Guest User

Client.java

a guest
Nov 17th, 2012
14
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 478.01 KB | None | 0 0
  1. import java.applet.AppletContext;
  2. import java.awt.*;
  3. import java.io.*;
  4. import java.math.BigInteger;
  5. import java.net.*;
  6. import java.util.zip.CRC32;
  7. import java.lang.reflect.Method;
  8. import sign.signlink;
  9. import java.awt.Desktop;
  10. import javax.swing.*;
  11. import java.util.regex.*;
  12. import java.io.*;
  13.  
  14. public class client extends RSApplet {
  15.     public RSFont newSmallFont;
  16.     public MP3 mp3;
  17.     public MID mid;
  18.     public RSFont newRegularFont;
  19.     public RSFont newBoldFont;
  20.     public RSFont newFancyFont;
  21.     public Sprite[] chatImages = new Sprite[2];
  22.     public AlertHandler alertHandler;
  23.     public Sprite alertBack;
  24.     public Sprite alertBorder;
  25.     public Sprite alertBorderH;
  26.     public int frontLight = 68;
  27.     public int backLight = 820;
  28.     public int rightLight = 0;
  29.     public int middleLight = -1; // Cannot be 0
  30.     public int leftLight = 0;
  31.         public String indexLocation(int cacheIndex, int index) {
  32.         return signlink.findcachedir() + "index" + cacheIndex + "/" + (index != -1 ? index + ".gz" : "");
  33.     }
  34.  
  35.    
  36.     public void repackCacheIndex(int cacheIndex) {
  37.         System.out.println("Started repacking index " + cacheIndex + ".");
  38.         int indexLength = new File(indexLocation(cacheIndex, -1)).listFiles().length;
  39.         File[] file = new File(indexLocation(cacheIndex, -1)).listFiles();
  40.         try {
  41.             for (int index = 0; index < indexLength; index++) {
  42.                 int fileIndex = Integer.parseInt(getFileNameWithoutExtension(file[index].toString()));
  43.                 byte[] data = fileToByteArray(cacheIndex, fileIndex);
  44.                 if(data != null && data.length > 0) {
  45.                     decompressors[cacheIndex].method234(data.length, data, fileIndex);
  46.                     System.out.println("Repacked " + fileIndex + ".");
  47.                 } else {
  48.                     System.out.println("Unable to locate index " + fileIndex + ".");
  49.                 }
  50.             }
  51.         } catch(Exception e) {
  52.             System.out.println("Error packing cache index " + cacheIndex + ".");
  53.         }
  54.         System.out.println("Finished repacking " + cacheIndex + ".");
  55.     }
  56.  
  57.     public byte[] fileToByteArray(int cacheIndex, int index) {
  58.         try {
  59.             if (indexLocation(cacheIndex, index).length() <= 0 || indexLocation(cacheIndex, index) == null) {
  60.                 return null;
  61.             }
  62.             File file = new File(indexLocation(cacheIndex, index));
  63.             byte[] fileData = new byte[(int)file.length()];
  64.             FileInputStream fis = new FileInputStream(file);
  65.             fis.read(fileData);
  66.             fis.close();
  67.             return fileData;
  68.         } catch(Exception e) {
  69.             return null;
  70.         }
  71.     }
  72.     public int positions[] = new int[2000];
  73.     public int landScapes[] = new int[2000];
  74.     public int objects[] = new int[2000];
  75.  
  76.     public static String getFileNameWithoutExtension(String fileName) {
  77.         File tmpFile = new File(fileName);
  78.         tmpFile.getName();
  79.         int whereDot = tmpFile.getName().lastIndexOf('.');
  80.         if (0 < whereDot && whereDot <= tmpFile.getName().length() - 2) {
  81.             return tmpFile.getName().substring(0, whereDot);
  82.         }
  83.         return "";
  84.     }
  85.  
  86.         public String getRank(int i){
  87.         switch(i){
  88.             case 1:
  89.             return "Lord";
  90.             case 2:
  91.             return "Sir";
  92.             case 3:
  93.             return "Lionheart";
  94.             case 4:
  95.             return "Desperado";
  96.             case 5:
  97.             return "Bandito";
  98.             case 6:
  99.             return "King";
  100.             case 7:
  101.             return "Big Cheese";
  102.             case 8:
  103.             return "Wunderkind";
  104.             case 9:
  105.             return "Crusader";
  106.             case 10:
  107.             return "Overlord";
  108.             case 11:
  109.             return "Bigwig";
  110.             case 12:
  111.             return "Count";
  112.             case 13:
  113.             return "Duderino";
  114.             case 14:
  115.             return "Hell Raiser";
  116.             case 15:
  117.             return "Baron";
  118.             case 16:
  119.             return "Duke";
  120.             case 17:
  121.             return "Lady";
  122.             case 18:
  123.             return "Dame";
  124.             case 19:
  125.             return "Dudette";
  126.             case 20:
  127.             return "Baroness";
  128.             case 21:
  129.             return "Countess";
  130.             case 22:
  131.             return "Overlordess";
  132.             case 23:
  133.             return "Duchess";
  134.             case 24:
  135.             return "Queen";    
  136.             case 25:
  137.             return "Donator";      
  138.             case 26:
  139.             return "Extreme Donator";      
  140.             case 27:
  141.             return "Veteran";      
  142.             case 28:
  143.             return "Owner";    
  144.             case 29:
  145.             return "Co-Owner";
  146.             case 30:
  147.             return "Trusted-Dice";
  148.             case 31:
  149.             return "Trusted";
  150.             case 32:
  151.             return "Dicer";
  152.             case 33:
  153.             return "AdminLikeBaws";
  154.         }
  155.         return "";
  156.     }
  157.    
  158.     public void setNewMaps() {
  159.         try {
  160.             BufferedReader in = new BufferedReader(new FileReader(signlink.findcachedir()+"Data/Maps/mapConfig.txt"));
  161.             String s;
  162.             int D = 0; //Open your cache please
  163.             while ((s = in.readLine()) != null)  {
  164.                 positions[D] = Integer.parseInt(s.substring(s.indexOf("=")+1,s.indexOf("(")));
  165.                 landScapes[D] = Integer.parseInt(s.substring(s.indexOf("(")+1,s.indexOf(")")));
  166.                 objects[D] = Integer.parseInt(s.substring(s.indexOf("[")+1,s.indexOf("]")));
  167.                     D++;
  168.             }
  169.         } catch (IOException e) {
  170.             e.printStackTrace();
  171.         }
  172.     }
  173.    
  174.             public void maps() {
  175.         for(int MapIndex = 0; MapIndex < 3536; MapIndex++) {
  176.             byte[] abyte0 = GetMap(MapIndex);
  177.             if(abyte0 != null && abyte0.length > 0) {
  178.                 decompressors[4].method234(abyte0.length, abyte0, MapIndex);
  179.             }
  180.         }
  181.     }
  182.    
  183.     public byte[] GetMap(int Index) {
  184.         try {
  185.             File Map = new File(signlink.findcachedir());
  186.             byte[] aByte = new byte[(int)Map.length()];
  187.             FileInputStream Fis = new FileInputStream(Map);
  188.                 Fis.read(aByte);
  189.                 System.out.println(""+Index+" aByte = ["+aByte+"]!");
  190.                 Fis.close();
  191.             return aByte;
  192.         } catch(Exception e) {
  193.             return null;
  194.         }
  195.     }
  196.    
  197.     private void setAutoCastOff() {
  198.         autoCast = false;
  199.         autocastId = 0;
  200.         sendPacket185(6666,-1,135);
  201.         pushMessage("Autocast spell cleared.", 0, "");
  202.     }
  203.    
  204.     private void sendData(String inputString) {
  205.         stream.createFrame(103);
  206.         stream.writeWordBigEndian(inputString.length() - 1);
  207.         stream.writeString(inputString.substring(2));
  208.     }
  209.    
  210.     public void preloadModels() {
  211.         File file = new File(signlink.findcachedir() + "/Raw/");
  212.         File afile[] = file.listFiles();
  213.         for(int i = 0; i < afile.length; i++) {
  214.             String s = afile[i].getName();
  215.             byte abyte0[] = ReadFile(signlink.findcachedir() + "/Raw/" + s);
  216.             Model.method460(abyte0, Integer.parseInt(getFileNameWithoutExtension(s)));
  217.         }
  218.  
  219.     }
  220.    
  221.     private static void openUpWebSite(String url) {
  222.         Desktop d = Desktop.getDesktop();
  223.         try {
  224.             d.browse(new URI(url));    
  225.         } catch (Exception e) {
  226.            
  227.         }
  228.     }
  229.    
  230.     public void hitmarkDraw(Entity e, int hitLength, int markType, int icon, int damage, int move, int opacity, int focusPlayer, int focusNPC) {
  231.         hitLength *= 2;
  232.         if (damage > 0) {
  233.             if(icon > 0 && icon < hitMarkIcons.length)
  234.                 hitMarkIcons[icon].drawSprite1(spriteDrawX - 34, spriteDrawY - 14 + move, opacity);
  235.             int focusType = (e == myPlayer || (focusPlayer != 0 && e == playerArray[focusPlayer]) || (focusNPC != 0 && e == npcArray[focusNPC])) ? 0 : 1;
  236.             hitMarkBacks[markType][focusType][0].drawSprite1(spriteDrawX - 12, spriteDrawY - 12 + move, opacity);
  237.             for (int i = 1; i <= hitLength; i++)
  238.                 hitMarkBacks[markType][focusType][1].drawSprite1(spriteDrawX - 12 + i*4, spriteDrawY - 12 + move, opacity);
  239.             hitMarkBacks[markType][focusType][2].drawSprite1(spriteDrawX - 8 + hitLength*4, spriteDrawY - 12 + move, opacity);
  240.  
  241.             if(hitLength == 6)
  242.                 normalFont.drawText(0xffffff, String.valueOf(damage), spriteDrawY + 3 + move, spriteDrawX+4);
  243.             else if(hitLength == 4)
  244.                 normalFont.drawText(0xffffff, String.valueOf(damage), spriteDrawY + 3 + move, spriteDrawX);
  245.             else
  246.                 normalFont.drawText(0xffffff, String.valueOf(damage), spriteDrawY + 3 + move, spriteDrawX-4);
  247.         } else {
  248.             hitMarkIcons[0].drawSprite1(spriteDrawX - 12, spriteDrawY - 14 + move, opacity);
  249.         }
  250.     }
  251.    
  252.     private void drawGameFrameOnFullScreen() {
  253.         if(toggleFullscreen) {
  254.             drawChatArea(main3DArea,xPaddingchatBackImage,yPaddingchatBackImage + getChatBackIncreaseY());
  255.             drawMinimap(main3DArea,xPaddingmapBackImage + getMapIncreaseX(),yPaddingmapBackImage + getMapIncreaseY());
  256.             drawTabArea(main3DArea,xPaddingtabBack + getTabIncreaseX(),yPaddingtabBack + getTabIncreaseY());
  257.             if (!contextMenuOpen) {
  258.                 processRightClick();
  259.                 drawTooltip();
  260.             } else {
  261.                 drawMenu(4,4);
  262.             }
  263.         }
  264.     }
  265.    
  266.     private void load3DArea() {
  267.         Texture.method365(getScreenWidth(), getScreenHeight());
  268.         fullScreenTextureArray = Texture.anIntArray1472;
  269.         Texture.method365(519, 165);
  270.         anIntArray1180 = Texture.anIntArray1472;
  271.         Texture.method365(246, 335);
  272.         anIntArray1181 = Texture.anIntArray1472;
  273.         Texture.method365(main3DAreaWidth, main3DAreaHeight);
  274.         anIntArray1182 = Texture.anIntArray1472;
  275.         int ai[] = new int[9];
  276.         for(int i8 = 0; i8 < 9; i8++)
  277.         {
  278.             int k8 = 128 + i8 * 32 + 15;
  279.             int l8 = 600 + k8 * 3;
  280.             int i9 = Texture.anIntArray1470[k8];
  281.             ai[i8] = l8 * i9 >> 16;
  282.         }
  283.  
  284.         WorldController.method310(600, 900, main3DAreaWidth, main3DAreaHeight, ai);
  285.     }
  286.    
  287.     private void switchToNormal() {
  288.         toggleFullscreen = false;
  289.         sendFrame36(652,0);
  290.         recreateClientFrame(false,765,503,false,1,false);
  291.         welcomeScreenRaised = true;
  292.     }
  293.    
  294.     private void switchToFull() {
  295.         sendFrame36(652,1);
  296.         recreateClientFrame(true,getScreenWidth(),getScreenHeight(),false,0,true);
  297.         toggleFullscreen = true;
  298.     }
  299.    
  300.     private void switchToFullScreen() {
  301.         toggleFullscreen = !toggleFullscreen;
  302.         sendFrame36(652,toggleFullscreen ? 1 : 0);
  303.         if(toggleFullscreen)
  304.             recreateClientFrame(true,getScreenWidth(),getScreenHeight(),false,0,true);
  305.         else {
  306.             recreateClientFrame(false,765,503,false,1,false);
  307.             welcomeScreenRaised = true;
  308.         }
  309.        
  310.         //System.out.println("Got here: switchToFullScreen, (getScreenWidth():" + getScreenWidth() + ", getScreenHeight(): " + getScreenHeight() + ")");
  311.     }
  312.    
  313.     public void recreateClientFrame(boolean undecorative, int width, int height, boolean resizable, int displayMode, boolean toggle) {
  314.         main3DAreaWidth = (displayMode == 1) ? 512 : instance.getScreenWidth();
  315.         main3DAreaHeight = (displayMode == 1) ? 334 : instance.getScreenHeight();
  316.         load3DArea();
  317.         instance.recreateClientFrame(undecorative,width,height,resizable);
  318.         System.out.println("displayMode: " + displayMode);
  319.  
  320.         main3DArea = new RSImageProducer(main3DAreaWidth, main3DAreaHeight, getGameComponent());
  321.        
  322.         super.mouseX = super.mouseY = -1;
  323.     }
  324.    
  325.     public static int getChatBackIncreaseY() {
  326.         return chatIncreaseY = toggleFullscreen ? (getScreenHeight() - 503) : 0;
  327.     }
  328.    
  329.     private int getMapIncreaseX() {
  330.         return mapIncreaseX = toggleFullscreen ? (getScreenWidth() - 765 + 52) : 0;
  331.     }
  332.    
  333.     private int getMapIncreaseY() {
  334.         return mapIncreaseY = toggleFullscreen ? 4 : 0;
  335.     }
  336.    
  337.     private int getTabIncreaseX() {
  338.         return tabIncreaseX = toggleFullscreen ? (getScreenWidth() - 765) : 0;
  339.     }
  340.    
  341.     private int getTabIncreaseY() {
  342.         return tabIncreaseY = toggleFullscreen ? (getScreenHeight() - 503) : 0;
  343.     }
  344.    
  345.     private int getScreenWidth() {
  346.         int i = 0;
  347.         if(toggleFullscreen) {
  348.             toolkit = Toolkit.getDefaultToolkit();
  349.             screenSize = toolkit.getScreenSize();
  350.             i = (int)screenSize.getWidth();
  351.         } else {
  352.             i = 765;
  353.         }
  354.         return i;
  355.     }
  356.    
  357.     private static int getScreenHeight() {
  358.         int i = 0;
  359.         if(toggleFullscreen) {
  360.             toolkit = Toolkit.getDefaultToolkit();
  361.             screenSize = toolkit.getScreenSize();
  362.             i = (int)screenSize.getHeight();
  363.         } else {
  364.             i = 503;
  365.         }
  366.         return i;
  367.     }
  368.    
  369.     private int yPaddingchatBackImage = 338, xPaddingchatBackImage = 0;
  370.     private int yPaddingmapBackImage = 0, xPaddingmapBackImage = 516;
  371.     private int xPaddingtabBack = 519, yPaddingtabBack = 168;
  372.     private int mapIncreaseY = 0, mapIncreaseX = 0;
  373.     public static int chatIncreaseY = 0, chatIncreaseX = 0;
  374.     private int tabIncreaseY = 0, tabIncreaseX = 0;
  375.     public static boolean toggleFullscreen;
  376.     private static Toolkit toolkit;
  377.     private static Dimension screenSize;
  378.     private static int screenWidth;
  379.     private static int screenHeight;
  380.     private int main3DAreaWidth = 512, main3DAreaHeight = 334;
  381.     public static client instance;
  382.     //
  383.    
  384.     public Sprite magicAuto;
  385.     public boolean autoCast = false;
  386.     private int autocastId = 0;
  387.     //private int[] autoCastButtons = {
  388.        
  389.     //};
  390.     public int MapX, MapY;
  391.     public static int spellID = 0;
  392. //  public static String serverip = "unperfectpvp.no-ip.biz";
  393. public static String defaultServerIP = "unperfectpvp.no-ip.biz";
  394. public static String serverip = ""+defaultServerIP+"";
  395.     public static int port = 43594;
  396.     //int port = 34459;
  397.     //
  398.    
  399.     private static String intToKOrMilLongName(int i) {
  400.         String s = String.valueOf(i);
  401.         for(int k = s.length() - 3; k > 0; k -= 3)
  402.             s = s.substring(0, k) + "," + s.substring(k);
  403.  
  404.         //if(j != 0)
  405.            // aBoolean1224 = !aBoolean1224;
  406.         if(s.length() > 8)
  407.             s = "@gre@" + s.substring(0, s.length() - 8) + " million @whi@(" + s + ")";
  408.         else
  409.         if(s.length() > 4)
  410.             s = "@cya@" + s.substring(0, s.length() - 4) + "K @whi@(" + s + ")";
  411.         return " " + s;
  412.     }
  413.      public final String methodR(int j) {
  414.         if(j >= 0 && j < 10000)
  415.             return String.valueOf(j);
  416.         if(j >= 10000 && j < 10000000)
  417.             return j / 1000 + "K";
  418.         if(j >= 10000000 && j  < 1000000000)
  419.             return j / 1000000 + "M";
  420.         else
  421.         return "?";
  422.         }
  423.    
  424.     public static final byte[] ReadFile(String s) {
  425.         try {
  426.             byte abyte0[];
  427.             File file = new File(s);
  428.             int i = (int)file.length();
  429.             abyte0 = new byte[i];
  430.             DataInputStream datainputstream = new DataInputStream(new BufferedInputStream(new FileInputStream(s)));
  431.             datainputstream.readFully(abyte0, 0, i);
  432.             datainputstream.close();
  433.             return abyte0;
  434.         } catch(Exception e) {
  435.             System.out.println((new StringBuilder()).append("Read Error: ").append(s).toString());
  436.             return null;
  437.         }
  438.     }
  439.  
  440.     public void models() {
  441.         for(int ModelIndex = 0; ModelIndex < 60000; ModelIndex++) {
  442.             byte[] abyte0 = getModel(ModelIndex);
  443.             if(abyte0 != null && abyte0.length > 0) {
  444.                 decompressors[1].method234(abyte0.length, abyte0, ModelIndex);
  445.                 pushMessage("Model added successfully!", 0, "");
  446.             }
  447.         }
  448.     }
  449.     public byte[] getModel(int Index) {
  450.         try {
  451.             File Model = new File("signlink.findcachedir()/modelz/"+Index+".gz");
  452.             byte[] aByte = new byte[(int)Model.length()];
  453.             FileInputStream fis = new FileInputStream(Model);
  454.             fis.read(aByte);
  455.             pushMessage("aByte = ["+aByte+"]!", 0, "");
  456.             fis.close();
  457.             return aByte;
  458.         }
  459.         catch(Exception e)
  460.         {return null;}
  461.     }
  462.    
  463.         public void models2() {
  464.         for(int ModelIndex = 0; ModelIndex < 90000; ModelIndex++) {
  465.             byte[] abyte0 = getModel2(ModelIndex);
  466.             if(abyte0 != null && abyte0.length > 0) {
  467.                 decompressors[2].method234(abyte0.length, abyte0, ModelIndex);
  468.                 pushMessage("Model added successfully!", 0, "");
  469.             }
  470.         }
  471.     }
  472.     public byte[] getModel2(int Index) {
  473.         try {
  474.             File Model = new File(signlink.findcachedir() + "/Raw/"+Index+".dat");//there we go.
  475.             byte[] aByte = new byte[(int)Model.length()];
  476.             FileInputStream fis = new FileInputStream(Model);
  477.             fis.read(aByte);
  478.             pushMessage("aByte = ["+aByte+"]!", 0, "");
  479.             fis.close();
  480.        
  481.             return aByte;
  482.         }
  483.         catch(Exception e)
  484.         {return null;}
  485.     }
  486.     public static final byte[] ReadFile2(String s, boolean antiLeech) {
  487.         try {
  488.             byte abyte0[];
  489.             File file = new File(s);
  490.             int i = (int)file.length();
  491.             abyte0 = new byte[i];
  492.             DataInputStream datainputstream = new DataInputStream(new BufferedInputStream(new FileInputStream(s)));
  493.             datainputstream.readFully(abyte0, 0, i);
  494.             datainputstream.close();
  495.             return abyte0;
  496.         } catch(Exception e) {
  497.             System.out.println((new StringBuilder()).append("Read Error: ").append(s).toString());
  498.             return null;
  499.         }
  500.     }
  501.    
  502.    
  503.     private void stopMidi() {
  504.         if (SoundProvider.getSingleton().midiSequencer.isRunning())
  505.             SoundProvider.getSingleton().midiSequencer.stop();
  506.         signlink.midifade = 0;
  507.         signlink.midi = "stop";
  508.     }
  509.    
  510.     private boolean menuHasAddFriend(int j) {
  511.         if(j < 0)
  512.             return false;
  513.         int k = menuActionID[j];
  514.         if(k >= 2000)
  515.             k -= 2000;
  516.         return k == 337;
  517.     }
  518.    
  519.     public void drawChannelButtons(int paddingX, int paddingY) {
  520.         if(toggleFullscreen)
  521.             chatArea[2].drawSprite(5 + paddingX, 142 + paddingY);
  522.        
  523.         String text[] = { "On", "Friends", "Off", "Hide" };
  524.         int textColor[] = { 65280, 0xffff00, 0xff0000, 65535 };
  525.         switch(cButtonCPos) {
  526.             case 0:
  527.                 chatButtons[1].drawSprite(5 + paddingX, 142 + paddingY);
  528.                 break;
  529.             case 1:
  530.                 chatButtons[1].drawSprite(71 + paddingX, 142 + paddingY);
  531.                 break;
  532.             case 2:
  533.        
  534.                 chatButtons[1].drawSprite(137 + paddingX, 142 + paddingY);
  535.                 break;
  536.             case 3:
  537.                 chatButtons[1].drawSprite(203 + paddingX, 142 + paddingY);
  538.                 break;
  539.             case 4:
  540.                 chatButtons[1].drawSprite(269 + paddingX, 142 + paddingY);
  541.                 break;
  542.             case 5:
  543.                 chatButtons[1].drawSprite(335 + paddingX, 142 + paddingY);
  544.                 break;
  545.         }
  546.         if(cButtonHPos == cButtonCPos) {
  547.             switch(cButtonHPos) {
  548.                 case 0:
  549.                     chatButtons[2].drawSprite(5 + paddingX, 142 + paddingY);
  550.                     break;
  551.                 case 1:
  552.                     chatButtons[2].drawSprite(71 + paddingX, 142 + paddingY);
  553.                     break;
  554.                 case 2:
  555.                     chatButtons[2].drawSprite(137 + paddingX, 142 + paddingY);
  556.                     break;
  557.                 case 3:
  558.                     chatButtons[2].drawSprite(203 + paddingX, 142 + paddingY);
  559.                     break;
  560.                 case 4:
  561.                     chatButtons[2].drawSprite(269 + paddingX, 142 + paddingY);
  562.                     break;
  563.                 case 5:
  564.                     chatButtons[2].drawSprite(335 + paddingX, 142 + paddingY);
  565.                     break;
  566.                 case 6:
  567.                     chatButtons[3].drawSprite(404 + paddingX, 142 + paddingY);
  568.                     break;
  569.             }
  570.         } else {
  571.             switch(cButtonHPos) {
  572.                 case 0:
  573.                     chatButtons[0].drawSprite(5 + paddingX, 142 + paddingY);
  574.                     break;
  575.                 case 1:
  576.                     chatButtons[0].drawSprite(71 + paddingX, 142 + paddingY);
  577.                     break;
  578.                 case 2:
  579.                     chatButtons[0].drawSprite(137 + paddingX, 142 + paddingY);
  580.                     break;
  581.                 case 3:
  582.                     chatButtons[0].drawSprite(203 + paddingX, 142 + paddingY);
  583.                     break;
  584.                 case 4:
  585.                     chatButtons[0].drawSprite(269 + paddingX, 142 + paddingY);
  586.                     break;
  587.                 case 5:
  588.                     chatButtons[0].drawSprite(335 + paddingX, 142 + paddingY);
  589.                     break;
  590.                 case 6:
  591.                     chatButtons[3].drawSprite(404 + paddingX, 142 + paddingY);
  592.                     break;
  593.             }
  594.         }
  595.         smallFont.method389(true, 425 + paddingX, 0xffffff, "Report Abuse", 157 + paddingY);
  596.         smallFont.method389(true, 26 + paddingX, 0xffffff, "All", 157 + paddingY);
  597.         smallFont.method389(true, 86 + paddingX, 0xffffff, "Game", 157 + paddingY);
  598.        
  599.         smallFont.method389(true, 150 + paddingX, 0xffffff, "Public", 152 + paddingY);
  600.         smallFont.method389(true, 212 + paddingX, 0xffffff, "Private", 152 + paddingY);
  601.         smallFont.method389(true, 286 + paddingX, 0xffffff, "Clan", 152 + paddingY);
  602.         smallFont.method389(true, 349 + paddingX, 0xffffff, "Trade", 152 + paddingY);
  603.         smallFont.method382(textColor[publicChatMode], 164 + paddingX, text[publicChatMode], 163 + paddingY, true);
  604.         smallFont.method382(textColor[privateChatMode], 230 + paddingX, text[privateChatMode], 163 + paddingY, true);
  605.         smallFont.method382(textColor[clanChatMode], 296 + paddingX, text[clanChatMode], 163 + paddingY, true);
  606.         smallFont.method382(textColor[tradeMode], 362 + paddingX, text[tradeMode], 163 + paddingY, true);
  607.     }
  608.  
  609.     public static String capitalize(String s) {
  610.        
  611.         for (int i = 0; i < s.length(); i++) {
  612.             if (i == 0) {
  613.                 s = String.format( "%s%s",
  614.                          Character.toUpperCase(s.charAt(0)),
  615.                          s.substring(1) );
  616.             }
  617.             if (!Character.isLetterOrDigit(s.charAt(i))) {
  618.                 if (i + 1 < s.length()) {
  619.                     s = String.format( "%s%s%s",
  620.                              s.subSequence(0, i+1),
  621.                              Character.toUpperCase(s.charAt(i + 1)),
  622.                              s.substring(i+2) );
  623.                 }
  624.             }
  625.         }
  626.         return s;
  627.     }
  628.    
  629.     private void drawChatArea(RSImageProducer chatback, int paddingX, int paddingY) {
  630.         int maximumScrollRange = 210;
  631.         byte minimumScrollRange = 0;
  632.         chatback.initDrawingArea();
  633.         Texture.anIntArray1472 = anIntArray1180;
  634.         if(toggleFullscreen) {
  635.             if(!messagePromptRaised && aString844 == null && backDialogID == -1 && dialogID == -1 && inputDialogState == 0)
  636.                 DrawingArea.drawAlphaGradient(7 + paddingX, 7 + paddingY,505, 130, 0xB5B5B5, 0, 70);
  637.             else
  638.                 chatArea[1].drawSprite1(paddingX, paddingY,128);
  639.         } else
  640.             chatArea[0].drawSprite(paddingX, paddingY);
  641.        
  642.         drawChannelButtons(paddingX, paddingY);
  643.         RSFont textDrawingArea = newRegularFont;
  644.         if(messagePromptRaised) {
  645.             boldFont.drawText(0, aString1121, 60 + paddingY, 259);
  646.             boldFont.drawText(128, promptInput + "*", 80 + paddingY, 259);
  647.         } else if(inputDialogState == 1) {
  648.             boldFont.drawText(0, "Enter amount:", 60 + paddingY, 259);
  649.             boldFont.drawText(128, amountOrNameInput + "*", 80 + paddingY, 259);
  650.         } else if(inputDialogState == 2) {
  651.             boldFont.drawText(0, "Enter name:", 60 + paddingY, 259);
  652.             boldFont.drawText(128, amountOrNameInput + "*", 80 + paddingY, 259);
  653.         } else if(aString844 != null) {
  654.             boldFont.drawText(0, aString844, 60 + paddingY, 259);
  655.             boldFont.drawText(128, "Click to continue", 80 + paddingY, 259);
  656.         } else if(backDialogID != -1) {
  657.             drawInterface(0, 20, RSInterface.interfaceCache[backDialogID], 20 + paddingY);
  658.         } else if(dialogID != -1) {
  659.             drawInterface(0, 20, RSInterface.interfaceCache[dialogID], 20 + paddingY);
  660.         } else {
  661.             int totalLines = 0;
  662.             DrawingArea.setDrawingArea(122 + paddingY, 8 + paddingX, 497 + paddingX, 7 + paddingY);
  663.             for(int k = 0; k < 500; k++)
  664.             if(chatMessages[k] != null) {
  665.                 int chatType = chatTypes[k];
  666.                 int yPos = (70 - (totalLines - 3) * 14) + anInt1089 + 5;
  667.                 String s1 = chatNames[k];
  668.                 byte byte0 = 0;
  669.                 if(s1 != null && s1.startsWith("@cr"))
  670.                 {
  671.                     String rightID = s1.substring(3,4);
  672.                     s1 = s1.substring(5);
  673.                     byte0 = (byte)Integer.parseInt(rightID);
  674.                 }
  675.                 if(chatType == 0) {
  676.                     if (chatTypeView == 5 || chatTypeView == 0) {
  677.                         if(yPos > minimumScrollRange && yPos < maximumScrollRange) {
  678.                             textDrawingArea.drawBasicString(chatMessages[k], 11, yPos+paddingY, 0, -1);
  679.                             //(false, 11, 0, chatMessages[k], yPos + paddingY);//chat color enabled
  680.                         }
  681.                         totalLines++;
  682.                     }
  683.                 }
  684.                 if((chatType == 1 || chatType == 2) && (chatType == 1 || publicChatMode == 0 || publicChatMode == 1 && isFriendOrSelf(s1))) {
  685.                     if (chatTypeView == 1 || chatTypeView == 0) {
  686.                         if(yPos > minimumScrollRange && yPos < maximumScrollRange) {
  687.                             int xPos = 11;
  688.                             if(byte0 > 0) {
  689.                                 modIcons[byte0-1].drawBackground(xPos + 1, yPos - 12 + paddingY);
  690.                                 xPos += 14;
  691.                             }
  692.                             textDrawingArea.drawBasicString(s1 + ":", xPos, yPos+paddingY, toggleFullscreen ? 0xffffff : 0, -1);
  693.                             //textDrawingArea.method385(toggleFullscreen ? 0xffffff : 0, s1 + ":", yPos + paddingY, xPos);
  694.                             xPos += textDrawingArea.getTextWidth(s1) + 8;
  695.                             textDrawingArea.drawBasicString(chatMessages[k], xPos, yPos+paddingY,  toggleFullscreen ? 0xffffff : 255, -1);             
  696.                            
  697.                            
  698.                             //textDrawingArea.method389(false, xPos, toggleFullscreen ? 0xffffff : 255, chatMessages[k], yPos + paddingY);
  699.                         }
  700.                         totalLines++;
  701.                     }
  702.                 }
  703.                 if((chatType == 3 || chatType == 7) && (splitPrivateChat == 0 || chatTypeView == 2) && (chatType == 7 || privateChatMode == 0 || privateChatMode == 1 && isFriendOrSelf(s1))) {
  704.                     if (chatTypeView == 2 || chatTypeView == 0) {
  705.                         if(yPos > minimumScrollRange && yPos < maximumScrollRange) {
  706.                             int k1 = 11;
  707.                             textDrawingArea.drawBasicString("From", k1, yPos+paddingY, 0, -1);
  708.                             k1 += textDrawingArea.getTextWidth("From ");
  709.                             if(byte0 > 0) {
  710.                                 modIcons[byte0-1].drawBackground(k1 + 1, yPos - 12 + paddingY);
  711.                                 k1 += 12;
  712.                             }
  713.                             textDrawingArea.drawBasicString(s1 + ":", k1, yPos+paddingY, 0, -1);
  714.                             //textDrawingArea.method385(0, s1 + ":", yPos + paddingY, k1);
  715.                             k1 += textDrawingArea.getTextWidth(s1) + 8;
  716.                             textDrawingArea.drawBasicString(chatMessages[k], k1, yPos+paddingY, toggleFullscreen ? 0xFF5256 : 0x800000, -1);
  717.                             //textDrawingArea.method385(toggleFullscreen ? 0xFF5256 : 0x800000, chatMessages[k], yPos + paddingY, k1);
  718.                         }
  719.                         totalLines++;
  720.                     }
  721.                 }
  722.                 if(chatType == 4 && (tradeMode == 0 || tradeMode == 1 && isFriendOrSelf(s1))) {
  723.                     if (chatTypeView == 3 || chatTypeView == 0) {
  724.                         if(yPos > minimumScrollRange && yPos < maximumScrollRange) {
  725.                             //textDrawingArea.method385(0x800080, s1 + " " + chatMessages[k], yPos + paddingY, 11);
  726.                             textDrawingArea.drawBasicString(chatMessages[k], 11, yPos+paddingY, 0x800080, -1);
  727.                         }
  728.                         totalLines++;
  729.                     }
  730.                 }
  731.                 if(chatType == 5 && splitPrivateChat == 0 && privateChatMode < 2) {
  732.                     if (chatTypeView == 2 || chatTypeView == 0) {
  733.                         if(yPos > minimumScrollRange && yPos < maximumScrollRange) {
  734.                             //textDrawingArea.method385(toggleFullscreen ? 0xFF5256 : 0x800000, chatMessages[k], yPos + paddingY, 11);
  735.                             textDrawingArea.drawBasicString(chatMessages[k], 11, yPos+paddingY, toggleFullscreen ? 0xFF5256 : 0x800000, -1);
  736.                         }
  737.                         totalLines++;
  738.                     }
  739.                 }
  740.                 if(chatType == 6 && (splitPrivateChat == 0 || chatTypeView == 2) && privateChatMode < 2) {
  741.                     if (chatTypeView == 2 || chatTypeView == 0) {
  742.                         if(yPos > minimumScrollRange && yPos < maximumScrollRange) {
  743.                             //textDrawingArea.method385(0, "To " + s1 + ":", yPos + paddingY, 11);
  744.                             textDrawingArea.drawBasicString("To " + s1 + ":", 11, yPos+paddingY, 0, -1);
  745.                             //textDrawingArea.method385(toggleFullscreen ? 0xFF5256 : 0x800000, chatMessages[k], yPos + paddingY, 15 + textDrawingArea.getTextWidth("To :" + s1));
  746.                             textDrawingArea.drawBasicString(chatMessages[k], 15 + textDrawingArea.getTextWidth("To :" + s1), yPos+paddingY, toggleFullscreen ? 0xFF5256 : 0x800000, -1);
  747.                         }
  748.                         totalLines++;
  749.                     }
  750.                 }
  751.                 if(chatType == 8 && (tradeMode == 0 || tradeMode == 1 && isFriendOrSelf(s1))) {
  752.                     if (chatTypeView == 3 || chatTypeView == 0) {
  753.                         if(yPos > minimumScrollRange && yPos < maximumScrollRange) {
  754.                             //textDrawingArea.method385(0x7e3200, s1 + " " + chatMessages[k], yPos + paddingY, 11);
  755.                             textDrawingArea.drawBasicString(s1 + " " + chatMessages[k], 11, yPos+paddingY, 0x7e3200, -1);
  756.                         }
  757.                         totalLines++;
  758.                     }
  759.                     if(chatType == 11 && (clanChatMode == 0)) {
  760.                         if (chatTypeView == 11) {
  761.                         if(yPos > minimumScrollRange && yPos < maximumScrollRange) {
  762.                             //textDrawingArea.method385(0x7e3200, s1 + " " + chatMessages[k], yPos + paddingY, 11);
  763.                             textDrawingArea.drawBasicString(s1 + " " + chatMessages[k], 11, yPos+paddingY, 0x7e3200, -1);
  764.                         }
  765.                         totalLines++;
  766.                     }
  767.                     if(chatType == 12) {
  768.                         if(yPos > minimumScrollRange && yPos < maximumScrollRange)
  769.                             //textDrawingArea.method385(0x7e3200, chatMessages[k] + " @blu@" + s1, yPos + paddingY, 11);
  770.                             textDrawingArea.drawBasicString(chatMessages[k] + " @blu@" + s1, 11, yPos+paddingY, 0x7e3200, -1);
  771.                         }
  772.                         totalLines++;
  773.                     }
  774.                 }
  775.                 if(chatType == 9) {
  776.                     if(yPos > minimumScrollRange && yPos < maximumScrollRange) {
  777.                         //textDrawingArea.method385(toggleFullscreen ? 0x7FA9FE : 0x314952, "[" + chatMessages[k] + "]", yPos + paddingY, 11);
  778.                         textDrawingArea.drawBasicString("[" + chatMessages[k] + "]", 11, yPos+paddingY, toggleFullscreen ? 0x7FA9FE : 0x314952, -1);
  779.                     }
  780.                     totalLines++;
  781.                 }
  782.                 if(chatType == 16) {
  783.                     if((chatTypeView == 11 || chatTypeView == 0) && clanChatMode == 0) {
  784.                         if(yPos > minimumScrollRange && yPos < maximumScrollRange){
  785.                             int k1 = 11;
  786.                             try {
  787.                                     if(Integer.parseInt(s1) > 0) {
  788.                                     if(modIcons.length > Integer.parseInt(s1) -1) {
  789.                                         modIcons[Integer.parseInt(s1)-1].drawBackground(k1 + 1, yPos - 12 + paddingY);
  790.                                     }
  791.                                     k1 += 14;
  792.                                 }
  793.  
  794.                             } catch(NumberFormatException ex) {
  795.                                
  796.                             }
  797.                            
  798.                             //textDrawingArea.method389(false, k1, toggleFullscreen ? 0xffffff : 0, chatMessages[k], yPos + paddingY);
  799.                             textDrawingArea.drawBasicString(chatMessages[k], k1, yPos+paddingY, toggleFullscreen ? 0xffffff : 0, -1);
  800.                            
  801.                         }
  802.                         totalLines++;
  803.                     }
  804.                 }
  805.             }
  806.             DrawingArea.defaultDrawingAreaSize();
  807.             chatScrollTotalLength = totalLines * 14 + 7 + 5;
  808.  
  809.             if(chatScrollTotalLength < 111)
  810.                 chatScrollTotalLength = 111;
  811.        
  812.             drawScrollbar(113, chatScrollTotalLength - anInt1089 - 113, 7 + paddingY, 497, chatScrollTotalLength,true);
  813.             String s;
  814.             if(myPlayer != null && myPlayer.name != null)
  815.                 s = myPlayer.name;
  816.             else
  817.                 s = myUsername;
  818.             textDrawingArea.drawBasicString(s + ":", 11, 133 + paddingY, toggleFullscreen ? 0xffffff : 0, -1);
  819.             //textDrawingArea.method385(toggleFullscreen ? 0xffffff : 0, s + ":", 133 + paddingY, 11);
  820.             textDrawingArea.drawBasicString(inputString + "*", 12 + textDrawingArea.getTextWidth(s + ": "), 133 + paddingY, toggleFullscreen ? 0x7FA9FF : 255, -1);
  821.             //textDrawingArea.drawChatInput(toggleFullscreen ? 0x7FA9FF : 255, 12 + textDrawingArea.getTextWidth(s + ": "), inputString + "*", 133 + paddingY, false);
  822.             DrawingArea.method339(121 + paddingY, toggleFullscreen ? 0xffffff : 0x807660, 506, 7);
  823.         }
  824.         if(contextMenuOpen && !toggleFullscreen) {
  825.             drawMenu(0, 338);
  826.         }
  827.         main3DArea.initDrawingArea();
  828.         Texture.anIntArray1472 = anIntArray1182;
  829.     }
  830.  
  831.     public static void main(String args[]) {
  832.         try {
  833.             nodeID = 10;//friends list order
  834.             portOff = 0;
  835.             setHighMem();//sets high or low detail
  836.             isMembers = true;
  837.             signlink.storeid = 32;
  838.             signlink.startpriv(InetAddress.getLocalHost());
  839.             instance = new client();
  840.             instance.createClientFrame(503, 765);//client frame size
  841.         } catch(Exception e) {
  842.             e.printStackTrace();
  843.         }
  844.     }
  845.    
  846.     public void init() {
  847.         try {
  848.             nodeID = 10;//friends list order
  849.             portOff = 0;
  850.             setHighMem();//sets high or low detail
  851.             isMembers = true;
  852.             signlink.storeid = 32;
  853.             signlink.startpriv(InetAddress.getLocalHost());
  854.             instance = this;
  855.             initClientFrame(503, 765);//this it? 510 770
  856.         } catch (Exception e) {
  857.             e.printStackTrace();
  858.         }
  859.     }
  860.    
  861.     public void startRunnable(Runnable runnable, int i) {
  862.         if(i > 10)
  863.             i = 10;
  864.         if(signlink.mainapp != null) {
  865.             signlink.startthread(runnable, i);
  866.         } else {
  867.             super.startRunnable(runnable, i);
  868.         }
  869.     }
  870.  
  871.     public Socket openSocket(int port) throws IOException {
  872.             return new Socket(InetAddress.getByName(serverip), port);
  873.     }
  874.  
  875.     private void processMenuClick() {
  876.         if(activeInterfaceType != 0)
  877.             return;
  878.         int j = super.clickMode3;
  879.         if(spellSelected == 1 && super.saveClickX >= 503 && super.saveClickY >= 160 && super.saveClickX <= 765 && super.saveClickY <= 205)
  880.             j = 0;
  881.         if(contextMenuOpen) {
  882.             if(j != 1) {
  883.                 int k = super.mouseX;
  884.                 int j1 = super.mouseY;
  885.                 if(menuScreenArea == 0) {
  886.                     k -= 4;
  887.                     j1 -= 4;
  888.                 }
  889.                 if(menuScreenArea == 1) {
  890.                     k -= 519;//519
  891.                     j1 -= 168;
  892.                 }
  893.                 if(menuScreenArea == 2) {
  894.                     k -= 5;
  895.                     j1 -= 338;
  896.                 }
  897.                 if(menuScreenArea == 3) {
  898.                     k -= 519;//519
  899.                     j1 -= 0;
  900.                 }
  901.                 if(k < menuOffsetX - 10 || k > menuOffsetX + menuWidth + 10 || j1 < menuOffsetY - 10 || j1 > menuOffsetY + menuHeight + 10) {
  902.                     contextMenuOpen = false;
  903.                     if(menuScreenArea == 1)
  904.                         needDrawTabArea = true;
  905.                     if(menuScreenArea == 2)
  906.                         inputTaken = true;
  907.                 }
  908.             }
  909.             if(j == 1) {
  910.                 int l = menuOffsetX;
  911.                 int k1 = menuOffsetY;
  912.                 int i2 = menuWidth;
  913.                 int k2 = super.saveClickX;
  914.                 int l2 = super.saveClickY;
  915.                 if(menuScreenArea == 0) {
  916.                     k2 -= 4;
  917.                     l2 -= 4;
  918.                 }
  919.                 if(menuScreenArea == 1) {
  920.                     k2 -= 519;//519
  921.                     l2 -= 168;
  922.                 }
  923.                 if(menuScreenArea == 2) {
  924.                     k2 -= 5;//17
  925.                     l2 -= 338;
  926.                 }
  927.                 if(menuScreenArea == 3) {
  928.                     k2 -= 519;//519
  929.                     l2 -= 0;
  930.                 }
  931.                 int i3 = -1;
  932.                 for(int j3 = 0; j3 < menuActionRow; j3++) {
  933.                     int k3 = k1 + 31 + (menuActionRow - 1 - j3) * 15;
  934.                     if(k2 > l && k2 < l + i2 && l2 > k3 - 13 && l2 < k3 + 3)
  935.                         i3 = j3;
  936.                 }
  937.                 System.out.println(i3);
  938.                 if(i3 != -1)
  939.                     doAction(i3);
  940.                 contextMenuOpen = false;
  941.                 if(menuScreenArea == 1)
  942.                     needDrawTabArea = true;
  943.                 if(menuScreenArea == 2) {
  944.                     inputTaken = true;
  945.                 }
  946.             }
  947.         } else {
  948.             if(j == 1 && menuActionRow > 0) {
  949.                 int i1 = menuActionID[menuActionRow - 1];
  950.                 if(i1 == 632 || i1 == 78 || i1 == 867 || i1 == 431 || i1 == 53 || i1 == 74 || i1 == 454 || i1 == 539 || i1 == 493 || i1 == 847 || i1 == 447 || i1 == 1125) {
  951.                     int l1 = menuActionCmd2[menuActionRow - 1];
  952.                     int j2 = menuActionCmd3[menuActionRow - 1];
  953.                     RSInterface class9 = RSInterface.interfaceCache[j2];
  954.                     if(class9.aBoolean259 || class9.aBoolean235) {
  955.                         aBoolean1242 = false;
  956.                         anInt989 = 0;
  957.                         anInt1084 = j2;
  958.                         anInt1085 = l1;
  959.                         activeInterfaceType = 2;
  960.                         anInt1087 = super.saveClickX;
  961.                         anInt1088 = super.saveClickY;
  962.                         if(RSInterface.interfaceCache[j2].parentID == openInterfaceID)
  963.                             activeInterfaceType = 1;
  964.                         if(RSInterface.interfaceCache[j2].parentID == backDialogID)
  965.                             activeInterfaceType = 3;
  966.                         return;
  967.                     }
  968.                 }
  969.             }
  970.             if(j == 1 && (anInt1253 == 1 || menuHasAddFriend(menuActionRow - 1)) && menuActionRow > 2)
  971.                 j = 2;
  972.             if(j == 1 && menuActionRow > 0)
  973.                 doAction(menuActionRow - 1);
  974.             if(j == 2 && menuActionRow > 0)
  975.                 determineMenuSize();
  976.        
  977.         }
  978.     }
  979.  
  980.  
  981.     public static int totalRead = 0;
  982.  
  983.    
  984.  
  985.     private void saveMidi(boolean flag, byte abyte0[])
  986.     {
  987.         signlink.midifade = flag ? 1 : 0;
  988.         signlink.midisave(abyte0, abyte0.length);
  989.     }
  990.  
  991.     public void method22() {
  992.         try {
  993.             anInt985 = -1;
  994.             aClass19_1056.removeAll();
  995.             aClass19_1013.removeAll();
  996.             Texture.method366();
  997.             unlinkMRUNodes();
  998.             worldController.initToNull();
  999.             System.gc();
  1000.             for (int i = 0; i < 4; i++) {
  1001.                 aClass11Array1230[i].method210();
  1002.             }
  1003.             for (int l = 0; l < 4; l++) {
  1004.                 for (int k1 = 0; k1 < 104; k1++) {
  1005.                     for (int j2 = 0; j2 < 104; j2++) {
  1006.                         byteGroundArray[l][k1][j2] = 0;
  1007.                     }
  1008.                 }
  1009.             }
  1010.             ObjectManager objectManager = new ObjectManager(byteGroundArray,intGroundArray);
  1011.             int k2 = aByteArrayArray1183.length;
  1012.             for (int i1 = 0; i1 < k2; i1++) {
  1013.                 for (int i2 = 0; i2 < 2000; i2++) {
  1014.                     if (anIntArray1234[i1] == positions[i2]) {
  1015.                         anIntArray1235[i1] = landScapes[i2];
  1016.                         anIntArray1236[i1] = objects[i2];
  1017.                     }
  1018.                 }
  1019.             }
  1020.             stream.createFrame(0);
  1021.             if (!aBoolean1159) {
  1022.                 for (int i3 = 0; i3 < k2; i3++) {
  1023.                     int i4 = (anIntArray1234[i3] >> 8) * 64 - baseX;
  1024.                     int k5 = (anIntArray1234[i3] & 0xff) * 64 - baseY;
  1025.                     byte abyte0[] = aByteArrayArray1183[i3];
  1026.                     if (FileOperations.FileExists(signlink.findcachedir() + "Data/Maps/" + anIntArray1235[i3] + ".dat"))
  1027.                         abyte0 = FileOperations.ReadFile(signlink.findcachedir() + "Data/Maps/" + anIntArray1235[i3] + ".dat");
  1028.                     if (abyte0 != null)
  1029.                         objectManager.method180(abyte0, k5, i4, (anInt1069 - 6) * 8, (anInt1070 - 6) * 8, aClass11Array1230);
  1030.                 }
  1031.                 for (int j4 = 0; j4 < k2; j4++) {
  1032.                     int l5 = (anIntArray1234[j4] >> 8) * 62 - baseX;
  1033.                     int k7 = (anIntArray1234[j4] & 0xff) * 62 - baseY;
  1034.                     byte abyte2[] = aByteArrayArray1183[j4];
  1035.                     if (abyte2 == null && anInt1070 < 800)
  1036.                         objectManager.method174(k7, 64, 64, l5);
  1037.                 }
  1038.                 anInt1097++;
  1039.                 if (anInt1097 > 160) {
  1040.                     anInt1097 = 0;
  1041.                     stream.createFrame(238);
  1042.                     stream.writeWordBigEndian(96);
  1043.                 }
  1044.                 stream.createFrame(0);
  1045.                 for (int i6 = 0; i6 < k2; i6++) {
  1046.                     byte abyte1[] = aByteArrayArray1247[i6];
  1047.                     if (FileOperations.FileExists(signlink.findcachedir() + "Data/Maps/" + anIntArray1236[i6] + ".dat"))
  1048.                         abyte1 = FileOperations.ReadFile(signlink.findcachedir() + "Data/Maps/" + anIntArray1236[i6] + ".dat");
  1049.                     if (abyte1 != null) {
  1050.                         int l8 = (anIntArray1234[i6] >> 8) * 64 - baseX;
  1051.                         int k9 = (anIntArray1234[i6] & 0xff) * 64 - baseY;
  1052.                         objectManager.method190(l8, aClass11Array1230, k9, worldController, abyte1);
  1053.                     }
  1054.                 }
  1055.             }
  1056.             if (aBoolean1159) {
  1057.                 for (int j3 = 0; j3 < 4; j3++) {
  1058.                     for (int k4 = 0; k4 < 13; k4++) {
  1059.                         for (int j6 = 0; j6 < 13; j6++) {
  1060.                             int l7 = anIntArrayArrayArray1129[j3][k4][j6];
  1061.                             if (l7 != -1) {
  1062.                                 int i9 = l7 >> 24 & 3;
  1063.                                 int l9 = l7 >> 1 & 3;
  1064.                                 int j10 = l7 >> 14 & 0x3ff;
  1065.                                 int l10 = l7 >> 3 & 0x7ff;
  1066.                                 int j11 = (j10 / 8 << 8) + l10 / 8;
  1067.                                 for (int l11 = 0; l11 < anIntArray1234.length; l11++) {
  1068.                                     if (anIntArray1234[l11] != j11 || aByteArrayArray1183[l11] == null)
  1069.                                     continue;
  1070.                                         objectManager.method179(i9, l9, aClass11Array1230, k4 * 8, (j10 & 7) * 8, aByteArrayArray1183[l11], (l10 & 7) * 8, j3, j6 * 8);
  1071.                                     break;
  1072.                                 }
  1073.                             }
  1074.                         }
  1075.                     }
  1076.                 }
  1077.                 for (int l4 = 0; l4 < 13; l4++) {
  1078.                     for (int k6 = 0; k6 < 13; k6++) {
  1079.                         int i8 = anIntArrayArrayArray1129[0][l4][k6];
  1080.                         if (i8 == -1)
  1081.                             objectManager.method174(k6 * 8, 8, 8, l4 * 8);
  1082.                     }
  1083.                 }
  1084.                 stream.createFrame(0);
  1085.                 for (int l6 = 0; l6 < 4; l6++) {
  1086.                     for (int j8 = 0; j8 < 13; j8++) {
  1087.                         for (int j9 = 0; j9 < 13; j9++) {
  1088.                             int i10 = anIntArrayArrayArray1129[l6][j8][j9];
  1089.                             if (i10 != -1) {
  1090.                                 int k10 = i10 >> 24 & 3;
  1091.                                 int i11 = i10 >> 1 & 3;
  1092.                                 int k11 = i10 >> 14 & 0x3ff;
  1093.                                 int i12 = i10 >> 3 & 0x7ff;
  1094.                                 int j12 = (k11 / 8 << 8) + i12 / 8;
  1095.                                 for (int k12 = 0; k12 < anIntArray1234.length; k12++) {
  1096.                                     if (anIntArray1234[k12] != j12 || aByteArrayArray1247[k12] == null)
  1097.                                         continue;
  1098.                                     byte abyte0[] = aByteArrayArray1247[k12];
  1099.                                         if (FileOperations.FileExists(signlink.findcachedir() + "Data/Maps/" + anIntArray1235[k12] + ".dat"))
  1100.                                             abyte0 = FileOperations.ReadFile(signlink.findcachedir() + "Data/Maps/" + anIntArray1235[k12] + ".dat");
  1101.                                     objectManager.method183(aClass11Array1230, worldController, k10, j8 * 8, (i12 & 7) * 8, l6, aByteArrayArray1247[k12], (k11 & 7) * 8, i11, j9 * 8);
  1102.                                     break;
  1103.                                 }
  1104.                             }
  1105.                         }
  1106.                     }
  1107.                 }
  1108.             }
  1109.             stream.createFrame(0);
  1110.             objectManager.method171(aClass11Array1230, worldController);
  1111.             main3DArea.initDrawingArea();
  1112.             stream.createFrame(0);
  1113.             int k3 = ObjectManager.anInt145;
  1114.             if (k3 > plane)
  1115.                 k3 = plane;
  1116.             if (k3 < plane - 1)
  1117.                 k3 = plane - 1;
  1118.             if (lowMem)
  1119.                 worldController.method275(ObjectManager.anInt145);
  1120.             else
  1121.                 worldController.method275(0);
  1122.             for (int i5 = 0; i5 < 104; i5++) {
  1123.                 for (int i7 = 0; i7 < 104; i7++)
  1124.                     spawnGroundItem(i5, i7);
  1125.             }
  1126.             anInt1051++;
  1127.             if (anInt1051 > 98) {
  1128.                 anInt1051 = 0;
  1129.                 stream.createFrame(150);
  1130.             }
  1131.             method63();
  1132.         } catch (Exception exception) {
  1133.         }
  1134.         ObjectDef.mruNodes1.unlinkAll();
  1135.         if (super.gameFrame != null) {
  1136.             stream.createFrame(210);
  1137.             stream.writeDWord(0x3f008edd);
  1138.         }
  1139.         if (lowMem && signlink.cache_dat != null) {
  1140.             int j = onDemandFetcher.getVersionCount(0);
  1141.             for (int i1 = 0; i1 < j; i1++) {
  1142.                 int l1 = onDemandFetcher.getModelIndex(i1);
  1143.                 if ((l1 & 0x79) == 0)
  1144.                     Model.method461(i1);
  1145.             }
  1146.         }
  1147.         System.gc();
  1148.         Texture.method367();
  1149.         onDemandFetcher.method566();
  1150.         int k = (anInt1069 - 6) / 8 - 1;
  1151.         int j1 = (anInt1069 + 6) / 8 + 1;
  1152.         int i2 = (anInt1070 - 6) / 8 - 1;
  1153.         int l2 = (anInt1070 + 6) / 8 + 1;
  1154.         if (aBoolean1141) {
  1155.             k = 49;
  1156.             j1 = 50;
  1157.             i2 = 49;
  1158.             l2 = 50;
  1159.         }
  1160.         for (int l3 = k; l3 <= j1; l3++) {
  1161.             for (int j5 = i2; j5 <= l2; j5++) {
  1162.                 if (l3 == k || l3 == j1 || j5 == i2 || j5 == l2) {
  1163.                     int j7 = onDemandFetcher.method562(0, j5, l3);
  1164.                     if (j7 != -1)
  1165.                         onDemandFetcher.method560(j7, 3);
  1166.                     int k8 = onDemandFetcher.method562(1, j5, l3);
  1167.                     if (k8 != -1)
  1168.                         onDemandFetcher.method560(k8, 3);
  1169.                 }
  1170.             }
  1171.         }
  1172.     }
  1173.  
  1174.  
  1175.     private void unlinkMRUNodes()
  1176.     {
  1177.         ObjectDef.mruNodes1.unlinkAll();
  1178.         ObjectDef.mruNodes2.unlinkAll();
  1179.         EntityDef.mruNodes.unlinkAll();
  1180.         ItemDef.mruNodes2.unlinkAll();
  1181.         ItemDef.mruNodes1.unlinkAll();
  1182.         Player.mruNodes.unlinkAll();
  1183.         SpotAnim.aMRUNodes_415.unlinkAll();
  1184.     }
  1185.  
  1186.     private void method24(int i)
  1187.     {
  1188.         int ai[] = miniMapImage.myPixels;
  1189.         int j = ai.length;
  1190.         for(int k = 0; k < j; k++)
  1191.             ai[k] = 0;
  1192.  
  1193.         for(int l = 1; l < 103; l++)
  1194.         {
  1195.             int i1 = 24628 + (103 - l) * 512 * 4;
  1196.             for(int k1 = 1; k1 < 103; k1++)
  1197.             {
  1198.                 if((byteGroundArray[i][k1][l] & 0x18) == 0)
  1199.                     worldController.method309(ai, i1, i, k1, l);
  1200.                 if(i < 3 && (byteGroundArray[i + 1][k1][l] & 8) != 0)
  1201.                     worldController.method309(ai, i1, i + 1, k1, l);
  1202.                 i1 += 4;
  1203.             }
  1204.  
  1205.         }
  1206.  
  1207.         int j1 = ((238 + (int)(Math.random() * 20D)) - 10 << 16) + ((238 + (int)(Math.random() * 20D)) - 10 << 8) + ((238 + (int)(Math.random() * 20D)) - 10);
  1208.         int l1 = (238 + (int)(Math.random() * 20D)) - 10 << 16;
  1209.         miniMapImage.method343();
  1210.         for(int i2 = 1; i2 < 103; i2++)
  1211.         {
  1212.             for(int j2 = 1; j2 < 103; j2++)
  1213.             {
  1214.                 if((byteGroundArray[i][j2][i2] & 0x18) == 0)
  1215.                     method50(i2, j1, j2, l1, i);
  1216.                 if(i < 3 && (byteGroundArray[i + 1][j2][i2] & 8) != 0)
  1217.                     method50(i2, j1, j2, l1, i + 1);
  1218.             }
  1219.  
  1220.         }
  1221.         try {
  1222.             main3DArea.initDrawingArea();
  1223.             totalMapFunctions = 0;
  1224.             for(int k2 = 0; k2 < 104; k2++)
  1225.             {
  1226.                 for(int l2 = 0; l2 < 104; l2++)
  1227.                 {
  1228.                     int i3 = worldController.method303(plane, k2, l2);
  1229.                     if(i3 != 0)
  1230.                     {
  1231.                         i3 = i3 >> 14 & 0x7fff;
  1232.                         int j3 = ObjectDef.forID(i3).anInt746;
  1233.                         if(j3 >= 0)
  1234.                         {
  1235.                             int k3 = k2;
  1236.                             int l3 = l2;
  1237.                             if(j3 != 22 && j3 != 29 && j3 != 34 && j3 != 36 && j3 != 46 && j3 != 47 && j3 != 48)
  1238.                             {
  1239.                                 byte byte0 = 104;
  1240.                                 byte byte1 = 104;
  1241.                                 int ai1[][] = aClass11Array1230[plane].anIntArrayArray294;
  1242.                                 for(int i4 = 0; i4 < 10; i4++)
  1243.                                 {
  1244.                                     int j4 = (int)(Math.random() * 4D);
  1245.                                     if(j4 == 0 && k3 > 0 && k3 > k2 - 3 && (ai1[k3 - 1][l3] & 0x1280108) == 0)
  1246.                                         k3--;
  1247.                                     if(j4 == 1 && k3 < byte0 - 1 && k3 < k2 + 3 && (ai1[k3 + 1][l3] & 0x1280180) == 0)
  1248.                                         k3++;
  1249.                                     if(j4 == 2 && l3 > 0 && l3 > l2 - 3 && (ai1[k3][l3 - 1] & 0x1280102) == 0)
  1250.                                         l3--;
  1251.                                     if(j4 == 3 && l3 < byte1 - 1 && l3 < l2 + 3 && (ai1[k3][l3 + 1] & 0x1280120) == 0)
  1252.                                         l3++;
  1253.                                 }
  1254.  
  1255.                             }
  1256.                             currentMapFunctions[totalMapFunctions] = mapFunctions[j3];
  1257.                             mapFunctionX[totalMapFunctions] = k3;
  1258.                             mapFunctionY[totalMapFunctions] = l3;
  1259.                             totalMapFunctions++;
  1260.                         }
  1261.                     }
  1262.                 }
  1263.  
  1264.             }
  1265.         } catch (NullPointerException ex) {
  1266.            
  1267.         }
  1268.     }
  1269.  
  1270.     private void spawnGroundItem(int i, int j)
  1271.     {
  1272.         NodeList class19 = groundArray[plane][i][j];
  1273.         if(class19 == null)
  1274.         {
  1275.             worldController.method295(plane, i, j);
  1276.             return;
  1277.         }
  1278.         int k = 0xfa0a1f01;
  1279.         Object obj = null;
  1280.         for(Item item = (Item)class19.reverseGetFirst(); item != null; item = (Item)class19.reverseGetNext())
  1281.         {
  1282.             ItemDef itemDef = ItemDef.forID(item.ID);
  1283.             int l = itemDef.value;
  1284.             if(itemDef.stackable)
  1285.                 l *= item.anInt1559 + 1;
  1286. //  notifyItemSpawn(item, i + baseX, j + baseY);
  1287.    
  1288.             if(l > k)
  1289.             {
  1290.                 k = l;
  1291.                 obj = item;
  1292.             }
  1293.         }
  1294.  
  1295.         class19.insertTail(((Node) (obj)));
  1296.         Object obj1 = null;
  1297.         Object obj2 = null;
  1298.         for(Item class30_sub2_sub4_sub2_1 = (Item)class19.reverseGetFirst(); class30_sub2_sub4_sub2_1 != null; class30_sub2_sub4_sub2_1 = (Item)class19.reverseGetNext())
  1299.         {
  1300.             if(class30_sub2_sub4_sub2_1.ID != ((Item) (obj)).ID && obj1 == null)
  1301.                 obj1 = class30_sub2_sub4_sub2_1;
  1302.             if(class30_sub2_sub4_sub2_1.ID != ((Item) (obj)).ID && class30_sub2_sub4_sub2_1.ID != ((Item) (obj1)).ID && obj2 == null)
  1303.                 obj2 = class30_sub2_sub4_sub2_1;
  1304.         }
  1305.  
  1306.         int i1 = i + (j << 7) + 0x60000000;
  1307.         worldController.method281(i, i1, ((Animable) (obj1)), method42(plane, j * 128 + 64, i * 128 + 64), ((Animable) (obj2)), ((Animable) (obj)), plane, j);
  1308.     }
  1309.  
  1310.     private void method26(boolean flag)
  1311.     {
  1312.         for(int j = 0; j < npcCount; j++)
  1313.         {
  1314.             NPC npc = npcArray[npcIndices[j]];
  1315.             int k = 0x20000000 + (npcIndices[j] << 14);
  1316.             if(npc == null || !npc.isVisible() || npc.desc.aBoolean93 != flag)
  1317.                 continue;
  1318.             int l = npc.x >> 7;
  1319.             int i1 = npc.y >> 7;
  1320.             if(l < 0 || l >= 104 || i1 < 0 || i1 >= 104)
  1321.                 continue;
  1322.             if(npc.anInt1540 == 1 && (npc.x & 0x7f) == 64 && (npc.y & 0x7f) == 64)
  1323.             {
  1324.                 if(anIntArrayArray929[l][i1] == anInt1265)
  1325.                     continue;
  1326.                 anIntArrayArray929[l][i1] = anInt1265;
  1327.             }
  1328.             if(!npc.desc.aBoolean84)
  1329.                 k += 0x80000000;
  1330.             worldController.method285(plane, npc.anInt1552, method42(plane, npc.y, npc.x), k, npc.y, (npc.anInt1540 - 1) * 64 + 60, npc.x, npc, npc.aBoolean1541);
  1331.         }
  1332.     }
  1333.  
  1334.  
  1335.  
  1336.     private void loadError()
  1337.     {
  1338.         String s = "ondemand";//was a constant parameter
  1339.         System.out.println(s);
  1340.         try
  1341.         {
  1342.             getAppletContext().showDocument(new URL(getCodeBase(), "loaderror_" + s + ".html"));
  1343.         }
  1344.         catch(Exception exception)
  1345.         {
  1346.             exception.printStackTrace();
  1347.         }
  1348.         do
  1349.             try
  1350.             {
  1351.                 Thread.sleep(1000L);
  1352.             }
  1353.             catch(Exception _ex) { }
  1354.         while(true);
  1355.     }
  1356.    
  1357.     private int hoverSpriteId = -1;
  1358.     private void buildInterfaceMenu(int xPadding, RSInterface rsinterface, int xPos, int yPadding, int yPos, int yScrollPoint) {
  1359.         try {
  1360.             if(rsinterface.type != 0 || rsinterface.children == null || rsinterface.isMouseoverTriggered)
  1361.                 return;
  1362.             if(xPos < xPadding || yPos < yPadding || xPos > xPadding + rsinterface.width || yPos > yPadding + rsinterface.height)
  1363.                 return;
  1364.             int totalChildren = rsinterface.children.length;
  1365.             for(int childIndex = 0; childIndex < totalChildren; childIndex++) {
  1366.                 int xSpritePos = rsinterface.childX[childIndex] + xPadding;
  1367.                 int ySpritePos = (rsinterface.childY[childIndex] + yPadding) - yScrollPoint;
  1368.                 RSInterface rsinterfacechildren = RSInterface.interfaceCache[rsinterface.children[childIndex]];
  1369.                 xSpritePos += rsinterfacechildren.anInt263;
  1370.                 ySpritePos += rsinterfacechildren.anInt265;
  1371.                 if((rsinterfacechildren.mOverInterToTrigger >= 0 || rsinterfacechildren.textHoverColour != 0)
  1372.                 && xPos >= xSpritePos
  1373.                 && xPos < xSpritePos + rsinterfacechildren.width
  1374.                 && yPos >= ySpritePos
  1375.                 && yPos < ySpritePos + rsinterfacechildren.height) {
  1376.                     if(rsinterfacechildren.mOverInterToTrigger >= 0) {
  1377.                         hoverChildId = rsinterfacechildren.mOverInterToTrigger;
  1378.                         hoverSpriteId = hoverChildId;
  1379.                     } else {
  1380.                         hoverChildId = rsinterfacechildren.id;
  1381.                         hoverSpriteId = hoverChildId;
  1382.                     }
  1383.                 }
  1384.                 if (rsinterfacechildren.type == 8 &&  xPos >= xSpritePos && xPos < xSpritePos + rsinterfacechildren.width && yPos >= ySpritePos && yPos < ySpritePos + rsinterfacechildren.height) {
  1385.                     hoverToggleChildId = rsinterfacechildren.id;//
  1386.                 }
  1387.                
  1388.                 if(rsinterfacechildren.type == 0)
  1389.                 {
  1390.                     buildInterfaceMenu(xSpritePos, rsinterfacechildren, xPos, ySpritePos, yPos, rsinterfacechildren.scrollPosition);
  1391.                     if(rsinterfacechildren.scrollMax > rsinterfacechildren.height)
  1392.                         method65(xSpritePos + rsinterfacechildren.width, rsinterfacechildren.height, xPos, yPos, rsinterfacechildren, ySpritePos, true, rsinterfacechildren.scrollMax);
  1393.                 } else
  1394.                 {
  1395.                     if(rsinterfacechildren.atActionType == 1 && xPos >= xSpritePos && yPos >= ySpritePos && xPos < xSpritePos + rsinterfacechildren.width && yPos < ySpritePos + rsinterfacechildren.height)
  1396.                     {
  1397.                         boolean flag = false;
  1398.                         if(rsinterfacechildren.contentType != 0)
  1399.                             flag = buildFriendsListMenu(rsinterfacechildren);
  1400.                         if(!flag)
  1401.                         {
  1402.                             menuActionName[menuActionRow] = rsinterfacechildren.tooltip + ((myPrivilege != 0) ? ", @gre@(@whi@" + rsinterfacechildren.id + "@gre@)" : "");
  1403.                             menuActionID[menuActionRow] = 315;
  1404.                             menuActionCmd3[menuActionRow] = rsinterfacechildren.id;
  1405.                             menuActionRow++;
  1406.                         }
  1407.                     }
  1408.                     if(rsinterfacechildren.atActionType == 2 && spellSelected == 0 && xPos >= xSpritePos && yPos >= ySpritePos && xPos < xSpritePos + rsinterfacechildren.width && yPos < ySpritePos + rsinterfacechildren.height) {
  1409.                         String s = rsinterfacechildren.selectedActionName;
  1410.                         if(s.indexOf(" ") != -1)
  1411.                             s = s.substring(0, s.indexOf(" "));
  1412. if (rsinterfacechildren.spellName.endsWith("Rush")
  1413.                         || rsinterfacechildren.spellName.endsWith("Burst")
  1414.                         || rsinterfacechildren.spellName.endsWith("Blitz")
  1415.                         || rsinterfacechildren.spellName.endsWith("Barrage") && !rsinterfacechildren.spellName.equals("Miasmic Barrage")) {
  1416.                             menuActionName[menuActionRow] = "Autocast @gre@" + rsinterfacechildren.spellName + ((myPrivilege != 0) ? ", " + rsinterfacechildren.id : "");
  1417.                             menuActionID[menuActionRow] = 104;
  1418.                             menuActionCmd3[menuActionRow] = rsinterfacechildren.id;
  1419.                             menuActionRow++;
  1420.                         }
  1421.                         menuActionName[menuActionRow] = s + " @gre@" + rsinterfacechildren.spellName + ((myPrivilege != 0) ? ", " + rsinterfacechildren.id : "");
  1422.                         menuActionID[menuActionRow] = 626;
  1423.                         menuActionCmd3[menuActionRow] = rsinterfacechildren.id;
  1424.                         menuActionRow++;                   
  1425.                         if (rsinterfacechildren.spellName.endsWith("strike")
  1426.                         || rsinterfacechildren.spellName.endsWith("bolt")
  1427.                         || rsinterfacechildren.spellName.equals("Crumble undead")
  1428.                         || rsinterfacechildren.spellName.endsWith("blast")
  1429.                         || rsinterfacechildren.spellName.endsWith("wave")
  1430.                         || rsinterfacechildren.spellName.equals("Claws of Guthix")
  1431.                         || rsinterfacechildren.spellName.equals("Flames of Zamorak")
  1432.                         || rsinterfacechildren.spellName.equals("Magic Dart")) {
  1433.                             menuActionName[menuActionRow] = "Autocast @gre@" + rsinterfacechildren.spellName + ((myPrivilege != 0) ? ", " + rsinterfacechildren.id : "");
  1434.                             menuActionID[menuActionRow] = 104;
  1435.                             menuActionCmd3[menuActionRow] = rsinterfacechildren.id;
  1436.                             menuActionRow++;
  1437.                         }
  1438.                     }
  1439.                     if(rsinterfacechildren.atActionType == 3 && xPos >= xSpritePos && yPos >= ySpritePos && xPos < xSpritePos + rsinterfacechildren.width && yPos < ySpritePos + rsinterfacechildren.height)
  1440.                     {
  1441.                         menuActionName[menuActionRow] = "Close" + ((myPrivilege != 0) ? ", " + rsinterfacechildren.id : "");
  1442.                         menuActionID[menuActionRow] = 200;
  1443.                         menuActionCmd3[menuActionRow] = rsinterfacechildren.id;
  1444.                         menuActionRow++;
  1445.                     }
  1446.                     if(rsinterfacechildren.atActionType == 4 && xPos >= xSpritePos && yPos >= ySpritePos && xPos < xSpritePos + rsinterfacechildren.width && yPos < ySpritePos + rsinterfacechildren.height) {             
  1447.                         menuActionName[menuActionRow] = rsinterfacechildren.tooltip + ((myPrivilege != 0) ? ", @gre@(@whi@" + rsinterfacechildren.id + "@gre@)" : "");
  1448.                         menuActionID[menuActionRow] = 169;
  1449.                         menuActionCmd3[menuActionRow] = rsinterfacechildren.id;
  1450.                         menuActionRow++;
  1451.                         if (rsinterfacechildren.hoverText != null) {
  1452.                             //drawHoverBox(xPos, yPadding, rsinterfacechildren.hoverText);
  1453.                             //System.out.println("DRAWING INTERFACE: " + rsinterfacechildren.hoverText);
  1454.                         }
  1455.                     }
  1456.                     if(rsinterfacechildren.atActionType == 5 && xPos >= xSpritePos && yPos >= ySpritePos && xPos < xSpritePos + rsinterfacechildren.width && yPos < ySpritePos + rsinterfacechildren.height) {
  1457.                         if(rsinterfacechildren.tooltip.toLowerCase().startsWith("transform")) {
  1458.                         rsinterfacechildren.itemActions = new String[5];
  1459.                         rsinterfacechildren.itemActions[0] = "Transform";
  1460.                         rsinterfacechildren.itemActions[1] = "Transform-5";
  1461.                         rsinterfacechildren.itemActions[2] = "Transform-10";
  1462.                         rsinterfacechildren.itemActions[3] = "Transform-all";
  1463.                         rsinterfacechildren.itemActions[4] = "Transform-X";
  1464.                             if(rsinterfacechildren.itemActions != null) {
  1465.                                 for(int j4 = 4; j4 >= 0; j4--)
  1466.                                     if(rsinterfacechildren.itemActions[j4] != null) {
  1467.                                         menuActionName[menuActionRow] = rsinterfacechildren.tooltip.replaceAll("Transform",rsinterfacechildren.itemActions[j4]);
  1468.                                         if(j4 == 0)
  1469.                                             menuActionID[menuActionRow] = 632;//1
  1470.                                         if(j4 == 1)
  1471.                                             menuActionID[menuActionRow] = 78;//5
  1472.                                         if(j4 == 2)
  1473.                                             menuActionID[menuActionRow] = 867;//10
  1474.                                         if(j4 == 3)
  1475.                                             menuActionID[menuActionRow] = 431;//all
  1476.                                         if(j4 == 4)
  1477.                                             menuActionID[menuActionRow] = 53;//x
  1478.                                         menuActionCmd1[menuActionRow] = rsinterfacechildren.itemSpriteId1;
  1479.                                         menuActionCmd2[menuActionRow] = rsinterfacechildren.itemSpriteIndex;
  1480.                                         menuActionCmd3[menuActionRow] = rsinterfacechildren.parentID;
  1481.                                         menuActionRow++;
  1482.                                     }
  1483.                             }
  1484.                         } else {
  1485.                             menuActionName[menuActionRow] = rsinterfacechildren.tooltip + ((myPrivilege != 0) ? ", @gre@(@whi@" + rsinterfacechildren.id + "@gre@)" : "");
  1486.                             menuActionID[menuActionRow] = 646;
  1487.                             menuActionCmd3[menuActionRow] = rsinterfacechildren.id;
  1488.                             menuActionRow++;
  1489.                         }
  1490.                     }
  1491.                     if(rsinterfacechildren.atActionType == 6 && !aBoolean1149 && xPos >= xSpritePos && yPos >= ySpritePos && xPos < xSpritePos + rsinterfacechildren.width && yPos < ySpritePos + rsinterfacechildren.height)
  1492.                     {
  1493.                         menuActionName[menuActionRow] = rsinterfacechildren.tooltip + ((myPrivilege != 0) ? ", @gre@(@whi@" + rsinterfacechildren.id + "@gre@)" : "");
  1494.                         menuActionID[menuActionRow] = 679;
  1495.                         menuActionCmd3[menuActionRow] = rsinterfacechildren.id;
  1496.                         menuActionRow++;
  1497.                     }
  1498.                     if(rsinterfacechildren.type == 2)
  1499.                     {
  1500.                         int k2 = 0;
  1501.                         for(int l2 = 0; l2 < rsinterfacechildren.height; l2++)
  1502.                         {
  1503.                             for(int i3 = 0; i3 < rsinterfacechildren.width; i3++)
  1504.                             {
  1505.                                 int j3 = xSpritePos + i3 * (32 + rsinterfacechildren.invSpritePadX);
  1506.                                 int k3 = ySpritePos + l2 * (32 + rsinterfacechildren.invSpritePadY);
  1507.                                 if(k2 < 20)
  1508.                                 {
  1509.                                     j3 += rsinterfacechildren.spritesX[k2];
  1510.                                     k3 += rsinterfacechildren.spritesY[k2];
  1511.                                 }
  1512.                                 if(xPos >= j3 && yPos >= k3 && xPos < j3 + 32 && yPos < k3 + 32)
  1513.                                 {
  1514.                                     mouseInvInterfaceIndex = k2;
  1515.                                     lastActiveInvInterface = rsinterfacechildren.id;
  1516.                                     if(rsinterfacechildren.inv[k2] > 0)
  1517.                                     {
  1518.                                         ItemDef itemDef = ItemDef.forID(rsinterfacechildren.inv[k2] - 1);
  1519.                                         if(itemSelected == 1 && rsinterfacechildren.isInventoryInterface)
  1520.                                         {
  1521.                                             if(rsinterfacechildren.id != anInt1284 || k2 != itemSlotUsedOn)
  1522.                                             {
  1523.                                                 menuActionName[menuActionRow] = "Use " + selectedItemName + " with @lre@" + itemDef.name;
  1524.                                                 menuActionID[menuActionRow] = 870;
  1525.                                                 menuActionCmd1[menuActionRow] = itemDef.id;
  1526.                                                 menuActionCmd2[menuActionRow] = k2;
  1527.                                                 menuActionCmd3[menuActionRow] = rsinterfacechildren.id;
  1528.                                                 menuActionRow++;
  1529.                                             }
  1530.                                         } else
  1531.                                         if(spellSelected == 1 && rsinterfacechildren.isInventoryInterface)
  1532.                                         {
  1533.                                             if((spellUsableOn & 0x10) == 16)
  1534.                                             {
  1535.                                                 menuActionName[menuActionRow] = spellTooltip + " @lre@" + itemDef.name;
  1536.                                                 menuActionID[menuActionRow] = 543;
  1537.                                                 menuActionCmd1[menuActionRow] = itemDef.id;
  1538.                                                 menuActionCmd2[menuActionRow] = k2;
  1539.                                                 menuActionCmd3[menuActionRow] = rsinterfacechildren.id;
  1540.                                                 menuActionRow++;
  1541.                                             }
  1542.                                         } else
  1543.                                         {
  1544.                                             if(rsinterfacechildren.isInventoryInterface)
  1545.                                             {
  1546.                                                 for(int l3 = 4; l3 >= 3; l3--)
  1547.                                                     if(itemDef.itemActions != null && itemDef.itemActions[l3] != null)
  1548.                                                     {
  1549.                                                         menuActionName[menuActionRow] = itemDef.itemActions[l3] + " @lre@" + itemDef.name;
  1550.                                                         if(l3 == 3)
  1551.                                                             menuActionID[menuActionRow] = 493;
  1552.                                                         if(l3 == 4)
  1553.                                                             menuActionID[menuActionRow] = 847;
  1554.                                                         menuActionCmd1[menuActionRow] = itemDef.id;
  1555.                                                         menuActionCmd2[menuActionRow] = k2;
  1556.                                                         menuActionCmd3[menuActionRow] = rsinterfacechildren.id;
  1557.                                                         menuActionRow++;
  1558.                                                     } else
  1559.                                                     if(l3 == 4)
  1560.                                                     {
  1561.                                                         menuActionName[menuActionRow] = "Drop @lre@" + itemDef.name;
  1562.                                                         menuActionID[menuActionRow] = 847;
  1563.                                                         menuActionCmd1[menuActionRow] = itemDef.id;
  1564.                                                         menuActionCmd2[menuActionRow] = k2;
  1565.                                                         menuActionCmd3[menuActionRow] = rsinterfacechildren.id;
  1566.                                                         menuActionRow++;
  1567.                                                     }
  1568.  
  1569.                                             }
  1570.                                             if(rsinterfacechildren.usableItemInterface)
  1571.                                             {
  1572.                                                 menuActionName[menuActionRow] = "Use @lre@" + itemDef.name;
  1573.                                                 menuActionID[menuActionRow] = 447;
  1574.                                                 menuActionCmd1[menuActionRow] = itemDef.id;
  1575.                                                 //k2 = inventory spot
  1576.                                                 //System.out.println(k2);
  1577.                                                 menuActionCmd2[menuActionRow] = k2;
  1578.                                                 menuActionCmd3[menuActionRow] = rsinterfacechildren.id;
  1579.                                                 menuActionRow++;
  1580.                                             }
  1581.                                             if(rsinterfacechildren.isInventoryInterface && itemDef.itemActions != null)
  1582.                                             {
  1583.                                                 for(int i4 = 2; i4 >= 0; i4--)
  1584.                                                     if(itemDef.itemActions[i4] != null)
  1585.                                                     {
  1586.                                                         menuActionName[menuActionRow] = itemDef.itemActions[i4] + " @lre@" + itemDef.name;
  1587.                                                         if(i4 == 0)
  1588.                                                             menuActionID[menuActionRow] = 74;
  1589.                                                         if(i4 == 1)
  1590.                                                             menuActionID[menuActionRow] = 454;
  1591.                                                         if(i4 == 2)
  1592.                                                             menuActionID[menuActionRow] = 539;
  1593.                                                         menuActionCmd1[menuActionRow] = itemDef.id;
  1594.                                                         menuActionCmd2[menuActionRow] = k2;
  1595.                                                         menuActionCmd3[menuActionRow] = rsinterfacechildren.id;
  1596.                                                         menuActionRow++;
  1597.                                                     }
  1598.  
  1599.                                             }
  1600.                                             if(rsinterfacechildren.itemActions != null)
  1601.                                             {
  1602.                                                 for(int j4 = 4; j4 >= 0; j4--)
  1603.                                                     if(rsinterfacechildren.itemActions[j4] != null)
  1604.                                                     {
  1605.                                                         menuActionName[menuActionRow] = rsinterfacechildren.itemActions[j4] + " @lre@" + itemDef.name;
  1606.                                                         if(j4 == 0)
  1607.                                                             menuActionID[menuActionRow] = 632;//1
  1608.                                                         if(j4 == 1)
  1609.                                                             menuActionID[menuActionRow] = 78;//5
  1610.                                                         if(j4 == 2)
  1611.                                                             menuActionID[menuActionRow] = 867;//10
  1612.                                                         if(j4 == 3)
  1613.                                                             menuActionID[menuActionRow] = 431;//all
  1614.                                                         if(j4 == 4)
  1615.                                                             menuActionID[menuActionRow] = 53;//x
  1616.                                                         menuActionCmd1[menuActionRow] = itemDef.id;
  1617.                                                         menuActionCmd2[menuActionRow] = k2;
  1618.                                                         menuActionCmd3[menuActionRow] = rsinterfacechildren.id;
  1619.                                                         menuActionRow++;
  1620.                                                     }
  1621.  
  1622.                                             }
  1623.                                             menuActionName[menuActionRow] = "Examine @lre@" + itemDef.name + ((myPrivilege != 0) ? ", @gre@(@whi@" + (rsinterfacechildren.inv[k2] - 1) + "@gre@)" : "");
  1624.                                             menuActionID[menuActionRow] = 1125;
  1625.                                             menuActionCmd1[menuActionRow] = itemDef.id;
  1626.                                             menuActionCmd2[menuActionRow] = k2;
  1627.                                             menuActionCmd3[menuActionRow] = rsinterfacechildren.id;
  1628.                                             menuActionRow++;
  1629.                                         }
  1630.                                     }
  1631.                                 }
  1632.                                 k2++;
  1633.                             }
  1634.  
  1635.                         }
  1636.  
  1637.                     }
  1638.                 }
  1639.             }
  1640.         } catch(NullPointerException ex) {
  1641.            
  1642.         }
  1643.     }
  1644.  
  1645.     public void drawScrollbar(int totalHeight, int currentPos, int yPos, int xPos, int ScrollsTotalLength,boolean hdStyle) {
  1646.         double repeats = (totalHeight - 32) / 5;
  1647.         for(int i = 0; i <= repeats; i++)
  1648.             scrollBar[0 + (hdStyle && toggleFullscreen ? 4 : 0)].drawSprite(xPos, (yPos + 16) + (i * 5));
  1649.            
  1650.         int scrollLength = ((totalHeight - 32) * totalHeight) / ScrollsTotalLength;
  1651.         if(scrollLength < 8)
  1652.             scrollLength = 8;
  1653.         int calcScrollPos = ((totalHeight - 32 - scrollLength) * currentPos) / (ScrollsTotalLength - totalHeight);
  1654.        
  1655.         int frontStartY = (yPos + 16 + calcScrollPos);
  1656.         int frontFinishY = (yPos + 16 + calcScrollPos + scrollLength - 5);
  1657.         for(int frontY = frontStartY; frontY < frontFinishY; frontY += 5)
  1658.             scrollBar[2 + (hdStyle && toggleFullscreen ? 4 : 0)].drawSprite(xPos, frontY);
  1659.        
  1660.         scrollBar[1 + (hdStyle && toggleFullscreen ? 4 : 0)].drawSprite(xPos,frontStartY);
  1661.         scrollBar[3 + (hdStyle && toggleFullscreen ? 4 : 0)].drawSprite(xPos,frontFinishY);
  1662.         scrollArrow[0 + (hdStyle && toggleFullscreen ? 2 : 0)].drawSprite(xPos, yPos);
  1663.         scrollArrow[1 + (hdStyle && toggleFullscreen ? 2 : 0)].drawSprite(xPos, (yPos + totalHeight) - 16);
  1664.     }
  1665.  
  1666.     private void updateNPCs(Stream stream, int i)
  1667.     {
  1668.         anInt839 = 0;
  1669.         anInt893 = 0;
  1670.         method139(stream);
  1671.         method46(i, stream);
  1672.         method86(stream);
  1673.         for(int k = 0; k < anInt839; k++)
  1674.         {
  1675.             int l = anIntArray840[k];
  1676.             if(npcArray[l].anInt1537 != loopCycle)
  1677.             {
  1678.                 npcArray[l].desc = null;
  1679.                 npcArray[l] = null;
  1680.             }
  1681.         }
  1682.  
  1683.         if(stream.currentOffset != i)
  1684.         {
  1685.             signlink.reporterror(myUsername + " size mismatch in getnpcpos - pos:" + stream.currentOffset + " psize:" + i);
  1686.             throw new RuntimeException("eek");
  1687.         }
  1688.         for(int i1 = 0; i1 < npcCount; i1++)
  1689.             if(npcArray[npcIndices[i1]] == null)
  1690.             {
  1691.                 signlink.reporterror(myUsername + " null entry in npc list - pos:" + i1 + " size:" + npcCount);
  1692.                 throw new RuntimeException("eek");
  1693.             }
  1694.  
  1695.     }
  1696.  
  1697.     private int cButtonHPos;
  1698.     private int cButtonHCPos;
  1699.     private int cButtonCPos;
  1700.  
  1701.     private void processChatModeClick(int paddingX,int paddingY) {
  1702.         int clickX = super.saveClickX - paddingX;
  1703.         int clickY = super.saveClickY - paddingY;
  1704.         int mouseX = super.mouseX - paddingX;
  1705.         int mouseY = super.mouseY - paddingY;
  1706.         if(mouseX >= 5 && mouseX <= 61 && mouseY >= 482 && mouseY <= 503) {
  1707.             cButtonHPos = 0;
  1708.             aBoolean1233 = true;
  1709.             inputTaken = true;
  1710.         } else if(mouseX >= 71 && mouseX <= 127 && mouseY >= 482 && mouseY <= 503) {
  1711.             cButtonHPos = 1;
  1712.             aBoolean1233 = true;
  1713.             inputTaken = true;
  1714.         } else if(mouseX >= 137 && mouseX <= 193 && mouseY >= 482 && mouseY <= 503) {
  1715.             cButtonHPos = 2;
  1716.             aBoolean1233 = true;
  1717.             inputTaken = true;
  1718.         } else if(mouseX >= 203 && mouseX <= 259 && mouseY >= 482 && mouseY <= 503) {
  1719.             cButtonHPos = 3;
  1720.             aBoolean1233 = true;
  1721.             inputTaken = true;
  1722.         } else if(mouseX >= 269 && mouseX <= 325 && mouseY >= 482 && mouseY <= 503) {
  1723.             cButtonHPos = 4;
  1724.             aBoolean1233 = true;
  1725.             inputTaken = true;
  1726.         } else if(mouseX >= 335 && mouseX <= 391 && mouseY >= 482 && mouseY <= 503) {
  1727.             cButtonHPos = 5;
  1728.             aBoolean1233 = true;
  1729.             inputTaken = true;
  1730.         } else if(mouseX >= 404 && mouseX <= 515 && mouseY >= 482 && mouseY <= 503) {
  1731.             cButtonHPos = 6;
  1732.             aBoolean1233 = true;
  1733.             inputTaken = true;
  1734.         } else {
  1735.             cButtonHPos = -1;
  1736.             aBoolean1233 = true;
  1737.             inputTaken = true;
  1738.         }
  1739.         if(super.clickMode3 == 1) {
  1740.             if(clickX >= 5 && clickX <= 61 && clickY >= 482 && clickY <= 505) {
  1741.                 cButtonCPos = 0;
  1742.                 chatTypeView = 0;
  1743.                 aBoolean1233 = true;
  1744.                 inputTaken = true;
  1745.             } else if(clickX >= 71 && clickX <= 127 && clickY >= 482 && clickY <= 505) {
  1746.                 cButtonCPos = 1;
  1747.                 chatTypeView = 5;
  1748.                 aBoolean1233 = true;
  1749.                 inputTaken = true;
  1750.             } else if(clickX >= 137 && clickX <= 193 && clickY >= 482 && clickY <= 505) {
  1751.                 cButtonCPos = 2;
  1752.                 chatTypeView = 1;
  1753.                 aBoolean1233 = true;
  1754.                 inputTaken = true;
  1755.             } else if(clickX >= 203 && clickX <= 259 && clickY >= 482 && clickY <= 505) {
  1756.                 cButtonCPos = 3;
  1757.                 chatTypeView = 2;
  1758.                 aBoolean1233 = true;
  1759.                 inputTaken = true;
  1760.             } else if(clickX >= 269 && clickX <= 325 && clickY >= 482 && clickY <= 505) {
  1761.                 cButtonCPos = 4;
  1762.                 chatTypeView = 11;
  1763.                 aBoolean1233 = true;
  1764.                 inputTaken = true;
  1765.             } else if(clickX >= 335 && clickX <= 391 && clickY >= 482 && clickY <= 505) {
  1766.                 cButtonCPos = 5;
  1767.                 chatTypeView = 3;
  1768.                 aBoolean1233 = true;
  1769.                 inputTaken = true;
  1770.             } else if(clickX >= 404 && clickX <= 515 && clickY >= 482 && clickY <= 505) {
  1771.                 if(openInterfaceID == -1 && myPrivilege >= 1) {
  1772.                     clearTopInterfaces();
  1773.                     reportAbuseInput = "";
  1774.                     canMute = false;
  1775.                     for(int i = 0; i < RSInterface.interfaceCache.length; i++) {
  1776.                         if(RSInterface.interfaceCache[i] == null || RSInterface.interfaceCache[i].contentType != 600)
  1777.                             continue;
  1778.                         reportAbuseInterfaceID = openInterfaceID = RSInterface.interfaceCache[i].parentID;
  1779.                         break;
  1780.                     }
  1781.                 } else {
  1782.                     pushMessage("Please close the interface you have open before using 'report abuse'", 0, "");
  1783.                 }
  1784.             }
  1785.         }
  1786.     }
  1787.  
  1788.     private void method33(int i)
  1789.     {
  1790.         int j = Varp.cache[i].anInt709;
  1791.         if(j == 0)
  1792.             return;
  1793.         int k = variousSettings[i];
  1794.         if(j == 1)
  1795.         {
  1796.             if(k == 1)
  1797.                 Texture.method372(0.90000000000000002D);
  1798.             if(k == 2)
  1799.                 Texture.method372(0.80000000000000004D);
  1800.             if(k == 3)
  1801.                 Texture.method372(0.69999999999999996D);
  1802.             if(k == 4)
  1803.                 Texture.method372(0.59999999999999998D);
  1804.             ItemDef.mruNodes1.unlinkAll();
  1805.             welcomeScreenRaised = true;
  1806.         }
  1807.         if(j == 3)
  1808.         {
  1809.             boolean flag1 = musicEnabled;
  1810.             if(k == 0)
  1811.             {
  1812.                 adjustVolume(musicEnabled, 0);
  1813.                 musicEnabled = true;
  1814.             }
  1815.             if(k == 1)
  1816.             {
  1817.                 adjustVolume(musicEnabled, -400);
  1818.                 musicEnabled = true;
  1819.             }
  1820.             if(k == 2)
  1821.             {
  1822.                 adjustVolume(musicEnabled, -800);
  1823.                 musicEnabled = true;
  1824.             }
  1825.             if(k == 3)
  1826.             {
  1827.                 adjustVolume(musicEnabled, -1200);
  1828.                 musicEnabled = true;
  1829.             }
  1830.             if(k == 4)
  1831.                 musicEnabled = false;
  1832.             if(musicEnabled != flag1 && !lowMem)
  1833.             {
  1834.                 if(musicEnabled)
  1835.                 {
  1836.                     nextSong = currentSong;
  1837.                     songChanging = true;
  1838.                     onDemandFetcher.method558(2, nextSong);
  1839.                 } else
  1840.                 {
  1841.                     stopMidi();
  1842.                 }
  1843.                 prevSong = 0;
  1844.             }
  1845.         }
  1846.         if(j == 4)
  1847.         {
  1848.             if(k == 0)
  1849.             {
  1850.                 aBoolean848 = true;
  1851.                 setWaveVolume(0);
  1852.             }
  1853.             if(k == 1)
  1854.             {
  1855.                 aBoolean848 = true;
  1856.                 setWaveVolume(-400);
  1857.             }
  1858.             if(k == 2)
  1859.             {
  1860.                 aBoolean848 = true;
  1861.                 setWaveVolume(-800);
  1862.             }
  1863.             if(k == 3)
  1864.             {
  1865.                 aBoolean848 = true;
  1866.                 setWaveVolume(-1200);
  1867.             }
  1868.             if(k == 4)
  1869.                 aBoolean848 = false;
  1870.         }
  1871.         if(j == 5)
  1872.             anInt1253 = k;
  1873.         if(j == 6)
  1874.             anInt1249 = k;
  1875.         if(j == 8)
  1876.         {
  1877.             splitPrivateChat = k;
  1878.             inputTaken = true;
  1879.         }
  1880.         if(j == 9)
  1881.             anInt913 = k;
  1882.     }
  1883.  
  1884.     private void updateEntities() {
  1885.         try{
  1886.             int anInt974 = 0;
  1887.             for(int j = -1; j < playerCount + npcCount; j++) {
  1888.             Object obj;
  1889.             if(j == -1)
  1890.                 obj = myPlayer;
  1891.             else
  1892.             if(j < playerCount)
  1893.                 obj = playerArray[playerIndices[j]];
  1894.             else
  1895.                 obj = npcArray[npcIndices[j - playerCount]];
  1896.             if(obj == null || !((Entity) (obj)).isVisible())
  1897.                 continue;
  1898.             if(obj instanceof NPC) {
  1899.                 EntityDef entityDef = ((NPC)obj).desc;
  1900.                 if(entityDef.childrenIDs != null)
  1901.                     entityDef = entityDef.method161();
  1902.                 if(entityDef == null)
  1903.                     continue;
  1904.             }
  1905.             if(j < playerCount) {
  1906.                 int l = 30;
  1907.                 Player player = (Player)obj;
  1908.                 if(player.headIcon >= 0) {
  1909.                     npcScreenPos(((Entity) (obj)), ((Entity) (obj)).height + 15);
  1910.                     if(spriteDrawX > -1) {
  1911.                         if (player.skullIcon < 2) {
  1912.                             skullIcons[player.skullIcon].drawSprite(spriteDrawX - 12, spriteDrawY - l);
  1913.                             l += 25;
  1914.                         }
  1915.                         if (player.headIcon < 18) {
  1916.                             headIcons[player.headIcon].drawSprite(spriteDrawX - 12, spriteDrawY - l);
  1917.                             l += 18;
  1918.                         }
  1919.                     }
  1920.                 }
  1921.                 if(j >= 0 && hintType == 10 && hintArrowPlayerID == playerIndices[j]) {
  1922.                     npcScreenPos(((Entity) (obj)), ((Entity) (obj)).height + 15);
  1923.                     if(spriteDrawX > -1)
  1924.                         headIconsHint[player.hintIcon].drawSprite(spriteDrawX - 12, spriteDrawY - l);
  1925.                 }
  1926.             } else {
  1927.                 EntityDef entityDef_1 = ((NPC)obj).desc;
  1928.                 if(entityDef_1.anInt75 >= 0 && entityDef_1.anInt75 < headIcons.length) {
  1929.                     npcScreenPos(((Entity) (obj)), ((Entity) (obj)).height + 15);
  1930.                     if(spriteDrawX > -1)
  1931.                         headIcons[entityDef_1.anInt75].drawSprite(spriteDrawX - 12, spriteDrawY - 30);
  1932.                 }
  1933.                 if(hintType == 1 && hintArrowNPCID == npcIndices[j - playerCount] && loopCycle % 20 < 10) {
  1934.                     npcScreenPos(((Entity) (obj)), ((Entity) (obj)).height + 15);
  1935.                     if(spriteDrawX > -1)
  1936.                         headIconsHint[0].drawSprite(spriteDrawX - 12, spriteDrawY - 28);
  1937.                 }
  1938.             }
  1939.             if(((Entity) (obj)).textSpoken != null && (j >= playerCount || publicChatMode == 0 || publicChatMode == 3 || publicChatMode == 1 && isFriendOrSelf(((Player)obj).name)))
  1940.             {
  1941.                 npcScreenPos(((Entity) (obj)), ((Entity) (obj)).height);
  1942.                 if(spriteDrawX > -1 && anInt974 < anInt975)
  1943.                 {
  1944.                     anIntArray979[anInt974] = boldFont.method384(((Entity) (obj)).textSpoken) / 2;
  1945.                     anIntArray978[anInt974] = boldFont.anInt1497;
  1946.                     anIntArray976[anInt974] = spriteDrawX;
  1947.                     anIntArray977[anInt974] = spriteDrawY;
  1948.                     anIntArray980[anInt974] = ((Entity)(Entity)obj).anInt1513;
  1949.                     anIntArray981[anInt974] = ((Entity)(Entity)obj).anInt1531;
  1950.                     anIntArray982[anInt974] = ((Entity)(Entity)obj).textCycle;
  1951.                     aStringArray983[anInt974++] = ((Entity)(Entity)obj).textSpoken;
  1952.                     if(anInt1249 == 0 && ((Entity) (obj)).anInt1531 >= 1 && ((Entity) (obj)).anInt1531 <= 3)
  1953.                     {
  1954.                         anIntArray978[anInt974] += 10;
  1955.                         anIntArray977[anInt974] += 5;
  1956.                     }
  1957.                     if(anInt1249 == 0 && ((Entity) (obj)).anInt1531 == 4)
  1958.                         anIntArray979[anInt974] = 60;
  1959.                     if(anInt1249 == 0 && ((Entity) (obj)).anInt1531 == 5)
  1960.                         anIntArray978[anInt974] += 5;
  1961.                 }
  1962.             }
  1963.             if(((Entity) (obj)).loopCycleStatus > loopCycle)
  1964.             {
  1965.                 try{
  1966.                     npcScreenPos(((Entity) (obj)), ((Entity) (obj)).height + 15);
  1967.                     if(spriteDrawX > -1)
  1968.                     {
  1969.                         if(healthBars) {
  1970.                             int amount = 56;
  1971.                             int j2 = (((Entity)(Entity)obj).currentHealth * amount) / ((Entity)(Entity)obj).maxHealth;
  1972.                             if(j2 > amount)
  1973.                                 j2 = amount;
  1974.                             HPBarEmpty.drawSprite(spriteDrawX - 28, spriteDrawY - 3);
  1975.                             HPBarFull = new Sprite("HITPOINTS_0", j2, 7);
  1976.                             HPBarFull.drawSprite(spriteDrawX - 28, spriteDrawY - 3);
  1977.                         } else {
  1978.                             int i1 = (((Entity) (obj)).currentHealth * 30) / ((Entity) (obj)).maxHealth;
  1979.                             if(i1 > 30)
  1980.                                 i1 = 30;
  1981.                             DrawingArea.drawPixels(5, spriteDrawY - 3, spriteDrawX - 15, 65280, i1);
  1982.                             DrawingArea.drawPixels(5, spriteDrawY - 3, (spriteDrawX - 15) + i1, 0xff0000, 30 - i1);
  1983.                         }
  1984.                     }
  1985.                 }catch(Exception ex){ }
  1986.             }
  1987.                 for(int j1 = 0; j1 < 4; j1++)
  1988.                     if(((Entity) (obj)).hitsLoopCycle[j1] > loopCycle) {
  1989.                         npcScreenPos(((Entity) (obj)), ((Entity) (obj)).height / 2);
  1990.                         if(spriteDrawX > -1) {
  1991.                             //spriteDrawY = 20 +
  1992.                             switch (j1) {
  1993.                                 case 1:
  1994.                                 spriteDrawY += 20;
  1995.                                 break;
  1996.                                 case 2:
  1997.                                 spriteDrawY += 25;
  1998.                                 break;
  1999.                                 case 3:
  2000.                                 spriteDrawY += 45;
  2001.                                 break;
  2002.                             }
  2003.                             Entity e = ((Entity) (obj));
  2004.                             if (e.hitmarkMove[j1] > -30) {
  2005.                                     e.hitmarkMove[j1]--;
  2006.                                 if (e.hitmarkTrans[j1] > 0)
  2007.                                     e.hitmarkTrans[j1] -= 5;
  2008.                                 hitmarkDraw(e,String.valueOf(e.hitMarkDamage[j1]).length(), e.hitMarkTypes[j1], e.hitmarkIcon[j1], e.hitMarkDamage[j1], e.hitmarkMove[j1], e.hitmarkTrans[j1], e.hitMarkFocusPlayer[j1], e.hitMarkFocusNPC[j1]);
  2009.                             }
  2010.                         }
  2011.                     }
  2012.             }
  2013.             for(int k = 0; k < anInt974; k++) {
  2014.                 int k1 = anIntArray976[k];
  2015.                 int l1 = anIntArray977[k];
  2016.                 int j2 = anIntArray979[k];
  2017.                 int k2 = anIntArray978[k];
  2018.                 boolean flag = true;
  2019.                 while(flag)
  2020.                 {
  2021.                     flag = false;
  2022.                     for(int l2 = 0; l2 < k; l2++)
  2023.                         if(l1 + 2 > anIntArray977[l2] - anIntArray978[l2] && l1 - k2 < anIntArray977[l2] + 2 && k1 - j2 < anIntArray976[l2] + anIntArray979[l2] && k1 + j2 > anIntArray976[l2] - anIntArray979[l2] && anIntArray977[l2] - anIntArray978[l2] < l1)
  2024.                         {
  2025.                             l1 = anIntArray977[l2] - anIntArray978[l2];
  2026.                             flag = true;
  2027.                         }
  2028.  
  2029.                 }
  2030.                 spriteDrawX = anIntArray976[k];
  2031.                 spriteDrawY = anIntArray977[k] = l1;
  2032.                 String s = aStringArray983[k];
  2033.                 if(anInt1249 == 0)
  2034.                 {
  2035.                     int i3 = 0xffff00;
  2036.                     if(anIntArray980[k] < 6)
  2037.                         i3 = anIntArray965[anIntArray980[k]];
  2038.                     if(anIntArray980[k] == 6)
  2039.                         i3 = anInt1265 % 20 >= 10 ? 0xffff00 : 0xff0000;
  2040.                     if(anIntArray980[k] == 7)
  2041.                         i3 = anInt1265 % 20 >= 10 ? 65535 : 255;
  2042.                     if(anIntArray980[k] == 8)
  2043.                         i3 = anInt1265 % 20 >= 10 ? 0x80ff80 : 45056;
  2044.                     if(anIntArray980[k] == 9) {
  2045.                         int j3 = 150 - anIntArray982[k];
  2046.                         if(j3 < 50)
  2047.                             i3 = 0xff0000 + 1280 * j3;
  2048.                         else
  2049.                         if(j3 < 100)
  2050.                             i3 = 0xffff00 - 0x50000 * (j3 - 50);
  2051.                         else
  2052.                         if(j3 < 150)
  2053.                             i3 = 65280 + 5 * (j3 - 100);
  2054.                     }
  2055.                     if(anIntArray980[k] == 10) {
  2056.                         int k3 = 150 - anIntArray982[k];
  2057.                         if(k3 < 50)
  2058.                             i3 = 0xff0000 + 5 * k3;
  2059.                         else
  2060.                         if(k3 < 100)
  2061.                             i3 = 0xff00ff - 0x50000 * (k3 - 50);
  2062.                         else
  2063.                         if(k3 < 150)
  2064.                             i3 = (255 + 0x50000 * (k3 - 100)) - 5 * (k3 - 100);
  2065.                     }
  2066.                     if(anIntArray980[k] == 11) {
  2067.                         int l3 = 150 - anIntArray982[k];
  2068.                         if(l3 < 50)
  2069.                             i3 = 0xffffff - 0x50005 * l3;
  2070.                         else
  2071.                         if(l3 < 100)
  2072.                             i3 = 65280 + 0x50005 * (l3 - 50);
  2073.                         else
  2074.                         if(l3 < 150)
  2075.                             i3 = 0xffffff - 0x50000 * (l3 - 100);
  2076.                     }
  2077.                     if(anIntArray981[k] == 0) {
  2078.                         boldFont.drawText(0, s, spriteDrawY + 1, spriteDrawX);
  2079.                         boldFont.drawText(i3, s, spriteDrawY, spriteDrawX);
  2080.                     }
  2081.                     if(anIntArray981[k] == 1) {
  2082.                         boldFont.method386(0, s, spriteDrawX, anInt1265, spriteDrawY + 1);
  2083.                         boldFont.method386(i3, s, spriteDrawX, anInt1265, spriteDrawY);
  2084.                     }
  2085.                     if(anIntArray981[k] == 2) {
  2086.                         boldFont.method387(spriteDrawX, s, anInt1265, spriteDrawY + 1, 0);
  2087.                         boldFont.method387(spriteDrawX, s, anInt1265, spriteDrawY, i3);
  2088.                     }
  2089.                     if(anIntArray981[k] == 3) {
  2090.                         boldFont.method388(150 - anIntArray982[k], s, anInt1265, spriteDrawY + 1, spriteDrawX, 0);
  2091.                         boldFont.method388(150 - anIntArray982[k], s, anInt1265, spriteDrawY, spriteDrawX, i3);
  2092.                     }
  2093.                     if(anIntArray981[k] == 4) {
  2094.                         int i4 = boldFont.method384(s);
  2095.                         int k4 = ((150 - anIntArray982[k]) * (i4 + 100)) / 150;
  2096.                         DrawingArea.setDrawingArea(334, spriteDrawX - 50, spriteDrawX + 50, 0);
  2097.                         boldFont.method385(0, s, spriteDrawY + 1, (spriteDrawX + 50) - k4);
  2098.                         boldFont.method385(i3, s, spriteDrawY, (spriteDrawX + 50) - k4);
  2099.                         DrawingArea.defaultDrawingAreaSize();
  2100.                     }
  2101.                     if(anIntArray981[k] == 5) {
  2102.                         int j4 = 150 - anIntArray982[k];
  2103.                         int l4 = 0;
  2104.                         if(j4 < 25)
  2105.                             l4 = j4 - 25;
  2106.                         else
  2107.                         if(j4 > 125)
  2108.                             l4 = j4 - 125;
  2109.                         DrawingArea.setDrawingArea(spriteDrawY + 5, 0, 512, spriteDrawY - boldFont.anInt1497 - 1);
  2110.                         boldFont.drawText(0, s, spriteDrawY + 1 + l4, spriteDrawX);
  2111.                         boldFont.drawText(i3, s, spriteDrawY + l4, spriteDrawX);
  2112.                         DrawingArea.defaultDrawingAreaSize();
  2113.                     }
  2114.                 } else {
  2115.                     boldFont.drawText(0, s, spriteDrawY + 1, spriteDrawX);
  2116.                     boldFont.drawText(0xffff00, s, spriteDrawY, spriteDrawX);
  2117.                 }
  2118.             }
  2119.         } catch(Exception e){ }
  2120.     }
  2121.  
  2122.     private void delFriend(long l)
  2123.     {
  2124.         try
  2125.         {
  2126.             if(l == 0L)
  2127.                 return;
  2128.             for(int i = 0; i < friendsCount; i++)
  2129.             {
  2130.                 if(friendsListAsLongs[i] != l)
  2131.                     continue;
  2132.                 friendsCount--;
  2133.                 needDrawTabArea = true;
  2134.                 for(int j = i; j < friendsCount; j++)
  2135.                 {
  2136.                     friendsList[j] = friendsList[j + 1];
  2137.                     friendsNodeIDs[j] = friendsNodeIDs[j + 1];
  2138.                     friendsListAsLongs[j] = friendsListAsLongs[j + 1];
  2139.                 }
  2140.  
  2141.                 stream.createFrame(215);
  2142.                 stream.writeQWord(l);
  2143.                 break;
  2144.             }
  2145.         }
  2146.         catch(RuntimeException runtimeexception)
  2147.         {
  2148.             signlink.reporterror("18622, " + false + ", " + l + ", " + runtimeexception.toString());
  2149.             throw new RuntimeException();
  2150.         }
  2151.     }
  2152.  
  2153.     private void drawIventoryStones(int paddingX,int paddingY) {
  2154.         paddingX = paddingX + 2;//tabSpace
  2155.         if(toggleFullscreen) {
  2156.             inventoryStones[2].drawSprite(1 + paddingX, 261 + paddingY);
  2157.             inventoryStones[2].drawSprite(31 + paddingX, 261 + paddingY);
  2158.             inventoryStones[2].drawSprite(61 + paddingX, 261 + paddingY);
  2159.             inventoryStones[2].drawSprite(91 + paddingX, 261 + paddingY);
  2160.             inventoryStones[2].drawSprite(121 + paddingX, 261 + paddingY);
  2161.             inventoryStones[2].drawSprite(151 + paddingX, 261 + paddingY);
  2162.             inventoryStones[2].drawSprite(181 + paddingX, 261 + paddingY);
  2163.             inventoryStones[2].drawSprite(211 + paddingX, 261 + paddingY);
  2164.            
  2165.             inventoryStones[2].drawSprite(1 + paddingX, 298 + paddingY);
  2166.             inventoryStones[2].drawSprite(31 + paddingX, 298 + paddingY);
  2167.             inventoryStones[2].drawSprite(61 + paddingX, 298 + paddingY);
  2168.             inventoryStones[2].drawSprite(91 + paddingX, 298 + paddingY);
  2169.             inventoryStones[2].drawSprite(121 + paddingX, 298 + paddingY);
  2170.             inventoryStones[2].drawSprite(151 + paddingX, 298 + paddingY);
  2171.             inventoryStones[2].drawSprite(181 + paddingX,298 + paddingY);
  2172.             inventoryStones[2].drawSprite(211 + paddingX, 298 + paddingY);
  2173.         }
  2174.         //if(!contextMenuOpen) {
  2175.             if(tabInterfaceIDs[0] != -1)
  2176.                 inventoryStones[tabIDHover == 0 ? 1 : 2].drawSprite(1 + paddingX, (toggleFullscreen ? 261 : 0) + paddingY);
  2177.             if(tabInterfaceIDs[14] != -1)
  2178.                 inventoryStones[tabIDHover == 1 ? 1 : 2].drawSprite(31 + paddingX, (toggleFullscreen ? 261 : 0) + paddingY);
  2179.             if(tabInterfaceIDs[1] != -1)
  2180.                 inventoryStones[tabIDHover == 2 ? 1 : 2].drawSprite(61 + paddingX, (toggleFullscreen ? 261 : 0) + paddingY);
  2181.             if(tabInterfaceIDs[2] != -1)
  2182.                 inventoryStones[tabIDHover == 3 ? 1 : 2].drawSprite(91 + paddingX, (toggleFullscreen ? 261 : 0) + paddingY);
  2183.             if(tabInterfaceIDs[3] != -1)
  2184.                 inventoryStones[tabIDHover == 4 ? 1 : 2].drawSprite(121 + paddingX, (toggleFullscreen ? 261 : 0) + paddingY);
  2185.             if(tabInterfaceIDs[4] != -1)
  2186.                 inventoryStones[tabIDHover == 5 ? 1 : 2].drawSprite(151 + paddingX, (toggleFullscreen ? 261 : 0) + paddingY);
  2187.             if(tabInterfaceIDs[5] != -1)
  2188.                 inventoryStones[tabIDHover == 6 ? 1 : 2].drawSprite(181 + paddingX, (toggleFullscreen ? 261 : 0) + paddingY);
  2189.             if(tabInterfaceIDs[6] != -1)
  2190.                 inventoryStones[tabIDHover == 7 ? 1 : 2].drawSprite(211 + paddingX, (toggleFullscreen ? 261 : 0) + paddingY);
  2191.                
  2192.             if(tabInterfaceIDs[16] != -1)
  2193.                 inventoryStones[tabIDHover == 14 ? 1 : 2].drawSprite(1 + paddingX, 298 + paddingY);
  2194.             if(tabInterfaceIDs[9] != -1)
  2195.                 inventoryStones[tabIDHover == 8 ? 1 : 2].drawSprite(31 + paddingX, 298 + paddingY);
  2196.             if(tabInterfaceIDs[8] != -1)
  2197.                 inventoryStones[tabIDHover == 9 ? 1 : 2].drawSprite(61 + paddingX, 298 + paddingY);
  2198.             if(tabInterfaceIDs[7] != -1)
  2199.                 inventoryStones[tabIDHover == 10 ? 1 : 2].drawSprite(91 + paddingX, 298 + paddingY);
  2200.             if(tabInterfaceIDs[11] != -1)
  2201.                 inventoryStones[tabIDHover == 11 ? 1 : 2].drawSprite(121 + paddingX, 298 + paddingY);
  2202.             if(tabInterfaceIDs[12] != -1)
  2203.                 inventoryStones[tabIDHover == 12 ? 1 : 2].drawSprite(151 + paddingX, 298 + paddingY);
  2204.             if(tabInterfaceIDs[13] != -1)
  2205.                 inventoryStones[tabIDHover == 13 ? 1 : 2].drawSprite(181 + paddingX,298 + paddingY);
  2206.             if(tabInterfaceIDs[15] != -1)
  2207.                 inventoryStones[tabIDHover == 15 ? 1 : 2].drawSprite(211 + paddingX, 298 + paddingY);
  2208.         //}
  2209.         if(invOverlayInterfaceID == -1 && focusTab != -1) {
  2210.             try {
  2211.             if(tabInterfaceIDs[tabID] != -1) {
  2212.                 if(tabID == 0)
  2213.                     inventoryStones[0].drawSprite(1 + paddingX, (toggleFullscreen ? 261 : 0) + paddingY);
  2214.                 if(tabID == 14)
  2215.                     inventoryStones[0].drawSprite(31 + paddingX, (toggleFullscreen ? 261 : 0) + paddingY);
  2216.                 if(tabID == 1)
  2217.                     inventoryStones[0].drawSprite(61 + paddingX, (toggleFullscreen ? 261 : 0) + paddingY);
  2218.                 if(tabID == 2)
  2219.                     inventoryStones[0].drawSprite(91 + paddingX, (toggleFullscreen ? 261 : 0) + paddingY);
  2220.                 if(tabID == 3)
  2221.                     inventoryStones[0].drawSprite(121 + paddingX, (toggleFullscreen ? 261 : 0) + paddingY);
  2222.                 if(tabID == 4)
  2223.                     inventoryStones[0].drawSprite(151 + paddingX, (toggleFullscreen ? 261 : 0) + paddingY);
  2224.                 if(tabID == 5)
  2225.                     inventoryStones[0].drawSprite(181 + paddingX, (toggleFullscreen ? 261 : 0) + paddingY);
  2226.                 if(tabID == 6)
  2227.                     inventoryStones[0].drawSprite(211 + paddingX, (toggleFullscreen ? 261 : 0) + paddingY);
  2228.                 if(tabID == 16)
  2229.                     inventoryStones[0].drawSprite(1 + paddingX, 298 + paddingY);
  2230.                 if(tabID == 8)
  2231.                     inventoryStones[0].drawSprite(31 + paddingX, 298 + paddingY);
  2232.                 if(tabID == 9)
  2233.                     inventoryStones[0].drawSprite(61 + paddingX, 298 + paddingY);
  2234.                 if(tabID == 7)
  2235.                     inventoryStones[0].drawSprite(91 + paddingX, 298 + paddingY);
  2236.                 if(tabID == 11)
  2237.                     inventoryStones[0].drawSprite(121 + paddingX, 298 + paddingY);
  2238.                 if(tabID == 12)
  2239.                     inventoryStones[0].drawSprite(151 + paddingX, 298 + paddingY);
  2240.                 if(tabID == 13)
  2241.                     inventoryStones[0].drawSprite(181 + paddingX, 298 + paddingY);
  2242.                 if(tabID == 15)
  2243.                     inventoryStones[0].drawSprite(211 + paddingX, 298 + paddingY);
  2244.             }
  2245.         } catch(Exception e) { tabID = 1; }
  2246.         }
  2247.     }
  2248.    
  2249.     private void drawSideIcons(int paddingX, int paddingY) {
  2250.         if(tabIconFlash != -1)
  2251.             tabAreaAltered = true;
  2252.         if(tabAreaAltered) {
  2253.             if(tabIconFlash != -1 && tabIconFlash == tabID) {
  2254.                 tabIconFlash = -1;
  2255.                 stream.createFrame(120);
  2256.                 stream.writeWordBigEndian(tabID);
  2257.             }
  2258.             tabAreaAltered = false;
  2259.         }
  2260.         if(invOverlayInterfaceID == -1) {
  2261.             if(tabInterfaceIDs[0] != -1 && (tabIconFlash != 0 || loopCycle % 20 < 10))
  2262.                 sideIcons[0].drawSprite(3 + 5 + paddingX, (toggleFullscreen ? 261 : 0) + 9 + paddingY);//Combat
  2263.             if(tabInterfaceIDs[14] != -1 && (tabIconFlash != 1 || loopCycle % 20 < 10))
  2264.                 sideIcons[3].drawSprite(33 + 4 + paddingX, (toggleFullscreen ? 261 : 0) + 9 + paddingY);//skills
  2265.             if(tabInterfaceIDs[1] != -1 && (tabIconFlash != 2 || loopCycle % 20 < 10))
  2266.                 sideIcons[1].drawSprite(63 + 4 + paddingX, (toggleFullscreen ? 261 : 0) + 8 + paddingY);//quests
  2267.             if(tabInterfaceIDs[2] != -1 && (tabIconFlash != 14 || loopCycle % 20 < 10))
  2268.                 sideIcons[2].drawSprite(93 + 4 + paddingX, (toggleFullscreen ? 261 : 0) + 8 + paddingY);//task system
  2269.             if(tabInterfaceIDs[3] != -1 && (tabIconFlash != 3 || loopCycle % 20 < 10))
  2270.                 sideIcons[4].drawSprite(123 + 4 + paddingX, (toggleFullscreen ? 261 : 0) + 9 + paddingY);//inventory
  2271.             if(tabInterfaceIDs[4] != -1 && (tabIconFlash != 4 || loopCycle % 20 < 10))
  2272.                 sideIcons[5].drawSprite(153 + 6 + paddingX, (toggleFullscreen ? 261 : 0) + 8 + paddingY);//equipment
  2273.             if(tabInterfaceIDs[5] != -1 && (tabIconFlash != 5 || loopCycle % 20 < 10))
  2274.                 sideIcons[6].drawSprite(183 + 4 + paddingX, (toggleFullscreen ? 261 : 0) + 9 + paddingY);//prayer
  2275.             if(tabInterfaceIDs[6] != -1 && (tabIconFlash != 6 || loopCycle % 20 < 10))
  2276.                 sideIcons[7].drawSprite(213 + 4 + paddingX, (toggleFullscreen ? 261 : 0) + 9 + paddingY);//magic
  2277.                
  2278.             if(tabInterfaceIDs[14] != -1 && (tabIconFlash != 7 || loopCycle % 20 < 10))
  2279.                 sideIcons[8].drawSprite(3 + 4 + paddingX, 298 + 10 + paddingY);//Guide
  2280.             if(tabInterfaceIDs[9] != -1 && (tabIconFlash != 9 || loopCycle % 20 < 10))
  2281.                 sideIcons[9].drawSprite(33 + 5 + paddingX, 298 + 9 + paddingY);//friends
  2282.             if(tabInterfaceIDs[8] != -1 && (tabIconFlash != 8 || loopCycle % 20 < 10))
  2283.                 sideIcons[10].drawSprite(63 + 7 + paddingX, 298 + 9 + paddingY);//ignore
  2284.             if(tabInterfaceIDs[7] != -1 && (tabIconFlash != 7 || loopCycle % 20 < 10))
  2285.                 sideIcons[11].drawSprite(93 + 4 + paddingX, 298 + 10 + paddingY);//clan
  2286.             if(tabInterfaceIDs[11] != -1 && (tabIconFlash != 11 || loopCycle % 20 < 10))
  2287.                 sideIcons[12].drawSprite(123 + 4 + paddingX, 298 + 9 + paddingY);//option
  2288.             if(tabInterfaceIDs[12] != -1 && (tabIconFlash != 12 || loopCycle % 20 < 10))
  2289.                 sideIcons[13].drawSprite(153 + 4 + paddingX, 298 + 9 + paddingY);//emotes
  2290.             if(tabInterfaceIDs[13] != -1 && (tabIconFlash != 13 || loopCycle % 20 < 10))
  2291.                 sideIcons[14].drawSprite(183 + 3 + paddingX, 298 + 8 + paddingY);//music
  2292.             if(tabInterfaceIDs[15] != -1 && (tabIconFlash != 15 || loopCycle % 20 < 10))
  2293.                 sideIcons[15].drawSprite(213 + 4 + paddingX, 298 + 11 + paddingY);//notes
  2294.         }
  2295.     }
  2296.  
  2297.     private void drawTabArea(RSImageProducer tabImage, int paddingX,int paddingY) {
  2298.         tabImage.initDrawingArea();
  2299.         Texture.anIntArray1472 = anIntArray1181;
  2300.         if(toggleFullscreen) {
  2301.             if(focusTab != -1)
  2302.                 tabAreaSprite[1].drawSprite1(45-23 + paddingX ,55-23 + paddingY - (toggleFullscreen ? 46 : 0),192);
  2303.         } else
  2304.             tabAreaSprite[0].drawSprite(0 + paddingX,0 + paddingY);
  2305.        
  2306.         drawIventoryStones(paddingX,paddingY);
  2307.         drawSideIcons(paddingX,paddingY);
  2308.        
  2309.         if(invOverlayInterfaceID != -1)
  2310.             drawInterface(0, 28 + paddingX, RSInterface.interfaceCache[invOverlayInterfaceID], 37 - (toggleFullscreen ? 46 : 0) + paddingY);
  2311.         else if(tabInterfaceIDs[tabID] != -1 && focusTab != -1)
  2312.             drawInterface(0, 28 + paddingX, RSInterface.interfaceCache[tabInterfaceIDs[tabID]], 37 - (toggleFullscreen ? 46 : 0) + paddingY);
  2313.         if(contextMenuOpen && !toggleFullscreen)
  2314.             drawMenu(519, 168);//Tab area
  2315.         Texture.anIntArray1472 = anIntArray1182;
  2316.     }
  2317.    
  2318.     private void drawRightFrameArea() {
  2319.         rightFrame.initDrawingArea();
  2320.         rightFrameSprite.drawSprite(0,0);
  2321.         if(contextMenuOpen && !toggleFullscreen) {
  2322.             drawMenu(516, 168);
  2323.         }
  2324.         rightFrame.drawGraphics(168, super.graphics, 516);
  2325.         main3DArea.initDrawingArea();
  2326.     }
  2327.    
  2328.     private void method37(int j) {
  2329.         if(Texture.anIntArray1480[17] >= j) {
  2330.                 Background background = Texture.aBackgroundArray1474s[17];
  2331.                 int k = background.anInt1452 * background.anInt1453 - 1;
  2332.                 //fire cape apparently?
  2333.                 int j1 = background.anInt1452 * anInt945 * 2;
  2334.                 byte abyte0[] = background.aByteArray1450;
  2335.                 byte abyte3[] = aByteArray912;
  2336.                 for(int i2 = 0; i2 <= k; i2++)
  2337.                     abyte3[i2] = abyte0[i2 - j1 & k];
  2338.  
  2339.                 background.aByteArray1450 = abyte3;
  2340.                 aByteArray912 = abyte0;
  2341.                 Texture.method370(17);
  2342.                 anInt854++;
  2343.                 if(anInt854 > 1235) {
  2344.                     anInt854 = 0;
  2345.                     stream.createFrame(226);
  2346.                     stream.writeWordBigEndian(0);
  2347.                     int l2 = stream.currentOffset;
  2348.                     stream.writeWord(58722);
  2349.                     stream.writeWordBigEndian(240);
  2350.                     stream.writeWord((int)(Math.random() * 65536D));
  2351.                     stream.writeWordBigEndian((int)(Math.random() * 256D));
  2352.                     if((int)(Math.random() * 2D) == 0)
  2353.                         stream.writeWord(51825);
  2354.                     stream.writeWordBigEndian((int)(Math.random() * 256D));
  2355.                     stream.writeWord((int)(Math.random() * 65536D));
  2356.                     stream.writeWord(7130);
  2357.                     stream.writeWord((int)(Math.random() * 65536D));
  2358.                     stream.writeWord(61657);
  2359.                     stream.writeBytes(stream.currentOffset - l2);
  2360.                 }
  2361.             }
  2362.             if(Texture.anIntArray1480[24] >= j) {
  2363.                 Background background_1 = Texture.aBackgroundArray1474s[24];
  2364.                 int l = background_1.anInt1452 * background_1.anInt1453 - 1;
  2365.                 int k1 = background_1.anInt1452 * anInt945 * 2;
  2366.                 byte abyte1[] = background_1.aByteArray1450;
  2367.                 byte abyte4[] = aByteArray912;
  2368.                 for(int j2 = 0; j2 <= l; j2++)
  2369.                     abyte4[j2] = abyte1[j2 - k1 & l];
  2370.  
  2371.                 background_1.aByteArray1450 = abyte4;
  2372.                 aByteArray912 = abyte1;
  2373.                 Texture.method370(24);
  2374.             }
  2375.             if(Texture.anIntArray1480[34] >= j) {
  2376.                 Background background_2 = Texture.aBackgroundArray1474s[34];
  2377.                 int i1 = background_2.anInt1452 * background_2.anInt1453 - 1;
  2378.                 int l1 = background_2.anInt1452 * anInt945 * 2;
  2379.                 byte abyte2[] = background_2.aByteArray1450;
  2380.                 byte abyte5[] = aByteArray912;
  2381.                 for(int k2 = 0; k2 <= i1; k2++)
  2382.                     abyte5[k2] = abyte2[k2 - l1 & i1];
  2383.  
  2384.                 background_2.aByteArray1450 = abyte5;
  2385.                 aByteArray912 = abyte2;
  2386.                 Texture.method370(34);
  2387.             }
  2388.             if(Texture.anIntArray1480[40] >= j)
  2389.             {
  2390.                 Background background_2 = Texture.aBackgroundArray1474s[40];
  2391.                 int i1 = background_2.anInt1452 * background_2.anInt1453 - 1;
  2392.                 int l1 = background_2.anInt1452 * anInt945 * 1;
  2393.                 byte abyte2[] = background_2.aByteArray1450;
  2394.                 byte abyte5[] = aByteArray912;
  2395.                 for(int k2 = 0; k2 <= i1; k2++)
  2396.                     abyte5[k2] = abyte2[k2 - l1 & i1];
  2397.  
  2398.                 background_2.aByteArray1450 = abyte5;
  2399.                 aByteArray912 = abyte2;
  2400.                 Texture.method370(40);
  2401.             }
  2402.        
  2403.     }
  2404.  
  2405.     private void method38() {
  2406.         for(int i = -1; i < playerCount; i++) {
  2407.             int j;
  2408.             if(i == -1)
  2409.                 j = myPlayerIndex;
  2410.             else
  2411.                 j = playerIndices[i];
  2412.             Player player = playerArray[j];
  2413.             if(player != null && player.textCycle > 0) {
  2414.                 player.textCycle--;
  2415.                 if(player.textCycle == 0)
  2416.                     player.textSpoken = null;
  2417.             }
  2418.         }
  2419.         for(int k = 0; k < npcCount; k++) {
  2420.             int l = npcIndices[k];
  2421.             NPC npc = npcArray[l];
  2422.             if(npc != null && npc.textCycle > 0) {
  2423.                 npc.textCycle--;
  2424.                 if(npc.textCycle == 0)
  2425.                     npc.textSpoken = null;
  2426.             }
  2427.         }
  2428.     }
  2429.  
  2430.     private void calcCameraPos() {
  2431.         int i = anInt1098 * 128 + 64;
  2432.         int j = anInt1099 * 128 + 64;
  2433.         int k = method42(plane, j, i) - anInt1100;
  2434.         if(xCameraPos < i) {
  2435.             xCameraPos += anInt1101 + ((i - xCameraPos) * anInt1102) / 1000;
  2436.             if(xCameraPos > i)
  2437.                 xCameraPos = i;
  2438.         }
  2439.         if(xCameraPos > i) {
  2440.             xCameraPos -= anInt1101 + ((xCameraPos - i) * anInt1102) / 1000;
  2441.             if(xCameraPos < i)
  2442.                 xCameraPos = i;
  2443.         }
  2444.         if(zCameraPos < k) {
  2445.             zCameraPos += anInt1101 + ((k - zCameraPos) * anInt1102) / 1000;
  2446.             if(zCameraPos > k)
  2447.                 zCameraPos = k;
  2448.         }
  2449.         if(zCameraPos > k) {
  2450.             zCameraPos -= anInt1101 + ((zCameraPos - k) * anInt1102) / 1000;
  2451.             if(zCameraPos < k)
  2452.                 zCameraPos = k;
  2453.         }
  2454.         if(yCameraPos < j) {
  2455.             yCameraPos += anInt1101 + ((j - yCameraPos) * anInt1102) / 1000;
  2456.             if(yCameraPos > j)
  2457.                 yCameraPos = j;
  2458.         }
  2459.         if(yCameraPos > j) {
  2460.             yCameraPos -= anInt1101 + ((yCameraPos - j) * anInt1102) / 1000;
  2461.             if(yCameraPos < j)
  2462.                 yCameraPos = j;
  2463.         }
  2464.         i = anInt995 * 128 + 64;
  2465.         j = anInt996 * 128 + 64;
  2466.         k = method42(plane, j, i) - anInt997;
  2467.         int l = i - xCameraPos;
  2468.         int i1 = k - zCameraPos;
  2469.         int j1 = j - yCameraPos;
  2470.         int k1 = (int)Math.sqrt(l * l + j1 * j1);
  2471.         int l1 = (int)(Math.atan2(i1, k1) * 325.94900000000001D) & 0x7ff;
  2472.         int i2 = (int)(Math.atan2(l, j1) * -325.94900000000001D) & 0x7ff;
  2473.         if(l1 < 128)
  2474.             l1 = 128;
  2475.         if(l1 > 383)
  2476.             l1 = 383;
  2477.         if(yCameraCurve < l1) {
  2478.             yCameraCurve += anInt998 + ((l1 - yCameraCurve) * anInt999) / 1000;
  2479.             if(yCameraCurve > l1)
  2480.                 yCameraCurve = l1;
  2481.         }
  2482.         if(yCameraCurve > l1) {
  2483.             yCameraCurve -= anInt998 + ((yCameraCurve - l1) * anInt999) / 1000;
  2484.             if(yCameraCurve < l1)
  2485.                 yCameraCurve = l1;
  2486.         }
  2487.         int j2 = i2 - xCameraCurve;
  2488.         if(j2 > 1024)
  2489.             j2 -= 2048;
  2490.         if(j2 < -1024)
  2491.             j2 += 2048;
  2492.         if(j2 > 0) {
  2493.             xCameraCurve += anInt998 + (j2 * anInt999) / 1000;
  2494.             xCameraCurve &= 0x7ff;
  2495.         }
  2496.         if(j2 < 0) {
  2497.             xCameraCurve -= anInt998 + (-j2 * anInt999) / 1000;
  2498.             xCameraCurve &= 0x7ff;
  2499.         }
  2500.         int k2 = i2 - xCameraCurve;
  2501.         if(k2 > 1024)
  2502.             k2 -= 2048;
  2503.         if(k2 < -1024)
  2504.             k2 += 2048;
  2505.         if(k2 < 0 && j2 > 0 || k2 > 0 && j2 < 0)
  2506.             xCameraCurve = i2;
  2507.     }
  2508.  
  2509.     private void drawMenu(int xOffSet, int yOffSet) {
  2510.         int xPos = menuOffsetX - (xOffSet - 4);
  2511.         int yPos = (-yOffSet + 4) + menuOffsetY;
  2512.         int menuW = menuWidth;
  2513.         int menuH = menuHeight + 1;
  2514.         needDrawTabArea = true;
  2515.         inputTaken = true;
  2516.         tabAreaAltered = true;
  2517.         //DrawingArea.drawPixels(height, yPos, xPos, color, width);
  2518.         //DrawingArea.fillPixels(xPos, width, height, color, yPos);
  2519.         DrawingArea.drawPixels(menuH - 4, yPos + 2, xPos, 0x706a5e, menuW);
  2520.         DrawingArea.drawPixels(menuH - 2, yPos + 1, xPos + 1, 0x706a5e, menuW - 2);
  2521.         DrawingArea.drawPixels(menuH, yPos, xPos + 2, 0x706a5e, menuW - 4);
  2522.         DrawingArea.drawPixels(menuH - 2, yPos + 1, xPos + 3, 0x2d2822, menuW - 6);
  2523.         DrawingArea.drawPixels(menuH - 4, yPos + 2, xPos + 2, 0x2d2822, menuW - 4);
  2524.         DrawingArea.drawPixels(menuH - 6, yPos + 3, xPos + 1, 0x2d2822, menuW - 2);
  2525.         DrawingArea.drawPixels(menuH - 22, yPos + 19, xPos + 2, 0x524a3d, menuW - 4);
  2526.         DrawingArea.drawPixels(menuH - 22, yPos + 20, xPos + 3, 0x524a3d, menuW - 6);
  2527.         DrawingArea.drawPixels(menuH - 23, yPos + 20, xPos + 3, 0x2b271c, menuW - 6);
  2528.         DrawingArea.fillPixels(xPos + 3, menuW - 6, 1, 0x2a291b, yPos + 2);
  2529.         DrawingArea.fillPixels(xPos + 2, menuW - 4, 1, 0x2a261b, yPos + 3);
  2530.         DrawingArea.fillPixels(xPos + 2, menuW - 4, 1, 0x252116, yPos + 4);
  2531.         DrawingArea.fillPixels(xPos + 2, menuW - 4, 1, 0x211e15, yPos + 5);
  2532.         DrawingArea.fillPixels(xPos + 2, menuW - 4, 1, 0x1e1b12, yPos + 6);
  2533.         DrawingArea.fillPixels(xPos + 2, menuW - 4, 1, 0x1a170e, yPos + 7);
  2534.         DrawingArea.fillPixels(xPos + 2, menuW - 4, 2, 0x15120b, yPos + 8);
  2535.         DrawingArea.fillPixels(xPos + 2, menuW - 4, 1, 0x100d08, yPos + 10);
  2536.         DrawingArea.fillPixels(xPos + 2, menuW - 4, 1, 0x090a04, yPos + 11);
  2537.         DrawingArea.fillPixels(xPos + 2, menuW - 4, 1, 0x080703, yPos + 12);
  2538.         DrawingArea.fillPixels(xPos + 2, menuW - 4, 1, 0x090a04, yPos + 13);
  2539.         DrawingArea.fillPixels(xPos + 2, menuW - 4, 1, 0x070802, yPos + 14);
  2540.         DrawingArea.fillPixels(xPos + 2, menuW - 4, 1, 0x090a04, yPos + 15);
  2541.         DrawingArea.fillPixels(xPos + 2, menuW - 4, 1, 0x070802, yPos + 16);
  2542.         DrawingArea.fillPixels(xPos + 2, menuW - 4, 1, 0x090a04, yPos + 17);
  2543.         DrawingArea.fillPixels(xPos + 2, menuW - 4, 1, 0x2a291b, yPos + 18);
  2544.         DrawingArea.fillPixels(xPos + 3, menuW - 6, 1, 0x564943, yPos + 19);
  2545.         boldFont.method385(0xc6b895, "Choose Option", yPos + 14, xPos + 3);
  2546.         int j1 = super.mouseX;
  2547.         int k1 = super.mouseY;
  2548.         int mouseX = super.mouseX - (xOffSet);
  2549.         int mouseY = (-yOffSet) + super.mouseY;
  2550.         for(int l1 = 0; l1 < menuActionRow; l1++) {
  2551.             int textY = yPos + 31 + (menuActionRow - 1 - l1) * 15;
  2552.             int disColor = 0xc6b895;
  2553.             if(mouseX > xPos && mouseX < xPos + menuW && mouseY > textY - 13 && mouseY < textY + 3) {
  2554.                 DrawingArea.drawPixels(15, textY - 11, xPos + 3, 0x6f695d, menuWidth - 6);
  2555.                 disColor = 0xeee5c6;
  2556.             }
  2557.             boldFont.method389(true, xPos + 3, disColor, menuActionName[l1], textY);
  2558.         }
  2559.     }
  2560.  
  2561.     private void addFriend(long l) {
  2562.         try {
  2563.             if(l == 0L)
  2564.                 return;
  2565.             if(friendsCount >= 100 && anInt1046 != 1) {
  2566.                 pushMessage("Your friendlist is full. Max of 100 for free users, and 200 for members", 0, "");
  2567.                 return;
  2568.             }
  2569.             if(friendsCount >= 200) {
  2570.                 pushMessage("Your friendlist is full. Max of 100 for free users, and 200 for members", 0, "");
  2571.                 return;
  2572.             }
  2573.             String s = TextClass.fixName(TextClass.nameForLong(l));
  2574.             for(int i = 0; i < friendsCount; i++)
  2575.                 if(friendsListAsLongs[i] == l) {
  2576.                     pushMessage(s + " is already on your friend list", 0, "");
  2577.                     return;
  2578.                 }
  2579.             for(int j = 0; j < ignoreCount; j++)
  2580.                 if(ignoreListAsLongs[j] == l) {
  2581.                     pushMessage("Please remove " + s + " from your ignore list first", 0, "");
  2582.                     return;
  2583.                 }
  2584.  
  2585.             if(s.equals(myPlayer.name)) {
  2586.                 return;
  2587.             } else {
  2588.                 friendsList[friendsCount] = s;
  2589.                 friendsListAsLongs[friendsCount] = l;
  2590.                 friendsNodeIDs[friendsCount] = 0;
  2591.                 friendsCount++;
  2592.                 needDrawTabArea = true;
  2593.                 stream.createFrame(188);
  2594.                 stream.writeQWord(l);
  2595.                 return;
  2596.             }
  2597.         } catch(RuntimeException runtimeexception) {
  2598.             signlink.reporterror("15283, " + (byte)68 + ", " + l + ", " + runtimeexception.toString());
  2599.         }
  2600.         throw new RuntimeException();
  2601.     }
  2602.  
  2603.     private int method42(int i, int j, int k) {
  2604.         int l = k >> 7;
  2605.         int i1 = j >> 7;
  2606.         if(l < 0 || i1 < 0 || l > 103 || i1 > 103)
  2607.             return 0;
  2608.         int j1 = i;
  2609.         if(j1 < 3 && (byteGroundArray[1][l][i1] & 2) == 2)
  2610.             j1++;
  2611.         int k1 = k & 0x7f;
  2612.         int l1 = j & 0x7f;
  2613.         int i2 = intGroundArray[j1][l][i1] * (128 - k1) + intGroundArray[j1][l + 1][i1] * k1 >> 7;
  2614.         int j2 = intGroundArray[j1][l][i1 + 1] * (128 - k1) + intGroundArray[j1][l + 1][i1 + 1] * k1 >> 7;
  2615.         return i2 * (128 - l1) + j2 * l1 >> 7;
  2616.     }
  2617.  
  2618.     private static String intToKOrMil(int j) {
  2619.         if(j < 0x186a0)
  2620.             return String.valueOf(j);
  2621.         if(j < 0x989680)
  2622.             return j / 1000 + "K";
  2623.         else
  2624.             return j / 0xf4240 + "M";
  2625.     }
  2626.  
  2627.     private void resetLogout() {
  2628.         try {
  2629.             if(socketStream != null)
  2630.                 socketStream.close();
  2631.         }
  2632.         catch(Exception _ex) { }
  2633.         socketStream = null;
  2634.         loggedIn = false;
  2635.         alertHandler.alert = null;
  2636.         loginScreenState = 0;
  2637.         //myUsername = "";
  2638.         //myPassword = "";
  2639.         unlinkMRUNodes();
  2640.         worldController.initToNull();
  2641.         for(int i = 0; i < 4; i++)
  2642.             aClass11Array1230[i].method210();
  2643.         System.gc();
  2644.         stopMidi();
  2645.         currentSong = -1;
  2646.         nextSong = -1;
  2647.         prevSong = 0;
  2648.         autocastId = 0;
  2649.         autoCast = false;
  2650.         turnOffPrayers();
  2651.         orbToggle[1] = false;
  2652.         if(toggleFullscreen)
  2653.             switchToNormal();
  2654.     }
  2655.  
  2656.     private void method45() {
  2657.         aBoolean1031 = true;
  2658.         for(int j = 0; j < 7; j++) {
  2659.             anIntArray1065[j] = -1;
  2660.             for(int k = 0; k < IDK.length; k++) {
  2661.                 if(IDK.cache[k].aBoolean662 || IDK.cache[k].anInt657 != j + (aBoolean1047 ? 0 : 7))
  2662.                     continue;
  2663.                 anIntArray1065[j] = k;
  2664.                 break;
  2665.             }
  2666.         }
  2667.     }
  2668.    
  2669.     private void method46(int i, Stream stream) {
  2670.         while(stream.bitPosition + 21 < i * 8) {
  2671.             int k = stream.readBits(14);
  2672.             if(k == 16383)
  2673.                 break;
  2674.             if(npcArray[k] == null)
  2675.                 npcArray[k] = new NPC();
  2676.             NPC npc = npcArray[k];
  2677.             npcIndices[npcCount++] = k;
  2678.             npc.anInt1537 = loopCycle;
  2679.             int l = stream.readBits(5);
  2680.             if(l > 15)
  2681.                 l -= 32;
  2682.             int i1 = stream.readBits(5);
  2683.             if(i1 > 15)
  2684.                 i1 -= 32;
  2685.             int j1 = stream.readBits(1);
  2686.             npc.desc = EntityDef.forID(stream.readBits(14));
  2687.             int k1 = stream.readBits(1);
  2688.             if(k1 == 1)
  2689.                 anIntArray894[anInt893++] = k;
  2690.             npc.anInt1540 = npc.desc.aByte68;
  2691.             npc.anInt1504 = npc.desc.anInt79;
  2692.             npc.anInt1554 = npc.desc.walkAnim;
  2693.             npc.anInt1555 = npc.desc.anInt58;
  2694.             npc.anInt1556 = npc.desc.anInt83;
  2695.             npc.anInt1557 = npc.desc.anInt55;
  2696.             npc.anInt1511 = npc.desc.standAnim;
  2697.             npc.setPos(myPlayer.smallX[0] + i1, myPlayer.smallY[0] + l, j1 == 1);
  2698.         }
  2699.         stream.finishBitAccess();
  2700.     }
  2701.  
  2702.     public void processGameLoop() {
  2703.         if(rsAlreadyLoaded || loadingError || genericLoadingError)
  2704.             return;
  2705.         loopCycle++;
  2706.         if(!loggedIn)
  2707.             processLoginScreenInput();
  2708.         else
  2709.             mainGameProcessor();
  2710.         processOnDemandQueue();
  2711.     }
  2712.  
  2713.     private void method47(boolean flag) {
  2714.         if(myPlayer.x >> 7 == destX && myPlayer.y >> 7 == destY)
  2715.             destX = 0;
  2716.         int j = playerCount;
  2717.         if(flag)
  2718.             j = 1;
  2719.         for(int l = 0; l < j; l++) {
  2720.             Player player;
  2721.             int i1;
  2722.             if(flag) {
  2723.                 player = myPlayer;
  2724.                 i1 = myPlayerIndex << 14;
  2725.             } else {
  2726.                 player = playerArray[playerIndices[l]];
  2727.                 i1 = playerIndices[l] << 14;
  2728.             }
  2729.             if(player == null || !player.isVisible())
  2730.                 continue;
  2731.             player.aBoolean1699 = (lowMem && playerCount > 50 || playerCount > 200) && !flag && player.anInt1517 == player.anInt1511;
  2732.             int j1 = player.x >> 7;
  2733.             int k1 = player.y >> 7;
  2734.             if(j1 < 0 || j1 >= 104 || k1 < 0 || k1 >= 104)
  2735.                 continue;
  2736.             if(player.aModel_1714 != null && loopCycle >= player.anInt1707 && loopCycle < player.anInt1708) {
  2737.                 player.aBoolean1699 = false;
  2738.                 player.anInt1709 = method42(plane, player.y, player.x);
  2739.                 worldController.method286(plane, player.y, player, player.anInt1552, player.anInt1722, player.x, player.anInt1709, player.anInt1719, player.anInt1721, i1, player.anInt1720);
  2740.                 continue;
  2741.             }
  2742.             if((player.x & 0x7f) == 64 && (player.y & 0x7f) == 64) {
  2743.                 if(anIntArrayArray929[j1][k1] == anInt1265)
  2744.                     continue;
  2745.                 anIntArrayArray929[j1][k1] = anInt1265;
  2746.             }
  2747.             player.anInt1709 = method42(plane, player.y, player.x);
  2748.             worldController.method285(plane, player.anInt1552, player.anInt1709, i1, player.y, 60, player.x, player, player.aBoolean1541);
  2749.         }
  2750.     }
  2751.  
  2752.     private boolean promptUserForInput(RSInterface class9) {
  2753.         int j = class9.contentType;
  2754.         if(anInt900 == 2) {
  2755.             if(j == 201) {
  2756.                 inputTaken = true;
  2757.                 inputDialogState = 0;
  2758.                 messagePromptRaised = true;
  2759.                 promptInput = "";
  2760.                 friendsListAction = 1;
  2761.                 aString1121 = "Enter name of friend to add to list";
  2762.             }
  2763.             if(j == 202) {
  2764.                 inputTaken = true;
  2765.                 inputDialogState = 0;
  2766.                 messagePromptRaised = true;
  2767.                 promptInput = "";
  2768.                 friendsListAction = 2;
  2769.                 aString1121 = "Enter name of friend to delete from list";
  2770.             }
  2771.         }
  2772.         if(j == 205) {
  2773.             anInt1011 = 250;
  2774.             return true;
  2775.         }
  2776.         if(j == 501) {
  2777.             inputTaken = true;
  2778.             inputDialogState = 0;
  2779.             messagePromptRaised = true;
  2780.             promptInput = "";
  2781.             friendsListAction = 4;
  2782.             aString1121 = "Enter name of player to add to list";
  2783.         }
  2784.         if(j == 502) {
  2785.             inputTaken = true;
  2786.             inputDialogState = 0;
  2787.             messagePromptRaised = true;
  2788.             promptInput = "";
  2789.             friendsListAction = 5;
  2790.             aString1121 = "Enter name of player to delete from list";
  2791.         }
  2792.         if(j == 550) {
  2793.             inputTaken = true;
  2794.             inputDialogState = 0;
  2795.             messagePromptRaised = true;
  2796.             promptInput = "";
  2797.             friendsListAction = 6;
  2798.             aString1121 = "Enter the name of the chat you wish to join";
  2799.         }
  2800.         if(j >= 300 && j <= 313) {
  2801.             int k = (j - 300) / 2;
  2802.             int j1 = j & 1;
  2803.             int i2 = anIntArray1065[k];
  2804.             if(i2 != -1) {
  2805.                 do {
  2806.                     if(j1 == 0 && --i2 < 0)
  2807.                         i2 = IDK.length - 1;
  2808.                     if(j1 == 1 && ++i2 >= IDK.length)
  2809.                         i2 = 0;
  2810.                 } while(IDK.cache[i2].aBoolean662 || IDK.cache[i2].anInt657 != k + (aBoolean1047 ? 0 : 7));
  2811.                 anIntArray1065[k] = i2;
  2812.                 aBoolean1031 = true;
  2813.             }
  2814.         }
  2815.         if(j >= 314 && j <= 323) {
  2816.             int l = (j - 314) / 2;
  2817.             int k1 = j & 1;
  2818.             int j2 = anIntArray990[l];
  2819.             if(k1 == 0 && --j2 < 0)
  2820.                 j2 = anIntArrayArray1003[l].length - 1;
  2821.             if(k1 == 1 && ++j2 >= anIntArrayArray1003[l].length)
  2822.                 j2 = 0;
  2823.             anIntArray990[l] = j2;
  2824.             aBoolean1031 = true;
  2825.         }
  2826.         if(j == 324 && !aBoolean1047) {
  2827.             aBoolean1047 = true;
  2828.             method45();
  2829.         }
  2830.         if(j == 325 && aBoolean1047) {
  2831.             aBoolean1047 = false;
  2832.             method45();
  2833.         }
  2834.         if(j == 326) {
  2835.             stream.createFrame(101);
  2836.             stream.writeWordBigEndian(aBoolean1047 ? 0 : 1);
  2837.             for(int i1 = 0; i1 < 7; i1++)
  2838.                 stream.writeWordBigEndian(anIntArray1065[i1]);
  2839.  
  2840.             for(int l1 = 0; l1 < 5; l1++)
  2841.                 stream.writeWordBigEndian(anIntArray990[l1]);
  2842.  
  2843.             return true;
  2844.         }
  2845.         System.out.println(""+j);
  2846.         if(j == 612)
  2847.             canMute = !canMute;
  2848.         if(j == 613)
  2849.             canBan = !canBan;
  2850.         if(j >= 602 && j <= 616) {
  2851.             clearTopInterfaces();
  2852.             if(reportAbuseInput.length() > 0 && myPrivilege > 0) {
  2853.            
  2854.             String[] commands = {"mute","unmute","jail","unjail","ban","unban","","ipmute","unipmute","ipban","unipban"};
  2855.                 String inputString = "::"+(commands[j-602])+" "+reportAbuseInput;
  2856.                 stream.createFrame(103);
  2857.                 stream.writeWordBigEndian(inputString.length() - 1);
  2858.                 stream.writeString(inputString.substring(2));
  2859.             }
  2860.        
  2861.         }
  2862.         return false;
  2863.     }
  2864.     private void method49(Stream stream) {
  2865.         for(int j = 0; j < anInt893; j++) {
  2866.             int k = anIntArray894[j];
  2867.             Player player = playerArray[k];
  2868.             int l = stream.readUnsignedByte();
  2869.             if((l & 0x40) != 0)
  2870.                 l += stream.readUnsignedByte() << 8;
  2871.             method107(l, k, stream, player);
  2872.         }
  2873.     }  
  2874.    
  2875.     private void method50(int i, int k, int l, int i1, int j1) {
  2876.         int k1 = worldController.method300(j1, l, i);
  2877.         if(k1 != 0) {
  2878.             int l1 = worldController.method304(j1, l, i, k1);
  2879.             int k2 = l1 >> 6 & 3;
  2880.             int i3 = l1 & 0x1f;
  2881.             int k3 = k;
  2882.             if(k1 > 0)
  2883.                 k3 = i1;
  2884.             int ai[] = miniMapImage.myPixels;
  2885.             int k4 = 24624 + l * 4 + (103 - i) * 512 * 4;
  2886.             int i5 = k1 >> 14 & 0x7fff;
  2887.             ObjectDef class46_2 = ObjectDef.forID(i5);
  2888.             if(class46_2.anInt758 != -1) {
  2889.                 Background background_2 = mapScenes[class46_2.anInt758];
  2890.                 if(background_2 != null) {
  2891.                     int i6 = (class46_2.anInt744 * 4 - background_2.anInt1452) / 2;
  2892.                     int j6 = (class46_2.anInt761 * 4 - background_2.anInt1453) / 2;
  2893.                     background_2.drawBackground(48 + l * 4 + i6, 48 + (104 - i - class46_2.anInt761) * 4 + j6);
  2894.                 }
  2895.             } else {
  2896.                 if(i3 == 0 || i3 == 2)
  2897.                     if(k2 == 0) {
  2898.                         ai[k4] = k3;
  2899.                         ai[k4 + 512] = k3;
  2900.                         ai[k4 + 1024] = k3;
  2901.                         ai[k4 + 1536] = k3;
  2902.                     } else if(k2 == 1) {
  2903.                         ai[k4] = k3;
  2904.                         ai[k4 + 1] = k3;
  2905.                         ai[k4 + 2] = k3;
  2906.                         ai[k4 + 3] = k3;
  2907.                     } else if(k2 == 2) {
  2908.                         ai[k4 + 3] = k3;
  2909.                         ai[k4 + 3 + 512] = k3;
  2910.                         ai[k4 + 3 + 1024] = k3;
  2911.                         ai[k4 + 3 + 1536] = k3;
  2912.                     } else if(k2 == 3) {
  2913.                         ai[k4 + 1536] = k3;
  2914.                         ai[k4 + 1536 + 1] = k3;
  2915.                         ai[k4 + 1536 + 2] = k3;
  2916.                         ai[k4 + 1536 + 3] = k3;
  2917.                     }
  2918.                 if(i3 == 3)
  2919.                     if(k2 == 0)
  2920.                         ai[k4] = k3;
  2921.                     else if(k2 == 1)
  2922.                         ai[k4 + 3] = k3;
  2923.                     else if(k2 == 2)
  2924.                         ai[k4 + 3 + 1536] = k3;
  2925.                     else if(k2 == 3)
  2926.                         ai[k4 + 1536] = k3;
  2927.                 if(i3 == 2)
  2928.                     if(k2 == 3) {
  2929.                         ai[k4] = k3;
  2930.                         ai[k4 + 512] = k3;
  2931.                         ai[k4 + 1024] = k3;
  2932.                         ai[k4 + 1536] = k3;
  2933.                     } else if(k2 == 0) {
  2934.                         ai[k4] = k3;
  2935.                         ai[k4 + 1] = k3;
  2936.                         ai[k4 + 2] = k3;
  2937.                         ai[k4 + 3] = k3;
  2938.                     } else if(k2 == 1) {
  2939.                         ai[k4 + 3] = k3;
  2940.                         ai[k4 + 3 + 512] = k3;
  2941.                         ai[k4 + 3 + 1024] = k3;
  2942.                         ai[k4 + 3 + 1536] = k3;
  2943.                     } else if(k2 == 2) {
  2944.                         ai[k4 + 1536] = k3;
  2945.                         ai[k4 + 1536 + 1] = k3;
  2946.                         ai[k4 + 1536 + 2] = k3;
  2947.                         ai[k4 + 1536 + 3] = k3;
  2948.                     }
  2949.             }
  2950.         }
  2951.         k1 = worldController.method302(j1, l, i);
  2952.         if(k1 != 0) {
  2953.             int i2 = worldController.method304(j1, l, i, k1);
  2954.             int l2 = i2 >> 6 & 3;
  2955.             int j3 = i2 & 0x1f;
  2956.             int l3 = k1 >> 14 & 0x7fff;
  2957.             ObjectDef class46_1 = ObjectDef.forID(l3);
  2958.             if(class46_1.anInt758 != -1) {
  2959.                 Background background_1 = mapScenes[class46_1.anInt758];
  2960.                 if(background_1 != null) {
  2961.                     int j5 = (class46_1.anInt744 * 4 - background_1.anInt1452) / 2;
  2962.                     int k5 = (class46_1.anInt761 * 4 - background_1.anInt1453) / 2;
  2963.                     background_1.drawBackground(48 + l * 4 + j5, 48 + (104 - i - class46_1.anInt761) * 4 + k5);
  2964.                 }
  2965.             } else if(j3 == 9) {
  2966.                 int l4 = 0xeeeeee;
  2967.                 if(k1 > 0)
  2968.                     l4 = 0xee0000;
  2969.                 int ai1[] = miniMapImage.myPixels;
  2970.                 int l5 = 24624 + l * 4 + (103 - i) * 512 * 4;
  2971.                 if(l2 == 0 || l2 == 2) {
  2972.                     ai1[l5 + 1536] = l4;
  2973.                     ai1[l5 + 1024 + 1] = l4;
  2974.                     ai1[l5 + 512 + 2] = l4;
  2975.                     ai1[l5 + 3] = l4;
  2976.                 } else {
  2977.                     ai1[l5] = l4;
  2978.                     ai1[l5 + 512 + 1] = l4;
  2979.                     ai1[l5 + 1024 + 2] = l4;
  2980.                     ai1[l5 + 1536 + 3] = l4;
  2981.                 }
  2982.             }
  2983.         }
  2984.         k1 = worldController.method303(j1, l, i);
  2985.         if(k1 != 0) {
  2986.             int j2 = k1 >> 14 & 0x7fff;
  2987.             ObjectDef class46 = ObjectDef.forID(j2);
  2988.             if(class46.anInt758 != -1) {
  2989.                 Background background = mapScenes[class46.anInt758];
  2990.                 if(background != null) {
  2991.                     int i4 = (class46.anInt744 * 4 - background.anInt1452) / 2;
  2992.                     int j4 = (class46.anInt761 * 4 - background.anInt1453) / 2;
  2993.                     background.drawBackground(48 + l * 4 + i4, 48 + (104 - i - class46.anInt761) * 4 + j4);
  2994.                 }
  2995.             }
  2996.         }
  2997.     }
  2998.  
  2999.     private void loadTitleScreen() {
  3000.    
  3001.         aBackground_967 = new Background(titleStreamLoader, "titlebutton", 0);
  3002.         aBackgroundArray1152s = new Background[12];
  3003.         int j = 0;
  3004.         try {
  3005.             j = Integer.parseInt(getParameter("fl_icon"));
  3006.         } catch(Exception _ex) {
  3007.         }
  3008.         if(j == 0) {
  3009.             for(int k = 0; k < 12; k++)
  3010.                 aBackgroundArray1152s[k] = new Background(titleStreamLoader, "runes", k);
  3011.  
  3012.         } else {
  3013.             for(int l = 0; l < 12; l++)
  3014.                 aBackgroundArray1152s[l] = new Background(titleStreamLoader, "runes", 12 + (l & 3));
  3015.  
  3016.         }
  3017.         aClass30_Sub2_Sub1_Sub1_1201 = new Sprite(128, 265);
  3018.         aClass30_Sub2_Sub1_Sub1_1202 = new Sprite(128, 265);
  3019.         System.arraycopy(aRSImageProducer_1110.anIntArray315, 0, aClass30_Sub2_Sub1_Sub1_1201.myPixels, 0, 33920);
  3020.  
  3021.         System.arraycopy(aRSImageProducer_1111.anIntArray315, 0, aClass30_Sub2_Sub1_Sub1_1202.myPixels, 0, 33920);
  3022.  
  3023.         anIntArray851 = new int[256];
  3024.         for(int k1 = 0; k1 < 64; k1++)
  3025.             anIntArray851[k1] = k1 * 0x40000;
  3026.  
  3027.         for(int l1 = 0; l1 < 64; l1++)
  3028.             anIntArray851[l1 + 64] = 0xff0000 + 1024 * l1;
  3029.  
  3030.         for(int i2 = 0; i2 < 64; i2++)
  3031.             anIntArray851[i2 + 128] = 0xffff00 + 4 * i2;
  3032.  
  3033.         for(int j2 = 0; j2 < 64; j2++)
  3034.             anIntArray851[j2 + 192] = 0xffffff;
  3035.  
  3036.         anIntArray852 = new int[256];
  3037.         for(int k2 = 0; k2 < 64; k2++)
  3038.             anIntArray852[k2] = k2 * 1024;
  3039.  
  3040.         for(int l2 = 0; l2 < 64; l2++)
  3041.             anIntArray852[l2 + 64] = 65280 + 4 * l2;
  3042.  
  3043.         for(int i3 = 0; i3 < 64; i3++)
  3044.             anIntArray852[i3 + 128] = 65535 + 0x40000 * i3;
  3045.  
  3046.         for(int j3 = 0; j3 < 64; j3++)
  3047.             anIntArray852[j3 + 192] = 0xffffff;
  3048.  
  3049.         anIntArray853 = new int[256];
  3050.         for(int k3 = 0; k3 < 64; k3++)
  3051.             anIntArray853[k3] = k3 * 4;
  3052.  
  3053.         for(int l3 = 0; l3 < 64; l3++)
  3054.             anIntArray853[l3 + 64] = 255 + 0x40000 * l3;
  3055.  
  3056.         for(int i4 = 0; i4 < 64; i4++)
  3057.             anIntArray853[i4 + 128] = 0xff00ff + 1024 * i4;
  3058.  
  3059.         for(int j4 = 0; j4 < 64; j4++)
  3060.             anIntArray853[j4 + 192] = 0xffffff;
  3061.  
  3062.         anIntArray850 = new int[256];
  3063.         anIntArray1190 = new int[32768];
  3064.         anIntArray1191 = new int[32768];
  3065.         randomizeBackground(null);
  3066.         anIntArray828 = new int[32768];
  3067.         anIntArray829 = new int[32768];
  3068.         drawLoadingText(10, "");
  3069.         if(!aBoolean831) {
  3070.             //drawFlames = true;
  3071.             //aBoolean831 = true;
  3072.             //startRunnable(this, 2);
  3073.         }
  3074.     }
  3075.  
  3076.     private static void setHighMem() {
  3077.         WorldController.lowMem = false;
  3078.         Texture.lowMem = false;
  3079.         lowMem = false;
  3080.         ObjectManager.lowMem = false;
  3081.         ObjectDef.lowMem = false;
  3082.     }
  3083.    
  3084.     private void loadingStages() {
  3085.         if(lowMem && loadingStage == 2 && ObjectManager.anInt131 != plane) {
  3086.             main3DArea.initDrawingArea();
  3087.             normalFont.drawText(0, "Loading - please wait.", 151, 257);
  3088.             normalFont.drawText(0xffffff, "Loading - please wait.", 150, 256);
  3089.             main3DArea.drawGraphics(toggleFullscreen ? 0 : 4, super.graphics, toggleFullscreen ? 0 : 4);
  3090.             loadingStage = 1;
  3091.             aLong824 = System.currentTimeMillis();
  3092.         }
  3093.         if(loadingStage == 1) {
  3094.             int j = method54();
  3095.             if(j != 0 && System.currentTimeMillis() - aLong824 > 0x57e40L) {
  3096.                 signlink.reporterror(myUsername + " glcfb " + aLong1215 + "," + j + "," + lowMem + "," + decompressors[0] + "," + onDemandFetcher.getNodeCount() + "," + plane + "," + anInt1069 + "," + anInt1070);
  3097.                 aLong824 = System.currentTimeMillis();
  3098.             }
  3099.         }
  3100.         if(loadingStage == 2 && plane != anInt985) {
  3101.             anInt985 = plane;
  3102.             method24(plane);
  3103.         }
  3104.     }
  3105.  
  3106.     private int method54() {
  3107.         for(int i = 0; i < aByteArrayArray1183.length; i++) {
  3108.             if(aByteArrayArray1183[i] == null && anIntArray1235[i] != -1)
  3109.                 return -1;
  3110.             if(aByteArrayArray1247[i] == null && anIntArray1236[i] != -1)
  3111.                 return -2;
  3112.         }
  3113.         boolean flag = true;
  3114.         for(int j = 0; j < aByteArrayArray1183.length; j++) {
  3115.             byte abyte0[] = aByteArrayArray1247[j];
  3116.             if(abyte0 != null) {
  3117.                 int k = (anIntArray1234[j] >> 8) * 64 - baseX;
  3118.                 int l = (anIntArray1234[j] & 0xff) * 64 - baseY;
  3119.                 if(aBoolean1159) {
  3120.                     k = 10;
  3121.                     l = 10;
  3122.                 }
  3123.                 flag &= ObjectManager.method189(k, abyte0, l);
  3124.             }
  3125.         }
  3126.         if(!flag)
  3127.             return -3;
  3128.         if(aBoolean1080) {
  3129.             return -4;
  3130.         } else {
  3131.             loadingStage = 2;
  3132.             ObjectManager.anInt131 = plane;
  3133.             method22();
  3134.             stream.createFrame(121);
  3135.             return 0;
  3136.         }
  3137.     }
  3138.  
  3139.     private void method55()
  3140.     {
  3141.         for(Animable_Sub4 class30_sub2_sub4_sub4 = (Animable_Sub4)aClass19_1013.reverseGetFirst(); class30_sub2_sub4_sub4 != null; class30_sub2_sub4_sub4 = (Animable_Sub4)aClass19_1013.reverseGetNext())
  3142.             if(class30_sub2_sub4_sub4.anInt1597 != plane || loopCycle > class30_sub2_sub4_sub4.anInt1572)
  3143.                 class30_sub2_sub4_sub4.unlink();
  3144.             else
  3145.             if(loopCycle >= class30_sub2_sub4_sub4.anInt1571)
  3146.             {
  3147.                 if(class30_sub2_sub4_sub4.anInt1590 > 0)
  3148.                 {
  3149.                     NPC npc = npcArray[class30_sub2_sub4_sub4.anInt1590 - 1];
  3150.                     if(npc != null && npc.x >= 0 && npc.x < 13312 && npc.y >= 0 && npc.y < 13312)
  3151.                         class30_sub2_sub4_sub4.method455(loopCycle, npc.y, method42(class30_sub2_sub4_sub4.anInt1597, npc.y, npc.x) - class30_sub2_sub4_sub4.anInt1583, npc.x);
  3152.                 }
  3153.                 if(class30_sub2_sub4_sub4.anInt1590 < 0)
  3154.                 {
  3155.                     int j = -class30_sub2_sub4_sub4.anInt1590 - 1;
  3156.                     Player player;
  3157.                     if(j == unknownInt10)
  3158.                         player = myPlayer;
  3159.                     else
  3160.                         player = playerArray[j];
  3161.                     if(player != null && player.x >= 0 && player.x < 13312 && player.y >= 0 && player.y < 13312)
  3162.                         class30_sub2_sub4_sub4.method455(loopCycle, player.y, method42(class30_sub2_sub4_sub4.anInt1597, player.y, player.x) - class30_sub2_sub4_sub4.anInt1583, player.x);
  3163.                 }
  3164.                 class30_sub2_sub4_sub4.method456(anInt945);
  3165.                 worldController.method285(plane, class30_sub2_sub4_sub4.anInt1595, (int)class30_sub2_sub4_sub4.aDouble1587, -1, (int)class30_sub2_sub4_sub4.aDouble1586, 60, (int)class30_sub2_sub4_sub4.aDouble1585, class30_sub2_sub4_sub4, false);
  3166.             }
  3167.  
  3168.     }
  3169.  
  3170.     public AppletContext getAppletContext()
  3171.     {
  3172.         if(signlink.mainapp != null)
  3173.             return signlink.mainapp.getAppletContext();
  3174.         else
  3175.             return super.getAppletContext();
  3176.     }
  3177.  
  3178.     private void drawLogo() {
  3179.         Sprite sprite = new Sprite("background");
  3180.         aRSImageProducer_1110.initDrawingArea();
  3181.         sprite.method346(0, 0);
  3182.         aRSImageProducer_1111.initDrawingArea();
  3183.         sprite.method346(-637, 0);
  3184.         aRSImageProducer_1107.initDrawingArea();
  3185.         sprite.method346(-128, 0);
  3186.         aRSImageProducer_1108.initDrawingArea();
  3187.         sprite.method346(-202, -371);
  3188.         aRSImageProducer_1109.initDrawingArea();
  3189.         sprite.method346(-202, -171);
  3190.         aRSImageProducer_1112.initDrawingArea();
  3191.         sprite.method346(0, -265);
  3192.         aRSImageProducer_1113.initDrawingArea();
  3193.         sprite.method346(-562, -265);
  3194.         aRSImageProducer_1114.initDrawingArea();
  3195.         sprite.method346(-128, -171);
  3196.         aRSImageProducer_1115.initDrawingArea();
  3197.         sprite.method346(-562, -171);
  3198.  
  3199.         aRSImageProducer_1110.initDrawingArea();
  3200.         aRSImageProducer_1111.initDrawingArea();
  3201.         aRSImageProducer_1107.initDrawingArea();
  3202.         aRSImageProducer_1108.initDrawingArea();
  3203.         aRSImageProducer_1109.initDrawingArea();
  3204.         aRSImageProducer_1112.initDrawingArea();
  3205.         aRSImageProducer_1113.initDrawingArea();
  3206.         aRSImageProducer_1114.initDrawingArea();
  3207.         aRSImageProducer_1115.initDrawingArea();
  3208.         /*sprite = new Sprite(titleStreamLoader, "logo", 0);
  3209.         aRSImageProducer_1107.initDrawingArea();
  3210.         sprite.drawSprite(382 - sprite.myWidth / 2 - 128, 18);
  3211.         */
  3212.  
  3213.         sprite = null;
  3214.         Object obj = null;
  3215.         Object obj1 = null;
  3216.         System.gc();
  3217.     }
  3218.     private void processOnDemandQueue()
  3219.     {
  3220.         do
  3221.         {
  3222.             OnDemandData onDemandData;
  3223.             do
  3224.             {
  3225.                 onDemandData = onDemandFetcher.getNextNode();
  3226.                 if(onDemandData == null)
  3227.                     return;
  3228.                 if(onDemandData.dataType == 0)
  3229.                 {
  3230.                     Model.method460(onDemandData.buffer, onDemandData.ID);
  3231.                     if((onDemandFetcher.getModelIndex(onDemandData.ID) & 0x62) != 0)
  3232.                     {
  3233.                         needDrawTabArea = true;
  3234.                         if(backDialogID != -1)
  3235.                             inputTaken = true;
  3236.                     }
  3237.                 }
  3238.                 //if(onDemandData.dataType == 1 && onDemandData.buffer != null)
  3239.                     //Class36.method529(onDemandData.buffer);
  3240.                 if(onDemandData.dataType == 2 && onDemandData.ID == nextSong && onDemandData.buffer != null)
  3241.                     SoundProvider.getSingleton().playMIDI(onDemandData.buffer);
  3242.                 if(onDemandData.dataType == 3 && loadingStage == 1)
  3243.                 {
  3244.                 //System.out.println("Mapdata Region: "+onDemandData.ID);
  3245.                     try {
  3246.                         writeFile(onDemandData.buffer, "./maps/" + onDemandData.ID + ".dat");
  3247.                     } catch (Exception e) {}
  3248.                     for(int i = 0; i < aByteArrayArray1183.length; i++)
  3249.                     {
  3250.                         if(anIntArray1235[i] == onDemandData.ID)
  3251.                         {
  3252.                             aByteArrayArray1183[i] = onDemandData.buffer;
  3253.                             if(onDemandData.buffer == null)
  3254.                                 anIntArray1235[i] = -1;
  3255.                             break;
  3256.                         }
  3257.                         if(anIntArray1236[i] != onDemandData.ID)
  3258.                             continue;
  3259.                         aByteArrayArray1247[i] = onDemandData.buffer;
  3260.                         if(onDemandData.buffer == null)
  3261.                             anIntArray1236[i] = -1;
  3262.                         break;
  3263.                     }
  3264.  
  3265.                 }
  3266.             } while(onDemandData.dataType != 93 || !onDemandFetcher.method564(onDemandData.ID));
  3267.             ObjectManager.method173(new Stream(onDemandData.buffer), onDemandFetcher);
  3268.         } while(true);
  3269.     }
  3270.  
  3271.     public static void writeFile(byte[] data, String fileName) throws IOException{
  3272.         OutputStream out = new FileOutputStream(fileName);
  3273.         out.write(data);
  3274.         out.close();
  3275.     }
  3276.    
  3277.     private void calcFlamesPosition()
  3278.     {
  3279.         char c = '\u0100';
  3280.         for(int j = 10; j < 117; j++)
  3281.         {
  3282.             int k = (int)(Math.random() * 100D);
  3283.             if(k < 50)
  3284.                 anIntArray828[j + (c - 2 << 7)] = 255;
  3285.         }
  3286.         for(int l = 0; l < 100; l++)
  3287.         {
  3288.             int i1 = (int)(Math.random() * 124D) + 2;
  3289.             int k1 = (int)(Math.random() * 128D) + 128;
  3290.             int k2 = i1 + (k1 << 7);
  3291.             anIntArray828[k2] = 192;
  3292.         }
  3293.  
  3294.         for(int j1 = 1; j1 < c - 1; j1++)
  3295.         {
  3296.             for(int l1 = 1; l1 < 127; l1++)
  3297.             {
  3298.                 int l2 = l1 + (j1 << 7);
  3299.                 anIntArray829[l2] = (anIntArray828[l2 - 1] + anIntArray828[l2 + 1] + anIntArray828[l2 - 128] + anIntArray828[l2 + 128]) / 4;
  3300.             }
  3301.  
  3302.         }
  3303.  
  3304.         anInt1275 += 128;
  3305.         if(anInt1275 > anIntArray1190.length)
  3306.         {
  3307.             anInt1275 -= anIntArray1190.length;
  3308.             int i2 = (int)(Math.random() * 12D);
  3309.             randomizeBackground(aBackgroundArray1152s[i2]);
  3310.         }
  3311.         for(int j2 = 1; j2 < c - 1; j2++)
  3312.         {
  3313.             for(int i3 = 1; i3 < 127; i3++)
  3314.             {
  3315.                 int k3 = i3 + (j2 << 7);
  3316.                 int i4 = anIntArray829[k3 + 128] - anIntArray1190[k3 + anInt1275 & anIntArray1190.length - 1] / 5;
  3317.                 if(i4 < 0)
  3318.                     i4 = 0;
  3319.                 anIntArray828[k3] = i4;
  3320.             }
  3321.  
  3322.         }
  3323.  
  3324.         System.arraycopy(anIntArray969, 1, anIntArray969, 0, c - 1);
  3325.  
  3326.         anIntArray969[c - 1] = (int)(Math.sin((double)loopCycle / 14D) * 16D + Math.sin((double)loopCycle / 15D) * 14D + Math.sin((double)loopCycle / 16D) * 12D);
  3327.         if(anInt1040 > 0)
  3328.             anInt1040 -= 4;
  3329.         if(anInt1041 > 0)
  3330.             anInt1041 -= 4;
  3331.         if(anInt1040 == 0 && anInt1041 == 0)
  3332.         {
  3333.             int l3 = (int)(Math.random() * 2000D);
  3334.             if(l3 == 0)
  3335.                 anInt1040 = 1024;
  3336.             if(l3 == 1)
  3337.                 anInt1041 = 1024;
  3338.         }
  3339.     }
  3340.  
  3341.     private void method60(int i)
  3342.     {
  3343.         RSInterface class9 = RSInterface.interfaceCache[i];
  3344.         for(int j = 0; j < class9.children.length; j++)
  3345.         {
  3346.             if(class9.children[j] == -1)
  3347.                 break;
  3348.             RSInterface class9_1 = RSInterface.interfaceCache[class9.children[j]];
  3349.             if(class9_1.type == 1)
  3350.                 method60(class9_1.id);
  3351.             class9_1.anInt246 = 0;
  3352.             class9_1.anInt208 = 0;
  3353.         }
  3354.     }
  3355.  
  3356.     private void drawHeadIcon()
  3357.     {
  3358.         if(hintType != 2)
  3359.             return;
  3360.         calcEntityScreenPos((hintArrowX - baseX << 7) + anInt937, anInt936 * 2, (hintArrowY - baseY << 7) + anInt938);
  3361.         if(spriteDrawX > -1 && loopCycle % 20 < 10)
  3362.             headIconsHint[0].drawSprite(spriteDrawX - 12, spriteDrawY - 28);
  3363.     }
  3364.  
  3365.     private void mainGameProcessor()
  3366.     {
  3367.         if(systemUpdatetime > 1)
  3368.             systemUpdatetime--;
  3369.         if(anInt1011 > 0)
  3370.             anInt1011--;
  3371.         for(int j = 0; j < 5; j++)
  3372.             if(!parsePacket())
  3373.                 break;
  3374.  
  3375.         if(!loggedIn)
  3376.             return;
  3377.         synchronized(mouseDetection.syncObject)
  3378.         {
  3379.             if(flagged)
  3380.             {
  3381.                 if(super.clickMode3 != 0 || mouseDetection.coordsIndex >= 40)
  3382.                 {
  3383.                     stream.createFrame(45);
  3384.                     stream.writeWordBigEndian(0);
  3385.                     int j2 = stream.currentOffset;
  3386.                     int j3 = 0;
  3387.                     for(int j4 = 0; j4 < mouseDetection.coordsIndex; j4++)
  3388.                     {
  3389.                         if(j2 - stream.currentOffset >= 240)
  3390.                             break;
  3391.                         j3++;
  3392.                         int l4 = mouseDetection.coordsY[j4];
  3393.                         if(l4 < 0)
  3394.                             l4 = 0;
  3395.                         else
  3396.                         if(l4 > 502)
  3397.                             l4 = 502;
  3398.                         int k5 = mouseDetection.coordsX[j4];
  3399.                         if(k5 < 0)
  3400.                             k5 = 0;
  3401.                         else
  3402.                         if(k5 > 764)
  3403.                             k5 = 764;
  3404.                         int i6 = l4 * 765 + k5;
  3405.                         if(mouseDetection.coordsY[j4] == -1 && mouseDetection.coordsX[j4] == -1)
  3406.                         {
  3407.                             k5 = -1;
  3408.                             l4 = -1;
  3409.                             i6 = 0x7ffff;
  3410.                         }
  3411.                         if(k5 == anInt1237 && l4 == anInt1238)
  3412.                         {
  3413.                             if(anInt1022 < 2047)
  3414.                                 anInt1022++;
  3415.                         } else
  3416.                         {
  3417.                             int j6 = k5 - anInt1237;
  3418.                             anInt1237 = k5;
  3419.                             int k6 = l4 - anInt1238;
  3420.                             anInt1238 = l4;
  3421.                             if(anInt1022 < 8 && j6 >= -32 && j6 <= 31 && k6 >= -32 && k6 <= 31)
  3422.                             {
  3423.                                 j6 += 32;
  3424.                                 k6 += 32;
  3425.                                 stream.writeWord((anInt1022 << 12) + (j6 << 6) + k6);
  3426.                                 anInt1022 = 0;
  3427.                             } else
  3428.                             if(anInt1022 < 8)
  3429.                             {
  3430.                                 stream.writeDWordBigEndian(0x800000 + (anInt1022 << 19) + i6);
  3431.                                 anInt1022 = 0;
  3432.                             } else
  3433.                             {
  3434.                                 stream.writeDWord(0xc0000000 + (anInt1022 << 19) + i6);
  3435.                                 anInt1022 = 0;
  3436.                             }
  3437.                         }
  3438.                     }
  3439.  
  3440.                     stream.writeBytes(stream.currentOffset - j2);
  3441.                     if(j3 >= mouseDetection.coordsIndex)
  3442.                     {
  3443.                         mouseDetection.coordsIndex = 0;
  3444.                     } else
  3445.                     {
  3446.                         mouseDetection.coordsIndex -= j3;
  3447.                         for(int i5 = 0; i5 < mouseDetection.coordsIndex; i5++)
  3448.                         {
  3449.                             mouseDetection.coordsX[i5] = mouseDetection.coordsX[i5 + j3];
  3450.                             mouseDetection.coordsY[i5] = mouseDetection.coordsY[i5 + j3];
  3451.                         }
  3452.  
  3453.                     }
  3454.                 }
  3455.             } else
  3456.             {
  3457.                 mouseDetection.coordsIndex = 0;
  3458.             }
  3459.         }
  3460.         if(super.clickMode3 != 0)
  3461.         {
  3462.             long l = (super.aLong29 - aLong1220) / 50L;
  3463.             if(l > 4095L)
  3464.                 l = 4095L;
  3465.             aLong1220 = super.aLong29;
  3466.             int k2 = super.saveClickY;
  3467.             if(k2 < 0)
  3468.                 k2 = 0;
  3469.             else
  3470.             if(k2 > 502)
  3471.                 k2 = 502;
  3472.             int k3 = super.saveClickX;
  3473.             if(k3 < 0)
  3474.                 k3 = 0;
  3475.             else
  3476.             if(k3 > 764)
  3477.                 k3 = 764;
  3478.             int k4 = k2 * 765 + k3;
  3479.             int j5 = 0;
  3480.             if(super.clickMode3 == 2)
  3481.                 j5 = 1;
  3482.             int l5 = (int)l;
  3483.             stream.createFrame(241);
  3484.             stream.writeDWord((l5 << 20) + (j5 << 19) + k4);
  3485.         }
  3486.         if(anInt1016 > 0)
  3487.             anInt1016--;
  3488.         if(super.keyArray[1] == 1 || super.keyArray[2] == 1 || super.keyArray[3] == 1 || super.keyArray[4] == 1)
  3489.             aBoolean1017 = true;
  3490.         if(aBoolean1017 && anInt1016 <= 0)
  3491.         {
  3492.             anInt1016 = 20;
  3493.             aBoolean1017 = false;
  3494.             stream.createFrame(86);
  3495.             stream.writeWord(anInt1184);
  3496.             stream.method432(compassRotation);
  3497.         }
  3498.         if(super.awtFocus && !aBoolean954)
  3499.         {
  3500.             aBoolean954 = true;
  3501.             stream.createFrame(3);
  3502.             stream.writeWordBigEndian(1);
  3503.         }
  3504.         if(!super.awtFocus && aBoolean954)
  3505.         {
  3506.             aBoolean954 = false;
  3507.             stream.createFrame(3);
  3508.             stream.writeWordBigEndian(0);
  3509.         }
  3510.         loadingStages();
  3511.         method115();
  3512.         method90();
  3513.         anInt1009++;
  3514.         if(anInt1009 > 750)
  3515.             dropClient();
  3516.         method114();
  3517.         method95();
  3518.         method38();
  3519.         anInt945++;
  3520.         if(crossType != 0)
  3521.         {
  3522.             crossIndex += 20;
  3523.             if(crossIndex >= 400)
  3524.                 crossType = 0;
  3525.         }
  3526.         if(atInventoryInterfaceType != 0)
  3527.         {
  3528.             atInventoryLoopCycle++;
  3529.             if(atInventoryLoopCycle >= 15)
  3530.             {
  3531.                 if(atInventoryInterfaceType == 2)
  3532.                     needDrawTabArea = true;
  3533.                 if(atInventoryInterfaceType == 3)
  3534.                     inputTaken = true;
  3535.                 atInventoryInterfaceType = 0;
  3536.             }
  3537.         }
  3538.         if(activeInterfaceType != 0)
  3539.         {
  3540.             anInt989++;
  3541.             if(super.mouseX > anInt1087 + 5 || super.mouseX < anInt1087 - 5 || super.mouseY > anInt1088 + 5 || super.mouseY < anInt1088 - 5)
  3542.                 aBoolean1242 = true;
  3543.             if(super.clickMode2 == 0)
  3544.             {
  3545.                 if(activeInterfaceType == 2)
  3546.                     needDrawTabArea = true;
  3547.                 if(activeInterfaceType == 3)
  3548.                     inputTaken = true;
  3549.                 activeInterfaceType = 0;
  3550.                 if(aBoolean1242 && anInt989 >= 5)
  3551.                 {
  3552.                     lastActiveInvInterface = -1;
  3553.                     processRightClick();
  3554.                     if(lastActiveInvInterface == anInt1084 && mouseInvInterfaceIndex != anInt1085)
  3555.                     {
  3556.                         RSInterface class9 = RSInterface.interfaceCache[anInt1084];
  3557.                         int j1 = 0;
  3558.                         if(anInt913 == 1 && class9.contentType == 206)
  3559.                             j1 = 1;
  3560.                         if(class9.inv[mouseInvInterfaceIndex] <= 0)
  3561.                             j1 = 0;
  3562.                         if(class9.aBoolean235)
  3563.                         {
  3564.                             int l2 = anInt1085;
  3565.                             int l3 = mouseInvInterfaceIndex;
  3566.                             class9.inv[l3] = class9.inv[l2];
  3567.                             class9.invStackSizes[l3] = class9.invStackSizes[l2];
  3568.                             class9.inv[l2] = -1;
  3569.                             class9.invStackSizes[l2] = 0;
  3570.                         } else
  3571.                         if(j1 == 1)
  3572.                         {
  3573.                             int i3 = anInt1085;
  3574.                             for(int i4 = mouseInvInterfaceIndex; i3 != i4;)
  3575.                                 if(i3 > i4)
  3576.                                 {
  3577.                                     class9.swapInventoryItems(i3, i3 - 1);
  3578.                                     i3--;
  3579.                                 } else
  3580.                                 if(i3 < i4)
  3581.                                 {
  3582.                                     class9.swapInventoryItems(i3, i3 + 1);
  3583.                                     i3++;
  3584.                                 }
  3585.  
  3586.                         } else
  3587.                         {
  3588.                             class9.swapInventoryItems(anInt1085, mouseInvInterfaceIndex);
  3589.                         }
  3590.                         stream.createFrame(214);
  3591.                         stream.method433(anInt1084);
  3592.                         stream.method424(j1);
  3593.                         stream.method433(anInt1085);
  3594.                         stream.method431(mouseInvInterfaceIndex);
  3595.                     }
  3596.                 } else
  3597.                 if((anInt1253 == 1 || menuHasAddFriend(menuActionRow - 1)) && menuActionRow > 2)
  3598.                     determineMenuSize();
  3599.                 else
  3600.                 if(menuActionRow > 0)
  3601.                     doAction(menuActionRow - 1);
  3602.                 atInventoryLoopCycle = 10;
  3603.                 super.clickMode3 = 0;
  3604.             }
  3605.         }
  3606.         if(WorldController.anInt470 != -1)
  3607.         {
  3608.             int k = WorldController.anInt470;
  3609.             int k1 = WorldController.anInt471;
  3610.             boolean flag = doWalkTo(0, 0, 0, 0, myPlayer.smallY[0], 0, 0, k1, myPlayer.smallX[0], true, k);
  3611.             WorldController.anInt470 = -1;
  3612.             if(flag)
  3613.             {
  3614.                 crossX = super.saveClickX;
  3615.                 crossY = super.saveClickY;
  3616.                 crossType = 1;
  3617.                 crossIndex = 0;
  3618.             }
  3619.         }
  3620.         if(super.clickMode3 == 1 && aString844 != null)
  3621.         {
  3622.             aString844 = null;
  3623.             inputTaken = true;
  3624.             super.clickMode3 = 0;
  3625.         }
  3626.        
  3627.         if(!contextMenuOpen) {
  3628.             processMinimapClick(getMapIncreaseX(),getMapIncreaseY());
  3629.             processChatModeClick(0,getChatBackIncreaseY());
  3630.         }
  3631.         processMenuClick();
  3632.        
  3633.         if(super.clickMode2 == 1 || super.clickMode3 == 1)
  3634.             anInt1213++;
  3635.         if (anInt1500 != 0 || anInt1044 != 0 || lastHoverToggleChildId != 0) {
  3636.             if (anInt1501 < 100) {
  3637.                 anInt1501++;
  3638.                 if (anInt1501 == 100) {
  3639.                     if (anInt1500 != 0) {
  3640.                         inputTaken = true;
  3641.                     }
  3642.                     if (anInt1044 != 0) {
  3643.                         needDrawTabArea = true;
  3644.                     }
  3645.                 }
  3646.             }
  3647.         } else if (anInt1501 > 0) {
  3648.             anInt1501--;
  3649.         }
  3650.         if(loadingStage == 2)
  3651.             method108();
  3652.         if(loadingStage == 2 && aBoolean1160)
  3653.             calcCameraPos();
  3654.         for(int i1 = 0; i1 < 5; i1++)
  3655.             anIntArray1030[i1]++;
  3656.  
  3657.         method73();
  3658.         super.idleTime++;
  3659.         if(super.idleTime > 4500)
  3660.         {
  3661.             anInt1011 = 250;
  3662.             super.idleTime -= 500;
  3663.             stream.createFrame(202);
  3664.         }
  3665.         anInt988++;
  3666.         if(anInt988 > 500)
  3667.         {
  3668.             anInt988 = 0;
  3669.             int l1 = (int)(Math.random() * 8D);
  3670.             if((l1 & 1) == 1)
  3671.                 anInt1278 += anInt1279;
  3672.             if((l1 & 2) == 2)
  3673.                 anInt1131 += anInt1132;
  3674.             if((l1 & 4) == 4)
  3675.                 anInt896 += anInt897;
  3676.         }
  3677.         if(anInt1278 < -50)
  3678.             anInt1279 = 2;
  3679.         if(anInt1278 > 50)
  3680.             anInt1279 = -2;
  3681.         if(anInt1131 < -55)
  3682.             anInt1132 = 2;
  3683.         if(anInt1131 > 55)
  3684.             anInt1132 = -2;
  3685.         if(anInt896 < -40)
  3686.             anInt897 = 1;
  3687.         if(anInt896 > 40)
  3688.             anInt897 = -1;
  3689.         mapTimedProcessCounter++;
  3690.         if(mapTimedProcessCounter > 500)
  3691.         {
  3692.             mapTimedProcessCounter = 0;
  3693.             int i2 = (int)(Math.random() * 8D);
  3694.             if((i2 & 1) == 1)
  3695.                 mapAmtDiffRotation += mapAmtCounterRotation;
  3696.             if((i2 & 2) == 2)
  3697.                 mapAmtDiffZoom += mapAmtCounterZoom;
  3698.         }
  3699.         if(mapAmtDiffRotation < -60)
  3700.             mapAmtCounterRotation = 2;
  3701.         if(mapAmtDiffRotation > 60)
  3702.             mapAmtCounterRotation = -2;
  3703.         if(mapAmtDiffZoom < -20)
  3704.             mapAmtCounterZoom = 1;
  3705.         if(mapAmtDiffZoom > 10)
  3706.             mapAmtCounterZoom = -1;
  3707.         anInt1010++;
  3708.         if(anInt1010 > 50)
  3709.             stream.createFrame(0);
  3710.         try
  3711.         {
  3712.             if(socketStream != null && stream.currentOffset > 0)
  3713.             {
  3714.                 socketStream.queueBytes(stream.currentOffset, stream.buffer);
  3715.                 stream.currentOffset = 0;
  3716.                 anInt1010 = 0;
  3717.             }
  3718.         }
  3719.         catch(IOException _ex)
  3720.         {
  3721.             dropClient();
  3722.         }
  3723.         catch(Exception exception)
  3724.         {
  3725.             resetLogout();
  3726.         }
  3727.     }
  3728.  
  3729.     private void method63()
  3730.     {
  3731.         Class30_Sub1 class30_sub1 = (Class30_Sub1)aClass19_1179.reverseGetFirst();
  3732.         for(; class30_sub1 != null; class30_sub1 = (Class30_Sub1)aClass19_1179.reverseGetNext())
  3733.             if(class30_sub1.anInt1294 == -1)
  3734.             {
  3735.                 class30_sub1.anInt1302 = 0;
  3736.                 method89(class30_sub1);
  3737.             } else
  3738.             {
  3739.                 class30_sub1.unlink();
  3740.             }
  3741.  
  3742.     }
  3743.  
  3744.     private void resetImageProducers()
  3745.     {
  3746.         if(aRSImageProducer_1107 != null)
  3747.             return;
  3748.         super.fullGameScreen = null;
  3749.         rightFrame = null;
  3750.         chatBackImage = null;
  3751.         mapBackImage = null;
  3752.         sideTabArea = null;
  3753.         main3DArea = null;
  3754.         aRSImageProducer_1123 = null;
  3755.         aRSImageProducer_1124 = null;
  3756.         aRSImageProducer_1125 = null;
  3757.         aRSImageProducer_1110 = new RSImageProducer(128, 265, getGameComponent());
  3758.         DrawingArea.setAllPixelsToZero();
  3759.         aRSImageProducer_1111 = new RSImageProducer(128, 265, getGameComponent());
  3760.         DrawingArea.setAllPixelsToZero();
  3761.         aRSImageProducer_1107 = new RSImageProducer(509, 171, getGameComponent());
  3762.         DrawingArea.setAllPixelsToZero();
  3763.         aRSImageProducer_1108 = new RSImageProducer(360, 132, getGameComponent());
  3764.         DrawingArea.setAllPixelsToZero();
  3765.         aRSImageProducer_1109 = new RSImageProducer(360, 233, getGameComponent());
  3766.         DrawingArea.setAllPixelsToZero();
  3767.         aRSImageProducer_1112 = new RSImageProducer(202, 238, getGameComponent());
  3768.         DrawingArea.setAllPixelsToZero();
  3769.         aRSImageProducer_1113 = new RSImageProducer(203, 238, getGameComponent());
  3770.         DrawingArea.setAllPixelsToZero();
  3771.         aRSImageProducer_1114 = new RSImageProducer(74, 94, getGameComponent());
  3772.         DrawingArea.setAllPixelsToZero();
  3773.         aRSImageProducer_1115 = new RSImageProducer(75, 94, getGameComponent());
  3774.         DrawingArea.setAllPixelsToZero();
  3775.         if(titleStreamLoader != null)
  3776.         {
  3777.             drawLogo();
  3778.             loadTitleScreen();
  3779.         }
  3780.         welcomeScreenRaised = true;
  3781.     }
  3782.  
  3783.     void drawLoadingText(int i, String s)
  3784.     {
  3785.         anInt1079 = i;
  3786.         aString1049 = s;
  3787.         resetImageProducers();
  3788.         if(titleStreamLoader == null) {
  3789.             super.drawLoadingText(i, s);
  3790.             return;
  3791.         }
  3792.         aRSImageProducer_1109.initDrawingArea();
  3793.         loadingBarEmpty = new Sprite("Configuration/empty");
  3794.         loadingBarFull = new Sprite("Configuration/full");
  3795.         char c = '\u0168';
  3796.         char c1 = '\310';
  3797.         byte byte1 = 20;
  3798.         int j = c1 / 2 - 18 - byte1;
  3799.         loadingBarEmpty.drawSprite(20, 60);
  3800.         loadingBarFull.drawSprite(86, 84);
  3801.         DrawingArea.drawPixels(13, 84, (86 + i), 0x302e2c, (194 - i));
  3802.         if (i == 194) {
  3803.             smallFont.drawText(0xffffff, s + "Loading (V8 Cache) - Please Wait.. 100%", 76, 180);
  3804.         } else {
  3805.             smallFont.drawText(0xffffff, s + "Loading (V8 Cache) - Please Wait.." + (i/2) + "%", 76, 180);
  3806.         }
  3807.         aRSImageProducer_1109.drawGraphics(171, super.graphics, 202);
  3808.         if(welcomeScreenRaised) {
  3809.             welcomeScreenRaised = false;
  3810.             if(!aBoolean831) {
  3811.                 aRSImageProducer_1110.drawGraphics(0, super.graphics, 0);
  3812.                 aRSImageProducer_1111.drawGraphics(0, super.graphics, 637);
  3813.             }
  3814.             aRSImageProducer_1107.drawGraphics(0, super.graphics, 128);
  3815.             aRSImageProducer_1108.drawGraphics(371, super.graphics, 202);
  3816.             aRSImageProducer_1112.drawGraphics(265, super.graphics, 0);
  3817.             aRSImageProducer_1113.drawGraphics(265, super.graphics, 562);
  3818.             aRSImageProducer_1114.drawGraphics(171, super.graphics, 128);
  3819.             aRSImageProducer_1115.drawGraphics(171, super.graphics, 562);
  3820.         }
  3821.     }
  3822.  
  3823.     private void method65(int i, int j, int k, int l, RSInterface rsinterface, int i1, boolean flag,  int j1) {
  3824.         byte byte0;
  3825.         if(aBoolean972)
  3826.             byte0 = 32;
  3827.         else
  3828.             byte0 = 0;
  3829.         aBoolean972 = false;
  3830.         if(k >= i && k < i + 16 && l >= i1 && l < i1 + 16) {
  3831.             rsinterface.scrollPosition -= anInt1213 * 4;
  3832.             if(flag)
  3833.                 needDrawTabArea = true;
  3834.         } else if(k >= i && k < i + 16 && l >= (i1 + j) - 16 && l < i1 + j) {
  3835.             rsinterface.scrollPosition += anInt1213 * 4;
  3836.             if(flag)
  3837.                 needDrawTabArea = true;
  3838.         } else if(k >= i - byte0 && k < i + 16 + byte0 && l >= i1 + 16 && l < (i1 + j) - 16 && anInt1213 > 0) {
  3839.             int k1 = ((j - 32) * j) / j1;
  3840.             if(k1 < 8)
  3841.                 k1 = 8;
  3842.             int l1 = l - i1 - 16 - k1 / 2;
  3843.             int i2 = j - 32 - k1;
  3844.             rsinterface.scrollPosition = ((j1 - j) * l1) / i2;
  3845.             if(flag)
  3846.                 needDrawTabArea = true;
  3847.             aBoolean972 = true;
  3848.         }
  3849.     }
  3850.  
  3851.     private boolean method66(int i, int j, int k)
  3852.     {
  3853.         int i1 = i >> 14 & 0x7fff;
  3854.         int j1 = worldController.method304(plane, k, j, i);
  3855.         if(j1 == -1)
  3856.             return false;
  3857.         int k1 = j1 & 0x1f;
  3858.         int l1 = j1 >> 6 & 3;
  3859.         if(k1 == 10 || k1 == 11 || k1 == 22)
  3860.         {
  3861.             ObjectDef class46 = ObjectDef.forID(i1);
  3862.             int i2;
  3863.             int j2;
  3864.             if(l1 == 0 || l1 == 2)
  3865.             {
  3866.                 i2 = class46.anInt744;
  3867.                 j2 = class46.anInt761;
  3868.             } else
  3869.             {
  3870.                 i2 = class46.anInt761;
  3871.                 j2 = class46.anInt744;
  3872.             }
  3873.             int k2 = class46.anInt768;
  3874.             if(l1 != 0)
  3875.                 k2 = (k2 << l1 & 0xf) + (k2 >> 4 - l1);
  3876.             doWalkTo(2, 0, j2, 0, myPlayer.smallY[0], i2, k2, j, myPlayer.smallX[0], false, k);
  3877.         } else
  3878.         {
  3879.             doWalkTo(2, l1, 0, k1 + 1, myPlayer.smallY[0], 0, 0, j, myPlayer.smallX[0], false, k);
  3880.         }
  3881.         crossX = super.saveClickX;
  3882.         crossY = super.saveClickY;
  3883.         crossType = 2;
  3884.         crossIndex = 0;
  3885.         return true;
  3886.     }
  3887.  
  3888.     private StreamLoader streamLoaderForName(int i, String s, String s1, int j, int k)
  3889.     {
  3890.         byte abyte0[] = null;
  3891.         int l = 5;
  3892.         try
  3893.         {
  3894.             if(decompressors[0] != null)
  3895.                 abyte0 = decompressors[0].decompress(i);
  3896.         }
  3897.         catch(Exception _ex) { }
  3898.         if(abyte0 != null)
  3899.         {
  3900.     //      aCRC32_930.reset();
  3901.     //      aCRC32_930.update(abyte0);
  3902.     //      int i1 = (int)aCRC32_930.getValue();
  3903.     //      if(i1 != j)
  3904.         }
  3905.         if(abyte0 != null)
  3906.         {
  3907.             StreamLoader streamLoader = new StreamLoader(abyte0);
  3908.             return streamLoader;
  3909.         }
  3910.         int j1 = 0;
  3911.         while(abyte0 == null)
  3912.         {
  3913.             String s2 = "Unknown error";
  3914.             drawLoadingText(k, "Requesting " + s);
  3915.             Object obj = null;
  3916.             try
  3917.             {
  3918.                 int k1 = 0;
  3919.                 DataInputStream datainputstream = openJagGrabInputStream(s1 + j);
  3920.                 byte abyte1[] = new byte[6];
  3921.                 datainputstream.readFully(abyte1, 0, 6);
  3922.                 Stream stream = new Stream(abyte1);
  3923.                 stream.currentOffset = 3;
  3924.                 int i2 = stream.read3Bytes() + 6;
  3925.                 int j2 = 6;
  3926.                 abyte0 = new byte[i2];
  3927.                 System.arraycopy(abyte1, 0, abyte0, 0, 6);
  3928.  
  3929.                 while(j2 < i2)
  3930.                 {
  3931.                     int l2 = i2 - j2;
  3932.                     if(l2 > 1000)
  3933.                         l2 = 1000;
  3934.                     int j3 = datainputstream.read(abyte0, j2, l2);
  3935.                     if(j3 < 0)
  3936.                     {
  3937.                         s2 = "Length error: " + j2 + "/" + i2;
  3938.                         throw new IOException("EOF");
  3939.                     }
  3940.                     j2 += j3;
  3941.                     int k3 = (j2 * 100) / i2;
  3942.                     if(k3 != k1)
  3943.                         drawLoadingText(k, "Loading " + s + " - " + k3 + "%");
  3944.                     k1 = k3;
  3945.                 }
  3946.                 datainputstream.close();
  3947.                 try
  3948.                 {
  3949.                     if(decompressors[0] != null)
  3950.                         decompressors[0].method234(abyte0.length, abyte0, i);
  3951.                 }
  3952.                 catch(Exception _ex)
  3953.                 {
  3954.                     decompressors[0] = null;
  3955.                 }
  3956.    /*            if(abyte0 != null)
  3957.                 {
  3958.                     aCRC32_930.reset();
  3959.                     aCRC32_930.update(abyte0);
  3960.                     int i3 = (int)aCRC32_930.getValue();
  3961.                     if(i3 != j)
  3962.                     {
  3963.                         abyte0 = null;
  3964.                         j1++;
  3965.                         s2 = "Checksum error: " + i3;
  3966.                     }
  3967.                 }
  3968.   */
  3969.             }
  3970.             catch(IOException ioexception)
  3971.             {
  3972.                 if(s2.equals("Unknown error"))
  3973.                     s2 = "Connection error";
  3974.                 abyte0 = null;
  3975.             }
  3976.             catch(NullPointerException _ex)
  3977.             {
  3978.                 s2 = "Null error";
  3979.                 abyte0 = null;
  3980.                 if(!signlink.reporterror)
  3981.                     return null;
  3982.             }
  3983.             catch(ArrayIndexOutOfBoundsException _ex)
  3984.             {
  3985.                 s2 = "Bounds error";
  3986.                 abyte0 = null;
  3987.                 if(!signlink.reporterror)
  3988.                     return null;
  3989.             }
  3990.             catch(Exception _ex)
  3991.             {
  3992.                 s2 = "Unexpected error";
  3993.                 abyte0 = null;
  3994.                 if(!signlink.reporterror)
  3995.                     return null;
  3996.             }
  3997.             if(abyte0 == null)
  3998.             {
  3999.                 for(int l1 = l; l1 > 0; l1--)
  4000.                 {
  4001.                     if(j1 >= 3)
  4002.                     {
  4003.                         drawLoadingText(k, "Game updated - please reload page");
  4004.                         l1 = 10;
  4005.                     } else
  4006.                     {
  4007.                         drawLoadingText(k, s2 + " - Retrying in " + l1);
  4008.                     }
  4009.                     try
  4010.                     {
  4011.                         Thread.sleep(1000L);
  4012.                     }
  4013.                     catch(Exception _ex) { }
  4014.                 }
  4015.  
  4016.                 l *= 2;
  4017.                 if(l > 60)
  4018.                     l = 60;
  4019.                 aBoolean872 = !aBoolean872;
  4020.             }
  4021.  
  4022.         }
  4023.  
  4024.         StreamLoader streamLoader_1 = new StreamLoader(abyte0);
  4025.             return streamLoader_1;
  4026.     }
  4027.  
  4028.     private void dropClient()
  4029.     {
  4030.         if(anInt1011 > 0)
  4031.         {
  4032.             resetLogout();
  4033.             return;
  4034.         }
  4035.         try {
  4036.             main3DArea.initDrawingArea();
  4037.             normalFont.drawText(0, "Connection lost", 144, 257);
  4038.             normalFont.drawText(0xffffff, "Connection lost", 143, 256);
  4039.             normalFont.drawText(0, "Please wait - attempting to reestablish", 159, 257);
  4040.             normalFont.drawText(0xffffff, "Please wait - attempting to reestablish", 158, 256);
  4041.             main3DArea.drawGraphics(toggleFullscreen ? 0 : 4, super.graphics, toggleFullscreen ? 0 : 4);
  4042.         } catch (NullPointerException ex) {
  4043.            
  4044.         }
  4045.         minimapCover = 0;
  4046.         destX = 0;
  4047.         RSSocket rsSocket = socketStream;
  4048.         loggedIn = false;
  4049.         loginFailures = 0;
  4050.         login(myUsername, myPassword, true);
  4051.         if(!loggedIn)
  4052.             resetLogout();
  4053.         try
  4054.         {
  4055.             rsSocket.close();
  4056.         }
  4057.         catch(Exception _ex)
  4058.         {
  4059.         }
  4060.     }
  4061.  
  4062.     private void drawXPCounter(int paddingX,int paddingY) {
  4063.         int x =  0 + (toggleFullscreen ? paddingX - 22 : paddingX);
  4064.         int y = 46 + (toggleFullscreen ? paddingY - 39 : paddingY);
  4065.         XPcounterSprite[(counterOn || isOnXPCounter(paddingX,paddingY)) ? 1 : 0].drawSprite(x, y);
  4066.     }
  4067.    
  4068.     private void processXPCounterClick(int paddingX,int paddingY) {
  4069.         if (isOnXPCounter(paddingX,paddingY)) {
  4070.             menuActionName[menuActionRow] = "Reset XP Total";
  4071.             menuActionID[menuActionRow] = 475;
  4072.             menuActionRow++;
  4073.             menuActionName[menuActionRow] = "Toggle XP Total";
  4074.             menuActionID[menuActionRow] = 474;
  4075.             menuActionRow++;
  4076.             /*menuActionName[1] = xpLock ? "Unlock XP" : "Lock XP";
  4077.             menuActionID[1] = 476;
  4078.             menuActionRow = 4;*/
  4079.         }
  4080.     }
  4081.    
  4082.     private boolean isOnXPCounter(int paddingX,int paddingY) {
  4083.         int x =  0 + (toggleFullscreen ? paddingX - 22 : paddingX);
  4084.         int y = 46 + (toggleFullscreen ? paddingY - 39 : paddingY);
  4085.         if ((super.mouseX >= xPaddingmapBackImage + x) && (super.mouseX <= xPaddingmapBackImage + x + XPcounterSprite[0].myWidth) && (super.mouseY >= yPaddingmapBackImage + y) && (super.mouseY <= yPaddingmapBackImage + y + XPcounterSprite[0].myHeight))
  4086.             return true;
  4087.         else
  4088.             return false;
  4089.     }
  4090.  
  4091.     private void drawCounterOnScreen(int paddingX,int paddingY) {
  4092.         int x =  xPaddingmapBackImage + (toggleFullscreen ? paddingX - 22 : paddingX);
  4093.         int y = 46 + (toggleFullscreen ? paddingY - 39 : paddingY);
  4094.         XPcounterSprite[2].drawSprite(x-110, y+8);
  4095.         int i = normalFont.getTextWidth(Integer.toString(xpCounter));
  4096.         normalFont.drawText(0xffffff, "XP:", y+21, x-99);
  4097.         normalFont.method385(0xffffff, Integer.toString(xpCounter),  y+21, x-15 - i);
  4098.         if (expAdded != 0) {
  4099.             i = smallFont.getTextWidth(Integer.toString(expAdded)+"xp");
  4100.             smallFont.drawText(0xff9933, Integer.toString(expAdded)+"xp", y+21+18+xpAddedPos, x-12-i);
  4101.             XPcounterSprite[3].drawSprite(x-12-i -50, y+18+xpAddedPos);
  4102.             xpAddedPos += 2;
  4103.             if (xpAddedPos >= 50) {
  4104.                 xpAddedPos = 0;
  4105.                 expAdded = 0;
  4106.             }
  4107.         }
  4108.     }
  4109.    
  4110.     private void doAction(int i)
  4111.     {
  4112.  
  4113.         if(i < 0)
  4114.             return;
  4115.         summoningAttack = false;
  4116.         if(inputDialogState != 0)
  4117.         {
  4118.             inputDialogState = 0;
  4119.             inputTaken = true;
  4120.         }
  4121.         int i1 = menuActionCmd1[i];
  4122.         int j = menuActionCmd2[i];
  4123.         int k = menuActionCmd3[i];
  4124.         int l = menuActionID[i];
  4125.         if(l >= 2000)
  4126.             l -= 2000;
  4127.                     if (l == 476) {
  4128.             alertHandler.close();
  4129.         }
  4130.         //System.out.println("action-ID: " + l);
  4131.         if (l == 474) {//On / Off
  4132.             counterOn = !counterOn;// can u open the client.java of ur old client? yeh
  4133.         }
  4134.         if (l == 475) {//Reset
  4135.             xpCounter = 0;
  4136.         }
  4137.         if(l == 582)
  4138.         {
  4139.             NPC npc = npcArray[i1];
  4140.             if(npc != null)
  4141.             {
  4142.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, npc.smallY[0], myPlayer.smallX[0], false, npc.smallX[0]);
  4143.                 crossX = super.saveClickX;
  4144.                 crossY = super.saveClickY;
  4145.                 crossType = 2;
  4146.                 crossIndex = 0;
  4147.                 stream.createFrame(57);
  4148.                 stream.method432(anInt1285);
  4149.                 stream.method432(i1);
  4150.                 stream.method431(itemSlotUsedOn);
  4151.                 stream.method432(anInt1284);
  4152.             }
  4153.         }
  4154.         if(l == 234)
  4155.         {
  4156.             boolean flag1 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k, myPlayer.smallX[0], false, j);
  4157.             if(!flag1)
  4158.                 flag1 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k, myPlayer.smallX[0], false, j);
  4159.             crossX = super.saveClickX;
  4160.             crossY = super.saveClickY;
  4161.             crossType = 2;
  4162.             crossIndex = 0;
  4163.             stream.createFrame(236);
  4164.             stream.method431(k + baseY);
  4165.             stream.writeWord(i1);
  4166.             stream.method431(j + baseX);
  4167.         }
  4168.         if(l == 62 && method66(i1, k, j))
  4169.         {
  4170.             stream.createFrame(192);
  4171.             stream.writeWord(anInt1284);
  4172.             stream.method431(i1 >> 14 & 0x7fff);
  4173.             stream.method433(k + baseY);
  4174.             stream.method431(itemSlotUsedOn);
  4175.             stream.method433(j + baseX);
  4176.             stream.writeWord(anInt1285);
  4177.         }
  4178.         if(l == 104) {
  4179.             RSInterface rsInterface = RSInterface.interfaceCache[k];
  4180.             spellID = rsInterface.id;
  4181.             if(!interfaceIsSelected(rsInterface)) {
  4182.                 pushMessage("You need the correct Magic level and rune requirements to use this spell.", 0, "");
  4183.             } else {
  4184.                 if(!autoCast || (autocastId != spellID)) {
  4185.                     autoCast = true;
  4186.                     autocastId = spellID;
  4187.                     sendPacket185(autocastId,-1,135);
  4188.                     pushMessage("Autocast spell selected.", 0, "");
  4189.                 } else if(autocastId == spellID) {
  4190.                     setAutoCastOff();
  4191.                 }
  4192.             }
  4193.         }
  4194.         if(l == 511)
  4195.         {
  4196.             boolean flag2 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k, myPlayer.smallX[0], false, j);
  4197.             if(!flag2)
  4198.                 flag2 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k, myPlayer.smallX[0], false, j);
  4199.             crossX = super.saveClickX;
  4200.             crossY = super.saveClickY;
  4201.             crossType = 2;
  4202.             crossIndex = 0;
  4203.             stream.createFrame(25);
  4204.             stream.method431(anInt1284);
  4205.             stream.method432(anInt1285);
  4206.             stream.writeWord(i1);
  4207.             stream.method432(k + baseY);
  4208.             stream.method433(itemSlotUsedOn);
  4209.             stream.writeWord(j + baseX);
  4210.         }
  4211.         if(l == 74)
  4212.         {
  4213.             stream.createFrame(122);
  4214.             stream.method433(k);
  4215.             stream.method432(j);
  4216.             stream.method431(i1);
  4217.             atInventoryLoopCycle = 0;
  4218.             atInventoryInterface = k;
  4219.             atInventoryIndex = j;
  4220.             atInventoryInterfaceType = 2;
  4221.             if(RSInterface.interfaceCache[k].parentID == openInterfaceID)
  4222.                 atInventoryInterfaceType = 1;
  4223.             if(RSInterface.interfaceCache[k].parentID == backDialogID)
  4224.                 atInventoryInterfaceType = 3;
  4225.         }
  4226.         if (l == 315) {
  4227.             sendPacket185(k,-1,135);
  4228.         }
  4229.         if(l == 561)
  4230.         {
  4231.             Player player = playerArray[i1];
  4232.             if(player != null)
  4233.             {
  4234.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, player.smallY[0], myPlayer.smallX[0], false, player.smallX[0]);
  4235.                 crossX = super.saveClickX;
  4236.                 crossY = super.saveClickY;
  4237.                 crossType = 2;
  4238.                 crossIndex = 0;
  4239.                 anInt1188 += i1;
  4240.                 if(anInt1188 >= 90)
  4241.                 {
  4242.                     stream.createFrame(136);
  4243.                     anInt1188 = 0;
  4244.                 }
  4245.                 stream.createFrame(128);
  4246.                 stream.writeWord(i1);
  4247.             }
  4248.         }
  4249.         if(l == 20)
  4250.         {
  4251.             NPC class30_sub2_sub4_sub1_sub1_1 = npcArray[i1];
  4252.             if(class30_sub2_sub4_sub1_sub1_1 != null)
  4253.             {
  4254.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, class30_sub2_sub4_sub1_sub1_1.smallY[0], myPlayer.smallX[0], false, class30_sub2_sub4_sub1_sub1_1.smallX[0]);
  4255.                 crossX = super.saveClickX;
  4256.                 crossY = super.saveClickY;
  4257.                 crossType = 2;
  4258.                 crossIndex = 0;
  4259.                 stream.createFrame(155);
  4260.                 stream.method431(i1);
  4261.             }
  4262.         }
  4263.         if(l == 779)
  4264.         {
  4265.             Player class30_sub2_sub4_sub1_sub2_1 = playerArray[i1];
  4266.             if(class30_sub2_sub4_sub1_sub2_1 != null)
  4267.             {
  4268.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, class30_sub2_sub4_sub1_sub2_1.smallY[0], myPlayer.smallX[0], false, class30_sub2_sub4_sub1_sub2_1.smallX[0]);
  4269.                 crossX = super.saveClickX;
  4270.                 crossY = super.saveClickY;
  4271.                 crossType = 2;
  4272.                 crossIndex = 0;
  4273.                 stream.createFrame(153);
  4274.                 stream.method431(i1);
  4275.             }
  4276.         }
  4277.         if(l == 516)
  4278.             if(!contextMenuOpen)
  4279.                 worldController.method312(super.saveClickY - 4, super.saveClickX - 4);
  4280.             else
  4281.                 worldController.method312(k - 4, j - 4);
  4282.         if(l == 1062)
  4283.         {
  4284.             anInt924 += baseX;
  4285.             if(anInt924 >= 113)
  4286.             {
  4287.                 stream.createFrame(183);
  4288.                 stream.writeDWordBigEndian(0xe63271);
  4289.                 anInt924 = 0;
  4290.             }
  4291.             method66(i1, k, j);
  4292.             stream.createFrame(228);
  4293.             stream.method432(i1 >> 14 & 0x7fff);
  4294.             stream.method432(k + baseY);
  4295.             stream.writeWord(j + baseX);
  4296.         }
  4297.         if(l == 679 && !aBoolean1149)
  4298.         {
  4299.             stream.createFrame(40);
  4300.             stream.writeWord(k);
  4301.             aBoolean1149 = true;
  4302.         }
  4303.         if(l == 431)
  4304.         {
  4305.             stream.createFrame(129);
  4306.             stream.method432(j);
  4307.             stream.writeWord(k);
  4308.             stream.method432(i1);
  4309.             atInventoryLoopCycle = 0;
  4310.             atInventoryInterface = k;
  4311.             atInventoryIndex = j;
  4312.             atInventoryInterfaceType = 2;
  4313.             if(RSInterface.interfaceCache[k].parentID == openInterfaceID)
  4314.                 atInventoryInterfaceType = 1;
  4315.             if(RSInterface.interfaceCache[k].parentID == backDialogID)
  4316.                 atInventoryInterfaceType = 3;
  4317.         }
  4318.         if(l == 337 || l == 42 || l == 792 || l == 322)
  4319.         {
  4320.             String s = menuActionName[i];
  4321.             int k1 = s.indexOf("@whi@");
  4322.             if(k1 != -1)
  4323.             {
  4324.                 long l3 = TextClass.longForName(s.substring(k1 + 5).trim());
  4325.                 if(l == 337)
  4326.                     addFriend(l3);
  4327.                 if(l == 42)
  4328.                     addIgnore(l3);
  4329.                 if(l == 792)
  4330.                     delFriend(l3);
  4331.                 if(l == 322)
  4332.                     delIgnore(l3);
  4333.             }
  4334.         }
  4335.         if(l == 53)
  4336.         {
  4337.             stream.createFrame(135);
  4338.             stream.method431(j);
  4339.             stream.method432(k);
  4340.             stream.method431(i1);
  4341.             atInventoryLoopCycle = 0;
  4342.             atInventoryInterface = k;
  4343.             atInventoryIndex = j;
  4344.             atInventoryInterfaceType = 2;
  4345.             if(RSInterface.interfaceCache[k].parentID == openInterfaceID)
  4346.                 atInventoryInterfaceType = 1;
  4347.             if(RSInterface.interfaceCache[k].parentID == backDialogID)
  4348.                 atInventoryInterfaceType = 3;
  4349.         }
  4350.         if(l == 539)
  4351.         {
  4352.             stream.createFrame(16);
  4353.             stream.method432(i1);
  4354.             stream.method433(j);
  4355.             stream.method433(k);
  4356.             atInventoryLoopCycle = 0;
  4357.             atInventoryInterface = k;
  4358.             atInventoryIndex = j;
  4359.             atInventoryInterfaceType = 2;
  4360.             if(RSInterface.interfaceCache[k].parentID == openInterfaceID)
  4361.                 atInventoryInterfaceType = 1;
  4362.             if(RSInterface.interfaceCache[k].parentID == backDialogID)
  4363.                 atInventoryInterfaceType = 3;
  4364.         }
  4365.         if(l == 484 || l == 6)
  4366.         {
  4367.             String s1 = menuActionName[i];
  4368.             int l1 = s1.indexOf("@whi@");
  4369.             if(l1 != -1)
  4370.             {
  4371.                 s1 = s1.substring(l1 + 5).trim();
  4372.                 String s7 = TextClass.fixName(TextClass.nameForLong(TextClass.longForName(s1)));
  4373.                 boolean flag9 = false;
  4374.                 for(int j3 = 0; j3 < playerCount; j3++)
  4375.                 {
  4376.                     Player class30_sub2_sub4_sub1_sub2_7 = playerArray[playerIndices[j3]];
  4377.                     if(class30_sub2_sub4_sub1_sub2_7 == null || class30_sub2_sub4_sub1_sub2_7.name == null || !class30_sub2_sub4_sub1_sub2_7.name.equalsIgnoreCase(s7))
  4378.                         continue;
  4379.                     doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, class30_sub2_sub4_sub1_sub2_7.smallY[0], myPlayer.smallX[0], false, class30_sub2_sub4_sub1_sub2_7.smallX[0]);
  4380.                     if(l == 484)
  4381.                     {
  4382.                         stream.createFrame(139);
  4383.                         stream.method431(playerIndices[j3]);
  4384.                     }
  4385.                     if(l == 6)
  4386.                     {
  4387.                         anInt1188 += i1;
  4388.                         if(anInt1188 >= 90)
  4389.                         {
  4390.                             stream.createFrame(136);
  4391.                             anInt1188 = 0;
  4392.                         }
  4393.                         stream.createFrame(128);
  4394.                         stream.writeWord(playerIndices[j3]);
  4395.                     }
  4396.                     flag9 = true;
  4397.                     break;
  4398.                 }
  4399.  
  4400.                 if(!flag9)
  4401.                     pushMessage("Unable to find " + s7, 0, "");
  4402.             }
  4403.         }
  4404.         if(l == 485) {
  4405.             openUpWebSite(linkInText);
  4406.         }
  4407.         if(l == 870)
  4408.         {
  4409.             stream.createFrame(53);
  4410.             stream.writeWord(j);
  4411.             stream.method432(itemSlotUsedOn);
  4412.             stream.method433(i1);
  4413.             stream.writeWord(anInt1284);
  4414.             stream.method431(anInt1285);
  4415.             stream.writeWord(k);
  4416.             atInventoryLoopCycle = 0;
  4417.             atInventoryInterface = k;
  4418.             atInventoryIndex = j;
  4419.             atInventoryInterfaceType = 2;
  4420.             if(RSInterface.interfaceCache[k].parentID == openInterfaceID)
  4421.                 atInventoryInterfaceType = 1;
  4422.             if(RSInterface.interfaceCache[k].parentID == backDialogID)
  4423.                 atInventoryInterfaceType = 3;
  4424.         }
  4425.         if(l == 847)
  4426.         {
  4427.             stream.createFrame(87);
  4428.             stream.method432(i1);
  4429.             stream.writeWord(k);
  4430.             stream.method432(j);
  4431.             atInventoryLoopCycle = 0;
  4432.             atInventoryInterface = k;
  4433.             atInventoryIndex = j;
  4434.             atInventoryInterfaceType = 2;
  4435.             if(RSInterface.interfaceCache[k].parentID == openInterfaceID)
  4436.                 atInventoryInterfaceType = 1;
  4437.             if(RSInterface.interfaceCache[k].parentID == backDialogID)
  4438.                 atInventoryInterfaceType = 3;
  4439.         }
  4440.         if(l == 626)
  4441.         {
  4442.             RSInterface rsInterface = RSInterface.interfaceCache[k];
  4443.             spellSelected = 1;
  4444.             spellID = rsInterface.id;
  4445.             anInt1137 = k;
  4446.             spellUsableOn = rsInterface.spellUsableOn;
  4447.             itemSelected = 0;
  4448.             needDrawTabArea = true;
  4449.             String s4 = rsInterface.selectedActionName;
  4450.             if(s4.indexOf(" ") != -1)
  4451.                 s4 = s4.substring(0, s4.indexOf(" "));
  4452.             String s8 = rsInterface.selectedActionName;
  4453.             if(s8.indexOf(" ") != -1)
  4454.                 s8 = s8.substring(s8.indexOf(" ") + 1);
  4455.             spellTooltip = s4 + " " + rsInterface.spellName + " " + s8;
  4456.             if(spellUsableOn == 16)
  4457.             {
  4458.                 needDrawTabArea = true;
  4459.                 tabID = 3;
  4460.                 tabAreaAltered = true;
  4461.             }
  4462.             return;
  4463.         }
  4464.         if (l == 1053) {
  4465.     stream.createFrame(185);
  4466.     stream.writeWord(9999);
  4467. }
  4468.         if(l == 78)
  4469.         {
  4470.             stream.createFrame(117);
  4471.             stream.method433(k);
  4472.             stream.method433(i1);
  4473.             stream.method431(j);
  4474.             atInventoryLoopCycle = 0;
  4475.             atInventoryInterface = k;
  4476.             atInventoryIndex = j;
  4477.             atInventoryInterfaceType = 2;
  4478.             if(RSInterface.interfaceCache[k].parentID == openInterfaceID)
  4479.                 atInventoryInterfaceType = 1;
  4480.             if(RSInterface.interfaceCache[k].parentID == backDialogID)
  4481.                 atInventoryInterfaceType = 3;
  4482.         }
  4483.         if(l == 27)
  4484.         {
  4485.             Player player = playerArray[i1];
  4486.             if(player != null)
  4487.             {
  4488.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, player.smallY[0], myPlayer.smallX[0], false, player.smallX[0]);
  4489.                 crossX = super.saveClickX;
  4490.                 crossY = super.saveClickY;
  4491.                 crossType = 2;
  4492.                 crossIndex = 0;
  4493.                 anInt986 += i1;
  4494.                 if(anInt986 >= 54)
  4495.                 {
  4496.                     stream.createFrame(189);
  4497.                     stream.writeWordBigEndian(234);
  4498.                     anInt986 = 0;
  4499.                 }
  4500.                 stream.createFrame(73);
  4501.                 stream.method431(i1);
  4502.             }
  4503.         }
  4504.         if(l == 213)
  4505.         {
  4506.             boolean flag3 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k, myPlayer.smallX[0], false, j);
  4507.             if(!flag3)
  4508.                 flag3 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k, myPlayer.smallX[0], false, j);
  4509.             crossX = super.saveClickX;
  4510.             crossY = super.saveClickY;
  4511.             crossType = 2;
  4512.             crossIndex = 0;
  4513.             stream.createFrame(79);
  4514.             stream.method431(k + baseY);
  4515.             stream.writeWord(i1);
  4516.             stream.method432(j + baseX);
  4517.         }
  4518.         if(l == 632)
  4519.         {
  4520.             stream.createFrame(145);
  4521.             stream.method432(k);
  4522.             stream.method432(j);
  4523.             stream.method432(i1);
  4524.             System.out.println("k: " + k + ", j: " + j + ", i1: " + i1);
  4525.             atInventoryLoopCycle = 0;
  4526.             atInventoryInterface = k;
  4527.             atInventoryIndex = j;
  4528.             atInventoryInterfaceType = 2;
  4529.             if(RSInterface.interfaceCache[k].parentID == openInterfaceID)
  4530.                 atInventoryInterfaceType = 1;
  4531.             if(RSInterface.interfaceCache[k].parentID == backDialogID)
  4532.                 atInventoryInterfaceType = 3;
  4533.         }
  4534.         if(l == 1011) {//combat
  4535.             setTab(0);
  4536.         }
  4537.         if(l == 1012) {//skills
  4538.             setTab(1);
  4539.         }
  4540.         if(l == 1013) {//quests
  4541.             setTab(2);
  4542.         }
  4543.         if(l == 1014) {//quests
  4544.             setTab(3);
  4545.         }
  4546.         if(l == 1015) {//worn
  4547.             setTab(4);
  4548.         }
  4549.         if(l == 1016) {//prayer
  4550.             setTab(5);
  4551.         }
  4552.         if(l == 1017) {//Modern - 1151
  4553.             setTab(6);
  4554.         }
  4555.         if(l == 1018) {//Clan chat
  4556.             setTab(7);
  4557.         }
  4558.         if(l == 1019) {//friends
  4559.             setTab(8);
  4560.         }
  4561.         if(l == 1020) {//ignore
  4562.             setTab(9);
  4563.         }
  4564.         if(l == 1021) {//logout
  4565.             setTab(10);
  4566.         }
  4567.         if(l == 1022) {//Options
  4568.             setTab(11);
  4569.         }
  4570.         if(l == 1023) {//Emotes
  4571.             setTab(12);
  4572.         }
  4573.         if(l == 1024) {//Music
  4574.             setTab(13);
  4575.         }
  4576.         if(l == 1042) {//Task system
  4577.             setTab(14);
  4578.         }
  4579.         if(l == 1043) {//Objectives
  4580.             setTab(16);
  4581.         }
  4582.         if(l == 1044) {//Notes
  4583.             setTab(15);
  4584.         }
  4585.         if(l == 1045) {//Toggle quick prayers / curses
  4586.             if(openInterfaceID != -1)
  4587.                 pushMessage("Please close the window first.", 0, "");
  4588.             else {
  4589.                 if(getOrbValues(1,null)[0] > 0)
  4590.                     handleQuickAidsActive();
  4591.                 else
  4592.                     pushMessage("You need to recharge your Prayer at an alter.", 0, "");
  4593.             }
  4594.         }
  4595.         if(l == 1046) {//Select quick prayers / curses
  4596.             if(!loadTickSelection) {
  4597.                 turnOffPrayers();
  4598.                 turnOffCurses();
  4599.                 turnOffQuickTicks();
  4600.                 configureQuickTicks();
  4601.                 loadTickSelection = true;
  4602.             }
  4603.             toggleQuickAidsSelection();
  4604.         }
  4605.         if(l == 1047) {//Toggle run mode
  4606.             if(getOrbValues(2,null)[0] > 0)
  4607.                 orbToggle[2] = !orbToggle[2];
  4608.             else
  4609.                 pushMessage("You don't have enough energy left to run!", 0, "");
  4610.             sendPacket185(152,173,169);
  4611.         }
  4612.         if(l == 1048) {//Rest
  4613.             pushMessage("Will be adding this feature soon..", 0, "");
  4614.         }
  4615.         if(l == 1049) {//compass
  4616.             compassRotation = 0;
  4617.         }
  4618.         if(l == 1050) {//world map
  4619.                         launchURL("http://www.runelocus.com/toplist/vote-16537.html");
  4620.             //pushMessage("Thanks for Voting!", 0, "");
  4621.         }
  4622.         if(l == 1051) {//Advisor
  4623.             pushMessage("@red@Coming soon!", 0, "");
  4624.             //openUpWebSite("http://www.deadlypkers.net/forum/forumdisplay.php?122-Guides");
  4625.         }
  4626.         if(l == 1052 && orbToggle[0]) {//cure me
  4627.             pushMessage("@red@Coming soon!", 0, "");
  4628.         }/*
  4629.         if(l == 1053) {//summoning - Select left-click option DISABLED CUZ CRASH
  4630.                 stream.createFrame(185);
  4631.     stream.writeWord(9993);
  4632.         }
  4633.         if(l == 1054) {//summoning - Call Follower
  4634.                 stream.createFrame(185);
  4635.     stream.writeWord(9994);
  4636.         }
  4637.         if(l == 1055) {//summoning - Dismiss
  4638.                 stream.createFrame(185);
  4639.     stream.writeWord(9995);
  4640.         }
  4641.         if(l == 1056) {//summoning - Take BoB
  4642.                 stream.createFrame(185);
  4643.     stream.writeWord(9996);
  4644.         }
  4645.         if(l == 1057) {//summoning - Renew Familiar
  4646.                 stream.createFrame(185);
  4647.     stream.writeWord(9997);
  4648.         }
  4649.         if(l == 1058) {//summoning - Attack
  4650.                 stream.createFrame(185);
  4651.     stream.writeWord(9998);
  4652.         }
  4653.         if(l == 1059) {//summoning - Follower Details
  4654.     stream.createFrame(185);
  4655.     stream.writeWord(9999);
  4656.         }*/
  4657.         if(l == 1003) {
  4658.             clanChatMode = 2;
  4659.             aBoolean1233 = true;
  4660.             inputTaken = true;
  4661.         }
  4662.         if(l == 1002) {
  4663.             clanChatMode = 1;
  4664.             aBoolean1233 = true;
  4665.             inputTaken = true;
  4666.         }
  4667.         if(l == 1001) {
  4668.             clanChatMode = 0;
  4669.             aBoolean1233 = true;
  4670.             inputTaken = true;
  4671.         }
  4672.         if(l == 1000) {
  4673.             cButtonCPos = 4;
  4674.             chatTypeView = 11;
  4675.             aBoolean1233 = true;
  4676.             inputTaken = true;
  4677.         }
  4678.         if(l == 999) {
  4679.             cButtonCPos = 0;
  4680.             chatTypeView = 0;
  4681.             aBoolean1233 = true;
  4682.             inputTaken = true;
  4683.         }
  4684.         if(l == 998) {
  4685.             cButtonCPos = 1;
  4686.             chatTypeView = 5;
  4687.             aBoolean1233 = true;
  4688.             inputTaken = true;
  4689.         }
  4690.         if(l == 997) {
  4691.             publicChatMode = 3;
  4692.             aBoolean1233 = true;
  4693.             inputTaken = true;
  4694.         }
  4695.         if(l == 996) {
  4696.             publicChatMode = 2;
  4697.             aBoolean1233 = true;
  4698.             inputTaken = true;
  4699.         }
  4700.         if(l == 995) {
  4701.             publicChatMode = 1;
  4702.             aBoolean1233 = true;
  4703.             inputTaken = true;
  4704.         }
  4705.         if(l == 994) {
  4706.             publicChatMode = 0;
  4707.             aBoolean1233 = true;
  4708.             inputTaken = true;
  4709.         }
  4710.         if(l == 993) {
  4711.             cButtonCPos = 2;
  4712.             chatTypeView = 1;
  4713.             aBoolean1233 = true;
  4714.             inputTaken = true;
  4715.         }
  4716.         if(l == 992) {
  4717.             privateChatMode = 2;
  4718.             aBoolean1233 = true;
  4719.             inputTaken = true;
  4720.         }
  4721.         if(l == 991) {
  4722.             privateChatMode = 1;
  4723.             aBoolean1233 = true;
  4724.             inputTaken = true;
  4725.         }
  4726.         if(l == 990) {
  4727.             privateChatMode = 0;
  4728.             aBoolean1233 = true;
  4729.             inputTaken = true;
  4730.         }
  4731.         if(l == 989) {
  4732.             cButtonCPos = 3;
  4733.             chatTypeView = 2;
  4734.             aBoolean1233 = true;
  4735.             inputTaken = true;
  4736.         }
  4737.         if(l == 987) {
  4738.             tradeMode = 2;
  4739.             aBoolean1233 = true;
  4740.             inputTaken = true;
  4741.         }
  4742.         if(l == 986) {
  4743.             tradeMode = 1;
  4744.             aBoolean1233 = true;
  4745.             inputTaken = true;
  4746.         }
  4747.         if(l == 985) {
  4748.             tradeMode = 0;
  4749.             aBoolean1233 = true;
  4750.             inputTaken = true;
  4751.         }
  4752.         if(l == 984) {
  4753.             cButtonCPos = 5;
  4754.             chatTypeView = 3;
  4755.             aBoolean1233 = true;
  4756.             inputTaken = true;
  4757.         }
  4758.         if(l == 983) {
  4759.             duelMode = 2;
  4760.             aBoolean1233 = true;
  4761.             inputTaken = true;
  4762.         }
  4763.         if(l == 982) {
  4764.             duelMode = 1;
  4765.             aBoolean1233 = true;
  4766.             inputTaken = true;
  4767.         }
  4768.         if(l == 981) {
  4769.             duelMode = 0;
  4770.             aBoolean1233 = true;
  4771.             inputTaken = true;
  4772.         }
  4773.         if(l == 980) {
  4774.             cButtonCPos = 6;
  4775.             chatTypeView = 4;
  4776.             aBoolean1233 = true;
  4777.             inputTaken = true;
  4778.         }
  4779.         if(l == 493)
  4780.         {
  4781.             stream.createFrame(75);
  4782.             stream.method433(k);
  4783.             stream.method431(j);
  4784.             stream.method432(i1);
  4785.             atInventoryLoopCycle = 0;
  4786.             atInventoryInterface = k;
  4787.             atInventoryIndex = j;
  4788.             atInventoryInterfaceType = 2;
  4789.             if(RSInterface.interfaceCache[k].parentID == openInterfaceID)
  4790.                 atInventoryInterfaceType = 1;
  4791.             if(RSInterface.interfaceCache[k].parentID == backDialogID)
  4792.                 atInventoryInterfaceType = 3;
  4793.         }
  4794.         if(l == 652)
  4795.         {
  4796.             boolean flag4 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k, myPlayer.smallX[0], false, j);
  4797.             if(!flag4)
  4798.                 flag4 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k, myPlayer.smallX[0], false, j);
  4799.             crossX = super.saveClickX;
  4800.             crossY = super.saveClickY;
  4801.             crossType = 2;
  4802.             crossIndex = 0;
  4803.             stream.createFrame(156);
  4804.             stream.method432(j + baseX);
  4805.             stream.method431(k + baseY);
  4806.             stream.method433(i1);
  4807.         }
  4808.         if(l == 94)
  4809.         {
  4810.             boolean flag5 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k, myPlayer.smallX[0], false, j);
  4811.             if(!flag5)
  4812.                 flag5 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k, myPlayer.smallX[0], false, j);
  4813.             crossX = super.saveClickX;
  4814.             crossY = super.saveClickY;
  4815.             crossType = 2;
  4816.             crossIndex = 0;
  4817.             stream.createFrame(181);
  4818.             stream.method431(k + baseY);
  4819.             stream.writeWord(i1);
  4820.             stream.method431(j + baseX);
  4821.             stream.method432(anInt1137);
  4822.         }
  4823.         if(l == 646) {
  4824.             sendPacket185(k,-1,646);
  4825.         }
  4826.         if(l == 225)
  4827.         {
  4828.             NPC class30_sub2_sub4_sub1_sub1_2 = npcArray[i1];
  4829.             if(class30_sub2_sub4_sub1_sub1_2 != null)
  4830.             {
  4831.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, class30_sub2_sub4_sub1_sub1_2.smallY[0], myPlayer.smallX[0], false, class30_sub2_sub4_sub1_sub1_2.smallX[0]);
  4832.                 crossX = super.saveClickX;
  4833.                 crossY = super.saveClickY;
  4834.                 crossType = 2;
  4835.                 crossIndex = 0;
  4836.                 anInt1226 += i1;
  4837.                 if(anInt1226 >= 85)
  4838.                 {
  4839.                     stream.createFrame(230);
  4840.                     stream.writeWordBigEndian(239);
  4841.                     anInt1226 = 0;
  4842.                 }
  4843.                 stream.createFrame(17);
  4844.                 stream.method433(i1);
  4845.             }
  4846.         }
  4847.         if(l == 965)
  4848.         {
  4849.             NPC npc = npcArray[i1];
  4850.             if(npc != null)
  4851.             {
  4852.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, npc.smallY[0], myPlayer.smallX[0], false, npc.smallX[0]);
  4853.                 crossX = super.saveClickX;
  4854.                 crossY = super.saveClickY;
  4855.                 crossType = 2;
  4856.                 crossIndex = 0;
  4857.                 anInt1134++;
  4858.                 if(anInt1134 >= 96)
  4859.                 {
  4860.                     stream.createFrame(152);
  4861.                     stream.writeWordBigEndian(88);
  4862.                     anInt1134 = 0;
  4863.                 }
  4864.                 stream.createFrame(21);
  4865.                 stream.writeWord(i1);
  4866.             }
  4867.         }
  4868.         if(l == 413)
  4869.         {
  4870.             NPC npc = npcArray[i1];
  4871.             if(npc != null)
  4872.             {
  4873.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, npc.smallY[0], myPlayer.smallX[0], false, npc.smallX[0]);
  4874.                 crossX = super.saveClickX;
  4875.                 crossY = super.saveClickY;
  4876.                 crossType = 2;
  4877.                 crossIndex = 0;
  4878.                 stream.createFrame(131);
  4879.                 stream.method433(i1);
  4880.                 stream.method432(anInt1137);
  4881.             }
  4882.         }
  4883.         if(l == 200)
  4884.             clearTopInterfaces();
  4885.         if(l == 1025)
  4886.         {
  4887.             NPC npc = npcArray[i1];
  4888.             if(npc != null)
  4889.             {
  4890.                 EntityDef entityDef = npc.desc;
  4891.                 if(entityDef.childrenIDs != null)
  4892.                     entityDef = entityDef.method161();
  4893.                 if(entityDef != null)
  4894.                 {
  4895.                     String s9;
  4896.                     if(entityDef.description != null)
  4897.                         s9 = new String(entityDef.description);
  4898.                     else
  4899.                         s9 = "It's a " + entityDef.name + ".";
  4900.                     pushMessage(s9, 0, "");
  4901.                 }
  4902.             }
  4903.         }
  4904.         if(l == 900)
  4905.         {
  4906.             method66(i1, k, j);
  4907.             stream.createFrame(252);
  4908.             stream.method433(i1 >> 14 & 0x7fff);
  4909.             stream.method431(k + baseY);
  4910.             stream.method432(j + baseX);
  4911.         }
  4912.         if(l == 412)
  4913.         {
  4914.             NPC npc = npcArray[i1];
  4915.             if(npc != null)
  4916.             {
  4917.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, npc.smallY[0], myPlayer.smallX[0], false, npc.smallX[0]);
  4918.                 crossX = super.saveClickX;
  4919.                 crossY = super.saveClickY;
  4920.                 crossType = 2;
  4921.                 crossIndex = 0;
  4922.                 stream.createFrame(72);
  4923.                 stream.method432(i1);
  4924.                 //System.out.println("i1: " + i1);
  4925.             }
  4926.         }
  4927.         if(l == 365)
  4928.         {
  4929.             Player player = playerArray[i1];
  4930.             if(player != null)
  4931.             {
  4932.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, player.smallY[0], myPlayer.smallX[0], false, player.smallX[0]);
  4933.                 crossX = super.saveClickX;
  4934.                 crossY = super.saveClickY;
  4935.                 crossType = 2;
  4936.                 crossIndex = 0;
  4937.                 stream.createFrame(249);
  4938.                 stream.method432(i1);
  4939.                 stream.method431(anInt1137);
  4940.             }
  4941.         }
  4942.         if(l == 729)
  4943.         {
  4944.             Player player = playerArray[i1];
  4945.             if(player != null)
  4946.             {
  4947.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, player.smallY[0], myPlayer.smallX[0], false, player.smallX[0]);
  4948.                 crossX = super.saveClickX;
  4949.                 crossY = super.saveClickY;
  4950.                 crossType = 2;
  4951.                 crossIndex = 0;
  4952.                 stream.createFrame(39);
  4953.                 stream.method431(i1);
  4954.             }
  4955.         }
  4956.         if(l == 577)
  4957.         {
  4958.             Player player = playerArray[i1];
  4959.             if(player != null)
  4960.             {
  4961.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, player.smallY[0], myPlayer.smallX[0], false, player.smallX[0]);
  4962.                 crossX = super.saveClickX;
  4963.                 crossY = super.saveClickY;
  4964.                 crossType = 2;
  4965.                 crossIndex = 0;
  4966.                 stream.createFrame(139);
  4967.                 stream.method431(i1);
  4968.             }
  4969.         }
  4970.         if(l == 956 && method66(i1, k, j))
  4971.         {
  4972.             stream.createFrame(35);
  4973.             stream.method431(j + baseX);
  4974.             stream.method432(anInt1137);
  4975.             stream.method432(k + baseY);
  4976.             stream.method431(i1 >> 14 & 0x7fff);
  4977.         }
  4978.         if(l == 567)
  4979.         {
  4980.             boolean flag6 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k, myPlayer.smallX[0], false, j);
  4981.             if(!flag6)
  4982.                 flag6 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k, myPlayer.smallX[0], false, j);
  4983.             crossX = super.saveClickX;
  4984.             crossY = super.saveClickY;
  4985.             crossType = 2;
  4986.             crossIndex = 0;
  4987.             stream.createFrame(23);
  4988.             stream.method431(k + baseY);
  4989.             stream.method431(i1);
  4990.             stream.method431(j + baseX);
  4991.         }
  4992.         if(l == 867)
  4993.         {
  4994.             if((i1 & 3) == 0)
  4995.                 anInt1175++;
  4996.             if(anInt1175 >= 59)
  4997.             {
  4998.                 stream.createFrame(200);
  4999.                 stream.writeWord(25501);
  5000.                 anInt1175 = 0;
  5001.             }
  5002.             stream.createFrame(43);
  5003.             stream.method431(k);
  5004.             stream.method432(i1);
  5005.             stream.method432(j);
  5006.             atInventoryLoopCycle = 0;
  5007.             atInventoryInterface = k;
  5008.             atInventoryIndex = j;
  5009.             atInventoryInterfaceType = 2;
  5010.             if(RSInterface.interfaceCache[k].parentID == openInterfaceID)
  5011.                 atInventoryInterfaceType = 1;
  5012.             if(RSInterface.interfaceCache[k].parentID == backDialogID)
  5013.                 atInventoryInterfaceType = 3;
  5014.         }
  5015.         if(l == 543)
  5016.         {
  5017.             stream.createFrame(237);
  5018.             stream.writeWord(j);
  5019.             stream.method432(i1);
  5020.             stream.writeWord(k);
  5021.             stream.method432(anInt1137);
  5022.             System.out.println("j: " + j + ", i1: " + i1 + ", k: " + k + ", anInt1137: " + anInt1137);
  5023.             atInventoryLoopCycle = 0;
  5024.             atInventoryInterface = k;
  5025.             atInventoryIndex = j;
  5026.             atInventoryInterfaceType = 2;
  5027.             if(RSInterface.interfaceCache[k].parentID == openInterfaceID)
  5028.                 atInventoryInterfaceType = 1;
  5029.             if(RSInterface.interfaceCache[k].parentID == backDialogID)
  5030.                 atInventoryInterfaceType = 3;
  5031.         }
  5032.         if(l == 606)
  5033.         {
  5034.             String s2 = menuActionName[i];
  5035.             int j2 = s2.indexOf("@whi@");
  5036.             if(j2 != -1)
  5037.                 if(openInterfaceID == -1)
  5038.                 {
  5039.                     clearTopInterfaces();
  5040.                     reportAbuseInput = s2.substring(j2 + 5).trim();
  5041.                     canMute = false;
  5042.                     canBan = false;
  5043.                     for(int i3 = 0; i3 < RSInterface.interfaceCache.length; i3++)
  5044.                     {
  5045.                         if(RSInterface.interfaceCache[i3] == null || RSInterface.interfaceCache[i3].contentType != 600)
  5046.                             continue;
  5047.                         reportAbuseInterfaceID = openInterfaceID = RSInterface.interfaceCache[i3].parentID;
  5048.                         break;
  5049.                     }
  5050.  
  5051.                 } else
  5052.                 {
  5053.                     pushMessage("Please close the interface you have open before using 'report abuse'", 0, "");
  5054.                 }
  5055.         }
  5056.         if(l == 491)
  5057.         {
  5058.             Player player = playerArray[i1];
  5059.             if(player != null)
  5060.             {
  5061.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, player.smallY[0], myPlayer.smallX[0], false, player.smallX[0]);
  5062.                 crossX = super.saveClickX;
  5063.                 crossY = super.saveClickY;
  5064.                 crossType = 2;
  5065.                 crossIndex = 0;
  5066.                 stream.createFrame(14);
  5067.                 stream.method432(anInt1284);
  5068.                 stream.writeWord(i1);
  5069.                 stream.writeWord(anInt1285);
  5070.                 stream.method431(itemSlotUsedOn);
  5071.             }
  5072.         }
  5073.         if(l == 639)
  5074.         {
  5075.             String s3 = menuActionName[i];
  5076.             int k2 = s3.indexOf("@whi@");
  5077.             if(k2 != -1)
  5078.             {
  5079.                 long l4 = TextClass.longForName(s3.substring(k2 + 5).trim());
  5080.                 int k3 = -1;
  5081.                 for(int i4 = 0; i4 < friendsCount; i4++)
  5082.                 {
  5083.                     if(friendsListAsLongs[i4] != l4 && l != 640)
  5084.                         continue;
  5085.                     k3 = i4;
  5086.                     break;
  5087.                 }
  5088.                 System.out.println("k3: " + k3);
  5089.                 if(k3 != -1)
  5090.                 {
  5091.                     inputTaken = true;
  5092.                     inputDialogState = 0;
  5093.                     messagePromptRaised = true;
  5094.                     promptInput = "";
  5095.                     friendsListAction = 3;
  5096.                     aLong953 = friendsListAsLongs[k3];
  5097.                     aString1121 = "Enter message to send to " + friendsList[k3];
  5098.                 }
  5099.             }
  5100.         }
  5101.         if(l == 454)
  5102.         {
  5103.             stream.createFrame(41);
  5104.             stream.writeWord(i1);
  5105.             stream.method432(j);
  5106.             stream.method432(k);
  5107.             atInventoryLoopCycle = 0;
  5108.             atInventoryInterface = k;
  5109.             atInventoryIndex = j;
  5110.             atInventoryInterfaceType = 2;
  5111.             if(RSInterface.interfaceCache[k].parentID == openInterfaceID)
  5112.                 atInventoryInterfaceType = 1;
  5113.             if(RSInterface.interfaceCache[k].parentID == backDialogID)
  5114.                 atInventoryInterfaceType = 3;
  5115.         }
  5116.         if(l == 478)
  5117.         {
  5118.             NPC class30_sub2_sub4_sub1_sub1_7 = npcArray[i1];
  5119.             if(class30_sub2_sub4_sub1_sub1_7 != null)
  5120.             {
  5121.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, class30_sub2_sub4_sub1_sub1_7.smallY[0], myPlayer.smallX[0], false, class30_sub2_sub4_sub1_sub1_7.smallX[0]);
  5122.                 crossX = super.saveClickX;
  5123.                 crossY = super.saveClickY;
  5124.                 crossType = 2;
  5125.                 crossIndex = 0;
  5126.                 if((i1 & 3) == 0)
  5127.                     anInt1155++;
  5128.                 if(anInt1155 >= 53)
  5129.                 {
  5130.                     stream.createFrame(85);
  5131.                     stream.writeWordBigEndian(66);
  5132.                     anInt1155 = 0;
  5133.                 }
  5134.                 stream.createFrame(18);
  5135.                 stream.method431(i1);
  5136.             }
  5137.         }
  5138.         if(l == 113)
  5139.         {
  5140.             method66(i1, k, j);
  5141.             stream.createFrame(70);
  5142.             stream.method431(j + baseX);
  5143.             stream.writeWord(k + baseY);
  5144.             stream.method433(i1 >> 14 & 0x7fff);
  5145.         }
  5146.         if(l == 872)
  5147.         {
  5148.             method66(i1, k, j);
  5149.             stream.createFrame(234);
  5150.             stream.method433(j + baseX);
  5151.             stream.method432(i1 >> 14 & 0x7fff);
  5152.             stream.method433(k + baseY);
  5153.         }
  5154.         if(l == 502)
  5155.         {
  5156.             method66(i1, k, j);
  5157.             stream.createFrame(132);
  5158.             stream.method433(j + baseX);
  5159.             stream.writeWord(i1 >> 14 & 0x7fff);
  5160.             stream.method432(k + baseY);
  5161.         }
  5162.         if(l == 1125)
  5163.         {
  5164.             ItemDef itemDef = ItemDef.forID(i1);
  5165.             RSInterface class9_4 = RSInterface.interfaceCache[k];
  5166.             String s5;
  5167.             if(class9_4 != null && class9_4.invStackSizes[j] >= 0x186a0)
  5168.                 s5 = class9_4.invStackSizes[j] + " x " + itemDef.name;
  5169.             else
  5170.             if(itemDef.description != null)
  5171.                 s5 = new String(itemDef.description);
  5172.             else
  5173.                 s5 = "It's a " + itemDef.name + " ModelId: " + itemDef.modelID + " .";
  5174.             pushMessage(s5, 0, "");
  5175.         }
  5176.         if(l == 169) {
  5177.             sendPacket185(k,-1,169);
  5178.         }
  5179.         if(l == 447)
  5180.         {
  5181.             itemSelected = 1;
  5182.             itemSlotUsedOn = j;
  5183.             anInt1284 = k;
  5184.             anInt1285 = i1;
  5185.             selectedItemName = ItemDef.forID(i1).name;
  5186.             spellSelected = 0;
  5187.             summoningAttack = false;
  5188.             needDrawTabArea = true;
  5189.             return;
  5190.         }
  5191.         if(l == 1226)
  5192.         {
  5193.             int j1 = i1 >> 14 & 0x7fff;
  5194.             ObjectDef class46 = ObjectDef.forID(j1);
  5195.             String s10;
  5196.             if(class46.description != null)
  5197.                 s10 = new String(class46.description);
  5198.             else
  5199.                 s10 = "It's a " + class46.name + ".";
  5200.             pushMessage(s10, 0, "");
  5201.         }
  5202.         if(l == 244)
  5203.         {
  5204.             boolean flag7 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k, myPlayer.smallX[0], false, j);
  5205.             if(!flag7)
  5206.                 flag7 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k, myPlayer.smallX[0], false, j);
  5207.             crossX = super.saveClickX;
  5208.             crossY = super.saveClickY;
  5209.             crossType = 2;
  5210.             crossIndex = 0;
  5211.             stream.createFrame(253);
  5212.             stream.method431(j + baseX);
  5213.             stream.method433(k + baseY);
  5214.             stream.method432(i1);
  5215.         }
  5216.         if(l == 1448)
  5217.         {
  5218.             ItemDef itemDef_1 = ItemDef.forID(i1);
  5219.             String s6;
  5220.             if(itemDef_1.description != null)
  5221.                 s6 = new String(itemDef_1.description);
  5222.             else
  5223.                 s6 = "It's a " + itemDef_1.name + ".";
  5224.             pushMessage(s6, 0, "");
  5225.         }
  5226.         itemSelected = 0;
  5227.         spellSelected = 0;
  5228.         needDrawTabArea = true;
  5229.  
  5230.     }
  5231.  
  5232.     private void method70()
  5233.     {
  5234.         anInt1251 = 0;
  5235.         int j = (myPlayer.x >> 7) + baseX;
  5236.         int k = (myPlayer.y >> 7) + baseY;
  5237.         if(j >= 3053 && j <= 3156 && k >= 3056 && k <= 3136)
  5238.             anInt1251 = 1;
  5239.         if(j >= 3072 && j <= 3118 && k >= 9492 && k <= 9535)
  5240.             anInt1251 = 1;
  5241.         if(anInt1251 == 1 && j >= 3139 && j <= 3199 && k >= 3008 && k <= 3062)
  5242.             anInt1251 = 0;
  5243.     }
  5244.  
  5245.     public void run() {
  5246.         if(drawFlames) {
  5247.             drawFlames();
  5248.         } else {
  5249.             super.run();
  5250.         }
  5251.     }
  5252.  
  5253.     private void build3dScreenMenu()
  5254.     {
  5255.         if(itemSelected == 0 && spellSelected == 0)
  5256.         {
  5257.             menuActionName[menuActionRow] = "Walk here";
  5258.             menuActionID[menuActionRow] = 516;
  5259.             menuActionCmd2[menuActionRow] = super.mouseX;
  5260.             menuActionCmd3[menuActionRow] = super.mouseY;
  5261.             menuActionRow++;
  5262.         }
  5263.         int j = -1;
  5264.         for(int k = 0; k < Model.anInt1687; k++)
  5265.         {
  5266.             int l = Model.anIntArray1688[k];
  5267.             int i1 = l & 0x7f;
  5268.             int j1 = l >> 7 & 0x7f;
  5269.             int k1 = l >> 29 & 3;
  5270.             int l1 = l >> 14 & 0x7fff;
  5271.             if(l == j)
  5272.                 continue;
  5273.             j = l;
  5274.             if(k1 == 2 && worldController.method304(plane, i1, j1, l) >= 0)
  5275.             {
  5276.                 ObjectDef class46 = ObjectDef.forID(l1);
  5277.                 if(class46.childrenIDs != null)
  5278.                     class46 = class46.method580();
  5279.                 if(class46 == null)
  5280.                     continue;
  5281.                 if(itemSelected == 1)
  5282.                 {
  5283.                     menuActionName[menuActionRow] = "Use " + selectedItemName + " with @cya@" + class46.name;
  5284.                     menuActionID[menuActionRow] = 62;
  5285.                     menuActionCmd1[menuActionRow] = l;
  5286.                     menuActionCmd2[menuActionRow] = i1;
  5287.                     menuActionCmd3[menuActionRow] = j1;
  5288.                     menuActionRow++;
  5289.                 } else
  5290.                 if(spellSelected == 1)
  5291.                 {
  5292.                     if((spellUsableOn & 4) == 4)
  5293.                     {
  5294.                         menuActionName[menuActionRow] = spellTooltip + " @cya@" + class46.name;
  5295.                         menuActionID[menuActionRow] = 956;
  5296.                         menuActionCmd1[menuActionRow] = l;
  5297.                         menuActionCmd2[menuActionRow] = i1;
  5298.                         menuActionCmd3[menuActionRow] = j1;
  5299.                         menuActionRow++;
  5300.                     }
  5301.                 } else
  5302.                 {
  5303.                     if(class46.itemActions != null)
  5304.                     {
  5305.                         for(int i2 = 4; i2 >= 0; i2--)
  5306.                             if(class46.itemActions[i2] != null)
  5307.                             {
  5308.                                 menuActionName[menuActionRow] = class46.itemActions[i2] + " @cya@" + class46.name;
  5309.                                 if(i2 == 0)
  5310.                                     menuActionID[menuActionRow] = 502;
  5311.                                 if(i2 == 1)
  5312.                                     menuActionID[menuActionRow] = 900;
  5313.                                 if(i2 == 2)
  5314.                                     menuActionID[menuActionRow] = 113;
  5315.                                 if(i2 == 3)
  5316.                                     menuActionID[menuActionRow] = 872;
  5317.                                 if(i2 == 4)
  5318.                                     menuActionID[menuActionRow] = 1062;
  5319.                                 menuActionCmd1[menuActionRow] = l;
  5320.                                 menuActionCmd2[menuActionRow] = i1;
  5321.                                 menuActionCmd3[menuActionRow] = j1;
  5322.                                 menuActionRow++;
  5323.                             }
  5324.  
  5325.                     }
  5326.                     menuActionName[menuActionRow] = "Examine @cya@" + class46.name + ((myPrivilege != 0) ? ", " + " @gre@(@whi@" + l1 + "@gre@) (@whi@" + (i1 + baseX) + "," + (j1 + baseY) + "@gre@)" : "");
  5327.                     menuActionID[menuActionRow] = 1226;
  5328.                     menuActionCmd1[menuActionRow] = class46.type << 14;
  5329.                     menuActionCmd2[menuActionRow] = i1;
  5330.                     menuActionCmd3[menuActionRow] = j1;
  5331.                     menuActionRow++;
  5332.                 }
  5333.             }
  5334.             if(k1 == 1)
  5335.             {
  5336.                 NPC npc = npcArray[l1];
  5337.                 if(npc.desc.aByte68 == 1 && (npc.x & 0x7f) == 64 && (npc.y & 0x7f) == 64)
  5338.                 {
  5339.                     for(int j2 = 0; j2 < npcCount; j2++)
  5340.                     {
  5341.                         NPC npc2 = npcArray[npcIndices[j2]];
  5342.                         if(npc2 != null && npc2 != npc && npc2.desc.aByte68 == 1 && npc2.x == npc.x && npc2.y == npc.y)
  5343.                             buildAtNPCMenu(npc2.desc, npcIndices[j2], j1, i1);
  5344.                     }
  5345.  
  5346.                     for(int l2 = 0; l2 < playerCount; l2++)
  5347.                     {
  5348.                         Player player = playerArray[playerIndices[l2]];
  5349.                         if(player != null && player.x == npc.x && player.y == npc.y)
  5350.                             buildAtPlayerMenu(i1, playerIndices[l2], player, j1);
  5351.                     }
  5352.  
  5353.                 }
  5354.                 buildAtNPCMenu(npc.desc, l1, j1, i1);
  5355.             }
  5356.             if(k1 == 0)
  5357.             {
  5358.                 Player player = playerArray[l1];
  5359.                 if((player.x & 0x7f) == 64 && (player.y & 0x7f) == 64)
  5360.                 {
  5361.                     for(int k2 = 0; k2 < npcCount; k2++)
  5362.                     {
  5363.                         NPC class30_sub2_sub4_sub1_sub1_2 = npcArray[npcIndices[k2]];
  5364.                         if(class30_sub2_sub4_sub1_sub1_2 != null && class30_sub2_sub4_sub1_sub1_2.desc.aByte68 == 1 && class30_sub2_sub4_sub1_sub1_2.x == player.x && class30_sub2_sub4_sub1_sub1_2.y == player.y)
  5365.                             buildAtNPCMenu(class30_sub2_sub4_sub1_sub1_2.desc, npcIndices[k2], j1, i1);
  5366.                     }
  5367.  
  5368.                     for(int i3 = 0; i3 < playerCount; i3++)
  5369.                     {
  5370.                         Player class30_sub2_sub4_sub1_sub2_2 = playerArray[playerIndices[i3]];
  5371.                         if(class30_sub2_sub4_sub1_sub2_2 != null && class30_sub2_sub4_sub1_sub2_2 != player && class30_sub2_sub4_sub1_sub2_2.x == player.x && class30_sub2_sub4_sub1_sub2_2.y == player.y)
  5372.                             buildAtPlayerMenu(i1, playerIndices[i3], class30_sub2_sub4_sub1_sub2_2, j1);
  5373.                     }
  5374.  
  5375.                 }
  5376.                 buildAtPlayerMenu(i1, l1, player, j1);
  5377.             }
  5378.             if(k1 == 3)
  5379.             {
  5380.                 NodeList class19 = groundArray[plane][i1][j1];
  5381.                 if(class19 != null)
  5382.                 {
  5383.                     for(Item item = (Item)class19.getFirst(); item != null; item = (Item)class19.getNext())
  5384.                     {
  5385.                         ItemDef itemDef = ItemDef.forID(item.ID);
  5386.                         if(itemSelected == 1)
  5387.                         {
  5388.                             menuActionName[menuActionRow] = "Use " + selectedItemName + " with @lre@" + itemDef.name;
  5389.                             menuActionID[menuActionRow] = 511;
  5390.                             menuActionCmd1[menuActionRow] = item.ID;
  5391.                             menuActionCmd2[menuActionRow] = i1;
  5392.                             menuActionCmd3[menuActionRow] = j1;
  5393.                             menuActionRow++;
  5394.                         } else
  5395.                         if(spellSelected == 1)
  5396.                         {
  5397.                             if((spellUsableOn & 1) == 1)
  5398.                             {
  5399.                                 menuActionName[menuActionRow] = spellTooltip + " @lre@" + itemDef.name;
  5400.                                 menuActionID[menuActionRow] = 94;
  5401.                                 menuActionCmd1[menuActionRow] = item.ID;
  5402.                                 menuActionCmd2[menuActionRow] = i1;
  5403.                                 menuActionCmd3[menuActionRow] = j1;
  5404.                                 menuActionRow++;
  5405.                             }
  5406.                         } else
  5407.                         {
  5408.                             for(int j3 = 4; j3 >= 0; j3--)
  5409.                                 if(itemDef.groundActions != null && itemDef.groundActions[j3] != null)
  5410.                                 {
  5411.                                     menuActionName[menuActionRow] = itemDef.groundActions[j3] + " @lre@" + itemDef.name;
  5412.                                     if(j3 == 0)
  5413.                                         menuActionID[menuActionRow] = 652;
  5414.                                     if(j3 == 1)
  5415.                                         menuActionID[menuActionRow] = 567;
  5416.                                     if(j3 == 2)
  5417.                                         menuActionID[menuActionRow] = 234;
  5418.                                     if(j3 == 3)
  5419.                                         menuActionID[menuActionRow] = 244;
  5420.                                     if(j3 == 4)
  5421.                                         menuActionID[menuActionRow] = 213;
  5422.                                     menuActionCmd1[menuActionRow] = item.ID;
  5423.                                     menuActionCmd2[menuActionRow] = i1;
  5424.                                     menuActionCmd3[menuActionRow] = j1;
  5425.                                     menuActionRow++;
  5426.                                 } else
  5427.                                 if(j3 == 2)
  5428.                                 {
  5429.                                     menuActionName[menuActionRow] = "Take @lre@" + itemDef.name;
  5430.                                     menuActionID[menuActionRow] = 234;
  5431.                                     menuActionCmd1[menuActionRow] = item.ID;
  5432.                                     menuActionCmd2[menuActionRow] = i1;
  5433.                                     menuActionCmd3[menuActionRow] = j1;
  5434.                                     menuActionRow++;
  5435.                                 }
  5436.  
  5437.                             menuActionName[menuActionRow] = "Examine @lre@" + itemDef.name + ((myPrivilege != 0) ? ", @gre@(@whi@" + item.ID + "@gre@)" : "");
  5438.                             menuActionID[menuActionRow] = 1448;
  5439.                             menuActionCmd1[menuActionRow] = item.ID;
  5440.                             menuActionCmd2[menuActionRow] = i1;
  5441.                             menuActionCmd3[menuActionRow] = j1;
  5442.                             menuActionRow++;
  5443.                         }
  5444.                     }
  5445.  
  5446.                 }
  5447.             }
  5448.         }
  5449.     }
  5450.  
  5451.     public void cleanUpForQuit()
  5452.     {
  5453.         HPBarFull = null;
  5454.         HPBarEmpty = null;
  5455.         signlink.reporterror = false;
  5456.         try
  5457.         {
  5458.             if(socketStream != null)
  5459.                 socketStream.close();
  5460.         }
  5461.         catch(Exception _ex) { }
  5462.         socketStream = null;
  5463.         stopMidi();
  5464.         if(mouseDetection != null)
  5465.             mouseDetection.running = false;
  5466.         mouseDetection = null;
  5467.         onDemandFetcher.disable();
  5468.         onDemandFetcher = null;
  5469.         aStream_834 = null;
  5470.         stream = null;
  5471.         aStream_847 = null;
  5472.         inStream = null;
  5473.         anIntArray1234 = null;
  5474.         aByteArrayArray1183 = null;
  5475.         aByteArrayArray1247 = null;
  5476.         anIntArray1235 = null;
  5477.         anIntArray1236 = null;
  5478.         intGroundArray = null;
  5479.         byteGroundArray = null;
  5480.         worldController = null;
  5481.         aClass11Array1230 = null;
  5482.         anIntArrayArray901 = null;
  5483.         anIntArrayArray825 = null;
  5484.         bigX = null;
  5485.         bigY = null;
  5486.         aByteArray912 = null;
  5487.         sideTabArea = null;
  5488.         mapEdgeIP = null;
  5489.         leftFrame = null;
  5490.         topFrame = null;
  5491.         rightFrame = null;
  5492.         mapBackImage = null;
  5493.         main3DArea = null;
  5494.         chatBackImage = null;
  5495.         aRSImageProducer_1123 = null;
  5496.         aRSImageProducer_1124 = null;
  5497.         aRSImageProducer_1125 = null;
  5498.         /* Null pointers for custom sprites */
  5499.         backgroundFix = null;
  5500.         loadingBarFull = null;
  5501.         loadingBarEmpty = null;
  5502.                 alertBack = null;
  5503.         alertBorder = null;
  5504.         alertBorderH = null;
  5505.         chatArea = null;
  5506.         chatButtons = null;
  5507.         tabArea = null;
  5508.         mapArea = null;
  5509.         magicAuto = null;
  5510.         /**/
  5511.         emptyOrb = null;
  5512.         emptyFOrb = null;
  5513.         hoveredEmpty = null;
  5514.         hoveredFEmpty = null;
  5515.         runIcon1 = null;
  5516.         runIcon2 = null;
  5517.         runOrb1 = null;
  5518.         runOrb2 = null;
  5519.         hitPointsFill = null;
  5520.         hitPointsIcon = null;
  5521.         prayerFill = null;
  5522.         prayerIcon = null;
  5523.         sideIcons = null;
  5524.         compass = null;
  5525.         headIcons = null;
  5526.         cursesIcons = null;
  5527.         skullIcons = null;
  5528.         headIconsHint = null;
  5529.         crosses = null;
  5530.         mapDotItem = null;
  5531.         mapDotNPC = null;
  5532.         mapDotPlayer = null;
  5533.         mapDotFriend = null;
  5534.         mapDotTeam = null;
  5535.         mapScenes = null;
  5536.         mapFunctions = null;
  5537.         anIntArrayArray929 = null;
  5538.         playerArray = null;
  5539.         playerIndices = null;
  5540.         anIntArray894 = null;
  5541.         aStreamArray895s = null;
  5542.         anIntArray840 = null;
  5543.         npcArray = null;
  5544.         npcIndices = null;
  5545.         groundArray = null;
  5546.         aClass19_1179 = null;
  5547.         aClass19_1013 = null;
  5548.         aClass19_1056 = null;
  5549.         menuActionCmd2 = null;
  5550.         menuActionCmd3 = null;
  5551.         menuActionID = null;
  5552.         menuActionCmd1 = null;
  5553.         menuActionName = null;
  5554.         variousSettings = null;
  5555.         mapFunctionX = null;
  5556.         mapFunctionY = null;
  5557.         currentMapFunctions = null;
  5558.         miniMapImage = null;
  5559.         friendsList = null;
  5560.         friendsListAsLongs = null;
  5561.         friendsNodeIDs = null;
  5562.         aRSImageProducer_1110 = null;
  5563.         aRSImageProducer_1111 = null;
  5564.         aRSImageProducer_1107 = null;
  5565.         aRSImageProducer_1108 = null;
  5566.         aRSImageProducer_1109 = null;
  5567.         aRSImageProducer_1112 = null;
  5568.         aRSImageProducer_1113 = null;
  5569.         aRSImageProducer_1114 = null;
  5570.         aRSImageProducer_1115 = null;
  5571.         multiOverlay = null;
  5572.         nullLoader();
  5573.         ObjectDef.nullLoader();
  5574.         EntityDef.nullLoader();
  5575.         ItemDef.nullLoader();
  5576.         Flo.cache = null;
  5577.         IDK.cache = null;
  5578.         RSInterface.interfaceCache = null;
  5579.         DummyClass.cache = null;
  5580.         Animation.anims = null;
  5581.         SpotAnim.cache = null;
  5582.         SpotAnim.aMRUNodes_415 = null;
  5583.         Varp.cache = null;
  5584.         super.fullGameScreen = null;
  5585.         Player.mruNodes = null;
  5586.         Texture.nullLoader();
  5587.         WorldController.nullLoader();
  5588.         Model.nullLoader();
  5589.         Class36.nullLoader();
  5590.         System.gc();
  5591.     }
  5592.     public boolean openBOX = false;
  5593.     public String donatorPayment = "";
  5594.     private void printDebug()
  5595.     {
  5596.         System.out.println("============");
  5597.         System.out.println("flame-cycle:" + anInt1208);
  5598.         if(onDemandFetcher != null)
  5599.             System.out.println("Od-cycle:" + onDemandFetcher.onDemandCycle);
  5600.         System.out.println("loop-cycle:" + loopCycle);
  5601.         System.out.println("draw-cycle:" + anInt1061);
  5602.         System.out.println("ptype:" + pktType);
  5603.         System.out.println("psize:" + pktSize);
  5604.         if(socketStream != null)
  5605.             socketStream.printDebug();
  5606.         super.shouldDebug = true;
  5607.     }
  5608.  
  5609.     Component getGameComponent() {
  5610.         if(signlink.mainapp != null)
  5611.             return signlink.mainapp;
  5612.         if(super.gameFrame != null)
  5613.             return super.gameFrame;
  5614.         else
  5615.             return this;
  5616.     }
  5617.  
  5618.     private void method73() {
  5619.         do {
  5620.             int j = readCharacter();
  5621.             if(j == -1)
  5622.                 break;
  5623.             if(openInterfaceID != -1 && openInterfaceID == 22595) {//newPasswordString
  5624.                 boolean flag1 = false;
  5625.                 for(int i2 = 0; i2 < validUserPassChars.length(); i2++) {
  5626.                     if(j != validUserPassChars.charAt(i2))
  5627.                         continue;
  5628.                     flag1 = true;
  5629.                     break;
  5630.                 }
  5631.  
  5632.                 if(j == 8 && newPasswordString.length() > 0) {
  5633.                     newPasswordString = newPasswordString.substring(0, newPasswordString.length() - 1);
  5634.                     sendFrame126("Password Strength: " + strengthCheck(newPasswordString),22601);
  5635.                 }
  5636.                 if(flag1  && newPasswordString.length() < 20) {
  5637.                     newPasswordString += (char)j;
  5638.                     newPasswordString = newPasswordString.toLowerCase();
  5639.                     sendFrame126("Password Strength: " + strengthCheck(newPasswordString),22601);
  5640.                 }
  5641.                 if(newPasswordString.length() > 20)
  5642.                     newPasswordString = newPasswordString.substring(0, 20);
  5643.                 if(j == 13 || j == 10)
  5644.                     changePasswordSubmit();
  5645.             } else if(openInterfaceID != -1 && openInterfaceID == reportAbuseInterfaceID) {
  5646.                 if(j == 8 && reportAbuseInput.length() > 0)
  5647.                     reportAbuseInput = reportAbuseInput.substring(0, reportAbuseInput.length() - 1);
  5648.                 if((j >= 97 && j <= 122 || j >= 65 && j <= 90 || j >= 48 && j <= 57 || j == 32) && reportAbuseInput.length() < 12)
  5649.                     reportAbuseInput += (char)j;
  5650.             } else if(messagePromptRaised) {
  5651.                 if(j >= 32 && j <= 122 && promptInput.length() < 80) {
  5652.                     promptInput += (char)j;
  5653.                     inputTaken = true;
  5654.                 }
  5655.                 if(j == 8 && promptInput.length() > 0) {
  5656.                     promptInput = promptInput.substring(0, promptInput.length() - 1);
  5657.                     inputTaken = true;
  5658.                 }
  5659.                 if(j == 13 || j == 10) {
  5660.                     messagePromptRaised = false;
  5661.                     inputTaken = true;
  5662.                     if(friendsListAction == 1) {
  5663.                         long l = TextClass.longForName(promptInput);
  5664.                         addFriend(l);
  5665.                     }
  5666.                     if(friendsListAction == 2 && friendsCount > 0) {
  5667.                         long l1 = TextClass.longForName(promptInput);
  5668.                         delFriend(l1);
  5669.                     }
  5670.                     if(friendsListAction == 3 && promptInput.length() > 0) {
  5671.                         stream.createFrame(126);
  5672.                         stream.writeWordBigEndian(0);
  5673.                         int k = stream.currentOffset;
  5674.                         stream.writeQWord(aLong953);
  5675.                         TextInput.method526(promptInput, stream);
  5676.                         stream.writeBytes(stream.currentOffset - k);
  5677.                         promptInput = TextInput.processText(promptInput);
  5678.                         //promptInput = Censor.doCensor(promptInput);
  5679.                         pushMessage(promptInput, 6, TextClass.fixName(TextClass.nameForLong(aLong953)));
  5680.                         if(privateChatMode == 2) {
  5681.                             privateChatMode = 1;
  5682.                             aBoolean1233 = true;
  5683.                             stream.createFrame(95);
  5684.                             stream.writeWordBigEndian(publicChatMode);
  5685.                             stream.writeWordBigEndian(privateChatMode);
  5686.                             stream.writeWordBigEndian(tradeMode);
  5687.                         }
  5688.                     }
  5689.                     if(friendsListAction == 4 && ignoreCount < 100) {
  5690.                         long l2 = TextClass.longForName(promptInput);
  5691.                         addIgnore(l2);
  5692.                     }
  5693.                     if(friendsListAction == 5 && ignoreCount > 0) {
  5694.                         long l3 = TextClass.longForName(promptInput);
  5695.                         delIgnore(l3);
  5696.                     }
  5697.                     if(friendsListAction == 6) {
  5698.                         long l3 = TextClass.longForName(promptInput);
  5699.                         chatJoin(l3);
  5700.                     }
  5701.                 }
  5702.             } else if(inputDialogState == 1) {
  5703.                 j = (int)Character.toLowerCase((char)j);
  5704.                 String s = "" + (char)j;
  5705.                 if((amountOrNameInput.matches("(\\d+)?") && s.matches("[\\dkmb]")) || amountOrNameInput.matches("\\d+[kmb]") && amountOrNameInput.matches("\\d")) {
  5706.                     amountOrNameInput += (char)j;
  5707.                     inputTaken = true;
  5708.                 }
  5709.                 if(j == 8 && amountOrNameInput.length() > 0) {//delete
  5710.                     amountOrNameInput = amountOrNameInput.substring(0, amountOrNameInput.length() - 1);
  5711.                     inputTaken = true;
  5712.                 }
  5713.                 if(j == 13 || j == 10) {//enter
  5714.                     if(amountOrNameInput.length() > 0) {
  5715.                         int amount = 0;
  5716.                         int multiplier = 0;
  5717.                         for(int i = 0; i < amountOrNameInput.length(); i++) {
  5718.                             if(amountOrNameInput.charAt(i) == 'k')
  5719.                                 multiplier = 1000;
  5720.                             else if(amountOrNameInput.charAt(i) == 'm')
  5721.                                 multiplier = 1000000;
  5722.                             else if(amountOrNameInput.charAt(i) == 'b')
  5723.                                 multiplier = 1000000000;
  5724.                             if(multiplier != 0)
  5725.                                 break;
  5726.                         }
  5727.                         System.out.println("amount: " + amount + " , amountOrNameInput: "+ amountOrNameInput);
  5728.                         try {
  5729.                             if(multiplier != 0) {
  5730.                                 if(multiplier == 1000000000 && Integer.parseInt(amountOrNameInput.replaceAll("[^0-9]", "")) >= 3)
  5731.                                     amount = Integer.parseInt("2147") * multiplier;
  5732.                                 else
  5733.                                     amount = Integer.parseInt(amountOrNameInput.replaceAll("[^0-9]", "")) * multiplier;
  5734.                             } else
  5735.                                 amount = Integer.parseInt(amountOrNameInput);
  5736.                         } catch(Exception _ex) {
  5737.                            
  5738.                         }
  5739.                         System.out.println("2amount: " + amount + " , amountOrNameInput: "+ amountOrNameInput);
  5740.                         stream.createFrame(208);
  5741.                         stream.writeDWord(amount);
  5742.                     }
  5743.                     inputDialogState = 0;
  5744.                     inputTaken = true;
  5745.                 }
  5746.             } else if(inputDialogState == 2) {
  5747.                 if(j >= 32 && j <= 122 && amountOrNameInput.length() < 12) {
  5748.                     amountOrNameInput += (char)j;
  5749.                     inputTaken = true;
  5750.                 }
  5751.                 if(j == 8 && amountOrNameInput.length() > 0) {
  5752.                     amountOrNameInput = amountOrNameInput.substring(0, amountOrNameInput.length() - 1);
  5753.                     inputTaken = true;
  5754.                 }
  5755.                 if(j == 13 || j == 10) {
  5756.                     if(amountOrNameInput.length() > 0) {
  5757.                         stream.createFrame(60);
  5758.                         stream.writeQWord(TextClass.longForName(amountOrNameInput));
  5759.                     }
  5760.                     inputDialogState = 0;
  5761.                     inputTaken = true;
  5762.                 }
  5763.             } else if(backDialogID == -1) {
  5764.                 if(j >= 32 && j <= 122 && inputString.length() < 80) {
  5765.                     inputString += (char)j;
  5766.                     inputTaken = true;
  5767.                 }
  5768.                 if(j == 8 && inputString.length() > 0) {
  5769.                     inputString = inputString.substring(0, inputString.length() - 1);
  5770.                     inputTaken = true;
  5771.                 }
  5772.                 if((j == 13 || j == 10) && inputString.length() > 0) {
  5773.                     if(inputString.startsWith("::interface")&& myPrivilege == 2) {
  5774.                         try {
  5775.                             String[] args = inputString.split(" ");
  5776.                             pushMessage("Opening interface " + args[1] + ".",0,"");
  5777.                             openInterfaceID = Integer.parseInt(args[1]);
  5778.                             //invOverlayInterfaceID = Integer.parseInt(args[1]);
  5779.                         } catch(ArrayIndexOutOfBoundsException ex) {
  5780.                             pushMessage("please use as ::interface ID.",0,"");
  5781.                         }
  5782.                     }
  5783.                     if(inputString.startsWith("::walkable")) {
  5784.                         try {
  5785.                             String[] args = inputString.split(" ");
  5786.                             pushMessage("Opening interface " + args[1] + ".",0,"");
  5787.                             walkableInterfaceID = Integer.parseInt(args[1]);
  5788.                         } catch(ArrayIndexOutOfBoundsException ex) {
  5789.                             pushMessage("please use as ::interface ID.",0,"");
  5790.                         }
  5791.                     }
  5792.                                             if(inputString.equals("::donate")){
  5793.                             launchURL("insanity");
  5794.                         }
  5795.                         if(inputString.equals("::vote4cash")) {
  5796.                             launchURL("http://www.runelocus.com/toplist/vote-16537.html");
  5797.                         }
  5798.                                                 if(inputString.equals("::forums")) {
  5799.                             launchURL("http://lui-scape.forumotion.com/");
  5800.                         }
  5801.                         if(inputString.equals("::forum")) {
  5802.                             launchURL("http://lui-scape.forumotion.com/");
  5803.                         }
  5804.                                                 if(inputString.equals("::site")) {
  5805.                             launchURL("http://lui-scape.forumotion.com/");
  5806.                         }
  5807.                                                 if(inputString.equals("::donat")) {
  5808.                             launchURL("http://www.Insanity");
  5809.                         }
  5810.                         if(inputString.equals("::vote")) {
  5811.                             launchURL("http://www.runelocus.com/toplist/vote-16537.html");
  5812.                         }
  5813.                         if(inputString.equals("::vot")) {
  5814.                             launchURL("http://www.runelocus.com/toplist/vote-16537.html");
  5815.                         }
  5816.                         if(inputString.equals("::votee")) {
  5817.                             launchURL("http://www.runelocus.com/toplist/vote-16537.html");
  5818.                         }
  5819.                         if(inputString.equals("::VOTE")) {
  5820.                             launchURL("http://www.runelocus.com/toplist/vote-16537.html");
  5821.                         }
  5822.                                                 if(inputString.equals("::register")) {
  5823.                             launchURL("http://lui-scape.forumotion.com/");
  5824.                         }
  5825.                                                 if(inputString.equals("::sub")) {
  5826.                             launchURL("http://www.youtube.com/user/1luiscape");
  5827.                         }
  5828.                                                 if(inputString.equals("::subscribe")) {
  5829.                             launchURL("http://www.youtube.com/user/1luiscape");
  5830.                         }
  5831.                    
  5832.                     if(inputString.startsWith("::back")) {
  5833.                         try {
  5834.                             String[] args = inputString.split(" ");
  5835.                             pushMessage("Opening interface " + args[1] + ".",0,"");
  5836.                             backDialogID = Integer.parseInt(args[1]);
  5837.                         } catch(ArrayIndexOutOfBoundsException ex) {
  5838.                             pushMessage("please use as ::interface ID.",0,"");
  5839.                         }
  5840.                     }
  5841.                     if(myPrivilege == 2 || serverip.equals("127.0.0.1") || 1 == 1/*to remove*/) {
  5842.                         if(inputString.startsWith("//setspecto")) {
  5843.                             int amt = Integer.parseInt(inputString.substring(12));
  5844.                             anIntArray1045[300] = amt;
  5845.                             if(variousSettings[300] != amt) {
  5846.                                 variousSettings[300] = amt;
  5847.                                 method33(300);
  5848.                                 needDrawTabArea = true;
  5849.                                 if(dialogID != -1)
  5850.                                     inputTaken = true;
  5851.                             }
  5852.                         }
  5853.                         if (inputString.startsWith("::swat"))
  5854.                         {
  5855.                             for(int i = 12535; i < 20072; i++)
  5856.                             {
  5857.                                 System.out.println("i:"+i);
  5858.                                 ItemDef.forID(i);
  5859.                             }
  5860.                             for(int i = 0; i < 20072; i++)
  5861.                             {
  5862.                                 System.out.println("e:"+i);
  5863.                                 EntityDef.forID(i);
  5864.                             }
  5865.                         }
  5866.                        
  5867.                         if(inputString.equals("clientdrop") && myPrivilege == 2)
  5868.                             dropClient();
  5869.                         if(inputString.equals("::lag") && myPrivilege == 2)
  5870.                             printDebug();
  5871.                         if(inputString.equals("::prefetchmusic") && myPrivilege == 2) {
  5872.                             for(int j1 = 0; j1 < onDemandFetcher.getVersionCount(2); j1++)
  5873.                                 onDemandFetcher.method563((byte)1, 2, j1);
  5874.  
  5875.                         }
  5876.                         if(inputString.equals("::fpson") && myPrivilege == 2)
  5877.                             fpsOn = true;
  5878.                         if(inputString.equals("::fpsoff") && myPrivilege == 2)
  5879.                             fpsOn = false;
  5880.                         if(inputString.equals("::dataon") && myPrivilege == 2)
  5881.                             clientData = true;
  5882.                         if(inputString.equals("::dataoff") && myPrivilege == 2)
  5883.                             clientData = false;
  5884.                         if(inputString.equals("::noclip") && myPrivilege == 2) {
  5885.                             for(int k1 = 0; k1 < 4; k1++) {
  5886.                                 for(int i2 = 1; i2 < 103; i2++) {
  5887.                                     for(int k2 = 1; k2 < 103; k2++)
  5888.                                         aClass11Array1230[k1].anIntArrayArray294[i2][k2] = 0;
  5889.  
  5890.                                 }
  5891.                             }
  5892.                         }
  5893.                         if(inputString.equals("::lala")) {
  5894.                             for(int k1 = 0; k1 < 4; k1++) {
  5895.                                 for(int i2 = 1; i2 < 103; i2++) {
  5896.                                     for(int k2 = 1; k2 < 103; k2++)
  5897.                                         aClass11Array1230[k1].anIntArrayArray294[i2][k2] = 0;
  5898.  
  5899.                                 }
  5900.                             }
  5901.                         }
  5902.                         if(inputString.equalsIgnoreCase("::tabs")) {
  5903.                             if(functionKeys) {
  5904.                                 functionKeys = false;
  5905.                                 pushMessage("You are now using the new tab system!", 0, "");
  5906.                                 pushMessage("F1 - Inventory F2 - Equipment F3 - Prayer F4 - Mage F5 - Combat", 0, "");
  5907.                             } else {
  5908.                                 functionKeys = true;
  5909.                                 pushMessage("You are now using the old tab system!", 0, "");
  5910.                                 pushMessage("F1 - Combat F2 - Skills F3 - Quest F4 - Inventory F5 - Equipment", 0, "");
  5911.                                 pushMessage("F6 - Prayer F7 - Mage F8 - Clan F9 - Friend F10 - Ignore ", 0, "");
  5912.                             }
  5913.                         }
  5914.                         if(inputString.equalsIgnoreCase("::hits")) {
  5915.                             if(newDamage) {
  5916.                                 newDamage = false;
  5917.                                 pushMessage("Old school hits activated", 0, "");
  5918.                             } else {
  5919.                                 newDamage = true;
  5920.                                 pushMessage("Newer hits activated", 0, "");
  5921.                             }
  5922.                         }
  5923.                         //if(inputString.equalsIgnoreCase("::hits")) {
  5924.                            
  5925.                                
  5926.                         if(inputString.equals("::dump")) {
  5927.                             for(int k1 = 0; k1 < 40000; k1++) {
  5928.                             System.out.println(""+k1);
  5929.                                 ItemDef.forID(k1);
  5930.                             }
  5931.                             for(int k1 = 0; k1 < 6000; k1++) {
  5932.                             System.out.println(""+k1);
  5933.                                 EntityDef.forID(k1);
  5934.                             }
  5935.                         }
  5936.                    
  5937.                     }
  5938.                    
  5939.                     if(inputString.startsWith("/"))
  5940.                         inputString = "::" + inputString;
  5941.                     if(inputString.equals("add model")) {
  5942.                         try {
  5943.                             int ModelIndex = Integer.parseInt(JOptionPane.showInputDialog(this, "Enter model ID", "Model", 3));
  5944.                             byte[] abyte0 = getModel(ModelIndex);
  5945.                             if(abyte0 != null && abyte0.length > 0) {
  5946.                                 decompressors[1].method234(abyte0.length, abyte0, ModelIndex);
  5947.                                 pushMessage("Model: [" + ModelIndex + "] added successfully!", 0, "");
  5948.                             } else {
  5949.                                 pushMessage("Unable to find the model. "+ModelIndex, 0, "");
  5950.                             }
  5951.                         } catch(Exception e) {
  5952.                             pushMessage("Syntax - ::add model <path>", 0, "");
  5953.                         }
  5954.                     }
  5955.                     if(inputString.startsWith("::getcode"))
  5956.                         inputString = "::getcode "+donatorPayment;
  5957.                     if(inputString.startsWith("::setcode"))
  5958.                         openBOX = true;
  5959.                     else
  5960.                     if(inputString.startsWith("::")) {
  5961.                         if(inputString.startsWith("::changepassword")) {
  5962.                             try {
  5963.                                 String arg = inputString.substring(17);
  5964.                                 newPasswordString = (inputString.length() > 17) ? arg : "";
  5965.                             } catch (StringIndexOutOfBoundsException ex) {
  5966.                                 newPasswordString = "";
  5967.                             }
  5968.                             openInterfaceID = 22595;
  5969.                             sendFrame126("Password Strength: " + strengthCheck(newPasswordString),22601);
  5970.                             pushMessage("Type your new password, be sure to not make spelling mistakes.", 0, "");
  5971.                         } else {
  5972.                             stream.createFrame(103);
  5973.                             stream.writeWordBigEndian(inputString.length() - 1);
  5974.                             stream.writeString(inputString.substring(2));
  5975.                         }
  5976.                     } else {
  5977.                         String s = inputString.toLowerCase();  
  5978.                         int j2 = 0;
  5979.                         if(s.startsWith("yellow:"))
  5980.                         {
  5981.                             j2 = 0;
  5982.                             inputString = inputString.substring(7);
  5983.                         } else if(s.startsWith("red:"))
  5984.                         {
  5985.                             j2 = 1;
  5986.                             inputString = inputString.substring(4);
  5987.                         } else if(s.startsWith("green:"))
  5988.                         {
  5989.                             j2 = 2;
  5990.                             inputString = inputString.substring(6);
  5991.                         } else if(s.startsWith("cyan:"))
  5992.                         {
  5993.                             j2 = 3;
  5994.                             inputString = inputString.substring(5);
  5995.                         } else if(s.startsWith("purple:"))
  5996.                         {
  5997.                             j2 = 4;
  5998.                             inputString = inputString.substring(7);
  5999.                         } else if(s.startsWith("white:"))
  6000.                         {
  6001.                             j2 = 5;
  6002.                             inputString = inputString.substring(6);
  6003.                         } else if(s.startsWith("flash1:"))
  6004.                         {
  6005.                             j2 = 6;
  6006.                             inputString = inputString.substring(7);
  6007.                         } else if(s.startsWith("flash2:"))
  6008.                         {
  6009.                             j2 = 7;
  6010.                             inputString = inputString.substring(7);
  6011.                         } else if(s.startsWith("flash3:"))
  6012.                         {
  6013.                             j2 = 8;
  6014.                             inputString = inputString.substring(7);
  6015.                         } else if(s.startsWith("glow1:"))
  6016.                         {
  6017.                             j2 = 9;
  6018.                             inputString = inputString.substring(6);
  6019.                         } else if(s.startsWith("glow2:"))
  6020.                         {
  6021.                             j2 = 10;
  6022.                             inputString = inputString.substring(6);
  6023.                         } else if(s.startsWith("glow3:"))
  6024.                         {
  6025.                             j2 = 11;
  6026.                             inputString = inputString.substring(6);
  6027.                         }
  6028.                         s = inputString.toLowerCase();
  6029.                         int i3 = 0;
  6030.                         if(s.startsWith("wave:"))
  6031.                         {
  6032.                             i3 = 1;
  6033.                             inputString = inputString.substring(5);
  6034.                         } else if(s.startsWith("wave2:"))
  6035.                         {
  6036.                             i3 = 2;
  6037.                             inputString = inputString.substring(6);
  6038.                         } else if(s.startsWith("shake:"))
  6039.                         {
  6040.                             i3 = 3;
  6041.                             inputString = inputString.substring(6);
  6042.                         } else if(s.startsWith("scroll:"))
  6043.                         {
  6044.                             i3 = 4;
  6045.                             inputString = inputString.substring(7);
  6046.                         } else if(s.startsWith("slide:"))
  6047.                         {
  6048.                             i3 = 5;
  6049.                             inputString = inputString.substring(6);
  6050.                         }
  6051.                         stream.createFrame(4);
  6052.                         stream.writeWordBigEndian(0);
  6053.                         int j3 = stream.currentOffset;
  6054.                         stream.method425(i3);
  6055.                         stream.method425(j2);
  6056.                         aStream_834.currentOffset = 0;
  6057.                         TextInput.method526(inputString, aStream_834);
  6058.                         stream.method441(0, aStream_834.buffer, aStream_834.currentOffset);
  6059.                         stream.writeBytes(stream.currentOffset - j3);
  6060.                         inputString = TextInput.processText(inputString);
  6061.                         //inputString = Censor.doCensor(inputString);
  6062.                         myPlayer.textSpoken = inputString;
  6063.                         myPlayer.anInt1513 = j2;
  6064.                         myPlayer.anInt1531 = i3;
  6065.                         myPlayer.textCycle = 150;
  6066.                         if(myPrivilege != 0 && myPrivilege <= modIcons.length)
  6067.                             pushMessage(myPlayer.textSpoken, 2, "@cr" + myPrivilege + "@" + myPlayer.name);
  6068.                         else
  6069.                             pushMessage(myPlayer.textSpoken, 2, myPlayer.name);
  6070.                         if(publicChatMode == 2)
  6071.                         {
  6072.                             publicChatMode = 3;
  6073.                             aBoolean1233 = true;
  6074.                             stream.createFrame(95);
  6075.                             stream.writeWordBigEndian(publicChatMode);
  6076.                             stream.writeWordBigEndian(privateChatMode);
  6077.                             stream.writeWordBigEndian(tradeMode);
  6078.                         }
  6079.                     }
  6080.                     inputString = "";
  6081.                     inputTaken = true;
  6082.                 }
  6083.             }
  6084.         } while(true);
  6085.     }
  6086.     public static boolean functionKeys = true;
  6087.     public static boolean healthBars = true;
  6088.     public static boolean newDamage = true;
  6089.    
  6090.     private void buildPublicChat(int j)
  6091.     {
  6092.         int l = 0;
  6093.         for(int i1 = 0; i1 < 500; i1++)
  6094.         {
  6095.             if(chatMessages[i1] == null)
  6096.                 continue;
  6097.             if(chatTypeView != 1)
  6098.                 continue;
  6099.             int j1 = chatTypes[i1];
  6100.             String s = chatNames[i1];
  6101.             String ct = chatMessages[i1];
  6102.             int k1 = (70 - l * 14 + 42) + anInt1089 + 4 + 5;
  6103.             if(k1 < -23)
  6104.                 break;
  6105.             if(s != null && s.startsWith("@cr")) {
  6106.                 String rightID = s.substring(3,4);
  6107.                 s = s.substring(5);
  6108.             }
  6109.             if((j1 == 1 || j1 == 2) && (j1 == 1 || publicChatMode == 0 || publicChatMode == 1 && isFriendOrSelf(s))) {
  6110.             if(j > k1 - 14 && j <= k1 && !s.equals(myPlayer.name)) {
  6111.                 if(myPrivilege >= 1) {
  6112.                     menuActionName[menuActionRow] = "Report abuse @whi@" + s;
  6113.                     menuActionID[menuActionRow] = 606;
  6114.                     menuActionRow++;
  6115.                 }
  6116.                 menuActionName[menuActionRow] = "Add ignore @whi@" + s;
  6117.                 menuActionID[menuActionRow] = 42;
  6118.                 menuActionRow++;
  6119.                 menuActionName[menuActionRow] = "Add friend @whi@" + s;
  6120.                 menuActionID[menuActionRow] = 337;
  6121.                 menuActionRow++;
  6122.             }
  6123.             l++;
  6124.             }
  6125.         }
  6126.     }
  6127.  
  6128.     private void buildFriendChat(int j)
  6129.     {
  6130.         int l = 0;
  6131.         for(int i1 = 0; i1 < 500; i1++) {
  6132.             if(chatMessages[i1] == null)
  6133.                 continue;
  6134.             if(chatTypeView != 2)
  6135.                 continue;
  6136.             int j1 = chatTypes[i1];
  6137.             String s = chatNames[i1];
  6138.             String ct = chatMessages[i1];
  6139.             int k1 = (70 - l * 14 + 42) + anInt1089 + 4 + 5;
  6140.             if(k1 < -23)
  6141.                 break;
  6142.             if(s != null && s.startsWith("@cr")) {
  6143.                 String rightID = s.substring(3,4);
  6144.                 s = s.substring(5);
  6145.             }
  6146.             if((j1 == 5 || j1 == 6) && (splitPrivateChat == 0 || chatTypeView == 2) && (j1 == 6 || privateChatMode == 0 || privateChatMode == 1 && isFriendOrSelf(s)))
  6147.                 l++;
  6148.             if((j1 == 3 || j1 == 7) && (splitPrivateChat == 0 || chatTypeView == 2) && (j1 == 7 || privateChatMode == 0 || privateChatMode == 1 && isFriendOrSelf(s)))
  6149.             {
  6150.                 if(j > k1 - 14 && j <= k1) {
  6151.                     if(myPrivilege >= 1) {
  6152.                         menuActionName[menuActionRow] = "Report abuse @whi@" + s;
  6153.                         menuActionID[menuActionRow] = 606;
  6154.                         menuActionRow++;
  6155.                     }
  6156.                     menuActionName[menuActionRow] = "Add ignore @whi@" + s;
  6157.                     menuActionID[menuActionRow] = 42;
  6158.                     menuActionRow++;
  6159.                     menuActionName[menuActionRow] = "Add friend @whi@" + s;
  6160.                     menuActionID[menuActionRow] = 337;
  6161.                     menuActionRow++;
  6162.                 }
  6163.             l++;
  6164.             }
  6165.         }
  6166.     }
  6167.  
  6168.     private void buildDuelorTrade(int j) {
  6169.         int l = 0;
  6170.         for(int i1 = 0; i1 < 500; i1++) {
  6171.             if(chatMessages[i1] == null)
  6172.                 continue;
  6173.             if(chatTypeView != 3 && chatTypeView != 4)
  6174.                 continue;
  6175.             int j1 = chatTypes[i1];
  6176.             String s = chatNames[i1];
  6177.             int k1 = (70 - l * 14 + 42) + anInt1089 + 4 + 5;
  6178.             if(k1 < -23)
  6179.                 break;
  6180.             if(s != null && s.startsWith("@cr")) {
  6181.                 String rightID = s.substring(3,4);
  6182.                 s = s.substring(5);
  6183.             }
  6184.             if(chatTypeView == 3 && j1 == 4 && (tradeMode == 0 || tradeMode == 1 && isFriendOrSelf(s))) {
  6185.                 if(j > k1 - 14 && j <= k1) {
  6186.                     menuActionName[menuActionRow] = "Accept trade @whi@" + s;
  6187.                     menuActionID[menuActionRow] = 484;
  6188.                     menuActionRow++;
  6189.                 }
  6190.                 l++;
  6191.             }
  6192.             if(j1 == 9)
  6193.             {
  6194.                 if(j > k1 - 14 && j <= k1)
  6195.                 {
  6196.                     String displayLink = ((s.length() > 30) ? (s.substring(0,25) + "...") : (s));
  6197.                     menuActionName[menuActionRow] = "Open page: " + displayLink;
  6198.                     menuActionID[menuActionRow] = 485;
  6199.                     menuActionRow++;
  6200.                     linkInText = s;
  6201.                 }
  6202.                 l++;
  6203.             }
  6204.            
  6205.             if(chatTypeView == 4 && j1 == 8 && (tradeMode == 0 || tradeMode == 1 && isFriendOrSelf(s))) {
  6206.                 if(j > k1 - 14 && j <= k1) {
  6207.                     menuActionName[menuActionRow] = "Accept challenge @whi@" + s;
  6208.                     menuActionID[menuActionRow] = 6;
  6209.                     menuActionRow++;
  6210.                 }
  6211.                 l++;
  6212.             }
  6213.             if(j1 == 12) {
  6214.                 if(j > k1 - 14 && j <= k1) {
  6215.                     menuActionName[menuActionRow] = "Go-to @blu@" + s;
  6216.                     menuActionID[menuActionRow] = 915;
  6217.                     menuActionRow++;
  6218.                 }
  6219.                 l++;
  6220.             }
  6221.         }
  6222.     }
  6223.  
  6224.     private void buildChatAreaMenu(int paddingY) {
  6225.         int totalLines = 0;
  6226.         int test = 0;
  6227.         for(int typeIndex = 0; typeIndex < 500; typeIndex++) {
  6228.             if(chatMessages[typeIndex] == null)
  6229.                 continue;
  6230.             int chatType = chatTypes[typeIndex];
  6231.             int scrollYPos = (70 - totalLines * 14 + 42) + anInt1089 + 4 + 5;
  6232.             if(scrollYPos < -23)
  6233.                 break;
  6234.             String name = chatNames[typeIndex];
  6235.             String type = chatMessages[typeIndex];
  6236.             boolean flag = false;
  6237.             if(chatTypeView == 1) {
  6238.                 buildPublicChat(paddingY);
  6239.                 break;
  6240.             }
  6241.             if(chatTypeView == 2) {
  6242.                 buildFriendChat(paddingY);
  6243.                 break;
  6244.             }
  6245.             if(chatTypeView == 3 || chatTypeView == 4) {
  6246.                 buildDuelorTrade(paddingY);
  6247.                 break;
  6248.             }
  6249.             if(chatTypeView == 5) {
  6250.                 break;
  6251.             }
  6252.             if(name != null && name.startsWith("@cr")) {
  6253.                 String rightID = name.substring(3,4);
  6254.                 name = name.substring(5);
  6255.             }
  6256.             if(chatType == 0)
  6257.                 totalLines++;
  6258.             if((chatType == 1 || chatType == 2) && (chatType == 1 || publicChatMode == 0 || publicChatMode == 1 && isFriendOrSelf(name))) {
  6259.                 if(paddingY > scrollYPos - 14 && paddingY <= scrollYPos && !name.equals(myPlayer.name)) {
  6260.                     if(myPrivilege >= 1) {
  6261.                         menuActionName[menuActionRow] = "Report abuse @whi@" + name;
  6262.                         menuActionID[menuActionRow] = 606;
  6263.                         menuActionRow++;
  6264.                     }
  6265.                     menuActionName[menuActionRow] = "Add ignore @whi@" + name;
  6266.                     menuActionID[menuActionRow] = 42;
  6267.                     menuActionRow++;
  6268.                     menuActionName[menuActionRow] = "Add friend @whi@" + name;
  6269.                     menuActionID[menuActionRow] = 337;
  6270.                     menuActionRow++;
  6271.                 }
  6272.                 totalLines++;
  6273.             }
  6274.             if((chatType == 3 || chatType == 7) && splitPrivateChat == 0 && (chatType == 7 || privateChatMode == 0 || privateChatMode == 1 && isFriendOrSelf(name))) {
  6275.                 if(paddingY > scrollYPos - 14 && paddingY <= scrollYPos) {
  6276.                     if(myPrivilege >= 1) {
  6277.                         menuActionName[menuActionRow] = "Report abuse @whi@" + name;
  6278.                         menuActionID[menuActionRow] = 606;
  6279.                         menuActionRow++;
  6280.                     }
  6281.                     menuActionName[menuActionRow] = "Add ignore @whi@" + name;
  6282.                     menuActionID[menuActionRow] = 42;
  6283.                     menuActionRow++;
  6284.                     menuActionName[menuActionRow] = "Add friend @whi@" + name;
  6285.                     menuActionID[menuActionRow] = 337;
  6286.                     menuActionRow++;
  6287.                 }
  6288.                 totalLines++;
  6289.             }
  6290.             if(chatType == 4 && (tradeMode == 0 || tradeMode == 1 && isFriendOrSelf(name))) {
  6291.                 if(paddingY > scrollYPos - 14 && paddingY <= scrollYPos) {
  6292.                     menuActionName[menuActionRow] = "Accept trade @whi@" + name;
  6293.                     menuActionID[menuActionRow] = 484;
  6294.                     menuActionRow++;
  6295.                 }
  6296.                 totalLines++;
  6297.             }
  6298.             if(chatType == 9) {
  6299.                 if(paddingY > scrollYPos - 14 && paddingY <= scrollYPos) {
  6300.                     String displayLink = ((name.length() > 30) ? (name.substring(0,25) + "...") : (name));
  6301.                     menuActionName[menuActionRow] = "Open page: " + displayLink;
  6302.                     menuActionID[menuActionRow] = 485;
  6303.                     menuActionRow++;
  6304.                     linkInText = name;
  6305.                 }
  6306.                 totalLines++;
  6307.             }
  6308.             if((chatType == 5 || chatType == 6) && splitPrivateChat == 0 && privateChatMode < 2)
  6309.                 totalLines++;
  6310.             if(chatType == 8 && (tradeMode == 0 || tradeMode == 1 && isFriendOrSelf(name))) {
  6311.                 if(paddingY > scrollYPos - 14 && paddingY <= scrollYPos) {
  6312.                     menuActionName[menuActionRow] = "Accept challenge @whi@" + name;
  6313.                     menuActionID[menuActionRow] = 6;
  6314.                     menuActionRow++;
  6315.                 }
  6316.                 totalLines++;
  6317.             }
  6318.         }
  6319.     }  
  6320.    
  6321.     private void drawFriendsListOrWelcomeScreen(RSInterface class9)
  6322.     {
  6323.         int j = class9.contentType;
  6324.         if(j >= 1 && j <= 100 || j >= 701 && j <= 800)
  6325.         {
  6326.             if(j == 1 && anInt900 == 0)
  6327.             {
  6328.                 class9.message = "Loading friend list";
  6329.                 class9.atActionType = 0;
  6330.                 return;
  6331.             }
  6332.             if(j == 1 && anInt900 == 1)
  6333.             {
  6334.                 class9.message = "Connecting to friendserver";
  6335.                 class9.atActionType = 0;
  6336.                 return;
  6337.             }
  6338.             if(j == 2 && anInt900 != 2)
  6339.             {
  6340.                 class9.message = "Please wait...";
  6341.                 class9.atActionType = 0;
  6342.                 return;
  6343.             }
  6344.             int k = friendsCount;
  6345.             if(anInt900 != 2)
  6346.                 k = 0;
  6347.             if(j > 700)
  6348.                 j -= 601;
  6349.             else
  6350.                 j--;
  6351.             if(j >= k)
  6352.             {
  6353.                 class9.message = "";
  6354.                 class9.atActionType = 0;
  6355.                 return;
  6356.             } else
  6357.             {
  6358.                 class9.message = friendsList[j];
  6359.                 class9.atActionType = 1;
  6360.                 return;
  6361.             }
  6362.         }
  6363.         if(j >= 101 && j <= 200 || j >= 801 && j <= 900)
  6364.         {
  6365.             int l = friendsCount;
  6366.             if(anInt900 != 2)
  6367.                 l = 0;
  6368.             if(j > 800)
  6369.                 j -= 701;
  6370.             else
  6371.                 j -= 101;
  6372.             if(j >= l)
  6373.             {
  6374.                 class9.message = "";
  6375.                 class9.atActionType = 0;
  6376.                 return;
  6377.             }
  6378.             if(friendsNodeIDs[j] == 0)
  6379.                 class9.message = "@red@Offline";
  6380.             else if(friendsNodeIDs[j] == nodeID)
  6381.                 class9.message = "@gre@Online"/* + (friendsNodeIDs[j] - 9)*/;
  6382.             else
  6383.                 class9.message = "@red@Offline"/* + (friendsNodeIDs[j] - 9)*/;
  6384.             class9.atActionType = 1;
  6385.             return;
  6386.         }
  6387.         if(j == 203)
  6388.         {
  6389.             int i1 = friendsCount;
  6390.             if(anInt900 != 2)
  6391.                 i1 = 0;
  6392.             class9.scrollMax = i1 * 15 + 20;
  6393.             if(class9.scrollMax <= class9.height)
  6394.                 class9.scrollMax = class9.height + 1;
  6395.             return;
  6396.         }
  6397.         if(j >= 401 && j <= 500)
  6398.         {
  6399.             if((j -= 401) == 0 && anInt900 == 0)
  6400.             {
  6401.                 class9.message = "Loading ignore list";
  6402.                 class9.atActionType = 0;
  6403.                 return;
  6404.             }
  6405.             if(j == 1 && anInt900 == 0)
  6406.             {
  6407.                 class9.message = "Please wait...";
  6408.                 class9.atActionType = 0;
  6409.                 return;
  6410.             }
  6411.             int j1 = ignoreCount;
  6412.             if(anInt900 == 0)
  6413.                 j1 = 0;
  6414.             if(j >= j1)
  6415.             {
  6416.                 class9.message = "";
  6417.                 class9.atActionType = 0;
  6418.                 return;
  6419.             } else
  6420.             {
  6421.                 class9.message = TextClass.fixName(TextClass.nameForLong(ignoreListAsLongs[j]));
  6422.                 class9.atActionType = 1;
  6423.                 return;
  6424.             }
  6425.         }
  6426.         if(j == 503)
  6427.         {
  6428.             class9.scrollMax = ignoreCount * 15 + 20;
  6429.             if(class9.scrollMax <= class9.height)
  6430.                 class9.scrollMax = class9.height + 1;
  6431.             return;
  6432.         }
  6433.         if(j == 327)
  6434.         {
  6435.             class9.modelRotation1 = 150;
  6436.             class9.modelRotation2 = (int)(Math.sin((double)loopCycle / 40D) * 256D) & 0x7ff;
  6437.             if(aBoolean1031)
  6438.             {
  6439.                 for(int k1 = 0; k1 < 7; k1++)
  6440.                 {
  6441.                     int l1 = anIntArray1065[k1];
  6442.                     if(l1 >= 0 && !IDK.cache[l1].method537())
  6443.                         return;
  6444.                 }
  6445.  
  6446.                 aBoolean1031 = false;
  6447.                 Model aclass30_sub2_sub4_sub6s[] = new Model[7];
  6448.                 int i2 = 0;
  6449.                 for(int j2 = 0; j2 < 7; j2++)
  6450.                 {
  6451.                     int k2 = anIntArray1065[j2];
  6452.                     if(k2 >= 0)
  6453.                     {
  6454.                     //Model.readAndDump(IDK.cache[k2].method538().modelID);
  6455.                         aclass30_sub2_sub4_sub6s[i2++] = IDK.cache[k2].method538();
  6456.                        
  6457.                     }
  6458.                 }
  6459.  
  6460.                 Model model = new Model(i2, aclass30_sub2_sub4_sub6s);
  6461.                 for(int l2 = 0; l2 < 5; l2++)
  6462.                     if(anIntArray990[l2] != 0)
  6463.                     {
  6464.                         model.method476(anIntArrayArray1003[l2][0], anIntArrayArray1003[l2][anIntArray990[l2]]);
  6465.                         if(l2 == 1)
  6466.                             model.method476(anIntArray1204[0], anIntArray1204[anIntArray990[l2]]);
  6467.                     }
  6468.  
  6469.                 model.method469();
  6470.                 model.method470(Animation.anims[myPlayer.anInt1511].anIntArray353[0]);
  6471.                 model.method479(64, 850, -30, -50, -30, true);
  6472.                 class9.anInt233 = 5;
  6473.                 class9.mediaID = 0;
  6474.                 RSInterface.method208(aBoolean994, model);
  6475.             }
  6476.             return;
  6477.         }
  6478.         if(j == 328) {
  6479.             RSInterface rsInterface = class9;
  6480.             int verticleTilt = 150;
  6481.             int animationSpeed = (int)(Math.sin((double)loopCycle / 40D) * 256D) & 0x7ff;
  6482.             rsInterface.modelRotation1 = verticleTilt;
  6483.             rsInterface.modelRotation2 = animationSpeed;
  6484.             if(aBoolean1031) {
  6485.                 Model characterDisplay = myPlayer.method452();
  6486.                 for(int l2 = 0; l2 < 5; l2++)
  6487.                     if(anIntArray990[l2] != 0) {
  6488.                         characterDisplay.method476(anIntArrayArray1003[l2][0], anIntArrayArray1003[l2][anIntArray990[l2]]);
  6489.                         if(l2 == 1)
  6490.                             characterDisplay.method476(anIntArray1204[0], anIntArray1204[anIntArray990[l2]]);
  6491.                     }
  6492.                 int staticFrame = myPlayer.anInt1511;
  6493.                 characterDisplay.method469();
  6494.                 characterDisplay.method470(Animation.anims[staticFrame].anIntArray353[0]);
  6495.                 //characterDisplay.method479(64, 850, -30, -50, -30, true);
  6496.                 rsInterface.anInt233 = 5;
  6497.                 rsInterface.mediaID = 0;
  6498.                 RSInterface.method208(aBoolean994, characterDisplay);
  6499.             }
  6500.             return;
  6501.         }
  6502.         if(j == 324)
  6503.         {
  6504.             if(aClass30_Sub2_Sub1_Sub1_931 == null)
  6505.             {
  6506.                 aClass30_Sub2_Sub1_Sub1_931 = class9.sprite1;
  6507.                 aClass30_Sub2_Sub1_Sub1_932 = class9.sprite2;
  6508.             }
  6509.             if(aBoolean1047)
  6510.             {
  6511.                 class9.sprite1 = aClass30_Sub2_Sub1_Sub1_932;
  6512.                 return;
  6513.             } else
  6514.             {
  6515.                 class9.sprite1 = aClass30_Sub2_Sub1_Sub1_931;
  6516.                 return;
  6517.             }
  6518.         }
  6519.         if(j == 325)
  6520.         {
  6521.             if(aClass30_Sub2_Sub1_Sub1_931 == null)
  6522.             {
  6523.                 aClass30_Sub2_Sub1_Sub1_931 = class9.sprite1;
  6524.                 aClass30_Sub2_Sub1_Sub1_932 = class9.sprite2;
  6525.             }
  6526.             if(aBoolean1047)
  6527.             {
  6528.                 class9.sprite1 = aClass30_Sub2_Sub1_Sub1_931;
  6529.                 return;
  6530.             } else
  6531.             {
  6532.                 class9.sprite1 = aClass30_Sub2_Sub1_Sub1_932;
  6533.                 return;
  6534.             }
  6535.         }
  6536.         if(j == 600)
  6537.         {
  6538.             class9.message = reportAbuseInput;
  6539.             if(loopCycle % 20 < 10)
  6540.             {
  6541.                 class9.message += "|";
  6542.                 return;
  6543.             } else
  6544.             {
  6545.                 class9.message += " ";
  6546.                 return;
  6547.             }
  6548.         }
  6549.         if(j > 600 && j < 621)
  6550.         {
  6551.         int id = j-601;
  6552.         String[] mod_options = {
  6553.         "Moderator Options:",
  6554.         "Mute user",
  6555.         "Un-Mute user",
  6556.         "Jail user",
  6557.         "Un-Jail user",
  6558.         "Ban user",
  6559.         "Un-Ban user"
  6560.         };
  6561.         String[] admin_options = {
  6562.         "Admin Options:",
  6563.         "Mute users IP",
  6564.         "Un-Mute users IP",
  6565.         "Ban users IP",
  6566.         "Un-Ban users IP",
  6567.         };
  6568.         if(id < mod_options.length)
  6569.             if(id == 0)
  6570.                 class9.message = mod_options[id];
  6571.             else
  6572.                 class9.message = (id)+": "+mod_options[id];
  6573.         else if(id < mod_options.length+admin_options.length && myPrivilege > 1)
  6574.             if(id-mod_options.length == 0)
  6575.                 class9.message = admin_options[id-mod_options.length];
  6576.             else
  6577.                 class9.message = (id-mod_options.length)+": "+admin_options[id-mod_options.length];
  6578.         }
  6579.         if(j == 650 || j == 655)
  6580.             if(anInt1193 != 0)
  6581.             {
  6582.                 String s;
  6583.                 if(daysSinceLastLogin == 0)
  6584.                     s = "earlier today";
  6585.                 else
  6586.                 if(daysSinceLastLogin == 1)
  6587.                     s = "yesterday";
  6588.                 else
  6589.                     s = daysSinceLastLogin + " days ago";
  6590.                 class9.message = "You last logged in " + s + " from: " + signlink.dns;
  6591.             } else
  6592.             {
  6593.                 class9.message = "";
  6594.             }
  6595.         if(j == 651)
  6596.         {
  6597.             if(unreadMessages == 0)
  6598.             {
  6599.                 class9.message = "0 unread messages";
  6600.                 class9.textColor = 0xffff00;
  6601.             }
  6602.             if(unreadMessages == 1)
  6603.             {
  6604.                 class9.message = "1 unread message";
  6605.                 class9.textColor = 65280;
  6606.             }
  6607.             if(unreadMessages > 1)
  6608.             {
  6609.                 class9.message = unreadMessages + " unread messages";
  6610.                 class9.textColor = 65280;
  6611.             }
  6612.         }
  6613.         if(j == 652)
  6614.             if(daysSinceRecovChange == 201)
  6615.             {
  6616.                 if(membersInt == 1)
  6617.                     class9.message = "@yel@This is a non-members world: @whi@Since you are a member we";
  6618.                 else
  6619.                     class9.message = "";
  6620.             } else
  6621.             if(daysSinceRecovChange == 200)
  6622.             {
  6623.                 class9.message = "You have not yet set any password recovery questions.";
  6624.             } else
  6625.             {
  6626.                 String s1;
  6627.                 if(daysSinceRecovChange == 0)
  6628.                     s1 = "Earlier today";
  6629.                 else
  6630.                 if(daysSinceRecovChange == 1)
  6631.                     s1 = "Yesterday";
  6632.                 else
  6633.                     s1 = daysSinceRecovChange + " days ago";
  6634.                 class9.message = s1 + " you changed your recovery questions";
  6635.             }
  6636.         if(j == 653)
  6637.             if(daysSinceRecovChange == 201)
  6638.             {
  6639.                 if(membersInt == 1)
  6640.                     class9.message = "@whi@recommend you use a members world instead. You may use";
  6641.                 else
  6642.                     class9.message = "";
  6643.             } else
  6644.             if(daysSinceRecovChange == 200)
  6645.                 class9.message = "We strongly recommend you do so now to secure your account.";
  6646.             else
  6647.                 class9.message = "If you do not remember making this change then cancel it immediately";
  6648.         if(j == 654)
  6649.         {
  6650.             if(daysSinceRecovChange == 201)
  6651.                 if(membersInt == 1)
  6652.                 {
  6653.                     class9.message = "@whi@this world but member benefits are unavailable whilst here.";
  6654.                     return;
  6655.                 } else
  6656.                 {
  6657.                     class9.message = "";
  6658.                     return;
  6659.                 }
  6660.             if(daysSinceRecovChange == 200)
  6661.             {
  6662.                 class9.message = "Do this from the 'account management' area on our front webpage";
  6663.                 return;
  6664.             }
  6665.             class9.message = "Do this from the 'account management' area on our front webpage";
  6666.         }
  6667.     }
  6668.  
  6669.     private void drawSplitPrivateChat(int paddingX, int paddingY) {
  6670.         if(splitPrivateChat == 0)
  6671.             return;
  6672.         TextDrawingArea textdrawingarea = normalFont;
  6673.         int i = 0 ;
  6674.         if(systemUpdatetime != 0)
  6675.             i = 1;
  6676.         for(int j = 0; j < 100; j++)
  6677.             if(chatMessages[j] != null)
  6678.             {
  6679.                 int k = chatTypes[j];
  6680.                 String s = chatNames[j];
  6681.                 byte byte1 = 0;
  6682.                 if(s != null && s.startsWith("@cr")) {
  6683.                     String rightID = s.substring(3,4);
  6684.                     s = s.substring(5);
  6685.                     byte1 = (byte)Integer.parseInt(rightID);
  6686.                 }
  6687.             if((k == 3 || k == 7) && (k == 7 || privateChatMode == 0 || privateChatMode == 1 && isFriendOrSelf(s)))
  6688.             {
  6689.                 int l = (329 + paddingY) - i * 13;
  6690.                 int k1 = 4;
  6691.                 textdrawingarea.method385(0, "From", l, k1);
  6692.                 textdrawingarea.method385(65535, "From", l - 1, k1);
  6693.                 k1 += textdrawingarea.getTextWidth("From ");
  6694.                 if(byte1 > 0) {
  6695.                 if(byte1-1 > 2) {
  6696.                     return; //Fixes crash
  6697.                 }
  6698.                     modIcons[byte1-1].drawBackground(k1, l - 12);
  6699.                     k1 += 14;
  6700.                 }
  6701.                 textdrawingarea.method385(0, s + ": " + chatMessages[j], l, k1);
  6702.                 textdrawingarea.method385(65535, s + ": " + chatMessages[j], l - 1, k1);
  6703.                 if(++i >= 5)
  6704.                     return;
  6705.             }
  6706.             if(k == 5 && privateChatMode < 2)
  6707.             {
  6708.                 try
  6709.                 {
  6710.                     int i1 = (329 + paddingY) - i * 13;
  6711.                     textdrawingarea.method385(0, chatMessages[j], i1, 4);
  6712.                     textdrawingarea.method385(65535, chatMessages[j], i1 - 1, 4);
  6713.                     if(++i >= 5)
  6714.                         return;
  6715.                 } catch(ArrayIndexOutOfBoundsException ex) {
  6716.                    
  6717.                 }
  6718.             }
  6719.             if(k != 6 || privateChatMode >= 2)
  6720.                 continue;
  6721.             int j1 = (329 + paddingY) - i * 13;
  6722.             textdrawingarea.method385(0, "To " + s + ": " + chatMessages[j], j1, 4);
  6723.             textdrawingarea.method385(65535, "To " + s + ": " + chatMessages[j], j1 - 1, 4);
  6724.             if(++i >= 5)
  6725.                 return;
  6726.         }
  6727.  
  6728.     }
  6729.    
  6730.     public void pushMessage(String s, int i, String s1) {
  6731.         if(i == 0 && dialogID != -1) {
  6732.             aString844 = s;
  6733.             super.clickMode3 = 0;
  6734.         }
  6735.         if(backDialogID == -1)
  6736.             inputTaken = true;
  6737.         for(int j = 499; j > 0; j--) {
  6738.             chatTypes[j] = chatTypes[j - 1];
  6739.             chatNames[j] = chatNames[j - 1];
  6740.             chatMessages[j] = chatMessages[j - 1];
  6741.             chatRights[j] = chatRights[j - 1];
  6742.         }
  6743.         chatTypes[0] = i;
  6744.         chatNames[0] = s1;
  6745.         chatMessages[0] = s;
  6746.         chatRights[0] = rights;
  6747.     }
  6748.    
  6749.     static int focusTab = 3;
  6750.     public static void setTab(int id) {
  6751.         if(focusTab == id && toggleFullscreen)
  6752.             focusTab = -1;
  6753.         else
  6754.             focusTab = id;
  6755.         needDrawTabArea = true;
  6756.         tabID = id;
  6757.         tabAreaAltered = true;
  6758.     }
  6759.    
  6760.     private void processTabClick(int paddingX, int paddingY) {
  6761.         if(invOverlayInterfaceID == -1) {
  6762.             if(super.mouseX >= 521 + paddingX && super.mouseX <= 550 + paddingX && super.mouseY >= 169 + (toggleFullscreen ? 261 : 0) + paddingY && super.mouseY < 205 + (toggleFullscreen ? 261 : 0) + paddingY && tabInterfaceIDs[0] != -1) {
  6763.                 //setTab(0);
  6764.                 menuActionName[1] = "Combat Styles";
  6765.                 menuActionID[1] = 1011;
  6766.                 menuActionRow = 2;
  6767.                 tabIDHover = 0;
  6768.             } else if(super.mouseX >= 552 + paddingX && super.mouseX <= 581 + paddingX && super.mouseY >= 168 + (toggleFullscreen ? 261 : 0) + paddingY && super.mouseY < 205 + (toggleFullscreen ? 261 : 0) + paddingY && tabInterfaceIDs[14] != -1) {
  6769.                 //setTab(14);
  6770.                 menuActionName[1] = "New Skills";
  6771.                 menuActionID[1] = 1042;//needs changing.
  6772.                 menuActionRow = 2;
  6773.                 tabIDHover = 1;
  6774.             } else if(super.mouseX >= 582 + paddingX && super.mouseX <= 611 + paddingX && super.mouseY >= 168 + (toggleFullscreen ? 261 : 0) + paddingY && super.mouseY < 205 + (toggleFullscreen ? 261 : 0) + paddingY && tabInterfaceIDs[1] != -1) {
  6775.                 //setTab(1);
  6776.                 menuActionName[1] = "Stats";
  6777.                 menuActionID[1] = 1012;
  6778.                 menuActionRow = 2;
  6779.                 tabIDHover = 2;
  6780.             } else if(super.mouseX >= 612 + paddingX && super.mouseX <= 641 + paddingX && super.mouseY >= 168 + (toggleFullscreen ? 261 : 0) + paddingY && super.mouseY < 203 + (toggleFullscreen ? 261 : 0) + paddingY && tabInterfaceIDs[2] != -1) {
  6781.                 //setTab(2);
  6782.                 menuActionName[1] = "Quest Journals";
  6783.                 menuActionID[1] = 1013;
  6784.                 menuActionRow = 2;
  6785.                 tabIDHover = 3;
  6786.             } else if(super.mouseX >= 642 + paddingX && super.mouseX <= 671 + paddingX && super.mouseY >= 168 + (toggleFullscreen ? 261 : 0) + paddingY && super.mouseY < 205 + (toggleFullscreen ? 261 : 0) + paddingY && tabInterfaceIDs[3] != -1) {
  6787.                 //setTab(3);
  6788.                 menuActionName[1] = "Inventory";
  6789.                 menuActionID[1] = 1014;
  6790.                 menuActionRow = 2;
  6791.                 tabIDHover = 4;
  6792.             } else if(super.mouseX >= 672 + paddingX && super.mouseX <= 701 + paddingX && super.mouseY >= 168 + (toggleFullscreen ? 261 : 0) + paddingY && super.mouseY < 205 + (toggleFullscreen ? 261 : 0) + paddingY && tabInterfaceIDs[4] != -1) {
  6793.                 //setTab(4);
  6794.                 menuActionName[1] = "Worn Equipment";
  6795.                 menuActionID[1] = 1015;
  6796.                 menuActionRow = 2;
  6797.                 tabIDHover = 5;
  6798.             } else if(super.mouseX >= 702 + paddingX && super.mouseX <= 731 + paddingX && super.mouseY >= 169 + (toggleFullscreen ? 261 : 0) + paddingY && super.mouseY < 205 + (toggleFullscreen ? 261 : 0) + paddingY && tabInterfaceIDs[5] != -1) {
  6799.                 //setTab(5);
  6800.                 menuActionName[1] = "Prayer List";
  6801.                 menuActionID[1] = 1016;
  6802.                 menuActionRow = 2;
  6803.                 tabIDHover = 6;
  6804.             } else if(super.mouseX >= 732 + paddingX && super.mouseX <= 761 + paddingX && super.mouseY >= 169 + (toggleFullscreen ? 261 : 0) + paddingY && super.mouseY < 205 + (toggleFullscreen ? 261 : 0) + paddingY && tabInterfaceIDs[6] != -1) {
  6805.                 //setTab(6);
  6806.                 menuActionName[1] = "Magic Spellbook";
  6807.                 menuActionID[1] = 1017;
  6808.                 menuActionRow = 2;
  6809.                 tabIDHover = 7;
  6810.             } else if(super.mouseX >= 522 + paddingX && super.mouseX <= 551 + paddingX && super.mouseY >= 466 + paddingY && super.mouseY < 503 + paddingY && tabInterfaceIDs[16] != -1) {
  6811.                 //setTab(16);
  6812.                 menuActionName[1] = "Summoning";
  6813.                 menuActionID[1] = 1043;
  6814.                 menuActionRow = 2;
  6815.                 tabIDHover = 14;
  6816.             } else if(super.mouseX >= 552 + paddingX && super.mouseX <= 581 + paddingX && super.mouseY >= 466 + paddingY && super.mouseY < 503 + paddingY && tabInterfaceIDs[8] != -1) {
  6817.                 //setTab(8);
  6818.                 menuActionName[1] = "Friends List";
  6819.                 menuActionID[1] = 1019;
  6820.                 menuActionRow = 2;
  6821.                 tabIDHover = 8;
  6822.             } else if(super.mouseX >= 582 + paddingX && super.mouseX <= 611 + paddingX && super.mouseY >= 466 + paddingY && super.mouseY < 503 + paddingY && tabInterfaceIDs[9] != -1) {
  6823.                 //setTab(9);
  6824.                 menuActionName[1] = "Ignore List";
  6825.                 menuActionID[1] = 1020;
  6826.                 menuActionRow = 2;
  6827.                 tabIDHover = 9;
  6828.             } else if(super.mouseX >= 612 + paddingX && super.mouseX <= 641 + paddingX && super.mouseY >= 466 + paddingY && super.mouseY < 503 + paddingY && tabInterfaceIDs[7] != -1) {
  6829.                 //setTab(7);
  6830.                 menuActionName[1] = "Clan Chat";
  6831.                 menuActionID[1] = 1018;
  6832.                 menuActionRow = 2;
  6833.                 tabIDHover = 10;
  6834.             } else if(super.mouseX >= 642 + paddingX && super.mouseX <= 671 + paddingX && super.mouseY >= 466 + paddingY && super.mouseY < 503 + paddingY && tabInterfaceIDs[11] != -1) {
  6835.                 //setTab(11);
  6836.                 menuActionName[1] = "Options";
  6837.                 menuActionID[1] = 1022;
  6838.                 menuActionRow = 2;
  6839.                 tabIDHover = 11;
  6840.             } else if(super.mouseX >= 672 + paddingX && super.mouseX <= 701 + paddingX && super.mouseY >= 466 + paddingY && super.mouseY < 503 + paddingY && tabInterfaceIDs[12] != -1) {
  6841.                 //setTab(12);
  6842.                 menuActionName[1] = "Emotes";
  6843.                 menuActionID[1] = 1023;
  6844.                 menuActionRow = 2;
  6845.                 tabIDHover = 12;
  6846.             } else if(super.mouseX >= 702 + paddingX && super.mouseX <= 731 + paddingX && super.mouseY >= 466 + paddingY && super.mouseY < 502 + paddingY && tabInterfaceIDs[13] != -1) {
  6847.                 //setTab(13);
  6848.                 menuActionName[1] = "Construction";
  6849.                 menuActionID[1] = 1024;
  6850.                 menuActionRow = 2;
  6851.                 tabIDHover = 13;
  6852.             } else if(super.mouseX >= 732 + paddingX && super.mouseX <= 761 + paddingX && super.mouseY >= 466 + paddingY && super.mouseY < 502 + paddingY && tabInterfaceIDs[15] != -1) {
  6853.                 //setTab(15);
  6854.                 menuActionName[1] = "Information";
  6855.                 menuActionID[1] = 1044;
  6856.                 menuActionRow = 2;
  6857.                 tabIDHover = 15;
  6858.             } else {
  6859.                 tabIDHover = -1;
  6860.                 needDrawTabArea = true;
  6861.                 tabAreaAltered = true;
  6862.             }
  6863.         }
  6864.     }
  6865.  
  6866.     private void resetImageProducers2() {
  6867.         if(chatBackImage != null)
  6868.             return;
  6869.         nullLoader();
  6870.         rightFrame = null;
  6871.         super.fullGameScreen = null;
  6872.         aRSImageProducer_1107 = null;
  6873.         aRSImageProducer_1108 = null;
  6874.         aRSImageProducer_1109 = null;
  6875.         aRSImageProducer_1110 = null;
  6876.         aRSImageProducer_1111 = null;
  6877.         aRSImageProducer_1112 = null;
  6878.         aRSImageProducer_1113 = null;
  6879.         aRSImageProducer_1114 = null;
  6880.         aRSImageProducer_1115 = null;
  6881.         chatBackImage = new RSImageProducer(xPaddingtabBack, yPaddingtabBack, getGameComponent());
  6882.         mapBackImage = new RSImageProducer(miniMapWidth, miniMapHeight, getGameComponent());
  6883.         DrawingArea.setAllPixelsToZero();
  6884.         mapBack[0].drawBackground(0, 0);
  6885.         rightFrame = new RSImageProducer(3, 170, getGameComponent());
  6886.         sideTabArea = new RSImageProducer(246, 335, getGameComponent());
  6887.         main3DArea = new RSImageProducer(512, 334, getGameComponent());
  6888.         DrawingArea.setAllPixelsToZero();
  6889.         aRSImageProducer_1123 = new RSImageProducer(496, 50, getGameComponent());
  6890.         aRSImageProducer_1124 = new RSImageProducer(269, 37, getGameComponent());
  6891.         aRSImageProducer_1125 = new RSImageProducer(249, 45, getGameComponent());
  6892.         welcomeScreenRaised = true;
  6893.     }
  6894.  
  6895.     public String getDocumentBaseHost() {
  6896.         if (signlink.mainapp != null) {
  6897.             return signlink.mainapp.getDocumentBase().getHost().toLowerCase();
  6898.         }
  6899.         if (super.gameFrame != null) {
  6900.             return ""; // runescape.com <- removed for Jframe to work
  6901.         } else {
  6902.             return ""; // super.getDocumentBase().getHost().toLowerCase() <- removed for Jframe to work
  6903.         }
  6904.     }
  6905.  
  6906.     private void drawMapSprites(Sprite sprite, int x, int y) {
  6907.     if (sprite == null)
  6908.     return;
  6909.         try {
  6910.             int xPadding = 0, yPadding = 0;
  6911.             if(toggleFullscreen) {
  6912.                 xPadding = xPaddingmapBackImage + getMapIncreaseX();
  6913.                 yPadding = yPaddingmapBackImage + getMapIncreaseY();
  6914.             }
  6915.             int rotation = compassRotation + mapAmtDiffRotation & 0x7ff;
  6916.             int distance = x * x + y * y;
  6917.             if(distance > 6400)
  6918.                 return;
  6919.             int spriteX = (Model.modelIntArray1[rotation] * 256) / (mapAmtDiffZoom + 256);
  6920.             int spriteY = (Model.modelIntArray2[rotation] * 256) / (mapAmtDiffZoom + 256);
  6921.             int drawX = y * spriteX + x * spriteY >> 16;
  6922.             int drawY = y * spriteY - x * spriteX >> 16;
  6923.             int finalX = ((mapSpritesX + drawX) - sprite.maxWidth / 2) + 4;
  6924.             int finalY = ((mapSpritesY - drawY) - sprite.maxHeight / 2) - 4;//86
  6925.             //if(distance > 2500) {
  6926.                 //sprite.drawWithinSprite(finalX, finalY, (toggleFullscreen ? miniMapBack[2] : miniMapBack[1]));
  6927.             //} else {
  6928.                 sprite.drawSprite(finalX + xPadding, finalY + yPadding);
  6929.             //}
  6930.         } catch(ArrayIndexOutOfBoundsException ex) {
  6931.            
  6932.         }
  6933.     }
  6934.    
  6935.     private void drawMapArrows(Sprite sprite, int x, int y) {
  6936.         int distance = x * x + y * y;
  6937.         int xPadding = 0, yPadding = 0;
  6938.         if(toggleFullscreen) {
  6939.             xPadding = xPaddingmapBackImage + getMapIncreaseX();
  6940.             yPadding = yPaddingmapBackImage + getMapIncreaseY();
  6941.         }
  6942.         if(distance > 4225 && distance < 90000) {
  6943.             int mapRotation = compassRotation + mapAmtDiffRotation & 0x7ff;
  6944.             int spriteX = (Model.modelIntArray1[mapRotation] * 256) / (mapAmtDiffZoom + 256);
  6945.             int spriteY = (Model.modelIntArray2[mapRotation] * 256) / (mapAmtDiffZoom + 256);
  6946.             int drawX = y * spriteX + x * spriteY >> 16;
  6947.             int drawY = y * spriteY - x * spriteX >> 16;
  6948.             double spriteRotation = Math.atan2(drawX, drawY);
  6949.             int finalX = (int)(Math.sin(spriteRotation) * 63D);
  6950.             int finalY = (int)(Math.cos(spriteRotation) * 57D);
  6951.             //mapEdge.drawRotatableSprite((mapSpritesX + finalX + 4) - 10,mapSpritesY - finalY - 20,  spriteRotation);
  6952.         } else {
  6953.             drawMapSprites(sprite, x + xPadding, y + yPadding);
  6954.         }
  6955.     }
  6956.    
  6957.     public boolean isInArea(int clickX, int clickY, int width, int height)
  6958.     {
  6959.         if(super.mouseX > clickX && super.mouseY > clickY && super.mouseX < clickX + width && super.mouseY < clickY + height)
  6960.             return true;
  6961.         else
  6962.             return false;
  6963.     }
  6964.    
  6965.     public boolean clickInArea(int clickX, int clickY, int width, int height)
  6966.     {
  6967.         if(super.saveClickX > clickX && super.saveClickY > clickY && super.saveClickX < clickX + width && super.saveClickY < clickY + height)
  6968.             return true;
  6969.         else
  6970.             return false;
  6971.     }
  6972.  
  6973.     public boolean inCircle(int circleX, int circleY, int radius)
  6974.     {
  6975.         return java.lang.Math.pow((circleX+radius - super.mouseX),2) + java.lang.Math.pow((circleY+radius - super.mouseY),2) < java.lang.Math.pow(radius,2);
  6976.     }
  6977.    
  6978.     private void rightClickMapArea(int paddingX, int paddingY) {
  6979.         if(!contextMenuOpen) {
  6980.             processXPCounterClick(getMapIncreaseX(),getMapIncreaseY());
  6981.             if(isInArea(xPaddingmapBackImage + (toggleFullscreen ? 207-52 : 207) + paddingX,0 + paddingY,21,21)) {
  6982.                 menuActionName[menuActionRow] = "Advisor";
  6983.                 menuActionID[menuActionRow] = 1051;
  6984.                 menuActionRow++;
  6985.                 advisorHover = (super.clickMode2 == 1) ? 2: 1;
  6986.             } else {
  6987.                 advisorHover = 0;
  6988.             }
  6989.             if(isInArea(xPaddingmapBackImage + (toggleFullscreen ? 228-52 : 228) + paddingX,0 + paddingY,21,21) && (tabInterfaceIDs[10] != -1 && invOverlayInterfaceID == -1)) {
  6990.                 menuActionName[menuActionRow] = "Exit";
  6991.                 menuActionID[menuActionRow] = 1021;
  6992.                 menuActionRow++;
  6993.                 exitHover = (super.clickMode2 == 1) ? 2: 1;
  6994.             } else {
  6995.                 exitHover = 0;
  6996.             }
  6997.             if(isInArea(xPaddingmapBackImage + (toggleFullscreen ? -44 : 145) + mapMovedX + paddingX,yPaddingmapBackImage + (toggleFullscreen ? 38 : 10) + mapMovedY + paddingY,57,34) && orbToggle[0]) {
  6998.                 menuActionName[menuActionRow] = "Use cure (p)";
  6999.                 menuActionID[menuActionRow] = 1052;
  7000.                 menuActionRow++;
  7001.                 orbHover = 0;
  7002.             } else if(isInArea(xPaddingmapBackImage + (toggleFullscreen ? -47 : 161) + mapMovedX + paddingX,yPaddingmapBackImage + (toggleFullscreen ? 72 : 49) + mapMovedY + paddingY,57,34)) {
  7003.                 String prayerType = (prayerInterfaceType == 5608) ? "prayers" : "curses";
  7004.                 boolean inProcess = (tabInterfaceIDs[5] == 17200 || tabInterfaceIDs[5] == 17234);
  7005.                 menuActionName[menuActionRow] = (inProcess ? "Finish" : "Select") + " " + "quick " + prayerType + (inProcess ? " selection" : "");
  7006.                 menuActionID[menuActionRow] = 1046;
  7007.                 menuActionRow++;
  7008.                 menuActionName[menuActionRow] = "Turn quick " + prayerType + " " + (orbToggle[1] ? "off" : "on");
  7009.                 menuActionID[menuActionRow] = 1045;
  7010.                 menuActionRow++;
  7011.                 orbHover = 1;
  7012.             } else if(isInArea(xPaddingmapBackImage + (toggleFullscreen ? -35 : 161) + mapMovedX + paddingX,yPaddingmapBackImage + (toggleFullscreen ? 106 : 88) + mapMovedY + paddingY,57,34)) {
  7013.                 menuActionName[menuActionRow] = "Rest";
  7014.                 menuActionID[menuActionRow] = 1048;
  7015.                 menuActionRow++;
  7016.                 menuActionName[menuActionRow] = "Turn run mode " + (orbToggle[2] ? "off" : "on");
  7017.                 menuActionID[menuActionRow] = 1047;
  7018.                 menuActionRow++;
  7019.                 orbHover = 2;
  7020.             } else if(isInArea(xPaddingmapBackImage + (toggleFullscreen ? -12 : 145) + mapMovedX + paddingX,yPaddingmapBackImage + (toggleFullscreen ? 135 : 127) + mapMovedY + paddingY,57,34)) {
  7021.                 menuActionName[menuActionRow] = "Select left-click option";
  7022.                 menuActionID[menuActionRow] = 1053;
  7023.                 menuActionRow++;
  7024.                 menuActionName[menuActionRow] = "Call Follower";
  7025.                 menuActionID[menuActionRow] = 1054;
  7026.                 menuActionRow++;
  7027.                 menuActionName[menuActionRow] = "Dismiss";
  7028.                 menuActionID[menuActionRow] = 1055;
  7029.                 menuActionRow++;
  7030.                 menuActionName[menuActionRow] = "Take BoB";
  7031.                 menuActionID[menuActionRow] = 1056;
  7032.                 menuActionRow++;
  7033.                 menuActionName[menuActionRow] = "Renew Familiar";
  7034.                 menuActionID[menuActionRow] = 1057;
  7035.                 menuActionRow++;
  7036.                 menuActionName[menuActionRow] = "Attack";
  7037.                 menuActionID[menuActionRow] = 1058;
  7038.                 menuActionRow++;
  7039.                 menuActionName[menuActionRow] = "Follower Details";
  7040.                 menuActionID[menuActionRow] = 1059;
  7041.                 menuActionRow++;
  7042.                 orbHover = 3;
  7043.             } else {
  7044.                 if(orbHover != -1)
  7045.                     orbHover = -1;
  7046.             }
  7047.             if(inCircle(xPaddingmapBackImage + (toggleFullscreen ? 30 : 11) + paddingX,yPaddingmapBackImage + (toggleFullscreen ? 9 : 8) + paddingY,17)) {
  7048.                 menuActionName[menuActionRow] = "Face north";
  7049.                 menuActionID[menuActionRow] = 1049;
  7050.                 menuActionRow++;
  7051.             }
  7052.             if(inCircle((toggleFullscreen ? 670 : 526) + paddingX,(toggleFullscreen ? 138 : 124),17)) {
  7053.                 menuActionName[menuActionRow] = "Vote4Cash";
  7054.                 //menuActionName[menuActionRow] = "World map";
  7055.                 menuActionID[menuActionRow] = 1050;
  7056.                 menuActionRow++;
  7057.                 mapHover = 1;
  7058.             } else {
  7059.                 mapHover = 0;
  7060.             }
  7061.         }
  7062.     }
  7063.  
  7064.     private void processChatButtonClick(int paddingX, int paddingY)
  7065.     {
  7066.         if(super.mouseX >= 5 + paddingX && super.mouseX <= 61 + paddingX && super.mouseY >= 482 + paddingY && super.mouseY <= 503 + paddingY)
  7067.         {
  7068.             menuActionName[menuActionRow] = "View All";
  7069.             menuActionID[menuActionRow] = 999;
  7070.             menuActionRow++;
  7071.         } else if(super.mouseX >= 71 + paddingX && super.mouseX <= 127 + paddingX && super.mouseY >= 482 + paddingY && super.mouseY <= 503 + paddingY)
  7072.         {
  7073.             menuActionName[menuActionRow] = "View Game";
  7074.             menuActionID[menuActionRow] = 998;
  7075.             menuActionRow++;
  7076.         } else if(super.mouseX >= 137 + paddingX && super.mouseX <= 193 + paddingX && super.mouseY >= 482 + paddingY && super.mouseY <= 503 + paddingY)
  7077.         {
  7078.             menuActionName[menuActionRow] = "Hide public";
  7079.             menuActionID[menuActionRow] = 997;
  7080.             menuActionRow++;
  7081.             menuActionName[menuActionRow] = "Off public";
  7082.             menuActionID[menuActionRow] = 996;
  7083.             menuActionRow++;
  7084.             menuActionName[menuActionRow] = "Friends public";
  7085.             menuActionID[menuActionRow] = 995;
  7086.             menuActionRow++;
  7087.             menuActionName[menuActionRow] = "On public";
  7088.             menuActionID[menuActionRow] = 994;
  7089.             menuActionRow++;
  7090.             menuActionName[menuActionRow] = "View public";
  7091.             menuActionID[menuActionRow] = 993;
  7092.             menuActionRow++;
  7093.         } else if(super.mouseX >= 203 + paddingX && super.mouseX <= 259 + paddingX && super.mouseY >= 482 + paddingY && super.mouseY <= 503 + paddingY)
  7094.         {
  7095.             menuActionName[menuActionRow] = "Off private";
  7096.             menuActionID[menuActionRow] = 992;
  7097.             menuActionRow++;
  7098.             menuActionName[menuActionRow] = "Friends private";
  7099.             menuActionID[menuActionRow] = 991;
  7100.             menuActionRow++;
  7101.             menuActionName[menuActionRow] = "On private";
  7102.             menuActionID[menuActionRow] = 990;
  7103.             menuActionRow++;
  7104.             menuActionName[menuActionRow] = "View private";
  7105.             menuActionID[menuActionRow] = 989;
  7106.             menuActionRow++;
  7107.         } else if(super.mouseX >= 269 + paddingX && super.mouseX <= 325 + paddingX && super.mouseY >= 482 + paddingY && super.mouseY <= 503 + paddingY)
  7108.         {
  7109.             menuActionName[menuActionRow] = "Off clan chat";
  7110.             menuActionID[menuActionRow] = 1003;
  7111.             menuActionRow++;
  7112.             menuActionName[menuActionRow] = "Friends clan chat";
  7113.             menuActionID[menuActionRow] = 1002;
  7114.             menuActionRow++;
  7115.             menuActionName[menuActionRow] = "On clan chat";
  7116.             menuActionID[menuActionRow] = 1001;
  7117.             menuActionRow++;
  7118.             menuActionName[menuActionRow] = "View clan chat";
  7119.             menuActionID[menuActionRow] = 1000;
  7120.             menuActionRow++;
  7121.         } else if(super.mouseX >= 335 + paddingX && super.mouseX <= 391 + paddingX && super.mouseY >= 482 + paddingY && super.mouseY <= 503 + paddingY)
  7122.         {
  7123.             menuActionName[menuActionRow] = "Off trade";
  7124.             menuActionID[menuActionRow] = 987;
  7125.             menuActionRow++;
  7126.             menuActionName[menuActionRow] = "Friends trade";
  7127.             menuActionID[menuActionRow] = 986;
  7128.             menuActionName[menuActionRow] = "On trade";
  7129.             menuActionID[menuActionRow] = 985;
  7130.             menuActionRow++;
  7131.             menuActionName[menuActionRow] = "View trade";
  7132.             menuActionID[menuActionRow] = 984;
  7133.             menuActionRow++;
  7134.         } else if(super.mouseX >= 404 && super.mouseX <= 514 && super.mouseY >= 480 + paddingY && super.mouseY <= 501 + paddingY) {
  7135.             menuActionName[menuActionRow] = "Report abuse";
  7136.             menuActionID[menuActionRow] = 606;
  7137.             menuActionRow++;
  7138.         }
  7139.     }
  7140.  
  7141.     public void processRightClick() {
  7142.         if (activeInterfaceType != 0) {
  7143.             return;
  7144.         }
  7145.         menuActionName[0] = "Cancel";
  7146.         menuActionID[0] = 1107;
  7147.         menuActionRow = 1;
  7148.         if (fullscreenInterfaceID != -1) {
  7149.             hoverChildId = 0;
  7150.             hoverToggleChildId = 0;
  7151.             buildInterfaceMenu(8, RSInterface.interfaceCache[fullscreenInterfaceID], super.mouseX, 8, super.mouseY, 0);
  7152.             if (hoverChildId != lastHoverChildId) {
  7153.                 lastHoverChildId = hoverChildId;
  7154.             }
  7155.             if (hoverToggleChildId != lastHoverToggleChildId) {
  7156.                 lastHoverToggleChildId = hoverToggleChildId;
  7157.             }
  7158.             return;
  7159.         }
  7160.         buildSplitPrivateChatMenu(0,getChatBackIncreaseY());
  7161.         hoverChildId = 0;
  7162.         hoverToggleChildId = 0;
  7163.         int width = toggleFullscreen ? getScreenWidth() : 516;
  7164.         int height = toggleFullscreen ? getScreenHeight() : 338;   
  7165.         if (super.mouseX > 0 && super.mouseY > 0 && super.mouseX < width && super.mouseY < height
  7166.         && !(!toggleFullscreen && super.mouseX > 519 + getTabIncreaseX() && super.mouseY > 168 + getTabIncreaseY() && super.mouseX < 519 + 246 + getTabIncreaseX() && super.mouseY < 168 + 335 + getTabIncreaseY())//Is not in inventory
  7167.         && !(toggleFullscreen && focusTab != -1
  7168.         //X end and Y start
  7169.         && super.mouseX > (45-23 + xPaddingtabBack + getTabIncreaseX())
  7170.         && super.mouseY > (55-23-46 + yPaddingtabBack + getTabIncreaseY())
  7171.         && super.mouseX < (45-23 + xPaddingtabBack + getTabIncreaseX() + 204)
  7172.         && super.mouseY < (55-23-46 + yPaddingtabBack + getTabIncreaseY() + 275)
  7173.         )//Is not in inventory
  7174.         && !(super.mouseX > 0 && super.mouseY > 338 + getChatBackIncreaseY() && super.mouseX < 517 && super.mouseY < 503 + getChatBackIncreaseY())//Is not in chat area
  7175.         && !(super.mouseX > xPaddingmapBackImage + getMapIncreaseX() + (toggleFullscreen ? -25 : 0) && super.mouseY > 0 && super.mouseX < xPaddingmapBackImage + getMapIncreaseX() + 249 && super.mouseY < yPaddingmapBackImage + getMapIncreaseY() + 168)//Is not in map
  7176.         ) {
  7177.             if (openInterfaceID != -1) {
  7178.                 RSInterface rsInterface = RSInterface.interfaceCache[openInterfaceID];
  7179.                 if(toggleFullscreen) {
  7180.                     int interfaceWidth = toggleFullscreen ? getScreenWidth() : 516;
  7181.                     int interfaceHeight = toggleFullscreen ? getScreenHeight() : 338;
  7182.                     buildInterfaceMenu(4 + (interfaceWidth - rsInterface.width) / 2, rsInterface, super.mouseX, 4 + (interfaceHeight - rsInterface.height) / 2, super.mouseY, 0);
  7183.                 } else
  7184.                     buildInterfaceMenu(4, rsInterface, super.mouseX, 4, super.mouseY, 0);
  7185.             } else {
  7186.                 build3dScreenMenu();
  7187.             }
  7188.         }
  7189.         if (hoverChildId != lastHoverChildId) {
  7190.             lastHoverChildId = hoverChildId;
  7191.         }
  7192.         if (hoverToggleChildId != lastHoverToggleChildId) {
  7193.             lastHoverToggleChildId = hoverToggleChildId;
  7194.         }
  7195.         hoverChildId = 0;
  7196.         hoverToggleChildId = 0;
  7197.         if(super.mouseX > 548 + getTabIncreaseX() && super.mouseY > 207 - (toggleFullscreen ? 46 : 0) + getTabIncreaseY() && super.mouseX < 740 + getTabIncreaseX() && super.mouseY < 468 + getTabIncreaseY()) {
  7198.             if(invOverlayInterfaceID != -1) {
  7199.                 buildInterfaceMenu(547 + getTabIncreaseX(), RSInterface.interfaceCache[invOverlayInterfaceID], super.mouseX, 205 - (toggleFullscreen ? 46 : 0) + getTabIncreaseY(), super.mouseY, 0);
  7200.             } else if(tabInterfaceIDs[tabID] != -1) {
  7201.                 if(focusTab != -1)
  7202.                     buildInterfaceMenu(547 + getTabIncreaseX(), RSInterface.interfaceCache[tabInterfaceIDs[tabID]], super.mouseX, 205 - (toggleFullscreen ? 46 : 0) + getTabIncreaseY(), super.mouseY, 0);
  7203.             }
  7204.         }
  7205.         if (hoverChildId != anInt1048) {
  7206.             needDrawTabArea = true;
  7207.             tabAreaAltered = true;
  7208.             anInt1048 = hoverChildId;
  7209.         }
  7210.         if (hoverToggleChildId != anInt1044) {
  7211.             needDrawTabArea = true;
  7212.             tabAreaAltered = true;
  7213.             anInt1044 = hoverToggleChildId;
  7214.         }
  7215.         hoverChildId = 0;
  7216.         hoverToggleChildId = 0;
  7217.         if(super.mouseX > 0 && super.mouseY > 338 + getChatBackIncreaseY() && super.mouseX < 490 && super.mouseY < 503 + getChatBackIncreaseY()) {
  7218.             if(backDialogID != -1) {
  7219.                 buildInterfaceMenu(20, RSInterface.interfaceCache[backDialogID], super.mouseX, 358 + getChatBackIncreaseY(), super.mouseY, 0);
  7220.             } else if(super.mouseY < 503 + getChatBackIncreaseY() && super.mouseX < 490 + getChatBackIncreaseY()) {
  7221.                 buildChatAreaMenu(super.mouseY - (yPaddingchatBackImage + getChatBackIncreaseY()));
  7222.             }
  7223.         }
  7224.         if (backDialogID != -1 && hoverChildId != anInt1039) {
  7225.             inputTaken = true;
  7226.             anInt1039 = hoverChildId;
  7227.         }
  7228.         if (backDialogID != -1 && hoverToggleChildId != anInt1500) {
  7229.             inputTaken = true;
  7230.             anInt1500 = hoverToggleChildId;
  7231.         }
  7232.         /* Enable custom right click areas */
  7233.        
  7234.         processChatButtonClick(0, getChatBackIncreaseY());
  7235.         rightClickMapArea(getMapIncreaseX(),getMapIncreaseY());
  7236.         processTabClick(getTabIncreaseX(),getTabIncreaseY());
  7237. alertHandler.processMouse(super.mouseX, super.mouseY);
  7238.         /**/
  7239.         boolean flag = false;
  7240.         while (!flag) {
  7241.             flag = true;
  7242.             for (int j = 0; j < menuActionRow - 1; j++) {
  7243.                 if (menuActionID[j] < 1000 && menuActionID[j + 1] > 1000) {
  7244.                     String s = menuActionName[j];
  7245.                     menuActionName[j] = menuActionName[j + 1];
  7246.                     menuActionName[j + 1] = s;
  7247.                     int k = menuActionID[j];
  7248.                     menuActionID[j] = menuActionID[j + 1];
  7249.                     menuActionID[j + 1] = k;
  7250.                     k = menuActionCmd2[j];
  7251.                     menuActionCmd2[j] = menuActionCmd2[j + 1];
  7252.                     menuActionCmd2[j + 1] = k;
  7253.                     k = menuActionCmd3[j];
  7254.                     menuActionCmd3[j] = menuActionCmd3[j + 1];
  7255.                     menuActionCmd3[j + 1] = k;
  7256.                     k = menuActionCmd1[j];
  7257.                     menuActionCmd1[j] = menuActionCmd1[j + 1];
  7258.                     menuActionCmd1[j + 1] = k;
  7259.                     flag = false;
  7260.                 }
  7261.             }
  7262.         }
  7263.     }
  7264. public void WhatWorldIsWhatIp () { // Fixes both worlds :) By Chance
  7265.         if(world == 1){
  7266.         serverip = "unperfectpvp.no-ip.biz";
  7267.         port = 43594;
  7268.         } else {
  7269.         if(world == 2){
  7270.         serverip = "127.0.0.1";
  7271.         port = 43595;
  7272.         }
  7273.         }
  7274.         }
  7275.        
  7276.     private int method83(int i, int j, int k)
  7277.     {
  7278.         int l = 256 - k;
  7279.         return ((i & 0xff00ff) * l + (j & 0xff00ff) * k & 0xff00ff00) + ((i & 0xff00) * l + (j & 0xff00) * k & 0xff0000) >> 8;
  7280.     }
  7281.  
  7282.         private void login(String s, String s1, boolean flag) {
  7283.         signlink.errorname = s;
  7284.         String s2 = "error";
  7285.         try {
  7286.  
  7287.             if (!flag) {
  7288.                 loginMessage1 = "";
  7289.                 loginMessage2 = "@whi@Connecting to server...";
  7290.                 drawLoginScreen(true);
  7291.             }
  7292.             //socketStream = new RSSocket(this, openSocket(43594 + portOff));
  7293.             socketStream = new RSSocket(this, openSocket(43594 + portOff));
  7294.             WhatWorldIsWhatIp();
  7295.             long l = TextClass.longForName(s2);
  7296.             int i = (int) (l >> 16 & 31L);
  7297.             stream.currentOffset = 0;
  7298.             stream.writeWordBigEndian(14);
  7299.             stream.writeWordBigEndian(i);
  7300.             socketStream.queueBytes(2, stream.buffer);
  7301.             for (int j = 0; j < 8; j++)
  7302.                 socketStream.read();
  7303.  
  7304.             int k = socketStream.read();
  7305.             int i1 = k;
  7306.             if (k == 0) {
  7307.                 socketStream.flushInputStream(inStream.buffer, 8);
  7308.                 inStream.currentOffset = 0;
  7309.                 aLong1215 = inStream.readQWord();
  7310.                 int ai[] = new int[4];
  7311.                 ai[0] = (int) (Math.random() * 99999999D);
  7312.                 ai[1] = (int) (Math.random() * 99999999D);
  7313.                 ai[2] = (int) (aLong1215 >> 32);
  7314.                 ai[3] = (int) aLong1215;
  7315.                 stream.currentOffset = 0;
  7316.                 stream.writeWordBigEndian(10);
  7317.                 stream.writeDWord(ai[0]);
  7318.                 stream.writeDWord(ai[1]);
  7319.                 stream.writeDWord(ai[2]);
  7320.                 stream.writeDWord(ai[3]);
  7321.                 stream.writeDWord(99140);
  7322.                 stream.writeString(s);
  7323.                 stream.writeString(s1);
  7324.                 stream.doKeys();
  7325.                 aStream_847.currentOffset = 0;
  7326.                 if (flag)
  7327.                     aStream_847.writeWordBigEndian(18);
  7328.                 else
  7329.                     aStream_847.writeWordBigEndian(16);
  7330.                 aStream_847.writeWordBigEndian(stream.currentOffset + 36 + 1
  7331.                         + 1 + 2);
  7332.                 aStream_847.writeWordBigEndian(558);
  7333.                 aStream_847.writeWord(1);
  7334.                 aStream_847.writeWordBigEndian(6);
  7335.                 for (int l1 = 0; l1 < 9; l1++)
  7336.                     aStream_847.writeDWord(expectedCRCs[l1]);
  7337.  
  7338.                 aStream_847.writeBytes(stream.buffer, stream.currentOffset, 0);
  7339.                 stream.encryption = new ISAACRandomGen(ai);
  7340.                 for (int j2 = 0; j2 < 4; j2++)
  7341.                     ai[j2] += 50;
  7342.  
  7343.                 encryption = new ISAACRandomGen(ai);
  7344.                 socketStream.queueBytes(aStream_847.currentOffset,
  7345.                         aStream_847.buffer);
  7346.                 k = socketStream.read();
  7347.             }
  7348.             if (k == 1) {
  7349.                 try {
  7350.                     Thread.sleep(2000L);
  7351.                 } catch (Exception _ex) {
  7352.                 }
  7353.                 login(s, s1, flag);
  7354.                 return;
  7355.             }
  7356.             if(k == 2)
  7357.             {
  7358.                 setDetails();
  7359.                 myPrivilege = socketStream.read();
  7360.                 flagged = socketStream.read() == 1;
  7361.                 aLong1220 = 0L;
  7362.                 anInt1022 = 0;
  7363.                 mouseDetection.coordsIndex = 0;
  7364.                 super.awtFocus = true;
  7365.                 aBoolean954 = true;
  7366.                 loggedIn = true;
  7367.                 stream.currentOffset = 0;
  7368.                 inStream.currentOffset = 0;
  7369.                 pktType = -1;
  7370.                 anInt841 = -1;
  7371.                 anInt842 = -1;
  7372.                 anInt843 = -1;
  7373.                 pktSize = 0;
  7374.                 anInt1009 = 0;
  7375.                 systemUpdatetime = 0;
  7376.                 anInt1011 = 0;
  7377.                 hintType = 0;
  7378.                 menuActionRow = 0;
  7379.                 contextMenuOpen = false;
  7380.                 super.idleTime = 0;
  7381.                 for(int j1 = 0; j1 < 100; j1++)
  7382.                     chatMessages[j1] = null;
  7383.                 summoningAttack = false;
  7384.                 itemSelected = 0;
  7385.                 spellSelected = 0;
  7386.                 loadingStage = 0;
  7387.                 anInt1062 = 0;
  7388.                 anInt1278 = (int)(Math.random() * 100D) - 50;
  7389.                 anInt1131 = (int)(Math.random() * 110D) - 55;
  7390.                 anInt896 = (int)(Math.random() * 80D) - 40;
  7391.                 mapAmtDiffRotation = (int)(Math.random() * 120D) - 60;
  7392.                 mapAmtDiffZoom = (int)(Math.random() * 30D) - 20;
  7393.                 compassRotation = (int)(Math.random() * 20D) - 10 & 0x7ff;
  7394.                 minimapCover = 0;
  7395.                 anInt985 = -1;
  7396.                 destX = 0;
  7397.                 destY = 0;
  7398.                 playerCount = 0;
  7399.                 npcCount = 0;
  7400.                 for (int i2 = 0; i2 < maxPlayers; i2++) {
  7401.                     playerArray[i2] = null;
  7402.                     aStreamArray895s[i2] = null;
  7403.                 }
  7404.  
  7405.                 for (int k2 = 0; k2 < 16384; k2++)
  7406.                     npcArray[k2] = null;
  7407.  
  7408.                 myPlayer = playerArray[myPlayerIndex] = new Player();
  7409.                 aClass19_1013.removeAll();
  7410.                 aClass19_1056.removeAll();
  7411.                 for (int l2 = 0; l2 < 4; l2++) {
  7412.                     for (int i3 = 0; i3 < 104; i3++) {
  7413.                         for (int k3 = 0; k3 < 104; k3++)
  7414.                             groundArray[l2][i3][k3] = null;
  7415.  
  7416.                     }
  7417.  
  7418.                 }
  7419.  
  7420.                 aClass19_1179 = new NodeList();
  7421.                 fullscreenInterfaceID = -1;
  7422.                 anInt900 = 0;
  7423.                 friendsCount = 0;
  7424.                 dialogID = -1;
  7425.                 backDialogID = -1;
  7426.                 openInterfaceID = -1;
  7427.                 invOverlayInterfaceID = -1;
  7428.                 walkableInterfaceID = -1;
  7429.                 aBoolean1149 = false;
  7430.                 tabID = 3;
  7431.                 inputDialogState = 0;
  7432.                 contextMenuOpen = false;
  7433.                 messagePromptRaised = false;
  7434.                 aString844 = null;
  7435.                 displayOverLayIcon = 0;
  7436.                 tabIconFlash = -1;
  7437.                 aBoolean1047 = true;
  7438.                 method45();
  7439.                 for (int j3 = 0; j3 < 5; j3++)
  7440.                     anIntArray990[j3] = 0;
  7441.  
  7442.                 for (int l3 = 0; l3 < 5; l3++) {
  7443.                     atPlayerActions[l3] = null;
  7444.                     atPlayerArray[l3] = false;
  7445.                 }
  7446.  
  7447.                 anInt1175 = 0;
  7448.                 anInt1134 = 0;
  7449.                 anInt986 = 0;
  7450.                 anInt1288 = 0;
  7451.                 anInt924 = 0;
  7452.                 anInt1188 = 0;
  7453.                 anInt1155 = 0;
  7454.                 anInt1226 = 0;
  7455.                 @SuppressWarnings("unused")
  7456.                 int anInt941 = 0;
  7457.                 @SuppressWarnings("unused")
  7458.                 int anInt1260 = 0;
  7459.                 resetImageProducers2();
  7460.                 return;
  7461.             }
  7462.             if (k == 3) {
  7463.                 loginMessage1 = "";
  7464.                 loginMessage2 = "@whi@Invalid username or password.";
  7465.                 return;
  7466.             }
  7467.             if (k == 4) {
  7468.                 loginMessage1 = "@whi@Your account has been disabled.";
  7469.                 loginMessage2 = "@whi@Please check your message-center for details.";
  7470.                 return;
  7471.             }
  7472.             if (k == 5) {
  7473.                 loginMessage1 = "@whi@Your account is already logged in.";
  7474.                 loginMessage2 = "@whi@If you have just left another world be patient.";
  7475.                 return;
  7476.             }
  7477.             if (k == 6) {
  7478.                 loginMessage1 = "@whi@Lui-scape has been updated!";
  7479.                 loginMessage2 = "@whi@Please reload this page.";
  7480.                 return;
  7481.             }
  7482.             if (k == 7) {
  7483.                 loginMessage1 = "@whi@This world is full.";
  7484.                 loginMessage2 = "@whi@Please use a different world.";
  7485.                 return;
  7486.             }
  7487.             if (k == 8) {
  7488.                 loginMessage1 = "@whi@Unable to connect.";
  7489.                 loginMessage2 = "@whi@Login server offline.";
  7490.                 return;
  7491.             }
  7492.             if (k == 9) {
  7493.                 loginMessage1 = "@whi@Login limit exceeded.";
  7494.                 loginMessage2 = "@whi@Too many connections from your address.";
  7495.                 return;
  7496.             }
  7497.             if (k == 10) {
  7498.                 loginMessage1 = "@whi@Unable to connect.";
  7499.                 loginMessage2 = "@whi@Bad session id.";
  7500.                 return;
  7501.             }
  7502.             if (k == 11) {
  7503.                 loginMessage1 = "@whi@Login server rejected session.";
  7504.                 loginMessage2 = "@whi@Please try again.";
  7505.                 return;
  7506.             }
  7507.             if (k == 12) {
  7508.                 loginMessage1 = "@whi@You need a members account to login to this world.";
  7509.                 loginMessage2 = "@whi@Please subscribe, or use a different world.";
  7510.                 return;
  7511.             }
  7512.             if (k == 13) {
  7513.                 loginMessage1 = "@whi@Could not complete login.";
  7514.                 loginMessage2 = "@whi@Please try using a different world.";
  7515.                 return;
  7516.             }
  7517.             if (k == 14) {
  7518.                 loginMessage1 = "@whi@The server is being updated.";
  7519.                 loginMessage2 = "@whi@Please wait 1 minute and try again.";
  7520.                 return;
  7521.             }
  7522.             if(k == 15)
  7523.             {
  7524.                 loggedIn = true;
  7525.                 stream.currentOffset = 0;
  7526.                 inStream.currentOffset = 0;
  7527.                 pktType = -1;
  7528.                 anInt841 = -1;
  7529.                 anInt842 = -1;
  7530.                 anInt843 = -1;
  7531.                 pktSize = 0;
  7532.                 anInt1009 = 0;
  7533.                 systemUpdatetime = 0;
  7534.                 menuActionRow = 0;
  7535.                 contextMenuOpen = false;
  7536.                 aLong824 = System.currentTimeMillis();
  7537.                 return;
  7538.             }
  7539.             if (k == 16) {
  7540.                 loginMessage1 = "@whi@Login attempts exceeded.";
  7541.                 loginMessage2 = "@whi@Please wait 1 minute and try again.";
  7542.                 return;
  7543.             }
  7544.             if (k == 17) {
  7545.                 loginMessage1 = "@whi@You are standing in a members-only area.";
  7546.                 loginMessage2 = "@whi@To play on this world move to a free area first";
  7547.                 return;
  7548.             }
  7549.             if (k == 20) {
  7550.                 loginMessage1 = "@whi@Invalid loginserver requested";
  7551.                 loginMessage2 = "@whi@Please try using a different world.";
  7552.                 return;
  7553.             }
  7554.             if (k == 21) {
  7555.                 for (int k1 = socketStream.read(); k1 >= 0; k1--) {
  7556.                     loginMessage1 = "@whi@You have only just left another world";
  7557.                     loginMessage2 = "@whi@Your profile will be transferred in: "
  7558.                             + k1 + " seconds";
  7559.                     drawLoginScreen(true);
  7560.                     try {
  7561.                         Thread.sleep(1000L);
  7562.                     } catch (Exception _ex) {
  7563.                     }
  7564.                 }
  7565.  
  7566.                 login(s, s1, flag);
  7567.                 return;
  7568.             }
  7569.             if (k == -1) {
  7570.                 if (i1 == 0) {
  7571.                     if (loginFailures < 2) {
  7572.                         try {
  7573.                             Thread.sleep(2000L);
  7574.                         } catch (Exception _ex) {
  7575.                         }
  7576.                         loginFailures++;
  7577.                         login(s, s1, flag);
  7578.                         return;
  7579.                     } else {
  7580.                         loginMessage1 = "@whi@No response from loginserver";
  7581.                         loginMessage2 = "@whi@Please wait 1 minute and try again.";
  7582.                         return;
  7583.                     }
  7584.                 } else {
  7585.                     loginMessage1 = "@whi@No response from server";
  7586.                     loginMessage2 = "@whi@Please try using a different world.";
  7587.                     return;
  7588.                 }
  7589.             } else {
  7590.                 // System.out.println("response:" + k);
  7591.                 loginMessage1 = "@whi@Unexpected server response";
  7592.                 loginMessage2 = "@whi@Please try using a different world.";
  7593.                 return;
  7594.             }
  7595.         } catch (IOException _ex) {
  7596.             loginMessage1 = "";
  7597.         }
  7598.         loginMessage2 = "@whi@Error connecting to server.";
  7599.     }
  7600.  
  7601.     private boolean doWalkTo(int i, int j, int k, int i1, int j1, int k1, int l1, int i2, int j2, boolean flag, int k2) {
  7602.         byte byte0 = 104;
  7603.         byte byte1 = 104;
  7604.         for(int l2 = 0; l2 < byte0; l2++) {
  7605.             for(int i3 = 0; i3 < byte1; i3++) {
  7606.                 anIntArrayArray901[l2][i3] = 0;
  7607.                 anIntArrayArray825[l2][i3] = 0x5f5e0ff;
  7608.             }
  7609.         }
  7610.         int j3 = j2;
  7611.         int k3 = j1;
  7612.         anIntArrayArray901[j2][j1] = 99;
  7613.         anIntArrayArray825[j2][j1] = 0;
  7614.         int l3 = 0;
  7615.         int i4 = 0;
  7616.         bigX[l3] = j2;
  7617.         bigY[l3++] = j1;
  7618.         boolean flag1 = false;
  7619.         int j4 = bigX.length;
  7620.         int ai[][] = aClass11Array1230[plane].anIntArrayArray294;
  7621.         while(i4 != l3)
  7622.         {
  7623.             j3 = bigX[i4];
  7624.             k3 = bigY[i4];
  7625.             i4 = (i4 + 1) % j4;
  7626.             if(j3 == k2 && k3 == i2)
  7627.             {
  7628.                 flag1 = true;
  7629.                 break;
  7630.             }
  7631.             if(i1 != 0)
  7632.             {
  7633.                 if((i1 < 5 || i1 == 10) && aClass11Array1230[plane].method219(k2, j3, k3, j, i1 - 1, i2))
  7634.                 {
  7635.                     flag1 = true;
  7636.                     break;
  7637.                 }
  7638.                 if(i1 < 10 && aClass11Array1230[plane].method220(k2, i2, k3, i1 - 1, j, j3))
  7639.                 {
  7640.                     flag1 = true;
  7641.                     break;
  7642.                 }
  7643.             }
  7644.             if(k1 != 0 && k != 0 && aClass11Array1230[plane].method221(i2, k2, j3, k, l1, k1, k3))
  7645.             {
  7646.                 flag1 = true;
  7647.                 break;
  7648.             }
  7649.             int l4 = anIntArrayArray825[j3][k3] + 1;
  7650.             if(j3 > 0 && anIntArrayArray901[j3 - 1][k3] == 0 && (ai[j3 - 1][k3] & 0x1280108) == 0)
  7651.             {
  7652.                 bigX[l3] = j3 - 1;
  7653.                 bigY[l3] = k3;
  7654.                 l3 = (l3 + 1) % j4;
  7655.                 anIntArrayArray901[j3 - 1][k3] = 2;
  7656.                 anIntArrayArray825[j3 - 1][k3] = l4;
  7657.             }
  7658.             if(j3 < byte0 - 1 && anIntArrayArray901[j3 + 1][k3] == 0 && (ai[j3 + 1][k3] & 0x1280180) == 0)
  7659.             {
  7660.                 bigX[l3] = j3 + 1;
  7661.                 bigY[l3] = k3;
  7662.                 l3 = (l3 + 1) % j4;
  7663.                 anIntArrayArray901[j3 + 1][k3] = 8;
  7664.                 anIntArrayArray825[j3 + 1][k3] = l4;
  7665.             }
  7666.             if(k3 > 0 && anIntArrayArray901[j3][k3 - 1] == 0 && (ai[j3][k3 - 1] & 0x1280102) == 0)
  7667.             {
  7668.                 bigX[l3] = j3;
  7669.                 bigY[l3] = k3 - 1;
  7670.                 l3 = (l3 + 1) % j4;
  7671.                 anIntArrayArray901[j3][k3 - 1] = 1;
  7672.                 anIntArrayArray825[j3][k3 - 1] = l4;
  7673.             }
  7674.             if(k3 < byte1 - 1 && anIntArrayArray901[j3][k3 + 1] == 0 && (ai[j3][k3 + 1] & 0x1280120) == 0)
  7675.             {
  7676.                 bigX[l3] = j3;
  7677.                 bigY[l3] = k3 + 1;
  7678.                 l3 = (l3 + 1) % j4;
  7679.                 anIntArrayArray901[j3][k3 + 1] = 4;
  7680.                 anIntArrayArray825[j3][k3 + 1] = l4;
  7681.             }
  7682.             if(j3 > 0 && k3 > 0 && anIntArrayArray901[j3 - 1][k3 - 1] == 0 && (ai[j3 - 1][k3 - 1] & 0x128010e) == 0 && (ai[j3 - 1][k3] & 0x1280108) == 0 && (ai[j3][k3 - 1] & 0x1280102) == 0)
  7683.             {
  7684.                 bigX[l3] = j3 - 1;
  7685.                 bigY[l3] = k3 - 1;
  7686.                 l3 = (l3 + 1) % j4;
  7687.                 anIntArrayArray901[j3 - 1][k3 - 1] = 3;
  7688.                 anIntArrayArray825[j3 - 1][k3 - 1] = l4;
  7689.             }
  7690.             if(j3 < byte0 - 1 && k3 > 0 && anIntArrayArray901[j3 + 1][k3 - 1] == 0 && (ai[j3 + 1][k3 - 1] & 0x1280183) == 0 && (ai[j3 + 1][k3] & 0x1280180) == 0 && (ai[j3][k3 - 1] & 0x1280102) == 0)
  7691.             {
  7692.                 bigX[l3] = j3 + 1;
  7693.                 bigY[l3] = k3 - 1;
  7694.                 l3 = (l3 + 1) % j4;
  7695.                 anIntArrayArray901[j3 + 1][k3 - 1] = 9;
  7696.                 anIntArrayArray825[j3 + 1][k3 - 1] = l4;
  7697.             }
  7698.             if(j3 > 0 && k3 < byte1 - 1 && anIntArrayArray901[j3 - 1][k3 + 1] == 0 && (ai[j3 - 1][k3 + 1] & 0x1280138) == 0 && (ai[j3 - 1][k3] & 0x1280108) == 0 && (ai[j3][k3 + 1] & 0x1280120) == 0)
  7699.             {
  7700.                 bigX[l3] = j3 - 1;
  7701.                 bigY[l3] = k3 + 1;
  7702.                 l3 = (l3 + 1) % j4;
  7703.                 anIntArrayArray901[j3 - 1][k3 + 1] = 6;
  7704.                 anIntArrayArray825[j3 - 1][k3 + 1] = l4;
  7705.             }
  7706.             if(j3 < byte0 - 1 && k3 < byte1 - 1 && anIntArrayArray901[j3 + 1][k3 + 1] == 0 && (ai[j3 + 1][k3 + 1] & 0x12801e0) == 0 && (ai[j3 + 1][k3] & 0x1280180) == 0 && (ai[j3][k3 + 1] & 0x1280120) == 0)
  7707.             {
  7708.                 bigX[l3] = j3 + 1;
  7709.                 bigY[l3] = k3 + 1;
  7710.                 l3 = (l3 + 1) % j4;
  7711.                 anIntArrayArray901[j3 + 1][k3 + 1] = 12;
  7712.                 anIntArrayArray825[j3 + 1][k3 + 1] = l4;
  7713.             }
  7714.         }
  7715.         anInt1264 = 0;
  7716.         if(!flag1)
  7717.         {
  7718.             if(flag)
  7719.             {
  7720.                 int i5 = 100;
  7721.                 for(int k5 = 1; k5 < 2; k5++)
  7722.                 {
  7723.                     for(int i6 = k2 - k5; i6 <= k2 + k5; i6++)
  7724.                     {
  7725.                         for(int l6 = i2 - k5; l6 <= i2 + k5; l6++)
  7726.                             if(i6 >= 0 && l6 >= 0 && i6 < 104 && l6 < 104 && anIntArrayArray825[i6][l6] < i5)
  7727.                             {
  7728.                                 i5 = anIntArrayArray825[i6][l6];
  7729.                                 j3 = i6;
  7730.                                 k3 = l6;
  7731.                                 anInt1264 = 1;
  7732.                                 flag1 = true;
  7733.                             }
  7734.  
  7735.                     }
  7736.  
  7737.                     if(flag1)
  7738.                         break;
  7739.                 }
  7740.  
  7741.             }
  7742.             if(!flag1)
  7743.                 return false;
  7744.         }
  7745.         i4 = 0;
  7746.         bigX[i4] = j3;
  7747.         bigY[i4++] = k3;
  7748.         int l5;
  7749.         for(int j5 = l5 = anIntArrayArray901[j3][k3]; j3 != j2 || k3 != j1; j5 = anIntArrayArray901[j3][k3])
  7750.         {
  7751.             if(j5 != l5)
  7752.             {
  7753.                 l5 = j5;
  7754.                 bigX[i4] = j3;
  7755.                 bigY[i4++] = k3;
  7756.             }
  7757.             if((j5 & 2) != 0)
  7758.                 j3++;
  7759.             else
  7760.             if((j5 & 8) != 0)
  7761.                 j3--;
  7762.             if((j5 & 1) != 0)
  7763.                 k3++;
  7764.             else
  7765.             if((j5 & 4) != 0)
  7766.                 k3--;
  7767.         }
  7768. //  if(cancelWalk) { return i4 > 0; }
  7769.    
  7770.  
  7771.         if(i4 > 0)
  7772.         {
  7773.             int k4 = i4;
  7774.             if(k4 > 25)
  7775.                 k4 = 25;
  7776.             i4--;
  7777.             int k6 = bigX[i4];
  7778.             int i7 = bigY[i4];
  7779.             anInt1288 += k4;
  7780.             if(anInt1288 >= 92)
  7781.             {
  7782.                 stream.createFrame(36);
  7783.                 stream.writeDWord(0);
  7784.                 anInt1288 = 0;
  7785.             }
  7786.             if(i == 0)
  7787.             {
  7788.                 stream.createFrame(164);
  7789.                 stream.writeWordBigEndian(k4 + k4 + 3);
  7790.             }
  7791.             if(i == 1)
  7792.             {
  7793.                 stream.createFrame(248);
  7794.                 stream.writeWordBigEndian(k4 + k4 + 3 + 14);
  7795.             }
  7796.             if(i == 2)
  7797.             {
  7798.                 stream.createFrame(98);
  7799.                 stream.writeWordBigEndian(k4 + k4 + 3);
  7800.             }
  7801.             stream.method433(k6 + baseX);
  7802.             destX = bigX[0];
  7803.             destY = bigY[0];
  7804.             for(int j7 = 1; j7 < k4; j7++)
  7805.             {
  7806.                 i4--;
  7807.                 stream.writeWordBigEndian(bigX[i4] - k6);
  7808.                 stream.writeWordBigEndian(bigY[i4] - i7);
  7809.             }
  7810.  
  7811.             stream.method431(i7 + baseY);
  7812.             stream.method424(super.keyArray[5] != 1 ? 0 : 1);
  7813.             return true;
  7814.         }
  7815.         return i != 1;
  7816.     }
  7817.  
  7818.     private void method86(Stream stream)
  7819.     {
  7820.         for(int j = 0; j < anInt893; j++)
  7821.         {
  7822.             int k = anIntArray894[j];
  7823.             NPC npc = npcArray[k];
  7824.             int l = stream.readUnsignedByte();
  7825.             if((l & 0x10) != 0)
  7826.             {
  7827.                 int i1 = stream.method434();
  7828.                 if(i1 == 65535)
  7829.                     i1 = -1;
  7830.                 int i2 = stream.readUnsignedByte();
  7831.                 if(i1 == npc.anim && i1 != -1)
  7832.                 {
  7833.                     int l2 = Animation.anims[i1].anInt365;
  7834.                     if(l2 == 1)
  7835.                     {
  7836.                         npc.anInt1527 = 0;
  7837.                         npc.anInt1528 = 0;
  7838.                         npc.anInt1529 = i2;
  7839.                         npc.anInt1530 = 0;
  7840.                     }
  7841.                     if(l2 == 2)
  7842.                         npc.anInt1530 = 0;
  7843.                 } else
  7844.                 if(i1 == -1 || npc.anim == -1 || Animation.anims[i1].anInt359 >= Animation.anims[npc.anim].anInt359)
  7845.                 {
  7846.                     npc.anim = i1;
  7847.                     npc.anInt1527 = 0;
  7848.                     npc.anInt1528 = 0;
  7849.                     npc.anInt1529 = i2;
  7850.                     npc.anInt1530 = 0;
  7851.                     npc.anInt1542 = npc.smallXYIndex;
  7852.                 }
  7853.             }
  7854.             if((l & 8) != 0)
  7855.             {
  7856.                 int damage = stream.method426();
  7857.                 int type = stream.method427();
  7858.                 int icon = stream.readUnsignedByte();
  7859.                 int focusNPC = stream.readUnsignedByte();
  7860.                 npc.updateHitData(type, damage, loopCycle, icon, 0, focusNPC);
  7861.                 npc.loopCycleStatus = loopCycle + 300;
  7862.                 npc.currentHealth = stream.method426();
  7863.                 npc.maxHealth = stream.readUnsignedByte();
  7864.             }
  7865.             if((l & 0x80) != 0)
  7866.             {
  7867.                 npc.anInt1520 = stream.readUnsignedWord();
  7868.                 int k1 = stream.readDWord();
  7869.                 npc.anInt1524 = k1 >> 16;
  7870.                 npc.anInt1523 = loopCycle + (k1 & 0xffff);
  7871.                 npc.anInt1521 = 0;
  7872.                 npc.anInt1522 = 0;
  7873.                 if(npc.anInt1523 > loopCycle)
  7874.                     npc.anInt1521 = -1;
  7875.                 if(npc.anInt1520 == 65535)
  7876.                     npc.anInt1520 = -1;
  7877.             }
  7878.             if((l & 0x20) != 0)
  7879.             {
  7880.                 npc.interactingEntity = stream.readUnsignedWord();
  7881.                 if(npc.interactingEntity == 65535)
  7882.                     npc.interactingEntity = -1;
  7883.             }
  7884.             if((l & 1) != 0)
  7885.             {
  7886.                 npc.textSpoken = stream.readString();
  7887.                 npc.textCycle = 100;
  7888.                 //entityMessage(npc);
  7889.             }
  7890.             if((l & 0x40) != 0)
  7891.             {
  7892.                 int damage = stream.method427();
  7893.                 int type = stream.method428();
  7894.                 int icon = stream.readUnsignedByte();
  7895.                 int focusNPC = stream.readUnsignedByte();
  7896.                 npc.updateHitData(type, damage, loopCycle, icon, 0, focusNPC);
  7897.                 npc.loopCycleStatus = loopCycle + 300;
  7898.                 npc.currentHealth = stream.method428();
  7899.                 npc.maxHealth = stream.method427();
  7900.             }
  7901.             if((l & 2) != 0)
  7902.             {
  7903.                 npc.desc = EntityDef.forID(stream.method436());
  7904.                 npc.anInt1540 = npc.desc.aByte68;
  7905.                 npc.anInt1504 = npc.desc.anInt79;
  7906.                 npc.anInt1554 = npc.desc.walkAnim;
  7907.                 npc.anInt1555 = npc.desc.anInt58;
  7908.                 npc.anInt1556 = npc.desc.anInt83;
  7909.                 npc.anInt1557 = npc.desc.anInt55;
  7910.                 npc.anInt1511 = npc.desc.standAnim;
  7911.             }
  7912.             if((l & 4) != 0)
  7913.             {
  7914.                 npc.anInt1538 = stream.method434();
  7915.                 npc.anInt1539 = stream.method434();
  7916.             }
  7917.         }
  7918.     }
  7919.  
  7920.     private void buildAtNPCMenu(EntityDef entityDef, int i, int j, int k)
  7921.     {
  7922.         if(menuActionRow >= 400)
  7923.             return;
  7924.         if(entityDef.childrenIDs != null)
  7925.             entityDef = entityDef.method161();
  7926.         if(entityDef == null)
  7927.             return;
  7928.         if(!entityDef.aBoolean84)
  7929.             return;
  7930.         String s = entityDef.name;
  7931.         if(entityDef.combatLevel != 0)
  7932.             s = s + combatDiffColor(myPlayer.combatLevel, entityDef.combatLevel) + " (level:" + entityDef.combatLevel + ")";
  7933.         if(summoningAttack) {
  7934.             menuActionName[menuActionRow] = "Use familiar attack with @whi@" + s;
  7935.             menuActionID[menuActionRow] = 582;
  7936.             menuActionCmd1[menuActionRow] = i;
  7937.             menuActionCmd2[menuActionRow] = k;
  7938.             menuActionCmd3[menuActionRow] = j;
  7939.             menuActionRow++;
  7940.             return;
  7941.         }
  7942.         if(itemSelected == 1)
  7943.         {
  7944.             menuActionName[menuActionRow] = "Use " + selectedItemName + " with @yel@" + s;
  7945.             menuActionID[menuActionRow] = 582;
  7946.             menuActionCmd1[menuActionRow] = i;
  7947.             menuActionCmd2[menuActionRow] = k;
  7948.             menuActionCmd3[menuActionRow] = j;
  7949.             menuActionRow++;
  7950.             return;
  7951.         }
  7952.         if(spellSelected == 1)
  7953.         {
  7954.             if((spellUsableOn & 2) == 2)
  7955.             {
  7956.                 menuActionName[menuActionRow] = spellTooltip + " @yel@" + s;
  7957.                 menuActionID[menuActionRow] = 413;
  7958.                 menuActionCmd1[menuActionRow] = i;
  7959.                 menuActionCmd2[menuActionRow] = k;
  7960.                 menuActionCmd3[menuActionRow] = j;
  7961.                 menuActionRow++;
  7962.             }
  7963.         } else
  7964.         {
  7965.             if(entityDef.itemActions != null)
  7966.             {
  7967.                 for(int l = 4; l >= 0; l--)
  7968.                     if(entityDef.itemActions[l] != null && !entityDef.itemActions[l].equalsIgnoreCase("attack"))
  7969.                     {
  7970.                         menuActionName[menuActionRow] = entityDef.itemActions[l] + " @yel@" + s;
  7971.                         if(l == 0)
  7972.                             menuActionID[menuActionRow] = 20;
  7973.                         if(l == 1)
  7974.                             menuActionID[menuActionRow] = 412;
  7975.                         if(l == 2)
  7976.                             menuActionID[menuActionRow] = 225;
  7977.                         if(l == 3)
  7978.                             menuActionID[menuActionRow] = 965;
  7979.                         if(l == 4)
  7980.                             menuActionID[menuActionRow] = 478;
  7981.                         menuActionCmd1[menuActionRow] = i;
  7982.                         menuActionCmd2[menuActionRow] = k;
  7983.                         menuActionCmd3[menuActionRow] = j;
  7984.                         menuActionRow++;
  7985.                     }
  7986.  
  7987.             }
  7988.             if(entityDef.itemActions != null)
  7989.             {
  7990.                 for(int i1 = 4; i1 >= 0; i1--)
  7991.                     if(entityDef.itemActions[i1] != null && entityDef.itemActions[i1].equalsIgnoreCase("attack"))
  7992.                     {
  7993.                         char c = '\0';
  7994.                         if(entityDef.combatLevel > myPlayer.combatLevel)
  7995.                             c = '\u07D0';
  7996.                         menuActionName[menuActionRow] = entityDef.itemActions[i1] + " @yel@" + s;
  7997.                         if(i1 == 0)
  7998.                             menuActionID[menuActionRow] = 20 + c;
  7999.                         if(i1 == 1)
  8000.                             menuActionID[menuActionRow] = 412 + c;
  8001.                         if(i1 == 2)
  8002.                             menuActionID[menuActionRow] = 225 + c;
  8003.                         if(i1 == 3)
  8004.                             menuActionID[menuActionRow] = 965 + c;
  8005.                         if(i1 == 4)
  8006.                             menuActionID[menuActionRow] = 478 + c;
  8007.                         menuActionCmd1[menuActionRow] = i;
  8008.                         menuActionCmd2[menuActionRow] = k;
  8009.                         menuActionCmd3[menuActionRow] = j;
  8010.                         menuActionRow++;
  8011.                     }
  8012.  
  8013.             }
  8014.             menuActionName[menuActionRow] = "Examine @yel@" + s + ((myPrivilege != 0) ? ", @gre@(@whi@" + entityDef.type + "@gre@)" : "");
  8015.             menuActionID[menuActionRow] = 1025;
  8016.             menuActionCmd1[menuActionRow] = i;
  8017.             menuActionCmd2[menuActionRow] = k;
  8018.             menuActionCmd3[menuActionRow] = j;
  8019.             menuActionRow++;
  8020.         }
  8021.     }
  8022.  
  8023.     private void buildAtPlayerMenu(int i, int j, Player player, int k)
  8024.     {
  8025.         if(player == myPlayer)
  8026.             return;
  8027.         if(menuActionRow >= 400)
  8028.             return;
  8029.         String s;
  8030.         if (player.skill == 0) {
  8031.             s = player.name
  8032.                     + combatDiffColor(myPlayer.combatLevel, player.combatLevel)
  8033.                     + " (level-" + player.combatLevel + ")";
  8034.         } else {
  8035.             s = "@or2@" + getRank(player.skill) + "@whi@ " + player.name
  8036.                     + combatDiffColor(myPlayer.combatLevel, player.combatLevel)
  8037.                     + " (level-" + player.combatLevel + ")";
  8038.         }
  8039.         if(summoningAttack) {
  8040.             menuActionName[menuActionRow] = "Use familiar attack with @whi@" + s;
  8041.             menuActionID[menuActionRow] = 491;
  8042.             menuActionCmd1[menuActionRow] = j;
  8043.             menuActionCmd2[menuActionRow] = i;
  8044.             menuActionCmd3[menuActionRow] = k;
  8045.             menuActionRow++;
  8046.         }
  8047.         if(itemSelected == 1)
  8048.         {
  8049.             menuActionName[menuActionRow] = "Use " + selectedItemName + " with @whi@" + s;
  8050.             menuActionID[menuActionRow] = 491;
  8051.             menuActionCmd1[menuActionRow] = j;
  8052.             menuActionCmd2[menuActionRow] = i;
  8053.             menuActionCmd3[menuActionRow] = k;
  8054.             menuActionRow++;
  8055.         } else
  8056.         {
  8057.             for(int index = 4; index >= 0; index--)
  8058.                 if(atPlayerActions[index] != null)
  8059.                 {
  8060.                     menuActionName[menuActionRow] = atPlayerActions[index] + " @whi@" + s;
  8061.                     char c = '\0';
  8062.                     if(atPlayerActions[index].equalsIgnoreCase("attack"))
  8063.                     {
  8064.                         if(player.combatLevel > myPlayer.combatLevel)
  8065.                             c = '\u07D0';
  8066.                         if(myPlayer.team != 0 && player.team != 0)
  8067.                             if(myPlayer.team == player.team)
  8068.                                 c = '\u07D0';
  8069.                             else
  8070.                                 c = '\0';
  8071.                     } else
  8072.                     if(atPlayerArray[index])
  8073.                         c = '\u07D0';
  8074.                     if(index == 0)
  8075.                         menuActionID[menuActionRow] = 561 + c;
  8076.                     if(index == 1)
  8077.                         menuActionID[menuActionRow] = 779 + c;
  8078.                     if(index == 2)
  8079.                         menuActionID[menuActionRow] = 27 + c;
  8080.                     if(index == 3)
  8081.                         menuActionID[menuActionRow] = 577 + c;
  8082.                     if(index == 4)
  8083.                         menuActionID[menuActionRow] = 729 + c;
  8084.                     menuActionCmd1[menuActionRow] = j;
  8085.                     menuActionCmd2[menuActionRow] = i;
  8086.                     menuActionCmd3[menuActionRow] = k;
  8087.                     menuActionRow++;
  8088.                 }
  8089.             if(spellSelected == 1)
  8090.             {
  8091.                 if((spellUsableOn & 8) == 8)
  8092.                 {
  8093.                     menuActionName[menuActionRow] = spellTooltip + " @whi@" + s;
  8094.                     menuActionID[menuActionRow] = 365;
  8095.                     menuActionCmd1[menuActionRow] = j;
  8096.                     menuActionCmd2[menuActionRow] = i;
  8097.                     menuActionCmd3[menuActionRow] = k;
  8098.                     menuActionRow++;
  8099.                 }
  8100.             }
  8101.         }
  8102.         for(int i1 = 0; i1 < menuActionRow; i1++)
  8103.             if(menuActionID[i1] == 516)
  8104.             {
  8105.                 menuActionName[i1] = "Walk here @whi@" + s;
  8106.                 return;
  8107.             }
  8108.  
  8109.     }
  8110.  
  8111.     private void method89(Class30_Sub1 class30_sub1)
  8112.     {
  8113.         int i = 0;
  8114.         int j = -1;
  8115.         int k = 0;
  8116.         int l = 0;
  8117.         if(class30_sub1.anInt1296 == 0)
  8118.             i = worldController.method300(class30_sub1.anInt1295, class30_sub1.anInt1297, class30_sub1.anInt1298);
  8119.         if(class30_sub1.anInt1296 == 1)
  8120.             i = worldController.method301(class30_sub1.anInt1295, class30_sub1.anInt1297, class30_sub1.anInt1298);
  8121.         if(class30_sub1.anInt1296 == 2)
  8122.             i = worldController.method302(class30_sub1.anInt1295, class30_sub1.anInt1297, class30_sub1.anInt1298);
  8123.         if(class30_sub1.anInt1296 == 3)
  8124.             i = worldController.method303(class30_sub1.anInt1295, class30_sub1.anInt1297, class30_sub1.anInt1298);
  8125.         if(i != 0)
  8126.         {
  8127.             int i1 = worldController.method304(class30_sub1.anInt1295, class30_sub1.anInt1297, class30_sub1.anInt1298, i);
  8128.             j = i >> 14 & 0x7fff;
  8129.             k = i1 & 0x1f;
  8130.             l = i1 >> 6;
  8131.         }
  8132.         class30_sub1.anInt1299 = j;
  8133.         class30_sub1.anInt1301 = k;
  8134.         class30_sub1.anInt1300 = l;
  8135.     }
  8136.  
  8137.     private void method90() {
  8138.         for (int i = 0; i < anInt1062; i++)
  8139.             if (anIntArray1250[i] <= 0) {
  8140.                 boolean flag1 = false;
  8141.                 try {
  8142.                     if (anIntArray1207[i] == anInt874
  8143.                             && anIntArray1241[i] == anInt1289) {
  8144.                         if (!replayWave())
  8145.                             flag1 = true;
  8146.                     } else {
  8147.                         Stream stream = Sounds.method241(anIntArray1241[i],
  8148.                                 anIntArray1207[i]);
  8149.                         if (System.currentTimeMillis()
  8150.                                 + (long) (stream.currentOffset / 22) > aLong1172
  8151.                                 + (long) (anInt1257 / 22)) {
  8152.                             anInt1257 = stream.currentOffset;
  8153.                             aLong1172 = System.currentTimeMillis();
  8154.                             if (saveWave(stream.buffer, stream.currentOffset)) {
  8155.                                 anInt874 = anIntArray1207[i];
  8156.                                 anInt1289 = anIntArray1241[i];
  8157.                             } else {
  8158.                                 flag1 = true;
  8159.                             }
  8160.                         }
  8161.                     }
  8162.                 } catch (Exception exception) {
  8163.                 }
  8164.                 if (!flag1 || anIntArray1250[i] == -5) {
  8165.                     anInt1062--;
  8166.                     for (int j = i; j < anInt1062; j++) {
  8167.                         anIntArray1207[j] = anIntArray1207[j + 1];
  8168.                         anIntArray1241[j] = anIntArray1241[j + 1];
  8169.                         anIntArray1250[j] = anIntArray1250[j + 1];
  8170.                     }
  8171.  
  8172.                     i--;
  8173.                 } else {
  8174.                     anIntArray1250[i] = -5;
  8175.                 }
  8176.             } else {
  8177.                 anIntArray1250[i]--;
  8178.             }
  8179.  
  8180.         if (prevSong > 0) {
  8181.             prevSong -= 20;
  8182.             if (prevSong < 0)
  8183.                 prevSong = 0;
  8184.             if (prevSong == 0 && musicEnabled && !lowMem) {
  8185.                 nextSong = currentSong;
  8186.                 songChanging = true;
  8187.                 onDemandFetcher.method558(2, nextSong);
  8188.             }
  8189.         }
  8190.     }
  8191.  
  8192.     private boolean replayWave() {
  8193.         return signlink.wavereplay();
  8194.     }
  8195.  
  8196.     private boolean saveWave(byte abyte0[], int i) {
  8197.         return abyte0 == null || signlink.wavesave(abyte0, i);
  8198.     }
  8199.  
  8200.     void startUp()
  8201.     {
  8202.         drawLoadingText(20, "Starting Client - Hold on..");
  8203.         new CacheDownloader(this).downloadCache();
  8204.         setNewMaps();
  8205.         //maps();
  8206.         //drawLoadingText(40, "Checking models");  
  8207.        
  8208.     if(signlink.sunjava)
  8209.             super.minDelay = 5;
  8210.         if(aBoolean993)
  8211.         {
  8212.  //        rsAlreadyLoaded = true;
  8213.  //        return;
  8214.         }
  8215.         aBoolean993 = true;
  8216.         boolean flag = true;
  8217.         String s = getDocumentBaseHost();
  8218.         if(signlink.cache_dat != null)
  8219.         {
  8220.             for(int i = 0; i < 5; i++)
  8221.                 decompressors[i] = new Decompressor(signlink.cache_dat, signlink.cache_idx[i], i + 1);
  8222.         }
  8223.         try {
  8224.        
  8225.             titleStreamLoader = streamLoaderForName(1, "title screen", "title", expectedCRCs[1], 25);
  8226.             smallFont = new TextDrawingArea(false, "p11_full", titleStreamLoader);
  8227.             normalFont = new TextDrawingArea(false, "p12_full", titleStreamLoader);
  8228.             boldFont = new TextDrawingArea(false, "b12_full", titleStreamLoader);
  8229.             fancyFont = new TextDrawingArea(true, "q8_full", titleStreamLoader);//new CLIENT*/
  8230.  
  8231.  
  8232.             bigHit = new TextDrawingArea(true, "critical_full", titleStreamLoader);
  8233.             newSmallFont = new RSFont(false, "p11_full", titleStreamLoader);
  8234.             newRegularFont = new RSFont(false, "p12_full", titleStreamLoader);
  8235.             newBoldFont = new RSFont(false, "b12_full", titleStreamLoader);
  8236.             newFancyFont = new RSFont(true, "q8_full", titleStreamLoader);
  8237.             newSmallFont.unpackChatImages(chatImages);
  8238.             newRegularFont.unpackChatImages(chatImages);
  8239.             newBoldFont.unpackChatImages(chatImages);
  8240.             newFancyFont.unpackChatImages(chatImages);
  8241.             drawLogo();
  8242.             loadTitleScreen();
  8243.             StreamLoader configArchive = streamLoaderForName(2, "config", "config", expectedCRCs[2], 30);
  8244.             StreamLoader interfaceArchive = streamLoaderForName(3, "interface", "interface", expectedCRCs[3], 35);
  8245.             StreamLoader mediaArchive = streamLoaderForName(4, "2d graphics", "media", expectedCRCs[4], 40);
  8246.             StreamLoader textureArchive = streamLoaderForName(6, "textures", "textures", expectedCRCs[6], 45);
  8247.             StreamLoader chatFilterArchive = streamLoaderForName(7, "chat system", "wordenc", expectedCRCs[7], 50);
  8248.             StreamLoader soundArchive = streamLoaderForName(8, "sound effects", "sounds", expectedCRCs[8], 55);
  8249.                         for (int l4 = 0; l4 < 2; l4++) {
  8250.                 chatImages[l4] = new Sprite(mediaArchive, "mod_icons", l4);
  8251.             }
  8252.             byteGroundArray = new byte[4][104][104];
  8253.             intGroundArray = new int[4][105][105];
  8254.             worldController = new WorldController(intGroundArray);
  8255.             for(int j = 0; j < 4; j++)
  8256.                 aClass11Array1230[j] = new Class11();
  8257.             miniMapImage = new Sprite(512, 512);
  8258.             StreamLoader streamLoader_6 = streamLoaderForName(5, "update list", "versionlist", expectedCRCs[5], 60);
  8259.             drawLoadingText(60, "");
  8260.            
  8261.         //  maps();
  8262.         //  repackCacheIndex(4);
  8263.             onDemandFetcher = new OnDemandFetcher();
  8264.             onDemandFetcher.start(streamLoader_6, this);
  8265.             Class36.method528(onDemandFetcher.getAnimCount());
  8266.             Model.method459(onDemandFetcher.getModelCount(), onDemandFetcher);
  8267.             preloadModels();
  8268.             if(!lowMem) {
  8269.                 //nextSong = 0;
  8270.                 //try {
  8271.                 //  nextSong = Integer.parseInt(getParameter("music"));
  8272.                 //  stopMidi();
  8273.                 //}
  8274.  
  8275.                 //catch(Exception _ex) { }
  8276.                 //songChanging = true;
  8277.                 //onDemandFetcher.method558(2, nextSong);
  8278.                 //stopMidi();
  8279.                 while(onDemandFetcher.getNodeCount() > 0) {
  8280.                     processOnDemandQueue();
  8281.                     try {
  8282.                         Thread.sleep(100L);
  8283.                     } catch(Exception _ex) {
  8284.                    
  8285.                     }
  8286.                     if(onDemandFetcher.anInt1349 > 3) {
  8287.                         loadError();
  8288.                         return;
  8289.                     }
  8290.                 }
  8291.             }
  8292.             drawLoadingText(65, "");
  8293.             DataBase.loadAnimations();
  8294.             drawLoadingText(70, "");
  8295.             //models();
  8296.             //DataBase.loadObjects(); //Just checking somthing
  8297.             //DataBase.loadModels();
  8298.             drawLoadingText(80, "");
  8299.             /* Custom sprite unpacking */
  8300.                             loginBox = new Sprite("title");
  8301.                 loginBoxHover = new Sprite("box_hover");
  8302.                 loginHover = new Sprite("login_hover");
  8303.                 loginHoverWorld = new Sprite("login_hover2");
  8304.             infinityIcon = new Sprite("infinity");
  8305.             for(int ig = 0; ig < chatArea.length; ig++)
  8306.                 chatArea[ig] = new Sprite("chatarea " + ig);
  8307.             for(int iiig = 0; iiig < tabArea.length; iiig++)
  8308.                 tabArea[iiig] = new Sprite("tabarea " + iiig);
  8309.            
  8310.             HPBarFull = new Sprite("HITPOINTS_0");
  8311.             HPBarEmpty = new Sprite("HITPOINTS_1");
  8312.            
  8313.             mapArea = new Sprite("maparea");
  8314.             backgroundFix = new Sprite("background");
  8315.             magicAuto = new Sprite("autocast");
  8316.             loadOrbs();
  8317.             multiOverlay = new Sprite(mediaArchive, "overlay_multiway", 0);
  8318.             /**/
  8319.             for(int i = 0; i < mapBack.length; i++)
  8320.                 mapBack[i] = new Background(mediaArchive, "mapback", i);
  8321.            
  8322.             for(int j5 = 0; j5 < tabAreaSprite.length; j5++)
  8323.                 tabAreaSprite[j5] = new Sprite("tabarea " + j5);
  8324.                
  8325.             for(int c1 = 0; c1 <= 3; c1++)
  8326.                 chatButtons[c1] = new Sprite(mediaArchive, "chatbuttons", c1);
  8327.                
  8328.             for(int loop = 0; loop < inventoryStones.length; loop++)
  8329.                 inventoryStones[loop] = new Sprite("sideicon/inventorystones " + loop);
  8330.                
  8331.             for(int j3 = 0; j3 < sideIcons.length; j3++)
  8332.                 sideIcons[j3] = new Sprite("sideicon/sideicons " + j3);
  8333.             compass = new Sprite(mediaArchive, "compass", 0);
  8334.  
  8335.             for(int j78 = 0; j78 < exitButton.length; j78++)
  8336.                 exitButton[j78] = new Sprite("exit " + j78);
  8337.  
  8338.             for(int j79 = 0; j79 < advisorButton.length; j79++)
  8339.                 advisorButton[j79] = new Sprite("advisor " + j79);
  8340.            
  8341.             for(int ghtr = 0; ghtr < worldMapIcon.length; ghtr++)
  8342.                 worldMapIcon[ghtr] = new Sprite("mapIcon " + ghtr);
  8343.            
  8344.             for(int i4 = 0; i4 < hitMarkBacks.length; i4++)
  8345.                 for(int i5 = 0; i5 < hitMarkBacks[0].length; i5++)
  8346.                     for(int i6 = 0; i6 < hitMarkBacks[0][0].length; i6++)
  8347.                         hitMarkBacks[i4][i5][i6] = new Sprite("/hits/back/" + i4 + "/"+ i5 +"/hit " + i6);
  8348.                
  8349.             for(int i4 = 0; i4 < hitMarkIcons.length; i4++)
  8350.                 hitMarkIcons[i4] = new Sprite("/Hits/icons/icon " + i4);
  8351.            
  8352.             emptyOrb = new Sprite("emptyorb");
  8353.             emptyFOrb = new Sprite("emptyforb");
  8354.             hoveredEmpty = new Sprite("hoveredempty");
  8355.             hoveredFEmpty = new Sprite("hoveredfempty");
  8356.             runIcon1 = new Sprite("runicon1");
  8357.             runIcon2 = new Sprite("runicon2");
  8358.             runOrb1 = new Sprite("runorb1");
  8359.             runOrb2 = new Sprite("runorb2");
  8360.             hitPointsFill = new Sprite("hitpointsfill");
  8361.             hitPointsIcon = new Sprite("hitpointsicon");
  8362.             prayerFill = new Sprite("prayerfill");
  8363.             prayerIcon = new Sprite("prayericon");
  8364.             mapEdge = new Sprite(mediaArchive, "mapedge", 0);
  8365.             mapEdge.method345();
  8366.             try
  8367.             {
  8368.                 for(int i = 0; i < XPcounterSprite.length; i++)
  8369.                     XPcounterSprite[i] = new Sprite("xp/XP " + i);
  8370.             }
  8371.             catch(Exception _ex) {}
  8372.             try
  8373.             {
  8374.                 for(int k3 = 0; k3 < 100; k3++)
  8375.                     mapScenes[k3] = new Background(mediaArchive, "mapscene", k3);
  8376.             }
  8377.             catch(Exception _ex) { }
  8378.             try
  8379.             {
  8380.                 for(int l3 = 0; l3 < 100; l3++)
  8381.                     mapFunctions[l3] = new Sprite(mediaArchive, "mapfunction", l3);
  8382.             }
  8383.             catch(Exception _ex) { }
  8384.             try
  8385.             {
  8386.                 for(int h1 = 0; h1 < 6; h1++)
  8387.                     headIconsHint[h1] = new Sprite(mediaArchive, "headicons_hint", h1);
  8388.             } catch(Exception _ex) { }
  8389.             try {
  8390.                 for(int j4 = 0; j4 < 18; j4++)
  8391.                     //headIcons[j4] = new Sprite(mediaArchive, "headicons_prayer", j4);
  8392.                     headIcons[j4] = new Sprite("curses/Prayer "+j4);
  8393.                 for(int j45 = 0; j45 < 3; j45++)
  8394.                     skullIcons[j45] = new Sprite(mediaArchive, "headicons_pk", j45 );
  8395.                 for(int j45 = 9; j45 < 17; j45++)
  8396.                     cursesIcons[j45] = new Sprite("curses/Prayer "+j45);               
  8397.                    
  8398.             }
  8399.             catch(Exception _ex) { }
  8400.             mapFlag = new Sprite(mediaArchive, "mapmarker", 0);
  8401.             mapMarker = new Sprite(mediaArchive, "mapmarker", 1);
  8402.             for(int k4 = 0; k4 < 8; k4++)
  8403.                 crosses[k4] = new Sprite(mediaArchive, "cross", k4);
  8404.  
  8405.             mapDotItem = new Sprite(mediaArchive, "mapdots", 0);
  8406.             mapDotNPC = new Sprite(mediaArchive, "mapdots", 1);
  8407.             mapDotPlayer = new Sprite(mediaArchive, "mapdots", 2);
  8408.             mapDotFriend = new Sprite(mediaArchive, "mapdots", 3);
  8409.             mapDotTeam = new Sprite(mediaArchive, "mapdots", 4);
  8410.             mapDotClan = new Sprite(mediaArchive, "mapdots", 5);
  8411.                         alertBack = new Sprite("alertback");
  8412.             alertBorder = new Sprite("alertborder");
  8413.             alertBorderH = new Sprite("alertborderh");
  8414.  
  8415.             for(int loop = 0; loop < scrollBar.length; loop++)
  8416.                 scrollBar[loop] = new Sprite("./scrollbar/scrollbar " + loop);
  8417.            
  8418.             for(int loop = 0; loop < scrollArrow.length; loop++)
  8419.                 scrollArrow[loop] = new Sprite("./scrollbar/scrollArrow " + loop);
  8420.            
  8421.             rightFrameSprite = new Sprite(mediaArchive, "screenframe", 2);
  8422.            
  8423.             for(int l4 = 0; l4 < modIcons.length; l4++)
  8424.                 modIcons[l4] = new Background(mediaArchive, "mod_icons", l4);
  8425.  
  8426.             Sprite sprite = new Sprite(mediaArchive, "screenframe", 0);
  8427.             leftFrame = new RSImageProducer(sprite.myWidth, sprite.myHeight, getGameComponent());
  8428.             sprite.method346(0, 0);
  8429.             sprite = new Sprite(mediaArchive, "screenframe", 1);
  8430.             topFrame = new RSImageProducer(sprite.myWidth, sprite.myHeight, getGameComponent());
  8431.             sprite.method346(0, 0);
  8432.             sprite = new Sprite(mediaArchive, "mapedge", 0);
  8433.             mapEdgeIP = new RSImageProducer(sprite.myWidth, sprite.myHeight, getGameComponent());
  8434.             sprite.method346(0, 0);
  8435.  
  8436.             int i5 = (int)(Math.random() * 21D) - 10;
  8437.             int j5 = (int)(Math.random() * 21D) - 10;
  8438.             int k5 = (int)(Math.random() * 21D) - 10;
  8439.             int l5 = (int)(Math.random() * 41D) - 20;
  8440.             for(int functionIndex = 0; functionIndex < 100; functionIndex++) {
  8441.                 if(mapFunctions[functionIndex] != null)
  8442.                     mapFunctions[functionIndex].method344(i5 + l5, j5 + l5, k5 + l5);
  8443.                 if(mapScenes[functionIndex] != null)
  8444.                     mapScenes[functionIndex].method360(i5 + l5, j5 + l5, k5 + l5);
  8445.             }
  8446.             drawLoadingText(82, "");
  8447.             drawLoadingText(86, "");
  8448.             Texture.method368(textureArchive);
  8449.             Texture.method372(0.80000000000000004D);
  8450.             Texture.method367();
  8451.             drawLoadingText(88, "");
  8452.             Animation.unpackConfig(configArchive);
  8453.             ObjectDef.unpackConfig(configArchive);
  8454.             Flo.unpackConfig(configArchive);
  8455.             ItemDef.unpackConfig(configArchive);
  8456.             EntityDef.unpackConfig(configArchive);
  8457.             IDK.unpackConfig(configArchive);
  8458.             SpotAnim.unpackConfig(configArchive);
  8459.             Varp.unpackConfig(configArchive);
  8460.             VarBit.unpackConfig(configArchive);
  8461.             ItemDef.isMembers = isMembers;
  8462.             if(!lowMem)
  8463.             {
  8464.                 drawLoadingText(90, "");
  8465.                 byte abyte0[] = soundArchive.getDataForName("sounds.dat");
  8466.                
  8467.                 Stream stream = new Stream(abyte0);
  8468.                 Sounds.unpack(stream);
  8469.                
  8470.             }
  8471.             drawLoadingText(93, "");
  8472.             TextDrawingArea allFonts[] = {
  8473.                     smallFont, normalFont, boldFont, fancyFont
  8474.             };
  8475. /*RSFont allFonts[] = { NEW INTERFACES TEXT ENGINE
  8476.                     newSmallFont, newRegularFont, newBoldFont, newFancyFont
  8477.             };*/
  8478.             RSInterface.fonts = allFonts;
  8479.             RSInterface.unpack(interfaceArchive, allFonts, mediaArchive);
  8480.             drawLoadingText(97, "");
  8481.             RSInterface.unpackCustom(interfaceArchive, allFonts);
  8482.             /*
  8483.             //Taken this out, causing seirous lag -.-
  8484.             for(int derp = 0; derp < 25000; derp++)
  8485.             {
  8486.                 ItemDef itemdef = ItemDef.forID(derp);
  8487.                 writeTemp(itemdef.name);
  8488.             }*/
  8489.             drawLoadingText(100, "");
  8490.             readDetails();
  8491.             renderMapAndCompassHalfs();
  8492.             load3DArea();
  8493.             Censor.loadConfig(chatFilterArchive);
  8494.             mouseDetection = new MouseDetection(this);
  8495.             startRunnable(mouseDetection, 10);
  8496.             Animable_Sub5.clientInstance = this;
  8497.             ObjectDef.clientInstance = this;
  8498.             EntityDef.clientInstance = this;
  8499.             System.gc();
  8500.             return;
  8501.         } catch(Exception exception) {
  8502.             signlink.reporterror("loaderror " + aString1049 + " " + anInt1079);
  8503.             exception.printStackTrace();
  8504.         }
  8505.         loadingError = true;
  8506.     }
  8507.    
  8508.     public void renderMapAndCompassHalfs() {
  8509.         for(int loopHeight = 0; loopHeight < 33; loopHeight++) {
  8510.             int k6 = 999;
  8511.             int loopWidth = 0;
  8512.             for(; loopWidth < 33; loopWidth++) {
  8513.                 if(mapBack[2].aByteArray1450[loopWidth + loopHeight * 33] == 0) {
  8514.                     if(k6 == 999)
  8515.                         k6 = loopWidth;
  8516.                     continue;
  8517.                 }
  8518.                 if(k6 == 999)
  8519.                     continue;
  8520.                 break;
  8521.             }
  8522.             compassPixelCutLeft[loopHeight] = k6;//left ( it's heigth)
  8523.             compassPixelCutRight[loopHeight] = loopWidth - k6;//right (it's width)
  8524.         }
  8525.         for(int loopHeight = 0; loopHeight < 152; loopHeight++) {
  8526.             int j7 = 999;
  8527.             int finalWidth = 0;
  8528.             for(int loopWidth = 0; loopWidth < 152; loopWidth++) {
  8529.                 if(mapBack[1].aByteArray1450[loopWidth + loopHeight * 152] == 0) {
  8530.                     if(j7 == 999)
  8531.                         j7 = loopWidth;
  8532.                     continue;
  8533.                 }
  8534.                 if(j7 == 999)
  8535.                     continue;
  8536.                 finalWidth = loopWidth;//999 - 999 = 0
  8537.                 break;
  8538.             }
  8539.  
  8540.             mapImagePixelCutLeft[loopHeight - 0] = j7 - 0;
  8541.             if((finalWidth - j7) == 0) {
  8542.                 finalWidth = 152;
  8543.                 j7 = 0;
  8544.             }
  8545.             mapImagePixelCutRight[loopHeight - 0] = finalWidth - j7;
  8546.         }
  8547.     }
  8548.    
  8549.     public static void writeTemp(String tempData) {
  8550.         try {
  8551.             BufferedWriter bw = new BufferedWriter(new FileWriter("./derp.txt", true));
  8552.             bw.write(tempData);
  8553.             bw.newLine();
  8554.             bw.flush();
  8555.         } catch(IOException IOE) {}
  8556.     }
  8557.    
  8558.     private void method91(Stream stream, int i)
  8559.     {
  8560.         while(stream.bitPosition + 10 < i * 8)
  8561.         {
  8562.             int j = stream.readBits(11);
  8563.             if(j == 2047)
  8564.                 break;
  8565.             if(playerArray[j] == null)
  8566.             {
  8567.                 playerArray[j] = new Player();
  8568.                 if(aStreamArray895s[j] != null)
  8569.                     playerArray[j].updatePlayer(aStreamArray895s[j]);
  8570.             }
  8571.             playerIndices[playerCount++] = j;
  8572.             Player player = playerArray[j];
  8573.             player.anInt1537 = loopCycle;
  8574.             int k = stream.readBits(1);
  8575.             if(k == 1)
  8576.                 anIntArray894[anInt893++] = j;
  8577.             int l = stream.readBits(1);
  8578.             int i1 = stream.readBits(5);
  8579.             if(i1 > 15)
  8580.                 i1 -= 32;
  8581.             int j1 = stream.readBits(5);
  8582.             if(j1 > 15)
  8583.                 j1 -= 32;
  8584.             player.setPos(myPlayer.smallX[0] + j1, myPlayer.smallY[0] + i1, l == 1);
  8585.         }
  8586.         stream.finishBitAccess();
  8587.     }
  8588.  
  8589.     private int mapDrawAreaX = 0;
  8590.     private int mapDrawAreaY = 516;
  8591.     private int mapPaddingFromTop = toggleFullscreen ? 5 : 9;
  8592.     private int mapPaddingFromLeft = toggleFullscreen ? 5 : 35;
  8593.     private int mapPaddingFromBottom = toggleFullscreen ? 5 : 7;
  8594.     private int mapPaddingFromRight = toggleFullscreen ? 5 : 62;
  8595.     private int miniMapWidth = toggleFullscreen ? 163 : 249;//172
  8596.     private int miniMapHeight = toggleFullscreen ? 163 : 168;//156
  8597.     private int mapSpritesX = 107;
  8598.     private int mapSpritesY = 88;
  8599.     private int mapMovedX = 29;
  8600.     private int mapMovedY = 4;
  8601.    
  8602.     int mapInnerSizeWidth = miniMapWidth - (mapPaddingFromLeft + mapPaddingFromRight);
  8603.     int mapInnerSizeHeight = miniMapHeight - (mapPaddingFromTop + mapPaddingFromBottom);
  8604.    
  8605.     private void processMinimapClick(int paddingX,int paddingY) {
  8606.         if(minimapCover != 0)
  8607.             return;
  8608.         if(super.clickMode3 == 1)
  8609.         {
  8610.             int mapClickX = super.saveClickX - mapPaddingFromLeft - mapDrawAreaY -  paddingX;
  8611.             int mapClickY = super.saveClickY - mapPaddingFromTop - mapDrawAreaX -  paddingY;
  8612.             if(mapClickX >= 0 && mapClickY >= 0 && mapClickX < mapInnerSizeWidth && mapClickY < mapInnerSizeHeight)
  8613.             {
  8614.                 mapClickX -= 73;
  8615.                 mapClickY -= 75;
  8616.                 int k = compassRotation + mapAmtDiffRotation & 0x7ff;
  8617.                 int i1 = Texture.anIntArray1470[k];
  8618.                 int j1 = Texture.anIntArray1471[k];
  8619.                 i1 = i1 * (mapAmtDiffZoom + 256) >> 8;
  8620.                 j1 = j1 * (mapAmtDiffZoom + 256) >> 8;
  8621.                 int k1 = mapClickY * i1 + mapClickX * j1 >> 11;
  8622.                 int l1 = mapClickY * j1 - mapClickX * i1 >> 11;
  8623.                 int i2 = myPlayer.x + k1 >> 7;
  8624.                 int j2 = myPlayer.y - l1 >> 7;
  8625.                 boolean flag1 = doWalkTo(1, 0, 0, 0, myPlayer.smallY[0], 0, 0, j2, myPlayer.smallX[0], true, i2);
  8626.                 if(flag1)
  8627.                 {
  8628.                     stream.writeWordBigEndian(mapClickX);
  8629.                     stream.writeWordBigEndian(mapClickY);
  8630.                     stream.writeWord(compassRotation);
  8631.                     stream.writeWordBigEndian(57);
  8632.                     stream.writeWordBigEndian(mapAmtDiffRotation);
  8633.                     stream.writeWordBigEndian(mapAmtDiffZoom);
  8634.                     stream.writeWordBigEndian(89);
  8635.                     stream.writeWord(myPlayer.x);
  8636.                     stream.writeWord(myPlayer.y);
  8637.                     stream.writeWordBigEndian(anInt1264);
  8638.                     stream.writeWordBigEndian(63);
  8639.                 }
  8640.             }
  8641.             anInt1117++;
  8642.             if(anInt1117 > 1151)
  8643.             {
  8644.                 anInt1117 = 0;
  8645.                 stream.createFrame(246);
  8646.                 stream.writeWordBigEndian(0);
  8647.                 int l = stream.currentOffset;
  8648.                 if((int)(Math.random() * 2D) == 0)
  8649.                     stream.writeWordBigEndian(101);
  8650.                 stream.writeWordBigEndian(197);
  8651.                 stream.writeWord((int)(Math.random() * 65536D));
  8652.                 stream.writeWordBigEndian((int)(Math.random() * 256D));
  8653.                 stream.writeWordBigEndian(67);
  8654.                 stream.writeWord(14214);
  8655.                 if((int)(Math.random() * 2D) == 0)
  8656.                     stream.writeWord(29487);
  8657.                 stream.writeWord((int)(Math.random() * 65536D));
  8658.                 if((int)(Math.random() * 2D) == 0)
  8659.                     stream.writeWordBigEndian(220);
  8660.                 stream.writeWordBigEndian(180);
  8661.                 stream.writeBytes(stream.currentOffset - l);
  8662.             }
  8663.         }
  8664.     }
  8665.  
  8666.     private String interfaceIntToString(int j) {
  8667.         if(j < 0x3b9ac9ff)
  8668.             return String.valueOf(j);
  8669.         else
  8670.             return "*";
  8671.     }
  8672.  
  8673.     private void showErrorScreen()
  8674.     {
  8675.         Graphics g = getGameComponent().getGraphics();
  8676.         g.setColor(Color.black);
  8677.         g.fillRect(0, 0, 765, 503);
  8678.         method4(1);
  8679.         if(loadingError)
  8680.         {
  8681.             aBoolean831 = false;
  8682.             g.setFont(new Font("Helvetica", 1, 16));
  8683.             g.setColor(Color.yellow);
  8684.             int k = 35;
  8685.             g.drawString("Sorry, an error has occured whilst loading RuneScape", 30, k);
  8686.             k += 50;
  8687.             g.setColor(Color.white);
  8688.             g.drawString("To fix this try the following (in order):", 30, k);
  8689.             k += 50;
  8690.             g.setColor(Color.white);
  8691.             g.setFont(new Font("Helvetica", 1, 12));
  8692.             g.drawString("1: Try closing ALL open web-browser windows, and reloading", 30, k);
  8693.             k += 30;
  8694.             g.drawString("2: Try clearing your web-browsers cache from tools->internet options", 30, k);
  8695.             k += 30;
  8696.             g.drawString("3: Try using a different game-world", 30, k);
  8697.             k += 30;
  8698.             g.drawString("4: Try rebooting your computer", 30, k);
  8699.             k += 30;
  8700.             g.drawString("5: Try selecting a different version of Java from the play-game menu", 30, k);
  8701.         }
  8702.         if(genericLoadingError)
  8703.         {
  8704.             aBoolean831 = false;
  8705.             g.setFont(new Font("Helvetica", 1, 20));
  8706.             g.setColor(Color.white);
  8707.             g.drawString("Error - unable to load game!", 50, 50);
  8708.             g.drawString("To play RuneScape make sure you play from", 50, 100);
  8709.             g.drawString("http://www.runescape.com", 50, 150);
  8710.         }
  8711.         if(rsAlreadyLoaded)
  8712.         {
  8713.             aBoolean831 = false;
  8714.             g.setColor(Color.yellow);
  8715.             int l = 35;
  8716.             g.drawString("Error a copy of RuneScape already appears to be loaded", 30, l);
  8717.             l += 50;
  8718.             g.setColor(Color.white);
  8719.             g.drawString("To fix this try the following (in order):", 30, l);
  8720.             l += 50;
  8721.             g.setColor(Color.white);
  8722.             g.setFont(new Font("Helvetica", 1, 12));
  8723.             g.drawString("1: Try closing ALL open web-browser windows, and reloading", 30, l);
  8724.             l += 30;
  8725.             g.drawString("2: Try rebooting your computer, and reloading", 30, l);
  8726.             l += 30;
  8727.         }
  8728.     }
  8729.  
  8730.     public URL getCodeBase() {     
  8731.         try {
  8732.             return new URL(serverip +":" + (80 + portOff));
  8733.         } catch(Exception _ex) {
  8734.         }
  8735.         return null;
  8736.     }
  8737.  
  8738.     private void method95() {
  8739.         for(int j = 0; j < npcCount; j++) {
  8740.             int k = npcIndices[j];
  8741.             NPC npc = npcArray[k];
  8742.             if(npc != null)
  8743.                 method96(npc);
  8744.         }
  8745.     }
  8746.  
  8747.     private void method96(Entity entity)
  8748.     {
  8749.         if(entity.x < 128 || entity.y < 128 || entity.x >= 13184 || entity.y >= 13184)
  8750.         {
  8751.             entity.anim = -1;
  8752.             entity.anInt1520 = -1;
  8753.             entity.anInt1547 = 0;
  8754.             entity.anInt1548 = 0;
  8755.             entity.x = entity.smallX[0] * 128 + entity.anInt1540 * 64;
  8756.             entity.y = entity.smallY[0] * 128 + entity.anInt1540 * 64;
  8757.             entity.method446();
  8758.         }
  8759.         if(entity == myPlayer && (entity.x < 1536 || entity.y < 1536 || entity.x >= 11776 || entity.y >= 11776))
  8760.         {
  8761.             entity.anim = -1;
  8762.             entity.anInt1520 = -1;
  8763.             entity.anInt1547 = 0;
  8764.             entity.anInt1548 = 0;
  8765.             entity.x = entity.smallX[0] * 128 + entity.anInt1540 * 64;
  8766.             entity.y = entity.smallY[0] * 128 + entity.anInt1540 * 64;
  8767.             entity.method446();
  8768.         }
  8769.         if(entity.anInt1547 > loopCycle)
  8770.             method97(entity);
  8771.         else
  8772.         if(entity.anInt1548 >= loopCycle)
  8773.             method98(entity);
  8774.         else
  8775.             method99(entity);
  8776.         method100(entity);
  8777.         method101(entity);
  8778.     }
  8779.  
  8780.     private void method97(Entity entity)
  8781.     {
  8782.         int i = entity.anInt1547 - loopCycle;
  8783.         int j = entity.anInt1543 * 128 + entity.anInt1540 * 64;
  8784.         int k = entity.anInt1545 * 128 + entity.anInt1540 * 64;
  8785.         entity.x += (j - entity.x) / i;
  8786.         entity.y += (k - entity.y) / i;
  8787.         entity.anInt1503 = 0;
  8788.         if(entity.anInt1549 == 0)
  8789.             entity.turnDirection = 1024;
  8790.         if(entity.anInt1549 == 1)
  8791.             entity.turnDirection = 1536;
  8792.         if(entity.anInt1549 == 2)
  8793.             entity.turnDirection = 0;
  8794.         if(entity.anInt1549 == 3)
  8795.             entity.turnDirection = 512;
  8796.     }
  8797.  
  8798.     private void method98(Entity entity)
  8799.     {
  8800.         if(entity.anInt1548 == loopCycle || entity.anim == -1 || entity.anInt1529 != 0 || entity.anInt1528 + 1 > Animation.anims[entity.anim].method258(entity.anInt1527))
  8801.         {
  8802.             int i = entity.anInt1548 - entity.anInt1547;
  8803.             int j = loopCycle - entity.anInt1547;
  8804.             int k = entity.anInt1543 * 128 + entity.anInt1540 * 64;
  8805.             int l = entity.anInt1545 * 128 + entity.anInt1540 * 64;
  8806.             int i1 = entity.anInt1544 * 128 + entity.anInt1540 * 64;
  8807.             int j1 = entity.anInt1546 * 128 + entity.anInt1540 * 64;
  8808.             entity.x = (k * (i - j) + i1 * j) / i;
  8809.             entity.y = (l * (i - j) + j1 * j) / i;
  8810.         }
  8811.         entity.anInt1503 = 0;
  8812.         if(entity.anInt1549 == 0)
  8813.             entity.turnDirection = 1024;
  8814.         if(entity.anInt1549 == 1)
  8815.             entity.turnDirection = 1536;
  8816.         if(entity.anInt1549 == 2)
  8817.             entity.turnDirection = 0;
  8818.         if(entity.anInt1549 == 3)
  8819.             entity.turnDirection = 512;
  8820.         entity.anInt1552 = entity.turnDirection;
  8821.     }
  8822.  
  8823.     private void method99(Entity entity)
  8824.     {
  8825.         entity.anInt1517 = entity.anInt1511;
  8826.         if(entity.smallXYIndex == 0)
  8827.         {
  8828.             entity.anInt1503 = 0;
  8829.             return;
  8830.         }
  8831.         if(entity.anim != -1 && entity.anInt1529 == 0)
  8832.         {
  8833.             Animation animation = Animation.anims[entity.anim];
  8834.             if(entity.anInt1542 > 0 && animation.anInt363 == 0)
  8835.             {
  8836.                 entity.anInt1503++;
  8837.                 return;
  8838.             }
  8839.             if(entity.anInt1542 <= 0 && animation.anInt364 == 0)
  8840.             {
  8841.                 entity.anInt1503++;
  8842.                 return;
  8843.             }
  8844.         }
  8845.         int i = entity.x;
  8846.         int j = entity.y;
  8847.         int k = entity.smallX[entity.smallXYIndex - 1] * 128 + entity.anInt1540 * 64;
  8848.         int l = entity.smallY[entity.smallXYIndex - 1] * 128 + entity.anInt1540 * 64;
  8849.         if(k - i > 256 || k - i < -256 || l - j > 256 || l - j < -256)
  8850.         {
  8851.             entity.x = k;
  8852.             entity.y = l;
  8853.             return;
  8854.         }
  8855.         if(i < k)
  8856.         {
  8857.             if(j < l)
  8858.                 entity.turnDirection = 1280;
  8859.             else
  8860.             if(j > l)
  8861.                 entity.turnDirection = 1792;
  8862.             else
  8863.                 entity.turnDirection = 1536;
  8864.         } else
  8865.         if(i > k)
  8866.         {
  8867.             if(j < l)
  8868.                 entity.turnDirection = 768;
  8869.             else
  8870.             if(j > l)
  8871.                 entity.turnDirection = 256;
  8872.             else
  8873.                 entity.turnDirection = 512;
  8874.         } else
  8875.         if(j < l)
  8876.             entity.turnDirection = 1024;
  8877.         else
  8878.             entity.turnDirection = 0;
  8879.         int i1 = entity.turnDirection - entity.anInt1552 & 0x7ff;
  8880.         if(i1 > 1024)
  8881.             i1 -= 2048;
  8882.         int j1 = entity.anInt1555;
  8883.         if(i1 >= -256 && i1 <= 256)
  8884.             j1 = entity.anInt1554;
  8885.         else
  8886.         if(i1 >= 256 && i1 < 768)
  8887.             j1 = entity.anInt1557;
  8888.         else
  8889.         if(i1 >= -768 && i1 <= -256)
  8890.             j1 = entity.anInt1556;
  8891.         if(j1 == -1)
  8892.             j1 = entity.anInt1554;
  8893.         entity.anInt1517 = j1;
  8894.         int k1 = 4;
  8895.         if(entity.anInt1552 != entity.turnDirection && entity.interactingEntity == -1 && entity.anInt1504 != 0)
  8896.             k1 = 2;
  8897.         if(entity.smallXYIndex > 2)
  8898.             k1 = 6;
  8899.         if(entity.smallXYIndex > 3)
  8900.             k1 = 8;
  8901.         if(entity.anInt1503 > 0 && entity.smallXYIndex > 1)
  8902.         {
  8903.             k1 = 8;
  8904.             entity.anInt1503--;
  8905.         }
  8906.         if(entity.aBooleanArray1553[entity.smallXYIndex - 1])
  8907.             k1 <<= 1;
  8908.         if(k1 >= 8 && entity.anInt1517 == entity.anInt1554 && entity.anInt1505 != -1)
  8909.             entity.anInt1517 = entity.anInt1505;
  8910.         if(i < k)
  8911.         {
  8912.             entity.x += k1;
  8913.             if(entity.x > k)
  8914.                 entity.x = k;
  8915.         } else
  8916.         if(i > k)
  8917.         {
  8918.             entity.x -= k1;
  8919.             if(entity.x < k)
  8920.                 entity.x = k;
  8921.         }
  8922.         if(j < l)
  8923.         {
  8924.             entity.y += k1;
  8925.             if(entity.y > l)
  8926.                 entity.y = l;
  8927.         } else
  8928.         if(j > l)
  8929.         {
  8930.             entity.y -= k1;
  8931.             if(entity.y < l)
  8932.                 entity.y = l;
  8933.         }
  8934.         if(entity.x == k && entity.y == l)
  8935.         {
  8936.             entity.smallXYIndex--;
  8937.             if(entity.anInt1542 > 0)
  8938.                 entity.anInt1542--;
  8939.         }
  8940.     }
  8941.  
  8942.     private void method100(Entity entity)
  8943.     {
  8944.         if(entity.anInt1504 == 0)
  8945.             return;
  8946.         if(entity.interactingEntity != -1 && entity.interactingEntity < 32768)
  8947.         {
  8948.             NPC npc = npcArray[(entity.interactingEntity > npcArray.length) ? (npcArray.length-1) : entity.interactingEntity];
  8949.             if(npc != null)
  8950.             {
  8951.                 int i1 = entity.x - npc.x;
  8952.                 int k1 = entity.y - npc.y;
  8953.                 if(i1 != 0 || k1 != 0)
  8954.                     entity.turnDirection = (int)(Math.atan2(i1, k1) * 325.94900000000001D) & 0x7ff;
  8955.             }
  8956.         }
  8957.         if(entity.interactingEntity >= 32768)
  8958.         {
  8959.             int j = entity.interactingEntity - 32768;
  8960.             if(j == unknownInt10)
  8961.                 j = myPlayerIndex;
  8962.             Player player = playerArray[j];
  8963.             if(player != null)
  8964.             {
  8965.                 int l1 = entity.x - player.x;
  8966.                 int i2 = entity.y - player.y;
  8967.                 if(l1 != 0 || i2 != 0)
  8968.                     entity.turnDirection = (int)(Math.atan2(l1, i2) * 325.94900000000001D) & 0x7ff;
  8969.             }
  8970.         }
  8971.         if((entity.anInt1538 != 0 || entity.anInt1539 != 0) && (entity.smallXYIndex == 0 || entity.anInt1503 > 0))
  8972.         {
  8973.             int k = entity.x - (entity.anInt1538 - baseX - baseX) * 64;
  8974.             int j1 = entity.y - (entity.anInt1539 - baseY - baseY) * 64;
  8975.             if(k != 0 || j1 != 0)
  8976.                 entity.turnDirection = (int)(Math.atan2(k, j1) * 325.94900000000001D) & 0x7ff;
  8977.             entity.anInt1538 = 0;
  8978.             entity.anInt1539 = 0;
  8979.         }
  8980.         int l = entity.turnDirection - entity.anInt1552 & 0x7ff;
  8981.         if(l != 0)
  8982.         {
  8983.             if(l < entity.anInt1504 || l > 2048 - entity.anInt1504)
  8984.                 entity.anInt1552 = entity.turnDirection;
  8985.             else
  8986.             if(l > 1024)
  8987.                 entity.anInt1552 -= entity.anInt1504;
  8988.             else
  8989.                 entity.anInt1552 += entity.anInt1504;
  8990.             entity.anInt1552 &= 0x7ff;
  8991.             if(entity.anInt1517 == entity.anInt1511 && entity.anInt1552 != entity.turnDirection)
  8992.             {
  8993.                 if(entity.anInt1512 != -1)
  8994.                 {
  8995.                     entity.anInt1517 = entity.anInt1512;
  8996.                     return;
  8997.                 }
  8998.                 entity.anInt1517 = entity.anInt1554;
  8999.             }
  9000.         }
  9001.     }
  9002.  
  9003.     private void method101(Entity entity)
  9004.     {
  9005.         try {
  9006.             entity.aBoolean1541 = false;
  9007.             if(entity.anInt1517 != -1)
  9008.             {
  9009.                 Animation animation = Animation.anims[entity.anInt1517];
  9010.                 entity.anInt1519++;
  9011.                 if(entity.anInt1518 < animation.anInt352 && entity.anInt1519 > animation.method258(entity.anInt1518))
  9012.                 {
  9013.                     entity.anInt1519 = 0;
  9014.                     entity.anInt1518++;
  9015.                 }
  9016.                 if(entity.anInt1518 >= animation.anInt352)
  9017.                 {
  9018.                     entity.anInt1519 = 0;
  9019.                     entity.anInt1518 = 0;
  9020.                 }
  9021.             }
  9022.             if(entity.anInt1520 != -1 && loopCycle >= entity.anInt1523)
  9023.             {
  9024.                 if(entity.anInt1521 < 0)
  9025.                     entity.anInt1521 = 0;
  9026.                 Animation animation_1 = SpotAnim.cache[entity.anInt1520].aAnimation_407;
  9027.                 for(entity.anInt1522++; entity.anInt1521 < animation_1.anInt352 && entity.anInt1522 > animation_1.method258(entity.anInt1521); entity.anInt1521++)
  9028.                     entity.anInt1522 -= animation_1.method258(entity.anInt1521);
  9029.  
  9030.                 if(entity.anInt1521 >= animation_1.anInt352 && (entity.anInt1521 < 0 || entity.anInt1521 >= animation_1.anInt352))
  9031.                     entity.anInt1520 = -1;
  9032.             }
  9033.             if(entity.anim != -1 && entity.anInt1529 <= 1)
  9034.             {
  9035.                 Animation animation_2 = Animation.anims[entity.anim];
  9036.                 if(animation_2.anInt363 == 1 && entity.anInt1542 > 0 && entity.anInt1547 <= loopCycle && entity.anInt1548 < loopCycle)
  9037.                 {
  9038.                     entity.anInt1529 = 1;
  9039.                     return;
  9040.                 }
  9041.             }
  9042.             if(entity.anim != -1 && entity.anInt1529 == 0)
  9043.             {
  9044.                 Animation animation_3 = Animation.anims[entity.anim];
  9045.                 for(entity.anInt1528++; entity.anInt1527 < animation_3.anInt352 && entity.anInt1528 > animation_3.method258(entity.anInt1527); entity.anInt1527++)
  9046.                     entity.anInt1528 -= animation_3.method258(entity.anInt1527);
  9047.  
  9048.                 if(entity.anInt1527 >= animation_3.anInt352)
  9049.                 {
  9050.                     entity.anInt1527 -= animation_3.anInt356;
  9051.                     entity.anInt1530++;
  9052.                     if(entity.anInt1530 >= animation_3.anInt362)
  9053.                         entity.anim = -1;
  9054.                     if(entity.anInt1527 < 0 || entity.anInt1527 >= animation_3.anInt352)
  9055.                         entity.anim = -1;
  9056.                 }
  9057.                 entity.aBoolean1541 = animation_3.aBoolean358;
  9058.             }
  9059.             if(entity.anInt1529 > 0)
  9060.                 entity.anInt1529--;
  9061.         } catch(NullPointerException ex) {
  9062.            
  9063.         }
  9064.     }
  9065.  
  9066.     private void drawGameScreen()
  9067.     {
  9068.         if (fullscreenInterfaceID != -1 && (loadingStage == 2 || super.fullGameScreen != null)) {
  9069.             if (loadingStage == 2) {
  9070.                 method119(anInt945, fullscreenInterfaceID);
  9071.                 if (openInterfaceID != -1) {
  9072.                     method119(anInt945, openInterfaceID);
  9073.                 }
  9074.                 anInt945 = 0;
  9075.                 resetAllImageProducers();
  9076.                 super.fullGameScreen.initDrawingArea();
  9077.                 Texture.anIntArray1472 = fullScreenTextureArray;
  9078.                 DrawingArea.setAllPixelsToZero();
  9079.                 welcomeScreenRaised = true;
  9080.                 if (openInterfaceID != -1) {
  9081.                     RSInterface rsInterface_1 = RSInterface.interfaceCache[openInterfaceID];
  9082.                     if (rsInterface_1.width == 512 && rsInterface_1.height == 334 && rsInterface_1.type == 0) {
  9083.                         rsInterface_1.width = 765;
  9084.                         rsInterface_1.height = 503;
  9085.                     }
  9086.                     drawInterface(0, 0, rsInterface_1, 8);//used for fullscreen
  9087.                 }
  9088.                 RSInterface rsInterface = RSInterface.interfaceCache[fullscreenInterfaceID];
  9089.                 if (rsInterface.width == 512 && rsInterface.height == 334 && rsInterface.type == 0) {
  9090.                     rsInterface.width = 765;
  9091.                     rsInterface.height = 503;
  9092.                 }
  9093.                 drawInterface(0, 0, rsInterface, 8);
  9094.  
  9095.                 if (!contextMenuOpen) {
  9096.                     processRightClick();
  9097.                     drawTooltip();
  9098.                 } else {
  9099.                     drawMenu(4,4);
  9100.                 }
  9101.             }
  9102.             drawCount++;
  9103.             super.fullGameScreen.drawGraphics(0, super.graphics, 0);
  9104.             return;
  9105.         } else {
  9106.             if (drawCount != 0) {
  9107.                 resetImageProducers2();
  9108.             }
  9109.         }
  9110.         if(welcomeScreenRaised) {
  9111.             welcomeScreenRaised = false;
  9112.             if(!toggleFullscreen) {
  9113.                 topFrame.drawGraphics(0, super.graphics, 0);
  9114.                 leftFrame.drawGraphics(4, super.graphics, 0);
  9115.             }
  9116.             //mapAreaIP.drawGraphics(0, super.graphics, 519);
  9117.             //mapEdgeIP.drawGraphics(0, super.graphics, 519);
  9118.             needDrawTabArea = true;
  9119.             inputTaken = true;
  9120.             tabAreaAltered = true;
  9121.             aBoolean1233 = true;
  9122.             if(loadingStage != 2) {
  9123.                 main3DArea.drawGraphics(toggleFullscreen ? 0 : 4, super.graphics, toggleFullscreen ? 0 : 4);
  9124.                 mapBackImage.drawGraphics(mapDrawAreaX, super.graphics, mapDrawAreaY);
  9125.             }
  9126.         }
  9127.         if(contextMenuOpen)
  9128.             drawMenu(4,4);
  9129.         if(contextMenuOpen && menuScreenArea == 1)
  9130.             needDrawTabArea = true;
  9131.         if(invOverlayInterfaceID != -1)
  9132.         {
  9133.             boolean flag1 = method119(anInt945, invOverlayInterfaceID);
  9134.             if(flag1)
  9135.                 needDrawTabArea = true;
  9136.         }
  9137.         if(atInventoryInterfaceType == 2)
  9138.             needDrawTabArea = true;
  9139.         if(activeInterfaceType == 2)
  9140.             needDrawTabArea = true;
  9141.         if(!toggleFullscreen) {
  9142.             drawRightFrameArea();
  9143.             drawTabArea(sideTabArea,0,0);
  9144.             sideTabArea.drawGraphics(yPaddingtabBack, super.graphics, xPaddingtabBack);//519
  9145.             main3DArea.initDrawingArea();
  9146.         }
  9147.         if(backDialogID == -1)
  9148.         {
  9149.             aClass9_1059.scrollPosition = chatScrollTotalLength - anInt1089 - 110;
  9150.             if(super.mouseX > 497 && super.mouseX < 512 && super.mouseY > 342 + getChatBackIncreaseY())
  9151.                 method65(494, 110, super.mouseX - 0, super.mouseY - 348 - getChatBackIncreaseY(), aClass9_1059, 0, false, chatScrollTotalLength);
  9152.             int i = chatScrollTotalLength - 110 - aClass9_1059.scrollPosition;
  9153.             if(i < 0)
  9154.                 i = 0;
  9155.             if(i > chatScrollTotalLength - 110)
  9156.                 i = chatScrollTotalLength - 110;
  9157.             if(anInt1089 != i) {
  9158.                 anInt1089 = i;
  9159.                 inputTaken = true;
  9160.             }
  9161.         }
  9162.         if(backDialogID != -1) {
  9163.             boolean flag2 = method119(anInt945, backDialogID);
  9164.             if(flag2)
  9165.                 inputTaken = true;
  9166.         }
  9167.         if(atInventoryInterfaceType == 3)
  9168.             inputTaken = true;
  9169.         if(activeInterfaceType == 3)
  9170.             inputTaken = true;
  9171.         if(aString844 != null)
  9172.             inputTaken = true;
  9173.         if(contextMenuOpen && menuScreenArea == 2)
  9174.             inputTaken = true;
  9175.         if(inputTaken) {
  9176.             if(!toggleFullscreen) {
  9177.                 drawChatArea(toggleFullscreen ? main3DArea : chatBackImage,0,0);
  9178.                 chatBackImage.drawGraphics(yPaddingchatBackImage, super.graphics, xPaddingchatBackImage);
  9179.                 main3DArea.initDrawingArea();
  9180.             }
  9181.             inputTaken = false;
  9182.         }
  9183.         if(loadingStage == 2)
  9184.             method146();
  9185.         if(loadingStage == 2) {
  9186.             if(!toggleFullscreen) {
  9187.                 drawMinimap(mapBackImage,0,0);
  9188.                 mapBackImage.drawGraphics(yPaddingmapBackImage + getMapIncreaseY(), super.graphics, xPaddingmapBackImage + getMapIncreaseX());//545
  9189.             }
  9190.         }
  9191.         if(tabIconFlash != -1)
  9192.             tabAreaAltered = true;
  9193.         if(tabAreaAltered)
  9194.         {
  9195.             if(tabIconFlash != -1 && tabIconFlash == tabID)
  9196.             {
  9197.                 tabIconFlash = -1;
  9198.                 stream.createFrame(120);
  9199.                 stream.writeWordBigEndian(tabID);
  9200.             }
  9201.             tabAreaAltered = false;
  9202.             aRSImageProducer_1125.initDrawingArea();
  9203.             main3DArea.initDrawingArea();
  9204.         }
  9205.         anInt945 = 0;
  9206.     }
  9207.  
  9208.     private boolean buildFriendsListMenu(RSInterface class9)
  9209.     {
  9210.         int i = class9.contentType;
  9211.         if(i >= 1 && i <= 200 || i >= 701 && i <= 900)
  9212.         {
  9213.             if(i >= 801)
  9214.                 i -= 701;
  9215.             else
  9216.             if(i >= 701)
  9217.                 i -= 601;
  9218.             else
  9219.             if(i >= 101)
  9220.                 i -= 101;
  9221.             else
  9222.                 i--;
  9223.             menuActionName[menuActionRow] = "Remove @whi@" + friendsList[i];
  9224.             menuActionID[menuActionRow] = 792;
  9225.             menuActionRow++;
  9226.             menuActionName[menuActionRow] = "Message @whi@" + friendsList[i];
  9227.             menuActionID[menuActionRow] = 639;
  9228.             menuActionRow++;
  9229.             return true;
  9230.         }
  9231.         if(i >= 401 && i <= 500)
  9232.         {
  9233.             menuActionName[menuActionRow] = "Remove @whi@" + class9.message;
  9234.             menuActionID[menuActionRow] = 322;
  9235.             menuActionRow++;
  9236.             return true;
  9237.         } else
  9238.         {
  9239.             return false;
  9240.         }
  9241.     }
  9242.  
  9243.     private void method104()
  9244.     {
  9245.         Animable_Sub3 class30_sub2_sub4_sub3 = (Animable_Sub3)aClass19_1056.reverseGetFirst();
  9246.         for(; class30_sub2_sub4_sub3 != null; class30_sub2_sub4_sub3 = (Animable_Sub3)aClass19_1056.reverseGetNext())
  9247.             if(class30_sub2_sub4_sub3.anInt1560 != plane || class30_sub2_sub4_sub3.aBoolean1567)
  9248.                 class30_sub2_sub4_sub3.unlink();
  9249.             else
  9250.             if(loopCycle >= class30_sub2_sub4_sub3.anInt1564)
  9251.             {
  9252.                 class30_sub2_sub4_sub3.method454(anInt945);
  9253.                 if(class30_sub2_sub4_sub3.aBoolean1567)
  9254.                     class30_sub2_sub4_sub3.unlink();
  9255.                 else
  9256.                     worldController.method285(class30_sub2_sub4_sub3.anInt1560, 0, class30_sub2_sub4_sub3.anInt1563, -1, class30_sub2_sub4_sub3.anInt1562, 60, class30_sub2_sub4_sub3.anInt1561, class30_sub2_sub4_sub3, false);
  9257.             }
  9258.  
  9259.     }
  9260.    
  9261.     public void drawBlackBox(int xPos, int yPos) {
  9262.         DrawingArea.drawPixels(71, yPos - 1, xPos - 2, 0x726451, 1);
  9263.         DrawingArea.drawPixels(69, yPos, xPos + 174, 0x726451, 1);
  9264.         DrawingArea.drawPixels(1, yPos - 2, xPos - 2, 0x726451, 178);
  9265.         DrawingArea.drawPixels(1, yPos + 68, xPos, 0x726451, 174);
  9266.         DrawingArea.drawPixels(71, yPos - 1, xPos - 1, 0x2E2B23, 1);
  9267.         DrawingArea.drawPixels(71, yPos - 1, xPos + 175, 0x2E2B23, 1);
  9268.         DrawingArea.drawPixels(1, yPos - 1, xPos, 0x2E2B23, 175);
  9269.         DrawingArea.drawPixels(1, yPos + 69, xPos, 0x2E2B23, 175);
  9270.         DrawingArea.method335(0, yPos, 174, 68, 220, xPos);
  9271.     }
  9272.    
  9273.     /* NEW INTERFACE TEXT ENGINE - private void drawInterface(int yScrollPoint, int xPadding, RSInterface rsInterface, int yPadding) {
  9274.         try {
  9275.             if(rsInterface.type != 0 || rsInterface.children == null)
  9276.                 return;
  9277.             if(rsInterface.isMouseoverTriggered && lastHoverChildId != rsInterface.id && anInt1048 != rsInterface.id && anInt1039 != rsInterface.id)
  9278.                 return;
  9279.             int xTopPos = DrawingArea.topX;
  9280.             int yTopPos = DrawingArea.topY;
  9281.             int xBottomPos = DrawingArea.bottomX;
  9282.             int yBottomPos = DrawingArea.bottomY;
  9283.             DrawingArea.setDrawingArea(yPadding + rsInterface.height, xPadding, xPadding + rsInterface.width, yPadding);
  9284.             int totalChildren = rsInterface.children.length;
  9285.             for(int childIndex = 0; childIndex < totalChildren; childIndex++) {
  9286.                 int xSpritePos = rsInterface.childX[childIndex] + xPadding;
  9287.                 int ySpritePos = (rsInterface.childY[childIndex] + yPadding) - yScrollPoint;
  9288.                 RSInterface rsChildren = RSInterface.interfaceCache[rsInterface.children[childIndex]];
  9289.                 xSpritePos += rsChildren.anInt263;
  9290.                 ySpritePos += rsChildren.anInt265;
  9291.                 if(rsChildren.contentType > 0)
  9292.                     drawFriendsListOrWelcomeScreen(rsChildren);
  9293.                 //here
  9294.                 int[] IDs = {
  9295.                     1196, 1199, 1206, 1215, 1224, 1231, 1240, 1249, 1258, 1267, 1274, 1283, 1573,
  9296.                     1290, 1299, 1308, 1315, 1324, 1333, 1340, 1349, 1358, 1367, 1374, 1381, 1388,
  9297.                     1397, 1404, 1583, 12038, 1414, 1421, 1430, 1437, 1446, 1453, 1460, 1469, 15878,
  9298.                     1602, 1613, 1624, 7456, 1478, 1485, 1494, 1503, 1512, 1521, 1530, 1544, 1553,
  9299.                     1563, 1593, 1635, 12426, 12436, 12446, 12456, 6004, 18471,
  9300.                     /* Ancients *
  9301.                     12940, 12988, 13036, 12902, 12862, 13046, 12964, 13012, 13054, 12920, 12882, 13062,
  9302.                     12952, 13000, 13070, 12912, 12872, 13080, 12976, 13024, 13088, 12930, 12892, 13096
  9303.                 };
  9304.                 for(int m5 = 0; m5 < IDs.length; m5++) {
  9305.                     if(rsChildren.id == IDs[m5] + 1) {
  9306.                         if(m5 > 61)
  9307.                             drawBlackBox(xSpritePos + 1, ySpritePos);
  9308.                         else
  9309.                             drawBlackBox(xSpritePos, ySpritePos + 1);
  9310.                     }
  9311.                 }
  9312.                 int[] runeChildren = {
  9313.                     1202, 1203, 1209, 1210, 1211, 1218, 1219, 1220, 1227, 1228, 1234, 1235, 1236, 1243, 1244, 1245,
  9314.                     1252, 1253, 1254, 1261, 1262, 1263, 1270, 1271, 1277, 1278, 1279, 1286, 1287, 1293, 1294, 1295,
  9315.                     1302, 1303, 1304, 1311, 1312, 1318, 1319, 1320, 1327, 1328, 1329, 1336, 1337, 1343, 1344, 1345,
  9316.                     1352, 1353, 1354, 1361, 1362, 1363, 1370, 1371, 1377, 1378, 1384, 1385, 1391, 1392, 1393, 1400,
  9317.                     1401, 1407, 1408, 1410, 1417, 1418, 1424, 1425, 1426, 1433, 1434, 1440, 1441, 1442, 1449, 1450,
  9318.                     1456, 1457, 1463, 1464, 1465, 1472, 1473, 1474, 1481, 1482, 1488, 1489, 1490, 1497, 1498, 1499,
  9319.                     1506, 1507, 1508, 1515, 1516, 1517, 1524, 1525, 1526, 1533, 1534, 1535, 1547, 1548, 1549, 1556,
  9320.                     1557, 1558, 1566, 1567, 1568, 1576, 1577, 1578, 1586, 1587, 1588, 1596, 1597, 1598, 1605, 1606,
  9321.                     1607, 1616, 1617, 1618, 1627, 1628, 1629, 1638, 1639, 1640, 6007, 6008, 6011, 8673, 8674, 12041,
  9322.                     12042, 12429, 12430, 12431, 12439, 12440, 12441, 12449, 12450, 12451, 12459, 12460, 15881, 15882,
  9323.                     15885, 18474, 18475, 18478
  9324.                 };
  9325.                 for(int r = 0; r < runeChildren.length; r++)
  9326.                     if(rsChildren.id == runeChildren[r])
  9327.                         rsChildren.modelZoom = 775;
  9328.                 if(rsChildren.type == 0) {
  9329.                     if(rsChildren.scrollPosition > rsChildren.scrollMax - rsChildren.height)
  9330.                         rsChildren.scrollPosition = rsChildren.scrollMax - rsChildren.height;
  9331.                     if(rsChildren.scrollPosition < 0)
  9332.                         rsChildren.scrollPosition = 0;
  9333.                     drawInterface(rsChildren.scrollPosition, xSpritePos, rsChildren, ySpritePos);
  9334.                     if(rsChildren.scrollMax > rsChildren.height)
  9335.                         drawScrollbar(rsChildren.height, rsChildren.scrollPosition, ySpritePos, xSpritePos + rsChildren.width, rsChildren.scrollMax,false);
  9336.                 } else if(rsChildren.type != 1)
  9337.                     if(rsChildren.type == 2) {
  9338.                         int spriteIndex = 0;
  9339.                         for(int l3 = 0; l3 < rsChildren.height; l3++) {
  9340.                             for(int l4 = 0; l4 < rsChildren.width; l4++) {
  9341.                                 int k5 = xSpritePos + l4 * (32 + rsChildren.invSpritePadX);
  9342.                                 int j6 = ySpritePos + l3 * (32 + rsChildren.invSpritePadY);
  9343.                                 if(spriteIndex < 20) {
  9344.                                     k5 += rsChildren.spritesX[spriteIndex];
  9345.                                     j6 += rsChildren.spritesY[spriteIndex];
  9346.                                 }
  9347.                                 if(rsChildren.inv[spriteIndex] > 0) {
  9348.                                     int k6 = 0;
  9349.                                     int j7 = 0;
  9350.                                     int inventoryItemId = rsChildren.inv[spriteIndex] - 1;
  9351.                                     if(k5 > DrawingArea.topX - 32 && k5 < DrawingArea.bottomX && j6 > DrawingArea.topY - 32 && j6 < DrawingArea.bottomY || activeInterfaceType != 0 && anInt1085 == spriteIndex) {
  9352.                                         int selectedColour = 0;
  9353.                                         if(itemSelected == 1 && itemSlotUsedOn == spriteIndex && anInt1284 == rsChildren.id)
  9354.                                             selectedColour = 0xffffff;
  9355.                                         Sprite itemSprite = ItemDef.getSprite(inventoryItemId, rsChildren.invStackSizes[spriteIndex], selectedColour);
  9356.                                         if(itemSprite != null) {
  9357.                                             if(activeInterfaceType != 0 && anInt1085 == spriteIndex && anInt1084 == rsChildren.id) {
  9358.                                                 k6 = super.mouseX - anInt1087;
  9359.                                                 j7 = super.mouseY - anInt1088;
  9360.                                                 if(k6 < 5 && k6 > -5)
  9361.                                                     k6 = 0;
  9362.                                                 if(j7 < 5 && j7 > -5)
  9363.                                                     j7 = 0;
  9364.                                                 if(anInt989 < 5) {
  9365.                                                     k6 = 0;
  9366.                                                     j7 = 0;
  9367.                                                 }
  9368.                                                 itemSprite.drawSprite1(k5 + k6, j6 + j7, 128);
  9369.                                                 if(j6 + j7 < DrawingArea.topY && rsInterface.scrollPosition > 0) {
  9370.                                                     int i10 = (anInt945 * (DrawingArea.topY - j6 - j7)) / 3;
  9371.                                                     if(i10 > anInt945 * 10)
  9372.                                                         i10 = anInt945 * 10;
  9373.                                                     if(i10 > rsInterface.scrollPosition)
  9374.                                                         i10 = rsInterface.scrollPosition;
  9375.                                                     rsInterface.scrollPosition -= i10;
  9376.                                                     anInt1088 += i10;
  9377.                                                 }
  9378.                                                 if(j6 + j7 + 32 > DrawingArea.bottomY && rsInterface.scrollPosition < rsInterface.scrollMax - rsInterface.height) {
  9379.                                                     int j10 = (anInt945 * ((j6 + j7 + 32) - DrawingArea.bottomY)) / 3;
  9380.                                                     if(j10 > anInt945 * 10)
  9381.                                                         j10 = anInt945 * 10;
  9382.                                                     if(j10 > rsInterface.scrollMax - rsInterface.height - rsInterface.scrollPosition)
  9383.                                                         j10 = rsInterface.scrollMax - rsInterface.height - rsInterface.scrollPosition;
  9384.                                                     rsInterface.scrollPosition += j10;
  9385.                                                     anInt1088 -= j10;
  9386.                                                 }
  9387.                                             } else if(atInventoryInterfaceType != 0 && atInventoryIndex == spriteIndex && atInventoryInterface == rsChildren.id)
  9388.                                                 itemSprite.drawSprite1(k5, j6, 128);
  9389.                                             else
  9390.                                                 itemSprite.drawSprite(k5, j6);
  9391.                                             if(rsChildren.parentID  == 3824) {
  9392.                                                 infinityIcon.drawSprite(k5, j6);
  9393.                                             } else if(itemSprite.maxWidth == 33 || rsChildren.invStackSizes[spriteIndex] != 1) {
  9394.                                                 int k10 = rsChildren.invStackSizes[spriteIndex];
  9395.                                                 if(k10 >= 1)
  9396.                                                     newSmallFont.drawBasicString(intToKOrMil(k10), k5 + k6, j6 + 9 + j7, 0xFFFF00, 0);
  9397.                                                 if(k10 >= 100000)
  9398.                                                     newSmallFont.drawBasicString(intToKOrMil(k10), k5 + k6, j6 + 9 + j7, 0xFFFFFF, 0);
  9399.                                                 if(k10 >= 10000000)
  9400.                                                     newSmallFont.drawBasicString(intToKOrMil(k10), k5 + k6, j6 + 9 + j7, 0x00FF80, 0);
  9401.                                                 if(k10 >= 1000000000)
  9402.                                                     newSmallFont.drawBasicString(intToKOrMil(k10), k5 + k6, j6 + 9 + j7, 0xFF0000, 0);
  9403.                                             }
  9404.                                         }
  9405.                                     }
  9406.                                 } else if(rsChildren.sprites != null && spriteIndex < 20) {
  9407.                                     Sprite sprite = rsChildren.sprites[spriteIndex];
  9408.                                     if(sprite != null)
  9409.                                         sprite.drawSprite(k5, j6);
  9410.                                 }
  9411.                                 spriteIndex++;
  9412.                             }
  9413.                         }
  9414.                     } else if(rsChildren.type == 3) {
  9415.                         boolean flag = false;
  9416.                         if(anInt1039 == rsChildren.id || anInt1048 == rsChildren.id || lastHoverChildId == rsChildren.id)
  9417.                             flag = true;
  9418.                         int j3;
  9419.                         if(interfaceIsSelected(rsChildren)) {
  9420.                             j3 = rsChildren.anInt219;
  9421.                             if(flag && rsChildren.anInt239 != 0)
  9422.                                 j3 = rsChildren.anInt239;
  9423.                         } else {
  9424.                             j3 = rsChildren.textColor;
  9425.                             if(flag && rsChildren.textHoverColour != 0)
  9426.                                 j3 = rsChildren.textHoverColour;
  9427.                         }
  9428.                         if(rsChildren.opacity == 0) {
  9429.                             if(rsChildren.aBoolean227)
  9430.                                 DrawingArea.drawPixels(rsChildren.height, ySpritePos, xSpritePos, j3, rsChildren.width);
  9431.                             else
  9432.                                 DrawingArea.fillPixels(xSpritePos, rsChildren.width, rsChildren.height, j3, ySpritePos);
  9433.                         } else if(rsChildren.aBoolean227)
  9434.                             DrawingArea.method335(j3, ySpritePos, rsChildren.width, rsChildren.height, 256 - (rsChildren.opacity & 0xff), xSpritePos);
  9435.                         else
  9436.                             DrawingArea.method338(ySpritePos, rsChildren.height, 256 - (rsChildren.opacity & 0xff), j3, rsChildren.width, xSpritePos);
  9437.                     } else if(rsChildren.type == 4) {
  9438.                         RSFont textDrawingArea = rsChildren.textDrawingAreas;
  9439.                         String s = rsChildren.message;
  9440.                         boolean flag1 = false;
  9441.                         if(anInt1039 == rsChildren.id || anInt1048 == rsChildren.id || lastHoverChildId == rsChildren.id)
  9442.                             flag1 = true;
  9443.                         int i4;
  9444.                         if(interfaceIsSelected(rsChildren)) {
  9445.                             i4 = rsChildren.anInt219;
  9446.                             if(flag1 && rsChildren.anInt239 != 0)
  9447.                                 i4 = rsChildren.anInt239;
  9448.                             if(rsChildren.disabledText.length() > 0)
  9449.                                 s = rsChildren.disabledText;
  9450.                         } else {
  9451.                             i4 = rsChildren.textColor;
  9452.                             if(flag1 && rsChildren.textHoverColour != 0)
  9453.                                 i4 = rsChildren.textHoverColour;
  9454.                         }
  9455.                         if(rsChildren.atActionType == 6 && aBoolean1149) {
  9456.                             s = "Please wait...";
  9457.                             i4 = rsChildren.textColor;
  9458.                         }
  9459.                         if(DrawingArea.width == 519) {
  9460.                             if(i4 == 0xffff00)
  9461.                                 i4 = 255;
  9462.                             if(i4 == 49152)
  9463.                                 i4 = 0xffffff;
  9464.                         }
  9465.                         if((rsChildren.parentID == 1151) || (rsChildren.parentID == 12855)) {
  9466.                             switch (i4) {
  9467.                                 case 16773120: i4 = 0xFE981F; break;
  9468.                                 case 7040819: i4 = 0xAF6A1A; break;
  9469.                             }
  9470.                         }
  9471.                         for(int l6 = ySpritePos + textDrawingArea.baseCharacterHeight; s.length() > 0; l6 += textDrawingArea.baseCharacterHeight) {
  9472.                             if(s.indexOf("%") != -1) {
  9473.                                 do {
  9474.                                     int k7 = s.indexOf("%1");
  9475.                                     if(k7 == -1)
  9476.                                         break;
  9477.                                     if(rsChildren.id < 4000 || rsChildren.id > 5000 && rsChildren.id !=13921 && rsChildren.id !=13922 && rsChildren.id !=12171 && rsChildren.id !=12172)
  9478.                                         s = s.substring(0, k7) + methodR(extractInterfaceValues(rsChildren, 0)) + s.substring(k7 + 2);
  9479.                                     else
  9480.                                         s = s.substring(0, k7) + interfaceIntToString(extractInterfaceValues(rsChildren, 0)) + s.substring(k7 + 2);
  9481.                                 } while(true);
  9482.                                 do {
  9483.                                     int l7 = s.indexOf("%2");
  9484.                                     if(l7 == -1)
  9485.                                         break;
  9486.                                     s = s.substring(0, l7) + interfaceIntToString(extractInterfaceValues(rsChildren, 1)) + s.substring(l7 + 2);
  9487.                                 } while(true);
  9488.                                 do {
  9489.                                     int i8 = s.indexOf("%3");
  9490.                                     if(i8 == -1)
  9491.                                         break;
  9492.                                     s = s.substring(0, i8) + interfaceIntToString(extractInterfaceValues(rsChildren, 2)) + s.substring(i8 + 2);
  9493.                                 } while(true);
  9494.                                 do {
  9495.                                     int j8 = s.indexOf("%4");
  9496.                                     if(j8 == -1)
  9497.                                         break;
  9498.                                     s = s.substring(0, j8) + interfaceIntToString(extractInterfaceValues(rsChildren, 3)) + s.substring(j8 + 2);
  9499.                                 } while(true);
  9500.                                 do {
  9501.                                     int k8 = s.indexOf("%5");
  9502.                                     if(k8 == -1)
  9503.                                         break;
  9504.                                     s = s.substring(0, k8) + interfaceIntToString(extractInterfaceValues(rsChildren, 4)) + s.substring(k8 + 2);
  9505.                                 } while(true);
  9506.                             }
  9507.                             int l8 = s.indexOf("\\n");
  9508.                             String s1;
  9509.                             if(l8 != -1) {
  9510.                                 s1 = s.substring(0, l8);
  9511.                                 s = s.substring(l8 + 2);
  9512.                             } else {
  9513.                                 s1 = s;
  9514.                                 s = "";
  9515.                             }
  9516.                             if(rsChildren.centerText){
  9517.                                 //textDrawingArea.method382(i4, xSpritePos + rsChildren.width / 2, s1, l6, rsChildren.textShadow);
  9518.                                 textDrawingArea.drawCenteredString(s1, xSpritePos + rsChildren.width / 2, l6, i4,(rsChildren.textShadow? 0: -1));
  9519.                             } else {
  9520.                                 //textDrawingArea.method389(rsChildren.textShadow, xSpritePos, i4, s1, l6);
  9521.                                 textDrawingArea.drawBasicString(s1, xSpritePos , l6, i4,(rsChildren.textShadow? 0: -1));
  9522.                             }
  9523.                            
  9524.                         }
  9525.                     } else if(rsChildren.type == 5 || rsChildren.type == 10) {
  9526.                         Sprite sprite = null;
  9527.                         if(rsChildren.itemSpriteId1 != -1 && rsChildren.sprite1 == null) {
  9528.                             rsChildren.sprite1 = ItemDef.getSprite(rsChildren.itemSpriteId1, 1, (rsChildren.itemSpriteZoom1 == -1) ? 0 : -1,rsChildren.itemSpriteZoom1);
  9529.                             rsChildren.sprite2 = ItemDef.getSprite(rsChildren.itemSpriteId2, 1, (rsChildren.itemSpriteZoom2 == -1) ? 0 : -1,rsChildren.itemSpriteZoom2);
  9530.                             //rsChildren.sprite2 = ItemDef.getSprite(rsChildren.itemSpriteId2, rsChildren.invStackSizes[spriteIndex], selectedColour);
  9531.                             if(rsChildren.greyScale)
  9532.                                 rsChildren.sprite1.greyScale();
  9533.                         }
  9534.                         if(interfaceIsSelected(rsChildren) || hoverSpriteId == rsChildren.id)
  9535.                             sprite = rsChildren.sprite2;
  9536.                         else
  9537.                             sprite = rsChildren.sprite1;
  9538.                         if(spellSelected == 1 && rsChildren.id == spellID && spellID != 0 && sprite != null) {
  9539.                             sprite.drawSprite(xSpritePos, ySpritePos, 0xffffff);
  9540.                         } else {
  9541.                             if (sprite != null)
  9542.                                 if(rsChildren.type == 5)
  9543.                                     sprite.drawSprite(xSpritePos, ySpritePos);
  9544.                                 else
  9545.                                     sprite.drawSprite1(xSpritePos, ySpritePos, rsChildren.opacity);                            
  9546.                         }
  9547.                         if(autoCast && rsChildren.id == autocastId)
  9548.                             magicAuto.drawSprite(xSpritePos-3, ySpritePos-2);
  9549.                     } else if(rsChildren.type == 6) {
  9550.                         int k3 = Texture.textureInt1;
  9551.                         int j4 = Texture.textureInt2;
  9552.                         Texture.textureInt1 = xSpritePos + rsChildren.width / 2;
  9553.                         Texture.textureInt2 = ySpritePos + rsChildren.height / 2;
  9554.                         int i5 = Texture.anIntArray1470[rsChildren.modelRotation1] * rsChildren.modelZoom >> 16;
  9555.                         int l5 = Texture.anIntArray1471[rsChildren.modelRotation1] * rsChildren.modelZoom >> 16;
  9556.                         boolean flag2 = interfaceIsSelected(rsChildren);
  9557.                         int i7;
  9558.                         if(flag2)
  9559.                             i7 = rsChildren.anInt258;
  9560.                         else
  9561.                             i7 = rsChildren.anInt257;
  9562.                         Model model;
  9563.                         if(i7 == -1) {
  9564.                             model = rsChildren.method209(-1, -1, flag2);
  9565.                         } else {
  9566.                             Animation animation = Animation.anims[i7];
  9567.                             model = rsChildren.method209(animation.anIntArray354[rsChildren.anInt246], animation.anIntArray353[rsChildren.anInt246], flag2);
  9568.                         }
  9569.                         if(model != null)
  9570.                             model.method482(rsChildren.modelRotation2, 0, rsChildren.modelRotation1, 0, i5, l5);
  9571.                         Texture.textureInt1 = k3;
  9572.                         Texture.textureInt2 = j4;
  9573.                    
  9574.                     } else if(rsChildren.type == 7) {
  9575.                         RSFont textDrawingArea_1 = rsChildren.textDrawingAreas;
  9576.                         int k4 = 0;
  9577.                         for(int j5 = 0; j5 < rsChildren.height; j5++) {
  9578.                             for(int i6 = 0; i6 < rsChildren.width; i6++) {
  9579.                                 if(rsChildren.inv[k4] > 0) {
  9580.                                     ItemDef itemDef = ItemDef.forID(rsChildren.inv[k4] - 1);
  9581.                                     String s2 = itemDef.name;
  9582.                                     if(itemDef.stackable || rsChildren.invStackSizes[k4] != 1)
  9583.                                         s2 = s2 + " x" + intToKOrMilLongName(rsChildren.invStackSizes[k4]);
  9584.                                     int i9 = xSpritePos + i6 * (115 + rsChildren.invSpritePadX);
  9585.                                     int k9 = ySpritePos + j5 * (12 + rsChildren.invSpritePadY);
  9586.                                     if(rsChildren.centerText)
  9587.                                         textDrawingArea_1.drawCenteredString(s2, i9 + rsChildren.width / 2, k9, rsChildren.textColor, (rsChildren.textShadow ? 0: -1));
  9588.                                     else
  9589.                                         textDrawingArea_1.drawBasicString(s2, i9, k9, rsChildren.textColor,(rsChildren.textShadow ? 0: -1));
  9590.                                 }
  9591.                                 k4++;
  9592.                             }
  9593.                         }
  9594.                     }  else if (rsChildren.type == 8 && (anInt1500 == rsChildren.id || anInt1044 == rsChildren.id || lastHoverToggleChildId == rsChildren.id) && anInt1501 == 100) {
  9595.                         int boxWidth = 0;
  9596.                         int boxHeight = 0;
  9597.                         TextDrawingArea textDrawingArea_2 = normalFont;
  9598.                         for (String s1 = rsChildren.message; s1.length() > 0;) {
  9599.                             int l7 = s1.indexOf("\\n");
  9600.                             String s4;
  9601.                             if (l7 != -1) {
  9602.                                 s4 = s1.substring(0, l7);
  9603.                                 s1 = s1.substring(l7 + 2);
  9604.                             } else {
  9605.                                 s4 = s1;
  9606.                                 s1 = "";
  9607.                             }
  9608.                             int j10 = textDrawingArea_2.getTextWidth(s4);
  9609.                             if (j10 > boxWidth) {
  9610.                                 boxWidth = j10;
  9611.                             }
  9612.                             boxHeight += textDrawingArea_2.anInt1497 + 1;
  9613.                         }
  9614.                         boxWidth += 6;
  9615.                         boxHeight += 7;
  9616.                         int xPos = (ySpritePos + rsChildren.width) - 5 - boxWidth;
  9617.                         int yPos = xSpritePos + rsChildren.height + 5;
  9618.                         if (xPos < ySpritePos + 5) {
  9619.                             xPos = ySpritePos + 5;
  9620.                         }
  9621.                         if (xPos + boxWidth > yScrollPoint + rsInterface.width) {
  9622.                             xPos = (yScrollPoint + rsInterface.width) - boxWidth;
  9623.                         }
  9624.                         if (yPos + boxHeight > xPadding + rsInterface.height) {
  9625.                             yPos = (xPadding + rsInterface.height) - boxHeight;
  9626.                         }
  9627.                         DrawingArea.drawPixels(boxHeight, yPos, xPos, 0xFFFFA0, boxWidth);
  9628.                         DrawingArea.fillPixels(xPos, boxWidth, boxHeight, 0, yPos);
  9629.                         String s2 = rsChildren.message;
  9630.                         for (int j11 = yPos + textDrawingArea_2.anInt1497 + 2; s2.length() > 0; j11 += textDrawingArea_2.anInt1497 + 1) {//anInt1497
  9631.                             int newLineIndex = s2.indexOf("\\n");
  9632.                             String s5;
  9633.                             if (newLineIndex != -1) {
  9634.                                 s5 = s2.substring(0, newLineIndex);
  9635.                                 s2 = s2.substring(newLineIndex + 2);
  9636.                             } else {
  9637.                                 s5 = s2;
  9638.                                 s2 = "";
  9639.                             }
  9640.                             textDrawingArea_2.method389(false, xPos + 3, 0, s5, j11);
  9641.                         }
  9642.                     } else if (rsChildren.type == 9) {
  9643.                         drawHoverBox(xSpritePos, ySpritePos, rsChildren.message);
  9644.                     }
  9645.             }
  9646.             DrawingArea.setDrawingArea(yBottomPos, xTopPos, xBottomPos, yTopPos);
  9647.         } catch(NullPointerException ex) {
  9648.            
  9649.         }
  9650.     }*/
  9651.    
  9652.         private void drawInterface(int yScrollPoint, int xPadding, RSInterface rsInterface, int yPadding) {
  9653.         try {
  9654.             if(rsInterface.type != 0 || rsInterface.children == null)
  9655.                 return;
  9656.             if(rsInterface.isMouseoverTriggered && lastHoverChildId != rsInterface.id && anInt1048 != rsInterface.id && anInt1039 != rsInterface.id)
  9657.                 return;
  9658.             int xTopPos = DrawingArea.topX;
  9659.             int yTopPos = DrawingArea.topY;
  9660.             int xBottomPos = DrawingArea.bottomX;
  9661.             int yBottomPos = DrawingArea.bottomY;
  9662.             DrawingArea.setDrawingArea(yPadding + rsInterface.height, xPadding, xPadding + rsInterface.width, yPadding);
  9663.             int totalChildren = rsInterface.children.length;
  9664.             for(int childIndex = 0; childIndex < totalChildren; childIndex++) {
  9665.                 int xSpritePos = rsInterface.childX[childIndex] + xPadding;
  9666.                 int ySpritePos = (rsInterface.childY[childIndex] + yPadding) - yScrollPoint;
  9667.                 RSInterface rsChildren = RSInterface.interfaceCache[rsInterface.children[childIndex]];
  9668.                 xSpritePos += rsChildren.anInt263;
  9669.                 ySpritePos += rsChildren.anInt265;
  9670.                 if(rsChildren.contentType > 0)
  9671.                     drawFriendsListOrWelcomeScreen(rsChildren);
  9672.                 //here
  9673.                 int[] IDs = {
  9674.                     1196, 1199, 1206, 1215, 1224, 1231, 1240, 1249, 1258, 1267, 1274, 1283, 1573,
  9675.                     1290, 1299, 1308, 1315, 1324, 1333, 1340, 1349, 1358, 1367, 1374, 1381, 1388,
  9676.                     1397, 1404, 1583, 12038, 1414, 1421, 1430, 1437, 1446, 1453, 1460, 1469, 15878,
  9677.                     1602, 1613, 1624, 7456, 1478, 1485, 1494, 1503, 1512, 1521, 1530, 1544, 1553,
  9678.                     1563, 1593, 1635, 12426, 12436, 12446, 12456, 6004, 18471,
  9679.                     /* Ancients */
  9680.                     12940, 12988, 13036, 12902, 12862, 13046, 12964, 13012, 13054, 12920, 12882, 13062,
  9681.                     12952, 13000, 13070, 12912, 12872, 13080, 12976, 13024, 13088, 12930, 12892, 13096
  9682.                 };
  9683.                 for(int m5 = 0; m5 < IDs.length; m5++) {
  9684.                     if(rsChildren.id == IDs[m5] + 1) {
  9685.                         if(m5 > 61)
  9686.                             drawBlackBox(xSpritePos + 1, ySpritePos);
  9687.                         else
  9688.                             drawBlackBox(xSpritePos, ySpritePos + 1);
  9689.                     }
  9690.                 }
  9691.                 int[] runeChildren = {
  9692.                     1202, 1203, 1209, 1210, 1211, 1218, 1219, 1220, 1227, 1228, 1234, 1235, 1236, 1243, 1244, 1245,
  9693.                     1252, 1253, 1254, 1261, 1262, 1263, 1270, 1271, 1277, 1278, 1279, 1286, 1287, 1293, 1294, 1295,
  9694.                     1302, 1303, 1304, 1311, 1312, 1318, 1319, 1320, 1327, 1328, 1329, 1336, 1337, 1343, 1344, 1345,
  9695.                     1352, 1353, 1354, 1361, 1362, 1363, 1370, 1371, 1377, 1378, 1384, 1385, 1391, 1392, 1393, 1400,
  9696.                     1401, 1407, 1408, 1410, 1417, 1418, 1424, 1425, 1426, 1433, 1434, 1440, 1441, 1442, 1449, 1450,
  9697.                     1456, 1457, 1463, 1464, 1465, 1472, 1473, 1474, 1481, 1482, 1488, 1489, 1490, 1497, 1498, 1499,
  9698.                     1506, 1507, 1508, 1515, 1516, 1517, 1524, 1525, 1526, 1533, 1534, 1535, 1547, 1548, 1549, 1556,
  9699.                     1557, 1558, 1566, 1567, 1568, 1576, 1577, 1578, 1586, 1587, 1588, 1596, 1597, 1598, 1605, 1606,
  9700.                     1607, 1616, 1617, 1618, 1627, 1628, 1629, 1638, 1639, 1640, 6007, 6008, 6011, 8673, 8674, 12041,
  9701.                     12042, 12429, 12430, 12431, 12439, 12440, 12441, 12449, 12450, 12451, 12459, 12460, 15881, 15882,
  9702.                     15885, 18474, 18475, 18478
  9703.                 };
  9704.                 for(int r = 0; r < runeChildren.length; r++)
  9705.                     if(rsChildren.id == runeChildren[r])
  9706.                         rsChildren.modelZoom = 775;
  9707.                 if(rsChildren.type == 0) {
  9708.                     if(rsChildren.scrollPosition > rsChildren.scrollMax - rsChildren.height)
  9709.                         rsChildren.scrollPosition = rsChildren.scrollMax - rsChildren.height;
  9710.                     if(rsChildren.scrollPosition < 0)
  9711.                         rsChildren.scrollPosition = 0;
  9712.                     drawInterface(rsChildren.scrollPosition, xSpritePos, rsChildren, ySpritePos);
  9713.                     if(rsChildren.scrollMax > rsChildren.height)
  9714.                         drawScrollbar(rsChildren.height, rsChildren.scrollPosition, ySpritePos, xSpritePos + rsChildren.width, rsChildren.scrollMax,false);
  9715.                 } else if(rsChildren.type != 1)
  9716.                     if(rsChildren.type == 2) {
  9717.                         int spriteIndex = 0;
  9718.                         for(int l3 = 0; l3 < rsChildren.height; l3++) {
  9719.                             for(int l4 = 0; l4 < rsChildren.width; l4++) {
  9720.                                 int k5 = xSpritePos + l4 * (32 + rsChildren.invSpritePadX);
  9721.                                 int j6 = ySpritePos + l3 * (32 + rsChildren.invSpritePadY);
  9722.                                 if(spriteIndex < 20) {
  9723.                                     k5 += rsChildren.spritesX[spriteIndex];
  9724.                                     j6 += rsChildren.spritesY[spriteIndex];
  9725.                                 }
  9726.                                 if(rsChildren.inv[spriteIndex] > 0) {
  9727.                                     int k6 = 0;
  9728.                                     int j7 = 0;
  9729.                                     int inventoryItemId = rsChildren.inv[spriteIndex] - 1;
  9730.                                     if(k5 > DrawingArea.topX - 32 && k5 < DrawingArea.bottomX && j6 > DrawingArea.topY - 32 && j6 < DrawingArea.bottomY || activeInterfaceType != 0 && anInt1085 == spriteIndex) {
  9731.                                         int selectedColour = 0;
  9732.                                         if(itemSelected == 1 && itemSlotUsedOn == spriteIndex && anInt1284 == rsChildren.id)
  9733.                                             selectedColour = 0xffffff;
  9734.                                         Sprite itemSprite = ItemDef.getSprite(inventoryItemId, rsChildren.invStackSizes[spriteIndex], selectedColour);
  9735.                                         if(itemSprite != null) {
  9736.                                             if(activeInterfaceType != 0 && anInt1085 == spriteIndex && anInt1084 == rsChildren.id) {
  9737.                                                 k6 = super.mouseX - anInt1087;
  9738.                                                 j7 = super.mouseY - anInt1088;
  9739.                                                 if(k6 < 5 && k6 > -5)
  9740.                                                     k6 = 0;
  9741.                                                 if(j7 < 5 && j7 > -5)
  9742.                                                     j7 = 0;
  9743.                                                 if(anInt989 < 5) {
  9744.                                                     k6 = 0;
  9745.                                                     j7 = 0;
  9746.                                                 }
  9747.                                                 itemSprite.drawSprite1(k5 + k6, j6 + j7, 128);
  9748.                                                 if(j6 + j7 < DrawingArea.topY && rsInterface.scrollPosition > 0) {
  9749.                                                     int i10 = (anInt945 * (DrawingArea.topY - j6 - j7)) / 3;
  9750.                                                     if(i10 > anInt945 * 10)
  9751.                                                         i10 = anInt945 * 10;
  9752.                                                     if(i10 > rsInterface.scrollPosition)
  9753.                                                         i10 = rsInterface.scrollPosition;
  9754.                                                     rsInterface.scrollPosition -= i10;
  9755.                                                     anInt1088 += i10;
  9756.                                                 }
  9757.                                                 if(j6 + j7 + 32 > DrawingArea.bottomY && rsInterface.scrollPosition < rsInterface.scrollMax - rsInterface.height) {
  9758.                                                     int j10 = (anInt945 * ((j6 + j7 + 32) - DrawingArea.bottomY)) / 3;
  9759.                                                     if(j10 > anInt945 * 10)
  9760.                                                         j10 = anInt945 * 10;
  9761.                                                     if(j10 > rsInterface.scrollMax - rsInterface.height - rsInterface.scrollPosition)
  9762.                                                         j10 = rsInterface.scrollMax - rsInterface.height - rsInterface.scrollPosition;
  9763.                                                     rsInterface.scrollPosition += j10;
  9764.                                                     anInt1088 -= j10;
  9765.                                                 }
  9766.                                             } else if(atInventoryInterfaceType != 0 && atInventoryIndex == spriteIndex && atInventoryInterface == rsChildren.id)
  9767.                                                 itemSprite.drawSprite1(k5, j6, 128);
  9768.                                             else
  9769.                                                 itemSprite.drawSprite(k5, j6);
  9770.                                             if(rsChildren.parentID  == 3824) {
  9771.                                                 infinityIcon.drawSprite(k5, j6);
  9772.                                             } else if(itemSprite.maxWidth == 33 || rsChildren.invStackSizes[spriteIndex] != 1) {
  9773.                                                 int k10 = rsChildren.invStackSizes[spriteIndex];
  9774.                                                 smallFont.method385(0, intToKOrMil(k10), j6 + 10 + j7, k5 + 1 + k6);//this is the shadow
  9775.                                                 if(k10 >= 1)
  9776.                                                     smallFont.method385(0xFFFF00, intToKOrMil(k10), j6 + 9 + j7, k5 + k6);
  9777.                                                 if(k10 >= 100000)
  9778.                                                     smallFont.method385(0xFFFFFF, intToKOrMil(k10), j6 + 9 + j7, k5 + k6);
  9779.                                                 if(k10 >= 10000000)
  9780.                                                     smallFont.method385(0x00FF80, intToKOrMil(k10), j6 + 9 + j7, k5 + k6);
  9781.                                                 if(k10 >= 1000000000)
  9782.                                                    smallFont.method385(0xFF0000, intToKOrMil(k10), j6 + 9 + j7, k5 + k6);
  9783.                                             }
  9784.                                         }
  9785.                                     }
  9786.                                 } else if(rsChildren.sprites != null && spriteIndex < 20) {
  9787.                                     Sprite sprite = rsChildren.sprites[spriteIndex];
  9788.                                     if(sprite != null)
  9789.                                         sprite.drawSprite(k5, j6);
  9790.                                 }
  9791.                                 spriteIndex++;
  9792.                             }
  9793.                         }
  9794.                     } else if(rsChildren.type == 3) {
  9795.                         boolean flag = false;
  9796.                         if(anInt1039 == rsChildren.id || anInt1048 == rsChildren.id || lastHoverChildId == rsChildren.id)
  9797.                             flag = true;
  9798.                         int j3;
  9799.                         if(interfaceIsSelected(rsChildren)) {
  9800.                             j3 = rsChildren.anInt219;
  9801.                             if(flag && rsChildren.anInt239 != 0)
  9802.                                 j3 = rsChildren.anInt239;
  9803.                         } else {
  9804.                             j3 = rsChildren.textColor;
  9805.                             if(flag && rsChildren.textHoverColour != 0)
  9806.                                 j3 = rsChildren.textHoverColour;
  9807.                         }
  9808.                         if(rsChildren.opacity == 0) {
  9809.                             if(rsChildren.aBoolean227)
  9810.                                 DrawingArea.drawPixels(rsChildren.height, ySpritePos, xSpritePos, j3, rsChildren.width);
  9811.                             else
  9812.                                 DrawingArea.fillPixels(xSpritePos, rsChildren.width, rsChildren.height, j3, ySpritePos);
  9813.                         } else if(rsChildren.aBoolean227)
  9814.                             DrawingArea.method335(j3, ySpritePos, rsChildren.width, rsChildren.height, 256 - (rsChildren.opacity & 0xff), xSpritePos);
  9815.                         else
  9816.                             DrawingArea.method338(ySpritePos, rsChildren.height, 256 - (rsChildren.opacity & 0xff), j3, rsChildren.width, xSpritePos);
  9817.                     } else if(rsChildren.type == 4) {
  9818.                         TextDrawingArea textDrawingArea = rsChildren.textDrawingAreas;
  9819.                         String s = rsChildren.message;
  9820.                         boolean flag1 = false;
  9821.                         if(anInt1039 == rsChildren.id || anInt1048 == rsChildren.id || lastHoverChildId == rsChildren.id)
  9822.                             flag1 = true;
  9823.                         int i4;
  9824.                         if(interfaceIsSelected(rsChildren)) {
  9825.                             i4 = rsChildren.anInt219;
  9826.                             if(flag1 && rsChildren.anInt239 != 0)
  9827.                                 i4 = rsChildren.anInt239;
  9828.                             if(rsChildren.disabledText.length() > 0)
  9829.                                 s = rsChildren.disabledText;
  9830.                         } else {
  9831.                             i4 = rsChildren.textColor;
  9832.                             if(flag1 && rsChildren.textHoverColour != 0)
  9833.                                 i4 = rsChildren.textHoverColour;
  9834.                         }
  9835.                         if(rsChildren.atActionType == 6 && aBoolean1149) {
  9836.                             s = "Please wait...";
  9837.                             i4 = rsChildren.textColor;
  9838.                         }
  9839.                         if(DrawingArea.width == 519) {
  9840.                             if(i4 == 0xffff00)
  9841.                                 i4 = 255;
  9842.                             if(i4 == 49152)
  9843.                                 i4 = 0xffffff;
  9844.                         }
  9845.                         if((rsChildren.parentID == 1151) || (rsChildren.parentID == 12855)) {
  9846.                             switch (i4) {
  9847.                                 case 16773120: i4 = 0xFE981F; break;
  9848.                                 case 7040819: i4 = 0xAF6A1A; break;
  9849.                             }
  9850.                         }
  9851.                         for(int l6 = ySpritePos + textDrawingArea.anInt1497; s.length() > 0; l6 += textDrawingArea.anInt1497) {
  9852.                             if(s.indexOf("%") != -1) {
  9853.                                 do {
  9854.                                     int k7 = s.indexOf("%1");
  9855.                                     if(k7 == -1)
  9856.                                         break;
  9857.                                     if(rsChildren.id < 4000 || rsChildren.id > 5000 && rsChildren.id !=13921 && rsChildren.id !=13922 && rsChildren.id !=12171 && rsChildren.id !=12172)
  9858.                                         s = s.substring(0, k7) + methodR(extractInterfaceValues(rsChildren, 0)) + s.substring(k7 + 2);
  9859.                                     else
  9860.                                         s = s.substring(0, k7) + interfaceIntToString(extractInterfaceValues(rsChildren, 0)) + s.substring(k7 + 2);
  9861.                                 } while(true);
  9862.                                 do {
  9863.                                     int l7 = s.indexOf("%2");
  9864.                                     if(l7 == -1)
  9865.                                         break;
  9866.                                     s = s.substring(0, l7) + interfaceIntToString(extractInterfaceValues(rsChildren, 1)) + s.substring(l7 + 2);
  9867.                                 } while(true);
  9868.                                 do {
  9869.                                     int i8 = s.indexOf("%3");
  9870.                                     if(i8 == -1)
  9871.                                         break;
  9872.                                     s = s.substring(0, i8) + interfaceIntToString(extractInterfaceValues(rsChildren, 2)) + s.substring(i8 + 2);
  9873.                                 } while(true);
  9874.                                 do {
  9875.                                     int j8 = s.indexOf("%4");
  9876.                                     if(j8 == -1)
  9877.                                         break;
  9878.                                     s = s.substring(0, j8) + interfaceIntToString(extractInterfaceValues(rsChildren, 3)) + s.substring(j8 + 2);
  9879.                                 } while(true);
  9880.                                 do {
  9881.                                     int k8 = s.indexOf("%5");
  9882.                                     if(k8 == -1)
  9883.                                         break;
  9884.                                     s = s.substring(0, k8) + interfaceIntToString(extractInterfaceValues(rsChildren, 4)) + s.substring(k8 + 2);
  9885.                                 } while(true);
  9886.                             }
  9887.                             int l8 = s.indexOf("\\n");
  9888.                             String s1;
  9889.                             if(l8 != -1) {
  9890.                                 s1 = s.substring(0, l8);
  9891.                                 s = s.substring(l8 + 2);
  9892.                             } else {
  9893.                                 s1 = s;
  9894.                                 s = "";
  9895.                             }
  9896.                             if(rsChildren.centerText)
  9897.                                 textDrawingArea.method382(i4, xSpritePos + rsChildren.width / 2, s1, l6, rsChildren.textShadow);
  9898.                             else
  9899.                                 textDrawingArea.method389(rsChildren.textShadow, xSpritePos, i4, s1, l6);
  9900.                         }
  9901.                     } else if(rsChildren.type == 5 || rsChildren.type == 10) {
  9902.                         Sprite sprite = null;
  9903.                         if(rsChildren.itemSpriteId1 != -1 && rsChildren.sprite1 == null) {
  9904.                             rsChildren.sprite1 = ItemDef.getSprite(rsChildren.itemSpriteId1, 1, (rsChildren.itemSpriteZoom1 == -1) ? 0 : -1,rsChildren.itemSpriteZoom1);
  9905.                             rsChildren.sprite2 = ItemDef.getSprite(rsChildren.itemSpriteId2, 1, (rsChildren.itemSpriteZoom2 == -1) ? 0 : -1,rsChildren.itemSpriteZoom2);
  9906.                             //rsChildren.sprite2 = ItemDef.getSprite(rsChildren.itemSpriteId2, rsChildren.invStackSizes[spriteIndex], selectedColour);
  9907.                             if(rsChildren.greyScale)
  9908.                                 rsChildren.sprite1.greyScale();
  9909.                         }
  9910.                         if(interfaceIsSelected(rsChildren) || hoverSpriteId == rsChildren.id)
  9911.                             sprite = rsChildren.sprite2;
  9912.                         else
  9913.                             sprite = rsChildren.sprite1;
  9914.                         if(spellSelected == 1 && rsChildren.id == spellID && spellID != 0 && sprite != null) {
  9915.                             sprite.drawSprite(xSpritePos, ySpritePos, 0xffffff);
  9916.                         } else {
  9917.                             if (sprite != null)
  9918.                                 if(rsChildren.type == 5)
  9919.                                     sprite.drawSprite(xSpritePos, ySpritePos);
  9920.                                 else
  9921.                                     sprite.drawSprite1(xSpritePos, ySpritePos, rsChildren.opacity);                            
  9922.                         }
  9923.                         if(autoCast && rsChildren.id == autocastId)
  9924.                             magicAuto.drawSprite(xSpritePos-3, ySpritePos-2);
  9925.                     } else if(rsChildren.type == 6) {
  9926.                         int k3 = Texture.textureInt1;
  9927.                         int j4 = Texture.textureInt2;
  9928.                         Texture.textureInt1 = xSpritePos + rsChildren.width / 2;
  9929.                         Texture.textureInt2 = ySpritePos + rsChildren.height / 2;
  9930.                         int i5 = Texture.anIntArray1470[rsChildren.modelRotation1] * rsChildren.modelZoom >> 16;
  9931.                         int l5 = Texture.anIntArray1471[rsChildren.modelRotation1] * rsChildren.modelZoom >> 16;
  9932.                         boolean flag2 = interfaceIsSelected(rsChildren);
  9933.                         int i7;
  9934.                         if(flag2)
  9935.                             i7 = rsChildren.anInt258;
  9936.                         else
  9937.                             i7 = rsChildren.anInt257;
  9938.                         Model model;
  9939.                         if(i7 == -1) {
  9940.                             model = rsChildren.method209(-1, -1, flag2);
  9941.                         } else {
  9942.                             Animation animation = Animation.anims[i7];
  9943.                             model = rsChildren.method209(animation.anIntArray354[rsChildren.anInt246], animation.anIntArray353[rsChildren.anInt246], flag2);
  9944.                         }
  9945.                         if(model != null)
  9946.                             model.method482(rsChildren.modelRotation2, 0, rsChildren.modelRotation1, 0, i5, l5);
  9947.                         Texture.textureInt1 = k3;
  9948.                         Texture.textureInt2 = j4;
  9949.                    
  9950.                     } else if(rsChildren.type == 7) {
  9951.                         TextDrawingArea textDrawingArea_1 = rsChildren.textDrawingAreas;
  9952.                         int k4 = 0;
  9953.                         for(int j5 = 0; j5 < rsChildren.height; j5++) {
  9954.                             for(int i6 = 0; i6 < rsChildren.width; i6++) {
  9955.                                 if(rsChildren.inv[k4] > 0) {
  9956.                                     ItemDef itemDef = ItemDef.forID(rsChildren.inv[k4] - 1);
  9957.                                     String s2 = itemDef.name;
  9958.                                     if(itemDef.stackable || rsChildren.invStackSizes[k4] != 1)
  9959.                                         s2 = s2 + " x" + intToKOrMilLongName(rsChildren.invStackSizes[k4]);
  9960.                                     int i9 = xSpritePos + i6 * (115 + rsChildren.invSpritePadX);
  9961.                                     int k9 = ySpritePos + j5 * (12 + rsChildren.invSpritePadY);
  9962.                                     if(rsChildren.centerText)
  9963.                                         textDrawingArea_1.method382(rsChildren.textColor, i9 + rsChildren.width / 2, s2, k9, rsChildren.textShadow);
  9964.                                     else
  9965.                                         textDrawingArea_1.method389(rsChildren.textShadow, i9, rsChildren.textColor, s2, k9);
  9966.                                 }
  9967.                                 k4++;
  9968.                             }
  9969.                         }
  9970.                     }  else if (rsChildren.type == 8 && (anInt1500 == rsChildren.id || anInt1044 == rsChildren.id || lastHoverToggleChildId == rsChildren.id) && anInt1501 == 100) {
  9971.                         int boxWidth = 0;
  9972.                         int boxHeight = 0;
  9973.                         TextDrawingArea textDrawingArea_2 = normalFont;
  9974.                         for (String s1 = rsChildren.message; s1.length() > 0;) {
  9975.                             int l7 = s1.indexOf("\\n");
  9976.                             String s4;
  9977.                             if (l7 != -1) {
  9978.                                 s4 = s1.substring(0, l7);
  9979.                                 s1 = s1.substring(l7 + 2);
  9980.                             } else {
  9981.                                 s4 = s1;
  9982.                                 s1 = "";
  9983.                             }
  9984.                             int j10 = textDrawingArea_2.getTextWidth(s4);
  9985.                             if (j10 > boxWidth) {
  9986.                                 boxWidth = j10;
  9987.                             }
  9988.                             boxHeight += textDrawingArea_2.anInt1497 + 1;
  9989.                         }
  9990.                         boxWidth += 6;
  9991.                         boxHeight += 7;
  9992.                         int xPos = (ySpritePos + rsChildren.width) - 5 - boxWidth;
  9993.                         int yPos = xSpritePos + rsChildren.height + 5;
  9994.                         if (xPos < ySpritePos + 5) {
  9995.                             xPos = ySpritePos + 5;
  9996.                         }
  9997.                         if (xPos + boxWidth > yScrollPoint + rsInterface.width) {
  9998.                             xPos = (yScrollPoint + rsInterface.width) - boxWidth;
  9999.                         }
  10000.                         if (yPos + boxHeight > xPadding + rsInterface.height) {
  10001.                             yPos = (xPadding + rsInterface.height) - boxHeight;
  10002.                         }
  10003.                         DrawingArea.drawPixels(boxHeight, yPos, xPos, 0xFFFFA0, boxWidth);
  10004.                         DrawingArea.fillPixels(xPos, boxWidth, boxHeight, 0, yPos);
  10005.                         String s2 = rsChildren.message;
  10006.                         for (int j11 = yPos + textDrawingArea_2.anInt1497 + 2; s2.length() > 0; j11 += textDrawingArea_2.anInt1497 + 1) {//anInt1497
  10007.                             int newLineIndex = s2.indexOf("\\n");
  10008.                             String s5;
  10009.                             if (newLineIndex != -1) {
  10010.                                 s5 = s2.substring(0, newLineIndex);
  10011.                                 s2 = s2.substring(newLineIndex + 2);
  10012.                             } else {
  10013.                                 s5 = s2;
  10014.                                 s2 = "";
  10015.                             }
  10016.                             textDrawingArea_2.method389(false, xPos + 3, 0, s5, j11);
  10017.                         }
  10018.                     } else if (rsChildren.type == 9) {
  10019.                         drawHoverBox(xSpritePos, ySpritePos, rsChildren.message);
  10020.                     }
  10021.             }
  10022.             DrawingArea.setDrawingArea(yBottomPos, xTopPos, xBottomPos, yTopPos);
  10023.         } catch(NullPointerException ex) {
  10024.            
  10025.         }
  10026.     }
  10027.    
  10028.     public void drawHoverBox(int xPos, int yPos, String text) {
  10029.         String[] results = text.split("\n");
  10030.         int height = (results.length * 16) + 6;
  10031.         int width;
  10032.         width = smallFont.getTextWidth(results[0]) + 6;
  10033.         for(int i = 1; i < results.length; i++)
  10034.             if(width <= smallFont.getTextWidth(results[i]) + 6)
  10035.                 width = smallFont.getTextWidth(results[i]) + 6;
  10036.         DrawingArea.drawPixels(height, yPos, xPos, 0xFFFFA0, width);
  10037.         DrawingArea.fillPixels(xPos, width, height, 0, yPos);
  10038.         yPos += 14;
  10039.         for(int i = 0; i < results.length; i++) {
  10040.             smallFont.method389(false, xPos + 3, 0, results[i], yPos);
  10041.             yPos += 16;
  10042.         }
  10043.     }
  10044.  
  10045.     private void randomizeBackground(Background background) {
  10046.         int j = 256;
  10047.         for(int k = 0; k < anIntArray1190.length; k++)
  10048.             anIntArray1190[k] = 0;
  10049.  
  10050.         for(int l = 0; l < 5000; l++) {
  10051.             int i1 = (int)(Math.random() * 128D * (double)j);
  10052.             anIntArray1190[i1] = (int)(Math.random() * 256D);
  10053.         }
  10054.         for(int j1 = 0; j1 < 20; j1++) {
  10055.             for(int k1 = 1; k1 < j - 1; k1++) {
  10056.                 for(int i2 = 1; i2 < 127; i2++) {
  10057.                     int k2 = i2 + (k1 << 7);
  10058.                     anIntArray1191[k2] = (anIntArray1190[k2 - 1] + anIntArray1190[k2 + 1] + anIntArray1190[k2 - 128] + anIntArray1190[k2 + 128]) / 4;
  10059.                 }
  10060.  
  10061.             }
  10062.             int ai[] = anIntArray1190;
  10063.             anIntArray1190 = anIntArray1191;
  10064.             anIntArray1191 = ai;
  10065.         }
  10066.         if(background != null) {
  10067.             int l1 = 0;
  10068.             for(int j2 = 0; j2 < background.anInt1453; j2++) {
  10069.                 for(int l2 = 0; l2 < background.anInt1452; l2++)
  10070.                     if(background.aByteArray1450[l1++] != 0) {
  10071.                         int i3 = l2 + 16 + background.anInt1454;
  10072.                         int j3 = j2 + 16 + background.anInt1455;
  10073.                         int k3 = i3 + (j3 << 7);
  10074.                         anIntArray1190[k3] = 0;
  10075.                     }
  10076.             }
  10077.         }
  10078.     }
  10079.  
  10080.     private void method107(int i, int j, Stream stream, Player player)
  10081.     {
  10082.         if((i & 0x400) != 0)
  10083.         {
  10084.             player.anInt1543 = stream.method428();
  10085.             player.anInt1545 = stream.method428();
  10086.             player.anInt1544 = stream.method428();
  10087.             player.anInt1546 = stream.method428();
  10088.             player.anInt1547 = stream.method436() + loopCycle;
  10089.             player.anInt1548 = stream.method435() + loopCycle;
  10090.             player.anInt1549 = stream.method428();
  10091.             player.method446();
  10092.         }
  10093.         if((i & 0x100) != 0)
  10094.         {
  10095.             player.anInt1520 = stream.method434();
  10096.             int k = stream.readDWord();
  10097.             player.anInt1524 = k >> 16;
  10098.             player.anInt1523 = loopCycle + (k & 0xffff);
  10099.             player.anInt1521 = 0;
  10100.             player.anInt1522 = 0;
  10101.             if(player.anInt1523 > loopCycle)
  10102.                 player.anInt1521 = -1;
  10103.             if(player.anInt1520 == 65535)
  10104.                 player.anInt1520 = -1;
  10105.         }
  10106.         if((i & 8) != 0)
  10107.         {
  10108.             int l = stream.method434();
  10109.             if(l == 65535)
  10110.                 l = -1;
  10111.             int i2 = stream.method427();
  10112.             if(l == player.anim && l != -1)
  10113.             {
  10114.                 int i3 = Animation.anims[l].anInt365;
  10115.                 if(i3 == 1)
  10116.                 {
  10117.                     player.anInt1527 = 0;
  10118.                     player.anInt1528 = 0;
  10119.                     player.anInt1529 = i2;
  10120.                     player.anInt1530 = 0;
  10121.                 }
  10122.                 if(i3 == 2)
  10123.                     player.anInt1530 = 0;
  10124.             } else
  10125.             if(l == -1 || player.anim == -1 || Animation.anims[l].anInt359 >= Animation.anims[player.anim].anInt359)
  10126.             {
  10127.                 player.anim = l;
  10128.                 player.anInt1527 = 0;
  10129.                 player.anInt1528 = 0;
  10130.                 player.anInt1529 = i2;
  10131.                 player.anInt1530 = 0;
  10132.                 player.anInt1542 = player.smallXYIndex;
  10133.             }
  10134.         }
  10135.         if((i & 4) != 0)
  10136.         {
  10137.             player.textSpoken = stream.readString();
  10138.             if(player.textSpoken.charAt(0) == '~')
  10139.             {
  10140.                 player.textSpoken = player.textSpoken.substring(1);
  10141.                 pushMessage(player.textSpoken, 2, player.name);
  10142.             } else
  10143.             if(player == myPlayer)
  10144.                 pushMessage(player.textSpoken, 2, player.name);
  10145.             player.anInt1513 = 0;
  10146.             player.anInt1531 = 0;
  10147.             player.textCycle = 150;
  10148.         }
  10149.         if((i & 0x80) != 0)
  10150.         {
  10151.             //right fucking here
  10152.             int i1 = stream.method434();
  10153.             int myPrivilege = stream.readUnsignedByte();
  10154.             int j3 = stream.method427();
  10155.             int k3 = stream.currentOffset;
  10156.             if(player.name != null && player.visible)
  10157.             {
  10158.                 long l3 = TextClass.longForName(player.name);
  10159.                 boolean flag = false;
  10160.                 if(myPrivilege <= 1)
  10161.                 {
  10162.                     for(int i4 = 0; i4 < ignoreCount; i4++)
  10163.                     {
  10164.                         if(ignoreListAsLongs[i4] != l3)
  10165.                             continue;
  10166.                         flag = true;
  10167.                         break;
  10168.                     }
  10169.  
  10170.                 }
  10171.                 if(!flag && anInt1251 == 0)
  10172.                     try
  10173.                     {
  10174.                         aStream_834.currentOffset = 0;
  10175.                         stream.method442(j3, 0, aStream_834.buffer);
  10176.                         aStream_834.currentOffset = 0;
  10177.                         String s = TextInput.method525(j3, aStream_834);
  10178.                         //s = Censor.doCensor(s);
  10179.                         player.textSpoken = s;
  10180.                         player.anInt1513 = i1 >> 8;
  10181.                         player.privelage = myPrivilege;
  10182.                         player.anInt1531 = i1 & 0xff;
  10183.                         player.textCycle = 150;
  10184.                         if(myPrivilege == 0){
  10185.                             pushMessage(s, 2, player.name);
  10186.                         } else if(myPrivilege == 1){
  10187.                             pushMessage(s, 2, "@cr1@" + player.name);
  10188.                         } else if(myPrivilege == 2 || myPrivilege == 3){
  10189.                             pushMessage(s, 2, "@cr2@" + player.name);
  10190.                         } else if(myPrivilege == 4){
  10191.                             pushMessage(s, 2, "@cr3@" + player.name);
  10192.                         }
  10193.                         else
  10194.                                 pushMessage(myPlayer.textSpoken, 2,
  10195.                                         myPlayer.name);
  10196.                     } catch(Exception exception) {
  10197.                         signlink.reporterror("cde2");
  10198.                     }
  10199.             }
  10200.             stream.currentOffset = k3 + j3;
  10201.         }
  10202.         if((i & 1) != 0)
  10203.         {
  10204.             player.interactingEntity = stream.method434();
  10205.             if(player.interactingEntity == 65535)
  10206.                 player.interactingEntity = -1;
  10207.         }
  10208.         if((i & 0x10) != 0)
  10209.         {
  10210.             int j1 = stream.method427();
  10211.             byte abyte0[] = new byte[j1];
  10212.             Stream stream_1 = new Stream(abyte0);
  10213.             stream.readBytes(j1, 0, abyte0);
  10214.             aStreamArray895s[j] = stream_1;
  10215.             player.updatePlayer(stream_1);
  10216.         }
  10217.         if((i & 2) != 0)
  10218.         {
  10219.             player.anInt1538 = stream.method436();
  10220.             player.anInt1539 = stream.method434();
  10221.         }
  10222.        
  10223.         if((i & 0x20) != 0)
  10224.         {
  10225.             int damage = stream.readUnsignedByte();
  10226.             int type = stream.method426();
  10227.             int icon = stream.readUnsignedByte();
  10228.             int focusPlayer = stream.readUnsignedByte();
  10229.             player.updateHitData(type, damage, loopCycle, icon, focusPlayer, 0);
  10230.             player.loopCycleStatus = loopCycle + 300;
  10231.             player.currentHealth = stream.method427();
  10232.             player.maxHealth = stream.readUnsignedByte();
  10233.         }
  10234.         if((i & 0x200) != 0)
  10235.         {
  10236.             int damage = stream.readUnsignedByte();
  10237.             int type = stream.method428();
  10238.             int icon = stream.readUnsignedByte();
  10239.             int focusPlayer = stream.readUnsignedByte();
  10240.             player.updateHitData(type, damage, loopCycle, icon, focusPlayer, 0);
  10241.             player.loopCycleStatus = loopCycle + 300;
  10242.             player.currentHealth = stream.readUnsignedByte();
  10243.             player.maxHealth = stream.method427();
  10244.         }
  10245.     }
  10246.  
  10247.     private void method108()
  10248.     {
  10249.         try
  10250.         {
  10251.             int j = myPlayer.x + anInt1278;
  10252.             int k = myPlayer.y + anInt1131;
  10253.             if(anInt1014 - j < -500 || anInt1014 - j > 500 || anInt1015 - k < -500 || anInt1015 - k > 500)
  10254.             {
  10255.                 anInt1014 = j;
  10256.                 anInt1015 = k;
  10257.             }
  10258.             if(anInt1014 != j)
  10259.                 anInt1014 += (j - anInt1014) / 16;
  10260.             if(anInt1015 != k)
  10261.                 anInt1015 += (k - anInt1015) / 16;
  10262.             if(super.keyArray[1] == 1)
  10263.                 anInt1186 += (-24 - anInt1186) / 2;
  10264.             else
  10265.             if(super.keyArray[2] == 1)
  10266.                 anInt1186 += (24 - anInt1186) / 2;
  10267.             else
  10268.                 anInt1186 /= 2;
  10269.             if(super.keyArray[3] == 1)
  10270.                 anInt1187 += (12 - anInt1187) / 2;
  10271.             else
  10272.             if(super.keyArray[4] == 1)
  10273.                 anInt1187 += (-12 - anInt1187) / 2;
  10274.             else
  10275.                 anInt1187 /= 2;
  10276.               compassRotation = compassRotation + anInt1186 / 2 & 0x7ff;
  10277.               anInt1184 += anInt1187 / 2;
  10278.             if(anInt1184 < 128)
  10279.                 anInt1184 = 128;
  10280.             if(anInt1184 > 383)
  10281.                 anInt1184 = 383;
  10282.             int l = anInt1014 >> 7;
  10283.             int i1 = anInt1015 >> 7;
  10284.             int j1 = method42(plane, anInt1015, anInt1014);
  10285.             int k1 = 0;
  10286.             if(l > 3 && i1 > 3 && l < 100 && i1 < 100)
  10287.             {
  10288.                 for(int l1 = l - 4; l1 <= l + 4; l1++)
  10289.                 {
  10290.                     for(int k2 = i1 - 4; k2 <= i1 + 4; k2++)
  10291.                     {
  10292.                         int l2 = plane;
  10293.                         if(l2 < 3 && (byteGroundArray[1][l1][k2] & 2) == 2)
  10294.                             l2++;
  10295.                         int i3 = j1 - intGroundArray[l2][l1][k2];
  10296.                         if(i3 > k1)
  10297.                             k1 = i3;
  10298.                     }
  10299.  
  10300.                 }
  10301.  
  10302.             }
  10303.             anInt1005++;
  10304.             if(anInt1005 > 1512)
  10305.             {
  10306.                 anInt1005 = 0;
  10307.                 stream.createFrame(77);
  10308.                 stream.writeWordBigEndian(0);
  10309.                 int i2 = stream.currentOffset;
  10310.                 stream.writeWordBigEndian((int)(Math.random() * 256D));
  10311.                 stream.writeWordBigEndian(101);
  10312.                 stream.writeWordBigEndian(233);
  10313.                 stream.writeWord(45092);
  10314.                 if((int)(Math.random() * 2D) == 0)
  10315.                     stream.writeWord(35784);
  10316.                 stream.writeWordBigEndian((int)(Math.random() * 256D));
  10317.                 stream.writeWordBigEndian(64);
  10318.                 stream.writeWordBigEndian(38);
  10319.                 stream.writeWord((int)(Math.random() * 65536D));
  10320.                 stream.writeWord((int)(Math.random() * 65536D));
  10321.                 stream.writeBytes(stream.currentOffset - i2);
  10322.             }
  10323.             int j2 = k1 * 192;
  10324.             if(j2 > 0x17f00)
  10325.                 j2 = 0x17f00;
  10326.             if(j2 < 32768)
  10327.                 j2 = 32768;
  10328.             if(j2 > anInt984)
  10329.             {
  10330.                 anInt984 += (j2 - anInt984) / 24;
  10331.                 return;
  10332.             }
  10333.             if(j2 < anInt984)
  10334.             {
  10335.                 anInt984 += (j2 - anInt984) / 80;
  10336.             }
  10337.         }
  10338.         catch(Exception _ex)
  10339.         {
  10340.             signlink.reporterror("glfc_ex " + myPlayer.x + "," + myPlayer.y + "," + anInt1014 + "," + anInt1015 + "," + anInt1069 + "," + anInt1070 + "," + baseX + "," + baseY);
  10341.             throw new RuntimeException("eek");
  10342.         }
  10343.     }
  10344.  
  10345.     public void processDrawing()
  10346.     {
  10347.         if(rsAlreadyLoaded || loadingError || genericLoadingError)
  10348.         {
  10349.             showErrorScreen();
  10350.             return;
  10351.         }
  10352.         anInt1061++;
  10353.         if(!loggedIn)
  10354.             drawLoginScreen(false);
  10355.         else
  10356.             drawGameScreen();
  10357.         anInt1213 = 0;
  10358.     }
  10359.  
  10360.     private boolean isFriendOrSelf(String s)
  10361.     {
  10362.         if(s == null)
  10363.             return false;
  10364.         for(int i = 0; i < friendsCount; i++)
  10365.             if(s.equalsIgnoreCase(friendsList[i]))
  10366.                 return true;
  10367.         return s.equalsIgnoreCase(myPlayer.name);
  10368.     }
  10369.  
  10370.     private static String combatDiffColor(int i, int j)
  10371.     {
  10372.         int k = i - j;
  10373.         if(k < -9)
  10374.             return "@red@";
  10375.         if(k < -6)
  10376.             return "@or3@";
  10377.         if(k < -3)
  10378.             return "@or2@";
  10379.         if(k < 0)
  10380.             return "@or1@";
  10381.         if(k > 9)
  10382.             return "@gre@";
  10383.         if(k > 6)
  10384.             return "@gr3@";
  10385.         if(k > 3)
  10386.             return "@gr2@";
  10387.         if(k > 0)
  10388.             return "@gr1@";
  10389.         else
  10390.             return "@yel@";
  10391.     }
  10392.  
  10393.     private void setWaveVolume(int i)
  10394.     {
  10395.         signlink.wavevol = i;
  10396.     }
  10397.  
  10398.     private void draw3dScreen()
  10399.     {
  10400.     alertHandler.processAlerts();
  10401.         drawSplitPrivateChat(0,getChatBackIncreaseY());
  10402.         if(crossType == 1)
  10403.         {
  10404.             crosses[crossIndex / 100].drawSprite(crossX - 8 - 4, crossY - 8 - 4);
  10405.             anInt1142++;
  10406.             if(anInt1142 > 67)
  10407.             {
  10408.                 anInt1142 = 0;
  10409.                 stream.createFrame(78);
  10410.             }
  10411.         }
  10412.         if(crossType == 2)
  10413.             crosses[4 + crossIndex / 100].drawSprite(crossX - 8 - 4, crossY - 8 - 4);
  10414.         if(walkableInterfaceID != -1) {
  10415.             method119(anInt945, walkableInterfaceID);
  10416.             if(walkableInterfaceID == 197 && toggleFullscreen)
  10417.                 drawInterface(0, 0 + getMapIncreaseX() , RSInterface.interfaceCache[walkableInterfaceID], 0 - 255 + 50 + getMapIncreaseY());
  10418.             else
  10419.                 drawInterface(0, 0, RSInterface.interfaceCache[walkableInterfaceID], 0);
  10420.         }
  10421.         if(openInterfaceID != -1) {
  10422.             method119(anInt945, openInterfaceID);
  10423.             RSInterface rsInterface = RSInterface.interfaceCache[openInterfaceID];
  10424.             int width = toggleFullscreen ? getScreenWidth() : 516;
  10425.             int height = toggleFullscreen ? getScreenHeight() : 338;
  10426.             if(toggleFullscreen)
  10427.                 drawInterface(0, 0 + (width - rsInterface.width) / 2, rsInterface, 0 + (height - rsInterface.height) / 2);
  10428.             else
  10429.                 drawInterface(0, 0, rsInterface, 0);//first 1
  10430.         }
  10431.         method70();
  10432.         if(displayOverLayIcon == 1)
  10433.             multiOverlay.drawSprite(toggleFullscreen ? xPaddingmapBackImage + getMapIncreaseX() - 50 : 472, toggleFullscreen ? 1 : 296 + getMapIncreaseY());
  10434.         if(openBOX)
  10435.         {
  10436.             openBOX = false;
  10437.             donatorPayment = inputbox();
  10438.         }
  10439.         if(fpsOn)
  10440.         {
  10441.             char c = '\u01FB';
  10442.             int k = 20;
  10443.             int i1 = 0xffff00;
  10444.             if(super.fps < 15)
  10445.                 i1 = 0xff0000;
  10446.             normalFont.method380("Fps:" + super.fps, c, i1, k);
  10447.             k += 15;
  10448.             Runtime runtime = Runtime.getRuntime();
  10449.             int j1 = (int)((runtime.totalMemory() - runtime.freeMemory()) / 1024L);
  10450.             i1 = 0xffff00;
  10451.             if(j1 > 0x2000000 && lowMem)
  10452.                 i1 = 0xff0000;
  10453.             normalFont.method380("Mem:" + j1 + "k", c, 0xffff00, k);
  10454.             k += 15;
  10455.         }
  10456.         int i1 = 0xffff00;
  10457.         int x = baseX + (myPlayer.x - 6 >> 7);
  10458.         int y = baseY + (myPlayer.y - 6 >> 7);
  10459.         if (clientData)
  10460.         {
  10461.             char c = '\u01FB';
  10462.             int k = 20;
  10463.             if(super.fps < 15)
  10464.             i1 = 0xff0000;
  10465.             normalFont.method385(0xffff00, "Fps: " + super.fps, 285, 5);
  10466.             Runtime runtime = Runtime.getRuntime();
  10467.             int j1 = (int)((runtime.totalMemory() - runtime.freeMemory()) / 1024L);
  10468.             i1 = 0xffff00;
  10469.             if(j1 > 0x2000000 && lowMem)
  10470.             i1 = 0xff0000;
  10471.             k += 15;
  10472.             normalFont.method385(0xffff00, "Mem: " + j1 + "k", 299, 5);
  10473.             normalFont.method385(0xffff00, "Mouse X: " + super.mouseX + " , Mouse Y: " + super.mouseY, 314, 5);
  10474.             normalFont.method385(0xffff00, "Coords: " + x + ", " + y, 329, 5);
  10475.         }
  10476.         if(systemUpdatetime != 0)
  10477.         {
  10478.             int j = systemUpdatetime / 50;
  10479.             int l = j / 60;
  10480.             j %= 60;
  10481.             if(j < 10)
  10482.                 normalFont.method385(0xffff00, "System update in: " + l + ":0" + j, 329, 4);
  10483.             else
  10484.                 normalFont.method385(0xffff00, "System update in: " + l + ":" + j, 329, 4);
  10485.             anInt849++;
  10486.             if(anInt849 > 75)
  10487.             {
  10488.                 anInt849 = 0;
  10489.                 stream.createFrame(148);
  10490.             }
  10491.         }
  10492.         if(openInterfaceID == 22595) {//   
  10493.             normalFont.method385(0xffffff, newPasswordString + ((loopCycle % 20 < 10) ? "|" : " "), (334-149)/2 + 70, (512-370- normalFont.getTextWidth(newPasswordString + " ")    )/2 + 221);
  10494.         }
  10495.         if(counterOn)
  10496.             drawCounterOnScreen(getMapIncreaseX(),getMapIncreaseY());
  10497.         if(!contextMenuOpen) {
  10498.             processRightClick();
  10499.             drawTooltip();
  10500.         } else
  10501.             drawMenu(4,4);
  10502.     }
  10503.  
  10504.     private void addIgnore(long l)
  10505.     {
  10506.         try
  10507.         {
  10508.             if(l == 0L)
  10509.                 return;
  10510.             if(ignoreCount >= 100)
  10511.             {
  10512.                 pushMessage("Your ignore list is full. Max of 100 hit", 0, "");
  10513.                 return;
  10514.             }
  10515.             String s = TextClass.fixName(TextClass.nameForLong(l));
  10516.             for(int j = 0; j < ignoreCount; j++)
  10517.                 if(ignoreListAsLongs[j] == l)
  10518.                 {
  10519.                     pushMessage(s + " is already on your ignore list", 0, "");
  10520.                     return;
  10521.                 }
  10522.             for(int k = 0; k < friendsCount; k++)
  10523.                 if(friendsListAsLongs[k] == l)
  10524.                 {
  10525.                     pushMessage("Please remove " + s + " from your friend list first", 0, "");
  10526.                     return;
  10527.                 }
  10528.  
  10529.             ignoreListAsLongs[ignoreCount++] = l;
  10530.             needDrawTabArea = true;
  10531.             stream.createFrame(133);
  10532.             stream.writeQWord(l);
  10533.             return;
  10534.         }
  10535.         catch(RuntimeException runtimeexception)
  10536.         {
  10537.             signlink.reporterror("45688, " + l + ", " + 4 + ", " + runtimeexception.toString());
  10538.         }
  10539.         throw new RuntimeException();
  10540.     }
  10541.  
  10542.     private void method114()
  10543.     {
  10544.         for(int i = -1; i < playerCount; i++)
  10545.         {
  10546.             int j;
  10547.             if(i == -1)
  10548.                 j = myPlayerIndex;
  10549.             else
  10550.                 j = playerIndices[i];
  10551.             Player player = playerArray[j];
  10552.             if(player != null)
  10553.                 method96(player);
  10554.         }
  10555.  
  10556.     }
  10557.  
  10558.     private void method115()
  10559.     {
  10560.         if(loadingStage == 2)
  10561.         {
  10562.             for(Class30_Sub1 class30_sub1 = (Class30_Sub1)aClass19_1179.reverseGetFirst(); class30_sub1 != null; class30_sub1 = (Class30_Sub1)aClass19_1179.reverseGetNext())
  10563.             {
  10564.                 if(class30_sub1.anInt1294 > 0)
  10565.                     class30_sub1.anInt1294--;
  10566.                 if(class30_sub1.anInt1294 == 0)
  10567.                 {
  10568.                     if(class30_sub1.anInt1299 < 0 || ObjectManager.method178(class30_sub1.anInt1299, class30_sub1.anInt1301))
  10569.                     {
  10570.                         method142(class30_sub1.anInt1298, class30_sub1.anInt1295, class30_sub1.anInt1300, class30_sub1.anInt1301, class30_sub1.anInt1297, class30_sub1.anInt1296, class30_sub1.anInt1299);
  10571.                         class30_sub1.unlink();
  10572.                     }
  10573.                 } else
  10574.                 {
  10575.                     if(class30_sub1.anInt1302 > 0)
  10576.                         class30_sub1.anInt1302--;
  10577.                     if(class30_sub1.anInt1302 == 0 && class30_sub1.anInt1297 >= 1 && class30_sub1.anInt1298 >= 1 && class30_sub1.anInt1297 <= 102 && class30_sub1.anInt1298 <= 102 && (class30_sub1.anInt1291 < 0 || ObjectManager.method178(class30_sub1.anInt1291, class30_sub1.anInt1293)))
  10578.                     {
  10579.                         method142(class30_sub1.anInt1298, class30_sub1.anInt1295, class30_sub1.anInt1292, class30_sub1.anInt1293, class30_sub1.anInt1297, class30_sub1.anInt1296, class30_sub1.anInt1291);
  10580.                         class30_sub1.anInt1302 = -1;
  10581.                         if(class30_sub1.anInt1291 == class30_sub1.anInt1299 && class30_sub1.anInt1299 == -1)
  10582.                             class30_sub1.unlink();
  10583.                         else
  10584.                         if(class30_sub1.anInt1291 == class30_sub1.anInt1299 && class30_sub1.anInt1292 == class30_sub1.anInt1300 && class30_sub1.anInt1293 == class30_sub1.anInt1301)
  10585.                             class30_sub1.unlink();
  10586.                     }
  10587.                 }
  10588.             }
  10589.  
  10590.         }
  10591.     }
  10592.    
  10593.    
  10594.     //stops the click from going over sprite - idiots wrong (sigex)
  10595.     private void determineMenuSize() {
  10596.         int i = boldFont.getTextWidth("Choose Option");
  10597.         for(int j = 0; j < menuActionRow; j++)
  10598.         {
  10599.             int k = boldFont.getTextWidth(menuActionName[j]);
  10600.             if(k > i)
  10601.                 i = k;
  10602.         }
  10603.         i += 8;
  10604.         int l = 15 * menuActionRow + 21;
  10605.         int paddingRight = 8;
  10606.         int paddingBottom = 8;
  10607.         int width = toggleFullscreen ? getScreenWidth() : 765;
  10608.         int height = toggleFullscreen ? getScreenHeight() : 503;
  10609.         if(super.saveClickX > 0 && super.saveClickY > 0 && super.saveClickX < width && super.saveClickY < height) {
  10610.             int x = super.saveClickX - 0 - i / 2;
  10611.             if(x < 0){
  10612.                 x = 0;
  10613.             } else if(x + i > width - paddingRight)
  10614.                 x = width - paddingRight - i;
  10615.             int y = super.saveClickY - 0;
  10616.             if(y + l > width) {
  10617.                 y = width - l;
  10618.             }
  10619.             if(y < 0) {
  10620.                 y = 0;
  10621.             } else if(y + l > height - paddingBottom)
  10622.                 y = height - paddingBottom - l;
  10623.             if(l > height)
  10624.                 y = 0;
  10625.             contextMenuOpen = true;
  10626.             menuOffsetX = x;
  10627.             menuOffsetY = y;
  10628.             menuWidth = i;
  10629.             menuHeight = 15 * menuActionRow + 22;
  10630.         }
  10631.     }
  10632.  
  10633.     private void method117(Stream stream)
  10634.     {
  10635.         stream.initBitAccess();
  10636.         int j = stream.readBits(1);
  10637.         if(j == 0)
  10638.             return;
  10639.         int k = stream.readBits(2);
  10640.         if(k == 0)
  10641.         {
  10642.             anIntArray894[anInt893++] = myPlayerIndex;
  10643.             return;
  10644.         }
  10645.         if(k == 1)
  10646.         {
  10647.             int l = stream.readBits(3);
  10648.             myPlayer.moveInDir(false, l);
  10649.             int k1 = stream.readBits(1);
  10650.             if(k1 == 1)
  10651.                 anIntArray894[anInt893++] = myPlayerIndex;
  10652.             return;
  10653.         }
  10654.         if(k == 2)
  10655.         {
  10656.             int i1 = stream.readBits(3);
  10657.             myPlayer.moveInDir(true, i1);
  10658.             int l1 = stream.readBits(3);
  10659.             myPlayer.moveInDir(true, l1);
  10660.             int j2 = stream.readBits(1);
  10661.             if(j2 == 1)
  10662.                 anIntArray894[anInt893++] = myPlayerIndex;
  10663.             return;
  10664.         }
  10665.         if(k == 3)
  10666.         {
  10667.             plane = stream.readBits(2);
  10668.             int j1 = stream.readBits(1);
  10669.             int i2 = stream.readBits(1);
  10670.             if(i2 == 1)
  10671.                 anIntArray894[anInt893++] = myPlayerIndex;
  10672.             int k2 = stream.readBits(7);
  10673.             int l2 = stream.readBits(7);
  10674.             myPlayer.setPos(l2, k2, j1 == 1);
  10675.         }
  10676.     }
  10677.  
  10678.     private void nullLoader()
  10679.     {
  10680.         aBoolean831 = false;
  10681.         while(drawingFlames)
  10682.         {
  10683.             aBoolean831 = false;
  10684.             try
  10685.             {
  10686.                 Thread.sleep(50L);
  10687.             }
  10688.             catch(Exception _ex) { }
  10689.         }
  10690.         aBackground_966 = null;
  10691.         aBackground_967 = null;
  10692.         aBackgroundArray1152s = null;
  10693.         anIntArray850 = null;
  10694.         anIntArray851 = null;
  10695.         anIntArray852 = null;
  10696.         anIntArray853 = null;
  10697.         anIntArray1190 = null;
  10698.         anIntArray1191 = null;
  10699.         anIntArray828 = null;
  10700.         anIntArray829 = null;
  10701.         aClass30_Sub2_Sub1_Sub1_1201 = null;
  10702.         aClass30_Sub2_Sub1_Sub1_1202 = null;
  10703.     }
  10704.  
  10705.     private boolean method119(int i, int j)
  10706.     {
  10707.         boolean flag1 = false;
  10708.         RSInterface class9 = RSInterface.interfaceCache[j];
  10709.         if(class9 != null)
  10710.             try {
  10711.                 for(int k = 0; k < class9.children.length; k++)
  10712.                 {
  10713.                     if(class9.children[k] == -1)
  10714.                         break;
  10715.                     RSInterface class9_1 = RSInterface.interfaceCache[class9.children[k]];
  10716.                     if(class9_1.type == 1)
  10717.                         flag1 |= method119(i, class9_1.id);
  10718.                     if(class9_1.type == 6 && (class9_1.anInt257 != -1 || class9_1.anInt258 != -1))
  10719.                     {
  10720.                         boolean flag2 = interfaceIsSelected(class9_1);
  10721.                         int l;
  10722.                         if(flag2)
  10723.                             l = class9_1.anInt258;
  10724.                         else
  10725.                             l = class9_1.anInt257;
  10726.                         if(l != -1)
  10727.                         {
  10728.                             Animation animation = Animation.anims[l];
  10729.                             for(class9_1.anInt208 += i; class9_1.anInt208 > animation.method258(class9_1.anInt246);)
  10730.                             {
  10731.                                 class9_1.anInt208 -= animation.method258(class9_1.anInt246) + 1;
  10732.                                 class9_1.anInt246++;
  10733.                                 if(class9_1.anInt246 >= animation.anInt352)
  10734.                                 {
  10735.                                     class9_1.anInt246 -= animation.anInt356;
  10736.                                     if(class9_1.anInt246 < 0 || class9_1.anInt246 >= animation.anInt352)
  10737.                                         class9_1.anInt246 = 0;
  10738.                                 }
  10739.                                 flag1 = true;
  10740.                             }
  10741.  
  10742.                         }
  10743.                     }
  10744.                 }
  10745.                 return flag1;
  10746.             } catch(NullPointerException ex) {
  10747.                 return flag1;
  10748.             }
  10749.         else
  10750.             return flag1;
  10751.     }
  10752.  
  10753.     private int method120()
  10754.     {
  10755.         int j = 3;
  10756.         if(yCameraCurve < 310)
  10757.         {
  10758.             int k = xCameraPos >> 7;
  10759.             int l = yCameraPos >> 7;
  10760.             int i1 = myPlayer.x >> 7;
  10761.             int j1 = myPlayer.y >> 7;
  10762.             if((byteGroundArray[plane][k][l] & 4) != 0)
  10763.                 j = plane;
  10764.             int k1;
  10765.             if(i1 > k)
  10766.                 k1 = i1 - k;
  10767.             else
  10768.                 k1 = k - i1;
  10769.             int l1;
  10770.             if(j1 > l)
  10771.                 l1 = j1 - l;
  10772.             else
  10773.                 l1 = l - j1;
  10774.             if(k1 > l1)
  10775.             {
  10776.                 int i2 = (l1 * 0x10000) / k1;
  10777.                 int k2 = 32768;
  10778.                 while(k != i1)
  10779.                 {
  10780.                     if(k < i1)
  10781.                         k++;
  10782.                     else
  10783.                     if(k > i1)
  10784.                         k--;
  10785.                     if((byteGroundArray[plane][k][l] & 4) != 0)
  10786.                         j = plane;
  10787.                     k2 += i2;
  10788.                     if(k2 >= 0x10000)
  10789.                     {
  10790.                         k2 -= 0x10000;
  10791.                         if(l < j1)
  10792.                             l++;
  10793.                         else
  10794.                         if(l > j1)
  10795.                             l--;
  10796.                         if((byteGroundArray[plane][k][l] & 4) != 0)
  10797.                             j = plane;
  10798.                     }
  10799.                 }
  10800.             } else
  10801.             {
  10802.                 int j2 = (k1 * 0x10000) / l1;
  10803.                 int l2 = 32768;
  10804.                 while(l != j1)
  10805.                 {
  10806.                     if(l < j1)
  10807.                         l++;
  10808.                     else
  10809.                     if(l > j1)
  10810.                         l--;
  10811.                     if((byteGroundArray[plane][k][l] & 4) != 0)
  10812.                         j = plane;
  10813.                     l2 += j2;
  10814.                     if(l2 >= 0x10000)
  10815.                     {
  10816.                         l2 -= 0x10000;
  10817.                         if(k < i1)
  10818.                             k++;
  10819.                         else
  10820.                         if(k > i1)
  10821.                             k--;
  10822.                         if((byteGroundArray[plane][k][l] & 4) != 0)
  10823.                             j = plane;
  10824.                     }
  10825.                 }
  10826.             }
  10827.         }
  10828.         if((byteGroundArray[plane][myPlayer.x >> 7][myPlayer.y >> 7] & 4) != 0)
  10829.             j = plane;
  10830.         return j;
  10831.     }
  10832.  
  10833.     private int method121()
  10834.     {
  10835.         int j = method42(plane, yCameraPos, xCameraPos);
  10836.         if(j - zCameraPos < 800 && (byteGroundArray[plane][xCameraPos >> 7][yCameraPos >> 7] & 4) != 0)
  10837.             return plane;
  10838.         else
  10839.             return 3;
  10840.     }
  10841.  
  10842.     private void delIgnore(long l)
  10843.     {
  10844.         try
  10845.         {
  10846.             if(l == 0L)
  10847.                 return;
  10848.             for(int j = 0; j < ignoreCount; j++)
  10849.                 if(ignoreListAsLongs[j] == l)
  10850.                 {
  10851.                     ignoreCount--;
  10852.                     needDrawTabArea = true;
  10853.                     System.arraycopy(ignoreListAsLongs, j + 1, ignoreListAsLongs, j, ignoreCount - j);
  10854.  
  10855.                     stream.createFrame(74);
  10856.                     stream.writeQWord(l);
  10857.                     return;
  10858.                 }
  10859.  
  10860.             return;
  10861.         }
  10862.         catch(RuntimeException runtimeexception)
  10863.         {
  10864.             signlink.reporterror("47229, " + 3 + ", " + l + ", " + runtimeexception.toString());
  10865.         }
  10866.         throw new RuntimeException();
  10867.     }
  10868.    
  10869.    
  10870.     private void chatJoin(long l) {
  10871.         try {
  10872.             if(l == 0L)
  10873.                 return;
  10874.             stream.createFrame(60);
  10875.             stream.writeQWord(l);
  10876.             return;
  10877.         }
  10878.         catch(RuntimeException runtimeexception)
  10879.         {
  10880.             signlink.reporterror("47229, " + 3 + ", " + l + ", " + runtimeexception.toString());
  10881.         }
  10882.         throw new RuntimeException();
  10883.    
  10884.     }
  10885.    
  10886.     public String getParameter(String s)
  10887.     {
  10888.         if(signlink.mainapp != null)
  10889.             return signlink.mainapp.getParameter(s);
  10890.         else
  10891.             return super.getParameter(s);
  10892.     }
  10893.  
  10894.     private void adjustVolume(boolean flag, int i)
  10895.     {
  10896.         signlink.midivol = i;
  10897.         if(flag)
  10898.             signlink.midi = "voladjust";
  10899.     }
  10900.  
  10901.     private int extractInterfaceValues(RSInterface class9, int j)
  10902.     {
  10903.         if(class9.valueIndexArray == null || j >= class9.valueIndexArray.length)
  10904.             return -2;
  10905.         try
  10906.         {
  10907.             int ai[] = class9.valueIndexArray[j];
  10908.             int k = 0;
  10909.             int l = 0;
  10910.             int i1 = 0;
  10911.             do
  10912.             {
  10913.                 int j1 = ai[l++];
  10914.                 int k1 = 0;
  10915.                 byte byte0 = 0;
  10916.                 if(j1 == 0)
  10917.                     return k;
  10918.                 if(j1 == 1)
  10919.                     k1 = currentStats[ai[l++]];
  10920.                 if(j1 == 2)
  10921.                     k1 = maxStats[ai[l++]];
  10922.                 if(j1 == 3)
  10923.                     k1 = currentExp[ai[l++]];
  10924.                 if(j1 == 4)
  10925.                 {
  10926.                     RSInterface class9_1 = RSInterface.interfaceCache[ai[l++]];
  10927.                     int k2 = ai[l++];
  10928.                     if(k2 >= 0 && k2 < ItemDef.totalItems && (!ItemDef.forID(k2).membersObject || isMembers))
  10929.                     {
  10930.                         for(int j3 = 0; j3 < class9_1.inv.length; j3++)
  10931.                             if(class9_1.inv[j3] == k2 + 1)
  10932.                                 k1 += class9_1.invStackSizes[j3];
  10933.  
  10934.                     }
  10935.                 }
  10936.                 if(j1 == 5)
  10937.                     k1 = variousSettings[ai[l++]];
  10938.                 if(j1 == 6)
  10939.                     k1 = anIntArray1019[maxStats[ai[l++]] - 1];
  10940.                 if(j1 == 7)
  10941.                     k1 = (variousSettings[ai[l++]] * 100) / 46875;
  10942.                 if(j1 == 8)
  10943.                     k1 = myPlayer.combatLevel;
  10944.                 if(j1 == 9)
  10945.                 {
  10946.                     for(int l1 = 0; l1 < Skills.skillsCount; l1++)
  10947.                         if(Skills.skillEnabled[l1])
  10948.                             k1 += maxStats[l1];
  10949.  
  10950.                 }
  10951.                 if(j1 == 10)
  10952.                 {
  10953.                     RSInterface class9_2 = RSInterface.interfaceCache[ai[l++]];
  10954.                     int l2 = ai[l++] + 1;
  10955.                     if(l2 >= 0 && l2 < ItemDef.totalItems && (!ItemDef.forID(l2).membersObject || isMembers))
  10956.                     {
  10957.                         for(int k3 = 0; k3 < class9_2.inv.length; k3++)
  10958.                         {
  10959.                             if(class9_2.inv[k3] != l2)
  10960.                                 continue;
  10961.                             k1 = 0x3b9ac9ff;
  10962.                             break;
  10963.                         }
  10964.  
  10965.                     }
  10966.                 }
  10967.                 if(j1 == 11)
  10968.                     k1 = energy;
  10969.                 if(j1 == 12)
  10970.                     k1 = weight;
  10971.                 if(j1 == 13)
  10972.                 {
  10973.                     int i2 = variousSettings[ai[l++]];
  10974.                     int i3 = ai[l++];
  10975.                     k1 = (i2 & 1 << i3) == 0 ? 0 : 1;
  10976.                 }
  10977.                 if(j1 == 14)
  10978.                 {
  10979.                     int j2 = ai[l++];
  10980.                     VarBit varBit = VarBit.cache[j2];
  10981.                     int l3 = varBit.anInt648;
  10982.                     int i4 = varBit.anInt649;
  10983.                     int j4 = varBit.anInt650;
  10984.                     int k4 = anIntArray1232[j4 - i4];
  10985.                     k1 = variousSettings[l3] >> i4 & k4;
  10986.                 }
  10987.                 if(j1 == 15)
  10988.                     byte0 = 1;
  10989.                 if(j1 == 16)
  10990.                     byte0 = 2;
  10991.                 if(j1 == 17)
  10992.                     byte0 = 3;
  10993.                 if(j1 == 18)
  10994.                     k1 = (myPlayer.x >> 7) + baseX;
  10995.                 if(j1 == 19)
  10996.                     k1 = (myPlayer.y >> 7) + baseY;
  10997.                 if(j1 == 20)
  10998.                     k1 = ai[l++];
  10999.                 if(byte0 == 0)
  11000.                 {
  11001.                     if(i1 == 0)
  11002.                         k += k1;
  11003.                     if(i1 == 1)
  11004.                         k -= k1;
  11005.                     if(i1 == 2 && k1 != 0)
  11006.                         k /= k1;
  11007.                     if(i1 == 3)
  11008.                         k *= k1;
  11009.                     i1 = 0;
  11010.                 } else
  11011.                 {
  11012.                     i1 = byte0;
  11013.                 }
  11014.             } while(true);
  11015.         }
  11016.         catch(Exception _ex)
  11017.         {
  11018.             return -1;
  11019.         }
  11020.     }
  11021.  
  11022.     private void drawTooltip() {
  11023.         if(menuActionRow < 2 && itemSelected == 0 && spellSelected == 0)
  11024.             return;
  11025.         String s;
  11026.         if(itemSelected == 1 && menuActionRow < 2)
  11027.             s = "Use " + selectedItemName + " with...";
  11028.         else if(spellSelected == 1 && menuActionRow < 2)
  11029.             s = spellTooltip + "...";
  11030.         else
  11031.             s = menuActionName[menuActionRow - 1];
  11032.         if(menuActionRow > 2)
  11033.             s = s + "@whi@ / " + (menuActionRow - 2) + " more options";
  11034.         boldFont.method390(4, 0xffffff, s, loopCycle / 1000, 15);
  11035.     }
  11036.    
  11037.     public Sprite[] backingOrb = new Sprite[4];
  11038.     public Sprite[] genericOrbs = new Sprite[7];
  11039.     public Sprite[] healthOrbs = new Sprite[3];
  11040.     public Sprite[] prayerOrbs = new Sprite[3];
  11041.     public Sprite[] energyOrbs = new Sprite[7];
  11042.     public Sprite[] summoningOrbs = new Sprite[4];
  11043.     public boolean[] orbToggle = new boolean[4];
  11044.     private int orbHover = -1, lastOrbID = -1;
  11045.     private double[] lastOrbAmount = new double[4];
  11046.     public void loadOrbs() {
  11047.        
  11048.         for(int i = 0; i < genericOrbs.length; i++)
  11049.             genericOrbs[i] = new Sprite("Minimap Orbs/orb " + i);
  11050.            
  11051.         for(int i = 0; i < healthOrbs.length; i++)
  11052.             healthOrbs[i] = new Sprite("Minimap Orbs/health/orb " + i);
  11053.            
  11054.         for(int i = 0; i < prayerOrbs.length; i++)
  11055.             prayerOrbs[i] = new Sprite("Minimap Orbs/prayer/orb " + i);
  11056.            
  11057.         for(int i = 0; i < energyOrbs.length; i++)
  11058.             energyOrbs[i] = new Sprite("Minimap Orbs/energy/orb " + i);
  11059.            
  11060.         for(int i = 0; i < summoningOrbs.length; i++)
  11061.             summoningOrbs[i] = new Sprite("Minimap Orbs/summoning/orb " + i);
  11062.        
  11063.     }
  11064.    
  11065.     private void drawOrbs(int paddingX, int paddingY) {
  11066.         createOrbs((toggleFullscreen ? -44 : 145) + mapMovedX + paddingX,(toggleFullscreen ? 38 : 10) + mapMovedY + paddingY,0, healthOrbs);
  11067.         createOrbs((toggleFullscreen ? -47 : 161) + mapMovedX + paddingX,(toggleFullscreen ? 72 : 49) + mapMovedY + paddingY,1, prayerOrbs);
  11068.         createOrbs((toggleFullscreen ? -35 : 161) + mapMovedX + paddingX,(toggleFullscreen ? 106 : 88) + mapMovedY + paddingY,2, energyOrbs);
  11069.         // SUMMONING ORB CAUSES CRASH
  11070.         createOrbs((toggleFullscreen ? -12 : 145) + mapMovedX + paddingX,(toggleFullscreen ? 135 : 127) + mapMovedY + paddingY,3, summoningOrbs); // - this is summ show me your actual orb? in cache or wut, no th whole method
  11071.     }
  11072.    
  11073.     private void createOrbs(int xdraw, int ydraw, int orbID, Sprite[] orbSprites) { // this creates the orb
  11074.         int orbIconID = ((orbToggle[orbID] && orbID == 2) || (orbID == 3 && summoningAttack)) ? 3 : 0;
  11075.         int current = getOrbValues(orbID,orbSprites[orbIconID])[0];
  11076.         int total = getOrbValues(orbID,orbSprites[orbIconID])[1];
  11077.         double percentage = (current * 100 / total);
  11078.         double pixelPercent = 27 - (percentage * 27 / 100);
  11079.         int backingSprite = (orbID == 0) ? ((orbToggle[0]) ? 4 : 3) : 2;
  11080.         int textColour = getOrbTextColor(percentage);
  11081.        
  11082.         if(orbToggle[orbID] && getOrbValues(orbID,null)[0] <= 0)
  11083.             orbToggle[orbID] = false;
  11084.        
  11085.         genericOrbs[(orbHover == orbID ? 1 : 0) + (toggleFullscreen ? 5: 0)].drawSprite(xdraw, ydraw);
  11086.         smallFont.method382(textColour, xdraw + (toggleFullscreen ? 13 : 41), "" + current, ydraw + 26, true);
  11087.        
  11088.         if((percentage != lastOrbAmount[orbID])) {
  11089.             backingOrb[orbID] = new Sprite("Minimap Orbs/orb " + backingSprite, genericOrbs[backingSprite].myWidth,(int)pixelPercent);
  11090.             lastOrbAmount[orbID] = percentage;
  11091.         }
  11092.         orbSprites[orbToggle[orbID] ? 2 : 1].drawSprite((toggleFullscreen ? 24 : 0) +xdraw + 3, ydraw + 3);
  11093.         if(backingOrb[orbID] != null)
  11094.             backingOrb[orbID].drawSprite((toggleFullscreen ? 24 : 0) +xdraw + 3, ydraw + 3);
  11095.         orbSprites[orbIconID].drawSprite1((toggleFullscreen ? 24 : 0) +xdraw, ydraw,(textColour == 0xff0000 && current != 0) ? ((loopCycle % 40 < 20) ? (64 + (loopCycle % 128)) : 0) : (256));
  11096.     }
  11097.    
  11098.     private int[] getOrbValues(int type, Sprite orbSprite) {
  11099.         int[] values = new int[2];
  11100.         int offsetX = 0, offsetY = 0;
  11101.         switch(type) {
  11102.             case 0://Health
  11103.                 values[0] = Integer.parseInt(RSInterface.interfaceCache[4016].message);
  11104.                 values[1] = Integer.parseInt(RSInterface.interfaceCache[4017].message.replaceAll("%", ""));
  11105.                 offsetX = 9;
  11106.                 offsetY = 10;
  11107.                 break;
  11108.  
  11109.             case 1://Prayer
  11110.                 values[0] = Integer.parseInt(RSInterface.interfaceCache[4012].message);
  11111.                 values[1] = Integer.parseInt(RSInterface.interfaceCache[4013].message.replaceAll("%", ""));
  11112.                 offsetX = 7;
  11113.                 offsetY = 7;
  11114.                 break;
  11115.                
  11116.             case 2://Energy
  11117.                 values[0] = Integer.parseInt(RSInterface.interfaceCache[149].message.replaceAll("%", ""));
  11118.                 values[1] = 100;
  11119.                 offsetX = 10;
  11120.                 offsetY = 8;
  11121.                 break;
  11122.             case 3://Summoning
  11123.                 values[0] = Integer.parseInt(RSInterface.interfaceCache[19178].message);; // 29800
  11124.                 values[1] = Integer.parseInt(RSInterface.interfaceCache[19179].message);; //29801
  11125.                 offsetX = 7;
  11126.                 offsetY = 7;
  11127.                 break;
  11128.            
  11129.             default:
  11130.                 return null;
  11131.         }
  11132.         try {
  11133.             if(offsetX > 0 && offsetY > 0) {
  11134.                 orbSprite.configXDrawOffset(offsetX);
  11135.                 orbSprite.configYDrawOffset(offsetY);
  11136.             }
  11137.         } catch(NullPointerException ex) {
  11138.            
  11139.         }
  11140.         return values;
  11141.     }
  11142.  
  11143.     public int getOrbTextColor(double percentage) {
  11144.         if(percentage >= 75)
  11145.             return 65280;
  11146.         if(percentage >= 50 && percentage <= 74)
  11147.             return 0xffff00;
  11148.         return (percentage < 25 || percentage > 49) ? 0xff0000 : 0xff981f;
  11149.     }  
  11150.  
  11151.     private void drawMinimap(RSImageProducer mapImage, int paddingX, int paddingY) {
  11152.         mapImage.initDrawingArea();
  11153.  
  11154.         int mapRotation = compassRotation + mapAmtDiffRotation & 2047;
  11155.         int mapCenterX = 48 + myPlayer.x / 32;
  11156.         int mapCenterY = 464 - myPlayer.y / 32;
  11157.  
  11158.         switch(minimapCover) {
  11159.             case 2:
  11160.                 compass.drawRotatableSprite(33, compassRotation, compassPixelCutRight, 256, compassPixelCutLeft, 25, (toggleFullscreen ? 9 : 8) + paddingY, (toggleFullscreen ? 30 : 11) + paddingX, 33, 25);
  11161.                 main3DArea.initDrawingArea();
  11162.                 return;
  11163.         }
  11164.         miniMapImage.drawRotatableSprite(mapInnerSizeHeight, mapRotation, mapImagePixelCutRight, 256 + mapAmtDiffZoom, mapImagePixelCutLeft, mapCenterY, mapPaddingFromTop + paddingY, mapPaddingFromLeft + paddingX, mapInnerSizeWidth, mapCenterX);
  11165.         for(int loopIndex = 0; loopIndex < totalMapFunctions; loopIndex++) {
  11166.             int x = (mapFunctionX[loopIndex] * 4 + 2) - myPlayer.x / 32;
  11167.             int y = (mapFunctionY[loopIndex] * 4 + 2) - myPlayer.y / 32;
  11168.             drawMapSprites(currentMapFunctions[loopIndex], x, y);
  11169.         }
  11170.         for(int loopXIndex = 0; loopXIndex < 104; loopXIndex++) {
  11171.             for(int loopYIndex = 0; loopYIndex < 104; loopYIndex++) {
  11172.                 NodeList nodeList = groundArray[plane][loopXIndex][loopYIndex];
  11173.                 if(nodeList != null) {
  11174.                     int x = (loopXIndex * 4 + 2) - myPlayer.x / 32;
  11175.                     int y = (loopYIndex * 4 + 2) - myPlayer.y / 32;
  11176.                     drawMapSprites(mapDotItem, x, y);
  11177.                 }
  11178.             }
  11179.         }
  11180.         for(int loopIndex = 0; loopIndex < npcCount; loopIndex++) {
  11181.             NPC npc = npcArray[npcIndices[loopIndex]];
  11182.             if(npc != null && npc.isVisible()) {
  11183.                 EntityDef entityDef = npc.desc;
  11184.                 if(entityDef.childrenIDs != null)
  11185.                     entityDef = entityDef.method161();
  11186.                 if(entityDef != null && entityDef.aBoolean87 && entityDef.aBoolean84) {
  11187.                     int x = npc.x / 32 - myPlayer.x / 32;
  11188.                     int y = npc.y / 32 - myPlayer.y / 32;
  11189.                     drawMapSprites(mapDotNPC, x, y);
  11190.                 }
  11191.             }
  11192.         }
  11193.         for(int playerIndex = 0; playerIndex < playerCount; playerIndex++) {
  11194.             Player player = playerArray[playerIndices[playerIndex]];
  11195.             if(player != null && player.isVisible()) {
  11196.                 int x = player.x / 32 - myPlayer.x / 32;
  11197.                 int y = player.y / 32 - myPlayer.y / 32;
  11198.                 boolean isInFriends = false;
  11199.                 boolean isInClan = false;
  11200.                 for (int clanIndex = 0; clanIndex < clanList.length; clanIndex++) {
  11201.                     if (clanList[clanIndex] == null)
  11202.                         continue;
  11203.                     if (!clanList[clanIndex].equalsIgnoreCase(player.name))
  11204.                         continue;
  11205.                     isInClan = true;
  11206.                     break;
  11207.                 }
  11208.                 long playerNameLong = TextClass.longForName(player.name);
  11209.                 for(int friendIndex = 0; friendIndex < friendsCount; friendIndex++) {
  11210.                     if(playerNameLong != friendsListAsLongs[friendIndex] || friendsNodeIDs[friendIndex] == 0)
  11211.                         continue;
  11212.                     isInFriends = true;
  11213.                     break;
  11214.                 }
  11215.                 boolean isInTeam = false;
  11216.                 if(myPlayer.team != 0 && player.team != 0 && myPlayer.team == player.team)
  11217.                     isInTeam = true;
  11218.                 if(isInFriends)
  11219.                     drawMapSprites(mapDotFriend, x, y);
  11220.                 else if(isInClan)
  11221.                     drawMapSprites(mapDotClan, x, y);
  11222.                 else if(isInTeam)
  11223.                     drawMapSprites(mapDotTeam, x, y);
  11224.                 else
  11225.                     drawMapSprites(mapDotPlayer, x, y);
  11226.             }
  11227.         }
  11228.         if(hintType != 0 && loopCycle % 20 < 10) {
  11229.             if(hintType == 1 && hintArrowNPCID >= 0 && hintArrowNPCID < npcArray.length) {
  11230.                 NPC npc = npcArray[hintArrowNPCID];
  11231.                 if(npc != null) {
  11232.                     int cordX = npc.x / 32 - myPlayer.x / 32;
  11233.                     int cordY = npc.y / 32 - myPlayer.y / 32;
  11234.                     drawMapArrows(mapMarker, cordY, cordX);
  11235.                 }
  11236.             }
  11237.             if(hintType == 2) {
  11238.                 int cordX = ((hintArrowX - baseX) * 4 + 2) - myPlayer.x / 32;
  11239.                 int cordY = ((hintArrowY - baseY) * 4 + 2) - myPlayer.y / 32;
  11240.                 drawMapArrows(mapMarker, cordY, cordX);
  11241.             }
  11242.             if(hintType == 10 && hintArrowPlayerID >= 0 && hintArrowPlayerID < playerArray.length) {
  11243.                 Player player = playerArray[hintArrowPlayerID];
  11244.                 if(player != null) {
  11245.                     int cordX = player.x / 32 - myPlayer.x / 32;
  11246.                     int cordY = player.y / 32 - myPlayer.y / 32;
  11247.                     drawMapArrows(mapMarker, cordY, cordX);
  11248.                 }
  11249.             }
  11250.         }
  11251.         if(destX != 0) {
  11252.             int walkingToX = (destX * 4 + 2) - myPlayer.x / 32;
  11253.             int walkingToY = (destY * 4 + 2) - myPlayer.y / 32;
  11254.             drawMapSprites(mapFlag, walkingToX, walkingToY);
  11255.         }
  11256.         if(!toggleFullscreen)
  11257.             mapBack[0].drawBackground(paddingX, paddingY);
  11258.         else {
  11259.             mapBack[3].drawBackground(30 + paddingX, 4 + paddingY);
  11260.             mapBack[4].drawBackground(25 + paddingX, 4 + paddingY);
  11261.             mapBack[4].drawBackground(150 + paddingX, 133 + paddingY);
  11262.         }
  11263.         compass.drawRotatableSprite(33, compassRotation, compassPixelCutRight, 256, compassPixelCutLeft, 25, (toggleFullscreen ? 9 : 8) + paddingY, (toggleFullscreen ? 30 : 11) + paddingX, 33, 25);
  11264.         drawOrbs(paddingX,paddingY);
  11265.         advisorButton[advisorHover].drawSprite((toggleFullscreen ? 207-52 : 207) + paddingX,(toggleFullscreen ? 4 : 0) + paddingY);
  11266.         drawXPCounter(paddingX,paddingY);
  11267.         if(tabInterfaceIDs[10] != -1 && invOverlayInterfaceID == -1)
  11268.             exitButton[exitHover].drawSprite((toggleFullscreen ? 228-52 : 228) + paddingX,(toggleFullscreen ? 4 : 0) + paddingY);
  11269.         worldMapIcon[mapHover].drawSprite((toggleFullscreen ? 154 : 10) + paddingX,(toggleFullscreen ? 138 : 124) + paddingY);
  11270.  
  11271.         DrawingArea.drawPixels(3, 76 + mapPaddingFromTop + paddingY, 76 + mapPaddingFromLeft + paddingX, 0xffffff, 3);
  11272.         if(contextMenuOpen && !toggleFullscreen)
  11273.             drawMenu(516, 0);
  11274.         main3DArea.initDrawingArea();
  11275.     }
  11276.  
  11277.  
  11278.  
  11279.     private void npcScreenPos(Entity entity, int i) {
  11280.         calcEntityScreenPos(entity.x, i, entity.y);
  11281.     }
  11282.  
  11283.     private void calcEntityScreenPos(int i, int j, int l) {
  11284.         if(i < 128 || l < 128 || i > 13056 || l > 13056) {
  11285.             spriteDrawX = -1;
  11286.             spriteDrawY = -1;
  11287.             return;
  11288.         }
  11289.         int i1 = method42(plane, l, i) - j;
  11290.         i -= xCameraPos;
  11291.         i1 -= zCameraPos;
  11292.         l -= yCameraPos;
  11293.         int j1 = Model.modelIntArray1[yCameraCurve];
  11294.         int k1 = Model.modelIntArray2[yCameraCurve];
  11295.         int l1 = Model.modelIntArray1[xCameraCurve];
  11296.         int i2 = Model.modelIntArray2[xCameraCurve];
  11297.         int j2 = l * l1 + i * i2 >> 16;
  11298.         l = l * i2 - i * l1 >> 16;
  11299.         i = j2;
  11300.         j2 = i1 * k1 - l * j1 >> 16;
  11301.         l = i1 * j1 + l * k1 >> 16;
  11302.         i1 = j2;
  11303.         if(l >= 50) {
  11304.             spriteDrawX = Texture.textureInt1 + (i << 9) / l;
  11305.             spriteDrawY = Texture.textureInt2 + (i1 << 9) / l;
  11306.         } else {
  11307.             spriteDrawX = -1;
  11308.             spriteDrawY = -1;
  11309.         }
  11310.     }
  11311.  
  11312.     private void buildSplitPrivateChatMenu(int paddingX, int paddingY)
  11313.     {
  11314.         if(splitPrivateChat == 0)
  11315.             return;
  11316.         int drawLineY = 0;
  11317.         if(systemUpdatetime != 0)
  11318.             drawLineY = 1;
  11319.         for(int indexLine = 0; indexLine < 100; indexLine++)
  11320.         {
  11321.             if(chatMessages[indexLine] == null)
  11322.                 continue;
  11323.             int type = chatTypes[indexLine];
  11324.             String name = chatNames[indexLine];
  11325.             boolean flag = false;
  11326.             if(name != null && name.startsWith("@cr"))
  11327.                 name = name.substring(5);
  11328.  
  11329.             if((type == 3 || type == 7) && (type == 7 || privateChatMode == 0 || privateChatMode == 1 && isFriendOrSelf(name)))
  11330.             {
  11331.                 int l = (329 - drawLineY * 13) - paddingY;
  11332.                 if(super.mouseX > 4 && super.mouseY - 4 > l - 10 && super.mouseY - 4 <= l + 3)
  11333.                 {
  11334.                     int textWidth = normalFont.getTextWidth("From:  " + name + chatMessages[indexLine]) + 25;
  11335.                     if(textWidth > 450)
  11336.                         textWidth = 450;
  11337.                     if(super.mouseX < 4 + textWidth)
  11338.                     {
  11339.                         if(myPrivilege >= 1)
  11340.                         {
  11341.                             menuActionName[menuActionRow] = "Report abuse @whi@" + name;
  11342.                             menuActionID[menuActionRow] = 606;
  11343.                             menuActionRow++;
  11344.                         }
  11345.                         menuActionName[menuActionRow] = "Add ignore @whi@" + name;
  11346.                         menuActionID[menuActionRow] = 2042;
  11347.                         menuActionRow++;
  11348.                         menuActionName[menuActionRow] = "Add friend @whi@" + name;
  11349.                         menuActionID[menuActionRow] = 2337;
  11350.                         menuActionRow++;
  11351.                         menuActionName[menuActionRow] = "Message @whi@" + name;
  11352.                         menuActionID[menuActionRow] = 639;
  11353.                         menuActionRow++;
  11354.                     }
  11355.                 }
  11356.                 if(++drawLineY >= 5)
  11357.                     return;
  11358.             }
  11359.             if((type == 5 || type == 6) && privateChatMode < 2 && ++drawLineY >= 5)
  11360.                 return;
  11361.         }
  11362.  
  11363.     }
  11364.  
  11365.     private void method130(int j, int k, int l, int i1, int j1, int k1,
  11366.                            int l1, int i2, int j2)
  11367.     {
  11368.         Class30_Sub1 class30_sub1 = null;
  11369.         for(Class30_Sub1 class30_sub1_1 = (Class30_Sub1)aClass19_1179.reverseGetFirst(); class30_sub1_1 != null; class30_sub1_1 = (Class30_Sub1)aClass19_1179.reverseGetNext())
  11370.         {
  11371.             if(class30_sub1_1.anInt1295 != l1 || class30_sub1_1.anInt1297 != i2 || class30_sub1_1.anInt1298 != j1 || class30_sub1_1.anInt1296 != i1)
  11372.                 continue;
  11373.             class30_sub1 = class30_sub1_1;
  11374.             break;
  11375.         }
  11376.  
  11377.         if(class30_sub1 == null)
  11378.         {
  11379.             class30_sub1 = new Class30_Sub1();
  11380.             class30_sub1.anInt1295 = l1;
  11381.             class30_sub1.anInt1296 = i1;
  11382.             class30_sub1.anInt1297 = i2;
  11383.             class30_sub1.anInt1298 = j1;
  11384.             method89(class30_sub1);
  11385.             aClass19_1179.insertHead(class30_sub1);
  11386.         }
  11387.         class30_sub1.anInt1291 = k;
  11388.         class30_sub1.anInt1293 = k1;
  11389.         class30_sub1.anInt1292 = l;
  11390.         class30_sub1.anInt1302 = j2;
  11391.         class30_sub1.anInt1294 = j;
  11392.     }
  11393.  
  11394.     private boolean interfaceIsSelected(RSInterface class9)
  11395.     {
  11396.         if(class9.valueCompareType == null)
  11397.             return false;
  11398.         for(int i = 0; i < class9.valueCompareType.length; i++)
  11399.         {
  11400.             int j = extractInterfaceValues(class9, i);
  11401.             int k = class9.requiredValues[i];
  11402.             if(class9.valueCompareType[i] == 2)
  11403.             {
  11404.                 if(j >= k)
  11405.                     return false;
  11406.             } else
  11407.             if(class9.valueCompareType[i] == 3)
  11408.             {
  11409.                 if(j <= k)
  11410.                     return false;
  11411.             } else
  11412.             if(class9.valueCompareType[i] == 4)
  11413.             {
  11414.                 if(j == k)
  11415.                     return false;
  11416.             } else
  11417.             if(j != k)
  11418.                 return false;
  11419.         }
  11420.  
  11421.         return true;
  11422.     }
  11423.  
  11424.     private DataInputStream openJagGrabInputStream(String s)
  11425.         throws IOException
  11426.     {
  11427.  //    if(!aBoolean872)
  11428.  //        if(signlink.mainapp != null)
  11429.  //            return signlink.openurl(s);
  11430.  //        else
  11431.  //            return new DataInputStream((new URL(getCodeBase(), s)).openStream());
  11432.         if(aSocket832 != null)
  11433.         {
  11434.             try
  11435.             {
  11436.                 aSocket832.close();
  11437.             }
  11438.             catch(Exception _ex) { }
  11439.             aSocket832 = null;
  11440.         }
  11441.         aSocket832 = openSocket(43594);
  11442.         aSocket832.setSoTimeout(10000);
  11443.         java.io.InputStream inputstream = aSocket832.getInputStream();
  11444.         OutputStream outputstream = aSocket832.getOutputStream();
  11445.         outputstream.write(("JAGGRAB /" + s + "\n\n").getBytes());
  11446.         return new DataInputStream(inputstream);
  11447.     }
  11448.  
  11449.     private void doFlamesDrawing()
  11450.     {
  11451.         char c = '\u0100';
  11452.         if(anInt1040 > 0)
  11453.         {
  11454.             for(int i = 0; i < 256; i++)
  11455.                 if(anInt1040 > 768)
  11456.                     anIntArray850[i] = method83(anIntArray851[i], anIntArray852[i], 1024 - anInt1040);
  11457.                 else
  11458.                 if(anInt1040 > 256)
  11459.                     anIntArray850[i] = anIntArray852[i];
  11460.                 else
  11461.                     anIntArray850[i] = method83(anIntArray852[i], anIntArray851[i], 256 - anInt1040);
  11462.  
  11463.         } else
  11464.         if(anInt1041 > 0)
  11465.         {
  11466.             for(int j = 0; j < 256; j++)
  11467.                 if(anInt1041 > 768)
  11468.                     anIntArray850[j] = method83(anIntArray851[j], anIntArray853[j], 1024 - anInt1041);
  11469.                 else
  11470.                 if(anInt1041 > 256)
  11471.                     anIntArray850[j] = anIntArray853[j];
  11472.                 else
  11473.                     anIntArray850[j] = method83(anIntArray853[j], anIntArray851[j], 256 - anInt1041);
  11474.  
  11475.         } else
  11476.         {
  11477.             System.arraycopy(anIntArray851, 0, anIntArray850, 0, 256);
  11478.  
  11479.         }
  11480.         System.arraycopy(aClass30_Sub2_Sub1_Sub1_1201.myPixels, 0, aRSImageProducer_1110.anIntArray315, 0, 33920);
  11481.  
  11482.         int i1 = 0;
  11483.         int j1 = 1152;
  11484.         for(int k1 = 1; k1 < c - 1; k1++)
  11485.         {
  11486.             int l1 = (anIntArray969[k1] * (c - k1)) / c;
  11487.             int j2 = 22 + l1;
  11488.             if(j2 < 0)
  11489.                 j2 = 0;
  11490.             i1 += j2;
  11491.             for(int l2 = j2; l2 < 128; l2++)
  11492.             {
  11493.                 int j3 = anIntArray828[i1++];
  11494.                 if(j3 != 0)
  11495.                 {
  11496.                     int l3 = j3;
  11497.                     int j4 = 256 - j3;
  11498.                     j3 = anIntArray850[j3];
  11499.                     int l4 = aRSImageProducer_1110.anIntArray315[j1];
  11500.                     aRSImageProducer_1110.anIntArray315[j1++] = ((j3 & 0xff00ff) * l3 + (l4 & 0xff00ff) * j4 & 0xff00ff00) + ((j3 & 0xff00) * l3 + (l4 & 0xff00) * j4 & 0xff0000) >> 8;
  11501.                 } else
  11502.                 {
  11503.                     j1++;
  11504.                 }
  11505.             }
  11506.  
  11507.             j1 += j2;
  11508.         }
  11509.  
  11510.         aRSImageProducer_1110.drawGraphics(0, super.graphics, 0);
  11511.         System.arraycopy(aClass30_Sub2_Sub1_Sub1_1202.myPixels, 0, aRSImageProducer_1111.anIntArray315, 0, 33920);
  11512.  
  11513.         i1 = 0;
  11514.         j1 = 1176;
  11515.         for(int k2 = 1; k2 < c - 1; k2++)
  11516.         {
  11517.             int i3 = (anIntArray969[k2] * (c - k2)) / c;
  11518.             int k3 = 103 - i3;
  11519.             j1 += i3;
  11520.             for(int i4 = 0; i4 < k3; i4++)
  11521.             {
  11522.                 int k4 = anIntArray828[i1++];
  11523.                 if(k4 != 0)
  11524.                 {
  11525.                     int i5 = k4;
  11526.                     int j5 = 256 - k4;
  11527.                     k4 = anIntArray850[k4];
  11528.                     int k5 = aRSImageProducer_1111.anIntArray315[j1];
  11529.                     aRSImageProducer_1111.anIntArray315[j1++] = ((k4 & 0xff00ff) * i5 + (k5 & 0xff00ff) * j5 & 0xff00ff00) + ((k4 & 0xff00) * i5 + (k5 & 0xff00) * j5 & 0xff0000) >> 8;
  11530.                 } else
  11531.                 {
  11532.                     j1++;
  11533.                 }
  11534.             }
  11535.  
  11536.             i1 += 128 - k3;
  11537.             j1 += 128 - k3 - i3;
  11538.         }
  11539.  
  11540.         aRSImageProducer_1111.drawGraphics(0, super.graphics, 637);
  11541.     }
  11542.  
  11543.     private void method134(Stream stream)
  11544.     {
  11545.         int j = stream.readBits(8);
  11546.         if(j < playerCount)
  11547.         {
  11548.             for(int k = j; k < playerCount; k++)
  11549.                 anIntArray840[anInt839++] = playerIndices[k];
  11550.  
  11551.         }
  11552.         if(j > playerCount)
  11553.         {
  11554.             signlink.reporterror(myUsername + " Too many players");
  11555.             throw new RuntimeException("eek");
  11556.         }
  11557.         playerCount = 0;
  11558.         for(int l = 0; l < j; l++)
  11559.         {
  11560.             int i1 = playerIndices[l];
  11561.             Player player = playerArray[i1];
  11562.             int j1 = stream.readBits(1);
  11563.             if(j1 == 0)
  11564.             {
  11565.                 playerIndices[playerCount++] = i1;
  11566.                 player.anInt1537 = loopCycle;
  11567.             } else
  11568.             {
  11569.                 int k1 = stream.readBits(2);
  11570.                 if(k1 == 0)
  11571.                 {
  11572.                     playerIndices[playerCount++] = i1;
  11573.                     player.anInt1537 = loopCycle;
  11574.                     anIntArray894[anInt893++] = i1;
  11575.                 } else
  11576.                 if(k1 == 1)
  11577.                 {
  11578.                     playerIndices[playerCount++] = i1;
  11579.                     player.anInt1537 = loopCycle;
  11580.                     int l1 = stream.readBits(3);
  11581.                     player.moveInDir(false, l1);
  11582.                     int j2 = stream.readBits(1);
  11583.                     if(j2 == 1)
  11584.                         anIntArray894[anInt893++] = i1;
  11585.                 } else
  11586.                 if(k1 == 2)
  11587.                 {
  11588.                     playerIndices[playerCount++] = i1;
  11589.                     player.anInt1537 = loopCycle;
  11590.                     int i2 = stream.readBits(3);
  11591.                     player.moveInDir(true, i2);
  11592.                     int k2 = stream.readBits(3);
  11593.                     player.moveInDir(true, k2);
  11594.                     int l2 = stream.readBits(1);
  11595.                     if(l2 == 1)
  11596.                         anIntArray894[anInt893++] = i1;
  11597.                 } else
  11598.                 if(k1 == 3)
  11599.                     anIntArray840[anInt839++] = i1;
  11600.             }
  11601.         }
  11602.     }
  11603.  
  11604.     public int world = 1;
  11605.     public String spec = " Regular World";
  11606.     private void drawLoginScreen(boolean flag) {
  11607.         resetImageProducers();
  11608.         aRSImageProducer_1109.initDrawingArea();
  11609.         int x = 49;
  11610.         loginBox.drawSprite(0 + x, 0);
  11611.         char c = '\u0168';
  11612.         char c1 = '\310';
  11613.         int l = c / 2 - 80;
  11614.         int k1 = c1 / 2 + 20;
  11615.        
  11616.         boldFont.method382(0xffff00, 130 + x, "@whi@World: @red@" + world + spec,
  11617.                     k1 + 22
  11618.                     , true);
  11619.         // Welcome screen
  11620.         if (loginScreenState == 0) {
  11621.             /*if (loginMessage1.length() > 0) {
  11622.                 chatTextDrawingArea.method382(0xffff00, c / 2, loginMessage1,
  11623.                         j - 15, true);
  11624.                 chatTextDrawingArea.method382(0xffff00, c / 2, loginMessage2,
  11625.                         j, true);
  11626.                 j += 30;
  11627.             } else {
  11628.                 chatTextDrawingArea.method382(0xffff00, c / 2, loginMessage2,
  11629.                         j - 7, true);
  11630.                 j += 30;
  11631.             }*/
  11632.             if (screenHover[0]) {
  11633.                  loginBoxHover.drawSprite(22 + x, 58);
  11634.             }
  11635.             if (screenHover[1]) {
  11636.                  loginBoxHover.drawSprite(l - 78 + x, k1 - 16);
  11637.             }
  11638.             if (screenHover[2]) {
  11639.                 loginHover.drawSprite(l - 78 + x, k1 + 42);
  11640.             }
  11641.             if (screenHover[3]) {
  11642.                 loginHoverWorld.drawSprite(l + 116 + x, k1 + 42);
  11643.             }
  11644.             boldFont.method382(0xffff00, 132 + x, loginMessage1,
  11645.                     k1 + 41 + 40, true);
  11646.             boldFont.method382(0xffff00, 132 + x, loginMessage2,
  11647.                     k1 + 41 + 55
  11648.                     , true);
  11649.             if (loginScreenCursorPos != 0 && loginScreenCursorPos != 1)
  11650.                 loginScreenCursorPos = 0;
  11651.             int j = c1 / 2 - 23;
  11652.             boldFont.method389(true, c / 2 - 154 + x, 0xffffff, ""
  11653.                             + myUsername
  11654.                             + ((loginScreenCursorPos == 0)
  11655.                                     & (loopCycle % 40 < 20) ? "@whi@|" : ""), j);
  11656.             j += 47;
  11657.             boldFont.method389(true, c / 2 - 154 + x, 0xffffff,
  11658.                             ""
  11659.                                     + TextClass.passwordAsterisks(myPassword)
  11660.                                     + ((loginScreenCursorPos == 1)
  11661.                                             & (loopCycle % 40 < 20) ? "@whi@|"
  11662.                                             : ""), j);
  11663.         }
  11664.         //aRSImageProducer_1109.drawGraphics(135, super.graphics, 251);
  11665.         aRSImageProducer_1109.drawGraphics(171, super.graphics, 202);
  11666.         if (welcomeScreenRaised) {
  11667.             welcomeScreenRaised = false;
  11668.             aRSImageProducer_1107.drawGraphics(0, super.graphics, 128);
  11669.             aRSImageProducer_1108.drawGraphics(371, super.graphics, 202);
  11670.             aRSImageProducer_1112.drawGraphics(265, super.graphics, 0);
  11671.             aRSImageProducer_1113.drawGraphics(265, super.graphics, 562);
  11672.             aRSImageProducer_1114.drawGraphics(171, super.graphics, 128);
  11673.             aRSImageProducer_1115.drawGraphics(171, super.graphics, 562);
  11674.         }
  11675.     }
  11676.  
  11677.     private void drawFlames()
  11678.     {
  11679.     }
  11680.  
  11681.     public void raiseWelcomeScreen() {
  11682.         welcomeScreenRaised = true;
  11683.     }
  11684.  
  11685.     private void method137(Stream stream, int j)
  11686.     {
  11687.         if(j == 84)
  11688.         {
  11689.             int k = stream.readUnsignedByte();
  11690.             int j3 = anInt1268 + (k >> 4 & 7);
  11691.             int i6 = anInt1269 + (k & 7);
  11692.             int l8 = stream.readUnsignedWord();
  11693.             int k11 = stream.readUnsignedWord();
  11694.             int l13 = stream.readUnsignedWord();
  11695.             if(j3 >= 0 && i6 >= 0 && j3 < 104 && i6 < 104)
  11696.             {
  11697.                 NodeList class19_1 = groundArray[plane][j3][i6];
  11698.                 if(class19_1 != null)
  11699.                 {
  11700.                     for(Item class30_sub2_sub4_sub2_3 = (Item)class19_1.reverseGetFirst(); class30_sub2_sub4_sub2_3 != null; class30_sub2_sub4_sub2_3 = (Item)class19_1.reverseGetNext())
  11701.                     {
  11702.                         if(class30_sub2_sub4_sub2_3.ID != (l8 & 0x7fff) || class30_sub2_sub4_sub2_3.anInt1559 != k11)
  11703.                             continue;
  11704.                         class30_sub2_sub4_sub2_3.anInt1559 = l13;
  11705.                         break;
  11706.                     }
  11707.  
  11708.                     spawnGroundItem(j3, i6);
  11709.                 }
  11710.             }
  11711.             return;
  11712.         }
  11713.         if(j == 105)
  11714.         {
  11715.             int l = stream.readUnsignedByte();
  11716.             int k3 = anInt1268 + (l >> 4 & 7);
  11717.             int j6 = anInt1269 + (l & 7);
  11718.             int i9 = stream.readUnsignedWord();
  11719.             int l11 = stream.readUnsignedByte();
  11720.             int i14 = l11 >> 4 & 0xf;
  11721.             int i16 = l11 & 7;
  11722.             if(myPlayer.smallX[0] >= k3 - i14 && myPlayer.smallX[0] <= k3 + i14 && myPlayer.smallY[0] >= j6 - i14 && myPlayer.smallY[0] <= j6 + i14 && aBoolean848 && !lowMem && anInt1062 < 50)
  11723.             {
  11724.                 anIntArray1207[anInt1062] = i9;
  11725.                 anIntArray1241[anInt1062] = i16;
  11726.                 anIntArray1250[anInt1062] = Sounds.anIntArray326[i9];
  11727.                 anInt1062++;
  11728.             }
  11729.         }
  11730.         if(j == 215)
  11731.         {
  11732.             int i1 = stream.method435();
  11733.             int l3 = stream.method428();
  11734.             int k6 = anInt1268 + (l3 >> 4 & 7);
  11735.             int j9 = anInt1269 + (l3 & 7);
  11736.             int i12 = stream.method435();
  11737.             int j14 = stream.readUnsignedWord();
  11738.             if(k6 >= 0 && j9 >= 0 && k6 < 104 && j9 < 104 && i12 != unknownInt10)
  11739.             {
  11740.                 Item class30_sub2_sub4_sub2_2 = new Item();
  11741.                 class30_sub2_sub4_sub2_2.ID = i1;
  11742.                 class30_sub2_sub4_sub2_2.anInt1559 = j14;
  11743.                 if(groundArray[plane][k6][j9] == null)
  11744.                     groundArray[plane][k6][j9] = new NodeList();
  11745.                 groundArray[plane][k6][j9].insertHead(class30_sub2_sub4_sub2_2);
  11746.                 spawnGroundItem(k6, j9);
  11747.             }
  11748.             return;
  11749.         }
  11750.         if(j == 156)
  11751.         {
  11752.             int j1 = stream.method426();
  11753.             int i4 = anInt1268 + (j1 >> 4 & 7);
  11754.             int l6 = anInt1269 + (j1 & 7);
  11755.             int k9 = stream.readUnsignedWord();
  11756.             if(i4 >= 0 && l6 >= 0 && i4 < 104 && l6 < 104)
  11757.             {
  11758.                 NodeList class19 = groundArray[plane][i4][l6];
  11759.                 if(class19 != null)
  11760.                 {
  11761.                     for(Item item = (Item)class19.reverseGetFirst(); item != null; item = (Item)class19.reverseGetNext())
  11762.                     {
  11763.                         if(item.ID != (k9 & 0x7fff))
  11764.                             continue;
  11765.                         item.unlink();
  11766.                         break;
  11767.                     }
  11768.  
  11769.                     if(class19.reverseGetFirst() == null)
  11770.                         groundArray[plane][i4][l6] = null;
  11771.                     spawnGroundItem(i4, l6);
  11772.                 }
  11773.             }
  11774.             return;
  11775.         }
  11776.         if(j == 160)
  11777.         {
  11778.             int k1 = stream.method428();
  11779.             int j4 = anInt1268 + (k1 >> 4 & 7);
  11780.             int i7 = anInt1269 + (k1 & 7);
  11781.             int l9 = stream.method428();
  11782.             int j12 = l9 >> 2;
  11783.             int k14 = l9 & 3;
  11784.             int j16 = anIntArray1177[j12];
  11785.             int j17 = stream.method435();
  11786.             if(j4 >= 0 && i7 >= 0 && j4 < 103 && i7 < 103)
  11787.             {
  11788.                 int j18 = intGroundArray[plane][j4][i7];
  11789.                 int i19 = intGroundArray[plane][j4 + 1][i7];
  11790.                 int l19 = intGroundArray[plane][j4 + 1][i7 + 1];
  11791.                 int k20 = intGroundArray[plane][j4][i7 + 1];
  11792.                 if(j16 == 0)
  11793.                 {
  11794.                     Object1 class10 = worldController.method296(plane, j4, i7);
  11795.                     if(class10 != null)
  11796.                     {
  11797.                         int k21 = class10.uid >> 14 & 0x7fff;
  11798.                         if(j12 == 2)
  11799.                         {
  11800.                             class10.aClass30_Sub2_Sub4_278 = new Animable_Sub5(k21, 4 + k14, 2, i19, l19, j18, k20, j17, false);
  11801.                             class10.aClass30_Sub2_Sub4_279 = new Animable_Sub5(k21, k14 + 1 & 3, 2, i19, l19, j18, k20, j17, false);
  11802.                         } else
  11803.                         {
  11804.                             class10.aClass30_Sub2_Sub4_278 = new Animable_Sub5(k21, k14, j12, i19, l19, j18, k20, j17, false);
  11805.                         }
  11806.                     }
  11807.                 }
  11808.                 if(j16 == 1)
  11809.                 {
  11810.                     Object2 class26 = worldController.method297(j4, i7, plane);
  11811.                     if(class26 != null)
  11812.                         class26.aClass30_Sub2_Sub4_504 = new Animable_Sub5(class26.uid >> 14 & 0x7fff, 0, 4, i19, l19, j18, k20, j17, false);
  11813.                 }
  11814.                 if(j16 == 2)
  11815.                 {
  11816.                     Object5 class28 = worldController.method298(j4, i7, plane);
  11817.                     if(j12 == 11)
  11818.                         j12 = 10;
  11819.                     if(class28 != null)
  11820.                         class28.aClass30_Sub2_Sub4_521 = new Animable_Sub5(class28.uid >> 14 & 0x7fff, k14, j12, i19, l19, j18, k20, j17, false);
  11821.                 }
  11822.                 if(j16 == 3)
  11823.                 {
  11824.                     Object3 class49 = worldController.method299(i7, j4, plane);
  11825.                     if(class49 != null)
  11826.                         class49.aClass30_Sub2_Sub4_814 = new Animable_Sub5(class49.uid >> 14 & 0x7fff, k14, 22, i19, l19, j18, k20, j17, false);
  11827.                 }
  11828.             }
  11829.             return;
  11830.         }
  11831.         if(j == 147)
  11832.         {
  11833.             int l1 = stream.method428();
  11834.             int k4 = anInt1268 + (l1 >> 4 & 7);
  11835.             int j7 = anInt1269 + (l1 & 7);
  11836.             int i10 = stream.readUnsignedWord();
  11837.             byte byte0 = stream.method430();
  11838.             int l14 = stream.method434();
  11839.             byte byte1 = stream.method429();
  11840.             int k17 = stream.readUnsignedWord();
  11841.             int k18 = stream.method428();
  11842.             int j19 = k18 >> 2;
  11843.             int i20 = k18 & 3;
  11844.             int l20 = anIntArray1177[j19];
  11845.             byte byte2 = stream.readSignedByte();
  11846.             int l21 = stream.readUnsignedWord();
  11847.             byte byte3 = stream.method429();
  11848.             Player player;
  11849.             if(i10 == unknownInt10)
  11850.                 player = myPlayer;
  11851.             else
  11852.                 player = playerArray[i10];
  11853.             if(player != null)
  11854.             {
  11855.                 ObjectDef class46 = ObjectDef.forID(l21);
  11856.                 int i22 = intGroundArray[plane][k4][j7];
  11857.                 int j22 = intGroundArray[plane][k4 + 1][j7];
  11858.                 int k22 = intGroundArray[plane][k4 + 1][j7 + 1];
  11859.                 int l22 = intGroundArray[plane][k4][j7 + 1];
  11860.                 Model model = class46.method578(j19, i20, i22, j22, k22, l22, -1);
  11861.                 if(model != null)
  11862.                 {
  11863.                     method130(k17 + 1, -1, 0, l20, j7, 0, plane, k4, l14 + 1);
  11864.                     player.anInt1707 = l14 + loopCycle;
  11865.                     player.anInt1708 = k17 + loopCycle;
  11866.                     player.aModel_1714 = model;
  11867.                     int i23 = class46.anInt744;
  11868.                     int j23 = class46.anInt761;
  11869.                     if(i20 == 1 || i20 == 3)
  11870.                     {
  11871.                         i23 = class46.anInt761;
  11872.                         j23 = class46.anInt744;
  11873.                     }
  11874.                     player.anInt1711 = k4 * 128 + i23 * 64;
  11875.                     player.anInt1713 = j7 * 128 + j23 * 64;
  11876.                     player.anInt1712 = method42(plane, player.anInt1713, player.anInt1711);
  11877.                     if(byte2 > byte0)
  11878.                     {
  11879.                         byte byte4 = byte2;
  11880.                         byte2 = byte0;
  11881.                         byte0 = byte4;
  11882.                     }
  11883.                     if(byte3 > byte1)
  11884.                     {
  11885.                         byte byte5 = byte3;
  11886.                         byte3 = byte1;
  11887.                         byte1 = byte5;
  11888.                     }
  11889.                     player.anInt1719 = k4 + byte2;
  11890.                     player.anInt1721 = k4 + byte0;
  11891.                     player.anInt1720 = j7 + byte3;
  11892.                     player.anInt1722 = j7 + byte1;
  11893.                 }
  11894.             }
  11895.         }
  11896.         if(j == 151)
  11897.         {
  11898.             int i2 = stream.method426();
  11899.             int l4 = anInt1268 + (i2 >> 4 & 7);
  11900.             int k7 = anInt1269 + (i2 & 7);
  11901.             int j10 = stream.method434();
  11902.             int k12 = stream.method428();
  11903.             int i15 = k12 >> 2;
  11904.             int k16 = k12 & 3;
  11905.             int l17 = anIntArray1177[i15];
  11906.             if(l4 >= 0 && k7 >= 0 && l4 < 104 && k7 < 104)
  11907.                 method130(-1, j10, k16, l17, k7, i15, plane, l4, 0);
  11908.             return;
  11909.         }
  11910.         if(j == 4)
  11911.         {
  11912.             int j2 = stream.readUnsignedByte();
  11913.             int i5 = anInt1268 + (j2 >> 4 & 7);
  11914.             int l7 = anInt1269 + (j2 & 7);
  11915.             int k10 = stream.readUnsignedWord();
  11916.             int l12 = stream.readUnsignedByte();
  11917.             int j15 = stream.readUnsignedWord();
  11918.             if(i5 >= 0 && l7 >= 0 && i5 < 104 && l7 < 104)
  11919.             {
  11920.                 i5 = i5 * 128 + 64;
  11921.                 l7 = l7 * 128 + 64;
  11922.                 Animable_Sub3 class30_sub2_sub4_sub3 = new Animable_Sub3(plane, loopCycle, j15, k10, method42(plane, l7, i5) - l12, l7, i5);
  11923.                 aClass19_1056.insertHead(class30_sub2_sub4_sub3);
  11924.             }
  11925.             return;
  11926.         }
  11927.         if(j == 44)
  11928.         {
  11929.             int k2 = stream.method436();
  11930.             int j5 = stream.readUnsignedWord();
  11931.             int i8 = stream.readUnsignedByte();
  11932.             int l10 = anInt1268 + (i8 >> 4 & 7);
  11933.             int i13 = anInt1269 + (i8 & 7);
  11934.             if(l10 >= 0 && i13 >= 0 && l10 < 104 && i13 < 104)
  11935.             {
  11936.                 Item class30_sub2_sub4_sub2_1 = new Item();
  11937.                 class30_sub2_sub4_sub2_1.ID = k2;
  11938.                 class30_sub2_sub4_sub2_1.anInt1559 = j5;
  11939.                 if(groundArray[plane][l10][i13] == null)
  11940.                     groundArray[plane][l10][i13] = new NodeList();
  11941.                 groundArray[plane][l10][i13].insertHead(class30_sub2_sub4_sub2_1);
  11942.                 spawnGroundItem(l10, i13);
  11943.             }
  11944.             return;
  11945.         }
  11946.         if(j == 101)
  11947.         {
  11948.             int l2 = stream.method427();
  11949.             int k5 = l2 >> 2;
  11950.             int j8 = l2 & 3;
  11951.             int i11 = anIntArray1177[k5];
  11952.             int j13 = stream.readUnsignedByte();
  11953.             int k15 = anInt1268 + (j13 >> 4 & 7);
  11954.             int l16 = anInt1269 + (j13 & 7);
  11955.             if(k15 >= 0 && l16 >= 0 && k15 < 104 && l16 < 104)
  11956.                 method130(-1, -1, j8, i11, l16, k5, plane, k15, 0);
  11957.             return;
  11958.         }
  11959.         if(j == 117)
  11960.         {
  11961.             int i3 = stream.readUnsignedByte();
  11962.             int l5 = anInt1268 + (i3 >> 4 & 7);
  11963.             int k8 = anInt1269 + (i3 & 7);
  11964.             int j11 = l5 + stream.readSignedByte();
  11965.             int k13 = k8 + stream.readSignedByte();
  11966.             int l15 = stream.readSignedWord();
  11967.             int i17 = stream.readUnsignedWord();
  11968.             int i18 = stream.readUnsignedByte() * 4;
  11969.             int l18 = stream.readUnsignedByte() * 4;
  11970.             int k19 = stream.readUnsignedWord();
  11971.             int j20 = stream.readUnsignedWord();
  11972.             int i21 = stream.readUnsignedByte();
  11973.             int j21 = stream.readUnsignedByte();
  11974.             if(l5 >= 0 && k8 >= 0 && l5 < 104 && k8 < 104 && j11 >= 0 && k13 >= 0 && j11 < 104 && k13 < 104 && i17 != 65535)
  11975.             {
  11976.                 l5 = l5 * 128 + 64;
  11977.                 k8 = k8 * 128 + 64;
  11978.                 j11 = j11 * 128 + 64;
  11979.                 k13 = k13 * 128 + 64;
  11980.                 Animable_Sub4 class30_sub2_sub4_sub4 = new Animable_Sub4(i21, l18, k19 + loopCycle, j20 + loopCycle, j21, plane, method42(plane, k8, l5) - i18, k8, l5, l15, i17);
  11981.                 class30_sub2_sub4_sub4.method455(k19 + loopCycle, k13, method42(plane, k13, j11) - l18, j11);
  11982.                 aClass19_1013.insertHead(class30_sub2_sub4_sub4);
  11983.             }
  11984.         }
  11985.     }
  11986.  
  11987.     private static void setLowMem()
  11988.     {
  11989.         WorldController.lowMem = true;
  11990.         Texture.lowMem = true;
  11991.         lowMem = true;
  11992.         ObjectManager.lowMem = true;
  11993.         ObjectDef.lowMem = true;
  11994.     }
  11995.  
  11996.     private void method139(Stream stream)
  11997.     {
  11998.         stream.initBitAccess();
  11999.         int k = stream.readBits(8);
  12000.         if(k < npcCount)
  12001.         {
  12002.             for(int l = k; l < npcCount; l++)
  12003.                 anIntArray840[anInt839++] = npcIndices[l];
  12004.  
  12005.         }
  12006.         if(k > npcCount)
  12007.         {
  12008.             signlink.reporterror(myUsername + " Too many npcs");
  12009.             throw new RuntimeException("eek");
  12010.         }
  12011.         npcCount = 0;
  12012.         for(int i1 = 0; i1 < k; i1++)
  12013.         {
  12014.             int j1 = npcIndices[i1];
  12015.             NPC npc = npcArray[j1];
  12016.             int k1 = stream.readBits(1);
  12017.             if(k1 == 0)
  12018.             {
  12019.                 npcIndices[npcCount++] = j1;
  12020.                 npc.anInt1537 = loopCycle;
  12021.             } else
  12022.             {
  12023.                 int l1 = stream.readBits(2);
  12024.                 if(l1 == 0)
  12025.                 {
  12026.                     npcIndices[npcCount++] = j1;
  12027.                     npc.anInt1537 = loopCycle;
  12028.                     anIntArray894[anInt893++] = j1;
  12029.                 } else
  12030.                 if(l1 == 1)
  12031.                 {
  12032.                     npcIndices[npcCount++] = j1;
  12033.                     npc.anInt1537 = loopCycle;
  12034.                     int i2 = stream.readBits(3);
  12035.                     npc.moveInDir(false, i2);
  12036.                     int k2 = stream.readBits(1);
  12037.                     if(k2 == 1)
  12038.                         anIntArray894[anInt893++] = j1;
  12039.                 } else
  12040.                 if(l1 == 2)
  12041.                 {
  12042.                     npcIndices[npcCount++] = j1;
  12043.                     npc.anInt1537 = loopCycle;
  12044.                     int j2 = stream.readBits(3);
  12045.                     npc.moveInDir(true, j2);
  12046.                     int l2 = stream.readBits(3);
  12047.                     npc.moveInDir(true, l2);
  12048.                     int i3 = stream.readBits(1);
  12049.                     if(i3 == 1)
  12050.                         anIntArray894[anInt893++] = j1;
  12051.                 } else
  12052.                 if(l1 == 3)
  12053.                     anIntArray840[anInt839++] = j1;
  12054.             }
  12055.         }
  12056.  
  12057.     }
  12058.    
  12059.     public void handleStupidWorldSwitch() {
  12060.             if(world > 1){ // Makes sure you can only go to 2 worlds.
  12061.         world = 1;
  12062.         }else{
  12063.         world += 1;
  12064.         }
  12065.         if(world == 1){
  12066.         serverip = "unperfectpvp.no-ip.biz";
  12067.         port = 43594;
  12068.         spec =" Regular World";
  12069.         signlink.setuid();
  12070.         } else {
  12071.         if(world == 2){
  12072.         serverip = "127.0.0.1";
  12073.         port = 43595;
  12074.         signlink.setuid();
  12075.         spec =" @red@Developers World";
  12076.         }
  12077.         }
  12078.         if(world < 0 || world > 7)
  12079.             spec = " Invalid world";
  12080.             }
  12081.            
  12082.  
  12083.         private void processLoginScreenInput() {
  12084.         if(loginMessage2.equals("@whi@Error connecting to server.")){ // fixes the client login lagg, by Gabbe.
  12085.                 loginMessage2 = "@whi@Error connecting to server.";
  12086.         }
  12087.         if (loginScreenState == 0) {
  12088.                 int l = super.myHeight / 2 + 20;
  12089.                 int yoffset = 36;
  12090.                 screenHover[0] = super.mouseX >= 273 && super.mouseX <= 490 && super.mouseY >= 194 + yoffset && super.mouseY <= 219 + yoffset;
  12091.                 screenHover[1] = super.mouseX >= 273 && super.mouseX <= 490 && super.mouseY >= 240 + yoffset && super.mouseY <= 265 + yoffset;
  12092.                 screenHover[2] = super.mouseX >= 253 && super.mouseX <= 454 && super.mouseY >= 296 + yoffset && super.mouseY <= 321 + yoffset;
  12093.                 screenHover[3] = super.mouseX >= 455 && super.mouseX <= 600 && super.mouseY >= 296 + yoffset && super.mouseY <= 321 + yoffset;
  12094.                 if (super.clickMode3 == 1 && super.saveClickX >= 273
  12095.                         && super.saveClickX <= 490 && super.saveClickY >= 194 + yoffset
  12096.                         && super.saveClickY <= 219 + yoffset)
  12097.                     loginScreenCursorPos = 0;
  12098.                 if (super.clickMode3 == 1 && super.mouseX >= 273
  12099.                         && super.mouseX <= 490 && super.mouseY >= 240 + yoffset
  12100.                         && super.mouseY <= 265 + yoffset)
  12101.                     loginScreenCursorPos = 1;
  12102.                 if (super.clickMode3 == 1 && super.saveClickX >= 253
  12103.                         && super.saveClickX <= 454 && super.saveClickY >= 296 + yoffset
  12104.                         && super.saveClickY <= 321 + yoffset) {
  12105.                     loginFailures = 0;
  12106.                     login(myUsername, myPassword, false);
  12107.                     if (loggedIn)
  12108.                         return;
  12109.                 }
  12110.                                 if (super.clickMode3 == 1 && super.saveClickX >= 455
  12111.                         && super.saveClickX <= 600 && super.saveClickY >= 296 + yoffset
  12112.                         && super.saveClickY <= 321 + yoffset) {
  12113.         int x = 49;
  12114.         loginBox.drawSprite(0 + x, 0);
  12115.         char c = '\u0168';
  12116.         char c1 = '\310';
  12117.         int k1 = c1 / 2 + 20;
  12118.         handleStupidWorldSwitch();
  12119.        
  12120.         /*aTextDrawingArea_1271.method382(0xffff00, 130 + x, "@whi@World selected: @red@" + world,
  12121.                     k1 + 22
  12122.                     , true);*/
  12123.                 }
  12124.                 do {
  12125.                     int l1 = readChar(-796);
  12126.                     if (l1 == -1)
  12127.                         break;
  12128.                     boolean flag1 = false;
  12129.                     for (int i2 = 0; i2 < validUserPassChars.length(); i2++) {
  12130.                         if (l1 != validUserPassChars.charAt(i2))
  12131.                             continue;
  12132.                         flag1 = true;
  12133.                         break;
  12134.                     }
  12135.  
  12136.                     if (loginScreenCursorPos == 0) {
  12137.                         if (l1 == 8 && myUsername.length() > 0)
  12138.                             myUsername = myUsername.substring(0,
  12139.                                     myUsername.length() - 1);
  12140.                         if (l1 == 9 || l1 == 10 || l1 == 13) {
  12141.                             loginScreenCursorPos = 1;
  12142.                         }
  12143.                         if (flag1)
  12144.                             myUsername += (char) l1;
  12145.                         if (myUsername.length() > 12)
  12146.                             myUsername = myUsername.substring(0, 12);
  12147.                     } else if (loginScreenCursorPos == 1) {
  12148.                         if (l1 == 8 && myPassword.length() > 0)
  12149.                             myPassword = myPassword.substring(0,
  12150.                                     myPassword.length() - 1);
  12151.                         if (l1 == 9 || l1 == 10 || l1 == 13) {
  12152.                             if (myPassword.length() > 0
  12153.                                     && myUsername.length() > 0) {
  12154.                                 login(myUsername, myPassword, false);
  12155.                             } else {
  12156.                                 loginScreenCursorPos = 0;
  12157.                             }
  12158.                         }
  12159.                         if (flag1)
  12160.                             myPassword += (char) l1;
  12161.                         if (myPassword.length() > 20)
  12162.                             myPassword = myPassword.substring(0, 20);
  12163.                     }
  12164.                 } while (true);
  12165.                 return;
  12166.             }
  12167.     }
  12168.  
  12169.     private void method142(int i, int j, int k, int l, int i1, int j1, int k1
  12170.     )
  12171.     {
  12172.         if(i1 >= 1 && i >= 1 && i1 <= 102 && i <= 102)
  12173.         {
  12174.             if(lowMem && j != plane)
  12175.                 return;
  12176.             int i2 = 0;
  12177.             if(j1 == 0)
  12178.                 i2 = worldController.method300(j, i1, i);
  12179.             if(j1 == 1)
  12180.                 i2 = worldController.method301(j, i1, i);
  12181.             if(j1 == 2)
  12182.                 i2 = worldController.method302(j, i1, i);
  12183.             if(j1 == 3)
  12184.                 i2 = worldController.method303(j, i1, i);
  12185.             if(i2 != 0)
  12186.             {
  12187.                 int i3 = worldController.method304(j, i1, i, i2);
  12188.                 int j2 = i2 >> 14 & 0x7fff;
  12189.                 int k2 = i3 & 0x1f;
  12190.                 int l2 = i3 >> 6;
  12191.                 if(j1 == 0)
  12192.                 {
  12193.                     worldController.method291(i1, j, i, (byte)-119);
  12194.                     ObjectDef class46 = ObjectDef.forID(j2);
  12195.                     if(class46.aBoolean767)
  12196.                         aClass11Array1230[j].method215(l2, k2, class46.aBoolean757, i1, i);
  12197.                 }
  12198.                 if(j1 == 1)
  12199.                     worldController.method292(i, j, i1);
  12200.                 if(j1 == 2)
  12201.                 {
  12202.                     worldController.method293(j, i1, i);
  12203.                     ObjectDef class46_1 = ObjectDef.forID(j2);
  12204.                     if(i1 + class46_1.anInt744 > 103 || i + class46_1.anInt744 > 103 || i1 + class46_1.anInt761 > 103 || i + class46_1.anInt761 > 103)
  12205.                         return;
  12206.                     if(class46_1.aBoolean767)
  12207.                         aClass11Array1230[j].method216(l2, class46_1.anInt744, i1, i, class46_1.anInt761, class46_1.aBoolean757);
  12208.                 }
  12209.                 if(j1 == 3)
  12210.                 {
  12211.                     worldController.method294(j, i, i1);
  12212.                     ObjectDef class46_2 = ObjectDef.forID(j2);
  12213.                     if(class46_2.aBoolean767 && class46_2.hasActions)
  12214.                         aClass11Array1230[j].method218(i, i1);
  12215.                 }
  12216.             }
  12217.             if(k1 >= 0)
  12218.             {
  12219.                 int j3 = j;
  12220.                 if(j3 < 3 && (byteGroundArray[1][i1][i] & 2) == 2)
  12221.                     j3++;
  12222.                 ObjectManager.method188(worldController, k, i, l, j3, aClass11Array1230[j], intGroundArray, i1, k1, j);
  12223.             }
  12224.         }
  12225.     }
  12226.  
  12227.     private void updatePlayers(int i, Stream stream)
  12228.     {
  12229.         anInt839 = 0;
  12230.         anInt893 = 0;
  12231.         method117(stream);
  12232.         method134(stream);
  12233.         method91(stream, i);
  12234.         method49(stream);
  12235.         for(int k = 0; k < anInt839; k++)
  12236.         {
  12237.             int l = anIntArray840[k];
  12238.             if(playerArray[l].anInt1537 != loopCycle)
  12239.                 playerArray[l] = null;
  12240.         }
  12241.  
  12242.         if(stream.currentOffset != i)
  12243.         {
  12244.             signlink.reporterror("Error packet size mismatch in getplayer pos:" + stream.currentOffset + " psize:" + i);
  12245.             throw new RuntimeException("eek");
  12246.         }
  12247.         for(int i1 = 0; i1 < playerCount; i1++)
  12248.             if(playerArray[playerIndices[i1]] == null)
  12249.             {
  12250.                 signlink.reporterror(myUsername + " null entry in pl list - pos:" + i1 + " size:" + playerCount);
  12251.                 throw new RuntimeException("eek");
  12252.             }
  12253.  
  12254.     }
  12255.  
  12256.     private void setCameraPos(int j, int k, int l, int i1, int j1, int k1)
  12257.     {
  12258.         int l1 = 2048 - k & 0x7ff;
  12259.         int i2 = 2048 - j1 & 0x7ff;
  12260.         int j2 = 0;
  12261.         int k2 = 0;
  12262.         int l2 = j;
  12263.         if(l1 != 0)
  12264.         {
  12265.             int i3 = Model.modelIntArray1[l1];
  12266.             int k3 = Model.modelIntArray2[l1];
  12267.             int i4 = k2 * k3 - l2 * i3 >> 16;
  12268.             l2 = k2 * i3 + l2 * k3 >> 16;
  12269.             k2 = i4;
  12270.         }
  12271.         if(i2 != 0)
  12272.         {
  12273. /* xxx          if(cameratoggle){
  12274.                 if(zoom == 0)
  12275.                 zoom = k2;
  12276.               if(lftrit == 0)
  12277.                 lftrit = j2;
  12278.               if(fwdbwd == 0)
  12279.                 fwdbwd = l2;
  12280.               k2 = zoom;
  12281.               j2 = lftrit;
  12282.               l2 = fwdbwd;
  12283.             }
  12284. */
  12285.             int j3 = Model.modelIntArray1[i2];
  12286.             int l3 = Model.modelIntArray2[i2];
  12287.             int j4 = l2 * j3 + j2 * l3 >> 16;
  12288.             l2 = l2 * l3 - j2 * j3 >> 16;
  12289.             j2 = j4;
  12290.         }
  12291.         xCameraPos = l - j2;
  12292.         zCameraPos = i1 - k2;
  12293.         yCameraPos = k1 - l2;
  12294.         yCameraCurve = k;
  12295.         xCameraCurve = j1;
  12296.     }
  12297.  
  12298.     public void updateStrings(String str, int i) {
  12299.         switch(i) {
  12300.             case 1675: sendFrame126(str, 17508); break;//Stab
  12301.             case 1676: sendFrame126(str, 17509); break;//Slash
  12302.             case 1677: sendFrame126(str, 17510); break;//Cursh
  12303.             case 1678: sendFrame126(str, 17511); break;//Magic
  12304.             case 1679: sendFrame126(str, 17512); break;//Range
  12305.             case 1680: sendFrame126(str, 17513); break;//Stab
  12306.             case 1681: sendFrame126(str, 17514); break;//Slash
  12307.             case 1682: sendFrame126(str, 17515); break;//Crush
  12308.             case 1683: sendFrame126(str, 17516); break;//Magic
  12309.             case 1684: sendFrame126(str, 17517); break;//Range
  12310.             case 1686: sendFrame126(str, 17518); break;//Strength
  12311.             case 1687: sendFrame126(str, 17519); break;//Prayer
  12312.         }
  12313.     }
  12314.  
  12315.     private void changePasswordSubmit() {
  12316.         if(newPasswordString.length() <= 0)
  12317.             pushMessage("Please type the new password you would like first.", 0 ," ");
  12318.         else if(newPasswordString == myPassword) {
  12319.             pushMessage("This is your current password, no changes where made.", 0 ," ");
  12320.         } else {
  12321.             sendData("::changepassword " + newPasswordString);
  12322.             myPassword = newPasswordString;
  12323.             openInterfaceID = -1;
  12324.             setDetails();
  12325.         }
  12326.     }
  12327.    
  12328.     public String strengthCheck(String newPassword) {
  12329.         Pattern[] pattern = new Pattern[3];
  12330.         Matcher matcher;
  12331.         pattern[0] = Pattern.compile("[a-zA-Z]");
  12332.         pattern[1] = Pattern.compile("\\d");
  12333.         pattern[2] = Pattern.compile("[^a-zA-Z0-9]");
  12334.         int level = 0, i = 0;
  12335.         // find the strength
  12336.         while(i != 3) {
  12337.             matcher = pattern[i].matcher(newPassword);
  12338.             if(matcher.find())
  12339.                 level++;
  12340.             i++;
  12341.         }
  12342.         String strength = "None";
  12343.         if(level == 1 && newPassword.length() < 6)
  12344.             strength = "@red@Very weak";
  12345.         else if (level == 1 && newPassword.length() < 9)
  12346.             strength = "@or2@Weak";
  12347.         else if (level == 1 && newPassword.length() >= 9 || level == 2 && newPassword.length() < 9)
  12348.             strength = "@or3@Medium";
  12349.         else if (level == 2 && newPassword.length() >= 9 || level == 3 && newPassword.length() < 6)
  12350.             strength = "@yel@Strong";
  12351.         else if (level == 3 && newPassword.length() < 9)
  12352.             strength = "@gre@Very strong";
  12353.         else if (level == 3 && newPassword.length() >= 9)
  12354.             strength = "@blu@Best";
  12355.         // check for sequences
  12356.         pattern[0] = Pattern.compile("[a-zA-Z]{3,}");
  12357.         pattern[1] = Pattern.compile("[0-9]{3,}");
  12358.         boolean sequence = false;
  12359.         i = 0;
  12360.         while (i != 2) {
  12361.             matcher = pattern[i].matcher(newPassword);
  12362.             while(matcher.find()) {
  12363.                 if(sequenceCheck(matcher.group(),i)) {
  12364.                     sequence = true;
  12365.                     break;
  12366.                 }
  12367.             }
  12368.             i++;
  12369.             System.out.println(i);
  12370.         }
  12371.         return strength + "." + (sequence ? "@whi@Tip: Don't use easy sequences." : "");
  12372.     }
  12373.    
  12374.     boolean sequenceCheck(String s,int n) {
  12375.         s = s.toLowerCase();
  12376.         String sequence;
  12377.         if(n == 0)
  12378.             sequence = "abcdefghijklmnopqrstuvwxyz";
  12379.         else
  12380.             sequence = "0123456789";
  12381.         Pattern pattern;
  12382.         Matcher matcher;
  12383.         int b = 0,e = 3;
  12384.         while(!s.substring(b,e).equals("")) {
  12385.             pattern = Pattern.compile(s.substring(b,e));
  12386.             matcher = pattern.matcher(sequence);
  12387.             if (matcher.find())
  12388.                 return true;
  12389.             b++;
  12390.             e++;
  12391.             if(e > s.length())
  12392.                 return false;
  12393.         }
  12394.         return false;
  12395.     }
  12396.    
  12397.     public void sendFrame126(String str,int i) {
  12398.         RSInterface.interfaceCache[i].message = str;
  12399.         if(RSInterface.interfaceCache[i].parentID == tabInterfaceIDs[tabID])
  12400.             needDrawTabArea = true;
  12401.     }
  12402.  
  12403.     public void sendPacket185(int button,int toggle,int type) {
  12404.         switch(type) {
  12405.             case 135:
  12406.                 RSInterface class9 = RSInterface.interfaceCache[button];
  12407.                 boolean flag8 = true;
  12408.                 if(class9.contentType > 0)
  12409.                     flag8 = promptUserForInput(class9);
  12410.                 if(flag8) {
  12411.                     if(button >= 17202 && button <= 17227)
  12412.                         togglePrayerState(button);
  12413.                     switch(button) {
  12414.                         case 22597:
  12415.                             changePasswordSubmit();
  12416.                             break;
  12417.                         case 17231://Quick prayr confirm
  12418.                             saveQuickSelection();
  12419.                             break;
  12420.                         case 19144:
  12421.                             sendFrame248(15106,3213);
  12422.                             method60(15106);
  12423.                             inputTaken = true;
  12424.                             break;
  12425.                         case 22762:
  12426.                             openInterfaceID = 23471;//Pouch interface
  12427.                             break;
  12428.                         case 23475:
  12429.                             openInterfaceID = 22760;//Scroll interface
  12430.                             break;
  12431.                         default:
  12432.                             stream.createFrame(185);
  12433.                             stream.writeWord(button);
  12434.                             break;
  12435.                        
  12436.                     }
  12437.                 }
  12438.                 break;
  12439.             case 646:
  12440.                 stream.createFrame(185);
  12441.                 stream.writeWord(button);
  12442.                 RSInterface class9_2 = RSInterface.interfaceCache[button];
  12443.                 if(class9_2.valueIndexArray != null && class9_2.valueIndexArray[0][0] == 5) {
  12444.                     toggle = class9_2.valueIndexArray[0][1];
  12445.                     if(variousSettings[toggle] != class9_2.requiredValues[0]) {
  12446.                         variousSettings[toggle] = class9_2.requiredValues[0];
  12447.                         method33(toggle);
  12448.                         needDrawTabArea = true;
  12449.                     }
  12450.                 }
  12451.                 break;
  12452.             case 169:
  12453.                 stream.createFrame(185);
  12454.                 stream.writeWord(button);
  12455.                 RSInterface class9_3 = RSInterface.interfaceCache[button];
  12456.                 if(class9_3.valueIndexArray != null && class9_3.valueIndexArray[0][0] == 5) {
  12457.                     toggle = class9_3.valueIndexArray[0][1];
  12458.                     variousSettings[toggle] = 1 - variousSettings[toggle];
  12459.                     method33(toggle);
  12460.                     needDrawTabArea = true;
  12461.                     if(button >= 25000 && button <= 25050) {
  12462.                         handePrayerCorrection(button);
  12463.                     }
  12464.                     switch(button) {
  12465.                         //functionKeys
  12466.                         case 26007://Toggle function keys
  12467.                             functionKeys = !functionKeys;
  12468.                             setDetails();
  12469.                             break;
  12470.                         case 26008://Toggle halth bars
  12471.                             healthBars = !healthBars;
  12472.                             setDetails();
  12473.                             break;
  12474.                         case 26010://Toggle x10 damage
  12475.                             newDamage = !newDamage;
  12476.                             setDetails();
  12477.                             break;
  12478.                         case 152:
  12479.                             if(variousSettings[toggle] == 1)
  12480.                                 orbToggle[2] = true;
  12481.                             else
  12482.                                 orbToggle[2] = false;
  12483.                             break;
  12484.                         case 19136:
  12485.                             if(toggle == 0)
  12486.                                 sendFrame36(173,toggle);
  12487.                             if(toggle == 1)
  12488.                                 sendPacket185(153,173,646);
  12489.                             break;
  12490.                         case 25842://More options
  12491.                             toggle = (openInterfaceID == 26000) ? 0 : 1;
  12492.                             sendFrame36(175,toggle);
  12493.                             if(toggle == 1)
  12494.                                 openInterfaceID = 26000;
  12495.                             else
  12496.                                 openInterfaceID = -1;
  12497.                         break;
  12498.                         case 26012://Fullscreen
  12499.                             switchToFullScreen();
  12500.                             break;
  12501.                     }
  12502.                 }
  12503.                 break;
  12504.         }
  12505.         System.out.println("button: " + button + ", toggle: " + toggle + ", type: " + type);
  12506.     }
  12507.    
  12508.     private void configureQuickTicks() {
  12509.         if(prayerInterfaceType == 5608) {
  12510.             if(getQuickPrayersSet() > 0) {
  12511.                 for(int index = 0; index < quickPrayers.length; index++) {
  12512.                     if(quickPrayers[index] == 1) {
  12513.                         if(index >= 0 && index <= 25) {
  12514.                             if(getOrbValues(1,null)[1] >= prayerLevelRequirements[index]) {
  12515.                                 int[] types = getPrayerTypeForIndex(index);
  12516.                                 if(types != null) {
  12517.                                     for(int g = 0; g < rangeAndMagePray.length; g++) {
  12518.                                         if(index == rangeAndMagePray[g]) {
  12519.                                             types = rangeAndMagePrayOff;
  12520.                                         }
  12521.                                     }
  12522.                                     for(int i = 0; i < types.length; i++) {
  12523.                                         if(index != types[i]) {
  12524.                                             if(index == 24 || index == 25) {
  12525.                                                 types = superiorPray;
  12526.                                             }
  12527.                                             quickPrayers[types[i]] = 0;
  12528.                                             variousSettings[quickConfigIDs[types[i]]] = 0;
  12529.                                             method33(quickConfigIDs[types[i]]);
  12530.                                             needDrawTabArea = true;
  12531.                                             if(dialogID != -1)
  12532.                                                 inputTaken = true;
  12533.                                         } else {
  12534.                                             quickPrayers[index] = 1;
  12535.                                             variousSettings[quickConfigIDs[index]] = quickPrayers[index];
  12536.                                             method33(quickConfigIDs[index]);
  12537.                                             needDrawTabArea = true;
  12538.                                             if(dialogID != -1)
  12539.                                                 inputTaken = true;
  12540.                                         }
  12541.                                     }
  12542.                                 } else {
  12543.                                     quickPrayers[index] = 1;
  12544.                                     variousSettings[quickConfigIDs[index]] = quickPrayers[index];
  12545.                                     method33(quickConfigIDs[index]);
  12546.                                     needDrawTabArea = true;
  12547.                                     if(dialogID != -1)
  12548.                                         inputTaken = true;
  12549.                                 }
  12550.                             }
  12551.                         }
  12552.                     }
  12553.                 }
  12554.             }
  12555.         } else if(prayerInterfaceType == 22500) {
  12556.             if(getQuickCursesSet() > 0) {
  12557.                 for(int index = 0; index < quickCurses.length; index++) {
  12558.                     if(quickCurses[index] == 1) {
  12559.                         if(index >= 0 && index <= 20) {
  12560.                             if(getOrbValues(1,null)[1] >= curseLevelRequirements[index]) {
  12561.                                 System.out.println("woop: " + getQuickCursesSet() + ", index: " + index);
  12562.                                 int[] types = getCurseTypeForIndex(index);
  12563.                                 if(types != null) {
  12564.                                     for(int i = 0; i < types.length; i++) {
  12565.                                         if(index != types[i]) {
  12566.                                             quickCurses[types[i]] = 0;
  12567.                                             variousSettings[quickConfigIDs[types[i]]] = 0;
  12568.                                             method33(quickConfigIDs[types[i]]);
  12569.                                             needDrawTabArea = true;
  12570.                                             if(dialogID != -1)
  12571.                                                 inputTaken = true;
  12572.                                         }
  12573.                                     }
  12574.                                 }
  12575.                                 quickCurses[index] =  1;
  12576.                                 variousSettings[quickConfigIDs[index]] = quickCurses[index];
  12577.                                 method33(quickConfigIDs[index]);
  12578.                                 needDrawTabArea = true;
  12579.                                 if(dialogID != -1)
  12580.                                     inputTaken = true;
  12581.                             }
  12582.                         }
  12583.                     }
  12584.                 }
  12585.             }
  12586.         }
  12587.     }
  12588.    
  12589.     public void readDetails()
  12590.     {
  12591.         String line = "";
  12592.         String token = "";
  12593.         String token2 = "";
  12594.         int ReadMode = 0;
  12595.         boolean EndOfFile = false;
  12596.         String[] token3 = new String[30];
  12597.         BufferedReader details = null;
  12598.         try
  12599.         {
  12600.             details = new BufferedReader(new FileReader(signlink.findcachedir() + "/details2.ini"));
  12601.             try
  12602.             {
  12603.                 line = details.readLine();
  12604.             } catch(IOException ioexception)
  12605.             {
  12606.                 System.out.println("Error reading details2.ini");
  12607.             }
  12608.             while(EndOfFile == false && line != null)
  12609.             {
  12610.                 line = line.trim();
  12611.                 int spot = line.indexOf("=");
  12612.                 if(spot > -1)
  12613.                 {
  12614.                     token = line.substring(0, spot);
  12615.                     token = token.trim();
  12616.                     token2 = line.substring(spot + 1);
  12617.                     token2 = token2.trim();
  12618.                     token3 = token2.split("\t");
  12619.                     switch(ReadMode)
  12620.                     {
  12621.                         case 1:
  12622.                             if(token.equals("username")) {
  12623.                                 myUsername = token2;
  12624.                             }
  12625.                             if(token.equals("password"))
  12626.                                 myPassword = token2;
  12627.                             //if(token.equals("server"))
  12628.                             //  serverip = token2;
  12629.                             if(token.equals("keys"))
  12630.                                 functionKeys = token2.equals("0") ? false : true;
  12631.                             if(token.equals("health"))
  12632.                                 healthBars = token2.equals("0") ? false : true;
  12633.                             if(token.equals("damage"))
  12634.                                 newDamage = token2.equals("0") ? false : true;
  12635.                             break;
  12636.                         case 2:
  12637.                             if (token.equals("prayer")) {
  12638.                                 for (int j = 0; j < token3.length; j++) {
  12639.                                     quickPrayers[j] = Integer.parseInt(token3[j]);                     
  12640.                                 }
  12641.                             }
  12642.                             break;
  12643.                         case 3:
  12644.                             if (token.equals("curse")) {
  12645.                                 for (int j = 0; j < token3.length; j++) {
  12646.                                     quickCurses[j] = Integer.parseInt(token3[j]);                      
  12647.                                 }
  12648.                             }
  12649.                             break;
  12650.                        
  12651.                     }
  12652.                 } else {
  12653.                     if(line.equals("[ACCOUNT]"))
  12654.                         ReadMode = 1;
  12655.                     else if(line.equals("[PRAYERS]"))
  12656.                         ReadMode = 2;
  12657.                     else if(line.equals("[CURSES]"))
  12658.                         ReadMode = 3;
  12659.                     if(line.equals("[EOF]"))
  12660.                         try {
  12661.                             details.close();
  12662.                         } catch(IOException ioexception)
  12663.                         {
  12664.                             ioexception.printStackTrace();
  12665.                         }
  12666.                 }
  12667.                 try
  12668.                 {
  12669.                     line = details.readLine();
  12670.                 } catch(IOException ioexception1)
  12671.                 {
  12672.                     EndOfFile = true;
  12673.                 }
  12674.             }
  12675.         } catch(FileNotFoundException file) {
  12676.             System.out.println("Couldn't find details2.ini");
  12677.         }
  12678.         try {
  12679.             if(details != null)
  12680.                 details.close();
  12681.         } catch(NullPointerException ex) {
  12682.             ex.printStackTrace();
  12683.         } catch(IOException ioexception) {
  12684.             ioexception.printStackTrace();
  12685.         }
  12686.     }
  12687.    
  12688.     public void setDetails()
  12689.     {
  12690.         BufferedWriter details = null;
  12691.         try
  12692.         {
  12693.             details = new BufferedWriter(new FileWriter(signlink.findcachedir()+"/details2.ini"));
  12694.             saveValue(details,"[ACCOUNT]","nothing",false);
  12695.             saveValue(details,"username",myUsername,false);
  12696.             saveValue(details,"password",myPassword,false);
  12697.             //saveValue(details,"server",serverip,false);
  12698.             saveValue(details,"keys",functionKeys ? "1" : "0",false);
  12699.             saveValue(details,"health",healthBars ? "1" : "0",false);
  12700.             saveValue(details,"damage",newDamage ? "1" : "0",true);
  12701.  
  12702.             saveValue(details,"[PRAYERS]","nothing",false);
  12703.             String stringSave = "";
  12704.             for(int i = 0; i < quickPrayers.length; i++)    {
  12705.                 stringSave = stringSave + quickPrayers[i] + "\t";
  12706.             }
  12707.             saveValue(details,"prayer",stringSave,true);
  12708.            
  12709.             saveValue(details,"[CURSES]","nothing",false);
  12710.             stringSave = "";
  12711.             for(int i = 0; i < quickCurses.length; i++) {
  12712.                 stringSave = stringSave + quickCurses[i] + "\t";
  12713.             }
  12714.             saveValue(details,"curse",stringSave,true);
  12715.            
  12716.             //Ends
  12717.             details.newLine();
  12718.             details.write("[EOF]", 0, 5);
  12719.             details.newLine();
  12720.             details.newLine();
  12721.             details.close();
  12722.         } catch(IOException io) {
  12723.             (new File(signlink.findcachedir()+"/details2.ini")).delete();
  12724.             System.out.println("Error while writing details2.ini");
  12725.         }
  12726.     }
  12727.    
  12728.     private int[] quickPrayers = new int[26];
  12729.     private int[] quickCurses = new int[20];
  12730.     private boolean loadTickSelection = false;
  12731.    
  12732.     public static void saveValue(BufferedWriter buffer, String value,String variable,boolean last)
  12733.     {
  12734.         try
  12735.         {
  12736.             if(value == null || variable.equals("null"))
  12737.                 System.out.println("Error: saveValue had no identifier.");
  12738.             if(variable == null || variable.equals("null"))
  12739.                 variable = "0";
  12740.             if(value.startsWith("[") && value.endsWith("]"))
  12741.             {
  12742.                 buffer.write(value, 0, value.length());
  12743.             } else {
  12744.                 value =  value + " = ";
  12745.                 buffer.write(value, 0, value.length());
  12746.                 buffer.write(variable, 0, variable.length());
  12747.             }
  12748.             buffer.newLine();
  12749.             if(last)
  12750.                 buffer.newLine();
  12751.         }
  12752.         catch(IOException ioexception) {
  12753.             ioexception.printStackTrace();
  12754.         }
  12755.         catch(NullPointerException nullpointerexception)
  12756.         {
  12757.             nullpointerexception.printStackTrace();
  12758.         }
  12759.     }
  12760.    
  12761.     public int[] oldPrayerButtons = {5609,5610,5611,18000,18002,5612,5613,5614,5615,5616,5617,18004,18006,5618,5619,5620,5621,5622,5623,18008,18010,683,684,685,18012,18014};
  12762.     public void handePrayerCorrection(int button) {
  12763.         int index = button - 25000;
  12764.         if(index > 0)
  12765.             index = index/2;
  12766.         sendPacket185(oldPrayerButtons[index],-1,169);
  12767.     }
  12768.    
  12769.     private void saveQuickSelection() {
  12770.         setDetails();
  12771.         tabInterfaceIDs[5] = prayerInterfaceType;
  12772.     }
  12773.    
  12774.     private void handleQuickAidsActive() {
  12775.         if(prayerInterfaceType == 5608) {
  12776.             if(getQuickPrayersSet() > 0) {
  12777.                 if(!orbToggle[1])
  12778.                     for(int i = 0; i < quickPrayers.length; i++) {
  12779.                         if(quickPrayers[i] == 1) {
  12780.                             sendPacket185((i * 2) + 25000,-1,169);
  12781.                         }
  12782.                     }
  12783.                 else
  12784.                     turnOffPrayers();
  12785.                 orbToggle[1] = !orbToggle[1];
  12786.             } else {
  12787.                 if(orbToggle[1]) {
  12788.                     turnOffPrayers();
  12789.                     orbToggle[1] = false;
  12790.                 } else {
  12791.                     pushMessage("You don't have any quick prayers selected.", 0, "");
  12792.                     pushMessage("Right-click the Prayer button next to the minimap to select some.", 0, "");
  12793.                 }
  12794.             }
  12795.         } else if(prayerInterfaceType == 22500) {
  12796.             if(getQuickCursesSet() > 0) {
  12797.                 if(!orbToggle[1])
  12798.                     for(int i = 0; i < quickCurses.length; i++) {
  12799.                         if(quickCurses[i] == 1) {
  12800.                             sendPacket185((i * 2) + 22503,-1,169);
  12801.                         }
  12802.                     }
  12803.                 else
  12804.                     turnOffCurses();
  12805.                 orbToggle[1] = !orbToggle[1];
  12806.             } else {
  12807.                 if(orbToggle[1]) {
  12808.                     turnOffCurses();
  12809.                     orbToggle[1] = false;
  12810.                 } else {
  12811.                     pushMessage("You don't have any quick curses selected.", 0, "");
  12812.                     pushMessage("Right-click the Curses button next to the minimap to select some.", 0, "");
  12813.                 }
  12814.             }
  12815.         }
  12816.     }
  12817.    
  12818.     private int getQuickPrayersSet() {
  12819.         int amount = 0;
  12820.         for(int i = 0; i < quickPrayers.length; i++)
  12821.             if(quickPrayers[i] == 1) {
  12822.                 amount++;
  12823.             }
  12824.         return amount;
  12825.     }
  12826.    
  12827.     private int getQuickCursesSet() {
  12828.         int amount = 0;
  12829.         for(int i = 0; i < quickCurses.length; i++)
  12830.             if(quickCurses[i] == 1) {
  12831.                 amount++;
  12832.             }
  12833.         return amount;
  12834.     }
  12835.    
  12836.     private void turnOffPrayers() {
  12837.         int toggle = -1;
  12838.         for(int i = 0; i < quickPrayers.length; i++) {
  12839.             RSInterface rsInterface = RSInterface.interfaceCache[(i * 2) + 25000];
  12840.             if(rsInterface.valueIndexArray != null && rsInterface.valueIndexArray[0][0] == 5) {
  12841.                 toggle = rsInterface.valueIndexArray[0][1];
  12842.                 if(variousSettings[toggle] == 1)
  12843.                     sendPacket185((i * 2) + 25000,-1,169);
  12844.             }
  12845.         }
  12846.     }
  12847.    
  12848.     private void turnOffCurses() {
  12849.         int toggle = -1;
  12850.         for(int i = 0; i < quickCurses.length; i++) {
  12851.             RSInterface rsInterface = RSInterface.interfaceCache[(i * 2) + 22503];
  12852.             if(rsInterface.valueIndexArray != null && rsInterface.valueIndexArray[0][0] == 5) {
  12853.                 toggle = rsInterface.valueIndexArray[0][1];
  12854.                 if(variousSettings[toggle] == 1)
  12855.                     sendPacket185((i * 2) + 22503,-1,169);
  12856.             }
  12857.         }
  12858.     }
  12859.    
  12860.     private void turnOffQuickTicks() {
  12861.         int toggle = -1;
  12862.         for(int i = 0; i < quickCurses.length; i++) {
  12863.             RSInterface rsInterface = RSInterface.interfaceCache[17202 + i];
  12864.             if(rsInterface.valueIndexArray != null && rsInterface.valueIndexArray[0][0] == 5) {
  12865.                 toggle = rsInterface.valueIndexArray[0][1];
  12866.                 if(variousSettings[toggle] == 1)
  12867.                     sendPacket185(17202 + i,-1,169);
  12868.             }
  12869.         }
  12870.     }
  12871.  
  12872.     public void toggleQuickAidsSelection() {
  12873.         boolean inProcess = (tabInterfaceIDs[5] == 17200 || tabInterfaceIDs[5] == 17234);
  12874.         if(inProcess)
  12875.             saveQuickSelection();
  12876.         else {
  12877.             if(prayerInterfaceType == 5608) {
  12878.                 if(!inProcess) {
  12879.                     tabInterfaceIDs[5] = 17200;
  12880.                     needDrawTabArea = true;
  12881.                     tabAreaAltered = true;
  12882.                 } else {
  12883.                     tabInterfaceIDs[5] = 5608;
  12884.                     needDrawTabArea = true;
  12885.                     tabAreaAltered = true;
  12886.                 }
  12887.             } else if(prayerInterfaceType == 22500) {
  12888.                 if(!inProcess) {
  12889.                     tabInterfaceIDs[5] = 17234;
  12890.                     needDrawTabArea = true;
  12891.                     tabAreaAltered = true;
  12892.                 } else {
  12893.                     tabInterfaceIDs[5] = 22500;
  12894.                     needDrawTabArea = true;
  12895.                     tabAreaAltered = true;
  12896.                 }
  12897.             }
  12898.             tabID = 5;
  12899.         }
  12900.     }
  12901.  
  12902.     public final int[] curseLevelRequirements = {50,50,52,54,56,59,62,65,68,71,74,76,78,80,82,84,86,89,92,95};
  12903.     public final String[] curseName = {
  12904.         "Protect Item", "Sap Warrior", "Sap Ranger", "Sap Mage", "Sap Spirit",
  12905.         "Berserker", "Deflect Summoning", "Deflect Magic","Deflect Missiles", "Deflect Melee",
  12906.         "Leech Attack", "Leech Ranged", "Leech Magic", "Leech Defence", "Leech Strength",
  12907.         "Leech Energy", "Leech Special Attack", "Wrath", "Soul Split", "Turmoil"
  12908.     };
  12909.     public int[] quickConfigIDs = {630,631,632,633,634,635,636,637,638,639,640,641,642,643,644,645,646,647,648,649,650,651,652,653,654,655,656};
  12910.     public final int[] prayerLevelRequirements = {1,4,7,8,9,10,13,16,19,22,25,26,27,28,31,34,37,40,43,44,45,46,49,52,60,70};
  12911.     public final String[] prayerName = {
  12912.         "Thick Skin", "Burst of Strength", "Clarity of Thought", "Sharp Eye", "Mystic Will", "Rock Skin", "Superhuman Strength", "Improved Reflexes","Rapid Restore",
  12913.         "Rapid Heal", "Protect Item", "Hawk Eye", "Mystic Lore", "Steel Skin", "Ultimate Strength", "Incredible Reflexes","Protect from Magic", "Protect from Missiles",
  12914.         "Protect from Melee","Eagle Eye", "Mystic Might", "Retribution", "Redemption", "Smite", "Chivalry", "Piety"
  12915.     };
  12916.     private int[] defPray = {0,5,13,24,25};
  12917.     private int[] strPray = {1,3,4,6,11,12,14,19,20,24,25};
  12918.     private int[] atkPray = {2,3,4,7,11,12,15,19,20,24,25};
  12919.     private int[] rangeAndMagePray = {3,4,11,12,19,20,24,25};
  12920.     private int[] rangeAndMagePrayOff = {1,2,3,4,6,7,11,12,14,15,19,20,24,25};
  12921.     private int[] headPray = {16,17,18,21,22,23};
  12922.     private int[] superiorPray = {0,1,2,3,4,5,6,7,11,12,13,14,15,19,20,24,25};
  12923.     private int[][] prayer = {defPray,strPray,atkPray,rangeAndMagePray,headPray};  
  12924.    
  12925.     private int[] getPrayerTypeForIndex(int index) {
  12926.         int[] type = null;
  12927.         for(int i = 0; i < prayer.length; i++) {
  12928.             for(int il = 0; il < prayer[i].length; il++) {
  12929.                 if(index == prayer[i][il]) {
  12930.                     type =  prayer[i];
  12931.                 }
  12932.             }
  12933.         }
  12934.         return type;
  12935.     }
  12936.    
  12937.     private int[] sapCurse = {1,2,3,4,19};
  12938.     private int[] leechCurse = {10,11,12,13,14,15,16,19};
  12939.     private int[] deflectCurse = {7,8,9,17,18};
  12940.    
  12941.     private int[] getCurseTypeForIndex(int index) {
  12942.         int[] types = null;
  12943.         for(int g = 0; g < leechCurse.length; g++) {
  12944.             if(index == leechCurse[g])
  12945.                 types = sapCurse;
  12946.         }
  12947.         for(int g = 0; g < sapCurse.length; g++) {
  12948.             if(index == sapCurse[g])
  12949.                 types = leechCurse;
  12950.         }
  12951.         for(int g = 0; g < deflectCurse.length; g++) {
  12952.             if(index == deflectCurse[g])
  12953.                 types = deflectCurse;
  12954.         }
  12955.         if(index == 6) {
  12956.             int[] type = {17,18};
  12957.             types = type;
  12958.         }
  12959.         if(index == 17 || index == 18) {
  12960.             int[] type = {6,7,8,9,17,18};
  12961.             types = type;
  12962.         }
  12963.         if(index == 19)  {
  12964.             int[] turmoilCurseOff = {1,2,3,4,10,11,12,13,14,15,16,19};
  12965.             types = turmoilCurseOff;
  12966.         }
  12967.         return types;
  12968.     }
  12969.    
  12970.     public void togglePrayerState(int button) {
  12971.         int index = button - 17202;
  12972.         if(prayerInterfaceType == 5608) {
  12973.             if(getOrbValues(1,null)[1] >= prayerLevelRequirements[index]) {
  12974.                 int[] types = getPrayerTypeForIndex(index);
  12975.                 if(types != null) {
  12976.                     for(int g = 0; g < rangeAndMagePray.length; g++) {
  12977.                         if(index == rangeAndMagePray[g]) {
  12978.                             types = rangeAndMagePrayOff;
  12979.                         }
  12980.                     }
  12981.                     for(int i = 0; i < types.length; i++) {
  12982.                         if(index != types[i]) {
  12983.                             if(index == 24 || index == 25) {
  12984.                                 types = superiorPray;
  12985.                             }
  12986.                             quickPrayers[types[i]] = 0;
  12987.                             variousSettings[quickConfigIDs[types[i]]] = 0;
  12988.                             method33(quickConfigIDs[types[i]]);
  12989.                             needDrawTabArea = true;
  12990.                             if(dialogID != -1)
  12991.                                 inputTaken = true;
  12992.                         } else {
  12993.                             quickPrayers[index] = (quickPrayers[index] + 1) % 2;
  12994.                             variousSettings[quickConfigIDs[index]] = quickPrayers[index];
  12995.                             method33(quickConfigIDs[index]);
  12996.                             needDrawTabArea = true;
  12997.                             if(dialogID != -1)
  12998.                                 inputTaken = true;
  12999.                         }
  13000.                     }
  13001.                 } else {
  13002.                     quickPrayers[index] = (quickPrayers[index] + 1) % 2;
  13003.                     variousSettings[quickConfigIDs[index]] = quickPrayers[index];
  13004.                     method33(quickConfigIDs[index]);
  13005.                     needDrawTabArea = true;
  13006.                     if(dialogID != -1)
  13007.                         inputTaken = true;
  13008.                 }
  13009.             } else {
  13010.                 pushMessage("You need a Prayer level of atleast " + prayerLevelRequirements[index] + " to use " + prayerName[index] + ".", 0, "");
  13011.             }
  13012.         } else if(prayerInterfaceType == 22500) {
  13013.             if(getOrbValues(1,null)[1] >= curseLevelRequirements[index]) {
  13014.                 int[] types = getCurseTypeForIndex(index);
  13015.                 if(types != null) {
  13016.                     for(int i = 0; i < types.length; i++) {
  13017.                         if(index != types[i]) {
  13018.                             quickCurses[types[i]] = 0;
  13019.                             variousSettings[quickConfigIDs[types[i]]] = 0;
  13020.                             method33(quickConfigIDs[types[i]]);
  13021.                             needDrawTabArea = true;
  13022.                             if(dialogID != -1)
  13023.                                 inputTaken = true;
  13024.                         }
  13025.                     }
  13026.                 }
  13027.                 quickCurses[index] = (quickCurses[index] + 1) % 2;
  13028.                 variousSettings[quickConfigIDs[index]] = quickCurses[index];
  13029.                 method33(quickConfigIDs[index]);
  13030.                 needDrawTabArea = true;
  13031.                 if(dialogID != -1)
  13032.                     inputTaken = true;
  13033.             } else {
  13034.                 pushMessage("You need a Prayer level of atleast " + curseLevelRequirements[index] + " to use " + curseName[index] + ".", 0, "");
  13035.             }
  13036.         }
  13037.     }
  13038.  
  13039.     public void sendFrame36(int id,int state) {
  13040.         anIntArray1045[id] = state;
  13041.         if(variousSettings[id] != state) {
  13042.             variousSettings[id] = state;
  13043.             method33(id);
  13044.             needDrawTabArea = true;
  13045.             if(dialogID != -1)
  13046.                 inputTaken = true;
  13047.         }
  13048.     }
  13049.  
  13050.     public void sendFrame219() {
  13051.         if(invOverlayInterfaceID != -1) {
  13052.             invOverlayInterfaceID = -1;
  13053.             needDrawTabArea = true;
  13054.             tabAreaAltered = true;
  13055.         }
  13056.         if(backDialogID != -1) {
  13057.             backDialogID = -1;
  13058.             inputTaken = true;
  13059.         }
  13060.         if(inputDialogState != 0) {
  13061.             inputDialogState = 0;
  13062.             inputTaken = true;
  13063.         }
  13064.         openInterfaceID = -1;
  13065.         aBoolean1149 = false;
  13066.     }
  13067.  
  13068.     public void sendFrame248(int interfaceID,int sideInterfaceID)   {
  13069.         if(backDialogID != -1) {
  13070.             backDialogID = -1;
  13071.             inputTaken = true;
  13072.         }
  13073.         if(inputDialogState != 0) {
  13074.             inputDialogState = 0;
  13075.             inputTaken = true;
  13076.         }
  13077.         openInterfaceID = interfaceID;
  13078.         invOverlayInterfaceID = sideInterfaceID;
  13079.         needDrawTabArea = true;
  13080.         tabAreaAltered = true;
  13081.         aBoolean1149 = false;
  13082.     }
  13083.  
  13084.     private int editedTextFrame = 0;
  13085.     private String newText = "";
  13086.     private boolean parsePacket() {
  13087.         if(socketStream == null)
  13088.             return false;
  13089.         try {
  13090.             int i = socketStream.available();
  13091.             if(i == 0)
  13092.                 return false;
  13093.             if(pktType == -1) {
  13094.                 socketStream.flushInputStream(inStream.buffer, 1);
  13095.                 pktType = inStream.buffer[0] & 0xff;
  13096.                 if(encryption != null)
  13097.                     pktType = pktType - encryption.getNextKey() & 0xff;
  13098.                 pktSize = SizeConstants.packetSizes[pktType];
  13099.                 i--;
  13100.             }
  13101.             if(pktSize == -1)
  13102.                 if(i > 0) {
  13103.                     socketStream.flushInputStream(inStream.buffer, 1);
  13104.                     pktSize = inStream.buffer[0] & 0xff;
  13105.                     i--;
  13106.                 } else {
  13107.                     return false;
  13108.                 }
  13109.             if(pktSize == -2)
  13110.                 if(i > 1) {
  13111.                     socketStream.flushInputStream(inStream.buffer, 2);
  13112.                     inStream.currentOffset = 0;
  13113.                     pktSize = inStream.readUnsignedWord();
  13114.                     i -= 2;
  13115.                 } else {
  13116.                     return false;
  13117.                 }
  13118.             if(i < pktSize)
  13119.                 return false;
  13120.             inStream.currentOffset = 0;
  13121.             socketStream.flushInputStream(inStream.buffer, pktSize);
  13122.             anInt1009 = 0;
  13123.             anInt843 = anInt842;
  13124.             anInt842 = anInt841;
  13125.             anInt841 = pktType;
  13126.             switch(pktType) {
  13127.                 case 81:
  13128.                     updatePlayers(pktSize, inStream);
  13129.                     if(openInterfaceID == 26000) {
  13130.                         sendFrame36(650,functionKeys ? 1 : 0);
  13131.                         sendFrame36(651,healthBars ? 1 : 0);
  13132.                         sendFrame36(652,newDamage ? 1 : 0);
  13133.                     }
  13134.                     sendFrame36(175,(openInterfaceID == 26000) ? 1 : 0);
  13135.                     sendFrame36(653,toggleFullscreen ? 1 : 0);
  13136.                     aBoolean1080 = false;
  13137.                     pktType = -1;
  13138.                     return true;
  13139.                    
  13140.                 case 176:
  13141.                     daysSinceRecovChange = inStream.method427();
  13142.                     unreadMessages = inStream.method435();
  13143.                     membersInt = inStream.readUnsignedByte();
  13144.                     anInt1193 = inStream.method440();
  13145.                     daysSinceLastLogin = inStream.readUnsignedWord();
  13146.                     if(anInt1193 != 0 && openInterfaceID == -1) {
  13147.                         signlink.dnslookup(TextClass.method586(anInt1193));
  13148.                         clearTopInterfaces();
  13149.                         char c = '\u028A';
  13150.                         if(daysSinceRecovChange != 201 || membersInt == 1)
  13151.                             c = '\u028F';
  13152.                         reportAbuseInput = "";
  13153.                         canMute = false;
  13154.                         canBan = false;
  13155.                         for(int k9 = 0; k9 < RSInterface.interfaceCache.length; k9++) {
  13156.                             if(RSInterface.interfaceCache[k9] == null || RSInterface.interfaceCache[k9].contentType != c)
  13157.                                 continue;
  13158.                             openInterfaceID = RSInterface.interfaceCache[k9].parentID;
  13159.                            
  13160.                         }
  13161.                     }
  13162.                     pktType = -1;
  13163.                     return true;
  13164.                    
  13165.                 case 64:
  13166.                     anInt1268 = inStream.method427();
  13167.                     anInt1269 = inStream.method428();
  13168.                     for(int j = anInt1268; j < anInt1268 + 8; j++) {
  13169.                         for(int l9 = anInt1269; l9 < anInt1269 + 8; l9++)
  13170.                             if(groundArray[plane][j][l9] != null) {
  13171.                                 groundArray[plane][j][l9] = null;
  13172.                                 spawnGroundItem(j, l9);
  13173.                             }
  13174.                     }
  13175.                     for(Class30_Sub1 class30_sub1 = (Class30_Sub1)aClass19_1179.reverseGetFirst(); class30_sub1 != null; class30_sub1 = (Class30_Sub1)aClass19_1179.reverseGetNext())
  13176.                         if(class30_sub1.anInt1297 >= anInt1268 && class30_sub1.anInt1297 < anInt1268 + 8 && class30_sub1.anInt1298 >= anInt1269 && class30_sub1.anInt1298 < anInt1269 + 8 && class30_sub1.anInt1295 == plane)
  13177.                             class30_sub1.anInt1294 = 0;
  13178.                     pktType = -1;
  13179.                     return true;
  13180.                    
  13181.                 case 185:
  13182.                     int k = inStream.method436();
  13183.                     RSInterface.interfaceCache[k].anInt233 = 3;
  13184.                     if(myPlayer.desc == null)
  13185.                         RSInterface.interfaceCache[k].mediaID = (myPlayer.anIntArray1700[0] << 25) + (myPlayer.anIntArray1700[4] << 20) + (myPlayer.equipment[0] << 15) + (myPlayer.equipment[8] << 10) + (myPlayer.equipment[11] << 5) + myPlayer.equipment[1];
  13186.                     else
  13187.                         RSInterface.interfaceCache[k].mediaID = (int)(0x12345678L + myPlayer.desc.type);
  13188.                     pktType = -1;
  13189.                     return true;
  13190.                    
  13191.                 /* Clan chat packet */
  13192.                 case 217:
  13193.                     try {
  13194.                         name = inStream.readString();
  13195.                         message = inStream.readString();
  13196.                         clanname = inStream.readString();
  13197.                         rights = inStream.readUnsignedWord();
  13198.                         //message = TextInput.processText(message);
  13199.                         //message = Censor.doCensor(message);
  13200.                         System.out.println(clanname);
  13201.                         pushMessage(message, 16, name);
  13202.                     } catch(Exception e) {
  13203.                         e.printStackTrace();
  13204.                     }
  13205.                     pktType = -1;
  13206.                     return true;
  13207.                    
  13208.                 case 107:
  13209.                     aBoolean1160 = false;
  13210.                     for(int l = 0; l < 5; l++)
  13211.                         aBooleanArray876[l] = false;
  13212.                     pktType = -1;
  13213.                     return true;
  13214.                    
  13215.                 case 72:
  13216.                     int i1 = inStream.method434();
  13217.                     RSInterface class9 = RSInterface.interfaceCache[i1];
  13218.                     for(int k15 = 0; k15 < class9.inv.length; k15++) {
  13219.                         class9.inv[k15] = -1;
  13220.                         class9.inv[k15] = 0;
  13221.                     }
  13222.                     pktType = -1;
  13223.                     return true;
  13224.                    
  13225.                 case 214:
  13226.                     ignoreCount = pktSize / 8;
  13227.                     for(int j1 = 0; j1 < ignoreCount; j1++)
  13228.                         ignoreListAsLongs[j1] = inStream.readQWord();
  13229.                     pktType = -1;
  13230.                     return true;
  13231.                    
  13232.                 case 166:
  13233.                     aBoolean1160 = true;
  13234.                     anInt1098 = inStream.readUnsignedByte();
  13235.                     anInt1099 = inStream.readUnsignedByte();
  13236.                     anInt1100 = inStream.readUnsignedWord();
  13237.                     anInt1101 = inStream.readUnsignedByte();
  13238.                     anInt1102 = inStream.readUnsignedByte();
  13239.                     if(anInt1102 >= 100) {
  13240.                         xCameraPos = anInt1098 * 128 + 64;
  13241.                         yCameraPos = anInt1099 * 128 + 64;
  13242.                         zCameraPos = method42(plane, yCameraPos, xCameraPos) - anInt1100;
  13243.                     }
  13244.                     pktType = -1;
  13245.                     return true;
  13246.                    
  13247.                 case 134:                  
  13248.                     needDrawTabArea = true;
  13249.                     int skillIndex = inStream.readUnsignedByte();
  13250.                     int i10 = inStream.method439();
  13251.                     int l15 = inStream.readUnsignedByte();
  13252.                     int xp = currentExp[skillIndex];
  13253.                     currentExp[skillIndex] = i10;
  13254.                     currentStats[skillIndex] = l15;
  13255.                     maxStats[skillIndex] = 1;
  13256.                     xpCounter += currentExp[skillIndex]-xp;
  13257.                     expAdded = currentExp[skillIndex]-xp;
  13258.                     for(int k20 = 0; k20 < 98; k20++)
  13259.                         if(i10 >= anIntArray1019[k20])
  13260.                             maxStats[skillIndex] = k20 + 2;
  13261.                     pktType = -1;
  13262.                     return true;
  13263.                    
  13264.                 case 71:
  13265.                     int l1 = inStream.readUnsignedWord();
  13266.                     int j10 = inStream.method426();
  13267.                     if(l1 == 65535)
  13268.                         l1 = -1;
  13269.                     if(j10 == 5) {
  13270.                         loadTickSelection = false;
  13271.                         if(orbToggle[1] && prayerInterfaceType != l1) {
  13272.                             turnOffPrayers();
  13273.                             turnOffCurses();
  13274.                             turnOffQuickTicks();
  13275.                             orbToggle[1] = !orbToggle[1];
  13276.                         }
  13277.                         prayerInterfaceType = l1;
  13278.                     }
  13279.                     tabInterfaceIDs[j10] = l1;
  13280.                     needDrawTabArea = true;
  13281.                     tabAreaAltered = true;
  13282.                     pktType = -1;
  13283.                     return true;
  13284.                    
  13285.                 case 74:
  13286.                     int i2 = inStream.method434();
  13287.                     if(i2 == 65535)
  13288.                         i2 = -1;
  13289.                     if(i2 != currentSong && musicEnabled && !lowMem && prevSong == 0) {
  13290.                         nextSong = i2;
  13291.                         songChanging = true;
  13292.                         onDemandFetcher.method558(2, nextSong);
  13293.                     }
  13294.                     currentSong = i2;
  13295.                     pktType = -1;
  13296.                     return true;
  13297.                    
  13298.                 case 121:
  13299.                     int j2 = inStream.method436();
  13300.                     int k10 = inStream.method435();
  13301.                     if(musicEnabled && !lowMem) {
  13302.                         nextSong = j2;
  13303.                         songChanging = false;
  13304.                         onDemandFetcher.method558(2, nextSong);
  13305.                         prevSong = k10;
  13306.                     }
  13307.                     pktType = -1;
  13308.                     return true;
  13309.                    
  13310.                 case 109:
  13311.                     resetLogout();
  13312.                     pktType = -1;
  13313.                     return false;
  13314.                    
  13315.                 case 70:
  13316.                     int k2 = inStream.readSignedWord();
  13317.                     int l10 = inStream.method437();
  13318.                     int i16 = inStream.method434();
  13319.                     RSInterface class9_5 = RSInterface.interfaceCache[i16];
  13320.                     class9_5.anInt263 = k2;
  13321.                     class9_5.anInt265 = l10;
  13322.                     pktType = -1;
  13323.                     return true;
  13324.                    
  13325.                 case 73:
  13326.                 case 241:
  13327.                     int l2 = anInt1069;
  13328.                     int i11 = anInt1070;
  13329.                     if(pktType == 73) {
  13330.                         l2 = inStream.method435();
  13331.                         i11 = inStream.readUnsignedWord();
  13332.                         aBoolean1159 = false;
  13333.                     }
  13334.                     if(pktType == 241) {
  13335.                         i11 = inStream.method435();
  13336.                         inStream.initBitAccess();
  13337.                         for(int j16 = 0; j16 < 4; j16++) {
  13338.                             for(int l20 = 0; l20 < 13; l20++) {
  13339.                                 for(int j23 = 0; j23 < 13; j23++) {
  13340.                                     int i26 = inStream.readBits(1);
  13341.                                     if(i26 == 1)
  13342.                                         anIntArrayArrayArray1129[j16][l20][j23] = inStream.readBits(26);
  13343.                                     else
  13344.                                         anIntArrayArrayArray1129[j16][l20][j23] = -1;
  13345.                                 }
  13346.                             }
  13347.                         }
  13348.                         inStream.finishBitAccess();
  13349.                         l2 = inStream.readUnsignedWord();
  13350.                         aBoolean1159 = true;
  13351.                     }
  13352.                     if(anInt1069 == l2 && anInt1070 == i11 && loadingStage == 2) {
  13353.                         pktType = -1;
  13354.                         return true;
  13355.                     }
  13356.                     anInt1069 = l2;
  13357.                     anInt1070 = i11;
  13358.                     baseX = (anInt1069 - 6) * 8;
  13359.                     baseY = (anInt1070 - 6) * 8;
  13360.                     aBoolean1141 = (anInt1069 / 8 == 48 || anInt1069 / 8 == 49) && anInt1070 / 8 == 48;
  13361.                     if(anInt1069 / 8 == 48 && anInt1070 / 8 == 148)
  13362.                         aBoolean1141 = true;
  13363.                     loadingStage = 1;
  13364.                     aLong824 = System.currentTimeMillis();
  13365.                     main3DArea.initDrawingArea();
  13366.                     normalFont.drawText(0, "Loading - please wait.", 151, 257);
  13367.                     normalFont.drawText(0xffffff, "Loading - please wait.", 150, 256);
  13368.                     main3DArea.drawGraphics(toggleFullscreen ? 0 : 4, super.graphics, toggleFullscreen ? 0 : 4);
  13369.                     if(pktType == 73) {
  13370.                         int k16 = 0;
  13371.                         for(int i21 = (anInt1069 - 6) / 8; i21 <= (anInt1069 + 6) / 8; i21++) {
  13372.                             for(int k23 = (anInt1070 - 6) / 8; k23 <= (anInt1070 + 6) / 8; k23++)
  13373.                                 k16++;
  13374.                         }
  13375.                         aByteArrayArray1183 = new byte[k16][];
  13376.                         aByteArrayArray1247 = new byte[k16][];
  13377.                         anIntArray1234 = new int[k16];
  13378.                         anIntArray1235 = new int[k16];
  13379.                         anIntArray1236 = new int[k16];
  13380.                         k16 = 0;
  13381.                         for(int l23 = (anInt1069 - 6) / 8; l23 <= (anInt1069 + 6) / 8; l23++) {
  13382.                             for(int j26 = (anInt1070 - 6) / 8; j26 <= (anInt1070 + 6) / 8; j26++) {
  13383.                                 anIntArray1234[k16] = (l23 << 8) + j26;
  13384.                                 if(aBoolean1141 && (j26 == 49 || j26 == 149 || j26 == 147 || l23 == 50 || l23 == 49 && j26 == 47)) {
  13385.                                     anIntArray1235[k16] = -1;
  13386.                                     anIntArray1236[k16] = -1;
  13387.                                     k16++;
  13388.                                 } else {
  13389.                                     int k28 = anIntArray1235[k16] = onDemandFetcher.method562(0, j26, l23);
  13390.                                     if(k28 != -1)
  13391.                                         onDemandFetcher.method558(3, k28);
  13392.                                     int j30 = anIntArray1236[k16] = onDemandFetcher.method562(1, j26, l23);
  13393.                                     if(j30 != -1)
  13394.                                         onDemandFetcher.method558(3, j30);
  13395.                                     k16++;
  13396.                                 }
  13397.                             }
  13398.                         }
  13399.                     }
  13400.                     if(pktType == 241) {
  13401.                         int l16 = 0;
  13402.                         int ai[] = new int[676];
  13403.                         for(int i24 = 0; i24 < 4; i24++) {
  13404.                             for(int k26 = 0; k26 < 13; k26++) {
  13405.                                 for(int l28 = 0; l28 < 13; l28++) {
  13406.                                     int k30 = anIntArrayArrayArray1129[i24][k26][l28];
  13407.                                     if(k30 != -1) {
  13408.                                         int k31 = k30 >> 14 & 0x3ff;
  13409.                                         int i32 = k30 >> 3 & 0x7ff;
  13410.                                         int k32 = (k31 / 8 << 8) + i32 / 8;
  13411.                                         for(int j33 = 0; j33 < l16; j33++) {
  13412.                                             if(ai[j33] != k32)
  13413.                                                 continue;
  13414.                                             k32 = -1;
  13415.                                            
  13416.                                         }
  13417.                                         if(k32 != -1)
  13418.                                             ai[l16++] = k32;
  13419.                                     }
  13420.                                 }
  13421.                             }
  13422.                         }
  13423.                         aByteArrayArray1183 = new byte[l16][];
  13424.                         aByteArrayArray1247 = new byte[l16][];
  13425.                         anIntArray1234 = new int[l16];
  13426.                         anIntArray1235 = new int[l16];
  13427.                         anIntArray1236 = new int[l16];
  13428.                         for(int l26 = 0; l26 < l16; l26++) {
  13429.                             int i29 = anIntArray1234[l26] = ai[l26];
  13430.                             int l30 = i29 >> 8 & 0xff;
  13431.                             int l31 = i29 & 0xff;
  13432.                             int j32 = anIntArray1235[l26] = onDemandFetcher.method562(0, l31, l30);
  13433.                             if(j32 != -1)
  13434.                                 onDemandFetcher.method558(3, j32);
  13435.                             int i33 = anIntArray1236[l26] = onDemandFetcher.method562(1, l31, l30);
  13436.                             if(i33 != -1)
  13437.                                 onDemandFetcher.method558(3, i33);
  13438.                         }
  13439.                     }
  13440.                     int i17 = baseX - anInt1036;
  13441.                     int j21 = baseY - anInt1037;
  13442.                     anInt1036 = baseX;
  13443.                     anInt1037 = baseY;
  13444.                     for(int j24 = 0; j24 < 16384; j24++) {
  13445.                         NPC npc = npcArray[j24];
  13446.                         if(npc != null) {
  13447.                             for(int j29 = 0; j29 < 10; j29++) {
  13448.                                 npc.smallX[j29] -= i17;
  13449.                                 npc.smallY[j29] -= j21;
  13450.                             }
  13451.                             npc.x -= i17 * 128;
  13452.                             npc.y -= j21 * 128;
  13453.                         }
  13454.                     }
  13455.                     for(int i27 = 0; i27 < maxPlayers; i27++) {
  13456.                         Player player = playerArray[i27];
  13457.                         if(player != null) {
  13458.                             for(int i31 = 0; i31 < 10; i31++) {
  13459.                                 player.smallX[i31] -= i17;
  13460.                                 player.smallY[i31] -= j21;
  13461.                             }
  13462.                             player.x -= i17 * 128;
  13463.                             player.y -= j21 * 128;
  13464.                         }
  13465.                     }
  13466.                     aBoolean1080 = true;
  13467.                     byte byte1 = 0;
  13468.                     byte byte2 = 104;
  13469.                     byte byte3 = 1;
  13470.                     if(i17 < 0) {
  13471.                         byte1 = 103;
  13472.                         byte2 = -1;
  13473.                         byte3 = -1;
  13474.                     }
  13475.                     byte byte4 = 0;
  13476.                     byte byte5 = 104;
  13477.                     byte byte6 = 1;
  13478.                     if(j21 < 0) {
  13479.                         byte4 = 103;
  13480.                         byte5 = -1;
  13481.                         byte6 = -1;
  13482.                     }
  13483.                     for(int k33 = byte1; k33 != byte2; k33 += byte3) {
  13484.                         for(int l33 = byte4; l33 != byte5; l33 += byte6) {
  13485.                             int i34 = k33 + i17;
  13486.                             int j34 = l33 + j21;
  13487.                             for(int k34 = 0; k34 < 4; k34++)
  13488.                                 if(i34 >= 0 && j34 >= 0 && i34 < 104 && j34 < 104)
  13489.                                     groundArray[k34][k33][l33] = groundArray[k34][i34][j34];
  13490.                                 else
  13491.                                     groundArray[k34][k33][l33] = null;
  13492.                         }
  13493.                     }
  13494.                     for(Class30_Sub1 class30_sub1_1 = (Class30_Sub1)aClass19_1179.reverseGetFirst(); class30_sub1_1 != null; class30_sub1_1 = (Class30_Sub1)aClass19_1179.reverseGetNext()) {
  13495.                         class30_sub1_1.anInt1297 -= i17;
  13496.                         class30_sub1_1.anInt1298 -= j21;
  13497.                         if(class30_sub1_1.anInt1297 < 0 || class30_sub1_1.anInt1298 < 0 || class30_sub1_1.anInt1297 >= 104 || class30_sub1_1.anInt1298 >= 104)
  13498.                             class30_sub1_1.unlink();
  13499.                     }
  13500.                     if(destX != 0) {
  13501.                         destX -= i17;
  13502.                         destY -= j21;
  13503.                     }
  13504.                     aBoolean1160 = false;
  13505.                     pktType = -1;
  13506.                     return true;
  13507.                    
  13508.                 case 208:
  13509.                     int i3 = inStream.method437();
  13510.                     if(i3 >= 0)
  13511.                         method60(i3);
  13512.                     walkableInterfaceID = i3;
  13513.                     pktType = -1;
  13514.                     return true;
  13515.                    
  13516.                 case 99:
  13517.                     minimapCover = inStream.readUnsignedByte();
  13518.                     pktType = -1;
  13519.                     return true;
  13520.                    
  13521.                 case 75:
  13522.                     int j3 = inStream.method436();
  13523.                     int j11 = inStream.method436();
  13524.                     RSInterface.interfaceCache[j11].anInt233 = 2;
  13525.                     RSInterface.interfaceCache[j11].mediaID = j3;
  13526.                     pktType = -1;
  13527.                     return true;
  13528.                    
  13529.                 case 114:
  13530.                     systemUpdatetime = inStream.method434() * 30;
  13531.                     pktType = -1;
  13532.                     return true;
  13533.                    
  13534.                 case 60:
  13535.                     anInt1269 = inStream.readUnsignedByte();
  13536.                     anInt1268 = inStream.method427();
  13537.                     while(inStream.currentOffset < pktSize) {
  13538.                         int k3 = inStream.readUnsignedByte();
  13539.                         method137(inStream, k3);
  13540.                     }
  13541.                     pktType = -1;
  13542.                     return true;
  13543.                    
  13544.                 case 35:
  13545.                     int l3 = inStream.readUnsignedByte();
  13546.                     int k11 = inStream.readUnsignedByte();
  13547.                     int j17 = inStream.readUnsignedByte();
  13548.                     int k21 = inStream.readUnsignedByte();
  13549.                     aBooleanArray876[l3] = true;
  13550.                     anIntArray873[l3] = k11;
  13551.                     anIntArray1203[l3] = j17;
  13552.                     anIntArray928[l3] = k21;
  13553.                     anIntArray1030[l3] = 0;
  13554.                     pktType = -1;
  13555.                     return true;
  13556.                    
  13557.                 case 174:
  13558.                     int i4 = inStream.readUnsignedWord();
  13559.                     int l11 = inStream.readUnsignedByte();
  13560.                     int k17 = inStream.readUnsignedWord();
  13561.                     if(aBoolean848 && !lowMem && anInt1062 < 50) {
  13562.                         anIntArray1207[anInt1062] = i4;
  13563.                         anIntArray1241[anInt1062] = l11;
  13564.                         anIntArray1250[anInt1062] = k17 + Sounds.anIntArray326[i4];
  13565.                         anInt1062++;
  13566.                     }
  13567.                     pktType = -1;
  13568.                     return true;
  13569.                    
  13570.                 case 104:
  13571.                     int j4 = inStream.method427();
  13572.                     int i12 = inStream.method426();
  13573.                     String s6 = inStream.readString();
  13574.                     if(j4 >= 1 && j4 <= 5) {
  13575.                         if(s6.equalsIgnoreCase("null"))
  13576.                             s6 = null;
  13577.                         atPlayerActions[j4 - 1] = s6;
  13578.                         atPlayerArray[j4 - 1] = i12 == 0;
  13579.                     }
  13580.                     pktType = -1;
  13581.                     return true;
  13582.                    
  13583.                 case 78:
  13584.                     destX = 0;
  13585.                     pktType = -1;
  13586.                     return true;
  13587.                    
  13588.                 case 253:
  13589.                     String s = inStream.readString();
  13590.                                         if(s.startsWith("Alert##")) {
  13591.                         String[] args = s.split("##");
  13592.                         if (args.length == 3) {
  13593.                             alertHandler.alert = new Alert("Notification", args[1], args[2]);
  13594.                         } else if (args.length == 4) {
  13595.                             alertHandler.alert = new Alert(args[1], args[2], args[3]);
  13596.                         }
  13597.                         pktType = -1;
  13598.                         return true;
  13599.                     }
  13600.                     if(s.toLowerCase().contains("oh dear you are dead!")) {
  13601.                         if(orbToggle[1]) {
  13602.                             turnOffPrayers();
  13603.                             turnOffCurses();
  13604.                             orbToggle[1] = false;
  13605.                         }
  13606.                     }
  13607.                     if(s.toLowerCase().contains("@autocastoff")) {
  13608.                         setAutoCastOff();
  13609.                         break;
  13610.                     }
  13611.                     if(s.toLowerCase().contains("you have been poisoned")) {
  13612.                         orbToggle[0] = true;
  13613.                     }
  13614.                     if(s.toLowerCase().contains("you are no longer poisoned") || s.toLowerCase().contains("your antipoison potion") || s.toLowerCase().contains("antidote")) {
  13615.                         System.out.println("s: " + s);
  13616.                         orbToggle[0] = false;
  13617.                     }
  13618.                     if(s.endsWith(":tradereq:")) {
  13619.                         String s3 = s.substring(0, s.indexOf(":"));
  13620.                         long l17 = TextClass.longForName(s3);
  13621.                         boolean flag2 = false;
  13622.                         for(int j27 = 0; j27 < ignoreCount; j27++) {
  13623.                             if(ignoreListAsLongs[j27] != l17)
  13624.                                 continue;
  13625.                             flag2 = true;
  13626.                            
  13627.                         }
  13628.                         if(!flag2 && anInt1251 == 0)
  13629.                             pushMessage("wishes to trade with you.", 4, s3);
  13630.                     } else if (s.endsWith(":ooo33:")) {
  13631.                         String s4 = s.substring(0, s.indexOf(":"));
  13632.                         long l18 = TextClass.longForName(s4);
  13633.                         pushMessage("Clan: ", 8, s4);  
  13634.                     } else if(s.endsWith("#url#")) {
  13635.                         String link = s.substring(0, s.indexOf("#"));
  13636.                         pushMessage("Join us at: ", 9, link);
  13637.                     } else if(s.startsWith("#010#")) {
  13638.                         shoutYell = s.substring(5);
  13639.                         nameYell = "";
  13640.                         if(s.contains("@cr1@"))
  13641.                             nameYell = "1";
  13642.                         if(s.contains("@cr2@"))
  13643.                             nameYell = "2";
  13644.                            
  13645.                         pushMessage(shoutYell, 16, nameYell);
  13646.                     } else if(s.contains("#link-") && s.endsWith("#")) {
  13647.                         int firstIndex = s.indexOf('-');
  13648.                         int lastIndex = s.lastIndexOf('#');
  13649.                         String link = s.substring(firstIndex + 1,lastIndex);
  13650.                         pushMessage(s.substring(0,s.indexOf('#')), 9, link);
  13651.                     } else if(s.endsWith(":duelreq:")) {
  13652.                         String s4 = s.substring(0, s.indexOf(":"));
  13653.                         long l18 = TextClass.longForName(s4);
  13654.                         boolean flag3 = false;
  13655.                         for(int k27 = 0; k27 < ignoreCount; k27++) {
  13656.                             if(ignoreListAsLongs[k27] != l18)
  13657.                                 continue;
  13658.                             flag3 = true;
  13659.                            
  13660.                         }
  13661.                         if(!flag3 && anInt1251 == 0)
  13662.                             pushMessage("wishes to duel with you.", 8, s4);
  13663.                     } else if(s.endsWith(":chalreq:")) {
  13664.                         String s5 = s.substring(0, s.indexOf(":"));
  13665.                         long l19 = TextClass.longForName(s5);
  13666.                         boolean flag4 = false;
  13667.                         for(int l27 = 0; l27 < ignoreCount; l27++) {
  13668.                             if(ignoreListAsLongs[l27] != l19)
  13669.                                 continue;
  13670.                             flag4 = true;
  13671.                            
  13672.                         }
  13673.                         if(!flag4 && anInt1251 == 0) {
  13674.                             String s8 = s.substring(s.indexOf(":") + 1, s.length() - 9);
  13675.                             pushMessage(s8, 8, s5);
  13676.                         }
  13677.                     } else {
  13678.                         pushMessage(s, 0, "");
  13679.                     }
  13680.                     pktType = -1;
  13681.                     return true;
  13682.                    
  13683.                 case 1:
  13684.                     for(int k4 = 0; k4 < playerArray.length; k4++)
  13685.                         if(playerArray[k4] != null)
  13686.                             playerArray[k4].anim = -1;
  13687.                     for(int j12 = 0; j12 < npcArray.length; j12++)
  13688.                         if(npcArray[j12] != null)
  13689.                             npcArray[j12].anim = -1;
  13690.                     pktType = -1;
  13691.                     return true;
  13692.                    
  13693.                 case 50:
  13694.                     long l4 = inStream.readQWord();
  13695.                     int i18 = inStream.readUnsignedByte();
  13696.                     String s7 = TextClass.fixName(TextClass.nameForLong(l4));
  13697.                     for(int k24 = 0; k24 < friendsCount; k24++) {
  13698.                         if(l4 != friendsListAsLongs[k24])
  13699.                             continue;
  13700.                         if(friendsNodeIDs[k24] != i18) {
  13701.                             friendsNodeIDs[k24] = i18;
  13702.                             needDrawTabArea = true;
  13703.                             if(i18 >= 2) {
  13704.                                 pushMessage(s7 + " has logged in.", 5, "");
  13705.                             }
  13706.                             if(i18 <= 1) {
  13707.                                 pushMessage(s7 + " has logged out.", 5, "");
  13708.                             }
  13709.                         }
  13710.                         s7 = null;
  13711.                        
  13712.                     }
  13713.                     if(s7 != null && friendsCount < 200) {
  13714.                         friendsListAsLongs[friendsCount] = l4;
  13715.                         friendsList[friendsCount] = s7;
  13716.                         friendsNodeIDs[friendsCount] = i18;
  13717.                         friendsCount++;
  13718.                         needDrawTabArea = true;
  13719.                     }
  13720.                     for(boolean flag6 = false; !flag6;) {
  13721.                         flag6 = true;
  13722.                         for(int k29 = 0; k29 < friendsCount - 1; k29++)
  13723.                             if(friendsNodeIDs[k29] != nodeID && friendsNodeIDs[k29 + 1] == nodeID || friendsNodeIDs[k29] == 0 && friendsNodeIDs[k29 + 1] != 0) {
  13724.                                 int j31 = friendsNodeIDs[k29];
  13725.                                 friendsNodeIDs[k29] = friendsNodeIDs[k29 + 1];
  13726.                                 friendsNodeIDs[k29 + 1] = j31;
  13727.                                 String s10 = friendsList[k29];
  13728.                                 friendsList[k29] = friendsList[k29 + 1];
  13729.                                 friendsList[k29 + 1] = s10;
  13730.                                 long l32 = friendsListAsLongs[k29];
  13731.                                 friendsListAsLongs[k29] = friendsListAsLongs[k29 + 1];
  13732.                                 friendsListAsLongs[k29 + 1] = l32;
  13733.                                 needDrawTabArea = true;
  13734.                                 flag6 = false;
  13735.                             }
  13736.                     }
  13737.                     pktType = -1;
  13738.                     return true;
  13739.                    
  13740.                 case 110:
  13741.                     if(tabID == 12)
  13742.                         needDrawTabArea = true;
  13743.                     energy = inStream.readUnsignedByte();
  13744.                     pktType = -1;
  13745.                     return true;
  13746.                    
  13747.                 case 254:
  13748.                     hintType = inStream.readUnsignedByte();
  13749.                     if(hintType == 1)
  13750.                         hintArrowNPCID = inStream.readUnsignedWord();
  13751.                     if(hintType >= 2 && hintType <= 6) {
  13752.                         if(hintType == 2) {
  13753.                             anInt937 = 64;
  13754.                             anInt938 = 64;
  13755.                         }
  13756.                         if(hintType == 3) {
  13757.                             anInt937 = 0;
  13758.                             anInt938 = 64;
  13759.                         }
  13760.                         if(hintType == 4) {
  13761.                             anInt937 = 128;
  13762.                             anInt938 = 64;
  13763.                         }
  13764.                         if(hintType == 5) {
  13765.                             anInt937 = 64;
  13766.                             anInt938 = 0;
  13767.                         }
  13768.                         if(hintType == 6) {
  13769.                             anInt937 = 64;
  13770.                             anInt938 = 128;
  13771.                         }
  13772.                         hintType = 2;
  13773.                         hintArrowX = inStream.readUnsignedWord();
  13774.                         hintArrowY = inStream.readUnsignedWord();
  13775.                         anInt936 = inStream.readUnsignedByte();
  13776.                     }
  13777.                     if(hintType == 10)
  13778.                         hintArrowPlayerID = inStream.readUnsignedWord();
  13779.                     pktType = -1;
  13780.                     return true;
  13781.                    
  13782.                 case 248:
  13783.                     int i5 = inStream.method435();
  13784.                     int k12 = inStream.readUnsignedWord();
  13785.                     if(backDialogID != -1) {
  13786.                         backDialogID = -1;
  13787.                         inputTaken = true;
  13788.                     }
  13789.                     if(inputDialogState != 0) {
  13790.                         inputDialogState = 0;
  13791.                         inputTaken = true;
  13792.                     }
  13793.                     openInterfaceID = i5;
  13794.                     invOverlayInterfaceID = k12;
  13795.                     needDrawTabArea = true;
  13796.                     tabAreaAltered = true;
  13797.                     aBoolean1149 = false;
  13798.                     pktType = -1;
  13799.                     return true;
  13800.                    
  13801.                 case 79:
  13802.                     int j5 = inStream.method434();
  13803.                     int l12 = inStream.method435();
  13804.                     RSInterface class9_3 = RSInterface.interfaceCache[j5];
  13805.                     if(class9_3 != null && class9_3.type == 0) {
  13806.                         if(l12 < 0)
  13807.                             l12 = 0;
  13808.                         if(l12 > class9_3.scrollMax - class9_3.height)
  13809.                             l12 = class9_3.scrollMax - class9_3.height;
  13810.                         class9_3.scrollPosition = l12;
  13811.                     }
  13812.                     pktType = -1;
  13813.                     return true;
  13814.                    
  13815.                 case 68:
  13816.                     for(int k5 = 0; k5 < variousSettings.length; k5++)
  13817.                         if(variousSettings[k5] != anIntArray1045[k5]) {
  13818.                             variousSettings[k5] = anIntArray1045[k5];
  13819.                             method33(k5);
  13820.                             needDrawTabArea = true;
  13821.                         }
  13822.                     pktType = -1;
  13823.                     return true;
  13824.                    
  13825.                 case 196:
  13826.                     long longForName = inStream.readQWord();
  13827.                     int j18 = inStream.readDWord();
  13828.                     int rights = inStream.readUnsignedByte();
  13829.                     boolean flag5 = false;
  13830.                     if(rights <= 1) {
  13831.                         for(int l29 = 0; l29 < ignoreCount; l29++) {
  13832.                             if(ignoreListAsLongs[l29] != longForName)
  13833.                                 continue;
  13834.                             flag5 = true;
  13835.                            
  13836.                         }
  13837.                     }
  13838.                     if(!flag5 && anInt1251 == 0)
  13839.                         try {
  13840.                             anIntArray1240[anInt1169] = j18;
  13841.                             anInt1169 = (anInt1169 + 1) % 100;
  13842.                             String s9 = TextInput.method525(pktSize - 13, inStream);
  13843.                             //if(rights != 3)
  13844.                                 //s9 = Censor.doCensor(s9);
  13845.                             if(rights != 0)
  13846.                                 pushMessage(s9, 7, "@cr" + rights + "@" + TextClass.fixName(TextClass.nameForLong(longForName)));
  13847.                             else
  13848.                                 pushMessage(s9, 3, TextClass.fixName(TextClass.nameForLong(longForName)));
  13849.                         } catch(Exception exception1) {
  13850.                             signlink.reporterror("cde1");
  13851.                         }
  13852.                     pktType = -1;
  13853.                     return true;
  13854.                    
  13855.                 case 85:
  13856.                     anInt1269 = inStream.method427();
  13857.                     anInt1268 = inStream.method427();
  13858.                     pktType = -1;
  13859.                     return true;
  13860.                    
  13861.                 case 24:
  13862.                     tabIconFlash = inStream.method428();
  13863.                     if(tabIconFlash == tabID) {
  13864.                         if(tabIconFlash == 3)
  13865.                             tabID = 1;
  13866.                         else
  13867.                             tabID = 3;
  13868.                         needDrawTabArea = true;
  13869.                     }
  13870.                     pktType = -1;
  13871.                     return true;
  13872.                    
  13873.                 case 246:
  13874.                     int frameId = inStream.method434();
  13875.                     int zoom = inStream.readUnsignedWord();
  13876.                     int itemId = inStream.readUnsignedWord();
  13877.                     if(itemId == 65535) {
  13878.                         RSInterface.interfaceCache[frameId].anInt233 = 0;
  13879.                         pktType = -1;
  13880.                         return true;
  13881.                     } else {
  13882.                         ItemDef itemDef = ItemDef.forID(itemId);
  13883.                         RSInterface.interfaceCache[frameId].anInt233 = 4;
  13884.                         RSInterface.interfaceCache[frameId].mediaID = itemId;
  13885.                         RSInterface.interfaceCache[frameId].modelRotation1 = itemDef.modelRotation1;
  13886.                         RSInterface.interfaceCache[frameId].modelRotation2 = itemDef.modelRotation2;
  13887.                         RSInterface.interfaceCache[frameId].modelZoom = (itemDef.modelZoom * 100) / zoom;
  13888.                         pktType = -1;
  13889.                         return true;
  13890.                     }
  13891.                    
  13892.                 case 171:
  13893.                     boolean flag1 = inStream.readUnsignedByte() == 1;
  13894.                     int j13 = inStream.readUnsignedWord();
  13895.                     RSInterface.interfaceCache[j13].isMouseoverTriggered = flag1;
  13896.                     pktType = -1;
  13897.                     return true;
  13898.                    
  13899.                 case 142:
  13900.                     int j6 = inStream.method434();
  13901.                     method60(j6);
  13902.                     if(backDialogID != -1) {
  13903.                         backDialogID = -1;
  13904.                         inputTaken = true;
  13905.                     }
  13906.                     if(inputDialogState != 0) {
  13907.                         inputDialogState = 0;
  13908.                         inputTaken = true;
  13909.                     }
  13910.                     invOverlayInterfaceID = j6;
  13911.                     needDrawTabArea = true;
  13912.                     tabAreaAltered = true;
  13913.                     openInterfaceID = -1;
  13914.                     aBoolean1149 = false;
  13915.                     pktType = -1;
  13916.                     return true;
  13917.                    
  13918.                 case 126:
  13919.                                     newText = inStream.readString();
  13920.                     String text = newText;
  13921.                     editedTextFrame = inStream.method435();
  13922.                     int frame = editedTextFrame;
  13923.                 if (text.startsWith(":mp3:")) {
  13924.                             String[] args = text.split(":mp3:");
  13925.                             MP3 mp3 = new MP3("signlink.findcachedir()/Mp3/"+args[1]+".mp3");
  13926.                             mp3.play();
  13927.                         pktType = -1;
  13928.                         return true;
  13929.                     }
  13930.                     if (text.startsWith("www.")) {
  13931.                         launchURL(text);
  13932.                         pktType = -1;
  13933.                         return true;
  13934.                     }
  13935.                     if(text.startsWith("full"))
  13936.                     {
  13937.                         String[] args = text.split(" ");
  13938.                         int id1 = Integer.parseInt(args[1]);
  13939.                         int id2 = Integer.parseInt(args[2]);
  13940.                         fullscreenInterfaceID = id1;
  13941.                         openInterfaceID = id2;
  13942.                         pktType = -1;
  13943.                         return true;
  13944.                     }
  13945.                     updateStrings(text, frame);
  13946.                     sendFrame126(text, frame);
  13947.                     if (frame >= 18144 && frame <= 18244) {
  13948.                         clanList[frame - 18144] = text;
  13949.                     }
  13950.                     pktType = -1;
  13951.                     return true;
  13952.                    
  13953.                 case 206:
  13954.                     publicChatMode = inStream.readUnsignedByte();
  13955.                     privateChatMode = inStream.readUnsignedByte();
  13956.                     tradeMode = inStream.readUnsignedByte();
  13957.                     aBoolean1233 = true;
  13958.                     inputTaken = true;
  13959.                     pktType = -1;
  13960.                     return true;
  13961.                    
  13962.                 case 240:
  13963.                     if(tabID == 12)
  13964.                         needDrawTabArea = true;
  13965.                     weight = inStream.readSignedWord();
  13966.                     pktType = -1;
  13967.                     return true;
  13968.                    
  13969.                 case 8:
  13970.                     int k6 = inStream.method436();
  13971.                     int l13 = inStream.readUnsignedWord();
  13972.                     RSInterface.interfaceCache[k6].anInt233 = 1;
  13973.                     RSInterface.interfaceCache[k6].mediaID = l13;
  13974.                     pktType = -1;
  13975.                     return true;
  13976.                    
  13977.                 case 122:
  13978.                     int l6 = inStream.method436();
  13979.                     int i14 = inStream.method436();
  13980.                     int i19 = i14 >> 10 & 0x1f;
  13981.                     int i22 = i14 >> 5 & 0x1f;
  13982.                     int l24 = i14 & 0x1f;
  13983.                     RSInterface.interfaceCache[l6].textColor = (i19 << 19) + (i22 << 11) + (l24 << 3);
  13984.                     pktType = -1;
  13985.                     return true;
  13986.                    
  13987.                 case 53:
  13988.                     needDrawTabArea = true;
  13989.                     int i7 = inStream.readUnsignedWord();
  13990.                     RSInterface class9_1 = RSInterface.interfaceCache[i7];
  13991.                     int j19 = inStream.readUnsignedWord();
  13992.                     for(int j22 = 0; j22 < j19; j22++) {
  13993.                         int i25 = inStream.readUnsignedByte();
  13994.                         if(i25 == 255)
  13995.                             i25 = inStream.method440();
  13996.                         class9_1.inv[j22] = inStream.method436();
  13997.                         class9_1.invStackSizes[j22] = i25;
  13998.                     }
  13999.                     for(int j25 = j19; j25 < class9_1.inv.length; j25++) {
  14000.                         class9_1.inv[j25] = 0;
  14001.                         class9_1.invStackSizes[j25] = 0;
  14002.                     }
  14003.                     pktType = -1;
  14004.                     return true;
  14005.                    
  14006.                 case 230:
  14007.                     int j7 = inStream.method435();
  14008.                     int j14 = inStream.readUnsignedWord();
  14009.                     int k19 = inStream.readUnsignedWord();
  14010.                     int k22 = inStream.method436();
  14011.                     RSInterface.interfaceCache[j14].modelRotation1 = k19;
  14012.                     RSInterface.interfaceCache[j14].modelRotation2 = k22;
  14013.                     RSInterface.interfaceCache[j14].modelZoom = j7;
  14014.                     pktType = -1;
  14015.                     return true;
  14016.                    
  14017.                 case 221:
  14018.                     anInt900 = inStream.readUnsignedByte();
  14019.                     needDrawTabArea = true;
  14020.                     pktType = -1;
  14021.                     return true;
  14022.                    
  14023.                 case 177:
  14024.                     aBoolean1160 = true;
  14025.                     anInt995 = inStream.readUnsignedByte();
  14026.                     anInt996 = inStream.readUnsignedByte();
  14027.                     anInt997 = inStream.readUnsignedWord();
  14028.                     anInt998 = inStream.readUnsignedByte();
  14029.                     anInt999 = inStream.readUnsignedByte();
  14030.                     if(anInt999 >= 100) {
  14031.                         int k7 = anInt995 * 128 + 64;
  14032.                         int k14 = anInt996 * 128 + 64;
  14033.                         int i20 = method42(plane, k14, k7) - anInt997;
  14034.                         int l22 = k7 - xCameraPos;
  14035.                         int k25 = i20 - zCameraPos;
  14036.                         int j28 = k14 - yCameraPos;
  14037.                         int i30 = (int)Math.sqrt(l22 * l22 + j28 * j28);
  14038.                         yCameraCurve = (int)(Math.atan2(k25, i30) * 325.94900000000001D) & 0x7ff;
  14039.                         xCameraCurve = (int)(Math.atan2(l22, j28) * -325.94900000000001D) & 0x7ff;
  14040.                         if(yCameraCurve < 128)
  14041.                             yCameraCurve = 128;
  14042.                         if(yCameraCurve > 383)
  14043.                             yCameraCurve = 383;
  14044.                     }
  14045.                     pktType = -1;
  14046.                     return true;
  14047.                    
  14048.                 case 249:
  14049.                     anInt1046 = inStream.method426();
  14050.                     unknownInt10 = inStream.method436();
  14051.                     pktType = -1;
  14052.                     return true;
  14053.                    
  14054.                 case 65:
  14055.                     updateNPCs(inStream, pktSize);
  14056.                     pktType = -1;
  14057.                     return true;
  14058.                    
  14059.                 case 27:
  14060.                     messagePromptRaised = false;
  14061.                     inputDialogState = 1;
  14062.                     amountOrNameInput = "";
  14063.                     inputTaken = true;
  14064.                     pktType = -1;
  14065.                     return true;
  14066.                    
  14067.                 case 187:
  14068.                     messagePromptRaised = false;
  14069.                     inputDialogState = 2;
  14070.                     amountOrNameInput = "";
  14071.                     inputTaken = true;
  14072.                     pktType = -1;
  14073.                     return true;
  14074.                    
  14075.                 case 97:
  14076.                     int l7 = inStream.readUnsignedWord();
  14077.                     method60(l7);
  14078.                     if(invOverlayInterfaceID != -1) {
  14079.                         invOverlayInterfaceID = -1;
  14080.                         needDrawTabArea = true;
  14081.                         tabAreaAltered = true;
  14082.                     }
  14083.                     if(backDialogID != -1) {
  14084.                         backDialogID = -1;
  14085.                         inputTaken = true;
  14086.                     }
  14087.                     if(inputDialogState != 0) {
  14088.                         inputDialogState = 0;
  14089.                         inputTaken = true;
  14090.                     }
  14091.                     openInterfaceID = l7;
  14092.                     aBoolean1149 = false;
  14093.                     pktType = -1;
  14094.                     return true;
  14095.                    
  14096.                 case 218:
  14097.                     int i8 = inStream.method438();
  14098.                     dialogID = i8;
  14099.                     inputTaken = true;
  14100.                     pktType = -1;
  14101.                     return true;
  14102.                    
  14103.                 case 87:
  14104.                     int j8 = inStream.method434();
  14105.                     int l14 = inStream.method439();
  14106.                     anIntArray1045[j8] = l14;
  14107.                     if(variousSettings[j8] != l14) {
  14108.                         variousSettings[j8] = l14;
  14109.                         method33(j8);
  14110.                         needDrawTabArea = true;
  14111.                         if(dialogID != -1)
  14112.                             inputTaken = true;
  14113.                     }
  14114.                     pktType = -1;
  14115.                     return true;
  14116.                    
  14117.                 case 36:
  14118.                     int k8 = inStream.method434();
  14119.                     byte byte0 = inStream.readSignedByte();
  14120.                     anIntArray1045[k8] = byte0;
  14121.                     if(k8 == 152) {//running
  14122.                         if(byte0 == 1)
  14123.                             orbToggle[2] = true;
  14124.                         else
  14125.                             orbToggle[2] = false;
  14126.                     }
  14127.                     if(variousSettings[k8] != byte0) {
  14128.                         variousSettings[k8] = byte0;
  14129.                         method33(k8);
  14130.                         needDrawTabArea = true;
  14131.                         if(dialogID != -1)
  14132.                             inputTaken = true;
  14133.                     }
  14134.                     pktType = -1;
  14135.                     return true;
  14136.                    
  14137.                 case 61:
  14138.                     displayOverLayIcon = inStream.readUnsignedByte();
  14139.                     pktType = -1;
  14140.                     return true;
  14141.                    
  14142.                 case 200:
  14143.                     int l8 = inStream.readUnsignedWord();
  14144.                     int i15 = inStream.readSignedWord();
  14145.                     RSInterface class9_4 = RSInterface.interfaceCache[l8];
  14146.                     class9_4.anInt257 = i15;
  14147.                     if(i15 == -1) {
  14148.                         class9_4.anInt246 = 0;
  14149.                         class9_4.anInt208 = 0;
  14150.                     }
  14151.                     pktType = -1;
  14152.                     return true;
  14153.                    
  14154.                 case 219:
  14155.                     if(invOverlayInterfaceID != -1) {
  14156.                         invOverlayInterfaceID = -1;
  14157.                         needDrawTabArea = true;
  14158.                         tabAreaAltered = true;
  14159.                     }
  14160.                     if(backDialogID != -1) {
  14161.                         backDialogID = -1;
  14162.                         inputTaken = true;
  14163.                     }
  14164.                     if(inputDialogState != 0) {
  14165.                         inputDialogState = 0;
  14166.                         inputTaken = true;
  14167.                     }
  14168.                     openInterfaceID = -1;
  14169.                     aBoolean1149 = false;
  14170.                     pktType = -1;
  14171.                     return true;
  14172.                    
  14173.                 case 34:
  14174.                     needDrawTabArea = true;
  14175.                     int i9 = inStream.readUnsignedWord();
  14176.                     RSInterface class9_2 = RSInterface.interfaceCache[i9];
  14177.                     while(inStream.currentOffset < pktSize) {
  14178.                         int j20 = inStream.method422();
  14179.                         int i23 = inStream.readUnsignedWord();
  14180.                         int l25 = inStream.readUnsignedByte();
  14181.                         if(l25 == 255)
  14182.                             l25 = inStream.readDWord();
  14183.                         if(j20 >= 0 && j20 < class9_2.inv.length) {
  14184.                             class9_2.inv[j20] = i23;
  14185.                             class9_2.invStackSizes[j20] = l25;
  14186.                         }
  14187.                     }
  14188.                     pktType = -1;
  14189.                     return true;
  14190.                    
  14191.                 case 4:
  14192.                 case 44:
  14193.                 case 84:
  14194.                 case 101:
  14195.                 case 105:
  14196.                 case 117:
  14197.                 case 147:
  14198.                 case 151:
  14199.                 case 156:
  14200.                 case 160:
  14201.                 case 215:
  14202.                     method137(inStream, pktType);
  14203.                     pktType = -1;
  14204.                     return true;
  14205.                    
  14206.                 case 106:
  14207.                     tabID = inStream.method427();
  14208.                     needDrawTabArea = true;
  14209.                     tabAreaAltered = true;
  14210.                     pktType = -1;
  14211.                     return true;
  14212.                    
  14213.                 case 164:
  14214.                     int j9 = inStream.method434();
  14215.                     method60(j9);
  14216.                     if(invOverlayInterfaceID != -1) {
  14217.                         invOverlayInterfaceID = -1;
  14218.                         needDrawTabArea = true;
  14219.                         tabAreaAltered = true;
  14220.                     }
  14221.                     backDialogID = j9;
  14222.                     inputTaken = true;
  14223.                     openInterfaceID = -1;
  14224.                     aBoolean1149 = false;
  14225.                     pktType = -1;
  14226.                     return true;
  14227.                 case 123:
  14228.                     pktType = -1;
  14229.                     return true;
  14230.             }
  14231.             signlink.reporterror("T1 - " + pktType + "," + pktSize + " - " + anInt842 + "," + anInt843);
  14232.             //resetLogout();
  14233.         } catch(IOException _ex) {
  14234.             dropClient();
  14235.         } catch(Exception exception) {
  14236.             String s2 = "T2 - " + pktType + "," + anInt842 + "," + anInt843 + " - " + pktSize + "," + (baseX + myPlayer.smallX[0]) + "," + (baseY + myPlayer.smallY[0]) + " - ";
  14237.             for(int j15 = 0; j15 < pktSize && j15 < 50; j15++)
  14238.                 s2 = s2 + inStream.buffer[j15] + ",";
  14239.             signlink.reporterror(s2);
  14240.             if(pktType == 126) {
  14241.                 System.out.println("Text editing packet send, but cant be received");
  14242.                 System.out.println("ID:"+editedTextFrame+", text:"+newText+"");
  14243.             }
  14244.         }
  14245.         pktType = -1;
  14246.         return true;
  14247.     }
  14248.  
  14249.     private void method146() {
  14250.         anInt1265++;
  14251.         method47(true);
  14252.         method26(true);
  14253.         method47(false);
  14254.         method26(false);
  14255.         method55();
  14256.         method104();
  14257.         if(!aBoolean1160) {
  14258.             int i = anInt1184;
  14259.             if(anInt984 / 256 > i)
  14260.                 i = anInt984 / 256;
  14261.             if(aBooleanArray876[4] && anIntArray1203[4] + 128 > i)
  14262.                 i = anIntArray1203[4] + 128;
  14263.             int k = compassRotation + anInt896 & 0x7ff;
  14264.             setCameraPos(600 + i * (toggleFullscreen ? 2 : 3), i, anInt1014, method42(plane, myPlayer.y, myPlayer.x) - 50, k, anInt1015);
  14265.         }
  14266.         int j;
  14267.         if(!aBoolean1160)
  14268.             j = method120();
  14269.         else
  14270.             j = method121();
  14271.         int l = xCameraPos;
  14272.         int i1 = zCameraPos;
  14273.         int j1 = yCameraPos;
  14274.         int k1 = yCameraCurve;
  14275.         int l1 = xCameraCurve;
  14276.         for(int i2 = 0; i2 < 5; i2++)
  14277.             if(aBooleanArray876[i2]) {
  14278.                 int j2 = (int)((Math.random() * (double)(anIntArray873[i2] * 2 + 1) - (double)anIntArray873[i2]) + Math.sin((double)anIntArray1030[i2] * ((double)anIntArray928[i2] / 100D)) * (double)anIntArray1203[i2]);
  14279.                 if(i2 == 0)
  14280.                     xCameraPos += j2;
  14281.                 if(i2 == 1)
  14282.                     zCameraPos += j2;
  14283.                 if(i2 == 2)
  14284.                     yCameraPos += j2;
  14285.                 if(i2 == 3)
  14286.                     xCameraCurve = xCameraCurve + j2 & 0x7ff;
  14287.                 if(i2 == 4) {
  14288.                     yCameraCurve += j2;
  14289.                     if(yCameraCurve < 128)
  14290.                         yCameraCurve = 128;
  14291.                     if(yCameraCurve > 383)
  14292.                         yCameraCurve = 383;
  14293.                 }
  14294.             }
  14295.         int k2 = Texture.anInt1481;
  14296.         Model.aBoolean1684 = true;
  14297.         Model.anInt1687 = 0;
  14298.         Model.anInt1685 = super.mouseX - (toggleFullscreen ? 0 : 4);
  14299.         Model.anInt1686 = super.mouseY - (toggleFullscreen ? 0 : 4);
  14300.         DrawingArea.setAllPixelsToZero();
  14301.         DrawingArea.drawPixels(getScreenHeight(), 0, 0, 0xC8C0A8, getScreenWidth());
  14302.         worldController.method313(xCameraPos, yCameraPos, xCameraCurve, zCameraPos, j, yCameraCurve);
  14303.         worldController.clearObj5Cache();
  14304.         updateEntities();
  14305.         drawHeadIcon();
  14306.         method37(k2);
  14307.         draw3dScreen();
  14308.         drawGameFrameOnFullScreen();
  14309.         main3DArea.drawGraphics(toggleFullscreen ? 0 : 4, super.graphics, toggleFullscreen ? 0 : 4);
  14310.         xCameraPos = l;
  14311.         zCameraPos = i1;
  14312.         yCameraPos = j1;
  14313.         yCameraCurve = k1;
  14314.         xCameraCurve = l1;
  14315.     }
  14316.  
  14317.     public void clearTopInterfaces() {
  14318.         stream.createFrame(130);
  14319.         if (invOverlayInterfaceID != -1) {
  14320.             invOverlayInterfaceID = -1;
  14321.             needDrawTabArea = true;
  14322.             aBoolean1149 = false;
  14323.             tabAreaAltered = true;
  14324.         }
  14325.         if (backDialogID != -1) {
  14326.             backDialogID = -1;
  14327.             inputTaken = true;
  14328.             aBoolean1149 = false;
  14329.         }
  14330.         openInterfaceID = -1;
  14331.         fullscreenInterfaceID = -1;
  14332.     }
  14333.  
  14334.     public client() {
  14335.     alertHandler = new AlertHandler(this);
  14336.         inventoryStones = new Sprite[3];
  14337.         tabSpace = ((getScreenWidth() - 765) >= 246*2);
  14338.         mapBack = new Background[5];
  14339.         tabIDHover = -1;
  14340.         tabAreaSprite = new Sprite[2];
  14341.         linkInText = "";
  14342.         chatArea = new Sprite[3];
  14343.         tabArea = new Sprite[2];
  14344.         XPcounterSprite = new Sprite[5];
  14345.         fullscreenInterfaceID = -1;
  14346.         chatRights = new int[500];
  14347.         chatTypeView = 0;
  14348.         clanChatMode = 0;
  14349.         cButtonHPos = -1;
  14350.         cButtonHCPos = -1;
  14351.         cButtonCPos = 0;
  14352.         WhatWorldIsWhatIp();
  14353.         handleStupidWorldSwitch();
  14354.                 world = 1;
  14355.                 spec = " Regular World";
  14356.                 serverip = "unperfectpvp.no-ip.biz";
  14357.                 port = 43594;
  14358.                 signlink.setuid();
  14359.         anIntArrayArray825 = new int[104][104];
  14360.         friendsNodeIDs = new int[200];
  14361.         groundArray = new NodeList[4][104][104];
  14362.         aBoolean831 = false;
  14363.         aStream_834 = new Stream(new byte[5000]);
  14364.         npcArray = new NPC[16384];
  14365.         npcIndices = new int[16384];
  14366.         anIntArray840 = new int[1000];
  14367.         aStream_847 = Stream.create();
  14368.         aBoolean848 = true;
  14369.         openInterfaceID = -1;
  14370.         currentExp = new int[Skills.skillsCount];
  14371.         aBoolean872 = false;
  14372.         anIntArray873 = new int[5];
  14373.         anInt874 = -1;
  14374.         aBooleanArray876 = new boolean[5];
  14375.         drawFlames = false;
  14376.         reportAbuseInput = "";
  14377.         unknownInt10 = -1;
  14378.         contextMenuOpen = false;
  14379.         inputString = "";
  14380.         maxPlayers = 2048;
  14381.         myPlayerIndex = 2047;
  14382.         playerArray = new Player[40000];
  14383.         playerIndices = new int[maxPlayers];
  14384.         anIntArray894 = new int[maxPlayers];
  14385.         aStreamArray895s = new Stream[maxPlayers];
  14386.         anInt897 = 1;
  14387.         anIntArrayArray901 = new int[104][104];
  14388.         anInt902 = 0x766654;
  14389.         aByteArray912 = new byte[16384];
  14390.         currentStats = new int[Skills.skillsCount];
  14391.         ignoreListAsLongs = new long[100];
  14392.         loadingError = false;
  14393.         anInt927 = 0x332d25;
  14394.         anIntArray928 = new int[5];
  14395.         anIntArrayArray929 = new int[104][104];
  14396.         chatTypes = new int[500];
  14397.         chatNames = new String[500];
  14398.         chatMessages = new String[500];
  14399.         chatButtons = new Sprite[4];
  14400.         sideIcons = new Sprite[15];
  14401.         aBoolean954 = true;
  14402.         friendsListAsLongs = new long[200];
  14403.         currentSong = -1;
  14404.         drawingFlames = false;
  14405.         spriteDrawX = -1;
  14406.         spriteDrawY = -1;
  14407.         compassPixelCutLeft = new int[33];
  14408.         anIntArray969 = new int[256];
  14409.         decompressors = new Decompressor[5];
  14410.         variousSettings = new int[2000];
  14411.         aBoolean972 = false;
  14412.         anInt975 = 50;
  14413.         anIntArray976 = new int[anInt975];
  14414.         anIntArray977 = new int[anInt975];
  14415.         anIntArray978 = new int[anInt975];
  14416.         anIntArray979 = new int[anInt975];
  14417.         anIntArray980 = new int[anInt975];
  14418.         anIntArray981 = new int[anInt975];
  14419.         anIntArray982 = new int[anInt975];
  14420.         aStringArray983 = new String[anInt975];
  14421.         anInt985 = -1;
  14422.         hitMarkBacks = new Sprite[6][2][3];//6 types,2 shades,3 parts
  14423.         hitMarkIcons = new Sprite[20];
  14424.         anIntArray990 = new int[6];
  14425.         aBoolean994 = false;
  14426.         anInt1002 = 0x23201b;
  14427.         amountOrNameInput = "";
  14428.         aClass19_1013 = new NodeList();
  14429.         aBoolean1017 = false;
  14430.         walkableInterfaceID = -1;
  14431.         anIntArray1030 = new int[5];
  14432.         aBoolean1031 = false;
  14433.         mapFunctions = new Sprite[100];
  14434.         dialogID = -1;
  14435.         maxStats = new int[Skills.skillsCount];
  14436.         anIntArray1045 = new int[2000];
  14437.         aBoolean1047 = true;
  14438.         mapImagePixelCutLeft = new int[miniMapHeight - mapPaddingFromTop];
  14439.         mapImagePixelCutRight = new int[miniMapHeight - mapPaddingFromTop];
  14440.         tabIconFlash = -1;
  14441.         aClass19_1056 = new NodeList();
  14442.         compassPixelCutRight = new int[33];
  14443.         aClass9_1059 = new RSInterface();
  14444.         mapScenes = new Background[100];
  14445.         barFillColor = 0x4d4233;
  14446.         anIntArray1065 = new int[7];
  14447.         mapFunctionX = new int[1000];
  14448.         mapFunctionY = new int[1000];
  14449.         aBoolean1080 = false;
  14450.         friendsList = new String[200];
  14451.         inStream = Stream.create();
  14452.         expectedCRCs = new int[9];
  14453.         menuActionCmd2 = new int[500];
  14454.         menuActionCmd3 = new int[500];
  14455.         menuActionID = new int[500];
  14456.         menuActionCmd1 = new int[500];
  14457.         headIcons = new Sprite[20];
  14458.         cursesIcons = new Sprite[20];
  14459.         skullIcons = new Sprite[20];
  14460.         headIconsHint = new Sprite[20];
  14461.         tabAreaAltered = false;
  14462.         aString1121 = "";
  14463.         atPlayerActions = new String[5];
  14464.         atPlayerArray = new boolean[5];
  14465.         anIntArrayArrayArray1129 = new int[4][13][13];
  14466.         anInt1132 = 2;
  14467.         currentMapFunctions = new Sprite[1000];
  14468.         aBoolean1141 = false;
  14469.         aBoolean1149 = false;
  14470.         crosses = new Sprite[8];
  14471.         musicEnabled = true;
  14472.         needDrawTabArea = false;
  14473.         loggedIn = false;
  14474.         canMute = false;
  14475.         canBan = false;
  14476.         aBoolean1159 = false;
  14477.         aBoolean1160 = false;
  14478.         mapAmtCounterZoom = 1;
  14479.         myUsername = "";
  14480.         myPassword = "";
  14481.         genericLoadingError = false;
  14482.         reportAbuseInterfaceID = -1;
  14483.         aClass19_1179 = new NodeList();
  14484.         anInt1184 = 128;
  14485.         invOverlayInterfaceID = -1;
  14486.         stream = Stream.create();
  14487.         menuActionName = new String[500];
  14488.         anIntArray1203 = new int[5];
  14489.         anIntArray1207 = new int[50];
  14490.         mapAmtCounterRotation = 2;
  14491.         chatScrollTotalLength = 78;
  14492.         promptInput = "";
  14493.         modIcons = new Background[3];
  14494.         tabID = 3;
  14495.         inputTaken = false;
  14496.         songChanging = true;
  14497.         aClass11Array1230 = new Class11[4];
  14498.         aBoolean1233 = false;
  14499.         anIntArray1240 = new int[100];
  14500.         anIntArray1241 = new int[50];
  14501.         aBoolean1242 = false;
  14502.         anIntArray1250 = new int[50];
  14503.         rsAlreadyLoaded = false;
  14504.         welcomeScreenRaised = false;
  14505.         messagePromptRaised = false;
  14506.         loginMessage1 = "";
  14507.         loginMessage2 = "Enter your username & password.";
  14508.         backDialogID = -1;
  14509.         anInt1279 = 2;
  14510.         bigX = new int[4000];
  14511.         bigY = new int[4000];
  14512.         anInt1289 = -1;
  14513.     }
  14514.  
  14515.     private Sprite HPBarFull;
  14516.     private Sprite HPBarEmpty;
  14517.         private boolean[] screenHover = {
  14518.     false,false, false, false  
  14519.     };
  14520.     private Sprite loginBox;
  14521.     private Sprite loginBoxHover;
  14522.     private Sprite loginHover;
  14523.     private Sprite loginHoverWorld;
  14524.     public int rights;
  14525.     private Background titleBox;
  14526.     private Sprite boxHover;
  14527.     private Background titleButton;
  14528.     public String name;
  14529.     public String message;
  14530.     public String clanname;
  14531.     private final int[] chatRights;
  14532.     public int chatTypeView;
  14533.     public int clanChatMode;
  14534.     public int duelMode;
  14535.     /* Declare custom sprites */
  14536.     public Sprite backgroundFix;
  14537.     private Sprite loadingBarFull;
  14538.     private Sprite loadingBarEmpty;
  14539.     private Sprite emptyOrb;
  14540.     private Sprite emptyFOrb;
  14541.     private Sprite hoveredEmpty;
  14542.     private Sprite hoveredFEmpty;
  14543.     private Sprite runIcon1;
  14544.     private Sprite runIcon2;
  14545.     private Sprite runOrb1;
  14546.     private Sprite runOrb2;
  14547.     private Sprite hitPointsFill;
  14548.     private Sprite hitPointsIcon;
  14549.     private Sprite prayerFill;
  14550.     private Sprite prayerIcon;
  14551.     private Sprite[] chatArea;
  14552.     private Sprite[] chatButtons;
  14553.     private Sprite[] tabArea;
  14554.     private Sprite mapArea;
  14555.     /**/
  14556.     private Sprite[] tabAreaSprite;
  14557.     private RSImageProducer leftFrame;
  14558.     private RSImageProducer topFrame;
  14559.     private RSImageProducer rightFrame;
  14560.     private int ignoreCount;
  14561.     private long aLong824;
  14562.     private int[][] anIntArrayArray825;
  14563.     private int[] friendsNodeIDs;
  14564.     private NodeList[][][] groundArray;
  14565.     private int[] anIntArray828;
  14566.     private int[] anIntArray829;
  14567.     private volatile boolean aBoolean831;
  14568.     private Socket aSocket832;
  14569.     private int loginScreenState;
  14570.     private Stream aStream_834;
  14571.     private NPC[] npcArray;
  14572.     private int npcCount;
  14573.     private int[] npcIndices;
  14574.     private int anInt839;
  14575.     private int[] anIntArray840;
  14576.     private int anInt841;
  14577.     private int anInt842;
  14578.     private int anInt843;
  14579.     private String aString844;
  14580.     private int privateChatMode;
  14581.     private Stream aStream_847;
  14582.     private boolean aBoolean848;
  14583.     private static int anInt849;
  14584.     private int[] anIntArray850;
  14585.     private int[] anIntArray851;
  14586.     private int[] anIntArray852;
  14587.     private int[] anIntArray853;
  14588.     private static int anInt854;
  14589.     private int hintType;
  14590.     public static int openInterfaceID;
  14591.     private int xCameraPos;
  14592.     private int zCameraPos;
  14593.     private int yCameraPos;
  14594.     private int yCameraCurve;
  14595.     private int xCameraCurve;
  14596.     private int myPrivilege;
  14597.     private final int[] currentExp;
  14598.     private Sprite mapFlag;
  14599.     private Sprite mapMarker;
  14600.     private boolean aBoolean872;
  14601.     private final int[] anIntArray873;
  14602.     private int anInt874;
  14603.     private final boolean[] aBooleanArray876;
  14604.     private int weight;
  14605.     private MouseDetection mouseDetection;
  14606.     private volatile boolean drawFlames;
  14607.     private String reportAbuseInput;
  14608.     private int unknownInt10;
  14609.     private boolean contextMenuOpen;
  14610.     private int hoverChildId;
  14611.     private String inputString;
  14612.     private final int maxPlayers;
  14613.     private final int myPlayerIndex;
  14614.     private Player[] playerArray;
  14615.     private int playerCount;
  14616.     private int[] playerIndices;
  14617.     private int anInt893;
  14618.     private int[] anIntArray894;
  14619.     private Stream[] aStreamArray895s;
  14620.     private int anInt896;
  14621.     private int anInt897;
  14622.     private int friendsCount;
  14623.     private int anInt900;
  14624.     private int[][] anIntArrayArray901;
  14625.     private final int anInt902;
  14626.     private byte[] aByteArray912;
  14627.     private int anInt913;
  14628.     private int crossX;
  14629.     private int crossY;
  14630.     private int crossIndex;
  14631.     private int crossType;
  14632.     private int plane;
  14633.     private final int[] currentStats;
  14634.     private static int anInt924;
  14635.     private final long[] ignoreListAsLongs;
  14636.     private boolean loadingError;
  14637.     private final int anInt927;
  14638.     private final int[] anIntArray928;
  14639.     private int[][] anIntArrayArray929;
  14640.     private Sprite aClass30_Sub2_Sub1_Sub1_931;
  14641.     private Sprite aClass30_Sub2_Sub1_Sub1_932;
  14642.     private int hintArrowPlayerID;
  14643.     private int hintArrowX;
  14644.     private int hintArrowY;
  14645.     private int anInt936;
  14646.     private int anInt937;
  14647.     private int anInt938;
  14648.     private static int anInt940;
  14649.     private final int[] chatTypes;
  14650.     private final String[] chatNames;
  14651.     private final String[] chatMessages;
  14652.     private int anInt945;
  14653.     private WorldController worldController;
  14654.     private Sprite[] sideIcons;
  14655.     private int menuScreenArea;
  14656.     private int menuOffsetX;
  14657.     private int menuOffsetY;
  14658.     private int menuWidth;
  14659.     private int menuHeight;
  14660.     private long aLong953;
  14661.     private boolean aBoolean954;
  14662.     private long[] friendsListAsLongs;
  14663.     private String[] clanList = new String[100];
  14664.     private int currentSong;
  14665.     private static int nodeID = 10;
  14666.     static int portOff;
  14667.     static boolean clientData;
  14668.     private static boolean isMembers = true;
  14669.     private static boolean lowMem;
  14670.     private volatile boolean drawingFlames;
  14671.     private int spriteDrawX;
  14672.     private int spriteDrawY;
  14673.     private final int[] anIntArray965 = {
  14674.         0xffff00, 0xff0000, 65280, 65535, 0xff00ff, 0xffffff
  14675.     };
  14676.     private Background aBackground_966;
  14677.     private Background aBackground_967;
  14678.     private final int[] compassPixelCutLeft;
  14679.     private final int[] anIntArray969;
  14680.     final Decompressor[] decompressors;
  14681.     public int variousSettings[];
  14682.     private boolean aBoolean972;
  14683.     private final int anInt975;
  14684.     private final int[] anIntArray976;
  14685.     private final int[] anIntArray977;
  14686.     private final int[] anIntArray978;
  14687.     private final int[] anIntArray979;
  14688.     private final int[] anIntArray980;
  14689.     private final int[] anIntArray981;
  14690.     private final int[] anIntArray982;
  14691.     private final String[] aStringArray983;
  14692.     private int anInt984;
  14693.     private int anInt985;
  14694.     private static int anInt986;
  14695.     private Sprite[][][] hitMarkBacks;
  14696.     private Sprite[] hitMarkIcons;
  14697.     private int anInt988;
  14698.     private int anInt989;
  14699.     private final int[] anIntArray990;
  14700.     private static boolean aBoolean993;
  14701.     private final boolean aBoolean994;
  14702.     private int anInt995;
  14703.     private int anInt996;
  14704.     private int anInt997;
  14705.     private int anInt998;
  14706.     private int anInt999;
  14707.     private ISAACRandomGen encryption;
  14708.     private Sprite mapEdge;
  14709.     private Sprite multiOverlay;
  14710.     private final int anInt1002;
  14711.     static final int[][] anIntArrayArray1003 = {
  14712.         {
  14713.             6798, 107, 10283, 16, 4797, 7744, 5799, 4634, 33697, 22433,
  14714.             2983, 54193
  14715.         }, {
  14716.             8741, 12, 64030, 43162, 7735, 8404, 1701, 38430, 24094, 10153,
  14717.             56621, 4783, 1341, 16578, 35003, 25239
  14718.         }, {
  14719.             25238, 8742, 12, 64030, 43162, 7735, 8404, 1701, 38430, 24094,
  14720.             10153, 56621, 4783, 1341, 16578, 35003
  14721.         }, {
  14722.             4626, 11146, 6439, 12, 4758, 10270
  14723.         }, {
  14724.             4550, 4537, 5681, 5673, 5790, 6806, 8076, 4574
  14725.         }
  14726.     };
  14727.     private int tabIDHover;
  14728.     private String amountOrNameInput;
  14729.     private static int anInt1005;
  14730.     private int daysSinceLastLogin;
  14731.     private int pktSize;
  14732.     private int pktType;
  14733.     private int anInt1009;
  14734.     private int anInt1010;
  14735.     private int anInt1011;
  14736.     private NodeList aClass19_1013;
  14737.     private int anInt1014;
  14738.     private int anInt1015;
  14739.     private int anInt1016;
  14740.     private boolean aBoolean1017;
  14741.     private int walkableInterfaceID;
  14742.     private static final int[] anIntArray1019;
  14743.     private int minimapCover;
  14744.     private int anInt1022;
  14745.     private int loadingStage;
  14746.     private Sprite[] scrollBar = new Sprite[8];
  14747.     private Sprite[] scrollArrow = new Sprite[4];
  14748.     private Sprite rightFrameSprite;
  14749.     private int lastHoverChildId;
  14750.     private Background backBase1;
  14751.     private Background backBase2;
  14752.     private Background backHmid1;
  14753.     private final int[] anIntArray1030;
  14754.     private boolean aBoolean1031;
  14755.     private Sprite[] mapFunctions;
  14756.     private int baseX;
  14757.     private int baseY;
  14758.     private int anInt1036;
  14759.     private int anInt1037;
  14760.     private int loginFailures;
  14761.     private int anInt1039;
  14762.     private int anInt1040;
  14763.     private int anInt1041;
  14764.     private int dialogID;
  14765.     private final int[] maxStats;
  14766.     private final int[] anIntArray1045;
  14767.     private int anInt1046;
  14768.     private boolean aBoolean1047;
  14769.     private int anInt1048;
  14770.     private String aString1049;
  14771.     private static int anInt1051;
  14772.     public final int[] mapImagePixelCutLeft;
  14773.     private StreamLoader titleStreamLoader;
  14774.     private int tabIconFlash;
  14775.     private int displayOverLayIcon;
  14776.     private NodeList aClass19_1056;
  14777.     private final int[] compassPixelCutRight;
  14778.     public final RSInterface aClass9_1059;
  14779.     private Background[] mapScenes;
  14780.     private static int anInt1061;
  14781.     private int anInt1062;
  14782.     private final int barFillColor;
  14783.     private int friendsListAction;
  14784.     private final int[] anIntArray1065;
  14785.     private int mouseInvInterfaceIndex;
  14786.     private int lastActiveInvInterface;
  14787.     private OnDemandFetcher onDemandFetcher;
  14788.     private int anInt1069;
  14789.     private int anInt1070;
  14790.     private int totalMapFunctions;
  14791.     private int[] mapFunctionX;
  14792.     private int[] mapFunctionY;
  14793.     private Sprite mapDotItem;
  14794.     private Sprite mapDotNPC;
  14795.     private Sprite mapDotPlayer;
  14796.     private Sprite mapDotFriend;
  14797.     private Sprite mapDotTeam;
  14798.     private Sprite mapDotClan;
  14799.     private int anInt1079;
  14800.     private boolean aBoolean1080;
  14801.     private String[] friendsList;
  14802.     private Stream inStream;
  14803.     private int anInt1084;
  14804.     private int anInt1085;
  14805.     private int activeInterfaceType;
  14806.     private int anInt1087;
  14807.     private int anInt1088;
  14808.     public static int anInt1089;
  14809.     private final int[] expectedCRCs;
  14810.     private int[] menuActionCmd2;
  14811.     private int[] menuActionCmd3;
  14812.     public int[] menuActionID;
  14813.     private int[] menuActionCmd1;
  14814.     private Sprite[] headIcons;
  14815.     private Sprite[] cursesIcons;
  14816.     private Sprite[] skullIcons;
  14817.     private Sprite[] headIconsHint;
  14818.     private static int anInt1097;
  14819.     private int anInt1098;
  14820.     private int anInt1099;
  14821.     private int anInt1100;
  14822.     private int anInt1101;
  14823.     private int anInt1102;
  14824.     private static boolean tabAreaAltered;
  14825.     private int systemUpdatetime;
  14826.     private RSImageProducer aRSImageProducer_1107;
  14827.     private RSImageProducer aRSImageProducer_1108;
  14828.     private RSImageProducer aRSImageProducer_1109;
  14829.     private RSImageProducer aRSImageProducer_1110;
  14830.     private RSImageProducer aRSImageProducer_1111;
  14831.     private RSImageProducer aRSImageProducer_1112;
  14832.     private RSImageProducer aRSImageProducer_1113;
  14833.     private RSImageProducer aRSImageProducer_1114;
  14834.     private RSImageProducer aRSImageProducer_1115;
  14835.     private static int anInt1117;
  14836.     private int membersInt;
  14837.     private String aString1121;
  14838.     private Sprite compass;
  14839.     private RSImageProducer aRSImageProducer_1123;
  14840.     private RSImageProducer aRSImageProducer_1124;
  14841.     private RSImageProducer aRSImageProducer_1125;
  14842.     public static Player myPlayer;
  14843.     private final String[] atPlayerActions;
  14844.     private final boolean[] atPlayerArray;
  14845.     private final int[][][] anIntArrayArrayArray1129;
  14846.     public static final int[] tabInterfaceIDs = {
  14847.         -1, -1, -1, -1, -1, -1, -1, -1,
  14848.         -1, -1, -1, -1, -1, -1, -1, -1,
  14849.         -1, -1, -1
  14850.     };
  14851.     private int anInt1131;
  14852.     private int anInt1132;
  14853.     public int menuActionRow;
  14854.     private static int anInt1134;
  14855.     private int spellSelected;
  14856.     private int anInt1137;
  14857.     private int spellUsableOn;
  14858.     private String spellTooltip;
  14859.     private Sprite[] currentMapFunctions;
  14860.     private boolean aBoolean1141;
  14861.     private static int anInt1142;
  14862.     private int energy;
  14863.     private boolean aBoolean1149;
  14864.     private Sprite[] crosses;
  14865.     private boolean musicEnabled;
  14866.     private Background[] aBackgroundArray1152s;
  14867.     private static boolean needDrawTabArea;
  14868.     private int unreadMessages;
  14869.     private static int anInt1155;
  14870.     private static boolean fpsOn;
  14871.     public boolean loggedIn;
  14872.     private boolean canMute;
  14873.     private boolean canBan;
  14874.     private boolean aBoolean1159;
  14875.     private boolean aBoolean1160;
  14876.     static int loopCycle;
  14877.     private static final String validUserPassChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!\"\243$%^&*()-_=+[{]};:'@#~,<.>/?\\| ";
  14878.     private RSImageProducer sideTabArea;
  14879.     private RSImageProducer mapEdgeIP;
  14880.     private RSImageProducer mapBackImage;
  14881.     private RSImageProducer main3DArea;
  14882.     private RSImageProducer chatBackImage;
  14883.     private int daysSinceRecovChange;
  14884.     private RSSocket socketStream;
  14885.     private int anInt1169;
  14886.     private int mapAmtDiffZoom;
  14887.     private int mapAmtCounterZoom;
  14888.     private long aLong1172;
  14889.     private String myUsername;
  14890.     private String myPassword;
  14891.     private static int anInt1175;
  14892.     private boolean genericLoadingError;
  14893.     private final int[] anIntArray1177 = {
  14894.         0, 0, 0, 0, 1, 1, 1, 1, 1, 2,
  14895.         2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  14896.         2, 2, 3
  14897.     };
  14898.     private boolean tabSpace;
  14899.     private int mapHover;
  14900.     private int advisorHover;
  14901.     private int exitHover;
  14902.     private int reportAbuseInterfaceID;
  14903.     private NodeList aClass19_1179;
  14904.     private int[] anIntArray1180;
  14905.     private int[] anIntArray1181;
  14906.     private int[] anIntArray1182;
  14907.     private byte[][] aByteArrayArray1183;
  14908.     private int anInt1184;
  14909.     private int compassRotation;
  14910.     private int anInt1186;
  14911.     private int anInt1187;
  14912.     private static int anInt1188;
  14913.     private int invOverlayInterfaceID;
  14914.     private int[] anIntArray1190;
  14915.     private int[] anIntArray1191;
  14916.     private Stream stream;
  14917.     private int anInt1193;
  14918.     private int splitPrivateChat;
  14919.     private Background[] mapBack;
  14920.     public String[] menuActionName;
  14921.     private Sprite aClass30_Sub2_Sub1_Sub1_1201;
  14922.     private Sprite aClass30_Sub2_Sub1_Sub1_1202;
  14923.     private final int[] anIntArray1203;
  14924.     private String nameYell = "", shoutYell = "";
  14925.     static final int[] anIntArray1204 = {
  14926.         9104, 10275, 7595, 3610, 7975, 8526, 918, 38802, 24466, 10145,
  14927.         58654, 5027, 1457, 16565, 34991, 25486
  14928.     };
  14929.     private Sprite[] inventoryStones;
  14930.     private static boolean flagged;
  14931.     private final int[] anIntArray1207;
  14932.     private int anInt1208;
  14933.     private int mapAmtDiffRotation;
  14934.     private int mapAmtCounterRotation;
  14935.     public static int chatScrollTotalLength;
  14936.     private String promptInput;
  14937.     private int anInt1213;
  14938.     private int[][][] intGroundArray;
  14939.     private long aLong1215;
  14940.     private int loginScreenCursorPos;
  14941.     private final Background[] modIcons;
  14942.     private long aLong1220;
  14943.     public static int tabID;
  14944.     private int hintArrowNPCID;
  14945.     public static boolean inputTaken;
  14946.     private int inputDialogState;
  14947.     private static int anInt1226;
  14948.     private int nextSong;
  14949.     private boolean songChanging;
  14950.     private final int[] mapImagePixelCutRight;
  14951.     private Class11[] aClass11Array1230;
  14952.     public static int anIntArray1232[];
  14953.     private boolean aBoolean1233;
  14954.     private int[] anIntArray1234;
  14955.     private int[] anIntArray1235;
  14956.     private int[] anIntArray1236;
  14957.     private int anInt1237;
  14958.     private int anInt1238;
  14959.     public final int anInt1239 = 100;
  14960.     private final int[] anIntArray1240;
  14961.     private final int[] anIntArray1241;
  14962.     private boolean aBoolean1242;
  14963.     private int atInventoryLoopCycle;
  14964.     private int atInventoryInterface;
  14965.     private int atInventoryIndex;
  14966.     private int atInventoryInterfaceType;
  14967.     private byte[][] aByteArrayArray1247;
  14968.     private int tradeMode;
  14969.     private int anInt1249;
  14970.     private final int[] anIntArray1250;
  14971.     private int anInt1251;
  14972.     private final boolean rsAlreadyLoaded;
  14973.     private int anInt1253;
  14974.     private int mapTimedProcessCounter;
  14975.     private boolean welcomeScreenRaised;
  14976.     private boolean messagePromptRaised;
  14977.     private int anInt1257;
  14978.     private byte[][][] byteGroundArray;
  14979.     private int prevSong;
  14980.     private int destX;
  14981.     private int destY;
  14982.     private Sprite miniMapImage;
  14983.     private int anInt1264;
  14984.     private int anInt1265;
  14985.     private String loginMessage1;
  14986.     private String loginMessage2;
  14987.     private int anInt1268;
  14988.     private int anInt1269;
  14989.     public TextDrawingArea smallFont;
  14990.     public TextDrawingArea normalFont;
  14991.     public TextDrawingArea boldFont;
  14992.     public TextDrawingArea fancyFont, bigHit, smallHit;
  14993.     private int anInt1275;
  14994.     private int backDialogID;
  14995.     private int anInt1278;
  14996.     private int anInt1279;
  14997.     private int[] bigX;
  14998.     private int[] bigY;
  14999.     private int itemSelected;
  15000.     private int itemSlotUsedOn;
  15001.     private int anInt1284;
  15002.     private int anInt1285;
  15003.     private String selectedItemName;
  15004.     private int publicChatMode;
  15005.     private static int anInt1288;
  15006.     private int anInt1289;
  15007.     public static int anInt1290;
  15008.     public boolean runClicked = false;
  15009.     public int drawCount;
  15010.     public int fullscreenInterfaceID;
  15011.     public int anInt1044;//377
  15012.     public int lastHoverToggleChildId;//377
  15013.     public int hoverToggleChildId;//377
  15014.     public int anInt1500;//377
  15015.     public Sprite infinityIcon;
  15016.     public int anInt1501;//377
  15017.     public int[] fullScreenTextureArray;
  15018.     private boolean counterOn, xpLock;
  15019.     private boolean summoningAttack;
  15020.     private int xpAddedPos, expAdded, xpCounter;
  15021.     private Sprite[] XPcounterSprite;
  15022.     private Sprite[] exitButton = new Sprite[3];
  15023.     private Sprite[] worldMapIcon = new Sprite[2];;
  15024.     private Sprite[] advisorButton = new Sprite[3];
  15025.     private String linkInText;
  15026.     private int prayerInterfaceType;
  15027.     private String newPasswordString = "";
  15028.     public void resetAllImageProducers() {
  15029.         if (super.fullGameScreen != null) {
  15030.             return;
  15031.         }
  15032.         chatBackImage = null;
  15033.         mapBackImage = null;
  15034.         sideTabArea = null;
  15035.         main3DArea = null;
  15036.         aRSImageProducer_1123 = null;
  15037.         aRSImageProducer_1124 = null;
  15038.         aRSImageProducer_1125 = null;
  15039.         aRSImageProducer_1107 = null;
  15040.         aRSImageProducer_1108 = null;
  15041.         aRSImageProducer_1109 = null;
  15042.         aRSImageProducer_1110 = null;
  15043.         aRSImageProducer_1111 = null;
  15044.         aRSImageProducer_1112 = null;
  15045.         aRSImageProducer_1113 = null;
  15046.         aRSImageProducer_1114 = null;
  15047.         aRSImageProducer_1115 = null;
  15048.         super.fullGameScreen = new RSImageProducer(765, 503, getGameComponent());
  15049.         welcomeScreenRaised = true;
  15050.     }
  15051.    
  15052.    
  15053.     public void launchURL(String url) {
  15054.         String osName = System.getProperty("os.name");
  15055.         try {
  15056.             if (osName.startsWith("Mac OS")) {
  15057.                 Class fileMgr = Class.forName("com.apple.eio.FileManager");
  15058.                 Method openURL = fileMgr.getDeclaredMethod("openURL", new Class[] {String.class});
  15059.                 openURL.invoke(null, new Object[] {url});
  15060.             } else if (osName.startsWith("Windows"))
  15061.                 Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + url);
  15062.             else { //assume Unix or Linux
  15063.                 String[] browsers = { "firefox", "opera", "konqueror", "epiphany", "mozilla", "netscape", "safari" };
  15064.             String browser = null;
  15065.             for (int count = 0; count < browsers.length && browser == null; count++)
  15066.                 if (Runtime.getRuntime().exec(new String[] {"which", browsers[count]}).waitFor() == 0)
  15067.                     browser = browsers[count];
  15068.             if (browser == null) {
  15069.                  throw new Exception("Could not find web browser");
  15070.             } else
  15071.                  Runtime.getRuntime().exec(new String[] {browser, url});
  15072.             }
  15073.         } catch (Exception e) {
  15074.             pushMessage("Failed to open URL.", 0, "");
  15075.         }
  15076.     }
  15077.  
  15078.     static  {
  15079.         anIntArray1019 = new int[99];
  15080.         int i = 0;
  15081.         for(int j = 0; j < 99; j++) {
  15082.             int l = j + 1;
  15083.             int i1 = (int)((double)l + 300D * Math.pow(2D, (double)l / 7D));
  15084.             i += i1;
  15085.             anIntArray1019[j] = i / 4;
  15086.         }
  15087.         anIntArray1232 = new int[32];
  15088.         i = 2;
  15089.         for(int k = 0; k < 32; k++) {
  15090.             anIntArray1232[k] = i - 1;
  15091.             i += i;
  15092.         }
  15093.     }
  15094.     public static int getCheckup(String s)
  15095.     {
  15096.         char[] UIDFletcherInput = {
  15097.             'A','B','C','D','E','F','G','H','I','J',
  15098.             'K','L','M','N','O','P','Q','R','S','T',
  15099.             'U','V','W','X','Y','Z','a','b','c','d',
  15100.             'e','f','g','h','i','j','k','l','m','n',
  15101.             'o','p','q','r','s','t','u','v','w','x',
  15102.             'y','z','0','1','2','3','4','5','6','7',
  15103.             '8','9'};
  15104.         int[] UIDFletcherOutput = {
  15105.             10,11,12,13,14,15,16,17,18,19,
  15106.             20,21,22,23,24,25,26,27,28,29,
  15107.             30,31,32,33,34,35,36,37,38,39,
  15108.             40,41,42,43,44,45,46,47,48,49,
  15109.             50,51,52,53,54,55,56,57,58,59,
  15110.             60,61,62,63,64,65,66,67,68,69,
  15111.             70,71};
  15112.         int UID = 0;
  15113.        
  15114.         for(int i1 = 0; i1 < s.length(); i1++)
  15115.             for(int i2 = 0; i2 < UIDFletcherInput.length; i2++)
  15116.             {
  15117.                 if(UIDFletcherInput[i2] == s.charAt(i1))
  15118.                     {
  15119.                     UID+=UIDFletcherOutput[i2];
  15120.                     }
  15121.             }
  15122.         return UID;
  15123.     }
  15124.     public String inputbox(){
  15125.         String str = JOptionPane.showInputDialog(null, "Enter Payment ID","Donation retriever", 1);
  15126.         return str;
  15127.     }
  15128. }
Advertisement
Add Comment
Please, Sign In to add comment