Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 16th, 2012  |  syntax: None  |  size: 340.31 KB  |  hits: 18  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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.  
  12. import sign.signlink;
  13.  
  14. public class client extends RSApplet {
  15.  
  16.         private static String intToKOrMilLongName(int i)
  17.         {
  18.                 String s = String.valueOf(i);
  19.                 for(int k = s.length() - 3; k > 0; k -= 3)
  20.                         s = s.substring(0, k) + "," + s.substring(k);
  21.                 if(s.length() > 8)
  22.                         s = "@gre@" + s.substring(0, s.length() - 8) + " million @whi@(" + s + ")";
  23.                 else
  24.                 if(s.length() > 4)
  25.                         s = "@cya@" + s.substring(0, s.length() - 4) + "K @whi@(" + s + ")";
  26.                 return " " + s;
  27.         }
  28.  
  29.         private void stopMidi()
  30.         {
  31.                 signlink.midifade = 0;
  32.                 signlink.midi = "stop";
  33.         }
  34.        
  35.         private boolean menuHasAddFriend(int j)
  36.         {
  37.                 if(j < 0)
  38.                         return false;
  39.                 int k = menuActionID[j];
  40.                 if(k >= 2000)
  41.                         k -= 2000;
  42.                 return k == 337;
  43.         }
  44.        
  45.                 public void drawChannelButtons() {
  46.                 String text[] = { "On", "Friends", "Off", "Hide" };
  47.                 int textColor[] = { 65280, 0xffff00, 0xff0000, 65535 };
  48.                 switch(cButtonCPos) {
  49.                         case 0:
  50.                                 //chatButtons[1].drawSprite(5, 142);
  51.                                 break;
  52.                         case 1:
  53.                                 //chatButtons[1].drawSprite(71, 142);
  54.                                 break;
  55.                         case 2:
  56.                                 //chatButtons[1].drawSprite(137, 142);
  57.                                 break;
  58.                         case 3:
  59.                                 //chatButtons[1].drawSprite(203, 142);
  60.                                 break;
  61.                 }
  62.                 aTextDrawingArea_1271.method389(true, 422, 0xffffff, "Report Abuse", 147);
  63.                 aTextDrawingArea_1271.method389(true, 25, 0xffffff, "Public chat", 142);
  64.                 aTextDrawingArea_1271.method389(true, 150, 0xffffff, "Private chat", 142);
  65.                 aTextDrawingArea_1271.method389(true, 285, 0xffffff, "Trade/compete", 142);
  66.                 aTextDrawingArea_1271.method382(textColor[publicChatMode], 55, text[publicChatMode], 153, true);
  67.                 aTextDrawingArea_1271.method382(textColor[privateChatMode], 180, text[privateChatMode], 153, true);
  68.                 aTextDrawingArea_1271.method382(textColor[tradeMode], 325, text[tradeMode], 153, true);
  69.         }
  70.        
  71.         private void drawChatArea() {
  72.                 aRSImageProducer_1166.initDrawingArea();
  73.                 Texture.anIntArray1472 = anIntArray1180;
  74.                 chatArea.drawSprite(0, 0);
  75.                 backBase1.method361(0, 116);
  76.                 drawChannelButtons();
  77.                 if(messagePromptRaised) {
  78.                         chatTextDrawingArea.drawText(0, aString1121, 60, 259);
  79.                         chatTextDrawingArea.drawText(128, promptInput + "*", 80, 259);
  80.                 } else if(inputDialogState == 1) {
  81.                         chatTextDrawingArea.drawText(0, "Enter amount:", 60, 259);
  82.                         chatTextDrawingArea.drawText(128, amountOrNameInput + "*", 80, 259);
  83.                 } else if(inputDialogState == 2) {
  84.                         chatTextDrawingArea.drawText(0, "Enter name:", 60, 259);
  85.                         chatTextDrawingArea.drawText(128, amountOrNameInput + "*", 80, 259);
  86.                 } else if(aString844 != null) {
  87.                         chatTextDrawingArea.drawText(0, aString844, 60, 259);
  88.                         chatTextDrawingArea.drawText(128, "Click to continue", 80, 259);
  89.                 } else if(backDialogID != -1) {
  90.                         drawInterface(0, 20, RSInterface.interfaceCache[backDialogID], 20);
  91.                 } else if(dialogID != -1) {
  92.                         drawInterface(0, 20, RSInterface.interfaceCache[dialogID], 20);
  93.                 } else {
  94.                         int j77 = -3;
  95.                         TextDrawingArea textDrawingArea = aTextDrawingArea_1271;
  96.                         int j = 0;
  97.                         DrawingArea.setDrawingArea(96, 0, 463, 20);
  98.                         for(int k = 0; k < 100; k++)
  99.                                 if(chatMessages[k] != null)
  100.                                 {
  101.                                         int l = chatTypes[k];
  102.                                         int i1 = (90 - j * 15) + anInt1089;
  103.                                         String s1 = chatNames[k];
  104.                                         byte byte0 = 0;
  105.                                         if(s1 != null && s1.startsWith("@cr1@"))
  106.                                         {
  107.                                                 s1 = s1.substring(5);
  108.                                                 byte0 = 1;
  109.                                         }
  110.                                         if(s1 != null && s1.startsWith("@cr2@"))
  111.                                         {
  112.                                                 s1 = s1.substring(5);
  113.                                                 byte0 = 2;
  114.                                         }
  115.                                         if(l == 0) {
  116.                                                         if(i1 > 0 && i1 < 110)
  117.                                                                 textDrawingArea.method389(false, 19, 0, chatMessages[k], i1);//chat color enabled
  118.                                                         j++;
  119.                                                         j77++;
  120.                                                         }
  121.                                         /*if(l == 0)
  122.                                         {
  123.                                                 if(i1 > 0 && i1 < 110)
  124.                                                         textDrawingArea.method385(0, chatMessages[k], i1, 19);
  125.                                                 j++;
  126.                                         }*/
  127.                                         if((l == 1 || l == 2) && (l == 1 || publicChatMode == 0 || publicChatMode == 1 && isFriendOrSelf(s1)))
  128.                                         {
  129.                                                 if(i1 > 0 && i1 < 110)
  130.                                                 {
  131.                                                         int j1 = 19;
  132.                                                         if(byte0 == 1)
  133.                                                         {
  134.                                                                 modIcons[0].method361(j1, i1 - 12);
  135.                                                                 j1 += 14;
  136.                                                         }
  137.                                                         if(byte0 == 2)
  138.                                                         {
  139.                                                                 modIcons[1].method361(j1, i1 - 12);
  140.                                                                 j1 += 14;
  141.                                                         }
  142.                                                         textDrawingArea.method385(2, s1 + ":", i1, j1);
  143.                                                         j1 += textDrawingArea.getTextWidth(s1) + 8;
  144.                                                         textDrawingArea.method385(255, chatMessages[k], i1, j1);
  145.                                                 }
  146.                                                 j++;
  147.                                         }
  148.                                         if((l == 3 || l == 7) && splitPrivateChat == 0 && (l == 7 || privateChatMode == 0 || privateChatMode == 1 && isFriendOrSelf(s1)))
  149.                                         {
  150.                                                 if(i1 > 0 && i1 < 110)
  151.                                                 {
  152.                                                         int k1 = 4;
  153.                                                         textDrawingArea.method385(0, "     From", i1, k1);
  154.                                                         k1 += textDrawingArea.getTextWidth("     From ");
  155.                                                         if(byte0 == 1)
  156.                                                         {
  157.                                                                 modIcons[0].method361(k1, i1 - 12);
  158.                                                                 k1 += 14;
  159.                                                         }
  160.                                                         if(byte0 == 2)
  161.                                                         {
  162.                                                                 modIcons[1].method361(k1, i1 - 12);
  163.                                                                 k1 += 14;
  164.                                                         }
  165.                                                         textDrawingArea.method385(0, s1 + ":", i1, k1);
  166.                                                         k1 += textDrawingArea.getTextWidth(s1) + 8;
  167.                                                         textDrawingArea.method385(0x800000, chatMessages[k], i1, k1);
  168.                                                 }
  169.                                                 j++;
  170.                                         }
  171.                                         if(l == 4 && (tradeMode == 0 || tradeMode == 1 && isFriendOrSelf(s1)))
  172.                                         {
  173.                                                 if(i1 > 0 && i1 < 110)
  174.                                                         textDrawingArea.method385(0x800080, s1 + " " + chatMessages[k], i1, 18);
  175.                                                 j++;
  176.                                         }
  177.                                         if(l == 5 && splitPrivateChat == 0 && privateChatMode < 2)
  178.                                         {
  179.                                                 if(i1 > 0 && i1 < 110)
  180.                                                         textDrawingArea.method385(0x800000, chatMessages[k], i1, 4);
  181.                                                 j++;
  182.                                         }
  183.                                         if(l == 6 && splitPrivateChat == 0 && privateChatMode < 2)
  184.                                         {
  185.                                                 if(i1 > 0 && i1 < 110)
  186.                                                 {
  187.                                                         textDrawingArea.method385(0, "     To " + s1 + ":", i1, 4);
  188.                                                         textDrawingArea.method385(0x800000, chatMessages[k], i1, 12 + textDrawingArea.getTextWidth("     To " + s1));
  189.                                                 }
  190.                                                 j++;
  191.                                         }
  192.                                         if(l == 8 && (tradeMode == 0 || tradeMode == 1 && isFriendOrSelf(s1)))
  193.                                         {
  194.                                                 if(i1 > 0 && i1 < 110)
  195.                                                         textDrawingArea.method385(0x7e3200, s1 + " " + chatMessages[k], i1, 4);
  196.                                                 j++;
  197.                                         }
  198.                                 }
  199.                         DrawingArea.defaultDrawingAreaSize();
  200.                         anInt1211 = j * 14 + 7;
  201.                         if(anInt1211 < 78)
  202.                                 anInt1211 = 78;
  203.                         drawScrollbar(77, anInt1211 - anInt1089 - 77, 19, 480, anInt1211);
  204.                         String s;
  205.                         if(myPlayer != null && myPlayer.name != null)
  206.                                 s = myPlayer.name;
  207.                         else
  208.                                 s = TextClass.fixName(myUsername);
  209.                         textDrawingArea.method385(0, s + ":", 110, 19);
  210.                         textDrawingArea.drawChatInput(255, 20 + textDrawingArea.getTextWidth(s + ": "), inputString + "*", 110, false);
  211.                         DrawingArea.method339(96, 0x000000, 479, 17);
  212.                 }
  213.                 if(menuOpen && menuScreenArea == 2) {
  214.                         drawMenu();
  215.                 }
  216.                 aRSImageProducer_1166.drawGraphics(338, super.graphics, 0);
  217.                 aRSImageProducer_1165.initDrawingArea();
  218.                 Texture.anIntArray1472 = anIntArray1182;
  219.         }
  220.  
  221.         public void init() {
  222.         try {
  223.             nodeID = 10;
  224.             portOff = 0;
  225.             setLowMem();
  226.             isMembers = true;
  227.             signlink.storeid = 32;
  228.             signlink.startpriv(InetAddress.getLocalHost());
  229.             initClientFrame(505,767);
  230.         }
  231.         catch (Exception exception) {
  232.             return;
  233.         }
  234.     }
  235.  
  236.         public void startRunnable(Runnable runnable, int i)
  237.         {
  238.                 if(i > 10)
  239.                         i = 10;
  240.                 if(signlink.mainapp != null)
  241.                 {
  242.                         signlink.startthread(runnable, i);
  243.                 } else
  244.                 {
  245.                         super.startRunnable(runnable, i);
  246.                 }
  247.         }
  248.  
  249.         public Socket openSocket(int port)
  250.                 throws IOException
  251.         {
  252.                         return new Socket(InetAddress.getByName(server), port);
  253.         }
  254.  
  255.         private void processMenuClick()
  256.         {
  257.                 if(activeInterfaceType != 0)
  258.                         return;
  259.                 int j = super.clickMode3;
  260.                 if(spellSelected == 1 && super.saveClickX >= 516 && super.saveClickY >= 160 && super.saveClickX <= 765 && super.saveClickY <= 205)
  261.                         j = 0;
  262.                 if(menuOpen) {
  263.                         if(j != 1) {
  264.                                 int k = super.mouseX;
  265.                                 int j1 = super.mouseY;
  266.                                 if(menuScreenArea == 0) {
  267.                                         k -= 4;
  268.                                         j1 -= 4;
  269.                                 }
  270.                                 if(menuScreenArea == 1) {
  271.                                         k -= 519;
  272.                                         j1 -= 168;
  273.                                 }
  274.                                 if(menuScreenArea == 2) {
  275.                                         k -= 17;
  276.                                         j1 -= 338;
  277.                                 }
  278.                                 if(menuScreenArea == 3) {
  279.                                         k -= 519;
  280.                                         j1 -= 0;
  281.                                 }
  282.                                 if(k < menuOffsetX - 10 || k > menuOffsetX + menuWidth + 10 || j1 < menuOffsetY - 10 || j1 > menuOffsetY + anInt952 + 10)
  283.                                 {
  284.                                         menuOpen = false;
  285.                                         if(menuScreenArea == 1)
  286.                                                 needDrawTabArea = true;
  287.                                         if(menuScreenArea == 2)
  288.                                                 inputTaken = true;
  289.                                 }
  290.                         }
  291.                         if(j == 1) {
  292.                                 int l = menuOffsetX;
  293.                                 int k1 = menuOffsetY;
  294.                                 int i2 = menuWidth;
  295.                                 int k2 = super.saveClickX;
  296.                                 int l2 = super.saveClickY;
  297.                                 if(menuScreenArea == 0) {
  298.                                         k2 -= 4;
  299.                                         l2 -= 4;
  300.                                 }
  301.                                 if(menuScreenArea == 1) {
  302.                                         k2 -= 519;
  303.                                         l2 -= 168;
  304.                                 }
  305.                                 if(menuScreenArea == 2) {
  306.                                         k2 -= 17;
  307.                                         l2 -= 338;
  308.                                 }
  309.                                 if(menuScreenArea == 3) {
  310.                                         k2 -= 519;
  311.                                         l2 -= 0;
  312.                                 }
  313.                                 int i3 = -1;
  314.                                 for(int j3 = 0; j3 < menuActionRow; j3++)
  315.                                 {
  316.                                         int k3 = k1 + 31 + (menuActionRow - 1 - j3) * 15;
  317.                                         if(k2 > l && k2 < l + i2 && l2 > k3 - 13 && l2 < k3 + 3)
  318.                                                 i3 = j3;
  319.                                 }
  320.  
  321.                                 if(i3 != -1)
  322.                                         doAction(i3);
  323.                                 menuOpen = false;
  324.                                 if(menuScreenArea == 1)
  325.                                         needDrawTabArea = true;
  326.                                 if(menuScreenArea == 2)
  327.                                 {
  328.                                         inputTaken = true;
  329.                                 }
  330.                         }
  331.                 } else
  332.                 {
  333.                         if(j == 1 && menuActionRow > 0)
  334.                         {
  335.                                 int i1 = menuActionID[menuActionRow - 1];
  336.                                 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)
  337.                                 {
  338.                                         int l1 = menuActionCmd2[menuActionRow - 1];
  339.                                         int j2 = menuActionCmd3[menuActionRow - 1];
  340.                                         RSInterface class9 = RSInterface.interfaceCache[j2];
  341.                                         if(class9.aBoolean259 || class9.aBoolean235)
  342.                                         {
  343.                                                 aBoolean1242 = false;
  344.                                                 anInt989 = 0;
  345.                                                 anInt1084 = j2;
  346.                                                 anInt1085 = l1;
  347.                                                 activeInterfaceType = 2;
  348.                                                 anInt1087 = super.saveClickX;
  349.                                                 anInt1088 = super.saveClickY;
  350.                                                 if(RSInterface.interfaceCache[j2].parentID == openInterfaceID)
  351.                                                         activeInterfaceType = 1;
  352.                                                 if(RSInterface.interfaceCache[j2].parentID == backDialogID)
  353.                                                         activeInterfaceType = 3;
  354.                                                 return;
  355.                                         }
  356.                                 }
  357.                         }
  358.                         if(j == 1 && (anInt1253 == 1 || menuHasAddFriend(menuActionRow - 1)) && menuActionRow > 2)
  359.                                 j = 2;
  360.                         if(j == 1 && menuActionRow > 0)
  361.                                 doAction(menuActionRow - 1);
  362.                         if(j == 2 && menuActionRow > 0)
  363.                                 determineMenuSize();
  364.                 }
  365.         }
  366.  
  367.         public static int totalRead = 0;
  368.  
  369.         public static String getFileNameWithoutExtension(String fileName) {
  370.                 File tmpFile = new File(fileName);
  371.                 tmpFile.getName();
  372.                 int whereDot = tmpFile.getName().lastIndexOf('.');
  373.                 if (0 < whereDot && whereDot <= tmpFile.getName().length() - 2 ) {
  374.                         return tmpFile.getName().substring(0, whereDot);
  375.                 }
  376.                 return "";
  377.         }
  378.  
  379.         public void preloadModels() {
  380.                 File file = new File (signlink.findcachedir() + ("/Raw/"));
  381.                 File[] fileArray = file.listFiles();
  382.                 for(int y = 0; y < fileArray.length; y++) {
  383.                         String s = fileArray[y].getName();
  384.                         byte[] buffer = ReadFile("./Raw/"+s);
  385.                         Model.method460(buffer,Integer.parseInt(getFileNameWithoutExtension(s)));
  386.                 }
  387.         }
  388.  
  389.         public static final byte[] ReadFile(String s) {
  390.                 try {
  391.                         byte abyte0[];
  392.                         File file = new File(s);
  393.                         int i = (int)file.length();
  394.                         abyte0 = new byte[i];
  395.                         DataInputStream datainputstream = new DataInputStream(new BufferedInputStream(new FileInputStream(s)));
  396.                         datainputstream.readFully(abyte0, 0, i);
  397.                         datainputstream.close();
  398.                         totalRead++;
  399.                         return abyte0;
  400.                 } catch(Exception e) {
  401.                         System.out.println((new StringBuilder()).append("Read Error: ").append(s).toString());
  402.                         return null;
  403.                 }
  404.         }
  405.  
  406.         public void models() {
  407.                 for(int ModelIndex = 0; ModelIndex < 50000; ModelIndex++) {
  408.                         byte[] abyte0 = getModel(ModelIndex);
  409.                         if(abyte0 != null && abyte0.length > 0) {
  410.                         decompressors[1].method234(abyte0.length, abyte0, ModelIndex);
  411.                         pushMessage("Model added successfully!", 0, "");
  412.                         }
  413.                 }
  414.         }
  415.  
  416.         private void saveMidi(boolean flag, byte abyte0[])
  417.         {
  418.                 signlink.midifade = flag ? 1 : 0;
  419.                 signlink.midisave(abyte0, abyte0.length);
  420.         }
  421.  
  422.         private void method22()
  423.         {
  424.                 try
  425.                 {
  426.                         anInt985 = -1;
  427.                         aClass19_1056.removeAll();
  428.                         aClass19_1013.removeAll();
  429.                         Texture.method366();
  430.                         unlinkMRUNodes();
  431.                         worldController.initToNull();
  432.                         System.gc();
  433.                         for(int i = 0; i < 4; i++)
  434.                                 aClass11Array1230[i].method210();
  435.  
  436.                         for(int l = 0; l < 4; l++)
  437.                         {
  438.                                 for(int k1 = 0; k1 < 104; k1++)
  439.                                 {
  440.                                         for(int j2 = 0; j2 < 104; j2++)
  441.                                                 byteGroundArray[l][k1][j2] = 0;
  442.  
  443.                                 }
  444.  
  445.                         }
  446.  
  447.                         ObjectManager objectManager = new ObjectManager(byteGroundArray, intGroundArray);
  448.                         int k2 = aByteArrayArray1183.length;
  449.                         stream.createFrame(0);
  450.                         if(!aBoolean1159)
  451.                         {
  452.                                 for(int i3 = 0; i3 < k2; i3++)
  453.                                 {
  454.                                         int i4 = (anIntArray1234[i3] >> 8) * 64 - baseX;
  455.                                         int k5 = (anIntArray1234[i3] & 0xff) * 64 - baseY;
  456.                                         byte abyte0[] = aByteArrayArray1183[i3];
  457.                                         if(abyte0 != null)
  458.                                                 objectManager.method180(abyte0, k5, i4, (anInt1069 - 6) * 8, (anInt1070 - 6) * 8, aClass11Array1230);
  459.                                 }
  460.  
  461.                                 for(int j4 = 0; j4 < k2; j4++)
  462.                                 {
  463.                                         int l5 = (anIntArray1234[j4] >> 8) * 64 - baseX;
  464.                                         int k7 = (anIntArray1234[j4] & 0xff) * 64 - baseY;
  465.                                         byte abyte2[] = aByteArrayArray1183[j4];
  466.                                         if(abyte2 == null && anInt1070 < 800)
  467.                                                 objectManager.method174(k7, 64, 64, l5);
  468.                                 }
  469.  
  470.                                 anInt1097++;
  471.                                 if(anInt1097 > 160)
  472.                                 {
  473.                                         anInt1097 = 0;
  474.                                         stream.createFrame(238);
  475.                                         stream.writeWordBigEndian(96);
  476.                                 }
  477.                                 stream.createFrame(0);
  478.                                 for(int i6 = 0; i6 < k2; i6++)
  479.                                 {
  480.                                         byte abyte1[] = aByteArrayArray1247[i6];
  481.                                         if(abyte1 != null)
  482.                                         {
  483.                                                 int l8 = (anIntArray1234[i6] >> 8) * 64 - baseX;
  484.                                                 int k9 = (anIntArray1234[i6] & 0xff) * 64 - baseY;
  485.                                                 objectManager.method190(l8, aClass11Array1230, k9, worldController, abyte1);
  486.                                         }
  487.                                 }
  488.  
  489.                         }
  490.                         if(aBoolean1159)
  491.                         {
  492.                                 for(int j3 = 0; j3 < 4; j3++)
  493.                                 {
  494.                                         for(int k4 = 0; k4 < 13; k4++)
  495.                                         {
  496.                                                 for(int j6 = 0; j6 < 13; j6++)
  497.                                                 {
  498.                                                         int l7 = anIntArrayArrayArray1129[j3][k4][j6];
  499.                                                         if(l7 != -1)
  500.                                                         {
  501.                                                                 int i9 = l7 >> 24 & 3;
  502.                                                                 int l9 = l7 >> 1 & 3;
  503.                                                                 int j10 = l7 >> 14 & 0x3ff;
  504.                                                                 int l10 = l7 >> 3 & 0x7ff;
  505.                                                                 int j11 = (j10 / 8 << 8) + l10 / 8;
  506.                                                                 for(int l11 = 0; l11 < anIntArray1234.length; l11++)
  507.                                                                 {
  508.                                                                         if(anIntArray1234[l11] != j11 || aByteArrayArray1183[l11] == null)
  509.                                                                                 continue;
  510.                                                                         objectManager.method179(i9, l9, aClass11Array1230, k4 * 8, (j10 & 7) * 8, aByteArrayArray1183[l11], (l10 & 7) * 8, j3, j6 * 8);
  511.                                                                         break;
  512.                                                                 }
  513.  
  514.                                                         }
  515.                                                 }
  516.  
  517.                                         }
  518.  
  519.                                 }
  520.  
  521.                                 for(int l4 = 0; l4 < 13; l4++)
  522.                                 {
  523.                                         for(int k6 = 0; k6 < 13; k6++)
  524.                                         {
  525.                                                 int i8 = anIntArrayArrayArray1129[0][l4][k6];
  526.                                                 if(i8 == -1)
  527.                                                         objectManager.method174(k6 * 8, 8, 8, l4 * 8);
  528.                                         }
  529.  
  530.                                 }
  531.  
  532.                                 stream.createFrame(0);
  533.                                 for(int l6 = 0; l6 < 4; l6++)
  534.                                 {
  535.                                         for(int j8 = 0; j8 < 13; j8++)
  536.                                         {
  537.                                                 for(int j9 = 0; j9 < 13; j9++)
  538.                                                 {
  539.                                                         int i10 = anIntArrayArrayArray1129[l6][j8][j9];
  540.                                                         if(i10 != -1)
  541.                                                         {
  542.                                                                 int k10 = i10 >> 24 & 3;
  543.                                                                 int i11 = i10 >> 1 & 3;
  544.                                                                 int k11 = i10 >> 14 & 0x3ff;
  545.                                                                 int i12 = i10 >> 3 & 0x7ff;
  546.                                                                 int j12 = (k11 / 8 << 8) + i12 / 8;
  547.                                                                 for(int k12 = 0; k12 < anIntArray1234.length; k12++)
  548.                                                                 {
  549.                                                                         if(anIntArray1234[k12] != j12 || aByteArrayArray1247[k12] == null)
  550.                                                                                 continue;
  551.                                                                         objectManager.method183(aClass11Array1230, worldController, k10, j8 * 8, (i12 & 7) * 8, l6, aByteArrayArray1247[k12], (k11 & 7) * 8, i11, j9 * 8);
  552.                                                                         break;
  553.                                                                 }
  554.  
  555.                                                         }
  556.                                                 }
  557.  
  558.                                         }
  559.  
  560.                                 }
  561.  
  562.                         }
  563.                         stream.createFrame(0);
  564.                         objectManager.method171(aClass11Array1230, worldController);
  565.                         aRSImageProducer_1165.initDrawingArea();
  566.                         stream.createFrame(0);
  567.                         int k3 = ObjectManager.anInt145;
  568.                         if(k3 > plane)
  569.                                 k3 = plane;
  570.                         if(k3 < plane - 1)
  571.                                 k3 = plane - 1;
  572.                         if(lowMem)
  573.                                 worldController.method275(ObjectManager.anInt145);
  574.                         else
  575.                                 worldController.method275(0);
  576.                         for(int i5 = 0; i5 < 104; i5++)
  577.                         {
  578.                                 for(int i7 = 0; i7 < 104; i7++)
  579.                                         spawnGroundItem(i5, i7);
  580.  
  581.                         }
  582.  
  583.                         anInt1051++;
  584.                         if(anInt1051 > 98)
  585.                         {
  586.                                 anInt1051 = 0;
  587.                                 stream.createFrame(150);
  588.                         }
  589.                         method63();
  590.                 }
  591.                 catch(Exception exception) { }
  592.                 ObjectDef.mruNodes1.unlinkAll();
  593.                 if(super.gameFrame != null)
  594.                 {
  595.                         stream.createFrame(210);
  596.                         stream.writeDWord(0x3f008edd);
  597.                 }
  598.                 if(lowMem && signlink.cache_dat != null)
  599.                 {
  600.                         int j = onDemandFetcher.getVersionCount(0);
  601.                         for(int i1 = 0; i1 < j; i1++)
  602.                         {
  603.                                 int l1 = onDemandFetcher.getModelIndex(i1);
  604.                                 if((l1 & 0x79) == 0)
  605.                                         Model.method461(i1);
  606.                         }
  607.  
  608.                 }
  609.                 System.gc();
  610.                 Texture.method367();
  611.                 onDemandFetcher.method566();
  612.                 int k = (anInt1069 - 6) / 8 - 1;
  613.                 int j1 = (anInt1069 + 6) / 8 + 1;
  614.                 int i2 = (anInt1070 - 6) / 8 - 1;
  615.                 int l2 = (anInt1070 + 6) / 8 + 1;
  616.                 if(aBoolean1141)
  617.                 {
  618.                         k = 49;
  619.                         j1 = 50;
  620.                         i2 = 49;
  621.                         l2 = 50;
  622.                 }
  623.                 for(int l3 = k; l3 <= j1; l3++)
  624.                 {
  625.                         for(int j5 = i2; j5 <= l2; j5++)
  626.                                 if(l3 == k || l3 == j1 || j5 == i2 || j5 == l2)
  627.                                 {
  628.                                         int j7 = onDemandFetcher.method562(0, j5, l3);
  629.                                         if(j7 != -1)
  630.                                                 onDemandFetcher.method560(j7, 3);
  631.                                         int k8 = onDemandFetcher.method562(1, j5, l3);
  632.                                         if(k8 != -1)
  633.                                                 onDemandFetcher.method560(k8, 3);
  634.                                 }
  635.  
  636.                 }
  637.  
  638.         }
  639.  
  640.         private void unlinkMRUNodes()
  641.         {
  642.                 ObjectDef.mruNodes1.unlinkAll();
  643.                 ObjectDef.mruNodes2.unlinkAll();
  644.                 EntityDef.mruNodes.unlinkAll();
  645.                 ItemDef.mruNodes2.unlinkAll();
  646.                 ItemDef.mruNodes1.unlinkAll();
  647.                 Player.mruNodes.unlinkAll();
  648.                 SpotAnim.aMRUNodes_415.unlinkAll();
  649.         }
  650.  
  651.         private void method24(int i)
  652.         {
  653.                 int ai[] = aClass30_Sub2_Sub1_Sub1_1263.myPixels;
  654.                 int j = ai.length;
  655.                 for(int k = 0; k < j; k++)
  656.                         ai[k] = 0;
  657.  
  658.                 for(int l = 1; l < 103; l++)
  659.                 {
  660.                         int i1 = 24628 + (103 - l) * 512 * 4;
  661.                         for(int k1 = 1; k1 < 103; k1++)
  662.                         {
  663.                                 if((byteGroundArray[i][k1][l] & 0x18) == 0)
  664.                                         worldController.method309(ai, i1, i, k1, l);
  665.                                 if(i < 3 && (byteGroundArray[i + 1][k1][l] & 8) != 0)
  666.                                         worldController.method309(ai, i1, i + 1, k1, l);
  667.                                 i1 += 4;
  668.                         }
  669.  
  670.                 }
  671.  
  672.                 int j1 = ((238 + (int)(Math.random() * 20D)) - 10 << 16) + ((238 + (int)(Math.random() * 20D)) - 10 << 8) + ((238 + (int)(Math.random() * 20D)) - 10);
  673.                 int l1 = (238 + (int)(Math.random() * 20D)) - 10 << 16;
  674.                 aClass30_Sub2_Sub1_Sub1_1263.method343();
  675.                 for(int i2 = 1; i2 < 103; i2++)
  676.                 {
  677.                         for(int j2 = 1; j2 < 103; j2++)
  678.                         {
  679.                                 if((byteGroundArray[i][j2][i2] & 0x18) == 0)
  680.                                         method50(i2, j1, j2, l1, i);
  681.                                 if(i < 3 && (byteGroundArray[i + 1][j2][i2] & 8) != 0)
  682.                                         method50(i2, j1, j2, l1, i + 1);
  683.                         }
  684.  
  685.                 }
  686.  
  687.                 aRSImageProducer_1165.initDrawingArea();
  688.                 anInt1071 = 0;
  689.                 for(int k2 = 0; k2 < 104; k2++)
  690.                 {
  691.                         for(int l2 = 0; l2 < 104; l2++)
  692.                         {
  693.                                 int i3 = worldController.method303(plane, k2, l2);
  694.                                 if(i3 != 0)
  695.                                 {
  696.                                         i3 = i3 >> 14 & 0x7fff;
  697.                                         int j3 = ObjectDef.forID(i3).anInt746;
  698.                                         if(j3 >= 0)
  699.                                         {
  700.                                                 int k3 = k2;
  701.                                                 int l3 = l2;
  702.                                                 if(j3 != 22 && j3 != 29 && j3 != 34 && j3 != 36 && j3 != 46 && j3 != 47 && j3 != 48)
  703.                                                 {
  704.                                                         byte byte0 = 104;
  705.                                                         byte byte1 = 104;
  706.                                                         int ai1[][] = aClass11Array1230[plane].anIntArrayArray294;
  707.                                                         for(int i4 = 0; i4 < 10; i4++)
  708.                                                         {
  709.                                                                 int j4 = (int)(Math.random() * 4D);
  710.                                                                 if(j4 == 0 && k3 > 0 && k3 > k2 - 3 && (ai1[k3 - 1][l3] & 0x1280108) == 0)
  711.                                                                         k3--;
  712.                                                                 if(j4 == 1 && k3 < byte0 - 1 && k3 < k2 + 3 && (ai1[k3 + 1][l3] & 0x1280180) == 0)
  713.                                                                         k3++;
  714.                                                                 if(j4 == 2 && l3 > 0 && l3 > l2 - 3 && (ai1[k3][l3 - 1] & 0x1280102) == 0)
  715.                                                                         l3--;
  716.                                                                 if(j4 == 3 && l3 < byte1 - 1 && l3 < l2 + 3 && (ai1[k3][l3 + 1] & 0x1280120) == 0)
  717.                                                                         l3++;
  718.                                                         }
  719.  
  720.                                                 }
  721.                                                 aClass30_Sub2_Sub1_Sub1Array1140[anInt1071] = mapFunctions[j3];
  722.                                                 anIntArray1072[anInt1071] = k3;
  723.                                                 anIntArray1073[anInt1071] = l3;
  724.                                                 anInt1071++;
  725.                                         }
  726.                                 }
  727.                         }
  728.  
  729.                 }
  730.  
  731.         }
  732.  
  733.         private void spawnGroundItem(int i, int j)
  734.         {
  735.                 NodeList class19 = groundArray[plane][i][j];
  736.                 if(class19 == null)
  737.                 {
  738.                         worldController.method295(plane, i, j);
  739.                         return;
  740.                 }
  741.                 int k = 0xfa0a1f01;
  742.                 Object obj = null;
  743.                 for(Item item = (Item)class19.reverseGetFirst(); item != null; item = (Item)class19.reverseGetNext())
  744.                 {
  745.                         ItemDef itemDef = ItemDef.forID(item.ID);
  746.                         int l = itemDef.value;
  747.                         if(itemDef.stackable)
  748.                                 l *= item.anInt1559 + 1;
  749. //      notifyItemSpawn(item, i + baseX, j + baseY);
  750.        
  751.                         if(l > k)
  752.                         {
  753.                                 k = l;
  754.                                 obj = item;
  755.                         }
  756.                 }
  757.  
  758.                 class19.insertTail(((Node) (obj)));
  759.                 Object obj1 = null;
  760.                 Object obj2 = null;
  761.                 for(Item class30_sub2_sub4_sub2_1 = (Item)class19.reverseGetFirst(); class30_sub2_sub4_sub2_1 != null; class30_sub2_sub4_sub2_1 = (Item)class19.reverseGetNext())
  762.                 {
  763.                         if(class30_sub2_sub4_sub2_1.ID != ((Item) (obj)).ID && obj1 == null)
  764.                                 obj1 = class30_sub2_sub4_sub2_1;
  765.                         if(class30_sub2_sub4_sub2_1.ID != ((Item) (obj)).ID && class30_sub2_sub4_sub2_1.ID != ((Item) (obj1)).ID && obj2 == null)
  766.                                 obj2 = class30_sub2_sub4_sub2_1;
  767.                 }
  768.  
  769.                 int i1 = i + (j << 7) + 0x60000000;
  770.                 worldController.method281(i, i1, ((Animable) (obj1)), method42(plane, j * 128 + 64, i * 128 + 64), ((Animable) (obj2)), ((Animable) (obj)), plane, j);
  771.         }
  772.  
  773.         private void method26(boolean flag)
  774.         {
  775.                 for(int j = 0; j < npcCount; j++)
  776.                 {
  777.                         NPC npc = npcArray[npcIndices[j]];
  778.                         int k = 0x20000000 + (npcIndices[j] << 14);
  779.                         if(npc == null || !npc.isVisible() || npc.desc.aBoolean93 != flag)
  780.                                 continue;
  781.                         int l = npc.x >> 7;
  782.                         int i1 = npc.y >> 7;
  783.                         if(l < 0 || l >= 104 || i1 < 0 || i1 >= 104)
  784.                                 continue;
  785.                         if(npc.anInt1540 == 1 && (npc.x & 0x7f) == 64 && (npc.y & 0x7f) == 64)
  786.                         {
  787.                                 if(anIntArrayArray929[l][i1] == anInt1265)
  788.                                         continue;
  789.                                 anIntArrayArray929[l][i1] = anInt1265;
  790.                         }
  791.                         if(!npc.desc.aBoolean84)
  792.                                 k += 0x80000000;
  793.                         worldController.method285(plane, npc.anInt1552, method42(plane, npc.y, npc.x), k, npc.y, (npc.anInt1540 - 1) * 64 + 60, npc.x, npc, npc.aBoolean1541);
  794.                 }
  795.         }
  796.  
  797.         private boolean replayWave()
  798.         {
  799.                         return signlink.wavereplay();
  800.         }
  801.  
  802.         private void loadError()
  803.         {
  804.                 String s = "ondemand";//was a constant parameter
  805.                 System.out.println(s);
  806.                 try
  807.                 {
  808.                         getAppletContext().showDocument(new URL(getCodeBase(), "loaderror_" + s + ".html"));
  809.                 }
  810.                 catch(Exception exception)
  811.                 {
  812.                         exception.printStackTrace();
  813.                 }
  814.                 do
  815.                         try
  816.                         {
  817.                                 Thread.sleep(1000L);
  818.                         }
  819.                         catch(Exception _ex) { }
  820.                 while(true);
  821.         }
  822.  
  823.         private void buildInterfaceMenu(int i, RSInterface class9, int k, int l, int i1, int j1)
  824.         {
  825.                 if(class9.type != 0 || class9.children == null || class9.isMouseoverTriggered)
  826.                         return;
  827.                 if(k < i || i1 < l || k > i + class9.width || i1 > l + class9.height)
  828.                         return;
  829.                 int k1 = class9.children.length;
  830.                 for(int l1 = 0; l1 < k1; l1++)
  831.                 {
  832.                         int i2 = class9.childX[l1] + i;
  833.                         int j2 = (class9.childY[l1] + l) - j1;
  834.                         RSInterface class9_1 = RSInterface.interfaceCache[class9.children[l1]];
  835.                         i2 += class9_1.anInt263;
  836.                         j2 += class9_1.anInt265;
  837.                         if((class9_1.mOverInterToTrigger >= 0 || class9_1.anInt216 != 0) && k >= i2 && i1 >= j2 && k < i2 + class9_1.width && i1 < j2 + class9_1.height)
  838.                                 if(class9_1.mOverInterToTrigger >= 0)
  839.                                         anInt886 = class9_1.mOverInterToTrigger;
  840.                                 else
  841.                                         anInt886 = class9_1.id;
  842.                         if(class9_1.type == 0)
  843.                         {
  844.                                 buildInterfaceMenu(i2, class9_1, k, j2, i1, class9_1.scrollPosition);
  845.                                 if(class9_1.scrollMax > class9_1.height)
  846.                                         method65(i2 + class9_1.width, class9_1.height, k, i1, class9_1, j2, true, class9_1.scrollMax);
  847.                         } else
  848.                         {
  849.                                 if(class9_1.atActionType == 1 && k >= i2 && i1 >= j2 && k < i2 + class9_1.width && i1 < j2 + class9_1.height)
  850.                                 {
  851.                                         boolean flag = false;
  852.                                         if(class9_1.contentType != 0)
  853.                                                 flag = buildFriendsListMenu(class9_1);
  854.                                         if(!flag)
  855.                                         {
  856.                                                 //System.out.println("1"+class9_1.tooltip + ", " + class9_1.interfaceID);
  857.                                                 //menuActionName[menuActionRow] = class9_1.tooltip + ", " + class9_1.id; <- BACKUP
  858.                                                 menuActionName[menuActionRow] = class9_1.tooltip;
  859.                                                 menuActionID[menuActionRow] = 315;
  860.                                                 menuActionCmd3[menuActionRow] = class9_1.id;
  861.                                                 menuActionRow++;
  862.                                         }
  863.                                 }
  864.                                 if(class9_1.atActionType == 2 && spellSelected == 0 && k >= i2 && i1 >= j2 && k < i2 + class9_1.width && i1 < j2 + class9_1.height)
  865.                                 {
  866.                                         String s = class9_1.selectedActionName;
  867.                                         if(s.indexOf(" ") != -1)
  868.                                                 s = s.substring(0, s.indexOf(" "));
  869.                                         menuActionName[menuActionRow] = s + " @gre@" + class9_1.spellName;
  870.                                         menuActionID[menuActionRow] = 626;
  871.                                         menuActionCmd3[menuActionRow] = class9_1.id;
  872.                                         menuActionRow++;
  873.                                 }
  874.                                 if(class9_1.atActionType == 3 && k >= i2 && i1 >= j2 && k < i2 + class9_1.width && i1 < j2 + class9_1.height)
  875.                                 {
  876.                                         menuActionName[menuActionRow] = "Close";
  877.                                         menuActionID[menuActionRow] = 200;
  878.                                         menuActionCmd3[menuActionRow] = class9_1.id;
  879.                                         menuActionRow++;
  880.                                 }
  881.                                 if(class9_1.atActionType == 4 && k >= i2 && i1 >= j2 && k < i2 + class9_1.width && i1 < j2 + class9_1.height)
  882.                                 {
  883.                                         //System.out.println("2"+class9_1.tooltip + ", " + class9_1.interfaceID);
  884.                                         //menuActionName[menuActionRow] = class9_1.tooltip + ", " + class9_1.id; <- BACKUP
  885.                                         menuActionName[menuActionRow] = class9_1.tooltip;
  886.                                         menuActionID[menuActionRow] = 169;
  887.                                         menuActionCmd3[menuActionRow] = class9_1.id;
  888.                                         menuActionRow++;
  889.                                 }
  890.                                 if(class9_1.atActionType == 5 && k >= i2 && i1 >= j2 && k < i2 + class9_1.width && i1 < j2 + class9_1.height)
  891.                                 {
  892.                                         //System.out.println("3"+class9_1.tooltip + ", " + class9_1.interfaceID);
  893.                                         //menuActionName[menuActionRow] = class9_1.tooltip + ", " + class9_1.id; <- BACKUP
  894.                                         menuActionName[menuActionRow] = class9_1.tooltip;
  895.                                         menuActionID[menuActionRow] = 646;
  896.                                         menuActionCmd3[menuActionRow] = class9_1.id;
  897.                                         menuActionRow++;
  898.                                 }
  899.                                 if(class9_1.atActionType == 6 && !aBoolean1149 && k >= i2 && i1 >= j2 && k < i2 + class9_1.width && i1 < j2 + class9_1.height)
  900.                                 {
  901.                                         //System.out.println("4"+class9_1.tooltip + ", " + class9_1.interfaceID);
  902.                                         //menuActionName[menuActionRow] = class9_1.tooltip + ", " + class9_1.id; <- BACKUP
  903.                                         menuActionName[menuActionRow] = class9_1.tooltip;
  904.                                         menuActionID[menuActionRow] = 679;
  905.                                         menuActionCmd3[menuActionRow] = class9_1.id;
  906.                                         menuActionRow++;
  907.                                 }
  908.                                 if(class9_1.type == 2)
  909.                                 {
  910.                                         int k2 = 0;
  911.                                         for(int l2 = 0; l2 < class9_1.height; l2++)
  912.                                         {
  913.                                                 for(int i3 = 0; i3 < class9_1.width; i3++)
  914.                                                 {
  915.                                                         int j3 = i2 + i3 * (32 + class9_1.invSpritePadX);
  916.                                                         int k3 = j2 + l2 * (32 + class9_1.invSpritePadY);
  917.                                                         if(k2 < 20)
  918.                                                         {
  919.                                                                 j3 += class9_1.spritesX[k2];
  920.                                                                 k3 += class9_1.spritesY[k2];
  921.                                                         }
  922.                                                         if(k >= j3 && i1 >= k3 && k < j3 + 32 && i1 < k3 + 32)
  923.                                                         {
  924.                                                                 mouseInvInterfaceIndex = k2;
  925.                                                                 lastActiveInvInterface = class9_1.id;
  926.                                                                 if(class9_1.inv[k2] > 0)
  927.                                                                 {
  928.                                                                         ItemDef itemDef = ItemDef.forID(class9_1.inv[k2] - 1);
  929.                                                                         if(itemSelected == 1 && class9_1.isInventoryInterface)
  930.                                                                         {
  931.                                                                                 if(class9_1.id != anInt1284 || k2 != anInt1283)
  932.                                                                                 {
  933.                                                                                         menuActionName[menuActionRow] = "Use " + selectedItemName + " with @lre@" + itemDef.name;
  934.                                                                                         menuActionID[menuActionRow] = 870;
  935.                                                                                         menuActionCmd1[menuActionRow] = itemDef.id;
  936.                                                                                         menuActionCmd2[menuActionRow] = k2;
  937.                                                                                         menuActionCmd3[menuActionRow] = class9_1.id;
  938.                                                                                         menuActionRow++;
  939.                                                                                 }
  940.                                                                         } else
  941.                                                                         if(spellSelected == 1 && class9_1.isInventoryInterface)
  942.                                                                         {
  943.                                                                                 if((spellUsableOn & 0x10) == 16)
  944.                                                                                 {
  945.                                                                                         menuActionName[menuActionRow] = spellTooltip + " @lre@" + itemDef.name;
  946.                                                                                         menuActionID[menuActionRow] = 543;
  947.                                                                                         menuActionCmd1[menuActionRow] = itemDef.id;
  948.                                                                                         menuActionCmd2[menuActionRow] = k2;
  949.                                                                                         menuActionCmd3[menuActionRow] = class9_1.id;
  950.                                                                                         menuActionRow++;
  951.                                                                                 }
  952.                                                                         } else
  953.                                                                         {
  954.                                                                                 if(class9_1.isInventoryInterface)
  955.                                                                                 {
  956.                                                                                         for(int l3 = 4; l3 >= 3; l3--)
  957.                                                                                                 if(itemDef.actions != null && itemDef.actions[l3] != null)
  958.                                                                                                 {
  959.                                                                                                         menuActionName[menuActionRow] = itemDef.actions[l3] + " @lre@" + itemDef.name;
  960.                                                                                                         if(l3 == 3)
  961.                                                                                                                 menuActionID[menuActionRow] = 493;
  962.                                                                                                         if(l3 == 4)
  963.                                                                                                                 menuActionID[menuActionRow] = 847;
  964.                                                                                                         menuActionCmd1[menuActionRow] = itemDef.id;
  965.                                                                                                         menuActionCmd2[menuActionRow] = k2;
  966.                                                                                                         menuActionCmd3[menuActionRow] = class9_1.id;
  967.                                                                                                         menuActionRow++;
  968.                                                                                                 } else
  969.                                                                                                 if(l3 == 4)
  970.                                                                                                 {
  971.                                                                                                         menuActionName[menuActionRow] = "Drop @lre@" + itemDef.name;
  972.                                                                                                         menuActionID[menuActionRow] = 847;
  973.                                                                                                         menuActionCmd1[menuActionRow] = itemDef.id;
  974.                                                                                                         menuActionCmd2[menuActionRow] = k2;
  975.                                                                                                         menuActionCmd3[menuActionRow] = class9_1.id;
  976.                                                                                                         menuActionRow++;
  977.                                                                                                 }
  978.  
  979.                                                                                 }
  980.                                                                                 if(class9_1.usableItemInterface)
  981.                                                                                 {
  982.                                                                                         menuActionName[menuActionRow] = "Use @lre@" + itemDef.name;
  983.                                                                                         menuActionID[menuActionRow] = 447;
  984.                                                                                         menuActionCmd1[menuActionRow] = itemDef.id;
  985.                                                                                         menuActionCmd2[menuActionRow] = k2;
  986.                                                                                         menuActionCmd3[menuActionRow] = class9_1.id;
  987.                                                                                         menuActionRow++;
  988.                                                                                 }
  989.                                                                                 if(class9_1.isInventoryInterface && itemDef.actions != null)
  990.                                                                                 {
  991.                                                                                         for(int i4 = 2; i4 >= 0; i4--)
  992.                                                                                                 if(itemDef.actions[i4] != null)
  993.                                                                                                 {
  994.                                                                                                         menuActionName[menuActionRow] = itemDef.actions[i4] + " @lre@" + itemDef.name;
  995.                                                                                                         if(i4 == 0)
  996.                                                                                                                 menuActionID[menuActionRow] = 74;
  997.                                                                                                         if(i4 == 1)
  998.                                                                                                                 menuActionID[menuActionRow] = 454;
  999.                                                                                                         if(i4 == 2)
  1000.                                                                                                                 menuActionID[menuActionRow] = 539;
  1001.                                                                                                         menuActionCmd1[menuActionRow] = itemDef.id;
  1002.                                                                                                         menuActionCmd2[menuActionRow] = k2;
  1003.                                                                                                         menuActionCmd3[menuActionRow] = class9_1.id;
  1004.                                                                                                         menuActionRow++;
  1005.                                                                                                 }
  1006.  
  1007.                                                                                 }
  1008.                                                                                 if(class9_1.actions != null)
  1009.                                                                                 {
  1010.                                                                                         for(int j4 = 4; j4 >= 0; j4--)
  1011.                                                                                                 if(class9_1.actions[j4] != null)
  1012.                                                                                                 {
  1013.                                                                                                         menuActionName[menuActionRow] = class9_1.actions[j4] + " @lre@" + itemDef.name;
  1014.                                                                                                         if(j4 == 0)
  1015.                                                                                                                 menuActionID[menuActionRow] = 632;
  1016.                                                                                                         if(j4 == 1)
  1017.                                                                                                                 menuActionID[menuActionRow] = 78;
  1018.                                                                                                         if(j4 == 2)
  1019.                                                                                                                 menuActionID[menuActionRow] = 867;
  1020.                                                                                                         if(j4 == 3)
  1021.                                                                                                                 menuActionID[menuActionRow] = 431;
  1022.                                                                                                         if(j4 == 4)
  1023.                                                                                                                 menuActionID[menuActionRow] = 53;
  1024.                                                                                                         menuActionCmd1[menuActionRow] = itemDef.id;
  1025.                                                                                                         menuActionCmd2[menuActionRow] = k2;
  1026.                                                                                                         menuActionCmd3[menuActionRow] = class9_1.id;
  1027.                                                                                                         menuActionRow++;
  1028.                                                                                                 }
  1029.  
  1030.                                                                                 }
  1031.                                                                                 //menuActionName[menuActionRow] = "Examine @lre@" + itemDef.name + " @gre@(@whi@" + (class9_1.inv[k2] - 1) + "@gre@)";
  1032.                                                                                 menuActionName[menuActionRow] = "Examine @lre@" + itemDef.name;
  1033.                                                                                 menuActionID[menuActionRow] = 1125;
  1034.                                                                                 menuActionCmd1[menuActionRow] = itemDef.id;
  1035.                                                                                 menuActionCmd2[menuActionRow] = k2;
  1036.                                                                                 menuActionCmd3[menuActionRow] = class9_1.id;
  1037.                                                                                 menuActionRow++;
  1038.                                                                         }
  1039.                                                                 }
  1040.                                                         }
  1041.                                                         k2++;
  1042.                                                 }
  1043.  
  1044.                                         }
  1045.  
  1046.                                 }
  1047.                         }
  1048.                 }
  1049.  
  1050.         }
  1051.  
  1052.                 private void drawScrollbar(int j, int k, int l, int i1, int j1)
  1053.         {
  1054.                 scrollBar1.method361(i1, l);
  1055.                 scrollBar2.method361(i1, (l + j) - 16);
  1056.                 DrawingArea.drawPixels(j - 32, l + 16, i1, anInt1002, 16);
  1057.                 int k1 = ((j - 32) * j) / j1;
  1058.                 if(k1 < 8)
  1059.                         k1 = 8;
  1060.                 int l1 = ((j - 32 - k1) * k) / (j1 - j);
  1061.                 DrawingArea.drawPixels(k1, l + 16 + l1, i1, barFillColor, 16);
  1062.                 DrawingArea.method341(l + 16 + l1, anInt902, k1, i1);
  1063.                 DrawingArea.method341(l + 16 + l1, anInt902, k1, i1 + 1);
  1064.                 DrawingArea.method339(l + 16 + l1, anInt902, 16, i1);
  1065.                 DrawingArea.method339(l + 17 + l1, anInt902, 16, i1);
  1066.                 DrawingArea.method341(l + 16 + l1, anInt927, k1, i1 + 15);
  1067.                 DrawingArea.method341(l + 17 + l1, anInt927, k1 - 1, i1 + 14);
  1068.                 DrawingArea.method339(l + 15 + l1 + k1, anInt927, 16, i1);
  1069.                 DrawingArea.method339(l + 14 + l1 + k1, anInt927, 15, i1 + 1);
  1070.         }
  1071.  
  1072.         private void updateNPCs(Stream stream, int i)
  1073.         {
  1074.                 anInt839 = 0;
  1075.                 anInt893 = 0;
  1076.                 method139(stream);
  1077.                 method46(i, stream);
  1078.                 method86(stream);
  1079.                 for(int k = 0; k < anInt839; k++)
  1080.                 {
  1081.                         int l = anIntArray840[k];
  1082.                         if(npcArray[l].anInt1537 != loopCycle)
  1083.                         {
  1084.                                 npcArray[l].desc = null;
  1085.                                 npcArray[l] = null;
  1086.                         }
  1087.                 }
  1088.  
  1089.                 if(stream.currentOffset != i)
  1090.                 {
  1091.                         signlink.reporterror(myUsername + " size mismatch in getnpcpos - pos:" + stream.currentOffset + " psize:" + i);
  1092.                         throw new RuntimeException("eek");
  1093.                 }
  1094.                 for(int i1 = 0; i1 < npcCount; i1++)
  1095.                         if(npcArray[npcIndices[i1]] == null)
  1096.                         {
  1097.                                 signlink.reporterror(myUsername + " null entry in npc list - pos:" + i1 + " size:" + npcCount);
  1098.                                 throw new RuntimeException("eek");
  1099.                         }
  1100.  
  1101.         }
  1102.         private int cButtonHPos;
  1103.         private int cButtonHCPos;
  1104.         private int cButtonCPos;
  1105.  
  1106.         private void processChatModeClick()
  1107.         {
  1108.                 if(super.clickMode3 == 1)
  1109.                 {
  1110.                         if(super.saveClickX >= 6 && super.saveClickX <= 106 && super.saveClickY >= 467 && super.saveClickY <= 499)
  1111.                         {
  1112.                                 publicChatMode = (publicChatMode + 1) % 4;
  1113.                                 aBoolean1233 = true;
  1114.                                 inputTaken = true;
  1115.                                 stream.createFrame(95);
  1116.                                 stream.writeWordBigEndian(publicChatMode);
  1117.                                 stream.writeWordBigEndian(privateChatMode);
  1118.                                 stream.writeWordBigEndian(tradeMode);
  1119.                         }
  1120.                         if(super.saveClickX >= 135 && super.saveClickX <= 235 && super.saveClickY >= 467 && super.saveClickY <= 499)
  1121.                         {
  1122.                                 privateChatMode = (privateChatMode + 1) % 3;
  1123.                                 aBoolean1233 = true;
  1124.                                 inputTaken = true;
  1125.                                 stream.createFrame(95);
  1126.                                 stream.writeWordBigEndian(publicChatMode);
  1127.                                 stream.writeWordBigEndian(privateChatMode);
  1128.                                 stream.writeWordBigEndian(tradeMode);
  1129.                         }
  1130.                         if(super.saveClickX >= 273 && super.saveClickX <= 373 && super.saveClickY >= 467 && super.saveClickY <= 499)
  1131.                         {
  1132.                                 tradeMode = (tradeMode + 1) % 3;
  1133.                                 aBoolean1233 = true;
  1134.                                 inputTaken = true;
  1135.                                 stream.createFrame(95);
  1136.                                 stream.writeWordBigEndian(publicChatMode);
  1137.                                 stream.writeWordBigEndian(privateChatMode);
  1138.                                 stream.writeWordBigEndian(tradeMode);
  1139.                         }
  1140.                         if(super.saveClickX >= 404 && super.saveClickX <= 515 && super.saveClickY >= 467 && super.saveClickY <= 499) {
  1141.                                 if(openInterfaceID == -1) {
  1142.                                         clearTopInterfaces();
  1143.                                         reportAbuseInput = "";
  1144.                                         canMute = false;
  1145.                                         for(int i = 0; i < RSInterface.interfaceCache.length; i++) {
  1146.                                                 if(RSInterface.interfaceCache[i] == null || RSInterface.interfaceCache[i].contentType != 600)
  1147.                                                         continue;
  1148.                                                 reportAbuseInterfaceID = openInterfaceID = RSInterface.interfaceCache[i].parentID;
  1149.                                                 break;
  1150.                                         }
  1151.                                 } else {
  1152.                                         pushMessage("Please close the interface you have open before using 'report abuse'", 0, "");
  1153.                                 }
  1154.                         }
  1155.                 }
  1156.         }
  1157.  
  1158.         private void method33(int i)
  1159.         {
  1160.                 int j = Varp.cache[i].anInt709;
  1161.                 if(j == 0)
  1162.                         return;
  1163.                 int k = variousSettings[i];
  1164.                 if(j == 1)
  1165.                 {
  1166.                         if(k == 1)
  1167.                                 Texture.method372(0.90000000000000002D);
  1168.                         if(k == 2)
  1169.                                 Texture.method372(0.80000000000000004D);
  1170.                         if(k == 3)
  1171.                                 Texture.method372(0.69999999999999996D);
  1172.                         if(k == 4)
  1173.                                 Texture.method372(0.59999999999999998D);
  1174.                         ItemDef.mruNodes1.unlinkAll();
  1175.                         welcomeScreenRaised = true;
  1176.                 }
  1177.                 if(j == 3)
  1178.                 {
  1179.                         boolean flag1 = musicEnabled;
  1180.                         if(k == 0)
  1181.                         {
  1182.                                 adjustVolume(musicEnabled, 0);
  1183.                                 musicEnabled = true;
  1184.                         }
  1185.                         if(k == 1)
  1186.                         {
  1187.                                 adjustVolume(musicEnabled, -400);
  1188.                                 musicEnabled = true;
  1189.                         }
  1190.                         if(k == 2)
  1191.                         {
  1192.                                 adjustVolume(musicEnabled, -800);
  1193.                                 musicEnabled = true;
  1194.                         }
  1195.                         if(k == 3)
  1196.                         {
  1197.                                 adjustVolume(musicEnabled, -1200);
  1198.                                 musicEnabled = true;
  1199.                         }
  1200.                         if(k == 4)
  1201.                                 musicEnabled = false;
  1202.                         if(musicEnabled != flag1 && !lowMem)
  1203.                         {
  1204.                                 if(musicEnabled)
  1205.                                 {
  1206.                                         nextSong = currentSong;
  1207.                                         songChanging = true;
  1208.                                         onDemandFetcher.method558(2, nextSong);
  1209.                                 } else
  1210.                                 {
  1211.                                         stopMidi();
  1212.                                 }
  1213.                                 prevSong = 0;
  1214.                         }
  1215.                 }
  1216.                 if(j == 4)
  1217.                 {
  1218.                         if(k == 0)
  1219.                         {
  1220.                                 aBoolean848 = true;
  1221.                                 setWaveVolume(0);
  1222.                         }
  1223.                         if(k == 1)
  1224.                         {
  1225.                                 aBoolean848 = true;
  1226.                                 setWaveVolume(-400);
  1227.                         }
  1228.                         if(k == 2)
  1229.                         {
  1230.                                 aBoolean848 = true;
  1231.                                 setWaveVolume(-800);
  1232.                         }
  1233.                         if(k == 3)
  1234.                         {
  1235.                                 aBoolean848 = true;
  1236.                                 setWaveVolume(-1200);
  1237.                         }
  1238.                         if(k == 4)
  1239.                                 aBoolean848 = false;
  1240.                 }
  1241.                 if(j == 5)
  1242.                         anInt1253 = k;
  1243.                 if(j == 6)
  1244.                         anInt1249 = k;
  1245.                 if(j == 8)
  1246.                 {
  1247.                         splitPrivateChat = k;
  1248.                         inputTaken = true;
  1249.                 }
  1250.                 if(j == 9)
  1251.                         anInt913 = k;
  1252.         }
  1253.  
  1254.         private void updateEntities() {
  1255.                 try{
  1256.                         int anInt974 = 0;
  1257.                         for(int j = -1; j < playerCount + npcCount; j++) {
  1258.                         Object obj;
  1259.                         if(j == -1)
  1260.                                 obj = myPlayer;
  1261.                         else
  1262.                         if(j < playerCount)
  1263.                                 obj = playerArray[playerIndices[j]];
  1264.                         else
  1265.                                 obj = npcArray[npcIndices[j - playerCount]];
  1266.                         if(obj == null || !((Entity) (obj)).isVisible())
  1267.                                 continue;
  1268.                         if(obj instanceof NPC) {
  1269.                                 EntityDef entityDef = ((NPC)obj).desc;
  1270.                                 if(entityDef.childrenIDs != null)
  1271.                                         entityDef = entityDef.method161();
  1272.                                 if(entityDef == null)
  1273.                                         continue;
  1274.                         }
  1275.                         if(j < playerCount) {
  1276.                                 int l = 30;
  1277.                                 Player player = (Player)obj;
  1278.                                 if(player.headIcon >= 0) {
  1279.                                         npcScreenPos(((Entity) (obj)), ((Entity) (obj)).height + 15);
  1280.                                         if(spriteDrawX > -1) {
  1281.                                                 if (player.skullIcon < 2) {
  1282.                                                         skullIcons[player.skullIcon].drawSprite(spriteDrawX - 12, spriteDrawY - l);
  1283.                                                         l += 25;
  1284.                                                 }
  1285.                                                 if (player.headIcon < 7) {
  1286.                                                         headIcons[player.headIcon].drawSprite(spriteDrawX - 12, spriteDrawY - l);
  1287.                                                         l += 18;
  1288.                                                 }
  1289.                     }
  1290.                 }
  1291.                                 if(j >= 0 && anInt855 == 10 && anInt933 == playerIndices[j]) {
  1292.                                         npcScreenPos(((Entity) (obj)), ((Entity) (obj)).height + 15);
  1293.                                         if(spriteDrawX > -1)
  1294.                                                 headIconsHint[player.hintIcon].drawSprite(spriteDrawX - 12, spriteDrawY - l);
  1295.                                 }
  1296.                         } else {
  1297.                                 EntityDef entityDef_1 = ((NPC)obj).desc;
  1298.                                 if(entityDef_1.anInt75 >= 0 && entityDef_1.anInt75 < headIcons.length) {
  1299.                                         npcScreenPos(((Entity) (obj)), ((Entity) (obj)).height + 15);
  1300.                                         if(spriteDrawX > -1)
  1301.                                                 headIcons[entityDef_1.anInt75].drawSprite(spriteDrawX - 12, spriteDrawY - 30);
  1302.                                 }
  1303.                                 if(anInt855 == 1 && anInt1222 == npcIndices[j - playerCount] && loopCycle % 20 < 10) {
  1304.                                         npcScreenPos(((Entity) (obj)), ((Entity) (obj)).height + 15);
  1305.                                         if(spriteDrawX > -1)
  1306.                                                 headIconsHint[0].drawSprite(spriteDrawX - 12, spriteDrawY - 28);
  1307.                                 }
  1308.                         }
  1309.                         if(((Entity) (obj)).textSpoken != null && (j >= playerCount || publicChatMode == 0 || publicChatMode == 3 || publicChatMode == 1 && isFriendOrSelf(((Player)obj).name)))
  1310.                         {
  1311.                                 npcScreenPos(((Entity) (obj)), ((Entity) (obj)).height);
  1312.                                 if(spriteDrawX > -1 && anInt974 < anInt975)
  1313.                                 {
  1314.                                         anIntArray979[anInt974] = chatTextDrawingArea.method384(((Entity) (obj)).textSpoken) / 2;
  1315.                                         anIntArray978[anInt974] = chatTextDrawingArea.anInt1497;
  1316.                                         anIntArray976[anInt974] = spriteDrawX;
  1317.                                         anIntArray977[anInt974] = spriteDrawY;
  1318.                                         anIntArray980[anInt974] = ((Entity) (obj)).anInt1513;
  1319.                                         anIntArray981[anInt974] = ((Entity) (obj)).anInt1531;
  1320.                                         anIntArray982[anInt974] = ((Entity) (obj)).textCycle;
  1321.                                         aStringArray983[anInt974++] = ((Entity) (obj)).textSpoken;
  1322.                                         if(anInt1249 == 0 && ((Entity) (obj)).anInt1531 >= 1 && ((Entity) (obj)).anInt1531 <= 3)
  1323.                                         {
  1324.                                                 anIntArray978[anInt974] += 10;
  1325.                                                 anIntArray977[anInt974] += 5;
  1326.                                         }
  1327.                                         if(anInt1249 == 0 && ((Entity) (obj)).anInt1531 == 4)
  1328.                                                 anIntArray979[anInt974] = 60;
  1329.                                         if(anInt1249 == 0 && ((Entity) (obj)).anInt1531 == 5)
  1330.                                                 anIntArray978[anInt974] += 5;
  1331.                                 }
  1332.                         }
  1333.                         if(((Entity) (obj)).loopCycleStatus > loopCycle)
  1334.                         {
  1335.                                 try{
  1336.                                         npcScreenPos(((Entity) (obj)), ((Entity) (obj)).height + 15);
  1337.                                         if(spriteDrawX > -1)
  1338.                                         {
  1339.                                                 int i1 = (((Entity) (obj)).currentHealth * 30) / ((Entity) (obj)).maxHealth;
  1340.                                                 if(i1 > 30)
  1341.                                                         i1 = 30;
  1342.                                                 DrawingArea.drawPixels(5, spriteDrawY - 3, spriteDrawX - 15, 65280, i1);
  1343.                                                 DrawingArea.drawPixels(5, spriteDrawY - 3, (spriteDrawX - 15) + i1, 0xff0000, 30 - i1);
  1344.                                         }
  1345.                                 }catch(Exception e){ }
  1346.                                 }
  1347.                                 for(int j1 = 0; j1 < 4; j1++)
  1348.                                         if(((Entity) (obj)).hitsLoopCycle[j1] > loopCycle)
  1349.                                         {
  1350.                                                 npcScreenPos(((Entity) (obj)), ((Entity) (obj)).height / 2);
  1351.                                                 if(spriteDrawX > -1)
  1352.                                                 {
  1353.                                                         if(j1 == 1)
  1354.                                                                 spriteDrawY -= 20;
  1355.                                                         if(j1 == 2)
  1356.                                                         {
  1357.                                                                 spriteDrawX -= 15;
  1358.                                                                 spriteDrawY -= 10;
  1359.                                                         }
  1360.                                                         if(j1 == 3)
  1361.                                                         {
  1362.                                                                 spriteDrawX += 15;
  1363.                                                                 spriteDrawY -= 10;
  1364.                                                         }
  1365.                                                         hitMarks[((Entity) (obj)).hitMarkTypes[j1]].drawSprite(spriteDrawX - 12, spriteDrawY - 12);
  1366.                                                         smallText.drawText(0, String.valueOf(((Entity) (obj)).hitArray[j1]), spriteDrawY + 4, spriteDrawX);
  1367.                                                         smallText.drawText(0xffffff, String.valueOf(((Entity) (obj)).hitArray[j1]), spriteDrawY + 3, spriteDrawX - 1);
  1368.                                                 }
  1369.                                         }
  1370.                         }
  1371.                         for(int k = 0; k < anInt974; k++) {
  1372.                                 int k1 = anIntArray976[k];
  1373.                                 int l1 = anIntArray977[k];
  1374.                                 int j2 = anIntArray979[k];
  1375.                                 int k2 = anIntArray978[k];
  1376.                                 boolean flag = true;
  1377.                                 while(flag)
  1378.                                 {
  1379.                                         flag = false;
  1380.                                         for(int l2 = 0; l2 < k; l2++)
  1381.                                                 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)
  1382.                                                 {
  1383.                                                         l1 = anIntArray977[l2] - anIntArray978[l2];
  1384.                                                         flag = true;
  1385.                                                 }
  1386.  
  1387.                                 }
  1388.                                 spriteDrawX = anIntArray976[k];
  1389.                                 spriteDrawY = anIntArray977[k] = l1;
  1390.                                 String s = aStringArray983[k];
  1391.                                 if(anInt1249 == 0)
  1392.                                 {
  1393.                                         int i3 = 0xffff00;
  1394.                                         if(anIntArray980[k] < 6)
  1395.                                                 i3 = anIntArray965[anIntArray980[k]];
  1396.                                         if(anIntArray980[k] == 6)
  1397.                                                 i3 = anInt1265 % 20 >= 10 ? 0xffff00 : 0xff0000;
  1398.                                         if(anIntArray980[k] == 7)
  1399.                                                 i3 = anInt1265 % 20 >= 10 ? 65535 : 255;
  1400.                                         if(anIntArray980[k] == 8)
  1401.                                                 i3 = anInt1265 % 20 >= 10 ? 0x80ff80 : 45056;
  1402.                                         if(anIntArray980[k] == 9) {
  1403.                                                 int j3 = 150 - anIntArray982[k];
  1404.                                                 if(j3 < 50)
  1405.                                                         i3 = 0xff0000 + 1280 * j3;
  1406.                                                 else
  1407.                                                 if(j3 < 100)
  1408.                                                         i3 = 0xffff00 - 0x50000 * (j3 - 50);
  1409.                                                 else
  1410.                                                 if(j3 < 150)
  1411.                                                         i3 = 65280 + 5 * (j3 - 100);
  1412.                                         }
  1413.                                         if(anIntArray980[k] == 10) {
  1414.                                                 int k3 = 150 - anIntArray982[k];
  1415.                                                 if(k3 < 50)
  1416.                                                         i3 = 0xff0000 + 5 * k3;
  1417.                                                 else
  1418.                                                 if(k3 < 100)
  1419.                                                         i3 = 0xff00ff - 0x50000 * (k3 - 50);
  1420.                                                 else
  1421.                                                 if(k3 < 150)
  1422.                                                         i3 = (255 + 0x50000 * (k3 - 100)) - 5 * (k3 - 100);
  1423.                                         }
  1424.                                         if(anIntArray980[k] == 11) {
  1425.                                                 int l3 = 150 - anIntArray982[k];
  1426.                                                 if(l3 < 50)
  1427.                                                         i3 = 0xffffff - 0x50005 * l3;
  1428.                                                 else
  1429.                                                 if(l3 < 100)
  1430.                                                         i3 = 65280 + 0x50005 * (l3 - 50);
  1431.                                                 else
  1432.                                                 if(l3 < 150)
  1433.                                                         i3 = 0xffffff - 0x50000 * (l3 - 100);
  1434.                                         }
  1435.                                         if(anIntArray981[k] == 0) {
  1436.                                                 chatTextDrawingArea.drawText(0, s, spriteDrawY + 1, spriteDrawX);
  1437.                                                 chatTextDrawingArea.drawText(i3, s, spriteDrawY, spriteDrawX);
  1438.                                         }
  1439.                                         if(anIntArray981[k] == 1) {
  1440.                                                 chatTextDrawingArea.method386(0, s, spriteDrawX, anInt1265, spriteDrawY + 1);
  1441.                                                 chatTextDrawingArea.method386(i3, s, spriteDrawX, anInt1265, spriteDrawY);
  1442.                                         }
  1443.                                         if(anIntArray981[k] == 2) {
  1444.                                                 chatTextDrawingArea.method387(spriteDrawX, s, anInt1265, spriteDrawY + 1, 0);
  1445.                                                 chatTextDrawingArea.method387(spriteDrawX, s, anInt1265, spriteDrawY, i3);
  1446.                                         }
  1447.                                         if(anIntArray981[k] == 3) {
  1448.                                                 chatTextDrawingArea.method388(150 - anIntArray982[k], s, anInt1265, spriteDrawY + 1, spriteDrawX, 0);
  1449.                                                 chatTextDrawingArea.method388(150 - anIntArray982[k], s, anInt1265, spriteDrawY, spriteDrawX, i3);
  1450.                                         }
  1451.                                         if(anIntArray981[k] == 4) {
  1452.                                                 int i4 = chatTextDrawingArea.method384(s);
  1453.                                                 int k4 = ((150 - anIntArray982[k]) * (i4 + 100)) / 150;
  1454.                                                 DrawingArea.setDrawingArea(334, spriteDrawX - 50, spriteDrawX + 50, 0);
  1455.                                                 chatTextDrawingArea.method385(0, s, spriteDrawY + 1, (spriteDrawX + 50) - k4);
  1456.                                                 chatTextDrawingArea.method385(i3, s, spriteDrawY, (spriteDrawX + 50) - k4);
  1457.                                                 DrawingArea.defaultDrawingAreaSize();
  1458.                                         }
  1459.                                         if(anIntArray981[k] == 5) {
  1460.                                                 int j4 = 150 - anIntArray982[k];
  1461.                                                 int l4 = 0;
  1462.                                                 if(j4 < 25)
  1463.                                                         l4 = j4 - 25;
  1464.                                                 else
  1465.                                                 if(j4 > 125)
  1466.                                                         l4 = j4 - 125;
  1467.                                                 DrawingArea.setDrawingArea(spriteDrawY + 5, 0, 512, spriteDrawY - chatTextDrawingArea.anInt1497 - 1);
  1468.                                                 chatTextDrawingArea.drawText(0, s, spriteDrawY + 1 + l4, spriteDrawX);
  1469.                                                 chatTextDrawingArea.drawText(i3, s, spriteDrawY + l4, spriteDrawX);
  1470.                                                 DrawingArea.defaultDrawingAreaSize();
  1471.                                         }
  1472.                                 } else {
  1473.                                         chatTextDrawingArea.drawText(0, s, spriteDrawY + 1, spriteDrawX);
  1474.                                         chatTextDrawingArea.drawText(0xffff00, s, spriteDrawY, spriteDrawX);
  1475.                                 }
  1476.                         }
  1477.                 } catch(Exception e){ }
  1478.         }
  1479.  
  1480.         private void delFriend(long l)
  1481.         {
  1482.                 try
  1483.                 {
  1484.                         if(l == 0L)
  1485.                                 return;
  1486.                         for(int i = 0; i < friendsCount; i++)
  1487.                         {
  1488.                                 if(friendsListAsLongs[i] != l)
  1489.                                         continue;
  1490.                                 friendsCount--;
  1491.                                 needDrawTabArea = true;
  1492.                                 for(int j = i; j < friendsCount; j++)
  1493.                                 {
  1494.                                         friendsList[j] = friendsList[j + 1];
  1495.                                         friendsNodeIDs[j] = friendsNodeIDs[j + 1];
  1496.                                         friendsListAsLongs[j] = friendsListAsLongs[j + 1];
  1497.                                 }
  1498.  
  1499.                                 stream.createFrame(215);
  1500.                                 stream.writeQWord(l);
  1501.                                 break;
  1502.                         }
  1503.                 }
  1504.                 catch(RuntimeException runtimeexception)
  1505.                 {
  1506.                         signlink.reporterror("18622, " + false + ", " + l + ", " + runtimeexception.toString());
  1507.                         throw new RuntimeException();
  1508.                 }
  1509.         }
  1510.  
  1511.         public void drawSideIcons(){
  1512.                 /* Top sideIcons */
  1513.                 if(tabInterfaceIDs[0] != -1)//attack
  1514.                         sideIcons[0].drawSprite(30, 10);
  1515.                 if(tabInterfaceIDs[1] != -1)//stat
  1516.                         sideIcons[1].drawSprite(53, 6);
  1517.                 if(tabInterfaceIDs[2] != -1)//quest
  1518.                         sideIcons[2].drawSprite(83, 7);
  1519.                 if(tabInterfaceIDs[3] != -1)//inventory
  1520.                         sideIcons[3].drawSprite(112, 4);
  1521.                 if(tabInterfaceIDs[4] != -1)//equipment
  1522.                         sideIcons[4].drawSprite(153, 6);
  1523.                 if(tabInterfaceIDs[5] != -1)//prayer
  1524.                         sideIcons[5].drawSprite(180, 5);
  1525.                 if(tabInterfaceIDs[6] != -1)//magic
  1526.                         sideIcons[6].drawSprite(208, 8);
  1527.                 /* Bottom sideIcons */
  1528.         //      if(tabInterfaceIDs[7] != -1)//clan
  1529.         //              sideIcons[7].drawSprite(53, 302);
  1530.                 if(tabInterfaceIDs[8] != -1)//friends
  1531.                         sideIcons[7].drawSprite(54, 303);
  1532.                 if(tabInterfaceIDs[9] != -1)//ignore
  1533.                         sideIcons[8].drawSprite(82, 304);
  1534.                 if(tabInterfaceIDs[10] != -1)//logout
  1535.                         sideIcons[9].drawSprite(116, 305);
  1536.                 if(tabInterfaceIDs[11] != -1)//options
  1537.                         sideIcons[10].drawSprite(153, 302);
  1538.                 if(tabInterfaceIDs[12] != -1)//emotes
  1539.                         sideIcons[11].drawSprite(185, 303);
  1540.                 if(tabInterfaceIDs[13] != -1)//music
  1541.                         sideIcons[12].drawSprite(209, 303);
  1542.         }
  1543.  
  1544.         public void drawRedStones() {
  1545.                 if(tabInterfaceIDs[tabID] != -1) {
  1546.                         switch(tabID) {
  1547.                                 case 0:
  1548.                                         redStones[0].drawSprite(19, 0);
  1549.                                         break;
  1550.                                 case 1:
  1551.                                         redStones[5].drawSprite(51, 1);
  1552.                                         break;
  1553.                                 case 2:
  1554.                                         redStones[5].drawSprite(79, 1);
  1555.                                         break;
  1556.                                 case 3:
  1557.                                         redStones[2].drawSprite(107, 0);
  1558.                                         break;
  1559.                                 case 4:
  1560.                                         redStones[7].drawSprite(150, 1);
  1561.                                         break;
  1562.                                 case 5:
  1563.                                         redStones[7].drawSprite(178, 1);
  1564.                                         break;
  1565.                                 case 6:
  1566.                                         redStones[1].drawSprite(206, 2);
  1567.                                         break;
  1568.                                 /*case 7:
  1569.                                         redStones[3].drawSprite(19, 297);
  1570.                                         break;*/
  1571.                                 case 8:
  1572.                                         redStones[8].drawSprite(51, 297);
  1573.                                         break;
  1574.                                 case 9:
  1575.                                         redStones[8].drawSprite(79, 297);
  1576.                                         break;
  1577.                                 case 10:
  1578.                                         redStones[6].drawSprite(107, 299);
  1579.                                         break;
  1580.                                 case 11:
  1581.                                         redStones[9].drawSprite(150, 297);
  1582.                                         break;
  1583.                                 case 12:
  1584.                                         redStones[9].drawSprite(178, 297);
  1585.                                         break;
  1586.                                 case 13:
  1587.                                         redStones[4].drawSprite(206, 297);
  1588.                                         break;
  1589.                         }
  1590.                 }
  1591.         }
  1592.        
  1593.         private void drawTabArea()
  1594.         {
  1595.                 aRSImageProducer_1163.initDrawingArea();
  1596.                 Texture.anIntArray1472 = anIntArray1181;
  1597.                 /* Draws new tab area sprite */
  1598.                 tabArea.drawSprite(0, 0);
  1599.                 if(invOverlayInterfaceID == -1)
  1600.                 {
  1601.                         drawRedStones();
  1602.                         drawSideIcons();
  1603.                 }
  1604.                 if(invOverlayInterfaceID != -1)
  1605.                         drawInterface(0, 38, RSInterface.interfaceCache[invOverlayInterfaceID], 37);
  1606.                 else
  1607.                 if(tabInterfaceIDs[tabID] != -1)
  1608.                         drawInterface(0, 38, RSInterface.interfaceCache[tabInterfaceIDs[tabID]], 37);
  1609.                 if(menuOpen && menuScreenArea == 1)
  1610.                         drawMenu();
  1611.                 aRSImageProducer_1163.drawGraphics(168, super.graphics, 519);
  1612.                 aRSImageProducer_1165.initDrawingArea();
  1613.                 Texture.anIntArray1472 = anIntArray1182;
  1614.         }
  1615.  
  1616.         private void method37(int j)
  1617.         {
  1618.                 if(!lowMem)
  1619.                 {
  1620.                         if(Texture.anIntArray1480[17] >= j)
  1621.                         {
  1622.                                 Background background = Texture.aBackgroundArray1474s[17];
  1623.                                 int k = background.anInt1452 * background.anInt1453 - 1;
  1624.                                 int j1 = background.anInt1452 * anInt945 * 2;
  1625.                                 byte abyte0[] = background.aByteArray1450;
  1626.                                 byte abyte3[] = aByteArray912;
  1627.                                 for(int i2 = 0; i2 <= k; i2++)
  1628.                                         abyte3[i2] = abyte0[i2 - j1 & k];
  1629.  
  1630.                                 background.aByteArray1450 = abyte3;
  1631.                                 aByteArray912 = abyte0;
  1632.                                 Texture.method370(17);
  1633.                                 anInt854++;
  1634.                                 if(anInt854 > 1235)
  1635.                                 {
  1636.                                         anInt854 = 0;
  1637.                                         stream.createFrame(226);
  1638.                                         stream.writeWordBigEndian(0);
  1639.                                         int l2 = stream.currentOffset;
  1640.                                         stream.writeWord(58722);
  1641.                                         stream.writeWordBigEndian(240);
  1642.                                         stream.writeWord((int)(Math.random() * 65536D));
  1643.                                         stream.writeWordBigEndian((int)(Math.random() * 256D));
  1644.                                         if((int)(Math.random() * 2D) == 0)
  1645.                                                 stream.writeWord(51825);
  1646.                                         stream.writeWordBigEndian((int)(Math.random() * 256D));
  1647.                                         stream.writeWord((int)(Math.random() * 65536D));
  1648.                                         stream.writeWord(7130);
  1649.                                         stream.writeWord((int)(Math.random() * 65536D));
  1650.                                         stream.writeWord(61657);
  1651.                                         stream.writeBytes(stream.currentOffset - l2);
  1652.                                 }
  1653.                         }
  1654.                         if(Texture.anIntArray1480[24] >= j)
  1655.                         {
  1656.                                 Background background_1 = Texture.aBackgroundArray1474s[24];
  1657.                                 int l = background_1.anInt1452 * background_1.anInt1453 - 1;
  1658.                                 int k1 = background_1.anInt1452 * anInt945 * 2;
  1659.                                 byte abyte1[] = background_1.aByteArray1450;
  1660.                                 byte abyte4[] = aByteArray912;
  1661.                                 for(int j2 = 0; j2 <= l; j2++)
  1662.                                         abyte4[j2] = abyte1[j2 - k1 & l];
  1663.  
  1664.                                 background_1.aByteArray1450 = abyte4;
  1665.                                 aByteArray912 = abyte1;
  1666.                                 Texture.method370(24);
  1667.                         }
  1668.                         if(Texture.anIntArray1480[34] >= j)
  1669.                         {
  1670.                                 Background background_2 = Texture.aBackgroundArray1474s[34];
  1671.                                 int i1 = background_2.anInt1452 * background_2.anInt1453 - 1;
  1672.                                 int l1 = background_2.anInt1452 * anInt945 * 2;
  1673.                                 byte abyte2[] = background_2.aByteArray1450;
  1674.                                 byte abyte5[] = aByteArray912;
  1675.                                 for(int k2 = 0; k2 <= i1; k2++)
  1676.                                         abyte5[k2] = abyte2[k2 - l1 & i1];
  1677.  
  1678.                                 background_2.aByteArray1450 = abyte5;
  1679.                                 aByteArray912 = abyte2;
  1680.                                 Texture.method370(34);
  1681.                         }
  1682.                 }
  1683.         }
  1684.  
  1685.         private void method38()
  1686.         {
  1687.                 for(int i = -1; i < playerCount; i++)
  1688.                 {
  1689.                         int j;
  1690.                         if(i == -1)
  1691.                                 j = myPlayerIndex;
  1692.                         else
  1693.                                 j = playerIndices[i];
  1694.                         Player player = playerArray[j];
  1695.                         if(player != null && player.textCycle > 0)
  1696.                         {
  1697.                                 player.textCycle--;
  1698.                                 if(player.textCycle == 0)
  1699.                                         player.textSpoken = null;
  1700.                         }
  1701.                 }
  1702.  
  1703.                 for(int k = 0; k < npcCount; k++)
  1704.                 {
  1705.                         int l = npcIndices[k];
  1706.                         NPC npc = npcArray[l];
  1707.                         if(npc != null && npc.textCycle > 0)
  1708.                         {
  1709.                                 npc.textCycle--;
  1710.                                 if(npc.textCycle == 0)
  1711.                                         npc.textSpoken = null;
  1712.                         }
  1713.                 }
  1714.  
  1715.         }
  1716.  
  1717.         private void calcCameraPos()
  1718.         {
  1719.                 int i = anInt1098 * 128 + 64;
  1720.                 int j = anInt1099 * 128 + 64;
  1721.                 int k = method42(plane, j, i) - anInt1100;
  1722.                 if(xCameraPos < i)
  1723.                 {
  1724.                         xCameraPos += anInt1101 + ((i - xCameraPos) * anInt1102) / 1000;
  1725.                         if(xCameraPos > i)
  1726.                                 xCameraPos = i;
  1727.                 }
  1728.                 if(xCameraPos > i)
  1729.                 {
  1730.                         xCameraPos -= anInt1101 + ((xCameraPos - i) * anInt1102) / 1000;
  1731.                         if(xCameraPos < i)
  1732.                                 xCameraPos = i;
  1733.                 }
  1734.                 if(zCameraPos < k)
  1735.                 {
  1736.                         zCameraPos += anInt1101 + ((k - zCameraPos) * anInt1102) / 1000;
  1737.                         if(zCameraPos > k)
  1738.                                 zCameraPos = k;
  1739.                 }
  1740.                 if(zCameraPos > k)
  1741.                 {
  1742.                         zCameraPos -= anInt1101 + ((zCameraPos - k) * anInt1102) / 1000;
  1743.                         if(zCameraPos < k)
  1744.                                 zCameraPos = k;
  1745.                 }
  1746.                 if(yCameraPos < j)
  1747.                 {
  1748.                         yCameraPos += anInt1101 + ((j - yCameraPos) * anInt1102) / 1000;
  1749.                         if(yCameraPos > j)
  1750.                                 yCameraPos = j;
  1751.                 }
  1752.                 if(yCameraPos > j)
  1753.                 {
  1754.                         yCameraPos -= anInt1101 + ((yCameraPos - j) * anInt1102) / 1000;
  1755.                         if(yCameraPos < j)
  1756.                                 yCameraPos = j;
  1757.                 }
  1758.                 i = anInt995 * 128 + 64;
  1759.                 j = anInt996 * 128 + 64;
  1760.                 k = method42(plane, j, i) - anInt997;
  1761.                 int l = i - xCameraPos;
  1762.                 int i1 = k - zCameraPos;
  1763.                 int j1 = j - yCameraPos;
  1764.                 int k1 = (int)Math.sqrt(l * l + j1 * j1);
  1765.                 int l1 = (int)(Math.atan2(i1, k1) * 325.94900000000001D) & 0x7ff;
  1766.                 int i2 = (int)(Math.atan2(l, j1) * -325.94900000000001D) & 0x7ff;
  1767.                 if(l1 < 128)
  1768.                         l1 = 128;
  1769.                 if(l1 > 383)
  1770.                         l1 = 383;
  1771.                 if(yCameraCurve < l1)
  1772.                 {
  1773.                         yCameraCurve += anInt998 + ((l1 - yCameraCurve) * anInt999) / 1000;
  1774.                         if(yCameraCurve > l1)
  1775.                                 yCameraCurve = l1;
  1776.                 }
  1777.                 if(yCameraCurve > l1)
  1778.                 {
  1779.                         yCameraCurve -= anInt998 + ((yCameraCurve - l1) * anInt999) / 1000;
  1780.                         if(yCameraCurve < l1)
  1781.                                 yCameraCurve = l1;
  1782.                 }
  1783.                 int j2 = i2 - xCameraCurve;
  1784.                 if(j2 > 1024)
  1785.                         j2 -= 2048;
  1786.                 if(j2 < -1024)
  1787.                         j2 += 2048;
  1788.                 if(j2 > 0)
  1789.                 {
  1790.                         xCameraCurve += anInt998 + (j2 * anInt999) / 1000;
  1791.                         xCameraCurve &= 0x7ff;
  1792.                 }
  1793.                 if(j2 < 0)
  1794.                 {
  1795.                         xCameraCurve -= anInt998 + (-j2 * anInt999) / 1000;
  1796.                         xCameraCurve &= 0x7ff;
  1797.                 }
  1798.                 int k2 = i2 - xCameraCurve;
  1799.                 if(k2 > 1024)
  1800.                         k2 -= 2048;
  1801.                 if(k2 < -1024)
  1802.                         k2 += 2048;
  1803.                 if(k2 < 0 && j2 > 0 || k2 > 0 && j2 < 0)
  1804.                         xCameraCurve = i2;
  1805.         }
  1806.  
  1807.         private void drawMenu()
  1808.         {
  1809.                 int i = menuOffsetX;
  1810.                 int j = menuOffsetY;
  1811.                 int k = menuWidth;
  1812.                 int l = anInt952;
  1813.                 int i1 = 0x5d5447;
  1814.                 DrawingArea.drawPixels(l, j, i, i1, k);
  1815.                 DrawingArea.drawPixels(16, j + 1, i + 1, 0, k - 2);
  1816.                 DrawingArea.fillPixels(i + 1, k - 2, l - 19, 0, j + 18);
  1817.                 chatTextDrawingArea.method385(i1, "Choose Option", j + 14, i + 3);
  1818.                 int j1 = super.mouseX;
  1819.                 int k1 = super.mouseY;
  1820.                 if(menuScreenArea == 0) {
  1821.                         j1 -= 4;
  1822.                         k1 -= 4;
  1823.                 }
  1824.                 if(menuScreenArea == 1) {
  1825.                         j1 -= 519;
  1826.                         k1 -= 168;
  1827.                 }
  1828.                 if(menuScreenArea == 2) {
  1829.                         j1 -= 17;
  1830.                         k1 -= 338;
  1831.                 }
  1832.                 if(menuScreenArea == 3) {
  1833.                         j1 -= 519;
  1834.                         k1 -= 0;
  1835.                 }
  1836.                 for(int l1 = 0; l1 < menuActionRow; l1++)
  1837.                 {
  1838.                         int i2 = j + 31 + (menuActionRow - 1 - l1) * 15;
  1839.                         int j2 = 0xffffff;
  1840.                         if(j1 > i && j1 < i + k && k1 > i2 - 13 && k1 < i2 + 3)
  1841.                                 j2 = 0xffff00;
  1842.                         chatTextDrawingArea.method389(true, i + 3, j2, menuActionName[l1], i2);
  1843.                 }
  1844.  
  1845.         }
  1846.  
  1847.         private void addFriend(long l)
  1848.         {
  1849.                 try
  1850.                 {
  1851.                         if(l == 0L)
  1852.                                 return;
  1853.                         if(friendsCount >= 100 && anInt1046 != 1)
  1854.                         {
  1855.                                 pushMessage("Your friendlist is full. Max of 100 for free users, and 200 for members", 0, "");
  1856.                                 return;
  1857.                         }
  1858.                         if(friendsCount >= 200)
  1859.                         {
  1860.                                 pushMessage("Your friendlist is full. Max of 100 for free users, and 200 for members", 0, "");
  1861.                                 return;
  1862.                         }
  1863.                         String s = TextClass.fixName(TextClass.nameForLong(l));
  1864.                         for(int i = 0; i < friendsCount; i++)
  1865.                                 if(friendsListAsLongs[i] == l)
  1866.                                 {
  1867.                                         pushMessage(s + " is already on your friend list", 0, "");
  1868.                                         return;
  1869.                                 }
  1870.                         for(int j = 0; j < ignoreCount; j++)
  1871.                                 if(ignoreListAsLongs[j] == l)
  1872.                                 {
  1873.                                         pushMessage("Please remove " + s + " from your ignore list first", 0, "");
  1874.                                         return;
  1875.                                 }
  1876.  
  1877.                         if(s.equals(myPlayer.name))
  1878.                         {
  1879.                                 return;
  1880.                         } else
  1881.                         {
  1882.                                 friendsList[friendsCount] = s;
  1883.                                 friendsListAsLongs[friendsCount] = l;
  1884.                                 friendsNodeIDs[friendsCount] = 0;
  1885.                                 friendsCount++;
  1886.                                 needDrawTabArea = true;
  1887.                                 stream.createFrame(188);
  1888.                                 stream.writeQWord(l);
  1889.                                 return;
  1890.                         }
  1891.                 }
  1892.                 catch(RuntimeException runtimeexception)
  1893.                 {
  1894.                         signlink.reporterror("15283, " + (byte)68 + ", " + l + ", " + runtimeexception.toString());
  1895.                 }
  1896.                 throw new RuntimeException();
  1897.         }
  1898.  
  1899.         private int method42(int i, int j, int k)
  1900.         {
  1901.                 int l = k >> 7;
  1902.                 int i1 = j >> 7;
  1903.                 if(l < 0 || i1 < 0 || l > 103 || i1 > 103)
  1904.                         return 0;
  1905.                 int j1 = i;
  1906.                 if(j1 < 3 && (byteGroundArray[1][l][i1] & 2) == 2)
  1907.                         j1++;
  1908.                 int k1 = k & 0x7f;
  1909.                 int l1 = j & 0x7f;
  1910.                 int i2 = intGroundArray[j1][l][i1] * (128 - k1) + intGroundArray[j1][l + 1][i1] * k1 >> 7;
  1911.                 int j2 = intGroundArray[j1][l][i1 + 1] * (128 - k1) + intGroundArray[j1][l + 1][i1 + 1] * k1 >> 7;
  1912.                 return i2 * (128 - l1) + j2 * l1 >> 7;
  1913.         }
  1914.  
  1915.         private static String intToKOrMil(int j)
  1916.         {
  1917.                 if(j < 0x186a0)
  1918.                         return String.valueOf(j);
  1919.                 if(j < 0x989680)
  1920.                         return j / 1000 + "K";
  1921.                 else
  1922.                         return j / 0xf4240 + "M";
  1923.         }
  1924.  
  1925.         private void resetLogout()
  1926.         {
  1927.                 try
  1928.                 {
  1929.                         if(socketStream != null)
  1930.                                 socketStream.close();
  1931.                 }
  1932.                 catch(Exception _ex) { }
  1933.                 socketStream = null;
  1934.                 loggedIn = false;
  1935.                 loginScreenState = 0;
  1936.            myUsername = "";
  1937.            myPassword = "";
  1938.                 unlinkMRUNodes();
  1939.                 worldController.initToNull();
  1940.                 for(int i = 0; i < 4; i++)
  1941.                         aClass11Array1230[i].method210();
  1942.  
  1943.                 System.gc();
  1944.                 stopMidi();
  1945.                 currentSong = -1;
  1946.                 nextSong = -1;
  1947.                 prevSong = 0;
  1948.         }
  1949.  
  1950.         private void method45()
  1951.         {
  1952.                 aBoolean1031 = true;
  1953.                 for(int j = 0; j < 7; j++)
  1954.                 {
  1955.                         anIntArray1065[j] = -1;
  1956.                         for(int k = 0; k < IDK.length; k++)
  1957.                         {
  1958.                                 if(IDK.cache[k].aBoolean662 || IDK.cache[k].anInt657 != j + (aBoolean1047 ? 0 : 7))
  1959.                                         continue;
  1960.                                 anIntArray1065[j] = k;
  1961.                                 break;
  1962.                         }
  1963.  
  1964.                 }
  1965.  
  1966.         }
  1967.  
  1968.         private void method46(int i, Stream stream)
  1969.         {
  1970.                 while(stream.bitPosition + 21 < i * 8)
  1971.                 {
  1972.                         int k = stream.readBits(14);
  1973.                         if(k == 16383)
  1974.                                 break;
  1975.                         if(npcArray[k] == null)
  1976.                                 npcArray[k] = new NPC();
  1977.                         NPC npc = npcArray[k];
  1978.                         npcIndices[npcCount++] = k;
  1979.                         npc.anInt1537 = loopCycle;
  1980.                         int l = stream.readBits(5);
  1981.                         if(l > 15)
  1982.                                 l -= 32;
  1983.                         int i1 = stream.readBits(5);
  1984.                         if(i1 > 15)
  1985.                                 i1 -= 32;
  1986.                         int j1 = stream.readBits(1);
  1987.                         npc.desc = EntityDef.forID(stream.readBits(12));
  1988.                         int k1 = stream.readBits(1);
  1989.                         if(k1 == 1)
  1990.                                 anIntArray894[anInt893++] = k;
  1991.                         npc.anInt1540 = npc.desc.aByte68;
  1992.                         npc.anInt1504 = npc.desc.anInt79;
  1993.                         npc.anInt1554 = npc.desc.anInt67;
  1994.                         npc.anInt1555 = npc.desc.anInt58;
  1995.                         npc.anInt1556 = npc.desc.anInt83;
  1996.                         npc.anInt1557 = npc.desc.anInt55;
  1997.                         npc.anInt1511 = npc.desc.anInt77;
  1998.                         npc.setPos(myPlayer.smallX[0] + i1, myPlayer.smallY[0] + l, j1 == 1);
  1999.                 }
  2000.                 stream.finishBitAccess();
  2001.         }
  2002.  
  2003.         public void processGameLoop()
  2004.         {
  2005.                 if(rsAlreadyLoaded || loadingError || genericLoadingError)
  2006.                         return;
  2007.                 loopCycle++;
  2008.                 if(!loggedIn)
  2009.                         processLoginScreenInput();
  2010.                 else
  2011.                         mainGameProcessor();
  2012.                 processOnDemandQueue();
  2013.         }
  2014.  
  2015.         private void method47(boolean flag)
  2016.         {
  2017.                 if(myPlayer.x >> 7 == destX && myPlayer.y >> 7 == destY)
  2018.                         destX = 0;
  2019.                 int j = playerCount;
  2020.                 if(flag)
  2021.                         j = 1;
  2022.                 for(int l = 0; l < j; l++)
  2023.                 {
  2024.                         Player player;
  2025.                         int i1;
  2026.                         if(flag)
  2027.                         {
  2028.                                 player = myPlayer;
  2029.                                 i1 = myPlayerIndex << 14;
  2030.                         } else
  2031.                         {
  2032.                                 player = playerArray[playerIndices[l]];
  2033.                                 i1 = playerIndices[l] << 14;
  2034.                         }
  2035.                         if(player == null || !player.isVisible())
  2036.                                 continue;
  2037.                         player.aBoolean1699 = (lowMem && playerCount > 50 || playerCount > 200) && !flag && player.anInt1517 == player.anInt1511;
  2038.                         int j1 = player.x >> 7;
  2039.                         int k1 = player.y >> 7;
  2040.                         if(j1 < 0 || j1 >= 104 || k1 < 0 || k1 >= 104)
  2041.                                 continue;
  2042.                         if(player.aModel_1714 != null && loopCycle >= player.anInt1707 && loopCycle < player.anInt1708)
  2043.                         {
  2044.                                 player.aBoolean1699 = false;
  2045.                                 player.anInt1709 = method42(plane, player.y, player.x);
  2046.                                 worldController.method286(plane, player.y, player, player.anInt1552, player.anInt1722, player.x, player.anInt1709, player.anInt1719, player.anInt1721, i1, player.anInt1720);
  2047.                                 continue;
  2048.                         }
  2049.                         if((player.x & 0x7f) == 64 && (player.y & 0x7f) == 64)
  2050.                         {
  2051.                                 if(anIntArrayArray929[j1][k1] == anInt1265)
  2052.                                         continue;
  2053.                                 anIntArrayArray929[j1][k1] = anInt1265;
  2054.                         }
  2055.                         player.anInt1709 = method42(plane, player.y, player.x);
  2056.                         worldController.method285(plane, player.anInt1552, player.anInt1709, i1, player.y, 60, player.x, player, player.aBoolean1541);
  2057.                 }
  2058.  
  2059.         }
  2060.  
  2061.         private boolean promptUserForInput(RSInterface class9)
  2062.         {
  2063.                 int j = class9.contentType;
  2064.                 if(anInt900 == 2)
  2065.                 {
  2066.                         if(j == 201)
  2067.                         {
  2068.                                 inputTaken = true;
  2069.                                 inputDialogState = 0;
  2070.                                 messagePromptRaised = true;
  2071.                                 promptInput = "";
  2072.                                 friendsListAction = 1;
  2073.                                 aString1121 = "Enter name of friend to add to list";
  2074.                         }
  2075.                         if(j == 202)
  2076.                         {
  2077.                                 inputTaken = true;
  2078.                                 inputDialogState = 0;
  2079.                                 messagePromptRaised = true;
  2080.                                 promptInput = "";
  2081.                                 friendsListAction = 2;
  2082.                                 aString1121 = "Enter name of friend to delete from list";
  2083.                         }
  2084.                 }
  2085.                 if(j == 205)
  2086.                 {
  2087.                         anInt1011 = 250;
  2088.                         return true;
  2089.                 }
  2090.                 if(j == 501)
  2091.                 {
  2092.                         inputTaken = true;
  2093.                         inputDialogState = 0;
  2094.                         messagePromptRaised = true;
  2095.                         promptInput = "";
  2096.                         friendsListAction = 4;
  2097.                         aString1121 = "Enter name of player to add to list";
  2098.                 }
  2099.                 if(j == 502)
  2100.                 {
  2101.                         inputTaken = true;
  2102.                         inputDialogState = 0;
  2103.                         messagePromptRaised = true;
  2104.                         promptInput = "";
  2105.                         friendsListAction = 5;
  2106.                         aString1121 = "Enter name of player to delete from list";
  2107.                 }
  2108.                 if(j >= 300 && j <= 313)
  2109.                 {
  2110.                         int k = (j - 300) / 2;
  2111.                         int j1 = j & 1;
  2112.                         int i2 = anIntArray1065[k];
  2113.                         if(i2 != -1)
  2114.                         {
  2115.                                 do
  2116.                                 {
  2117.                                         if(j1 == 0 && --i2 < 0)
  2118.                                                 i2 = IDK.length - 1;
  2119.                                         if(j1 == 1 && ++i2 >= IDK.length)
  2120.                                                 i2 = 0;
  2121.                                 } while(IDK.cache[i2].aBoolean662 || IDK.cache[i2].anInt657 != k + (aBoolean1047 ? 0 : 7));
  2122.                                 anIntArray1065[k] = i2;
  2123.                                 aBoolean1031 = true;
  2124.                         }
  2125.                 }
  2126.                 if(j >= 314 && j <= 323)
  2127.                 {
  2128.                         int l = (j - 314) / 2;
  2129.                         int k1 = j & 1;
  2130.                         int j2 = anIntArray990[l];
  2131.                         if(k1 == 0 && --j2 < 0)
  2132.                                 j2 = anIntArrayArray1003[l].length - 1;
  2133.                         if(k1 == 1 && ++j2 >= anIntArrayArray1003[l].length)
  2134.                                 j2 = 0;
  2135.                         anIntArray990[l] = j2;
  2136.                         aBoolean1031 = true;
  2137.                 }
  2138.                 if(j == 324 && !aBoolean1047)
  2139.                 {
  2140.                         aBoolean1047 = true;
  2141.                         method45();
  2142.                 }
  2143.                 if(j == 325 && aBoolean1047)
  2144.                 {
  2145.                         aBoolean1047 = false;
  2146.                         method45();
  2147.                 }
  2148.                 if(j == 326)
  2149.                 {
  2150.                         stream.createFrame(101);
  2151.                         stream.writeWordBigEndian(aBoolean1047 ? 0 : 1);
  2152.                         for(int i1 = 0; i1 < 7; i1++)
  2153.                                 stream.writeWordBigEndian(anIntArray1065[i1]);
  2154.  
  2155.                         for(int l1 = 0; l1 < 5; l1++)
  2156.                                 stream.writeWordBigEndian(anIntArray990[l1]);
  2157.  
  2158.                         return true;
  2159.                 }
  2160.                 if(j == 613)
  2161.                         canMute = !canMute;
  2162.                 if(j >= 601 && j <= 612)
  2163.                 {
  2164.                         clearTopInterfaces();
  2165.                         if(reportAbuseInput.length() > 0)
  2166.                         {
  2167.                                 stream.createFrame(218);
  2168.                                 stream.writeQWord(TextClass.longForName(reportAbuseInput));
  2169.                                 stream.writeWordBigEndian(j - 601);
  2170.                                 stream.writeWordBigEndian(canMute ? 1 : 0);
  2171.                         }
  2172.                 }
  2173.                 return false;
  2174.         }
  2175.  
  2176.         private void method49(Stream stream)
  2177.         {
  2178.                 for(int j = 0; j < anInt893; j++)
  2179.                 {
  2180.                         int k = anIntArray894[j];
  2181.                         Player player = playerArray[k];
  2182.                         int l = stream.readUnsignedByte();
  2183.                         if((l & 0x40) != 0)
  2184.                                 l += stream.readUnsignedByte() << 8;
  2185.                         method107(l, k, stream, player);
  2186.                 }
  2187.  
  2188.         }
  2189.  
  2190.         private void method50(int i, int k, int l, int i1, int j1)
  2191.         {
  2192.                 int k1 = worldController.method300(j1, l, i);
  2193.                 if(k1 != 0)
  2194.                 {
  2195.                         int l1 = worldController.method304(j1, l, i, k1);
  2196.                         int k2 = l1 >> 6 & 3;
  2197.                         int i3 = l1 & 0x1f;
  2198.                         int k3 = k;
  2199.                         if(k1 > 0)
  2200.                                 k3 = i1;
  2201.                         int ai[] = aClass30_Sub2_Sub1_Sub1_1263.myPixels;
  2202.                         int k4 = 24624 + l * 4 + (103 - i) * 512 * 4;
  2203.                         int i5 = k1 >> 14 & 0x7fff;
  2204.                         ObjectDef class46_2 = ObjectDef.forID(i5);
  2205.                         if(class46_2.anInt758 != -1)
  2206.                         {
  2207.                                 Background background_2 = mapScenes[class46_2.anInt758];
  2208.                                 if(background_2 != null)
  2209.                                 {
  2210.                                         int i6 = (class46_2.anInt744 * 4 - background_2.anInt1452) / 2;
  2211.                                         int j6 = (class46_2.anInt761 * 4 - background_2.anInt1453) / 2;
  2212.                                         background_2.method361(48 + l * 4 + i6, 48 + (104 - i - class46_2.anInt761) * 4 + j6);
  2213.                                 }
  2214.                         } else
  2215.                         {
  2216.                                 if(i3 == 0 || i3 == 2)
  2217.                                         if(k2 == 0)
  2218.                                         {
  2219.                                                 ai[k4] = k3;
  2220.                                                 ai[k4 + 512] = k3;
  2221.                                                 ai[k4 + 1024] = k3;
  2222.                                                 ai[k4 + 1536] = k3;
  2223.                                         } else
  2224.                                         if(k2 == 1)
  2225.                                         {
  2226.                                                 ai[k4] = k3;
  2227.                                                 ai[k4 + 1] = k3;
  2228.                                                 ai[k4 + 2] = k3;
  2229.                                                 ai[k4 + 3] = k3;
  2230.                                         } else
  2231.                                         if(k2 == 2)
  2232.                                         {
  2233.                                                 ai[k4 + 3] = k3;
  2234.                                                 ai[k4 + 3 + 512] = k3;
  2235.                                                 ai[k4 + 3 + 1024] = k3;
  2236.                                                 ai[k4 + 3 + 1536] = k3;
  2237.                                         } else
  2238.                                         if(k2 == 3)
  2239.                                         {
  2240.                                                 ai[k4 + 1536] = k3;
  2241.                                                 ai[k4 + 1536 + 1] = k3;
  2242.                                                 ai[k4 + 1536 + 2] = k3;
  2243.                                                 ai[k4 + 1536 + 3] = k3;
  2244.                                         }
  2245.                                 if(i3 == 3)
  2246.                                         if(k2 == 0)
  2247.                                                 ai[k4] = k3;
  2248.                                         else
  2249.                                         if(k2 == 1)
  2250.                                                 ai[k4 + 3] = k3;
  2251.                                         else
  2252.                                         if(k2 == 2)
  2253.                                                 ai[k4 + 3 + 1536] = k3;
  2254.                                         else
  2255.                                         if(k2 == 3)
  2256.                                                 ai[k4 + 1536] = k3;
  2257.                                 if(i3 == 2)
  2258.                                         if(k2 == 3)
  2259.                                         {
  2260.                                                 ai[k4] = k3;
  2261.                                                 ai[k4 + 512] = k3;
  2262.                                                 ai[k4 + 1024] = k3;
  2263.                                                 ai[k4 + 1536] = k3;
  2264.                                         } else
  2265.                                         if(k2 == 0)
  2266.                                         {
  2267.                                                 ai[k4] = k3;
  2268.                                                 ai[k4 + 1] = k3;
  2269.                                                 ai[k4 + 2] = k3;
  2270.                                                 ai[k4 + 3] = k3;
  2271.                                         } else
  2272.                                         if(k2 == 1)
  2273.                                         {
  2274.                                                 ai[k4 + 3] = k3;
  2275.                                                 ai[k4 + 3 + 512] = k3;
  2276.                                                 ai[k4 + 3 + 1024] = k3;
  2277.                                                 ai[k4 + 3 + 1536] = k3;
  2278.                                         } else
  2279.                                         if(k2 == 2)
  2280.                                         {
  2281.                                                 ai[k4 + 1536] = k3;
  2282.                                                 ai[k4 + 1536 + 1] = k3;
  2283.                                                 ai[k4 + 1536 + 2] = k3;
  2284.                                                 ai[k4 + 1536 + 3] = k3;
  2285.                                         }
  2286.                         }
  2287.                 }
  2288.                 k1 = worldController.method302(j1, l, i);
  2289.                 if(k1 != 0)
  2290.                 {
  2291.                         int i2 = worldController.method304(j1, l, i, k1);
  2292.                         int l2 = i2 >> 6 & 3;
  2293.                         int j3 = i2 & 0x1f;
  2294.                         int l3 = k1 >> 14 & 0x7fff;
  2295.                         ObjectDef class46_1 = ObjectDef.forID(l3);
  2296.                         if(class46_1.anInt758 != -1)
  2297.                         {
  2298.                                 Background background_1 = mapScenes[class46_1.anInt758];
  2299.                                 if(background_1 != null)
  2300.                                 {
  2301.                                         int j5 = (class46_1.anInt744 * 4 - background_1.anInt1452) / 2;
  2302.                                         int k5 = (class46_1.anInt761 * 4 - background_1.anInt1453) / 2;
  2303.                                         background_1.method361(48 + l * 4 + j5, 48 + (104 - i - class46_1.anInt761) * 4 + k5);
  2304.                                 }
  2305.                         } else
  2306.                         if(j3 == 9)
  2307.                         {
  2308.                                 int l4 = 0xeeeeee;
  2309.                                 if(k1 > 0)
  2310.                                         l4 = 0xee0000;
  2311.                                 int ai1[] = aClass30_Sub2_Sub1_Sub1_1263.myPixels;
  2312.                                 int l5 = 24624 + l * 4 + (103 - i) * 512 * 4;
  2313.                                 if(l2 == 0 || l2 == 2)
  2314.                                 {
  2315.                                         ai1[l5 + 1536] = l4;
  2316.                                         ai1[l5 + 1024 + 1] = l4;
  2317.                                         ai1[l5 + 512 + 2] = l4;
  2318.                                         ai1[l5 + 3] = l4;
  2319.                                 } else
  2320.                                 {
  2321.                                         ai1[l5] = l4;
  2322.                                         ai1[l5 + 512 + 1] = l4;
  2323.                                         ai1[l5 + 1024 + 2] = l4;
  2324.                                         ai1[l5 + 1536 + 3] = l4;
  2325.                                 }
  2326.                         }
  2327.                 }
  2328.                 k1 = worldController.method303(j1, l, i);
  2329.                 if(k1 != 0)
  2330.                 {
  2331.                         int j2 = k1 >> 14 & 0x7fff;
  2332.                         ObjectDef class46 = ObjectDef.forID(j2);
  2333.                         if(class46.anInt758 != -1)
  2334.                         {
  2335.                                 Background background = mapScenes[class46.anInt758];
  2336.                                 if(background != null)
  2337.                                 {
  2338.                                         int i4 = (class46.anInt744 * 4 - background.anInt1452) / 2;
  2339.                                         int j4 = (class46.anInt761 * 4 - background.anInt1453) / 2;
  2340.                                         background.method361(48 + l * 4 + i4, 48 + (104 - i - class46.anInt761) * 4 + j4);
  2341.                                 }
  2342.                         }
  2343.                 }
  2344.         }
  2345.  
  2346.         private void loadTitleScreen()
  2347.         {
  2348.                 aBackground_966 = new Background(titleStreamLoader, "titlebox", 0);
  2349.                 aBackground_967 = new Background(titleStreamLoader, "titlebutton", 0);
  2350.                 aBackgroundArray1152s = new Background[12];
  2351.                 int j = 0;
  2352.                 try
  2353.                 {
  2354.                         j = Integer.parseInt(getParameter("fl_icon"));
  2355.                 }
  2356.                 catch(Exception _ex) { }
  2357.                 if(j == 0)
  2358.                 {
  2359.                         for(int k = 0; k < 12; k++)
  2360.                                 aBackgroundArray1152s[k] = new Background(titleStreamLoader, "runes", k);
  2361.  
  2362.                 } else
  2363.                 {
  2364.                         for(int l = 0; l < 12; l++)
  2365.                                 aBackgroundArray1152s[l] = new Background(titleStreamLoader, "runes", 12 + (l & 3));
  2366.  
  2367.                 }
  2368.                 aClass30_Sub2_Sub1_Sub1_1201 = new Sprite(128, 265);
  2369.                 aClass30_Sub2_Sub1_Sub1_1202 = new Sprite(128, 265);
  2370.                 System.arraycopy(aRSImageProducer_1110.anIntArray315, 0, aClass30_Sub2_Sub1_Sub1_1201.myPixels, 0, 33920);
  2371.  
  2372.                 System.arraycopy(aRSImageProducer_1111.anIntArray315, 0, aClass30_Sub2_Sub1_Sub1_1202.myPixels, 0, 33920);
  2373.  
  2374.                 anIntArray851 = new int[256];
  2375.                 for(int k1 = 0; k1 < 64; k1++)
  2376.                         anIntArray851[k1] = k1 * 0x40000;
  2377.  
  2378.                 for(int l1 = 0; l1 < 64; l1++)
  2379.                         anIntArray851[l1 + 64] = 0xff0000 + 1024 * l1;
  2380.  
  2381.                 for(int i2 = 0; i2 < 64; i2++)
  2382.                         anIntArray851[i2 + 128] = 0xffff00 + 4 * i2;
  2383.  
  2384.                 for(int j2 = 0; j2 < 64; j2++)
  2385.                         anIntArray851[j2 + 192] = 0xffffff;
  2386.  
  2387.                 anIntArray852 = new int[256];
  2388.                 for(int k2 = 0; k2 < 64; k2++)
  2389.                         anIntArray852[k2] = k2 * 1024;
  2390.  
  2391.                 for(int l2 = 0; l2 < 64; l2++)
  2392.                         anIntArray852[l2 + 64] = 65280 + 4 * l2;
  2393.  
  2394.                 for(int i3 = 0; i3 < 64; i3++)
  2395.                         anIntArray852[i3 + 128] = 65535 + 0x40000 * i3;
  2396.  
  2397.                 for(int j3 = 0; j3 < 64; j3++)
  2398.                         anIntArray852[j3 + 192] = 0xffffff;
  2399.  
  2400.                 anIntArray853 = new int[256];
  2401.                 for(int k3 = 0; k3 < 64; k3++)
  2402.                         anIntArray853[k3] = k3 * 4;
  2403.  
  2404.                 for(int l3 = 0; l3 < 64; l3++)
  2405.                         anIntArray853[l3 + 64] = 255 + 0x40000 * l3;
  2406.  
  2407.                 for(int i4 = 0; i4 < 64; i4++)
  2408.                         anIntArray853[i4 + 128] = 0xff00ff + 1024 * i4;
  2409.  
  2410.                 for(int j4 = 0; j4 < 64; j4++)
  2411.                         anIntArray853[j4 + 192] = 0xffffff;
  2412.  
  2413.                 anIntArray850 = new int[256];
  2414.                 anIntArray1190 = new int[32768];
  2415.                 anIntArray1191 = new int[32768];
  2416.                 randomizeBackground(null);
  2417.                 anIntArray828 = new int[32768];
  2418.                 anIntArray829 = new int[32768];
  2419.                 drawLoadingText(10, "Connecting to fileserver");
  2420.                 if(!aBoolean831)
  2421.                 {
  2422.                         drawFlames = true;
  2423.                         aBoolean831 = true;
  2424.                         startRunnable(this, 2);
  2425.                 }
  2426.         }
  2427.  
  2428.         private static void setHighMem()
  2429.         {
  2430.                 WorldController.lowMem = false;
  2431.                 Texture.lowMem = false;
  2432.                 lowMem = false;
  2433.                 ObjectManager.lowMem = false;
  2434.                 ObjectDef.lowMem = false;
  2435.         }
  2436.  
  2437.         public static void main(String args[]) {
  2438.         try {
  2439.             nodeID = 10;
  2440.             portOff = 0;
  2441.             setLowMem();
  2442.             isMembers = true;
  2443.             signlink.storeid = 32;
  2444.             signlink.startpriv(InetAddress.getLocalHost());
  2445.             client client1 = new client();
  2446.             client1.createClientFrame(505, 767);
  2447.         }
  2448.         catch(Exception exception)
  2449.         {
  2450.         }
  2451.     }
  2452.  
  2453.         private void loadingStages()
  2454.         {
  2455.                 if(lowMem && loadingStage == 2 && ObjectManager.anInt131 != plane)
  2456.                 {
  2457.                         aRSImageProducer_1165.initDrawingArea();
  2458.                         aTextDrawingArea_1271.drawText(0, "Loading - please wait.", 151, 257);
  2459.                         aTextDrawingArea_1271.drawText(0xffffff, "Loading - please wait.", 150, 256);
  2460.                         aRSImageProducer_1165.drawGraphics(4, super.graphics, 4);
  2461.                         loadingStage = 1;
  2462.                         aLong824 = System.currentTimeMillis();
  2463.                 }
  2464.                 if(loadingStage == 1)
  2465.                 {
  2466.                         int j = method54();
  2467.                         if(j != 0 && System.currentTimeMillis() - aLong824 > 0x57e40L)
  2468.                         {
  2469.                                 signlink.reporterror(myUsername + " glcfb " + aLong1215 + "," + j + "," + lowMem + "," + decompressors[0] + "," + onDemandFetcher.getNodeCount() + "," + plane + "," + anInt1069 + "," + anInt1070);
  2470.                                 aLong824 = System.currentTimeMillis();
  2471.                         }
  2472.                 }
  2473.                 if(loadingStage == 2 && plane != anInt985)
  2474.                 {
  2475.                         anInt985 = plane;
  2476.                         method24(plane);
  2477.                 }
  2478.         }
  2479.  
  2480.         private int method54()
  2481.         {
  2482.                 for(int i = 0; i < aByteArrayArray1183.length; i++)
  2483.                 {
  2484.                         if(aByteArrayArray1183[i] == null && anIntArray1235[i] != -1)
  2485.                                 return -1;
  2486.                         if(aByteArrayArray1247[i] == null && anIntArray1236[i] != -1)
  2487.                                 return -2;
  2488.                 }
  2489.  
  2490.                 boolean flag = true;
  2491.                 for(int j = 0; j < aByteArrayArray1183.length; j++)
  2492.                 {
  2493.                         byte abyte0[] = aByteArrayArray1247[j];
  2494.                         if(abyte0 != null)
  2495.                         {
  2496.                                 int k = (anIntArray1234[j] >> 8) * 64 - baseX;
  2497.                                 int l = (anIntArray1234[j] & 0xff) * 64 - baseY;
  2498.                                 if(aBoolean1159)
  2499.                                 {
  2500.                                         k = 10;
  2501.                                         l = 10;
  2502.                                 }
  2503.                                 flag &= ObjectManager.method189(k, abyte0, l);
  2504.                         }
  2505.                 }
  2506.  
  2507.                 if(!flag)
  2508.                         return -3;
  2509.                 if(aBoolean1080)
  2510.                 {
  2511.                         return -4;
  2512.                 } else
  2513.                 {
  2514.                         loadingStage = 2;
  2515.                         ObjectManager.anInt131 = plane;
  2516.                         method22();
  2517.                         stream.createFrame(121);
  2518.                         return 0;
  2519.                 }
  2520.         }
  2521.  
  2522.         private void method55()
  2523.         {
  2524.                 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())
  2525.                         if(class30_sub2_sub4_sub4.anInt1597 != plane || loopCycle > class30_sub2_sub4_sub4.anInt1572)
  2526.                                 class30_sub2_sub4_sub4.unlink();
  2527.                         else
  2528.                         if(loopCycle >= class30_sub2_sub4_sub4.anInt1571)
  2529.                         {
  2530.                                 if(class30_sub2_sub4_sub4.anInt1590 > 0)
  2531.                                 {
  2532.                                         NPC npc = npcArray[class30_sub2_sub4_sub4.anInt1590 - 1];
  2533.                                         if(npc != null && npc.x >= 0 && npc.x < 13312 && npc.y >= 0 && npc.y < 13312)
  2534.                                                 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);
  2535.                                 }
  2536.                                 if(class30_sub2_sub4_sub4.anInt1590 < 0)
  2537.                                 {
  2538.                                         int j = -class30_sub2_sub4_sub4.anInt1590 - 1;
  2539.                                         Player player;
  2540.                                         if(j == unknownInt10)
  2541.                                                 player = myPlayer;
  2542.                                         else
  2543.                                                 player = playerArray[j];
  2544.                                         if(player != null && player.x >= 0 && player.x < 13312 && player.y >= 0 && player.y < 13312)
  2545.                                                 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);
  2546.                                 }
  2547.                                 class30_sub2_sub4_sub4.method456(anInt945);
  2548.                                 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);
  2549.                         }
  2550.  
  2551.         }
  2552.  
  2553.         public AppletContext getAppletContext()
  2554.         {
  2555.                 if(signlink.mainapp != null)
  2556.                         return signlink.mainapp.getAppletContext();
  2557.                 else
  2558.                         return super.getAppletContext();
  2559.         }
  2560.  
  2561.         private void drawLogo()
  2562.         {
  2563.                 byte abyte0[] = titleStreamLoader.getDataForName("title.dat");
  2564.                 Sprite sprite = new Sprite(abyte0, this);
  2565.                 aRSImageProducer_1110.initDrawingArea();
  2566.                 sprite.method346(0, 0);
  2567.                 aRSImageProducer_1111.initDrawingArea();
  2568.                 sprite.method346(-637, 0);
  2569.                 aRSImageProducer_1107.initDrawingArea();
  2570.                 sprite.method346(-128, 0);
  2571.                 aRSImageProducer_1108.initDrawingArea();
  2572.                 sprite.method346(-202, -371);
  2573.                 aRSImageProducer_1109.initDrawingArea();
  2574.                 sprite.method346(-202, -171);
  2575.                 aRSImageProducer_1112.initDrawingArea();
  2576.                 sprite.method346(0, -265);
  2577.                 aRSImageProducer_1113.initDrawingArea();
  2578.                 sprite.method346(-562, -265);
  2579.                 aRSImageProducer_1114.initDrawingArea();
  2580.                 sprite.method346(-128, -171);
  2581.                 aRSImageProducer_1115.initDrawingArea();
  2582.                 sprite.method346(-562, -171);
  2583.                 int ai[] = new int[sprite.myWidth];
  2584.                 for(int j = 0; j < sprite.myHeight; j++)
  2585.                 {
  2586.                         for(int k = 0; k < sprite.myWidth; k++)
  2587.                                 ai[k] = sprite.myPixels[(sprite.myWidth - k - 1) + sprite.myWidth * j];
  2588.                        
  2589.                         System.arraycopy(ai, 0, sprite.myPixels, sprite.myWidth * j, sprite.myWidth);
  2590.                 }
  2591.                 /*aRSImageProducer_1110.initDrawingArea();
  2592.                 sprite.method346(382, 0);
  2593.                 aRSImageProducer_1111.initDrawingArea();
  2594.                 sprite.method346(-255, 0);
  2595.                 aRSImageProducer_1107.initDrawingArea();
  2596.                 sprite.method346(254, 0);
  2597.                 aRSImageProducer_1108.initDrawingArea();
  2598.                 sprite.method346(180, -371);
  2599.                 aRSImageProducer_1109.initDrawingArea();
  2600.                 sprite.method346(180, -171);
  2601.                 aRSImageProducer_1112.initDrawingArea();
  2602.                 sprite.method346(382, -265);
  2603.                 aRSImageProducer_1113.initDrawingArea();
  2604.                 sprite.method346(-180, -265);
  2605.                 aRSImageProducer_1114.initDrawingArea();
  2606.                 sprite.method346(254, -171);
  2607.                 aRSImageProducer_1115.initDrawingArea();
  2608.                 sprite.method346(254, -171);
  2609.                 aRSImageProducer_1115.initDrawingArea();
  2610.                 sprite.method346(-180, -171);*/
  2611.                 sprite = null;
  2612.                 Object obj = null;
  2613.                 Object obj1 = null;
  2614.                 System.gc();
  2615.         }
  2616.  
  2617.                 /*      System.arraycopy(ai, 0, sprite.myPixels, sprite.myWidth * j, sprite.myWidth);
  2618.  
  2619.                 }
  2620.  
  2621.                 aRSImageProducer_1110.initDrawingArea();
  2622.                 sprite.method346(382, 0);
  2623.                 aRSImageProducer_1111.initDrawingArea();
  2624.                 sprite.method346(-255, 0);
  2625.                 aRSImageProducer_1107.initDrawingArea();
  2626.                 sprite.method346(254, 0);
  2627.                 aRSImageProducer_1108.initDrawingArea();
  2628.                 sprite.method346(180, -371);
  2629.                 aRSImageProducer_1109.initDrawingArea();
  2630.                 sprite.method346(180, -171);
  2631.                 aRSImageProducer_1112.initDrawingArea();
  2632.                 sprite.method346(382, -265);
  2633.                 aRSImageProducer_1113.initDrawingArea();
  2634.                 sprite.method346(-180, -265);
  2635.                 aRSImageProducer_1114.initDrawingArea();
  2636.                 sprite.method346(254, -171);
  2637.                 aRSImageProducer_1115.initDrawingArea();
  2638.                         sprite.method346(-180, -171);
  2639.                         sprite = new Sprite(titleStreamLoader, "logo", 0);
  2640.                         aRSImageProducer_1107.initDrawingArea();
  2641.                         sprite.drawSprite(382 - sprite.myWidth / 2 - 128, 18);
  2642.                         sprite = null;
  2643.                         Object obj = null;
  2644.                         Object obj1 = null;
  2645.                         System.gc();
  2646.  
  2647.         }*/
  2648.  
  2649.         private void processOnDemandQueue()
  2650.         {
  2651.                 do
  2652.                 {
  2653.                         OnDemandData onDemandData;
  2654.                         do
  2655.                         {
  2656.                                 onDemandData = onDemandFetcher.getNextNode();
  2657.                                 if(onDemandData == null)
  2658.                                         return;
  2659.                                 if(onDemandData.dataType == 0)
  2660.                                 {
  2661.                                         Model.method460(onDemandData.buffer, onDemandData.ID);
  2662.                                         if((onDemandFetcher.getModelIndex(onDemandData.ID) & 0x62) != 0)
  2663.                                         {
  2664.                                                 needDrawTabArea = true;
  2665.                                                 if(backDialogID != -1)
  2666.                                                         inputTaken = true;
  2667.                                         }
  2668.                                 }
  2669.                                 if(onDemandData.dataType == 1 && onDemandData.buffer != null)
  2670.                                         Class36.method529(onDemandData.buffer);
  2671.                                 if(onDemandData.dataType == 2 && onDemandData.ID == nextSong && onDemandData.buffer != null)
  2672.                                         saveMidi(songChanging, onDemandData.buffer);
  2673.                                 if(onDemandData.dataType == 3 && loadingStage == 1)
  2674.                                 {
  2675.                                         for(int i = 0; i < aByteArrayArray1183.length; i++)
  2676.                                         {
  2677.                                                 if(anIntArray1235[i] == onDemandData.ID)
  2678.                                                 {
  2679.                                                         aByteArrayArray1183[i] = onDemandData.buffer;
  2680.                                                         if(onDemandData.buffer == null)
  2681.                                                                 anIntArray1235[i] = -1;
  2682.                                                         break;
  2683.                                                 }
  2684.                                                 if(anIntArray1236[i] != onDemandData.ID)
  2685.                                                         continue;
  2686.                                                 aByteArrayArray1247[i] = onDemandData.buffer;
  2687.                                                 if(onDemandData.buffer == null)
  2688.                                                         anIntArray1236[i] = -1;
  2689.                                                 break;
  2690.                                         }
  2691.  
  2692.                                 }
  2693.                         } while(onDemandData.dataType != 93 || !onDemandFetcher.method564(onDemandData.ID));
  2694.                         ObjectManager.method173(new Stream(onDemandData.buffer), onDemandFetcher);
  2695.                 } while(true);
  2696.         }
  2697.  
  2698.         private void calcFlamesPosition()
  2699.         {
  2700.                 char c = '\u0100';
  2701.                 for(int j = 10; j < 117; j++)
  2702.                 {
  2703.                         int k = (int)(Math.random() * 100D);
  2704.                         if(k < 50)
  2705.                                 anIntArray828[j + (c - 2 << 7)] = 255;
  2706.                 }
  2707.                 for(int l = 0; l < 100; l++)
  2708.                 {
  2709.                         int i1 = (int)(Math.random() * 124D) + 2;
  2710.                         int k1 = (int)(Math.random() * 128D) + 128;
  2711.                         int k2 = i1 + (k1 << 7);
  2712.                         anIntArray828[k2] = 192;
  2713.                 }
  2714.  
  2715.                 for(int j1 = 1; j1 < c - 1; j1++)
  2716.                 {
  2717.                         for(int l1 = 1; l1 < 127; l1++)
  2718.                         {
  2719.                                 int l2 = l1 + (j1 << 7);
  2720.                                 anIntArray829[l2] = (anIntArray828[l2 - 1] + anIntArray828[l2 + 1] + anIntArray828[l2 - 128] + anIntArray828[l2 + 128]) / 4;
  2721.                         }
  2722.  
  2723.                 }
  2724.  
  2725.                 anInt1275 += 128;
  2726.                 if(anInt1275 > anIntArray1190.length)
  2727.                 {
  2728.                         anInt1275 -= anIntArray1190.length;
  2729.                         int i2 = (int)(Math.random() * 12D);
  2730.                         randomizeBackground(aBackgroundArray1152s[i2]);
  2731.                 }
  2732.                 for(int j2 = 1; j2 < c - 1; j2++)
  2733.                 {
  2734.                         for(int i3 = 1; i3 < 127; i3++)
  2735.                         {
  2736.                                 int k3 = i3 + (j2 << 7);
  2737.                                 int i4 = anIntArray829[k3 + 128] - anIntArray1190[k3 + anInt1275 & anIntArray1190.length - 1] / 5;
  2738.                                 if(i4 < 0)
  2739.                                         i4 = 0;
  2740.                                 anIntArray828[k3] = i4;
  2741.                         }
  2742.  
  2743.                 }
  2744.  
  2745.                 System.arraycopy(anIntArray969, 1, anIntArray969, 0, c - 1);
  2746.  
  2747.                 anIntArray969[c - 1] = (int)(Math.sin((double)loopCycle / 14D) * 16D + Math.sin((double)loopCycle / 15D) * 14D + Math.sin((double)loopCycle / 16D) * 12D);
  2748.                 if(anInt1040 > 0)
  2749.                         anInt1040 -= 4;
  2750.                 if(anInt1041 > 0)
  2751.                         anInt1041 -= 4;
  2752.                 if(anInt1040 == 0 && anInt1041 == 0)
  2753.                 {
  2754.                         int l3 = (int)(Math.random() * 2000D);
  2755.                         if(l3 == 0)
  2756.                                 anInt1040 = 1024;
  2757.                         if(l3 == 1)
  2758.                                 anInt1041 = 1024;
  2759.                 }
  2760.         }
  2761.  
  2762.         private boolean saveWave(byte abyte0[], int i)
  2763.         {
  2764.                 return abyte0 == null || signlink.wavesave(abyte0, i);
  2765.         }
  2766.  
  2767.         private void method60(int i)
  2768.         {
  2769.                 RSInterface class9 = RSInterface.interfaceCache[i];
  2770.                 for(int j = 0; j < class9.children.length; j++)
  2771.                 {
  2772.                         if(class9.children[j] == -1)
  2773.                                 break;
  2774.                         RSInterface class9_1 = RSInterface.interfaceCache[class9.children[j]];
  2775.                         if(class9_1.type == 1)
  2776.                                 method60(class9_1.id);
  2777.                         class9_1.anInt246 = 0;
  2778.                         class9_1.anInt208 = 0;
  2779.                 }
  2780.         }
  2781.  
  2782.         private void drawHeadIcon()
  2783.     {
  2784.         if(anInt855 != 2)
  2785.             return;
  2786.         calcEntityScreenPos((anInt934 - baseX << 7) + anInt937, anInt936 * 2, (anInt935 - baseY << 7) + anInt938);
  2787.         if(spriteDrawX > -1 && loopCycle % 20 < 10)
  2788.             headIconsHint[0].drawSprite(spriteDrawX - 12, spriteDrawY - 28);
  2789.     }
  2790.  
  2791.         private void mainGameProcessor()
  2792.         {
  2793.                 if(anInt1104 > 1)
  2794.                         anInt1104--;
  2795.                 if(anInt1011 > 0)
  2796.                         anInt1011--;
  2797.                 for(int j = 0; j < 5; j++)
  2798.                         if(!parsePacket())
  2799.                                 break;
  2800.  
  2801.                 if(!loggedIn)
  2802.                         return;
  2803.                 synchronized(mouseDetection.syncObject)
  2804.                 {
  2805.                         if(flagged)
  2806.                         {
  2807.                                 if(super.clickMode3 != 0 || mouseDetection.coordsIndex >= 40)
  2808.                                 {
  2809.                                         stream.createFrame(45);
  2810.                                         stream.writeWordBigEndian(0);
  2811.                                         int j2 = stream.currentOffset;
  2812.                                         int j3 = 0;
  2813.                                         for(int j4 = 0; j4 < mouseDetection.coordsIndex; j4++)
  2814.                                         {
  2815.                                                 if(j2 - stream.currentOffset >= 240)
  2816.                                                         break;
  2817.                                                 j3++;
  2818.                                                 int l4 = mouseDetection.coordsY[j4];
  2819.                                                 if(l4 < 0)
  2820.                                                         l4 = 0;
  2821.                                                 else
  2822.                                                 if(l4 > 502)
  2823.                                                         l4 = 502;
  2824.                                                 int k5 = mouseDetection.coordsX[j4];
  2825.                                                 if(k5 < 0)
  2826.                                                         k5 = 0;
  2827.                                                 else
  2828.                                                 if(k5 > 764)
  2829.                                                         k5 = 764;
  2830.                                                 int i6 = l4 * 765 + k5;
  2831.                                                 if(mouseDetection.coordsY[j4] == -1 && mouseDetection.coordsX[j4] == -1)
  2832.                                                 {
  2833.                                                         k5 = -1;
  2834.                                                         l4 = -1;
  2835.                                                         i6 = 0x7ffff;
  2836.                                                 }
  2837.                                                 if(k5 == anInt1237 && l4 == anInt1238)
  2838.                                                 {
  2839.                                                         if(anInt1022 < 2047)
  2840.                                                                 anInt1022++;
  2841.                                                 } else
  2842.                                                 {
  2843.                                                         int j6 = k5 - anInt1237;
  2844.                                                         anInt1237 = k5;
  2845.                                                         int k6 = l4 - anInt1238;
  2846.                                                         anInt1238 = l4;
  2847.                                                         if(anInt1022 < 8 && j6 >= -32 && j6 <= 31 && k6 >= -32 && k6 <= 31)
  2848.                                                         {
  2849.                                                                 j6 += 32;
  2850.                                                                 k6 += 32;
  2851.                                                                 stream.writeWord((anInt1022 << 12) + (j6 << 6) + k6);
  2852.                                                                 anInt1022 = 0;
  2853.                                                         } else
  2854.                                                         if(anInt1022 < 8)
  2855.                                                         {
  2856.                                                                 stream.writeDWordBigEndian(0x800000 + (anInt1022 << 19) + i6);
  2857.                                                                 anInt1022 = 0;
  2858.                                                         } else
  2859.                                                         {
  2860.                                                                 stream.writeDWord(0xc0000000 + (anInt1022 << 19) + i6);
  2861.                                                                 anInt1022 = 0;
  2862.                                                         }
  2863.                                                 }
  2864.                                         }
  2865.  
  2866.                                         stream.writeBytes(stream.currentOffset - j2);
  2867.                                         if(j3 >= mouseDetection.coordsIndex)
  2868.                                         {
  2869.                                                 mouseDetection.coordsIndex = 0;
  2870.                                         } else
  2871.                                         {
  2872.                                                 mouseDetection.coordsIndex -= j3;
  2873.                                                 for(int i5 = 0; i5 < mouseDetection.coordsIndex; i5++)
  2874.                                                 {
  2875.                                                         mouseDetection.coordsX[i5] = mouseDetection.coordsX[i5 + j3];
  2876.                                                         mouseDetection.coordsY[i5] = mouseDetection.coordsY[i5 + j3];
  2877.                                                 }
  2878.  
  2879.                                         }
  2880.                                 }
  2881.                         } else
  2882.                         {
  2883.                                 mouseDetection.coordsIndex = 0;
  2884.                         }
  2885.                 }
  2886.                 if(super.clickMode3 != 0)
  2887.                 {
  2888.                         long l = (super.aLong29 - aLong1220) / 50L;
  2889.                         if(l > 4095L)
  2890.                                 l = 4095L;
  2891.                         aLong1220 = super.aLong29;
  2892.                         int k2 = super.saveClickY;
  2893.                         if(k2 < 0)
  2894.                                 k2 = 0;
  2895.                         else
  2896.                         if(k2 > 502)
  2897.                                 k2 = 502;
  2898.                         int k3 = super.saveClickX;
  2899.                         if(k3 < 0)
  2900.                                 k3 = 0;
  2901.                         else
  2902.                         if(k3 > 764)
  2903.                                 k3 = 764;
  2904.                         int k4 = k2 * 765 + k3;
  2905.                         int j5 = 0;
  2906.                         if(super.clickMode3 == 2)
  2907.                                 j5 = 1;
  2908.                         int l5 = (int)l;
  2909.                         stream.createFrame(241);
  2910.                         stream.writeDWord((l5 << 20) + (j5 << 19) + k4);
  2911.                 }
  2912.                 if(anInt1016 > 0)
  2913.                         anInt1016--;
  2914.                 if(super.keyArray[1] == 1 || super.keyArray[2] == 1 || super.keyArray[3] == 1 || super.keyArray[4] == 1)
  2915.                         aBoolean1017 = true;
  2916.                 if(aBoolean1017 && anInt1016 <= 0)
  2917.                 {
  2918.                         anInt1016 = 20;
  2919.                         aBoolean1017 = false;
  2920.                         stream.createFrame(86);
  2921.                         stream.writeWord(anInt1184);
  2922.                         stream.method432(minimapInt1);
  2923.                 }
  2924.                 if(super.awtFocus && !aBoolean954)
  2925.                 {
  2926.                         aBoolean954 = true;
  2927.                         stream.createFrame(3);
  2928.                         stream.writeWordBigEndian(1);
  2929.                 }
  2930.                 if(!super.awtFocus && aBoolean954)
  2931.                 {
  2932.                         aBoolean954 = false;
  2933.                         stream.createFrame(3);
  2934.                         stream.writeWordBigEndian(0);
  2935.                 }
  2936.                 loadingStages();
  2937.                 method115();
  2938.                 method90();
  2939.                 anInt1009++;
  2940.                 if(anInt1009 > 750)
  2941.                         dropClient();
  2942.                 method114();
  2943.                 method95();
  2944.                 method38();
  2945.                 anInt945++;
  2946.                 if(crossType != 0)
  2947.                 {
  2948.                         crossIndex += 20;
  2949.                         if(crossIndex >= 400)
  2950.                                 crossType = 0;
  2951.                 }
  2952.                 if(atInventoryInterfaceType != 0)
  2953.                 {
  2954.                         atInventoryLoopCycle++;
  2955.                         if(atInventoryLoopCycle >= 15)
  2956.                         {
  2957.                                 if(atInventoryInterfaceType == 2)
  2958.                                         needDrawTabArea = true;
  2959.                                 if(atInventoryInterfaceType == 3)
  2960.                                         inputTaken = true;
  2961.                                 atInventoryInterfaceType = 0;
  2962.                         }
  2963.                 }
  2964.                 if(activeInterfaceType != 0)
  2965.                 {
  2966.                         anInt989++;
  2967.                         if(super.mouseX > anInt1087 + 5 || super.mouseX < anInt1087 - 5 || super.mouseY > anInt1088 + 5 || super.mouseY < anInt1088 - 5)
  2968.                                 aBoolean1242 = true;
  2969.                         if(super.clickMode2 == 0)
  2970.                         {
  2971.                                 if(activeInterfaceType == 2)
  2972.                                         needDrawTabArea = true;
  2973.                                 if(activeInterfaceType == 3)
  2974.                                         inputTaken = true;
  2975.                                 activeInterfaceType = 0;
  2976.                                 if(aBoolean1242 && anInt989 >= 5)
  2977.                                 {
  2978.                                         lastActiveInvInterface = -1;
  2979.                                         processRightClick();
  2980.                                         if(lastActiveInvInterface == anInt1084 && mouseInvInterfaceIndex != anInt1085)
  2981.                                         {
  2982.                                                 RSInterface class9 = RSInterface.interfaceCache[anInt1084];
  2983.                                                 int j1 = 0;
  2984.                                                 if(anInt913 == 1 && class9.contentType == 206)
  2985.                                                         j1 = 1;
  2986.                                                 if(class9.inv[mouseInvInterfaceIndex] <= 0)
  2987.                                                         j1 = 0;
  2988.                                                 if(class9.aBoolean235)
  2989.                                                 {
  2990.                                                         int l2 = anInt1085;
  2991.                                                         int l3 = mouseInvInterfaceIndex;
  2992.                                                         class9.inv[l3] = class9.inv[l2];
  2993.                                                         class9.invStackSizes[l3] = class9.invStackSizes[l2];
  2994.                                                         class9.inv[l2] = -1;
  2995.                                                         class9.invStackSizes[l2] = 0;
  2996.                                                 } else
  2997.                                                 if(j1 == 1)
  2998.                                                 {
  2999.                                                         int i3 = anInt1085;
  3000.                                                         for(int i4 = mouseInvInterfaceIndex; i3 != i4;)
  3001.                                                                 if(i3 > i4)
  3002.                                                                 {
  3003.                                                                         class9.swapInventoryItems(i3, i3 - 1);
  3004.                                                                         i3--;
  3005.                                                                 } else
  3006.                                                                 if(i3 < i4)
  3007.                                                                 {
  3008.                                                                         class9.swapInventoryItems(i3, i3 + 1);
  3009.                                                                         i3++;
  3010.                                                                 }
  3011.  
  3012.                                                 } else
  3013.                                                 {
  3014.                                                         class9.swapInventoryItems(anInt1085, mouseInvInterfaceIndex);
  3015.                                                 }
  3016.                                                 stream.createFrame(214);
  3017.                                                 stream.method433(anInt1084);
  3018.                                                 stream.method424(j1);
  3019.                                                 stream.method433(anInt1085);
  3020.                                                 stream.method431(mouseInvInterfaceIndex);
  3021.                                         }
  3022.                                 } else
  3023.                                 if((anInt1253 == 1 || menuHasAddFriend(menuActionRow - 1)) && menuActionRow > 2)
  3024.                                         determineMenuSize();
  3025.                                 else
  3026.                                 if(menuActionRow > 0)
  3027.                                         doAction(menuActionRow - 1);
  3028.                                 atInventoryLoopCycle = 10;
  3029.                                 super.clickMode3 = 0;
  3030.                         }
  3031.                 }
  3032.                 if(WorldController.anInt470 != -1)
  3033.                 {
  3034.                         int k = WorldController.anInt470;
  3035.                         int k1 = WorldController.anInt471;
  3036.                         boolean flag = doWalkTo(0, 0, 0, 0, myPlayer.smallY[0], 0, 0, k1, myPlayer.smallX[0], true, k);
  3037.                         WorldController.anInt470 = -1;
  3038.                         if(flag)
  3039.                         {
  3040.                                 crossX = super.saveClickX;
  3041.                                 crossY = super.saveClickY;
  3042.                                 crossType = 1;
  3043.                                 crossIndex = 0;
  3044.                         }
  3045.                 }
  3046.                 if(super.clickMode3 == 1 && aString844 != null)
  3047.                 {
  3048.                         aString844 = null;
  3049.                         inputTaken = true;
  3050.                         super.clickMode3 = 0;
  3051.                 }
  3052.                 processMenuClick();
  3053.                 processMainScreenClick();
  3054.                 processTabClick();
  3055.                 processMapAreaClick();
  3056.                 processChatModeClick();
  3057.                 if(super.clickMode2 == 1 || super.clickMode3 == 1)
  3058.                         anInt1213++;
  3059.                 if(loadingStage == 2)
  3060.                         method108();
  3061.                 if(loadingStage == 2 && aBoolean1160)
  3062.                         calcCameraPos();
  3063.                 for(int i1 = 0; i1 < 5; i1++)
  3064.                         anIntArray1030[i1]++;
  3065.  
  3066.                 method73();
  3067.                 super.idleTime++;
  3068.                 if(super.idleTime > 4500)
  3069.                 {
  3070.                         anInt1011 = 250;
  3071.                         super.idleTime -= 500;
  3072.                         stream.createFrame(202);
  3073.                 }
  3074.                 anInt988++;
  3075.                 if(anInt988 > 500)
  3076.                 {
  3077.                         anInt988 = 0;
  3078.                         int l1 = (int)(Math.random() * 8D);
  3079.                         if((l1 & 1) == 1)
  3080.                                 anInt1278 += anInt1279;
  3081.                         if((l1 & 2) == 2)
  3082.                                 anInt1131 += anInt1132;
  3083.                         if((l1 & 4) == 4)
  3084.                                 anInt896 += anInt897;
  3085.                 }
  3086.                 if(anInt1278 < -50)
  3087.                         anInt1279 = 2;
  3088.                 if(anInt1278 > 50)
  3089.                         anInt1279 = -2;
  3090.                 if(anInt1131 < -55)
  3091.                         anInt1132 = 2;
  3092.                 if(anInt1131 > 55)
  3093.                         anInt1132 = -2;
  3094.                 if(anInt896 < -40)
  3095.                         anInt897 = 1;
  3096.                 if(anInt896 > 40)
  3097.                         anInt897 = -1;
  3098.                 anInt1254++;
  3099.                 if(anInt1254 > 500)
  3100.                 {
  3101.                         anInt1254 = 0;
  3102.                         int i2 = (int)(Math.random() * 8D);
  3103.                         if((i2 & 1) == 1)
  3104.                                 minimapInt2 += anInt1210;
  3105.                         if((i2 & 2) == 2)
  3106.                                 minimapInt3 += anInt1171;
  3107.                 }
  3108.                 if(minimapInt2 < -60)
  3109.                         anInt1210 = 2;
  3110.                 if(minimapInt2 > 60)
  3111.                         anInt1210 = -2;
  3112.                 if(minimapInt3 < -20)
  3113.                         anInt1171 = 1;
  3114.                 if(minimapInt3 > 10)
  3115.                         anInt1171 = -1;
  3116.                 anInt1010++;
  3117.                 if(anInt1010 > 50)
  3118.                         stream.createFrame(0);
  3119.                 try
  3120.                 {
  3121.                         if(socketStream != null && stream.currentOffset > 0)
  3122.                         {
  3123.                                 socketStream.queueBytes(stream.currentOffset, stream.buffer);
  3124.                                 stream.currentOffset = 0;
  3125.                                 anInt1010 = 0;
  3126.                         }
  3127.                 }
  3128.                 catch(IOException _ex)
  3129.                 {
  3130.                         dropClient();
  3131.                 }
  3132.                 catch(Exception exception)
  3133.                 {
  3134.                         resetLogout();
  3135.                 }
  3136.         }
  3137.  
  3138.         private void method63()
  3139.         {
  3140.                 Class30_Sub1 class30_sub1 = (Class30_Sub1)aClass19_1179.reverseGetFirst();
  3141.                 for(; class30_sub1 != null; class30_sub1 = (Class30_Sub1)aClass19_1179.reverseGetNext())
  3142.                         if(class30_sub1.anInt1294 == -1)
  3143.                         {
  3144.                                 class30_sub1.anInt1302 = 0;
  3145.                                 method89(class30_sub1);
  3146.                         } else
  3147.                         {
  3148.                                 class30_sub1.unlink();
  3149.                         }
  3150.  
  3151.         }
  3152.  
  3153.         private void resetImageProducers()
  3154.         {
  3155.                 if(aRSImageProducer_1107 != null)
  3156.                         return;
  3157.                 super.fullGameScreen = null;
  3158.                 aRSImageProducer_1166 = null;
  3159.                 aRSImageProducer_1164 = null;
  3160.                 aRSImageProducer_1163 = null;
  3161.                 aRSImageProducer_1165 = null;
  3162.                 aRSImageProducer_1123 = null;
  3163.                 aRSImageProducer_1124 = null;
  3164.                 aRSImageProducer_1125 = null;
  3165.                 aRSImageProducer_1110 = new RSImageProducer(128, 265, getGameComponent());
  3166.                 DrawingArea.setAllPixelsToZero();
  3167.                 aRSImageProducer_1111 = new RSImageProducer(128, 265, getGameComponent());
  3168.                 DrawingArea.setAllPixelsToZero();
  3169.                 aRSImageProducer_1107 = new RSImageProducer(509, 171, getGameComponent());
  3170.                 DrawingArea.setAllPixelsToZero();
  3171.                 aRSImageProducer_1108 = new RSImageProducer(360, 132, getGameComponent());
  3172.                 DrawingArea.setAllPixelsToZero();
  3173.                 aRSImageProducer_1109 = new RSImageProducer(360, 200, getGameComponent());
  3174.                 DrawingArea.setAllPixelsToZero();
  3175.                 aRSImageProducer_1112 = new RSImageProducer(202, 238, getGameComponent());
  3176.                 DrawingArea.setAllPixelsToZero();
  3177.                 aRSImageProducer_1113 = new RSImageProducer(203, 238, getGameComponent());
  3178.                 DrawingArea.setAllPixelsToZero();
  3179.                 aRSImageProducer_1114 = new RSImageProducer(74, 94, getGameComponent());
  3180.                 DrawingArea.setAllPixelsToZero();
  3181.                 aRSImageProducer_1115 = new RSImageProducer(75, 94, getGameComponent());
  3182.                 DrawingArea.setAllPixelsToZero();
  3183.                 if(titleStreamLoader != null)
  3184.                 {
  3185.                         drawLogo();
  3186.                         loadTitleScreen();
  3187.                 }
  3188.                 welcomeScreenRaised = true;
  3189.         }
  3190.  
  3191.         void drawLoadingText(int i, String s)
  3192.         {
  3193.                 anInt1079 = i;
  3194.                 aString1049 = s;
  3195.                 resetImageProducers();
  3196.                 if(titleStreamLoader == null)
  3197.                 {
  3198.                         super.drawLoadingText(i, s);
  3199.                         return;
  3200.                 }
  3201.                 aRSImageProducer_1109.initDrawingArea();
  3202.                 char c = '\u0168';
  3203.                 char c1 = '\310';
  3204.                 byte byte1 = 20;
  3205.                 chatTextDrawingArea.drawText(0xffffff, "Peractorum is loading - please wait...", c1 / 2 - 26 - byte1, c / 2);
  3206.                 int j = c1 / 2 - 18 - byte1;
  3207.                 DrawingArea.fillPixels(c / 2 - 152, 304, 34, 0x8c1111, j);
  3208.                 DrawingArea.fillPixels(c / 2 - 151, 302, 32, 0, j + 1);
  3209.                 DrawingArea.drawPixels(30, j + 2, c / 2 - 150, 0x8c1111, i * 3);
  3210.                 DrawingArea.drawPixels(30, j + 2, (c / 2 - 150) + i * 3, 0, 300 - i * 3);
  3211.                 chatTextDrawingArea.drawText(0xffffff, s, (c1 / 2 + 5) - byte1, c / 2);
  3212.                 aRSImageProducer_1109.drawGraphics(171, super.graphics, 202);
  3213.                 if(welcomeScreenRaised)
  3214.                 {
  3215.                         welcomeScreenRaised = false;
  3216.                         if(!aBoolean831)
  3217.                         {
  3218.                                 aRSImageProducer_1110.drawGraphics(0, super.graphics, 0);
  3219.                                 aRSImageProducer_1111.drawGraphics(0, super.graphics, 637);
  3220.                         }
  3221.                         aRSImageProducer_1107.drawGraphics(0, super.graphics, 128);
  3222.                         aRSImageProducer_1108.drawGraphics(371, super.graphics, 202);
  3223.                         aRSImageProducer_1112.drawGraphics(265, super.graphics, 0);
  3224.                         aRSImageProducer_1113.drawGraphics(265, super.graphics, 562);
  3225.                         aRSImageProducer_1114.drawGraphics(171, super.graphics, 128);
  3226.                         aRSImageProducer_1115.drawGraphics(171, super.graphics, 562);
  3227.                 }
  3228.         }
  3229.  
  3230.         private void method65(int i, int j, int k, int l, RSInterface class9, int i1, boolean flag,
  3231.                                                   int j1)
  3232.         {
  3233.                 int anInt992;
  3234.                 if(aBoolean972)
  3235.                         anInt992 = 32;
  3236.                 else
  3237.                         anInt992 = 0;
  3238.                 aBoolean972 = false;
  3239.                 if(k >= i && k < i + 16 && l >= i1 && l < i1 + 16)
  3240.                 {
  3241.                         class9.scrollPosition -= anInt1213 * 4;
  3242.                         if(flag)
  3243.                         {
  3244.                                 needDrawTabArea = true;
  3245.                         }
  3246.                 } else
  3247.                 if(k >= i && k < i + 16 && l >= (i1 + j) - 16 && l < i1 + j)
  3248.                 {
  3249.                         class9.scrollPosition += anInt1213 * 4;
  3250.                         if(flag)
  3251.                         {
  3252.                                 needDrawTabArea = true;
  3253.                         }
  3254.                 } else
  3255.                 if(k >= i - anInt992 && k < i + 16 + anInt992 && l >= i1 + 16 && l < (i1 + j) - 16 && anInt1213 > 0)
  3256.                 {
  3257.                         int l1 = ((j - 32) * j) / j1;
  3258.                         if(l1 < 8)
  3259.                                 l1 = 8;
  3260.                         int i2 = l - i1 - 16 - l1 / 2;
  3261.                         int j2 = j - 32 - l1;
  3262.                         class9.scrollPosition = ((j1 - j) * i2) / j2;
  3263.                         if(flag)
  3264.                                 needDrawTabArea = true;
  3265.                         aBoolean972 = true;
  3266.                 }
  3267.         }
  3268.  
  3269.         private boolean method66(int i, int j, int k)
  3270.         {
  3271.                 int i1 = i >> 14 & 0x7fff;
  3272.                 int j1 = worldController.method304(plane, k, j, i);
  3273.                 if(j1 == -1)
  3274.                         return false;
  3275.                 int k1 = j1 & 0x1f;
  3276.                 int l1 = j1 >> 6 & 3;
  3277.                 if(k1 == 10 || k1 == 11 || k1 == 22)
  3278.                 {
  3279.                         ObjectDef class46 = ObjectDef.forID(i1);
  3280.                         int i2;
  3281.                         int j2;
  3282.                         if(l1 == 0 || l1 == 2)
  3283.                         {
  3284.                                 i2 = class46.anInt744;
  3285.                                 j2 = class46.anInt761;
  3286.                         } else
  3287.                         {
  3288.                                 i2 = class46.anInt761;
  3289.                                 j2 = class46.anInt744;
  3290.                         }
  3291.                         int k2 = class46.anInt768;
  3292.                         if(l1 != 0)
  3293.                                 k2 = (k2 << l1 & 0xf) + (k2 >> 4 - l1);
  3294.                         doWalkTo(2, 0, j2, 0, myPlayer.smallY[0], i2, k2, j, myPlayer.smallX[0], false, k);
  3295.                 } else
  3296.                 {
  3297.                         doWalkTo(2, l1, 0, k1 + 1, myPlayer.smallY[0], 0, 0, j, myPlayer.smallX[0], false, k);
  3298.                 }
  3299.                 crossX = super.saveClickX;
  3300.                 crossY = super.saveClickY;
  3301.                 crossType = 2;
  3302.                 crossIndex = 0;
  3303.                 return true;
  3304.         }
  3305.  
  3306.         private StreamLoader streamLoaderForName(int i, String s, String s1, int j, int k)
  3307.         {
  3308.                 byte abyte0[] = null;
  3309.                 int l = 5;
  3310.                 try
  3311.                 {
  3312.                         if(decompressors[0] != null)
  3313.                                 abyte0 = decompressors[0].decompress(i);
  3314.                 }
  3315.                 catch(Exception _ex) { }
  3316.                 if(abyte0 != null)
  3317.                 {
  3318.         //              aCRC32_930.reset();
  3319.         //              aCRC32_930.update(abyte0);
  3320.         //              int i1 = (int)aCRC32_930.getValue();
  3321.         //              if(i1 != j)
  3322.                 }
  3323.                 if(abyte0 != null)
  3324.                 {
  3325.                         StreamLoader streamLoader = new StreamLoader(abyte0);
  3326.                         return streamLoader;
  3327.                 }
  3328.                 int j1 = 0;
  3329.                 while(abyte0 == null)
  3330.                 {
  3331.                         String s2 = "Unknown error";
  3332.                         drawLoadingText(k, "Requesting " + s);
  3333.                         Object obj = null;
  3334.                         try
  3335.                         {
  3336.                                 int k1 = 0;
  3337.                                 DataInputStream datainputstream = openJagGrabInputStream(s1 + j);
  3338.                                 byte abyte1[] = new byte[6];
  3339.                                 datainputstream.readFully(abyte1, 0, 6);
  3340.                                 Stream stream = new Stream(abyte1);
  3341.                                 stream.currentOffset = 3;
  3342.                                 int i2 = stream.read3Bytes() + 6;
  3343.                                 int j2 = 6;
  3344.                                 abyte0 = new byte[i2];
  3345.                                 System.arraycopy(abyte1, 0, abyte0, 0, 6);
  3346.  
  3347.                                 while(j2 < i2)
  3348.                                 {
  3349.                                         int l2 = i2 - j2;
  3350.                                         if(l2 > 1000)
  3351.                                                 l2 = 1000;
  3352.                                         int j3 = datainputstream.read(abyte0, j2, l2);
  3353.                                         if(j3 < 0)
  3354.                                         {
  3355.                                                 s2 = "Length error: " + j2 + "/" + i2;
  3356.                                                 throw new IOException("EOF");
  3357.                                         }
  3358.                                         j2 += j3;
  3359.                                         int k3 = (j2 * 100) / i2;
  3360.                                         if(k3 != k1)
  3361.                                                 drawLoadingText(k, "Loading " + s + " - " + k3 + "%");
  3362.                                         k1 = k3;
  3363.                                 }
  3364.                                 datainputstream.close();
  3365.                                 try
  3366.                                 {
  3367.                                         if(decompressors[0] != null)
  3368.                                                 decompressors[0].method234(abyte0.length, abyte0, i);
  3369.                                 }
  3370.                                 catch(Exception _ex)
  3371.                                 {
  3372.                                         decompressors[0] = null;
  3373.                                 }
  3374.    /*                    if(abyte0 != null)
  3375.                                 {
  3376.                                         aCRC32_930.reset();
  3377.                                         aCRC32_930.update(abyte0);
  3378.                                         int i3 = (int)aCRC32_930.getValue();
  3379.                                         if(i3 != j)
  3380.                                         {
  3381.                                                 abyte0 = null;
  3382.                                                 j1++;
  3383.                                                 s2 = "Checksum error: " + i3;
  3384.                                         }
  3385.                                 }
  3386.   */
  3387.                         }
  3388.                         catch(IOException ioexception)
  3389.                         {
  3390.                                 if(s2.equals("Unknown error"))
  3391.                                         s2 = "Connection error";
  3392.                                 abyte0 = null;
  3393.                         }
  3394.                         catch(NullPointerException _ex)
  3395.                         {
  3396.                                 s2 = "Null error";
  3397.                                 abyte0 = null;
  3398.                                 if(!signlink.reporterror)
  3399.                                         return null;
  3400.                         }
  3401.                         catch(ArrayIndexOutOfBoundsException _ex)
  3402.                         {
  3403.                                 s2 = "Bounds error";
  3404.                                 abyte0 = null;
  3405.                                 if(!signlink.reporterror)
  3406.                                         return null;
  3407.                         }
  3408.                         catch(Exception _ex)
  3409.                         {
  3410.                                 s2 = "Unexpected error";
  3411.                                 abyte0 = null;
  3412.                                 if(!signlink.reporterror)
  3413.                                         return null;
  3414.                         }
  3415.                         if(abyte0 == null)
  3416.                         {
  3417.                                 for(int l1 = l; l1 > 0; l1--)
  3418.                                 {
  3419.                                         if(j1 >= 3)
  3420.                                         {
  3421.                                                 drawLoadingText(k, "Game updated - please reload page");
  3422.                                                 l1 = 10;
  3423.                                         } else
  3424.                                         {
  3425.                                                 drawLoadingText(k, s2 + " - Retrying in " + l1);
  3426.                                         }
  3427.                                         try
  3428.                                         {
  3429.                                                 Thread.sleep(1000L);
  3430.                                         }
  3431.                                         catch(Exception _ex) { }
  3432.                                 }
  3433.  
  3434.                                 l *= 2;
  3435.                                 if(l > 60)
  3436.                                         l = 60;
  3437.                                 aBoolean872 = !aBoolean872;
  3438.                         }
  3439.  
  3440.                 }
  3441.  
  3442.                 StreamLoader streamLoader_1 = new StreamLoader(abyte0);
  3443.                         return streamLoader_1;
  3444.         }
  3445.  
  3446.         private void dropClient()
  3447.         {
  3448.                 if(anInt1011 > 0)
  3449.                 {
  3450.                         resetLogout();
  3451.                         return;
  3452.                 }
  3453.                 aRSImageProducer_1165.initDrawingArea();
  3454.                 aTextDrawingArea_1271.drawText(0, "Connection lost", 144, 257);
  3455.                 aTextDrawingArea_1271.drawText(0xffffff, "Connection lost", 143, 256);
  3456.                 aTextDrawingArea_1271.drawText(0, "Please wait - attempting to reestablish", 159, 257);
  3457.                 aTextDrawingArea_1271.drawText(0xffffff, "Please wait - attempting to reestablish", 158, 256);
  3458.                 aRSImageProducer_1165.drawGraphics(4, super.graphics, 4);
  3459.                 anInt1021 = 0;
  3460.                 destX = 0;
  3461.                 RSSocket rsSocket = socketStream;
  3462.                 loggedIn = false;
  3463.                 loginFailures = 0;
  3464.                 login(myUsername, myPassword, true);
  3465.                 if(!loggedIn)
  3466.                         resetLogout();
  3467.                 try
  3468.                 {
  3469.                         rsSocket.close();
  3470.                 }
  3471.                 catch(Exception _ex)
  3472.                 {
  3473.                 }
  3474.         }
  3475.  
  3476.         private void doAction(int i)
  3477.         {
  3478.                 if(i < 0)
  3479.                         return;
  3480.                 if(inputDialogState != 0)
  3481.                 {
  3482.                         inputDialogState = 0;
  3483.                         inputTaken = true;
  3484.                 }
  3485.                 int j = menuActionCmd2[i];
  3486.                 int k = menuActionCmd3[i];
  3487.                 int l = menuActionID[i];
  3488.                 int i1 = menuActionCmd1[i];
  3489.                 if(l >= 2000)
  3490.                         l -= 2000;
  3491.                 if(l == 582)
  3492.                 {
  3493.                         NPC npc = npcArray[i1];
  3494.                         if(npc != null)
  3495.                         {
  3496.                                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, npc.smallY[0], myPlayer.smallX[0], false, npc.smallX[0]);
  3497.                                 crossX = super.saveClickX;
  3498.                                 crossY = super.saveClickY;
  3499.                                 crossType = 2;
  3500.                                 crossIndex = 0;
  3501.                                 stream.createFrame(57);
  3502.                                 stream.method432(anInt1285);
  3503.                                 stream.method432(i1);
  3504.                                 stream.method431(anInt1283);
  3505.                                 stream.method432(anInt1284);
  3506.                         }
  3507.                 }
  3508.                 if(l == 234)
  3509.                 {
  3510.                         boolean flag1 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k, myPlayer.smallX[0], false, j);
  3511.                         if(!flag1)
  3512.                                 flag1 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k, myPlayer.smallX[0], false, j);
  3513.                         crossX = super.saveClickX;
  3514.                         crossY = super.saveClickY;
  3515.                         crossType = 2;
  3516.                         crossIndex = 0;
  3517.                         stream.createFrame(236);
  3518.                         stream.method431(k + baseY);
  3519.                         stream.writeWord(i1);
  3520.                         stream.method431(j + baseX);
  3521.                 }
  3522.                 if(l == 62 && method66(i1, k, j))
  3523.                 {
  3524.                         stream.createFrame(192);
  3525.                         stream.writeWord(anInt1284);
  3526.                         stream.method431(i1 >> 14 & 0x7fff);
  3527.                         stream.method433(k + baseY);
  3528.                         stream.method431(anInt1283);
  3529.                         stream.method433(j + baseX);
  3530.                         stream.writeWord(anInt1285);
  3531.                 }
  3532.                 if(l == 511)
  3533.                 {
  3534.                         boolean flag2 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k, myPlayer.smallX[0], false, j);
  3535.                         if(!flag2)
  3536.                                 flag2 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k, myPlayer.smallX[0], false, j);
  3537.                         crossX = super.saveClickX;
  3538.                         crossY = super.saveClickY;
  3539.                         crossType = 2;
  3540.                         crossIndex = 0;
  3541.                         stream.createFrame(25);
  3542.                         stream.method431(anInt1284);
  3543.                         stream.method432(anInt1285);
  3544.                         stream.writeWord(i1);
  3545.                         stream.method432(k + baseY);
  3546.                         stream.method433(anInt1283);
  3547.                         stream.writeWord(j + baseX);
  3548.                 }
  3549.                 if(l == 74)
  3550.                 {
  3551.                         stream.createFrame(122);
  3552.                         stream.method433(k);
  3553.                         stream.method432(j);
  3554.                         stream.method431(i1);
  3555.                         atInventoryLoopCycle = 0;
  3556.                         atInventoryInterface = k;
  3557.                         atInventoryIndex = j;
  3558.                         atInventoryInterfaceType = 2;
  3559.                         if(RSInterface.interfaceCache[k].parentID == openInterfaceID)
  3560.                                 atInventoryInterfaceType = 1;
  3561.                         if(RSInterface.interfaceCache[k].parentID == backDialogID)
  3562.                                 atInventoryInterfaceType = 3;
  3563.                 }
  3564.                 if(l == 315)
  3565.                 {
  3566.                         RSInterface class9 = RSInterface.interfaceCache[k];
  3567.                         boolean flag8 = true;
  3568.                         if(class9.contentType > 0)
  3569.                                 flag8 = promptUserForInput(class9);
  3570.                         if(flag8)
  3571.                         {
  3572.                                 stream.createFrame(185);
  3573.                                 stream.writeWord(k);
  3574.                         }
  3575.                 }
  3576.                 if(l == 561)
  3577.                 {
  3578.                         Player player = playerArray[i1];
  3579.                         if(player != null)
  3580.                         {
  3581.                                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, player.smallY[0], myPlayer.smallX[0], false, player.smallX[0]);
  3582.                                 crossX = super.saveClickX;
  3583.                                 crossY = super.saveClickY;
  3584.                                 crossType = 2;
  3585.                                 crossIndex = 0;
  3586.                                 anInt1188 += i1;
  3587.                                 if(anInt1188 >= 90)
  3588.                                 {
  3589.                                         stream.createFrame(136);
  3590.                                         anInt1188 = 0;
  3591.                                 }
  3592.                                 stream.createFrame(128);
  3593.                                 stream.writeWord(i1);
  3594.                         }
  3595.                 }
  3596.                 if(l == 20)
  3597.                 {
  3598.                         NPC class30_sub2_sub4_sub1_sub1_1 = npcArray[i1];
  3599.                         if(class30_sub2_sub4_sub1_sub1_1 != null)
  3600.                         {
  3601.                                 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]);
  3602.                                 crossX = super.saveClickX;
  3603.                                 crossY = super.saveClickY;
  3604.                                 crossType = 2;
  3605.                                 crossIndex = 0;
  3606.                                 stream.createFrame(155);
  3607.                                 stream.method431(i1);
  3608.                         }
  3609.                 }
  3610.                 if(l == 779)
  3611.                 {
  3612.                         Player class30_sub2_sub4_sub1_sub2_1 = playerArray[i1];
  3613.                         if(class30_sub2_sub4_sub1_sub2_1 != null)
  3614.                         {
  3615.                                 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]);
  3616.                                 crossX = super.saveClickX;
  3617.                                 crossY = super.saveClickY;
  3618.                                 crossType = 2;
  3619.                                 crossIndex = 0;
  3620.                                 stream.createFrame(153);
  3621.                                 stream.method431(i1);
  3622.                         }
  3623.                 }
  3624.                 if(l == 516)
  3625.                         if(!menuOpen)
  3626.                                 worldController.method312(super.saveClickY - 4, super.saveClickX - 4);
  3627.                         else
  3628.                                 worldController.method312(k - 4, j - 4);
  3629.                 if(l == 1062)
  3630.                 {
  3631.                         anInt924 += baseX;
  3632.                         if(anInt924 >= 113)
  3633.                         {
  3634.                                 stream.createFrame(183);
  3635.                                 stream.writeDWordBigEndian(0xe63271);
  3636.                                 anInt924 = 0;
  3637.                         }
  3638.                         method66(i1, k, j);
  3639.                         stream.createFrame(228);
  3640.                         stream.method432(i1 >> 14 & 0x7fff);
  3641.                         stream.method432(k + baseY);
  3642.                         stream.writeWord(j + baseX);
  3643.                 }
  3644.                 if(l == 679 && !aBoolean1149)
  3645.                 {
  3646.                         stream.createFrame(40);
  3647.                         stream.writeWord(k);
  3648.                         aBoolean1149 = true;
  3649.                 }
  3650.                 if(l == 431)
  3651.                 {
  3652.                         stream.createFrame(129);
  3653.                         stream.method432(j);
  3654.                         stream.writeWord(k);
  3655.                         stream.method432(i1);
  3656.                         atInventoryLoopCycle = 0;
  3657.                         atInventoryInterface = k;
  3658.                         atInventoryIndex = j;
  3659.                         atInventoryInterfaceType = 2;
  3660.                         if(RSInterface.interfaceCache[k].parentID == openInterfaceID)
  3661.                                 atInventoryInterfaceType = 1;
  3662.                         if(RSInterface.interfaceCache[k].parentID == backDialogID)
  3663.                                 atInventoryInterfaceType = 3;
  3664.                 }
  3665.                 if(l == 337 || l == 42 || l == 792 || l == 322)
  3666.                 {
  3667.                         String s = menuActionName[i];
  3668.                         int k1 = s.indexOf("@whi@");
  3669.                         if(k1 != -1)
  3670.                         {
  3671.                                 long l3 = TextClass.longForName(s.substring(k1 + 5).trim());
  3672.                                 if(l == 337)
  3673.                                         addFriend(l3);
  3674.                                 if(l == 42)
  3675.                                         addIgnore(l3);
  3676.                                 if(l == 792)
  3677.                                         delFriend(l3);
  3678.                                 if(l == 322)
  3679.                                         delIgnore(l3);
  3680.                         }
  3681.                 }
  3682.                 if(l == 53)
  3683.                 {
  3684.                         stream.createFrame(135);
  3685.                         stream.method431(j);
  3686.                         stream.method432(k);
  3687.                         stream.method431(i1);
  3688.                         atInventoryLoopCycle = 0;
  3689.                         atInventoryInterface = k;
  3690.                         atInventoryIndex = j;
  3691.                         atInventoryInterfaceType = 2;
  3692.                         if(RSInterface.interfaceCache[k].parentID == openInterfaceID)
  3693.                                 atInventoryInterfaceType = 1;
  3694.                         if(RSInterface.interfaceCache[k].parentID == backDialogID)
  3695.                                 atInventoryInterfaceType = 3;
  3696.                 }
  3697.                 if(l == 539)
  3698.                 {
  3699.                         stream.createFrame(16);
  3700.                         stream.method432(i1);
  3701.                         stream.method433(j);
  3702.                         stream.method433(k);
  3703.                         atInventoryLoopCycle = 0;
  3704.                         atInventoryInterface = k;
  3705.                         atInventoryIndex = j;
  3706.                         atInventoryInterfaceType = 2;
  3707.                         if(RSInterface.interfaceCache[k].parentID == openInterfaceID)
  3708.                                 atInventoryInterfaceType = 1;
  3709.                         if(RSInterface.interfaceCache[k].parentID == backDialogID)
  3710.                                 atInventoryInterfaceType = 3;
  3711.                 }
  3712.                 if(l == 484 || l == 6)
  3713.                 {
  3714.                         String s1 = menuActionName[i];
  3715.                         int l1 = s1.indexOf("@whi@");
  3716.                         if(l1 != -1)
  3717.                         {
  3718.                                 s1 = s1.substring(l1 + 5).trim();
  3719.                                 String s7 = TextClass.fixName(TextClass.nameForLong(TextClass.longForName(s1)));
  3720.                                 boolean flag9 = false;
  3721.                                 for(int j3 = 0; j3 < playerCount; j3++)
  3722.                                 {
  3723.                                         Player class30_sub2_sub4_sub1_sub2_7 = playerArray[playerIndices[j3]];
  3724.                                         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))
  3725.                                                 continue;
  3726.                                         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]);
  3727.                                         if(l == 484)
  3728.                                         {
  3729.                                                 stream.createFrame(139);
  3730.                                                 stream.method431(playerIndices[j3]);
  3731.                                         }
  3732.                                         if(l == 6)
  3733.                                         {
  3734.                                                 anInt1188 += i1;
  3735.                                                 if(anInt1188 >= 90)
  3736.                                                 {
  3737.                                                         stream.createFrame(136);
  3738.                                                         anInt1188 = 0;
  3739.                                                 }
  3740.                                                 stream.createFrame(128);
  3741.                                                 stream.writeWord(playerIndices[j3]);
  3742.                                         }
  3743.                                         flag9 = true;
  3744.                                         break;
  3745.                                 }
  3746.  
  3747.                                 if(!flag9)
  3748.                                         pushMessage("Unable to find " + s7, 0, "");
  3749.                         }
  3750.                 }
  3751.                 if(l == 870)
  3752.                 {
  3753.                         stream.createFrame(53);
  3754.                         stream.writeWord(j);
  3755.                         stream.method432(anInt1283);
  3756.                         stream.method433(i1);
  3757.                         stream.writeWord(anInt1284);
  3758.                         stream.method431(anInt1285);
  3759.                         stream.writeWord(k);
  3760.                         atInventoryLoopCycle = 0;
  3761.                         atInventoryInterface = k;
  3762.                         atInventoryIndex = j;
  3763.                         atInventoryInterfaceType = 2;
  3764.                         if(RSInterface.interfaceCache[k].parentID == openInterfaceID)
  3765.                                 atInventoryInterfaceType = 1;
  3766.                         if(RSInterface.interfaceCache[k].parentID == backDialogID)
  3767.                                 atInventoryInterfaceType = 3;
  3768.                 }
  3769.                 if(l == 847)
  3770.                 {
  3771.                         stream.createFrame(87);
  3772.                         stream.method432(i1);
  3773.                         stream.writeWord(k);
  3774.                         stream.method432(j);
  3775.                         atInventoryLoopCycle = 0;
  3776.                         atInventoryInterface = k;
  3777.                         atInventoryIndex = j;
  3778.                         atInventoryInterfaceType = 2;
  3779.                         if(RSInterface.interfaceCache[k].parentID == openInterfaceID)
  3780.                                 atInventoryInterfaceType = 1;
  3781.                         if(RSInterface.interfaceCache[k].parentID == backDialogID)
  3782.                                 atInventoryInterfaceType = 3;
  3783.                 }
  3784.                 if(l == 626)
  3785.                 {
  3786.                         RSInterface class9_1 = RSInterface.interfaceCache[k];
  3787.                         spellSelected = 1;
  3788.                         anInt1137 = k;
  3789.                         spellUsableOn = class9_1.spellUsableOn;
  3790.                         itemSelected = 0;
  3791.                         needDrawTabArea = true;
  3792.                         String s4 = class9_1.selectedActionName;
  3793.                         if(s4.indexOf(" ") != -1)
  3794.                                 s4 = s4.substring(0, s4.indexOf(" "));
  3795.                         String s8 = class9_1.selectedActionName;
  3796.                         if(s8.indexOf(" ") != -1)
  3797.                                 s8 = s8.substring(s8.indexOf(" ") + 1);
  3798.                         spellTooltip = s4 + " " + class9_1.spellName + " " + s8;
  3799.                         if(spellUsableOn == 16)
  3800.                         {
  3801.                                 needDrawTabArea = true;
  3802.                                 tabID = 3;
  3803.                                 tabAreaAltered = true;
  3804.                         }
  3805.                         return;
  3806.                 }
  3807.                 if(l == 78)
  3808.                 {
  3809.                         stream.createFrame(117);
  3810.                         stream.method433(k);
  3811.                         stream.method433(i1);
  3812.                         stream.method431(j);
  3813.                         atInventoryLoopCycle = 0;
  3814.                         atInventoryInterface = k;
  3815.                         atInventoryIndex = j;
  3816.                         atInventoryInterfaceType = 2;
  3817.                         if(RSInterface.interfaceCache[k].parentID == openInterfaceID)
  3818.                                 atInventoryInterfaceType = 1;
  3819.                         if(RSInterface.interfaceCache[k].parentID == backDialogID)
  3820.                                 atInventoryInterfaceType = 3;
  3821.                 }
  3822.                 if(l == 27)
  3823.                 {
  3824.                         Player class30_sub2_sub4_sub1_sub2_2 = playerArray[i1];
  3825.                         if(class30_sub2_sub4_sub1_sub2_2 != null)
  3826.                         {
  3827.                                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, class30_sub2_sub4_sub1_sub2_2.smallY[0], myPlayer.smallX[0], false, class30_sub2_sub4_sub1_sub2_2.smallX[0]);
  3828.                                 crossX = super.saveClickX;
  3829.                                 crossY = super.saveClickY;
  3830.                                 crossType = 2;
  3831.                                 crossIndex = 0;
  3832.                                 anInt986 += i1;
  3833.                                 if(anInt986 >= 54)
  3834.                                 {
  3835.                                         stream.createFrame(189);
  3836.                                         stream.writeWordBigEndian(234);
  3837.                                         anInt986 = 0;
  3838.                                 }
  3839.                                 stream.createFrame(73);
  3840.                                 stream.method431(i1);
  3841.                         }
  3842.                 }
  3843.                 if(l == 213)
  3844.                 {
  3845.                         boolean flag3 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k, myPlayer.smallX[0], false, j);
  3846.                         if(!flag3)
  3847.                                 flag3 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k, myPlayer.smallX[0], false, j);
  3848.                         crossX = super.saveClickX;
  3849.                         crossY = super.saveClickY;
  3850.                         crossType = 2;
  3851.                         crossIndex = 0;
  3852.                         stream.createFrame(79);
  3853.                         stream.method431(k + baseY);
  3854.                         stream.writeWord(i1);
  3855.                         stream.method432(j + baseX);
  3856.                 }
  3857.                 if(l == 632)
  3858.                 {
  3859.                         stream.createFrame(145);
  3860.                         stream.method432(k);
  3861.                         stream.method432(j);
  3862.                         stream.method432(i1);
  3863.                         atInventoryLoopCycle = 0;
  3864.                         atInventoryInterface = k;
  3865.                         atInventoryIndex = j;
  3866.                         atInventoryInterfaceType = 2;
  3867.                         if(RSInterface.interfaceCache[k].parentID == openInterfaceID)
  3868.                                 atInventoryInterfaceType = 1;
  3869.                         if(RSInterface.interfaceCache[k].parentID == backDialogID)
  3870.                                 atInventoryInterfaceType = 3;
  3871.                 }
  3872.                 if(l == 493)
  3873.                 {
  3874.                         stream.createFrame(75);
  3875.                         stream.method433(k);
  3876.                         stream.method431(j);
  3877.                         stream.method432(i1);
  3878.                         atInventoryLoopCycle = 0;
  3879.                         atInventoryInterface = k;
  3880.                         atInventoryIndex = j;
  3881.                         atInventoryInterfaceType = 2;
  3882.                         if(RSInterface.interfaceCache[k].parentID == openInterfaceID)
  3883.                                 atInventoryInterfaceType = 1;
  3884.                         if(RSInterface.interfaceCache[k].parentID == backDialogID)
  3885.                                 atInventoryInterfaceType = 3;
  3886.                 }
  3887.                 if(l == 652)
  3888.                 {
  3889.                         boolean flag4 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k, myPlayer.smallX[0], false, j);
  3890.                         if(!flag4)
  3891.                                 flag4 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k, myPlayer.smallX[0], false, j);
  3892.                         crossX = super.saveClickX;
  3893.                         crossY = super.saveClickY;
  3894.                         crossType = 2;
  3895.                         crossIndex = 0;
  3896.                         stream.createFrame(156);
  3897.                         stream.method432(j + baseX);
  3898.                         stream.method431(k + baseY);
  3899.                         stream.method433(i1);
  3900.                 }
  3901.                 if(l == 94)
  3902.                 {
  3903.                         boolean flag5 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k, myPlayer.smallX[0], false, j);
  3904.                         if(!flag5)
  3905.                                 flag5 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k, myPlayer.smallX[0], false, j);
  3906.                         crossX = super.saveClickX;
  3907.                         crossY = super.saveClickY;
  3908.                         crossType = 2;
  3909.                         crossIndex = 0;
  3910.                         stream.createFrame(181);
  3911.                         stream.method431(k + baseY);
  3912.                         stream.writeWord(i1);
  3913.                         stream.method431(j + baseX);
  3914.                         stream.method432(anInt1137);
  3915.                 }
  3916.                 if(l == 646)
  3917.                 {
  3918.                         stream.createFrame(185);
  3919.                         stream.writeWord(k);
  3920.                         RSInterface class9_2 = RSInterface.interfaceCache[k];
  3921.                         if(class9_2.valueIndexArray != null && class9_2.valueIndexArray[0][0] == 5)
  3922.                         {
  3923.                                 int i2 = class9_2.valueIndexArray[0][1];
  3924.                                 if(variousSettings[i2] != class9_2.anIntArray212[0])
  3925.                                 {
  3926.                                         variousSettings[i2] = class9_2.anIntArray212[0];
  3927.                                         method33(i2);
  3928.                                         needDrawTabArea = true;
  3929.                                 }
  3930.                         }
  3931.                 }
  3932.                 if(l == 225)
  3933.                 {
  3934.                         NPC class30_sub2_sub4_sub1_sub1_2 = npcArray[i1];
  3935.                         if(class30_sub2_sub4_sub1_sub1_2 != null)
  3936.                         {
  3937.                                 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]);
  3938.                                 crossX = super.saveClickX;
  3939.                                 crossY = super.saveClickY;
  3940.                                 crossType = 2;
  3941.                                 crossIndex = 0;
  3942.                                 anInt1226 += i1;
  3943.                                 if(anInt1226 >= 85)
  3944.                                 {
  3945.                                         stream.createFrame(230);
  3946.                                         stream.writeWordBigEndian(239);
  3947.                                         anInt1226 = 0;
  3948.                                 }
  3949.                                 stream.createFrame(17);
  3950.                                 stream.method433(i1);
  3951.                         }
  3952.                 }
  3953.                 if(l == 965)
  3954.                 {
  3955.                         NPC class30_sub2_sub4_sub1_sub1_3 = npcArray[i1];
  3956.                         if(class30_sub2_sub4_sub1_sub1_3 != null)
  3957.                         {
  3958.                                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, class30_sub2_sub4_sub1_sub1_3.smallY[0], myPlayer.smallX[0], false, class30_sub2_sub4_sub1_sub1_3.smallX[0]);
  3959.                                 crossX = super.saveClickX;
  3960.                                 crossY = super.saveClickY;
  3961.                                 crossType = 2;
  3962.                                 crossIndex = 0;
  3963.                                 anInt1134++;
  3964.                                 if(anInt1134 >= 96)
  3965.                                 {
  3966.                                         stream.createFrame(152);
  3967.                                         stream.writeWordBigEndian(88);
  3968.                                         anInt1134 = 0;
  3969.                                 }
  3970.                                 stream.createFrame(21);
  3971.                                 stream.writeWord(i1);
  3972.                         }
  3973.                 }
  3974.                 if(l == 413)
  3975.                 {
  3976.                         NPC class30_sub2_sub4_sub1_sub1_4 = npcArray[i1];
  3977.                         if(class30_sub2_sub4_sub1_sub1_4 != null)
  3978.                         {
  3979.                                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, class30_sub2_sub4_sub1_sub1_4.smallY[0], myPlayer.smallX[0], false, class30_sub2_sub4_sub1_sub1_4.smallX[0]);
  3980.                                 crossX = super.saveClickX;
  3981.                                 crossY = super.saveClickY;
  3982.                                 crossType = 2;
  3983.                                 crossIndex = 0;
  3984.                                 stream.createFrame(131);
  3985.                                 stream.method433(i1);
  3986.                                 stream.method432(anInt1137);
  3987.                         }
  3988.                 }
  3989.                 if(l == 200)
  3990.                         clearTopInterfaces();
  3991.                 if(l == 1025)
  3992.                 {
  3993.                         NPC class30_sub2_sub4_sub1_sub1_5 = npcArray[i1];
  3994.                         if(class30_sub2_sub4_sub1_sub1_5 != null)
  3995.                         {
  3996.                                 EntityDef entityDef = class30_sub2_sub4_sub1_sub1_5.desc;
  3997.                                 if(entityDef.childrenIDs != null)
  3998.                                         entityDef = entityDef.method161();
  3999.                                 if(entityDef != null)
  4000.                                 {
  4001.                                         String s9;
  4002.                                         if(entityDef.description != null)
  4003.                                                 s9 = new String(entityDef.description);
  4004.                                         else
  4005.                                                 s9 = "It's a " + entityDef.name + ".";
  4006.                                         pushMessage(s9, 0, "");
  4007.                                 }
  4008.                         }
  4009.                 }
  4010.                 if(l == 900)
  4011.                 {
  4012.                         method66(i1, k, j);
  4013.                         stream.createFrame(252);
  4014.                         stream.method433(i1 >> 14 & 0x7fff);
  4015.                         stream.method431(k + baseY);
  4016.                         stream.method432(j + baseX);
  4017.                 }
  4018.                 if(l == 412)
  4019.                 {
  4020.                         NPC class30_sub2_sub4_sub1_sub1_6 = npcArray[i1];
  4021.                         if(class30_sub2_sub4_sub1_sub1_6 != null)
  4022.                         {
  4023.                                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, class30_sub2_sub4_sub1_sub1_6.smallY[0], myPlayer.smallX[0], false, class30_sub2_sub4_sub1_sub1_6.smallX[0]);
  4024.                                 crossX = super.saveClickX;
  4025.                                 crossY = super.saveClickY;
  4026.                                 crossType = 2;
  4027.                                 crossIndex = 0;
  4028.                                 stream.createFrame(72);
  4029.                                 stream.method432(i1);
  4030.                         }
  4031.                 }
  4032.                 if(l == 365)
  4033.                 {
  4034.                         Player class30_sub2_sub4_sub1_sub2_3 = playerArray[i1];
  4035.                         if(class30_sub2_sub4_sub1_sub2_3 != null)
  4036.                         {
  4037.                                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, class30_sub2_sub4_sub1_sub2_3.smallY[0], myPlayer.smallX[0], false, class30_sub2_sub4_sub1_sub2_3.smallX[0]);
  4038.                                 crossX = super.saveClickX;
  4039.                                 crossY = super.saveClickY;
  4040.                                 crossType = 2;
  4041.                                 crossIndex = 0;
  4042.                                 stream.createFrame(249);
  4043.                                 stream.method432(i1);
  4044.                                 stream.method431(anInt1137);
  4045.                         }
  4046.                 }
  4047.                 if(l == 729)
  4048.                 {
  4049.                         Player class30_sub2_sub4_sub1_sub2_4 = playerArray[i1];
  4050.                         if(class30_sub2_sub4_sub1_sub2_4 != null)
  4051.                         {
  4052.                                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, class30_sub2_sub4_sub1_sub2_4.smallY[0], myPlayer.smallX[0], false, class30_sub2_sub4_sub1_sub2_4.smallX[0]);
  4053.                                 crossX = super.saveClickX;
  4054.                                 crossY = super.saveClickY;
  4055.                                 crossType = 2;
  4056.                                 crossIndex = 0;
  4057.                                 stream.createFrame(39);
  4058.                                 stream.method431(i1);
  4059.                         }
  4060.                 }
  4061.                 if(l == 577)
  4062.                 {
  4063.                         Player class30_sub2_sub4_sub1_sub2_5 = playerArray[i1];
  4064.                         if(class30_sub2_sub4_sub1_sub2_5 != null)
  4065.                         {
  4066.                                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, class30_sub2_sub4_sub1_sub2_5.smallY[0], myPlayer.smallX[0], false, class30_sub2_sub4_sub1_sub2_5.smallX[0]);
  4067.                                 crossX = super.saveClickX;
  4068.                                 crossY = super.saveClickY;
  4069.                                 crossType = 2;
  4070.                                 crossIndex = 0;
  4071.                                 stream.createFrame(139);
  4072.                                 stream.method431(i1);
  4073.                         }
  4074.                 }
  4075.                 if(l == 956 && method66(i1, k, j))
  4076.                 {
  4077.                         stream.createFrame(35);
  4078.                         stream.method431(j + baseX);
  4079.                         stream.method432(anInt1137);
  4080.                         stream.method432(k + baseY);
  4081.                         stream.method431(i1 >> 14 & 0x7fff);
  4082.                 }
  4083.                 if(l == 567)
  4084.                 {
  4085.                         boolean flag6 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k, myPlayer.smallX[0], false, j);
  4086.                         if(!flag6)
  4087.                                 flag6 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k, myPlayer.smallX[0], false, j);
  4088.                         crossX = super.saveClickX;
  4089.                         crossY = super.saveClickY;
  4090.                         crossType = 2;
  4091.                         crossIndex = 0;
  4092.                         stream.createFrame(23);
  4093.                         stream.method431(k + baseY);
  4094.                         stream.method431(i1);
  4095.                         stream.method431(j + baseX);
  4096.                 }
  4097.                 if(l == 867)
  4098.                 {
  4099.                         if((i1 & 3) == 0)
  4100.                                 anInt1175++;
  4101.                         if(anInt1175 >= 59)
  4102.                         {
  4103.                                 stream.createFrame(200);
  4104.                                 stream.writeWord(25501);
  4105.                                 anInt1175 = 0;
  4106.                         }
  4107.                         stream.createFrame(43);
  4108.                         stream.method431(k);
  4109.                         stream.method432(i1);
  4110.                         stream.method432(j);
  4111.                         atInventoryLoopCycle = 0;
  4112.                         atInventoryInterface = k;
  4113.                         atInventoryIndex = j;
  4114.                         atInventoryInterfaceType = 2;
  4115.                         if(RSInterface.interfaceCache[k].parentID == openInterfaceID)
  4116.                                 atInventoryInterfaceType = 1;
  4117.                         if(RSInterface.interfaceCache[k].parentID == backDialogID)
  4118.                                 atInventoryInterfaceType = 3;
  4119.                 }
  4120.                 if(l == 543)
  4121.                 {
  4122.                         stream.createFrame(237);
  4123.                         stream.writeWord(j);
  4124.                         stream.method432(i1);
  4125.                         stream.writeWord(k);
  4126.                         stream.method432(anInt1137);
  4127.                         atInventoryLoopCycle = 0;
  4128.                         atInventoryInterface = k;
  4129.                         atInventoryIndex = j;
  4130.                         atInventoryInterfaceType = 2;
  4131.                         if(RSInterface.interfaceCache[k].parentID == openInterfaceID)
  4132.                                 atInventoryInterfaceType = 1;
  4133.                         if(RSInterface.interfaceCache[k].parentID == backDialogID)
  4134.                                 atInventoryInterfaceType = 3;
  4135.                 }
  4136.                 if(l == 606)
  4137.                 {
  4138.                         String s2 = menuActionName[i];
  4139.                         int j2 = s2.indexOf("@whi@");
  4140.                         if(j2 != -1)
  4141.                                 if(openInterfaceID == -1)
  4142.                                 {
  4143.                                         clearTopInterfaces();
  4144.                                         reportAbuseInput = s2.substring(j2 + 5).trim();
  4145.                                         canMute = false;
  4146.                                         for(int i3 = 0; i3 < RSInterface.interfaceCache.length; i3++)
  4147.                                         {
  4148.                                                 if(RSInterface.interfaceCache[i3] == null || RSInterface.interfaceCache[i3].contentType != 600)
  4149.                                                         continue;
  4150.                                                 reportAbuseInterfaceID = openInterfaceID = RSInterface.interfaceCache[i3].parentID;
  4151.                                                 break;
  4152.                                         }
  4153.  
  4154.                                 } else
  4155.                                 {
  4156.                                         pushMessage("Please close the interface you have open before using 'report abuse'", 0, "");
  4157.                                 }
  4158.                 }
  4159.                 if(l == 491)
  4160.                 {
  4161.                         Player class30_sub2_sub4_sub1_sub2_6 = playerArray[i1];
  4162.                         if(class30_sub2_sub4_sub1_sub2_6 != null)
  4163.                         {
  4164.                                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, class30_sub2_sub4_sub1_sub2_6.smallY[0], myPlayer.smallX[0], false, class30_sub2_sub4_sub1_sub2_6.smallX[0]);
  4165.                                 crossX = super.saveClickX;
  4166.                                 crossY = super.saveClickY;
  4167.                                 crossType = 2;
  4168.                                 crossIndex = 0;
  4169.                                 stream.createFrame(14);
  4170.                                 //stream.method432(anInt1284);
  4171.                                 stream.writeWord(i1); //Player id
  4172.                                 //stream.writeWord(anInt1285);
  4173.                                 stream.method431(anInt1283); //Item slot
  4174.                         }
  4175.                 }
  4176.                 if(l == 639)
  4177.                 {
  4178.                         String s3 = menuActionName[i];
  4179.                         int k2 = s3.indexOf("@whi@");
  4180.                         if(k2 != -1)
  4181.                         {
  4182.                                 long l4 = TextClass.longForName(s3.substring(k2 + 5).trim());
  4183.                                 int k3 = -1;
  4184.                                 for(int i4 = 0; i4 < friendsCount; i4++)
  4185.                                 {
  4186.                                         if(friendsListAsLongs[i4] != l4)
  4187.                                                 continue;
  4188.                                         k3 = i4;
  4189.                                         break;
  4190.                                 }
  4191.  
  4192.                                 if(k3 != -1 && friendsNodeIDs[k3] > 0)
  4193.                                 {
  4194.                                         inputTaken = true;
  4195.                                         inputDialogState = 0;
  4196.                                         messagePromptRaised = true;
  4197.                                         promptInput = "";
  4198.                                         friendsListAction = 3;
  4199.                                         aLong953 = friendsListAsLongs[k3];
  4200.                                         aString1121 = "Enter message to send to " + friendsList[k3];
  4201.                                 }
  4202.                         }
  4203.                 }
  4204.                 if(l == 454)
  4205.                 {
  4206.                         stream.createFrame(41);
  4207.                         stream.writeWord(i1);
  4208.                         stream.method432(j);
  4209.                         stream.method432(k);
  4210.                         atInventoryLoopCycle = 0;
  4211.                         atInventoryInterface = k;
  4212.                         atInventoryIndex = j;
  4213.                         atInventoryInterfaceType = 2;
  4214.                         if(RSInterface.interfaceCache[k].parentID == openInterfaceID)
  4215.                                 atInventoryInterfaceType = 1;
  4216.                         if(RSInterface.interfaceCache[k].parentID == backDialogID)
  4217.                                 atInventoryInterfaceType = 3;
  4218.                 }
  4219.                 if(l == 478)
  4220.                 {
  4221.                         NPC class30_sub2_sub4_sub1_sub1_7 = npcArray[i1];
  4222.                         if(class30_sub2_sub4_sub1_sub1_7 != null)
  4223.                         {
  4224.                                 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]);
  4225.                                 crossX = super.saveClickX;
  4226.                                 crossY = super.saveClickY;
  4227.                                 crossType = 2;
  4228.                                 crossIndex = 0;
  4229.                                 if((i1 & 3) == 0)
  4230.                                         anInt1155++;
  4231.                                 if(anInt1155 >= 53)
  4232.                                 {
  4233.                                         stream.createFrame(85);
  4234.                                         stream.writeWordBigEndian(66);
  4235.                                         anInt1155 = 0;
  4236.                                 }
  4237.                                 stream.createFrame(18);
  4238.                                 stream.method431(i1);
  4239.                         }
  4240.                 }
  4241.                 if(l == 113)
  4242.                 {
  4243.                         method66(i1, k, j);
  4244.                         stream.createFrame(70);
  4245.                         stream.method431(j + baseX);
  4246.                         stream.writeWord(k + baseY);
  4247.                         stream.method433(i1 >> 14 & 0x7fff);
  4248.                 }
  4249.                 if(l == 872)
  4250.                 {
  4251.                         method66(i1, k, j);
  4252.                         stream.createFrame(234);
  4253.                         stream.method433(j + baseX);
  4254.                         stream.method432(i1 >> 14 & 0x7fff);
  4255.                         stream.method433(k + baseY);
  4256.                 }
  4257.                 if(l == 502)
  4258.                 {
  4259.                         method66(i1, k, j);
  4260.                         stream.createFrame(132);
  4261.                         stream.method433(j + baseX);
  4262.                         stream.writeWord(i1 >> 14 & 0x7fff);
  4263.                         stream.method432(k + baseY);
  4264.                 }
  4265.                 if(l == 1125)
  4266.                 {
  4267.                         ItemDef itemDef = ItemDef.forID(i1);
  4268.                         RSInterface class9_4 = RSInterface.interfaceCache[k];
  4269.                         String s5;
  4270.                         if(class9_4 != null && class9_4.invStackSizes[j] >= 0x186a0)
  4271.                                 s5 = class9_4.invStackSizes[j] + " x " + itemDef.name;
  4272.                         else
  4273.                         if(itemDef.description != null)
  4274.                                 s5 = new String(itemDef.description);
  4275.                         else
  4276.                                 s5 = "It's a " + itemDef.name + ".";
  4277.                         pushMessage(s5, 0, "");
  4278.                 }
  4279.                 if(l == 169)
  4280.                 {
  4281.                         stream.createFrame(185);
  4282.                         stream.writeWord(k);
  4283.                         RSInterface class9_3 = RSInterface.interfaceCache[k];
  4284.                         if(class9_3.valueIndexArray != null && class9_3.valueIndexArray[0][0] == 5)
  4285.                         {
  4286.                                 int l2 = class9_3.valueIndexArray[0][1];
  4287.                                 variousSettings[l2] = 1 - variousSettings[l2];
  4288.                                 method33(l2);
  4289.                                 needDrawTabArea = true;
  4290.                         }
  4291.                 }
  4292.                 if(l == 447)
  4293.                 {
  4294.                         itemSelected = 1;
  4295.                         anInt1283 = j;
  4296.                         anInt1284 = k;
  4297.                         anInt1285 = i1;
  4298.                         selectedItemName = ItemDef.forID(i1).name;
  4299.                         spellSelected = 0;
  4300.                         needDrawTabArea = true;
  4301.                         return;
  4302.                 }
  4303.                 if(l == 1226)
  4304.                 {
  4305.                         int j1 = i1 >> 14 & 0x7fff;
  4306.                         ObjectDef class46 = ObjectDef.forID(j1);
  4307.                         String s10;
  4308.                         if(class46.description != null)
  4309.                                 s10 = new String(class46.description);
  4310.                         else
  4311.                                 s10 = "It's a " + class46.name + ".";
  4312.                         pushMessage(s10, 0, "");
  4313.                 }
  4314.                 if(l == 244)
  4315.                 {
  4316.                         boolean flag7 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k, myPlayer.smallX[0], false, j);
  4317.                         if(!flag7)
  4318.                                 flag7 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k, myPlayer.smallX[0], false, j);
  4319.                         crossX = super.saveClickX;
  4320.                         crossY = super.saveClickY;
  4321.                         crossType = 2;
  4322.                         crossIndex = 0;
  4323.                         stream.createFrame(253);
  4324.                         stream.method431(j + baseX);
  4325.                         stream.method433(k + baseY);
  4326.                         stream.method432(i1);
  4327.                 }
  4328.                 if(l == 1448)
  4329.                 {
  4330.                         ItemDef itemDef_1 = ItemDef.forID(i1);
  4331.                         String s6;
  4332.                         if(itemDef_1.description != null)
  4333.                                 s6 = new String(itemDef_1.description);
  4334.                         else
  4335.                                 s6 = "It's a " + itemDef_1.name + ".";
  4336.                         pushMessage(s6, 0, "");
  4337.                 }
  4338.                 itemSelected = 0;
  4339.                         spellSelected = 0;
  4340.                         needDrawTabArea = true;
  4341.  
  4342.         }
  4343.  
  4344.         private void method70()
  4345.         {
  4346.                 anInt1251 = 0;
  4347.                 int j = (myPlayer.x >> 7) + baseX;
  4348.                 int k = (myPlayer.y >> 7) + baseY;
  4349.                 if(j >= 3053 && j <= 3156 && k >= 3056 && k <= 3136)
  4350.                         anInt1251 = 1;
  4351.                 if(j >= 3072 && j <= 3118 && k >= 9492 && k <= 9535)
  4352.                         anInt1251 = 1;
  4353.                 if(anInt1251 == 1 && j >= 3139 && j <= 3199 && k >= 3008 && k <= 3062)
  4354.                         anInt1251 = 0;
  4355.         }
  4356.  
  4357.         public void run()
  4358.         {
  4359.                 if(drawFlames)
  4360.                 {
  4361.                         drawFlames();
  4362.                 } else
  4363.                 {
  4364.                         super.run();
  4365.                 }
  4366.         }
  4367.  
  4368.         private void build3dScreenMenu()
  4369.         {
  4370.                 if(itemSelected == 0 && spellSelected == 0)
  4371.                 {
  4372.                         menuActionName[menuActionRow] = "Walk here";
  4373.                         menuActionID[menuActionRow] = 516;
  4374.                         menuActionCmd2[menuActionRow] = super.mouseX;
  4375.                         menuActionCmd3[menuActionRow] = super.mouseY;
  4376.                         menuActionRow++;
  4377.                 }
  4378.                 int j = -1;
  4379.                 for(int k = 0; k < Model.anInt1687; k++)
  4380.                 {
  4381.                         int l = Model.anIntArray1688[k];
  4382.                         int i1 = l & 0x7f;
  4383.                         int j1 = l >> 7 & 0x7f;
  4384.                         int k1 = l >> 29 & 3;
  4385.                         int l1 = l >> 14 & 0x7fff;
  4386.                         if(l == j)
  4387.                                 continue;
  4388.                         j = l;
  4389.                         if(k1 == 2 && worldController.method304(plane, i1, j1, l) >= 0)
  4390.                         {
  4391.                                 ObjectDef class46 = ObjectDef.forID(l1);
  4392.                                 if(class46.childrenIDs != null)
  4393.                                         class46 = class46.method580();
  4394.                                 if(class46 == null)
  4395.                                         continue;
  4396.                                 if(itemSelected == 1)
  4397.                                 {
  4398.                                         menuActionName[menuActionRow] = "Use " + selectedItemName + " with @cya@" + class46.name;
  4399.                                         menuActionID[menuActionRow] = 62;
  4400.                                         menuActionCmd1[menuActionRow] = l;
  4401.                                         menuActionCmd2[menuActionRow] = i1;
  4402.                                         menuActionCmd3[menuActionRow] = j1;
  4403.                                         menuActionRow++;
  4404.                                 } else
  4405.                                 if(spellSelected == 1)
  4406.                                 {
  4407.                                         if((spellUsableOn & 4) == 4)
  4408.                                         {
  4409.                                                 menuActionName[menuActionRow] = spellTooltip + " @cya@" + class46.name;
  4410.                                                 menuActionID[menuActionRow] = 956;
  4411.                                                 menuActionCmd1[menuActionRow] = l;
  4412.                                                 menuActionCmd2[menuActionRow] = i1;
  4413.                                                 menuActionCmd3[menuActionRow] = j1;
  4414.                                                 menuActionRow++;
  4415.                                         }
  4416.                                 } else
  4417.                                 {
  4418.                                         if(class46.actions != null)
  4419.                                         {
  4420.                                                 for(int i2 = 4; i2 >= 0; i2--)
  4421.                                                         if(class46.actions[i2] != null)
  4422.                                                         {
  4423.                                                                 menuActionName[menuActionRow] = class46.actions[i2] + " @cya@" + class46.name;
  4424.                                                                 if(i2 == 0)
  4425.                                                                         menuActionID[menuActionRow] = 502;
  4426.                                                                 if(i2 == 1)
  4427.                                                                         menuActionID[menuActionRow] = 900;
  4428.                                                                 if(i2 == 2)
  4429.                                                                         menuActionID[menuActionRow] = 113;
  4430.                                                                 if(i2 == 3)
  4431.                                                                         menuActionID[menuActionRow] = 872;
  4432.                                                                 if(i2 == 4)
  4433.                                                                         menuActionID[menuActionRow] = 1062;
  4434.                                                                 menuActionCmd1[menuActionRow] = l;
  4435.                                                                 menuActionCmd2[menuActionRow] = i1;
  4436.                                                                 menuActionCmd3[menuActionRow] = j1;
  4437.                                                                 menuActionRow++;
  4438.                                                         }
  4439.  
  4440.                                         }
  4441.                                         //menuActionName[menuActionRow] = "Examine @cya@" + class46.name + " @gre@(@whi@" + l1 + "@gre@) (@whi@" + (i1 + baseX) + "," + (j1 + baseY) + "@gre@)";
  4442.                                         menuActionName[menuActionRow] = "Examine @cya@" + class46.name;
  4443.                                         menuActionID[menuActionRow] = 1226;
  4444.                                         menuActionCmd1[menuActionRow] = class46.type << 14;
  4445.                                         menuActionCmd2[menuActionRow] = i1;
  4446.                                         menuActionCmd3[menuActionRow] = j1;
  4447.                                         menuActionRow++;
  4448.                                 }
  4449.                         }
  4450.                         if(k1 == 1)
  4451.                         {
  4452.                                 NPC npc = npcArray[l1];
  4453.                                 if(npc.desc.aByte68 == 1 && (npc.x & 0x7f) == 64 && (npc.y & 0x7f) == 64)
  4454.                                 {
  4455.                                         for(int j2 = 0; j2 < npcCount; j2++)
  4456.                                         {
  4457.                                                 NPC npc2 = npcArray[npcIndices[j2]];
  4458.                                                 if(npc2 != null && npc2 != npc && npc2.desc.aByte68 == 1 && npc2.x == npc.x && npc2.y == npc.y)
  4459.                                                         buildAtNPCMenu(npc2.desc, npcIndices[j2], j1, i1);
  4460.                                         }
  4461.  
  4462.                                         for(int l2 = 0; l2 < playerCount; l2++)
  4463.                                         {
  4464.                                                 Player player = playerArray[playerIndices[l2]];
  4465.                                                 if(player != null && player.x == npc.x && player.y == npc.y)
  4466.                                                         buildAtPlayerMenu(i1, playerIndices[l2], player, j1);
  4467.                                         }
  4468.  
  4469.                                 }
  4470.                                 buildAtNPCMenu(npc.desc, l1, j1, i1);
  4471.                         }
  4472.                         if(k1 == 0)
  4473.                         {
  4474.                                 Player player = playerArray[l1];
  4475.                                 if((player.x & 0x7f) == 64 && (player.y & 0x7f) == 64)
  4476.                                 {
  4477.                                         for(int k2 = 0; k2 < npcCount; k2++)
  4478.                                         {
  4479.                                                 NPC class30_sub2_sub4_sub1_sub1_2 = npcArray[npcIndices[k2]];
  4480.                                                 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)
  4481.                                                         buildAtNPCMenu(class30_sub2_sub4_sub1_sub1_2.desc, npcIndices[k2], j1, i1);
  4482.                                         }
  4483.  
  4484.                                         for(int i3 = 0; i3 < playerCount; i3++)
  4485.                                         {
  4486.                                                 Player class30_sub2_sub4_sub1_sub2_2 = playerArray[playerIndices[i3]];
  4487.                                                 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)
  4488.                                                         buildAtPlayerMenu(i1, playerIndices[i3], class30_sub2_sub4_sub1_sub2_2, j1);
  4489.                                         }
  4490.  
  4491.                                 }
  4492.                                 buildAtPlayerMenu(i1, l1, player, j1);
  4493.                         }
  4494.                         if(k1 == 3)
  4495.                         {
  4496.                                 NodeList class19 = groundArray[plane][i1][j1];
  4497.                                 if(class19 != null)
  4498.                                 {
  4499.                                         for(Item item = (Item)class19.getFirst(); item != null; item = (Item)class19.getNext())
  4500.                                         {
  4501.                                                 ItemDef itemDef = ItemDef.forID(item.ID);
  4502.                                                 if(itemSelected == 1)
  4503.                                                 {
  4504.                                                         menuActionName[menuActionRow] = "Use " + selectedItemName + " with @lre@" + itemDef.name;
  4505.                                                         menuActionID[menuActionRow] = 511;
  4506.                                                         menuActionCmd1[menuActionRow] = item.ID;
  4507.                                                         menuActionCmd2[menuActionRow] = i1;
  4508.                                                         menuActionCmd3[menuActionRow] = j1;
  4509.                                                         menuActionRow++;
  4510.                                                 } else
  4511.                                                 if(spellSelected == 1)
  4512.                                                 {
  4513.                                                         if((spellUsableOn & 1) == 1)
  4514.                                                         {
  4515.                                                                 menuActionName[menuActionRow] = spellTooltip + " @lre@" + itemDef.name;
  4516.                                                                 menuActionID[menuActionRow] = 94;
  4517.                                                                 menuActionCmd1[menuActionRow] = item.ID;
  4518.                                                                 menuActionCmd2[menuActionRow] = i1;
  4519.                                                                 menuActionCmd3[menuActionRow] = j1;
  4520.                                                                 menuActionRow++;
  4521.                                                         }
  4522.                                                 } else
  4523.                                                 {
  4524.                                                         for(int j3 = 4; j3 >= 0; j3--)
  4525.                                                                 if(itemDef.groundActions != null && itemDef.groundActions[j3] != null)
  4526.                                                                 {
  4527.                                                                         menuActionName[menuActionRow] = itemDef.groundActions[j3] + " @lre@" + itemDef.name;
  4528.                                                                         if(j3 == 0)
  4529.                                                                                 menuActionID[menuActionRow] = 652;
  4530.                                                                         if(j3 == 1)
  4531.                                                                                 menuActionID[menuActionRow] = 567;
  4532.                                                                         if(j3 == 2)
  4533.                                                                                 menuActionID[menuActionRow] = 234;
  4534.                                                                         if(j3 == 3)
  4535.                                                                                 menuActionID[menuActionRow] = 244;
  4536.                                                                         if(j3 == 4)
  4537.                                                                                 menuActionID[menuActionRow] = 213;
  4538.                                                                         menuActionCmd1[menuActionRow] = item.ID;
  4539.                                                                         menuActionCmd2[menuActionRow] = i1;
  4540.                                                                         menuActionCmd3[menuActionRow] = j1;
  4541.                                                                         menuActionRow++;
  4542.                                                                 } else
  4543.                                                                 if(j3 == 2)
  4544.                                                                 {
  4545.                                                                         menuActionName[menuActionRow] = "Take @lre@" + itemDef.name;
  4546.                                                                         menuActionID[menuActionRow] = 234;
  4547.                                                                         menuActionCmd1[menuActionRow] = item.ID;
  4548.                                                                         menuActionCmd2[menuActionRow] = i1;
  4549.                                                                         menuActionCmd3[menuActionRow] = j1;
  4550.                                                                         menuActionRow++;
  4551.                                                                 }
  4552.  
  4553.                                                         //menuActionName[menuActionRow] = "Examine @lre@" + itemDef.name + " @gre@(@whi@" + item.ID + "@gre@)";
  4554.                                                         menuActionName[menuActionRow] = "Examine @lre@" + itemDef.name;
  4555.                                                         menuActionID[menuActionRow] = 1448;
  4556.                                                         menuActionCmd1[menuActionRow] = item.ID;
  4557.                                                         menuActionCmd2[menuActionRow] = i1;
  4558.                                                         menuActionCmd3[menuActionRow] = j1;
  4559.                                                         menuActionRow++;
  4560.                                                 }
  4561.                                         }
  4562.  
  4563.                                 }
  4564.                         }
  4565.                 }
  4566.         }
  4567.  
  4568.         public void cleanUpForQuit()
  4569.         {
  4570.                 signlink.reporterror = false;
  4571.                 try
  4572.                 {
  4573.                         if(socketStream != null)
  4574.                                 socketStream.close();
  4575.                 }
  4576.                 catch(Exception _ex) { }
  4577.                 socketStream = null;
  4578.                 stopMidi();
  4579.                 if(mouseDetection != null)
  4580.                         mouseDetection.running = false;
  4581.                 mouseDetection = null;
  4582.                 onDemandFetcher.disable();
  4583.                 onDemandFetcher = null;
  4584.                 aStream_834 = null;
  4585.                 stream = null;
  4586.                 aStream_847 = null;
  4587.                 inStream = null;
  4588.                 anIntArray1234 = null;
  4589.                 aByteArrayArray1183 = null;
  4590.                 aByteArrayArray1247 = null;
  4591.                 anIntArray1235 = null;
  4592.                 anIntArray1236 = null;
  4593.                 intGroundArray = null;
  4594.                 byteGroundArray = null;
  4595.                 worldController = null;
  4596.                 aClass11Array1230 = null;
  4597.                 anIntArrayArray901 = null;
  4598.                 anIntArrayArray825 = null;
  4599.                 bigX = null;
  4600.                 bigY = null;
  4601.                 aByteArray912 = null;
  4602.                 aRSImageProducer_1163 = null;
  4603.                 aRSImageProducer_1164 = null;
  4604.                 aRSImageProducer_1165 = null;
  4605.                 aRSImageProducer_1166 = null;
  4606.                 aRSImageProducer_1123 = null;
  4607.                 aRSImageProducer_1124 = null;
  4608.                 aRSImageProducer_1125 = null;
  4609.                 /* Null pointers for custom sprites */
  4610.                 chatArea = null;
  4611.                 chatButtonH = null;
  4612.                 chatButtonHC = null;
  4613.                 chatButtonC = null;
  4614.                 reportH = null;
  4615.                 tabArea = null;
  4616.                 mapArea = null;
  4617.                 frame = null;
  4618.                 /**/
  4619.                 mapBack = null;
  4620.                 backBase1 = null;
  4621.                 sideIcons = null;
  4622.                 redStones = null;
  4623.                 compass = null;
  4624.                 hitMarks = null;
  4625.                 headIcons = null;
  4626.                 headIconsHint = null;
  4627.                 crosses = null;
  4628.                 mapDotItem = null;
  4629.                 mapDotNPC = null;
  4630.                 mapDotPlayer = null;
  4631.                 mapDotFriend = null;
  4632.                 mapDotTeam = null;
  4633.                 mapScenes = null;
  4634.                 mapFunctions = null;
  4635.                 anIntArrayArray929 = null;
  4636.                 playerArray = null;
  4637.                 playerIndices = null;
  4638.                 anIntArray894 = null;
  4639.                 aStreamArray895s = null;
  4640.                 anIntArray840 = null;
  4641.                 npcArray = null;
  4642.                 npcIndices = null;
  4643.                 groundArray = null;
  4644.                 aClass19_1179 = null;
  4645.                 aClass19_1013 = null;
  4646.                 aClass19_1056 = null;
  4647.                 menuActionCmd2 = null;
  4648.                 menuActionCmd3 = null;
  4649.                 menuActionID = null;
  4650.                 menuActionCmd1 = null;
  4651.                 menuActionName = null;
  4652.                 variousSettings = null;
  4653.                 anIntArray1072 = null;
  4654.                 anIntArray1073 = null;
  4655.                 aClass30_Sub2_Sub1_Sub1Array1140 = null;
  4656.                 aClass30_Sub2_Sub1_Sub1_1263 = null;
  4657.                 friendsList = null;
  4658.                 friendsListAsLongs = null;
  4659.                 friendsNodeIDs = null;
  4660.                 aRSImageProducer_1110 = null;
  4661.                 aRSImageProducer_1111 = null;
  4662.                 aRSImageProducer_1107 = null;
  4663.                 aRSImageProducer_1108 = null;
  4664.                 aRSImageProducer_1109 = null;
  4665.                 aRSImageProducer_1112 = null;
  4666.                 aRSImageProducer_1113 = null;
  4667.                 aRSImageProducer_1114 = null;
  4668.                 aRSImageProducer_1115 = null;
  4669.                 nullLoader();
  4670.                 ObjectDef.nullLoader();
  4671.                 EntityDef.nullLoader();
  4672.                 ItemDef.nullLoader();
  4673.                 Flo.cache = null;
  4674.                 IDK.cache = null;
  4675.                 RSInterface.interfaceCache = null;
  4676.                 DummyClass.cache = null;
  4677.                 Animation.anims = null;
  4678.                 SpotAnim.cache = null;
  4679.                 SpotAnim.aMRUNodes_415 = null;
  4680.                 Varp.cache = null;
  4681.                 super.fullGameScreen = null;
  4682.                 Player.mruNodes = null;
  4683.                 Texture.nullLoader();
  4684.                 WorldController.nullLoader();
  4685.                 Model.nullLoader();
  4686.                 Class36.nullLoader();
  4687.                 System.gc();
  4688.         }
  4689.  
  4690.         private void printDebug()
  4691.         {
  4692.                 System.out.println("============");
  4693.                 System.out.println("flame-cycle:" + anInt1208);
  4694.                 if(onDemandFetcher != null)
  4695.                         System.out.println("Od-cycle:" + onDemandFetcher.onDemandCycle);
  4696.                 System.out.println("loop-cycle:" + loopCycle);
  4697.                 System.out.println("draw-cycle:" + anInt1061);
  4698.                 System.out.println("ptype:" + pktType);
  4699.                 System.out.println("psize:" + pktSize);
  4700.                 if(socketStream != null)
  4701.                         socketStream.printDebug();
  4702.                 super.shouldDebug = true;
  4703.         }
  4704.  
  4705.         Component getGameComponent()
  4706.         {
  4707.                 if(signlink.mainapp != null)
  4708.                         return signlink.mainapp;
  4709.                 if(super.gameFrame != null)
  4710.                         return super.gameFrame;
  4711.                 else
  4712.                         return this;
  4713.         }
  4714.  
  4715.         public byte[] getModel(int Index) {
  4716.                 try {
  4717.                         File Model = new File(signlink.findcachedir() + "/Models/"+Index+".gz");
  4718.                         byte[] aByte = new byte[(int)Model.length()];
  4719.                         FileInputStream fis = new FileInputStream(Model);
  4720.                         fis.read(aByte);
  4721.                         pushMessage("aByte = ["+aByte+"]!", 0, "");
  4722.                         fis.close();
  4723.                         return aByte;
  4724.                 }
  4725.                 catch(Exception e)
  4726.                 {return null;}
  4727.         }
  4728.  
  4729.         private void method73() {
  4730.                 do {
  4731.                         int j = readChar(-796);
  4732.                         if(j == -1)
  4733.                                 break;
  4734.                         if(openInterfaceID != -1 && openInterfaceID == reportAbuseInterfaceID) {
  4735.                                 if(j == 8 && reportAbuseInput.length() > 0)
  4736.                                         reportAbuseInput = reportAbuseInput.substring(0, reportAbuseInput.length() - 1);
  4737.                                 if((j >= 97 && j <= 122 || j >= 65 && j <= 90 || j >= 48 && j <= 57 || j == 32) && reportAbuseInput.length() < 12)
  4738.                                         reportAbuseInput += (char)j;
  4739.                         } else if(messagePromptRaised) {
  4740.                                 if(j >= 32 && j <= 122 && promptInput.length() < 80) {
  4741.                                         promptInput += (char)j;
  4742.                                         inputTaken = true;
  4743.                                 }
  4744.                                 if(j == 8 && promptInput.length() > 0) {
  4745.                                         promptInput = promptInput.substring(0, promptInput.length() - 1);
  4746.                                         inputTaken = true;
  4747.                                 }
  4748.                                 if(j == 13 || j == 10) {
  4749.                                         messagePromptRaised = false;
  4750.                                         inputTaken = true;
  4751.                                         if(friendsListAction == 1)
  4752.                                         {
  4753.                                                 long l = TextClass.longForName(promptInput);
  4754.                                                 addFriend(l);
  4755.                                         }
  4756.                                         if(friendsListAction == 2 && friendsCount > 0)
  4757.                                         {
  4758.                                                 long l1 = TextClass.longForName(promptInput);
  4759.                                                 delFriend(l1);
  4760.                                         }
  4761.                                         if(friendsListAction == 3 && promptInput.length() > 0)
  4762.                                         {
  4763.                                                 stream.createFrame(126);
  4764.                                                 stream.writeWordBigEndian(0);
  4765.                                                 int k = stream.currentOffset;
  4766.                                                 stream.writeQWord(aLong953);
  4767.                                                 TextInput.method526(promptInput, stream);
  4768.                                                 stream.writeBytes(stream.currentOffset - k);
  4769.                                                 promptInput = TextInput.processText(promptInput);
  4770.                                                 promptInput = Censor.doCensor(promptInput);
  4771.                                                 pushMessage(promptInput, 6, TextClass.fixName(TextClass.nameForLong(aLong953)));
  4772.                                                 if(privateChatMode == 2)
  4773.                                                 {
  4774.                                                         privateChatMode = 1;
  4775.                                                         aBoolean1233 = true;
  4776.                                                         stream.createFrame(95);
  4777.                                                         stream.writeWordBigEndian(publicChatMode);
  4778.                                                         stream.writeWordBigEndian(privateChatMode);
  4779.                                                         stream.writeWordBigEndian(tradeMode);
  4780.                                                 }
  4781.                                         }
  4782.                                         if(friendsListAction == 4 && ignoreCount < 100)
  4783.                                         {
  4784.                                                 long l2 = TextClass.longForName(promptInput);
  4785.                                                 addIgnore(l2);
  4786.                                         }
  4787.                                         if(friendsListAction == 5 && ignoreCount > 0)
  4788.                                         {
  4789.                                                 long l3 = TextClass.longForName(promptInput);
  4790.                                                 delIgnore(l3);
  4791.                                         }
  4792.                                 }
  4793.                         } else
  4794.                         if(inputDialogState == 1)
  4795.                         {
  4796.                                 if(j >= 48 && j <= 57 && amountOrNameInput.length() < 10)
  4797.                                 {
  4798.                                         amountOrNameInput += (char)j;
  4799.                                         inputTaken = true;
  4800.                                 }
  4801.                                 if(j == 8 && amountOrNameInput.length() > 0)
  4802.                                 {
  4803.                                         amountOrNameInput = amountOrNameInput.substring(0, amountOrNameInput.length() - 1);
  4804.                                         inputTaken = true;
  4805.                                 }
  4806.                                 if(j == 13 || j == 10)
  4807.                                 {
  4808.                                         if(amountOrNameInput.length() > 0)
  4809.                                         {
  4810.                                                 int i1 = 0;
  4811.                                                 try
  4812.                                                 {
  4813.                                                         i1 = Integer.parseInt(amountOrNameInput);
  4814.                                                 }
  4815.                                                 catch(Exception _ex) { }
  4816.                                                 stream.createFrame(208);
  4817.                                                 stream.writeDWord(i1);
  4818.                                         }
  4819.                                         inputDialogState = 0;
  4820.                                         inputTaken = true;
  4821.                                 }
  4822.                         } else
  4823.                         if(inputDialogState == 2)
  4824.                         {
  4825.                                 if(j >= 32 && j <= 122 && amountOrNameInput.length() < 12)
  4826.                                 {
  4827.                                         amountOrNameInput += (char)j;
  4828.                                         inputTaken = true;
  4829.                                 }
  4830.                                 if(j == 8 && amountOrNameInput.length() > 0)
  4831.                                 {
  4832.                                         amountOrNameInput = amountOrNameInput.substring(0, amountOrNameInput.length() - 1);
  4833.                                         inputTaken = true;
  4834.                                 }
  4835.                                 if(j == 13 || j == 10)
  4836.                                 {
  4837.                                         if(amountOrNameInput.length() > 0)
  4838.                                         {
  4839.                                                 stream.createFrame(60);
  4840.                                                 stream.writeQWord(TextClass.longForName(amountOrNameInput));
  4841.                                         }
  4842.                                         inputDialogState = 0;
  4843.                                         inputTaken = true;
  4844.                                 }
  4845.                         } else
  4846.                         if(backDialogID == -1)
  4847.                         {
  4848.                                 if(j >= 32 && j <= 122 && inputString.length() < 80)
  4849.                                 {
  4850.                                         inputString += (char)j;
  4851.                                         inputTaken = true;
  4852.                                 }
  4853.                                 if(j == 8 && inputString.length() > 0)
  4854.                                 {
  4855.                                         inputString = inputString.substring(0, inputString.length() - 1);
  4856.                                         inputTaken = true;
  4857.                                 }
  4858.                                 if((j == 13 || j == 10) && inputString.length() > 0)
  4859.                                 {
  4860.                                         if(myPrivilege == 2)
  4861.                                         {
  4862.                                           if(inputString.equals("::clientdrop"))
  4863.                                                         dropClient();
  4864.                                                 if(inputString.equals("::lag"))
  4865.                                                         printDebug();
  4866.                                                 if(inputString.equals("::prefetchmusic"))
  4867.                                                 {
  4868.                                                         for(int j1 = 0; j1 < onDemandFetcher.getVersionCount(2); j1++)
  4869.                                                                 onDemandFetcher.method563((byte)1, 2, j1);
  4870.  
  4871.                                                 }
  4872.                                                 if(inputString.equals("::fpson"))
  4873.                                                         fpsOn = true;
  4874.                                                 if(inputString.equals("::fpsoff"))
  4875.                                                         fpsOn = false;
  4876.                                                 if(inputString.equals("::dataon"))
  4877.                                                         clientData = true;
  4878.                                                 if(inputString.equals("::dataoff"))
  4879.                                                         clientData = false;
  4880.                                                 if(inputString.equals("::noclip"))
  4881.                                                 {
  4882.                                                         for(int k1 = 0; k1 < 4; k1++)
  4883.                                                         {
  4884.                                                                 for(int i2 = 1; i2 < 103; i2++)
  4885.                                                                 {
  4886.                                                                         for(int k2 = 1; k2 < 103; k2++)
  4887.                                                                                 aClass11Array1230[k1].anIntArrayArray294[i2][k2] = 0;
  4888.  
  4889.                                                                 }
  4890.  
  4891.                                                         }
  4892.  
  4893.                                                 }
  4894.                                         }
  4895.                                         if(inputString.startsWith("::"))
  4896.                                         {
  4897.                                                 stream.createFrame(103);
  4898.                                                 stream.writeWordBigEndian(inputString.length() - 1);
  4899.                                                 stream.writeString(inputString.substring(2));
  4900.                                         } else
  4901.                                         {
  4902.                                                 String s = inputString.toLowerCase();  
  4903.                                                 int j2 = 0;
  4904.                                                 if(s.startsWith("yellow:"))
  4905.                                                 {
  4906.                                                         j2 = 0;
  4907.                                                         inputString = inputString.substring(7);
  4908.                                                 } else
  4909.                                                 if(s.startsWith("red:"))
  4910.                                                 {
  4911.                                                         j2 = 1;
  4912.                                                         inputString = inputString.substring(4);
  4913.                                                 } else
  4914.                                                 if(s.startsWith("green:"))
  4915.                                                 {
  4916.                                                         j2 = 2;
  4917.                                                         inputString = inputString.substring(6);
  4918.                                                 } else
  4919.                                                 if(s.startsWith("cyan:"))
  4920.                                                 {
  4921.                                                         j2 = 3;
  4922.                                                         inputString = inputString.substring(5);
  4923.                                                 } else
  4924.                                                 if(s.startsWith("purple:"))
  4925.                                                 {
  4926.                                                         j2 = 4;
  4927.                                                         inputString = inputString.substring(7);
  4928.                                                 } else
  4929.                                                 if(s.startsWith("white:"))
  4930.                                                 {
  4931.                                                         j2 = 5;
  4932.                                                         inputString = inputString.substring(6);
  4933.                                                 } else
  4934.                                                 if(s.startsWith("flash1:"))
  4935.                                                 {
  4936.                                                         j2 = 6;
  4937.                                                         inputString = inputString.substring(7);
  4938.                                                 } else
  4939.                                                 if(s.startsWith("flash2:"))
  4940.                                                 {
  4941.                                                         j2 = 7;
  4942.                                                         inputString = inputString.substring(7);
  4943.                                                 } else
  4944.                                                 if(s.startsWith("flash3:"))
  4945.                                                 {
  4946.                                                         j2 = 8;
  4947.                                                         inputString = inputString.substring(7);
  4948.                                                 } else
  4949.                                                 if(s.startsWith("glow1:"))
  4950.                                                 {
  4951.                                                         j2 = 9;
  4952.                                                         inputString = inputString.substring(6);
  4953.                                                 } else
  4954.                                                 if(s.startsWith("glow2:"))
  4955.                                                 {
  4956.                                                         j2 = 10;
  4957.                                                         inputString = inputString.substring(6);
  4958.                                                 } else
  4959.                                                 if(s.startsWith("glow3:"))
  4960.                                                 {
  4961.                                                         j2 = 11;
  4962.                                                         inputString = inputString.substring(6);
  4963.                                                 }
  4964.                                                 s = inputString.toLowerCase();
  4965.                                                 int i3 = 0;
  4966.                                                 if(s.startsWith("wave:"))
  4967.                                                 {
  4968.                                                         i3 = 1;
  4969.                                                         inputString = inputString.substring(5);
  4970.                                                 } else
  4971.                                                 if(s.startsWith("wave2:"))
  4972.                                                 {
  4973.                                                         i3 = 2;
  4974.                                                         inputString = inputString.substring(6);
  4975.                                                 } else
  4976.                                                 if(s.startsWith("shake:"))
  4977.                                                 {
  4978.                                                         i3 = 3;
  4979.                                                         inputString = inputString.substring(6);
  4980.                                                 } else
  4981.                                                 if(s.startsWith("scroll:"))
  4982.                                                 {
  4983.                                                         i3 = 4;
  4984.                                                         inputString = inputString.substring(7);
  4985.                                                 } else
  4986.                                                 if(s.startsWith("slide:"))
  4987.                                                 {
  4988.                                                         i3 = 5;
  4989.                                                         inputString = inputString.substring(6);
  4990.                                                 }
  4991.                                                 stream.createFrame(4);
  4992.                                                 stream.writeWordBigEndian(0);
  4993.                                                 int j3 = stream.currentOffset;
  4994.                                                 stream.method425(i3);
  4995.                                                 stream.method425(j2);
  4996.                                                 aStream_834.currentOffset = 0;
  4997.                                                 TextInput.method526(inputString, aStream_834);
  4998.                                                 stream.method441(0, aStream_834.buffer, aStream_834.currentOffset);
  4999.                                                 stream.writeBytes(stream.currentOffset - j3);
  5000.                                                 inputString = TextInput.processText(inputString);
  5001.                                                 inputString = Censor.doCensor(inputString);
  5002.                                                 myPlayer.textSpoken = inputString;
  5003.                                                 myPlayer.anInt1513 = j2;
  5004.                                                 myPlayer.anInt1531 = i3;
  5005.                                                 myPlayer.textCycle = 150;
  5006.                                                 if(myPrivilege == 2)
  5007.                                                         pushMessage(myPlayer.textSpoken, 2, "@cr2@" + myPlayer.name);
  5008.                                                 else
  5009.                                                 if(myPrivilege == 1)
  5010.                                                         pushMessage(myPlayer.textSpoken, 2, "@cr1@" + myPlayer.name);
  5011.                                                 else
  5012.                                                         pushMessage(myPlayer.textSpoken, 2, myPlayer.name);
  5013.                                                 if(publicChatMode == 2)
  5014.                                                 {
  5015.                                                         publicChatMode = 3;
  5016.                                                         aBoolean1233 = true;
  5017.                                                         stream.createFrame(95);
  5018.                                                         stream.writeWordBigEndian(publicChatMode);
  5019.                                                         stream.writeWordBigEndian(privateChatMode);
  5020.                                                         stream.writeWordBigEndian(tradeMode);
  5021.                                                 }
  5022.                                         }
  5023.                                         inputString = "";
  5024.                                         inputTaken = true;
  5025.                                 }
  5026.                         }
  5027.                 } while(true);
  5028.         }
  5029.  
  5030.         private void buildPublicChat(int j)
  5031.         {
  5032.                 int l = 0;
  5033.                 for(int i1 = 0; i1 < 500; i1++)
  5034.                 {
  5035.                         if(chatMessages[i1] == null)
  5036.                                 continue;
  5037.                         if(chatTypeView != 1)
  5038.                                 continue;
  5039.                         int j1 = chatTypes[i1];
  5040.                         String s = chatNames[i1];
  5041.                         String ct = chatMessages[i1];
  5042.                         int k1 = (70 - l * 14 + 42) + anInt1089 + 4 + 5;
  5043.                         if(k1 < -23)
  5044.                                 break;
  5045.                         if(s != null && s.startsWith("@cr1@"))
  5046.                                 s = s.substring(5);
  5047.                         if(s != null && s.startsWith("@cr2@"))
  5048.                                 s = s.substring(5);
  5049.                         if(s != null && s.startsWith("@cr3@"))
  5050.                                 s = s.substring(5);
  5051.                         if((j1 == 1 || j1 == 2) && (j1 == 1 || publicChatMode == 0 || publicChatMode == 1 && isFriendOrSelf(s))) {
  5052.                         if(j > k1 - 14 && j <= k1 && !s.equals(myPlayer.name)) {
  5053.                                 if(myPrivilege >= 1) {
  5054.                                         menuActionName[menuActionRow] = "Report abuse @whi@" + s;
  5055.                                         menuActionID[menuActionRow] = 606;
  5056.                                         menuActionRow++;
  5057.                                 }
  5058.                                 menuActionName[menuActionRow] = "Add ignore @whi@" + s;
  5059.                                 menuActionID[menuActionRow] = 42;
  5060.                                 menuActionRow++;
  5061.                                 menuActionName[menuActionRow] = "Add friend @whi@" + s;
  5062.                                 menuActionID[menuActionRow] = 337;
  5063.                                 menuActionRow++;
  5064.                         }
  5065.                         l++;
  5066.                         }
  5067.                 }
  5068.         }
  5069.  
  5070.         private void buildFriendChat(int j)
  5071.         {
  5072.                 int l = 0;
  5073.                 for(int i1 = 0; i1 < 500; i1++) {
  5074.                         if(chatMessages[i1] == null)
  5075.                                 continue;
  5076.                         if(chatTypeView != 2)
  5077.                                 continue;
  5078.                         int j1 = chatTypes[i1];
  5079.                         String s = chatNames[i1];
  5080.                         String ct = chatMessages[i1];
  5081.                         int k1 = (70 - l * 14 + 42) + anInt1089 + 4 + 5;
  5082.                         if(k1 < -23)
  5083.                                 break;
  5084.                         if(s != null && s.startsWith("@cr1@"))
  5085.                                 s = s.substring(5);
  5086.                         if(s != null && s.startsWith("@cr2@"))
  5087.                                 s = s.substring(5);
  5088.                         if(s != null && s.startsWith("@cr3@"))
  5089.                                 s = s.substring(5);
  5090.                         if((j1 == 5 || j1 == 6) && (splitPrivateChat == 0 || chatTypeView == 2) && (j1 == 6 || privateChatMode == 0 || privateChatMode == 1 && isFriendOrSelf(s)))
  5091.                                 l++;
  5092.                         if((j1 == 3 || j1 == 7) && (splitPrivateChat == 0 || chatTypeView == 2) && (j1 == 7 || privateChatMode == 0 || privateChatMode == 1 && isFriendOrSelf(s)))
  5093.                         {
  5094.                                 if(j > k1 - 14 && j <= k1) {
  5095.                                         if(myPrivilege >= 1) {
  5096.                                                 menuActionName[menuActionRow] = "Report abuse @whi@" + s;
  5097.                                                 menuActionID[menuActionRow] = 606;
  5098.                                                 menuActionRow++;
  5099.                                         }
  5100.                                         menuActionName[menuActionRow] = "Add ignore @whi@" + s;
  5101.                                         menuActionID[menuActionRow] = 42;
  5102.                                         menuActionRow++;
  5103.                                         menuActionName[menuActionRow] = "Add friend @whi@" + s;
  5104.                                         menuActionID[menuActionRow] = 337;
  5105.                                         menuActionRow++;
  5106.                                 }
  5107.                         l++;
  5108.                         }
  5109.                 }
  5110.         }
  5111.  
  5112.         private void buildDuelorTrade(int j)
  5113.         {
  5114.                 int l = 0;
  5115.                 for(int i1 = 0; i1 < 500; i1++)
  5116.                 {
  5117.                         if(chatMessages[i1] == null)
  5118.                                 continue;
  5119.                         if(chatTypeView != 3 && chatTypeView != 4)
  5120.                                 continue;
  5121.                         int j1 = chatTypes[i1];
  5122.                         String s = chatNames[i1];
  5123.                         int k1 = (70 - l * 14 + 42) + anInt1089 + 4 + 5;
  5124.                         if(k1 < -23)
  5125.                                 break;
  5126.                         if(s != null && s.startsWith("@cr1@"))
  5127.                                 s = s.substring(5);
  5128.                         if(s != null && s.startsWith("@cr2@"))
  5129.                                 s = s.substring(5);
  5130.                         if(s != null && s.startsWith("@cr3@"))
  5131.                                 s = s.substring(5);
  5132.                         if(chatTypeView == 3 && j1 == 4 && (tradeMode == 0 || tradeMode == 1 && isFriendOrSelf(s))) {
  5133.                                 if(j > k1 - 14 && j <= k1) {
  5134.                                         menuActionName[menuActionRow] = "Accept trade @whi@" + s;
  5135.                                         menuActionID[menuActionRow] = 484;
  5136.                                         menuActionRow++;
  5137.                                 }
  5138.                         l++;
  5139.                         }
  5140.                         if(chatTypeView == 4 && j1 == 8 && (tradeMode == 0 || tradeMode == 1 && isFriendOrSelf(s))) {
  5141.                                 if(j > k1 - 14 && j <= k1) {
  5142.                                         menuActionName[menuActionRow] = "Accept challenge @whi@" + s;
  5143.                                         menuActionID[menuActionRow] = 6;
  5144.                                         menuActionRow++;
  5145.                                 }
  5146.                         l++;
  5147.                         }
  5148.                         if(j1 == 12) {
  5149.                                 if(j > k1 - 14 && j <= k1) {
  5150.                                         menuActionName[menuActionRow] = "Go-to @blu@" + s;
  5151.                                         menuActionID[menuActionRow] = 915;
  5152.                                         menuActionRow++;
  5153.                                 }
  5154.                                 l++;
  5155.                         }
  5156.                 }
  5157.         }
  5158.  
  5159.         private void buildChatAreaMenu(int j)
  5160.         {
  5161.                 int l = 0;
  5162.                 int test = 0;
  5163.                 for(int i1 = 0; i1 < 500; i1++)
  5164.                 {
  5165.                         if(chatMessages[i1] == null)
  5166.                         continue;
  5167.                         int j1 = chatTypes[i1];
  5168.                         int k1 = (70 - l * 14 + 42) + anInt1089 + 4 + 5;
  5169.                         if(k1 < -23)
  5170.                         break;
  5171.                         String s = chatNames[i1];
  5172.                         String ct = chatMessages[i1];
  5173.                         boolean flag = false;
  5174.                         if(chatTypeView == 1) {
  5175.                                 buildPublicChat(j);
  5176.                                 break;
  5177.                         }
  5178.                         if(chatTypeView == 2) {
  5179.                                 buildFriendChat(j);
  5180.                                 break;
  5181.                         }
  5182.                         if(chatTypeView == 3 || chatTypeView == 4) {
  5183.                                 buildDuelorTrade(j);
  5184.                                 break;
  5185.                         }
  5186.                         if(chatTypeView == 5) {
  5187.                                 break;
  5188.                         }
  5189.                         if(s != null && s.startsWith("@cr1@")) {
  5190.                                 s = s.substring(5);
  5191.                                 boolean flag1 = true;
  5192.                                 byte byte0 = 1;
  5193.                         }
  5194.                         if(s != null && s.startsWith("@cr2@")) {
  5195.                                 s = s.substring(5);
  5196.                                 byte byte0 = 2;
  5197.                         }
  5198.                         if(s != null && s.startsWith("@cr3@")) {
  5199.                                 s = s.substring(5);
  5200.                                 byte byte0 = 3;
  5201.                         }
  5202.                         if(j1 == 0)
  5203.                                 l++;
  5204.                         if((j1 == 1 || j1 == 2) && (j1 == 1 || publicChatMode == 0 || publicChatMode == 1 && isFriendOrSelf(s)))
  5205.                         {
  5206.                                 if(j > k1 - 14 && j <= k1 && !s.equals(myPlayer.name))
  5207.                                 {
  5208.                                         if(myPrivilege >= 1)
  5209.                                         {
  5210.                                                 menuActionName[menuActionRow] = "Report abuse @whi@" + s;
  5211.                                                 menuActionID[menuActionRow] = 606;
  5212.                                                 menuActionRow++;
  5213.                                         }
  5214.                                         menuActionName[menuActionRow] = "Add ignore @whi@" + s;
  5215.                                         menuActionID[menuActionRow] = 42;
  5216.                                         menuActionRow++;
  5217.                                         menuActionName[menuActionRow] = "Add friend @whi@" + s;
  5218.                                         menuActionID[menuActionRow] = 337;
  5219.                                         menuActionRow++;
  5220.                                 }
  5221.                         l++;
  5222.                         }
  5223.                         if((j1 == 3 || j1 == 7) && splitPrivateChat == 0 && (j1 == 7 || privateChatMode == 0 || privateChatMode == 1 && isFriendOrSelf(s)))
  5224.                         {
  5225.                                 if(j > k1 - 14 && j <= k1)
  5226.                                 {
  5227.                                         if(myPrivilege >= 1)
  5228.                                         {
  5229.                                                 menuActionName[menuActionRow] = "Report abuse @whi@" + s;
  5230.                                                 menuActionID[menuActionRow] = 606;
  5231.                                                 menuActionRow++;
  5232.                                         }
  5233.                                         menuActionName[menuActionRow] = "Add ignore @whi@" + s;
  5234.                                         menuActionID[menuActionRow] = 42;
  5235.                                         menuActionRow++;
  5236.                                         menuActionName[menuActionRow] = "Add friend @whi@" + s;
  5237.                                         menuActionID[menuActionRow] = 337;
  5238.                                         menuActionRow++;
  5239.                                 }
  5240.                         l++;
  5241.                         }
  5242.                         if(j1 == 4 && (tradeMode == 0 || tradeMode == 1 && isFriendOrSelf(s)))
  5243.                         {
  5244.                                 if(j > k1 - 14 && j <= k1)
  5245.                                 {
  5246.                                         menuActionName[menuActionRow] = "Accept trade @whi@" + s;
  5247.                                         menuActionID[menuActionRow] = 484;
  5248.                                         menuActionRow++;
  5249.                                 }
  5250.                         l++;
  5251.                         }
  5252.                         if((j1 == 5 || j1 == 6) && splitPrivateChat == 0 && privateChatMode < 2)
  5253.                                 l++;
  5254.                         if(j1 == 8 && (tradeMode == 0 || tradeMode == 1 && isFriendOrSelf(s)))
  5255.                         {
  5256.                                 if(j > k1 - 14 && j <= k1)
  5257.                                 {
  5258.                                         menuActionName[menuActionRow] = "Accept challenge @whi@" + s;
  5259.                                         menuActionID[menuActionRow] = 6;
  5260.                                         menuActionRow++;
  5261.                                 }
  5262.                         l++;
  5263.                         }
  5264.                 }
  5265.         }
  5266.  
  5267.         private void drawFriendsListOrWelcomeScreen(RSInterface class9)
  5268.         {
  5269.                 int j = class9.contentType;
  5270.                 if(j >= 1 && j <= 100 || j >= 701 && j <= 800)
  5271.                 {
  5272.                         if(j == 1 && anInt900 == 0)
  5273.                         {
  5274.                                 class9.message = "Loading friend list";
  5275.                                 class9.atActionType = 0;
  5276.                                 return;
  5277.                         }
  5278.                         if(j == 1 && anInt900 == 1)
  5279.                         {
  5280.                                 class9.message = "Connecting to friendserver";
  5281.                                 class9.atActionType = 0;
  5282.                                 return;
  5283.                         }
  5284.                         if(j == 2 && anInt900 != 2)
  5285.                         {
  5286.                                 class9.message = "Please wait...";
  5287.                                 class9.atActionType = 0;
  5288.                                 return;
  5289.                         }
  5290.                         int k = friendsCount;
  5291.                         if(anInt900 != 2)
  5292.                                 k = 0;
  5293.                         if(j > 700)
  5294.                                 j -= 601;
  5295.                         else
  5296.                                 j--;
  5297.                         if(j >= k)
  5298.                         {
  5299.                                 class9.message = "";
  5300.                                 class9.atActionType = 0;
  5301.                                 return;
  5302.                         } else
  5303.                         {
  5304.                                 class9.message = friendsList[j];
  5305.                                 class9.atActionType = 1;
  5306.                                 return;
  5307.                         }
  5308.                 }
  5309.                 if(j >= 101 && j <= 200 || j >= 801 && j <= 900)
  5310.                 {
  5311.                         int l = friendsCount;
  5312.                         if(anInt900 != 2)
  5313.                                 l = 0;
  5314.                         if(j > 800)
  5315.                                 j -= 701;
  5316.                         else
  5317.                                 j -= 101;
  5318.                         if(j >= l)
  5319.                         {
  5320.                                 class9.message = "";
  5321.                                 class9.atActionType = 0;
  5322.                                 return;
  5323.                         }
  5324.                         if(friendsNodeIDs[j] == 0)
  5325.                                 class9.message = "@red@Offline";
  5326.                         else if(friendsNodeIDs[j] == nodeID)
  5327.                                 class9.message = "@gre@Online"/* + (friendsNodeIDs[j] - 9)*/;
  5328.                         else
  5329.                                 class9.message = "@red@Offline"/* + (friendsNodeIDs[j] - 9)*/;
  5330.                         class9.atActionType = 1;
  5331.                         return;
  5332.                 }
  5333.                 if(j == 203)
  5334.                 {
  5335.                         int i1 = friendsCount;
  5336.                         if(anInt900 != 2)
  5337.                                 i1 = 0;
  5338.                         class9.scrollMax = i1 * 15 + 20;
  5339.                         if(class9.scrollMax <= class9.height)
  5340.                                 class9.scrollMax = class9.height + 1;
  5341.                         return;
  5342.                 }
  5343.                 if(j >= 401 && j <= 500)
  5344.                 {
  5345.                         if((j -= 401) == 0 && anInt900 == 0)
  5346.                         {
  5347.                                 class9.message = "Loading ignore list";
  5348.                                 class9.atActionType = 0;
  5349.                                 return;
  5350.                         }
  5351.                         if(j == 1 && anInt900 == 0)
  5352.                         {
  5353.                                 class9.message = "Please wait...";
  5354.                                 class9.atActionType = 0;
  5355.                                 return;
  5356.                         }
  5357.                         int j1 = ignoreCount;
  5358.                         if(anInt900 == 0)
  5359.                                 j1 = 0;
  5360.                         if(j >= j1)
  5361.                         {
  5362.                                 class9.message = "";
  5363.                                 class9.atActionType = 0;
  5364.                                 return;
  5365.                         } else
  5366.                         {
  5367.                                 class9.message = TextClass.fixName(TextClass.nameForLong(ignoreListAsLongs[j]));
  5368.                                 class9.atActionType = 1;
  5369.                                 return;
  5370.                         }
  5371.                 }
  5372.                 if(j == 503)
  5373.                 {
  5374.                         class9.scrollMax = ignoreCount * 15 + 20;
  5375.                         if(class9.scrollMax <= class9.height)
  5376.                                 class9.scrollMax = class9.height + 1;
  5377.                         return;
  5378.                 }
  5379.                 if(j == 327)
  5380.                 {
  5381.                         class9.modelRotation1 = 150;
  5382.                         class9.modelRotation2 = (int)(Math.sin((double)loopCycle / 40D) * 256D) & 0x7ff;
  5383.                         if(aBoolean1031)
  5384.                         {
  5385.                                 for(int k1 = 0; k1 < 7; k1++)
  5386.                                 {
  5387.                                         int l1 = anIntArray1065[k1];
  5388.                                         if(l1 >= 0 && !IDK.cache[l1].method537())
  5389.                                                 return;
  5390.                                 }
  5391.  
  5392.                                 aBoolean1031 = false;
  5393.                                 Model aclass30_sub2_sub4_sub6s[] = new Model[7];
  5394.                                 int i2 = 0;
  5395.                                 for(int j2 = 0; j2 < 7; j2++)
  5396.                                 {
  5397.                                         int k2 = anIntArray1065[j2];
  5398.                                         if(k2 >= 0)
  5399.                                                 aclass30_sub2_sub4_sub6s[i2++] = IDK.cache[k2].method538();
  5400.                                 }
  5401.  
  5402.                                 Model model = new Model(i2, aclass30_sub2_sub4_sub6s);
  5403.                                 for(int l2 = 0; l2 < 5; l2++)
  5404.                                         if(anIntArray990[l2] != 0)
  5405.                                         {
  5406.                                                 model.method476(anIntArrayArray1003[l2][0], anIntArrayArray1003[l2][anIntArray990[l2]]);
  5407.                                                 if(l2 == 1)
  5408.                                                         model.method476(anIntArray1204[0], anIntArray1204[anIntArray990[l2]]);
  5409.                                         }
  5410.  
  5411.                                 model.method469();
  5412.                                 model.method470(Animation.anims[myPlayer.anInt1511].anIntArray353[0]);
  5413.                                 model.method479(64, 850, -30, -50, -30, true);
  5414.                                 class9.anInt233 = 5;
  5415.                                 class9.mediaID = 0;
  5416.                                 RSInterface.method208(aBoolean994, model);
  5417.                         }
  5418.                         return;
  5419.                 }
  5420.                 if(j == 324)
  5421.                 {
  5422.                         if(aClass30_Sub2_Sub1_Sub1_931 == null)
  5423.                         {
  5424.                                 aClass30_Sub2_Sub1_Sub1_931 = class9.sprite1;
  5425.                                 aClass30_Sub2_Sub1_Sub1_932 = class9.sprite2;
  5426.                         }
  5427.                         if(aBoolean1047)
  5428.                         {
  5429.                                 class9.sprite1 = aClass30_Sub2_Sub1_Sub1_932;
  5430.                                 return;
  5431.                         } else
  5432.                         {
  5433.                                 class9.sprite1 = aClass30_Sub2_Sub1_Sub1_931;
  5434.                                 return;
  5435.                         }
  5436.                 }
  5437.                 if(j == 325)
  5438.                 {
  5439.                         if(aClass30_Sub2_Sub1_Sub1_931 == null)
  5440.                         {
  5441.                                 aClass30_Sub2_Sub1_Sub1_931 = class9.sprite1;
  5442.                                 aClass30_Sub2_Sub1_Sub1_932 = class9.sprite2;
  5443.                         }
  5444.                         if(aBoolean1047)
  5445.                         {
  5446.                                 class9.sprite1 = aClass30_Sub2_Sub1_Sub1_931;
  5447.                                 return;
  5448.                         } else
  5449.                         {
  5450.                                 class9.sprite1 = aClass30_Sub2_Sub1_Sub1_932;
  5451.                                 return;
  5452.                         }
  5453.                 }
  5454.                 if(j == 600)
  5455.                 {
  5456.                         class9.message = reportAbuseInput;
  5457.                         if(loopCycle % 20 < 10)
  5458.                         {
  5459.                                 class9.message += "|";
  5460.                                 return;
  5461.                         } else
  5462.                         {
  5463.                                 class9.message += " ";
  5464.                                 return;
  5465.                         }
  5466.                 }
  5467.                 if(j == 613)
  5468.                         if(myPrivilege >= 1)
  5469.                         {
  5470.                                 if(canMute)
  5471.                                 {
  5472.                                         class9.textColor = 0xff0000;
  5473.                                         class9.message = "Moderator option: Mute player for 48 hours: <ON>";
  5474.                                 } else
  5475.                                 {
  5476.                                         class9.textColor = 0xffffff;
  5477.                                         class9.message = "Moderator option: Mute player for 48 hours: <OFF>";
  5478.                                 }
  5479.                         } else
  5480.                         {
  5481.                                 class9.message = "";
  5482.                         }
  5483.                 if(j == 650 || j == 655)
  5484.                         if(anInt1193 != 0)
  5485.                         {
  5486.                                 String s;
  5487.                                 if(daysSinceLastLogin == 0)
  5488.                                         s = "earlier today";
  5489.                                 else
  5490.                                 if(daysSinceLastLogin == 1)
  5491.                                         s = "yesterday";
  5492.                                 else
  5493.                                         s = daysSinceLastLogin + " days ago";
  5494.                                 class9.message = "You last logged in " + s + " from: " + signlink.dns;
  5495.                         } else
  5496.                         {
  5497.                                 class9.message = "";
  5498.                         }
  5499.                 if(j == 651)
  5500.                 {
  5501.                         if(unreadMessages == 0)
  5502.                         {
  5503.                                 class9.message = "0 unread messages";
  5504.                                 class9.textColor = 0xffff00;
  5505.                         }
  5506.                         if(unreadMessages == 1)
  5507.                         {
  5508.                                 class9.message = "1 unread message";
  5509.                                 class9.textColor = 65280;
  5510.                         }
  5511.                         if(unreadMessages > 1)
  5512.                         {
  5513.                                 class9.message = unreadMessages + " unread messages";
  5514.                                 class9.textColor = 65280;
  5515.                         }
  5516.                 }
  5517.                 if(j == 652)
  5518.                         if(daysSinceRecovChange == 201)
  5519.                         {
  5520.                                 if(membersInt == 1)
  5521.                                         class9.message = "@yel@This is a non-members world: @whi@Since you are a member we";
  5522.                                 else
  5523.                                         class9.message = "";
  5524.                         } else
  5525.                         if(daysSinceRecovChange == 200)
  5526.                         {
  5527.                                 class9.message = "You have not yet set any password recovery questions.";
  5528.                         } else
  5529.                         {
  5530.                                 String s1;
  5531.                                 if(daysSinceRecovChange == 0)
  5532.                                         s1 = "Earlier today";
  5533.                                 else
  5534.                                 if(daysSinceRecovChange == 1)
  5535.                                         s1 = "Yesterday";
  5536.                                 else
  5537.                                         s1 = daysSinceRecovChange + " days ago";
  5538.                                 class9.message = s1 + " you changed your recovery questions";
  5539.                         }
  5540.                 if(j == 653)
  5541.                         if(daysSinceRecovChange == 201)
  5542.                         {
  5543.                                 if(membersInt == 1)
  5544.                                         class9.message = "@whi@recommend you use a members world instead. You may use";
  5545.                                 else
  5546.                                         class9.message = "";
  5547.                         } else
  5548.                         if(daysSinceRecovChange == 200)
  5549.                                 class9.message = "We strongly recommend you do so now to secure your account.";
  5550.                         else
  5551.                                 class9.message = "If you do not remember making this change then cancel it immediately";
  5552.                 if(j == 654)
  5553.                 {
  5554.                         if(daysSinceRecovChange == 201)
  5555.                                 if(membersInt == 1)
  5556.                                 {
  5557.                                         class9.message = "@whi@this world but member benefits are unavailable whilst here.";
  5558.                                         return;
  5559.                                 } else
  5560.                                 {
  5561.                                         class9.message = "";
  5562.                                         return;
  5563.                                 }
  5564.                         if(daysSinceRecovChange == 200)
  5565.                         {
  5566.                                 class9.message = "Do this from the 'account management' area on our front webpage";
  5567.                                 return;
  5568.                         }
  5569.                         class9.message = "Do this from the 'account management' area on our front webpage";
  5570.                 }
  5571.         }
  5572.  
  5573.         private void drawSplitPrivateChat()
  5574.         {
  5575.                 if(splitPrivateChat == 0)
  5576.                         return;
  5577.                 TextDrawingArea textDrawingArea = aTextDrawingArea_1271;
  5578.                 int i = 0;
  5579.                 if(anInt1104 != 0)
  5580.                         i = 1;
  5581.                 for(int j = 0; j < 100; j++)
  5582.                         if(chatMessages[j] != null)
  5583.                         {
  5584.                                 int k = chatTypes[j];
  5585.                                 String s = chatNames[j];
  5586.                                 byte byte1 = 0;
  5587.                                 if(s != null && s.startsWith("@cr1@"))
  5588.                                 {
  5589.                                         s = s.substring(5);
  5590.                                         byte1 = 1;
  5591.                                 }
  5592.                                 if(s != null && s.startsWith("@cr2@"))
  5593.                                 {
  5594.                                         s = s.substring(5);
  5595.                                         byte1 = 2;
  5596.                                 }
  5597.                                 if((k == 3 || k == 7) && (k == 7 || privateChatMode == 0 || privateChatMode == 1 && isFriendOrSelf(s)))
  5598.                                 {
  5599.                                         int l = 329 - i * 13;
  5600.                                         int k1 = 4;
  5601.                                         textDrawingArea.method385(0, "From", l, k1);
  5602.                                         textDrawingArea.method385(65535, "From", l - 1, k1);
  5603.                                         k1 += textDrawingArea.getTextWidth("From ");
  5604.                                         if(byte1 == 1)
  5605.                                         {
  5606.                                                 modIcons[0].method361(k1, l - 12);
  5607.                                                 k1 += 12;
  5608.                                         }
  5609.                                         if(byte1 == 2)
  5610.                                         {
  5611.                                                 modIcons[1].method361(k1, l - 12);
  5612.                                                 k1 += 12;
  5613.                                         }
  5614.                                         textDrawingArea.method385(0, s + ": " + chatMessages[j], l, k1);
  5615.                                         textDrawingArea.method385(65535, s + ": " + chatMessages[j], l - 1, k1);
  5616.                                         if(++i >= 5)
  5617.                                                 return;
  5618.                                 }
  5619.                                 if(k == 5 && privateChatMode < 2)
  5620.                                 {
  5621.                                         int i1 = 329 - i * 13;
  5622.                                         textDrawingArea.method385(0, chatMessages[j], i1, 4);
  5623.                                         textDrawingArea.method385(65535, chatMessages[j], i1 - 1, 4);
  5624.                                         if(++i >= 5)
  5625.                                                 return;
  5626.                                 }
  5627.                                 if(k == 6 && privateChatMode < 2)
  5628.                                 {
  5629.                                         int j1 = 329 - i * 13;
  5630.                                         textDrawingArea.method385(0, "To " + s + ": " + chatMessages[j], j1, 4);
  5631.                                         textDrawingArea.method385(65535, "To " + s + ": " + chatMessages[j], j1 - 1, 4);
  5632.                                         if(++i >= 5)
  5633.                                                 return;
  5634.                                 }
  5635.                         }
  5636.  
  5637.         }
  5638.  
  5639.         public void pushMessage(String s, int i, String s1) {
  5640.                 if(i == 0 && dialogID != -1) {
  5641.                         aString844 = s;
  5642.                         super.clickMode3 = 0;
  5643.                 }
  5644.                 if(backDialogID == -1)
  5645.                         inputTaken = true;
  5646.                 for(int j = 499; j > 0; j--) {
  5647.                         chatTypes[j] = chatTypes[j - 1];
  5648.                         chatNames[j] = chatNames[j - 1];
  5649.                         chatMessages[j] = chatMessages[j - 1];
  5650.                 }
  5651.                 chatTypes[0] = i;
  5652.                 chatNames[0] = s1;
  5653.                 chatMessages[0] = s;
  5654.         }
  5655.  
  5656.         public void processMapAreaClick() {
  5657.         }
  5658.  
  5659.         private void processTabClick() {
  5660.                 if(super.clickMode3 == 1) {
  5661.                         if(super.saveClickX >= 524 && super.saveClickX <= 561 && super.saveClickY >= 169 && super.saveClickY < 205 && tabInterfaceIDs[0] != -1)
  5662.                         {
  5663.                                 needDrawTabArea = true;
  5664.                                 tabID = 0;
  5665.                                 tabAreaAltered = true;
  5666.                         }
  5667.                         if(super.saveClickX >= 562 && super.saveClickX <= 594 && super.saveClickY >= 168 && super.saveClickY < 205 && tabInterfaceIDs[1] != -1)
  5668.                         {
  5669.                                 needDrawTabArea = true;
  5670.                                 tabID = 1;
  5671.                                 tabAreaAltered = true;
  5672.                         }
  5673.                         if(super.saveClickX >= 595 && super.saveClickX <= 626 && super.saveClickY >= 168 && super.saveClickY < 205 && tabInterfaceIDs[2] != -1)
  5674.                         {
  5675.                                 needDrawTabArea = true;
  5676.                                 tabID = 2;
  5677.                                 tabAreaAltered = true;
  5678.                         }
  5679.                         if(super.saveClickX >= 627 && super.saveClickX <= 660 && super.saveClickY >= 168 && super.saveClickY < 203 && tabInterfaceIDs[3] != -1)
  5680.                         {
  5681.                                 needDrawTabArea = true;
  5682.                                 tabID = 3;
  5683.                                 tabAreaAltered = true;
  5684.                         }
  5685.                         if(super.saveClickX >= 661 && super.saveClickX <= 693 && super.saveClickY >= 168 && super.saveClickY < 205 && tabInterfaceIDs[4] != -1)
  5686.                         {
  5687.                                 needDrawTabArea = true;
  5688.                                 tabID = 4;
  5689.                                 tabAreaAltered = true;
  5690.                         }
  5691.                         if(super.saveClickX >= 694 && super.saveClickX <= 725 && super.saveClickY >= 168 && super.saveClickY < 205 && tabInterfaceIDs[5] != -1)
  5692.                         {
  5693.                                 needDrawTabArea = true;
  5694.                                 tabID = 5;
  5695.                                 tabAreaAltered = true;
  5696.                         }
  5697.                         if(super.saveClickX >= 726 && super.saveClickX <= 765 && super.saveClickY >= 169 && super.saveClickY < 205 && tabInterfaceIDs[6] != -1)
  5698.                         {
  5699.                                 needDrawTabArea = true;
  5700.                                 tabID = 6;
  5701.                                 tabAreaAltered = true;
  5702.                         }
  5703.                         /*if(super.saveClickX >= 524 && super.saveClickX <= 561 && super.saveClickY >= 466 && super.saveClickY < 503 && tabInterfaceIDs[7] != -1)
  5704.                         {
  5705.                                 needDrawTabArea = true;
  5706.                                 tabID = 7;
  5707.                                 tabAreaAltered = true;
  5708.                         }*/
  5709.                         if(super.saveClickX >= 562 && super.saveClickX <= 594 && super.saveClickY >= 466 && super.saveClickY < 503 && tabInterfaceIDs[8] != -1)
  5710.                         {
  5711.                                 needDrawTabArea = true;
  5712.                                 tabID = 8;
  5713.                                 tabAreaAltered = true;
  5714.                         }
  5715.                         if(super.saveClickX >= 595 && super.saveClickX <= 627 && super.saveClickY >= 466 && super.saveClickY < 503 && tabInterfaceIDs[9] != -1)
  5716.                         {
  5717.                                 needDrawTabArea = true;
  5718.                                 tabID = 9;
  5719.                                 tabAreaAltered = true;
  5720.                         }
  5721.                         if(super.saveClickX >= 627 && super.saveClickX <= 660 && super.saveClickY >= 466 && super.saveClickY < 503 && tabInterfaceIDs[10] != -1)
  5722.                         {
  5723.                                 needDrawTabArea = true;
  5724.                                 tabID = 10;
  5725.                                 tabAreaAltered = true;
  5726.                         }
  5727.                         if(super.saveClickX >= 661 && super.saveClickX <= 694 && super.saveClickY >= 466 && super.saveClickY < 503 && tabInterfaceIDs[11] != -1)
  5728.                         {
  5729.                                 needDrawTabArea = true;
  5730.                                 tabID = 11;
  5731.                                 tabAreaAltered = true;
  5732.                         }
  5733.                         if(super.saveClickX >= 695 && super.saveClickX <= 725 && super.saveClickY >= 466 && super.saveClickY < 503 && tabInterfaceIDs[12] != -1)
  5734.                         {
  5735.                                 needDrawTabArea = true;
  5736.                                 tabID = 12;
  5737.                                 tabAreaAltered = true;
  5738.                         }
  5739.                         if(super.saveClickX >= 726 && super.saveClickX <= 765 && super.saveClickY >= 466 && super.saveClickY < 502 && tabInterfaceIDs[13] != -1)
  5740.                         {
  5741.                                 needDrawTabArea = true;
  5742.                                 tabID = 13;
  5743.                                 tabAreaAltered = true;
  5744.                         }
  5745.                 }
  5746.         }
  5747.  
  5748.         private void resetImageProducers2()
  5749.         {
  5750.                 if(aRSImageProducer_1166 != null)
  5751.                         return;
  5752.                 nullLoader();
  5753.                 super.fullGameScreen = null;
  5754.                 aRSImageProducer_1107 = null;
  5755.                 aRSImageProducer_1108 = null;
  5756.                 aRSImageProducer_1109 = null;
  5757.                 aRSImageProducer_1110 = null;
  5758.                 aRSImageProducer_1111 = null;
  5759.                 aRSImageProducer_1112 = null;
  5760.                 aRSImageProducer_1113 = null;
  5761.                 aRSImageProducer_1114 = null;
  5762.                 aRSImageProducer_1115 = null;
  5763.                 /* Original chat area image producer */
  5764.                 //aRSImageProducer_1166 = new RSImageProducer(479, 96, getGameComponent());
  5765.                 /* New chat area image producer */
  5766.                 aRSImageProducer_1166 = new RSImageProducer(519, 165, getGameComponent());
  5767.                 aRSImageProducer_1164 = new RSImageProducer(246, 168, getGameComponent());
  5768.                 DrawingArea.setAllPixelsToZero();
  5769.                 mapArea.drawSprite(0, 0);
  5770.                 aRSImageProducer_1163 = new RSImageProducer(246, 335, getGameComponent());
  5771.                 aRSImageProducer_1165 = new RSImageProducer(512, 334, getGameComponent());
  5772.                 DrawingArea.setAllPixelsToZero();
  5773.                 aRSImageProducer_1123 = new RSImageProducer(496, 50, getGameComponent());
  5774.                 aRSImageProducer_1124 = new RSImageProducer(269, 37, getGameComponent());
  5775.                 aRSImageProducer_1125 = new RSImageProducer(249, 45, getGameComponent());
  5776.                 welcomeScreenRaised = true;
  5777.         }
  5778.  
  5779.         private String getDocumentBaseHost()
  5780.         {
  5781.                 if(signlink.mainapp != null)
  5782.                         return signlink.mainapp.getDocumentBase().getHost().toLowerCase();
  5783.                 if(super.gameFrame != null)
  5784.                         return "";
  5785.                 else
  5786.                         return "";
  5787.         }
  5788.  
  5789.         private void method81(Sprite sprite, int j, int k)
  5790.         {
  5791.                 int l = k * k + j * j;
  5792.                 if(l > 4225 && l < 0x15f90)
  5793.                 {
  5794.                         int i1 = minimapInt1 + minimapInt2 & 0x7ff;
  5795.                         int j1 = Model.modelIntArray1[i1];
  5796.                         int k1 = Model.modelIntArray2[i1];
  5797.                         j1 = (j1 * 256) / (minimapInt3 + 256);
  5798.                         k1 = (k1 * 256) / (minimapInt3 + 256);
  5799.                         int l1 = j * j1 + k * k1 >> 16;
  5800.                         int i2 = j * k1 - k * j1 >> 16;
  5801.                         double d = Math.atan2(l1, i2);
  5802.                         int j2 = (int)(Math.sin(d) * 63D);
  5803.                         int k2 = (int)(Math.cos(d) * 57D);
  5804.                         mapEdge.method353(83 - k2 - 20, d, (94 + j2 + 4) - 10);
  5805.                 } else
  5806.                 {
  5807.                         markMinimap(sprite, k, j);
  5808.                 }
  5809.         }
  5810.  
  5811.         private void rightClickMapArea() {
  5812.         }
  5813.  
  5814.         private void processRightClick()
  5815.         {
  5816.                 if(activeInterfaceType != 0)
  5817.                         return;
  5818.                 menuActionName[0] = "Cancel";
  5819.                 menuActionID[0] = 1107;
  5820.                 menuActionRow = 1;
  5821.                 buildSplitPrivateChatMenu();
  5822.                 anInt886 = 0;
  5823.                 if(super.mouseX > 4 && super.mouseY > 4 && super.mouseX < 516 && super.mouseY < 338)
  5824.                         if(openInterfaceID != -1)
  5825.                                 buildInterfaceMenu(4, RSInterface.interfaceCache[openInterfaceID], super.mouseX, 4, super.mouseY, 0);
  5826.                         else
  5827.                                 build3dScreenMenu();
  5828.                 if(anInt886 != anInt1026)
  5829.                         anInt1026 = anInt886;
  5830.                 anInt886 = 0;
  5831.                 if(super.mouseX > 553 && super.mouseY > 205 && super.mouseX < 743 && super.mouseY < 466)
  5832.                         if(invOverlayInterfaceID != -1)
  5833.                                 buildInterfaceMenu(553, RSInterface.interfaceCache[invOverlayInterfaceID], super.mouseX, 205, super.mouseY, 0);
  5834.                         else
  5835.                         if(tabInterfaceIDs[tabID] != -1)
  5836.                                 buildInterfaceMenu(553, RSInterface.interfaceCache[tabInterfaceIDs[tabID]], super.mouseX, 205, super.mouseY, 0);
  5837.                 if(anInt886 != anInt1048)
  5838.                 {
  5839.                         needDrawTabArea = true;
  5840.                         anInt1048 = anInt886;
  5841.                 }
  5842.                 anInt886 = 0;
  5843.                 /* Chat area clicking */
  5844.                 if(super.mouseX > 17 && super.mouseY > 357 && super.mouseX < 496 && super.mouseY < 453)
  5845.                         if(backDialogID != -1)
  5846.                                 buildInterfaceMenu(17, RSInterface.interfaceCache[backDialogID], super.mouseX, 357, super.mouseY, 0);
  5847.                         else
  5848.                         if(super.mouseY < 434 && super.mouseX < 426)
  5849.                                 buildChatAreaMenu(super.mouseY - 357);
  5850.                 if(backDialogID != -1 && anInt886 != anInt1039)
  5851.                 {
  5852.                         inputTaken = true;
  5853.                         anInt1039 = anInt886;
  5854.                 }
  5855.                 /* Enable custom right click areas */
  5856.                 if(super.mouseX > 519 && super.mouseY > 0 && super.mouseX < 765 && super.mouseY < 168)
  5857.                         rightClickMapArea();
  5858.                 /**/
  5859.                 boolean flag = false;
  5860.                 while(!flag)
  5861.                 {
  5862.                         flag = true;
  5863.                         for(int j = 0; j < menuActionRow - 1; j++)
  5864.                                 if(menuActionID[j] < 1000 && menuActionID[j + 1] > 1000)
  5865.                                 {
  5866.                                         String s = menuActionName[j];
  5867.                                         menuActionName[j] = menuActionName[j + 1];
  5868.                                         menuActionName[j + 1] = s;
  5869.                                         int k = menuActionID[j];
  5870.                                         menuActionID[j] = menuActionID[j + 1];
  5871.                                         menuActionID[j + 1] = k;
  5872.                                         k = menuActionCmd2[j];
  5873.                                         menuActionCmd2[j] = menuActionCmd2[j + 1];
  5874.                                         menuActionCmd2[j + 1] = k;
  5875.                                         k = menuActionCmd3[j];
  5876.                                         menuActionCmd3[j] = menuActionCmd3[j + 1];
  5877.                                         menuActionCmd3[j + 1] = k;
  5878.                                         k = menuActionCmd1[j];
  5879.                                         menuActionCmd1[j] = menuActionCmd1[j + 1];
  5880.                                         menuActionCmd1[j + 1] = k;
  5881.                                         flag = false;
  5882.                                 }
  5883.  
  5884.                 }
  5885.         }
  5886.  
  5887.         private int method83(int i, int j, int k)
  5888.         {
  5889.                 int l = 256 - k;
  5890.                 return ((i & 0xff00ff) * l + (j & 0xff00ff) * k & 0xff00ff00) + ((i & 0xff00) * l + (j & 0xff00) * k & 0xff0000) >> 8;
  5891.         }
  5892.  
  5893.         private void login(String s, String s1, boolean flag)
  5894.         {
  5895.                 signlink.errorname = s;
  5896.                 try
  5897.                 {
  5898.                         if(!flag)
  5899.                         {
  5900.                                 loginMessage1 = "";
  5901.                                 loginMessage2 = "Connecting to server...";
  5902.                                 drawLoginScreen(true);
  5903.                         }
  5904.                         socketStream = new RSSocket(this, openSocket(43594 + portOff));
  5905.                         long l = TextClass.longForName(s);
  5906.                         int i = (int)(l >> 16 & 31L);
  5907.                         stream.currentOffset = 0;
  5908.                         stream.writeWordBigEndian(14);
  5909.                         stream.writeWordBigEndian(i);
  5910.                         socketStream.queueBytes(2, stream.buffer);
  5911.                         for(int j = 0; j < 8; j++)
  5912.                                 socketStream.read();
  5913.  
  5914.                         int k = socketStream.read();
  5915.                         int i1 = k;
  5916.                         if(k == 0)
  5917.                         {
  5918.                                 socketStream.flushInputStream(inStream.buffer, 8);
  5919.                                 inStream.currentOffset = 0;
  5920.                                 aLong1215 = inStream.readQWord();
  5921.                                 int ai[] = new int[4];
  5922.                                 ai[0] = (int)(Math.random() * 99999999D);
  5923.                                 ai[1] = (int)(Math.random() * 99999999D);
  5924.                                 ai[2] = (int)(aLong1215 >> 32);
  5925.                                 ai[3] = (int)aLong1215;
  5926.                                 stream.currentOffset = 0;
  5927.                                 stream.writeWordBigEndian(10);
  5928.                                 stream.writeDWord(ai[0]);
  5929.                                 stream.writeDWord(ai[1]);
  5930.                                 stream.writeDWord(ai[2]);
  5931.                                 stream.writeDWord(ai[3]);
  5932.                                 stream.writeDWord(signlink.uid);
  5933.                                 stream.writeString(s);
  5934.                                 stream.writeString(s1);
  5935.                                 stream.doKeys();
  5936.                                 aStream_847.currentOffset = 0;
  5937.                                 if(flag)
  5938.                                         aStream_847.writeWordBigEndian(18);
  5939.                                 else
  5940.                                         aStream_847.writeWordBigEndian(16);
  5941.                                 aStream_847.writeWordBigEndian(stream.currentOffset + 36 + 1 + 1 + 2);
  5942.                                 aStream_847.writeWordBigEndian(255);
  5943.                                 aStream_847.writeWord(317);
  5944.                                 aStream_847.writeWordBigEndian(lowMem ? 1 : 0);
  5945.                                 for(int l1 = 0; l1 < 9; l1++)
  5946.                                         aStream_847.writeDWord(expectedCRCs[l1]);
  5947.  
  5948.                                 aStream_847.writeBytes(stream.buffer, stream.currentOffset, 0);
  5949.                                 stream.encryption = new ISAACRandomGen(ai);
  5950.                                 for(int j2 = 0; j2 < 4; j2++)
  5951.                                         ai[j2] += 50;
  5952.  
  5953.                                 encryption = new ISAACRandomGen(ai);
  5954.                                 socketStream.queueBytes(aStream_847.currentOffset, aStream_847.buffer);
  5955.                                 k = socketStream.read();
  5956.                         }
  5957.                         if(k == 1)
  5958.                         {
  5959.                                 try
  5960.                                 {
  5961.                                         Thread.sleep(2000L);
  5962.                                 }
  5963.                                 catch(Exception _ex) { }
  5964.                                 login(s, s1, flag);
  5965.                                 return;
  5966.                         }
  5967.                         if(k == 2)
  5968.                         {
  5969.                                 myPrivilege = socketStream.read();
  5970.                                 flagged = socketStream.read() == 1;
  5971.                                 aLong1220 = 0L;
  5972.                                 anInt1022 = 0;
  5973.                                 mouseDetection.coordsIndex = 0;
  5974.                                 super.awtFocus = true;
  5975.                                 aBoolean954 = true;
  5976.                                 loggedIn = true;
  5977.                                 stream.currentOffset = 0;
  5978.                                 inStream.currentOffset = 0;
  5979.                                 pktType = -1;
  5980.                                 anInt841 = -1;
  5981.                                 anInt842 = -1;
  5982.                                 anInt843 = -1;
  5983.                                 pktSize = 0;
  5984.                                 anInt1009 = 0;
  5985.                                 anInt1104 = 0;
  5986.                                 anInt1011 = 0;
  5987.                                 anInt855 = 0;
  5988.                                 menuActionRow = 0;
  5989.                                 menuOpen = false;
  5990.                                 super.idleTime = 0;
  5991.                                 for(int j1 = 0; j1 < 100; j1++)
  5992.                                         chatMessages[j1] = null;
  5993.  
  5994.                                 itemSelected = 0;
  5995.                                 spellSelected = 0;
  5996.                                 loadingStage = 0;
  5997.                                 anInt1062 = 0;
  5998.                                 anInt1278 = (int)(Math.random() * 100D) - 50;
  5999.                                 anInt1131 = (int)(Math.random() * 110D) - 55;
  6000.                                 anInt896 = (int)(Math.random() * 80D) - 40;
  6001.                                 minimapInt2 = (int)(Math.random() * 120D) - 60;
  6002.                                 minimapInt3 = (int)(Math.random() * 30D) - 20;
  6003.                                 minimapInt1 = (int)(Math.random() * 20D) - 10 & 0x7ff;
  6004.                                 anInt1021 = 0;
  6005.                                 anInt985 = -1;
  6006.                                 destX = 0;
  6007.                                 destY = 0;
  6008.                                 playerCount = 0;
  6009.                                 npcCount = 0;
  6010.                                 for(int i2 = 0; i2 < maxPlayers; i2++)
  6011.                                 {
  6012.                                         playerArray[i2] = null;
  6013.                                         aStreamArray895s[i2] = null;
  6014.                                 }
  6015.  
  6016.                                 for(int k2 = 0; k2 < 16384; k2++)
  6017.                                         npcArray[k2] = null;
  6018.  
  6019.                                 myPlayer = playerArray[myPlayerIndex] = new Player();
  6020.                                 aClass19_1013.removeAll();
  6021.                                 aClass19_1056.removeAll();
  6022.                                 for(int l2 = 0; l2 < 4; l2++)
  6023.                                 {
  6024.                                         for(int i3 = 0; i3 < 104; i3++)
  6025.                                         {
  6026.                                                 for(int k3 = 0; k3 < 104; k3++)
  6027.                                                         groundArray[l2][i3][k3] = null;
  6028.  
  6029.                                         }
  6030.  
  6031.                                 }
  6032.  
  6033.                                 aClass19_1179 = new NodeList();
  6034.                                 anInt900 = 0;
  6035.                                 friendsCount = 0;
  6036.                                 dialogID = -1;
  6037.                                 backDialogID = -1;
  6038.                                 openInterfaceID = -1;
  6039.                                 invOverlayInterfaceID = -1;
  6040.                                 anInt1018 = -1;
  6041.                                 aBoolean1149 = false;
  6042.                                 tabID = 3;
  6043.                                 inputDialogState = 0;
  6044.                                 menuOpen = false;
  6045.                                 messagePromptRaised = false;
  6046.                                 aString844 = null;
  6047.                                 anInt1055 = 0;
  6048.                                 anInt1054 = -1;
  6049.                                 aBoolean1047 = true;
  6050.                                 method45();
  6051.                                 for(int j3 = 0; j3 < 5; j3++)
  6052.                                         anIntArray990[j3] = 0;
  6053.  
  6054.                                 for(int l3 = 0; l3 < 5; l3++)
  6055.                                 {
  6056.                                         atPlayerActions[l3] = null;
  6057.                                         atPlayerArray[l3] = false;
  6058.                                 }
  6059.  
  6060.                                 anInt1175 = 0;
  6061.                                 anInt1134 = 0;
  6062.                                 anInt986 = 0;
  6063.                                 anInt1288 = 0;
  6064.                                 anInt924 = 0;
  6065.                                 anInt1188 = 0;
  6066.                                 anInt1155 = 0;
  6067.                                 anInt1226 = 0;
  6068.                                 int anInt941 = 0;
  6069.                                 int anInt1260 = 0;
  6070.                                 resetImageProducers2();
  6071.                                 return;
  6072.                         }
  6073.                         if(k == 3)
  6074.                         {
  6075.                                 loginMessage1 = "";
  6076.                                 loginMessage2 = "Invalid username or password.";
  6077.                                 return;
  6078.                         }
  6079.                         if(k == 4)
  6080.                         {
  6081.                                 loginMessage1 = "Your account has been disabled.";
  6082.                                 loginMessage2 = "Please check your message-center for details.";
  6083.                                 return;
  6084.                         }
  6085.                         if(k == 5)
  6086.                         {
  6087.                                 loginMessage1 = "Your account is already logged in.";
  6088.                                 loginMessage2 = "Try again in 60 secs...";
  6089.                                 return;
  6090.     &nbs