Advertisement
Guest User

Game.java

a guest
May 23rd, 2019
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 360.39 KB | None | 0 0
  1. import java.applet.AppletContext;
  2. import java.awt.Color;
  3. import java.awt.Component;
  4. import java.awt.Font;
  5. import java.awt.Graphics;
  6. import java.io.ByteArrayInputStream;
  7. import java.io.DataInputStream;
  8. import java.io.EOFException;
  9. import java.io.File;
  10. import java.io.FileInputStream;
  11. import java.io.IOException;
  12. import java.io.InputStream;
  13. import java.io.OutputStream;
  14. import java.net.InetAddress;
  15. import java.net.Socket;
  16. import java.net.URL;
  17. import java.text.DecimalFormat;
  18. import java.text.DecimalFormatSymbols;
  19. import java.util.Calendar;
  20. import java.util.Date;
  21.  
  22. @SuppressWarnings("serial")
  23. public class Game extends RSApplet {
  24.  
  25.     public static String intToKOrMilLongName(int i) {
  26.         String s = String.valueOf(i);
  27.         for (int k = s.length() - 3; k > 0; k -= 3) {
  28.             s = s.substring(0, k) + "," + s.substring(k);
  29.         }
  30.         if (s.length() > 8) {
  31.             s = "@gre@" + s.substring(0, s.length() - 8) + " million @whi@(" + s + ")";
  32.         } else if (s.length() > 4) {
  33.             s = "@cya@" + s.substring(0, s.length() - 4) + "K @whi@(" + s + ")";
  34.         }
  35.         return " " + s;
  36.     }
  37.    
  38.     static final boolean musicIsntNull() {
  39.         if (aClass56_749 == null)
  40.             return false;
  41.         return true;
  42.     }
  43.     void mouseWheelDragged(int i, int j) {
  44.         if (!mouseWheelDown)
  45.             return;
  46.         this.anInt1186 += i * 3;
  47.         this.anInt1187 += (j << 1);
  48.     }
  49.    
  50.     static final void method790() {
  51.         if (aClass56_749 != null) {
  52.             method891(false);
  53.             if (anInt720 > 0) {
  54.                 aClass56_749.method831(256);
  55.                 anInt720 = 0;
  56.             }
  57.             aClass56_749.method828();
  58.             aClass56_749 = null;
  59.         }
  60.     }
  61.    
  62.     public static String getFileNameWithoutExtension(String fileName) {
  63.         File tmpFile = new File(fileName);
  64.         tmpFile.getName();
  65.         int whereDot = tmpFile.getName().lastIndexOf('.');
  66.         if (0 < whereDot && whereDot <= tmpFile.getName().length() - 2) {
  67.             return tmpFile.getName().substring(0, whereDot);
  68.         }
  69.         return "";
  70.     }
  71.    
  72.     public String indexLocation(int cacheIndex, int index) {
  73.         return Signlink.findcachedir() + "index" + cacheIndex + "/" + (index != -1 ? index + ".gz" : "");
  74.     }
  75.  
  76.     public void repackCacheIndex(int cacheIndex) {
  77.         System.out.println("Started repacking index " + cacheIndex + ".");
  78.         int indexLength = new File(indexLocation(cacheIndex, -1)).listFiles().length;
  79.         File[] file = new File(indexLocation(cacheIndex, -1)).listFiles();
  80.         try {
  81.             for (int index = 0; index < indexLength; index++) {
  82.                 int fileIndex = Integer.parseInt(getFileNameWithoutExtension(file[index].toString()));
  83.                 byte[] data = fileToByteArray(cacheIndex, fileIndex);
  84.                 if(data != null && data.length > 0) {
  85.                     decompressors[cacheIndex].method234(data.length, data, fileIndex);
  86.                     System.out.println("Repacked " + fileIndex + ".");
  87.                 } else {
  88.                     System.out.println("Unable to locate index " + fileIndex + ".");
  89.                 }
  90.             }
  91.         } catch(Exception e) {
  92.             System.out.println("Error packing cache index " + cacheIndex + ".");
  93.         }
  94.         System.out.println("Finished repacking " + cacheIndex + ".");
  95.     }
  96.  
  97.     public byte[] fileToByteArray(int cacheIndex, int index) {
  98.         try {
  99.             if (indexLocation(cacheIndex, index).length() <= 0 || indexLocation(cacheIndex, index) == null) {
  100.                 return null;
  101.             }
  102.             File file = new File(indexLocation(cacheIndex, index));
  103.             byte[] fileData = new byte[(int)file.length()];
  104.             FileInputStream fis = new FileInputStream(file);
  105.             fis.read(fileData);
  106.             fis.close();
  107.             return fileData;
  108.         } catch(Exception e) {
  109.             return null;
  110.         }
  111.     }
  112.    
  113.     public void musics() {
  114.         for(int MusicIndex = 0; MusicIndex < 3536; MusicIndex++) {
  115.             byte[] abyte0 = GetMusic(MusicIndex);
  116.                 if (abyte0 != null && abyte0.length > 0) {
  117.                     decompressors[3].method234(abyte0.length, abyte0, MusicIndex);
  118.                 }
  119.             }
  120.         }
  121.    
  122.     public byte[] GetMusic(int Index) {
  123.         try {
  124.         File Music = new File(Signlink.findcachedir() + "./sounds/"+Index+".gz");
  125.         byte[] aByte = new byte[(int)Music.length()];
  126.         FileInputStream Fis = new FileInputStream(Music);
  127.         Fis.read(aByte);
  128.         Fis.close();
  129.         return aByte;
  130.         } catch(Exception e) {
  131.         return null;
  132.         }
  133.     }
  134.    
  135.     static final void setVolume(int i) {
  136.         if (musicIsntNull()) {
  137.             if (fetchMusic)
  138.                 musicVolume2 = i;
  139.             else
  140.                 method900(i);
  141.         }
  142.     }
  143.    
  144.     static final void method900(int i) {
  145.         if (aClass56_749 != null) {
  146.             if (anInt720 == 0) {
  147.                 if (anInt478 >= 0) {
  148.                     anInt478 = i;
  149.                     aClass56_749.method830(i, 0);
  150.                 }
  151.             } else if (aByteArray347 != null)
  152.                 anInt1478 = i;
  153.         }
  154.     }
  155.    
  156.     static final synchronized void method55(boolean bool) {
  157.         if (musicIsntNull()) {
  158.             method891(bool);
  159.             fetchMusic = false;
  160.         }
  161.     }
  162.    
  163.     static final void method891(boolean bool) {
  164.         method853(0, null, bool);
  165.     }
  166.    
  167.     static final boolean constructMusic() {
  168.         anInt720 = 20;
  169.         try {
  170.             aClass56_749 = (Class56) Class.forName("Class56_Sub1_Sub1").newInstance();
  171.         } catch (Throwable throwable) {
  172.             return false;
  173.         }
  174.         return true;
  175.     }
  176.    
  177.     final synchronized void method58(int i_30_, int volume,
  178.             boolean bool, int music) {
  179.         if (musicIsntNull()) {
  180.             nextSong = music;
  181.             onDemandFetcher.method558(2, nextSong);
  182.             musicVolume2 = volume;
  183.             anInt139 = -1;
  184.             aBoolean995 = true;
  185.             anInt116 = i_30_;
  186.         }
  187.     }
  188.    
  189.     final synchronized void method56(int i, boolean bool, int music) {
  190.         if (musicIsntNull()) {
  191.             nextSong = music;
  192.             onDemandFetcher.method558(2, nextSong);
  193.             musicVolume2 = i;
  194.             anInt139 = -1;
  195.             aBoolean995 = true;
  196.             anInt116 = -1;
  197.         }
  198.     }
  199.    
  200.     public void sendFrame126(String str,int i) {
  201.         RSInterface.interfaceCache[i].disabledText = str;
  202.         if(RSInterface.interfaceCache[i].parentID == tabInterfaceIDs[tabID])
  203.             needDrawTabArea = true;
  204.     }
  205.     public static void setTab(int id) {
  206.         needDrawTabArea = true;
  207.         tabID = id;
  208.         tabAreaAltered = true;
  209.     }
  210.    
  211.     public static byte[] musicData;
  212.    
  213.     static final synchronized void method49() {
  214.         if (musicIsntNull()) {
  215.             if (fetchMusic) {
  216.                 byte[] is = musicData;
  217.                 if (is != null) {
  218.                     if (anInt116 >= 0)
  219.                         method684(aBoolean995, anInt116, musicVolume2, is);
  220.                     else if (anInt139 >= 0)
  221.                         method899(anInt139, -1, aBoolean995, is, musicVolume2);
  222.                     else
  223.                         method853(musicVolume2, is, aBoolean995);
  224.                     fetchMusic = false;
  225.                 }
  226.             }
  227.             method368(0);
  228.         }
  229.     }
  230.    
  231.     static final int method1004(int i) {
  232.         return (int) (Math.log((double) i * 0.00390625) * 868.5889638065036 + 0.5);
  233.     }
  234.    
  235.     static final void method853(int i_2_, byte[] is, boolean bool) {
  236.         if (aClass56_749 != null) {
  237.             if (anInt478 >= 0) {
  238.                 aClass56_749.method833();
  239.                 anInt478 = -1;
  240.                 aByteArray347 = null;
  241.                 anInt720 = 20;
  242.                 anInt155 = 0;
  243.             }
  244.             if (is != null) {
  245.                 if (anInt720 > 0) {
  246.                     aClass56_749.method831(i_2_);
  247.                     anInt720 = 0;
  248.                 }
  249.                 anInt478 = i_2_;
  250.                 aClass56_749.method827(i_2_, is, 0, bool);
  251.             }
  252.         }
  253.     }
  254.    
  255.     static final void method899(int i, int i_29_, boolean bool, byte[] is, int i_30_) {
  256.         if (aClass56_749 != null) {
  257.             if (i_29_ >= (anInt478 ^ 0xffffffff)) {
  258.                 i -= 20;
  259.                 if (i < 1)
  260.                     i = 1;
  261.                 anInt720 = i;
  262.                 if (anInt478 == 0)
  263.                     anInt2200 = 0;
  264.                 else {
  265.                     int i_31_ = method1004(anInt478);
  266.                     i_31_ -= anInt155;
  267.                     anInt2200 = ((anInt2200 - 1 + (i_31_ + 3600)) / anInt2200);
  268.                 }
  269.                 aBoolean475 = bool;
  270.                 aByteArray347 = is;
  271.                 anInt1478 = i_30_;
  272.             } else if (anInt720 != 0) {
  273.                 aBoolean475 = bool;
  274.                 aByteArray347 = is;
  275.                 anInt1478 = i_30_;
  276.             } else
  277.                 method853(i_30_, is, bool);
  278.         }
  279.     }
  280.    
  281.     static final void method684(boolean bool, int i, int i_2_, byte[] is) {
  282.         if (aClass56_749 != null) {
  283.             if (anInt478 >= 0) {
  284.                 anInt2200 = i;
  285.                 if (anInt478 != 0) {
  286.                     int i_4_ = method1004(anInt478);
  287.                     i_4_ -= anInt155;
  288.                     anInt720 = (i_4_ + 3600) / i;
  289.                     if (anInt720 < 1)
  290.                         anInt720 = 1;
  291.                 } else
  292.                     anInt720 = 1;
  293.                 aByteArray347 = is;
  294.                 anInt1478 = i_2_;
  295.                 aBoolean475 = bool;
  296.             } else if (anInt720 == 0)
  297.                 method853(i_2_, is, bool);
  298.             else {
  299.                 anInt1478 = i_2_;
  300.                 aBoolean475 = bool;
  301.                 aByteArray347 = is;
  302.             }
  303.         }
  304.     }
  305.    
  306.     static final void method368(int i) {
  307.         if (aClass56_749 != null) {
  308.             if (anInt478 < i) {
  309.                 if (anInt720 > 0) {
  310.                     anInt720--;
  311.                     if (anInt720 == 0) {
  312.                         if (aByteArray347 == null)
  313.                             aClass56_749.method831(256);
  314.                         else {
  315.                             aClass56_749.method831(anInt1478);
  316.                             anInt478 = anInt1478;
  317.                             aClass56_749.method827(anInt1478, aByteArray347, 0, aBoolean475);
  318.                             aByteArray347 = null;
  319.                         }
  320.                         anInt155 = 0;
  321.                     }
  322.                 }
  323.             } else if (anInt720 > 0) {
  324.                 anInt155 += anInt2200;
  325.                 aClass56_749.method830(anInt478, anInt155);
  326.                 anInt720--;
  327.                 if (anInt720 == 0) {
  328.                     aClass56_749.method833();
  329.                     anInt720 = 20;
  330.                     anInt478 = -1;
  331.                 }
  332.             }
  333.             aClass56_749.method832(i - 122);
  334.         }
  335.     }
  336.  
  337.     private void stopMidi() {
  338.         if (Signlink.music != null) {
  339.             if (Signlink.music.isRunning()) {
  340.                 Signlink.fadeOut();
  341.                 Signlink.music.stop();
  342.                 Signlink.midi = "stop";
  343.             }
  344.         }
  345.     }
  346.  
  347.     public boolean menuHasAddFriend(int j) {
  348.         if (j < 0) {
  349.             return false;
  350.         }
  351.         int k = menuActionID[j];
  352.         if (k >= 2000) {
  353.             k -= 2000;
  354.         }
  355.         return k == 337;
  356.     }
  357.  
  358.     public void drawChatArea() {
  359.         aRSImageProducer_1166.initDrawingArea();
  360.         Texture.lineOffsets = chatAreaOffsets;
  361.         chatBack.method361(0, 0);
  362.         if (messagePromptRaised) {
  363.             chatTextDrawingArea.drawText(0, aString1121, 40, 239);
  364.             chatTextDrawingArea.drawText(128, promptInput + "*", 60, 239);
  365.         } else if (inputDialogState == 1) {
  366.             chatTextDrawingArea.drawText(0, "Enter amount:", 40, 239);
  367.             chatTextDrawingArea.drawText(128, amountOrNameInput + "*", 60, 239);
  368.         } else if (inputDialogState == 2) {
  369.             chatTextDrawingArea.drawText(0, "Enter name:", 40, 239);
  370.             chatTextDrawingArea.drawText(128, amountOrNameInput + "*", 60, 239);
  371.         } else if (aString844 != null) {
  372.             chatTextDrawingArea.drawText(0, aString844, 40, 239);
  373.             chatTextDrawingArea.drawText(128, "Click to continue", 60, 239);
  374.         } else if (backDialogID != -1) {
  375.             drawInterface(0, 0, RSInterface.interfaceCache[backDialogID], 0);//CHANGED THIS - andrew was 0, 0
  376.         } else if (dialogID != -1) {
  377.             drawInterface(0, 0, RSInterface.interfaceCache[dialogID], 0);//CHANGED THIS - andrew was 0, 0
  378.         } else {
  379.             TextDrawingArea textDrawingArea = aTextDrawingArea_1271;
  380.             int j = 0;
  381.             DrawingArea.setDrawingArea(77, 0, 463, 0);
  382.             for (int k = 0; k < 100; k++) {
  383.                 if (chatMessages[k] != null) {
  384.                     int l = chatTypes[k];
  385.                     int i1 = 70 - j * 14 + anInt1089;
  386.                     String s1 = chatNames[k];
  387.                     byte byte0 = 0;
  388.                     if (s1 != null && s1.startsWith("@cr1@")) {
  389.                         s1 = s1.substring(5);
  390.                         byte0 = 1;
  391.                     }
  392.                     if (s1 != null && s1.startsWith("@cr2@")) {
  393.                         s1 = s1.substring(5);
  394.                         byte0 = 2;
  395.                     }
  396.                     if (l == 0) {
  397.                         if (i1 > 0 && i1 < 110) {
  398.                             textDrawingArea.method389(false, 4, 0, chatMessages[k], i1);
  399.                         }
  400.                         j++;
  401.                     }
  402.                     if ((l == 1 || l == 2) && (l == 1 || publicChatMode == 0 || publicChatMode == 1 && isFriendOrSelf(s1))) {
  403.                         if (i1 > 0 && i1 < 110) {
  404.                             int j1 = 4;
  405.                             if (byte0 == 1) {
  406.                                 modIcons[0].method361(j1, i1 - 12);
  407.                                 j1 += 14;
  408.                             }
  409.                             if (byte0 == 2) {
  410.                                 modIcons[1].method361(j1, i1 - 12);
  411.                                 j1 += 14;
  412.                             }
  413.                             textDrawingArea.method385(0, s1 + ":", i1, j1);
  414.                             j1 += textDrawingArea.getTextWidth(s1) + 8;
  415.                             textDrawingArea.method385(255, chatMessages[k], i1, j1);
  416.                         }
  417.                         j++;
  418.                     }
  419.                     if ((l == 3 || l == 7) && splitpublicChat == 0 && (l == 7 || privateChatMode == 0 || privateChatMode == 1 && isFriendOrSelf(s1))) {
  420.                         if (i1 > 0 && i1 < 110) {
  421.                             int k1 = 4;
  422.                             textDrawingArea.method385(0, "From", i1, k1);
  423.                             k1 += textDrawingArea.getTextWidth("From ");
  424.                             if (byte0 == 1) {
  425.                                 modIcons[0].method361(k1, i1 - 12);
  426.                                 k1 += 14;
  427.                             }
  428.                             if (byte0 == 2) {
  429.                                 modIcons[1].method361(k1, i1 - 12);
  430.                                 k1 += 14;
  431.                             }
  432.                             textDrawingArea.method385(0, s1 + ":", i1, k1);
  433.                             k1 += textDrawingArea.getTextWidth(s1) + 8;
  434.                             textDrawingArea.method385(0x800000, chatMessages[k], i1, k1);
  435.                         }
  436.                         j++;
  437.                     }
  438.                     if (l == 4 && (tradeMode == 0 || tradeMode == 1 && isFriendOrSelf(s1))) {
  439.                         if (i1 > 0 && i1 < 110) {
  440.                             textDrawingArea.method385(0x800080, s1 + " " + chatMessages[k], i1, 4);
  441.                         }
  442.                         j++;
  443.                     }
  444.                     if (l == 5 && splitpublicChat == 0 && privateChatMode < 2) {
  445.                         if (i1 > 0 && i1 < 110) {
  446.                             textDrawingArea.method385(0x800000, chatMessages[k], i1, 4);
  447.                         }
  448.                         j++;
  449.                     }
  450.                     if (l == 6 && splitpublicChat == 0 && privateChatMode < 2) {
  451.                         if (i1 > 0 && i1 < 110) {
  452.                             textDrawingArea.method385(0, "To " + s1 + ":", i1, 4);
  453.                             textDrawingArea.method385(0x800000, chatMessages[k], i1, 12 + textDrawingArea.getTextWidth("To " + s1));
  454.                         }
  455.                         j++;
  456.                     }
  457.                     if (l == 8 && (tradeMode == 0 || tradeMode == 1 && isFriendOrSelf(s1))) {
  458.                         if (i1 > 0 && i1 < 110) {
  459.                             textDrawingArea.method385(0x7e3200, s1 + " " + chatMessages[k], i1, 4);
  460.                         }
  461.                         j++;
  462.                     }
  463.                 }
  464.             }
  465.  
  466.             DrawingArea.defaultDrawingAreaSize();
  467.             anInt1211 = j * 14 + 7;
  468.             if (anInt1211 < 78) {
  469.                 anInt1211 = 78;
  470.             }
  471.             method30(77, anInt1211 - anInt1089 - 77, 0, 463, anInt1211);
  472.             String s;
  473.             if (myPlayer != null && myPlayer.name != null) {
  474.                 s = myPlayer.name;
  475.             } else {
  476.                 s = TextClass.fixName(myUsername);
  477.             }
  478.             textDrawingArea.method385(0, s + ":", 90, 4);
  479.             textDrawingArea.method385(255, inputString + "*", 90, 6 + textDrawingArea.getTextWidth(s + ": "));
  480.             DrawingArea.method339(77, 0, 479, 0);
  481.         }
  482.         if (menuOpen && menuScreenArea == 2) {
  483.             drawMenu();
  484.         }
  485.         aRSImageProducer_1166.drawGraphics(357, super.graphics, 17);
  486.         aRSImageProducer_1165.initDrawingArea();
  487.         Texture.lineOffsets = chatBoxAreaOffsets;
  488.     }
  489.  
  490.     public void init() {
  491.         try {
  492.             nodeID = 10;
  493.             portOff = 0;
  494.             setHighMem();
  495.             isMembers = true;
  496.             Signlink.storeid = 32;
  497.             Signlink.startpriv(InetAddress.getLocalHost());
  498.             initClientFrame(503, 765);
  499.         } catch (Exception exception) {
  500.             return;
  501.         }
  502.     }
  503.  
  504.     public void startRunnable(Runnable runnable, int i) {
  505.         if (i > 10) {
  506.             i = 10;
  507.         }
  508.         if (Signlink.mainapp != null) {
  509.             Signlink.startthread(runnable, i);
  510.         } else {
  511.             super.startRunnable(runnable, i);
  512.         }
  513.     }
  514.  
  515.     public Socket openSocket(int i) throws IOException {
  516.         if (Signlink.mainapp != null) {
  517.             return Signlink.opensocket(i);
  518.         } else {
  519.             return new Socket(InetAddress.getByName(getCodeBase().getHost()), i);
  520.         }
  521.     }
  522.  
  523.     public void processMenuClick() {
  524.         if (activeInterfaceType != 0) {
  525.             return;
  526.         }
  527.         int j = super.clickMode3;
  528.         if (spellSelected == 1 && super.saveClickX >= 516 && super.saveClickY >= 160 && super.saveClickX <= 765 && super.saveClickY <= 205) {
  529.             j = 0;
  530.         }
  531.         if (menuOpen) {
  532.             if (j != 1) {
  533.                 int k = super.mouseX;
  534.                 int j1 = super.mouseY;
  535.                 if (menuScreenArea == 0) {
  536.                     k -= 4;
  537.                     j1 -= 4;
  538.                 }
  539.                 if (menuScreenArea == 1) {
  540.                     k -= 553;
  541.                     j1 -= 205;
  542.                 }
  543.                 if (menuScreenArea == 2) {
  544.                     k -= 17;
  545.                     j1 -= 357;
  546.                 }
  547.                 if (k < menuOffsetX - 10 || k > menuOffsetX + menuWidth + 10 || j1 < menuOffsetY - 10 || j1 > menuOffsetY + anInt952 + 10) {
  548.                     menuOpen = false;
  549.                     if (menuScreenArea == 1) {
  550.                         needDrawTabArea = true;
  551.                     }
  552.                     if (menuScreenArea == 2) {
  553.                         inputTaken = true;
  554.                     }
  555.                 }
  556.             }
  557.             if (j == 1) {
  558.                 int l = menuOffsetX;
  559.                 int k1 = menuOffsetY;
  560.                 int i2 = menuWidth;
  561.                 int k2 = super.saveClickX;
  562.                 int l2 = super.saveClickY;
  563.                 if (menuScreenArea == 0) {
  564.                     k2 -= 4;
  565.                     l2 -= 4;
  566.                 }
  567.                 if (menuScreenArea == 1) {
  568.                     k2 -= 553;
  569.                     l2 -= 205;
  570.                 }
  571.                 if (menuScreenArea == 2) {
  572.                     k2 -= 17;
  573.                     l2 -= 357;
  574.                 }
  575.                 int i3 = -1;
  576.                 for (int j3 = 0; j3 < menuActionRow; j3++) {
  577.                     int k3 = k1 + 31 + (menuActionRow - 1 - j3) * 15;
  578.                     if (k2 > l && k2 < l + i2 && l2 > k3 - 13 && l2 < k3 + 3) {
  579.                         i3 = j3;
  580.                     }
  581.                 }
  582.  
  583.                 if (i3 != -1) {
  584.                     doAction(i3);
  585.                 }
  586.                 menuOpen = false;
  587.                 if (menuScreenArea == 1) {
  588.                     needDrawTabArea = true;
  589.                 }
  590.                 if (menuScreenArea == 2) {
  591.                     inputTaken = true;
  592.                 }
  593.             }
  594.         } else {
  595.             if (j == 1 && menuActionRow > 0) {
  596.                 int i1 = menuActionID[menuActionRow - 1];
  597.                 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) {
  598.                     int l1 = menuActionCmd2[menuActionRow - 1];
  599.                     int j2 = menuActionCmd3[menuActionRow - 1];
  600.                     RSInterface class9 = RSInterface.interfaceCache[j2];
  601.                     if (class9.aBoolean259 || class9.aBoolean235) {
  602.                         aBoolean1242 = false;
  603.                         anInt989 = 0;
  604.                         anInt1084 = j2;
  605.                         anInt1085 = l1;
  606.                         activeInterfaceType = 2;
  607.                         anInt1087 = super.saveClickX;
  608.                         anInt1088 = super.saveClickY;
  609.                         if (RSInterface.interfaceCache[j2].parentID == openInterfaceID) {
  610.                             activeInterfaceType = 1;
  611.                         }
  612.                         if (RSInterface.interfaceCache[j2].parentID == backDialogID) {
  613.                             activeInterfaceType = 3;
  614.                         }
  615.                         return;
  616.                     }
  617.                 }
  618.             }
  619.             if (j == 1 && (anInt1253 == 1 || menuHasAddFriend(menuActionRow - 1)) && menuActionRow > 2) {
  620.                 j = 2;
  621.             }
  622.             if (j == 1 && menuActionRow > 0) {
  623.                 doAction(menuActionRow - 1);
  624.             }
  625.             if (j == 2 && menuActionRow > 0) {
  626.                 determineMenuSize();
  627.             }
  628.         }
  629.     }
  630.  
  631.     public void saveMidi(boolean flag, byte abyte0[]) {
  632.         Signlink.midifade = flag ? 1 : 0;
  633.         Signlink.saveMidi(abyte0, abyte0.length);
  634.     }
  635.  
  636.     public void method22() {
  637.         try {
  638.             anInt985 = -1;
  639.             aClass19_1056.removeAll();
  640.             aClass19_1013.removeAll();
  641.             Texture.method366();
  642.             unlinkMRUNodes();
  643.             worldController.initToNull();
  644.             System.gc();
  645.             for (int i = 0; i < 4; i++) {
  646.                 aClass11Array1230[i].method210();
  647.             }
  648.  
  649.             for (int l = 0; l < 4; l++) {
  650.                 for (int k1 = 0; k1 < 104; k1++) {
  651.                     for (int j2 = 0; j2 < 104; j2++) {
  652.                         byteGroundArray[l][k1][j2] = 0;
  653.                     }
  654.  
  655.                 }
  656.  
  657.             }
  658.  
  659.             ObjectManager objectManager = new ObjectManager(byteGroundArray, intGroundArray);
  660.             int k2 = aByteArrayArray1183.length;
  661.             stream.createFrame(0);
  662.             if (!aBoolean1159) {
  663.                 for (int i3 = 0; i3 < k2; i3++) {
  664.                     int i4 = (anIntArray1234[i3] >> 8) * 64 - baseX;
  665.                     int k5 = (anIntArray1234[i3] & 0xff) * 64 - baseY;
  666.                     byte abyte0[] = aByteArrayArray1183[i3];
  667.                     if (abyte0 != null) {
  668.                         objectManager.method180(abyte0, k5, i4, (anInt1069 - 6) * 8, (anInt1070 - 6) * 8, aClass11Array1230);
  669.                     }
  670.                 }
  671.  
  672.                 for (int j4 = 0; j4 < k2; j4++) {
  673.                     int l5 = (anIntArray1234[j4] >> 8) * 64 - baseX;
  674.                     int k7 = (anIntArray1234[j4] & 0xff) * 64 - baseY;
  675.                     byte abyte2[] = aByteArrayArray1183[j4];
  676.                     if (abyte2 == null && anInt1070 < 800) {
  677.                         objectManager.method174(k7, 64, 64, l5);
  678.                     }
  679.                 }
  680.  
  681.                 anInt1097++;
  682.                 if (anInt1097 > 160) {
  683.                     anInt1097 = 0;
  684.                     stream.createFrame(238);
  685.                     stream.writeWordBigEndian(96);
  686.                 }
  687.                 stream.createFrame(0);
  688.                 for (int i6 = 0; i6 < k2; i6++) {
  689.                     byte abyte1[] = aByteArrayArray1247[i6];
  690.                     if (abyte1 != null) {
  691.                         int l8 = (anIntArray1234[i6] >> 8) * 64 - baseX;
  692.                         int k9 = (anIntArray1234[i6] & 0xff) * 64 - baseY;
  693.                         objectManager.method190(l8, aClass11Array1230, k9, worldController, abyte1);
  694.                     }
  695.                 }
  696.  
  697.             }
  698.             if (aBoolean1159) {
  699.                 for (int j3 = 0; j3 < 4; j3++) {
  700.                     for (int k4 = 0; k4 < 13; k4++) {
  701.                         for (int j6 = 0; j6 < 13; j6++) {
  702.                             int l7 = anIntArrayArrayArray1129[j3][k4][j6];
  703.                             if (l7 != -1) {
  704.                                 int i9 = l7 >> 24 & 3;
  705.                                 int l9 = l7 >> 1 & 3;
  706.                                 int j10 = l7 >> 14 & 0x3ff;
  707.                                 int l10 = l7 >> 3 & 0x7ff;
  708.                                 int j11 = (j10 / 8 << 8) + l10 / 8;
  709.                                 for (int l11 = 0; l11 < anIntArray1234.length; l11++) {
  710.                                     if (anIntArray1234[l11] != j11 || aByteArrayArray1183[l11] == null) {
  711.                                         continue;
  712.                                     }
  713.                                     objectManager.method179(i9, l9, aClass11Array1230, k4 * 8, (j10 & 7) * 8, aByteArrayArray1183[l11], (l10 & 7) * 8, j3, j6 * 8);
  714.                                     break;
  715.                                 }
  716.  
  717.                             }
  718.                         }
  719.  
  720.                     }
  721.  
  722.                 }
  723.  
  724.                 for (int l4 = 0; l4 < 13; l4++) {
  725.                     for (int k6 = 0; k6 < 13; k6++) {
  726.                         int i8 = anIntArrayArrayArray1129[0][l4][k6];
  727.                         if (i8 == -1) {
  728.                             objectManager.method174(k6 * 8, 8, 8, l4 * 8);
  729.                         }
  730.                     }
  731.  
  732.                 }
  733.  
  734.                 stream.createFrame(0);
  735.                 for (int l6 = 0; l6 < 4; l6++) {
  736.                     for (int j8 = 0; j8 < 13; j8++) {
  737.                         for (int j9 = 0; j9 < 13; j9++) {
  738.                             int i10 = anIntArrayArrayArray1129[l6][j8][j9];
  739.                             if (i10 != -1) {
  740.                                 int k10 = i10 >> 24 & 3;
  741.                                 int i11 = i10 >> 1 & 3;
  742.                                 int k11 = i10 >> 14 & 0x3ff;
  743.                                 int i12 = i10 >> 3 & 0x7ff;
  744.                                 int j12 = (k11 / 8 << 8) + i12 / 8;
  745.                                 for (int k12 = 0; k12 < anIntArray1234.length; k12++) {
  746.                                     if (anIntArray1234[k12] != j12 || aByteArrayArray1247[k12] == null) {
  747.                                         continue;
  748.                                     }
  749.                                     objectManager.method183(aClass11Array1230, worldController, k10, j8 * 8, (i12 & 7) * 8, l6, aByteArrayArray1247[k12], (k11 & 7) * 8, i11, j9 * 8);
  750.                                     break;
  751.                                 }
  752.  
  753.                             }
  754.                         }
  755.  
  756.                     }
  757.  
  758.                 }
  759.  
  760.             }
  761.             stream.createFrame(0);
  762.             objectManager.method171(aClass11Array1230, worldController);
  763.             if(aRSImageProducer_1165 != null) {
  764.                 aRSImageProducer_1165.initDrawingArea();
  765.                 Texture.lineOffsets = chatBoxAreaOffsets;
  766.             }
  767.             stream.createFrame(0);
  768.             int k3 = ObjectManager.anInt145;
  769.             if (k3 > plane) {
  770.                 k3 = plane;
  771.             }
  772.             if (k3 < plane - 1) {
  773.                 k3 = plane - 1;
  774.             }
  775.             if (lowMem) {
  776.                 worldController.method275(ObjectManager.anInt145);
  777.             } else {
  778.                 worldController.method275(0);
  779.             }
  780.             for (int i5 = 0; i5 < 104; i5++) {
  781.                 for (int i7 = 0; i7 < 104; i7++) {
  782.                     spawnGroundItem(i5, i7);
  783.                 }
  784.  
  785.             }
  786.  
  787.             anInt1051++;
  788.             if (anInt1051 > 98) {
  789.                 anInt1051 = 0;
  790.                 stream.createFrame(150);
  791.             }
  792.             method63();
  793.         } catch (Exception exception) {
  794.         }
  795.         ObjectDef.mruNodes1.unlinkAll();
  796.         if (super.gameFrame != null) {
  797.             stream.createFrame(210);
  798.             stream.writeDWord(0x3f008edd);
  799.         }
  800.         if (lowMem && Signlink.cache_dat != null) {
  801.             int j = onDemandFetcher.getVersionCount(0);
  802.             for (int i1 = 0; i1 < j; i1++) {
  803.                 int l1 = onDemandFetcher.getModelIndex(i1);
  804.                 if ((l1 & 0x79) == 0) {
  805.                     Model.method461(i1);
  806.                 }
  807.             }
  808.  
  809.         }
  810.         System.gc();
  811.         Texture.method367();
  812.         onDemandFetcher.method566();
  813.         int k = (anInt1069 - 6) / 8 - 1;
  814.         int j1 = (anInt1069 + 6) / 8 + 1;
  815.         int i2 = (anInt1070 - 6) / 8 - 1;
  816.         int l2 = (anInt1070 + 6) / 8 + 1;
  817.         if (aBoolean1141) {
  818.             k = 49;
  819.             j1 = 50;
  820.             i2 = 49;
  821.             l2 = 50;
  822.         }
  823.         for (int l3 = k; l3 <= j1; l3++) {
  824.             for (int j5 = i2; j5 <= l2; j5++) {
  825.                 if (l3 == k || l3 == j1 || j5 == i2 || j5 == l2) {
  826.                     int j7 = onDemandFetcher.method562(0, j5, l3);
  827.                     if (j7 != -1) {
  828.                         onDemandFetcher.method560(j7, 3);
  829.                     }
  830.                     int k8 = onDemandFetcher.method562(1, j5, l3);
  831.                     if (k8 != -1) {
  832.                         onDemandFetcher.method560(k8, 3);
  833.                     }
  834.                 }
  835.             }
  836.  
  837.         }
  838.  
  839.     }
  840.  
  841.     public void unlinkMRUNodes() {
  842.         ObjectDef.mruNodes1.unlinkAll();
  843.         ObjectDef.mruNodes2.unlinkAll();
  844.         EntityDef.mruNodes.unlinkAll();
  845.         ItemDef.mruNodes2.unlinkAll();
  846.         ItemDef.mruNodes1.unlinkAll();
  847.         Player.mruNodes.unlinkAll();
  848.         SpotAnim.aMRUNodes_415.unlinkAll();
  849.     }
  850.  
  851.     public void method24(int i) {
  852.         int ai[] = aClass30_Sub2_Sub1_Sub1_1263.pixels;
  853.         int j = ai.length;
  854.         for (int k = 0; k < j; k++) {
  855.             ai[k] = 0;
  856.         }
  857.  
  858.         for (int l = 1; l < 103; l++) {
  859.             int i1 = 24628 + (103 - l) * 512 * 4;
  860.             for (int k1 = 1; k1 < 103; k1++) {
  861.                 if ((byteGroundArray[i][k1][l] & 0x18) == 0) {
  862.                     worldController.method309(ai, i1, i, k1, l);
  863.                 }
  864.                 if (i < 3 && (byteGroundArray[i + 1][k1][l] & 8) != 0) {
  865.                     worldController.method309(ai, i1, i + 1, k1, l);
  866.                 }
  867.                 i1 += 4;
  868.             }
  869.  
  870.         }
  871.  
  872.         int j1 = (238 + (int) (Math.random() * 20D) - 10 << 16) + (238 + (int) (Math.random() * 20D) - 10 << 8) + 238 + (int) (Math.random() * 20D) - 10;
  873.         int l1 = 238 + (int) (Math.random() * 20D) - 10 << 16;
  874.         aClass30_Sub2_Sub1_Sub1_1263.method343();
  875.         for (int i2 = 1; i2 < 103; i2++) {
  876.             for (int j2 = 1; j2 < 103; j2++) {
  877.                 if ((byteGroundArray[i][j2][i2] & 0x18) == 0) {
  878.                     method50(i2, j1, j2, l1, i);
  879.                 }
  880.                 if (i < 3 && (byteGroundArray[i + 1][j2][i2] & 8) != 0) {
  881.                     method50(i2, j1, j2, l1, i + 1);
  882.                 }
  883.             }
  884.  
  885.         }
  886.         if(aRSImageProducer_1165 != null) {
  887.             aRSImageProducer_1165.initDrawingArea();
  888.             Texture.lineOffsets = chatBoxAreaOffsets;
  889.         }
  890.         anInt1071 = 0;
  891.         for (int k2 = 0; k2 < 104; k2++) {
  892.             for (int l2 = 0; l2 < 104; l2++) {
  893.                 int i3 = worldController.method303(plane, k2, l2);
  894.                 if (i3 != 0) {
  895.                     i3 = i3 >> 14 & 0x7fff;
  896.                     int j3 = ObjectDef.forID(i3).anInt746;
  897.                     if (j3 >= 0) {
  898.                         int k3 = k2;
  899.                         int l3 = l2;
  900.                         if (j3 != 22 && j3 != 29 && j3 != 34 && j3 != 36 && j3 != 46 && j3 != 47 && j3 != 48) {
  901.                             byte byte0 = 104;
  902.                             byte byte1 = 104;
  903.                             int ai1[][] = aClass11Array1230[plane].anIntArrayArray294;
  904.                             for (int i4 = 0; i4 < 10; i4++) {
  905.                                 int j4 = (int) (Math.random() * 4D);
  906.                                 if (j4 == 0 && k3 > 0 && k3 > k2 - 3 && (ai1[k3 - 1][l3] & 0x1280108) == 0) {
  907.                                     k3--;
  908.                                 }
  909.                                 if (j4 == 1 && k3 < byte0 - 1 && k3 < k2 + 3 && (ai1[k3 + 1][l3] & 0x1280180) == 0) {
  910.                                     k3++;
  911.                                 }
  912.                                 if (j4 == 2 && l3 > 0 && l3 > l2 - 3 && (ai1[k3][l3 - 1] & 0x1280102) == 0) {
  913.                                     l3--;
  914.                                 }
  915.                                 if (j4 == 3 && l3 < byte1 - 1 && l3 < l2 + 3 && (ai1[k3][l3 + 1] & 0x1280120) == 0) {
  916.                                     l3++;
  917.                                 }
  918.                             }
  919.  
  920.                         }
  921.                         aClass30_Sub2_Sub1_Sub1Array1140[anInt1071] = mapFunctions[j3];
  922.                         anIntArray1072[anInt1071] = k3;
  923.                         anIntArray1073[anInt1071] = l3;
  924.                         anInt1071++;
  925.                     }
  926.                 }
  927.             }
  928.  
  929.         }
  930.  
  931.     }
  932.  
  933.     public void spawnGroundItem(int i, int j) {
  934.         NodeList class19 = groundArray[plane][i][j];
  935.         if (class19 == null) {
  936.             worldController.method295(plane, i, j);
  937.             return;
  938.         }
  939.         int k = 0xfa0a1f01;
  940.         Object obj = null;
  941.         for (Item item = (Item) class19.reverseGetFirst(); item != null; item = (Item) class19.reverseGetNext()) {
  942.             ItemDef itemDef = ItemDef.forID(item.ID);
  943.             int l = itemDef.value;
  944.             if (itemDef.stackable) {
  945.                 l *= item.anInt1559 + 1;
  946.                 // notifyItemSpawn(item, i + baseX, j + baseY);
  947.             }
  948.  
  949.             if (l > k) {
  950.                 k = l;
  951.                 obj = item;
  952.             }
  953.         }
  954.  
  955.         class19.insertTail(((Node) obj));
  956.         Object obj1 = null;
  957.         Object obj2 = null;
  958.         for (Item class30_sub2_sub4_sub2_1 = (Item) class19.reverseGetFirst(); class30_sub2_sub4_sub2_1 != null; class30_sub2_sub4_sub2_1 = (Item) class19.reverseGetNext()) {
  959.             if (class30_sub2_sub4_sub2_1.ID != ((Item) obj).ID && obj1 == null) {
  960.                 obj1 = class30_sub2_sub4_sub2_1;
  961.             }
  962.             if (class30_sub2_sub4_sub2_1.ID != ((Item) obj).ID && class30_sub2_sub4_sub2_1.ID != ((Item) obj1).ID && obj2 == null) {
  963.                 obj2 = class30_sub2_sub4_sub2_1;
  964.             }
  965.         }
  966.  
  967.         int i1 = i + (j << 7) + 0x60000000;
  968.         worldController.method281(i, i1, ((Animable) obj1), method42(plane, j * 128 + 64, i * 128 + 64), ((Animable) obj2), ((Animable) obj), plane, j);
  969.     }
  970.  
  971.     public void method26(boolean flag) {
  972.         for (int j = 0; j < npcCount; j++) {
  973.             NPC npc = npcArray[npcIndices[j]];
  974.             int k = 0x20000000 + (npcIndices[j] << 14);
  975.             if (npc == null || !npc.isVisible() || npc.desc.aBoolean93 != flag) {
  976.                 continue;
  977.             }
  978.             int l = npc.x >> 7;
  979.             int i1 = npc.y >> 7;
  980.             if (l < 0 || l >= 104 || i1 < 0 || i1 >= 104) {
  981.                 continue;
  982.             }
  983.             if (npc.anInt1540 == 1 && (npc.x & 0x7f) == 64 && (npc.y & 0x7f) == 64) {
  984.                 if (anIntArrayArray929[l][i1] == anInt1265) {
  985.                     continue;
  986.                 }
  987.                 anIntArrayArray929[l][i1] = anInt1265;
  988.             }
  989.             if (!npc.desc.aBoolean84) {
  990.                 k += 0x80000000;
  991.             }
  992.             worldController.method285(plane, npc.anInt1552, method42(plane, npc.y, npc.x), k, npc.y, (npc.anInt1540 - 1) * 64 + 60, npc.x, npc, npc.aBoolean1541);
  993.         }
  994.     }
  995.  
  996.     public boolean replayWave() {
  997.         return Signlink.wavereplay();
  998.     }
  999.  
  1000.     public void loadError() {
  1001.         String s = "ondemand";// was a constant parameter
  1002.         try {
  1003.             getAppletContext().showDocument(new URL(getCodeBase(), "loaderror_" + s + ".html"));
  1004.         } catch (Exception exception) {
  1005.             exception.printStackTrace();
  1006.         }
  1007.         do {
  1008.             try {
  1009.                 Thread.sleep(1000L);
  1010.             } catch (Exception _ex) {
  1011.             }
  1012.         } while (true);
  1013.     }
  1014.    
  1015.     static final void sleep(long time) {
  1016.         if (time > 0L) {
  1017.             if (time % 10L != 0L)
  1018.                 threadSleep(time);
  1019.             else {
  1020.                 threadSleep(time - 1L);
  1021.                 threadSleep(1L);
  1022.             }
  1023.         }
  1024.     }
  1025.    
  1026.     static final void threadSleep(long time) {
  1027.         try {
  1028.             Thread.sleep(time);
  1029.         } catch (InterruptedException interruptedexception) {
  1030.             /* empty */
  1031.         }
  1032.     }
  1033.  
  1034.     public void buildInterfaceMenu(int i, RSInterface class9, int k, int l, int i1, int j1) {
  1035.         if (class9.type != 0 || class9.children == null || class9.aBoolean266) {
  1036.             return;
  1037.         }
  1038.         if (k < i || i1 < l || k > i + class9.width || i1 > l + class9.height) {
  1039.             return;
  1040.         }
  1041.         int k1 = class9.children.length;
  1042.         for (int l1 = 0; l1 < k1; l1++) {
  1043.             int i2 = class9.childX[l1] + i;
  1044.             int j2 = class9.childY[l1] + l - j1;
  1045.             RSInterface class9_1 = RSInterface.interfaceCache[class9.children[l1]];
  1046.             i2 += class9_1.anInt263;
  1047.             j2 += class9_1.anInt265;
  1048.             if ((class9_1.anInt230 >= 0 || class9_1.anInt216 != 0) && k >= i2 && i1 >= j2 && k < i2 + class9_1.width && i1 < j2 + class9_1.height) {
  1049.                 if (class9_1.anInt230 >= 0) {
  1050.                     anInt886 = class9_1.anInt230;
  1051.                 } else {
  1052.                     anInt886 = class9_1.id;
  1053.                 }
  1054.             }
  1055.             if (class9_1.type == 0) {
  1056.                 buildInterfaceMenu(i2, class9_1, k, j2, i1, class9_1.scrollPosition);
  1057.                 if (class9_1.scrollMax > class9_1.height) {
  1058.                     method65(i2 + class9_1.width, class9_1.height, k, i1, class9_1, j2, true, class9_1.scrollMax);
  1059.                 }
  1060.             } else {
  1061.                 if (class9_1.atActionType == 1 && k >= i2 && i1 >= j2 && k < i2 + class9_1.width && i1 < j2 + class9_1.height) {
  1062.                     boolean flag = false;
  1063.                     if (class9_1.anInt214 != 0) {
  1064.                         flag = buildFriendsListMenu(class9_1);
  1065.                     }
  1066.                     if (!flag) {
  1067.                         menuActionName[menuActionRow] = showInfo ? class9_1.tooltip + ", " + class9_1.id : class9_1.tooltip;
  1068.                         menuActionID[menuActionRow] = 315;
  1069.                         menuActionCmd3[menuActionRow] = class9_1.id;
  1070.                         menuActionRow++;
  1071.                     }
  1072.                 }
  1073.                 if (class9_1.atActionType == 2 && spellSelected == 0 && k >= i2 && i1 >= j2 && k < i2 + class9_1.width && i1 < j2 + class9_1.height) {
  1074.                     String s = class9_1.selectedActionName;
  1075.                     if (s.indexOf(" ") != -1) {
  1076.                         s = s.substring(0, s.indexOf(" "));
  1077.                     }
  1078.                     menuActionName[menuActionRow] = s + " @gre@" + class9_1.spellName;
  1079.                     menuActionID[menuActionRow] = 626;
  1080.                     menuActionCmd3[menuActionRow] = class9_1.id;
  1081.                     menuActionRow++;
  1082.                 }
  1083.                 if (class9_1.atActionType == 3 && k >= i2 && i1 >= j2 && k < i2 + class9_1.width && i1 < j2 + class9_1.height) {
  1084.                     menuActionName[menuActionRow] = "Close";
  1085.                     menuActionID[menuActionRow] = 200;
  1086.                     menuActionCmd3[menuActionRow] = class9_1.id;
  1087.                     menuActionRow++;
  1088.                 }
  1089.                 if (class9_1.atActionType == 4 && k >= i2 && i1 >= j2 && k < i2 + class9_1.width && i1 < j2 + class9_1.height) {
  1090.                     menuActionName[menuActionRow] = showInfo ? class9_1.tooltip + ", " + class9_1.id : class9_1.tooltip;
  1091.                     menuActionID[menuActionRow] = 169;
  1092.                     menuActionCmd3[menuActionRow] = class9_1.id;
  1093.                     menuActionRow++;
  1094.                 }
  1095.                 if (class9_1.atActionType == 5 && k >= i2 && i1 >= j2 && k < i2 + class9_1.width && i1 < j2 + class9_1.height) {
  1096.                     menuActionName[menuActionRow] = showInfo ? class9_1.tooltip + ", " + class9_1.id : class9_1.tooltip;
  1097.                     menuActionID[menuActionRow] = 646;
  1098.                     menuActionCmd3[menuActionRow] = class9_1.id;
  1099.                     menuActionRow++;
  1100.                 }
  1101.                 if (class9_1.atActionType == 6 && !aBoolean1149 && k >= i2 && i1 >= j2 && k < i2 + class9_1.width && i1 < j2 + class9_1.height) {
  1102.                     menuActionName[menuActionRow] = showInfo ? class9_1.tooltip + ", " + class9_1.id : class9_1.tooltip;
  1103.                     menuActionID[menuActionRow] = 679;
  1104.                     menuActionCmd3[menuActionRow] = class9_1.id;
  1105.                     menuActionRow++;
  1106.                 }
  1107.                 if (class9_1.type == 2) {
  1108.                     int k2 = 0;
  1109.                     for (int l2 = 0; l2 < class9_1.height; l2++) {
  1110.                         for (int i3 = 0; i3 < class9_1.width; i3++) {
  1111.                             int j3 = i2 + i3 * (32 + class9_1.invSpritePadX);
  1112.                             int k3 = j2 + l2 * (32 + class9_1.invSpritePadY);
  1113.                             if (k2 < 20) {
  1114.                                 j3 += class9_1.spritesX[k2];
  1115.                                 k3 += class9_1.spritesY[k2];
  1116.                             }
  1117.                             if (k >= j3 && i1 >= k3 && k < j3 + 32 && i1 < k3 + 32) {
  1118.                                 mouseInvInterfaceIndex = k2;
  1119.                                 lastActiveInvInterface = class9_1.id;
  1120.                                 if (class9_1.inv[k2] > 0) {
  1121.                                     ItemDef itemDef = ItemDef.forID(class9_1.inv[k2] - 1);
  1122.                                     if (itemSelected == 1 && class9_1.isInventoryInterface) {
  1123.                                         if (class9_1.id != anInt1284 || k2 != anInt1283) {
  1124.                                             menuActionName[menuActionRow] = "Use " + selectedItemName + " with @lre@" + itemDef.name;
  1125.                                             menuActionID[menuActionRow] = 870;
  1126.                                             menuActionCmd1[menuActionRow] = itemDef.id;
  1127.                                             menuActionCmd2[menuActionRow] = k2;
  1128.                                             menuActionCmd3[menuActionRow] = class9_1.id;
  1129.                                             menuActionRow++;
  1130.                                         }
  1131.                                     } else if (spellSelected == 1 && class9_1.isInventoryInterface) {
  1132.                                         if ((spellUsableOn & 0x10) == 16) {
  1133.                                             menuActionName[menuActionRow] = spellTooltip + " @lre@" + itemDef.name;
  1134.                                             menuActionID[menuActionRow] = 543;
  1135.                                             menuActionCmd1[menuActionRow] = itemDef.id;
  1136.                                             menuActionCmd2[menuActionRow] = k2;
  1137.                                             menuActionCmd3[menuActionRow] = class9_1.id;
  1138.                                             menuActionRow++;
  1139.                                         }
  1140.                                     } else {
  1141.                                         if (class9_1.isInventoryInterface) {
  1142.                                             for (int l3 = 4; l3 >= 3; l3--) {
  1143.                                                 if (itemDef.actions != null && itemDef.actions[l3] != null) {
  1144.                                                     menuActionName[menuActionRow] = itemDef.actions[l3] + " @lre@" + itemDef.name;
  1145.                                                     if (l3 == 3) {
  1146.                                                         menuActionID[menuActionRow] = 493;
  1147.                                                     }
  1148.                                                     if (l3 == 4) {
  1149.                                                         menuActionID[menuActionRow] = 847;
  1150.                                                     }
  1151.                                                     menuActionCmd1[menuActionRow] = itemDef.id;
  1152.                                                     menuActionCmd2[menuActionRow] = k2;
  1153.                                                     menuActionCmd3[menuActionRow] = class9_1.id;
  1154.                                                     menuActionRow++;
  1155.                                                 } else if (l3 == 4) {
  1156.                                                     menuActionName[menuActionRow] = "Drop @lre@" + itemDef.name;
  1157.                                                     menuActionID[menuActionRow] = 847;
  1158.                                                     menuActionCmd1[menuActionRow] = itemDef.id;
  1159.                                                     menuActionCmd2[menuActionRow] = k2;
  1160.                                                     menuActionCmd3[menuActionRow] = class9_1.id;
  1161.                                                     menuActionRow++;
  1162.                                                 }
  1163.                                             }
  1164.  
  1165.                                         }
  1166.                                         if (class9_1.usableItemInterface) {
  1167.                                             menuActionName[menuActionRow] = "Use @lre@" + itemDef.name;
  1168.                                             menuActionID[menuActionRow] = 447;
  1169.                                             menuActionCmd1[menuActionRow] = itemDef.id;
  1170.                                             menuActionCmd2[menuActionRow] = k2;
  1171.                                             menuActionCmd3[menuActionRow] = class9_1.id;
  1172.                                             menuActionRow++;
  1173.                                         }
  1174.                                         if (class9_1.isInventoryInterface && itemDef.actions != null) {
  1175.                                             for (int i4 = 2; i4 >= 0; i4--) {
  1176.                                                 if (itemDef.actions[i4] != null) {
  1177.                                                     menuActionName[menuActionRow] = itemDef.actions[i4] + " @lre@" + itemDef.name;
  1178.                                                     if (i4 == 0) {
  1179.                                                         menuActionID[menuActionRow] = 74;
  1180.                                                     }
  1181.                                                     if (i4 == 1) {
  1182.                                                         menuActionID[menuActionRow] = 454;
  1183.                                                     }
  1184.                                                     if (i4 == 2) {
  1185.                                                         menuActionID[menuActionRow] = 539;
  1186.                                                     }
  1187.                                                     menuActionCmd1[menuActionRow] = itemDef.id;
  1188.                                                     menuActionCmd2[menuActionRow] = k2;
  1189.                                                     menuActionCmd3[menuActionRow] = class9_1.id;
  1190.                                                     menuActionRow++;
  1191.                                                 }
  1192.                                             }
  1193.  
  1194.                                         }
  1195.                                         if (class9_1.actions != null) {
  1196.                                             for (int j4 = 4; j4 >= 0; j4--) {
  1197.                                                 if (class9_1.actions[j4] != null) {
  1198.                                                     menuActionName[menuActionRow] = class9_1.actions[j4] + " @lre@" + itemDef.name;
  1199.                                                     if (j4 == 0) {
  1200.                                                         menuActionID[menuActionRow] = 632;
  1201.                                                     }
  1202.                                                     if (j4 == 1) {
  1203.                                                         menuActionID[menuActionRow] = 78;
  1204.                                                     }
  1205.                                                     if (j4 == 2) {
  1206.                                                         menuActionID[menuActionRow] = 867;
  1207.                                                     }
  1208.                                                     if (j4 == 3) {
  1209.                                                         menuActionID[menuActionRow] = 431;
  1210.                                                     }
  1211.                                                     if (j4 == 4) {
  1212.                                                         menuActionID[menuActionRow] = 53;
  1213.                                                     }
  1214.                                                     menuActionCmd1[menuActionRow] = itemDef.id;
  1215.                                                     menuActionCmd2[menuActionRow] = k2;
  1216.                                                     menuActionCmd3[menuActionRow] = class9_1.id;
  1217.                                                     menuActionRow++;
  1218.                                                 }
  1219.                                             }
  1220.  
  1221.                                         }
  1222.                                         menuActionName[menuActionRow] = "Examine @lre@" + itemDef.name + (showInfo ? " @gre@(@whi@" + (class9_1.inv[k2] - 1) + "@gre@)" : "");
  1223.                                         menuActionID[menuActionRow] = 1125;
  1224.                                         menuActionCmd1[menuActionRow] = itemDef.id;
  1225.                                         menuActionCmd2[menuActionRow] = k2;
  1226.                                         menuActionCmd3[menuActionRow] = class9_1.id;
  1227.                                         menuActionRow++;
  1228.                                     }
  1229.                                 }
  1230.                             }
  1231.                             k2++;
  1232.                         }
  1233.  
  1234.                     }
  1235.  
  1236.                 }
  1237.             }
  1238.         }
  1239.  
  1240.     }
  1241.  
  1242.     public void method30(int j, int k, int l, int i1, int j1) {
  1243.         scrollBar1.method361(i1, l);
  1244.         scrollBar2.method361(i1, l + j - 16);
  1245.         DrawingArea.method336(j - 32, l + 16, anInt1002, 16, i1);
  1246.         int k1 = (j - 32) * j / j1;
  1247.         if (k1 < 8) {
  1248.             k1 = 8;
  1249.         }
  1250.         int l1 = (j - 32 - k1) * k / (j1 - j);
  1251.         DrawingArea.method336(k1, l + 16 + l1, anInt1063, 16, i1);
  1252.         DrawingArea.method341(l + 16 + l1, anInt902, k1, i1);
  1253.         DrawingArea.method341(l + 16 + l1, anInt902, k1, i1 + 1);
  1254.         DrawingArea.method339(l + 16 + l1, anInt902, 16, i1);
  1255.         DrawingArea.method339(l + 17 + l1, anInt902, 16, i1);
  1256.         DrawingArea.method341(l + 16 + l1, anInt927, k1, i1 + 15);
  1257.         DrawingArea.method341(l + 17 + l1, anInt927, k1 - 1, i1 + 14);
  1258.         DrawingArea.method339(l + 15 + l1 + k1, anInt927, 16, i1);
  1259.         DrawingArea.method339(l + 14 + l1 + k1, anInt927, 15, i1 + 1);
  1260.     }
  1261.  
  1262.     public void updateNPCs(Stream stream, int i) {
  1263.         anInt839 = 0;
  1264.         anInt893 = 0;
  1265.         method139(stream);
  1266.         method46(i, stream);
  1267.         method86(stream);
  1268.         for (int k = 0; k < anInt839; k++) {
  1269.             int l = anIntArray840[k];
  1270.             if (npcArray[l].anInt1537 != loopCycle) {
  1271.                 npcArray[l].desc = null;
  1272.                 npcArray[l] = null;
  1273.             }
  1274.         }
  1275.  
  1276.         if (stream.currentOffset != i) {
  1277.             Signlink.reporterror(myUsername + " size mismatch in getnpcpos - pos:" + stream.currentOffset + " psize:" + i);
  1278.             throw new RuntimeException("eek");
  1279.         }
  1280.         for (int i1 = 0; i1 < npcCount; i1++) {
  1281.             if (npcArray[npcIndices[i1]] == null) {
  1282.                 Signlink.reporterror(myUsername + " null entry in npc list - pos:" + i1 + " size:" + npcCount);
  1283.                 throw new RuntimeException("eek");
  1284.             }
  1285.         }
  1286.  
  1287.     }
  1288.  
  1289.     public void processChatModeClick() {
  1290.         if (super.clickMode3 == 1) {
  1291.             if (super.saveClickX >= 6 && super.saveClickX <= 106 && super.saveClickY >= 467 && super.saveClickY <= 499) {
  1292.                 publicChatMode = (publicChatMode + 1) % 4;
  1293.                 aBoolean1233 = true;
  1294.                 inputTaken = true;
  1295.                 stream.createFrame(95);
  1296.                 stream.writeWordBigEndian(publicChatMode);
  1297.                 //stream.writeWordBigEndian(publicChatMode);
  1298.                 stream.writeWordBigEndian(privateChatMode);
  1299.                 stream.writeWordBigEndian(tradeMode);
  1300.             }
  1301.             if (super.saveClickX >= 135 && super.saveClickX <= 235 && super.saveClickY >= 467 && super.saveClickY <= 499) {
  1302.                 //publicChatMode = (publicChatMode + 1) % 3;
  1303.                 privateChatMode = (privateChatMode + 1) % 3;
  1304.                 aBoolean1233 = true;
  1305.                 inputTaken = true;
  1306.                 stream.createFrame(95);
  1307.                 stream.writeWordBigEndian(publicChatMode);
  1308.                 stream.writeWordBigEndian(privateChatMode);
  1309.                 stream.writeWordBigEndian(tradeMode);
  1310.             }
  1311.             if (super.saveClickX >= 273 && super.saveClickX <= 373 && super.saveClickY >= 467 && super.saveClickY <= 499) {
  1312.                 tradeMode = (tradeMode + 1) % 3;
  1313.                 aBoolean1233 = true;
  1314.                 inputTaken = true;
  1315.                 stream.createFrame(95);
  1316.                 stream.writeWordBigEndian(publicChatMode);
  1317.                 stream.writeWordBigEndian(privateChatMode);
  1318.                 stream.writeWordBigEndian(tradeMode);
  1319.             }
  1320.             if (super.saveClickX >= 412 && super.saveClickX <= 512 && super.saveClickY >= 467 && super.saveClickY <= 499) {
  1321.                 if (openInterfaceID == -1) {
  1322.                     closeOpenInterfaces();
  1323.                     reportAbuseInput = "";
  1324.                     canMute = false;
  1325.                     for (RSInterface element : RSInterface.interfaceCache) {
  1326.                         if (element == null || element.anInt214 != 600) {
  1327.                             continue;
  1328.                         }
  1329.                         reportAbuseInterfaceID = openInterfaceID = element.parentID;
  1330.                         break;
  1331.                     }
  1332.  
  1333.                 } else {
  1334.                     pushMessage("Please close the interface you have open before using 'report abuse'", 0, "");
  1335.                 }
  1336.             }
  1337.             anInt940++;
  1338.             if (anInt940 > 1386) {
  1339.                 anInt940 = 0;
  1340.                 stream.createFrame(165);
  1341.                 stream.writeWordBigEndian(0);
  1342.                 int j = stream.currentOffset;
  1343.                 stream.writeWordBigEndian(139);
  1344.                 stream.writeWordBigEndian(150);
  1345.                 stream.writeWord(32131);
  1346.                 stream.writeWordBigEndian((int) (Math.random() * 256D));
  1347.                 stream.writeWord(3250);
  1348.                 stream.writeWordBigEndian(177);
  1349.                 stream.writeWord(24859);
  1350.                 stream.writeWordBigEndian(119);
  1351.                 if ((int) (Math.random() * 2D) == 0) {
  1352.                     stream.writeWord(47234);
  1353.                 }
  1354.                 if ((int) (Math.random() * 2D) == 0) {
  1355.                     stream.writeWordBigEndian(21);
  1356.                 }
  1357.                 stream.writeBytes(stream.currentOffset - j);
  1358.             }
  1359.         }
  1360.     }
  1361.  
  1362.     public void method33(int i) {
  1363.         int action = Varp.cache[i].anInt709;
  1364.         if (action == 0) {
  1365.             return;
  1366.         }
  1367.         int config = variousSettings[i];
  1368.         if (action == 1) {
  1369.             if (config == 1) {
  1370.                 Texture.method372(0.90000000000000002D);
  1371.             }
  1372.             if (config == 2) {
  1373.                 Texture.method372(0.80000000000000004D);
  1374.             }
  1375.             if (config == 3) {
  1376.                 Texture.method372(0.69999999999999996D);
  1377.             }
  1378.             if (config == 4) {
  1379.                 Texture.method372(0.59999999999999998D);
  1380.             }
  1381.             ItemDef.mruNodes1.unlinkAll();
  1382.             welcomeScreenRaised = true;
  1383.         }
  1384.         if (action == 3) {
  1385.             int volume = 0;
  1386.             if (config == 0)
  1387.                 volume = 255;
  1388.             if (config == 1)
  1389.                 volume = 192;
  1390.             if (config == 2)
  1391.                 volume = 128;
  1392.             if (config == 3)
  1393.                 volume = 64;
  1394.             if (config == 4)
  1395.                 volume = 0;
  1396.             if (volume != musicVolume) {
  1397.                 if (musicVolume != 0 || currentSong == -1) {
  1398.                     if (volume != 0)
  1399.                         setVolume(volume);
  1400.                     else {
  1401.                         method55(false);
  1402.                         previousSong = 0;
  1403.                     }
  1404.                 } else {
  1405.                     method56(volume, false, currentSong);
  1406.                     previousSong = 0;//TODO temp music
  1407.                 }
  1408.                 musicVolume = volume;
  1409.             }
  1410.         }
  1411.         if (action == 4) {
  1412.             SoundPlayer.setVolume(config);
  1413.             if (config == 0) {
  1414.                 aBoolean848 = true;
  1415.                 setWaveVolume(0);
  1416.             }
  1417.             if (config == 1) {
  1418.                 aBoolean848 = true;
  1419.                 setWaveVolume(-400);
  1420.             }
  1421.             if (config == 2) {
  1422.                 aBoolean848 = true;
  1423.                 setWaveVolume(-800);
  1424.             }
  1425.             if (config == 3) {
  1426.                 aBoolean848 = true;
  1427.                 setWaveVolume(-1200);
  1428.             }
  1429.             if (config == 4) {
  1430.                 aBoolean848 = false;
  1431.             }
  1432.         }
  1433.         if (action == 5) {
  1434.             anInt1253 = config;
  1435.         }
  1436.         if (action == 6) {
  1437.             anInt1249 = config;
  1438.         }
  1439.         if (action == 8) {
  1440.             splitpublicChat = config;
  1441.             inputTaken = true;
  1442.         }
  1443.         if (action == 9) {
  1444.             anInt913 = config;
  1445.         }
  1446.     }
  1447.  
  1448.     public void updateEntities() {
  1449.         try {
  1450.             int anInt974 = 0;
  1451.             for (int j = -1; j < playerCount + npcCount; j++) {
  1452.                 Object obj;
  1453.                 if (j == -1) {
  1454.                     obj = myPlayer;
  1455.                 } else if (j < playerCount) {
  1456.                     obj = playerArray[playerIndices[j]];
  1457.                 } else {
  1458.                     obj = npcArray[npcIndices[j - playerCount]];
  1459.                 }
  1460.                 if (obj == null || !((Entity) obj).isVisible()) {
  1461.                     continue;
  1462.                 }
  1463.                 if (obj instanceof NPC) {
  1464.                     EntityDef entityDef = ((NPC) obj).desc;
  1465.                     if (entityDef.childrenIDs != null) {
  1466.                         entityDef = entityDef.method161();
  1467.                     }
  1468.                     if (entityDef == null) {
  1469.                         continue;
  1470.                     }
  1471.                 }
  1472.                 if (j < playerCount) {
  1473.                     int l = 30;
  1474.                     Player player = (Player) obj;
  1475.                     if (player.headIcon >= 0) {
  1476.                         npcScreenPos(((Entity) obj), ((Entity) obj).height + 15);
  1477.                         if (spriteDrawX > -1) {
  1478.                             if (player.skullIcon < 2) {
  1479.                                 skullIcons[player.skullIcon].drawSprite(spriteDrawX - 12, spriteDrawY - l);
  1480.                                 l += 25;
  1481.                             }
  1482.                             if (player.headIcon < 7) {
  1483.                                 headIcons[player.headIcon].drawSprite(spriteDrawX - 12, spriteDrawY - l);
  1484.                                 l += 18;
  1485.                             }
  1486.                         }
  1487.                     }
  1488.                     if (j >= 0 && anInt855 == 10 && anInt933 == playerIndices[j]) {
  1489.                         npcScreenPos(((Entity) obj), ((Entity) obj).height + 15);
  1490.                         if (spriteDrawX > -1) {
  1491.                             headIconsHint[1].drawSprite(spriteDrawX - 12, spriteDrawY - l);
  1492.                         }
  1493.                     }
  1494.                 } else {
  1495.                     EntityDef entityDef_1 = ((NPC) obj).desc;
  1496.                     if (entityDef_1.anInt75 >= 0 && entityDef_1.anInt75 < headIcons.length) {
  1497.                         npcScreenPos(((Entity) obj), ((Entity) obj).height + 15);
  1498.                         if (spriteDrawX > -1) {
  1499.                             headIcons[entityDef_1.anInt75].drawSprite(spriteDrawX - 12, spriteDrawY - 30);
  1500.                         }
  1501.                     }
  1502.                     if (anInt855 == 1 && anInt1222 == npcIndices[j - playerCount] && loopCycle % 20 < 10) {
  1503.                         npcScreenPos(((Entity) obj), ((Entity) obj).height + 15);
  1504.                         if (spriteDrawX > -1) {
  1505.                             headIconsHint[0].drawSprite(spriteDrawX - 12, spriteDrawY - 28);
  1506.                         }
  1507.                     }
  1508.                 }
  1509.                 if (((Entity) obj).textSpoken != null && (j >= playerCount || publicChatMode == 0 || publicChatMode == 3 || publicChatMode == 1 && isFriendOrSelf(((Player) obj).name))) {
  1510.                     npcScreenPos(((Entity) obj), ((Entity) obj).height);
  1511.                     if (spriteDrawX > -1 && anInt974 < anInt975) {
  1512.                         anIntArray979[anInt974] = chatTextDrawingArea.method384(((Entity) obj).textSpoken) / 2;
  1513.                         anIntArray978[anInt974] = chatTextDrawingArea.anInt1497;
  1514.                         anIntArray976[anInt974] = spriteDrawX;
  1515.                         anIntArray977[anInt974] = spriteDrawY;
  1516.                         anIntArray980[anInt974] = ((Entity) obj).anInt1513;
  1517.                         anIntArray981[anInt974] = ((Entity) obj).anInt1531;
  1518.                         anIntArray982[anInt974] = ((Entity) obj).textCycle;
  1519.                         aStringArray983[anInt974++] = ((Entity) obj).textSpoken;
  1520.                         if (anInt1249 == 0 && ((Entity) obj).anInt1531 >= 1 && ((Entity) obj).anInt1531 <= 3) {
  1521.                             anIntArray978[anInt974] += 10;
  1522.                             anIntArray977[anInt974] += 5;
  1523.                         }
  1524.                         if (anInt1249 == 0 && ((Entity) obj).anInt1531 == 4) {
  1525.                             anIntArray979[anInt974] = 60;
  1526.                         }
  1527.                         if (anInt1249 == 0 && ((Entity) obj).anInt1531 == 5) {
  1528.                             anIntArray978[anInt974] += 5;
  1529.                         }
  1530.                     }
  1531.                 }
  1532.                 if (((Entity) obj).loopCycleStatus > loopCycle) {
  1533.                     try {
  1534.                         npcScreenPos(((Entity) obj), ((Entity) obj).height + 15);
  1535.                         if (spriteDrawX > -1) {
  1536.                             int i1 = ((Entity) obj).currentHealth * 30 / ((Entity) obj).maxHealth;
  1537.                             if (i1 > 30) {
  1538.                                 i1 = 30;
  1539.                             }
  1540.                             DrawingArea.method336(5, spriteDrawY - 3, 65280, i1, spriteDrawX - 15);
  1541.                             DrawingArea.method336(5, spriteDrawY - 3, 0xff0000, 30 - i1, spriteDrawX - 15 + i1);
  1542.                         }
  1543.                     } catch (Exception e) {
  1544.                     }
  1545.                 }
  1546.                 for (int j1 = 0; j1 < 4; j1++) {
  1547.                     if (((Entity) obj).hitsLoopCycle[j1] > loopCycle) {
  1548.                         npcScreenPos(((Entity) obj), ((Entity) obj).height / 2);
  1549.                         if (spriteDrawX > -1) {
  1550.                             if (j1 == 1) {
  1551.                                 spriteDrawY -= 20;
  1552.                             }
  1553.                             if (j1 == 2) {
  1554.                                 spriteDrawX -= 15;
  1555.                                 spriteDrawY -= 10;
  1556.                             }
  1557.                             if (j1 == 3) {
  1558.                                 spriteDrawX += 15;
  1559.                                 spriteDrawY -= 10;
  1560.                             }
  1561.                             hitMarks[((Entity) obj).hitMarkTypes[j1]].drawSprite(spriteDrawX - 12, spriteDrawY - 12);
  1562.                             aTextDrawingArea_1270.drawText(0, String.valueOf(((Entity) obj).hitArray[j1]), spriteDrawY + 4, spriteDrawX);
  1563.                             aTextDrawingArea_1270.drawText(0xffffff, String.valueOf(((Entity) obj).hitArray[j1]), spriteDrawY + 3, spriteDrawX - 1);
  1564.                         }
  1565.                     }
  1566.                 }
  1567.             }
  1568.             for (int k = 0; k < anInt974; k++) {
  1569.                 int k1 = anIntArray976[k];
  1570.                 int l1 = anIntArray977[k];
  1571.                 int j2 = anIntArray979[k];
  1572.                 int k2 = anIntArray978[k];
  1573.                 boolean flag = true;
  1574.                 while (flag) {
  1575.                     flag = false;
  1576.                     for (int l2 = 0; l2 < k; l2++) {
  1577.                         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) {
  1578.                             l1 = anIntArray977[l2] - anIntArray978[l2];
  1579.                             flag = true;
  1580.                         }
  1581.                     }
  1582.  
  1583.                 }
  1584.                 spriteDrawX = anIntArray976[k];
  1585.                 spriteDrawY = anIntArray977[k] = l1;
  1586.                 String s = aStringArray983[k];
  1587.                 if (anInt1249 == 0) {
  1588.                     int i3 = 0xffff00;
  1589.                     if (anIntArray980[k] < 6) {
  1590.                         i3 = anIntArray965[anIntArray980[k]];
  1591.                     }
  1592.                     if (anIntArray980[k] == 6) {
  1593.                         i3 = anInt1265 % 20 >= 10 ? 0xffff00 : 0xff0000;
  1594.                     }
  1595.                     if (anIntArray980[k] == 7) {
  1596.                         i3 = anInt1265 % 20 >= 10 ? 65535 : 255;
  1597.                     }
  1598.                     if (anIntArray980[k] == 8) {
  1599.                         i3 = anInt1265 % 20 >= 10 ? 0x80ff80 : 45056;
  1600.                     }
  1601.                     if (anIntArray980[k] == 9) {
  1602.                         int j3 = 150 - anIntArray982[k];
  1603.                         if (j3 < 50) {
  1604.                             i3 = 0xff0000 + 1280 * j3;
  1605.                         } else if (j3 < 100) {
  1606.                             i3 = 0xffff00 - 0x50000 * (j3 - 50);
  1607.                         } else if (j3 < 150) {
  1608.                             i3 = 65280 + 5 * (j3 - 100);
  1609.                         }
  1610.                     }
  1611.                     if (anIntArray980[k] == 10) {
  1612.                         int k3 = 150 - anIntArray982[k];
  1613.                         if (k3 < 50) {
  1614.                             i3 = 0xff0000 + 5 * k3;
  1615.                         } else if (k3 < 100) {
  1616.                             i3 = 0xff00ff - 0x50000 * (k3 - 50);
  1617.                         } else if (k3 < 150) {
  1618.                             i3 = 255 + 0x50000 * (k3 - 100) - 5 * (k3 - 100);
  1619.                         }
  1620.                     }
  1621.                     if (anIntArray980[k] == 11) {
  1622.                         int l3 = 150 - anIntArray982[k];
  1623.                         if (l3 < 50) {
  1624.                             i3 = 0xffffff - 0x50005 * l3;
  1625.                         } else if (l3 < 100) {
  1626.                             i3 = 65280 + 0x50005 * (l3 - 50);
  1627.                         } else if (l3 < 150) {
  1628.                             i3 = 0xffffff - 0x50000 * (l3 - 100);
  1629.                         }
  1630.                     }
  1631.                     if (anIntArray981[k] == 0) {
  1632.                         chatTextDrawingArea.drawText(0, s, spriteDrawY + 1, spriteDrawX);
  1633.                         chatTextDrawingArea.drawText(i3, s, spriteDrawY, spriteDrawX);
  1634.                     }
  1635.                     if (anIntArray981[k] == 1) {
  1636.                         chatTextDrawingArea.method386(0, s, spriteDrawX, anInt1265, spriteDrawY + 1);
  1637.                         chatTextDrawingArea.method386(i3, s, spriteDrawX, anInt1265, spriteDrawY);
  1638.                     }
  1639.                     if (anIntArray981[k] == 2) {
  1640.                         chatTextDrawingArea.method387(spriteDrawX, s, anInt1265, spriteDrawY + 1, 0);
  1641.                         chatTextDrawingArea.method387(spriteDrawX, s, anInt1265, spriteDrawY, i3);
  1642.                     }
  1643.                     if (anIntArray981[k] == 3) {
  1644.                         chatTextDrawingArea.method388(150 - anIntArray982[k], s, anInt1265, spriteDrawY + 1, spriteDrawX, 0);
  1645.                         chatTextDrawingArea.method388(150 - anIntArray982[k], s, anInt1265, spriteDrawY, spriteDrawX, i3);
  1646.                     }
  1647.                     if (anIntArray981[k] == 4) {
  1648.                         int i4 = chatTextDrawingArea.method384(s);
  1649.                         int k4 = (150 - anIntArray982[k]) * (i4 + 100) / 150;
  1650.                         DrawingArea.setDrawingArea(334, spriteDrawX - 50, spriteDrawX + 50, 0);
  1651.                         chatTextDrawingArea.method385(0, s, spriteDrawY + 1, spriteDrawX + 50 - k4);
  1652.                         chatTextDrawingArea.method385(i3, s, spriteDrawY, spriteDrawX + 50 - k4);
  1653.                         DrawingArea.defaultDrawingAreaSize();
  1654.                     }
  1655.                     if (anIntArray981[k] == 5) {
  1656.                         int j4 = 150 - anIntArray982[k];
  1657.                         int l4 = 0;
  1658.                         if (j4 < 25) {
  1659.                             l4 = j4 - 25;
  1660.                         } else if (j4 > 125) {
  1661.                             l4 = j4 - 125;
  1662.                         }
  1663.                         DrawingArea.setDrawingArea(spriteDrawY + 5, 0, 512, spriteDrawY - chatTextDrawingArea.anInt1497 - 1);
  1664.                         chatTextDrawingArea.drawText(0, s, spriteDrawY + 1 + l4, spriteDrawX);
  1665.                         chatTextDrawingArea.drawText(i3, s, spriteDrawY + l4, spriteDrawX);
  1666.                         DrawingArea.defaultDrawingAreaSize();
  1667.                     }
  1668.                 } else {
  1669.                     chatTextDrawingArea.drawText(0, s, spriteDrawY + 1, spriteDrawX);
  1670.                     chatTextDrawingArea.drawText(0xffff00, s, spriteDrawY, spriteDrawX);
  1671.                 }
  1672.             }
  1673.         } catch (Exception e) {
  1674.         }
  1675.     }
  1676.  
  1677.     public void delFriend(long l) {
  1678.         try {
  1679.             if (l == 0L) {
  1680.                 return;
  1681.             }
  1682.             for (int i = 0; i < friendsCount; i++) {
  1683.                 if (friendsListAsLongs[i] != l) {
  1684.                     continue;
  1685.                 }
  1686.                 friendsCount--;
  1687.                 needDrawTabArea = true;
  1688.                 for (int j = i; j < friendsCount; j++) {
  1689.                     friendsList[j] = friendsList[j + 1];
  1690.                     friendsNodeIDs[j] = friendsNodeIDs[j + 1];
  1691.                     friendsListAsLongs[j] = friendsListAsLongs[j + 1];
  1692.                 }
  1693.  
  1694.                 stream.createFrame(215);
  1695.                 stream.writeQWord(l);
  1696.                 break;
  1697.             }
  1698.         } catch (RuntimeException runtimeexception) {
  1699.             Signlink.reporterror("18622, " + false + ", " + l + ", " + runtimeexception.toString());
  1700.             throw new RuntimeException();
  1701.         }
  1702.     }
  1703.  
  1704.     public void drawTabArea() {
  1705.         aRSImageProducer_1163.initDrawingArea();
  1706.         Texture.lineOffsets = tabAreaOffsets;
  1707.         invBack.method361(0, 0);
  1708.         if (invOverlayInterfaceID != -1) {
  1709.             drawInterface(0, 0, RSInterface.interfaceCache[invOverlayInterfaceID], 0);
  1710.         } else if (tabInterfaceIDs[tabID] != -1) {
  1711.             drawInterface(0, 0, RSInterface.interfaceCache[tabInterfaceIDs[tabID]], 0);
  1712.         }
  1713.         if (menuOpen && menuScreenArea == 1) {
  1714.             drawMenu();
  1715.         }
  1716.         aRSImageProducer_1163.drawGraphics(205, super.graphics, 553);
  1717.         aRSImageProducer_1165.initDrawingArea();
  1718.         Texture.lineOffsets = chatBoxAreaOffsets;
  1719.     }
  1720.  
  1721.     public void method37(int j) {
  1722.         if (!lowMem) {
  1723.             if (Texture.anIntArray1480[17] >= j) {
  1724.                 Background background = Texture.aBackgroundArray1474s[17];
  1725.                 int k = background.anInt1452 * background.anInt1453 - 1;
  1726.                 int j1 = background.anInt1452 * anInt945 * 2;
  1727.                 byte abyte0[] = background.aByteArray1450;
  1728.                 byte abyte3[] = aByteArray912;
  1729.                 for (int i2 = 0; i2 <= k; i2++) {
  1730.                     abyte3[i2] = abyte0[i2 - j1 & k];
  1731.                 }
  1732.  
  1733.                 background.aByteArray1450 = abyte3;
  1734.                 aByteArray912 = abyte0;
  1735.                 Texture.method370(17);
  1736.             }
  1737.             if (Texture.anIntArray1480[24] >= j) {
  1738.                 Background background_1 = Texture.aBackgroundArray1474s[24];
  1739.                 int l = background_1.anInt1452 * background_1.anInt1453 - 1;
  1740.                 int k1 = background_1.anInt1452 * anInt945 * 2;
  1741.                 byte abyte1[] = background_1.aByteArray1450;
  1742.                 byte abyte4[] = aByteArray912;
  1743.                 for (int j2 = 0; j2 <= l; j2++) {
  1744.                     abyte4[j2] = abyte1[j2 - k1 & l];
  1745.                 }
  1746.  
  1747.                 background_1.aByteArray1450 = abyte4;
  1748.                 aByteArray912 = abyte1;
  1749.                 Texture.method370(24);
  1750.             }
  1751.             if (Texture.anIntArray1480[34] >= j) {
  1752.                 Background background_2 = Texture.aBackgroundArray1474s[34];
  1753.                 int i1 = background_2.anInt1452 * background_2.anInt1453 - 1;
  1754.                 int l1 = background_2.anInt1452 * anInt945 * 2;
  1755.                 byte abyte2[] = background_2.aByteArray1450;
  1756.                 byte abyte5[] = aByteArray912;
  1757.                 for (int k2 = 0; k2 <= i1; k2++) {
  1758.                     abyte5[k2] = abyte2[k2 - l1 & i1];
  1759.                 }
  1760.  
  1761.                 background_2.aByteArray1450 = abyte5;
  1762.                 aByteArray912 = abyte2;
  1763.                 Texture.method370(34);
  1764.             }
  1765.             if (Texture.anIntArray1480[40] >= j) {
  1766.                 Background background_2 = Texture.aBackgroundArray1474s[40];
  1767.                 int i1 = background_2.anInt1452 * background_2.anInt1453 - 1;
  1768.                 int l1 = background_2.anInt1452 * anInt945 * 2;
  1769.                 byte abyte2[] = background_2.aByteArray1450;
  1770.                 byte abyte5[] = aByteArray912;
  1771.                 for (int k2 = 0; k2 <= i1; k2++) {
  1772.                     abyte5[k2] = abyte2[k2 - l1 & i1];
  1773.                 }
  1774.  
  1775.                 background_2.aByteArray1450 = abyte5;
  1776.                 aByteArray912 = abyte2;
  1777.                 Texture.method370(40);
  1778.             }
  1779.         }
  1780.     }
  1781.  
  1782.     public void method38() {
  1783.         for (int i = -1; i < playerCount; i++) {
  1784.             int j;
  1785.             if (i == -1) {
  1786.                 j = myPlayerIndex;
  1787.             } else {
  1788.                 j = playerIndices[i];
  1789.             }
  1790.             Player player = playerArray[j];
  1791.             if (player != null && player.textCycle > 0) {
  1792.                 player.textCycle--;
  1793.                 if (player.textCycle == 0) {
  1794.                     player.textSpoken = null;
  1795.                 }
  1796.             }
  1797.         }
  1798.  
  1799.         for (int k = 0; k < npcCount; k++) {
  1800.             int l = npcIndices[k];
  1801.             NPC npc = npcArray[l];
  1802.             if (npc != null && npc.textCycle > 0) {
  1803.                 npc.textCycle--;
  1804.                 if (npc.textCycle == 0) {
  1805.                     npc.textSpoken = null;
  1806.                 }
  1807.             }
  1808.         }
  1809.  
  1810.     }
  1811.  
  1812.     public void calcCameraPos() {
  1813.         int i = anInt1098 * 128 + 64;
  1814.         int j = anInt1099 * 128 + 64;
  1815.         int k = method42(plane, j, i) - anInt1100;
  1816.         if (xCameraPos < i) {
  1817.             xCameraPos += anInt1101 + (i - xCameraPos) * anInt1102 / 1000;
  1818.             if (xCameraPos > i) {
  1819.                 xCameraPos = i;
  1820.             }
  1821.         }
  1822.         if (xCameraPos > i) {
  1823.             xCameraPos -= anInt1101 + (xCameraPos - i) * anInt1102 / 1000;
  1824.             if (xCameraPos < i) {
  1825.                 xCameraPos = i;
  1826.             }
  1827.         }
  1828.         if (zCameraPos < k) {
  1829.             zCameraPos += anInt1101 + (k - zCameraPos) * anInt1102 / 1000;
  1830.             if (zCameraPos > k) {
  1831.                 zCameraPos = k;
  1832.             }
  1833.         }
  1834.         if (zCameraPos > k) {
  1835.             zCameraPos -= anInt1101 + (zCameraPos - k) * anInt1102 / 1000;
  1836.             if (zCameraPos < k) {
  1837.                 zCameraPos = k;
  1838.             }
  1839.         }
  1840.         if (yCameraPos < j) {
  1841.             yCameraPos += anInt1101 + (j - yCameraPos) * anInt1102 / 1000;
  1842.             if (yCameraPos > j) {
  1843.                 yCameraPos = j;
  1844.             }
  1845.         }
  1846.         if (yCameraPos > j) {
  1847.             yCameraPos -= anInt1101 + (yCameraPos - j) * anInt1102 / 1000;
  1848.             if (yCameraPos < j) {
  1849.                 yCameraPos = j;
  1850.             }
  1851.         }
  1852.         i = anInt995 * 128 + 64;
  1853.         j = anInt996 * 128 + 64;
  1854.         k = method42(plane, j, i) - anInt997;
  1855.         int l = i - xCameraPos;
  1856.         int i1 = k - zCameraPos;
  1857.         int j1 = j - yCameraPos;
  1858.         int k1 = (int) Math.sqrt(l * l + j1 * j1);
  1859.         int l1 = (int) (Math.atan2(i1, k1) * 325.94900000000001D) & 0x7ff;
  1860.         int i2 = (int) (Math.atan2(l, j1) * -325.94900000000001D) & 0x7ff;
  1861.         if (l1 < 128) {
  1862.             l1 = 128;
  1863.         }
  1864.         if (l1 > 383) {
  1865.             l1 = 383;
  1866.         }
  1867.         if (yCameraCurve < l1) {
  1868.             yCameraCurve += anInt998 + (l1 - yCameraCurve) * anInt999 / 1000;
  1869.             if (yCameraCurve > l1) {
  1870.                 yCameraCurve = l1;
  1871.             }
  1872.         }
  1873.         if (yCameraCurve > l1) {
  1874.             yCameraCurve -= anInt998 + (yCameraCurve - l1) * anInt999 / 1000;
  1875.             if (yCameraCurve < l1) {
  1876.                 yCameraCurve = l1;
  1877.             }
  1878.         }
  1879.         int j2 = i2 - xCameraCurve;
  1880.         if (j2 > 1024) {
  1881.             j2 -= 2048;
  1882.         }
  1883.         if (j2 < -1024) {
  1884.             j2 += 2048;
  1885.         }
  1886.         if (j2 > 0) {
  1887.             xCameraCurve += anInt998 + j2 * anInt999 / 1000;
  1888.             xCameraCurve &= 0x7ff;
  1889.         }
  1890.         if (j2 < 0) {
  1891.             xCameraCurve -= anInt998 + -j2 * anInt999 / 1000;
  1892.             xCameraCurve &= 0x7ff;
  1893.         }
  1894.         int k2 = i2 - xCameraCurve;
  1895.         if (k2 > 1024) {
  1896.             k2 -= 2048;
  1897.         }
  1898.         if (k2 < -1024) {
  1899.             k2 += 2048;
  1900.         }
  1901.         if (k2 < 0 && j2 > 0 || k2 > 0 && j2 < 0) {
  1902.             xCameraCurve = i2;
  1903.         }
  1904.     }
  1905.  
  1906.     public void drawMenu() {
  1907.         int i = menuOffsetX;
  1908.         int j = menuOffsetY;
  1909.         int k = menuWidth;
  1910.         int l = anInt952;
  1911.         int i1 = 0x5d5447;
  1912.         DrawingArea.method336(l, j, i1, k, i);
  1913.         DrawingArea.method336(16, j + 1, 0, k - 2, i + 1);
  1914.         DrawingArea.fillPixels(j + 18, l - 19, 0, i + 1, k - 2);
  1915.         chatTextDrawingArea.method385(i1, "Choose Option", j + 14, i + 3);
  1916.         int j1 = super.mouseX;
  1917.         int k1 = super.mouseY;
  1918.         if (menuScreenArea == 0) {
  1919.             j1 -= 4;
  1920.             k1 -= 4;
  1921.         }
  1922.         if (menuScreenArea == 1) {
  1923.             j1 -= 553;
  1924.             k1 -= 205;
  1925.         }
  1926.         if (menuScreenArea == 2) {
  1927.             j1 -= 17;
  1928.             k1 -= 357;
  1929.         }
  1930.         for (int l1 = 0; l1 < menuActionRow; l1++) {
  1931.             int i2 = j + 31 + (menuActionRow - 1 - l1) * 15;
  1932.             int j2 = 0xffffff;
  1933.             if (j1 > i && j1 < i + k && k1 > i2 - 13 && k1 < i2 + 3) {
  1934.                 j2 = 0xffff00;
  1935.             }
  1936.             chatTextDrawingArea.method389(true, i + 3, j2, menuActionName[l1], i2);
  1937.         }
  1938.  
  1939.     }
  1940.  
  1941.     public void addFriend(long l) {
  1942.         try {
  1943.             if (l == 0L) {
  1944.                 return;
  1945.             }
  1946.             if (friendsCount >= 100 && anInt1046 != 1) {
  1947.                 pushMessage("Your friendlist is full. Max of 100 for free users, and 200 for members", 0, "");
  1948.                 return;
  1949.             }
  1950.             if (friendsCount >= 200) {
  1951.                 pushMessage("Your friendlist is full. Max of 100 for free users, and 200 for members", 0, "");
  1952.                 return;
  1953.             }
  1954.             String s = TextClass.fixName(TextClass.nameForLong(l));
  1955.             for (int i = 0; i < friendsCount; i++) {
  1956.                 if (friendsListAsLongs[i] == l) {
  1957.                     pushMessage(s + " is already on your friend list", 0, "");
  1958.                     return;
  1959.                 }
  1960.             }
  1961.             for (int j = 0; j < ignoreCount; j++) {
  1962.                 if (ignoreListAsLongs[j] == l) {
  1963.                     pushMessage("Please remove " + s + " from your ignore list first", 0, "");
  1964.                     return;
  1965.                 }
  1966.             }
  1967.  
  1968.             if (s.equals(myPlayer.name)) {
  1969.                 return;
  1970.             } else {
  1971.                 friendsList[friendsCount] = s;
  1972.                 friendsListAsLongs[friendsCount] = l;
  1973.                 friendsNodeIDs[friendsCount] = 0;
  1974.                 friendsCount++;
  1975.                 needDrawTabArea = true;
  1976.                 stream.createFrame(188);
  1977.                 stream.writeQWord(l);
  1978.                 return;
  1979.             }
  1980.         } catch (RuntimeException runtimeexception) {
  1981.             Signlink.reporterror("15283, " + (byte) 68 + ", " + l + ", " + runtimeexception.toString());
  1982.         }
  1983.         throw new RuntimeException();
  1984.     }
  1985.  
  1986.     public int method42(int i, int j, int k) {
  1987.         int l = k >> 7;
  1988.         int i1 = j >> 7;
  1989.         if (l < 0 || i1 < 0 || l > 103 || i1 > 103) {
  1990.             return 0;
  1991.         }
  1992.         int j1 = i;
  1993.         if (j1 < 3 && (byteGroundArray[1][l][i1] & 2) == 2) {
  1994.             j1++;
  1995.         }
  1996.         int k1 = k & 0x7f;
  1997.         int l1 = j & 0x7f;
  1998.         int i2 = intGroundArray[j1][l][i1] * (128 - k1) + intGroundArray[j1][l + 1][i1] * k1 >> 7;
  1999.         int j2 = intGroundArray[j1][l][i1 + 1] * (128 - k1) + intGroundArray[j1][l + 1][i1 + 1] * k1 >> 7;
  2000.         return i2 * (128 - l1) + j2 * l1 >> 7;
  2001.     }
  2002.  
  2003.     public static String intToKOrMil(int j) {
  2004.         if (j < 0x186a0) {
  2005.             return String.valueOf(j);
  2006.         }
  2007.         if (j < 0x989680) {
  2008.             return j / 1000 + "K";
  2009.         } else {
  2010.             return j / 0xf4240 + "M";
  2011.         }
  2012.     }
  2013.  
  2014.     public void resetLogout() {
  2015.         try {
  2016.             if (socketStream != null) {
  2017.                 socketStream.close();
  2018.             }
  2019.         } catch (Exception _ex) {
  2020.         }
  2021.         socketStream = null;
  2022.         loggedIn = false;
  2023.         loginScreenState = 0;
  2024.         // myUsername = "";
  2025.         // myPassword = "";
  2026.         unlinkMRUNodes();
  2027.         worldController.initToNull();
  2028.         for (int i = 0; i < 4; i++) {
  2029.             aClass11Array1230[i].method210();
  2030.         }
  2031.  
  2032.         System.gc();
  2033.         stopMidi();
  2034.         currentSong = -1;
  2035.         nextSong = -1;
  2036.         previousSong = 0;
  2037.         method58(10, musicVolume, false, 0);
  2038.     }
  2039.  
  2040.     public void method45() {
  2041.         aBoolean1031 = true;
  2042.         for (int j = 0; j < 7; j++) {
  2043.             anIntArray1065[j] = -1;
  2044.             for (int k = 0; k < IDK.length; k++) {
  2045.                 if (IDK.cache[k].aBoolean662 || IDK.cache[k].anInt657 != j + (aBoolean1047 ? 0 : 7)) {
  2046.                     continue;
  2047.                 }
  2048.                 anIntArray1065[j] = k;
  2049.                 break;
  2050.             }
  2051.  
  2052.         }
  2053.  
  2054.     }
  2055.  
  2056.     public void method46(int i, Stream stream) {
  2057.         while (stream.bitPosition + 21 < i * 8) {
  2058.             int k = stream.readBits(14);
  2059.             if (k == 16383) {
  2060.                 break;
  2061.             }
  2062.             if (npcArray[k] == null) {
  2063.                 npcArray[k] = new NPC();
  2064.             }
  2065.             NPC npc = npcArray[k];
  2066.             npcIndices[npcCount++] = k;
  2067.             npc.anInt1537 = loopCycle;
  2068.             int l = stream.readBits(5);
  2069.             if (l > 15) {
  2070.                 l -= 32;
  2071.             }
  2072.             int i1 = stream.readBits(5);
  2073.             if (i1 > 15) {
  2074.                 i1 -= 32;
  2075.             }
  2076.             int j1 = stream.readBits(1);
  2077.             npc.desc = EntityDef.forID(stream.readBits(ClientSettings.NPC_BITS));
  2078.             int k1 = stream.readBits(1);
  2079.             if (k1 == 1) {
  2080.                 anIntArray894[anInt893++] = k;
  2081.             }
  2082.             npc.anInt1540 = npc.desc.aByte68;
  2083.             npc.anInt1504 = npc.desc.anInt79;
  2084.             npc.anInt1554 = npc.desc.anInt67;
  2085.             npc.anInt1555 = npc.desc.anInt58;
  2086.             npc.anInt1556 = npc.desc.anInt83;
  2087.             npc.anInt1557 = npc.desc.anInt55;
  2088.             npc.anInt1511 = npc.desc.anInt77;
  2089.             npc.setPos(myPlayer.smallX[0] + i1, myPlayer.smallY[0] + l, j1 == 1);
  2090.         }
  2091.         stream.finishBitAccess();
  2092.     }
  2093.  
  2094.     public void processGameLoop() {
  2095.         if (rsAlreadyLoaded || loadingError || genericLoadingError) {
  2096.             return;
  2097.         }
  2098.         loopCycle++;
  2099.         if (!loggedIn) {
  2100.             processLoginScreenInput();
  2101.         } else {
  2102.             mainGameProcessor();
  2103.         }
  2104.         processOnDemandQueue();
  2105.         method49();
  2106.     }
  2107.  
  2108.     public void method47(boolean flag) {
  2109.         if (myPlayer.x >> 7 == destX && myPlayer.y >> 7 == destY) {
  2110.             destX = 0;
  2111.         }
  2112.         int j = playerCount;
  2113.         if (flag) {
  2114.             j = 1;
  2115.         }
  2116.         for (int l = 0; l < j; l++) {
  2117.             Player player;
  2118.             int i1;
  2119.             if (flag) {
  2120.                 player = myPlayer;
  2121.                 i1 = myPlayerIndex << 14;
  2122.             } else {
  2123.                 player = playerArray[playerIndices[l]];
  2124.                 i1 = playerIndices[l] << 14;
  2125.             }
  2126.             if (player == null || !player.isVisible()) {
  2127.                 continue;
  2128.             }
  2129.             player.aBoolean1699 = (lowMem && playerCount > 50 || playerCount > 200) && !flag && player.anInt1517 == player.anInt1511;
  2130.             int j1 = player.x >> 7;
  2131.             int k1 = player.y >> 7;
  2132.             if (j1 < 0 || j1 >= 104 || k1 < 0 || k1 >= 104) {
  2133.                 continue;
  2134.             }
  2135.             if (player.aModel_1714 != null && loopCycle >= player.anInt1707 && loopCycle < player.anInt1708) {
  2136.                 player.aBoolean1699 = false;
  2137.                 player.anInt1709 = method42(plane, player.y, player.x);
  2138.                 worldController.method286(plane, player.y, player, player.anInt1552, player.anInt1722, player.x, player.anInt1709, player.anInt1719, player.anInt1721, i1, player.anInt1720);
  2139.                 continue;
  2140.             }
  2141.             if ((player.x & 0x7f) == 64 && (player.y & 0x7f) == 64) {
  2142.                 if (anIntArrayArray929[j1][k1] == anInt1265) {
  2143.                     continue;
  2144.                 }
  2145.                 anIntArrayArray929[j1][k1] = anInt1265;
  2146.             }
  2147.             player.anInt1709 = method42(plane, player.y, player.x);
  2148.             worldController.method285(plane, player.anInt1552, player.anInt1709, i1, player.y, 60, player.x, player, player.aBoolean1541);
  2149.         }
  2150.  
  2151.     }
  2152.  
  2153.     public boolean promptUserForInput(RSInterface class9) {
  2154.         int j = class9.anInt214;
  2155.         if (anInt900 == 2) {
  2156.             if (j == 201) {
  2157.                 inputTaken = true;
  2158.                 inputDialogState = 0;
  2159.                 messagePromptRaised = true;
  2160.                 promptInput = "";
  2161.                 friendsListAction = 1;
  2162.                 aString1121 = "Enter name of friend to add to list";
  2163.             }
  2164.             if (j == 202) {
  2165.                 inputTaken = true;
  2166.                 inputDialogState = 0;
  2167.                 messagePromptRaised = true;
  2168.                 promptInput = "";
  2169.                 friendsListAction = 2;
  2170.                 aString1121 = "Enter name of friend to delete from list";
  2171.             }
  2172.         }
  2173.         if (j == 205) {
  2174.             anInt1011 = 250;
  2175.             return true;
  2176.         }
  2177.         if (j == 501) {
  2178.             inputTaken = true;
  2179.             inputDialogState = 0;
  2180.             messagePromptRaised = true;
  2181.             promptInput = "";
  2182.             friendsListAction = 4;
  2183.             aString1121 = "Enter name of player to add to list";
  2184.         }
  2185.         if (j == 502) {
  2186.             inputTaken = true;
  2187.             inputDialogState = 0;
  2188.             messagePromptRaised = true;
  2189.             promptInput = "";
  2190.             friendsListAction = 5;
  2191.             aString1121 = "Enter name of player to delete from list";
  2192.         }
  2193.         if (j >= 300 && j <= 313) {
  2194.             int k = (j - 300) / 2;
  2195.             int j1 = j & 1;
  2196.             int i2 = anIntArray1065[k];
  2197.             if (i2 != -1) {
  2198.                 do {
  2199.                     if (j1 == 0 && --i2 < 0) {
  2200.                         i2 = IDK.length - 1;
  2201.                     }
  2202.                     if (j1 == 1 && ++i2 >= IDK.length) {
  2203.                         i2 = 0;
  2204.                     }
  2205.                 } while (IDK.cache[i2].aBoolean662 || IDK.cache[i2].anInt657 != k + (aBoolean1047 ? 0 : 7));
  2206.                 anIntArray1065[k] = i2;
  2207.                 aBoolean1031 = true;
  2208.             }
  2209.         }
  2210.         if (j >= 314 && j <= 323) {
  2211.             int l = (j - 314) / 2;
  2212.             int k1 = j & 1;
  2213.             int j2 = anIntArray990[l];
  2214.             if (k1 == 0 && --j2 < 0) {
  2215.                 j2 = anIntArrayArray1003[l].length - 1;
  2216.             }
  2217.             if (k1 == 1 && ++j2 >= anIntArrayArray1003[l].length) {
  2218.                 j2 = 0;
  2219.             }
  2220.             anIntArray990[l] = j2;
  2221.             aBoolean1031 = true;
  2222.         }
  2223.         if (j == 324 && !aBoolean1047) {
  2224.             aBoolean1047 = true;
  2225.             method45();
  2226.         }
  2227.         if (j == 325 && aBoolean1047) {
  2228.             aBoolean1047 = false;
  2229.             method45();
  2230.         }
  2231.         if (j == 326) {
  2232.             stream.createFrame(101);
  2233.             stream.writeWordBigEndian(aBoolean1047 ? 0 : 1);
  2234.             for (int i1 = 0; i1 < 7; i1++) {
  2235.                 stream.writeWordBigEndian(anIntArray1065[i1]);
  2236.             }
  2237.  
  2238.             for (int l1 = 0; l1 < 5; l1++) {
  2239.                 stream.writeWordBigEndian(anIntArray990[l1]);
  2240.             }
  2241.  
  2242.             return true;
  2243.         }
  2244.         if (j == 613) {
  2245.             canMute = !canMute;
  2246.         }
  2247.         if (j >= 601 && j <= 612) {
  2248.             closeOpenInterfaces();
  2249.             if (reportAbuseInput.length() > 0) {
  2250.                 stream.createFrame(218);
  2251.                 stream.writeQWord(TextClass.longForName(reportAbuseInput));
  2252.                 stream.writeWordBigEndian(j - 601);
  2253.                 stream.writeWordBigEndian(canMute ? 1 : 0);
  2254.             }
  2255.         }
  2256.         return false;
  2257.     }
  2258.  
  2259.     public void method49(Stream stream) {
  2260.         for (int j = 0; j < anInt893; j++) {
  2261.             int k = anIntArray894[j];
  2262.             Player player = playerArray[k];
  2263.             int l = stream.readUnsignedByte();
  2264.             if ((l & 0x40) != 0) {
  2265.                 l += stream.readUnsignedByte() << 8;
  2266.             }
  2267.             method107(l, k, stream, player);
  2268.         }
  2269.  
  2270.     }
  2271.  
  2272.     public void method50(int i, int k, int l, int i1, int j1) {
  2273.         int k1 = worldController.method300(j1, l, i);
  2274.         if (k1 != 0) {
  2275.             int l1 = worldController.method304(j1, l, i, k1);
  2276.             int k2 = l1 >> 6 & 3;
  2277.             int i3 = l1 & 0x1f;
  2278.             int k3 = k;
  2279.             if (k1 > 0) {
  2280.                 k3 = i1;
  2281.             }
  2282.             int ai[] = aClass30_Sub2_Sub1_Sub1_1263.pixels;
  2283.             int k4 = 24624 + l * 4 + (103 - i) * 512 * 4;
  2284.             int i5 = k1 >> 14 & 0x7fff;
  2285.             ObjectDef class46_2 = ObjectDef.forID(i5);
  2286.             if (class46_2.anInt758 != -1) {
  2287.                 Background background_2 = mapScenes[class46_2.anInt758];
  2288.                 if (background_2 != null) {
  2289.                     int i6 = (class46_2.anInt744 * 4 - background_2.anInt1452) / 2;
  2290.                     int j6 = (class46_2.anInt761 * 4 - background_2.anInt1453) / 2;
  2291.                     background_2.method361(48 + l * 4 + i6, 48 + (104 - i - class46_2.anInt761) * 4 + j6);
  2292.                 }
  2293.             } else {
  2294.                 if (i3 == 0 || i3 == 2) {
  2295.                     if (k2 == 0) {
  2296.                         ai[k4] = k3;
  2297.                         ai[k4 + 512] = k3;
  2298.                         ai[k4 + 1024] = k3;
  2299.                         ai[k4 + 1536] = k3;
  2300.                     } else if (k2 == 1) {
  2301.                         ai[k4] = k3;
  2302.                         ai[k4 + 1] = k3;
  2303.                         ai[k4 + 2] = k3;
  2304.                         ai[k4 + 3] = k3;
  2305.                     } else if (k2 == 2) {
  2306.                         ai[k4 + 3] = k3;
  2307.                         ai[k4 + 3 + 512] = k3;
  2308.                         ai[k4 + 3 + 1024] = k3;
  2309.                         ai[k4 + 3 + 1536] = k3;
  2310.                     } else if (k2 == 3) {
  2311.                         ai[k4 + 1536] = k3;
  2312.                         ai[k4 + 1536 + 1] = k3;
  2313.                         ai[k4 + 1536 + 2] = k3;
  2314.                         ai[k4 + 1536 + 3] = k3;
  2315.                     }
  2316.                 }
  2317.                 if (i3 == 3) {
  2318.                     if (k2 == 0) {
  2319.                         ai[k4] = k3;
  2320.                     } else if (k2 == 1) {
  2321.                         ai[k4 + 3] = k3;
  2322.                     } else if (k2 == 2) {
  2323.                         ai[k4 + 3 + 1536] = k3;
  2324.                     } else if (k2 == 3) {
  2325.                         ai[k4 + 1536] = k3;
  2326.                     }
  2327.                 }
  2328.                 if (i3 == 2) {
  2329.                     if (k2 == 3) {
  2330.                         ai[k4] = k3;
  2331.                         ai[k4 + 512] = k3;
  2332.                         ai[k4 + 1024] = k3;
  2333.                         ai[k4 + 1536] = k3;
  2334.                     } else if (k2 == 0) {
  2335.                         ai[k4] = k3;
  2336.                         ai[k4 + 1] = k3;
  2337.                         ai[k4 + 2] = k3;
  2338.                         ai[k4 + 3] = k3;
  2339.                     } else if (k2 == 1) {
  2340.                         ai[k4 + 3] = k3;
  2341.                         ai[k4 + 3 + 512] = k3;
  2342.                         ai[k4 + 3 + 1024] = k3;
  2343.                         ai[k4 + 3 + 1536] = k3;
  2344.                     } else if (k2 == 2) {
  2345.                         ai[k4 + 1536] = k3;
  2346.                         ai[k4 + 1536 + 1] = k3;
  2347.                         ai[k4 + 1536 + 2] = k3;
  2348.                         ai[k4 + 1536 + 3] = k3;
  2349.                     }
  2350.                 }
  2351.             }
  2352.         }
  2353.         k1 = worldController.method302(j1, l, i);
  2354.         if (k1 != 0) {
  2355.             int i2 = worldController.method304(j1, l, i, k1);
  2356.             int l2 = i2 >> 6 & 3;
  2357.             int j3 = i2 & 0x1f;
  2358.             int l3 = k1 >> 14 & 0x7fff;
  2359.             ObjectDef class46_1 = ObjectDef.forID(l3);
  2360.             if (class46_1.anInt758 != -1) {
  2361.                 Background background_1 = mapScenes[class46_1.anInt758];
  2362.                 if (background_1 != null) {
  2363.                     int j5 = (class46_1.anInt744 * 4 - background_1.anInt1452) / 2;
  2364.                     int k5 = (class46_1.anInt761 * 4 - background_1.anInt1453) / 2;
  2365.                     background_1.method361(48 + l * 4 + j5, 48 + (104 - i - class46_1.anInt761) * 4 + k5);
  2366.                 }
  2367.             } else if (j3 == 9) {
  2368.                 int l4 = 0xeeeeee;
  2369.                 if (k1 > 0) {
  2370.                     l4 = 0xee0000;
  2371.                 }
  2372.                 int ai1[] = aClass30_Sub2_Sub1_Sub1_1263.pixels;
  2373.                 int l5 = 24624 + l * 4 + (103 - i) * 512 * 4;
  2374.                 if (l2 == 0 || l2 == 2) {
  2375.                     ai1[l5 + 1536] = l4;
  2376.                     ai1[l5 + 1024 + 1] = l4;
  2377.                     ai1[l5 + 512 + 2] = l4;
  2378.                     ai1[l5 + 3] = l4;
  2379.                 } else {
  2380.                     ai1[l5] = l4;
  2381.                     ai1[l5 + 512 + 1] = l4;
  2382.                     ai1[l5 + 1024 + 2] = l4;
  2383.                     ai1[l5 + 1536 + 3] = l4;
  2384.                 }
  2385.             }
  2386.         }
  2387.         k1 = worldController.method303(j1, l, i);
  2388.         if (k1 != 0) {
  2389.             int j2 = k1 >> 14 & 0x7fff;
  2390.             ObjectDef class46 = ObjectDef.forID(j2);
  2391.             if (class46.anInt758 != -1) {
  2392.                 Background background = mapScenes[class46.anInt758];
  2393.                 if (background != null) {
  2394.                     int i4 = (class46.anInt744 * 4 - background.anInt1452) / 2;
  2395.                     int j4 = (class46.anInt761 * 4 - background.anInt1453) / 2;
  2396.                     background.method361(48 + l * 4 + i4, 48 + (104 - i - class46.anInt761) * 4 + j4);
  2397.                 }
  2398.             }
  2399.         }
  2400.     }
  2401.  
  2402.     public void loadTitleScreen() {
  2403.         aBackground_966 = new Background(titleStreamLoader, "titlebox", 0);
  2404.         aBackground_967 = new Background(titleStreamLoader, "titlebutton", 0);
  2405.         aBackgroundArray1152s = new Background[12];
  2406.         int j = 0;
  2407.         try {
  2408.             j = Integer.parseInt(getParameter("fl_icon"));
  2409.         } catch (Exception _ex) {
  2410.         }
  2411.         if (j == 0) {
  2412.             for (int k = 0; k < 12; k++) {
  2413.                 aBackgroundArray1152s[k] = new Background(titleStreamLoader, "runes", k);
  2414.             }
  2415.  
  2416.         } else {
  2417.             for (int l = 0; l < 12; l++) {
  2418.                 aBackgroundArray1152s[l] = new Background(titleStreamLoader, "runes", 12 + (l & 3));
  2419.             }
  2420.  
  2421.         }
  2422.         aClass30_Sub2_Sub1_Sub1_1201 = new Sprite(128, 265);
  2423.         aClass30_Sub2_Sub1_Sub1_1202 = new Sprite(128, 265);
  2424.         System.arraycopy(aRSImageProducer_1110.anIntArray315, 0, aClass30_Sub2_Sub1_Sub1_1201.pixels, 0, 33920);
  2425.  
  2426.         System.arraycopy(aRSImageProducer_1111.anIntArray315, 0, aClass30_Sub2_Sub1_Sub1_1202.pixels, 0, 33920);
  2427.  
  2428.         anIntArray851 = new int[256];
  2429.         for (int k1 = 0; k1 < 64; k1++) {
  2430.             anIntArray851[k1] = k1 * 0x40000;
  2431.         }
  2432.  
  2433.         for (int l1 = 0; l1 < 64; l1++) {
  2434.             anIntArray851[l1 + 64] = 0xff0000 + 1024 * l1;
  2435.         }
  2436.  
  2437.         for (int i2 = 0; i2 < 64; i2++) {
  2438.             anIntArray851[i2 + 128] = 0xffff00 + 4 * i2;
  2439.         }
  2440.  
  2441.         for (int j2 = 0; j2 < 64; j2++) {
  2442.             anIntArray851[j2 + 192] = 0xffffff;
  2443.         }
  2444.  
  2445.         anIntArray852 = new int[256];
  2446.         for (int k2 = 0; k2 < 64; k2++) {
  2447.             anIntArray852[k2] = k2 * 1024;
  2448.         }
  2449.  
  2450.         for (int l2 = 0; l2 < 64; l2++) {
  2451.             anIntArray852[l2 + 64] = 65280 + 4 * l2;
  2452.         }
  2453.  
  2454.         for (int i3 = 0; i3 < 64; i3++) {
  2455.             anIntArray852[i3 + 128] = 65535 + 0x40000 * i3;
  2456.         }
  2457.  
  2458.         for (int j3 = 0; j3 < 64; j3++) {
  2459.             anIntArray852[j3 + 192] = 0xffffff;
  2460.         }
  2461.  
  2462.         anIntArray853 = new int[256];
  2463.         for (int k3 = 0; k3 < 64; k3++) {
  2464.             anIntArray853[k3] = k3 * 4;
  2465.         }
  2466.  
  2467.         for (int l3 = 0; l3 < 64; l3++) {
  2468.             anIntArray853[l3 + 64] = 255 + 0x40000 * l3;
  2469.         }
  2470.  
  2471.         for (int i4 = 0; i4 < 64; i4++) {
  2472.             anIntArray853[i4 + 128] = 0xff00ff + 1024 * i4;
  2473.         }
  2474.  
  2475.         for (int j4 = 0; j4 < 64; j4++) {
  2476.             anIntArray853[j4 + 192] = 0xffffff;
  2477.         }
  2478.  
  2479.         anIntArray850 = new int[256];
  2480.         anIntArray1190 = new int[32768];
  2481.         anIntArray1191 = new int[32768];
  2482.         randomizeBackground(null);
  2483.         anIntArray828 = new int[32768];
  2484.         anIntArray829 = new int[32768];
  2485.         drawLoadingText(10, "Connecting to fileserver");
  2486.         if (!aBoolean831) {
  2487.             drawFlames = true;
  2488.             aBoolean831 = true;
  2489.             startRunnable(this, 2);
  2490.         }
  2491.     }
  2492.  
  2493.     public static void setHighMem() {
  2494.         WorldController.lowMem = false;
  2495.         Texture.lowMem = false;
  2496.         lowMem = false;
  2497.         ObjectManager.lowMem = false;
  2498.         ObjectDef.lowMem = false;
  2499.     }
  2500.  
  2501.     public void loadingStages() {
  2502.         if (lowMem && loadingStage == 2 && ObjectManager.anInt131 != plane) {
  2503.             drawTextOnScreen(null, "Loading - please wait.");
  2504.             loadingStage = 1;
  2505.             aLong824 = System.currentTimeMillis();
  2506.         }
  2507.         if (loadingStage == 1) {
  2508.             int j = method54();
  2509.             if (j != 0 && System.currentTimeMillis() - aLong824 > 0x57e40L) {
  2510.                 Signlink.reporterror(myUsername + " glcfb " + aLong1215 + "," + j + "," + lowMem + "," + decompressors[0] + "," + onDemandFetcher.getNodeCount() + "," + plane + "," + anInt1069 + "," + anInt1070);
  2511.                 aLong824 = System.currentTimeMillis();
  2512.             }
  2513.         }
  2514.         if (loadingStage == 2 && plane != anInt985) {
  2515.             anInt985 = plane;
  2516.             method24(plane);
  2517.         }
  2518.     }
  2519.  
  2520.     public int method54() {
  2521.         for (int i = 0; i < aByteArrayArray1183.length; i++) {
  2522.             if (aByteArrayArray1183[i] == null && anIntArray1235[i] != -1) {
  2523.                 return -1;
  2524.             }
  2525.             if (aByteArrayArray1247[i] == null && anIntArray1236[i] != -1) {
  2526.                 return -2;
  2527.             }
  2528.         }
  2529.  
  2530.         boolean flag = true;
  2531.         for (int j = 0; j < aByteArrayArray1183.length; j++) {
  2532.             byte abyte0[] = aByteArrayArray1247[j];
  2533.             if (abyte0 != null) {
  2534.                 int k = (anIntArray1234[j] >> 8) * 64 - baseX;
  2535.                 int l = (anIntArray1234[j] & 0xff) * 64 - baseY;
  2536.                 if (aBoolean1159) {
  2537.                     k = 10;
  2538.                     l = 10;
  2539.                 }
  2540.                 flag &= ObjectManager.method189(k, abyte0, l);
  2541.             }
  2542.         }
  2543.  
  2544.         if (!flag) {
  2545.             return -3;
  2546.         }
  2547.         if (aBoolean1080) {
  2548.             return -4;
  2549.         } else {
  2550.             loadingStage = 2;
  2551.             ObjectManager.anInt131 = plane;
  2552.             method22();
  2553.             stream.createFrame(121);
  2554.             return 0;
  2555.         }
  2556.     }
  2557.  
  2558.     public void method55() {
  2559.         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()) {
  2560.             if (class30_sub2_sub4_sub4.anInt1597 != plane || loopCycle > class30_sub2_sub4_sub4.anInt1572) {
  2561.                 class30_sub2_sub4_sub4.unlink();
  2562.             } else if (loopCycle >= class30_sub2_sub4_sub4.anInt1571) {
  2563.                 if (class30_sub2_sub4_sub4.anInt1590 > 0) {
  2564.                     NPC npc = npcArray[class30_sub2_sub4_sub4.anInt1590 - 1];
  2565.                     if (npc != null && npc.x >= 0 && npc.x < 13312 && npc.y >= 0 && npc.y < 13312) {
  2566.                         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);
  2567.                     }
  2568.                 }
  2569.                 if (class30_sub2_sub4_sub4.anInt1590 < 0) {
  2570.                     int j = -class30_sub2_sub4_sub4.anInt1590 - 1;
  2571.                     Player player;
  2572.                     if (j == unknownInt10) {
  2573.                         player = myPlayer;
  2574.                     } else {
  2575.                         player = playerArray[j];
  2576.                     }
  2577.                     if (player != null && player.x >= 0 && player.x < 13312 && player.y >= 0 && player.y < 13312) {
  2578.                         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);
  2579.                     }
  2580.                 }
  2581.                 class30_sub2_sub4_sub4.method456(anInt945);
  2582.                 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);
  2583.             }
  2584.         }
  2585.  
  2586.     }
  2587.  
  2588.     public AppletContext getAppletContext() {
  2589.         if (Signlink.mainapp != null) {
  2590.             return Signlink.mainapp.getAppletContext();
  2591.         } else {
  2592.             return super.getAppletContext();
  2593.         }
  2594.     }
  2595.  
  2596.     public void drawLogo() {
  2597.         byte abyte0[] = titleStreamLoader.getDataForName("title.dat");
  2598.         Sprite sprite = new Sprite(abyte0, this);
  2599.         aRSImageProducer_1110.initDrawingArea();
  2600.         sprite.method346(0, 0);
  2601.         aRSImageProducer_1111.initDrawingArea();
  2602.         sprite.method346(-637, 0);
  2603.         aRSImageProducer_1107.initDrawingArea();
  2604.         sprite.method346(-128, 0);
  2605.         aRSImageProducer_1108.initDrawingArea();
  2606.         sprite.method346(-202, -371);
  2607.         aRSImageProducer_1109.initDrawingArea();
  2608.         sprite.method346(-202, -171);
  2609.         aRSImageProducer_1112.initDrawingArea();
  2610.         sprite.method346(0, -265);
  2611.         aRSImageProducer_1113.initDrawingArea();
  2612.         sprite.method346(-562, -265);
  2613.         aRSImageProducer_1114.initDrawingArea();
  2614.         sprite.method346(-128, -171);
  2615.         aRSImageProducer_1115.initDrawingArea();
  2616.         sprite.method346(-562, -171);
  2617.         int ai[] = new int[sprite.width];
  2618.         for (int j = 0; j < sprite.height; j++) {
  2619.             for (int k = 0; k < sprite.width; k++) {
  2620.                 ai[k] = sprite.pixels[sprite.width - k - 1 + sprite.width * j];
  2621.             }
  2622.  
  2623.             System.arraycopy(ai, 0, sprite.pixels, sprite.width * j, sprite.width);
  2624.  
  2625.         }
  2626.  
  2627.         aRSImageProducer_1110.initDrawingArea();
  2628.         sprite.method346(382, 0);
  2629.         aRSImageProducer_1111.initDrawingArea();
  2630.         sprite.method346(-255, 0);
  2631.         aRSImageProducer_1107.initDrawingArea();
  2632.         sprite.method346(254, 0);
  2633.         aRSImageProducer_1108.initDrawingArea();
  2634.         sprite.method346(180, -371);
  2635.         aRSImageProducer_1109.initDrawingArea();
  2636.         sprite.method346(180, -171);
  2637.         aRSImageProducer_1112.initDrawingArea();
  2638.         sprite.method346(382, -265);
  2639.         aRSImageProducer_1113.initDrawingArea();
  2640.         sprite.method346(-180, -265);
  2641.         aRSImageProducer_1114.initDrawingArea();
  2642.         sprite.method346(254, -171);
  2643.         aRSImageProducer_1115.initDrawingArea();
  2644.         sprite.method346(-180, -171);
  2645.         sprite = new Sprite(titleStreamLoader, "logo", 0);
  2646.         aRSImageProducer_1107.initDrawingArea();
  2647.         sprite.drawSprite(382 - sprite.width / 2 - 128, 18);
  2648.         sprite = null;
  2649.         System.gc();
  2650.  
  2651.     }
  2652.  
  2653.     public void processOnDemandQueue() {
  2654.         do {
  2655.             OnDemandData onDemandData;
  2656.             do {
  2657.                 onDemandData = onDemandFetcher.getNextNode();
  2658.                 if (onDemandData == null) {
  2659.                     return;
  2660.                 }
  2661.                 if (onDemandData.dataType == 0) {
  2662.                     Model.method460(onDemandData.buffer, onDemandData.ID);
  2663.                     if ((onDemandFetcher.getModelIndex(onDemandData.ID) & 0x62) != 0) {
  2664.                         needDrawTabArea = true;
  2665.                         if (backDialogID != -1) {
  2666.                             inputTaken = true;
  2667.                         }
  2668.                     }
  2669.                 }
  2670.                 if (onDemandData.dataType == 1 && onDemandData.buffer != null) {
  2671.                     Class36.method529(onDemandData.buffer);
  2672.                 }
  2673.                 if (onDemandData.dataType == 2 && onDemandData.ID == nextSong && onDemandData.buffer != null) {
  2674.                     musicData = new byte[onDemandData.buffer.length];
  2675.                     System.arraycopy(onDemandData.buffer, 0, musicData, 0, musicData.length);
  2676.                     fetchMusic = true;
  2677.                 }
  2678.                 if (onDemandData.dataType == 3 && loadingStage == 1) {
  2679.                     for (int i = 0; i < aByteArrayArray1183.length; i++) {
  2680.                         if (anIntArray1235[i] == onDemandData.ID) {
  2681.                             aByteArrayArray1183[i] = onDemandData.buffer;
  2682.                             if (onDemandData.buffer == null) {
  2683.                                 anIntArray1235[i] = -1;
  2684.                             }
  2685.                             break;
  2686.                         }
  2687.                         if (anIntArray1236[i] != onDemandData.ID) {
  2688.                             continue;
  2689.                         }
  2690.                         aByteArrayArray1247[i] = onDemandData.buffer;
  2691.                         if (onDemandData.buffer == null) {
  2692.                             anIntArray1236[i] = -1;
  2693.                         }
  2694.                         break;
  2695.                     }
  2696.  
  2697.                 }
  2698.             } while (onDemandData.dataType != 93 || !onDemandFetcher.method564(onDemandData.ID));
  2699.             ObjectManager.method173(new Stream(onDemandData.buffer), onDemandFetcher);
  2700.         } while (true);
  2701.     }
  2702.  
  2703.     public void calcFlamesPosition() {
  2704.         char c = '\u0100';
  2705.         for (int j = 10; j < 117; j++) {
  2706.             int k = (int) (Math.random() * 100D);
  2707.             if (k < 50) {
  2708.                 anIntArray828[j + (c - 2 << 7)] = 255;
  2709.             }
  2710.         }
  2711.         for (int l = 0; l < 100; l++) {
  2712.             int i1 = (int) (Math.random() * 124D) + 2;
  2713.             int k1 = (int) (Math.random() * 128D) + 128;
  2714.             int k2 = i1 + (k1 << 7);
  2715.             anIntArray828[k2] = 192;
  2716.         }
  2717.  
  2718.         for (int j1 = 1; j1 < c - 1; j1++) {
  2719.             for (int l1 = 1; l1 < 127; l1++) {
  2720.                 int l2 = l1 + (j1 << 7);
  2721.                 anIntArray829[l2] = (anIntArray828[l2 - 1] + anIntArray828[l2 + 1] + anIntArray828[l2 - 128] + anIntArray828[l2 + 128]) / 4;
  2722.             }
  2723.  
  2724.         }
  2725.  
  2726.         anInt1275 += 128;
  2727.         if (anInt1275 > anIntArray1190.length) {
  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.             for (int i3 = 1; i3 < 127; i3++) {
  2734.                 int k3 = i3 + (j2 << 7);
  2735.                 int i4 = anIntArray829[k3 + 128] - anIntArray1190[k3 + anInt1275 & anIntArray1190.length - 1] / 5;
  2736.                 if (i4 < 0) {
  2737.                     i4 = 0;
  2738.                 }
  2739.                 anIntArray828[k3] = i4;
  2740.             }
  2741.  
  2742.         }
  2743.  
  2744.         System.arraycopy(anIntArray969, 1, anIntArray969, 0, c - 1);
  2745.  
  2746.         anIntArray969[c - 1] = (int) (Math.sin((double) loopCycle / 14D) * 16D + Math.sin((double) loopCycle / 15D) * 14D + Math.sin((double) loopCycle / 16D) * 12D);
  2747.         if (anInt1040 > 0) {
  2748.             anInt1040 -= 4;
  2749.         }
  2750.         if (anInt1041 > 0) {
  2751.             anInt1041 -= 4;
  2752.         }
  2753.         if (anInt1040 == 0 && anInt1041 == 0) {
  2754.             int l3 = (int) (Math.random() * 2000D);
  2755.             if (l3 == 0) {
  2756.                 anInt1040 = 1024;
  2757.             }
  2758.             if (l3 == 1) {
  2759.                 anInt1041 = 1024;
  2760.             }
  2761.         }
  2762.     }
  2763.  
  2764.     public boolean saveWave(byte abyte0[], int i) {
  2765.         return abyte0 == null || Signlink.wavesave(abyte0, i);
  2766.     }
  2767.  
  2768.     public void method60(int i) {
  2769.         RSInterface class9 = RSInterface.interfaceCache[i];
  2770.         for (int element : class9.children) {
  2771.             if (element == -1) {
  2772.                 break;
  2773.             }
  2774.             RSInterface class9_1 = RSInterface.interfaceCache[element];
  2775.             if (class9_1.type == 1) {
  2776.                 method60(class9_1.id);
  2777.             }
  2778.             class9_1.anInt246 = 0;
  2779.             class9_1.anInt208 = 0;
  2780.         }
  2781.     }
  2782.  
  2783.     public void drawHeadIcon() {
  2784.         if (anInt855 != 2) {
  2785.             return;
  2786.         }
  2787.         calcEntityScreenPos((anInt934 - baseX << 7) + anInt937, anInt936 * 2, (anInt935 - baseY << 7) + anInt938);
  2788.         if (spriteDrawX > -1 && loopCycle % 20 < 10) {
  2789.             headIconsHint[0].drawSprite(spriteDrawX - 12, spriteDrawY - 28);
  2790.         }
  2791.     }
  2792.  
  2793.     public void mainGameProcessor() {
  2794.         if (anInt1104 > 1) {
  2795.             anInt1104--;
  2796.         }
  2797.         if (anInt1011 > 0) {
  2798.             anInt1011--;
  2799.         }
  2800.         for (int j = 0; j < 5; j++) {
  2801.             if (!parsePacket()) {
  2802.                 break;
  2803.             }
  2804.         }
  2805.  
  2806.         if (!loggedIn) {
  2807.             return;
  2808.         }
  2809.         synchronized (mouseDetection.syncObject) {
  2810.             if (flagged) {
  2811.                 if (super.clickMode3 != 0 || mouseDetection.coordsIndex >= 40) {
  2812.                     stream.createFrame(45);
  2813.                     stream.writeWordBigEndian(0);
  2814.                     int j2 = stream.currentOffset;
  2815.                     int j3 = 0;
  2816.                     for (int j4 = 0; j4 < mouseDetection.coordsIndex; j4++) {
  2817.                         if (j2 - stream.currentOffset >= 240) {
  2818.                             break;
  2819.                         }
  2820.                         j3++;
  2821.                         int l4 = mouseDetection.coordsY[j4];
  2822.                         if (l4 < 0) {
  2823.                             l4 = 0;
  2824.                         } else if (l4 > 502) {
  2825.                             l4 = 502;
  2826.                         }
  2827.                         int k5 = mouseDetection.coordsX[j4];
  2828.                         if (k5 < 0) {
  2829.                             k5 = 0;
  2830.                         } else if (k5 > 764) {
  2831.                             k5 = 764;
  2832.                         }
  2833.                         int i6 = l4 * 765 + k5;
  2834.                         if (mouseDetection.coordsY[j4] == -1 && mouseDetection.coordsX[j4] == -1) {
  2835.                             k5 = -1;
  2836.                             l4 = -1;
  2837.                             i6 = 0x7ffff;
  2838.                         }
  2839.                         if (k5 == anInt1237 && l4 == anInt1238) {
  2840.                             if (anInt1022 < 2047) {
  2841.                                 anInt1022++;
  2842.                             }
  2843.                         } else {
  2844.                             int j6 = k5 - anInt1237;
  2845.                             anInt1237 = k5;
  2846.                             int k6 = l4 - anInt1238;
  2847.                             anInt1238 = l4;
  2848.                             if (anInt1022 < 8 && j6 >= -32 && j6 <= 31 && k6 >= -32 && k6 <= 31) {
  2849.                                 j6 += 32;
  2850.                                 k6 += 32;
  2851.                                 stream.writeWord((anInt1022 << 12) + (j6 << 6) + k6);
  2852.                                 anInt1022 = 0;
  2853.                             } else if (anInt1022 < 8) {
  2854.                                 stream.writeDWordBigEndian(0x800000 + (anInt1022 << 19) + i6);
  2855.                                 anInt1022 = 0;
  2856.                             } else {
  2857.                                 stream.writeDWord(0xc0000000 + (anInt1022 << 19) + i6);
  2858.                                 anInt1022 = 0;
  2859.                             }
  2860.                         }
  2861.                     }
  2862.  
  2863.                     stream.writeBytes(stream.currentOffset - j2);
  2864.                     if (j3 >= mouseDetection.coordsIndex) {
  2865.                         mouseDetection.coordsIndex = 0;
  2866.                     } else {
  2867.                         mouseDetection.coordsIndex -= j3;
  2868.                         for (int i5 = 0; i5 < mouseDetection.coordsIndex; i5++) {
  2869.                             mouseDetection.coordsX[i5] = mouseDetection.coordsX[i5 + j3];
  2870.                             mouseDetection.coordsY[i5] = mouseDetection.coordsY[i5 + j3];
  2871.                         }
  2872.  
  2873.                     }
  2874.                 }
  2875.             } else {
  2876.                 mouseDetection.coordsIndex = 0;
  2877.             }
  2878.         }
  2879.         if (super.clickMode3 != 0) {
  2880.             long l = (super.aLong29 - aLong1220) / 50L;
  2881.             if (l > 4095L) {
  2882.                 l = 4095L;
  2883.             }
  2884.             aLong1220 = super.aLong29;
  2885.             int k2 = super.saveClickY;
  2886.             if (k2 < 0) {
  2887.                 k2 = 0;
  2888.             } else if (k2 > 502) {
  2889.                 k2 = 502;
  2890.             }
  2891.             int k3 = super.saveClickX;
  2892.             if (k3 < 0) {
  2893.                 k3 = 0;
  2894.             } else if (k3 > 764) {
  2895.                 k3 = 764;
  2896.             }
  2897.             int k4 = k2 * 765 + k3;
  2898.             int j5 = 0;
  2899.             if (super.clickMode3 == 2) {
  2900.                 j5 = 1;
  2901.             }
  2902.             int l5 = (int) l;
  2903.             stream.createFrame(241);
  2904.             stream.writeDWord((l5 << 20) + (j5 << 19) + k4);
  2905.         }
  2906.         if (anInt1016 > 0) {
  2907.             anInt1016--;
  2908.         }
  2909.         if (super.keyArray[1] == 1 || super.keyArray[2] == 1 || super.keyArray[3] == 1 || super.keyArray[4] == 1) {
  2910.             aBoolean1017 = true;
  2911.         }
  2912.         if (aBoolean1017 && anInt1016 <= 0) {
  2913.             anInt1016 = 20;
  2914.             aBoolean1017 = false;
  2915.             stream.createFrame(86);
  2916.             stream.writeWord(anInt1184);
  2917.             stream.method432(minimapInt1);
  2918.         }
  2919.         if (super.awtFocus && !aBoolean954) {
  2920.             aBoolean954 = true;
  2921.             stream.createFrame(3);
  2922.             stream.writeWordBigEndian(1);
  2923.         }
  2924.         if (!super.awtFocus && aBoolean954) {
  2925.             aBoolean954 = false;
  2926.             stream.createFrame(3);
  2927.             stream.writeWordBigEndian(0);
  2928.         }
  2929.         loadingStages();
  2930.         method115();
  2931.         method90();
  2932.         anInt1009++;
  2933.         if (anInt1009 > 750) {
  2934.             dropClient();
  2935.         }
  2936.         method114();
  2937.         method95();
  2938.         method38();
  2939.         anInt945++;
  2940.         if (crossType != 0) {
  2941.             crossIndex += 20;
  2942.             if (crossIndex >= 400) {
  2943.                 crossType = 0;
  2944.             }
  2945.         }
  2946.         if (atInventoryInterfaceType != 0) {
  2947.             atInventoryLoopCycle++;
  2948.             if (atInventoryLoopCycle >= 15) {
  2949.                 if (atInventoryInterfaceType == 2) {
  2950.                     needDrawTabArea = true;
  2951.                 }
  2952.                 if (atInventoryInterfaceType == 3) {
  2953.                     inputTaken = true;
  2954.                 }
  2955.                 atInventoryInterfaceType = 0;
  2956.             }
  2957.         }
  2958.         if (activeInterfaceType != 0) {
  2959.             anInt989++;
  2960.             if (super.mouseX > anInt1087 + 5 || super.mouseX < anInt1087 - 5 || super.mouseY > anInt1088 + 5 || super.mouseY < anInt1088 - 5) {
  2961.                 aBoolean1242 = true;
  2962.             }
  2963.             if (super.clickMode2 == 0) {
  2964.                 if (activeInterfaceType == 2) {
  2965.                     needDrawTabArea = true;
  2966.                 }
  2967.                 if (activeInterfaceType == 3) {
  2968.                     inputTaken = true;
  2969.                 }
  2970.                 activeInterfaceType = 0;
  2971.                 if (aBoolean1242 && anInt989 >= 5) {
  2972.                     lastActiveInvInterface = -1;
  2973.                     processRightClick();
  2974.                     if (lastActiveInvInterface == anInt1084 && mouseInvInterfaceIndex != anInt1085) {
  2975.                         RSInterface class9 = RSInterface.interfaceCache[anInt1084];
  2976.                         int j1 = 0;
  2977.                         if (anInt913 == 1 && class9.anInt214 == 206) {
  2978.                             j1 = 1;
  2979.                         }
  2980.                         if (class9.inv[mouseInvInterfaceIndex] <= 0) {
  2981.                             j1 = 0;
  2982.                         }
  2983.                         if (class9.aBoolean235) {
  2984.                             int l2 = anInt1085;
  2985.                             int l3 = mouseInvInterfaceIndex;
  2986.                             class9.inv[l3] = class9.inv[l2];
  2987.                             class9.invStackSizes[l3] = class9.invStackSizes[l2];
  2988.                             class9.inv[l2] = -1;
  2989.                             class9.invStackSizes[l2] = 0;
  2990.                         } else if (j1 == 1) {
  2991.                             int i3 = anInt1085;
  2992.                             for (int i4 = mouseInvInterfaceIndex; i3 != i4;) {
  2993.                                 if (i3 > i4) {
  2994.                                     class9.swapInventoryItems(i3, i3 - 1);
  2995.                                     i3--;
  2996.                                 } else if (i3 < i4) {
  2997.                                     class9.swapInventoryItems(i3, i3 + 1);
  2998.                                     i3++;
  2999.                                 }
  3000.                             }
  3001.  
  3002.                         } else {
  3003.                             class9.swapInventoryItems(anInt1085, mouseInvInterfaceIndex);
  3004.                         }
  3005.                         stream.createFrame(214);
  3006.                         stream.method433(anInt1084);
  3007.                         stream.method424(j1);
  3008.                         stream.method433(anInt1085);
  3009.                         stream.method431(mouseInvInterfaceIndex);
  3010.                     }
  3011.                 } else if ((anInt1253 == 1 || menuHasAddFriend(menuActionRow - 1)) && menuActionRow > 2) {
  3012.                     determineMenuSize();
  3013.                 } else if (menuActionRow > 0) {
  3014.                     doAction(menuActionRow - 1);
  3015.                 }
  3016.                 atInventoryLoopCycle = 10;
  3017.                 super.clickMode3 = 0;
  3018.             }
  3019.         }
  3020.         if (WorldController.anInt470 != -1) {
  3021.             int k = WorldController.anInt470;
  3022.             int k1 = WorldController.anInt471;
  3023.             boolean flag = doWalkTo(0, 0, 0, 0, myPlayer.smallY[0], 0, 0, k1, myPlayer.smallX[0], true, k);
  3024.             WorldController.anInt470 = -1;
  3025.             if (flag) {
  3026.                 crossX = super.saveClickX;
  3027.                 crossY = super.saveClickY;
  3028.                 crossType = 1;
  3029.                 crossIndex = 0;
  3030.             }
  3031.         }
  3032.         if (super.clickMode3 == 1 && aString844 != null) {
  3033.             aString844 = null;
  3034.             inputTaken = true;
  3035.             super.clickMode3 = 0;
  3036.         }
  3037.         processMenuClick();
  3038.         if (fullScreenBackDialogID == -1) {
  3039.             processMainScreenClick();
  3040.             processTabClick();
  3041.             processChatModeClick();
  3042.         }
  3043.         if (super.clickMode2 == 1 || super.clickMode3 == 1) {
  3044.             anInt1213++;
  3045.         }
  3046.         if (loadingStage == 2) {
  3047.             method108();
  3048.         }
  3049.         if (loadingStage == 2 && aBoolean1160) {
  3050.             calcCameraPos();
  3051.         }
  3052.         for (int i1 = 0; i1 < 5; i1++) {
  3053.             anIntArray1030[i1]++;
  3054.         }
  3055.  
  3056.         method73();
  3057.         super.idleTime++;
  3058.         if (super.idleTime > 12000) {
  3059.             anInt1011 = 250;
  3060.             super.idleTime -= 500;
  3061.             stream.createFrame(202);
  3062.         }
  3063.         anInt988++;
  3064.         if (anInt988 > 500) {
  3065.             anInt988 = 0;
  3066.             int l1 = (int) (Math.random() * 8D);
  3067.             if ((l1 & 1) == 1) {
  3068.                 anInt1278 += anInt1279;
  3069.             }
  3070.             if ((l1 & 2) == 2) {
  3071.                 anInt1131 += anInt1132;
  3072.             }
  3073.             if ((l1 & 4) == 4) {
  3074.                 anInt896 += anInt897;
  3075.             }
  3076.         }
  3077.         if (anInt1278 < -50) {
  3078.             anInt1279 = 2;
  3079.         }
  3080.         if (anInt1278 > 50) {
  3081.             anInt1279 = -2;
  3082.         }
  3083.         if (anInt1131 < -55) {
  3084.             anInt1132 = 2;
  3085.         }
  3086.         if (anInt1131 > 55) {
  3087.             anInt1132 = -2;
  3088.         }
  3089.         if (anInt896 < -40) {
  3090.             anInt897 = 1;
  3091.         }
  3092.         if (anInt896 > 40) {
  3093.             anInt897 = -1;
  3094.         }
  3095.         anInt1254++;
  3096.         if (anInt1254 > 500) {
  3097.             anInt1254 = 0;
  3098.             int i2 = (int) (Math.random() * 8D);
  3099.             if ((i2 & 1) == 1) {
  3100.                 minimapInt2 += anInt1210;
  3101.             }
  3102.             if ((i2 & 2) == 2) {
  3103.                 minimapInt3 += anInt1171;
  3104.             }
  3105.         }
  3106.         if (minimapInt2 < -60) {
  3107.             anInt1210 = 2;
  3108.         }
  3109.         if (minimapInt2 > 60) {
  3110.             anInt1210 = -2;
  3111.         }
  3112.         if (minimapInt3 < -20) {
  3113.             anInt1171 = 1;
  3114.         }
  3115.         if (minimapInt3 > 10) {
  3116.             anInt1171 = -1;
  3117.         }
  3118.         anInt1010++;
  3119.         if (anInt1010 > 50) {
  3120.             stream.createFrame(0);
  3121.         }
  3122.         try {
  3123.             if (socketStream != null && stream.currentOffset > 0) {
  3124.                 socketStream.queueBytes(stream.currentOffset, stream.buffer);
  3125.                 stream.currentOffset = 0;
  3126.                 anInt1010 = 0;
  3127.             }
  3128.         } catch (IOException _ex) {
  3129.             dropClient();
  3130.         } catch (Exception exception) {
  3131.             resetLogout();
  3132.         }
  3133.     }
  3134.  
  3135.     public void method63() {
  3136.         Class30_Sub1 class30_sub1 = (Class30_Sub1) aClass19_1179.reverseGetFirst();
  3137.         for (; class30_sub1 != null; class30_sub1 = (Class30_Sub1) aClass19_1179.reverseGetNext()) {
  3138.             if (class30_sub1.anInt1294 == -1) {
  3139.                 class30_sub1.anInt1302 = 0;
  3140.                 method89(class30_sub1);
  3141.             } else {
  3142.                 class30_sub1.unlink();
  3143.             }
  3144.         }
  3145.  
  3146.     }
  3147.  
  3148.     void drawLoadingText(int i, String s) {
  3149.         anInt1079 = i;
  3150.         aString1049 = s;
  3151.         resetImageProducers();
  3152.         if (titleStreamLoader == null) {
  3153.             super.drawLoadingText(i, s);
  3154.             return;
  3155.         }
  3156.         aRSImageProducer_1109.initDrawingArea();
  3157.         char c = '\u0168';
  3158.         char c1 = '\310';
  3159.         byte byte1 = 20;
  3160.         chatTextDrawingArea.drawText(0xffffff, "" + ClientSettings.SERVER_NAME + " is loading - please wait...", c1 / 2 - 26 - byte1, c / 2);
  3161.         int j = c1 / 2 - 18 - byte1;
  3162.         DrawingArea.fillPixels(j, 34, 0x8c1111, c / 2 - 152, 304);
  3163.         DrawingArea.fillPixels(j + 1, 32, 0, c / 2 - 151, 302);
  3164.         DrawingArea.method336(30, j + 2, 0x8c1111, i * 3, c / 2 - 150);
  3165.         DrawingArea.method336(30, j + 2, 0, 300 - i * 3, c / 2 - 150 + i * 3);
  3166.         chatTextDrawingArea.drawText(0xffffff, s, c1 / 2 + 5 - byte1, c / 2);
  3167.         aRSImageProducer_1109.drawGraphics(171, super.graphics, 202);
  3168.         if (welcomeScreenRaised) {
  3169.             welcomeScreenRaised = false;
  3170.             if (!aBoolean831) {
  3171.                 aRSImageProducer_1110.drawGraphics(0, super.graphics, 0);
  3172.                 aRSImageProducer_1111.drawGraphics(0, super.graphics, 637);
  3173.             }
  3174.             aRSImageProducer_1107.drawGraphics(0, super.graphics, 128);
  3175.             aRSImageProducer_1108.drawGraphics(371, super.graphics, 202);
  3176.             aRSImageProducer_1112.drawGraphics(265, super.graphics, 0);
  3177.             aRSImageProducer_1113.drawGraphics(265, super.graphics, 562);
  3178.             aRSImageProducer_1114.drawGraphics(171, super.graphics, 128);
  3179.             aRSImageProducer_1115.drawGraphics(171, super.graphics, 562);
  3180.         }
  3181.     }
  3182.  
  3183.     public void method65(int i, int j, int k, int l, RSInterface class9, int i1, boolean flag, int j1) {
  3184.         int anInt992;
  3185.         if (aBoolean972) {
  3186.             anInt992 = 32;
  3187.         } else {
  3188.             anInt992 = 0;
  3189.         }
  3190.         aBoolean972 = false;
  3191.         if (k >= i && k < i + 16 && l >= i1 && l < i1 + 16) {
  3192.             class9.scrollPosition -= anInt1213 * 4;
  3193.             if (flag) {
  3194.                 needDrawTabArea = true;
  3195.             }
  3196.         } else if (k >= i && k < i + 16 && l >= i1 + j - 16 && l < i1 + j) {
  3197.             class9.scrollPosition += anInt1213 * 4;
  3198.             if (flag) {
  3199.                 needDrawTabArea = true;
  3200.             }
  3201.         } else if (k >= i - anInt992 && k < i + 16 + anInt992 && l >= i1 + 16 && l < i1 + j - 16 && anInt1213 > 0) {
  3202.             int l1 = (j - 32) * j / j1;
  3203.             if (l1 < 8) {
  3204.                 l1 = 8;
  3205.             }
  3206.             int i2 = l - i1 - 16 - l1 / 2;
  3207.             int j2 = j - 32 - l1;
  3208.             class9.scrollPosition = (j1 - j) * i2 / j2;
  3209.             if (flag) {
  3210.                 needDrawTabArea = true;
  3211.             }
  3212.             aBoolean972 = true;
  3213.         }
  3214.     }
  3215.  
  3216.     public boolean method66(int i, int j, int k) {
  3217.         int i1 = i >> 14 & 0x7fff;
  3218.         int j1 = worldController.method304(plane, k, j, i);
  3219.         if (j1 == -1) {
  3220.             return false;
  3221.         }
  3222.         int k1 = j1 & 0x1f;
  3223.         int l1 = j1 >> 6 & 3;
  3224.         if (k1 == 10 || k1 == 11 || k1 == 22) {
  3225.             ObjectDef class46 = ObjectDef.forID(i1);
  3226.             int i2;
  3227.             int j2;
  3228.             if (l1 == 0 || l1 == 2) {
  3229.                 i2 = class46.anInt744;
  3230.                 j2 = class46.anInt761;
  3231.             } else {
  3232.                 i2 = class46.anInt761;
  3233.                 j2 = class46.anInt744;
  3234.             }
  3235.             int k2 = class46.anInt768;
  3236.             if (l1 != 0) {
  3237.                 k2 = (k2 << l1 & 0xf) + (k2 >> 4 - l1);
  3238.             }
  3239.             doWalkTo(2, 0, j2, 0, myPlayer.smallY[0], i2, k2, j, myPlayer.smallX[0], false, k);
  3240.         } else {
  3241.             doWalkTo(2, l1, 0, k1 + 1, myPlayer.smallY[0], 0, 0, j, myPlayer.smallX[0], false, k);
  3242.         }
  3243.         crossX = super.saveClickX;
  3244.         crossY = super.saveClickY;
  3245.         crossType = 2;
  3246.         crossIndex = 0;
  3247.         return true;
  3248.     }
  3249.  
  3250.     public StreamLoader streamLoaderForName(int i, String s, String s1, int j, int k) {
  3251.         byte abyte0[] = null;
  3252.         int l = 5;
  3253.         try {
  3254.             if (decompressors[0] != null) {
  3255.                 abyte0 = decompressors[0].decompress(i);
  3256.             }
  3257.         } catch (Exception _ex) {
  3258.         }
  3259.         if (abyte0 != null) {
  3260.             // aCRC32_930.reset();
  3261.             // aCRC32_930.update(abyte0);
  3262.             // int i1 = (int)aCRC32_930.getValue();
  3263.             // if(i1 != j)
  3264.         }
  3265.         if (abyte0 != null) {
  3266.             StreamLoader streamLoader = new StreamLoader(abyte0);
  3267.             return streamLoader;
  3268.         }
  3269.         int j1 = 0;
  3270.         while (abyte0 == null) {
  3271.             String s2 = "Unknown error";
  3272.             drawLoadingText(k, "Requesting " + s);
  3273.             try {
  3274.                 int k1 = 0;
  3275.                 DataInputStream datainputstream = openJagGrabInputStream(s1 + j);
  3276.                 byte abyte1[] = new byte[6];
  3277.                 datainputstream.readFully(abyte1, 0, 6);
  3278.                 Stream stream = new Stream(abyte1);
  3279.                 stream.currentOffset = 3;
  3280.                 int i2 = stream.read3Bytes() + 6;
  3281.                 int j2 = 6;
  3282.                 abyte0 = new byte[i2];
  3283.                 System.arraycopy(abyte1, 0, abyte0, 0, 6);
  3284.  
  3285.                 while (j2 < i2) {
  3286.                     int l2 = i2 - j2;
  3287.                     if (l2 > 1000) {
  3288.                         l2 = 1000;
  3289.                     }
  3290.                     int j3 = datainputstream.read(abyte0, j2, l2);
  3291.                     if (j3 < 0) {
  3292.                         s2 = "Length error: " + j2 + "/" + i2;
  3293.                         throw new IOException("EOF");
  3294.                     }
  3295.                     j2 += j3;
  3296.                     int k3 = j2 * 100 / i2;
  3297.                     if (k3 != k1) {
  3298.                         drawLoadingText(k, "Loading " + s + " - " + k3 + "%");
  3299.                     }
  3300.                     k1 = k3;
  3301.                 }
  3302.                 datainputstream.close();
  3303.                 try {
  3304.                     if (decompressors[0] != null) {
  3305.                         decompressors[0].method234(abyte0.length, abyte0, i);
  3306.                     }
  3307.                 } catch (Exception _ex) {
  3308.                     decompressors[0] = null;
  3309.                 }
  3310.                 /*
  3311.                  * if(abyte0 != null) { aCRC32_930.reset();
  3312.                  * aCRC32_930.update(abyte0); int i3 =
  3313.                  * (int)aCRC32_930.getValue(); if(i3 != j) { abyte0 = null;
  3314.                  * j1++; s2 = "Checksum error: " + i3; } }
  3315.                  */
  3316.             } catch (IOException ioexception) {
  3317.                 if (s2.equals("Unknown error")) {
  3318.                     s2 = "Connection error";
  3319.                 }
  3320.                 abyte0 = null;
  3321.             } catch (NullPointerException _ex) {
  3322.                 s2 = "Null error";
  3323.                 abyte0 = null;
  3324.                 if (!Signlink.reporterror) {
  3325.                     return null;
  3326.                 }
  3327.             } catch (ArrayIndexOutOfBoundsException _ex) {
  3328.                 s2 = "Bounds error";
  3329.                 abyte0 = null;
  3330.                 if (!Signlink.reporterror) {
  3331.                     return null;
  3332.                 }
  3333.             } catch (Exception _ex) {
  3334.                 s2 = "Unexpected error";
  3335.                 abyte0 = null;
  3336.                 if (!Signlink.reporterror) {
  3337.                     return null;
  3338.                 }
  3339.             }
  3340.             if (abyte0 == null) {
  3341.                 for (int l1 = l; l1 > 0; l1--) {
  3342.                     if (j1 >= 3) {
  3343.                         drawLoadingText(k, "Game updated - please reload page");
  3344.                         l1 = 10;
  3345.                     } else {
  3346.                         drawLoadingText(k, s2 + " - Retrying in " + l1);
  3347.                     }
  3348.                     try {
  3349.                         Thread.sleep(1000L);
  3350.                     } catch (Exception _ex) {
  3351.                     }
  3352.                 }
  3353.  
  3354.                 l *= 2;
  3355.                 if (l > 60) {
  3356.                     l = 60;
  3357.                 }
  3358.                 aBoolean872 = !aBoolean872;
  3359.             }
  3360.  
  3361.         }
  3362.  
  3363.         StreamLoader streamLoader_1 = new StreamLoader(abyte0);
  3364.         return streamLoader_1;
  3365.     }
  3366.  
  3367.     public void dropClient() {
  3368.         if (anInt1011 > 0) {
  3369.             resetLogout();
  3370.             return;
  3371.         }
  3372.         drawTextOnScreen("Please wait - attempting to reestablish", "Connection lost");
  3373.         anInt1021 = 0;
  3374.         destX = 0;
  3375.         RSSocket rsSocket = socketStream;
  3376.         loggedIn = false;
  3377.         loginFailures = 0;
  3378.         login(myUsername, myPassword, true);
  3379.         if (!loggedIn) {
  3380.             resetLogout();
  3381.         }
  3382.         try {
  3383.             rsSocket.close();
  3384.         } catch (Exception _ex) {
  3385.         }
  3386.     }
  3387.    
  3388.     public void drawTextOnScreen(String s, String s1) {
  3389.         if (aRSImageProducer_1165 != null) {
  3390.             aRSImageProducer_1165.initDrawingArea();
  3391.             Texture.lineOffsets = chatBoxAreaOffsets;
  3392.             int j = 151;
  3393.             if (s != null)
  3394.                 j -= 7;
  3395.             aTextDrawingArea_1271.drawText(0, s1, j, 257);
  3396.             aTextDrawingArea_1271.drawText(0xffffff, s1, j - 1, 256);
  3397.             j += 15;
  3398.             if (s != null) {
  3399.                 aTextDrawingArea_1271.drawText(0, s, j, 257);
  3400.                 aTextDrawingArea_1271.drawText(0xffffff, s, j - 1, 256);
  3401.             }
  3402.             aRSImageProducer_1165.drawGraphics(4, super.graphics, 4);
  3403.             return;
  3404.         }
  3405.         if (super.fullGameScreen != null) {
  3406.             super.fullGameScreen.initDrawingArea();
  3407.             Texture.lineOffsets = gameScreenOffsets;
  3408.             int k = 251;
  3409.             char c = '\u012C';
  3410.             byte byte0 = 50;
  3411.             DrawingArea.method336(byte0, k - 5 - byte0 / 2, 0, c, 383 - c / 2);
  3412.             DrawingArea.fillPixels(k - 5 - byte0 / 2, byte0, 0xffffff, 383 - c / 2, c);
  3413.             if (s != null)
  3414.                 k -= 7;
  3415.             aTextDrawingArea_1271.drawText(0, s1, k, 383);
  3416.             aTextDrawingArea_1271.drawText(0xffffff, s1, k - 1, 382);
  3417.             k += 15;
  3418.             if (s != null) {
  3419.                 aTextDrawingArea_1271.drawText(0, s, k, 383);
  3420.                 aTextDrawingArea_1271.drawText(0xffffff, s, k - 1, 382);
  3421.             }
  3422.             super.fullGameScreen.drawGraphics(0, super.graphics, 0);
  3423.         }
  3424.     }
  3425.  
  3426.     public void doAction(int i) {
  3427.         if (i < 0) {
  3428.             return;
  3429.         }
  3430.         if (inputDialogState != 0) {
  3431.             inputDialogState = 0;
  3432.             inputTaken = true;
  3433.         }
  3434.         int j = menuActionCmd2[i];
  3435.         int k = menuActionCmd3[i];
  3436.         int l = menuActionID[i];
  3437.         int i1 = menuActionCmd1[i];
  3438.         if (l >= 2000) {
  3439.             l -= 2000;
  3440.         }
  3441.         if (l == 582) {
  3442.             NPC npc = npcArray[i1];
  3443.             if (npc != null) {
  3444.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, npc.smallY[0], myPlayer.smallX[0], false, npc.smallX[0]);
  3445.                 crossX = super.saveClickX;
  3446.                 crossY = super.saveClickY;
  3447.                 crossType = 2;
  3448.                 crossIndex = 0;
  3449.                 stream.createFrame(57);
  3450.                 stream.method432(anInt1285);
  3451.                 stream.method432(i1);
  3452.                 stream.method431(anInt1283);
  3453.                 stream.method432(anInt1284);
  3454.             }
  3455.         }
  3456.         if (l == 234) {
  3457.             boolean flag1 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k, myPlayer.smallX[0], false, j);
  3458.             if (!flag1) {
  3459.                 flag1 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k, myPlayer.smallX[0], false, j);
  3460.             }
  3461.             crossX = super.saveClickX;
  3462.             crossY = super.saveClickY;
  3463.             crossType = 2;
  3464.             crossIndex = 0;
  3465.             stream.createFrame(236);
  3466.             stream.method431(k + baseY);
  3467.             stream.writeWord(i1);
  3468.             stream.method431(j + baseX);
  3469.         }
  3470.         if (l == 62 && method66(i1, k, j)) {
  3471.             stream.createFrame(192);
  3472.             stream.writeWord(anInt1284);
  3473.             stream.method431(i1 >> 14 & 0x7fff);
  3474.             stream.method433(k + baseY);
  3475.             stream.method431(anInt1283);
  3476.             stream.method433(j + baseX);
  3477.             stream.writeWord(anInt1285);
  3478.         }
  3479.         if (l == 511) {
  3480.             boolean flag2 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k, myPlayer.smallX[0], false, j);
  3481.             if (!flag2) {
  3482.                 flag2 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k, myPlayer.smallX[0], false, j);
  3483.             }
  3484.             crossX = super.saveClickX;
  3485.             crossY = super.saveClickY;
  3486.             crossType = 2;
  3487.             crossIndex = 0;
  3488.             stream.createFrame(25);
  3489.             stream.method431(anInt1284);
  3490.             stream.method432(anInt1285);
  3491.             stream.writeWord(i1);
  3492.             stream.method432(k + baseY);
  3493.             stream.method433(anInt1283);
  3494.             stream.writeWord(j + baseX);
  3495.         }
  3496.         if (l == 74) {
  3497.             stream.createFrame(122);
  3498.             stream.method433(k);
  3499.             stream.method432(j);
  3500.             stream.method431(i1);
  3501.             atInventoryLoopCycle = 0;
  3502.             atInventoryInterface = k;
  3503.             atInventoryIndex = j;
  3504.             atInventoryInterfaceType = 2;
  3505.             if (RSInterface.interfaceCache[k].parentID == openInterfaceID) {
  3506.                 atInventoryInterfaceType = 1;
  3507.             }
  3508.             if (RSInterface.interfaceCache[k].parentID == backDialogID) {
  3509.                 atInventoryInterfaceType = 3;
  3510.             }
  3511.         }
  3512.         if (l == 315) {
  3513.             RSInterface class9 = RSInterface.interfaceCache[k];
  3514.             boolean flag8 = true;
  3515.             if (class9.anInt214 > 0) {
  3516.                 flag8 = promptUserForInput(class9);
  3517.             }
  3518.             if (flag8) {
  3519.                 stream.createFrame(185);
  3520.                 stream.writeWord(k);
  3521.             }
  3522.         }
  3523.         if (l == 561) {
  3524.             Player player = playerArray[i1];
  3525.             if (player != null) {
  3526.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, player.smallY[0], myPlayer.smallX[0], false, player.smallX[0]);
  3527.                 crossX = super.saveClickX;
  3528.                 crossY = super.saveClickY;
  3529.                 crossType = 2;
  3530.                 crossIndex = 0;
  3531.                 anInt1188 += i1;
  3532.                 if (anInt1188 >= 90) {
  3533.                     stream.createFrame(136);
  3534.                     anInt1188 = 0;
  3535.                 }
  3536.                 stream.createFrame(128);
  3537.                 stream.writeWord(i1);
  3538.             }
  3539.         }
  3540.         if (l == 20) {
  3541.             NPC class30_sub2_sub4_sub1_sub1_1 = npcArray[i1];
  3542.             if (class30_sub2_sub4_sub1_sub1_1 != null) {
  3543.                 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]);
  3544.                 crossX = super.saveClickX;
  3545.                 crossY = super.saveClickY;
  3546.                 crossType = 2;
  3547.                 crossIndex = 0;
  3548.                 stream.createFrame(155);
  3549.                 stream.method431(i1);
  3550.             }
  3551.         }
  3552.         if (l == 779) {
  3553.             Player class30_sub2_sub4_sub1_sub2_1 = playerArray[i1];
  3554.             if (class30_sub2_sub4_sub1_sub2_1 != null) {
  3555.                 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]);
  3556.                 crossX = super.saveClickX;
  3557.                 crossY = super.saveClickY;
  3558.                 crossType = 2;
  3559.                 crossIndex = 0;
  3560.                 stream.createFrame(153);
  3561.                 stream.method431(i1);
  3562.             }
  3563.         }
  3564.         if (l == 516) {
  3565.             if (!menuOpen) {
  3566.                 worldController.method312(super.saveClickY - 4, super.saveClickX - 4);
  3567.             } else {
  3568.                 worldController.method312(k - 4, j - 4);
  3569.             }
  3570.         }
  3571.         if (l == 1062) {
  3572.             anInt924 += baseX;
  3573.             if (anInt924 >= 113) {
  3574.                 stream.createFrame(183);
  3575.                 stream.writeDWordBigEndian(0xe63271);
  3576.                 anInt924 = 0;
  3577.             }
  3578.             method66(i1, k, j);
  3579.             stream.createFrame(228);
  3580.             stream.method432(i1 >> 14 & 0x7fff);
  3581.             stream.method432(k + baseY);
  3582.             stream.writeWord(j + baseX);
  3583.         }
  3584.         if (l == 679 && !aBoolean1149) {
  3585.             stream.createFrame(40);
  3586.             stream.writeWord(k);
  3587.             aBoolean1149 = true;
  3588.         }
  3589.         if (l == 431) {
  3590.             stream.createFrame(129);
  3591.             stream.method432(j);
  3592.             stream.writeWord(k);
  3593.             stream.method432(i1);
  3594.             atInventoryLoopCycle = 0;
  3595.             atInventoryInterface = k;
  3596.             atInventoryIndex = j;
  3597.             atInventoryInterfaceType = 2;
  3598.             if (RSInterface.interfaceCache[k].parentID == openInterfaceID) {
  3599.                 atInventoryInterfaceType = 1;
  3600.             }
  3601.             if (RSInterface.interfaceCache[k].parentID == backDialogID) {
  3602.                 atInventoryInterfaceType = 3;
  3603.             }
  3604.         }
  3605.         if (l == 337 || l == 42 || l == 792 || l == 322) {
  3606.             String s = menuActionName[i];
  3607.             int k1 = s.indexOf("@whi@");
  3608.             if (k1 != -1) {
  3609.                 long l3 = TextClass.longForName(s.substring(k1 + 5).trim());
  3610.                 if (l == 337) {
  3611.                     addFriend(l3);
  3612.                 }
  3613.                 if (l == 42) {
  3614.                     addIgnore(l3);
  3615.                 }
  3616.                 if (l == 792) {
  3617.                     delFriend(l3);
  3618.                 }
  3619.                 if (l == 322) {
  3620.                     delIgnore(l3);
  3621.                 }
  3622.             }
  3623.         }
  3624.         if (l == 53) {
  3625.             stream.createFrame(135);
  3626.             stream.method431(j);
  3627.             stream.method432(k);
  3628.             stream.method431(i1);
  3629.             atInventoryLoopCycle = 0;
  3630.             atInventoryInterface = k;
  3631.             atInventoryIndex = j;
  3632.             atInventoryInterfaceType = 2;
  3633.             if (RSInterface.interfaceCache[k].parentID == openInterfaceID) {
  3634.                 atInventoryInterfaceType = 1;
  3635.             }
  3636.             if (RSInterface.interfaceCache[k].parentID == backDialogID) {
  3637.                 atInventoryInterfaceType = 3;
  3638.             }
  3639.         }
  3640.         if (l == 539) {
  3641.             stream.createFrame(16);
  3642.             stream.method432(i1);
  3643.             stream.method433(j);
  3644.             stream.method433(k);
  3645.             atInventoryLoopCycle = 0;
  3646.             atInventoryInterface = k;
  3647.             atInventoryIndex = j;
  3648.             atInventoryInterfaceType = 2;
  3649.             if (RSInterface.interfaceCache[k].parentID == openInterfaceID) {
  3650.                 atInventoryInterfaceType = 1;
  3651.             }
  3652.             if (RSInterface.interfaceCache[k].parentID == backDialogID) {
  3653.                 atInventoryInterfaceType = 3;
  3654.             }
  3655.         }
  3656.         if (l == 484 || l == 6) {
  3657.             String s1 = menuActionName[i];
  3658.             int l1 = s1.indexOf("@whi@");
  3659.             if (l1 != -1) {
  3660.                 s1 = s1.substring(l1 + 5).trim();
  3661.                 String s7 = TextClass.fixName(TextClass.nameForLong(TextClass.longForName(s1)));
  3662.                 boolean flag9 = false;
  3663.                 for (int j3 = 0; j3 < playerCount; j3++) {
  3664.                     Player class30_sub2_sub4_sub1_sub2_7 = playerArray[playerIndices[j3]];
  3665.                     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)) {
  3666.                         continue;
  3667.                     }
  3668.                     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]);
  3669.                     if (l == 484) {
  3670.                         stream.createFrame(139);
  3671.                         stream.method431(playerIndices[j3]);
  3672.                     }
  3673.                     if (l == 6) {
  3674.                         anInt1188 += i1;
  3675.                         if (anInt1188 >= 90) {
  3676.                             stream.createFrame(136);
  3677.                             anInt1188 = 0;
  3678.                         }
  3679.                         stream.createFrame(128);
  3680.                         stream.writeWord(playerIndices[j3]);
  3681.                     }
  3682.                     flag9 = true;
  3683.                     break;
  3684.                 }
  3685.  
  3686.                 if (!flag9) {
  3687.                     pushMessage("Unable to find " + s7, 0, "");
  3688.                 }
  3689.             }
  3690.         }
  3691.         if (l == 870) {
  3692.             stream.createFrame(53);
  3693.             stream.writeWord(j);
  3694.             stream.method432(anInt1283);
  3695.             stream.method433(i1);
  3696.             stream.writeWord(anInt1284);
  3697.             stream.method431(anInt1285);
  3698.             stream.writeWord(k);
  3699.             atInventoryLoopCycle = 0;
  3700.             atInventoryInterface = k;
  3701.             atInventoryIndex = j;
  3702.             atInventoryInterfaceType = 2;
  3703.             if (RSInterface.interfaceCache[k].parentID == openInterfaceID) {
  3704.                 atInventoryInterfaceType = 1;
  3705.             }
  3706.             if (RSInterface.interfaceCache[k].parentID == backDialogID) {
  3707.                 atInventoryInterfaceType = 3;
  3708.             }
  3709.         }
  3710.         if (l == 847) {
  3711.             stream.createFrame(87);
  3712.             stream.method432(i1);
  3713.             stream.writeWord(k);
  3714.             stream.method432(j);
  3715.             atInventoryLoopCycle = 0;
  3716.             atInventoryInterface = k;
  3717.             atInventoryIndex = j;
  3718.             atInventoryInterfaceType = 2;
  3719.             if (RSInterface.interfaceCache[k].parentID == openInterfaceID) {
  3720.                 atInventoryInterfaceType = 1;
  3721.             }
  3722.             if (RSInterface.interfaceCache[k].parentID == backDialogID) {
  3723.                 atInventoryInterfaceType = 3;
  3724.             }
  3725.         }
  3726.         if (l == 626) {
  3727.             RSInterface class9_1 = RSInterface.interfaceCache[k];
  3728.             spellSelected = 1;
  3729.             anInt1137 = k;
  3730.             spellUsableOn = class9_1.spellUsableOn;
  3731.             itemSelected = 0;
  3732.             needDrawTabArea = true;
  3733.             String s4 = class9_1.selectedActionName;
  3734.             if (s4.indexOf(" ") != -1) {
  3735.                 s4 = s4.substring(0, s4.indexOf(" "));
  3736.             }
  3737.             String s8 = class9_1.selectedActionName;
  3738.             if (s8.indexOf(" ") != -1) {
  3739.                 s8 = s8.substring(s8.indexOf(" ") + 1);
  3740.             }
  3741.             spellTooltip = s4 + " " + class9_1.spellName + " " + s8;
  3742.             if (spellUsableOn == 16) {
  3743.                 needDrawTabArea = true;
  3744.                 tabID = 3;
  3745.                 tabAreaAltered = true;
  3746.             }
  3747.             return;
  3748.         }
  3749.         if (l == 78) {
  3750.             stream.createFrame(117);
  3751.             stream.method433(k);
  3752.             stream.method433(i1);
  3753.             stream.method431(j);
  3754.             atInventoryLoopCycle = 0;
  3755.             atInventoryInterface = k;
  3756.             atInventoryIndex = j;
  3757.             atInventoryInterfaceType = 2;
  3758.             if (RSInterface.interfaceCache[k].parentID == openInterfaceID) {
  3759.                 atInventoryInterfaceType = 1;
  3760.             }
  3761.             if (RSInterface.interfaceCache[k].parentID == backDialogID) {
  3762.                 atInventoryInterfaceType = 3;
  3763.             }
  3764.         }
  3765.         if (l == 27) {
  3766.             Player class30_sub2_sub4_sub1_sub2_2 = playerArray[i1];
  3767.             if (class30_sub2_sub4_sub1_sub2_2 != null) {
  3768.                 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]);
  3769.                 crossX = super.saveClickX;
  3770.                 crossY = super.saveClickY;
  3771.                 crossType = 2;
  3772.                 crossIndex = 0;
  3773.                 anInt986 += i1;
  3774.                 if (anInt986 >= 54) {
  3775.                     stream.createFrame(189);
  3776.                     stream.writeWordBigEndian(234);
  3777.                     anInt986 = 0;
  3778.                 }
  3779.                 stream.createFrame(73);
  3780.                 stream.method431(i1);
  3781.             }
  3782.         }
  3783.         if (l == 213) {
  3784.             boolean flag3 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k, myPlayer.smallX[0], false, j);
  3785.             if (!flag3) {
  3786.                 flag3 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k, myPlayer.smallX[0], false, j);
  3787.             }
  3788.             crossX = super.saveClickX;
  3789.             crossY = super.saveClickY;
  3790.             crossType = 2;
  3791.             crossIndex = 0;
  3792.             stream.createFrame(79);
  3793.             stream.method431(k + baseY);
  3794.             stream.writeWord(i1);
  3795.             stream.method432(j + baseX);
  3796.         }
  3797.         if (l == 632) {
  3798.             stream.createFrame(145);
  3799.             stream.method432(k);
  3800.             stream.method432(j);
  3801.             stream.method432(i1);
  3802.             atInventoryLoopCycle = 0;
  3803.             atInventoryInterface = k;
  3804.             atInventoryIndex = j;
  3805.             atInventoryInterfaceType = 2;
  3806.             if (RSInterface.interfaceCache[k].parentID == openInterfaceID) {
  3807.                 atInventoryInterfaceType = 1;
  3808.             }
  3809.             if (RSInterface.interfaceCache[k].parentID == backDialogID) {
  3810.                 atInventoryInterfaceType = 3;
  3811.             }
  3812.         }
  3813.         if (l == 493) {
  3814.             stream.createFrame(75);
  3815.             stream.method433(k);
  3816.             stream.method431(j);
  3817.             stream.method432(i1);
  3818.             atInventoryLoopCycle = 0;
  3819.             atInventoryInterface = k;
  3820.             atInventoryIndex = j;
  3821.             atInventoryInterfaceType = 2;
  3822.             if (RSInterface.interfaceCache[k].parentID == openInterfaceID) {
  3823.                 atInventoryInterfaceType = 1;
  3824.             }
  3825.             if (RSInterface.interfaceCache[k].parentID == backDialogID) {
  3826.                 atInventoryInterfaceType = 3;
  3827.             }
  3828.         }
  3829.         if (l == 652) {
  3830.             boolean flag4 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k, myPlayer.smallX[0], false, j);
  3831.             if (!flag4) {
  3832.                 flag4 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k, myPlayer.smallX[0], false, j);
  3833.             }
  3834.             crossX = super.saveClickX;
  3835.             crossY = super.saveClickY;
  3836.             crossType = 2;
  3837.             crossIndex = 0;
  3838.             stream.createFrame(156);
  3839.             stream.method432(j + baseX);
  3840.             stream.method431(k + baseY);
  3841.             stream.method433(i1);
  3842.         }
  3843.         if (l == 94) {
  3844.             boolean flag5 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k, myPlayer.smallX[0], false, j);
  3845.             if (!flag5) {
  3846.                 flag5 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k, myPlayer.smallX[0], false, j);
  3847.             }
  3848.             crossX = super.saveClickX;
  3849.             crossY = super.saveClickY;
  3850.             crossType = 2;
  3851.             crossIndex = 0;
  3852.             stream.createFrame(181);
  3853.             stream.method431(k + baseY);
  3854.             stream.writeWord(i1);
  3855.             stream.method431(j + baseX);
  3856.             stream.method432(anInt1137);
  3857.         }
  3858.         if (l == 646) {
  3859.             stream.createFrame(185);
  3860.             stream.writeWord(k);
  3861.             RSInterface class9_2 = RSInterface.interfaceCache[k];
  3862.             if (class9_2.valueIndexArray != null && class9_2.valueIndexArray[0][0] == 5) {
  3863.                 int i2 = class9_2.valueIndexArray[0][1];
  3864.                 if (variousSettings[i2] != class9_2.anIntArray212[0]) {
  3865.                     variousSettings[i2] = class9_2.anIntArray212[0];
  3866.                     method33(i2);
  3867.                     needDrawTabArea = true;
  3868.                 }
  3869.             }
  3870.         }
  3871.         if (l == 225) {
  3872.             NPC class30_sub2_sub4_sub1_sub1_2 = npcArray[i1];
  3873.             if (class30_sub2_sub4_sub1_sub1_2 != null) {
  3874.                 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]);
  3875.                 crossX = super.saveClickX;
  3876.                 crossY = super.saveClickY;
  3877.                 crossType = 2;
  3878.                 crossIndex = 0;
  3879.                 anInt1226 += i1;
  3880.                 if (anInt1226 >= 85) {
  3881.                     stream.createFrame(230);
  3882.                     stream.writeWordBigEndian(239);
  3883.                     anInt1226 = 0;
  3884.                 }
  3885.                 stream.createFrame(17);
  3886.                 stream.method433(i1);
  3887.             }
  3888.         }
  3889.         if (l == 965) {
  3890.             NPC class30_sub2_sub4_sub1_sub1_3 = npcArray[i1];
  3891.             if (class30_sub2_sub4_sub1_sub1_3 != null) {
  3892.                 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]);
  3893.                 crossX = super.saveClickX;
  3894.                 crossY = super.saveClickY;
  3895.                 crossType = 2;
  3896.                 crossIndex = 0;
  3897.                 anInt1134++;
  3898.                 if (anInt1134 >= 96) {
  3899.                     stream.createFrame(152);
  3900.                     stream.writeWordBigEndian(88);
  3901.                     anInt1134 = 0;
  3902.                 }
  3903.                 stream.createFrame(21);
  3904.                 stream.writeWord(i1);
  3905.             }
  3906.         }
  3907.         if (l == 413) {
  3908.             NPC class30_sub2_sub4_sub1_sub1_4 = npcArray[i1];
  3909.             if (class30_sub2_sub4_sub1_sub1_4 != null) {
  3910.                 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]);
  3911.                 crossX = super.saveClickX;
  3912.                 crossY = super.saveClickY;
  3913.                 crossType = 2;
  3914.                 crossIndex = 0;
  3915.                 stream.createFrame(131);
  3916.                 stream.method433(i1);
  3917.                 stream.method432(anInt1137);
  3918.             }
  3919.         }
  3920.         if (l == 200) {
  3921.             closeOpenInterfaces();
  3922.         }
  3923.         if (l == 1025) {
  3924.             NPC class30_sub2_sub4_sub1_sub1_5 = npcArray[i1];
  3925.             if (class30_sub2_sub4_sub1_sub1_5 != null) {
  3926.                 EntityDef entityDef = class30_sub2_sub4_sub1_sub1_5.desc;
  3927.                 if (entityDef.childrenIDs != null) {
  3928.                     entityDef = entityDef.method161();
  3929.                 }
  3930.                 if (entityDef != null) {
  3931.                     String s9;
  3932.                     if (entityDef.description != null) {
  3933.                         s9 = new String(entityDef.description);
  3934.                     } else {
  3935.                         s9 = "It's a " + entityDef.name + ".";
  3936.                     }
  3937.                     pushMessage(s9, 0, "");
  3938.                 }
  3939.             }
  3940.         }
  3941.         if (l == 900) {
  3942.             method66(i1, k, j);
  3943.             stream.createFrame(252);
  3944.             stream.method433(i1 >> 14 & 0x7fff);
  3945.             stream.method431(k + baseY);
  3946.             stream.method432(j + baseX);
  3947.         }
  3948.         if (l == 412) {
  3949.             NPC class30_sub2_sub4_sub1_sub1_6 = npcArray[i1];
  3950.             if (class30_sub2_sub4_sub1_sub1_6 != null) {
  3951.                 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]);
  3952.                 crossX = super.saveClickX;
  3953.                 crossY = super.saveClickY;
  3954.                 crossType = 2;
  3955.                 crossIndex = 0;
  3956.                 stream.createFrame(72);
  3957.                 stream.method432(i1);
  3958.             }
  3959.         }
  3960.         if (l == 365) {
  3961.             Player class30_sub2_sub4_sub1_sub2_3 = playerArray[i1];
  3962.             if (class30_sub2_sub4_sub1_sub2_3 != null) {
  3963.                 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]);
  3964.                 crossX = super.saveClickX;
  3965.                 crossY = super.saveClickY;
  3966.                 crossType = 2;
  3967.                 crossIndex = 0;
  3968.                 stream.createFrame(249);
  3969.                 stream.method432(i1);
  3970.                 stream.method431(anInt1137);
  3971.             }
  3972.         }
  3973.         if (l == 729) {
  3974.             Player class30_sub2_sub4_sub1_sub2_4 = playerArray[i1];
  3975.             if (class30_sub2_sub4_sub1_sub2_4 != null) {
  3976.                 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]);
  3977.                 crossX = super.saveClickX;
  3978.                 crossY = super.saveClickY;
  3979.                 crossType = 2;
  3980.                 crossIndex = 0;
  3981.                 stream.createFrame(39);
  3982.                 stream.method431(i1);
  3983.             }
  3984.         }
  3985.         if (l == 577) {
  3986.             Player class30_sub2_sub4_sub1_sub2_5 = playerArray[i1];
  3987.             if (class30_sub2_sub4_sub1_sub2_5 != null) {
  3988.                 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]);
  3989.                 crossX = super.saveClickX;
  3990.                 crossY = super.saveClickY;
  3991.                 crossType = 2;
  3992.                 crossIndex = 0;
  3993.                 stream.createFrame(139);
  3994.                 stream.method431(i1);
  3995.             }
  3996.         }
  3997.         if (l == 956 && method66(i1, k, j)) {
  3998.             stream.createFrame(35);
  3999.             stream.method431(j + baseX);
  4000.             stream.method432(anInt1137);
  4001.             stream.method432(k + baseY);
  4002.             stream.method431(i1 >> 14 & 0x7fff);
  4003.         }
  4004.         if (l == 567) {
  4005.             boolean flag6 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k, myPlayer.smallX[0], false, j);
  4006.             if (!flag6) {
  4007.                 flag6 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k, myPlayer.smallX[0], false, j);
  4008.             }
  4009.             crossX = super.saveClickX;
  4010.             crossY = super.saveClickY;
  4011.             crossType = 2;
  4012.             crossIndex = 0;
  4013.             stream.createFrame(23);
  4014.             stream.method431(k + baseY);
  4015.             stream.method431(i1);
  4016.             stream.method431(j + baseX);
  4017.         }
  4018.         if (l == 867) {
  4019.             if ((i1 & 3) == 0) {
  4020.                 anInt1175++;
  4021.             }
  4022.             if (anInt1175 >= 59) {
  4023.                 stream.createFrame(200);
  4024.                 stream.writeWord(25501);
  4025.                 anInt1175 = 0;
  4026.             }
  4027.             stream.createFrame(43);
  4028.             stream.method431(k);
  4029.             stream.method432(i1);
  4030.             stream.method432(j);
  4031.             atInventoryLoopCycle = 0;
  4032.             atInventoryInterface = k;
  4033.             atInventoryIndex = j;
  4034.             atInventoryInterfaceType = 2;
  4035.             if (RSInterface.interfaceCache[k].parentID == openInterfaceID) {
  4036.                 atInventoryInterfaceType = 1;
  4037.             }
  4038.             if (RSInterface.interfaceCache[k].parentID == backDialogID) {
  4039.                 atInventoryInterfaceType = 3;
  4040.             }
  4041.         }
  4042.         if (l == 543) {
  4043.             stream.createFrame(237);
  4044.             stream.writeWord(j);
  4045.             stream.method432(i1);
  4046.             stream.writeWord(k);
  4047.             stream.method432(anInt1137);
  4048.             atInventoryLoopCycle = 0;
  4049.             atInventoryInterface = k;
  4050.             atInventoryIndex = j;
  4051.             atInventoryInterfaceType = 2;
  4052.             if (RSInterface.interfaceCache[k].parentID == openInterfaceID) {
  4053.                 atInventoryInterfaceType = 1;
  4054.             }
  4055.             if (RSInterface.interfaceCache[k].parentID == backDialogID) {
  4056.                 atInventoryInterfaceType = 3;
  4057.             }
  4058.         }
  4059.         if (l == 606) {
  4060.             String s2 = menuActionName[i];
  4061.             int j2 = s2.indexOf("@whi@");
  4062.             if (j2 != -1) {
  4063.                 if (openInterfaceID == -1) {
  4064.                     closeOpenInterfaces();
  4065.                     reportAbuseInput = s2.substring(j2 + 5).trim();
  4066.                     canMute = false;
  4067.                     for (RSInterface element : RSInterface.interfaceCache) {
  4068.                         if (element == null || element.anInt214 != 600) {
  4069.                             continue;
  4070.                         }
  4071.                         reportAbuseInterfaceID = openInterfaceID = element.parentID;
  4072.                         break;
  4073.                     }
  4074.  
  4075.                 } else {
  4076.                     pushMessage("Please close the interface you have open before using 'report abuse'", 0, "");
  4077.                 }
  4078.             }
  4079.         }
  4080.         if (l == 491) {
  4081.             Player class30_sub2_sub4_sub1_sub2_6 = playerArray[i1];
  4082.             if (class30_sub2_sub4_sub1_sub2_6 != null) {
  4083.                 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]);
  4084.                 crossX = super.saveClickX;
  4085.                 crossY = super.saveClickY;
  4086.                 crossType = 2;
  4087.                 crossIndex = 0;
  4088.                 stream.createFrame(14);
  4089.                 // stream.method432(anInt1284);
  4090.                 stream.writeWord(i1);
  4091.                 // stream.writeWord(anInt1285);
  4092.                 stream.method431(anInt1283);
  4093.             }
  4094.         }
  4095.         if (l == 639) {
  4096.             String s3 = menuActionName[i];
  4097.             int k2 = s3.indexOf("@whi@");
  4098.             if (k2 != -1) {
  4099.                 long l4 = TextClass.longForName(s3.substring(k2 + 5).trim());
  4100.                 int k3 = -1;
  4101.                 for (int i4 = 0; i4 < friendsCount; i4++) {
  4102.                     if (friendsListAsLongs[i4] != l4) {
  4103.                         continue;
  4104.                     }
  4105.                     k3 = i4;
  4106.                     break;
  4107.                 }
  4108.  
  4109.                 if (k3 != -1 && friendsNodeIDs[k3] > 9) {
  4110.                     inputTaken = true;
  4111.                     inputDialogState = 0;
  4112.                     messagePromptRaised = true;
  4113.                     promptInput = "";
  4114.                     friendsListAction = 3;
  4115.                     aLong953 = friendsListAsLongs[k3];
  4116.                     aString1121 = "Enter message to send to " + friendsList[k3];
  4117.                 } else {
  4118.                     pushMessage("That player is currently offline.", 0, "");
  4119.                 }
  4120.             }
  4121.         }
  4122.         if (l == 454) {
  4123.             stream.createFrame(41);
  4124.             stream.writeWord(i1);
  4125.             stream.method432(j);
  4126.             stream.method432(k);
  4127.             atInventoryLoopCycle = 0;
  4128.             atInventoryInterface = k;
  4129.             atInventoryIndex = j;
  4130.             atInventoryInterfaceType = 2;
  4131.             if (RSInterface.interfaceCache[k].parentID == openInterfaceID) {
  4132.                 atInventoryInterfaceType = 1;
  4133.             }
  4134.             if (RSInterface.interfaceCache[k].parentID == backDialogID) {
  4135.                 atInventoryInterfaceType = 3;
  4136.             }
  4137.         }
  4138.         if (l == 478) {
  4139.             NPC class30_sub2_sub4_sub1_sub1_7 = npcArray[i1];
  4140.             if (class30_sub2_sub4_sub1_sub1_7 != null) {
  4141.                 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]);
  4142.                 crossX = super.saveClickX;
  4143.                 crossY = super.saveClickY;
  4144.                 crossType = 2;
  4145.                 crossIndex = 0;
  4146.                 if ((i1 & 3) == 0) {
  4147.                     anInt1155++;
  4148.                 }
  4149.                 if (anInt1155 >= 53) {
  4150.                     stream.createFrame(85);
  4151.                     stream.writeWordBigEndian(66);
  4152.                     anInt1155 = 0;
  4153.                 }
  4154.                 stream.createFrame(18);
  4155.                 stream.method431(i1);
  4156.             }
  4157.         }
  4158.         if (l == 113) {//third
  4159.             method66(i1, k, j);
  4160.             stream.createFrame(70);
  4161.             stream.method431(j + baseX);
  4162.             stream.writeWord(k + baseY);
  4163.             stream.method433(i1 >> 14 & 0x7fff);
  4164.         }
  4165.         if (l == 872) {//fourth
  4166.             method66(i1, k, j);
  4167.             stream.createFrame(234);
  4168.             stream.method433(j + baseX);
  4169.             stream.method432(i1 >> 14 & 0x7fff);
  4170.             stream.method433(k + baseY);
  4171.         }
  4172.         if (l == 502) {//first
  4173.             method66(i1, k, j);
  4174.             stream.createFrame(132);
  4175.             stream.method433(j + baseX);
  4176.             stream.writeWord(i1 >> 14 & 0x7fff);
  4177.             stream.method432(k + baseY);
  4178.         }
  4179.         if (l == 1125) {
  4180.             ItemDef itemDef = ItemDef.forID(i1);
  4181.             RSInterface class9_4 = RSInterface.interfaceCache[k];
  4182.             String s5;
  4183.             if (class9_4 != null && class9_4.invStackSizes[j] >= 0x186a0) {
  4184.                 DecimalFormatSymbols separator = new DecimalFormatSymbols();
  4185.                 separator.setGroupingSeparator(',');
  4186.                 DecimalFormat formatter = new DecimalFormat("#,###,###,###", separator);
  4187.                 s5 = formatter.format(class9_4.invStackSizes[j]) + " x " + itemDef.name;
  4188.             } else if (itemDef.description != null) {
  4189.                 s5 = new String(itemDef.description);
  4190.             } else {
  4191.                 s5 = "It's a " + itemDef.name + ".";
  4192.             }
  4193.             pushMessage(s5, 0, "");
  4194.         }
  4195.         if (l == 169) {
  4196.             stream.createFrame(185);
  4197.             stream.writeWord(k);
  4198.             RSInterface class9_3 = RSInterface.interfaceCache[k];
  4199.             if (class9_3.valueIndexArray != null && class9_3.valueIndexArray[0][0] == 5) {
  4200.                 int l2 = class9_3.valueIndexArray[0][1];
  4201.                 variousSettings[l2] = 1 - variousSettings[l2];
  4202.                 method33(l2);
  4203.                 needDrawTabArea = true;
  4204.             }
  4205.         }
  4206.         if (l == 447) {
  4207.             itemSelected = 1;
  4208.             anInt1283 = j;
  4209.             anInt1284 = k;
  4210.             anInt1285 = i1;
  4211.             selectedItemName = ItemDef.forID(i1).name;
  4212.             spellSelected = 0;
  4213.             needDrawTabArea = true;
  4214.             return;
  4215.         }
  4216.         if (l == 1226) {
  4217.             int j1 = i1 >> 14 & 0x7fff;
  4218.             ObjectDef class46 = ObjectDef.forID(j1);
  4219.             String s10;
  4220.             if (class46.description != null) {
  4221.                 s10 = new String(class46.description);
  4222.             } else {
  4223.                 s10 = "It's a " + class46.name + ".";
  4224.             }
  4225.             pushMessage(s10, 0, "");
  4226.         }
  4227.         if (l == 244) {
  4228.             boolean flag7 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k, myPlayer.smallX[0], false, j);
  4229.             if (!flag7) {
  4230.                 flag7 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k, myPlayer.smallX[0], false, j);
  4231.             }
  4232.             crossX = super.saveClickX;
  4233.             crossY = super.saveClickY;
  4234.             crossType = 2;
  4235.             crossIndex = 0;
  4236.             stream.createFrame(253);
  4237.             stream.method431(j + baseX);
  4238.             stream.method433(k + baseY);
  4239.             stream.method432(i1);
  4240.         }
  4241.         if (l == 1448) {
  4242.             ItemDef itemDef_1 = ItemDef.forID(i1);
  4243.             String s6;
  4244.             if (itemDef_1.description != null) {
  4245.                 s6 = new String(itemDef_1.description);
  4246.             } else {
  4247.                 s6 = "It's a " + itemDef_1.name + ".";
  4248.             }
  4249.             pushMessage(s6, 0, "");
  4250.         }
  4251.         itemSelected = 0;
  4252.         spellSelected = 0;
  4253.         needDrawTabArea = true;
  4254.  
  4255.     }
  4256.  
  4257.     public void method70() {
  4258.         anInt1251 = 0;
  4259.         int j = (myPlayer.x >> 7) + baseX;
  4260.         int k = (myPlayer.y >> 7) + baseY;
  4261.         if (j >= 3053 && j <= 3156 && k >= 3056 && k <= 3136) {
  4262.             anInt1251 = 1;
  4263.         }
  4264.         if (j >= 3072 && j <= 3118 && k >= 9492 && k <= 9535) {
  4265.             anInt1251 = 1;
  4266.         }
  4267.         if (anInt1251 == 1 && j >= 3139 && j <= 3199 && k >= 3008 && k <= 3062) {
  4268.             anInt1251 = 0;
  4269.         }
  4270.     }
  4271.  
  4272.     public void run() {
  4273.         if (drawFlames) {
  4274.             drawFlames();
  4275.         } else {
  4276.             super.run();
  4277.         }
  4278.     }
  4279.  
  4280.     public void build3dScreenMenu() {
  4281.         if (itemSelected == 0 && spellSelected == 0) {
  4282.             menuActionName[menuActionRow] = "Walk here";
  4283.             menuActionID[menuActionRow] = 516;
  4284.             menuActionCmd2[menuActionRow] = super.mouseX;
  4285.             menuActionCmd3[menuActionRow] = super.mouseY;
  4286.             menuActionRow++;
  4287.         }
  4288.         int j = -1;
  4289.         for (int k = 0; k < Model.anInt1687; k++) {
  4290.             int l = Model.anIntArray1688[k];
  4291.             int i1 = l & 0x7f;
  4292.             int j1 = l >> 7 & 0x7f;
  4293.             int k1 = l >> 29 & 3;
  4294.             int l1 = l >> 14 & 0x7fff;
  4295.             if (l == j) {
  4296.                 continue;
  4297.             }
  4298.             j = l;
  4299.             if (k1 == 2 && worldController.method304(plane, i1, j1, l) >= 0) {
  4300.                 ObjectDef class46 = ObjectDef.forID(l1);
  4301.                 if (class46.childrenIDs != null) {
  4302.                     class46 = class46.method580();
  4303.                 }
  4304.                 if (class46 == null) {
  4305.                     continue;
  4306.                 }
  4307.                 if (itemSelected == 1) {
  4308.                     menuActionName[menuActionRow] = "Use " + selectedItemName + " with @cya@" + class46.name;
  4309.                     menuActionID[menuActionRow] = 62;
  4310.                     menuActionCmd1[menuActionRow] = l;
  4311.                     menuActionCmd2[menuActionRow] = i1;
  4312.                     menuActionCmd3[menuActionRow] = j1;
  4313.                     menuActionRow++;
  4314.                 } else if (spellSelected == 1) {
  4315.                     if ((spellUsableOn & 4) == 4) {
  4316.                         menuActionName[menuActionRow] = spellTooltip + " @cya@" + class46.name;
  4317.                         menuActionID[menuActionRow] = 956;
  4318.                         menuActionCmd1[menuActionRow] = l;
  4319.                         menuActionCmd2[menuActionRow] = i1;
  4320.                         menuActionCmd3[menuActionRow] = j1;
  4321.                         menuActionRow++;
  4322.                     }
  4323.                 } else {
  4324.                     if (class46.actions != null) {
  4325.                         for (int i2 = 4; i2 >= 0; i2--) {
  4326.                             if (class46.actions[i2] != null) {
  4327.                                 menuActionName[menuActionRow] = class46.actions[i2] + " @cya@" + class46.name;
  4328.                                 if (i2 == 0) {
  4329.                                     menuActionID[menuActionRow] = 502;
  4330.                                 }
  4331.                                 if (i2 == 1) {
  4332.                                     menuActionID[menuActionRow] = 900;
  4333.                                 }
  4334.                                 if (i2 == 2) {
  4335.                                     menuActionID[menuActionRow] = 113;
  4336.                                 }
  4337.                                 if (i2 == 3) {
  4338.                                     menuActionID[menuActionRow] = 872;
  4339.                                 }
  4340.                                 if (i2 == 4) {
  4341.                                     menuActionID[menuActionRow] = 1062;
  4342.                                 }
  4343.                                 menuActionCmd1[menuActionRow] = l;
  4344.                                 menuActionCmd2[menuActionRow] = i1;
  4345.                                 menuActionCmd3[menuActionRow] = j1;
  4346.                                 menuActionRow++;
  4347.                             }
  4348.                         }
  4349.  
  4350.                     }
  4351.                     menuActionName[menuActionRow] = "Examine @cya@" + class46.name + (showInfo ? " @gre@(@whi@" + l1 + "@gre@) (@whi@" + (i1 + baseX) + "," + (j1 + baseY) + "@gre@)" : "");
  4352.                     menuActionID[menuActionRow] = 1226;
  4353.                     menuActionCmd1[menuActionRow] = class46.type << 14;
  4354.                     menuActionCmd2[menuActionRow] = i1;
  4355.                     menuActionCmd3[menuActionRow] = j1;
  4356.                     menuActionRow++;
  4357.                 }
  4358.             }
  4359.             if (k1 == 1) {
  4360.                 NPC npc = npcArray[l1];
  4361.                 if (npc.desc.aByte68 == 1 && (npc.x & 0x7f) == 64 && (npc.y & 0x7f) == 64) {
  4362.                     for (int j2 = 0; j2 < npcCount; j2++) {
  4363.                         NPC npc2 = npcArray[npcIndices[j2]];
  4364.                         if (npc2 != null && npc2 != npc && npc2.desc.aByte68 == 1 && npc2.x == npc.x && npc2.y == npc.y) {
  4365.                             buildAtNPCMenu(npc2.desc, npcIndices[j2], j1, i1);
  4366.                         }
  4367.                     }
  4368.  
  4369.                     for (int l2 = 0; l2 < playerCount; l2++) {
  4370.                         Player player = playerArray[playerIndices[l2]];
  4371.                         if (player != null && player.x == npc.x && player.y == npc.y) {
  4372.                             buildAtPlayerMenu(i1, playerIndices[l2], player, j1);
  4373.                         }
  4374.                     }
  4375.  
  4376.                 }
  4377.                 buildAtNPCMenu(npc.desc, l1, j1, i1);
  4378.             }
  4379.             if (k1 == 0) {
  4380.                 Player player = playerArray[l1];
  4381.                 if ((player.x & 0x7f) == 64 && (player.y & 0x7f) == 64) {
  4382.                     for (int k2 = 0; k2 < npcCount; k2++) {
  4383.                         NPC class30_sub2_sub4_sub1_sub1_2 = npcArray[npcIndices[k2]];
  4384.                         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) {
  4385.                             buildAtNPCMenu(class30_sub2_sub4_sub1_sub1_2.desc, npcIndices[k2], j1, i1);
  4386.                         }
  4387.                     }
  4388.  
  4389.                     for (int i3 = 0; i3 < playerCount; i3++) {
  4390.                         Player class30_sub2_sub4_sub1_sub2_2 = playerArray[playerIndices[i3]];
  4391.                         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) {
  4392.                             buildAtPlayerMenu(i1, playerIndices[i3], class30_sub2_sub4_sub1_sub2_2, j1);
  4393.                         }
  4394.                     }
  4395.  
  4396.                 }
  4397.                 buildAtPlayerMenu(i1, l1, player, j1);
  4398.             }
  4399.             if (k1 == 3) {
  4400.                 NodeList class19 = groundArray[plane][i1][j1];
  4401.                 if (class19 != null) {
  4402.                     for (Item item = (Item) class19.getFirst(); item != null; item = (Item) class19.getNext()) {
  4403.                         ItemDef itemDef = ItemDef.forID(item.ID);
  4404.                         if (itemSelected == 1) {
  4405.                             menuActionName[menuActionRow] = "Use " + selectedItemName + " with @lre@" + itemDef.name;
  4406.                             menuActionID[menuActionRow] = 511;
  4407.                             menuActionCmd1[menuActionRow] = item.ID;
  4408.                             menuActionCmd2[menuActionRow] = i1;
  4409.                             menuActionCmd3[menuActionRow] = j1;
  4410.                             menuActionRow++;
  4411.                         } else if (spellSelected == 1) {
  4412.                             if ((spellUsableOn & 1) == 1) {
  4413.                                 menuActionName[menuActionRow] = spellTooltip + " @lre@" + itemDef.name;
  4414.                                 menuActionID[menuActionRow] = 94;
  4415.                                 menuActionCmd1[menuActionRow] = item.ID;
  4416.                                 menuActionCmd2[menuActionRow] = i1;
  4417.                                 menuActionCmd3[menuActionRow] = j1;
  4418.                                 menuActionRow++;
  4419.                             }
  4420.                         } else {
  4421.                             for (int j3 = 4; j3 >= 0; j3--) {
  4422.                                 if (itemDef.groundActions != null && itemDef.groundActions[j3] != null) {
  4423.                                     menuActionName[menuActionRow] = itemDef.groundActions[j3] + " @lre@" + itemDef.name;
  4424.                                     if (j3 == 0) {
  4425.                                         menuActionID[menuActionRow] = 652;
  4426.                                     }
  4427.                                     if (j3 == 1) {
  4428.                                         menuActionID[menuActionRow] = 567;
  4429.                                     }
  4430.                                     if (j3 == 2) {
  4431.                                         menuActionID[menuActionRow] = 234;
  4432.                                     }
  4433.                                     if (j3 == 3) {
  4434.                                         menuActionID[menuActionRow] = 244;
  4435.                                     }
  4436.                                     if (j3 == 4) {
  4437.                                         menuActionID[menuActionRow] = 213;
  4438.                                     }
  4439.                                     menuActionCmd1[menuActionRow] = item.ID;
  4440.                                     menuActionCmd2[menuActionRow] = i1;
  4441.                                     menuActionCmd3[menuActionRow] = j1;
  4442.                                     menuActionRow++;
  4443.                                 } else if (j3 == 2) {
  4444.                                     menuActionName[menuActionRow] = "Take @lre@" + itemDef.name;
  4445.                                     menuActionID[menuActionRow] = 234;
  4446.                                     menuActionCmd1[menuActionRow] = item.ID;
  4447.                                     menuActionCmd2[menuActionRow] = i1;
  4448.                                     menuActionCmd3[menuActionRow] = j1;
  4449.                                     menuActionRow++;
  4450.                                 }
  4451.                             }
  4452.  
  4453.                             menuActionName[menuActionRow] = "Examine @lre@" + itemDef.name + (showInfo ? " @gre@(@whi@" + item.ID + "@gre@)" : "");
  4454.                             menuActionID[menuActionRow] = 1448;
  4455.                             menuActionCmd1[menuActionRow] = item.ID;
  4456.                             menuActionCmd2[menuActionRow] = i1;
  4457.                             menuActionCmd3[menuActionRow] = j1;
  4458.                             menuActionRow++;
  4459.                         }
  4460.                     }
  4461.  
  4462.                 }
  4463.             }
  4464.         }
  4465.     }
  4466.  
  4467.     public void cleanUpForQuit() {
  4468.         Signlink.reporterror = false;
  4469.         try {
  4470.             if (socketStream != null) {
  4471.                 socketStream.close();
  4472.             }
  4473.         } catch (Exception _ex) {
  4474.         }
  4475.         socketStream = null;
  4476.         stopMidi();
  4477.         if (mouseDetection != null) {
  4478.             mouseDetection.running = false;
  4479.         }
  4480.         mouseDetection = null;
  4481.         onDemandFetcher.disable();
  4482.         onDemandFetcher = null;
  4483.         aStream_834 = null;
  4484.         stream = null;
  4485.         aStream_847 = null;
  4486.         inStream = null;
  4487.         anIntArray1234 = null;
  4488.         aByteArrayArray1183 = null;
  4489.         aByteArrayArray1247 = null;
  4490.         anIntArray1235 = null;
  4491.         anIntArray1236 = null;
  4492.         intGroundArray = null;
  4493.         byteGroundArray = null;
  4494.         worldController = null;
  4495.         aClass11Array1230 = null;
  4496.         anIntArrayArray901 = null;
  4497.         anIntArrayArray825 = null;
  4498.         bigX = null;
  4499.         bigY = null;
  4500.         aByteArray912 = null;
  4501.         aRSImageProducer_1163 = null;
  4502.         aRSImageProducer_1164 = null;
  4503.         aRSImageProducer_1165 = null;
  4504.         aRSImageProducer_1166 = null;
  4505.         aRSImageProducer_1123 = null;
  4506.         aRSImageProducer_1124 = null;
  4507.         aRSImageProducer_1125 = null;
  4508.         backLeftIP1 = null;
  4509.         backLeftIP2 = null;
  4510.         backRightIP1 = null;
  4511.         backRightIP2 = null;
  4512.         backTopIP1 = null;
  4513.         backVmidIP1 = null;
  4514.         backVmidIP2 = null;
  4515.         backVmidIP3 = null;
  4516.         backVmidIP2_2 = null;
  4517.         invBack = null;
  4518.         mapBack = null;
  4519.         chatBack = null;
  4520.         backBase1 = null;
  4521.         backBase2 = null;
  4522.         backHmid1 = null;
  4523.         sideIcons = null;
  4524.         redStone1 = null;
  4525.         redStone2 = null;
  4526.         redStone3 = null;
  4527.         redStone1_2 = null;
  4528.         redStone2_2 = null;
  4529.         redStone1_3 = null;
  4530.         redStone2_3 = null;
  4531.         redStone3_2 = null;
  4532.         redStone1_4 = null;
  4533.         redStone2_4 = null;
  4534.         compass = null;
  4535.         hitMarks = null;
  4536.         headIcons = null;
  4537.         skullIcons = null;
  4538.         headIconsHint = null;
  4539.         crosses = null;
  4540.         mapDotItem = null;
  4541.         mapDotNPC = null;
  4542.         mapDotPlayer = null;
  4543.         mapDotFriend = null;
  4544.         mapDotTeam = null;
  4545.         mapScenes = null;
  4546.         mapFunctions = null;
  4547.         anIntArrayArray929 = null;
  4548.         playerArray = null;
  4549.         playerIndices = null;
  4550.         anIntArray894 = null;
  4551.         aStreamArray895s = null;
  4552.         anIntArray840 = null;
  4553.         npcArray = null;
  4554.         npcIndices = null;
  4555.         groundArray = null;
  4556.         aClass19_1179 = null;
  4557.         aClass19_1013 = null;
  4558.         aClass19_1056 = null;
  4559.         menuActionCmd2 = null;
  4560.         menuActionCmd3 = null;
  4561.         menuActionID = null;
  4562.         menuActionCmd1 = null;
  4563.         menuActionName = null;
  4564.         variousSettings = null;
  4565.         anIntArray1072 = null;
  4566.         anIntArray1073 = null;
  4567.         aClass30_Sub2_Sub1_Sub1Array1140 = null;
  4568.         aClass30_Sub2_Sub1_Sub1_1263 = null;
  4569.         friendsList = null;
  4570.         friendsListAsLongs = null;
  4571.         friendsNodeIDs = null;
  4572.         aRSImageProducer_1110 = null;
  4573.         aRSImageProducer_1111 = null;
  4574.         aRSImageProducer_1107 = null;
  4575.         aRSImageProducer_1108 = null;
  4576.         aRSImageProducer_1109 = null;
  4577.         aRSImageProducer_1112 = null;
  4578.         aRSImageProducer_1113 = null;
  4579.         aRSImageProducer_1114 = null;
  4580.         aRSImageProducer_1115 = null;
  4581.         multiOverlay = null;
  4582.         nullLoader();
  4583.         ObjectDef.nullLoader();
  4584.         EntityDef.nullLoader();
  4585.         ItemDef.nullLoader();
  4586.         Flo.cache = null;
  4587.         IDK.cache = null;
  4588.         RSInterface.interfaceCache = null;
  4589.         DummyClass.cache = null;
  4590.         Animation.anims = null;
  4591.         SpotAnim.cache = null;
  4592.         SpotAnim.aMRUNodes_415 = null;
  4593.         Varp.cache = null;
  4594.         super.fullGameScreen = null;
  4595.         Player.mruNodes = null;
  4596.         Texture.nullLoader();
  4597.         WorldController.nullLoader();
  4598.         Model.nullLoader();
  4599.         Class36.nullLoader();
  4600.         System.gc();
  4601.     }
  4602.  
  4603.     public void printDebug() {
  4604.         System.out.println("============");
  4605.         System.out.println("flame-cycle:" + anInt1208);
  4606.         if (onDemandFetcher != null) {
  4607.             System.out.println("Od-cycle:" + onDemandFetcher.onDemandCycle);
  4608.         }
  4609.         System.out.println("loop-cycle:" + loopCycle);
  4610.         System.out.println("draw-cycle:" + anInt1061);
  4611.         System.out.println("ptype:" + pktType);
  4612.         System.out.println("psize:" + pktSize);
  4613.         if (socketStream != null) {
  4614.             socketStream.printDebug();
  4615.         }
  4616.         super.shouldDebug = true;
  4617.     }
  4618.  
  4619.     Component getGameComponent() {
  4620.         if (Signlink.mainapp != null) {
  4621.             return Signlink.mainapp;
  4622.         }
  4623.         if (super.gameFrame != null) {
  4624.             return super.gameFrame;
  4625.         } else {
  4626.             return this;
  4627.         }
  4628.     }
  4629.  
  4630.     public void method73() {
  4631.         do {
  4632.             int j = readChar(-796);
  4633.             if (j == -1) {
  4634.                 break;
  4635.             }
  4636.             if (openInterfaceID != -1 && openInterfaceID == reportAbuseInterfaceID) {
  4637.                 if (j == 8 && reportAbuseInput.length() > 0) {
  4638.                     reportAbuseInput = reportAbuseInput.substring(0, reportAbuseInput.length() - 1);
  4639.                 }
  4640.                 if ((j >= 97 && j <= 122 || j >= 65 && j <= 90 || j >= 48 && j <= 57 || j == 32) && reportAbuseInput.length() < 12) {
  4641.                     reportAbuseInput += (char) j;
  4642.                 }
  4643.             } else if (messagePromptRaised) {
  4644.                 if (j >= 32 && j <= 122 && promptInput.length() < 80) {
  4645.                     promptInput += (char) j;
  4646.                     inputTaken = true;
  4647.                 }
  4648.                 if (j == 8 && promptInput.length() > 0) {
  4649.                     promptInput = promptInput.substring(0, promptInput.length() - 1);
  4650.                     inputTaken = true;
  4651.                 }
  4652.                 if (j == 13 || j == 10) {
  4653.                     messagePromptRaised = false;
  4654.                     inputTaken = true;
  4655.                     if (friendsListAction == 1) {
  4656.                         long l = TextClass.longForName(promptInput);
  4657.                         addFriend(l);
  4658.                     }
  4659.                     if (friendsListAction == 2 && friendsCount > 0) {
  4660.                         long l1 = TextClass.longForName(promptInput);
  4661.                         delFriend(l1);
  4662.                     }
  4663.                     if (friendsListAction == 3 && promptInput.length() > 0) {
  4664.                         stream.createFrame(126);
  4665.                         stream.writeWordBigEndian(0);
  4666.                         int k = stream.currentOffset;
  4667.                         stream.writeQWord(aLong953);
  4668.                         TextInput.method526(promptInput, stream);
  4669.                         stream.writeBytes(stream.currentOffset - k);
  4670.                         promptInput = TextInput.processText(promptInput);
  4671.                         promptInput = Censor.doCensor(promptInput);
  4672.                         pushMessage(promptInput, 6, TextClass.fixName(TextClass.nameForLong(aLong953)));
  4673.                         if (privateChatMode == 2) {
  4674.                             privateChatMode = 1;
  4675.                             aBoolean1233 = true;
  4676.                             stream.createFrame(95);
  4677.                             stream.writeWordBigEndian(publicChatMode);
  4678.                             stream.writeWordBigEndian(privateChatMode);
  4679.                             stream.writeWordBigEndian(tradeMode);
  4680.                         }
  4681.                     }
  4682.                     if (friendsListAction == 4 && ignoreCount < 100) {
  4683.                         long l2 = TextClass.longForName(promptInput);
  4684.                         addIgnore(l2);
  4685.                     }
  4686.                     if (friendsListAction == 5 && ignoreCount > 0) {
  4687.                         long l3 = TextClass.longForName(promptInput);
  4688.                         delIgnore(l3);
  4689.                     }
  4690.                 }
  4691.             } else if (inputDialogState == 1) {
  4692.                 if (j >= 48 && j <= 57 && amountOrNameInput.length() < 10) {
  4693.                     amountOrNameInput += (char) j;
  4694.                     inputTaken = true;
  4695.                 }
  4696.                 if ((!amountOrNameInput.toLowerCase().contains("k") && !amountOrNameInput.toLowerCase().contains("m") && !amountOrNameInput.toLowerCase().contains("b")) && (j == 107 || j == 109) || j == 98) {
  4697.                     amountOrNameInput += (char) j;
  4698.                     inputTaken = true;
  4699.                 }
  4700.                 if (j == 8 && amountOrNameInput.length() > 0) {
  4701.                     amountOrNameInput = amountOrNameInput.substring(0, amountOrNameInput.length() - 1);
  4702.                     inputTaken = true;
  4703.                 }
  4704.                 try {
  4705.                 if (j == 13 || j == 10) {
  4706.                     if (amountOrNameInput.length() > 0) {
  4707.                         if (amountOrNameInput.toLowerCase().contains("k")) {
  4708.                             amountOrNameInput = amountOrNameInput.replaceAll("k", "000");
  4709.                         } else if (amountOrNameInput.toLowerCase().contains("m")) {
  4710.                             amountOrNameInput = amountOrNameInput.replaceAll("m", "000000");
  4711.                         } else if (amountOrNameInput.toLowerCase().contains("b")) {
  4712.                             amountOrNameInput = amountOrNameInput.replaceAll("b", "000000000");
  4713.                         }
  4714.                         int amount = 0;
  4715.                         amount = Integer.parseInt(amountOrNameInput);
  4716.                         stream.createFrame(208);
  4717.                         stream.writeDWord(amount);
  4718.                     }
  4719.                     inputDialogState = 0;
  4720.                     inputTaken = true;
  4721.                 }
  4722.             } catch (NumberFormatException nfe) {
  4723.                 inputDialogState = 0;
  4724.                 inputTaken = true;
  4725.                 pushMessage("Please enter a lower amount.", 0, "");
  4726.             }
  4727.             } else if (inputDialogState == 2) {
  4728.                 if (j >= 32 && j <= 122 && amountOrNameInput.length() < 12) {
  4729.                     amountOrNameInput += (char) j;
  4730.                     inputTaken = true;
  4731.                 }
  4732.                 if (j == 8 && amountOrNameInput.length() > 0) {
  4733.                     amountOrNameInput = amountOrNameInput.substring(0, amountOrNameInput.length() - 1);
  4734.                     inputTaken = true;
  4735.                 }
  4736.                 if (j == 13 || j == 10) {
  4737.                     if (amountOrNameInput.length() > 0) {
  4738.                         stream.createFrame(60);
  4739.                         stream.writeQWord(TextClass.longForName(amountOrNameInput));
  4740.                     }
  4741.                     inputDialogState = 0;
  4742.                     inputTaken = true;
  4743.                 }
  4744.             } else if (backDialogID == -1 && fullScreenBackDialogID == -1) {
  4745.                 if (j >= 32 && j <= 122 && inputString.length() < 80) {
  4746.                     inputString += (char) j;
  4747.                     inputTaken = true;
  4748.                 }
  4749.                 if (j == 8 && inputString.length() > 0) {
  4750.                     inputString = inputString.substring(0, inputString.length() - 1);
  4751.                     inputTaken = true;
  4752.                 }
  4753.                 if ((j == 13 || j == 10) && inputString.length() > 0) {
  4754.                     if (myPrivilege == 2) {
  4755.                         if (inputString.equals("::clientdrop")) {
  4756.                             dropClient();
  4757.                         }
  4758.                         if (inputString.equals("::lag")) {
  4759.                             printDebug();
  4760.                         }
  4761.                         if (inputString.equals("::prefetchmusic")) {
  4762.                             for (int j1 = 0; j1 < onDemandFetcher.getVersionCount(2); j1++) {
  4763.                                 onDemandFetcher.method563((byte) 1, 2, j1);
  4764.                             }
  4765.  
  4766.                         }
  4767.                         if (inputString.equals("::fps")) {
  4768.                             fpsOn = !fpsOn;
  4769.                         }
  4770.                         if (inputString.equals("::dataon")) {
  4771.                             showInfo = !showInfo;
  4772.                         }
  4773.                         if (inputString.equals("::clip")) {
  4774.                             for (int k1 = 0; k1 < 4; k1++) {
  4775.                                 for (int i2 = 1; i2 < 103; i2++) {
  4776.                                     for (int k2 = 1; k2 < 103; k2++) {
  4777.                                         aClass11Array1230[k1].anIntArrayArray294[i2][k2] = 0;
  4778.                                     }
  4779.  
  4780.                                 }
  4781.  
  4782.                             }
  4783.  
  4784.                         }
  4785.                     }
  4786.                     if (inputString.startsWith("::")) {
  4787.                         stream.createFrame(103);
  4788.                         stream.writeWordBigEndian(inputString.length() - 1);
  4789.                         stream.writeString(inputString.substring(2));
  4790.                     } else {
  4791.                         String s = inputString.toLowerCase();
  4792.                         int j2 = 0;
  4793.                         if (s.startsWith("yellow:")) {
  4794.                             j2 = 0;
  4795.                             inputString = inputString.substring(7);
  4796.                         } else if (s.startsWith("red:")) {
  4797.                             j2 = 1;
  4798.                             inputString = inputString.substring(4);
  4799.                         } else if (s.startsWith("green:")) {
  4800.                             j2 = 2;
  4801.                             inputString = inputString.substring(6);
  4802.                         } else if (s.startsWith("cyan:")) {
  4803.                             j2 = 3;
  4804.                             inputString = inputString.substring(5);
  4805.                         } else if (s.startsWith("purple:")) {
  4806.                             j2 = 4;
  4807.                             inputString = inputString.substring(7);
  4808.                         } else if (s.startsWith("white:")) {
  4809.                             j2 = 5;
  4810.                             inputString = inputString.substring(6);
  4811.                         } else if (s.startsWith("flash1:")) {
  4812.                             j2 = 6;
  4813.                             inputString = inputString.substring(7);
  4814.                         } else if (s.startsWith("flash2:")) {
  4815.                             j2 = 7;
  4816.                             inputString = inputString.substring(7);
  4817.                         } else if (s.startsWith("flash3:")) {
  4818.                             j2 = 8;
  4819.                             inputString = inputString.substring(7);
  4820.                         } else if (s.startsWith("glow1:")) {
  4821.                             j2 = 9;
  4822.                             inputString = inputString.substring(6);
  4823.                         } else if (s.startsWith("glow2:")) {
  4824.                             j2 = 10;
  4825.                             inputString = inputString.substring(6);
  4826.                         } else if (s.startsWith("glow3:")) {
  4827.                             j2 = 11;
  4828.                             inputString = inputString.substring(6);
  4829.                         }
  4830.                         s = inputString.toLowerCase();
  4831.                         int i3 = 0;
  4832.                         if (s.startsWith("wave:")) {
  4833.                             i3 = 1;
  4834.                             inputString = inputString.substring(5);
  4835.                         } else if (s.startsWith("wave2:")) {
  4836.                             i3 = 2;
  4837.                             inputString = inputString.substring(6);
  4838.                         } else if (s.startsWith("shake:")) {
  4839.                             i3 = 3;
  4840.                             inputString = inputString.substring(6);
  4841.                         } else if (s.startsWith("scroll:")) {
  4842.                             i3 = 4;
  4843.                             inputString = inputString.substring(7);
  4844.                         } else if (s.startsWith("slide:")) {
  4845.                             i3 = 5;
  4846.                             inputString = inputString.substring(6);
  4847.                         }
  4848.                         stream.createFrame(4);
  4849.                         stream.writeWordBigEndian(0);
  4850.                         int j3 = stream.currentOffset;
  4851.                         stream.method425(i3);
  4852.                         stream.method425(j2);
  4853.                         aStream_834.currentOffset = 0;
  4854.                         TextInput.method526(inputString, aStream_834);
  4855.                         stream.method441(0, aStream_834.buffer, aStream_834.currentOffset);
  4856.                         stream.writeBytes(stream.currentOffset - j3);
  4857.                         inputString = TextInput.processText(inputString);
  4858.                         inputString = Censor.doCensor(inputString);
  4859.                         myPlayer.textSpoken = inputString;
  4860.                         myPlayer.anInt1513 = j2;
  4861.                         myPlayer.anInt1531 = i3;
  4862.                         myPlayer.textCycle = 150;
  4863.                         if (myPrivilege == 2 || myPrivilege == 3) {
  4864.                             pushMessage(myPlayer.textSpoken, 2, "@cr2@" + myPlayer.name);
  4865.                         } else if (myPrivilege == 1) {
  4866.                             pushMessage(myPlayer.textSpoken, 2, "@cr1@" + myPlayer.name);
  4867.                         } else {
  4868.                             pushMessage(myPlayer.textSpoken, 2, myPlayer.name);
  4869.                         }
  4870.                         if (publicChatMode == 2) {
  4871.                             publicChatMode = 3;
  4872.                             aBoolean1233 = true;
  4873.                             stream.createFrame(95);
  4874.                             stream.writeWordBigEndian(publicChatMode);
  4875.                             stream.writeWordBigEndian(privateChatMode);
  4876.                             stream.writeWordBigEndian(tradeMode);
  4877.                         }
  4878.                     }
  4879.                     inputString = "";
  4880.                     inputTaken = true;
  4881.                 }
  4882.             }
  4883.         } while (true);
  4884.     }
  4885.  
  4886.     public void buildChatAreaMenu(int j) {
  4887.         int l = 0;
  4888.         for (int i1 = 0; i1 < 100; i1++) {
  4889.             if (chatMessages[i1] == null) {
  4890.                 continue;
  4891.             }
  4892.             int j1 = chatTypes[i1];
  4893.             int k1 = 70 - l * 14 + anInt1089 + 4;
  4894.             if (k1 < -20) {
  4895.                 break;
  4896.             }
  4897.             String s = chatNames[i1];
  4898.             if (s != null && s.startsWith("@cr1@")) {
  4899.                 s = s.substring(5);
  4900.             }
  4901.             if (s != null && s.startsWith("@cr2@")) {
  4902.                 s = s.substring(5);
  4903.             }
  4904.             if (j1 == 0) {
  4905.                 l++;
  4906.             }
  4907.             if ((j1 == 1 || j1 == 2) && (j1 == 1 || publicChatMode == 0 || publicChatMode == 1 && isFriendOrSelf(s))) {
  4908.                 if (j > k1 - 14 && j <= k1 && !s.equals(myPlayer.name)) {
  4909.                     if (myPrivilege >= 1 && myPrivilege <= 3) {
  4910.                         menuActionName[menuActionRow] = "Report abuse @whi@" + s;
  4911.                         menuActionID[menuActionRow] = 606;
  4912.                         menuActionRow++;
  4913.                     }
  4914.                     menuActionName[menuActionRow] = "Add ignore @whi@" + s;
  4915.                     menuActionID[menuActionRow] = 42;
  4916.                     menuActionRow++;
  4917.                     menuActionName[menuActionRow] = "Reply to @whi@" + s;
  4918.                     menuActionID[menuActionRow] = 639;
  4919.                     menuActionRow++;
  4920.                     menuActionName[menuActionRow] = "Add friend @whi@" + s;
  4921.                     menuActionID[menuActionRow] = 337;
  4922.                     menuActionRow++;
  4923.                 }
  4924.                 l++;
  4925.             }
  4926.             if ((j1 == 3 || j1 == 7) && splitpublicChat == 0 && (j1 == 7 || privateChatMode == 0 || publicChatMode == 1 && isFriendOrSelf(s))) {
  4927.                 if (j > k1 - 14 && j <= k1) {
  4928.                     if (myPrivilege >= 1 && myPrivilege <= 3) {
  4929.                         menuActionName[menuActionRow] = "Report abuse @whi@" + s;
  4930.                         menuActionID[menuActionRow] = 606;
  4931.                         menuActionRow++;
  4932.                     }
  4933.                     menuActionName[menuActionRow] = "Add ignore @whi@" + s;
  4934.                     menuActionID[menuActionRow] = 42;
  4935.                     menuActionRow++;
  4936.                     menuActionName[menuActionRow] = "Reply to @whi@" + s;
  4937.                     menuActionID[menuActionRow] = 639;
  4938.                     menuActionRow++;
  4939.                     menuActionName[menuActionRow] = "Add friend @whi@" + s;
  4940.                     menuActionID[menuActionRow] = 337;
  4941.                     menuActionRow++;
  4942.                 }
  4943.                 l++;
  4944.             }
  4945.             if (j1 == 4 && (tradeMode == 0 || tradeMode == 1 && isFriendOrSelf(s))) {
  4946.                 if (j > k1 - 14 && j <= k1) {
  4947.                     menuActionName[menuActionRow] = "Accept trade @whi@" + s;
  4948.                     menuActionID[menuActionRow] = 484;
  4949.                     menuActionRow++;
  4950.                 }
  4951.                 l++;
  4952.             }
  4953.             if ((j1 == 5 || j1 == 6) && splitpublicChat == 0 && privateChatMode < 2) {
  4954.                 l++;
  4955.             }
  4956.             if (j1 == 8 && (tradeMode == 0 || tradeMode == 1 && isFriendOrSelf(s))) {
  4957.                 if (j > k1 - 14 && j <= k1) {
  4958.                     menuActionName[menuActionRow] = "Accept challenge @whi@" + s;
  4959.                     menuActionID[menuActionRow] = 6;
  4960.                     menuActionRow++;
  4961.                 }
  4962.                 l++;
  4963.             }
  4964.         }
  4965.  
  4966.     }
  4967.  
  4968.     public void drawFriendsListOrWelcomeScreen(RSInterface class9) {
  4969.         int j = class9.anInt214;
  4970.         if (j >= 1 && j <= 100 || j >= 701 && j <= 800) {
  4971.             if (j == 1 && anInt900 == 0) {
  4972.                 class9.disabledText = "Loading friend list";
  4973.                 class9.atActionType = 0;
  4974.                 return;
  4975.             }
  4976.             if (j == 1 && anInt900 == 1) {
  4977.                 class9.disabledText = "Connecting to friendserver";
  4978.                 class9.atActionType = 0;
  4979.                 return;
  4980.             }
  4981.             if (j == 2 && anInt900 != 2) {
  4982.                 class9.disabledText = "Please wait...";
  4983.                 class9.atActionType = 0;
  4984.                 return;
  4985.             }
  4986.             int k = friendsCount;
  4987.             if (anInt900 != 2) {
  4988.                 k = 0;
  4989.             }
  4990.             if (j > 700) {
  4991.                 j -= 601;
  4992.             } else {
  4993.                 j--;
  4994.             }
  4995.             if (j >= k) {
  4996.                 class9.disabledText = "";
  4997.                 class9.atActionType = 0;
  4998.                 return;
  4999.             } else {
  5000.                 class9.disabledText = friendsList[j];
  5001.                 class9.atActionType = 1;
  5002.                 return;
  5003.             }
  5004.         }
  5005.         if (j >= 101 && j <= 200 || j >= 801 && j <= 900) {
  5006.             int l = friendsCount;
  5007.             if (anInt900 != 2) {
  5008.                 l = 0;
  5009.             }
  5010.             if (j > 800) {
  5011.                 j -= 701;
  5012.             } else {
  5013.                 j -= 101;
  5014.             }
  5015.             if (j >= l) {
  5016.                 class9.disabledText = "";
  5017.                 class9.atActionType = 0;
  5018.                 return;
  5019.             }
  5020.             if (friendsNodeIDs[j] == 0) {
  5021.                 class9.disabledText = "@red@Offline";
  5022.             } else if (friendsNodeIDs[j] == nodeID) {
  5023.                 class9.disabledText = "@gre@World-1";
  5024.             } else {
  5025.                 class9.disabledText = "@red@Offline";
  5026.             }
  5027.             class9.atActionType = 1;
  5028.             return;
  5029.         }
  5030.         if (j == 203) {
  5031.             int i1 = friendsCount;
  5032.             if (anInt900 != 2) {
  5033.                 i1 = 0;
  5034.             }
  5035.             class9.scrollMax = i1 * 15 + 20;
  5036.             if (class9.scrollMax <= class9.height) {
  5037.                 class9.scrollMax = class9.height + 1;
  5038.             }
  5039.             return;
  5040.         }
  5041.         if (j >= 401 && j <= 500) {
  5042.             if ((j -= 401) == 0 && anInt900 == 0) {
  5043.                 class9.disabledText = "Loading ignore list";
  5044.                 class9.atActionType = 0;
  5045.                 return;
  5046.             }
  5047.             if (j == 1 && anInt900 == 0) {
  5048.                 class9.disabledText = "Please wait...";
  5049.                 class9.atActionType = 0;
  5050.                 return;
  5051.             }
  5052.             int j1 = ignoreCount;
  5053.             if (anInt900 == 0) {
  5054.                 j1 = 0;
  5055.             }
  5056.             if (j >= j1) {
  5057.                 class9.disabledText = "";
  5058.                 class9.atActionType = 0;
  5059.                 return;
  5060.             } else {
  5061.                 class9.disabledText = TextClass.fixName(TextClass.nameForLong(ignoreListAsLongs[j]));
  5062.                 class9.atActionType = 1;
  5063.                 return;
  5064.             }
  5065.         }
  5066.         if (j == 503) {
  5067.             class9.scrollMax = ignoreCount * 15 + 20;
  5068.             if (class9.scrollMax <= class9.height) {
  5069.                 class9.scrollMax = class9.height + 1;
  5070.             }
  5071.             return;
  5072.         }
  5073.         if (j == 327) {
  5074.             class9.anInt270 = 150;
  5075.             class9.anInt271 = (int) (Math.sin((double) loopCycle / 40D) * 256D) & 0x7ff;
  5076.             if (aBoolean1031) {
  5077.                 for (int k1 = 0; k1 < 7; k1++) {
  5078.                     int l1 = anIntArray1065[k1];
  5079.                     if (l1 >= 0 && !IDK.cache[l1].method537()) {
  5080.                         return;
  5081.                     }
  5082.                 }
  5083.  
  5084.                 aBoolean1031 = false;
  5085.                 Model aclass30_sub2_sub4_sub6s[] = new Model[7];
  5086.                 int i2 = 0;
  5087.                 for (int j2 = 0; j2 < 7; j2++) {
  5088.                     int k2 = anIntArray1065[j2];
  5089.                     if (k2 >= 0) {
  5090.                         aclass30_sub2_sub4_sub6s[i2++] = IDK.cache[k2].method538();
  5091.                     }
  5092.                 }
  5093.  
  5094.                 Model model = new Model(i2, aclass30_sub2_sub4_sub6s);
  5095.                 for (int l2 = 0; l2 < 5; l2++) {
  5096.                     if (anIntArray990[l2] != 0) {
  5097.                         model.method476(anIntArrayArray1003[l2][0], anIntArrayArray1003[l2][anIntArray990[l2]]);
  5098.                         if (l2 == 1) {
  5099.                             model.method476(anIntArray1204[0], anIntArray1204[anIntArray990[l2]]);
  5100.                         }
  5101.                     }
  5102.                 }
  5103.  
  5104.                 model.method469();
  5105.                 model.method470(Animation.anims[myPlayer.anInt1511].anIntArray353[0]);
  5106.                 model.method479(64, 850, -30, -50, -30, true);
  5107.                 class9.anInt233 = 5;
  5108.                 class9.mediaID = 0;
  5109.                 RSInterface.method208(model, 0, 5);
  5110.             }
  5111.             return;
  5112.         }
  5113.         if (j == 324) {
  5114.             if (aClass30_Sub2_Sub1_Sub1_931 == null) {
  5115.                 aClass30_Sub2_Sub1_Sub1_931 = class9.sprite1;
  5116.                 aClass30_Sub2_Sub1_Sub1_932 = class9.sprite2;
  5117.             }
  5118.             if (aBoolean1047) {
  5119.                 class9.sprite1 = aClass30_Sub2_Sub1_Sub1_932;
  5120.                 return;
  5121.             } else {
  5122.                 class9.sprite1 = aClass30_Sub2_Sub1_Sub1_931;
  5123.                 return;
  5124.             }
  5125.         }
  5126.         if (j == 325) {
  5127.             if (aClass30_Sub2_Sub1_Sub1_931 == null) {
  5128.                 aClass30_Sub2_Sub1_Sub1_931 = class9.sprite1;
  5129.                 aClass30_Sub2_Sub1_Sub1_932 = class9.sprite2;
  5130.             }
  5131.             if (aBoolean1047) {
  5132.                 class9.sprite1 = aClass30_Sub2_Sub1_Sub1_931;
  5133.                 return;
  5134.             } else {
  5135.                 class9.sprite1 = aClass30_Sub2_Sub1_Sub1_932;
  5136.                 return;
  5137.             }
  5138.         }
  5139.         if (j == 600) {
  5140.             class9.disabledText = reportAbuseInput;
  5141.             if (loopCycle % 20 < 10) {
  5142.                 class9.disabledText += "|";
  5143.                 return;
  5144.             } else {
  5145.                 class9.disabledText += " ";
  5146.                 return;
  5147.             }
  5148.         }
  5149.         if (j == 613) {
  5150.             if (myPrivilege >= 1 && myPrivilege <= 3) {
  5151.                 if (canMute) {
  5152.                     class9.textColor = 0xff0000;
  5153.                     class9.disabledText = "Moderator option: Mute player for 48 hours: <ON>";
  5154.                 } else {
  5155.                     class9.textColor = 0xffffff;
  5156.                     class9.disabledText = "Moderator option: Mute player for 48 hours: <OFF>";
  5157.                 }
  5158.             } else {
  5159.                 class9.disabledText = "";
  5160.             }
  5161.         }
  5162.         if (j == 660) {
  5163.             int k1 = anInt1170 - anInt1215;
  5164.             String s1;
  5165.             if (k1 <= 0)
  5166.                 s1 = "earlier today";
  5167.             else if (k1 == 1)
  5168.                 s1 = "yesterday";
  5169.             else
  5170.                 s1 = k1 + " days ago";
  5171.             class9.disabledText = "You last logged in @red@" + s1
  5172.                     + "@bla@ from: @red@" + Signlink.dns;
  5173.         }
  5174.         if (j == 661)
  5175.             if (anInt1034 == 0)
  5176.                 class9.disabledText = "\\nYou have not yet set any recovery questions.\\nIt is @lre@strongly@yel@ recommended that you do so.\\n\\nIf you don't you will be @lre@unable to recover your\\n@lre@password@yel@ if you forget it, or it is stolen.";
  5177.             else if (anInt1034 <= anInt1170) {
  5178.                 class9.disabledText = "\\n\\nRecovery Questions Last Set:\\n@gre@"
  5179.                         + method104(anInt1034);
  5180.             } else {
  5181.                 int l1 = (anInt1170 + 14) - anInt1034;
  5182.                 String s2;
  5183.                 if (l1 <= 0)
  5184.                     s2 = "Earlier today";
  5185.                 else if (l1 == 1)
  5186.                     s2 = "Yesterday";
  5187.                 else
  5188.                     s2 = l1 + " days ago";
  5189.                 class9.disabledText = s2
  5190.                         + " you requested@lre@ new recovery\\n@lre@questions.@yel@ The requested change will occur\\non: @lre@"
  5191.                         + method104(anInt1034)
  5192.                         + "\\n\\nIf you do not remember making this request\\ncancel it immediately, and change your password.";
  5193.             }
  5194.         if (j == 662) {
  5195.             String s;
  5196.             if (anInt1273 == 0)
  5197.                 s = "@yel@0 unread messages";
  5198.             else if (anInt1273 == 1)
  5199.                 s = "@gre@1 unread message";
  5200.             else
  5201.                 s = "@gre@" + anInt1273 + " unread messages";
  5202.             class9.disabledText = "You have " + s + "\\nin your message centre.";
  5203.         }
  5204.         if (j == 663)
  5205.             if (anInt1083 <= 0 || anInt1083 > anInt1170 + 10)
  5206.                 class9.disabledText = "Last password change:\\n@gre@Never changed";
  5207.             else
  5208.                 class9.disabledText = "Last password change:\\n@gre@"
  5209.                         + method104(anInt1083);
  5210.         if (j == 665)
  5211.             if (anInt992 > 2 && !isMembers)
  5212.                 class9.disabledText = "This is a non-members\\nworld. To enjoy your\\nmembers benefits we\\nrecommend you play on a\\nmembers world instead.";
  5213.             else if (anInt992 > 2)
  5214.                 class9.disabledText = "\\n\\nYou have @gre@" + anInt992
  5215.                         + "@yel@ days of\\nmember credit remaining.";
  5216.             else if (anInt992 > 0)
  5217.                 class9.disabledText = "You have @gre@"
  5218.                         + anInt992
  5219.                         + "@yel@ days of\\nmember credit remaining.\\n\\n@lre@Credit low! Renew now\\n@lre@to avoid losing members.";
  5220.             else
  5221.                 class9.disabledText = "You are not a member.\\n\\nChoose to subscribe and\\nyou'll get loads of extra\\nbenefits and features.";
  5222.         if (j == 667)
  5223.             if (anInt992 > 2 && !isMembers)
  5224.                 class9.disabledText = "To switch to a members-only world:\\n1) Logout and return to the world selection page.\\n2) Choose one of the members world with a gold star next to it's name.\\n\\nIf you prefer you can continue to use this world,\\nbut members only features will be unavailable here.";
  5225.             else if (anInt992 > 0)
  5226.                 class9.disabledText = "To extend or cancel a subscription:\\n1) Logout and return to the frontpage of this website.\\n2)Choose the relevant option from the 'membership' section.\\n\\nNote: If you are a credit card subscriber a top-up payment will\\nautomatically be taken when 3 days credit remain.\\n(unless you cancel your subscription, which can be done at any time.)";
  5227.             else
  5228.                 class9.disabledText = "To start a subscripton:\\n1) Logout and return to the frontpage of this website.\\n2) Choose 'Start a new subscription'";
  5229.         if (j == 668) {
  5230.             if (anInt1034 > anInt1170) {
  5231.                 class9.disabledText = "To cancel this request:\\n1) Logout and return to the frontpage of this website.\\n2) Choose 'Cancel recovery questions'.";
  5232.                 return;
  5233.             }
  5234.             class9.disabledText = "To change your recovery questions:\\n1) Logout and return to the frontpage of this website.\\n2) Choose 'Set new recovery questions'.";
  5235.         }
  5236.     }
  5237.    
  5238.     public String method104(int i) {
  5239.         if (i > anInt1170 + 10) {
  5240.             return "Unknown";
  5241.         } else {
  5242.             long l = ((long) i + 11745L) * 0x5265c00L;
  5243.             Calendar calendar = Calendar.getInstance();
  5244.             calendar.setTime(new Date(l));
  5245.             int j = calendar.get(5);
  5246.             int k = calendar.get(2);
  5247.             int i1 = calendar.get(1);
  5248.             String as[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul",
  5249.                     "Aug", "Sep", "Oct", "Nov", "Dec" };
  5250.             return j + "-" + as[k] + "-" + i1;
  5251.         }
  5252.     }
  5253.  
  5254.     public void drawSplitpublicChat() {
  5255.         if (splitpublicChat == 0) {
  5256.             return;
  5257.         }
  5258.         TextDrawingArea textDrawingArea = aTextDrawingArea_1271;
  5259.         int i = 0;
  5260.         if (anInt1104 != 0) {
  5261.             i = 1;
  5262.         }
  5263.         for (int j = 0; j < 100; j++) {
  5264.             if (chatMessages[j] != null) {
  5265.                 int k = chatTypes[j];
  5266.                 String s = chatNames[j];
  5267.                 byte byte1 = 0;
  5268.                 if (s != null && s.startsWith("@cr1@")) {
  5269.                     s = s.substring(5);
  5270.                     byte1 = 1;
  5271.                 }
  5272.                 if (s != null && s.startsWith("@cr2@")) {
  5273.                     s = s.substring(5);
  5274.                     byte1 = 2;
  5275.                 }
  5276.                 if ((k == 3 || k == 7) && (k == 7 || privateChatMode == 0 || privateChatMode == 1 && isFriendOrSelf(s))) {
  5277.                     int l = 329 - i * 13;
  5278.                     int k1 = 4;
  5279.                     textDrawingArea.method385(0, "From", l, k1);
  5280.                     textDrawingArea.method385(65535, "From", l - 1, k1);
  5281.                     k1 += textDrawingArea.getTextWidth("From ");
  5282.                     if (byte1 == 1) {
  5283.                         modIcons[0].method361(k1, l - 12);
  5284.                         k1 += 14;
  5285.                     }
  5286.                     if (byte1 == 2) {
  5287.                         modIcons[1].method361(k1, l - 12);
  5288.                         k1 += 14;
  5289.                     }
  5290.                     textDrawingArea.method385(0, s + ": " + chatMessages[j], l, k1);
  5291.                     textDrawingArea.method385(65535, s + ": " + chatMessages[j], l - 1, k1);
  5292.                     if (++i >= 5) {
  5293.                         return;
  5294.                     }
  5295.                 }
  5296.                 if (k == 5 && privateChatMode < 2) {
  5297.                     int i1 = 329 - i * 13;
  5298.                     textDrawingArea.method385(0, chatMessages[j], i1, 4);
  5299.                     textDrawingArea.method385(65535, chatMessages[j], i1 - 1, 4);
  5300.                     if (++i >= 5) {
  5301.                         return;
  5302.                     }
  5303.                 }
  5304.                 if (k == 6 && privateChatMode < 2) {
  5305.                     int j1 = 329 - i * 13;
  5306.                     textDrawingArea.method385(0, "To " + s + ": " + chatMessages[j], j1, 4);
  5307.                     textDrawingArea.method385(65535, "To " + s + ": " + chatMessages[j], j1 - 1, 4);
  5308.                     if (++i >= 5) {
  5309.                         return;
  5310.                     }
  5311.                 }
  5312.             }
  5313.         }
  5314.  
  5315.     }
  5316.  
  5317.     public void pushMessage(String s, int i, String s1) {
  5318.         if (i == 0 && dialogID != -1) {
  5319.             aString844 = s;
  5320.             super.clickMode3 = 0;
  5321.         }
  5322.         if (backDialogID == -1) {
  5323.             inputTaken = true;
  5324.         }
  5325.         for (int j = 99; j > 0; j--) {
  5326.             chatTypes[j] = chatTypes[j - 1];
  5327.             chatNames[j] = chatNames[j - 1];
  5328.             chatMessages[j] = chatMessages[j - 1];
  5329.         }
  5330.  
  5331.         chatTypes[0] = i;
  5332.         chatNames[0] = s1;
  5333.         chatMessages[0] = s;
  5334.     }
  5335.  
  5336.     public void processTabClick() {
  5337.         if (super.clickMode3 == 1) {
  5338.             if (super.saveClickX >= 539 && super.saveClickX <= 573 && super.saveClickY >= 169 && super.saveClickY < 205 && tabInterfaceIDs[0] != -1) {
  5339.                 needDrawTabArea = true;
  5340.                 tabID = 0;
  5341.                 tabAreaAltered = true;
  5342.             }
  5343.             if (super.saveClickX >= 569 && super.saveClickX <= 599 && super.saveClickY >= 168 && super.saveClickY < 205 && tabInterfaceIDs[1] != -1) {
  5344.                 needDrawTabArea = true;
  5345.                 tabID = 1;
  5346.                 tabAreaAltered = true;
  5347.             }
  5348.             if (super.saveClickX >= 597 && super.saveClickX <= 627 && super.saveClickY >= 168 && super.saveClickY < 205 && tabInterfaceIDs[2] != -1) {
  5349.                 needDrawTabArea = true;
  5350.                 tabID = 2;
  5351.                 tabAreaAltered = true;
  5352.             }
  5353.             if (super.saveClickX >= 625 && super.saveClickX <= 669 && super.saveClickY >= 168 && super.saveClickY < 203 && tabInterfaceIDs[3] != -1) {
  5354.                 needDrawTabArea = true;
  5355.                 tabID = 3;
  5356.                 tabAreaAltered = true;
  5357.             }
  5358.             if (super.saveClickX >= 666 && super.saveClickX <= 696 && super.saveClickY >= 168 && super.saveClickY < 205 && tabInterfaceIDs[4] != -1) {
  5359.                 needDrawTabArea = true;
  5360.                 tabID = 4;
  5361.                 tabAreaAltered = true;
  5362.             }
  5363.             if (super.saveClickX >= 694 && super.saveClickX <= 724 && super.saveClickY >= 168 && super.saveClickY < 205 && tabInterfaceIDs[5] != -1) {
  5364.                 needDrawTabArea = true;
  5365.                 tabID = 5;
  5366.                 tabAreaAltered = true;
  5367.             }
  5368.             if (super.saveClickX >= 722 && super.saveClickX <= 756 && super.saveClickY >= 169 && super.saveClickY < 205 && tabInterfaceIDs[6] != -1) {
  5369.                 needDrawTabArea = true;
  5370.                 tabID = 6;
  5371.                 tabAreaAltered = true;
  5372.             }
  5373.             if (super.saveClickX >= 540 && super.saveClickX <= 574 && super.saveClickY >= 466 && super.saveClickY < 502 && tabInterfaceIDs[7] != -1) {
  5374.                 needDrawTabArea = true;
  5375.                 tabID = 7;
  5376.                 tabAreaAltered = true;
  5377.             }
  5378.             if (super.saveClickX >= 572 && super.saveClickX <= 602 && super.saveClickY >= 466 && super.saveClickY < 503 && tabInterfaceIDs[8] != -1) {
  5379.                 needDrawTabArea = true;
  5380.                 tabID = 8;
  5381.                 tabAreaAltered = true;
  5382.             }
  5383.             if (super.saveClickX >= 599 && super.saveClickX <= 629 && super.saveClickY >= 466 && super.saveClickY < 503 && tabInterfaceIDs[9] != -1) {
  5384.                 needDrawTabArea = true;
  5385.                 tabID = 9;
  5386.                 tabAreaAltered = true;
  5387.             }
  5388.             if (super.saveClickX >= 627 && super.saveClickX <= 671 && super.saveClickY >= 467 && super.saveClickY < 502 && tabInterfaceIDs[10] != -1) {
  5389.                 needDrawTabArea = true;
  5390.                 tabID = 10;
  5391.                 tabAreaAltered = true;
  5392.             }
  5393.             if (super.saveClickX >= 669 && super.saveClickX <= 699 && super.saveClickY >= 466 && super.saveClickY < 503 && tabInterfaceIDs[11] != -1) {
  5394.                 needDrawTabArea = true;
  5395.                 tabID = 11;
  5396.                 tabAreaAltered = true;
  5397.             }
  5398.             if (super.saveClickX >= 696 && super.saveClickX <= 726 && super.saveClickY >= 466 && super.saveClickY < 503 && tabInterfaceIDs[12] != -1) {
  5399.                 needDrawTabArea = true;
  5400.                 tabID = 12;
  5401.                 tabAreaAltered = true;
  5402.             }
  5403.             if (super.saveClickX >= 724 && super.saveClickX <= 758 && super.saveClickY >= 466 && super.saveClickY < 502 && tabInterfaceIDs[13] != -1) {
  5404.                 needDrawTabArea = true;
  5405.                 tabID = 13;
  5406.                 tabAreaAltered = true;
  5407.             }
  5408.             if (anInt1054 == tabID) {
  5409.                 stream.createFrame(152);
  5410.                 stream.writeWordBigEndian(tabID);
  5411.             }
  5412.         }
  5413.     }
  5414.    
  5415.     public void resetImageProducers() {
  5416.         if (aRSImageProducer_1107 != null) {
  5417.             return;
  5418.         }
  5419.         super.fullGameScreen = null;
  5420.         aRSImageProducer_1166 = null;
  5421.         aRSImageProducer_1164 = null;
  5422.         aRSImageProducer_1163 = null;
  5423.         aRSImageProducer_1165 = null;
  5424.         aRSImageProducer_1123 = null;
  5425.         aRSImageProducer_1124 = null;
  5426.         aRSImageProducer_1125 = null;
  5427.         aRSImageProducer_1110 = new RSImageProducer(128, 265, getGameComponent());
  5428.         DrawingArea.setAllPixelsToZero();
  5429.         aRSImageProducer_1111 = new RSImageProducer(128, 265, getGameComponent());
  5430.         DrawingArea.setAllPixelsToZero();
  5431.         aRSImageProducer_1107 = new RSImageProducer(509, 171, getGameComponent());
  5432.         DrawingArea.setAllPixelsToZero();
  5433.         aRSImageProducer_1108 = new RSImageProducer(360, 132, getGameComponent());
  5434.         DrawingArea.setAllPixelsToZero();
  5435.         aRSImageProducer_1109 = new RSImageProducer(360, 200, getGameComponent());
  5436.         DrawingArea.setAllPixelsToZero();
  5437.         aRSImageProducer_1112 = new RSImageProducer(202, 238, getGameComponent());
  5438.         DrawingArea.setAllPixelsToZero();
  5439.         aRSImageProducer_1113 = new RSImageProducer(203, 238, getGameComponent());
  5440.         DrawingArea.setAllPixelsToZero();
  5441.         aRSImageProducer_1114 = new RSImageProducer(74, 94, getGameComponent());
  5442.         DrawingArea.setAllPixelsToZero();
  5443.         aRSImageProducer_1115 = new RSImageProducer(75, 94, getGameComponent());
  5444.         DrawingArea.setAllPixelsToZero();
  5445.         if (titleStreamLoader != null) {
  5446.             drawLogo();
  5447.             loadTitleScreen();
  5448.         }
  5449.         welcomeScreenRaised = true;
  5450.     }
  5451.    
  5452.     public void resetAllImageProducers() {
  5453.         if (super.fullGameScreen != null)
  5454.             return;
  5455.         nullLoader();
  5456.         aRSImageProducer_1107 = null;
  5457.         aRSImageProducer_1108 = null;
  5458.         aRSImageProducer_1109 = null;
  5459.         aRSImageProducer_1112 = null;
  5460.         aRSImageProducer_1113 = null;
  5461.         aRSImageProducer_1114 = null;
  5462.         aRSImageProducer_1115 = null;
  5463.         aRSImageProducer_1166 = null;
  5464.         aRSImageProducer_1164 = null;
  5465.         aRSImageProducer_1163 = null;
  5466.         aRSImageProducer_1165 = null;
  5467.         aRSImageProducer_1123 = null;
  5468.         aRSImageProducer_1125 = null;
  5469.         aRSImageProducer_1124 = null;
  5470.         super.fullGameScreen = new RSImageProducer(765, 503, getGameComponent());
  5471.         welcomeScreenRaised = true;
  5472.     }
  5473.  
  5474.     public void resetImageProducers2() {
  5475.         if (aRSImageProducer_1166 != null) {
  5476.             return;
  5477.         }
  5478.         nullLoader();
  5479.         super.fullGameScreen = null;
  5480.         aRSImageProducer_1107 = null;
  5481.         aRSImageProducer_1108 = null;
  5482.         aRSImageProducer_1109 = null;
  5483.         aRSImageProducer_1110 = null;
  5484.         aRSImageProducer_1111 = null;
  5485.         aRSImageProducer_1112 = null;
  5486.         aRSImageProducer_1113 = null;
  5487.         aRSImageProducer_1114 = null;
  5488.         aRSImageProducer_1115 = null;
  5489.         aRSImageProducer_1166 = new RSImageProducer(479, 96, getGameComponent());
  5490.         aRSImageProducer_1164 = new RSImageProducer(172, 156, getGameComponent());
  5491.         DrawingArea.setAllPixelsToZero();
  5492.         mapBack.method361(0, 0);
  5493.         aRSImageProducer_1163 = new RSImageProducer(190, 261, getGameComponent());
  5494.         aRSImageProducer_1165 = new RSImageProducer(512, 334, getGameComponent());
  5495.         DrawingArea.setAllPixelsToZero();
  5496.         aRSImageProducer_1123 = new RSImageProducer(496, 50, getGameComponent());
  5497.         aRSImageProducer_1124 = new RSImageProducer(269, 37, getGameComponent());
  5498.         aRSImageProducer_1125 = new RSImageProducer(249, 45, getGameComponent());
  5499.         welcomeScreenRaised = true;
  5500.         aRSImageProducer_1165.initDrawingArea();
  5501.         Texture.lineOffsets = chatBoxAreaOffsets;
  5502.         // SignLink.midii.fadeOut();
  5503.     }
  5504.  
  5505.     public void method81(Sprite sprite, int y, int x) {
  5506.         int l = x * x + y * y;
  5507.         if (l > 4225 && l < 90000) {
  5508.             int i1 = minimapInt1 + minimapInt2 & 0x7ff;
  5509.             int j1 = Model.modelIntArray1[i1];
  5510.             int k1 = Model.modelIntArray2[i1];
  5511.             j1 = (j1 * 256) / (minimapInt3 + 256);
  5512.             k1 = (k1 * 256) / (minimapInt3 + 256);
  5513.             int l1 = y * j1 + x * k1 >> 16;
  5514.             int i2 = y * k1 - x * j1 >> 16;
  5515.             double d = Math.atan2((double) l1, (double) i2);
  5516.             int j2 = (int) (Math.sin(d) * 63D);
  5517.             int k2 = (int) (Math.cos(d) * 57D);
  5518.             mapEdge.method353(83 - k2 - 20, d, 94 + j2 + 4 - 10);
  5519.         } else {
  5520.             markMinimap(sprite, x, y);
  5521.         }
  5522.     }
  5523.  
  5524.     public void processRightClick() {
  5525.         if (activeInterfaceType != 0) {
  5526.             return;
  5527.         }
  5528.         menuActionName[0] = "Cancel";
  5529.         menuActionID[0] = 1107;
  5530.         menuActionRow = 1;
  5531.         if(fullScreenBackDialogID != -1) {
  5532.             anInt886 = 0;
  5533.             buildInterfaceMenu(0, RSInterface.interfaceCache[fullScreenBackDialogID], super.mouseX, 0, super.mouseY, 0);
  5534.             if (anInt886 != anInt1026) {
  5535.                 anInt1026 = anInt886;
  5536.             }
  5537.             return;
  5538.         }
  5539.         buildSplitPrivateChatMenu();
  5540.         anInt886 = 0;
  5541.         if (super.mouseX > 4 && super.mouseY > 4 && super.mouseX < 516 && super.mouseY < 338) {
  5542.             if (openInterfaceID != -1) {
  5543.                 buildInterfaceMenu(4, RSInterface.interfaceCache[openInterfaceID], super.mouseX, 4, super.mouseY, 0);
  5544.             } else {
  5545.                 build3dScreenMenu();
  5546.             }
  5547.         }
  5548.         if (anInt886 != anInt1026) {
  5549.             anInt1026 = anInt886;
  5550.         }
  5551.         anInt886 = 0;
  5552.         if (super.mouseX > 553 && super.mouseY > 205 && super.mouseX < 743 && super.mouseY < 466) {
  5553.             if (invOverlayInterfaceID != -1) {
  5554.                 buildInterfaceMenu(553, RSInterface.interfaceCache[invOverlayInterfaceID], super.mouseX, 205, super.mouseY, 0);
  5555.             } else if (tabInterfaceIDs[tabID] != -1) {
  5556.                 buildInterfaceMenu(553, RSInterface.interfaceCache[tabInterfaceIDs[tabID]], super.mouseX, 205, super.mouseY, 0);
  5557.             }
  5558.         }
  5559.         if (anInt886 != anInt1048) {
  5560.             needDrawTabArea = true;
  5561.             anInt1048 = anInt886;
  5562.         }
  5563.         anInt886 = 0;
  5564.         if (super.mouseX > 17 && super.mouseY > 357 && super.mouseX < 496 && super.mouseY < 453) {
  5565.             if (backDialogID != -1) {
  5566.                 buildInterfaceMenu(17, RSInterface.interfaceCache[backDialogID], super.mouseX, 357, super.mouseY, 0);
  5567.             } else if (dialogID != -1) {
  5568.                 buildInterfaceMenu(17, RSInterface.interfaceCache[dialogID], super.mouseX, 357, super.mouseY, 0);
  5569.             } else if (super.mouseY < 434 && super.mouseX < 426) {
  5570.                 buildChatAreaMenu(super.mouseY - 357);
  5571.             }
  5572.         }
  5573.         if ((backDialogID != -1 || dialogID != -1) && anInt886 != anInt1039) {//TODO remove if any issues
  5574.             inputTaken = true;
  5575.             anInt1039 = anInt886;
  5576.         }
  5577.         boolean flag = false;
  5578.         while (!flag) {
  5579.             flag = true;
  5580.             for (int j = 0; j < menuActionRow - 1; j++) {
  5581.                 if (menuActionID[j] < 1000 && menuActionID[j + 1] > 1000) {
  5582.                     String s = menuActionName[j];
  5583.                     menuActionName[j] = menuActionName[j + 1];
  5584.                     menuActionName[j + 1] = s;
  5585.                     int k = menuActionID[j];
  5586.                     menuActionID[j] = menuActionID[j + 1];
  5587.                     menuActionID[j + 1] = k;
  5588.                     k = menuActionCmd2[j];
  5589.                     menuActionCmd2[j] = menuActionCmd2[j + 1];
  5590.                     menuActionCmd2[j + 1] = k;
  5591.                     k = menuActionCmd3[j];
  5592.                     menuActionCmd3[j] = menuActionCmd3[j + 1];
  5593.                     menuActionCmd3[j + 1] = k;
  5594.                     k = menuActionCmd1[j];
  5595.                     menuActionCmd1[j] = menuActionCmd1[j + 1];
  5596.                     menuActionCmd1[j + 1] = k;
  5597.                     flag = false;
  5598.                 }
  5599.             }
  5600.  
  5601.         }
  5602.     }
  5603.  
  5604.     public int method83(int i, int j, int k) {
  5605.         int l = 256 - k;
  5606.         return ((i & 0xff00ff) * l + (j & 0xff00ff) * k & 0xff00ff00) + ((i & 0xff00) * l + (j & 0xff00) * k & 0xff0000) >> 8;
  5607.     }
  5608.  
  5609.     public void login(String s, String s1, boolean flag) {
  5610.         Signlink.errorname = s;
  5611.         try {
  5612.             if (!flag) {
  5613.                 loginMessage1 = "";
  5614.                 loginMessage2 = "Connecting to server...";
  5615.                 drawLoginScreen(true);
  5616.             }
  5617.             socketStream = new RSSocket(this, openSocket(43594 + portOff));
  5618.             long l = TextClass.longForName(s);
  5619.             int i = (int) (l >> 16 & 31L);
  5620.             stream.currentOffset = 0;
  5621.             stream.writeWordBigEndian(14);
  5622.             stream.writeWordBigEndian(i);
  5623.             socketStream.queueBytes(2, stream.buffer);
  5624.             for (int j = 0; j < 8; j++) {
  5625.                 socketStream.read();
  5626.             }
  5627.  
  5628.             int k = socketStream.read();
  5629.             int i1 = k;
  5630.             if (k == 0) {
  5631.                 socketStream.flushInputStream(inStream.buffer, 8);
  5632.                 inStream.currentOffset = 0;
  5633.                 aLong1215 = inStream.readQWord();
  5634.                 int ai[] = new int[4];
  5635.                 ai[0] = (int) (Math.random() * 99999999D);
  5636.                 ai[1] = (int) (Math.random() * 99999999D);
  5637.                 ai[2] = (int) (aLong1215 >> 32);
  5638.                 ai[3] = (int) aLong1215;
  5639.                 stream.currentOffset = 0;
  5640.                 stream.writeWordBigEndian(10);
  5641.                 stream.writeDWord(ai[0]);
  5642.                 stream.writeDWord(ai[1]);
  5643.                 stream.writeDWord(ai[2]);
  5644.                 stream.writeDWord(ai[3]);
  5645.                 stream.writeDWord(ClientSettings.UID);
  5646.                 stream.writeString(s);
  5647.                 stream.writeString(s1);
  5648.                 stream.doKeys();
  5649.                 aStream_847.currentOffset = 0;
  5650.                 if (flag) {
  5651.                     aStream_847.writeWordBigEndian(18);
  5652.                 } else {
  5653.                     aStream_847.writeWordBigEndian(16);
  5654.                 }
  5655.                 aStream_847.writeWordBigEndian(stream.currentOffset + 36 + 1 + 1 + 2);
  5656.                 aStream_847.writeWordBigEndian(255);
  5657.                 aStream_847.writeWord(1);
  5658.                 aStream_847.writeWordBigEndian(lowMem ? 1 : 0);
  5659.                 for (int l1 = 0; l1 < 9; l1++) {
  5660.                     aStream_847.writeDWord(expectedCRCs[l1]);
  5661.                 }
  5662.  
  5663.                 aStream_847.writeBytes(stream.buffer, stream.currentOffset, 0);
  5664.                 stream.encryption = new ISAACRandomGen(ai);
  5665.                 for (int j2 = 0; j2 < 4; j2++) {
  5666.                     ai[j2] += 50;
  5667.                 }
  5668.  
  5669.                 encryption = new ISAACRandomGen(ai);
  5670.                 socketStream.queueBytes(aStream_847.currentOffset, aStream_847.buffer);
  5671.                 k = socketStream.read();
  5672.             }
  5673.             if (k == 1) {
  5674.                 try {
  5675.                     Thread.sleep(2000L);
  5676.                 } catch (Exception _ex) {
  5677.                 }
  5678.                 login(s, s1, flag);
  5679.                 return;
  5680.             }
  5681.             if (k == 2) {
  5682.                 myPrivilege = socketStream.read();
  5683.                 flagged = socketStream.read() == 1;
  5684.                 aLong1220 = 0L;
  5685.                 anInt1022 = 0;
  5686.                 mouseDetection.coordsIndex = 0;
  5687.                 super.awtFocus = true;
  5688.                 aBoolean954 = true;
  5689.                 loggedIn = true;
  5690.                 stream.currentOffset = 0;
  5691.                 inStream.currentOffset = 0;
  5692.                 pktType = -1;
  5693.                 anInt841 = -1;
  5694.                 anInt842 = -1;
  5695.                 anInt843 = -1;
  5696.                 pktSize = 0;
  5697.                 anInt1009 = 0;
  5698.                 anInt1104 = 0;
  5699.                 anInt1011 = 0;
  5700.                 anInt855 = 0;
  5701.                 menuActionRow = 0;
  5702.                 menuOpen = false;
  5703.                 super.idleTime = 0;
  5704.                 for (int j1 = 0; j1 < 100; j1++) {
  5705.                     chatMessages[j1] = null;
  5706.                 }
  5707.  
  5708.                 itemSelected = 0;
  5709.                 spellSelected = 0;
  5710.                 loadingStage = 0;
  5711.                 currentSound = 0;
  5712.                 anInt1278 = (int) (Math.random() * 100D) - 50;
  5713.                 anInt1131 = (int) (Math.random() * 110D) - 55;
  5714.                 anInt896 = (int) (Math.random() * 80D) - 40;
  5715.                 minimapInt2 = (int) (Math.random() * 120D) - 60;
  5716.                 minimapInt3 = (int) (Math.random() * 30D) - 20;
  5717.                 minimapInt1 = (int) (Math.random() * 20D) - 10 & 0x7ff;
  5718.                 anInt1021 = 0;
  5719.                 anInt985 = -1;
  5720.                 destX = 0;
  5721.                 destY = 0;
  5722.                 playerCount = 0;
  5723.                 npcCount = 0;
  5724.                 for (int i2 = 0; i2 < maxPlayers; i2++) {
  5725.                     playerArray[i2] = null;
  5726.                     aStreamArray895s[i2] = null;
  5727.                 }
  5728.  
  5729.                 for (int k2 = 0; k2 < 16384; k2++) {
  5730.                     npcArray[k2] = null;
  5731.                 }
  5732.  
  5733.                 myPlayer = playerArray[myPlayerIndex] = new Player();
  5734.                 aClass19_1013.removeAll();
  5735.                 aClass19_1056.removeAll();
  5736.                 for (int l2 = 0; l2 < 4; l2++) {
  5737.                     for (int i3 = 0; i3 < 104; i3++) {
  5738.                         for (int k3 = 0; k3 < 104; k3++) {
  5739.                             groundArray[l2][i3][k3] = null;
  5740.                         }
  5741.  
  5742.                     }
  5743.  
  5744.                 }
  5745.  
  5746.                 aClass19_1179 = new NodeList();
  5747.                 anInt900 = 0;
  5748.                 friendsCount = 0;
  5749.                 dialogID = -1;
  5750.                 backDialogID = -1;
  5751.                 openInterfaceID = -1;
  5752.                 invOverlayInterfaceID = -1;
  5753.                 fullScreenBackDialogID = -1;
  5754.                 fullScreenInterfaceId = -1;
  5755.                 anInt1018 = -1;
  5756.                 aBoolean1149 = false;
  5757.                 tabID = 3;
  5758.                 inputDialogState = 0;
  5759.                 menuOpen = false;
  5760.                 messagePromptRaised = false;
  5761.                 aString844 = null;
  5762.                 anInt1055 = 0;
  5763.                 anInt1054 = -1;
  5764.                 aBoolean1047 = true;
  5765.                 method45();
  5766.                 for (int j3 = 0; j3 < 5; j3++) {
  5767.                     anIntArray990[j3] = 0;
  5768.                 }
  5769.  
  5770.                 for (int l3 = 0; l3 < 5; l3++) {
  5771.                     atPlayerActions[l3] = null;
  5772.                     atPlayerArray[l3] = false;
  5773.                 }
  5774.  
  5775.                 anInt1175 = 0;
  5776.                 anInt1134 = 0;
  5777.                 anInt986 = 0;
  5778.                 anInt1288 = 0;
  5779.                 anInt924 = 0;
  5780.                 anInt1188 = 0;
  5781.                 anInt1155 = 0;
  5782.                 anInt1226 = 0;
  5783.                 resetImageProducers2();
  5784.                 return;
  5785.             }
  5786.             if (k == 3) {
  5787.                 loginMessage1 = "";
  5788.                 loginMessage2 = "Invalid username or password.";
  5789.                 return;
  5790.             }
  5791.             if (k == 4) {
  5792.                 loginMessage1 = "Your account has been disabled.";
  5793.                 loginMessage2 = "Please check your message-center for details.";
  5794.                 return;
  5795.             }
  5796.             if (k == 5) {
  5797.                 loginMessage1 = "Your account is already logged in.";
  5798.                 loginMessage2 = "Try again in 60 secs...";
  5799.                 return;
  5800.             }
  5801.             if (k == 6) {
  5802.                 loginMessage1 = "" + ClientSettings.SERVER_NAME + " has been updated!";
  5803.                 loginMessage2 = "Please reload this page.";
  5804.                 return;
  5805.             }
  5806.             if (k == 7) {
  5807.                 loginMessage1 = "This world is full.";
  5808.                 loginMessage2 = "Please use a different world.";
  5809.                 return;
  5810.             }
  5811.             if (k == 8) {
  5812.                 loginMessage1 = "Unable to connect.";
  5813.                 loginMessage2 = "Login server offline.";
  5814.                 return;
  5815.             }
  5816.             if (k == 9) {
  5817.                 loginMessage1 = "Login limit exceeded.";
  5818.                 loginMessage2 = "Too many connections from your address.";
  5819.                 return;
  5820.             }
  5821.             if (k == 10) {
  5822.                 loginMessage1 = "Unable to connect.";
  5823.                 loginMessage2 = "Bad session id.";
  5824.                 return;
  5825.             }
  5826.             if (k == 11) {
  5827.                 loginMessage2 = "Login server rejected session.";
  5828.                 loginMessage2 = "Please try again.";
  5829.                 return;
  5830.             }
  5831.             if (k == 12) {
  5832.                 loginMessage1 = "Only staff are allowed to play right now.";
  5833.                 loginMessage2 = "Please login using a staff account.";
  5834.                 //loginMessage1 = "You need a members account to login to this world.";
  5835.                 //loginMessage2 = "Please subscribe, or use a different world.";
  5836.                 return;
  5837.             }
  5838.             if (k == 13) {
  5839.                 loginMessage1 = "Could not complete login.";
  5840.                 loginMessage2 = "Please try using a different world.";
  5841.                 return;
  5842.             }
  5843.             if (k == 14) {
  5844.                 loginMessage1 = "The server is being updated.";
  5845.                 loginMessage2 = "Please wait 1 minute and try again.";
  5846.                 return;
  5847.             }
  5848.             if (k == 15) {
  5849.                 loggedIn = true;
  5850.                 stream.currentOffset = 0;
  5851.                 inStream.currentOffset = 0;
  5852.                 pktType = -1;
  5853.                 anInt841 = -1;
  5854.                 anInt842 = -1;
  5855.                 anInt843 = -1;
  5856.                 pktSize = 0;
  5857.                 anInt1009 = 0;
  5858.                 anInt1104 = 0;
  5859.                 menuActionRow = 0;
  5860.                 menuOpen = false;
  5861.                 aLong824 = System.currentTimeMillis();
  5862.                 return;
  5863.             }
  5864.             if (k == 16) {
  5865.                 loginMessage1 = "Login attempts exceeded.";
  5866.                 loginMessage2 = "Please wait 1 minute and try again.";
  5867.                 return;
  5868.             }
  5869.             if (k == 17) {
  5870.                 loginMessage1 = "You are standing in a members-only area.";
  5871.                 loginMessage2 = "To play on this world move to a free area first";
  5872.                 return;
  5873.             }
  5874.             if (k == 20) {
  5875.                 loginMessage1 = "Invalid loginserver requested";
  5876.                 loginMessage2 = "Please try using a different world.";
  5877.                 return;
  5878.             }
  5879.             if (k == 30) {
  5880.                 loginMessage1 = "You need a forum account to play.";
  5881.                 loginMessage2 = "Go to " + ClientSettings.SERVER_WEBSITE + " to register.";
  5882.                 return;
  5883.             }
  5884.             if (k == 31) {
  5885.                 loginMessage1 = "You're using an invalid or outdated client.";
  5886.                 loginMessage2 = "Get the latest version at " + ClientSettings.SERVER_WEBSITE + "";
  5887.                 return;
  5888.             }
  5889.             if (k == 32) {
  5890.                 loginMessage1 = "You need to recover your account first,";
  5891.                 loginMessage2 = "go to " + ClientSettings.SERVER_WEBSITE + "/help for a tutorial!";
  5892.                 return;
  5893.             }
  5894.             if (k == 33) {
  5895.                 loginMessage1 = "You need a members account to login to this world.";
  5896.                 loginMessage2 = "Please subscribe, or use a different world.";
  5897.                 return;
  5898.             }
  5899.             if (k == 34) {
  5900.                 loginMessage1 = "You need to activate your forum account first.";
  5901.                 loginMessage2 = "Click on confirm in the email we have send you!";
  5902.                 return;
  5903.             }
  5904.             if (k == 21) {
  5905.                 for (int k1 = socketStream.read(); k1 >= 0; k1--) {
  5906.                     loginMessage1 = "You have only just left another world";
  5907.                     loginMessage2 = "Your profile will be transferred in: " + k1 + " seconds";
  5908.                     drawLoginScreen(true);
  5909.                     try {
  5910.                         Thread.sleep(1000L);
  5911.                     } catch (Exception _ex) {
  5912.                     }
  5913.                 }
  5914.  
  5915.                 login(s, s1, flag);
  5916.                 return;
  5917.             }
  5918.             if (k == -1) {
  5919.                 if (i1 == 0) {
  5920.                     if (loginFailures < 2) {
  5921.                         try {
  5922.                             Thread.sleep(2000L);
  5923.                         } catch (Exception _ex) {
  5924.                         }
  5925.                         loginFailures++;
  5926.                         login(s, s1, flag);
  5927.                         return;
  5928.                     } else {
  5929.                         loginMessage1 = "Error connecting to server.";
  5930.                         loginMessage2 = "Please try again in a little while.";
  5931.                         return;
  5932.                     }
  5933.                 } else {
  5934.                     loginMessage1 = "No response from server";
  5935.                     loginMessage2 = "Please try using a different world.";
  5936.                     return;
  5937.                 }
  5938.             } else {
  5939.                 System.out.println("response:" + k);
  5940.                 loginMessage1 = "Unexpected server response";
  5941.                 loginMessage2 = "Please try using a different world.";
  5942.                 return;
  5943.             }
  5944.         } catch (IOException _ex) {
  5945.             loginMessage1 = "";
  5946.         }
  5947.         loginMessage2 = "Error connecting to server.";
  5948.     }
  5949.  
  5950.     public boolean doWalkTo(int i, int j, int k, int i1, int j1, int k1, int l1, int i2, int j2, boolean flag, int k2) {
  5951.         byte byte0 = 104;
  5952.         byte byte1 = 104;
  5953.         for (int l2 = 0; l2 < byte0; l2++) {
  5954.             for (int i3 = 0; i3 < byte1; i3++) {
  5955.                 anIntArrayArray901[l2][i3] = 0;
  5956.                 anIntArrayArray825[l2][i3] = 0x5f5e0ff;
  5957.             }
  5958.  
  5959.         }
  5960.  
  5961.         int j3 = j2;
  5962.         int k3 = j1;
  5963.         anIntArrayArray901[j2][j1] = 99;
  5964.         anIntArrayArray825[j2][j1] = 0;
  5965.         int l3 = 0;
  5966.         int i4 = 0;
  5967.         bigX[l3] = j2;
  5968.         bigY[l3++] = j1;
  5969.         boolean flag1 = false;
  5970.         int j4 = bigX.length;
  5971.         int ai[][] = aClass11Array1230[plane].anIntArrayArray294;
  5972.         while (i4 != l3) {
  5973.             j3 = bigX[i4];
  5974.             k3 = bigY[i4];
  5975.             i4 = (i4 + 1) % j4;
  5976.             if (j3 == k2 && k3 == i2) {
  5977.                 flag1 = true;
  5978.                 break;
  5979.             }
  5980.             if (i1 != 0) {
  5981.                 if ((i1 < 5 || i1 == 10) && aClass11Array1230[plane].method219(k2, j3, k3, j, i1 - 1, i2)) {
  5982.                     flag1 = true;
  5983.                     break;
  5984.                 }
  5985.                 if (i1 < 10 && aClass11Array1230[plane].method220(k2, i2, k3, i1 - 1, j, j3)) {
  5986.                     flag1 = true;
  5987.                     break;
  5988.                 }
  5989.             }
  5990.             if (k1 != 0 && k != 0 && aClass11Array1230[plane].method221(i2, k2, j3, k, l1, k1, k3)) {
  5991.                 flag1 = true;
  5992.                 break;
  5993.             }
  5994.             int l4 = anIntArrayArray825[j3][k3] + 1;
  5995.             if (j3 > 0 && anIntArrayArray901[j3 - 1][k3] == 0 && (ai[j3 - 1][k3] & 0x1280108) == 0) {
  5996.                 bigX[l3] = j3 - 1;
  5997.                 bigY[l3] = k3;
  5998.                 l3 = (l3 + 1) % j4;
  5999.                 anIntArrayArray901[j3 - 1][k3] = 2;
  6000.                 anIntArrayArray825[j3 - 1][k3] = l4;
  6001.             }
  6002.             if (j3 < byte0 - 1 && anIntArrayArray901[j3 + 1][k3] == 0 && (ai[j3 + 1][k3] & 0x1280180) == 0) {
  6003.                 bigX[l3] = j3 + 1;
  6004.                 bigY[l3] = k3;
  6005.                 l3 = (l3 + 1) % j4;
  6006.                 anIntArrayArray901[j3 + 1][k3] = 8;
  6007.                 anIntArrayArray825[j3 + 1][k3] = l4;
  6008.             }
  6009.             if (k3 > 0 && anIntArrayArray901[j3][k3 - 1] == 0 && (ai[j3][k3 - 1] & 0x1280102) == 0) {
  6010.                 bigX[l3] = j3;
  6011.                 bigY[l3] = k3 - 1;
  6012.                 l3 = (l3 + 1) % j4;
  6013.                 anIntArrayArray901[j3][k3 - 1] = 1;
  6014.                 anIntArrayArray825[j3][k3 - 1] = l4;
  6015.             }
  6016.             if (k3 < byte1 - 1 && anIntArrayArray901[j3][k3 + 1] == 0 && (ai[j3][k3 + 1] & 0x1280120) == 0) {
  6017.                 bigX[l3] = j3;
  6018.                 bigY[l3] = k3 + 1;
  6019.                 l3 = (l3 + 1) % j4;
  6020.                 anIntArrayArray901[j3][k3 + 1] = 4;
  6021.                 anIntArrayArray825[j3][k3 + 1] = l4;
  6022.             }
  6023.             if (j3 > 0 && k3 > 0 && anIntArrayArray901[j3 - 1][k3 - 1] == 0 && (ai[j3 - 1][k3 - 1] & 0x128010e) == 0 && (ai[j3 - 1][k3] & 0x1280108) == 0 && (ai[j3][k3 - 1] & 0x1280102) == 0) {
  6024.                 bigX[l3] = j3 - 1;
  6025.                 bigY[l3] = k3 - 1;
  6026.                 l3 = (l3 + 1) % j4;
  6027.                 anIntArrayArray901[j3 - 1][k3 - 1] = 3;
  6028.                 anIntArrayArray825[j3 - 1][k3 - 1] = l4;
  6029.             }
  6030.             if (j3 < byte0 - 1 && k3 > 0 && anIntArrayArray901[j3 + 1][k3 - 1] == 0 && (ai[j3 + 1][k3 - 1] & 0x1280183) == 0 && (ai[j3 + 1][k3] & 0x1280180) == 0 && (ai[j3][k3 - 1] & 0x1280102) == 0) {
  6031.                 bigX[l3] = j3 + 1;
  6032.                 bigY[l3] = k3 - 1;
  6033.                 l3 = (l3 + 1) % j4;
  6034.                 anIntArrayArray901[j3 + 1][k3 - 1] = 9;
  6035.                 anIntArrayArray825[j3 + 1][k3 - 1] = l4;
  6036.             }
  6037.             if (j3 > 0 && k3 < byte1 - 1 && anIntArrayArray901[j3 - 1][k3 + 1] == 0 && (ai[j3 - 1][k3 + 1] & 0x1280138) == 0 && (ai[j3 - 1][k3] & 0x1280108) == 0 && (ai[j3][k3 + 1] & 0x1280120) == 0) {
  6038.                 bigX[l3] = j3 - 1;
  6039.                 bigY[l3] = k3 + 1;
  6040.                 l3 = (l3 + 1) % j4;
  6041.                 anIntArrayArray901[j3 - 1][k3 + 1] = 6;
  6042.                 anIntArrayArray825[j3 - 1][k3 + 1] = l4;
  6043.             }
  6044.             if (j3 < byte0 - 1 && k3 < byte1 - 1 && anIntArrayArray901[j3 + 1][k3 + 1] == 0 && (ai[j3 + 1][k3 + 1] & 0x12801e0) == 0 && (ai[j3 + 1][k3] & 0x1280180) == 0 && (ai[j3][k3 + 1] & 0x1280120) == 0) {
  6045.                 bigX[l3] = j3 + 1;
  6046.                 bigY[l3] = k3 + 1;
  6047.                 l3 = (l3 + 1) % j4;
  6048.                 anIntArrayArray901[j3 + 1][k3 + 1] = 12;
  6049.                 anIntArrayArray825[j3 + 1][k3 + 1] = l4;
  6050.             }
  6051.         }
  6052.         anInt1264 = 0;
  6053.         if (!flag1) {
  6054.             if (flag) {
  6055.                 int i5 = 100;
  6056.                 for (int k5 = 1; k5 < 2; k5++) {
  6057.                     for (int i6 = k2 - k5; i6 <= k2 + k5; i6++) {
  6058.                         for (int l6 = i2 - k5; l6 <= i2 + k5; l6++) {
  6059.                             if (i6 >= 0 && l6 >= 0 && i6 < 104 && l6 < 104 && anIntArrayArray825[i6][l6] < i5) {
  6060.                                 i5 = anIntArrayArray825[i6][l6];
  6061.                                 j3 = i6;
  6062.                                 k3 = l6;
  6063.                                 anInt1264 = 1;
  6064.                                 flag1 = true;
  6065.                             }
  6066.                         }
  6067.  
  6068.                     }
  6069.  
  6070.                     if (flag1) {
  6071.                         break;
  6072.                     }
  6073.                 }
  6074.  
  6075.             }
  6076.             if (!flag1) {
  6077.                 return false;
  6078.             }
  6079.         }
  6080.         i4 = 0;
  6081.         bigX[i4] = j3;
  6082.         bigY[i4++] = k3;
  6083.         int l5;
  6084.         for (int j5 = l5 = anIntArrayArray901[j3][k3]; j3 != j2 || k3 != j1; j5 = anIntArrayArray901[j3][k3]) {
  6085.             if (j5 != l5) {
  6086.                 l5 = j5;
  6087.                 bigX[i4] = j3;
  6088.                 bigY[i4++] = k3;
  6089.             }
  6090.             if ((j5 & 2) != 0) {
  6091.                 j3++;
  6092.             } else if ((j5 & 8) != 0) {
  6093.                 j3--;
  6094.             }
  6095.             if ((j5 & 1) != 0) {
  6096.                 k3++;
  6097.             } else if ((j5 & 4) != 0) {
  6098.                 k3--;
  6099.             }
  6100.         }
  6101.         // if(cancelWalk) { return i4 > 0; }
  6102.  
  6103.         if (i4 > 0) {
  6104.             int k4 = i4;
  6105.             if (k4 > 25) {
  6106.                 k4 = 25;
  6107.             }
  6108.             i4--;
  6109.             int k6 = bigX[i4];
  6110.             int i7 = bigY[i4];
  6111.             anInt1288 += k4;
  6112.             if (anInt1288 >= 92) {
  6113.                 stream.createFrame(36);
  6114.                 stream.writeDWord(0);
  6115.                 anInt1288 = 0;
  6116.             }
  6117.             if (i == 0) {
  6118.                 stream.createFrame(164);
  6119.                 stream.writeWordBigEndian(k4 + k4 + 3);
  6120.             }
  6121.             if (i == 1) {
  6122.                 stream.createFrame(248);
  6123.                 stream.writeWordBigEndian(k4 + k4 + 3 + 14);
  6124.             }
  6125.             if (i == 2) {
  6126.                 stream.createFrame(98);
  6127.                 stream.writeWordBigEndian(k4 + k4 + 3);
  6128.             }
  6129.             stream.method433(k6 + baseX);
  6130.             destX = bigX[0];
  6131.             destY = bigY[0];
  6132.             for (int j7 = 1; j7 < k4; j7++) {
  6133.                 i4--;
  6134.                 stream.writeWordBigEndian(bigX[i4] - k6);
  6135.                 stream.writeWordBigEndian(bigY[i4] - i7);
  6136.             }
  6137.  
  6138.             stream.method431(i7 + baseY);
  6139.             stream.method424(super.keyArray[5] != 1 ? 0 : 1);
  6140.             return true;
  6141.         }
  6142.         return i != 1;
  6143.     }
  6144.    
  6145.     static final int method77(int i, int i_1_) {
  6146.         if (i_1_ == -2)
  6147.             return 12345678;
  6148.         if (i_1_ == -1) {
  6149.             if (i < 0)
  6150.                 i = 0;
  6151.             else if (i > 127)
  6152.                 i = 127;
  6153.             i = 127 - i;
  6154.             return i;
  6155.         }
  6156.         i = i * (i_1_ & 0x7f) / 128;
  6157.         if (i < 2)
  6158.             i = 2;
  6159.         else if (i > 126)
  6160.             i = 126;
  6161.         return (i_1_ & 0xff80) + i;
  6162.     }
  6163.  
  6164.     public void method86(Stream stream) {
  6165.         for (int j = 0; j < anInt893; j++) {
  6166.             int k = anIntArray894[j];
  6167.             NPC npc = npcArray[k];
  6168.             int l = stream.readUnsignedByte();
  6169.             if ((l & 0x10) != 0) {
  6170.                 int i1 = stream.method434();
  6171.                 if (i1 == 65535) {
  6172.                     i1 = -1;
  6173.                 }
  6174.                 int i2 = stream.readUnsignedByte();
  6175.                 if (i1 == npc.anim && i1 != -1) {
  6176.                     int l2 = Animation.anims[i1].anInt365;
  6177.                     if (l2 == 1) {
  6178.                         npc.anInt1527 = 0;
  6179.                         npc.anInt1528 = 0;
  6180.                         npc.anInt1529 = i2;
  6181.                         npc.anInt1530 = 0;
  6182.                     }
  6183.                     if (l2 == 2) {
  6184.                         npc.anInt1530 = 0;
  6185.                     }
  6186.                 } else if (i1 == -1 || npc.anim == -1 || Animation.anims[i1].anInt359 >= Animation.anims[npc.anim].anInt359) {
  6187.                     npc.anim = i1;
  6188.                     npc.anInt1527 = 0;
  6189.                     npc.anInt1528 = 0;
  6190.                     npc.anInt1529 = i2;
  6191.                     npc.anInt1530 = 0;
  6192.                     npc.anInt1542 = npc.smallXYIndex;
  6193.                 }
  6194.             }
  6195.             if ((l & 8) != 0) {
  6196.                 int j1 = stream.readUnsignedByteA();
  6197.                 int j2 = stream.method427();
  6198.                 npc.updateHitData(j2, j1, loopCycle);
  6199.                 npc.loopCycleStatus = loopCycle + 300;
  6200.                 npc.currentHealth = stream.readUnsignedByteA();
  6201.                 npc.maxHealth = stream.readUnsignedByte();
  6202.             }
  6203.             if ((l & 0x80) != 0) {
  6204.                 npc.anInt1520 = stream.readUnsignedWord();
  6205.                 int k1 = stream.readDWord();
  6206.                 npc.anInt1524 = k1 >> 16;
  6207.                 npc.anInt1523 = loopCycle + (k1 & 0xffff);
  6208.                 npc.anInt1521 = 0;
  6209.                 npc.anInt1522 = 0;
  6210.                 if (npc.anInt1523 > loopCycle) {
  6211.                     npc.anInt1521 = -1;
  6212.                 }
  6213.                 if (npc.anInt1520 == 65535) {
  6214.                     npc.anInt1520 = -1;
  6215.                 }
  6216.             }
  6217.             if ((l & 0x20) != 0) {
  6218.                 npc.interactingEntity = stream.readUnsignedWord();
  6219.                 if (npc.interactingEntity == 65535) {
  6220.                     npc.interactingEntity = -1;
  6221.                 }
  6222.             }
  6223.             if ((l & 1) != 0) {
  6224.                 npc.textSpoken = stream.readString();
  6225.                 npc.textCycle = 100;
  6226.             }
  6227.             if ((l & 0x40) != 0) {
  6228.                 int l1 = stream.method427();
  6229.                 int k2 = stream.method428();
  6230.                 npc.updateHitData(k2, l1, loopCycle);
  6231.                 npc.loopCycleStatus = loopCycle + 300;
  6232.                 npc.currentHealth = stream.method428();
  6233.                 npc.maxHealth = stream.method427();
  6234.             }
  6235.             if ((l & 2) != 0) {
  6236.                 npc.desc = EntityDef.forID(stream.method436());
  6237.                 npc.anInt1540 = npc.desc.aByte68;
  6238.                 npc.anInt1504 = npc.desc.anInt79;
  6239.                 npc.anInt1554 = npc.desc.anInt67;
  6240.                 npc.anInt1555 = npc.desc.anInt58;
  6241.                 npc.anInt1556 = npc.desc.anInt83;
  6242.                 npc.anInt1557 = npc.desc.anInt55;
  6243.                 npc.anInt1511 = npc.desc.anInt77;
  6244.             }
  6245.             if ((l & 4) != 0) {
  6246.                 npc.anInt1538 = stream.method434();
  6247.                 npc.anInt1539 = stream.method434();
  6248.             }
  6249.         }
  6250.     }
  6251.  
  6252.     public void buildAtNPCMenu(EntityDef entityDef, int i, int j, int k) {
  6253.         if (menuActionRow >= 400) {
  6254.             return;
  6255.         }
  6256.         if (entityDef.childrenIDs != null) {
  6257.             entityDef = entityDef.method161();
  6258.         }
  6259.         if (entityDef == null) {
  6260.             return;
  6261.         }
  6262.         if (!entityDef.aBoolean84) {
  6263.             return;
  6264.         }
  6265.         String s = entityDef.name;
  6266.         if (entityDef.combatLevel != 0) {
  6267.             s = s + combatDiffColor(myPlayer.combatLevel, entityDef.combatLevel) + " (level-" + entityDef.combatLevel + ")";
  6268.         }
  6269.         if (itemSelected == 1) {
  6270.             menuActionName[menuActionRow] = "Use " + selectedItemName + " with @yel@" + s;
  6271.             menuActionID[menuActionRow] = 582;
  6272.             menuActionCmd1[menuActionRow] = i;
  6273.             menuActionCmd2[menuActionRow] = k;
  6274.             menuActionCmd3[menuActionRow] = j;
  6275.             menuActionRow++;
  6276.             return;
  6277.         }
  6278.         if (spellSelected == 1) {
  6279.             if ((spellUsableOn & 2) == 2) {
  6280.                 menuActionName[menuActionRow] = spellTooltip + " @yel@" + s;
  6281.                 menuActionID[menuActionRow] = 413;
  6282.                 menuActionCmd1[menuActionRow] = i;
  6283.                 menuActionCmd2[menuActionRow] = k;
  6284.                 menuActionCmd3[menuActionRow] = j;
  6285.                 menuActionRow++;
  6286.             }
  6287.         } else {
  6288.             if (entityDef.actions != null) {
  6289.                 for (int l = 4; l >= 0; l--) {
  6290.                     if (entityDef.actions[l] != null && !entityDef.actions[l].equalsIgnoreCase("attack")) {
  6291.                         menuActionName[menuActionRow] = entityDef.actions[l] + " @yel@" + s;
  6292.                         if (l == 0) {
  6293.                             menuActionID[menuActionRow] = 20;
  6294.                         }
  6295.                         if (l == 1) {
  6296.                             menuActionID[menuActionRow] = 412;
  6297.                         }
  6298.                         if (l == 2) {
  6299.                             menuActionID[menuActionRow] = 225;
  6300.                         }
  6301.                         if (l == 3) {
  6302.                             menuActionID[menuActionRow] = 965;
  6303.                         }
  6304.                         if (l == 4) {
  6305.                             menuActionID[menuActionRow] = 478;
  6306.                         }
  6307.                         menuActionCmd1[menuActionRow] = i;
  6308.                         menuActionCmd2[menuActionRow] = k;
  6309.                         menuActionCmd3[menuActionRow] = j;
  6310.                         menuActionRow++;
  6311.                     }
  6312.                 }
  6313.  
  6314.             }
  6315.             if (entityDef.actions != null) {
  6316.                 for (int i1 = 4; i1 >= 0; i1--) {
  6317.                     if (entityDef.actions[i1] != null && entityDef.actions[i1].equalsIgnoreCase("attack")) {
  6318.                         char c = '\0';
  6319.                         if (entityDef.combatLevel > myPlayer.combatLevel) {
  6320.                             c = '\u07D0';
  6321.                         }
  6322.                         menuActionName[menuActionRow] = entityDef.actions[i1] + " @yel@" + s;
  6323.                         if (i1 == 0) {
  6324.                             menuActionID[menuActionRow] = 20 + c;
  6325.                         }
  6326.                         if (i1 == 1) {
  6327.                             menuActionID[menuActionRow] = 412 + c;
  6328.                         }
  6329.                         if (i1 == 2) {
  6330.                             menuActionID[menuActionRow] = 225 + c;
  6331.                         }
  6332.                         if (i1 == 3) {
  6333.                             menuActionID[menuActionRow] = 965 + c;
  6334.                         }
  6335.                         if (i1 == 4) {
  6336.                             menuActionID[menuActionRow] = 478 + c;
  6337.                         }
  6338.                         menuActionCmd1[menuActionRow] = i;
  6339.                         menuActionCmd2[menuActionRow] = k;
  6340.                         menuActionCmd3[menuActionRow] = j;
  6341.                         menuActionRow++;
  6342.                     }
  6343.                 }
  6344.  
  6345.             }
  6346.             menuActionName[menuActionRow] = "Examine @yel@" + s + (showInfo ? " @gre@(@whi@" + entityDef.type + "@gre@)" : "");
  6347.             menuActionID[menuActionRow] = 1025;
  6348.             menuActionCmd1[menuActionRow] = i;
  6349.             menuActionCmd2[menuActionRow] = k;
  6350.             menuActionCmd3[menuActionRow] = j;
  6351.             menuActionRow++;
  6352.         }
  6353.     }
  6354.  
  6355.     public void buildAtPlayerMenu(int i, int j, Player player, int k) {
  6356.         if (player == myPlayer) {
  6357.             return;
  6358.         }
  6359.         if (menuActionRow >= 400) {
  6360.             return;
  6361.         }
  6362.         String s;
  6363.         if (player.skill == 0) {
  6364.             s = player.name + combatDiffColor(myPlayer.combatLevel, player.combatLevel) + " (level-" + player.combatLevel + ")";
  6365.         } else {
  6366.             s = player.name + " (skill-" + player.skill + ")";
  6367.         }
  6368.         if (itemSelected == 1) {
  6369.             menuActionName[menuActionRow] = "Use " + selectedItemName + " with @whi@" + s;
  6370.             menuActionID[menuActionRow] = 491;
  6371.             menuActionCmd1[menuActionRow] = j;
  6372.             menuActionCmd2[menuActionRow] = i;
  6373.             menuActionCmd3[menuActionRow] = k;
  6374.             menuActionRow++;
  6375.         } else if (spellSelected == 1) {
  6376.             if ((spellUsableOn & 8) == 8) {
  6377.                 menuActionName[menuActionRow] = spellTooltip + " @whi@" + s;
  6378.                 menuActionID[menuActionRow] = 365;
  6379.                 menuActionCmd1[menuActionRow] = j;
  6380.                 menuActionCmd2[menuActionRow] = i;
  6381.                 menuActionCmd3[menuActionRow] = k;
  6382.                 menuActionRow++;
  6383.             }
  6384.         } else {
  6385.             for (int l = 4; l >= 0; l--) {
  6386.                 if (atPlayerActions[l] != null) {
  6387.                     menuActionName[menuActionRow] = atPlayerActions[l] + " @whi@" + s;
  6388.                     char c = '\0';
  6389.                     if (atPlayerActions[l].equalsIgnoreCase("attack")) {
  6390.                         if (player.combatLevel > myPlayer.combatLevel) {
  6391.                             c = '\u07D0';
  6392.                         }
  6393.                         if (myPlayer.team != 0 && player.team != 0) {
  6394.                             if (myPlayer.team == player.team) {
  6395.                                 c = '\u07D0';
  6396.                             } else {
  6397.                                 c = '\0';
  6398.                             }
  6399.                         }
  6400.                     } else if (atPlayerArray[l]) {
  6401.                         c = '\u07D0';
  6402.                     }
  6403.                     if (l == 0) {
  6404.                         menuActionID[menuActionRow] = 561 + c;
  6405.                     }
  6406.                     if (l == 1) {
  6407.                         menuActionID[menuActionRow] = 779 + c;
  6408.                     }
  6409.                     if (l == 2) {
  6410.                         menuActionID[menuActionRow] = 27 + c;
  6411.                     }
  6412.                     if (l == 3) {
  6413.                         menuActionID[menuActionRow] = 577 + c;
  6414.                     }
  6415.                     if (l == 4) {
  6416.                         menuActionID[menuActionRow] = 729 + c;
  6417.                     }
  6418.                     menuActionCmd1[menuActionRow] = j;
  6419.                     menuActionCmd2[menuActionRow] = i;
  6420.                     menuActionCmd3[menuActionRow] = k;
  6421.                     menuActionRow++;
  6422.                 }
  6423.             }
  6424.  
  6425.         }
  6426.         for (int i1 = 0; i1 < menuActionRow; i1++) {
  6427.             if (menuActionID[i1] == 516) {
  6428.                 menuActionName[i1] = "Walk here @whi@" + s;
  6429.                 return;
  6430.             }
  6431.         }
  6432.  
  6433.     }
  6434.  
  6435.     public void method89(Class30_Sub1 class30_sub1) {
  6436.         int i = 0;
  6437.         int j = -1;
  6438.         int k = 0;
  6439.         int l = 0;
  6440.         if (class30_sub1.anInt1296 == 0) {
  6441.             i = worldController.method300(class30_sub1.anInt1295, class30_sub1.anInt1297, class30_sub1.anInt1298);
  6442.         }
  6443.         if (class30_sub1.anInt1296 == 1) {
  6444.             i = worldController.method301(class30_sub1.anInt1295, class30_sub1.anInt1297, class30_sub1.anInt1298);
  6445.         }
  6446.         if (class30_sub1.anInt1296 == 2) {
  6447.             i = worldController.method302(class30_sub1.anInt1295, class30_sub1.anInt1297, class30_sub1.anInt1298);
  6448.         }
  6449.         if (class30_sub1.anInt1296 == 3) {
  6450.             i = worldController.method303(class30_sub1.anInt1295, class30_sub1.anInt1297, class30_sub1.anInt1298);
  6451.         }
  6452.         if (i != 0) {
  6453.             int i1 = worldController.method304(class30_sub1.anInt1295, class30_sub1.anInt1297, class30_sub1.anInt1298, i);
  6454.             j = i >> 14 & 0x7fff;
  6455.             k = i1 & 0x1f;
  6456.             l = i1 >> 6;
  6457.         }
  6458.         class30_sub1.anInt1299 = j;
  6459.         class30_sub1.anInt1301 = k;
  6460.         class30_sub1.anInt1300 = l;
  6461.     }
  6462.  
  6463.     public final void method90() {
  6464.         for (int index = 0; index < currentSound; index++) {
  6465.             //if (soundDelay[index] <= 0) {
  6466.                 boolean flag1 = false;
  6467.                 try {
  6468.                     Stream stream = Sounds.method241(soundType[index], sound[index]);
  6469.                     new SoundPlayer((InputStream) new ByteArrayInputStream(stream.buffer, 0, stream.currentOffset), soundVolume[index], soundDelay[index]);
  6470.                     if (System.currentTimeMillis() + (long) (stream.currentOffset / 22) > aLong1172 + (long) (anInt1257 / 22)) {
  6471.                         anInt1257 = stream.currentOffset;
  6472.                         aLong1172 = System.currentTimeMillis();
  6473.                     }
  6474.                 } catch (Exception exception) {
  6475.                     exception.printStackTrace();
  6476.                 }
  6477.                 if (!flag1 || soundDelay[index] == -5) {
  6478.                     currentSound--;
  6479.                     for (int j = index; j < currentSound; j++) {
  6480.                         sound[j] = sound[j + 1];
  6481.                         soundType[j] = soundType[j + 1];
  6482.                         soundDelay[j] = soundDelay[j + 1];
  6483.                         soundVolume[j] = soundVolume[j + 1];
  6484.                     }
  6485.                     index--;
  6486.                 } else {
  6487.                     soundDelay[index] = -5;
  6488.                 }
  6489.             /*} else {
  6490.                 soundDelay[index]--;
  6491.             }*/
  6492.         }
  6493.         if (previousSong > 0) {
  6494.             previousSong -= 20;
  6495.             if (previousSong < 0)
  6496.                 previousSong = 0;
  6497.             if (previousSong == 0 && musicVolume != 0 && currentSong != -1) {
  6498.                 method56(musicVolume, false, currentSong);
  6499.             }
  6500.         }
  6501.     }
  6502.    
  6503.     private void connectServer()
  6504.     {
  6505.       int j = 5;
  6506.         expectedCRCs[8] = 0;
  6507.         int k = 0;
  6508.         while(expectedCRCs[8] == 0)
  6509.         {
  6510.             String s = "Unknown problem";
  6511.             drawLoadingText(20, "Connecting to web server");
  6512.             try
  6513.             {
  6514.                 DataInputStream datainputstream = openJagGrabInputStream("crc" + (int)(Math.random() * 99999999D) + "-" + 317);
  6515.                 Stream class30_sub2_sub2 = new Stream(new byte[40]);
  6516.                 datainputstream.readFully(class30_sub2_sub2.buffer, 0, 40);
  6517.                 datainputstream.close();
  6518.                 for(int i1 = 0; i1 < 9; i1++)
  6519.                     expectedCRCs[i1] = class30_sub2_sub2.readDWord();
  6520.  
  6521.                 int j1 = class30_sub2_sub2.readDWord();
  6522.                 int k1 = 1234;
  6523.                 for(int l1 = 0; l1 < 9; l1++)
  6524.                     k1 = (k1 << 1) + expectedCRCs[l1];
  6525.  
  6526.                 if(j1 != k1)
  6527.                 {
  6528.                     s = "checksum problem";
  6529.                     expectedCRCs[8] = 0;
  6530.                 }
  6531.             }
  6532.             catch(EOFException _ex)
  6533.             {
  6534.                 s = "EOF problem";
  6535.                 expectedCRCs[8] = 0;
  6536.             }
  6537.             catch(IOException _ex)
  6538.             {
  6539.                 s = "connection problem";
  6540.                 expectedCRCs[8] = 0;
  6541.             }
  6542.             catch(Exception _ex)
  6543.             {
  6544.                 s = "logic problem";
  6545.                 expectedCRCs[8] = 0;
  6546.                 if(!Signlink.reporterror)
  6547.                     return;
  6548.             }
  6549.             if(expectedCRCs[8] == 0)
  6550.             {
  6551.                 k++;
  6552.                 for(int l = j; l > 0; l--)
  6553.                 {
  6554.                     if(k >= 10)
  6555.                     {
  6556.                         drawLoadingText(10, "Game updated - please reload page");
  6557.                         l = 10;
  6558.                     } else
  6559.                     {
  6560.                         drawLoadingText(10, s + " - Will retry in " + l + " secs.");
  6561.                     }
  6562.                     try
  6563.                     {
  6564.                         Thread.sleep(1000L);
  6565.                     }
  6566.                     catch(Exception _ex) { }
  6567.                 }
  6568.  
  6569.                 j *= 2;
  6570.                 if(j > 60)
  6571.                     j = 60;
  6572.                 aBoolean872 = !aBoolean872;
  6573.             }
  6574.         }
  6575.     }
  6576.  
  6577.     void startUp() {
  6578.         drawLoadingText(20, "Starting up");
  6579. //      try {
  6580. //          CacheDownloader.download(this, new URL("https://dl.dropboxusercontent.com/u/19852069/assets.zip"));
  6581. //      } catch (IOException e) {
  6582. //          e.printStackTrace();
  6583. //      }
  6584.         if (Signlink.sunjava) {
  6585.             super.minDelay = 5;
  6586.         }
  6587.         aBoolean993 = true;
  6588.         boolean flag = true;
  6589.         if (!flag) {
  6590.             genericLoadingError = true;
  6591.             return;
  6592.         }
  6593.         if (Signlink.cache_dat != null) {
  6594.             for (int i = 0; i < 5; i++) {
  6595.                 decompressors[i] = new Decompressor(Signlink.cache_dat, Signlink.cache_idx[i], i + 1);
  6596.             }
  6597.  
  6598.         }
  6599.         try {
  6600.             connectServer();
  6601.             titleStreamLoader = streamLoaderForName(1, "title screen", "title", expectedCRCs[1], 25);
  6602.             aTextDrawingArea_1270 = new TextDrawingArea(false, "p11_full", titleStreamLoader);
  6603.             aTextDrawingArea_1271 = new TextDrawingArea(false, "p12_full", titleStreamLoader);
  6604.             chatTextDrawingArea = new TextDrawingArea(false, "b12_full", titleStreamLoader);
  6605.             TextDrawingArea aTextDrawingArea_1273 = new TextDrawingArea(true, "q8_full", titleStreamLoader);
  6606.             drawLogo();
  6607.             loadTitleScreen();
  6608.             //repackCacheIndex(1);
  6609.             constructMusic();
  6610.             StreamLoader streamLoader = streamLoaderForName(2, "config", "config", expectedCRCs[2], 30);
  6611.             StreamLoader streamLoader_1 = streamLoaderForName(3, "interface", "interface", expectedCRCs[3], 35);
  6612.             StreamLoader streamLoader_2 = streamLoaderForName(4, "2d graphics", "media", expectedCRCs[4], 40);
  6613.             StreamLoader streamLoader_3 = streamLoaderForName(6, "textures", "textures", expectedCRCs[6], 45);
  6614.             StreamLoader streamLoader_4 = streamLoaderForName(7, "chat system", "wordenc", expectedCRCs[7], 50);
  6615.             StreamLoader streamLoader_5 = streamLoaderForName(8, "sound effects", "sounds", expectedCRCs[8], 55);
  6616.             byteGroundArray = new byte[4][104][104];
  6617.             intGroundArray = new int[4][105][105];
  6618.             worldController = new WorldController(intGroundArray);
  6619.             for (int j = 0; j < 4; j++) {
  6620.                 aClass11Array1230[j] = new CollisionMap();
  6621.             }
  6622.  
  6623.             aClass30_Sub2_Sub1_Sub1_1263 = new Sprite(512, 512);
  6624.             StreamLoader streamLoader_6 = streamLoaderForName(5, "update list", "versionlist", expectedCRCs[5], 60);
  6625.             drawLoadingText(60, "Connecting to update server");
  6626.             onDemandFetcher = new OnDemandFetcher();
  6627.             onDemandFetcher.start(streamLoader_6, this);
  6628. //          musics();
  6629.             Class36.method528(onDemandFetcher.getAnimCount());
  6630.             Model.method459(onDemandFetcher.getVersionCount(0), onDemandFetcher);
  6631.             if (!lowMem) {
  6632.                 method58(10, musicVolume, false, 0);
  6633.                 while (onDemandFetcher.getNodeCount() > 0) {
  6634.                     processOnDemandQueue();
  6635.                     try {
  6636.                         Thread.sleep(100L);
  6637.                     } catch (Exception _ex) {
  6638.                     }
  6639.                     if (onDemandFetcher.anInt1349 > 3) {
  6640.                         loadError();
  6641.                         return;
  6642.                     }
  6643.                 }
  6644.             }
  6645.             drawLoadingText(65, "Requesting animations");
  6646.             int k = onDemandFetcher.getVersionCount(1);
  6647.             for (int i1 = 0; i1 < k; i1++) {
  6648.                 onDemandFetcher.method558(1, i1);
  6649.             }
  6650.  
  6651.             while (onDemandFetcher.getNodeCount() > 0) {
  6652.                 int j1 = k - onDemandFetcher.getNodeCount();
  6653.                 if (j1 > 0) {
  6654.                     drawLoadingText(65, "Loading animations - " + j1 * 100 / k + "%");
  6655.                 }
  6656.                 processOnDemandQueue();
  6657.                 try {
  6658.                     Thread.sleep(100L);
  6659.                 } catch (Exception _ex) {
  6660.                 }
  6661.                 if (onDemandFetcher.anInt1349 > 3) {
  6662.                     loadError();
  6663.                     return;
  6664.                 }
  6665.             }
  6666.             drawLoadingText(70, "Requesting models");
  6667.             k = onDemandFetcher.getVersionCount(0);
  6668.             for (int k1 = 0; k1 < k; k1++) {
  6669.                 int l1 = onDemandFetcher.getModelIndex(k1);
  6670.                 if ((l1 & 1) != 0) {
  6671.                     onDemandFetcher.method558(0, k1);
  6672.                 }
  6673.             }
  6674.  
  6675.             k = onDemandFetcher.getNodeCount();
  6676.             while (onDemandFetcher.getNodeCount() > 0) {
  6677.                 int i2 = k - onDemandFetcher.getNodeCount();
  6678.                 if (i2 > 0) {
  6679.                     drawLoadingText(70, "Loading models - " + i2 * 100 / k + "%");
  6680.                 }
  6681.                 processOnDemandQueue();
  6682.                 try {
  6683.                     Thread.sleep(100L);
  6684.                 } catch (Exception _ex) {
  6685.                 }
  6686.             }
  6687.             if (decompressors[0] != null) {
  6688.                 drawLoadingText(75, "Requesting maps");
  6689.                 onDemandFetcher.method558(3, onDemandFetcher.method562(0, 48, 47));
  6690.                 onDemandFetcher.method558(3, onDemandFetcher.method562(1, 48, 47));
  6691.                 onDemandFetcher.method558(3, onDemandFetcher.method562(0, 48, 48));
  6692.                 onDemandFetcher.method558(3, onDemandFetcher.method562(1, 48, 48));
  6693.                 onDemandFetcher.method558(3, onDemandFetcher.method562(0, 48, 49));
  6694.                 onDemandFetcher.method558(3, onDemandFetcher.method562(1, 48, 49));
  6695.                 onDemandFetcher.method558(3, onDemandFetcher.method562(0, 47, 47));
  6696.                 onDemandFetcher.method558(3, onDemandFetcher.method562(1, 47, 47));
  6697.                 onDemandFetcher.method558(3, onDemandFetcher.method562(0, 47, 48));
  6698.                 onDemandFetcher.method558(3, onDemandFetcher.method562(1, 47, 48));
  6699.                 onDemandFetcher.method558(3, onDemandFetcher.method562(0, 148, 48));
  6700.                 onDemandFetcher.method558(3, onDemandFetcher.method562(1, 148, 48));
  6701.                 k = onDemandFetcher.getNodeCount();
  6702.                 while (onDemandFetcher.getNodeCount() > 0) {
  6703.                     int j2 = k - onDemandFetcher.getNodeCount();
  6704.                     if (j2 > 0) {
  6705.                         drawLoadingText(75, "Loading maps - " + j2 * 100 / k + "%");
  6706.                     }
  6707.                     processOnDemandQueue();
  6708.                     try {
  6709.                         Thread.sleep(100L);
  6710.                     } catch (Exception _ex) {
  6711.                     }
  6712.                 }
  6713.             }
  6714.             k = onDemandFetcher.getVersionCount(0);
  6715.             for (int k2 = 0; k2 < k; k2++) {
  6716.                 int l2 = onDemandFetcher.getModelIndex(k2);
  6717.                 byte byte0 = 0;
  6718.                 if ((l2 & 8) != 0) {
  6719.                     byte0 = 10;
  6720.                 } else if ((l2 & 0x20) != 0) {
  6721.                     byte0 = 9;
  6722.                 } else if ((l2 & 0x10) != 0) {
  6723.                     byte0 = 8;
  6724.                 } else if ((l2 & 0x40) != 0) {
  6725.                     byte0 = 7;
  6726.                 } else if ((l2 & 0x80) != 0) {
  6727.                     byte0 = 6;
  6728.                 } else if ((l2 & 2) != 0) {
  6729.                     byte0 = 5;
  6730.                 } else if ((l2 & 4) != 0) {
  6731.                     byte0 = 4;
  6732.                 }
  6733.                 if ((l2 & 1) != 0) {
  6734.                     byte0 = 3;
  6735.                 }
  6736.                 if (byte0 != 0) {
  6737.                     onDemandFetcher.method563(byte0, 0, k2);
  6738.                 }
  6739.             }
  6740.  
  6741.             onDemandFetcher.method554(isMembers);
  6742.             if (!lowMem) {
  6743.                 int l = onDemandFetcher.getVersionCount(2);
  6744.                 for (int i3 = 1; i3 < l; i3++) {
  6745.                     if (onDemandFetcher.method569(i3)) {
  6746.                         onDemandFetcher.method563((byte) 1, 2, i3);
  6747.                     }
  6748.                 }
  6749.  
  6750.             }
  6751.             drawLoadingText(80, "Unpacking media");
  6752.             invBack = new Background(streamLoader_2, "invback", 0);
  6753.             chatBack = new Background(streamLoader_2, "chatback", 0);
  6754.             mapBack = new Background(streamLoader_2, "mapback", 0);
  6755.             backBase1 = new Background(streamLoader_2, "backbase1", 0);
  6756.             backBase2 = new Background(streamLoader_2, "backbase2", 0);
  6757.             backHmid1 = new Background(streamLoader_2, "backhmid1", 0);
  6758.             for (int j3 = 0; j3 < 13; j3++) {
  6759.                 sideIcons[j3] = new Background(streamLoader_2, "sideicons", j3);
  6760.             }
  6761.  
  6762.             compass = new Sprite(streamLoader_2, "compass", 0);
  6763.             mapEdge = new Sprite(streamLoader_2, "mapedge", 0);
  6764.             mapEdge.method345();
  6765.  
  6766.             multiOverlay = new Sprite(streamLoader_2, "overlay_multiway", 0);
  6767.             try {
  6768.                 for (int k3 = 0; k3 < 100; k3++) {
  6769.                     mapScenes[k3] = new Background(streamLoader_2, "mapscene", k3);
  6770.                 }
  6771.  
  6772.             } catch (Exception _ex) {
  6773.             }
  6774.             try {
  6775.                 for (int l3 = 0; l3 < 100; l3++) {
  6776.                     mapFunctions[l3] = new Sprite(streamLoader_2, "mapfunction", l3);
  6777.                 }
  6778.  
  6779.             } catch (Exception _ex) {
  6780.             }
  6781.             try {
  6782.                 for (int i4 = 0; i4 < 20; i4++) {
  6783.                     hitMarks[i4] = new Sprite(streamLoader_2, "hitmarks", i4);
  6784.                 }
  6785.  
  6786.             } catch (Exception _ex) {
  6787.             }
  6788.             try {
  6789.                 for (int h1 = 0; h1 < 6; h1++) {
  6790.                     headIconsHint[h1] = new Sprite(streamLoader_2, "headicons_hint", h1);
  6791.                 }
  6792.                 for (int j4 = 0; j4 < 8; j4++) {
  6793.                     headIcons[j4] = new Sprite(streamLoader_2, "headicons_prayer", j4);
  6794.                 }
  6795.                 for (int j45 = 0; j45 < 3; j45++) {
  6796.                     skullIcons[j45] = new Sprite(streamLoader_2, "headicons_pk", j45);
  6797.                 }
  6798.             } catch (Exception _ex) {
  6799.             }
  6800.             mapFlag = new Sprite(streamLoader_2, "mapmarker", 0);
  6801.             mapMarker = new Sprite(streamLoader_2, "mapmarker", 1);
  6802.             for (int k4 = 0; k4 < 8; k4++) {
  6803.                 crosses[k4] = new Sprite(streamLoader_2, "cross", k4);
  6804.             }
  6805.  
  6806.             mapDotItem = new Sprite(streamLoader_2, "mapdots", 0);
  6807.             mapDotNPC = new Sprite(streamLoader_2, "mapdots", 1);
  6808.             mapDotPlayer = new Sprite(streamLoader_2, "mapdots", 2);
  6809.             mapDotFriend = new Sprite(streamLoader_2, "mapdots", 3);
  6810.             mapDotTeam = new Sprite(streamLoader_2, "mapdots", 4);
  6811.             scrollBar1 = new Background(streamLoader_2, "scrollbar", 0);
  6812.             scrollBar2 = new Background(streamLoader_2, "scrollbar", 1);
  6813.             redStone1 = new Background(streamLoader_2, "redstone1", 0);
  6814.             redStone2 = new Background(streamLoader_2, "redstone2", 0);
  6815.             redStone3 = new Background(streamLoader_2, "redstone3", 0);
  6816.             redStone1_2 = new Background(streamLoader_2, "redstone1", 0);
  6817.             redStone1_2.method358();
  6818.             redStone2_2 = new Background(streamLoader_2, "redstone2", 0);
  6819.             redStone2_2.method358();
  6820.             redStone1_3 = new Background(streamLoader_2, "redstone1", 0);
  6821.             redStone1_3.method359();
  6822.             redStone2_3 = new Background(streamLoader_2, "redstone2", 0);
  6823.             redStone2_3.method359();
  6824.             redStone3_2 = new Background(streamLoader_2, "redstone3", 0);
  6825.             redStone3_2.method359();
  6826.             redStone1_4 = new Background(streamLoader_2, "redstone1", 0);
  6827.             redStone1_4.method358();
  6828.             redStone1_4.method359();
  6829.             redStone2_4 = new Background(streamLoader_2, "redstone2", 0);
  6830.             redStone2_4.method358();
  6831.             redStone2_4.method359();
  6832.             for (int l4 = 0; l4 < 2; l4++) {
  6833.                 modIcons[l4] = new Background(streamLoader_2, "mod_icons", l4);
  6834.             }
  6835.  
  6836.             Sprite sprite = new Sprite(streamLoader_2, "backleft1", 0);
  6837.             backLeftIP1 = new RSImageProducer(sprite.width, sprite.height, getGameComponent());
  6838.             sprite.method346(0, 0);
  6839.             sprite = new Sprite(streamLoader_2, "backleft2", 0);
  6840.             backLeftIP2 = new RSImageProducer(sprite.width, sprite.height, getGameComponent());
  6841.             sprite.method346(0, 0);
  6842.             sprite = new Sprite(streamLoader_2, "backright1", 0);
  6843.             backRightIP1 = new RSImageProducer(sprite.width, sprite.height, getGameComponent());
  6844.             sprite.method346(0, 0);
  6845.             sprite = new Sprite(streamLoader_2, "backright2", 0);
  6846.             backRightIP2 = new RSImageProducer(sprite.width, sprite.height, getGameComponent());
  6847.             sprite.method346(0, 0);
  6848.             sprite = new Sprite(streamLoader_2, "backtop1", 0);
  6849.             backTopIP1 = new RSImageProducer(sprite.width, sprite.height, getGameComponent());
  6850.             sprite.method346(0, 0);
  6851.             sprite = new Sprite(streamLoader_2, "backvmid1", 0);
  6852.             backVmidIP1 = new RSImageProducer(sprite.width, sprite.height, getGameComponent());
  6853.             sprite.method346(0, 0);
  6854.             sprite = new Sprite(streamLoader_2, "backvmid2", 0);
  6855.             backVmidIP2 = new RSImageProducer(sprite.width, sprite.height, getGameComponent());
  6856.             sprite.method346(0, 0);
  6857.             sprite = new Sprite(streamLoader_2, "backvmid3", 0);
  6858.             backVmidIP3 = new RSImageProducer(sprite.width, sprite.height, getGameComponent());
  6859.             sprite.method346(0, 0);
  6860.             sprite = new Sprite(streamLoader_2, "backhmid2", 0);
  6861.             backVmidIP2_2 = new RSImageProducer(sprite.width, sprite.height, getGameComponent());
  6862.             sprite.method346(0, 0);
  6863.             int i5 = (int) (Math.random() * 21D) - 10;
  6864.             int j5 = (int) (Math.random() * 21D) - 10;
  6865.             int k5 = (int) (Math.random() * 21D) - 10;
  6866.             int l5 = (int) (Math.random() * 41D) - 20;
  6867.             for (int i6 = 0; i6 < 100; i6++) {
  6868.                 if (mapFunctions[i6] != null) {
  6869.                     mapFunctions[i6].method344(i5 + l5, j5 + l5, k5 + l5);
  6870.                 }
  6871.                 if (mapScenes[i6] != null) {
  6872.                     mapScenes[i6].method360(i5 + l5, j5 + l5, k5 + l5);
  6873.                 }
  6874.             }
  6875.  
  6876.             drawLoadingText(83, "Unpacking textures");
  6877.             Texture.method368(streamLoader_3);
  6878.             Texture.method372(0.80000000000000004D);
  6879.             Texture.method367();
  6880.             drawLoadingText(86, "Unpacking config");
  6881.             Animation.unpackConfig(streamLoader);
  6882.             ObjectDef.unpackConfig(streamLoader);
  6883.             Flo.unpackConfig(streamLoader);
  6884.             ItemDef.unpackConfig(streamLoader);
  6885.             EntityDef.unpackConfig(streamLoader);
  6886.             IDK.unpackConfig(streamLoader);
  6887.             SpotAnim.unpackConfig(streamLoader);
  6888.             Varp.unpackConfig(streamLoader);
  6889.             VarBit.unpackConfig(streamLoader);
  6890.             ItemDef.isMembers = isMembers;
  6891.             // if (!lowMem) {
  6892.             drawLoadingText(90, "Unpacking sounds");
  6893.             byte abyte0[] = streamLoader_5.getDataForName("sounds.dat");
  6894.             Stream stream = new Stream(abyte0);
  6895.             Sounds.unpack(stream);
  6896.             // }
  6897.             drawLoadingText(95, "Unpacking interfaces");
  6898.             TextDrawingArea aclass30_sub2_sub1_sub4s[] = {aTextDrawingArea_1270, aTextDrawingArea_1271, chatTextDrawingArea, aTextDrawingArea_1273};
  6899.             RSInterface.unpack(streamLoader_1, aclass30_sub2_sub1_sub4s, streamLoader_2);
  6900.             drawLoadingText(100, "Preparing game engine");
  6901.             for (int j6 = 0; j6 < 33; j6++) {
  6902.                 int k6 = 999;
  6903.                 int i7 = 0;
  6904.                 for (int k7 = 0; k7 < 34; k7++) {
  6905.                     if (mapBack.aByteArray1450[k7 + j6 * mapBack.anInt1452] == 0) {
  6906.                         if (k6 == 999) {
  6907.                             k6 = k7;
  6908.                         }
  6909.                         continue;
  6910.                     }
  6911.                     if (k6 == 999) {
  6912.                         continue;
  6913.                     }
  6914.                     i7 = k7;
  6915.                     break;
  6916.                 }
  6917.  
  6918.                 anIntArray968[j6] = k6;
  6919.                 anIntArray1057[j6] = i7 - k6;
  6920.             }
  6921.  
  6922.             for (int l6 = 5; l6 < 156; l6++) {
  6923.                 int j7 = 999;
  6924.                 int l7 = 0;
  6925.                 for (int j8 = 25; j8 < 172; j8++) {
  6926.                     if (mapBack.aByteArray1450[j8 + l6 * mapBack.anInt1452] == 0 && (j8 > 34 || l6 > 34)) {
  6927.                         if (j7 == 999) {
  6928.                             j7 = j8;
  6929.                         }
  6930.                         continue;
  6931.                     }
  6932.                     if (j7 == 999) {
  6933.                         continue;
  6934.                     }
  6935.                     l7 = j8;
  6936.                     break;
  6937.                 }
  6938.  
  6939.                 anIntArray1052[l6 - 5] = j7 - 25;
  6940.                 anIntArray1229[l6 - 5] = l7 - j7;
  6941.             }
  6942.             Texture.method365(765, 503);
  6943.             gameScreenOffsets = Texture.lineOffsets;
  6944.             Texture.method365(479, 96);
  6945.             chatAreaOffsets = Texture.lineOffsets;
  6946.             Texture.method365(190, 261);
  6947.             tabAreaOffsets = Texture.lineOffsets;
  6948.             Texture.method365(512, 334);
  6949.             chatBoxAreaOffsets = Texture.lineOffsets;
  6950.             int ai[] = new int[9];
  6951.             for (int i8 = 0; i8 < 9; i8++) {
  6952.                 int k8 = 128 + i8 * 32 + 15;
  6953.                 int l8 = 600 + k8 * 3;
  6954.                 int i9 = Texture.anIntArray1470[k8];
  6955.                 ai[i8] = l8 * i9 >> 16;
  6956.             }
  6957.  
  6958.             WorldController.method310(500, 800, 512, 334, ai);
  6959.             Censor.loadConfig(streamLoader_4);
  6960.             mouseDetection = new MouseDetection(this);
  6961.             startRunnable(mouseDetection, 10);
  6962.             Animable_Sub5.clientInstance = this;
  6963.             ObjectDef.clientInstance = this;
  6964.             EntityDef.clientInstance = this;
  6965.             return;
  6966.         } catch (Exception exception) {
  6967.             Signlink.reporterror("loaderror " + aString1049 + " " + anInt1079);
  6968.         }
  6969.         loadingError = true;
  6970.     }
  6971.  
  6972.     public void method91(Stream stream, int i) {
  6973.         while (stream.bitPosition + 10 < i * 8) {
  6974.             int j = stream.readBits(11);
  6975.             if (j == 2047) {
  6976.                 break;
  6977.             }
  6978.             if (playerArray[j] == null) {
  6979.                 playerArray[j] = new Player();
  6980.                 if (aStreamArray895s[j] != null) {
  6981.                     playerArray[j].updatePlayer(aStreamArray895s[j]);
  6982.                 }
  6983.             }
  6984.             playerIndices[playerCount++] = j;
  6985.             Player player = playerArray[j];
  6986.             player.anInt1537 = loopCycle;
  6987.             int k = stream.readBits(1);
  6988.             if (k == 1) {
  6989.                 anIntArray894[anInt893++] = j;
  6990.             }
  6991.             int l = stream.readBits(1);
  6992.             int i1 = stream.readBits(5);
  6993.             if (i1 > 15) {
  6994.                 i1 -= 32;
  6995.             }
  6996.             int j1 = stream.readBits(5);
  6997.             if (j1 > 15) {
  6998.                 j1 -= 32;
  6999.             }
  7000.             player.setPos(myPlayer.smallX[0] + j1, myPlayer.smallY[0] + i1, l == 1);
  7001.         }
  7002.         stream.finishBitAccess();
  7003.     }
  7004.  
  7005.     public void processMainScreenClick() {
  7006.         if (anInt1021 != 0) {
  7007.             return;
  7008.         }
  7009.         if (super.clickMode3 == 1) {
  7010.             int i = super.saveClickX - 25 - 550;
  7011.             int j = super.saveClickY - 5 - 4;
  7012.             if (i >= 0 && j >= 0 && i < 146 && j < 151) {
  7013.                 i -= 73;
  7014.                 j -= 75;
  7015.                 int k = minimapInt1 + minimapInt2 & 0x7ff;
  7016.                 int i1 = Texture.anIntArray1470[k];
  7017.                 int j1 = Texture.anIntArray1471[k];
  7018.                 i1 = i1 * (minimapInt3 + 256) >> 8;
  7019.                 j1 = j1 * (minimapInt3 + 256) >> 8;
  7020.                 int k1 = j * i1 + i * j1 >> 11;
  7021.                 int l1 = j * j1 - i * i1 >> 11;
  7022.                 int i2 = myPlayer.x + k1 >> 7;
  7023.                 int j2 = myPlayer.y - l1 >> 7;
  7024.                 boolean flag1 = doWalkTo(1, 0, 0, 0, myPlayer.smallY[0], 0, 0, j2, myPlayer.smallX[0], true, i2);
  7025.                 if (flag1) {
  7026.                     stream.writeWordBigEndian(i);
  7027.                     stream.writeWordBigEndian(j);
  7028.                     stream.writeWord(minimapInt1);
  7029.                     stream.writeWordBigEndian(57);
  7030.                     stream.writeWordBigEndian(minimapInt2);
  7031.                     stream.writeWordBigEndian(minimapInt3);
  7032.                     stream.writeWordBigEndian(89);
  7033.                     stream.writeWord(myPlayer.x);
  7034.                     stream.writeWord(myPlayer.y);
  7035.                     stream.writeWordBigEndian(anInt1264);
  7036.                     stream.writeWordBigEndian(63);
  7037.                 }
  7038.             }
  7039.             anInt1117++;
  7040.             if (anInt1117 > 1151) {
  7041.                 anInt1117 = 0;
  7042.                 stream.createFrame(246);
  7043.                 stream.writeWordBigEndian(0);
  7044.                 int l = stream.currentOffset;
  7045.                 if ((int) (Math.random() * 2D) == 0) {
  7046.                     stream.writeWordBigEndian(101);
  7047.                 }
  7048.                 stream.writeWordBigEndian(197);
  7049.                 stream.writeWord((int) (Math.random() * 65536D));
  7050.                 stream.writeWordBigEndian((int) (Math.random() * 256D));
  7051.                 stream.writeWordBigEndian(67);
  7052.                 stream.writeWord(14214);
  7053.                 if ((int) (Math.random() * 2D) == 0) {
  7054.                     stream.writeWord(29487);
  7055.                 }
  7056.                 stream.writeWord((int) (Math.random() * 65536D));
  7057.                 if ((int) (Math.random() * 2D) == 0) {
  7058.                     stream.writeWordBigEndian(220);
  7059.                 }
  7060.                 stream.writeWordBigEndian(180);
  7061.                 stream.writeBytes(stream.currentOffset - l);
  7062.             }
  7063.         }
  7064.     }
  7065.  
  7066.     public String interfaceIntToString(int j) {
  7067.         if (j < 0x3b9ac9ff) {
  7068.             return String.valueOf(j);
  7069.         } else {
  7070.             return "*";
  7071.         }
  7072.     }
  7073.  
  7074.     public void showErrorScreen() {
  7075.         Graphics g = getGameComponent().getGraphics();
  7076.         g.setColor(Color.black);
  7077.         g.fillRect(0, 0, 765, 503);
  7078.         method4(1);
  7079.         if (loadingError) {
  7080.             aBoolean831 = false;
  7081.             g.setFont(new Font("Helvetica", 1, 16));
  7082.             g.setColor(Color.yellow);
  7083.             int k = 35;
  7084.             g.drawString("Sorry, an error has occured whilst loading " + ClientSettings.SERVER_NAME + "", 30, k);
  7085.             k += 50;
  7086.             g.setColor(Color.white);
  7087.             g.drawString("To fix this try the following (in order):", 30, k);
  7088.             k += 50;
  7089.             g.setColor(Color.white);
  7090.             g.setFont(new Font("Helvetica", 1, 12));
  7091.             g.drawString("1: Try closing ALL open web-browser windows, and reloading", 30, k);
  7092.             k += 30;
  7093.             g.drawString("2: Try clearing your web-browsers cache from tools->internet options", 30, k);
  7094.             k += 30;
  7095.             g.drawString("3: Try using a different game-world", 30, k);
  7096.             k += 30;
  7097.             g.drawString("4: Try rebooting your computer", 30, k);
  7098.             k += 30;
  7099.             g.drawString("5: Try selecting a different version of Java from the play-game menu", 30, k);
  7100.         }
  7101.         if (genericLoadingError) {
  7102.             aBoolean831 = false;
  7103.             g.setFont(new Font("Helvetica", 1, 20));
  7104.             g.setColor(Color.white);
  7105.             g.drawString("Error - unable to load game!", 50, 50);
  7106.             g.drawString("To play " + ClientSettings.SERVER_NAME + " make sure you play from", 50, 100);
  7107.             g.drawString("" + ClientSettings.SERVER_WEBSITE + "", 50, 150);
  7108.         }
  7109.         if (rsAlreadyLoaded) {
  7110.             aBoolean831 = false;
  7111.             g.setColor(Color.yellow);
  7112.             int l = 35;
  7113.             g.drawString("Error a copy of " + ClientSettings.SERVER_NAME + " already appears to be loaded", 30, l);
  7114.             l += 50;
  7115.             g.setColor(Color.white);
  7116.             g.drawString("To fix this try the following (in order):", 30, l);
  7117.             l += 50;
  7118.             g.setColor(Color.white);
  7119.             g.setFont(new Font("Helvetica", 1, 12));
  7120.             g.drawString("1: Try closing ALL open web-browser windows, and reloading", 30, l);
  7121.             l += 30;
  7122.             g.drawString("2: Try rebooting your computer, and reloading", 30, l);
  7123.             l += 30;
  7124.         }
  7125.     }
  7126.  
  7127.     public URL getCodeBase() {
  7128.         // if (SignLink.mainapp != null) {
  7129.         // return SignLink.mainapp.getCodeBase();
  7130.         // }
  7131.         try {
  7132.             // if (super.gameFrame != null) {
  7133.             return new URL("http://" + server + ":" + (80 + portOff));
  7134.             // }
  7135.         } catch (Exception _ex) {
  7136.         }
  7137.         return null;
  7138.         // return super.getCodeBase();
  7139.     }
  7140.  
  7141.     public void method95() {
  7142.         for (int j = 0; j < npcCount; j++) {
  7143.             int k = npcIndices[j];
  7144.             NPC npc = npcArray[k];
  7145.             if (npc != null) {
  7146.                 method96(npc);
  7147.             }
  7148.         }
  7149.     }
  7150.  
  7151.     public void method96(Entity entity) {
  7152.         if (entity.x < 128 || entity.y < 128 || entity.x >= 13184 || entity.y >= 13184) {
  7153.             entity.anim = -1;
  7154.             entity.anInt1520 = -1;
  7155.             entity.anInt1547 = 0;
  7156.             entity.anInt1548 = 0;
  7157.             entity.x = entity.smallX[0] * 128 + entity.anInt1540 * 64;
  7158.             entity.y = entity.smallY[0] * 128 + entity.anInt1540 * 64;
  7159.             entity.method446();
  7160.         }
  7161.         if (entity == myPlayer && (entity.x < 1536 || entity.y < 1536 || entity.x >= 11776 || entity.y >= 11776)) {
  7162.             entity.anim = -1;
  7163.             entity.anInt1520 = -1;
  7164.             entity.anInt1547 = 0;
  7165.             entity.anInt1548 = 0;
  7166.             entity.x = entity.smallX[0] * 128 + entity.anInt1540 * 64;
  7167.             entity.y = entity.smallY[0] * 128 + entity.anInt1540 * 64;
  7168.             entity.method446();
  7169.         }
  7170.         if (entity.anInt1547 > loopCycle) {
  7171.             method97(entity);
  7172.         } else if (entity.anInt1548 >= loopCycle) {
  7173.             method98(entity);
  7174.         } else {
  7175.             method99(entity);
  7176.         }
  7177.         method100(entity);
  7178.         method101(entity);
  7179.     }
  7180.  
  7181.     public void method97(Entity entity) {
  7182.         int i = entity.anInt1547 - loopCycle;
  7183.         int j = entity.anInt1543 * 128 + entity.anInt1540 * 64;
  7184.         int k = entity.anInt1545 * 128 + entity.anInt1540 * 64;
  7185.         entity.x += (j - entity.x) / i;
  7186.         entity.y += (k - entity.y) / i;
  7187.         entity.anInt1503 = 0;
  7188.         if (entity.anInt1549 == 0) {
  7189.             entity.turnDirection = 1024;
  7190.         }
  7191.         if (entity.anInt1549 == 1) {
  7192.             entity.turnDirection = 1536;
  7193.         }
  7194.         if (entity.anInt1549 == 2) {
  7195.             entity.turnDirection = 0;
  7196.         }
  7197.         if (entity.anInt1549 == 3) {
  7198.             entity.turnDirection = 512;
  7199.         }
  7200.     }
  7201.  
  7202.     public void method98(Entity entity) {
  7203.         if (entity.anInt1548 == loopCycle || entity.anim == -1 || entity.anInt1529 != 0 || entity.anInt1528 + 1 > Animation.anims[entity.anim].method258(entity.anInt1527)) {
  7204.             int i = entity.anInt1548 - entity.anInt1547;
  7205.             int j = loopCycle - entity.anInt1547;
  7206.             int k = entity.anInt1543 * 128 + entity.anInt1540 * 64;
  7207.             int l = entity.anInt1545 * 128 + entity.anInt1540 * 64;
  7208.             int i1 = entity.anInt1544 * 128 + entity.anInt1540 * 64;
  7209.             int j1 = entity.anInt1546 * 128 + entity.anInt1540 * 64;
  7210.             entity.x = (k * (i - j) + i1 * j) / i;
  7211.             entity.y = (l * (i - j) + j1 * j) / i;
  7212.         }
  7213.         entity.anInt1503 = 0;
  7214.         if (entity.anInt1549 == 0) {
  7215.             entity.turnDirection = 1024;
  7216.         }
  7217.         if (entity.anInt1549 == 1) {
  7218.             entity.turnDirection = 1536;
  7219.         }
  7220.         if (entity.anInt1549 == 2) {
  7221.             entity.turnDirection = 0;
  7222.         }
  7223.         if (entity.anInt1549 == 3) {
  7224.             entity.turnDirection = 512;
  7225.         }
  7226.         entity.anInt1552 = entity.turnDirection;
  7227.     }
  7228.  
  7229.     public void method99(Entity entity) {
  7230.         entity.anInt1517 = entity.anInt1511;
  7231.         if (entity.smallXYIndex == 0) {
  7232.             entity.anInt1503 = 0;
  7233.             return;
  7234.         }
  7235.         if (entity.anim != -1 && entity.anInt1529 == 0) {
  7236.             Animation animation = Animation.anims[entity.anim];
  7237.             if (entity.anInt1542 > 0 && animation.anInt363 == 0) {
  7238.                 entity.anInt1503++;
  7239.                 return;
  7240.             }
  7241.             if (entity.anInt1542 <= 0 && animation.anInt364 == 0) {
  7242.                 entity.anInt1503++;
  7243.                 return;
  7244.             }
  7245.         }
  7246.         int i = entity.x;
  7247.         int j = entity.y;
  7248.         int k = entity.smallX[entity.smallXYIndex - 1] * 128 + entity.anInt1540 * 64;
  7249.         int l = entity.smallY[entity.smallXYIndex - 1] * 128 + entity.anInt1540 * 64;
  7250.         if (k - i > 256 || k - i < -256 || l - j > 256 || l - j < -256) {
  7251.             entity.x = k;
  7252.             entity.y = l;
  7253.             return;
  7254.         }
  7255.         if (i < k) {
  7256.             if (j < l) {
  7257.                 entity.turnDirection = 1280;
  7258.             } else if (j > l) {
  7259.                 entity.turnDirection = 1792;
  7260.             } else {
  7261.                 entity.turnDirection = 1536;
  7262.             }
  7263.         } else if (i > k) {
  7264.             if (j < l) {
  7265.                 entity.turnDirection = 768;
  7266.             } else if (j > l) {
  7267.                 entity.turnDirection = 256;
  7268.             } else {
  7269.                 entity.turnDirection = 512;
  7270.             }
  7271.         } else if (j < l) {
  7272.             entity.turnDirection = 1024;
  7273.         } else {
  7274.             entity.turnDirection = 0;
  7275.         }
  7276.         int i1 = entity.turnDirection - entity.anInt1552 & 0x7ff;
  7277.         if (i1 > 1024) {
  7278.             i1 -= 2048;
  7279.         }
  7280.         int j1 = entity.anInt1555;
  7281.         if (i1 >= -256 && i1 <= 256) {
  7282.             j1 = entity.anInt1554;
  7283.         } else if (i1 >= 256 && i1 < 768) {
  7284.             j1 = entity.anInt1557;
  7285.         } else if (i1 >= -768 && i1 <= -256) {
  7286.             j1 = entity.anInt1556;
  7287.         }
  7288.         if (j1 == -1) {
  7289.             j1 = entity.anInt1554;
  7290.         }
  7291.         entity.anInt1517 = j1;
  7292.         int k1 = 4;
  7293.         if (entity.anInt1552 != entity.turnDirection && entity.interactingEntity == -1 && entity.anInt1504 != 0) {
  7294.             k1 = 2;
  7295.         }
  7296.         if (entity.smallXYIndex > 2) {
  7297.             k1 = 6;
  7298.         }
  7299.         if (entity.smallXYIndex > 3) {
  7300.             k1 = 8;
  7301.         }
  7302.         if (entity.anInt1503 > 0 && entity.smallXYIndex > 1) {
  7303.             k1 = 8;
  7304.             entity.anInt1503--;
  7305.         }
  7306.         if (entity.aBooleanArray1553[entity.smallXYIndex - 1]) {
  7307.             k1 <<= 1;
  7308.         }
  7309.         if (k1 >= 8 && entity.anInt1517 == entity.anInt1554 && entity.anInt1505 != -1) {
  7310.             entity.anInt1517 = entity.anInt1505;
  7311.         }
  7312.         if (i < k) {
  7313.             entity.x += k1;
  7314.             if (entity.x > k) {
  7315.                 entity.x = k;
  7316.             }
  7317.         } else if (i > k) {
  7318.             entity.x -= k1;
  7319.             if (entity.x < k) {
  7320.                 entity.x = k;
  7321.             }
  7322.         }
  7323.         if (j < l) {
  7324.             entity.y += k1;
  7325.             if (entity.y > l) {
  7326.                 entity.y = l;
  7327.             }
  7328.         } else if (j > l) {
  7329.             entity.y -= k1;
  7330.             if (entity.y < l) {
  7331.                 entity.y = l;
  7332.             }
  7333.         }
  7334.         if (entity.x == k && entity.y == l) {
  7335.             entity.smallXYIndex--;
  7336.             if (entity.anInt1542 > 0) {
  7337.                 entity.anInt1542--;
  7338.             }
  7339.         }
  7340.     }
  7341.  
  7342.     public void method100(Entity entity) {
  7343.         if (entity.anInt1504 == 0) {
  7344.             return;
  7345.         }
  7346.         if (entity.interactingEntity != -1 && entity.interactingEntity < 32768) {
  7347.             NPC npc = npcArray[entity.interactingEntity];
  7348.             if (npc != null) {
  7349.                 int i1 = entity.x - npc.x;
  7350.                 int k1 = entity.y - npc.y;
  7351.                 if (i1 != 0 || k1 != 0) {
  7352.                     entity.turnDirection = (int) (Math.atan2(i1, k1) * 325.94900000000001D) & 0x7ff;
  7353.                 }
  7354.             }
  7355.         }
  7356.         if (entity.interactingEntity >= 32768) {
  7357.             int j = entity.interactingEntity - 32768;
  7358.             if (j == unknownInt10) {
  7359.                 j = myPlayerIndex;
  7360.             }
  7361.             Player player = playerArray[j];
  7362.             if (player != null) {
  7363.                 int l1 = entity.x - player.x;
  7364.                 int i2 = entity.y - player.y;
  7365.                 if (l1 != 0 || i2 != 0) {
  7366.                     entity.turnDirection = (int) (Math.atan2(l1, i2) * 325.94900000000001D) & 0x7ff;
  7367.                 }
  7368.             }
  7369.         }
  7370.         if ((entity.anInt1538 != 0 || entity.anInt1539 != 0) && (entity.smallXYIndex == 0 || entity.anInt1503 > 0)) {
  7371.             int k = entity.x - (entity.anInt1538 - baseX - baseX) * 64;
  7372.             int j1 = entity.y - (entity.anInt1539 - baseY - baseY) * 64;
  7373.             if (k != 0 || j1 != 0) {
  7374.                 entity.turnDirection = (int) (Math.atan2(k, j1) * 325.94900000000001D) & 0x7ff;
  7375.             }
  7376.             entity.anInt1538 = 0;
  7377.             entity.anInt1539 = 0;
  7378.         }
  7379.         int l = entity.turnDirection - entity.anInt1552 & 0x7ff;
  7380.         if (l != 0) {
  7381.             if (l < entity.anInt1504 || l > 2048 - entity.anInt1504) {
  7382.                 entity.anInt1552 = entity.turnDirection;
  7383.             } else if (l > 1024) {
  7384.                 entity.anInt1552 -= entity.anInt1504;
  7385.             } else {
  7386.                 entity.anInt1552 += entity.anInt1504;
  7387.             }
  7388.             entity.anInt1552 &= 0x7ff;
  7389.             if (entity.anInt1517 == entity.anInt1511 && entity.anInt1552 != entity.turnDirection) {
  7390.                 if (entity.anInt1512 != -1) {
  7391.                     entity.anInt1517 = entity.anInt1512;
  7392.                     return;
  7393.                 }
  7394.                 entity.anInt1517 = entity.anInt1554;
  7395.             }
  7396.         }
  7397.     }
  7398.  
  7399.     public void method101(Entity entity) {
  7400.         entity.aBoolean1541 = false;
  7401.         if (entity.anInt1517 != -1) {
  7402.             Animation animation = Animation.anims[entity.anInt1517];
  7403.             entity.anInt1519++;
  7404.             if (entity.anInt1518 < animation.anInt352 && entity.anInt1519 > animation.method258(entity.anInt1518)) {
  7405.                 entity.anInt1519 = 0;
  7406.                 entity.anInt1518++;
  7407.             }
  7408.             if (entity.anInt1518 >= animation.anInt352) {
  7409.                 entity.anInt1519 = 0;
  7410.                 entity.anInt1518 = 0;
  7411.             }
  7412.         }
  7413.         if (entity.anInt1520 != -1 && loopCycle >= entity.anInt1523) {
  7414.             if (entity.anInt1521 < 0) {
  7415.                 entity.anInt1521 = 0;
  7416.             }
  7417.             Animation animation_1 = SpotAnim.cache[entity.anInt1520].aAnimation_407;
  7418.             for (entity.anInt1522++; entity.anInt1521 < animation_1.anInt352 && entity.anInt1522 > animation_1.method258(entity.anInt1521); entity.anInt1521++) {
  7419.                 entity.anInt1522 -= animation_1.method258(entity.anInt1521);
  7420.             }
  7421.  
  7422.             if (entity.anInt1521 >= animation_1.anInt352 && (entity.anInt1521 < 0 || entity.anInt1521 >= animation_1.anInt352)) {
  7423.                 entity.anInt1520 = -1;
  7424.             }
  7425.         }
  7426.         if (entity.anim != -1 && entity.anInt1529 <= 1) {
  7427.             Animation animation_2 = Animation.anims[entity.anim];
  7428.             if (animation_2.anInt363 == 1 && entity.anInt1542 > 0 && entity.anInt1547 <= loopCycle && entity.anInt1548 < loopCycle) {
  7429.                 entity.anInt1529 = 1;
  7430.                 return;
  7431.             }
  7432.         }
  7433.         if (entity.anim != -1 && entity.anInt1529 == 0) {
  7434.             Animation animation_3 = Animation.anims[entity.anim];
  7435.             for (entity.anInt1528++; entity.anInt1527 < animation_3.anInt352 && entity.anInt1528 > animation_3.method258(entity.anInt1527); entity.anInt1527++) {
  7436.                 entity.anInt1528 -= animation_3.method258(entity.anInt1527);
  7437.             }
  7438.  
  7439.             if (entity.anInt1527 >= animation_3.anInt352) {
  7440.                 entity.anInt1527 -= animation_3.anInt356;
  7441.                 entity.anInt1530++;
  7442.                 if (entity.anInt1530 >= animation_3.anInt362) {
  7443.                     entity.anim = -1;
  7444.                 }
  7445.                 if (entity.anInt1527 < 0 || entity.anInt1527 >= animation_3.anInt352) {
  7446.                     entity.anim = -1;
  7447.                 }
  7448.             }
  7449.             entity.aBoolean1541 = animation_3.aBoolean358;
  7450.         }
  7451.         if (entity.anInt1529 > 0) {
  7452.             entity.anInt1529--;
  7453.         }
  7454.     }
  7455.  
  7456.     public void drawGameScreen() {
  7457.         if (fullScreenBackDialogID != -1 && (loadingStage == 2 || super.fullGameScreen != null)) {
  7458.             if (loadingStage == 2) {
  7459.                 method119(anInt945, fullScreenBackDialogID);
  7460.                 if (fullScreenInterfaceId != -1)
  7461.                     method119(anInt945, fullScreenInterfaceId);
  7462.                 anInt945 = 0;
  7463.                 resetAllImageProducers();
  7464.                 super.fullGameScreen.initDrawingArea();
  7465.                 Texture.lineOffsets = gameScreenOffsets;
  7466.                 DrawingArea.setAllPixelsToZero();
  7467.                 welcomeScreenRaised = true;
  7468.                 RSInterface rSInterface = RSInterface.interfaceCache[fullScreenBackDialogID];
  7469.                 if (rSInterface.width == 512 && rSInterface.height == 334
  7470.                         && rSInterface.type == 0) {
  7471.                     rSInterface.width = 765;
  7472.                     rSInterface.height = 503;
  7473.                 }
  7474.                 drawInterface(0, 0, rSInterface, 0);
  7475.                 if (fullScreenInterfaceId != -1) {
  7476.                     RSInterface class13_1 = RSInterface.interfaceCache[fullScreenInterfaceId];
  7477.                     if (class13_1.width == 512 && class13_1.height == 334
  7478.                             && class13_1.type == 0) {
  7479.                         class13_1.width = 765;
  7480.                         class13_1.height = 503;
  7481.                     }
  7482.                     drawInterface(0, 0, class13_1, 0);
  7483.                 }
  7484.                 if (!menuOpen) {
  7485.                     processRightClick();
  7486.                     drawTooltip();
  7487.                 } else {
  7488.                     drawMenu();
  7489.                 }
  7490.             }
  7491.             super.fullGameScreen.drawGraphics(0, super.graphics, 0);
  7492.             return;
  7493.         }
  7494.         if (welcomeScreenRaised) {
  7495.             resetImageProducers2();
  7496.             welcomeScreenRaised = false;
  7497.             backLeftIP1.drawGraphics(4, super.graphics, 0);
  7498.             backLeftIP2.drawGraphics(357, super.graphics, 0);
  7499.             backRightIP1.drawGraphics(4, super.graphics, 722);
  7500.             backRightIP2.drawGraphics(205, super.graphics, 743);
  7501.             backTopIP1.drawGraphics(0, super.graphics, 0);
  7502.             backVmidIP1.drawGraphics(4, super.graphics, 516);
  7503.             backVmidIP2.drawGraphics(205, super.graphics, 516);
  7504.             backVmidIP3.drawGraphics(357, super.graphics, 496);
  7505.             backVmidIP2_2.drawGraphics(338, super.graphics, 0);
  7506.             needDrawTabArea = true;
  7507.             inputTaken = true;
  7508.             tabAreaAltered = true;
  7509.             aBoolean1233 = true;
  7510.             if (loadingStage != 2) {
  7511.                 aRSImageProducer_1165.drawGraphics(4, super.graphics, 4);
  7512.                 aRSImageProducer_1164.drawGraphics(4, super.graphics, 550);
  7513.             }
  7514.         }
  7515.         if (loadingStage == 2) {
  7516.             method146();
  7517.         }
  7518.         if (menuOpen && menuScreenArea == 1) {
  7519.             needDrawTabArea = true;
  7520.         }
  7521.         if (invOverlayInterfaceID != -1) {
  7522.             boolean flag1 = method119(anInt945, invOverlayInterfaceID);
  7523.             if (flag1) {
  7524.                 needDrawTabArea = true;
  7525.             }
  7526.         }
  7527.         if (atInventoryInterfaceType == 2) {
  7528.             needDrawTabArea = true;
  7529.         }
  7530.         if (activeInterfaceType == 2) {
  7531.             needDrawTabArea = true;
  7532.         }
  7533.         if (needDrawTabArea) {
  7534.             drawTabArea();
  7535.             needDrawTabArea = false;
  7536.         }
  7537.         if (backDialogID == -1) {
  7538.             aClass9_1059.scrollPosition = anInt1211 - anInt1089 - 77;
  7539.             if (super.mouseX > 448 && super.mouseX < 560 && super.mouseY > 332) {
  7540.                 method65(463, 77, super.mouseX - 17, super.mouseY - 357, aClass9_1059, 0, false, anInt1211);
  7541.             }
  7542.             int i = anInt1211 - 77 - aClass9_1059.scrollPosition;
  7543.             if (i < 0) {
  7544.                 i = 0;
  7545.             }
  7546.             if (i > anInt1211 - 77) {
  7547.                 i = anInt1211 - 77;
  7548.             }
  7549.             if (anInt1089 != i) {
  7550.                 anInt1089 = i;
  7551.                 inputTaken = true;
  7552.             }
  7553.         }
  7554.         if (backDialogID != -1) {
  7555.             boolean flag2 = method119(anInt945, backDialogID);
  7556.             if (flag2) {
  7557.                 inputTaken = true;
  7558.             }
  7559.         }
  7560.         if (dialogID != -1) {
  7561.             inputTaken = true;
  7562.         }
  7563.         if (atInventoryInterfaceType == 3) {
  7564.             inputTaken = true;
  7565.         }
  7566.         if (activeInterfaceType == 3) {
  7567.             inputTaken = true;
  7568.         }
  7569.         if (aString844 != null) {
  7570.             inputTaken = true;
  7571.         }
  7572.         if (menuOpen && menuScreenArea == 2) {
  7573.             inputTaken = true;
  7574.         }
  7575.         if (inputTaken) {
  7576.             drawChatArea();
  7577.             inputTaken = false;
  7578.         }
  7579.         if (loadingStage == 2) {
  7580.             drawMinimap();
  7581.             aRSImageProducer_1164.drawGraphics(4, super.graphics, 550);
  7582.         }
  7583.         if (anInt1054 != -1) {
  7584.             tabAreaAltered = true;
  7585.         }
  7586.         if (tabAreaAltered) {
  7587.             if (anInt1054 != -1 && anInt1054 == tabID) {
  7588.                 anInt1054 = -1;
  7589.                 stream.createFrame(120);
  7590.                 stream.writeWordBigEndian(tabID);
  7591.             }
  7592.             tabAreaAltered = false;
  7593.             aRSImageProducer_1125.initDrawingArea();
  7594.             backHmid1.method361(0, 0);
  7595.             if (invOverlayInterfaceID == -1) {
  7596.                 if (tabInterfaceIDs[tabID] != -1) {
  7597.                     if (tabID == 0) {
  7598.                         redStone1.method361(22, 10);
  7599.                     }
  7600.                     if (tabID == 1) {
  7601.                         redStone2.method361(54, 8);
  7602.                     }
  7603.                     if (tabID == 2) {
  7604.                         redStone2.method361(82, 8);
  7605.                     }
  7606.                     if (tabID == 3) {
  7607.                         redStone3.method361(110, 8);
  7608.                     }
  7609.                     if (tabID == 4) {
  7610.                         redStone2_2.method361(153, 8);
  7611.                     }
  7612.                     if (tabID == 5) {
  7613.                         redStone2_2.method361(181, 8);
  7614.                     }
  7615.                     if (tabID == 6) {
  7616.                         redStone1_2.method361(209, 9);
  7617.                     }
  7618.                 }
  7619.                 if (tabInterfaceIDs[0] != -1 && (anInt1054 != 0 || loopCycle % 20 < 10)) {
  7620.                     sideIcons[0].method361(29, 13);
  7621.                 }
  7622.                 if (tabInterfaceIDs[1] != -1 && (anInt1054 != 1 || loopCycle % 20 < 10)) {
  7623.                     sideIcons[1].method361(53, 11);
  7624.                 }
  7625.                 if (tabInterfaceIDs[2] != -1 && (anInt1054 != 2 || loopCycle % 20 < 10)) {
  7626.                     sideIcons[2].method361(82, 11);
  7627.                 }
  7628.                 if (tabInterfaceIDs[3] != -1 && (anInt1054 != 3 || loopCycle % 20 < 10)) {
  7629.                     sideIcons[3].method361(115, 12);
  7630.                 }
  7631.                 if (tabInterfaceIDs[4] != -1 && (anInt1054 != 4 || loopCycle % 20 < 10)) {
  7632.                     sideIcons[4].method361(153, 13);
  7633.                 }
  7634.                 if (tabInterfaceIDs[5] != -1 && (anInt1054 != 5 || loopCycle % 20 < 10)) {
  7635.                     sideIcons[5].method361(180, 11);
  7636.                 }
  7637.                 if (tabInterfaceIDs[6] != -1 && (anInt1054 != 6 || loopCycle % 20 < 10)) {
  7638.                     sideIcons[6].method361(208, 13);
  7639.                 }
  7640.             }
  7641.             aRSImageProducer_1125.drawGraphics(160, super.graphics, 516);
  7642.             aRSImageProducer_1124.initDrawingArea();
  7643.             backBase2.method361(0, 0);
  7644.             if (invOverlayInterfaceID == -1) {
  7645.                 if (tabInterfaceIDs[tabID] != -1) {
  7646.                     if (tabID == 7) {
  7647.                         redStone1_3.method361(42, 0);
  7648.                     }
  7649.                     if (tabID == 8) {
  7650.                         redStone2_3.method361(74, 0);
  7651.                     }
  7652.                     if (tabID == 9) {
  7653.                         redStone2_3.method361(102, 0);
  7654.                     }
  7655.                     if (tabID == 10) {
  7656.                         redStone3_2.method361(130, 1);
  7657.                     }
  7658.                     if (tabID == 11) {
  7659.                         redStone2_4.method361(173, 0);
  7660.                     }
  7661.                     if (tabID == 12) {
  7662.                         redStone2_4.method361(201, 0);
  7663.                     }
  7664.                     if (tabID == 13) {
  7665.                         redStone1_4.method361(229, 0);
  7666.                     }
  7667.                 }
  7668.                 if (tabInterfaceIDs[8] != -1 && (anInt1054 != 8 || loopCycle % 20 < 10)) {
  7669.                     sideIcons[7].method361(74, 2);
  7670.                 }
  7671.                 if (tabInterfaceIDs[9] != -1 && (anInt1054 != 9 || loopCycle % 20 < 10)) {
  7672.                     sideIcons[8].method361(102, 3);
  7673.                 }
  7674.                 if (tabInterfaceIDs[10] != -1 && (anInt1054 != 10 || loopCycle % 20 < 10)) {
  7675.                     sideIcons[9].method361(137, 4);
  7676.                 }
  7677.                 if (tabInterfaceIDs[11] != -1 && (anInt1054 != 11 || loopCycle % 20 < 10)) {
  7678.                     sideIcons[10].method361(174, 2);
  7679.                 }
  7680.                 if (tabInterfaceIDs[12] != -1 && (anInt1054 != 12 || loopCycle % 20 < 10)) {
  7681.                     sideIcons[11].method361(201, 2);
  7682.                 }
  7683.                 if (tabInterfaceIDs[13] != -1 && (anInt1054 != 13 || loopCycle % 20 < 10)) {
  7684.                     sideIcons[12].method361(226, 2);
  7685.                 }
  7686.             }
  7687.             aRSImageProducer_1124.drawGraphics(466, super.graphics, 496);
  7688.             aRSImageProducer_1165.initDrawingArea();
  7689.             Texture.lineOffsets = chatBoxAreaOffsets;
  7690.         }
  7691.         if (aBoolean1233) {
  7692.             aBoolean1233 = false;
  7693.             aRSImageProducer_1123.initDrawingArea();
  7694.             backBase1.method361(0, 0);
  7695.             aTextDrawingArea_1271.method382(0xffffff, 55, "Public chat", 28, true);
  7696.             if (publicChatMode == 0) {
  7697.                 aTextDrawingArea_1271.method382(65280, 55, "On", 41, true);
  7698.             }
  7699.             if (publicChatMode == 1) {
  7700.                 aTextDrawingArea_1271.method382(0xffff00, 55, "Friends", 41, true);
  7701.             }
  7702.             if (publicChatMode == 2) {
  7703.                 aTextDrawingArea_1271.method382(0xff0000, 55, "Off", 41, true);
  7704.             }
  7705.             if (publicChatMode == 3) {
  7706.                 aTextDrawingArea_1271.method382(65535, 55, "Hide", 41, true);
  7707.             }
  7708.             aTextDrawingArea_1271.method382(0xffffff, 184, "Private chat", 28, true);
  7709.             if (privateChatMode == 0) {
  7710.                 aTextDrawingArea_1271.method382(65280, 184, "On", 41, true);
  7711.             }
  7712.             if (privateChatMode == 1) {
  7713.                 aTextDrawingArea_1271.method382(0xffff00, 184, "Friends", 41, true);
  7714.             }
  7715.             if (privateChatMode == 2) {
  7716.                 aTextDrawingArea_1271.method382(0xff0000, 184, "Off", 41, true);
  7717.             }
  7718.             aTextDrawingArea_1271.method382(0xffffff, 324, "Trade/compete", 28, true);
  7719.             if (tradeMode == 0) {
  7720.                 aTextDrawingArea_1271.method382(65280, 324, "On", 41, true);
  7721.             }
  7722.             if (tradeMode == 1) {
  7723.                 aTextDrawingArea_1271.method382(0xffff00, 324, "Friends", 41, true);
  7724.             }
  7725.             if (tradeMode == 2) {
  7726.                 aTextDrawingArea_1271.method382(0xff0000, 324, "Off", 41, true);
  7727.             }
  7728.             aTextDrawingArea_1271.method382(0xffffff, 458, "Report abuse", 33, true);
  7729.             aRSImageProducer_1123.drawGraphics(453, super.graphics, 0);
  7730.             aRSImageProducer_1165.initDrawingArea();
  7731.             Texture.lineOffsets = chatBoxAreaOffsets;
  7732.         }
  7733.         anInt945 = 0;
  7734.     }
  7735.  
  7736.     public boolean buildFriendsListMenu(RSInterface class9) {
  7737.         int i = class9.anInt214;
  7738.         if (i >= 1 && i <= 200 || i >= 701 && i <= 900) {
  7739.             if (i >= 801) {
  7740.                 i -= 701;
  7741.             } else if (i >= 701) {
  7742.                 i -= 601;
  7743.             } else if (i >= 101) {
  7744.                 i -= 101;
  7745.             } else {
  7746.                 i--;
  7747.             }
  7748.             menuActionName[menuActionRow] = "Remove @whi@" + friendsList[i];
  7749.             menuActionID[menuActionRow] = 792;
  7750.             menuActionRow++;
  7751.             menuActionName[menuActionRow] = "Message @whi@" + friendsList[i];
  7752.             menuActionID[menuActionRow] = 639;
  7753.             menuActionRow++;
  7754.             return true;
  7755.         }
  7756.         if (i >= 401 && i <= 500) {
  7757.             menuActionName[menuActionRow] = "Remove @whi@" + class9.disabledText;
  7758.             menuActionID[menuActionRow] = 322;
  7759.             menuActionRow++;
  7760.             return true;
  7761.         } else {
  7762.             return false;
  7763.         }
  7764.     }
  7765.  
  7766.     public void method104() {
  7767.         Animable_Sub3 class30_sub2_sub4_sub3 = (Animable_Sub3) aClass19_1056.reverseGetFirst();
  7768.         for (; class30_sub2_sub4_sub3 != null; class30_sub2_sub4_sub3 = (Animable_Sub3) aClass19_1056.reverseGetNext()) {
  7769.             if (class30_sub2_sub4_sub3.anInt1560 != plane || class30_sub2_sub4_sub3.aBoolean1567) {
  7770.                 class30_sub2_sub4_sub3.unlink();
  7771.             } else if (loopCycle >= class30_sub2_sub4_sub3.anInt1564) {
  7772.                 class30_sub2_sub4_sub3.method454(anInt945);
  7773.                 if (class30_sub2_sub4_sub3.aBoolean1567) {
  7774.                     class30_sub2_sub4_sub3.unlink();
  7775.                 } else {
  7776.                     worldController.method285(class30_sub2_sub4_sub3.anInt1560, 0, class30_sub2_sub4_sub3.anInt1563, -1, class30_sub2_sub4_sub3.anInt1562, 60, class30_sub2_sub4_sub3.anInt1561, class30_sub2_sub4_sub3, false);
  7777.                 }
  7778.             }
  7779.         }
  7780.  
  7781.     }
  7782.  
  7783.     public void drawInterface(int scrollPos, int k, RSInterface class9, int l) {
  7784.         if (class9.type != 0 || class9.children == null) {
  7785.             return;
  7786.         }
  7787.         if (class9.aBoolean266 && anInt1026 != class9.id && anInt1048 != class9.id && anInt1039 != class9.id) {
  7788.             return;
  7789.         }
  7790.         int i1 = DrawingArea.topX;
  7791.         int j1 = DrawingArea.topY;
  7792.         int k1 = DrawingArea.bottomX;
  7793.         int l1 = DrawingArea.bottomY;
  7794.         DrawingArea.setDrawingArea(l + class9.height, k, k + class9.width, l);
  7795.         int i2 = class9.children.length;
  7796.         for (int j2 = 0; j2 < i2; j2++) {
  7797.             int k2 = class9.childX[j2] + k;
  7798.             int l2 = class9.childY[j2] + l - scrollPos;
  7799.             RSInterface component = RSInterface.interfaceCache[class9.children[j2]];
  7800.             k2 += component.anInt263;
  7801.             l2 += component.anInt265;
  7802.             if (component.anInt214 > 0) {
  7803.                 drawFriendsListOrWelcomeScreen(component);
  7804.             }
  7805.             if (component.type == 0) {
  7806.                 if (component.scrollPosition > component.scrollMax - component.height) {
  7807.                     component.scrollPosition = component.scrollMax - component.height;
  7808.                 }
  7809.                 if (component.scrollPosition < 0) {
  7810.                     component.scrollPosition = 0;
  7811.                 }
  7812.                 drawInterface(component.scrollPosition, k2, component, l2);
  7813.                 if (component.scrollMax > component.height) {
  7814.                     method30(component.height, component.scrollPosition, l2, k2 + component.width, component.scrollMax);
  7815.                 }
  7816.             } else if (component.type != 1) {
  7817.                 if (component.type == 2) {
  7818.                     int i3 = 0;
  7819.                     for (int l3 = 0; l3 < component.height; l3++) {
  7820.                         for (int l4 = 0; l4 < component.width; l4++) {
  7821.                             int k5 = k2 + l4 * (32 + component.invSpritePadX);
  7822.                             int j6 = l2 + l3 * (32 + component.invSpritePadY);
  7823.                             if (i3 < 20) {
  7824.                                 k5 += component.spritesX[i3];
  7825.                                 j6 += component.spritesY[i3];
  7826.                             }
  7827.                             if (component.inv[i3] > 0) {
  7828.                                 int k6 = 0;
  7829.                                 int j7 = 0;
  7830.                                 int j9 = component.inv[i3] - 1;
  7831.                                 if (k5 > DrawingArea.topX - 32 && k5 < DrawingArea.bottomX && j6 > DrawingArea.topY - 32 && j6 < DrawingArea.bottomY || activeInterfaceType != 0 && anInt1085 == i3) {
  7832.                                     int l9 = 0;
  7833.                                     if (itemSelected == 1 && anInt1283 == i3 && anInt1284 == component.id) {
  7834.                                         l9 = 0xffffff;
  7835.                                     }
  7836.                                     Sprite class30_sub2_sub1_sub1_2 = ItemDef.getSprite(j9, component.invStackSizes[i3], l9);
  7837.                                     if (class30_sub2_sub1_sub1_2 != null) {
  7838.                                         if (activeInterfaceType != 0 && anInt1085 == i3 && anInt1084 == component.id) {
  7839.                                             k6 = super.mouseX - anInt1087;
  7840.                                             j7 = super.mouseY - anInt1088;
  7841.                                             if (k6 < 5 && k6 > -5) {
  7842.                                                 k6 = 0;
  7843.                                             }
  7844.                                             if (j7 < 5 && j7 > -5) {
  7845.                                                 j7 = 0;
  7846.                                             }
  7847.                                             if (anInt989 < 5) {
  7848.                                                 k6 = 0;
  7849.                                                 j7 = 0;
  7850.                                             }
  7851.                                             class30_sub2_sub1_sub1_2.drawSprite1(k5 + k6, j6 + j7);
  7852.                                             if (j6 + j7 < DrawingArea.topY && class9.scrollPosition > 0) {
  7853.                                                 int i10 = anInt945 * (DrawingArea.topY - j6 - j7) / 3;
  7854.                                                 if (i10 > anInt945 * 10) {
  7855.                                                     i10 = anInt945 * 10;
  7856.                                                 }
  7857.                                                 if (i10 > class9.scrollPosition) {
  7858.                                                     i10 = class9.scrollPosition;
  7859.                                                 }
  7860.                                                 class9.scrollPosition -= i10;
  7861.                                                 anInt1088 += i10;
  7862.                                             }
  7863.                                             if (j6 + j7 + 32 > DrawingArea.bottomY && class9.scrollPosition < class9.scrollMax - class9.height) {
  7864.                                                 int j10 = anInt945 * (j6 + j7 + 32 - DrawingArea.bottomY) / 3;
  7865.                                                 if (j10 > anInt945 * 10) {
  7866.                                                     j10 = anInt945 * 10;
  7867.                                                 }
  7868.                                                 if (j10 > class9.scrollMax - class9.height - class9.scrollPosition) {
  7869.                                                     j10 = class9.scrollMax - class9.height - class9.scrollPosition;
  7870.                                                 }
  7871.                                                 class9.scrollPosition += j10;
  7872.                                                 anInt1088 -= j10;
  7873.                                             }
  7874.                                         } else if (atInventoryInterfaceType != 0 && atInventoryIndex == i3 && atInventoryInterface == component.id) {
  7875.                                             class30_sub2_sub1_sub1_2.drawSprite1(k5, j6);
  7876.                                         } else {
  7877.                                             class30_sub2_sub1_sub1_2.drawSprite(k5, j6);
  7878.                                         }
  7879.                                         if (class30_sub2_sub1_sub1_2.trimWidth == 33 || component.invStackSizes[i3] != 1) {
  7880.                                             int k10 = component.invStackSizes[i3];
  7881.                                             aTextDrawingArea_1270.method385(0, intToKOrMil(k10), j6 + 10 + j7, k5 + 1 + k6);
  7882.                                             aTextDrawingArea_1270.method385(0xffff00, intToKOrMil(k10), j6 + 9 + j7, k5 + k6);
  7883.                                         }
  7884.                                     }
  7885.                                 }
  7886.                             } else if (component.sprites != null && i3 < 20) {
  7887.                                 Sprite class30_sub2_sub1_sub1_1 = component.sprites[i3];
  7888.                                 if (class30_sub2_sub1_sub1_1 != null) {
  7889.                                     class30_sub2_sub1_sub1_1.drawSprite(k5, j6);
  7890.                                 }
  7891.                             }
  7892.                             i3++;
  7893.                         }
  7894.  
  7895.                     }
  7896.  
  7897.                 } else if (component.type == 3) {
  7898.                     boolean flag = false;
  7899.                     if (anInt1039 == component.id || anInt1048 == component.id || anInt1026 == component.id) {
  7900.                         flag = true;
  7901.                     }
  7902.                     int j3;
  7903.                     if (interfaceIsSelected(component)) {
  7904.                         j3 = component.anInt219;
  7905.                         if (flag && component.anInt239 != 0) {
  7906.                             j3 = component.anInt239;
  7907.                         }
  7908.                     } else {
  7909.                         j3 = component.textColor;
  7910.                         if (flag && component.anInt216 != 0) {
  7911.                             j3 = component.anInt216;
  7912.                         }
  7913.                     }
  7914.                     if (component.aByte254 == 0) {
  7915.                         if (component.aBoolean227) {
  7916.                             DrawingArea.method336(component.height, l2, j3, component.width, k2);
  7917.                         } else {
  7918.                             DrawingArea.fillPixels(l2, component.height, j3, k2, component.width);
  7919.                         }
  7920.                     } else if (component.aBoolean227) {
  7921.                         DrawingArea.method335(j3, l2, component.width, component.height, 256 - (component.aByte254 & 0xff), k2);
  7922.                     } else {
  7923.                         DrawingArea.method338(l2, component.height, 256 - (component.aByte254 & 0xff), j3, component.width, k2);
  7924.                     }
  7925.                 } else if (component.type == 4) {
  7926.                     TextDrawingArea textDrawingArea = component.textDrawingAreas;
  7927.                     String s = component.disabledText;
  7928.                     boolean flag1 = false;
  7929.                     if (anInt1039 == component.id || anInt1048 == component.id || anInt1026 == component.id) {
  7930.                         flag1 = true;
  7931.                     }
  7932.                     int i4;
  7933.                     if (interfaceIsSelected(component)) {
  7934.                         i4 = component.anInt219;
  7935.                         if (flag1 && component.anInt239 != 0) {
  7936.                             i4 = component.anInt239;
  7937.                         }
  7938.                         if (component.enabledText.length() > 0) {
  7939.                             s = component.enabledText;
  7940.                         }
  7941.                     } else {
  7942.                         i4 = component.textColor;
  7943.                         if (flag1 && component.anInt216 != 0) {
  7944.                             i4 = component.anInt216;
  7945.                         }
  7946.                     }
  7947.                     if (component.atActionType == 6 && aBoolean1149) {
  7948.                         s = "Please wait...";
  7949.                         i4 = component.textColor;
  7950.                     }
  7951.                     if (DrawingArea.width == 479) {
  7952.                         if (i4 == 0xffff00) {
  7953.                             i4 = 255;
  7954.                         }
  7955.                         if (i4 == 49152) {
  7956.                             i4 = 0xffffff;
  7957.                         }
  7958.                     }
  7959.                     for (int l6 = l2 + textDrawingArea.anInt1497; s.length() > 0; l6 += textDrawingArea.anInt1497) {
  7960.                         if (s.indexOf("%") != -1) {
  7961.                             do {
  7962.                                 int k7 = s.indexOf("%1");
  7963.                                 if (k7 == -1) {
  7964.                                     break;
  7965.                                 }
  7966.                                 s = s.substring(0, k7) + interfaceIntToString(extractInterfaceValues(component, 0)) + s.substring(k7 + 2);
  7967.                             } while (true);
  7968.                             do {
  7969.                                 int l7 = s.indexOf("%2");
  7970.                                 if (l7 == -1) {
  7971.                                     break;
  7972.                                 }
  7973.                                 s = s.substring(0, l7) + interfaceIntToString(extractInterfaceValues(component, 1)) + s.substring(l7 + 2);
  7974.                             } while (true);
  7975.                             do {
  7976.                                 int i8 = s.indexOf("%3");
  7977.                                 if (i8 == -1) {
  7978.                                     break;
  7979.                                 }
  7980.                                 s = s.substring(0, i8) + interfaceIntToString(extractInterfaceValues(component, 2)) + s.substring(i8 + 2);
  7981.                             } while (true);
  7982.                             do {
  7983.                                 int j8 = s.indexOf("%4");
  7984.                                 if (j8 == -1) {
  7985.                                     break;
  7986.                                 }
  7987.                                 s = s.substring(0, j8) + interfaceIntToString(extractInterfaceValues(component, 3)) + s.substring(j8 + 2);
  7988.                             } while (true);
  7989.                             do {
  7990.                                 int k8 = s.indexOf("%5");
  7991.                                 if (k8 == -1) {
  7992.                                     break;
  7993.                                 }
  7994.                                 s = s.substring(0, k8) + interfaceIntToString(extractInterfaceValues(component, 4)) + s.substring(k8 + 2);
  7995.                             } while (true);
  7996.                         }
  7997.                         int l8 = s.indexOf("\\n");
  7998.                         String s1;
  7999.                         if (l8 != -1) {
  8000.                             s1 = s.substring(0, l8);
  8001.                             s = s.substring(l8 + 2);
  8002.                         } else {
  8003.                             s1 = s;
  8004.                             s = "";
  8005.                         }
  8006.                         if (component.aBoolean223) {
  8007.                             textDrawingArea.method382(i4, k2 + component.width / 2, s1, l6, component.aBoolean268);
  8008.                         } else {
  8009.                             textDrawingArea.method389(component.aBoolean268, k2, i4, s1, l6);
  8010.                         }
  8011.                     }
  8012.  
  8013.                 } else if (component.type == 5) {
  8014.                     Sprite sprite;
  8015.                     if (interfaceIsSelected(component)) {
  8016.                         sprite = component.sprite2;
  8017.                     } else {
  8018.                         sprite = component.sprite1;
  8019.                     }
  8020.                     if (sprite != null) {
  8021.                         sprite.drawSprite(k2, l2);
  8022.                     }
  8023.                 } else if (component.type == 6) {
  8024.                     int k3 = Texture.textureInt1;
  8025.                     int j4 = Texture.textureInt2;
  8026.                     Texture.textureInt1 = k2 + component.width / 2;
  8027.                     Texture.textureInt2 = l2 + component.height / 2;
  8028.                     int i5 = Texture.anIntArray1470[component.anInt270] * component.anInt269 >> 16;
  8029.                     int l5 = Texture.anIntArray1471[component.anInt270] * component.anInt269 >> 16;
  8030.                     boolean flag2 = interfaceIsSelected(component);
  8031.                     int i7;
  8032.                     if (flag2) {
  8033.                         i7 = component.anInt258;
  8034.                     } else {
  8035.                         i7 = component.anInt257;
  8036.                     }
  8037.                     Model model;
  8038.                     if (i7 == -1) {
  8039.                         model = component.method209(-1, -1, flag2);
  8040.                     } else {
  8041.                         Animation animation = Animation.anims[i7];
  8042.                         model = component.method209(animation.anIntArray354[component.anInt246], animation.anIntArray353[component.anInt246], flag2);
  8043.                     }
  8044.                     if (model != null) {
  8045.                         model.method482(component.anInt271, 0, component.anInt270, 0, i5, l5);
  8046.                     }
  8047.                     Texture.textureInt1 = k3;
  8048.                     Texture.textureInt2 = j4;
  8049.                 } else if (component.type == 7) {
  8050.                     TextDrawingArea textDrawingArea_1 = component.textDrawingAreas;
  8051.                     int k4 = 0;
  8052.                     for (int j5 = 0; j5 < component.height; j5++) {
  8053.                         for (int i6 = 0; i6 < component.width; i6++) {
  8054.                             if (component.inv[k4] > 0) {
  8055.                                 ItemDef itemDef = ItemDef.forID(component.inv[k4] - 1);
  8056.                                 String s2 = itemDef.name;
  8057.                                 if (itemDef.stackable || component.invStackSizes[k4] != 1) {
  8058.                                     s2 = s2 + " x" + intToKOrMilLongName(component.invStackSizes[k4]);
  8059.                                 }
  8060.                                 int i9 = k2 + i6 * (115 + component.invSpritePadX);
  8061.                                 int k9 = l2 + j5 * (12 + component.invSpritePadY);
  8062.                                 if (component.aBoolean223) {
  8063.                                     textDrawingArea_1.method382(component.textColor, i9 + component.width / 2, s2, k9, component.aBoolean268);
  8064.                                 } else {
  8065.                                     textDrawingArea_1.method389(component.aBoolean268, i9, component.textColor, s2, k9);
  8066.                                 }
  8067.                             }
  8068.                             k4++;
  8069.                         }
  8070.  
  8071.                     }
  8072.  
  8073.                 } else if(component.type == 8) {
  8074.                    
  8075.                 }
  8076.             }
  8077.         }
  8078.  
  8079.         DrawingArea.setDrawingArea(l1, i1, k1, j1);
  8080.     }
  8081.  
  8082.     public void randomizeBackground(Background background) {
  8083.         int j = 256;
  8084.         for (int k = 0; k < anIntArray1190.length; k++) {
  8085.             anIntArray1190[k] = 0;
  8086.         }
  8087.  
  8088.         for (int l = 0; l < 5000; l++) {
  8089.             int i1 = (int) (Math.random() * 128D * (double) j);
  8090.             anIntArray1190[i1] = (int) (Math.random() * 256D);
  8091.         }
  8092.  
  8093.         for (int j1 = 0; j1 < 20; j1++) {
  8094.             for (int k1 = 1; k1 < j - 1; k1++) {
  8095.                 for (int i2 = 1; i2 < 127; i2++) {
  8096.                     int k2 = i2 + (k1 << 7);
  8097.                     anIntArray1191[k2] = (anIntArray1190[k2 - 1] + anIntArray1190[k2 + 1] + anIntArray1190[k2 - 128] + anIntArray1190[k2 + 128]) / 4;
  8098.                 }
  8099.  
  8100.             }
  8101.  
  8102.             int ai[] = anIntArray1190;
  8103.             anIntArray1190 = anIntArray1191;
  8104.             anIntArray1191 = ai;
  8105.         }
  8106.  
  8107.         if (background != null) {
  8108.             int l1 = 0;
  8109.             for (int j2 = 0; j2 < background.anInt1453; j2++) {
  8110.                 for (int l2 = 0; l2 < background.anInt1452; l2++) {
  8111.                     if (background.aByteArray1450[l1++] != 0) {
  8112.                         int i3 = l2 + 16 + background.anInt1454;
  8113.                         int j3 = j2 + 16 + background.anInt1455;
  8114.                         int k3 = i3 + (j3 << 7);
  8115.                         anIntArray1190[k3] = 0;
  8116.                     }
  8117.                 }
  8118.  
  8119.             }
  8120.  
  8121.         }
  8122.     }
  8123.  
  8124.     public void method107(int i, int j, Stream stream, Player player) {
  8125.         if ((i & 0x400) != 0) {
  8126.             player.anInt1543 = stream.method428();
  8127.             player.anInt1545 = stream.method428();
  8128.             player.anInt1544 = stream.method428();
  8129.             player.anInt1546 = stream.method428();
  8130.             player.anInt1547 = stream.method436() + loopCycle;
  8131.             player.anInt1548 = stream.method435() + loopCycle;
  8132.             player.anInt1549 = stream.method428();
  8133.             player.method446();
  8134.         }
  8135.         if ((i & 0x100) != 0) {
  8136.             player.anInt1520 = stream.method434();
  8137.             int k = stream.readDWord();
  8138.             player.anInt1524 = k >> 16;
  8139.             player.anInt1523 = loopCycle + (k & 0xffff);
  8140.             player.anInt1521 = 0;
  8141.             player.anInt1522 = 0;
  8142.             if (player.anInt1523 > loopCycle) {
  8143.                 player.anInt1521 = -1;
  8144.             }
  8145.             if (player.anInt1520 == 65535) {
  8146.                 player.anInt1520 = -1;
  8147.             }
  8148.             //processSound(player.anInt1520, 0, player, null);
  8149.         }
  8150.         if ((i & 8) != 0) {
  8151.             int l = stream.method434();
  8152.             if (l == 65535) {
  8153.                 l = -1;
  8154.             }
  8155.             //processSound(l, 1, player, null);
  8156.             int i2 = stream.method427();
  8157.             if (l == player.anim && l != -1) {
  8158.                 int i3 = Animation.anims[l].anInt365;
  8159.                 if (i3 == 1) {
  8160.                     player.anInt1527 = 0;
  8161.                     player.anInt1528 = 0;
  8162.                     player.anInt1529 = i2;
  8163.                     player.anInt1530 = 0;
  8164.                 }
  8165.                 if (i3 == 2) {
  8166.                     player.anInt1530 = 0;
  8167.                 }
  8168.             } else if (l == -1 || player.anim == -1 || Animation.anims[l].anInt359 >= Animation.anims[player.anim].anInt359) {
  8169.                 player.anim = l;
  8170.                 player.anInt1527 = 0;
  8171.                 player.anInt1528 = 0;
  8172.                 player.anInt1529 = i2;
  8173.                 player.anInt1530 = 0;
  8174.                 player.anInt1542 = player.smallXYIndex;
  8175.             }
  8176.         }
  8177.         if ((i & 4) != 0) {
  8178.             player.textSpoken = stream.readString();
  8179.             if (player.textSpoken.charAt(0) == '~') {
  8180.                 player.textSpoken = player.textSpoken.substring(1);
  8181.                 pushMessage(player.textSpoken, 2, player.name);
  8182.             } else if (player == myPlayer) {
  8183.                 pushMessage(player.textSpoken, 2, player.name);
  8184.             }
  8185.             player.anInt1513 = 0;
  8186.             player.anInt1531 = 0;
  8187.             player.textCycle = 150;
  8188.         }
  8189.         if ((i & 0x80) != 0) {
  8190.             int i1 = stream.method434();
  8191.             int j2 = stream.readUnsignedByte();
  8192.             int j3 = stream.method427();
  8193.             int k3 = stream.currentOffset;
  8194.             if (player.name != null && player.visible) {
  8195.                 long l3 = TextClass.longForName(player.name);
  8196.                 boolean flag = false;
  8197.                 if (j2 <= 1) {
  8198.                     for (int i4 = 0; i4 < ignoreCount; i4++) {
  8199.                         if (ignoreListAsLongs[i4] != l3) {
  8200.                             continue;
  8201.                         }
  8202.                         flag = true;
  8203.                         break;
  8204.                     }
  8205.  
  8206.                 }
  8207.                 if (!flag && anInt1251 == 0) {
  8208.                     try {
  8209.                         aStream_834.currentOffset = 0;
  8210.                         stream.method442(j3, 0, aStream_834.buffer);
  8211.                         aStream_834.currentOffset = 0;
  8212.                         String s = TextInput.method525(j3, aStream_834);
  8213.                         s = Censor.doCensor(s);
  8214.                         player.textSpoken = s;
  8215.                         player.anInt1513 = i1 >> 8;
  8216.                         player.privelage = j2;
  8217.  
  8218.                         // entityMessage(player);
  8219.  
  8220.                         player.anInt1531 = i1 & 0xff;
  8221.                         player.textCycle = 150;
  8222.                         if (j2 == 2 || j2 == 3) {
  8223.                             pushMessage(s, 1, "@cr2@" + player.name);
  8224.                         } else if (j2 == 1) {
  8225.                             pushMessage(s, 1, "@cr1@" + player.name);
  8226.                         } else {
  8227.                             pushMessage(s, 2, player.name);
  8228.                         }
  8229.                     } catch (Exception exception) {
  8230.                         Signlink.reporterror("cde2");
  8231.                     }
  8232.                 }
  8233.             }
  8234.             stream.currentOffset = k3 + j3;
  8235.         }
  8236.         if ((i & 1) != 0) {
  8237.             player.interactingEntity = stream.method434();
  8238.             if (player.interactingEntity == 65535) {
  8239.                 player.interactingEntity = -1;
  8240.             }
  8241.         }
  8242.         if ((i & 0x10) != 0) {
  8243.             int j1 = stream.method427();
  8244.             byte abyte0[] = new byte[j1];
  8245.             Stream stream_1 = new Stream(abyte0);
  8246.             stream.readBytes(j1, 0, abyte0);
  8247.             aStreamArray895s[j] = stream_1;
  8248.             player.updatePlayer(stream_1);
  8249.         }
  8250.         if ((i & 2) != 0) {
  8251.             player.anInt1538 = stream.method436();
  8252.             player.anInt1539 = stream.method434();
  8253.         }
  8254.         if ((i & 0x20) != 0) {
  8255.             int k1 = stream.readUnsignedByte();
  8256.             int k2 = stream.readUnsignedByteA();
  8257.             player.updateHitData(k2, k1, loopCycle);
  8258.             player.loopCycleStatus = loopCycle + 300;
  8259.             player.currentHealth = stream.method427();
  8260.             player.maxHealth = stream.readUnsignedByte();
  8261.         }
  8262.         if ((i & 0x200) != 0) {
  8263.             int l1 = stream.readUnsignedByte();
  8264.             int l2 = stream.method428();
  8265.             player.updateHitData(l2, l1, loopCycle);
  8266.             player.loopCycleStatus = loopCycle + 300;
  8267.             player.currentHealth = stream.readUnsignedByte();
  8268.             player.maxHealth = stream.method427();
  8269.         }
  8270.     }
  8271.  
  8272.     public void method108() {
  8273.         try {
  8274.             int j = myPlayer.x + anInt1278;
  8275.             int k = myPlayer.y + anInt1131;
  8276.             if (anInt1014 - j < -500 || anInt1014 - j > 500 || anInt1015 - k < -500 || anInt1015 - k > 500) {
  8277.                 anInt1014 = j;
  8278.                 anInt1015 = k;
  8279.             }
  8280.             if (anInt1014 != j) {
  8281.                 anInt1014 += (j - anInt1014) / 16;
  8282.             }
  8283.             if (anInt1015 != k) {
  8284.                 anInt1015 += (k - anInt1015) / 16;
  8285.             }
  8286.             if (super.keyArray[1] == 1) {
  8287.                 anInt1186 += (-24 - anInt1186) / 2;
  8288.             } else if (super.keyArray[2] == 1) {
  8289.                 anInt1186 += (24 - anInt1186) / 2;
  8290.             } else {
  8291.                 anInt1186 /= 2;
  8292.             }
  8293.             if (super.keyArray[3] == 1) {
  8294.                 anInt1187 += (12 - anInt1187) / 2;
  8295.             } else if (super.keyArray[4] == 1) {
  8296.                 anInt1187 += (-12 - anInt1187) / 2;
  8297.             } else {
  8298.                 anInt1187 /= 2;
  8299.             }
  8300.             minimapInt1 = minimapInt1 + anInt1186 / 2 & 0x7ff;
  8301.             anInt1184 += anInt1187 / 2;
  8302.             if (anInt1184 < 128) {
  8303.                 anInt1184 = 128;
  8304.             }
  8305.             if (anInt1184 > 383) {
  8306.                 anInt1184 = 383;
  8307.             }
  8308.             int l = anInt1014 >> 7;
  8309.             int i1 = anInt1015 >> 7;
  8310.             int j1 = method42(plane, anInt1015, anInt1014);
  8311.             int k1 = 0;
  8312.             if (l > 3 && i1 > 3 && l < 100 && i1 < 100) {
  8313.                 for (int l1 = l - 4; l1 <= l + 4; l1++) {
  8314.                     for (int k2 = i1 - 4; k2 <= i1 + 4; k2++) {
  8315.                         int l2 = plane;
  8316.                         if (l2 < 3 && (byteGroundArray[1][l1][k2] & 2) == 2) {
  8317.                             l2++;
  8318.                         }
  8319.                         int i3 = j1 - intGroundArray[l2][l1][k2];
  8320.                         if (i3 > k1) {
  8321.                             k1 = i3;
  8322.                         }
  8323.                     }
  8324.  
  8325.                 }
  8326.  
  8327.             }
  8328.             anInt1005++;
  8329.             if (anInt1005 > 1512) {
  8330.                 anInt1005 = 0;
  8331.                 stream.createFrame(77);
  8332.                 stream.writeWordBigEndian(0);
  8333.                 int i2 = stream.currentOffset;
  8334.                 stream.writeWordBigEndian((int) (Math.random() * 256D));
  8335.                 stream.writeWordBigEndian(101);
  8336.                 stream.writeWordBigEndian(233);
  8337.                 stream.writeWord(45092);
  8338.                 if ((int) (Math.random() * 2D) == 0) {
  8339.                     stream.writeWord(35784);
  8340.                 }
  8341.                 stream.writeWordBigEndian((int) (Math.random() * 256D));
  8342.                 stream.writeWordBigEndian(64);
  8343.                 stream.writeWordBigEndian(38);
  8344.                 stream.writeWord((int) (Math.random() * 65536D));
  8345.                 stream.writeWord((int) (Math.random() * 65536D));
  8346.                 stream.writeBytes(stream.currentOffset - i2);
  8347.             }
  8348.             int j2 = k1 * 192;
  8349.             if (j2 > 0x17f00) {
  8350.                 j2 = 0x17f00;
  8351.             }
  8352.             if (j2 < 32768) {
  8353.                 j2 = 32768;
  8354.             }
  8355.             if (j2 > anInt984) {
  8356.                 anInt984 += (j2 - anInt984) / 24;
  8357.                 return;
  8358.             }
  8359.             if (j2 < anInt984) {
  8360.                 anInt984 += (j2 - anInt984) / 80;
  8361.             }
  8362.         } catch (Exception _ex) {
  8363.             Signlink.reporterror("glfc_ex " + myPlayer.x + "," + myPlayer.y + "," + anInt1014 + "," + anInt1015 + "," + anInt1069 + "," + anInt1070 + "," + baseX + "," + baseY);
  8364.             throw new RuntimeException("eek");
  8365.         }
  8366.     }
  8367.  
  8368.     public void processDrawing() {
  8369.         if (rsAlreadyLoaded || loadingError || genericLoadingError) {
  8370.             showErrorScreen();
  8371.             return;
  8372.         }
  8373.         anInt1061++;
  8374.         if (!loggedIn) {
  8375.             drawLoginScreen(false);
  8376.         } else {
  8377.             drawGameScreen();
  8378.         }
  8379.         anInt1213 = 0;
  8380.     }
  8381.  
  8382.     public boolean isFriendOrSelf(String s) {
  8383.         if (s == null) {
  8384.             return false;
  8385.         }
  8386.         for (int i = 0; i < friendsCount; i++) {
  8387.             if (s.equalsIgnoreCase(friendsList[i])) {
  8388.                 return true;
  8389.             }
  8390.         }
  8391.         return s.equalsIgnoreCase(myPlayer.name);
  8392.     }
  8393.  
  8394.     public static String combatDiffColor(int i, int j) {
  8395.         int k = i - j;
  8396.         if (k < -9) {
  8397.             return "@red@";
  8398.         }
  8399.         if (k < -6) {
  8400.             return "@or3@";
  8401.         }
  8402.         if (k < -3) {
  8403.             return "@or2@";
  8404.         }
  8405.         if (k < 0) {
  8406.             return "@or1@";
  8407.         }
  8408.         if (k > 9) {
  8409.             return "@gre@";
  8410.         }
  8411.         if (k > 6) {
  8412.             return "@gr3@";
  8413.         }
  8414.         if (k > 3) {
  8415.             return "@gr2@";
  8416.         }
  8417.         if (k > 0) {
  8418.             return "@gr1@";
  8419.         } else {
  8420.             return "@yel@";
  8421.         }
  8422.     }
  8423.  
  8424.     public void setWaveVolume(int i) {
  8425.         Signlink.wavevol = i;
  8426.     }
  8427.  
  8428.     public void draw3dScreen() {
  8429.         drawSplitpublicChat();
  8430.         if (crossType == 1) {
  8431.             crosses[crossIndex / 100].drawSprite(crossX - 8 - 4, crossY - 8 - 4);
  8432.             anInt1142++;
  8433.             if (anInt1142 > 67) {
  8434.                 anInt1142 = 0;
  8435.                 stream.createFrame(78);
  8436.             }
  8437.         }
  8438.         if (crossType == 2) {
  8439.             crosses[4 + crossIndex / 100].drawSprite(crossX - 8 - 4, crossY - 8 - 4);
  8440.         }
  8441.         if (anInt1018 != -1) {
  8442.             method119(anInt945, anInt1018);
  8443.             drawInterface(0, 0, RSInterface.interfaceCache[anInt1018], 0);
  8444.         }
  8445.         if (openInterfaceID != -1) {
  8446.             method119(anInt945, openInterfaceID);
  8447.             drawInterface(0, 0, RSInterface.interfaceCache[openInterfaceID], 0);
  8448.         }
  8449.         method70();
  8450.         if (!menuOpen) {
  8451.             processRightClick();
  8452.             drawTooltip();
  8453.         } else if (menuScreenArea == 0) {
  8454.             drawMenu();
  8455.         }
  8456.         if (anInt1055 == 1) {
  8457.             multiOverlay.drawSprite(472, 296);
  8458.         }
  8459.         if (fpsOn) {
  8460.             char c = '\u01FB';
  8461.             int k = 20;
  8462.             int i1 = 0xffff00;
  8463.             if (super.fps < 15) {
  8464.                 i1 = 0xff0000;
  8465.             }
  8466.             aTextDrawingArea_1271.method380("Fps:" + super.fps, c, i1, k);
  8467.             k += 15;
  8468.             Runtime runtime = Runtime.getRuntime();
  8469.             int j1 = (int) ((runtime.totalMemory() - runtime.freeMemory()) / 1024L);
  8470.             i1 = 0xffff00;
  8471.             if (j1 > 0x2000000 && lowMem) {
  8472.                 i1 = 0xff0000;
  8473.             }
  8474.             aTextDrawingArea_1271.method380("Mem:" + j1 + "k", c, 0xffff00, k);
  8475.             k += 15;
  8476.         }
  8477.         if (anInt1104 != 0) {
  8478.             int j = anInt1104 / 50;
  8479.             int l = j / 60;
  8480.             j %= 60;
  8481.             if (j < 10) {
  8482.                 aTextDrawingArea_1271.method385(0xffff00, "System update in: " + l + ":0" + j, 329, 4);
  8483.             } else {
  8484.                 aTextDrawingArea_1271.method385(0xffff00, "System update in: " + l + ":" + j, 329, 4);
  8485.             }
  8486.             anInt849++;
  8487.             if (anInt849 > 75) {
  8488.                 anInt849 = 0;
  8489.                 stream.createFrame(148);
  8490.             }
  8491.         }
  8492.     }
  8493.  
  8494.     public void addIgnore(long l) {
  8495.         try {
  8496.             if (l == 0L) {
  8497.                 return;
  8498.             }
  8499.             if (ignoreCount >= 100) {
  8500.                 pushMessage("Your ignore list is full. Max of 100 hit", 0, "");
  8501.                 return;
  8502.             }
  8503.             String s = TextClass.fixName(TextClass.nameForLong(l));
  8504.             for (int j = 0; j < ignoreCount; j++) {
  8505.                 if (ignoreListAsLongs[j] == l) {
  8506.                     pushMessage(s + " is already on your ignore list", 0, "");
  8507.                     return;
  8508.                 }
  8509.             }
  8510.             for (int k = 0; k < friendsCount; k++) {
  8511.                 if (friendsListAsLongs[k] == l) {
  8512.                     pushMessage("Please remove " + s + " from your friend list first", 0, "");
  8513.                     return;
  8514.                 }
  8515.             }
  8516.  
  8517.             ignoreListAsLongs[ignoreCount++] = l;
  8518.             needDrawTabArea = true;
  8519.             stream.createFrame(133);
  8520.             stream.writeQWord(l);
  8521.             return;
  8522.         } catch (RuntimeException runtimeexception) {
  8523.             Signlink.reporterror("45688, " + l + ", " + 4 + ", " + runtimeexception.toString());
  8524.         }
  8525.         throw new RuntimeException();
  8526.     }
  8527.  
  8528.     public void method114() {
  8529.         for (int i = -1; i < playerCount; i++) {
  8530.             int j;
  8531.             if (i == -1) {
  8532.                 j = myPlayerIndex;
  8533.             } else {
  8534.                 j = playerIndices[i];
  8535.             }
  8536.             Player player = playerArray[j];
  8537.             if (player != null) {
  8538.                 method96(player);
  8539.             }
  8540.         }
  8541.  
  8542.     }
  8543.  
  8544.     public void method115() {
  8545.         if (loadingStage == 2) {
  8546.             for (Class30_Sub1 class30_sub1 = (Class30_Sub1) aClass19_1179.reverseGetFirst(); class30_sub1 != null; class30_sub1 = (Class30_Sub1) aClass19_1179.reverseGetNext()) {
  8547.                 if (class30_sub1.anInt1294 > 0) {
  8548.                     class30_sub1.anInt1294--;
  8549.                 }
  8550.                 if (class30_sub1.anInt1294 == 0) {
  8551.                     if (class30_sub1.anInt1299 < 0 || ObjectManager.method178(class30_sub1.anInt1299, class30_sub1.anInt1301)) {
  8552.                         method142(class30_sub1.anInt1298, class30_sub1.anInt1295, class30_sub1.anInt1300, class30_sub1.anInt1301, class30_sub1.anInt1297, class30_sub1.anInt1296, class30_sub1.anInt1299);
  8553.                         class30_sub1.unlink();
  8554.                     }
  8555.                 } else {
  8556.                     if (class30_sub1.anInt1302 > 0) {
  8557.                         class30_sub1.anInt1302--;
  8558.                     }
  8559.                     if (class30_sub1.anInt1302 == 0 && class30_sub1.anInt1297 >= 1 && class30_sub1.anInt1298 >= 1 && class30_sub1.anInt1297 <= 102 && class30_sub1.anInt1298 <= 102 && (class30_sub1.anInt1291 < 0 || ObjectManager.method178(class30_sub1.anInt1291, class30_sub1.anInt1293))) {
  8560.                         method142(class30_sub1.anInt1298, class30_sub1.anInt1295, class30_sub1.anInt1292, class30_sub1.anInt1293, class30_sub1.anInt1297, class30_sub1.anInt1296, class30_sub1.anInt1291);
  8561.                         class30_sub1.anInt1302 = -1;
  8562.                         if (class30_sub1.anInt1291 == class30_sub1.anInt1299 && class30_sub1.anInt1299 == -1) {
  8563.                             class30_sub1.unlink();
  8564.                         } else if (class30_sub1.anInt1291 == class30_sub1.anInt1299 && class30_sub1.anInt1292 == class30_sub1.anInt1300 && class30_sub1.anInt1293 == class30_sub1.anInt1301) {
  8565.                             class30_sub1.unlink();
  8566.                         }
  8567.                     }
  8568.                 }
  8569.             }
  8570.  
  8571.         }
  8572.     }
  8573.  
  8574.     public void determineMenuSize() {
  8575.         int i = chatTextDrawingArea.getTextWidth("Choose Option");
  8576.         for (int j = 0; j < menuActionRow; j++) {
  8577.             int k = chatTextDrawingArea.getTextWidth(menuActionName[j]);
  8578.             if (k > i) {
  8579.                 i = k;
  8580.             }
  8581.         }
  8582.  
  8583.         i += 8;
  8584.         int l = 15 * menuActionRow + 21;
  8585.         if (super.saveClickX > 4 && super.saveClickY > 4 && super.saveClickX < 516 && super.saveClickY < 338) {
  8586.             int i1 = super.saveClickX - 4 - i / 2;
  8587.             if (i1 + i > 512) {
  8588.                 i1 = 512 - i;
  8589.             }
  8590.             if (i1 < 0) {
  8591.                 i1 = 0;
  8592.             }
  8593.             int l1 = super.saveClickY - 4;
  8594.             if (l1 + l > 334) {
  8595.                 l1 = 334 - l;
  8596.             }
  8597.             if (l1 < 0) {
  8598.                 l1 = 0;
  8599.             }
  8600.             menuOpen = true;
  8601.             menuScreenArea = 0;
  8602.             menuOffsetX = i1;
  8603.             menuOffsetY = l1;
  8604.             menuWidth = i;
  8605.             anInt952 = 15 * menuActionRow + 22;
  8606.         }
  8607.         if (super.saveClickX > 553 && super.saveClickY > 205 && super.saveClickX < 743 && super.saveClickY < 466) {
  8608.             int j1 = super.saveClickX - 553 - i / 2;
  8609.             if (j1 < 0) {
  8610.                 j1 = 0;
  8611.             } else if (j1 + i > 190) {
  8612.                 j1 = 190 - i;
  8613.             }
  8614.             int i2 = super.saveClickY - 205;
  8615.             if (i2 < 0) {
  8616.                 i2 = 0;
  8617.             } else if (i2 + l > 261) {
  8618.                 i2 = 261 - l;
  8619.             }
  8620.             menuOpen = true;
  8621.             menuScreenArea = 1;
  8622.             menuOffsetX = j1;
  8623.             menuOffsetY = i2;
  8624.             menuWidth = i;
  8625.             anInt952 = 15 * menuActionRow + 22;
  8626.         }
  8627.         if (super.saveClickX > 17 && super.saveClickY > 357 && super.saveClickX < 496 && super.saveClickY < 453) {
  8628.             int k1 = super.saveClickX - 17 - i / 2;
  8629.             if (k1 < 0) {
  8630.                 k1 = 0;
  8631.             } else if (k1 + i > 479) {
  8632.                 k1 = 479 - i;
  8633.             }
  8634.             int j2 = super.saveClickY - 357;
  8635.             if (j2 < 0) {
  8636.                 j2 = 0;
  8637.             } else if (j2 + l > 96) {
  8638.                 j2 = 96 - l;
  8639.             }
  8640.             menuOpen = true;
  8641.             menuScreenArea = 2;
  8642.             menuOffsetX = k1;
  8643.             menuOffsetY = j2;
  8644.             menuWidth = i;
  8645.             anInt952 = 15 * menuActionRow + 22;
  8646.         }
  8647.     }
  8648.  
  8649.     public void method117(Stream stream) {
  8650.         stream.initBitAccess();
  8651.         int j = stream.readBits(1);
  8652.         if (j == 0) {
  8653.             return;
  8654.         }
  8655.         int k = stream.readBits(2);
  8656.         if (k == 0) {
  8657.             anIntArray894[anInt893++] = myPlayerIndex;
  8658.             return;
  8659.         }
  8660.         if (k == 1) {
  8661.             int l = stream.readBits(3);
  8662.             myPlayer.moveInDir(false, l);
  8663.             int k1 = stream.readBits(1);
  8664.             if (k1 == 1) {
  8665.                 anIntArray894[anInt893++] = myPlayerIndex;
  8666.             }
  8667.             return;
  8668.         }
  8669.         if (k == 2) {
  8670.             int i1 = stream.readBits(3);
  8671.             myPlayer.moveInDir(true, i1);
  8672.             int l1 = stream.readBits(3);
  8673.             myPlayer.moveInDir(true, l1);
  8674.             int j2 = stream.readBits(1);
  8675.             if (j2 == 1) {
  8676.                 anIntArray894[anInt893++] = myPlayerIndex;
  8677.             }
  8678.             return;
  8679.         }
  8680.         if (k == 3) {
  8681.             plane = stream.readBits(2);
  8682.             int j1 = stream.readBits(1);
  8683.             int i2 = stream.readBits(1);
  8684.             if (i2 == 1) {
  8685.                 anIntArray894[anInt893++] = myPlayerIndex;
  8686.             }
  8687.             int k2 = stream.readBits(7);
  8688.             int l2 = stream.readBits(7);
  8689.             myPlayer.setPos(l2, k2, j1 == 1);
  8690.         }
  8691.     }
  8692.  
  8693.     public void nullLoader() {
  8694.         aBoolean831 = false;
  8695.         while (drawingFlames) {
  8696.             aBoolean831 = false;
  8697.             try {
  8698.                 Thread.sleep(50L);
  8699.             } catch (Exception _ex) {
  8700.             }
  8701.         }
  8702.         aBackground_966 = null;
  8703.         aBackground_967 = null;
  8704.         aBackgroundArray1152s = null;
  8705.         anIntArray850 = null;
  8706.         anIntArray851 = null;
  8707.         anIntArray852 = null;
  8708.         anIntArray853 = null;
  8709.         anIntArray1190 = null;
  8710.         anIntArray1191 = null;
  8711.         anIntArray828 = null;
  8712.         anIntArray829 = null;
  8713.         aClass30_Sub2_Sub1_Sub1_1201 = null;
  8714.         aClass30_Sub2_Sub1_Sub1_1202 = null;
  8715.     }
  8716.  
  8717.     public boolean method119(int i, int j) {
  8718.         boolean flag1 = false;
  8719.         RSInterface class9 = RSInterface.interfaceCache[j];
  8720.         for (int element : class9.children) {
  8721.             if (element == -1) {
  8722.                 break;
  8723.             }
  8724.             RSInterface class9_1 = RSInterface.interfaceCache[element];
  8725.             if (class9_1.type == 1) {
  8726.                 flag1 |= method119(i, class9_1.id);
  8727.             }
  8728.             if (class9_1.type == 6 && (class9_1.anInt257 != -1 || class9_1.anInt258 != -1)) {
  8729.                 boolean flag2 = interfaceIsSelected(class9_1);
  8730.                 int l;
  8731.                 if (flag2) {
  8732.                     l = class9_1.anInt258;
  8733.                 } else {
  8734.                     l = class9_1.anInt257;
  8735.                 }
  8736.                 if (l != -1) {
  8737.                     Animation animation = Animation.anims[l];
  8738.                     for (class9_1.anInt208 += i; class9_1.anInt208 > animation.method258(class9_1.anInt246);) {
  8739.                         class9_1.anInt208 -= animation.method258(class9_1.anInt246) + 1;
  8740.                         class9_1.anInt246++;
  8741.                         if (class9_1.anInt246 >= animation.anInt352) {
  8742.                             class9_1.anInt246 -= animation.anInt356;
  8743.                             if (class9_1.anInt246 < 0 || class9_1.anInt246 >= animation.anInt352) {
  8744.                                 class9_1.anInt246 = 0;
  8745.                             }
  8746.                         }
  8747.                         flag1 = true;
  8748.                     }
  8749.  
  8750.                 }
  8751.             }
  8752.         }
  8753.  
  8754.         return flag1;
  8755.     }
  8756.  
  8757.     public int method120() {
  8758.         int j = 3;
  8759.         if (yCameraCurve < 310) {
  8760.             int k = xCameraPos >> 7;
  8761.             int l = yCameraPos >> 7;
  8762.             int i1 = myPlayer.x >> 7;
  8763.             int j1 = myPlayer.y >> 7;
  8764.             if ((byteGroundArray[plane][k][l] & 4) != 0) {
  8765.                 j = plane;
  8766.             }
  8767.             int k1;
  8768.             if (i1 > k) {
  8769.                 k1 = i1 - k;
  8770.             } else {
  8771.                 k1 = k - i1;
  8772.             }
  8773.             int l1;
  8774.             if (j1 > l) {
  8775.                 l1 = j1 - l;
  8776.             } else {
  8777.                 l1 = l - j1;
  8778.             }
  8779.             if (k1 > l1) {
  8780.                 int i2 = l1 * 0x10000 / k1;
  8781.                 int k2 = 32768;
  8782.                 while (k != i1) {
  8783.                     if (k < i1) {
  8784.                         k++;
  8785.                     } else if (k > i1) {
  8786.                         k--;
  8787.                     }
  8788.                     if ((byteGroundArray[plane][k][l] & 4) != 0) {
  8789.                         j = plane;
  8790.                     }
  8791.                     k2 += i2;
  8792.                     if (k2 >= 0x10000) {
  8793.                         k2 -= 0x10000;
  8794.                         if (l < j1) {
  8795.                             l++;
  8796.                         } else if (l > j1) {
  8797.                             l--;
  8798.                         }
  8799.                         if ((byteGroundArray[plane][k][l] & 4) != 0) {
  8800.                             j = plane;
  8801.                         }
  8802.                     }
  8803.                 }
  8804.             } else {
  8805.                 int j2 = k1 * 0x10000 / l1;
  8806.                 int l2 = 32768;
  8807.                 while (l != j1) {
  8808.                     if (l < j1) {
  8809.                         l++;
  8810.                     } else if (l > j1) {
  8811.                         l--;
  8812.                     }
  8813.                     if ((byteGroundArray[plane][k][l] & 4) != 0) {
  8814.                         j = plane;
  8815.                     }
  8816.                     l2 += j2;
  8817.                     if (l2 >= 0x10000) {
  8818.                         l2 -= 0x10000;
  8819.                         if (k < i1) {
  8820.                             k++;
  8821.                         } else if (k > i1) {
  8822.                             k--;
  8823.                         }
  8824.                         if ((byteGroundArray[plane][k][l] & 4) != 0) {
  8825.                             j = plane;
  8826.                         }
  8827.                     }
  8828.                 }
  8829.             }
  8830.         }
  8831.         if ((byteGroundArray[plane][myPlayer.x >> 7][myPlayer.y >> 7] & 4) != 0) {
  8832.             j = plane;
  8833.         }
  8834.         return j;
  8835.     }
  8836.  
  8837.     public int method121() {
  8838.         int j = method42(plane, yCameraPos, xCameraPos);
  8839.         if (j - zCameraPos < 800 && (byteGroundArray[plane][xCameraPos >> 7][yCameraPos >> 7] & 4) != 0) {
  8840.             return plane;
  8841.         } else {
  8842.             return 3;
  8843.         }
  8844.     }
  8845.  
  8846.     public void delIgnore(long l) {
  8847.         try {
  8848.             if (l == 0L) {
  8849.                 return;
  8850.             }
  8851.             for (int j = 0; j < ignoreCount; j++) {
  8852.                 if (ignoreListAsLongs[j] == l) {
  8853.                     ignoreCount--;
  8854.                     needDrawTabArea = true;
  8855.                     System.arraycopy(ignoreListAsLongs, j + 1, ignoreListAsLongs, j, ignoreCount - j);
  8856.  
  8857.                     stream.createFrame(74);
  8858.                     stream.writeQWord(l);
  8859.                     return;
  8860.                 }
  8861.             }
  8862.  
  8863.             return;
  8864.         } catch (RuntimeException runtimeexception) {
  8865.             Signlink.reporterror("47229, " + 3 + ", " + l + ", " + runtimeexception.toString());
  8866.         }
  8867.         throw new RuntimeException();
  8868.     }
  8869.  
  8870.     public String getParameter(String s) {
  8871.         if (Signlink.mainapp != null) {
  8872.             return Signlink.mainapp.getParameter(s);
  8873.         } else {
  8874.             return super.getParameter(s);
  8875.         }
  8876.     }
  8877.  
  8878.     public int extractInterfaceValues(RSInterface class9, int j) {
  8879.         if (class9.valueIndexArray == null || j >= class9.valueIndexArray.length) {
  8880.             return -2;
  8881.         }
  8882.         try {
  8883.             int ai[] = class9.valueIndexArray[j];
  8884.             int k = 0;
  8885.             int l = 0;
  8886.             int i1 = 0;
  8887.             do {
  8888.                 int j1 = ai[l++];
  8889.                 int k1 = 0;
  8890.                 byte byte0 = 0;
  8891.                 if (j1 == 0) {
  8892.                     return k;
  8893.                 }
  8894.                 if (j1 == 1) {
  8895.                     k1 = currentStats[ai[l++]];
  8896.                 }
  8897.                 if (j1 == 2) {
  8898.                     k1 = maxStats[ai[l++]];
  8899.                 }
  8900.                 if (j1 == 3) {
  8901.                     k1 = currentExp[ai[l++]];
  8902.                 }
  8903.                 if (j1 == 4) {
  8904.                     RSInterface class9_1 = RSInterface.interfaceCache[ai[l++]];
  8905.                     int k2 = ai[l++];
  8906.                     if (k2 >= 0 && k2 < ItemDef.totalItems && (!ItemDef.forID(k2).membersObject || isMembers)) {
  8907.                         for (int j3 = 0; j3 < class9_1.inv.length; j3++) {
  8908.                             if (class9_1.inv[j3] == k2 + 1) {
  8909.                                 k1 += class9_1.invStackSizes[j3];
  8910.                             }
  8911.                         }
  8912.  
  8913.                     }
  8914.                 }
  8915.                 if (j1 == 5) {
  8916.                     k1 = variousSettings[ai[l++]];
  8917.                 }
  8918.                 if (j1 == 6) {
  8919.                     k1 = anIntArray1019[maxStats[ai[l++]] - 1];
  8920.                 }
  8921.                 if (j1 == 7) {
  8922.                     k1 = variousSettings[ai[l++]] * 100 / 46875;
  8923.                 }
  8924.                 if (j1 == 8) {
  8925.                     k1 = myPlayer.combatLevel;
  8926.                 }
  8927.                 if (j1 == 9) {
  8928.                     for (int l1 = 0; l1 < Skills.skillsCount; l1++) {
  8929.                         if (Skills.skillEnabled[l1]) {
  8930.                             k1 += maxStats[l1];
  8931.                         }
  8932.                     }
  8933.  
  8934.                 }
  8935.                 if (j1 == 10) {
  8936.                     RSInterface class9_2 = RSInterface.interfaceCache[ai[l++]];
  8937.                     int l2 = ai[l++] + 1;
  8938.                     if (l2 >= 0 && l2 < ItemDef.totalItems && (!ItemDef.forID(l2).membersObject || isMembers)) {
  8939.                         for (int element : class9_2.inv) {
  8940.                             if (element != l2) {
  8941.                                 continue;
  8942.                             }
  8943.                             k1 = 0x3b9ac9ff;
  8944.                             break;
  8945.                         }
  8946.  
  8947.                     }
  8948.                 }
  8949.                 if (j1 == 11) {
  8950.                     k1 = energy;
  8951.                 }
  8952.                 if (j1 == 12) {
  8953.                     k1 = weight;
  8954.                 }
  8955.                 if (j1 == 13) {
  8956.                     int i2 = variousSettings[ai[l++]];
  8957.                     int i3 = ai[l++];
  8958.                     k1 = (i2 & 1 << i3) == 0 ? 0 : 1;
  8959.                 }
  8960.                 if (j1 == 14) {
  8961.                     int j2 = ai[l++];
  8962.                     VarBit varBit = VarBit.cache[j2];
  8963.                     int l3 = varBit.anInt648;
  8964.                     int i4 = varBit.anInt649;
  8965.                     int j4 = varBit.anInt650;
  8966.                     int k4 = anIntArray1232[j4 - i4];
  8967.                     k1 = variousSettings[l3] >> i4 & k4;
  8968.                 }
  8969.                 if (j1 == 15) {
  8970.                     byte0 = 1;
  8971.                 }
  8972.                 if (j1 == 16) {
  8973.                     byte0 = 2;
  8974.                 }
  8975.                 if (j1 == 17) {
  8976.                     byte0 = 3;
  8977.                 }
  8978.                 if (j1 == 18) {
  8979.                     k1 = (myPlayer.x >> 7) + baseX;
  8980.                 }
  8981.                 if (j1 == 19) {
  8982.                     k1 = (myPlayer.y >> 7) + baseY;
  8983.                 }
  8984.                 if (j1 == 20) {
  8985.                     k1 = ai[l++];
  8986.                 }
  8987.                 if (byte0 == 0) {
  8988.                     if (i1 == 0) {
  8989.                         k += k1;
  8990.                     }
  8991.                     if (i1 == 1) {
  8992.                         k -= k1;
  8993.                     }
  8994.                     if (i1 == 2 && k1 != 0) {
  8995.                         k /= k1;
  8996.                     }
  8997.                     if (i1 == 3) {
  8998.                         k *= k1;
  8999.                     }
  9000.                     i1 = 0;
  9001.                 } else {
  9002.                     i1 = byte0;
  9003.                 }
  9004.             } while (true);
  9005.         } catch (Exception _ex) {
  9006.             return -1;
  9007.         }
  9008.     }
  9009.  
  9010.     public void drawTooltip() {
  9011.         if (menuActionRow < 2 && itemSelected == 0 && spellSelected == 0) {
  9012.             return;
  9013.         }
  9014.         String s;
  9015.         if (itemSelected == 1 && menuActionRow < 2) {
  9016.             s = "Use " + selectedItemName + " with...";
  9017.         } else if (spellSelected == 1 && menuActionRow < 2) {
  9018.             s = spellTooltip + "...";
  9019.         } else {
  9020.             s = menuActionName[menuActionRow - 1];
  9021.         }
  9022.         if (menuActionRow > 2) {
  9023.             s = s + "@whi@ / " + (menuActionRow - 2) + " more options";
  9024.         }
  9025.         chatTextDrawingArea.method390(4, 0xffffff, s, loopCycle / 1000, 15);
  9026.     }
  9027.  
  9028.     public void drawMinimap() {
  9029.         aRSImageProducer_1164.initDrawingArea();
  9030.         if (anInt1021 == 2) {
  9031.             byte abyte0[] = mapBack.aByteArray1450;
  9032.             int ai[] = DrawingArea.pixels;
  9033.             int k2 = abyte0.length;
  9034.             for (int i5 = 0; i5 < k2; i5++) {
  9035.                 if (abyte0[i5] == 0) {
  9036.                     ai[i5] = 0;
  9037.                 }
  9038.             }
  9039.  
  9040.             compass.method352(33, minimapInt1, anIntArray1057, 256, anIntArray968, 25, 0, 0, 33, 25);
  9041.             aRSImageProducer_1165.initDrawingArea();
  9042.             Texture.lineOffsets = chatBoxAreaOffsets;
  9043.             return;
  9044.         }
  9045.         int i = minimapInt1 + minimapInt2 & 0x7ff;
  9046.         int j = 48 + myPlayer.x / 32;
  9047.         int l2 = 464 - myPlayer.y / 32;
  9048.         aClass30_Sub2_Sub1_Sub1_1263.method352(151, i, anIntArray1229, 256 + minimapInt3, anIntArray1052, l2, 5, 25, 146, j);
  9049.         compass.method352(33, minimapInt1, anIntArray1057, 256, anIntArray968, 25, 0, 0, 33, 25);
  9050.         for (int j5 = 0; j5 < anInt1071; j5++) {
  9051.             int k = anIntArray1072[j5] * 4 + 2 - myPlayer.x / 32;
  9052.             int i3 = anIntArray1073[j5] * 4 + 2 - myPlayer.y / 32;
  9053.             markMinimap(aClass30_Sub2_Sub1_Sub1Array1140[j5], k, i3);
  9054.         }
  9055.  
  9056.         for (int k5 = 0; k5 < 104; k5++) {
  9057.             for (int l5 = 0; l5 < 104; l5++) {
  9058.                 NodeList class19 = groundArray[plane][k5][l5];
  9059.                 if (class19 != null) {
  9060.                     int l = k5 * 4 + 2 - myPlayer.x / 32;
  9061.                     int j3 = l5 * 4 + 2 - myPlayer.y / 32;
  9062.                     markMinimap(mapDotItem, l, j3);
  9063.                 }
  9064.             }
  9065.  
  9066.         }
  9067.  
  9068.         for (int i6 = 0; i6 < npcCount; i6++) {
  9069.             NPC npc = npcArray[npcIndices[i6]];
  9070.             if (npc != null && npc.isVisible()) {
  9071.                 EntityDef entityDef = npc.desc;
  9072.                 if (entityDef.childrenIDs != null) {
  9073.                     entityDef = entityDef.method161();
  9074.                 }
  9075.                 if (entityDef != null && entityDef.aBoolean87 && entityDef.aBoolean84) {
  9076.                     int i1 = npc.x / 32 - myPlayer.x / 32;
  9077.                     int k3 = npc.y / 32 - myPlayer.y / 32;
  9078.                     markMinimap(mapDotNPC, i1, k3);
  9079.                 }
  9080.             }
  9081.         }
  9082.  
  9083.         for (int j6 = 0; j6 < playerCount; j6++) {
  9084.             Player player = playerArray[playerIndices[j6]];
  9085.             if (player != null && player.isVisible()) {
  9086.                 int j1 = player.x / 32 - myPlayer.x / 32;
  9087.                 int l3 = player.y / 32 - myPlayer.y / 32;
  9088.                 boolean flag1 = false;
  9089.                 long l6 = TextClass.longForName(player.name);
  9090.                 for (int k6 = 0; k6 < friendsCount; k6++) {
  9091.                     if (l6 != friendsListAsLongs[k6] || friendsNodeIDs[k6] == 0) {
  9092.                         continue;
  9093.                     }
  9094.                     flag1 = true;
  9095.                     break;
  9096.                 }
  9097.  
  9098.                 boolean flag2 = false;
  9099.                 if (myPlayer.team != 0 && player.team != 0 && myPlayer.team == player.team) {
  9100.                     flag2 = true;
  9101.                 }
  9102.                 if (flag1) {
  9103.                     markMinimap(mapDotFriend, j1, l3);
  9104.                 } else if (flag2) {
  9105.                     markMinimap(mapDotTeam, j1, l3);
  9106.                 } else {
  9107.                     markMinimap(mapDotPlayer, j1, l3);
  9108.                 }
  9109.             }
  9110.         }
  9111.  
  9112.         if (anInt855 != 0 && loopCycle % 20 < 10) {
  9113.             if (anInt855 == 1 && anInt1222 >= 0 && anInt1222 < npcArray.length) {
  9114.                 NPC class30_sub2_sub4_sub1_sub1_1 = npcArray[anInt1222];
  9115.                 if (class30_sub2_sub4_sub1_sub1_1 != null) {
  9116.                     int k1 = class30_sub2_sub4_sub1_sub1_1.x / 32 - myPlayer.x / 32;
  9117.                     int i4 = class30_sub2_sub4_sub1_sub1_1.y / 32 - myPlayer.y / 32;
  9118.                     method81(mapMarker, i4, k1);
  9119.                 }
  9120.             }
  9121.             if (anInt855 == 2) {
  9122.                 int l1 = (anInt934 - baseX) * 4 + 2 - myPlayer.x / 32;
  9123.                 int j4 = (anInt935 - baseY) * 4 + 2 - myPlayer.y / 32;
  9124.                 method81(mapMarker, j4, l1);
  9125.             }
  9126.             if (anInt855 == 10 && anInt933 >= 0 && anInt933 < playerArray.length) {
  9127.                 Player class30_sub2_sub4_sub1_sub2_1 = playerArray[anInt933];
  9128.                 if (class30_sub2_sub4_sub1_sub2_1 != null) {
  9129.                     int i2 = class30_sub2_sub4_sub1_sub2_1.x / 32 - myPlayer.x / 32;
  9130.                     int k4 = class30_sub2_sub4_sub1_sub2_1.y / 32 - myPlayer.y / 32;
  9131.                     method81(mapMarker, k4, i2);
  9132.                 }
  9133.             }
  9134.         }
  9135.         if (destX != 0) {
  9136.             int j2 = destX * 4 + 2 - myPlayer.x / 32;
  9137.             int l4 = destY * 4 + 2 - myPlayer.y / 32;
  9138.             markMinimap(mapFlag, j2, l4);
  9139.         }
  9140.         DrawingArea.method336(3, 78, 0xffffff, 3, 97);
  9141.         aRSImageProducer_1165.initDrawingArea();
  9142.         Texture.lineOffsets = chatBoxAreaOffsets;
  9143.     }
  9144.  
  9145.     public void npcScreenPos(Entity entity, int i) {
  9146.         calcEntityScreenPos(entity.x, i, entity.y);
  9147.  
  9148.         // aryan entity.entScreenX = spriteDrawX; entity.entScreenY =
  9149.         // spriteDrawY;
  9150.     }
  9151.  
  9152.     public void calcEntityScreenPos(int i, int j, int l) {
  9153.         if (i < 128 || l < 128 || i > 13056 || l > 13056) {
  9154.             spriteDrawX = -1;
  9155.             spriteDrawY = -1;
  9156.             return;
  9157.         }
  9158.         int i1 = method42(plane, l, i) - j;
  9159.         i -= xCameraPos;
  9160.         i1 -= zCameraPos;
  9161.         l -= yCameraPos;
  9162.         int j1 = Model.modelIntArray1[yCameraCurve];
  9163.         int k1 = Model.modelIntArray2[yCameraCurve];
  9164.         int l1 = Model.modelIntArray1[xCameraCurve];
  9165.         int i2 = Model.modelIntArray2[xCameraCurve];
  9166.         int j2 = l * l1 + i * i2 >> 16;
  9167.         l = l * i2 - i * l1 >> 16;
  9168.         i = j2;
  9169.         j2 = i1 * k1 - l * j1 >> 16;
  9170.         l = i1 * j1 + l * k1 >> 16;
  9171.         i1 = j2;
  9172.         if (l >= 50) {
  9173.             spriteDrawX = Texture.textureInt1 + (i << 9) / l;
  9174.             spriteDrawY = Texture.textureInt2 + (i1 << 9) / l;
  9175.         } else {
  9176.             spriteDrawX = -1;
  9177.             spriteDrawY = -1;
  9178.         }
  9179.     }
  9180.  
  9181.     public void buildSplitPrivateChatMenu() {
  9182.         if (splitpublicChat == 0) {
  9183.             return;
  9184.         }
  9185.         int i = 0;
  9186.         if (anInt1104 != 0) {
  9187.             i = 1;
  9188.         }
  9189.         for (int j = 0; j < 100; j++) {
  9190.             if (chatMessages[j] != null) {
  9191.                 int k = chatTypes[j];
  9192.                 String s = chatNames[j];
  9193.                 if (s != null && s.startsWith("@cr1@")) {
  9194.                     s = s.substring(5);
  9195.                 }
  9196.                 if (s != null && s.startsWith("@cr2@")) {
  9197.                     s = s.substring(5);
  9198.                 }
  9199.                 if ((k == 3 || k == 7) && (k == 7 || privateChatMode == 0 || privateChatMode == 1 && isFriendOrSelf(s))) {
  9200.                     int l = 329 - i * 13;
  9201.                     if (super.mouseX > 4 && super.mouseY - 4 > l - 10 && super.mouseY - 4 <= l + 3) {
  9202.                         int i1 = aTextDrawingArea_1271.getTextWidth("From:  " + s + chatMessages[j]) + 25;
  9203.                         if (i1 > 450) {
  9204.                             i1 = 450;
  9205.                         }
  9206.                         if (super.mouseX < 4 + i1) {
  9207.                             if (myPrivilege >= 1 && myPrivilege <= 3) {
  9208.                                 menuActionName[menuActionRow] = "Report abuse @whi@" + s;
  9209.                                 menuActionID[menuActionRow] = 2606;
  9210.                                 menuActionRow++;
  9211.                             }
  9212.                             menuActionName[menuActionRow] = "Add ignore @whi@" + s;
  9213.                             menuActionID[menuActionRow] = 2042;
  9214.                             menuActionRow++;
  9215.                             menuActionName[menuActionRow] = "Reply to @whi@" + s;
  9216.                             menuActionID[menuActionRow] = 2639;
  9217.                             menuActionRow++;
  9218.                             menuActionName[menuActionRow] = "Add friend @whi@" + s;
  9219.                             menuActionID[menuActionRow] = 2337;
  9220.                             menuActionRow++;
  9221.                         }
  9222.                     }
  9223.                     if (++i >= 5) {
  9224.                         return;
  9225.                     }
  9226.                 }
  9227.                 if ((k == 5 || k == 6) && privateChatMode < 2 && ++i >= 5) {
  9228.                     return;
  9229.                 }
  9230.             }
  9231.         }
  9232.  
  9233.     }
  9234.  
  9235.     public void method130(int j, int k, int l, int i1, int j1, int k1, int l1, int i2, int j2) {
  9236.         Class30_Sub1 class30_sub1 = null;
  9237.         for (Class30_Sub1 class30_sub1_1 = (Class30_Sub1) aClass19_1179.reverseGetFirst(); class30_sub1_1 != null; class30_sub1_1 = (Class30_Sub1) aClass19_1179.reverseGetNext()) {
  9238.             if (class30_sub1_1.anInt1295 != l1 || class30_sub1_1.anInt1297 != i2 || class30_sub1_1.anInt1298 != j1 || class30_sub1_1.anInt1296 != i1) {
  9239.                 continue;
  9240.             }
  9241.             class30_sub1 = class30_sub1_1;
  9242.             break;
  9243.         }
  9244.  
  9245.         if (class30_sub1 == null) {
  9246.             class30_sub1 = new Class30_Sub1();
  9247.             class30_sub1.anInt1295 = l1;
  9248.             class30_sub1.anInt1296 = i1;
  9249.             class30_sub1.anInt1297 = i2;
  9250.             class30_sub1.anInt1298 = j1;
  9251.             method89(class30_sub1);
  9252.             aClass19_1179.insertHead(class30_sub1);
  9253.         }
  9254.         class30_sub1.anInt1291 = k;
  9255.         class30_sub1.anInt1293 = k1;
  9256.         class30_sub1.anInt1292 = l;
  9257.         class30_sub1.anInt1302 = j2;
  9258.         class30_sub1.anInt1294 = j;
  9259.     }
  9260.  
  9261.     public boolean interfaceIsSelected(RSInterface class9) {
  9262.         if (class9.anIntArray245 == null) {
  9263.             return false;
  9264.         }
  9265.         for (int i = 0; i < class9.anIntArray245.length; i++) {
  9266.             int j = extractInterfaceValues(class9, i);
  9267.             int k = class9.anIntArray212[i];
  9268.             if (class9.anIntArray245[i] == 2) {
  9269.                 if (j >= k) {
  9270.                     return false;
  9271.                 }
  9272.             } else if (class9.anIntArray245[i] == 3) {
  9273.                 if (j <= k) {
  9274.                     return false;
  9275.                 }
  9276.             } else if (class9.anIntArray245[i] == 4) {
  9277.                 if (j == k) {
  9278.                     return false;
  9279.                 }
  9280.             } else if (j != k) {
  9281.                 return false;
  9282.             }
  9283.         }
  9284.  
  9285.         return true;
  9286.     }
  9287.  
  9288.     public DataInputStream openJagGrabInputStream(String s) throws IOException {
  9289.         // if(!aBoolean872)
  9290.         // if(signlink.mainapp != null)
  9291.         // return signlink.openurl(s);
  9292.         // else
  9293.         // return new DataInputStream((new URL(getCodeBase(), s)).openStream());
  9294.         if (aSocket832 != null) {
  9295.             try {
  9296.                 aSocket832.close();
  9297.             } catch (Exception _ex) {
  9298.             }
  9299.             aSocket832 = null;
  9300.         }
  9301.         aSocket832 = openSocket(43595);
  9302.         aSocket832.setSoTimeout(10000);
  9303.         java.io.InputStream inputstream = aSocket832.getInputStream();
  9304.         OutputStream outputstream = aSocket832.getOutputStream();
  9305.         outputstream.write(("JAGGRAB /" + s + "\n\n").getBytes());
  9306.         return new DataInputStream(inputstream);
  9307.     }
  9308.    
  9309.     public void doFlamesDrawing() {
  9310.         char c = '\u0100';
  9311.         if (anInt1040 > 0) {
  9312.             for (int i = 0; i < 256; i++) {
  9313.                 if (anInt1040 > 768) {
  9314.                     anIntArray850[i] = method83(anIntArray851[i], anIntArray852[i], 1024 - anInt1040);
  9315.                 } else if (anInt1040 > 256) {
  9316.                     anIntArray850[i] = anIntArray852[i];
  9317.                 } else {
  9318.                     anIntArray850[i] = method83(anIntArray852[i], anIntArray851[i], 256 - anInt1040);
  9319.                 }
  9320.             }
  9321.  
  9322.         } else if (anInt1041 > 0) {
  9323.             for (int j = 0; j < 256; j++) {
  9324.                 if (anInt1041 > 768) {
  9325.                     anIntArray850[j] = method83(anIntArray851[j], anIntArray853[j], 1024 - anInt1041);
  9326.                 } else if (anInt1041 > 256) {
  9327.                     anIntArray850[j] = anIntArray853[j];
  9328.                 } else {
  9329.                     anIntArray850[j] = method83(anIntArray853[j], anIntArray851[j], 256 - anInt1041);
  9330.                 }
  9331.             }
  9332.  
  9333.         } else {
  9334.             System.arraycopy(anIntArray851, 0, anIntArray850, 0, 256);
  9335.  
  9336.         }
  9337.         System.arraycopy(aClass30_Sub2_Sub1_Sub1_1201.pixels, 0, aRSImageProducer_1110.anIntArray315, 0, 33920);
  9338.  
  9339.         int i1 = 0;
  9340.         int j1 = 1152;
  9341.         for (int k1 = 1; k1 < c - 1; k1++) {
  9342.             int l1 = anIntArray969[k1] * (c - k1) / c;
  9343.             int j2 = 22 + l1;
  9344.             if (j2 < 0) {
  9345.                 j2 = 0;
  9346.             }
  9347.             i1 += j2;
  9348.             for (int l2 = j2; l2 < 128; l2++) {
  9349.                 int j3 = anIntArray828[i1++];
  9350.                 if (j3 != 0) {
  9351.                     int l3 = j3;
  9352.                     int j4 = 256 - j3;
  9353.                     j3 = anIntArray850[j3];
  9354.                     int l4 = aRSImageProducer_1110.anIntArray315[j1];
  9355.                     aRSImageProducer_1110.anIntArray315[j1++] = ((j3 & 0xff00ff) * l3 + (l4 & 0xff00ff) * j4 & 0xff00ff00) + ((j3 & 0xff00) * l3 + (l4 & 0xff00) * j4 & 0xff0000) >> 8;
  9356.                 } else {
  9357.                     j1++;
  9358.                 }
  9359.             }
  9360.  
  9361.             j1 += j2;
  9362.         }
  9363.  
  9364.         aRSImageProducer_1110.drawGraphics(0, super.graphics, 0);
  9365.         System.arraycopy(aClass30_Sub2_Sub1_Sub1_1202.pixels, 0, aRSImageProducer_1111.anIntArray315, 0, 33920);
  9366.  
  9367.         i1 = 0;
  9368.         j1 = 1176;
  9369.         for (int k2 = 1; k2 < c - 1; k2++) {
  9370.             int i3 = anIntArray969[k2] * (c - k2) / c;
  9371.             int k3 = 103 - i3;
  9372.             j1 += i3;
  9373.             for (int i4 = 0; i4 < k3; i4++) {
  9374.                 int k4 = anIntArray828[i1++];
  9375.                 if (k4 != 0) {
  9376.                     int i5 = k4;
  9377.                     int j5 = 256 - k4;
  9378.                     k4 = anIntArray850[k4];
  9379.                     int k5 = aRSImageProducer_1111.anIntArray315[j1];
  9380.                     aRSImageProducer_1111.anIntArray315[j1++] = ((k4 & 0xff00ff) * i5 + (k5 & 0xff00ff) * j5 & 0xff00ff00) + ((k4 & 0xff00) * i5 + (k5 & 0xff00) * j5 & 0xff0000) >> 8;
  9381.                 } else {
  9382.                     j1++;
  9383.                 }
  9384.             }
  9385.  
  9386.             i1 += 128 - k3;
  9387.             j1 += 128 - k3 - i3;
  9388.         }
  9389.  
  9390.         aRSImageProducer_1111.drawGraphics(0, super.graphics, 637);
  9391.     }
  9392.  
  9393.     public void method134(Stream stream) {
  9394.         int j = stream.readBits(8);
  9395.         if (j < playerCount) {
  9396.             for (int k = j; k < playerCount; k++) {
  9397.                 anIntArray840[anInt839++] = playerIndices[k];
  9398.             }
  9399.  
  9400.         }
  9401.         if (j > playerCount) {
  9402.             Signlink.reporterror(myUsername + " Too many players");
  9403.             throw new RuntimeException("eek");
  9404.         }
  9405.         playerCount = 0;
  9406.         for (int l = 0; l < j; l++) {
  9407.             int i1 = playerIndices[l];
  9408.             Player player = playerArray[i1];
  9409.             int j1 = stream.readBits(1);
  9410.             if (j1 == 0) {
  9411.                 playerIndices[playerCount++] = i1;
  9412.                 player.anInt1537 = loopCycle;
  9413.             } else {
  9414.                 int k1 = stream.readBits(2);
  9415.                 if (k1 == 0) {
  9416.                     playerIndices[playerCount++] = i1;
  9417.                     player.anInt1537 = loopCycle;
  9418.                     anIntArray894[anInt893++] = i1;
  9419.                 } else if (k1 == 1) {
  9420.                     playerIndices[playerCount++] = i1;
  9421.                     player.anInt1537 = loopCycle;
  9422.                     int l1 = stream.readBits(3);
  9423.                     player.moveInDir(false, l1);
  9424.                     int j2 = stream.readBits(1);
  9425.                     if (j2 == 1) {
  9426.                         anIntArray894[anInt893++] = i1;
  9427.                     }
  9428.                 } else if (k1 == 2) {
  9429.                     playerIndices[playerCount++] = i1;
  9430.                     player.anInt1537 = loopCycle;
  9431.                     int i2 = stream.readBits(3);
  9432.                     player.moveInDir(true, i2);
  9433.                     int k2 = stream.readBits(3);
  9434.                     player.moveInDir(true, k2);
  9435.                     int l2 = stream.readBits(1);
  9436.                     if (l2 == 1) {
  9437.                         anIntArray894[anInt893++] = i1;
  9438.                     }
  9439.                 } else if (k1 == 3) {
  9440.                     anIntArray840[anInt839++] = i1;
  9441.                 }
  9442.             }
  9443.         }
  9444.     }
  9445.  
  9446.     public void drawLoginScreen(boolean flag) {
  9447.         resetImageProducers();
  9448.         aRSImageProducer_1109.initDrawingArea();
  9449.         aBackground_966.method361(0, 0);
  9450.         char c = '\u0168';
  9451.         char c1 = '\310';
  9452.         if (loginScreenState == 0) {
  9453.             int i = c1 / 2 + 80;
  9454.             aTextDrawingArea_1270.method382(0x75a9a9, c / 2, onDemandFetcher.statusString, i, true);
  9455.             i = c1 / 2 - 20;
  9456.             chatTextDrawingArea.method382(0xffff00, c / 2, "Welcome to " + ClientSettings.SERVER_NAME + "", i, true);
  9457.             i += 30;
  9458.             int l = c / 2 - 80;
  9459.             int k1 = c1 / 2 + 20;
  9460.             aBackground_967.method361(l - 73, k1 - 20);
  9461.             chatTextDrawingArea.method382(0xffffff, l, "New User", k1 + 5, true);
  9462.             l = c / 2 + 80;
  9463.             aBackground_967.method361(l - 73, k1 - 20);
  9464.             chatTextDrawingArea.method382(0xffffff, l, "Existing User", k1 + 5, true);
  9465.         }
  9466.         if (loginScreenState == 2) {
  9467.             int j = c1 / 2 - 40;
  9468.             if (loginMessage1.length() > 0) {
  9469.                 chatTextDrawingArea.method382(0xffff00, c / 2, loginMessage1, j - 15, true);
  9470.                 chatTextDrawingArea.method382(0xffff00, c / 2, loginMessage2, j, true);
  9471.                 j += 30;
  9472.             } else {
  9473.                 chatTextDrawingArea.method382(0xffff00, c / 2, loginMessage2, j - 7, true);
  9474.                 j += 30;
  9475.             }
  9476.             chatTextDrawingArea.method389(true, c / 2 - 90, 0xffffff, "Username: " + myUsername + (loginScreenCursorPos == 0 & loopCycle % 40 < 20 ? "@yel@|" : ""), j);
  9477.             j += 15;
  9478.             chatTextDrawingArea.method389(true, c / 2 - 88, 0xffffff, "Password: " + TextClass.passwordAsterisks(myPassword) + (loginScreenCursorPos == 1 & loopCycle % 40 < 20 ? "@yel@|" : ""), j);
  9479.             j += 15;
  9480.             if (!flag) {
  9481.                 int i1 = c / 2 - 80;
  9482.                 int l1 = c1 / 2 + 50;
  9483.                 aBackground_967.method361(i1 - 73, l1 - 20);
  9484.                 chatTextDrawingArea.method382(0xffffff, i1, "Login", l1 + 5, true);
  9485.                 i1 = c / 2 + 80;
  9486.                 aBackground_967.method361(i1 - 73, l1 - 20);
  9487.                 chatTextDrawingArea.method382(0xffffff, i1, "Cancel", l1 + 5, true);
  9488.             }
  9489.         }
  9490.         if (loginScreenState == 3) {
  9491.             chatTextDrawingArea.method382(0xffff00, c / 2, "Create a free account", c1 / 2 - 60, true);
  9492.             int k = c1 / 2 - 35;
  9493.             chatTextDrawingArea.method382(0xffffff, c / 2, "To create a new account you need to", k, true);
  9494.             k += 15;
  9495.             chatTextDrawingArea.method382(0xffffff, c / 2, "go back to the main " + ClientSettings.SERVER_NAME + " webpage", k, true);
  9496.             k += 15;
  9497.             chatTextDrawingArea.method382(0xffffff, c / 2, "and choose the red 'create account'", k, true);
  9498.             k += 15;
  9499.             chatTextDrawingArea.method382(0xffffff, c / 2, "button at the top right of that page.", k, true);
  9500.             k += 15;
  9501.             int j1 = c / 2;
  9502.             int i2 = c1 / 2 + 50;
  9503.             aBackground_967.method361(j1 - 73, i2 - 20);
  9504.             chatTextDrawingArea.method382(0xffffff, j1, "Cancel", i2 + 5, true);
  9505.         }
  9506.         aRSImageProducer_1109.drawGraphics(171, super.graphics, 202);
  9507.         if (welcomeScreenRaised) {
  9508.             welcomeScreenRaised = false;
  9509.             aRSImageProducer_1107.drawGraphics(0, super.graphics, 128);
  9510.             aRSImageProducer_1108.drawGraphics(371, super.graphics, 202);
  9511.             aRSImageProducer_1112.drawGraphics(265, super.graphics, 0);
  9512.             aRSImageProducer_1113.drawGraphics(265, super.graphics, 562);
  9513.             aRSImageProducer_1114.drawGraphics(171, super.graphics, 128);
  9514.             aRSImageProducer_1115.drawGraphics(171, super.graphics, 562);
  9515.         }
  9516.     }
  9517.  
  9518.     public void drawFlames() {
  9519.         drawingFlames = true;
  9520.         try {
  9521.             long l = System.currentTimeMillis();
  9522.             int i = 0;
  9523.             int j = 20;
  9524.             while (aBoolean831) {
  9525.                 anInt1208++;
  9526.                 calcFlamesPosition();
  9527.                 calcFlamesPosition();
  9528.                 doFlamesDrawing();
  9529.                 if (++i > 10) {
  9530.                     long l1 = System.currentTimeMillis();
  9531.                     int k = (int) (l1 - l) / 10 - j;
  9532.                     j = 40 - k;
  9533.                     if (j < 5) {
  9534.                         j = 5;
  9535.                     }
  9536.                     i = 0;
  9537.                     l = l1;
  9538.                 }
  9539.                 try {
  9540.                     Thread.sleep(j);
  9541.                 } catch (Exception _ex) {
  9542.                 }
  9543.             }
  9544.         } catch (Exception _ex) {
  9545.         }
  9546.         drawingFlames = false;
  9547.     }
  9548.  
  9549.     public void raiseWelcomeScreen() {
  9550.         welcomeScreenRaised = true;
  9551.     }
  9552.  
  9553.     public void method137(Stream stream, int j) {
  9554.         if (j == 84) {
  9555.             int k = stream.readUnsignedByte();
  9556.             int j3 = anInt1268 + (k >> 4 & 7);
  9557.             int i6 = anInt1269 + (k & 7);
  9558.             int l8 = stream.readUnsignedWord();
  9559.             int k11 = stream.readUnsignedWord();
  9560.             int l13 = stream.readUnsignedWord();
  9561.             if (j3 >= 0 && i6 >= 0 && j3 < 104 && i6 < 104) {
  9562.                 NodeList class19_1 = groundArray[plane][j3][i6];
  9563.                 if (class19_1 != null) {
  9564.                     for (Item class30_sub2_sub4_sub2_3 = (Item) class19_1.reverseGetFirst(); class30_sub2_sub4_sub2_3 != null; class30_sub2_sub4_sub2_3 = (Item) class19_1.reverseGetNext()) {
  9565.                         if (class30_sub2_sub4_sub2_3.ID != (l8 & 0x7fff) || class30_sub2_sub4_sub2_3.anInt1559 != k11) {
  9566.                             continue;
  9567.                         }
  9568.                         class30_sub2_sub4_sub2_3.anInt1559 = l13;
  9569.                         break;
  9570.                     }
  9571.  
  9572.                     spawnGroundItem(j3, i6);
  9573.                 }
  9574.             }
  9575.             return;
  9576.         }
  9577.         if (j == 105) {
  9578.             int l = stream.readUnsignedByte();
  9579.             int k3 = anInt1268 + (l >> 4 & 7);
  9580.             int j6 = anInt1269 + (l & 7);
  9581.             int i9 = stream.readUnsignedWord();
  9582.             int l11 = stream.readUnsignedByte();
  9583.             int i14 = l11 >> 4 & 0xf;
  9584.             int i16 = l11 & 7;
  9585.             if (myPlayer.smallX[0] >= k3 - i14 && myPlayer.smallX[0] <= k3 + i14 && myPlayer.smallY[0] >= j6 - i14 && myPlayer.smallY[0] <= j6 + i14 && aBoolean848 && !lowMem && currentSound < 50) {
  9586.                 sound[currentSound] = i9;
  9587.                 soundType[currentSound] = i16;
  9588.                 soundDelay[currentSound] = Sounds.anIntArray326[i9];
  9589.                 currentSound++;
  9590.             }
  9591.         }
  9592.         if (j == 215) {
  9593.             int i1 = stream.method435();
  9594.             int l3 = stream.method428();
  9595.             int k6 = anInt1268 + (l3 >> 4 & 7);
  9596.             int j9 = anInt1269 + (l3 & 7);
  9597.             int i12 = stream.method435();
  9598.             int j14 = stream.readUnsignedWord();
  9599.             if (k6 >= 0 && j9 >= 0 && k6 < 104 && j9 < 104 && i12 != unknownInt10) {
  9600.                 Item class30_sub2_sub4_sub2_2 = new Item();
  9601.                 class30_sub2_sub4_sub2_2.ID = i1;
  9602.                 class30_sub2_sub4_sub2_2.anInt1559 = j14;
  9603.                 if (groundArray[plane][k6][j9] == null) {
  9604.                     groundArray[plane][k6][j9] = new NodeList();
  9605.                 }
  9606.                 groundArray[plane][k6][j9].insertHead(class30_sub2_sub4_sub2_2);
  9607.                 spawnGroundItem(k6, j9);
  9608.             }
  9609.             return;
  9610.         }
  9611.         if (j == 156) {
  9612.             int j1 = stream.readUnsignedByteA();
  9613.             int i4 = anInt1268 + (j1 >> 4 & 7);
  9614.             int l6 = anInt1269 + (j1 & 7);
  9615.             int k9 = stream.readUnsignedWord();
  9616.             if (i4 >= 0 && l6 >= 0 && i4 < 104 && l6 < 104) {
  9617.                 NodeList class19 = groundArray[plane][i4][l6];
  9618.                 if (class19 != null) {
  9619.                     for (Item item = (Item) class19.reverseGetFirst(); item != null; item = (Item) class19.reverseGetNext()) {
  9620.                         if (item.ID != (k9 & 0x7fff)) {
  9621.                             continue;
  9622.                         }
  9623.                         item.unlink();
  9624.                         break;
  9625.                     }
  9626.  
  9627.                     if (class19.reverseGetFirst() == null) {
  9628.                         groundArray[plane][i4][l6] = null;
  9629.                     }
  9630.                     spawnGroundItem(i4, l6);
  9631.                 }
  9632.             }
  9633.             return;
  9634.         }
  9635.         if (j == 160) {
  9636.             int k1 = stream.method428();
  9637.             int j4 = anInt1268 + (k1 >> 4 & 7);
  9638.             int i7 = anInt1269 + (k1 & 7);
  9639.             int l9 = stream.method428();
  9640.             int j12 = l9 >> 2;
  9641.             int k14 = l9 & 3;
  9642.             int j16 = anIntArray1177[j12];
  9643.             int j17 = stream.method435();
  9644.             if (j4 >= 0 && i7 >= 0 && j4 < 103 && i7 < 103) {
  9645.                 int j18 = intGroundArray[plane][j4][i7];
  9646.                 int i19 = intGroundArray[plane][j4 + 1][i7];
  9647.                 int l19 = intGroundArray[plane][j4 + 1][i7 + 1];
  9648.                 int k20 = intGroundArray[plane][j4][i7 + 1];
  9649.                 if (j16 == 0) {
  9650.                     Object1 class10 = worldController.method296(plane, j4, i7);
  9651.                     if (class10 != null) {
  9652.                         int k21 = class10.uid >> 14 & 0x7fff;
  9653.                         if (j12 == 2) {
  9654.                             class10.aClass30_Sub2_Sub4_278 = new Animable_Sub5(k21, 4 + k14, 2, i19, l19, j18, k20, j17, false);
  9655.                             class10.aClass30_Sub2_Sub4_279 = new Animable_Sub5(k21, k14 + 1 & 3, 2, i19, l19, j18, k20, j17, false);
  9656.                         } else {
  9657.                             class10.aClass30_Sub2_Sub4_278 = new Animable_Sub5(k21, k14, j12, i19, l19, j18, k20, j17, false);
  9658.                         }
  9659.                     }
  9660.                 }
  9661.                 if (j16 == 1) {
  9662.                     Object2 class26 = worldController.method297(j4, i7, plane);
  9663.                     if (class26 != null) {
  9664.                         class26.aClass30_Sub2_Sub4_504 = new Animable_Sub5(class26.uid >> 14 & 0x7fff, 0, 4, i19, l19, j18, k20, j17, false);
  9665.                     }
  9666.                 }
  9667.                 if (j16 == 2) {
  9668.                     Object5 class28 = worldController.method298(j4, i7, plane);
  9669.                     if (j12 == 11) {
  9670.                         j12 = 10;
  9671.                     }
  9672.                     if (class28 != null) {
  9673.                         class28.aClass30_Sub2_Sub4_521 = new Animable_Sub5(class28.uid >> 14 & 0x7fff, k14, j12, i19, l19, j18, k20, j17, false);
  9674.                     }
  9675.                 }
  9676.                 if (j16 == 3) {
  9677.                     Object3 class49 = worldController.method299(i7, j4, plane);
  9678.                     if (class49 != null) {
  9679.                         class49.aClass30_Sub2_Sub4_814 = new Animable_Sub5(class49.uid >> 14 & 0x7fff, k14, 22, i19, l19, j18, k20, j17, false);
  9680.                     }
  9681.                 }
  9682.             }
  9683.             return;
  9684.         }
  9685.         if (j == 147) {
  9686.             int l1 = stream.method428();
  9687.             int k4 = anInt1268 + (l1 >> 4 & 7);
  9688.             int j7 = anInt1269 + (l1 & 7);
  9689.             int i10 = stream.readUnsignedWord();
  9690.             byte byte0 = stream.method430();
  9691.             int l14 = stream.method434();
  9692.             byte byte1 = stream.method429();
  9693.             int k17 = stream.readUnsignedWord();
  9694.             int k18 = stream.method428();
  9695.             int j19 = k18 >> 2;
  9696.             int i20 = k18 & 3;
  9697.             int l20 = anIntArray1177[j19];
  9698.             byte byte2 = stream.readSignedByte();
  9699.             int l21 = stream.readUnsignedWord();
  9700.             byte byte3 = stream.method429();
  9701.             Player player;
  9702.             if (i10 == unknownInt10) {
  9703.                 player = myPlayer;
  9704.             } else {
  9705.                 player = playerArray[i10];
  9706.             }
  9707.             if (player != null) {
  9708.                 ObjectDef class46 = ObjectDef.forID(l21);
  9709.                 int i22 = intGroundArray[plane][k4][j7];
  9710.                 int j22 = intGroundArray[plane][k4 + 1][j7];
  9711.                 int k22 = intGroundArray[plane][k4 + 1][j7 + 1];
  9712.                 int l22 = intGroundArray[plane][k4][j7 + 1];
  9713.                 Model model = class46.method578(j19, i20, i22, j22, k22, l22, -1);
  9714.                 if (model != null) {
  9715.                     method130(k17 + 1, -1, 0, l20, j7, 0, plane, k4, l14 + 1);
  9716.                     player.anInt1707 = l14 + loopCycle;
  9717.                     player.anInt1708 = k17 + loopCycle;
  9718.                     player.aModel_1714 = model;
  9719.                     int i23 = class46.anInt744;
  9720.                     int j23 = class46.anInt761;
  9721.                     if (i20 == 1 || i20 == 3) {
  9722.                         i23 = class46.anInt761;
  9723.                         j23 = class46.anInt744;
  9724.                     }
  9725.                     player.anInt1711 = k4 * 128 + i23 * 64;
  9726.                     player.anInt1713 = j7 * 128 + j23 * 64;
  9727.                     player.anInt1712 = method42(plane, player.anInt1713, player.anInt1711);
  9728.                     if (byte2 > byte0) {
  9729.                         byte byte4 = byte2;
  9730.                         byte2 = byte0;
  9731.                         byte0 = byte4;
  9732.                     }
  9733.                     if (byte3 > byte1) {
  9734.                         byte byte5 = byte3;
  9735.                         byte3 = byte1;
  9736.                         byte1 = byte5;
  9737.                     }
  9738.                     player.anInt1719 = k4 + byte2;
  9739.                     player.anInt1721 = k4 + byte0;
  9740.                     player.anInt1720 = j7 + byte3;
  9741.                     player.anInt1722 = j7 + byte1;
  9742.                 }
  9743.             }
  9744.         }
  9745.         if (j == 101) {
  9746.             int l2 = stream.method427();
  9747.             int k5 = l2 >> 2;
  9748.             int j8 = l2 & 3;
  9749.             int i11 = anIntArray1177[k5];
  9750.             int j13 = stream.readUnsignedByte();
  9751.             int k15 = anInt1268 + (j13 >> 4 & 7);
  9752.             int l16 = anInt1269 + (j13 & 7);
  9753.             if (k15 >= 0 && l16 >= 0 && k15 < 104 && l16 < 104)
  9754.                 method130(-1, -1, j8, i11, l16, k5, plane, k15, 0);
  9755.             return;
  9756.         }
  9757.         if (j == 151) {
  9758.             int i2 = stream.method426();
  9759.             int l4 = anInt1268 + (i2 >> 4 & 7);
  9760.             int k7 = anInt1269 + (i2 & 7);
  9761.             int j10 = stream.method434();
  9762.             int k12 = stream.method428();
  9763.             int i15 = k12 >> 2;
  9764.             int k16 = k12 & 3;
  9765.             int l17 = anIntArray1177[i15];
  9766.             if (l4 >= 0 && k7 >= 0 && l4 < 104 && k7 < 104)
  9767.                 method130(-1, j10, k16, l17, k7, i15, plane, l4, 0);
  9768.             return;
  9769.         }
  9770.  
  9771.         if (j == 4) {
  9772.             int j2 = stream.readUnsignedByte();
  9773.             int i5 = anInt1268 + (j2 >> 4 & 7);
  9774.             int l7 = anInt1269 + (j2 & 7);
  9775.             int k10 = stream.readUnsignedWord();
  9776.             int l12 = stream.readUnsignedByte();
  9777.             int j15 = stream.readUnsignedWord();
  9778.             if (i5 >= 0 && l7 >= 0 && i5 < 104 && l7 < 104) {
  9779.                 i5 = i5 * 128 + 64;
  9780.                 l7 = l7 * 128 + 64;
  9781.                 Animable_Sub3 class30_sub2_sub4_sub3 = new Animable_Sub3(plane, loopCycle, j15, k10, method42(plane, l7, i5) - l12, l7, i5);
  9782.                 aClass19_1056.insertHead(class30_sub2_sub4_sub3);
  9783.             }
  9784.             return;
  9785.         }
  9786.         if (j == 44) {
  9787.             int k2 = stream.method436();
  9788.             int j5 = stream.readUnsignedWord();
  9789.             int i8 = stream.readUnsignedByte();
  9790.             int l10 = anInt1268 + (i8 >> 4 & 7);
  9791.             int i13 = anInt1269 + (i8 & 7);
  9792.             if (l10 >= 0 && i13 >= 0 && l10 < 104 && i13 < 104) {
  9793.                 Item class30_sub2_sub4_sub2_1 = new Item();
  9794.                 class30_sub2_sub4_sub2_1.ID = k2;
  9795.                 class30_sub2_sub4_sub2_1.anInt1559 = j5;
  9796.                 if (groundArray[plane][l10][i13] == null) {
  9797.                     groundArray[plane][l10][i13] = new NodeList();
  9798.                 }
  9799.                 groundArray[plane][l10][i13].insertHead(class30_sub2_sub4_sub2_1);
  9800.                 spawnGroundItem(l10, i13);
  9801.             }
  9802.             return;
  9803.         }
  9804.         if (j == 117) {
  9805.             int i3 = stream.readUnsignedByte();
  9806.             int l5 = anInt1268 + (i3 >> 4 & 7);
  9807.             int k8 = anInt1269 + (i3 & 7);
  9808.             int j11 = l5 + stream.readSignedByte();
  9809.             int k13 = k8 + stream.readSignedByte();
  9810.             int l15 = stream.readSignedWord();
  9811.             int i17 = stream.readUnsignedWord();
  9812.             int i18 = stream.readUnsignedByte() * 4;
  9813.             int l18 = stream.readUnsignedByte() * 4;
  9814.             int k19 = stream.readUnsignedWord();
  9815.             int j20 = stream.readUnsignedWord();
  9816.             int i21 = stream.readUnsignedByte();
  9817.             int j21 = stream.readUnsignedByte();
  9818.             if (l5 >= 0 && k8 >= 0 && l5 < 104 && k8 < 104 && j11 >= 0 && k13 >= 0 && j11 < 104 && k13 < 104 && i17 != 65535) {
  9819.                 l5 = l5 * 128 + 64;
  9820.                 k8 = k8 * 128 + 64;
  9821.                 j11 = j11 * 128 + 64;
  9822.                 k13 = k13 * 128 + 64;
  9823.                 Animable_Sub4 class30_sub2_sub4_sub4 = new Animable_Sub4(i21, l18, k19 + loopCycle, j20 + loopCycle, j21, plane, method42(plane, k8, l5) - i18, k8, l5, l15, i17);
  9824.                 class30_sub2_sub4_sub4.method455(k19 + loopCycle, k13, method42(plane, k13, j11) - l18, j11);
  9825.                 aClass19_1013.insertHead(class30_sub2_sub4_sub4);
  9826.             }
  9827.         }
  9828.     }
  9829.  
  9830.     public static void setLowMem() {
  9831.         WorldController.lowMem = true;
  9832.         Texture.lowMem = true;
  9833.         lowMem = true;
  9834.         ObjectManager.lowMem = true;
  9835.         ObjectDef.lowMem = true;
  9836.     }
  9837.  
  9838.     public void method139(Stream stream) {
  9839.         stream.initBitAccess();
  9840.         int k = stream.readBits(8);
  9841.         if (k < npcCount) {
  9842.             for (int l = k; l < npcCount; l++) {
  9843.                 anIntArray840[anInt839++] = npcIndices[l];
  9844.             }
  9845.  
  9846.         }
  9847.         if (k > npcCount) {
  9848.             Signlink.reporterror(myUsername + " Too many npcs");
  9849.             throw new RuntimeException("eek");
  9850.         }
  9851.         npcCount = 0;
  9852.         for (int i1 = 0; i1 < k; i1++) {
  9853.             int j1 = npcIndices[i1];
  9854.             NPC npc = npcArray[j1];
  9855.             int k1 = stream.readBits(1);
  9856.             if (k1 == 0) {
  9857.                 npcIndices[npcCount++] = j1;
  9858.                 npc.anInt1537 = loopCycle;
  9859.             } else {
  9860.                 int l1 = stream.readBits(2);
  9861.                 if (l1 == 0) {
  9862.                     npcIndices[npcCount++] = j1;
  9863.                     npc.anInt1537 = loopCycle;
  9864.                     anIntArray894[anInt893++] = j1;
  9865.                 } else if (l1 == 1) {
  9866.                     npcIndices[npcCount++] = j1;
  9867.                     npc.anInt1537 = loopCycle;
  9868.                     int i2 = stream.readBits(3);
  9869.                     npc.moveInDir(false, i2);
  9870.                     int k2 = stream.readBits(1);
  9871.                     if (k2 == 1) {
  9872.                         anIntArray894[anInt893++] = j1;
  9873.                     }
  9874.                 } else if (l1 == 2) {
  9875.                     npcIndices[npcCount++] = j1;
  9876.                     npc.anInt1537 = loopCycle;
  9877.                     int j2 = stream.readBits(3);
  9878.                     npc.moveInDir(true, j2);
  9879.                     int l2 = stream.readBits(3);
  9880.                     npc.moveInDir(true, l2);
  9881.                     int i3 = stream.readBits(1);
  9882.                     if (i3 == 1) {
  9883.                         anIntArray894[anInt893++] = j1;
  9884.                     }
  9885.                 } else if (l1 == 3) {
  9886.                     anIntArray840[anInt839++] = j1;
  9887.                 }
  9888.             }
  9889.         }
  9890.  
  9891.     }
  9892.  
  9893.     public void processLoginScreenInput() {
  9894.         if (loginScreenState == 0) {
  9895.             int i = super.myWidth / 2 - 80;
  9896.             int l = super.myHeight / 2 + 20;
  9897.             l += 20;
  9898.             if (super.clickMode3 == 1 && super.saveClickX >= i - 75 && super.saveClickX <= i + 75 && super.saveClickY >= l - 20 && super.saveClickY <= l + 20) {
  9899.                 loginScreenState = 3;
  9900.                 loginScreenCursorPos = 0;
  9901.             }
  9902.             i = super.myWidth / 2 + 80;
  9903.             if (super.clickMode3 == 1 && super.saveClickX >= i - 75 && super.saveClickX <= i + 75 && super.saveClickY >= l - 20 && super.saveClickY <= l + 20) {
  9904.                 loginMessage1 = "";
  9905.                 loginMessage2 = "Enter your username & password.";
  9906.                 loginScreenState = 2;
  9907.                 loginScreenCursorPos = 0;
  9908.             }
  9909.         } else {
  9910.             if (loginScreenState == 2) {
  9911.                 int j = super.myHeight / 2 - 40;
  9912.                 j += 30;
  9913.                 j += 25;
  9914.                 if (super.clickMode3 == 1 && super.saveClickY >= j - 15 && super.saveClickY < j) {
  9915.                     loginScreenCursorPos = 0;
  9916.                 }
  9917.                 j += 15;
  9918.                 if (super.clickMode3 == 1 && super.saveClickY >= j - 15 && super.saveClickY < j) {
  9919.                     loginScreenCursorPos = 1;
  9920.                 }
  9921.                 j += 15;
  9922.                 int i1 = super.myWidth / 2 - 80;
  9923.                 int k1 = super.myHeight / 2 + 50;
  9924.                 k1 += 20;
  9925.                 if (super.clickMode3 == 1 && super.saveClickX >= i1 - 75 && super.saveClickX <= i1 + 75 && super.saveClickY >= k1 - 20 && super.saveClickY <= k1 + 20) {
  9926.                     loginFailures = 0;
  9927.                     login(myUsername, myPassword, false);
  9928.                     if (loggedIn) {
  9929.                         return;
  9930.                     }
  9931.                 }
  9932.                 i1 = super.myWidth / 2 + 80;
  9933.                 if (super.clickMode3 == 1 && super.saveClickX >= i1 - 75 && super.saveClickX <= i1 + 75 && super.saveClickY >= k1 - 20 && super.saveClickY <= k1 + 20) {
  9934.                     loginScreenState = 0;
  9935.                     // myUsername = "";
  9936.                     // myPassword = "";
  9937.                 }
  9938.                 do {
  9939.                     int l1 = readChar(-796);
  9940.                     if (l1 == -1) {
  9941.                         break;
  9942.                     }
  9943.                     boolean flag1 = false;
  9944.                     for (int i2 = 0; i2 < validUserPassChars.length(); i2++) {
  9945.                         if (l1 != validUserPassChars.charAt(i2)) {
  9946.                             continue;
  9947.                         }
  9948.                         flag1 = true;
  9949.                         break;
  9950.                     }
  9951.  
  9952.                     if (loginScreenCursorPos == 0) {
  9953.                         if (l1 == 8 && myUsername.length() > 0) {
  9954.                             myUsername = myUsername.substring(0, myUsername.length() - 1);
  9955.                         }
  9956.                         if (l1 == 9 || l1 == 10 || l1 == 13) {
  9957.                             loginScreenCursorPos = 1;
  9958.                         }
  9959.                         if (flag1) {
  9960.                             myUsername += (char) l1;
  9961.                         }
  9962.                         if (myUsername.length() > 12) {
  9963.                             myUsername = myUsername.substring(0, 12);
  9964.                         }
  9965.                     } else if (loginScreenCursorPos == 1) {
  9966.                         if (l1 == 8 && myPassword.length() > 0) {
  9967.                             myPassword = myPassword.substring(0, myPassword.length() - 1);
  9968.                         }
  9969.                         if (l1 == 9 || l1 == 10 || l1 == 13) {
  9970.                             login(myUsername, myPassword, false);
  9971.                             loginScreenCursorPos = 0;
  9972.                         }
  9973.                         if (flag1) {
  9974.                             myPassword += (char) l1;
  9975.                         }
  9976.                         if (myPassword.length() > 20) {
  9977.                             myPassword = myPassword.substring(0, 20);
  9978.                         }
  9979.                     }
  9980.                 } while (true);
  9981.                 return;
  9982.             }
  9983.             if (loginScreenState == 3) {
  9984.                 int k = super.myWidth / 2;
  9985.                 int j1 = super.myHeight / 2 + 50;
  9986.                 j1 += 20;
  9987.                 if (super.clickMode3 == 1 && super.saveClickX >= k - 75 && super.saveClickX <= k + 75 && super.saveClickY >= j1 - 20 && super.saveClickY <= j1 + 20) {
  9988.                     loginScreenState = 0;
  9989.                 }
  9990.             }
  9991.         }
  9992.     }
  9993.  
  9994.     public void markMinimap(Sprite sprite, int i, int j) {
  9995.         int k = minimapInt1 + minimapInt2 & 0x7ff;
  9996.         int l = i * i + j * j;
  9997.         if (l > 6400) {
  9998.             return;
  9999.         }
  10000.         int i1 = Model.modelIntArray1[k];
  10001.         int j1 = Model.modelIntArray2[k];
  10002.         i1 = i1 * 256 / (minimapInt3 + 256);
  10003.         j1 = j1 * 256 / (minimapInt3 + 256);
  10004.         int k1 = j * i1 + i * j1 >> 16;
  10005.         int l1 = j * j1 - i * i1 >> 16;
  10006.         if (l > 2500) {
  10007.             sprite.method354(mapBack, 83 - l1 - sprite.trimHeight / 2 - 4, 94 + k1 - sprite.trimWidth / 2 + 4);
  10008.         } else {
  10009.             sprite.drawSprite(94 + k1 - sprite.trimWidth / 2 + 4, 83 - l1 - sprite.trimHeight / 2 - 4);
  10010.         }
  10011.     }
  10012.  
  10013.     public void method142(int i, int j, int k, int l, int i1, int j1, int k1) {
  10014.         if (i1 >= 1 && i >= 1 && i1 <= 102 && i <= 102) {
  10015.             if (lowMem && j != plane) {
  10016.                 return;
  10017.             }
  10018.             int i2 = 0;
  10019.             if (j1 == 0) {
  10020.                 i2 = worldController.method300(j, i1, i);
  10021.             }
  10022.             if (j1 == 1) {
  10023.                 i2 = worldController.method301(j, i1, i);
  10024.             }
  10025.             if (j1 == 2) {
  10026.                 i2 = worldController.method302(j, i1, i);
  10027.             }
  10028.             if (j1 == 3) {
  10029.                 i2 = worldController.method303(j, i1, i);
  10030.             }
  10031.             if (i2 != 0) {
  10032.                 int i3 = worldController.method304(j, i1, i, i2);
  10033.                 int j2 = i2 >> 14 & 0x7fff;
  10034.                 int k2 = i3 & 0x1f;
  10035.                 int l2 = i3 >> 6;
  10036.                 if (j1 == 0) {
  10037.                     worldController.method291(i1, j, i, (byte) -119);
  10038.                     ObjectDef class46 = ObjectDef.forID(j2);
  10039.                     if (class46.aBoolean767) {
  10040.                         aClass11Array1230[j].method215(l2, k2, class46.aBoolean757, i1, i);
  10041.                     }
  10042.                 }
  10043.                 if (j1 == 1) {
  10044.                     worldController.method292(i, j, i1);
  10045.                 }
  10046.                 if (j1 == 2) {
  10047.                     worldController.method293(j, i1, i);
  10048.                     ObjectDef class46_1 = ObjectDef.forID(j2);
  10049.                     if (i1 + class46_1.anInt744 > 103 || i + class46_1.anInt744 > 103 || i1 + class46_1.anInt761 > 103 || i + class46_1.anInt761 > 103) {
  10050.                         return;
  10051.                     }
  10052.                     if (class46_1.aBoolean767) {
  10053.                         aClass11Array1230[j].method216(l2, class46_1.anInt744, i1, i, class46_1.anInt761, class46_1.aBoolean757);
  10054.                     }
  10055.                 }
  10056.                 if (j1 == 3) {
  10057.                     worldController.method294(j, i, i1);
  10058.                     ObjectDef class46_2 = ObjectDef.forID(j2);
  10059.                     if (class46_2.aBoolean767 && class46_2.hasActions) {
  10060.                         aClass11Array1230[j].method218(i, i1);
  10061.                     }
  10062.                 }
  10063.             }
  10064.             if (k1 >= 0) {
  10065.                 int j3 = j;
  10066.                 if (j3 < 3 && (byteGroundArray[1][i1][i] & 2) == 2) {
  10067.                     j3++;
  10068.                 }
  10069.                 ObjectManager.method188(worldController, k, i, l, j3, aClass11Array1230[j], intGroundArray, i1, k1, j);
  10070.             }
  10071.         }
  10072.     }
  10073.  
  10074.     public void updatePlayers(int i, Stream stream) {
  10075.         anInt839 = 0;
  10076.         anInt893 = 0;
  10077.         method117(stream);
  10078.         method134(stream);
  10079.         method91(stream, i);
  10080.         method49(stream);
  10081.         for (int k = 0; k < anInt839; k++) {
  10082.             int l = anIntArray840[k];
  10083.             if (playerArray[l].anInt1537 != loopCycle) {
  10084.                 playerArray[l] = null;
  10085.             }
  10086.         }
  10087.  
  10088.         if (stream.currentOffset != i) {
  10089.             Signlink.reporterror("Error packet size mismatch in getplayer pos:" + stream.currentOffset + " psize:" + i);
  10090.             throw new RuntimeException("eek");
  10091.         }
  10092.         for (int i1 = 0; i1 < playerCount; i1++) {
  10093.             if (playerArray[playerIndices[i1]] == null) {
  10094.                 Signlink.reporterror(myUsername + " null entry in pl list - pos:" + i1 + " size:" + playerCount);
  10095.                 throw new RuntimeException("eek");
  10096.             }
  10097.         }
  10098.  
  10099.     }
  10100.  
  10101.     public void setCameraPos(int j, int k, int l, int i1, int j1, int k1) {
  10102.         int l1 = 2048 - k & 0x7ff;
  10103.         int i2 = 2048 - j1 & 0x7ff;
  10104.         int j2 = 0;
  10105.         int k2 = 0;
  10106.         int l2 = j;
  10107.         if (l1 != 0) {
  10108.             int i3 = Model.modelIntArray1[l1];
  10109.             int k3 = Model.modelIntArray2[l1];
  10110.             int i4 = k2 * k3 - l2 * i3 >> 16;
  10111.             l2 = k2 * i3 + l2 * k3 >> 16;
  10112.             k2 = i4;
  10113.         }
  10114.         if (i2 != 0) {
  10115.             /*
  10116.              * xxx if(cameratoggle){ if(zoom == 0) zoom = k2; if(lftrit == 0)
  10117.              * lftrit = j2; if(fwdbwd == 0) fwdbwd = l2; k2 = zoom; j2 = lftrit;
  10118.              * l2 = fwdbwd; }
  10119.              */
  10120.             int j3 = Model.modelIntArray1[i2];
  10121.             int l3 = Model.modelIntArray2[i2];
  10122.             int j4 = l2 * j3 + j2 * l3 >> 16;
  10123.             l2 = l2 * l3 - j2 * j3 >> 16;
  10124.             j2 = j4;
  10125.         }
  10126.         xCameraPos = l - j2;
  10127.         zCameraPos = i1 - k2;
  10128.         yCameraPos = k1 - l2;
  10129.         yCameraCurve = k;
  10130.         xCameraCurve = j1;
  10131.     }
  10132.  
  10133.     public boolean parsePacket() {
  10134.         if (socketStream == null) {
  10135.             return false;
  10136.         }
  10137.         try {
  10138.             int i = socketStream.available();
  10139.             if (i == 0) {
  10140.                 return false;
  10141.             }
  10142.             if (pktType == -1) {
  10143.                 socketStream.flushInputStream(inStream.buffer, 1);
  10144.                 pktType = inStream.buffer[0] & 0xff;
  10145.                 if (encryption != null) {
  10146.                     pktType = pktType - encryption.getNextKey() & 0xff;
  10147.                 }
  10148.                 pktSize = SizeConstants.packetSizes[pktType];
  10149.                 i--;
  10150.             }
  10151.             if (pktSize == -1) {
  10152.                 if (i > 0) {
  10153.                     socketStream.flushInputStream(inStream.buffer, 1);
  10154.                     pktSize = inStream.buffer[0] & 0xff;
  10155.                     i--;
  10156.                 } else {
  10157.                     return false;
  10158.                 }
  10159.             }
  10160.             if (pktSize == -2) {
  10161.                 if (i > 1) {
  10162.                     socketStream.flushInputStream(inStream.buffer, 2);
  10163.                     inStream.currentOffset = 0;
  10164.                     pktSize = inStream.readUnsignedWord();
  10165.                     i -= 2;
  10166.                 } else {
  10167.                     return false;
  10168.                 }
  10169.             }
  10170.             if (i < pktSize) {
  10171.                 return false;
  10172.             }
  10173.             inStream.currentOffset = 0;
  10174.             socketStream.flushInputStream(inStream.buffer, pktSize);
  10175.             anInt1009 = 0;
  10176.             anInt843 = anInt842;
  10177.             anInt842 = anInt841;
  10178.             anInt841 = pktType;
  10179.             if (pktType == 81) {
  10180.                 updatePlayers(pktSize, inStream);
  10181.                 aBoolean1080 = false;
  10182.                 pktType = -1;
  10183.                 return true;
  10184.             }
  10185.             if (pktType == 176) {
  10186.                 daysSinceRecovChange = inStream.method427();
  10187.                 unreadMessages = inStream.method435();
  10188.                 membersInt = inStream.readUnsignedByte();
  10189.                 anInt1193 = inStream.method440();
  10190.                 daysSinceLastLogin = inStream.readUnsignedWord();
  10191.                 if (anInt1193 != 0 && openInterfaceID == -1) {
  10192.                     Signlink.dnslookup(TextClass.method586(anInt1193));
  10193.                     closeOpenInterfaces();
  10194.                     char c = '\u028A';
  10195.                     if (daysSinceRecovChange != 201 || membersInt == 1) {
  10196.                         c = '\u028F';
  10197.                     }
  10198.                     reportAbuseInput = "";
  10199.                     canMute = false;
  10200.                     for (RSInterface element : RSInterface.interfaceCache) {
  10201.                         if (element == null || element.anInt214 != c) {
  10202.                             continue;
  10203.                         }
  10204.                         openInterfaceID = element.parentID;
  10205.                         break;
  10206.                     }
  10207.  
  10208.                 }
  10209.                 pktType = -1;
  10210.                 return true;
  10211.             }
  10212.             if (pktType == 64) {
  10213.                 anInt1268 = inStream.method427();
  10214.                 anInt1269 = inStream.method428();
  10215.                 for (int j = anInt1268; j < anInt1268 + 8; j++) {
  10216.                     for (int l9 = anInt1269; l9 < anInt1269 + 8; l9++) {
  10217.                         if (groundArray[plane][j][l9] != null) {
  10218.                             groundArray[plane][j][l9] = null;
  10219.                             spawnGroundItem(j, l9);
  10220.                         }
  10221.                     }
  10222.  
  10223.                 }
  10224.  
  10225.                 for (Class30_Sub1 class30_sub1 = (Class30_Sub1) aClass19_1179.reverseGetFirst(); class30_sub1 != null; class30_sub1 = (Class30_Sub1) aClass19_1179.reverseGetNext()) {
  10226.                     if (class30_sub1.anInt1297 >= anInt1268 && class30_sub1.anInt1297 < anInt1268 + 8 && class30_sub1.anInt1298 >= anInt1269 && class30_sub1.anInt1298 < anInt1269 + 8 && class30_sub1.anInt1295 == plane) {
  10227.                         class30_sub1.anInt1294 = 0;
  10228.                     }
  10229.                 }
  10230.  
  10231.                 pktType = -1;
  10232.                 return true;
  10233.             }
  10234.             if (pktType == 185) {
  10235.                 int k = inStream.method436();
  10236.                 RSInterface.interfaceCache[k].anInt233 = 3;
  10237.                 if (myPlayer.desc == null) {
  10238.                     RSInterface.interfaceCache[k].mediaID = (myPlayer.anIntArray1700[0] << 25) + (myPlayer.anIntArray1700[4] << 20) + (myPlayer.equipment[0] << 15) + (myPlayer.equipment[8] << 10) + (myPlayer.equipment[11] << 5) + myPlayer.equipment[1];
  10239.                 } else {
  10240.                     RSInterface.interfaceCache[k].mediaID = (int) (0x12345678L + myPlayer.desc.type);
  10241.                 }
  10242.                 pktType = -1;
  10243.                 return true;
  10244.             }
  10245.             if (pktType == 107) {
  10246.                 aBoolean1160 = false;
  10247.                 for (int l = 0; l < 5; l++) {
  10248.                     aBooleanArray876[l] = false;
  10249.                 }
  10250.  
  10251.                 pktType = -1;
  10252.                 return true;
  10253.             }
  10254.             if (pktType == 72) {
  10255.                 int i1 = inStream.method434();
  10256.                 RSInterface class9 = RSInterface.interfaceCache[i1];
  10257.                 for (int k15 = 0; k15 < class9.inv.length; k15++) {
  10258.                     class9.inv[k15] = -1;
  10259.                     class9.inv[k15] = 0;
  10260.                 }
  10261.  
  10262.                 pktType = -1;
  10263.                 return true;
  10264.             }
  10265.             if (pktType == 214) {
  10266.                 ignoreCount = pktSize / 8;
  10267.                 for (int j1 = 0; j1 < ignoreCount; j1++) {
  10268.                     ignoreListAsLongs[j1] = inStream.readQWord();
  10269.                 }
  10270.  
  10271.                 pktType = -1;
  10272.                 return true;
  10273.             }
  10274.             if (pktType == 166) {
  10275.                 aBoolean1160 = true;
  10276.                 anInt1098 = inStream.readUnsignedByte();
  10277.                 anInt1099 = inStream.readUnsignedByte();
  10278.                 anInt1100 = inStream.readUnsignedWord();
  10279.                 anInt1101 = inStream.readUnsignedByte();
  10280.                 anInt1102 = inStream.readUnsignedByte();
  10281.                 if (anInt1102 >= 100) {
  10282.                     xCameraPos = anInt1098 * 128 + 64;
  10283.                     yCameraPos = anInt1099 * 128 + 64;
  10284.                     zCameraPos = method42(plane, yCameraPos, xCameraPos) - anInt1100;
  10285.                 }
  10286.                 pktType = -1;
  10287.                 return true;
  10288.             }
  10289.             if (pktType == 134) {
  10290.                 needDrawTabArea = true;
  10291.                 int k1 = inStream.readUnsignedByte();
  10292.                 int i10 = inStream.method439();
  10293.                 int l15 = inStream.readUnsignedByte();
  10294.                 currentExp[k1] = i10;
  10295.                 currentStats[k1] = l15;
  10296.                 maxStats[k1] = 1;
  10297.                 for (int k20 = 0; k20 < 98; k20++) {
  10298.                     if (i10 >= anIntArray1019[k20]) {
  10299.                         maxStats[k1] = k20 + 2;
  10300.                     }
  10301.                 }
  10302.  
  10303.                 pktType = -1;
  10304.                 return true;
  10305.             }
  10306.             if (pktType == 71) {
  10307.                 int l1 = inStream.readUnsignedWord();
  10308.                 int j10 = inStream.readUnsignedByteA();
  10309.                 if (l1 == 65535) {
  10310.                     l1 = -1;
  10311.                 }
  10312.                 tabInterfaceIDs[j10] = l1;
  10313.                 needDrawTabArea = true;
  10314.                 tabAreaAltered = true;
  10315.                 pktType = -1;
  10316.                 return true;
  10317.             }
  10318.             if (pktType == 74) {
  10319.                 int i2 = inStream.method434();
  10320.                 if (i2 == 65535) {
  10321.                     i2 = -1;
  10322.                 }
  10323.                 if (i2 != -1 || previousSong != 0) {
  10324.                     if (i2 != -1 && currentSong != i2 && musicVolume != 0 && previousSong == 0)
  10325.                         method58(10, musicVolume, false, i2);
  10326.                 } else
  10327.                     method55(false);
  10328.                 currentSong = i2;
  10329.                 pktType = -1;
  10330.                 return true;
  10331.             }
  10332.             if (pktType == 121) {
  10333.                 int i_60_ = inStream.method436();
  10334.                 int i_61_ = inStream.method435();
  10335.                 if (i_61_ == 65535)
  10336.                     i_61_ = -1;
  10337.                 if (musicVolume != 0 && i_61_ != -1) {
  10338.                     method56(musicVolume, false, i_60_);
  10339.                     previousSong = i_61_*20;
  10340.                 }
  10341.                 pktType = -1;
  10342.                 return true;
  10343.             }
  10344.             if (pktType == 109) {
  10345.                 resetLogout();
  10346.                 pktType = -1;
  10347.                 return false;
  10348.             }
  10349.             if (pktType == 70) {
  10350.                 int k2 = inStream.readSignedWord();
  10351.                 int l10 = inStream.method437();
  10352.                 int i16 = inStream.method434();
  10353.                 RSInterface class9_5 = RSInterface.interfaceCache[i16];
  10354.                 class9_5.anInt263 = k2;
  10355.                 class9_5.anInt265 = l10;
  10356.                 pktType = -1;
  10357.                 return true;
  10358.             }
  10359.             if (pktType == 73 || pktType == 241) {
  10360.  
  10361.                 // mapReset();
  10362.                 int l2 = anInt1069;
  10363.                 int i11 = anInt1070;
  10364.                 if (pktType == 73) {
  10365.                     l2 = inStream.method435();
  10366.                     i11 = inStream.readUnsignedWord();
  10367.                     aBoolean1159 = false;
  10368.                 }
  10369.                 if (pktType == 241) {
  10370.                     i11 = inStream.method435();
  10371.                     inStream.initBitAccess();
  10372.                     for (int j16 = 0; j16 < 4; j16++) {
  10373.                         for (int l20 = 0; l20 < 13; l20++) {
  10374.                             for (int j23 = 0; j23 < 13; j23++) {
  10375.                                 int i26 = inStream.readBits(1);
  10376.                                 if (i26 == 1) {
  10377.                                     anIntArrayArrayArray1129[j16][l20][j23] = inStream.readBits(26);
  10378.                                 } else {
  10379.                                     anIntArrayArrayArray1129[j16][l20][j23] = -1;
  10380.                                 }
  10381.                             }
  10382.  
  10383.                         }
  10384.  
  10385.                     }
  10386.  
  10387.                     inStream.finishBitAccess();
  10388.                     l2 = inStream.readUnsignedWord();
  10389.                     aBoolean1159 = true;
  10390.                 }
  10391.                 if (anInt1069 == l2 && anInt1070 == i11 && loadingStage == 2) {
  10392.                     pktType = -1;
  10393.                     return true;
  10394.                 }
  10395.                 anInt1069 = l2;
  10396.                 anInt1070 = i11;
  10397.                 baseX = (anInt1069 - 6) * 8;
  10398.                 baseY = (anInt1070 - 6) * 8;
  10399.                 aBoolean1141 = (anInt1069 / 8 == 48 || anInt1069 / 8 == 49) && anInt1070 / 8 == 48;
  10400.                 if (anInt1069 / 8 == 48 && anInt1070 / 8 == 148) {
  10401.                     aBoolean1141 = true;
  10402.                 }
  10403.                 loadingStage = 1;
  10404.                 aLong824 = System.currentTimeMillis();
  10405.                 drawTextOnScreen(null, "Loading - please wait.");
  10406.                 if (pktType == 73) {
  10407.                     int k16 = 0;
  10408.                     for (int i21 = (anInt1069 - 6) / 8; i21 <= (anInt1069 + 6) / 8; i21++) {
  10409.                         for (int k23 = (anInt1070 - 6) / 8; k23 <= (anInt1070 + 6) / 8; k23++) {
  10410.                             k16++;
  10411.                         }
  10412.  
  10413.                     }
  10414.  
  10415.                     aByteArrayArray1183 = new byte[k16][];
  10416.                     aByteArrayArray1247 = new byte[k16][];
  10417.                     anIntArray1234 = new int[k16];
  10418.                     anIntArray1235 = new int[k16];
  10419.                     anIntArray1236 = new int[k16];
  10420.                     k16 = 0;
  10421.                     for (int l23 = (anInt1069 - 6) / 8; l23 <= (anInt1069 + 6) / 8; l23++) {
  10422.                         for (int j26 = (anInt1070 - 6) / 8; j26 <= (anInt1070 + 6) / 8; j26++) {
  10423.                             anIntArray1234[k16] = (l23 << 8) + j26;
  10424.                             if (aBoolean1141 && (j26 == 49 || j26 == 149 || j26 == 147 || l23 == 50 || l23 == 49 && j26 == 47)) {
  10425.                                 anIntArray1235[k16] = -1;
  10426.                                 anIntArray1236[k16] = -1;
  10427.                                 k16++;
  10428.                             } else {
  10429.                                 int k28 = anIntArray1235[k16] = onDemandFetcher.method562(0, j26, l23);
  10430.                                 if (k28 != -1) {
  10431.                                     onDemandFetcher.method558(3, k28);
  10432.                                 }
  10433.                                 int j30 = anIntArray1236[k16] = onDemandFetcher.method562(1, j26, l23);
  10434.                                 if (j30 != -1) {
  10435.                                     onDemandFetcher.method558(3, j30);
  10436.                                 }
  10437.                                 k16++;
  10438.                             }
  10439.                         }
  10440.  
  10441.                     }
  10442.  
  10443.                 }
  10444.                 if (pktType == 241) {
  10445.                     int l16 = 0;
  10446.                     int ai[] = new int[676];
  10447.                     for (int i24 = 0; i24 < 4; i24++) {
  10448.                         for (int k26 = 0; k26 < 13; k26++) {
  10449.                             for (int l28 = 0; l28 < 13; l28++) {
  10450.                                 int k30 = anIntArrayArrayArray1129[i24][k26][l28];
  10451.                                 if (k30 != -1) {
  10452.                                     int k31 = k30 >> 14 & 0x3ff;
  10453.                                     int i32 = k30 >> 3 & 0x7ff;
  10454.                                     int k32 = (k31 / 8 << 8) + i32 / 8;
  10455.                                     for (int j33 = 0; j33 < l16; j33++) {
  10456.                                         if (ai[j33] != k32) {
  10457.                                             continue;
  10458.                                         }
  10459.                                         k32 = -1;
  10460.                                         break;
  10461.                                     }
  10462.  
  10463.                                     if (k32 != -1) {
  10464.                                         ai[l16++] = k32;
  10465.                                     }
  10466.                                 }
  10467.                             }
  10468.  
  10469.                         }
  10470.  
  10471.                     }
  10472.  
  10473.                     aByteArrayArray1183 = new byte[l16][];
  10474.                     aByteArrayArray1247 = new byte[l16][];
  10475.                     anIntArray1234 = new int[l16];
  10476.                     anIntArray1235 = new int[l16];
  10477.                     anIntArray1236 = new int[l16];
  10478.                     for (int l26 = 0; l26 < l16; l26++) {
  10479.                         int i29 = anIntArray1234[l26] = ai[l26];
  10480.                         int l30 = i29 >> 8 & 0xff;
  10481.                         int l31 = i29 & 0xff;
  10482.                         int j32 = anIntArray1235[l26] = onDemandFetcher.method562(0, l31, l30);
  10483.                         if (j32 != -1) {
  10484.                             onDemandFetcher.method558(3, j32);
  10485.                         }
  10486.                         int i33 = anIntArray1236[l26] = onDemandFetcher.method562(1, l31, l30);
  10487.                         if (i33 != -1) {
  10488.                             onDemandFetcher.method558(3, i33);
  10489.                         }
  10490.                     }
  10491.  
  10492.                 }
  10493.                 int i17 = baseX - anInt1036;
  10494.                 int j21 = baseY - anInt1037;
  10495.                 anInt1036 = baseX;
  10496.                 anInt1037 = baseY;
  10497.                 for (int j24 = 0; j24 < 16384; j24++) {
  10498.                     NPC npc = npcArray[j24];
  10499.                     if (npc != null) {
  10500.                         for (int j29 = 0; j29 < 10; j29++) {
  10501.                             npc.smallX[j29] -= i17;
  10502.                             npc.smallY[j29] -= j21;
  10503.                         }
  10504.  
  10505.                         npc.x -= i17 * 128;
  10506.                         npc.y -= j21 * 128;
  10507.                     }
  10508.                 }
  10509.  
  10510.                 for (int i27 = 0; i27 < maxPlayers; i27++) {
  10511.                     Player player = playerArray[i27];
  10512.                     if (player != null) {
  10513.                         for (int i31 = 0; i31 < 10; i31++) {
  10514.                             player.smallX[i31] -= i17;
  10515.                             player.smallY[i31] -= j21;
  10516.                         }
  10517.  
  10518.                         player.x -= i17 * 128;
  10519.                         player.y -= j21 * 128;
  10520.                     }
  10521.                 }
  10522.  
  10523.                 aBoolean1080 = true;
  10524.                 byte byte1 = 0;
  10525.                 byte byte2 = 104;
  10526.                 byte byte3 = 1;
  10527.                 if (i17 < 0) {
  10528.                     byte1 = 103;
  10529.                     byte2 = -1;
  10530.                     byte3 = -1;
  10531.                 }
  10532.                 byte byte4 = 0;
  10533.                 byte byte5 = 104;
  10534.                 byte byte6 = 1;
  10535.                 if (j21 < 0) {
  10536.                     byte4 = 103;
  10537.                     byte5 = -1;
  10538.                     byte6 = -1;
  10539.                 }
  10540.                 for (int k33 = byte1; k33 != byte2; k33 += byte3) {
  10541.                     for (int l33 = byte4; l33 != byte5; l33 += byte6) {
  10542.                         int i34 = k33 + i17;
  10543.                         int j34 = l33 + j21;
  10544.                         for (int k34 = 0; k34 < 4; k34++) {
  10545.                             if (i34 >= 0 && j34 >= 0 && i34 < 104 && j34 < 104) {
  10546.                                 groundArray[k34][k33][l33] = groundArray[k34][i34][j34];
  10547.                             } else {
  10548.                                 groundArray[k34][k33][l33] = null;
  10549.                             }
  10550.                         }
  10551.  
  10552.                     }
  10553.  
  10554.                 }
  10555.  
  10556.                 for (Class30_Sub1 class30_sub1_1 = (Class30_Sub1) aClass19_1179.reverseGetFirst(); class30_sub1_1 != null; class30_sub1_1 = (Class30_Sub1) aClass19_1179.reverseGetNext()) {
  10557.                     class30_sub1_1.anInt1297 -= i17;
  10558.                     class30_sub1_1.anInt1298 -= j21;
  10559.                     if (class30_sub1_1.anInt1297 < 0 || class30_sub1_1.anInt1298 < 0 || class30_sub1_1.anInt1297 >= 104 || class30_sub1_1.anInt1298 >= 104) {
  10560.                         class30_sub1_1.unlink();
  10561.                     }
  10562.                 }
  10563.  
  10564.                 if (destX != 0) {
  10565.                     destX -= i17;
  10566.                     destY -= j21;
  10567.                 }
  10568.                 aBoolean1160 = false;
  10569.                 pktType = -1;
  10570.                 return true;
  10571.             }
  10572.             if (pktType == 208) {
  10573.                 int i3 = inStream.method437();
  10574.                 if (i3 >= 0) {
  10575.                     method60(i3);
  10576.                 }
  10577.                 anInt1018 = i3;
  10578.                 pktType = -1;
  10579.                 return true;
  10580.             }
  10581.             if (pktType == 99) {
  10582.                 anInt1021 = inStream.readUnsignedByte();
  10583.                 pktType = -1;
  10584.                 return true;
  10585.             }
  10586.             if (pktType == 75) {
  10587.                 int j3 = inStream.method436();
  10588.                 int j11 = inStream.method436();
  10589.                 RSInterface.interfaceCache[j11].anInt233 = 2;
  10590.                 RSInterface.interfaceCache[j11].mediaID = j3;
  10591.                 pktType = -1;
  10592.                 return true;
  10593.             }
  10594.             if (pktType == 114) {
  10595.                 anInt1104 = inStream.method434() * 30;
  10596.                 pktType = -1;
  10597.                 return true;
  10598.             }
  10599.             if (pktType == 60) {
  10600.                 anInt1269 = inStream.readUnsignedByte();
  10601.                 anInt1268 = inStream.method427();
  10602.                 while (inStream.currentOffset < pktSize) {
  10603.                     int k3 = inStream.readUnsignedByte();
  10604.                     method137(inStream, k3);
  10605.                 }
  10606.                 pktType = -1;
  10607.                 return true;
  10608.             }
  10609.             if (pktType == 35) {
  10610.                 int l3 = inStream.readUnsignedByte();
  10611.                 int k11 = inStream.readUnsignedByte();
  10612.                 int j17 = inStream.readUnsignedByte();
  10613.                 int k21 = inStream.readUnsignedByte();
  10614.                 aBooleanArray876[l3] = true;
  10615.                 anIntArray873[l3] = k11;
  10616.                 anIntArray1203[l3] = j17;
  10617.                 anIntArray928[l3] = k21;
  10618.                 anIntArray1030[l3] = 0;
  10619.                 pktType = -1;
  10620.                 return true;
  10621.             }
  10622.             if (pktType == 174) {
  10623.                 int id = inStream.readUnsignedWord();
  10624.                 int type = inStream.readUnsignedByte();
  10625.                 int delay = inStream.readUnsignedWord();
  10626.                 int volume = inStream.readUnsignedByte();
  10627.                 sound[currentSound] = id;
  10628.                 soundType[currentSound] = type;
  10629.                 soundDelay[currentSound] = delay + Sounds.anIntArray326[id];
  10630.                 soundVolume[currentSound] = volume;
  10631.                 currentSound++;
  10632.                 pktType = -1;
  10633.                 return true;
  10634.             }
  10635.             if (pktType == 104) {
  10636.                 int j4 = inStream.method427();
  10637.                 int i12 = inStream.readUnsignedByteA();
  10638.                 String s6 = inStream.readString();
  10639.                 if (j4 >= 1 && j4 <= 5) {
  10640.                     if (s6.equalsIgnoreCase("null")) {
  10641.                         s6 = null;
  10642.                     }
  10643.                     atPlayerActions[j4 - 1] = s6;
  10644.                     atPlayerArray[j4 - 1] = i12 == 0;
  10645.                 }
  10646.                 pktType = -1;
  10647.                 return true;
  10648.             }
  10649.             if (pktType == 78) {
  10650.                 destX = 0;
  10651.                 pktType = -1;
  10652.                 return true;
  10653.             }
  10654.             if (pktType == 253) {
  10655.                 String s = inStream.readString();
  10656.                 if (s.endsWith(":tradereq:")) {
  10657.                     String s3 = s.substring(0, s.indexOf(":"));
  10658.                     long l17 = TextClass.longForName(s3);
  10659.                     boolean flag2 = false;
  10660.                     for (int j27 = 0; j27 < ignoreCount; j27++) {
  10661.                         if (ignoreListAsLongs[j27] != l17) {
  10662.                             continue;
  10663.                         }
  10664.                         flag2 = true;
  10665.                         break;
  10666.                     }
  10667.  
  10668.                     if (!flag2 && anInt1251 == 0) {
  10669.                         pushMessage("wishes to trade with you.", 4, s3);
  10670.                     }
  10671.                 } else if (s.endsWith(":duelreq:")) {
  10672.                     String s4 = s.substring(0, s.indexOf(":"));
  10673.                     long l18 = TextClass.longForName(s4);
  10674.                     boolean flag3 = false;
  10675.                     for (int k27 = 0; k27 < ignoreCount; k27++) {
  10676.                         if (ignoreListAsLongs[k27] != l18) {
  10677.                             continue;
  10678.                         }
  10679.                         flag3 = true;
  10680.                         break;
  10681.                     }
  10682.  
  10683.                     if (!flag3 && anInt1251 == 0) {
  10684.                         pushMessage("wishes to duel with you.", 8, s4);
  10685.                     }
  10686.                 } else if (s.endsWith(":chalreq:")) {
  10687.                     String s5 = s.substring(0, s.indexOf(":"));
  10688.                     long l19 = TextClass.longForName(s5);
  10689.                     boolean flag4 = false;
  10690.                     for (int l27 = 0; l27 < ignoreCount; l27++) {
  10691.                         if (ignoreListAsLongs[l27] != l19) {
  10692.                             continue;
  10693.                         }
  10694.                         flag4 = true;
  10695.                         break;
  10696.                     }
  10697.  
  10698.                     if (!flag4 && anInt1251 == 0) {
  10699.                         String s8 = s.substring(s.indexOf(":") + 1, s.length() - 9);
  10700.                         pushMessage(s8, 8, s5);
  10701.                     }
  10702.                 } else if (s.endsWith(":airtiara:")) {
  10703.                     tiara = 1;
  10704.                 } else if (s.endsWith(":watertiara:")) {
  10705.                     tiara = 2;
  10706.                 } else if (s.endsWith(":earthtiara:")) {
  10707.                     tiara = 3;
  10708.                 } else if (s.endsWith(":firetiara:")) {
  10709.                     tiara = 4;
  10710.                 } else if (s.endsWith(":mindtiara:")) {
  10711.                     tiara = 5;
  10712.                 } else if (s.endsWith(":bodytiara:")) {
  10713.                     tiara = 6;
  10714.                 } else if (s.endsWith(":cosmictiara:")) {
  10715.                     tiara = 7;
  10716.                 } else if (s.endsWith(":chaostiara:")) {
  10717.                     tiara = 8;
  10718.                 } else if (s.endsWith(":naturetiara:")) {
  10719.                     tiara = 9;
  10720.                 } else if (s.endsWith(":lawtiara:")) {
  10721.                     tiara = 10;
  10722.                 } else if (s.endsWith(":deathtiara:")) {
  10723.                     tiara = 11;
  10724.                 } else if (s.endsWith(":notiara:")) {
  10725.                     tiara = 0;
  10726.                 } else {
  10727.                     pushMessage(s, 0, "");
  10728.                 }
  10729.                 pktType = -1;
  10730.                 // serverMessage(s);
  10731.  
  10732.                 return true;
  10733.             }
  10734.             if (pktType == 1) {
  10735.                 for (int k4 = 0; k4 < playerArray.length; k4++) {
  10736.                     if (playerArray[k4] != null) {
  10737.                         playerArray[k4].anim = -1;
  10738.                     }
  10739.                 }
  10740.  
  10741.                 for (int j12 = 0; j12 < npcArray.length; j12++) {
  10742.                     if (npcArray[j12] != null) {
  10743.                         npcArray[j12].anim = -1;
  10744.                     }
  10745.                 }
  10746.  
  10747.                 pktType = -1;
  10748.                 return true;
  10749.             }
  10750.             if (pktType == 50) {
  10751.                 long l4 = inStream.readQWord();
  10752.                 int i18 = inStream.readUnsignedByte();
  10753.                 String s7 = TextClass.fixName(TextClass.nameForLong(l4));
  10754.                 for (int k24 = 0; k24 < friendsCount; k24++) {
  10755.                     if (l4 != friendsListAsLongs[k24]) {
  10756.                         continue;
  10757.                     }
  10758.                     if (friendsNodeIDs[k24] != i18) {
  10759.                         friendsNodeIDs[k24] = i18;
  10760.                         needDrawTabArea = true;
  10761.                         if (i18 >= 2) {
  10762.                             pushMessage(s7 + " has logged in.", 5, "");
  10763.                         }
  10764.                         if (i18 <= 1) {
  10765.                             pushMessage(s7 + " has logged out.", 5, "");
  10766.                         }
  10767.                     }
  10768.                     s7 = null;
  10769.                     break;
  10770.                 }
  10771.  
  10772.                 if (s7 != null && friendsCount < 200) {
  10773.                     friendsListAsLongs[friendsCount] = l4;
  10774.                     friendsList[friendsCount] = s7;
  10775.                     friendsNodeIDs[friendsCount] = i18;
  10776.                     friendsCount++;
  10777.                     needDrawTabArea = true;
  10778.                 }
  10779.                 for (boolean flag6 = false; !flag6;) {
  10780.                     flag6 = true;
  10781.                     for (int k29 = 0; k29 < friendsCount - 1; k29++) {
  10782.                         if (friendsNodeIDs[k29] != nodeID && friendsNodeIDs[k29 + 1] == nodeID || friendsNodeIDs[k29] == 0 && friendsNodeIDs[k29 + 1] != 0) {
  10783.                             int j31 = friendsNodeIDs[k29];
  10784.                             friendsNodeIDs[k29] = friendsNodeIDs[k29 + 1];
  10785.                             friendsNodeIDs[k29 + 1] = j31;
  10786.                             String s10 = friendsList[k29];
  10787.                             friendsList[k29] = friendsList[k29 + 1];
  10788.                             friendsList[k29 + 1] = s10;
  10789.                             long l32 = friendsListAsLongs[k29];
  10790.                             friendsListAsLongs[k29] = friendsListAsLongs[k29 + 1];
  10791.                             friendsListAsLongs[k29 + 1] = l32;
  10792.                             needDrawTabArea = true;
  10793.                             flag6 = false;
  10794.                         }
  10795.                     }
  10796.  
  10797.                 }
  10798.  
  10799.                 pktType = -1;
  10800.                 return true;
  10801.             }
  10802.             if (pktType == 110) {
  10803.                 if (tabID == 12) {
  10804.                     needDrawTabArea = true;
  10805.                 }
  10806.                 energy = inStream.readUnsignedByte();
  10807.                 pktType = -1;
  10808.                 return true;
  10809.             }
  10810.             if (pktType == 254) {
  10811.                 anInt855 = inStream.readUnsignedByte();
  10812.                 if (anInt855 == 1) {
  10813.                     anInt1222 = inStream.readUnsignedWord();
  10814.                 }
  10815.                 if (anInt855 >= 2 && anInt855 <= 6) {
  10816.                     if (anInt855 == 2) {
  10817.                         anInt937 = 64;
  10818.                         anInt938 = 64;
  10819.                     }
  10820.                     if (anInt855 == 3) {
  10821.                         anInt937 = 0;
  10822.                         anInt938 = 64;
  10823.                     }
  10824.                     if (anInt855 == 4) {
  10825.                         anInt937 = 128;
  10826.                         anInt938 = 64;
  10827.                     }
  10828.                     if (anInt855 == 5) {
  10829.                         anInt937 = 64;
  10830.                         anInt938 = 0;
  10831.                     }
  10832.                     if (anInt855 == 6) {
  10833.                         anInt937 = 64;
  10834.                         anInt938 = 128;
  10835.                     }
  10836.                     anInt855 = 2;
  10837.                     anInt934 = inStream.readUnsignedWord();
  10838.                     anInt935 = inStream.readUnsignedWord();
  10839.                     anInt936 = inStream.readUnsignedByte();
  10840.                 }
  10841.                 if (anInt855 == 10) {
  10842.                     anInt933 = inStream.readUnsignedWord();
  10843.                 }
  10844.                 pktType = -1;
  10845.                 return true;
  10846.             }
  10847.             if (pktType == 248) {
  10848.                 int i5 = inStream.method435();
  10849.                 int k12 = inStream.readUnsignedWord();
  10850.                 if (backDialogID != -1) {
  10851.                     backDialogID = -1;
  10852.                     inputTaken = true;
  10853.                 }
  10854.                 if (fullScreenBackDialogID != -1) {
  10855.                     fullScreenBackDialogID = -1;
  10856.                     welcomeScreenRaised = true;
  10857.                 }
  10858.                 if (fullScreenInterfaceId != -1) {
  10859.                     fullScreenInterfaceId = -1;
  10860.                 }
  10861.                 if (openInterfaceID != i5) {
  10862.                     openInterfaceID = i5;
  10863.                 }
  10864.                 if (invOverlayInterfaceID != k12) {
  10865.                     invOverlayInterfaceID = k12;
  10866.                 }
  10867.                 if (inputDialogState != 0) {
  10868.                     inputDialogState = 0;
  10869.                     inputTaken = true;
  10870.                 }
  10871.                 needDrawTabArea = true;
  10872.                 tabAreaAltered = true;
  10873.                 aBoolean1149 = false;
  10874.                 pktType = -1;
  10875.                 return true;
  10876.             }
  10877.             if (pktType == 79) {
  10878.                 int j5 = inStream.method434();
  10879.                 int l12 = inStream.method435();
  10880.                 RSInterface class9_3 = RSInterface.interfaceCache[j5];
  10881.                 if (class9_3 != null && class9_3.type == 0) {
  10882.                     if (l12 < 0) {
  10883.                         l12 = 0;
  10884.                     }
  10885.                     if (l12 > class9_3.scrollMax - class9_3.height) {
  10886.                         l12 = class9_3.scrollMax - class9_3.height;
  10887.                     }
  10888.                     class9_3.scrollPosition = l12;
  10889.                 }
  10890.                 pktType = -1;
  10891.                 return true;
  10892.             }
  10893.             if (pktType == 68) {
  10894.                 for (int k5 = 0; k5 < variousSettings.length; k5++) {
  10895.                     if (variousSettings[k5] != anIntArray1045[k5]) {
  10896.                         variousSettings[k5] = anIntArray1045[k5];
  10897.                         method33(k5);
  10898.                         needDrawTabArea = true;
  10899.                     }
  10900.                 }
  10901.  
  10902.                 pktType = -1;
  10903.                 return true;
  10904.             }
  10905.             if (pktType == 196) {
  10906.                 long l5 = inStream.readQWord();
  10907.                 @SuppressWarnings("unused")
  10908.                 int j18 = inStream.readDWord();
  10909.                 int l21 = inStream.readUnsignedByte();
  10910.                 boolean flag5 = false;
  10911.                 if (l21 <= 1) {
  10912.                     for (int l29 = 0; l29 < ignoreCount; l29++) {
  10913.                         if (ignoreListAsLongs[l29] != l5) {
  10914.                             continue;
  10915.                         }
  10916.                         flag5 = true;
  10917.  
  10918.                     }
  10919.                 }
  10920.                 if (!flag5 && anInt1251 == 0) {
  10921.                     try {
  10922.                         String s9 = TextInput.method525(pktSize - 13, inStream);
  10923.                         if (l21 == 2 || l21 == 3) {
  10924.                             pushMessage(s9, 7, "@cr2@" + TextClass.fixName(TextClass.nameForLong(l5)));
  10925.                         } else if (l21 == 1) {
  10926.                             pushMessage(s9, 7, "@cr1@" + TextClass.fixName(TextClass.nameForLong(l5)));
  10927.                         } else {
  10928.                             pushMessage(s9, 3, TextClass.fixName(TextClass.nameForLong(l5)));
  10929.                         }
  10930.                     } catch (Exception exception1) {
  10931.                         Signlink.reporterror("cde1");
  10932.                     }
  10933.                 }
  10934.                 pktType = -1;
  10935.                 return true;
  10936.             }
  10937.             if (pktType == 85) {
  10938.                 anInt1269 = inStream.method427();
  10939.                 anInt1268 = inStream.method427();
  10940.                 pktType = -1;
  10941.                 return true;
  10942.             }
  10943.             if (pktType == 24) {
  10944.                 anInt1054 = inStream.method428();
  10945.                 if (anInt1054 == tabID) {
  10946.                     if (anInt1054 == 3) {
  10947.                         tabID = 1;
  10948.                     } else {
  10949.                         tabID = 3;
  10950.                     }
  10951.                     needDrawTabArea = true;
  10952.                 }
  10953.                 pktType = -1;
  10954.                 return true;
  10955.             }
  10956.             if (pktType == 246) {
  10957.                 int i6 = inStream.method434();
  10958.                 int i13 = inStream.readUnsignedWord();
  10959.                 int k18 = inStream.readUnsignedWord();
  10960.                 if (k18 == 65535) {
  10961.                     RSInterface.interfaceCache[i6].anInt233 = 0;
  10962.                     pktType = -1;
  10963.                     return true;
  10964.                 } else {
  10965.                     ItemDef itemDef = ItemDef.forID(k18);
  10966.                     RSInterface.interfaceCache[i6].anInt233 = 4;
  10967.                     RSInterface.interfaceCache[i6].mediaID = k18;
  10968.                     RSInterface.interfaceCache[i6].anInt270 = itemDef.modelRotation1;
  10969.                     RSInterface.interfaceCache[i6].anInt271 = itemDef.modelRotation2;
  10970.                     RSInterface.interfaceCache[i6].anInt269 = itemDef.modelZoom * 100 / i13;
  10971.                     pktType = -1;
  10972.                     return true;
  10973.                 }
  10974.             }
  10975.             if (pktType == 171) {
  10976.                 boolean flag1 = inStream.readUnsignedByte() == 1;
  10977.                 int j13 = inStream.readUnsignedWord();
  10978.                 RSInterface.interfaceCache[j13].aBoolean266 = flag1;
  10979.                 pktType = -1;
  10980.                 return true;
  10981.             }
  10982.             if (pktType == 142) {
  10983.                 int j6 = inStream.method434();
  10984.                 method60(j6);
  10985.                 if (backDialogID != -1) {
  10986.                     backDialogID = -1;
  10987.                     inputTaken = true;
  10988.                 }
  10989.                 if (fullScreenBackDialogID != -1) {
  10990.                     fullScreenBackDialogID = -1;
  10991.                     welcomeScreenRaised = true;
  10992.                 }
  10993.                 if (fullScreenInterfaceId != -1) {
  10994.                     fullScreenInterfaceId = -1;
  10995.                 }
  10996.                 if (openInterfaceID != -1) {
  10997.                     openInterfaceID = -1;
  10998.                 }
  10999.                 if (invOverlayInterfaceID != j6) {
  11000.                     invOverlayInterfaceID = j6;
  11001.                 }
  11002.                 if (inputDialogState != 0) {
  11003.                     inputDialogState = 0;
  11004.                     inputTaken = true;
  11005.                 }
  11006.                 needDrawTabArea = true;
  11007.                 tabAreaAltered = true;
  11008.                 aBoolean1149 = false;
  11009.                 pktType = -1;
  11010.                 return true;
  11011.             }
  11012.             if (pktType == 126) {
  11013.                 String s1 = inStream.readString();
  11014.                 int k13 = inStream.method435();
  11015.                 RSInterface.interfaceCache[k13].disabledText = s1;
  11016.                 if (RSInterface.interfaceCache[k13].parentID == tabInterfaceIDs[tabID]) {
  11017.                     needDrawTabArea = true;
  11018.                 }
  11019.                 pktType = -1;
  11020.                 return true;
  11021.             }
  11022.             if (pktType == 206) {
  11023.                 publicChatMode = inStream.readUnsignedByte();
  11024.                 privateChatMode = inStream.readUnsignedByte();
  11025.                 tradeMode = inStream.readUnsignedByte();
  11026.                 aBoolean1233 = true;
  11027.                 inputTaken = true;
  11028.                 pktType = -1;
  11029.                 return true;
  11030.             }
  11031.             if (pktType == 240) {
  11032.                 if (tabID == 12) {
  11033.                     needDrawTabArea = true;
  11034.                 }
  11035.                 weight = inStream.readSignedWord();
  11036.                 pktType = -1;
  11037.                 return true;
  11038.             }
  11039.             if (pktType == 69) {
  11040.                 int k9 = inStream.readUnsignedWord();
  11041.                 int k15 = inStream.readUnsignedWord();
  11042.                 method60(k15);
  11043.                 if (k9 != -1)
  11044.                     method60(k9);
  11045.                 if (openInterfaceID != -1) {
  11046.                     openInterfaceID = -1;
  11047.                 }
  11048.                 if (invOverlayInterfaceID != -1) {
  11049.                     invOverlayInterfaceID = -1;
  11050.                 }
  11051.                 if (backDialogID != -1) {
  11052.                     backDialogID = -1;
  11053.                 }
  11054.                 if (fullScreenBackDialogID != k15) {
  11055.                     fullScreenBackDialogID = k15;
  11056.                 }
  11057.                 if (fullScreenInterfaceId != k15) {
  11058.                     fullScreenInterfaceId = k9;
  11059.                 }
  11060.                 inputDialogState = 0;
  11061.                 aBoolean1149 = false;
  11062.                 pktType = -1;
  11063.                 return true;
  11064.             }
  11065.             if (pktType == 8) {
  11066.                 int k6 = inStream.method436();
  11067.                 int l13 = inStream.readUnsignedWord();
  11068.                 RSInterface.interfaceCache[k6].anInt233 = 1;
  11069.                 RSInterface.interfaceCache[k6].mediaID = l13;
  11070.                 pktType = -1;
  11071.                 return true;
  11072.             }
  11073.             if (pktType == 122) {
  11074.                 int l6 = inStream.method436();
  11075.                 int i14 = inStream.method436();
  11076.                 int i19 = i14 >> 10 & 0x1f;
  11077.                 int i22 = i14 >> 5 & 0x1f;
  11078.                 int l24 = i14 & 0x1f;
  11079.                 RSInterface.interfaceCache[l6].textColor = (i19 << 19) + (i22 << 11) + (l24 << 3);
  11080.                 pktType = -1;
  11081.                 return true;
  11082.             }
  11083.             if (pktType == 53) {
  11084.                 needDrawTabArea = true;
  11085.                 int i7 = inStream.readUnsignedWord();
  11086.                 RSInterface class9_1 = RSInterface.interfaceCache[i7];
  11087.                 int j19 = inStream.readUnsignedWord();
  11088.                 for (int j22 = 0; j22 < j19; j22++) {
  11089.                     int i25 = inStream.readUnsignedByte();
  11090.                     if (i25 == 255) {
  11091.                         i25 = inStream.method440();
  11092.                     }
  11093.                     class9_1.inv[j22] = inStream.method436();
  11094.                     class9_1.invStackSizes[j22] = i25;
  11095.                 }
  11096.  
  11097.                 for (int j25 = j19; j25 < class9_1.inv.length; j25++) {
  11098.                     class9_1.inv[j25] = 0;
  11099.                     class9_1.invStackSizes[j25] = 0;
  11100.                 }
  11101.  
  11102.                 pktType = -1;
  11103.                 return true;
  11104.             }
  11105.             if (pktType == 230) {
  11106.                 int j7 = inStream.method435();
  11107.                 int j14 = inStream.readUnsignedWord();
  11108.                 int k19 = inStream.readUnsignedWord();
  11109.                 int k22 = inStream.method436();
  11110.                 RSInterface.interfaceCache[j14].anInt270 = k19;
  11111.                 RSInterface.interfaceCache[j14].anInt271 = k22;
  11112.                 RSInterface.interfaceCache[j14].anInt269 = j7;
  11113.                 pktType = -1;
  11114.                 return true;
  11115.             }
  11116.             if (pktType == 221) {
  11117.                 anInt900 = inStream.readUnsignedByte();
  11118.                 needDrawTabArea = true;
  11119.                 pktType = -1;
  11120.                 return true;
  11121.             }
  11122.             if (pktType == 177) {
  11123.                 aBoolean1160 = true;
  11124.                 anInt995 = inStream.readUnsignedByte();
  11125.                 anInt996 = inStream.readUnsignedByte();
  11126.                 anInt997 = inStream.readUnsignedWord();
  11127.                 anInt998 = inStream.readUnsignedByte();
  11128.                 anInt999 = inStream.readUnsignedByte();
  11129.                 if (anInt999 >= 100) {
  11130.                     int k7 = anInt995 * 128 + 64;
  11131.                     int k14 = anInt996 * 128 + 64;
  11132.                     int i20 = method42(plane, k14, k7) - anInt997;
  11133.                     int l22 = k7 - xCameraPos;
  11134.                     int k25 = i20 - zCameraPos;
  11135.                     int j28 = k14 - yCameraPos;
  11136.                     int i30 = (int) Math.sqrt(l22 * l22 + j28 * j28);
  11137.                     yCameraCurve = (int) (Math.atan2(k25, i30) * 325.94900000000001D) & 0x7ff;
  11138.                     xCameraCurve = (int) (Math.atan2(l22, j28) * -325.94900000000001D) & 0x7ff;
  11139.                     if (yCameraCurve < 128) {
  11140.                         yCameraCurve = 128;
  11141.                     }
  11142.                     if (yCameraCurve > 383) {
  11143.                         yCameraCurve = 383;
  11144.                     }
  11145.                 }
  11146.                 pktType = -1;
  11147.                 return true;
  11148.             }
  11149.             if (pktType == 249) {
  11150.                 anInt1046 = inStream.readUnsignedByteA();
  11151.                 unknownInt10 = inStream.method436();
  11152.                 pktType = -1;
  11153.                 return true;
  11154.             }
  11155.             if (pktType == 65) {
  11156.                 updateNPCs(inStream, pktSize);
  11157.                 pktType = -1;
  11158.                 return true;
  11159.             }
  11160.             if (pktType == 27) {
  11161.                 messagePromptRaised = false;
  11162.                 inputDialogState = 1;
  11163.                 amountOrNameInput = "";
  11164.                 inputTaken = true;
  11165.                 pktType = -1;
  11166.                 return true;
  11167.             }
  11168.             if (pktType == 187) {
  11169.                 messagePromptRaised = false;
  11170.                 inputDialogState = 2;
  11171.                 amountOrNameInput = "";
  11172.                 inputTaken = true;
  11173.                 pktType = -1;
  11174.                 return true;
  11175.             }
  11176.             if (pktType == 97) {
  11177.                 int l7 = inStream.readUnsignedWord();
  11178.                 method60(l7);
  11179.                 if (invOverlayInterfaceID != -1) {
  11180.                     invOverlayInterfaceID = -1;
  11181.                     needDrawTabArea = true;
  11182.                     tabAreaAltered = true;
  11183.                 }
  11184.                 if (backDialogID != -1) {
  11185.                     backDialogID = -1;
  11186.                     inputTaken = true;
  11187.                 }
  11188.                 if (fullScreenBackDialogID != -1) {
  11189.                     fullScreenBackDialogID = -1;
  11190.                     welcomeScreenRaised = true;
  11191.                 }
  11192.                 if (fullScreenInterfaceId != -1) {
  11193.                     fullScreenInterfaceId = -1;
  11194.                 }
  11195.                 /*if (openInterfaceID != l7) {
  11196.                     openInterfaceID = l7;
  11197.                 }*/
  11198.                 if (inputDialogState != 0) {
  11199.                     inputDialogState = 0;
  11200.                     inputTaken = true;
  11201.                 }
  11202.                 /*
  11203.                  * 15244 = main Interface ID
  11204.                  * 17511 = Question Type
  11205.                  * 15819 = Christmas Type
  11206.                  * 15812 = Security Type
  11207.                  * 15801 = Item Scam Type
  11208.                  * 15791 = Password Safety
  11209.                  * 15774 = Good/Bad Password
  11210.                  * 15767 = Drama Type
  11211.                  */
  11212.                
  11213.                 if (l7 == 15244) {
  11214.                     openInterfaceID = 15812;//secondary/bottom part
  11215.                     fullScreenBackDialogID = 15244;
  11216.                 /*} else if (l7 == 17511) {
  11217.                     openInterfaceID = 17511;
  11218.                     fullScreenBackDialogID = 15244;
  11219.                 } else if (l7 == 15819) {
  11220.                     openInterfaceID = 15819;
  11221.                     fullScreenBackDialogID = 15244;
  11222.                 } else if (l7 == 15812) {
  11223.                     openInterfaceID = 15812;
  11224.                     fullScreenBackDialogID = 15244;
  11225.                 } else if (l7 == 15801) {
  11226.                     openInterfaceID = 15801;
  11227.                     fullScreenBackDialogID = 15244;
  11228.                 } else if (l7 == 15791) {
  11229.                     openInterfaceID = 15791;
  11230.                     fullScreenBackDialogID = 15244;
  11231.                 } else if (l7 == 15774) {
  11232.                     openInterfaceID = 15774;
  11233.                     fullScreenBackDialogID = 15244;
  11234.                 } else if (l7 == 15767) {
  11235.                     openInterfaceID = 15767;
  11236.                     fullScreenBackDialogID = 15244;*/
  11237.                 } else {
  11238.                     openInterfaceID = l7;
  11239.                 }
  11240.                 aBoolean1149 = false;
  11241.                 pktType = -1;
  11242.                 return true;
  11243.             }
  11244.             if (pktType == 218) {
  11245.                 int i8 = inStream.method438();
  11246.                 dialogID = i8;
  11247.                 inputTaken = true;
  11248.                 pktType = -1;
  11249.                 return true;
  11250.             }
  11251.             if (pktType == 87) {
  11252.                 int j8 = inStream.method434();
  11253.                 int l14 = inStream.method439();
  11254.                 anIntArray1045[j8] = l14;
  11255.                 if (variousSettings[j8] != l14) {
  11256.                     variousSettings[j8] = l14;
  11257.                     method33(j8);
  11258.                     needDrawTabArea = true;
  11259.                     if (dialogID != -1) {
  11260.                         inputTaken = true;
  11261.                     }
  11262.                 }
  11263.                 pktType = -1;
  11264.                 return true;
  11265.             }
  11266.             if (pktType == 36) {
  11267.                 int k8 = inStream.method434();
  11268.                 byte byte0 = inStream.readSignedByte();
  11269.                 anIntArray1045[k8] = byte0;
  11270.                 if (variousSettings[k8] != byte0) {
  11271.                     variousSettings[k8] = byte0;
  11272.                     method33(k8);
  11273.                     needDrawTabArea = true;
  11274.                     if (dialogID != -1) {
  11275.                         inputTaken = true;
  11276.                     }
  11277.                 }
  11278.                 pktType = -1;
  11279.                 return true;
  11280.             }
  11281.             if (pktType == 61) {
  11282.                 anInt1055 = inStream.readUnsignedByte();
  11283.                 pktType = -1;
  11284.                 return true;
  11285.             }
  11286.             if (pktType == 200) {
  11287.                 int l8 = inStream.readUnsignedWord();
  11288.                 int i15 = inStream.readSignedWord();
  11289.                 RSInterface class9_4 = RSInterface.interfaceCache[l8];
  11290.                 class9_4.anInt257 = i15;
  11291.                 if (i15 == -1) {
  11292.                     class9_4.anInt246 = 0;
  11293.                     class9_4.anInt208 = 0;
  11294.                 }
  11295.                 pktType = -1;
  11296.                 return true;
  11297.             }
  11298.             if (pktType == 219) {
  11299.                 if (invOverlayInterfaceID != -1) {
  11300.                     invOverlayInterfaceID = -1;
  11301.                     needDrawTabArea = true;
  11302.                     tabAreaAltered = true;
  11303.                 }
  11304.                 if (backDialogID != -1) {
  11305.                     backDialogID = -1;
  11306.                     inputTaken = true;
  11307.                 }
  11308.                 if (fullScreenBackDialogID != -1) {
  11309.                     fullScreenBackDialogID = -1;
  11310.                     welcomeScreenRaised = true;
  11311.                 }
  11312.                 if (fullScreenInterfaceId != -1) {
  11313.                     fullScreenInterfaceId = -1;
  11314.                 }
  11315.                 if (openInterfaceID != -1) {
  11316.                     openInterfaceID = -1;
  11317.                 }
  11318.                 if (inputDialogState != 0) {
  11319.                     inputDialogState = 0;
  11320.                     inputTaken = true;
  11321.                 }
  11322.                 aBoolean1149 = false;
  11323.                 pktType = -1;
  11324.                 return true;
  11325.             }
  11326.             if (pktType == 34) {
  11327.                 needDrawTabArea = true;
  11328.                 int i9 = inStream.readUnsignedWord();
  11329.                 RSInterface class9_2 = RSInterface.interfaceCache[i9];
  11330.                 while (inStream.currentOffset < pktSize) {
  11331.                     int j20 = inStream.method422();
  11332.                     int i23 = inStream.readUnsignedWord();
  11333.                     int l25 = inStream.readUnsignedByte();
  11334.                     if (l25 == 255) {
  11335.                         l25 = inStream.readDWord();
  11336.                     }
  11337.                     if (j20 >= 0 && j20 < class9_2.inv.length) {
  11338.                         class9_2.inv[j20] = i23;
  11339.                         class9_2.invStackSizes[j20] = l25;
  11340.                     }
  11341.                 }
  11342.                 pktType = -1;
  11343.                 return true;
  11344.             }
  11345.             if (pktType == 105 || pktType == 84 || pktType == 147 || pktType == 215 || pktType == 4 || pktType == 117 || pktType == 156 || pktType == 44 || pktType == 160 || pktType == 101 || pktType == 151) {
  11346.                 method137(inStream, pktType);
  11347.                 pktType = -1;
  11348.                 return true;
  11349.             }
  11350.             if (pktType == 106) {
  11351.                 tabID = inStream.method427();
  11352.                 needDrawTabArea = true;
  11353.                 tabAreaAltered = true;
  11354.                 pktType = -1;
  11355.                 return true;
  11356.             }
  11357.             if (pktType == 164) {
  11358.                 int j9 = inStream.method434();
  11359.                 method60(j9);
  11360.                 if (invOverlayInterfaceID != -1) {
  11361.                     invOverlayInterfaceID = -1;
  11362.                     needDrawTabArea = true;
  11363.                     tabAreaAltered = true;
  11364.                 }
  11365.                 if (fullScreenBackDialogID != -1) {
  11366.                     fullScreenBackDialogID = -1;
  11367.                     welcomeScreenRaised = true;
  11368.                 }
  11369.                 if (fullScreenInterfaceId != -1) {
  11370.                     fullScreenInterfaceId = -1;
  11371.                 }
  11372.                 if (openInterfaceID != -1) {
  11373.                     openInterfaceID = -1;
  11374.                 }
  11375.                 if (backDialogID != j9) {
  11376.                     backDialogID = j9;
  11377.                 }
  11378.                 inputTaken = true;
  11379.                 aBoolean1149 = false;
  11380.                 pktType = -1;
  11381.                 return true;
  11382.             }
  11383.             String s2 = "T1 - " + pktType + "," + pktSize + " - " + anInt842 + "," + anInt843 + " - ";
  11384.             for (int j15 = 0; j15 < pktSize && j15 < 50; j15++) {
  11385.                 s2 = s2 + inStream.buffer[j15] + ",";
  11386.             }
  11387.             Signlink.reporterror(s2);
  11388.             resetLogout();
  11389.         } catch (IOException _ex) {
  11390.             dropClient();
  11391.         } catch (Exception exception) {
  11392.             String s2 = "T2 - " + pktType + "," + anInt842 + "," + anInt843 + " - " + pktSize + "," + (baseX + myPlayer.smallX[0]) + "," + (baseY + myPlayer.smallY[0]) + " - ";
  11393.             for (int j15 = 0; j15 < pktSize && j15 < 50; j15++) {
  11394.                 s2 = s2 + inStream.buffer[j15] + ",";
  11395.             }
  11396.  
  11397.             Signlink.reporterror(s2);
  11398.             resetLogout();
  11399.         }
  11400.         return true;
  11401.     }
  11402.  
  11403.     public void method146() {
  11404.         anInt1265++;
  11405.         method47(true);
  11406.         method26(true);
  11407.         method47(false);
  11408.         method26(false);
  11409.         method55();
  11410.         method104();
  11411.         if (!aBoolean1160) {
  11412.             int i = anInt1184;
  11413.             if (anInt984 / 256 > i) {
  11414.                 i = anInt984 / 256;
  11415.             }
  11416.             if (aBooleanArray876[4] && anIntArray1203[4] + 128 > i) {
  11417.                 i = anIntArray1203[4] + 128;
  11418.             }
  11419.             int k = minimapInt1 + anInt896 & 0x7ff;
  11420.             setCameraPos(600 + i * 3, i, anInt1014, method42(plane, myPlayer.y, myPlayer.x) - 50, k, anInt1015);
  11421.         }
  11422.         int j;
  11423.         if (!aBoolean1160) {
  11424.             j = method120();
  11425.         } else {
  11426.             j = method121();
  11427.         }
  11428.         int l = xCameraPos;
  11429.         int i1 = zCameraPos;
  11430.         int j1 = yCameraPos;
  11431.         int k1 = yCameraCurve;
  11432.         int l1 = xCameraCurve;
  11433.         for (int i2 = 0; i2 < 5; i2++) {
  11434.             if (aBooleanArray876[i2]) {
  11435.                 int j2 = (int) (Math.random() * (double) (anIntArray873[i2] * 2 + 1) - (double) anIntArray873[i2] + Math.sin((double) anIntArray1030[i2] * (double) anIntArray928[i2] / 100D) * (double) anIntArray1203[i2]);
  11436.                 if (i2 == 0) {
  11437.                     xCameraPos += j2;
  11438.                 }
  11439.                 if (i2 == 1) {
  11440.                     zCameraPos += j2;
  11441.                 }
  11442.                 if (i2 == 2) {
  11443.                     yCameraPos += j2;
  11444.                 }
  11445.                 if (i2 == 3) {
  11446.                     xCameraCurve = xCameraCurve + j2 & 0x7ff;
  11447.                 }
  11448.                 if (i2 == 4) {
  11449.                     yCameraCurve += j2;
  11450.                     if (yCameraCurve < 128) {
  11451.                         yCameraCurve = 128;
  11452.                     }
  11453.                     if (yCameraCurve > 383) {
  11454.                         yCameraCurve = 383;
  11455.                     }
  11456.                 }
  11457.             }
  11458.         }
  11459.  
  11460.         int k2 = Texture.anInt1481;
  11461.         Model.aBoolean1684 = true;
  11462.         Model.anInt1687 = 0;
  11463.         Model.anInt1685 = super.mouseX - 4;
  11464.         Model.anInt1686 = super.mouseY - 4;
  11465.         DrawingArea.setAllPixelsToZero();
  11466.         // xxx disables graphics if(graphicsEnabled){
  11467.         worldController.method313(xCameraPos, yCameraPos, xCameraCurve, zCameraPos, j, yCameraCurve);
  11468.         worldController.clearObj5Cache();
  11469.         updateEntities();
  11470.         drawHeadIcon();
  11471.         method37(k2);
  11472.         draw3dScreen();
  11473.         aRSImageProducer_1165.drawGraphics(4, super.graphics, 4);
  11474.         xCameraPos = l;
  11475.         zCameraPos = i1;
  11476.         yCameraPos = j1;
  11477.         yCameraCurve = k1;
  11478.         xCameraCurve = l1;
  11479.         // }
  11480.     }
  11481.  
  11482.     public void closeOpenInterfaces() {
  11483.         stream.createFrame(130);
  11484.         if (invOverlayInterfaceID != -1) {
  11485.             invOverlayInterfaceID = -1;
  11486.             needDrawTabArea = true;
  11487.             aBoolean1149 = false;
  11488.             tabAreaAltered = true;
  11489.         }
  11490.         if (backDialogID != -1) {
  11491.             backDialogID = -1;
  11492.             inputTaken = true;
  11493.             aBoolean1149 = false;
  11494.         }
  11495.         if (fullScreenBackDialogID != -1) {
  11496.             fullScreenBackDialogID = -1;
  11497.             welcomeScreenRaised = true;
  11498.         }
  11499.         if (fullScreenInterfaceId != -1) {
  11500.             fullScreenInterfaceId = -1;
  11501.         }
  11502.         if (openInterfaceID != -1)
  11503.             openInterfaceID = -1;
  11504.     }
  11505.  
  11506.     public Game() {
  11507.         server = ClientSettings.SERVER_IP;
  11508.         anIntArrayArray825 = new int[104][104];
  11509.         friendsNodeIDs = new int[200];
  11510.         groundArray = new NodeList[4][104][104];
  11511.         aBoolean831 = false;
  11512.         aStream_834 = new Stream(new byte[5000]);
  11513.         npcArray = new NPC[16384];
  11514.         npcIndices = new int[16384];
  11515.         anIntArray840 = new int[1000];
  11516.         aStream_847 = Stream.create();
  11517.         aBoolean848 = true;
  11518.         openInterfaceID = -1;
  11519.         currentExp = new int[Skills.skillsCount];
  11520.         aBoolean872 = false;
  11521.         anIntArray873 = new int[5];
  11522.         anInt874 = -1;
  11523.         aBooleanArray876 = new boolean[5];
  11524.         drawFlames = false;
  11525.         reportAbuseInput = "";
  11526.         unknownInt10 = -1;
  11527.         menuOpen = false;
  11528.         inputString = "";
  11529.         maxPlayers = 2048;
  11530.         myPlayerIndex = 2047;
  11531.         playerArray = new Player[maxPlayers];
  11532.         playerIndices = new int[maxPlayers];
  11533.         anIntArray894 = new int[maxPlayers];
  11534.         aStreamArray895s = new Stream[maxPlayers];
  11535.         anInt897 = 1;
  11536.         anIntArrayArray901 = new int[104][104];
  11537.         anInt902 = 0x766654;
  11538.         aByteArray912 = new byte[16384];
  11539.         currentStats = new int[Skills.skillsCount];
  11540.         ignoreListAsLongs = new long[100];
  11541.         loadingError = false;
  11542.         anInt927 = 0x332d25;
  11543.         anIntArray928 = new int[5];
  11544.         anIntArrayArray929 = new int[104][104];
  11545.         chatTypes = new int[100];
  11546.         chatNames = new String[100];
  11547.         chatMessages = new String[100];
  11548.         sideIcons = new Background[13];
  11549.         aBoolean954 = true;
  11550.         friendsListAsLongs = new long[200];
  11551.         currentSong = -1;
  11552.         drawingFlames = false;
  11553.         spriteDrawX = -1;
  11554.         spriteDrawY = -1;
  11555.         anIntArray968 = new int[33];
  11556.         anIntArray969 = new int[256];
  11557.         decompressors = new Decompressor[5];
  11558.         variousSettings = new int[2000];
  11559.         aBoolean972 = false;
  11560.         anInt975 = 50;
  11561.         anIntArray976 = new int[anInt975];
  11562.         anIntArray977 = new int[anInt975];
  11563.         anIntArray978 = new int[anInt975];
  11564.         anIntArray979 = new int[anInt975];
  11565.         anIntArray980 = new int[anInt975];
  11566.         anIntArray981 = new int[anInt975];
  11567.         anIntArray982 = new int[anInt975];
  11568.         aStringArray983 = new String[anInt975];
  11569.         anInt985 = -1;
  11570.         hitMarks = new Sprite[20];
  11571.         anIntArray990 = new int[5];
  11572.         anInt1002 = 0x23201b;
  11573.         amountOrNameInput = "";
  11574.         aClass19_1013 = new NodeList();
  11575.         aBoolean1017 = false;
  11576.         anInt1018 = -1;
  11577.         anIntArray1030 = new int[5];
  11578.         aBoolean1031 = false;
  11579.         mapFunctions = new Sprite[100];
  11580.         dialogID = -1;
  11581.         maxStats = new int[Skills.skillsCount];
  11582.         anIntArray1045 = new int[2000];
  11583.         aBoolean1047 = true;
  11584.         anIntArray1052 = new int[151];
  11585.         anInt1054 = -1;
  11586.         aClass19_1056 = new NodeList();
  11587.         anIntArray1057 = new int[33];
  11588.         aClass9_1059 = new RSInterface();
  11589.         mapScenes = new Background[100];
  11590.         anInt1063 = 0x4d4233;
  11591.         anIntArray1065 = new int[7];
  11592.         anIntArray1072 = new int[1000];
  11593.         anIntArray1073 = new int[1000];
  11594.         aBoolean1080 = false;
  11595.         friendsList = new String[200];
  11596.         inStream = Stream.create();
  11597.         expectedCRCs = new int[9];
  11598.         menuActionCmd2 = new int[500];
  11599.         menuActionCmd3 = new int[500];
  11600.         menuActionID = new int[500];
  11601.         menuActionCmd1 = new int[500];
  11602.         headIcons = new Sprite[20];
  11603.         headIconsHint = new Sprite[20];
  11604.         skullIcons = new Sprite[20];
  11605.         tabAreaAltered = false;
  11606.         aString1121 = "";
  11607.         atPlayerActions = new String[5];
  11608.         atPlayerArray = new boolean[5];
  11609.         anIntArrayArrayArray1129 = new int[4][13][13];
  11610.         anInt1132 = 2;
  11611.         aClass30_Sub2_Sub1_Sub1Array1140 = new Sprite[1000];
  11612.         aBoolean1141 = false;
  11613.         aBoolean1149 = false;
  11614.         crosses = new Sprite[8];
  11615.         musicEnabled = true;
  11616.         needDrawTabArea = false;
  11617.         loggedIn = false;
  11618.         canMute = false;
  11619.         aBoolean1159 = false;
  11620.         aBoolean1160 = false;
  11621.         anInt1171 = 1;
  11622.         myUsername = "";
  11623.         myPassword = "";
  11624.         genericLoadingError = false;
  11625.         reportAbuseInterfaceID = -1;
  11626.         aClass19_1179 = new NodeList();
  11627.         anInt1184 = 128;
  11628.         invOverlayInterfaceID = -1;
  11629.         stream = Stream.create();
  11630.         menuActionName = new String[500];
  11631.         anIntArray1203 = new int[5];
  11632.         sound = new int[50];
  11633.         anInt1210 = 2;
  11634.         anInt1211 = 78;
  11635.         promptInput = "";
  11636.         modIcons = new Background[2];
  11637.         tabID = 3;
  11638.         inputTaken = false;
  11639.         songChanging = true;
  11640.         anIntArray1229 = new int[151];
  11641.         aClass11Array1230 = new CollisionMap[4];
  11642.         aBoolean1233 = false;
  11643.         soundType = new int[50];
  11644.         aBoolean1242 = false;
  11645.         soundDelay = new int[50];
  11646.         soundVolume = new int[50];
  11647.         rsAlreadyLoaded = false;
  11648.         welcomeScreenRaised = false;
  11649.         messagePromptRaised = false;
  11650.         loginMessage1 = "";
  11651.         loginMessage2 = "";
  11652.         backDialogID = -1;
  11653.         anInt1279 = 2;
  11654.         bigX = new int[4000];
  11655.         bigY = new int[4000];
  11656.         anInt1289 = -1;
  11657.     }
  11658.  
  11659.     public static String server;
  11660.     public int ignoreCount;
  11661.     public long aLong824;
  11662.     public int[][] anIntArrayArray825;
  11663.     public int[] friendsNodeIDs;
  11664.     public NodeList[][][] groundArray;
  11665.     public int[] anIntArray828;
  11666.     public int[] anIntArray829;
  11667.     public volatile boolean aBoolean831;
  11668.     public Socket aSocket832;
  11669.     public int loginScreenState;
  11670.     public Stream aStream_834;
  11671.     public NPC[] npcArray;
  11672.     public int npcCount;
  11673.     public int[] npcIndices;
  11674.     public int anInt839;
  11675.     public int[] anIntArray840;
  11676.     public int anInt841;
  11677.     public int anInt842;
  11678.     public int anInt843;
  11679.     public String aString844;
  11680.     public int publicChatMode;
  11681.     public int privateChatMode;
  11682.     public Stream aStream_847;
  11683.     public boolean aBoolean848;
  11684.     public static int anInt849;
  11685.     public int[] anIntArray850;
  11686.     public int[] anIntArray851;
  11687.     public int[] anIntArray852;
  11688.     public int[] anIntArray853;
  11689.     public static int anInt854;
  11690.     public int anInt855;
  11691.     public int openInterfaceID;
  11692.     public int fullScreenBackDialogID = -1;
  11693.     public int fullScreenInterfaceId = -1;
  11694.     public int xCameraPos;
  11695.     public int zCameraPos;
  11696.     public int yCameraPos;
  11697.     public int yCameraCurve;
  11698.     public int xCameraCurve;
  11699.     public int myPrivilege;
  11700.     public final int[] currentExp;
  11701.     public static int musicId;
  11702.     public static int soundId;
  11703.     public Background redStone1_3;
  11704.     public Background redStone2_3;
  11705.     public Background redStone3_2;
  11706.     public Background redStone1_4;
  11707.     public Background redStone2_4;
  11708.     public Sprite multiOverlay;
  11709.     public Sprite mapFlag;
  11710.     public Sprite mapMarker;
  11711.     public boolean aBoolean872;
  11712.     public final int[] anIntArray873;
  11713.     public int anInt874;
  11714.     public final boolean[] aBooleanArray876;
  11715.     public int weight;
  11716.     public MouseDetection mouseDetection;
  11717.     public volatile boolean drawFlames;
  11718.     public String reportAbuseInput;
  11719.     public int unknownInt10;
  11720.     public boolean menuOpen;
  11721.     public int anInt886;
  11722.     public String inputString;
  11723.     public final int maxPlayers;
  11724.     public final int myPlayerIndex;
  11725.     public Player[] playerArray;
  11726.     public int playerCount;
  11727.     public int[] playerIndices;
  11728.     public int anInt893;
  11729.     public int[] anIntArray894;
  11730.     public Stream[] aStreamArray895s;
  11731.     public int anInt896;
  11732.     public int anInt897;
  11733.     public int friendsCount;
  11734.     public int anInt900;
  11735.     public int[][] anIntArrayArray901;
  11736.     public final int anInt902;
  11737.     public RSImageProducer backLeftIP1;
  11738.     public RSImageProducer backLeftIP2;
  11739.     public RSImageProducer backRightIP1;
  11740.     public RSImageProducer backRightIP2;
  11741.     public RSImageProducer backTopIP1;
  11742.     public RSImageProducer backVmidIP1;
  11743.     public RSImageProducer backVmidIP2;
  11744.     public RSImageProducer backVmidIP3;
  11745.     public RSImageProducer backVmidIP2_2;
  11746.     public byte[] aByteArray912;
  11747.     public int anInt913;
  11748.     public int crossX;
  11749.     public int crossY;
  11750.     public int crossIndex;
  11751.     public int crossType;
  11752.     public int plane;
  11753.     public final int[] currentStats;
  11754.     public static int anInt924;
  11755.     public final long[] ignoreListAsLongs;
  11756.     public boolean loadingError;
  11757.     public final int anInt927;
  11758.     public final int[] anIntArray928;
  11759.     public int[][] anIntArrayArray929;
  11760.     public Sprite aClass30_Sub2_Sub1_Sub1_931;
  11761.     public Sprite aClass30_Sub2_Sub1_Sub1_932;
  11762.     public int anInt933;
  11763.     public int anInt934;
  11764.     public int anInt935;
  11765.     public int anInt936;
  11766.     public int anInt937;
  11767.     public int anInt938;
  11768.     public static int anInt940;
  11769.     public final int[] chatTypes;
  11770.     public final String[] chatNames;
  11771.     public final String[] chatMessages;
  11772.     public int anInt945;
  11773.     public WorldController worldController;
  11774.     public Background[] sideIcons;
  11775.     public int menuScreenArea;
  11776.     public int menuOffsetX;
  11777.     public int menuOffsetY;
  11778.     public int menuWidth;
  11779.     public int anInt952;
  11780.     public long aLong953;
  11781.     public boolean aBoolean954;
  11782.     public long[] friendsListAsLongs;
  11783.     public int currentSong;
  11784.     public static int nodeID = 10;
  11785.     static int portOff;
  11786.     public static boolean isMembers = true;
  11787.     public static boolean lowMem;
  11788.     public volatile boolean drawingFlames;
  11789.     public int spriteDrawX;
  11790.     public int spriteDrawY;
  11791.     public final int[] anIntArray965 = {0xffff00, 0xff0000, 65280, 65535, 0xff00ff, 0xffffff};
  11792.     public Background aBackground_966;
  11793.     public Background aBackground_967;
  11794.     public final int[] anIntArray968;
  11795.     public final int[] anIntArray969;
  11796.     final Decompressor[] decompressors;
  11797.     public int variousSettings[];
  11798.     public boolean aBoolean972;
  11799.     public final int anInt975;
  11800.     public final int[] anIntArray976;
  11801.     public final int[] anIntArray977;
  11802.     public final int[] anIntArray978;
  11803.     public final int[] anIntArray979;
  11804.     public final int[] anIntArray980;
  11805.     public final int[] anIntArray981;
  11806.     public final int[] anIntArray982;
  11807.     public final String[] aStringArray983;
  11808.     public int anInt984;
  11809.     public int anInt985;
  11810.     public static int anInt986;
  11811.     public Sprite[] hitMarks;
  11812.     public int anInt988;
  11813.     public int anInt989;
  11814.     public final int[] anIntArray990;
  11815.     public static boolean aBoolean993;
  11816.     public int anInt995;
  11817.     public int anInt996;
  11818.     public int anInt997;
  11819.     public int anInt998;
  11820.     public int anInt999;
  11821.     public ISAACRandomGen encryption;
  11822.     public Sprite mapEdge;
  11823.     public final int anInt1002;
  11824.     static final int[][] anIntArrayArray1003 = {{6798, 107, 10283, 16, 4797, 7744, 5799, 4634, 33697, 22433, 2983, 54193}, {8741, 12, 64030, 43162, 7735, 8404, 1701, 38430, 24094, 10153, 56621, 4783, 1341, 16578, 35003, 25239}, {25238, 8742, 12, 64030, 43162, 7735, 8404, 1701, 38430, 24094, 10153, 56621, 4783, 1341, 16578, 35003}, {4626, 11146, 6439, 12, 4758, 10270}, {4550, 4537, 5681, 5673, 5790, 6806, 8076, 4574}};
  11825.     public String amountOrNameInput;
  11826.     public static int anInt1005;
  11827.     public int daysSinceLastLogin;
  11828.     public int pktSize;
  11829.     public int pktType;
  11830.     public int anInt1009;
  11831.     public int anInt1010;
  11832.     public int anInt1011;
  11833.     public NodeList aClass19_1013;
  11834.     public int anInt1014;
  11835.     public int anInt1015;
  11836.     public int anInt1016;
  11837.     public boolean aBoolean1017;
  11838.     public int anInt1018;
  11839.     public static final int[] anIntArray1019;
  11840.     public int anInt1021;
  11841.     public int anInt1022;
  11842.     public int loadingStage;
  11843.     public Background scrollBar1;
  11844.     public Background scrollBar2;
  11845.     public int anInt1026;
  11846.     public Background backBase1;
  11847.     public Background backBase2;
  11848.     public Background backHmid1;
  11849.     public final int[] anIntArray1030;
  11850.     public boolean aBoolean1031;
  11851.     public Sprite[] mapFunctions;
  11852.     public int baseX;
  11853.     public int baseY;
  11854.     public int anInt1036;
  11855.     public int anInt1037;
  11856.     public int loginFailures;
  11857.     public int anInt1039;
  11858.     public int anInt1040;
  11859.     public int anInt1041;
  11860.     public int dialogID;
  11861.     public final int[] maxStats;
  11862.     public final int[] anIntArray1045;
  11863.     public int anInt1046;
  11864.     public boolean aBoolean1047;
  11865.     public int anInt1048;
  11866.     public String aString1049;
  11867.     public static int anInt1051;
  11868.     public final int[] anIntArray1052;
  11869.     public StreamLoader titleStreamLoader;
  11870.     public int anInt1054;
  11871.     public int anInt1055;
  11872.     public NodeList aClass19_1056;
  11873.     public final int[] anIntArray1057;
  11874.     public final RSInterface aClass9_1059;
  11875.     public Background[] mapScenes;
  11876.     public static int anInt1061;
  11877.     public int currentSound;
  11878.     public final int anInt1063;
  11879.     public int friendsListAction;
  11880.     public final int[] anIntArray1065;
  11881.     public int mouseInvInterfaceIndex;
  11882.     public int lastActiveInvInterface;
  11883.     public OnDemandFetcher onDemandFetcher;
  11884.     public int anInt1069;
  11885.     public int anInt1070;
  11886.     public int anInt1071;
  11887.     public int[] anIntArray1072;
  11888.     public int[] anIntArray1073;
  11889.     public Sprite mapDotItem;
  11890.     public Sprite mapDotNPC;
  11891.     public Sprite mapDotPlayer;
  11892.     public Sprite mapDotFriend;
  11893.     public Sprite mapDotTeam;
  11894.     public int anInt1079;
  11895.     public boolean aBoolean1080;
  11896.     public String[] friendsList;
  11897.     public Stream inStream;
  11898.     public int anInt1084;
  11899.     public int anInt1085;
  11900.     public int activeInterfaceType;
  11901.     public int anInt1087;
  11902.     public int anInt1088;
  11903.     public int anInt1089;
  11904.     public final int[] expectedCRCs;
  11905.     public int[] menuActionCmd2;
  11906.     public int[] menuActionCmd3;
  11907.     public int[] menuActionID;
  11908.     public int[] menuActionCmd1;
  11909.     public Sprite[] headIcons;
  11910.     public Sprite[] skullIcons;
  11911.     public Sprite[] headIconsHint;
  11912.     public static int anInt1097;
  11913.     public int anInt1098;
  11914.     public int anInt1099;
  11915.     public int anInt1100;
  11916.     public int anInt1101;
  11917.     public int anInt1102;
  11918.     public static boolean tabAreaAltered;
  11919.     public int anInt1104;
  11920.     public RSImageProducer aRSImageProducer_1107;
  11921.     public RSImageProducer aRSImageProducer_1108;
  11922.     public RSImageProducer aRSImageProducer_1109;
  11923.     public RSImageProducer aRSImageProducer_1110;
  11924.     public RSImageProducer aRSImageProducer_1111;
  11925.     public RSImageProducer aRSImageProducer_1112;
  11926.     public RSImageProducer aRSImageProducer_1113;
  11927.     public RSImageProducer aRSImageProducer_1114;
  11928.     public RSImageProducer aRSImageProducer_1115;
  11929.     public static int anInt1117;
  11930.     public int membersInt;
  11931.     public String aString1121;
  11932.     public Sprite compass;
  11933.     public RSImageProducer aRSImageProducer_1123;
  11934.     public RSImageProducer aRSImageProducer_1124;
  11935.     public RSImageProducer aRSImageProducer_1125;
  11936.     public static Player myPlayer;
  11937.     public final String[] atPlayerActions;
  11938.     public final boolean[] atPlayerArray;
  11939.     public final int[][][] anIntArrayArrayArray1129;
  11940.     public final int[] tabInterfaceIDs = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1};
  11941.     public int anInt1131;
  11942.     public int anInt1132;
  11943.     public int menuActionRow;
  11944.     public static int anInt1134;
  11945.     public int spellSelected;
  11946.     public int anInt1137;
  11947.     public int spellUsableOn;
  11948.     public String spellTooltip;
  11949.     public Sprite[] aClass30_Sub2_Sub1_Sub1Array1140;
  11950.     public boolean aBoolean1141;
  11951.     public static int anInt1142;
  11952.     public Background redStone1;
  11953.     public Background redStone2;
  11954.     public Background redStone3;
  11955.     public Background redStone1_2;
  11956.     public Background redStone2_2;
  11957.     public int energy;
  11958.     public boolean aBoolean1149;
  11959.     public Sprite[] crosses;
  11960.     public boolean musicEnabled;
  11961.     public Background[] aBackgroundArray1152s;
  11962.     public static boolean needDrawTabArea;
  11963.     public int unreadMessages;
  11964.     public static int anInt1155;
  11965.     public static boolean fpsOn;
  11966.     public boolean loggedIn;
  11967.     public boolean canMute;
  11968.     public boolean aBoolean1159;
  11969.     public boolean aBoolean1160;
  11970.     static int loopCycle;
  11971.     public static final String validUserPassChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!\"\243$%^&*()-_=+[{]};:'@#~,<.>/?\\| ";
  11972.     public RSImageProducer aRSImageProducer_1163;
  11973.     public RSImageProducer aRSImageProducer_1164;
  11974.     public RSImageProducer aRSImageProducer_1165;
  11975.     public RSImageProducer aRSImageProducer_1166;
  11976.     public int daysSinceRecovChange;
  11977.     public RSSocket socketStream;
  11978.     public int minimapInt3;
  11979.     public int anInt1171;
  11980.     public static long aLong1172;
  11981.     public String myUsername;
  11982.     public String myPassword;
  11983.     public static int anInt1175;
  11984.     public boolean genericLoadingError;
  11985.     public final int[] anIntArray1177 = {0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3};
  11986.     public int reportAbuseInterfaceID;
  11987.     public NodeList aClass19_1179;
  11988.     public int[] chatAreaOffsets;
  11989.     public int[] tabAreaOffsets;
  11990.     public int[] chatBoxAreaOffsets;
  11991.     public byte[][] aByteArrayArray1183;
  11992.     public int anInt1184;
  11993.     public int minimapInt1;
  11994.     public int anInt1186;
  11995.     public int anInt1187;
  11996.     public static int anInt1188;
  11997.     public int invOverlayInterfaceID;
  11998.     public int[] anIntArray1190;
  11999.     public int[] anIntArray1191;
  12000.     public Stream stream;
  12001.     public int anInt1193;
  12002.     public int splitpublicChat;
  12003.     public Background invBack;
  12004.     public Background mapBack;
  12005.     public Background chatBack;
  12006.     public String[] menuActionName;
  12007.     public Sprite aClass30_Sub2_Sub1_Sub1_1201;
  12008.     public Sprite aClass30_Sub2_Sub1_Sub1_1202;
  12009.     public final int[] anIntArray1203;
  12010.     static final int[] anIntArray1204 = {9104, 10275, 7595, 3610, 7975, 8526, 918, 38802, 24466, 10145, 58654, 5027, 1457, 16565, 34991, 25486};
  12011.     public static boolean flagged;
  12012.     public final int[] sound;
  12013.     public int anInt1208;
  12014.     public int minimapInt2;
  12015.     public int anInt1210;
  12016.     public int anInt1211;
  12017.     public String promptInput;
  12018.     public int anInt1213;
  12019.     public int[][][] intGroundArray;
  12020.     public long aLong1215;
  12021.     public int loginScreenCursorPos;
  12022.     public final Background[] modIcons;
  12023.     public long aLong1220;
  12024.     public static int tabID;
  12025.     public int anInt1222;
  12026.     public boolean inputTaken;
  12027.     public int inputDialogState;
  12028.     public static int anInt1226;
  12029.     public int nextSong;
  12030.     public boolean songChanging;
  12031.     public final int[] anIntArray1229;
  12032.     public CollisionMap[] aClass11Array1230;
  12033.     public static int anIntArray1232[];
  12034.     public boolean aBoolean1233;
  12035.     public int[] anIntArray1234;
  12036.     public int[] anIntArray1235;
  12037.     public int[] anIntArray1236;
  12038.     public int anInt1237;
  12039.     public int anInt1238;
  12040.     public final int anInt1239 = 100;
  12041.     public final int[] soundType;
  12042.     public boolean aBoolean1242;
  12043.     public int atInventoryLoopCycle;
  12044.     public int atInventoryInterface;
  12045.     public int atInventoryIndex;
  12046.     public int atInventoryInterfaceType;
  12047.     public byte[][] aByteArrayArray1247;
  12048.     public int tradeMode;
  12049.     public int anInt1249;
  12050.     public final int[] soundDelay;
  12051.     public final int[] soundVolume;
  12052.     public int anInt1251;
  12053.     public final boolean rsAlreadyLoaded;
  12054.     public int anInt1253;
  12055.     public int anInt1254;
  12056.     public boolean welcomeScreenRaised;
  12057.     public boolean messagePromptRaised;
  12058.     public static int anInt1257;
  12059.     public byte[][][] byteGroundArray;
  12060.     public int previousSong;
  12061.     public int destX;
  12062.     public int destY;
  12063.     public Sprite aClass30_Sub2_Sub1_Sub1_1263;
  12064.     public int anInt1264;
  12065.     public int anInt1265;
  12066.     public String loginMessage1;
  12067.     public String loginMessage2;
  12068.     public int anInt1268;
  12069.     public int anInt1269;
  12070.     public TextDrawingArea aTextDrawingArea_1270;
  12071.     public TextDrawingArea aTextDrawingArea_1271;
  12072.     public TextDrawingArea chatTextDrawingArea;
  12073.     public int anInt1275;
  12074.     public int backDialogID;
  12075.     public int anInt1278;
  12076.     public int anInt1279;
  12077.     public int[] bigX;
  12078.     public int[] bigY;
  12079.     public int itemSelected;
  12080.     public int anInt1283;
  12081.     public int anInt1284;
  12082.     public int anInt1285;
  12083.     public String selectedItemName;
  12084.     public static int anInt1288;
  12085.     public int anInt1289;
  12086.     public static int tiara;
  12087.     public static int anInt1290;
  12088.     public boolean showInfo;
  12089.     public static int anInt1401 = 256;
  12090.     public static int[] anIntArray385 = new int[] { 12800, 12800, 12800, 12800, 12800, 12800,
  12091.     12800, 12800, 12800, 12800, 12800, 12800,
  12092.     12800, 12800, 12800, 12800 };
  12093.     public static int anInt720 = 0;
  12094.     public static Class56 aClass56_749;
  12095.     public static boolean fetchMusic = false;
  12096.     public static int musicVolume2;
  12097.     public static int anInt478 = -1;
  12098.     public static byte[] aByteArray347;
  12099.     public static int anInt155 = 0;
  12100.     public static int anInt2200 = 0;
  12101.     public static int anInt1478;
  12102.     public static boolean aBoolean475;
  12103.     public static int anInt116;
  12104.     public static boolean aBoolean995;
  12105.     public static int anInt139;
  12106.     public static int musicVolume = 255;
  12107.     public int[] gameScreenOffsets;
  12108.     public int anInt1170;
  12109.     public int anInt1215;
  12110.     public int anInt1083;
  12111.     public int anInt992;
  12112.     public int anInt1273;
  12113.     public int anInt1034;
  12114.  
  12115.     static {
  12116.         anIntArray1019 = new int[99];
  12117.         int i = 0;
  12118.         for (int j = 0; j < 99; j++) {
  12119.             int l = j + 1;
  12120.             int i1 = (int) ((double) l + 300D * Math.pow(2D, (double) l / 7D));
  12121.             i += i1;
  12122.             anIntArray1019[j] = i / 4;
  12123.         }
  12124.  
  12125.         anIntArray1232 = new int[32];
  12126.         i = 2;
  12127.         for (int k = 0; k < 32; k++) {
  12128.             anIntArray1232[k] = i - 1;
  12129.             i += i;
  12130.         }
  12131.  
  12132.     }
  12133. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement