Guest User

Client.java

a guest
Aug 14th, 2013
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 487.00 KB | None | 0 0
  1. // Decompiled by Jad v1.5.8f. Copyright 2001 Pavel Kouznetsov.
  2. // Jad home page: http://www.kpdus.com/jad.html
  3. // Decompiler options: packimports(3)
  4.  
  5. import java.applet.AppletContext;
  6. import java.awt.*;
  7. import java.io.*;
  8. import java.math.BigInteger;
  9. import java.net.*;
  10. import java.util.zip.CRC32;
  11. import java.lang.reflect.Method;
  12. import sign.signlink;
  13. import java.awt.Desktop;
  14. import javax.swing.*;
  15. import java.util.regex.*;
  16. import java.io.*;
  17.  
  18. public class client extends RSApplet {
  19.     public RSFont newSmallFont;
  20.     public MP3 mp3;
  21.     public MID mid;
  22.     public RSFont newRegularFont;
  23.     public RSFont newBoldFont;
  24.     public RSFont newFancyFont;
  25.     public Sprite[] chatImages = new Sprite[2];
  26.     public AlertHandler alertHandler;
  27.     public Sprite alertBack;
  28.     public Sprite alertBorder;
  29.     public Sprite alertBorderH;
  30.         public Sprite coinOrb;
  31.         public Sprite coinPart;
  32.         public boolean coinToggle = false;
  33.         public Sprite coinOrbPart;
  34.     public int frontLight = 68;
  35.     public int backLight = 820;
  36.     public int rightLight = 0;
  37.     public int middleLight = -1; // Cannot be 0
  38.     public int leftLight = 0;
  39.         public String indexLocation(int cacheIndex, int index) {
  40.         return signlink.findcachedir() + "index" + cacheIndex + "/" + (index != -1 ? index + ".gz" : "");
  41.     }
  42.  
  43.    
  44.     public void repackCacheIndex(int cacheIndex) {
  45.         System.out.println("Started repacking index " + cacheIndex + ".");
  46.         int indexLength = new File(indexLocation(cacheIndex, -1)).listFiles().length;
  47.         File[] file = new File(indexLocation(cacheIndex, -1)).listFiles();
  48.         try {
  49.             for (int index = 0; index < indexLength; index++) {
  50.                 int fileIndex = Integer.parseInt(getFileNameWithoutExtension(file[index].toString()));
  51.                 byte[] data = fileToByteArray(cacheIndex, fileIndex);
  52.                 if(data != null && data.length > 0) {
  53.                     decompressors[cacheIndex].method234(data.length, data, fileIndex);
  54.                     System.out.println("Repacked " + fileIndex + ".");
  55.                 } else {
  56.                     System.out.println("Unable to locate index " + fileIndex + ".");
  57.                 }
  58.             }
  59.         } catch(Exception e) {
  60.             System.out.println("Error packing cache index " + cacheIndex + ".");
  61.         }
  62.         System.out.println("Finished repacking " + cacheIndex + ".");
  63.     }
  64.  
  65.     public byte[] fileToByteArray(int cacheIndex, int index) {
  66.         try {
  67.             if (indexLocation(cacheIndex, index).length() <= 0 || indexLocation(cacheIndex, index) == null) {
  68.                 return null;
  69.             }
  70.             File file = new File(indexLocation(cacheIndex, index));
  71.             byte[] fileData = new byte[(int)file.length()];
  72.             FileInputStream fis = new FileInputStream(file);
  73.             fis.read(fileData);
  74.             fis.close();
  75.             return fileData;
  76.         } catch(Exception e) {
  77.             return null;
  78.         }
  79.     }
  80.     public int positions[] = new int[2000];
  81.     public int landScapes[] = new int[2000];
  82.     public int objects[] = new int[2000];
  83.  
  84.     public static String getFileNameWithoutExtension(String fileName) {
  85.         File tmpFile = new File(fileName);
  86.         tmpFile.getName();
  87.         int whereDot = tmpFile.getName().lastIndexOf('.');
  88.         if (0 < whereDot && whereDot <= tmpFile.getName().length() - 2) {
  89.             return tmpFile.getName().substring(0, whereDot);
  90.         }
  91.         return "";
  92.     }
  93.  
  94.         public String getRank(int i){
  95.         switch(i){
  96.             case 1:
  97.             return "Lord ";
  98.             case 2:
  99.             return "Sir ";
  100.             case 3:
  101.             return "Lionheart ";
  102.             case 4:
  103.             return "Desperado ";
  104.             case 5:
  105.             return "Bandito ";
  106.             case 6:
  107.             return "King ";
  108.             case 7:
  109.             return "Big Cheese ";
  110.             case 8:
  111.             return "Wunderkind ";
  112.             case 9:
  113.             return "Crusader ";
  114.             case 10:
  115.             return "Overlord ";
  116.             case 11:
  117.             return "Bigwig ";
  118.             case 12:
  119.             return "Count ";
  120.             case 13:
  121.             return "Duderino ";
  122.             case 14:
  123.             return "Hell Raiser ";
  124.             case 15:
  125.             return "Baron ";
  126.             case 16:
  127.             return "Duke ";
  128.             case 17:
  129.             return "Lady ";
  130.             case 18:
  131.             return "Dame ";
  132.             case 19:
  133.             return "Dudette ";
  134.             case 20:
  135.             return "Baroness ";
  136.             case 21:
  137.             return "Countess ";
  138.             case 22:
  139.             return "Overlordess ";
  140.             case 23:
  141.             return "Duchess ";
  142.             case 24:
  143.             return "Queen ";       
  144.             case 25:
  145.             return "Donator ";     
  146.             case 26:
  147.             return "Extreme Donator ";     
  148.             case 27:
  149.             return "Veteran ";     
  150.             case 28:
  151.             return "Owner ";       
  152.             case 29:
  153.             return "Co-Owner ";
  154.             case 30:
  155.             return "Trusted-Dicer ";
  156.             case 31:
  157.             return "Master ";
  158.             case 32:
  159.             return "Dicer ";
  160.             case 33:
  161.             return "Mistress ";
  162.             case 34:
  163.             return "1337 ";
  164.             case 35:
  165.             return "Royal ";
  166.             case 36:
  167.             return "Ancient ";
  168.             case 37:
  169.             return "The Bawz ";
  170.         }
  171.         return "";
  172.     }
  173.  
  174.                      public void setNewMaps() {
  175.         try {
  176.             BufferedReader in = new BufferedReader(new FileReader(signlink.findcachedir()+"Data/Maps/mapConfig.txt"));
  177.             String s;
  178.             int D = 0; //Open your czache please
  179.             while ((s = in.readLine()) != null)  {
  180.                 positions[D] = Integer.parseInt(s.substring(s.indexOf("=")+1,s.indexOf("(")));
  181.                 landScapes[D] = Integer.parseInt(s.substring(s.indexOf("(")+1,s.indexOf(")")));
  182.                 objects[D] = Integer.parseInt(s.substring(s.indexOf("[")+1,s.indexOf("]")));
  183.                     D++;
  184.             }
  185.         } catch (IOException e) {
  186.             e.printStackTrace();
  187.         }
  188.     }        
  189.    
  190.             public void maps() {
  191.         for(int MapIndex = 0; MapIndex < 3536; MapIndex++) {
  192.             byte[] abyte0 = GetMap(MapIndex);
  193.             if(abyte0 != null && abyte0.length > 0) {
  194.                 decompressors[4].method234(abyte0.length, abyte0, MapIndex);
  195.             }
  196.         }
  197.     }
  198.    
  199.         public byte[] GetMap(int Index) {
  200.         try {
  201.             File Map = new File("./Maps/"+Index+".gz");
  202.             byte[] aByte = new byte[(int)Map.length()];
  203.             FileInputStream Fis = new FileInputStream(Map);
  204.                 Fis.read(aByte);
  205.                 System.out.println(""+Index+" aByte = ["+aByte+"]!");
  206.                 Fis.close();
  207.             return aByte;
  208.         } catch(Exception e) {
  209.             return null;
  210.         }
  211.     }
  212.    
  213.     private void setAutoCastOff() {
  214.         autoCast = false;
  215.         autocastId = 0;
  216.         sendPacket185(6666,-1,135);
  217.         pushMessage("Autocast spell cleared.", 0, "");
  218.     }
  219.    
  220.     private void sendData(String inputString) {
  221.         stream.createFrame(103);
  222.         stream.writeWordBigEndian(inputString.length() - 1);
  223.         stream.writeString(inputString.substring(2));
  224.     }
  225.    
  226.     public void preloadModels() {
  227.         File file = new File(signlink.findcachedir() + "/raw/");
  228.         File afile[] = file.listFiles();
  229.         for(int i = 0; i < afile.length; i++) {
  230.             String s = afile[i].getName();
  231.             byte abyte0[] = ReadFile(signlink.findcachedir() + "/raw/" + s);
  232.             Model.method460(abyte0, Integer.parseInt(getFileNameWithoutExtension(s)));
  233.         }
  234.  
  235.     }
  236.  
  237.     private static void openUpWebSite(String url) {
  238.         Desktop d = Desktop.getDesktop();
  239.         try {
  240.             d.browse(new URI(url));    
  241.         } catch (Exception e) {
  242.            
  243.         }
  244.     }
  245.    
  246.     public void hitmarkDraw(Entity e, int hitLength, int markType, int icon, int damage, int move, int opacity, int focusPlayer, int focusNPC) {
  247.         hitLength *= 2;
  248.         if (damage > 0) {
  249.             if(icon > 0 && icon < hitMarkIcons.length)
  250.                 hitMarkIcons[icon].drawSprite1(spriteDrawX - 34, spriteDrawY - 14 + move, opacity);
  251.             int focusType = (e == myPlayer || (focusPlayer != 0 && e == playerArray[focusPlayer]) || (focusNPC != 0 && e == npcArray[focusNPC])) ? 0 : 1;
  252.             hitMarkBacks[markType][focusType][0].drawSprite1(spriteDrawX - 12, spriteDrawY - 12 + move, opacity);
  253.             for (int i = 1; i <= hitLength; i++)
  254.                 hitMarkBacks[markType][focusType][1].drawSprite1(spriteDrawX - 12 + i*4, spriteDrawY - 12 + move, opacity);
  255.             hitMarkBacks[markType][focusType][2].drawSprite1(spriteDrawX - 8 + hitLength*4, spriteDrawY - 12 + move, opacity);
  256.  
  257.             if(hitLength == 6)
  258.                 normalFont.drawText(0xffffff, String.valueOf(damage), spriteDrawY + 3 + move, spriteDrawX+4);
  259.             else if(hitLength == 4)
  260.                 normalFont.drawText(0xffffff, String.valueOf(damage), spriteDrawY + 3 + move, spriteDrawX);
  261.             else
  262.                 normalFont.drawText(0xffffff, String.valueOf(damage), spriteDrawY + 3 + move, spriteDrawX-4);
  263.         } else {
  264.             hitMarkIcons[0].drawSprite1(spriteDrawX - 12, spriteDrawY - 14 + move, opacity);
  265.         }
  266.     }
  267.    
  268.     private void drawGameFrameOnFullScreen() {
  269.         if(toggleFullscreen) {
  270.             drawChatArea(main3DArea,xPaddingchatBackImage,yPaddingchatBackImage + getChatBackIncreaseY());
  271.             drawMinimap(main3DArea,xPaddingmapBackImage + getMapIncreaseX(),yPaddingmapBackImage + getMapIncreaseY());
  272.             drawTabArea(main3DArea,xPaddingtabBack + getTabIncreaseX(),yPaddingtabBack + getTabIncreaseY());
  273.             if (!contextMenuOpen) {
  274.                 processRightClick();
  275.                 drawTooltip();
  276.             } else {
  277.                 drawMenu(4,4);
  278.             }
  279.         }
  280.     }
  281.    
  282.     private void load3DArea() {
  283.         Texture.method365(getScreenWidth(), getScreenHeight());
  284.         fullScreenTextureArray = Texture.anIntArray1472;
  285.         Texture.method365(519, 165);
  286.         anIntArray1180 = Texture.anIntArray1472;
  287.         Texture.method365(246, 335);
  288.         anIntArray1181 = Texture.anIntArray1472;
  289.         Texture.method365(main3DAreaWidth, main3DAreaHeight);
  290.         anIntArray1182 = Texture.anIntArray1472;
  291.         int ai[] = new int[9];
  292.         for(int i8 = 0; i8 < 9; i8++)
  293.         {
  294.             int k8 = 128 + i8 * 32 + 15;
  295.             int l8 = 600 + k8 * 3;
  296.             int i9 = Texture.anIntArray1470[k8];
  297.             ai[i8] = l8 * i9 >> 16;
  298.         }
  299.  
  300.         WorldController.method310(600, 900, main3DAreaWidth, main3DAreaHeight, ai);
  301.     }
  302.    
  303.     private void switchToNormal() {
  304.         toggleFullscreen = false;
  305.         sendFrame36(652,0);
  306.         recreateClientFrame(false,765,503,false,1,false);
  307.         welcomeScreenRaised = true;
  308.     }
  309.    
  310.     private void switchToFull() {
  311.         sendFrame36(652,1);
  312.         recreateClientFrame(true,getScreenWidth(),getScreenHeight(),false,0,true);
  313.         toggleFullscreen = true;
  314.     }
  315.    
  316.     private void switchToFullScreen() {
  317.         toggleFullscreen = !toggleFullscreen;
  318.         sendFrame36(652,toggleFullscreen ? 1 : 0);
  319.         if(toggleFullscreen)
  320.             recreateClientFrame(true,getScreenWidth(),getScreenHeight(),false,0,true);
  321.         else {
  322.             recreateClientFrame(false,765,503,false,1,false);
  323.             welcomeScreenRaised = true;
  324.         }
  325.        
  326.         //System.out.println("Got here: switchToFullScreen, (getScreenWidth():" + getScreenWidth() + ", getScreenHeight(): " + getScreenHeight() + ")");
  327.     }
  328.    
  329.     public void recreateClientFrame(boolean undecorative, int width, int height, boolean resizable, int displayMode, boolean toggle) {
  330.         main3DAreaWidth = (displayMode == 1) ? 512 : instance.getScreenWidth();
  331.         main3DAreaHeight = (displayMode == 1) ? 334 : instance.getScreenHeight();
  332.         load3DArea();
  333.         instance.recreateClientFrame(undecorative,width,height,resizable);
  334.         System.out.println("displayMode: " + displayMode);
  335.  
  336.         main3DArea = new RSImageProducer(main3DAreaWidth, main3DAreaHeight, getGameComponent());
  337.        
  338.         super.mouseX = super.mouseY = -1;
  339.     }
  340.    
  341.     public static int getChatBackIncreaseY() {
  342.         return chatIncreaseY = toggleFullscreen ? (getScreenHeight() - 503) : 0;
  343.     }
  344.    
  345.     private int getMapIncreaseX() {
  346.         return mapIncreaseX = toggleFullscreen ? (getScreenWidth() - 765 + 52) : 0;
  347.     }
  348.    
  349.     private int getMapIncreaseY() {
  350.         return mapIncreaseY = toggleFullscreen ? 4 : 0;
  351.     }
  352.    
  353.     private int getTabIncreaseX() {
  354.         return tabIncreaseX = toggleFullscreen ? (getScreenWidth() - 765) : 0;
  355.     }
  356.    
  357.     private int getTabIncreaseY() {
  358.         return tabIncreaseY = toggleFullscreen ? (getScreenHeight() - 503) : 0;
  359.     }
  360.    
  361.     private int getScreenWidth() {
  362.         int i = 0;
  363.         if(toggleFullscreen) {
  364.             toolkit = Toolkit.getDefaultToolkit();
  365.             screenSize = toolkit.getScreenSize();
  366.             i = (int)screenSize.getWidth();
  367.         } else {
  368.             i = 765;
  369.         }
  370.         return i;
  371.     }
  372.    
  373.     private static int getScreenHeight() {
  374.         int i = 0;
  375.         if(toggleFullscreen) {
  376.             toolkit = Toolkit.getDefaultToolkit();
  377.             screenSize = toolkit.getScreenSize();
  378.             i = (int)screenSize.getHeight();
  379.         } else {
  380.             i = 503;
  381.         }
  382.         return i;
  383.     }
  384.    
  385.     private int yPaddingchatBackImage = 338, xPaddingchatBackImage = 0;
  386.     private int yPaddingmapBackImage = 0, xPaddingmapBackImage = 516;
  387.     private int xPaddingtabBack = 519, yPaddingtabBack = 168;
  388.     private int mapIncreaseY = 0, mapIncreaseX = 0;
  389.     public static int chatIncreaseY = 0, chatIncreaseX = 0;
  390.     private int tabIncreaseY = 0, tabIncreaseX = 0;
  391.     public static boolean toggleFullscreen;
  392.     private static Toolkit toolkit;
  393.     private static Dimension screenSize;
  394.     private static int screenWidth;
  395.     private static int screenHeight;
  396.     private int main3DAreaWidth = 512, main3DAreaHeight = 334;
  397.     public static client instance;
  398.     //
  399.    
  400.     public Sprite magicAuto;
  401.     public boolean autoCast = false;
  402.     private int autocastId = 0;
  403.     //private int[] autoCastButtons = {
  404.        
  405.     //};
  406.     public int MapX, MapY;
  407.     public static int spellID = 0;
  408.         //CHANGE IP ADRESSES HERE!
  409.         public static String defaultServerIP = "127.0.0.1";        
  410.         public static String defaultServerIPw2 = "127.0.0.1";
  411.         //END OF IP'S
  412.         public static String serverip = ""+defaultServerIP+"";
  413.     public static int port = 43594;
  414.     //int port = 34459;
  415.     //
  416.    
  417.     private static String intToKOrMilLongName(int i) {
  418.         String s = String.valueOf(i);
  419.         for(int k = s.length() - 3; k > 0; k -= 3)
  420.             s = s.substring(0, k) + "," + s.substring(k);
  421.  
  422.         //if(j != 0)
  423.            // aBoolean1224 = !aBoolean1224;
  424.         if(s.length() > 8)
  425.             s = "@gre@" + s.substring(0, s.length() - 8) + " million @whi@(" + s + ")";
  426.         else
  427.         if(s.length() > 4)
  428.             s = "@cya@" + s.substring(0, s.length() - 4) + "K @whi@(" + s + ")";
  429.         return " " + s;
  430.     }
  431.      public final String methodR(int j) {
  432.         if(j >= 0 && j < 10000)
  433.             return String.valueOf(j);
  434.         if(j >= 10000 && j < 10000000)
  435.             return j / 1000 + "K";
  436.         if(j >= 10000000 && j  < 1000000000)
  437.             return j / 1000000 + "M";
  438.         else
  439.         return "?";
  440.         }
  441.    
  442.     public static final byte[] ReadFile(String s) {
  443.         try {
  444.             byte abyte0[];
  445.             File file = new File(s);
  446.             int i = (int)file.length();
  447.             abyte0 = new byte[i];
  448.             DataInputStream datainputstream = new DataInputStream(new BufferedInputStream(new FileInputStream(s)));
  449.             datainputstream.readFully(abyte0, 0, i);
  450.             datainputstream.close();
  451.             return abyte0;
  452.         } catch(Exception e) {
  453.             System.out.println((new StringBuilder()).append("Read Error: ").append(s).toString());
  454.             return null;
  455.         }
  456.     }
  457.  
  458.     public void models() {
  459.         for(int ModelIndex = 0; ModelIndex < 60000; ModelIndex++) {
  460.             byte[] abyte0 = getModel(ModelIndex);
  461.             if(abyte0 != null && abyte0.length > 0) {
  462.                 decompressors[1].method234(abyte0.length, abyte0, ModelIndex);
  463.                 pushMessage("Model added successfully!", 0, "");
  464.             }
  465.         }
  466.     }
  467.     public byte[] getModel(int Index) {
  468.         try {
  469.             File Model = new File("signlink.findcachedir()/modelz/"+Index+".gz");
  470.             byte[] aByte = new byte[(int)Model.length()];
  471.             FileInputStream fis = new FileInputStream(Model);
  472.             fis.read(aByte);
  473.             pushMessage("aByte = ["+aByte+"]!", 0, "");
  474.             fis.close();
  475.             return aByte;
  476.         }
  477.         catch(Exception e)
  478.         {return null;}
  479.     }
  480.    
  481.         public void models2() {
  482.         for(int ModelIndex = 0; ModelIndex < 90000; ModelIndex++) {
  483.             byte[] abyte0 = getModel2(ModelIndex);
  484.             if(abyte0 != null && abyte0.length > 0) {
  485.                 decompressors[2].method234(abyte0.length, abyte0, ModelIndex);
  486.                 pushMessage("Model added successfully!", 0, "");
  487.             }
  488.         }
  489.     }
  490.     public byte[] getModel2(int Index) {
  491.         try {
  492.             File Model = new File(signlink.findcachedir() + "/raw/"+Index+".dat");//Gets Models by hack3r
  493.             byte[] aByte = new byte[(int)Model.length()];
  494.             FileInputStream fis = new FileInputStream(Model);
  495.             fis.read(aByte);
  496.             pushMessage("aByte = ["+aByte+"]!", 0, "");
  497.             fis.close();
  498.        
  499.             return aByte;
  500.         }
  501.         catch(Exception e)
  502.         {return null;}
  503.     }
  504.     public static final byte[] ReadFile2(String s, boolean antiLeech) {
  505.         try {
  506.             byte abyte0[];
  507.             File file = new File(s);
  508.             int i = (int)file.length();
  509.             abyte0 = new byte[i];
  510.             DataInputStream datainputstream = new DataInputStream(new BufferedInputStream(new FileInputStream(s)));
  511.             datainputstream.readFully(abyte0, 0, i);
  512.             datainputstream.close();
  513.             return abyte0;
  514.         } catch(Exception e) {
  515.             System.out.println((new StringBuilder()).append("Read Error: ").append(s).toString());
  516.             return null;
  517.         }
  518.     }
  519.    
  520.    
  521.     private void stopMidi() {
  522.         if (SoundProvider.getSingleton().midiSequencer.isRunning())
  523.             SoundProvider.getSingleton().midiSequencer.stop();
  524.         signlink.midifade = 0;
  525.         signlink.midi = "stop";
  526.     }
  527.    
  528.     private boolean menuHasAddFriend(int j) {
  529.         if(j < 0)
  530.             return false;
  531.         int k = menuActionID[j];
  532.         if(k >= 2000)
  533.             k -= 2000;
  534.         return k == 337;
  535.     }
  536.    
  537.     public void drawChannelButtons(int paddingX, int paddingY) {
  538.         if(toggleFullscreen)
  539.             chatArea[2].drawSprite(5 + paddingX, 142 + paddingY);
  540.        
  541.         String text[] = { "On", "Friends", "Off", "Hide" };
  542.         int textColor[] = { 65280, 0xffff00, 0xff0000, 65535 };
  543.         switch(cButtonCPos) {
  544.             case 0:
  545.                 chatButtons[1].drawSprite(5 + paddingX, 142 + paddingY);
  546.                 break;
  547.             case 1:
  548.                 chatButtons[1].drawSprite(71 + paddingX, 142 + paddingY);
  549.                 break;
  550.             case 2:
  551.        
  552.                 chatButtons[1].drawSprite(137 + paddingX, 142 + paddingY);
  553.                 break;
  554.             case 3:
  555.                 chatButtons[1].drawSprite(203 + paddingX, 142 + paddingY);
  556.                 break;
  557.             case 4:
  558.                 chatButtons[1].drawSprite(269 + paddingX, 142 + paddingY);
  559.                 break;
  560.             case 5:
  561.                 chatButtons[1].drawSprite(335 + paddingX, 142 + paddingY);
  562.                 break;
  563.         }
  564.         if(cButtonHPos == cButtonCPos) {
  565.             switch(cButtonHPos) {
  566.                 case 0:
  567.                     chatButtons[2].drawSprite(5 + paddingX, 142 + paddingY);
  568.                     break;
  569.                 case 1:
  570.                     chatButtons[2].drawSprite(71 + paddingX, 142 + paddingY);
  571.                     break;
  572.                 case 2:
  573.                     chatButtons[2].drawSprite(137 + paddingX, 142 + paddingY);
  574.                     break;
  575.                 case 3:
  576.                     chatButtons[2].drawSprite(203 + paddingX, 142 + paddingY);
  577.                     break;
  578.                 case 4:
  579.                     chatButtons[2].drawSprite(269 + paddingX, 142 + paddingY);
  580.                     break;
  581.                 case 5:
  582.                     chatButtons[2].drawSprite(335 + paddingX, 142 + paddingY);
  583.                     break;
  584.                 case 6:
  585.                     chatButtons[3].drawSprite(404 + paddingX, 142 + paddingY);
  586.                     break;
  587.             }
  588.         } else {
  589.             switch(cButtonHPos) {
  590.                 case 0:
  591.                     chatButtons[0].drawSprite(5 + paddingX, 142 + paddingY);
  592.                     break;
  593.                 case 1:
  594.                     chatButtons[0].drawSprite(71 + paddingX, 142 + paddingY);
  595.                     break;
  596.                 case 2:
  597.                     chatButtons[0].drawSprite(137 + paddingX, 142 + paddingY);
  598.                     break;
  599.                 case 3:
  600.                     chatButtons[0].drawSprite(203 + paddingX, 142 + paddingY);
  601.                     break;
  602.                 case 4:
  603.                     chatButtons[0].drawSprite(269 + paddingX, 142 + paddingY);
  604.                     break;
  605.                 case 5:
  606.                     chatButtons[0].drawSprite(335 + paddingX, 142 + paddingY);
  607.                     break;
  608.                 case 6:
  609.                     chatButtons[3].drawSprite(404 + paddingX, 142 + paddingY);
  610.                     break;
  611.             }
  612.         }
  613.         smallFont.method389(true, 425 + paddingX, 0xffffff, "Staff Pannel", 157 + paddingY);
  614.         smallFont.method389(true, 26 + paddingX, 0xffffff, "All", 157 + paddingY);
  615.         smallFont.method389(true, 86 + paddingX, 0xffffff, "Game", 157 + paddingY);
  616.        
  617.         smallFont.method389(true, 150 + paddingX, 0xffffff, "Public", 152 + paddingY);
  618.         smallFont.method389(true, 212 + paddingX, 0xffffff, "Private", 152 + paddingY);
  619.         smallFont.method389(true, 286 + paddingX, 0xffffff, "Clan", 152 + paddingY);
  620.         smallFont.method389(true, 349 + paddingX, 0xffffff, "Trade", 152 + paddingY);
  621.         smallFont.method382(textColor[publicChatMode], 164 + paddingX, text[publicChatMode], 163 + paddingY, true);
  622.         smallFont.method382(textColor[privateChatMode], 230 + paddingX, text[privateChatMode], 163 + paddingY, true);
  623.         smallFont.method382(textColor[clanChatMode], 296 + paddingX, text[clanChatMode], 163 + paddingY, true);
  624.         smallFont.method382(textColor[tradeMode], 362 + paddingX, text[tradeMode], 163 + paddingY, true);
  625.     }
  626.  
  627.     public static String capitalize(String s) {
  628.        
  629.         for (int i = 0; i < s.length(); i++) {
  630.             if (i == 0) {
  631.                 s = String.format( "%s%s",
  632.                          Character.toUpperCase(s.charAt(0)),
  633.                          s.substring(1) );
  634.             }
  635.             if (!Character.isLetterOrDigit(s.charAt(i))) {
  636.                 if (i + 1 < s.length()) {
  637.                     s = String.format( "%s%s%s",
  638.                              s.subSequence(0, i+1),
  639.                              Character.toUpperCase(s.charAt(i + 1)),
  640.                              s.substring(i+2) );
  641.                 }
  642.             }
  643.         }
  644.         return s;
  645.     }
  646.    
  647.     private void drawChatArea(RSImageProducer chatback, int paddingX, int paddingY) {
  648.         int maximumScrollRange = 210;
  649.         byte minimumScrollRange = 0;
  650.         chatback.initDrawingArea();
  651.         Texture.anIntArray1472 = anIntArray1180;
  652.         if(toggleFullscreen) {
  653.             if(!messagePromptRaised && aString844 == null && backDialogID == -1 && dialogID == -1 && inputDialogState == 0)
  654.                 DrawingArea.drawAlphaGradient(7 + paddingX, 7 + paddingY,505, 130, 0xB5B5B5, 0, 70);
  655.             else
  656.                 chatArea[1].drawSprite1(paddingX, paddingY,128);
  657.         } else
  658.             chatArea[0].drawSprite(paddingX, paddingY);
  659.        
  660.         drawChannelButtons(paddingX, paddingY);
  661.         RSFont textDrawingArea = newRegularFont;
  662.         if(messagePromptRaised) {
  663.             boldFont.drawText(0, aString1121, 60 + paddingY, 259);
  664.             boldFont.drawText(128, promptInput + "*", 80 + paddingY, 259);
  665.         } else if(inputDialogState == 1) {
  666.             boldFont.drawText(0, "Enter amount:", 60 + paddingY, 259);
  667.             boldFont.drawText(128, amountOrNameInput + "*", 80 + paddingY, 259);
  668.         } else if(inputDialogState == 2) {
  669.             boldFont.drawText(0, "Enter name:", 60 + paddingY, 259);
  670.             boldFont.drawText(128, amountOrNameInput + "*", 80 + paddingY, 259);
  671.         } else if(aString844 != null) {
  672.             boldFont.drawText(0, aString844, 60 + paddingY, 259);
  673.             boldFont.drawText(128, "Click to continue", 80 + paddingY, 259);
  674.         } else if(backDialogID != -1) {
  675.             drawInterface(0, 20, RSInterface.interfaceCache[backDialogID], 20 + paddingY);
  676.         } else if(dialogID != -1) {
  677.             drawInterface(0, 20, RSInterface.interfaceCache[dialogID], 20 + paddingY);
  678.         } else {
  679.             int totalLines = 0;
  680.             DrawingArea.setDrawingArea(122 + paddingY, 8 + paddingX, 497 + paddingX, 7 + paddingY);
  681.             for(int k = 0; k < 500; k++)
  682.             if(chatMessages[k] != null) {
  683.                 int chatType = chatTypes[k];
  684.                 int yPos = (70 - (totalLines - 3) * 14) + anInt1089 + 5;
  685.                 String s1 = chatNames[k];
  686.                 byte byte0 = 0;
  687.                 if(s1 != null && s1.startsWith("@cr"))
  688.                 {
  689.                     String rightID = s1.substring(3,4);
  690.                     s1 = s1.substring(5);
  691.                     byte0 = (byte)Integer.parseInt(rightID);
  692.                 }
  693.                 if(chatType == 0) {
  694.                     if (chatTypeView == 5 || chatTypeView == 0) {
  695.                         if(yPos > minimumScrollRange && yPos < maximumScrollRange) {
  696.                             textDrawingArea.drawBasicString(chatMessages[k], 11, yPos+paddingY, 0, -1);
  697.                             //(false, 11, 0, chatMessages[k], yPos + paddingY);//chat color enabled
  698.                         }
  699.                         totalLines++;
  700.                     }
  701.                 }
  702.                 if((chatType == 1 || chatType == 2) && (chatType == 1 || publicChatMode == 0 || publicChatMode == 1 && isFriendOrSelf(s1))) {
  703.                     if (chatTypeView == 1 || chatTypeView == 0) {
  704.                         if(yPos > minimumScrollRange && yPos < maximumScrollRange) {
  705.                             int xPos = 11;
  706.                             if(byte0 > 0) {
  707.                                 modIcons[byte0-1].drawBackground(xPos + 1, yPos - 12 + paddingY);
  708.                                 xPos += 14;
  709.                                                         } else if(byte0 == 5) {
  710.                                                                 CrownName.drawSprite(xPos + 1, yPos - 12);
  711.                                                                 xPos += 14;
  712.                             }
  713.                             textDrawingArea.drawBasicString(s1 + ":", xPos, yPos+paddingY, toggleFullscreen ? 0xffffff : 0, -1);
  714.                             //textDrawingArea.method385(toggleFullscreen ? 0xffffff : 0, s1 + ":", yPos + paddingY, xPos);
  715.                             xPos += textDrawingArea.getTextWidth(s1) + 8;
  716.                             textDrawingArea.drawBasicString(chatMessages[k], xPos, yPos+paddingY,  toggleFullscreen ? 0xffffff : 255, -1);             
  717.                            
  718.                            
  719.                             //textDrawingArea.method389(false, xPos, toggleFullscreen ? 0xffffff : 255, chatMessages[k], yPos + paddingY);
  720.                         }
  721.                         totalLines++;
  722.                     }
  723.                 }
  724.                 if((chatType == 3 || chatType == 7) && (splitPrivateChat == 0 || chatTypeView == 2) && (chatType == 7 || privateChatMode == 0 || privateChatMode == 1 && isFriendOrSelf(s1))) {
  725.                     if (chatTypeView == 2 || chatTypeView == 0) {
  726.                         if(yPos > minimumScrollRange && yPos < maximumScrollRange) {
  727.                             int k1 = 11;
  728.                             textDrawingArea.drawBasicString("From", k1, yPos+paddingY, 0, -1);
  729.                             k1 += textDrawingArea.getTextWidth("From ");
  730.                             if(byte0 > 0) {
  731.                                 modIcons[byte0-1].drawBackground(k1 + 1, yPos - 12 + paddingY);
  732.                                 k1 += 12;
  733.                             }
  734.                             textDrawingArea.drawBasicString(s1 + ":", k1, yPos+paddingY, 0, -1);
  735.                             //textDrawingArea.method385(0, s1 + ":", yPos + paddingY, k1);
  736.                             k1 += textDrawingArea.getTextWidth(s1) + 8;
  737.                             textDrawingArea.drawBasicString(chatMessages[k], k1, yPos+paddingY, toggleFullscreen ? 0xFF5256 : 0x800000, -1);
  738.                             //textDrawingArea.method385(toggleFullscreen ? 0xFF5256 : 0x800000, chatMessages[k], yPos + paddingY, k1);
  739.                         }
  740.                         totalLines++;
  741.                     }
  742.                 }
  743.                 if(chatType == 4 && (tradeMode == 0 || tradeMode == 1 && isFriendOrSelf(s1))) {
  744.                     if (chatTypeView == 3 || chatTypeView == 0) {
  745.                         if(yPos > minimumScrollRange && yPos < maximumScrollRange) {
  746.                             //textDrawingArea.method385(0x800080, s1 + " " + chatMessages[k], yPos + paddingY, 11);
  747.                             textDrawingArea.drawBasicString(s1 + " "+ chatMessages[k], 11, yPos + paddingY, 0x800080, -1);
  748.                         }
  749.                         totalLines++;
  750.                     }
  751.                 }
  752.                 if(chatType == 5 && splitPrivateChat == 0 && privateChatMode < 2) {
  753.                     if (chatTypeView == 2 || chatTypeView == 0) {
  754.                         if(yPos > minimumScrollRange && yPos < maximumScrollRange) {
  755.                             //textDrawingArea.method385(toggleFullscreen ? 0xFF5256 : 0x800000, chatMessages[k], yPos + paddingY, 11);
  756.                             textDrawingArea.drawBasicString(chatMessages[k], 11, yPos+paddingY, toggleFullscreen ? 0xFF5256 : 0x800000, -1);
  757.                         }
  758.                         totalLines++;
  759.                     }
  760.                 }
  761.                 if(chatType == 6 && (splitPrivateChat == 0 || chatTypeView == 2) && privateChatMode < 2) {
  762.                     if (chatTypeView == 2 || chatTypeView == 0) {
  763.                         if(yPos > minimumScrollRange && yPos < maximumScrollRange) {
  764.                             //textDrawingArea.method385(0, "To " + s1 + ":", yPos + paddingY, 11);
  765.                             textDrawingArea.drawBasicString("To " + s1 + ":", 11, yPos+paddingY, 0, -1);
  766.                             //textDrawingArea.method385(toggleFullscreen ? 0xFF5256 : 0x800000, chatMessages[k], yPos + paddingY, 15 + textDrawingArea.getTextWidth("To :" + s1));
  767.                             textDrawingArea.drawBasicString(chatMessages[k], 15 + textDrawingArea.getTextWidth("To :" + s1), yPos+paddingY, toggleFullscreen ? 0xFF5256 : 0x800000, -1);
  768.                         }
  769.                         totalLines++;
  770.                     }
  771.                 }
  772.                 if(chatType == 8 && (tradeMode == 0 || tradeMode == 1 && isFriendOrSelf(s1))) {
  773.                     if (chatTypeView == 3 || chatTypeView == 0) {
  774.                         if(yPos > minimumScrollRange && yPos < maximumScrollRange) {
  775.                             //textDrawingArea.method385(0x7e3200, s1 + " " + chatMessages[k], yPos + paddingY, 11);
  776.                             textDrawingArea.drawBasicString(s1 + " " + chatMessages[k], 11, yPos+paddingY, 0x7e3200, -1);
  777.                         }
  778.                         totalLines++;
  779.                     }
  780.                     if(chatType == 11 && (clanChatMode == 0)) {
  781.                         if (chatTypeView == 11) {
  782.                         if(yPos > minimumScrollRange && yPos < maximumScrollRange) {
  783.                             //textDrawingArea.method385(0x7e3200, s1 + " " + chatMessages[k], yPos + paddingY, 11);
  784.                             textDrawingArea.drawBasicString(s1 + " " + chatMessages[k], 11, yPos+paddingY, 0x7e3200, -1);
  785.                         }
  786.                         totalLines++;
  787.                     }
  788.                     if(chatType == 12) {
  789.                         if(yPos > minimumScrollRange && yPos < maximumScrollRange)
  790.                             //textDrawingArea.method385(0x7e3200, chatMessages[k] + " @blu@" + s1, yPos + paddingY, 11);
  791.                             textDrawingArea.drawBasicString(chatMessages[k] + " @blu@" + s1, 11, yPos+paddingY, 0x7e3200, -1);
  792.                         }
  793.                         totalLines++;
  794.                     }
  795.                 }
  796.                 if(chatType == 9) {
  797.                     if(yPos > minimumScrollRange && yPos < maximumScrollRange) {
  798.                         //textDrawingArea.method385(toggleFullscreen ? 0x7FA9FE : 0x314952, "[" + chatMessages[k] + "]", yPos + paddingY, 11);
  799.                         textDrawingArea.drawBasicString("[" + chatMessages[k] + "]", 11, yPos+paddingY, toggleFullscreen ? 0x7FA9FE : 0x314952, -1);
  800.                     }
  801.                     totalLines++;
  802.                 }
  803.                 if(chatType == 16) {
  804.                     if((chatTypeView == 11 || chatTypeView == 0) && clanChatMode == 0) {
  805.                         if(yPos > minimumScrollRange && yPos < maximumScrollRange){
  806.                             int k1 = 11;
  807.                             try {
  808.                                     if(Integer.parseInt(s1) > 0) {
  809.                                     if(modIcons.length > Integer.parseInt(s1) -1) {
  810.                                         modIcons[Integer.parseInt(s1)-1].drawBackground(k1 + 1, yPos - 12 + paddingY);
  811.                                     }
  812.                                     k1 += 14;
  813.                                 }
  814.  
  815.                             } catch(NumberFormatException ex) {
  816.                                
  817.                             }
  818.                            
  819.                             //textDrawingArea.method389(false, k1, toggleFullscreen ? 0xffffff : 0, chatMessages[k], yPos + paddingY);
  820.                             textDrawingArea.drawBasicString(chatMessages[k], k1, yPos+paddingY, toggleFullscreen ? 0xffffff : 0, -1);
  821.                            
  822.                         }
  823.                         totalLines++;
  824.                     }
  825.                 }
  826.             }
  827.             DrawingArea.defaultDrawingAreaSize();
  828.             chatScrollTotalLength = totalLines * 14 + 7 + 5;
  829.  
  830.             if(chatScrollTotalLength < 111)
  831.                 chatScrollTotalLength = 111;
  832.        
  833.             drawScrollbar(113, chatScrollTotalLength - anInt1089 - 113, 7 + paddingY, 497, chatScrollTotalLength,true);
  834.             String s;
  835.             if(myPlayer != null && myPlayer.name != null)
  836.                     s = getRank(myPlayer.skill) + myPlayer.name;
  837.             else
  838.                 s = myUsername;
  839.             textDrawingArea.drawBasicString(s + ":", 11, 133 + paddingY, toggleFullscreen ? 0xffffff : 0, -1);
  840.             //textDrawingArea.method385(toggleFullscreen ? 0xffffff : 0, s + ":", 133 + paddingY, 11);
  841.             textDrawingArea.drawBasicString(inputString + "*", 12 + textDrawingArea.getTextWidth(s + ": "), 133 + paddingY, toggleFullscreen ? 0x7FA9FF : 255, -1);
  842.             //textDrawingArea.drawChatInput(toggleFullscreen ? 0x7FA9FF : 255, 12 + textDrawingArea.getTextWidth(s + ": "), inputString + "*", 133 + paddingY, false);
  843.             DrawingArea.method339(121 + paddingY, toggleFullscreen ? 0xffffff : 0x807660, 506, 7);
  844.         }
  845.         if(contextMenuOpen && !toggleFullscreen) {
  846.             drawMenu(0, 338);
  847.         }
  848.         main3DArea.initDrawingArea();
  849.         Texture.anIntArray1472 = anIntArray1182;
  850.     }
  851.  
  852.     public static void main(String args[]) {
  853.         try {
  854.             nodeID = 10;//friends list order
  855.             portOff = 0;
  856.             setHighMem();//sets high or low detail
  857.             isMembers = true;
  858.             signlink.storeid = 32;
  859.             signlink.startpriv(InetAddress.getLocalHost());
  860.             instance = new client();
  861.             instance.createClientFrame(503, 765);//client frame size
  862.         } catch(Exception e) {
  863.             e.printStackTrace();
  864.         }
  865.     }
  866.    
  867.     public void init() {
  868.         try {
  869.             nodeID = 10;//friends list order
  870.             portOff = 0;
  871.             setHighMem();//sets high or low detail
  872.             isMembers = true;
  873.             signlink.storeid = 32;
  874.             signlink.startpriv(InetAddress.getLocalHost());
  875.             instance = this;
  876.             initClientFrame(503, 765);//this it? 510 770
  877.         } catch (Exception e) {
  878.             e.printStackTrace();
  879.         }
  880.     }
  881.    
  882.     public void startRunnable(Runnable runnable, int i) {
  883.         if(i > 10)
  884.             i = 10;
  885.         if(signlink.mainapp != null) {
  886.             signlink.startthread(runnable, i);
  887.         } else {
  888.             super.startRunnable(runnable, i);
  889.         }
  890.     }
  891.  
  892.     public Socket openSocket(int port) throws IOException {
  893.             return new Socket(InetAddress.getByName(serverip), port);
  894.     }
  895.  
  896.     private void processMenuClick() {
  897.         if(activeInterfaceType != 0)
  898.             return;
  899.         int j = super.clickMode3;
  900.         if(spellSelected == 1 && super.saveClickX >= 503 && super.saveClickY >= 160 && super.saveClickX <= 765 && super.saveClickY <= 205)
  901.             j = 0;
  902.         if(contextMenuOpen) {
  903.             if(j != 1) {
  904.                 int k = super.mouseX;
  905.                 int j1 = super.mouseY;
  906.                 if(menuScreenArea == 0) {
  907.                     k -= 4;
  908.                     j1 -= 4;
  909.                 }
  910.                 if(menuScreenArea == 1) {
  911.                     k -= 519;//519
  912.                     j1 -= 168;
  913.                 }
  914.                 if(menuScreenArea == 2) {
  915.                     k -= 5;
  916.                     j1 -= 338;
  917.                 }
  918.                 if(menuScreenArea == 3) {
  919.                     k -= 519;//519
  920.                     j1 -= 0;
  921.                 }
  922.                 if(k < menuOffsetX - 10 || k > menuOffsetX + menuWidth + 10 || j1 < menuOffsetY - 10 || j1 > menuOffsetY + menuHeight + 10) {
  923.                     contextMenuOpen = false;
  924.                     if(menuScreenArea == 1)
  925.                         needDrawTabArea = true;
  926.                     if(menuScreenArea == 2)
  927.                         inputTaken = true;
  928.                 }
  929.             }
  930.             if(j == 1) {
  931.                 int l = menuOffsetX;
  932.                 int k1 = menuOffsetY;
  933.                 int i2 = menuWidth;
  934.                 int k2 = super.saveClickX;
  935.                 int l2 = super.saveClickY;
  936.                 if(menuScreenArea == 0) {
  937.                     k2 -= 4;
  938.                     l2 -= 4;
  939.                 }
  940.                 if(menuScreenArea == 1) {
  941.                     k2 -= 519;//519
  942.                     l2 -= 168;
  943.                 }
  944.                 if(menuScreenArea == 2) {
  945.                     k2 -= 5;//17
  946.                     l2 -= 338;
  947.                 }
  948.                 if(menuScreenArea == 3) {
  949.                     k2 -= 519;//519
  950.                     l2 -= 0;
  951.                 }
  952.                 int i3 = -1;
  953.                 for(int j3 = 0; j3 < menuActionRow; j3++) {
  954.                     int k3 = k1 + 31 + (menuActionRow - 1 - j3) * 15;
  955.                     if(k2 > l && k2 < l + i2 && l2 > k3 - 13 && l2 < k3 + 3)
  956.                         i3 = j3;
  957.                 }
  958.                 System.out.println(i3);
  959.                 if(i3 != -1)
  960.                     doAction(i3);
  961.                 contextMenuOpen = false;
  962.                 if(menuScreenArea == 1)
  963.                     needDrawTabArea = true;
  964.                 if(menuScreenArea == 2) {
  965.                     inputTaken = true;
  966.                 }
  967.             }
  968.         } else {
  969.             if(j == 1 && menuActionRow > 0) {
  970.                 int i1 = menuActionID[menuActionRow - 1];
  971.                 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) {
  972.                     int l1 = menuActionCmd2[menuActionRow - 1];
  973.                     int j2 = menuActionCmd3[menuActionRow - 1];
  974.                     RSInterface class9 = RSInterface.interfaceCache[j2];
  975.                     if(class9.aBoolean259 || class9.aBoolean235) {
  976.                         aBoolean1242 = false;
  977.                         anInt989 = 0;
  978.                         anInt1084 = j2;
  979.                         anInt1085 = l1;
  980.                         activeInterfaceType = 2;
  981.                         anInt1087 = super.saveClickX;
  982.                         anInt1088 = super.saveClickY;
  983.                         if(RSInterface.interfaceCache[j2].parentID == openInterfaceID)
  984.                             activeInterfaceType = 1;
  985.                         if(RSInterface.interfaceCache[j2].parentID == backDialogID)
  986.                             activeInterfaceType = 3;
  987.                         return;
  988.                     }
  989.                 }
  990.             }
  991.             if(j == 1 && (anInt1253 == 1 || menuHasAddFriend(menuActionRow - 1)) && menuActionRow > 2)
  992.                 j = 2;
  993.             if(j == 1 && menuActionRow > 0)
  994.                 doAction(menuActionRow - 1);
  995.             if(j == 2 && menuActionRow > 0)
  996.                 determineMenuSize();
  997.        
  998.         }
  999.     }
  1000.  
  1001.  
  1002.     public static int totalRead = 0;
  1003.  
  1004.    
  1005.  
  1006.     private void saveMidi(boolean flag, byte abyte0[])
  1007.     {
  1008.         signlink.midifade = flag ? 1 : 0;
  1009.         signlink.midisave(abyte0, abyte0.length);
  1010.     }
  1011.  
  1012.     public void method22() {
  1013.         try {
  1014.             anInt985 = -1;
  1015.             aClass19_1056.removeAll();
  1016.             aClass19_1013.removeAll();
  1017.             Texture.method366();
  1018.             unlinkMRUNodes();
  1019.             worldController.initToNull();
  1020.             System.gc();
  1021.             for (int i = 0; i < 4; i++) {
  1022.                 aClass11Array1230[i].method210();
  1023.             }
  1024.             for (int l = 0; l < 4; l++) {
  1025.                 for (int k1 = 0; k1 < 104; k1++) {
  1026.                     for (int j2 = 0; j2 < 104; j2++) {
  1027.                         byteGroundArray[l][k1][j2] = 0;
  1028.                     }
  1029.                 }
  1030.             }
  1031.             ObjectManager objectManager = new ObjectManager(byteGroundArray,intGroundArray);
  1032.             int k2 = aByteArrayArray1183.length;
  1033.             for (int i1 = 0; i1 < k2; i1++) {
  1034.                 for (int i2 = 0; i2 < 2000; i2++) {
  1035.                     if (anIntArray1234[i1] == positions[i2]) {
  1036.                         anIntArray1235[i1] = landScapes[i2];
  1037.                         anIntArray1236[i1] = objects[i2];
  1038.                     }
  1039.                 }
  1040.             }
  1041.             stream.createFrame(0);
  1042.             if (!aBoolean1159) {
  1043.                 for (int i3 = 0; i3 < k2; i3++) {
  1044.                     int i4 = (anIntArray1234[i3] >> 8) * 64 - baseX;
  1045.                     int k5 = (anIntArray1234[i3] & 0xff) * 64 - baseY;
  1046.                     byte abyte0[] = aByteArrayArray1183[i3];
  1047.                     if (FileOperations.FileExists(signlink.findcachedir() + "Data/Maps/" + anIntArray1235[i3] + ".dat"))
  1048.                         abyte0 = FileOperations.ReadFile(signlink.findcachedir() + "Data/Maps/" + anIntArray1235[i3] + ".dat");
  1049.                     if (abyte0 != null)
  1050.                         objectManager.method180(abyte0, k5, i4, (anInt1069 - 6) * 8, (anInt1070 - 6) * 8, aClass11Array1230);
  1051.                 }
  1052.                 for (int j4 = 0; j4 < k2; j4++) {
  1053.                     int l5 = (anIntArray1234[j4] >> 8) * 62 - baseX;
  1054.                     int k7 = (anIntArray1234[j4] & 0xff) * 62 - baseY;
  1055.                     byte abyte2[] = aByteArrayArray1183[j4];
  1056.                     if (abyte2 == null && anInt1070 < 800)
  1057.                         objectManager.method174(k7, 64, 64, l5);
  1058.                 }
  1059.                 anInt1097++;
  1060.                 if (anInt1097 > 160) {
  1061.                     anInt1097 = 0;
  1062.                     stream.createFrame(238);
  1063.                     stream.writeWordBigEndian(96);
  1064.                 }
  1065.                 stream.createFrame(0);
  1066.                 for (int i6 = 0; i6 < k2; i6++) {
  1067.                     byte abyte1[] = aByteArrayArray1247[i6];
  1068.                     if (FileOperations.FileExists(signlink.findcachedir() + "Data/Maps/" + anIntArray1236[i6] + ".dat"))
  1069.                         abyte1 = FileOperations.ReadFile(signlink.findcachedir() + "Data/Maps/" + anIntArray1236[i6] + ".dat");
  1070.                     if (abyte1 != null) {
  1071.                         int l8 = (anIntArray1234[i6] >> 8) * 64 - baseX;
  1072.                         int k9 = (anIntArray1234[i6] & 0xff) * 64 - baseY;
  1073.                         objectManager.method190(l8, aClass11Array1230, k9, worldController, abyte1);
  1074.                     }
  1075.                 }
  1076.             }
  1077.             if (aBoolean1159) {
  1078.                 for (int j3 = 0; j3 < 4; j3++) {
  1079.                     for (int k4 = 0; k4 < 13; k4++) {
  1080.                         for (int j6 = 0; j6 < 13; j6++) {
  1081.                             int l7 = anIntArrayArrayArray1129[j3][k4][j6];
  1082.                             if (l7 != -1) {
  1083.                                 int i9 = l7 >> 24 & 3;
  1084.                                 int l9 = l7 >> 1 & 3;
  1085.                                 int j10 = l7 >> 14 & 0x3ff;
  1086.                                 int l10 = l7 >> 3 & 0x7ff;
  1087.                                 int j11 = (j10 / 8 << 8) + l10 / 8;
  1088.                                 for (int l11 = 0; l11 < anIntArray1234.length; l11++) {
  1089.                                     if (anIntArray1234[l11] != j11 || aByteArrayArray1183[l11] == null)
  1090.                                     continue;
  1091.                                         objectManager.method179(i9, l9, aClass11Array1230, k4 * 8, (j10 & 7) * 8, aByteArrayArray1183[l11], (l10 & 7) * 8, j3, j6 * 8);
  1092.                                     break;
  1093.                                 }
  1094.                             }
  1095.                         }
  1096.                     }
  1097.                 }
  1098.                 for (int l4 = 0; l4 < 13; l4++) {
  1099.                     for (int k6 = 0; k6 < 13; k6++) {
  1100.                         int i8 = anIntArrayArrayArray1129[0][l4][k6];
  1101.                         if (i8 == -1)
  1102.                             objectManager.method174(k6 * 8, 8, 8, l4 * 8);
  1103.                     }
  1104.                 }
  1105.                 stream.createFrame(0);
  1106.                 for (int l6 = 0; l6 < 4; l6++) {
  1107.                     for (int j8 = 0; j8 < 13; j8++) {
  1108.                         for (int j9 = 0; j9 < 13; j9++) {
  1109.                             int i10 = anIntArrayArrayArray1129[l6][j8][j9];
  1110.                             if (i10 != -1) {
  1111.                                 int k10 = i10 >> 24 & 3;
  1112.                                 int i11 = i10 >> 1 & 3;
  1113.                                 int k11 = i10 >> 14 & 0x3ff;
  1114.                                 int i12 = i10 >> 3 & 0x7ff;
  1115.                                 int j12 = (k11 / 8 << 8) + i12 / 8;
  1116.                                 for (int k12 = 0; k12 < anIntArray1234.length; k12++) {
  1117.                                     if (anIntArray1234[k12] != j12 || aByteArrayArray1247[k12] == null)
  1118.                                         continue;
  1119.                                     byte abyte0[] = aByteArrayArray1247[k12];
  1120.                                         if (FileOperations.FileExists(signlink.findcachedir() + "Data/Maps/" + anIntArray1235[k12] + ".dat"))
  1121.                                             abyte0 = FileOperations.ReadFile(signlink.findcachedir() + "Data/Maps/" + anIntArray1235[k12] + ".dat");
  1122.                                     objectManager.method183(aClass11Array1230, worldController, k10, j8 * 8, (i12 & 7) * 8, l6, aByteArrayArray1247[k12], (k11 & 7) * 8, i11, j9 * 8);
  1123.                                     break;
  1124.                                 }
  1125.                             }
  1126.                         }
  1127.                     }
  1128.                 }
  1129.             }
  1130.             stream.createFrame(0);
  1131.             objectManager.method171(aClass11Array1230, worldController);
  1132.             main3DArea.initDrawingArea();
  1133.             stream.createFrame(0);
  1134.             int k3 = ObjectManager.anInt145;
  1135.             if (k3 > plane)
  1136.                 k3 = plane;
  1137.             if (k3 < plane - 1)
  1138.                 k3 = plane - 1;
  1139.             if (lowMem)
  1140.                 worldController.method275(ObjectManager.anInt145);
  1141.             else
  1142.                 worldController.method275(0);
  1143.             for (int i5 = 0; i5 < 104; i5++) {
  1144.                 for (int i7 = 0; i7 < 104; i7++)
  1145.                     spawnGroundItem(i5, i7);
  1146.             }
  1147.             anInt1051++;
  1148.             if (anInt1051 > 98) {
  1149.                 anInt1051 = 0;
  1150.                 stream.createFrame(150);
  1151.             }
  1152.             method63();
  1153.         } catch (Exception exception) {
  1154.         }
  1155.         ObjectDef.mruNodes1.unlinkAll();
  1156.         if (super.gameFrame != null) {
  1157.             stream.createFrame(210);
  1158.             stream.writeDWord(0x3f008edd);
  1159.         }
  1160.         if (lowMem && signlink.cache_dat != null) {
  1161.             int j = onDemandFetcher.getVersionCount(0);
  1162.             for (int i1 = 0; i1 < j; i1++) {
  1163.                 int l1 = onDemandFetcher.getModelIndex(i1);
  1164.                 if ((l1 & 0x79) == 0)
  1165.                     Model.method461(i1);
  1166.             }
  1167.         }
  1168.         System.gc();
  1169.         Texture.method367();
  1170.         onDemandFetcher.method566();
  1171.         int k = (anInt1069 - 6) / 8 - 1;
  1172.         int j1 = (anInt1069 + 6) / 8 + 1;
  1173.         int i2 = (anInt1070 - 6) / 8 - 1;
  1174.         int l2 = (anInt1070 + 6) / 8 + 1;
  1175.         if (aBoolean1141) {
  1176.             k = 49;
  1177.             j1 = 50;
  1178.             i2 = 49;
  1179.             l2 = 50;
  1180.         }
  1181.         for (int l3 = k; l3 <= j1; l3++) {
  1182.             for (int j5 = i2; j5 <= l2; j5++) {
  1183.                 if (l3 == k || l3 == j1 || j5 == i2 || j5 == l2) {
  1184.                     int j7 = onDemandFetcher.method562(0, j5, l3);
  1185.                     if (j7 != -1)
  1186.                         onDemandFetcher.method560(j7, 3);
  1187.                     int k8 = onDemandFetcher.method562(1, j5, l3);
  1188.                     if (k8 != -1)
  1189.                         onDemandFetcher.method560(k8, 3);
  1190.                 }
  1191.             }
  1192.         }
  1193.     }
  1194.  
  1195.  
  1196.     private void unlinkMRUNodes()
  1197.     {
  1198.         ObjectDef.mruNodes1.unlinkAll();
  1199.         ObjectDef.mruNodes2.unlinkAll();
  1200.         EntityDef.mruNodes.unlinkAll();
  1201.         ItemDef.mruNodes2.unlinkAll();
  1202.         ItemDef.mruNodes1.unlinkAll();
  1203.         Player.mruNodes.unlinkAll();
  1204.         SpotAnim.aMRUNodes_415.unlinkAll();
  1205.     }
  1206.  
  1207.     private void method24(int i)
  1208.     {
  1209.         int ai[] = miniMapImage.myPixels;
  1210.         int j = ai.length;
  1211.         for(int k = 0; k < j; k++)
  1212.             ai[k] = 0;
  1213.  
  1214.         for(int l = 1; l < 103; l++)
  1215.         {
  1216.             int i1 = 24628 + (103 - l) * 512 * 4;
  1217.             for(int k1 = 1; k1 < 103; k1++)
  1218.             {
  1219.                 if((byteGroundArray[i][k1][l] & 0x18) == 0)
  1220.                     worldController.method309(ai, i1, i, k1, l);
  1221.                 if(i < 3 && (byteGroundArray[i + 1][k1][l] & 8) != 0)
  1222.                     worldController.method309(ai, i1, i + 1, k1, l);
  1223.                 i1 += 4;
  1224.             }
  1225.  
  1226.         }
  1227.  
  1228.         int j1 = ((238 + (int)(Math.random() * 20D)) - 10 << 16) + ((238 + (int)(Math.random() * 20D)) - 10 << 8) + ((238 + (int)(Math.random() * 20D)) - 10);
  1229.         int l1 = (238 + (int)(Math.random() * 20D)) - 10 << 16;
  1230.         miniMapImage.method343();
  1231.         for(int i2 = 1; i2 < 103; i2++)
  1232.         {
  1233.             for(int j2 = 1; j2 < 103; j2++)
  1234.             {
  1235.                 if((byteGroundArray[i][j2][i2] & 0x18) == 0)
  1236.                     method50(i2, j1, j2, l1, i);
  1237.                 if(i < 3 && (byteGroundArray[i + 1][j2][i2] & 8) != 0)
  1238.                     method50(i2, j1, j2, l1, i + 1);
  1239.             }
  1240.  
  1241.         }
  1242.         try {
  1243.             main3DArea.initDrawingArea();
  1244.             totalMapFunctions = 0;
  1245.             for(int k2 = 0; k2 < 104; k2++)
  1246.             {
  1247.                 for(int l2 = 0; l2 < 104; l2++)
  1248.                 {
  1249.                     int i3 = worldController.method303(plane, k2, l2);
  1250.                     if(i3 != 0)
  1251.                     {
  1252.                         i3 = i3 >> 14 & 0x7fff;
  1253.                         int j3 = ObjectDef.forID(i3).anInt746;
  1254.                         if(j3 >= 0)
  1255.                         {
  1256.                             int k3 = k2;
  1257.                             int l3 = l2;
  1258.                             if(j3 != 22 && j3 != 29 && j3 != 34 && j3 != 36 && j3 != 46 && j3 != 47 && j3 != 48)
  1259.                             {
  1260.                                 byte byte0 = 104;
  1261.                                 byte byte1 = 104;
  1262.                                 int ai1[][] = aClass11Array1230[plane].anIntArrayArray294;
  1263.                                 for(int i4 = 0; i4 < 10; i4++)
  1264.                                 {
  1265.                                     int j4 = (int)(Math.random() * 4D);
  1266.                                     if(j4 == 0 && k3 > 0 && k3 > k2 - 3 && (ai1[k3 - 1][l3] & 0x1280108) == 0)
  1267.                                         k3--;
  1268.                                     if(j4 == 1 && k3 < byte0 - 1 && k3 < k2 + 3 && (ai1[k3 + 1][l3] & 0x1280180) == 0)
  1269.                                         k3++;
  1270.                                     if(j4 == 2 && l3 > 0 && l3 > l2 - 3 && (ai1[k3][l3 - 1] & 0x1280102) == 0)
  1271.                                         l3--;
  1272.                                     if(j4 == 3 && l3 < byte1 - 1 && l3 < l2 + 3 && (ai1[k3][l3 + 1] & 0x1280120) == 0)
  1273.                                         l3++;
  1274.                                 }
  1275.  
  1276.                             }
  1277.                             currentMapFunctions[totalMapFunctions] = mapFunctions[j3];
  1278.                             mapFunctionX[totalMapFunctions] = k3;
  1279.                             mapFunctionY[totalMapFunctions] = l3;
  1280.                             totalMapFunctions++;
  1281.                         }
  1282.                     }
  1283.                 }
  1284.  
  1285.             }
  1286.         } catch (NullPointerException ex) {
  1287.            
  1288.         }
  1289.     }
  1290.  
  1291.     private void spawnGroundItem(int i, int j)
  1292.     {
  1293.         NodeList class19 = groundArray[plane][i][j];
  1294.         if(class19 == null)
  1295.         {
  1296.             worldController.method295(plane, i, j);
  1297.             return;
  1298.         }
  1299.         int k = 0xfa0a1f01;
  1300.         Object obj = null;
  1301.         for(Item item = (Item)class19.reverseGetFirst(); item != null; item = (Item)class19.reverseGetNext())
  1302.         {
  1303.             ItemDef itemDef = ItemDef.forID(item.ID);
  1304.             int l = itemDef.value;
  1305.             if(itemDef.stackable)
  1306.                 l *= item.anInt1559 + 1;
  1307. //  notifyItemSpawn(item, i + baseX, j + baseY);
  1308.    
  1309.             if(l > k)
  1310.             {
  1311.                 k = l;
  1312.                 obj = item;
  1313.             }
  1314.         }
  1315.  
  1316.         class19.insertTail(((Node) (obj)));
  1317.         Object obj1 = null;
  1318.         Object obj2 = null;
  1319.         for(Item class30_sub2_sub4_sub2_1 = (Item)class19.reverseGetFirst(); class30_sub2_sub4_sub2_1 != null; class30_sub2_sub4_sub2_1 = (Item)class19.reverseGetNext())
  1320.         {
  1321.             if(class30_sub2_sub4_sub2_1.ID != ((Item) (obj)).ID && obj1 == null)
  1322.                 obj1 = class30_sub2_sub4_sub2_1;
  1323.             if(class30_sub2_sub4_sub2_1.ID != ((Item) (obj)).ID && class30_sub2_sub4_sub2_1.ID != ((Item) (obj1)).ID && obj2 == null)
  1324.                 obj2 = class30_sub2_sub4_sub2_1;
  1325.         }
  1326.  
  1327.         int i1 = i + (j << 7) + 0x60000000;
  1328.         worldController.method281(i, i1, ((Animable) (obj1)), method42(plane, j * 128 + 64, i * 128 + 64), ((Animable) (obj2)), ((Animable) (obj)), plane, j);
  1329.     }
  1330.  
  1331.     private void method26(boolean flag)
  1332.     {
  1333.         for(int j = 0; j < npcCount; j++)
  1334.         {
  1335.             NPC npc = npcArray[npcIndices[j]];
  1336.             int k = 0x20000000 + (npcIndices[j] << 14);
  1337.             if(npc == null || !npc.isVisible() || npc.desc.aBoolean93 != flag)
  1338.                 continue;
  1339.             int l = npc.x >> 7;
  1340.             int i1 = npc.y >> 7;
  1341.             if(l < 0 || l >= 104 || i1 < 0 || i1 >= 104)
  1342.                 continue;
  1343.             if(npc.anInt1540 == 1 && (npc.x & 0x7f) == 64 && (npc.y & 0x7f) == 64)
  1344.             {
  1345.                 if(anIntArrayArray929[l][i1] == anInt1265)
  1346.                     continue;
  1347.                 anIntArrayArray929[l][i1] = anInt1265;
  1348.             }
  1349.             if(!npc.desc.aBoolean84)
  1350.                 k += 0x80000000;
  1351.             worldController.method285(plane, npc.anInt1552, method42(plane, npc.y, npc.x), k, npc.y, (npc.anInt1540 - 1) * 64 + 60, npc.x, npc, npc.aBoolean1541);
  1352.         }
  1353.     }
  1354.  
  1355.  
  1356.  
  1357.     private void loadError()
  1358.     {
  1359.         String s = "ondemand";//was a constant parameter
  1360.         System.out.println(s);
  1361.         try
  1362.         {
  1363.             getAppletContext().showDocument(new URL(getCodeBase(), "loaderror_" + s + ".html"));
  1364.         }
  1365.         catch(Exception exception)
  1366.         {
  1367.             exception.printStackTrace();
  1368.         }
  1369.         do
  1370.             try
  1371.             {
  1372.                 Thread.sleep(1000L);
  1373.             }
  1374.             catch(Exception _ex) { }
  1375.         while(true);
  1376.     }
  1377.    
  1378.     private int hoverSpriteId = -1;
  1379.     private void buildInterfaceMenu(int xPadding, RSInterface rsinterface, int xPos, int yPadding, int yPos, int yScrollPoint) {
  1380.         try {
  1381.             if(rsinterface.type != 0 || rsinterface.children == null || rsinterface.isMouseoverTriggered)
  1382.                 return;
  1383.             if(xPos < xPadding || yPos < yPadding || xPos > xPadding + rsinterface.width || yPos > yPadding + rsinterface.height)
  1384.                 return;
  1385.             int totalChildren = rsinterface.children.length;
  1386.             for(int childIndex = 0; childIndex < totalChildren; childIndex++) {
  1387.                 int xSpritePos = rsinterface.childX[childIndex] + xPadding;
  1388.                 int ySpritePos = (rsinterface.childY[childIndex] + yPadding) - yScrollPoint;
  1389.                 RSInterface rsinterfacechildren = RSInterface.interfaceCache[rsinterface.children[childIndex]];
  1390.                 xSpritePos += rsinterfacechildren.anInt263;
  1391.                 ySpritePos += rsinterfacechildren.anInt265;
  1392.                 if((rsinterfacechildren.mOverInterToTrigger >= 0 || rsinterfacechildren.textHoverColour != 0)
  1393.                 && xPos >= xSpritePos
  1394.                 && xPos < xSpritePos + rsinterfacechildren.width
  1395.                 && yPos >= ySpritePos
  1396.                 && yPos < ySpritePos + rsinterfacechildren.height) {
  1397.                     if(rsinterfacechildren.mOverInterToTrigger >= 0) {
  1398.                         hoverChildId = rsinterfacechildren.mOverInterToTrigger;
  1399.                         hoverSpriteId = hoverChildId;
  1400.                     } else {
  1401.                         hoverChildId = rsinterfacechildren.id;
  1402.                         hoverSpriteId = hoverChildId;
  1403.                     }
  1404.                 }
  1405.                 if (rsinterfacechildren.type == 8 &&  xPos >= xSpritePos && xPos < xSpritePos + rsinterfacechildren.width && yPos >= ySpritePos && yPos < ySpritePos + rsinterfacechildren.height) {
  1406.                     hoverToggleChildId = rsinterfacechildren.id;//
  1407.                 }
  1408.                
  1409.                 if(rsinterfacechildren.type == 0)
  1410.                 {
  1411.                     buildInterfaceMenu(xSpritePos, rsinterfacechildren, xPos, ySpritePos, yPos, rsinterfacechildren.scrollPosition);
  1412.                     if(rsinterfacechildren.scrollMax > rsinterfacechildren.height)
  1413.                         method65(xSpritePos + rsinterfacechildren.width, rsinterfacechildren.height, xPos, yPos, rsinterfacechildren, ySpritePos, true, rsinterfacechildren.scrollMax);
  1414.                 } else
  1415.                 {
  1416.                     if(rsinterfacechildren.atActionType == 1 && xPos >= xSpritePos && yPos >= ySpritePos && xPos < xSpritePos + rsinterfacechildren.width && yPos < ySpritePos + rsinterfacechildren.height)
  1417.                     {
  1418.                         boolean flag = false;
  1419.                         if(rsinterfacechildren.contentType != 0)
  1420.                             flag = buildFriendsListMenu(rsinterfacechildren);
  1421.                         if(!flag)
  1422.                         {
  1423.                             menuActionName[menuActionRow] = rsinterfacechildren.tooltip + ((myPrivilege != 0) ? ", @gre@(@whi@" + rsinterfacechildren.id + "@gre@)" : "");
  1424.                             menuActionID[menuActionRow] = 315;
  1425.                             menuActionCmd3[menuActionRow] = rsinterfacechildren.id;
  1426.                             menuActionRow++;
  1427.                         }
  1428.                     }
  1429.                     if(rsinterfacechildren.atActionType == 2 && spellSelected == 0 && xPos >= xSpritePos && yPos >= ySpritePos && xPos < xSpritePos + rsinterfacechildren.width && yPos < ySpritePos + rsinterfacechildren.height) {
  1430.                         String s = rsinterfacechildren.selectedActionName;
  1431.                         if(s.indexOf(" ") != -1)
  1432.                             s = s.substring(0, s.indexOf(" "));
  1433. if (rsinterfacechildren.spellName.endsWith("Rush")
  1434.                         || rsinterfacechildren.spellName.endsWith("Burst")
  1435.                         || rsinterfacechildren.spellName.endsWith("Blitz")
  1436.                         || rsinterfacechildren.spellName.endsWith("Barrage") && !rsinterfacechildren.spellName.equals("Miasmic Barrage")) {
  1437.                             menuActionName[menuActionRow] = "Autocast @gre@" + rsinterfacechildren.spellName + ((myPrivilege != 0) ? ", " + rsinterfacechildren.id : "");
  1438.                             menuActionID[menuActionRow] = 104;
  1439.                             menuActionCmd3[menuActionRow] = rsinterfacechildren.id;
  1440.                             menuActionRow++;
  1441.                         }
  1442.                         menuActionName[menuActionRow] = s + " @gre@" + rsinterfacechildren.spellName + ((myPrivilege != 0) ? ", " + rsinterfacechildren.id : "");
  1443.                         menuActionID[menuActionRow] = 626;
  1444.                         menuActionCmd3[menuActionRow] = rsinterfacechildren.id;
  1445.                         menuActionRow++;                   
  1446.                         if (rsinterfacechildren.spellName.endsWith("strike")
  1447.                         || rsinterfacechildren.spellName.endsWith("bolt")
  1448.                         || rsinterfacechildren.spellName.equals("Crumble undead")
  1449.                         || rsinterfacechildren.spellName.endsWith("blast")
  1450.                         || rsinterfacechildren.spellName.endsWith("wave")
  1451.                         || rsinterfacechildren.spellName.equals("Claws of Guthix")
  1452.                         || rsinterfacechildren.spellName.equals("Flames of Zamorak")
  1453.                         || rsinterfacechildren.spellName.equals("Magic Dart")) {
  1454.                             menuActionName[menuActionRow] = "Autocast @gre@" + rsinterfacechildren.spellName + ((myPrivilege != 0) ? ", " + rsinterfacechildren.id : "");
  1455.                             menuActionID[menuActionRow] = 104;
  1456.                             menuActionCmd3[menuActionRow] = rsinterfacechildren.id;
  1457.                             menuActionRow++;
  1458.                         }
  1459.                     }
  1460.                     if(rsinterfacechildren.atActionType == 3 && xPos >= xSpritePos && yPos >= ySpritePos && xPos < xSpritePos + rsinterfacechildren.width && yPos < ySpritePos + rsinterfacechildren.height)
  1461.                     {
  1462.                         menuActionName[menuActionRow] = "Close" + ((myPrivilege != 0) ? ", " + rsinterfacechildren.id : "");
  1463.                         menuActionID[menuActionRow] = 200;
  1464.                         menuActionCmd3[menuActionRow] = rsinterfacechildren.id;
  1465.                         menuActionRow++;
  1466.                     }
  1467.                     if(rsinterfacechildren.atActionType == 4 && xPos >= xSpritePos && yPos >= ySpritePos && xPos < xSpritePos + rsinterfacechildren.width && yPos < ySpritePos + rsinterfacechildren.height) {             
  1468.                         menuActionName[menuActionRow] = rsinterfacechildren.tooltip + ((myPrivilege != 0) ? ", @gre@(@whi@" + rsinterfacechildren.id + "@gre@)" : "");
  1469.                         menuActionID[menuActionRow] = 169;
  1470.                         menuActionCmd3[menuActionRow] = rsinterfacechildren.id;
  1471.                         menuActionRow++;
  1472.                         if (rsinterfacechildren.hoverText != null) {
  1473.                             //drawHoverBox(xPos, yPadding, rsinterfacechildren.hoverText);
  1474.                             //System.out.println("DRAWING INTERFACE: " + rsinterfacechildren.hoverText);
  1475.                         }
  1476.                     }
  1477.                     if(rsinterfacechildren.atActionType == 5 && xPos >= xSpritePos && yPos >= ySpritePos && xPos < xSpritePos + rsinterfacechildren.width && yPos < ySpritePos + rsinterfacechildren.height) {
  1478.                         if(rsinterfacechildren.tooltip.toLowerCase().startsWith("transform")) {
  1479.                         rsinterfacechildren.itemActions = new String[5];
  1480.                         rsinterfacechildren.itemActions[0] = "Transform";
  1481.                         rsinterfacechildren.itemActions[1] = "Transform-5";
  1482.                         rsinterfacechildren.itemActions[2] = "Transform-10";
  1483.                         rsinterfacechildren.itemActions[3] = "Transform-all";
  1484.                         rsinterfacechildren.itemActions[4] = "Transform-X";
  1485.                             if(rsinterfacechildren.itemActions != null) {
  1486.                                 for(int j4 = 4; j4 >= 0; j4--)
  1487.                                     if(rsinterfacechildren.itemActions[j4] != null) {
  1488.                                         menuActionName[menuActionRow] = rsinterfacechildren.tooltip.replaceAll("Transform",rsinterfacechildren.itemActions[j4]);
  1489.                                         if(j4 == 0)
  1490.                                             menuActionID[menuActionRow] = 632;//1
  1491.                                         if(j4 == 1)
  1492.                                             menuActionID[menuActionRow] = 78;//5
  1493.                                         if(j4 == 2)
  1494.                                             menuActionID[menuActionRow] = 867;//10
  1495.                                         if(j4 == 3)
  1496.                                             menuActionID[menuActionRow] = 431;//all
  1497.                                         if(j4 == 4)
  1498.                                             menuActionID[menuActionRow] = 53;//x
  1499.                                         menuActionCmd1[menuActionRow] = rsinterfacechildren.itemSpriteId1;
  1500.                                         menuActionCmd2[menuActionRow] = rsinterfacechildren.itemSpriteIndex;
  1501.                                         menuActionCmd3[menuActionRow] = rsinterfacechildren.parentID;
  1502.                                         menuActionRow++;
  1503.                                     }
  1504.                             }
  1505.                         } else {
  1506.                             menuActionName[menuActionRow] = rsinterfacechildren.tooltip + ((myPrivilege != 0) ? ", @gre@(@whi@" + rsinterfacechildren.id + "@gre@)" : "");
  1507.                             menuActionID[menuActionRow] = 646;
  1508.                             menuActionCmd3[menuActionRow] = rsinterfacechildren.id;
  1509.                             menuActionRow++;
  1510.                         }
  1511.                     }
  1512.                     if(rsinterfacechildren.atActionType == 6 && !aBoolean1149 && xPos >= xSpritePos && yPos >= ySpritePos && xPos < xSpritePos + rsinterfacechildren.width && yPos < ySpritePos + rsinterfacechildren.height)
  1513.                     {
  1514.                         menuActionName[menuActionRow] = rsinterfacechildren.tooltip + ((myPrivilege != 0) ? ", @gre@(@whi@" + rsinterfacechildren.id + "@gre@)" : "");
  1515.                         menuActionID[menuActionRow] = 679;
  1516.                         menuActionCmd3[menuActionRow] = rsinterfacechildren.id;
  1517.                         menuActionRow++;
  1518.                     }
  1519.                     if(rsinterfacechildren.type == 2)
  1520.                     {
  1521.                         int k2 = 0;
  1522.                         for(int l2 = 0; l2 < rsinterfacechildren.height; l2++)
  1523.                         {
  1524.                             for(int i3 = 0; i3 < rsinterfacechildren.width; i3++)
  1525.                             {
  1526.                                 int j3 = xSpritePos + i3 * (32 + rsinterfacechildren.invSpritePadX);
  1527.                                 int k3 = ySpritePos + l2 * (32 + rsinterfacechildren.invSpritePadY);
  1528.                                 if(k2 < 20)
  1529.                                 {
  1530.                                     j3 += rsinterfacechildren.spritesX[k2];
  1531.                                     k3 += rsinterfacechildren.spritesY[k2];
  1532.                                 }
  1533.                                 if(xPos >= j3 && yPos >= k3 && xPos < j3 + 32 && yPos < k3 + 32)
  1534.                                 {
  1535.                                     mouseInvInterfaceIndex = k2;
  1536.                                     lastActiveInvInterface = rsinterfacechildren.id;
  1537.                                     if(rsinterfacechildren.inv[k2] > 0)
  1538.                                     {
  1539.                                         ItemDef itemDef = ItemDef.forID(rsinterfacechildren.inv[k2] - 1);
  1540.                                         if(itemSelected == 1 && rsinterfacechildren.isInventoryInterface)
  1541.                                         {
  1542.                                             if(rsinterfacechildren.id != anInt1284 || k2 != itemSlotUsedOn)
  1543.                                             {
  1544.                                                 menuActionName[menuActionRow] = "Use " + selectedItemName + " with @lre@" + itemDef.name;
  1545.                                                 menuActionID[menuActionRow] = 870;
  1546.                                                 menuActionCmd1[menuActionRow] = itemDef.id;
  1547.                                                 menuActionCmd2[menuActionRow] = k2;
  1548.                                                 menuActionCmd3[menuActionRow] = rsinterfacechildren.id;
  1549.                                                 menuActionRow++;
  1550.                                             }
  1551.                                         } else
  1552.                                         if(spellSelected == 1 && rsinterfacechildren.isInventoryInterface)
  1553.                                         {
  1554.                                             if((spellUsableOn & 0x10) == 16)
  1555.                                             {
  1556.                                                 menuActionName[menuActionRow] = spellTooltip + " @lre@" + itemDef.name;
  1557.                                                 menuActionID[menuActionRow] = 543;
  1558.                                                 menuActionCmd1[menuActionRow] = itemDef.id;
  1559.                                                 menuActionCmd2[menuActionRow] = k2;
  1560.                                                 menuActionCmd3[menuActionRow] = rsinterfacechildren.id;
  1561.                                                 menuActionRow++;
  1562.                                             }
  1563.                                         } else
  1564.                                         {
  1565.                                             if(rsinterfacechildren.isInventoryInterface)
  1566.                                             {
  1567.                                                 for(int l3 = 4; l3 >= 3; l3--)
  1568.                                                     if(itemDef.itemActions != null && itemDef.itemActions[l3] != null)
  1569.                                                     {
  1570.                                                         menuActionName[menuActionRow] = itemDef.itemActions[l3] + " @lre@" + itemDef.name;
  1571.                                                         if(l3 == 3)
  1572.                                                             menuActionID[menuActionRow] = 493;
  1573.                                                         if(l3 == 4)
  1574.                                                             menuActionID[menuActionRow] = 847;
  1575.                                                         menuActionCmd1[menuActionRow] = itemDef.id;
  1576.                                                         menuActionCmd2[menuActionRow] = k2;
  1577.                                                         menuActionCmd3[menuActionRow] = rsinterfacechildren.id;
  1578.                                                         menuActionRow++;
  1579.                                                     } else
  1580.                                                     if(l3 == 4)
  1581.                                                     {
  1582.                                                         menuActionName[menuActionRow] = "Drop @lre@" + itemDef.name;
  1583.                                                         menuActionID[menuActionRow] = 847;
  1584.                                                         menuActionCmd1[menuActionRow] = itemDef.id;
  1585.                                                         menuActionCmd2[menuActionRow] = k2;
  1586.                                                         menuActionCmd3[menuActionRow] = rsinterfacechildren.id;
  1587.                                                         menuActionRow++;
  1588.                                                     }
  1589.  
  1590.                                             }
  1591.                                             if(rsinterfacechildren.usableItemInterface)
  1592.                                             {
  1593.                                                 menuActionName[menuActionRow] = "Use @lre@" + itemDef.name;
  1594.                                                 menuActionID[menuActionRow] = 447;
  1595.                                                 menuActionCmd1[menuActionRow] = itemDef.id;
  1596.                                                 //k2 = inventory spot
  1597.                                                 //System.out.println(k2);
  1598.                                                 menuActionCmd2[menuActionRow] = k2;
  1599.                                                 menuActionCmd3[menuActionRow] = rsinterfacechildren.id;
  1600.                                                 menuActionRow++;
  1601.                                             }
  1602.                                             if(rsinterfacechildren.isInventoryInterface && itemDef.itemActions != null)
  1603.                                             {
  1604.                                                 for(int i4 = 2; i4 >= 0; i4--)
  1605.                                                     if(itemDef.itemActions[i4] != null)
  1606.                                                     {
  1607.                                                         menuActionName[menuActionRow] = itemDef.itemActions[i4] + " @lre@" + itemDef.name;
  1608.                                                         if(i4 == 0)
  1609.                                                             menuActionID[menuActionRow] = 74;
  1610.                                                         if(i4 == 1)
  1611.                                                             menuActionID[menuActionRow] = 454;
  1612.                                                         if(i4 == 2)
  1613.                                                             menuActionID[menuActionRow] = 539;
  1614.                                                         menuActionCmd1[menuActionRow] = itemDef.id;
  1615.                                                         menuActionCmd2[menuActionRow] = k2;
  1616.                                                         menuActionCmd3[menuActionRow] = rsinterfacechildren.id;
  1617.                                                         menuActionRow++;
  1618.                                                     }
  1619.  
  1620.                                             }
  1621.                                             if(rsinterfacechildren.itemActions != null)
  1622.                                             {
  1623.                                                 for(int j4 = 4; j4 >= 0; j4--)
  1624.                                                     if(rsinterfacechildren.itemActions[j4] != null)
  1625.                                                     {
  1626.                                                         menuActionName[menuActionRow] = rsinterfacechildren.itemActions[j4] + " @lre@" + itemDef.name;
  1627.                                                         if(j4 == 0)
  1628.                                                             menuActionID[menuActionRow] = 632;//1
  1629.                                                         if(j4 == 1)
  1630.                                                             menuActionID[menuActionRow] = 78;//5
  1631.                                                         if(j4 == 2)
  1632.                                                             menuActionID[menuActionRow] = 867;//10
  1633.                                                         if(j4 == 3)
  1634.                                                             menuActionID[menuActionRow] = 431;//all
  1635.                                                         if(j4 == 4)
  1636.                                                             menuActionID[menuActionRow] = 53;//x
  1637.                                                         menuActionCmd1[menuActionRow] = itemDef.id;
  1638.                                                         menuActionCmd2[menuActionRow] = k2;
  1639.                                                         menuActionCmd3[menuActionRow] = rsinterfacechildren.id;
  1640.                                                         menuActionRow++;
  1641.                                                     }
  1642.  
  1643.                                             }
  1644.                                             menuActionName[menuActionRow] = "Examine @lre@" + itemDef.name + ((myPrivilege != 0) ? ", @gre@(@whi@" + (rsinterfacechildren.inv[k2] - 1) + "@gre@)" : "");
  1645.                                             menuActionID[menuActionRow] = 1125;
  1646.                                             menuActionCmd1[menuActionRow] = itemDef.id;
  1647.                                             menuActionCmd2[menuActionRow] = k2;
  1648.                                             menuActionCmd3[menuActionRow] = rsinterfacechildren.id;
  1649.                                             menuActionRow++;
  1650.                                         }
  1651.                                     }
  1652.                                 }
  1653.                                 k2++;
  1654.                             }
  1655.  
  1656.                         }
  1657.  
  1658.                     }
  1659.                 }
  1660.             }
  1661.         } catch(NullPointerException ex) {
  1662.            
  1663.         }
  1664.     }
  1665.  
  1666.     public void drawScrollbar(int totalHeight, int currentPos, int yPos, int xPos, int ScrollsTotalLength,boolean hdStyle) {
  1667.         double repeats = (totalHeight - 32) / 5;
  1668.         for(int i = 0; i <= repeats; i++)
  1669.             scrollBar[0 + (hdStyle && toggleFullscreen ? 4 : 0)].drawSprite(xPos, (yPos + 16) + (i * 5));
  1670.            
  1671.         int scrollLength = ((totalHeight - 32) * totalHeight) / ScrollsTotalLength;
  1672.         if(scrollLength < 8)
  1673.             scrollLength = 8;
  1674.         int calcScrollPos = ((totalHeight - 32 - scrollLength) * currentPos) / (ScrollsTotalLength - totalHeight);
  1675.        
  1676.         int frontStartY = (yPos + 16 + calcScrollPos);
  1677.         int frontFinishY = (yPos + 16 + calcScrollPos + scrollLength - 5);
  1678.         for(int frontY = frontStartY; frontY < frontFinishY; frontY += 5)
  1679.             scrollBar[2 + (hdStyle && toggleFullscreen ? 4 : 0)].drawSprite(xPos, frontY);
  1680.        
  1681.         scrollBar[1 + (hdStyle && toggleFullscreen ? 4 : 0)].drawSprite(xPos,frontStartY);
  1682.         scrollBar[3 + (hdStyle && toggleFullscreen ? 4 : 0)].drawSprite(xPos,frontFinishY);
  1683.         scrollArrow[0 + (hdStyle && toggleFullscreen ? 2 : 0)].drawSprite(xPos, yPos);
  1684.         scrollArrow[1 + (hdStyle && toggleFullscreen ? 2 : 0)].drawSprite(xPos, (yPos + totalHeight) - 16);
  1685.     }
  1686.  
  1687.     private void updateNPCs(Stream stream, int i)
  1688.     {
  1689.         anInt839 = 0;
  1690.         anInt893 = 0;
  1691.         method139(stream);
  1692.         method46(i, stream);
  1693.         method86(stream);
  1694.         for(int k = 0; k < anInt839; k++)
  1695.         {
  1696.             int l = anIntArray840[k];
  1697.             if(npcArray[l].anInt1537 != loopCycle)
  1698.             {
  1699.                 npcArray[l].desc = null;
  1700.                 npcArray[l] = null;
  1701.             }
  1702.         }
  1703.  
  1704.         if(stream.currentOffset != i)
  1705.         {
  1706.             signlink.reporterror(myUsername + " size mismatch in getnpcpos - pos:" + stream.currentOffset + " psize:" + i);
  1707.             throw new RuntimeException("eek");
  1708.         }
  1709.         for(int i1 = 0; i1 < npcCount; i1++)
  1710.             if(npcArray[npcIndices[i1]] == null)
  1711.             {
  1712.                 signlink.reporterror(myUsername + " null entry in npc list - pos:" + i1 + " size:" + npcCount);
  1713.                 throw new RuntimeException("eek");
  1714.             }
  1715.  
  1716.     }
  1717.  
  1718.     private int cButtonHPos;
  1719.     private int cButtonHCPos;
  1720.     private int cButtonCPos;
  1721.  
  1722.     private void processChatModeClick(int paddingX,int paddingY) {
  1723.         int clickX = super.saveClickX - paddingX;
  1724.         int clickY = super.saveClickY - paddingY;
  1725.         int mouseX = super.mouseX - paddingX;
  1726.         int mouseY = super.mouseY - paddingY;
  1727.         if(mouseX >= 5 && mouseX <= 61 && mouseY >= 482 && mouseY <= 503) {
  1728.             cButtonHPos = 0;
  1729.             aBoolean1233 = true;
  1730.             inputTaken = true;
  1731.         } else if(mouseX >= 71 && mouseX <= 127 && mouseY >= 482 && mouseY <= 503) {
  1732.             cButtonHPos = 1;
  1733.             aBoolean1233 = true;
  1734.             inputTaken = true;
  1735.         } else if(mouseX >= 137 && mouseX <= 193 && mouseY >= 482 && mouseY <= 503) {
  1736.             cButtonHPos = 2;
  1737.             aBoolean1233 = true;
  1738.             inputTaken = true;
  1739.         } else if(mouseX >= 203 && mouseX <= 259 && mouseY >= 482 && mouseY <= 503) {
  1740.             cButtonHPos = 3;
  1741.             aBoolean1233 = true;
  1742.             inputTaken = true;
  1743.         } else if(mouseX >= 269 && mouseX <= 325 && mouseY >= 482 && mouseY <= 503) {
  1744.             cButtonHPos = 4;
  1745.             aBoolean1233 = true;
  1746.             inputTaken = true;
  1747.         } else if(mouseX >= 335 && mouseX <= 391 && mouseY >= 482 && mouseY <= 503) {
  1748.             cButtonHPos = 5;
  1749.             aBoolean1233 = true;
  1750.             inputTaken = true;
  1751.         } else if(mouseX >= 404 && mouseX <= 515 && mouseY >= 482 && mouseY <= 503) {
  1752.             cButtonHPos = 6;
  1753.             aBoolean1233 = true;
  1754.             inputTaken = true;
  1755.         } else {
  1756.             cButtonHPos = -1;
  1757.             aBoolean1233 = true;
  1758.             inputTaken = true;
  1759.         }
  1760.         if(super.clickMode3 == 1) {
  1761.             if(clickX >= 5 && clickX <= 61 && clickY >= 482 && clickY <= 505) {
  1762.                 cButtonCPos = 0;
  1763.                 chatTypeView = 0;
  1764.                 aBoolean1233 = true;
  1765.                 inputTaken = true;
  1766.             } else if(clickX >= 71 && clickX <= 127 && clickY >= 482 && clickY <= 505) {
  1767.                 cButtonCPos = 1;
  1768.                 chatTypeView = 5;
  1769.                 aBoolean1233 = true;
  1770.                 inputTaken = true;
  1771.             } else if(clickX >= 137 && clickX <= 193 && clickY >= 482 && clickY <= 505) {
  1772.                 cButtonCPos = 2;
  1773.                 chatTypeView = 1;
  1774.                 aBoolean1233 = true;
  1775.                 inputTaken = true;
  1776.             } else if(clickX >= 203 && clickX <= 259 && clickY >= 482 && clickY <= 505) {
  1777.                 cButtonCPos = 3;
  1778.                 chatTypeView = 2;
  1779.                 aBoolean1233 = true;
  1780.                 inputTaken = true;
  1781.             } else if(clickX >= 269 && clickX <= 325 && clickY >= 482 && clickY <= 505) {
  1782.                 cButtonCPos = 4;
  1783.                 chatTypeView = 11;
  1784.                 aBoolean1233 = true;
  1785.                 inputTaken = true;
  1786.             } else if(clickX >= 335 && clickX <= 391 && clickY >= 482 && clickY <= 505) {
  1787.                 cButtonCPos = 5;
  1788.                 chatTypeView = 3;
  1789.                 aBoolean1233 = true;
  1790.                 inputTaken = true;
  1791.             } else if(clickX >= 404 && clickX <= 515 && clickY >= 482 && clickY <= 505) {
  1792.                 if(openInterfaceID == -1 && myPrivilege >= 1) {
  1793.                     clearTopInterfaces();
  1794.                     reportAbuseInput = "";
  1795.                     canMute = false;
  1796.                     for(int i = 0; i < RSInterface.interfaceCache.length; i++) {
  1797.                         if(RSInterface.interfaceCache[i] == null || RSInterface.interfaceCache[i].contentType != 600)
  1798.                             continue;
  1799.                         reportAbuseInterfaceID = openInterfaceID = RSInterface.interfaceCache[i].parentID;
  1800.                         break;
  1801.                     }
  1802.                 } else {
  1803.                     pushMessage("Staff Pannel Is Disabled for you! Sorry :L", 0, "");
  1804.                 }
  1805.             }
  1806.         }
  1807.     }
  1808.  
  1809.     private void method33(int i)
  1810.     {
  1811.         int j = Varp.cache[i].anInt709;
  1812.         if(j == 0)
  1813.             return;
  1814.         int k = variousSettings[i];
  1815.         if(j == 1)
  1816.         {
  1817.             if(k == 1)
  1818.                 Texture.method372(0.90000000000000002D);
  1819.             if(k == 2)
  1820.                 Texture.method372(0.80000000000000004D);
  1821.             if(k == 3)
  1822.                 Texture.method372(0.69999999999999996D);
  1823.             if(k == 4)
  1824.                 Texture.method372(0.59999999999999998D);
  1825.             ItemDef.mruNodes1.unlinkAll();
  1826.             welcomeScreenRaised = true;
  1827.         }
  1828.         if(j == 3)
  1829.         {
  1830.             boolean flag1 = musicEnabled;
  1831.             if(k == 0)
  1832.             {
  1833.                 adjustVolume(musicEnabled, 0);
  1834.                 musicEnabled = true;
  1835.             }
  1836.             if(k == 1)
  1837.             {
  1838.                 adjustVolume(musicEnabled, -400);
  1839.                 musicEnabled = true;
  1840.             }
  1841.             if(k == 2)
  1842.             {
  1843.                 adjustVolume(musicEnabled, -800);
  1844.                 musicEnabled = true;
  1845.             }
  1846.             if(k == 3)
  1847.             {
  1848.                 adjustVolume(musicEnabled, -1200);
  1849.                 musicEnabled = true;
  1850.             }
  1851.             if(k == 4)
  1852.                 musicEnabled = false;
  1853.             if(musicEnabled != flag1 && !lowMem)
  1854.             {
  1855.                 if(musicEnabled)
  1856.                 {
  1857.                     nextSong = currentSong;
  1858.                     songChanging = true;
  1859.                     onDemandFetcher.method558(2, nextSong);
  1860.                 } else
  1861.                 {
  1862.                     stopMidi();
  1863.                 }
  1864.                 prevSong = 0;
  1865.             }
  1866.         }
  1867.         if(j == 4)
  1868.         {
  1869.             if(k == 0)
  1870.             {
  1871.                 aBoolean848 = true;
  1872.                 setWaveVolume(0);
  1873.             }
  1874.             if(k == 1)
  1875.             {
  1876.                 aBoolean848 = true;
  1877.                 setWaveVolume(-400);
  1878.             }
  1879.             if(k == 2)
  1880.             {
  1881.                 aBoolean848 = true;
  1882.                 setWaveVolume(-800);
  1883.             }
  1884.             if(k == 3)
  1885.             {
  1886.                 aBoolean848 = true;
  1887.                 setWaveVolume(-1200);
  1888.             }
  1889.             if(k == 4)
  1890.                 aBoolean848 = false;
  1891.         }
  1892.         if(j == 5)
  1893.             anInt1253 = k;
  1894.         if(j == 6)
  1895.             anInt1249 = k;
  1896.         if(j == 8)
  1897.         {
  1898.             splitPrivateChat = k;
  1899.             inputTaken = true;
  1900.         }
  1901.         if(j == 9)
  1902.             anInt913 = k;
  1903.     }
  1904.  
  1905.     private void updateEntities() {
  1906.         try{
  1907.             int anInt974 = 0;
  1908.             for(int j = -1; j < playerCount + npcCount; j++) {
  1909.             Object obj;
  1910.             if(j == -1)
  1911.                 obj = myPlayer;
  1912.             else
  1913.             if(j < playerCount)
  1914.                 obj = playerArray[playerIndices[j]];
  1915.             else
  1916.                 obj = npcArray[npcIndices[j - playerCount]];
  1917.             if(obj == null || !((Entity) (obj)).isVisible())
  1918.                 continue;
  1919.             if(obj instanceof NPC) {
  1920.                 EntityDef entityDef = ((NPC)obj).desc;
  1921.                 if(entityDef.childrenIDs != null)
  1922.                     entityDef = entityDef.method161();
  1923.                 if(entityDef == null)
  1924.                     continue;
  1925.             }
  1926.             if(j < playerCount) {
  1927.                 int l = 30;
  1928.                 Player player = (Player)obj;
  1929.                 if(player.headIcon >= 0) {
  1930.                     npcScreenPos(((Entity) (obj)), ((Entity) (obj)).height + 15);
  1931.                     if(spriteDrawX > -1) {
  1932.                         if (player.skullIcon < 2) {
  1933.                             skullIcons[player.skullIcon].drawSprite(spriteDrawX - 12, spriteDrawY - l);
  1934.                             l += 25;
  1935.                         }
  1936.                         if (player.headIcon < 18) {
  1937.                             headIcons[player.headIcon].drawSprite(spriteDrawX - 12, spriteDrawY - l);
  1938.                             l += 18;
  1939.                         }
  1940.                     }
  1941.                 }
  1942.                 if(j >= 0 && hintType == 10 && hintArrowPlayerID == playerIndices[j]) {
  1943.                     npcScreenPos(((Entity) (obj)), ((Entity) (obj)).height + 15);
  1944.                     if(spriteDrawX > -1)
  1945.                         headIconsHint[player.hintIcon].drawSprite(spriteDrawX - 12, spriteDrawY - l);
  1946.                 }
  1947.             } else {
  1948.                 EntityDef entityDef_1 = ((NPC)obj).desc;
  1949.                 if(entityDef_1.anInt75 >= 0 && entityDef_1.anInt75 < headIcons.length) {
  1950.                     npcScreenPos(((Entity) (obj)), ((Entity) (obj)).height + 15);
  1951.                     if(spriteDrawX > -1)
  1952.                         headIcons[entityDef_1.anInt75].drawSprite(spriteDrawX - 12, spriteDrawY - 30);
  1953.                 }
  1954.                 if(hintType == 1 && hintArrowNPCID == npcIndices[j - playerCount] && loopCycle % 20 < 10) {
  1955.                     npcScreenPos(((Entity) (obj)), ((Entity) (obj)).height + 15);
  1956.                     if(spriteDrawX > -1)
  1957.                         headIconsHint[0].drawSprite(spriteDrawX - 12, spriteDrawY - 28);
  1958.                 }
  1959.             }
  1960.             if(((Entity) (obj)).textSpoken != null && (j >= playerCount || publicChatMode == 0 || publicChatMode == 3 || publicChatMode == 1 && isFriendOrSelf(((Player)obj).name)))
  1961.             {
  1962.                 npcScreenPos(((Entity) (obj)), ((Entity) (obj)).height);
  1963.                 if(spriteDrawX > -1 && anInt974 < anInt975)
  1964.                 {
  1965.                     anIntArray979[anInt974] = boldFont.method384(((Entity) (obj)).textSpoken) / 2;
  1966.                     anIntArray978[anInt974] = boldFont.anInt1497;
  1967.                     anIntArray976[anInt974] = spriteDrawX;
  1968.                     anIntArray977[anInt974] = spriteDrawY;
  1969.                     anIntArray980[anInt974] = ((Entity)(Entity)obj).anInt1513;
  1970.                     anIntArray981[anInt974] = ((Entity)(Entity)obj).anInt1531;
  1971.                     anIntArray982[anInt974] = ((Entity)(Entity)obj).textCycle;
  1972.                     aStringArray983[anInt974++] = ((Entity)(Entity)obj).textSpoken;
  1973.                     if(anInt1249 == 0 && ((Entity) (obj)).anInt1531 >= 1 && ((Entity) (obj)).anInt1531 <= 3)
  1974.                     {
  1975.                         anIntArray978[anInt974] += 10;
  1976.                         anIntArray977[anInt974] += 5;
  1977.                     }
  1978.                     if(anInt1249 == 0 && ((Entity) (obj)).anInt1531 == 4)
  1979.                         anIntArray979[anInt974] = 60;
  1980.                     if(anInt1249 == 0 && ((Entity) (obj)).anInt1531 == 5)
  1981.                         anIntArray978[anInt974] += 5;
  1982.                 }
  1983.             }
  1984.             if(((Entity) (obj)).loopCycleStatus > loopCycle)
  1985.             {
  1986.                 try{
  1987.                     npcScreenPos(((Entity) (obj)), ((Entity) (obj)).height + 15);
  1988.                     if(spriteDrawX > -1)
  1989.                     {
  1990.                         if(healthBars) {
  1991.                             int amount = 56;
  1992.                             int j2 = (((Entity)(Entity)obj).currentHealth * amount) / ((Entity)(Entity)obj).maxHealth;
  1993.                             if(j2 > amount)
  1994.                                 j2 = amount;
  1995.                             HPBarEmpty.drawSprite(spriteDrawX - 28, spriteDrawY - 3);
  1996.                             HPBarFull = new Sprite("HITPOINTS_0", j2, 7);
  1997.                             HPBarFull.drawSprite(spriteDrawX - 28, spriteDrawY - 3);
  1998.                         } else {
  1999.                             int i1 = (((Entity) (obj)).currentHealth * 30) / ((Entity) (obj)).maxHealth;
  2000.                             if(i1 > 30)
  2001.                                 i1 = 30;
  2002.                             DrawingArea.drawPixels(5, spriteDrawY - 3, spriteDrawX - 15, 65280, i1);
  2003.                             DrawingArea.drawPixels(5, spriteDrawY - 3, (spriteDrawX - 15) + i1, 0xff0000, 30 - i1);
  2004.                         }
  2005.                     }
  2006.                 }catch(Exception ex){ }
  2007.             }
  2008.                 for(int j1 = 0; j1 < 4; j1++)
  2009.                     if(((Entity) (obj)).hitsLoopCycle[j1] > loopCycle) {
  2010.                         npcScreenPos(((Entity) (obj)), ((Entity) (obj)).height / 2);
  2011.                         if(spriteDrawX > -1) {
  2012.                             //spriteDrawY = 20 +
  2013.                             switch (j1) {
  2014.                                 case 1:
  2015.                                 spriteDrawY += 20;
  2016.                                 break;
  2017.                                 case 2:
  2018.                                 spriteDrawY += 25;
  2019.                                 break;
  2020.                                 case 3:
  2021.                                 spriteDrawY += 45;
  2022.                                 break;
  2023.                             }
  2024.                             Entity e = ((Entity) (obj));
  2025.                             if (e.hitmarkMove[j1] > -30) {
  2026.                                     e.hitmarkMove[j1]--;
  2027.                                 if (e.hitmarkTrans[j1] > 0)
  2028.                                     e.hitmarkTrans[j1] -= 5;
  2029.                                 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]);
  2030.                             }
  2031.                         }
  2032.                     }
  2033.             }
  2034.             for(int k = 0; k < anInt974; k++) {
  2035.                 int k1 = anIntArray976[k];
  2036.                 int l1 = anIntArray977[k];
  2037.                 int j2 = anIntArray979[k];
  2038.                 int k2 = anIntArray978[k];
  2039.                 boolean flag = true;
  2040.                 while(flag)
  2041.                 {
  2042.                     flag = false;
  2043.                     for(int l2 = 0; l2 < k; l2++)
  2044.                         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)
  2045.                         {
  2046.                             l1 = anIntArray977[l2] - anIntArray978[l2];
  2047.                             flag = true;
  2048.                         }
  2049.  
  2050.                 }
  2051.                 spriteDrawX = anIntArray976[k];
  2052.                 spriteDrawY = anIntArray977[k] = l1;
  2053.                 String s = aStringArray983[k];
  2054.                 if(anInt1249 == 0)
  2055.                 {
  2056.                     int i3 = 0xffff00;
  2057.                     if(anIntArray980[k] < 6)
  2058.                         i3 = anIntArray965[anIntArray980[k]];
  2059.                     if(anIntArray980[k] == 6)
  2060.                         i3 = anInt1265 % 20 >= 10 ? 0xffff00 : 0xff0000;
  2061.                     if(anIntArray980[k] == 7)
  2062.                         i3 = anInt1265 % 20 >= 10 ? 65535 : 255;
  2063.                     if(anIntArray980[k] == 8)
  2064.                         i3 = anInt1265 % 20 >= 10 ? 0x80ff80 : 45056;
  2065.                     if(anIntArray980[k] == 9) {
  2066.                         int j3 = 150 - anIntArray982[k];
  2067.                         if(j3 < 50)
  2068.                             i3 = 0xff0000 + 1280 * j3;
  2069.                         else
  2070.                         if(j3 < 100)
  2071.                             i3 = 0xffff00 - 0x50000 * (j3 - 50);
  2072.                         else
  2073.                         if(j3 < 150)
  2074.                             i3 = 65280 + 5 * (j3 - 100);
  2075.                     }
  2076.                     if(anIntArray980[k] == 10) {
  2077.                         int k3 = 150 - anIntArray982[k];
  2078.                         if(k3 < 50)
  2079.                             i3 = 0xff0000 + 5 * k3;
  2080.                         else
  2081.                         if(k3 < 100)
  2082.                             i3 = 0xff00ff - 0x50000 * (k3 - 50);
  2083.                         else
  2084.                         if(k3 < 150)
  2085.                             i3 = (255 + 0x50000 * (k3 - 100)) - 5 * (k3 - 100);
  2086.                     }
  2087.                     if(anIntArray980[k] == 11) {
  2088.                         int l3 = 150 - anIntArray982[k];
  2089.                         if(l3 < 50)
  2090.                             i3 = 0xffffff - 0x50005 * l3;
  2091.                         else
  2092.                         if(l3 < 100)
  2093.                             i3 = 65280 + 0x50005 * (l3 - 50);
  2094.                         else
  2095.                         if(l3 < 150)
  2096.                             i3 = 0xffffff - 0x50000 * (l3 - 100);
  2097.                     }
  2098.                     if(anIntArray981[k] == 0) {
  2099.                         boldFont.drawText(0, s, spriteDrawY + 1, spriteDrawX);
  2100.                         boldFont.drawText(i3, s, spriteDrawY, spriteDrawX);
  2101.                     }
  2102.                     if(anIntArray981[k] == 1) {
  2103.                         boldFont.method386(0, s, spriteDrawX, anInt1265, spriteDrawY + 1);
  2104.                         boldFont.method386(i3, s, spriteDrawX, anInt1265, spriteDrawY);
  2105.                     }
  2106.                     if(anIntArray981[k] == 2) {
  2107.                         boldFont.method387(spriteDrawX, s, anInt1265, spriteDrawY + 1, 0);
  2108.                         boldFont.method387(spriteDrawX, s, anInt1265, spriteDrawY, i3);
  2109.                     }
  2110.                     if(anIntArray981[k] == 3) {
  2111.                         boldFont.method388(150 - anIntArray982[k], s, anInt1265, spriteDrawY + 1, spriteDrawX, 0);
  2112.                         boldFont.method388(150 - anIntArray982[k], s, anInt1265, spriteDrawY, spriteDrawX, i3);
  2113.                     }
  2114.                     if(anIntArray981[k] == 4) {
  2115.                         int i4 = boldFont.method384(s);
  2116.                         int k4 = ((150 - anIntArray982[k]) * (i4 + 100)) / 150;
  2117.                         DrawingArea.setDrawingArea(334, spriteDrawX - 50, spriteDrawX + 50, 0);
  2118.                         boldFont.method385(0, s, spriteDrawY + 1, (spriteDrawX + 50) - k4);
  2119.                         boldFont.method385(i3, s, spriteDrawY, (spriteDrawX + 50) - k4);
  2120.                         DrawingArea.defaultDrawingAreaSize();
  2121.                     }
  2122.                     if(anIntArray981[k] == 5) {
  2123.                         int j4 = 150 - anIntArray982[k];
  2124.                         int l4 = 0;
  2125.                         if(j4 < 25)
  2126.                             l4 = j4 - 25;
  2127.                         else
  2128.                         if(j4 > 125)
  2129.                             l4 = j4 - 125;
  2130.                         DrawingArea.setDrawingArea(spriteDrawY + 5, 0, 512, spriteDrawY - boldFont.anInt1497 - 1);
  2131.                         boldFont.drawText(0, s, spriteDrawY + 1 + l4, spriteDrawX);
  2132.                         boldFont.drawText(i3, s, spriteDrawY + l4, spriteDrawX);
  2133.                         DrawingArea.defaultDrawingAreaSize();
  2134.                     }
  2135.                 } else {
  2136.                     boldFont.drawText(0, s, spriteDrawY + 1, spriteDrawX);
  2137.                     boldFont.drawText(0xffff00, s, spriteDrawY, spriteDrawX);
  2138.                 }
  2139.             }
  2140.         } catch(Exception e){ }
  2141.     }
  2142.  
  2143.     private void delFriend(long l)
  2144.     {
  2145.         try
  2146.         {
  2147.             if(l == 0L)
  2148.                 return;
  2149.             for(int i = 0; i < friendsCount; i++)
  2150.             {
  2151.                 if(friendsListAsLongs[i] != l)
  2152.                     continue;
  2153.                 friendsCount--;
  2154.                 needDrawTabArea = true;
  2155.                 for(int j = i; j < friendsCount; j++)
  2156.                 {
  2157.                     friendsList[j] = friendsList[j + 1];
  2158.                     friendsNodeIDs[j] = friendsNodeIDs[j + 1];
  2159.                     friendsListAsLongs[j] = friendsListAsLongs[j + 1];
  2160.                 }
  2161.  
  2162.                 stream.createFrame(215);
  2163.                 stream.writeQWord(l);
  2164.                 break;
  2165.             }
  2166.         }
  2167.         catch(RuntimeException runtimeexception)
  2168.         {
  2169.             signlink.reporterror("18622, " + false + ", " + l + ", " + runtimeexception.toString());
  2170.             throw new RuntimeException();
  2171.         }
  2172.     }
  2173.  
  2174.     private void drawIventoryStones(int paddingX,int paddingY) {
  2175.         paddingX = paddingX + 2;//tabSpace
  2176.         if(toggleFullscreen) {
  2177.             inventoryStones[2].drawSprite(1 + paddingX, 261 + paddingY);
  2178.             inventoryStones[2].drawSprite(31 + paddingX, 261 + paddingY);
  2179.             inventoryStones[2].drawSprite(61 + paddingX, 261 + paddingY);
  2180.             inventoryStones[2].drawSprite(91 + paddingX, 261 + paddingY);
  2181.             inventoryStones[2].drawSprite(121 + paddingX, 261 + paddingY);
  2182.             inventoryStones[2].drawSprite(151 + paddingX, 261 + paddingY);
  2183.             inventoryStones[2].drawSprite(181 + paddingX, 261 + paddingY);
  2184.             inventoryStones[2].drawSprite(211 + paddingX, 261 + paddingY);
  2185.            
  2186.             inventoryStones[2].drawSprite(1 + paddingX, 298 + paddingY);
  2187.             inventoryStones[2].drawSprite(31 + paddingX, 298 + paddingY);
  2188.             inventoryStones[2].drawSprite(61 + paddingX, 298 + paddingY);
  2189.             inventoryStones[2].drawSprite(91 + paddingX, 298 + paddingY);
  2190.             inventoryStones[2].drawSprite(121 + paddingX, 298 + paddingY);
  2191.             inventoryStones[2].drawSprite(151 + paddingX, 298 + paddingY);
  2192.             inventoryStones[2].drawSprite(181 + paddingX,298 + paddingY);
  2193.             inventoryStones[2].drawSprite(211 + paddingX, 298 + paddingY);
  2194.         }
  2195.         //if(!contextMenuOpen) {
  2196.             if(tabInterfaceIDs[0] != -1)
  2197.                 inventoryStones[tabIDHover == 0 ? 1 : 2].drawSprite(1 + paddingX, (toggleFullscreen ? 261 : 0) + paddingY);
  2198.             if(tabInterfaceIDs[14] != -1)
  2199.                 inventoryStones[tabIDHover == 1 ? 1 : 2].drawSprite(31 + paddingX, (toggleFullscreen ? 261 : 0) + paddingY);
  2200.             if(tabInterfaceIDs[1] != -1)
  2201.                 inventoryStones[tabIDHover == 2 ? 1 : 2].drawSprite(61 + paddingX, (toggleFullscreen ? 261 : 0) + paddingY);
  2202.             if(tabInterfaceIDs[2] != -1)
  2203.                 inventoryStones[tabIDHover == 3 ? 1 : 2].drawSprite(91 + paddingX, (toggleFullscreen ? 261 : 0) + paddingY);
  2204.             if(tabInterfaceIDs[3] != -1)
  2205.                 inventoryStones[tabIDHover == 4 ? 1 : 2].drawSprite(121 + paddingX, (toggleFullscreen ? 261 : 0) + paddingY);
  2206.             if(tabInterfaceIDs[4] != -1)
  2207.                 inventoryStones[tabIDHover == 5 ? 1 : 2].drawSprite(151 + paddingX, (toggleFullscreen ? 261 : 0) + paddingY);
  2208.             if(tabInterfaceIDs[5] != -1)
  2209.                 inventoryStones[tabIDHover == 6 ? 1 : 2].drawSprite(181 + paddingX, (toggleFullscreen ? 261 : 0) + paddingY);
  2210.             if(tabInterfaceIDs[6] != -1)
  2211.                 inventoryStones[tabIDHover == 7 ? 1 : 2].drawSprite(211 + paddingX, (toggleFullscreen ? 261 : 0) + paddingY);
  2212.                
  2213.             if(tabInterfaceIDs[16] != -1)
  2214.                 inventoryStones[tabIDHover == 14 ? 1 : 2].drawSprite(1 + paddingX, 298 + paddingY);
  2215.             if(tabInterfaceIDs[9] != -1)
  2216.                 inventoryStones[tabIDHover == 8 ? 1 : 2].drawSprite(31 + paddingX, 298 + paddingY);
  2217.             if(tabInterfaceIDs[8] != -1)
  2218.                 inventoryStones[tabIDHover == 9 ? 1 : 2].drawSprite(61 + paddingX, 298 + paddingY);
  2219.             if(tabInterfaceIDs[7] != -1)
  2220.                 inventoryStones[tabIDHover == 10 ? 1 : 2].drawSprite(91 + paddingX, 298 + paddingY);
  2221.             if(tabInterfaceIDs[11] != -1)
  2222.                 inventoryStones[tabIDHover == 11 ? 1 : 2].drawSprite(121 + paddingX, 298 + paddingY);
  2223.             if(tabInterfaceIDs[12] != -1)
  2224.                 inventoryStones[tabIDHover == 12 ? 1 : 2].drawSprite(151 + paddingX, 298 + paddingY);
  2225.             if(tabInterfaceIDs[13] != -1)
  2226.                 inventoryStones[tabIDHover == 13 ? 1 : 2].drawSprite(181 + paddingX,298 + paddingY);
  2227.             if(tabInterfaceIDs[15] != -1)
  2228.                 inventoryStones[tabIDHover == 15 ? 1 : 2].drawSprite(211 + paddingX, 298 + paddingY);
  2229.         //}
  2230.         if(invOverlayInterfaceID == -1 && focusTab != -1) {
  2231.             try {
  2232.             if(tabInterfaceIDs[tabID] != -1) {
  2233.                 if(tabID == 0)
  2234.                     inventoryStones[0].drawSprite(1 + paddingX, (toggleFullscreen ? 261 : 0) + paddingY);
  2235.                 if(tabID == 14)
  2236.                     inventoryStones[0].drawSprite(31 + paddingX, (toggleFullscreen ? 261 : 0) + paddingY);
  2237.                 if(tabID == 1)
  2238.                     inventoryStones[0].drawSprite(61 + paddingX, (toggleFullscreen ? 261 : 0) + paddingY);
  2239.                 if(tabID == 2)
  2240.                     inventoryStones[0].drawSprite(91 + paddingX, (toggleFullscreen ? 261 : 0) + paddingY);
  2241.                 if(tabID == 3)
  2242.                     inventoryStones[0].drawSprite(121 + paddingX, (toggleFullscreen ? 261 : 0) + paddingY);
  2243.                 if(tabID == 4)
  2244.                     inventoryStones[0].drawSprite(151 + paddingX, (toggleFullscreen ? 261 : 0) + paddingY);
  2245.                 if(tabID == 5)
  2246.                     inventoryStones[0].drawSprite(181 + paddingX, (toggleFullscreen ? 261 : 0) + paddingY);
  2247.                 if(tabID == 6)
  2248.                     inventoryStones[0].drawSprite(211 + paddingX, (toggleFullscreen ? 261 : 0) + paddingY);
  2249.                 if(tabID == 16)
  2250.                     inventoryStones[0].drawSprite(1 + paddingX, 298 + paddingY);
  2251.                 if(tabID == 8)
  2252.                     inventoryStones[0].drawSprite(31 + paddingX, 298 + paddingY);
  2253.                 if(tabID == 9)
  2254.                     inventoryStones[0].drawSprite(61 + paddingX, 298 + paddingY);
  2255.                 if(tabID == 7)
  2256.                     inventoryStones[0].drawSprite(91 + paddingX, 298 + paddingY);
  2257.                 if(tabID == 11)
  2258.                     inventoryStones[0].drawSprite(121 + paddingX, 298 + paddingY);
  2259.                 if(tabID == 12)
  2260.                     inventoryStones[0].drawSprite(151 + paddingX, 298 + paddingY);
  2261.                 if(tabID == 13)
  2262.                     inventoryStones[0].drawSprite(181 + paddingX, 298 + paddingY);
  2263.                 if(tabID == 15)
  2264.                     inventoryStones[0].drawSprite(211 + paddingX, 298 + paddingY);
  2265.             }
  2266.         } catch(Exception e) { tabID = 1; }
  2267.         }
  2268.     }
  2269.    
  2270.     private void drawSideIcons(int paddingX, int paddingY) {
  2271.         if(tabIconFlash != -1)
  2272.             tabAreaAltered = true;
  2273.         if(tabAreaAltered) {
  2274.             if(tabIconFlash != -1 && tabIconFlash == tabID) {
  2275.                 tabIconFlash = -1;
  2276.                 stream.createFrame(120);
  2277.                 stream.writeWordBigEndian(tabID);
  2278.             }
  2279.             tabAreaAltered = false;
  2280.         }
  2281.         if(invOverlayInterfaceID == -1) {
  2282.             if(tabInterfaceIDs[0] != -1 && (tabIconFlash != 0 || loopCycle % 20 < 10))
  2283.                 sideIcons[0].drawSprite(3 + 5 + paddingX, (toggleFullscreen ? 261 : 0) + 9 + paddingY);//Combat
  2284.             if(tabInterfaceIDs[14] != -1 && (tabIconFlash != 1 || loopCycle % 20 < 10))
  2285.                 sideIcons[3].drawSprite(33 + 4 + paddingX, (toggleFullscreen ? 261 : 0) + 9 + paddingY);//skills
  2286.             if(tabInterfaceIDs[1] != -1 && (tabIconFlash != 2 || loopCycle % 20 < 10))
  2287.                 sideIcons[1].drawSprite(63 + 4 + paddingX, (toggleFullscreen ? 261 : 0) + 8 + paddingY);//quests
  2288.             if(tabInterfaceIDs[2] != -1 && (tabIconFlash != 14 || loopCycle % 20 < 10))
  2289.                 sideIcons[2].drawSprite(93 + 4 + paddingX, (toggleFullscreen ? 261 : 0) + 8 + paddingY);//task system
  2290.             if(tabInterfaceIDs[3] != -1 && (tabIconFlash != 3 || loopCycle % 20 < 10))
  2291.                 sideIcons[4].drawSprite(123 + 4 + paddingX, (toggleFullscreen ? 261 : 0) + 9 + paddingY);//inventory
  2292.             if(tabInterfaceIDs[4] != -1 && (tabIconFlash != 4 || loopCycle % 20 < 10))
  2293.                 sideIcons[5].drawSprite(153 + 6 + paddingX, (toggleFullscreen ? 261 : 0) + 8 + paddingY);//equipment
  2294.             if(tabInterfaceIDs[5] != -1 && (tabIconFlash != 5 || loopCycle % 20 < 10))
  2295.                 sideIcons[6].drawSprite(183 + 4 + paddingX, (toggleFullscreen ? 261 : 0) + 9 + paddingY);//prayer
  2296.             if(tabInterfaceIDs[6] != -1 && (tabIconFlash != 6 || loopCycle % 20 < 10))
  2297.                 sideIcons[7].drawSprite(213 + 4 + paddingX, (toggleFullscreen ? 261 : 0) + 9 + paddingY);//magic
  2298.                
  2299.             if(tabInterfaceIDs[14] != -1 && (tabIconFlash != 7 || loopCycle % 20 < 10))
  2300.                 sideIcons[8].drawSprite(3 + 4 + paddingX, 298 + 10 + paddingY);//Guide
  2301.             if(tabInterfaceIDs[9] != -1 && (tabIconFlash != 9 || loopCycle % 20 < 10))
  2302.                 sideIcons[9].drawSprite(33 + 5 + paddingX, 298 + 9 + paddingY);//friends
  2303.             if(tabInterfaceIDs[8] != -1 && (tabIconFlash != 8 || loopCycle % 20 < 10))
  2304.                 sideIcons[10].drawSprite(63 + 7 + paddingX, 298 + 9 + paddingY);//ignore
  2305.             if(tabInterfaceIDs[7] != -1 && (tabIconFlash != 7 || loopCycle % 20 < 10))
  2306.                 sideIcons[11].drawSprite(93 + 4 + paddingX, 298 + 10 + paddingY);//clan
  2307.             if(tabInterfaceIDs[11] != -1 && (tabIconFlash != 11 || loopCycle % 20 < 10))
  2308.                 sideIcons[12].drawSprite(123 + 4 + paddingX, 298 + 9 + paddingY);//option
  2309.             if(tabInterfaceIDs[12] != -1 && (tabIconFlash != 12 || loopCycle % 20 < 10))
  2310.                 sideIcons[13].drawSprite(153 + 4 + paddingX, 298 + 9 + paddingY);//emotes
  2311.             if(tabInterfaceIDs[13] != -1 && (tabIconFlash != 13 || loopCycle % 20 < 10))
  2312.                 sideIcons[14].drawSprite(183 + 3 + paddingX, 298 + 8 + paddingY);//music
  2313.             if(tabInterfaceIDs[15] != -1 && (tabIconFlash != 15 || loopCycle % 20 < 10))
  2314.                 sideIcons[15].drawSprite(213 + 4 + paddingX, 298 + 11 + paddingY);//notes
  2315.         }
  2316.     }
  2317.  
  2318.     private void drawTabArea(RSImageProducer tabImage, int paddingX,int paddingY) {
  2319.         tabImage.initDrawingArea();
  2320.         Texture.anIntArray1472 = anIntArray1181;
  2321.         if(toggleFullscreen) {
  2322.             if(focusTab != -1)
  2323.                 tabAreaSprite[1].drawSprite1(45-23 + paddingX ,55-23 + paddingY - (toggleFullscreen ? 46 : 0),192);
  2324.         } else
  2325.             tabAreaSprite[0].drawSprite(0 + paddingX,0 + paddingY);
  2326.        
  2327.         drawIventoryStones(paddingX,paddingY);
  2328.         drawSideIcons(paddingX,paddingY);
  2329.        
  2330.         if(invOverlayInterfaceID != -1)
  2331.             drawInterface(0, 28 + paddingX, RSInterface.interfaceCache[invOverlayInterfaceID], 37 - (toggleFullscreen ? 46 : 0) + paddingY);
  2332.         else if(tabInterfaceIDs[tabID] != -1 && focusTab != -1)
  2333.             drawInterface(0, 28 + paddingX, RSInterface.interfaceCache[tabInterfaceIDs[tabID]], 37 - (toggleFullscreen ? 46 : 0) + paddingY);
  2334.         if(contextMenuOpen && !toggleFullscreen)
  2335.             drawMenu(519, 168);//Tab area
  2336.         Texture.anIntArray1472 = anIntArray1182;
  2337.     }
  2338.    
  2339.     private void drawRightFrameArea() {
  2340.         rightFrame.initDrawingArea();
  2341.         rightFrameSprite.drawSprite(0,0);
  2342.         if(contextMenuOpen && !toggleFullscreen) {
  2343.             drawMenu(516, 168);
  2344.         }
  2345.         rightFrame.drawGraphics(168, super.graphics, 516);
  2346.         main3DArea.initDrawingArea();
  2347.     }
  2348.    
  2349.     private void method37(int j) {
  2350.         if(Texture.anIntArray1480[17] >= j) {
  2351.                 Background background = Texture.aBackgroundArray1474s[17];
  2352.                 int k = background.anInt1452 * background.anInt1453 - 1;
  2353.                 //fire cape apparently?
  2354.                 int j1 = background.anInt1452 * anInt945 * 2;
  2355.                 byte abyte0[] = background.aByteArray1450;
  2356.                 byte abyte3[] = aByteArray912;
  2357.                 for(int i2 = 0; i2 <= k; i2++)
  2358.                     abyte3[i2] = abyte0[i2 - j1 & k];
  2359.  
  2360.                 background.aByteArray1450 = abyte3;
  2361.                 aByteArray912 = abyte0;
  2362.                 Texture.method370(17);
  2363.                 anInt854++;
  2364.                 if(anInt854 > 1235) {
  2365.                     anInt854 = 0;
  2366.                     stream.createFrame(226);
  2367.                     stream.writeWordBigEndian(0);
  2368.                     int l2 = stream.currentOffset;
  2369.                     stream.writeWord(58722);
  2370.                     stream.writeWordBigEndian(240);
  2371.                     stream.writeWord((int)(Math.random() * 65536D));
  2372.                     stream.writeWordBigEndian((int)(Math.random() * 256D));
  2373.                     if((int)(Math.random() * 2D) == 0)
  2374.                         stream.writeWord(51825);
  2375.                     stream.writeWordBigEndian((int)(Math.random() * 256D));
  2376.                     stream.writeWord((int)(Math.random() * 65536D));
  2377.                     stream.writeWord(7130);
  2378.                     stream.writeWord((int)(Math.random() * 65536D));
  2379.                     stream.writeWord(61657);
  2380.                     stream.writeBytes(stream.currentOffset - l2);
  2381.                 }
  2382.             }
  2383.             if(Texture.anIntArray1480[24] >= j) {
  2384.                 Background background_1 = Texture.aBackgroundArray1474s[24];
  2385.                 int l = background_1.anInt1452 * background_1.anInt1453 - 1;
  2386.                 int k1 = background_1.anInt1452 * anInt945 * 2;
  2387.                 byte abyte1[] = background_1.aByteArray1450;
  2388.                 byte abyte4[] = aByteArray912;
  2389.                 for(int j2 = 0; j2 <= l; j2++)
  2390.                     abyte4[j2] = abyte1[j2 - k1 & l];
  2391.  
  2392.                 background_1.aByteArray1450 = abyte4;
  2393.                 aByteArray912 = abyte1;
  2394.                 Texture.method370(24);
  2395.             }
  2396.             if(Texture.anIntArray1480[34] >= j) {
  2397.                 Background background_2 = Texture.aBackgroundArray1474s[34];
  2398.                 int i1 = background_2.anInt1452 * background_2.anInt1453 - 1;
  2399.                 int l1 = background_2.anInt1452 * anInt945 * 2;
  2400.                 byte abyte2[] = background_2.aByteArray1450;
  2401.                 byte abyte5[] = aByteArray912;
  2402.                 for(int k2 = 0; k2 <= i1; k2++)
  2403.                     abyte5[k2] = abyte2[k2 - l1 & i1];
  2404.  
  2405.                 background_2.aByteArray1450 = abyte5;
  2406.                 aByteArray912 = abyte2;
  2407.                 Texture.method370(34);
  2408.             }
  2409.             if(Texture.anIntArray1480[40] >= j)
  2410.             {
  2411.                 Background background_2 = Texture.aBackgroundArray1474s[40];
  2412.                 int i1 = background_2.anInt1452 * background_2.anInt1453 - 1;
  2413.                 int l1 = background_2.anInt1452 * anInt945 * 1;
  2414.                 byte abyte2[] = background_2.aByteArray1450;
  2415.                 byte abyte5[] = aByteArray912;
  2416.                 for(int k2 = 0; k2 <= i1; k2++)
  2417.                     abyte5[k2] = abyte2[k2 - l1 & i1];
  2418.  
  2419.                 background_2.aByteArray1450 = abyte5;
  2420.                 aByteArray912 = abyte2;
  2421.                 Texture.method370(40);
  2422.             }
  2423.        
  2424.     }
  2425.  
  2426.     private void method38() {
  2427.         for(int i = -1; i < playerCount; i++) {
  2428.             int j;
  2429.             if(i == -1)
  2430.                 j = myPlayerIndex;
  2431.             else
  2432.                 j = playerIndices[i];
  2433.             Player player = playerArray[j];
  2434.             if(player != null && player.textCycle > 0) {
  2435.                 player.textCycle--;
  2436.                 if(player.textCycle == 0)
  2437.                     player.textSpoken = null;
  2438.             }
  2439.         }
  2440.         for(int k = 0; k < npcCount; k++) {
  2441.             int l = npcIndices[k];
  2442.             NPC npc = npcArray[l];
  2443.             if(npc != null && npc.textCycle > 0) {
  2444.                 npc.textCycle--;
  2445.                 if(npc.textCycle == 0)
  2446.                     npc.textSpoken = null;
  2447.             }
  2448.         }
  2449.     }
  2450.  
  2451.     private void calcCameraPos() {
  2452.         int i = anInt1098 * 128 + 64;
  2453.         int j = anInt1099 * 128 + 64;
  2454.         int k = method42(plane, j, i) - anInt1100;
  2455.         if(xCameraPos < i) {
  2456.             xCameraPos += anInt1101 + ((i - xCameraPos) * anInt1102) / 1000;
  2457.             if(xCameraPos > i)
  2458.                 xCameraPos = i;
  2459.         }
  2460.         if(xCameraPos > i) {
  2461.             xCameraPos -= anInt1101 + ((xCameraPos - i) * anInt1102) / 1000;
  2462.             if(xCameraPos < i)
  2463.                 xCameraPos = i;
  2464.         }
  2465.         if(zCameraPos < k) {
  2466.             zCameraPos += anInt1101 + ((k - zCameraPos) * anInt1102) / 1000;
  2467.             if(zCameraPos > k)
  2468.                 zCameraPos = k;
  2469.         }
  2470.         if(zCameraPos > k) {
  2471.             zCameraPos -= anInt1101 + ((zCameraPos - k) * anInt1102) / 1000;
  2472.             if(zCameraPos < k)
  2473.                 zCameraPos = k;
  2474.         }
  2475.         if(yCameraPos < j) {
  2476.             yCameraPos += anInt1101 + ((j - yCameraPos) * anInt1102) / 1000;
  2477.             if(yCameraPos > j)
  2478.                 yCameraPos = j;
  2479.         }
  2480.         if(yCameraPos > j) {
  2481.             yCameraPos -= anInt1101 + ((yCameraPos - j) * anInt1102) / 1000;
  2482.             if(yCameraPos < j)
  2483.                 yCameraPos = j;
  2484.         }
  2485.         i = anInt995 * 128 + 64;
  2486.         j = anInt996 * 128 + 64;
  2487.         k = method42(plane, j, i) - anInt997;
  2488.         int l = i - xCameraPos;
  2489.         int i1 = k - zCameraPos;
  2490.         int j1 = j - yCameraPos;
  2491.         int k1 = (int)Math.sqrt(l * l + j1 * j1);
  2492.         int l1 = (int)(Math.atan2(i1, k1) * 325.94900000000001D) & 0x7ff;
  2493.         int i2 = (int)(Math.atan2(l, j1) * -325.94900000000001D) & 0x7ff;
  2494.         if(l1 < 128)
  2495.             l1 = 128;
  2496.         if(l1 > 383)
  2497.             l1 = 383;
  2498.         if(yCameraCurve < l1) {
  2499.             yCameraCurve += anInt998 + ((l1 - yCameraCurve) * anInt999) / 1000;
  2500.             if(yCameraCurve > l1)
  2501.                 yCameraCurve = l1;
  2502.         }
  2503.         if(yCameraCurve > l1) {
  2504.             yCameraCurve -= anInt998 + ((yCameraCurve - l1) * anInt999) / 1000;
  2505.             if(yCameraCurve < l1)
  2506.                 yCameraCurve = l1;
  2507.         }
  2508.         int j2 = i2 - xCameraCurve;
  2509.         if(j2 > 1024)
  2510.             j2 -= 2048;
  2511.         if(j2 < -1024)
  2512.             j2 += 2048;
  2513.         if(j2 > 0) {
  2514.             xCameraCurve += anInt998 + (j2 * anInt999) / 1000;
  2515.             xCameraCurve &= 0x7ff;
  2516.         }
  2517.         if(j2 < 0) {
  2518.             xCameraCurve -= anInt998 + (-j2 * anInt999) / 1000;
  2519.             xCameraCurve &= 0x7ff;
  2520.         }
  2521.         int k2 = i2 - xCameraCurve;
  2522.         if(k2 > 1024)
  2523.             k2 -= 2048;
  2524.         if(k2 < -1024)
  2525.             k2 += 2048;
  2526.         if(k2 < 0 && j2 > 0 || k2 > 0 && j2 < 0)
  2527.             xCameraCurve = i2;
  2528.     }
  2529.  
  2530.     private void drawMenu(int xOffSet, int yOffSet) {
  2531.         int xPos = menuOffsetX - (xOffSet - 4);
  2532.         int yPos = (-yOffSet + 4) + menuOffsetY;
  2533.         int menuW = menuWidth;
  2534.         int menuH = menuHeight + 1;
  2535.         needDrawTabArea = true;
  2536.         inputTaken = true;
  2537.         tabAreaAltered = true;
  2538.         //DrawingArea.drawPixels(height, yPos, xPos, color, width);
  2539.         //DrawingArea.fillPixels(xPos, width, height, color, yPos);
  2540.         DrawingArea.drawPixels(menuH - 4, yPos + 2, xPos, 0x706a5e, menuW);
  2541.         DrawingArea.drawPixels(menuH - 2, yPos + 1, xPos + 1, 0x706a5e, menuW - 2);
  2542.         DrawingArea.drawPixels(menuH, yPos, xPos + 2, 0x706a5e, menuW - 4);
  2543.         DrawingArea.drawPixels(menuH - 2, yPos + 1, xPos + 3, 0x2d2822, menuW - 6);
  2544.         DrawingArea.drawPixels(menuH - 4, yPos + 2, xPos + 2, 0x2d2822, menuW - 4);
  2545.         DrawingArea.drawPixels(menuH - 6, yPos + 3, xPos + 1, 0x2d2822, menuW - 2);
  2546.         DrawingArea.drawPixels(menuH - 22, yPos + 19, xPos + 2, 0x524a3d, menuW - 4);
  2547.         DrawingArea.drawPixels(menuH - 22, yPos + 20, xPos + 3, 0x524a3d, menuW - 6);
  2548.         DrawingArea.drawPixels(menuH - 23, yPos + 20, xPos + 3, 0x112329, menuW - 6);
  2549.         DrawingArea.fillPixels(xPos + 3, menuW - 6, 1, 0x2a291b, yPos + 2);
  2550.         DrawingArea.fillPixels(xPos + 2, menuW - 4, 1, 0x2a261b, yPos + 3);
  2551.         DrawingArea.fillPixels(xPos + 2, menuW - 4, 1, 0x252116, yPos + 4);
  2552.         DrawingArea.fillPixels(xPos + 2, menuW - 4, 1, 0x211e15, yPos + 5);
  2553.         DrawingArea.fillPixels(xPos + 2, menuW - 4, 1, 0x1e1b12, yPos + 6);
  2554.         DrawingArea.fillPixels(xPos + 2, menuW - 4, 1, 0x1a170e, yPos + 7);
  2555.         DrawingArea.fillPixels(xPos + 2, menuW - 4, 2, 0x15120b, yPos + 8);
  2556.         DrawingArea.fillPixels(xPos + 2, menuW - 4, 1, 0x100d08, yPos + 10);
  2557.         DrawingArea.fillPixels(xPos + 2, menuW - 4, 1, 0x090a04, yPos + 11);
  2558.         DrawingArea.fillPixels(xPos + 2, menuW - 4, 1, 0x080703, yPos + 12);
  2559.         DrawingArea.fillPixels(xPos + 2, menuW - 4, 1, 0x090a04, yPos + 13);
  2560.         DrawingArea.fillPixels(xPos + 2, menuW - 4, 1, 0x070802, yPos + 14);
  2561.         DrawingArea.fillPixels(xPos + 2, menuW - 4, 1, 0x090a04, yPos + 15);
  2562.         DrawingArea.fillPixels(xPos + 2, menuW - 4, 1, 0x070802, yPos + 16);
  2563.         DrawingArea.fillPixels(xPos + 2, menuW - 4, 1, 0x090a04, yPos + 17);
  2564.         DrawingArea.fillPixels(xPos + 2, menuW - 4, 1, 0x2a291b, yPos + 18);
  2565.         DrawingArea.fillPixels(xPos + 3, menuW - 6, 1, 0x564943, yPos + 19);
  2566.         boldFont.method385(0xc6b895, "Choose Option", yPos + 14, xPos + 3);
  2567.         int j1 = super.mouseX;
  2568.         int k1 = super.mouseY;
  2569.         int mouseX = super.mouseX - (xOffSet);
  2570.         int mouseY = (-yOffSet) + super.mouseY;
  2571.         for(int l1 = 0; l1 < menuActionRow; l1++) {
  2572.             int textY = yPos + 31 + (menuActionRow - 1 - l1) * 15;
  2573.             int disColor = 0xc6b895;
  2574.             if(mouseX > xPos && mouseX < xPos + menuW && mouseY > textY - 13 && mouseY < textY + 3) {
  2575.                 DrawingArea.drawPixels(15, textY - 11, xPos + 3, 0x26566C, menuWidth - 6);
  2576.                 disColor = 0xeee5c6;
  2577.             }
  2578.             boldFont.method389(true, xPos + 3, 0xAAA184, menuActionName[l1], textY);
  2579.         }
  2580.     }
  2581.  
  2582.     private void addFriend(long l) {
  2583.         try {
  2584.             if(l == 0L)
  2585.                 return;
  2586.             if(friendsCount >= 100 && anInt1046 != 1) {
  2587.                 pushMessage("Your friendlist is full. Max of 100 for free users, and 200 for members", 0, "");
  2588.                 return;
  2589.             }
  2590.             if(friendsCount >= 200) {
  2591.                 pushMessage("Your friendlist is full. Max of 100 for free users, and 200 for members", 0, "");
  2592.                 return;
  2593.             }
  2594.             String s = TextClass.fixName(TextClass.nameForLong(l));
  2595.             for(int i = 0; i < friendsCount; i++)
  2596.                 if(friendsListAsLongs[i] == l) {
  2597.                     pushMessage(s + " is already on your friend list", 0, "");
  2598.                     return;
  2599.                 }
  2600.             for(int j = 0; j < ignoreCount; j++)
  2601.                 if(ignoreListAsLongs[j] == l) {
  2602.                     pushMessage("Please remove " + s + " from your ignore list first", 0, "");
  2603.                     return;
  2604.                 }
  2605.  
  2606.             if(s.equals(myPlayer.name)) {
  2607.                 return;
  2608.             } else {
  2609.                 friendsList[friendsCount] = s;
  2610.                 friendsListAsLongs[friendsCount] = l;
  2611.                 friendsNodeIDs[friendsCount] = 0;
  2612.                 friendsCount++;
  2613.                 needDrawTabArea = true;
  2614.                 stream.createFrame(188);
  2615.                 stream.writeQWord(l);
  2616.                 return;
  2617.             }
  2618.         } catch(RuntimeException runtimeexception) {
  2619.             signlink.reporterror("15283, " + (byte)68 + ", " + l + ", " + runtimeexception.toString());
  2620.         }
  2621.         throw new RuntimeException();
  2622.     }
  2623.  
  2624.     private int method42(int i, int j, int k) {
  2625.         int l = k >> 7;
  2626.         int i1 = j >> 7;
  2627.         if(l < 0 || i1 < 0 || l > 103 || i1 > 103)
  2628.             return 0;
  2629.         int j1 = i;
  2630.         if(j1 < 3 && (byteGroundArray[1][l][i1] & 2) == 2)
  2631.             j1++;
  2632.         int k1 = k & 0x7f;
  2633.         int l1 = j & 0x7f;
  2634.         int i2 = intGroundArray[j1][l][i1] * (128 - k1) + intGroundArray[j1][l + 1][i1] * k1 >> 7;
  2635.         int j2 = intGroundArray[j1][l][i1 + 1] * (128 - k1) + intGroundArray[j1][l + 1][i1 + 1] * k1 >> 7;
  2636.         return i2 * (128 - l1) + j2 * l1 >> 7;
  2637.     }
  2638.  
  2639.     private static String intToKOrMil(int j) {
  2640.         if(j < 0x186a0)
  2641.             return String.valueOf(j);
  2642.         if(j < 0x989680)
  2643.             return j / 1000 + "K";
  2644.         else
  2645.             return j / 0xf4240 + "M";
  2646.     }
  2647.  
  2648.     private void resetLogout() {
  2649.         try {
  2650.             if(socketStream != null)
  2651.                 socketStream.close();
  2652.         }
  2653.         catch(Exception _ex) { }
  2654.         socketStream = null;
  2655.         loggedIn = false;
  2656.         alertHandler.alert = null;
  2657.         loginScreenState = 0;
  2658.         //myUsername = "";
  2659.         //myPassword = "";
  2660.         unlinkMRUNodes();
  2661.         worldController.initToNull();
  2662.         for(int i = 0; i < 4; i++)
  2663.             aClass11Array1230[i].method210();
  2664.         System.gc();
  2665.         stopMidi();
  2666.         currentSong = -1;
  2667.         nextSong = -1;
  2668.         prevSong = 0;
  2669.         autocastId = 0;
  2670.         autoCast = false;
  2671.         turnOffPrayers();
  2672.         orbToggle[1] = false;
  2673.         if(toggleFullscreen)
  2674.             switchToNormal();
  2675.     }
  2676.  
  2677.     private void method45() {
  2678.         aBoolean1031 = true;
  2679.         for(int j = 0; j < 7; j++) {
  2680.             anIntArray1065[j] = -1;
  2681.             for(int k = 0; k < IDK.length; k++) {
  2682.                 if(IDK.cache[k].aBoolean662 || IDK.cache[k].anInt657 != j + (aBoolean1047 ? 0 : 7))
  2683.                     continue;
  2684.                 anIntArray1065[j] = k;
  2685.                 break;
  2686.             }
  2687.         }
  2688.     }
  2689.    
  2690.     private void method46(int i, Stream stream) {
  2691.         while(stream.bitPosition + 21 < i * 8) {
  2692.             int k = stream.readBits(14);
  2693.             if(k == 16383)
  2694.                 break;
  2695.             if(npcArray[k] == null)
  2696.                 npcArray[k] = new NPC();
  2697.             NPC npc = npcArray[k];
  2698.             npcIndices[npcCount++] = k;
  2699.             npc.anInt1537 = loopCycle;
  2700.             int l = stream.readBits(5);
  2701.             if(l > 15)
  2702.                 l -= 32;
  2703.             int i1 = stream.readBits(5);
  2704.             if(i1 > 15)
  2705.                 i1 -= 32;
  2706.             int j1 = stream.readBits(1);
  2707.             npc.desc = EntityDef.forID(stream.readBits(14));
  2708.             int k1 = stream.readBits(1);
  2709.             if(k1 == 1)
  2710.                 anIntArray894[anInt893++] = k;
  2711.             npc.anInt1540 = npc.desc.aByte68;
  2712.             npc.anInt1504 = npc.desc.anInt79;
  2713.             npc.anInt1554 = npc.desc.walkAnim;
  2714.             npc.anInt1555 = npc.desc.anInt58;
  2715.             npc.anInt1556 = npc.desc.anInt83;
  2716.             npc.anInt1557 = npc.desc.anInt55;
  2717.             npc.anInt1511 = npc.desc.standAnim;
  2718.             npc.setPos(myPlayer.smallX[0] + i1, myPlayer.smallY[0] + l, j1 == 1);
  2719.         }
  2720.         stream.finishBitAccess();
  2721.     }
  2722.  
  2723.     public void processGameLoop() {
  2724.         if(rsAlreadyLoaded || loadingError || genericLoadingError)
  2725.             return;
  2726.         loopCycle++;
  2727.         if(!loggedIn)
  2728.             processLoginScreenInput();
  2729.         else
  2730.             mainGameProcessor();
  2731.         processOnDemandQueue();
  2732.     }
  2733.  
  2734.     private void method47(boolean flag) {
  2735.         if(myPlayer.x >> 7 == destX && myPlayer.y >> 7 == destY)
  2736.             destX = 0;
  2737.         int j = playerCount;
  2738.         if(flag)
  2739.             j = 1;
  2740.         for(int l = 0; l < j; l++) {
  2741.             Player player;
  2742.             int i1;
  2743.             if(flag) {
  2744.                 player = myPlayer;
  2745.                 i1 = myPlayerIndex << 14;
  2746.             } else {
  2747.                 player = playerArray[playerIndices[l]];
  2748.                 i1 = playerIndices[l] << 14;
  2749.             }
  2750.             if(player == null || !player.isVisible())
  2751.                 continue;
  2752.             player.aBoolean1699 = (lowMem && playerCount > 50 || playerCount > 200) && !flag && player.anInt1517 == player.anInt1511;
  2753.             int j1 = player.x >> 7;
  2754.             int k1 = player.y >> 7;
  2755.             if(j1 < 0 || j1 >= 104 || k1 < 0 || k1 >= 104)
  2756.                 continue;
  2757.             if(player.aModel_1714 != null && loopCycle >= player.anInt1707 && loopCycle < player.anInt1708) {
  2758.                 player.aBoolean1699 = false;
  2759.                 player.anInt1709 = method42(plane, player.y, player.x);
  2760.                 worldController.method286(plane, player.y, player, player.anInt1552, player.anInt1722, player.x, player.anInt1709, player.anInt1719, player.anInt1721, i1, player.anInt1720);
  2761.                 continue;
  2762.             }
  2763.             if((player.x & 0x7f) == 64 && (player.y & 0x7f) == 64) {
  2764.                 if(anIntArrayArray929[j1][k1] == anInt1265)
  2765.                     continue;
  2766.                 anIntArrayArray929[j1][k1] = anInt1265;
  2767.             }
  2768.             player.anInt1709 = method42(plane, player.y, player.x);
  2769.             worldController.method285(plane, player.anInt1552, player.anInt1709, i1, player.y, 60, player.x, player, player.aBoolean1541);
  2770.         }
  2771.     }
  2772.  
  2773.     private boolean promptUserForInput(RSInterface class9) {
  2774.         int j = class9.contentType;
  2775.         if(anInt900 == 2) {
  2776.             if(j == 201) {
  2777.                 inputTaken = true;
  2778.                 inputDialogState = 0;
  2779.                 messagePromptRaised = true;
  2780.                 promptInput = "";
  2781.                 friendsListAction = 1;
  2782.                 aString1121 = "Enter name of friend to add to list";
  2783.             }
  2784.             if(j == 202) {
  2785.                 inputTaken = true;
  2786.                 inputDialogState = 0;
  2787.                 messagePromptRaised = true;
  2788.                 promptInput = "";
  2789.                 friendsListAction = 2;
  2790.                 aString1121 = "Enter name of friend to delete from list";
  2791.             }
  2792.         }
  2793.         if(j == 205) {
  2794.             anInt1011 = 250;
  2795.             return true;
  2796.         }
  2797.         if(j == 501) {
  2798.             inputTaken = true;
  2799.             inputDialogState = 0;
  2800.             messagePromptRaised = true;
  2801.             promptInput = "";
  2802.             friendsListAction = 4;
  2803.             aString1121 = "Enter name of player to add to list";
  2804.         }
  2805.         if(j == 502) {
  2806.             inputTaken = true;
  2807.             inputDialogState = 0;
  2808.             messagePromptRaised = true;
  2809.             promptInput = "";
  2810.             friendsListAction = 5;
  2811.             aString1121 = "Enter name of player to delete from list";
  2812.         }
  2813.         if(j == 550) {
  2814.             inputTaken = true;
  2815.             inputDialogState = 0;
  2816.             messagePromptRaised = true;
  2817.             promptInput = "";
  2818.             friendsListAction = 6;
  2819.             aString1121 = "Enter the name of the chat you wish to join";
  2820.         }
  2821.         if(j >= 300 && j <= 313) {
  2822.             int k = (j - 300) / 2;
  2823.             int j1 = j & 1;
  2824.             int i2 = anIntArray1065[k];
  2825.             if(i2 != -1) {
  2826.                 do {
  2827.                     if(j1 == 0 && --i2 < 0)
  2828.                         i2 = IDK.length - 1;
  2829.                     if(j1 == 1 && ++i2 >= IDK.length)
  2830.                         i2 = 0;
  2831.                 } while(IDK.cache[i2].aBoolean662 || IDK.cache[i2].anInt657 != k + (aBoolean1047 ? 0 : 7));
  2832.                 anIntArray1065[k] = i2;
  2833.                 aBoolean1031 = true;
  2834.             }
  2835.         }
  2836.         if(j >= 314 && j <= 323) {
  2837.             int l = (j - 314) / 2;
  2838.             int k1 = j & 1;
  2839.             int j2 = anIntArray990[l];
  2840.             if(k1 == 0 && --j2 < 0)
  2841.                 j2 = anIntArrayArray1003[l].length - 1;
  2842.             if(k1 == 1 && ++j2 >= anIntArrayArray1003[l].length)
  2843.                 j2 = 0;
  2844.             anIntArray990[l] = j2;
  2845.             aBoolean1031 = true;
  2846.         }
  2847.         if(j == 324 && !aBoolean1047) {
  2848.             aBoolean1047 = true;
  2849.             method45();
  2850.         }
  2851.         if(j == 325 && aBoolean1047) {
  2852.             aBoolean1047 = false;
  2853.             method45();
  2854.         }
  2855.         if(j == 326) {
  2856.             stream.createFrame(101);
  2857.             stream.writeWordBigEndian(aBoolean1047 ? 0 : 1);
  2858.             for(int i1 = 0; i1 < 7; i1++)
  2859.                 stream.writeWordBigEndian(anIntArray1065[i1]);
  2860.  
  2861.             for(int l1 = 0; l1 < 5; l1++)
  2862.                 stream.writeWordBigEndian(anIntArray990[l1]);
  2863.  
  2864.             return true;
  2865.         }
  2866.         System.out.println(""+j);
  2867.         if(j == 612)
  2868.             canMute = !canMute;
  2869.         if(j == 613)
  2870.             canBan = !canBan;
  2871.         if(j >= 602 && j <= 616) {
  2872.             clearTopInterfaces();
  2873.             if(reportAbuseInput.length() > 0 && myPrivilege > 0) {
  2874.            
  2875.             String[] commands = {"mute","unmute","jail","unjail","ban","unban","","ipmute","unipmute","ipban","unipban"};
  2876.                 String inputString = "::"+(commands[j-602])+" "+reportAbuseInput;
  2877.                 stream.createFrame(103);
  2878.                 stream.writeWordBigEndian(inputString.length() - 1);
  2879.                 stream.writeString(inputString.substring(2));
  2880.             }
  2881.        
  2882.         }
  2883.         return false;
  2884.     }
  2885.     private void method49(Stream stream) {
  2886.         for(int j = 0; j < anInt893; j++) {
  2887.             int k = anIntArray894[j];
  2888.             Player player = playerArray[k];
  2889.             int l = stream.readUnsignedByte();
  2890.             if((l & 0x40) != 0)
  2891.                 l += stream.readUnsignedByte() << 8;
  2892.             method107(l, k, stream, player);
  2893.         }
  2894.     }  
  2895.    
  2896.     private void method50(int i, int k, int l, int i1, int j1) {
  2897.         int k1 = worldController.method300(j1, l, i);
  2898.         if(k1 != 0) {
  2899.             int l1 = worldController.method304(j1, l, i, k1);
  2900.             int k2 = l1 >> 6 & 3;
  2901.             int i3 = l1 & 0x1f;
  2902.             int k3 = k;
  2903.             if(k1 > 0)
  2904.                 k3 = i1;
  2905.             int ai[] = miniMapImage.myPixels;
  2906.             int k4 = 24624 + l * 4 + (103 - i) * 512 * 4;
  2907.             int i5 = k1 >> 14 & 0x7fff;
  2908.             ObjectDef class46_2 = ObjectDef.forID(i5);
  2909.             if(class46_2.anInt758 != -1) {
  2910.                 Background background_2 = mapScenes[class46_2.anInt758];
  2911.                 if(background_2 != null) {
  2912.                     int i6 = (class46_2.anInt744 * 4 - background_2.anInt1452) / 2;
  2913.                     int j6 = (class46_2.anInt761 * 4 - background_2.anInt1453) / 2;
  2914.                     background_2.drawBackground(48 + l * 4 + i6, 48 + (104 - i - class46_2.anInt761) * 4 + j6);
  2915.                 }
  2916.             } else {
  2917.                 if(i3 == 0 || i3 == 2)
  2918.                     if(k2 == 0) {
  2919.                         ai[k4] = k3;
  2920.                         ai[k4 + 512] = k3;
  2921.                         ai[k4 + 1024] = k3;
  2922.                         ai[k4 + 1536] = k3;
  2923.                     } else if(k2 == 1) {
  2924.                         ai[k4] = k3;
  2925.                         ai[k4 + 1] = k3;
  2926.                         ai[k4 + 2] = k3;
  2927.                         ai[k4 + 3] = k3;
  2928.                     } else if(k2 == 2) {
  2929.                         ai[k4 + 3] = k3;
  2930.                         ai[k4 + 3 + 512] = k3;
  2931.                         ai[k4 + 3 + 1024] = k3;
  2932.                         ai[k4 + 3 + 1536] = k3;
  2933.                     } else if(k2 == 3) {
  2934.                         ai[k4 + 1536] = k3;
  2935.                         ai[k4 + 1536 + 1] = k3;
  2936.                         ai[k4 + 1536 + 2] = k3;
  2937.                         ai[k4 + 1536 + 3] = k3;
  2938.                     }
  2939.                 if(i3 == 3)
  2940.                     if(k2 == 0)
  2941.                         ai[k4] = k3;
  2942.                     else if(k2 == 1)
  2943.                         ai[k4 + 3] = k3;
  2944.                     else if(k2 == 2)
  2945.                         ai[k4 + 3 + 1536] = k3;
  2946.                     else if(k2 == 3)
  2947.                         ai[k4 + 1536] = k3;
  2948.                 if(i3 == 2)
  2949.                     if(k2 == 3) {
  2950.                         ai[k4] = k3;
  2951.                         ai[k4 + 512] = k3;
  2952.                         ai[k4 + 1024] = k3;
  2953.                         ai[k4 + 1536] = k3;
  2954.                     } else if(k2 == 0) {
  2955.                         ai[k4] = k3;
  2956.                         ai[k4 + 1] = k3;
  2957.                         ai[k4 + 2] = k3;
  2958.                         ai[k4 + 3] = k3;
  2959.                     } else if(k2 == 1) {
  2960.                         ai[k4 + 3] = k3;
  2961.                         ai[k4 + 3 + 512] = k3;
  2962.                         ai[k4 + 3 + 1024] = k3;
  2963.                         ai[k4 + 3 + 1536] = k3;
  2964.                     } else if(k2 == 2) {
  2965.                         ai[k4 + 1536] = k3;
  2966.                         ai[k4 + 1536 + 1] = k3;
  2967.                         ai[k4 + 1536 + 2] = k3;
  2968.                         ai[k4 + 1536 + 3] = k3;
  2969.                     }
  2970.             }
  2971.         }
  2972.         k1 = worldController.method302(j1, l, i);
  2973.         if(k1 != 0) {
  2974.             int i2 = worldController.method304(j1, l, i, k1);
  2975.             int l2 = i2 >> 6 & 3;
  2976.             int j3 = i2 & 0x1f;
  2977.             int l3 = k1 >> 14 & 0x7fff;
  2978.             ObjectDef class46_1 = ObjectDef.forID(l3);
  2979.             if(class46_1.anInt758 != -1) {
  2980.                 Background background_1 = mapScenes[class46_1.anInt758];
  2981.                 if(background_1 != null) {
  2982.                     int j5 = (class46_1.anInt744 * 4 - background_1.anInt1452) / 2;
  2983.                     int k5 = (class46_1.anInt761 * 4 - background_1.anInt1453) / 2;
  2984.                     background_1.drawBackground(48 + l * 4 + j5, 48 + (104 - i - class46_1.anInt761) * 4 + k5);
  2985.                 }
  2986.             } else if(j3 == 9) {
  2987.                 int l4 = 0xeeeeee;
  2988.                 if(k1 > 0)
  2989.                     l4 = 0xee0000;
  2990.                 int ai1[] = miniMapImage.myPixels;
  2991.                 int l5 = 24624 + l * 4 + (103 - i) * 512 * 4;
  2992.                 if(l2 == 0 || l2 == 2) {
  2993.                     ai1[l5 + 1536] = l4;
  2994.                     ai1[l5 + 1024 + 1] = l4;
  2995.                     ai1[l5 + 512 + 2] = l4;
  2996.                     ai1[l5 + 3] = l4;
  2997.                 } else {
  2998.                     ai1[l5] = l4;
  2999.                     ai1[l5 + 512 + 1] = l4;
  3000.                     ai1[l5 + 1024 + 2] = l4;
  3001.                     ai1[l5 + 1536 + 3] = l4;
  3002.                 }
  3003.             }
  3004.         }
  3005.         k1 = worldController.method303(j1, l, i);
  3006.         if(k1 != 0) {
  3007.             int j2 = k1 >> 14 & 0x7fff;
  3008.             ObjectDef class46 = ObjectDef.forID(j2);
  3009.             if(class46.anInt758 != -1) {
  3010.                 Background background = mapScenes[class46.anInt758];
  3011.                 if(background != null) {
  3012.                     int i4 = (class46.anInt744 * 4 - background.anInt1452) / 2;
  3013.                     int j4 = (class46.anInt761 * 4 - background.anInt1453) / 2;
  3014.                     background.drawBackground(48 + l * 4 + i4, 48 + (104 - i - class46.anInt761) * 4 + j4);
  3015.                 }
  3016.             }
  3017.         }
  3018.     }
  3019.  
  3020.     private void loadTitleScreen() {
  3021.    
  3022.         aBackground_967 = new Background(titleStreamLoader, "titlebutton", 0);
  3023.         aBackgroundArray1152s = new Background[12];
  3024.         int j = 0;
  3025.         try {
  3026.             j = Integer.parseInt(getParameter("fl_icon"));
  3027.         } catch(Exception _ex) {
  3028.         }
  3029.         if(j == 0) {
  3030.             for(int k = 0; k < 12; k++)
  3031.                 aBackgroundArray1152s[k] = new Background(titleStreamLoader, "runes", k);
  3032.  
  3033.         } else {
  3034.             for(int l = 0; l < 12; l++)
  3035.                 aBackgroundArray1152s[l] = new Background(titleStreamLoader, "runes", 12 + (l & 3));
  3036.  
  3037.         }
  3038.         aClass30_Sub2_Sub1_Sub1_1201 = new Sprite(128, 265);
  3039.         aClass30_Sub2_Sub1_Sub1_1202 = new Sprite(128, 265);
  3040.         System.arraycopy(aRSImageProducer_1110.anIntArray315, 0, aClass30_Sub2_Sub1_Sub1_1201.myPixels, 0, 33920);
  3041.  
  3042.         System.arraycopy(aRSImageProducer_1111.anIntArray315, 0, aClass30_Sub2_Sub1_Sub1_1202.myPixels, 0, 33920);
  3043.  
  3044.         anIntArray851 = new int[256];
  3045.         for(int k1 = 0; k1 < 64; k1++)
  3046.             anIntArray851[k1] = k1 * 0x40000;
  3047.  
  3048.         for(int l1 = 0; l1 < 64; l1++)
  3049.             anIntArray851[l1 + 64] = 0xff0000 + 1024 * l1;
  3050.  
  3051.         for(int i2 = 0; i2 < 64; i2++)
  3052.             anIntArray851[i2 + 128] = 0xffff00 + 4 * i2;
  3053.  
  3054.         for(int j2 = 0; j2 < 64; j2++)
  3055.             anIntArray851[j2 + 192] = 0xffffff;
  3056.  
  3057.         anIntArray852 = new int[256];
  3058.         for(int k2 = 0; k2 < 64; k2++)
  3059.             anIntArray852[k2] = k2 * 1024;
  3060.  
  3061.         for(int l2 = 0; l2 < 64; l2++)
  3062.             anIntArray852[l2 + 64] = 65280 + 4 * l2;
  3063.  
  3064.         for(int i3 = 0; i3 < 64; i3++)
  3065.             anIntArray852[i3 + 128] = 65535 + 0x40000 * i3;
  3066.  
  3067.         for(int j3 = 0; j3 < 64; j3++)
  3068.             anIntArray852[j3 + 192] = 0xffffff;
  3069.  
  3070.         anIntArray853 = new int[256];
  3071.         for(int k3 = 0; k3 < 64; k3++)
  3072.             anIntArray853[k3] = k3 * 4;
  3073.  
  3074.         for(int l3 = 0; l3 < 64; l3++)
  3075.             anIntArray853[l3 + 64] = 255 + 0x40000 * l3;
  3076.  
  3077.         for(int i4 = 0; i4 < 64; i4++)
  3078.             anIntArray853[i4 + 128] = 0xff00ff + 1024 * i4;
  3079.  
  3080.         for(int j4 = 0; j4 < 64; j4++)
  3081.             anIntArray853[j4 + 192] = 0xffffff;
  3082.  
  3083.         anIntArray850 = new int[256];
  3084.         anIntArray1190 = new int[32768];
  3085.         anIntArray1191 = new int[32768];
  3086.         randomizeBackground(null);
  3087.         anIntArray828 = new int[32768];
  3088.         anIntArray829 = new int[32768];
  3089.         drawLoadingText(10, "");
  3090.         if(!aBoolean831) {
  3091.             //drawFlames = true;
  3092.             //aBoolean831 = true;
  3093.             //startRunnable(this, 2);
  3094.         }
  3095.     }
  3096.  
  3097.     private static void setHighMem() {
  3098.         WorldController.lowMem = false;
  3099.         Texture.lowMem = false;
  3100.         lowMem = false;
  3101.         ObjectManager.lowMem = false;
  3102.         ObjectDef.lowMem = false;
  3103.     }
  3104.    
  3105.     private void loadingStages() {
  3106.         if(lowMem && loadingStage == 2 && ObjectManager.anInt131 != plane) {
  3107.             main3DArea.initDrawingArea();
  3108.             normalFont.drawText(0, "Loading - please wait.", 151, 257);
  3109.             normalFont.drawText(0xffffff, "Loading - please wait.", 150, 256);
  3110.             main3DArea.drawGraphics(toggleFullscreen ? 0 : 4, super.graphics, toggleFullscreen ? 0 : 4);
  3111.             loadingStage = 1;
  3112.             aLong824 = System.currentTimeMillis();
  3113.         }
  3114.         if(loadingStage == 1) {
  3115.             int j = method54();
  3116.             if(j != 0 && System.currentTimeMillis() - aLong824 > 0x57e40L) {
  3117.                 signlink.reporterror(myUsername + " glcfb " + aLong1215 + "," + j + "," + lowMem + "," + decompressors[0] + "," + onDemandFetcher.getNodeCount() + "," + plane + "," + anInt1069 + "," + anInt1070);
  3118.                 aLong824 = System.currentTimeMillis();
  3119.             }
  3120.         }
  3121.         if(loadingStage == 2 && plane != anInt985) {
  3122.             anInt985 = plane;
  3123.             method24(plane);
  3124.         }
  3125.     }
  3126.  
  3127.     private int method54() {
  3128.         for(int i = 0; i < aByteArrayArray1183.length; i++) {
  3129.             if(aByteArrayArray1183[i] == null && anIntArray1235[i] != -1)
  3130.                 return -1;
  3131.             if(aByteArrayArray1247[i] == null && anIntArray1236[i] != -1)
  3132.                 return -2;
  3133.         }
  3134.         boolean flag = true;
  3135.         for(int j = 0; j < aByteArrayArray1183.length; j++) {
  3136.             byte abyte0[] = aByteArrayArray1247[j];
  3137.             if(abyte0 != null) {
  3138.                 int k = (anIntArray1234[j] >> 8) * 64 - baseX;
  3139.                 int l = (anIntArray1234[j] & 0xff) * 64 - baseY;
  3140.                 if(aBoolean1159) {
  3141.                     k = 10;
  3142.                     l = 10;
  3143.                 }
  3144.                 flag &= ObjectManager.method189(k, abyte0, l);
  3145.             }
  3146.         }
  3147.         if(!flag)
  3148.             return -3;
  3149.         if(aBoolean1080) {
  3150.             return -4;
  3151.         } else {
  3152.             loadingStage = 2;
  3153.             ObjectManager.anInt131 = plane;
  3154.             method22();
  3155.             stream.createFrame(121);
  3156.             return 0;
  3157.         }
  3158.     }
  3159.  
  3160.     private void method55()
  3161.     {
  3162.         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())
  3163.             if(class30_sub2_sub4_sub4.anInt1597 != plane || loopCycle > class30_sub2_sub4_sub4.anInt1572)
  3164.                 class30_sub2_sub4_sub4.unlink();
  3165.             else
  3166.             if(loopCycle >= class30_sub2_sub4_sub4.anInt1571)
  3167.             {
  3168.                 if(class30_sub2_sub4_sub4.anInt1590 > 0)
  3169.                 {
  3170.                     NPC npc = npcArray[class30_sub2_sub4_sub4.anInt1590 - 1];
  3171.                     if(npc != null && npc.x >= 0 && npc.x < 13312 && npc.y >= 0 && npc.y < 13312)
  3172.                         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);
  3173.                 }
  3174.                 if(class30_sub2_sub4_sub4.anInt1590 < 0)
  3175.                 {
  3176.                     int j = -class30_sub2_sub4_sub4.anInt1590 - 1;
  3177.                     Player player;
  3178.                     if(j == unknownInt10)
  3179.                         player = myPlayer;
  3180.                     else
  3181.                         player = playerArray[j];
  3182.                     if(player != null && player.x >= 0 && player.x < 13312 && player.y >= 0 && player.y < 13312)
  3183.                         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);
  3184.                 }
  3185.                 class30_sub2_sub4_sub4.method456(anInt945);
  3186.                 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);
  3187.             }
  3188.  
  3189.     }
  3190.  
  3191.     public AppletContext getAppletContext()
  3192.     {
  3193.         if(signlink.mainapp != null)
  3194.             return signlink.mainapp.getAppletContext();
  3195.         else
  3196.             return super.getAppletContext();
  3197.     }
  3198.  
  3199.     private void drawLogo() {
  3200.         Sprite sprite = new Sprite("background");
  3201.         aRSImageProducer_1110.initDrawingArea();
  3202.         sprite.method346(0, 0);
  3203.         aRSImageProducer_1111.initDrawingArea();
  3204.         sprite.method346(-637, 0);
  3205.         aRSImageProducer_1107.initDrawingArea();
  3206.         sprite.method346(-128, 0);
  3207.         aRSImageProducer_1108.initDrawingArea();
  3208.         sprite.method346(-202, -371);
  3209.         aRSImageProducer_1109.initDrawingArea();
  3210.         sprite.method346(-202, -171);
  3211.         aRSImageProducer_1112.initDrawingArea();
  3212.         sprite.method346(0, -265);
  3213.         aRSImageProducer_1113.initDrawingArea();
  3214.         sprite.method346(-562, -265);
  3215.         aRSImageProducer_1114.initDrawingArea();
  3216.         sprite.method346(-128, -171);
  3217.         aRSImageProducer_1115.initDrawingArea();
  3218.         sprite.method346(-562, -171);
  3219.  
  3220.         aRSImageProducer_1110.initDrawingArea();
  3221.         aRSImageProducer_1111.initDrawingArea();
  3222.         aRSImageProducer_1107.initDrawingArea();
  3223.         aRSImageProducer_1108.initDrawingArea();
  3224.         aRSImageProducer_1109.initDrawingArea();
  3225.         aRSImageProducer_1112.initDrawingArea();
  3226.         aRSImageProducer_1113.initDrawingArea();
  3227.         aRSImageProducer_1114.initDrawingArea();
  3228.         aRSImageProducer_1115.initDrawingArea();
  3229.         /*sprite = new Sprite(titleStreamLoader, "logo", 0);
  3230.         aRSImageProducer_1107.initDrawingArea();
  3231.         sprite.drawSprite(382 - sprite.myWidth / 2 - 128, 18);
  3232.         */
  3233.  
  3234.         sprite = null;
  3235.         Object obj = null;
  3236.         Object obj1 = null;
  3237.         System.gc();
  3238.     }
  3239.     private void processOnDemandQueue()
  3240.     {
  3241.         do
  3242.         {
  3243.             OnDemandData onDemandData;
  3244.             do
  3245.             {
  3246.                 onDemandData = onDemandFetcher.getNextNode();
  3247.                 if(onDemandData == null)
  3248.                     return;
  3249.                 if(onDemandData.dataType == 0)
  3250.                 {
  3251.                     Model.method460(onDemandData.buffer, onDemandData.ID);
  3252.                     if((onDemandFetcher.getModelIndex(onDemandData.ID) & 0x62) != 0)
  3253.                     {
  3254.                         needDrawTabArea = true;
  3255.                         if(backDialogID != -1)
  3256.                             inputTaken = true;
  3257.                     }
  3258.                 }
  3259.                 //if(onDemandData.dataType == 1 && onDemandData.buffer != null)
  3260.                     //Class36.method529(onDemandData.buffer);
  3261.                 if(onDemandData.dataType == 2 && onDemandData.ID == nextSong && onDemandData.buffer != null)
  3262.                     SoundProvider.getSingleton().playMIDI(onDemandData.buffer);
  3263.                 if(onDemandData.dataType == 3 && loadingStage == 1)
  3264.                 {
  3265.                 //System.out.println("Mapdata Region: "+onDemandData.ID);
  3266.                     try {
  3267.                         writeFile(onDemandData.buffer, "./maps/" + onDemandData.ID + ".dat");
  3268.                     } catch (Exception e) {}
  3269.                     for(int i = 0; i < aByteArrayArray1183.length; i++)
  3270.                     {
  3271.                         if(anIntArray1235[i] == onDemandData.ID)
  3272.                         {
  3273.                             aByteArrayArray1183[i] = onDemandData.buffer;
  3274.                             if(onDemandData.buffer == null)
  3275.                                 anIntArray1235[i] = -1;
  3276.                             break;
  3277.                         }
  3278.                         if(anIntArray1236[i] != onDemandData.ID)
  3279.                             continue;
  3280.                         aByteArrayArray1247[i] = onDemandData.buffer;
  3281.                         if(onDemandData.buffer == null)
  3282.                             anIntArray1236[i] = -1;
  3283.                         break;
  3284.                     }
  3285.  
  3286.                 }
  3287.             } while(onDemandData.dataType != 93 || !onDemandFetcher.method564(onDemandData.ID));
  3288.             ObjectManager.method173(new Stream(onDemandData.buffer), onDemandFetcher);
  3289.         } while(true);
  3290.     }
  3291.  
  3292.     public static void writeFile(byte[] data, String fileName) throws IOException{
  3293.         OutputStream out = new FileOutputStream(fileName);
  3294.         out.write(data);
  3295.         out.close();
  3296.     }
  3297.    
  3298.     private void calcFlamesPosition()
  3299.     {
  3300.         char c = '\u0100';
  3301.         for(int j = 10; j < 117; j++)
  3302.         {
  3303.             int k = (int)(Math.random() * 100D);
  3304.             if(k < 50)
  3305.                 anIntArray828[j + (c - 2 << 7)] = 255;
  3306.         }
  3307.         for(int l = 0; l < 100; l++)
  3308.         {
  3309.             int i1 = (int)(Math.random() * 124D) + 2;
  3310.             int k1 = (int)(Math.random() * 128D) + 128;
  3311.             int k2 = i1 + (k1 << 7);
  3312.             anIntArray828[k2] = 192;
  3313.         }
  3314.  
  3315.         for(int j1 = 1; j1 < c - 1; j1++)
  3316.         {
  3317.             for(int l1 = 1; l1 < 127; l1++)
  3318.             {
  3319.                 int l2 = l1 + (j1 << 7);
  3320.                 anIntArray829[l2] = (anIntArray828[l2 - 1] + anIntArray828[l2 + 1] + anIntArray828[l2 - 128] + anIntArray828[l2 + 128]) / 4;
  3321.             }
  3322.  
  3323.         }
  3324.  
  3325.         anInt1275 += 128;
  3326.         if(anInt1275 > anIntArray1190.length)
  3327.         {
  3328.             anInt1275 -= anIntArray1190.length;
  3329.             int i2 = (int)(Math.random() * 12D);
  3330.             randomizeBackground(aBackgroundArray1152s[i2]);
  3331.         }
  3332.         for(int j2 = 1; j2 < c - 1; j2++)
  3333.         {
  3334.             for(int i3 = 1; i3 < 127; i3++)
  3335.             {
  3336.                 int k3 = i3 + (j2 << 7);
  3337.                 int i4 = anIntArray829[k3 + 128] - anIntArray1190[k3 + anInt1275 & anIntArray1190.length - 1] / 5;
  3338.                 if(i4 < 0)
  3339.                     i4 = 0;
  3340.                 anIntArray828[k3] = i4;
  3341.             }
  3342.  
  3343.         }
  3344.  
  3345.         System.arraycopy(anIntArray969, 1, anIntArray969, 0, c - 1);
  3346.  
  3347.         anIntArray969[c - 1] = (int)(Math.sin((double)loopCycle / 14D) * 16D + Math.sin((double)loopCycle / 15D) * 14D + Math.sin((double)loopCycle / 16D) * 12D);
  3348.         if(anInt1040 > 0)
  3349.             anInt1040 -= 4;
  3350.         if(anInt1041 > 0)
  3351.             anInt1041 -= 4;
  3352.         if(anInt1040 == 0 && anInt1041 == 0)
  3353.         {
  3354.             int l3 = (int)(Math.random() * 2000D);
  3355.             if(l3 == 0)
  3356.                 anInt1040 = 1024;
  3357.             if(l3 == 1)
  3358.                 anInt1041 = 1024;
  3359.         }
  3360.     }
  3361.  
  3362.     private void method60(int i)
  3363.     {
  3364.         RSInterface class9 = RSInterface.interfaceCache[i];
  3365.         for(int j = 0; j < class9.children.length; j++)
  3366.         {
  3367.             if(class9.children[j] == -1)
  3368.                 break;
  3369.             RSInterface class9_1 = RSInterface.interfaceCache[class9.children[j]];
  3370.             if(class9_1.type == 1)
  3371.                 method60(class9_1.id);
  3372.             class9_1.anInt246 = 0;
  3373.             class9_1.anInt208 = 0;
  3374.         }
  3375.     }
  3376.  
  3377.     private void drawHeadIcon()
  3378.     {
  3379.         if(hintType != 2)
  3380.             return;
  3381.         calcEntityScreenPos((hintArrowX - baseX << 7) + anInt937, anInt936 * 2, (hintArrowY - baseY << 7) + anInt938);
  3382.         if(spriteDrawX > -1 && loopCycle % 20 < 10)
  3383.             headIconsHint[0].drawSprite(spriteDrawX - 12, spriteDrawY - 28);
  3384.     }
  3385.  
  3386.     private void mainGameProcessor()
  3387.     {
  3388.         if(systemUpdatetime > 1)
  3389.             systemUpdatetime--;
  3390.         if(anInt1011 > 0)
  3391.             anInt1011--;
  3392.         for(int j = 0; j < 5; j++)
  3393.             if(!parsePacket())
  3394.                 break;
  3395.  
  3396.         if(!loggedIn)
  3397.             return;
  3398.         synchronized(mouseDetection.syncObject)
  3399.         {
  3400.             if(flagged)
  3401.             {
  3402.                 if(super.clickMode3 != 0 || mouseDetection.coordsIndex >= 40)
  3403.                 {
  3404.                     stream.createFrame(45);
  3405.                     stream.writeWordBigEndian(0);
  3406.                     int j2 = stream.currentOffset;
  3407.                     int j3 = 0;
  3408.                     for(int j4 = 0; j4 < mouseDetection.coordsIndex; j4++)
  3409.                     {
  3410.                         if(j2 - stream.currentOffset >= 240)
  3411.                             break;
  3412.                         j3++;
  3413.                         int l4 = mouseDetection.coordsY[j4];
  3414.                         if(l4 < 0)
  3415.                             l4 = 0;
  3416.                         else
  3417.                         if(l4 > 502)
  3418.                             l4 = 502;
  3419.                         int k5 = mouseDetection.coordsX[j4];
  3420.                         if(k5 < 0)
  3421.                             k5 = 0;
  3422.                         else
  3423.                         if(k5 > 764)
  3424.                             k5 = 764;
  3425.                         int i6 = l4 * 765 + k5;
  3426.                         if(mouseDetection.coordsY[j4] == -1 && mouseDetection.coordsX[j4] == -1)
  3427.                         {
  3428.                             k5 = -1;
  3429.                             l4 = -1;
  3430.                             i6 = 0x7ffff;
  3431.                         }
  3432.                         if(k5 == anInt1237 && l4 == anInt1238)
  3433.                         {
  3434.                             if(anInt1022 < 2047)
  3435.                                 anInt1022++;
  3436.                         } else
  3437.                         {
  3438.                             int j6 = k5 - anInt1237;
  3439.                             anInt1237 = k5;
  3440.                             int k6 = l4 - anInt1238;
  3441.                             anInt1238 = l4;
  3442.                             if(anInt1022 < 8 && j6 >= -32 && j6 <= 31 && k6 >= -32 && k6 <= 31)
  3443.                             {
  3444.                                 j6 += 32;
  3445.                                 k6 += 32;
  3446.                                 stream.writeWord((anInt1022 << 12) + (j6 << 6) + k6);
  3447.                                 anInt1022 = 0;
  3448.                             } else
  3449.                             if(anInt1022 < 8)
  3450.                             {
  3451.                                 stream.writeDWordBigEndian(0x800000 + (anInt1022 << 19) + i6);
  3452.                                 anInt1022 = 0;
  3453.                             } else
  3454.                             {
  3455.                                 stream.writeDWord(0xc0000000 + (anInt1022 << 19) + i6);
  3456.                                 anInt1022 = 0;
  3457.                             }
  3458.                         }
  3459.                     }
  3460.  
  3461.                     stream.writeBytes(stream.currentOffset - j2);
  3462.                     if(j3 >= mouseDetection.coordsIndex)
  3463.                     {
  3464.                         mouseDetection.coordsIndex = 0;
  3465.                     } else
  3466.                     {
  3467.                         mouseDetection.coordsIndex -= j3;
  3468.                         for(int i5 = 0; i5 < mouseDetection.coordsIndex; i5++)
  3469.                         {
  3470.                             mouseDetection.coordsX[i5] = mouseDetection.coordsX[i5 + j3];
  3471.                             mouseDetection.coordsY[i5] = mouseDetection.coordsY[i5 + j3];
  3472.                         }
  3473.  
  3474.                     }
  3475.                 }
  3476.             } else
  3477.             {
  3478.                 mouseDetection.coordsIndex = 0;
  3479.             }
  3480.         }
  3481.         if(super.clickMode3 != 0)
  3482.         {
  3483.             long l = (super.aLong29 - aLong1220) / 50L;
  3484.             if(l > 4095L)
  3485.                 l = 4095L;
  3486.             aLong1220 = super.aLong29;
  3487.             int k2 = super.saveClickY;
  3488.             if(k2 < 0)
  3489.                 k2 = 0;
  3490.             else
  3491.             if(k2 > 502)
  3492.                 k2 = 502;
  3493.             int k3 = super.saveClickX;
  3494.             if(k3 < 0)
  3495.                 k3 = 0;
  3496.             else
  3497.             if(k3 > 764)
  3498.                 k3 = 764;
  3499.             int k4 = k2 * 765 + k3;
  3500.             int j5 = 0;
  3501.             if(super.clickMode3 == 2)
  3502.                 j5 = 1;
  3503.             int l5 = (int)l;
  3504.             stream.createFrame(241);
  3505.             stream.writeDWord((l5 << 20) + (j5 << 19) + k4);
  3506.         }
  3507.         if(anInt1016 > 0)
  3508.             anInt1016--;
  3509.         if(super.keyArray[1] == 1 || super.keyArray[2] == 1 || super.keyArray[3] == 1 || super.keyArray[4] == 1)
  3510.             aBoolean1017 = true;
  3511.         if(aBoolean1017 && anInt1016 <= 0)
  3512.         {
  3513.             anInt1016 = 20;
  3514.             aBoolean1017 = false;
  3515.             stream.createFrame(86);
  3516.             stream.writeWord(anInt1184);
  3517.             stream.method432(compassRotation);
  3518.         }
  3519.         if(super.awtFocus && !aBoolean954)
  3520.         {
  3521.             aBoolean954 = true;
  3522.             stream.createFrame(3);
  3523.             stream.writeWordBigEndian(1);
  3524.         }
  3525.         if(!super.awtFocus && aBoolean954)
  3526.         {
  3527.             aBoolean954 = false;
  3528.             stream.createFrame(3);
  3529.             stream.writeWordBigEndian(0);
  3530.         }
  3531.         loadingStages();
  3532.         method115();
  3533.         method90();
  3534.         anInt1009++;
  3535.         if(anInt1009 > 750)
  3536.             dropClient();
  3537.         method114();
  3538.         method95();
  3539.         method38();
  3540.         anInt945++;
  3541.         if(crossType != 0)
  3542.         {
  3543.             crossIndex += 20;
  3544.             if(crossIndex >= 400)
  3545.                 crossType = 0;
  3546.         }
  3547.         if(atInventoryInterfaceType != 0)
  3548.         {
  3549.             atInventoryLoopCycle++;
  3550.             if(atInventoryLoopCycle >= 15)
  3551.             {
  3552.                 if(atInventoryInterfaceType == 2)
  3553.                     needDrawTabArea = true;
  3554.                 if(atInventoryInterfaceType == 3)
  3555.                     inputTaken = true;
  3556.                 atInventoryInterfaceType = 0;
  3557.             }
  3558.         }
  3559.         if(activeInterfaceType != 0)
  3560.         {
  3561.             anInt989++;
  3562.             if(super.mouseX > anInt1087 + 5 || super.mouseX < anInt1087 - 5 || super.mouseY > anInt1088 + 5 || super.mouseY < anInt1088 - 5)
  3563.                 aBoolean1242 = true;
  3564.             if(super.clickMode2 == 0)
  3565.             {
  3566.                 if(activeInterfaceType == 2)
  3567.                     needDrawTabArea = true;
  3568.                 if(activeInterfaceType == 3)
  3569.                     inputTaken = true;
  3570.                 activeInterfaceType = 0;
  3571.                 if(aBoolean1242 && anInt989 >= 5)
  3572.                 {
  3573.                     lastActiveInvInterface = -1;
  3574.                     processRightClick();
  3575.                     if(lastActiveInvInterface == anInt1084 && mouseInvInterfaceIndex != anInt1085)
  3576.                     {
  3577.                         RSInterface class9 = RSInterface.interfaceCache[anInt1084];
  3578.                         int j1 = 0;
  3579.                         if(anInt913 == 1 && class9.contentType == 206)
  3580.                             j1 = 1;
  3581.                         if(class9.inv[mouseInvInterfaceIndex] <= 0)
  3582.                             j1 = 0;
  3583.                         if(class9.aBoolean235)
  3584.                         {
  3585.                             int l2 = anInt1085;
  3586.                             int l3 = mouseInvInterfaceIndex;
  3587.                             class9.inv[l3] = class9.inv[l2];
  3588.                             class9.invStackSizes[l3] = class9.invStackSizes[l2];
  3589.                             class9.inv[l2] = -1;
  3590.                             class9.invStackSizes[l2] = 0;
  3591.                         } else
  3592.                         if(j1 == 1)
  3593.                         {
  3594.                             int i3 = anInt1085;
  3595.                             for(int i4 = mouseInvInterfaceIndex; i3 != i4;)
  3596.                                 if(i3 > i4)
  3597.                                 {
  3598.                                     class9.swapInventoryItems(i3, i3 - 1);
  3599.                                     i3--;
  3600.                                 } else
  3601.                                 if(i3 < i4)
  3602.                                 {
  3603.                                     class9.swapInventoryItems(i3, i3 + 1);
  3604.                                     i3++;
  3605.                                 }
  3606.  
  3607.                         } else
  3608.                         {
  3609.                             class9.swapInventoryItems(anInt1085, mouseInvInterfaceIndex);
  3610.                         }
  3611.                         stream.createFrame(214);
  3612.                         stream.method433(anInt1084);
  3613.                         stream.method424(j1);
  3614.                         stream.method433(anInt1085);
  3615.                         stream.method431(mouseInvInterfaceIndex);
  3616.                     }
  3617.                 } else
  3618.                 if((anInt1253 == 1 || menuHasAddFriend(menuActionRow - 1)) && menuActionRow > 2)
  3619.                     determineMenuSize();
  3620.                 else
  3621.                 if(menuActionRow > 0)
  3622.                     doAction(menuActionRow - 1);
  3623.                 atInventoryLoopCycle = 10;
  3624.                 super.clickMode3 = 0;
  3625.             }
  3626.         }
  3627.         if(WorldController.anInt470 != -1)
  3628.         {
  3629.             int k = WorldController.anInt470;
  3630.             int k1 = WorldController.anInt471;
  3631.             boolean flag = doWalkTo(0, 0, 0, 0, myPlayer.smallY[0], 0, 0, k1, myPlayer.smallX[0], true, k);
  3632.             WorldController.anInt470 = -1;
  3633.             if(flag)
  3634.             {
  3635.                 crossX = super.saveClickX;
  3636.                 crossY = super.saveClickY;
  3637.                 crossType = 1;
  3638.                 crossIndex = 0;
  3639.             }
  3640.         }
  3641.         if(super.clickMode3 == 1 && aString844 != null)
  3642.         {
  3643.             aString844 = null;
  3644.             inputTaken = true;
  3645.             super.clickMode3 = 0;
  3646.         }
  3647.        
  3648.         if(!contextMenuOpen) {
  3649.             processMinimapClick(getMapIncreaseX(),getMapIncreaseY());
  3650.             processChatModeClick(0,getChatBackIncreaseY());
  3651.         }
  3652.         processMenuClick();
  3653.        
  3654.         if(super.clickMode2 == 1 || super.clickMode3 == 1)
  3655.             anInt1213++;
  3656.         if (anInt1500 != 0 || anInt1044 != 0 || lastHoverToggleChildId != 0) {
  3657.             if (anInt1501 < 100) {
  3658.                 anInt1501++;
  3659.                 if (anInt1501 == 100) {
  3660.                     if (anInt1500 != 0) {
  3661.                         inputTaken = true;
  3662.                     }
  3663.                     if (anInt1044 != 0) {
  3664.                         needDrawTabArea = true;
  3665.                     }
  3666.                 }
  3667.             }
  3668.         } else if (anInt1501 > 0) {
  3669.             anInt1501--;
  3670.         }
  3671.         if(loadingStage == 2)
  3672.             method108();
  3673.         if(loadingStage == 2 && aBoolean1160)
  3674.             calcCameraPos();
  3675.         for(int i1 = 0; i1 < 5; i1++)
  3676.             anIntArray1030[i1]++;
  3677.  
  3678.         method73();
  3679.         super.idleTime++;
  3680.         if(super.idleTime > 4500)
  3681.         {
  3682.             anInt1011 = 250;
  3683.             super.idleTime -= 500;
  3684.             stream.createFrame(202);
  3685.         }
  3686.         anInt988++;
  3687.         if(anInt988 > 500)
  3688.         {
  3689.             anInt988 = 0;
  3690.             int l1 = (int)(Math.random() * 8D);
  3691.             if((l1 & 1) == 1)
  3692.                 anInt1278 += anInt1279;
  3693.             if((l1 & 2) == 2)
  3694.                 anInt1131 += anInt1132;
  3695.             if((l1 & 4) == 4)
  3696.                 anInt896 += anInt897;
  3697.         }
  3698.         if(anInt1278 < -50)
  3699.             anInt1279 = 2;
  3700.         if(anInt1278 > 50)
  3701.             anInt1279 = -2;
  3702.         if(anInt1131 < -55)
  3703.             anInt1132 = 2;
  3704.         if(anInt1131 > 55)
  3705.             anInt1132 = -2;
  3706.         if(anInt896 < -40)
  3707.             anInt897 = 1;
  3708.         if(anInt896 > 40)
  3709.             anInt897 = -1;
  3710.         mapTimedProcessCounter++;
  3711.         if(mapTimedProcessCounter > 500)
  3712.         {
  3713.             mapTimedProcessCounter = 0;
  3714.             int i2 = (int)(Math.random() * 8D);
  3715.             if((i2 & 1) == 1)
  3716.                 mapAmtDiffRotation += mapAmtCounterRotation;
  3717.             if((i2 & 2) == 2)
  3718.                 mapAmtDiffZoom += mapAmtCounterZoom;
  3719.         }
  3720.         if(mapAmtDiffRotation < -60)
  3721.             mapAmtCounterRotation = 2;
  3722.         if(mapAmtDiffRotation > 60)
  3723.             mapAmtCounterRotation = -2;
  3724.         if(mapAmtDiffZoom < -20)
  3725.             mapAmtCounterZoom = 1;
  3726.         if(mapAmtDiffZoom > 10)
  3727.             mapAmtCounterZoom = -1;
  3728.         anInt1010++;
  3729.         if(anInt1010 > 50)
  3730.             stream.createFrame(0);
  3731.         try
  3732.         {
  3733.             if(socketStream != null && stream.currentOffset > 0)
  3734.             {
  3735.                 socketStream.queueBytes(stream.currentOffset, stream.buffer);
  3736.                 stream.currentOffset = 0;
  3737.                 anInt1010 = 0;
  3738.             }
  3739.         }
  3740.         catch(IOException _ex)
  3741.         {
  3742.             dropClient();
  3743.         }
  3744.         catch(Exception exception)
  3745.         {
  3746.             resetLogout();
  3747.         }
  3748.     }
  3749.  
  3750.     private void method63()
  3751.     {
  3752.         Class30_Sub1 class30_sub1 = (Class30_Sub1)aClass19_1179.reverseGetFirst();
  3753.         for(; class30_sub1 != null; class30_sub1 = (Class30_Sub1)aClass19_1179.reverseGetNext())
  3754.             if(class30_sub1.anInt1294 == -1)
  3755.             {
  3756.                 class30_sub1.anInt1302 = 0;
  3757.                 method89(class30_sub1);
  3758.             } else
  3759.             {
  3760.                 class30_sub1.unlink();
  3761.             }
  3762.  
  3763.     }
  3764.  
  3765.         private void resetImage() {
  3766.                 DrawingArea.setAllPixelsToZero();
  3767.         }
  3768.  
  3769.     private void resetImageProducers()
  3770.     {
  3771.         if(aRSImageProducer_1107 != null)
  3772.             return;
  3773.         super.fullGameScreen = null;
  3774.         rightFrame = null;
  3775.         chatBackImage = null;
  3776.         mapBackImage = null;
  3777.         sideTabArea = null;
  3778.         main3DArea = null;
  3779.         aRSImageProducer_1123 = null;
  3780.         aRSImageProducer_1124 = null;
  3781.         aRSImageProducer_1125 = null;
  3782.         aRSImageProducer_1110 = new RSImageProducer(128, 265, getGameComponent());
  3783.         DrawingArea.setAllPixelsToZero();
  3784.         aRSImageProducer_1111 = new RSImageProducer(128, 265, getGameComponent());
  3785.         DrawingArea.setAllPixelsToZero();
  3786.         aRSImageProducer_1107 = new RSImageProducer(509, 171, getGameComponent());
  3787.         DrawingArea.setAllPixelsToZero();
  3788.         aRSImageProducer_1108 = new RSImageProducer(360, 132, getGameComponent());
  3789.         DrawingArea.setAllPixelsToZero();
  3790.         aRSImageProducer_1109 = new RSImageProducer(360, 233, getGameComponent());
  3791.         DrawingArea.setAllPixelsToZero();
  3792.         aRSImageProducer_1112 = new RSImageProducer(202, 238, getGameComponent());
  3793.         DrawingArea.setAllPixelsToZero();
  3794.         aRSImageProducer_1113 = new RSImageProducer(203, 238, getGameComponent());
  3795.         DrawingArea.setAllPixelsToZero();
  3796.         aRSImageProducer_1114 = new RSImageProducer(74, 94, getGameComponent());
  3797.         DrawingArea.setAllPixelsToZero();
  3798.         aRSImageProducer_1115 = new RSImageProducer(75, 94, getGameComponent());
  3799.         DrawingArea.setAllPixelsToZero();
  3800.         if(titleStreamLoader != null)
  3801.         {
  3802.             drawLogo();
  3803.             loadTitleScreen();
  3804.         }
  3805.         welcomeScreenRaised = true;
  3806.     }
  3807.  
  3808.     void drawLoadingText(int i, String s)
  3809.         {
  3810.             anInt1079 = i;
  3811.         aString1049 = s;
  3812.         resetImageProducers();
  3813.         if(titleStreamLoader == null) {
  3814.             super.drawLoadingText(i, s);
  3815.             return;
  3816.         }
  3817.             aRSImageProducer_1109.initDrawingArea();       
  3818.         loadingBarEmpty = new Sprite("Configuration/empty");
  3819.         loadingBarFull = new Sprite("Configuration/full");
  3820.         loadingBarEmpty.drawSprite(20, 60);
  3821.         loadingBarFull.drawSprite(86, 84);
  3822.         DrawingArea.drawPixels(13, 84, (194 + i), 0x302e2c, (86 - i));
  3823.         if (i == 194) {
  3824.             smallFont.drawText(0xffffff, s + "Loading Deathlypvpz - Please Wait.. 100%", 79, 180);
  3825.         } else {
  3826.             smallFont.drawText(0xffffff, s + "Loading Deathlypvpz - Please Wait.." + (i) + "%", 79, 180);
  3827.                 }
  3828.         aRSImageProducer_1109.drawGraphics(171, super.graphics, 202);
  3829.         if(welcomeScreenRaised) {
  3830.             welcomeScreenRaised = false;
  3831.             if(!aBoolean831) {
  3832.                 aRSImageProducer_1110.drawGraphics(0, super.graphics, 0);
  3833.                 aRSImageProducer_1111.drawGraphics(0, super.graphics, 637);
  3834.             }
  3835.             aRSImageProducer_1107.drawGraphics(0, super.graphics, 128);
  3836.             aRSImageProducer_1108.drawGraphics(371, super.graphics, 202);
  3837.             aRSImageProducer_1112.drawGraphics(265, super.graphics, 0);
  3838.             aRSImageProducer_1113.drawGraphics(265, super.graphics, 562);
  3839.             aRSImageProducer_1114.drawGraphics(171, super.graphics, 128);
  3840.             aRSImageProducer_1115.drawGraphics(171, super.graphics, 562);
  3841.         }
  3842.     }
  3843.  
  3844.     private void method65(int i, int j, int k, int l, RSInterface rsinterface, int i1, boolean flag,  int j1) {
  3845.         byte byte0;
  3846.         if(aBoolean972)
  3847.             byte0 = 32;
  3848.         else
  3849.             byte0 = 0;
  3850.         aBoolean972 = false;
  3851.         if(k >= i && k < i + 16 && l >= i1 && l < i1 + 16) {
  3852.             rsinterface.scrollPosition -= anInt1213 * 4;
  3853.             if(flag)
  3854.                 needDrawTabArea = true;
  3855.         } else if(k >= i && k < i + 16 && l >= (i1 + j) - 16 && l < i1 + j) {
  3856.             rsinterface.scrollPosition += anInt1213 * 4;
  3857.             if(flag)
  3858.                 needDrawTabArea = true;
  3859.         } else if(k >= i - byte0 && k < i + 16 + byte0 && l >= i1 + 16 && l < (i1 + j) - 16 && anInt1213 > 0) {
  3860.             int k1 = ((j - 32) * j) / j1;
  3861.             if(k1 < 8)
  3862.                 k1 = 8;
  3863.             int l1 = l - i1 - 16 - k1 / 2;
  3864.             int i2 = j - 32 - k1;
  3865.             rsinterface.scrollPosition = ((j1 - j) * l1) / i2;
  3866.             if(flag)
  3867.                 needDrawTabArea = true;
  3868.             aBoolean972 = true;
  3869.         }
  3870.     }
  3871.  
  3872.     private boolean method66(int i, int j, int k)
  3873.     {
  3874.         int i1 = i >> 14 & 0x7fff;
  3875.         int j1 = worldController.method304(plane, k, j, i);
  3876.         if(j1 == -1)
  3877.             return false;
  3878.         int k1 = j1 & 0x1f;
  3879.         int l1 = j1 >> 6 & 3;
  3880.         if(k1 == 10 || k1 == 11 || k1 == 22)
  3881.         {
  3882.             ObjectDef class46 = ObjectDef.forID(i1);
  3883.             int i2;
  3884.             int j2;
  3885.             if(l1 == 0 || l1 == 2)
  3886.             {
  3887.                 i2 = class46.anInt744;
  3888.                 j2 = class46.anInt761;
  3889.             } else
  3890.             {
  3891.                 i2 = class46.anInt761;
  3892.                 j2 = class46.anInt744;
  3893.             }
  3894.             int k2 = class46.anInt768;
  3895.             if(l1 != 0)
  3896.                 k2 = (k2 << l1 & 0xf) + (k2 >> 4 - l1);
  3897.             doWalkTo(2, 0, j2, 0, myPlayer.smallY[0], i2, k2, j, myPlayer.smallX[0], false, k);
  3898.         } else
  3899.         {
  3900.             doWalkTo(2, l1, 0, k1 + 1, myPlayer.smallY[0], 0, 0, j, myPlayer.smallX[0], false, k);
  3901.         }
  3902.         crossX = super.saveClickX;
  3903.         crossY = super.saveClickY;
  3904.         crossType = 2;
  3905.         crossIndex = 0;
  3906.         return true;
  3907.     }
  3908.  
  3909.     private StreamLoader streamLoaderForName(int i, String s, String s1, int j, int k)
  3910.     {
  3911.         byte abyte0[] = null;
  3912.         int l = 5;
  3913.         try
  3914.         {
  3915.             if(decompressors[0] != null)
  3916.                 abyte0 = decompressors[0].decompress(i);
  3917.         }
  3918.         catch(Exception _ex) { }
  3919.         if(abyte0 != null)
  3920.         {
  3921.     //      aCRC32_930.reset();
  3922.     //      aCRC32_930.update(abyte0);
  3923.     //      int i1 = (int)aCRC32_930.getValue();
  3924.     //      if(i1 != j)
  3925.         }
  3926.         if(abyte0 != null)
  3927.         {
  3928.             StreamLoader streamLoader = new StreamLoader(abyte0);
  3929.             return streamLoader;
  3930.         }
  3931.         int j1 = 0;
  3932.         while(abyte0 == null)
  3933.         {
  3934.             String s2 = "Unknown error";
  3935.             drawLoadingText(k, "Requesting " + s);
  3936.             Object obj = null;
  3937.             try
  3938.             {
  3939.                 int k1 = 0;
  3940.                 DataInputStream datainputstream = openJagGrabInputStream(s1 + j);
  3941.                 byte abyte1[] = new byte[6];
  3942.                 datainputstream.readFully(abyte1, 0, 6);
  3943.                 Stream stream = new Stream(abyte1);
  3944.                 stream.currentOffset = 3;
  3945.                 int i2 = stream.read3Bytes() + 6;
  3946.                 int j2 = 6;
  3947.                 abyte0 = new byte[i2];
  3948.                 System.arraycopy(abyte1, 0, abyte0, 0, 6);
  3949.  
  3950.                 while(j2 < i2)
  3951.                 {
  3952.                     int l2 = i2 - j2;
  3953.                     if(l2 > 1000)
  3954.                         l2 = 1000;
  3955.                     int j3 = datainputstream.read(abyte0, j2, l2);
  3956.                     if(j3 < 0)
  3957.                     {
  3958.                         s2 = "Length error: " + j2 + "/" + i2;
  3959.                         throw new IOException("EOF");
  3960.                     }
  3961.                     j2 += j3;
  3962.                     int k3 = (j2 * 100) / i2;
  3963.                     if(k3 != k1)
  3964.                         drawLoadingText(k, "Loading " + s + " - " + k3 + "%");
  3965.                     k1 = k3;
  3966.                 }
  3967.                 datainputstream.close();
  3968.                 try
  3969.                 {
  3970.                     if(decompressors[0] != null)
  3971.                         decompressors[0].method234(abyte0.length, abyte0, i);
  3972.                 }
  3973.                 catch(Exception _ex)
  3974.                 {
  3975.                     decompressors[0] = null;
  3976.                 }
  3977.    /*            if(abyte0 != null)
  3978.                 {
  3979.                     aCRC32_930.reset();
  3980.                     aCRC32_930.update(abyte0);
  3981.                     int i3 = (int)aCRC32_930.getValue();
  3982.                     if(i3 != j)
  3983.                     {
  3984.                         abyte0 = null;
  3985.                         j1++;
  3986.                         s2 = "Checksum error: " + i3;
  3987.                     }
  3988.                 }
  3989.   */
  3990.             }
  3991.             catch(IOException ioexception)
  3992.             {
  3993.                 if(s2.equals("Unknown error"))
  3994.                     s2 = "Connection error";
  3995.                 abyte0 = null;
  3996.             }
  3997.             catch(NullPointerException _ex)
  3998.             {
  3999.                 s2 = "Null error";
  4000.                 abyte0 = null;
  4001.                 if(!signlink.reporterror)
  4002.                     return null;
  4003.             }
  4004.             catch(ArrayIndexOutOfBoundsException _ex)
  4005.             {
  4006.                 s2 = "Bounds error";
  4007.                 abyte0 = null;
  4008.                 if(!signlink.reporterror)
  4009.                     return null;
  4010.             }
  4011.             catch(Exception _ex)
  4012.             {
  4013.                 s2 = "Unexpected error";
  4014.                 abyte0 = null;
  4015.                 if(!signlink.reporterror)
  4016.                     return null;
  4017.             }
  4018.             if(abyte0 == null)
  4019.             {
  4020.                 for(int l1 = l; l1 > 0; l1--)
  4021.                 {
  4022.                     if(j1 >= 3)
  4023.                     {
  4024.                         drawLoadingText(k, "Game updated - please reload page");
  4025.                         l1 = 10;
  4026.                     } else
  4027.                     {
  4028.                         drawLoadingText(k, s2 + " - Retrying in " + l1);
  4029.                     }
  4030.                     try
  4031.                     {
  4032.                         Thread.sleep(1000L);
  4033.                     }
  4034.                     catch(Exception _ex) { }
  4035.                 }
  4036.  
  4037.                 l *= 2;
  4038.                 if(l > 60)
  4039.                     l = 60;
  4040.                 aBoolean872 = !aBoolean872;
  4041.             }
  4042.  
  4043.         }
  4044.  
  4045.         StreamLoader streamLoader_1 = new StreamLoader(abyte0);
  4046.             return streamLoader_1;
  4047.     }
  4048.  
  4049.     private void dropClient()
  4050.     {
  4051.         if(anInt1011 > 0)
  4052.         {
  4053.             resetLogout();
  4054.             return;
  4055.         }
  4056.         try {
  4057.             main3DArea.initDrawingArea();
  4058.             normalFont.drawText(0, "Connection lost", 144, 257);
  4059.             normalFont.drawText(0xffffff, "Connection lost", 143, 256);
  4060.             normalFont.drawText(0, "Please wait - attempting to reestablish", 159, 257);
  4061.             normalFont.drawText(0xffffff, "Please wait - attempting to reestablish", 158, 256);
  4062.             main3DArea.drawGraphics(toggleFullscreen ? 0 : 4, super.graphics, toggleFullscreen ? 0 : 4);
  4063.         } catch (NullPointerException ex) {
  4064.            
  4065.         }
  4066.         minimapCover = 0;
  4067.         destX = 0;
  4068.         RSSocket rsSocket = socketStream;
  4069.         loggedIn = false;
  4070.         loginFailures = 0;
  4071.         login(myUsername, myPassword, true);
  4072.         if(!loggedIn)
  4073.             resetLogout();
  4074.         try
  4075.         {
  4076.             rsSocket.close();
  4077.         }
  4078.         catch(Exception _ex)
  4079.         {
  4080.         }
  4081.     }
  4082.  
  4083.     private void drawXPCounter(int paddingX,int paddingY) {
  4084.         int x =  0 + (toggleFullscreen ? paddingX - 22 : paddingX);
  4085.         int y = 46 + (toggleFullscreen ? paddingY - 39 : paddingY);
  4086.         XPcounterSprite[(counterOn || isOnXPCounter(paddingX,paddingY)) ? 1 : 0].drawSprite(x, y);
  4087.     }
  4088.    
  4089.     private void processXPCounterClick(int paddingX,int paddingY) {
  4090.         if (isOnXPCounter(paddingX,paddingY)) {
  4091.             menuActionName[menuActionRow] = "Reset XP Total";
  4092.             menuActionID[menuActionRow] = 475;
  4093.             menuActionRow++;
  4094.             menuActionName[menuActionRow] = "Toggle XP Total";
  4095.             menuActionID[menuActionRow] = 474;
  4096.             menuActionRow++;
  4097.             /*menuActionName[1] = xpLock ? "Unlock XP" : "Lock XP";
  4098.             menuActionID[1] = 476;
  4099.             menuActionRow = 4;*/
  4100.         }
  4101.     }
  4102.    
  4103.     private boolean isOnXPCounter(int paddingX,int paddingY) {
  4104.         int x =  0 + (toggleFullscreen ? paddingX - 22 : paddingX);
  4105.         int y = 46 + (toggleFullscreen ? paddingY - 39 : paddingY);
  4106.         if ((super.mouseX >= xPaddingmapBackImage + x) && (super.mouseX <= xPaddingmapBackImage + x + XPcounterSprite[0].myWidth) && (super.mouseY >= yPaddingmapBackImage + y) && (super.mouseY <= yPaddingmapBackImage + y + XPcounterSprite[0].myHeight))
  4107.             return true;
  4108.         else
  4109.             return false;
  4110.     }
  4111.  
  4112.     private void drawCounterOnScreen(int paddingX,int paddingY) {
  4113.         int x =  xPaddingmapBackImage + (toggleFullscreen ? paddingX - 22 : paddingX);
  4114.         int y = 46 + (toggleFullscreen ? paddingY - 39 : paddingY);
  4115.         XPcounterSprite[2].drawSprite(x-110, y+8);
  4116.         int i = normalFont.getTextWidth(Integer.toString(xpCounter));
  4117.         normalFont.drawText(0xffffff, "XP:", y+21, x-99);
  4118.         normalFont.method385(0xffffff, Integer.toString(xpCounter),  y+21, x-15 - i);
  4119.         if (expAdded != 0) {
  4120.             i = smallFont.getTextWidth(Integer.toString(expAdded)+"xp");
  4121.             smallFont.drawText(0xff9933, Integer.toString(expAdded)+"xp", y+21+18+xpAddedPos, x-12-i);
  4122.             XPcounterSprite[3].drawSprite(x-12-i -50, y+18+xpAddedPos);
  4123.             xpAddedPos += 2;
  4124.             if (xpAddedPos >= 50) {
  4125.                 xpAddedPos = 0;
  4126.                 expAdded = 0;
  4127.             }
  4128.         }
  4129.     }
  4130.    
  4131.     private void doAction(int i)
  4132.     {
  4133.  
  4134.         if(i < 0)
  4135.             return;
  4136.         summoningAttack = false;
  4137.         if(inputDialogState != 0)
  4138.         {
  4139.             inputDialogState = 0;
  4140.             inputTaken = true;
  4141.         }
  4142.         int i1 = menuActionCmd1[i];
  4143.         int j = menuActionCmd2[i];
  4144.         int k = menuActionCmd3[i];
  4145.         int l = menuActionID[i];
  4146.         if(l >= 2000)
  4147.             l -= 2000;
  4148.                     if (l == 476) {
  4149.             alertHandler.close();
  4150.         }
  4151.         //System.out.println("action-ID: " + l);
  4152.         if (l == 474) {//On / Off
  4153.             counterOn = !counterOn;// can u open the client.java of ur old client? yeh
  4154.         }
  4155.         if (l == 475) {//Reset
  4156.             xpCounter = 0;
  4157.         }
  4158.                 if (l == 712) {
  4159.             //Toggle
  4160.             coinToggle = !coinToggle;
  4161.         }
  4162.         if (l == 713) {
  4163.                         //withdraw action
  4164.                                             inputTaken = true;
  4165.                                             messagePromptRaised = true;
  4166.                                             amountOrNameInput = "";
  4167.                                             inputDialogState = 0;
  4168.                                             interfaceButtonAction = 557;
  4169.                                             aString1121 = "Enter amount";
  4170.                 }
  4171.         if (l == 714) {
  4172.                         //add examine option here
  4173.                         pushMessage(new StringBuilder().append("Your money pouch currently contains ").append(RSInterface.interfaceCache[8135].message).append(" coins.").toString(), 0, "");
  4174.                 }
  4175.         if (l == 715) {
  4176.             //add price check action here
  4177.                         pushMessage("Price Check Coming soon..?", 0, "");
  4178.         }
  4179.         if(l == 582)
  4180.         {
  4181.             NPC npc = npcArray[i1];
  4182.             if(npc != null)
  4183.             {
  4184.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, npc.smallY[0], myPlayer.smallX[0], false, npc.smallX[0]);
  4185.                 crossX = super.saveClickX;
  4186.                 crossY = super.saveClickY;
  4187.                 crossType = 2;
  4188.                 crossIndex = 0;
  4189.                 stream.createFrame(57);
  4190.                 stream.method432(anInt1285);
  4191.                 stream.method432(i1);
  4192.                 stream.method431(itemSlotUsedOn);
  4193.                 stream.method432(anInt1284);
  4194.             }
  4195.         }
  4196.         if(l == 234)
  4197.         {
  4198.             boolean flag1 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k, myPlayer.smallX[0], false, j);
  4199.             if(!flag1)
  4200.                 flag1 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k, myPlayer.smallX[0], false, j);
  4201.             crossX = super.saveClickX;
  4202.             crossY = super.saveClickY;
  4203.             crossType = 2;
  4204.             crossIndex = 0;
  4205.             stream.createFrame(236);
  4206.             stream.method431(k + baseY);
  4207.             stream.writeWord(i1);
  4208.             stream.method431(j + baseX);
  4209.         }
  4210.         if(l == 62 && method66(i1, k, j))
  4211.         {
  4212.             stream.createFrame(192);
  4213.             stream.writeWord(anInt1284);
  4214.             stream.method431(i1 >> 14 & 0x7fff);
  4215.             stream.method433(k + baseY);
  4216.             stream.method431(itemSlotUsedOn);
  4217.             stream.method433(j + baseX);
  4218.             stream.writeWord(anInt1285);
  4219.         }
  4220.         if(l == 104) {
  4221.             RSInterface rsInterface = RSInterface.interfaceCache[k];
  4222.             spellID = rsInterface.id;
  4223.             if(!interfaceIsSelected(rsInterface)) {
  4224.                 pushMessage("You need the correct Magic level and rune requirements to use this spell.", 0, "");
  4225.             } else {
  4226.                 if(!autoCast || (autocastId != spellID)) {
  4227.                     autoCast = true;
  4228.                     autocastId = spellID;
  4229.                     sendPacket185(autocastId,-1,135);
  4230.                     pushMessage("Autocast spell selected.", 0, "");
  4231.                 } else if(autocastId == spellID) {
  4232.                     setAutoCastOff();
  4233.                 }
  4234.             }
  4235.         }
  4236.         if(l == 511)
  4237.         {
  4238.             boolean flag2 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k, myPlayer.smallX[0], false, j);
  4239.             if(!flag2)
  4240.                 flag2 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k, myPlayer.smallX[0], false, j);
  4241.             crossX = super.saveClickX;
  4242.             crossY = super.saveClickY;
  4243.             crossType = 2;
  4244.             crossIndex = 0;
  4245.             stream.createFrame(25);
  4246.             stream.method431(anInt1284);
  4247.             stream.method432(anInt1285);
  4248.             stream.writeWord(i1);
  4249.             stream.method432(k + baseY);
  4250.             stream.method433(itemSlotUsedOn);
  4251.             stream.writeWord(j + baseX);
  4252.         }
  4253.         if(l == 74)
  4254.         {
  4255.             stream.createFrame(122);
  4256.             stream.method433(k);
  4257.             stream.method432(j);
  4258.             stream.method431(i1);
  4259.             atInventoryLoopCycle = 0;
  4260.             atInventoryInterface = k;
  4261.             atInventoryIndex = j;
  4262.             atInventoryInterfaceType = 2;
  4263.             if(RSInterface.interfaceCache[k].parentID == openInterfaceID)
  4264.                 atInventoryInterfaceType = 1;
  4265.             if(RSInterface.interfaceCache[k].parentID == backDialogID)
  4266.                 atInventoryInterfaceType = 3;
  4267.         }
  4268.         if (l == 315) {
  4269.             sendPacket185(k,-1,135);
  4270.         }
  4271.         if(l == 561)
  4272.         {
  4273.             Player player = playerArray[i1];
  4274.             if(player != null)
  4275.             {
  4276.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, player.smallY[0], myPlayer.smallX[0], false, player.smallX[0]);
  4277.                 crossX = super.saveClickX;
  4278.                 crossY = super.saveClickY;
  4279.                 crossType = 2;
  4280.                 crossIndex = 0;
  4281.                 anInt1188 += i1;
  4282.                 if(anInt1188 >= 90)
  4283.                 {
  4284.                     stream.createFrame(136);
  4285.                     anInt1188 = 0;
  4286.                 }
  4287.                 stream.createFrame(128);
  4288.                 stream.writeWord(i1);
  4289.             }
  4290.         }
  4291.         if(l == 20)
  4292.         {
  4293.             NPC class30_sub2_sub4_sub1_sub1_1 = npcArray[i1];
  4294.             if(class30_sub2_sub4_sub1_sub1_1 != null)
  4295.             {
  4296.                 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]);
  4297.                 crossX = super.saveClickX;
  4298.                 crossY = super.saveClickY;
  4299.                 crossType = 2;
  4300.                 crossIndex = 0;
  4301.                 stream.createFrame(155);
  4302.                 stream.method431(i1);
  4303.             }
  4304.         }
  4305.         if(l == 779)
  4306.         {
  4307.             Player class30_sub2_sub4_sub1_sub2_1 = playerArray[i1];
  4308.             if(class30_sub2_sub4_sub1_sub2_1 != null)
  4309.             {
  4310.                 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]);
  4311.                 crossX = super.saveClickX;
  4312.                 crossY = super.saveClickY;
  4313.                 crossType = 2;
  4314.                 crossIndex = 0;
  4315.                 stream.createFrame(153);
  4316.                 stream.method431(i1);
  4317.             }
  4318.         }
  4319.         if(l == 516)
  4320.             if(!contextMenuOpen)
  4321.                 worldController.method312(super.saveClickY - 4, super.saveClickX - 4);
  4322.             else
  4323.                 worldController.method312(k - 4, j - 4);
  4324.         if(l == 1062)
  4325.         {
  4326.             anInt924 += baseX;
  4327.             if(anInt924 >= 113)
  4328.             {
  4329.                 stream.createFrame(183);
  4330.                 stream.writeDWordBigEndian(0xe63271);
  4331.                 anInt924 = 0;
  4332.             }
  4333.             method66(i1, k, j);
  4334.             stream.createFrame(228);
  4335.             stream.method432(i1 >> 14 & 0x7fff);
  4336.             stream.method432(k + baseY);
  4337.             stream.writeWord(j + baseX);
  4338.         }
  4339.         if(l == 679 && !aBoolean1149)
  4340.         {
  4341.             stream.createFrame(40);
  4342.             stream.writeWord(k);
  4343.             aBoolean1149 = true;
  4344.         }
  4345.         if(l == 431)
  4346.         {
  4347.             stream.createFrame(129);
  4348.             stream.method432(j);
  4349.             stream.writeWord(k);
  4350.             stream.method432(i1);
  4351.             atInventoryLoopCycle = 0;
  4352.             atInventoryInterface = k;
  4353.             atInventoryIndex = j;
  4354.             atInventoryInterfaceType = 2;
  4355.             if(RSInterface.interfaceCache[k].parentID == openInterfaceID)
  4356.                 atInventoryInterfaceType = 1;
  4357.             if(RSInterface.interfaceCache[k].parentID == backDialogID)
  4358.                 atInventoryInterfaceType = 3;
  4359.         }
  4360.         if(l == 337 || l == 42 || l == 792 || l == 322)
  4361.         {
  4362.             String s = menuActionName[i];
  4363.             int k1 = s.indexOf("@whi@");
  4364.             if(k1 != -1)
  4365.             {
  4366.                 long l3 = TextClass.longForName(s.substring(k1 + 5).trim());
  4367.                 if(l == 337)
  4368.                     addFriend(l3);
  4369.                 if(l == 42)
  4370.                     addIgnore(l3);
  4371.                 if(l == 792)
  4372.                     delFriend(l3);
  4373.                 if(l == 322)
  4374.                     delIgnore(l3);
  4375.             }
  4376.         }
  4377.         if(l == 53)
  4378.         {
  4379.             stream.createFrame(135);
  4380.             stream.method431(j);
  4381.             stream.method432(k);
  4382.             stream.method431(i1);
  4383.             atInventoryLoopCycle = 0;
  4384.             atInventoryInterface = k;
  4385.             atInventoryIndex = j;
  4386.             atInventoryInterfaceType = 2;
  4387.             if(RSInterface.interfaceCache[k].parentID == openInterfaceID)
  4388.                 atInventoryInterfaceType = 1;
  4389.             if(RSInterface.interfaceCache[k].parentID == backDialogID)
  4390.                 atInventoryInterfaceType = 3;
  4391.         }
  4392.         if(l == 539)
  4393.         {
  4394.             stream.createFrame(16);
  4395.             stream.method432(i1);
  4396.             stream.method433(j);
  4397.             stream.method433(k);
  4398.             atInventoryLoopCycle = 0;
  4399.             atInventoryInterface = k;
  4400.             atInventoryIndex = j;
  4401.             atInventoryInterfaceType = 2;
  4402.             if(RSInterface.interfaceCache[k].parentID == openInterfaceID)
  4403.                 atInventoryInterfaceType = 1;
  4404.             if(RSInterface.interfaceCache[k].parentID == backDialogID)
  4405.                 atInventoryInterfaceType = 3;
  4406.         }
  4407.         if(l == 484 || l == 6)
  4408.         {
  4409.             String s1 = menuActionName[i];
  4410.             int l1 = s1.indexOf("@whi@");
  4411.             if(l1 != -1)
  4412.             {
  4413.                 s1 = s1.substring(l1 + 5).trim();
  4414.                 String s7 = TextClass.fixName(TextClass.nameForLong(TextClass.longForName(s1)));
  4415.                 boolean flag9 = false;
  4416.                 for(int j3 = 0; j3 < playerCount; j3++)
  4417.                 {
  4418.                     Player class30_sub2_sub4_sub1_sub2_7 = playerArray[playerIndices[j3]];
  4419.                     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))
  4420.                         continue;
  4421.                     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]);
  4422.                     if(l == 484)
  4423.                     {
  4424.                         stream.createFrame(139);
  4425.                         stream.method431(playerIndices[j3]);
  4426.                     }
  4427.                     if(l == 6)
  4428.                     {
  4429.                         anInt1188 += i1;
  4430.                         if(anInt1188 >= 90)
  4431.                         {
  4432.                             stream.createFrame(136);
  4433.                             anInt1188 = 0;
  4434.                         }
  4435.                         stream.createFrame(128);
  4436.                         stream.writeWord(playerIndices[j3]);
  4437.                     }
  4438.                     flag9 = true;
  4439.                     break;
  4440.                 }
  4441.  
  4442.                 if(!flag9)
  4443.                     pushMessage("Unable to find " + s7, 0, "");
  4444.             }
  4445.         }
  4446.         if(l == 485) {
  4447.             openUpWebSite(linkInText);
  4448.         }
  4449.         if(l == 870)
  4450.         {
  4451.             stream.createFrame(53);
  4452.             stream.writeWord(j);
  4453.             stream.method432(itemSlotUsedOn);
  4454.             stream.method433(i1);
  4455.             stream.writeWord(anInt1284);
  4456.             stream.method431(anInt1285);
  4457.             stream.writeWord(k);
  4458.             atInventoryLoopCycle = 0;
  4459.             atInventoryInterface = k;
  4460.             atInventoryIndex = j;
  4461.             atInventoryInterfaceType = 2;
  4462.             if(RSInterface.interfaceCache[k].parentID == openInterfaceID)
  4463.                 atInventoryInterfaceType = 1;
  4464.             if(RSInterface.interfaceCache[k].parentID == backDialogID)
  4465.                 atInventoryInterfaceType = 3;
  4466.         }
  4467.         if(l == 847)
  4468.         {
  4469.             stream.createFrame(87);
  4470.             stream.method432(i1);
  4471.             stream.writeWord(k);
  4472.             stream.method432(j);
  4473.             atInventoryLoopCycle = 0;
  4474.             atInventoryInterface = k;
  4475.             atInventoryIndex = j;
  4476.             atInventoryInterfaceType = 2;
  4477.             if(RSInterface.interfaceCache[k].parentID == openInterfaceID)
  4478.                 atInventoryInterfaceType = 1;
  4479.             if(RSInterface.interfaceCache[k].parentID == backDialogID)
  4480.                 atInventoryInterfaceType = 3;
  4481.         }
  4482.         if(l == 626)
  4483.         {
  4484.             RSInterface rsInterface = RSInterface.interfaceCache[k];
  4485.             spellSelected = 1;
  4486.             spellID = rsInterface.id;
  4487.             anInt1137 = k;
  4488.             spellUsableOn = rsInterface.spellUsableOn;
  4489.             itemSelected = 0;
  4490.             needDrawTabArea = true;
  4491.             String s4 = rsInterface.selectedActionName;
  4492.             if(s4.indexOf(" ") != -1)
  4493.                 s4 = s4.substring(0, s4.indexOf(" "));
  4494.             String s8 = rsInterface.selectedActionName;
  4495.             if(s8.indexOf(" ") != -1)
  4496.                 s8 = s8.substring(s8.indexOf(" ") + 1);
  4497.             spellTooltip = s4 + " " + rsInterface.spellName + " " + s8;
  4498.             if(spellUsableOn == 16)
  4499.             {
  4500.                 needDrawTabArea = true;
  4501.                 tabID = 3;
  4502.                 tabAreaAltered = true;
  4503.             }
  4504.             return;
  4505.         }
  4506.         if (l == 1053) {
  4507.     stream.createFrame(185);
  4508.     stream.writeWord(9999);
  4509. }
  4510.         if(l == 78)
  4511.         {
  4512.             stream.createFrame(117);
  4513.             stream.method433(k);
  4514.             stream.method433(i1);
  4515.             stream.method431(j);
  4516.             atInventoryLoopCycle = 0;
  4517.             atInventoryInterface = k;
  4518.             atInventoryIndex = j;
  4519.             atInventoryInterfaceType = 2;
  4520.             if(RSInterface.interfaceCache[k].parentID == openInterfaceID)
  4521.                 atInventoryInterfaceType = 1;
  4522.             if(RSInterface.interfaceCache[k].parentID == backDialogID)
  4523.                 atInventoryInterfaceType = 3;
  4524.         }
  4525.         if(l == 27)
  4526.         {
  4527.             Player player = playerArray[i1];
  4528.             if(player != null)
  4529.             {
  4530.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, player.smallY[0], myPlayer.smallX[0], false, player.smallX[0]);
  4531.                 crossX = super.saveClickX;
  4532.                 crossY = super.saveClickY;
  4533.                 crossType = 2;
  4534.                 crossIndex = 0;
  4535.                 anInt986 += i1;
  4536.                 if(anInt986 >= 54)
  4537.                 {
  4538.                     stream.createFrame(189);
  4539.                     stream.writeWordBigEndian(234);
  4540.                     anInt986 = 0;
  4541.                 }
  4542.                 stream.createFrame(73);
  4543.                 stream.method431(i1);
  4544.             }
  4545.         }
  4546.         if(l == 213)
  4547.         {
  4548.             boolean flag3 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k, myPlayer.smallX[0], false, j);
  4549.             if(!flag3)
  4550.                 flag3 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k, myPlayer.smallX[0], false, j);
  4551.             crossX = super.saveClickX;
  4552.             crossY = super.saveClickY;
  4553.             crossType = 2;
  4554.             crossIndex = 0;
  4555.             stream.createFrame(79);
  4556.             stream.method431(k + baseY);
  4557.             stream.writeWord(i1);
  4558.             stream.method432(j + baseX);
  4559.         }
  4560.         if(l == 632)
  4561.         {
  4562.             stream.createFrame(145);
  4563.             stream.method432(k);
  4564.             stream.method432(j);
  4565.             stream.method432(i1);
  4566.             System.out.println("k: " + k + ", j: " + j + ", i1: " + i1);
  4567.             atInventoryLoopCycle = 0;
  4568.             atInventoryInterface = k;
  4569.             atInventoryIndex = j;
  4570.             atInventoryInterfaceType = 2;
  4571.             if(RSInterface.interfaceCache[k].parentID == openInterfaceID)
  4572.                 atInventoryInterfaceType = 1;
  4573.             if(RSInterface.interfaceCache[k].parentID == backDialogID)
  4574.                 atInventoryInterfaceType = 3;
  4575.         }
  4576.         if(l == 1011) {//combat
  4577.             setTab(0);
  4578.         }
  4579.         if(l == 1012) {//skills
  4580.             setTab(1);
  4581.         }
  4582.         if(l == 1013) {//quests
  4583.             setTab(2);
  4584.         }
  4585.         if(l == 1014) {//quests
  4586.             setTab(3);
  4587.         }
  4588.         if(l == 1015) {//worn
  4589.             setTab(4);
  4590.         }
  4591.         if(l == 1016) {//prayer
  4592.             setTab(5);
  4593.         }
  4594.         if(l == 1017) {//Modern - 1151
  4595.             setTab(6);
  4596.         }
  4597.         if(l == 1018) {//Clan chat
  4598.             setTab(7);
  4599.         }
  4600.         if(l == 1019) {//friends
  4601.             setTab(8);
  4602.         }
  4603.         if(l == 1020) {//ignore
  4604.             setTab(9);
  4605.         }
  4606.         if(l == 1021) {//logout
  4607.             setTab(10);
  4608.         }
  4609.         if(l == 1022) {//Options
  4610.             setTab(11);
  4611.         }
  4612.         if(l == 1023) {//Emotes
  4613.             setTab(12);
  4614.         }
  4615.         if(l == 1024) {//Music
  4616.             setTab(13);
  4617.         }
  4618.         if(l == 1042) {//Task system
  4619.             setTab(14);
  4620.         }
  4621.         if(l == 1043) {//Objectives
  4622.             setTab(16);
  4623.         }
  4624.         if(l == 1044) {//Notes
  4625.             setTab(15);
  4626.         }
  4627.         if(l == 1045) {//Toggle quick prayers / curses
  4628.             if(openInterfaceID != -1)
  4629.                 pushMessage("Please close the window first.", 0, "");
  4630.             else {
  4631.                 if(getOrbValues(1,null)[0] > 0)
  4632.                     handleQuickAidsActive();
  4633.                 else
  4634.                     pushMessage("You need to recharge your Prayer at an alter.", 0, "");
  4635.             }
  4636.         }
  4637.         if(l == 1046) {//Select quick prayers / curses
  4638.             if(!loadTickSelection) {
  4639.                 turnOffPrayers();
  4640.                 turnOffCurses();
  4641.                 turnOffQuickTicks();
  4642.                 configureQuickTicks();
  4643.                 loadTickSelection = true;
  4644.             }
  4645.             toggleQuickAidsSelection();
  4646.         }
  4647.         if(l == 1047) {//Toggle run mode
  4648.             if(getOrbValues(2,null)[0] > 0)
  4649.                 orbToggle[2] = !orbToggle[2];
  4650.             else
  4651.                 pushMessage("You don't have enough energy left to run!", 0, "");
  4652.             sendPacket185(152,173,169);
  4653.         }
  4654.         if(l == 1048) {//Rest
  4655.             pushMessage("<col=225>Type ::rest To rest", 0, "");
  4656.         }
  4657.         if(l == 1049) {//compass
  4658.             compassRotation = 0;
  4659.         }
  4660.         if(l == 1050) {//world map
  4661.                         launchURL("www.deathlypvpz.net/vote/");
  4662.             pushMessage("<col=225>Vote and Then Claim Your Rewards! with ::claim", 0, "");
  4663.         }
  4664.         if(l == 1051) {//Advisor
  4665.             launchURL("www.deathlypvpz.freesmfhosting.com");
  4666.                         pushMessage("<col=225>For Advice Ask For Help On The Forums.", 0, "");
  4667.         }
  4668.         if(l == 1052 && orbToggle[0]) {//cure me
  4669.             pushMessage("<col=225>Coming soon!", 0, "");
  4670.         }/*
  4671.         if(l == 1053) {//summoning - Select left-click option DISABLED CUZ CRASH
  4672.                 stream.createFrame(185);
  4673.     stream.writeWord(9993);
  4674.         }
  4675.         if(l == 1054) {//summoning - Call Follower
  4676.                 stream.createFrame(185);
  4677.     stream.writeWord(9994);
  4678.         }
  4679.         if(l == 1055) {//summoning - Dismiss
  4680.                 stream.createFrame(185);
  4681.     stream.writeWord(9995);
  4682.         }
  4683.         if(l == 1056) {//summoning - Take BoB
  4684.                 stream.createFrame(185);
  4685.     stream.writeWord(9996);
  4686.         }
  4687.         if(l == 1057) {//summoning - Renew Familiar
  4688.                 stream.createFrame(185);
  4689.     stream.writeWord(9997);
  4690.         }
  4691.         if(l == 1058) {//summoning - Attack
  4692.                 stream.createFrame(185);
  4693.     stream.writeWord(9998);
  4694.         }
  4695.         if(l == 1059) {//summoning - Follower Details
  4696.     stream.createFrame(185);
  4697.     stream.writeWord(9999);
  4698.         }*/
  4699.         if(l == 1003) {
  4700.             clanChatMode = 2;
  4701.             aBoolean1233 = true;
  4702.             inputTaken = true;
  4703.         }
  4704.         if(l == 1002) {
  4705.             clanChatMode = 1;
  4706.             aBoolean1233 = true;
  4707.             inputTaken = true;
  4708.         }
  4709.         if(l == 1001) {
  4710.             clanChatMode = 0;
  4711.             aBoolean1233 = true;
  4712.             inputTaken = true;
  4713.         }
  4714.         if(l == 1000) {
  4715.             cButtonCPos = 4;
  4716.             chatTypeView = 11;
  4717.             aBoolean1233 = true;
  4718.             inputTaken = true;
  4719.         }
  4720.         if(l == 999) {
  4721.             cButtonCPos = 0;
  4722.             chatTypeView = 0;
  4723.             aBoolean1233 = true;
  4724.             inputTaken = true;
  4725.         }
  4726.         if(l == 998) {
  4727.             cButtonCPos = 1;
  4728.             chatTypeView = 5;
  4729.             aBoolean1233 = true;
  4730.             inputTaken = true;
  4731.         }
  4732.         if(l == 997) {
  4733.             publicChatMode = 3;
  4734.             aBoolean1233 = true;
  4735.             inputTaken = true;
  4736.         }
  4737.         if(l == 996) {
  4738.             publicChatMode = 2;
  4739.             aBoolean1233 = true;
  4740.             inputTaken = true;
  4741.         }
  4742.         if(l == 995) {
  4743.             publicChatMode = 1;
  4744.             aBoolean1233 = true;
  4745.             inputTaken = true;
  4746.         }
  4747.         if(l == 994) {
  4748.             publicChatMode = 0;
  4749.             aBoolean1233 = true;
  4750.             inputTaken = true;
  4751.         }
  4752.         if(l == 993) {
  4753.             cButtonCPos = 2;
  4754.             chatTypeView = 1;
  4755.             aBoolean1233 = true;
  4756.             inputTaken = true;
  4757.         }
  4758.         if(l == 992) {
  4759.             privateChatMode = 2;
  4760.             aBoolean1233 = true;
  4761.             inputTaken = true;
  4762.         }
  4763.         if(l == 991) {
  4764.             privateChatMode = 1;
  4765.             aBoolean1233 = true;
  4766.             inputTaken = true;
  4767.         }
  4768.         if(l == 990) {
  4769.             privateChatMode = 0;
  4770.             aBoolean1233 = true;
  4771.             inputTaken = true;
  4772.         }
  4773.         if(l == 989) {
  4774.             cButtonCPos = 3;
  4775.             chatTypeView = 2;
  4776.             aBoolean1233 = true;
  4777.             inputTaken = true;
  4778.         }
  4779.         if(l == 987) {
  4780.             tradeMode = 2;
  4781.             aBoolean1233 = true;
  4782.             inputTaken = true;
  4783.         }
  4784.         if(l == 986) {
  4785.             tradeMode = 1;
  4786.             aBoolean1233 = true;
  4787.             inputTaken = true;
  4788.         }
  4789.         if(l == 985) {
  4790.             tradeMode = 0;
  4791.             aBoolean1233 = true;
  4792.             inputTaken = true;
  4793.         }
  4794.         if(l == 984) {
  4795.             cButtonCPos = 5;
  4796.             chatTypeView = 3;
  4797.             aBoolean1233 = true;
  4798.             inputTaken = true;
  4799.         }
  4800.         if(l == 983) {
  4801.             duelMode = 2;
  4802.             aBoolean1233 = true;
  4803.             inputTaken = true;
  4804.         }
  4805.         if(l == 982) {
  4806.             duelMode = 1;
  4807.             aBoolean1233 = true;
  4808.             inputTaken = true;
  4809.         }
  4810.         if(l == 981) {
  4811.             duelMode = 0;
  4812.             aBoolean1233 = true;
  4813.             inputTaken = true;
  4814.         }
  4815.         if(l == 980) {
  4816.             cButtonCPos = 6;
  4817.             chatTypeView = 4;
  4818.             aBoolean1233 = true;
  4819.             inputTaken = true;
  4820.         }
  4821.         if(l == 493)
  4822.         {
  4823.             stream.createFrame(75);
  4824.             stream.method433(k);
  4825.             stream.method431(j);
  4826.             stream.method432(i1);
  4827.             atInventoryLoopCycle = 0;
  4828.             atInventoryInterface = k;
  4829.             atInventoryIndex = j;
  4830.             atInventoryInterfaceType = 2;
  4831.             if(RSInterface.interfaceCache[k].parentID == openInterfaceID)
  4832.                 atInventoryInterfaceType = 1;
  4833.             if(RSInterface.interfaceCache[k].parentID == backDialogID)
  4834.                 atInventoryInterfaceType = 3;
  4835.         }
  4836.         if(l == 652)
  4837.         {
  4838.             boolean flag4 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k, myPlayer.smallX[0], false, j);
  4839.             if(!flag4)
  4840.                 flag4 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k, myPlayer.smallX[0], false, j);
  4841.             crossX = super.saveClickX;
  4842.             crossY = super.saveClickY;
  4843.             crossType = 2;
  4844.             crossIndex = 0;
  4845.             stream.createFrame(156);
  4846.             stream.method432(j + baseX);
  4847.             stream.method431(k + baseY);
  4848.             stream.method433(i1);
  4849.         }
  4850.         if(l == 94)
  4851.         {
  4852.             boolean flag5 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k, myPlayer.smallX[0], false, j);
  4853.             if(!flag5)
  4854.                 flag5 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k, myPlayer.smallX[0], false, j);
  4855.             crossX = super.saveClickX;
  4856.             crossY = super.saveClickY;
  4857.             crossType = 2;
  4858.             crossIndex = 0;
  4859.             stream.createFrame(181);
  4860.             stream.method431(k + baseY);
  4861.             stream.writeWord(i1);
  4862.             stream.method431(j + baseX);
  4863.             stream.method432(anInt1137);
  4864.         }
  4865.         if(l == 646) {
  4866.             sendPacket185(k,-1,646);
  4867.         }
  4868.         if(l == 225)
  4869.         {
  4870.             NPC class30_sub2_sub4_sub1_sub1_2 = npcArray[i1];
  4871.             if(class30_sub2_sub4_sub1_sub1_2 != null)
  4872.             {
  4873.                 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]);
  4874.                 crossX = super.saveClickX;
  4875.                 crossY = super.saveClickY;
  4876.                 crossType = 2;
  4877.                 crossIndex = 0;
  4878.                 anInt1226 += i1;
  4879.                 if(anInt1226 >= 85)
  4880.                 {
  4881.                     stream.createFrame(230);
  4882.                     stream.writeWordBigEndian(239);
  4883.                     anInt1226 = 0;
  4884.                 }
  4885.                 stream.createFrame(17);
  4886.                 stream.method433(i1);
  4887.             }
  4888.         }
  4889.         if(l == 965)
  4890.         {
  4891.             NPC npc = npcArray[i1];
  4892.             if(npc != null)
  4893.             {
  4894.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, npc.smallY[0], myPlayer.smallX[0], false, npc.smallX[0]);
  4895.                 crossX = super.saveClickX;
  4896.                 crossY = super.saveClickY;
  4897.                 crossType = 2;
  4898.                 crossIndex = 0;
  4899.                 anInt1134++;
  4900.                 if(anInt1134 >= 96)
  4901.                 {
  4902.                     stream.createFrame(152);
  4903.                     stream.writeWordBigEndian(88);
  4904.                     anInt1134 = 0;
  4905.                 }
  4906.                 stream.createFrame(21);
  4907.                 stream.writeWord(i1);
  4908.             }
  4909.         }
  4910.         if(l == 413)
  4911.         {
  4912.             NPC npc = npcArray[i1];
  4913.             if(npc != null)
  4914.             {
  4915.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, npc.smallY[0], myPlayer.smallX[0], false, npc.smallX[0]);
  4916.                 crossX = super.saveClickX;
  4917.                 crossY = super.saveClickY;
  4918.                 crossType = 2;
  4919.                 crossIndex = 0;
  4920.                 stream.createFrame(131);
  4921.                 stream.method433(i1);
  4922.                 stream.method432(anInt1137);
  4923.             }
  4924.         }
  4925.         if(l == 200)
  4926.             clearTopInterfaces();
  4927.         if(l == 1025)
  4928.         {
  4929.             NPC npc = npcArray[i1];
  4930.             if(npc != null)
  4931.             {
  4932.                 EntityDef entityDef = npc.desc;
  4933.                 if(entityDef.childrenIDs != null)
  4934.                     entityDef = entityDef.method161();
  4935.                 if(entityDef != null)
  4936.                 {
  4937.                     String s9;
  4938.                     if(entityDef.description != null)
  4939.                         s9 = new String(entityDef.description);
  4940.                     else
  4941.                         s9 = "It's a " + entityDef.name + ".";
  4942.                     pushMessage(s9, 0, "");
  4943.                 }
  4944.             }
  4945.         }
  4946.         if(l == 900)
  4947.         {
  4948.             method66(i1, k, j);
  4949.             stream.createFrame(252);
  4950.             stream.method433(i1 >> 14 & 0x7fff);
  4951.             stream.method431(k + baseY);
  4952.             stream.method432(j + baseX);
  4953.         }
  4954.         if(l == 412)
  4955.         {
  4956.             NPC npc = npcArray[i1];
  4957.             if(npc != null)
  4958.             {
  4959.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, npc.smallY[0], myPlayer.smallX[0], false, npc.smallX[0]);
  4960.                 crossX = super.saveClickX;
  4961.                 crossY = super.saveClickY;
  4962.                 crossType = 2;
  4963.                 crossIndex = 0;
  4964.                 stream.createFrame(72);
  4965.                 stream.method432(i1);
  4966.                 //System.out.println("i1: " + i1);
  4967.             }
  4968.         }
  4969.         if(l == 365)
  4970.         {
  4971.             Player player = playerArray[i1];
  4972.             if(player != null)
  4973.             {
  4974.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, player.smallY[0], myPlayer.smallX[0], false, player.smallX[0]);
  4975.                 crossX = super.saveClickX;
  4976.                 crossY = super.saveClickY;
  4977.                 crossType = 2;
  4978.                 crossIndex = 0;
  4979.                 stream.createFrame(249);
  4980.                 stream.method432(i1);
  4981.                 stream.method431(anInt1137);
  4982.             }
  4983.         }
  4984.         if(l == 729)
  4985.         {
  4986.             Player player = playerArray[i1];
  4987.             if(player != null)
  4988.             {
  4989.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, player.smallY[0], myPlayer.smallX[0], false, player.smallX[0]);
  4990.                 crossX = super.saveClickX;
  4991.                 crossY = super.saveClickY;
  4992.                 crossType = 2;
  4993.                 crossIndex = 0;
  4994.                 stream.createFrame(39);
  4995.                 stream.method431(i1);
  4996.             }
  4997.         }
  4998.         if(l == 577)
  4999.         {
  5000.             Player player = playerArray[i1];
  5001.             if(player != null)
  5002.             {
  5003.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, player.smallY[0], myPlayer.smallX[0], false, player.smallX[0]);
  5004.                 crossX = super.saveClickX;
  5005.                 crossY = super.saveClickY;
  5006.                 crossType = 2;
  5007.                 crossIndex = 0;
  5008.                 stream.createFrame(139);
  5009.                 stream.method431(i1);
  5010.             }
  5011.         }
  5012.         if(l == 956 && method66(i1, k, j))
  5013.         {
  5014.             stream.createFrame(35);
  5015.             stream.method431(j + baseX);
  5016.             stream.method432(anInt1137);
  5017.             stream.method432(k + baseY);
  5018.             stream.method431(i1 >> 14 & 0x7fff);
  5019.         }
  5020.         if(l == 567)
  5021.         {
  5022.             boolean flag6 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k, myPlayer.smallX[0], false, j);
  5023.             if(!flag6)
  5024.                 flag6 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k, myPlayer.smallX[0], false, j);
  5025.             crossX = super.saveClickX;
  5026.             crossY = super.saveClickY;
  5027.             crossType = 2;
  5028.             crossIndex = 0;
  5029.             stream.createFrame(23);
  5030.             stream.method431(k + baseY);
  5031.             stream.method431(i1);
  5032.             stream.method431(j + baseX);
  5033.         }
  5034.         if(l == 867)
  5035.         {
  5036.             if((i1 & 3) == 0)
  5037.                 anInt1175++;
  5038.             if(anInt1175 >= 59)
  5039.             {
  5040.                 stream.createFrame(200);
  5041.                 stream.writeWord(25501);
  5042.                 anInt1175 = 0;
  5043.             }
  5044.             stream.createFrame(43);
  5045.             stream.method431(k);
  5046.             stream.method432(i1);
  5047.             stream.method432(j);
  5048.             atInventoryLoopCycle = 0;
  5049.             atInventoryInterface = k;
  5050.             atInventoryIndex = j;
  5051.             atInventoryInterfaceType = 2;
  5052.             if(RSInterface.interfaceCache[k].parentID == openInterfaceID)
  5053.                 atInventoryInterfaceType = 1;
  5054.             if(RSInterface.interfaceCache[k].parentID == backDialogID)
  5055.                 atInventoryInterfaceType = 3;
  5056.         }
  5057.         if(l == 543)
  5058.         {
  5059.             stream.createFrame(237);
  5060.             stream.writeWord(j);
  5061.             stream.method432(i1);
  5062.             stream.writeWord(k);
  5063.             stream.method432(anInt1137);
  5064.             System.out.println("j: " + j + ", i1: " + i1 + ", k: " + k + ", anInt1137: " + anInt1137);
  5065.             atInventoryLoopCycle = 0;
  5066.             atInventoryInterface = k;
  5067.             atInventoryIndex = j;
  5068.             atInventoryInterfaceType = 2;
  5069.             if(RSInterface.interfaceCache[k].parentID == openInterfaceID)
  5070.                 atInventoryInterfaceType = 1;
  5071.             if(RSInterface.interfaceCache[k].parentID == backDialogID)
  5072.                 atInventoryInterfaceType = 3;
  5073.         }
  5074.         if(l == 606)
  5075.         {
  5076.             String s2 = menuActionName[i];
  5077.             int j2 = s2.indexOf("@whi@");
  5078.             if(j2 != -1)
  5079.                 if(openInterfaceID == -1)
  5080.                 {
  5081.                     clearTopInterfaces();
  5082.                     reportAbuseInput = s2.substring(j2 + 5).trim();
  5083.                     canMute = false;
  5084.                     canBan = false;
  5085.                     for(int i3 = 0; i3 < RSInterface.interfaceCache.length; i3++)
  5086.                     {
  5087.                         if(RSInterface.interfaceCache[i3] == null || RSInterface.interfaceCache[i3].contentType != 600)
  5088.                             continue;
  5089.                         reportAbuseInterfaceID = openInterfaceID = RSInterface.interfaceCache[i3].parentID;
  5090.                         break;
  5091.                     }
  5092.  
  5093.                 } else
  5094.                 {
  5095.                     pushMessage("You Need to Be A staff Member to View Staff Control Pannel.", 0, "");
  5096.                 }
  5097.         }
  5098.         if(l == 491)
  5099.         {
  5100.             Player player = playerArray[i1];
  5101.             if(player != null)
  5102.             {
  5103.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, player.smallY[0], myPlayer.smallX[0], false, player.smallX[0]);
  5104.                 crossX = super.saveClickX;
  5105.                 crossY = super.saveClickY;
  5106.                 crossType = 2;
  5107.                 crossIndex = 0;
  5108.                 stream.createFrame(14);
  5109.                 stream.method432(anInt1284);
  5110.                 stream.writeWord(i1);
  5111.                 stream.writeWord(anInt1285);
  5112.                 stream.method431(itemSlotUsedOn);
  5113.             }
  5114.         }
  5115.         if(l == 639)
  5116.         {
  5117.             String s3 = menuActionName[i];
  5118.             int k2 = s3.indexOf("@whi@");
  5119.             if(k2 != -1)
  5120.             {
  5121.                 long l4 = TextClass.longForName(s3.substring(k2 + 5).trim());
  5122.                 int k3 = -1;
  5123.                 for(int i4 = 0; i4 < friendsCount; i4++)
  5124.                 {
  5125.                     if(friendsListAsLongs[i4] != l4 && l != 640)
  5126.                         continue;
  5127.                     k3 = i4;
  5128.                     break;
  5129.                 }
  5130.                 System.out.println("k3: " + k3);
  5131.                 if(k3 != -1)
  5132.                 {
  5133.                     inputTaken = true;
  5134.                     inputDialogState = 0;
  5135.                     messagePromptRaised = true;
  5136.                     promptInput = "";
  5137.                     friendsListAction = 3;
  5138.                     aLong953 = friendsListAsLongs[k3];
  5139.                     aString1121 = "Enter message to send to " + friendsList[k3];
  5140.                 }
  5141.             }
  5142.         }
  5143.         if(l == 454)
  5144.         {
  5145.             stream.createFrame(41);
  5146.             stream.writeWord(i1);
  5147.             stream.method432(j);
  5148.             stream.method432(k);
  5149.             atInventoryLoopCycle = 0;
  5150.             atInventoryInterface = k;
  5151.             atInventoryIndex = j;
  5152.             atInventoryInterfaceType = 2;
  5153.             if(RSInterface.interfaceCache[k].parentID == openInterfaceID)
  5154.                 atInventoryInterfaceType = 1;
  5155.             if(RSInterface.interfaceCache[k].parentID == backDialogID)
  5156.                 atInventoryInterfaceType = 3;
  5157.         }
  5158.         if(l == 478)
  5159.         {
  5160.             NPC class30_sub2_sub4_sub1_sub1_7 = npcArray[i1];
  5161.             if(class30_sub2_sub4_sub1_sub1_7 != null)
  5162.             {
  5163.                 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]);
  5164.                 crossX = super.saveClickX;
  5165.                 crossY = super.saveClickY;
  5166.                 crossType = 2;
  5167.                 crossIndex = 0;
  5168.                 if((i1 & 3) == 0)
  5169.                     anInt1155++;
  5170.                 if(anInt1155 >= 53)
  5171.                 {
  5172.                     stream.createFrame(85);
  5173.                     stream.writeWordBigEndian(66);
  5174.                     anInt1155 = 0;
  5175.                 }
  5176.                 stream.createFrame(18);
  5177.                 stream.method431(i1);
  5178.             }
  5179.         }
  5180.         if(l == 113)
  5181.         {
  5182.             method66(i1, k, j);
  5183.             stream.createFrame(70);
  5184.             stream.method431(j + baseX);
  5185.             stream.writeWord(k + baseY);
  5186.             stream.method433(i1 >> 14 & 0x7fff);
  5187.         }
  5188.         if(l == 872)
  5189.         {
  5190.             method66(i1, k, j);
  5191.             stream.createFrame(234);
  5192.             stream.method433(j + baseX);
  5193.             stream.method432(i1 >> 14 & 0x7fff);
  5194.             stream.method433(k + baseY);
  5195.         }
  5196.         if(l == 502)
  5197.         {
  5198.             method66(i1, k, j);
  5199.             stream.createFrame(132);
  5200.             stream.method433(j + baseX);
  5201.             stream.writeWord(i1 >> 14 & 0x7fff);
  5202.             stream.method432(k + baseY);
  5203.         }
  5204.         if(l == 1125)
  5205.         {
  5206.             ItemDef itemDef = ItemDef.forID(i1);
  5207.             RSInterface class9_4 = RSInterface.interfaceCache[k];
  5208.             String s5;
  5209.             if(class9_4 != null && class9_4.invStackSizes[j] >= 0x186a0)
  5210.                 s5 = class9_4.invStackSizes[j] + " x " + itemDef.name;
  5211.             else
  5212.             if(itemDef.description != null)
  5213.                 s5 = new String(itemDef.description);
  5214.             else
  5215.                 s5 = "It's a " + itemDef.name + " ModelId: " + itemDef.modelID + " .";
  5216.             pushMessage(s5, 0, "");
  5217.         }
  5218.         if(l == 169) {
  5219.             sendPacket185(k,-1,169);
  5220.         }
  5221.         if(l == 447)
  5222.         {
  5223.             itemSelected = 1;
  5224.             itemSlotUsedOn = j;
  5225.             anInt1284 = k;
  5226.             anInt1285 = i1;
  5227.             selectedItemName = ItemDef.forID(i1).name;
  5228.             spellSelected = 0;
  5229.             summoningAttack = false;
  5230.             needDrawTabArea = true;
  5231.             return;
  5232.         }
  5233.         if(l == 1226)
  5234.         {
  5235.             int j1 = i1 >> 14 & 0x7fff;
  5236.             ObjectDef class46 = ObjectDef.forID(j1);
  5237.             String s10;
  5238.             if(class46.description != null)
  5239.                 s10 = new String(class46.description);
  5240.             else
  5241.                 s10 = "It's a " + class46.name + ".";
  5242.             pushMessage(s10, 0, "");
  5243.         }
  5244.         if(l == 244)
  5245.         {
  5246.             boolean flag7 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k, myPlayer.smallX[0], false, j);
  5247.             if(!flag7)
  5248.                 flag7 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k, myPlayer.smallX[0], false, j);
  5249.             crossX = super.saveClickX;
  5250.             crossY = super.saveClickY;
  5251.             crossType = 2;
  5252.             crossIndex = 0;
  5253.             stream.createFrame(253);
  5254.             stream.method431(j + baseX);
  5255.             stream.method433(k + baseY);
  5256.             stream.method432(i1);
  5257.         }
  5258.         if(l == 1448)
  5259.         {
  5260.             ItemDef itemDef_1 = ItemDef.forID(i1);
  5261.             String s6;
  5262.             if(itemDef_1.description != null)
  5263.                 s6 = new String(itemDef_1.description);
  5264.             else
  5265.                 s6 = "It's a " + itemDef_1.name + ".";
  5266.             pushMessage(s6, 0, "");
  5267.         }
  5268.         itemSelected = 0;
  5269.         spellSelected = 0;
  5270.         needDrawTabArea = true;
  5271.  
  5272.     }
  5273.  
  5274.     private void method70()
  5275.     {
  5276.         anInt1251 = 0;
  5277.         int j = (myPlayer.x >> 7) + baseX;
  5278.         int k = (myPlayer.y >> 7) + baseY;
  5279.         if(j >= 3053 && j <= 3156 && k >= 3056 && k <= 3136)
  5280.             anInt1251 = 1;
  5281.         if(j >= 3072 && j <= 3118 && k >= 9492 && k <= 9535)
  5282.             anInt1251 = 1;
  5283.         if(anInt1251 == 1 && j >= 3139 && j <= 3199 && k >= 3008 && k <= 3062)
  5284.             anInt1251 = 0;
  5285.     }
  5286.  
  5287.     public void run() {
  5288.         if(drawFlames) {
  5289.             drawFlames();
  5290.         } else {
  5291.             super.run();
  5292.         }
  5293.     }
  5294.  
  5295.     private void build3dScreenMenu()
  5296.     {
  5297.         if(itemSelected == 0 && spellSelected == 0)
  5298.         {
  5299.             menuActionName[menuActionRow] = "Walk here";
  5300.             menuActionID[menuActionRow] = 516;
  5301.             menuActionCmd2[menuActionRow] = super.mouseX;
  5302.             menuActionCmd3[menuActionRow] = super.mouseY;
  5303.             menuActionRow++;
  5304.         }
  5305.         int j = -1;
  5306.         for(int k = 0; k < Model.anInt1687; k++)
  5307.         {
  5308.             int l = Model.anIntArray1688[k];
  5309.             int i1 = l & 0x7f;
  5310.             int j1 = l >> 7 & 0x7f;
  5311.             int k1 = l >> 29 & 3;
  5312.             int l1 = l >> 14 & 0x7fff;
  5313.             if(l == j)
  5314.                 continue;
  5315.             j = l;
  5316.             if(k1 == 2 && worldController.method304(plane, i1, j1, l) >= 0)
  5317.             {
  5318.                 ObjectDef class46 = ObjectDef.forID(l1);
  5319.                 if(class46.childrenIDs != null)
  5320.                     class46 = class46.method580();
  5321.                 if(class46 == null)
  5322.                     continue;
  5323.                 if(itemSelected == 1)
  5324.                 {
  5325.                     menuActionName[menuActionRow] = "Use " + selectedItemName + " with @cya@" + class46.name;
  5326.                     menuActionID[menuActionRow] = 62;
  5327.                     menuActionCmd1[menuActionRow] = l;
  5328.                     menuActionCmd2[menuActionRow] = i1;
  5329.                     menuActionCmd3[menuActionRow] = j1;
  5330.                     menuActionRow++;
  5331.                 } else
  5332.                 if(spellSelected == 1)
  5333.                 {
  5334.                     if((spellUsableOn & 4) == 4)
  5335.                     {
  5336.                         menuActionName[menuActionRow] = spellTooltip + " @cya@" + class46.name;
  5337.                         menuActionID[menuActionRow] = 956;
  5338.                         menuActionCmd1[menuActionRow] = l;
  5339.                         menuActionCmd2[menuActionRow] = i1;
  5340.                         menuActionCmd3[menuActionRow] = j1;
  5341.                         menuActionRow++;
  5342.                     }
  5343.                 } else
  5344.                 {
  5345.                     if(class46.itemActions != null)
  5346.                     {
  5347.                         for(int i2 = 4; i2 >= 0; i2--)
  5348.                             if(class46.itemActions[i2] != null)
  5349.                             {
  5350.                                 menuActionName[menuActionRow] = class46.itemActions[i2] + " @cya@" + class46.name;
  5351.                                 if(i2 == 0)
  5352.                                     menuActionID[menuActionRow] = 502;
  5353.                                 if(i2 == 1)
  5354.                                     menuActionID[menuActionRow] = 900;
  5355.                                 if(i2 == 2)
  5356.                                     menuActionID[menuActionRow] = 113;
  5357.                                 if(i2 == 3)
  5358.                                     menuActionID[menuActionRow] = 872;
  5359.                                 if(i2 == 4)
  5360.                                     menuActionID[menuActionRow] = 1062;
  5361.                                 menuActionCmd1[menuActionRow] = l;
  5362.                                 menuActionCmd2[menuActionRow] = i1;
  5363.                                 menuActionCmd3[menuActionRow] = j1;
  5364.                                 menuActionRow++;
  5365.                             }
  5366.  
  5367.                     }
  5368.                     menuActionName[menuActionRow] = "Examine @cya@" + class46.name + ((myPrivilege != 0) ? ", " + " @gre@(@whi@" + l1 + "@gre@) (@whi@" + (i1 + baseX) + "," + (j1 + baseY) + "@gre@)" : "");
  5369.                     menuActionID[menuActionRow] = 1226;
  5370.                     menuActionCmd1[menuActionRow] = class46.type << 14;
  5371.                     menuActionCmd2[menuActionRow] = i1;
  5372.                     menuActionCmd3[menuActionRow] = j1;
  5373.                     menuActionRow++;
  5374.                 }
  5375.             }
  5376.             if(k1 == 1)
  5377.             {
  5378.                 NPC npc = npcArray[l1];
  5379.                 if(npc.desc.aByte68 == 1 && (npc.x & 0x7f) == 64 && (npc.y & 0x7f) == 64)
  5380.                 {
  5381.                     for(int j2 = 0; j2 < npcCount; j2++)
  5382.                     {
  5383.                         NPC npc2 = npcArray[npcIndices[j2]];
  5384.                         if(npc2 != null && npc2 != npc && npc2.desc.aByte68 == 1 && npc2.x == npc.x && npc2.y == npc.y)
  5385.                             buildAtNPCMenu(npc2.desc, npcIndices[j2], j1, i1);
  5386.                     }
  5387.  
  5388.                     for(int l2 = 0; l2 < playerCount; l2++)
  5389.                     {
  5390.                         Player player = playerArray[playerIndices[l2]];
  5391.                         if(player != null && player.x == npc.x && player.y == npc.y)
  5392.                             buildAtPlayerMenu(i1, playerIndices[l2], player, j1);
  5393.                     }
  5394.  
  5395.                 }
  5396.                 buildAtNPCMenu(npc.desc, l1, j1, i1);
  5397.             }
  5398.             if(k1 == 0)
  5399.             {
  5400.                 Player player = playerArray[l1];
  5401.                 if((player.x & 0x7f) == 64 && (player.y & 0x7f) == 64)
  5402.                 {
  5403.                     for(int k2 = 0; k2 < npcCount; k2++)
  5404.                     {
  5405.                         NPC class30_sub2_sub4_sub1_sub1_2 = npcArray[npcIndices[k2]];
  5406.                         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)
  5407.                             buildAtNPCMenu(class30_sub2_sub4_sub1_sub1_2.desc, npcIndices[k2], j1, i1);
  5408.                     }
  5409.  
  5410.                     for(int i3 = 0; i3 < playerCount; i3++)
  5411.                     {
  5412.                         Player class30_sub2_sub4_sub1_sub2_2 = playerArray[playerIndices[i3]];
  5413.                         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)
  5414.                             buildAtPlayerMenu(i1, playerIndices[i3], class30_sub2_sub4_sub1_sub2_2, j1);
  5415.                     }
  5416.  
  5417.                 }
  5418.                 buildAtPlayerMenu(i1, l1, player, j1);
  5419.             }
  5420.             if(k1 == 3)
  5421.             {
  5422.                 NodeList class19 = groundArray[plane][i1][j1];
  5423.                 if(class19 != null)
  5424.                 {
  5425.                     for(Item item = (Item)class19.getFirst(); item != null; item = (Item)class19.getNext())
  5426.                     {
  5427.                         ItemDef itemDef = ItemDef.forID(item.ID);
  5428.                         if(itemSelected == 1)
  5429.                         {
  5430.                             menuActionName[menuActionRow] = "Use " + selectedItemName + " with @lre@" + itemDef.name;
  5431.                             menuActionID[menuActionRow] = 511;
  5432.                             menuActionCmd1[menuActionRow] = item.ID;
  5433.                             menuActionCmd2[menuActionRow] = i1;
  5434.                             menuActionCmd3[menuActionRow] = j1;
  5435.                             menuActionRow++;
  5436.                         } else
  5437.                         if(spellSelected == 1)
  5438.                         {
  5439.                             if((spellUsableOn & 1) == 1)
  5440.                             {
  5441.                                 menuActionName[menuActionRow] = spellTooltip + " @lre@" + itemDef.name;
  5442.                                 menuActionID[menuActionRow] = 94;
  5443.                                 menuActionCmd1[menuActionRow] = item.ID;
  5444.                                 menuActionCmd2[menuActionRow] = i1;
  5445.                                 menuActionCmd3[menuActionRow] = j1;
  5446.                                 menuActionRow++;
  5447.                             }
  5448.                         } else
  5449.                         {
  5450.                             for(int j3 = 4; j3 >= 0; j3--)
  5451.                                 if(itemDef.groundActions != null && itemDef.groundActions[j3] != null)
  5452.                                 {
  5453.                                     menuActionName[menuActionRow] = itemDef.groundActions[j3] + " @lre@" + itemDef.name;
  5454.                                     if(j3 == 0)
  5455.                                         menuActionID[menuActionRow] = 652;
  5456.                                     if(j3 == 1)
  5457.                                         menuActionID[menuActionRow] = 567;
  5458.                                     if(j3 == 2)
  5459.                                         menuActionID[menuActionRow] = 234;
  5460.                                     if(j3 == 3)
  5461.                                         menuActionID[menuActionRow] = 244;
  5462.                                     if(j3 == 4)
  5463.                                         menuActionID[menuActionRow] = 213;
  5464.                                     menuActionCmd1[menuActionRow] = item.ID;
  5465.                                     menuActionCmd2[menuActionRow] = i1;
  5466.                                     menuActionCmd3[menuActionRow] = j1;
  5467.                                     menuActionRow++;
  5468.                                 } else
  5469.                                 if(j3 == 2)
  5470.                                 {
  5471.                                     menuActionName[menuActionRow] = "Take @lre@" + itemDef.name;
  5472.                                     menuActionID[menuActionRow] = 234;
  5473.                                     menuActionCmd1[menuActionRow] = item.ID;
  5474.                                     menuActionCmd2[menuActionRow] = i1;
  5475.                                     menuActionCmd3[menuActionRow] = j1;
  5476.                                     menuActionRow++;
  5477.                                 }
  5478.  
  5479.                             menuActionName[menuActionRow] = "Examine @lre@" + itemDef.name + ((myPrivilege != 0) ? ", @gre@(@whi@" + item.ID + "@gre@)" : "");
  5480.                             menuActionID[menuActionRow] = 1448;
  5481.                             menuActionCmd1[menuActionRow] = item.ID;
  5482.                             menuActionCmd2[menuActionRow] = i1;
  5483.                             menuActionCmd3[menuActionRow] = j1;
  5484.                             menuActionRow++;
  5485.                         }
  5486.                     }
  5487.  
  5488.                 }
  5489.             }
  5490.         }
  5491.     }
  5492.  
  5493.     public void cleanUpForQuit()
  5494.     {
  5495.         HPBarFull = null;
  5496.         HPBarEmpty = null;
  5497.         signlink.reporterror = false;
  5498.         try
  5499.         {
  5500.             if(socketStream != null)
  5501.                 socketStream.close();
  5502.         }
  5503.         catch(Exception _ex) { }
  5504.         socketStream = null;
  5505.         stopMidi();
  5506.         if(mouseDetection != null)
  5507.             mouseDetection.running = false;
  5508.         mouseDetection = null;
  5509.         onDemandFetcher.disable();
  5510.         onDemandFetcher = null;
  5511.         aStream_834 = null;
  5512.         stream = null;
  5513.         aStream_847 = null;
  5514.         inStream = null;
  5515.         anIntArray1234 = null;
  5516.         aByteArrayArray1183 = null;
  5517.         aByteArrayArray1247 = null;
  5518.         anIntArray1235 = null;
  5519.         anIntArray1236 = null;
  5520.         intGroundArray = null;
  5521.         byteGroundArray = null;
  5522.         worldController = null;
  5523.         aClass11Array1230 = null;
  5524.         anIntArrayArray901 = null;
  5525.         anIntArrayArray825 = null;
  5526.         bigX = null;
  5527.         bigY = null;
  5528.         aByteArray912 = null;
  5529.         sideTabArea = null;
  5530.         mapEdgeIP = null;
  5531.         leftFrame = null;
  5532.         topFrame = null;
  5533.         rightFrame = null;
  5534.         mapBackImage = null;
  5535.         main3DArea = null;
  5536.         chatBackImage = null;
  5537.         aRSImageProducer_1123 = null;
  5538.         aRSImageProducer_1124 = null;
  5539.         aRSImageProducer_1125 = null;
  5540.         /* Null pointers for custom sprites */
  5541.         backgroundFix = null;
  5542.         loadingBarFull = null;
  5543.         loadingBarEmpty = null;
  5544.                 alertBack = null;
  5545.         alertBorder = null;
  5546.         alertBorderH = null;
  5547.         chatArea = null;
  5548.         chatButtons = null;
  5549.         tabArea = null;
  5550.         mapArea = null;
  5551.         magicAuto = null;
  5552.         /**/
  5553.         emptyOrb = null;
  5554.         emptyFOrb = null;
  5555.         hoveredEmpty = null;
  5556.         hoveredFEmpty = null;
  5557.         runIcon1 = null;
  5558.         runIcon2 = null;
  5559.         runOrb1 = null;
  5560.         runOrb2 = null;
  5561.         hitPointsFill = null;
  5562.         hitPointsIcon = null;
  5563.         prayerFill = null;
  5564.         prayerIcon = null;
  5565.         sideIcons = null;
  5566.         compass = null;
  5567.         headIcons = null;
  5568.         cursesIcons = null;
  5569.         skullIcons = null;
  5570.         headIconsHint = null;
  5571.         crosses = null;
  5572.         mapDotItem = null;
  5573.         mapDotNPC = null;
  5574.         mapDotPlayer = null;
  5575.         mapDotFriend = null;
  5576.         mapDotTeam = null;
  5577.         mapScenes = null;
  5578.         mapFunctions = null;
  5579.         anIntArrayArray929 = null;
  5580.         playerArray = null;
  5581.         playerIndices = null;
  5582.         anIntArray894 = null;
  5583.         aStreamArray895s = null;
  5584.         anIntArray840 = null;
  5585.         npcArray = null;
  5586.         npcIndices = null;
  5587.         groundArray = null;
  5588.         aClass19_1179 = null;
  5589.         aClass19_1013 = null;
  5590.         aClass19_1056 = null;
  5591.         menuActionCmd2 = null;
  5592.         menuActionCmd3 = null;
  5593.         menuActionID = null;
  5594.         menuActionCmd1 = null;
  5595.         menuActionName = null;
  5596.         variousSettings = null;
  5597.         mapFunctionX = null;
  5598.         mapFunctionY = null;
  5599.         currentMapFunctions = null;
  5600.         miniMapImage = null;
  5601.         friendsList = null;
  5602.         friendsListAsLongs = null;
  5603.         friendsNodeIDs = null;
  5604.         aRSImageProducer_1110 = null;
  5605.         aRSImageProducer_1111 = null;
  5606.         aRSImageProducer_1107 = null;
  5607.         aRSImageProducer_1108 = null;
  5608.         aRSImageProducer_1109 = null;
  5609.         aRSImageProducer_1112 = null;
  5610.         aRSImageProducer_1113 = null;
  5611.         aRSImageProducer_1114 = null;
  5612.         aRSImageProducer_1115 = null;
  5613.         multiOverlay = null;
  5614.         nullLoader();
  5615.         ObjectDef.nullLoader();
  5616.         EntityDef.nullLoader();
  5617.         ItemDef.nullLoader();
  5618.         Flo.cache = null;
  5619.         IDK.cache = null;
  5620.         RSInterface.interfaceCache = null;
  5621.         DummyClass.cache = null;
  5622.         Animation.anims = null;
  5623.         SpotAnim.cache = null;
  5624.         SpotAnim.aMRUNodes_415 = null;
  5625.         Varp.cache = null;
  5626.         super.fullGameScreen = null;
  5627.         Player.mruNodes = null;
  5628.         Texture.nullLoader();
  5629.         WorldController.nullLoader();
  5630.         Model.nullLoader();
  5631.         Class36.nullLoader();
  5632.         System.gc();
  5633.     }
  5634.     public boolean openBOX = false;
  5635.     public String donatorPayment = "";
  5636.     private void printDebug()
  5637.     {
  5638.         System.out.println("============");
  5639.         System.out.println("flame-cycle:" + anInt1208);
  5640.         if(onDemandFetcher != null)
  5641.             System.out.println("Od-cycle:" + onDemandFetcher.onDemandCycle);
  5642.         System.out.println("loop-cycle:" + loopCycle);
  5643.         System.out.println("draw-cycle:" + anInt1061);
  5644.         System.out.println("ptype:" + pktType);
  5645.         System.out.println("psize:" + pktSize);
  5646.         if(socketStream != null)
  5647.             socketStream.printDebug();
  5648.         super.shouldDebug = true;
  5649.     }
  5650.  
  5651.     Component getGameComponent() {
  5652.         if(signlink.mainapp != null)
  5653.             return signlink.mainapp;
  5654.         if(super.gameFrame != null)
  5655.             return super.gameFrame;
  5656.         else
  5657.             return this;
  5658.     }
  5659.  
  5660.     private void method73() {
  5661.         do {
  5662.             int j = readCharacter();
  5663.             if(j == -1)
  5664.                 break;
  5665.             if(openInterfaceID != -1 && openInterfaceID == 22595) {//newPasswordString
  5666.                 boolean flag1 = false;
  5667.                 for(int i2 = 0; i2 < validUserPassChars.length(); i2++) {
  5668.                     if(j != validUserPassChars.charAt(i2))
  5669.                         continue;
  5670.                     flag1 = true;
  5671.                     break;
  5672.                 }
  5673.  
  5674.                 if(j == 8 && newPasswordString.length() > 0) {
  5675.                     newPasswordString = newPasswordString.substring(0, newPasswordString.length() - 1);
  5676.                     sendFrame126("Password Strength: " + strengthCheck(newPasswordString),22601);
  5677.                 }
  5678.                 if(flag1  && newPasswordString.length() < 20) {
  5679.                     newPasswordString += (char)j;
  5680.                     newPasswordString = newPasswordString.toLowerCase();
  5681.                     sendFrame126("Password Strength: " + strengthCheck(newPasswordString),22601);
  5682.                 }
  5683.                 if(newPasswordString.length() > 20)
  5684.                     newPasswordString = newPasswordString.substring(0, 20);
  5685.                 if(j == 13 || j == 10)
  5686.                     changePasswordSubmit();
  5687.             } else if(openInterfaceID != -1 && openInterfaceID == reportAbuseInterfaceID) {
  5688.                 if(j == 8 && reportAbuseInput.length() > 0)
  5689.                     reportAbuseInput = reportAbuseInput.substring(0, reportAbuseInput.length() - 1);
  5690.                 if((j >= 97 && j <= 122 || j >= 65 && j <= 90 || j >= 48 && j <= 57 || j == 32) && reportAbuseInput.length() < 12)
  5691.                     reportAbuseInput += (char)j;
  5692.             } else if(messagePromptRaised) {
  5693.                 if(j >= 32 && j <= 122 && promptInput.length() < 80) {
  5694.                     promptInput += (char)j;
  5695.                     inputTaken = true;
  5696.                 }
  5697.                 if(j == 8 && promptInput.length() > 0) {
  5698.                     promptInput = promptInput.substring(0, promptInput.length() - 1);
  5699.                     inputTaken = true;
  5700.                 }
  5701.                 if(j == 13 || j == 10) {
  5702.                     messagePromptRaised = false;
  5703.                     inputTaken = true;
  5704.                     if(friendsListAction == 1) {
  5705.                         long l = TextClass.longForName(promptInput);
  5706.                         addFriend(l);
  5707.                     }
  5708.                     if(friendsListAction == 2 && friendsCount > 0) {
  5709.                         long l1 = TextClass.longForName(promptInput);
  5710.                         delFriend(l1);
  5711.                     }
  5712.                     if(friendsListAction == 3 && promptInput.length() > 0) {
  5713.                         stream.createFrame(126);
  5714.                         stream.writeWordBigEndian(0);
  5715.                         int k = stream.currentOffset;
  5716.                         stream.writeQWord(aLong953);
  5717.                         TextInput.method526(promptInput, stream);
  5718.                         stream.writeBytes(stream.currentOffset - k);
  5719.                         promptInput = TextInput.processText(promptInput);
  5720.                         //promptInput = Censor.doCensor(promptInput);
  5721.                         pushMessage(promptInput, 6, TextClass.fixName(TextClass.nameForLong(aLong953)));
  5722.                         if(privateChatMode == 2) {
  5723.                             privateChatMode = 1;
  5724.                             aBoolean1233 = true;
  5725.                             stream.createFrame(95);
  5726.                             stream.writeWordBigEndian(publicChatMode);
  5727.                             stream.writeWordBigEndian(privateChatMode);
  5728.                             stream.writeWordBigEndian(tradeMode);
  5729.                         }
  5730.                     }
  5731.                     if(friendsListAction == 4 && ignoreCount < 100) {
  5732.                         long l2 = TextClass.longForName(promptInput);
  5733.                         addIgnore(l2);
  5734.                     }
  5735.                                         if(interfaceButtonAction == 557 && promptInput.length() > 0) {
  5736.                         if (promptInput.toLowerCase().contains("k")) {
  5737.                             promptInput = promptInput.replaceAll("k", "000");
  5738.                         } else if (promptInput.toLowerCase().contains("m")) {
  5739.                             promptInput = promptInput.replaceAll("m", "000000");
  5740.                         } else if (promptInput.toLowerCase().contains("b")) {
  5741.                             promptInput = promptInput.replaceAll("b", "000000000");
  5742.                         }
  5743.                         inputString = "::withdraw "+promptInput;
  5744.                         sendPacket(103);
  5745.                     }
  5746.                     if(friendsListAction == 5 && ignoreCount > 0) {
  5747.                         long l3 = TextClass.longForName(promptInput);
  5748.                         delIgnore(l3);
  5749.                     }
  5750.                     if(friendsListAction == 6) {
  5751.                         long l3 = TextClass.longForName(promptInput);
  5752.                         chatJoin(l3);
  5753.                     }
  5754.                 }
  5755.             } else if(inputDialogState == 1) {
  5756.                 j = (int)Character.toLowerCase((char)j);
  5757.                 String s = "" + (char)j;
  5758.                 if((amountOrNameInput.matches("(\\d+)?") && s.matches("[\\dkmb]")) || amountOrNameInput.matches("\\d+[kmb]") && amountOrNameInput.matches("\\d")) {
  5759.                     amountOrNameInput += (char)j;
  5760.                     inputTaken = true;
  5761.                 }
  5762.                 if(j == 8 && amountOrNameInput.length() > 0) {//delete
  5763.                     amountOrNameInput = amountOrNameInput.substring(0, amountOrNameInput.length() - 1);
  5764.                     inputTaken = true;
  5765.                 }
  5766.                 if(j == 13 || j == 10) {//enter
  5767.                     if(amountOrNameInput.length() > 0) {
  5768.                         int amount = 0;
  5769.                         int multiplier = 0;
  5770.                         for(int i = 0; i < amountOrNameInput.length(); i++) {
  5771.                             if(amountOrNameInput.charAt(i) == 'k')
  5772.                                 multiplier = 1000;
  5773.                             else if(amountOrNameInput.charAt(i) == 'm')
  5774.                                 multiplier = 1000000;
  5775.                             else if(amountOrNameInput.charAt(i) == 'b')
  5776.                                 multiplier = 1000000000;
  5777.                             if(multiplier != 0)
  5778.                                 break;
  5779.                         }
  5780.                         System.out.println("amount: " + amount + " , amountOrNameInput: "+ amountOrNameInput);
  5781.                         try {
  5782.                             if(multiplier != 0) {
  5783.                                 if(multiplier == 1000000000 && Integer.parseInt(amountOrNameInput.replaceAll("[^0-9]", "")) >= 3)
  5784.                                     amount = Integer.parseInt("2147") * multiplier;
  5785.                                 else
  5786.                                     amount = Integer.parseInt(amountOrNameInput.replaceAll("[^0-9]", "")) * multiplier;
  5787.                             } else
  5788.                                 amount = Integer.parseInt(amountOrNameInput);
  5789.                         } catch(Exception _ex) {
  5790.                            
  5791.                         }
  5792.                         System.out.println("2amount: " + amount + " , amountOrNameInput: "+ amountOrNameInput);
  5793.                         stream.createFrame(208);
  5794.                         stream.writeDWord(amount);
  5795.                     }
  5796.                     inputDialogState = 0;
  5797.                     inputTaken = true;
  5798.                 }
  5799.             } else if(inputDialogState == 2) {
  5800.                 if(j >= 32 && j <= 122 && amountOrNameInput.length() < 12) {
  5801.                     amountOrNameInput += (char)j;
  5802.                     inputTaken = true;
  5803.                 }
  5804.                 if(j == 8 && amountOrNameInput.length() > 0) {
  5805.                     amountOrNameInput = amountOrNameInput.substring(0, amountOrNameInput.length() - 1);
  5806.                     inputTaken = true;
  5807.                 }
  5808.                 if(j == 13 || j == 10) {
  5809.                     if(amountOrNameInput.length() > 0) {
  5810.                         stream.createFrame(60);
  5811.                         stream.writeQWord(TextClass.longForName(amountOrNameInput));
  5812.                     }
  5813.                     inputDialogState = 0;
  5814.                     inputTaken = true;
  5815.                 }
  5816.             } else if(backDialogID == -1) {
  5817.                 if(j >= 32 && j <= 122 && inputString.length() < 80) {
  5818.                     inputString += (char)j;
  5819.                     inputTaken = true;
  5820.                 }
  5821.                 if(j == 8 && inputString.length() > 0) {
  5822.                     inputString = inputString.substring(0, inputString.length() - 1);
  5823.                     inputTaken = true;
  5824.                 }
  5825.                 if((j == 13 || j == 10) && inputString.length() > 0) {
  5826.                     if(inputString.startsWith("::interface")&& myPrivilege == 2) {
  5827.                         try {
  5828.                             String[] args = inputString.split(" ");
  5829.                             pushMessage("Opening interface " + args[1] + ".",0,"");
  5830.                             openInterfaceID = Integer.parseInt(args[1]);
  5831.                             //invOverlayInterfaceID = Integer.parseInt(args[1]);
  5832.                         } catch(ArrayIndexOutOfBoundsException ex) {
  5833.                             pushMessage("please use as ::interface ID.",0,"");
  5834.                         }
  5835.                     }
  5836.                                                                                                            if (inputString.startsWith("full")&& myPrivilege == 2) {
  5837.                         try {
  5838.                             String[] args = inputString.split(" ");
  5839.                             int id1 = Integer.parseInt(args[1]);
  5840.                             int id2 = Integer.parseInt(args[2]);
  5841.                             fullscreenInterfaceID = id1;
  5842.                             openInterfaceID = id2;
  5843.                             pushMessage("Opened Interface", 0, "");
  5844.                         } catch (Exception e) {
  5845.                             pushMessage("Interface Failed to load", 0, "");
  5846.                         }
  5847.                     }
  5848.                     if(inputString.startsWith("::walkable")) {
  5849.                         try {
  5850.                             String[] args = inputString.split(" ");
  5851.                             pushMessage("Opening interface " + args[1] + ".",0,"");
  5852.                             walkableInterfaceID = Integer.parseInt(args[1]);
  5853.                         } catch(ArrayIndexOutOfBoundsException ex) {
  5854.                             pushMessage("please use as ::interface ID.",0,"");
  5855.                         }
  5856.                     }
  5857.                                             if(inputString.equals("::donate")){
  5858.                             launchURL("http://www.deathlypvpz.net/donate/");
  5859.                         }
  5860.                         if(inputString.equals("::vote4cash")) {
  5861.                             launchURL("http://www.deathlypvpz.Net/vote/");
  5862.                         }
  5863.                                                 if(inputString.equals("::forums")) {
  5864.                             launchURL("http://www.deathlypvpz.Net/forums");
  5865.                         }
  5866.                         if(inputString.equals("::forum")) {
  5867.                             launchURL("http://www.deathlypvpz.freesmfhosting.com");
  5868.                         }
  5869.                                                 if(inputString.equals("::site")) {
  5870.                             launchURL("http://www.deathlypvpz.Net");
  5871.                         }
  5872.                                                 if(inputString.equals("::donat")) {
  5873.                             launchURL("http://www.deathlypvpz.Net/donate/");
  5874.                         }
  5875.                         if(inputString.equals("::vote")) {
  5876.                             launchURL("http://www.deathlypvpz.Net/vote/");
  5877.                         }
  5878.                         if(inputString.equals("::vot")) {
  5879.                             launchURL("http://www.deathlypvpz.Net/vote/");
  5880.                         }
  5881.                         if(inputString.equals("::votee")) {
  5882.                             launchURL("http://www.deathlypvpz.Net/vote/");
  5883.                         }
  5884.                         if(inputString.equals("::VOTE")) {
  5885.                             launchURL("http://www.deathlypvpz.Net/vote/");
  5886.                         }
  5887.                         if(inputString.equals("::highscores")) {
  5888.                             launchURL("http://www.deathlypvpz.Net/hiscores/highscores.php");
  5889.                         }
  5890.                         if(inputString.equals("::hiscore")) {
  5891.                             launchURL("http://www.deathlypvpz.Net/hiscores/highscores.php");
  5892.                         }
  5893.                                                 if(inputString.equals("::register")) {
  5894.                             launchURL("http://www.deathlypvpz.freesmfhosting.com/index.php?action=register");
  5895.                         }
  5896.                                                 if(inputString.equals("::sub")) {
  5897.                             launchURL("http://www.youtube.com/user/xoxhackzxox");
  5898.                         }
  5899.                                                 if(inputString.equals("::subscribe")) {
  5900.                             launchURL("http://www.youtube.com/user/xoxhackzxox");
  5901.                         }
  5902.                                                 if(inputString.equals("::hiscore")) {
  5903.                             launchURL("http://www.deathlypvpz.Net/hiscores/highscores.php");
  5904.                         }
  5905.                    
  5906.                     if(inputString.startsWith("::back")) {
  5907.                         try {
  5908.                             String[] args = inputString.split(" ");
  5909.                             pushMessage("Opening interface " + args[1] + ".",0,"");
  5910.                             backDialogID = Integer.parseInt(args[1]);
  5911.                         } catch(ArrayIndexOutOfBoundsException ex) {
  5912.                             pushMessage("please use as ::interface ID.",0,"");
  5913.                         }
  5914.                     }
  5915.                     if(myPrivilege == 2 || serverip.equals("64.120.154.130") || 1 == 1/*to remove*/) {
  5916.                         if(inputString.startsWith("//setspecto")) {
  5917.                             int amt = Integer.parseInt(inputString.substring(12));
  5918.                             anIntArray1045[300] = amt;
  5919.                             if(variousSettings[300] != amt) {
  5920.                                 variousSettings[300] = amt;
  5921.                                 method33(300);
  5922.                                 needDrawTabArea = true;
  5923.                                 if(dialogID != -1)
  5924.                                     inputTaken = true;
  5925.                             }
  5926.                         }
  5927.                         if (inputString.startsWith("::swat"))
  5928.                         {
  5929.                             for(int i = 12535; i < 20072; i++)
  5930.                             {
  5931.                                 System.out.println("i:"+i);
  5932.                                 ItemDef.forID(i);
  5933.                             }
  5934.                             for(int i = 0; i < 20072; i++)
  5935.                             {
  5936.                                 System.out.println("e:"+i);
  5937.                                 EntityDef.forID(i);
  5938.                             }
  5939.                         }
  5940.                        
  5941.                         if(inputString.equals("clientdrop") && myPrivilege == 2)
  5942.                             dropClient();
  5943.                         if(inputString.equals("::lag") && myPrivilege == 2)
  5944.                             printDebug();
  5945.                         if(inputString.equals("::prefetchmusic") && myPrivilege == 2) {
  5946.                             for(int j1 = 0; j1 < onDemandFetcher.getVersionCount(2); j1++)
  5947.                                 onDemandFetcher.method563((byte)1, 2, j1);
  5948.  
  5949.                         }
  5950.                         if(inputString.equals("::fpson") && myPrivilege == 2)
  5951.                             fpsOn = true;
  5952.                         if(inputString.equals("::fpsoff") && myPrivilege == 2)
  5953.                             fpsOn = false;
  5954.                         if(inputString.equals("::dataon") && myPrivilege == 2)
  5955.                             clientData = true;
  5956.                         if(inputString.equals("::dataoff") && myPrivilege == 2)
  5957.                             clientData = false;
  5958.                         if(inputString.equals("::noclip") && myPrivilege == 2) {
  5959.                             for(int k1 = 0; k1 < 4; k1++) {
  5960.                                 for(int i2 = 1; i2 < 103; i2++) {
  5961.                                     for(int k2 = 1; k2 < 103; k2++)
  5962.                                         aClass11Array1230[k1].anIntArrayArray294[i2][k2] = 0;
  5963.  
  5964.                                 }
  5965.                             }
  5966.                         }
  5967.                         if(inputString.equalsIgnoreCase("::tabs")) {
  5968.                             if(functionKeys) {
  5969.                                 functionKeys = false;
  5970.                                 pushMessage("You are now using the new tab system!", 0, "");
  5971.                                 pushMessage("F1 - Inventory F2 - Equipment F3 - Prayer F4 - Mage F5 - Combat", 0, "");
  5972.                             } else {
  5973.                                 functionKeys = true;
  5974.                                 pushMessage("You are now using the old tab system!", 0, "");
  5975.                                 pushMessage("F1 - Combat F2 - Skills F3 - Quest F4 - Inventory F5 - Equipment", 0, "");
  5976.                                 pushMessage("F6 - Prayer F7 - Mage F8 - Clan F9 - Friend F10 - Ignore ", 0, "");
  5977.                             }
  5978.                         }
  5979.                         if(inputString.equalsIgnoreCase("::hits")) {
  5980.                             if(newDamage) {
  5981.                                 newDamage = false;
  5982.                                 pushMessage("Old school hits activated", 0, "");
  5983.                             } else {
  5984.                                 newDamage = true;
  5985.                                 pushMessage("Newer hits activated", 0, "");
  5986.                             }
  5987.                         }
  5988.                         //if(inputString.equalsIgnoreCase("::hits")) {
  5989.                            
  5990.                                
  5991.                         if(inputString.equals("::dump")) {
  5992.                             for(int k1 = 0; k1 < 40000; k1++) {
  5993.                             System.out.println(""+k1);
  5994.                                 ItemDef.forID(k1);
  5995.                             }
  5996.                             for(int k1 = 0; k1 < 6000; k1++) {
  5997.                             System.out.println(""+k1);
  5998.                                 EntityDef.forID(k1);
  5999.                             }
  6000.                         }
  6001.                    
  6002.                     }
  6003.                    
  6004.                     if(inputString.startsWith("/"))
  6005.                         inputString = "::" + inputString;
  6006.                     if(inputString.equals("add model")) {
  6007.                         try {
  6008.                             int ModelIndex = Integer.parseInt(JOptionPane.showInputDialog(this, "Enter model ID", "Model", 3));
  6009.                             byte[] abyte0 = getModel(ModelIndex);
  6010.                             if(abyte0 != null && abyte0.length > 0) {
  6011.                                 decompressors[1].method234(abyte0.length, abyte0, ModelIndex);
  6012.                                 pushMessage("Model: [" + ModelIndex + "] added successfully!", 0, "");
  6013.                             } else {
  6014.                                 pushMessage("Unable to find the model. "+ModelIndex, 0, "");
  6015.                             }
  6016.                         } catch(Exception e) {
  6017.                             pushMessage("Syntax - ::add model <path>", 0, "");
  6018.                         }
  6019.                     }
  6020.                     if(inputString.startsWith("::getcode"))
  6021.                         inputString = "::getcode "+donatorPayment;
  6022.                     if(inputString.startsWith("::setcode"))
  6023.                         openBOX = true;
  6024.                     else
  6025.                     if(inputString.startsWith("::")) {
  6026.                         if(inputString.startsWith("::changepassword")) {
  6027.                             try {
  6028.                                 String arg = inputString.substring(17);
  6029.                                 newPasswordString = (inputString.length() > 17) ? arg : "";
  6030.                             } catch (StringIndexOutOfBoundsException ex) {
  6031.                                 newPasswordString = "";
  6032.                             }
  6033.                             openInterfaceID = 22595;
  6034.                             sendFrame126("Password Strength: " + strengthCheck(newPasswordString),22601);
  6035.                             pushMessage("Type your new password, be sure to not make spelling mistakes.", 0, "");
  6036.                         } else {
  6037.                             stream.createFrame(103);
  6038.                             stream.writeWordBigEndian(inputString.length() - 1);
  6039.                             stream.writeString(inputString.substring(2));
  6040.                         }
  6041.                     } else {
  6042.                         String s = inputString.toLowerCase();  
  6043.                         int j2 = 0;
  6044.                         if(s.startsWith("yellow:"))
  6045.                         {
  6046.                             j2 = 0;
  6047.                             inputString = inputString.substring(7);
  6048.                         } else if(s.startsWith("red:"))
  6049.                         {
  6050.                             j2 = 1;
  6051.                             inputString = inputString.substring(4);
  6052.                         } else if(s.startsWith("green:"))
  6053.                         {
  6054.                             j2 = 2;
  6055.                             inputString = inputString.substring(6);
  6056.                         } else if(s.startsWith("cyan:"))
  6057.                         {
  6058.                             j2 = 3;
  6059.                             inputString = inputString.substring(5);
  6060.                         } else if(s.startsWith("purple:"))
  6061.                         {
  6062.                             j2 = 4;
  6063.                             inputString = inputString.substring(7);
  6064.                         } else if(s.startsWith("white:"))
  6065.                         {
  6066.                             j2 = 5;
  6067.                             inputString = inputString.substring(6);
  6068.                         } else if(s.startsWith("flash1:"))
  6069.                         {
  6070.                             j2 = 6;
  6071.                             inputString = inputString.substring(7);
  6072.                         } else if(s.startsWith("flash2:"))
  6073.                         {
  6074.                             j2 = 7;
  6075.                             inputString = inputString.substring(7);
  6076.                         } else if(s.startsWith("flash3:"))
  6077.                         {
  6078.                             j2 = 8;
  6079.                             inputString = inputString.substring(7);
  6080.                         } else if(s.startsWith("glow1:"))
  6081.                         {
  6082.                             j2 = 9;
  6083.                             inputString = inputString.substring(6);
  6084.                         } else if(s.startsWith("glow2:"))
  6085.                         {
  6086.                             j2 = 10;
  6087.                             inputString = inputString.substring(6);
  6088.                         } else if(s.startsWith("glow3:"))
  6089.                         {
  6090.                             j2 = 11;
  6091.                             inputString = inputString.substring(6);
  6092.                         }
  6093.                         s = inputString.toLowerCase();
  6094.                         int i3 = 0;
  6095.                         if(s.startsWith("wave:"))
  6096.                         {
  6097.                             i3 = 1;
  6098.                             inputString = inputString.substring(5);
  6099.                         } else if(s.startsWith("wave2:"))
  6100.                         {
  6101.                             i3 = 2;
  6102.                             inputString = inputString.substring(6);
  6103.                         } else if(s.startsWith("shake:"))
  6104.                         {
  6105.                             i3 = 3;
  6106.                             inputString = inputString.substring(6);
  6107.                         } else if(s.startsWith("scroll:"))
  6108.                         {
  6109.                             i3 = 4;
  6110.                             inputString = inputString.substring(7);
  6111.                         } else if(s.startsWith("slide:"))
  6112.                         {
  6113.                             i3 = 5;
  6114.                             inputString = inputString.substring(6);
  6115.                         }
  6116.                         stream.createFrame(4);
  6117.                         stream.writeWordBigEndian(0);
  6118.                         int j3 = stream.currentOffset;
  6119.                         stream.method425(i3);
  6120.                         stream.method425(j2);
  6121.                         aStream_834.currentOffset = 0;
  6122.                         TextInput.method526(inputString, aStream_834);
  6123.                         stream.method441(0, aStream_834.buffer, aStream_834.currentOffset);
  6124.                         stream.writeBytes(stream.currentOffset - j3);
  6125.                         inputString = TextInput.processText(inputString);
  6126.                         //inputString = Censor.doCensor(inputString);
  6127.                         myPlayer.textSpoken = inputString;
  6128.                         myPlayer.anInt1513 = j2;
  6129.                         myPlayer.anInt1531 = i3;
  6130.                         myPlayer.textCycle = 150;
  6131.                         if(myPrivilege == 4) {
  6132.                             pushMessage(myPlayer.textSpoken, 2, "@cr3@" + "<col=13132800>"+getRank(myPlayer.skill)+"</col>" + myPlayer.name);
  6133.                         } else if(myPrivilege == 3) {
  6134.                             pushMessage(myPlayer.textSpoken, 2, "@cr2@" + "<col=13132800>"+getRank(myPlayer.skill)+"</col>" + myPlayer.name);
  6135.                         } else if(myPrivilege == 2) {
  6136.                             pushMessage(myPlayer.textSpoken, 2, "@cr2@" + "<col=13132800>"+getRank(myPlayer.skill)+"</col>" + myPlayer.name);
  6137.                         } else if(myPrivilege == 1) {
  6138.                             pushMessage(myPlayer.textSpoken, 2, "@cr1@" + "<col=13132800>"+getRank(myPlayer.skill)+"</col>" + myPlayer.name);
  6139.                         } else {
  6140.                             pushMessage(myPlayer.textSpoken, 2, "<col=13132800>"+getRank(myPlayer.skill)+"</col>" + myPlayer.name);
  6141.                         }
  6142.                         if(publicChatMode == 2)
  6143.                         {
  6144.                             publicChatMode = 3;
  6145.                             aBoolean1233 = true;
  6146.                             stream.createFrame(95);
  6147.                             stream.writeWordBigEndian(publicChatMode);
  6148.                             stream.writeWordBigEndian(privateChatMode);
  6149.                             stream.writeWordBigEndian(tradeMode);
  6150.                         }
  6151.                     }
  6152.                     inputString = "";
  6153.                     inputTaken = true;
  6154.                 }
  6155.             }
  6156.         } while(true);
  6157.     }
  6158.     public static boolean functionKeys = true;
  6159.     public static boolean healthBars = true;
  6160.     public static boolean newDamage = true;
  6161.    
  6162.     private void buildPublicChat(int j)
  6163.     {
  6164.         int l = 0;
  6165.         for(int i1 = 0; i1 < 500; i1++)
  6166.         {
  6167.             if(chatMessages[i1] == null)
  6168.                 continue;
  6169.             if(chatTypeView != 1)
  6170.                 continue;
  6171.             int j1 = chatTypes[i1];
  6172.             String s = chatNames[i1];
  6173.             String ct = chatMessages[i1];
  6174.             int k1 = (70 - l * 14 + 42) + anInt1089 + 4 + 5;
  6175.             if(k1 < -23)
  6176.                 break;
  6177.             if(s != null && s.startsWith("@cr")) {
  6178.                 String rightID = s.substring(3,4);
  6179.                 s = s.substring(5);
  6180.             }
  6181.             if((j1 == 1 || j1 == 2) && (j1 == 1 || publicChatMode == 0 || publicChatMode == 1 && isFriendOrSelf(s))) {
  6182.             if(j > k1 - 14 && j <= k1 && !s.equals(myPlayer.name)) {
  6183.                 if(myPrivilege >= 1) {
  6184.                     menuActionName[menuActionRow] = "Staff Pannel @whi@" + s;
  6185.                     menuActionID[menuActionRow] = 606;
  6186.                     menuActionRow++;
  6187.                 }
  6188.                 menuActionName[menuActionRow] = "Add ignore" + s;
  6189.                 menuActionID[menuActionRow] = 42;
  6190.                 menuActionRow++;
  6191.                 menuActionName[menuActionRow] = "Add friend" + s;
  6192.                 menuActionID[menuActionRow] = 337;
  6193.                 menuActionRow++;
  6194.             }
  6195.             l++;
  6196.             }
  6197.         }
  6198.     }
  6199.  
  6200.     private void buildFriendChat(int j)
  6201.     {
  6202.         int l = 0;
  6203.         for(int i1 = 0; i1 < 500; i1++) {
  6204.             if(chatMessages[i1] == null)
  6205.                 continue;
  6206.             if(chatTypeView != 2)
  6207.                 continue;
  6208.             int j1 = chatTypes[i1];
  6209.             String s = chatNames[i1];
  6210.             String ct = chatMessages[i1];
  6211.             int k1 = (70 - l * 14 + 42) + anInt1089 + 4 + 5;
  6212.             if(k1 < -23)
  6213.                 break;
  6214.             if(s != null && s.startsWith("@cr")) {
  6215.                 String rightID = s.substring(3,4);
  6216.                 s = s.substring(5);
  6217.             }
  6218.             if((j1 == 5 || j1 == 6) && (splitPrivateChat == 0 || chatTypeView == 2) && (j1 == 6 || privateChatMode == 0 || privateChatMode == 1 && isFriendOrSelf(s)))
  6219.                 l++;
  6220.             if((j1 == 3 || j1 == 7) && (splitPrivateChat == 0 || chatTypeView == 2) && (j1 == 7 || privateChatMode == 0 || privateChatMode == 1 && isFriendOrSelf(s)))
  6221.             {
  6222.                 if(j > k1 - 14 && j <= k1) {
  6223.                     if(myPrivilege >= 1) {
  6224.                         menuActionName[menuActionRow] = "Staff Pannel @whi@" + s;
  6225.                         menuActionID[menuActionRow] = 606;
  6226.                         menuActionRow++;
  6227.                     }
  6228.                     menuActionName[menuActionRow] = "Add ignore" + s;
  6229.                     menuActionID[menuActionRow] = 42;
  6230.                     menuActionRow++;
  6231.                     menuActionName[menuActionRow] = "Add friend" + s;
  6232.                     menuActionID[menuActionRow] = 337;
  6233.                     menuActionRow++;
  6234.                 }
  6235.             l++;
  6236.             }
  6237.         }
  6238.     }
  6239.  
  6240.     private void buildDuelorTrade(int j) {
  6241.         int l = 0;
  6242.         for(int i1 = 0; i1 < 500; i1++) {
  6243.             if(chatMessages[i1] == null)
  6244.                 continue;
  6245.             if(chatTypeView != 3 && chatTypeView != 4)
  6246.                 continue;
  6247.             int j1 = chatTypes[i1];
  6248.             String s = chatNames[i1];
  6249.             int k1 = (70 - l * 14 + 42) + anInt1089 + 4 + 5;
  6250.             if(k1 < -23)
  6251.                 break;
  6252.             if(s != null && s.startsWith("@cr")) {
  6253.                 String rightID = s.substring(3,4);
  6254.                 s = s.substring(5);
  6255.             }
  6256.             if(chatTypeView == 3 && j1 == 4 && (tradeMode == 0 || tradeMode == 1 && isFriendOrSelf(s))) {
  6257.                 if(j > k1 - 14 && j <= k1) {
  6258.                     menuActionName[menuActionRow] = "Accept trade @whi@" + s;
  6259.                     menuActionID[menuActionRow] = 484;
  6260.                     menuActionRow++;
  6261.                 }
  6262.                 l++;
  6263.             }
  6264.             if(j1 == 9)
  6265.             {
  6266.                 if(j > k1 - 14 && j <= k1)
  6267.                 {
  6268.                     String displayLink = ((s.length() > 30) ? (s.substring(0,25) + "...") : (s));
  6269.                     menuActionName[menuActionRow] = "Open page: " + displayLink;
  6270.                     menuActionID[menuActionRow] = 485;
  6271.                     menuActionRow++;
  6272.                     linkInText = s;
  6273.                 }
  6274.                 l++;
  6275.             }
  6276.            
  6277.             if(chatTypeView == 4 && j1 == 8 && (tradeMode == 0 || tradeMode == 1 && isFriendOrSelf(s))) {
  6278.                 if(j > k1 - 14 && j <= k1) {
  6279.                     menuActionName[menuActionRow] = "Accept challenge @whi@" + s;
  6280.                     menuActionID[menuActionRow] = 6;
  6281.                     menuActionRow++;
  6282.                 }
  6283.                 l++;
  6284.             }
  6285.             if(j1 == 12) {
  6286.                 if(j > k1 - 14 && j <= k1) {
  6287.                     menuActionName[menuActionRow] = "Go-to @blu@" + s;
  6288.                     menuActionID[menuActionRow] = 915;
  6289.                     menuActionRow++;
  6290.                 }
  6291.                 l++;
  6292.             }
  6293.         }
  6294.     }
  6295.  
  6296.     private void buildChatAreaMenu(int paddingY) {
  6297.         int totalLines = 0;
  6298.         int test = 0;
  6299.         for(int typeIndex = 0; typeIndex < 500; typeIndex++) {
  6300.             if(chatMessages[typeIndex] == null)
  6301.                 continue;
  6302.             int chatType = chatTypes[typeIndex];
  6303.             int scrollYPos = (70 - totalLines * 14 + 42) + anInt1089 + 4 + 5;
  6304.             if(scrollYPos < -23)
  6305.                 break;
  6306.             String name = chatNames[typeIndex];
  6307.             String type = chatMessages[typeIndex];
  6308.             boolean flag = false;
  6309.             if(chatTypeView == 1) {
  6310.                 buildPublicChat(paddingY);
  6311.                 break;
  6312.             }
  6313.             if(chatTypeView == 2) {
  6314.                 buildFriendChat(paddingY);
  6315.                 break;
  6316.             }
  6317.             if(chatTypeView == 3 || chatTypeView == 4) {
  6318.                 buildDuelorTrade(paddingY);
  6319.                 break;
  6320.             }
  6321.             if(chatTypeView == 5) {
  6322.                 break;
  6323.             }
  6324.             if(name != null && name.startsWith("@cr")) {
  6325.                 String rightID = name.substring(3,4);
  6326.                 name = name.substring(5);
  6327.             }
  6328.             if(chatType == 0)
  6329.                 totalLines++;
  6330.             if((chatType == 1 || chatType == 2) && (chatType == 1 || publicChatMode == 0 || publicChatMode == 1 && isFriendOrSelf(name))) {
  6331.                 if(paddingY > scrollYPos - 14 && paddingY <= scrollYPos && !name.equals(myPlayer.name)) {
  6332.                     if(myPrivilege >= 1) {
  6333.                         menuActionName[menuActionRow] = "Staff Pannel @whi@" + name;
  6334.                         menuActionID[menuActionRow] = 606;
  6335.                         menuActionRow++;
  6336.                     }
  6337.                     menuActionName[menuActionRow] = "Add ignore" + name;
  6338.                     menuActionID[menuActionRow] = 42;
  6339.                     menuActionRow++;
  6340.                     menuActionName[menuActionRow] = "Add friend" + name;
  6341.                     menuActionID[menuActionRow] = 337;
  6342.                     menuActionRow++;
  6343.                 }
  6344.                 totalLines++;
  6345.             }
  6346.             if((chatType == 3 || chatType == 7) && splitPrivateChat == 0 && (chatType == 7 || privateChatMode == 0 || privateChatMode == 1 && isFriendOrSelf(name))) {
  6347.                 if(paddingY > scrollYPos - 14 && paddingY <= scrollYPos) {
  6348.                     if(myPrivilege >= 1) {
  6349.                         menuActionName[menuActionRow] = "Staff Pannel @whi@" + name;
  6350.                         menuActionID[menuActionRow] = 606;
  6351.                         menuActionRow++;
  6352.                     }
  6353.                     menuActionName[menuActionRow] = "Add ignore" + name;
  6354.                     menuActionID[menuActionRow] = 42;
  6355.                     menuActionRow++;
  6356.                     menuActionName[menuActionRow] = "Add friend" + name;
  6357.                     menuActionID[menuActionRow] = 337;
  6358.                     menuActionRow++;
  6359.                 }
  6360.                 totalLines++;
  6361.             }
  6362.             if(chatType == 4 && (tradeMode == 0 || tradeMode == 1 && isFriendOrSelf(name))) {
  6363.                 if(paddingY > scrollYPos - 14 && paddingY <= scrollYPos) {
  6364.                     menuActionName[menuActionRow] = "Accept trade @whi@" + name;
  6365.                     menuActionID[menuActionRow] = 484;
  6366.                     menuActionRow++;
  6367.                 }
  6368.                 totalLines++;
  6369.             }
  6370.             if(chatType == 9) {
  6371.                 if(paddingY > scrollYPos - 14 && paddingY <= scrollYPos) {
  6372.                     String displayLink = ((name.length() > 30) ? (name.substring(0,25) + "...") : (name));
  6373.                     menuActionName[menuActionRow] = "Open page: " + displayLink;
  6374.                     menuActionID[menuActionRow] = 485;
  6375.                     menuActionRow++;
  6376.                     linkInText = name;
  6377.                 }
  6378.                 totalLines++;
  6379.             }
  6380.             if((chatType == 5 || chatType == 6) && splitPrivateChat == 0 && privateChatMode < 2)
  6381.                 totalLines++;
  6382.             if(chatType == 8 && (tradeMode == 0 || tradeMode == 1 && isFriendOrSelf(name))) {
  6383.                 if(paddingY > scrollYPos - 14 && paddingY <= scrollYPos) {
  6384.                     menuActionName[menuActionRow] = "Accept challenge @whi@" + name;
  6385.                     menuActionID[menuActionRow] = 6;
  6386.                     menuActionRow++;
  6387.                 }
  6388.                 totalLines++;
  6389.             }
  6390.         }
  6391.     }  
  6392.    
  6393.     private void drawFriendsListOrWelcomeScreen(RSInterface class9)
  6394.     {
  6395.         int j = class9.contentType;
  6396.         if(j >= 1 && j <= 100 || j >= 701 && j <= 800)
  6397.         {
  6398.             if(j == 1 && anInt900 == 0)
  6399.             {
  6400.                 class9.message = "Loading friend list";
  6401.                 class9.atActionType = 0;
  6402.                 return;
  6403.             }
  6404.             if(j == 1 && anInt900 == 1)
  6405.             {
  6406.                 class9.message = "Connecting to friendserver";
  6407.                 class9.atActionType = 0;
  6408.                 return;
  6409.             }
  6410.             if(j == 2 && anInt900 != 2)
  6411.             {
  6412.                 class9.message = "Please wait...";
  6413.                 class9.atActionType = 0;
  6414.                 return;
  6415.             }
  6416.             int k = friendsCount;
  6417.             if(anInt900 != 2)
  6418.                 k = 0;
  6419.             if(j > 700)
  6420.                 j -= 601;
  6421.             else
  6422.                 j--;
  6423.             if(j >= k)
  6424.             {
  6425.                 class9.message = "";
  6426.                 class9.atActionType = 0;
  6427.                 return;
  6428.             } else
  6429.             {
  6430.                 class9.message = friendsList[j];
  6431.                 class9.atActionType = 1;
  6432.                 return;
  6433.             }
  6434.         }
  6435.         if(j >= 101 && j <= 200 || j >= 801 && j <= 900)
  6436.         {
  6437.             int l = friendsCount;
  6438.             if(anInt900 != 2)
  6439.                 l = 0;
  6440.             if(j > 800)
  6441.                 j -= 701;
  6442.             else
  6443.                 j -= 101;
  6444.             if(j >= l)
  6445.             {
  6446.                 class9.message = "";
  6447.                 class9.atActionType = 0;
  6448.                 return;
  6449.             }
  6450.             if(friendsNodeIDs[j] == 0)
  6451.                 class9.message = "@red@Offline";
  6452.             else if(friendsNodeIDs[j] == nodeID)
  6453.                 class9.message = "@gre@Online"/* + (friendsNodeIDs[j] - 9)*/;
  6454.             else
  6455.                 class9.message = "@red@Offline"/* + (friendsNodeIDs[j] - 9)*/;
  6456.             class9.atActionType = 1;
  6457.             return;
  6458.         }
  6459.         if(j == 203)
  6460.         {
  6461.             int i1 = friendsCount;
  6462.             if(anInt900 != 2)
  6463.                 i1 = 0;
  6464.             class9.scrollMax = i1 * 15 + 20;
  6465.             if(class9.scrollMax <= class9.height)
  6466.                 class9.scrollMax = class9.height + 1;
  6467.             return;
  6468.         }
  6469.         if(j >= 401 && j <= 500)
  6470.         {
  6471.             if((j -= 401) == 0 && anInt900 == 0)
  6472.             {
  6473.                 class9.message = "Loading ignore list";
  6474.                 class9.atActionType = 0;
  6475.                 return;
  6476.             }
  6477.             if(j == 1 && anInt900 == 0)
  6478.             {
  6479.                 class9.message = "Please wait...";
  6480.                 class9.atActionType = 0;
  6481.                 return;
  6482.             }
  6483.             int j1 = ignoreCount;
  6484.             if(anInt900 == 0)
  6485.                 j1 = 0;
  6486.             if(j >= j1)
  6487.             {
  6488.                 class9.message = "";
  6489.                 class9.atActionType = 0;
  6490.                 return;
  6491.             } else
  6492.             {
  6493.                 class9.message = TextClass.fixName(TextClass.nameForLong(ignoreListAsLongs[j]));
  6494.                 class9.atActionType = 1;
  6495.                 return;
  6496.             }
  6497.         }
  6498.         if(j == 503)
  6499.         {
  6500.             class9.scrollMax = ignoreCount * 15 + 20;
  6501.             if(class9.scrollMax <= class9.height)
  6502.                 class9.scrollMax = class9.height + 1;
  6503.             return;
  6504.         }
  6505.         if(j == 327)
  6506.         {
  6507.             class9.modelRotation1 = 150;
  6508.             class9.modelRotation2 = (int)(Math.sin((double)loopCycle / 40D) * 256D) & 0x7ff;
  6509.             if(aBoolean1031)
  6510.             {
  6511.                 for(int k1 = 0; k1 < 7; k1++)
  6512.                 {
  6513.                     int l1 = anIntArray1065[k1];
  6514.                     if(l1 >= 0 && !IDK.cache[l1].method537())
  6515.                         return;
  6516.                 }
  6517.  
  6518.                 aBoolean1031 = false;
  6519.                 Model aclass30_sub2_sub4_sub6s[] = new Model[7];
  6520.                 int i2 = 0;
  6521.                 for(int j2 = 0; j2 < 7; j2++)
  6522.                 {
  6523.                     int k2 = anIntArray1065[j2];
  6524.                     if(k2 >= 0)
  6525.                     {
  6526.                     //Model.readAndDump(IDK.cache[k2].method538().modelID);
  6527.                         aclass30_sub2_sub4_sub6s[i2++] = IDK.cache[k2].method538();
  6528.                        
  6529.                     }
  6530.                 }
  6531.  
  6532.                 Model model = new Model(i2, aclass30_sub2_sub4_sub6s);
  6533.                 for(int l2 = 0; l2 < 5; l2++)
  6534.                     if(anIntArray990[l2] != 0)
  6535.                     {
  6536.                         model.method476(anIntArrayArray1003[l2][0], anIntArrayArray1003[l2][anIntArray990[l2]]);
  6537.                         if(l2 == 1)
  6538.                             model.method476(anIntArray1204[0], anIntArray1204[anIntArray990[l2]]);
  6539.                     }
  6540.  
  6541.                 model.method469();
  6542.                 model.method470(Animation.anims[myPlayer.anInt1511].anIntArray353[0]);
  6543.                 model.method479(64, 850, -30, -50, -30, true);
  6544.                 class9.anInt233 = 5;
  6545.                 class9.mediaID = 0;
  6546.                 RSInterface.method208(aBoolean994, model);
  6547.             }
  6548.             return;
  6549.         }
  6550.         if(j == 328) {
  6551.             RSInterface rsInterface = class9;
  6552.             int verticleTilt = 150;
  6553.             int animationSpeed = (int)(Math.sin((double)loopCycle / 40D) * 256D) & 0x7ff;
  6554.             rsInterface.modelRotation1 = verticleTilt;
  6555.             rsInterface.modelRotation2 = animationSpeed;
  6556.             if(aBoolean1031) {
  6557.                 Model characterDisplay = myPlayer.method452();
  6558.                 for(int l2 = 0; l2 < 5; l2++)
  6559.                     if(anIntArray990[l2] != 0) {
  6560.                         characterDisplay.method476(anIntArrayArray1003[l2][0], anIntArrayArray1003[l2][anIntArray990[l2]]);
  6561.                         if(l2 == 1)
  6562.                             characterDisplay.method476(anIntArray1204[0], anIntArray1204[anIntArray990[l2]]);
  6563.                     }
  6564.                 int staticFrame = myPlayer.anInt1511;
  6565.                 characterDisplay.method469();
  6566.                 characterDisplay.method470(Animation.anims[staticFrame].anIntArray353[0]);
  6567.                 //characterDisplay.method479(64, 850, -30, -50, -30, true);
  6568.                 rsInterface.anInt233 = 5;
  6569.                 rsInterface.mediaID = 0;
  6570.                 RSInterface.method208(aBoolean994, characterDisplay);
  6571.             }
  6572.             return;
  6573.         }
  6574.         if(j == 324)
  6575.         {
  6576.             if(aClass30_Sub2_Sub1_Sub1_931 == null)
  6577.             {
  6578.                 aClass30_Sub2_Sub1_Sub1_931 = class9.sprite1;
  6579.                 aClass30_Sub2_Sub1_Sub1_932 = class9.sprite2;
  6580.             }
  6581.             if(aBoolean1047)
  6582.             {
  6583.                 class9.sprite1 = aClass30_Sub2_Sub1_Sub1_932;
  6584.                 return;
  6585.             } else
  6586.             {
  6587.                 class9.sprite1 = aClass30_Sub2_Sub1_Sub1_931;
  6588.                 return;
  6589.             }
  6590.         }
  6591.         if(j == 325)
  6592.         {
  6593.             if(aClass30_Sub2_Sub1_Sub1_931 == null)
  6594.             {
  6595.                 aClass30_Sub2_Sub1_Sub1_931 = class9.sprite1;
  6596.                 aClass30_Sub2_Sub1_Sub1_932 = class9.sprite2;
  6597.             }
  6598.             if(aBoolean1047)
  6599.             {
  6600.                 class9.sprite1 = aClass30_Sub2_Sub1_Sub1_931;
  6601.                 return;
  6602.             } else
  6603.             {
  6604.                 class9.sprite1 = aClass30_Sub2_Sub1_Sub1_932;
  6605.                 return;
  6606.             }
  6607.         }
  6608.         if(j == 600)
  6609.         {
  6610.             class9.message = reportAbuseInput;
  6611.             if(loopCycle % 20 < 10)
  6612.             {
  6613.                 class9.message += "|";
  6614.                 return;
  6615.             } else
  6616.             {
  6617.                 class9.message += " ";
  6618.                 return;
  6619.             }
  6620.         }
  6621.         if(j > 600 && j < 621)
  6622.         {
  6623.         int id = j-601;
  6624.         String[] mod_options = {
  6625.         "Moderator Options:",
  6626.         "Mute user",
  6627.         "Un-Mute user",
  6628.         "Jail user",
  6629.         "Un-Jail user",
  6630.         "Ban user",
  6631.         "Un-Ban user"
  6632.         };
  6633.         String[] admin_options = {
  6634.         "Admin Options:",
  6635.         "Mute users IP",
  6636.         "Un-Mute users IP",
  6637.         "Ban users IP",
  6638.         "Un-Ban users IP",
  6639.         };
  6640.         if(id < mod_options.length)
  6641.             if(id == 0)
  6642.                 class9.message = mod_options[id];
  6643.             else
  6644.                 class9.message = (id)+": "+mod_options[id];
  6645.         else if(id < mod_options.length+admin_options.length && myPrivilege > 1)
  6646.             if(id-mod_options.length == 0)
  6647.                 class9.message = admin_options[id-mod_options.length];
  6648.             else
  6649.                 class9.message = (id-mod_options.length)+": "+admin_options[id-mod_options.length];
  6650.         }
  6651.         if(j == 650 || j == 655)
  6652.             if(anInt1193 != 0)
  6653.             {
  6654.                 String s;
  6655.                 if(daysSinceLastLogin == 0)
  6656.                     s = "earlier today";
  6657.                 else
  6658.                 if(daysSinceLastLogin == 1)
  6659.                     s = "yesterday";
  6660.                 else
  6661.                     s = daysSinceLastLogin + " days ago";
  6662.                 class9.message = "You last logged in " + s + " from: " + signlink.dns;
  6663.             } else
  6664.             {
  6665.                 class9.message = "";
  6666.             }
  6667.         if(j == 651)
  6668.         {
  6669.             if(unreadMessages == 0)
  6670.             {
  6671.                 class9.message = "0 unread messages";
  6672.                 class9.textColor = 0xffff00;
  6673.             }
  6674.             if(unreadMessages == 1)
  6675.             {
  6676.                 class9.message = "1 unread message";
  6677.                 class9.textColor = 65280;
  6678.             }
  6679.             if(unreadMessages > 1)
  6680.             {
  6681.                 class9.message = unreadMessages + " unread messages";
  6682.                 class9.textColor = 65280;
  6683.             }
  6684.         }
  6685.         if(j == 652)
  6686.             if(daysSinceRecovChange == 201)
  6687.             {
  6688.                 if(membersInt == 1)
  6689.                     class9.message = "@yel@This is a non-members world: @whi@Since you are a member we";
  6690.                 else
  6691.                     class9.message = "";
  6692.             } else
  6693.             if(daysSinceRecovChange == 200)
  6694.             {
  6695.                 class9.message = "You have not yet set any password recovery questions.";
  6696.             } else
  6697.             {
  6698.                 String s1;
  6699.                 if(daysSinceRecovChange == 0)
  6700.                     s1 = "Earlier today";
  6701.                 else
  6702.                 if(daysSinceRecovChange == 1)
  6703.                     s1 = "Yesterday";
  6704.                 else
  6705.                     s1 = daysSinceRecovChange + " days ago";
  6706.                 class9.message = s1 + " you changed your recovery questions";
  6707.             }
  6708.         if(j == 653)
  6709.             if(daysSinceRecovChange == 201)
  6710.             {
  6711.                 if(membersInt == 1)
  6712.                     class9.message = "@whi@recommend you use a members world instead. You may use";
  6713.                 else
  6714.                     class9.message = "";
  6715.             } else
  6716.             if(daysSinceRecovChange == 200)
  6717.                 class9.message = "We strongly recommend you do so now to secure your account.";
  6718.             else
  6719.                 class9.message = "If you do not remember making this change then cancel it immediately";
  6720.         if(j == 654)
  6721.         {
  6722.             if(daysSinceRecovChange == 201)
  6723.                 if(membersInt == 1)
  6724.                 {
  6725.                     class9.message = "@whi@this world but member benefits are unavailable whilst here.";
  6726.                     return;
  6727.                 } else
  6728.                 {
  6729.                     class9.message = "";
  6730.                     return;
  6731.                 }
  6732.             if(daysSinceRecovChange == 200)
  6733.             {
  6734.                 class9.message = "Do this from the 'account management' area on our front webpage";
  6735.                 return;
  6736.             }
  6737.             class9.message = "Do this from the 'account management' area on our front webpage";
  6738.         }
  6739.     }
  6740.  
  6741.     private void drawSplitPrivateChat(int paddingX, int paddingY) {
  6742.         if(splitPrivateChat == 0)
  6743.             return;
  6744.         TextDrawingArea textdrawingarea = normalFont;
  6745.         int i = 0 ;
  6746.         if(systemUpdatetime != 0)
  6747.             i = 1;
  6748.         for(int j = 0; j < 100; j++)
  6749.             if(chatMessages[j] != null)
  6750.             {
  6751.                 int k = chatTypes[j];
  6752.                 String s = chatNames[j];
  6753.                 byte byte1 = 0;
  6754.                 if(s != null && s.startsWith("@cr")) {
  6755.                     String rightID = s.substring(3,4);
  6756.                     s = s.substring(5);
  6757.                     byte1 = (byte)Integer.parseInt(rightID);
  6758.                 }
  6759.             if((k == 3 || k == 7) && (k == 7 || privateChatMode == 0 || privateChatMode == 1 && isFriendOrSelf(s)))
  6760.             {
  6761.                 int l = (329 + paddingY) - i * 13;
  6762.                 int k1 = 4;
  6763.                 textdrawingarea.method385(0, "From", l, k1);
  6764.                 textdrawingarea.method385(65535, "From", l - 1, k1);
  6765.                 k1 += textdrawingarea.getTextWidth("From ");
  6766.                 if(byte1 > 0) {
  6767.                 if(byte1-1 > 2) {
  6768.                     return; //Fixes crash
  6769.                 }
  6770.                     modIcons[byte1-1].drawBackground(k1, l - 12);
  6771.                     k1 += 14;
  6772.                 }
  6773.                 textdrawingarea.method385(0, s + ": " + chatMessages[j], l, k1);
  6774.                 textdrawingarea.method385(65535, s + ": " + chatMessages[j], l - 1, k1);
  6775.                 if(++i >= 5)
  6776.                     return;
  6777.             }
  6778.             if(k == 5 && privateChatMode < 2)
  6779.             {
  6780.                 try
  6781.                 {
  6782.                     int i1 = (329 + paddingY) - i * 13;
  6783.                     textdrawingarea.method385(0, chatMessages[j], i1, 4);
  6784.                     textdrawingarea.method385(65535, chatMessages[j], i1 - 1, 4);
  6785.                     if(++i >= 5)
  6786.                         return;
  6787.                 } catch(ArrayIndexOutOfBoundsException ex) {
  6788.                    
  6789.                 }
  6790.             }
  6791.             if(k != 6 || privateChatMode >= 2)
  6792.                 continue;
  6793.             int j1 = (329 + paddingY) - i * 13;
  6794.             textdrawingarea.method385(0, "To " + s + ": " + chatMessages[j], j1, 4);
  6795.             textdrawingarea.method385(65535, "To " + s + ": " + chatMessages[j], j1 - 1, 4);
  6796.             if(++i >= 5)
  6797.                 return;
  6798.         }
  6799.  
  6800.     }
  6801.    
  6802.     public void pushMessage(String s, int i, String s1) {
  6803.         if(i == 0 && dialogID != -1) {
  6804.             aString844 = s;
  6805.             super.clickMode3 = 0;
  6806.         }
  6807.         if(backDialogID == -1)
  6808.             inputTaken = true;
  6809.         for(int j = 499; j > 0; j--) {
  6810.             chatTypes[j] = chatTypes[j - 1];
  6811.             chatNames[j] = chatNames[j - 1];
  6812.             chatMessages[j] = chatMessages[j - 1];
  6813.             chatRights[j] = chatRights[j - 1];
  6814.         }
  6815.         chatTypes[0] = i;
  6816.         chatNames[0] = s1;
  6817.         chatMessages[0] = s;
  6818.         chatRights[0] = rights;
  6819.     }
  6820.    
  6821.     static int focusTab = 3;
  6822.     public static void setTab(int id) {
  6823.         if(focusTab == id && toggleFullscreen)
  6824.             focusTab = -1;
  6825.         else
  6826.             focusTab = id;
  6827.         needDrawTabArea = true;
  6828.         tabID = id;
  6829.         tabAreaAltered = true;
  6830.     }
  6831.    
  6832.     private void processTabClick(int paddingX, int paddingY) {
  6833.         if(invOverlayInterfaceID == -1) {
  6834.             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) {
  6835.                 //setTab(0);
  6836.                 menuActionName[1] = "Combat Styles";
  6837.                 menuActionID[1] = 1011;
  6838.                 menuActionRow = 2;
  6839.                 tabIDHover = 0;
  6840.             } 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) {
  6841.                 //setTab(14);
  6842.                 menuActionName[1] = "New Skills";
  6843.                 menuActionID[1] = 1042;//needs changing.
  6844.                 menuActionRow = 2;
  6845.                 tabIDHover = 1;
  6846.             } 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) {
  6847.                 //setTab(1);
  6848.                 menuActionName[1] = "Stats";
  6849.                 menuActionID[1] = 1012;
  6850.                 menuActionRow = 2;
  6851.                 tabIDHover = 2;
  6852.             } 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) {
  6853.                 //setTab(2);
  6854.                 menuActionName[1] = "Quest Journals";
  6855.                 menuActionID[1] = 1013;
  6856.                 menuActionRow = 2;
  6857.                 tabIDHover = 3;
  6858.             } 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) {
  6859.                 //setTab(3);
  6860.                 menuActionName[1] = "Inventory";
  6861.                 menuActionID[1] = 1014;
  6862.                 menuActionRow = 2;
  6863.                 tabIDHover = 4;
  6864.             } 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) {
  6865.                 //setTab(4);
  6866.                 menuActionName[1] = "Worn Equipment";
  6867.                 menuActionID[1] = 1015;
  6868.                 menuActionRow = 2;
  6869.                 tabIDHover = 5;
  6870.             } 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) {
  6871.                 //setTab(5);
  6872.                 menuActionName[1] = "Prayer List";
  6873.                 menuActionID[1] = 1016;
  6874.                 menuActionRow = 2;
  6875.                 tabIDHover = 6;
  6876.             } 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) {
  6877.                 //setTab(6);
  6878.                 menuActionName[1] = "Magic Spellbook";
  6879.                 menuActionID[1] = 1017;
  6880.                 menuActionRow = 2;
  6881.                 tabIDHover = 7;
  6882.             } else if(super.mouseX >= 522 + paddingX && super.mouseX <= 551 + paddingX && super.mouseY >= 466 + paddingY && super.mouseY < 503 + paddingY && tabInterfaceIDs[16] != -1) {
  6883.                 //setTab(16);
  6884.                 menuActionName[1] = "Summoning";
  6885.                 menuActionID[1] = 1043;
  6886.                 menuActionRow = 2;
  6887.                 tabIDHover = 14;
  6888.             } else if(super.mouseX >= 552 + paddingX && super.mouseX <= 581 + paddingX && super.mouseY >= 466 + paddingY && super.mouseY < 503 + paddingY && tabInterfaceIDs[8] != -1) {
  6889.                 //setTab(8);
  6890.                 menuActionName[1] = "Friends List";
  6891.                 menuActionID[1] = 1019;
  6892.                 menuActionRow = 2;
  6893.                 tabIDHover = 8;
  6894.             } else if(super.mouseX >= 582 + paddingX && super.mouseX <= 611 + paddingX && super.mouseY >= 466 + paddingY && super.mouseY < 503 + paddingY && tabInterfaceIDs[9] != -1) {
  6895.                 //setTab(9);
  6896.                 menuActionName[1] = "Ignore List";
  6897.                 menuActionID[1] = 1020;
  6898.                 menuActionRow = 2;
  6899.                 tabIDHover = 9;
  6900.             } else if(super.mouseX >= 612 + paddingX && super.mouseX <= 641 + paddingX && super.mouseY >= 466 + paddingY && super.mouseY < 503 + paddingY && tabInterfaceIDs[7] != -1) {
  6901.                 //setTab(7);
  6902.                 menuActionName[1] = "Clan Chat";
  6903.                 menuActionID[1] = 1018;
  6904.                 menuActionRow = 2;
  6905.                 tabIDHover = 10;
  6906.             } else if(super.mouseX >= 642 + paddingX && super.mouseX <= 671 + paddingX && super.mouseY >= 466 + paddingY && super.mouseY < 503 + paddingY && tabInterfaceIDs[11] != -1) {
  6907.                 //setTab(11);
  6908.                 menuActionName[1] = "Options";
  6909.                 menuActionID[1] = 1022;
  6910.                 menuActionRow = 2;
  6911.                 tabIDHover = 11;
  6912.             } else if(super.mouseX >= 672 + paddingX && super.mouseX <= 701 + paddingX && super.mouseY >= 466 + paddingY && super.mouseY < 503 + paddingY && tabInterfaceIDs[12] != -1) {
  6913.                 //setTab(12);
  6914.                 menuActionName[1] = "Emotes";
  6915.                 menuActionID[1] = 1023;
  6916.                 menuActionRow = 2;
  6917.                 tabIDHover = 12;
  6918.             } else if(super.mouseX >= 702 + paddingX && super.mouseX <= 731 + paddingX && super.mouseY >= 466 + paddingY && super.mouseY < 502 + paddingY && tabInterfaceIDs[13] != -1) {
  6919.                 //setTab(13);
  6920.                 menuActionName[1] = "Construction";
  6921.                 menuActionID[1] = 1024;
  6922.                 menuActionRow = 2;
  6923.                 tabIDHover = 13;
  6924.             } else if(super.mouseX >= 732 + paddingX && super.mouseX <= 761 + paddingX && super.mouseY >= 466 + paddingY && super.mouseY < 502 + paddingY && tabInterfaceIDs[15] != -1) {
  6925.                 //setTab(15);
  6926.                 menuActionName[1] = "Information";
  6927.                 menuActionID[1] = 1044;
  6928.                 menuActionRow = 2;
  6929.                 tabIDHover = 15;
  6930.             } else {
  6931.                 tabIDHover = -1;
  6932.                 needDrawTabArea = true;
  6933.                 tabAreaAltered = true;
  6934.             }
  6935.         }
  6936.     }
  6937.  
  6938.     private void resetImageProducers2() {
  6939.         if(chatBackImage != null)
  6940.             return;
  6941.         nullLoader();
  6942.         rightFrame = null;
  6943.         super.fullGameScreen = null;
  6944.         aRSImageProducer_1107 = null;
  6945.         aRSImageProducer_1108 = null;
  6946.         aRSImageProducer_1109 = null;
  6947.         aRSImageProducer_1110 = null;
  6948.         aRSImageProducer_1111 = null;
  6949.         aRSImageProducer_1112 = null;
  6950.         aRSImageProducer_1113 = null;
  6951.         aRSImageProducer_1114 = null;
  6952.         aRSImageProducer_1115 = null;
  6953.         chatBackImage = new RSImageProducer(xPaddingtabBack, yPaddingtabBack, getGameComponent());
  6954.         mapBackImage = new RSImageProducer(miniMapWidth, miniMapHeight, getGameComponent());
  6955.         DrawingArea.setAllPixelsToZero();
  6956.         mapBack[0].drawBackground(0, 0);
  6957.         rightFrame = new RSImageProducer(3, 170, getGameComponent());
  6958.         sideTabArea = new RSImageProducer(246, 335, getGameComponent());
  6959.         main3DArea = new RSImageProducer(512, 334, getGameComponent());
  6960.         DrawingArea.setAllPixelsToZero();
  6961.         aRSImageProducer_1123 = new RSImageProducer(496, 50, getGameComponent());
  6962.         aRSImageProducer_1124 = new RSImageProducer(269, 37, getGameComponent());
  6963.         aRSImageProducer_1125 = new RSImageProducer(249, 45, getGameComponent());
  6964.         welcomeScreenRaised = true;
  6965.     }
  6966.  
  6967.     public String getDocumentBaseHost() {
  6968.         if (signlink.mainapp != null) {
  6969.             return signlink.mainapp.getDocumentBase().getHost().toLowerCase();
  6970.         }
  6971.         if (super.gameFrame != null) {
  6972.             return ""; // runescape.com <- removed for Jframe to work
  6973.         } else {
  6974.             return ""; // super.getDocumentBase().getHost().toLowerCase() <- removed for Jframe to work
  6975.         }
  6976.     }
  6977.  
  6978.     private void drawMapSprites(Sprite sprite, int x, int y) {
  6979.     if (sprite == null)
  6980.     return;
  6981.         try {
  6982.             int xPadding = 0, yPadding = 0;
  6983.             if(toggleFullscreen) {
  6984.                 xPadding = xPaddingmapBackImage + getMapIncreaseX();
  6985.                 yPadding = yPaddingmapBackImage + getMapIncreaseY();
  6986.             }
  6987.             int rotation = compassRotation + mapAmtDiffRotation & 0x7ff;
  6988.             int distance = x * x + y * y;
  6989.             if(distance > 6400)
  6990.                 return;
  6991.             int spriteX = (Model.modelIntArray1[rotation] * 256) / (mapAmtDiffZoom + 256);
  6992.             int spriteY = (Model.modelIntArray2[rotation] * 256) / (mapAmtDiffZoom + 256);
  6993.             int drawX = y * spriteX + x * spriteY >> 16;
  6994.             int drawY = y * spriteY - x * spriteX >> 16;
  6995.             int finalX = ((mapSpritesX + drawX) - sprite.maxWidth / 2) + 4;
  6996.             int finalY = ((mapSpritesY - drawY) - sprite.maxHeight / 2) - 4;//86
  6997.             //if(distance > 2500) {
  6998.                 //sprite.drawWithinSprite(finalX, finalY, (toggleFullscreen ? miniMapBack[2] : miniMapBack[1]));
  6999.             //} else {
  7000.                 sprite.drawSprite(finalX + xPadding, finalY + yPadding);
  7001.             //}
  7002.         } catch(ArrayIndexOutOfBoundsException ex) {
  7003.            
  7004.         }
  7005.     }
  7006.    
  7007.     private void drawMapArrows(Sprite sprite, int x, int y) {
  7008.         int distance = x * x + y * y;
  7009.         int xPadding = 0, yPadding = 0;
  7010.         if(toggleFullscreen) {
  7011.             xPadding = xPaddingmapBackImage + getMapIncreaseX();
  7012.             yPadding = yPaddingmapBackImage + getMapIncreaseY();
  7013.         }
  7014.         if(distance > 4225 && distance < 90000) {
  7015.             int mapRotation = compassRotation + mapAmtDiffRotation & 0x7ff;
  7016.             int spriteX = (Model.modelIntArray1[mapRotation] * 256) / (mapAmtDiffZoom + 256);
  7017.             int spriteY = (Model.modelIntArray2[mapRotation] * 256) / (mapAmtDiffZoom + 256);
  7018.             int drawX = y * spriteX + x * spriteY >> 16;
  7019.             int drawY = y * spriteY - x * spriteX >> 16;
  7020.             double spriteRotation = Math.atan2(drawX, drawY);
  7021.             int finalX = (int)(Math.sin(spriteRotation) * 63D);
  7022.             int finalY = (int)(Math.cos(spriteRotation) * 57D);
  7023.             //mapEdge.drawRotatableSprite((mapSpritesX + finalX + 4) - 10,mapSpritesY - finalY - 20,  spriteRotation);
  7024.         } else {
  7025.             drawMapSprites(sprite, x + xPadding, y + yPadding);
  7026.         }
  7027.     }
  7028.    
  7029.     public boolean isInArea(int clickX, int clickY, int width, int height)
  7030.     {
  7031.         if(super.mouseX > clickX && super.mouseY > clickY && super.mouseX < clickX + width && super.mouseY < clickY + height)
  7032.             return true;
  7033.         else
  7034.             return false;
  7035.     }
  7036.    
  7037.     public boolean clickInArea(int clickX, int clickY, int width, int height)
  7038.     {
  7039.         if(super.saveClickX > clickX && super.saveClickY > clickY && super.saveClickX < clickX + width && super.saveClickY < clickY + height)
  7040.             return true;
  7041.         else
  7042.             return false;
  7043.     }
  7044.  
  7045.     public boolean inCircle(int circleX, int circleY, int radius)
  7046.     {
  7047.         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);
  7048.     }
  7049.    
  7050.     private void rightClickMapArea(int paddingX, int paddingY) {
  7051.                 if(!coinToggle){
  7052.             if (super.mouseX >= 512 && super.mouseX <= 546 && super.mouseY >= 87 && super.mouseY <= 118) {
  7053.                 menuActionName[4] = coinToggle ? "Toggle money pouch" : "Toggle money pouch";
  7054.                 menuActionID[4] = 712;
  7055.                 menuActionName[3] = "Withdraw money pouch";
  7056.                 menuActionID[3] = 713;
  7057.                 menuActionName[2] = "Examine money pouch";
  7058.                 menuActionID[2] = 714;
  7059.                 menuActionName[1] = "Price checker";
  7060.                 menuActionID[1] = 715;
  7061.                 menuActionRow = 5;
  7062.             }
  7063.         } else if(coinToggle){
  7064.             if (super.mouseX >= 436 && super.mouseX <= 546 && super.mouseY >= 87 && super.mouseY <= 118) {
  7065.                 menuActionName[4] = coinToggle ? "Toggle money pouch" : "Toggle money pouch";
  7066.                 menuActionID[4] = 712;
  7067.                 menuActionName[3] = "Withdraw money pouch";
  7068.                 menuActionID[3] = 713;
  7069.                 menuActionName[2] = "Examine money pouch";
  7070.                 menuActionID[2] = 714;
  7071.                 menuActionName[1] = "Price checker";
  7072.                 menuActionID[1] = 715;
  7073.                 menuActionRow = 5;
  7074.             }
  7075.         }
  7076.  
  7077.         if(!contextMenuOpen) {
  7078.             processXPCounterClick(getMapIncreaseX(),getMapIncreaseY());
  7079.             if(isInArea(xPaddingmapBackImage + (toggleFullscreen ? 207-52 : 207) + paddingX,0 + paddingY,21,21)) {
  7080.                 menuActionName[menuActionRow] = "Advisor";
  7081.                 menuActionID[menuActionRow] = 1051;
  7082.                 menuActionRow++;
  7083.                 advisorHover = (super.clickMode2 == 1) ? 2: 1;
  7084.             } else {
  7085.                 advisorHover = 0;
  7086.             }
  7087.             if(isInArea(xPaddingmapBackImage + (toggleFullscreen ? 228-52 : 228) + paddingX,0 + paddingY,21,21) && (tabInterfaceIDs[10] != -1 && invOverlayInterfaceID == -1)) {
  7088.                 menuActionName[menuActionRow] = "Exit";
  7089.                 menuActionID[menuActionRow] = 1021;
  7090.                 menuActionRow++;
  7091.                 exitHover = (super.clickMode2 == 1) ? 2: 1;
  7092.             } else {
  7093.                 exitHover = 0;
  7094.             }
  7095.             if(isInArea(xPaddingmapBackImage + (toggleFullscreen ? -44 : 145) + mapMovedX + paddingX,yPaddingmapBackImage + (toggleFullscreen ? 38 : 10) + mapMovedY + paddingY,57,34) && orbToggle[0]) {
  7096.                 menuActionName[menuActionRow] = "Use cure (p)";
  7097.                 menuActionID[menuActionRow] = 1052;
  7098.                 menuActionRow++;
  7099.                 orbHover = 0;
  7100.             } else if(isInArea(xPaddingmapBackImage + (toggleFullscreen ? -47 : 161) + mapMovedX + paddingX,yPaddingmapBackImage + (toggleFullscreen ? 72 : 49) + mapMovedY + paddingY,57,34)) {
  7101.                 String prayerType = (prayerInterfaceType == 5608) ? "prayers" : "curses";
  7102.                 boolean inProcess = (tabInterfaceIDs[5] == 17200 || tabInterfaceIDs[5] == 17234);
  7103.                 menuActionName[menuActionRow] = (inProcess ? "Finish" : "Select") + " " + "quick " + prayerType + (inProcess ? " selection" : "");
  7104.                 menuActionID[menuActionRow] = 1046;
  7105.                 menuActionRow++;
  7106.                 menuActionName[menuActionRow] = "Turn quick " + prayerType + " " + (orbToggle[1] ? "off" : "on");
  7107.                 menuActionID[menuActionRow] = 1045;
  7108.                 menuActionRow++;
  7109.                 orbHover = 1;
  7110.             } else if(isInArea(xPaddingmapBackImage + (toggleFullscreen ? -35 : 161) + mapMovedX + paddingX,yPaddingmapBackImage + (toggleFullscreen ? 106 : 88) + mapMovedY + paddingY,57,34)) {
  7111.                 menuActionName[menuActionRow] = "Rest";
  7112.                 menuActionID[menuActionRow] = 1048;
  7113.                 menuActionRow++;
  7114.                 menuActionName[menuActionRow] = "Turn run mode " + (orbToggle[2] ? "off" : "on");
  7115.                 menuActionID[menuActionRow] = 1047;
  7116.                 menuActionRow++;
  7117.                 orbHover = 2;
  7118.             } else if(isInArea(xPaddingmapBackImage + (toggleFullscreen ? -12 : 145) + mapMovedX + paddingX,yPaddingmapBackImage + (toggleFullscreen ? 135 : 127) + mapMovedY + paddingY,57,34)) {
  7119.                 menuActionName[menuActionRow] = "Select left-click option";
  7120.                 menuActionID[menuActionRow] = 1053;
  7121.                 menuActionRow++;
  7122.                 menuActionName[menuActionRow] = "Call Follower";
  7123.                 menuActionID[menuActionRow] = 1054;
  7124.                 menuActionRow++;
  7125.                 menuActionName[menuActionRow] = "Dismiss";
  7126.                 menuActionID[menuActionRow] = 1055;
  7127.                 menuActionRow++;
  7128.                 menuActionName[menuActionRow] = "Take BoB";
  7129.                 menuActionID[menuActionRow] = 1056;
  7130.                 menuActionRow++;
  7131.                 menuActionName[menuActionRow] = "Renew Familiar";
  7132.                 menuActionID[menuActionRow] = 1057;
  7133.                 menuActionRow++;
  7134.                 menuActionName[menuActionRow] = "Attack";
  7135.                 menuActionID[menuActionRow] = 1058;
  7136.                 menuActionRow++;
  7137.                 menuActionName[menuActionRow] = "Follower Details";
  7138.                 menuActionID[menuActionRow] = 1059;
  7139.                 menuActionRow++;
  7140.                 orbHover = 3;
  7141.             } else {
  7142.                 if(orbHover != -1)
  7143.                     orbHover = -1;
  7144.             }
  7145.             if(inCircle(xPaddingmapBackImage + (toggleFullscreen ? 30 : 11) + paddingX,yPaddingmapBackImage + (toggleFullscreen ? 9 : 8) + paddingY,17)) {
  7146.                 menuActionName[menuActionRow] = "Face north";
  7147.                 menuActionID[menuActionRow] = 1049;
  7148.                 menuActionRow++;
  7149.             }
  7150.             if(inCircle((toggleFullscreen ? 670 : 526) + paddingX,(toggleFullscreen ? 138 : 124),17)) {
  7151.                 menuActionName[menuActionRow] = "Vote4Cash";
  7152.                 //menuActionName[menuActionRow] = "World map";
  7153.                 menuActionID[menuActionRow] = 1050;
  7154.                 menuActionRow++;
  7155.                 mapHover = 1;
  7156.             } else {
  7157.                 mapHover = 0;
  7158.             }
  7159.         }
  7160.     }
  7161.  
  7162.     private void processChatButtonClick(int paddingX, int paddingY)
  7163.     {
  7164.         if(super.mouseX >= 5 + paddingX && super.mouseX <= 61 + paddingX && super.mouseY >= 482 + paddingY && super.mouseY <= 503 + paddingY)
  7165.         {
  7166.             menuActionName[menuActionRow] = "View All";
  7167.             menuActionID[menuActionRow] = 999;
  7168.             menuActionRow++;
  7169.         } else if(super.mouseX >= 71 + paddingX && super.mouseX <= 127 + paddingX && super.mouseY >= 482 + paddingY && super.mouseY <= 503 + paddingY)
  7170.         {
  7171.             menuActionName[menuActionRow] = "View Game";
  7172.             menuActionID[menuActionRow] = 998;
  7173.             menuActionRow++;
  7174.         } else if(super.mouseX >= 137 + paddingX && super.mouseX <= 193 + paddingX && super.mouseY >= 482 + paddingY && super.mouseY <= 503 + paddingY)
  7175.         {
  7176.             menuActionName[menuActionRow] = "Hide public";
  7177.             menuActionID[menuActionRow] = 997;
  7178.             menuActionRow++;
  7179.             menuActionName[menuActionRow] = "Off public";
  7180.             menuActionID[menuActionRow] = 996;
  7181.             menuActionRow++;
  7182.             menuActionName[menuActionRow] = "Friends public";
  7183.             menuActionID[menuActionRow] = 995;
  7184.             menuActionRow++;
  7185.             menuActionName[menuActionRow] = "On public";
  7186.             menuActionID[menuActionRow] = 994;
  7187.             menuActionRow++;
  7188.             menuActionName[menuActionRow] = "View public";
  7189.             menuActionID[menuActionRow] = 993;
  7190.             menuActionRow++;
  7191.         } else if(super.mouseX >= 203 + paddingX && super.mouseX <= 259 + paddingX && super.mouseY >= 482 + paddingY && super.mouseY <= 503 + paddingY)
  7192.         {
  7193.             menuActionName[menuActionRow] = "Off private";
  7194.             menuActionID[menuActionRow] = 992;
  7195.             menuActionRow++;
  7196.             menuActionName[menuActionRow] = "Friends private";
  7197.             menuActionID[menuActionRow] = 991;
  7198.             menuActionRow++;
  7199.             menuActionName[menuActionRow] = "On private";
  7200.             menuActionID[menuActionRow] = 990;
  7201.             menuActionRow++;
  7202.             menuActionName[menuActionRow] = "View private";
  7203.             menuActionID[menuActionRow] = 989;
  7204.             menuActionRow++;
  7205.         } else if(super.mouseX >= 269 + paddingX && super.mouseX <= 325 + paddingX && super.mouseY >= 482 + paddingY && super.mouseY <= 503 + paddingY)
  7206.         {
  7207.             menuActionName[menuActionRow] = "Off clan chat";
  7208.             menuActionID[menuActionRow] = 1003;
  7209.             menuActionRow++;
  7210.             menuActionName[menuActionRow] = "Friends clan chat";
  7211.             menuActionID[menuActionRow] = 1002;
  7212.             menuActionRow++;
  7213.             menuActionName[menuActionRow] = "On clan chat";
  7214.             menuActionID[menuActionRow] = 1001;
  7215.             menuActionRow++;
  7216.             menuActionName[menuActionRow] = "View clan chat";
  7217.             menuActionID[menuActionRow] = 1000;
  7218.             menuActionRow++;
  7219.         } else if(super.mouseX >= 335 + paddingX && super.mouseX <= 391 + paddingX && super.mouseY >= 482 + paddingY && super.mouseY <= 503 + paddingY)
  7220.         {
  7221.             menuActionName[menuActionRow] = "Off trade";
  7222.             menuActionID[menuActionRow] = 987;
  7223.             menuActionRow++;
  7224.             menuActionName[menuActionRow] = "Friends trade";
  7225.             menuActionID[menuActionRow] = 986;
  7226.             menuActionName[menuActionRow] = "On trade";
  7227.             menuActionID[menuActionRow] = 985;
  7228.             menuActionRow++;
  7229.             menuActionName[menuActionRow] = "View trade";
  7230.             menuActionID[menuActionRow] = 984;
  7231.             menuActionRow++;
  7232.         } else if(super.mouseX >= 404 && super.mouseX <= 514 && super.mouseY >= 480 + paddingY && super.mouseY <= 501 + paddingY) {
  7233.             menuActionName[menuActionRow] = "Staff Pannel";
  7234.             menuActionID[menuActionRow] = 606;
  7235.             menuActionRow++;
  7236.         }
  7237.     }
  7238.  
  7239.     public void processRightClick() {
  7240.         if (activeInterfaceType != 0) {
  7241.             return;
  7242.         }
  7243.         menuActionName[0] = "Cancel";
  7244.         menuActionID[0] = 1107;
  7245.         menuActionRow = 1;
  7246.         if (fullscreenInterfaceID != -1) {
  7247.             hoverChildId = 0;
  7248.             hoverToggleChildId = 0;
  7249.             buildInterfaceMenu(8, RSInterface.interfaceCache[fullscreenInterfaceID], super.mouseX, 8, super.mouseY, 0);
  7250.             if (hoverChildId != lastHoverChildId) {
  7251.                 lastHoverChildId = hoverChildId;
  7252.             }
  7253.             if (hoverToggleChildId != lastHoverToggleChildId) {
  7254.                 lastHoverToggleChildId = hoverToggleChildId;
  7255.             }
  7256.             return;
  7257.         }
  7258.         buildSplitPrivateChatMenu(0,getChatBackIncreaseY());
  7259.         hoverChildId = 0;
  7260.         hoverToggleChildId = 0;
  7261.         int width = toggleFullscreen ? getScreenWidth() : 516;
  7262.         int height = toggleFullscreen ? getScreenHeight() : 338;   
  7263.         if (super.mouseX > 0 && super.mouseY > 0 && super.mouseX < width && super.mouseY < height
  7264.         && !(!toggleFullscreen && super.mouseX > 519 + getTabIncreaseX() && super.mouseY > 168 + getTabIncreaseY() && super.mouseX < 519 + 246 + getTabIncreaseX() && super.mouseY < 168 + 335 + getTabIncreaseY())//Is not in inventory
  7265.         && !(toggleFullscreen && focusTab != -1
  7266.         //X end and Y start
  7267.         && super.mouseX > (45-23 + xPaddingtabBack + getTabIncreaseX())
  7268.         && super.mouseY > (55-23-46 + yPaddingtabBack + getTabIncreaseY())
  7269.         && super.mouseX < (45-23 + xPaddingtabBack + getTabIncreaseX() + 204)
  7270.         && super.mouseY < (55-23-46 + yPaddingtabBack + getTabIncreaseY() + 275)
  7271.         )//Is not in inventory
  7272.         && !(super.mouseX > 0 && super.mouseY > 338 + getChatBackIncreaseY() && super.mouseX < 517 && super.mouseY < 503 + getChatBackIncreaseY())//Is not in chat area
  7273.         && !(super.mouseX > xPaddingmapBackImage + getMapIncreaseX() + (toggleFullscreen ? -25 : 0) && super.mouseY > 0 && super.mouseX < xPaddingmapBackImage + getMapIncreaseX() + 249 && super.mouseY < yPaddingmapBackImage + getMapIncreaseY() + 168)//Is not in map
  7274.         ) {
  7275.             if (openInterfaceID != -1) {
  7276.                 RSInterface rsInterface = RSInterface.interfaceCache[openInterfaceID];
  7277.                 if(toggleFullscreen) {
  7278.                     int interfaceWidth = toggleFullscreen ? getScreenWidth() : 516;
  7279.                     int interfaceHeight = toggleFullscreen ? getScreenHeight() : 338;
  7280.                     buildInterfaceMenu(4 + (interfaceWidth - rsInterface.width) / 2, rsInterface, super.mouseX, 4 + (interfaceHeight - rsInterface.height) / 2, super.mouseY, 0);
  7281.                 } else
  7282.                     buildInterfaceMenu(4, rsInterface, super.mouseX, 4, super.mouseY, 0);
  7283.             } else {
  7284.                 build3dScreenMenu();
  7285.             }
  7286.         }
  7287.         if (hoverChildId != lastHoverChildId) {
  7288.             lastHoverChildId = hoverChildId;
  7289.         }
  7290.         if (hoverToggleChildId != lastHoverToggleChildId) {
  7291.             lastHoverToggleChildId = hoverToggleChildId;
  7292.         }
  7293.         hoverChildId = 0;
  7294.         hoverToggleChildId = 0;
  7295.         if(super.mouseX > 548 + getTabIncreaseX() && super.mouseY > 207 - (toggleFullscreen ? 46 : 0) + getTabIncreaseY() && super.mouseX < 740 + getTabIncreaseX() && super.mouseY < 468 + getTabIncreaseY()) {
  7296.             if(invOverlayInterfaceID != -1) {
  7297.                 buildInterfaceMenu(547 + getTabIncreaseX(), RSInterface.interfaceCache[invOverlayInterfaceID], super.mouseX, 205 - (toggleFullscreen ? 46 : 0) + getTabIncreaseY(), super.mouseY, 0);
  7298.             } else if(tabInterfaceIDs[tabID] != -1) {
  7299.                 if(focusTab != -1)
  7300.                     buildInterfaceMenu(547 + getTabIncreaseX(), RSInterface.interfaceCache[tabInterfaceIDs[tabID]], super.mouseX, 205 - (toggleFullscreen ? 46 : 0) + getTabIncreaseY(), super.mouseY, 0);
  7301.             }
  7302.         }
  7303.         if (hoverChildId != anInt1048) {
  7304.             needDrawTabArea = true;
  7305.             tabAreaAltered = true;
  7306.             anInt1048 = hoverChildId;
  7307.         }
  7308.         if (hoverToggleChildId != anInt1044) {
  7309.             needDrawTabArea = true;
  7310.             tabAreaAltered = true;
  7311.             anInt1044 = hoverToggleChildId;
  7312.         }
  7313.         hoverChildId = 0;
  7314.         hoverToggleChildId = 0;
  7315.         if(super.mouseX > 0 && super.mouseY > 338 + getChatBackIncreaseY() && super.mouseX < 490 && super.mouseY < 503 + getChatBackIncreaseY()) {
  7316.             if(backDialogID != -1) {
  7317.                 buildInterfaceMenu(20, RSInterface.interfaceCache[backDialogID], super.mouseX, 358 + getChatBackIncreaseY(), super.mouseY, 0);
  7318.             } else if(super.mouseY < 503 + getChatBackIncreaseY() && super.mouseX < 490 + getChatBackIncreaseY()) {
  7319.                 buildChatAreaMenu(super.mouseY - (yPaddingchatBackImage + getChatBackIncreaseY()));
  7320.             }
  7321.         }
  7322.         if (backDialogID != -1 && hoverChildId != anInt1039) {
  7323.             inputTaken = true;
  7324.             anInt1039 = hoverChildId;
  7325.         }
  7326.         if (backDialogID != -1 && hoverToggleChildId != anInt1500) {
  7327.             inputTaken = true;
  7328.             anInt1500 = hoverToggleChildId;
  7329.         }
  7330.         /* Enable custom right click areas */
  7331.        
  7332.         processChatButtonClick(0, getChatBackIncreaseY());
  7333.         rightClickMapArea(getMapIncreaseX(),getMapIncreaseY());
  7334.         processTabClick(getTabIncreaseX(),getTabIncreaseY());
  7335. alertHandler.processMouse(super.mouseX, super.mouseY);
  7336.         /**/
  7337.         boolean flag = false;
  7338.         while (!flag) {
  7339.             flag = true;
  7340.             for (int j = 0; j < menuActionRow - 1; j++) {
  7341.                 if (menuActionID[j] < 1000 && menuActionID[j + 1] > 1000) {
  7342.                     String s = menuActionName[j];
  7343.                     menuActionName[j] = menuActionName[j + 1];
  7344.                     menuActionName[j + 1] = s;
  7345.                     int k = menuActionID[j];
  7346.                     menuActionID[j] = menuActionID[j + 1];
  7347.                     menuActionID[j + 1] = k;
  7348.                     k = menuActionCmd2[j];
  7349.                     menuActionCmd2[j] = menuActionCmd2[j + 1];
  7350.                     menuActionCmd2[j + 1] = k;
  7351.                     k = menuActionCmd3[j];
  7352.                     menuActionCmd3[j] = menuActionCmd3[j + 1];
  7353.                     menuActionCmd3[j + 1] = k;
  7354.                     k = menuActionCmd1[j];
  7355.                     menuActionCmd1[j] = menuActionCmd1[j + 1];
  7356.                     menuActionCmd1[j + 1] = k;
  7357.                     flag = false;
  7358.                 }
  7359.             }
  7360.         }
  7361.     }
  7362. public void WhatWorldIsWhatIp () { // Fixes both worlds :) By Hack3r REDONE
  7363.         if(world == 1){
  7364.         serverip = ""+defaultServerIP+"";
  7365.         port = 43595;
  7366.         } else {
  7367.                                            if(world == 2){
  7368.         serverip = ""+defaultServerIPw2+"";
  7369.         port = 43595;
  7370.         }
  7371.         }
  7372.         }
  7373.        
  7374.     private int method83(int i, int j, int k)
  7375.     {
  7376.         int l = 256 - k;
  7377.         return ((i & 0xff00ff) * l + (j & 0xff00ff) * k & 0xff00ff00) + ((i & 0xff00) * l + (j & 0xff00) * k & 0xff0000) >> 8;
  7378.     }
  7379.  
  7380.         private void login(String s, String s1, boolean flag) {
  7381.         signlink.errorname = s;
  7382.         String s2 = "error";
  7383.         try {
  7384.  
  7385.             if (!flag) {
  7386.                 loginMessage1 = "";
  7387.                 loginMessage2 = "@whi@Connecting to server...";
  7388.                 drawLoginScreen(true);
  7389.             }
  7390.             //socketStream = new RSSocket(this, openSocket(43594 + portOff));
  7391.             socketStream = new RSSocket(this, openSocket(43594 + portOff));
  7392.             WhatWorldIsWhatIp();
  7393.             long l = TextClass.longForName(s2);
  7394.             int i = (int) (l >> 16 & 31L);
  7395.             stream.currentOffset = 0;
  7396.             stream.writeWordBigEndian(14);
  7397.             stream.writeWordBigEndian(i);
  7398.             socketStream.queueBytes(2, stream.buffer);
  7399.             for (int j = 0; j < 8; j++)
  7400.                 socketStream.read();
  7401.  
  7402.             int k = socketStream.read();
  7403.             int i1 = k;
  7404.             if (k == 0) {
  7405.                 socketStream.flushInputStream(inStream.buffer, 8);
  7406.                 inStream.currentOffset = 0;
  7407.                 aLong1215 = inStream.readQWord();
  7408.                 int ai[] = new int[4];
  7409.                 ai[0] = (int) (Math.random() * 99999999D);
  7410.                 ai[1] = (int) (Math.random() * 99999999D);
  7411.                 ai[2] = (int) (aLong1215 >> 32);
  7412.                 ai[3] = (int) aLong1215;
  7413.                 stream.currentOffset = 0;
  7414.                 stream.writeWordBigEndian(10);
  7415.                 stream.writeDWord(ai[0]);
  7416.                 stream.writeDWord(ai[1]);
  7417.                 stream.writeDWord(ai[2]);
  7418.                 stream.writeDWord(ai[3]);
  7419.                 stream.writeDWord(26342);
  7420.                 stream.writeString(s);
  7421.                 stream.writeString(s1);
  7422.                 stream.doKeys();
  7423.                 aStream_847.currentOffset = 0;
  7424.                 if (flag)
  7425.                     aStream_847.writeWordBigEndian(18);
  7426.                 else
  7427.                     aStream_847.writeWordBigEndian(16);
  7428.                 aStream_847.writeWordBigEndian(stream.currentOffset + 36 + 1
  7429.                         + 1 + 2);
  7430.                 aStream_847.writeWordBigEndian(558);
  7431.                 aStream_847.writeWord(1);
  7432.                 aStream_847.writeWordBigEndian(6);
  7433.                 for (int l1 = 0; l1 < 9; l1++)
  7434.                     aStream_847.writeDWord(expectedCRCs[l1]);
  7435.  
  7436.                 aStream_847.writeBytes(stream.buffer, stream.currentOffset, 0);
  7437.                 stream.encryption = new ISAACRandomGen(ai);
  7438.                 for (int j2 = 0; j2 < 4; j2++)
  7439.                     ai[j2] += 50;
  7440.  
  7441.                 encryption = new ISAACRandomGen(ai);
  7442.                 socketStream.queueBytes(aStream_847.currentOffset,
  7443.                         aStream_847.buffer);
  7444.                 k = socketStream.read();
  7445.             }
  7446.             if (k == 1) {
  7447.                 try {
  7448.                     Thread.sleep(2000L);
  7449.                 } catch (Exception _ex) {
  7450.                 }
  7451.                 login(s, s1, flag);
  7452.                 return;
  7453.             }
  7454.             if(k == 2)
  7455.             {
  7456.                 setDetails();
  7457.                 myPrivilege = socketStream.read();
  7458.                 flagged = socketStream.read() == 1;
  7459.                 aLong1220 = 0L;
  7460.                 anInt1022 = 0;
  7461.                 mouseDetection.coordsIndex = 0;
  7462.                 super.awtFocus = true;
  7463.                 aBoolean954 = true;
  7464.                 loggedIn = true;
  7465.                 stream.currentOffset = 0;
  7466.                 inStream.currentOffset = 0;
  7467.                 pktType = -1;
  7468.                 anInt841 = -1;
  7469.                 anInt842 = -1;
  7470.                 anInt843 = -1;
  7471.                 pktSize = 0;
  7472.                 anInt1009 = 0;
  7473.                 systemUpdatetime = 0;
  7474.                 anInt1011 = 0;
  7475.                 hintType = 0;
  7476.                 menuActionRow = 0;
  7477.                 contextMenuOpen = false;
  7478.                 super.idleTime = 0;
  7479.                 for(int j1 = 0; j1 < 100; j1++)
  7480.                     chatMessages[j1] = null;
  7481.                 summoningAttack = false;
  7482.                 itemSelected = 0;
  7483.                 spellSelected = 0;
  7484.                 loadingStage = 0;
  7485.                 anInt1062 = 0;
  7486.                 anInt1278 = (int)(Math.random() * 100D) - 50;
  7487.                 anInt1131 = (int)(Math.random() * 110D) - 55;
  7488.                 anInt896 = (int)(Math.random() * 80D) - 40;
  7489.                 mapAmtDiffRotation = (int)(Math.random() * 120D) - 60;
  7490.                 mapAmtDiffZoom = (int)(Math.random() * 30D) - 20;
  7491.                 compassRotation = (int)(Math.random() * 20D) - 10 & 0x7ff;
  7492.                 minimapCover = 0;
  7493.                 anInt985 = -1;
  7494.                 destX = 0;
  7495.                 destY = 0;
  7496.                 playerCount = 0;
  7497.                 npcCount = 0;
  7498.                 for (int i2 = 0; i2 < maxPlayers; i2++) {
  7499.                     playerArray[i2] = null;
  7500.                     aStreamArray895s[i2] = null;
  7501.                 }
  7502.  
  7503.                 for (int k2 = 0; k2 < 16384; k2++)
  7504.                     npcArray[k2] = null;
  7505.  
  7506.                 myPlayer = playerArray[myPlayerIndex] = new Player();
  7507.                 aClass19_1013.removeAll();
  7508.                 aClass19_1056.removeAll();
  7509.                 for (int l2 = 0; l2 < 4; l2++) {
  7510.                     for (int i3 = 0; i3 < 104; i3++) {
  7511.                         for (int k3 = 0; k3 < 104; k3++)
  7512.                             groundArray[l2][i3][k3] = null;
  7513.  
  7514.                     }
  7515.  
  7516.                 }
  7517.  
  7518.                 aClass19_1179 = new NodeList();
  7519.                 fullscreenInterfaceID = -1;
  7520.                 anInt900 = 0;
  7521.                 friendsCount = 0;
  7522.                 dialogID = -1;
  7523.                 backDialogID = -1;
  7524.                 openInterfaceID = -1;
  7525.                 invOverlayInterfaceID = -1;
  7526.                 walkableInterfaceID = -1;
  7527.                 aBoolean1149 = false;
  7528.                 tabID = 3;
  7529.                 inputDialogState = 0;
  7530.                 contextMenuOpen = false;
  7531.                 messagePromptRaised = false;
  7532.                 aString844 = null;
  7533.                 displayOverLayIcon = 0;
  7534.                 tabIconFlash = -1;
  7535.                 aBoolean1047 = true;
  7536.                 method45();
  7537.                 for (int j3 = 0; j3 < 5; j3++)
  7538.                     anIntArray990[j3] = 0;
  7539.  
  7540.                 for (int l3 = 0; l3 < 5; l3++) {
  7541.                     atPlayerActions[l3] = null;
  7542.                     atPlayerArray[l3] = false;
  7543.                 }
  7544.  
  7545.                 anInt1175 = 0;
  7546.                 anInt1134 = 0;
  7547.                 anInt986 = 0;
  7548.                 anInt1288 = 0;
  7549.                 anInt924 = 0;
  7550.                 anInt1188 = 0;
  7551.                 anInt1155 = 0;
  7552.                 anInt1226 = 0;
  7553.                 @SuppressWarnings("unused")
  7554.                 int anInt941 = 0;
  7555.                 @SuppressWarnings("unused")
  7556.                 int anInt1260 = 0;
  7557.                 resetImageProducers2();
  7558.                 return;
  7559.             }
  7560.             if (k == 3) {
  7561.                 loginMessage1 = "";
  7562.                 loginMessage2 = "@whi@Invalid username or password.";
  7563.                 return;
  7564.             }
  7565.             if (k == 4) {
  7566.                 loginMessage1 = "@whi@Your account has been Banned.";
  7567.                 loginMessage2 = "@whi@Please Appeal For Unban on Forums";
  7568.                 return;
  7569.             }
  7570.             if (k == 5) {
  7571.                 loginMessage1 = "@whi@Your account is already logged in.";
  7572.                 loginMessage2 = "@whi@If you have just left another world be patient.";
  7573.                 return;
  7574.             }
  7575.             if (k == 6) {
  7576.                 loginMessage1 = "@whi@Deathlypvpz has been updated!";
  7577.                 loginMessage2 = "@whi@Please reload this page.";
  7578.                 return;
  7579.             }
  7580.             if (k == 7) {
  7581.                 loginMessage1 = "@whi@This world is full.";
  7582.                 loginMessage2 = "@whi@Please use a different world.";
  7583.                 return;
  7584.             }
  7585.             if (k == 8) {
  7586.                 loginMessage1 = "@whi@Unable to connect.";
  7587.                 loginMessage2 = "@whi@Login server offline.";
  7588.                 return;
  7589.             }
  7590.             if (k == 9) {
  7591.                 loginMessage1 = "@whi@Login limit exceeded.";
  7592.                 loginMessage2 = "@whi@Too many connections from your address.";
  7593.                 return;
  7594.             }
  7595.             if (k == 10) {
  7596.                 loginMessage1 = "@whi@Unable to connect.";
  7597.                 loginMessage2 = "@whi@Bad session id.";
  7598.                 return;
  7599.             }
  7600.             if (k == 11) {
  7601.                 loginMessage1 = "@whi@Login server rejected session.";
  7602.                 loginMessage2 = "@whi@Please try again.";
  7603.                 return;
  7604.             }
  7605.             if (k == 12) {
  7606.                 loginMessage1 = "@whi@You need a members account to login to this world.";
  7607.                 loginMessage2 = "@whi@Please subscribe, or use a different world.";
  7608.                 return;
  7609.             }
  7610.             if (k == 13) {
  7611.                 loginMessage1 = "@whi@Could not complete login.";
  7612.                 loginMessage2 = "@whi@Please try using a different world.";
  7613.                 return;
  7614.             }
  7615.             if (k == 14) {
  7616.                 loginMessage1 = "@whi@The server is being updated.";
  7617.                 loginMessage2 = "@whi@Please wait 1 minute and try again.";
  7618.                 return;
  7619.             }
  7620.             if(k == 15)
  7621.             {
  7622.                 loggedIn = true;
  7623.                 stream.currentOffset = 0;
  7624.                 inStream.currentOffset = 0;
  7625.                 pktType = -1;
  7626.                 anInt841 = -1;
  7627.                 anInt842 = -1;
  7628.                 anInt843 = -1;
  7629.                 pktSize = 0;
  7630.                 anInt1009 = 0;
  7631.                 systemUpdatetime = 0;
  7632.                 menuActionRow = 0;
  7633.                 contextMenuOpen = false;
  7634.                 aLong824 = System.currentTimeMillis();
  7635.                 return;
  7636.             }
  7637.             if (k == 16) {
  7638.                 loginMessage1 = "@whi@Login attempts exceeded.";
  7639.                 loginMessage2 = "@whi@Please wait 1 minute and try again.";
  7640.                 return;
  7641.             }
  7642.             if (k == 17) {
  7643.                 loginMessage1 = "@whi@You are standing in a members-only area.";
  7644.                 loginMessage2 = "@whi@To play on this world move to a free area first";
  7645.                 return;
  7646.             }
  7647.             if (k == 20) {
  7648.                 loginMessage1 = "@whi@Invalid loginserver requested";
  7649.                 loginMessage2 = "@whi@Please try using a different world.";
  7650.                 return;
  7651.             }
  7652.             if (k == 21) {
  7653.                 for (int k1 = socketStream.read(); k1 >= 0; k1--) {
  7654.                     loginMessage1 = "@whi@You have only just left another world";
  7655.                     loginMessage2 = "@whi@Your profile will be transferred in: "
  7656.                             + k1 + " seconds";
  7657.                     drawLoginScreen(true);
  7658.                     try {
  7659.                         Thread.sleep(1000L);
  7660.                     } catch (Exception _ex) {
  7661.                     }
  7662.                 }
  7663.  
  7664.                 login(s, s1, flag);
  7665.                 return;
  7666.             }
  7667.             if (k == -1) {
  7668.                 if (i1 == 0) {
  7669.                     if (loginFailures < 2) {
  7670.                         try {
  7671.                             Thread.sleep(2000L);
  7672.                         } catch (Exception _ex) {
  7673.                         }
  7674.                         loginFailures++;
  7675.                         login(s, s1, flag);
  7676.                         return;
  7677.                     } else {
  7678.                         loginMessage1 = "@whi@No response from loginserver";
  7679.                         loginMessage2 = "@whi@Reload Browser or Wait 1 Min";
  7680.                         return;
  7681.                     }
  7682.                 } else {
  7683.                     loginMessage1 = "@whi@No response from server";
  7684.                     loginMessage2 = "@whi@Reload Browser or use Diff World";
  7685.                     return;
  7686.                 }
  7687.             } else {
  7688.                 // System.out.println("response:" + k);
  7689.                 loginMessage1 = "@whi@Unexpected server response";
  7690.                 loginMessage2 = "@whi@Reload Browser or use Diff World";
  7691.                 return;
  7692.             }
  7693.         } catch (IOException _ex) {
  7694.             loginMessage1 = "";
  7695.         }
  7696.         loginMessage2 = "@whi@Error connecting to server.";
  7697.     }
  7698.  
  7699.     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) {
  7700.         byte byte0 = 104;
  7701.         byte byte1 = 104;
  7702.         for(int l2 = 0; l2 < byte0; l2++) {
  7703.             for(int i3 = 0; i3 < byte1; i3++) {
  7704.                 anIntArrayArray901[l2][i3] = 0;
  7705.                 anIntArrayArray825[l2][i3] = 0x5f5e0ff;
  7706.             }
  7707.         }
  7708.         int j3 = j2;
  7709.         int k3 = j1;
  7710.         anIntArrayArray901[j2][j1] = 99;
  7711.         anIntArrayArray825[j2][j1] = 0;
  7712.         int l3 = 0;
  7713.         int i4 = 0;
  7714.         bigX[l3] = j2;
  7715.         bigY[l3++] = j1;
  7716.         boolean flag1 = false;
  7717.         int j4 = bigX.length;
  7718.         int ai[][] = aClass11Array1230[plane].anIntArrayArray294;
  7719.         while(i4 != l3)
  7720.         {
  7721.             j3 = bigX[i4];
  7722.             k3 = bigY[i4];
  7723.             i4 = (i4 + 1) % j4;
  7724.             if(j3 == k2 && k3 == i2)
  7725.             {
  7726.                 flag1 = true;
  7727.                 break;
  7728.             }
  7729.             if(i1 != 0)
  7730.             {
  7731.                 if((i1 < 5 || i1 == 10) && aClass11Array1230[plane].method219(k2, j3, k3, j, i1 - 1, i2))
  7732.                 {
  7733.                     flag1 = true;
  7734.                     break;
  7735.                 }
  7736.                 if(i1 < 10 && aClass11Array1230[plane].method220(k2, i2, k3, i1 - 1, j, j3))
  7737.                 {
  7738.                     flag1 = true;
  7739.                     break;
  7740.                 }
  7741.             }
  7742.             if(k1 != 0 && k != 0 && aClass11Array1230[plane].method221(i2, k2, j3, k, l1, k1, k3))
  7743.             {
  7744.                 flag1 = true;
  7745.                 break;
  7746.             }
  7747.             int l4 = anIntArrayArray825[j3][k3] + 1;
  7748.             if(j3 > 0 && anIntArrayArray901[j3 - 1][k3] == 0 && (ai[j3 - 1][k3] & 0x1280108) == 0)
  7749.             {
  7750.                 bigX[l3] = j3 - 1;
  7751.                 bigY[l3] = k3;
  7752.                 l3 = (l3 + 1) % j4;
  7753.                 anIntArrayArray901[j3 - 1][k3] = 2;
  7754.                 anIntArrayArray825[j3 - 1][k3] = l4;
  7755.             }
  7756.             if(j3 < byte0 - 1 && anIntArrayArray901[j3 + 1][k3] == 0 && (ai[j3 + 1][k3] & 0x1280180) == 0)
  7757.             {
  7758.                 bigX[l3] = j3 + 1;
  7759.                 bigY[l3] = k3;
  7760.                 l3 = (l3 + 1) % j4;
  7761.                 anIntArrayArray901[j3 + 1][k3] = 8;
  7762.                 anIntArrayArray825[j3 + 1][k3] = l4;
  7763.             }
  7764.             if(k3 > 0 && anIntArrayArray901[j3][k3 - 1] == 0 && (ai[j3][k3 - 1] & 0x1280102) == 0)
  7765.             {
  7766.                 bigX[l3] = j3;
  7767.                 bigY[l3] = k3 - 1;
  7768.                 l3 = (l3 + 1) % j4;
  7769.                 anIntArrayArray901[j3][k3 - 1] = 1;
  7770.                 anIntArrayArray825[j3][k3 - 1] = l4;
  7771.             }
  7772.             if(k3 < byte1 - 1 && anIntArrayArray901[j3][k3 + 1] == 0 && (ai[j3][k3 + 1] & 0x1280120) == 0)
  7773.             {
  7774.                 bigX[l3] = j3;
  7775.                 bigY[l3] = k3 + 1;
  7776.                 l3 = (l3 + 1) % j4;
  7777.                 anIntArrayArray901[j3][k3 + 1] = 4;
  7778.                 anIntArrayArray825[j3][k3 + 1] = l4;
  7779.             }
  7780.             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)
  7781.             {
  7782.                 bigX[l3] = j3 - 1;
  7783.                 bigY[l3] = k3 - 1;
  7784.                 l3 = (l3 + 1) % j4;
  7785.                 anIntArrayArray901[j3 - 1][k3 - 1] = 3;
  7786.                 anIntArrayArray825[j3 - 1][k3 - 1] = l4;
  7787.             }
  7788.             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)
  7789.             {
  7790.                 bigX[l3] = j3 + 1;
  7791.                 bigY[l3] = k3 - 1;
  7792.                 l3 = (l3 + 1) % j4;
  7793.                 anIntArrayArray901[j3 + 1][k3 - 1] = 9;
  7794.                 anIntArrayArray825[j3 + 1][k3 - 1] = l4;
  7795.             }
  7796.             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)
  7797.             {
  7798.                 bigX[l3] = j3 - 1;
  7799.                 bigY[l3] = k3 + 1;
  7800.                 l3 = (l3 + 1) % j4;
  7801.                 anIntArrayArray901[j3 - 1][k3 + 1] = 6;
  7802.                 anIntArrayArray825[j3 - 1][k3 + 1] = l4;
  7803.             }
  7804.             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)
  7805.             {
  7806.                 bigX[l3] = j3 + 1;
  7807.                 bigY[l3] = k3 + 1;
  7808.                 l3 = (l3 + 1) % j4;
  7809.                 anIntArrayArray901[j3 + 1][k3 + 1] = 12;
  7810.                 anIntArrayArray825[j3 + 1][k3 + 1] = l4;
  7811.             }
  7812.         }
  7813.         anInt1264 = 0;
  7814.         if(!flag1)
  7815.         {
  7816.             if(flag)
  7817.             {
  7818.                 int i5 = 100;
  7819.                 for(int k5 = 1; k5 < 2; k5++)
  7820.                 {
  7821.                     for(int i6 = k2 - k5; i6 <= k2 + k5; i6++)
  7822.                     {
  7823.                         for(int l6 = i2 - k5; l6 <= i2 + k5; l6++)
  7824.                             if(i6 >= 0 && l6 >= 0 && i6 < 104 && l6 < 104 && anIntArrayArray825[i6][l6] < i5)
  7825.                             {
  7826.                                 i5 = anIntArrayArray825[i6][l6];
  7827.                                 j3 = i6;
  7828.                                 k3 = l6;
  7829.                                 anInt1264 = 1;
  7830.                                 flag1 = true;
  7831.                             }
  7832.  
  7833.                     }
  7834.  
  7835.                     if(flag1)
  7836.                         break;
  7837.                 }
  7838.  
  7839.             }
  7840.             if(!flag1)
  7841.                 return false;
  7842.         }
  7843.         i4 = 0;
  7844.         bigX[i4] = j3;
  7845.         bigY[i4++] = k3;
  7846.         int l5;
  7847.         for(int j5 = l5 = anIntArrayArray901[j3][k3]; j3 != j2 || k3 != j1; j5 = anIntArrayArray901[j3][k3])
  7848.         {
  7849.             if(j5 != l5)
  7850.             {
  7851.                 l5 = j5;
  7852.                 bigX[i4] = j3;
  7853.                 bigY[i4++] = k3;
  7854.             }
  7855.             if((j5 & 2) != 0)
  7856.                 j3++;
  7857.             else
  7858.             if((j5 & 8) != 0)
  7859.                 j3--;
  7860.             if((j5 & 1) != 0)
  7861.                 k3++;
  7862.             else
  7863.             if((j5 & 4) != 0)
  7864.                 k3--;
  7865.         }
  7866. //  if(cancelWalk) { return i4 > 0; }
  7867.    
  7868.  
  7869.         if(i4 > 0)
  7870.         {
  7871.             int k4 = i4;
  7872.             if(k4 > 25)
  7873.                 k4 = 25;
  7874.             i4--;
  7875.             int k6 = bigX[i4];
  7876.             int i7 = bigY[i4];
  7877.             anInt1288 += k4;
  7878.             if(anInt1288 >= 92)
  7879.             {
  7880.                 stream.createFrame(36);
  7881.                 stream.writeDWord(0);
  7882.                 anInt1288 = 0;
  7883.             }
  7884.             if(i == 0)
  7885.             {
  7886.                 stream.createFrame(164);
  7887.                 stream.writeWordBigEndian(k4 + k4 + 3);
  7888.             }
  7889.             if(i == 1)
  7890.             {
  7891.                 stream.createFrame(248);
  7892.                 stream.writeWordBigEndian(k4 + k4 + 3 + 14);
  7893.             }
  7894.             if(i == 2)
  7895.             {
  7896.                 stream.createFrame(98);
  7897.                 stream.writeWordBigEndian(k4 + k4 + 3);
  7898.             }
  7899.             stream.method433(k6 + baseX);
  7900.             destX = bigX[0];
  7901.             destY = bigY[0];
  7902.             for(int j7 = 1; j7 < k4; j7++)
  7903.             {
  7904.                 i4--;
  7905.                 stream.writeWordBigEndian(bigX[i4] - k6);
  7906.                 stream.writeWordBigEndian(bigY[i4] - i7);
  7907.             }
  7908.  
  7909.             stream.method431(i7 + baseY);
  7910.             stream.method424(super.keyArray[5] != 1 ? 0 : 1);
  7911.             return true;
  7912.         }
  7913.         return i != 1;
  7914.     }
  7915.  
  7916.     private void method86(Stream stream)
  7917.     {
  7918.         for(int j = 0; j < anInt893; j++)
  7919.         {
  7920.             int k = anIntArray894[j];
  7921.             NPC npc = npcArray[k];
  7922.             int l = stream.readUnsignedByte();
  7923.             if((l & 0x10) != 0)
  7924.             {
  7925.                 int i1 = stream.method434();
  7926.                 if(i1 == 65535)
  7927.                     i1 = -1;
  7928.                 int i2 = stream.readUnsignedByte();
  7929.                 if(i1 == npc.anim && i1 != -1)
  7930.                 {
  7931.                     int l2 = Animation.anims[i1].anInt365;
  7932.                     if(l2 == 1)
  7933.                     {
  7934.                         npc.anInt1527 = 0;
  7935.                         npc.anInt1528 = 0;
  7936.                         npc.anInt1529 = i2;
  7937.                         npc.anInt1530 = 0;
  7938.                     }
  7939.                     if(l2 == 2)
  7940.                         npc.anInt1530 = 0;
  7941.                 } else
  7942.                 if(i1 == -1 || npc.anim == -1 || Animation.anims[i1].anInt359 >= Animation.anims[npc.anim].anInt359)
  7943.                 {
  7944.                     npc.anim = i1;
  7945.                     npc.anInt1527 = 0;
  7946.                     npc.anInt1528 = 0;
  7947.                     npc.anInt1529 = i2;
  7948.                     npc.anInt1530 = 0;
  7949.                     npc.anInt1542 = npc.smallXYIndex;
  7950.                 }
  7951.             }
  7952.             if((l & 8) != 0)
  7953.             {
  7954.                 int damage = stream.method426();
  7955.                 int type = stream.method427();
  7956.                 int icon = stream.readUnsignedByte();
  7957.                 int focusNPC = stream.readUnsignedByte();
  7958.                 npc.updateHitData(type, damage, loopCycle, icon, 0, focusNPC);
  7959.                 npc.loopCycleStatus = loopCycle + 300;
  7960.                 npc.currentHealth = stream.method426();
  7961.                 npc.maxHealth = stream.readUnsignedByte();
  7962.             }
  7963.             if((l & 0x80) != 0)
  7964.             {
  7965.                 npc.anInt1520 = stream.readUnsignedWord();
  7966.                 int k1 = stream.readDWord();
  7967.                 npc.anInt1524 = k1 >> 16;
  7968.                 npc.anInt1523 = loopCycle + (k1 & 0xffff);
  7969.                 npc.anInt1521 = 0;
  7970.                 npc.anInt1522 = 0;
  7971.                 if(npc.anInt1523 > loopCycle)
  7972.                     npc.anInt1521 = -1;
  7973.                 if(npc.anInt1520 == 65535)
  7974.                     npc.anInt1520 = -1;
  7975.             }
  7976.             if((l & 0x20) != 0)
  7977.             {
  7978.                 npc.interactingEntity = stream.readUnsignedWord();
  7979.                 if(npc.interactingEntity == 65535)
  7980.                     npc.interactingEntity = -1;
  7981.             }
  7982.             if((l & 1) != 0)
  7983.             {
  7984.                 npc.textSpoken = stream.readString();
  7985.                 npc.textCycle = 100;
  7986.                 //entityMessage(npc);
  7987.             }
  7988.             if((l & 0x40) != 0)
  7989.             {
  7990.                 int damage = stream.method427();
  7991.                 int type = stream.method428();
  7992.                 int icon = stream.readUnsignedByte();
  7993.                 int focusNPC = stream.readUnsignedByte();
  7994.                 npc.updateHitData(type, damage, loopCycle, icon, 0, focusNPC);
  7995.                 npc.loopCycleStatus = loopCycle + 300;
  7996.                 npc.currentHealth = stream.method428();
  7997.                 npc.maxHealth = stream.method427();
  7998.             }
  7999.             if((l & 2) != 0)
  8000.             {
  8001.                 npc.desc = EntityDef.forID(stream.method436());
  8002.                 npc.anInt1540 = npc.desc.aByte68;
  8003.                 npc.anInt1504 = npc.desc.anInt79;
  8004.                 npc.anInt1554 = npc.desc.walkAnim;
  8005.                 npc.anInt1555 = npc.desc.anInt58;
  8006.                 npc.anInt1556 = npc.desc.anInt83;
  8007.                 npc.anInt1557 = npc.desc.anInt55;
  8008.                 npc.anInt1511 = npc.desc.standAnim;
  8009.             }
  8010.             if((l & 4) != 0)
  8011.             {
  8012.                 npc.anInt1538 = stream.method434();
  8013.                 npc.anInt1539 = stream.method434();
  8014.             }
  8015.         }
  8016.     }
  8017.  
  8018.     private void buildAtNPCMenu(EntityDef entityDef, int i, int j, int k)
  8019.     {
  8020.         if(menuActionRow >= 400)
  8021.             return;
  8022.         if(entityDef.childrenIDs != null)
  8023.             entityDef = entityDef.method161();
  8024.         if(entityDef == null)
  8025.             return;
  8026.         if(!entityDef.aBoolean84)
  8027.             return;
  8028.         String s = entityDef.name;
  8029.         if(entityDef.combatLevel != 0)
  8030.             s = s + combatDiffColor(myPlayer.combatLevel, entityDef.combatLevel) + " (level:" + entityDef.combatLevel + ")";
  8031.         if(summoningAttack) {
  8032.             menuActionName[menuActionRow] = "Use familiar attack with @whi@" + s;
  8033.             menuActionID[menuActionRow] = 582;
  8034.             menuActionCmd1[menuActionRow] = i;
  8035.             menuActionCmd2[menuActionRow] = k;
  8036.             menuActionCmd3[menuActionRow] = j;
  8037.             menuActionRow++;
  8038.             return;
  8039.         }
  8040.         if(itemSelected == 1)
  8041.         {
  8042.             menuActionName[menuActionRow] = "Use " + selectedItemName + " with @yel@" + s;
  8043.             menuActionID[menuActionRow] = 582;
  8044.             menuActionCmd1[menuActionRow] = i;
  8045.             menuActionCmd2[menuActionRow] = k;
  8046.             menuActionCmd3[menuActionRow] = j;
  8047.             menuActionRow++;
  8048.             return;
  8049.         }
  8050.         if(spellSelected == 1)
  8051.         {
  8052.             if((spellUsableOn & 2) == 2)
  8053.             {
  8054.                 menuActionName[menuActionRow] = spellTooltip + " @yel@" + s;
  8055.                 menuActionID[menuActionRow] = 413;
  8056.                 menuActionCmd1[menuActionRow] = i;
  8057.                 menuActionCmd2[menuActionRow] = k;
  8058.                 menuActionCmd3[menuActionRow] = j;
  8059.                 menuActionRow++;
  8060.             }
  8061.         } else
  8062.         {
  8063.             if(entityDef.itemActions != null)
  8064.             {
  8065.                 for(int l = 4; l >= 0; l--)
  8066.                     if(entityDef.itemActions[l] != null && !entityDef.itemActions[l].equalsIgnoreCase("attack"))
  8067.                     {
  8068.                         menuActionName[menuActionRow] = entityDef.itemActions[l] + " @yel@" + s;
  8069.                         if(l == 0)
  8070.                             menuActionID[menuActionRow] = 20;
  8071.                         if(l == 1)
  8072.                             menuActionID[menuActionRow] = 412;
  8073.                         if(l == 2)
  8074.                             menuActionID[menuActionRow] = 225;
  8075.                         if(l == 3)
  8076.                             menuActionID[menuActionRow] = 965;
  8077.                         if(l == 4)
  8078.                             menuActionID[menuActionRow] = 478;
  8079.                         menuActionCmd1[menuActionRow] = i;
  8080.                         menuActionCmd2[menuActionRow] = k;
  8081.                         menuActionCmd3[menuActionRow] = j;
  8082.                         menuActionRow++;
  8083.                     }
  8084.  
  8085.             }
  8086.             if(entityDef.itemActions != null)
  8087.             {
  8088.                 for(int i1 = 4; i1 >= 0; i1--)
  8089.                     if(entityDef.itemActions[i1] != null && entityDef.itemActions[i1].equalsIgnoreCase("attack"))
  8090.                     {
  8091.                         char c = '\0';
  8092.                         if(entityDef.combatLevel > myPlayer.combatLevel)
  8093.                             c = '\u07D0';
  8094.                         menuActionName[menuActionRow] = entityDef.itemActions[i1] + " @yel@" + s;
  8095.                         if(i1 == 0)
  8096.                             menuActionID[menuActionRow] = 20 + c;
  8097.                         if(i1 == 1)
  8098.                             menuActionID[menuActionRow] = 412 + c;
  8099.                         if(i1 == 2)
  8100.                             menuActionID[menuActionRow] = 225 + c;
  8101.                         if(i1 == 3)
  8102.                             menuActionID[menuActionRow] = 965 + c;
  8103.                         if(i1 == 4)
  8104.                             menuActionID[menuActionRow] = 478 + c;
  8105.                         menuActionCmd1[menuActionRow] = i;
  8106.                         menuActionCmd2[menuActionRow] = k;
  8107.                         menuActionCmd3[menuActionRow] = j;
  8108.                         menuActionRow++;
  8109.                     }
  8110.  
  8111.             }
  8112.             menuActionName[menuActionRow] = "Examine @yel@" + s + ((myPrivilege != 0) ? ", @gre@(@whi@" + entityDef.type + "@gre@)" : "");
  8113.             menuActionID[menuActionRow] = 1025;
  8114.             menuActionCmd1[menuActionRow] = i;
  8115.             menuActionCmd2[menuActionRow] = k;
  8116.             menuActionCmd3[menuActionRow] = j;
  8117.             menuActionRow++;
  8118.         }
  8119.     }
  8120.  
  8121.     private void buildAtPlayerMenu(int i, int j, Player player, int k)
  8122.     {
  8123.         if(player == myPlayer)
  8124.             return;
  8125.         if(menuActionRow >= 400)
  8126.             return;
  8127.         String s;
  8128.         if (player.skill == 0) {
  8129.             s = player.name
  8130.                     + combatDiffColor(myPlayer.combatLevel, player.combatLevel)
  8131.                     + " (level-" + player.combatLevel + ")";
  8132.         } else {
  8133.             s = "@or2@" + getRank(player.skill) + "@whi@ " + player.name
  8134.                     + combatDiffColor(myPlayer.combatLevel, player.combatLevel)
  8135.                     + " (level-" + player.combatLevel + ")";
  8136.         }
  8137.         if(summoningAttack) {
  8138.             menuActionName[menuActionRow] = "Use familiar attack with @whi@" + s;
  8139.             menuActionID[menuActionRow] = 491;
  8140.             menuActionCmd1[menuActionRow] = j;
  8141.             menuActionCmd2[menuActionRow] = i;
  8142.             menuActionCmd3[menuActionRow] = k;
  8143.             menuActionRow++;
  8144.         }
  8145.         if(itemSelected == 1)
  8146.         {
  8147.             menuActionName[menuActionRow] = "Use " + selectedItemName + " with @whi@" + s;
  8148.             menuActionID[menuActionRow] = 491;
  8149.             menuActionCmd1[menuActionRow] = j;
  8150.             menuActionCmd2[menuActionRow] = i;
  8151.             menuActionCmd3[menuActionRow] = k;
  8152.             menuActionRow++;
  8153.         } else
  8154.         {
  8155.             for(int index = 4; index >= 0; index--)
  8156.                 if(atPlayerActions[index] != null)
  8157.                 {
  8158.                     menuActionName[menuActionRow] = atPlayerActions[index] + " @whi@" + s;
  8159.                     char c = '\0';
  8160.                     if(atPlayerActions[index].equalsIgnoreCase("attack"))
  8161.                     {
  8162.                         if(player.combatLevel > myPlayer.combatLevel)
  8163.                             c = '\u07D0';
  8164.                         if(myPlayer.team != 0 && player.team != 0)
  8165.                             if(myPlayer.team == player.team)
  8166.                                 c = '\u07D0';
  8167.                             else
  8168.                                 c = '\0';
  8169.                     } else
  8170.                     if(atPlayerArray[index])
  8171.                         c = '\u07D0';
  8172.                     if(index == 0)
  8173.                         menuActionID[menuActionRow] = 561 + c;
  8174.                     if(index == 1)
  8175.                         menuActionID[menuActionRow] = 779 + c;
  8176.                     if(index == 2)
  8177.                         menuActionID[menuActionRow] = 27 + c;
  8178.                     if(index == 3)
  8179.                         menuActionID[menuActionRow] = 577 + c;
  8180.                     if(index == 4)
  8181.                         menuActionID[menuActionRow] = 729 + c;
  8182.                     menuActionCmd1[menuActionRow] = j;
  8183.                     menuActionCmd2[menuActionRow] = i;
  8184.                     menuActionCmd3[menuActionRow] = k;
  8185.                     menuActionRow++;
  8186.                 }
  8187.             if(spellSelected == 1)
  8188.             {
  8189.                 if((spellUsableOn & 8) == 8)
  8190.                 {
  8191.                     menuActionName[menuActionRow] = spellTooltip + " @whi@" + s;
  8192.                     menuActionID[menuActionRow] = 365;
  8193.                     menuActionCmd1[menuActionRow] = j;
  8194.                     menuActionCmd2[menuActionRow] = i;
  8195.                     menuActionCmd3[menuActionRow] = k;
  8196.                     menuActionRow++;
  8197.                 }
  8198.             }
  8199.         }
  8200.         for(int i1 = 0; i1 < menuActionRow; i1++)
  8201.             if(menuActionID[i1] == 516)
  8202.             {
  8203.                 menuActionName[i1] = "Walk here @whi@" + s;
  8204.                 return;
  8205.             }
  8206.  
  8207.     }
  8208.  
  8209.     private void method89(Class30_Sub1 class30_sub1)
  8210.     {
  8211.         int i = 0;
  8212.         int j = -1;
  8213.         int k = 0;
  8214.         int l = 0;
  8215.         if(class30_sub1.anInt1296 == 0)
  8216.             i = worldController.method300(class30_sub1.anInt1295, class30_sub1.anInt1297, class30_sub1.anInt1298);
  8217.         if(class30_sub1.anInt1296 == 1)
  8218.             i = worldController.method301(class30_sub1.anInt1295, class30_sub1.anInt1297, class30_sub1.anInt1298);
  8219.         if(class30_sub1.anInt1296 == 2)
  8220.             i = worldController.method302(class30_sub1.anInt1295, class30_sub1.anInt1297, class30_sub1.anInt1298);
  8221.         if(class30_sub1.anInt1296 == 3)
  8222.             i = worldController.method303(class30_sub1.anInt1295, class30_sub1.anInt1297, class30_sub1.anInt1298);
  8223.         if(i != 0)
  8224.         {
  8225.             int i1 = worldController.method304(class30_sub1.anInt1295, class30_sub1.anInt1297, class30_sub1.anInt1298, i);
  8226.             j = i >> 14 & 0x7fff;
  8227.             k = i1 & 0x1f;
  8228.             l = i1 >> 6;
  8229.         }
  8230.         class30_sub1.anInt1299 = j;
  8231.         class30_sub1.anInt1301 = k;
  8232.         class30_sub1.anInt1300 = l;
  8233.     }
  8234.  
  8235.     private void method90() {
  8236.         for (int i = 0; i < anInt1062; i++)
  8237.             if (anIntArray1250[i] <= 0) {
  8238.                 boolean flag1 = false;
  8239.                 try {
  8240.                     if (anIntArray1207[i] == anInt874
  8241.                             && anIntArray1241[i] == anInt1289) {
  8242.                         if (!replayWave())
  8243.                             flag1 = true;
  8244.                     } else {
  8245.                         Stream stream = Sounds.method241(anIntArray1241[i],
  8246.                                 anIntArray1207[i]);
  8247.                         if (System.currentTimeMillis()
  8248.                                 + (long) (stream.currentOffset / 22) > aLong1172
  8249.                                 + (long) (anInt1257 / 22)) {
  8250.                             anInt1257 = stream.currentOffset;
  8251.                             aLong1172 = System.currentTimeMillis();
  8252.                             if (saveWave(stream.buffer, stream.currentOffset)) {
  8253.                                 anInt874 = anIntArray1207[i];
  8254.                                 anInt1289 = anIntArray1241[i];
  8255.                             } else {
  8256.                                 flag1 = true;
  8257.                             }
  8258.                         }
  8259.                     }
  8260.                 } catch (Exception exception) {
  8261.                 }
  8262.                 if (!flag1 || anIntArray1250[i] == -5) {
  8263.                     anInt1062--;
  8264.                     for (int j = i; j < anInt1062; j++) {
  8265.                         anIntArray1207[j] = anIntArray1207[j + 1];
  8266.                         anIntArray1241[j] = anIntArray1241[j + 1];
  8267.                         anIntArray1250[j] = anIntArray1250[j + 1];
  8268.                     }
  8269.  
  8270.                     i--;
  8271.                 } else {
  8272.                     anIntArray1250[i] = -5;
  8273.                 }
  8274.             } else {
  8275.                 anIntArray1250[i]--;
  8276.             }
  8277.  
  8278.         if (prevSong > 0) {
  8279.             prevSong -= 20;
  8280.             if (prevSong < 0)
  8281.                 prevSong = 0;
  8282.             if (prevSong == 0 && musicEnabled && !lowMem) {
  8283.                 nextSong = currentSong;
  8284.                 songChanging = true;
  8285.                 onDemandFetcher.method558(2, nextSong);
  8286.             }
  8287.         }
  8288.     }
  8289.  
  8290.     private boolean replayWave() {
  8291.         return signlink.wavereplay();
  8292.     }
  8293.  
  8294.     private boolean saveWave(byte abyte0[], int i) {
  8295.         return abyte0 == null || signlink.wavesave(abyte0, i);
  8296.     }
  8297.  
  8298.     void startUp()
  8299.     {
  8300.         //drawLoadingText(20, "Loading Deathlypvpz...");
  8301.         new CacheDownloader(this).downloadCache();
  8302.         setNewMaps();
  8303.         //maps();
  8304.         //drawLoadingText(40, "Checking models");  
  8305.        
  8306.     if(signlink.sunjava)
  8307.             super.minDelay = 5;
  8308.         if(aBoolean993)
  8309.         {
  8310.  //        rsAlreadyLoaded = true;
  8311.  //        return;
  8312.         }
  8313.         aBoolean993 = true;
  8314.         boolean flag = true;
  8315.         String s = getDocumentBaseHost();
  8316.         if(signlink.cache_dat != null)
  8317.         {
  8318.             for(int i = 0; i < 5; i++)
  8319.                 decompressors[i] = new Decompressor(signlink.cache_dat, signlink.cache_idx[i], i + 1);
  8320.         }
  8321.         try {
  8322.        
  8323.             titleStreamLoader = streamLoaderForName(1, "title screen", "title", expectedCRCs[1], 25);
  8324.             smallFont = new TextDrawingArea(false, "p11_full", titleStreamLoader);
  8325.             normalFont = new TextDrawingArea(false, "p12_full", titleStreamLoader);
  8326.             boldFont = new TextDrawingArea(false, "b12_full", titleStreamLoader);
  8327.             fancyFont = new TextDrawingArea(true, "q8_full", titleStreamLoader);//new CLIENT*/
  8328.  
  8329.  
  8330.             bigHit = new TextDrawingArea(true, "critical_full", titleStreamLoader);
  8331.             newSmallFont = new RSFont(false, "p11_full", titleStreamLoader);
  8332.             newRegularFont = new RSFont(false, "p12_full", titleStreamLoader);
  8333.             newBoldFont = new RSFont(false, "b12_full", titleStreamLoader);
  8334.             newFancyFont = new RSFont(true, "q8_full", titleStreamLoader);
  8335.             newSmallFont.unpackChatImages(chatImages);
  8336.             newRegularFont.unpackChatImages(chatImages);
  8337.             newBoldFont.unpackChatImages(chatImages);
  8338.             newFancyFont.unpackChatImages(chatImages);
  8339.             drawLogo();
  8340.             loadTitleScreen();
  8341.             StreamLoader configArchive = streamLoaderForName(2, "config", "config", expectedCRCs[2], 30);
  8342.             StreamLoader interfaceArchive = streamLoaderForName(3, "interface", "interface", expectedCRCs[3], 35);
  8343.             StreamLoader mediaArchive = streamLoaderForName(4, "2d graphics", "media", expectedCRCs[4], 40);
  8344.             StreamLoader textureArchive = streamLoaderForName(6, "textures", "textures", expectedCRCs[6], 45);
  8345.             StreamLoader chatFilterArchive = streamLoaderForName(7, "chat system", "wordenc", expectedCRCs[7], 50);
  8346.             StreamLoader soundArchive = streamLoaderForName(8, "sound effects", "sounds", expectedCRCs[8], 55);
  8347.                         for (int l4 = 0; l4 < 2; l4++) {
  8348.                 chatImages[l4] = new Sprite(mediaArchive, "mod_icons", l4);
  8349.             }
  8350.             byteGroundArray = new byte[4][104][104];
  8351.             intGroundArray = new int[4][105][105];
  8352.             worldController = new WorldController(intGroundArray);
  8353.             for(int j = 0; j < 4; j++)
  8354.                 aClass11Array1230[j] = new Class11();
  8355.             miniMapImage = new Sprite(512, 512);
  8356.             StreamLoader streamLoader_6 = streamLoaderForName(5, "update list", "versionlist", expectedCRCs[5], 60);
  8357.             drawLoadingText(60, "");
  8358.            
  8359.         //  maps();
  8360.         //  repackCacheIndex(4);
  8361.             onDemandFetcher = new OnDemandFetcher();
  8362.             onDemandFetcher.start(streamLoader_6, this);
  8363.             Class36.method528(onDemandFetcher.getAnimCount());
  8364.             Model.method459(onDemandFetcher.getModelCount(), onDemandFetcher);
  8365.             preloadModels();
  8366.             if(!lowMem) {
  8367.                 //nextSong = 0;
  8368.                 //try {
  8369.                 //  nextSong = Integer.parseInt(getParameter("music"));
  8370.                 //  stopMidi();
  8371.                 //}
  8372.  
  8373.                 //catch(Exception _ex) { }
  8374.                 //songChanging = true;
  8375.                 //onDemandFetcher.method558(2, nextSong);
  8376.                 //stopMidi();
  8377.                 while(onDemandFetcher.getNodeCount() > 0) {
  8378.                     processOnDemandQueue();
  8379.                     try {
  8380.                         Thread.sleep(100L);
  8381.                     } catch(Exception _ex) {
  8382.                    
  8383.                     }
  8384.                     if(onDemandFetcher.anInt1349 > 3) {
  8385.                         loadError();
  8386.                         return;
  8387.                     }
  8388.                 }
  8389.             }
  8390.             drawLoadingText(65, "");
  8391.             DataBase.loadAnimations();
  8392.             drawLoadingText(70, "");
  8393.             //models();
  8394.             //DataBase.loadObjects(); //Just checking somthing
  8395.             //DataBase.loadModels();
  8396.             drawLoadingText(80, "");
  8397.             /* Custom sprite unpacking */
  8398.                             loginBox = new Sprite("title");
  8399.                 loginBoxHover = new Sprite("box_hover");
  8400.                 loginHover = new Sprite("login_hover");
  8401.                                 CrownName = new Sprite("CrownName");
  8402.                 loginHoverWorld = new Sprite("login_hover2");
  8403.             infinityIcon = new Sprite("infinity");
  8404.             for(int ig = 0; ig < chatArea.length; ig++)
  8405.                 chatArea[ig] = new Sprite("chatarea " + ig);
  8406.             for(int iiig = 0; iiig < tabArea.length; iiig++)
  8407.                 tabArea[iiig] = new Sprite("tabarea " + iiig);
  8408.            
  8409.             HPBarFull = new Sprite("HITPOINTS_0");
  8410.             HPBarEmpty = new Sprite("HITPOINTS_1");
  8411.            
  8412.             mapArea = new Sprite("maparea");
  8413.             backgroundFix = new Sprite("background");
  8414.             magicAuto = new Sprite("autocast");
  8415.             loadOrbs();
  8416.             multiOverlay = new Sprite(mediaArchive, "overlay_multiway", 0);
  8417.             /**/
  8418.             for(int i = 0; i < mapBack.length; i++)
  8419.                 mapBack[i] = new Background(mediaArchive, "mapback", i);
  8420.            
  8421.             for(int j5 = 0; j5 < tabAreaSprite.length; j5++)
  8422.                 tabAreaSprite[j5] = new Sprite("tabarea " + j5);
  8423.                
  8424.             for(int c1 = 0; c1 <= 3; c1++)
  8425.                 chatButtons[c1] = new Sprite(mediaArchive, "chatbuttons", c1);
  8426.                
  8427.             for(int loop = 0; loop < inventoryStones.length; loop++)
  8428.                 inventoryStones[loop] = new Sprite("sideicon/inventorystones " + loop);
  8429.                
  8430.             for(int j3 = 0; j3 < sideIcons.length; j3++)
  8431.                 sideIcons[j3] = new Sprite("sideicon/sideicons " + j3);
  8432.             compass = new Sprite(mediaArchive, "compass", 0);
  8433.  
  8434.             for(int j78 = 0; j78 < exitButton.length; j78++)
  8435.                 exitButton[j78] = new Sprite("exit " + j78);
  8436.  
  8437.             for(int j79 = 0; j79 < advisorButton.length; j79++)
  8438.                 advisorButton[j79] = new Sprite("advisor " + j79);
  8439.            
  8440.             for(int ghtr = 0; ghtr < worldMapIcon.length; ghtr++)
  8441.                 worldMapIcon[ghtr] = new Sprite("mapIcon " + ghtr);
  8442.            
  8443.             for(int i4 = 0; i4 < hitMarkBacks.length; i4++)
  8444.                 for(int i5 = 0; i5 < hitMarkBacks[0].length; i5++)
  8445.                     for(int i6 = 0; i6 < hitMarkBacks[0][0].length; i6++)
  8446.                         hitMarkBacks[i4][i5][i6] = new Sprite("/hits/back/" + i4 + "/"+ i5 +"/hit " + i6);
  8447.                
  8448.             for(int i4 = 0; i4 < hitMarkIcons.length; i4++)
  8449.                 hitMarkIcons[i4] = new Sprite("/Hits/icons/icon " + i4);
  8450.            
  8451.             emptyOrb = new Sprite("emptyorb");
  8452.             emptyFOrb = new Sprite("emptyforb");
  8453.             hoveredEmpty = new Sprite("hoveredempty");
  8454.             hoveredFEmpty = new Sprite("hoveredfempty");
  8455.             runIcon1 = new Sprite("runicon1");
  8456.             runIcon2 = new Sprite("runicon2");
  8457.             runOrb1 = new Sprite("runorb1");
  8458.             runOrb2 = new Sprite("runorb2");
  8459.             hitPointsFill = new Sprite("hitpointsfill");
  8460.             hitPointsIcon = new Sprite("hitpointsicon");
  8461.             prayerFill = new Sprite("prayerfill");
  8462.             prayerIcon = new Sprite("prayericon");
  8463.             mapEdge = new Sprite(mediaArchive, "mapedge", 0);
  8464.             mapEdge.method345();
  8465.             try
  8466.             {
  8467.                 for(int i = 0; i < XPcounterSprite.length; i++)
  8468.                     XPcounterSprite[i] = new Sprite("xp/XP " + i);
  8469.             }
  8470.             catch(Exception _ex) {}
  8471.             try
  8472.             {
  8473.                 for(int k3 = 0; k3 < 100; k3++)
  8474.                     mapScenes[k3] = new Background(mediaArchive, "mapscene", k3);
  8475.             }
  8476.             catch(Exception _ex) { }
  8477.             try
  8478.             {
  8479.                 for(int l3 = 0; l3 < 100; l3++)
  8480.                     mapFunctions[l3] = new Sprite(mediaArchive, "mapfunction", l3);
  8481.             }
  8482.             catch(Exception _ex) { }
  8483.             try
  8484.             {
  8485.                 for(int h1 = 0; h1 < 6; h1++)
  8486.                     headIconsHint[h1] = new Sprite(mediaArchive, "headicons_hint", h1);
  8487.             } catch(Exception _ex) { }
  8488.             try {
  8489.                 for(int j4 = 0; j4 < 18; j4++)
  8490.                     //headIcons[j4] = new Sprite(mediaArchive, "headicons_prayer", j4);
  8491.                     headIcons[j4] = new Sprite("curses/Prayer "+j4);
  8492.                 for(int j45 = 0; j45 < 3; j45++)
  8493.                     skullIcons[j45] = new Sprite(mediaArchive, "headicons_pk", j45 );
  8494.                 for(int j45 = 9; j45 < 17; j45++)
  8495.                     cursesIcons[j45] = new Sprite("curses/Prayer "+j45);               
  8496.                    
  8497.             }
  8498.             catch(Exception _ex) { }
  8499.             mapFlag = new Sprite(mediaArchive, "mapmarker", 0);
  8500.             mapMarker = new Sprite(mediaArchive, "mapmarker", 1);
  8501.             for(int k4 = 0; k4 < 8; k4++)
  8502.                 crosses[k4] = new Sprite(mediaArchive, "cross", k4);
  8503.  
  8504.             mapDotItem = new Sprite(mediaArchive, "mapdots", 0);
  8505.             mapDotNPC = new Sprite(mediaArchive, "mapdots", 1);
  8506.             mapDotPlayer = new Sprite(mediaArchive, "mapdots", 2);
  8507.             mapDotFriend = new Sprite(mediaArchive, "mapdots", 3);
  8508.             mapDotTeam = new Sprite(mediaArchive, "mapdots", 4);
  8509.             mapDotClan = new Sprite(mediaArchive, "mapdots", 5);
  8510.                         alertBack = new Sprite("alertback");
  8511.             alertBorder = new Sprite("alertborder");
  8512.             alertBorderH = new Sprite("alertborderh");
  8513.  
  8514.             for(int loop = 0; loop < scrollBar.length; loop++)
  8515.                 scrollBar[loop] = new Sprite("./scrollbar/scrollbar " + loop);
  8516.            
  8517.             for(int loop = 0; loop < scrollArrow.length; loop++)
  8518.                 scrollArrow[loop] = new Sprite("./scrollbar/scrollArrow " + loop);
  8519.            
  8520.             rightFrameSprite = new Sprite(mediaArchive, "screenframe", 2);
  8521.            
  8522.             for(int l4 = 0; l4 < modIcons.length; l4++)
  8523.                 modIcons[l4] = new Background(mediaArchive, "mod_icons", l4);
  8524.  
  8525.             Sprite sprite = new Sprite(mediaArchive, "screenframe", 0);
  8526.             leftFrame = new RSImageProducer(sprite.myWidth, sprite.myHeight, getGameComponent());
  8527.             sprite.method346(0, 0);
  8528.             sprite = new Sprite(mediaArchive, "screenframe", 1);
  8529.             topFrame = new RSImageProducer(sprite.myWidth, sprite.myHeight, getGameComponent());
  8530.             sprite.method346(0, 0);
  8531.             sprite = new Sprite(mediaArchive, "mapedge", 0);
  8532.             mapEdgeIP = new RSImageProducer(sprite.myWidth, sprite.myHeight, getGameComponent());
  8533.             sprite.method346(0, 0);
  8534.  
  8535.             int i5 = (int)(Math.random() * 21D) - 10;
  8536.             int j5 = (int)(Math.random() * 21D) - 10;
  8537.             int k5 = (int)(Math.random() * 21D) - 10;
  8538.             int l5 = (int)(Math.random() * 41D) - 20;
  8539.             for(int functionIndex = 0; functionIndex < 100; functionIndex++) {
  8540.                 if(mapFunctions[functionIndex] != null)
  8541.                     mapFunctions[functionIndex].method344(i5 + l5, j5 + l5, k5 + l5);
  8542.                 if(mapScenes[functionIndex] != null)
  8543.                     mapScenes[functionIndex].method360(i5 + l5, j5 + l5, k5 + l5);
  8544.             }
  8545.             drawLoadingText(82, "");
  8546.             drawLoadingText(86, "");
  8547.             Texture.method368(textureArchive);
  8548.             Texture.method372(0.80000000000000004D);
  8549.             Texture.method367();
  8550.             drawLoadingText(88, "");
  8551.             Animation.unpackConfig(configArchive);
  8552.             ObjectDef.unpackConfig(configArchive);
  8553.             Flo.unpackConfig(configArchive);
  8554.             ItemDef.unpackConfig(configArchive);
  8555.             EntityDef.unpackConfig(configArchive);
  8556.             IDK.unpackConfig(configArchive);
  8557.             SpotAnim.unpackConfig(configArchive);
  8558.             Varp.unpackConfig(configArchive);
  8559.             VarBit.unpackConfig(configArchive);
  8560.             ItemDef.isMembers = isMembers;
  8561.             if(!lowMem)
  8562.             {
  8563.                 drawLoadingText(90, "");
  8564.                 byte abyte0[] = soundArchive.getDataForName("sounds.dat");
  8565.                
  8566.                 Stream stream = new Stream(abyte0);
  8567.                 Sounds.unpack(stream);
  8568.                
  8569.             }
  8570.             drawLoadingText(93, "");
  8571.             TextDrawingArea allFonts[] = {
  8572.                     smallFont, normalFont, boldFont, fancyFont
  8573.             };
  8574. /*RSFont allFonts[] = { NEW INTERFACES TEXT ENGINE
  8575.                     newSmallFont, newRegularFont, newBoldFont, newFancyFont
  8576.             };*/
  8577.             RSInterface.fonts = allFonts;
  8578.             RSInterface.unpack(interfaceArchive, allFonts, mediaArchive);
  8579.             drawLoadingText(97, "");
  8580.             RSInterface.unpackCustom(interfaceArchive, allFonts);
  8581.             /*
  8582.             //Taken this out, causing seirous lag -.-
  8583.             for(int derp = 0; derp < 25000; derp++)
  8584.             {
  8585.                 ItemDef itemdef = ItemDef.forID(derp);
  8586.                 writeTemp(itemdef.name);
  8587.             }*/
  8588.             drawLoadingText(100, "");
  8589.             readDetails();
  8590.             renderMapAndCompassHalfs();
  8591.             load3DArea();
  8592.             Censor.loadConfig(chatFilterArchive);
  8593.             mouseDetection = new MouseDetection(this);
  8594.             startRunnable(mouseDetection, 10);
  8595.             Animable_Sub5.clientInstance = this;
  8596.             ObjectDef.clientInstance = this;
  8597.             EntityDef.clientInstance = this;
  8598.             System.gc();
  8599.             return;
  8600.         } catch(Exception exception) {
  8601.             signlink.reporterror("loaderror " + aString1049 + " " + anInt1079);
  8602.             exception.printStackTrace();
  8603.         }
  8604.         loadingError = true;
  8605.     }
  8606.    
  8607.     public void renderMapAndCompassHalfs() {
  8608.         for(int loopHeight = 0; loopHeight < 33; loopHeight++) {
  8609.             int k6 = 999;
  8610.             int loopWidth = 0;
  8611.             for(; loopWidth < 33; loopWidth++) {
  8612.                 if(mapBack[2].aByteArray1450[loopWidth + loopHeight * 33] == 0) {
  8613.                     if(k6 == 999)
  8614.                         k6 = loopWidth;
  8615.                     continue;
  8616.                 }
  8617.                 if(k6 == 999)
  8618.                     continue;
  8619.                 break;
  8620.             }
  8621.             compassPixelCutLeft[loopHeight] = k6;//left ( it's heigth)
  8622.             compassPixelCutRight[loopHeight] = loopWidth - k6;//right (it's width)
  8623.         }
  8624.         for(int loopHeight = 0; loopHeight < 152; loopHeight++) {
  8625.             int j7 = 999;
  8626.             int finalWidth = 0;
  8627.             for(int loopWidth = 0; loopWidth < 152; loopWidth++) {
  8628.                 if(mapBack[1].aByteArray1450[loopWidth + loopHeight * 152] == 0) {
  8629.                     if(j7 == 999)
  8630.                         j7 = loopWidth;
  8631.                     continue;
  8632.                 }
  8633.                 if(j7 == 999)
  8634.                     continue;
  8635.                 finalWidth = loopWidth;//999 - 999 = 0
  8636.                 break;
  8637.             }
  8638.  
  8639.             mapImagePixelCutLeft[loopHeight - 0] = j7 - 0;
  8640.             if((finalWidth - j7) == 0) {
  8641.                 finalWidth = 152;
  8642.                 j7 = 0;
  8643.             }
  8644.             mapImagePixelCutRight[loopHeight - 0] = finalWidth - j7;
  8645.         }
  8646.     }
  8647.    
  8648.     public static void writeTemp(String tempData) {
  8649.         try {
  8650.             BufferedWriter bw = new BufferedWriter(new FileWriter("./derp.txt", true));
  8651.             bw.write(tempData);
  8652.             bw.newLine();
  8653.             bw.flush();
  8654.         } catch(IOException IOE) {}
  8655.     }
  8656.    
  8657.     private void method91(Stream stream, int i)
  8658.     {
  8659.         while(stream.bitPosition + 10 < i * 8)
  8660.         {
  8661.             int j = stream.readBits(11);
  8662.             if(j == 2047)
  8663.                 break;
  8664.             if(playerArray[j] == null)
  8665.             {
  8666.                 playerArray[j] = new Player();
  8667.                 if(aStreamArray895s[j] != null)
  8668.                     playerArray[j].updatePlayer(aStreamArray895s[j]);
  8669.             }
  8670.             playerIndices[playerCount++] = j;
  8671.             Player player = playerArray[j];
  8672.             player.anInt1537 = loopCycle;
  8673.             int k = stream.readBits(1);
  8674.             if(k == 1)
  8675.                 anIntArray894[anInt893++] = j;
  8676.             int l = stream.readBits(1);
  8677.             int i1 = stream.readBits(5);
  8678.             if(i1 > 15)
  8679.                 i1 -= 32;
  8680.             int j1 = stream.readBits(5);
  8681.             if(j1 > 15)
  8682.                 j1 -= 32;
  8683.             player.setPos(myPlayer.smallX[0] + j1, myPlayer.smallY[0] + i1, l == 1);
  8684.         }
  8685.         stream.finishBitAccess();
  8686.     }
  8687.  
  8688.     private int mapDrawAreaX = 0;
  8689.     private int mapDrawAreaY = 516;
  8690.     private int mapPaddingFromTop = toggleFullscreen ? 5 : 9;
  8691.     private int mapPaddingFromLeft = toggleFullscreen ? 5 : 35;
  8692.     private int mapPaddingFromBottom = toggleFullscreen ? 5 : 7;
  8693.     private int mapPaddingFromRight = toggleFullscreen ? 5 : 62;
  8694.     private int miniMapWidth = toggleFullscreen ? 163 : 249;//172
  8695.     private int miniMapHeight = toggleFullscreen ? 163 : 168;//156
  8696.     private int mapSpritesX = 107;
  8697.     private int mapSpritesY = 88;
  8698.     private int mapMovedX = 29;
  8699.     private int mapMovedY = 4;
  8700.    
  8701.     int mapInnerSizeWidth = miniMapWidth - (mapPaddingFromLeft + mapPaddingFromRight);
  8702.     int mapInnerSizeHeight = miniMapHeight - (mapPaddingFromTop + mapPaddingFromBottom);
  8703.    
  8704.     private void processMinimapClick(int paddingX,int paddingY) {
  8705.         if(minimapCover != 0)
  8706.             return;
  8707.         if(super.clickMode3 == 1)
  8708.         {
  8709.             int mapClickX = super.saveClickX - mapPaddingFromLeft - mapDrawAreaY -  paddingX;
  8710.             int mapClickY = super.saveClickY - mapPaddingFromTop - mapDrawAreaX -  paddingY;
  8711.             if(mapClickX >= 0 && mapClickY >= 0 && mapClickX < mapInnerSizeWidth && mapClickY < mapInnerSizeHeight)
  8712.             {
  8713.                 mapClickX -= 73;
  8714.                 mapClickY -= 75;
  8715.                 int k = compassRotation + mapAmtDiffRotation & 0x7ff;
  8716.                 int i1 = Texture.anIntArray1470[k];
  8717.                 int j1 = Texture.anIntArray1471[k];
  8718.                 i1 = i1 * (mapAmtDiffZoom + 256) >> 8;
  8719.                 j1 = j1 * (mapAmtDiffZoom + 256) >> 8;
  8720.                 int k1 = mapClickY * i1 + mapClickX * j1 >> 11;
  8721.                 int l1 = mapClickY * j1 - mapClickX * i1 >> 11;
  8722.                 int i2 = myPlayer.x + k1 >> 7;
  8723.                 int j2 = myPlayer.y - l1 >> 7;
  8724.                 boolean flag1 = doWalkTo(1, 0, 0, 0, myPlayer.smallY[0], 0, 0, j2, myPlayer.smallX[0], true, i2);
  8725.                 if(flag1)
  8726.                 {
  8727.                     stream.writeWordBigEndian(mapClickX);
  8728.                     stream.writeWordBigEndian(mapClickY);
  8729.                     stream.writeWord(compassRotation);
  8730.                     stream.writeWordBigEndian(57);
  8731.                     stream.writeWordBigEndian(mapAmtDiffRotation);
  8732.                     stream.writeWordBigEndian(mapAmtDiffZoom);
  8733.                     stream.writeWordBigEndian(89);
  8734.                     stream.writeWord(myPlayer.x);
  8735.                     stream.writeWord(myPlayer.y);
  8736.                     stream.writeWordBigEndian(anInt1264);
  8737.                     stream.writeWordBigEndian(63);
  8738.                 }
  8739.             }
  8740.             anInt1117++;
  8741.             if(anInt1117 > 1151)
  8742.             {
  8743.                 anInt1117 = 0;
  8744.                 stream.createFrame(246);
  8745.                 stream.writeWordBigEndian(0);
  8746.                 int l = stream.currentOffset;
  8747.                 if((int)(Math.random() * 2D) == 0)
  8748.                     stream.writeWordBigEndian(101);
  8749.                 stream.writeWordBigEndian(197);
  8750.                 stream.writeWord((int)(Math.random() * 65536D));
  8751.                 stream.writeWordBigEndian((int)(Math.random() * 256D));
  8752.                 stream.writeWordBigEndian(67);
  8753.                 stream.writeWord(14214);
  8754.                 if((int)(Math.random() * 2D) == 0)
  8755.                     stream.writeWord(29487);
  8756.                 stream.writeWord((int)(Math.random() * 65536D));
  8757.                 if((int)(Math.random() * 2D) == 0)
  8758.                     stream.writeWordBigEndian(220);
  8759.                 stream.writeWordBigEndian(180);
  8760.                 stream.writeBytes(stream.currentOffset - l);
  8761.             }
  8762.         }
  8763.     }
  8764.  
  8765.     private String interfaceIntToString(int j) {
  8766.         if(j < 0x3b9ac9ff)
  8767.             return String.valueOf(j);
  8768.         else
  8769.             return "*";
  8770.     }
  8771.  
  8772.     private void showErrorScreen()
  8773.     {
  8774.         Graphics g = getGameComponent().getGraphics();
  8775.         g.setColor(Color.black);
  8776.         g.fillRect(0, 0, 765, 503);
  8777.         method4(1);
  8778.         if(loadingError)
  8779.         {
  8780.             aBoolean831 = false;
  8781.             g.setFont(new Font("Helvetica", 1, 16));
  8782.             g.setColor(Color.yellow);
  8783.             int k = 35;
  8784.             g.drawString("Sorry, an error has occured whilst loading Deathlypvpz", 30, k);
  8785.             k += 50;
  8786.             g.setColor(Color.white);
  8787.             g.drawString("To fix this try the following (in order):", 30, k);
  8788.             k += 50;
  8789.             g.setColor(Color.white);
  8790.             g.setFont(new Font("Helvetica", 1, 12));
  8791.             g.drawString("1: Try closing ALL open web-browser windows, and reloading", 30, k);
  8792.             k += 30;
  8793.             g.drawString("2: Try clearing your web-browsers cache from tools->internet options", 30, k);
  8794.             k += 30;
  8795.             g.drawString("3: Try using a different game-world", 30, k);
  8796.             k += 30;
  8797.             g.drawString("4: Try rebooting your computer", 30, k);
  8798.             k += 30;
  8799.             g.drawString("5: Try selecting a different version of Java from the play-game menu", 30, k);
  8800.         }
  8801.         if(genericLoadingError)
  8802.         {
  8803.             aBoolean831 = false;
  8804.             g.setFont(new Font("Helvetica", 1, 20));
  8805.             g.setColor(Color.white);
  8806.             g.drawString("Error - unable to load game!", 50, 50);
  8807.             g.drawString("To play Deathlypvpz make sure you play from", 50, 100);
  8808.             g.drawString("http://www.deathlypvpz.net", 50, 150);
  8809.         }
  8810.         if(rsAlreadyLoaded)
  8811.         {
  8812.             aBoolean831 = false;
  8813.             g.setColor(Color.yellow);
  8814.             int l = 35;
  8815.             g.drawString("Error a copy of Deathlypvpz already appears to be loaded", 30, l);
  8816.             l += 50;
  8817.             g.setColor(Color.white);
  8818.             g.drawString("To fix this try the following (in order):", 30, l);
  8819.             l += 50;
  8820.             g.setColor(Color.white);
  8821.             g.setFont(new Font("Helvetica", 1, 12));
  8822.             g.drawString("1: Try closing ALL open web-browser windows, and reloading", 30, l);
  8823.             l += 30;
  8824.             g.drawString("2: Try rebooting your computer, and reloading", 30, l);
  8825.             l += 30;
  8826.         }
  8827.     }
  8828.  
  8829.     public URL getCodeBase() {     
  8830.         try {
  8831.             return new URL(serverip +":" + (80 + portOff));
  8832.         } catch(Exception _ex) {
  8833.         }
  8834.         return null;
  8835.     }
  8836.  
  8837.     private void method95() {
  8838.         for(int j = 0; j < npcCount; j++) {
  8839.             int k = npcIndices[j];
  8840.             NPC npc = npcArray[k];
  8841.             if(npc != null)
  8842.                 method96(npc);
  8843.         }
  8844.     }
  8845.  
  8846.     private void method96(Entity entity)
  8847.     {
  8848.         if(entity.x < 128 || entity.y < 128 || entity.x >= 13184 || entity.y >= 13184)
  8849.         {
  8850.             entity.anim = -1;
  8851.             entity.anInt1520 = -1;
  8852.             entity.anInt1547 = 0;
  8853.             entity.anInt1548 = 0;
  8854.             entity.x = entity.smallX[0] * 128 + entity.anInt1540 * 64;
  8855.             entity.y = entity.smallY[0] * 128 + entity.anInt1540 * 64;
  8856.             entity.method446();
  8857.         }
  8858.         if(entity == myPlayer && (entity.x < 1536 || entity.y < 1536 || entity.x >= 11776 || entity.y >= 11776))
  8859.         {
  8860.             entity.anim = -1;
  8861.             entity.anInt1520 = -1;
  8862.             entity.anInt1547 = 0;
  8863.             entity.anInt1548 = 0;
  8864.             entity.x = entity.smallX[0] * 128 + entity.anInt1540 * 64;
  8865.             entity.y = entity.smallY[0] * 128 + entity.anInt1540 * 64;
  8866.             entity.method446();
  8867.         }
  8868.         if(entity.anInt1547 > loopCycle)
  8869.             method97(entity);
  8870.         else
  8871.         if(entity.anInt1548 >= loopCycle)
  8872.             method98(entity);
  8873.         else
  8874.             method99(entity);
  8875.         method100(entity);
  8876.         method101(entity);
  8877.     }
  8878.  
  8879.     private void method97(Entity entity)
  8880.     {
  8881.         int i = entity.anInt1547 - loopCycle;
  8882.         int j = entity.anInt1543 * 128 + entity.anInt1540 * 64;
  8883.         int k = entity.anInt1545 * 128 + entity.anInt1540 * 64;
  8884.         entity.x += (j - entity.x) / i;
  8885.         entity.y += (k - entity.y) / i;
  8886.         entity.anInt1503 = 0;
  8887.         if(entity.anInt1549 == 0)
  8888.             entity.turnDirection = 1024;
  8889.         if(entity.anInt1549 == 1)
  8890.             entity.turnDirection = 1536;
  8891.         if(entity.anInt1549 == 2)
  8892.             entity.turnDirection = 0;
  8893.         if(entity.anInt1549 == 3)
  8894.             entity.turnDirection = 512;
  8895.     }
  8896.  
  8897.     private void method98(Entity entity)
  8898.     {
  8899.         if(entity.anInt1548 == loopCycle || entity.anim == -1 || entity.anInt1529 != 0 || entity.anInt1528 + 1 > Animation.anims[entity.anim].method258(entity.anInt1527))
  8900.         {
  8901.             int i = entity.anInt1548 - entity.anInt1547;
  8902.             int j = loopCycle - entity.anInt1547;
  8903.             int k = entity.anInt1543 * 128 + entity.anInt1540 * 64;
  8904.             int l = entity.anInt1545 * 128 + entity.anInt1540 * 64;
  8905.             int i1 = entity.anInt1544 * 128 + entity.anInt1540 * 64;
  8906.             int j1 = entity.anInt1546 * 128 + entity.anInt1540 * 64;
  8907.             entity.x = (k * (i - j) + i1 * j) / i;
  8908.             entity.y = (l * (i - j) + j1 * j) / i;
  8909.         }
  8910.         entity.anInt1503 = 0;
  8911.         if(entity.anInt1549 == 0)
  8912.             entity.turnDirection = 1024;
  8913.         if(entity.anInt1549 == 1)
  8914.             entity.turnDirection = 1536;
  8915.         if(entity.anInt1549 == 2)
  8916.             entity.turnDirection = 0;
  8917.         if(entity.anInt1549 == 3)
  8918.             entity.turnDirection = 512;
  8919.         entity.anInt1552 = entity.turnDirection;
  8920.     }
  8921.  
  8922.     private void method99(Entity entity)
  8923.     {
  8924.         entity.anInt1517 = entity.anInt1511;
  8925.         if(entity.smallXYIndex == 0)
  8926.         {
  8927.             entity.anInt1503 = 0;
  8928.             return;
  8929.         }
  8930.         if(entity.anim != -1 && entity.anInt1529 == 0)
  8931.         {
  8932.             Animation animation = Animation.anims[entity.anim];
  8933.             if(entity.anInt1542 > 0 && animation.anInt363 == 0)
  8934.             {
  8935.                 entity.anInt1503++;
  8936.                 return;
  8937.             }
  8938.             if(entity.anInt1542 <= 0 && animation.anInt364 == 0)
  8939.             {
  8940.                 entity.anInt1503++;
  8941.                 return;
  8942.             }
  8943.         }
  8944.         int i = entity.x;
  8945.         int j = entity.y;
  8946.         int k = entity.smallX[entity.smallXYIndex - 1] * 128 + entity.anInt1540 * 64;
  8947.         int l = entity.smallY[entity.smallXYIndex - 1] * 128 + entity.anInt1540 * 64;
  8948.         if(k - i > 256 || k - i < -256 || l - j > 256 || l - j < -256)
  8949.         {
  8950.             entity.x = k;
  8951.             entity.y = l;
  8952.             return;
  8953.         }
  8954.         if(i < k)
  8955.         {
  8956.             if(j < l)
  8957.                 entity.turnDirection = 1280;
  8958.             else
  8959.             if(j > l)
  8960.                 entity.turnDirection = 1792;
  8961.             else
  8962.                 entity.turnDirection = 1536;
  8963.         } else
  8964.         if(i > k)
  8965.         {
  8966.             if(j < l)
  8967.                 entity.turnDirection = 768;
  8968.             else
  8969.             if(j > l)
  8970.                 entity.turnDirection = 256;
  8971.             else
  8972.                 entity.turnDirection = 512;
  8973.         } else
  8974.         if(j < l)
  8975.             entity.turnDirection = 1024;
  8976.         else
  8977.             entity.turnDirection = 0;
  8978.         int i1 = entity.turnDirection - entity.anInt1552 & 0x7ff;
  8979.         if(i1 > 1024)
  8980.             i1 -= 2048;
  8981.         int j1 = entity.anInt1555;
  8982.         if(i1 >= -256 && i1 <= 256)
  8983.             j1 = entity.anInt1554;
  8984.         else
  8985.         if(i1 >= 256 && i1 < 768)
  8986.             j1 = entity.anInt1557;
  8987.         else
  8988.         if(i1 >= -768 && i1 <= -256)
  8989.             j1 = entity.anInt1556;
  8990.         if(j1 == -1)
  8991.             j1 = entity.anInt1554;
  8992.         entity.anInt1517 = j1;
  8993.         int k1 = 4;
  8994.         if(entity.anInt1552 != entity.turnDirection && entity.interactingEntity == -1 && entity.anInt1504 != 0)
  8995.             k1 = 2;
  8996.         if(entity.smallXYIndex > 2)
  8997.             k1 = 6;
  8998.         if(entity.smallXYIndex > 3)
  8999.             k1 = 8;
  9000.         if(entity.anInt1503 > 0 && entity.smallXYIndex > 1)
  9001.         {
  9002.             k1 = 8;
  9003.             entity.anInt1503--;
  9004.         }
  9005.         if(entity.aBooleanArray1553[entity.smallXYIndex - 1])
  9006.             k1 <<= 1;
  9007.         if(k1 >= 8 && entity.anInt1517 == entity.anInt1554 && entity.anInt1505 != -1)
  9008.             entity.anInt1517 = entity.anInt1505;
  9009.         if(i < k)
  9010.         {
  9011.             entity.x += k1;
  9012.             if(entity.x > k)
  9013.                 entity.x = k;
  9014.         } else
  9015.         if(i > k)
  9016.         {
  9017.             entity.x -= k1;
  9018.             if(entity.x < k)
  9019.                 entity.x = k;
  9020.         }
  9021.         if(j < l)
  9022.         {
  9023.             entity.y += k1;
  9024.             if(entity.y > l)
  9025.                 entity.y = l;
  9026.         } else
  9027.         if(j > l)
  9028.         {
  9029.             entity.y -= k1;
  9030.             if(entity.y < l)
  9031.                 entity.y = l;
  9032.         }
  9033.         if(entity.x == k && entity.y == l)
  9034.         {
  9035.             entity.smallXYIndex--;
  9036.             if(entity.anInt1542 > 0)
  9037.                 entity.anInt1542--;
  9038.         }
  9039.     }
  9040.  
  9041.     private void method100(Entity entity)
  9042.     {
  9043.         if(entity.anInt1504 == 0)
  9044.             return;
  9045.         if(entity.interactingEntity != -1 && entity.interactingEntity < 32768)
  9046.         {
  9047.             NPC npc = npcArray[(entity.interactingEntity > npcArray.length) ? (npcArray.length-1) : entity.interactingEntity];
  9048.             if(npc != null)
  9049.             {
  9050.                 int i1 = entity.x - npc.x;
  9051.                 int k1 = entity.y - npc.y;
  9052.                 if(i1 != 0 || k1 != 0)
  9053.                     entity.turnDirection = (int)(Math.atan2(i1, k1) * 325.94900000000001D) & 0x7ff;
  9054.             }
  9055.         }
  9056.         if(entity.interactingEntity >= 32768)
  9057.         {
  9058.             int j = entity.interactingEntity - 32768;
  9059.             if(j == unknownInt10)
  9060.                 j = myPlayerIndex;
  9061.             Player player = playerArray[j];
  9062.             if(player != null)
  9063.             {
  9064.                 int l1 = entity.x - player.x;
  9065.                 int i2 = entity.y - player.y;
  9066.                 if(l1 != 0 || i2 != 0)
  9067.                     entity.turnDirection = (int)(Math.atan2(l1, i2) * 325.94900000000001D) & 0x7ff;
  9068.             }
  9069.         }
  9070.         if((entity.anInt1538 != 0 || entity.anInt1539 != 0) && (entity.smallXYIndex == 0 || entity.anInt1503 > 0))
  9071.         {
  9072.             int k = entity.x - (entity.anInt1538 - baseX - baseX) * 64;
  9073.             int j1 = entity.y - (entity.anInt1539 - baseY - baseY) * 64;
  9074.             if(k != 0 || j1 != 0)
  9075.                 entity.turnDirection = (int)(Math.atan2(k, j1) * 325.94900000000001D) & 0x7ff;
  9076.             entity.anInt1538 = 0;
  9077.             entity.anInt1539 = 0;
  9078.         }
  9079.         int l = entity.turnDirection - entity.anInt1552 & 0x7ff;
  9080.         if(l != 0)
  9081.         {
  9082.             if(l < entity.anInt1504 || l > 2048 - entity.anInt1504)
  9083.                 entity.anInt1552 = entity.turnDirection;
  9084.             else
  9085.             if(l > 1024)
  9086.                 entity.anInt1552 -= entity.anInt1504;
  9087.             else
  9088.                 entity.anInt1552 += entity.anInt1504;
  9089.             entity.anInt1552 &= 0x7ff;
  9090.             if(entity.anInt1517 == entity.anInt1511 && entity.anInt1552 != entity.turnDirection)
  9091.             {
  9092.                 if(entity.anInt1512 != -1)
  9093.                 {
  9094.                     entity.anInt1517 = entity.anInt1512;
  9095.                     return;
  9096.                 }
  9097.                 entity.anInt1517 = entity.anInt1554;
  9098.             }
  9099.         }
  9100.     }
  9101.  
  9102.     private void method101(Entity entity)
  9103.     {
  9104.         try {
  9105.             entity.aBoolean1541 = false;
  9106.             if(entity.anInt1517 != -1)
  9107.             {
  9108.                 Animation animation = Animation.anims[entity.anInt1517];
  9109.                 entity.anInt1519++;
  9110.                 if(entity.anInt1518 < animation.anInt352 && entity.anInt1519 > animation.method258(entity.anInt1518))
  9111.                 {
  9112.                     entity.anInt1519 = 0;
  9113.                     entity.anInt1518++;
  9114.                 }
  9115.                 if(entity.anInt1518 >= animation.anInt352)
  9116.                 {
  9117.                     entity.anInt1519 = 0;
  9118.                     entity.anInt1518 = 0;
  9119.                 }
  9120.             }
  9121.             if(entity.anInt1520 != -1 && loopCycle >= entity.anInt1523)
  9122.             {
  9123.                 if(entity.anInt1521 < 0)
  9124.                     entity.anInt1521 = 0;
  9125.                 Animation animation_1 = SpotAnim.cache[entity.anInt1520].aAnimation_407;
  9126.                 for(entity.anInt1522++; entity.anInt1521 < animation_1.anInt352 && entity.anInt1522 > animation_1.method258(entity.anInt1521); entity.anInt1521++)
  9127.                     entity.anInt1522 -= animation_1.method258(entity.anInt1521);
  9128.  
  9129.                 if(entity.anInt1521 >= animation_1.anInt352 && (entity.anInt1521 < 0 || entity.anInt1521 >= animation_1.anInt352))
  9130.                     entity.anInt1520 = -1;
  9131.             }
  9132.             if(entity.anim != -1 && entity.anInt1529 <= 1)
  9133.             {
  9134.                 Animation animation_2 = Animation.anims[entity.anim];
  9135.                 if(animation_2.anInt363 == 1 && entity.anInt1542 > 0 && entity.anInt1547 <= loopCycle && entity.anInt1548 < loopCycle)
  9136.                 {
  9137.                     entity.anInt1529 = 1;
  9138.                     return;
  9139.                 }
  9140.             }
  9141.             if(entity.anim != -1 && entity.anInt1529 == 0)
  9142.             {
  9143.                 Animation animation_3 = Animation.anims[entity.anim];
  9144.                 for(entity.anInt1528++; entity.anInt1527 < animation_3.anInt352 && entity.anInt1528 > animation_3.method258(entity.anInt1527); entity.anInt1527++)
  9145.                     entity.anInt1528 -= animation_3.method258(entity.anInt1527);
  9146.  
  9147.                 if(entity.anInt1527 >= animation_3.anInt352)
  9148.                 {
  9149.                     entity.anInt1527 -= animation_3.anInt356;
  9150.                     entity.anInt1530++;
  9151.                     if(entity.anInt1530 >= animation_3.anInt362)
  9152.                         entity.anim = -1;
  9153.                     if(entity.anInt1527 < 0 || entity.anInt1527 >= animation_3.anInt352)
  9154.                         entity.anim = -1;
  9155.                 }
  9156.                 entity.aBoolean1541 = animation_3.aBoolean358;
  9157.             }
  9158.             if(entity.anInt1529 > 0)
  9159.                 entity.anInt1529--;
  9160.         } catch(NullPointerException ex) {
  9161.            
  9162.         }
  9163.     }
  9164.  
  9165.     private void drawGameScreen()
  9166.     {
  9167.         if (fullscreenInterfaceID != -1 && (loadingStage == 2 || super.fullGameScreen != null)) {
  9168.             if (loadingStage == 2) {
  9169.                 method119(anInt945, fullscreenInterfaceID);
  9170.                 if (openInterfaceID != -1) {
  9171.                     method119(anInt945, openInterfaceID);
  9172.                 }
  9173.                 anInt945 = 0;
  9174.                 resetAllImageProducers();
  9175.                 super.fullGameScreen.initDrawingArea();
  9176.                 Texture.anIntArray1472 = fullScreenTextureArray;
  9177.                 DrawingArea.setAllPixelsToZero();
  9178.                 welcomeScreenRaised = true;
  9179.                 if (openInterfaceID != -1) {
  9180.                     RSInterface rsInterface_1 = RSInterface.interfaceCache[openInterfaceID];
  9181.                     if (rsInterface_1.width == 512 && rsInterface_1.height == 334 && rsInterface_1.type == 0) {
  9182.                         rsInterface_1.width = 765;
  9183.                         rsInterface_1.height = 503;
  9184.                     }
  9185.                     drawInterface(0, 0, rsInterface_1, 8);//used for fullscreen
  9186.                 }
  9187.                 RSInterface rsInterface = RSInterface.interfaceCache[fullscreenInterfaceID];
  9188.                 if (rsInterface.width == 512 && rsInterface.height == 334 && rsInterface.type == 0) {
  9189.                     rsInterface.width = 765;
  9190.                     rsInterface.height = 503;
  9191.                 }
  9192.                 drawInterface(0, 0, rsInterface, 8);
  9193.  
  9194.                 if (!contextMenuOpen) {
  9195.                     processRightClick();
  9196.                     drawTooltip();
  9197.                 } else {
  9198.                     drawMenu(4,4);
  9199.                 }
  9200.             }
  9201.             drawCount++;
  9202.             super.fullGameScreen.drawGraphics(0, super.graphics, 0);
  9203.             return;
  9204.         } else {
  9205.             if (drawCount != 0) {
  9206.                 resetImageProducers2();
  9207.             }
  9208.         }
  9209.         if(welcomeScreenRaised) {
  9210.             welcomeScreenRaised = false;
  9211.             if(!toggleFullscreen) {
  9212.                 topFrame.drawGraphics(0, super.graphics, 0);
  9213.                 leftFrame.drawGraphics(4, super.graphics, 0);
  9214.             }
  9215.             //mapAreaIP.drawGraphics(0, super.graphics, 519);
  9216.             //mapEdgeIP.drawGraphics(0, super.graphics, 519);
  9217.             needDrawTabArea = true;
  9218.             inputTaken = true;
  9219.             tabAreaAltered = true;
  9220.             aBoolean1233 = true;
  9221.             if(loadingStage != 2) {
  9222.                 main3DArea.drawGraphics(toggleFullscreen ? 0 : 4, super.graphics, toggleFullscreen ? 0 : 4);
  9223.                 mapBackImage.drawGraphics(mapDrawAreaX, super.graphics, mapDrawAreaY);
  9224.             }
  9225.         }
  9226.         if(contextMenuOpen)
  9227.             drawMenu(4,4);
  9228.         if(contextMenuOpen && menuScreenArea == 1)
  9229.             needDrawTabArea = true;
  9230.         if(invOverlayInterfaceID != -1)
  9231.         {
  9232.             boolean flag1 = method119(anInt945, invOverlayInterfaceID);
  9233.             if(flag1)
  9234.                 needDrawTabArea = true;
  9235.         }
  9236.         if(atInventoryInterfaceType == 2)
  9237.             needDrawTabArea = true;
  9238.         if(activeInterfaceType == 2)
  9239.             needDrawTabArea = true;
  9240.         if(!toggleFullscreen) {
  9241.             drawRightFrameArea();
  9242.             drawTabArea(sideTabArea,0,0);
  9243.             sideTabArea.drawGraphics(yPaddingtabBack, super.graphics, xPaddingtabBack);//519
  9244.             main3DArea.initDrawingArea();
  9245.         }
  9246.         if(backDialogID == -1)
  9247.         {
  9248.             aClass9_1059.scrollPosition = chatScrollTotalLength - anInt1089 - 110;
  9249.             if(super.mouseX > 497 && super.mouseX < 512 && super.mouseY > 342 + getChatBackIncreaseY())
  9250.                 method65(494, 110, super.mouseX - 0, super.mouseY - 348 - getChatBackIncreaseY(), aClass9_1059, 0, false, chatScrollTotalLength);
  9251.             int i = chatScrollTotalLength - 110 - aClass9_1059.scrollPosition;
  9252.             if(i < 0)
  9253.                 i = 0;
  9254.             if(i > chatScrollTotalLength - 110)
  9255.                 i = chatScrollTotalLength - 110;
  9256.             if(anInt1089 != i) {
  9257.                 anInt1089 = i;
  9258.                 inputTaken = true;
  9259.             }
  9260.         }
  9261.         if(backDialogID != -1) {
  9262.             boolean flag2 = method119(anInt945, backDialogID);
  9263.             if(flag2)
  9264.                 inputTaken = true;
  9265.         }
  9266.         if(atInventoryInterfaceType == 3)
  9267.             inputTaken = true;
  9268.         if(activeInterfaceType == 3)
  9269.             inputTaken = true;
  9270.         if(aString844 != null)
  9271.             inputTaken = true;
  9272.         if(contextMenuOpen && menuScreenArea == 2)
  9273.             inputTaken = true;
  9274.         if(inputTaken) {
  9275.             if(!toggleFullscreen) {
  9276.                 drawChatArea(toggleFullscreen ? main3DArea : chatBackImage,0,0);
  9277.                 chatBackImage.drawGraphics(yPaddingchatBackImage, super.graphics, xPaddingchatBackImage);
  9278.                 main3DArea.initDrawingArea();
  9279.             }
  9280.             inputTaken = false;
  9281.         }
  9282.         if(loadingStage == 2)
  9283.             method146();
  9284.         if(loadingStage == 2) {
  9285.             if(!toggleFullscreen) {
  9286.                 drawMinimap(mapBackImage,0,0);
  9287.                 mapBackImage.drawGraphics(yPaddingmapBackImage + getMapIncreaseY(), super.graphics, xPaddingmapBackImage + getMapIncreaseX());//545
  9288.             }
  9289.         }
  9290.         if(tabIconFlash != -1)
  9291.             tabAreaAltered = true;
  9292.         if(tabAreaAltered)
  9293.         {
  9294.             if(tabIconFlash != -1 && tabIconFlash == tabID)
  9295.             {
  9296.                 tabIconFlash = -1;
  9297.                 stream.createFrame(120);
  9298.                 stream.writeWordBigEndian(tabID);
  9299.             }
  9300.             tabAreaAltered = false;
  9301.             aRSImageProducer_1125.initDrawingArea();
  9302.             main3DArea.initDrawingArea();
  9303.         }
  9304.         anInt945 = 0;
  9305.     }
  9306.  
  9307.     private boolean buildFriendsListMenu(RSInterface class9)
  9308.     {
  9309.         int i = class9.contentType;
  9310.         if(i >= 1 && i <= 200 || i >= 701 && i <= 900)
  9311.         {
  9312.             if(i >= 801)
  9313.                 i -= 701;
  9314.             else
  9315.             if(i >= 701)
  9316.                 i -= 601;
  9317.             else
  9318.             if(i >= 101)
  9319.                 i -= 101;
  9320.             else
  9321.                 i--;
  9322.             menuActionName[menuActionRow] = "Remove @whi@" + friendsList[i];
  9323.             menuActionID[menuActionRow] = 792;
  9324.             menuActionRow++;
  9325.             menuActionName[menuActionRow] = "Message @whi@" + friendsList[i];
  9326.             menuActionID[menuActionRow] = 639;
  9327.             menuActionRow++;
  9328.             return true;
  9329.         }
  9330.         if(i >= 401 && i <= 500)
  9331.         {
  9332.             menuActionName[menuActionRow] = "Remove @whi@" + class9.message;
  9333.             menuActionID[menuActionRow] = 322;
  9334.             menuActionRow++;
  9335.             return true;
  9336.         } else
  9337.         {
  9338.             return false;
  9339.         }
  9340.     }
  9341.  
  9342.     private void method104()
  9343.     {
  9344.         Animable_Sub3 class30_sub2_sub4_sub3 = (Animable_Sub3)aClass19_1056.reverseGetFirst();
  9345.         for(; class30_sub2_sub4_sub3 != null; class30_sub2_sub4_sub3 = (Animable_Sub3)aClass19_1056.reverseGetNext())
  9346.             if(class30_sub2_sub4_sub3.anInt1560 != plane || class30_sub2_sub4_sub3.aBoolean1567)
  9347.                 class30_sub2_sub4_sub3.unlink();
  9348.             else
  9349.             if(loopCycle >= class30_sub2_sub4_sub3.anInt1564)
  9350.             {
  9351.                 class30_sub2_sub4_sub3.method454(anInt945);
  9352.                 if(class30_sub2_sub4_sub3.aBoolean1567)
  9353.                     class30_sub2_sub4_sub3.unlink();
  9354.                 else
  9355.                     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);
  9356.             }
  9357.  
  9358.     }
  9359.    
  9360.     public void drawBlackBox(int xPos, int yPos) {
  9361.         DrawingArea.drawPixels(71, yPos - 1, xPos - 2, 0x726451, 1);
  9362.         DrawingArea.drawPixels(69, yPos, xPos + 174, 0x726451, 1);
  9363.         DrawingArea.drawPixels(1, yPos - 2, xPos - 2, 0x726451, 178);
  9364.         DrawingArea.drawPixels(1, yPos + 68, xPos, 0x726451, 174);
  9365.         DrawingArea.drawPixels(71, yPos - 1, xPos - 1, 0x2E2B23, 1);
  9366.         DrawingArea.drawPixels(71, yPos - 1, xPos + 175, 0x2E2B23, 1);
  9367.         DrawingArea.drawPixels(1, yPos - 1, xPos, 0x2E2B23, 175);
  9368.         DrawingArea.drawPixels(1, yPos + 69, xPos, 0x2E2B23, 175);
  9369.         DrawingArea.method335(0, yPos, 174, 68, 220, xPos);
  9370.     }
  9371.    
  9372.     /* NEW INTERFACE TEXT ENGINE - private void drawInterface(int yScrollPoint, int xPadding, RSInterface rsInterface, int yPadding) {
  9373.         try {
  9374.             if(rsInterface.type != 0 || rsInterface.children == null)
  9375.                 return;
  9376.             if(rsInterface.isMouseoverTriggered && lastHoverChildId != rsInterface.id && anInt1048 != rsInterface.id && anInt1039 != rsInterface.id)
  9377.                 return;
  9378.             int xTopPos = DrawingArea.topX;
  9379.             int yTopPos = DrawingArea.topY;
  9380.             int xBottomPos = DrawingArea.bottomX;
  9381.             int yBottomPos = DrawingArea.bottomY;
  9382.             DrawingArea.setDrawingArea(yPadding + rsInterface.height, xPadding, xPadding + rsInterface.width, yPadding);
  9383.             int totalChildren = rsInterface.children.length;
  9384.             for(int childIndex = 0; childIndex < totalChildren; childIndex++) {
  9385.                 int xSpritePos = rsInterface.childX[childIndex] + xPadding;
  9386.                 int ySpritePos = (rsInterface.childY[childIndex] + yPadding) - yScrollPoint;
  9387.                 RSInterface rsChildren = RSInterface.interfaceCache[rsInterface.children[childIndex]];
  9388.                 xSpritePos += rsChildren.anInt263;
  9389.                 ySpritePos += rsChildren.anInt265;
  9390.                 if(rsChildren.contentType > 0)
  9391.                     drawFriendsListOrWelcomeScreen(rsChildren);
  9392.                 //here
  9393.                 int[] IDs = {
  9394.                     1196, 1199, 1206, 1215, 1224, 1231, 1240, 1249, 1258, 1267, 1274, 1283, 1573,
  9395.                     1290, 1299, 1308, 1315, 1324, 1333, 1340, 1349, 1358, 1367, 1374, 1381, 1388,
  9396.                     1397, 1404, 1583, 12038, 1414, 1421, 1430, 1437, 1446, 1453, 1460, 1469, 15878,
  9397.                     1602, 1613, 1624, 7456, 1478, 1485, 1494, 1503, 1512, 1521, 1530, 1544, 1553,
  9398.                     1563, 1593, 1635, 12426, 12436, 12446, 12456, 6004, 18471,
  9399.                     /* Ancients *
  9400.                     12940, 12988, 13036, 12902, 12862, 13046, 12964, 13012, 13054, 12920, 12882, 13062,
  9401.                     12952, 13000, 13070, 12912, 12872, 13080, 12976, 13024, 13088, 12930, 12892, 13096
  9402.                 };
  9403.                 for(int m5 = 0; m5 < IDs.length; m5++) {
  9404.                     if(rsChildren.id == IDs[m5] + 1) {
  9405.                         if(m5 > 61)
  9406.                             drawBlackBox(xSpritePos + 1, ySpritePos);
  9407.                         else
  9408.                             drawBlackBox(xSpritePos, ySpritePos + 1);
  9409.                     }
  9410.                 }
  9411.                 int[] runeChildren = {
  9412.                     1202, 1203, 1209, 1210, 1211, 1218, 1219, 1220, 1227, 1228, 1234, 1235, 1236, 1243, 1244, 1245,
  9413.                     1252, 1253, 1254, 1261, 1262, 1263, 1270, 1271, 1277, 1278, 1279, 1286, 1287, 1293, 1294, 1295,
  9414.                     1302, 1303, 1304, 1311, 1312, 1318, 1319, 1320, 1327, 1328, 1329, 1336, 1337, 1343, 1344, 1345,
  9415.                     1352, 1353, 1354, 1361, 1362, 1363, 1370, 1371, 1377, 1378, 1384, 1385, 1391, 1392, 1393, 1400,
  9416.                     1401, 1407, 1408, 1410, 1417, 1418, 1424, 1425, 1426, 1433, 1434, 1440, 1441, 1442, 1449, 1450,
  9417.                     1456, 1457, 1463, 1464, 1465, 1472, 1473, 1474, 1481, 1482, 1488, 1489, 1490, 1497, 1498, 1499,
  9418.                     1506, 1507, 1508, 1515, 1516, 1517, 1524, 1525, 1526, 1533, 1534, 1535, 1547, 1548, 1549, 1556,
  9419.                     1557, 1558, 1566, 1567, 1568, 1576, 1577, 1578, 1586, 1587, 1588, 1596, 1597, 1598, 1605, 1606,
  9420.                     1607, 1616, 1617, 1618, 1627, 1628, 1629, 1638, 1639, 1640, 6007, 6008, 6011, 8673, 8674, 12041,
  9421.                     12042, 12429, 12430, 12431, 12439, 12440, 12441, 12449, 12450, 12451, 12459, 12460, 15881, 15882,
  9422.                     15885, 18474, 18475, 18478
  9423.                 };
  9424.                 for(int r = 0; r < runeChildren.length; r++)
  9425.                     if(rsChildren.id == runeChildren[r])
  9426.                         rsChildren.modelZoom = 775;
  9427.                 if(rsChildren.type == 0) {
  9428.                     if(rsChildren.scrollPosition > rsChildren.scrollMax - rsChildren.height)
  9429.                         rsChildren.scrollPosition = rsChildren.scrollMax - rsChildren.height;
  9430.                     if(rsChildren.scrollPosition < 0)
  9431.                         rsChildren.scrollPosition = 0;
  9432.                     drawInterface(rsChildren.scrollPosition, xSpritePos, rsChildren, ySpritePos);
  9433.                     if(rsChildren.scrollMax > rsChildren.height)
  9434.                         drawScrollbar(rsChildren.height, rsChildren.scrollPosition, ySpritePos, xSpritePos + rsChildren.width, rsChildren.scrollMax,false);
  9435.                 } else if(rsChildren.type != 1)
  9436.                     if(rsChildren.type == 2) {
  9437.                         int spriteIndex = 0;
  9438.                         for(int l3 = 0; l3 < rsChildren.height; l3++) {
  9439.                             for(int l4 = 0; l4 < rsChildren.width; l4++) {
  9440.                                 int k5 = xSpritePos + l4 * (32 + rsChildren.invSpritePadX);
  9441.                                 int j6 = ySpritePos + l3 * (32 + rsChildren.invSpritePadY);
  9442.                                 if(spriteIndex < 20) {
  9443.                                     k5 += rsChildren.spritesX[spriteIndex];
  9444.                                     j6 += rsChildren.spritesY[spriteIndex];
  9445.                                 }
  9446.                                 if(rsChildren.inv[spriteIndex] > 0) {
  9447.                                     int k6 = 0;
  9448.                                     int j7 = 0;
  9449.                                     int inventoryItemId = rsChildren.inv[spriteIndex] - 1;
  9450.                                     if(k5 > DrawingArea.topX - 32 && k5 < DrawingArea.bottomX && j6 > DrawingArea.topY - 32 && j6 < DrawingArea.bottomY || activeInterfaceType != 0 && anInt1085 == spriteIndex) {
  9451.                                         int selectedColour = 0;
  9452.                                         if(itemSelected == 1 && itemSlotUsedOn == spriteIndex && anInt1284 == rsChildren.id)
  9453.                                             selectedColour = 0xffffff;
  9454.                                         Sprite itemSprite = ItemDef.getSprite(inventoryItemId, rsChildren.invStackSizes[spriteIndex], selectedColour);
  9455.                                         if(itemSprite != null) {
  9456.                                             if(activeInterfaceType != 0 && anInt1085 == spriteIndex && anInt1084 == rsChildren.id) {
  9457.                                                 k6 = super.mouseX - anInt1087;
  9458.                                                 j7 = super.mouseY - anInt1088;
  9459.                                                 if(k6 < 5 && k6 > -5)
  9460.                                                     k6 = 0;
  9461.                                                 if(j7 < 5 && j7 > -5)
  9462.                                                     j7 = 0;
  9463.                                                 if(anInt989 < 5) {
  9464.                                                     k6 = 0;
  9465.                                                     j7 = 0;
  9466.                                                 }
  9467.                                                 itemSprite.drawSprite1(k5 + k6, j6 + j7, 128);
  9468.                                                 if(j6 + j7 < DrawingArea.topY && rsInterface.scrollPosition > 0) {
  9469.                                                     int i10 = (anInt945 * (DrawingArea.topY - j6 - j7)) / 3;
  9470.                                                     if(i10 > anInt945 * 10)
  9471.                                                         i10 = anInt945 * 10;
  9472.                                                     if(i10 > rsInterface.scrollPosition)
  9473.                                                         i10 = rsInterface.scrollPosition;
  9474.                                                     rsInterface.scrollPosition -= i10;
  9475.                                                     anInt1088 += i10;
  9476.                                                 }
  9477.                                                 if(j6 + j7 + 32 > DrawingArea.bottomY && rsInterface.scrollPosition < rsInterface.scrollMax - rsInterface.height) {
  9478.                                                     int j10 = (anInt945 * ((j6 + j7 + 32) - DrawingArea.bottomY)) / 3;
  9479.                                                     if(j10 > anInt945 * 10)
  9480.                                                         j10 = anInt945 * 10;
  9481.                                                     if(j10 > rsInterface.scrollMax - rsInterface.height - rsInterface.scrollPosition)
  9482.                                                         j10 = rsInterface.scrollMax - rsInterface.height - rsInterface.scrollPosition;
  9483.                                                     rsInterface.scrollPosition += j10;
  9484.                                                     anInt1088 -= j10;
  9485.                                                 }
  9486.                                             } else if(atInventoryInterfaceType != 0 && atInventoryIndex == spriteIndex && atInventoryInterface == rsChildren.id)
  9487.                                                 itemSprite.drawSprite1(k5, j6, 128);
  9488.                                             else
  9489.                                                 itemSprite.drawSprite(k5, j6);
  9490.                                             if(rsChildren.parentID  == 3824) {
  9491.                                                 infinityIcon.drawSprite(k5, j6);
  9492.                                             } else if(itemSprite.maxWidth == 33 || rsChildren.invStackSizes[spriteIndex] != 1) {
  9493.                                                 int k10 = rsChildren.invStackSizes[spriteIndex];
  9494.                                                 if(k10 >= 1)
  9495.                                                     newSmallFont.drawBasicString(intToKOrMil(k10), k5 + k6, j6 + 9 + j7, 0xFFFF00, 0);
  9496.                                                 if(k10 >= 100000)
  9497.                                                     newSmallFont.drawBasicString(intToKOrMil(k10), k5 + k6, j6 + 9 + j7, 0xFFFFFF, 0);
  9498.                                                 if(k10 >= 10000000)
  9499.                                                     newSmallFont.drawBasicString(intToKOrMil(k10), k5 + k6, j6 + 9 + j7, 0x00FF80, 0);
  9500.                                                 if(k10 >= 1000000000)
  9501.                                                     newSmallFont.drawBasicString(intToKOrMil(k10), k5 + k6, j6 + 9 + j7, 0xFF0000, 0);
  9502.                                             }
  9503.                                         }
  9504.                                     }
  9505.                                 } else if(rsChildren.sprites != null && spriteIndex < 20) {
  9506.                                     Sprite sprite = rsChildren.sprites[spriteIndex];
  9507.                                     if(sprite != null)
  9508.                                         sprite.drawSprite(k5, j6);
  9509.                                 }
  9510.                                 spriteIndex++;
  9511.                             }
  9512.                         }
  9513.                     } else if(rsChildren.type == 3) {
  9514.                         boolean flag = false;
  9515.                         if(anInt1039 == rsChildren.id || anInt1048 == rsChildren.id || lastHoverChildId == rsChildren.id)
  9516.                             flag = true;
  9517.                         int j3;
  9518.                         if(interfaceIsSelected(rsChildren)) {
  9519.                             j3 = rsChildren.anInt219;
  9520.                             if(flag && rsChildren.anInt239 != 0)
  9521.                                 j3 = rsChildren.anInt239;
  9522.                         } else {
  9523.                             j3 = rsChildren.textColor;
  9524.                             if(flag && rsChildren.textHoverColour != 0)
  9525.                                 j3 = rsChildren.textHoverColour;
  9526.                         }
  9527.                         if(rsChildren.opacity == 0) {
  9528.                             if(rsChildren.aBoolean227)
  9529.                                 DrawingArea.drawPixels(rsChildren.height, ySpritePos, xSpritePos, j3, rsChildren.width);
  9530.                             else
  9531.                                 DrawingArea.fillPixels(xSpritePos, rsChildren.width, rsChildren.height, j3, ySpritePos);
  9532.                         } else if(rsChildren.aBoolean227)
  9533.                             DrawingArea.method335(j3, ySpritePos, rsChildren.width, rsChildren.height, 256 - (rsChildren.opacity & 0xff), xSpritePos);
  9534.                         else
  9535.                             DrawingArea.method338(ySpritePos, rsChildren.height, 256 - (rsChildren.opacity & 0xff), j3, rsChildren.width, xSpritePos);
  9536.                     } else if(rsChildren.type == 4) {
  9537.                         RSFont textDrawingArea = rsChildren.textDrawingAreas;
  9538.                         String s = rsChildren.message;
  9539.                         boolean flag1 = false;
  9540.                         if(anInt1039 == rsChildren.id || anInt1048 == rsChildren.id || lastHoverChildId == rsChildren.id)
  9541.                             flag1 = true;
  9542.                         int i4;
  9543.                         if(interfaceIsSelected(rsChildren)) {
  9544.                             i4 = rsChildren.anInt219;
  9545.                             if(flag1 && rsChildren.anInt239 != 0)
  9546.                                 i4 = rsChildren.anInt239;
  9547.                             if(rsChildren.disabledText.length() > 0)
  9548.                                 s = rsChildren.disabledText;
  9549.                         } else {
  9550.                             i4 = rsChildren.textColor;
  9551.                             if(flag1 && rsChildren.textHoverColour != 0)
  9552.                                 i4 = rsChildren.textHoverColour;
  9553.                         }
  9554.                         if(rsChildren.atActionType == 6 && aBoolean1149) {
  9555.                             s = "Please wait...";
  9556.                             i4 = rsChildren.textColor;
  9557.                         }
  9558.                         if(DrawingArea.width == 519) {
  9559.                             if(i4 == 0xffff00)
  9560.                                 i4 = 255;
  9561.                             if(i4 == 49152)
  9562.                                 i4 = 0xffffff;
  9563.                         }
  9564.                         if((rsChildren.parentID == 1151) || (rsChildren.parentID == 12855)) {
  9565.                             switch (i4) {
  9566.                                 case 16773120: i4 = 0xFE981F; break;
  9567.                                 case 7040819: i4 = 0xAF6A1A; break;
  9568.                             }
  9569.                         }
  9570.                         for(int l6 = ySpritePos + textDrawingArea.baseCharacterHeight; s.length() > 0; l6 += textDrawingArea.baseCharacterHeight) {
  9571.                             if(s.indexOf("%") != -1) {
  9572.                                 do {
  9573.                                     int k7 = s.indexOf("%1");
  9574.                                     if(k7 == -1)
  9575.                                         break;
  9576.                                     if(rsChildren.id < 4000 || rsChildren.id > 5000 && rsChildren.id !=13921 && rsChildren.id !=13922 && rsChildren.id !=12171 && rsChildren.id !=12172)
  9577.                                         s = s.substring(0, k7) + methodR(extractInterfaceValues(rsChildren, 0)) + s.substring(k7 + 2);
  9578.                                     else
  9579.                                         s = s.substring(0, k7) + interfaceIntToString(extractInterfaceValues(rsChildren, 0)) + s.substring(k7 + 2);
  9580.                                 } while(true);
  9581.                                 do {
  9582.                                     int l7 = s.indexOf("%2");
  9583.                                     if(l7 == -1)
  9584.                                         break;
  9585.                                     s = s.substring(0, l7) + interfaceIntToString(extractInterfaceValues(rsChildren, 1)) + s.substring(l7 + 2);
  9586.                                 } while(true);
  9587.                                 do {
  9588.                                     int i8 = s.indexOf("%3");
  9589.                                     if(i8 == -1)
  9590.                                         break;
  9591.                                     s = s.substring(0, i8) + interfaceIntToString(extractInterfaceValues(rsChildren, 2)) + s.substring(i8 + 2);
  9592.                                 } while(true);
  9593.                                 do {
  9594.                                     int j8 = s.indexOf("%4");
  9595.                                     if(j8 == -1)
  9596.                                         break;
  9597.                                     s = s.substring(0, j8) + interfaceIntToString(extractInterfaceValues(rsChildren, 3)) + s.substring(j8 + 2);
  9598.                                 } while(true);
  9599.                                 do {
  9600.                                     int k8 = s.indexOf("%5");
  9601.                                     if(k8 == -1)
  9602.                                         break;
  9603.                                     s = s.substring(0, k8) + interfaceIntToString(extractInterfaceValues(rsChildren, 4)) + s.substring(k8 + 2);
  9604.                                 } while(true);
  9605.                             }
  9606.                             int l8 = s.indexOf("\\n");
  9607.                             String s1;
  9608.                             if(l8 != -1) {
  9609.                                 s1 = s.substring(0, l8);
  9610.                                 s = s.substring(l8 + 2);
  9611.                             } else {
  9612.                                 s1 = s;
  9613.                                 s = "";
  9614.                             }
  9615.                             if(rsChildren.centerText){
  9616.                                 //textDrawingArea.method382(i4, xSpritePos + rsChildren.width / 2, s1, l6, rsChildren.textShadow);
  9617.                                 textDrawingArea.drawCenteredString(s1, xSpritePos + rsChildren.width / 2, l6, i4,(rsChildren.textShadow? 0: -1));
  9618.                             } else {
  9619.                                 //textDrawingArea.method389(rsChildren.textShadow, xSpritePos, i4, s1, l6);
  9620.                                 textDrawingArea.drawBasicString(s1, xSpritePos , l6, i4,(rsChildren.textShadow? 0: -1));
  9621.                             }
  9622.                            
  9623.                         }
  9624.                     } else if(rsChildren.type == 5 || rsChildren.type == 10) {
  9625.                         Sprite sprite = null;
  9626.                         if(rsChildren.itemSpriteId1 != -1 && rsChildren.sprite1 == null) {
  9627.                             rsChildren.sprite1 = ItemDef.getSprite(rsChildren.itemSpriteId1, 1, (rsChildren.itemSpriteZoom1 == -1) ? 0 : -1,rsChildren.itemSpriteZoom1);
  9628.                             rsChildren.sprite2 = ItemDef.getSprite(rsChildren.itemSpriteId2, 1, (rsChildren.itemSpriteZoom2 == -1) ? 0 : -1,rsChildren.itemSpriteZoom2);
  9629.                             //rsChildren.sprite2 = ItemDef.getSprite(rsChildren.itemSpriteId2, rsChildren.invStackSizes[spriteIndex], selectedColour);
  9630.                             if(rsChildren.greyScale)
  9631.                                 rsChildren.sprite1.greyScale();
  9632.                         }
  9633.                         if(interfaceIsSelected(rsChildren) || hoverSpriteId == rsChildren.id)
  9634.                             sprite = rsChildren.sprite2;
  9635.                         else
  9636.                             sprite = rsChildren.sprite1;
  9637.                         if(spellSelected == 1 && rsChildren.id == spellID && spellID != 0 && sprite != null) {
  9638.                             sprite.drawSprite(xSpritePos, ySpritePos, 0xffffff);
  9639.                         } else {
  9640.                             if (sprite != null)
  9641.                                 if(rsChildren.type == 5)
  9642.                                     sprite.drawSprite(xSpritePos, ySpritePos);
  9643.                                 else
  9644.                                     sprite.drawSprite1(xSpritePos, ySpritePos, rsChildren.opacity);                            
  9645.                         }
  9646.                         if(autoCast && rsChildren.id == autocastId)
  9647.                             magicAuto.drawSprite(xSpritePos-3, ySpritePos-2);
  9648.                     } else if(rsChildren.type == 6) {
  9649.                         int k3 = Texture.textureInt1;
  9650.                         int j4 = Texture.textureInt2;
  9651.                         Texture.textureInt1 = xSpritePos + rsChildren.width / 2;
  9652.                         Texture.textureInt2 = ySpritePos + rsChildren.height / 2;
  9653.                         int i5 = Texture.anIntArray1470[rsChildren.modelRotation1] * rsChildren.modelZoom >> 16;
  9654.                         int l5 = Texture.anIntArray1471[rsChildren.modelRotation1] * rsChildren.modelZoom >> 16;
  9655.                         boolean flag2 = interfaceIsSelected(rsChildren);
  9656.                         int i7;
  9657.                         if(flag2)
  9658.                             i7 = rsChildren.anInt258;
  9659.                         else
  9660.                             i7 = rsChildren.anInt257;
  9661.                         Model model;
  9662.                         if(i7 == -1) {
  9663.                             model = rsChildren.method209(-1, -1, flag2);
  9664.                         } else {
  9665.                             Animation animation = Animation.anims[i7];
  9666.                             model = rsChildren.method209(animation.anIntArray354[rsChildren.anInt246], animation.anIntArray353[rsChildren.anInt246], flag2);
  9667.                         }
  9668.                         if(model != null)
  9669.                             model.method482(rsChildren.modelRotation2, 0, rsChildren.modelRotation1, 0, i5, l5);
  9670.                         Texture.textureInt1 = k3;
  9671.                         Texture.textureInt2 = j4;
  9672.                    
  9673.                     } else if(rsChildren.type == 7) {
  9674.                         RSFont textDrawingArea_1 = rsChildren.textDrawingAreas;
  9675.                         int k4 = 0;
  9676.                         for(int j5 = 0; j5 < rsChildren.height; j5++) {
  9677.                             for(int i6 = 0; i6 < rsChildren.width; i6++) {
  9678.                                 if(rsChildren.inv[k4] > 0) {
  9679.                                     ItemDef itemDef = ItemDef.forID(rsChildren.inv[k4] - 1);
  9680.                                     String s2 = itemDef.name;
  9681.                                     if(itemDef.stackable || rsChildren.invStackSizes[k4] != 1)
  9682.                                         s2 = s2 + " x" + intToKOrMilLongName(rsChildren.invStackSizes[k4]);
  9683.                                     int i9 = xSpritePos + i6 * (115 + rsChildren.invSpritePadX);
  9684.                                     int k9 = ySpritePos + j5 * (12 + rsChildren.invSpritePadY);
  9685.                                     if(rsChildren.centerText)
  9686.                                         textDrawingArea_1.drawCenteredString(s2, i9 + rsChildren.width / 2, k9, rsChildren.textColor, (rsChildren.textShadow ? 0: -1));
  9687.                                     else
  9688.                                         textDrawingArea_1.drawBasicString(s2, i9, k9, rsChildren.textColor,(rsChildren.textShadow ? 0: -1));
  9689.                                 }
  9690.                                 k4++;
  9691.                             }
  9692.                         }
  9693.                     }  else if (rsChildren.type == 8 && (anInt1500 == rsChildren.id || anInt1044 == rsChildren.id || lastHoverToggleChildId == rsChildren.id) && anInt1501 == 100) {
  9694.                         int boxWidth = 0;
  9695.                         int boxHeight = 0;
  9696.                         TextDrawingArea textDrawingArea_2 = normalFont;
  9697.                         for (String s1 = rsChildren.message; s1.length() > 0;) {
  9698.                             int l7 = s1.indexOf("\\n");
  9699.                             String s4;
  9700.                             if (l7 != -1) {
  9701.                                 s4 = s1.substring(0, l7);
  9702.                                 s1 = s1.substring(l7 + 2);
  9703.                             } else {
  9704.                                 s4 = s1;
  9705.                                 s1 = "";
  9706.                             }
  9707.                             int j10 = textDrawingArea_2.getTextWidth(s4);
  9708.                             if (j10 > boxWidth) {
  9709.                                 boxWidth = j10;
  9710.                             }
  9711.                             boxHeight += textDrawingArea_2.anInt1497 + 1;
  9712.                         }
  9713.                         boxWidth += 6;
  9714.                         boxHeight += 7;
  9715.                         int xPos = (ySpritePos + rsChildren.width) - 5 - boxWidth;
  9716.                         int yPos = xSpritePos + rsChildren.height + 5;
  9717.                         if (xPos < ySpritePos + 5) {
  9718.                             xPos = ySpritePos + 5;
  9719.                         }
  9720.                         if (xPos + boxWidth > yScrollPoint + rsInterface.width) {
  9721.                             xPos = (yScrollPoint + rsInterface.width) - boxWidth;
  9722.                         }
  9723.                         if (yPos + boxHeight > xPadding + rsInterface.height) {
  9724.                             yPos = (xPadding + rsInterface.height) - boxHeight;
  9725.                         }
  9726.                         DrawingArea.drawPixels(boxHeight, yPos, xPos, 0xFFFFA0, boxWidth);
  9727.                         DrawingArea.fillPixels(xPos, boxWidth, boxHeight, 0, yPos);
  9728.                         String s2 = rsChildren.message;
  9729.                         for (int j11 = yPos + textDrawingArea_2.anInt1497 + 2; s2.length() > 0; j11 += textDrawingArea_2.anInt1497 + 1) {//anInt1497
  9730.                             int newLineIndex = s2.indexOf("\\n");
  9731.                             String s5;
  9732.                             if (newLineIndex != -1) {
  9733.                                 s5 = s2.substring(0, newLineIndex);
  9734.                                 s2 = s2.substring(newLineIndex + 2);
  9735.                             } else {
  9736.                                 s5 = s2;
  9737.                                 s2 = "";
  9738.                             }
  9739.                             textDrawingArea_2.method389(false, xPos + 3, 0, s5, j11);
  9740.                         }
  9741.                     } else if (rsChildren.type == 9) {
  9742.                         drawHoverBox(xSpritePos, ySpritePos, rsChildren.message);
  9743.                     }
  9744.             }
  9745.             DrawingArea.setDrawingArea(yBottomPos, xTopPos, xBottomPos, yTopPos);
  9746.         } catch(NullPointerException ex) {
  9747.            
  9748.         }
  9749.     }*/
  9750.    
  9751.         private void drawInterface(int yScrollPoint, int xPadding, RSInterface rsInterface, int yPadding) {
  9752.         try {
  9753.             if(rsInterface.type != 0 || rsInterface.children == null)
  9754.                 return;
  9755.             if(rsInterface.isMouseoverTriggered && lastHoverChildId != rsInterface.id && anInt1048 != rsInterface.id && anInt1039 != rsInterface.id)
  9756.                 return;
  9757.             int xTopPos = DrawingArea.topX;
  9758.             int yTopPos = DrawingArea.topY;
  9759.             int xBottomPos = DrawingArea.bottomX;
  9760.             int yBottomPos = DrawingArea.bottomY;
  9761.             DrawingArea.setDrawingArea(yPadding + rsInterface.height, xPadding, xPadding + rsInterface.width, yPadding);
  9762.             int totalChildren = rsInterface.children.length;
  9763.             for(int childIndex = 0; childIndex < totalChildren; childIndex++) {
  9764.                 int xSpritePos = rsInterface.childX[childIndex] + xPadding;
  9765.                 int ySpritePos = (rsInterface.childY[childIndex] + yPadding) - yScrollPoint;
  9766.                 RSInterface rsChildren = RSInterface.interfaceCache[rsInterface.children[childIndex]];
  9767.                 xSpritePos += rsChildren.anInt263;
  9768.                 ySpritePos += rsChildren.anInt265;
  9769.                 if(rsChildren.contentType > 0)
  9770.                     drawFriendsListOrWelcomeScreen(rsChildren);
  9771.                 //here
  9772.                 int[] IDs = {
  9773.                     1196, 1199, 1206, 1215, 1224, 1231, 1240, 1249, 1258, 1267, 1274, 1283, 1573,
  9774.                     1290, 1299, 1308, 1315, 1324, 1333, 1340, 1349, 1358, 1367, 1374, 1381, 1388,
  9775.                     1397, 1404, 1583, 12038, 1414, 1421, 1430, 1437, 1446, 1453, 1460, 1469, 15878,
  9776.                     1602, 1613, 1624, 7456, 1478, 1485, 1494, 1503, 1512, 1521, 1530, 1544, 1553,
  9777.                     1563, 1593, 1635, 12426, 12436, 12446, 12456, 6004, 18471,
  9778.                     /* Ancients */
  9779.                     12940, 12988, 13036, 12902, 12862, 13046, 12964, 13012, 13054, 12920, 12882, 13062,
  9780.                     12952, 13000, 13070, 12912, 12872, 13080, 12976, 13024, 13088, 12930, 12892, 13096
  9781.                 };
  9782.                 for(int m5 = 0; m5 < IDs.length; m5++) {
  9783.                     if(rsChildren.id == IDs[m5] + 1) {
  9784.                         if(m5 > 61)
  9785.                             drawBlackBox(xSpritePos + 1, ySpritePos);
  9786.                         else
  9787.                             drawBlackBox(xSpritePos, ySpritePos + 1);
  9788.                     }
  9789.                 }
  9790.                 int[] runeChildren = {
  9791.                     1202, 1203, 1209, 1210, 1211, 1218, 1219, 1220, 1227, 1228, 1234, 1235, 1236, 1243, 1244, 1245,
  9792.                     1252, 1253, 1254, 1261, 1262, 1263, 1270, 1271, 1277, 1278, 1279, 1286, 1287, 1293, 1294, 1295,
  9793.                     1302, 1303, 1304, 1311, 1312, 1318, 1319, 1320, 1327, 1328, 1329, 1336, 1337, 1343, 1344, 1345,
  9794.                     1352, 1353, 1354, 1361, 1362, 1363, 1370, 1371, 1377, 1378, 1384, 1385, 1391, 1392, 1393, 1400,
  9795.                     1401, 1407, 1408, 1410, 1417, 1418, 1424, 1425, 1426, 1433, 1434, 1440, 1441, 1442, 1449, 1450,
  9796.                     1456, 1457, 1463, 1464, 1465, 1472, 1473, 1474, 1481, 1482, 1488, 1489, 1490, 1497, 1498, 1499,
  9797.                     1506, 1507, 1508, 1515, 1516, 1517, 1524, 1525, 1526, 1533, 1534, 1535, 1547, 1548, 1549, 1556,
  9798.                     1557, 1558, 1566, 1567, 1568, 1576, 1577, 1578, 1586, 1587, 1588, 1596, 1597, 1598, 1605, 1606,
  9799.                     1607, 1616, 1617, 1618, 1627, 1628, 1629, 1638, 1639, 1640, 6007, 6008, 6011, 8673, 8674, 12041,
  9800.                     12042, 12429, 12430, 12431, 12439, 12440, 12441, 12449, 12450, 12451, 12459, 12460, 15881, 15882,
  9801.                     15885, 18474, 18475, 18478
  9802.                 };
  9803.                 for(int r = 0; r < runeChildren.length; r++)
  9804.                     if(rsChildren.id == runeChildren[r])
  9805.                         rsChildren.modelZoom = 775;
  9806.                 if(rsChildren.type == 0) {
  9807.                     if(rsChildren.scrollPosition > rsChildren.scrollMax - rsChildren.height)
  9808.                         rsChildren.scrollPosition = rsChildren.scrollMax - rsChildren.height;
  9809.                     if(rsChildren.scrollPosition < 0)
  9810.                         rsChildren.scrollPosition = 0;
  9811.                     drawInterface(rsChildren.scrollPosition, xSpritePos, rsChildren, ySpritePos);
  9812.                     if(rsChildren.scrollMax > rsChildren.height)
  9813.                         drawScrollbar(rsChildren.height, rsChildren.scrollPosition, ySpritePos, xSpritePos + rsChildren.width, rsChildren.scrollMax,false);
  9814.                 } else if(rsChildren.type != 1)
  9815.                     if(rsChildren.type == 2) {
  9816.                         int spriteIndex = 0;
  9817.                         for(int l3 = 0; l3 < rsChildren.height; l3++) {
  9818.                             for(int l4 = 0; l4 < rsChildren.width; l4++) {
  9819.                                 int k5 = xSpritePos + l4 * (32 + rsChildren.invSpritePadX);
  9820.                                 int j6 = ySpritePos + l3 * (32 + rsChildren.invSpritePadY);
  9821.                                 if(spriteIndex < 20) {
  9822.                                     k5 += rsChildren.spritesX[spriteIndex];
  9823.                                     j6 += rsChildren.spritesY[spriteIndex];
  9824.                                 }
  9825.                                 if(rsChildren.inv[spriteIndex] > 0) {
  9826.                                     int k6 = 0;
  9827.                                     int j7 = 0;
  9828.                                     int inventoryItemId = rsChildren.inv[spriteIndex] - 1;
  9829.                                     if(k5 > DrawingArea.topX - 32 && k5 < DrawingArea.bottomX && j6 > DrawingArea.topY - 32 && j6 < DrawingArea.bottomY || activeInterfaceType != 0 && anInt1085 == spriteIndex) {
  9830.                                         int selectedColour = 0;
  9831.                                         if(itemSelected == 1 && itemSlotUsedOn == spriteIndex && anInt1284 == rsChildren.id)
  9832.                                             selectedColour = 0xffffff;
  9833.                                         Sprite itemSprite = ItemDef.getSprite(inventoryItemId, rsChildren.invStackSizes[spriteIndex], selectedColour);
  9834.                                         if(itemSprite != null) {
  9835.                                             if(activeInterfaceType != 0 && anInt1085 == spriteIndex && anInt1084 == rsChildren.id) {
  9836.                                                 k6 = super.mouseX - anInt1087;
  9837.                                                 j7 = super.mouseY - anInt1088;
  9838.                                                 if(k6 < 5 && k6 > -5)
  9839.                                                     k6 = 0;
  9840.                                                 if(j7 < 5 && j7 > -5)
  9841.                                                     j7 = 0;
  9842.                                                 if(anInt989 < 5) {
  9843.                                                     k6 = 0;
  9844.                                                     j7 = 0;
  9845.                                                 }
  9846.                                                 itemSprite.drawSprite1(k5 + k6, j6 + j7, 128);
  9847.                                                 if(j6 + j7 < DrawingArea.topY && rsInterface.scrollPosition > 0) {
  9848.                                                     int i10 = (anInt945 * (DrawingArea.topY - j6 - j7)) / 3;
  9849.                                                     if(i10 > anInt945 * 10)
  9850.                                                         i10 = anInt945 * 10;
  9851.                                                     if(i10 > rsInterface.scrollPosition)
  9852.                                                         i10 = rsInterface.scrollPosition;
  9853.                                                     rsInterface.scrollPosition -= i10;
  9854.                                                     anInt1088 += i10;
  9855.                                                 }
  9856.                                                 if(j6 + j7 + 32 > DrawingArea.bottomY && rsInterface.scrollPosition < rsInterface.scrollMax - rsInterface.height) {
  9857.                                                     int j10 = (anInt945 * ((j6 + j7 + 32) - DrawingArea.bottomY)) / 3;
  9858.                                                     if(j10 > anInt945 * 10)
  9859.                                                         j10 = anInt945 * 10;
  9860.                                                     if(j10 > rsInterface.scrollMax - rsInterface.height - rsInterface.scrollPosition)
  9861.                                                         j10 = rsInterface.scrollMax - rsInterface.height - rsInterface.scrollPosition;
  9862.                                                     rsInterface.scrollPosition += j10;
  9863.                                                     anInt1088 -= j10;
  9864.                                                 }
  9865.                                             } else if(atInventoryInterfaceType != 0 && atInventoryIndex == spriteIndex && atInventoryInterface == rsChildren.id)
  9866.                                                 itemSprite.drawSprite1(k5, j6, 128);
  9867.                                             else
  9868.                                                 itemSprite.drawSprite(k5, j6);
  9869.                                             if(rsChildren.parentID  == 3824) {
  9870.                                                 infinityIcon.drawSprite(k5, j6);
  9871.                                             } else if(itemSprite.maxWidth == 33 || rsChildren.invStackSizes[spriteIndex] != 1) {
  9872.                                                 int k10 = rsChildren.invStackSizes[spriteIndex];
  9873.                                                 smallFont.method385(0, intToKOrMil(k10), j6 + 10 + j7, k5 + 1 + k6);//this is the shadow
  9874.                                                 if(k10 >= 1)
  9875.                                                     smallFont.method385(0xFFFF00, intToKOrMil(k10), j6 + 9 + j7, k5 + k6);
  9876.                                                 if(k10 >= 100000)
  9877.                                                     smallFont.method385(0xFFFFFF, intToKOrMil(k10), j6 + 9 + j7, k5 + k6);
  9878.                                                 if(k10 >= 10000000)
  9879.                                                     smallFont.method385(0x00FF80, intToKOrMil(k10), j6 + 9 + j7, k5 + k6);
  9880.                                             }
  9881.                                         }
  9882.                                     }
  9883.                                 } else if(rsChildren.sprites != null && spriteIndex < 20) {
  9884.                                     Sprite sprite = rsChildren.sprites[spriteIndex];
  9885.                                     if(sprite != null)
  9886.                                         sprite.drawSprite(k5, j6);
  9887.                                 }
  9888.                                 spriteIndex++;
  9889.                             }
  9890.                         }
  9891.                     } else if(rsChildren.type == 3) {
  9892.                         boolean flag = false;
  9893.                         if(anInt1039 == rsChildren.id || anInt1048 == rsChildren.id || lastHoverChildId == rsChildren.id)
  9894.                             flag = true;
  9895.                         int j3;
  9896.                         if(interfaceIsSelected(rsChildren)) {
  9897.                             j3 = rsChildren.anInt219;
  9898.                             if(flag && rsChildren.anInt239 != 0)
  9899.                                 j3 = rsChildren.anInt239;
  9900.                         } else {
  9901.                             j3 = rsChildren.textColor;
  9902.                             if(flag && rsChildren.textHoverColour != 0)
  9903.                                 j3 = rsChildren.textHoverColour;
  9904.                         }
  9905.                         if(rsChildren.opacity == 0) {
  9906.                             if(rsChildren.aBoolean227)
  9907.                                 DrawingArea.drawPixels(rsChildren.height, ySpritePos, xSpritePos, j3, rsChildren.width);
  9908.                             else
  9909.                                 DrawingArea.fillPixels(xSpritePos, rsChildren.width, rsChildren.height, j3, ySpritePos);
  9910.                         } else if(rsChildren.aBoolean227)
  9911.                             DrawingArea.method335(j3, ySpritePos, rsChildren.width, rsChildren.height, 256 - (rsChildren.opacity & 0xff), xSpritePos);
  9912.                         else
  9913.                             DrawingArea.method338(ySpritePos, rsChildren.height, 256 - (rsChildren.opacity & 0xff), j3, rsChildren.width, xSpritePos);
  9914.                     } else if(rsChildren.type == 4) {
  9915.                         TextDrawingArea textDrawingArea = rsChildren.textDrawingAreas;
  9916.                         String s = rsChildren.message;
  9917.                         boolean flag1 = false;
  9918.                         if(anInt1039 == rsChildren.id || anInt1048 == rsChildren.id || lastHoverChildId == rsChildren.id)
  9919.                             flag1 = true;
  9920.                         int i4;
  9921.                         if(interfaceIsSelected(rsChildren)) {
  9922.                             i4 = rsChildren.anInt219;
  9923.                             if(flag1 && rsChildren.anInt239 != 0)
  9924.                                 i4 = rsChildren.anInt239;
  9925.                             if(rsChildren.disabledText.length() > 0)
  9926.                                 s = rsChildren.disabledText;
  9927.                         } else {
  9928.                             i4 = rsChildren.textColor;
  9929.                             if(flag1 && rsChildren.textHoverColour != 0)
  9930.                                 i4 = rsChildren.textHoverColour;
  9931.                         }
  9932.                         if(rsChildren.atActionType == 6 && aBoolean1149) {
  9933.                             s = "Please wait...";
  9934.                             i4 = rsChildren.textColor;
  9935.                         }
  9936.                         if(DrawingArea.width == 519) {
  9937.                             if(i4 == 0xffff00)
  9938.                                 i4 = 255;
  9939.                             if(i4 == 49152)
  9940.                                 i4 = 0xffffff;
  9941.                         }
  9942.                         if((rsChildren.parentID == 1151) || (rsChildren.parentID == 12855)) {
  9943.                             switch (i4) {
  9944.                                 case 16773120: i4 = 0xFE981F; break;
  9945.                                 case 7040819: i4 = 0xAF6A1A; break;
  9946.                             }
  9947.                         }
  9948.                         for(int l6 = ySpritePos + textDrawingArea.anInt1497; s.length() > 0; l6 += textDrawingArea.anInt1497) {
  9949.                             if(s.indexOf("%") != -1) {
  9950.                                 do {
  9951.                                     int k7 = s.indexOf("%1");
  9952.                                     if(k7 == -1)
  9953.                                         break;
  9954.                                     if(rsChildren.id < 4000 || rsChildren.id > 5000 && rsChildren.id !=13921 && rsChildren.id !=13922 && rsChildren.id !=12171 && rsChildren.id !=12172)
  9955.                                         s = s.substring(0, k7) + methodR(extractInterfaceValues(rsChildren, 0)) + s.substring(k7 + 2);
  9956.                                     else
  9957.                                         s = s.substring(0, k7) + interfaceIntToString(extractInterfaceValues(rsChildren, 0)) + s.substring(k7 + 2);
  9958.                                 } while(true);
  9959.                                 do {
  9960.                                     int l7 = s.indexOf("%2");
  9961.                                     if(l7 == -1)
  9962.                                         break;
  9963.                                     s = s.substring(0, l7) + interfaceIntToString(extractInterfaceValues(rsChildren, 1)) + s.substring(l7 + 2);
  9964.                                 } while(true);
  9965.                                 do {
  9966.                                     int i8 = s.indexOf("%3");
  9967.                                     if(i8 == -1)
  9968.                                         break;
  9969.                                     s = s.substring(0, i8) + interfaceIntToString(extractInterfaceValues(rsChildren, 2)) + s.substring(i8 + 2);
  9970.                                 } while(true);
  9971.                                 do {
  9972.                                     int j8 = s.indexOf("%4");
  9973.                                     if(j8 == -1)
  9974.                                         break;
  9975.                                     s = s.substring(0, j8) + interfaceIntToString(extractInterfaceValues(rsChildren, 3)) + s.substring(j8 + 2);
  9976.                                 } while(true);
  9977.                                 do {
  9978.                                     int k8 = s.indexOf("%5");
  9979.                                     if(k8 == -1)
  9980.                                         break;
  9981.                                     s = s.substring(0, k8) + interfaceIntToString(extractInterfaceValues(rsChildren, 4)) + s.substring(k8 + 2);
  9982.                                 } while(true);
  9983.                             }
  9984.                             int l8 = s.indexOf("\\n");
  9985.                             String s1;
  9986.                             if(l8 != -1) {
  9987.                                 s1 = s.substring(0, l8);
  9988.                                 s = s.substring(l8 + 2);
  9989.                             } else {
  9990.                                 s1 = s;
  9991.                                 s = "";
  9992.                             }
  9993.                             if(rsChildren.centerText)
  9994.                                 textDrawingArea.method382(i4, xSpritePos + rsChildren.width / 2, s1, l6, rsChildren.textShadow);
  9995.                             else
  9996.                                 textDrawingArea.method389(rsChildren.textShadow, xSpritePos, i4, s1, l6);
  9997.                         }
  9998.                     } else if(rsChildren.type == 5 || rsChildren.type == 10) {
  9999.                         Sprite sprite = null;
  10000.                         if(rsChildren.itemSpriteId1 != -1 && rsChildren.sprite1 == null) {
  10001.                             rsChildren.sprite1 = ItemDef.getSprite(rsChildren.itemSpriteId1, 1, (rsChildren.itemSpriteZoom1 == -1) ? 0 : -1,rsChildren.itemSpriteZoom1);
  10002.                             rsChildren.sprite2 = ItemDef.getSprite(rsChildren.itemSpriteId2, 1, (rsChildren.itemSpriteZoom2 == -1) ? 0 : -1,rsChildren.itemSpriteZoom2);
  10003.                             //rsChildren.sprite2 = ItemDef.getSprite(rsChildren.itemSpriteId2, rsChildren.invStackSizes[spriteIndex], selectedColour);
  10004.                             if(rsChildren.greyScale)
  10005.                                 rsChildren.sprite1.greyScale();
  10006.                         }
  10007.                         if(interfaceIsSelected(rsChildren) || hoverSpriteId == rsChildren.id)
  10008.                             sprite = rsChildren.sprite2;
  10009.                         else
  10010.                             sprite = rsChildren.sprite1;
  10011.                         if(spellSelected == 1 && rsChildren.id == spellID && spellID != 0 && sprite != null) {
  10012.                             sprite.drawSprite(xSpritePos, ySpritePos, 0xffffff);
  10013.                         } else {
  10014.                             if (sprite != null)
  10015.                                 if(rsChildren.type == 5)
  10016.                                     sprite.drawSprite(xSpritePos, ySpritePos);
  10017.                                 else
  10018.                                     sprite.drawSprite1(xSpritePos, ySpritePos, rsChildren.opacity);                            
  10019.                         }
  10020.                         if(autoCast && rsChildren.id == autocastId)
  10021.                             magicAuto.drawSprite(xSpritePos-3, ySpritePos-2);
  10022.                     } else if(rsChildren.type == 6) {
  10023.                         int k3 = Texture.textureInt1;
  10024.                         int j4 = Texture.textureInt2;
  10025.                         Texture.textureInt1 = xSpritePos + rsChildren.width / 2;
  10026.                         Texture.textureInt2 = ySpritePos + rsChildren.height / 2;
  10027.                         int i5 = Texture.anIntArray1470[rsChildren.modelRotation1] * rsChildren.modelZoom >> 16;
  10028.                         int l5 = Texture.anIntArray1471[rsChildren.modelRotation1] * rsChildren.modelZoom >> 16;
  10029.                         boolean flag2 = interfaceIsSelected(rsChildren);
  10030.                         int i7;
  10031.                         if(flag2)
  10032.                             i7 = rsChildren.anInt258;
  10033.                         else
  10034.                             i7 = rsChildren.anInt257;
  10035.                         Model model;
  10036.                         if(i7 == -1) {
  10037.                             model = rsChildren.method209(-1, -1, flag2);
  10038.                         } else {
  10039.                             Animation animation = Animation.anims[i7];
  10040.                             model = rsChildren.method209(animation.anIntArray354[rsChildren.anInt246], animation.anIntArray353[rsChildren.anInt246], flag2);
  10041.                         }
  10042.                         if(model != null)
  10043.                             model.method482(rsChildren.modelRotation2, 0, rsChildren.modelRotation1, 0, i5, l5);
  10044.                         Texture.textureInt1 = k3;
  10045.                         Texture.textureInt2 = j4;
  10046.                    
  10047.                     } else if(rsChildren.type == 7) {
  10048.                         TextDrawingArea textDrawingArea_1 = rsChildren.textDrawingAreas;
  10049.                         int k4 = 0;
  10050.                         for(int j5 = 0; j5 < rsChildren.height; j5++) {
  10051.                             for(int i6 = 0; i6 < rsChildren.width; i6++) {
  10052.                                 if(rsChildren.inv[k4] > 0) {
  10053.                                     ItemDef itemDef = ItemDef.forID(rsChildren.inv[k4] - 1);
  10054.                                     String s2 = itemDef.name;
  10055.                                     if(itemDef.stackable || rsChildren.invStackSizes[k4] != 1)
  10056.                                         s2 = s2 + " x" + intToKOrMilLongName(rsChildren.invStackSizes[k4]);
  10057.                                     int i9 = xSpritePos + i6 * (115 + rsChildren.invSpritePadX);
  10058.                                     int k9 = ySpritePos + j5 * (12 + rsChildren.invSpritePadY);
  10059.                                     if(rsChildren.centerText)
  10060.                                         textDrawingArea_1.method382(rsChildren.textColor, i9 + rsChildren.width / 2, s2, k9, rsChildren.textShadow);
  10061.                                     else
  10062.                                         textDrawingArea_1.method389(rsChildren.textShadow, i9, rsChildren.textColor, s2, k9);
  10063.                                 }
  10064.                                 k4++;
  10065.                             }
  10066.                         }
  10067.                     }  else if (rsChildren.type == 8 && (anInt1500 == rsChildren.id || anInt1044 == rsChildren.id || lastHoverToggleChildId == rsChildren.id) && anInt1501 == 100) {
  10068.                         int boxWidth = 0;
  10069.                         int boxHeight = 0;
  10070.                         TextDrawingArea textDrawingArea_2 = normalFont;
  10071.                         for (String s1 = rsChildren.message; s1.length() > 0;) {
  10072.                             int l7 = s1.indexOf("\\n");
  10073.                             String s4;
  10074.                             if (l7 != -1) {
  10075.                                 s4 = s1.substring(0, l7);
  10076.                                 s1 = s1.substring(l7 + 2);
  10077.                             } else {
  10078.                                 s4 = s1;
  10079.                                 s1 = "";
  10080.                             }
  10081.                             int j10 = textDrawingArea_2.getTextWidth(s4);
  10082.                             if (j10 > boxWidth) {
  10083.                                 boxWidth = j10;
  10084.                             }
  10085.                             boxHeight += textDrawingArea_2.anInt1497 + 1;
  10086.                         }
  10087.                         boxWidth += 6;
  10088.                         boxHeight += 7;
  10089.                         int xPos = (ySpritePos + rsChildren.width) - 5 - boxWidth;
  10090.                         int yPos = xSpritePos + rsChildren.height + 5;
  10091.                         if (xPos < ySpritePos + 5) {
  10092.                             xPos = ySpritePos + 5;
  10093.                         }
  10094.                         if (xPos + boxWidth > yScrollPoint + rsInterface.width) {
  10095.                             xPos = (yScrollPoint + rsInterface.width) - boxWidth;
  10096.                         }
  10097.                         if (yPos + boxHeight > xPadding + rsInterface.height) {
  10098.                             yPos = (xPadding + rsInterface.height) - boxHeight;
  10099.                         }
  10100.                         DrawingArea.drawPixels(boxHeight, yPos, xPos, 0xFFFFA0, boxWidth);
  10101.                         DrawingArea.fillPixels(xPos, boxWidth, boxHeight, 0, yPos);
  10102.                         String s2 = rsChildren.message;
  10103.                         for (int j11 = yPos + textDrawingArea_2.anInt1497 + 2; s2.length() > 0; j11 += textDrawingArea_2.anInt1497 + 1) {//anInt1497
  10104.                             int newLineIndex = s2.indexOf("\\n");
  10105.                             String s5;
  10106.                             if (newLineIndex != -1) {
  10107.                                 s5 = s2.substring(0, newLineIndex);
  10108.                                 s2 = s2.substring(newLineIndex + 2);
  10109.                             } else {
  10110.                                 s5 = s2;
  10111.                                 s2 = "";
  10112.                             }
  10113.                             textDrawingArea_2.method389(false, xPos + 3, 0, s5, j11);
  10114.                         }
  10115.                     } else if (rsChildren.type == 9) {
  10116.                         drawHoverBox(xSpritePos, ySpritePos, rsChildren.message);
  10117.                     }
  10118.             }
  10119.             DrawingArea.setDrawingArea(yBottomPos, xTopPos, xBottomPos, yTopPos);
  10120.         } catch(NullPointerException ex) {
  10121.            
  10122.         }
  10123.     }
  10124.    
  10125.     public void drawHoverBox(int xPos, int yPos, String text) {
  10126.         String[] results = text.split("\n");
  10127.         int height = (results.length * 16) + 6;
  10128.         int width;
  10129.         width = smallFont.getTextWidth(results[0]) + 6;
  10130.         for(int i = 1; i < results.length; i++)
  10131.             if(width <= smallFont.getTextWidth(results[i]) + 6)
  10132.                 width = smallFont.getTextWidth(results[i]) + 6;
  10133.         DrawingArea.drawPixels(height, yPos, xPos, 0xFFFFA0, width);
  10134.         DrawingArea.fillPixels(xPos, width, height, 0, yPos);
  10135.         yPos += 14;
  10136.         for(int i = 0; i < results.length; i++) {
  10137.             smallFont.method389(false, xPos + 3, 0, results[i], yPos);
  10138.             yPos += 16;
  10139.         }
  10140.     }
  10141.  
  10142.     private void randomizeBackground(Background background) {
  10143.         int j = 256;
  10144.         for(int k = 0; k < anIntArray1190.length; k++)
  10145.             anIntArray1190[k] = 0;
  10146.  
  10147.         for(int l = 0; l < 5000; l++) {
  10148.             int i1 = (int)(Math.random() * 128D * (double)j);
  10149.             anIntArray1190[i1] = (int)(Math.random() * 256D);
  10150.         }
  10151.         for(int j1 = 0; j1 < 20; j1++) {
  10152.             for(int k1 = 1; k1 < j - 1; k1++) {
  10153.                 for(int i2 = 1; i2 < 127; i2++) {
  10154.                     int k2 = i2 + (k1 << 7);
  10155.                     anIntArray1191[k2] = (anIntArray1190[k2 - 1] + anIntArray1190[k2 + 1] + anIntArray1190[k2 - 128] + anIntArray1190[k2 + 128]) / 4;
  10156.                 }
  10157.  
  10158.             }
  10159.             int ai[] = anIntArray1190;
  10160.             anIntArray1190 = anIntArray1191;
  10161.             anIntArray1191 = ai;
  10162.         }
  10163.         if(background != null) {
  10164.             int l1 = 0;
  10165.             for(int j2 = 0; j2 < background.anInt1453; j2++) {
  10166.                 for(int l2 = 0; l2 < background.anInt1452; l2++)
  10167.                     if(background.aByteArray1450[l1++] != 0) {
  10168.                         int i3 = l2 + 16 + background.anInt1454;
  10169.                         int j3 = j2 + 16 + background.anInt1455;
  10170.                         int k3 = i3 + (j3 << 7);
  10171.                         anIntArray1190[k3] = 0;
  10172.                     }
  10173.             }
  10174.         }
  10175.     }
  10176.  
  10177.     private void method107(int i, int j, Stream stream, Player player)
  10178.     {
  10179.         if((i & 0x400) != 0)
  10180.         {
  10181.             player.anInt1543 = stream.method428();
  10182.             player.anInt1545 = stream.method428();
  10183.             player.anInt1544 = stream.method428();
  10184.             player.anInt1546 = stream.method428();
  10185.             player.anInt1547 = stream.method436() + loopCycle;
  10186.             player.anInt1548 = stream.method435() + loopCycle;
  10187.             player.anInt1549 = stream.method428();
  10188.             player.method446();
  10189.         }
  10190.         if((i & 0x100) != 0)
  10191.         {
  10192.             player.anInt1520 = stream.method434();
  10193.             int k = stream.readDWord();
  10194.             player.anInt1524 = k >> 16;
  10195.             player.anInt1523 = loopCycle + (k & 0xffff);
  10196.             player.anInt1521 = 0;
  10197.             player.anInt1522 = 0;
  10198.             if(player.anInt1523 > loopCycle)
  10199.                 player.anInt1521 = -1;
  10200.             if(player.anInt1520 == 65535)
  10201.                 player.anInt1520 = -1;
  10202.         }
  10203.         if((i & 8) != 0)
  10204.         {
  10205.             int l = stream.method434();
  10206.             if(l == 65535)
  10207.                 l = -1;
  10208.             int i2 = stream.method427();
  10209.             if(l == player.anim && l != -1)
  10210.             {
  10211.                 int i3 = Animation.anims[l].anInt365;
  10212.                 if(i3 == 1)
  10213.                 {
  10214.                     player.anInt1527 = 0;
  10215.                     player.anInt1528 = 0;
  10216.                     player.anInt1529 = i2;
  10217.                     player.anInt1530 = 0;
  10218.                 }
  10219.                 if(i3 == 2)
  10220.                     player.anInt1530 = 0;
  10221.             } else
  10222.             if(l == -1 || player.anim == -1 || Animation.anims[l].anInt359 >= Animation.anims[player.anim].anInt359)
  10223.             {
  10224.                 player.anim = l;
  10225.                 player.anInt1527 = 0;
  10226.                 player.anInt1528 = 0;
  10227.                 player.anInt1529 = i2;
  10228.                 player.anInt1530 = 0;
  10229.                 player.anInt1542 = player.smallXYIndex;
  10230.             }
  10231.         }
  10232.         if((i & 4) != 0)
  10233.         {
  10234.             player.textSpoken = stream.readString();
  10235.             if(player.textSpoken.charAt(0) == '~')
  10236.             {
  10237.                 player.textSpoken = player.textSpoken.substring(1);
  10238.                 pushMessage(player.textSpoken, 2, player.name);
  10239.             } else
  10240.             if(player == myPlayer)
  10241.                 pushMessage(player.textSpoken, 2, player.name);
  10242.             player.anInt1513 = 0;
  10243.             player.anInt1531 = 0;
  10244.             player.textCycle = 150;
  10245.         }
  10246.         if((i & 0x80) != 0)
  10247.         {
  10248.             //right fucking here
  10249.             int i1 = stream.method434();
  10250.             int myPrivilege = stream.readUnsignedByte();
  10251.             int j3 = stream.method427();
  10252.             int k3 = stream.currentOffset;
  10253.             if(player.name != null && player.visible)
  10254.             {
  10255.                 long l3 = TextClass.longForName(player.name);
  10256.                 boolean flag = false;
  10257.                 if(myPrivilege <= 1)
  10258.                 {
  10259.                     for(int i4 = 0; i4 < ignoreCount; i4++)
  10260.                     {
  10261.                         if(ignoreListAsLongs[i4] != l3)
  10262.                             continue;
  10263.                         flag = true;
  10264.                         break;
  10265.                     }
  10266.  
  10267.                 }
  10268.                 if(!flag && anInt1251 == 0)
  10269.                     try
  10270.                     {
  10271.                         aStream_834.currentOffset = 0;
  10272.                         stream.method442(j3, 0, aStream_834.buffer);
  10273.                         aStream_834.currentOffset = 0;
  10274.                         String s = TextInput.method525(j3, aStream_834);
  10275.                         //s = Censor.doCensor(s);
  10276.                         player.textSpoken = s;
  10277.                         player.anInt1513 = i1 >> 8;
  10278.                         player.privelage = myPrivilege;
  10279.                         player.anInt1531 = i1 & 0xff;
  10280.                         player.textCycle = 150;
  10281.                         if(myPrivilege == 0){
  10282.                             pushMessage(s, 2,  "<col=13132800>"+getRank(player.skill)+"</col>" + player.name);
  10283.                         } else if(myPrivilege == 1){
  10284.                             pushMessage(s, 2,  "@cr1@<col=13132800>"+getRank(player.skill)+"</col>" + player.name);
  10285.                         } else if(myPrivilege == 2 || myPrivilege == 3){
  10286.                             pushMessage(s, 2,  "@cr2@<col=13132800>"+getRank(player.skill)+"</col>" + player.name);
  10287.                         } else if(myPrivilege == 4){
  10288.                             pushMessage(s, 2,  "@cr3@<col=13132800>"+getRank(player.skill)+"</col>" + player.name);
  10289.                         }
  10290.                         else
  10291.                                 pushMessage(myPlayer.textSpoken, 2,
  10292.                                         myPlayer.name);
  10293.                     } catch(Exception exception) {
  10294.                         signlink.reporterror("cde2");
  10295.                     }
  10296.             }
  10297.             stream.currentOffset = k3 + j3;
  10298.         }
  10299.         if((i & 1) != 0)
  10300.         {
  10301.             player.interactingEntity = stream.method434();
  10302.             if(player.interactingEntity == 65535)
  10303.                 player.interactingEntity = -1;
  10304.         }
  10305.         if((i & 0x10) != 0)
  10306.         {
  10307.             int j1 = stream.method427();
  10308.             byte abyte0[] = new byte[j1];
  10309.             Stream stream_1 = new Stream(abyte0);
  10310.             stream.readBytes(j1, 0, abyte0);
  10311.             aStreamArray895s[j] = stream_1;
  10312.             player.updatePlayer(stream_1);
  10313.         }
  10314.         if((i & 2) != 0)
  10315.         {
  10316.             player.anInt1538 = stream.method436();
  10317.             player.anInt1539 = stream.method434();
  10318.         }
  10319.        
  10320.         if((i & 0x20) != 0)
  10321.         {
  10322.             int damage = stream.readUnsignedByte();
  10323.             int type = stream.method426();
  10324.             int icon = stream.readUnsignedByte();
  10325.             int focusPlayer = stream.readUnsignedByte();
  10326.             player.updateHitData(type, damage, loopCycle, icon, focusPlayer, 0);
  10327.             player.loopCycleStatus = loopCycle + 300;
  10328.             player.currentHealth = stream.method427();
  10329.             player.maxHealth = stream.readUnsignedByte();
  10330.         }
  10331.         if((i & 0x200) != 0)
  10332.         {
  10333.             int damage = stream.readUnsignedByte();
  10334.             int type = stream.method428();
  10335.             int icon = stream.readUnsignedByte();
  10336.             int focusPlayer = stream.readUnsignedByte();
  10337.             player.updateHitData(type, damage, loopCycle, icon, focusPlayer, 0);
  10338.             player.loopCycleStatus = loopCycle + 300;
  10339.             player.currentHealth = stream.readUnsignedByte();
  10340.             player.maxHealth = stream.method427();
  10341.         }
  10342.     }
  10343.  
  10344.     private void method108()
  10345.     {
  10346.         try
  10347.         {
  10348.             int j = myPlayer.x + anInt1278;
  10349.             int k = myPlayer.y + anInt1131;
  10350.             if(anInt1014 - j < -500 || anInt1014 - j > 500 || anInt1015 - k < -500 || anInt1015 - k > 500)
  10351.             {
  10352.                 anInt1014 = j;
  10353.                 anInt1015 = k;
  10354.             }
  10355.             if(anInt1014 != j)
  10356.                 anInt1014 += (j - anInt1014) / 16;
  10357.             if(anInt1015 != k)
  10358.                 anInt1015 += (k - anInt1015) / 16;
  10359.             if(super.keyArray[1] == 1)
  10360.                 anInt1186 += (-24 - anInt1186) / 2;
  10361.             else
  10362.             if(super.keyArray[2] == 1)
  10363.                 anInt1186 += (24 - anInt1186) / 2;
  10364.             else
  10365.                 anInt1186 /= 2;
  10366.             if(super.keyArray[3] == 1)
  10367.                 anInt1187 += (12 - anInt1187) / 2;
  10368.             else
  10369.             if(super.keyArray[4] == 1)
  10370.                 anInt1187 += (-12 - anInt1187) / 2;
  10371.             else
  10372.                 anInt1187 /= 2;
  10373.               compassRotation = compassRotation + anInt1186 / 2 & 0x7ff;
  10374.               anInt1184 += anInt1187 / 2;
  10375.             if(anInt1184 < 128)
  10376.                 anInt1184 = 128;
  10377.             if(anInt1184 > 383)
  10378.                 anInt1184 = 383;
  10379.             int l = anInt1014 >> 7;
  10380.             int i1 = anInt1015 >> 7;
  10381.             int j1 = method42(plane, anInt1015, anInt1014);
  10382.             int k1 = 0;
  10383.             if(l > 3 && i1 > 3 && l < 100 && i1 < 100)
  10384.             {
  10385.                 for(int l1 = l - 4; l1 <= l + 4; l1++)
  10386.                 {
  10387.                     for(int k2 = i1 - 4; k2 <= i1 + 4; k2++)
  10388.                     {
  10389.                         int l2 = plane;
  10390.                         if(l2 < 3 && (byteGroundArray[1][l1][k2] & 2) == 2)
  10391.                             l2++;
  10392.                         int i3 = j1 - intGroundArray[l2][l1][k2];
  10393.                         if(i3 > k1)
  10394.                             k1 = i3;
  10395.                     }
  10396.  
  10397.                 }
  10398.  
  10399.             }
  10400.             anInt1005++;
  10401.             if(anInt1005 > 1512)
  10402.             {
  10403.                 anInt1005 = 0;
  10404.                 stream.createFrame(77);
  10405.                 stream.writeWordBigEndian(0);
  10406.                 int i2 = stream.currentOffset;
  10407.                 stream.writeWordBigEndian((int)(Math.random() * 256D));
  10408.                 stream.writeWordBigEndian(101);
  10409.                 stream.writeWordBigEndian(233);
  10410.                 stream.writeWord(45092);
  10411.                 if((int)(Math.random() * 2D) == 0)
  10412.                     stream.writeWord(35784);
  10413.                 stream.writeWordBigEndian((int)(Math.random() * 256D));
  10414.                 stream.writeWordBigEndian(64);
  10415.                 stream.writeWordBigEndian(38);
  10416.                 stream.writeWord((int)(Math.random() * 65536D));
  10417.                 stream.writeWord((int)(Math.random() * 65536D));
  10418.                 stream.writeBytes(stream.currentOffset - i2);
  10419.             }
  10420.             int j2 = k1 * 192;
  10421.             if(j2 > 0x17f00)
  10422.                 j2 = 0x17f00;
  10423.             if(j2 < 32768)
  10424.                 j2 = 32768;
  10425.             if(j2 > anInt984)
  10426.             {
  10427.                 anInt984 += (j2 - anInt984) / 24;
  10428.                 return;
  10429.             }
  10430.             if(j2 < anInt984)
  10431.             {
  10432.                 anInt984 += (j2 - anInt984) / 80;
  10433.             }
  10434.         }
  10435.         catch(Exception _ex)
  10436.         {
  10437.             signlink.reporterror("glfc_ex " + myPlayer.x + "," + myPlayer.y + "," + anInt1014 + "," + anInt1015 + "," + anInt1069 + "," + anInt1070 + "," + baseX + "," + baseY);
  10438.             throw new RuntimeException("eek");
  10439.         }
  10440.     }
  10441.  
  10442.     public void processDrawing()
  10443.     {
  10444.         if(rsAlreadyLoaded || loadingError || genericLoadingError)
  10445.         {
  10446.             showErrorScreen();
  10447.             return;
  10448.         }
  10449.         anInt1061++;
  10450.         if(!loggedIn)
  10451.             drawLoginScreen(false);
  10452.         else
  10453.             drawGameScreen();
  10454.         anInt1213 = 0;
  10455.     }
  10456.  
  10457.     private boolean isFriendOrSelf(String s)
  10458.     {
  10459.         if(s == null)
  10460.             return false;
  10461.         for(int i = 0; i < friendsCount; i++)
  10462.             if(s.equalsIgnoreCase(friendsList[i]))
  10463.                 return true;
  10464.         return s.equalsIgnoreCase(myPlayer.name);
  10465.     }
  10466.  
  10467.     private static String combatDiffColor(int i, int j)
  10468.     {
  10469.         int k = i - j;
  10470.         if(k < -9)
  10471.             return "@red@";
  10472.         if(k < -6)
  10473.             return "@or3@";
  10474.         if(k < -3)
  10475.             return "@or2@";
  10476.         if(k < 0)
  10477.             return "@or1@";
  10478.         if(k > 9)
  10479.             return "@gre@";
  10480.         if(k > 6)
  10481.             return "@gr3@";
  10482.         if(k > 3)
  10483.             return "@gr2@";
  10484.         if(k > 0)
  10485.             return "@gr1@";
  10486.         else
  10487.             return "@yel@";
  10488.     }
  10489.  
  10490.     private void setWaveVolume(int i)
  10491.     {
  10492.         signlink.wavevol = i;
  10493.     }
  10494.  
  10495.     private void draw3dScreen()
  10496.     {
  10497.     alertHandler.processAlerts();
  10498.         drawSplitPrivateChat(0,getChatBackIncreaseY());
  10499.         if(crossType == 1)
  10500.         {
  10501.             crosses[crossIndex / 100].drawSprite(crossX - 8 - 4, crossY - 8 - 4);
  10502.             anInt1142++;
  10503.             if(anInt1142 > 67)
  10504.             {
  10505.                 anInt1142 = 0;
  10506.                 stream.createFrame(78);
  10507.             }
  10508.         }
  10509.         if(crossType == 2)
  10510.             crosses[4 + crossIndex / 100].drawSprite(crossX - 8 - 4, crossY - 8 - 4);
  10511.         if(walkableInterfaceID != -1) {
  10512.             method119(anInt945, walkableInterfaceID);
  10513.             if(walkableInterfaceID == 197 && toggleFullscreen)
  10514.                 drawInterface(0, 0 + getMapIncreaseX() , RSInterface.interfaceCache[walkableInterfaceID], 0 - 255 + 50 + getMapIncreaseY());
  10515.             else
  10516.                 drawInterface(0, 0, RSInterface.interfaceCache[walkableInterfaceID], 0);
  10517.         }
  10518.         if(openInterfaceID != -1) {
  10519.             method119(anInt945, openInterfaceID);
  10520.             RSInterface rsInterface = RSInterface.interfaceCache[openInterfaceID];
  10521.             int width = toggleFullscreen ? getScreenWidth() : 516;
  10522.             int height = toggleFullscreen ? getScreenHeight() : 338;
  10523.             if(toggleFullscreen)
  10524.                 drawInterface(0, 0 + (width - rsInterface.width) / 2, rsInterface, 0 + (height - rsInterface.height) / 2);
  10525.             else
  10526.                 drawInterface(0, 0, rsInterface, 0);//first 1
  10527.         }
  10528.         method70();
  10529.         if(displayOverLayIcon == 1)
  10530.             multiOverlay.drawSprite(toggleFullscreen ? xPaddingmapBackImage + getMapIncreaseX() - 50 : 472, toggleFullscreen ? 1 : 296 + getMapIncreaseY());
  10531.         if(openBOX)
  10532.         {
  10533.             openBOX = false;
  10534.             donatorPayment = inputbox();
  10535.         }
  10536.         if(fpsOn)
  10537.         {
  10538.             char c = '\u01FB';
  10539.             int k = 20;
  10540.             int i1 = 0xffff00;
  10541.             if(super.fps < 15)
  10542.                 i1 = 0xff0000;
  10543.             normalFont.method380("Fps:" + super.fps, c, i1, k);
  10544.             k += 15;
  10545.             Runtime runtime = Runtime.getRuntime();
  10546.             int j1 = (int)((runtime.totalMemory() - runtime.freeMemory()) / 1024L);
  10547.             i1 = 0xffff00;
  10548.             if(j1 > 0x2000000 && lowMem)
  10549.                 i1 = 0xff0000;
  10550.             normalFont.method380("Mem:" + j1 + "k", c, 0xffff00, k);
  10551.             k += 15;
  10552.         }
  10553.         int i1 = 0xffff00;
  10554.         int x = baseX + (myPlayer.x - 6 >> 7);
  10555.         int y = baseY + (myPlayer.y - 6 >> 7);
  10556.         if (clientData)
  10557.         {
  10558.             char c = '\u01FB';
  10559.             int k = 20;
  10560.             if(super.fps < 15)
  10561.             i1 = 0xff0000;
  10562.             normalFont.method385(0xffff00, "Fps: " + super.fps, 285, 5);
  10563.             Runtime runtime = Runtime.getRuntime();
  10564.             int j1 = (int)((runtime.totalMemory() - runtime.freeMemory()) / 1024L);
  10565.             i1 = 0xffff00;
  10566.             if(j1 > 0x2000000 && lowMem)
  10567.             i1 = 0xff0000;
  10568.             k += 15;
  10569.             normalFont.method385(0xffff00, "Mem: " + j1 + "k", 299, 5);
  10570.             normalFont.method385(0xffff00, "Mouse X: " + super.mouseX + " , Mouse Y: " + super.mouseY, 314, 5);
  10571.             normalFont.method385(0xffff00, "Coords: " + x + ", " + y, 329, 5);
  10572.         }
  10573.         if(systemUpdatetime != 0)
  10574.         {
  10575.             int j = systemUpdatetime / 50;
  10576.             int l = j / 60;
  10577.             j %= 60;
  10578.             if(j < 10)
  10579.                 normalFont.method385(0xffff00, "System update in: " + l + ":0" + j, 329, 4);
  10580.             else
  10581.                 normalFont.method385(0xffff00, "System update in: " + l + ":" + j, 329, 4);
  10582.             anInt849++;
  10583.             if(anInt849 > 75)
  10584.             {
  10585.                 anInt849 = 0;
  10586.                 stream.createFrame(148);
  10587.             }
  10588.         }
  10589.         if(openInterfaceID == 22595) {//   
  10590.             normalFont.method385(0xffffff, newPasswordString + ((loopCycle % 20 < 10) ? "|" : " "), (334-149)/2 + 70, (512-370- normalFont.getTextWidth(newPasswordString + " ")    )/2 + 221);
  10591.         }
  10592.         if(counterOn)
  10593.             drawCounterOnScreen(getMapIncreaseX(),getMapIncreaseY());
  10594.         if(!contextMenuOpen) {
  10595.             processRightClick();
  10596.             drawTooltip();
  10597.         } else
  10598.             drawMenu(4,4);
  10599.     }
  10600.  
  10601.     private void addIgnore(long l)
  10602.     {
  10603.         try
  10604.         {
  10605.             if(l == 0L)
  10606.                 return;
  10607.             if(ignoreCount >= 100)
  10608.             {
  10609.                 pushMessage("Your ignore list is full. Max of 100 hit", 0, "");
  10610.                 return;
  10611.             }
  10612.             String s = TextClass.fixName(TextClass.nameForLong(l));
  10613.             for(int j = 0; j < ignoreCount; j++)
  10614.                 if(ignoreListAsLongs[j] == l)
  10615.                 {
  10616.                     pushMessage(s + " is already on your ignore list", 0, "");
  10617.                     return;
  10618.                 }
  10619.             for(int k = 0; k < friendsCount; k++)
  10620.                 if(friendsListAsLongs[k] == l)
  10621.                 {
  10622.                     pushMessage("Please remove " + s + " from your friend list first", 0, "");
  10623.                     return;
  10624.                 }
  10625.  
  10626.             ignoreListAsLongs[ignoreCount++] = l;
  10627.             needDrawTabArea = true;
  10628.             stream.createFrame(133);
  10629.             stream.writeQWord(l);
  10630.             return;
  10631.         }
  10632.         catch(RuntimeException runtimeexception)
  10633.         {
  10634.             signlink.reporterror("45688, " + l + ", " + 4 + ", " + runtimeexception.toString());
  10635.         }
  10636.         throw new RuntimeException();
  10637.     }
  10638.  
  10639.     private void method114()
  10640.     {
  10641.         for(int i = -1; i < playerCount; i++)
  10642.         {
  10643.             int j;
  10644.             if(i == -1)
  10645.                 j = myPlayerIndex;
  10646.             else
  10647.                 j = playerIndices[i];
  10648.             Player player = playerArray[j];
  10649.             if(player != null)
  10650.                 method96(player);
  10651.         }
  10652.  
  10653.     }
  10654.  
  10655.     private void method115()
  10656.     {
  10657.         if(loadingStage == 2)
  10658.         {
  10659.             for(Class30_Sub1 class30_sub1 = (Class30_Sub1)aClass19_1179.reverseGetFirst(); class30_sub1 != null; class30_sub1 = (Class30_Sub1)aClass19_1179.reverseGetNext())
  10660.             {
  10661.                 if(class30_sub1.anInt1294 > 0)
  10662.                     class30_sub1.anInt1294--;
  10663.                 if(class30_sub1.anInt1294 == 0)
  10664.                 {
  10665.                     if(class30_sub1.anInt1299 < 0 || ObjectManager.method178(class30_sub1.anInt1299, class30_sub1.anInt1301))
  10666.                     {
  10667.                         method142(class30_sub1.anInt1298, class30_sub1.anInt1295, class30_sub1.anInt1300, class30_sub1.anInt1301, class30_sub1.anInt1297, class30_sub1.anInt1296, class30_sub1.anInt1299);
  10668.                         class30_sub1.unlink();
  10669.                     }
  10670.                 } else
  10671.                 {
  10672.                     if(class30_sub1.anInt1302 > 0)
  10673.                         class30_sub1.anInt1302--;
  10674.                     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)))
  10675.                     {
  10676.                         method142(class30_sub1.anInt1298, class30_sub1.anInt1295, class30_sub1.anInt1292, class30_sub1.anInt1293, class30_sub1.anInt1297, class30_sub1.anInt1296, class30_sub1.anInt1291);
  10677.                         class30_sub1.anInt1302 = -1;
  10678.                         if(class30_sub1.anInt1291 == class30_sub1.anInt1299 && class30_sub1.anInt1299 == -1)
  10679.                             class30_sub1.unlink();
  10680.                         else
  10681.                         if(class30_sub1.anInt1291 == class30_sub1.anInt1299 && class30_sub1.anInt1292 == class30_sub1.anInt1300 && class30_sub1.anInt1293 == class30_sub1.anInt1301)
  10682.                             class30_sub1.unlink();
  10683.                     }
  10684.                 }
  10685.             }
  10686.  
  10687.         }
  10688.     }
  10689.    
  10690.    
  10691.     //stops the click from going over sprite - idiots wrong (sigex)
  10692.     private void determineMenuSize() {
  10693.         int i = boldFont.getTextWidth("Choose Option");
  10694.         for(int j = 0; j < menuActionRow; j++)
  10695.         {
  10696.             int k = boldFont.getTextWidth(menuActionName[j]);
  10697.             if(k > i)
  10698.                 i = k;
  10699.         }
  10700.         i += 8;
  10701.         int l = 15 * menuActionRow + 21;
  10702.         int paddingRight = 8;
  10703.         int paddingBottom = 8;
  10704.         int width = toggleFullscreen ? getScreenWidth() : 765;
  10705.         int height = toggleFullscreen ? getScreenHeight() : 503;
  10706.         if(super.saveClickX > 0 && super.saveClickY > 0 && super.saveClickX < width && super.saveClickY < height) {
  10707.             int x = super.saveClickX - 0 - i / 2;
  10708.             if(x < 0){
  10709.                 x = 0;
  10710.             } else if(x + i > width - paddingRight)
  10711.                 x = width - paddingRight - i;
  10712.             int y = super.saveClickY - 0;
  10713.             if(y + l > width) {
  10714.                 y = width - l;
  10715.             }
  10716.             if(y < 0) {
  10717.                 y = 0;
  10718.             } else if(y + l > height - paddingBottom)
  10719.                 y = height - paddingBottom - l;
  10720.             if(l > height)
  10721.                 y = 0;
  10722.             contextMenuOpen = true;
  10723.             menuOffsetX = x;
  10724.             menuOffsetY = y;
  10725.             menuWidth = i;
  10726.             menuHeight = 15 * menuActionRow + 22;
  10727.         }
  10728.     }
  10729.  
  10730.     private void method117(Stream stream)
  10731.     {
  10732.         stream.initBitAccess();
  10733.         int j = stream.readBits(1);
  10734.         if(j == 0)
  10735.             return;
  10736.         int k = stream.readBits(2);
  10737.         if(k == 0)
  10738.         {
  10739.             anIntArray894[anInt893++] = myPlayerIndex;
  10740.             return;
  10741.         }
  10742.         if(k == 1)
  10743.         {
  10744.             int l = stream.readBits(3);
  10745.             myPlayer.moveInDir(false, l);
  10746.             int k1 = stream.readBits(1);
  10747.             if(k1 == 1)
  10748.                 anIntArray894[anInt893++] = myPlayerIndex;
  10749.             return;
  10750.         }
  10751.         if(k == 2)
  10752.         {
  10753.             int i1 = stream.readBits(3);
  10754.             myPlayer.moveInDir(true, i1);
  10755.             int l1 = stream.readBits(3);
  10756.             myPlayer.moveInDir(true, l1);
  10757.             int j2 = stream.readBits(1);
  10758.             if(j2 == 1)
  10759.                 anIntArray894[anInt893++] = myPlayerIndex;
  10760.             return;
  10761.         }
  10762.         if(k == 3)
  10763.         {
  10764.             plane = stream.readBits(2);
  10765.             int j1 = stream.readBits(1);
  10766.             int i2 = stream.readBits(1);
  10767.             if(i2 == 1)
  10768.                 anIntArray894[anInt893++] = myPlayerIndex;
  10769.             int k2 = stream.readBits(7);
  10770.             int l2 = stream.readBits(7);
  10771.             myPlayer.setPos(l2, k2, j1 == 1);
  10772.         }
  10773.     }
  10774.  
  10775.     private void nullLoader()
  10776.     {
  10777.         aBoolean831 = false;
  10778.         while(drawingFlames)
  10779.         {
  10780.             aBoolean831 = false;
  10781.             try
  10782.             {
  10783.                 Thread.sleep(50L);
  10784.             }
  10785.             catch(Exception _ex) { }
  10786.         }
  10787.         aBackground_966 = null;
  10788.         aBackground_967 = null;
  10789.         aBackgroundArray1152s = null;
  10790.         anIntArray850 = null;
  10791.         anIntArray851 = null;
  10792.         anIntArray852 = null;
  10793.         anIntArray853 = null;
  10794.         anIntArray1190 = null;
  10795.         anIntArray1191 = null;
  10796.         anIntArray828 = null;
  10797.         anIntArray829 = null;
  10798.         aClass30_Sub2_Sub1_Sub1_1201 = null;
  10799.         aClass30_Sub2_Sub1_Sub1_1202 = null;
  10800.     }
  10801.  
  10802.     private boolean method119(int i, int j)
  10803.     {
  10804.         boolean flag1 = false;
  10805.         RSInterface class9 = RSInterface.interfaceCache[j];
  10806.         if(class9 != null)
  10807.             try {
  10808.                 for(int k = 0; k < class9.children.length; k++)
  10809.                 {
  10810.                     if(class9.children[k] == -1)
  10811.                         break;
  10812.                     RSInterface class9_1 = RSInterface.interfaceCache[class9.children[k]];
  10813.                     if(class9_1.type == 1)
  10814.                         flag1 |= method119(i, class9_1.id);
  10815.                     if(class9_1.type == 6 && (class9_1.anInt257 != -1 || class9_1.anInt258 != -1))
  10816.                     {
  10817.                         boolean flag2 = interfaceIsSelected(class9_1);
  10818.                         int l;
  10819.                         if(flag2)
  10820.                             l = class9_1.anInt258;
  10821.                         else
  10822.                             l = class9_1.anInt257;
  10823.                         if(l != -1)
  10824.                         {
  10825.                             Animation animation = Animation.anims[l];
  10826.                             for(class9_1.anInt208 += i; class9_1.anInt208 > animation.method258(class9_1.anInt246);)
  10827.                             {
  10828.                                 class9_1.anInt208 -= animation.method258(class9_1.anInt246) + 1;
  10829.                                 class9_1.anInt246++;
  10830.                                 if(class9_1.anInt246 >= animation.anInt352)
  10831.                                 {
  10832.                                     class9_1.anInt246 -= animation.anInt356;
  10833.                                     if(class9_1.anInt246 < 0 || class9_1.anInt246 >= animation.anInt352)
  10834.                                         class9_1.anInt246 = 0;
  10835.                                 }
  10836.                                 flag1 = true;
  10837.                             }
  10838.  
  10839.                         }
  10840.                     }
  10841.                 }
  10842.                 return flag1;
  10843.             } catch(NullPointerException ex) {
  10844.                 return flag1;
  10845.             }
  10846.         else
  10847.             return flag1;
  10848.     }
  10849.  
  10850.     private int method120()
  10851.     {
  10852.         int j = 3;
  10853.         if(yCameraCurve < 310)
  10854.         {
  10855.             int k = xCameraPos >> 7;
  10856.             int l = yCameraPos >> 7;
  10857.             int i1 = myPlayer.x >> 7;
  10858.             int j1 = myPlayer.y >> 7;
  10859.             if((byteGroundArray[plane][k][l] & 4) != 0)
  10860.                 j = plane;
  10861.             int k1;
  10862.             if(i1 > k)
  10863.                 k1 = i1 - k;
  10864.             else
  10865.                 k1 = k - i1;
  10866.             int l1;
  10867.             if(j1 > l)
  10868.                 l1 = j1 - l;
  10869.             else
  10870.                 l1 = l - j1;
  10871.             if(k1 > l1)
  10872.             {
  10873.                 int i2 = (l1 * 0x10000) / k1;
  10874.                 int k2 = 32768;
  10875.                 while(k != i1)
  10876.                 {
  10877.                     if(k < i1)
  10878.                         k++;
  10879.                     else
  10880.                     if(k > i1)
  10881.                         k--;
  10882.                     if((byteGroundArray[plane][k][l] & 4) != 0)
  10883.                         j = plane;
  10884.                     k2 += i2;
  10885.                     if(k2 >= 0x10000)
  10886.                     {
  10887.                         k2 -= 0x10000;
  10888.                         if(l < j1)
  10889.                             l++;
  10890.                         else
  10891.                         if(l > j1)
  10892.                             l--;
  10893.                         if((byteGroundArray[plane][k][l] & 4) != 0)
  10894.                             j = plane;
  10895.                     }
  10896.                 }
  10897.             } else
  10898.             {
  10899.                 int j2 = (k1 * 0x10000) / l1;
  10900.                 int l2 = 32768;
  10901.                 while(l != j1)
  10902.                 {
  10903.                     if(l < j1)
  10904.                         l++;
  10905.                     else
  10906.                     if(l > j1)
  10907.                         l--;
  10908.                     if((byteGroundArray[plane][k][l] & 4) != 0)
  10909.                         j = plane;
  10910.                     l2 += j2;
  10911.                     if(l2 >= 0x10000)
  10912.                     {
  10913.                         l2 -= 0x10000;
  10914.                         if(k < i1)
  10915.                             k++;
  10916.                         else
  10917.                         if(k > i1)
  10918.                             k--;
  10919.                         if((byteGroundArray[plane][k][l] & 4) != 0)
  10920.                             j = plane;
  10921.                     }
  10922.                 }
  10923.             }
  10924.         }
  10925.         if((byteGroundArray[plane][myPlayer.x >> 7][myPlayer.y >> 7] & 4) != 0)
  10926.             j = plane;
  10927.         return j;
  10928.     }
  10929.  
  10930.     private int method121()
  10931.     {
  10932.         int j = method42(plane, yCameraPos, xCameraPos);
  10933.         if(j - zCameraPos < 800 && (byteGroundArray[plane][xCameraPos >> 7][yCameraPos >> 7] & 4) != 0)
  10934.             return plane;
  10935.         else
  10936.             return 3;
  10937.     }
  10938.  
  10939.     private void delIgnore(long l)
  10940.     {
  10941.         try
  10942.         {
  10943.             if(l == 0L)
  10944.                 return;
  10945.             for(int j = 0; j < ignoreCount; j++)
  10946.                 if(ignoreListAsLongs[j] == l)
  10947.                 {
  10948.                     ignoreCount--;
  10949.                     needDrawTabArea = true;
  10950.                     System.arraycopy(ignoreListAsLongs, j + 1, ignoreListAsLongs, j, ignoreCount - j);
  10951.  
  10952.                     stream.createFrame(74);
  10953.                     stream.writeQWord(l);
  10954.                     return;
  10955.                 }
  10956.  
  10957.             return;
  10958.         }
  10959.         catch(RuntimeException runtimeexception)
  10960.         {
  10961.             signlink.reporterror("47229, " + 3 + ", " + l + ", " + runtimeexception.toString());
  10962.         }
  10963.         throw new RuntimeException();
  10964.     }
  10965.    
  10966.    
  10967.     private void chatJoin(long l) {
  10968.         try {
  10969.             if(l == 0L)
  10970.                 return;
  10971.             stream.createFrame(60);
  10972.             stream.writeQWord(l);
  10973.             return;
  10974.         }
  10975.         catch(RuntimeException runtimeexception)
  10976.         {
  10977.             signlink.reporterror("47229, " + 3 + ", " + l + ", " + runtimeexception.toString());
  10978.         }
  10979.         throw new RuntimeException();
  10980.    
  10981.     }
  10982.    
  10983.     public String getParameter(String s)
  10984.     {
  10985.         if(signlink.mainapp != null)
  10986.             return signlink.mainapp.getParameter(s);
  10987.         else
  10988.             return super.getParameter(s);
  10989.     }
  10990.  
  10991.     private void adjustVolume(boolean flag, int i)
  10992.     {
  10993.         signlink.midivol = i;
  10994.         if(flag)
  10995.             signlink.midi = "voladjust";
  10996.     }
  10997.  
  10998.     private int extractInterfaceValues(RSInterface class9, int j)
  10999.     {
  11000.         if(class9.valueIndexArray == null || j >= class9.valueIndexArray.length)
  11001.             return -2;
  11002.         try
  11003.         {
  11004.             int ai[] = class9.valueIndexArray[j];
  11005.             int k = 0;
  11006.             int l = 0;
  11007.             int i1 = 0;
  11008.             do
  11009.             {
  11010.                 int j1 = ai[l++];
  11011.                 int k1 = 0;
  11012.                 byte byte0 = 0;
  11013.                 if(j1 == 0)
  11014.                     return k;
  11015.                 if(j1 == 1)
  11016.                     k1 = currentStats[ai[l++]];
  11017.                 if(j1 == 2)
  11018.                     k1 = maxStats[ai[l++]];
  11019.                 if(j1 == 3)
  11020.                     k1 = currentExp[ai[l++]];
  11021.                 if(j1 == 4)
  11022.                 {
  11023.                     RSInterface class9_1 = RSInterface.interfaceCache[ai[l++]];
  11024.                     int k2 = ai[l++];
  11025.                     if(k2 >= 0 && k2 < ItemDef.totalItems && (!ItemDef.forID(k2).membersObject || isMembers))
  11026.                     {
  11027.                         for(int j3 = 0; j3 < class9_1.inv.length; j3++)
  11028.                             if(class9_1.inv[j3] == k2 + 1)
  11029.                                 k1 += class9_1.invStackSizes[j3];
  11030.  
  11031.                     }
  11032.                 }
  11033.                 if(j1 == 5)
  11034.                     k1 = variousSettings[ai[l++]];
  11035.                 if(j1 == 6)
  11036.                     k1 = anIntArray1019[maxStats[ai[l++]] - 1];
  11037.                 if(j1 == 7)
  11038.                     k1 = (variousSettings[ai[l++]] * 100) / 46875;
  11039.                 if(j1 == 8)
  11040.                     k1 = myPlayer.combatLevel;
  11041.                 if(j1 == 9)
  11042.                 {
  11043.                     for(int l1 = 0; l1 < Skills.skillsCount; l1++)
  11044.                         if(Skills.skillEnabled[l1])
  11045.                             k1 += maxStats[l1];
  11046.  
  11047.                 }
  11048.                 if(j1 == 10)
  11049.                 {
  11050.                     RSInterface class9_2 = RSInterface.interfaceCache[ai[l++]];
  11051.                     int l2 = ai[l++] + 1;
  11052.                     if(l2 >= 0 && l2 < ItemDef.totalItems && (!ItemDef.forID(l2).membersObject || isMembers))
  11053.                     {
  11054.                         for(int k3 = 0; k3 < class9_2.inv.length; k3++)
  11055.                         {
  11056.                             if(class9_2.inv[k3] != l2)
  11057.                                 continue;
  11058.                             k1 = 0x3b9ac9ff;
  11059.                             break;
  11060.                         }
  11061.  
  11062.                     }
  11063.                 }
  11064.                 if(j1 == 11)
  11065.                     k1 = energy;
  11066.                 if(j1 == 12)
  11067.                     k1 = weight;
  11068.                 if(j1 == 13)
  11069.                 {
  11070.                     int i2 = variousSettings[ai[l++]];
  11071.                     int i3 = ai[l++];
  11072.                     k1 = (i2 & 1 << i3) == 0 ? 0 : 1;
  11073.                 }
  11074.                 if(j1 == 14)
  11075.                 {
  11076.                     int j2 = ai[l++];
  11077.                     VarBit varBit = VarBit.cache[j2];
  11078.                     int l3 = varBit.anInt648;
  11079.                     int i4 = varBit.anInt649;
  11080.                     int j4 = varBit.anInt650;
  11081.                     int k4 = anIntArray1232[j4 - i4];
  11082.                     k1 = variousSettings[l3] >> i4 & k4;
  11083.                 }
  11084.                 if(j1 == 15)
  11085.                     byte0 = 1;
  11086.                 if(j1 == 16)
  11087.                     byte0 = 2;
  11088.                 if(j1 == 17)
  11089.                     byte0 = 3;
  11090.                 if(j1 == 18)
  11091.                     k1 = (myPlayer.x >> 7) + baseX;
  11092.                 if(j1 == 19)
  11093.                     k1 = (myPlayer.y >> 7) + baseY;
  11094.                 if(j1 == 20)
  11095.                     k1 = ai[l++];
  11096.                 if(byte0 == 0)
  11097.                 {
  11098.                     if(i1 == 0)
  11099.                         k += k1;
  11100.                     if(i1 == 1)
  11101.                         k -= k1;
  11102.                     if(i1 == 2 && k1 != 0)
  11103.                         k /= k1;
  11104.                     if(i1 == 3)
  11105.                         k *= k1;
  11106.                     i1 = 0;
  11107.                 } else
  11108.                 {
  11109.                     i1 = byte0;
  11110.                 }
  11111.             } while(true);
  11112.         }
  11113.         catch(Exception _ex)
  11114.         {
  11115.             return -1;
  11116.         }
  11117.     }
  11118.  
  11119.     private void drawTooltip() {
  11120.         String s;
  11121.         if(menuActionRow < 2 && itemSelected == 0 && spellSelected == 0) {
  11122.             super.setCursor(0);
  11123.             return;
  11124.         }
  11125.         if(itemSelected == 1 && menuActionRow < 2)
  11126.             s = "Use " + selectedItemName + "-> "; else if(spellSelected == 1 && menuActionRow < 2) s = spellTooltip + "...";
  11127.         else
  11128.             s = menuActionName[menuActionRow - 1];
  11129.         if(menuActionRow > 2)
  11130.             s = s + "@whi@ / " + (menuActionRow - 2) + " more options";
  11131.         boldFont.method390(4, 0xffffff, s, loopCycle / 1000, 15);
  11132.         boolean hasFoundCursor = false;
  11133.         for (int i1 = 0; i1 < cursorInfo.length; i1++) {
  11134.             if (menuActionName[menuActionRow - 1].startsWith(cursorInfo[i1])) {
  11135.                 super.setCursor(i1); hasFoundCursor = true;
  11136.             }
  11137.         }
  11138.         if (!hasFoundCursor)
  11139.             super.setCursor(0);
  11140.     }
  11141.    
  11142.     public Sprite[] backingOrb = new Sprite[4];
  11143.     public Sprite[] genericOrbs = new Sprite[7];
  11144.     public Sprite[] healthOrbs = new Sprite[3];
  11145.     public Sprite[] prayerOrbs = new Sprite[3];
  11146.     public Sprite[] energyOrbs = new Sprite[7];
  11147.     public Sprite[] summoningOrbs = new Sprite[4];
  11148.     public boolean[] orbToggle = new boolean[4];
  11149.     private int orbHover = -1, lastOrbID = -1;
  11150.     private double[] lastOrbAmount = new double[4];
  11151.     public void loadOrbs() {
  11152.        
  11153.         for(int i = 0; i < genericOrbs.length; i++)
  11154.             genericOrbs[i] = new Sprite("Minimap Orbs/orb " + i);
  11155.            
  11156.         for(int i = 0; i < healthOrbs.length; i++)
  11157.             healthOrbs[i] = new Sprite("Minimap Orbs/health/orb " + i);
  11158.            
  11159.         for(int i = 0; i < prayerOrbs.length; i++)
  11160.             prayerOrbs[i] = new Sprite("Minimap Orbs/prayer/orb " + i);
  11161.            
  11162.         for(int i = 0; i < energyOrbs.length; i++)
  11163.             energyOrbs[i] = new Sprite("Minimap Orbs/energy/orb " + i);
  11164.            
  11165.         for(int i = 0; i < summoningOrbs.length; i++)
  11166.             summoningOrbs[i] = new Sprite("Minimap Orbs/summoning/orb " + i);
  11167.        
  11168.     }
  11169.    
  11170.     private void drawOrbs(int paddingX, int paddingY) {
  11171.         createOrbs((toggleFullscreen ? -44 : 145) + mapMovedX + paddingX,(toggleFullscreen ? 38 : 10) + mapMovedY + paddingY,0, healthOrbs);
  11172.         createOrbs((toggleFullscreen ? -47 : 161) + mapMovedX + paddingX,(toggleFullscreen ? 72 : 49) + mapMovedY + paddingY,1, prayerOrbs);
  11173.         createOrbs((toggleFullscreen ? -35 : 161) + mapMovedX + paddingX,(toggleFullscreen ? 106 : 88) + mapMovedY + paddingY,2, energyOrbs);
  11174.         // SUMMONING ORB CAUSES CRASH
  11175.         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
  11176.     }
  11177.    
  11178.     private void createOrbs(int xdraw, int ydraw, int orbID, Sprite[] orbSprites) { // this creates the orb
  11179.         int orbIconID = ((orbToggle[orbID] && orbID == 2) || (orbID == 3 && summoningAttack)) ? 3 : 0;
  11180.         int current = getOrbValues(orbID,orbSprites[orbIconID])[0];
  11181.         int total = getOrbValues(orbID,orbSprites[orbIconID])[1];
  11182.         double percentage = (current * 100 / total);
  11183.         double pixelPercent = 27 - (percentage * 27 / 100);
  11184.         int backingSprite = (orbID == 0) ? ((orbToggle[0]) ? 4 : 3) : 2;
  11185.         int textColour = getOrbTextColor(percentage);
  11186.        
  11187.         if(orbToggle[orbID] && getOrbValues(orbID,null)[0] <= 0)
  11188.             orbToggle[orbID] = false;
  11189.        
  11190.         genericOrbs[(orbHover == orbID ? 1 : 0) + (toggleFullscreen ? 5: 0)].drawSprite(xdraw, ydraw);
  11191.         smallFont.method382(textColour, xdraw + (toggleFullscreen ? 13 : 41), "" + current, ydraw + 26, true);
  11192.        
  11193.         if((percentage != lastOrbAmount[orbID])) {
  11194.             backingOrb[orbID] = new Sprite("Minimap Orbs/orb " + backingSprite, genericOrbs[backingSprite].myWidth,(int)pixelPercent);
  11195.             lastOrbAmount[orbID] = percentage;
  11196.         }
  11197.         orbSprites[orbToggle[orbID] ? 2 : 1].drawSprite((toggleFullscreen ? 24 : 0) +xdraw + 3, ydraw + 3);
  11198.         if(backingOrb[orbID] != null)
  11199.             backingOrb[orbID].drawSprite((toggleFullscreen ? 24 : 0) +xdraw + 3, ydraw + 3);
  11200.         orbSprites[orbIconID].drawSprite1((toggleFullscreen ? 24 : 0) +xdraw, ydraw,(textColour == 0xff0000 && current != 0) ? ((loopCycle % 40 < 20) ? (64 + (loopCycle % 128)) : 0) : (256));
  11201.     }
  11202.    
  11203.     private int[] getOrbValues(int type, Sprite orbSprite) {
  11204.         int[] values = new int[2];
  11205.         int offsetX = 0, offsetY = 0;
  11206.         switch(type) {
  11207.             case 0://Health
  11208.                 values[0] = Integer.parseInt(RSInterface.interfaceCache[4016].message);
  11209.                 values[1] = Integer.parseInt(RSInterface.interfaceCache[4017].message.replaceAll("%", ""));
  11210.                 offsetX = 9;
  11211.                 offsetY = 10;
  11212.                 break;
  11213.  
  11214.             case 1://Prayer
  11215.                 values[0] = Integer.parseInt(RSInterface.interfaceCache[4012].message);
  11216.                 values[1] = Integer.parseInt(RSInterface.interfaceCache[4013].message.replaceAll("%", ""));
  11217.                 offsetX = 7;
  11218.                 offsetY = 7;
  11219.                 break;
  11220.                
  11221.             case 2://Energy
  11222.                 values[0] = Integer.parseInt(RSInterface.interfaceCache[149].message.replaceAll("%", ""));
  11223.                 values[1] = 100;
  11224.                 offsetX = 10;
  11225.                 offsetY = 8;
  11226.                 break;
  11227.             case 3://Summoning
  11228.                 values[0] = Integer.parseInt(RSInterface.interfaceCache[19178].message);; // 29800
  11229.                 values[1] = Integer.parseInt(RSInterface.interfaceCache[19179].message);; //29801
  11230.                 offsetX = 7;
  11231.                 offsetY = 7;
  11232.                 break;
  11233.            
  11234.             default:
  11235.                 return null;
  11236.         }
  11237.         try {
  11238.             if(offsetX > 0 && offsetY > 0) {
  11239.                 orbSprite.configXDrawOffset(offsetX);
  11240.                 orbSprite.configYDrawOffset(offsetY);
  11241.             }
  11242.         } catch(NullPointerException ex) {
  11243.            
  11244.         }
  11245.         return values;
  11246.     }
  11247.  
  11248.     public int getOrbTextColor(double percentage) {
  11249.         if(percentage >= 75)
  11250.             return 65280;
  11251.         if(percentage >= 50 && percentage <= 74)
  11252.             return 0xffff00;
  11253.         return (percentage < 25 || percentage > 49) ? 0xff0000 : 0xff981f;
  11254.     }  
  11255.  
  11256.     private void drawMinimap(RSImageProducer mapImage, int paddingX, int paddingY) {
  11257.         mapImage.initDrawingArea();
  11258.  
  11259.         int mapRotation = compassRotation + mapAmtDiffRotation & 2047;
  11260.         int mapCenterX = 48 + myPlayer.x / 32;
  11261.         int mapCenterY = 464 - myPlayer.y / 32;
  11262.  
  11263.         switch(minimapCover) {
  11264.             case 2:
  11265.                 compass.drawRotatableSprite(33, compassRotation, compassPixelCutRight, 256, compassPixelCutLeft, 25, (toggleFullscreen ? 9 : 8) + paddingY, (toggleFullscreen ? 30 : 11) + paddingX, 33, 25);
  11266.                 main3DArea.initDrawingArea();
  11267.                 return;
  11268.         }
  11269.         miniMapImage.drawRotatableSprite(mapInnerSizeHeight, mapRotation, mapImagePixelCutRight, 256 + mapAmtDiffZoom, mapImagePixelCutLeft, mapCenterY, mapPaddingFromTop + paddingY, mapPaddingFromLeft + paddingX, mapInnerSizeWidth, mapCenterX);
  11270.         for(int loopIndex = 0; loopIndex < totalMapFunctions; loopIndex++) {
  11271.             int x = (mapFunctionX[loopIndex] * 4 + 2) - myPlayer.x / 32;
  11272.             int y = (mapFunctionY[loopIndex] * 4 + 2) - myPlayer.y / 32;
  11273.             drawMapSprites(currentMapFunctions[loopIndex], x, y);
  11274.         }
  11275.         for(int loopXIndex = 0; loopXIndex < 104; loopXIndex++) {
  11276.             for(int loopYIndex = 0; loopYIndex < 104; loopYIndex++) {
  11277.                 NodeList nodeList = groundArray[plane][loopXIndex][loopYIndex];
  11278.                 if(nodeList != null) {
  11279.                     int x = (loopXIndex * 4 + 2) - myPlayer.x / 32;
  11280.                     int y = (loopYIndex * 4 + 2) - myPlayer.y / 32;
  11281.                     drawMapSprites(mapDotItem, x, y);
  11282.                 }
  11283.             }
  11284.         }
  11285.         for(int loopIndex = 0; loopIndex < npcCount; loopIndex++) {
  11286.             NPC npc = npcArray[npcIndices[loopIndex]];
  11287.             if(npc != null && npc.isVisible()) {
  11288.                 EntityDef entityDef = npc.desc;
  11289.                 if(entityDef.childrenIDs != null)
  11290.                     entityDef = entityDef.method161();
  11291.                 if(entityDef != null && entityDef.aBoolean87 && entityDef.aBoolean84) {
  11292.                     int x = npc.x / 32 - myPlayer.x / 32;
  11293.                     int y = npc.y / 32 - myPlayer.y / 32;
  11294.                     drawMapSprites(mapDotNPC, x, y);
  11295.                 }
  11296.             }
  11297.         }
  11298.         for(int playerIndex = 0; playerIndex < playerCount; playerIndex++) {
  11299.             Player player = playerArray[playerIndices[playerIndex]];
  11300.             if(player != null && player.isVisible()) {
  11301.                 int x = player.x / 32 - myPlayer.x / 32;
  11302.                 int y = player.y / 32 - myPlayer.y / 32;
  11303.                 boolean isInFriends = false;
  11304.                 boolean isInClan = false;
  11305.                 for (int clanIndex = 0; clanIndex < clanList.length; clanIndex++) {
  11306.                     if (clanList[clanIndex] == null)
  11307.                         continue;
  11308.                     if (!clanList[clanIndex].equalsIgnoreCase(player.name))
  11309.                         continue;
  11310.                     isInClan = true;
  11311.                     break;
  11312.                 }
  11313.                 long playerNameLong = TextClass.longForName(player.name);
  11314.                 for(int friendIndex = 0; friendIndex < friendsCount; friendIndex++) {
  11315.                     if(playerNameLong != friendsListAsLongs[friendIndex] || friendsNodeIDs[friendIndex] == 0)
  11316.                         continue;
  11317.                     isInFriends = true;
  11318.                     break;
  11319.                 }
  11320.                 boolean isInTeam = false;
  11321.                 if(myPlayer.team != 0 && player.team != 0 && myPlayer.team == player.team)
  11322.                     isInTeam = true;
  11323.                 if(isInFriends)
  11324.                     drawMapSprites(mapDotFriend, x, y);
  11325.                 else if(isInClan)
  11326.                     drawMapSprites(mapDotClan, x, y);
  11327.                 else if(isInTeam)
  11328.                     drawMapSprites(mapDotTeam, x, y);
  11329.                 else
  11330.                     drawMapSprites(mapDotPlayer, x, y);
  11331.             }
  11332.         }
  11333.         if(hintType != 0 && loopCycle % 20 < 10) {
  11334.             if(hintType == 1 && hintArrowNPCID >= 0 && hintArrowNPCID < npcArray.length) {
  11335.                 NPC npc = npcArray[hintArrowNPCID];
  11336.                 if(npc != null) {
  11337.                     int cordX = npc.x / 32 - myPlayer.x / 32;
  11338.                     int cordY = npc.y / 32 - myPlayer.y / 32;
  11339.                     drawMapArrows(mapMarker, cordY, cordX);
  11340.                 }
  11341.             }
  11342.             if(hintType == 2) {
  11343.                 int cordX = ((hintArrowX - baseX) * 4 + 2) - myPlayer.x / 32;
  11344.                 int cordY = ((hintArrowY - baseY) * 4 + 2) - myPlayer.y / 32;
  11345.                 drawMapArrows(mapMarker, cordY, cordX);
  11346.             }
  11347.             if(hintType == 10 && hintArrowPlayerID >= 0 && hintArrowPlayerID < playerArray.length) {
  11348.                 Player player = playerArray[hintArrowPlayerID];
  11349.                 if(player != null) {
  11350.                     int cordX = player.x / 32 - myPlayer.x / 32;
  11351.                     int cordY = player.y / 32 - myPlayer.y / 32;
  11352.                     drawMapArrows(mapMarker, cordY, cordX);
  11353.                 }
  11354.             }
  11355.         }
  11356.         if(destX != 0) {
  11357.             int walkingToX = (destX * 4 + 2) - myPlayer.x / 32;
  11358.             int walkingToY = (destY * 4 + 2) - myPlayer.y / 32;
  11359.             drawMapSprites(mapFlag, walkingToX, walkingToY);
  11360.         }
  11361.         if(!toggleFullscreen)
  11362.             mapBack[0].drawBackground(paddingX, paddingY);
  11363.         else {
  11364.             mapBack[3].drawBackground(30 + paddingX, 4 + paddingY);
  11365.             mapBack[4].drawBackground(25 + paddingX, 4 + paddingY);
  11366.             mapBack[4].drawBackground(150 + paddingX, 133 + paddingY);
  11367.         }
  11368.         compass.drawRotatableSprite(33, compassRotation, compassPixelCutRight, 256, compassPixelCutLeft, 25, (toggleFullscreen ? 9 : 8) + paddingY, (toggleFullscreen ? 30 : 11) + paddingX, 33, 25);
  11369.         drawOrbs(paddingX,paddingY);
  11370.                 drawCoinOrb();
  11371.         advisorButton[advisorHover].drawSprite((toggleFullscreen ? 207-52 : 207) + paddingX,(toggleFullscreen ? 4 : 0) + paddingY);
  11372.         drawXPCounter(paddingX,paddingY);
  11373.         if(tabInterfaceIDs[10] != -1 && invOverlayInterfaceID == -1)
  11374.             exitButton[exitHover].drawSprite((toggleFullscreen ? 228-52 : 228) + paddingX,(toggleFullscreen ? 4 : 0) + paddingY);
  11375.         worldMapIcon[mapHover].drawSprite((toggleFullscreen ? 154 : 10) + paddingX,(toggleFullscreen ? 138 : 124) + paddingY);
  11376.  
  11377.         DrawingArea.drawPixels(3, 76 + mapPaddingFromTop + paddingY, 76 + mapPaddingFromLeft + paddingX, 0xffffff, 3);
  11378.         if(contextMenuOpen && !toggleFullscreen)
  11379.             drawMenu(516, 0);
  11380.         main3DArea.initDrawingArea();
  11381.     }
  11382.  
  11383.  
  11384.  
  11385.     private void npcScreenPos(Entity entity, int i) {
  11386.         calcEntityScreenPos(entity.x, i, entity.y);
  11387.     }
  11388.  
  11389.     private void calcEntityScreenPos(int i, int j, int l) {
  11390.         if(i < 128 || l < 128 || i > 13056 || l > 13056) {
  11391.             spriteDrawX = -1;
  11392.             spriteDrawY = -1;
  11393.             return;
  11394.         }
  11395.         int i1 = method42(plane, l, i) - j;
  11396.         i -= xCameraPos;
  11397.         i1 -= zCameraPos;
  11398.         l -= yCameraPos;
  11399.         int j1 = Model.modelIntArray1[yCameraCurve];
  11400.         int k1 = Model.modelIntArray2[yCameraCurve];
  11401.         int l1 = Model.modelIntArray1[xCameraCurve];
  11402.         int i2 = Model.modelIntArray2[xCameraCurve];
  11403.         int j2 = l * l1 + i * i2 >> 16;
  11404.         l = l * i2 - i * l1 >> 16;
  11405.         i = j2;
  11406.         j2 = i1 * k1 - l * j1 >> 16;
  11407.         l = i1 * j1 + l * k1 >> 16;
  11408.         i1 = j2;
  11409.         if(l >= 50) {
  11410.             spriteDrawX = Texture.textureInt1 + (i << 9) / l;
  11411.             spriteDrawY = Texture.textureInt2 + (i1 << 9) / l;
  11412.         } else {
  11413.             spriteDrawX = -1;
  11414.             spriteDrawY = -1;
  11415.         }
  11416.     }
  11417.  
  11418.     private void buildSplitPrivateChatMenu(int paddingX, int paddingY)
  11419.     {
  11420.         if(splitPrivateChat == 0)
  11421.             return;
  11422.         int drawLineY = 0;
  11423.         if(systemUpdatetime != 0)
  11424.             drawLineY = 1;
  11425.         for(int indexLine = 0; indexLine < 100; indexLine++)
  11426.         {
  11427.             if(chatMessages[indexLine] == null)
  11428.                 continue;
  11429.             int type = chatTypes[indexLine];
  11430.             String name = chatNames[indexLine];
  11431.             boolean flag = false;
  11432.             if(name != null && name.startsWith("@cr"))
  11433.                 name = name.substring(5);
  11434.  
  11435.             if((type == 3 || type == 7) && (type == 7 || privateChatMode == 0 || privateChatMode == 1 && isFriendOrSelf(name)))
  11436.             {
  11437.                 int l = (329 - drawLineY * 13) - paddingY;
  11438.                 if(super.mouseX > 4 && super.mouseY - 4 > l - 10 && super.mouseY - 4 <= l + 3)
  11439.                 {
  11440.                     int textWidth = normalFont.getTextWidth("From:  " + name + chatMessages[indexLine]) + 25;
  11441.                     if(textWidth > 450)
  11442.                         textWidth = 450;
  11443.                     if(super.mouseX < 4 + textWidth)
  11444.                     {
  11445.                         if(myPrivilege >= 1)
  11446.                         {
  11447.                             menuActionName[menuActionRow] = "Staff Pannel @whi@" + name;
  11448.                             menuActionID[menuActionRow] = 606;
  11449.                             menuActionRow++;
  11450.                         }
  11451.                         menuActionName[menuActionRow] = "Add ignore" + name;
  11452.                         menuActionID[menuActionRow] = 2042;
  11453.                         menuActionRow++;
  11454.                         menuActionName[menuActionRow] = "Add friend" + name;
  11455.                         menuActionID[menuActionRow] = 2337;
  11456.                         menuActionRow++;
  11457.                         menuActionName[menuActionRow] = "Message @whi@" + name;
  11458.                         menuActionID[menuActionRow] = 639;
  11459.                         menuActionRow++;
  11460.                     }
  11461.                 }
  11462.                 if(++drawLineY >= 5)
  11463.                     return;
  11464.             }
  11465.             if((type == 5 || type == 6) && privateChatMode < 2 && ++drawLineY >= 5)
  11466.                 return;
  11467.         }
  11468.  
  11469.     }
  11470.  
  11471.     private void method130(int j, int k, int l, int i1, int j1, int k1,
  11472.                            int l1, int i2, int j2)
  11473.     {
  11474.         Class30_Sub1 class30_sub1 = null;
  11475.         for(Class30_Sub1 class30_sub1_1 = (Class30_Sub1)aClass19_1179.reverseGetFirst(); class30_sub1_1 != null; class30_sub1_1 = (Class30_Sub1)aClass19_1179.reverseGetNext())
  11476.         {
  11477.             if(class30_sub1_1.anInt1295 != l1 || class30_sub1_1.anInt1297 != i2 || class30_sub1_1.anInt1298 != j1 || class30_sub1_1.anInt1296 != i1)
  11478.                 continue;
  11479.             class30_sub1 = class30_sub1_1;
  11480.             break;
  11481.         }
  11482.  
  11483.         if(class30_sub1 == null)
  11484.         {
  11485.             class30_sub1 = new Class30_Sub1();
  11486.             class30_sub1.anInt1295 = l1;
  11487.             class30_sub1.anInt1296 = i1;
  11488.             class30_sub1.anInt1297 = i2;
  11489.             class30_sub1.anInt1298 = j1;
  11490.             method89(class30_sub1);
  11491.             aClass19_1179.insertHead(class30_sub1);
  11492.         }
  11493.         class30_sub1.anInt1291 = k;
  11494.         class30_sub1.anInt1293 = k1;
  11495.         class30_sub1.anInt1292 = l;
  11496.         class30_sub1.anInt1302 = j2;
  11497.         class30_sub1.anInt1294 = j;
  11498.     }
  11499.  
  11500.     private boolean interfaceIsSelected(RSInterface class9)
  11501.     {
  11502.         if(class9.valueCompareType == null)
  11503.             return false;
  11504.         for(int i = 0; i < class9.valueCompareType.length; i++)
  11505.         {
  11506.             int j = extractInterfaceValues(class9, i);
  11507.             int k = class9.requiredValues[i];
  11508.             if(class9.valueCompareType[i] == 2)
  11509.             {
  11510.                 if(j >= k)
  11511.                     return false;
  11512.             } else
  11513.             if(class9.valueCompareType[i] == 3)
  11514.             {
  11515.                 if(j <= k)
  11516.                     return false;
  11517.             } else
  11518.             if(class9.valueCompareType[i] == 4)
  11519.             {
  11520.                 if(j == k)
  11521.                     return false;
  11522.             } else
  11523.             if(j != k)
  11524.                 return false;
  11525.         }
  11526.  
  11527.         return true;
  11528.     }
  11529.  
  11530.     private DataInputStream openJagGrabInputStream(String s)
  11531.         throws IOException
  11532.     {
  11533.  //    if(!aBoolean872)
  11534.  //        if(signlink.mainapp != null)
  11535.  //            return signlink.openurl(s);
  11536.  //        else
  11537.  //            return new DataInputStream((new URL(getCodeBase(), s)).openStream());
  11538.         if(aSocket832 != null)
  11539.         {
  11540.             try
  11541.             {
  11542.                 aSocket832.close();
  11543.             }
  11544.             catch(Exception _ex) { }
  11545.             aSocket832 = null;
  11546.         }
  11547.         aSocket832 = openSocket(43594);
  11548.         aSocket832.setSoTimeout(10000);
  11549.         java.io.InputStream inputstream = aSocket832.getInputStream();
  11550.         OutputStream outputstream = aSocket832.getOutputStream();
  11551.         outputstream.write(("JAGGRAB /" + s + "\n\n").getBytes());
  11552.         return new DataInputStream(inputstream);
  11553.     }
  11554.  
  11555.     private void doFlamesDrawing()
  11556.     {
  11557.         char c = '\u0100';
  11558.         if(anInt1040 > 0)
  11559.         {
  11560.             for(int i = 0; i < 256; i++)
  11561.                 if(anInt1040 > 768)
  11562.                     anIntArray850[i] = method83(anIntArray851[i], anIntArray852[i], 1024 - anInt1040);
  11563.                 else
  11564.                 if(anInt1040 > 256)
  11565.                     anIntArray850[i] = anIntArray852[i];
  11566.                 else
  11567.                     anIntArray850[i] = method83(anIntArray852[i], anIntArray851[i], 256 - anInt1040);
  11568.  
  11569.         } else
  11570.         if(anInt1041 > 0)
  11571.         {
  11572.             for(int j = 0; j < 256; j++)
  11573.                 if(anInt1041 > 768)
  11574.                     anIntArray850[j] = method83(anIntArray851[j], anIntArray853[j], 1024 - anInt1041);
  11575.                 else
  11576.                 if(anInt1041 > 256)
  11577.                     anIntArray850[j] = anIntArray853[j];
  11578.                 else
  11579.                     anIntArray850[j] = method83(anIntArray853[j], anIntArray851[j], 256 - anInt1041);
  11580.  
  11581.         } else
  11582.         {
  11583.             System.arraycopy(anIntArray851, 0, anIntArray850, 0, 256);
  11584.  
  11585.         }
  11586.         System.arraycopy(aClass30_Sub2_Sub1_Sub1_1201.myPixels, 0, aRSImageProducer_1110.anIntArray315, 0, 33920);
  11587.  
  11588.         int i1 = 0;
  11589.         int j1 = 1152;
  11590.         for(int k1 = 1; k1 < c - 1; k1++)
  11591.         {
  11592.             int l1 = (anIntArray969[k1] * (c - k1)) / c;
  11593.             int j2 = 22 + l1;
  11594.             if(j2 < 0)
  11595.                 j2 = 0;
  11596.             i1 += j2;
  11597.             for(int l2 = j2; l2 < 128; l2++)
  11598.             {
  11599.                 int j3 = anIntArray828[i1++];
  11600.                 if(j3 != 0)
  11601.                 {
  11602.                     int l3 = j3;
  11603.                     int j4 = 256 - j3;
  11604.                     j3 = anIntArray850[j3];
  11605.                     int l4 = aRSImageProducer_1110.anIntArray315[j1];
  11606.                     aRSImageProducer_1110.anIntArray315[j1++] = ((j3 & 0xff00ff) * l3 + (l4 & 0xff00ff) * j4 & 0xff00ff00) + ((j3 & 0xff00) * l3 + (l4 & 0xff00) * j4 & 0xff0000) >> 8;
  11607.                 } else
  11608.                 {
  11609.                     j1++;
  11610.                 }
  11611.             }
  11612.  
  11613.             j1 += j2;
  11614.         }
  11615.  
  11616.         aRSImageProducer_1110.drawGraphics(0, super.graphics, 0);
  11617.         System.arraycopy(aClass30_Sub2_Sub1_Sub1_1202.myPixels, 0, aRSImageProducer_1111.anIntArray315, 0, 33920);
  11618.  
  11619.         i1 = 0;
  11620.         j1 = 1176;
  11621.         for(int k2 = 1; k2 < c - 1; k2++)
  11622.         {
  11623.             int i3 = (anIntArray969[k2] * (c - k2)) / c;
  11624.             int k3 = 103 - i3;
  11625.             j1 += i3;
  11626.             for(int i4 = 0; i4 < k3; i4++)
  11627.             {
  11628.                 int k4 = anIntArray828[i1++];
  11629.                 if(k4 != 0)
  11630.                 {
  11631.                     int i5 = k4;
  11632.                     int j5 = 256 - k4;
  11633.                     k4 = anIntArray850[k4];
  11634.                     int k5 = aRSImageProducer_1111.anIntArray315[j1];
  11635.                     aRSImageProducer_1111.anIntArray315[j1++] = ((k4 & 0xff00ff) * i5 + (k5 & 0xff00ff) * j5 & 0xff00ff00) + ((k4 & 0xff00) * i5 + (k5 & 0xff00) * j5 & 0xff0000) >> 8;
  11636.                 } else
  11637.                 {
  11638.                     j1++;
  11639.                 }
  11640.             }
  11641.  
  11642.             i1 += 128 - k3;
  11643.             j1 += 128 - k3 - i3;
  11644.         }
  11645.  
  11646.         aRSImageProducer_1111.drawGraphics(0, super.graphics, 637);
  11647.     }
  11648.  
  11649.     private void method134(Stream stream)
  11650.     {
  11651.         int j = stream.readBits(8);
  11652.         if(j < playerCount)
  11653.         {
  11654.             for(int k = j; k < playerCount; k++)
  11655.                 anIntArray840[anInt839++] = playerIndices[k];
  11656.  
  11657.         }
  11658.         if(j > playerCount)
  11659.         {
  11660.             signlink.reporterror(myUsername + " Too many players");
  11661.             throw new RuntimeException("eek");
  11662.         }
  11663.         playerCount = 0;
  11664.         for(int l = 0; l < j; l++)
  11665.         {
  11666.             int i1 = playerIndices[l];
  11667.             Player player = playerArray[i1];
  11668.             int j1 = stream.readBits(1);
  11669.             if(j1 == 0)
  11670.             {
  11671.                 playerIndices[playerCount++] = i1;
  11672.                 player.anInt1537 = loopCycle;
  11673.             } else
  11674.             {
  11675.                 int k1 = stream.readBits(2);
  11676.                 if(k1 == 0)
  11677.                 {
  11678.                     playerIndices[playerCount++] = i1;
  11679.                     player.anInt1537 = loopCycle;
  11680.                     anIntArray894[anInt893++] = i1;
  11681.                 } else
  11682.                 if(k1 == 1)
  11683.                 {
  11684.                     playerIndices[playerCount++] = i1;
  11685.                     player.anInt1537 = loopCycle;
  11686.                     int l1 = stream.readBits(3);
  11687.                     player.moveInDir(false, l1);
  11688.                     int j2 = stream.readBits(1);
  11689.                     if(j2 == 1)
  11690.                         anIntArray894[anInt893++] = i1;
  11691.                 } else
  11692.                 if(k1 == 2)
  11693.                 {
  11694.                     playerIndices[playerCount++] = i1;
  11695.                     player.anInt1537 = loopCycle;
  11696.                     int i2 = stream.readBits(3);
  11697.                     player.moveInDir(true, i2);
  11698.                     int k2 = stream.readBits(3);
  11699.                     player.moveInDir(true, k2);
  11700.                     int l2 = stream.readBits(1);
  11701.                     if(l2 == 1)
  11702.                         anIntArray894[anInt893++] = i1;
  11703.                 } else
  11704.                 if(k1 == 3)
  11705.                     anIntArray840[anInt839++] = i1;
  11706.             }
  11707.         }
  11708.     }
  11709.  
  11710.     public int world = 1;
  11711.     public String spec = "@red@Normal World";
  11712. private void drawLoginScreen(boolean flag) {
  11713.         resetImageProducers();
  11714.         aRSImageProducer_1109.initDrawingArea();
  11715.         int x = 49;
  11716.         loginBox.drawSprite(0 + x, 0);
  11717.         char c = '\u0168';
  11718.         char c1 = '\310';
  11719.         int l = c / 2 - 80;
  11720.         int k1 = c1 / 2 + 20;
  11721.        
  11722.         boldFont.method382(0xffff00, 130 + x, "@whi@World: @red@" + spec,k1 + 22, true);
  11723.         if (loginScreenState == 0) {
  11724.             if (screenHover[0]) {
  11725.                  loginBoxHover.drawSprite(22 + x, 58);
  11726.             }
  11727.             if (screenHover[1]) {
  11728.                  loginBoxHover.drawSprite(l - 78 + x, k1 - 16);
  11729.             }
  11730.             if (screenHover[2]) {
  11731.                 loginHover.drawSprite(l - 78 + x, k1 + 42);
  11732.             }
  11733.             if (screenHover[3]) {
  11734.                 loginHoverWorld.drawSprite(l + 116 + x, k1 + 42);
  11735.             }
  11736.             boldFont.method382(0xffff00, 132 + x, loginMessage1,
  11737.                     k1 + 41 + 40, true);
  11738.             boldFont.method382(0xffff00, 132 + x, loginMessage2,
  11739.                     k1 + 41 + 55
  11740.                     , true);
  11741.             if (loginScreenCursorPos != 0 && loginScreenCursorPos != 1)
  11742.                 loginScreenCursorPos = 0;
  11743.             int j = c1 / 2 - 23;
  11744.             boldFont.method389(true, c / 2 - 154 + x, 0xffffff, ""
  11745.                             + myUsername
  11746.                             + ((loginScreenCursorPos == 0)
  11747.                                     & (loopCycle % 40 < 20) ? "@whi@|" : ""), j);
  11748.             j += 47;
  11749.             boldFont.method389(true, c / 2 - 154 + x, 0xffffff,
  11750.                             ""
  11751.                                     + TextClass.passwordAsterisks(myPassword)
  11752.                                     + ((loginScreenCursorPos == 1)
  11753.                                             & (loopCycle % 40 < 20) ? "@whi@|"
  11754.                                             : ""), j);
  11755.         }
  11756.         aRSImageProducer_1109.drawGraphics(171, super.graphics, 202);
  11757.         if (welcomeScreenRaised) {
  11758.             welcomeScreenRaised = false;
  11759.             aRSImageProducer_1110.drawGraphics(0, super.graphics, 0);
  11760.             aRSImageProducer_1111.drawGraphics(0, super.graphics, 637);
  11761.             aRSImageProducer_1107.drawGraphics(0, super.graphics, 128);
  11762.             aRSImageProducer_1108.drawGraphics(371, super.graphics, 202);
  11763.             aRSImageProducer_1112.drawGraphics(265, super.graphics, 0);
  11764.             aRSImageProducer_1113.drawGraphics(265, super.graphics, 562);
  11765.             aRSImageProducer_1114.drawGraphics(171, super.graphics, 128);
  11766.             aRSImageProducer_1115.drawGraphics(171, super.graphics, 562);
  11767.         }
  11768.     }
  11769.  
  11770.     private void drawFlames()
  11771.     {
  11772.     }
  11773.  
  11774.     public void raiseWelcomeScreen() {
  11775.         welcomeScreenRaised = true;
  11776.     }
  11777.  
  11778.     private void method137(Stream stream, int j)
  11779.     {
  11780.         if(j == 84)
  11781.         {
  11782.             int k = stream.readUnsignedByte();
  11783.             int j3 = anInt1268 + (k >> 4 & 7);
  11784.             int i6 = anInt1269 + (k & 7);
  11785.             int l8 = stream.readUnsignedWord();
  11786.             int k11 = stream.readUnsignedWord();
  11787.             int l13 = stream.readUnsignedWord();
  11788.             if(j3 >= 0 && i6 >= 0 && j3 < 104 && i6 < 104)
  11789.             {
  11790.                 NodeList class19_1 = groundArray[plane][j3][i6];
  11791.                 if(class19_1 != null)
  11792.                 {
  11793.                     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())
  11794.                     {
  11795.                         if(class30_sub2_sub4_sub2_3.ID != (l8 & 0x7fff) || class30_sub2_sub4_sub2_3.anInt1559 != k11)
  11796.                             continue;
  11797.                         class30_sub2_sub4_sub2_3.anInt1559 = l13;
  11798.                         break;
  11799.                     }
  11800.  
  11801.                     spawnGroundItem(j3, i6);
  11802.                 }
  11803.             }
  11804.             return;
  11805.         }
  11806.         if(j == 105)
  11807.         {
  11808.             int l = stream.readUnsignedByte();
  11809.             int k3 = anInt1268 + (l >> 4 & 7);
  11810.             int j6 = anInt1269 + (l & 7);
  11811.             int i9 = stream.readUnsignedWord();
  11812.             int l11 = stream.readUnsignedByte();
  11813.             int i14 = l11 >> 4 & 0xf;
  11814.             int i16 = l11 & 7;
  11815.             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)
  11816.             {
  11817.                 anIntArray1207[anInt1062] = i9;
  11818.                 anIntArray1241[anInt1062] = i16;
  11819.                 anIntArray1250[anInt1062] = Sounds.anIntArray326[i9];
  11820.                 anInt1062++;
  11821.             }
  11822.         }
  11823.         if(j == 215)
  11824.         {
  11825.             int i1 = stream.method435();
  11826.             int l3 = stream.method428();
  11827.             int k6 = anInt1268 + (l3 >> 4 & 7);
  11828.             int j9 = anInt1269 + (l3 & 7);
  11829.             int i12 = stream.method435();
  11830.             int j14 = stream.readUnsignedWord();
  11831.             if(k6 >= 0 && j9 >= 0 && k6 < 104 && j9 < 104 && i12 != unknownInt10)
  11832.             {
  11833.                 Item class30_sub2_sub4_sub2_2 = new Item();
  11834.                 class30_sub2_sub4_sub2_2.ID = i1;
  11835.                 class30_sub2_sub4_sub2_2.anInt1559 = j14;
  11836.                 if(groundArray[plane][k6][j9] == null)
  11837.                     groundArray[plane][k6][j9] = new NodeList();
  11838.                 groundArray[plane][k6][j9].insertHead(class30_sub2_sub4_sub2_2);
  11839.                 spawnGroundItem(k6, j9);
  11840.             }
  11841.             return;
  11842.         }
  11843.         if(j == 156)
  11844.         {
  11845.             int j1 = stream.method426();
  11846.             int i4 = anInt1268 + (j1 >> 4 & 7);
  11847.             int l6 = anInt1269 + (j1 & 7);
  11848.             int k9 = stream.readUnsignedWord();
  11849.             if(i4 >= 0 && l6 >= 0 && i4 < 104 && l6 < 104)
  11850.             {
  11851.                 NodeList class19 = groundArray[plane][i4][l6];
  11852.                 if(class19 != null)
  11853.                 {
  11854.                     for(Item item = (Item)class19.reverseGetFirst(); item != null; item = (Item)class19.reverseGetNext())
  11855.                     {
  11856.                         if(item.ID != (k9 & 0x7fff))
  11857.                             continue;
  11858.                         item.unlink();
  11859.                         break;
  11860.                     }
  11861.  
  11862.                     if(class19.reverseGetFirst() == null)
  11863.                         groundArray[plane][i4][l6] = null;
  11864.                     spawnGroundItem(i4, l6);
  11865.                 }
  11866.             }
  11867.             return;
  11868.         }
  11869.         if(j == 160)
  11870.         {
  11871.             int k1 = stream.method428();
  11872.             int j4 = anInt1268 + (k1 >> 4 & 7);
  11873.             int i7 = anInt1269 + (k1 & 7);
  11874.             int l9 = stream.method428();
  11875.             int j12 = l9 >> 2;
  11876.             int k14 = l9 & 3;
  11877.             int j16 = anIntArray1177[j12];
  11878.             int j17 = stream.method435();
  11879.             if(j4 >= 0 && i7 >= 0 && j4 < 103 && i7 < 103)
  11880.             {
  11881.                 int j18 = intGroundArray[plane][j4][i7];
  11882.                 int i19 = intGroundArray[plane][j4 + 1][i7];
  11883.                 int l19 = intGroundArray[plane][j4 + 1][i7 + 1];
  11884.                 int k20 = intGroundArray[plane][j4][i7 + 1];
  11885.                 if(j16 == 0)
  11886.                 {
  11887.                     Object1 class10 = worldController.method296(plane, j4, i7);
  11888.                     if(class10 != null)
  11889.                     {
  11890.                         int k21 = class10.uid >> 14 & 0x7fff;
  11891.                         if(j12 == 2)
  11892.                         {
  11893.                             class10.aClass30_Sub2_Sub4_278 = new Animable_Sub5(k21, 4 + k14, 2, i19, l19, j18, k20, j17, false);
  11894.                             class10.aClass30_Sub2_Sub4_279 = new Animable_Sub5(k21, k14 + 1 & 3, 2, i19, l19, j18, k20, j17, false);
  11895.                         } else
  11896.                         {
  11897.                             class10.aClass30_Sub2_Sub4_278 = new Animable_Sub5(k21, k14, j12, i19, l19, j18, k20, j17, false);
  11898.                         }
  11899.                     }
  11900.                 }
  11901.                 if(j16 == 1)
  11902.                 {
  11903.                     Object2 class26 = worldController.method297(j4, i7, plane);
  11904.                     if(class26 != null)
  11905.                         class26.aClass30_Sub2_Sub4_504 = new Animable_Sub5(class26.uid >> 14 & 0x7fff, 0, 4, i19, l19, j18, k20, j17, false);
  11906.                 }
  11907.                 if(j16 == 2)
  11908.                 {
  11909.                     Object5 class28 = worldController.method298(j4, i7, plane);
  11910.                     if(j12 == 11)
  11911.                         j12 = 10;
  11912.                     if(class28 != null)
  11913.                         class28.aClass30_Sub2_Sub4_521 = new Animable_Sub5(class28.uid >> 14 & 0x7fff, k14, j12, i19, l19, j18, k20, j17, false);
  11914.                 }
  11915.                 if(j16 == 3)
  11916.                 {
  11917.                     Object3 class49 = worldController.method299(i7, j4, plane);
  11918.                     if(class49 != null)
  11919.                         class49.aClass30_Sub2_Sub4_814 = new Animable_Sub5(class49.uid >> 14 & 0x7fff, k14, 22, i19, l19, j18, k20, j17, false);
  11920.                 }
  11921.             }
  11922.             return;
  11923.         }
  11924.         if(j == 147)
  11925.         {
  11926.             int l1 = stream.method428();
  11927.             int k4 = anInt1268 + (l1 >> 4 & 7);
  11928.             int j7 = anInt1269 + (l1 & 7);
  11929.             int i10 = stream.readUnsignedWord();
  11930.             byte byte0 = stream.method430();
  11931.             int l14 = stream.method434();
  11932.             byte byte1 = stream.method429();
  11933.             int k17 = stream.readUnsignedWord();
  11934.             int k18 = stream.method428();
  11935.             int j19 = k18 >> 2;
  11936.             int i20 = k18 & 3;
  11937.             int l20 = anIntArray1177[j19];
  11938.             byte byte2 = stream.readSignedByte();
  11939.             int l21 = stream.readUnsignedWord();
  11940.             byte byte3 = stream.method429();
  11941.             Player player;
  11942.             if(i10 == unknownInt10)
  11943.                 player = myPlayer;
  11944.             else
  11945.                 player = playerArray[i10];
  11946.             if(player != null)
  11947.             {
  11948.                 ObjectDef class46 = ObjectDef.forID(l21);
  11949.                 int i22 = intGroundArray[plane][k4][j7];
  11950.                 int j22 = intGroundArray[plane][k4 + 1][j7];
  11951.                 int k22 = intGroundArray[plane][k4 + 1][j7 + 1];
  11952.                 int l22 = intGroundArray[plane][k4][j7 + 1];
  11953.                 Model model = class46.method578(j19, i20, i22, j22, k22, l22, -1);
  11954.                 if(model != null)
  11955.                 {
  11956.                     method130(k17 + 1, -1, 0, l20, j7, 0, plane, k4, l14 + 1);
  11957.                     player.anInt1707 = l14 + loopCycle;
  11958.                     player.anInt1708 = k17 + loopCycle;
  11959.                     player.aModel_1714 = model;
  11960.                     int i23 = class46.anInt744;
  11961.                     int j23 = class46.anInt761;
  11962.                     if(i20 == 1 || i20 == 3)
  11963.                     {
  11964.                         i23 = class46.anInt761;
  11965.                         j23 = class46.anInt744;
  11966.                     }
  11967.                     player.anInt1711 = k4 * 128 + i23 * 64;
  11968.                     player.anInt1713 = j7 * 128 + j23 * 64;
  11969.                     player.anInt1712 = method42(plane, player.anInt1713, player.anInt1711);
  11970.                     if(byte2 > byte0)
  11971.                     {
  11972.                         byte byte4 = byte2;
  11973.                         byte2 = byte0;
  11974.                         byte0 = byte4;
  11975.                     }
  11976.                     if(byte3 > byte1)
  11977.                     {
  11978.                         byte byte5 = byte3;
  11979.                         byte3 = byte1;
  11980.                         byte1 = byte5;
  11981.                     }
  11982.                     player.anInt1719 = k4 + byte2;
  11983.                     player.anInt1721 = k4 + byte0;
  11984.                     player.anInt1720 = j7 + byte3;
  11985.                     player.anInt1722 = j7 + byte1;
  11986.                 }
  11987.             }
  11988.         }
  11989.         if(j == 151)
  11990.         {
  11991.             int i2 = stream.method426();
  11992.             int l4 = anInt1268 + (i2 >> 4 & 7);
  11993.             int k7 = anInt1269 + (i2 & 7);
  11994.             int j10 = stream.method434();
  11995.             int k12 = stream.method428();
  11996.             int i15 = k12 >> 2;
  11997.             int k16 = k12 & 3;
  11998.             int l17 = anIntArray1177[i15];
  11999.             if(l4 >= 0 && k7 >= 0 && l4 < 104 && k7 < 104)
  12000.                 method130(-1, j10, k16, l17, k7, i15, plane, l4, 0);
  12001.             return;
  12002.         }
  12003.         if(j == 4)
  12004.         {
  12005.             int j2 = stream.readUnsignedByte();
  12006.             int i5 = anInt1268 + (j2 >> 4 & 7);
  12007.             int l7 = anInt1269 + (j2 & 7);
  12008.             int k10 = stream.readUnsignedWord();
  12009.             int l12 = stream.readUnsignedByte();
  12010.             int j15 = stream.readUnsignedWord();
  12011.             if(i5 >= 0 && l7 >= 0 && i5 < 104 && l7 < 104)
  12012.             {
  12013.                 i5 = i5 * 128 + 64;
  12014.                 l7 = l7 * 128 + 64;
  12015.                 Animable_Sub3 class30_sub2_sub4_sub3 = new Animable_Sub3(plane, loopCycle, j15, k10, method42(plane, l7, i5) - l12, l7, i5);
  12016.                 aClass19_1056.insertHead(class30_sub2_sub4_sub3);
  12017.             }
  12018.             return;
  12019.         }
  12020.         if(j == 44)
  12021.         {
  12022.             int k2 = stream.method436();
  12023.             int j5 = stream.readUnsignedWord();
  12024.             int i8 = stream.readUnsignedByte();
  12025.             int l10 = anInt1268 + (i8 >> 4 & 7);
  12026.             int i13 = anInt1269 + (i8 & 7);
  12027.             if(l10 >= 0 && i13 >= 0 && l10 < 104 && i13 < 104)
  12028.             {
  12029.                 Item class30_sub2_sub4_sub2_1 = new Item();
  12030.                 class30_sub2_sub4_sub2_1.ID = k2;
  12031.                 class30_sub2_sub4_sub2_1.anInt1559 = j5;
  12032.                 if(groundArray[plane][l10][i13] == null)
  12033.                     groundArray[plane][l10][i13] = new NodeList();
  12034.                 groundArray[plane][l10][i13].insertHead(class30_sub2_sub4_sub2_1);
  12035.                 spawnGroundItem(l10, i13);
  12036.             }
  12037.             return;
  12038.         }
  12039.         if(j == 101)
  12040.         {
  12041.             int l2 = stream.method427();
  12042.             int k5 = l2 >> 2;
  12043.             int j8 = l2 & 3;
  12044.             int i11 = anIntArray1177[k5];
  12045.             int j13 = stream.readUnsignedByte();
  12046.             int k15 = anInt1268 + (j13 >> 4 & 7);
  12047.             int l16 = anInt1269 + (j13 & 7);
  12048.             if(k15 >= 0 && l16 >= 0 && k15 < 104 && l16 < 104)
  12049.                 method130(-1, -1, j8, i11, l16, k5, plane, k15, 0);
  12050.             return;
  12051.         }
  12052.         if(j == 117)
  12053.         {
  12054.             int i3 = stream.readUnsignedByte();
  12055.             int l5 = anInt1268 + (i3 >> 4 & 7);
  12056.             int k8 = anInt1269 + (i3 & 7);
  12057.             int j11 = l5 + stream.readSignedByte();
  12058.             int k13 = k8 + stream.readSignedByte();
  12059.             int l15 = stream.readSignedWord();
  12060.             int i17 = stream.readUnsignedWord();
  12061.             int i18 = stream.readUnsignedByte() * 4;
  12062.             int l18 = stream.readUnsignedByte() * 4;
  12063.             int k19 = stream.readUnsignedWord();
  12064.             int j20 = stream.readUnsignedWord();
  12065.             int i21 = stream.readUnsignedByte();
  12066.             int j21 = stream.readUnsignedByte();
  12067.             if(l5 >= 0 && k8 >= 0 && l5 < 104 && k8 < 104 && j11 >= 0 && k13 >= 0 && j11 < 104 && k13 < 104 && i17 != 65535)
  12068.             {
  12069.                 l5 = l5 * 128 + 64;
  12070.                 k8 = k8 * 128 + 64;
  12071.                 j11 = j11 * 128 + 64;
  12072.                 k13 = k13 * 128 + 64;
  12073.                 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);
  12074.                 class30_sub2_sub4_sub4.method455(k19 + loopCycle, k13, method42(plane, k13, j11) - l18, j11);
  12075.                 aClass19_1013.insertHead(class30_sub2_sub4_sub4);
  12076.             }
  12077.         }
  12078.     }
  12079.  
  12080.     private static void setLowMem()
  12081.     {
  12082.         WorldController.lowMem = true;
  12083.         Texture.lowMem = true;
  12084.         lowMem = true;
  12085.         ObjectManager.lowMem = true;
  12086.         ObjectDef.lowMem = true;
  12087.     }
  12088.  
  12089.     private void method139(Stream stream)
  12090.     {
  12091.         stream.initBitAccess();
  12092.         int k = stream.readBits(8);
  12093.         if(k < npcCount)
  12094.         {
  12095.             for(int l = k; l < npcCount; l++)
  12096.                 anIntArray840[anInt839++] = npcIndices[l];
  12097.  
  12098.         }
  12099.         if(k > npcCount)
  12100.         {
  12101.             signlink.reporterror(myUsername + " Too many npcs");
  12102.             throw new RuntimeException("eek");
  12103.         }
  12104.         npcCount = 0;
  12105.         for(int i1 = 0; i1 < k; i1++)
  12106.         {
  12107.             int j1 = npcIndices[i1];
  12108.             NPC npc = npcArray[j1];
  12109.             int k1 = stream.readBits(1);
  12110.             if(k1 == 0)
  12111.             {
  12112.                 npcIndices[npcCount++] = j1;
  12113.                 npc.anInt1537 = loopCycle;
  12114.             } else
  12115.             {
  12116.                 int l1 = stream.readBits(2);
  12117.                 if(l1 == 0)
  12118.                 {
  12119.                     npcIndices[npcCount++] = j1;
  12120.                     npc.anInt1537 = loopCycle;
  12121.                     anIntArray894[anInt893++] = j1;
  12122.                 } else
  12123.                 if(l1 == 1)
  12124.                 {
  12125.                     npcIndices[npcCount++] = j1;
  12126.                     npc.anInt1537 = loopCycle;
  12127.                     int i2 = stream.readBits(3);
  12128.                     npc.moveInDir(false, i2);
  12129.                     int k2 = stream.readBits(1);
  12130.                     if(k2 == 1)
  12131.                         anIntArray894[anInt893++] = j1;
  12132.                 } else
  12133.                 if(l1 == 2)
  12134.                 {
  12135.                     npcIndices[npcCount++] = j1;
  12136.                     npc.anInt1537 = loopCycle;
  12137.                     int j2 = stream.readBits(3);
  12138.                     npc.moveInDir(true, j2);
  12139.                     int l2 = stream.readBits(3);
  12140.                     npc.moveInDir(true, l2);
  12141.                     int i3 = stream.readBits(1);
  12142.                     if(i3 == 1)
  12143.                         anIntArray894[anInt893++] = j1;
  12144.                 } else
  12145.                 if(l1 == 3)
  12146.                     anIntArray840[anInt839++] = j1;
  12147.             }
  12148.         }
  12149.  
  12150.     }
  12151.    
  12152.     public void handleStupidWorldSwitch() {
  12153.             if(world > 1){ //STOPS MORE THAN 2 WORLD RE-WRITE LATER
  12154.         world = 1;
  12155.         }else{
  12156.         world += 1;
  12157.         }
  12158.         if(world == 1){
  12159.         serverip = ""+defaultServerIP+"";
  12160.         port = 43595;
  12161.         spec ="@red@Normal World";
  12162.         signlink.setuid();
  12163.         } else {
  12164.                                            if(world == 2){
  12165.         serverip = ""+defaultServerIPw2+"";
  12166.         port = 43595;
  12167.         signlink.setuid();
  12168.         spec =" @red@Hack3r`s World";
  12169.         }
  12170.         }
  12171.         if(world < 0 || world > 7)
  12172.             spec = " Invalid world";
  12173.             }
  12174.            
  12175.  
  12176.         private void processLoginScreenInput() {
  12177.         if(loginMessage2.equals("@whi@Error connecting to server.")){ // fixes the client login lagg, by Gabbe.
  12178.                 loginMessage2 = "@whi@Error connecting to server.";
  12179.         }
  12180.         if (loginScreenState == 0) {
  12181.                 int l = super.myHeight / 2 + 20;
  12182.                 int yoffset = 36;
  12183.                 screenHover[0] = super.mouseX >= 273 && super.mouseX <= 490 && super.mouseY >= 194 + yoffset && super.mouseY <= 219 + yoffset;
  12184.                 screenHover[1] = super.mouseX >= 273 && super.mouseX <= 490 && super.mouseY >= 240 + yoffset && super.mouseY <= 265 + yoffset;
  12185.                 screenHover[2] = super.mouseX >= 253 && super.mouseX <= 454 && super.mouseY >= 296 + yoffset && super.mouseY <= 321 + yoffset;
  12186.                 screenHover[3] = super.mouseX >= 455 && super.mouseX <= 600 && super.mouseY >= 296 + yoffset && super.mouseY <= 321 + yoffset;
  12187.                 if (super.clickMode3 == 1 && super.saveClickX >= 273
  12188.                         && super.saveClickX <= 490 && super.saveClickY >= 194 + yoffset
  12189.                         && super.saveClickY <= 219 + yoffset)
  12190.                     loginScreenCursorPos = 0;
  12191.                 if (super.clickMode3 == 1 && super.mouseX >= 273
  12192.                         && super.mouseX <= 490 && super.mouseY >= 240 + yoffset
  12193.                         && super.mouseY <= 265 + yoffset)
  12194.                     loginScreenCursorPos = 1;
  12195.                 if (super.clickMode3 == 1 && super.saveClickX >= 253
  12196.                         && super.saveClickX <= 454 && super.saveClickY >= 296 + yoffset
  12197.                         && super.saveClickY <= 321 + yoffset) {
  12198.                     loginFailures = 0;
  12199.                     login(myUsername, myPassword, false);
  12200.                     if (loggedIn)
  12201.                         return;
  12202.                 }
  12203.                                 if (super.clickMode3 == 1 && super.saveClickX >= 455
  12204.                         && super.saveClickX <= 600 && super.saveClickY >= 296 + yoffset
  12205.                         && super.saveClickY <= 321 + yoffset) {
  12206.         int x = 49;
  12207.         loginBox.drawSprite(0 + x, 0);
  12208.         char c = '\u0168';
  12209.         char c1 = '\310';
  12210.         int k1 = c1 / 2 + 20;
  12211.         handleStupidWorldSwitch();
  12212.        
  12213.         /*aTextDrawingArea_1271.method382(0xffff00, 130 + x, "@whi@World selected: @red@" + world,
  12214.                     k1 + 22
  12215.                     , true);*/
  12216.                 }
  12217.                 do {
  12218.                     int l1 = readChar(-796);
  12219.                     if (l1 == -1)
  12220.                         break;
  12221.                     boolean flag1 = false;
  12222.                     for (int i2 = 0; i2 < validUserPassChars.length(); i2++) {
  12223.                         if (l1 != validUserPassChars.charAt(i2))
  12224.                             continue;
  12225.                         flag1 = true;
  12226.                         break;
  12227.                     }
  12228.  
  12229.                     if (loginScreenCursorPos == 0) {
  12230.                         if (l1 == 8 && myUsername.length() > 0)
  12231.                             myUsername = myUsername.substring(0,
  12232.                                     myUsername.length() - 1);
  12233.                         if (l1 == 9 || l1 == 10 || l1 == 13) {
  12234.                             loginScreenCursorPos = 1;
  12235.                         }
  12236.                         if (flag1)
  12237.                             myUsername += (char) l1;
  12238.                         if (myUsername.length() > 12)
  12239.                             myUsername = myUsername.substring(0, 12);
  12240.                     } else if (loginScreenCursorPos == 1) {
  12241.                         if (l1 == 8 && myPassword.length() > 0)
  12242.                             myPassword = myPassword.substring(0,
  12243.                                     myPassword.length() - 1);
  12244.                         if (l1 == 9 || l1 == 10 || l1 == 13) {
  12245.                             if (myPassword.length() > 0
  12246.                                     && myUsername.length() > 0) {
  12247.                                 login(myUsername, myPassword, false);
  12248.                             } else {
  12249.                                 loginScreenCursorPos = 0;
  12250.                             }
  12251.                         }
  12252.                         if (flag1)
  12253.                             myPassword += (char) l1;
  12254.                         if (myPassword.length() > 20)
  12255.                             myPassword = myPassword.substring(0, 20);
  12256.                     }
  12257.                 } while (true);
  12258.                 return;
  12259.             }
  12260.     }
  12261.  
  12262.     private void method142(int i, int j, int k, int l, int i1, int j1, int k1
  12263.     )
  12264.     {
  12265.         if(i1 >= 1 && i >= 1 && i1 <= 102 && i <= 102)
  12266.         {
  12267.             if(lowMem && j != plane)
  12268.                 return;
  12269.             int i2 = 0;
  12270.             if(j1 == 0)
  12271.                 i2 = worldController.method300(j, i1, i);
  12272.             if(j1 == 1)
  12273.                 i2 = worldController.method301(j, i1, i);
  12274.             if(j1 == 2)
  12275.                 i2 = worldController.method302(j, i1, i);
  12276.             if(j1 == 3)
  12277.                 i2 = worldController.method303(j, i1, i);
  12278.             if(i2 != 0)
  12279.             {
  12280.                 int i3 = worldController.method304(j, i1, i, i2);
  12281.                 int j2 = i2 >> 14 & 0x7fff;
  12282.                 int k2 = i3 & 0x1f;
  12283.                 int l2 = i3 >> 6;
  12284.                 if(j1 == 0)
  12285.                 {
  12286.                     worldController.method291(i1, j, i, (byte)-119);
  12287.                     ObjectDef class46 = ObjectDef.forID(j2);
  12288.                     if(class46.aBoolean767)
  12289.                         aClass11Array1230[j].method215(l2, k2, class46.aBoolean757, i1, i);
  12290.                 }
  12291.                 if(j1 == 1)
  12292.                     worldController.method292(i, j, i1);
  12293.                 if(j1 == 2)
  12294.                 {
  12295.                     worldController.method293(j, i1, i);
  12296.                     ObjectDef class46_1 = ObjectDef.forID(j2);
  12297.                     if(i1 + class46_1.anInt744 > 103 || i + class46_1.anInt744 > 103 || i1 + class46_1.anInt761 > 103 || i + class46_1.anInt761 > 103)
  12298.                         return;
  12299.                     if(class46_1.aBoolean767)
  12300.                         aClass11Array1230[j].method216(l2, class46_1.anInt744, i1, i, class46_1.anInt761, class46_1.aBoolean757);
  12301.                 }
  12302.                 if(j1 == 3)
  12303.                 {
  12304.                     worldController.method294(j, i, i1);
  12305.                     ObjectDef class46_2 = ObjectDef.forID(j2);
  12306.                     if(class46_2.aBoolean767 && class46_2.hasActions)
  12307.                         aClass11Array1230[j].method218(i, i1);
  12308.                 }
  12309.             }
  12310.             if(k1 >= 0)
  12311.             {
  12312.                 int j3 = j;
  12313.                 if(j3 < 3 && (byteGroundArray[1][i1][i] & 2) == 2)
  12314.                     j3++;
  12315.                 ObjectManager.method188(worldController, k, i, l, j3, aClass11Array1230[j], intGroundArray, i1, k1, j);
  12316.             }
  12317.         }
  12318.     }
  12319.  
  12320.     private void updatePlayers(int i, Stream stream)
  12321.     {
  12322.         anInt839 = 0;
  12323.         anInt893 = 0;
  12324.         method117(stream);
  12325.         method134(stream);
  12326.         method91(stream, i);
  12327.         method49(stream);
  12328.         for(int k = 0; k < anInt839; k++)
  12329.         {
  12330.             int l = anIntArray840[k];
  12331.             if(playerArray[l].anInt1537 != loopCycle)
  12332.                 playerArray[l] = null;
  12333.         }
  12334.  
  12335.         if(stream.currentOffset != i)
  12336.         {
  12337.             signlink.reporterror("Error packet size mismatch in getplayer pos:" + stream.currentOffset + " psize:" + i);
  12338.             throw new RuntimeException("eek");
  12339.         }
  12340.         for(int i1 = 0; i1 < playerCount; i1++)
  12341.             if(playerArray[playerIndices[i1]] == null)
  12342.             {
  12343.                 signlink.reporterror(myUsername + " null entry in pl list - pos:" + i1 + " size:" + playerCount);
  12344.                 throw new RuntimeException("eek");
  12345.             }
  12346.  
  12347.     }
  12348.  
  12349.     private void setCameraPos(int j, int k, int l, int i1, int j1, int k1)
  12350.     {
  12351.         int l1 = 2048 - k & 0x7ff;
  12352.         int i2 = 2048 - j1 & 0x7ff;
  12353.         int j2 = 0;
  12354.         int k2 = 0;
  12355.         int l2 = j;
  12356.         if(l1 != 0)
  12357.         {
  12358.             int i3 = Model.modelIntArray1[l1];
  12359.             int k3 = Model.modelIntArray2[l1];
  12360.             int i4 = k2 * k3 - l2 * i3 >> 16;
  12361.             l2 = k2 * i3 + l2 * k3 >> 16;
  12362.             k2 = i4;
  12363.         }
  12364.         if(i2 != 0)
  12365.         {
  12366. /* xxx          if(cameratoggle){
  12367.                 if(zoom == 0)
  12368.                 zoom = k2;
  12369.               if(lftrit == 0)
  12370.                 lftrit = j2;
  12371.               if(fwdbwd == 0)
  12372.                 fwdbwd = l2;
  12373.               k2 = zoom;
  12374.               j2 = lftrit;
  12375.               l2 = fwdbwd;
  12376.             }
  12377. */
  12378.             int j3 = Model.modelIntArray1[i2];
  12379.             int l3 = Model.modelIntArray2[i2];
  12380.             int j4 = l2 * j3 + j2 * l3 >> 16;
  12381.             l2 = l2 * l3 - j2 * j3 >> 16;
  12382.             j2 = j4;
  12383.         }
  12384.         xCameraPos = l - j2;
  12385.         zCameraPos = i1 - k2;
  12386.         yCameraPos = k1 - l2;
  12387.         yCameraCurve = k;
  12388.         xCameraCurve = j1;
  12389.     }
  12390.  
  12391.     public void updateStrings(String str, int i) {
  12392.         switch(i) {
  12393.             case 1675: sendFrame126(str, 17508); break;//Stab
  12394.             case 1676: sendFrame126(str, 17509); break;//Slash
  12395.             case 1677: sendFrame126(str, 17510); break;//Cursh
  12396.             case 1678: sendFrame126(str, 17511); break;//Magic
  12397.             case 1679: sendFrame126(str, 17512); break;//Range
  12398.             case 1680: sendFrame126(str, 17513); break;//Stab
  12399.             case 1681: sendFrame126(str, 17514); break;//Slash
  12400.             case 1682: sendFrame126(str, 17515); break;//Crush
  12401.             case 1683: sendFrame126(str, 17516); break;//Magic
  12402.             case 1684: sendFrame126(str, 17517); break;//Range
  12403.             case 1686: sendFrame126(str, 17518); break;//Strength
  12404.             case 1687: sendFrame126(str, 17519); break;//Prayer
  12405.         }
  12406.     }
  12407.  
  12408.     private void changePasswordSubmit() {
  12409.         if(newPasswordString.length() <= 0)
  12410.             pushMessage("Please type the new password you would like first.", 0 ," ");
  12411.         else if(newPasswordString == myPassword) {
  12412.             pushMessage("This is your current password, no changes where made.", 0 ," ");
  12413.         } else {
  12414.             sendData("::changepassword " + newPasswordString);
  12415.             myPassword = newPasswordString;
  12416.             openInterfaceID = -1;
  12417.             setDetails();
  12418.         }
  12419.     }
  12420.    
  12421.     public String strengthCheck(String newPassword) {
  12422.         Pattern[] pattern = new Pattern[3];
  12423.         Matcher matcher;
  12424.         pattern[0] = Pattern.compile("[a-zA-Z]");
  12425.         pattern[1] = Pattern.compile("\\d");
  12426.         pattern[2] = Pattern.compile("[^a-zA-Z0-9]");
  12427.         int level = 0, i = 0;
  12428.         // find the strength
  12429.         while(i != 3) {
  12430.             matcher = pattern[i].matcher(newPassword);
  12431.             if(matcher.find())
  12432.                 level++;
  12433.             i++;
  12434.         }
  12435.         String strength = "None";
  12436.         if(level == 1 && newPassword.length() < 6)
  12437.             strength = "@red@Very weak";
  12438.         else if (level == 1 && newPassword.length() < 9)
  12439.             strength = "@or2@Weak";
  12440.         else if (level == 1 && newPassword.length() >= 9 || level == 2 && newPassword.length() < 9)
  12441.             strength = "@or3@Medium";
  12442.         else if (level == 2 && newPassword.length() >= 9 || level == 3 && newPassword.length() < 6)
  12443.             strength = "@yel@Strong";
  12444.         else if (level == 3 && newPassword.length() < 9)
  12445.             strength = "@gre@Very strong";
  12446.         else if (level == 3 && newPassword.length() >= 9)
  12447.             strength = "@blu@Best";
  12448.         // check for sequences
  12449.         pattern[0] = Pattern.compile("[a-zA-Z]{3,}");
  12450.         pattern[1] = Pattern.compile("[0-9]{3,}");
  12451.         boolean sequence = false;
  12452.         i = 0;
  12453.         while (i != 2) {
  12454.             matcher = pattern[i].matcher(newPassword);
  12455.             while(matcher.find()) {
  12456.                 if(sequenceCheck(matcher.group(),i)) {
  12457.                     sequence = true;
  12458.                     break;
  12459.                 }
  12460.             }
  12461.             i++;
  12462.             System.out.println(i);
  12463.         }
  12464.         return strength + "." + (sequence ? "@whi@Tip: Don't use easy sequences." : "");
  12465.     }
  12466.    
  12467.     boolean sequenceCheck(String s,int n) {
  12468.         s = s.toLowerCase();
  12469.         String sequence;
  12470.         if(n == 0)
  12471.             sequence = "abcdefghijklmnopqrstuvwxyz";
  12472.         else
  12473.             sequence = "0123456789";
  12474.         Pattern pattern;
  12475.         Matcher matcher;
  12476.         int b = 0,e = 3;
  12477.         while(!s.substring(b,e).equals("")) {
  12478.             pattern = Pattern.compile(s.substring(b,e));
  12479.             matcher = pattern.matcher(sequence);
  12480.             if (matcher.find())
  12481.                 return true;
  12482.             b++;
  12483.             e++;
  12484.             if(e > s.length())
  12485.                 return false;
  12486.         }
  12487.         return false;
  12488.     }
  12489.    
  12490.     public void sendFrame126(String str,int i) {
  12491.         RSInterface.interfaceCache[i].message = str;
  12492.         if(RSInterface.interfaceCache[i].parentID == tabInterfaceIDs[tabID])
  12493.             needDrawTabArea = true;
  12494.     }
  12495.  
  12496.     public void sendPacket185(int button,int toggle,int type) {
  12497.         switch(type) {
  12498.             case 135:
  12499.                 RSInterface class9 = RSInterface.interfaceCache[button];
  12500.                 boolean flag8 = true;
  12501.                 if(class9.contentType > 0)
  12502.                     flag8 = promptUserForInput(class9);
  12503.                 if(flag8) {
  12504.                     if(button >= 17202 && button <= 17227)
  12505.                         togglePrayerState(button);
  12506.                     switch(button) {
  12507.                         case 22597:
  12508.                             changePasswordSubmit();
  12509.                             break;
  12510.                         case 17231://Quick prayr confirm
  12511.                             saveQuickSelection();
  12512.                             break;
  12513.                         case 19144:
  12514.                             sendFrame248(15106,3213);
  12515.                             method60(15106);
  12516.                             inputTaken = true;
  12517.                             break;
  12518.                         case 22762:
  12519.                             openInterfaceID = 23471;//Pouch interface
  12520.                             break;
  12521.                         case 23475:
  12522.                             openInterfaceID = 22760;//Scroll interface
  12523.                             break;
  12524.                         default:
  12525.                             stream.createFrame(185);
  12526.                             stream.writeWord(button);
  12527.                             break;
  12528.                        
  12529.                     }
  12530.                 }
  12531.                 break;
  12532.             case 646:
  12533.                 stream.createFrame(185);
  12534.                 stream.writeWord(button);
  12535.                 RSInterface class9_2 = RSInterface.interfaceCache[button];
  12536.                 if(class9_2.valueIndexArray != null && class9_2.valueIndexArray[0][0] == 5) {
  12537.                     toggle = class9_2.valueIndexArray[0][1];
  12538.                     if(variousSettings[toggle] != class9_2.requiredValues[0]) {
  12539.                         variousSettings[toggle] = class9_2.requiredValues[0];
  12540.                         method33(toggle);
  12541.                         needDrawTabArea = true;
  12542.                     }
  12543.                 }
  12544.                 break;
  12545.             case 169:
  12546.                 stream.createFrame(185);
  12547.                 stream.writeWord(button);
  12548.                 RSInterface class9_3 = RSInterface.interfaceCache[button];
  12549.                 if(class9_3.valueIndexArray != null && class9_3.valueIndexArray[0][0] == 5) {
  12550.                     toggle = class9_3.valueIndexArray[0][1];
  12551.                     variousSettings[toggle] = 1 - variousSettings[toggle];
  12552.                     method33(toggle);
  12553.                     needDrawTabArea = true;
  12554.                     if(button >= 25000 && button <= 25050) {
  12555.                         handePrayerCorrection(button);
  12556.                     }
  12557.                     switch(button) {
  12558.                         //functionKeys
  12559.                         case 26007://Toggle function keys
  12560.                             functionKeys = !functionKeys;
  12561.                             setDetails();
  12562.                             break;
  12563.                         case 26008://Toggle halth bars
  12564.                             healthBars = !healthBars;
  12565.                             setDetails();
  12566.                             break;
  12567.                         case 26010://Toggle x10 damage
  12568.                             newDamage = !newDamage;
  12569.                             setDetails();
  12570.                             break;
  12571.                         case 152:
  12572.                             if(variousSettings[toggle] == 1)
  12573.                                 orbToggle[2] = true;
  12574.                             else
  12575.                                 orbToggle[2] = false;
  12576.                             break;
  12577.                         case 19136:
  12578.                             if(toggle == 0)
  12579.                                 sendFrame36(173,toggle);
  12580.                             if(toggle == 1)
  12581.                                 sendPacket185(153,173,646);
  12582.                             break;
  12583.                         case 25842://More options
  12584.                             toggle = (openInterfaceID == 26000) ? 0 : 1;
  12585.                             sendFrame36(175,toggle);
  12586.                             if(toggle == 1)
  12587.                                 openInterfaceID = 26000;
  12588.                             else
  12589.                                 openInterfaceID = -1;
  12590.                         break;
  12591.                                                 case 25837://Fullscreen
  12592.                             switchToFullScreen();
  12593.                             break;
  12594.                         case 26012://Fullscreen
  12595.                             switchToFullScreen();
  12596.                             break;
  12597.                     }
  12598.                 }
  12599.                 break;
  12600.         }
  12601.         System.out.println("button: " + button + ", toggle: " + toggle + ", type: " + type);
  12602.     }
  12603.    
  12604.     private void configureQuickTicks() {
  12605.         if(prayerInterfaceType == 5608) {
  12606.             if(getQuickPrayersSet() > 0) {
  12607.                 for(int index = 0; index < quickPrayers.length; index++) {
  12608.                     if(quickPrayers[index] == 1) {
  12609.                         if(index >= 0 && index <= 25) {
  12610.                             if(getOrbValues(1,null)[1] >= prayerLevelRequirements[index]) {
  12611.                                 int[] types = getPrayerTypeForIndex(index);
  12612.                                 if(types != null) {
  12613.                                     for(int g = 0; g < rangeAndMagePray.length; g++) {
  12614.                                         if(index == rangeAndMagePray[g]) {
  12615.                                             types = rangeAndMagePrayOff;
  12616.                                         }
  12617.                                     }
  12618.                                     for(int i = 0; i < types.length; i++) {
  12619.                                         if(index != types[i]) {
  12620.                                             if(index == 24 || index == 25) {
  12621.                                                 types = superiorPray;
  12622.                                             }
  12623.                                             quickPrayers[types[i]] = 0;
  12624.                                             variousSettings[quickConfigIDs[types[i]]] = 0;
  12625.                                             method33(quickConfigIDs[types[i]]);
  12626.                                             needDrawTabArea = true;
  12627.                                             if(dialogID != -1)
  12628.                                                 inputTaken = true;
  12629.                                         } else {
  12630.                                             quickPrayers[index] = 1;
  12631.                                             variousSettings[quickConfigIDs[index]] = quickPrayers[index];
  12632.                                             method33(quickConfigIDs[index]);
  12633.                                             needDrawTabArea = true;
  12634.                                             if(dialogID != -1)
  12635.                                                 inputTaken = true;
  12636.                                         }
  12637.                                     }
  12638.                                 } else {
  12639.                                     quickPrayers[index] = 1;
  12640.                                     variousSettings[quickConfigIDs[index]] = quickPrayers[index];
  12641.                                     method33(quickConfigIDs[index]);
  12642.                                     needDrawTabArea = true;
  12643.                                     if(dialogID != -1)
  12644.                                         inputTaken = true;
  12645.                                 }
  12646.                             }
  12647.                         }
  12648.                     }
  12649.                 }
  12650.             }
  12651.         } else if(prayerInterfaceType == 22500) {
  12652.             if(getQuickCursesSet() > 0) {
  12653.                 for(int index = 0; index < quickCurses.length; index++) {
  12654.                     if(quickCurses[index] == 1) {
  12655.                         if(index >= 0 && index <= 20) {
  12656.                             if(getOrbValues(1,null)[1] >= curseLevelRequirements[index]) {
  12657.                                 System.out.println("woop: " + getQuickCursesSet() + ", index: " + index);
  12658.                                 int[] types = getCurseTypeForIndex(index);
  12659.                                 if(types != null) {
  12660.                                     for(int i = 0; i < types.length; i++) {
  12661.                                         if(index != types[i]) {
  12662.                                             quickCurses[types[i]] = 0;
  12663.                                             variousSettings[quickConfigIDs[types[i]]] = 0;
  12664.                                             method33(quickConfigIDs[types[i]]);
  12665.                                             needDrawTabArea = true;
  12666.                                             if(dialogID != -1)
  12667.                                                 inputTaken = true;
  12668.                                         }
  12669.                                     }
  12670.                                 }
  12671.                                 quickCurses[index] =  1;
  12672.                                 variousSettings[quickConfigIDs[index]] = quickCurses[index];
  12673.                                 method33(quickConfigIDs[index]);
  12674.                                 needDrawTabArea = true;
  12675.                                 if(dialogID != -1)
  12676.                                     inputTaken = true;
  12677.                             }
  12678.                         }
  12679.                     }
  12680.                 }
  12681.             }
  12682.         }
  12683.     }
  12684.    
  12685.     public void readDetails()
  12686.     {
  12687.         String line = "";
  12688.         String token = "";
  12689.         String token2 = "";
  12690.         int ReadMode = 0;
  12691.         boolean EndOfFile = false;
  12692.         String[] token3 = new String[30];
  12693.         BufferedReader details = null;
  12694.         try
  12695.         {
  12696.             details = new BufferedReader(new FileReader(signlink.findcachedir() + "/deathlypvpzsave.ini"));
  12697.             try
  12698.             {
  12699.                 line = details.readLine();
  12700.             } catch(IOException ioexception)
  12701.             {
  12702.                 System.out.println("Error reading saveuser.ini");
  12703.             }
  12704.             while(EndOfFile == false && line != null)
  12705.             {
  12706.                 line = line.trim();
  12707.                 int spot = line.indexOf("=");
  12708.                 if(spot > -1)
  12709.                 {
  12710.                     token = line.substring(0, spot);
  12711.                     token = token.trim();
  12712.                     token2 = line.substring(spot + 1);
  12713.                     token2 = token2.trim();
  12714.                     token3 = token2.split("\t");
  12715.                     switch(ReadMode)
  12716.                     {
  12717.                         case 1:
  12718.                             if(token.equals("username")) {
  12719.                                 myUsername = token2;
  12720.                             }
  12721.                             if(token.equals("password"))
  12722.                                 myPassword = token2;
  12723.                             //if(token.equals("server"))
  12724.                             //  serverip = token2;
  12725.                             if(token.equals("keys"))
  12726.                                 functionKeys = token2.equals("0") ? false : true;
  12727.                             if(token.equals("health"))
  12728.                                 healthBars = token2.equals("0") ? false : true;
  12729.                             if(token.equals("damage"))
  12730.                                 newDamage = token2.equals("0") ? false : true;
  12731.                             break;
  12732.                         case 2:
  12733.                             if (token.equals("prayer")) {
  12734.                                 for (int j = 0; j < token3.length; j++) {
  12735.                                     quickPrayers[j] = Integer.parseInt(token3[j]);                     
  12736.                                 }
  12737.                             }
  12738.                             break;
  12739.                         case 3:
  12740.                             if (token.equals("curse")) {
  12741.                                 for (int j = 0; j < token3.length; j++) {
  12742.                                     quickCurses[j] = Integer.parseInt(token3[j]);                      
  12743.                                 }
  12744.                             }
  12745.                             break;
  12746.                        
  12747.                     }
  12748.                 } else {
  12749.                     if(line.equals("[ACCOUNT]"))
  12750.                         ReadMode = 1;
  12751.                     else if(line.equals("[PRAYERS]"))
  12752.                         ReadMode = 2;
  12753.                     else if(line.equals("[CURSES]"))
  12754.                         ReadMode = 3;
  12755.                     if(line.equals("[EOF]"))
  12756.                         try {
  12757.                             details.close();
  12758.                         } catch(IOException ioexception)
  12759.                         {
  12760.                             ioexception.printStackTrace();
  12761.                         }
  12762.                 }
  12763.                 try
  12764.                 {
  12765.                     line = details.readLine();
  12766.                 } catch(IOException ioexception1)
  12767.                 {
  12768.                     EndOfFile = true;
  12769.                 }
  12770.             }
  12771.         } catch(FileNotFoundException file) {
  12772.             System.out.println("Couldn't find saveuser.ini");
  12773.         }
  12774.         try {
  12775.             if(details != null)
  12776.                 details.close();
  12777.         } catch(NullPointerException ex) {
  12778.             ex.printStackTrace();
  12779.         } catch(IOException ioexception) {
  12780.             ioexception.printStackTrace();
  12781.         }
  12782.     }
  12783.    
  12784.     public void setDetails()
  12785.     {
  12786.         BufferedWriter details = null;
  12787.         try
  12788.         {
  12789.             details = new BufferedWriter(new FileWriter(signlink.findcachedir()+"/saveuser.ini"));
  12790.             saveValue(details,"[ACCOUNT]","nothing",false);
  12791.             saveValue(details,"username",myUsername,false);
  12792.             saveValue(details,"password",myPassword,false);
  12793.             //saveValue(details,"server",serverip,false);
  12794.             saveValue(details,"keys",functionKeys ? "1" : "0",false);
  12795.             saveValue(details,"health",healthBars ? "1" : "0",false);
  12796.             saveValue(details,"damage",newDamage ? "1" : "0",true);
  12797.  
  12798.             saveValue(details,"[PRAYERS]","nothing",false);
  12799.             String stringSave = "";
  12800.             for(int i = 0; i < quickPrayers.length; i++)    {
  12801.                 stringSave = stringSave + quickPrayers[i] + "\t";
  12802.             }
  12803.             saveValue(details,"prayer",stringSave,true);
  12804.            
  12805.             saveValue(details,"[CURSES]","nothing",false);
  12806.             stringSave = "";
  12807.             for(int i = 0; i < quickCurses.length; i++) {
  12808.                 stringSave = stringSave + quickCurses[i] + "\t";
  12809.             }
  12810.             saveValue(details,"curse",stringSave,true);
  12811.            
  12812.             //Ends
  12813.             details.newLine();
  12814.             details.write("[EOF]", 0, 5);
  12815.             details.newLine();
  12816.             details.newLine();
  12817.             details.close();
  12818.         } catch(IOException io) {
  12819.             (new File(signlink.findcachedir()+"/saveuser.ini")).delete();
  12820.             System.out.println("Error while writing saveuser.ini");
  12821.         }
  12822.     }
  12823.    
  12824.     private int[] quickPrayers = new int[26];
  12825.     private int[] quickCurses = new int[20];
  12826.     private boolean loadTickSelection = false;
  12827.    
  12828.     public static void saveValue(BufferedWriter buffer, String value,String variable,boolean last)
  12829.     {
  12830.         try
  12831.         {
  12832.             if(value == null || variable.equals("null"))
  12833.                 System.out.println("Error: saveValue had no identifier.");
  12834.             if(variable == null || variable.equals("null"))
  12835.                 variable = "0";
  12836.             if(value.startsWith("[") && value.endsWith("]"))
  12837.             {
  12838.                 buffer.write(value, 0, value.length());
  12839.             } else {
  12840.                 value =  value + " = ";
  12841.                 buffer.write(value, 0, value.length());
  12842.                 buffer.write(variable, 0, variable.length());
  12843.             }
  12844.             buffer.newLine();
  12845.             if(last)
  12846.                 buffer.newLine();
  12847.         }
  12848.         catch(IOException ioexception) {
  12849.             ioexception.printStackTrace();
  12850.         }
  12851.         catch(NullPointerException nullpointerexception)
  12852.         {
  12853.             nullpointerexception.printStackTrace();
  12854.         }
  12855.     }
  12856.    
  12857.     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};
  12858.     public void handePrayerCorrection(int button) {
  12859.         int index = button - 25000;
  12860.         if(index > 0)
  12861.             index = index/2;
  12862.         sendPacket185(oldPrayerButtons[index],-1,169);
  12863.     }
  12864.    
  12865.     private void saveQuickSelection() {
  12866.         setDetails();
  12867.         tabInterfaceIDs[5] = prayerInterfaceType;
  12868.     }
  12869.    
  12870.     private void handleQuickAidsActive() {
  12871.         if(prayerInterfaceType == 5608) {
  12872.             if(getQuickPrayersSet() > 0) {
  12873.                 if(!orbToggle[1])
  12874.                     for(int i = 0; i < quickPrayers.length; i++) {
  12875.                         if(quickPrayers[i] == 1) {
  12876.                             sendPacket185((i * 2) + 25000,-1,169);
  12877.                         }
  12878.                     }
  12879.                 else
  12880.                     turnOffPrayers();
  12881.                 orbToggle[1] = !orbToggle[1];
  12882.             } else {
  12883.                 if(orbToggle[1]) {
  12884.                     turnOffPrayers();
  12885.                     orbToggle[1] = false;
  12886.                 } else {
  12887.                     pushMessage("You don't have any quick prayers selected.", 0, "");
  12888.                     pushMessage("Right-click the Prayer button next to the minimap to select some.", 0, "");
  12889.                 }
  12890.             }
  12891.         } else if(prayerInterfaceType == 22500) {
  12892.             if(getQuickCursesSet() > 0) {
  12893.                 if(!orbToggle[1])
  12894.                     for(int i = 0; i < quickCurses.length; i++) {
  12895.                         if(quickCurses[i] == 1) {
  12896.                             sendPacket185((i * 2) + 22503,-1,169);
  12897.                         }
  12898.                     }
  12899.                 else
  12900.                     turnOffCurses();
  12901.                 orbToggle[1] = !orbToggle[1];
  12902.             } else {
  12903.                 if(orbToggle[1]) {
  12904.                     turnOffCurses();
  12905.                     orbToggle[1] = false;
  12906.                 } else {
  12907.                     pushMessage("You don't have any quick curses selected.", 0, "");
  12908.                     pushMessage("Right-click the Curses button next to the minimap to select some.", 0, "");
  12909.                 }
  12910.             }
  12911.         }
  12912.     }
  12913.    
  12914.     private int getQuickPrayersSet() {
  12915.         int amount = 0;
  12916.         for(int i = 0; i < quickPrayers.length; i++)
  12917.             if(quickPrayers[i] == 1) {
  12918.                 amount++;
  12919.             }
  12920.         return amount;
  12921.     }
  12922.    
  12923.     private int getQuickCursesSet() {
  12924.         int amount = 0;
  12925.         for(int i = 0; i < quickCurses.length; i++)
  12926.             if(quickCurses[i] == 1) {
  12927.                 amount++;
  12928.             }
  12929.         return amount;
  12930.     }
  12931.    
  12932.     private void turnOffPrayers() {
  12933.         int toggle = -1;
  12934.         for(int i = 0; i < quickPrayers.length; i++) {
  12935.             RSInterface rsInterface = RSInterface.interfaceCache[(i * 2) + 25000];
  12936.             if(rsInterface.valueIndexArray != null && rsInterface.valueIndexArray[0][0] == 5) {
  12937.                 toggle = rsInterface.valueIndexArray[0][1];
  12938.                 if(variousSettings[toggle] == 1)
  12939.                     sendPacket185((i * 2) + 25000,-1,169);
  12940.             }
  12941.         }
  12942.     }
  12943.    
  12944.     private void turnOffCurses() {
  12945.         int toggle = -1;
  12946.         for(int i = 0; i < quickCurses.length; i++) {
  12947.             RSInterface rsInterface = RSInterface.interfaceCache[(i * 2) + 22503];
  12948.             if(rsInterface.valueIndexArray != null && rsInterface.valueIndexArray[0][0] == 5) {
  12949.                 toggle = rsInterface.valueIndexArray[0][1];
  12950.                 if(variousSettings[toggle] == 1)
  12951.                     sendPacket185((i * 2) + 22503,-1,169);
  12952.             }
  12953.         }
  12954.     }
  12955.    
  12956.     private void turnOffQuickTicks() {
  12957.         int toggle = -1;
  12958.         for(int i = 0; i < quickCurses.length; i++) {
  12959.             RSInterface rsInterface = RSInterface.interfaceCache[17202 + i];
  12960.             if(rsInterface.valueIndexArray != null && rsInterface.valueIndexArray[0][0] == 5) {
  12961.                 toggle = rsInterface.valueIndexArray[0][1];
  12962.                 if(variousSettings[toggle] == 1)
  12963.                     sendPacket185(17202 + i,-1,169);
  12964.             }
  12965.         }
  12966.     }
  12967.  
  12968.     public void toggleQuickAidsSelection() {
  12969.         boolean inProcess = (tabInterfaceIDs[5] == 17200 || tabInterfaceIDs[5] == 17234);
  12970.         if(inProcess)
  12971.             saveQuickSelection();
  12972.         else {
  12973.             if(prayerInterfaceType == 5608) {
  12974.                 if(!inProcess) {
  12975.                     tabInterfaceIDs[5] = 17200;
  12976.                     needDrawTabArea = true;
  12977.                     tabAreaAltered = true;
  12978.                 } else {
  12979.                     tabInterfaceIDs[5] = 5608;
  12980.                     needDrawTabArea = true;
  12981.                     tabAreaAltered = true;
  12982.                 }
  12983.             } else if(prayerInterfaceType == 22500) {
  12984.                 if(!inProcess) {
  12985.                     tabInterfaceIDs[5] = 17234;
  12986.                     needDrawTabArea = true;
  12987.                     tabAreaAltered = true;
  12988.                 } else {
  12989.                     tabInterfaceIDs[5] = 22500;
  12990.                     needDrawTabArea = true;
  12991.                     tabAreaAltered = true;
  12992.                 }
  12993.             }
  12994.             tabID = 5;
  12995.         }
  12996.     }
  12997.  
  12998.     public final int[] curseLevelRequirements = {50,50,52,54,56,59,62,65,68,71,74,76,78,80,82,84,86,89,92,95};
  12999.     public final String[] curseName = {
  13000.         "Protect Item", "Sap Warrior", "Sap Ranger", "Sap Mage", "Sap Spirit",
  13001.         "Berserker", "Deflect Summoning", "Deflect Magic","Deflect Missiles", "Deflect Melee",
  13002.         "Leech Attack", "Leech Ranged", "Leech Magic", "Leech Defence", "Leech Strength",
  13003.         "Leech Energy", "Leech Special Attack", "Wrath", "Soul Split", "Turmoil"
  13004.     };
  13005.     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};
  13006.     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};
  13007.     public final String[] prayerName = {
  13008.         "Thick Skin", "Burst of Strength", "Clarity of Thought", "Sharp Eye", "Mystic Will", "Rock Skin", "Superhuman Strength", "Improved Reflexes","Rapid Restore",
  13009.         "Rapid Heal", "Protect Item", "Hawk Eye", "Mystic Lore", "Steel Skin", "Ultimate Strength", "Incredible Reflexes","Protect from Magic", "Protect from Missiles",
  13010.         "Protect from Melee","Eagle Eye", "Mystic Might", "Retribution", "Redemption", "Smite", "Chivalry", "Piety"
  13011.     };
  13012.     private int[] defPray = {0,5,13,24,25};
  13013.     private int[] strPray = {1,3,4,6,11,12,14,19,20,24,25};
  13014.     private int[] atkPray = {2,3,4,7,11,12,15,19,20,24,25};
  13015.     private int[] rangeAndMagePray = {3,4,11,12,19,20,24,25};
  13016.     private int[] rangeAndMagePrayOff = {1,2,3,4,6,7,11,12,14,15,19,20,24,25};
  13017.     private int[] headPray = {16,17,18,21,22,23};
  13018.     private int[] superiorPray = {0,1,2,3,4,5,6,7,11,12,13,14,15,19,20,24,25};
  13019.     private int[][] prayer = {defPray,strPray,atkPray,rangeAndMagePray,headPray};  
  13020.    
  13021.     private int[] getPrayerTypeForIndex(int index) {
  13022.         int[] type = null;
  13023.         for(int i = 0; i < prayer.length; i++) {
  13024.             for(int il = 0; il < prayer[i].length; il++) {
  13025.                 if(index == prayer[i][il]) {
  13026.                     type =  prayer[i];
  13027.                 }
  13028.             }
  13029.         }
  13030.         return type;
  13031.     }
  13032.    
  13033.     private int[] sapCurse = {1,2,3,4,19};
  13034.     private int[] leechCurse = {10,11,12,13,14,15,16,19};
  13035.     private int[] deflectCurse = {7,8,9,17,18};
  13036.    
  13037.     private int[] getCurseTypeForIndex(int index) {
  13038.         int[] types = null;
  13039.         for(int g = 0; g < leechCurse.length; g++) {
  13040.             if(index == leechCurse[g])
  13041.                 types = sapCurse;
  13042.         }
  13043.         for(int g = 0; g < sapCurse.length; g++) {
  13044.             if(index == sapCurse[g])
  13045.                 types = leechCurse;
  13046.         }
  13047.         for(int g = 0; g < deflectCurse.length; g++) {
  13048.             if(index == deflectCurse[g])
  13049.                 types = deflectCurse;
  13050.         }
  13051.         if(index == 6) {
  13052.             int[] type = {17,18};
  13053.             types = type;
  13054.         }
  13055.         if(index == 17 || index == 18) {
  13056.             int[] type = {6,7,8,9,17,18};
  13057.             types = type;
  13058.         }
  13059.         if(index == 19)  {
  13060.             int[] turmoilCurseOff = {1,2,3,4,10,11,12,13,14,15,16,19};
  13061.             types = turmoilCurseOff;
  13062.         }
  13063.         return types;
  13064.     }
  13065.    
  13066.     public void togglePrayerState(int button) {
  13067.         int index = button - 17202;
  13068.         if(prayerInterfaceType == 5608) {
  13069.             if(getOrbValues(1,null)[1] >= prayerLevelRequirements[index]) {
  13070.                 int[] types = getPrayerTypeForIndex(index);
  13071.                 if(types != null) {
  13072.                     for(int g = 0; g < rangeAndMagePray.length; g++) {
  13073.                         if(index == rangeAndMagePray[g]) {
  13074.                             types = rangeAndMagePrayOff;
  13075.                         }
  13076.                     }
  13077.                     for(int i = 0; i < types.length; i++) {
  13078.                         if(index != types[i]) {
  13079.                             if(index == 24 || index == 25) {
  13080.                                 types = superiorPray;
  13081.                             }
  13082.                             quickPrayers[types[i]] = 0;
  13083.                             variousSettings[quickConfigIDs[types[i]]] = 0;
  13084.                             method33(quickConfigIDs[types[i]]);
  13085.                             needDrawTabArea = true;
  13086.                             if(dialogID != -1)
  13087.                                 inputTaken = true;
  13088.                         } else {
  13089.                             quickPrayers[index] = (quickPrayers[index] + 1) % 2;
  13090.                             variousSettings[quickConfigIDs[index]] = quickPrayers[index];
  13091.                             method33(quickConfigIDs[index]);
  13092.                             needDrawTabArea = true;
  13093.                             if(dialogID != -1)
  13094.                                 inputTaken = true;
  13095.                         }
  13096.                     }
  13097.                 } else {
  13098.                     quickPrayers[index] = (quickPrayers[index] + 1) % 2;
  13099.                     variousSettings[quickConfigIDs[index]] = quickPrayers[index];
  13100.                     method33(quickConfigIDs[index]);
  13101.                     needDrawTabArea = true;
  13102.                     if(dialogID != -1)
  13103.                         inputTaken = true;
  13104.                 }
  13105.             } else {
  13106.                 pushMessage("You need a Prayer level of atleast " + prayerLevelRequirements[index] + " to use " + prayerName[index] + ".", 0, "");
  13107.             }
  13108.         } else if(prayerInterfaceType == 22500) {
  13109.             if(getOrbValues(1,null)[1] >= curseLevelRequirements[index]) {
  13110.                 int[] types = getCurseTypeForIndex(index);
  13111.                 if(types != null) {
  13112.                     for(int i = 0; i < types.length; i++) {
  13113.                         if(index != types[i]) {
  13114.                             quickCurses[types[i]] = 0;
  13115.                             variousSettings[quickConfigIDs[types[i]]] = 0;
  13116.                             method33(quickConfigIDs[types[i]]);
  13117.                             needDrawTabArea = true;
  13118.                             if(dialogID != -1)
  13119.                                 inputTaken = true;
  13120.                         }
  13121.                     }
  13122.                 }
  13123.                 quickCurses[index] = (quickCurses[index] + 1) % 2;
  13124.                 variousSettings[quickConfigIDs[index]] = quickCurses[index];
  13125.                 method33(quickConfigIDs[index]);
  13126.                 needDrawTabArea = true;
  13127.                 if(dialogID != -1)
  13128.                     inputTaken = true;
  13129.             } else {
  13130.                 pushMessage("You need a Prayer level of atleast " + curseLevelRequirements[index] + " to use " + curseName[index] + ".", 0, "");
  13131.             }
  13132.         }
  13133.     }
  13134.  
  13135.     public void sendFrame36(int id,int state) {
  13136.         anIntArray1045[id] = state;
  13137.         if(variousSettings[id] != state) {
  13138.             variousSettings[id] = state;
  13139.             method33(id);
  13140.             needDrawTabArea = true;
  13141.             if(dialogID != -1)
  13142.                 inputTaken = true;
  13143.         }
  13144.     }
  13145.  
  13146.     public void sendFrame219() {
  13147.         if(invOverlayInterfaceID != -1) {
  13148.             invOverlayInterfaceID = -1;
  13149.             needDrawTabArea = true;
  13150.             tabAreaAltered = true;
  13151.         }
  13152.         if(backDialogID != -1) {
  13153.             backDialogID = -1;
  13154.             inputTaken = true;
  13155.         }
  13156.         if(inputDialogState != 0) {
  13157.             inputDialogState = 0;
  13158.             inputTaken = true;
  13159.         }
  13160.         openInterfaceID = -1;
  13161.         aBoolean1149 = false;
  13162.     }
  13163.  
  13164.     public void sendFrame248(int interfaceID,int sideInterfaceID)   {
  13165.         if(backDialogID != -1) {
  13166.             backDialogID = -1;
  13167.             inputTaken = true;
  13168.         }
  13169.         if(inputDialogState != 0) {
  13170.             inputDialogState = 0;
  13171.             inputTaken = true;
  13172.         }
  13173.         openInterfaceID = interfaceID;
  13174.         invOverlayInterfaceID = sideInterfaceID;
  13175.         needDrawTabArea = true;
  13176.         tabAreaAltered = true;
  13177.         aBoolean1149 = false;
  13178.     }
  13179.  
  13180.     private int editedTextFrame = 0;
  13181.     private String newText = "";
  13182.     private boolean parsePacket() {
  13183.         if(socketStream == null)
  13184.             return false;
  13185.         try {
  13186.             int i = socketStream.available();
  13187.             if(i == 0)
  13188.                 return false;
  13189.             if(pktType == -1) {
  13190.                 socketStream.flushInputStream(inStream.buffer, 1);
  13191.                 pktType = inStream.buffer[0] & 0xff;
  13192.                 if(encryption != null)
  13193.                     pktType = pktType - encryption.getNextKey() & 0xff;
  13194.                 pktSize = SizeConstants.packetSizes[pktType];
  13195.                 i--;
  13196.             }
  13197.             if(pktSize == -1)
  13198.                 if(i > 0) {
  13199.                     socketStream.flushInputStream(inStream.buffer, 1);
  13200.                     pktSize = inStream.buffer[0] & 0xff;
  13201.                     i--;
  13202.                 } else {
  13203.                     return false;
  13204.                 }
  13205.             if(pktSize == -2)
  13206.                 if(i > 1) {
  13207.                     socketStream.flushInputStream(inStream.buffer, 2);
  13208.                     inStream.currentOffset = 0;
  13209.                     pktSize = inStream.readUnsignedWord();
  13210.                     i -= 2;
  13211.                 } else {
  13212.                     return false;
  13213.                 }
  13214.             if(i < pktSize)
  13215.                 return false;
  13216.             inStream.currentOffset = 0;
  13217.             socketStream.flushInputStream(inStream.buffer, pktSize);
  13218.             anInt1009 = 0;
  13219.             anInt843 = anInt842;
  13220.             anInt842 = anInt841;
  13221.             anInt841 = pktType;
  13222.             switch(pktType) {
  13223.                 case 81:
  13224.                     updatePlayers(pktSize, inStream);
  13225.                     if(openInterfaceID == 26000) {
  13226.                         sendFrame36(650,functionKeys ? 1 : 0);
  13227.                         sendFrame36(651,healthBars ? 1 : 0);
  13228.                         sendFrame36(652,newDamage ? 1 : 0);
  13229.                     }
  13230.                     sendFrame36(175,(openInterfaceID == 26000) ? 1 : 0);
  13231.                     sendFrame36(653,toggleFullscreen ? 1 : 0);
  13232.                     aBoolean1080 = false;
  13233.                     pktType = -1;
  13234.                     return true;
  13235.                    
  13236.                 case 176:
  13237.                     daysSinceRecovChange = inStream.method427();
  13238.                     unreadMessages = inStream.method435();
  13239.                     membersInt = inStream.readUnsignedByte();
  13240.                     anInt1193 = inStream.method440();
  13241.                     daysSinceLastLogin = inStream.readUnsignedWord();
  13242.                     if(anInt1193 != 0 && openInterfaceID == -1) {
  13243.                         signlink.dnslookup(TextClass.method586(anInt1193));
  13244.                         clearTopInterfaces();
  13245.                         char c = '\u028A';
  13246.                         if(daysSinceRecovChange != 201 || membersInt == 1)
  13247.                             c = '\u028F';
  13248.                         reportAbuseInput = "";
  13249.                         canMute = false;
  13250.                         canBan = false;
  13251.                         for(int k9 = 0; k9 < RSInterface.interfaceCache.length; k9++) {
  13252.                             if(RSInterface.interfaceCache[k9] == null || RSInterface.interfaceCache[k9].contentType != c)
  13253.                                 continue;
  13254.                             openInterfaceID = RSInterface.interfaceCache[k9].parentID;
  13255.                            
  13256.                         }
  13257.                     }
  13258.                     pktType = -1;
  13259.                     return true;
  13260.                    
  13261.                 case 64:
  13262.                     anInt1268 = inStream.method427();
  13263.                     anInt1269 = inStream.method428();
  13264.                     for(int j = anInt1268; j < anInt1268 + 8; j++) {
  13265.                         for(int l9 = anInt1269; l9 < anInt1269 + 8; l9++)
  13266.                             if(groundArray[plane][j][l9] != null) {
  13267.                                 groundArray[plane][j][l9] = null;
  13268.                                 spawnGroundItem(j, l9);
  13269.                             }
  13270.                     }
  13271.                     for(Class30_Sub1 class30_sub1 = (Class30_Sub1)aClass19_1179.reverseGetFirst(); class30_sub1 != null; class30_sub1 = (Class30_Sub1)aClass19_1179.reverseGetNext())
  13272.                         if(class30_sub1.anInt1297 >= anInt1268 && class30_sub1.anInt1297 < anInt1268 + 8 && class30_sub1.anInt1298 >= anInt1269 && class30_sub1.anInt1298 < anInt1269 + 8 && class30_sub1.anInt1295 == plane)
  13273.                             class30_sub1.anInt1294 = 0;
  13274.                     pktType = -1;
  13275.                     return true;
  13276.                    
  13277.                 case 185:
  13278.                     int k = inStream.method436();
  13279.                     RSInterface.interfaceCache[k].anInt233 = 3;
  13280.                     if(myPlayer.desc == null)
  13281.                         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];
  13282.                     else
  13283.                         RSInterface.interfaceCache[k].mediaID = (int)(0x12345678L + myPlayer.desc.type);
  13284.                     pktType = -1;
  13285.                     return true;
  13286.                    
  13287.                 /* Clan chat packet */
  13288.                 case 217:
  13289.                     try {
  13290.                         name = inStream.readString();
  13291.                         message = inStream.readString();
  13292.                         clanname = inStream.readString();
  13293.                         rights = inStream.readUnsignedWord();
  13294.                         //message = TextInput.processText(message);
  13295.                         //message = Censor.doCensor(message);
  13296.                         System.out.println(clanname);
  13297.                         pushMessage(message, 16, name);
  13298.                     } catch(Exception e) {
  13299.                         e.printStackTrace();
  13300.                     }
  13301.                     pktType = -1;
  13302.                     return true;
  13303.                    
  13304.                 case 107:
  13305.                     aBoolean1160 = false;
  13306.                     for(int l = 0; l < 5; l++)
  13307.                         aBooleanArray876[l] = false;
  13308.                                                                                                             xpCounter = 0;
  13309.                     pktType = -1;
  13310.                     return true;
  13311.                    
  13312.                 case 72:
  13313.                     int i1 = inStream.method434();
  13314.                     RSInterface class9 = RSInterface.interfaceCache[i1];
  13315.                     for(int k15 = 0; k15 < class9.inv.length; k15++) {
  13316.                         class9.inv[k15] = -1;
  13317.                         class9.inv[k15] = 0;
  13318.                     }
  13319.                     pktType = -1;
  13320.                     return true;
  13321.                    
  13322.                 case 214:
  13323.                     ignoreCount = pktSize / 8;
  13324.                     for(int j1 = 0; j1 < ignoreCount; j1++)
  13325.                         ignoreListAsLongs[j1] = inStream.readQWord();
  13326.                     pktType = -1;
  13327.                     return true;
  13328.                    
  13329.                 case 166:
  13330.                     aBoolean1160 = true;
  13331.                     anInt1098 = inStream.readUnsignedByte();
  13332.                     anInt1099 = inStream.readUnsignedByte();
  13333.                     anInt1100 = inStream.readUnsignedWord();
  13334.                     anInt1101 = inStream.readUnsignedByte();
  13335.                     anInt1102 = inStream.readUnsignedByte();
  13336.                     if(anInt1102 >= 100) {
  13337.                         xCameraPos = anInt1098 * 128 + 64;
  13338.                         yCameraPos = anInt1099 * 128 + 64;
  13339.                         zCameraPos = method42(plane, yCameraPos, xCameraPos) - anInt1100;
  13340.                     }
  13341.                     pktType = -1;
  13342.                     return true;
  13343.                    
  13344.                 case 134:                  
  13345.                     needDrawTabArea = true;
  13346.                     int skillIndex = inStream.readUnsignedByte();
  13347.                     int i10 = inStream.method439();
  13348.                     int l15 = inStream.readUnsignedByte();
  13349.                     int xp = currentExp[skillIndex];
  13350.                     currentExp[skillIndex] = i10;
  13351.                     currentStats[skillIndex] = l15;
  13352.                     maxStats[skillIndex] = 1;
  13353.                     xpCounter += currentExp[skillIndex]-xp;
  13354.                     expAdded = currentExp[skillIndex]-xp;
  13355.                     for(int k20 = 0; k20 < 98; k20++)
  13356.                         if(i10 >= anIntArray1019[k20])
  13357.                             maxStats[skillIndex] = k20 + 2;
  13358.                     pktType = -1;
  13359.                     return true;
  13360.                    
  13361.                 case 71:
  13362.                     int l1 = inStream.readUnsignedWord();
  13363.                     int j10 = inStream.method426();
  13364.                     if(l1 == 65535)
  13365.                         l1 = -1;
  13366.                     if(j10 == 5) {
  13367.                         loadTickSelection = false;
  13368.                         if(orbToggle[1] && prayerInterfaceType != l1) {
  13369.                             turnOffPrayers();
  13370.                             turnOffCurses();
  13371.                             turnOffQuickTicks();
  13372.                             orbToggle[1] = !orbToggle[1];
  13373.                         }
  13374.                         prayerInterfaceType = l1;
  13375.                     }
  13376.                     tabInterfaceIDs[j10] = l1;
  13377.                     needDrawTabArea = true;
  13378.                     tabAreaAltered = true;
  13379.                     pktType = -1;
  13380.                     return true;
  13381.                    
  13382.                 case 74:
  13383.                     int i2 = inStream.method434();
  13384.                     if(i2 == 65535)
  13385.                         i2 = -1;
  13386.                     if(i2 != currentSong && musicEnabled && !lowMem && prevSong == 0) {
  13387.                         nextSong = i2;
  13388.                         songChanging = true;
  13389.                         onDemandFetcher.method558(2, nextSong);
  13390.                     }
  13391.                     currentSong = i2;
  13392.                     pktType = -1;
  13393.                     return true;
  13394.                    
  13395.                 case 121:
  13396.                     int j2 = inStream.method436();
  13397.                     int k10 = inStream.method435();
  13398.                     if(musicEnabled && !lowMem) {
  13399.                         nextSong = j2;
  13400.                         songChanging = false;
  13401.                         onDemandFetcher.method558(2, nextSong);
  13402.                         prevSong = k10;
  13403.                     }
  13404.                     pktType = -1;
  13405.                     return true;
  13406.                    
  13407.                 case 109:
  13408.                     resetLogout();
  13409.                     pktType = -1;
  13410.                     return false;
  13411.                    
  13412.                 case 70:
  13413.                     int k2 = inStream.readSignedWord();
  13414.                     int l10 = inStream.method437();
  13415.                     int i16 = inStream.method434();
  13416.                     RSInterface class9_5 = RSInterface.interfaceCache[i16];
  13417.                     class9_5.anInt263 = k2;
  13418.                     class9_5.anInt265 = l10;
  13419.                     pktType = -1;
  13420.                     return true;
  13421.                    
  13422.                 case 73:
  13423.                 case 241:
  13424.                     int l2 = anInt1069;
  13425.                     int i11 = anInt1070;
  13426.                     if(pktType == 73) {
  13427.                         l2 = inStream.method435();
  13428.                         i11 = inStream.readUnsignedWord();
  13429.                         aBoolean1159 = false;
  13430.                     }
  13431.                     if(pktType == 241) {
  13432.                         i11 = inStream.method435();
  13433.                         inStream.initBitAccess();
  13434.                         for(int j16 = 0; j16 < 4; j16++) {
  13435.                             for(int l20 = 0; l20 < 13; l20++) {
  13436.                                 for(int j23 = 0; j23 < 13; j23++) {
  13437.                                     int i26 = inStream.readBits(1);
  13438.                                     if(i26 == 1)
  13439.                                         anIntArrayArrayArray1129[j16][l20][j23] = inStream.readBits(26);
  13440.                                     else
  13441.                                         anIntArrayArrayArray1129[j16][l20][j23] = -1;
  13442.                                 }
  13443.                             }
  13444.                         }
  13445.                         inStream.finishBitAccess();
  13446.                         l2 = inStream.readUnsignedWord();
  13447.                         aBoolean1159 = true;
  13448.                     }
  13449.                     if(anInt1069 == l2 && anInt1070 == i11 && loadingStage == 2) {
  13450.                         pktType = -1;
  13451.                         return true;
  13452.                     }
  13453.                     anInt1069 = l2;
  13454.                     anInt1070 = i11;
  13455.                     baseX = (anInt1069 - 6) * 8;
  13456.                     baseY = (anInt1070 - 6) * 8;
  13457.                     aBoolean1141 = (anInt1069 / 8 == 48 || anInt1069 / 8 == 49) && anInt1070 / 8 == 48;
  13458.                     if(anInt1069 / 8 == 48 && anInt1070 / 8 == 148)
  13459.                         aBoolean1141 = true;
  13460.                     loadingStage = 1;
  13461.                     aLong824 = System.currentTimeMillis();
  13462.                     main3DArea.initDrawingArea();
  13463.                     normalFont.drawText(0, "Loading Deathlypvpz - please wait.", 151, 257);
  13464.                     normalFont.drawText(0xffffff, "Loading Deathlypvpz - please wait.", 150, 256);
  13465.                     main3DArea.drawGraphics(toggleFullscreen ? 0 : 4, super.graphics, toggleFullscreen ? 0 : 4);
  13466.                     if(pktType == 73) {
  13467.                         int k16 = 0;
  13468.                         for(int i21 = (anInt1069 - 6) / 8; i21 <= (anInt1069 + 6) / 8; i21++) {
  13469.                             for(int k23 = (anInt1070 - 6) / 8; k23 <= (anInt1070 + 6) / 8; k23++)
  13470.                                 k16++;
  13471.                         }
  13472.                         aByteArrayArray1183 = new byte[k16][];
  13473.                         aByteArrayArray1247 = new byte[k16][];
  13474.                         anIntArray1234 = new int[k16];
  13475.                         anIntArray1235 = new int[k16];
  13476.                         anIntArray1236 = new int[k16];
  13477.                         k16 = 0;
  13478.                         for(int l23 = (anInt1069 - 6) / 8; l23 <= (anInt1069 + 6) / 8; l23++) {
  13479.                             for(int j26 = (anInt1070 - 6) / 8; j26 <= (anInt1070 + 6) / 8; j26++) {
  13480.                                 anIntArray1234[k16] = (l23 << 8) + j26;
  13481.                                 if(aBoolean1141 && (j26 == 49 || j26 == 149 || j26 == 147 || l23 == 50 || l23 == 49 && j26 == 47)) {
  13482.                                     anIntArray1235[k16] = -1;
  13483.                                     anIntArray1236[k16] = -1;
  13484.                                     k16++;
  13485.                                 } else {
  13486.                                     int k28 = anIntArray1235[k16] = onDemandFetcher.method562(0, j26, l23);
  13487.                                     if(k28 != -1)
  13488.                                         onDemandFetcher.method558(3, k28);
  13489.                                     int j30 = anIntArray1236[k16] = onDemandFetcher.method562(1, j26, l23);
  13490.                                     if(j30 != -1)
  13491.                                         onDemandFetcher.method558(3, j30);
  13492.                                     k16++;
  13493.                                 }
  13494.                             }
  13495.                         }
  13496.                     }
  13497.                     if(pktType == 241) {
  13498.                         int l16 = 0;
  13499.                         int ai[] = new int[676];
  13500.                         for(int i24 = 0; i24 < 4; i24++) {
  13501.                             for(int k26 = 0; k26 < 13; k26++) {
  13502.                                 for(int l28 = 0; l28 < 13; l28++) {
  13503.                                     int k30 = anIntArrayArrayArray1129[i24][k26][l28];
  13504.                                     if(k30 != -1) {
  13505.                                         int k31 = k30 >> 14 & 0x3ff;
  13506.                                         int i32 = k30 >> 3 & 0x7ff;
  13507.                                         int k32 = (k31 / 8 << 8) + i32 / 8;
  13508.                                         for(int j33 = 0; j33 < l16; j33++) {
  13509.                                             if(ai[j33] != k32)
  13510.                                                 continue;
  13511.                                             k32 = -1;
  13512.                                            
  13513.                                         }
  13514.                                         if(k32 != -1)
  13515.                                             ai[l16++] = k32;
  13516.                                     }
  13517.                                 }
  13518.                             }
  13519.                         }
  13520.                         aByteArrayArray1183 = new byte[l16][];
  13521.                         aByteArrayArray1247 = new byte[l16][];
  13522.                         anIntArray1234 = new int[l16];
  13523.                         anIntArray1235 = new int[l16];
  13524.                         anIntArray1236 = new int[l16];
  13525.                         for(int l26 = 0; l26 < l16; l26++) {
  13526.                             int i29 = anIntArray1234[l26] = ai[l26];
  13527.                             int l30 = i29 >> 8 & 0xff;
  13528.                             int l31 = i29 & 0xff;
  13529.                             int j32 = anIntArray1235[l26] = onDemandFetcher.method562(0, l31, l30);
  13530.                             if(j32 != -1)
  13531.                                 onDemandFetcher.method558(3, j32);
  13532.                             int i33 = anIntArray1236[l26] = onDemandFetcher.method562(1, l31, l30);
  13533.                             if(i33 != -1)
  13534.                                 onDemandFetcher.method558(3, i33);
  13535.                         }
  13536.                     }
  13537.                     int i17 = baseX - anInt1036;
  13538.                     int j21 = baseY - anInt1037;
  13539.                     anInt1036 = baseX;
  13540.                     anInt1037 = baseY;
  13541.                     for(int j24 = 0; j24 < 16384; j24++) {
  13542.                         NPC npc = npcArray[j24];
  13543.                         if(npc != null) {
  13544.                             for(int j29 = 0; j29 < 10; j29++) {
  13545.                                 npc.smallX[j29] -= i17;
  13546.                                 npc.smallY[j29] -= j21;
  13547.                             }
  13548.                             npc.x -= i17 * 128;
  13549.                             npc.y -= j21 * 128;
  13550.                         }
  13551.                     }
  13552.                     for(int i27 = 0; i27 < maxPlayers; i27++) {
  13553.                         Player player = playerArray[i27];
  13554.                         if(player != null) {
  13555.                             for(int i31 = 0; i31 < 10; i31++) {
  13556.                                 player.smallX[i31] -= i17;
  13557.                                 player.smallY[i31] -= j21;
  13558.                             }
  13559.                             player.x -= i17 * 128;
  13560.                             player.y -= j21 * 128;
  13561.                         }
  13562.                     }
  13563.                     aBoolean1080 = true;
  13564.                     byte byte1 = 0;
  13565.                     byte byte2 = 104;
  13566.                     byte byte3 = 1;
  13567.                     if(i17 < 0) {
  13568.                         byte1 = 103;
  13569.                         byte2 = -1;
  13570.                         byte3 = -1;
  13571.                     }
  13572.                     byte byte4 = 0;
  13573.                     byte byte5 = 104;
  13574.                     byte byte6 = 1;
  13575.                     if(j21 < 0) {
  13576.                         byte4 = 103;
  13577.                         byte5 = -1;
  13578.                         byte6 = -1;
  13579.                     }
  13580.                     for(int k33 = byte1; k33 != byte2; k33 += byte3) {
  13581.                         for(int l33 = byte4; l33 != byte5; l33 += byte6) {
  13582.                             int i34 = k33 + i17;
  13583.                             int j34 = l33 + j21;
  13584.                             for(int k34 = 0; k34 < 4; k34++)
  13585.                                 if(i34 >= 0 && j34 >= 0 && i34 < 104 && j34 < 104)
  13586.                                     groundArray[k34][k33][l33] = groundArray[k34][i34][j34];
  13587.                                 else
  13588.                                     groundArray[k34][k33][l33] = null;
  13589.                         }
  13590.                     }
  13591.                     for(Class30_Sub1 class30_sub1_1 = (Class30_Sub1)aClass19_1179.reverseGetFirst(); class30_sub1_1 != null; class30_sub1_1 = (Class30_Sub1)aClass19_1179.reverseGetNext()) {
  13592.                         class30_sub1_1.anInt1297 -= i17;
  13593.                         class30_sub1_1.anInt1298 -= j21;
  13594.                         if(class30_sub1_1.anInt1297 < 0 || class30_sub1_1.anInt1298 < 0 || class30_sub1_1.anInt1297 >= 104 || class30_sub1_1.anInt1298 >= 104)
  13595.                             class30_sub1_1.unlink();
  13596.                     }
  13597.                     if(destX != 0) {
  13598.                         destX -= i17;
  13599.                         destY -= j21;
  13600.                     }
  13601.                     aBoolean1160 = false;
  13602.                     pktType = -1;
  13603.                     return true;
  13604.                    
  13605.                 case 208:
  13606.                     int i3 = inStream.method437();
  13607.                     if(i3 >= 0)
  13608.                         method60(i3);
  13609.                     walkableInterfaceID = i3;
  13610.                     pktType = -1;
  13611.                     return true;
  13612.                    
  13613.                 case 99:
  13614.                     minimapCover = inStream.readUnsignedByte();
  13615.                     pktType = -1;
  13616.                     return true;
  13617.                    
  13618.                 case 75:
  13619.                     int j3 = inStream.method436();
  13620.                     int j11 = inStream.method436();
  13621.                     RSInterface.interfaceCache[j11].anInt233 = 2;
  13622.                     RSInterface.interfaceCache[j11].mediaID = j3;
  13623.                     pktType = -1;
  13624.                     return true;
  13625.                    
  13626.                 case 114:
  13627.                     systemUpdatetime = inStream.method434() * 30;
  13628.                     pktType = -1;
  13629.                     return true;
  13630.                    
  13631.                 case 60:
  13632.                     anInt1269 = inStream.readUnsignedByte();
  13633.                     anInt1268 = inStream.method427();
  13634.                     while(inStream.currentOffset < pktSize) {
  13635.                         int k3 = inStream.readUnsignedByte();
  13636.                         method137(inStream, k3);
  13637.                     }
  13638.                     pktType = -1;
  13639.                     return true;
  13640.                    
  13641.                 case 35:
  13642.                     int l3 = inStream.readUnsignedByte();
  13643.                     int k11 = inStream.readUnsignedByte();
  13644.                     int j17 = inStream.readUnsignedByte();
  13645.                     int k21 = inStream.readUnsignedByte();
  13646.                     aBooleanArray876[l3] = true;
  13647.                     anIntArray873[l3] = k11;
  13648.                     anIntArray1203[l3] = j17;
  13649.                     anIntArray928[l3] = k21;
  13650.                     anIntArray1030[l3] = 0;
  13651.                     pktType = -1;
  13652.                     return true;
  13653.                    
  13654.                 case 174:
  13655.                     int i4 = inStream.readUnsignedWord();
  13656.                     int l11 = inStream.readUnsignedByte();
  13657.                     int k17 = inStream.readUnsignedWord();
  13658.                     if(aBoolean848 && !lowMem && anInt1062 < 50) {
  13659.                         anIntArray1207[anInt1062] = i4;
  13660.                         anIntArray1241[anInt1062] = l11;
  13661.                         anIntArray1250[anInt1062] = k17 + Sounds.anIntArray326[i4];
  13662.                         anInt1062++;
  13663.                     }
  13664.                     pktType = -1;
  13665.                     return true;
  13666.                    
  13667.                 case 104:
  13668.                     int j4 = inStream.method427();
  13669.                     int i12 = inStream.method426();
  13670.                     String s6 = inStream.readString();
  13671.                     if(j4 >= 1 && j4 <= 5) {
  13672.                         if(s6.equalsIgnoreCase("null"))
  13673.                             s6 = null;
  13674.                         atPlayerActions[j4 - 1] = s6;
  13675.                         atPlayerArray[j4 - 1] = i12 == 0;
  13676.                     }
  13677.                     pktType = -1;
  13678.                     return true;
  13679.                    
  13680.                 case 78:
  13681.                     destX = 0;
  13682.                     pktType = -1;
  13683.                     return true;
  13684.                    
  13685.                 case 253:
  13686.                     String s = inStream.readString();
  13687.                                         if(s.startsWith("Alert##")) {
  13688.                         String[] args = s.split("##");
  13689.                         if (args.length == 3) {
  13690.                             alertHandler.alert = new Alert("Notification", args[1], args[2]);
  13691.                         } else if (args.length == 4) {
  13692.                             alertHandler.alert = new Alert(args[1], args[2], args[3]);
  13693.                         }
  13694.                         pktType = -1;
  13695.                         return true;
  13696.                     }
  13697.                     if(s.toLowerCase().contains("oh dear you are dead!")) {
  13698.                         if(orbToggle[1]) {
  13699.                             turnOffPrayers();
  13700.                             turnOffCurses();
  13701.                             orbToggle[1] = false;
  13702.                         }
  13703.                     }
  13704.                     if(s.toLowerCase().contains("@autocastoff")) {
  13705.                         setAutoCastOff();
  13706.                         break;
  13707.                     }
  13708.                     if(s.toLowerCase().contains("you have been poisoned")) {
  13709.                         orbToggle[0] = true;
  13710.                     }
  13711.                     if(s.toLowerCase().contains("you are no longer poisoned") || s.toLowerCase().contains("your antipoison potion") || s.toLowerCase().contains("antidote")) {
  13712.                         System.out.println("s: " + s);
  13713.                         orbToggle[0] = false;
  13714.                     }
  13715.                     if(s.endsWith(":tradereq:")) {
  13716.                         String s3 = s.substring(0, s.indexOf(":"));
  13717.                         long l17 = TextClass.longForName(s3);
  13718.                         boolean flag2 = false;
  13719.                         for(int j27 = 0; j27 < ignoreCount; j27++) {
  13720.                             if(ignoreListAsLongs[j27] != l17)
  13721.                                 continue;
  13722.                             flag2 = true;
  13723.                            
  13724.                         }
  13725.                         if(!flag2 && anInt1251 == 0)
  13726.                             pushMessage("wishes to trade with you.", 4, s3);
  13727.                     } else if (s.endsWith(":ooo33:")) {
  13728.                         String s4 = s.substring(0, s.indexOf(":"));
  13729.                         long l18 = TextClass.longForName(s4);
  13730.                         pushMessage("Clan: ", 8, s4);  
  13731.                     } else if(s.endsWith("#url#")) {
  13732.                         String link = s.substring(0, s.indexOf("#"));
  13733.                         pushMessage("Join us at: ", 9, link);
  13734.                     } else if(s.startsWith("#010#")) {
  13735.                         shoutYell = s.substring(5);
  13736.                         nameYell = "";
  13737.                         if(s.contains("@cr1@"))
  13738.                             nameYell = "1";
  13739.                         if(s.contains("@cr2@"))
  13740.                             nameYell = "2";
  13741.                                                 if(s.contains("@cr5@"))
  13742.                             nameYell = "5";
  13743.                            
  13744.                         pushMessage(shoutYell, 16, nameYell);
  13745.                     } else if(s.contains("#link-") && s.endsWith("#")) {
  13746.                         int firstIndex = s.indexOf('-');
  13747.                         int lastIndex = s.lastIndexOf('#');
  13748.                         String link = s.substring(firstIndex + 1,lastIndex);
  13749.                         pushMessage(s.substring(0,s.indexOf('#')), 9, link);
  13750.                     } else if(s.endsWith(":duelreq:")) {
  13751.                         String s4 = s.substring(0, s.indexOf(":"));
  13752.                         long l18 = TextClass.longForName(s4);
  13753.                         boolean flag3 = false;
  13754.                         for(int k27 = 0; k27 < ignoreCount; k27++) {
  13755.                             if(ignoreListAsLongs[k27] != l18)
  13756.                                 continue;
  13757.                             flag3 = true;
  13758.                            
  13759.                         }
  13760.                         if(!flag3 && anInt1251 == 0)
  13761.                             pushMessage("wishes to duel with you.", 8, s4);
  13762.                     } else if(s.endsWith(":chalreq:")) {
  13763.                         String s5 = s.substring(0, s.indexOf(":"));
  13764.                         long l19 = TextClass.longForName(s5);
  13765.                         boolean flag4 = false;
  13766.                         for(int l27 = 0; l27 < ignoreCount; l27++) {
  13767.                             if(ignoreListAsLongs[l27] != l19)
  13768.                                 continue;
  13769.                             flag4 = true;
  13770.                            
  13771.                         }
  13772.                         if(!flag4 && anInt1251 == 0) {
  13773.                             String s8 = s.substring(s.indexOf(":") + 1, s.length() - 9);
  13774.                             pushMessage(s8, 8, s5);
  13775.                         }
  13776.                     } else {
  13777.                         pushMessage(s, 0, "");
  13778.                     }
  13779.                     pktType = -1;
  13780.                     return true;
  13781.                    
  13782.                 case 1:
  13783.                     for(int k4 = 0; k4 < playerArray.length; k4++)
  13784.                         if(playerArray[k4] != null)
  13785.                             playerArray[k4].anim = -1;
  13786.                     for(int j12 = 0; j12 < npcArray.length; j12++)
  13787.                         if(npcArray[j12] != null)
  13788.                             npcArray[j12].anim = -1;
  13789.                     pktType = -1;
  13790.                     return true;
  13791.                    
  13792.                 case 50:
  13793.                     long l4 = inStream.readQWord();
  13794.                     int i18 = inStream.readUnsignedByte();
  13795.                     String s7 = TextClass.fixName(TextClass.nameForLong(l4));
  13796.                     for(int k24 = 0; k24 < friendsCount; k24++) {
  13797.                         if(l4 != friendsListAsLongs[k24])
  13798.                             continue;
  13799.                         if(friendsNodeIDs[k24] != i18) {
  13800.                             friendsNodeIDs[k24] = i18;
  13801.                             needDrawTabArea = true;
  13802.                             if(i18 >= 2) {
  13803.                                 pushMessage(s7 + " has logged in.", 5, "");
  13804.                             }
  13805.                             if(i18 <= 1) {
  13806.                                 pushMessage(s7 + " has logged out.", 5, "");
  13807.                             }
  13808.                         }
  13809.                         s7 = null;
  13810.                        
  13811.                     }
  13812.                     if(s7 != null && friendsCount < 200) {
  13813.                         friendsListAsLongs[friendsCount] = l4;
  13814.                         friendsList[friendsCount] = s7;
  13815.                         friendsNodeIDs[friendsCount] = i18;
  13816.                         friendsCount++;
  13817.                         needDrawTabArea = true;
  13818.                     }
  13819.                     for(boolean flag6 = false; !flag6;) {
  13820.                         flag6 = true;
  13821.                         for(int k29 = 0; k29 < friendsCount - 1; k29++)
  13822.                             if(friendsNodeIDs[k29] != nodeID && friendsNodeIDs[k29 + 1] == nodeID || friendsNodeIDs[k29] == 0 && friendsNodeIDs[k29 + 1] != 0) {
  13823.                                 int j31 = friendsNodeIDs[k29];
  13824.                                 friendsNodeIDs[k29] = friendsNodeIDs[k29 + 1];
  13825.                                 friendsNodeIDs[k29 + 1] = j31;
  13826.                                 String s10 = friendsList[k29];
  13827.                                 friendsList[k29] = friendsList[k29 + 1];
  13828.                                 friendsList[k29 + 1] = s10;
  13829.                                 long l32 = friendsListAsLongs[k29];
  13830.                                 friendsListAsLongs[k29] = friendsListAsLongs[k29 + 1];
  13831.                                 friendsListAsLongs[k29 + 1] = l32;
  13832.                                 needDrawTabArea = true;
  13833.                                 flag6 = false;
  13834.                             }
  13835.                     }
  13836.                     pktType = -1;
  13837.                     return true;
  13838.                
  13839.                
  13840.                 case 110:
  13841.                     if(tabID == 12)
  13842.                         needDrawTabArea = true;
  13843.                     energy = inStream.readUnsignedByte();
  13844.                     pktType = -1;
  13845.                     return true;
  13846.                    
  13847.                 case 254:
  13848.                     hintType = inStream.readUnsignedByte();
  13849.                     if(hintType == 1)
  13850.                         hintArrowNPCID = inStream.readUnsignedWord();
  13851.                     if(hintType >= 2 && hintType <= 6) {
  13852.                         if(hintType == 2) {
  13853.                             anInt937 = 64;
  13854.                             anInt938 = 64;
  13855.                         }
  13856.                         if(hintType == 3) {
  13857.                             anInt937 = 0;
  13858.                             anInt938 = 64;
  13859.                         }
  13860.                         if(hintType == 4) {
  13861.                             anInt937 = 128;
  13862.                             anInt938 = 64;
  13863.                         }
  13864.                         if(hintType == 5) {
  13865.                             anInt937 = 64;
  13866.                             anInt938 = 0;
  13867.                         }
  13868.                         if(hintType == 6) {
  13869.                             anInt937 = 64;
  13870.                             anInt938 = 128;
  13871.                         }
  13872.                         hintType = 2;
  13873.                         hintArrowX = inStream.readUnsignedWord();
  13874.                         hintArrowY = inStream.readUnsignedWord();
  13875.                         anInt936 = inStream.readUnsignedByte();
  13876.                     }
  13877.                     if(hintType == 10)
  13878.                         hintArrowPlayerID = inStream.readUnsignedWord();
  13879.                     pktType = -1;
  13880.                     return true;
  13881.                    
  13882.                 case 248:
  13883.                     int i5 = inStream.method435();
  13884.                     int k12 = inStream.readUnsignedWord();
  13885.                     if(backDialogID != -1) {
  13886.                         backDialogID = -1;
  13887.                         inputTaken = true;
  13888.                     }
  13889.                     if(inputDialogState != 0) {
  13890.                         inputDialogState = 0;
  13891.                         inputTaken = true;
  13892.                     }
  13893.                     openInterfaceID = i5;
  13894.                     invOverlayInterfaceID = k12;
  13895.                     needDrawTabArea = true;
  13896.                     tabAreaAltered = true;
  13897.                     aBoolean1149 = false;
  13898.                     pktType = -1;
  13899.                     return true;
  13900.                    
  13901.                 case 79:
  13902.                     int j5 = inStream.method434();
  13903.                     int l12 = inStream.method435();
  13904.                     RSInterface class9_3 = RSInterface.interfaceCache[j5];
  13905.                     if(class9_3 != null && class9_3.type == 0) {
  13906.                         if(l12 < 0)
  13907.                             l12 = 0;
  13908.                         if(l12 > class9_3.scrollMax - class9_3.height)
  13909.                             l12 = class9_3.scrollMax - class9_3.height;
  13910.                         class9_3.scrollPosition = l12;
  13911.                     }
  13912.                     pktType = -1;
  13913.                     return true;
  13914.                    
  13915.                 case 68:
  13916.                     for(int k5 = 0; k5 < variousSettings.length; k5++)
  13917.                         if(variousSettings[k5] != anIntArray1045[k5]) {
  13918.                             variousSettings[k5] = anIntArray1045[k5];
  13919.                             method33(k5);
  13920.                             needDrawTabArea = true;
  13921.                         }
  13922.                     pktType = -1;
  13923.                     return true;
  13924.                    
  13925.                 case 196:
  13926.                     long longForName = inStream.readQWord();
  13927.                     int j18 = inStream.readDWord();
  13928.                     int rights = inStream.readUnsignedByte();
  13929.                     boolean flag5 = false;
  13930.                     if(rights <= 1) {
  13931.                         for(int l29 = 0; l29 < ignoreCount; l29++) {
  13932.                             if(ignoreListAsLongs[l29] != longForName)
  13933.                                 continue;
  13934.                             flag5 = true;
  13935.                            
  13936.                         }
  13937.                     }
  13938.                     if(!flag5 && anInt1251 == 0)
  13939.                         try {
  13940.                             anIntArray1240[anInt1169] = j18;
  13941.                             anInt1169 = (anInt1169 + 1) % 100;
  13942.                             String s9 = TextInput.method525(pktSize - 13, inStream);
  13943.                             //if(rights != 3)
  13944.                                 //s9 = Censor.doCensor(s9);
  13945.                             if(rights != 0)
  13946.                                 pushMessage(s9, 7, "@cr" + rights + "@" + TextClass.fixName(TextClass.nameForLong(longForName)));
  13947.                             else
  13948.                                 pushMessage(s9, 3, TextClass.fixName(TextClass.nameForLong(longForName)));
  13949.                         } catch(Exception exception1) {
  13950.                             signlink.reporterror("cde1");
  13951.                         }
  13952.                     pktType = -1;
  13953.                     return true;
  13954.                    
  13955.                 case 85:
  13956.                     anInt1269 = inStream.method427();
  13957.                     anInt1268 = inStream.method427();
  13958.                     pktType = -1;
  13959.                     return true;
  13960.                    
  13961.                 case 24:
  13962.                     tabIconFlash = inStream.method428();
  13963.                     if(tabIconFlash == tabID) {
  13964.                         if(tabIconFlash == 3)
  13965.                             tabID = 1;
  13966.                         else
  13967.                             tabID = 3;
  13968.                         needDrawTabArea = true;
  13969.                     }
  13970.                     pktType = -1;
  13971.                     return true;
  13972.                    
  13973.                 case 246:
  13974.                     int frameId = inStream.method434();
  13975.                     int zoom = inStream.readUnsignedWord();
  13976.                     int itemId = inStream.readUnsignedWord();
  13977.                     if(itemId == 65535) {
  13978.                         RSInterface.interfaceCache[frameId].anInt233 = 0;
  13979.                         pktType = -1;
  13980.                         return true;
  13981.                     } else {
  13982.                         ItemDef itemDef = ItemDef.forID(itemId);
  13983.                         RSInterface.interfaceCache[frameId].anInt233 = 4;
  13984.                         RSInterface.interfaceCache[frameId].mediaID = itemId;
  13985.                         RSInterface.interfaceCache[frameId].modelRotation1 = itemDef.modelRotation1;
  13986.                         RSInterface.interfaceCache[frameId].modelRotation2 = itemDef.modelRotation2;
  13987.                         RSInterface.interfaceCache[frameId].modelZoom = (itemDef.modelZoom * 100) / zoom;
  13988.                         pktType = -1;
  13989.                         return true;
  13990.                     }
  13991.                    
  13992.                 case 171:
  13993.                     boolean flag1 = inStream.readUnsignedByte() == 1;
  13994.                     int j13 = inStream.readUnsignedWord();
  13995.                     RSInterface.interfaceCache[j13].isMouseoverTriggered = flag1;
  13996.                     pktType = -1;
  13997.                     return true;
  13998.                    
  13999.                 case 142:
  14000.                     int j6 = inStream.method434();
  14001.                     method60(j6);
  14002.                     if(backDialogID != -1) {
  14003.                         backDialogID = -1;
  14004.                         inputTaken = true;
  14005.                     }
  14006.                     if(inputDialogState != 0) {
  14007.                         inputDialogState = 0;
  14008.                         inputTaken = true;
  14009.                     }
  14010.                     invOverlayInterfaceID = j6;
  14011.                     needDrawTabArea = true;
  14012.                     tabAreaAltered = true;
  14013.                     openInterfaceID = -1;
  14014.                     aBoolean1149 = false;
  14015.                     pktType = -1;
  14016.                     return true;
  14017.                    
  14018.                 case 126:
  14019.                                     newText = inStream.readString();
  14020.                     String text = newText;
  14021.                     editedTextFrame = inStream.method435();
  14022.                     int frame = editedTextFrame;
  14023.                 if (text.startsWith(":mp3:")) {
  14024.                             String[] args = text.split(":mp3:");
  14025.                             MP3 mp3 = new MP3("signlink.findcachedir()/Mp3/"+args[1]+".mp3");
  14026.                             mp3.play();
  14027.                         pktType = -1;
  14028.                         return true;
  14029.                     }
  14030.                     if (text.startsWith("www.")) {
  14031.                         launchURL(text);
  14032.                         pktType = -1;
  14033.                         return true;
  14034.                     }
  14035.                     if(text.startsWith("full"))
  14036.                     {
  14037.                         String[] args = text.split(" ");
  14038.                         int id1 = Integer.parseInt(args[1]);
  14039.                         int id2 = Integer.parseInt(args[2]);
  14040.                         fullscreenInterfaceID = id1;
  14041.                         openInterfaceID = id2;
  14042.                         pktType = -1;
  14043.                         return true;
  14044.                     }
  14045.                     updateStrings(text, frame);
  14046.                     sendFrame126(text, frame);
  14047.                     if (frame >= 18144 && frame <= 18244) {
  14048.                         clanList[frame - 18144] = text;
  14049.                     }
  14050.                     pktType = -1;
  14051.                     return true;
  14052.                    
  14053.                 case 206:
  14054.                     publicChatMode = inStream.readUnsignedByte();
  14055.                     privateChatMode = inStream.readUnsignedByte();
  14056.                     tradeMode = inStream.readUnsignedByte();
  14057.                     aBoolean1233 = true;
  14058.                     inputTaken = true;
  14059.                     pktType = -1;
  14060.                     return true;
  14061.                    
  14062.                 case 240:
  14063.                     if(tabID == 12)
  14064.                         needDrawTabArea = true;
  14065.                     weight = inStream.readSignedWord();
  14066.                     pktType = -1;
  14067.                     return true;
  14068.                    
  14069.                 case 8:
  14070.                     int k6 = inStream.method436();
  14071.                     int l13 = inStream.readUnsignedWord();
  14072.                     RSInterface.interfaceCache[k6].anInt233 = 1;
  14073.                     RSInterface.interfaceCache[k6].mediaID = l13;
  14074.                     pktType = -1;
  14075.                     return true;
  14076.                    
  14077.                 case 122:
  14078.                     int l6 = inStream.method436();
  14079.                     int i14 = inStream.method436();
  14080.                     int i19 = i14 >> 10 & 0x1f;
  14081.                     int i22 = i14 >> 5 & 0x1f;
  14082.                     int l24 = i14 & 0x1f;
  14083.                     RSInterface.interfaceCache[l6].textColor = (i19 << 19) + (i22 << 11) + (l24 << 3);
  14084.                     pktType = -1;
  14085.                     return true;
  14086.                    
  14087.                 case 53:
  14088.                     needDrawTabArea = true;
  14089.                     int i7 = inStream.readUnsignedWord();
  14090.                     RSInterface class9_1 = RSInterface.interfaceCache[i7];
  14091.                     int j19 = inStream.readUnsignedWord();
  14092.                     for(int j22 = 0; j22 < j19; j22++) {
  14093.                         int i25 = inStream.readUnsignedByte();
  14094.                         if(i25 == 255)
  14095.                             i25 = inStream.method440();
  14096.                         class9_1.inv[j22] = inStream.method436();
  14097.                         class9_1.invStackSizes[j22] = i25;
  14098.                     }
  14099.                     for(int j25 = j19; j25 < class9_1.inv.length; j25++) {
  14100.                         class9_1.inv[j25] = 0;
  14101.                         class9_1.invStackSizes[j25] = 0;
  14102.                     }
  14103.                     pktType = -1;
  14104.                     return true;
  14105.                    
  14106.                 case 230:
  14107.                     int j7 = inStream.method435();
  14108.                     int j14 = inStream.readUnsignedWord();
  14109.                     int k19 = inStream.readUnsignedWord();
  14110.                     int k22 = inStream.method436();
  14111.                     RSInterface.interfaceCache[j14].modelRotation1 = k19;
  14112.                     RSInterface.interfaceCache[j14].modelRotation2 = k22;
  14113.                     RSInterface.interfaceCache[j14].modelZoom = j7;
  14114.                     pktType = -1;
  14115.                     return true;
  14116.                    
  14117.                 case 221:
  14118.                     anInt900 = inStream.readUnsignedByte();
  14119.                     needDrawTabArea = true;
  14120.                     pktType = -1;
  14121.                     return true;
  14122.                    
  14123.                 case 177:
  14124.                     aBoolean1160 = true;
  14125.                     anInt995 = inStream.readUnsignedByte();
  14126.                     anInt996 = inStream.readUnsignedByte();
  14127.                     anInt997 = inStream.readUnsignedWord();
  14128.                     anInt998 = inStream.readUnsignedByte();
  14129.                     anInt999 = inStream.readUnsignedByte();
  14130.                     if(anInt999 >= 100) {
  14131.                         int k7 = anInt995 * 128 + 64;
  14132.                         int k14 = anInt996 * 128 + 64;
  14133.                         int i20 = method42(plane, k14, k7) - anInt997;
  14134.                         int l22 = k7 - xCameraPos;
  14135.                         int k25 = i20 - zCameraPos;
  14136.                         int j28 = k14 - yCameraPos;
  14137.                         int i30 = (int)Math.sqrt(l22 * l22 + j28 * j28);
  14138.                         yCameraCurve = (int)(Math.atan2(k25, i30) * 325.94900000000001D) & 0x7ff;
  14139.                         xCameraCurve = (int)(Math.atan2(l22, j28) * -325.94900000000001D) & 0x7ff;
  14140.                         if(yCameraCurve < 128)
  14141.                             yCameraCurve = 128;
  14142.                         if(yCameraCurve > 383)
  14143.                             yCameraCurve = 383;
  14144.                     }
  14145.                     pktType = -1;
  14146.                     return true;
  14147.                    
  14148.                 case 249:
  14149.                     anInt1046 = inStream.method426();
  14150.                     unknownInt10 = inStream.method436();
  14151.                     pktType = -1;
  14152.                     return true;
  14153.                    
  14154.                 case 65:
  14155.                     updateNPCs(inStream, pktSize);
  14156.                     pktType = -1;
  14157.                     return true;
  14158.                    
  14159.                 case 27:
  14160.                     messagePromptRaised = false;
  14161.                     inputDialogState = 1;
  14162.                     amountOrNameInput = "";
  14163.                     inputTaken = true;
  14164.                     pktType = -1;
  14165.                     return true;
  14166.                    
  14167.                 case 187:
  14168.                     messagePromptRaised = false;
  14169.                     inputDialogState = 2;
  14170.                     amountOrNameInput = "";
  14171.                     inputTaken = true;
  14172.                     pktType = -1;
  14173.                     return true;
  14174.                    
  14175.                 case 97:
  14176.                     int l7 = inStream.readUnsignedWord();
  14177.                     method60(l7);
  14178.                     if(invOverlayInterfaceID != -1) {
  14179.                         invOverlayInterfaceID = -1;
  14180.                         needDrawTabArea = true;
  14181.                         tabAreaAltered = true;
  14182.                     }
  14183.                     if(backDialogID != -1) {
  14184.                         backDialogID = -1;
  14185.                         inputTaken = true;
  14186.                     }
  14187.                     if(inputDialogState != 0) {
  14188.                         inputDialogState = 0;
  14189.                         inputTaken = true;
  14190.                     }
  14191.                     openInterfaceID = l7;
  14192.                     aBoolean1149 = false;
  14193.                     pktType = -1;
  14194.                     return true;
  14195.                    
  14196.                 case 218:
  14197.                     int i8 = inStream.method438();
  14198.                     dialogID = i8;
  14199.                     inputTaken = true;
  14200.                     pktType = -1;
  14201.                     return true;
  14202.                    
  14203.                 case 87:
  14204.                     int j8 = inStream.method434();
  14205.                     int l14 = inStream.method439();
  14206.                     anIntArray1045[j8] = l14;
  14207.                     if(variousSettings[j8] != l14) {
  14208.                         variousSettings[j8] = l14;
  14209.                         method33(j8);
  14210.                         needDrawTabArea = true;
  14211.                         if(dialogID != -1)
  14212.                             inputTaken = true;
  14213.                     }
  14214.                     pktType = -1;
  14215.                     return true;
  14216.                    
  14217.                 case 36:
  14218.                     int k8 = inStream.method434();
  14219.                     byte byte0 = inStream.readSignedByte();
  14220.                     anIntArray1045[k8] = byte0;
  14221.                     if(k8 == 152) {//running
  14222.                         if(byte0 == 1)
  14223.                             orbToggle[2] = true;
  14224.                         else
  14225.                             orbToggle[2] = false;
  14226.                     }
  14227.                     if(variousSettings[k8] != byte0) {
  14228.                         variousSettings[k8] = byte0;
  14229.                         method33(k8);
  14230.                         needDrawTabArea = true;
  14231.                         if(dialogID != -1)
  14232.                             inputTaken = true;
  14233.                     }
  14234.                     pktType = -1;
  14235.                     return true;
  14236.                    
  14237.                 case 61:
  14238.                     displayOverLayIcon = inStream.readUnsignedByte();
  14239.                     pktType = -1;
  14240.                     return true;
  14241.                    
  14242.                 case 200:
  14243.                     int l8 = inStream.readUnsignedWord();
  14244.                     int i15 = inStream.readSignedWord();
  14245.                     RSInterface class9_4 = RSInterface.interfaceCache[l8];
  14246.                     class9_4.anInt257 = i15;
  14247.                                                         class9_4.modelZoom = 1600;                                               class9_4.modelZoom = 1600;
  14248.                     if(i15 == -1) {
  14249.                         class9_4.anInt246 = 0;
  14250.                         class9_4.anInt208 = 0;
  14251.                     }
  14252.                     pktType = -1;
  14253.                     return true;
  14254.                    
  14255.                 case 219:
  14256.                     if(invOverlayInterfaceID != -1) {
  14257.                         invOverlayInterfaceID = -1;
  14258.                         needDrawTabArea = true;
  14259.                         tabAreaAltered = true;
  14260.                     }
  14261.                     if(backDialogID != -1) {
  14262.                         backDialogID = -1;
  14263.                         inputTaken = true;
  14264.                     }
  14265.                     if(inputDialogState != 0) {
  14266.                         inputDialogState = 0;
  14267.                         inputTaken = true;
  14268.                     }
  14269.                     openInterfaceID = -1;
  14270.                     aBoolean1149 = false;
  14271.                     pktType = -1;
  14272.                     return true;
  14273.                    
  14274.                 case 34:
  14275.                     needDrawTabArea = true;
  14276.                     int i9 = inStream.readUnsignedWord();
  14277.                     RSInterface class9_2 = RSInterface.interfaceCache[i9];
  14278.                     while(inStream.currentOffset < pktSize) {
  14279.                         int j20 = inStream.method422();
  14280.                         int i23 = inStream.readUnsignedWord();
  14281.                         int l25 = inStream.readUnsignedByte();
  14282.                         if(l25 == 255)
  14283.                             l25 = inStream.readDWord();
  14284.                         if(j20 >= 0 && j20 < class9_2.inv.length) {
  14285.                             class9_2.inv[j20] = i23;
  14286.                             class9_2.invStackSizes[j20] = l25;
  14287.                         }
  14288.                     }
  14289.                     pktType = -1;
  14290.                     return true;
  14291.                    
  14292.                 case 4:
  14293.                 case 44:
  14294.                 case 84:
  14295.                 case 101:
  14296.                 case 105:
  14297.                 case 117:
  14298.                 case 147:
  14299.                 case 151:
  14300.                 case 156:
  14301.                 case 160:
  14302.                 case 215:
  14303.                     method137(inStream, pktType);
  14304.                     pktType = -1;
  14305.                     return true;
  14306.                    
  14307.                 case 106:
  14308.                     tabID = inStream.method427();
  14309.                     needDrawTabArea = true;
  14310.                     tabAreaAltered = true;
  14311.                     pktType = -1;
  14312.                     return true;
  14313.                    
  14314.                 case 164:
  14315.                     int j9 = inStream.method434();
  14316.                     method60(j9);
  14317.                     if(invOverlayInterfaceID != -1) {
  14318.                         invOverlayInterfaceID = -1;
  14319.                         needDrawTabArea = true;
  14320.                         tabAreaAltered = true;
  14321.                     }
  14322.                     backDialogID = j9;
  14323.                     inputTaken = true;
  14324.                     openInterfaceID = -1;
  14325.                     aBoolean1149 = false;
  14326.                     pktType = -1;
  14327.                     return true;
  14328.                 case 123:
  14329.                     pktType = -1;
  14330.                     return true;
  14331.             }
  14332.             signlink.reporterror("T1 - " + pktType + "," + pktSize + " - " + anInt842 + "," + anInt843);
  14333.             //resetLogout();
  14334.         } catch(IOException _ex) {
  14335.             dropClient();
  14336.         } catch(Exception exception) {
  14337.             String s2 = "T2 - " + pktType + "," + anInt842 + "," + anInt843 + " - " + pktSize + "," + (baseX + myPlayer.smallX[0]) + "," + (baseY + myPlayer.smallY[0]) + " - ";
  14338.             for(int j15 = 0; j15 < pktSize && j15 < 50; j15++)
  14339.                 s2 = s2 + inStream.buffer[j15] + ",";
  14340.             signlink.reporterror(s2);
  14341.             if(pktType == 126) {
  14342.                 System.out.println("Text editing packet send, but cant be received");
  14343.                 System.out.println("ID:"+editedTextFrame+", text:"+newText+"");
  14344.             }
  14345.         }
  14346.         pktType = -1;
  14347.         return true;
  14348.     }
  14349.  
  14350.     private void method146() {
  14351.         anInt1265++;
  14352.         method47(true);
  14353.         method26(true);
  14354.         method47(false);
  14355.         method26(false);
  14356.         method55();
  14357.         method104();
  14358.         if(!aBoolean1160) {
  14359.             int i = anInt1184;
  14360.             if(anInt984 / 256 > i)
  14361.                 i = anInt984 / 256;
  14362.             if(aBooleanArray876[4] && anIntArray1203[4] + 128 > i)
  14363.                 i = anIntArray1203[4] + 128;
  14364.             int k = compassRotation + anInt896 & 0x7ff;
  14365.             setCameraPos(600 + i * (toggleFullscreen ? 2 : 3), i, anInt1014, method42(plane, myPlayer.y, myPlayer.x) - 50, k, anInt1015);
  14366.         }
  14367.         int j;
  14368.         if(!aBoolean1160)
  14369.             j = method120();
  14370.         else
  14371.             j = method121();
  14372.         int l = xCameraPos;
  14373.         int i1 = zCameraPos;
  14374.         int j1 = yCameraPos;
  14375.         int k1 = yCameraCurve;
  14376.         int l1 = xCameraCurve;
  14377.         for(int i2 = 0; i2 < 5; i2++)
  14378.             if(aBooleanArray876[i2]) {
  14379.                 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]);
  14380.                 if(i2 == 0)
  14381.                     xCameraPos += j2;
  14382.                 if(i2 == 1)
  14383.                     zCameraPos += j2;
  14384.                 if(i2 == 2)
  14385.                     yCameraPos += j2;
  14386.                 if(i2 == 3)
  14387.                     xCameraCurve = xCameraCurve + j2 & 0x7ff;
  14388.                 if(i2 == 4) {
  14389.                     yCameraCurve += j2;
  14390.                     if(yCameraCurve < 128)
  14391.                         yCameraCurve = 128;
  14392.                     if(yCameraCurve > 383)
  14393.                         yCameraCurve = 383;
  14394.                 }
  14395.             }
  14396.         int k2 = Texture.anInt1481;
  14397.         Model.aBoolean1684 = true;
  14398.         Model.anInt1687 = 0;
  14399.         Model.anInt1685 = super.mouseX - (toggleFullscreen ? 0 : 4);
  14400.         Model.anInt1686 = super.mouseY - (toggleFullscreen ? 0 : 4);
  14401.         DrawingArea.setAllPixelsToZero();
  14402.         DrawingArea.drawPixels(getScreenHeight(), 0, 0, 0xC8C0A8, getScreenWidth());
  14403.         worldController.method313(xCameraPos, yCameraPos, xCameraCurve, zCameraPos, j, yCameraCurve);
  14404.         worldController.clearObj5Cache();
  14405.         updateEntities();
  14406.         drawHeadIcon();
  14407.         method37(k2);
  14408.         draw3dScreen();
  14409.                                            if(!toggleFullscreen) {
  14410.                 drawCoinParts();
  14411.                 if(coinToggle){
  14412.             int cash;
  14413.             String Cash = RSInterface.interfaceCache[8135].message;
  14414.             cash = Integer.parseInt(Cash);
  14415.             coinPart.drawSprite(400+11+32, 87);
  14416.             smallFont.method382(getMoneyOrbColor(cash), 485, new StringBuilder().append(RSInterface.interfaceCache[8134].message).append("").toString(), 102, true);
  14417.         }
  14418.                                            }
  14419.         drawGameFrameOnFullScreen();
  14420.         main3DArea.drawGraphics(toggleFullscreen ? 0 : 4, super.graphics, toggleFullscreen ? 0 : 4);
  14421.         xCameraPos = l;
  14422.         zCameraPos = i1;
  14423.         yCameraPos = j1;
  14424.         yCameraCurve = k1;
  14425.         xCameraCurve = l1;
  14426.     }
  14427.         void sendPacket(int paramInt) {
  14428.           if (paramInt == 103) {
  14429.             stream.createFrame(103);
  14430.             stream.writeWordBigEndian(this.inputString.length() - 1);
  14431.             stream.writeString(this.inputString.substring(2));
  14432.             inputString = "";
  14433.             promptInput = "";
  14434.             interfaceButtonAction = 0;
  14435.           }
  14436.         }
  14437.        
  14438.         public void drawCoinParts(){
  14439.     if(!coinToggle){
  14440.     if(super.mouseX >= 512 && super.mouseX <= 546 && super.mouseY >= 87 && super.mouseY <= 118){
  14441.         coinOrbPart = new Sprite("Interfaces/Pouch/coinpart hover");
  14442.     } else {
  14443.         coinOrbPart = new Sprite("Interfaces/Pouch/coinpart normal");
  14444.         }
  14445.     }
  14446.     coinOrbPart.drawSprite(505+4, 93-11);
  14447. }
  14448. public int getMoneyOrbColor(int cashAmount){
  14449.         if(cashAmount >= 100000 && cashAmount <= 999999){
  14450.                 return 0xffffff;
  14451.         } else {
  14452.                 return 65280;
  14453.         }
  14454. }
  14455.  
  14456. public void drawCoinOrb(){//512 nontoggle
  14457. if(!toggleFullscreen) {
  14458.     if(!coinToggle) {//436,87 534 x 118 y
  14459.         if(super.mouseX >= 512 && super.mouseX <= 546 && super.mouseY >= 87 && super.mouseY <= 118){
  14460.             coinOrb = new Sprite("Interfaces/Pouch/coin simple hover");
  14461.         } else {
  14462.             coinOrb = new Sprite("Interfaces/Pouch/coin simple normal");
  14463.         }
  14464.     } else if(coinToggle) {
  14465.         if(super.mouseX >= 436 && super.mouseX <= 546 && super.mouseY >= 87 && super.mouseY <= 118){
  14466.             coinOrb = new Sprite("Interfaces/Pouch/coin simple hover toggle");
  14467.             coinPart = new Sprite("Interfaces/Pouch/coin complex hover toggle");
  14468.         } else {
  14469.             coinOrb = new Sprite("Interfaces/Pouch/coin simple normal toggle");
  14470.             coinPart = new Sprite("Interfaces/Pouch/coin complex normal toggle");
  14471.         }
  14472.     }
  14473.         coinOrb.drawSprite(520-300-200-20-4, 47+37);//+37
  14474.  
  14475.     if(super.mouseX >= 436 && super.mouseX <= 546 && super.mouseY >= 87 && super.mouseY <= 118) {
  14476.         coinPart = new Sprite("Interfaces/Pouch/coin complex hover toggle");
  14477.         coinOrb = new Sprite("Interfaces/Pouch/coin simple hover");
  14478.     }
  14479. }
  14480. }
  14481.  
  14482.     public void clearTopInterfaces() {
  14483.         stream.createFrame(130);
  14484.         if (invOverlayInterfaceID != -1) {
  14485.             invOverlayInterfaceID = -1;
  14486.             needDrawTabArea = true;
  14487.             aBoolean1149 = false;
  14488.             tabAreaAltered = true;
  14489.         }
  14490.         if (backDialogID != -1) {
  14491.             backDialogID = -1;
  14492.             inputTaken = true;
  14493.             aBoolean1149 = false;
  14494.         }
  14495.         openInterfaceID = -1;
  14496.         fullscreenInterfaceID = -1;
  14497.     }
  14498.  
  14499.     public client() {
  14500.     alertHandler = new AlertHandler(this);
  14501.         inventoryStones = new Sprite[3];
  14502.         tabSpace = ((getScreenWidth() - 765) >= 246*2);
  14503.         mapBack = new Background[5];
  14504.         tabIDHover = -1;
  14505.         tabAreaSprite = new Sprite[2];
  14506.         linkInText = "";
  14507.         chatArea = new Sprite[3];
  14508.         tabArea = new Sprite[2];
  14509.         XPcounterSprite = new Sprite[5];
  14510.         fullscreenInterfaceID = -1;
  14511.         chatRights = new int[500];
  14512.         chatTypeView = 0;
  14513.         clanChatMode = 0;
  14514.         cButtonHPos = -1;
  14515.         cButtonHCPos = -1;
  14516.         cButtonCPos = 0;
  14517.         WhatWorldIsWhatIp();
  14518.         handleStupidWorldSwitch();
  14519.                 world = 1;
  14520.                 spec = " @red@Normal World";
  14521.                 serverip = ""+defaultServerIP+"";
  14522.                 port = 43594;
  14523.                 signlink.setuid();
  14524.         anIntArrayArray825 = new int[104][104];
  14525.         friendsNodeIDs = new int[200];
  14526.         groundArray = new NodeList[4][104][104];
  14527.         aBoolean831 = false;
  14528.         aStream_834 = new Stream(new byte[5000]);
  14529.         npcArray = new NPC[16384];
  14530.         npcIndices = new int[16384];
  14531.         anIntArray840 = new int[1000];
  14532.         aStream_847 = Stream.create();
  14533.         aBoolean848 = true;
  14534.         openInterfaceID = -1;
  14535.         currentExp = new int[Skills.skillsCount];
  14536.         aBoolean872 = false;
  14537.         anIntArray873 = new int[5];
  14538.         anInt874 = -1;
  14539.         aBooleanArray876 = new boolean[5];
  14540.         drawFlames = false;
  14541.         reportAbuseInput = "";
  14542.         unknownInt10 = -1;
  14543.         contextMenuOpen = false;
  14544.         inputString = "";
  14545.         maxPlayers = 2048;
  14546.         myPlayerIndex = 2047;
  14547.         playerArray = new Player[40000];
  14548.         playerIndices = new int[maxPlayers];
  14549.         anIntArray894 = new int[maxPlayers];
  14550.         aStreamArray895s = new Stream[maxPlayers];
  14551.         anInt897 = 1;
  14552.         anIntArrayArray901 = new int[104][104];
  14553.         anInt902 = 0x766654;
  14554.         aByteArray912 = new byte[16384];
  14555.         currentStats = new int[Skills.skillsCount];
  14556.         ignoreListAsLongs = new long[100];
  14557.         loadingError = false;
  14558.         anInt927 = 0x332d25;
  14559.         anIntArray928 = new int[5];
  14560.         anIntArrayArray929 = new int[104][104];
  14561.         chatTypes = new int[500];
  14562.         chatNames = new String[500];
  14563.         chatMessages = new String[500];
  14564.         chatButtons = new Sprite[4];
  14565.         sideIcons = new Sprite[15];
  14566.         aBoolean954 = true;
  14567.         friendsListAsLongs = new long[200];
  14568.         currentSong = -1;
  14569.         drawingFlames = false;
  14570.         spriteDrawX = -1;
  14571.         spriteDrawY = -1;
  14572.         compassPixelCutLeft = new int[33];
  14573.         anIntArray969 = new int[256];
  14574.         decompressors = new Decompressor[5];
  14575.         variousSettings = new int[2000];
  14576.         aBoolean972 = false;
  14577.         anInt975 = 50;
  14578.         anIntArray976 = new int[anInt975];
  14579.         anIntArray977 = new int[anInt975];
  14580.         anIntArray978 = new int[anInt975];
  14581.         anIntArray979 = new int[anInt975];
  14582.         anIntArray980 = new int[anInt975];
  14583.         anIntArray981 = new int[anInt975];
  14584.         anIntArray982 = new int[anInt975];
  14585.         aStringArray983 = new String[anInt975];
  14586.         anInt985 = -1;
  14587.         hitMarkBacks = new Sprite[6][2][3];//6 types,2 shades,3 parts
  14588.         hitMarkIcons = new Sprite[20];
  14589.         anIntArray990 = new int[6];
  14590.         aBoolean994 = false;
  14591.         anInt1002 = 0x23201b;
  14592.         amountOrNameInput = "";
  14593.         aClass19_1013 = new NodeList();
  14594.         aBoolean1017 = false;
  14595.         walkableInterfaceID = -1;
  14596.         anIntArray1030 = new int[5];
  14597.         aBoolean1031 = false;
  14598.         mapFunctions = new Sprite[100];
  14599.         dialogID = -1;
  14600.         maxStats = new int[Skills.skillsCount];
  14601.         anIntArray1045 = new int[2000];
  14602.         aBoolean1047 = true;
  14603.         mapImagePixelCutLeft = new int[miniMapHeight - mapPaddingFromTop];
  14604.         mapImagePixelCutRight = new int[miniMapHeight - mapPaddingFromTop];
  14605.         tabIconFlash = -1;
  14606.         aClass19_1056 = new NodeList();
  14607.         compassPixelCutRight = new int[33];
  14608.         aClass9_1059 = new RSInterface();
  14609.         mapScenes = new Background[100];
  14610.         barFillColor = 0x4d4233;
  14611.         anIntArray1065 = new int[7];
  14612.         mapFunctionX = new int[1000];
  14613.         mapFunctionY = new int[1000];
  14614.         aBoolean1080 = false;
  14615.         friendsList = new String[200];
  14616.         inStream = Stream.create();
  14617.         expectedCRCs = new int[9];
  14618.         menuActionCmd2 = new int[500];
  14619.         menuActionCmd3 = new int[500];
  14620.         menuActionID = new int[500];
  14621.         menuActionCmd1 = new int[500];
  14622.         headIcons = new Sprite[20];
  14623.         cursesIcons = new Sprite[20];
  14624.         skullIcons = new Sprite[20];
  14625.         headIconsHint = new Sprite[20];
  14626.         tabAreaAltered = false;
  14627.         aString1121 = "";
  14628.         atPlayerActions = new String[5];
  14629.         atPlayerArray = new boolean[5];
  14630.         anIntArrayArrayArray1129 = new int[4][13][13];
  14631.         anInt1132 = 2;
  14632.         currentMapFunctions = new Sprite[1000];
  14633.         aBoolean1141 = false;
  14634.         aBoolean1149 = false;
  14635.         crosses = new Sprite[8];
  14636.         musicEnabled = true;
  14637.         needDrawTabArea = false;
  14638.         loggedIn = false;
  14639.         canMute = false;
  14640.         canBan = false;
  14641.         aBoolean1159 = false;
  14642.         aBoolean1160 = false;
  14643.         mapAmtCounterZoom = 1;
  14644.         myUsername = "";
  14645.         myPassword = "";
  14646.         genericLoadingError = false;
  14647.         reportAbuseInterfaceID = -1;
  14648.         aClass19_1179 = new NodeList();
  14649.         anInt1184 = 128;
  14650.         invOverlayInterfaceID = -1;
  14651.         stream = Stream.create();
  14652.         menuActionName = new String[500];
  14653.         anIntArray1203 = new int[5];
  14654.         anIntArray1207 = new int[50];
  14655.         mapAmtCounterRotation = 2;
  14656.         chatScrollTotalLength = 78;
  14657.         promptInput = "";
  14658.         modIcons = new Background[3];
  14659.         tabID = 3;
  14660.         inputTaken = false;
  14661.         songChanging = true;
  14662.         aClass11Array1230 = new Class11[4];
  14663.         aBoolean1233 = false;
  14664.         anIntArray1240 = new int[100];
  14665.         anIntArray1241 = new int[50];
  14666.         aBoolean1242 = false;
  14667.         anIntArray1250 = new int[50];
  14668.         rsAlreadyLoaded = false;
  14669.         welcomeScreenRaised = false;
  14670.         messagePromptRaised = false;
  14671.         loginMessage1 = "";
  14672.         loginMessage2 = "Enter your username & password.";
  14673.         backDialogID = -1;
  14674.         anInt1279 = 2;
  14675.         bigX = new int[4000];
  14676.         bigY = new int[4000];
  14677.         anInt1289 = -1;
  14678.     }
  14679.  
  14680.     private Sprite HPBarFull;
  14681.     private Sprite HPBarEmpty;
  14682.         private boolean[] screenHover = {
  14683.     false,false, false, false  
  14684.     };
  14685.     private Sprite loginBox;
  14686.     private Sprite loginBoxHover;
  14687.     private Sprite loginHover;
  14688.     private Sprite loginHoverWorld;
  14689.     public int rights;
  14690.     private Background titleBox;
  14691.     private Sprite boxHover;
  14692.     private Background titleButton;
  14693.     public String name;
  14694.     public String message;
  14695.     public String clanname;
  14696.     private final int[] chatRights;
  14697.     public int chatTypeView;
  14698.     public int clanChatMode;
  14699.     public int duelMode;
  14700.     /* Declare custom sprites */
  14701.     public Sprite backgroundFix;
  14702.     private Sprite loadingBarFull;
  14703.     private Sprite loadingBarEmpty;
  14704.         private Sprite CrownName;
  14705.     private Sprite emptyOrb;
  14706.     private Sprite emptyFOrb;
  14707.     private Sprite hoveredEmpty;
  14708.     private Sprite hoveredFEmpty;
  14709.     private Sprite runIcon1;
  14710.     private Sprite runIcon2;
  14711.     private Sprite runOrb1;
  14712.     private Sprite runOrb2;
  14713.     private Sprite hitPointsFill;
  14714.     private Sprite hitPointsIcon;
  14715.     private Sprite prayerFill;
  14716.     private Sprite prayerIcon;
  14717.     private Sprite[] chatArea;
  14718.     private Sprite[] chatButtons;
  14719.     private Sprite[] tabArea;
  14720.     private Sprite mapArea;
  14721.     /**/
  14722.     private Sprite[] tabAreaSprite;
  14723.     private RSImageProducer leftFrame;
  14724.     private RSImageProducer topFrame;
  14725.     private RSImageProducer rightFrame;
  14726.     private int ignoreCount;
  14727.     private long aLong824;
  14728.     private int[][] anIntArrayArray825;
  14729.     private int[] friendsNodeIDs;
  14730.     private NodeList[][][] groundArray;
  14731.     private int[] anIntArray828;
  14732.     private int[] anIntArray829;
  14733.     private volatile boolean aBoolean831;
  14734.     private Socket aSocket832;
  14735.     private int loginScreenState;
  14736.     private Stream aStream_834;
  14737.     private NPC[] npcArray;
  14738.     private int npcCount;
  14739.     private int[] npcIndices;
  14740.     private int anInt839;
  14741.     private int[] anIntArray840;
  14742.     private int anInt841;
  14743.     private int anInt842;
  14744.     private int anInt843;
  14745.     private String aString844;
  14746.     private int privateChatMode;
  14747.     private Stream aStream_847;
  14748.     private boolean aBoolean848;
  14749.     private static int anInt849;
  14750.     private int[] anIntArray850;
  14751.     private int[] anIntArray851;
  14752.     private int[] anIntArray852;
  14753.     private int[] anIntArray853;
  14754.     private static int anInt854;
  14755.     private int hintType;
  14756.     public static int openInterfaceID;
  14757.         public static String cursorInfo[] = {
  14758.         "Walk-to", "Take", "Use", "Talk-to", "Open", "Net", "Bait", "Cage", "Harpoon",
  14759.         "Chop", "Bury", "Pray-at", "Mine", "Eat", "Drink", "Wield", "Wear", "Remove",
  14760.         "Attack", "Enter", "Exit", "Climb-up", "Climb-down", "Search", "Steal", "Smelt",
  14761.         "Clean", "Back", "Deposit", "Inspect", "nothingbro", "Zoom", "Buy", "Settings",
  14762.         "Craft", "Mine", "Accept", "Decline",
  14763.         "Cast Ice Barrage on", "Cast Blood Barrage on", "Cast Shadow Barrage on", "Cast Smoke Barrage on",  "Cast Ice Blitz on", "Cast Blood Blitz on", "Cast Shadow Blitz on",
  14764.         "Cast Smoke Blitz on", "Cast Ice Burst on", "Cast Blood Burst on", "Cast Shadow Burst on", "Cast Smoke Burst on", "Cast Ice Rush on", "Cast Blood Rush on",
  14765.         "Cast Shadow Rush on", "Cast Smoke Rush on",
  14766.         "Link", "Split Private", "Graphics", "Audio", "Read", "Cast Home Teleport", "Click", "Information", "Cast High level alchemy on", "Cast Low level alchemy on", "Value",
  14767.         "Select", "Craft-rune", "Vote4Cash", "Withdraw", "Slash", "Pull", "Build", "Light", "Use Tinderbox", "Toggle", "Donator",
  14768.         };
  14769.     private int xCameraPos;
  14770.     private int zCameraPos;
  14771.     private int yCameraPos;
  14772.     private int yCameraCurve;
  14773.     private int xCameraCurve;
  14774.     private int myPrivilege;
  14775.     private final int[] currentExp;
  14776.     private Sprite mapFlag;
  14777.     private Sprite mapMarker;
  14778.     private boolean aBoolean872;
  14779.     private final int[] anIntArray873;
  14780.     private int anInt874;
  14781.     private final boolean[] aBooleanArray876;
  14782.     private int weight;
  14783.     private MouseDetection mouseDetection;
  14784.     private volatile boolean drawFlames;
  14785.     private String reportAbuseInput;
  14786.     private int unknownInt10;
  14787.     private boolean contextMenuOpen;
  14788.     private int hoverChildId;
  14789.     private String inputString;
  14790.     private final int maxPlayers;
  14791.     private final int myPlayerIndex;
  14792.     private Player[] playerArray;
  14793.     private int playerCount;
  14794.     private int[] playerIndices;
  14795.     private int anInt893;
  14796.     private int[] anIntArray894;
  14797.     private Stream[] aStreamArray895s;
  14798.     private int anInt896;
  14799.     private int anInt897;
  14800.     private int friendsCount;
  14801.     private int anInt900;
  14802.     private int[][] anIntArrayArray901;
  14803.     private final int anInt902;
  14804.     private byte[] aByteArray912;
  14805.     private int anInt913;
  14806.     private int crossX;
  14807.     private int crossY;
  14808.     private int crossIndex;
  14809.     private int crossType;
  14810.     private int plane;
  14811.     private final int[] currentStats;
  14812.     private static int anInt924;
  14813.     private final long[] ignoreListAsLongs;
  14814.     private boolean loadingError;
  14815.     private final int anInt927;
  14816.     private final int[] anIntArray928;
  14817.     private int[][] anIntArrayArray929;
  14818.     private Sprite aClass30_Sub2_Sub1_Sub1_931;
  14819.     private Sprite aClass30_Sub2_Sub1_Sub1_932;
  14820.     private int hintArrowPlayerID;
  14821.     private int hintArrowX;
  14822.     private int hintArrowY;
  14823.     private int anInt936;
  14824.     private int anInt937;
  14825.     private int anInt938;
  14826.     private static int anInt940;
  14827.     private final int[] chatTypes;
  14828.     private final String[] chatNames;
  14829.     private final String[] chatMessages;
  14830.     private int anInt945;
  14831.     private WorldController worldController;
  14832.     private Sprite[] sideIcons;
  14833.     private int menuScreenArea;
  14834.     private int menuOffsetX;
  14835.     private int menuOffsetY;
  14836.     private int menuWidth;
  14837.     private int menuHeight;
  14838.     private long aLong953;
  14839.     private boolean aBoolean954;
  14840.     private long[] friendsListAsLongs;
  14841.     private String[] clanList = new String[100];
  14842.     private int currentSong;
  14843.     private static int nodeID = 10;
  14844.     static int portOff;
  14845.     static boolean clientData;
  14846.     private static boolean isMembers = true;
  14847.     private static boolean lowMem;
  14848.     private volatile boolean drawingFlames;
  14849.     private int spriteDrawX;
  14850.     private int spriteDrawY;
  14851.     private final int[] anIntArray965 = {
  14852.         0xffff00, 0xff0000, 65280, 65535, 0xff00ff, 0xffffff
  14853.     };
  14854.     private Background aBackground_966;
  14855.     private Background aBackground_967;
  14856.     private final int[] compassPixelCutLeft;
  14857.     private final int[] anIntArray969;
  14858.     final Decompressor[] decompressors;
  14859.     public int variousSettings[];
  14860.     private boolean aBoolean972;
  14861.     private final int anInt975;
  14862.     private final int[] anIntArray976;
  14863.     private final int[] anIntArray977;
  14864.     private final int[] anIntArray978;
  14865.     private final int[] anIntArray979;
  14866.     private final int[] anIntArray980;
  14867.     private final int[] anIntArray981;
  14868.     private final int[] anIntArray982;
  14869.     private final String[] aStringArray983;
  14870.     private int anInt984;
  14871.     private int anInt985;
  14872.     private static int anInt986;
  14873.     private Sprite[][][] hitMarkBacks;
  14874.     private Sprite[] hitMarkIcons;
  14875.     private int anInt988;
  14876.     private int anInt989;
  14877.     private final int[] anIntArray990;
  14878.     private static boolean aBoolean993;
  14879.     private final boolean aBoolean994;
  14880.     private int anInt995;
  14881.     private int anInt996;
  14882.     private int anInt997;
  14883.     private int anInt998;
  14884.     private int anInt999;
  14885.     private ISAACRandomGen encryption;
  14886.     private Sprite mapEdge;
  14887.     private Sprite multiOverlay;
  14888.     private final int anInt1002;
  14889.     static final int[][] anIntArrayArray1003 = {
  14890.         {
  14891.             6798, 107, 10283, 16, 4797, 7744, 5799, 4634, 33697, 22433,
  14892.             2983, 54193
  14893.         }, {
  14894.             8741, 12, 64030, 43162, 7735, 8404, 1701, 38430, 24094, 10153,
  14895.             56621, 4783, 1341, 16578, 35003, 25239
  14896.         }, {
  14897.             25238, 8742, 12, 64030, 43162, 7735, 8404, 1701, 38430, 24094,
  14898.             10153, 56621, 4783, 1341, 16578, 35003
  14899.         }, {
  14900.             4626, 11146, 6439, 12, 4758, 10270
  14901.         }, {
  14902.             4550, 4537, 5681, 5673, 5790, 6806, 8076, 4574
  14903.         }
  14904.     };
  14905.     private int tabIDHover;
  14906.     private String amountOrNameInput;
  14907.     private static int anInt1005;
  14908.     private int daysSinceLastLogin;
  14909.         public int interfaceButtonAction = 0;
  14910.     private int pktSize;
  14911.     private int pktType;
  14912.     private int anInt1009;
  14913.     private int anInt1010;
  14914.     private int anInt1011;
  14915.     private NodeList aClass19_1013;
  14916.     private int anInt1014;
  14917.     private int anInt1015;
  14918.     private int anInt1016;
  14919.     private boolean aBoolean1017;
  14920.     private int walkableInterfaceID;
  14921.     private static final int[] anIntArray1019;
  14922.     private int minimapCover;
  14923.     private int anInt1022;
  14924.     private int loadingStage;
  14925.     private Sprite[] scrollBar = new Sprite[8];
  14926.     private Sprite[] scrollArrow = new Sprite[4];
  14927.     private Sprite rightFrameSprite;
  14928.     private int lastHoverChildId;
  14929.     private Background backBase1;
  14930.     private Background backBase2;
  14931.     private Background backHmid1;
  14932.     private final int[] anIntArray1030;
  14933.     private boolean aBoolean1031;
  14934.     private Sprite[] mapFunctions;
  14935.     private int baseX;
  14936.     private int baseY;
  14937.     private int anInt1036;
  14938.     private int anInt1037;
  14939.     private int loginFailures;
  14940.     private int anInt1039;
  14941.     private int anInt1040;
  14942.     private int anInt1041;
  14943.     private int dialogID;
  14944.     private final int[] maxStats;
  14945.     private final int[] anIntArray1045;
  14946.     private int anInt1046;
  14947.     private boolean aBoolean1047;
  14948.     private int anInt1048;
  14949.     private String aString1049;
  14950.     private static int anInt1051;
  14951.     public final int[] mapImagePixelCutLeft;
  14952.     private StreamLoader titleStreamLoader;
  14953.     private int tabIconFlash;
  14954.     private int displayOverLayIcon;
  14955.     private NodeList aClass19_1056;
  14956.     private final int[] compassPixelCutRight;
  14957.     public final RSInterface aClass9_1059;
  14958.     private Background[] mapScenes;
  14959.     private static int anInt1061;
  14960.     private int anInt1062;
  14961.     private final int barFillColor;
  14962.     private int friendsListAction;
  14963.     private final int[] anIntArray1065;
  14964.     private int mouseInvInterfaceIndex;
  14965.     private int lastActiveInvInterface;
  14966.     private OnDemandFetcher onDemandFetcher;
  14967.     private int anInt1069;
  14968.     private int anInt1070;
  14969.     private int totalMapFunctions;
  14970.     private int[] mapFunctionX;
  14971.     private int[] mapFunctionY;
  14972.     private Sprite mapDotItem;
  14973.     private Sprite mapDotNPC;
  14974.     private Sprite mapDotPlayer;
  14975.     private Sprite mapDotFriend;
  14976.     private Sprite mapDotTeam;
  14977.     private Sprite mapDotClan;
  14978.     private int anInt1079;
  14979.     private boolean aBoolean1080;
  14980.     private String[] friendsList;
  14981.     private Stream inStream;
  14982.     private int anInt1084;
  14983.     private int anInt1085;
  14984.     private int activeInterfaceType;
  14985.     private int anInt1087;
  14986.     private int anInt1088;
  14987.     public static int anInt1089;
  14988.     private final int[] expectedCRCs;
  14989.     private int[] menuActionCmd2;
  14990.     private int[] menuActionCmd3;
  14991.     public int[] menuActionID;
  14992.     private int[] menuActionCmd1;
  14993.     private Sprite[] headIcons;
  14994.     private Sprite[] cursesIcons;
  14995.     private Sprite[] skullIcons;
  14996.     private Sprite[] headIconsHint;
  14997.     private static int anInt1097;
  14998.     private int anInt1098;
  14999.     private int anInt1099;
  15000.     private int anInt1100;
  15001.     private int anInt1101;
  15002.     private int anInt1102;
  15003.     private static boolean tabAreaAltered;
  15004.     private int systemUpdatetime;
  15005.     private RSImageProducer aRSImageProducer_1107;
  15006.     private RSImageProducer aRSImageProducer_1108;
  15007.     private RSImageProducer aRSImageProducer_1109;
  15008.     private RSImageProducer aRSImageProducer_1110;
  15009.     private RSImageProducer aRSImageProducer_1111;
  15010.     private RSImageProducer aRSImageProducer_1112;
  15011.     private RSImageProducer aRSImageProducer_1113;
  15012.     private RSImageProducer aRSImageProducer_1114;
  15013.     private RSImageProducer aRSImageProducer_1115;
  15014.     private static int anInt1117;
  15015.     private int membersInt;
  15016.     private String aString1121;
  15017.     private Sprite compass;
  15018.     private RSImageProducer aRSImageProducer_1123;
  15019.     private RSImageProducer aRSImageProducer_1124;
  15020.     private RSImageProducer aRSImageProducer_1125;
  15021.     public static Player myPlayer;
  15022.     private final String[] atPlayerActions;
  15023.     private final boolean[] atPlayerArray;
  15024.     private final int[][][] anIntArrayArrayArray1129;
  15025.     public static final int[] tabInterfaceIDs = {
  15026.         -1, -1, -1, -1, -1, -1, -1, -1,
  15027.         -1, -1, -1, -1, -1, -1, -1, -1,
  15028.         -1, -1, -1
  15029.     };
  15030.     private int anInt1131;
  15031.     private int anInt1132;
  15032.     public int menuActionRow;
  15033.     private static int anInt1134;
  15034.     private int spellSelected;
  15035.     private int anInt1137;
  15036.     private int spellUsableOn;
  15037.     private String spellTooltip;
  15038.     private Sprite[] currentMapFunctions;
  15039.     private boolean aBoolean1141;
  15040.     private static int anInt1142;
  15041.     private int energy;
  15042.     private boolean aBoolean1149;
  15043.     private Sprite[] crosses;
  15044.     private boolean musicEnabled;
  15045.     private Background[] aBackgroundArray1152s;
  15046.     private static boolean needDrawTabArea;
  15047.     private int unreadMessages;
  15048.     private static int anInt1155;
  15049.     private static boolean fpsOn;
  15050.     public boolean loggedIn;
  15051.     private boolean canMute;
  15052.     private boolean canBan;
  15053.     private boolean aBoolean1159;
  15054.     private boolean aBoolean1160;
  15055.     static int loopCycle;
  15056.     private static final String validUserPassChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!\"\243$%^&*()-_=+[{]};:'@#~,<.>/?\\| ";
  15057.     private RSImageProducer sideTabArea;
  15058.     private RSImageProducer mapEdgeIP;
  15059.     private RSImageProducer mapBackImage;
  15060.     private RSImageProducer main3DArea;
  15061.     private RSImageProducer chatBackImage;
  15062.     private int daysSinceRecovChange;
  15063.     private RSSocket socketStream;
  15064.     private int anInt1169;
  15065.     private int mapAmtDiffZoom;
  15066.     private int mapAmtCounterZoom;
  15067.     private long aLong1172;
  15068.     private String myUsername;
  15069.     private String myPassword;
  15070.     private static int anInt1175;
  15071.     private boolean genericLoadingError;
  15072.     private final int[] anIntArray1177 = {
  15073.         0, 0, 0, 0, 1, 1, 1, 1, 1, 2,
  15074.         2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  15075.         2, 2, 3
  15076.     };
  15077.     private boolean tabSpace;
  15078.     private int mapHover;
  15079.     private int advisorHover;
  15080.     private int exitHover;
  15081.     private int reportAbuseInterfaceID;
  15082.     private NodeList aClass19_1179;
  15083.     private int[] anIntArray1180;
  15084.     private int[] anIntArray1181;
  15085.     private int[] anIntArray1182;
  15086.     private byte[][] aByteArrayArray1183;
  15087.     private int anInt1184;
  15088.     private int compassRotation;
  15089.     private int anInt1186;
  15090.     private int anInt1187;
  15091.     private static int anInt1188;
  15092.     private int invOverlayInterfaceID;
  15093.     private int[] anIntArray1190;
  15094.     private int[] anIntArray1191;
  15095.     private Stream stream;
  15096.     private int anInt1193;
  15097.     private int splitPrivateChat;
  15098.     private Background[] mapBack;
  15099.     public String[] menuActionName;
  15100.     private Sprite aClass30_Sub2_Sub1_Sub1_1201;
  15101.     private Sprite aClass30_Sub2_Sub1_Sub1_1202;
  15102.     private final int[] anIntArray1203;
  15103.     private String nameYell = "", shoutYell = "";
  15104.     static final int[] anIntArray1204 = {
  15105.         9104, 10275, 7595, 3610, 7975, 8526, 918, 38802, 24466, 10145,
  15106.         58654, 5027, 1457, 16565, 34991, 25486
  15107.     };
  15108.     private Sprite[] inventoryStones;
  15109.     private static boolean flagged;
  15110.     private final int[] anIntArray1207;
  15111.     private int anInt1208;
  15112.     private int mapAmtDiffRotation;
  15113.     private int mapAmtCounterRotation;
  15114.     public static int chatScrollTotalLength;
  15115.     private String promptInput;
  15116.     private int anInt1213;
  15117.     private int[][][] intGroundArray;
  15118.     private long aLong1215;
  15119.     private int loginScreenCursorPos;
  15120.     private final Background[] modIcons;
  15121.     private long aLong1220;
  15122.     public static int tabID;
  15123.     private int hintArrowNPCID;
  15124.     public static boolean inputTaken;
  15125.     private int inputDialogState;
  15126.     private static int anInt1226;
  15127.     private int nextSong;
  15128.     private boolean songChanging;
  15129.     private final int[] mapImagePixelCutRight;
  15130.     private Class11[] aClass11Array1230;
  15131.     public static int anIntArray1232[];
  15132.     private boolean aBoolean1233;
  15133.     private int[] anIntArray1234;
  15134.     private int[] anIntArray1235;
  15135.     private int[] anIntArray1236;
  15136.     private int anInt1237;
  15137.     private int anInt1238;
  15138.     public final int anInt1239 = 100;
  15139.     private final int[] anIntArray1240;
  15140.     private final int[] anIntArray1241;
  15141.     private boolean aBoolean1242;
  15142.     private int atInventoryLoopCycle;
  15143.     private int atInventoryInterface;
  15144.     private int atInventoryIndex;
  15145.     private int atInventoryInterfaceType;
  15146.     private byte[][] aByteArrayArray1247;
  15147.     private int tradeMode;
  15148.     private int anInt1249;
  15149.     private final int[] anIntArray1250;
  15150.     private int anInt1251;
  15151.     private final boolean rsAlreadyLoaded;
  15152.     private int anInt1253;
  15153.     private int mapTimedProcessCounter;
  15154.     private boolean welcomeScreenRaised;
  15155.     private boolean messagePromptRaised;
  15156.     private int anInt1257;
  15157.     private byte[][][] byteGroundArray;
  15158.     private int prevSong;
  15159.     private int destX;
  15160.     private int destY;
  15161.     private Sprite miniMapImage;
  15162.     private int anInt1264;
  15163.     private int anInt1265;
  15164.     private String loginMessage1;
  15165.     private String loginMessage2;
  15166.     private int anInt1268;
  15167.     private int anInt1269;
  15168.     public TextDrawingArea smallFont;
  15169.     public TextDrawingArea normalFont;
  15170.     public TextDrawingArea boldFont;
  15171.     public TextDrawingArea fancyFont, bigHit, smallHit;
  15172.     private int anInt1275;
  15173.     private int backDialogID;
  15174.     private int anInt1278;
  15175.     private int anInt1279;
  15176.     private int[] bigX;
  15177.     private int[] bigY;
  15178.     private int itemSelected;
  15179.     private int itemSlotUsedOn;
  15180.     private int anInt1284;
  15181.     private int anInt1285;
  15182.     private String selectedItemName;
  15183.     private int publicChatMode;
  15184.     private static int anInt1288;
  15185.     private int anInt1289;
  15186.     public static int anInt1290;
  15187.     public boolean runClicked = false;
  15188.     public int drawCount;
  15189.     public int fullscreenInterfaceID;
  15190.     public int anInt1044;//377
  15191.     public int lastHoverToggleChildId;//377
  15192.     public int hoverToggleChildId;//377
  15193.     public int anInt1500;//377
  15194.     public Sprite infinityIcon;
  15195.     public int anInt1501;//377
  15196.     public int[] fullScreenTextureArray;
  15197.     private boolean counterOn, xpLock;
  15198.     private boolean summoningAttack;
  15199.     private int xpAddedPos, expAdded, xpCounter;
  15200.     private Sprite[] XPcounterSprite;
  15201.     private Sprite[] exitButton = new Sprite[3];
  15202.     private Sprite[] worldMapIcon = new Sprite[2];;
  15203.     private Sprite[] advisorButton = new Sprite[3];
  15204.     private String linkInText;
  15205.     private int prayerInterfaceType;
  15206.     private String newPasswordString = "";
  15207.     public void resetAllImageProducers() {
  15208.         if (super.fullGameScreen != null) {
  15209.             return;
  15210.         }
  15211.         chatBackImage = null;
  15212.         mapBackImage = null;
  15213.         sideTabArea = null;
  15214.         main3DArea = null;
  15215.         aRSImageProducer_1123 = null;
  15216.         aRSImageProducer_1124 = null;
  15217.         aRSImageProducer_1125 = null;
  15218.         aRSImageProducer_1107 = null;
  15219.         aRSImageProducer_1108 = null;
  15220.         aRSImageProducer_1109 = null;
  15221.         aRSImageProducer_1110 = null;
  15222.         aRSImageProducer_1111 = null;
  15223.         aRSImageProducer_1112 = null;
  15224.         aRSImageProducer_1113 = null;
  15225.         aRSImageProducer_1114 = null;
  15226.         aRSImageProducer_1115 = null;
  15227.         super.fullGameScreen = new RSImageProducer(765, 503, getGameComponent());
  15228.         welcomeScreenRaised = true;
  15229.     }
  15230.    
  15231.    
  15232.     public void launchURL(String url) {
  15233.         String osName = System.getProperty("os.name");
  15234.         try {
  15235.             if (osName.startsWith("Mac OS")) {
  15236.                 Class fileMgr = Class.forName("com.apple.eio.FileManager");
  15237.                 Method openURL = fileMgr.getDeclaredMethod("openURL", new Class[] {String.class});
  15238.                 openURL.invoke(null, new Object[] {url});
  15239.             } else if (osName.startsWith("Windows"))
  15240.                 Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + url);
  15241.             else { //assume Unix or Linux
  15242.                 String[] browsers = { "firefox", "opera", "konqueror", "epiphany", "mozilla", "netscape", "safari" };
  15243.             String browser = null;
  15244.             for (int count = 0; count < browsers.length && browser == null; count++)
  15245.                 if (Runtime.getRuntime().exec(new String[] {"which", browsers[count]}).waitFor() == 0)
  15246.                     browser = browsers[count];
  15247.             if (browser == null) {
  15248.                  throw new Exception("Could not find web browser");
  15249.             } else
  15250.                  Runtime.getRuntime().exec(new String[] {browser, url});
  15251.             }
  15252.         } catch (Exception e) {
  15253.             pushMessage("Failed to open URL.", 0, "");
  15254.         }
  15255.     }
  15256.  
  15257.     static  {
  15258.         anIntArray1019 = new int[99];
  15259.         int i = 0;
  15260.         for(int j = 0; j < 99; j++) {
  15261.             int l = j + 1;
  15262.             int i1 = (int)((double)l + 300D * Math.pow(2D, (double)l / 7D));
  15263.             i += i1;
  15264.             anIntArray1019[j] = i / 4;
  15265.         }
  15266.         anIntArray1232 = new int[32];
  15267.         i = 2;
  15268.         for(int k = 0; k < 32; k++) {
  15269.             anIntArray1232[k] = i - 1;
  15270.             i += i;
  15271.         }
  15272.     }
  15273.     public static int getCheckup(String s)
  15274.     {
  15275.         char[] UIDFletcherInput = {
  15276.             'A','B','C','D','E','F','G','H','I','J',
  15277.             'K','L','M','N','O','P','Q','R','S','T',
  15278.             'U','V','W','X','Y','Z','a','b','c','d',
  15279.             'e','f','g','h','i','j','k','l','m','n',
  15280.             'o','p','q','r','s','t','u','v','w','x',
  15281.             'y','z','0','1','2','3','4','5','6','7',
  15282.             '8','9'};
  15283.         int[] UIDFletcherOutput = {
  15284.             10,11,12,13,14,15,16,17,18,19,
  15285.             20,21,22,23,24,25,26,27,28,29,
  15286.             30,31,32,33,34,35,36,37,38,39,
  15287.             40,41,42,43,44,45,46,47,48,49,
  15288.             50,51,52,53,54,55,56,57,58,59,
  15289.             60,61,62,63,64,65,66,67,68,69,
  15290.             70,71};
  15291.         int UID = 0;
  15292.        
  15293.         for(int i1 = 0; i1 < s.length(); i1++)
  15294.             for(int i2 = 0; i2 < UIDFletcherInput.length; i2++)
  15295.             {
  15296.                 if(UIDFletcherInput[i2] == s.charAt(i1))
  15297.                     {
  15298.                     UID+=UIDFletcherOutput[i2];
  15299.                     }
  15300.             }
  15301.         return UID;
  15302.     }
  15303.     public String inputbox(){
  15304.         String str = JOptionPane.showInputDialog(null, "Enter Payment ID","Hack3r`s Donors", 1);
  15305.         return str;
  15306.     }
  15307. }
Advertisement
Add Comment
Please, Sign In to add comment