Advertisement
Guest User

Game.java

a guest
May 23rd, 2019
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 360.24 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.    
  206.     public static byte[] musicData;
  207.    
  208.     static final synchronized void method49() {
  209.         if (musicIsntNull()) {
  210.             if (fetchMusic) {
  211.                 byte[] is = musicData;
  212.                 if (is != null) {
  213.                     if (anInt116 >= 0)
  214.                         method684(aBoolean995, anInt116, musicVolume2, is);
  215.                     else if (anInt139 >= 0)
  216.                         method899(anInt139, -1, aBoolean995, is, musicVolume2);
  217.                     else
  218.                         method853(musicVolume2, is, aBoolean995);
  219.                     fetchMusic = false;
  220.                 }
  221.             }
  222.             method368(0);
  223.         }
  224.     }
  225.    
  226.     static final int method1004(int i) {
  227.         return (int) (Math.log((double) i * 0.00390625) * 868.5889638065036 + 0.5);
  228.     }
  229.    
  230.     static final void method853(int i_2_, byte[] is, boolean bool) {
  231.         if (aClass56_749 != null) {
  232.             if (anInt478 >= 0) {
  233.                 aClass56_749.method833();
  234.                 anInt478 = -1;
  235.                 aByteArray347 = null;
  236.                 anInt720 = 20;
  237.                 anInt155 = 0;
  238.             }
  239.             if (is != null) {
  240.                 if (anInt720 > 0) {
  241.                     aClass56_749.method831(i_2_);
  242.                     anInt720 = 0;
  243.                 }
  244.                 anInt478 = i_2_;
  245.                 aClass56_749.method827(i_2_, is, 0, bool);
  246.             }
  247.         }
  248.     }
  249.    
  250.     static final void method899(int i, int i_29_, boolean bool, byte[] is, int i_30_) {
  251.         if (aClass56_749 != null) {
  252.             if (i_29_ >= (anInt478 ^ 0xffffffff)) {
  253.                 i -= 20;
  254.                 if (i < 1)
  255.                     i = 1;
  256.                 anInt720 = i;
  257.                 if (anInt478 == 0)
  258.                     anInt2200 = 0;
  259.                 else {
  260.                     int i_31_ = method1004(anInt478);
  261.                     i_31_ -= anInt155;
  262.                     anInt2200 = ((anInt2200 - 1 + (i_31_ + 3600)) / anInt2200);
  263.                 }
  264.                 aBoolean475 = bool;
  265.                 aByteArray347 = is;
  266.                 anInt1478 = i_30_;
  267.             } else if (anInt720 != 0) {
  268.                 aBoolean475 = bool;
  269.                 aByteArray347 = is;
  270.                 anInt1478 = i_30_;
  271.             } else
  272.                 method853(i_30_, is, bool);
  273.         }
  274.     }
  275.    
  276.     static final void method684(boolean bool, int i, int i_2_, byte[] is) {
  277.         if (aClass56_749 != null) {
  278.             if (anInt478 >= 0) {
  279.                 anInt2200 = i;
  280.                 if (anInt478 != 0) {
  281.                     int i_4_ = method1004(anInt478);
  282.                     i_4_ -= anInt155;
  283.                     anInt720 = (i_4_ + 3600) / i;
  284.                     if (anInt720 < 1)
  285.                         anInt720 = 1;
  286.                 } else
  287.                     anInt720 = 1;
  288.                 aByteArray347 = is;
  289.                 anInt1478 = i_2_;
  290.                 aBoolean475 = bool;
  291.             } else if (anInt720 == 0)
  292.                 method853(i_2_, is, bool);
  293.             else {
  294.                 anInt1478 = i_2_;
  295.                 aBoolean475 = bool;
  296.                 aByteArray347 = is;
  297.             }
  298.         }
  299.     }
  300.    
  301.     static final void method368(int i) {
  302.         if (aClass56_749 != null) {
  303.             if (anInt478 < i) {
  304.                 if (anInt720 > 0) {
  305.                     anInt720--;
  306.                     if (anInt720 == 0) {
  307.                         if (aByteArray347 == null)
  308.                             aClass56_749.method831(256);
  309.                         else {
  310.                             aClass56_749.method831(anInt1478);
  311.                             anInt478 = anInt1478;
  312.                             aClass56_749.method827(anInt1478, aByteArray347, 0, aBoolean475);
  313.                             aByteArray347 = null;
  314.                         }
  315.                         anInt155 = 0;
  316.                     }
  317.                 }
  318.             } else if (anInt720 > 0) {
  319.                 anInt155 += anInt2200;
  320.                 aClass56_749.method830(anInt478, anInt155);
  321.                 anInt720--;
  322.                 if (anInt720 == 0) {
  323.                     aClass56_749.method833();
  324.                     anInt720 = 20;
  325.                     anInt478 = -1;
  326.                 }
  327.             }
  328.             aClass56_749.method832(i - 122);
  329.         }
  330.     }
  331.  
  332.     private void stopMidi() {
  333.         if (Signlink.music != null) {
  334.             if (Signlink.music.isRunning()) {
  335.                 Signlink.fadeOut();
  336.                 Signlink.music.stop();
  337.                 Signlink.midi = "stop";
  338.             }
  339.         }
  340.     }
  341.  
  342.     public boolean menuHasAddFriend(int j) {
  343.         if (j < 0) {
  344.             return false;
  345.         }
  346.         int k = menuActionID[j];
  347.         if (k >= 2000) {
  348.             k -= 2000;
  349.         }
  350.         return k == 337;
  351.     }
  352.  
  353.     public void drawChatArea() {
  354.         aRSImageProducer_1166.initDrawingArea();
  355.         Texture.lineOffsets = chatAreaOffsets;
  356.         chatBack.method361(0, 0);
  357.         if (messagePromptRaised) {
  358.             chatTextDrawingArea.drawText(0, aString1121, 40, 239);
  359.             chatTextDrawingArea.drawText(128, promptInput + "*", 60, 239);
  360.         } else if (inputDialogState == 1) {
  361.             chatTextDrawingArea.drawText(0, "Enter amount:", 40, 239);
  362.             chatTextDrawingArea.drawText(128, amountOrNameInput + "*", 60, 239);
  363.         } else if (inputDialogState == 2) {
  364.             chatTextDrawingArea.drawText(0, "Enter name:", 40, 239);
  365.             chatTextDrawingArea.drawText(128, amountOrNameInput + "*", 60, 239);
  366.         } else if (aString844 != null) {
  367.             chatTextDrawingArea.drawText(0, aString844, 40, 239);
  368.             chatTextDrawingArea.drawText(128, "Click to continue", 60, 239);
  369.         } else if (backDialogID != -1) {
  370.             drawInterface(0, 0, RSInterface.interfaceCache[backDialogID], 0);//CHANGED THIS - andrew was 0, 0
  371.         } else if (dialogID != -1) {
  372.             drawInterface(0, 0, RSInterface.interfaceCache[dialogID], 0);//CHANGED THIS - andrew was 0, 0
  373.         } else {
  374.             TextDrawingArea textDrawingArea = aTextDrawingArea_1271;
  375.             int j = 0;
  376.             DrawingArea.setDrawingArea(77, 0, 463, 0);
  377.             for (int k = 0; k < 100; k++) {
  378.                 if (chatMessages[k] != null) {
  379.                     int l = chatTypes[k];
  380.                     int i1 = 70 - j * 14 + anInt1089;
  381.                     String s1 = chatNames[k];
  382.                     byte byte0 = 0;
  383.                     if (s1 != null && s1.startsWith("@cr1@")) {
  384.                         s1 = s1.substring(5);
  385.                         byte0 = 1;
  386.                     }
  387.                     if (s1 != null && s1.startsWith("@cr2@")) {
  388.                         s1 = s1.substring(5);
  389.                         byte0 = 2;
  390.                     }
  391.                     if (l == 0) {
  392.                         if (i1 > 0 && i1 < 110) {
  393.                             textDrawingArea.method389(false, 4, 0, chatMessages[k], i1);
  394.                         }
  395.                         j++;
  396.                     }
  397.                     if ((l == 1 || l == 2) && (l == 1 || publicChatMode == 0 || publicChatMode == 1 && isFriendOrSelf(s1))) {
  398.                         if (i1 > 0 && i1 < 110) {
  399.                             int j1 = 4;
  400.                             if (byte0 == 1) {
  401.                                 modIcons[0].method361(j1, i1 - 12);
  402.                                 j1 += 14;
  403.                             }
  404.                             if (byte0 == 2) {
  405.                                 modIcons[1].method361(j1, i1 - 12);
  406.                                 j1 += 14;
  407.                             }
  408.                             textDrawingArea.method385(0, s1 + ":", i1, j1);
  409.                             j1 += textDrawingArea.getTextWidth(s1) + 8;
  410.                             textDrawingArea.method385(255, chatMessages[k], i1, j1);
  411.                         }
  412.                         j++;
  413.                     }
  414.                     if ((l == 3 || l == 7) && splitpublicChat == 0 && (l == 7 || privateChatMode == 0 || privateChatMode == 1 && isFriendOrSelf(s1))) {
  415.                         if (i1 > 0 && i1 < 110) {
  416.                             int k1 = 4;
  417.                             textDrawingArea.method385(0, "From", i1, k1);
  418.                             k1 += textDrawingArea.getTextWidth("From ");
  419.                             if (byte0 == 1) {
  420.                                 modIcons[0].method361(k1, i1 - 12);
  421.                                 k1 += 14;
  422.                             }
  423.                             if (byte0 == 2) {
  424.                                 modIcons[1].method361(k1, i1 - 12);
  425.                                 k1 += 14;
  426.                             }
  427.                             textDrawingArea.method385(0, s1 + ":", i1, k1);
  428.                             k1 += textDrawingArea.getTextWidth(s1) + 8;
  429.                             textDrawingArea.method385(0x800000, chatMessages[k], i1, k1);
  430.                         }
  431.                         j++;
  432.                     }
  433.                     if (l == 4 && (tradeMode == 0 || tradeMode == 1 && isFriendOrSelf(s1))) {
  434.                         if (i1 > 0 && i1 < 110) {
  435.                             textDrawingArea.method385(0x800080, s1 + " " + chatMessages[k], i1, 4);
  436.                         }
  437.                         j++;
  438.                     }
  439.                     if (l == 5 && splitpublicChat == 0 && privateChatMode < 2) {
  440.                         if (i1 > 0 && i1 < 110) {
  441.                             textDrawingArea.method385(0x800000, chatMessages[k], i1, 4);
  442.                         }
  443.                         j++;
  444.                     }
  445.                     if (l == 6 && splitpublicChat == 0 && privateChatMode < 2) {
  446.                         if (i1 > 0 && i1 < 110) {
  447.                             textDrawingArea.method385(0, "To " + s1 + ":", i1, 4);
  448.                             textDrawingArea.method385(0x800000, chatMessages[k], i1, 12 + textDrawingArea.getTextWidth("To " + s1));
  449.                         }
  450.                         j++;
  451.                     }
  452.                     if (l == 8 && (tradeMode == 0 || tradeMode == 1 && isFriendOrSelf(s1))) {
  453.                         if (i1 > 0 && i1 < 110) {
  454.                             textDrawingArea.method385(0x7e3200, s1 + " " + chatMessages[k], i1, 4);
  455.                         }
  456.                         j++;
  457.                     }
  458.                 }
  459.             }
  460.  
  461.             DrawingArea.defaultDrawingAreaSize();
  462.             anInt1211 = j * 14 + 7;
  463.             if (anInt1211 < 78) {
  464.                 anInt1211 = 78;
  465.             }
  466.             method30(77, anInt1211 - anInt1089 - 77, 0, 463, anInt1211);
  467.             String s;
  468.             if (myPlayer != null && myPlayer.name != null) {
  469.                 s = myPlayer.name;
  470.             } else {
  471.                 s = TextClass.fixName(myUsername);
  472.             }
  473.             textDrawingArea.method385(0, s + ":", 90, 4);
  474.             textDrawingArea.method385(255, inputString + "*", 90, 6 + textDrawingArea.getTextWidth(s + ": "));
  475.             DrawingArea.method339(77, 0, 479, 0);
  476.         }
  477.         if (menuOpen && menuScreenArea == 2) {
  478.             drawMenu();
  479.         }
  480.         aRSImageProducer_1166.drawGraphics(357, super.graphics, 17);
  481.         aRSImageProducer_1165.initDrawingArea();
  482.         Texture.lineOffsets = chatBoxAreaOffsets;
  483.     }
  484.  
  485.     public void init() {
  486.         try {
  487.             nodeID = 10;
  488.             portOff = 0;
  489.             setHighMem();
  490.             isMembers = true;
  491.             Signlink.storeid = 32;
  492.             Signlink.startpriv(InetAddress.getLocalHost());
  493.             initClientFrame(503, 765);
  494.         } catch (Exception exception) {
  495.             return;
  496.         }
  497.     }
  498.  
  499.     public void startRunnable(Runnable runnable, int i) {
  500.         if (i > 10) {
  501.             i = 10;
  502.         }
  503.         if (Signlink.mainapp != null) {
  504.             Signlink.startthread(runnable, i);
  505.         } else {
  506.             super.startRunnable(runnable, i);
  507.         }
  508.     }
  509.  
  510.     public Socket openSocket(int i) throws IOException {
  511.         if (Signlink.mainapp != null) {
  512.             return Signlink.opensocket(i);
  513.         } else {
  514.             return new Socket(InetAddress.getByName(getCodeBase().getHost()), i);
  515.         }
  516.     }
  517.  
  518.     public void processMenuClick() {
  519.         if (activeInterfaceType != 0) {
  520.             return;
  521.         }
  522.         int j = super.clickMode3;
  523.         if (spellSelected == 1 && super.saveClickX >= 516 && super.saveClickY >= 160 && super.saveClickX <= 765 && super.saveClickY <= 205) {
  524.             j = 0;
  525.         }
  526.         if (menuOpen) {
  527.             if (j != 1) {
  528.                 int k = super.mouseX;
  529.                 int j1 = super.mouseY;
  530.                 if (menuScreenArea == 0) {
  531.                     k -= 4;
  532.                     j1 -= 4;
  533.                 }
  534.                 if (menuScreenArea == 1) {
  535.                     k -= 553;
  536.                     j1 -= 205;
  537.                 }
  538.                 if (menuScreenArea == 2) {
  539.                     k -= 17;
  540.                     j1 -= 357;
  541.                 }
  542.                 if (k < menuOffsetX - 10 || k > menuOffsetX + menuWidth + 10 || j1 < menuOffsetY - 10 || j1 > menuOffsetY + anInt952 + 10) {
  543.                     menuOpen = false;
  544.                     if (menuScreenArea == 1) {
  545.                         needDrawTabArea = true;
  546.                     }
  547.                     if (menuScreenArea == 2) {
  548.                         inputTaken = true;
  549.                     }
  550.                 }
  551.             }
  552.             if (j == 1) {
  553.                 int l = menuOffsetX;
  554.                 int k1 = menuOffsetY;
  555.                 int i2 = menuWidth;
  556.                 int k2 = super.saveClickX;
  557.                 int l2 = super.saveClickY;
  558.                 if (menuScreenArea == 0) {
  559.                     k2 -= 4;
  560.                     l2 -= 4;
  561.                 }
  562.                 if (menuScreenArea == 1) {
  563.                     k2 -= 553;
  564.                     l2 -= 205;
  565.                 }
  566.                 if (menuScreenArea == 2) {
  567.                     k2 -= 17;
  568.                     l2 -= 357;
  569.                 }
  570.                 int i3 = -1;
  571.                 for (int j3 = 0; j3 < menuActionRow; j3++) {
  572.                     int k3 = k1 + 31 + (menuActionRow - 1 - j3) * 15;
  573.                     if (k2 > l && k2 < l + i2 && l2 > k3 - 13 && l2 < k3 + 3) {
  574.                         i3 = j3;
  575.                     }
  576.                 }
  577.  
  578.                 if (i3 != -1) {
  579.                     doAction(i3);
  580.                 }
  581.                 menuOpen = false;
  582.                 if (menuScreenArea == 1) {
  583.                     needDrawTabArea = true;
  584.                 }
  585.                 if (menuScreenArea == 2) {
  586.                     inputTaken = true;
  587.                 }
  588.             }
  589.         } else {
  590.             if (j == 1 && menuActionRow > 0) {
  591.                 int i1 = menuActionID[menuActionRow - 1];
  592.                 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) {
  593.                     int l1 = menuActionCmd2[menuActionRow - 1];
  594.                     int j2 = menuActionCmd3[menuActionRow - 1];
  595.                     RSInterface class9 = RSInterface.interfaceCache[j2];
  596.                     if (class9.aBoolean259 || class9.aBoolean235) {
  597.                         aBoolean1242 = false;
  598.                         anInt989 = 0;
  599.                         anInt1084 = j2;
  600.                         anInt1085 = l1;
  601.                         activeInterfaceType = 2;
  602.                         anInt1087 = super.saveClickX;
  603.                         anInt1088 = super.saveClickY;
  604.                         if (RSInterface.interfaceCache[j2].parentID == openInterfaceID) {
  605.                             activeInterfaceType = 1;
  606.                         }
  607.                         if (RSInterface.interfaceCache[j2].parentID == backDialogID) {
  608.                             activeInterfaceType = 3;
  609.                         }
  610.                         return;
  611.                     }
  612.                 }
  613.             }
  614.             if (j == 1 && (anInt1253 == 1 || menuHasAddFriend(menuActionRow - 1)) && menuActionRow > 2) {
  615.                 j = 2;
  616.             }
  617.             if (j == 1 && menuActionRow > 0) {
  618.                 doAction(menuActionRow - 1);
  619.             }
  620.             if (j == 2 && menuActionRow > 0) {
  621.                 determineMenuSize();
  622.             }
  623.         }
  624.     }
  625.  
  626.     public void saveMidi(boolean flag, byte abyte0[]) {
  627.         Signlink.midifade = flag ? 1 : 0;
  628.         Signlink.saveMidi(abyte0, abyte0.length);
  629.     }
  630.  
  631.     public void method22() {
  632.         try {
  633.             anInt985 = -1;
  634.             aClass19_1056.removeAll();
  635.             aClass19_1013.removeAll();
  636.             Texture.method366();
  637.             unlinkMRUNodes();
  638.             worldController.initToNull();
  639.             System.gc();
  640.             for (int i = 0; i < 4; i++) {
  641.                 aClass11Array1230[i].method210();
  642.             }
  643.  
  644.             for (int l = 0; l < 4; l++) {
  645.                 for (int k1 = 0; k1 < 104; k1++) {
  646.                     for (int j2 = 0; j2 < 104; j2++) {
  647.                         byteGroundArray[l][k1][j2] = 0;
  648.                     }
  649.  
  650.                 }
  651.  
  652.             }
  653.  
  654.             ObjectManager objectManager = new ObjectManager(byteGroundArray, intGroundArray);
  655.             int k2 = aByteArrayArray1183.length;
  656.             stream.createFrame(0);
  657.             if (!aBoolean1159) {
  658.                 for (int i3 = 0; i3 < k2; i3++) {
  659.                     int i4 = (anIntArray1234[i3] >> 8) * 64 - baseX;
  660.                     int k5 = (anIntArray1234[i3] & 0xff) * 64 - baseY;
  661.                     byte abyte0[] = aByteArrayArray1183[i3];
  662.                     if (abyte0 != null) {
  663.                         objectManager.method180(abyte0, k5, i4, (anInt1069 - 6) * 8, (anInt1070 - 6) * 8, aClass11Array1230);
  664.                     }
  665.                 }
  666.  
  667.                 for (int j4 = 0; j4 < k2; j4++) {
  668.                     int l5 = (anIntArray1234[j4] >> 8) * 64 - baseX;
  669.                     int k7 = (anIntArray1234[j4] & 0xff) * 64 - baseY;
  670.                     byte abyte2[] = aByteArrayArray1183[j4];
  671.                     if (abyte2 == null && anInt1070 < 800) {
  672.                         objectManager.method174(k7, 64, 64, l5);
  673.                     }
  674.                 }
  675.  
  676.                 anInt1097++;
  677.                 if (anInt1097 > 160) {
  678.                     anInt1097 = 0;
  679.                     stream.createFrame(238);
  680.                     stream.writeWordBigEndian(96);
  681.                 }
  682.                 stream.createFrame(0);
  683.                 for (int i6 = 0; i6 < k2; i6++) {
  684.                     byte abyte1[] = aByteArrayArray1247[i6];
  685.                     if (abyte1 != null) {
  686.                         int l8 = (anIntArray1234[i6] >> 8) * 64 - baseX;
  687.                         int k9 = (anIntArray1234[i6] & 0xff) * 64 - baseY;
  688.                         objectManager.method190(l8, aClass11Array1230, k9, worldController, abyte1);
  689.                     }
  690.                 }
  691.  
  692.             }
  693.             if (aBoolean1159) {
  694.                 for (int j3 = 0; j3 < 4; j3++) {
  695.                     for (int k4 = 0; k4 < 13; k4++) {
  696.                         for (int j6 = 0; j6 < 13; j6++) {
  697.                             int l7 = anIntArrayArrayArray1129[j3][k4][j6];
  698.                             if (l7 != -1) {
  699.                                 int i9 = l7 >> 24 & 3;
  700.                                 int l9 = l7 >> 1 & 3;
  701.                                 int j10 = l7 >> 14 & 0x3ff;
  702.                                 int l10 = l7 >> 3 & 0x7ff;
  703.                                 int j11 = (j10 / 8 << 8) + l10 / 8;
  704.                                 for (int l11 = 0; l11 < anIntArray1234.length; l11++) {
  705.                                     if (anIntArray1234[l11] != j11 || aByteArrayArray1183[l11] == null) {
  706.                                         continue;
  707.                                     }
  708.                                     objectManager.method179(i9, l9, aClass11Array1230, k4 * 8, (j10 & 7) * 8, aByteArrayArray1183[l11], (l10 & 7) * 8, j3, j6 * 8);
  709.                                     break;
  710.                                 }
  711.  
  712.                             }
  713.                         }
  714.  
  715.                     }
  716.  
  717.                 }
  718.  
  719.                 for (int l4 = 0; l4 < 13; l4++) {
  720.                     for (int k6 = 0; k6 < 13; k6++) {
  721.                         int i8 = anIntArrayArrayArray1129[0][l4][k6];
  722.                         if (i8 == -1) {
  723.                             objectManager.method174(k6 * 8, 8, 8, l4 * 8);
  724.                         }
  725.                     }
  726.  
  727.                 }
  728.  
  729.                 stream.createFrame(0);
  730.                 for (int l6 = 0; l6 < 4; l6++) {
  731.                     for (int j8 = 0; j8 < 13; j8++) {
  732.                         for (int j9 = 0; j9 < 13; j9++) {
  733.                             int i10 = anIntArrayArrayArray1129[l6][j8][j9];
  734.                             if (i10 != -1) {
  735.                                 int k10 = i10 >> 24 & 3;
  736.                                 int i11 = i10 >> 1 & 3;
  737.                                 int k11 = i10 >> 14 & 0x3ff;
  738.                                 int i12 = i10 >> 3 & 0x7ff;
  739.                                 int j12 = (k11 / 8 << 8) + i12 / 8;
  740.                                 for (int k12 = 0; k12 < anIntArray1234.length; k12++) {
  741.                                     if (anIntArray1234[k12] != j12 || aByteArrayArray1247[k12] == null) {
  742.                                         continue;
  743.                                     }
  744.                                     objectManager.method183(aClass11Array1230, worldController, k10, j8 * 8, (i12 & 7) * 8, l6, aByteArrayArray1247[k12], (k11 & 7) * 8, i11, j9 * 8);
  745.                                     break;
  746.                                 }
  747.  
  748.                             }
  749.                         }
  750.  
  751.                     }
  752.  
  753.                 }
  754.  
  755.             }
  756.             stream.createFrame(0);
  757.             objectManager.method171(aClass11Array1230, worldController);
  758.             if(aRSImageProducer_1165 != null) {
  759.                 aRSImageProducer_1165.initDrawingArea();
  760.                 Texture.lineOffsets = chatBoxAreaOffsets;
  761.             }
  762.             stream.createFrame(0);
  763.             int k3 = ObjectManager.anInt145;
  764.             if (k3 > plane) {
  765.                 k3 = plane;
  766.             }
  767.             if (k3 < plane - 1) {
  768.                 k3 = plane - 1;
  769.             }
  770.             if (lowMem) {
  771.                 worldController.method275(ObjectManager.anInt145);
  772.             } else {
  773.                 worldController.method275(0);
  774.             }
  775.             for (int i5 = 0; i5 < 104; i5++) {
  776.                 for (int i7 = 0; i7 < 104; i7++) {
  777.                     spawnGroundItem(i5, i7);
  778.                 }
  779.  
  780.             }
  781.  
  782.             anInt1051++;
  783.             if (anInt1051 > 98) {
  784.                 anInt1051 = 0;
  785.                 stream.createFrame(150);
  786.             }
  787.             method63();
  788.         } catch (Exception exception) {
  789.         }
  790.         ObjectDef.mruNodes1.unlinkAll();
  791.         if (super.gameFrame != null) {
  792.             stream.createFrame(210);
  793.             stream.writeDWord(0x3f008edd);
  794.         }
  795.         if (lowMem && Signlink.cache_dat != null) {
  796.             int j = onDemandFetcher.getVersionCount(0);
  797.             for (int i1 = 0; i1 < j; i1++) {
  798.                 int l1 = onDemandFetcher.getModelIndex(i1);
  799.                 if ((l1 & 0x79) == 0) {
  800.                     Model.method461(i1);
  801.                 }
  802.             }
  803.  
  804.         }
  805.         System.gc();
  806.         Texture.method367();
  807.         onDemandFetcher.method566();
  808.         int k = (anInt1069 - 6) / 8 - 1;
  809.         int j1 = (anInt1069 + 6) / 8 + 1;
  810.         int i2 = (anInt1070 - 6) / 8 - 1;
  811.         int l2 = (anInt1070 + 6) / 8 + 1;
  812.         if (aBoolean1141) {
  813.             k = 49;
  814.             j1 = 50;
  815.             i2 = 49;
  816.             l2 = 50;
  817.         }
  818.         for (int l3 = k; l3 <= j1; l3++) {
  819.             for (int j5 = i2; j5 <= l2; j5++) {
  820.                 if (l3 == k || l3 == j1 || j5 == i2 || j5 == l2) {
  821.                     int j7 = onDemandFetcher.method562(0, j5, l3);
  822.                     if (j7 != -1) {
  823.                         onDemandFetcher.method560(j7, 3);
  824.                     }
  825.                     int k8 = onDemandFetcher.method562(1, j5, l3);
  826.                     if (k8 != -1) {
  827.                         onDemandFetcher.method560(k8, 3);
  828.                     }
  829.                 }
  830.             }
  831.  
  832.         }
  833.  
  834.     }
  835.  
  836.     public void unlinkMRUNodes() {
  837.         ObjectDef.mruNodes1.unlinkAll();
  838.         ObjectDef.mruNodes2.unlinkAll();
  839.         EntityDef.mruNodes.unlinkAll();
  840.         ItemDef.mruNodes2.unlinkAll();
  841.         ItemDef.mruNodes1.unlinkAll();
  842.         Player.mruNodes.unlinkAll();
  843.         SpotAnim.aMRUNodes_415.unlinkAll();
  844.     }
  845.  
  846.     public void method24(int i) {
  847.         int ai[] = aClass30_Sub2_Sub1_Sub1_1263.pixels;
  848.         int j = ai.length;
  849.         for (int k = 0; k < j; k++) {
  850.             ai[k] = 0;
  851.         }
  852.  
  853.         for (int l = 1; l < 103; l++) {
  854.             int i1 = 24628 + (103 - l) * 512 * 4;
  855.             for (int k1 = 1; k1 < 103; k1++) {
  856.                 if ((byteGroundArray[i][k1][l] & 0x18) == 0) {
  857.                     worldController.method309(ai, i1, i, k1, l);
  858.                 }
  859.                 if (i < 3 && (byteGroundArray[i + 1][k1][l] & 8) != 0) {
  860.                     worldController.method309(ai, i1, i + 1, k1, l);
  861.                 }
  862.                 i1 += 4;
  863.             }
  864.  
  865.         }
  866.  
  867.         int j1 = (238 + (int) (Math.random() * 20D) - 10 << 16) + (238 + (int) (Math.random() * 20D) - 10 << 8) + 238 + (int) (Math.random() * 20D) - 10;
  868.         int l1 = 238 + (int) (Math.random() * 20D) - 10 << 16;
  869.         aClass30_Sub2_Sub1_Sub1_1263.method343();
  870.         for (int i2 = 1; i2 < 103; i2++) {
  871.             for (int j2 = 1; j2 < 103; j2++) {
  872.                 if ((byteGroundArray[i][j2][i2] & 0x18) == 0) {
  873.                     method50(i2, j1, j2, l1, i);
  874.                 }
  875.                 if (i < 3 && (byteGroundArray[i + 1][j2][i2] & 8) != 0) {
  876.                     method50(i2, j1, j2, l1, i + 1);
  877.                 }
  878.             }
  879.  
  880.         }
  881.         if(aRSImageProducer_1165 != null) {
  882.             aRSImageProducer_1165.initDrawingArea();
  883.             Texture.lineOffsets = chatBoxAreaOffsets;
  884.         }
  885.         anInt1071 = 0;
  886.         for (int k2 = 0; k2 < 104; k2++) {
  887.             for (int l2 = 0; l2 < 104; l2++) {
  888.                 int i3 = worldController.method303(plane, k2, l2);
  889.                 if (i3 != 0) {
  890.                     i3 = i3 >> 14 & 0x7fff;
  891.                     int j3 = ObjectDef.forID(i3).anInt746;
  892.                     if (j3 >= 0) {
  893.                         int k3 = k2;
  894.                         int l3 = l2;
  895.                         if (j3 != 22 && j3 != 29 && j3 != 34 && j3 != 36 && j3 != 46 && j3 != 47 && j3 != 48) {
  896.                             byte byte0 = 104;
  897.                             byte byte1 = 104;
  898.                             int ai1[][] = aClass11Array1230[plane].anIntArrayArray294;
  899.                             for (int i4 = 0; i4 < 10; i4++) {
  900.                                 int j4 = (int) (Math.random() * 4D);
  901.                                 if (j4 == 0 && k3 > 0 && k3 > k2 - 3 && (ai1[k3 - 1][l3] & 0x1280108) == 0) {
  902.                                     k3--;
  903.                                 }
  904.                                 if (j4 == 1 && k3 < byte0 - 1 && k3 < k2 + 3 && (ai1[k3 + 1][l3] & 0x1280180) == 0) {
  905.                                     k3++;
  906.                                 }
  907.                                 if (j4 == 2 && l3 > 0 && l3 > l2 - 3 && (ai1[k3][l3 - 1] & 0x1280102) == 0) {
  908.                                     l3--;
  909.                                 }
  910.                                 if (j4 == 3 && l3 < byte1 - 1 && l3 < l2 + 3 && (ai1[k3][l3 + 1] & 0x1280120) == 0) {
  911.                                     l3++;
  912.                                 }
  913.                             }
  914.  
  915.                         }
  916.                         aClass30_Sub2_Sub1_Sub1Array1140[anInt1071] = mapFunctions[j3];
  917.                         anIntArray1072[anInt1071] = k3;
  918.                         anIntArray1073[anInt1071] = l3;
  919.                         anInt1071++;
  920.                     }
  921.                 }
  922.             }
  923.  
  924.         }
  925.  
  926.     }
  927.  
  928.     public void spawnGroundItem(int i, int j) {
  929.         NodeList class19 = groundArray[plane][i][j];
  930.         if (class19 == null) {
  931.             worldController.method295(plane, i, j);
  932.             return;
  933.         }
  934.         int k = 0xfa0a1f01;
  935.         Object obj = null;
  936.         for (Item item = (Item) class19.reverseGetFirst(); item != null; item = (Item) class19.reverseGetNext()) {
  937.             ItemDef itemDef = ItemDef.forID(item.ID);
  938.             int l = itemDef.value;
  939.             if (itemDef.stackable) {
  940.                 l *= item.anInt1559 + 1;
  941.                 // notifyItemSpawn(item, i + baseX, j + baseY);
  942.             }
  943.  
  944.             if (l > k) {
  945.                 k = l;
  946.                 obj = item;
  947.             }
  948.         }
  949.  
  950.         class19.insertTail(((Node) obj));
  951.         Object obj1 = null;
  952.         Object obj2 = null;
  953.         for (Item class30_sub2_sub4_sub2_1 = (Item) class19.reverseGetFirst(); class30_sub2_sub4_sub2_1 != null; class30_sub2_sub4_sub2_1 = (Item) class19.reverseGetNext()) {
  954.             if (class30_sub2_sub4_sub2_1.ID != ((Item) obj).ID && obj1 == null) {
  955.                 obj1 = class30_sub2_sub4_sub2_1;
  956.             }
  957.             if (class30_sub2_sub4_sub2_1.ID != ((Item) obj).ID && class30_sub2_sub4_sub2_1.ID != ((Item) obj1).ID && obj2 == null) {
  958.                 obj2 = class30_sub2_sub4_sub2_1;
  959.             }
  960.         }
  961.  
  962.         int i1 = i + (j << 7) + 0x60000000;
  963.         worldController.method281(i, i1, ((Animable) obj1), method42(plane, j * 128 + 64, i * 128 + 64), ((Animable) obj2), ((Animable) obj), plane, j);
  964.     }
  965.  
  966.     public void method26(boolean flag) {
  967.         for (int j = 0; j < npcCount; j++) {
  968.             NPC npc = npcArray[npcIndices[j]];
  969.             int k = 0x20000000 + (npcIndices[j] << 14);
  970.             if (npc == null || !npc.isVisible() || npc.desc.aBoolean93 != flag) {
  971.                 continue;
  972.             }
  973.             int l = npc.x >> 7;
  974.             int i1 = npc.y >> 7;
  975.             if (l < 0 || l >= 104 || i1 < 0 || i1 >= 104) {
  976.                 continue;
  977.             }
  978.             if (npc.anInt1540 == 1 && (npc.x & 0x7f) == 64 && (npc.y & 0x7f) == 64) {
  979.                 if (anIntArrayArray929[l][i1] == anInt1265) {
  980.                     continue;
  981.                 }
  982.                 anIntArrayArray929[l][i1] = anInt1265;
  983.             }
  984.             if (!npc.desc.aBoolean84) {
  985.                 k += 0x80000000;
  986.             }
  987.             worldController.method285(plane, npc.anInt1552, method42(plane, npc.y, npc.x), k, npc.y, (npc.anInt1540 - 1) * 64 + 60, npc.x, npc, npc.aBoolean1541);
  988.         }
  989.     }
  990.  
  991.     public boolean replayWave() {
  992.         return Signlink.wavereplay();
  993.     }
  994.  
  995.     public void loadError() {
  996.         String s = "ondemand";// was a constant parameter
  997.         try {
  998.             getAppletContext().showDocument(new URL(getCodeBase(), "loaderror_" + s + ".html"));
  999.         } catch (Exception exception) {
  1000.             exception.printStackTrace();
  1001.         }
  1002.         do {
  1003.             try {
  1004.                 Thread.sleep(1000L);
  1005.             } catch (Exception _ex) {
  1006.             }
  1007.         } while (true);
  1008.     }
  1009.    
  1010.     static final void sleep(long time) {
  1011.         if (time > 0L) {
  1012.             if (time % 10L != 0L)
  1013.                 threadSleep(time);
  1014.             else {
  1015.                 threadSleep(time - 1L);
  1016.                 threadSleep(1L);
  1017.             }
  1018.         }
  1019.     }
  1020.    
  1021.     static final void threadSleep(long time) {
  1022.         try {
  1023.             Thread.sleep(time);
  1024.         } catch (InterruptedException interruptedexception) {
  1025.             /* empty */
  1026.         }
  1027.     }
  1028.  
  1029.     public void buildInterfaceMenu(int i, RSInterface class9, int k, int l, int i1, int j1) {
  1030.         if (class9.type != 0 || class9.children == null || class9.aBoolean266) {
  1031.             return;
  1032.         }
  1033.         if (k < i || i1 < l || k > i + class9.width || i1 > l + class9.height) {
  1034.             return;
  1035.         }
  1036.         int k1 = class9.children.length;
  1037.         for (int l1 = 0; l1 < k1; l1++) {
  1038.             int i2 = class9.childX[l1] + i;
  1039.             int j2 = class9.childY[l1] + l - j1;
  1040.             RSInterface class9_1 = RSInterface.interfaceCache[class9.children[l1]];
  1041.             i2 += class9_1.anInt263;
  1042.             j2 += class9_1.anInt265;
  1043.             if ((class9_1.anInt230 >= 0 || class9_1.anInt216 != 0) && k >= i2 && i1 >= j2 && k < i2 + class9_1.width && i1 < j2 + class9_1.height) {
  1044.                 if (class9_1.anInt230 >= 0) {
  1045.                     anInt886 = class9_1.anInt230;
  1046.                 } else {
  1047.                     anInt886 = class9_1.id;
  1048.                 }
  1049.             }
  1050.             if (class9_1.type == 0) {
  1051.                 buildInterfaceMenu(i2, class9_1, k, j2, i1, class9_1.scrollPosition);
  1052.                 if (class9_1.scrollMax > class9_1.height) {
  1053.                     method65(i2 + class9_1.width, class9_1.height, k, i1, class9_1, j2, true, class9_1.scrollMax);
  1054.                 }
  1055.             } else {
  1056.                 if (class9_1.atActionType == 1 && k >= i2 && i1 >= j2 && k < i2 + class9_1.width && i1 < j2 + class9_1.height) {
  1057.                     boolean flag = false;
  1058.                     if (class9_1.anInt214 != 0) {
  1059.                         flag = buildFriendsListMenu(class9_1);
  1060.                     }
  1061.                     if (!flag) {
  1062.                         menuActionName[menuActionRow] = showInfo ? class9_1.tooltip + ", " + class9_1.id : class9_1.tooltip;
  1063.                         menuActionID[menuActionRow] = 315;
  1064.                         menuActionCmd3[menuActionRow] = class9_1.id;
  1065.                         menuActionRow++;
  1066.                     }
  1067.                 }
  1068.                 if (class9_1.atActionType == 2 && spellSelected == 0 && k >= i2 && i1 >= j2 && k < i2 + class9_1.width && i1 < j2 + class9_1.height) {
  1069.                     String s = class9_1.selectedActionName;
  1070.                     if (s.indexOf(" ") != -1) {
  1071.                         s = s.substring(0, s.indexOf(" "));
  1072.                     }
  1073.                     menuActionName[menuActionRow] = s + " @gre@" + class9_1.spellName;
  1074.                     menuActionID[menuActionRow] = 626;
  1075.                     menuActionCmd3[menuActionRow] = class9_1.id;
  1076.                     menuActionRow++;
  1077.                 }
  1078.                 if (class9_1.atActionType == 3 && k >= i2 && i1 >= j2 && k < i2 + class9_1.width && i1 < j2 + class9_1.height) {
  1079.                     menuActionName[menuActionRow] = "Close";
  1080.                     menuActionID[menuActionRow] = 200;
  1081.                     menuActionCmd3[menuActionRow] = class9_1.id;
  1082.                     menuActionRow++;
  1083.                 }
  1084.                 if (class9_1.atActionType == 4 && k >= i2 && i1 >= j2 && k < i2 + class9_1.width && i1 < j2 + class9_1.height) {
  1085.                     menuActionName[menuActionRow] = showInfo ? class9_1.tooltip + ", " + class9_1.id : class9_1.tooltip;
  1086.                     menuActionID[menuActionRow] = 169;
  1087.                     menuActionCmd3[menuActionRow] = class9_1.id;
  1088.                     menuActionRow++;
  1089.                 }
  1090.                 if (class9_1.atActionType == 5 && k >= i2 && i1 >= j2 && k < i2 + class9_1.width && i1 < j2 + class9_1.height) {
  1091.                     menuActionName[menuActionRow] = showInfo ? class9_1.tooltip + ", " + class9_1.id : class9_1.tooltip;
  1092.                     menuActionID[menuActionRow] = 646;
  1093.                     menuActionCmd3[menuActionRow] = class9_1.id;
  1094.                     menuActionRow++;
  1095.                 }
  1096.                 if (class9_1.atActionType == 6 && !aBoolean1149 && k >= i2 && i1 >= j2 && k < i2 + class9_1.width && i1 < j2 + class9_1.height) {
  1097.                     menuActionName[menuActionRow] = showInfo ? class9_1.tooltip + ", " + class9_1.id : class9_1.tooltip;
  1098.                     menuActionID[menuActionRow] = 679;
  1099.                     menuActionCmd3[menuActionRow] = class9_1.id;
  1100.                     menuActionRow++;
  1101.                 }
  1102.                 if (class9_1.type == 2) {
  1103.                     int k2 = 0;
  1104.                     for (int l2 = 0; l2 < class9_1.height; l2++) {
  1105.                         for (int i3 = 0; i3 < class9_1.width; i3++) {
  1106.                             int j3 = i2 + i3 * (32 + class9_1.invSpritePadX);
  1107.                             int k3 = j2 + l2 * (32 + class9_1.invSpritePadY);
  1108.                             if (k2 < 20) {
  1109.                                 j3 += class9_1.spritesX[k2];
  1110.                                 k3 += class9_1.spritesY[k2];
  1111.                             }
  1112.                             if (k >= j3 && i1 >= k3 && k < j3 + 32 && i1 < k3 + 32) {
  1113.                                 mouseInvInterfaceIndex = k2;
  1114.                                 lastActiveInvInterface = class9_1.id;
  1115.                                 if (class9_1.inv[k2] > 0) {
  1116.                                     ItemDef itemDef = ItemDef.forID(class9_1.inv[k2] - 1);
  1117.                                     if (itemSelected == 1 && class9_1.isInventoryInterface) {
  1118.                                         if (class9_1.id != anInt1284 || k2 != anInt1283) {
  1119.                                             menuActionName[menuActionRow] = "Use " + selectedItemName + " with @lre@" + itemDef.name;
  1120.                                             menuActionID[menuActionRow] = 870;
  1121.                                             menuActionCmd1[menuActionRow] = itemDef.id;
  1122.                                             menuActionCmd2[menuActionRow] = k2;
  1123.                                             menuActionCmd3[menuActionRow] = class9_1.id;
  1124.                                             menuActionRow++;
  1125.                                         }
  1126.                                     } else if (spellSelected == 1 && class9_1.isInventoryInterface) {
  1127.                                         if ((spellUsableOn & 0x10) == 16) {
  1128.                                             menuActionName[menuActionRow] = spellTooltip + " @lre@" + itemDef.name;
  1129.                                             menuActionID[menuActionRow] = 543;
  1130.                                             menuActionCmd1[menuActionRow] = itemDef.id;
  1131.                                             menuActionCmd2[menuActionRow] = k2;
  1132.                                             menuActionCmd3[menuActionRow] = class9_1.id;
  1133.                                             menuActionRow++;
  1134.                                         }
  1135.                                     } else {
  1136.                                         if (class9_1.isInventoryInterface) {
  1137.                                             for (int l3 = 4; l3 >= 3; l3--) {
  1138.                                                 if (itemDef.actions != null && itemDef.actions[l3] != null) {
  1139.                                                     menuActionName[menuActionRow] = itemDef.actions[l3] + " @lre@" + itemDef.name;
  1140.                                                     if (l3 == 3) {
  1141.                                                         menuActionID[menuActionRow] = 493;
  1142.                                                     }
  1143.                                                     if (l3 == 4) {
  1144.                                                         menuActionID[menuActionRow] = 847;
  1145.                                                     }
  1146.                                                     menuActionCmd1[menuActionRow] = itemDef.id;
  1147.                                                     menuActionCmd2[menuActionRow] = k2;
  1148.                                                     menuActionCmd3[menuActionRow] = class9_1.id;
  1149.                                                     menuActionRow++;
  1150.                                                 } else if (l3 == 4) {
  1151.                                                     menuActionName[menuActionRow] = "Drop @lre@" + itemDef.name;
  1152.                                                     menuActionID[menuActionRow] = 847;
  1153.                                                     menuActionCmd1[menuActionRow] = itemDef.id;
  1154.                                                     menuActionCmd2[menuActionRow] = k2;
  1155.                                                     menuActionCmd3[menuActionRow] = class9_1.id;
  1156.                                                     menuActionRow++;
  1157.                                                 }
  1158.                                             }
  1159.  
  1160.                                         }
  1161.                                         if (class9_1.usableItemInterface) {
  1162.                                             menuActionName[menuActionRow] = "Use @lre@" + itemDef.name;
  1163.                                             menuActionID[menuActionRow] = 447;
  1164.                                             menuActionCmd1[menuActionRow] = itemDef.id;
  1165.                                             menuActionCmd2[menuActionRow] = k2;
  1166.                                             menuActionCmd3[menuActionRow] = class9_1.id;
  1167.                                             menuActionRow++;
  1168.                                         }
  1169.                                         if (class9_1.isInventoryInterface && itemDef.actions != null) {
  1170.                                             for (int i4 = 2; i4 >= 0; i4--) {
  1171.                                                 if (itemDef.actions[i4] != null) {
  1172.                                                     menuActionName[menuActionRow] = itemDef.actions[i4] + " @lre@" + itemDef.name;
  1173.                                                     if (i4 == 0) {
  1174.                                                         menuActionID[menuActionRow] = 74;
  1175.                                                     }
  1176.                                                     if (i4 == 1) {
  1177.                                                         menuActionID[menuActionRow] = 454;
  1178.                                                     }
  1179.                                                     if (i4 == 2) {
  1180.                                                         menuActionID[menuActionRow] = 539;
  1181.                                                     }
  1182.                                                     menuActionCmd1[menuActionRow] = itemDef.id;
  1183.                                                     menuActionCmd2[menuActionRow] = k2;
  1184.                                                     menuActionCmd3[menuActionRow] = class9_1.id;
  1185.                                                     menuActionRow++;
  1186.                                                 }
  1187.                                             }
  1188.  
  1189.                                         }
  1190.                                         if (class9_1.actions != null) {
  1191.                                             for (int j4 = 4; j4 >= 0; j4--) {
  1192.                                                 if (class9_1.actions[j4] != null) {
  1193.                                                     menuActionName[menuActionRow] = class9_1.actions[j4] + " @lre@" + itemDef.name;
  1194.                                                     if (j4 == 0) {
  1195.                                                         menuActionID[menuActionRow] = 632;
  1196.                                                     }
  1197.                                                     if (j4 == 1) {
  1198.                                                         menuActionID[menuActionRow] = 78;
  1199.                                                     }
  1200.                                                     if (j4 == 2) {
  1201.                                                         menuActionID[menuActionRow] = 867;
  1202.                                                     }
  1203.                                                     if (j4 == 3) {
  1204.                                                         menuActionID[menuActionRow] = 431;
  1205.                                                     }
  1206.                                                     if (j4 == 4) {
  1207.                                                         menuActionID[menuActionRow] = 53;
  1208.                                                     }
  1209.                                                     menuActionCmd1[menuActionRow] = itemDef.id;
  1210.                                                     menuActionCmd2[menuActionRow] = k2;
  1211.                                                     menuActionCmd3[menuActionRow] = class9_1.id;
  1212.                                                     menuActionRow++;
  1213.                                                 }
  1214.                                             }
  1215.  
  1216.                                         }
  1217.                                         menuActionName[menuActionRow] = "Examine @lre@" + itemDef.name + (showInfo ? " @gre@(@whi@" + (class9_1.inv[k2] - 1) + "@gre@)" : "");
  1218.                                         menuActionID[menuActionRow] = 1125;
  1219.                                         menuActionCmd1[menuActionRow] = itemDef.id;
  1220.                                         menuActionCmd2[menuActionRow] = k2;
  1221.                                         menuActionCmd3[menuActionRow] = class9_1.id;
  1222.                                         menuActionRow++;
  1223.                                     }
  1224.                                 }
  1225.                             }
  1226.                             k2++;
  1227.                         }
  1228.  
  1229.                     }
  1230.  
  1231.                 }
  1232.             }
  1233.         }
  1234.  
  1235.     }
  1236.  
  1237.     public void method30(int j, int k, int l, int i1, int j1) {
  1238.         scrollBar1.method361(i1, l);
  1239.         scrollBar2.method361(i1, l + j - 16);
  1240.         DrawingArea.method336(j - 32, l + 16, anInt1002, 16, i1);
  1241.         int k1 = (j - 32) * j / j1;
  1242.         if (k1 < 8) {
  1243.             k1 = 8;
  1244.         }
  1245.         int l1 = (j - 32 - k1) * k / (j1 - j);
  1246.         DrawingArea.method336(k1, l + 16 + l1, anInt1063, 16, i1);
  1247.         DrawingArea.method341(l + 16 + l1, anInt902, k1, i1);
  1248.         DrawingArea.method341(l + 16 + l1, anInt902, k1, i1 + 1);
  1249.         DrawingArea.method339(l + 16 + l1, anInt902, 16, i1);
  1250.         DrawingArea.method339(l + 17 + l1, anInt902, 16, i1);
  1251.         DrawingArea.method341(l + 16 + l1, anInt927, k1, i1 + 15);
  1252.         DrawingArea.method341(l + 17 + l1, anInt927, k1 - 1, i1 + 14);
  1253.         DrawingArea.method339(l + 15 + l1 + k1, anInt927, 16, i1);
  1254.         DrawingArea.method339(l + 14 + l1 + k1, anInt927, 15, i1 + 1);
  1255.     }
  1256.  
  1257.     public void updateNPCs(Stream stream, int i) {
  1258.         anInt839 = 0;
  1259.         anInt893 = 0;
  1260.         method139(stream);
  1261.         method46(i, stream);
  1262.         method86(stream);
  1263.         for (int k = 0; k < anInt839; k++) {
  1264.             int l = anIntArray840[k];
  1265.             if (npcArray[l].anInt1537 != loopCycle) {
  1266.                 npcArray[l].desc = null;
  1267.                 npcArray[l] = null;
  1268.             }
  1269.         }
  1270.  
  1271.         if (stream.currentOffset != i) {
  1272.             Signlink.reporterror(myUsername + " size mismatch in getnpcpos - pos:" + stream.currentOffset + " psize:" + i);
  1273.             throw new RuntimeException("eek");
  1274.         }
  1275.         for (int i1 = 0; i1 < npcCount; i1++) {
  1276.             if (npcArray[npcIndices[i1]] == null) {
  1277.                 Signlink.reporterror(myUsername + " null entry in npc list - pos:" + i1 + " size:" + npcCount);
  1278.                 throw new RuntimeException("eek");
  1279.             }
  1280.         }
  1281.  
  1282.     }
  1283.  
  1284.     public void processChatModeClick() {
  1285.         if (super.clickMode3 == 1) {
  1286.             if (super.saveClickX >= 6 && super.saveClickX <= 106 && super.saveClickY >= 467 && super.saveClickY <= 499) {
  1287.                 publicChatMode = (publicChatMode + 1) % 4;
  1288.                 aBoolean1233 = true;
  1289.                 inputTaken = true;
  1290.                 stream.createFrame(95);
  1291.                 stream.writeWordBigEndian(publicChatMode);
  1292.                 //stream.writeWordBigEndian(publicChatMode);
  1293.                 stream.writeWordBigEndian(privateChatMode);
  1294.                 stream.writeWordBigEndian(tradeMode);
  1295.             }
  1296.             if (super.saveClickX >= 135 && super.saveClickX <= 235 && super.saveClickY >= 467 && super.saveClickY <= 499) {
  1297.                 //publicChatMode = (publicChatMode + 1) % 3;
  1298.                 privateChatMode = (privateChatMode + 1) % 3;
  1299.                 aBoolean1233 = true;
  1300.                 inputTaken = true;
  1301.                 stream.createFrame(95);
  1302.                 stream.writeWordBigEndian(publicChatMode);
  1303.                 stream.writeWordBigEndian(privateChatMode);
  1304.                 stream.writeWordBigEndian(tradeMode);
  1305.             }
  1306.             if (super.saveClickX >= 273 && super.saveClickX <= 373 && super.saveClickY >= 467 && super.saveClickY <= 499) {
  1307.                 tradeMode = (tradeMode + 1) % 3;
  1308.                 aBoolean1233 = true;
  1309.                 inputTaken = true;
  1310.                 stream.createFrame(95);
  1311.                 stream.writeWordBigEndian(publicChatMode);
  1312.                 stream.writeWordBigEndian(privateChatMode);
  1313.                 stream.writeWordBigEndian(tradeMode);
  1314.             }
  1315.             if (super.saveClickX >= 412 && super.saveClickX <= 512 && super.saveClickY >= 467 && super.saveClickY <= 499) {
  1316.                 if (openInterfaceID == -1) {
  1317.                     closeOpenInterfaces();
  1318.                     reportAbuseInput = "";
  1319.                     canMute = false;
  1320.                     for (RSInterface element : RSInterface.interfaceCache) {
  1321.                         if (element == null || element.anInt214 != 600) {
  1322.                             continue;
  1323.                         }
  1324.                         reportAbuseInterfaceID = openInterfaceID = element.parentID;
  1325.                         break;
  1326.                     }
  1327.  
  1328.                 } else {
  1329.                     pushMessage("Please close the interface you have open before using 'report abuse'", 0, "");
  1330.                 }
  1331.             }
  1332.             anInt940++;
  1333.             if (anInt940 > 1386) {
  1334.                 anInt940 = 0;
  1335.                 stream.createFrame(165);
  1336.                 stream.writeWordBigEndian(0);
  1337.                 int j = stream.currentOffset;
  1338.                 stream.writeWordBigEndian(139);
  1339.                 stream.writeWordBigEndian(150);
  1340.                 stream.writeWord(32131);
  1341.                 stream.writeWordBigEndian((int) (Math.random() * 256D));
  1342.                 stream.writeWord(3250);
  1343.                 stream.writeWordBigEndian(177);
  1344.                 stream.writeWord(24859);
  1345.                 stream.writeWordBigEndian(119);
  1346.                 if ((int) (Math.random() * 2D) == 0) {
  1347.                     stream.writeWord(47234);
  1348.                 }
  1349.                 if ((int) (Math.random() * 2D) == 0) {
  1350.                     stream.writeWordBigEndian(21);
  1351.                 }
  1352.                 stream.writeBytes(stream.currentOffset - j);
  1353.             }
  1354.         }
  1355.     }
  1356.  
  1357.     public void method33(int i) {
  1358.         int action = Varp.cache[i].anInt709;
  1359.         if (action == 0) {
  1360.             return;
  1361.         }
  1362.         int config = variousSettings[i];
  1363.         if (action == 1) {
  1364.             if (config == 1) {
  1365.                 Texture.method372(0.90000000000000002D);
  1366.             }
  1367.             if (config == 2) {
  1368.                 Texture.method372(0.80000000000000004D);
  1369.             }
  1370.             if (config == 3) {
  1371.                 Texture.method372(0.69999999999999996D);
  1372.             }
  1373.             if (config == 4) {
  1374.                 Texture.method372(0.59999999999999998D);
  1375.             }
  1376.             ItemDef.mruNodes1.unlinkAll();
  1377.             welcomeScreenRaised = true;
  1378.         }
  1379.         if (action == 3) {
  1380.             int volume = 0;
  1381.             if (config == 0)
  1382.                 volume = 255;
  1383.             if (config == 1)
  1384.                 volume = 192;
  1385.             if (config == 2)
  1386.                 volume = 128;
  1387.             if (config == 3)
  1388.                 volume = 64;
  1389.             if (config == 4)
  1390.                 volume = 0;
  1391.             if (volume != musicVolume) {
  1392.                 if (musicVolume != 0 || currentSong == -1) {
  1393.                     if (volume != 0)
  1394.                         setVolume(volume);
  1395.                     else {
  1396.                         method55(false);
  1397.                         previousSong = 0;
  1398.                     }
  1399.                 } else {
  1400.                     method56(volume, false, currentSong);
  1401.                     previousSong = 0;//TODO temp music
  1402.                 }
  1403.                 musicVolume = volume;
  1404.             }
  1405.         }
  1406.         if (action == 4) {
  1407.             SoundPlayer.setVolume(config);
  1408.             if (config == 0) {
  1409.                 aBoolean848 = true;
  1410.                 setWaveVolume(0);
  1411.             }
  1412.             if (config == 1) {
  1413.                 aBoolean848 = true;
  1414.                 setWaveVolume(-400);
  1415.             }
  1416.             if (config == 2) {
  1417.                 aBoolean848 = true;
  1418.                 setWaveVolume(-800);
  1419.             }
  1420.             if (config == 3) {
  1421.                 aBoolean848 = true;
  1422.                 setWaveVolume(-1200);
  1423.             }
  1424.             if (config == 4) {
  1425.                 aBoolean848 = false;
  1426.             }
  1427.         }
  1428.         if (action == 5) {
  1429.             anInt1253 = config;
  1430.         }
  1431.         if (action == 6) {
  1432.             anInt1249 = config;
  1433.         }
  1434.         if (action == 8) {
  1435.             splitpublicChat = config;
  1436.             inputTaken = true;
  1437.         }
  1438.         if (action == 9) {
  1439.             anInt913 = config;
  1440.         }
  1441.     }
  1442.  
  1443.     public void updateEntities() {
  1444.         try {
  1445.             int anInt974 = 0;
  1446.             for (int j = -1; j < playerCount + npcCount; j++) {
  1447.                 Object obj;
  1448.                 if (j == -1) {
  1449.                     obj = myPlayer;
  1450.                 } else if (j < playerCount) {
  1451.                     obj = playerArray[playerIndices[j]];
  1452.                 } else {
  1453.                     obj = npcArray[npcIndices[j - playerCount]];
  1454.                 }
  1455.                 if (obj == null || !((Entity) obj).isVisible()) {
  1456.                     continue;
  1457.                 }
  1458.                 if (obj instanceof NPC) {
  1459.                     EntityDef entityDef = ((NPC) obj).desc;
  1460.                     if (entityDef.childrenIDs != null) {
  1461.                         entityDef = entityDef.method161();
  1462.                     }
  1463.                     if (entityDef == null) {
  1464.                         continue;
  1465.                     }
  1466.                 }
  1467.                 if (j < playerCount) {
  1468.                     int l = 30;
  1469.                     Player player = (Player) obj;
  1470.                     if (player.headIcon >= 0) {
  1471.                         npcScreenPos(((Entity) obj), ((Entity) obj).height + 15);
  1472.                         if (spriteDrawX > -1) {
  1473.                             if (player.skullIcon < 2) {
  1474.                                 skullIcons[player.skullIcon].drawSprite(spriteDrawX - 12, spriteDrawY - l);
  1475.                                 l += 25;
  1476.                             }
  1477.                             if (player.headIcon < 7) {
  1478.                                 headIcons[player.headIcon].drawSprite(spriteDrawX - 12, spriteDrawY - l);
  1479.                                 l += 18;
  1480.                             }
  1481.                         }
  1482.                     }
  1483.                     if (j >= 0 && anInt855 == 10 && anInt933 == playerIndices[j]) {
  1484.                         npcScreenPos(((Entity) obj), ((Entity) obj).height + 15);
  1485.                         if (spriteDrawX > -1) {
  1486.                             headIconsHint[1].drawSprite(spriteDrawX - 12, spriteDrawY - l);
  1487.                         }
  1488.                     }
  1489.                 } else {
  1490.                     EntityDef entityDef_1 = ((NPC) obj).desc;
  1491.                     if (entityDef_1.anInt75 >= 0 && entityDef_1.anInt75 < headIcons.length) {
  1492.                         npcScreenPos(((Entity) obj), ((Entity) obj).height + 15);
  1493.                         if (spriteDrawX > -1) {
  1494.                             headIcons[entityDef_1.anInt75].drawSprite(spriteDrawX - 12, spriteDrawY - 30);
  1495.                         }
  1496.                     }
  1497.                     if (anInt855 == 1 && anInt1222 == npcIndices[j - playerCount] && loopCycle % 20 < 10) {
  1498.                         npcScreenPos(((Entity) obj), ((Entity) obj).height + 15);
  1499.                         if (spriteDrawX > -1) {
  1500.                             headIconsHint[0].drawSprite(spriteDrawX - 12, spriteDrawY - 28);
  1501.                         }
  1502.                     }
  1503.                 }
  1504.                 if (((Entity) obj).textSpoken != null && (j >= playerCount || publicChatMode == 0 || publicChatMode == 3 || publicChatMode == 1 && isFriendOrSelf(((Player) obj).name))) {
  1505.                     npcScreenPos(((Entity) obj), ((Entity) obj).height);
  1506.                     if (spriteDrawX > -1 && anInt974 < anInt975) {
  1507.                         anIntArray979[anInt974] = chatTextDrawingArea.method384(((Entity) obj).textSpoken) / 2;
  1508.                         anIntArray978[anInt974] = chatTextDrawingArea.anInt1497;
  1509.                         anIntArray976[anInt974] = spriteDrawX;
  1510.                         anIntArray977[anInt974] = spriteDrawY;
  1511.                         anIntArray980[anInt974] = ((Entity) obj).anInt1513;
  1512.                         anIntArray981[anInt974] = ((Entity) obj).anInt1531;
  1513.                         anIntArray982[anInt974] = ((Entity) obj).textCycle;
  1514.                         aStringArray983[anInt974++] = ((Entity) obj).textSpoken;
  1515.                         if (anInt1249 == 0 && ((Entity) obj).anInt1531 >= 1 && ((Entity) obj).anInt1531 <= 3) {
  1516.                             anIntArray978[anInt974] += 10;
  1517.                             anIntArray977[anInt974] += 5;
  1518.                         }
  1519.                         if (anInt1249 == 0 && ((Entity) obj).anInt1531 == 4) {
  1520.                             anIntArray979[anInt974] = 60;
  1521.                         }
  1522.                         if (anInt1249 == 0 && ((Entity) obj).anInt1531 == 5) {
  1523.                             anIntArray978[anInt974] += 5;
  1524.                         }
  1525.                     }
  1526.                 }
  1527.                 if (((Entity) obj).loopCycleStatus > loopCycle) {
  1528.                     try {
  1529.                         npcScreenPos(((Entity) obj), ((Entity) obj).height + 15);
  1530.                         if (spriteDrawX > -1) {
  1531.                             int i1 = ((Entity) obj).currentHealth * 30 / ((Entity) obj).maxHealth;
  1532.                             if (i1 > 30) {
  1533.                                 i1 = 30;
  1534.                             }
  1535.                             DrawingArea.method336(5, spriteDrawY - 3, 65280, i1, spriteDrawX - 15);
  1536.                             DrawingArea.method336(5, spriteDrawY - 3, 0xff0000, 30 - i1, spriteDrawX - 15 + i1);
  1537.                         }
  1538.                     } catch (Exception e) {
  1539.                     }
  1540.                 }
  1541.                 for (int j1 = 0; j1 < 4; j1++) {
  1542.                     if (((Entity) obj).hitsLoopCycle[j1] > loopCycle) {
  1543.                         npcScreenPos(((Entity) obj), ((Entity) obj).height / 2);
  1544.                         if (spriteDrawX > -1) {
  1545.                             if (j1 == 1) {
  1546.                                 spriteDrawY -= 20;
  1547.                             }
  1548.                             if (j1 == 2) {
  1549.                                 spriteDrawX -= 15;
  1550.                                 spriteDrawY -= 10;
  1551.                             }
  1552.                             if (j1 == 3) {
  1553.                                 spriteDrawX += 15;
  1554.                                 spriteDrawY -= 10;
  1555.                             }
  1556.                             hitMarks[((Entity) obj).hitMarkTypes[j1]].drawSprite(spriteDrawX - 12, spriteDrawY - 12);
  1557.                             aTextDrawingArea_1270.drawText(0, String.valueOf(((Entity) obj).hitArray[j1]), spriteDrawY + 4, spriteDrawX);
  1558.                             aTextDrawingArea_1270.drawText(0xffffff, String.valueOf(((Entity) obj).hitArray[j1]), spriteDrawY + 3, spriteDrawX - 1);
  1559.                         }
  1560.                     }
  1561.                 }
  1562.             }
  1563.             for (int k = 0; k < anInt974; k++) {
  1564.                 int k1 = anIntArray976[k];
  1565.                 int l1 = anIntArray977[k];
  1566.                 int j2 = anIntArray979[k];
  1567.                 int k2 = anIntArray978[k];
  1568.                 boolean flag = true;
  1569.                 while (flag) {
  1570.                     flag = false;
  1571.                     for (int l2 = 0; l2 < k; l2++) {
  1572.                         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) {
  1573.                             l1 = anIntArray977[l2] - anIntArray978[l2];
  1574.                             flag = true;
  1575.                         }
  1576.                     }
  1577.  
  1578.                 }
  1579.                 spriteDrawX = anIntArray976[k];
  1580.                 spriteDrawY = anIntArray977[k] = l1;
  1581.                 String s = aStringArray983[k];
  1582.                 if (anInt1249 == 0) {
  1583.                     int i3 = 0xffff00;
  1584.                     if (anIntArray980[k] < 6) {
  1585.                         i3 = anIntArray965[anIntArray980[k]];
  1586.                     }
  1587.                     if (anIntArray980[k] == 6) {
  1588.                         i3 = anInt1265 % 20 >= 10 ? 0xffff00 : 0xff0000;
  1589.                     }
  1590.                     if (anIntArray980[k] == 7) {
  1591.                         i3 = anInt1265 % 20 >= 10 ? 65535 : 255;
  1592.                     }
  1593.                     if (anIntArray980[k] == 8) {
  1594.                         i3 = anInt1265 % 20 >= 10 ? 0x80ff80 : 45056;
  1595.                     }
  1596.                     if (anIntArray980[k] == 9) {
  1597.                         int j3 = 150 - anIntArray982[k];
  1598.                         if (j3 < 50) {
  1599.                             i3 = 0xff0000 + 1280 * j3;
  1600.                         } else if (j3 < 100) {
  1601.                             i3 = 0xffff00 - 0x50000 * (j3 - 50);
  1602.                         } else if (j3 < 150) {
  1603.                             i3 = 65280 + 5 * (j3 - 100);
  1604.                         }
  1605.                     }
  1606.                     if (anIntArray980[k] == 10) {
  1607.                         int k3 = 150 - anIntArray982[k];
  1608.                         if (k3 < 50) {
  1609.                             i3 = 0xff0000 + 5 * k3;
  1610.                         } else if (k3 < 100) {
  1611.                             i3 = 0xff00ff - 0x50000 * (k3 - 50);
  1612.                         } else if (k3 < 150) {
  1613.                             i3 = 255 + 0x50000 * (k3 - 100) - 5 * (k3 - 100);
  1614.                         }
  1615.                     }
  1616.                     if (anIntArray980[k] == 11) {
  1617.                         int l3 = 150 - anIntArray982[k];
  1618.                         if (l3 < 50) {
  1619.                             i3 = 0xffffff - 0x50005 * l3;
  1620.                         } else if (l3 < 100) {
  1621.                             i3 = 65280 + 0x50005 * (l3 - 50);
  1622.                         } else if (l3 < 150) {
  1623.                             i3 = 0xffffff - 0x50000 * (l3 - 100);
  1624.                         }
  1625.                     }
  1626.                     if (anIntArray981[k] == 0) {
  1627.                         chatTextDrawingArea.drawText(0, s, spriteDrawY + 1, spriteDrawX);
  1628.                         chatTextDrawingArea.drawText(i3, s, spriteDrawY, spriteDrawX);
  1629.                     }
  1630.                     if (anIntArray981[k] == 1) {
  1631.                         chatTextDrawingArea.method386(0, s, spriteDrawX, anInt1265, spriteDrawY + 1);
  1632.                         chatTextDrawingArea.method386(i3, s, spriteDrawX, anInt1265, spriteDrawY);
  1633.                     }
  1634.                     if (anIntArray981[k] == 2) {
  1635.                         chatTextDrawingArea.method387(spriteDrawX, s, anInt1265, spriteDrawY + 1, 0);
  1636.                         chatTextDrawingArea.method387(spriteDrawX, s, anInt1265, spriteDrawY, i3);
  1637.                     }
  1638.                     if (anIntArray981[k] == 3) {
  1639.                         chatTextDrawingArea.method388(150 - anIntArray982[k], s, anInt1265, spriteDrawY + 1, spriteDrawX, 0);
  1640.                         chatTextDrawingArea.method388(150 - anIntArray982[k], s, anInt1265, spriteDrawY, spriteDrawX, i3);
  1641.                     }
  1642.                     if (anIntArray981[k] == 4) {
  1643.                         int i4 = chatTextDrawingArea.method384(s);
  1644.                         int k4 = (150 - anIntArray982[k]) * (i4 + 100) / 150;
  1645.                         DrawingArea.setDrawingArea(334, spriteDrawX - 50, spriteDrawX + 50, 0);
  1646.                         chatTextDrawingArea.method385(0, s, spriteDrawY + 1, spriteDrawX + 50 - k4);
  1647.                         chatTextDrawingArea.method385(i3, s, spriteDrawY, spriteDrawX + 50 - k4);
  1648.                         DrawingArea.defaultDrawingAreaSize();
  1649.                     }
  1650.                     if (anIntArray981[k] == 5) {
  1651.                         int j4 = 150 - anIntArray982[k];
  1652.                         int l4 = 0;
  1653.                         if (j4 < 25) {
  1654.                             l4 = j4 - 25;
  1655.                         } else if (j4 > 125) {
  1656.                             l4 = j4 - 125;
  1657.                         }
  1658.                         DrawingArea.setDrawingArea(spriteDrawY + 5, 0, 512, spriteDrawY - chatTextDrawingArea.anInt1497 - 1);
  1659.                         chatTextDrawingArea.drawText(0, s, spriteDrawY + 1 + l4, spriteDrawX);
  1660.                         chatTextDrawingArea.drawText(i3, s, spriteDrawY + l4, spriteDrawX);
  1661.                         DrawingArea.defaultDrawingAreaSize();
  1662.                     }
  1663.                 } else {
  1664.                     chatTextDrawingArea.drawText(0, s, spriteDrawY + 1, spriteDrawX);
  1665.                     chatTextDrawingArea.drawText(0xffff00, s, spriteDrawY, spriteDrawX);
  1666.                 }
  1667.             }
  1668.         } catch (Exception e) {
  1669.         }
  1670.     }
  1671.  
  1672.     public void delFriend(long l) {
  1673.         try {
  1674.             if (l == 0L) {
  1675.                 return;
  1676.             }
  1677.             for (int i = 0; i < friendsCount; i++) {
  1678.                 if (friendsListAsLongs[i] != l) {
  1679.                     continue;
  1680.                 }
  1681.                 friendsCount--;
  1682.                 needDrawTabArea = true;
  1683.                 for (int j = i; j < friendsCount; j++) {
  1684.                     friendsList[j] = friendsList[j + 1];
  1685.                     friendsNodeIDs[j] = friendsNodeIDs[j + 1];
  1686.                     friendsListAsLongs[j] = friendsListAsLongs[j + 1];
  1687.                 }
  1688.  
  1689.                 stream.createFrame(215);
  1690.                 stream.writeQWord(l);
  1691.                 break;
  1692.             }
  1693.         } catch (RuntimeException runtimeexception) {
  1694.             Signlink.reporterror("18622, " + false + ", " + l + ", " + runtimeexception.toString());
  1695.             throw new RuntimeException();
  1696.         }
  1697.     }
  1698.  
  1699.     public void drawTabArea() {
  1700.         aRSImageProducer_1163.initDrawingArea();
  1701.         Texture.lineOffsets = tabAreaOffsets;
  1702.         invBack.method361(0, 0);
  1703.         if (invOverlayInterfaceID != -1) {
  1704.             drawInterface(0, 0, RSInterface.interfaceCache[invOverlayInterfaceID], 0);
  1705.         } else if (tabInterfaceIDs[tabID] != -1) {
  1706.             drawInterface(0, 0, RSInterface.interfaceCache[tabInterfaceIDs[tabID]], 0);
  1707.         }
  1708.         if (menuOpen && menuScreenArea == 1) {
  1709.             drawMenu();
  1710.         }
  1711.         aRSImageProducer_1163.drawGraphics(205, super.graphics, 553);
  1712.         aRSImageProducer_1165.initDrawingArea();
  1713.         Texture.lineOffsets = chatBoxAreaOffsets;
  1714.     }
  1715.  
  1716.     public void method37(int j) {
  1717.         if (!lowMem) {
  1718.             if (Texture.anIntArray1480[17] >= j) {
  1719.                 Background background = Texture.aBackgroundArray1474s[17];
  1720.                 int k = background.anInt1452 * background.anInt1453 - 1;
  1721.                 int j1 = background.anInt1452 * anInt945 * 2;
  1722.                 byte abyte0[] = background.aByteArray1450;
  1723.                 byte abyte3[] = aByteArray912;
  1724.                 for (int i2 = 0; i2 <= k; i2++) {
  1725.                     abyte3[i2] = abyte0[i2 - j1 & k];
  1726.                 }
  1727.  
  1728.                 background.aByteArray1450 = abyte3;
  1729.                 aByteArray912 = abyte0;
  1730.                 Texture.method370(17);
  1731.             }
  1732.             if (Texture.anIntArray1480[24] >= j) {
  1733.                 Background background_1 = Texture.aBackgroundArray1474s[24];
  1734.                 int l = background_1.anInt1452 * background_1.anInt1453 - 1;
  1735.                 int k1 = background_1.anInt1452 * anInt945 * 2;
  1736.                 byte abyte1[] = background_1.aByteArray1450;
  1737.                 byte abyte4[] = aByteArray912;
  1738.                 for (int j2 = 0; j2 <= l; j2++) {
  1739.                     abyte4[j2] = abyte1[j2 - k1 & l];
  1740.                 }
  1741.  
  1742.                 background_1.aByteArray1450 = abyte4;
  1743.                 aByteArray912 = abyte1;
  1744.                 Texture.method370(24);
  1745.             }
  1746.             if (Texture.anIntArray1480[34] >= j) {
  1747.                 Background background_2 = Texture.aBackgroundArray1474s[34];
  1748.                 int i1 = background_2.anInt1452 * background_2.anInt1453 - 1;
  1749.                 int l1 = background_2.anInt1452 * anInt945 * 2;
  1750.                 byte abyte2[] = background_2.aByteArray1450;
  1751.                 byte abyte5[] = aByteArray912;
  1752.                 for (int k2 = 0; k2 <= i1; k2++) {
  1753.                     abyte5[k2] = abyte2[k2 - l1 & i1];
  1754.                 }
  1755.  
  1756.                 background_2.aByteArray1450 = abyte5;
  1757.                 aByteArray912 = abyte2;
  1758.                 Texture.method370(34);
  1759.             }
  1760.             if (Texture.anIntArray1480[40] >= j) {
  1761.                 Background background_2 = Texture.aBackgroundArray1474s[40];
  1762.                 int i1 = background_2.anInt1452 * background_2.anInt1453 - 1;
  1763.                 int l1 = background_2.anInt1452 * anInt945 * 2;
  1764.                 byte abyte2[] = background_2.aByteArray1450;
  1765.                 byte abyte5[] = aByteArray912;
  1766.                 for (int k2 = 0; k2 <= i1; k2++) {
  1767.                     abyte5[k2] = abyte2[k2 - l1 & i1];
  1768.                 }
  1769.  
  1770.                 background_2.aByteArray1450 = abyte5;
  1771.                 aByteArray912 = abyte2;
  1772.                 Texture.method370(40);
  1773.             }
  1774.         }
  1775.     }
  1776.  
  1777.     public void method38() {
  1778.         for (int i = -1; i < playerCount; i++) {
  1779.             int j;
  1780.             if (i == -1) {
  1781.                 j = myPlayerIndex;
  1782.             } else {
  1783.                 j = playerIndices[i];
  1784.             }
  1785.             Player player = playerArray[j];
  1786.             if (player != null && player.textCycle > 0) {
  1787.                 player.textCycle--;
  1788.                 if (player.textCycle == 0) {
  1789.                     player.textSpoken = null;
  1790.                 }
  1791.             }
  1792.         }
  1793.  
  1794.         for (int k = 0; k < npcCount; k++) {
  1795.             int l = npcIndices[k];
  1796.             NPC npc = npcArray[l];
  1797.             if (npc != null && npc.textCycle > 0) {
  1798.                 npc.textCycle--;
  1799.                 if (npc.textCycle == 0) {
  1800.                     npc.textSpoken = null;
  1801.                 }
  1802.             }
  1803.         }
  1804.  
  1805.     }
  1806.  
  1807.     public void calcCameraPos() {
  1808.         int i = anInt1098 * 128 + 64;
  1809.         int j = anInt1099 * 128 + 64;
  1810.         int k = method42(plane, j, i) - anInt1100;
  1811.         if (xCameraPos < i) {
  1812.             xCameraPos += anInt1101 + (i - xCameraPos) * anInt1102 / 1000;
  1813.             if (xCameraPos > i) {
  1814.                 xCameraPos = i;
  1815.             }
  1816.         }
  1817.         if (xCameraPos > i) {
  1818.             xCameraPos -= anInt1101 + (xCameraPos - i) * anInt1102 / 1000;
  1819.             if (xCameraPos < i) {
  1820.                 xCameraPos = i;
  1821.             }
  1822.         }
  1823.         if (zCameraPos < k) {
  1824.             zCameraPos += anInt1101 + (k - zCameraPos) * anInt1102 / 1000;
  1825.             if (zCameraPos > k) {
  1826.                 zCameraPos = k;
  1827.             }
  1828.         }
  1829.         if (zCameraPos > k) {
  1830.             zCameraPos -= anInt1101 + (zCameraPos - k) * anInt1102 / 1000;
  1831.             if (zCameraPos < k) {
  1832.                 zCameraPos = k;
  1833.             }
  1834.         }
  1835.         if (yCameraPos < j) {
  1836.             yCameraPos += anInt1101 + (j - yCameraPos) * anInt1102 / 1000;
  1837.             if (yCameraPos > j) {
  1838.                 yCameraPos = j;
  1839.             }
  1840.         }
  1841.         if (yCameraPos > j) {
  1842.             yCameraPos -= anInt1101 + (yCameraPos - j) * anInt1102 / 1000;
  1843.             if (yCameraPos < j) {
  1844.                 yCameraPos = j;
  1845.             }
  1846.         }
  1847.         i = anInt995 * 128 + 64;
  1848.         j = anInt996 * 128 + 64;
  1849.         k = method42(plane, j, i) - anInt997;
  1850.         int l = i - xCameraPos;
  1851.         int i1 = k - zCameraPos;
  1852.         int j1 = j - yCameraPos;
  1853.         int k1 = (int) Math.sqrt(l * l + j1 * j1);
  1854.         int l1 = (int) (Math.atan2(i1, k1) * 325.94900000000001D) & 0x7ff;
  1855.         int i2 = (int) (Math.atan2(l, j1) * -325.94900000000001D) & 0x7ff;
  1856.         if (l1 < 128) {
  1857.             l1 = 128;
  1858.         }
  1859.         if (l1 > 383) {
  1860.             l1 = 383;
  1861.         }
  1862.         if (yCameraCurve < l1) {
  1863.             yCameraCurve += anInt998 + (l1 - yCameraCurve) * anInt999 / 1000;
  1864.             if (yCameraCurve > l1) {
  1865.                 yCameraCurve = l1;
  1866.             }
  1867.         }
  1868.         if (yCameraCurve > l1) {
  1869.             yCameraCurve -= anInt998 + (yCameraCurve - l1) * anInt999 / 1000;
  1870.             if (yCameraCurve < l1) {
  1871.                 yCameraCurve = l1;
  1872.             }
  1873.         }
  1874.         int j2 = i2 - xCameraCurve;
  1875.         if (j2 > 1024) {
  1876.             j2 -= 2048;
  1877.         }
  1878.         if (j2 < -1024) {
  1879.             j2 += 2048;
  1880.         }
  1881.         if (j2 > 0) {
  1882.             xCameraCurve += anInt998 + j2 * anInt999 / 1000;
  1883.             xCameraCurve &= 0x7ff;
  1884.         }
  1885.         if (j2 < 0) {
  1886.             xCameraCurve -= anInt998 + -j2 * anInt999 / 1000;
  1887.             xCameraCurve &= 0x7ff;
  1888.         }
  1889.         int k2 = i2 - xCameraCurve;
  1890.         if (k2 > 1024) {
  1891.             k2 -= 2048;
  1892.         }
  1893.         if (k2 < -1024) {
  1894.             k2 += 2048;
  1895.         }
  1896.         if (k2 < 0 && j2 > 0 || k2 > 0 && j2 < 0) {
  1897.             xCameraCurve = i2;
  1898.         }
  1899.     }
  1900.  
  1901.     public void drawMenu() {
  1902.         int i = menuOffsetX;
  1903.         int j = menuOffsetY;
  1904.         int k = menuWidth;
  1905.         int l = anInt952;
  1906.         int i1 = 0x5d5447;
  1907.         DrawingArea.method336(l, j, i1, k, i);
  1908.         DrawingArea.method336(16, j + 1, 0, k - 2, i + 1);
  1909.         DrawingArea.fillPixels(j + 18, l - 19, 0, i + 1, k - 2);
  1910.         chatTextDrawingArea.method385(i1, "Choose Option", j + 14, i + 3);
  1911.         int j1 = super.mouseX;
  1912.         int k1 = super.mouseY;
  1913.         if (menuScreenArea == 0) {
  1914.             j1 -= 4;
  1915.             k1 -= 4;
  1916.         }
  1917.         if (menuScreenArea == 1) {
  1918.             j1 -= 553;
  1919.             k1 -= 205;
  1920.         }
  1921.         if (menuScreenArea == 2) {
  1922.             j1 -= 17;
  1923.             k1 -= 357;
  1924.         }
  1925.         for (int l1 = 0; l1 < menuActionRow; l1++) {
  1926.             int i2 = j + 31 + (menuActionRow - 1 - l1) * 15;
  1927.             int j2 = 0xffffff;
  1928.             if (j1 > i && j1 < i + k && k1 > i2 - 13 && k1 < i2 + 3) {
  1929.                 j2 = 0xffff00;
  1930.             }
  1931.             chatTextDrawingArea.method389(true, i + 3, j2, menuActionName[l1], i2);
  1932.         }
  1933.  
  1934.     }
  1935.  
  1936.     public void addFriend(long l) {
  1937.         try {
  1938.             if (l == 0L) {
  1939.                 return;
  1940.             }
  1941.             if (friendsCount >= 100 && anInt1046 != 1) {
  1942.                 pushMessage("Your friendlist is full. Max of 100 for free users, and 200 for members", 0, "");
  1943.                 return;
  1944.             }
  1945.             if (friendsCount >= 200) {
  1946.                 pushMessage("Your friendlist is full. Max of 100 for free users, and 200 for members", 0, "");
  1947.                 return;
  1948.             }
  1949.             String s = TextClass.fixName(TextClass.nameForLong(l));
  1950.             for (int i = 0; i < friendsCount; i++) {
  1951.                 if (friendsListAsLongs[i] == l) {
  1952.                     pushMessage(s + " is already on your friend list", 0, "");
  1953.                     return;
  1954.                 }
  1955.             }
  1956.             for (int j = 0; j < ignoreCount; j++) {
  1957.                 if (ignoreListAsLongs[j] == l) {
  1958.                     pushMessage("Please remove " + s + " from your ignore list first", 0, "");
  1959.                     return;
  1960.                 }
  1961.             }
  1962.  
  1963.             if (s.equals(myPlayer.name)) {
  1964.                 return;
  1965.             } else {
  1966.                 friendsList[friendsCount] = s;
  1967.                 friendsListAsLongs[friendsCount] = l;
  1968.                 friendsNodeIDs[friendsCount] = 0;
  1969.                 friendsCount++;
  1970.                 needDrawTabArea = true;
  1971.                 stream.createFrame(188);
  1972.                 stream.writeQWord(l);
  1973.                 return;
  1974.             }
  1975.         } catch (RuntimeException runtimeexception) {
  1976.             Signlink.reporterror("15283, " + (byte) 68 + ", " + l + ", " + runtimeexception.toString());
  1977.         }
  1978.         throw new RuntimeException();
  1979.     }
  1980.  
  1981.     public int method42(int i, int j, int k) {
  1982.         int l = k >> 7;
  1983.         int i1 = j >> 7;
  1984.         if (l < 0 || i1 < 0 || l > 103 || i1 > 103) {
  1985.             return 0;
  1986.         }
  1987.         int j1 = i;
  1988.         if (j1 < 3 && (byteGroundArray[1][l][i1] & 2) == 2) {
  1989.             j1++;
  1990.         }
  1991.         int k1 = k & 0x7f;
  1992.         int l1 = j & 0x7f;
  1993.         int i2 = intGroundArray[j1][l][i1] * (128 - k1) + intGroundArray[j1][l + 1][i1] * k1 >> 7;
  1994.         int j2 = intGroundArray[j1][l][i1 + 1] * (128 - k1) + intGroundArray[j1][l + 1][i1 + 1] * k1 >> 7;
  1995.         return i2 * (128 - l1) + j2 * l1 >> 7;
  1996.     }
  1997.  
  1998.     public static String intToKOrMil(int j) {
  1999.         if (j < 0x186a0) {
  2000.             return String.valueOf(j);
  2001.         }
  2002.         if (j < 0x989680) {
  2003.             return j / 1000 + "K";
  2004.         } else {
  2005.             return j / 0xf4240 + "M";
  2006.         }
  2007.     }
  2008.  
  2009.     public void resetLogout() {
  2010.         try {
  2011.             if (socketStream != null) {
  2012.                 socketStream.close();
  2013.             }
  2014.         } catch (Exception _ex) {
  2015.         }
  2016.         socketStream = null;
  2017.         loggedIn = false;
  2018.         loginScreenState = 0;
  2019.         // myUsername = "";
  2020.         // myPassword = "";
  2021.         unlinkMRUNodes();
  2022.         worldController.initToNull();
  2023.         for (int i = 0; i < 4; i++) {
  2024.             aClass11Array1230[i].method210();
  2025.         }
  2026.  
  2027.         System.gc();
  2028.         stopMidi();
  2029.         currentSong = -1;
  2030.         nextSong = -1;
  2031.         previousSong = 0;
  2032.         method58(10, musicVolume, false, 0);
  2033.     }
  2034.  
  2035.     public void method45() {
  2036.         aBoolean1031 = true;
  2037.         for (int j = 0; j < 7; j++) {
  2038.             anIntArray1065[j] = -1;
  2039.             for (int k = 0; k < IDK.length; k++) {
  2040.                 if (IDK.cache[k].aBoolean662 || IDK.cache[k].anInt657 != j + (aBoolean1047 ? 0 : 7)) {
  2041.                     continue;
  2042.                 }
  2043.                 anIntArray1065[j] = k;
  2044.                 break;
  2045.             }
  2046.  
  2047.         }
  2048.  
  2049.     }
  2050.  
  2051.     public void method46(int i, Stream stream) {
  2052.         while (stream.bitPosition + 21 < i * 8) {
  2053.             int k = stream.readBits(14);
  2054.             if (k == 16383) {
  2055.                 break;
  2056.             }
  2057.             if (npcArray[k] == null) {
  2058.                 npcArray[k] = new NPC();
  2059.             }
  2060.             NPC npc = npcArray[k];
  2061.             npcIndices[npcCount++] = k;
  2062.             npc.anInt1537 = loopCycle;
  2063.             int l = stream.readBits(5);
  2064.             if (l > 15) {
  2065.                 l -= 32;
  2066.             }
  2067.             int i1 = stream.readBits(5);
  2068.             if (i1 > 15) {
  2069.                 i1 -= 32;
  2070.             }
  2071.             int j1 = stream.readBits(1);
  2072.             npc.desc = EntityDef.forID(stream.readBits(ClientSettings.NPC_BITS));
  2073.             int k1 = stream.readBits(1);
  2074.             if (k1 == 1) {
  2075.                 anIntArray894[anInt893++] = k;
  2076.             }
  2077.             npc.anInt1540 = npc.desc.aByte68;
  2078.             npc.anInt1504 = npc.desc.anInt79;
  2079.             npc.anInt1554 = npc.desc.anInt67;
  2080.             npc.anInt1555 = npc.desc.anInt58;
  2081.             npc.anInt1556 = npc.desc.anInt83;
  2082.             npc.anInt1557 = npc.desc.anInt55;
  2083.             npc.anInt1511 = npc.desc.anInt77;
  2084.             npc.setPos(myPlayer.smallX[0] + i1, myPlayer.smallY[0] + l, j1 == 1);
  2085.         }
  2086.         stream.finishBitAccess();
  2087.     }
  2088.  
  2089.     public void processGameLoop() {
  2090.         if (rsAlreadyLoaded || loadingError || genericLoadingError) {
  2091.             return;
  2092.         }
  2093.         loopCycle++;
  2094.         if (!loggedIn) {
  2095.             processLoginScreenInput();
  2096.         } else {
  2097.             mainGameProcessor();
  2098.         }
  2099.         processOnDemandQueue();
  2100.         method49();
  2101.     }
  2102.  
  2103.     public void method47(boolean flag) {
  2104.         if (myPlayer.x >> 7 == destX && myPlayer.y >> 7 == destY) {
  2105.             destX = 0;
  2106.         }
  2107.         int j = playerCount;
  2108.         if (flag) {
  2109.             j = 1;
  2110.         }
  2111.         for (int l = 0; l < j; l++) {
  2112.             Player player;
  2113.             int i1;
  2114.             if (flag) {
  2115.                 player = myPlayer;
  2116.                 i1 = myPlayerIndex << 14;
  2117.             } else {
  2118.                 player = playerArray[playerIndices[l]];
  2119.                 i1 = playerIndices[l] << 14;
  2120.             }
  2121.             if (player == null || !player.isVisible()) {
  2122.                 continue;
  2123.             }
  2124.             player.aBoolean1699 = (lowMem && playerCount > 50 || playerCount > 200) && !flag && player.anInt1517 == player.anInt1511;
  2125.             int j1 = player.x >> 7;
  2126.             int k1 = player.y >> 7;
  2127.             if (j1 < 0 || j1 >= 104 || k1 < 0 || k1 >= 104) {
  2128.                 continue;
  2129.             }
  2130.             if (player.aModel_1714 != null && loopCycle >= player.anInt1707 && loopCycle < player.anInt1708) {
  2131.                 player.aBoolean1699 = false;
  2132.                 player.anInt1709 = method42(plane, player.y, player.x);
  2133.                 worldController.method286(plane, player.y, player, player.anInt1552, player.anInt1722, player.x, player.anInt1709, player.anInt1719, player.anInt1721, i1, player.anInt1720);
  2134.                 continue;
  2135.             }
  2136.             if ((player.x & 0x7f) == 64 && (player.y & 0x7f) == 64) {
  2137.                 if (anIntArrayArray929[j1][k1] == anInt1265) {
  2138.                     continue;
  2139.                 }
  2140.                 anIntArrayArray929[j1][k1] = anInt1265;
  2141.             }
  2142.             player.anInt1709 = method42(plane, player.y, player.x);
  2143.             worldController.method285(plane, player.anInt1552, player.anInt1709, i1, player.y, 60, player.x, player, player.aBoolean1541);
  2144.         }
  2145.  
  2146.     }
  2147.  
  2148.     public boolean promptUserForInput(RSInterface class9) {
  2149.         int j = class9.anInt214;
  2150.         if (anInt900 == 2) {
  2151.             if (j == 201) {
  2152.                 inputTaken = true;
  2153.                 inputDialogState = 0;
  2154.                 messagePromptRaised = true;
  2155.                 promptInput = "";
  2156.                 friendsListAction = 1;
  2157.                 aString1121 = "Enter name of friend to add to list";
  2158.             }
  2159.             if (j == 202) {
  2160.                 inputTaken = true;
  2161.                 inputDialogState = 0;
  2162.                 messagePromptRaised = true;
  2163.                 promptInput = "";
  2164.                 friendsListAction = 2;
  2165.                 aString1121 = "Enter name of friend to delete from list";
  2166.             }
  2167.         }
  2168.         if (j == 205) {
  2169.             anInt1011 = 250;
  2170.             return true;
  2171.         }
  2172.         if (j == 501) {
  2173.             inputTaken = true;
  2174.             inputDialogState = 0;
  2175.             messagePromptRaised = true;
  2176.             promptInput = "";
  2177.             friendsListAction = 4;
  2178.             aString1121 = "Enter name of player to add to list";
  2179.         }
  2180.         if (j == 502) {
  2181.             inputTaken = true;
  2182.             inputDialogState = 0;
  2183.             messagePromptRaised = true;
  2184.             promptInput = "";
  2185.             friendsListAction = 5;
  2186.             aString1121 = "Enter name of player to delete from list";
  2187.         }
  2188.         if (j >= 300 && j <= 313) {
  2189.             int k = (j - 300) / 2;
  2190.             int j1 = j & 1;
  2191.             int i2 = anIntArray1065[k];
  2192.             if (i2 != -1) {
  2193.                 do {
  2194.                     if (j1 == 0 && --i2 < 0) {
  2195.                         i2 = IDK.length - 1;
  2196.                     }
  2197.                     if (j1 == 1 && ++i2 >= IDK.length) {
  2198.                         i2 = 0;
  2199.                     }
  2200.                 } while (IDK.cache[i2].aBoolean662 || IDK.cache[i2].anInt657 != k + (aBoolean1047 ? 0 : 7));
  2201.                 anIntArray1065[k] = i2;
  2202.                 aBoolean1031 = true;
  2203.             }
  2204.         }
  2205.         if (j >= 314 && j <= 323) {
  2206.             int l = (j - 314) / 2;
  2207.             int k1 = j & 1;
  2208.             int j2 = anIntArray990[l];
  2209.             if (k1 == 0 && --j2 < 0) {
  2210.                 j2 = anIntArrayArray1003[l].length - 1;
  2211.             }
  2212.             if (k1 == 1 && ++j2 >= anIntArrayArray1003[l].length) {
  2213.                 j2 = 0;
  2214.             }
  2215.             anIntArray990[l] = j2;
  2216.             aBoolean1031 = true;
  2217.         }
  2218.         if (j == 324 && !aBoolean1047) {
  2219.             aBoolean1047 = true;
  2220.             method45();
  2221.         }
  2222.         if (j == 325 && aBoolean1047) {
  2223.             aBoolean1047 = false;
  2224.             method45();
  2225.         }
  2226.         if (j == 326) {
  2227.             stream.createFrame(101);
  2228.             stream.writeWordBigEndian(aBoolean1047 ? 0 : 1);
  2229.             for (int i1 = 0; i1 < 7; i1++) {
  2230.                 stream.writeWordBigEndian(anIntArray1065[i1]);
  2231.             }
  2232.  
  2233.             for (int l1 = 0; l1 < 5; l1++) {
  2234.                 stream.writeWordBigEndian(anIntArray990[l1]);
  2235.             }
  2236.  
  2237.             return true;
  2238.         }
  2239.         if (j == 613) {
  2240.             canMute = !canMute;
  2241.         }
  2242.         if (j >= 601 && j <= 612) {
  2243.             closeOpenInterfaces();
  2244.             if (reportAbuseInput.length() > 0) {
  2245.                 stream.createFrame(218);
  2246.                 stream.writeQWord(TextClass.longForName(reportAbuseInput));
  2247.                 stream.writeWordBigEndian(j - 601);
  2248.                 stream.writeWordBigEndian(canMute ? 1 : 0);
  2249.             }
  2250.         }
  2251.         return false;
  2252.     }
  2253.  
  2254.     public void method49(Stream stream) {
  2255.         for (int j = 0; j < anInt893; j++) {
  2256.             int k = anIntArray894[j];
  2257.             Player player = playerArray[k];
  2258.             int l = stream.readUnsignedByte();
  2259.             if ((l & 0x40) != 0) {
  2260.                 l += stream.readUnsignedByte() << 8;
  2261.             }
  2262.             method107(l, k, stream, player);
  2263.         }
  2264.  
  2265.     }
  2266.  
  2267.     public void method50(int i, int k, int l, int i1, int j1) {
  2268.         int k1 = worldController.method300(j1, l, i);
  2269.         if (k1 != 0) {
  2270.             int l1 = worldController.method304(j1, l, i, k1);
  2271.             int k2 = l1 >> 6 & 3;
  2272.             int i3 = l1 & 0x1f;
  2273.             int k3 = k;
  2274.             if (k1 > 0) {
  2275.                 k3 = i1;
  2276.             }
  2277.             int ai[] = aClass30_Sub2_Sub1_Sub1_1263.pixels;
  2278.             int k4 = 24624 + l * 4 + (103 - i) * 512 * 4;
  2279.             int i5 = k1 >> 14 & 0x7fff;
  2280.             ObjectDef class46_2 = ObjectDef.forID(i5);
  2281.             if (class46_2.anInt758 != -1) {
  2282.                 Background background_2 = mapScenes[class46_2.anInt758];
  2283.                 if (background_2 != null) {
  2284.                     int i6 = (class46_2.anInt744 * 4 - background_2.anInt1452) / 2;
  2285.                     int j6 = (class46_2.anInt761 * 4 - background_2.anInt1453) / 2;
  2286.                     background_2.method361(48 + l * 4 + i6, 48 + (104 - i - class46_2.anInt761) * 4 + j6);
  2287.                 }
  2288.             } else {
  2289.                 if (i3 == 0 || i3 == 2) {
  2290.                     if (k2 == 0) {
  2291.                         ai[k4] = k3;
  2292.                         ai[k4 + 512] = k3;
  2293.                         ai[k4 + 1024] = k3;
  2294.                         ai[k4 + 1536] = k3;
  2295.                     } else if (k2 == 1) {
  2296.                         ai[k4] = k3;
  2297.                         ai[k4 + 1] = k3;
  2298.                         ai[k4 + 2] = k3;
  2299.                         ai[k4 + 3] = k3;
  2300.                     } else if (k2 == 2) {
  2301.                         ai[k4 + 3] = k3;
  2302.                         ai[k4 + 3 + 512] = k3;
  2303.                         ai[k4 + 3 + 1024] = k3;
  2304.                         ai[k4 + 3 + 1536] = k3;
  2305.                     } else if (k2 == 3) {
  2306.                         ai[k4 + 1536] = k3;
  2307.                         ai[k4 + 1536 + 1] = k3;
  2308.                         ai[k4 + 1536 + 2] = k3;
  2309.                         ai[k4 + 1536 + 3] = k3;
  2310.                     }
  2311.                 }
  2312.                 if (i3 == 3) {
  2313.                     if (k2 == 0) {
  2314.                         ai[k4] = k3;
  2315.                     } else if (k2 == 1) {
  2316.                         ai[k4 + 3] = k3;
  2317.                     } else if (k2 == 2) {
  2318.                         ai[k4 + 3 + 1536] = k3;
  2319.                     } else if (k2 == 3) {
  2320.                         ai[k4 + 1536] = k3;
  2321.                     }
  2322.                 }
  2323.                 if (i3 == 2) {
  2324.                     if (k2 == 3) {
  2325.                         ai[k4] = k3;
  2326.                         ai[k4 + 512] = k3;
  2327.                         ai[k4 + 1024] = k3;
  2328.                         ai[k4 + 1536] = k3;
  2329.                     } else if (k2 == 0) {
  2330.                         ai[k4] = k3;
  2331.                         ai[k4 + 1] = k3;
  2332.                         ai[k4 + 2] = k3;
  2333.                         ai[k4 + 3] = k3;
  2334.                     } else if (k2 == 1) {
  2335.                         ai[k4 + 3] = k3;
  2336.                         ai[k4 + 3 + 512] = k3;
  2337.                         ai[k4 + 3 + 1024] = k3;
  2338.                         ai[k4 + 3 + 1536] = k3;
  2339.                     } else if (k2 == 2) {
  2340.                         ai[k4 + 1536] = k3;
  2341.                         ai[k4 + 1536 + 1] = k3;
  2342.                         ai[k4 + 1536 + 2] = k3;
  2343.                         ai[k4 + 1536 + 3] = k3;
  2344.                     }
  2345.                 }
  2346.             }
  2347.         }
  2348.         k1 = worldController.method302(j1, l, i);
  2349.         if (k1 != 0) {
  2350.             int i2 = worldController.method304(j1, l, i, k1);
  2351.             int l2 = i2 >> 6 & 3;
  2352.             int j3 = i2 & 0x1f;
  2353.             int l3 = k1 >> 14 & 0x7fff;
  2354.             ObjectDef class46_1 = ObjectDef.forID(l3);
  2355.             if (class46_1.anInt758 != -1) {
  2356.                 Background background_1 = mapScenes[class46_1.anInt758];
  2357.                 if (background_1 != null) {
  2358.                     int j5 = (class46_1.anInt744 * 4 - background_1.anInt1452) / 2;
  2359.                     int k5 = (class46_1.anInt761 * 4 - background_1.anInt1453) / 2;
  2360.                     background_1.method361(48 + l * 4 + j5, 48 + (104 - i - class46_1.anInt761) * 4 + k5);
  2361.                 }
  2362.             } else if (j3 == 9) {
  2363.                 int l4 = 0xeeeeee;
  2364.                 if (k1 > 0) {
  2365.                     l4 = 0xee0000;
  2366.                 }
  2367.                 int ai1[] = aClass30_Sub2_Sub1_Sub1_1263.pixels;
  2368.                 int l5 = 24624 + l * 4 + (103 - i) * 512 * 4;
  2369.                 if (l2 == 0 || l2 == 2) {
  2370.                     ai1[l5 + 1536] = l4;
  2371.                     ai1[l5 + 1024 + 1] = l4;
  2372.                     ai1[l5 + 512 + 2] = l4;
  2373.                     ai1[l5 + 3] = l4;
  2374.                 } else {
  2375.                     ai1[l5] = l4;
  2376.                     ai1[l5 + 512 + 1] = l4;
  2377.                     ai1[l5 + 1024 + 2] = l4;
  2378.                     ai1[l5 + 1536 + 3] = l4;
  2379.                 }
  2380.             }
  2381.         }
  2382.         k1 = worldController.method303(j1, l, i);
  2383.         if (k1 != 0) {
  2384.             int j2 = k1 >> 14 & 0x7fff;
  2385.             ObjectDef class46 = ObjectDef.forID(j2);
  2386.             if (class46.anInt758 != -1) {
  2387.                 Background background = mapScenes[class46.anInt758];
  2388.                 if (background != null) {
  2389.                     int i4 = (class46.anInt744 * 4 - background.anInt1452) / 2;
  2390.                     int j4 = (class46.anInt761 * 4 - background.anInt1453) / 2;
  2391.                     background.method361(48 + l * 4 + i4, 48 + (104 - i - class46.anInt761) * 4 + j4);
  2392.                 }
  2393.             }
  2394.         }
  2395.     }
  2396.  
  2397.     public void loadTitleScreen() {
  2398.         aBackground_966 = new Background(titleStreamLoader, "titlebox", 0);
  2399.         aBackground_967 = new Background(titleStreamLoader, "titlebutton", 0);
  2400.         aBackgroundArray1152s = new Background[12];
  2401.         int j = 0;
  2402.         try {
  2403.             j = Integer.parseInt(getParameter("fl_icon"));
  2404.         } catch (Exception _ex) {
  2405.         }
  2406.         if (j == 0) {
  2407.             for (int k = 0; k < 12; k++) {
  2408.                 aBackgroundArray1152s[k] = new Background(titleStreamLoader, "runes", k);
  2409.             }
  2410.  
  2411.         } else {
  2412.             for (int l = 0; l < 12; l++) {
  2413.                 aBackgroundArray1152s[l] = new Background(titleStreamLoader, "runes", 12 + (l & 3));
  2414.             }
  2415.  
  2416.         }
  2417.         aClass30_Sub2_Sub1_Sub1_1201 = new Sprite(128, 265);
  2418.         aClass30_Sub2_Sub1_Sub1_1202 = new Sprite(128, 265);
  2419.         System.arraycopy(aRSImageProducer_1110.anIntArray315, 0, aClass30_Sub2_Sub1_Sub1_1201.pixels, 0, 33920);
  2420.  
  2421.         System.arraycopy(aRSImageProducer_1111.anIntArray315, 0, aClass30_Sub2_Sub1_Sub1_1202.pixels, 0, 33920);
  2422.  
  2423.         anIntArray851 = new int[256];
  2424.         for (int k1 = 0; k1 < 64; k1++) {
  2425.             anIntArray851[k1] = k1 * 0x40000;
  2426.         }
  2427.  
  2428.         for (int l1 = 0; l1 < 64; l1++) {
  2429.             anIntArray851[l1 + 64] = 0xff0000 + 1024 * l1;
  2430.         }
  2431.  
  2432.         for (int i2 = 0; i2 < 64; i2++) {
  2433.             anIntArray851[i2 + 128] = 0xffff00 + 4 * i2;
  2434.         }
  2435.  
  2436.         for (int j2 = 0; j2 < 64; j2++) {
  2437.             anIntArray851[j2 + 192] = 0xffffff;
  2438.         }
  2439.  
  2440.         anIntArray852 = new int[256];
  2441.         for (int k2 = 0; k2 < 64; k2++) {
  2442.             anIntArray852[k2] = k2 * 1024;
  2443.         }
  2444.  
  2445.         for (int l2 = 0; l2 < 64; l2++) {
  2446.             anIntArray852[l2 + 64] = 65280 + 4 * l2;
  2447.         }
  2448.  
  2449.         for (int i3 = 0; i3 < 64; i3++) {
  2450.             anIntArray852[i3 + 128] = 65535 + 0x40000 * i3;
  2451.         }
  2452.  
  2453.         for (int j3 = 0; j3 < 64; j3++) {
  2454.             anIntArray852[j3 + 192] = 0xffffff;
  2455.         }
  2456.  
  2457.         anIntArray853 = new int[256];
  2458.         for (int k3 = 0; k3 < 64; k3++) {
  2459.             anIntArray853[k3] = k3 * 4;
  2460.         }
  2461.  
  2462.         for (int l3 = 0; l3 < 64; l3++) {
  2463.             anIntArray853[l3 + 64] = 255 + 0x40000 * l3;
  2464.         }
  2465.  
  2466.         for (int i4 = 0; i4 < 64; i4++) {
  2467.             anIntArray853[i4 + 128] = 0xff00ff + 1024 * i4;
  2468.         }
  2469.  
  2470.         for (int j4 = 0; j4 < 64; j4++) {
  2471.             anIntArray853[j4 + 192] = 0xffffff;
  2472.         }
  2473.  
  2474.         anIntArray850 = new int[256];
  2475.         anIntArray1190 = new int[32768];
  2476.         anIntArray1191 = new int[32768];
  2477.         randomizeBackground(null);
  2478.         anIntArray828 = new int[32768];
  2479.         anIntArray829 = new int[32768];
  2480.         drawLoadingText(10, "Connecting to fileserver");
  2481.         if (!aBoolean831) {
  2482.             drawFlames = true;
  2483.             aBoolean831 = true;
  2484.             startRunnable(this, 2);
  2485.         }
  2486.     }
  2487.  
  2488.     public static void setHighMem() {
  2489.         WorldController.lowMem = false;
  2490.         Texture.lowMem = false;
  2491.         lowMem = false;
  2492.         ObjectManager.lowMem = false;
  2493.         ObjectDef.lowMem = false;
  2494.     }
  2495.  
  2496.     public void loadingStages() {
  2497.         if (lowMem && loadingStage == 2 && ObjectManager.anInt131 != plane) {
  2498.             drawTextOnScreen(null, "Loading - please wait.");
  2499.             loadingStage = 1;
  2500.             aLong824 = System.currentTimeMillis();
  2501.         }
  2502.         if (loadingStage == 1) {
  2503.             int j = method54();
  2504.             if (j != 0 && System.currentTimeMillis() - aLong824 > 0x57e40L) {
  2505.                 Signlink.reporterror(myUsername + " glcfb " + aLong1215 + "," + j + "," + lowMem + "," + decompressors[0] + "," + onDemandFetcher.getNodeCount() + "," + plane + "," + anInt1069 + "," + anInt1070);
  2506.                 aLong824 = System.currentTimeMillis();
  2507.             }
  2508.         }
  2509.         if (loadingStage == 2 && plane != anInt985) {
  2510.             anInt985 = plane;
  2511.             method24(plane);
  2512.         }
  2513.     }
  2514.  
  2515.     public int method54() {
  2516.         for (int i = 0; i < aByteArrayArray1183.length; i++) {
  2517.             if (aByteArrayArray1183[i] == null && anIntArray1235[i] != -1) {
  2518.                 return -1;
  2519.             }
  2520.             if (aByteArrayArray1247[i] == null && anIntArray1236[i] != -1) {
  2521.                 return -2;
  2522.             }
  2523.         }
  2524.  
  2525.         boolean flag = true;
  2526.         for (int j = 0; j < aByteArrayArray1183.length; j++) {
  2527.             byte abyte0[] = aByteArrayArray1247[j];
  2528.             if (abyte0 != null) {
  2529.                 int k = (anIntArray1234[j] >> 8) * 64 - baseX;
  2530.                 int l = (anIntArray1234[j] & 0xff) * 64 - baseY;
  2531.                 if (aBoolean1159) {
  2532.                     k = 10;
  2533.                     l = 10;
  2534.                 }
  2535.                 flag &= ObjectManager.method189(k, abyte0, l);
  2536.             }
  2537.         }
  2538.  
  2539.         if (!flag) {
  2540.             return -3;
  2541.         }
  2542.         if (aBoolean1080) {
  2543.             return -4;
  2544.         } else {
  2545.             loadingStage = 2;
  2546.             ObjectManager.anInt131 = plane;
  2547.             method22();
  2548.             stream.createFrame(121);
  2549.             return 0;
  2550.         }
  2551.     }
  2552.  
  2553.     public void method55() {
  2554.         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()) {
  2555.             if (class30_sub2_sub4_sub4.anInt1597 != plane || loopCycle > class30_sub2_sub4_sub4.anInt1572) {
  2556.                 class30_sub2_sub4_sub4.unlink();
  2557.             } else if (loopCycle >= class30_sub2_sub4_sub4.anInt1571) {
  2558.                 if (class30_sub2_sub4_sub4.anInt1590 > 0) {
  2559.                     NPC npc = npcArray[class30_sub2_sub4_sub4.anInt1590 - 1];
  2560.                     if (npc != null && npc.x >= 0 && npc.x < 13312 && npc.y >= 0 && npc.y < 13312) {
  2561.                         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);
  2562.                     }
  2563.                 }
  2564.                 if (class30_sub2_sub4_sub4.anInt1590 < 0) {
  2565.                     int j = -class30_sub2_sub4_sub4.anInt1590 - 1;
  2566.                     Player player;
  2567.                     if (j == unknownInt10) {
  2568.                         player = myPlayer;
  2569.                     } else {
  2570.                         player = playerArray[j];
  2571.                     }
  2572.                     if (player != null && player.x >= 0 && player.x < 13312 && player.y >= 0 && player.y < 13312) {
  2573.                         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);
  2574.                     }
  2575.                 }
  2576.                 class30_sub2_sub4_sub4.method456(anInt945);
  2577.                 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);
  2578.             }
  2579.         }
  2580.  
  2581.     }
  2582.  
  2583.     public AppletContext getAppletContext() {
  2584.         if (Signlink.mainapp != null) {
  2585.             return Signlink.mainapp.getAppletContext();
  2586.         } else {
  2587.             return super.getAppletContext();
  2588.         }
  2589.     }
  2590.  
  2591.     public void drawLogo() {
  2592.         byte abyte0[] = titleStreamLoader.getDataForName("title.dat");
  2593.         Sprite sprite = new Sprite(abyte0, this);
  2594.         aRSImageProducer_1110.initDrawingArea();
  2595.         sprite.method346(0, 0);
  2596.         aRSImageProducer_1111.initDrawingArea();
  2597.         sprite.method346(-637, 0);
  2598.         aRSImageProducer_1107.initDrawingArea();
  2599.         sprite.method346(-128, 0);
  2600.         aRSImageProducer_1108.initDrawingArea();
  2601.         sprite.method346(-202, -371);
  2602.         aRSImageProducer_1109.initDrawingArea();
  2603.         sprite.method346(-202, -171);
  2604.         aRSImageProducer_1112.initDrawingArea();
  2605.         sprite.method346(0, -265);
  2606.         aRSImageProducer_1113.initDrawingArea();
  2607.         sprite.method346(-562, -265);
  2608.         aRSImageProducer_1114.initDrawingArea();
  2609.         sprite.method346(-128, -171);
  2610.         aRSImageProducer_1115.initDrawingArea();
  2611.         sprite.method346(-562, -171);
  2612.         int ai[] = new int[sprite.width];
  2613.         for (int j = 0; j < sprite.height; j++) {
  2614.             for (int k = 0; k < sprite.width; k++) {
  2615.                 ai[k] = sprite.pixels[sprite.width - k - 1 + sprite.width * j];
  2616.             }
  2617.  
  2618.             System.arraycopy(ai, 0, sprite.pixels, sprite.width * j, sprite.width);
  2619.  
  2620.         }
  2621.  
  2622.         aRSImageProducer_1110.initDrawingArea();
  2623.         sprite.method346(382, 0);
  2624.         aRSImageProducer_1111.initDrawingArea();
  2625.         sprite.method346(-255, 0);
  2626.         aRSImageProducer_1107.initDrawingArea();
  2627.         sprite.method346(254, 0);
  2628.         aRSImageProducer_1108.initDrawingArea();
  2629.         sprite.method346(180, -371);
  2630.         aRSImageProducer_1109.initDrawingArea();
  2631.         sprite.method346(180, -171);
  2632.         aRSImageProducer_1112.initDrawingArea();
  2633.         sprite.method346(382, -265);
  2634.         aRSImageProducer_1113.initDrawingArea();
  2635.         sprite.method346(-180, -265);
  2636.         aRSImageProducer_1114.initDrawingArea();
  2637.         sprite.method346(254, -171);
  2638.         aRSImageProducer_1115.initDrawingArea();
  2639.         sprite.method346(-180, -171);
  2640.         sprite = new Sprite(titleStreamLoader, "logo", 0);
  2641.         aRSImageProducer_1107.initDrawingArea();
  2642.         sprite.drawSprite(382 - sprite.width / 2 - 128, 18);
  2643.         sprite = null;
  2644.         System.gc();
  2645.  
  2646.     }
  2647.  
  2648.     public void processOnDemandQueue() {
  2649.         do {
  2650.             OnDemandData onDemandData;
  2651.             do {
  2652.                 onDemandData = onDemandFetcher.getNextNode();
  2653.                 if (onDemandData == null) {
  2654.                     return;
  2655.                 }
  2656.                 if (onDemandData.dataType == 0) {
  2657.                     Model.method460(onDemandData.buffer, onDemandData.ID);
  2658.                     if ((onDemandFetcher.getModelIndex(onDemandData.ID) & 0x62) != 0) {
  2659.                         needDrawTabArea = true;
  2660.                         if (backDialogID != -1) {
  2661.                             inputTaken = true;
  2662.                         }
  2663.                     }
  2664.                 }
  2665.                 if (onDemandData.dataType == 1 && onDemandData.buffer != null) {
  2666.                     Class36.method529(onDemandData.buffer);
  2667.                 }
  2668.                 if (onDemandData.dataType == 2 && onDemandData.ID == nextSong && onDemandData.buffer != null) {
  2669.                     musicData = new byte[onDemandData.buffer.length];
  2670.                     System.arraycopy(onDemandData.buffer, 0, musicData, 0, musicData.length);
  2671.                     fetchMusic = true;
  2672.                 }
  2673.                 if (onDemandData.dataType == 3 && loadingStage == 1) {
  2674.                     for (int i = 0; i < aByteArrayArray1183.length; i++) {
  2675.                         if (anIntArray1235[i] == onDemandData.ID) {
  2676.                             aByteArrayArray1183[i] = onDemandData.buffer;
  2677.                             if (onDemandData.buffer == null) {
  2678.                                 anIntArray1235[i] = -1;
  2679.                             }
  2680.                             break;
  2681.                         }
  2682.                         if (anIntArray1236[i] != onDemandData.ID) {
  2683.                             continue;
  2684.                         }
  2685.                         aByteArrayArray1247[i] = onDemandData.buffer;
  2686.                         if (onDemandData.buffer == null) {
  2687.                             anIntArray1236[i] = -1;
  2688.                         }
  2689.                         break;
  2690.                     }
  2691.  
  2692.                 }
  2693.             } while (onDemandData.dataType != 93 || !onDemandFetcher.method564(onDemandData.ID));
  2694.             ObjectManager.method173(new Stream(onDemandData.buffer), onDemandFetcher);
  2695.         } while (true);
  2696.     }
  2697.  
  2698.     public void calcFlamesPosition() {
  2699.         char c = '\u0100';
  2700.         for (int j = 10; j < 117; j++) {
  2701.             int k = (int) (Math.random() * 100D);
  2702.             if (k < 50) {
  2703.                 anIntArray828[j + (c - 2 << 7)] = 255;
  2704.             }
  2705.         }
  2706.         for (int l = 0; l < 100; l++) {
  2707.             int i1 = (int) (Math.random() * 124D) + 2;
  2708.             int k1 = (int) (Math.random() * 128D) + 128;
  2709.             int k2 = i1 + (k1 << 7);
  2710.             anIntArray828[k2] = 192;
  2711.         }
  2712.  
  2713.         for (int j1 = 1; j1 < c - 1; j1++) {
  2714.             for (int l1 = 1; l1 < 127; l1++) {
  2715.                 int l2 = l1 + (j1 << 7);
  2716.                 anIntArray829[l2] = (anIntArray828[l2 - 1] + anIntArray828[l2 + 1] + anIntArray828[l2 - 128] + anIntArray828[l2 + 128]) / 4;
  2717.             }
  2718.  
  2719.         }
  2720.  
  2721.         anInt1275 += 128;
  2722.         if (anInt1275 > anIntArray1190.length) {
  2723.             anInt1275 -= anIntArray1190.length;
  2724.             int i2 = (int) (Math.random() * 12D);
  2725.             randomizeBackground(aBackgroundArray1152s[i2]);
  2726.         }
  2727.         for (int j2 = 1; j2 < c - 1; j2++) {
  2728.             for (int i3 = 1; i3 < 127; i3++) {
  2729.                 int k3 = i3 + (j2 << 7);
  2730.                 int i4 = anIntArray829[k3 + 128] - anIntArray1190[k3 + anInt1275 & anIntArray1190.length - 1] / 5;
  2731.                 if (i4 < 0) {
  2732.                     i4 = 0;
  2733.                 }
  2734.                 anIntArray828[k3] = i4;
  2735.             }
  2736.  
  2737.         }
  2738.  
  2739.         System.arraycopy(anIntArray969, 1, anIntArray969, 0, c - 1);
  2740.  
  2741.         anIntArray969[c - 1] = (int) (Math.sin((double) loopCycle / 14D) * 16D + Math.sin((double) loopCycle / 15D) * 14D + Math.sin((double) loopCycle / 16D) * 12D);
  2742.         if (anInt1040 > 0) {
  2743.             anInt1040 -= 4;
  2744.         }
  2745.         if (anInt1041 > 0) {
  2746.             anInt1041 -= 4;
  2747.         }
  2748.         if (anInt1040 == 0 && anInt1041 == 0) {
  2749.             int l3 = (int) (Math.random() * 2000D);
  2750.             if (l3 == 0) {
  2751.                 anInt1040 = 1024;
  2752.             }
  2753.             if (l3 == 1) {
  2754.                 anInt1041 = 1024;
  2755.             }
  2756.         }
  2757.     }
  2758.  
  2759.     public boolean saveWave(byte abyte0[], int i) {
  2760.         return abyte0 == null || Signlink.wavesave(abyte0, i);
  2761.     }
  2762.  
  2763.     public void method60(int i) {
  2764.         RSInterface class9 = RSInterface.interfaceCache[i];
  2765.         for (int element : class9.children) {
  2766.             if (element == -1) {
  2767.                 break;
  2768.             }
  2769.             RSInterface class9_1 = RSInterface.interfaceCache[element];
  2770.             if (class9_1.type == 1) {
  2771.                 method60(class9_1.id);
  2772.             }
  2773.             class9_1.anInt246 = 0;
  2774.             class9_1.anInt208 = 0;
  2775.         }
  2776.     }
  2777.  
  2778.     public void drawHeadIcon() {
  2779.         if (anInt855 != 2) {
  2780.             return;
  2781.         }
  2782.         calcEntityScreenPos((anInt934 - baseX << 7) + anInt937, anInt936 * 2, (anInt935 - baseY << 7) + anInt938);
  2783.         if (spriteDrawX > -1 && loopCycle % 20 < 10) {
  2784.             headIconsHint[0].drawSprite(spriteDrawX - 12, spriteDrawY - 28);
  2785.         }
  2786.     }
  2787.  
  2788.     public void mainGameProcessor() {
  2789.         if (anInt1104 > 1) {
  2790.             anInt1104--;
  2791.         }
  2792.         if (anInt1011 > 0) {
  2793.             anInt1011--;
  2794.         }
  2795.         for (int j = 0; j < 5; j++) {
  2796.             if (!parsePacket()) {
  2797.                 break;
  2798.             }
  2799.         }
  2800.  
  2801.         if (!loggedIn) {
  2802.             return;
  2803.         }
  2804.         synchronized (mouseDetection.syncObject) {
  2805.             if (flagged) {
  2806.                 if (super.clickMode3 != 0 || mouseDetection.coordsIndex >= 40) {
  2807.                     stream.createFrame(45);
  2808.                     stream.writeWordBigEndian(0);
  2809.                     int j2 = stream.currentOffset;
  2810.                     int j3 = 0;
  2811.                     for (int j4 = 0; j4 < mouseDetection.coordsIndex; j4++) {
  2812.                         if (j2 - stream.currentOffset >= 240) {
  2813.                             break;
  2814.                         }
  2815.                         j3++;
  2816.                         int l4 = mouseDetection.coordsY[j4];
  2817.                         if (l4 < 0) {
  2818.                             l4 = 0;
  2819.                         } else if (l4 > 502) {
  2820.                             l4 = 502;
  2821.                         }
  2822.                         int k5 = mouseDetection.coordsX[j4];
  2823.                         if (k5 < 0) {
  2824.                             k5 = 0;
  2825.                         } else if (k5 > 764) {
  2826.                             k5 = 764;
  2827.                         }
  2828.                         int i6 = l4 * 765 + k5;
  2829.                         if (mouseDetection.coordsY[j4] == -1 && mouseDetection.coordsX[j4] == -1) {
  2830.                             k5 = -1;
  2831.                             l4 = -1;
  2832.                             i6 = 0x7ffff;
  2833.                         }
  2834.                         if (k5 == anInt1237 && l4 == anInt1238) {
  2835.                             if (anInt1022 < 2047) {
  2836.                                 anInt1022++;
  2837.                             }
  2838.                         } else {
  2839.                             int j6 = k5 - anInt1237;
  2840.                             anInt1237 = k5;
  2841.                             int k6 = l4 - anInt1238;
  2842.                             anInt1238 = l4;
  2843.                             if (anInt1022 < 8 && j6 >= -32 && j6 <= 31 && k6 >= -32 && k6 <= 31) {
  2844.                                 j6 += 32;
  2845.                                 k6 += 32;
  2846.                                 stream.writeWord((anInt1022 << 12) + (j6 << 6) + k6);
  2847.                                 anInt1022 = 0;
  2848.                             } else if (anInt1022 < 8) {
  2849.                                 stream.writeDWordBigEndian(0x800000 + (anInt1022 << 19) + i6);
  2850.                                 anInt1022 = 0;
  2851.                             } else {
  2852.                                 stream.writeDWord(0xc0000000 + (anInt1022 << 19) + i6);
  2853.                                 anInt1022 = 0;
  2854.                             }
  2855.                         }
  2856.                     }
  2857.  
  2858.                     stream.writeBytes(stream.currentOffset - j2);
  2859.                     if (j3 >= mouseDetection.coordsIndex) {
  2860.                         mouseDetection.coordsIndex = 0;
  2861.                     } else {
  2862.                         mouseDetection.coordsIndex -= j3;
  2863.                         for (int i5 = 0; i5 < mouseDetection.coordsIndex; i5++) {
  2864.                             mouseDetection.coordsX[i5] = mouseDetection.coordsX[i5 + j3];
  2865.                             mouseDetection.coordsY[i5] = mouseDetection.coordsY[i5 + j3];
  2866.                         }
  2867.  
  2868.                     }
  2869.                 }
  2870.             } else {
  2871.                 mouseDetection.coordsIndex = 0;
  2872.             }
  2873.         }
  2874.         if (super.clickMode3 != 0) {
  2875.             long l = (super.aLong29 - aLong1220) / 50L;
  2876.             if (l > 4095L) {
  2877.                 l = 4095L;
  2878.             }
  2879.             aLong1220 = super.aLong29;
  2880.             int k2 = super.saveClickY;
  2881.             if (k2 < 0) {
  2882.                 k2 = 0;
  2883.             } else if (k2 > 502) {
  2884.                 k2 = 502;
  2885.             }
  2886.             int k3 = super.saveClickX;
  2887.             if (k3 < 0) {
  2888.                 k3 = 0;
  2889.             } else if (k3 > 764) {
  2890.                 k3 = 764;
  2891.             }
  2892.             int k4 = k2 * 765 + k3;
  2893.             int j5 = 0;
  2894.             if (super.clickMode3 == 2) {
  2895.                 j5 = 1;
  2896.             }
  2897.             int l5 = (int) l;
  2898.             stream.createFrame(241);
  2899.             stream.writeDWord((l5 << 20) + (j5 << 19) + k4);
  2900.         }
  2901.         if (anInt1016 > 0) {
  2902.             anInt1016--;
  2903.         }
  2904.         if (super.keyArray[1] == 1 || super.keyArray[2] == 1 || super.keyArray[3] == 1 || super.keyArray[4] == 1) {
  2905.             aBoolean1017 = true;
  2906.         }
  2907.         if (aBoolean1017 && anInt1016 <= 0) {
  2908.             anInt1016 = 20;
  2909.             aBoolean1017 = false;
  2910.             stream.createFrame(86);
  2911.             stream.writeWord(anInt1184);
  2912.             stream.method432(minimapInt1);
  2913.         }
  2914.         if (super.awtFocus && !aBoolean954) {
  2915.             aBoolean954 = true;
  2916.             stream.createFrame(3);
  2917.             stream.writeWordBigEndian(1);
  2918.         }
  2919.         if (!super.awtFocus && aBoolean954) {
  2920.             aBoolean954 = false;
  2921.             stream.createFrame(3);
  2922.             stream.writeWordBigEndian(0);
  2923.         }
  2924.         loadingStages();
  2925.         method115();
  2926.         method90();
  2927.         anInt1009++;
  2928.         if (anInt1009 > 750) {
  2929.             dropClient();
  2930.         }
  2931.         method114();
  2932.         method95();
  2933.         method38();
  2934.         anInt945++;
  2935.         if (crossType != 0) {
  2936.             crossIndex += 20;
  2937.             if (crossIndex >= 400) {
  2938.                 crossType = 0;
  2939.             }
  2940.         }
  2941.         if (atInventoryInterfaceType != 0) {
  2942.             atInventoryLoopCycle++;
  2943.             if (atInventoryLoopCycle >= 15) {
  2944.                 if (atInventoryInterfaceType == 2) {
  2945.                     needDrawTabArea = true;
  2946.                 }
  2947.                 if (atInventoryInterfaceType == 3) {
  2948.                     inputTaken = true;
  2949.                 }
  2950.                 atInventoryInterfaceType = 0;
  2951.             }
  2952.         }
  2953.         if (activeInterfaceType != 0) {
  2954.             anInt989++;
  2955.             if (super.mouseX > anInt1087 + 5 || super.mouseX < anInt1087 - 5 || super.mouseY > anInt1088 + 5 || super.mouseY < anInt1088 - 5) {
  2956.                 aBoolean1242 = true;
  2957.             }
  2958.             if (super.clickMode2 == 0) {
  2959.                 if (activeInterfaceType == 2) {
  2960.                     needDrawTabArea = true;
  2961.                 }
  2962.                 if (activeInterfaceType == 3) {
  2963.                     inputTaken = true;
  2964.                 }
  2965.                 activeInterfaceType = 0;
  2966.                 if (aBoolean1242 && anInt989 >= 5) {
  2967.                     lastActiveInvInterface = -1;
  2968.                     processRightClick();
  2969.                     if (lastActiveInvInterface == anInt1084 && mouseInvInterfaceIndex != anInt1085) {
  2970.                         RSInterface class9 = RSInterface.interfaceCache[anInt1084];
  2971.                         int j1 = 0;
  2972.                         if (anInt913 == 1 && class9.anInt214 == 206) {
  2973.                             j1 = 1;
  2974.                         }
  2975.                         if (class9.inv[mouseInvInterfaceIndex] <= 0) {
  2976.                             j1 = 0;
  2977.                         }
  2978.                         if (class9.aBoolean235) {
  2979.                             int l2 = anInt1085;
  2980.                             int l3 = mouseInvInterfaceIndex;
  2981.                             class9.inv[l3] = class9.inv[l2];
  2982.                             class9.invStackSizes[l3] = class9.invStackSizes[l2];
  2983.                             class9.inv[l2] = -1;
  2984.                             class9.invStackSizes[l2] = 0;
  2985.                         } else if (j1 == 1) {
  2986.                             int i3 = anInt1085;
  2987.                             for (int i4 = mouseInvInterfaceIndex; i3 != i4;) {
  2988.                                 if (i3 > i4) {
  2989.                                     class9.swapInventoryItems(i3, i3 - 1);
  2990.                                     i3--;
  2991.                                 } else if (i3 < i4) {
  2992.                                     class9.swapInventoryItems(i3, i3 + 1);
  2993.                                     i3++;
  2994.                                 }
  2995.                             }
  2996.  
  2997.                         } else {
  2998.                             class9.swapInventoryItems(anInt1085, mouseInvInterfaceIndex);
  2999.                         }
  3000.                         stream.createFrame(214);
  3001.                         stream.method433(anInt1084);
  3002.                         stream.method424(j1);
  3003.                         stream.method433(anInt1085);
  3004.                         stream.method431(mouseInvInterfaceIndex);
  3005.                     }
  3006.                 } else if ((anInt1253 == 1 || menuHasAddFriend(menuActionRow - 1)) && menuActionRow > 2) {
  3007.                     determineMenuSize();
  3008.                 } else if (menuActionRow > 0) {
  3009.                     doAction(menuActionRow - 1);
  3010.                 }
  3011.                 atInventoryLoopCycle = 10;
  3012.                 super.clickMode3 = 0;
  3013.             }
  3014.         }
  3015.         if (WorldController.anInt470 != -1) {
  3016.             int k = WorldController.anInt470;
  3017.             int k1 = WorldController.anInt471;
  3018.             boolean flag = doWalkTo(0, 0, 0, 0, myPlayer.smallY[0], 0, 0, k1, myPlayer.smallX[0], true, k);
  3019.             WorldController.anInt470 = -1;
  3020.             if (flag) {
  3021.                 crossX = super.saveClickX;
  3022.                 crossY = super.saveClickY;
  3023.                 crossType = 1;
  3024.                 crossIndex = 0;
  3025.             }
  3026.         }
  3027.         if (super.clickMode3 == 1 && aString844 != null) {
  3028.             aString844 = null;
  3029.             inputTaken = true;
  3030.             super.clickMode3 = 0;
  3031.         }
  3032.         processMenuClick();
  3033.         if (fullScreenBackDialogID == -1) {
  3034.             processMainScreenClick();
  3035.             processTabClick();
  3036.             processChatModeClick();
  3037.         }
  3038.         if (super.clickMode2 == 1 || super.clickMode3 == 1) {
  3039.             anInt1213++;
  3040.         }
  3041.         if (loadingStage == 2) {
  3042.             method108();
  3043.         }
  3044.         if (loadingStage == 2 && aBoolean1160) {
  3045.             calcCameraPos();
  3046.         }
  3047.         for (int i1 = 0; i1 < 5; i1++) {
  3048.             anIntArray1030[i1]++;
  3049.         }
  3050.  
  3051.         method73();
  3052.         super.idleTime++;
  3053.         if (super.idleTime > 12000) {
  3054.             anInt1011 = 250;
  3055.             super.idleTime -= 500;
  3056.             stream.createFrame(202);
  3057.         }
  3058.         anInt988++;
  3059.         if (anInt988 > 500) {
  3060.             anInt988 = 0;
  3061.             int l1 = (int) (Math.random() * 8D);
  3062.             if ((l1 & 1) == 1) {
  3063.                 anInt1278 += anInt1279;
  3064.             }
  3065.             if ((l1 & 2) == 2) {
  3066.                 anInt1131 += anInt1132;
  3067.             }
  3068.             if ((l1 & 4) == 4) {
  3069.                 anInt896 += anInt897;
  3070.             }
  3071.         }
  3072.         if (anInt1278 < -50) {
  3073.             anInt1279 = 2;
  3074.         }
  3075.         if (anInt1278 > 50) {
  3076.             anInt1279 = -2;
  3077.         }
  3078.         if (anInt1131 < -55) {
  3079.             anInt1132 = 2;
  3080.         }
  3081.         if (anInt1131 > 55) {
  3082.             anInt1132 = -2;
  3083.         }
  3084.         if (anInt896 < -40) {
  3085.             anInt897 = 1;
  3086.         }
  3087.         if (anInt896 > 40) {
  3088.             anInt897 = -1;
  3089.         }
  3090.         anInt1254++;
  3091.         if (anInt1254 > 500) {
  3092.             anInt1254 = 0;
  3093.             int i2 = (int) (Math.random() * 8D);
  3094.             if ((i2 & 1) == 1) {
  3095.                 minimapInt2 += anInt1210;
  3096.             }
  3097.             if ((i2 & 2) == 2) {
  3098.                 minimapInt3 += anInt1171;
  3099.             }
  3100.         }
  3101.         if (minimapInt2 < -60) {
  3102.             anInt1210 = 2;
  3103.         }
  3104.         if (minimapInt2 > 60) {
  3105.             anInt1210 = -2;
  3106.         }
  3107.         if (minimapInt3 < -20) {
  3108.             anInt1171 = 1;
  3109.         }
  3110.         if (minimapInt3 > 10) {
  3111.             anInt1171 = -1;
  3112.         }
  3113.         anInt1010++;
  3114.         if (anInt1010 > 50) {
  3115.             stream.createFrame(0);
  3116.         }
  3117.         try {
  3118.             if (socketStream != null && stream.currentOffset > 0) {
  3119.                 socketStream.queueBytes(stream.currentOffset, stream.buffer);
  3120.                 stream.currentOffset = 0;
  3121.                 anInt1010 = 0;
  3122.             }
  3123.         } catch (IOException _ex) {
  3124.             dropClient();
  3125.         } catch (Exception exception) {
  3126.             resetLogout();
  3127.         }
  3128.     }
  3129.  
  3130.     public void method63() {
  3131.         Class30_Sub1 class30_sub1 = (Class30_Sub1) aClass19_1179.reverseGetFirst();
  3132.         for (; class30_sub1 != null; class30_sub1 = (Class30_Sub1) aClass19_1179.reverseGetNext()) {
  3133.             if (class30_sub1.anInt1294 == -1) {
  3134.                 class30_sub1.anInt1302 = 0;
  3135.                 method89(class30_sub1);
  3136.             } else {
  3137.                 class30_sub1.unlink();
  3138.             }
  3139.         }
  3140.  
  3141.     }
  3142.  
  3143.     void drawLoadingText(int i, String s) {
  3144.         anInt1079 = i;
  3145.         aString1049 = s;
  3146.         resetImageProducers();
  3147.         if (titleStreamLoader == null) {
  3148.             super.drawLoadingText(i, s);
  3149.             return;
  3150.         }
  3151.         aRSImageProducer_1109.initDrawingArea();
  3152.         char c = '\u0168';
  3153.         char c1 = '\310';
  3154.         byte byte1 = 20;
  3155.         chatTextDrawingArea.drawText(0xffffff, "" + ClientSettings.SERVER_NAME + " is loading - please wait...", c1 / 2 - 26 - byte1, c / 2);
  3156.         int j = c1 / 2 - 18 - byte1;
  3157.         DrawingArea.fillPixels(j, 34, 0x8c1111, c / 2 - 152, 304);
  3158.         DrawingArea.fillPixels(j + 1, 32, 0, c / 2 - 151, 302);
  3159.         DrawingArea.method336(30, j + 2, 0x8c1111, i * 3, c / 2 - 150);
  3160.         DrawingArea.method336(30, j + 2, 0, 300 - i * 3, c / 2 - 150 + i * 3);
  3161.         chatTextDrawingArea.drawText(0xffffff, s, c1 / 2 + 5 - byte1, c / 2);
  3162.         aRSImageProducer_1109.drawGraphics(171, super.graphics, 202);
  3163.         if (welcomeScreenRaised) {
  3164.             welcomeScreenRaised = false;
  3165.             if (!aBoolean831) {
  3166.                 aRSImageProducer_1110.drawGraphics(0, super.graphics, 0);
  3167.                 aRSImageProducer_1111.drawGraphics(0, super.graphics, 637);
  3168.             }
  3169.             aRSImageProducer_1107.drawGraphics(0, super.graphics, 128);
  3170.             aRSImageProducer_1108.drawGraphics(371, super.graphics, 202);
  3171.             aRSImageProducer_1112.drawGraphics(265, super.graphics, 0);
  3172.             aRSImageProducer_1113.drawGraphics(265, super.graphics, 562);
  3173.             aRSImageProducer_1114.drawGraphics(171, super.graphics, 128);
  3174.             aRSImageProducer_1115.drawGraphics(171, super.graphics, 562);
  3175.         }
  3176.     }
  3177.  
  3178.     public void method65(int i, int j, int k, int l, RSInterface class9, int i1, boolean flag, int j1) {
  3179.         int anInt992;
  3180.         if (aBoolean972) {
  3181.             anInt992 = 32;
  3182.         } else {
  3183.             anInt992 = 0;
  3184.         }
  3185.         aBoolean972 = false;
  3186.         if (k >= i && k < i + 16 && l >= i1 && l < i1 + 16) {
  3187.             class9.scrollPosition -= anInt1213 * 4;
  3188.             if (flag) {
  3189.                 needDrawTabArea = true;
  3190.             }
  3191.         } else if (k >= i && k < i + 16 && l >= i1 + j - 16 && l < i1 + j) {
  3192.             class9.scrollPosition += anInt1213 * 4;
  3193.             if (flag) {
  3194.                 needDrawTabArea = true;
  3195.             }
  3196.         } else if (k >= i - anInt992 && k < i + 16 + anInt992 && l >= i1 + 16 && l < i1 + j - 16 && anInt1213 > 0) {
  3197.             int l1 = (j - 32) * j / j1;
  3198.             if (l1 < 8) {
  3199.                 l1 = 8;
  3200.             }
  3201.             int i2 = l - i1 - 16 - l1 / 2;
  3202.             int j2 = j - 32 - l1;
  3203.             class9.scrollPosition = (j1 - j) * i2 / j2;
  3204.             if (flag) {
  3205.                 needDrawTabArea = true;
  3206.             }
  3207.             aBoolean972 = true;
  3208.         }
  3209.     }
  3210.  
  3211.     public boolean method66(int i, int j, int k) {
  3212.         int i1 = i >> 14 & 0x7fff;
  3213.         int j1 = worldController.method304(plane, k, j, i);
  3214.         if (j1 == -1) {
  3215.             return false;
  3216.         }
  3217.         int k1 = j1 & 0x1f;
  3218.         int l1 = j1 >> 6 & 3;
  3219.         if (k1 == 10 || k1 == 11 || k1 == 22) {
  3220.             ObjectDef class46 = ObjectDef.forID(i1);
  3221.             int i2;
  3222.             int j2;
  3223.             if (l1 == 0 || l1 == 2) {
  3224.                 i2 = class46.anInt744;
  3225.                 j2 = class46.anInt761;
  3226.             } else {
  3227.                 i2 = class46.anInt761;
  3228.                 j2 = class46.anInt744;
  3229.             }
  3230.             int k2 = class46.anInt768;
  3231.             if (l1 != 0) {
  3232.                 k2 = (k2 << l1 & 0xf) + (k2 >> 4 - l1);
  3233.             }
  3234.             doWalkTo(2, 0, j2, 0, myPlayer.smallY[0], i2, k2, j, myPlayer.smallX[0], false, k);
  3235.         } else {
  3236.             doWalkTo(2, l1, 0, k1 + 1, myPlayer.smallY[0], 0, 0, j, myPlayer.smallX[0], false, k);
  3237.         }
  3238.         crossX = super.saveClickX;
  3239.         crossY = super.saveClickY;
  3240.         crossType = 2;
  3241.         crossIndex = 0;
  3242.         return true;
  3243.     }
  3244.  
  3245.     public StreamLoader streamLoaderForName(int i, String s, String s1, int j, int k) {
  3246.         byte abyte0[] = null;
  3247.         int l = 5;
  3248.         try {
  3249.             if (decompressors[0] != null) {
  3250.                 abyte0 = decompressors[0].decompress(i);
  3251.             }
  3252.         } catch (Exception _ex) {
  3253.         }
  3254.         if (abyte0 != null) {
  3255.             // aCRC32_930.reset();
  3256.             // aCRC32_930.update(abyte0);
  3257.             // int i1 = (int)aCRC32_930.getValue();
  3258.             // if(i1 != j)
  3259.         }
  3260.         if (abyte0 != null) {
  3261.             StreamLoader streamLoader = new StreamLoader(abyte0);
  3262.             return streamLoader;
  3263.         }
  3264.         int j1 = 0;
  3265.         while (abyte0 == null) {
  3266.             String s2 = "Unknown error";
  3267.             drawLoadingText(k, "Requesting " + s);
  3268.             try {
  3269.                 int k1 = 0;
  3270.                 DataInputStream datainputstream = openJagGrabInputStream(s1 + j);
  3271.                 byte abyte1[] = new byte[6];
  3272.                 datainputstream.readFully(abyte1, 0, 6);
  3273.                 Stream stream = new Stream(abyte1);
  3274.                 stream.currentOffset = 3;
  3275.                 int i2 = stream.read3Bytes() + 6;
  3276.                 int j2 = 6;
  3277.                 abyte0 = new byte[i2];
  3278.                 System.arraycopy(abyte1, 0, abyte0, 0, 6);
  3279.  
  3280.                 while (j2 < i2) {
  3281.                     int l2 = i2 - j2;
  3282.                     if (l2 > 1000) {
  3283.                         l2 = 1000;
  3284.                     }
  3285.                     int j3 = datainputstream.read(abyte0, j2, l2);
  3286.                     if (j3 < 0) {
  3287.                         s2 = "Length error: " + j2 + "/" + i2;
  3288.                         throw new IOException("EOF");
  3289.                     }
  3290.                     j2 += j3;
  3291.                     int k3 = j2 * 100 / i2;
  3292.                     if (k3 != k1) {
  3293.                         drawLoadingText(k, "Loading " + s + " - " + k3 + "%");
  3294.                     }
  3295.                     k1 = k3;
  3296.                 }
  3297.                 datainputstream.close();
  3298.                 try {
  3299.                     if (decompressors[0] != null) {
  3300.                         decompressors[0].method234(abyte0.length, abyte0, i);
  3301.                     }
  3302.                 } catch (Exception _ex) {
  3303.                     decompressors[0] = null;
  3304.                 }
  3305.                 /*
  3306.                  * if(abyte0 != null) { aCRC32_930.reset();
  3307.                  * aCRC32_930.update(abyte0); int i3 =
  3308.                  * (int)aCRC32_930.getValue(); if(i3 != j) { abyte0 = null;
  3309.                  * j1++; s2 = "Checksum error: " + i3; } }
  3310.                  */
  3311.             } catch (IOException ioexception) {
  3312.                 if (s2.equals("Unknown error")) {
  3313.                     s2 = "Connection error";
  3314.                 }
  3315.                 abyte0 = null;
  3316.             } catch (NullPointerException _ex) {
  3317.                 s2 = "Null error";
  3318.                 abyte0 = null;
  3319.                 if (!Signlink.reporterror) {
  3320.                     return null;
  3321.                 }
  3322.             } catch (ArrayIndexOutOfBoundsException _ex) {
  3323.                 s2 = "Bounds error";
  3324.                 abyte0 = null;
  3325.                 if (!Signlink.reporterror) {
  3326.                     return null;
  3327.                 }
  3328.             } catch (Exception _ex) {
  3329.                 s2 = "Unexpected error";
  3330.                 abyte0 = null;
  3331.                 if (!Signlink.reporterror) {
  3332.                     return null;
  3333.                 }
  3334.             }
  3335.             if (abyte0 == null) {
  3336.                 for (int l1 = l; l1 > 0; l1--) {
  3337.                     if (j1 >= 3) {
  3338.                         drawLoadingText(k, "Game updated - please reload page");
  3339.                         l1 = 10;
  3340.                     } else {
  3341.                         drawLoadingText(k, s2 + " - Retrying in " + l1);
  3342.                     }
  3343.                     try {
  3344.                         Thread.sleep(1000L);
  3345.                     } catch (Exception _ex) {
  3346.                     }
  3347.                 }
  3348.  
  3349.                 l *= 2;
  3350.                 if (l > 60) {
  3351.                     l = 60;
  3352.                 }
  3353.                 aBoolean872 = !aBoolean872;
  3354.             }
  3355.  
  3356.         }
  3357.  
  3358.         StreamLoader streamLoader_1 = new StreamLoader(abyte0);
  3359.         return streamLoader_1;
  3360.     }
  3361.  
  3362.     public void dropClient() {
  3363.         if (anInt1011 > 0) {
  3364.             resetLogout();
  3365.             return;
  3366.         }
  3367.         drawTextOnScreen("Please wait - attempting to reestablish", "Connection lost");
  3368.         anInt1021 = 0;
  3369.         destX = 0;
  3370.         RSSocket rsSocket = socketStream;
  3371.         loggedIn = false;
  3372.         loginFailures = 0;
  3373.         login(myUsername, myPassword, true);
  3374.         if (!loggedIn) {
  3375.             resetLogout();
  3376.         }
  3377.         try {
  3378.             rsSocket.close();
  3379.         } catch (Exception _ex) {
  3380.         }
  3381.     }
  3382.    
  3383.     public void drawTextOnScreen(String s, String s1) {
  3384.         if (aRSImageProducer_1165 != null) {
  3385.             aRSImageProducer_1165.initDrawingArea();
  3386.             Texture.lineOffsets = chatBoxAreaOffsets;
  3387.             int j = 151;
  3388.             if (s != null)
  3389.                 j -= 7;
  3390.             aTextDrawingArea_1271.drawText(0, s1, j, 257);
  3391.             aTextDrawingArea_1271.drawText(0xffffff, s1, j - 1, 256);
  3392.             j += 15;
  3393.             if (s != null) {
  3394.                 aTextDrawingArea_1271.drawText(0, s, j, 257);
  3395.                 aTextDrawingArea_1271.drawText(0xffffff, s, j - 1, 256);
  3396.             }
  3397.             aRSImageProducer_1165.drawGraphics(4, super.graphics, 4);
  3398.             return;
  3399.         }
  3400.         if (super.fullGameScreen != null) {
  3401.             super.fullGameScreen.initDrawingArea();
  3402.             Texture.lineOffsets = gameScreenOffsets;
  3403.             int k = 251;
  3404.             char c = '\u012C';
  3405.             byte byte0 = 50;
  3406.             DrawingArea.method336(byte0, k - 5 - byte0 / 2, 0, c, 383 - c / 2);
  3407.             DrawingArea.fillPixels(k - 5 - byte0 / 2, byte0, 0xffffff, 383 - c / 2, c);
  3408.             if (s != null)
  3409.                 k -= 7;
  3410.             aTextDrawingArea_1271.drawText(0, s1, k, 383);
  3411.             aTextDrawingArea_1271.drawText(0xffffff, s1, k - 1, 382);
  3412.             k += 15;
  3413.             if (s != null) {
  3414.                 aTextDrawingArea_1271.drawText(0, s, k, 383);
  3415.                 aTextDrawingArea_1271.drawText(0xffffff, s, k - 1, 382);
  3416.             }
  3417.             super.fullGameScreen.drawGraphics(0, super.graphics, 0);
  3418.         }
  3419.     }
  3420.  
  3421.     public void doAction(int i) {
  3422.         if (i < 0) {
  3423.             return;
  3424.         }
  3425.         if (inputDialogState != 0) {
  3426.             inputDialogState = 0;
  3427.             inputTaken = true;
  3428.         }
  3429.         int j = menuActionCmd2[i];
  3430.         int k = menuActionCmd3[i];
  3431.         int l = menuActionID[i];
  3432.         int i1 = menuActionCmd1[i];
  3433.         if (l >= 2000) {
  3434.             l -= 2000;
  3435.         }
  3436.         if (l == 582) {
  3437.             NPC npc = npcArray[i1];
  3438.             if (npc != null) {
  3439.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, npc.smallY[0], myPlayer.smallX[0], false, npc.smallX[0]);
  3440.                 crossX = super.saveClickX;
  3441.                 crossY = super.saveClickY;
  3442.                 crossType = 2;
  3443.                 crossIndex = 0;
  3444.                 stream.createFrame(57);
  3445.                 stream.method432(anInt1285);
  3446.                 stream.method432(i1);
  3447.                 stream.method431(anInt1283);
  3448.                 stream.method432(anInt1284);
  3449.             }
  3450.         }
  3451.         if (l == 234) {
  3452.             boolean flag1 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k, myPlayer.smallX[0], false, j);
  3453.             if (!flag1) {
  3454.                 flag1 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k, myPlayer.smallX[0], false, j);
  3455.             }
  3456.             crossX = super.saveClickX;
  3457.             crossY = super.saveClickY;
  3458.             crossType = 2;
  3459.             crossIndex = 0;
  3460.             stream.createFrame(236);
  3461.             stream.method431(k + baseY);
  3462.             stream.writeWord(i1);
  3463.             stream.method431(j + baseX);
  3464.         }
  3465.         if (l == 62 && method66(i1, k, j)) {
  3466.             stream.createFrame(192);
  3467.             stream.writeWord(anInt1284);
  3468.             stream.method431(i1 >> 14 & 0x7fff);
  3469.             stream.method433(k + baseY);
  3470.             stream.method431(anInt1283);
  3471.             stream.method433(j + baseX);
  3472.             stream.writeWord(anInt1285);
  3473.         }
  3474.         if (l == 511) {
  3475.             boolean flag2 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k, myPlayer.smallX[0], false, j);
  3476.             if (!flag2) {
  3477.                 flag2 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k, myPlayer.smallX[0], false, j);
  3478.             }
  3479.             crossX = super.saveClickX;
  3480.             crossY = super.saveClickY;
  3481.             crossType = 2;
  3482.             crossIndex = 0;
  3483.             stream.createFrame(25);
  3484.             stream.method431(anInt1284);
  3485.             stream.method432(anInt1285);
  3486.             stream.writeWord(i1);
  3487.             stream.method432(k + baseY);
  3488.             stream.method433(anInt1283);
  3489.             stream.writeWord(j + baseX);
  3490.         }
  3491.         if (l == 74) {
  3492.             stream.createFrame(122);
  3493.             stream.method433(k);
  3494.             stream.method432(j);
  3495.             stream.method431(i1);
  3496.             atInventoryLoopCycle = 0;
  3497.             atInventoryInterface = k;
  3498.             atInventoryIndex = j;
  3499.             atInventoryInterfaceType = 2;
  3500.             if (RSInterface.interfaceCache[k].parentID == openInterfaceID) {
  3501.                 atInventoryInterfaceType = 1;
  3502.             }
  3503.             if (RSInterface.interfaceCache[k].parentID == backDialogID) {
  3504.                 atInventoryInterfaceType = 3;
  3505.             }
  3506.         }
  3507.         if (l == 315) {
  3508.             RSInterface class9 = RSInterface.interfaceCache[k];
  3509.             boolean flag8 = true;
  3510.             if (class9.anInt214 > 0) {
  3511.                 flag8 = promptUserForInput(class9);
  3512.             }
  3513.             if (flag8) {
  3514.                 stream.createFrame(185);
  3515.                 stream.writeWord(k);
  3516.             }
  3517.         }
  3518.         if (l == 561) {
  3519.             Player player = playerArray[i1];
  3520.             if (player != null) {
  3521.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, player.smallY[0], myPlayer.smallX[0], false, player.smallX[0]);
  3522.                 crossX = super.saveClickX;
  3523.                 crossY = super.saveClickY;
  3524.                 crossType = 2;
  3525.                 crossIndex = 0;
  3526.                 anInt1188 += i1;
  3527.                 if (anInt1188 >= 90) {
  3528.                     stream.createFrame(136);
  3529.                     anInt1188 = 0;
  3530.                 }
  3531.                 stream.createFrame(128);
  3532.                 stream.writeWord(i1);
  3533.             }
  3534.         }
  3535.         if (l == 20) {
  3536.             NPC class30_sub2_sub4_sub1_sub1_1 = npcArray[i1];
  3537.             if (class30_sub2_sub4_sub1_sub1_1 != null) {
  3538.                 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]);
  3539.                 crossX = super.saveClickX;
  3540.                 crossY = super.saveClickY;
  3541.                 crossType = 2;
  3542.                 crossIndex = 0;
  3543.                 stream.createFrame(155);
  3544.                 stream.method431(i1);
  3545.             }
  3546.         }
  3547.         if (l == 779) {
  3548.             Player class30_sub2_sub4_sub1_sub2_1 = playerArray[i1];
  3549.             if (class30_sub2_sub4_sub1_sub2_1 != null) {
  3550.                 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]);
  3551.                 crossX = super.saveClickX;
  3552.                 crossY = super.saveClickY;
  3553.                 crossType = 2;
  3554.                 crossIndex = 0;
  3555.                 stream.createFrame(153);
  3556.                 stream.method431(i1);
  3557.             }
  3558.         }
  3559.         if (l == 516) {
  3560.             if (!menuOpen) {
  3561.                 worldController.method312(super.saveClickY - 4, super.saveClickX - 4);
  3562.             } else {
  3563.                 worldController.method312(k - 4, j - 4);
  3564.             }
  3565.         }
  3566.         if (l == 1062) {
  3567.             anInt924 += baseX;
  3568.             if (anInt924 >= 113) {
  3569.                 stream.createFrame(183);
  3570.                 stream.writeDWordBigEndian(0xe63271);
  3571.                 anInt924 = 0;
  3572.             }
  3573.             method66(i1, k, j);
  3574.             stream.createFrame(228);
  3575.             stream.method432(i1 >> 14 & 0x7fff);
  3576.             stream.method432(k + baseY);
  3577.             stream.writeWord(j + baseX);
  3578.         }
  3579.         if (l == 679 && !aBoolean1149) {
  3580.             stream.createFrame(40);
  3581.             stream.writeWord(k);
  3582.             aBoolean1149 = true;
  3583.         }
  3584.         if (l == 431) {
  3585.             stream.createFrame(129);
  3586.             stream.method432(j);
  3587.             stream.writeWord(k);
  3588.             stream.method432(i1);
  3589.             atInventoryLoopCycle = 0;
  3590.             atInventoryInterface = k;
  3591.             atInventoryIndex = j;
  3592.             atInventoryInterfaceType = 2;
  3593.             if (RSInterface.interfaceCache[k].parentID == openInterfaceID) {
  3594.                 atInventoryInterfaceType = 1;
  3595.             }
  3596.             if (RSInterface.interfaceCache[k].parentID == backDialogID) {
  3597.                 atInventoryInterfaceType = 3;
  3598.             }
  3599.         }
  3600.         if (l == 337 || l == 42 || l == 792 || l == 322) {
  3601.             String s = menuActionName[i];
  3602.             int k1 = s.indexOf("@whi@");
  3603.             if (k1 != -1) {
  3604.                 long l3 = TextClass.longForName(s.substring(k1 + 5).trim());
  3605.                 if (l == 337) {
  3606.                     addFriend(l3);
  3607.                 }
  3608.                 if (l == 42) {
  3609.                     addIgnore(l3);
  3610.                 }
  3611.                 if (l == 792) {
  3612.                     delFriend(l3);
  3613.                 }
  3614.                 if (l == 322) {
  3615.                     delIgnore(l3);
  3616.                 }
  3617.             }
  3618.         }
  3619.         if (l == 53) {
  3620.             stream.createFrame(135);
  3621.             stream.method431(j);
  3622.             stream.method432(k);
  3623.             stream.method431(i1);
  3624.             atInventoryLoopCycle = 0;
  3625.             atInventoryInterface = k;
  3626.             atInventoryIndex = j;
  3627.             atInventoryInterfaceType = 2;
  3628.             if (RSInterface.interfaceCache[k].parentID == openInterfaceID) {
  3629.                 atInventoryInterfaceType = 1;
  3630.             }
  3631.             if (RSInterface.interfaceCache[k].parentID == backDialogID) {
  3632.                 atInventoryInterfaceType = 3;
  3633.             }
  3634.         }
  3635.         if (l == 539) {
  3636.             stream.createFrame(16);
  3637.             stream.method432(i1);
  3638.             stream.method433(j);
  3639.             stream.method433(k);
  3640.             atInventoryLoopCycle = 0;
  3641.             atInventoryInterface = k;
  3642.             atInventoryIndex = j;
  3643.             atInventoryInterfaceType = 2;
  3644.             if (RSInterface.interfaceCache[k].parentID == openInterfaceID) {
  3645.                 atInventoryInterfaceType = 1;
  3646.             }
  3647.             if (RSInterface.interfaceCache[k].parentID == backDialogID) {
  3648.                 atInventoryInterfaceType = 3;
  3649.             }
  3650.         }
  3651.         if (l == 484 || l == 6) {
  3652.             String s1 = menuActionName[i];
  3653.             int l1 = s1.indexOf("@whi@");
  3654.             if (l1 != -1) {
  3655.                 s1 = s1.substring(l1 + 5).trim();
  3656.                 String s7 = TextClass.fixName(TextClass.nameForLong(TextClass.longForName(s1)));
  3657.                 boolean flag9 = false;
  3658.                 for (int j3 = 0; j3 < playerCount; j3++) {
  3659.                     Player class30_sub2_sub4_sub1_sub2_7 = playerArray[playerIndices[j3]];
  3660.                     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)) {
  3661.                         continue;
  3662.                     }
  3663.                     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]);
  3664.                     if (l == 484) {
  3665.                         stream.createFrame(139);
  3666.                         stream.method431(playerIndices[j3]);
  3667.                     }
  3668.                     if (l == 6) {
  3669.                         anInt1188 += i1;
  3670.                         if (anInt1188 >= 90) {
  3671.                             stream.createFrame(136);
  3672.                             anInt1188 = 0;
  3673.                         }
  3674.                         stream.createFrame(128);
  3675.                         stream.writeWord(playerIndices[j3]);
  3676.                     }
  3677.                     flag9 = true;
  3678.                     break;
  3679.                 }
  3680.  
  3681.                 if (!flag9) {
  3682.                     pushMessage("Unable to find " + s7, 0, "");
  3683.                 }
  3684.             }
  3685.         }
  3686.         if (l == 870) {
  3687.             stream.createFrame(53);
  3688.             stream.writeWord(j);
  3689.             stream.method432(anInt1283);
  3690.             stream.method433(i1);
  3691.             stream.writeWord(anInt1284);
  3692.             stream.method431(anInt1285);
  3693.             stream.writeWord(k);
  3694.             atInventoryLoopCycle = 0;
  3695.             atInventoryInterface = k;
  3696.             atInventoryIndex = j;
  3697.             atInventoryInterfaceType = 2;
  3698.             if (RSInterface.interfaceCache[k].parentID == openInterfaceID) {
  3699.                 atInventoryInterfaceType = 1;
  3700.             }
  3701.             if (RSInterface.interfaceCache[k].parentID == backDialogID) {
  3702.                 atInventoryInterfaceType = 3;
  3703.             }
  3704.         }
  3705.         if (l == 847) {
  3706.             stream.createFrame(87);
  3707.             stream.method432(i1);
  3708.             stream.writeWord(k);
  3709.             stream.method432(j);
  3710.             atInventoryLoopCycle = 0;
  3711.             atInventoryInterface = k;
  3712.             atInventoryIndex = j;
  3713.             atInventoryInterfaceType = 2;
  3714.             if (RSInterface.interfaceCache[k].parentID == openInterfaceID) {
  3715.                 atInventoryInterfaceType = 1;
  3716.             }
  3717.             if (RSInterface.interfaceCache[k].parentID == backDialogID) {
  3718.                 atInventoryInterfaceType = 3;
  3719.             }
  3720.         }
  3721.         if (l == 626) {
  3722.             RSInterface class9_1 = RSInterface.interfaceCache[k];
  3723.             spellSelected = 1;
  3724.             anInt1137 = k;
  3725.             spellUsableOn = class9_1.spellUsableOn;
  3726.             itemSelected = 0;
  3727.             needDrawTabArea = true;
  3728.             String s4 = class9_1.selectedActionName;
  3729.             if (s4.indexOf(" ") != -1) {
  3730.                 s4 = s4.substring(0, s4.indexOf(" "));
  3731.             }
  3732.             String s8 = class9_1.selectedActionName;
  3733.             if (s8.indexOf(" ") != -1) {
  3734.                 s8 = s8.substring(s8.indexOf(" ") + 1);
  3735.             }
  3736.             spellTooltip = s4 + " " + class9_1.spellName + " " + s8;
  3737.             if (spellUsableOn == 16) {
  3738.                 needDrawTabArea = true;
  3739.                 tabID = 3;
  3740.                 tabAreaAltered = true;
  3741.             }
  3742.             return;
  3743.         }
  3744.         if (l == 78) {
  3745.             stream.createFrame(117);
  3746.             stream.method433(k);
  3747.             stream.method433(i1);
  3748.             stream.method431(j);
  3749.             atInventoryLoopCycle = 0;
  3750.             atInventoryInterface = k;
  3751.             atInventoryIndex = j;
  3752.             atInventoryInterfaceType = 2;
  3753.             if (RSInterface.interfaceCache[k].parentID == openInterfaceID) {
  3754.                 atInventoryInterfaceType = 1;
  3755.             }
  3756.             if (RSInterface.interfaceCache[k].parentID == backDialogID) {
  3757.                 atInventoryInterfaceType = 3;
  3758.             }
  3759.         }
  3760.         if (l == 27) {
  3761.             Player class30_sub2_sub4_sub1_sub2_2 = playerArray[i1];
  3762.             if (class30_sub2_sub4_sub1_sub2_2 != null) {
  3763.                 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]);
  3764.                 crossX = super.saveClickX;
  3765.                 crossY = super.saveClickY;
  3766.                 crossType = 2;
  3767.                 crossIndex = 0;
  3768.                 anInt986 += i1;
  3769.                 if (anInt986 >= 54) {
  3770.                     stream.createFrame(189);
  3771.                     stream.writeWordBigEndian(234);
  3772.                     anInt986 = 0;
  3773.                 }
  3774.                 stream.createFrame(73);
  3775.                 stream.method431(i1);
  3776.             }
  3777.         }
  3778.         if (l == 213) {
  3779.             boolean flag3 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k, myPlayer.smallX[0], false, j);
  3780.             if (!flag3) {
  3781.                 flag3 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k, myPlayer.smallX[0], false, j);
  3782.             }
  3783.             crossX = super.saveClickX;
  3784.             crossY = super.saveClickY;
  3785.             crossType = 2;
  3786.             crossIndex = 0;
  3787.             stream.createFrame(79);
  3788.             stream.method431(k + baseY);
  3789.             stream.writeWord(i1);
  3790.             stream.method432(j + baseX);
  3791.         }
  3792.         if (l == 632) {
  3793.             stream.createFrame(145);
  3794.             stream.method432(k);
  3795.             stream.method432(j);
  3796.             stream.method432(i1);
  3797.             atInventoryLoopCycle = 0;
  3798.             atInventoryInterface = k;
  3799.             atInventoryIndex = j;
  3800.             atInventoryInterfaceType = 2;
  3801.             if (RSInterface.interfaceCache[k].parentID == openInterfaceID) {
  3802.                 atInventoryInterfaceType = 1;
  3803.             }
  3804.             if (RSInterface.interfaceCache[k].parentID == backDialogID) {
  3805.                 atInventoryInterfaceType = 3;
  3806.             }
  3807.         }
  3808.         if (l == 493) {
  3809.             stream.createFrame(75);
  3810.             stream.method433(k);
  3811.             stream.method431(j);
  3812.             stream.method432(i1);
  3813.             atInventoryLoopCycle = 0;
  3814.             atInventoryInterface = k;
  3815.             atInventoryIndex = j;
  3816.             atInventoryInterfaceType = 2;
  3817.             if (RSInterface.interfaceCache[k].parentID == openInterfaceID) {
  3818.                 atInventoryInterfaceType = 1;
  3819.             }
  3820.             if (RSInterface.interfaceCache[k].parentID == backDialogID) {
  3821.                 atInventoryInterfaceType = 3;
  3822.             }
  3823.         }
  3824.         if (l == 652) {
  3825.             boolean flag4 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k, myPlayer.smallX[0], false, j);
  3826.             if (!flag4) {
  3827.                 flag4 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k, myPlayer.smallX[0], false, j);
  3828.             }
  3829.             crossX = super.saveClickX;
  3830.             crossY = super.saveClickY;
  3831.             crossType = 2;
  3832.             crossIndex = 0;
  3833.             stream.createFrame(156);
  3834.             stream.method432(j + baseX);
  3835.             stream.method431(k + baseY);
  3836.             stream.method433(i1);
  3837.         }
  3838.         if (l == 94) {
  3839.             boolean flag5 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k, myPlayer.smallX[0], false, j);
  3840.             if (!flag5) {
  3841.                 flag5 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k, myPlayer.smallX[0], false, j);
  3842.             }
  3843.             crossX = super.saveClickX;
  3844.             crossY = super.saveClickY;
  3845.             crossType = 2;
  3846.             crossIndex = 0;
  3847.             stream.createFrame(181);
  3848.             stream.method431(k + baseY);
  3849.             stream.writeWord(i1);
  3850.             stream.method431(j + baseX);
  3851.             stream.method432(anInt1137);
  3852.         }
  3853.         if (l == 646) {
  3854.             stream.createFrame(185);
  3855.             stream.writeWord(k);
  3856.             RSInterface class9_2 = RSInterface.interfaceCache[k];
  3857.             if (class9_2.valueIndexArray != null && class9_2.valueIndexArray[0][0] == 5) {
  3858.                 int i2 = class9_2.valueIndexArray[0][1];
  3859.                 if (variousSettings[i2] != class9_2.anIntArray212[0]) {
  3860.                     variousSettings[i2] = class9_2.anIntArray212[0];
  3861.                     method33(i2);
  3862.                     needDrawTabArea = true;
  3863.                 }
  3864.             }
  3865.         }
  3866.         if (l == 225) {
  3867.             NPC class30_sub2_sub4_sub1_sub1_2 = npcArray[i1];
  3868.             if (class30_sub2_sub4_sub1_sub1_2 != null) {
  3869.                 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]);
  3870.                 crossX = super.saveClickX;
  3871.                 crossY = super.saveClickY;
  3872.                 crossType = 2;
  3873.                 crossIndex = 0;
  3874.                 anInt1226 += i1;
  3875.                 if (anInt1226 >= 85) {
  3876.                     stream.createFrame(230);
  3877.                     stream.writeWordBigEndian(239);
  3878.                     anInt1226 = 0;
  3879.                 }
  3880.                 stream.createFrame(17);
  3881.                 stream.method433(i1);
  3882.             }
  3883.         }
  3884.         if (l == 965) {
  3885.             NPC class30_sub2_sub4_sub1_sub1_3 = npcArray[i1];
  3886.             if (class30_sub2_sub4_sub1_sub1_3 != null) {
  3887.                 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]);
  3888.                 crossX = super.saveClickX;
  3889.                 crossY = super.saveClickY;
  3890.                 crossType = 2;
  3891.                 crossIndex = 0;
  3892.                 anInt1134++;
  3893.                 if (anInt1134 >= 96) {
  3894.                     stream.createFrame(152);
  3895.                     stream.writeWordBigEndian(88);
  3896.                     anInt1134 = 0;
  3897.                 }
  3898.                 stream.createFrame(21);
  3899.                 stream.writeWord(i1);
  3900.             }
  3901.         }
  3902.         if (l == 413) {
  3903.             NPC class30_sub2_sub4_sub1_sub1_4 = npcArray[i1];
  3904.             if (class30_sub2_sub4_sub1_sub1_4 != null) {
  3905.                 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]);
  3906.                 crossX = super.saveClickX;
  3907.                 crossY = super.saveClickY;
  3908.                 crossType = 2;
  3909.                 crossIndex = 0;
  3910.                 stream.createFrame(131);
  3911.                 stream.method433(i1);
  3912.                 stream.method432(anInt1137);
  3913.             }
  3914.         }
  3915.         if (l == 200) {
  3916.             closeOpenInterfaces();
  3917.         }
  3918.         if (l == 1025) {
  3919.             NPC class30_sub2_sub4_sub1_sub1_5 = npcArray[i1];
  3920.             if (class30_sub2_sub4_sub1_sub1_5 != null) {
  3921.                 EntityDef entityDef = class30_sub2_sub4_sub1_sub1_5.desc;
  3922.                 if (entityDef.childrenIDs != null) {
  3923.                     entityDef = entityDef.method161();
  3924.                 }
  3925.                 if (entityDef != null) {
  3926.                     String s9;
  3927.                     if (entityDef.description != null) {
  3928.                         s9 = new String(entityDef.description);
  3929.                     } else {
  3930.                         s9 = "It's a " + entityDef.name + ".";
  3931.                     }
  3932.                     pushMessage(s9, 0, "");
  3933.                 }
  3934.             }
  3935.         }
  3936.         if (l == 900) {
  3937.             method66(i1, k, j);
  3938.             stream.createFrame(252);
  3939.             stream.method433(i1 >> 14 & 0x7fff);
  3940.             stream.method431(k + baseY);
  3941.             stream.method432(j + baseX);
  3942.         }
  3943.         if (l == 412) {
  3944.             NPC class30_sub2_sub4_sub1_sub1_6 = npcArray[i1];
  3945.             if (class30_sub2_sub4_sub1_sub1_6 != null) {
  3946.                 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]);
  3947.                 crossX = super.saveClickX;
  3948.                 crossY = super.saveClickY;
  3949.                 crossType = 2;
  3950.                 crossIndex = 0;
  3951.                 stream.createFrame(72);
  3952.                 stream.method432(i1);
  3953.             }
  3954.         }
  3955.         if (l == 365) {
  3956.             Player class30_sub2_sub4_sub1_sub2_3 = playerArray[i1];
  3957.             if (class30_sub2_sub4_sub1_sub2_3 != null) {
  3958.                 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]);
  3959.                 crossX = super.saveClickX;
  3960.                 crossY = super.saveClickY;
  3961.                 crossType = 2;
  3962.                 crossIndex = 0;
  3963.                 stream.createFrame(249);
  3964.                 stream.method432(i1);
  3965.                 stream.method431(anInt1137);
  3966.             }
  3967.         }
  3968.         if (l == 729) {
  3969.             Player class30_sub2_sub4_sub1_sub2_4 = playerArray[i1];
  3970.             if (class30_sub2_sub4_sub1_sub2_4 != null) {
  3971.                 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]);
  3972.                 crossX = super.saveClickX;
  3973.                 crossY = super.saveClickY;
  3974.                 crossType = 2;
  3975.                 crossIndex = 0;
  3976.                 stream.createFrame(39);
  3977.                 stream.method431(i1);
  3978.             }
  3979.         }
  3980.         if (l == 577) {
  3981.             Player class30_sub2_sub4_sub1_sub2_5 = playerArray[i1];
  3982.             if (class30_sub2_sub4_sub1_sub2_5 != null) {
  3983.                 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]);
  3984.                 crossX = super.saveClickX;
  3985.                 crossY = super.saveClickY;
  3986.                 crossType = 2;
  3987.                 crossIndex = 0;
  3988.                 stream.createFrame(139);
  3989.                 stream.method431(i1);
  3990.             }
  3991.         }
  3992.         if (l == 956 && method66(i1, k, j)) {
  3993.             stream.createFrame(35);
  3994.             stream.method431(j + baseX);
  3995.             stream.method432(anInt1137);
  3996.             stream.method432(k + baseY);
  3997.             stream.method431(i1 >> 14 & 0x7fff);
  3998.         }
  3999.         if (l == 567) {
  4000.             boolean flag6 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k, myPlayer.smallX[0], false, j);
  4001.             if (!flag6) {
  4002.                 flag6 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k, myPlayer.smallX[0], false, j);
  4003.             }
  4004.             crossX = super.saveClickX;
  4005.             crossY = super.saveClickY;
  4006.             crossType = 2;
  4007.             crossIndex = 0;
  4008.             stream.createFrame(23);
  4009.             stream.method431(k + baseY);
  4010.             stream.method431(i1);
  4011.             stream.method431(j + baseX);
  4012.         }
  4013.         if (l == 867) {
  4014.             if ((i1 & 3) == 0) {
  4015.                 anInt1175++;
  4016.             }
  4017.             if (anInt1175 >= 59) {
  4018.                 stream.createFrame(200);
  4019.                 stream.writeWord(25501);
  4020.                 anInt1175 = 0;
  4021.             }
  4022.             stream.createFrame(43);
  4023.             stream.method431(k);
  4024.             stream.method432(i1);
  4025.             stream.method432(j);
  4026.             atInventoryLoopCycle = 0;
  4027.             atInventoryInterface = k;
  4028.             atInventoryIndex = j;
  4029.             atInventoryInterfaceType = 2;
  4030.             if (RSInterface.interfaceCache[k].parentID == openInterfaceID) {
  4031.                 atInventoryInterfaceType = 1;
  4032.             }
  4033.             if (RSInterface.interfaceCache[k].parentID == backDialogID) {
  4034.                 atInventoryInterfaceType = 3;
  4035.             }
  4036.         }
  4037.         if (l == 543) {
  4038.             stream.createFrame(237);
  4039.             stream.writeWord(j);
  4040.             stream.method432(i1);
  4041.             stream.writeWord(k);
  4042.             stream.method432(anInt1137);
  4043.             atInventoryLoopCycle = 0;
  4044.             atInventoryInterface = k;
  4045.             atInventoryIndex = j;
  4046.             atInventoryInterfaceType = 2;
  4047.             if (RSInterface.interfaceCache[k].parentID == openInterfaceID) {
  4048.                 atInventoryInterfaceType = 1;
  4049.             }
  4050.             if (RSInterface.interfaceCache[k].parentID == backDialogID) {
  4051.                 atInventoryInterfaceType = 3;
  4052.             }
  4053.         }
  4054.         if (l == 606) {
  4055.             String s2 = menuActionName[i];
  4056.             int j2 = s2.indexOf("@whi@");
  4057.             if (j2 != -1) {
  4058.                 if (openInterfaceID == -1) {
  4059.                     closeOpenInterfaces();
  4060.                     reportAbuseInput = s2.substring(j2 + 5).trim();
  4061.                     canMute = false;
  4062.                     for (RSInterface element : RSInterface.interfaceCache) {
  4063.                         if (element == null || element.anInt214 != 600) {
  4064.                             continue;
  4065.                         }
  4066.                         reportAbuseInterfaceID = openInterfaceID = element.parentID;
  4067.                         break;
  4068.                     }
  4069.  
  4070.                 } else {
  4071.                     pushMessage("Please close the interface you have open before using 'report abuse'", 0, "");
  4072.                 }
  4073.             }
  4074.         }
  4075.         if (l == 491) {
  4076.             Player class30_sub2_sub4_sub1_sub2_6 = playerArray[i1];
  4077.             if (class30_sub2_sub4_sub1_sub2_6 != null) {
  4078.                 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]);
  4079.                 crossX = super.saveClickX;
  4080.                 crossY = super.saveClickY;
  4081.                 crossType = 2;
  4082.                 crossIndex = 0;
  4083.                 stream.createFrame(14);
  4084.                 // stream.method432(anInt1284);
  4085.                 stream.writeWord(i1);
  4086.                 // stream.writeWord(anInt1285);
  4087.                 stream.method431(anInt1283);
  4088.             }
  4089.         }
  4090.         if (l == 639) {
  4091.             String s3 = menuActionName[i];
  4092.             int k2 = s3.indexOf("@whi@");
  4093.             if (k2 != -1) {
  4094.                 long l4 = TextClass.longForName(s3.substring(k2 + 5).trim());
  4095.                 int k3 = -1;
  4096.                 for (int i4 = 0; i4 < friendsCount; i4++) {
  4097.                     if (friendsListAsLongs[i4] != l4) {
  4098.                         continue;
  4099.                     }
  4100.                     k3 = i4;
  4101.                     break;
  4102.                 }
  4103.  
  4104.                 if (k3 != -1 && friendsNodeIDs[k3] > 9) {
  4105.                     inputTaken = true;
  4106.                     inputDialogState = 0;
  4107.                     messagePromptRaised = true;
  4108.                     promptInput = "";
  4109.                     friendsListAction = 3;
  4110.                     aLong953 = friendsListAsLongs[k3];
  4111.                     aString1121 = "Enter message to send to " + friendsList[k3];
  4112.                 } else {
  4113.                     pushMessage("That player is currently offline.", 0, "");
  4114.                 }
  4115.             }
  4116.         }
  4117.         if (l == 454) {
  4118.             stream.createFrame(41);
  4119.             stream.writeWord(i1);
  4120.             stream.method432(j);
  4121.             stream.method432(k);
  4122.             atInventoryLoopCycle = 0;
  4123.             atInventoryInterface = k;
  4124.             atInventoryIndex = j;
  4125.             atInventoryInterfaceType = 2;
  4126.             if (RSInterface.interfaceCache[k].parentID == openInterfaceID) {
  4127.                 atInventoryInterfaceType = 1;
  4128.             }
  4129.             if (RSInterface.interfaceCache[k].parentID == backDialogID) {
  4130.                 atInventoryInterfaceType = 3;
  4131.             }
  4132.         }
  4133.         if (l == 478) {
  4134.             NPC class30_sub2_sub4_sub1_sub1_7 = npcArray[i1];
  4135.             if (class30_sub2_sub4_sub1_sub1_7 != null) {
  4136.                 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]);
  4137.                 crossX = super.saveClickX;
  4138.                 crossY = super.saveClickY;
  4139.                 crossType = 2;
  4140.                 crossIndex = 0;
  4141.                 if ((i1 & 3) == 0) {
  4142.                     anInt1155++;
  4143.                 }
  4144.                 if (anInt1155 >= 53) {
  4145.                     stream.createFrame(85);
  4146.                     stream.writeWordBigEndian(66);
  4147.                     anInt1155 = 0;
  4148.                 }
  4149.                 stream.createFrame(18);
  4150.                 stream.method431(i1);
  4151.             }
  4152.         }
  4153.         if (l == 113) {//third
  4154.             method66(i1, k, j);
  4155.             stream.createFrame(70);
  4156.             stream.method431(j + baseX);
  4157.             stream.writeWord(k + baseY);
  4158.             stream.method433(i1 >> 14 & 0x7fff);
  4159.         }
  4160.         if (l == 872) {//fourth
  4161.             method66(i1, k, j);
  4162.             stream.createFrame(234);
  4163.             stream.method433(j + baseX);
  4164.             stream.method432(i1 >> 14 & 0x7fff);
  4165.             stream.method433(k + baseY);
  4166.         }
  4167.         if (l == 502) {//first
  4168.             method66(i1, k, j);
  4169.             stream.createFrame(132);
  4170.             stream.method433(j + baseX);
  4171.             stream.writeWord(i1 >> 14 & 0x7fff);
  4172.             stream.method432(k + baseY);
  4173.         }
  4174.         if (l == 1125) {
  4175.             ItemDef itemDef = ItemDef.forID(i1);
  4176.             RSInterface class9_4 = RSInterface.interfaceCache[k];
  4177.             String s5;
  4178.             if (class9_4 != null && class9_4.invStackSizes[j] >= 0x186a0) {
  4179.                 DecimalFormatSymbols separator = new DecimalFormatSymbols();
  4180.                 separator.setGroupingSeparator(',');
  4181.                 DecimalFormat formatter = new DecimalFormat("#,###,###,###", separator);
  4182.                 s5 = formatter.format(class9_4.invStackSizes[j]) + " x " + itemDef.name;
  4183.             } else if (itemDef.description != null) {
  4184.                 s5 = new String(itemDef.description);
  4185.             } else {
  4186.                 s5 = "It's a " + itemDef.name + ".";
  4187.             }
  4188.             pushMessage(s5, 0, "");
  4189.         }
  4190.         if (l == 169) {
  4191.             stream.createFrame(185);
  4192.             stream.writeWord(k);
  4193.             RSInterface class9_3 = RSInterface.interfaceCache[k];
  4194.             if (class9_3.valueIndexArray != null && class9_3.valueIndexArray[0][0] == 5) {
  4195.                 int l2 = class9_3.valueIndexArray[0][1];
  4196.                 variousSettings[l2] = 1 - variousSettings[l2];
  4197.                 method33(l2);
  4198.                 needDrawTabArea = true;
  4199.             }
  4200.         }
  4201.         if (l == 447) {
  4202.             itemSelected = 1;
  4203.             anInt1283 = j;
  4204.             anInt1284 = k;
  4205.             anInt1285 = i1;
  4206.             selectedItemName = ItemDef.forID(i1).name;
  4207.             spellSelected = 0;
  4208.             needDrawTabArea = true;
  4209.             return;
  4210.         }
  4211.         if (l == 1226) {
  4212.             int j1 = i1 >> 14 & 0x7fff;
  4213.             ObjectDef class46 = ObjectDef.forID(j1);
  4214.             String s10;
  4215.             if (class46.description != null) {
  4216.                 s10 = new String(class46.description);
  4217.             } else {
  4218.                 s10 = "It's a " + class46.name + ".";
  4219.             }
  4220.             pushMessage(s10, 0, "");
  4221.         }
  4222.         if (l == 244) {
  4223.             boolean flag7 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k, myPlayer.smallX[0], false, j);
  4224.             if (!flag7) {
  4225.                 flag7 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k, myPlayer.smallX[0], false, j);
  4226.             }
  4227.             crossX = super.saveClickX;
  4228.             crossY = super.saveClickY;
  4229.             crossType = 2;
  4230.             crossIndex = 0;
  4231.             stream.createFrame(253);
  4232.             stream.method431(j + baseX);
  4233.             stream.method433(k + baseY);
  4234.             stream.method432(i1);
  4235.         }
  4236.         if (l == 1448) {
  4237.             ItemDef itemDef_1 = ItemDef.forID(i1);
  4238.             String s6;
  4239.             if (itemDef_1.description != null) {
  4240.                 s6 = new String(itemDef_1.description);
  4241.             } else {
  4242.                 s6 = "It's a " + itemDef_1.name + ".";
  4243.             }
  4244.             pushMessage(s6, 0, "");
  4245.         }
  4246.         itemSelected = 0;
  4247.         spellSelected = 0;
  4248.         needDrawTabArea = true;
  4249.  
  4250.     }
  4251.  
  4252.     public void method70() {
  4253.         anInt1251 = 0;
  4254.         int j = (myPlayer.x >> 7) + baseX;
  4255.         int k = (myPlayer.y >> 7) + baseY;
  4256.         if (j >= 3053 && j <= 3156 && k >= 3056 && k <= 3136) {
  4257.             anInt1251 = 1;
  4258.         }
  4259.         if (j >= 3072 && j <= 3118 && k >= 9492 && k <= 9535) {
  4260.             anInt1251 = 1;
  4261.         }
  4262.         if (anInt1251 == 1 && j >= 3139 && j <= 3199 && k >= 3008 && k <= 3062) {
  4263.             anInt1251 = 0;
  4264.         }
  4265.     }
  4266.  
  4267.     public void run() {
  4268.         if (drawFlames) {
  4269.             drawFlames();
  4270.         } else {
  4271.             super.run();
  4272.         }
  4273.     }
  4274.  
  4275.     public void build3dScreenMenu() {
  4276.         if (itemSelected == 0 && spellSelected == 0) {
  4277.             menuActionName[menuActionRow] = "Walk here";
  4278.             menuActionID[menuActionRow] = 516;
  4279.             menuActionCmd2[menuActionRow] = super.mouseX;
  4280.             menuActionCmd3[menuActionRow] = super.mouseY;
  4281.             menuActionRow++;
  4282.         }
  4283.         int j = -1;
  4284.         for (int k = 0; k < Model.anInt1687; k++) {
  4285.             int l = Model.anIntArray1688[k];
  4286.             int i1 = l & 0x7f;
  4287.             int j1 = l >> 7 & 0x7f;
  4288.             int k1 = l >> 29 & 3;
  4289.             int l1 = l >> 14 & 0x7fff;
  4290.             if (l == j) {
  4291.                 continue;
  4292.             }
  4293.             j = l;
  4294.             if (k1 == 2 && worldController.method304(plane, i1, j1, l) >= 0) {
  4295.                 ObjectDef class46 = ObjectDef.forID(l1);
  4296.                 if (class46.childrenIDs != null) {
  4297.                     class46 = class46.method580();
  4298.                 }
  4299.                 if (class46 == null) {
  4300.                     continue;
  4301.                 }
  4302.                 if (itemSelected == 1) {
  4303.                     menuActionName[menuActionRow] = "Use " + selectedItemName + " with @cya@" + class46.name;
  4304.                     menuActionID[menuActionRow] = 62;
  4305.                     menuActionCmd1[menuActionRow] = l;
  4306.                     menuActionCmd2[menuActionRow] = i1;
  4307.                     menuActionCmd3[menuActionRow] = j1;
  4308.                     menuActionRow++;
  4309.                 } else if (spellSelected == 1) {
  4310.                     if ((spellUsableOn & 4) == 4) {
  4311.                         menuActionName[menuActionRow] = spellTooltip + " @cya@" + class46.name;
  4312.                         menuActionID[menuActionRow] = 956;
  4313.                         menuActionCmd1[menuActionRow] = l;
  4314.                         menuActionCmd2[menuActionRow] = i1;
  4315.                         menuActionCmd3[menuActionRow] = j1;
  4316.                         menuActionRow++;
  4317.                     }
  4318.                 } else {
  4319.                     if (class46.actions != null) {
  4320.                         for (int i2 = 4; i2 >= 0; i2--) {
  4321.                             if (class46.actions[i2] != null) {
  4322.                                 menuActionName[menuActionRow] = class46.actions[i2] + " @cya@" + class46.name;
  4323.                                 if (i2 == 0) {
  4324.                                     menuActionID[menuActionRow] = 502;
  4325.                                 }
  4326.                                 if (i2 == 1) {
  4327.                                     menuActionID[menuActionRow] = 900;
  4328.                                 }
  4329.                                 if (i2 == 2) {
  4330.                                     menuActionID[menuActionRow] = 113;
  4331.                                 }
  4332.                                 if (i2 == 3) {
  4333.                                     menuActionID[menuActionRow] = 872;
  4334.                                 }
  4335.                                 if (i2 == 4) {
  4336.                                     menuActionID[menuActionRow] = 1062;
  4337.                                 }
  4338.                                 menuActionCmd1[menuActionRow] = l;
  4339.                                 menuActionCmd2[menuActionRow] = i1;
  4340.                                 menuActionCmd3[menuActionRow] = j1;
  4341.                                 menuActionRow++;
  4342.                             }
  4343.                         }
  4344.  
  4345.                     }
  4346.                     menuActionName[menuActionRow] = "Examine @cya@" + class46.name + (showInfo ? " @gre@(@whi@" + l1 + "@gre@) (@whi@" + (i1 + baseX) + "," + (j1 + baseY) + "@gre@)" : "");
  4347.                     menuActionID[menuActionRow] = 1226;
  4348.                     menuActionCmd1[menuActionRow] = class46.type << 14;
  4349.                     menuActionCmd2[menuActionRow] = i1;
  4350.                     menuActionCmd3[menuActionRow] = j1;
  4351.                     menuActionRow++;
  4352.                 }
  4353.             }
  4354.             if (k1 == 1) {
  4355.                 NPC npc = npcArray[l1];
  4356.                 if (npc.desc.aByte68 == 1 && (npc.x & 0x7f) == 64 && (npc.y & 0x7f) == 64) {
  4357.                     for (int j2 = 0; j2 < npcCount; j2++) {
  4358.                         NPC npc2 = npcArray[npcIndices[j2]];
  4359.                         if (npc2 != null && npc2 != npc && npc2.desc.aByte68 == 1 && npc2.x == npc.x && npc2.y == npc.y) {
  4360.                             buildAtNPCMenu(npc2.desc, npcIndices[j2], j1, i1);
  4361.                         }
  4362.                     }
  4363.  
  4364.                     for (int l2 = 0; l2 < playerCount; l2++) {
  4365.                         Player player = playerArray[playerIndices[l2]];
  4366.                         if (player != null && player.x == npc.x && player.y == npc.y) {
  4367.                             buildAtPlayerMenu(i1, playerIndices[l2], player, j1);
  4368.                         }
  4369.                     }
  4370.  
  4371.                 }
  4372.                 buildAtNPCMenu(npc.desc, l1, j1, i1);
  4373.             }
  4374.             if (k1 == 0) {
  4375.                 Player player = playerArray[l1];
  4376.                 if ((player.x & 0x7f) == 64 && (player.y & 0x7f) == 64) {
  4377.                     for (int k2 = 0; k2 < npcCount; k2++) {
  4378.                         NPC class30_sub2_sub4_sub1_sub1_2 = npcArray[npcIndices[k2]];
  4379.                         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) {
  4380.                             buildAtNPCMenu(class30_sub2_sub4_sub1_sub1_2.desc, npcIndices[k2], j1, i1);
  4381.                         }
  4382.                     }
  4383.  
  4384.                     for (int i3 = 0; i3 < playerCount; i3++) {
  4385.                         Player class30_sub2_sub4_sub1_sub2_2 = playerArray[playerIndices[i3]];
  4386.                         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) {
  4387.                             buildAtPlayerMenu(i1, playerIndices[i3], class30_sub2_sub4_sub1_sub2_2, j1);
  4388.                         }
  4389.                     }
  4390.  
  4391.                 }
  4392.                 buildAtPlayerMenu(i1, l1, player, j1);
  4393.             }
  4394.             if (k1 == 3) {
  4395.                 NodeList class19 = groundArray[plane][i1][j1];
  4396.                 if (class19 != null) {
  4397.                     for (Item item = (Item) class19.getFirst(); item != null; item = (Item) class19.getNext()) {
  4398.                         ItemDef itemDef = ItemDef.forID(item.ID);
  4399.                         if (itemSelected == 1) {
  4400.                             menuActionName[menuActionRow] = "Use " + selectedItemName + " with @lre@" + itemDef.name;
  4401.                             menuActionID[menuActionRow] = 511;
  4402.                             menuActionCmd1[menuActionRow] = item.ID;
  4403.                             menuActionCmd2[menuActionRow] = i1;
  4404.                             menuActionCmd3[menuActionRow] = j1;
  4405.                             menuActionRow++;
  4406.                         } else if (spellSelected == 1) {
  4407.                             if ((spellUsableOn & 1) == 1) {
  4408.                                 menuActionName[menuActionRow] = spellTooltip + " @lre@" + itemDef.name;
  4409.                                 menuActionID[menuActionRow] = 94;
  4410.                                 menuActionCmd1[menuActionRow] = item.ID;
  4411.                                 menuActionCmd2[menuActionRow] = i1;
  4412.                                 menuActionCmd3[menuActionRow] = j1;
  4413.                                 menuActionRow++;
  4414.                             }
  4415.                         } else {
  4416.                             for (int j3 = 4; j3 >= 0; j3--) {
  4417.                                 if (itemDef.groundActions != null && itemDef.groundActions[j3] != null) {
  4418.                                     menuActionName[menuActionRow] = itemDef.groundActions[j3] + " @lre@" + itemDef.name;
  4419.                                     if (j3 == 0) {
  4420.                                         menuActionID[menuActionRow] = 652;
  4421.                                     }
  4422.                                     if (j3 == 1) {
  4423.                                         menuActionID[menuActionRow] = 567;
  4424.                                     }
  4425.                                     if (j3 == 2) {
  4426.                                         menuActionID[menuActionRow] = 234;
  4427.                                     }
  4428.                                     if (j3 == 3) {
  4429.                                         menuActionID[menuActionRow] = 244;
  4430.                                     }
  4431.                                     if (j3 == 4) {
  4432.                                         menuActionID[menuActionRow] = 213;
  4433.                                     }
  4434.                                     menuActionCmd1[menuActionRow] = item.ID;
  4435.                                     menuActionCmd2[menuActionRow] = i1;
  4436.                                     menuActionCmd3[menuActionRow] = j1;
  4437.                                     menuActionRow++;
  4438.                                 } else if (j3 == 2) {
  4439.                                     menuActionName[menuActionRow] = "Take @lre@" + itemDef.name;
  4440.                                     menuActionID[menuActionRow] = 234;
  4441.                                     menuActionCmd1[menuActionRow] = item.ID;
  4442.                                     menuActionCmd2[menuActionRow] = i1;
  4443.                                     menuActionCmd3[menuActionRow] = j1;
  4444.                                     menuActionRow++;
  4445.                                 }
  4446.                             }
  4447.  
  4448.                             menuActionName[menuActionRow] = "Examine @lre@" + itemDef.name + (showInfo ? " @gre@(@whi@" + item.ID + "@gre@)" : "");
  4449.                             menuActionID[menuActionRow] = 1448;
  4450.                             menuActionCmd1[menuActionRow] = item.ID;
  4451.                             menuActionCmd2[menuActionRow] = i1;
  4452.                             menuActionCmd3[menuActionRow] = j1;
  4453.                             menuActionRow++;
  4454.                         }
  4455.                     }
  4456.  
  4457.                 }
  4458.             }
  4459.         }
  4460.     }
  4461.  
  4462.     public void cleanUpForQuit() {
  4463.         Signlink.reporterror = false;
  4464.         try {
  4465.             if (socketStream != null) {
  4466.                 socketStream.close();
  4467.             }
  4468.         } catch (Exception _ex) {
  4469.         }
  4470.         socketStream = null;
  4471.         stopMidi();
  4472.         if (mouseDetection != null) {
  4473.             mouseDetection.running = false;
  4474.         }
  4475.         mouseDetection = null;
  4476.         onDemandFetcher.disable();
  4477.         onDemandFetcher = null;
  4478.         aStream_834 = null;
  4479.         stream = null;
  4480.         aStream_847 = null;
  4481.         inStream = null;
  4482.         anIntArray1234 = null;
  4483.         aByteArrayArray1183 = null;
  4484.         aByteArrayArray1247 = null;
  4485.         anIntArray1235 = null;
  4486.         anIntArray1236 = null;
  4487.         intGroundArray = null;
  4488.         byteGroundArray = null;
  4489.         worldController = null;
  4490.         aClass11Array1230 = null;
  4491.         anIntArrayArray901 = null;
  4492.         anIntArrayArray825 = null;
  4493.         bigX = null;
  4494.         bigY = null;
  4495.         aByteArray912 = null;
  4496.         aRSImageProducer_1163 = null;
  4497.         aRSImageProducer_1164 = null;
  4498.         aRSImageProducer_1165 = null;
  4499.         aRSImageProducer_1166 = null;
  4500.         aRSImageProducer_1123 = null;
  4501.         aRSImageProducer_1124 = null;
  4502.         aRSImageProducer_1125 = null;
  4503.         backLeftIP1 = null;
  4504.         backLeftIP2 = null;
  4505.         backRightIP1 = null;
  4506.         backRightIP2 = null;
  4507.         backTopIP1 = null;
  4508.         backVmidIP1 = null;
  4509.         backVmidIP2 = null;
  4510.         backVmidIP3 = null;
  4511.         backVmidIP2_2 = null;
  4512.         invBack = null;
  4513.         mapBack = null;
  4514.         chatBack = null;
  4515.         backBase1 = null;
  4516.         backBase2 = null;
  4517.         backHmid1 = null;
  4518.         sideIcons = null;
  4519.         redStone1 = null;
  4520.         redStone2 = null;
  4521.         redStone3 = null;
  4522.         redStone1_2 = null;
  4523.         redStone2_2 = null;
  4524.         redStone1_3 = null;
  4525.         redStone2_3 = null;
  4526.         redStone3_2 = null;
  4527.         redStone1_4 = null;
  4528.         redStone2_4 = null;
  4529.         compass = null;
  4530.         hitMarks = null;
  4531.         headIcons = null;
  4532.         skullIcons = null;
  4533.         headIconsHint = null;
  4534.         crosses = null;
  4535.         mapDotItem = null;
  4536.         mapDotNPC = null;
  4537.         mapDotPlayer = null;
  4538.         mapDotFriend = null;
  4539.         mapDotTeam = null;
  4540.         mapScenes = null;
  4541.         mapFunctions = null;
  4542.         anIntArrayArray929 = null;
  4543.         playerArray = null;
  4544.         playerIndices = null;
  4545.         anIntArray894 = null;
  4546.         aStreamArray895s = null;
  4547.         anIntArray840 = null;
  4548.         npcArray = null;
  4549.         npcIndices = null;
  4550.         groundArray = null;
  4551.         aClass19_1179 = null;
  4552.         aClass19_1013 = null;
  4553.         aClass19_1056 = null;
  4554.         menuActionCmd2 = null;
  4555.         menuActionCmd3 = null;
  4556.         menuActionID = null;
  4557.         menuActionCmd1 = null;
  4558.         menuActionName = null;
  4559.         variousSettings = null;
  4560.         anIntArray1072 = null;
  4561.         anIntArray1073 = null;
  4562.         aClass30_Sub2_Sub1_Sub1Array1140 = null;
  4563.         aClass30_Sub2_Sub1_Sub1_1263 = null;
  4564.         friendsList = null;
  4565.         friendsListAsLongs = null;
  4566.         friendsNodeIDs = null;
  4567.         aRSImageProducer_1110 = null;
  4568.         aRSImageProducer_1111 = null;
  4569.         aRSImageProducer_1107 = null;
  4570.         aRSImageProducer_1108 = null;
  4571.         aRSImageProducer_1109 = null;
  4572.         aRSImageProducer_1112 = null;
  4573.         aRSImageProducer_1113 = null;
  4574.         aRSImageProducer_1114 = null;
  4575.         aRSImageProducer_1115 = null;
  4576.         multiOverlay = null;
  4577.         nullLoader();
  4578.         ObjectDef.nullLoader();
  4579.         EntityDef.nullLoader();
  4580.         ItemDef.nullLoader();
  4581.         Flo.cache = null;
  4582.         IDK.cache = null;
  4583.         RSInterface.interfaceCache = null;
  4584.         DummyClass.cache = null;
  4585.         Animation.anims = null;
  4586.         SpotAnim.cache = null;
  4587.         SpotAnim.aMRUNodes_415 = null;
  4588.         Varp.cache = null;
  4589.         super.fullGameScreen = null;
  4590.         Player.mruNodes = null;
  4591.         Texture.nullLoader();
  4592.         WorldController.nullLoader();
  4593.         Model.nullLoader();
  4594.         Class36.nullLoader();
  4595.         System.gc();
  4596.     }
  4597.  
  4598.     public void printDebug() {
  4599.         System.out.println("============");
  4600.         System.out.println("flame-cycle:" + anInt1208);
  4601.         if (onDemandFetcher != null) {
  4602.             System.out.println("Od-cycle:" + onDemandFetcher.onDemandCycle);
  4603.         }
  4604.         System.out.println("loop-cycle:" + loopCycle);
  4605.         System.out.println("draw-cycle:" + anInt1061);
  4606.         System.out.println("ptype:" + pktType);
  4607.         System.out.println("psize:" + pktSize);
  4608.         if (socketStream != null) {
  4609.             socketStream.printDebug();
  4610.         }
  4611.         super.shouldDebug = true;
  4612.     }
  4613.  
  4614.     Component getGameComponent() {
  4615.         if (Signlink.mainapp != null) {
  4616.             return Signlink.mainapp;
  4617.         }
  4618.         if (super.gameFrame != null) {
  4619.             return super.gameFrame;
  4620.         } else {
  4621.             return this;
  4622.         }
  4623.     }
  4624.  
  4625.     public void method73() {
  4626.         do {
  4627.             int j = readChar(-796);
  4628.             if (j == -1) {
  4629.                 break;
  4630.             }
  4631.             if (openInterfaceID != -1 && openInterfaceID == reportAbuseInterfaceID) {
  4632.                 if (j == 8 && reportAbuseInput.length() > 0) {
  4633.                     reportAbuseInput = reportAbuseInput.substring(0, reportAbuseInput.length() - 1);
  4634.                 }
  4635.                 if ((j >= 97 && j <= 122 || j >= 65 && j <= 90 || j >= 48 && j <= 57 || j == 32) && reportAbuseInput.length() < 12) {
  4636.                     reportAbuseInput += (char) j;
  4637.                 }
  4638.             } else if (messagePromptRaised) {
  4639.                 if (j >= 32 && j <= 122 && promptInput.length() < 80) {
  4640.                     promptInput += (char) j;
  4641.                     inputTaken = true;
  4642.                 }
  4643.                 if (j == 8 && promptInput.length() > 0) {
  4644.                     promptInput = promptInput.substring(0, promptInput.length() - 1);
  4645.                     inputTaken = true;
  4646.                 }
  4647.                 if (j == 13 || j == 10) {
  4648.                     messagePromptRaised = false;
  4649.                     inputTaken = true;
  4650.                     if (friendsListAction == 1) {
  4651.                         long l = TextClass.longForName(promptInput);
  4652.                         addFriend(l);
  4653.                     }
  4654.                     if (friendsListAction == 2 && friendsCount > 0) {
  4655.                         long l1 = TextClass.longForName(promptInput);
  4656.                         delFriend(l1);
  4657.                     }
  4658.                     if (friendsListAction == 3 && promptInput.length() > 0) {
  4659.                         stream.createFrame(126);
  4660.                         stream.writeWordBigEndian(0);
  4661.                         int k = stream.currentOffset;
  4662.                         stream.writeQWord(aLong953);
  4663.                         TextInput.method526(promptInput, stream);
  4664.                         stream.writeBytes(stream.currentOffset - k);
  4665.                         promptInput = TextInput.processText(promptInput);
  4666.                         promptInput = Censor.doCensor(promptInput);
  4667.                         pushMessage(promptInput, 6, TextClass.fixName(TextClass.nameForLong(aLong953)));
  4668.                         if (privateChatMode == 2) {
  4669.                             privateChatMode = 1;
  4670.                             aBoolean1233 = true;
  4671.                             stream.createFrame(95);
  4672.                             stream.writeWordBigEndian(publicChatMode);
  4673.                             stream.writeWordBigEndian(privateChatMode);
  4674.                             stream.writeWordBigEndian(tradeMode);
  4675.                         }
  4676.                     }
  4677.                     if (friendsListAction == 4 && ignoreCount < 100) {
  4678.                         long l2 = TextClass.longForName(promptInput);
  4679.                         addIgnore(l2);
  4680.                     }
  4681.                     if (friendsListAction == 5 && ignoreCount > 0) {
  4682.                         long l3 = TextClass.longForName(promptInput);
  4683.                         delIgnore(l3);
  4684.                     }
  4685.                 }
  4686.             } else if (inputDialogState == 1) {
  4687.                 if (j >= 48 && j <= 57 && amountOrNameInput.length() < 10) {
  4688.                     amountOrNameInput += (char) j;
  4689.                     inputTaken = true;
  4690.                 }
  4691.                 if ((!amountOrNameInput.toLowerCase().contains("k") && !amountOrNameInput.toLowerCase().contains("m") && !amountOrNameInput.toLowerCase().contains("b")) && (j == 107 || j == 109) || j == 98) {
  4692.                     amountOrNameInput += (char) j;
  4693.                     inputTaken = true;
  4694.                 }
  4695.                 if (j == 8 && amountOrNameInput.length() > 0) {
  4696.                     amountOrNameInput = amountOrNameInput.substring(0, amountOrNameInput.length() - 1);
  4697.                     inputTaken = true;
  4698.                 }
  4699.                 try {
  4700.                 if (j == 13 || j == 10) {
  4701.                     if (amountOrNameInput.length() > 0) {
  4702.                         if (amountOrNameInput.toLowerCase().contains("k")) {
  4703.                             amountOrNameInput = amountOrNameInput.replaceAll("k", "000");
  4704.                         } else if (amountOrNameInput.toLowerCase().contains("m")) {
  4705.                             amountOrNameInput = amountOrNameInput.replaceAll("m", "000000");
  4706.                         } else if (amountOrNameInput.toLowerCase().contains("b")) {
  4707.                             amountOrNameInput = amountOrNameInput.replaceAll("b", "000000000");
  4708.                         }
  4709.                         int amount = 0;
  4710.                         amount = Integer.parseInt(amountOrNameInput);
  4711.                         stream.createFrame(208);
  4712.                         stream.writeDWord(amount);
  4713.                     }
  4714.                     inputDialogState = 0;
  4715.                     inputTaken = true;
  4716.                 }
  4717.             } catch (NumberFormatException nfe) {
  4718.                 inputDialogState = 0;
  4719.                 inputTaken = true;
  4720.                 pushMessage("Please enter a lower amount.", 0, "");
  4721.             }
  4722.             } else if (inputDialogState == 2) {
  4723.                 if (j >= 32 && j <= 122 && amountOrNameInput.length() < 12) {
  4724.                     amountOrNameInput += (char) j;
  4725.                     inputTaken = true;
  4726.                 }
  4727.                 if (j == 8 && amountOrNameInput.length() > 0) {
  4728.                     amountOrNameInput = amountOrNameInput.substring(0, amountOrNameInput.length() - 1);
  4729.                     inputTaken = true;
  4730.                 }
  4731.                 if (j == 13 || j == 10) {
  4732.                     if (amountOrNameInput.length() > 0) {
  4733.                         stream.createFrame(60);
  4734.                         stream.writeQWord(TextClass.longForName(amountOrNameInput));
  4735.                     }
  4736.                     inputDialogState = 0;
  4737.                     inputTaken = true;
  4738.                 }
  4739.             } else if (backDialogID == -1 && fullScreenBackDialogID == -1) {
  4740.                 if (j >= 32 && j <= 122 && inputString.length() < 80) {
  4741.                     inputString += (char) j;
  4742.                     inputTaken = true;
  4743.                 }
  4744.                 if (j == 8 && inputString.length() > 0) {
  4745.                     inputString = inputString.substring(0, inputString.length() - 1);
  4746.                     inputTaken = true;
  4747.                 }
  4748.                 if ((j == 13 || j == 10) && inputString.length() > 0) {
  4749.                     if (myPrivilege == 2) {
  4750.                         if (inputString.equals("::clientdrop")) {
  4751.                             dropClient();
  4752.                         }
  4753.                         if (inputString.equals("::lag")) {
  4754.                             printDebug();
  4755.                         }
  4756.                         if (inputString.equals("::prefetchmusic")) {
  4757.                             for (int j1 = 0; j1 < onDemandFetcher.getVersionCount(2); j1++) {
  4758.                                 onDemandFetcher.method563((byte) 1, 2, j1);
  4759.                             }
  4760.  
  4761.                         }
  4762.                         if (inputString.equals("::fps")) {
  4763.                             fpsOn = !fpsOn;
  4764.                         }
  4765.                         if (inputString.equals("::dataon")) {
  4766.                             showInfo = !showInfo;
  4767.                         }
  4768.                         if (inputString.equals("::clip")) {
  4769.                             for (int k1 = 0; k1 < 4; k1++) {
  4770.                                 for (int i2 = 1; i2 < 103; i2++) {
  4771.                                     for (int k2 = 1; k2 < 103; k2++) {
  4772.                                         aClass11Array1230[k1].anIntArrayArray294[i2][k2] = 0;
  4773.                                     }
  4774.  
  4775.                                 }
  4776.  
  4777.                             }
  4778.  
  4779.                         }
  4780.                     }
  4781.                     if (inputString.startsWith("::")) {
  4782.                         stream.createFrame(103);
  4783.                         stream.writeWordBigEndian(inputString.length() - 1);
  4784.                         stream.writeString(inputString.substring(2));
  4785.                     } else {
  4786.                         String s = inputString.toLowerCase();
  4787.                         int j2 = 0;
  4788.                         if (s.startsWith("yellow:")) {
  4789.                             j2 = 0;
  4790.                             inputString = inputString.substring(7);
  4791.                         } else if (s.startsWith("red:")) {
  4792.                             j2 = 1;
  4793.                             inputString = inputString.substring(4);
  4794.                         } else if (s.startsWith("green:")) {
  4795.                             j2 = 2;
  4796.                             inputString = inputString.substring(6);
  4797.                         } else if (s.startsWith("cyan:")) {
  4798.                             j2 = 3;
  4799.                             inputString = inputString.substring(5);
  4800.                         } else if (s.startsWith("purple:")) {
  4801.                             j2 = 4;
  4802.                             inputString = inputString.substring(7);
  4803.                         } else if (s.startsWith("white:")) {
  4804.                             j2 = 5;
  4805.                             inputString = inputString.substring(6);
  4806.                         } else if (s.startsWith("flash1:")) {
  4807.                             j2 = 6;
  4808.                             inputString = inputString.substring(7);
  4809.                         } else if (s.startsWith("flash2:")) {
  4810.                             j2 = 7;
  4811.                             inputString = inputString.substring(7);
  4812.                         } else if (s.startsWith("flash3:")) {
  4813.                             j2 = 8;
  4814.                             inputString = inputString.substring(7);
  4815.                         } else if (s.startsWith("glow1:")) {
  4816.                             j2 = 9;
  4817.                             inputString = inputString.substring(6);
  4818.                         } else if (s.startsWith("glow2:")) {
  4819.                             j2 = 10;
  4820.                             inputString = inputString.substring(6);
  4821.                         } else if (s.startsWith("glow3:")) {
  4822.                             j2 = 11;
  4823.                             inputString = inputString.substring(6);
  4824.                         }
  4825.                         s = inputString.toLowerCase();
  4826.                         int i3 = 0;
  4827.                         if (s.startsWith("wave:")) {
  4828.                             i3 = 1;
  4829.                             inputString = inputString.substring(5);
  4830.                         } else if (s.startsWith("wave2:")) {
  4831.                             i3 = 2;
  4832.                             inputString = inputString.substring(6);
  4833.                         } else if (s.startsWith("shake:")) {
  4834.                             i3 = 3;
  4835.                             inputString = inputString.substring(6);
  4836.                         } else if (s.startsWith("scroll:")) {
  4837.                             i3 = 4;
  4838.                             inputString = inputString.substring(7);
  4839.                         } else if (s.startsWith("slide:")) {
  4840.                             i3 = 5;
  4841.                             inputString = inputString.substring(6);
  4842.                         }
  4843.                         stream.createFrame(4);
  4844.                         stream.writeWordBigEndian(0);
  4845.                         int j3 = stream.currentOffset;
  4846.                         stream.method425(i3);
  4847.                         stream.method425(j2);
  4848.                         aStream_834.currentOffset = 0;
  4849.                         TextInput.method526(inputString, aStream_834);
  4850.                         stream.method441(0, aStream_834.buffer, aStream_834.currentOffset);
  4851.                         stream.writeBytes(stream.currentOffset - j3);
  4852.                         inputString = TextInput.processText(inputString);
  4853.                         inputString = Censor.doCensor(inputString);
  4854.                         myPlayer.textSpoken = inputString;
  4855.                         myPlayer.anInt1513 = j2;
  4856.                         myPlayer.anInt1531 = i3;
  4857.                         myPlayer.textCycle = 150;
  4858.                         if (myPrivilege == 2 || myPrivilege == 3) {
  4859.                             pushMessage(myPlayer.textSpoken, 2, "@cr2@" + myPlayer.name);
  4860.                         } else if (myPrivilege == 1) {
  4861.                             pushMessage(myPlayer.textSpoken, 2, "@cr1@" + myPlayer.name);
  4862.                         } else {
  4863.                             pushMessage(myPlayer.textSpoken, 2, myPlayer.name);
  4864.                         }
  4865.                         if (publicChatMode == 2) {
  4866.                             publicChatMode = 3;
  4867.                             aBoolean1233 = true;
  4868.                             stream.createFrame(95);
  4869.                             stream.writeWordBigEndian(publicChatMode);
  4870.                             stream.writeWordBigEndian(privateChatMode);
  4871.                             stream.writeWordBigEndian(tradeMode);
  4872.                         }
  4873.                     }
  4874.                     inputString = "";
  4875.                     inputTaken = true;
  4876.                 }
  4877.             }
  4878.         } while (true);
  4879.     }
  4880.  
  4881.     public void buildChatAreaMenu(int j) {
  4882.         int l = 0;
  4883.         for (int i1 = 0; i1 < 100; i1++) {
  4884.             if (chatMessages[i1] == null) {
  4885.                 continue;
  4886.             }
  4887.             int j1 = chatTypes[i1];
  4888.             int k1 = 70 - l * 14 + anInt1089 + 4;
  4889.             if (k1 < -20) {
  4890.                 break;
  4891.             }
  4892.             String s = chatNames[i1];
  4893.             if (s != null && s.startsWith("@cr1@")) {
  4894.                 s = s.substring(5);
  4895.             }
  4896.             if (s != null && s.startsWith("@cr2@")) {
  4897.                 s = s.substring(5);
  4898.             }
  4899.             if (j1 == 0) {
  4900.                 l++;
  4901.             }
  4902.             if ((j1 == 1 || j1 == 2) && (j1 == 1 || publicChatMode == 0 || publicChatMode == 1 && isFriendOrSelf(s))) {
  4903.                 if (j > k1 - 14 && j <= k1 && !s.equals(myPlayer.name)) {
  4904.                     if (myPrivilege >= 1 && myPrivilege <= 3) {
  4905.                         menuActionName[menuActionRow] = "Report abuse @whi@" + s;
  4906.                         menuActionID[menuActionRow] = 606;
  4907.                         menuActionRow++;
  4908.                     }
  4909.                     menuActionName[menuActionRow] = "Add ignore @whi@" + s;
  4910.                     menuActionID[menuActionRow] = 42;
  4911.                     menuActionRow++;
  4912.                     menuActionName[menuActionRow] = "Reply to @whi@" + s;
  4913.                     menuActionID[menuActionRow] = 639;
  4914.                     menuActionRow++;
  4915.                     menuActionName[menuActionRow] = "Add friend @whi@" + s;
  4916.                     menuActionID[menuActionRow] = 337;
  4917.                     menuActionRow++;
  4918.                 }
  4919.                 l++;
  4920.             }
  4921.             if ((j1 == 3 || j1 == 7) && splitpublicChat == 0 && (j1 == 7 || privateChatMode == 0 || publicChatMode == 1 && isFriendOrSelf(s))) {
  4922.                 if (j > k1 - 14 && j <= k1) {
  4923.                     if (myPrivilege >= 1 && myPrivilege <= 3) {
  4924.                         menuActionName[menuActionRow] = "Report abuse @whi@" + s;
  4925.                         menuActionID[menuActionRow] = 606;
  4926.                         menuActionRow++;
  4927.                     }
  4928.                     menuActionName[menuActionRow] = "Add ignore @whi@" + s;
  4929.                     menuActionID[menuActionRow] = 42;
  4930.                     menuActionRow++;
  4931.                     menuActionName[menuActionRow] = "Reply to @whi@" + s;
  4932.                     menuActionID[menuActionRow] = 639;
  4933.                     menuActionRow++;
  4934.                     menuActionName[menuActionRow] = "Add friend @whi@" + s;
  4935.                     menuActionID[menuActionRow] = 337;
  4936.                     menuActionRow++;
  4937.                 }
  4938.                 l++;
  4939.             }
  4940.             if (j1 == 4 && (tradeMode == 0 || tradeMode == 1 && isFriendOrSelf(s))) {
  4941.                 if (j > k1 - 14 && j <= k1) {
  4942.                     menuActionName[menuActionRow] = "Accept trade @whi@" + s;
  4943.                     menuActionID[menuActionRow] = 484;
  4944.                     menuActionRow++;
  4945.                 }
  4946.                 l++;
  4947.             }
  4948.             if ((j1 == 5 || j1 == 6) && splitpublicChat == 0 && privateChatMode < 2) {
  4949.                 l++;
  4950.             }
  4951.             if (j1 == 8 && (tradeMode == 0 || tradeMode == 1 && isFriendOrSelf(s))) {
  4952.                 if (j > k1 - 14 && j <= k1) {
  4953.                     menuActionName[menuActionRow] = "Accept challenge @whi@" + s;
  4954.                     menuActionID[menuActionRow] = 6;
  4955.                     menuActionRow++;
  4956.                 }
  4957.                 l++;
  4958.             }
  4959.         }
  4960.  
  4961.     }
  4962.  
  4963.     public void drawFriendsListOrWelcomeScreen(RSInterface class9) {
  4964.         int j = class9.anInt214;
  4965.         if (j >= 1 && j <= 100 || j >= 701 && j <= 800) {
  4966.             if (j == 1 && anInt900 == 0) {
  4967.                 class9.disabledText = "Loading friend list";
  4968.                 class9.atActionType = 0;
  4969.                 return;
  4970.             }
  4971.             if (j == 1 && anInt900 == 1) {
  4972.                 class9.disabledText = "Connecting to friendserver";
  4973.                 class9.atActionType = 0;
  4974.                 return;
  4975.             }
  4976.             if (j == 2 && anInt900 != 2) {
  4977.                 class9.disabledText = "Please wait...";
  4978.                 class9.atActionType = 0;
  4979.                 return;
  4980.             }
  4981.             int k = friendsCount;
  4982.             if (anInt900 != 2) {
  4983.                 k = 0;
  4984.             }
  4985.             if (j > 700) {
  4986.                 j -= 601;
  4987.             } else {
  4988.                 j--;
  4989.             }
  4990.             if (j >= k) {
  4991.                 class9.disabledText = "";
  4992.                 class9.atActionType = 0;
  4993.                 return;
  4994.             } else {
  4995.                 class9.disabledText = friendsList[j];
  4996.                 class9.atActionType = 1;
  4997.                 return;
  4998.             }
  4999.         }
  5000.         if (j >= 101 && j <= 200 || j >= 801 && j <= 900) {
  5001.             int l = friendsCount;
  5002.             if (anInt900 != 2) {
  5003.                 l = 0;
  5004.             }
  5005.             if (j > 800) {
  5006.                 j -= 701;
  5007.             } else {
  5008.                 j -= 101;
  5009.             }
  5010.             if (j >= l) {
  5011.                 class9.disabledText = "";
  5012.                 class9.atActionType = 0;
  5013.                 return;
  5014.             }
  5015.             if (friendsNodeIDs[j] == 0) {
  5016.                 class9.disabledText = "@red@Offline";
  5017.             } else if (friendsNodeIDs[j] == nodeID) {
  5018.                 class9.disabledText = "@gre@World-1";
  5019.             } else {
  5020.                 class9.disabledText = "@red@Offline";
  5021.             }
  5022.             class9.atActionType = 1;
  5023.             return;
  5024.         }
  5025.         if (j == 203) {
  5026.             int i1 = friendsCount;
  5027.             if (anInt900 != 2) {
  5028.                 i1 = 0;
  5029.             }
  5030.             class9.scrollMax = i1 * 15 + 20;
  5031.             if (class9.scrollMax <= class9.height) {
  5032.                 class9.scrollMax = class9.height + 1;
  5033.             }
  5034.             return;
  5035.         }
  5036.         if (j >= 401 && j <= 500) {
  5037.             if ((j -= 401) == 0 && anInt900 == 0) {
  5038.                 class9.disabledText = "Loading ignore list";
  5039.                 class9.atActionType = 0;
  5040.                 return;
  5041.             }
  5042.             if (j == 1 && anInt900 == 0) {
  5043.                 class9.disabledText = "Please wait...";
  5044.                 class9.atActionType = 0;
  5045.                 return;
  5046.             }
  5047.             int j1 = ignoreCount;
  5048.             if (anInt900 == 0) {
  5049.                 j1 = 0;
  5050.             }
  5051.             if (j >= j1) {
  5052.                 class9.disabledText = "";
  5053.                 class9.atActionType = 0;
  5054.                 return;
  5055.             } else {
  5056.                 class9.disabledText = TextClass.fixName(TextClass.nameForLong(ignoreListAsLongs[j]));
  5057.                 class9.atActionType = 1;
  5058.                 return;
  5059.             }
  5060.         }
  5061.         if (j == 503) {
  5062.             class9.scrollMax = ignoreCount * 15 + 20;
  5063.             if (class9.scrollMax <= class9.height) {
  5064.                 class9.scrollMax = class9.height + 1;
  5065.             }
  5066.             return;
  5067.         }
  5068.         if (j == 327) {
  5069.             class9.anInt270 = 150;
  5070.             class9.anInt271 = (int) (Math.sin((double) loopCycle / 40D) * 256D) & 0x7ff;
  5071.             if (aBoolean1031) {
  5072.                 for (int k1 = 0; k1 < 7; k1++) {
  5073.                     int l1 = anIntArray1065[k1];
  5074.                     if (l1 >= 0 && !IDK.cache[l1].method537()) {
  5075.                         return;
  5076.                     }
  5077.                 }
  5078.  
  5079.                 aBoolean1031 = false;
  5080.                 Model aclass30_sub2_sub4_sub6s[] = new Model[7];
  5081.                 int i2 = 0;
  5082.                 for (int j2 = 0; j2 < 7; j2++) {
  5083.                     int k2 = anIntArray1065[j2];
  5084.                     if (k2 >= 0) {
  5085.                         aclass30_sub2_sub4_sub6s[i2++] = IDK.cache[k2].method538();
  5086.                     }
  5087.                 }
  5088.  
  5089.                 Model model = new Model(i2, aclass30_sub2_sub4_sub6s);
  5090.                 for (int l2 = 0; l2 < 5; l2++) {
  5091.                     if (anIntArray990[l2] != 0) {
  5092.                         model.method476(anIntArrayArray1003[l2][0], anIntArrayArray1003[l2][anIntArray990[l2]]);
  5093.                         if (l2 == 1) {
  5094.                             model.method476(anIntArray1204[0], anIntArray1204[anIntArray990[l2]]);
  5095.                         }
  5096.                     }
  5097.                 }
  5098.  
  5099.                 model.method469();
  5100.                 model.method470(Animation.anims[myPlayer.anInt1511].anIntArray353[0]);
  5101.                 model.method479(64, 850, -30, -50, -30, true);
  5102.                 class9.anInt233 = 5;
  5103.                 class9.mediaID = 0;
  5104.                 RSInterface.method208(model, 0, 5);
  5105.             }
  5106.             return;
  5107.         }
  5108.         if (j == 324) {
  5109.             if (aClass30_Sub2_Sub1_Sub1_931 == null) {
  5110.                 aClass30_Sub2_Sub1_Sub1_931 = class9.sprite1;
  5111.                 aClass30_Sub2_Sub1_Sub1_932 = class9.sprite2;
  5112.             }
  5113.             if (aBoolean1047) {
  5114.                 class9.sprite1 = aClass30_Sub2_Sub1_Sub1_932;
  5115.                 return;
  5116.             } else {
  5117.                 class9.sprite1 = aClass30_Sub2_Sub1_Sub1_931;
  5118.                 return;
  5119.             }
  5120.         }
  5121.         if (j == 325) {
  5122.             if (aClass30_Sub2_Sub1_Sub1_931 == null) {
  5123.                 aClass30_Sub2_Sub1_Sub1_931 = class9.sprite1;
  5124.                 aClass30_Sub2_Sub1_Sub1_932 = class9.sprite2;
  5125.             }
  5126.             if (aBoolean1047) {
  5127.                 class9.sprite1 = aClass30_Sub2_Sub1_Sub1_931;
  5128.                 return;
  5129.             } else {
  5130.                 class9.sprite1 = aClass30_Sub2_Sub1_Sub1_932;
  5131.                 return;
  5132.             }
  5133.         }
  5134.         if (j == 600) {
  5135.             class9.disabledText = reportAbuseInput;
  5136.             if (loopCycle % 20 < 10) {
  5137.                 class9.disabledText += "|";
  5138.                 return;
  5139.             } else {
  5140.                 class9.disabledText += " ";
  5141.                 return;
  5142.             }
  5143.         }
  5144.         if (j == 613) {
  5145.             if (myPrivilege >= 1 && myPrivilege <= 3) {
  5146.                 if (canMute) {
  5147.                     class9.textColor = 0xff0000;
  5148.                     class9.disabledText = "Moderator option: Mute player for 48 hours: <ON>";
  5149.                 } else {
  5150.                     class9.textColor = 0xffffff;
  5151.                     class9.disabledText = "Moderator option: Mute player for 48 hours: <OFF>";
  5152.                 }
  5153.             } else {
  5154.                 class9.disabledText = "";
  5155.             }
  5156.         }
  5157.         if (j == 660) {
  5158.             int k1 = anInt1170 - anInt1215;
  5159.             String s1;
  5160.             if (k1 <= 0)
  5161.                 s1 = "earlier today";
  5162.             else if (k1 == 1)
  5163.                 s1 = "yesterday";
  5164.             else
  5165.                 s1 = k1 + " days ago";
  5166.             class9.disabledText = "You last logged in @red@" + s1
  5167.                     + "@bla@ from: @red@" + Signlink.dns;
  5168.         }
  5169.         if (j == 661)
  5170.             if (anInt1034 == 0)
  5171.                 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.";
  5172.             else if (anInt1034 <= anInt1170) {
  5173.                 class9.disabledText = "\\n\\nRecovery Questions Last Set:\\n@gre@"
  5174.                         + method104(anInt1034);
  5175.             } else {
  5176.                 int l1 = (anInt1170 + 14) - anInt1034;
  5177.                 String s2;
  5178.                 if (l1 <= 0)
  5179.                     s2 = "Earlier today";
  5180.                 else if (l1 == 1)
  5181.                     s2 = "Yesterday";
  5182.                 else
  5183.                     s2 = l1 + " days ago";
  5184.                 class9.disabledText = s2
  5185.                         + " you requested@lre@ new recovery\\n@lre@questions.@yel@ The requested change will occur\\non: @lre@"
  5186.                         + method104(anInt1034)
  5187.                         + "\\n\\nIf you do not remember making this request\\ncancel it immediately, and change your password.";
  5188.             }
  5189.         if (j == 662) {
  5190.             String s;
  5191.             if (anInt1273 == 0)
  5192.                 s = "@yel@0 unread messages";
  5193.             else if (anInt1273 == 1)
  5194.                 s = "@gre@1 unread message";
  5195.             else
  5196.                 s = "@gre@" + anInt1273 + " unread messages";
  5197.             class9.disabledText = "You have " + s + "\\nin your message centre.";
  5198.         }
  5199.         if (j == 663)
  5200.             if (anInt1083 <= 0 || anInt1083 > anInt1170 + 10)
  5201.                 class9.disabledText = "Last password change:\\n@gre@Never changed";
  5202.             else
  5203.                 class9.disabledText = "Last password change:\\n@gre@"
  5204.                         + method104(anInt1083);
  5205.         if (j == 665)
  5206.             if (anInt992 > 2 && !isMembers)
  5207.                 class9.disabledText = "This is a non-members\\nworld. To enjoy your\\nmembers benefits we\\nrecommend you play on a\\nmembers world instead.";
  5208.             else if (anInt992 > 2)
  5209.                 class9.disabledText = "\\n\\nYou have @gre@" + anInt992
  5210.                         + "@yel@ days of\\nmember credit remaining.";
  5211.             else if (anInt992 > 0)
  5212.                 class9.disabledText = "You have @gre@"
  5213.                         + anInt992
  5214.                         + "@yel@ days of\\nmember credit remaining.\\n\\n@lre@Credit low! Renew now\\n@lre@to avoid losing members.";
  5215.             else
  5216.                 class9.disabledText = "You are not a member.\\n\\nChoose to subscribe and\\nyou'll get loads of extra\\nbenefits and features.";
  5217.         if (j == 667)
  5218.             if (anInt992 > 2 && !isMembers)
  5219.                 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.";
  5220.             else if (anInt992 > 0)
  5221.                 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.)";
  5222.             else
  5223.                 class9.disabledText = "To start a subscripton:\\n1) Logout and return to the frontpage of this website.\\n2) Choose 'Start a new subscription'";
  5224.         if (j == 668) {
  5225.             if (anInt1034 > anInt1170) {
  5226.                 class9.disabledText = "To cancel this request:\\n1) Logout and return to the frontpage of this website.\\n2) Choose 'Cancel recovery questions'.";
  5227.                 return;
  5228.             }
  5229.             class9.disabledText = "To change your recovery questions:\\n1) Logout and return to the frontpage of this website.\\n2) Choose 'Set new recovery questions'.";
  5230.         }
  5231.     }
  5232.    
  5233.     public String method104(int i) {
  5234.         if (i > anInt1170 + 10) {
  5235.             return "Unknown";
  5236.         } else {
  5237.             long l = ((long) i + 11745L) * 0x5265c00L;
  5238.             Calendar calendar = Calendar.getInstance();
  5239.             calendar.setTime(new Date(l));
  5240.             int j = calendar.get(5);
  5241.             int k = calendar.get(2);
  5242.             int i1 = calendar.get(1);
  5243.             String as[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul",
  5244.                     "Aug", "Sep", "Oct", "Nov", "Dec" };
  5245.             return j + "-" + as[k] + "-" + i1;
  5246.         }
  5247.     }
  5248.  
  5249.     public void drawSplitpublicChat() {
  5250.         if (splitpublicChat == 0) {
  5251.             return;
  5252.         }
  5253.         TextDrawingArea textDrawingArea = aTextDrawingArea_1271;
  5254.         int i = 0;
  5255.         if (anInt1104 != 0) {
  5256.             i = 1;
  5257.         }
  5258.         for (int j = 0; j < 100; j++) {
  5259.             if (chatMessages[j] != null) {
  5260.                 int k = chatTypes[j];
  5261.                 String s = chatNames[j];
  5262.                 byte byte1 = 0;
  5263.                 if (s != null && s.startsWith("@cr1@")) {
  5264.                     s = s.substring(5);
  5265.                     byte1 = 1;
  5266.                 }
  5267.                 if (s != null && s.startsWith("@cr2@")) {
  5268.                     s = s.substring(5);
  5269.                     byte1 = 2;
  5270.                 }
  5271.                 if ((k == 3 || k == 7) && (k == 7 || privateChatMode == 0 || privateChatMode == 1 && isFriendOrSelf(s))) {
  5272.                     int l = 329 - i * 13;
  5273.                     int k1 = 4;
  5274.                     textDrawingArea.method385(0, "From", l, k1);
  5275.                     textDrawingArea.method385(65535, "From", l - 1, k1);
  5276.                     k1 += textDrawingArea.getTextWidth("From ");
  5277.                     if (byte1 == 1) {
  5278.                         modIcons[0].method361(k1, l - 12);
  5279.                         k1 += 14;
  5280.                     }
  5281.                     if (byte1 == 2) {
  5282.                         modIcons[1].method361(k1, l - 12);
  5283.                         k1 += 14;
  5284.                     }
  5285.                     textDrawingArea.method385(0, s + ": " + chatMessages[j], l, k1);
  5286.                     textDrawingArea.method385(65535, s + ": " + chatMessages[j], l - 1, k1);
  5287.                     if (++i >= 5) {
  5288.                         return;
  5289.                     }
  5290.                 }
  5291.                 if (k == 5 && privateChatMode < 2) {
  5292.                     int i1 = 329 - i * 13;
  5293.                     textDrawingArea.method385(0, chatMessages[j], i1, 4);
  5294.                     textDrawingArea.method385(65535, chatMessages[j], i1 - 1, 4);
  5295.                     if (++i >= 5) {
  5296.                         return;
  5297.                     }
  5298.                 }
  5299.                 if (k == 6 && privateChatMode < 2) {
  5300.                     int j1 = 329 - i * 13;
  5301.                     textDrawingArea.method385(0, "To " + s + ": " + chatMessages[j], j1, 4);
  5302.                     textDrawingArea.method385(65535, "To " + s + ": " + chatMessages[j], j1 - 1, 4);
  5303.                     if (++i >= 5) {
  5304.                         return;
  5305.                     }
  5306.                 }
  5307.             }
  5308.         }
  5309.  
  5310.     }
  5311.  
  5312.     public void pushMessage(String s, int i, String s1) {
  5313.         if (i == 0 && dialogID != -1) {
  5314.             aString844 = s;
  5315.             super.clickMode3 = 0;
  5316.         }
  5317.         if (backDialogID == -1) {
  5318.             inputTaken = true;
  5319.         }
  5320.         for (int j = 99; j > 0; j--) {
  5321.             chatTypes[j] = chatTypes[j - 1];
  5322.             chatNames[j] = chatNames[j - 1];
  5323.             chatMessages[j] = chatMessages[j - 1];
  5324.         }
  5325.  
  5326.         chatTypes[0] = i;
  5327.         chatNames[0] = s1;
  5328.         chatMessages[0] = s;
  5329.     }
  5330.  
  5331.     public void processTabClick() {
  5332.         if (super.clickMode3 == 1) {
  5333.             if (super.saveClickX >= 539 && super.saveClickX <= 573 && super.saveClickY >= 169 && super.saveClickY < 205 && tabInterfaceIDs[0] != -1) {
  5334.                 needDrawTabArea = true;
  5335.                 tabID = 0;
  5336.                 tabAreaAltered = true;
  5337.             }
  5338.             if (super.saveClickX >= 569 && super.saveClickX <= 599 && super.saveClickY >= 168 && super.saveClickY < 205 && tabInterfaceIDs[1] != -1) {
  5339.                 needDrawTabArea = true;
  5340.                 tabID = 1;
  5341.                 tabAreaAltered = true;
  5342.             }
  5343.             if (super.saveClickX >= 597 && super.saveClickX <= 627 && super.saveClickY >= 168 && super.saveClickY < 205 && tabInterfaceIDs[2] != -1) {
  5344.                 needDrawTabArea = true;
  5345.                 tabID = 2;
  5346.                 tabAreaAltered = true;
  5347.             }
  5348.             if (super.saveClickX >= 625 && super.saveClickX <= 669 && super.saveClickY >= 168 && super.saveClickY < 203 && tabInterfaceIDs[3] != -1) {
  5349.                 needDrawTabArea = true;
  5350.                 tabID = 3;
  5351.                 tabAreaAltered = true;
  5352.             }
  5353.             if (super.saveClickX >= 666 && super.saveClickX <= 696 && super.saveClickY >= 168 && super.saveClickY < 205 && tabInterfaceIDs[4] != -1) {
  5354.                 needDrawTabArea = true;
  5355.                 tabID = 4;
  5356.                 tabAreaAltered = true;
  5357.             }
  5358.             if (super.saveClickX >= 694 && super.saveClickX <= 724 && super.saveClickY >= 168 && super.saveClickY < 205 && tabInterfaceIDs[5] != -1) {
  5359.                 needDrawTabArea = true;
  5360.                 tabID = 5;
  5361.                 tabAreaAltered = true;
  5362.             }
  5363.             if (super.saveClickX >= 722 && super.saveClickX <= 756 && super.saveClickY >= 169 && super.saveClickY < 205 && tabInterfaceIDs[6] != -1) {
  5364.                 needDrawTabArea = true;
  5365.                 tabID = 6;
  5366.                 tabAreaAltered = true;
  5367.             }
  5368.             if (super.saveClickX >= 540 && super.saveClickX <= 574 && super.saveClickY >= 466 && super.saveClickY < 502 && tabInterfaceIDs[7] != -1) {
  5369.                 needDrawTabArea = true;
  5370.                 tabID = 7;
  5371.                 tabAreaAltered = true;
  5372.             }
  5373.             if (super.saveClickX >= 572 && super.saveClickX <= 602 && super.saveClickY >= 466 && super.saveClickY < 503 && tabInterfaceIDs[8] != -1) {
  5374.                 needDrawTabArea = true;
  5375.                 tabID = 8;
  5376.                 tabAreaAltered = true;
  5377.             }
  5378.             if (super.saveClickX >= 599 && super.saveClickX <= 629 && super.saveClickY >= 466 && super.saveClickY < 503 && tabInterfaceIDs[9] != -1) {
  5379.                 needDrawTabArea = true;
  5380.                 tabID = 9;
  5381.                 tabAreaAltered = true;
  5382.             }
  5383.             if (super.saveClickX >= 627 && super.saveClickX <= 671 && super.saveClickY >= 467 && super.saveClickY < 502 && tabInterfaceIDs[10] != -1) {
  5384.                 needDrawTabArea = true;
  5385.                 tabID = 10;
  5386.                 tabAreaAltered = true;
  5387.             }
  5388.             if (super.saveClickX >= 669 && super.saveClickX <= 699 && super.saveClickY >= 466 && super.saveClickY < 503 && tabInterfaceIDs[11] != -1) {
  5389.                 needDrawTabArea = true;
  5390.                 tabID = 11;
  5391.                 tabAreaAltered = true;
  5392.             }
  5393.             if (super.saveClickX >= 696 && super.saveClickX <= 726 && super.saveClickY >= 466 && super.saveClickY < 503 && tabInterfaceIDs[12] != -1) {
  5394.                 needDrawTabArea = true;
  5395.                 tabID = 12;
  5396.                 tabAreaAltered = true;
  5397.             }
  5398.             if (super.saveClickX >= 724 && super.saveClickX <= 758 && super.saveClickY >= 466 && super.saveClickY < 502 && tabInterfaceIDs[13] != -1) {
  5399.                 needDrawTabArea = true;
  5400.                 tabID = 13;
  5401.                 tabAreaAltered = true;
  5402.             }
  5403.             if (anInt1054 == tabID) {
  5404.                 stream.createFrame(152);
  5405.                 stream.writeWordBigEndian(tabID);
  5406.             }
  5407.         }
  5408.     }
  5409.    
  5410.     public void resetImageProducers() {
  5411.         if (aRSImageProducer_1107 != null) {
  5412.             return;
  5413.         }
  5414.         super.fullGameScreen = null;
  5415.         aRSImageProducer_1166 = null;
  5416.         aRSImageProducer_1164 = null;
  5417.         aRSImageProducer_1163 = null;
  5418.         aRSImageProducer_1165 = null;
  5419.         aRSImageProducer_1123 = null;
  5420.         aRSImageProducer_1124 = null;
  5421.         aRSImageProducer_1125 = null;
  5422.         aRSImageProducer_1110 = new RSImageProducer(128, 265, getGameComponent());
  5423.         DrawingArea.setAllPixelsToZero();
  5424.         aRSImageProducer_1111 = new RSImageProducer(128, 265, getGameComponent());
  5425.         DrawingArea.setAllPixelsToZero();
  5426.         aRSImageProducer_1107 = new RSImageProducer(509, 171, getGameComponent());
  5427.         DrawingArea.setAllPixelsToZero();
  5428.         aRSImageProducer_1108 = new RSImageProducer(360, 132, getGameComponent());
  5429.         DrawingArea.setAllPixelsToZero();
  5430.         aRSImageProducer_1109 = new RSImageProducer(360, 200, getGameComponent());
  5431.         DrawingArea.setAllPixelsToZero();
  5432.         aRSImageProducer_1112 = new RSImageProducer(202, 238, getGameComponent());
  5433.         DrawingArea.setAllPixelsToZero();
  5434.         aRSImageProducer_1113 = new RSImageProducer(203, 238, getGameComponent());
  5435.         DrawingArea.setAllPixelsToZero();
  5436.         aRSImageProducer_1114 = new RSImageProducer(74, 94, getGameComponent());
  5437.         DrawingArea.setAllPixelsToZero();
  5438.         aRSImageProducer_1115 = new RSImageProducer(75, 94, getGameComponent());
  5439.         DrawingArea.setAllPixelsToZero();
  5440.         if (titleStreamLoader != null) {
  5441.             drawLogo();
  5442.             loadTitleScreen();
  5443.         }
  5444.         welcomeScreenRaised = true;
  5445.     }
  5446.    
  5447.     public void resetAllImageProducers() {
  5448.         if (super.fullGameScreen != null)
  5449.             return;
  5450.         nullLoader();
  5451.         aRSImageProducer_1107 = null;
  5452.         aRSImageProducer_1108 = null;
  5453.         aRSImageProducer_1109 = null;
  5454.         aRSImageProducer_1112 = null;
  5455.         aRSImageProducer_1113 = null;
  5456.         aRSImageProducer_1114 = null;
  5457.         aRSImageProducer_1115 = null;
  5458.         aRSImageProducer_1166 = null;
  5459.         aRSImageProducer_1164 = null;
  5460.         aRSImageProducer_1163 = null;
  5461.         aRSImageProducer_1165 = null;
  5462.         aRSImageProducer_1123 = null;
  5463.         aRSImageProducer_1125 = null;
  5464.         aRSImageProducer_1124 = null;
  5465.         super.fullGameScreen = new RSImageProducer(765, 503, getGameComponent());
  5466.         welcomeScreenRaised = true;
  5467.     }
  5468.  
  5469.     public void resetImageProducers2() {
  5470.         if (aRSImageProducer_1166 != null) {
  5471.             return;
  5472.         }
  5473.         nullLoader();
  5474.         super.fullGameScreen = null;
  5475.         aRSImageProducer_1107 = null;
  5476.         aRSImageProducer_1108 = null;
  5477.         aRSImageProducer_1109 = null;
  5478.         aRSImageProducer_1110 = null;
  5479.         aRSImageProducer_1111 = null;
  5480.         aRSImageProducer_1112 = null;
  5481.         aRSImageProducer_1113 = null;
  5482.         aRSImageProducer_1114 = null;
  5483.         aRSImageProducer_1115 = null;
  5484.         aRSImageProducer_1166 = new RSImageProducer(479, 96, getGameComponent());
  5485.         aRSImageProducer_1164 = new RSImageProducer(172, 156, getGameComponent());
  5486.         DrawingArea.setAllPixelsToZero();
  5487.         mapBack.method361(0, 0);
  5488.         aRSImageProducer_1163 = new RSImageProducer(190, 261, getGameComponent());
  5489.         aRSImageProducer_1165 = new RSImageProducer(512, 334, getGameComponent());
  5490.         DrawingArea.setAllPixelsToZero();
  5491.         aRSImageProducer_1123 = new RSImageProducer(496, 50, getGameComponent());
  5492.         aRSImageProducer_1124 = new RSImageProducer(269, 37, getGameComponent());
  5493.         aRSImageProducer_1125 = new RSImageProducer(249, 45, getGameComponent());
  5494.         welcomeScreenRaised = true;
  5495.         aRSImageProducer_1165.initDrawingArea();
  5496.         Texture.lineOffsets = chatBoxAreaOffsets;
  5497.         // SignLink.midii.fadeOut();
  5498.     }
  5499.  
  5500.     public void method81(Sprite sprite, int y, int x) {
  5501.         int l = x * x + y * y;
  5502.         if (l > 4225 && l < 90000) {
  5503.             int i1 = minimapInt1 + minimapInt2 & 0x7ff;
  5504.             int j1 = Model.modelIntArray1[i1];
  5505.             int k1 = Model.modelIntArray2[i1];
  5506.             j1 = (j1 * 256) / (minimapInt3 + 256);
  5507.             k1 = (k1 * 256) / (minimapInt3 + 256);
  5508.             int l1 = y * j1 + x * k1 >> 16;
  5509.             int i2 = y * k1 - x * j1 >> 16;
  5510.             double d = Math.atan2((double) l1, (double) i2);
  5511.             int j2 = (int) (Math.sin(d) * 63D);
  5512.             int k2 = (int) (Math.cos(d) * 57D);
  5513.             mapEdge.method353(83 - k2 - 20, d, 94 + j2 + 4 - 10);
  5514.         } else {
  5515.             markMinimap(sprite, x, y);
  5516.         }
  5517.     }
  5518.  
  5519.     public void processRightClick() {
  5520.         if (activeInterfaceType != 0) {
  5521.             return;
  5522.         }
  5523.         menuActionName[0] = "Cancel";
  5524.         menuActionID[0] = 1107;
  5525.         menuActionRow = 1;
  5526.         if(fullScreenBackDialogID != -1) {
  5527.             anInt886 = 0;
  5528.             buildInterfaceMenu(0, RSInterface.interfaceCache[fullScreenBackDialogID], super.mouseX, 0, super.mouseY, 0);
  5529.             if (anInt886 != anInt1026) {
  5530.                 anInt1026 = anInt886;
  5531.             }
  5532.             return;
  5533.         }
  5534.         buildSplitPrivateChatMenu();
  5535.         anInt886 = 0;
  5536.         if (super.mouseX > 4 && super.mouseY > 4 && super.mouseX < 516 && super.mouseY < 338) {
  5537.             if (openInterfaceID != -1) {
  5538.                 buildInterfaceMenu(4, RSInterface.interfaceCache[openInterfaceID], super.mouseX, 4, super.mouseY, 0);
  5539.             } else {
  5540.                 build3dScreenMenu();
  5541.             }
  5542.         }
  5543.         if (anInt886 != anInt1026) {
  5544.             anInt1026 = anInt886;
  5545.         }
  5546.         anInt886 = 0;
  5547.         if (super.mouseX > 553 && super.mouseY > 205 && super.mouseX < 743 && super.mouseY < 466) {
  5548.             if (invOverlayInterfaceID != -1) {
  5549.                 buildInterfaceMenu(553, RSInterface.interfaceCache[invOverlayInterfaceID], super.mouseX, 205, super.mouseY, 0);
  5550.             } else if (tabInterfaceIDs[tabID] != -1) {
  5551.                 buildInterfaceMenu(553, RSInterface.interfaceCache[tabInterfaceIDs[tabID]], super.mouseX, 205, super.mouseY, 0);
  5552.             }
  5553.         }
  5554.         if (anInt886 != anInt1048) {
  5555.             needDrawTabArea = true;
  5556.             anInt1048 = anInt886;
  5557.         }
  5558.         anInt886 = 0;
  5559.         if (super.mouseX > 17 && super.mouseY > 357 && super.mouseX < 496 && super.mouseY < 453) {
  5560.             if (backDialogID != -1) {
  5561.                 buildInterfaceMenu(17, RSInterface.interfaceCache[backDialogID], super.mouseX, 357, super.mouseY, 0);
  5562.             } else if (dialogID != -1) {
  5563.                 buildInterfaceMenu(17, RSInterface.interfaceCache[dialogID], super.mouseX, 357, super.mouseY, 0);
  5564.             } else if (super.mouseY < 434 && super.mouseX < 426) {
  5565.                 buildChatAreaMenu(super.mouseY - 357);
  5566.             }
  5567.         }
  5568.         if ((backDialogID != -1 || dialogID != -1) && anInt886 != anInt1039) {//TODO remove if any issues
  5569.             inputTaken = true;
  5570.             anInt1039 = anInt886;
  5571.         }
  5572.         boolean flag = false;
  5573.         while (!flag) {
  5574.             flag = true;
  5575.             for (int j = 0; j < menuActionRow - 1; j++) {
  5576.                 if (menuActionID[j] < 1000 && menuActionID[j + 1] > 1000) {
  5577.                     String s = menuActionName[j];
  5578.                     menuActionName[j] = menuActionName[j + 1];
  5579.                     menuActionName[j + 1] = s;
  5580.                     int k = menuActionID[j];
  5581.                     menuActionID[j] = menuActionID[j + 1];
  5582.                     menuActionID[j + 1] = k;
  5583.                     k = menuActionCmd2[j];
  5584.                     menuActionCmd2[j] = menuActionCmd2[j + 1];
  5585.                     menuActionCmd2[j + 1] = k;
  5586.                     k = menuActionCmd3[j];
  5587.                     menuActionCmd3[j] = menuActionCmd3[j + 1];
  5588.                     menuActionCmd3[j + 1] = k;
  5589.                     k = menuActionCmd1[j];
  5590.                     menuActionCmd1[j] = menuActionCmd1[j + 1];
  5591.                     menuActionCmd1[j + 1] = k;
  5592.                     flag = false;
  5593.                 }
  5594.             }
  5595.  
  5596.         }
  5597.     }
  5598.  
  5599.     public int method83(int i, int j, int k) {
  5600.         int l = 256 - k;
  5601.         return ((i & 0xff00ff) * l + (j & 0xff00ff) * k & 0xff00ff00) + ((i & 0xff00) * l + (j & 0xff00) * k & 0xff0000) >> 8;
  5602.     }
  5603.  
  5604.     public void login(String s, String s1, boolean flag) {
  5605.         Signlink.errorname = s;
  5606.         try {
  5607.             if (!flag) {
  5608.                 loginMessage1 = "";
  5609.                 loginMessage2 = "Connecting to server...";
  5610.                 drawLoginScreen(true);
  5611.             }
  5612.             socketStream = new RSSocket(this, openSocket(43594 + portOff));
  5613.             long l = TextClass.longForName(s);
  5614.             int i = (int) (l >> 16 & 31L);
  5615.             stream.currentOffset = 0;
  5616.             stream.writeWordBigEndian(14);
  5617.             stream.writeWordBigEndian(i);
  5618.             socketStream.queueBytes(2, stream.buffer);
  5619.             for (int j = 0; j < 8; j++) {
  5620.                 socketStream.read();
  5621.             }
  5622.  
  5623.             int k = socketStream.read();
  5624.             int i1 = k;
  5625.             if (k == 0) {
  5626.                 socketStream.flushInputStream(inStream.buffer, 8);
  5627.                 inStream.currentOffset = 0;
  5628.                 aLong1215 = inStream.readQWord();
  5629.                 int ai[] = new int[4];
  5630.                 ai[0] = (int) (Math.random() * 99999999D);
  5631.                 ai[1] = (int) (Math.random() * 99999999D);
  5632.                 ai[2] = (int) (aLong1215 >> 32);
  5633.                 ai[3] = (int) aLong1215;
  5634.                 stream.currentOffset = 0;
  5635.                 stream.writeWordBigEndian(10);
  5636.                 stream.writeDWord(ai[0]);
  5637.                 stream.writeDWord(ai[1]);
  5638.                 stream.writeDWord(ai[2]);
  5639.                 stream.writeDWord(ai[3]);
  5640.                 stream.writeDWord(ClientSettings.UID);
  5641.                 stream.writeString(s);
  5642.                 stream.writeString(s1);
  5643.                 stream.doKeys();
  5644.                 aStream_847.currentOffset = 0;
  5645.                 if (flag) {
  5646.                     aStream_847.writeWordBigEndian(18);
  5647.                 } else {
  5648.                     aStream_847.writeWordBigEndian(16);
  5649.                 }
  5650.                 aStream_847.writeWordBigEndian(stream.currentOffset + 36 + 1 + 1 + 2);
  5651.                 aStream_847.writeWordBigEndian(255);
  5652.                 aStream_847.writeWord(1);
  5653.                 aStream_847.writeWordBigEndian(lowMem ? 1 : 0);
  5654.                 for (int l1 = 0; l1 < 9; l1++) {
  5655.                     aStream_847.writeDWord(expectedCRCs[l1]);
  5656.                 }
  5657.  
  5658.                 aStream_847.writeBytes(stream.buffer, stream.currentOffset, 0);
  5659.                 stream.encryption = new ISAACRandomGen(ai);
  5660.                 for (int j2 = 0; j2 < 4; j2++) {
  5661.                     ai[j2] += 50;
  5662.                 }
  5663.  
  5664.                 encryption = new ISAACRandomGen(ai);
  5665.                 socketStream.queueBytes(aStream_847.currentOffset, aStream_847.buffer);
  5666.                 k = socketStream.read();
  5667.             }
  5668.             if (k == 1) {
  5669.                 try {
  5670.                     Thread.sleep(2000L);
  5671.                 } catch (Exception _ex) {
  5672.                 }
  5673.                 login(s, s1, flag);
  5674.                 return;
  5675.             }
  5676.             if (k == 2) {
  5677.                 myPrivilege = socketStream.read();
  5678.                 flagged = socketStream.read() == 1;
  5679.                 aLong1220 = 0L;
  5680.                 anInt1022 = 0;
  5681.                 mouseDetection.coordsIndex = 0;
  5682.                 super.awtFocus = true;
  5683.                 aBoolean954 = true;
  5684.                 loggedIn = true;
  5685.                 stream.currentOffset = 0;
  5686.                 inStream.currentOffset = 0;
  5687.                 pktType = -1;
  5688.                 anInt841 = -1;
  5689.                 anInt842 = -1;
  5690.                 anInt843 = -1;
  5691.                 pktSize = 0;
  5692.                 anInt1009 = 0;
  5693.                 anInt1104 = 0;
  5694.                 anInt1011 = 0;
  5695.                 anInt855 = 0;
  5696.                 menuActionRow = 0;
  5697.                 menuOpen = false;
  5698.                 super.idleTime = 0;
  5699.                 for (int j1 = 0; j1 < 100; j1++) {
  5700.                     chatMessages[j1] = null;
  5701.                 }
  5702.  
  5703.                 itemSelected = 0;
  5704.                 spellSelected = 0;
  5705.                 loadingStage = 0;
  5706.                 currentSound = 0;
  5707.                 anInt1278 = (int) (Math.random() * 100D) - 50;
  5708.                 anInt1131 = (int) (Math.random() * 110D) - 55;
  5709.                 anInt896 = (int) (Math.random() * 80D) - 40;
  5710.                 minimapInt2 = (int) (Math.random() * 120D) - 60;
  5711.                 minimapInt3 = (int) (Math.random() * 30D) - 20;
  5712.                 minimapInt1 = (int) (Math.random() * 20D) - 10 & 0x7ff;
  5713.                 anInt1021 = 0;
  5714.                 anInt985 = -1;
  5715.                 destX = 0;
  5716.                 destY = 0;
  5717.                 playerCount = 0;
  5718.                 npcCount = 0;
  5719.                 for (int i2 = 0; i2 < maxPlayers; i2++) {
  5720.                     playerArray[i2] = null;
  5721.                     aStreamArray895s[i2] = null;
  5722.                 }
  5723.  
  5724.                 for (int k2 = 0; k2 < 16384; k2++) {
  5725.                     npcArray[k2] = null;
  5726.                 }
  5727.  
  5728.                 myPlayer = playerArray[myPlayerIndex] = new Player();
  5729.                 aClass19_1013.removeAll();
  5730.                 aClass19_1056.removeAll();
  5731.                 for (int l2 = 0; l2 < 4; l2++) {
  5732.                     for (int i3 = 0; i3 < 104; i3++) {
  5733.                         for (int k3 = 0; k3 < 104; k3++) {
  5734.                             groundArray[l2][i3][k3] = null;
  5735.                         }
  5736.  
  5737.                     }
  5738.  
  5739.                 }
  5740.  
  5741.                 aClass19_1179 = new NodeList();
  5742.                 anInt900 = 0;
  5743.                 friendsCount = 0;
  5744.                 dialogID = -1;
  5745.                 backDialogID = -1;
  5746.                 openInterfaceID = -1;
  5747.                 invOverlayInterfaceID = -1;
  5748.                 fullScreenBackDialogID = -1;
  5749.                 fullScreenInterfaceId = -1;
  5750.                 anInt1018 = -1;
  5751.                 aBoolean1149 = false;
  5752.                 tabID = 3;
  5753.                 inputDialogState = 0;
  5754.                 menuOpen = false;
  5755.                 messagePromptRaised = false;
  5756.                 aString844 = null;
  5757.                 anInt1055 = 0;
  5758.                 anInt1054 = -1;
  5759.                 aBoolean1047 = true;
  5760.                 method45();
  5761.                 for (int j3 = 0; j3 < 5; j3++) {
  5762.                     anIntArray990[j3] = 0;
  5763.                 }
  5764.  
  5765.                 for (int l3 = 0; l3 < 5; l3++) {
  5766.                     atPlayerActions[l3] = null;
  5767.                     atPlayerArray[l3] = false;
  5768.                 }
  5769.  
  5770.                 anInt1175 = 0;
  5771.                 anInt1134 = 0;
  5772.                 anInt986 = 0;
  5773.                 anInt1288 = 0;
  5774.                 anInt924 = 0;
  5775.                 anInt1188 = 0;
  5776.                 anInt1155 = 0;
  5777.                 anInt1226 = 0;
  5778.                 resetImageProducers2();
  5779.                 return;
  5780.             }
  5781.             if (k == 3) {
  5782.                 loginMessage1 = "";
  5783.                 loginMessage2 = "Invalid username or password.";
  5784.                 return;
  5785.             }
  5786.             if (k == 4) {
  5787.                 loginMessage1 = "Your account has been disabled.";
  5788.                 loginMessage2 = "Please check your message-center for details.";
  5789.                 return;
  5790.             }
  5791.             if (k == 5) {
  5792.                 loginMessage1 = "Your account is already logged in.";
  5793.                 loginMessage2 = "Try again in 60 secs...";
  5794.                 return;
  5795.             }
  5796.             if (k == 6) {
  5797.                 loginMessage1 = "" + ClientSettings.SERVER_NAME + " has been updated!";
  5798.                 loginMessage2 = "Please reload this page.";
  5799.                 return;
  5800.             }
  5801.             if (k == 7) {
  5802.                 loginMessage1 = "This world is full.";
  5803.                 loginMessage2 = "Please use a different world.";
  5804.                 return;
  5805.             }
  5806.             if (k == 8) {
  5807.                 loginMessage1 = "Unable to connect.";
  5808.                 loginMessage2 = "Login server offline.";
  5809.                 return;
  5810.             }
  5811.             if (k == 9) {
  5812.                 loginMessage1 = "Login limit exceeded.";
  5813.                 loginMessage2 = "Too many connections from your address.";
  5814.                 return;
  5815.             }
  5816.             if (k == 10) {
  5817.                 loginMessage1 = "Unable to connect.";
  5818.                 loginMessage2 = "Bad session id.";
  5819.                 return;
  5820.             }
  5821.             if (k == 11) {
  5822.                 loginMessage2 = "Login server rejected session.";
  5823.                 loginMessage2 = "Please try again.";
  5824.                 return;
  5825.             }
  5826.             if (k == 12) {
  5827.                 loginMessage1 = "Only staff are allowed to play right now.";
  5828.                 loginMessage2 = "Please login using a staff account.";
  5829.                 //loginMessage1 = "You need a members account to login to this world.";
  5830.                 //loginMessage2 = "Please subscribe, or use a different world.";
  5831.                 return;
  5832.             }
  5833.             if (k == 13) {
  5834.                 loginMessage1 = "Could not complete login.";
  5835.                 loginMessage2 = "Please try using a different world.";
  5836.                 return;
  5837.             }
  5838.             if (k == 14) {
  5839.                 loginMessage1 = "The server is being updated.";
  5840.                 loginMessage2 = "Please wait 1 minute and try again.";
  5841.                 return;
  5842.             }
  5843.             if (k == 15) {
  5844.                 loggedIn = true;
  5845.                 stream.currentOffset = 0;
  5846.                 inStream.currentOffset = 0;
  5847.                 pktType = -1;
  5848.                 anInt841 = -1;
  5849.                 anInt842 = -1;
  5850.                 anInt843 = -1;
  5851.                 pktSize = 0;
  5852.                 anInt1009 = 0;
  5853.                 anInt1104 = 0;
  5854.                 menuActionRow = 0;
  5855.                 menuOpen = false;
  5856.                 aLong824 = System.currentTimeMillis();
  5857.                 return;
  5858.             }
  5859.             if (k == 16) {
  5860.                 loginMessage1 = "Login attempts exceeded.";
  5861.                 loginMessage2 = "Please wait 1 minute and try again.";
  5862.                 return;
  5863.             }
  5864.             if (k == 17) {
  5865.                 loginMessage1 = "You are standing in a members-only area.";
  5866.                 loginMessage2 = "To play on this world move to a free area first";
  5867.                 return;
  5868.             }
  5869.             if (k == 20) {
  5870.                 loginMessage1 = "Invalid loginserver requested";
  5871.                 loginMessage2 = "Please try using a different world.";
  5872.                 return;
  5873.             }
  5874.             if (k == 30) {
  5875.                 loginMessage1 = "You need a forum account to play.";
  5876.                 loginMessage2 = "Go to " + ClientSettings.SERVER_WEBSITE + " to register.";
  5877.                 return;
  5878.             }
  5879.             if (k == 31) {
  5880.                 loginMessage1 = "You're using an invalid or outdated client.";
  5881.                 loginMessage2 = "Get the latest version at " + ClientSettings.SERVER_WEBSITE + "";
  5882.                 return;
  5883.             }
  5884.             if (k == 32) {
  5885.                 loginMessage1 = "You need to recover your account first,";
  5886.                 loginMessage2 = "go to " + ClientSettings.SERVER_WEBSITE + "/help for a tutorial!";
  5887.                 return;
  5888.             }
  5889.             if (k == 33) {
  5890.                 loginMessage1 = "You need a members account to login to this world.";
  5891.                 loginMessage2 = "Please subscribe, or use a different world.";
  5892.                 return;
  5893.             }
  5894.             if (k == 34) {
  5895.                 loginMessage1 = "You need to activate your forum account first.";
  5896.                 loginMessage2 = "Click on confirm in the email we have send you!";
  5897.                 return;
  5898.             }
  5899.             if (k == 21) {
  5900.                 for (int k1 = socketStream.read(); k1 >= 0; k1--) {
  5901.                     loginMessage1 = "You have only just left another world";
  5902.                     loginMessage2 = "Your profile will be transferred in: " + k1 + " seconds";
  5903.                     drawLoginScreen(true);
  5904.                     try {
  5905.                         Thread.sleep(1000L);
  5906.                     } catch (Exception _ex) {
  5907.                     }
  5908.                 }
  5909.  
  5910.                 login(s, s1, flag);
  5911.                 return;
  5912.             }
  5913.             if (k == -1) {
  5914.                 if (i1 == 0) {
  5915.                     if (loginFailures < 2) {
  5916.                         try {
  5917.                             Thread.sleep(2000L);
  5918.                         } catch (Exception _ex) {
  5919.                         }
  5920.                         loginFailures++;
  5921.                         login(s, s1, flag);
  5922.                         return;
  5923.                     } else {
  5924.                         loginMessage1 = "Error connecting to server.";
  5925.                         loginMessage2 = "Please try again in a little while.";
  5926.                         return;
  5927.                     }
  5928.                 } else {
  5929.                     loginMessage1 = "No response from server";
  5930.                     loginMessage2 = "Please try using a different world.";
  5931.                     return;
  5932.                 }
  5933.             } else {
  5934.                 System.out.println("response:" + k);
  5935.                 loginMessage1 = "Unexpected server response";
  5936.                 loginMessage2 = "Please try using a different world.";
  5937.                 return;
  5938.             }
  5939.         } catch (IOException _ex) {
  5940.             loginMessage1 = "";
  5941.         }
  5942.         loginMessage2 = "Error connecting to server.";
  5943.     }
  5944.  
  5945.     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) {
  5946.         byte byte0 = 104;
  5947.         byte byte1 = 104;
  5948.         for (int l2 = 0; l2 < byte0; l2++) {
  5949.             for (int i3 = 0; i3 < byte1; i3++) {
  5950.                 anIntArrayArray901[l2][i3] = 0;
  5951.                 anIntArrayArray825[l2][i3] = 0x5f5e0ff;
  5952.             }
  5953.  
  5954.         }
  5955.  
  5956.         int j3 = j2;
  5957.         int k3 = j1;
  5958.         anIntArrayArray901[j2][j1] = 99;
  5959.         anIntArrayArray825[j2][j1] = 0;
  5960.         int l3 = 0;
  5961.         int i4 = 0;
  5962.         bigX[l3] = j2;
  5963.         bigY[l3++] = j1;
  5964.         boolean flag1 = false;
  5965.         int j4 = bigX.length;
  5966.         int ai[][] = aClass11Array1230[plane].anIntArrayArray294;
  5967.         while (i4 != l3) {
  5968.             j3 = bigX[i4];
  5969.             k3 = bigY[i4];
  5970.             i4 = (i4 + 1) % j4;
  5971.             if (j3 == k2 && k3 == i2) {
  5972.                 flag1 = true;
  5973.                 break;
  5974.             }
  5975.             if (i1 != 0) {
  5976.                 if ((i1 < 5 || i1 == 10) && aClass11Array1230[plane].method219(k2, j3, k3, j, i1 - 1, i2)) {
  5977.                     flag1 = true;
  5978.                     break;
  5979.                 }
  5980.                 if (i1 < 10 && aClass11Array1230[plane].method220(k2, i2, k3, i1 - 1, j, j3)) {
  5981.                     flag1 = true;
  5982.                     break;
  5983.                 }
  5984.             }
  5985.             if (k1 != 0 && k != 0 && aClass11Array1230[plane].method221(i2, k2, j3, k, l1, k1, k3)) {
  5986.                 flag1 = true;
  5987.                 break;
  5988.             }
  5989.             int l4 = anIntArrayArray825[j3][k3] + 1;
  5990.             if (j3 > 0 && anIntArrayArray901[j3 - 1][k3] == 0 && (ai[j3 - 1][k3] & 0x1280108) == 0) {
  5991.                 bigX[l3] = j3 - 1;
  5992.                 bigY[l3] = k3;
  5993.                 l3 = (l3 + 1) % j4;
  5994.                 anIntArrayArray901[j3 - 1][k3] = 2;
  5995.                 anIntArrayArray825[j3 - 1][k3] = l4;
  5996.             }
  5997.             if (j3 < byte0 - 1 && anIntArrayArray901[j3 + 1][k3] == 0 && (ai[j3 + 1][k3] & 0x1280180) == 0) {
  5998.                 bigX[l3] = j3 + 1;
  5999.                 bigY[l3] = k3;
  6000.                 l3 = (l3 + 1) % j4;
  6001.                 anIntArrayArray901[j3 + 1][k3] = 8;
  6002.                 anIntArrayArray825[j3 + 1][k3] = l4;
  6003.             }
  6004.             if (k3 > 0 && anIntArrayArray901[j3][k3 - 1] == 0 && (ai[j3][k3 - 1] & 0x1280102) == 0) {
  6005.                 bigX[l3] = j3;
  6006.                 bigY[l3] = k3 - 1;
  6007.                 l3 = (l3 + 1) % j4;
  6008.                 anIntArrayArray901[j3][k3 - 1] = 1;
  6009.                 anIntArrayArray825[j3][k3 - 1] = l4;
  6010.             }
  6011.             if (k3 < byte1 - 1 && anIntArrayArray901[j3][k3 + 1] == 0 && (ai[j3][k3 + 1] & 0x1280120) == 0) {
  6012.                 bigX[l3] = j3;
  6013.                 bigY[l3] = k3 + 1;
  6014.                 l3 = (l3 + 1) % j4;
  6015.                 anIntArrayArray901[j3][k3 + 1] = 4;
  6016.                 anIntArrayArray825[j3][k3 + 1] = l4;
  6017.             }
  6018.             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) {
  6019.                 bigX[l3] = j3 - 1;
  6020.                 bigY[l3] = k3 - 1;
  6021.                 l3 = (l3 + 1) % j4;
  6022.                 anIntArrayArray901[j3 - 1][k3 - 1] = 3;
  6023.                 anIntArrayArray825[j3 - 1][k3 - 1] = l4;
  6024.             }
  6025.             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) {
  6026.                 bigX[l3] = j3 + 1;
  6027.                 bigY[l3] = k3 - 1;
  6028.                 l3 = (l3 + 1) % j4;
  6029.                 anIntArrayArray901[j3 + 1][k3 - 1] = 9;
  6030.                 anIntArrayArray825[j3 + 1][k3 - 1] = l4;
  6031.             }
  6032.             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) {
  6033.                 bigX[l3] = j3 - 1;
  6034.                 bigY[l3] = k3 + 1;
  6035.                 l3 = (l3 + 1) % j4;
  6036.                 anIntArrayArray901[j3 - 1][k3 + 1] = 6;
  6037.                 anIntArrayArray825[j3 - 1][k3 + 1] = l4;
  6038.             }
  6039.             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) {
  6040.                 bigX[l3] = j3 + 1;
  6041.                 bigY[l3] = k3 + 1;
  6042.                 l3 = (l3 + 1) % j4;
  6043.                 anIntArrayArray901[j3 + 1][k3 + 1] = 12;
  6044.                 anIntArrayArray825[j3 + 1][k3 + 1] = l4;
  6045.             }
  6046.         }
  6047.         anInt1264 = 0;
  6048.         if (!flag1) {
  6049.             if (flag) {
  6050.                 int i5 = 100;
  6051.                 for (int k5 = 1; k5 < 2; k5++) {
  6052.                     for (int i6 = k2 - k5; i6 <= k2 + k5; i6++) {
  6053.                         for (int l6 = i2 - k5; l6 <= i2 + k5; l6++) {
  6054.                             if (i6 >= 0 && l6 >= 0 && i6 < 104 && l6 < 104 && anIntArrayArray825[i6][l6] < i5) {
  6055.                                 i5 = anIntArrayArray825[i6][l6];
  6056.                                 j3 = i6;
  6057.                                 k3 = l6;
  6058.                                 anInt1264 = 1;
  6059.                                 flag1 = true;
  6060.                             }
  6061.                         }
  6062.  
  6063.                     }
  6064.  
  6065.                     if (flag1) {
  6066.                         break;
  6067.                     }
  6068.                 }
  6069.  
  6070.             }
  6071.             if (!flag1) {
  6072.                 return false;
  6073.             }
  6074.         }
  6075.         i4 = 0;
  6076.         bigX[i4] = j3;
  6077.         bigY[i4++] = k3;
  6078.         int l5;
  6079.         for (int j5 = l5 = anIntArrayArray901[j3][k3]; j3 != j2 || k3 != j1; j5 = anIntArrayArray901[j3][k3]) {
  6080.             if (j5 != l5) {
  6081.                 l5 = j5;
  6082.                 bigX[i4] = j3;
  6083.                 bigY[i4++] = k3;
  6084.             }
  6085.             if ((j5 & 2) != 0) {
  6086.                 j3++;
  6087.             } else if ((j5 & 8) != 0) {
  6088.                 j3--;
  6089.             }
  6090.             if ((j5 & 1) != 0) {
  6091.                 k3++;
  6092.             } else if ((j5 & 4) != 0) {
  6093.                 k3--;
  6094.             }
  6095.         }
  6096.         // if(cancelWalk) { return i4 > 0; }
  6097.  
  6098.         if (i4 > 0) {
  6099.             int k4 = i4;
  6100.             if (k4 > 25) {
  6101.                 k4 = 25;
  6102.             }
  6103.             i4--;
  6104.             int k6 = bigX[i4];
  6105.             int i7 = bigY[i4];
  6106.             anInt1288 += k4;
  6107.             if (anInt1288 >= 92) {
  6108.                 stream.createFrame(36);
  6109.                 stream.writeDWord(0);
  6110.                 anInt1288 = 0;
  6111.             }
  6112.             if (i == 0) {
  6113.                 stream.createFrame(164);
  6114.                 stream.writeWordBigEndian(k4 + k4 + 3);
  6115.             }
  6116.             if (i == 1) {
  6117.                 stream.createFrame(248);
  6118.                 stream.writeWordBigEndian(k4 + k4 + 3 + 14);
  6119.             }
  6120.             if (i == 2) {
  6121.                 stream.createFrame(98);
  6122.                 stream.writeWordBigEndian(k4 + k4 + 3);
  6123.             }
  6124.             stream.method433(k6 + baseX);
  6125.             destX = bigX[0];
  6126.             destY = bigY[0];
  6127.             for (int j7 = 1; j7 < k4; j7++) {
  6128.                 i4--;
  6129.                 stream.writeWordBigEndian(bigX[i4] - k6);
  6130.                 stream.writeWordBigEndian(bigY[i4] - i7);
  6131.             }
  6132.  
  6133.             stream.method431(i7 + baseY);
  6134.             stream.method424(super.keyArray[5] != 1 ? 0 : 1);
  6135.             return true;
  6136.         }
  6137.         return i != 1;
  6138.     }
  6139.    
  6140.     static final int method77(int i, int i_1_) {
  6141.         if (i_1_ == -2)
  6142.             return 12345678;
  6143.         if (i_1_ == -1) {
  6144.             if (i < 0)
  6145.                 i = 0;
  6146.             else if (i > 127)
  6147.                 i = 127;
  6148.             i = 127 - i;
  6149.             return i;
  6150.         }
  6151.         i = i * (i_1_ & 0x7f) / 128;
  6152.         if (i < 2)
  6153.             i = 2;
  6154.         else if (i > 126)
  6155.             i = 126;
  6156.         return (i_1_ & 0xff80) + i;
  6157.     }
  6158.  
  6159.     public void method86(Stream stream) {
  6160.         for (int j = 0; j < anInt893; j++) {
  6161.             int k = anIntArray894[j];
  6162.             NPC npc = npcArray[k];
  6163.             int l = stream.readUnsignedByte();
  6164.             if ((l & 0x10) != 0) {
  6165.                 int i1 = stream.method434();
  6166.                 if (i1 == 65535) {
  6167.                     i1 = -1;
  6168.                 }
  6169.                 int i2 = stream.readUnsignedByte();
  6170.                 if (i1 == npc.anim && i1 != -1) {
  6171.                     int l2 = Animation.anims[i1].anInt365;
  6172.                     if (l2 == 1) {
  6173.                         npc.anInt1527 = 0;
  6174.                         npc.anInt1528 = 0;
  6175.                         npc.anInt1529 = i2;
  6176.                         npc.anInt1530 = 0;
  6177.                     }
  6178.                     if (l2 == 2) {
  6179.                         npc.anInt1530 = 0;
  6180.                     }
  6181.                 } else if (i1 == -1 || npc.anim == -1 || Animation.anims[i1].anInt359 >= Animation.anims[npc.anim].anInt359) {
  6182.                     npc.anim = i1;
  6183.                     npc.anInt1527 = 0;
  6184.                     npc.anInt1528 = 0;
  6185.                     npc.anInt1529 = i2;
  6186.                     npc.anInt1530 = 0;
  6187.                     npc.anInt1542 = npc.smallXYIndex;
  6188.                 }
  6189.             }
  6190.             if ((l & 8) != 0) {
  6191.                 int j1 = stream.readUnsignedByteA();
  6192.                 int j2 = stream.method427();
  6193.                 npc.updateHitData(j2, j1, loopCycle);
  6194.                 npc.loopCycleStatus = loopCycle + 300;
  6195.                 npc.currentHealth = stream.readUnsignedByteA();
  6196.                 npc.maxHealth = stream.readUnsignedByte();
  6197.             }
  6198.             if ((l & 0x80) != 0) {
  6199.                 npc.anInt1520 = stream.readUnsignedWord();
  6200.                 int k1 = stream.readDWord();
  6201.                 npc.anInt1524 = k1 >> 16;
  6202.                 npc.anInt1523 = loopCycle + (k1 & 0xffff);
  6203.                 npc.anInt1521 = 0;
  6204.                 npc.anInt1522 = 0;
  6205.                 if (npc.anInt1523 > loopCycle) {
  6206.                     npc.anInt1521 = -1;
  6207.                 }
  6208.                 if (npc.anInt1520 == 65535) {
  6209.                     npc.anInt1520 = -1;
  6210.                 }
  6211.             }
  6212.             if ((l & 0x20) != 0) {
  6213.                 npc.interactingEntity = stream.readUnsignedWord();
  6214.                 if (npc.interactingEntity == 65535) {
  6215.                     npc.interactingEntity = -1;
  6216.                 }
  6217.             }
  6218.             if ((l & 1) != 0) {
  6219.                 npc.textSpoken = stream.readString();
  6220.                 npc.textCycle = 100;
  6221.             }
  6222.             if ((l & 0x40) != 0) {
  6223.                 int l1 = stream.method427();
  6224.                 int k2 = stream.method428();
  6225.                 npc.updateHitData(k2, l1, loopCycle);
  6226.                 npc.loopCycleStatus = loopCycle + 300;
  6227.                 npc.currentHealth = stream.method428();
  6228.                 npc.maxHealth = stream.method427();
  6229.             }
  6230.             if ((l & 2) != 0) {
  6231.                 npc.desc = EntityDef.forID(stream.method436());
  6232.                 npc.anInt1540 = npc.desc.aByte68;
  6233.                 npc.anInt1504 = npc.desc.anInt79;
  6234.                 npc.anInt1554 = npc.desc.anInt67;
  6235.                 npc.anInt1555 = npc.desc.anInt58;
  6236.                 npc.anInt1556 = npc.desc.anInt83;
  6237.                 npc.anInt1557 = npc.desc.anInt55;
  6238.                 npc.anInt1511 = npc.desc.anInt77;
  6239.             }
  6240.             if ((l & 4) != 0) {
  6241.                 npc.anInt1538 = stream.method434();
  6242.                 npc.anInt1539 = stream.method434();
  6243.             }
  6244.         }
  6245.     }
  6246.  
  6247.     public void buildAtNPCMenu(EntityDef entityDef, int i, int j, int k) {
  6248.         if (menuActionRow >= 400) {
  6249.             return;
  6250.         }
  6251.         if (entityDef.childrenIDs != null) {
  6252.             entityDef = entityDef.method161();
  6253.         }
  6254.         if (entityDef == null) {
  6255.             return;
  6256.         }
  6257.         if (!entityDef.aBoolean84) {
  6258.             return;
  6259.         }
  6260.         String s = entityDef.name;
  6261.         if (entityDef.combatLevel != 0) {
  6262.             s = s + combatDiffColor(myPlayer.combatLevel, entityDef.combatLevel) + " (level-" + entityDef.combatLevel + ")";
  6263.         }
  6264.         if (itemSelected == 1) {
  6265.             menuActionName[menuActionRow] = "Use " + selectedItemName + " with @yel@" + s;
  6266.             menuActionID[menuActionRow] = 582;
  6267.             menuActionCmd1[menuActionRow] = i;
  6268.             menuActionCmd2[menuActionRow] = k;
  6269.             menuActionCmd3[menuActionRow] = j;
  6270.             menuActionRow++;
  6271.             return;
  6272.         }
  6273.         if (spellSelected == 1) {
  6274.             if ((spellUsableOn & 2) == 2) {
  6275.                 menuActionName[menuActionRow] = spellTooltip + " @yel@" + s;
  6276.                 menuActionID[menuActionRow] = 413;
  6277.                 menuActionCmd1[menuActionRow] = i;
  6278.                 menuActionCmd2[menuActionRow] = k;
  6279.                 menuActionCmd3[menuActionRow] = j;
  6280.                 menuActionRow++;
  6281.             }
  6282.         } else {
  6283.             if (entityDef.actions != null) {
  6284.                 for (int l = 4; l >= 0; l--) {
  6285.                     if (entityDef.actions[l] != null && !entityDef.actions[l].equalsIgnoreCase("attack")) {
  6286.                         menuActionName[menuActionRow] = entityDef.actions[l] + " @yel@" + s;
  6287.                         if (l == 0) {
  6288.                             menuActionID[menuActionRow] = 20;
  6289.                         }
  6290.                         if (l == 1) {
  6291.                             menuActionID[menuActionRow] = 412;
  6292.                         }
  6293.                         if (l == 2) {
  6294.                             menuActionID[menuActionRow] = 225;
  6295.                         }
  6296.                         if (l == 3) {
  6297.                             menuActionID[menuActionRow] = 965;
  6298.                         }
  6299.                         if (l == 4) {
  6300.                             menuActionID[menuActionRow] = 478;
  6301.                         }
  6302.                         menuActionCmd1[menuActionRow] = i;
  6303.                         menuActionCmd2[menuActionRow] = k;
  6304.                         menuActionCmd3[menuActionRow] = j;
  6305.                         menuActionRow++;
  6306.                     }
  6307.                 }
  6308.  
  6309.             }
  6310.             if (entityDef.actions != null) {
  6311.                 for (int i1 = 4; i1 >= 0; i1--) {
  6312.                     if (entityDef.actions[i1] != null && entityDef.actions[i1].equalsIgnoreCase("attack")) {
  6313.                         char c = '\0';
  6314.                         if (entityDef.combatLevel > myPlayer.combatLevel) {
  6315.                             c = '\u07D0';
  6316.                         }
  6317.                         menuActionName[menuActionRow] = entityDef.actions[i1] + " @yel@" + s;
  6318.                         if (i1 == 0) {
  6319.                             menuActionID[menuActionRow] = 20 + c;
  6320.                         }
  6321.                         if (i1 == 1) {
  6322.                             menuActionID[menuActionRow] = 412 + c;
  6323.                         }
  6324.                         if (i1 == 2) {
  6325.                             menuActionID[menuActionRow] = 225 + c;
  6326.                         }
  6327.                         if (i1 == 3) {
  6328.                             menuActionID[menuActionRow] = 965 + c;
  6329.                         }
  6330.                         if (i1 == 4) {
  6331.                             menuActionID[menuActionRow] = 478 + c;
  6332.                         }
  6333.                         menuActionCmd1[menuActionRow] = i;
  6334.                         menuActionCmd2[menuActionRow] = k;
  6335.                         menuActionCmd3[menuActionRow] = j;
  6336.                         menuActionRow++;
  6337.                     }
  6338.                 }
  6339.  
  6340.             }
  6341.             menuActionName[menuActionRow] = "Examine @yel@" + s + (showInfo ? " @gre@(@whi@" + entityDef.type + "@gre@)" : "");
  6342.             menuActionID[menuActionRow] = 1025;
  6343.             menuActionCmd1[menuActionRow] = i;
  6344.             menuActionCmd2[menuActionRow] = k;
  6345.             menuActionCmd3[menuActionRow] = j;
  6346.             menuActionRow++;
  6347.         }
  6348.     }
  6349.  
  6350.     public void buildAtPlayerMenu(int i, int j, Player player, int k) {
  6351.         if (player == myPlayer) {
  6352.             return;
  6353.         }
  6354.         if (menuActionRow >= 400) {
  6355.             return;
  6356.         }
  6357.         String s;
  6358.         if (player.skill == 0) {
  6359.             s = player.name + combatDiffColor(myPlayer.combatLevel, player.combatLevel) + " (level-" + player.combatLevel + ")";
  6360.         } else {
  6361.             s = player.name + " (skill-" + player.skill + ")";
  6362.         }
  6363.         if (itemSelected == 1) {
  6364.             menuActionName[menuActionRow] = "Use " + selectedItemName + " with @whi@" + s;
  6365.             menuActionID[menuActionRow] = 491;
  6366.             menuActionCmd1[menuActionRow] = j;
  6367.             menuActionCmd2[menuActionRow] = i;
  6368.             menuActionCmd3[menuActionRow] = k;
  6369.             menuActionRow++;
  6370.         } else if (spellSelected == 1) {
  6371.             if ((spellUsableOn & 8) == 8) {
  6372.                 menuActionName[menuActionRow] = spellTooltip + " @whi@" + s;
  6373.                 menuActionID[menuActionRow] = 365;
  6374.                 menuActionCmd1[menuActionRow] = j;
  6375.                 menuActionCmd2[menuActionRow] = i;
  6376.                 menuActionCmd3[menuActionRow] = k;
  6377.                 menuActionRow++;
  6378.             }
  6379.         } else {
  6380.             for (int l = 4; l >= 0; l--) {
  6381.                 if (atPlayerActions[l] != null) {
  6382.                     menuActionName[menuActionRow] = atPlayerActions[l] + " @whi@" + s;
  6383.                     char c = '\0';
  6384.                     if (atPlayerActions[l].equalsIgnoreCase("attack")) {
  6385.                         if (player.combatLevel > myPlayer.combatLevel) {
  6386.                             c = '\u07D0';
  6387.                         }
  6388.                         if (myPlayer.team != 0 && player.team != 0) {
  6389.                             if (myPlayer.team == player.team) {
  6390.                                 c = '\u07D0';
  6391.                             } else {
  6392.                                 c = '\0';
  6393.                             }
  6394.                         }
  6395.                     } else if (atPlayerArray[l]) {
  6396.                         c = '\u07D0';
  6397.                     }
  6398.                     if (l == 0) {
  6399.                         menuActionID[menuActionRow] = 561 + c;
  6400.                     }
  6401.                     if (l == 1) {
  6402.                         menuActionID[menuActionRow] = 779 + c;
  6403.                     }
  6404.                     if (l == 2) {
  6405.                         menuActionID[menuActionRow] = 27 + c;
  6406.                     }
  6407.                     if (l == 3) {
  6408.                         menuActionID[menuActionRow] = 577 + c;
  6409.                     }
  6410.                     if (l == 4) {
  6411.                         menuActionID[menuActionRow] = 729 + c;
  6412.                     }
  6413.                     menuActionCmd1[menuActionRow] = j;
  6414.                     menuActionCmd2[menuActionRow] = i;
  6415.                     menuActionCmd3[menuActionRow] = k;
  6416.                     menuActionRow++;
  6417.                 }
  6418.             }
  6419.  
  6420.         }
  6421.         for (int i1 = 0; i1 < menuActionRow; i1++) {
  6422.             if (menuActionID[i1] == 516) {
  6423.                 menuActionName[i1] = "Walk here @whi@" + s;
  6424.                 return;
  6425.             }
  6426.         }
  6427.  
  6428.     }
  6429.  
  6430.     public void method89(Class30_Sub1 class30_sub1) {
  6431.         int i = 0;
  6432.         int j = -1;
  6433.         int k = 0;
  6434.         int l = 0;
  6435.         if (class30_sub1.anInt1296 == 0) {
  6436.             i = worldController.method300(class30_sub1.anInt1295, class30_sub1.anInt1297, class30_sub1.anInt1298);
  6437.         }
  6438.         if (class30_sub1.anInt1296 == 1) {
  6439.             i = worldController.method301(class30_sub1.anInt1295, class30_sub1.anInt1297, class30_sub1.anInt1298);
  6440.         }
  6441.         if (class30_sub1.anInt1296 == 2) {
  6442.             i = worldController.method302(class30_sub1.anInt1295, class30_sub1.anInt1297, class30_sub1.anInt1298);
  6443.         }
  6444.         if (class30_sub1.anInt1296 == 3) {
  6445.             i = worldController.method303(class30_sub1.anInt1295, class30_sub1.anInt1297, class30_sub1.anInt1298);
  6446.         }
  6447.         if (i != 0) {
  6448.             int i1 = worldController.method304(class30_sub1.anInt1295, class30_sub1.anInt1297, class30_sub1.anInt1298, i);
  6449.             j = i >> 14 & 0x7fff;
  6450.             k = i1 & 0x1f;
  6451.             l = i1 >> 6;
  6452.         }
  6453.         class30_sub1.anInt1299 = j;
  6454.         class30_sub1.anInt1301 = k;
  6455.         class30_sub1.anInt1300 = l;
  6456.     }
  6457.  
  6458.     public final void method90() {
  6459.         for (int index = 0; index < currentSound; index++) {
  6460.             //if (soundDelay[index] <= 0) {
  6461.                 boolean flag1 = false;
  6462.                 try {
  6463.                     Stream stream = Sounds.method241(soundType[index], sound[index]);
  6464.                     new SoundPlayer((InputStream) new ByteArrayInputStream(stream.buffer, 0, stream.currentOffset), soundVolume[index], soundDelay[index]);
  6465.                     if (System.currentTimeMillis() + (long) (stream.currentOffset / 22) > aLong1172 + (long) (anInt1257 / 22)) {
  6466.                         anInt1257 = stream.currentOffset;
  6467.                         aLong1172 = System.currentTimeMillis();
  6468.                     }
  6469.                 } catch (Exception exception) {
  6470.                     exception.printStackTrace();
  6471.                 }
  6472.                 if (!flag1 || soundDelay[index] == -5) {
  6473.                     currentSound--;
  6474.                     for (int j = index; j < currentSound; j++) {
  6475.                         sound[j] = sound[j + 1];
  6476.                         soundType[j] = soundType[j + 1];
  6477.                         soundDelay[j] = soundDelay[j + 1];
  6478.                         soundVolume[j] = soundVolume[j + 1];
  6479.                     }
  6480.                     index--;
  6481.                 } else {
  6482.                     soundDelay[index] = -5;
  6483.                 }
  6484.             /*} else {
  6485.                 soundDelay[index]--;
  6486.             }*/
  6487.         }
  6488.         if (previousSong > 0) {
  6489.             previousSong -= 20;
  6490.             if (previousSong < 0)
  6491.                 previousSong = 0;
  6492.             if (previousSong == 0 && musicVolume != 0 && currentSong != -1) {
  6493.                 method56(musicVolume, false, currentSong);
  6494.             }
  6495.         }
  6496.     }
  6497.    
  6498.     private void connectServer()
  6499.     {
  6500.       int j = 5;
  6501.         expectedCRCs[8] = 0;
  6502.         int k = 0;
  6503.         while(expectedCRCs[8] == 0)
  6504.         {
  6505.             String s = "Unknown problem";
  6506.             drawLoadingText(20, "Connecting to web server");
  6507.             try
  6508.             {
  6509.                 DataInputStream datainputstream = openJagGrabInputStream("crc" + (int)(Math.random() * 99999999D) + "-" + 317);
  6510.                 Stream class30_sub2_sub2 = new Stream(new byte[40]);
  6511.                 datainputstream.readFully(class30_sub2_sub2.buffer, 0, 40);
  6512.                 datainputstream.close();
  6513.                 for(int i1 = 0; i1 < 9; i1++)
  6514.                     expectedCRCs[i1] = class30_sub2_sub2.readDWord();
  6515.  
  6516.                 int j1 = class30_sub2_sub2.readDWord();
  6517.                 int k1 = 1234;
  6518.                 for(int l1 = 0; l1 < 9; l1++)
  6519.                     k1 = (k1 << 1) + expectedCRCs[l1];
  6520.  
  6521.                 if(j1 != k1)
  6522.                 {
  6523.                     s = "checksum problem";
  6524.                     expectedCRCs[8] = 0;
  6525.                 }
  6526.             }
  6527.             catch(EOFException _ex)
  6528.             {
  6529.                 s = "EOF problem";
  6530.                 expectedCRCs[8] = 0;
  6531.             }
  6532.             catch(IOException _ex)
  6533.             {
  6534.                 s = "connection problem";
  6535.                 expectedCRCs[8] = 0;
  6536.             }
  6537.             catch(Exception _ex)
  6538.             {
  6539.                 s = "logic problem";
  6540.                 expectedCRCs[8] = 0;
  6541.                 if(!Signlink.reporterror)
  6542.                     return;
  6543.             }
  6544.             if(expectedCRCs[8] == 0)
  6545.             {
  6546.                 k++;
  6547.                 for(int l = j; l > 0; l--)
  6548.                 {
  6549.                     if(k >= 10)
  6550.                     {
  6551.                         drawLoadingText(10, "Game updated - please reload page");
  6552.                         l = 10;
  6553.                     } else
  6554.                     {
  6555.                         drawLoadingText(10, s + " - Will retry in " + l + " secs.");
  6556.                     }
  6557.                     try
  6558.                     {
  6559.                         Thread.sleep(1000L);
  6560.                     }
  6561.                     catch(Exception _ex) { }
  6562.                 }
  6563.  
  6564.                 j *= 2;
  6565.                 if(j > 60)
  6566.                     j = 60;
  6567.                 aBoolean872 = !aBoolean872;
  6568.             }
  6569.         }
  6570.     }
  6571.  
  6572.     void startUp() {
  6573.         drawLoadingText(20, "Starting up");
  6574. //      try {
  6575. //          CacheDownloader.download(this, new URL("https://dl.dropboxusercontent.com/u/19852069/assets.zip"));
  6576. //      } catch (IOException e) {
  6577. //          e.printStackTrace();
  6578. //      }
  6579.         if (Signlink.sunjava) {
  6580.             super.minDelay = 5;
  6581.         }
  6582.         aBoolean993 = true;
  6583.         boolean flag = true;
  6584.         if (!flag) {
  6585.             genericLoadingError = true;
  6586.             return;
  6587.         }
  6588.         if (Signlink.cache_dat != null) {
  6589.             for (int i = 0; i < 5; i++) {
  6590.                 decompressors[i] = new Decompressor(Signlink.cache_dat, Signlink.cache_idx[i], i + 1);
  6591.             }
  6592.  
  6593.         }
  6594.         try {
  6595.             connectServer();
  6596.             titleStreamLoader = streamLoaderForName(1, "title screen", "title", expectedCRCs[1], 25);
  6597.             aTextDrawingArea_1270 = new TextDrawingArea(false, "p11_full", titleStreamLoader);
  6598.             aTextDrawingArea_1271 = new TextDrawingArea(false, "p12_full", titleStreamLoader);
  6599.             chatTextDrawingArea = new TextDrawingArea(false, "b12_full", titleStreamLoader);
  6600.             TextDrawingArea aTextDrawingArea_1273 = new TextDrawingArea(true, "q8_full", titleStreamLoader);
  6601.             drawLogo();
  6602.             loadTitleScreen();
  6603.             //repackCacheIndex(1);
  6604.             constructMusic();
  6605.             StreamLoader streamLoader = streamLoaderForName(2, "config", "config", expectedCRCs[2], 30);
  6606.             StreamLoader streamLoader_1 = streamLoaderForName(3, "interface", "interface", expectedCRCs[3], 35);
  6607.             StreamLoader streamLoader_2 = streamLoaderForName(4, "2d graphics", "media", expectedCRCs[4], 40);
  6608.             StreamLoader streamLoader_3 = streamLoaderForName(6, "textures", "textures", expectedCRCs[6], 45);
  6609.             StreamLoader streamLoader_4 = streamLoaderForName(7, "chat system", "wordenc", expectedCRCs[7], 50);
  6610.             StreamLoader streamLoader_5 = streamLoaderForName(8, "sound effects", "sounds", expectedCRCs[8], 55);
  6611.             byteGroundArray = new byte[4][104][104];
  6612.             intGroundArray = new int[4][105][105];
  6613.             worldController = new WorldController(intGroundArray);
  6614.             for (int j = 0; j < 4; j++) {
  6615.                 aClass11Array1230[j] = new CollisionMap();
  6616.             }
  6617.  
  6618.             aClass30_Sub2_Sub1_Sub1_1263 = new Sprite(512, 512);
  6619.             StreamLoader streamLoader_6 = streamLoaderForName(5, "update list", "versionlist", expectedCRCs[5], 60);
  6620.             drawLoadingText(60, "Connecting to update server");
  6621.             onDemandFetcher = new OnDemandFetcher();
  6622.             onDemandFetcher.start(streamLoader_6, this);
  6623. //          musics();
  6624.             Class36.method528(onDemandFetcher.getAnimCount());
  6625.             Model.method459(onDemandFetcher.getVersionCount(0), onDemandFetcher);
  6626.             if (!lowMem) {
  6627.                 method58(10, musicVolume, false, 0);
  6628.                 while (onDemandFetcher.getNodeCount() > 0) {
  6629.                     processOnDemandQueue();
  6630.                     try {
  6631.                         Thread.sleep(100L);
  6632.                     } catch (Exception _ex) {
  6633.                     }
  6634.                     if (onDemandFetcher.anInt1349 > 3) {
  6635.                         loadError();
  6636.                         return;
  6637.                     }
  6638.                 }
  6639.             }
  6640.             drawLoadingText(65, "Requesting animations");
  6641.             int k = onDemandFetcher.getVersionCount(1);
  6642.             for (int i1 = 0; i1 < k; i1++) {
  6643.                 onDemandFetcher.method558(1, i1);
  6644.             }
  6645.  
  6646.             while (onDemandFetcher.getNodeCount() > 0) {
  6647.                 int j1 = k - onDemandFetcher.getNodeCount();
  6648.                 if (j1 > 0) {
  6649.                     drawLoadingText(65, "Loading animations - " + j1 * 100 / k + "%");
  6650.                 }
  6651.                 processOnDemandQueue();
  6652.                 try {
  6653.                     Thread.sleep(100L);
  6654.                 } catch (Exception _ex) {
  6655.                 }
  6656.                 if (onDemandFetcher.anInt1349 > 3) {
  6657.                     loadError();
  6658.                     return;
  6659.                 }
  6660.             }
  6661.             drawLoadingText(70, "Requesting models");
  6662.             k = onDemandFetcher.getVersionCount(0);
  6663.             for (int k1 = 0; k1 < k; k1++) {
  6664.                 int l1 = onDemandFetcher.getModelIndex(k1);
  6665.                 if ((l1 & 1) != 0) {
  6666.                     onDemandFetcher.method558(0, k1);
  6667.                 }
  6668.             }
  6669.  
  6670.             k = onDemandFetcher.getNodeCount();
  6671.             while (onDemandFetcher.getNodeCount() > 0) {
  6672.                 int i2 = k - onDemandFetcher.getNodeCount();
  6673.                 if (i2 > 0) {
  6674.                     drawLoadingText(70, "Loading models - " + i2 * 100 / k + "%");
  6675.                 }
  6676.                 processOnDemandQueue();
  6677.                 try {
  6678.                     Thread.sleep(100L);
  6679.                 } catch (Exception _ex) {
  6680.                 }
  6681.             }
  6682.             if (decompressors[0] != null) {
  6683.                 drawLoadingText(75, "Requesting maps");
  6684.                 onDemandFetcher.method558(3, onDemandFetcher.method562(0, 48, 47));
  6685.                 onDemandFetcher.method558(3, onDemandFetcher.method562(1, 48, 47));
  6686.                 onDemandFetcher.method558(3, onDemandFetcher.method562(0, 48, 48));
  6687.                 onDemandFetcher.method558(3, onDemandFetcher.method562(1, 48, 48));
  6688.                 onDemandFetcher.method558(3, onDemandFetcher.method562(0, 48, 49));
  6689.                 onDemandFetcher.method558(3, onDemandFetcher.method562(1, 48, 49));
  6690.                 onDemandFetcher.method558(3, onDemandFetcher.method562(0, 47, 47));
  6691.                 onDemandFetcher.method558(3, onDemandFetcher.method562(1, 47, 47));
  6692.                 onDemandFetcher.method558(3, onDemandFetcher.method562(0, 47, 48));
  6693.                 onDemandFetcher.method558(3, onDemandFetcher.method562(1, 47, 48));
  6694.                 onDemandFetcher.method558(3, onDemandFetcher.method562(0, 148, 48));
  6695.                 onDemandFetcher.method558(3, onDemandFetcher.method562(1, 148, 48));
  6696.                 k = onDemandFetcher.getNodeCount();
  6697.                 while (onDemandFetcher.getNodeCount() > 0) {
  6698.                     int j2 = k - onDemandFetcher.getNodeCount();
  6699.                     if (j2 > 0) {
  6700.                         drawLoadingText(75, "Loading maps - " + j2 * 100 / k + "%");
  6701.                     }
  6702.                     processOnDemandQueue();
  6703.                     try {
  6704.                         Thread.sleep(100L);
  6705.                     } catch (Exception _ex) {
  6706.                     }
  6707.                 }
  6708.             }
  6709.             k = onDemandFetcher.getVersionCount(0);
  6710.             for (int k2 = 0; k2 < k; k2++) {
  6711.                 int l2 = onDemandFetcher.getModelIndex(k2);
  6712.                 byte byte0 = 0;
  6713.                 if ((l2 & 8) != 0) {
  6714.                     byte0 = 10;
  6715.                 } else if ((l2 & 0x20) != 0) {
  6716.                     byte0 = 9;
  6717.                 } else if ((l2 & 0x10) != 0) {
  6718.                     byte0 = 8;
  6719.                 } else if ((l2 & 0x40) != 0) {
  6720.                     byte0 = 7;
  6721.                 } else if ((l2 & 0x80) != 0) {
  6722.                     byte0 = 6;
  6723.                 } else if ((l2 & 2) != 0) {
  6724.                     byte0 = 5;
  6725.                 } else if ((l2 & 4) != 0) {
  6726.                     byte0 = 4;
  6727.                 }
  6728.                 if ((l2 & 1) != 0) {
  6729.                     byte0 = 3;
  6730.                 }
  6731.                 if (byte0 != 0) {
  6732.                     onDemandFetcher.method563(byte0, 0, k2);
  6733.                 }
  6734.             }
  6735.  
  6736.             onDemandFetcher.method554(isMembers);
  6737.             if (!lowMem) {
  6738.                 int l = onDemandFetcher.getVersionCount(2);
  6739.                 for (int i3 = 1; i3 < l; i3++) {
  6740.                     if (onDemandFetcher.method569(i3)) {
  6741.                         onDemandFetcher.method563((byte) 1, 2, i3);
  6742.                     }
  6743.                 }
  6744.  
  6745.             }
  6746.             drawLoadingText(80, "Unpacking media");
  6747.             invBack = new Background(streamLoader_2, "invback", 0);
  6748.             chatBack = new Background(streamLoader_2, "chatback", 0);
  6749.             mapBack = new Background(streamLoader_2, "mapback", 0);
  6750.             backBase1 = new Background(streamLoader_2, "backbase1", 0);
  6751.             backBase2 = new Background(streamLoader_2, "backbase2", 0);
  6752.             backHmid1 = new Background(streamLoader_2, "backhmid1", 0);
  6753.             for (int j3 = 0; j3 < 13; j3++) {
  6754.                 sideIcons[j3] = new Background(streamLoader_2, "sideicons", j3);
  6755.             }
  6756.  
  6757.             compass = new Sprite(streamLoader_2, "compass", 0);
  6758.             mapEdge = new Sprite(streamLoader_2, "mapedge", 0);
  6759.             mapEdge.method345();
  6760.  
  6761.             multiOverlay = new Sprite(streamLoader_2, "overlay_multiway", 0);
  6762.             try {
  6763.                 for (int k3 = 0; k3 < 100; k3++) {
  6764.                     mapScenes[k3] = new Background(streamLoader_2, "mapscene", k3);
  6765.                 }
  6766.  
  6767.             } catch (Exception _ex) {
  6768.             }
  6769.             try {
  6770.                 for (int l3 = 0; l3 < 100; l3++) {
  6771.                     mapFunctions[l3] = new Sprite(streamLoader_2, "mapfunction", l3);
  6772.                 }
  6773.  
  6774.             } catch (Exception _ex) {
  6775.             }
  6776.             try {
  6777.                 for (int i4 = 0; i4 < 20; i4++) {
  6778.                     hitMarks[i4] = new Sprite(streamLoader_2, "hitmarks", i4);
  6779.                 }
  6780.  
  6781.             } catch (Exception _ex) {
  6782.             }
  6783.             try {
  6784.                 for (int h1 = 0; h1 < 6; h1++) {
  6785.                     headIconsHint[h1] = new Sprite(streamLoader_2, "headicons_hint", h1);
  6786.                 }
  6787.                 for (int j4 = 0; j4 < 8; j4++) {
  6788.                     headIcons[j4] = new Sprite(streamLoader_2, "headicons_prayer", j4);
  6789.                 }
  6790.                 for (int j45 = 0; j45 < 3; j45++) {
  6791.                     skullIcons[j45] = new Sprite(streamLoader_2, "headicons_pk", j45);
  6792.                 }
  6793.             } catch (Exception _ex) {
  6794.             }
  6795.             mapFlag = new Sprite(streamLoader_2, "mapmarker", 0);
  6796.             mapMarker = new Sprite(streamLoader_2, "mapmarker", 1);
  6797.             for (int k4 = 0; k4 < 8; k4++) {
  6798.                 crosses[k4] = new Sprite(streamLoader_2, "cross", k4);
  6799.             }
  6800.  
  6801.             mapDotItem = new Sprite(streamLoader_2, "mapdots", 0);
  6802.             mapDotNPC = new Sprite(streamLoader_2, "mapdots", 1);
  6803.             mapDotPlayer = new Sprite(streamLoader_2, "mapdots", 2);
  6804.             mapDotFriend = new Sprite(streamLoader_2, "mapdots", 3);
  6805.             mapDotTeam = new Sprite(streamLoader_2, "mapdots", 4);
  6806.             scrollBar1 = new Background(streamLoader_2, "scrollbar", 0);
  6807.             scrollBar2 = new Background(streamLoader_2, "scrollbar", 1);
  6808.             redStone1 = new Background(streamLoader_2, "redstone1", 0);
  6809.             redStone2 = new Background(streamLoader_2, "redstone2", 0);
  6810.             redStone3 = new Background(streamLoader_2, "redstone3", 0);
  6811.             redStone1_2 = new Background(streamLoader_2, "redstone1", 0);
  6812.             redStone1_2.method358();
  6813.             redStone2_2 = new Background(streamLoader_2, "redstone2", 0);
  6814.             redStone2_2.method358();
  6815.             redStone1_3 = new Background(streamLoader_2, "redstone1", 0);
  6816.             redStone1_3.method359();
  6817.             redStone2_3 = new Background(streamLoader_2, "redstone2", 0);
  6818.             redStone2_3.method359();
  6819.             redStone3_2 = new Background(streamLoader_2, "redstone3", 0);
  6820.             redStone3_2.method359();
  6821.             redStone1_4 = new Background(streamLoader_2, "redstone1", 0);
  6822.             redStone1_4.method358();
  6823.             redStone1_4.method359();
  6824.             redStone2_4 = new Background(streamLoader_2, "redstone2", 0);
  6825.             redStone2_4.method358();
  6826.             redStone2_4.method359();
  6827.             for (int l4 = 0; l4 < 2; l4++) {
  6828.                 modIcons[l4] = new Background(streamLoader_2, "mod_icons", l4);
  6829.             }
  6830.  
  6831.             Sprite sprite = new Sprite(streamLoader_2, "backleft1", 0);
  6832.             backLeftIP1 = new RSImageProducer(sprite.width, sprite.height, getGameComponent());
  6833.             sprite.method346(0, 0);
  6834.             sprite = new Sprite(streamLoader_2, "backleft2", 0);
  6835.             backLeftIP2 = new RSImageProducer(sprite.width, sprite.height, getGameComponent());
  6836.             sprite.method346(0, 0);
  6837.             sprite = new Sprite(streamLoader_2, "backright1", 0);
  6838.             backRightIP1 = new RSImageProducer(sprite.width, sprite.height, getGameComponent());
  6839.             sprite.method346(0, 0);
  6840.             sprite = new Sprite(streamLoader_2, "backright2", 0);
  6841.             backRightIP2 = new RSImageProducer(sprite.width, sprite.height, getGameComponent());
  6842.             sprite.method346(0, 0);
  6843.             sprite = new Sprite(streamLoader_2, "backtop1", 0);
  6844.             backTopIP1 = new RSImageProducer(sprite.width, sprite.height, getGameComponent());
  6845.             sprite.method346(0, 0);
  6846.             sprite = new Sprite(streamLoader_2, "backvmid1", 0);
  6847.             backVmidIP1 = new RSImageProducer(sprite.width, sprite.height, getGameComponent());
  6848.             sprite.method346(0, 0);
  6849.             sprite = new Sprite(streamLoader_2, "backvmid2", 0);
  6850.             backVmidIP2 = new RSImageProducer(sprite.width, sprite.height, getGameComponent());
  6851.             sprite.method346(0, 0);
  6852.             sprite = new Sprite(streamLoader_2, "backvmid3", 0);
  6853.             backVmidIP3 = new RSImageProducer(sprite.width, sprite.height, getGameComponent());
  6854.             sprite.method346(0, 0);
  6855.             sprite = new Sprite(streamLoader_2, "backhmid2", 0);
  6856.             backVmidIP2_2 = new RSImageProducer(sprite.width, sprite.height, getGameComponent());
  6857.             sprite.method346(0, 0);
  6858.             int i5 = (int) (Math.random() * 21D) - 10;
  6859.             int j5 = (int) (Math.random() * 21D) - 10;
  6860.             int k5 = (int) (Math.random() * 21D) - 10;
  6861.             int l5 = (int) (Math.random() * 41D) - 20;
  6862.             for (int i6 = 0; i6 < 100; i6++) {
  6863.                 if (mapFunctions[i6] != null) {
  6864.                     mapFunctions[i6].method344(i5 + l5, j5 + l5, k5 + l5);
  6865.                 }
  6866.                 if (mapScenes[i6] != null) {
  6867.                     mapScenes[i6].method360(i5 + l5, j5 + l5, k5 + l5);
  6868.                 }
  6869.             }
  6870.  
  6871.             drawLoadingText(83, "Unpacking textures");
  6872.             Texture.method368(streamLoader_3);
  6873.             Texture.method372(0.80000000000000004D);
  6874.             Texture.method367();
  6875.             drawLoadingText(86, "Unpacking config");
  6876.             Animation.unpackConfig(streamLoader);
  6877.             ObjectDef.unpackConfig(streamLoader);
  6878.             Flo.unpackConfig(streamLoader);
  6879.             ItemDef.unpackConfig(streamLoader);
  6880.             EntityDef.unpackConfig(streamLoader);
  6881.             IDK.unpackConfig(streamLoader);
  6882.             SpotAnim.unpackConfig(streamLoader);
  6883.             Varp.unpackConfig(streamLoader);
  6884.             VarBit.unpackConfig(streamLoader);
  6885.             ItemDef.isMembers = isMembers;
  6886.             // if (!lowMem) {
  6887.             drawLoadingText(90, "Unpacking sounds");
  6888.             byte abyte0[] = streamLoader_5.getDataForName("sounds.dat");
  6889.             Stream stream = new Stream(abyte0);
  6890.             Sounds.unpack(stream);
  6891.             // }
  6892.             drawLoadingText(95, "Unpacking interfaces");
  6893.             TextDrawingArea aclass30_sub2_sub1_sub4s[] = {aTextDrawingArea_1270, aTextDrawingArea_1271, chatTextDrawingArea, aTextDrawingArea_1273};
  6894.             RSInterface.unpack(streamLoader_1, aclass30_sub2_sub1_sub4s, streamLoader_2);
  6895.             drawLoadingText(100, "Preparing game engine");
  6896.             for (int j6 = 0; j6 < 33; j6++) {
  6897.                 int k6 = 999;
  6898.                 int i7 = 0;
  6899.                 for (int k7 = 0; k7 < 34; k7++) {
  6900.                     if (mapBack.aByteArray1450[k7 + j6 * mapBack.anInt1452] == 0) {
  6901.                         if (k6 == 999) {
  6902.                             k6 = k7;
  6903.                         }
  6904.                         continue;
  6905.                     }
  6906.                     if (k6 == 999) {
  6907.                         continue;
  6908.                     }
  6909.                     i7 = k7;
  6910.                     break;
  6911.                 }
  6912.  
  6913.                 anIntArray968[j6] = k6;
  6914.                 anIntArray1057[j6] = i7 - k6;
  6915.             }
  6916.  
  6917.             for (int l6 = 5; l6 < 156; l6++) {
  6918.                 int j7 = 999;
  6919.                 int l7 = 0;
  6920.                 for (int j8 = 25; j8 < 172; j8++) {
  6921.                     if (mapBack.aByteArray1450[j8 + l6 * mapBack.anInt1452] == 0 && (j8 > 34 || l6 > 34)) {
  6922.                         if (j7 == 999) {
  6923.                             j7 = j8;
  6924.                         }
  6925.                         continue;
  6926.                     }
  6927.                     if (j7 == 999) {
  6928.                         continue;
  6929.                     }
  6930.                     l7 = j8;
  6931.                     break;
  6932.                 }
  6933.  
  6934.                 anIntArray1052[l6 - 5] = j7 - 25;
  6935.                 anIntArray1229[l6 - 5] = l7 - j7;
  6936.             }
  6937.             Texture.method365(765, 503);
  6938.             gameScreenOffsets = Texture.lineOffsets;
  6939.             Texture.method365(479, 96);
  6940.             chatAreaOffsets = Texture.lineOffsets;
  6941.             Texture.method365(190, 261);
  6942.             tabAreaOffsets = Texture.lineOffsets;
  6943.             Texture.method365(512, 334);
  6944.             chatBoxAreaOffsets = Texture.lineOffsets;
  6945.             int ai[] = new int[9];
  6946.             for (int i8 = 0; i8 < 9; i8++) {
  6947.                 int k8 = 128 + i8 * 32 + 15;
  6948.                 int l8 = 600 + k8 * 3;
  6949.                 int i9 = Texture.anIntArray1470[k8];
  6950.                 ai[i8] = l8 * i9 >> 16;
  6951.             }
  6952.  
  6953.             WorldController.method310(500, 800, 512, 334, ai);
  6954.             Censor.loadConfig(streamLoader_4);
  6955.             mouseDetection = new MouseDetection(this);
  6956.             startRunnable(mouseDetection, 10);
  6957.             Animable_Sub5.clientInstance = this;
  6958.             ObjectDef.clientInstance = this;
  6959.             EntityDef.clientInstance = this;
  6960.             return;
  6961.         } catch (Exception exception) {
  6962.             Signlink.reporterror("loaderror " + aString1049 + " " + anInt1079);
  6963.         }
  6964.         loadingError = true;
  6965.     }
  6966.  
  6967.     public void method91(Stream stream, int i) {
  6968.         while (stream.bitPosition + 10 < i * 8) {
  6969.             int j = stream.readBits(11);
  6970.             if (j == 2047) {
  6971.                 break;
  6972.             }
  6973.             if (playerArray[j] == null) {
  6974.                 playerArray[j] = new Player();
  6975.                 if (aStreamArray895s[j] != null) {
  6976.                     playerArray[j].updatePlayer(aStreamArray895s[j]);
  6977.                 }
  6978.             }
  6979.             playerIndices[playerCount++] = j;
  6980.             Player player = playerArray[j];
  6981.             player.anInt1537 = loopCycle;
  6982.             int k = stream.readBits(1);
  6983.             if (k == 1) {
  6984.                 anIntArray894[anInt893++] = j;
  6985.             }
  6986.             int l = stream.readBits(1);
  6987.             int i1 = stream.readBits(5);
  6988.             if (i1 > 15) {
  6989.                 i1 -= 32;
  6990.             }
  6991.             int j1 = stream.readBits(5);
  6992.             if (j1 > 15) {
  6993.                 j1 -= 32;
  6994.             }
  6995.             player.setPos(myPlayer.smallX[0] + j1, myPlayer.smallY[0] + i1, l == 1);
  6996.         }
  6997.         stream.finishBitAccess();
  6998.     }
  6999.  
  7000.     public void processMainScreenClick() {
  7001.         if (anInt1021 != 0) {
  7002.             return;
  7003.         }
  7004.         if (super.clickMode3 == 1) {
  7005.             int i = super.saveClickX - 25 - 550;
  7006.             int j = super.saveClickY - 5 - 4;
  7007.             if (i >= 0 && j >= 0 && i < 146 && j < 151) {
  7008.                 i -= 73;
  7009.                 j -= 75;
  7010.                 int k = minimapInt1 + minimapInt2 & 0x7ff;
  7011.                 int i1 = Texture.anIntArray1470[k];
  7012.                 int j1 = Texture.anIntArray1471[k];
  7013.                 i1 = i1 * (minimapInt3 + 256) >> 8;
  7014.                 j1 = j1 * (minimapInt3 + 256) >> 8;
  7015.                 int k1 = j * i1 + i * j1 >> 11;
  7016.                 int l1 = j * j1 - i * i1 >> 11;
  7017.                 int i2 = myPlayer.x + k1 >> 7;
  7018.                 int j2 = myPlayer.y - l1 >> 7;
  7019.                 boolean flag1 = doWalkTo(1, 0, 0, 0, myPlayer.smallY[0], 0, 0, j2, myPlayer.smallX[0], true, i2);
  7020.                 if (flag1) {
  7021.                     stream.writeWordBigEndian(i);
  7022.                     stream.writeWordBigEndian(j);
  7023.                     stream.writeWord(minimapInt1);
  7024.                     stream.writeWordBigEndian(57);
  7025.                     stream.writeWordBigEndian(minimapInt2);
  7026.                     stream.writeWordBigEndian(minimapInt3);
  7027.                     stream.writeWordBigEndian(89);
  7028.                     stream.writeWord(myPlayer.x);
  7029.                     stream.writeWord(myPlayer.y);
  7030.                     stream.writeWordBigEndian(anInt1264);
  7031.                     stream.writeWordBigEndian(63);
  7032.                 }
  7033.             }
  7034.             anInt1117++;
  7035.             if (anInt1117 > 1151) {
  7036.                 anInt1117 = 0;
  7037.                 stream.createFrame(246);
  7038.                 stream.writeWordBigEndian(0);
  7039.                 int l = stream.currentOffset;
  7040.                 if ((int) (Math.random() * 2D) == 0) {
  7041.                     stream.writeWordBigEndian(101);
  7042.                 }
  7043.                 stream.writeWordBigEndian(197);
  7044.                 stream.writeWord((int) (Math.random() * 65536D));
  7045.                 stream.writeWordBigEndian((int) (Math.random() * 256D));
  7046.                 stream.writeWordBigEndian(67);
  7047.                 stream.writeWord(14214);
  7048.                 if ((int) (Math.random() * 2D) == 0) {
  7049.                     stream.writeWord(29487);
  7050.                 }
  7051.                 stream.writeWord((int) (Math.random() * 65536D));
  7052.                 if ((int) (Math.random() * 2D) == 0) {
  7053.                     stream.writeWordBigEndian(220);
  7054.                 }
  7055.                 stream.writeWordBigEndian(180);
  7056.                 stream.writeBytes(stream.currentOffset - l);
  7057.             }
  7058.         }
  7059.     }
  7060.  
  7061.     public String interfaceIntToString(int j) {
  7062.         if (j < 0x3b9ac9ff) {
  7063.             return String.valueOf(j);
  7064.         } else {
  7065.             return "*";
  7066.         }
  7067.     }
  7068.  
  7069.     public void showErrorScreen() {
  7070.         Graphics g = getGameComponent().getGraphics();
  7071.         g.setColor(Color.black);
  7072.         g.fillRect(0, 0, 765, 503);
  7073.         method4(1);
  7074.         if (loadingError) {
  7075.             aBoolean831 = false;
  7076.             g.setFont(new Font("Helvetica", 1, 16));
  7077.             g.setColor(Color.yellow);
  7078.             int k = 35;
  7079.             g.drawString("Sorry, an error has occured whilst loading " + ClientSettings.SERVER_NAME + "", 30, k);
  7080.             k += 50;
  7081.             g.setColor(Color.white);
  7082.             g.drawString("To fix this try the following (in order):", 30, k);
  7083.             k += 50;
  7084.             g.setColor(Color.white);
  7085.             g.setFont(new Font("Helvetica", 1, 12));
  7086.             g.drawString("1: Try closing ALL open web-browser windows, and reloading", 30, k);
  7087.             k += 30;
  7088.             g.drawString("2: Try clearing your web-browsers cache from tools->internet options", 30, k);
  7089.             k += 30;
  7090.             g.drawString("3: Try using a different game-world", 30, k);
  7091.             k += 30;
  7092.             g.drawString("4: Try rebooting your computer", 30, k);
  7093.             k += 30;
  7094.             g.drawString("5: Try selecting a different version of Java from the play-game menu", 30, k);
  7095.         }
  7096.         if (genericLoadingError) {
  7097.             aBoolean831 = false;
  7098.             g.setFont(new Font("Helvetica", 1, 20));
  7099.             g.setColor(Color.white);
  7100.             g.drawString("Error - unable to load game!", 50, 50);
  7101.             g.drawString("To play " + ClientSettings.SERVER_NAME + " make sure you play from", 50, 100);
  7102.             g.drawString("" + ClientSettings.SERVER_WEBSITE + "", 50, 150);
  7103.         }
  7104.         if (rsAlreadyLoaded) {
  7105.             aBoolean831 = false;
  7106.             g.setColor(Color.yellow);
  7107.             int l = 35;
  7108.             g.drawString("Error a copy of " + ClientSettings.SERVER_NAME + " already appears to be loaded", 30, l);
  7109.             l += 50;
  7110.             g.setColor(Color.white);
  7111.             g.drawString("To fix this try the following (in order):", 30, l);
  7112.             l += 50;
  7113.             g.setColor(Color.white);
  7114.             g.setFont(new Font("Helvetica", 1, 12));
  7115.             g.drawString("1: Try closing ALL open web-browser windows, and reloading", 30, l);
  7116.             l += 30;
  7117.             g.drawString("2: Try rebooting your computer, and reloading", 30, l);
  7118.             l += 30;
  7119.         }
  7120.     }
  7121.  
  7122.     public URL getCodeBase() {
  7123.         // if (SignLink.mainapp != null) {
  7124.         // return SignLink.mainapp.getCodeBase();
  7125.         // }
  7126.         try {
  7127.             // if (super.gameFrame != null) {
  7128.             return new URL("http://" + server + ":" + (80 + portOff));
  7129.             // }
  7130.         } catch (Exception _ex) {
  7131.         }
  7132.         return null;
  7133.         // return super.getCodeBase();
  7134.     }
  7135.  
  7136.     public void method95() {
  7137.         for (int j = 0; j < npcCount; j++) {
  7138.             int k = npcIndices[j];
  7139.             NPC npc = npcArray[k];
  7140.             if (npc != null) {
  7141.                 method96(npc);
  7142.             }
  7143.         }
  7144.     }
  7145.  
  7146.     public void method96(Entity entity) {
  7147.         if (entity.x < 128 || entity.y < 128 || entity.x >= 13184 || entity.y >= 13184) {
  7148.             entity.anim = -1;
  7149.             entity.anInt1520 = -1;
  7150.             entity.anInt1547 = 0;
  7151.             entity.anInt1548 = 0;
  7152.             entity.x = entity.smallX[0] * 128 + entity.anInt1540 * 64;
  7153.             entity.y = entity.smallY[0] * 128 + entity.anInt1540 * 64;
  7154.             entity.method446();
  7155.         }
  7156.         if (entity == myPlayer && (entity.x < 1536 || entity.y < 1536 || entity.x >= 11776 || entity.y >= 11776)) {
  7157.             entity.anim = -1;
  7158.             entity.anInt1520 = -1;
  7159.             entity.anInt1547 = 0;
  7160.             entity.anInt1548 = 0;
  7161.             entity.x = entity.smallX[0] * 128 + entity.anInt1540 * 64;
  7162.             entity.y = entity.smallY[0] * 128 + entity.anInt1540 * 64;
  7163.             entity.method446();
  7164.         }
  7165.         if (entity.anInt1547 > loopCycle) {
  7166.             method97(entity);
  7167.         } else if (entity.anInt1548 >= loopCycle) {
  7168.             method98(entity);
  7169.         } else {
  7170.             method99(entity);
  7171.         }
  7172.         method100(entity);
  7173.         method101(entity);
  7174.     }
  7175.  
  7176.     public void method97(Entity entity) {
  7177.         int i = entity.anInt1547 - loopCycle;
  7178.         int j = entity.anInt1543 * 128 + entity.anInt1540 * 64;
  7179.         int k = entity.anInt1545 * 128 + entity.anInt1540 * 64;
  7180.         entity.x += (j - entity.x) / i;
  7181.         entity.y += (k - entity.y) / i;
  7182.         entity.anInt1503 = 0;
  7183.         if (entity.anInt1549 == 0) {
  7184.             entity.turnDirection = 1024;
  7185.         }
  7186.         if (entity.anInt1549 == 1) {
  7187.             entity.turnDirection = 1536;
  7188.         }
  7189.         if (entity.anInt1549 == 2) {
  7190.             entity.turnDirection = 0;
  7191.         }
  7192.         if (entity.anInt1549 == 3) {
  7193.             entity.turnDirection = 512;
  7194.         }
  7195.     }
  7196.  
  7197.     public void method98(Entity entity) {
  7198.         if (entity.anInt1548 == loopCycle || entity.anim == -1 || entity.anInt1529 != 0 || entity.anInt1528 + 1 > Animation.anims[entity.anim].method258(entity.anInt1527)) {
  7199.             int i = entity.anInt1548 - entity.anInt1547;
  7200.             int j = loopCycle - entity.anInt1547;
  7201.             int k = entity.anInt1543 * 128 + entity.anInt1540 * 64;
  7202.             int l = entity.anInt1545 * 128 + entity.anInt1540 * 64;
  7203.             int i1 = entity.anInt1544 * 128 + entity.anInt1540 * 64;
  7204.             int j1 = entity.anInt1546 * 128 + entity.anInt1540 * 64;
  7205.             entity.x = (k * (i - j) + i1 * j) / i;
  7206.             entity.y = (l * (i - j) + j1 * j) / i;
  7207.         }
  7208.         entity.anInt1503 = 0;
  7209.         if (entity.anInt1549 == 0) {
  7210.             entity.turnDirection = 1024;
  7211.         }
  7212.         if (entity.anInt1549 == 1) {
  7213.             entity.turnDirection = 1536;
  7214.         }
  7215.         if (entity.anInt1549 == 2) {
  7216.             entity.turnDirection = 0;
  7217.         }
  7218.         if (entity.anInt1549 == 3) {
  7219.             entity.turnDirection = 512;
  7220.         }
  7221.         entity.anInt1552 = entity.turnDirection;
  7222.     }
  7223.  
  7224.     public void method99(Entity entity) {
  7225.         entity.anInt1517 = entity.anInt1511;
  7226.         if (entity.smallXYIndex == 0) {
  7227.             entity.anInt1503 = 0;
  7228.             return;
  7229.         }
  7230.         if (entity.anim != -1 && entity.anInt1529 == 0) {
  7231.             Animation animation = Animation.anims[entity.anim];
  7232.             if (entity.anInt1542 > 0 && animation.anInt363 == 0) {
  7233.                 entity.anInt1503++;
  7234.                 return;
  7235.             }
  7236.             if (entity.anInt1542 <= 0 && animation.anInt364 == 0) {
  7237.                 entity.anInt1503++;
  7238.                 return;
  7239.             }
  7240.         }
  7241.         int i = entity.x;
  7242.         int j = entity.y;
  7243.         int k = entity.smallX[entity.smallXYIndex - 1] * 128 + entity.anInt1540 * 64;
  7244.         int l = entity.smallY[entity.smallXYIndex - 1] * 128 + entity.anInt1540 * 64;
  7245.         if (k - i > 256 || k - i < -256 || l - j > 256 || l - j < -256) {
  7246.             entity.x = k;
  7247.             entity.y = l;
  7248.             return;
  7249.         }
  7250.         if (i < k) {
  7251.             if (j < l) {
  7252.                 entity.turnDirection = 1280;
  7253.             } else if (j > l) {
  7254.                 entity.turnDirection = 1792;
  7255.             } else {
  7256.                 entity.turnDirection = 1536;
  7257.             }
  7258.         } else if (i > k) {
  7259.             if (j < l) {
  7260.                 entity.turnDirection = 768;
  7261.             } else if (j > l) {
  7262.                 entity.turnDirection = 256;
  7263.             } else {
  7264.                 entity.turnDirection = 512;
  7265.             }
  7266.         } else if (j < l) {
  7267.             entity.turnDirection = 1024;
  7268.         } else {
  7269.             entity.turnDirection = 0;
  7270.         }
  7271.         int i1 = entity.turnDirection - entity.anInt1552 & 0x7ff;
  7272.         if (i1 > 1024) {
  7273.             i1 -= 2048;
  7274.         }
  7275.         int j1 = entity.anInt1555;
  7276.         if (i1 >= -256 && i1 <= 256) {
  7277.             j1 = entity.anInt1554;
  7278.         } else if (i1 >= 256 && i1 < 768) {
  7279.             j1 = entity.anInt1557;
  7280.         } else if (i1 >= -768 && i1 <= -256) {
  7281.             j1 = entity.anInt1556;
  7282.         }
  7283.         if (j1 == -1) {
  7284.             j1 = entity.anInt1554;
  7285.         }
  7286.         entity.anInt1517 = j1;
  7287.         int k1 = 4;
  7288.         if (entity.anInt1552 != entity.turnDirection && entity.interactingEntity == -1 && entity.anInt1504 != 0) {
  7289.             k1 = 2;
  7290.         }
  7291.         if (entity.smallXYIndex > 2) {
  7292.             k1 = 6;
  7293.         }
  7294.         if (entity.smallXYIndex > 3) {
  7295.             k1 = 8;
  7296.         }
  7297.         if (entity.anInt1503 > 0 && entity.smallXYIndex > 1) {
  7298.             k1 = 8;
  7299.             entity.anInt1503--;
  7300.         }
  7301.         if (entity.aBooleanArray1553[entity.smallXYIndex - 1]) {
  7302.             k1 <<= 1;
  7303.         }
  7304.         if (k1 >= 8 && entity.anInt1517 == entity.anInt1554 && entity.anInt1505 != -1) {
  7305.             entity.anInt1517 = entity.anInt1505;
  7306.         }
  7307.         if (i < k) {
  7308.             entity.x += k1;
  7309.             if (entity.x > k) {
  7310.                 entity.x = k;
  7311.             }
  7312.         } else if (i > k) {
  7313.             entity.x -= k1;
  7314.             if (entity.x < k) {
  7315.                 entity.x = k;
  7316.             }
  7317.         }
  7318.         if (j < l) {
  7319.             entity.y += k1;
  7320.             if (entity.y > l) {
  7321.                 entity.y = l;
  7322.             }
  7323.         } else if (j > l) {
  7324.             entity.y -= k1;
  7325.             if (entity.y < l) {
  7326.                 entity.y = l;
  7327.             }
  7328.         }
  7329.         if (entity.x == k && entity.y == l) {
  7330.             entity.smallXYIndex--;
  7331.             if (entity.anInt1542 > 0) {
  7332.                 entity.anInt1542--;
  7333.             }
  7334.         }
  7335.     }
  7336.  
  7337.     public void method100(Entity entity) {
  7338.         if (entity.anInt1504 == 0) {
  7339.             return;
  7340.         }
  7341.         if (entity.interactingEntity != -1 && entity.interactingEntity < 32768) {
  7342.             NPC npc = npcArray[entity.interactingEntity];
  7343.             if (npc != null) {
  7344.                 int i1 = entity.x - npc.x;
  7345.                 int k1 = entity.y - npc.y;
  7346.                 if (i1 != 0 || k1 != 0) {
  7347.                     entity.turnDirection = (int) (Math.atan2(i1, k1) * 325.94900000000001D) & 0x7ff;
  7348.                 }
  7349.             }
  7350.         }
  7351.         if (entity.interactingEntity >= 32768) {
  7352.             int j = entity.interactingEntity - 32768;
  7353.             if (j == unknownInt10) {
  7354.                 j = myPlayerIndex;
  7355.             }
  7356.             Player player = playerArray[j];
  7357.             if (player != null) {
  7358.                 int l1 = entity.x - player.x;
  7359.                 int i2 = entity.y - player.y;
  7360.                 if (l1 != 0 || i2 != 0) {
  7361.                     entity.turnDirection = (int) (Math.atan2(l1, i2) * 325.94900000000001D) & 0x7ff;
  7362.                 }
  7363.             }
  7364.         }
  7365.         if ((entity.anInt1538 != 0 || entity.anInt1539 != 0) && (entity.smallXYIndex == 0 || entity.anInt1503 > 0)) {
  7366.             int k = entity.x - (entity.anInt1538 - baseX - baseX) * 64;
  7367.             int j1 = entity.y - (entity.anInt1539 - baseY - baseY) * 64;
  7368.             if (k != 0 || j1 != 0) {
  7369.                 entity.turnDirection = (int) (Math.atan2(k, j1) * 325.94900000000001D) & 0x7ff;
  7370.             }
  7371.             entity.anInt1538 = 0;
  7372.             entity.anInt1539 = 0;
  7373.         }
  7374.         int l = entity.turnDirection - entity.anInt1552 & 0x7ff;
  7375.         if (l != 0) {
  7376.             if (l < entity.anInt1504 || l > 2048 - entity.anInt1504) {
  7377.                 entity.anInt1552 = entity.turnDirection;
  7378.             } else if (l > 1024) {
  7379.                 entity.anInt1552 -= entity.anInt1504;
  7380.             } else {
  7381.                 entity.anInt1552 += entity.anInt1504;
  7382.             }
  7383.             entity.anInt1552 &= 0x7ff;
  7384.             if (entity.anInt1517 == entity.anInt1511 && entity.anInt1552 != entity.turnDirection) {
  7385.                 if (entity.anInt1512 != -1) {
  7386.                     entity.anInt1517 = entity.anInt1512;
  7387.                     return;
  7388.                 }
  7389.                 entity.anInt1517 = entity.anInt1554;
  7390.             }
  7391.         }
  7392.     }
  7393.  
  7394.     public void method101(Entity entity) {
  7395.         entity.aBoolean1541 = false;
  7396.         if (entity.anInt1517 != -1) {
  7397.             Animation animation = Animation.anims[entity.anInt1517];
  7398.             entity.anInt1519++;
  7399.             if (entity.anInt1518 < animation.anInt352 && entity.anInt1519 > animation.method258(entity.anInt1518)) {
  7400.                 entity.anInt1519 = 0;
  7401.                 entity.anInt1518++;
  7402.             }
  7403.             if (entity.anInt1518 >= animation.anInt352) {
  7404.                 entity.anInt1519 = 0;
  7405.                 entity.anInt1518 = 0;
  7406.             }
  7407.         }
  7408.         if (entity.anInt1520 != -1 && loopCycle >= entity.anInt1523) {
  7409.             if (entity.anInt1521 < 0) {
  7410.                 entity.anInt1521 = 0;
  7411.             }
  7412.             Animation animation_1 = SpotAnim.cache[entity.anInt1520].aAnimation_407;
  7413.             for (entity.anInt1522++; entity.anInt1521 < animation_1.anInt352 && entity.anInt1522 > animation_1.method258(entity.anInt1521); entity.anInt1521++) {
  7414.                 entity.anInt1522 -= animation_1.method258(entity.anInt1521);
  7415.             }
  7416.  
  7417.             if (entity.anInt1521 >= animation_1.anInt352 && (entity.anInt1521 < 0 || entity.anInt1521 >= animation_1.anInt352)) {
  7418.                 entity.anInt1520 = -1;
  7419.             }
  7420.         }
  7421.         if (entity.anim != -1 && entity.anInt1529 <= 1) {
  7422.             Animation animation_2 = Animation.anims[entity.anim];
  7423.             if (animation_2.anInt363 == 1 && entity.anInt1542 > 0 && entity.anInt1547 <= loopCycle && entity.anInt1548 < loopCycle) {
  7424.                 entity.anInt1529 = 1;
  7425.                 return;
  7426.             }
  7427.         }
  7428.         if (entity.anim != -1 && entity.anInt1529 == 0) {
  7429.             Animation animation_3 = Animation.anims[entity.anim];
  7430.             for (entity.anInt1528++; entity.anInt1527 < animation_3.anInt352 && entity.anInt1528 > animation_3.method258(entity.anInt1527); entity.anInt1527++) {
  7431.                 entity.anInt1528 -= animation_3.method258(entity.anInt1527);
  7432.             }
  7433.  
  7434.             if (entity.anInt1527 >= animation_3.anInt352) {
  7435.                 entity.anInt1527 -= animation_3.anInt356;
  7436.                 entity.anInt1530++;
  7437.                 if (entity.anInt1530 >= animation_3.anInt362) {
  7438.                     entity.anim = -1;
  7439.                 }
  7440.                 if (entity.anInt1527 < 0 || entity.anInt1527 >= animation_3.anInt352) {
  7441.                     entity.anim = -1;
  7442.                 }
  7443.             }
  7444.             entity.aBoolean1541 = animation_3.aBoolean358;
  7445.         }
  7446.         if (entity.anInt1529 > 0) {
  7447.             entity.anInt1529--;
  7448.         }
  7449.     }
  7450.  
  7451.     public void drawGameScreen() {
  7452.         if (fullScreenBackDialogID != -1 && (loadingStage == 2 || super.fullGameScreen != null)) {
  7453.             if (loadingStage == 2) {
  7454.                 method119(anInt945, fullScreenBackDialogID);
  7455.                 if (fullScreenInterfaceId != -1)
  7456.                     method119(anInt945, fullScreenInterfaceId);
  7457.                 anInt945 = 0;
  7458.                 resetAllImageProducers();
  7459.                 super.fullGameScreen.initDrawingArea();
  7460.                 Texture.lineOffsets = gameScreenOffsets;
  7461.                 DrawingArea.setAllPixelsToZero();
  7462.                 welcomeScreenRaised = true;
  7463.                 RSInterface rSInterface = RSInterface.interfaceCache[fullScreenBackDialogID];
  7464.                 if (rSInterface.width == 512 && rSInterface.height == 334
  7465.                         && rSInterface.type == 0) {
  7466.                     rSInterface.width = 765;
  7467.                     rSInterface.height = 503;
  7468.                 }
  7469.                 drawInterface(0, 0, rSInterface, 0);
  7470.                 if (fullScreenInterfaceId != -1) {
  7471.                     RSInterface class13_1 = RSInterface.interfaceCache[fullScreenInterfaceId];
  7472.                     if (class13_1.width == 512 && class13_1.height == 334
  7473.                             && class13_1.type == 0) {
  7474.                         class13_1.width = 765;
  7475.                         class13_1.height = 503;
  7476.                     }
  7477.                     drawInterface(0, 0, class13_1, 0);
  7478.                 }
  7479.                 if (!menuOpen) {
  7480.                     processRightClick();
  7481.                     drawTooltip();
  7482.                 } else {
  7483.                     drawMenu();
  7484.                 }
  7485.             }
  7486.             super.fullGameScreen.drawGraphics(0, super.graphics, 0);
  7487.             return;
  7488.         }
  7489.         if (welcomeScreenRaised) {
  7490.             resetImageProducers2();
  7491.             welcomeScreenRaised = false;
  7492.             backLeftIP1.drawGraphics(4, super.graphics, 0);
  7493.             backLeftIP2.drawGraphics(357, super.graphics, 0);
  7494.             backRightIP1.drawGraphics(4, super.graphics, 722);
  7495.             backRightIP2.drawGraphics(205, super.graphics, 743);
  7496.             backTopIP1.drawGraphics(0, super.graphics, 0);
  7497.             backVmidIP1.drawGraphics(4, super.graphics, 516);
  7498.             backVmidIP2.drawGraphics(205, super.graphics, 516);
  7499.             backVmidIP3.drawGraphics(357, super.graphics, 496);
  7500.             backVmidIP2_2.drawGraphics(338, super.graphics, 0);
  7501.             needDrawTabArea = true;
  7502.             inputTaken = true;
  7503.             tabAreaAltered = true;
  7504.             aBoolean1233 = true;
  7505.             if (loadingStage != 2) {
  7506.                 aRSImageProducer_1165.drawGraphics(4, super.graphics, 4);
  7507.                 aRSImageProducer_1164.drawGraphics(4, super.graphics, 550);
  7508.             }
  7509.         }
  7510.         if (loadingStage == 2) {
  7511.             method146();
  7512.         }
  7513.         if (menuOpen && menuScreenArea == 1) {
  7514.             needDrawTabArea = true;
  7515.         }
  7516.         if (invOverlayInterfaceID != -1) {
  7517.             boolean flag1 = method119(anInt945, invOverlayInterfaceID);
  7518.             if (flag1) {
  7519.                 needDrawTabArea = true;
  7520.             }
  7521.         }
  7522.         if (atInventoryInterfaceType == 2) {
  7523.             needDrawTabArea = true;
  7524.         }
  7525.         if (activeInterfaceType == 2) {
  7526.             needDrawTabArea = true;
  7527.         }
  7528.         if (needDrawTabArea) {
  7529.             drawTabArea();
  7530.             needDrawTabArea = false;
  7531.         }
  7532.         if (backDialogID == -1) {
  7533.             aClass9_1059.scrollPosition = anInt1211 - anInt1089 - 77;
  7534.             if (super.mouseX > 448 && super.mouseX < 560 && super.mouseY > 332) {
  7535.                 method65(463, 77, super.mouseX - 17, super.mouseY - 357, aClass9_1059, 0, false, anInt1211);
  7536.             }
  7537.             int i = anInt1211 - 77 - aClass9_1059.scrollPosition;
  7538.             if (i < 0) {
  7539.                 i = 0;
  7540.             }
  7541.             if (i > anInt1211 - 77) {
  7542.                 i = anInt1211 - 77;
  7543.             }
  7544.             if (anInt1089 != i) {
  7545.                 anInt1089 = i;
  7546.                 inputTaken = true;
  7547.             }
  7548.         }
  7549.         if (backDialogID != -1) {
  7550.             boolean flag2 = method119(anInt945, backDialogID);
  7551.             if (flag2) {
  7552.                 inputTaken = true;
  7553.             }
  7554.         }
  7555.         if (dialogID != -1) {
  7556.             inputTaken = true;
  7557.         }
  7558.         if (atInventoryInterfaceType == 3) {
  7559.             inputTaken = true;
  7560.         }
  7561.         if (activeInterfaceType == 3) {
  7562.             inputTaken = true;
  7563.         }
  7564.         if (aString844 != null) {
  7565.             inputTaken = true;
  7566.         }
  7567.         if (menuOpen && menuScreenArea == 2) {
  7568.             inputTaken = true;
  7569.         }
  7570.         if (inputTaken) {
  7571.             drawChatArea();
  7572.             inputTaken = false;
  7573.         }
  7574.         if (loadingStage == 2) {
  7575.             drawMinimap();
  7576.             aRSImageProducer_1164.drawGraphics(4, super.graphics, 550);
  7577.         }
  7578.         if (anInt1054 != -1) {
  7579.             tabAreaAltered = true;
  7580.         }
  7581.         if (tabAreaAltered) {
  7582.             if (anInt1054 != -1 && anInt1054 == tabID) {
  7583.                 anInt1054 = -1;
  7584.                 stream.createFrame(120);
  7585.                 stream.writeWordBigEndian(tabID);
  7586.             }
  7587.             tabAreaAltered = false;
  7588.             aRSImageProducer_1125.initDrawingArea();
  7589.             backHmid1.method361(0, 0);
  7590.             if (invOverlayInterfaceID == -1) {
  7591.                 if (tabInterfaceIDs[tabID] != -1) {
  7592.                     if (tabID == 0) {
  7593.                         redStone1.method361(22, 10);
  7594.                     }
  7595.                     if (tabID == 1) {
  7596.                         redStone2.method361(54, 8);
  7597.                     }
  7598.                     if (tabID == 2) {
  7599.                         redStone2.method361(82, 8);
  7600.                     }
  7601.                     if (tabID == 3) {
  7602.                         redStone3.method361(110, 8);
  7603.                     }
  7604.                     if (tabID == 4) {
  7605.                         redStone2_2.method361(153, 8);
  7606.                     }
  7607.                     if (tabID == 5) {
  7608.                         redStone2_2.method361(181, 8);
  7609.                     }
  7610.                     if (tabID == 6) {
  7611.                         redStone1_2.method361(209, 9);
  7612.                     }
  7613.                 }
  7614.                 if (tabInterfaceIDs[0] != -1 && (anInt1054 != 0 || loopCycle % 20 < 10)) {
  7615.                     sideIcons[0].method361(29, 13);
  7616.                 }
  7617.                 if (tabInterfaceIDs[1] != -1 && (anInt1054 != 1 || loopCycle % 20 < 10)) {
  7618.                     sideIcons[1].method361(53, 11);
  7619.                 }
  7620.                 if (tabInterfaceIDs[2] != -1 && (anInt1054 != 2 || loopCycle % 20 < 10)) {
  7621.                     sideIcons[2].method361(82, 11);
  7622.                 }
  7623.                 if (tabInterfaceIDs[3] != -1 && (anInt1054 != 3 || loopCycle % 20 < 10)) {
  7624.                     sideIcons[3].method361(115, 12);
  7625.                 }
  7626.                 if (tabInterfaceIDs[4] != -1 && (anInt1054 != 4 || loopCycle % 20 < 10)) {
  7627.                     sideIcons[4].method361(153, 13);
  7628.                 }
  7629.                 if (tabInterfaceIDs[5] != -1 && (anInt1054 != 5 || loopCycle % 20 < 10)) {
  7630.                     sideIcons[5].method361(180, 11);
  7631.                 }
  7632.                 if (tabInterfaceIDs[6] != -1 && (anInt1054 != 6 || loopCycle % 20 < 10)) {
  7633.                     sideIcons[6].method361(208, 13);
  7634.                 }
  7635.             }
  7636.             aRSImageProducer_1125.drawGraphics(160, super.graphics, 516);
  7637.             aRSImageProducer_1124.initDrawingArea();
  7638.             backBase2.method361(0, 0);
  7639.             if (invOverlayInterfaceID == -1) {
  7640.                 if (tabInterfaceIDs[tabID] != -1) {
  7641.                     if (tabID == 7) {
  7642.                         redStone1_3.method361(42, 0);
  7643.                     }
  7644.                     if (tabID == 8) {
  7645.                         redStone2_3.method361(74, 0);
  7646.                     }
  7647.                     if (tabID == 9) {
  7648.                         redStone2_3.method361(102, 0);
  7649.                     }
  7650.                     if (tabID == 10) {
  7651.                         redStone3_2.method361(130, 1);
  7652.                     }
  7653.                     if (tabID == 11) {
  7654.                         redStone2_4.method361(173, 0);
  7655.                     }
  7656.                     if (tabID == 12) {
  7657.                         redStone2_4.method361(201, 0);
  7658.                     }
  7659.                     if (tabID == 13) {
  7660.                         redStone1_4.method361(229, 0);
  7661.                     }
  7662.                 }
  7663.                 if (tabInterfaceIDs[8] != -1 && (anInt1054 != 8 || loopCycle % 20 < 10)) {
  7664.                     sideIcons[7].method361(74, 2);
  7665.                 }
  7666.                 if (tabInterfaceIDs[9] != -1 && (anInt1054 != 9 || loopCycle % 20 < 10)) {
  7667.                     sideIcons[8].method361(102, 3);
  7668.                 }
  7669.                 if (tabInterfaceIDs[10] != -1 && (anInt1054 != 10 || loopCycle % 20 < 10)) {
  7670.                     sideIcons[9].method361(137, 4);
  7671.                 }
  7672.                 if (tabInterfaceIDs[11] != -1 && (anInt1054 != 11 || loopCycle % 20 < 10)) {
  7673.                     sideIcons[10].method361(174, 2);
  7674.                 }
  7675.                 if (tabInterfaceIDs[12] != -1 && (anInt1054 != 12 || loopCycle % 20 < 10)) {
  7676.                     sideIcons[11].method361(201, 2);
  7677.                 }
  7678.                 if (tabInterfaceIDs[13] != -1 && (anInt1054 != 13 || loopCycle % 20 < 10)) {
  7679.                     sideIcons[12].method361(226, 2);
  7680.                 }
  7681.             }
  7682.             aRSImageProducer_1124.drawGraphics(466, super.graphics, 496);
  7683.             aRSImageProducer_1165.initDrawingArea();
  7684.             Texture.lineOffsets = chatBoxAreaOffsets;
  7685.         }
  7686.         if (aBoolean1233) {
  7687.             aBoolean1233 = false;
  7688.             aRSImageProducer_1123.initDrawingArea();
  7689.             backBase1.method361(0, 0);
  7690.             aTextDrawingArea_1271.method382(0xffffff, 55, "Public chat", 28, true);
  7691.             if (publicChatMode == 0) {
  7692.                 aTextDrawingArea_1271.method382(65280, 55, "On", 41, true);
  7693.             }
  7694.             if (publicChatMode == 1) {
  7695.                 aTextDrawingArea_1271.method382(0xffff00, 55, "Friends", 41, true);
  7696.             }
  7697.             if (publicChatMode == 2) {
  7698.                 aTextDrawingArea_1271.method382(0xff0000, 55, "Off", 41, true);
  7699.             }
  7700.             if (publicChatMode == 3) {
  7701.                 aTextDrawingArea_1271.method382(65535, 55, "Hide", 41, true);
  7702.             }
  7703.             aTextDrawingArea_1271.method382(0xffffff, 184, "Private chat", 28, true);
  7704.             if (privateChatMode == 0) {
  7705.                 aTextDrawingArea_1271.method382(65280, 184, "On", 41, true);
  7706.             }
  7707.             if (privateChatMode == 1) {
  7708.                 aTextDrawingArea_1271.method382(0xffff00, 184, "Friends", 41, true);
  7709.             }
  7710.             if (privateChatMode == 2) {
  7711.                 aTextDrawingArea_1271.method382(0xff0000, 184, "Off", 41, true);
  7712.             }
  7713.             aTextDrawingArea_1271.method382(0xffffff, 324, "Trade/compete", 28, true);
  7714.             if (tradeMode == 0) {
  7715.                 aTextDrawingArea_1271.method382(65280, 324, "On", 41, true);
  7716.             }
  7717.             if (tradeMode == 1) {
  7718.                 aTextDrawingArea_1271.method382(0xffff00, 324, "Friends", 41, true);
  7719.             }
  7720.             if (tradeMode == 2) {
  7721.                 aTextDrawingArea_1271.method382(0xff0000, 324, "Off", 41, true);
  7722.             }
  7723.             aTextDrawingArea_1271.method382(0xffffff, 458, "Report abuse", 33, true);
  7724.             aRSImageProducer_1123.drawGraphics(453, super.graphics, 0);
  7725.             aRSImageProducer_1165.initDrawingArea();
  7726.             Texture.lineOffsets = chatBoxAreaOffsets;
  7727.         }
  7728.         anInt945 = 0;
  7729.     }
  7730.  
  7731.     public boolean buildFriendsListMenu(RSInterface class9) {
  7732.         int i = class9.anInt214;
  7733.         if (i >= 1 && i <= 200 || i >= 701 && i <= 900) {
  7734.             if (i >= 801) {
  7735.                 i -= 701;
  7736.             } else if (i >= 701) {
  7737.                 i -= 601;
  7738.             } else if (i >= 101) {
  7739.                 i -= 101;
  7740.             } else {
  7741.                 i--;
  7742.             }
  7743.             menuActionName[menuActionRow] = "Remove @whi@" + friendsList[i];
  7744.             menuActionID[menuActionRow] = 792;
  7745.             menuActionRow++;
  7746.             menuActionName[menuActionRow] = "Message @whi@" + friendsList[i];
  7747.             menuActionID[menuActionRow] = 639;
  7748.             menuActionRow++;
  7749.             return true;
  7750.         }
  7751.         if (i >= 401 && i <= 500) {
  7752.             menuActionName[menuActionRow] = "Remove @whi@" + class9.disabledText;
  7753.             menuActionID[menuActionRow] = 322;
  7754.             menuActionRow++;
  7755.             return true;
  7756.         } else {
  7757.             return false;
  7758.         }
  7759.     }
  7760.  
  7761.     public void method104() {
  7762.         Animable_Sub3 class30_sub2_sub4_sub3 = (Animable_Sub3) aClass19_1056.reverseGetFirst();
  7763.         for (; class30_sub2_sub4_sub3 != null; class30_sub2_sub4_sub3 = (Animable_Sub3) aClass19_1056.reverseGetNext()) {
  7764.             if (class30_sub2_sub4_sub3.anInt1560 != plane || class30_sub2_sub4_sub3.aBoolean1567) {
  7765.                 class30_sub2_sub4_sub3.unlink();
  7766.             } else if (loopCycle >= class30_sub2_sub4_sub3.anInt1564) {
  7767.                 class30_sub2_sub4_sub3.method454(anInt945);
  7768.                 if (class30_sub2_sub4_sub3.aBoolean1567) {
  7769.                     class30_sub2_sub4_sub3.unlink();
  7770.                 } else {
  7771.                     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);
  7772.                 }
  7773.             }
  7774.         }
  7775.  
  7776.     }
  7777.  
  7778.     public void drawInterface(int scrollPos, int k, RSInterface class9, int l) {
  7779.         if (class9.type != 0 || class9.children == null) {
  7780.             return;
  7781.         }
  7782.         if (class9.aBoolean266 && anInt1026 != class9.id && anInt1048 != class9.id && anInt1039 != class9.id) {
  7783.             return;
  7784.         }
  7785.         int i1 = DrawingArea.topX;
  7786.         int j1 = DrawingArea.topY;
  7787.         int k1 = DrawingArea.bottomX;
  7788.         int l1 = DrawingArea.bottomY;
  7789.         DrawingArea.setDrawingArea(l + class9.height, k, k + class9.width, l);
  7790.         int i2 = class9.children.length;
  7791.         for (int j2 = 0; j2 < i2; j2++) {
  7792.             int k2 = class9.childX[j2] + k;
  7793.             int l2 = class9.childY[j2] + l - scrollPos;
  7794.             RSInterface component = RSInterface.interfaceCache[class9.children[j2]];
  7795.             k2 += component.anInt263;
  7796.             l2 += component.anInt265;
  7797.             if (component.anInt214 > 0) {
  7798.                 drawFriendsListOrWelcomeScreen(component);
  7799.             }
  7800.             if (component.type == 0) {
  7801.                 if (component.scrollPosition > component.scrollMax - component.height) {
  7802.                     component.scrollPosition = component.scrollMax - component.height;
  7803.                 }
  7804.                 if (component.scrollPosition < 0) {
  7805.                     component.scrollPosition = 0;
  7806.                 }
  7807.                 drawInterface(component.scrollPosition, k2, component, l2);
  7808.                 if (component.scrollMax > component.height) {
  7809.                     method30(component.height, component.scrollPosition, l2, k2 + component.width, component.scrollMax);
  7810.                 }
  7811.             } else if (component.type != 1) {
  7812.                 if (component.type == 2) {
  7813.                     int i3 = 0;
  7814.                     for (int l3 = 0; l3 < component.height; l3++) {
  7815.                         for (int l4 = 0; l4 < component.width; l4++) {
  7816.                             int k5 = k2 + l4 * (32 + component.invSpritePadX);
  7817.                             int j6 = l2 + l3 * (32 + component.invSpritePadY);
  7818.                             if (i3 < 20) {
  7819.                                 k5 += component.spritesX[i3];
  7820.                                 j6 += component.spritesY[i3];
  7821.                             }
  7822.                             if (component.inv[i3] > 0) {
  7823.                                 int k6 = 0;
  7824.                                 int j7 = 0;
  7825.                                 int j9 = component.inv[i3] - 1;
  7826.                                 if (k5 > DrawingArea.topX - 32 && k5 < DrawingArea.bottomX && j6 > DrawingArea.topY - 32 && j6 < DrawingArea.bottomY || activeInterfaceType != 0 && anInt1085 == i3) {
  7827.                                     int l9 = 0;
  7828.                                     if (itemSelected == 1 && anInt1283 == i3 && anInt1284 == component.id) {
  7829.                                         l9 = 0xffffff;
  7830.                                     }
  7831.                                     Sprite class30_sub2_sub1_sub1_2 = ItemDef.getSprite(j9, component.invStackSizes[i3], l9);
  7832.                                     if (class30_sub2_sub1_sub1_2 != null) {
  7833.                                         if (activeInterfaceType != 0 && anInt1085 == i3 && anInt1084 == component.id) {
  7834.                                             k6 = super.mouseX - anInt1087;
  7835.                                             j7 = super.mouseY - anInt1088;
  7836.                                             if (k6 < 5 && k6 > -5) {
  7837.                                                 k6 = 0;
  7838.                                             }
  7839.                                             if (j7 < 5 && j7 > -5) {
  7840.                                                 j7 = 0;
  7841.                                             }
  7842.                                             if (anInt989 < 5) {
  7843.                                                 k6 = 0;
  7844.                                                 j7 = 0;
  7845.                                             }
  7846.                                             class30_sub2_sub1_sub1_2.drawSprite1(k5 + k6, j6 + j7);
  7847.                                             if (j6 + j7 < DrawingArea.topY && class9.scrollPosition > 0) {
  7848.                                                 int i10 = anInt945 * (DrawingArea.topY - j6 - j7) / 3;
  7849.                                                 if (i10 > anInt945 * 10) {
  7850.                                                     i10 = anInt945 * 10;
  7851.                                                 }
  7852.                                                 if (i10 > class9.scrollPosition) {
  7853.                                                     i10 = class9.scrollPosition;
  7854.                                                 }
  7855.                                                 class9.scrollPosition -= i10;
  7856.                                                 anInt1088 += i10;
  7857.                                             }
  7858.                                             if (j6 + j7 + 32 > DrawingArea.bottomY && class9.scrollPosition < class9.scrollMax - class9.height) {
  7859.                                                 int j10 = anInt945 * (j6 + j7 + 32 - DrawingArea.bottomY) / 3;
  7860.                                                 if (j10 > anInt945 * 10) {
  7861.                                                     j10 = anInt945 * 10;
  7862.                                                 }
  7863.                                                 if (j10 > class9.scrollMax - class9.height - class9.scrollPosition) {
  7864.                                                     j10 = class9.scrollMax - class9.height - class9.scrollPosition;
  7865.                                                 }
  7866.                                                 class9.scrollPosition += j10;
  7867.                                                 anInt1088 -= j10;
  7868.                                             }
  7869.                                         } else if (atInventoryInterfaceType != 0 && atInventoryIndex == i3 && atInventoryInterface == component.id) {
  7870.                                             class30_sub2_sub1_sub1_2.drawSprite1(k5, j6);
  7871.                                         } else {
  7872.                                             class30_sub2_sub1_sub1_2.drawSprite(k5, j6);
  7873.                                         }
  7874.                                         if (class30_sub2_sub1_sub1_2.trimWidth == 33 || component.invStackSizes[i3] != 1) {
  7875.                                             int k10 = component.invStackSizes[i3];
  7876.                                             aTextDrawingArea_1270.method385(0, intToKOrMil(k10), j6 + 10 + j7, k5 + 1 + k6);
  7877.                                             aTextDrawingArea_1270.method385(0xffff00, intToKOrMil(k10), j6 + 9 + j7, k5 + k6);
  7878.                                         }
  7879.                                     }
  7880.                                 }
  7881.                             } else if (component.sprites != null && i3 < 20) {
  7882.                                 Sprite class30_sub2_sub1_sub1_1 = component.sprites[i3];
  7883.                                 if (class30_sub2_sub1_sub1_1 != null) {
  7884.                                     class30_sub2_sub1_sub1_1.drawSprite(k5, j6);
  7885.                                 }
  7886.                             }
  7887.                             i3++;
  7888.                         }
  7889.  
  7890.                     }
  7891.  
  7892.                 } else if (component.type == 3) {
  7893.                     boolean flag = false;
  7894.                     if (anInt1039 == component.id || anInt1048 == component.id || anInt1026 == component.id) {
  7895.                         flag = true;
  7896.                     }
  7897.                     int j3;
  7898.                     if (interfaceIsSelected(component)) {
  7899.                         j3 = component.anInt219;
  7900.                         if (flag && component.anInt239 != 0) {
  7901.                             j3 = component.anInt239;
  7902.                         }
  7903.                     } else {
  7904.                         j3 = component.textColor;
  7905.                         if (flag && component.anInt216 != 0) {
  7906.                             j3 = component.anInt216;
  7907.                         }
  7908.                     }
  7909.                     if (component.aByte254 == 0) {
  7910.                         if (component.aBoolean227) {
  7911.                             DrawingArea.method336(component.height, l2, j3, component.width, k2);
  7912.                         } else {
  7913.                             DrawingArea.fillPixels(l2, component.height, j3, k2, component.width);
  7914.                         }
  7915.                     } else if (component.aBoolean227) {
  7916.                         DrawingArea.method335(j3, l2, component.width, component.height, 256 - (component.aByte254 & 0xff), k2);
  7917.                     } else {
  7918.                         DrawingArea.method338(l2, component.height, 256 - (component.aByte254 & 0xff), j3, component.width, k2);
  7919.                     }
  7920.                 } else if (component.type == 4) {
  7921.                     TextDrawingArea textDrawingArea = component.textDrawingAreas;
  7922.                     String s = component.disabledText;
  7923.                     boolean flag1 = false;
  7924.                     if (anInt1039 == component.id || anInt1048 == component.id || anInt1026 == component.id) {
  7925.                         flag1 = true;
  7926.                     }
  7927.                     int i4;
  7928.                     if (interfaceIsSelected(component)) {
  7929.                         i4 = component.anInt219;
  7930.                         if (flag1 && component.anInt239 != 0) {
  7931.                             i4 = component.anInt239;
  7932.                         }
  7933.                         if (component.enabledText.length() > 0) {
  7934.                             s = component.enabledText;
  7935.                         }
  7936.                     } else {
  7937.                         i4 = component.textColor;
  7938.                         if (flag1 && component.anInt216 != 0) {
  7939.                             i4 = component.anInt216;
  7940.                         }
  7941.                     }
  7942.                     if (component.atActionType == 6 && aBoolean1149) {
  7943.                         s = "Please wait...";
  7944.                         i4 = component.textColor;
  7945.                     }
  7946.                     if (DrawingArea.width == 479) {
  7947.                         if (i4 == 0xffff00) {
  7948.                             i4 = 255;
  7949.                         }
  7950.                         if (i4 == 49152) {
  7951.                             i4 = 0xffffff;
  7952.                         }
  7953.                     }
  7954.                     for (int l6 = l2 + textDrawingArea.anInt1497; s.length() > 0; l6 += textDrawingArea.anInt1497) {
  7955.                         if (s.indexOf("%") != -1) {
  7956.                             do {
  7957.                                 int k7 = s.indexOf("%1");
  7958.                                 if (k7 == -1) {
  7959.                                     break;
  7960.                                 }
  7961.                                 s = s.substring(0, k7) + interfaceIntToString(extractInterfaceValues(component, 0)) + s.substring(k7 + 2);
  7962.                             } while (true);
  7963.                             do {
  7964.                                 int l7 = s.indexOf("%2");
  7965.                                 if (l7 == -1) {
  7966.                                     break;
  7967.                                 }
  7968.                                 s = s.substring(0, l7) + interfaceIntToString(extractInterfaceValues(component, 1)) + s.substring(l7 + 2);
  7969.                             } while (true);
  7970.                             do {
  7971.                                 int i8 = s.indexOf("%3");
  7972.                                 if (i8 == -1) {
  7973.                                     break;
  7974.                                 }
  7975.                                 s = s.substring(0, i8) + interfaceIntToString(extractInterfaceValues(component, 2)) + s.substring(i8 + 2);
  7976.                             } while (true);
  7977.                             do {
  7978.                                 int j8 = s.indexOf("%4");
  7979.                                 if (j8 == -1) {
  7980.                                     break;
  7981.                                 }
  7982.                                 s = s.substring(0, j8) + interfaceIntToString(extractInterfaceValues(component, 3)) + s.substring(j8 + 2);
  7983.                             } while (true);
  7984.                             do {
  7985.                                 int k8 = s.indexOf("%5");
  7986.                                 if (k8 == -1) {
  7987.                                     break;
  7988.                                 }
  7989.                                 s = s.substring(0, k8) + interfaceIntToString(extractInterfaceValues(component, 4)) + s.substring(k8 + 2);
  7990.                             } while (true);
  7991.                         }
  7992.                         int l8 = s.indexOf("\\n");
  7993.                         String s1;
  7994.                         if (l8 != -1) {
  7995.                             s1 = s.substring(0, l8);
  7996.                             s = s.substring(l8 + 2);
  7997.                         } else {
  7998.                             s1 = s;
  7999.                             s = "";
  8000.                         }
  8001.                         if (component.aBoolean223) {
  8002.                             textDrawingArea.method382(i4, k2 + component.width / 2, s1, l6, component.aBoolean268);
  8003.                         } else {
  8004.                             textDrawingArea.method389(component.aBoolean268, k2, i4, s1, l6);
  8005.                         }
  8006.                     }
  8007.  
  8008.                 } else if (component.type == 5) {
  8009.                     Sprite sprite;
  8010.                     if (interfaceIsSelected(component)) {
  8011.                         sprite = component.sprite2;
  8012.                     } else {
  8013.                         sprite = component.sprite1;
  8014.                     }
  8015.                     if (sprite != null) {
  8016.                         sprite.drawSprite(k2, l2);
  8017.                     }
  8018.                 } else if (component.type == 6) {
  8019.                     int k3 = Texture.textureInt1;
  8020.                     int j4 = Texture.textureInt2;
  8021.                     Texture.textureInt1 = k2 + component.width / 2;
  8022.                     Texture.textureInt2 = l2 + component.height / 2;
  8023.                     int i5 = Texture.anIntArray1470[component.anInt270] * component.anInt269 >> 16;
  8024.                     int l5 = Texture.anIntArray1471[component.anInt270] * component.anInt269 >> 16;
  8025.                     boolean flag2 = interfaceIsSelected(component);
  8026.                     int i7;
  8027.                     if (flag2) {
  8028.                         i7 = component.anInt258;
  8029.                     } else {
  8030.                         i7 = component.anInt257;
  8031.                     }
  8032.                     Model model;
  8033.                     if (i7 == -1) {
  8034.                         model = component.method209(-1, -1, flag2);
  8035.                     } else {
  8036.                         Animation animation = Animation.anims[i7];
  8037.                         model = component.method209(animation.anIntArray354[component.anInt246], animation.anIntArray353[component.anInt246], flag2);
  8038.                     }
  8039.                     if (model != null) {
  8040.                         model.method482(component.anInt271, 0, component.anInt270, 0, i5, l5);
  8041.                     }
  8042.                     Texture.textureInt1 = k3;
  8043.                     Texture.textureInt2 = j4;
  8044.                 } else if (component.type == 7) {
  8045.                     TextDrawingArea textDrawingArea_1 = component.textDrawingAreas;
  8046.                     int k4 = 0;
  8047.                     for (int j5 = 0; j5 < component.height; j5++) {
  8048.                         for (int i6 = 0; i6 < component.width; i6++) {
  8049.                             if (component.inv[k4] > 0) {
  8050.                                 ItemDef itemDef = ItemDef.forID(component.inv[k4] - 1);
  8051.                                 String s2 = itemDef.name;
  8052.                                 if (itemDef.stackable || component.invStackSizes[k4] != 1) {
  8053.                                     s2 = s2 + " x" + intToKOrMilLongName(component.invStackSizes[k4]);
  8054.                                 }
  8055.                                 int i9 = k2 + i6 * (115 + component.invSpritePadX);
  8056.                                 int k9 = l2 + j5 * (12 + component.invSpritePadY);
  8057.                                 if (component.aBoolean223) {
  8058.                                     textDrawingArea_1.method382(component.textColor, i9 + component.width / 2, s2, k9, component.aBoolean268);
  8059.                                 } else {
  8060.                                     textDrawingArea_1.method389(component.aBoolean268, i9, component.textColor, s2, k9);
  8061.                                 }
  8062.                             }
  8063.                             k4++;
  8064.                         }
  8065.  
  8066.                     }
  8067.  
  8068.                 } else if(component.type == 8) {
  8069.                    
  8070.                 }
  8071.             }
  8072.         }
  8073.  
  8074.         DrawingArea.setDrawingArea(l1, i1, k1, j1);
  8075.     }
  8076.  
  8077.     public void randomizeBackground(Background background) {
  8078.         int j = 256;
  8079.         for (int k = 0; k < anIntArray1190.length; k++) {
  8080.             anIntArray1190[k] = 0;
  8081.         }
  8082.  
  8083.         for (int l = 0; l < 5000; l++) {
  8084.             int i1 = (int) (Math.random() * 128D * (double) j);
  8085.             anIntArray1190[i1] = (int) (Math.random() * 256D);
  8086.         }
  8087.  
  8088.         for (int j1 = 0; j1 < 20; j1++) {
  8089.             for (int k1 = 1; k1 < j - 1; k1++) {
  8090.                 for (int i2 = 1; i2 < 127; i2++) {
  8091.                     int k2 = i2 + (k1 << 7);
  8092.                     anIntArray1191[k2] = (anIntArray1190[k2 - 1] + anIntArray1190[k2 + 1] + anIntArray1190[k2 - 128] + anIntArray1190[k2 + 128]) / 4;
  8093.                 }
  8094.  
  8095.             }
  8096.  
  8097.             int ai[] = anIntArray1190;
  8098.             anIntArray1190 = anIntArray1191;
  8099.             anIntArray1191 = ai;
  8100.         }
  8101.  
  8102.         if (background != null) {
  8103.             int l1 = 0;
  8104.             for (int j2 = 0; j2 < background.anInt1453; j2++) {
  8105.                 for (int l2 = 0; l2 < background.anInt1452; l2++) {
  8106.                     if (background.aByteArray1450[l1++] != 0) {
  8107.                         int i3 = l2 + 16 + background.anInt1454;
  8108.                         int j3 = j2 + 16 + background.anInt1455;
  8109.                         int k3 = i3 + (j3 << 7);
  8110.                         anIntArray1190[k3] = 0;
  8111.                     }
  8112.                 }
  8113.  
  8114.             }
  8115.  
  8116.         }
  8117.     }
  8118.  
  8119.     public void method107(int i, int j, Stream stream, Player player) {
  8120.         if ((i & 0x400) != 0) {
  8121.             player.anInt1543 = stream.method428();
  8122.             player.anInt1545 = stream.method428();
  8123.             player.anInt1544 = stream.method428();
  8124.             player.anInt1546 = stream.method428();
  8125.             player.anInt1547 = stream.method436() + loopCycle;
  8126.             player.anInt1548 = stream.method435() + loopCycle;
  8127.             player.anInt1549 = stream.method428();
  8128.             player.method446();
  8129.         }
  8130.         if ((i & 0x100) != 0) {
  8131.             player.anInt1520 = stream.method434();
  8132.             int k = stream.readDWord();
  8133.             player.anInt1524 = k >> 16;
  8134.             player.anInt1523 = loopCycle + (k & 0xffff);
  8135.             player.anInt1521 = 0;
  8136.             player.anInt1522 = 0;
  8137.             if (player.anInt1523 > loopCycle) {
  8138.                 player.anInt1521 = -1;
  8139.             }
  8140.             if (player.anInt1520 == 65535) {
  8141.                 player.anInt1520 = -1;
  8142.             }
  8143.             //processSound(player.anInt1520, 0, player, null);
  8144.         }
  8145.         if ((i & 8) != 0) {
  8146.             int l = stream.method434();
  8147.             if (l == 65535) {
  8148.                 l = -1;
  8149.             }
  8150.             //processSound(l, 1, player, null);
  8151.             int i2 = stream.method427();
  8152.             if (l == player.anim && l != -1) {
  8153.                 int i3 = Animation.anims[l].anInt365;
  8154.                 if (i3 == 1) {
  8155.                     player.anInt1527 = 0;
  8156.                     player.anInt1528 = 0;
  8157.                     player.anInt1529 = i2;
  8158.                     player.anInt1530 = 0;
  8159.                 }
  8160.                 if (i3 == 2) {
  8161.                     player.anInt1530 = 0;
  8162.                 }
  8163.             } else if (l == -1 || player.anim == -1 || Animation.anims[l].anInt359 >= Animation.anims[player.anim].anInt359) {
  8164.                 player.anim = l;
  8165.                 player.anInt1527 = 0;
  8166.                 player.anInt1528 = 0;
  8167.                 player.anInt1529 = i2;
  8168.                 player.anInt1530 = 0;
  8169.                 player.anInt1542 = player.smallXYIndex;
  8170.             }
  8171.         }
  8172.         if ((i & 4) != 0) {
  8173.             player.textSpoken = stream.readString();
  8174.             if (player.textSpoken.charAt(0) == '~') {
  8175.                 player.textSpoken = player.textSpoken.substring(1);
  8176.                 pushMessage(player.textSpoken, 2, player.name);
  8177.             } else if (player == myPlayer) {
  8178.                 pushMessage(player.textSpoken, 2, player.name);
  8179.             }
  8180.             player.anInt1513 = 0;
  8181.             player.anInt1531 = 0;
  8182.             player.textCycle = 150;
  8183.         }
  8184.         if ((i & 0x80) != 0) {
  8185.             int i1 = stream.method434();
  8186.             int j2 = stream.readUnsignedByte();
  8187.             int j3 = stream.method427();
  8188.             int k3 = stream.currentOffset;
  8189.             if (player.name != null && player.visible) {
  8190.                 long l3 = TextClass.longForName(player.name);
  8191.                 boolean flag = false;
  8192.                 if (j2 <= 1) {
  8193.                     for (int i4 = 0; i4 < ignoreCount; i4++) {
  8194.                         if (ignoreListAsLongs[i4] != l3) {
  8195.                             continue;
  8196.                         }
  8197.                         flag = true;
  8198.                         break;
  8199.                     }
  8200.  
  8201.                 }
  8202.                 if (!flag && anInt1251 == 0) {
  8203.                     try {
  8204.                         aStream_834.currentOffset = 0;
  8205.                         stream.method442(j3, 0, aStream_834.buffer);
  8206.                         aStream_834.currentOffset = 0;
  8207.                         String s = TextInput.method525(j3, aStream_834);
  8208.                         s = Censor.doCensor(s);
  8209.                         player.textSpoken = s;
  8210.                         player.anInt1513 = i1 >> 8;
  8211.                         player.privelage = j2;
  8212.  
  8213.                         // entityMessage(player);
  8214.  
  8215.                         player.anInt1531 = i1 & 0xff;
  8216.                         player.textCycle = 150;
  8217.                         if (j2 == 2 || j2 == 3) {
  8218.                             pushMessage(s, 1, "@cr2@" + player.name);
  8219.                         } else if (j2 == 1) {
  8220.                             pushMessage(s, 1, "@cr1@" + player.name);
  8221.                         } else {
  8222.                             pushMessage(s, 2, player.name);
  8223.                         }
  8224.                     } catch (Exception exception) {
  8225.                         Signlink.reporterror("cde2");
  8226.                     }
  8227.                 }
  8228.             }
  8229.             stream.currentOffset = k3 + j3;
  8230.         }
  8231.         if ((i & 1) != 0) {
  8232.             player.interactingEntity = stream.method434();
  8233.             if (player.interactingEntity == 65535) {
  8234.                 player.interactingEntity = -1;
  8235.             }
  8236.         }
  8237.         if ((i & 0x10) != 0) {
  8238.             int j1 = stream.method427();
  8239.             byte abyte0[] = new byte[j1];
  8240.             Stream stream_1 = new Stream(abyte0);
  8241.             stream.readBytes(j1, 0, abyte0);
  8242.             aStreamArray895s[j] = stream_1;
  8243.             player.updatePlayer(stream_1);
  8244.         }
  8245.         if ((i & 2) != 0) {
  8246.             player.anInt1538 = stream.method436();
  8247.             player.anInt1539 = stream.method434();
  8248.         }
  8249.         if ((i & 0x20) != 0) {
  8250.             int k1 = stream.readUnsignedByte();
  8251.             int k2 = stream.readUnsignedByteA();
  8252.             player.updateHitData(k2, k1, loopCycle);
  8253.             player.loopCycleStatus = loopCycle + 300;
  8254.             player.currentHealth = stream.method427();
  8255.             player.maxHealth = stream.readUnsignedByte();
  8256.         }
  8257.         if ((i & 0x200) != 0) {
  8258.             int l1 = stream.readUnsignedByte();
  8259.             int l2 = stream.method428();
  8260.             player.updateHitData(l2, l1, loopCycle);
  8261.             player.loopCycleStatus = loopCycle + 300;
  8262.             player.currentHealth = stream.readUnsignedByte();
  8263.             player.maxHealth = stream.method427();
  8264.         }
  8265.     }
  8266.  
  8267.     public void method108() {
  8268.         try {
  8269.             int j = myPlayer.x + anInt1278;
  8270.             int k = myPlayer.y + anInt1131;
  8271.             if (anInt1014 - j < -500 || anInt1014 - j > 500 || anInt1015 - k < -500 || anInt1015 - k > 500) {
  8272.                 anInt1014 = j;
  8273.                 anInt1015 = k;
  8274.             }
  8275.             if (anInt1014 != j) {
  8276.                 anInt1014 += (j - anInt1014) / 16;
  8277.             }
  8278.             if (anInt1015 != k) {
  8279.                 anInt1015 += (k - anInt1015) / 16;
  8280.             }
  8281.             if (super.keyArray[1] == 1) {
  8282.                 anInt1186 += (-24 - anInt1186) / 2;
  8283.             } else if (super.keyArray[2] == 1) {
  8284.                 anInt1186 += (24 - anInt1186) / 2;
  8285.             } else {
  8286.                 anInt1186 /= 2;
  8287.             }
  8288.             if (super.keyArray[3] == 1) {
  8289.                 anInt1187 += (12 - anInt1187) / 2;
  8290.             } else if (super.keyArray[4] == 1) {
  8291.                 anInt1187 += (-12 - anInt1187) / 2;
  8292.             } else {
  8293.                 anInt1187 /= 2;
  8294.             }
  8295.             minimapInt1 = minimapInt1 + anInt1186 / 2 & 0x7ff;
  8296.             anInt1184 += anInt1187 / 2;
  8297.             if (anInt1184 < 128) {
  8298.                 anInt1184 = 128;
  8299.             }
  8300.             if (anInt1184 > 383) {
  8301.                 anInt1184 = 383;
  8302.             }
  8303.             int l = anInt1014 >> 7;
  8304.             int i1 = anInt1015 >> 7;
  8305.             int j1 = method42(plane, anInt1015, anInt1014);
  8306.             int k1 = 0;
  8307.             if (l > 3 && i1 > 3 && l < 100 && i1 < 100) {
  8308.                 for (int l1 = l - 4; l1 <= l + 4; l1++) {
  8309.                     for (int k2 = i1 - 4; k2 <= i1 + 4; k2++) {
  8310.                         int l2 = plane;
  8311.                         if (l2 < 3 && (byteGroundArray[1][l1][k2] & 2) == 2) {
  8312.                             l2++;
  8313.                         }
  8314.                         int i3 = j1 - intGroundArray[l2][l1][k2];
  8315.                         if (i3 > k1) {
  8316.                             k1 = i3;
  8317.                         }
  8318.                     }
  8319.  
  8320.                 }
  8321.  
  8322.             }
  8323.             anInt1005++;
  8324.             if (anInt1005 > 1512) {
  8325.                 anInt1005 = 0;
  8326.                 stream.createFrame(77);
  8327.                 stream.writeWordBigEndian(0);
  8328.                 int i2 = stream.currentOffset;
  8329.                 stream.writeWordBigEndian((int) (Math.random() * 256D));
  8330.                 stream.writeWordBigEndian(101);
  8331.                 stream.writeWordBigEndian(233);
  8332.                 stream.writeWord(45092);
  8333.                 if ((int) (Math.random() * 2D) == 0) {
  8334.                     stream.writeWord(35784);
  8335.                 }
  8336.                 stream.writeWordBigEndian((int) (Math.random() * 256D));
  8337.                 stream.writeWordBigEndian(64);
  8338.                 stream.writeWordBigEndian(38);
  8339.                 stream.writeWord((int) (Math.random() * 65536D));
  8340.                 stream.writeWord((int) (Math.random() * 65536D));
  8341.                 stream.writeBytes(stream.currentOffset - i2);
  8342.             }
  8343.             int j2 = k1 * 192;
  8344.             if (j2 > 0x17f00) {
  8345.                 j2 = 0x17f00;
  8346.             }
  8347.             if (j2 < 32768) {
  8348.                 j2 = 32768;
  8349.             }
  8350.             if (j2 > anInt984) {
  8351.                 anInt984 += (j2 - anInt984) / 24;
  8352.                 return;
  8353.             }
  8354.             if (j2 < anInt984) {
  8355.                 anInt984 += (j2 - anInt984) / 80;
  8356.             }
  8357.         } catch (Exception _ex) {
  8358.             Signlink.reporterror("glfc_ex " + myPlayer.x + "," + myPlayer.y + "," + anInt1014 + "," + anInt1015 + "," + anInt1069 + "," + anInt1070 + "," + baseX + "," + baseY);
  8359.             throw new RuntimeException("eek");
  8360.         }
  8361.     }
  8362.  
  8363.     public void processDrawing() {
  8364.         if (rsAlreadyLoaded || loadingError || genericLoadingError) {
  8365.             showErrorScreen();
  8366.             return;
  8367.         }
  8368.         anInt1061++;
  8369.         if (!loggedIn) {
  8370.             drawLoginScreen(false);
  8371.         } else {
  8372.             drawGameScreen();
  8373.         }
  8374.         anInt1213 = 0;
  8375.     }
  8376.  
  8377.     public boolean isFriendOrSelf(String s) {
  8378.         if (s == null) {
  8379.             return false;
  8380.         }
  8381.         for (int i = 0; i < friendsCount; i++) {
  8382.             if (s.equalsIgnoreCase(friendsList[i])) {
  8383.                 return true;
  8384.             }
  8385.         }
  8386.         return s.equalsIgnoreCase(myPlayer.name);
  8387.     }
  8388.  
  8389.     public static String combatDiffColor(int i, int j) {
  8390.         int k = i - j;
  8391.         if (k < -9) {
  8392.             return "@red@";
  8393.         }
  8394.         if (k < -6) {
  8395.             return "@or3@";
  8396.         }
  8397.         if (k < -3) {
  8398.             return "@or2@";
  8399.         }
  8400.         if (k < 0) {
  8401.             return "@or1@";
  8402.         }
  8403.         if (k > 9) {
  8404.             return "@gre@";
  8405.         }
  8406.         if (k > 6) {
  8407.             return "@gr3@";
  8408.         }
  8409.         if (k > 3) {
  8410.             return "@gr2@";
  8411.         }
  8412.         if (k > 0) {
  8413.             return "@gr1@";
  8414.         } else {
  8415.             return "@yel@";
  8416.         }
  8417.     }
  8418.  
  8419.     public void setWaveVolume(int i) {
  8420.         Signlink.wavevol = i;
  8421.     }
  8422.  
  8423.     public void draw3dScreen() {
  8424.         drawSplitpublicChat();
  8425.         if (crossType == 1) {
  8426.             crosses[crossIndex / 100].drawSprite(crossX - 8 - 4, crossY - 8 - 4);
  8427.             anInt1142++;
  8428.             if (anInt1142 > 67) {
  8429.                 anInt1142 = 0;
  8430.                 stream.createFrame(78);
  8431.             }
  8432.         }
  8433.         if (crossType == 2) {
  8434.             crosses[4 + crossIndex / 100].drawSprite(crossX - 8 - 4, crossY - 8 - 4);
  8435.         }
  8436.         if (anInt1018 != -1) {
  8437.             method119(anInt945, anInt1018);
  8438.             drawInterface(0, 0, RSInterface.interfaceCache[anInt1018], 0);
  8439.         }
  8440.         if (openInterfaceID != -1) {
  8441.             method119(anInt945, openInterfaceID);
  8442.             drawInterface(0, 0, RSInterface.interfaceCache[openInterfaceID], 0);
  8443.         }
  8444.         method70();
  8445.         if (!menuOpen) {
  8446.             processRightClick();
  8447.             drawTooltip();
  8448.         } else if (menuScreenArea == 0) {
  8449.             drawMenu();
  8450.         }
  8451.         if (anInt1055 == 1) {
  8452.             multiOverlay.drawSprite(472, 296);
  8453.         }
  8454.         if (fpsOn) {
  8455.             char c = '\u01FB';
  8456.             int k = 20;
  8457.             int i1 = 0xffff00;
  8458.             if (super.fps < 15) {
  8459.                 i1 = 0xff0000;
  8460.             }
  8461.             aTextDrawingArea_1271.method380("Fps:" + super.fps, c, i1, k);
  8462.             k += 15;
  8463.             Runtime runtime = Runtime.getRuntime();
  8464.             int j1 = (int) ((runtime.totalMemory() - runtime.freeMemory()) / 1024L);
  8465.             i1 = 0xffff00;
  8466.             if (j1 > 0x2000000 && lowMem) {
  8467.                 i1 = 0xff0000;
  8468.             }
  8469.             aTextDrawingArea_1271.method380("Mem:" + j1 + "k", c, 0xffff00, k);
  8470.             k += 15;
  8471.         }
  8472.         if (anInt1104 != 0) {
  8473.             int j = anInt1104 / 50;
  8474.             int l = j / 60;
  8475.             j %= 60;
  8476.             if (j < 10) {
  8477.                 aTextDrawingArea_1271.method385(0xffff00, "System update in: " + l + ":0" + j, 329, 4);
  8478.             } else {
  8479.                 aTextDrawingArea_1271.method385(0xffff00, "System update in: " + l + ":" + j, 329, 4);
  8480.             }
  8481.             anInt849++;
  8482.             if (anInt849 > 75) {
  8483.                 anInt849 = 0;
  8484.                 stream.createFrame(148);
  8485.             }
  8486.         }
  8487.     }
  8488.  
  8489.     public void addIgnore(long l) {
  8490.         try {
  8491.             if (l == 0L) {
  8492.                 return;
  8493.             }
  8494.             if (ignoreCount >= 100) {
  8495.                 pushMessage("Your ignore list is full. Max of 100 hit", 0, "");
  8496.                 return;
  8497.             }
  8498.             String s = TextClass.fixName(TextClass.nameForLong(l));
  8499.             for (int j = 0; j < ignoreCount; j++) {
  8500.                 if (ignoreListAsLongs[j] == l) {
  8501.                     pushMessage(s + " is already on your ignore list", 0, "");
  8502.                     return;
  8503.                 }
  8504.             }
  8505.             for (int k = 0; k < friendsCount; k++) {
  8506.                 if (friendsListAsLongs[k] == l) {
  8507.                     pushMessage("Please remove " + s + " from your friend list first", 0, "");
  8508.                     return;
  8509.                 }
  8510.             }
  8511.  
  8512.             ignoreListAsLongs[ignoreCount++] = l;
  8513.             needDrawTabArea = true;
  8514.             stream.createFrame(133);
  8515.             stream.writeQWord(l);
  8516.             return;
  8517.         } catch (RuntimeException runtimeexception) {
  8518.             Signlink.reporterror("45688, " + l + ", " + 4 + ", " + runtimeexception.toString());
  8519.         }
  8520.         throw new RuntimeException();
  8521.     }
  8522.  
  8523.     public void method114() {
  8524.         for (int i = -1; i < playerCount; i++) {
  8525.             int j;
  8526.             if (i == -1) {
  8527.                 j = myPlayerIndex;
  8528.             } else {
  8529.                 j = playerIndices[i];
  8530.             }
  8531.             Player player = playerArray[j];
  8532.             if (player != null) {
  8533.                 method96(player);
  8534.             }
  8535.         }
  8536.  
  8537.     }
  8538.  
  8539.     public void method115() {
  8540.         if (loadingStage == 2) {
  8541.             for (Class30_Sub1 class30_sub1 = (Class30_Sub1) aClass19_1179.reverseGetFirst(); class30_sub1 != null; class30_sub1 = (Class30_Sub1) aClass19_1179.reverseGetNext()) {
  8542.                 if (class30_sub1.anInt1294 > 0) {
  8543.                     class30_sub1.anInt1294--;
  8544.                 }
  8545.                 if (class30_sub1.anInt1294 == 0) {
  8546.                     if (class30_sub1.anInt1299 < 0 || ObjectManager.method178(class30_sub1.anInt1299, class30_sub1.anInt1301)) {
  8547.                         method142(class30_sub1.anInt1298, class30_sub1.anInt1295, class30_sub1.anInt1300, class30_sub1.anInt1301, class30_sub1.anInt1297, class30_sub1.anInt1296, class30_sub1.anInt1299);
  8548.                         class30_sub1.unlink();
  8549.                     }
  8550.                 } else {
  8551.                     if (class30_sub1.anInt1302 > 0) {
  8552.                         class30_sub1.anInt1302--;
  8553.                     }
  8554.                     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))) {
  8555.                         method142(class30_sub1.anInt1298, class30_sub1.anInt1295, class30_sub1.anInt1292, class30_sub1.anInt1293, class30_sub1.anInt1297, class30_sub1.anInt1296, class30_sub1.anInt1291);
  8556.                         class30_sub1.anInt1302 = -1;
  8557.                         if (class30_sub1.anInt1291 == class30_sub1.anInt1299 && class30_sub1.anInt1299 == -1) {
  8558.                             class30_sub1.unlink();
  8559.                         } else if (class30_sub1.anInt1291 == class30_sub1.anInt1299 && class30_sub1.anInt1292 == class30_sub1.anInt1300 && class30_sub1.anInt1293 == class30_sub1.anInt1301) {
  8560.                             class30_sub1.unlink();
  8561.                         }
  8562.                     }
  8563.                 }
  8564.             }
  8565.  
  8566.         }
  8567.     }
  8568.  
  8569.     public void determineMenuSize() {
  8570.         int i = chatTextDrawingArea.getTextWidth("Choose Option");
  8571.         for (int j = 0; j < menuActionRow; j++) {
  8572.             int k = chatTextDrawingArea.getTextWidth(menuActionName[j]);
  8573.             if (k > i) {
  8574.                 i = k;
  8575.             }
  8576.         }
  8577.  
  8578.         i += 8;
  8579.         int l = 15 * menuActionRow + 21;
  8580.         if (super.saveClickX > 4 && super.saveClickY > 4 && super.saveClickX < 516 && super.saveClickY < 338) {
  8581.             int i1 = super.saveClickX - 4 - i / 2;
  8582.             if (i1 + i > 512) {
  8583.                 i1 = 512 - i;
  8584.             }
  8585.             if (i1 < 0) {
  8586.                 i1 = 0;
  8587.             }
  8588.             int l1 = super.saveClickY - 4;
  8589.             if (l1 + l > 334) {
  8590.                 l1 = 334 - l;
  8591.             }
  8592.             if (l1 < 0) {
  8593.                 l1 = 0;
  8594.             }
  8595.             menuOpen = true;
  8596.             menuScreenArea = 0;
  8597.             menuOffsetX = i1;
  8598.             menuOffsetY = l1;
  8599.             menuWidth = i;
  8600.             anInt952 = 15 * menuActionRow + 22;
  8601.         }
  8602.         if (super.saveClickX > 553 && super.saveClickY > 205 && super.saveClickX < 743 && super.saveClickY < 466) {
  8603.             int j1 = super.saveClickX - 553 - i / 2;
  8604.             if (j1 < 0) {
  8605.                 j1 = 0;
  8606.             } else if (j1 + i > 190) {
  8607.                 j1 = 190 - i;
  8608.             }
  8609.             int i2 = super.saveClickY - 205;
  8610.             if (i2 < 0) {
  8611.                 i2 = 0;
  8612.             } else if (i2 + l > 261) {
  8613.                 i2 = 261 - l;
  8614.             }
  8615.             menuOpen = true;
  8616.             menuScreenArea = 1;
  8617.             menuOffsetX = j1;
  8618.             menuOffsetY = i2;
  8619.             menuWidth = i;
  8620.             anInt952 = 15 * menuActionRow + 22;
  8621.         }
  8622.         if (super.saveClickX > 17 && super.saveClickY > 357 && super.saveClickX < 496 && super.saveClickY < 453) {
  8623.             int k1 = super.saveClickX - 17 - i / 2;
  8624.             if (k1 < 0) {
  8625.                 k1 = 0;
  8626.             } else if (k1 + i > 479) {
  8627.                 k1 = 479 - i;
  8628.             }
  8629.             int j2 = super.saveClickY - 357;
  8630.             if (j2 < 0) {
  8631.                 j2 = 0;
  8632.             } else if (j2 + l > 96) {
  8633.                 j2 = 96 - l;
  8634.             }
  8635.             menuOpen = true;
  8636.             menuScreenArea = 2;
  8637.             menuOffsetX = k1;
  8638.             menuOffsetY = j2;
  8639.             menuWidth = i;
  8640.             anInt952 = 15 * menuActionRow + 22;
  8641.         }
  8642.     }
  8643.  
  8644.     public void method117(Stream stream) {
  8645.         stream.initBitAccess();
  8646.         int j = stream.readBits(1);
  8647.         if (j == 0) {
  8648.             return;
  8649.         }
  8650.         int k = stream.readBits(2);
  8651.         if (k == 0) {
  8652.             anIntArray894[anInt893++] = myPlayerIndex;
  8653.             return;
  8654.         }
  8655.         if (k == 1) {
  8656.             int l = stream.readBits(3);
  8657.             myPlayer.moveInDir(false, l);
  8658.             int k1 = stream.readBits(1);
  8659.             if (k1 == 1) {
  8660.                 anIntArray894[anInt893++] = myPlayerIndex;
  8661.             }
  8662.             return;
  8663.         }
  8664.         if (k == 2) {
  8665.             int i1 = stream.readBits(3);
  8666.             myPlayer.moveInDir(true, i1);
  8667.             int l1 = stream.readBits(3);
  8668.             myPlayer.moveInDir(true, l1);
  8669.             int j2 = stream.readBits(1);
  8670.             if (j2 == 1) {
  8671.                 anIntArray894[anInt893++] = myPlayerIndex;
  8672.             }
  8673.             return;
  8674.         }
  8675.         if (k == 3) {
  8676.             plane = stream.readBits(2);
  8677.             int j1 = stream.readBits(1);
  8678.             int i2 = stream.readBits(1);
  8679.             if (i2 == 1) {
  8680.                 anIntArray894[anInt893++] = myPlayerIndex;
  8681.             }
  8682.             int k2 = stream.readBits(7);
  8683.             int l2 = stream.readBits(7);
  8684.             myPlayer.setPos(l2, k2, j1 == 1);
  8685.         }
  8686.     }
  8687.  
  8688.     public void nullLoader() {
  8689.         aBoolean831 = false;
  8690.         while (drawingFlames) {
  8691.             aBoolean831 = false;
  8692.             try {
  8693.                 Thread.sleep(50L);
  8694.             } catch (Exception _ex) {
  8695.             }
  8696.         }
  8697.         aBackground_966 = null;
  8698.         aBackground_967 = null;
  8699.         aBackgroundArray1152s = null;
  8700.         anIntArray850 = null;
  8701.         anIntArray851 = null;
  8702.         anIntArray852 = null;
  8703.         anIntArray853 = null;
  8704.         anIntArray1190 = null;
  8705.         anIntArray1191 = null;
  8706.         anIntArray828 = null;
  8707.         anIntArray829 = null;
  8708.         aClass30_Sub2_Sub1_Sub1_1201 = null;
  8709.         aClass30_Sub2_Sub1_Sub1_1202 = null;
  8710.     }
  8711.  
  8712.     public boolean method119(int i, int j) {
  8713.         boolean flag1 = false;
  8714.         RSInterface class9 = RSInterface.interfaceCache[j];
  8715.         for (int element : class9.children) {
  8716.             if (element == -1) {
  8717.                 break;
  8718.             }
  8719.             RSInterface class9_1 = RSInterface.interfaceCache[element];
  8720.             if (class9_1.type == 1) {
  8721.                 flag1 |= method119(i, class9_1.id);
  8722.             }
  8723.             if (class9_1.type == 6 && (class9_1.anInt257 != -1 || class9_1.anInt258 != -1)) {
  8724.                 boolean flag2 = interfaceIsSelected(class9_1);
  8725.                 int l;
  8726.                 if (flag2) {
  8727.                     l = class9_1.anInt258;
  8728.                 } else {
  8729.                     l = class9_1.anInt257;
  8730.                 }
  8731.                 if (l != -1) {
  8732.                     Animation animation = Animation.anims[l];
  8733.                     for (class9_1.anInt208 += i; class9_1.anInt208 > animation.method258(class9_1.anInt246);) {
  8734.                         class9_1.anInt208 -= animation.method258(class9_1.anInt246) + 1;
  8735.                         class9_1.anInt246++;
  8736.                         if (class9_1.anInt246 >= animation.anInt352) {
  8737.                             class9_1.anInt246 -= animation.anInt356;
  8738.                             if (class9_1.anInt246 < 0 || class9_1.anInt246 >= animation.anInt352) {
  8739.                                 class9_1.anInt246 = 0;
  8740.                             }
  8741.                         }
  8742.                         flag1 = true;
  8743.                     }
  8744.  
  8745.                 }
  8746.             }
  8747.         }
  8748.  
  8749.         return flag1;
  8750.     }
  8751.  
  8752.     public int method120() {
  8753.         int j = 3;
  8754.         if (yCameraCurve < 310) {
  8755.             int k = xCameraPos >> 7;
  8756.             int l = yCameraPos >> 7;
  8757.             int i1 = myPlayer.x >> 7;
  8758.             int j1 = myPlayer.y >> 7;
  8759.             if ((byteGroundArray[plane][k][l] & 4) != 0) {
  8760.                 j = plane;
  8761.             }
  8762.             int k1;
  8763.             if (i1 > k) {
  8764.                 k1 = i1 - k;
  8765.             } else {
  8766.                 k1 = k - i1;
  8767.             }
  8768.             int l1;
  8769.             if (j1 > l) {
  8770.                 l1 = j1 - l;
  8771.             } else {
  8772.                 l1 = l - j1;
  8773.             }
  8774.             if (k1 > l1) {
  8775.                 int i2 = l1 * 0x10000 / k1;
  8776.                 int k2 = 32768;
  8777.                 while (k != i1) {
  8778.                     if (k < i1) {
  8779.                         k++;
  8780.                     } else if (k > i1) {
  8781.                         k--;
  8782.                     }
  8783.                     if ((byteGroundArray[plane][k][l] & 4) != 0) {
  8784.                         j = plane;
  8785.                     }
  8786.                     k2 += i2;
  8787.                     if (k2 >= 0x10000) {
  8788.                         k2 -= 0x10000;
  8789.                         if (l < j1) {
  8790.                             l++;
  8791.                         } else if (l > j1) {
  8792.                             l--;
  8793.                         }
  8794.                         if ((byteGroundArray[plane][k][l] & 4) != 0) {
  8795.                             j = plane;
  8796.                         }
  8797.                     }
  8798.                 }
  8799.             } else {
  8800.                 int j2 = k1 * 0x10000 / l1;
  8801.                 int l2 = 32768;
  8802.                 while (l != j1) {
  8803.                     if (l < j1) {
  8804.                         l++;
  8805.                     } else if (l > j1) {
  8806.                         l--;
  8807.                     }
  8808.                     if ((byteGroundArray[plane][k][l] & 4) != 0) {
  8809.                         j = plane;
  8810.                     }
  8811.                     l2 += j2;
  8812.                     if (l2 >= 0x10000) {
  8813.                         l2 -= 0x10000;
  8814.                         if (k < i1) {
  8815.                             k++;
  8816.                         } else if (k > i1) {
  8817.                             k--;
  8818.                         }
  8819.                         if ((byteGroundArray[plane][k][l] & 4) != 0) {
  8820.                             j = plane;
  8821.                         }
  8822.                     }
  8823.                 }
  8824.             }
  8825.         }
  8826.         if ((byteGroundArray[plane][myPlayer.x >> 7][myPlayer.y >> 7] & 4) != 0) {
  8827.             j = plane;
  8828.         }
  8829.         return j;
  8830.     }
  8831.  
  8832.     public int method121() {
  8833.         int j = method42(plane, yCameraPos, xCameraPos);
  8834.         if (j - zCameraPos < 800 && (byteGroundArray[plane][xCameraPos >> 7][yCameraPos >> 7] & 4) != 0) {
  8835.             return plane;
  8836.         } else {
  8837.             return 3;
  8838.         }
  8839.     }
  8840.  
  8841.     public void delIgnore(long l) {
  8842.         try {
  8843.             if (l == 0L) {
  8844.                 return;
  8845.             }
  8846.             for (int j = 0; j < ignoreCount; j++) {
  8847.                 if (ignoreListAsLongs[j] == l) {
  8848.                     ignoreCount--;
  8849.                     needDrawTabArea = true;
  8850.                     System.arraycopy(ignoreListAsLongs, j + 1, ignoreListAsLongs, j, ignoreCount - j);
  8851.  
  8852.                     stream.createFrame(74);
  8853.                     stream.writeQWord(l);
  8854.                     return;
  8855.                 }
  8856.             }
  8857.  
  8858.             return;
  8859.         } catch (RuntimeException runtimeexception) {
  8860.             Signlink.reporterror("47229, " + 3 + ", " + l + ", " + runtimeexception.toString());
  8861.         }
  8862.         throw new RuntimeException();
  8863.     }
  8864.  
  8865.     public String getParameter(String s) {
  8866.         if (Signlink.mainapp != null) {
  8867.             return Signlink.mainapp.getParameter(s);
  8868.         } else {
  8869.             return super.getParameter(s);
  8870.         }
  8871.     }
  8872.  
  8873.     public int extractInterfaceValues(RSInterface class9, int j) {
  8874.         if (class9.valueIndexArray == null || j >= class9.valueIndexArray.length) {
  8875.             return -2;
  8876.         }
  8877.         try {
  8878.             int ai[] = class9.valueIndexArray[j];
  8879.             int k = 0;
  8880.             int l = 0;
  8881.             int i1 = 0;
  8882.             do {
  8883.                 int j1 = ai[l++];
  8884.                 int k1 = 0;
  8885.                 byte byte0 = 0;
  8886.                 if (j1 == 0) {
  8887.                     return k;
  8888.                 }
  8889.                 if (j1 == 1) {
  8890.                     k1 = currentStats[ai[l++]];
  8891.                 }
  8892.                 if (j1 == 2) {
  8893.                     k1 = maxStats[ai[l++]];
  8894.                 }
  8895.                 if (j1 == 3) {
  8896.                     k1 = currentExp[ai[l++]];
  8897.                 }
  8898.                 if (j1 == 4) {
  8899.                     RSInterface class9_1 = RSInterface.interfaceCache[ai[l++]];
  8900.                     int k2 = ai[l++];
  8901.                     if (k2 >= 0 && k2 < ItemDef.totalItems && (!ItemDef.forID(k2).membersObject || isMembers)) {
  8902.                         for (int j3 = 0; j3 < class9_1.inv.length; j3++) {
  8903.                             if (class9_1.inv[j3] == k2 + 1) {
  8904.                                 k1 += class9_1.invStackSizes[j3];
  8905.                             }
  8906.                         }
  8907.  
  8908.                     }
  8909.                 }
  8910.                 if (j1 == 5) {
  8911.                     k1 = variousSettings[ai[l++]];
  8912.                 }
  8913.                 if (j1 == 6) {
  8914.                     k1 = anIntArray1019[maxStats[ai[l++]] - 1];
  8915.                 }
  8916.                 if (j1 == 7) {
  8917.                     k1 = variousSettings[ai[l++]] * 100 / 46875;
  8918.                 }
  8919.                 if (j1 == 8) {
  8920.                     k1 = myPlayer.combatLevel;
  8921.                 }
  8922.                 if (j1 == 9) {
  8923.                     for (int l1 = 0; l1 < Skills.skillsCount; l1++) {
  8924.                         if (Skills.skillEnabled[l1]) {
  8925.                             k1 += maxStats[l1];
  8926.                         }
  8927.                     }
  8928.  
  8929.                 }
  8930.                 if (j1 == 10) {
  8931.                     RSInterface class9_2 = RSInterface.interfaceCache[ai[l++]];
  8932.                     int l2 = ai[l++] + 1;
  8933.                     if (l2 >= 0 && l2 < ItemDef.totalItems && (!ItemDef.forID(l2).membersObject || isMembers)) {
  8934.                         for (int element : class9_2.inv) {
  8935.                             if (element != l2) {
  8936.                                 continue;
  8937.                             }
  8938.                             k1 = 0x3b9ac9ff;
  8939.                             break;
  8940.                         }
  8941.  
  8942.                     }
  8943.                 }
  8944.                 if (j1 == 11) {
  8945.                     k1 = energy;
  8946.                 }
  8947.                 if (j1 == 12) {
  8948.                     k1 = weight;
  8949.                 }
  8950.                 if (j1 == 13) {
  8951.                     int i2 = variousSettings[ai[l++]];
  8952.                     int i3 = ai[l++];
  8953.                     k1 = (i2 & 1 << i3) == 0 ? 0 : 1;
  8954.                 }
  8955.                 if (j1 == 14) {
  8956.                     int j2 = ai[l++];
  8957.                     VarBit varBit = VarBit.cache[j2];
  8958.                     int l3 = varBit.anInt648;
  8959.                     int i4 = varBit.anInt649;
  8960.                     int j4 = varBit.anInt650;
  8961.                     int k4 = anIntArray1232[j4 - i4];
  8962.                     k1 = variousSettings[l3] >> i4 & k4;
  8963.                 }
  8964.                 if (j1 == 15) {
  8965.                     byte0 = 1;
  8966.                 }
  8967.                 if (j1 == 16) {
  8968.                     byte0 = 2;
  8969.                 }
  8970.                 if (j1 == 17) {
  8971.                     byte0 = 3;
  8972.                 }
  8973.                 if (j1 == 18) {
  8974.                     k1 = (myPlayer.x >> 7) + baseX;
  8975.                 }
  8976.                 if (j1 == 19) {
  8977.                     k1 = (myPlayer.y >> 7) + baseY;
  8978.                 }
  8979.                 if (j1 == 20) {
  8980.                     k1 = ai[l++];
  8981.                 }
  8982.                 if (byte0 == 0) {
  8983.                     if (i1 == 0) {
  8984.                         k += k1;
  8985.                     }
  8986.                     if (i1 == 1) {
  8987.                         k -= k1;
  8988.                     }
  8989.                     if (i1 == 2 && k1 != 0) {
  8990.                         k /= k1;
  8991.                     }
  8992.                     if (i1 == 3) {
  8993.                         k *= k1;
  8994.                     }
  8995.                     i1 = 0;
  8996.                 } else {
  8997.                     i1 = byte0;
  8998.                 }
  8999.             } while (true);
  9000.         } catch (Exception _ex) {
  9001.             return -1;
  9002.         }
  9003.     }
  9004.  
  9005.     public void drawTooltip() {
  9006.         if (menuActionRow < 2 && itemSelected == 0 && spellSelected == 0) {
  9007.             return;
  9008.         }
  9009.         String s;
  9010.         if (itemSelected == 1 && menuActionRow < 2) {
  9011.             s = "Use " + selectedItemName + " with...";
  9012.         } else if (spellSelected == 1 && menuActionRow < 2) {
  9013.             s = spellTooltip + "...";
  9014.         } else {
  9015.             s = menuActionName[menuActionRow - 1];
  9016.         }
  9017.         if (menuActionRow > 2) {
  9018.             s = s + "@whi@ / " + (menuActionRow - 2) + " more options";
  9019.         }
  9020.         chatTextDrawingArea.method390(4, 0xffffff, s, loopCycle / 1000, 15);
  9021.     }
  9022.  
  9023.     public void drawMinimap() {
  9024.         aRSImageProducer_1164.initDrawingArea();
  9025.         if (anInt1021 == 2) {
  9026.             byte abyte0[] = mapBack.aByteArray1450;
  9027.             int ai[] = DrawingArea.pixels;
  9028.             int k2 = abyte0.length;
  9029.             for (int i5 = 0; i5 < k2; i5++) {
  9030.                 if (abyte0[i5] == 0) {
  9031.                     ai[i5] = 0;
  9032.                 }
  9033.             }
  9034.  
  9035.             compass.method352(33, minimapInt1, anIntArray1057, 256, anIntArray968, 25, 0, 0, 33, 25);
  9036.             aRSImageProducer_1165.initDrawingArea();
  9037.             Texture.lineOffsets = chatBoxAreaOffsets;
  9038.             return;
  9039.         }
  9040.         int i = minimapInt1 + minimapInt2 & 0x7ff;
  9041.         int j = 48 + myPlayer.x / 32;
  9042.         int l2 = 464 - myPlayer.y / 32;
  9043.         aClass30_Sub2_Sub1_Sub1_1263.method352(151, i, anIntArray1229, 256 + minimapInt3, anIntArray1052, l2, 5, 25, 146, j);
  9044.         compass.method352(33, minimapInt1, anIntArray1057, 256, anIntArray968, 25, 0, 0, 33, 25);
  9045.         for (int j5 = 0; j5 < anInt1071; j5++) {
  9046.             int k = anIntArray1072[j5] * 4 + 2 - myPlayer.x / 32;
  9047.             int i3 = anIntArray1073[j5] * 4 + 2 - myPlayer.y / 32;
  9048.             markMinimap(aClass30_Sub2_Sub1_Sub1Array1140[j5], k, i3);
  9049.         }
  9050.  
  9051.         for (int k5 = 0; k5 < 104; k5++) {
  9052.             for (int l5 = 0; l5 < 104; l5++) {
  9053.                 NodeList class19 = groundArray[plane][k5][l5];
  9054.                 if (class19 != null) {
  9055.                     int l = k5 * 4 + 2 - myPlayer.x / 32;
  9056.                     int j3 = l5 * 4 + 2 - myPlayer.y / 32;
  9057.                     markMinimap(mapDotItem, l, j3);
  9058.                 }
  9059.             }
  9060.  
  9061.         }
  9062.  
  9063.         for (int i6 = 0; i6 < npcCount; i6++) {
  9064.             NPC npc = npcArray[npcIndices[i6]];
  9065.             if (npc != null && npc.isVisible()) {
  9066.                 EntityDef entityDef = npc.desc;
  9067.                 if (entityDef.childrenIDs != null) {
  9068.                     entityDef = entityDef.method161();
  9069.                 }
  9070.                 if (entityDef != null && entityDef.aBoolean87 && entityDef.aBoolean84) {
  9071.                     int i1 = npc.x / 32 - myPlayer.x / 32;
  9072.                     int k3 = npc.y / 32 - myPlayer.y / 32;
  9073.                     markMinimap(mapDotNPC, i1, k3);
  9074.                 }
  9075.             }
  9076.         }
  9077.  
  9078.         for (int j6 = 0; j6 < playerCount; j6++) {
  9079.             Player player = playerArray[playerIndices[j6]];
  9080.             if (player != null && player.isVisible()) {
  9081.                 int j1 = player.x / 32 - myPlayer.x / 32;
  9082.                 int l3 = player.y / 32 - myPlayer.y / 32;
  9083.                 boolean flag1 = false;
  9084.                 long l6 = TextClass.longForName(player.name);
  9085.                 for (int k6 = 0; k6 < friendsCount; k6++) {
  9086.                     if (l6 != friendsListAsLongs[k6] || friendsNodeIDs[k6] == 0) {
  9087.                         continue;
  9088.                     }
  9089.                     flag1 = true;
  9090.                     break;
  9091.                 }
  9092.  
  9093.                 boolean flag2 = false;
  9094.                 if (myPlayer.team != 0 && player.team != 0 && myPlayer.team == player.team) {
  9095.                     flag2 = true;
  9096.                 }
  9097.                 if (flag1) {
  9098.                     markMinimap(mapDotFriend, j1, l3);
  9099.                 } else if (flag2) {
  9100.                     markMinimap(mapDotTeam, j1, l3);
  9101.                 } else {
  9102.                     markMinimap(mapDotPlayer, j1, l3);
  9103.                 }
  9104.             }
  9105.         }
  9106.  
  9107.         if (anInt855 != 0 && loopCycle % 20 < 10) {
  9108.             if (anInt855 == 1 && anInt1222 >= 0 && anInt1222 < npcArray.length) {
  9109.                 NPC class30_sub2_sub4_sub1_sub1_1 = npcArray[anInt1222];
  9110.                 if (class30_sub2_sub4_sub1_sub1_1 != null) {
  9111.                     int k1 = class30_sub2_sub4_sub1_sub1_1.x / 32 - myPlayer.x / 32;
  9112.                     int i4 = class30_sub2_sub4_sub1_sub1_1.y / 32 - myPlayer.y / 32;
  9113.                     method81(mapMarker, i4, k1);
  9114.                 }
  9115.             }
  9116.             if (anInt855 == 2) {
  9117.                 int l1 = (anInt934 - baseX) * 4 + 2 - myPlayer.x / 32;
  9118.                 int j4 = (anInt935 - baseY) * 4 + 2 - myPlayer.y / 32;
  9119.                 method81(mapMarker, j4, l1);
  9120.             }
  9121.             if (anInt855 == 10 && anInt933 >= 0 && anInt933 < playerArray.length) {
  9122.                 Player class30_sub2_sub4_sub1_sub2_1 = playerArray[anInt933];
  9123.                 if (class30_sub2_sub4_sub1_sub2_1 != null) {
  9124.                     int i2 = class30_sub2_sub4_sub1_sub2_1.x / 32 - myPlayer.x / 32;
  9125.                     int k4 = class30_sub2_sub4_sub1_sub2_1.y / 32 - myPlayer.y / 32;
  9126.                     method81(mapMarker, k4, i2);
  9127.                 }
  9128.             }
  9129.         }
  9130.         if (destX != 0) {
  9131.             int j2 = destX * 4 + 2 - myPlayer.x / 32;
  9132.             int l4 = destY * 4 + 2 - myPlayer.y / 32;
  9133.             markMinimap(mapFlag, j2, l4);
  9134.         }
  9135.         DrawingArea.method336(3, 78, 0xffffff, 3, 97);
  9136.         aRSImageProducer_1165.initDrawingArea();
  9137.         Texture.lineOffsets = chatBoxAreaOffsets;
  9138.     }
  9139.  
  9140.     public void npcScreenPos(Entity entity, int i) {
  9141.         calcEntityScreenPos(entity.x, i, entity.y);
  9142.  
  9143.         // aryan entity.entScreenX = spriteDrawX; entity.entScreenY =
  9144.         // spriteDrawY;
  9145.     }
  9146.  
  9147.     public void calcEntityScreenPos(int i, int j, int l) {
  9148.         if (i < 128 || l < 128 || i > 13056 || l > 13056) {
  9149.             spriteDrawX = -1;
  9150.             spriteDrawY = -1;
  9151.             return;
  9152.         }
  9153.         int i1 = method42(plane, l, i) - j;
  9154.         i -= xCameraPos;
  9155.         i1 -= zCameraPos;
  9156.         l -= yCameraPos;
  9157.         int j1 = Model.modelIntArray1[yCameraCurve];
  9158.         int k1 = Model.modelIntArray2[yCameraCurve];
  9159.         int l1 = Model.modelIntArray1[xCameraCurve];
  9160.         int i2 = Model.modelIntArray2[xCameraCurve];
  9161.         int j2 = l * l1 + i * i2 >> 16;
  9162.         l = l * i2 - i * l1 >> 16;
  9163.         i = j2;
  9164.         j2 = i1 * k1 - l * j1 >> 16;
  9165.         l = i1 * j1 + l * k1 >> 16;
  9166.         i1 = j2;
  9167.         if (l >= 50) {
  9168.             spriteDrawX = Texture.textureInt1 + (i << 9) / l;
  9169.             spriteDrawY = Texture.textureInt2 + (i1 << 9) / l;
  9170.         } else {
  9171.             spriteDrawX = -1;
  9172.             spriteDrawY = -1;
  9173.         }
  9174.     }
  9175.  
  9176.     public void buildSplitPrivateChatMenu() {
  9177.         if (splitpublicChat == 0) {
  9178.             return;
  9179.         }
  9180.         int i = 0;
  9181.         if (anInt1104 != 0) {
  9182.             i = 1;
  9183.         }
  9184.         for (int j = 0; j < 100; j++) {
  9185.             if (chatMessages[j] != null) {
  9186.                 int k = chatTypes[j];
  9187.                 String s = chatNames[j];
  9188.                 if (s != null && s.startsWith("@cr1@")) {
  9189.                     s = s.substring(5);
  9190.                 }
  9191.                 if (s != null && s.startsWith("@cr2@")) {
  9192.                     s = s.substring(5);
  9193.                 }
  9194.                 if ((k == 3 || k == 7) && (k == 7 || privateChatMode == 0 || privateChatMode == 1 && isFriendOrSelf(s))) {
  9195.                     int l = 329 - i * 13;
  9196.                     if (super.mouseX > 4 && super.mouseY - 4 > l - 10 && super.mouseY - 4 <= l + 3) {
  9197.                         int i1 = aTextDrawingArea_1271.getTextWidth("From:  " + s + chatMessages[j]) + 25;
  9198.                         if (i1 > 450) {
  9199.                             i1 = 450;
  9200.                         }
  9201.                         if (super.mouseX < 4 + i1) {
  9202.                             if (myPrivilege >= 1 && myPrivilege <= 3) {
  9203.                                 menuActionName[menuActionRow] = "Report abuse @whi@" + s;
  9204.                                 menuActionID[menuActionRow] = 2606;
  9205.                                 menuActionRow++;
  9206.                             }
  9207.                             menuActionName[menuActionRow] = "Add ignore @whi@" + s;
  9208.                             menuActionID[menuActionRow] = 2042;
  9209.                             menuActionRow++;
  9210.                             menuActionName[menuActionRow] = "Reply to @whi@" + s;
  9211.                             menuActionID[menuActionRow] = 2639;
  9212.                             menuActionRow++;
  9213.                             menuActionName[menuActionRow] = "Add friend @whi@" + s;
  9214.                             menuActionID[menuActionRow] = 2337;
  9215.                             menuActionRow++;
  9216.                         }
  9217.                     }
  9218.                     if (++i >= 5) {
  9219.                         return;
  9220.                     }
  9221.                 }
  9222.                 if ((k == 5 || k == 6) && privateChatMode < 2 && ++i >= 5) {
  9223.                     return;
  9224.                 }
  9225.             }
  9226.         }
  9227.  
  9228.     }
  9229.  
  9230.     public void method130(int j, int k, int l, int i1, int j1, int k1, int l1, int i2, int j2) {
  9231.         Class30_Sub1 class30_sub1 = null;
  9232.         for (Class30_Sub1 class30_sub1_1 = (Class30_Sub1) aClass19_1179.reverseGetFirst(); class30_sub1_1 != null; class30_sub1_1 = (Class30_Sub1) aClass19_1179.reverseGetNext()) {
  9233.             if (class30_sub1_1.anInt1295 != l1 || class30_sub1_1.anInt1297 != i2 || class30_sub1_1.anInt1298 != j1 || class30_sub1_1.anInt1296 != i1) {
  9234.                 continue;
  9235.             }
  9236.             class30_sub1 = class30_sub1_1;
  9237.             break;
  9238.         }
  9239.  
  9240.         if (class30_sub1 == null) {
  9241.             class30_sub1 = new Class30_Sub1();
  9242.             class30_sub1.anInt1295 = l1;
  9243.             class30_sub1.anInt1296 = i1;
  9244.             class30_sub1.anInt1297 = i2;
  9245.             class30_sub1.anInt1298 = j1;
  9246.             method89(class30_sub1);
  9247.             aClass19_1179.insertHead(class30_sub1);
  9248.         }
  9249.         class30_sub1.anInt1291 = k;
  9250.         class30_sub1.anInt1293 = k1;
  9251.         class30_sub1.anInt1292 = l;
  9252.         class30_sub1.anInt1302 = j2;
  9253.         class30_sub1.anInt1294 = j;
  9254.     }
  9255.  
  9256.     public boolean interfaceIsSelected(RSInterface class9) {
  9257.         if (class9.anIntArray245 == null) {
  9258.             return false;
  9259.         }
  9260.         for (int i = 0; i < class9.anIntArray245.length; i++) {
  9261.             int j = extractInterfaceValues(class9, i);
  9262.             int k = class9.anIntArray212[i];
  9263.             if (class9.anIntArray245[i] == 2) {
  9264.                 if (j >= k) {
  9265.                     return false;
  9266.                 }
  9267.             } else if (class9.anIntArray245[i] == 3) {
  9268.                 if (j <= k) {
  9269.                     return false;
  9270.                 }
  9271.             } else if (class9.anIntArray245[i] == 4) {
  9272.                 if (j == k) {
  9273.                     return false;
  9274.                 }
  9275.             } else if (j != k) {
  9276.                 return false;
  9277.             }
  9278.         }
  9279.  
  9280.         return true;
  9281.     }
  9282.  
  9283.     public DataInputStream openJagGrabInputStream(String s) throws IOException {
  9284.         // if(!aBoolean872)
  9285.         // if(signlink.mainapp != null)
  9286.         // return signlink.openurl(s);
  9287.         // else
  9288.         // return new DataInputStream((new URL(getCodeBase(), s)).openStream());
  9289.         if (aSocket832 != null) {
  9290.             try {
  9291.                 aSocket832.close();
  9292.             } catch (Exception _ex) {
  9293.             }
  9294.             aSocket832 = null;
  9295.         }
  9296.         aSocket832 = openSocket(43595);
  9297.         aSocket832.setSoTimeout(10000);
  9298.         java.io.InputStream inputstream = aSocket832.getInputStream();
  9299.         OutputStream outputstream = aSocket832.getOutputStream();
  9300.         outputstream.write(("JAGGRAB /" + s + "\n\n").getBytes());
  9301.         return new DataInputStream(inputstream);
  9302.     }
  9303.    
  9304.     public void doFlamesDrawing() {
  9305.         char c = '\u0100';
  9306.         if (anInt1040 > 0) {
  9307.             for (int i = 0; i < 256; i++) {
  9308.                 if (anInt1040 > 768) {
  9309.                     anIntArray850[i] = method83(anIntArray851[i], anIntArray852[i], 1024 - anInt1040);
  9310.                 } else if (anInt1040 > 256) {
  9311.                     anIntArray850[i] = anIntArray852[i];
  9312.                 } else {
  9313.                     anIntArray850[i] = method83(anIntArray852[i], anIntArray851[i], 256 - anInt1040);
  9314.                 }
  9315.             }
  9316.  
  9317.         } else if (anInt1041 > 0) {
  9318.             for (int j = 0; j < 256; j++) {
  9319.                 if (anInt1041 > 768) {
  9320.                     anIntArray850[j] = method83(anIntArray851[j], anIntArray853[j], 1024 - anInt1041);
  9321.                 } else if (anInt1041 > 256) {
  9322.                     anIntArray850[j] = anIntArray853[j];
  9323.                 } else {
  9324.                     anIntArray850[j] = method83(anIntArray853[j], anIntArray851[j], 256 - anInt1041);
  9325.                 }
  9326.             }
  9327.  
  9328.         } else {
  9329.             System.arraycopy(anIntArray851, 0, anIntArray850, 0, 256);
  9330.  
  9331.         }
  9332.         System.arraycopy(aClass30_Sub2_Sub1_Sub1_1201.pixels, 0, aRSImageProducer_1110.anIntArray315, 0, 33920);
  9333.  
  9334.         int i1 = 0;
  9335.         int j1 = 1152;
  9336.         for (int k1 = 1; k1 < c - 1; k1++) {
  9337.             int l1 = anIntArray969[k1] * (c - k1) / c;
  9338.             int j2 = 22 + l1;
  9339.             if (j2 < 0) {
  9340.                 j2 = 0;
  9341.             }
  9342.             i1 += j2;
  9343.             for (int l2 = j2; l2 < 128; l2++) {
  9344.                 int j3 = anIntArray828[i1++];
  9345.                 if (j3 != 0) {
  9346.                     int l3 = j3;
  9347.                     int j4 = 256 - j3;
  9348.                     j3 = anIntArray850[j3];
  9349.                     int l4 = aRSImageProducer_1110.anIntArray315[j1];
  9350.                     aRSImageProducer_1110.anIntArray315[j1++] = ((j3 & 0xff00ff) * l3 + (l4 & 0xff00ff) * j4 & 0xff00ff00) + ((j3 & 0xff00) * l3 + (l4 & 0xff00) * j4 & 0xff0000) >> 8;
  9351.                 } else {
  9352.                     j1++;
  9353.                 }
  9354.             }
  9355.  
  9356.             j1 += j2;
  9357.         }
  9358.  
  9359.         aRSImageProducer_1110.drawGraphics(0, super.graphics, 0);
  9360.         System.arraycopy(aClass30_Sub2_Sub1_Sub1_1202.pixels, 0, aRSImageProducer_1111.anIntArray315, 0, 33920);
  9361.  
  9362.         i1 = 0;
  9363.         j1 = 1176;
  9364.         for (int k2 = 1; k2 < c - 1; k2++) {
  9365.             int i3 = anIntArray969[k2] * (c - k2) / c;
  9366.             int k3 = 103 - i3;
  9367.             j1 += i3;
  9368.             for (int i4 = 0; i4 < k3; i4++) {
  9369.                 int k4 = anIntArray828[i1++];
  9370.                 if (k4 != 0) {
  9371.                     int i5 = k4;
  9372.                     int j5 = 256 - k4;
  9373.                     k4 = anIntArray850[k4];
  9374.                     int k5 = aRSImageProducer_1111.anIntArray315[j1];
  9375.                     aRSImageProducer_1111.anIntArray315[j1++] = ((k4 & 0xff00ff) * i5 + (k5 & 0xff00ff) * j5 & 0xff00ff00) + ((k4 & 0xff00) * i5 + (k5 & 0xff00) * j5 & 0xff0000) >> 8;
  9376.                 } else {
  9377.                     j1++;
  9378.                 }
  9379.             }
  9380.  
  9381.             i1 += 128 - k3;
  9382.             j1 += 128 - k3 - i3;
  9383.         }
  9384.  
  9385.         aRSImageProducer_1111.drawGraphics(0, super.graphics, 637);
  9386.     }
  9387.  
  9388.     public void method134(Stream stream) {
  9389.         int j = stream.readBits(8);
  9390.         if (j < playerCount) {
  9391.             for (int k = j; k < playerCount; k++) {
  9392.                 anIntArray840[anInt839++] = playerIndices[k];
  9393.             }
  9394.  
  9395.         }
  9396.         if (j > playerCount) {
  9397.             Signlink.reporterror(myUsername + " Too many players");
  9398.             throw new RuntimeException("eek");
  9399.         }
  9400.         playerCount = 0;
  9401.         for (int l = 0; l < j; l++) {
  9402.             int i1 = playerIndices[l];
  9403.             Player player = playerArray[i1];
  9404.             int j1 = stream.readBits(1);
  9405.             if (j1 == 0) {
  9406.                 playerIndices[playerCount++] = i1;
  9407.                 player.anInt1537 = loopCycle;
  9408.             } else {
  9409.                 int k1 = stream.readBits(2);
  9410.                 if (k1 == 0) {
  9411.                     playerIndices[playerCount++] = i1;
  9412.                     player.anInt1537 = loopCycle;
  9413.                     anIntArray894[anInt893++] = i1;
  9414.                 } else if (k1 == 1) {
  9415.                     playerIndices[playerCount++] = i1;
  9416.                     player.anInt1537 = loopCycle;
  9417.                     int l1 = stream.readBits(3);
  9418.                     player.moveInDir(false, l1);
  9419.                     int j2 = stream.readBits(1);
  9420.                     if (j2 == 1) {
  9421.                         anIntArray894[anInt893++] = i1;
  9422.                     }
  9423.                 } else if (k1 == 2) {
  9424.                     playerIndices[playerCount++] = i1;
  9425.                     player.anInt1537 = loopCycle;
  9426.                     int i2 = stream.readBits(3);
  9427.                     player.moveInDir(true, i2);
  9428.                     int k2 = stream.readBits(3);
  9429.                     player.moveInDir(true, k2);
  9430.                     int l2 = stream.readBits(1);
  9431.                     if (l2 == 1) {
  9432.                         anIntArray894[anInt893++] = i1;
  9433.                     }
  9434.                 } else if (k1 == 3) {
  9435.                     anIntArray840[anInt839++] = i1;
  9436.                 }
  9437.             }
  9438.         }
  9439.     }
  9440.  
  9441.     public void drawLoginScreen(boolean flag) {
  9442.         resetImageProducers();
  9443.         aRSImageProducer_1109.initDrawingArea();
  9444.         aBackground_966.method361(0, 0);
  9445.         char c = '\u0168';
  9446.         char c1 = '\310';
  9447.         if (loginScreenState == 0) {
  9448.             int i = c1 / 2 + 80;
  9449.             aTextDrawingArea_1270.method382(0x75a9a9, c / 2, onDemandFetcher.statusString, i, true);
  9450.             i = c1 / 2 - 20;
  9451.             chatTextDrawingArea.method382(0xffff00, c / 2, "Welcome to " + ClientSettings.SERVER_NAME + "", i, true);
  9452.             i += 30;
  9453.             int l = c / 2 - 80;
  9454.             int k1 = c1 / 2 + 20;
  9455.             aBackground_967.method361(l - 73, k1 - 20);
  9456.             chatTextDrawingArea.method382(0xffffff, l, "New User", k1 + 5, true);
  9457.             l = c / 2 + 80;
  9458.             aBackground_967.method361(l - 73, k1 - 20);
  9459.             chatTextDrawingArea.method382(0xffffff, l, "Existing User", k1 + 5, true);
  9460.         }
  9461.         if (loginScreenState == 2) {
  9462.             int j = c1 / 2 - 40;
  9463.             if (loginMessage1.length() > 0) {
  9464.                 chatTextDrawingArea.method382(0xffff00, c / 2, loginMessage1, j - 15, true);
  9465.                 chatTextDrawingArea.method382(0xffff00, c / 2, loginMessage2, j, true);
  9466.                 j += 30;
  9467.             } else {
  9468.                 chatTextDrawingArea.method382(0xffff00, c / 2, loginMessage2, j - 7, true);
  9469.                 j += 30;
  9470.             }
  9471.             chatTextDrawingArea.method389(true, c / 2 - 90, 0xffffff, "Username: " + myUsername + (loginScreenCursorPos == 0 & loopCycle % 40 < 20 ? "@yel@|" : ""), j);
  9472.             j += 15;
  9473.             chatTextDrawingArea.method389(true, c / 2 - 88, 0xffffff, "Password: " + TextClass.passwordAsterisks(myPassword) + (loginScreenCursorPos == 1 & loopCycle % 40 < 20 ? "@yel@|" : ""), j);
  9474.             j += 15;
  9475.             if (!flag) {
  9476.                 int i1 = c / 2 - 80;
  9477.                 int l1 = c1 / 2 + 50;
  9478.                 aBackground_967.method361(i1 - 73, l1 - 20);
  9479.                 chatTextDrawingArea.method382(0xffffff, i1, "Login", l1 + 5, true);
  9480.                 i1 = c / 2 + 80;
  9481.                 aBackground_967.method361(i1 - 73, l1 - 20);
  9482.                 chatTextDrawingArea.method382(0xffffff, i1, "Cancel", l1 + 5, true);
  9483.             }
  9484.         }
  9485.         if (loginScreenState == 3) {
  9486.             chatTextDrawingArea.method382(0xffff00, c / 2, "Create a free account", c1 / 2 - 60, true);
  9487.             int k = c1 / 2 - 35;
  9488.             chatTextDrawingArea.method382(0xffffff, c / 2, "To create a new account you need to", k, true);
  9489.             k += 15;
  9490.             chatTextDrawingArea.method382(0xffffff, c / 2, "go back to the main " + ClientSettings.SERVER_NAME + " webpage", k, true);
  9491.             k += 15;
  9492.             chatTextDrawingArea.method382(0xffffff, c / 2, "and choose the red 'create account'", k, true);
  9493.             k += 15;
  9494.             chatTextDrawingArea.method382(0xffffff, c / 2, "button at the top right of that page.", k, true);
  9495.             k += 15;
  9496.             int j1 = c / 2;
  9497.             int i2 = c1 / 2 + 50;
  9498.             aBackground_967.method361(j1 - 73, i2 - 20);
  9499.             chatTextDrawingArea.method382(0xffffff, j1, "Cancel", i2 + 5, true);
  9500.         }
  9501.         aRSImageProducer_1109.drawGraphics(171, super.graphics, 202);
  9502.         if (welcomeScreenRaised) {
  9503.             welcomeScreenRaised = false;
  9504.             aRSImageProducer_1107.drawGraphics(0, super.graphics, 128);
  9505.             aRSImageProducer_1108.drawGraphics(371, super.graphics, 202);
  9506.             aRSImageProducer_1112.drawGraphics(265, super.graphics, 0);
  9507.             aRSImageProducer_1113.drawGraphics(265, super.graphics, 562);
  9508.             aRSImageProducer_1114.drawGraphics(171, super.graphics, 128);
  9509.             aRSImageProducer_1115.drawGraphics(171, super.graphics, 562);
  9510.         }
  9511.     }
  9512.  
  9513.     public void drawFlames() {
  9514.         drawingFlames = true;
  9515.         try {
  9516.             long l = System.currentTimeMillis();
  9517.             int i = 0;
  9518.             int j = 20;
  9519.             while (aBoolean831) {
  9520.                 anInt1208++;
  9521.                 calcFlamesPosition();
  9522.                 calcFlamesPosition();
  9523.                 doFlamesDrawing();
  9524.                 if (++i > 10) {
  9525.                     long l1 = System.currentTimeMillis();
  9526.                     int k = (int) (l1 - l) / 10 - j;
  9527.                     j = 40 - k;
  9528.                     if (j < 5) {
  9529.                         j = 5;
  9530.                     }
  9531.                     i = 0;
  9532.                     l = l1;
  9533.                 }
  9534.                 try {
  9535.                     Thread.sleep(j);
  9536.                 } catch (Exception _ex) {
  9537.                 }
  9538.             }
  9539.         } catch (Exception _ex) {
  9540.         }
  9541.         drawingFlames = false;
  9542.     }
  9543.  
  9544.     public void raiseWelcomeScreen() {
  9545.         welcomeScreenRaised = true;
  9546.     }
  9547.  
  9548.     public void method137(Stream stream, int j) {
  9549.         if (j == 84) {
  9550.             int k = stream.readUnsignedByte();
  9551.             int j3 = anInt1268 + (k >> 4 & 7);
  9552.             int i6 = anInt1269 + (k & 7);
  9553.             int l8 = stream.readUnsignedWord();
  9554.             int k11 = stream.readUnsignedWord();
  9555.             int l13 = stream.readUnsignedWord();
  9556.             if (j3 >= 0 && i6 >= 0 && j3 < 104 && i6 < 104) {
  9557.                 NodeList class19_1 = groundArray[plane][j3][i6];
  9558.                 if (class19_1 != null) {
  9559.                     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()) {
  9560.                         if (class30_sub2_sub4_sub2_3.ID != (l8 & 0x7fff) || class30_sub2_sub4_sub2_3.anInt1559 != k11) {
  9561.                             continue;
  9562.                         }
  9563.                         class30_sub2_sub4_sub2_3.anInt1559 = l13;
  9564.                         break;
  9565.                     }
  9566.  
  9567.                     spawnGroundItem(j3, i6);
  9568.                 }
  9569.             }
  9570.             return;
  9571.         }
  9572.         if (j == 105) {
  9573.             int l = stream.readUnsignedByte();
  9574.             int k3 = anInt1268 + (l >> 4 & 7);
  9575.             int j6 = anInt1269 + (l & 7);
  9576.             int i9 = stream.readUnsignedWord();
  9577.             int l11 = stream.readUnsignedByte();
  9578.             int i14 = l11 >> 4 & 0xf;
  9579.             int i16 = l11 & 7;
  9580.             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) {
  9581.                 sound[currentSound] = i9;
  9582.                 soundType[currentSound] = i16;
  9583.                 soundDelay[currentSound] = Sounds.anIntArray326[i9];
  9584.                 currentSound++;
  9585.             }
  9586.         }
  9587.         if (j == 215) {
  9588.             int i1 = stream.method435();
  9589.             int l3 = stream.method428();
  9590.             int k6 = anInt1268 + (l3 >> 4 & 7);
  9591.             int j9 = anInt1269 + (l3 & 7);
  9592.             int i12 = stream.method435();
  9593.             int j14 = stream.readUnsignedWord();
  9594.             if (k6 >= 0 && j9 >= 0 && k6 < 104 && j9 < 104 && i12 != unknownInt10) {
  9595.                 Item class30_sub2_sub4_sub2_2 = new Item();
  9596.                 class30_sub2_sub4_sub2_2.ID = i1;
  9597.                 class30_sub2_sub4_sub2_2.anInt1559 = j14;
  9598.                 if (groundArray[plane][k6][j9] == null) {
  9599.                     groundArray[plane][k6][j9] = new NodeList();
  9600.                 }
  9601.                 groundArray[plane][k6][j9].insertHead(class30_sub2_sub4_sub2_2);
  9602.                 spawnGroundItem(k6, j9);
  9603.             }
  9604.             return;
  9605.         }
  9606.         if (j == 156) {
  9607.             int j1 = stream.readUnsignedByteA();
  9608.             int i4 = anInt1268 + (j1 >> 4 & 7);
  9609.             int l6 = anInt1269 + (j1 & 7);
  9610.             int k9 = stream.readUnsignedWord();
  9611.             if (i4 >= 0 && l6 >= 0 && i4 < 104 && l6 < 104) {
  9612.                 NodeList class19 = groundArray[plane][i4][l6];
  9613.                 if (class19 != null) {
  9614.                     for (Item item = (Item) class19.reverseGetFirst(); item != null; item = (Item) class19.reverseGetNext()) {
  9615.                         if (item.ID != (k9 & 0x7fff)) {
  9616.                             continue;
  9617.                         }
  9618.                         item.unlink();
  9619.                         break;
  9620.                     }
  9621.  
  9622.                     if (class19.reverseGetFirst() == null) {
  9623.                         groundArray[plane][i4][l6] = null;
  9624.                     }
  9625.                     spawnGroundItem(i4, l6);
  9626.                 }
  9627.             }
  9628.             return;
  9629.         }
  9630.         if (j == 160) {
  9631.             int k1 = stream.method428();
  9632.             int j4 = anInt1268 + (k1 >> 4 & 7);
  9633.             int i7 = anInt1269 + (k1 & 7);
  9634.             int l9 = stream.method428();
  9635.             int j12 = l9 >> 2;
  9636.             int k14 = l9 & 3;
  9637.             int j16 = anIntArray1177[j12];
  9638.             int j17 = stream.method435();
  9639.             if (j4 >= 0 && i7 >= 0 && j4 < 103 && i7 < 103) {
  9640.                 int j18 = intGroundArray[plane][j4][i7];
  9641.                 int i19 = intGroundArray[plane][j4 + 1][i7];
  9642.                 int l19 = intGroundArray[plane][j4 + 1][i7 + 1];
  9643.                 int k20 = intGroundArray[plane][j4][i7 + 1];
  9644.                 if (j16 == 0) {
  9645.                     Object1 class10 = worldController.method296(plane, j4, i7);
  9646.                     if (class10 != null) {
  9647.                         int k21 = class10.uid >> 14 & 0x7fff;
  9648.                         if (j12 == 2) {
  9649.                             class10.aClass30_Sub2_Sub4_278 = new Animable_Sub5(k21, 4 + k14, 2, i19, l19, j18, k20, j17, false);
  9650.                             class10.aClass30_Sub2_Sub4_279 = new Animable_Sub5(k21, k14 + 1 & 3, 2, i19, l19, j18, k20, j17, false);
  9651.                         } else {
  9652.                             class10.aClass30_Sub2_Sub4_278 = new Animable_Sub5(k21, k14, j12, i19, l19, j18, k20, j17, false);
  9653.                         }
  9654.                     }
  9655.                 }
  9656.                 if (j16 == 1) {
  9657.                     Object2 class26 = worldController.method297(j4, i7, plane);
  9658.                     if (class26 != null) {
  9659.                         class26.aClass30_Sub2_Sub4_504 = new Animable_Sub5(class26.uid >> 14 & 0x7fff, 0, 4, i19, l19, j18, k20, j17, false);
  9660.                     }
  9661.                 }
  9662.                 if (j16 == 2) {
  9663.                     Object5 class28 = worldController.method298(j4, i7, plane);
  9664.                     if (j12 == 11) {
  9665.                         j12 = 10;
  9666.                     }
  9667.                     if (class28 != null) {
  9668.                         class28.aClass30_Sub2_Sub4_521 = new Animable_Sub5(class28.uid >> 14 & 0x7fff, k14, j12, i19, l19, j18, k20, j17, false);
  9669.                     }
  9670.                 }
  9671.                 if (j16 == 3) {
  9672.                     Object3 class49 = worldController.method299(i7, j4, plane);
  9673.                     if (class49 != null) {
  9674.                         class49.aClass30_Sub2_Sub4_814 = new Animable_Sub5(class49.uid >> 14 & 0x7fff, k14, 22, i19, l19, j18, k20, j17, false);
  9675.                     }
  9676.                 }
  9677.             }
  9678.             return;
  9679.         }
  9680.         if (j == 147) {
  9681.             int l1 = stream.method428();
  9682.             int k4 = anInt1268 + (l1 >> 4 & 7);
  9683.             int j7 = anInt1269 + (l1 & 7);
  9684.             int i10 = stream.readUnsignedWord();
  9685.             byte byte0 = stream.method430();
  9686.             int l14 = stream.method434();
  9687.             byte byte1 = stream.method429();
  9688.             int k17 = stream.readUnsignedWord();
  9689.             int k18 = stream.method428();
  9690.             int j19 = k18 >> 2;
  9691.             int i20 = k18 & 3;
  9692.             int l20 = anIntArray1177[j19];
  9693.             byte byte2 = stream.readSignedByte();
  9694.             int l21 = stream.readUnsignedWord();
  9695.             byte byte3 = stream.method429();
  9696.             Player player;
  9697.             if (i10 == unknownInt10) {
  9698.                 player = myPlayer;
  9699.             } else {
  9700.                 player = playerArray[i10];
  9701.             }
  9702.             if (player != null) {
  9703.                 ObjectDef class46 = ObjectDef.forID(l21);
  9704.                 int i22 = intGroundArray[plane][k4][j7];
  9705.                 int j22 = intGroundArray[plane][k4 + 1][j7];
  9706.                 int k22 = intGroundArray[plane][k4 + 1][j7 + 1];
  9707.                 int l22 = intGroundArray[plane][k4][j7 + 1];
  9708.                 Model model = class46.method578(j19, i20, i22, j22, k22, l22, -1);
  9709.                 if (model != null) {
  9710.                     method130(k17 + 1, -1, 0, l20, j7, 0, plane, k4, l14 + 1);
  9711.                     player.anInt1707 = l14 + loopCycle;
  9712.                     player.anInt1708 = k17 + loopCycle;
  9713.                     player.aModel_1714 = model;
  9714.                     int i23 = class46.anInt744;
  9715.                     int j23 = class46.anInt761;
  9716.                     if (i20 == 1 || i20 == 3) {
  9717.                         i23 = class46.anInt761;
  9718.                         j23 = class46.anInt744;
  9719.                     }
  9720.                     player.anInt1711 = k4 * 128 + i23 * 64;
  9721.                     player.anInt1713 = j7 * 128 + j23 * 64;
  9722.                     player.anInt1712 = method42(plane, player.anInt1713, player.anInt1711);
  9723.                     if (byte2 > byte0) {
  9724.                         byte byte4 = byte2;
  9725.                         byte2 = byte0;
  9726.                         byte0 = byte4;
  9727.                     }
  9728.                     if (byte3 > byte1) {
  9729.                         byte byte5 = byte3;
  9730.                         byte3 = byte1;
  9731.                         byte1 = byte5;
  9732.                     }
  9733.                     player.anInt1719 = k4 + byte2;
  9734.                     player.anInt1721 = k4 + byte0;
  9735.                     player.anInt1720 = j7 + byte3;
  9736.                     player.anInt1722 = j7 + byte1;
  9737.                 }
  9738.             }
  9739.         }
  9740.         if (j == 101) {
  9741.             int l2 = stream.method427();
  9742.             int k5 = l2 >> 2;
  9743.             int j8 = l2 & 3;
  9744.             int i11 = anIntArray1177[k5];
  9745.             int j13 = stream.readUnsignedByte();
  9746.             int k15 = anInt1268 + (j13 >> 4 & 7);
  9747.             int l16 = anInt1269 + (j13 & 7);
  9748.             if (k15 >= 0 && l16 >= 0 && k15 < 104 && l16 < 104)
  9749.                 method130(-1, -1, j8, i11, l16, k5, plane, k15, 0);
  9750.             return;
  9751.         }
  9752.         if (j == 151) {
  9753.             int i2 = stream.method426();
  9754.             int l4 = anInt1268 + (i2 >> 4 & 7);
  9755.             int k7 = anInt1269 + (i2 & 7);
  9756.             int j10 = stream.method434();
  9757.             int k12 = stream.method428();
  9758.             int i15 = k12 >> 2;
  9759.             int k16 = k12 & 3;
  9760.             int l17 = anIntArray1177[i15];
  9761.             if (l4 >= 0 && k7 >= 0 && l4 < 104 && k7 < 104)
  9762.                 method130(-1, j10, k16, l17, k7, i15, plane, l4, 0);
  9763.             return;
  9764.         }
  9765.  
  9766.         if (j == 4) {
  9767.             int j2 = stream.readUnsignedByte();
  9768.             int i5 = anInt1268 + (j2 >> 4 & 7);
  9769.             int l7 = anInt1269 + (j2 & 7);
  9770.             int k10 = stream.readUnsignedWord();
  9771.             int l12 = stream.readUnsignedByte();
  9772.             int j15 = stream.readUnsignedWord();
  9773.             if (i5 >= 0 && l7 >= 0 && i5 < 104 && l7 < 104) {
  9774.                 i5 = i5 * 128 + 64;
  9775.                 l7 = l7 * 128 + 64;
  9776.                 Animable_Sub3 class30_sub2_sub4_sub3 = new Animable_Sub3(plane, loopCycle, j15, k10, method42(plane, l7, i5) - l12, l7, i5);
  9777.                 aClass19_1056.insertHead(class30_sub2_sub4_sub3);
  9778.             }
  9779.             return;
  9780.         }
  9781.         if (j == 44) {
  9782.             int k2 = stream.method436();
  9783.             int j5 = stream.readUnsignedWord();
  9784.             int i8 = stream.readUnsignedByte();
  9785.             int l10 = anInt1268 + (i8 >> 4 & 7);
  9786.             int i13 = anInt1269 + (i8 & 7);
  9787.             if (l10 >= 0 && i13 >= 0 && l10 < 104 && i13 < 104) {
  9788.                 Item class30_sub2_sub4_sub2_1 = new Item();
  9789.                 class30_sub2_sub4_sub2_1.ID = k2;
  9790.                 class30_sub2_sub4_sub2_1.anInt1559 = j5;
  9791.                 if (groundArray[plane][l10][i13] == null) {
  9792.                     groundArray[plane][l10][i13] = new NodeList();
  9793.                 }
  9794.                 groundArray[plane][l10][i13].insertHead(class30_sub2_sub4_sub2_1);
  9795.                 spawnGroundItem(l10, i13);
  9796.             }
  9797.             return;
  9798.         }
  9799.         if (j == 117) {
  9800.             int i3 = stream.readUnsignedByte();
  9801.             int l5 = anInt1268 + (i3 >> 4 & 7);
  9802.             int k8 = anInt1269 + (i3 & 7);
  9803.             int j11 = l5 + stream.readSignedByte();
  9804.             int k13 = k8 + stream.readSignedByte();
  9805.             int l15 = stream.readSignedWord();
  9806.             int i17 = stream.readUnsignedWord();
  9807.             int i18 = stream.readUnsignedByte() * 4;
  9808.             int l18 = stream.readUnsignedByte() * 4;
  9809.             int k19 = stream.readUnsignedWord();
  9810.             int j20 = stream.readUnsignedWord();
  9811.             int i21 = stream.readUnsignedByte();
  9812.             int j21 = stream.readUnsignedByte();
  9813.             if (l5 >= 0 && k8 >= 0 && l5 < 104 && k8 < 104 && j11 >= 0 && k13 >= 0 && j11 < 104 && k13 < 104 && i17 != 65535) {
  9814.                 l5 = l5 * 128 + 64;
  9815.                 k8 = k8 * 128 + 64;
  9816.                 j11 = j11 * 128 + 64;
  9817.                 k13 = k13 * 128 + 64;
  9818.                 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);
  9819.                 class30_sub2_sub4_sub4.method455(k19 + loopCycle, k13, method42(plane, k13, j11) - l18, j11);
  9820.                 aClass19_1013.insertHead(class30_sub2_sub4_sub4);
  9821.             }
  9822.         }
  9823.     }
  9824.  
  9825.     public static void setLowMem() {
  9826.         WorldController.lowMem = true;
  9827.         Texture.lowMem = true;
  9828.         lowMem = true;
  9829.         ObjectManager.lowMem = true;
  9830.         ObjectDef.lowMem = true;
  9831.     }
  9832.  
  9833.     public void method139(Stream stream) {
  9834.         stream.initBitAccess();
  9835.         int k = stream.readBits(8);
  9836.         if (k < npcCount) {
  9837.             for (int l = k; l < npcCount; l++) {
  9838.                 anIntArray840[anInt839++] = npcIndices[l];
  9839.             }
  9840.  
  9841.         }
  9842.         if (k > npcCount) {
  9843.             Signlink.reporterror(myUsername + " Too many npcs");
  9844.             throw new RuntimeException("eek");
  9845.         }
  9846.         npcCount = 0;
  9847.         for (int i1 = 0; i1 < k; i1++) {
  9848.             int j1 = npcIndices[i1];
  9849.             NPC npc = npcArray[j1];
  9850.             int k1 = stream.readBits(1);
  9851.             if (k1 == 0) {
  9852.                 npcIndices[npcCount++] = j1;
  9853.                 npc.anInt1537 = loopCycle;
  9854.             } else {
  9855.                 int l1 = stream.readBits(2);
  9856.                 if (l1 == 0) {
  9857.                     npcIndices[npcCount++] = j1;
  9858.                     npc.anInt1537 = loopCycle;
  9859.                     anIntArray894[anInt893++] = j1;
  9860.                 } else if (l1 == 1) {
  9861.                     npcIndices[npcCount++] = j1;
  9862.                     npc.anInt1537 = loopCycle;
  9863.                     int i2 = stream.readBits(3);
  9864.                     npc.moveInDir(false, i2);
  9865.                     int k2 = stream.readBits(1);
  9866.                     if (k2 == 1) {
  9867.                         anIntArray894[anInt893++] = j1;
  9868.                     }
  9869.                 } else if (l1 == 2) {
  9870.                     npcIndices[npcCount++] = j1;
  9871.                     npc.anInt1537 = loopCycle;
  9872.                     int j2 = stream.readBits(3);
  9873.                     npc.moveInDir(true, j2);
  9874.                     int l2 = stream.readBits(3);
  9875.                     npc.moveInDir(true, l2);
  9876.                     int i3 = stream.readBits(1);
  9877.                     if (i3 == 1) {
  9878.                         anIntArray894[anInt893++] = j1;
  9879.                     }
  9880.                 } else if (l1 == 3) {
  9881.                     anIntArray840[anInt839++] = j1;
  9882.                 }
  9883.             }
  9884.         }
  9885.  
  9886.     }
  9887.  
  9888.     public void processLoginScreenInput() {
  9889.         if (loginScreenState == 0) {
  9890.             int i = super.myWidth / 2 - 80;
  9891.             int l = super.myHeight / 2 + 20;
  9892.             l += 20;
  9893.             if (super.clickMode3 == 1 && super.saveClickX >= i - 75 && super.saveClickX <= i + 75 && super.saveClickY >= l - 20 && super.saveClickY <= l + 20) {
  9894.                 loginScreenState = 3;
  9895.                 loginScreenCursorPos = 0;
  9896.             }
  9897.             i = super.myWidth / 2 + 80;
  9898.             if (super.clickMode3 == 1 && super.saveClickX >= i - 75 && super.saveClickX <= i + 75 && super.saveClickY >= l - 20 && super.saveClickY <= l + 20) {
  9899.                 loginMessage1 = "";
  9900.                 loginMessage2 = "Enter your username & password.";
  9901.                 loginScreenState = 2;
  9902.                 loginScreenCursorPos = 0;
  9903.             }
  9904.         } else {
  9905.             if (loginScreenState == 2) {
  9906.                 int j = super.myHeight / 2 - 40;
  9907.                 j += 30;
  9908.                 j += 25;
  9909.                 if (super.clickMode3 == 1 && super.saveClickY >= j - 15 && super.saveClickY < j) {
  9910.                     loginScreenCursorPos = 0;
  9911.                 }
  9912.                 j += 15;
  9913.                 if (super.clickMode3 == 1 && super.saveClickY >= j - 15 && super.saveClickY < j) {
  9914.                     loginScreenCursorPos = 1;
  9915.                 }
  9916.                 j += 15;
  9917.                 int i1 = super.myWidth / 2 - 80;
  9918.                 int k1 = super.myHeight / 2 + 50;
  9919.                 k1 += 20;
  9920.                 if (super.clickMode3 == 1 && super.saveClickX >= i1 - 75 && super.saveClickX <= i1 + 75 && super.saveClickY >= k1 - 20 && super.saveClickY <= k1 + 20) {
  9921.                     loginFailures = 0;
  9922.                     login(myUsername, myPassword, false);
  9923.                     if (loggedIn) {
  9924.                         return;
  9925.                     }
  9926.                 }
  9927.                 i1 = super.myWidth / 2 + 80;
  9928.                 if (super.clickMode3 == 1 && super.saveClickX >= i1 - 75 && super.saveClickX <= i1 + 75 && super.saveClickY >= k1 - 20 && super.saveClickY <= k1 + 20) {
  9929.                     loginScreenState = 0;
  9930.                     // myUsername = "";
  9931.                     // myPassword = "";
  9932.                 }
  9933.                 do {
  9934.                     int l1 = readChar(-796);
  9935.                     if (l1 == -1) {
  9936.                         break;
  9937.                     }
  9938.                     boolean flag1 = false;
  9939.                     for (int i2 = 0; i2 < validUserPassChars.length(); i2++) {
  9940.                         if (l1 != validUserPassChars.charAt(i2)) {
  9941.                             continue;
  9942.                         }
  9943.                         flag1 = true;
  9944.                         break;
  9945.                     }
  9946.  
  9947.                     if (loginScreenCursorPos == 0) {
  9948.                         if (l1 == 8 && myUsername.length() > 0) {
  9949.                             myUsername = myUsername.substring(0, myUsername.length() - 1);
  9950.                         }
  9951.                         if (l1 == 9 || l1 == 10 || l1 == 13) {
  9952.                             loginScreenCursorPos = 1;
  9953.                         }
  9954.                         if (flag1) {
  9955.                             myUsername += (char) l1;
  9956.                         }
  9957.                         if (myUsername.length() > 12) {
  9958.                             myUsername = myUsername.substring(0, 12);
  9959.                         }
  9960.                     } else if (loginScreenCursorPos == 1) {
  9961.                         if (l1 == 8 && myPassword.length() > 0) {
  9962.                             myPassword = myPassword.substring(0, myPassword.length() - 1);
  9963.                         }
  9964.                         if (l1 == 9 || l1 == 10 || l1 == 13) {
  9965.                             login(myUsername, myPassword, false);
  9966.                             loginScreenCursorPos = 0;
  9967.                         }
  9968.                         if (flag1) {
  9969.                             myPassword += (char) l1;
  9970.                         }
  9971.                         if (myPassword.length() > 20) {
  9972.                             myPassword = myPassword.substring(0, 20);
  9973.                         }
  9974.                     }
  9975.                 } while (true);
  9976.                 return;
  9977.             }
  9978.             if (loginScreenState == 3) {
  9979.                 int k = super.myWidth / 2;
  9980.                 int j1 = super.myHeight / 2 + 50;
  9981.                 j1 += 20;
  9982.                 if (super.clickMode3 == 1 && super.saveClickX >= k - 75 && super.saveClickX <= k + 75 && super.saveClickY >= j1 - 20 && super.saveClickY <= j1 + 20) {
  9983.                     loginScreenState = 0;
  9984.                 }
  9985.             }
  9986.         }
  9987.     }
  9988.  
  9989.     public void markMinimap(Sprite sprite, int i, int j) {
  9990.         int k = minimapInt1 + minimapInt2 & 0x7ff;
  9991.         int l = i * i + j * j;
  9992.         if (l > 6400) {
  9993.             return;
  9994.         }
  9995.         int i1 = Model.modelIntArray1[k];
  9996.         int j1 = Model.modelIntArray2[k];
  9997.         i1 = i1 * 256 / (minimapInt3 + 256);
  9998.         j1 = j1 * 256 / (minimapInt3 + 256);
  9999.         int k1 = j * i1 + i * j1 >> 16;
  10000.         int l1 = j * j1 - i * i1 >> 16;
  10001.         if (l > 2500) {
  10002.             sprite.method354(mapBack, 83 - l1 - sprite.trimHeight / 2 - 4, 94 + k1 - sprite.trimWidth / 2 + 4);
  10003.         } else {
  10004.             sprite.drawSprite(94 + k1 - sprite.trimWidth / 2 + 4, 83 - l1 - sprite.trimHeight / 2 - 4);
  10005.         }
  10006.     }
  10007.  
  10008.     public void method142(int i, int j, int k, int l, int i1, int j1, int k1) {
  10009.         if (i1 >= 1 && i >= 1 && i1 <= 102 && i <= 102) {
  10010.             if (lowMem && j != plane) {
  10011.                 return;
  10012.             }
  10013.             int i2 = 0;
  10014.             if (j1 == 0) {
  10015.                 i2 = worldController.method300(j, i1, i);
  10016.             }
  10017.             if (j1 == 1) {
  10018.                 i2 = worldController.method301(j, i1, i);
  10019.             }
  10020.             if (j1 == 2) {
  10021.                 i2 = worldController.method302(j, i1, i);
  10022.             }
  10023.             if (j1 == 3) {
  10024.                 i2 = worldController.method303(j, i1, i);
  10025.             }
  10026.             if (i2 != 0) {
  10027.                 int i3 = worldController.method304(j, i1, i, i2);
  10028.                 int j2 = i2 >> 14 & 0x7fff;
  10029.                 int k2 = i3 & 0x1f;
  10030.                 int l2 = i3 >> 6;
  10031.                 if (j1 == 0) {
  10032.                     worldController.method291(i1, j, i, (byte) -119);
  10033.                     ObjectDef class46 = ObjectDef.forID(j2);
  10034.                     if (class46.aBoolean767) {
  10035.                         aClass11Array1230[j].method215(l2, k2, class46.aBoolean757, i1, i);
  10036.                     }
  10037.                 }
  10038.                 if (j1 == 1) {
  10039.                     worldController.method292(i, j, i1);
  10040.                 }
  10041.                 if (j1 == 2) {
  10042.                     worldController.method293(j, i1, i);
  10043.                     ObjectDef class46_1 = ObjectDef.forID(j2);
  10044.                     if (i1 + class46_1.anInt744 > 103 || i + class46_1.anInt744 > 103 || i1 + class46_1.anInt761 > 103 || i + class46_1.anInt761 > 103) {
  10045.                         return;
  10046.                     }
  10047.                     if (class46_1.aBoolean767) {
  10048.                         aClass11Array1230[j].method216(l2, class46_1.anInt744, i1, i, class46_1.anInt761, class46_1.aBoolean757);
  10049.                     }
  10050.                 }
  10051.                 if (j1 == 3) {
  10052.                     worldController.method294(j, i, i1);
  10053.                     ObjectDef class46_2 = ObjectDef.forID(j2);
  10054.                     if (class46_2.aBoolean767 && class46_2.hasActions) {
  10055.                         aClass11Array1230[j].method218(i, i1);
  10056.                     }
  10057.                 }
  10058.             }
  10059.             if (k1 >= 0) {
  10060.                 int j3 = j;
  10061.                 if (j3 < 3 && (byteGroundArray[1][i1][i] & 2) == 2) {
  10062.                     j3++;
  10063.                 }
  10064.                 ObjectManager.method188(worldController, k, i, l, j3, aClass11Array1230[j], intGroundArray, i1, k1, j);
  10065.             }
  10066.         }
  10067.     }
  10068.  
  10069.     public void updatePlayers(int i, Stream stream) {
  10070.         anInt839 = 0;
  10071.         anInt893 = 0;
  10072.         method117(stream);
  10073.         method134(stream);
  10074.         method91(stream, i);
  10075.         method49(stream);
  10076.         for (int k = 0; k < anInt839; k++) {
  10077.             int l = anIntArray840[k];
  10078.             if (playerArray[l].anInt1537 != loopCycle) {
  10079.                 playerArray[l] = null;
  10080.             }
  10081.         }
  10082.  
  10083.         if (stream.currentOffset != i) {
  10084.             Signlink.reporterror("Error packet size mismatch in getplayer pos:" + stream.currentOffset + " psize:" + i);
  10085.             throw new RuntimeException("eek");
  10086.         }
  10087.         for (int i1 = 0; i1 < playerCount; i1++) {
  10088.             if (playerArray[playerIndices[i1]] == null) {
  10089.                 Signlink.reporterror(myUsername + " null entry in pl list - pos:" + i1 + " size:" + playerCount);
  10090.                 throw new RuntimeException("eek");
  10091.             }
  10092.         }
  10093.  
  10094.     }
  10095.  
  10096.     public void setCameraPos(int j, int k, int l, int i1, int j1, int k1) {
  10097.         int l1 = 2048 - k & 0x7ff;
  10098.         int i2 = 2048 - j1 & 0x7ff;
  10099.         int j2 = 0;
  10100.         int k2 = 0;
  10101.         int l2 = j;
  10102.         if (l1 != 0) {
  10103.             int i3 = Model.modelIntArray1[l1];
  10104.             int k3 = Model.modelIntArray2[l1];
  10105.             int i4 = k2 * k3 - l2 * i3 >> 16;
  10106.             l2 = k2 * i3 + l2 * k3 >> 16;
  10107.             k2 = i4;
  10108.         }
  10109.         if (i2 != 0) {
  10110.             /*
  10111.              * xxx if(cameratoggle){ if(zoom == 0) zoom = k2; if(lftrit == 0)
  10112.              * lftrit = j2; if(fwdbwd == 0) fwdbwd = l2; k2 = zoom; j2 = lftrit;
  10113.              * l2 = fwdbwd; }
  10114.              */
  10115.             int j3 = Model.modelIntArray1[i2];
  10116.             int l3 = Model.modelIntArray2[i2];
  10117.             int j4 = l2 * j3 + j2 * l3 >> 16;
  10118.             l2 = l2 * l3 - j2 * j3 >> 16;
  10119.             j2 = j4;
  10120.         }
  10121.         xCameraPos = l - j2;
  10122.         zCameraPos = i1 - k2;
  10123.         yCameraPos = k1 - l2;
  10124.         yCameraCurve = k;
  10125.         xCameraCurve = j1;
  10126.     }
  10127.  
  10128.     public boolean parsePacket() {
  10129.         if (socketStream == null) {
  10130.             return false;
  10131.         }
  10132.         try {
  10133.             int i = socketStream.available();
  10134.             if (i == 0) {
  10135.                 return false;
  10136.             }
  10137.             if (pktType == -1) {
  10138.                 socketStream.flushInputStream(inStream.buffer, 1);
  10139.                 pktType = inStream.buffer[0] & 0xff;
  10140.                 if (encryption != null) {
  10141.                     pktType = pktType - encryption.getNextKey() & 0xff;
  10142.                 }
  10143.                 pktSize = SizeConstants.packetSizes[pktType];
  10144.                 i--;
  10145.             }
  10146.             if (pktSize == -1) {
  10147.                 if (i > 0) {
  10148.                     socketStream.flushInputStream(inStream.buffer, 1);
  10149.                     pktSize = inStream.buffer[0] & 0xff;
  10150.                     i--;
  10151.                 } else {
  10152.                     return false;
  10153.                 }
  10154.             }
  10155.             if (pktSize == -2) {
  10156.                 if (i > 1) {
  10157.                     socketStream.flushInputStream(inStream.buffer, 2);
  10158.                     inStream.currentOffset = 0;
  10159.                     pktSize = inStream.readUnsignedWord();
  10160.                     i -= 2;
  10161.                 } else {
  10162.                     return false;
  10163.                 }
  10164.             }
  10165.             if (i < pktSize) {
  10166.                 return false;
  10167.             }
  10168.             inStream.currentOffset = 0;
  10169.             socketStream.flushInputStream(inStream.buffer, pktSize);
  10170.             anInt1009 = 0;
  10171.             anInt843 = anInt842;
  10172.             anInt842 = anInt841;
  10173.             anInt841 = pktType;
  10174.             if (pktType == 81) {
  10175.                 updatePlayers(pktSize, inStream);
  10176.                 aBoolean1080 = false;
  10177.                 pktType = -1;
  10178.                 return true;
  10179.             }
  10180.             if (pktType == 176) {
  10181.                 daysSinceRecovChange = inStream.method427();
  10182.                 unreadMessages = inStream.method435();
  10183.                 membersInt = inStream.readUnsignedByte();
  10184.                 anInt1193 = inStream.method440();
  10185.                 daysSinceLastLogin = inStream.readUnsignedWord();
  10186.                 if (anInt1193 != 0 && openInterfaceID == -1) {
  10187.                     Signlink.dnslookup(TextClass.method586(anInt1193));
  10188.                     closeOpenInterfaces();
  10189.                     char c = '\u028A';
  10190.                     if (daysSinceRecovChange != 201 || membersInt == 1) {
  10191.                         c = '\u028F';
  10192.                     }
  10193.                     reportAbuseInput = "";
  10194.                     canMute = false;
  10195.                     for (RSInterface element : RSInterface.interfaceCache) {
  10196.                         if (element == null || element.anInt214 != c) {
  10197.                             continue;
  10198.                         }
  10199.                         openInterfaceID = element.parentID;
  10200.                         break;
  10201.                     }
  10202.  
  10203.                 }
  10204.                 pktType = -1;
  10205.                 return true;
  10206.             }
  10207.             if (pktType == 64) {
  10208.                 anInt1268 = inStream.method427();
  10209.                 anInt1269 = inStream.method428();
  10210.                 for (int j = anInt1268; j < anInt1268 + 8; j++) {
  10211.                     for (int l9 = anInt1269; l9 < anInt1269 + 8; l9++) {
  10212.                         if (groundArray[plane][j][l9] != null) {
  10213.                             groundArray[plane][j][l9] = null;
  10214.                             spawnGroundItem(j, l9);
  10215.                         }
  10216.                     }
  10217.  
  10218.                 }
  10219.  
  10220.                 for (Class30_Sub1 class30_sub1 = (Class30_Sub1) aClass19_1179.reverseGetFirst(); class30_sub1 != null; class30_sub1 = (Class30_Sub1) aClass19_1179.reverseGetNext()) {
  10221.                     if (class30_sub1.anInt1297 >= anInt1268 && class30_sub1.anInt1297 < anInt1268 + 8 && class30_sub1.anInt1298 >= anInt1269 && class30_sub1.anInt1298 < anInt1269 + 8 && class30_sub1.anInt1295 == plane) {
  10222.                         class30_sub1.anInt1294 = 0;
  10223.                     }
  10224.                 }
  10225.  
  10226.                 pktType = -1;
  10227.                 return true;
  10228.             }
  10229.             if (pktType == 185) {
  10230.                 int k = inStream.method436();
  10231.                 RSInterface.interfaceCache[k].anInt233 = 3;
  10232.                 if (myPlayer.desc == null) {
  10233.                     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];
  10234.                 } else {
  10235.                     RSInterface.interfaceCache[k].mediaID = (int) (0x12345678L + myPlayer.desc.type);
  10236.                 }
  10237.                 pktType = -1;
  10238.                 return true;
  10239.             }
  10240.             if (pktType == 107) {
  10241.                 aBoolean1160 = false;
  10242.                 for (int l = 0; l < 5; l++) {
  10243.                     aBooleanArray876[l] = false;
  10244.                 }
  10245.  
  10246.                 pktType = -1;
  10247.                 return true;
  10248.             }
  10249.             if (pktType == 72) {
  10250.                 int i1 = inStream.method434();
  10251.                 RSInterface class9 = RSInterface.interfaceCache[i1];
  10252.                 for (int k15 = 0; k15 < class9.inv.length; k15++) {
  10253.                     class9.inv[k15] = -1;
  10254.                     class9.inv[k15] = 0;
  10255.                 }
  10256.  
  10257.                 pktType = -1;
  10258.                 return true;
  10259.             }
  10260.             if (pktType == 214) {
  10261.                 ignoreCount = pktSize / 8;
  10262.                 for (int j1 = 0; j1 < ignoreCount; j1++) {
  10263.                     ignoreListAsLongs[j1] = inStream.readQWord();
  10264.                 }
  10265.  
  10266.                 pktType = -1;
  10267.                 return true;
  10268.             }
  10269.             if (pktType == 166) {
  10270.                 aBoolean1160 = true;
  10271.                 anInt1098 = inStream.readUnsignedByte();
  10272.                 anInt1099 = inStream.readUnsignedByte();
  10273.                 anInt1100 = inStream.readUnsignedWord();
  10274.                 anInt1101 = inStream.readUnsignedByte();
  10275.                 anInt1102 = inStream.readUnsignedByte();
  10276.                 if (anInt1102 >= 100) {
  10277.                     xCameraPos = anInt1098 * 128 + 64;
  10278.                     yCameraPos = anInt1099 * 128 + 64;
  10279.                     zCameraPos = method42(plane, yCameraPos, xCameraPos) - anInt1100;
  10280.                 }
  10281.                 pktType = -1;
  10282.                 return true;
  10283.             }
  10284.             if (pktType == 134) {
  10285.                 needDrawTabArea = true;
  10286.                 int k1 = inStream.readUnsignedByte();
  10287.                 int i10 = inStream.method439();
  10288.                 int l15 = inStream.readUnsignedByte();
  10289.                 currentExp[k1] = i10;
  10290.                 currentStats[k1] = l15;
  10291.                 maxStats[k1] = 1;
  10292.                 for (int k20 = 0; k20 < 98; k20++) {
  10293.                     if (i10 >= anIntArray1019[k20]) {
  10294.                         maxStats[k1] = k20 + 2;
  10295.                     }
  10296.                 }
  10297.  
  10298.                 pktType = -1;
  10299.                 return true;
  10300.             }
  10301.             if (pktType == 71) {
  10302.                 int l1 = inStream.readUnsignedWord();
  10303.                 int j10 = inStream.readUnsignedByteA();
  10304.                 if (l1 == 65535) {
  10305.                     l1 = -1;
  10306.                 }
  10307.                 tabInterfaceIDs[j10] = l1;
  10308.                 needDrawTabArea = true;
  10309.                 tabAreaAltered = true;
  10310.                 pktType = -1;
  10311.                 return true;
  10312.             }
  10313.             if (pktType == 74) {
  10314.                 int i2 = inStream.method434();
  10315.                 if (i2 == 65535) {
  10316.                     i2 = -1;
  10317.                 }
  10318.                 if (i2 != -1 || previousSong != 0) {
  10319.                     if (i2 != -1 && currentSong != i2 && musicVolume != 0 && previousSong == 0)
  10320.                         method58(10, musicVolume, false, i2);
  10321.                 } else
  10322.                     method55(false);
  10323.                 currentSong = i2;
  10324.                 pktType = -1;
  10325.                 return true;
  10326.             }
  10327.             if (pktType == 121) {
  10328.                 int i_60_ = inStream.method436();
  10329.                 int i_61_ = inStream.method435();
  10330.                 if (i_61_ == 65535)
  10331.                     i_61_ = -1;
  10332.                 if (musicVolume != 0 && i_61_ != -1) {
  10333.                     method56(musicVolume, false, i_60_);
  10334.                     previousSong = i_61_*20;
  10335.                 }
  10336.                 pktType = -1;
  10337.                 return true;
  10338.             }
  10339.             if (pktType == 109) {
  10340.                 resetLogout();
  10341.                 pktType = -1;
  10342.                 return false;
  10343.             }
  10344.             if (pktType == 70) {
  10345.                 int k2 = inStream.readSignedWord();
  10346.                 int l10 = inStream.method437();
  10347.                 int i16 = inStream.method434();
  10348.                 RSInterface class9_5 = RSInterface.interfaceCache[i16];
  10349.                 class9_5.anInt263 = k2;
  10350.                 class9_5.anInt265 = l10;
  10351.                 pktType = -1;
  10352.                 return true;
  10353.             }
  10354.             if (pktType == 73 || pktType == 241) {
  10355.  
  10356.                 // mapReset();
  10357.                 int l2 = anInt1069;
  10358.                 int i11 = anInt1070;
  10359.                 if (pktType == 73) {
  10360.                     l2 = inStream.method435();
  10361.                     i11 = inStream.readUnsignedWord();
  10362.                     aBoolean1159 = false;
  10363.                 }
  10364.                 if (pktType == 241) {
  10365.                     i11 = inStream.method435();
  10366.                     inStream.initBitAccess();
  10367.                     for (int j16 = 0; j16 < 4; j16++) {
  10368.                         for (int l20 = 0; l20 < 13; l20++) {
  10369.                             for (int j23 = 0; j23 < 13; j23++) {
  10370.                                 int i26 = inStream.readBits(1);
  10371.                                 if (i26 == 1) {
  10372.                                     anIntArrayArrayArray1129[j16][l20][j23] = inStream.readBits(26);
  10373.                                 } else {
  10374.                                     anIntArrayArrayArray1129[j16][l20][j23] = -1;
  10375.                                 }
  10376.                             }
  10377.  
  10378.                         }
  10379.  
  10380.                     }
  10381.  
  10382.                     inStream.finishBitAccess();
  10383.                     l2 = inStream.readUnsignedWord();
  10384.                     aBoolean1159 = true;
  10385.                 }
  10386.                 if (anInt1069 == l2 && anInt1070 == i11 && loadingStage == 2) {
  10387.                     pktType = -1;
  10388.                     return true;
  10389.                 }
  10390.                 anInt1069 = l2;
  10391.                 anInt1070 = i11;
  10392.                 baseX = (anInt1069 - 6) * 8;
  10393.                 baseY = (anInt1070 - 6) * 8;
  10394.                 aBoolean1141 = (anInt1069 / 8 == 48 || anInt1069 / 8 == 49) && anInt1070 / 8 == 48;
  10395.                 if (anInt1069 / 8 == 48 && anInt1070 / 8 == 148) {
  10396.                     aBoolean1141 = true;
  10397.                 }
  10398.                 loadingStage = 1;
  10399.                 aLong824 = System.currentTimeMillis();
  10400.                 drawTextOnScreen(null, "Loading - please wait.");
  10401.                 if (pktType == 73) {
  10402.                     int k16 = 0;
  10403.                     for (int i21 = (anInt1069 - 6) / 8; i21 <= (anInt1069 + 6) / 8; i21++) {
  10404.                         for (int k23 = (anInt1070 - 6) / 8; k23 <= (anInt1070 + 6) / 8; k23++) {
  10405.                             k16++;
  10406.                         }
  10407.  
  10408.                     }
  10409.  
  10410.                     aByteArrayArray1183 = new byte[k16][];
  10411.                     aByteArrayArray1247 = new byte[k16][];
  10412.                     anIntArray1234 = new int[k16];
  10413.                     anIntArray1235 = new int[k16];
  10414.                     anIntArray1236 = new int[k16];
  10415.                     k16 = 0;
  10416.                     for (int l23 = (anInt1069 - 6) / 8; l23 <= (anInt1069 + 6) / 8; l23++) {
  10417.                         for (int j26 = (anInt1070 - 6) / 8; j26 <= (anInt1070 + 6) / 8; j26++) {
  10418.                             anIntArray1234[k16] = (l23 << 8) + j26;
  10419.                             if (aBoolean1141 && (j26 == 49 || j26 == 149 || j26 == 147 || l23 == 50 || l23 == 49 && j26 == 47)) {
  10420.                                 anIntArray1235[k16] = -1;
  10421.                                 anIntArray1236[k16] = -1;
  10422.                                 k16++;
  10423.                             } else {
  10424.                                 int k28 = anIntArray1235[k16] = onDemandFetcher.method562(0, j26, l23);
  10425.                                 if (k28 != -1) {
  10426.                                     onDemandFetcher.method558(3, k28);
  10427.                                 }
  10428.                                 int j30 = anIntArray1236[k16] = onDemandFetcher.method562(1, j26, l23);
  10429.                                 if (j30 != -1) {
  10430.                                     onDemandFetcher.method558(3, j30);
  10431.                                 }
  10432.                                 k16++;
  10433.                             }
  10434.                         }
  10435.  
  10436.                     }
  10437.  
  10438.                 }
  10439.                 if (pktType == 241) {
  10440.                     int l16 = 0;
  10441.                     int ai[] = new int[676];
  10442.                     for (int i24 = 0; i24 < 4; i24++) {
  10443.                         for (int k26 = 0; k26 < 13; k26++) {
  10444.                             for (int l28 = 0; l28 < 13; l28++) {
  10445.                                 int k30 = anIntArrayArrayArray1129[i24][k26][l28];
  10446.                                 if (k30 != -1) {
  10447.                                     int k31 = k30 >> 14 & 0x3ff;
  10448.                                     int i32 = k30 >> 3 & 0x7ff;
  10449.                                     int k32 = (k31 / 8 << 8) + i32 / 8;
  10450.                                     for (int j33 = 0; j33 < l16; j33++) {
  10451.                                         if (ai[j33] != k32) {
  10452.                                             continue;
  10453.                                         }
  10454.                                         k32 = -1;
  10455.                                         break;
  10456.                                     }
  10457.  
  10458.                                     if (k32 != -1) {
  10459.                                         ai[l16++] = k32;
  10460.                                     }
  10461.                                 }
  10462.                             }
  10463.  
  10464.                         }
  10465.  
  10466.                     }
  10467.  
  10468.                     aByteArrayArray1183 = new byte[l16][];
  10469.                     aByteArrayArray1247 = new byte[l16][];
  10470.                     anIntArray1234 = new int[l16];
  10471.                     anIntArray1235 = new int[l16];
  10472.                     anIntArray1236 = new int[l16];
  10473.                     for (int l26 = 0; l26 < l16; l26++) {
  10474.                         int i29 = anIntArray1234[l26] = ai[l26];
  10475.                         int l30 = i29 >> 8 & 0xff;
  10476.                         int l31 = i29 & 0xff;
  10477.                         int j32 = anIntArray1235[l26] = onDemandFetcher.method562(0, l31, l30);
  10478.                         if (j32 != -1) {
  10479.                             onDemandFetcher.method558(3, j32);
  10480.                         }
  10481.                         int i33 = anIntArray1236[l26] = onDemandFetcher.method562(1, l31, l30);
  10482.                         if (i33 != -1) {
  10483.                             onDemandFetcher.method558(3, i33);
  10484.                         }
  10485.                     }
  10486.  
  10487.                 }
  10488.                 int i17 = baseX - anInt1036;
  10489.                 int j21 = baseY - anInt1037;
  10490.                 anInt1036 = baseX;
  10491.                 anInt1037 = baseY;
  10492.                 for (int j24 = 0; j24 < 16384; j24++) {
  10493.                     NPC npc = npcArray[j24];
  10494.                     if (npc != null) {
  10495.                         for (int j29 = 0; j29 < 10; j29++) {
  10496.                             npc.smallX[j29] -= i17;
  10497.                             npc.smallY[j29] -= j21;
  10498.                         }
  10499.  
  10500.                         npc.x -= i17 * 128;
  10501.                         npc.y -= j21 * 128;
  10502.                     }
  10503.                 }
  10504.  
  10505.                 for (int i27 = 0; i27 < maxPlayers; i27++) {
  10506.                     Player player = playerArray[i27];
  10507.                     if (player != null) {
  10508.                         for (int i31 = 0; i31 < 10; i31++) {
  10509.                             player.smallX[i31] -= i17;
  10510.                             player.smallY[i31] -= j21;
  10511.                         }
  10512.  
  10513.                         player.x -= i17 * 128;
  10514.                         player.y -= j21 * 128;
  10515.                     }
  10516.                 }
  10517.  
  10518.                 aBoolean1080 = true;
  10519.                 byte byte1 = 0;
  10520.                 byte byte2 = 104;
  10521.                 byte byte3 = 1;
  10522.                 if (i17 < 0) {
  10523.                     byte1 = 103;
  10524.                     byte2 = -1;
  10525.                     byte3 = -1;
  10526.                 }
  10527.                 byte byte4 = 0;
  10528.                 byte byte5 = 104;
  10529.                 byte byte6 = 1;
  10530.                 if (j21 < 0) {
  10531.                     byte4 = 103;
  10532.                     byte5 = -1;
  10533.                     byte6 = -1;
  10534.                 }
  10535.                 for (int k33 = byte1; k33 != byte2; k33 += byte3) {
  10536.                     for (int l33 = byte4; l33 != byte5; l33 += byte6) {
  10537.                         int i34 = k33 + i17;
  10538.                         int j34 = l33 + j21;
  10539.                         for (int k34 = 0; k34 < 4; k34++) {
  10540.                             if (i34 >= 0 && j34 >= 0 && i34 < 104 && j34 < 104) {
  10541.                                 groundArray[k34][k33][l33] = groundArray[k34][i34][j34];
  10542.                             } else {
  10543.                                 groundArray[k34][k33][l33] = null;
  10544.                             }
  10545.                         }
  10546.  
  10547.                     }
  10548.  
  10549.                 }
  10550.  
  10551.                 for (Class30_Sub1 class30_sub1_1 = (Class30_Sub1) aClass19_1179.reverseGetFirst(); class30_sub1_1 != null; class30_sub1_1 = (Class30_Sub1) aClass19_1179.reverseGetNext()) {
  10552.                     class30_sub1_1.anInt1297 -= i17;
  10553.                     class30_sub1_1.anInt1298 -= j21;
  10554.                     if (class30_sub1_1.anInt1297 < 0 || class30_sub1_1.anInt1298 < 0 || class30_sub1_1.anInt1297 >= 104 || class30_sub1_1.anInt1298 >= 104) {
  10555.                         class30_sub1_1.unlink();
  10556.                     }
  10557.                 }
  10558.  
  10559.                 if (destX != 0) {
  10560.                     destX -= i17;
  10561.                     destY -= j21;
  10562.                 }
  10563.                 aBoolean1160 = false;
  10564.                 pktType = -1;
  10565.                 return true;
  10566.             }
  10567.             if (pktType == 208) {
  10568.                 int i3 = inStream.method437();
  10569.                 if (i3 >= 0) {
  10570.                     method60(i3);
  10571.                 }
  10572.                 anInt1018 = i3;
  10573.                 pktType = -1;
  10574.                 return true;
  10575.             }
  10576.             if (pktType == 99) {
  10577.                 anInt1021 = inStream.readUnsignedByte();
  10578.                 pktType = -1;
  10579.                 return true;
  10580.             }
  10581.             if (pktType == 75) {
  10582.                 int j3 = inStream.method436();
  10583.                 int j11 = inStream.method436();
  10584.                 RSInterface.interfaceCache[j11].anInt233 = 2;
  10585.                 RSInterface.interfaceCache[j11].mediaID = j3;
  10586.                 pktType = -1;
  10587.                 return true;
  10588.             }
  10589.             if (pktType == 114) {
  10590.                 anInt1104 = inStream.method434() * 30;
  10591.                 pktType = -1;
  10592.                 return true;
  10593.             }
  10594.             if (pktType == 60) {
  10595.                 anInt1269 = inStream.readUnsignedByte();
  10596.                 anInt1268 = inStream.method427();
  10597.                 while (inStream.currentOffset < pktSize) {
  10598.                     int k3 = inStream.readUnsignedByte();
  10599.                     method137(inStream, k3);
  10600.                 }
  10601.                 pktType = -1;
  10602.                 return true;
  10603.             }
  10604.             if (pktType == 35) {
  10605.                 int l3 = inStream.readUnsignedByte();
  10606.                 int k11 = inStream.readUnsignedByte();
  10607.                 int j17 = inStream.readUnsignedByte();
  10608.                 int k21 = inStream.readUnsignedByte();
  10609.                 aBooleanArray876[l3] = true;
  10610.                 anIntArray873[l3] = k11;
  10611.                 anIntArray1203[l3] = j17;
  10612.                 anIntArray928[l3] = k21;
  10613.                 anIntArray1030[l3] = 0;
  10614.                 pktType = -1;
  10615.                 return true;
  10616.             }
  10617.             if (pktType == 174) {
  10618.                 int id = inStream.readUnsignedWord();
  10619.                 int type = inStream.readUnsignedByte();
  10620.                 int delay = inStream.readUnsignedWord();
  10621.                 int volume = inStream.readUnsignedByte();
  10622.                 sound[currentSound] = id;
  10623.                 soundType[currentSound] = type;
  10624.                 soundDelay[currentSound] = delay + Sounds.anIntArray326[id];
  10625.                 soundVolume[currentSound] = volume;
  10626.                 currentSound++;
  10627.                 pktType = -1;
  10628.                 return true;
  10629.             }
  10630.             if (pktType == 104) {
  10631.                 int j4 = inStream.method427();
  10632.                 int i12 = inStream.readUnsignedByteA();
  10633.                 String s6 = inStream.readString();
  10634.                 if (j4 >= 1 && j4 <= 5) {
  10635.                     if (s6.equalsIgnoreCase("null")) {
  10636.                         s6 = null;
  10637.                     }
  10638.                     atPlayerActions[j4 - 1] = s6;
  10639.                     atPlayerArray[j4 - 1] = i12 == 0;
  10640.                 }
  10641.                 pktType = -1;
  10642.                 return true;
  10643.             }
  10644.             if (pktType == 78) {
  10645.                 destX = 0;
  10646.                 pktType = -1;
  10647.                 return true;
  10648.             }
  10649.             if (pktType == 253) {
  10650.                 String s = inStream.readString();
  10651.                 if (s.endsWith(":tradereq:")) {
  10652.                     String s3 = s.substring(0, s.indexOf(":"));
  10653.                     long l17 = TextClass.longForName(s3);
  10654.                     boolean flag2 = false;
  10655.                     for (int j27 = 0; j27 < ignoreCount; j27++) {
  10656.                         if (ignoreListAsLongs[j27] != l17) {
  10657.                             continue;
  10658.                         }
  10659.                         flag2 = true;
  10660.                         break;
  10661.                     }
  10662.  
  10663.                     if (!flag2 && anInt1251 == 0) {
  10664.                         pushMessage("wishes to trade with you.", 4, s3);
  10665.                     }
  10666.                 } else if (s.endsWith(":duelreq:")) {
  10667.                     String s4 = s.substring(0, s.indexOf(":"));
  10668.                     long l18 = TextClass.longForName(s4);
  10669.                     boolean flag3 = false;
  10670.                     for (int k27 = 0; k27 < ignoreCount; k27++) {
  10671.                         if (ignoreListAsLongs[k27] != l18) {
  10672.                             continue;
  10673.                         }
  10674.                         flag3 = true;
  10675.                         break;
  10676.                     }
  10677.  
  10678.                     if (!flag3 && anInt1251 == 0) {
  10679.                         pushMessage("wishes to duel with you.", 8, s4);
  10680.                     }
  10681.                 } else if (s.endsWith(":chalreq:")) {
  10682.                     String s5 = s.substring(0, s.indexOf(":"));
  10683.                     long l19 = TextClass.longForName(s5);
  10684.                     boolean flag4 = false;
  10685.                     for (int l27 = 0; l27 < ignoreCount; l27++) {
  10686.                         if (ignoreListAsLongs[l27] != l19) {
  10687.                             continue;
  10688.                         }
  10689.                         flag4 = true;
  10690.                         break;
  10691.                     }
  10692.  
  10693.                     if (!flag4 && anInt1251 == 0) {
  10694.                         String s8 = s.substring(s.indexOf(":") + 1, s.length() - 9);
  10695.                         pushMessage(s8, 8, s5);
  10696.                     }
  10697.                 } else if (s.endsWith(":airtiara:")) {
  10698.                     tiara = 1;
  10699.                 } else if (s.endsWith(":watertiara:")) {
  10700.                     tiara = 2;
  10701.                 } else if (s.endsWith(":earthtiara:")) {
  10702.                     tiara = 3;
  10703.                 } else if (s.endsWith(":firetiara:")) {
  10704.                     tiara = 4;
  10705.                 } else if (s.endsWith(":mindtiara:")) {
  10706.                     tiara = 5;
  10707.                 } else if (s.endsWith(":bodytiara:")) {
  10708.                     tiara = 6;
  10709.                 } else if (s.endsWith(":cosmictiara:")) {
  10710.                     tiara = 7;
  10711.                 } else if (s.endsWith(":chaostiara:")) {
  10712.                     tiara = 8;
  10713.                 } else if (s.endsWith(":naturetiara:")) {
  10714.                     tiara = 9;
  10715.                 } else if (s.endsWith(":lawtiara:")) {
  10716.                     tiara = 10;
  10717.                 } else if (s.endsWith(":deathtiara:")) {
  10718.                     tiara = 11;
  10719.                 } else if (s.endsWith(":notiara:")) {
  10720.                     tiara = 0;
  10721.                 } else {
  10722.                     pushMessage(s, 0, "");
  10723.                 }
  10724.                 pktType = -1;
  10725.                 // serverMessage(s);
  10726.  
  10727.                 return true;
  10728.             }
  10729.             if (pktType == 1) {
  10730.                 for (int k4 = 0; k4 < playerArray.length; k4++) {
  10731.                     if (playerArray[k4] != null) {
  10732.                         playerArray[k4].anim = -1;
  10733.                     }
  10734.                 }
  10735.  
  10736.                 for (int j12 = 0; j12 < npcArray.length; j12++) {
  10737.                     if (npcArray[j12] != null) {
  10738.                         npcArray[j12].anim = -1;
  10739.                     }
  10740.                 }
  10741.  
  10742.                 pktType = -1;
  10743.                 return true;
  10744.             }
  10745.             if (pktType == 50) {
  10746.                 long l4 = inStream.readQWord();
  10747.                 int i18 = inStream.readUnsignedByte();
  10748.                 String s7 = TextClass.fixName(TextClass.nameForLong(l4));
  10749.                 for (int k24 = 0; k24 < friendsCount; k24++) {
  10750.                     if (l4 != friendsListAsLongs[k24]) {
  10751.                         continue;
  10752.                     }
  10753.                     if (friendsNodeIDs[k24] != i18) {
  10754.                         friendsNodeIDs[k24] = i18;
  10755.                         needDrawTabArea = true;
  10756.                         if (i18 >= 2) {
  10757.                             pushMessage(s7 + " has logged in.", 5, "");
  10758.                         }
  10759.                         if (i18 <= 1) {
  10760.                             pushMessage(s7 + " has logged out.", 5, "");
  10761.                         }
  10762.                     }
  10763.                     s7 = null;
  10764.                     break;
  10765.                 }
  10766.  
  10767.                 if (s7 != null && friendsCount < 200) {
  10768.                     friendsListAsLongs[friendsCount] = l4;
  10769.                     friendsList[friendsCount] = s7;
  10770.                     friendsNodeIDs[friendsCount] = i18;
  10771.                     friendsCount++;
  10772.                     needDrawTabArea = true;
  10773.                 }
  10774.                 for (boolean flag6 = false; !flag6;) {
  10775.                     flag6 = true;
  10776.                     for (int k29 = 0; k29 < friendsCount - 1; k29++) {
  10777.                         if (friendsNodeIDs[k29] != nodeID && friendsNodeIDs[k29 + 1] == nodeID || friendsNodeIDs[k29] == 0 && friendsNodeIDs[k29 + 1] != 0) {
  10778.                             int j31 = friendsNodeIDs[k29];
  10779.                             friendsNodeIDs[k29] = friendsNodeIDs[k29 + 1];
  10780.                             friendsNodeIDs[k29 + 1] = j31;
  10781.                             String s10 = friendsList[k29];
  10782.                             friendsList[k29] = friendsList[k29 + 1];
  10783.                             friendsList[k29 + 1] = s10;
  10784.                             long l32 = friendsListAsLongs[k29];
  10785.                             friendsListAsLongs[k29] = friendsListAsLongs[k29 + 1];
  10786.                             friendsListAsLongs[k29 + 1] = l32;
  10787.                             needDrawTabArea = true;
  10788.                             flag6 = false;
  10789.                         }
  10790.                     }
  10791.  
  10792.                 }
  10793.  
  10794.                 pktType = -1;
  10795.                 return true;
  10796.             }
  10797.             if (pktType == 110) {
  10798.                 if (tabID == 12) {
  10799.                     needDrawTabArea = true;
  10800.                 }
  10801.                 energy = inStream.readUnsignedByte();
  10802.                 pktType = -1;
  10803.                 return true;
  10804.             }
  10805.             if (pktType == 254) {
  10806.                 anInt855 = inStream.readUnsignedByte();
  10807.                 if (anInt855 == 1) {
  10808.                     anInt1222 = inStream.readUnsignedWord();
  10809.                 }
  10810.                 if (anInt855 >= 2 && anInt855 <= 6) {
  10811.                     if (anInt855 == 2) {
  10812.                         anInt937 = 64;
  10813.                         anInt938 = 64;
  10814.                     }
  10815.                     if (anInt855 == 3) {
  10816.                         anInt937 = 0;
  10817.                         anInt938 = 64;
  10818.                     }
  10819.                     if (anInt855 == 4) {
  10820.                         anInt937 = 128;
  10821.                         anInt938 = 64;
  10822.                     }
  10823.                     if (anInt855 == 5) {
  10824.                         anInt937 = 64;
  10825.                         anInt938 = 0;
  10826.                     }
  10827.                     if (anInt855 == 6) {
  10828.                         anInt937 = 64;
  10829.                         anInt938 = 128;
  10830.                     }
  10831.                     anInt855 = 2;
  10832.                     anInt934 = inStream.readUnsignedWord();
  10833.                     anInt935 = inStream.readUnsignedWord();
  10834.                     anInt936 = inStream.readUnsignedByte();
  10835.                 }
  10836.                 if (anInt855 == 10) {
  10837.                     anInt933 = inStream.readUnsignedWord();
  10838.                 }
  10839.                 pktType = -1;
  10840.                 return true;
  10841.             }
  10842.             if (pktType == 248) {
  10843.                 int i5 = inStream.method435();
  10844.                 int k12 = inStream.readUnsignedWord();
  10845.                 if (backDialogID != -1) {
  10846.                     backDialogID = -1;
  10847.                     inputTaken = true;
  10848.                 }
  10849.                 if (fullScreenBackDialogID != -1) {
  10850.                     fullScreenBackDialogID = -1;
  10851.                     welcomeScreenRaised = true;
  10852.                 }
  10853.                 if (fullScreenInterfaceId != -1) {
  10854.                     fullScreenInterfaceId = -1;
  10855.                 }
  10856.                 if (openInterfaceID != i5) {
  10857.                     openInterfaceID = i5;
  10858.                 }
  10859.                 if (invOverlayInterfaceID != k12) {
  10860.                     invOverlayInterfaceID = k12;
  10861.                 }
  10862.                 if (inputDialogState != 0) {
  10863.                     inputDialogState = 0;
  10864.                     inputTaken = true;
  10865.                 }
  10866.                 needDrawTabArea = true;
  10867.                 tabAreaAltered = true;
  10868.                 aBoolean1149 = false;
  10869.                 pktType = -1;
  10870.                 return true;
  10871.             }
  10872.             if (pktType == 79) {
  10873.                 int j5 = inStream.method434();
  10874.                 int l12 = inStream.method435();
  10875.                 RSInterface class9_3 = RSInterface.interfaceCache[j5];
  10876.                 if (class9_3 != null && class9_3.type == 0) {
  10877.                     if (l12 < 0) {
  10878.                         l12 = 0;
  10879.                     }
  10880.                     if (l12 > class9_3.scrollMax - class9_3.height) {
  10881.                         l12 = class9_3.scrollMax - class9_3.height;
  10882.                     }
  10883.                     class9_3.scrollPosition = l12;
  10884.                 }
  10885.                 pktType = -1;
  10886.                 return true;
  10887.             }
  10888.             if (pktType == 68) {
  10889.                 for (int k5 = 0; k5 < variousSettings.length; k5++) {
  10890.                     if (variousSettings[k5] != anIntArray1045[k5]) {
  10891.                         variousSettings[k5] = anIntArray1045[k5];
  10892.                         method33(k5);
  10893.                         needDrawTabArea = true;
  10894.                     }
  10895.                 }
  10896.  
  10897.                 pktType = -1;
  10898.                 return true;
  10899.             }
  10900.             if (pktType == 196) {
  10901.                 long l5 = inStream.readQWord();
  10902.                 @SuppressWarnings("unused")
  10903.                 int j18 = inStream.readDWord();
  10904.                 int l21 = inStream.readUnsignedByte();
  10905.                 boolean flag5 = false;
  10906.                 if (l21 <= 1) {
  10907.                     for (int l29 = 0; l29 < ignoreCount; l29++) {
  10908.                         if (ignoreListAsLongs[l29] != l5) {
  10909.                             continue;
  10910.                         }
  10911.                         flag5 = true;
  10912.  
  10913.                     }
  10914.                 }
  10915.                 if (!flag5 && anInt1251 == 0) {
  10916.                     try {
  10917.                         String s9 = TextInput.method525(pktSize - 13, inStream);
  10918.                         if (l21 == 2 || l21 == 3) {
  10919.                             pushMessage(s9, 7, "@cr2@" + TextClass.fixName(TextClass.nameForLong(l5)));
  10920.                         } else if (l21 == 1) {
  10921.                             pushMessage(s9, 7, "@cr1@" + TextClass.fixName(TextClass.nameForLong(l5)));
  10922.                         } else {
  10923.                             pushMessage(s9, 3, TextClass.fixName(TextClass.nameForLong(l5)));
  10924.                         }
  10925.                     } catch (Exception exception1) {
  10926.                         Signlink.reporterror("cde1");
  10927.                     }
  10928.                 }
  10929.                 pktType = -1;
  10930.                 return true;
  10931.             }
  10932.             if (pktType == 85) {
  10933.                 anInt1269 = inStream.method427();
  10934.                 anInt1268 = inStream.method427();
  10935.                 pktType = -1;
  10936.                 return true;
  10937.             }
  10938.             if (pktType == 24) {
  10939.                 anInt1054 = inStream.method428();
  10940.                 if (anInt1054 == tabID) {
  10941.                     if (anInt1054 == 3) {
  10942.                         tabID = 1;
  10943.                     } else {
  10944.                         tabID = 3;
  10945.                     }
  10946.                     needDrawTabArea = true;
  10947.                 }
  10948.                 pktType = -1;
  10949.                 return true;
  10950.             }
  10951.             if (pktType == 246) {
  10952.                 int i6 = inStream.method434();
  10953.                 int i13 = inStream.readUnsignedWord();
  10954.                 int k18 = inStream.readUnsignedWord();
  10955.                 if (k18 == 65535) {
  10956.                     RSInterface.interfaceCache[i6].anInt233 = 0;
  10957.                     pktType = -1;
  10958.                     return true;
  10959.                 } else {
  10960.                     ItemDef itemDef = ItemDef.forID(k18);
  10961.                     RSInterface.interfaceCache[i6].anInt233 = 4;
  10962.                     RSInterface.interfaceCache[i6].mediaID = k18;
  10963.                     RSInterface.interfaceCache[i6].anInt270 = itemDef.modelRotation1;
  10964.                     RSInterface.interfaceCache[i6].anInt271 = itemDef.modelRotation2;
  10965.                     RSInterface.interfaceCache[i6].anInt269 = itemDef.modelZoom * 100 / i13;
  10966.                     pktType = -1;
  10967.                     return true;
  10968.                 }
  10969.             }
  10970.             if (pktType == 171) {
  10971.                 boolean flag1 = inStream.readUnsignedByte() == 1;
  10972.                 int j13 = inStream.readUnsignedWord();
  10973.                 RSInterface.interfaceCache[j13].aBoolean266 = flag1;
  10974.                 pktType = -1;
  10975.                 return true;
  10976.             }
  10977.             if (pktType == 142) {
  10978.                 int j6 = inStream.method434();
  10979.                 method60(j6);
  10980.                 if (backDialogID != -1) {
  10981.                     backDialogID = -1;
  10982.                     inputTaken = true;
  10983.                 }
  10984.                 if (fullScreenBackDialogID != -1) {
  10985.                     fullScreenBackDialogID = -1;
  10986.                     welcomeScreenRaised = true;
  10987.                 }
  10988.                 if (fullScreenInterfaceId != -1) {
  10989.                     fullScreenInterfaceId = -1;
  10990.                 }
  10991.                 if (openInterfaceID != -1) {
  10992.                     openInterfaceID = -1;
  10993.                 }
  10994.                 if (invOverlayInterfaceID != j6) {
  10995.                     invOverlayInterfaceID = j6;
  10996.                 }
  10997.                 if (inputDialogState != 0) {
  10998.                     inputDialogState = 0;
  10999.                     inputTaken = true;
  11000.                 }
  11001.                 needDrawTabArea = true;
  11002.                 tabAreaAltered = true;
  11003.                 aBoolean1149 = false;
  11004.                 pktType = -1;
  11005.                 return true;
  11006.             }
  11007.             if (pktType == 126) {
  11008.                 String s1 = inStream.readString();
  11009.                 int k13 = inStream.method435();
  11010.                 RSInterface.interfaceCache[k13].disabledText = s1;
  11011.                 if (RSInterface.interfaceCache[k13].parentID == tabInterfaceIDs[tabID]) {
  11012.                     needDrawTabArea = true;
  11013.                 }
  11014.                 pktType = -1;
  11015.                 return true;
  11016.             }
  11017.             if (pktType == 206) {
  11018.                 publicChatMode = inStream.readUnsignedByte();
  11019.                 privateChatMode = inStream.readUnsignedByte();
  11020.                 tradeMode = inStream.readUnsignedByte();
  11021.                 aBoolean1233 = true;
  11022.                 inputTaken = true;
  11023.                 pktType = -1;
  11024.                 return true;
  11025.             }
  11026.             if (pktType == 240) {
  11027.                 if (tabID == 12) {
  11028.                     needDrawTabArea = true;
  11029.                 }
  11030.                 weight = inStream.readSignedWord();
  11031.                 pktType = -1;
  11032.                 return true;
  11033.             }
  11034.             if (pktType == 69) {
  11035.                 int k9 = inStream.readUnsignedWord();
  11036.                 int k15 = inStream.readUnsignedWord();
  11037.                 method60(k15);
  11038.                 if (k9 != -1)
  11039.                     method60(k9);
  11040.                 if (openInterfaceID != -1) {
  11041.                     openInterfaceID = -1;
  11042.                 }
  11043.                 if (invOverlayInterfaceID != -1) {
  11044.                     invOverlayInterfaceID = -1;
  11045.                 }
  11046.                 if (backDialogID != -1) {
  11047.                     backDialogID = -1;
  11048.                 }
  11049.                 if (fullScreenBackDialogID != k15) {
  11050.                     fullScreenBackDialogID = k15;
  11051.                 }
  11052.                 if (fullScreenInterfaceId != k15) {
  11053.                     fullScreenInterfaceId = k9;
  11054.                 }
  11055.                 inputDialogState = 0;
  11056.                 aBoolean1149 = false;
  11057.                 pktType = -1;
  11058.                 return true;
  11059.             }
  11060.             if (pktType == 8) {
  11061.                 int k6 = inStream.method436();
  11062.                 int l13 = inStream.readUnsignedWord();
  11063.                 RSInterface.interfaceCache[k6].anInt233 = 1;
  11064.                 RSInterface.interfaceCache[k6].mediaID = l13;
  11065.                 pktType = -1;
  11066.                 return true;
  11067.             }
  11068.             if (pktType == 122) {
  11069.                 int l6 = inStream.method436();
  11070.                 int i14 = inStream.method436();
  11071.                 int i19 = i14 >> 10 & 0x1f;
  11072.                 int i22 = i14 >> 5 & 0x1f;
  11073.                 int l24 = i14 & 0x1f;
  11074.                 RSInterface.interfaceCache[l6].textColor = (i19 << 19) + (i22 << 11) + (l24 << 3);
  11075.                 pktType = -1;
  11076.                 return true;
  11077.             }
  11078.             if (pktType == 53) {
  11079.                 needDrawTabArea = true;
  11080.                 int i7 = inStream.readUnsignedWord();
  11081.                 RSInterface class9_1 = RSInterface.interfaceCache[i7];
  11082.                 int j19 = inStream.readUnsignedWord();
  11083.                 for (int j22 = 0; j22 < j19; j22++) {
  11084.                     int i25 = inStream.readUnsignedByte();
  11085.                     if (i25 == 255) {
  11086.                         i25 = inStream.method440();
  11087.                     }
  11088.                     class9_1.inv[j22] = inStream.method436();
  11089.                     class9_1.invStackSizes[j22] = i25;
  11090.                 }
  11091.  
  11092.                 for (int j25 = j19; j25 < class9_1.inv.length; j25++) {
  11093.                     class9_1.inv[j25] = 0;
  11094.                     class9_1.invStackSizes[j25] = 0;
  11095.                 }
  11096.  
  11097.                 pktType = -1;
  11098.                 return true;
  11099.             }
  11100.             if (pktType == 230) {
  11101.                 int j7 = inStream.method435();
  11102.                 int j14 = inStream.readUnsignedWord();
  11103.                 int k19 = inStream.readUnsignedWord();
  11104.                 int k22 = inStream.method436();
  11105.                 RSInterface.interfaceCache[j14].anInt270 = k19;
  11106.                 RSInterface.interfaceCache[j14].anInt271 = k22;
  11107.                 RSInterface.interfaceCache[j14].anInt269 = j7;
  11108.                 pktType = -1;
  11109.                 return true;
  11110.             }
  11111.             if (pktType == 221) {
  11112.                 anInt900 = inStream.readUnsignedByte();
  11113.                 needDrawTabArea = true;
  11114.                 pktType = -1;
  11115.                 return true;
  11116.             }
  11117.             if (pktType == 177) {
  11118.                 aBoolean1160 = true;
  11119.                 anInt995 = inStream.readUnsignedByte();
  11120.                 anInt996 = inStream.readUnsignedByte();
  11121.                 anInt997 = inStream.readUnsignedWord();
  11122.                 anInt998 = inStream.readUnsignedByte();
  11123.                 anInt999 = inStream.readUnsignedByte();
  11124.                 if (anInt999 >= 100) {
  11125.                     int k7 = anInt995 * 128 + 64;
  11126.                     int k14 = anInt996 * 128 + 64;
  11127.                     int i20 = method42(plane, k14, k7) - anInt997;
  11128.                     int l22 = k7 - xCameraPos;
  11129.                     int k25 = i20 - zCameraPos;
  11130.                     int j28 = k14 - yCameraPos;
  11131.                     int i30 = (int) Math.sqrt(l22 * l22 + j28 * j28);
  11132.                     yCameraCurve = (int) (Math.atan2(k25, i30) * 325.94900000000001D) & 0x7ff;
  11133.                     xCameraCurve = (int) (Math.atan2(l22, j28) * -325.94900000000001D) & 0x7ff;
  11134.                     if (yCameraCurve < 128) {
  11135.                         yCameraCurve = 128;
  11136.                     }
  11137.                     if (yCameraCurve > 383) {
  11138.                         yCameraCurve = 383;
  11139.                     }
  11140.                 }
  11141.                 pktType = -1;
  11142.                 return true;
  11143.             }
  11144.             if (pktType == 249) {
  11145.                 anInt1046 = inStream.readUnsignedByteA();
  11146.                 unknownInt10 = inStream.method436();
  11147.                 pktType = -1;
  11148.                 return true;
  11149.             }
  11150.             if (pktType == 65) {
  11151.                 updateNPCs(inStream, pktSize);
  11152.                 pktType = -1;
  11153.                 return true;
  11154.             }
  11155.             if (pktType == 27) {
  11156.                 messagePromptRaised = false;
  11157.                 inputDialogState = 1;
  11158.                 amountOrNameInput = "";
  11159.                 inputTaken = true;
  11160.                 pktType = -1;
  11161.                 return true;
  11162.             }
  11163.             if (pktType == 187) {
  11164.                 messagePromptRaised = false;
  11165.                 inputDialogState = 2;
  11166.                 amountOrNameInput = "";
  11167.                 inputTaken = true;
  11168.                 pktType = -1;
  11169.                 return true;
  11170.             }
  11171.             if (pktType == 97) {
  11172.                 int l7 = inStream.readUnsignedWord();
  11173.                 method60(l7);
  11174.                 if (invOverlayInterfaceID != -1) {
  11175.                     invOverlayInterfaceID = -1;
  11176.                     needDrawTabArea = true;
  11177.                     tabAreaAltered = true;
  11178.                 }
  11179.                 if (backDialogID != -1) {
  11180.                     backDialogID = -1;
  11181.                     inputTaken = true;
  11182.                 }
  11183.                 if (fullScreenBackDialogID != -1) {
  11184.                     fullScreenBackDialogID = -1;
  11185.                     welcomeScreenRaised = true;
  11186.                 }
  11187.                 if (fullScreenInterfaceId != -1) {
  11188.                     fullScreenInterfaceId = -1;
  11189.                 }
  11190.                 /*if (openInterfaceID != l7) {
  11191.                     openInterfaceID = l7;
  11192.                 }*/
  11193.                 if (inputDialogState != 0) {
  11194.                     inputDialogState = 0;
  11195.                     inputTaken = true;
  11196.                 }
  11197.                 /*
  11198.                  * 15244 = main Interface ID
  11199.                  * 17511 = Question Type
  11200.                  * 15819 = Christmas Type
  11201.                  * 15812 = Security Type
  11202.                  * 15801 = Item Scam Type
  11203.                  * 15791 = Password Safety
  11204.                  * 15774 = Good/Bad Password
  11205.                  * 15767 = Drama Type
  11206.                  */
  11207.                
  11208.                 if (l7 == 15244) {
  11209.                     openInterfaceID = 15812;//secondary/bottom part
  11210.                     fullScreenBackDialogID = 15244;
  11211.                 /*} else if (l7 == 17511) {
  11212.                     openInterfaceID = 17511;
  11213.                     fullScreenBackDialogID = 15244;
  11214.                 } else if (l7 == 15819) {
  11215.                     openInterfaceID = 15819;
  11216.                     fullScreenBackDialogID = 15244;
  11217.                 } else if (l7 == 15812) {
  11218.                     openInterfaceID = 15812;
  11219.                     fullScreenBackDialogID = 15244;
  11220.                 } else if (l7 == 15801) {
  11221.                     openInterfaceID = 15801;
  11222.                     fullScreenBackDialogID = 15244;
  11223.                 } else if (l7 == 15791) {
  11224.                     openInterfaceID = 15791;
  11225.                     fullScreenBackDialogID = 15244;
  11226.                 } else if (l7 == 15774) {
  11227.                     openInterfaceID = 15774;
  11228.                     fullScreenBackDialogID = 15244;
  11229.                 } else if (l7 == 15767) {
  11230.                     openInterfaceID = 15767;
  11231.                     fullScreenBackDialogID = 15244;*/
  11232.                 } else {
  11233.                     openInterfaceID = l7;
  11234.                 }
  11235.                 aBoolean1149 = false;
  11236.                 pktType = -1;
  11237.                 return true;
  11238.             }
  11239.             if (pktType == 218) {
  11240.                 int i8 = inStream.method438();
  11241.                 dialogID = i8;
  11242.                 inputTaken = true;
  11243.                 pktType = -1;
  11244.                 return true;
  11245.             }
  11246.             if (pktType == 87) {
  11247.                 int j8 = inStream.method434();
  11248.                 int l14 = inStream.method439();
  11249.                 anIntArray1045[j8] = l14;
  11250.                 if (variousSettings[j8] != l14) {
  11251.                     variousSettings[j8] = l14;
  11252.                     method33(j8);
  11253.                     needDrawTabArea = true;
  11254.                     if (dialogID != -1) {
  11255.                         inputTaken = true;
  11256.                     }
  11257.                 }
  11258.                 pktType = -1;
  11259.                 return true;
  11260.             }
  11261.             if (pktType == 36) {
  11262.                 int k8 = inStream.method434();
  11263.                 byte byte0 = inStream.readSignedByte();
  11264.                 anIntArray1045[k8] = byte0;
  11265.                 if (variousSettings[k8] != byte0) {
  11266.                     variousSettings[k8] = byte0;
  11267.                     method33(k8);
  11268.                     needDrawTabArea = true;
  11269.                     if (dialogID != -1) {
  11270.                         inputTaken = true;
  11271.                     }
  11272.                 }
  11273.                 pktType = -1;
  11274.                 return true;
  11275.             }
  11276.             if (pktType == 61) {
  11277.                 anInt1055 = inStream.readUnsignedByte();
  11278.                 pktType = -1;
  11279.                 return true;
  11280.             }
  11281.             if (pktType == 200) {
  11282.                 int l8 = inStream.readUnsignedWord();
  11283.                 int i15 = inStream.readSignedWord();
  11284.                 RSInterface class9_4 = RSInterface.interfaceCache[l8];
  11285.                 class9_4.anInt257 = i15;
  11286.                 if (i15 == -1) {
  11287.                     class9_4.anInt246 = 0;
  11288.                     class9_4.anInt208 = 0;
  11289.                 }
  11290.                 pktType = -1;
  11291.                 return true;
  11292.             }
  11293.             if (pktType == 219) {
  11294.                 if (invOverlayInterfaceID != -1) {
  11295.                     invOverlayInterfaceID = -1;
  11296.                     needDrawTabArea = true;
  11297.                     tabAreaAltered = true;
  11298.                 }
  11299.                 if (backDialogID != -1) {
  11300.                     backDialogID = -1;
  11301.                     inputTaken = true;
  11302.                 }
  11303.                 if (fullScreenBackDialogID != -1) {
  11304.                     fullScreenBackDialogID = -1;
  11305.                     welcomeScreenRaised = true;
  11306.                 }
  11307.                 if (fullScreenInterfaceId != -1) {
  11308.                     fullScreenInterfaceId = -1;
  11309.                 }
  11310.                 if (openInterfaceID != -1) {
  11311.                     openInterfaceID = -1;
  11312.                 }
  11313.                 if (inputDialogState != 0) {
  11314.                     inputDialogState = 0;
  11315.                     inputTaken = true;
  11316.                 }
  11317.                 aBoolean1149 = false;
  11318.                 pktType = -1;
  11319.                 return true;
  11320.             }
  11321.             if (pktType == 34) {
  11322.                 needDrawTabArea = true;
  11323.                 int i9 = inStream.readUnsignedWord();
  11324.                 RSInterface class9_2 = RSInterface.interfaceCache[i9];
  11325.                 while (inStream.currentOffset < pktSize) {
  11326.                     int j20 = inStream.method422();
  11327.                     int i23 = inStream.readUnsignedWord();
  11328.                     int l25 = inStream.readUnsignedByte();
  11329.                     if (l25 == 255) {
  11330.                         l25 = inStream.readDWord();
  11331.                     }
  11332.                     if (j20 >= 0 && j20 < class9_2.inv.length) {
  11333.                         class9_2.inv[j20] = i23;
  11334.                         class9_2.invStackSizes[j20] = l25;
  11335.                     }
  11336.                 }
  11337.                 pktType = -1;
  11338.                 return true;
  11339.             }
  11340.             if (pktType == 105 || pktType == 84 || pktType == 147 || pktType == 215 || pktType == 4 || pktType == 117 || pktType == 156 || pktType == 44 || pktType == 160 || pktType == 101 || pktType == 151) {
  11341.                 method137(inStream, pktType);
  11342.                 pktType = -1;
  11343.                 return true;
  11344.             }
  11345.             if (pktType == 106) {
  11346.                 tabID = inStream.method427();
  11347.                 needDrawTabArea = true;
  11348.                 tabAreaAltered = true;
  11349.                 pktType = -1;
  11350.                 return true;
  11351.             }
  11352.             if (pktType == 164) {
  11353.                 int j9 = inStream.method434();
  11354.                 method60(j9);
  11355.                 if (invOverlayInterfaceID != -1) {
  11356.                     invOverlayInterfaceID = -1;
  11357.                     needDrawTabArea = true;
  11358.                     tabAreaAltered = true;
  11359.                 }
  11360.                 if (fullScreenBackDialogID != -1) {
  11361.                     fullScreenBackDialogID = -1;
  11362.                     welcomeScreenRaised = true;
  11363.                 }
  11364.                 if (fullScreenInterfaceId != -1) {
  11365.                     fullScreenInterfaceId = -1;
  11366.                 }
  11367.                 if (openInterfaceID != -1) {
  11368.                     openInterfaceID = -1;
  11369.                 }
  11370.                 if (backDialogID != j9) {
  11371.                     backDialogID = j9;
  11372.                 }
  11373.                 inputTaken = true;
  11374.                 aBoolean1149 = false;
  11375.                 pktType = -1;
  11376.                 return true;
  11377.             }
  11378.             String s2 = "T1 - " + pktType + "," + pktSize + " - " + anInt842 + "," + anInt843 + " - ";
  11379.             for (int j15 = 0; j15 < pktSize && j15 < 50; j15++) {
  11380.                 s2 = s2 + inStream.buffer[j15] + ",";
  11381.             }
  11382.             Signlink.reporterror(s2);
  11383.             resetLogout();
  11384.         } catch (IOException _ex) {
  11385.             dropClient();
  11386.         } catch (Exception exception) {
  11387.             String s2 = "T2 - " + pktType + "," + anInt842 + "," + anInt843 + " - " + pktSize + "," + (baseX + myPlayer.smallX[0]) + "," + (baseY + myPlayer.smallY[0]) + " - ";
  11388.             for (int j15 = 0; j15 < pktSize && j15 < 50; j15++) {
  11389.                 s2 = s2 + inStream.buffer[j15] + ",";
  11390.             }
  11391.  
  11392.             Signlink.reporterror(s2);
  11393.             resetLogout();
  11394.         }
  11395.         return true;
  11396.     }
  11397.  
  11398.     public void method146() {
  11399.         anInt1265++;
  11400.         method47(true);
  11401.         method26(true);
  11402.         method47(false);
  11403.         method26(false);
  11404.         method55();
  11405.         method104();
  11406.         if (!aBoolean1160) {
  11407.             int i = anInt1184;
  11408.             if (anInt984 / 256 > i) {
  11409.                 i = anInt984 / 256;
  11410.             }
  11411.             if (aBooleanArray876[4] && anIntArray1203[4] + 128 > i) {
  11412.                 i = anIntArray1203[4] + 128;
  11413.             }
  11414.             int k = minimapInt1 + anInt896 & 0x7ff;
  11415.             setCameraPos(600 + i * 3, i, anInt1014, method42(plane, myPlayer.y, myPlayer.x) - 50, k, anInt1015);
  11416.         }
  11417.         int j;
  11418.         if (!aBoolean1160) {
  11419.             j = method120();
  11420.         } else {
  11421.             j = method121();
  11422.         }
  11423.         int l = xCameraPos;
  11424.         int i1 = zCameraPos;
  11425.         int j1 = yCameraPos;
  11426.         int k1 = yCameraCurve;
  11427.         int l1 = xCameraCurve;
  11428.         for (int i2 = 0; i2 < 5; i2++) {
  11429.             if (aBooleanArray876[i2]) {
  11430.                 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]);
  11431.                 if (i2 == 0) {
  11432.                     xCameraPos += j2;
  11433.                 }
  11434.                 if (i2 == 1) {
  11435.                     zCameraPos += j2;
  11436.                 }
  11437.                 if (i2 == 2) {
  11438.                     yCameraPos += j2;
  11439.                 }
  11440.                 if (i2 == 3) {
  11441.                     xCameraCurve = xCameraCurve + j2 & 0x7ff;
  11442.                 }
  11443.                 if (i2 == 4) {
  11444.                     yCameraCurve += j2;
  11445.                     if (yCameraCurve < 128) {
  11446.                         yCameraCurve = 128;
  11447.                     }
  11448.                     if (yCameraCurve > 383) {
  11449.                         yCameraCurve = 383;
  11450.                     }
  11451.                 }
  11452.             }
  11453.         }
  11454.  
  11455.         int k2 = Texture.anInt1481;
  11456.         Model.aBoolean1684 = true;
  11457.         Model.anInt1687 = 0;
  11458.         Model.anInt1685 = super.mouseX - 4;
  11459.         Model.anInt1686 = super.mouseY - 4;
  11460.         DrawingArea.setAllPixelsToZero();
  11461.         // xxx disables graphics if(graphicsEnabled){
  11462.         worldController.method313(xCameraPos, yCameraPos, xCameraCurve, zCameraPos, j, yCameraCurve);
  11463.         worldController.clearObj5Cache();
  11464.         updateEntities();
  11465.         drawHeadIcon();
  11466.         method37(k2);
  11467.         draw3dScreen();
  11468.         aRSImageProducer_1165.drawGraphics(4, super.graphics, 4);
  11469.         xCameraPos = l;
  11470.         zCameraPos = i1;
  11471.         yCameraPos = j1;
  11472.         yCameraCurve = k1;
  11473.         xCameraCurve = l1;
  11474.         // }
  11475.     }
  11476.  
  11477.     public void closeOpenInterfaces() {
  11478.         stream.createFrame(130);
  11479.         if (invOverlayInterfaceID != -1) {
  11480.             invOverlayInterfaceID = -1;
  11481.             needDrawTabArea = true;
  11482.             aBoolean1149 = false;
  11483.             tabAreaAltered = true;
  11484.         }
  11485.         if (backDialogID != -1) {
  11486.             backDialogID = -1;
  11487.             inputTaken = true;
  11488.             aBoolean1149 = false;
  11489.         }
  11490.         if (fullScreenBackDialogID != -1) {
  11491.             fullScreenBackDialogID = -1;
  11492.             welcomeScreenRaised = true;
  11493.         }
  11494.         if (fullScreenInterfaceId != -1) {
  11495.             fullScreenInterfaceId = -1;
  11496.         }
  11497.         if (openInterfaceID != -1)
  11498.             openInterfaceID = -1;
  11499.     }
  11500.  
  11501.     public Game() {
  11502.         server = ClientSettings.SERVER_IP;
  11503.         anIntArrayArray825 = new int[104][104];
  11504.         friendsNodeIDs = new int[200];
  11505.         groundArray = new NodeList[4][104][104];
  11506.         aBoolean831 = false;
  11507.         aStream_834 = new Stream(new byte[5000]);
  11508.         npcArray = new NPC[16384];
  11509.         npcIndices = new int[16384];
  11510.         anIntArray840 = new int[1000];
  11511.         aStream_847 = Stream.create();
  11512.         aBoolean848 = true;
  11513.         openInterfaceID = -1;
  11514.         currentExp = new int[Skills.skillsCount];
  11515.         aBoolean872 = false;
  11516.         anIntArray873 = new int[5];
  11517.         anInt874 = -1;
  11518.         aBooleanArray876 = new boolean[5];
  11519.         drawFlames = false;
  11520.         reportAbuseInput = "";
  11521.         unknownInt10 = -1;
  11522.         menuOpen = false;
  11523.         inputString = "";
  11524.         maxPlayers = 2048;
  11525.         myPlayerIndex = 2047;
  11526.         playerArray = new Player[maxPlayers];
  11527.         playerIndices = new int[maxPlayers];
  11528.         anIntArray894 = new int[maxPlayers];
  11529.         aStreamArray895s = new Stream[maxPlayers];
  11530.         anInt897 = 1;
  11531.         anIntArrayArray901 = new int[104][104];
  11532.         anInt902 = 0x766654;
  11533.         aByteArray912 = new byte[16384];
  11534.         currentStats = new int[Skills.skillsCount];
  11535.         ignoreListAsLongs = new long[100];
  11536.         loadingError = false;
  11537.         anInt927 = 0x332d25;
  11538.         anIntArray928 = new int[5];
  11539.         anIntArrayArray929 = new int[104][104];
  11540.         chatTypes = new int[100];
  11541.         chatNames = new String[100];
  11542.         chatMessages = new String[100];
  11543.         sideIcons = new Background[13];
  11544.         aBoolean954 = true;
  11545.         friendsListAsLongs = new long[200];
  11546.         currentSong = -1;
  11547.         drawingFlames = false;
  11548.         spriteDrawX = -1;
  11549.         spriteDrawY = -1;
  11550.         anIntArray968 = new int[33];
  11551.         anIntArray969 = new int[256];
  11552.         decompressors = new Decompressor[5];
  11553.         variousSettings = new int[2000];
  11554.         aBoolean972 = false;
  11555.         anInt975 = 50;
  11556.         anIntArray976 = new int[anInt975];
  11557.         anIntArray977 = new int[anInt975];
  11558.         anIntArray978 = new int[anInt975];
  11559.         anIntArray979 = new int[anInt975];
  11560.         anIntArray980 = new int[anInt975];
  11561.         anIntArray981 = new int[anInt975];
  11562.         anIntArray982 = new int[anInt975];
  11563.         aStringArray983 = new String[anInt975];
  11564.         anInt985 = -1;
  11565.         hitMarks = new Sprite[20];
  11566.         anIntArray990 = new int[5];
  11567.         anInt1002 = 0x23201b;
  11568.         amountOrNameInput = "";
  11569.         aClass19_1013 = new NodeList();
  11570.         aBoolean1017 = false;
  11571.         anInt1018 = -1;
  11572.         anIntArray1030 = new int[5];
  11573.         aBoolean1031 = false;
  11574.         mapFunctions = new Sprite[100];
  11575.         dialogID = -1;
  11576.         maxStats = new int[Skills.skillsCount];
  11577.         anIntArray1045 = new int[2000];
  11578.         aBoolean1047 = true;
  11579.         anIntArray1052 = new int[151];
  11580.         anInt1054 = -1;
  11581.         aClass19_1056 = new NodeList();
  11582.         anIntArray1057 = new int[33];
  11583.         aClass9_1059 = new RSInterface();
  11584.         mapScenes = new Background[100];
  11585.         anInt1063 = 0x4d4233;
  11586.         anIntArray1065 = new int[7];
  11587.         anIntArray1072 = new int[1000];
  11588.         anIntArray1073 = new int[1000];
  11589.         aBoolean1080 = false;
  11590.         friendsList = new String[200];
  11591.         inStream = Stream.create();
  11592.         expectedCRCs = new int[9];
  11593.         menuActionCmd2 = new int[500];
  11594.         menuActionCmd3 = new int[500];
  11595.         menuActionID = new int[500];
  11596.         menuActionCmd1 = new int[500];
  11597.         headIcons = new Sprite[20];
  11598.         headIconsHint = new Sprite[20];
  11599.         skullIcons = new Sprite[20];
  11600.         tabAreaAltered = false;
  11601.         aString1121 = "";
  11602.         atPlayerActions = new String[5];
  11603.         atPlayerArray = new boolean[5];
  11604.         anIntArrayArrayArray1129 = new int[4][13][13];
  11605.         anInt1132 = 2;
  11606.         aClass30_Sub2_Sub1_Sub1Array1140 = new Sprite[1000];
  11607.         aBoolean1141 = false;
  11608.         aBoolean1149 = false;
  11609.         crosses = new Sprite[8];
  11610.         musicEnabled = true;
  11611.         needDrawTabArea = false;
  11612.         loggedIn = false;
  11613.         canMute = false;
  11614.         aBoolean1159 = false;
  11615.         aBoolean1160 = false;
  11616.         anInt1171 = 1;
  11617.         myUsername = "";
  11618.         myPassword = "";
  11619.         genericLoadingError = false;
  11620.         reportAbuseInterfaceID = -1;
  11621.         aClass19_1179 = new NodeList();
  11622.         anInt1184 = 128;
  11623.         invOverlayInterfaceID = -1;
  11624.         stream = Stream.create();
  11625.         menuActionName = new String[500];
  11626.         anIntArray1203 = new int[5];
  11627.         sound = new int[50];
  11628.         anInt1210 = 2;
  11629.         anInt1211 = 78;
  11630.         promptInput = "";
  11631.         modIcons = new Background[2];
  11632.         tabID = 3;
  11633.         inputTaken = false;
  11634.         songChanging = true;
  11635.         anIntArray1229 = new int[151];
  11636.         aClass11Array1230 = new CollisionMap[4];
  11637.         aBoolean1233 = false;
  11638.         soundType = new int[50];
  11639.         aBoolean1242 = false;
  11640.         soundDelay = new int[50];
  11641.         soundVolume = new int[50];
  11642.         rsAlreadyLoaded = false;
  11643.         welcomeScreenRaised = false;
  11644.         messagePromptRaised = false;
  11645.         loginMessage1 = "";
  11646.         loginMessage2 = "";
  11647.         backDialogID = -1;
  11648.         anInt1279 = 2;
  11649.         bigX = new int[4000];
  11650.         bigY = new int[4000];
  11651.         anInt1289 = -1;
  11652.     }
  11653.  
  11654.     public static String server;
  11655.     public int ignoreCount;
  11656.     public long aLong824;
  11657.     public int[][] anIntArrayArray825;
  11658.     public int[] friendsNodeIDs;
  11659.     public NodeList[][][] groundArray;
  11660.     public int[] anIntArray828;
  11661.     public int[] anIntArray829;
  11662.     public volatile boolean aBoolean831;
  11663.     public Socket aSocket832;
  11664.     public int loginScreenState;
  11665.     public Stream aStream_834;
  11666.     public NPC[] npcArray;
  11667.     public int npcCount;
  11668.     public int[] npcIndices;
  11669.     public int anInt839;
  11670.     public int[] anIntArray840;
  11671.     public int anInt841;
  11672.     public int anInt842;
  11673.     public int anInt843;
  11674.     public String aString844;
  11675.     public int publicChatMode;
  11676.     public int privateChatMode;
  11677.     public Stream aStream_847;
  11678.     public boolean aBoolean848;
  11679.     public static int anInt849;
  11680.     public int[] anIntArray850;
  11681.     public int[] anIntArray851;
  11682.     public int[] anIntArray852;
  11683.     public int[] anIntArray853;
  11684.     public static int anInt854;
  11685.     public int anInt855;
  11686.     public int openInterfaceID;
  11687.     public int fullScreenBackDialogID = -1;
  11688.     public int fullScreenInterfaceId = -1;
  11689.     public int xCameraPos;
  11690.     public int zCameraPos;
  11691.     public int yCameraPos;
  11692.     public int yCameraCurve;
  11693.     public int xCameraCurve;
  11694.     public int myPrivilege;
  11695.     public final int[] currentExp;
  11696.     public static int musicId;
  11697.     public static int soundId;
  11698.     public Background redStone1_3;
  11699.     public Background redStone2_3;
  11700.     public Background redStone3_2;
  11701.     public Background redStone1_4;
  11702.     public Background redStone2_4;
  11703.     public Sprite multiOverlay;
  11704.     public Sprite mapFlag;
  11705.     public Sprite mapMarker;
  11706.     public boolean aBoolean872;
  11707.     public final int[] anIntArray873;
  11708.     public int anInt874;
  11709.     public final boolean[] aBooleanArray876;
  11710.     public int weight;
  11711.     public MouseDetection mouseDetection;
  11712.     public volatile boolean drawFlames;
  11713.     public String reportAbuseInput;
  11714.     public int unknownInt10;
  11715.     public boolean menuOpen;
  11716.     public int anInt886;
  11717.     public String inputString;
  11718.     public final int maxPlayers;
  11719.     public final int myPlayerIndex;
  11720.     public Player[] playerArray;
  11721.     public int playerCount;
  11722.     public int[] playerIndices;
  11723.     public int anInt893;
  11724.     public int[] anIntArray894;
  11725.     public Stream[] aStreamArray895s;
  11726.     public int anInt896;
  11727.     public int anInt897;
  11728.     public int friendsCount;
  11729.     public int anInt900;
  11730.     public int[][] anIntArrayArray901;
  11731.     public final int anInt902;
  11732.     public RSImageProducer backLeftIP1;
  11733.     public RSImageProducer backLeftIP2;
  11734.     public RSImageProducer backRightIP1;
  11735.     public RSImageProducer backRightIP2;
  11736.     public RSImageProducer backTopIP1;
  11737.     public RSImageProducer backVmidIP1;
  11738.     public RSImageProducer backVmidIP2;
  11739.     public RSImageProducer backVmidIP3;
  11740.     public RSImageProducer backVmidIP2_2;
  11741.     public byte[] aByteArray912;
  11742.     public int anInt913;
  11743.     public int crossX;
  11744.     public int crossY;
  11745.     public int crossIndex;
  11746.     public int crossType;
  11747.     public int plane;
  11748.     public final int[] currentStats;
  11749.     public static int anInt924;
  11750.     public final long[] ignoreListAsLongs;
  11751.     public boolean loadingError;
  11752.     public final int anInt927;
  11753.     public final int[] anIntArray928;
  11754.     public int[][] anIntArrayArray929;
  11755.     public Sprite aClass30_Sub2_Sub1_Sub1_931;
  11756.     public Sprite aClass30_Sub2_Sub1_Sub1_932;
  11757.     public int anInt933;
  11758.     public int anInt934;
  11759.     public int anInt935;
  11760.     public int anInt936;
  11761.     public int anInt937;
  11762.     public int anInt938;
  11763.     public static int anInt940;
  11764.     public final int[] chatTypes;
  11765.     public final String[] chatNames;
  11766.     public final String[] chatMessages;
  11767.     public int anInt945;
  11768.     public WorldController worldController;
  11769.     public Background[] sideIcons;
  11770.     public int menuScreenArea;
  11771.     public int menuOffsetX;
  11772.     public int menuOffsetY;
  11773.     public int menuWidth;
  11774.     public int anInt952;
  11775.     public long aLong953;
  11776.     public boolean aBoolean954;
  11777.     public long[] friendsListAsLongs;
  11778.     public int currentSong;
  11779.     public static int nodeID = 10;
  11780.     static int portOff;
  11781.     public static boolean isMembers = true;
  11782.     public static boolean lowMem;
  11783.     public volatile boolean drawingFlames;
  11784.     public int spriteDrawX;
  11785.     public int spriteDrawY;
  11786.     public final int[] anIntArray965 = {0xffff00, 0xff0000, 65280, 65535, 0xff00ff, 0xffffff};
  11787.     public Background aBackground_966;
  11788.     public Background aBackground_967;
  11789.     public final int[] anIntArray968;
  11790.     public final int[] anIntArray969;
  11791.     final Decompressor[] decompressors;
  11792.     public int variousSettings[];
  11793.     public boolean aBoolean972;
  11794.     public final int anInt975;
  11795.     public final int[] anIntArray976;
  11796.     public final int[] anIntArray977;
  11797.     public final int[] anIntArray978;
  11798.     public final int[] anIntArray979;
  11799.     public final int[] anIntArray980;
  11800.     public final int[] anIntArray981;
  11801.     public final int[] anIntArray982;
  11802.     public final String[] aStringArray983;
  11803.     public int anInt984;
  11804.     public int anInt985;
  11805.     public static int anInt986;
  11806.     public Sprite[] hitMarks;
  11807.     public int anInt988;
  11808.     public int anInt989;
  11809.     public final int[] anIntArray990;
  11810.     public static boolean aBoolean993;
  11811.     public int anInt995;
  11812.     public int anInt996;
  11813.     public int anInt997;
  11814.     public int anInt998;
  11815.     public int anInt999;
  11816.     public ISAACRandomGen encryption;
  11817.     public Sprite mapEdge;
  11818.     public final int anInt1002;
  11819.     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}};
  11820.     public String amountOrNameInput;
  11821.     public static int anInt1005;
  11822.     public int daysSinceLastLogin;
  11823.     public int pktSize;
  11824.     public int pktType;
  11825.     public int anInt1009;
  11826.     public int anInt1010;
  11827.     public int anInt1011;
  11828.     public NodeList aClass19_1013;
  11829.     public int anInt1014;
  11830.     public int anInt1015;
  11831.     public int anInt1016;
  11832.     public boolean aBoolean1017;
  11833.     public int anInt1018;
  11834.     public static final int[] anIntArray1019;
  11835.     public int anInt1021;
  11836.     public int anInt1022;
  11837.     public int loadingStage;
  11838.     public Background scrollBar1;
  11839.     public Background scrollBar2;
  11840.     public int anInt1026;
  11841.     public Background backBase1;
  11842.     public Background backBase2;
  11843.     public Background backHmid1;
  11844.     public final int[] anIntArray1030;
  11845.     public boolean aBoolean1031;
  11846.     public Sprite[] mapFunctions;
  11847.     public int baseX;
  11848.     public int baseY;
  11849.     public int anInt1036;
  11850.     public int anInt1037;
  11851.     public int loginFailures;
  11852.     public int anInt1039;
  11853.     public int anInt1040;
  11854.     public int anInt1041;
  11855.     public int dialogID;
  11856.     public final int[] maxStats;
  11857.     public final int[] anIntArray1045;
  11858.     public int anInt1046;
  11859.     public boolean aBoolean1047;
  11860.     public int anInt1048;
  11861.     public String aString1049;
  11862.     public static int anInt1051;
  11863.     public final int[] anIntArray1052;
  11864.     public StreamLoader titleStreamLoader;
  11865.     public int anInt1054;
  11866.     public int anInt1055;
  11867.     public NodeList aClass19_1056;
  11868.     public final int[] anIntArray1057;
  11869.     public final RSInterface aClass9_1059;
  11870.     public Background[] mapScenes;
  11871.     public static int anInt1061;
  11872.     public int currentSound;
  11873.     public final int anInt1063;
  11874.     public int friendsListAction;
  11875.     public final int[] anIntArray1065;
  11876.     public int mouseInvInterfaceIndex;
  11877.     public int lastActiveInvInterface;
  11878.     public OnDemandFetcher onDemandFetcher;
  11879.     public int anInt1069;
  11880.     public int anInt1070;
  11881.     public int anInt1071;
  11882.     public int[] anIntArray1072;
  11883.     public int[] anIntArray1073;
  11884.     public Sprite mapDotItem;
  11885.     public Sprite mapDotNPC;
  11886.     public Sprite mapDotPlayer;
  11887.     public Sprite mapDotFriend;
  11888.     public Sprite mapDotTeam;
  11889.     public int anInt1079;
  11890.     public boolean aBoolean1080;
  11891.     public String[] friendsList;
  11892.     public Stream inStream;
  11893.     public int anInt1084;
  11894.     public int anInt1085;
  11895.     public int activeInterfaceType;
  11896.     public int anInt1087;
  11897.     public int anInt1088;
  11898.     public int anInt1089;
  11899.     public final int[] expectedCRCs;
  11900.     public int[] menuActionCmd2;
  11901.     public int[] menuActionCmd3;
  11902.     public int[] menuActionID;
  11903.     public int[] menuActionCmd1;
  11904.     public Sprite[] headIcons;
  11905.     public Sprite[] skullIcons;
  11906.     public Sprite[] headIconsHint;
  11907.     public static int anInt1097;
  11908.     public int anInt1098;
  11909.     public int anInt1099;
  11910.     public int anInt1100;
  11911.     public int anInt1101;
  11912.     public int anInt1102;
  11913.     public boolean tabAreaAltered;
  11914.     public int anInt1104;
  11915.     public RSImageProducer aRSImageProducer_1107;
  11916.     public RSImageProducer aRSImageProducer_1108;
  11917.     public RSImageProducer aRSImageProducer_1109;
  11918.     public RSImageProducer aRSImageProducer_1110;
  11919.     public RSImageProducer aRSImageProducer_1111;
  11920.     public RSImageProducer aRSImageProducer_1112;
  11921.     public RSImageProducer aRSImageProducer_1113;
  11922.     public RSImageProducer aRSImageProducer_1114;
  11923.     public RSImageProducer aRSImageProducer_1115;
  11924.     public static int anInt1117;
  11925.     public int membersInt;
  11926.     public String aString1121;
  11927.     public Sprite compass;
  11928.     public RSImageProducer aRSImageProducer_1123;
  11929.     public RSImageProducer aRSImageProducer_1124;
  11930.     public RSImageProducer aRSImageProducer_1125;
  11931.     public static Player myPlayer;
  11932.     public final String[] atPlayerActions;
  11933.     public final boolean[] atPlayerArray;
  11934.     public final int[][][] anIntArrayArrayArray1129;
  11935.     public final int[] tabInterfaceIDs = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1};
  11936.     public int anInt1131;
  11937.     public int anInt1132;
  11938.     public int menuActionRow;
  11939.     public static int anInt1134;
  11940.     public int spellSelected;
  11941.     public int anInt1137;
  11942.     public int spellUsableOn;
  11943.     public String spellTooltip;
  11944.     public Sprite[] aClass30_Sub2_Sub1_Sub1Array1140;
  11945.     public boolean aBoolean1141;
  11946.     public static int anInt1142;
  11947.     public Background redStone1;
  11948.     public Background redStone2;
  11949.     public Background redStone3;
  11950.     public Background redStone1_2;
  11951.     public Background redStone2_2;
  11952.     public int energy;
  11953.     public boolean aBoolean1149;
  11954.     public Sprite[] crosses;
  11955.     public boolean musicEnabled;
  11956.     public Background[] aBackgroundArray1152s;
  11957.     public boolean needDrawTabArea;
  11958.     public int unreadMessages;
  11959.     public static int anInt1155;
  11960.     public static boolean fpsOn;
  11961.     public boolean loggedIn;
  11962.     public boolean canMute;
  11963.     public boolean aBoolean1159;
  11964.     public boolean aBoolean1160;
  11965.     static int loopCycle;
  11966.     public static final String validUserPassChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!\"\243$%^&*()-_=+[{]};:'@#~,<.>/?\\| ";
  11967.     public RSImageProducer aRSImageProducer_1163;
  11968.     public RSImageProducer aRSImageProducer_1164;
  11969.     public RSImageProducer aRSImageProducer_1165;
  11970.     public RSImageProducer aRSImageProducer_1166;
  11971.     public int daysSinceRecovChange;
  11972.     public RSSocket socketStream;
  11973.     public int minimapInt3;
  11974.     public int anInt1171;
  11975.     public static long aLong1172;
  11976.     public String myUsername;
  11977.     public String myPassword;
  11978.     public static int anInt1175;
  11979.     public boolean genericLoadingError;
  11980.     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};
  11981.     public int reportAbuseInterfaceID;
  11982.     public NodeList aClass19_1179;
  11983.     public int[] chatAreaOffsets;
  11984.     public int[] tabAreaOffsets;
  11985.     public int[] chatBoxAreaOffsets;
  11986.     public byte[][] aByteArrayArray1183;
  11987.     public int anInt1184;
  11988.     public int minimapInt1;
  11989.     public int anInt1186;
  11990.     public int anInt1187;
  11991.     public static int anInt1188;
  11992.     public int invOverlayInterfaceID;
  11993.     public int[] anIntArray1190;
  11994.     public int[] anIntArray1191;
  11995.     public Stream stream;
  11996.     public int anInt1193;
  11997.     public int splitpublicChat;
  11998.     public Background invBack;
  11999.     public Background mapBack;
  12000.     public Background chatBack;
  12001.     public String[] menuActionName;
  12002.     public Sprite aClass30_Sub2_Sub1_Sub1_1201;
  12003.     public Sprite aClass30_Sub2_Sub1_Sub1_1202;
  12004.     public final int[] anIntArray1203;
  12005.     static final int[] anIntArray1204 = {9104, 10275, 7595, 3610, 7975, 8526, 918, 38802, 24466, 10145, 58654, 5027, 1457, 16565, 34991, 25486};
  12006.     public static boolean flagged;
  12007.     public final int[] sound;
  12008.     public int anInt1208;
  12009.     public int minimapInt2;
  12010.     public int anInt1210;
  12011.     public int anInt1211;
  12012.     public String promptInput;
  12013.     public int anInt1213;
  12014.     public int[][][] intGroundArray;
  12015.     public long aLong1215;
  12016.     public int loginScreenCursorPos;
  12017.     public final Background[] modIcons;
  12018.     public long aLong1220;
  12019.     public int tabID;
  12020.     public int anInt1222;
  12021.     public boolean inputTaken;
  12022.     public int inputDialogState;
  12023.     public static int anInt1226;
  12024.     public int nextSong;
  12025.     public boolean songChanging;
  12026.     public final int[] anIntArray1229;
  12027.     public CollisionMap[] aClass11Array1230;
  12028.     public static int anIntArray1232[];
  12029.     public boolean aBoolean1233;
  12030.     public int[] anIntArray1234;
  12031.     public int[] anIntArray1235;
  12032.     public int[] anIntArray1236;
  12033.     public int anInt1237;
  12034.     public int anInt1238;
  12035.     public final int anInt1239 = 100;
  12036.     public final int[] soundType;
  12037.     public boolean aBoolean1242;
  12038.     public int atInventoryLoopCycle;
  12039.     public int atInventoryInterface;
  12040.     public int atInventoryIndex;
  12041.     public int atInventoryInterfaceType;
  12042.     public byte[][] aByteArrayArray1247;
  12043.     public int tradeMode;
  12044.     public int anInt1249;
  12045.     public final int[] soundDelay;
  12046.     public final int[] soundVolume;
  12047.     public int anInt1251;
  12048.     public final boolean rsAlreadyLoaded;
  12049.     public int anInt1253;
  12050.     public int anInt1254;
  12051.     public boolean welcomeScreenRaised;
  12052.     public boolean messagePromptRaised;
  12053.     public static int anInt1257;
  12054.     public byte[][][] byteGroundArray;
  12055.     public int previousSong;
  12056.     public int destX;
  12057.     public int destY;
  12058.     public Sprite aClass30_Sub2_Sub1_Sub1_1263;
  12059.     public int anInt1264;
  12060.     public int anInt1265;
  12061.     public String loginMessage1;
  12062.     public String loginMessage2;
  12063.     public int anInt1268;
  12064.     public int anInt1269;
  12065.     public TextDrawingArea aTextDrawingArea_1270;
  12066.     public TextDrawingArea aTextDrawingArea_1271;
  12067.     public TextDrawingArea chatTextDrawingArea;
  12068.     public int anInt1275;
  12069.     public int backDialogID;
  12070.     public int anInt1278;
  12071.     public int anInt1279;
  12072.     public int[] bigX;
  12073.     public int[] bigY;
  12074.     public int itemSelected;
  12075.     public int anInt1283;
  12076.     public int anInt1284;
  12077.     public int anInt1285;
  12078.     public String selectedItemName;
  12079.     public static int anInt1288;
  12080.     public int anInt1289;
  12081.     public static int tiara;
  12082.     public static int anInt1290;
  12083.     public boolean showInfo;
  12084.     public static int anInt1401 = 256;
  12085.     public static int[] anIntArray385 = new int[] { 12800, 12800, 12800, 12800, 12800, 12800,
  12086.     12800, 12800, 12800, 12800, 12800, 12800,
  12087.     12800, 12800, 12800, 12800 };
  12088.     public static int anInt720 = 0;
  12089.     public static Class56 aClass56_749;
  12090.     public static boolean fetchMusic = false;
  12091.     public static int musicVolume2;
  12092.     public static int anInt478 = -1;
  12093.     public static byte[] aByteArray347;
  12094.     public static int anInt155 = 0;
  12095.     public static int anInt2200 = 0;
  12096.     public static int anInt1478;
  12097.     public static boolean aBoolean475;
  12098.     public static int anInt116;
  12099.     public static boolean aBoolean995;
  12100.     public static int anInt139;
  12101.     public static int musicVolume = 255;
  12102.     public int[] gameScreenOffsets;
  12103.     public int anInt1170;
  12104.     public int anInt1215;
  12105.     public int anInt1083;
  12106.     public int anInt992;
  12107.     public int anInt1273;
  12108.     public int anInt1034;
  12109.  
  12110.     static {
  12111.         anIntArray1019 = new int[99];
  12112.         int i = 0;
  12113.         for (int j = 0; j < 99; j++) {
  12114.             int l = j + 1;
  12115.             int i1 = (int) ((double) l + 300D * Math.pow(2D, (double) l / 7D));
  12116.             i += i1;
  12117.             anIntArray1019[j] = i / 4;
  12118.         }
  12119.  
  12120.         anIntArray1232 = new int[32];
  12121.         i = 2;
  12122.         for (int k = 0; k < 32; k++) {
  12123.             anIntArray1232[k] = i - 1;
  12124.             i += i;
  12125.         }
  12126.  
  12127.     }
  12128. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement