Advertisement
Guest User

Untitled

a guest
May 29th, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 492.17 KB | None | 0 0
  1. import java.applet.AppletContext;
  2. import java.awt.*;
  3. import java.io.*;
  4. import java.net.*;
  5. import java.text.DecimalFormat;
  6. import java.text.NumberFormat;
  7. import java.lang.reflect.Method;
  8.  
  9. import sign.signlink;
  10.  
  11. import javax.swing.*;
  12.  
  13. public class client extends RSApplet {
  14.    
  15.     public enum ScreenMode {
  16.         FIXED,
  17.         RESIZABLE;
  18.     }
  19.    
  20.     public static ScreenMode frameMode = ScreenMode.FIXED;
  21.     public static int frameWidth = 765;
  22.     public static int frameHeight = 503;
  23.     public static int screenAreaWidth = 512;
  24.     public static int screenAreaHeight = 334;
  25.     public static int cameraZoom = 600;
  26.     public static boolean showChatComponents = true;
  27.     public static boolean showTabComponents = true;
  28.     public static boolean changeTabArea = frameMode == ScreenMode.FIXED ? false : true;
  29.     public static boolean changeChatArea = frameMode == ScreenMode.FIXED ? false : true;
  30.     public static boolean transparentTabArea = false;
  31.    
  32.     public static void frameMode(ScreenMode screenMode) {
  33.         if (frameMode != screenMode) {
  34.             frameMode = screenMode;
  35.             if (screenMode == ScreenMode.FIXED) {
  36.                 frameWidth = 765;
  37.                 frameHeight = 503;
  38.                 cameraZoom = 600;
  39.                 changeChatArea = false;
  40.                 changeTabArea = false;
  41.             } else if (screenMode == ScreenMode.RESIZABLE) {
  42.                 frameWidth = 766;
  43.                 frameHeight = 536;
  44.                 cameraZoom = 850;
  45.             }
  46.             rebuildFrameSize(screenMode, frameWidth, frameHeight);
  47.             setBounds();
  48.             System.out.println("ScreenMode: " + screenMode.toString());
  49.         }
  50.         showChatComponents = screenMode == ScreenMode.FIXED ? true : showChatComponents;
  51.         showTabComponents = screenMode == ScreenMode.FIXED ? true : showTabComponents;
  52.     }
  53.    
  54.     public static void rebuildFrameSize(ScreenMode screenMode, int screenWidth, int screenHeight) {
  55.         try {
  56.             screenAreaWidth = (screenMode == ScreenMode.FIXED) ? 512 : screenWidth;
  57.             screenAreaHeight = (screenMode == ScreenMode.FIXED) ? 334 : screenHeight;
  58.             frameWidth = screenWidth;
  59.             frameHeight = screenHeight;
  60.             Jframe.refreshFrameSize(screenMode == ScreenMode.FIXED, screenMode == ScreenMode.RESIZABLE);
  61.             setBounds();
  62.         } catch (Exception e) {
  63.             e.printStackTrace();
  64.         }
  65.     }
  66.    
  67.     public void refreshFrameSize() {
  68.         if (frameMode != ScreenMode.FIXED) {
  69.             if (frameWidth != getGameComponent().getWidth()) {
  70.                 frameWidth = getGameComponent().getWidth();
  71.                 screenAreaWidth = frameWidth;
  72.                 setBounds();
  73.             }
  74.             if (frameHeight != getGameComponent().getHeight()) {
  75.                 frameHeight = getGameComponent().getHeight();
  76.                 screenAreaHeight = frameHeight;
  77.                 setBounds();
  78.             }
  79.         }
  80.     }
  81.    
  82.     private static void setBounds() {
  83.         Texture.method365(frameWidth, frameHeight);
  84.         fullScreenTextureArray = Texture.anIntArray1472;
  85.         Texture.method365(frameMode == ScreenMode.FIXED ? (aRSImageProducer_1166 != null ? aRSImageProducer_1166.canvasWidth : 516) : frameWidth, frameMode == ScreenMode.FIXED ? (aRSImageProducer_1166 != null ? aRSImageProducer_1166.canvasHeight : 165) : frameHeight);
  86.         anIntArray1180 = Texture.anIntArray1472;
  87.         Texture.method365(frameMode == ScreenMode.FIXED ? (aRSImageProducer_1163 != null ? aRSImageProducer_1163.canvasWidth : 250) : frameWidth, frameMode == ScreenMode.FIXED ? (aRSImageProducer_1163 != null ? aRSImageProducer_1163.canvasHeight : 335) : frameHeight);
  88.         anIntArray1181 = Texture.anIntArray1472;
  89.         Texture.method365(screenAreaWidth, screenAreaHeight);
  90.         anIntArray1182 = Texture.anIntArray1472;
  91.         int ai[] = new int[9];
  92.         for(int i8 = 0; i8 < 9; i8++) {
  93.             int k8 = 128 + i8 * 32 + 15;
  94.             int l8 = 600 + k8 * 3;
  95.             int i9 = Texture.anIntArray1470[k8];
  96.             ai[i8] = l8 * i9 >> 16;
  97.         }
  98.         if (frameMode == ScreenMode.RESIZABLE && (frameWidth >= 756) && (frameWidth <= 1025) && (frameHeight >= 494) && (frameHeight <= 850)) {
  99.             WorldController.viewDistance = 9;
  100.             cameraZoom = 575;
  101.         } else if (frameMode == ScreenMode.FIXED) {
  102.             cameraZoom = 600;
  103.         } else if (frameMode == ScreenMode.RESIZABLE) {
  104.             WorldController.viewDistance = 10;
  105.             cameraZoom = 600;
  106.         }
  107.         WorldController.method310(500, 800, screenAreaWidth, screenAreaHeight, ai);
  108.         if (loggedIn) {
  109.             aRSImageProducer_1165 = new ImageProducer(screenAreaWidth, screenAreaHeight);
  110.         }
  111.     }
  112.    
  113.     public boolean getMousePositions() {
  114.         if (mouseInRegion(frameWidth - (frameWidth <= 1000 ? 240 : 420), frameHeight - (frameWidth <= 1000 ? 90 : 37), frameWidth, frameHeight)) {
  115.             return false;
  116.         }
  117.         if (showChatComponents) {
  118.             if (changeChatArea) {
  119.                 if (super.mouseX > 0 && super.mouseX < 494 && super.mouseY > frameHeight - 175 && super.mouseY < frameHeight) {
  120.                     return true;
  121.                 } else {
  122.                     if (super.mouseX > 494 && super.mouseX < 515 && super.mouseY > frameHeight - 175 && super.mouseY < frameHeight) {
  123.                         return false;
  124.                     }
  125.                 }
  126.             } else if (!changeChatArea) {
  127.                 if (super.mouseX > 0 && super.mouseX < 519 && super.mouseY > frameHeight - 175 && super.mouseY < frameHeight) {
  128.                     return false;
  129.                 }
  130.             }
  131.         }
  132.         if (mouseInRegion2(frameWidth - 216, frameWidth, 0, 172)) {
  133.             return false;
  134.         }
  135.         if (!changeTabArea) {
  136.             if (super.mouseX > 0 && super.mouseY > 0 && super.mouseY < frameWidth && super.mouseY < frameHeight) {
  137.                 if (super.mouseX >= frameWidth - 242 && super.mouseY >= frameHeight - 335) {
  138.                     return false;
  139.                 }
  140.                 return true;
  141.             }
  142.             return false;
  143.         }
  144.         if (showTabComponents) {
  145.             if (frameWidth > 1000) {
  146.                 if (super.mouseX >= frameWidth - 420 && super.mouseX <= frameWidth && super.mouseY >= frameHeight - 37 && super.mouseY <= frameHeight || super.mouseX > frameWidth - 225 && super.mouseX < frameWidth && super.mouseY > frameHeight - 37 - 274 && super.mouseY < frameHeight) {
  147.                     return false;
  148.                 }
  149.             } else {
  150.                 if (super.mouseX >= frameWidth - 210 && super.mouseX <= frameWidth && super.mouseY >= frameHeight - 74 && super.mouseY <= frameHeight || super.mouseX > frameWidth - 225 && super.mouseX < frameWidth && super.mouseY > frameHeight - 74 - 274 && super.mouseY < frameHeight) {
  151.                     return false;
  152.                 }
  153.             }
  154.         }
  155.         return true;
  156.     }
  157.    
  158.     public boolean mouseInRegion2(int x1, int x2, int y1, int y2) {
  159.         if (super.mouseX >= x1 && super.mouseX <= x2 && super.mouseY >= y1 && super.mouseY <= y2) {
  160.             return true;
  161.         }
  162.         return false;
  163.     }
  164.    
  165.     public boolean mouseInRegion(int x1, int y1, int x2, int y2) {
  166.         if (super.mouseX >= x1 && super.mouseX <= x2 && super.mouseY >= y1 && super.mouseY <= y2) {
  167.             return true;
  168.         }
  169.         return false;
  170.     }
  171.    
  172.     public boolean mouseMapPosition() {
  173.         if (super.mouseX >= frameWidth - 21 && super.mouseX <= frameWidth && super.mouseY >= 0 && super.mouseY <= 21) {
  174.             return false;
  175.         }
  176.         return true;
  177.     }
  178.  
  179.     private static final long serialVersionUID = 2L;
  180.  
  181.     private static String intToKOrMilLongName(int i) {
  182.         String s = String.valueOf(i);
  183.         for (int k = s.length() - 3; k > 0; k -= 3)
  184.             s = s.substring(0, k) + "," + s.substring(k);
  185.         if (s.length() > 8)
  186.             s = "@gre@" + s.substring(0, s.length() - 8) + " million @whi@("
  187.                     + s + ")";
  188.         else if (s.length() > 4)
  189.             s = "@cya@" + s.substring(0, s.length() - 4) + "K @whi@(" + s + ")";
  190.         return " " + s;
  191.     }
  192.    
  193.     public int getXPForLevel(int level) {
  194.         int points = 0;
  195.         int output = 0;
  196.         for (int lvl = 1; lvl <= level; lvl++) {
  197.             points += Math.floor(lvl + 300.0 * Math.pow(2.0, lvl / 7.0));
  198.             if (lvl >= level) {
  199.                 return output;
  200.             }
  201.             output = (int)Math.floor(points / 4);
  202.         }
  203.         return 0;
  204.     }
  205.  
  206.     private static String intToKOrMil(int j) {
  207.         if (j < 0x186a0)
  208.             return String.valueOf(j);
  209.         if (j < 0x989680)
  210.             return j / 1000 + "K";
  211.         else
  212.             return j / 0xf4240 + "M";
  213.     }
  214.  
  215.     public final String titleColor(final int i, int type) {
  216.         String titleChatbox = "", titleRightclick = "";
  217.         switch (i) {
  218.  
  219.         case 0: // orange
  220.             titleChatbox = "A67711";
  221.             titleRightclick = "or0";
  222.             break;
  223.  
  224.         case 1: // purple
  225.             titleChatbox = "FF00CD";
  226.             titleRightclick = "pur";
  227.             break;
  228.  
  229.         case 2: // red
  230.             titleChatbox = "ff0000";
  231.             titleRightclick = "red";
  232.             break;
  233.  
  234.         case 3: // green
  235.             titleChatbox = "148200";
  236.             titleRightclick = "gr0";
  237.             break;
  238.  
  239.         case 4: // black
  240.             titleChatbox = "0";
  241.             titleRightclick = "bla";
  242.             break;
  243.  
  244.         case 5: // yellow
  245.             titleChatbox = "ffff00";
  246.             titleRightclick = "yel";
  247.             break;
  248.  
  249.         case 6: // cyan
  250.             titleChatbox = "65535";
  251.             titleRightclick = "cya";
  252.             break;
  253.  
  254.         case 7: // white
  255.             titleChatbox = "ffffff";
  256.             titleRightclick = "whi";
  257.             break;
  258.         }
  259.         if (type == 0)
  260.             return titleChatbox;
  261.         else
  262.             return titleRightclick;
  263.     }
  264.  
  265.     public void stopMidi() {
  266.         signlink.midifade = 0;
  267.         signlink.midi = "stop";
  268.     }
  269.  
  270.     public Sprite[] chatImages = new Sprite[2];
  271.     public static int spellID = 0;
  272.     public int MapX, MapY;
  273.    
  274.  
  275.     public static void setTab(int id) {
  276.         needDrawTabArea = true;
  277.         tabID = id;
  278.         tabAreaAltered = true;
  279.     }
  280.  
  281.     private boolean menuHasAddFriend(int j) {
  282.         if (j < 0)
  283.             return false;
  284.         int k = menuActionID[j];
  285.         if (k >= 2000)
  286.             k -= 2000;
  287.         return k == 337;
  288.     }
  289.  
  290.     private final int[]
  291.             modeX = { 164, 230, 296, 362 },
  292.             modeNamesX = { 26, 86, 150, 212, 286, 349, 427 },
  293.             modeNamesY = { 158, 158, 153, 153, 153, 153, 158 },
  294.             channelButtonsX = { 5, 71, 137, 203, 269, 335, 404 };
  295.  
  296.     private final String[] modeNames = { "All", "Game", "Public", "Private", "Clan", "Trade", "Report Abuse" };
  297.  
  298.     public void drawChannelButtons() {
  299.         final int yOffset = frameMode == ScreenMode.FIXED ? 0 : frameHeight - 165;
  300.         cacheSprite[33].drawSprite(0, 143 + yOffset);
  301.         String text[] = { "On", "Friends", "Off", "Hide" };
  302.         int textColor[] = { 65280, 0xffff00, 0xff0000, 65535 };
  303.         switch (cButtonCPos) {
  304.         case 0:
  305.         case 1:
  306.         case 2:
  307.         case 3:
  308.         case 4:
  309.         case 5:
  310.         case 6:
  311.             cacheSprite[16].drawSprite(channelButtonsX[cButtonCPos], 143 + yOffset);
  312.             break;
  313.         }
  314.         if (cButtonHPos == cButtonCPos) {
  315.             switch (cButtonHPos) {
  316.             case 0:
  317.             case 1:
  318.             case 2:
  319.             case 3:
  320.             case 4:
  321.             case 5:
  322.             case 6:
  323.             case 7:
  324.                 cacheSprite[17].drawSprite(channelButtonsX[cButtonHPos], 143 + yOffset);
  325.                 break;
  326.             }
  327.         } else {
  328.             switch (cButtonHPos) {
  329.             case 0:
  330.             case 1:
  331.             case 2:
  332.             case 3:
  333.             case 4:
  334.             case 5:
  335.                 cacheSprite[15].drawSprite(channelButtonsX[cButtonHPos], 143 + yOffset);
  336.                 break;
  337.             case 6:
  338.                 cacheSprite[18].drawSprite(channelButtonsX[cButtonHPos], 143 + yOffset);
  339.                 break;
  340.             }
  341.         }
  342.         int[] modes = { publicChatMode, privateChatMode, clanChatMode, tradeMode };
  343.         for (int i = 0; i < modeNamesX.length; i++) {
  344.             smallText.method389(true, modeNamesX[i], 0xffffff, modeNames[i], modeNamesY[i] + yOffset);
  345.         }
  346.         for (int i = 0; i < modeX.length; i++) {
  347.             smallText.method382(textColor[modes[i]], modeX[i], text[modes[i]], 164 + yOffset, true);
  348.         }
  349.     }
  350.    
  351.     private boolean chatStateCheck() {
  352.         return messagePromptRaised || inputDialogState != 0 || aString844 != null || backDialogID != -1 || dialogID != -1;
  353.     }
  354.  
  355.     private void drawChatArea() {
  356.         int yOffset = frameMode == ScreenMode.FIXED ? 0 : frameHeight - 165;
  357.         if (frameMode == ScreenMode.FIXED) {
  358.             aRSImageProducer_1166.initDrawingArea();
  359.         }
  360.         Texture.anIntArray1472 = anIntArray1180;
  361.         if (chatStateCheck()) {
  362.             showChatComponents = true;
  363.             cacheSprite[20].drawSprite(0, yOffset);
  364.         }
  365.         if (showChatComponents) {
  366.             if (changeChatArea && !chatStateCheck()) {
  367.                 DrawingArea.method339(7 + yOffset, 0x575757, 506, 7);
  368.                 DrawingArea.drawAlphaGradient(7, 7 + yOffset, 506, 135, 0, 0xFFFFFF, 20);
  369.             } else {
  370.                 cacheSprite[20].drawSprite(0, yOffset);
  371.             }
  372.         }
  373.         if (!showChatComponents || changeChatArea) {
  374.             DrawingArea.drawAlphaPixels(7, frameHeight - 23, 506, 24, 0, 100);
  375.         }
  376.         drawChannelButtons();
  377.         TextDrawingArea textDrawingArea = aTextDrawingArea_1271;
  378.         if (messagePromptRaised) {
  379.             newBoldFont.drawCenteredString(aString1121, 259, 60 + yOffset, 0, -1);
  380.             newBoldFont.drawCenteredString(promptInput + "*", 259, 80 + yOffset, 128, -1);
  381.         } else if (inputDialogState == 1) {
  382.             newBoldFont.drawCenteredString("Enter amount:", 259, 60 + yOffset, 0, -1);
  383.             newBoldFont.drawCenteredString(amountOrNameInput + "*", 259, 80 + yOffset,
  384.                     128, -1);
  385.         } else if (inputDialogState == 2) {
  386.             newBoldFont.drawCenteredString("Enter name:", 259, 60 + yOffset, 0, -1);
  387.             newBoldFont.drawCenteredString(amountOrNameInput + "*", 259, 80 + yOffset,
  388.                     128, -1);
  389.         } else if (aString844 != null) {
  390.             newBoldFont.drawCenteredString(aString844, 259, 60 + yOffset, 0, -1);
  391.             newBoldFont.drawCenteredString("Click to continue", 259, 80 + yOffset, 128,
  392.                     -1);
  393.         } else if (backDialogID != -1) {
  394.             drawInterface(0, 20, RSInterface.interfaceCache[backDialogID], 20 + yOffset);
  395.         } else if (dialogID != -1) {
  396.             drawInterface(0, 20, RSInterface.interfaceCache[dialogID], 20 + yOffset);
  397.         } else if (showChatComponents) {
  398.             int j77 = -3;
  399.             int j = 0;
  400.             DrawingArea.setDrawingArea(122 + yOffset, 8, 497, 7 + yOffset);
  401.             for (int k = 0; k < 500; k++)
  402.                 if (chatMessages[k] != null) {
  403.                     int chatType = chatTypes[k];
  404.                     int yPos = (70 - j77 * 14) + anInt1089 + 5;
  405.                     String s1 = chatNames[k];
  406.                     byte byte0 = 0;
  407.                     if (s1 != null && s1.startsWith("@cr1@")) {
  408.                         s1 = s1.substring(5);
  409.                         byte0 = 1;
  410.                     } else if (s1 != null && s1.startsWith("@cr2@")) {
  411.                         s1 = s1.substring(5);
  412.                         byte0 = 2;
  413.                     } else if (s1 != null && s1.startsWith("@cr3@")) {
  414.                         s1 = s1.substring(5);
  415.                         byte0 = 3;
  416.                     } else if (s1 != null && s1.startsWith("@cr4@")) {
  417.                         s1 = s1.substring(5);
  418.                         byte0 = 4;
  419.                     } else if (s1 != null && s1.startsWith("@cr5@")) {
  420.                         s1 = s1.substring(5);
  421.                         byte0 = 5;
  422.                     } else if (s1 != null && s1.startsWith("@cr6@")) {
  423.                         s1 = s1.substring(5);
  424.                         byte0 = 6;
  425.                     } else if (s1 != null && s1.startsWith("@cr7@")) {
  426.                         s1 = s1.substring(5);
  427.                         byte0 = 7;
  428.                     } else if (s1 != null && s1.startsWith("@cr8@")) {
  429.                         s1 = s1.substring(5);
  430.                         byte0 = 8;
  431.                     } else if (s1 != null && s1.startsWith("@cr9@")) {
  432.                         s1 = s1.substring(5);
  433.                         byte0 = 9;
  434.                     } else if (s1 != null && s1.startsWith("@cr10@")) {
  435.                         s1 = s1.substring(5);
  436.                         byte0 = 10;
  437.                     } else if (s1 != null && s1.startsWith("@cr11@")) {
  438.                         s1 = s1.substring(5);
  439.                         byte0 = 11;
  440.                     } else if (s1 != null && s1.startsWith("@cr12@")) {
  441.                         s1 = s1.substring(5);
  442.                         byte0 = 12;
  443.                     } else if (s1 != null && s1.startsWith("@cr13@")) {
  444.                         s1 = s1.substring(5);
  445.                         byte0 = 13;
  446.                     } else if (s1 != null && s1.startsWith("@cr14@")) {
  447.                         s1 = s1.substring(5);
  448.                         byte0 = 14;
  449.                     } else if (s1 != null && s1.startsWith("@cr15@")) {
  450.                         s1 = s1.substring(5);
  451.                         byte0 = 15;
  452.                     } else if (s1 != null && s1.startsWith("@cr16@")) {
  453.                         s1 = s1.substring(5);
  454.                         byte0 = 16;
  455.                     } else if (s1 != null && s1.startsWith("@cr17@")) {
  456.                         s1 = s1.substring(5);
  457.                         byte0 = 17;
  458.                     } else if (s1 != null && s1.startsWith("@cr18@")) {
  459.                         s1 = s1.substring(5);
  460.                         byte0 = 18;
  461.                     } else if (s1 != null && s1.startsWith("@cr19@")) {
  462.                         s1 = s1.substring(5);
  463.                         byte0 = 19;
  464.                     } else if (s1 != null && s1.startsWith("@cr20@")) {
  465.                         s1 = s1.substring(5);
  466.                         byte0 = 20;
  467.                     } else if (s1 != null && s1.startsWith("@cr21@")) {
  468.                         s1 = s1.substring(5);
  469.                         byte0 = 21;
  470.                     } else if (s1 != null && s1.startsWith("@cr22@")) {
  471.                         s1 = s1.substring(5);
  472.                         byte0 = 22;
  473.                     } else if (s1 != null && s1.startsWith("@cr23@")) {
  474.                         s1 = s1.substring(5);
  475.                         byte0 = 23;
  476.                     } else if (s1 != null && s1.startsWith("@cr24@")) {
  477.                         s1 = s1.substring(5);
  478.                         byte0 = 24;
  479.                     } else if (s1 != null && s1.startsWith("@cr25@")) {
  480.                         s1 = s1.substring(5);
  481.                         byte0 = 25;
  482.                     } else if (s1 != null && s1.startsWith("@cr26@")) {
  483.                         s1 = s1.substring(5);
  484.                         byte0 = 26;
  485.                     } else if (s1 != null && s1.startsWith("@cr27@")) {
  486.                         s1 = s1.substring(5);
  487.                         byte0 = 27;
  488.                     } else if (s1 != null && s1.startsWith("@cr28@")) {
  489.                         s1 = s1.substring(5);
  490.                         byte0 = 28;
  491.                     } else if (s1 != null && s1.startsWith("@cr29@")) {
  492.                         s1 = s1.substring(5);
  493.                         byte0 = 29;
  494.                     }
  495.                     if (chatType == 0) {
  496.                         if (chatTypeView == 5 || chatTypeView == 0) {
  497.                             if (yPos > 0 && yPos < 210)
  498.                                 newRegularFont.drawBasicString(chatMessages[k], 11, yPos + yOffset, changeChatArea ? 0xffffff : 0, changeChatArea ? 0 : -1);
  499.                             j++;
  500.                             j77++;
  501.                         }
  502.                     }
  503.                     if ((chatType == 1 || chatType == 2)
  504.                             && (chatType == 1 || publicChatMode == 0 || publicChatMode == 1
  505.                                     && isFriendOrSelf(s1))) {
  506.                         if (chatTypeView == 1 || chatTypeView == 0) {
  507.                             if (yPos > 0 && yPos < 210) {
  508.                                 int xPos = 11;
  509.                                 if (byte0 == 1) {
  510.                                     modIcons[0].drawSprite(xPos + 1, yPos - 11 + yOffset);
  511.                                     xPos += 14;
  512.                                 } else if (byte0 == 2) {
  513.                                     modIcons[1].drawSprite(xPos, yPos - 13 + yOffset);
  514.                                     xPos += 14;
  515.                                 } else if (byte0 == 3) {
  516.                                     modIcons[2].drawSprite(xPos + 1, yPos - 11 + yOffset);
  517.                                     xPos += 14;
  518.                                 } else if (byte0 == 4) {
  519.                                     modIcons[3].drawSprite(xPos + 1, yPos - 10 + yOffset);
  520.                                     xPos += 14;
  521.                                 } else if (byte0 == 5) {
  522.                                     modIcons[4].drawSprite(xPos + 1, yPos - 10 + yOffset);
  523.                                     xPos += 14;
  524.                                 } else if (byte0 == 6) {
  525.                                     modIcons[5].drawSprite(xPos + 1, yPos - 10 + yOffset);
  526.                                     xPos += 14;
  527.                                 } else if (byte0 == 7) {
  528.                                     modIcons[6].drawSprite(xPos + 1, yPos - 10 + yOffset);
  529.                                     xPos += 14;
  530.                                 } else if (byte0 == 8) {
  531.                                     modIcons[7].drawSprite(xPos + 1, yPos - 10 + yOffset);
  532.                                     xPos += 14;
  533.                                 } else if (byte0 == 9) {
  534.                                     modIcons[8].drawSprite(xPos + 1, yPos - 10 + yOffset);
  535.                                     xPos += 16;
  536.                                 } else if (byte0 == 10) {
  537.                                     modIcons[10].drawSprite(xPos + 1, yPos - 10 + yOffset);
  538.                                     xPos += 14;
  539.                                 } else if (byte0 == 11) {
  540.                                     modIcons[10].drawSprite(xPos + 1, yPos - 10 + yOffset);
  541.                                     xPos += 14;
  542.                                 } else if (byte0 == 12) {
  543.                                     modIcons[10].drawSprite(xPos + 1, yPos - 10 + yOffset);
  544.                                     xPos += 14;
  545.                                 } else if (byte0 == 13) {
  546.                                     modIcons[10].drawSprite(xPos + 1, yPos - 10 + yOffset);
  547.                                     xPos += 14;
  548.                                 } else if (byte0 == 14) {
  549.                                     modIcons[10].drawSprite(xPos + 1, yPos - 10 + yOffset);
  550.                                     xPos += 14;
  551.                                 } else if (byte0 == 15) {
  552.                                     modIcons[10].drawSprite(xPos + 1, yPos - 10 + yOffset);
  553.                                     xPos += 14;
  554.                                 } else if (byte0 == 16) {
  555.                                     modIcons[10].drawSprite(xPos + 1, yPos - 10 + yOffset);
  556.                                     xPos += 14;
  557.                                 } else if (byte0 == 17) {
  558.                                     modIcons[10].drawSprite(xPos + 1, yPos - 10 + yOffset);
  559.                                     xPos += 14;
  560.                                 } else if (byte0 == 18) {
  561.                                     modIcons[10].drawSprite(xPos + 1, yPos - 10 + yOffset);
  562.                                     xPos += 14;
  563.                                 } else if (byte0 == 19) {
  564.                                     modIcons[10].drawSprite(xPos + 1, yPos - 10 + yOffset);
  565.                                     xPos += 14;
  566.                                 } else if (byte0 == 20) {
  567.                                     modIcons[10].drawSprite(xPos + 1, yPos - 10 + yOffset);
  568.                                     xPos += 14;
  569.                                 } else if (byte0 == 21) {
  570.                                     modIcons[10].drawSprite(xPos + 1, yPos - 10 + yOffset);
  571.                                     xPos += 14;
  572.                                 } else if (byte0 == 22) {
  573.                                     modIcons[10].drawSprite(xPos + 1, yPos - 10 + yOffset);
  574.                                     xPos += 14;
  575.                                 } else if (byte0 == 23) {
  576.                                     modIcons[10].drawSprite(xPos + 1, yPos - 10 + yOffset);
  577.                                     xPos += 14;
  578.                                 } else if (byte0 == 24) {
  579.                                     modIcons[10].drawSprite(xPos + 1, yPos - 10 + yOffset);
  580.                                     xPos += 14;
  581.                                 } else if (byte0 == 25) {
  582.                                     modIcons[10].drawSprite(xPos + 1, yPos - 10 + yOffset);
  583.                                     xPos += 14;
  584.                                 } else if (byte0 == 26) {
  585.                                     modIcons[10].drawSprite(xPos + 1, yPos - 10 + yOffset);
  586.                                     xPos += 14;
  587.                                 } else if (byte0 == 27) {
  588.                                     modIcons[10].drawSprite(xPos + 1, yPos - 10 + yOffset);
  589.                                     xPos += 14;
  590.                                 } else if (byte0 == 28) {
  591.                                     modIcons[10].drawSprite(xPos + 1, yPos - 10 + yOffset);
  592.                                     xPos += 14;
  593.                                 } else if (byte0 == 29) {
  594.                                     modIcons[10].drawSprite(xPos + 1, yPos - 10 + yOffset);
  595.                                     xPos += 14;
  596.                                 }
  597.                                
  598.                                 newRegularFont.drawBasicString(s1 + ":", xPos, yPos + yOffset, changeChatArea ? 0xffffff : 0, changeChatArea ? 0 : -1);
  599.                                 xPos += newRegularFont.getTextWidth(s1) + 8;
  600.                                 newRegularFont.drawBasicString(chatMessages[k], xPos, yPos + yOffset, changeChatArea ? 0x7FA9FF : 255, changeChatArea ? 0 : -1);
  601.                             }
  602.                             j++;
  603.                             j77++;
  604.                         }
  605.                     }
  606.                     if ((chatType == 3 || chatType == 7)
  607.                             && (splitPrivateChat == 0 || chatTypeView == 2)
  608.                             && (chatType == 7 || privateChatMode == 0 || privateChatMode == 1
  609.                                     && isFriendOrSelf(s1))) {
  610.                         if (chatTypeView == 2 || chatTypeView == 0) {
  611.                             if (yPos > 0 && yPos < 210) {
  612.                                 int k1 = 11;
  613.                                 newRegularFont.drawBasicString("From", k1,
  614.                                         yPos + yOffset, changeChatArea ? 0xFFFFFF : 0, changeChatArea ? 0 : -1);
  615.                                 if (byte0 == 3 || byte0 == 2 || byte0 == 1
  616.                                         || byte0 == 0) {
  617.                                     k1 += textDrawingArea.getTextWidth("From ");
  618.                                 } else if (byte0 == 4 || byte0 == 5 || byte0 == 6 || byte0 == 7 || byte0 == 8
  619.                                         || byte0 == 9 || byte0 == 10 || byte0 == 11 || byte0 == 12 || byte0 == 13
  620.                                         || byte0 == 14 || byte0 == 15 || byte0 == 16 || byte0 == 17 || byte0 == 18
  621.                                         || byte0 == 19 || byte0 == 20 || byte0 == 21 || byte0 == 22 || byte0 == 23
  622.                                         || byte0 == 24 || byte0 == 25 || byte0 == 26 || byte0 == 27 || byte0 == 28
  623.                                         || byte0 == 29) {
  624.                                     k1 += textDrawingArea.getTextWidth("From ");
  625.                                 }
  626.                                 if (byte0 == 1) {
  627.                                     modIcons[0].drawSprite(k1 - 1, yPos - 11 + yOffset);
  628.                                     k1 += 12;
  629.                                 } else if (byte0 == 2) {
  630.                                     modIcons[1].drawSprite(k1 - 2, yPos - 13 + yOffset);
  631.                                     k1 += 12;
  632.                                 } else if (byte0 == 3) {
  633.                                     modIcons[2].drawSprite(k1 - 1, yPos - 11 + yOffset);
  634.                                     k1 += 12;
  635.                                 } else if (byte0 == 4) {
  636.                                     modIcons[3].drawSprite(k1, yPos - 10 + yOffset);
  637.                                     k1 += 12;
  638.                                 } else if (byte0 == 5) {
  639.                                     modIcons[4].drawSprite(k1, yPos - 10 + yOffset);
  640.                                     k1 += 12;
  641.                                 } else if (byte0 == 6) {
  642.                                     modIcons[5].drawSprite(k1, yPos - 10 + yOffset);
  643.                                     k1 += 12;
  644.                                 } else if (byte0 == 7) {
  645.                                     modIcons[6].drawSprite(k1, yPos - 10 + yOffset);
  646.                                     k1 += 12;
  647.                                 } else if (byte0 == 8) {
  648.                                     modIcons[7].drawSprite(k1, yPos - 10 + yOffset);
  649.                                     k1 += 12;
  650.                                 } else if (byte0 == 9) {
  651.                                     modIcons[8].drawSprite(k1, yPos - 10 + yOffset);
  652.                                     k1 += 14;
  653.                                 } else if (byte0 == 10) {
  654.                                     modIcons[10].drawSprite(k1, yPos - 10 + yOffset);
  655.                                     k1 += 12;
  656.                                 } else if (byte0 == 11) {
  657.                                     modIcons[10].drawSprite(k1, yPos - 10 + yOffset);
  658.                                     k1 += 12;
  659.                                 } else if (byte0 == 12) {
  660.                                     modIcons[10].drawSprite(k1, yPos - 10 + yOffset);
  661.                                     k1 += 12;
  662.                                 } else if (byte0 == 13) {
  663.                                     modIcons[10].drawSprite(k1, yPos - 10 + yOffset);
  664.                                     k1 += 12;
  665.                                 } else if (byte0 == 14) {
  666.                                     modIcons[10].drawSprite(k1, yPos - 10 + yOffset);
  667.                                     k1 += 12;
  668.                                 } else if (byte0 == 15) {
  669.                                     modIcons[10].drawSprite(k1, yPos - 10 + yOffset);
  670.                                     k1 += 12;
  671.                                 } else if (byte0 == 16) {
  672.                                     modIcons[10].drawSprite(k1, yPos - 10 + yOffset);
  673.                                     k1 += 12;
  674.                                 } else if (byte0 == 17) {
  675.                                     modIcons[10].drawSprite(k1, yPos - 10 + yOffset);
  676.                                     k1 += 12;
  677.                                 } else if (byte0 == 18) {
  678.                                     modIcons[10].drawSprite(k1, yPos - 10 + yOffset);
  679.                                     k1 += 12;
  680.                                 } else if (byte0 == 19) {
  681.                                     modIcons[10].drawSprite(k1, yPos - 10 + yOffset);
  682.                                     k1 += 12;
  683.                                 } else if (byte0 == 20) {
  684.                                     modIcons[10].drawSprite(k1, yPos - 10 + yOffset);
  685.                                     k1 += 12;
  686.                                 } else if (byte0 == 21) {
  687.                                     modIcons[10].drawSprite(k1, yPos - 10 + yOffset);
  688.                                     k1 += 12;
  689.                                 } else if (byte0 == 22) {
  690.                                     modIcons[10].drawSprite(k1, yPos - 10 + yOffset);
  691.                                     k1 += 12;
  692.                                 } else if (byte0 == 23) {
  693.                                     modIcons[10].drawSprite(k1, yPos - 10 + yOffset);
  694.                                     k1 += 12;
  695.                                 } else if (byte0 == 24) {
  696.                                     modIcons[10].drawSprite(k1, yPos - 10 + yOffset);
  697.                                     k1 += 12;
  698.                                 } else if (byte0 == 25) {
  699.                                     modIcons[10].drawSprite(k1, yPos - 10 + yOffset);
  700.                                     k1 += 12;
  701.                                 } else if (byte0 == 26) {
  702.                                     modIcons[10].drawSprite(k1, yPos - 10 + yOffset);
  703.                                     k1 += 12;
  704.                                 } else if (byte0 == 27) {
  705.                                     modIcons[10].drawSprite(k1, yPos - 10 + yOffset);
  706.                                     k1 += 12;
  707.                                 } else if (byte0 == 28) {
  708.                                     modIcons[10].drawSprite(k1, yPos - 10 + yOffset);
  709.                                     k1 += 12;
  710.                                 } else if (byte0 == 29) {
  711.                                     modIcons[10].drawSprite(k1, yPos - 10 + yOffset);
  712.                                     k1 += 12;
  713.                                 }
  714.                                
  715.                                 newRegularFont.drawBasicString(s1 + ":", k1, yPos + yOffset, changeChatArea ? 0xFFFFFF : 0, changeChatArea ? 0 : -1);
  716.                                 k1 += newRegularFont.getTextWidth(s1) + 8;
  717.                                 newRegularFont.drawBasicString(chatMessages[k], k1, yPos + yOffset, changeChatArea ? 0xFF00D4 : 0x800000, changeChatArea ? 0 : -1);
  718.                             }
  719.                             j++;
  720.                             j77++;
  721.                         }
  722.                     }
  723.                     if (chatType == 4
  724.                             && (tradeMode == 0 || tradeMode == 1
  725.                                     && isFriendOrSelf(s1))) {
  726.                         if (chatTypeView == 3 || chatTypeView == 0) {
  727.                             if (yPos > 0 && yPos < 210)
  728.                                 newRegularFont.drawBasicString(s1 + " "
  729.                                         + chatMessages[k], 11, yPos + yOffset, changeChatArea ? 0xFF00D4 : 0x800000,
  730.                                                 changeChatArea ?  0 : -1);
  731.                             j++;
  732.                             j77++;
  733.                         }
  734.                     }
  735.                     if (chatType == 5 && splitPrivateChat == 0
  736.                             && privateChatMode < 2) {
  737.                         if (chatTypeView == 2 || chatTypeView == 0) {
  738.                             if (yPos > 0 && yPos < 210)
  739.                                 newRegularFont.drawBasicString(chatMessages[k],
  740.                                         11, yPos + yOffset, changeChatArea ? 0xFF00D4 : 0x800000, changeChatArea ?  0 : -1);
  741.                             j++;
  742.                             j77++;
  743.                         }
  744.                     }
  745.                     if (chatType == 6
  746.                             && (splitPrivateChat == 0 || chatTypeView == 2)
  747.                             && privateChatMode < 2) {
  748.                         if (chatTypeView == 2 || chatTypeView == 0) {
  749.                             if (yPos > 0 && yPos < 210) {
  750.                                 newRegularFont.drawBasicString(
  751.                                         "To " + s1 + ":", 11, yPos + yOffset, changeChatArea ? 0xffffff : 0, changeChatArea ?  0 : -1);
  752.                                 newRegularFont.drawBasicString(
  753.                                         chatMessages[k],
  754.                                         15 + newRegularFont.getTextWidth("To :"
  755.                                                 + s1), yPos + yOffset, changeChatArea ? 0xFF00D4 : 0x800000, changeChatArea ?  0 : -1);
  756.                             }
  757.                             j++;
  758.                             j77++;
  759.                         }
  760.                     }
  761.                     if (chatType == 8
  762.                             && (tradeMode == 0 || tradeMode == 1
  763.                                     && isFriendOrSelf(s1))) {
  764.                         if (chatTypeView == 3 || chatTypeView == 0) {
  765.                             if (yPos > 0 && yPos < 210)
  766.                                 newRegularFont.drawBasicString(s1 + " "
  767.                                         + chatMessages[k], 11, yPos + yOffset,
  768.                                         0x7e3200, changeChatArea ?  0 : -1);
  769.                             j++;
  770.                             j77++;
  771.                         }
  772.                         if (chatType == 11 && (clanChatMode == 0)) {
  773.                             if (chatTypeView == 11) {
  774.                                 if (yPos > 0 && yPos < 110)
  775.                                     newRegularFont.drawBasicString(s1 + " "
  776.                                             + chatMessages[k], 19, yPos + yOffset,
  777.                                             0x7e3200, changeChatArea ?  0 : -1);
  778.                                 j++;
  779.                                 j77++;
  780.                             }
  781.                         }
  782.                         if (chatType == 12) {
  783.                             if (chatTypeView == 11 || chatTypeView == 0) {
  784.                                 if (yPos > 3 && yPos < 130) {
  785.                                     String title = "<col=0000FF>"
  786.                                             + clanTitles[k] + "</col>";
  787.                                     String username = (chatRights[k] > 0 ? "<img="
  788.                                             + (chatRights[k] - 1) + ">"
  789.                                             : "")
  790.                                             + TextClass.fixName(chatNames[k]);
  791.                                     String message = "<col=800000>"
  792.                                             + chatMessages[k] + "</col>";
  793.                                     newRegularFont.drawBasicString("[" + title
  794.                                             + "] " + username + ": " + message,
  795.                                             11, yPos + yOffset, changeChatArea ? 0xFFFFFF : 0, changeChatArea ?  0 : -1);
  796.                                 }
  797.                                 j++;
  798.                                 j77++;
  799.                             }
  800.                         }
  801.                     }
  802.                     if (chatType == 16) {
  803.                         int j2 = 40 + 11;
  804.                         int clanNameWidth = textDrawingArea
  805.                                 .getTextWidth(clanname);
  806.                         if (chatTypeView == 11 || chatTypeView == 0) {
  807.                             if (yPos > 0 && yPos < 110)
  808.                                 switch (chatRights[k]) {
  809.                                 case 1:
  810.                                     j2 += clanNameWidth;
  811.                                     modIcons[0].drawSprite(j2 - 18, yPos - 12 + yOffset);
  812.                                     j2 += 15;
  813.                                     break;
  814.                                 case 2:
  815.                                     j2 += clanNameWidth;
  816.                                     modIcons[1].drawSprite(j2 - 18, yPos - 12 + yOffset);
  817.                                     j2 += 15;
  818.                                     break;
  819.                                 case 3:
  820.                                     j2 += clanNameWidth;
  821.                                     modIcons[2].drawSprite(j2 - 18, yPos - 12 + yOffset);
  822.                                     j2 += 15;
  823.                                     break;
  824.                                 case 4:
  825.                                     j2 += clanNameWidth;
  826.                                     modIcons[3].drawSprite(j2 - 18, yPos - 12 + yOffset);
  827.                                     j2 += 15;
  828.                                     break;
  829.                                 case 5:
  830.                                     j2 += clanNameWidth;
  831.                                     modIcons[4].drawSprite(j2 - 18, yPos - 12 + yOffset);
  832.                                     j2 += 15;
  833.                                     break;
  834.                                 case 6:
  835.                                     j2 += clanNameWidth;
  836.                                     modIcons[5].drawSprite(j2 - 18, yPos - 12 + yOffset);
  837.                                     j2 += 15;
  838.                                     break;
  839.                                 case 7:
  840.                                     j2 += clanNameWidth;
  841.                                     modIcons[6].drawSprite(j2 - 18, yPos - 12 + yOffset);
  842.                                     j2 += 15;
  843.                                     break;
  844.                                 case 8:
  845.                                     j2 += clanNameWidth;
  846.                                     modIcons[7].drawSprite(j2 - 18, yPos - 12 + yOffset);
  847.                                     j2 += 15;
  848.                                     break;
  849.                                 case 9:
  850.                                     j2 += clanNameWidth;
  851.                                     modIcons[8].drawSprite(j2 - 18, yPos - 12 + yOffset);
  852.                                     j2 += 15;
  853.                                     break;
  854.                                 case 10:
  855.                                     j2 += clanNameWidth;
  856.                                     modIcons[10].drawSprite(j2 - 18, yPos - 12 + yOffset);
  857.                                     j2 += 15;
  858.                                     break;
  859.                                 case 11:
  860.                                     j2 += clanNameWidth;
  861.                                     modIcons[10].drawSprite(j2 - 18, yPos - 12 + yOffset);
  862.                                     j2 += 15;
  863.                                     break;
  864.                                 case 12:
  865.                                     j2 += clanNameWidth;
  866.                                     modIcons[10].drawSprite(j2 - 18, yPos - 12 + yOffset);
  867.                                     j2 += 15;
  868.                                     break;
  869.                                 case 13:
  870.                                     j2 += clanNameWidth;
  871.                                     modIcons[10].drawSprite(j2 - 18, yPos - 12 + yOffset);
  872.                                     j2 += 15;
  873.                                     break;
  874.                                 case 14:
  875.                                     j2 += clanNameWidth;
  876.                                     modIcons[10].drawSprite(j2 - 18, yPos - 12 + yOffset);
  877.                                     j2 += 15;
  878.                                     break;
  879.                                 case 15:
  880.                                     j2 += clanNameWidth;
  881.                                     modIcons[10].drawSprite(j2 - 18, yPos - 12 + yOffset);
  882.                                     j2 += 15;
  883.                                     break;
  884.                                 case 16:
  885.                                     j2 += clanNameWidth;
  886.                                     modIcons[10].drawSprite(j2 - 18, yPos - 12 + yOffset);
  887.                                     j2 += 15;
  888.                                     break;
  889.                                 case 17:
  890.                                     j2 += clanNameWidth;
  891.                                     modIcons[10].drawSprite(j2 - 18, yPos - 12 + yOffset);
  892.                                     j2 += 15;
  893.                                     break;
  894.                                 case 18:
  895.                                     j2 += clanNameWidth;
  896.                                     modIcons[10].drawSprite(j2 - 18, yPos - 12 + yOffset);
  897.                                     j2 += 15;
  898.                                     break;
  899.                                 case 19:
  900.                                     j2 += clanNameWidth;
  901.                                     modIcons[10].drawSprite(j2 - 18, yPos - 12 + yOffset);
  902.                                     j2 += 15;
  903.                                     break;
  904.                                 case 20:
  905.                                     j2 += clanNameWidth;
  906.                                     modIcons[10].drawSprite(j2 - 18, yPos - 12 + yOffset);
  907.                                     j2 += 15;
  908.                                     break;
  909.                                 case 21:
  910.                                     j2 += clanNameWidth;
  911.                                     modIcons[10].drawSprite(j2 - 18, yPos - 12 + yOffset);
  912.                                     j2 += 15;
  913.                                     break;
  914.                                 case 22:
  915.                                     j2 += clanNameWidth;
  916.                                     modIcons[10].drawSprite(j2 - 18, yPos - 12 + yOffset);
  917.                                     j2 += 15;
  918.                                     break;
  919.                                 case 23:
  920.                                     j2 += clanNameWidth;
  921.                                     modIcons[10].drawSprite(j2 - 18, yPos - 12 + yOffset);
  922.                                     j2 += 15;
  923.                                     break;
  924.                                 case 24:
  925.                                     j2 += clanNameWidth;
  926.                                     modIcons[10].drawSprite(j2 - 18, yPos - 12 + yOffset);
  927.                                     j2 += 15;
  928.                                     break;
  929.                                 case 25:
  930.                                     j2 += clanNameWidth;
  931.                                     modIcons[10].drawSprite(j2 - 18, yPos - 12 + yOffset);
  932.                                     j2 += 15;
  933.                                     break;
  934.                                 case 26:
  935.                                     j2 += clanNameWidth;
  936.                                     modIcons[10].drawSprite(j2 - 18, yPos - 12 + yOffset);
  937.                                     j2 += 15;
  938.                                     break;
  939.                                 case 27:
  940.                                     j2 += clanNameWidth;
  941.                                     modIcons[10].drawSprite(j2 - 18, yPos - 12 + yOffset);
  942.                                     j2 += 15;
  943.                                     break;
  944.                                 case 28:
  945.                                     j2 += clanNameWidth;
  946.                                     modIcons[10].drawSprite(j2 - 18, yPos - 12 + yOffset);
  947.                                     j2 += 15;
  948.                                     break;
  949.                                 case 29:
  950.                                     j2 += clanNameWidth;
  951.                                     modIcons[10].drawSprite(j2 - 18, yPos - 12 + yOffset);
  952.                                     j2 += 15;
  953.                                     break;
  954.                                 default:
  955.                                     j2 += clanNameWidth;
  956.                                     break;
  957.                                 }
  958.                             newRegularFont.drawBasicString("[", 19, yPos + yOffset, changeChatArea ? 0xffffff : 0, changeChatArea ? 0 : -1);
  959.                             newRegularFont.drawBasicString("]", clanNameWidth + 16 + 11, yPos, changeChatArea ? 0xffffff : 0, changeChatArea ? 0 : -1);
  960.                             newRegularFont.drawBasicString(""+ capitalize(clanname) + "", 25, yPos + yOffset, changeChatArea ? 0x7FA9FF : 255, changeChatArea ? 0 : -1);
  961.                             newRegularFont.drawBasicString(capitalize(chatNames[k]) + ":", j2 - 17, yPos + yOffset);
  962.                             j2 += newRegularFont.getTextWidth(chatNames[k]) + 7;
  963.                             newRegularFont.drawBasicString(capitalize(chatMessages[k]), j2 - 16, yPos + yOffset,changeChatArea ? 0xFF00D4 : 0x800000, changeChatArea ? 0 : -1);
  964.  
  965.                             j++;
  966.                             j77++;
  967.                         }
  968.                     }
  969.                 }
  970.             DrawingArea.defaultDrawingAreaSize();
  971.             anInt1211 = j * 14 + 7 + 5;
  972.             if (anInt1211 < 111)
  973.                 anInt1211 = 111;
  974.             drawScrollbar(114, anInt1211 - anInt1089 - 113, 7 + yOffset, 496, anInt1211, changeChatArea);  
  975.             String fixedString;
  976.  
  977.             if (myPlayer != null && myPlayer.name != null)
  978.                 fixedString = "<col=" + titleColor(myPlayer.titleColor, 0)
  979.                         + ">" + myPlayer.title + "</col>" + myPlayer.name;
  980.             else
  981.                 fixedString = TextClass.fixName(capitalize(myUsername));
  982.  
  983.             String s;
  984.             if (myPlayer != null && myPlayer.name != null)
  985.                 s = "" + myPlayer.title + "" + myPlayer.name;
  986.             else
  987.                 s = TextClass.fixName(capitalize(myUsername));
  988.             int xPos = 0;
  989.             int yPos = 0;
  990.             DrawingArea.setDrawingArea(140 + yOffset, 8, 509, 120 + yOffset);
  991.             if (myPrivilege == 0) { // Player
  992.                 newRegularFont.drawBasicString(fixedString + "", 11, 133 + yOffset, changeChatArea ? 0xFFFFFF : 0, changeChatArea ? 0 : -1);
  993.                 textDrawingArea.method385(changeChatArea ? 0xFFFFFF : 0, ": ", 133 + yOffset, (11) + textDrawingArea.getTextWidth(s));
  994.                 newRegularFont.drawBasicString(inputString + ((loopCycle % 40 < 20) ? "|" : ""), 13 + textDrawingArea.getTextWidth(s + ": "), 133 + yOffset, changeChatArea ? 0x7FA9FF : 255, changeChatArea ?  0 : -1);
  995.             } else if (myPrivilege == 1) { //IronMan
  996.                 modIcons[0].drawSprite(10 + xPos, 122 + yPos + yOffset);
  997.                 xPos += 14;
  998.                 newRegularFont.drawBasicString(fixedString + "", 23, 133 + yOffset, changeChatArea ? 0xFFFFFF : 0, changeChatArea ? 0 : -1);
  999.                 textDrawingArea.method385(changeChatArea ? 0xFFFFFF : 0, ": ", 133 + yOffset,(23 + textDrawingArea.getTextWidth(s)));
  1000.                 newRegularFont.drawBasicString(inputString + ((loopCycle % 40 < 20) ? "|" : ""), 25 + textDrawingArea.getTextWidth(s + ": "), 133 + yOffset, changeChatArea ? 0x7FA9FF : 255, changeChatArea ?  0 : -1);
  1001.             } else if (myPrivilege == 2) { //Ultimate IronMan
  1002.                 modIcons[1].drawSprite(10 + xPos, 122 + yPos + yOffset);
  1003.                 xPos += 14;
  1004.                 newRegularFont.drawBasicString(fixedString + "", 23, 133 + yOffset, changeChatArea ? 0xFFFFFF : 0, changeChatArea ? 0 : -1);
  1005.                 textDrawingArea.method385(changeChatArea ? 0xFFFFFF : 0, ": ", 133 + yOffset,(23 + textDrawingArea.getTextWidth(s)));
  1006.                 newRegularFont.drawBasicString(inputString + ((loopCycle % 40 < 20) ? "|" : ""), 25 + textDrawingArea.getTextWidth(s + ": "), 133 + yOffset, changeChatArea ? 0x7FA9FF : 255, changeChatArea ?  0 : -1);
  1007.             } else if (myPrivilege == 3) { //Hardcore IronMan
  1008.                 modIcons[2].drawSprite(10 + xPos, 122 + yPos + yOffset);
  1009.                 xPos += 14;
  1010.                 newRegularFont.drawBasicString(fixedString + "", 23, 133 + yOffset, changeChatArea ? 0xFFFFFF : 0, changeChatArea ? 0 : -1);
  1011.                 textDrawingArea.method385(changeChatArea ? 0xFFFFFF : 0, ": ", 133 + yOffset,(23 + textDrawingArea.getTextWidth(s)));
  1012.                 newRegularFont.drawBasicString(inputString + ((loopCycle % 40 < 20) ? "|" : ""), 25 + textDrawingArea.getTextWidth(s + ": "), 133 + yOffset, changeChatArea ? 0x7FA9FF : 255, changeChatArea ?  0 : -1);
  1013.             } else if (myPrivilege == 4) { //Veteran
  1014.                 modIcons[3].drawSprite(10 + xPos, 122 + yPos + yOffset);
  1015.                 xPos += 14;
  1016.                 newRegularFont.drawBasicString(fixedString + "", 23, 133 + yOffset, changeChatArea ? 0xFFFFFF : 0, changeChatArea ? 0 : -1);
  1017.                 textDrawingArea.method385(changeChatArea ? 0xFFFFFF : 0, ": ", 133 + yOffset, (23 + textDrawingArea.getTextWidth(s)));
  1018.                 newRegularFont.drawBasicString(inputString + ((loopCycle % 40 < 20) ? "|" : ""), 25 + textDrawingArea.getTextWidth(s + ": "), 133 + yOffset, changeChatArea ? 0x7FA9FF : 255, changeChatArea ? 0 : -1);
  1019.             } else if (myPrivilege == 5) { //Trusted
  1020.                 modIcons[4].drawSprite(10 + xPos, 122 + yPos + yOffset);
  1021.                 xPos += 14;
  1022.                 newRegularFont.drawBasicString(fixedString + "", 23, 133 + yOffset, changeChatArea ? 0xFFFFFF : 0, changeChatArea ? 0 : -1);
  1023.                 modIcons[9].drawSprite(textDrawingArea.getTextWidth(s) + 24, 123 + yOffset);
  1024.                 textDrawingArea.method385(changeChatArea ? 0xFFFFFF : 0, ": ", 133 + yOffset, (38 + textDrawingArea.getTextWidth(s)));
  1025.                 newRegularFont.drawBasicString(inputString + ((loopCycle % 40 < 20) ? "|" : ""), 36 + textDrawingArea.getTextWidth(s + ": "), 133 + yOffset, changeChatArea ? 0x7FA9FF : 255, changeChatArea ? 0 : -1);
  1026.             } else if (myPrivilege == 6) { //Youtuber
  1027.                 modIcons[5].drawSprite(10 + xPos, 122 + yPos + yOffset);
  1028.                 xPos += 14;
  1029.                 newRegularFont.drawBasicString(fixedString + "", 23, 133 + yOffset, changeChatArea ? 0xFFFFFF : 0, changeChatArea ? 0 : -1);
  1030.                 modIcons[9].drawSprite(textDrawingArea.getTextWidth(s) + 24, 123 + yOffset);
  1031.                 textDrawingArea.method385(changeChatArea ? 0xFFFFFF : 0, ": ", 133 + yOffset, (38 + textDrawingArea.getTextWidth(s)));
  1032.                 newRegularFont.drawBasicString(inputString + ((loopCycle % 40 < 20) ? "|" : ""), 36 + textDrawingArea.getTextWidth(s + ": "), 133 + yOffset, changeChatArea ? 0x7FA9FF : 255, changeChatArea ? 0 : -1);
  1033.             } else if (myPrivilege == 7) { //Streamer
  1034.                 modIcons[6].drawSprite(10 + xPos, 122 + yPos + yOffset);
  1035.                 xPos += 14;
  1036.                 newRegularFont.drawBasicString(fixedString + "", 23, 133 + yOffset, changeChatArea ? 0xFFFFFF : 0, changeChatArea ? 0 : -1);
  1037.                 modIcons[9].drawSprite(textDrawingArea.getTextWidth(s) + 24, 123 + yOffset);
  1038.                 textDrawingArea.method385(changeChatArea ? 0xFFFFFF : 0, ": ", 133 + yOffset, (38 + textDrawingArea.getTextWidth(s)));
  1039.                 newRegularFont.drawBasicString(inputString + ((loopCycle % 40 < 20) ? "|" : ""), 36 + textDrawingArea.getTextWidth(s + ": "), 133 + yOffset, changeChatArea ? 0x7FA9FF : 255, changeChatArea ? 0 : -1);
  1040.             } else if (myPrivilege == 8) { //Graphics Designer
  1041.                 modIcons[7].drawSprite(9 + xPos, 122 + yPos + yOffset);
  1042.                 xPos += 14;
  1043.                 newRegularFont.drawBasicString(fixedString + "", 23, 133 + yOffset, changeChatArea ? 0xFFFFFF : 0, changeChatArea ? 0 : -1);
  1044.                 modIcons[9].drawSprite(textDrawingArea.getTextWidth(s) + 24, 123 + yOffset);
  1045.                 textDrawingArea.method385(changeChatArea ? 0xFFFFFF : 0, ": ", 133 + yOffset, (38 + textDrawingArea.getTextWidth(s)));
  1046.                 newRegularFont.drawBasicString(inputString + ((loopCycle % 40 < 20) ? "|" : ""), 36 + textDrawingArea.getTextWidth(s + ": "), 133 + yOffset, changeChatArea ? 0x7FA9FF : 255, changeChatArea ? 0 : -1);
  1047.             } else if (myPrivilege == 9) { //Wiki Editor
  1048.                 modIcons[8].drawSprite(10 + xPos, 122 + yPos + yOffset);
  1049.                 xPos += 14;
  1050.                 newRegularFont.drawBasicString(fixedString + "", 23, 133 + yOffset, changeChatArea ? 0xFFFFFF : 0, changeChatArea ? 0 : -1);
  1051.                 modIcons[9].drawSprite(textDrawingArea.getTextWidth(s) + 24, 123 + yOffset);
  1052.                 textDrawingArea.method385(changeChatArea ? 0xFFFFFF : 0, ": ", 133 + yOffset, (38 + textDrawingArea.getTextWidth(s)));
  1053.                 newRegularFont.drawBasicString(inputString + ((loopCycle % 40 < 20) ? "|" : ""), 36 + textDrawingArea.getTextWidth(s + ": "), 133 + yOffset, changeChatArea ? 0x7FA9FF : 255, changeChatArea ? 0 : -1);
  1054.             } else if (myPrivilege == 10) { //Wiki Administrator
  1055.                 modIcons[10].drawSprite(10 + xPos, 122 + yPos + yOffset);
  1056.                 xPos += 14;
  1057.                 newRegularFont.drawBasicString(fixedString + "", 23, 133 + yOffset, changeChatArea ? 0xFFFFFF : 0, changeChatArea ? 0 : -1);
  1058.                 modIcons[9].drawSprite(textDrawingArea.getTextWidth(s) + 24, 123 + yOffset);
  1059.                 textDrawingArea.method385(changeChatArea ? 0xFFFFFF : 0, ": ", 133 + yOffset, (38 + textDrawingArea.getTextWidth(s)));
  1060.                 newRegularFont.drawBasicString(inputString + ((loopCycle % 40 < 20) ? "|" : ""), 36 + textDrawingArea.getTextWidth(s + ": "), 133 + yOffset, changeChatArea ? 0x7FA9FF : 255, changeChatArea ? 0 : -1);
  1061.             } else if (myPrivilege == 11) { //Sapphire Donator
  1062.                 modIcons[10].drawSprite(10 + xPos, 122 + yPos + yOffset);
  1063.                 xPos += 14;
  1064.                 newRegularFont.drawBasicString(fixedString + "", 23, 133 + yOffset, changeChatArea ? 0xFFFFFF : 0, changeChatArea ? 0 : -1);
  1065.                 modIcons[9].drawSprite(textDrawingArea.getTextWidth(s) + 24, 123 + yOffset);
  1066.                 textDrawingArea.method385(changeChatArea ? 0xFFFFFF : 0, ": ", 133 + yOffset, (38 + textDrawingArea.getTextWidth(s)));
  1067.                 newRegularFont.drawBasicString(inputString + ((loopCycle % 40 < 20) ? "|" : ""), 36 + textDrawingArea.getTextWidth(s + ": "), 133 + yOffset, changeChatArea ? 0x7FA9FF : 255, changeChatArea ? 0 : -1);
  1068.             } else if (myPrivilege == 12) { //Emerald Donator
  1069.                 modIcons[10].drawSprite(10 + xPos, 122 + yPos + yOffset);
  1070.                 xPos += 14;
  1071.                 newRegularFont.drawBasicString(fixedString + "", 23, 133 + yOffset, changeChatArea ? 0xFFFFFF : 0, changeChatArea ? 0 : -1);
  1072.                 modIcons[9].drawSprite(textDrawingArea.getTextWidth(s) + 24, 123 + yOffset);
  1073.                 textDrawingArea.method385(changeChatArea ? 0xFFFFFF : 0, ": ", 133 + yOffset, (38 + textDrawingArea.getTextWidth(s)));
  1074.                 newRegularFont.drawBasicString(inputString + ((loopCycle % 40 < 20) ? "|" : ""), 36 + textDrawingArea.getTextWidth(s + ": "), 133 + yOffset, changeChatArea ? 0x7FA9FF : 255, changeChatArea ? 0 : -1);
  1075.             } else if (myPrivilege == 13) { //Ruby Donator
  1076.                 modIcons[10].drawSprite(10 + xPos, 122 + yPos + yOffset);
  1077.                 xPos += 14;
  1078.                 newRegularFont.drawBasicString(fixedString + "", 23, 133 + yOffset, changeChatArea ? 0xFFFFFF : 0, changeChatArea ? 0 : -1);
  1079.                 modIcons[9].drawSprite(textDrawingArea.getTextWidth(s) + 24, 123 + yOffset);
  1080.                 textDrawingArea.method385(changeChatArea ? 0xFFFFFF : 0, ": ", 133 + yOffset, (38 + textDrawingArea.getTextWidth(s)));
  1081.                 newRegularFont.drawBasicString(inputString + ((loopCycle % 40 < 20) ? "|" : ""), 36 + textDrawingArea.getTextWidth(s + ": "), 133 + yOffset, changeChatArea ? 0x7FA9FF : 255, changeChatArea ? 0 : -1);
  1082.             } else if (myPrivilege == 14) { //Diamond Donator
  1083.                 modIcons[10].drawSprite(10 + xPos, 122 + yPos + yOffset);
  1084.                 xPos += 14;
  1085.                 newRegularFont.drawBasicString(fixedString + "", 23, 133 + yOffset, changeChatArea ? 0xFFFFFF : 0, changeChatArea ? 0 : -1);
  1086.                 modIcons[9].drawSprite(textDrawingArea.getTextWidth(s) + 24, 123 + yOffset);
  1087.                 textDrawingArea.method385(changeChatArea ? 0xFFFFFF : 0, ": ", 133 + yOffset, (38 + textDrawingArea.getTextWidth(s)));
  1088.                 newRegularFont.drawBasicString(inputString + ((loopCycle % 40 < 20) ? "|" : ""), 36 + textDrawingArea.getTextWidth(s + ": "), 133 + yOffset, changeChatArea ? 0x7FA9FF : 255, changeChatArea ? 0 : -1);
  1089.             } else if (myPrivilege == 15) { //Dragonstone Donator
  1090.                 modIcons[10].drawSprite(10 + xPos, 122 + yPos + yOffset);
  1091.                 xPos += 14;
  1092.                 newRegularFont.drawBasicString(fixedString + "", 23, 133 + yOffset, changeChatArea ? 0xFFFFFF : 0, changeChatArea ? 0 : -1);
  1093.                 modIcons[9].drawSprite(textDrawingArea.getTextWidth(s) + 24, 123 + yOffset);
  1094.                 textDrawingArea.method385(changeChatArea ? 0xFFFFFF : 0, ": ", 133 + yOffset, (38 + textDrawingArea.getTextWidth(s)));
  1095.                 newRegularFont.drawBasicString(inputString + ((loopCycle % 40 < 20) ? "|" : ""), 36 + textDrawingArea.getTextWidth(s + ": "), 133 + yOffset, changeChatArea ? 0x7FA9FF : 255, changeChatArea ? 0 : -1);
  1096.             } else if (myPrivilege == 16) { //Onyx Donator
  1097.                 modIcons[10].drawSprite(10 + xPos, 122 + yPos + yOffset);
  1098.                 xPos += 14;
  1099.                 newRegularFont.drawBasicString(fixedString + "", 23, 133 + yOffset, changeChatArea ? 0xFFFFFF : 0, changeChatArea ? 0 : -1);
  1100.                 modIcons[9].drawSprite(textDrawingArea.getTextWidth(s) + 24, 123 + yOffset);
  1101.                 textDrawingArea.method385(changeChatArea ? 0xFFFFFF : 0, ": ", 133 + yOffset, (38 + textDrawingArea.getTextWidth(s)));
  1102.                 newRegularFont.drawBasicString(inputString + ((loopCycle % 40 < 20) ? "|" : ""), 36 + textDrawingArea.getTextWidth(s + ": "), 133 + yOffset, changeChatArea ? 0x7FA9FF : 255, changeChatArea ? 0 : -1);
  1103.             } else if (myPrivilege == 17) { //Zenyte Donator
  1104.                 modIcons[10].drawSprite(10 + xPos, 122 + yPos + yOffset);
  1105.                 xPos += 14;
  1106.                 newRegularFont.drawBasicString(fixedString + "", 23, 133 + yOffset, changeChatArea ? 0xFFFFFF : 0, changeChatArea ? 0 : -1);
  1107.                 modIcons[9].drawSprite(textDrawingArea.getTextWidth(s) + 24, 123 + yOffset);
  1108.                 textDrawingArea.method385(changeChatArea ? 0xFFFFFF : 0, ": ", 133 + yOffset, (38 + textDrawingArea.getTextWidth(s)));
  1109.                 newRegularFont.drawBasicString(inputString + ((loopCycle % 40 < 20) ? "|" : ""), 36 + textDrawingArea.getTextWidth(s + ": "), 133 + yOffset, changeChatArea ? 0x7FA9FF : 255, changeChatArea ? 0 : -1);
  1110.             } else if (myPrivilege == 18) { //Support
  1111.                 modIcons[10].drawSprite(10 + xPos, 122 + yPos + yOffset);
  1112.                 xPos += 14;
  1113.                 newRegularFont.drawBasicString(fixedString + "", 23, 133 + yOffset, changeChatArea ? 0xFFFFFF : 0, changeChatArea ? 0 : -1);
  1114.                 modIcons[9].drawSprite(textDrawingArea.getTextWidth(s) + 24, 123 + yOffset);
  1115.                 textDrawingArea.method385(changeChatArea ? 0xFFFFFF : 0, ": ", 133 + yOffset, (38 + textDrawingArea.getTextWidth(s)));
  1116.                 newRegularFont.drawBasicString(inputString + ((loopCycle % 40 < 20) ? "|" : ""), 36 + textDrawingArea.getTextWidth(s + ": "), 133 + yOffset, changeChatArea ? 0x7FA9FF : 255, changeChatArea ? 0 : -1);
  1117.             } else if (myPrivilege == 19) { //Forum Moderator
  1118.                 modIcons[10].drawSprite(10 + xPos, 122 + yPos + yOffset);
  1119.                 xPos += 14;
  1120.                 newRegularFont.drawBasicString(fixedString + "", 23, 133 + yOffset, changeChatArea ? 0xFFFFFF : 0, changeChatArea ? 0 : -1);
  1121.                 modIcons[9].drawSprite(textDrawingArea.getTextWidth(s) + 24, 123 + yOffset);
  1122.                 textDrawingArea.method385(changeChatArea ? 0xFFFFFF : 0, ": ", 133 + yOffset, (38 + textDrawingArea.getTextWidth(s)));
  1123.                 newRegularFont.drawBasicString(inputString + ((loopCycle % 40 < 20) ? "|" : ""), 36 + textDrawingArea.getTextWidth(s + ": "), 133 + yOffset, changeChatArea ? 0x7FA9FF : 255, changeChatArea ? 0 : -1);
  1124.             } else if (myPrivilege == 20) { //Moderator
  1125.                 modIcons[10].drawSprite(10 + xPos, 122 + yPos + yOffset);
  1126.                 xPos += 14;
  1127.                 newRegularFont.drawBasicString(fixedString + "", 23, 133 + yOffset, changeChatArea ? 0xFFFFFF : 0, changeChatArea ? 0 : -1);
  1128.                 modIcons[9].drawSprite(textDrawingArea.getTextWidth(s) + 24, 123 + yOffset);
  1129.                 textDrawingArea.method385(changeChatArea ? 0xFFFFFF : 0, ": ", 133 + yOffset, (38 + textDrawingArea.getTextWidth(s)));
  1130.                 newRegularFont.drawBasicString(inputString + ((loopCycle % 40 < 20) ? "|" : ""), 36 + textDrawingArea.getTextWidth(s + ": "), 133 + yOffset, changeChatArea ? 0x7FA9FF : 255, changeChatArea ? 0 : -1);
  1131.             } else if (myPrivilege == 21) { //Global Moderator
  1132.                 modIcons[10].drawSprite(10 + xPos, 122 + yPos + yOffset);
  1133.                 xPos += 14;
  1134.                 newRegularFont.drawBasicString(fixedString + "", 23, 133 + yOffset, changeChatArea ? 0xFFFFFF : 0, changeChatArea ? 0 : -1);
  1135.                 modIcons[9].drawSprite(textDrawingArea.getTextWidth(s) + 24, 123 + yOffset);
  1136.                 textDrawingArea.method385(changeChatArea ? 0xFFFFFF : 0, ": ", 133 + yOffset, (38 + textDrawingArea.getTextWidth(s)));
  1137.                 newRegularFont.drawBasicString(inputString + ((loopCycle % 40 < 20) ? "|" : ""), 36 + textDrawingArea.getTextWidth(s + ": "), 133 + yOffset, changeChatArea ? 0x7FA9FF : 255, changeChatArea ? 0 : -1);
  1138.             } else if (myPrivilege == 22) { //Forum Administrator
  1139.                 modIcons[10].drawSprite(10 + xPos, 122 + yPos + yOffset);
  1140.                 xPos += 14;
  1141.                 newRegularFont.drawBasicString(fixedString + "", 23, 133 + yOffset, changeChatArea ? 0xFFFFFF : 0, changeChatArea ? 0 : -1);
  1142.                 modIcons[9].drawSprite(textDrawingArea.getTextWidth(s) + 24, 123 + yOffset);
  1143.                 textDrawingArea.method385(changeChatArea ? 0xFFFFFF : 0, ": ", 133 + yOffset, (38 + textDrawingArea.getTextWidth(s)));
  1144.                 newRegularFont.drawBasicString(inputString + ((loopCycle % 40 < 20) ? "|" : ""), 36 + textDrawingArea.getTextWidth(s + ": "), 133 + yOffset, changeChatArea ? 0x7FA9FF : 255, changeChatArea ? 0 : -1);
  1145.             } else if (myPrivilege == 23) { //Administrator
  1146.                 modIcons[10].drawSprite(10 + xPos, 122 + yPos + yOffset);
  1147.                 xPos += 14;
  1148.                 newRegularFont.drawBasicString(fixedString + "", 23, 133 + yOffset, changeChatArea ? 0xFFFFFF : 0, changeChatArea ? 0 : -1);
  1149.                 modIcons[9].drawSprite(textDrawingArea.getTextWidth(s) + 24, 123 + yOffset);
  1150.                 textDrawingArea.method385(changeChatArea ? 0xFFFFFF : 0, ": ", 133 + yOffset, (38 + textDrawingArea.getTextWidth(s)));
  1151.                 newRegularFont.drawBasicString(inputString + ((loopCycle % 40 < 20) ? "|" : ""), 36 + textDrawingArea.getTextWidth(s + ": "), 133 + yOffset, changeChatArea ? 0x7FA9FF : 255, changeChatArea ? 0 : -1);
  1152.             } else if (myPrivilege == 24) { //Global Administrator
  1153.                 modIcons[10].drawSprite(10 + xPos, 122 + yPos + yOffset);
  1154.                 xPos += 14;
  1155.                 newRegularFont.drawBasicString(fixedString + "", 23, 133 + yOffset, changeChatArea ? 0xFFFFFF : 0, changeChatArea ? 0 : -1);
  1156.                 modIcons[9].drawSprite(textDrawingArea.getTextWidth(s) + 24, 123 + yOffset);
  1157.                 textDrawingArea.method385(changeChatArea ? 0xFFFFFF : 0, ": ", 133 + yOffset, (38 + textDrawingArea.getTextWidth(s)));
  1158.                 newRegularFont.drawBasicString(inputString + ((loopCycle % 40 < 20) ? "|" : ""), 36 + textDrawingArea.getTextWidth(s + ": "), 133 + yOffset, changeChatArea ? 0x7FA9FF : 255, changeChatArea ? 0 : -1);
  1159.             } else if (myPrivilege == 25) { //Community Manager
  1160.                 modIcons[10].drawSprite(10 + xPos, 122 + yPos + yOffset);
  1161.                 xPos += 14;
  1162.                 newRegularFont.drawBasicString(fixedString + "", 23, 133 + yOffset, changeChatArea ? 0xFFFFFF : 0, changeChatArea ? 0 : -1);
  1163.                 modIcons[9].drawSprite(textDrawingArea.getTextWidth(s) + 24, 123 + yOffset);
  1164.                 textDrawingArea.method385(changeChatArea ? 0xFFFFFF : 0, ": ", 133 + yOffset, (38 + textDrawingArea.getTextWidth(s)));
  1165.                 newRegularFont.drawBasicString(inputString + ((loopCycle % 40 < 20) ? "|" : ""), 36 + textDrawingArea.getTextWidth(s + ": "), 133 + yOffset, changeChatArea ? 0x7FA9FF : 255, changeChatArea ? 0 : -1);
  1166.             } else if (myPrivilege == 26) { //Technical Support
  1167.                 modIcons[10].drawSprite(10 + xPos, 122 + yPos + yOffset);
  1168.                 xPos += 14;
  1169.                 newRegularFont.drawBasicString(fixedString + "", 23, 133 + yOffset, changeChatArea ? 0xFFFFFF : 0, changeChatArea ? 0 : -1);
  1170.                 modIcons[9].drawSprite(textDrawingArea.getTextWidth(s) + 24, 123 + yOffset);
  1171.                 textDrawingArea.method385(changeChatArea ? 0xFFFFFF : 0, ": ", 133 + yOffset, (38 + textDrawingArea.getTextWidth(s)));
  1172.                 newRegularFont.drawBasicString(inputString + ((loopCycle % 40 < 20) ? "|" : ""), 36 + textDrawingArea.getTextWidth(s + ": "), 133 + yOffset, changeChatArea ? 0x7FA9FF : 255, changeChatArea ? 0 : -1);
  1173.             } else if (myPrivilege == 27) { //Website Developer
  1174.                 modIcons[10].drawSprite(10 + xPos, 122 + yPos + yOffset);
  1175.                 xPos += 14;
  1176.                 newRegularFont.drawBasicString(fixedString + "", 23, 133 + yOffset, changeChatArea ? 0xFFFFFF : 0, changeChatArea ? 0 : -1);
  1177.                 modIcons[9].drawSprite(textDrawingArea.getTextWidth(s) + 24, 123 + yOffset);
  1178.                 textDrawingArea.method385(changeChatArea ? 0xFFFFFF : 0, ": ", 133 + yOffset, (38 + textDrawingArea.getTextWidth(s)));
  1179.                 newRegularFont.drawBasicString(inputString + ((loopCycle % 40 < 20) ? "|" : ""), 36 + textDrawingArea.getTextWidth(s + ": "), 133 + yOffset, changeChatArea ? 0x7FA9FF : 255, changeChatArea ? 0 : -1);
  1180.             } else if (myPrivilege == 28) { //Server Developer
  1181.                 modIcons[10].drawSprite(10 + xPos, 122 + yPos + yOffset);
  1182.                 xPos += 14;
  1183.                 newRegularFont.drawBasicString(fixedString + "", 23, 133 + yOffset, changeChatArea ? 0xFFFFFF : 0, changeChatArea ? 0 : -1);
  1184.                 modIcons[9].drawSprite(textDrawingArea.getTextWidth(s) + 24, 123 + yOffset);
  1185.                 textDrawingArea.method385(changeChatArea ? 0xFFFFFF : 0, ": ", 133 + yOffset, (38 + textDrawingArea.getTextWidth(s)));
  1186.                 newRegularFont.drawBasicString(inputString + ((loopCycle % 40 < 20) ? "|" : ""), 36 + textDrawingArea.getTextWidth(s + ": "), 133 + yOffset, changeChatArea ? 0x7FA9FF : 255, changeChatArea ? 0 : -1);
  1187.             } else if (myPrivilege == 29) { //Owner
  1188.                 modIcons[10].drawSprite(10 + xPos, 122 + yPos + yOffset);
  1189.                 xPos += 14;
  1190.                 newRegularFont.drawBasicString(fixedString + "", 23, 133 + yOffset, changeChatArea ? 0xFFFFFF : 0, changeChatArea ? 0 : -1);
  1191.                 modIcons[9].drawSprite(textDrawingArea.getTextWidth(s) + 24, 123 + yOffset);
  1192.                 textDrawingArea.method385(changeChatArea ? 0xFFFFFF : 0, ": ", 133 + yOffset, (38 + textDrawingArea.getTextWidth(s)));
  1193.                 newRegularFont.drawBasicString(inputString + ((loopCycle % 40 < 20) ? "|" : ""), 36 + textDrawingArea.getTextWidth(s + ": "), 133 + yOffset, changeChatArea ? 0x7FA9FF : 255, changeChatArea ? 0 : -1);
  1194.             }
  1195.             DrawingArea.method339(121 + yOffset, changeChatArea ? 0x575757 : 0x807660, 506, 7);
  1196.             DrawingArea.defaultDrawingAreaSize();
  1197.         }
  1198.         if (menuOpen) {
  1199.             drawMenu(0, frameMode == ScreenMode.FIXED ? 338 : 0);
  1200.         }
  1201.         if (frameMode == ScreenMode.FIXED) {
  1202.             aRSImageProducer_1166.drawGraphics(338, super.graphics, 0);
  1203.         }
  1204.         aRSImageProducer_1165.initDrawingArea();
  1205.         Texture.anIntArray1472 = anIntArray1182;
  1206.     }
  1207.  
  1208.     private String clanUsername;
  1209.     private String clanMessage;
  1210.     private String clanTitle;
  1211.     private final String[] clanTitles;
  1212.     private int channelRights;
  1213.  
  1214.     @Override
  1215.     public void init() {
  1216.         try {
  1217.             nodeID = 10;
  1218.             portOff = 0;
  1219.             setHighMem();
  1220.             isMembers = true;
  1221.             signlink.storeid = 32;
  1222.             signlink.startpriv(InetAddress.getLocalHost());
  1223.             initClientFrame(503, 765);
  1224.             instance = this;
  1225.         } catch (Exception exception) {
  1226.             return;
  1227.         }
  1228.     }
  1229.  
  1230.     @Override
  1231.     public void startRunnable(Runnable runnable, int i) {
  1232.         if (i > 10)
  1233.             i = 10;
  1234.         if (signlink.mainapp != null) {
  1235.             signlink.startthread(runnable, i);
  1236.         } else {
  1237.             super.startRunnable(runnable, i);
  1238.         }
  1239.     }
  1240.  
  1241.     public Socket openSocket(int port) throws IOException {
  1242.         return new Socket(InetAddress.getByName(server), port);
  1243.     }
  1244.  
  1245.     private void processMenuClick() {
  1246.         if (activeInterfaceType != 0)
  1247.             return;
  1248.         int j = super.clickMode3;
  1249.         if (spellSelected == 1 && super.saveClickX >= 516 && super.saveClickY >= 160 && super.saveClickX <= 765 && super.saveClickY <= 205)
  1250.             j = 0;
  1251.         if (menuOpen) {
  1252.             if (j != 1) {
  1253.                 int k = super.mouseX;
  1254.                 int j1 = super.mouseY;
  1255.                 if (menuScreenArea == 0) {
  1256.                     k -= 4;
  1257.                     j1 -= 4;
  1258.                 }
  1259.                 if (menuScreenArea == 1) {
  1260.                     k -= 519;
  1261.                     j1 -= 168;
  1262.                 }
  1263.                 if (menuScreenArea == 2) {
  1264.                     k -= 17;
  1265.                     j1 -= 338;
  1266.                 }
  1267.                 if (menuScreenArea == 3) {
  1268.                     k -= 519;
  1269.                     j1 -= 0;
  1270.                 }
  1271.                 if (k < menuOffsetX - 10 || k > menuOffsetX + menuWidth + 10 || j1 < menuOffsetY - 10 || j1 > menuOffsetY + menuHeight + 10) {
  1272.                     menuOpen = false;
  1273.                     if (menuScreenArea == 1) {
  1274.                     }
  1275.                     if (menuScreenArea == 2)
  1276.                         inputTaken = true;
  1277.                 }
  1278.             }
  1279.             if (j == 1) {
  1280.                 int l = menuOffsetX;
  1281.                 int k1 = menuOffsetY;
  1282.                 int i2 = menuWidth;
  1283.                 int k2 = super.saveClickX;
  1284.                 int l2 = super.saveClickY;
  1285.                 switch (menuScreenArea) {
  1286.                 case 0:
  1287.                     k2 -= 4;
  1288.                     l2 -= 4;
  1289.                     break;
  1290.                 case 1:
  1291.                     k2 -= 519;
  1292.                     l2 -= 168;
  1293.                     break;
  1294.                 case 2:
  1295.                     k2 -= 5;
  1296.                     l2 -= 338;
  1297.                     break;
  1298.                 case 3:
  1299.                     k2 -= 519;
  1300.                     l2 -= 0;
  1301.                     break;
  1302.                 }
  1303.                 int i3 = -1;
  1304.                 for (int j3 = 0; j3 < menuActionRow; j3++) {
  1305.                     int k3 = k1 + 31 + (menuActionRow - 1 - j3) * 15;
  1306.                     if (k2 > l && k2 < l + i2 && l2 > k3 - 13 && l2 < k3 + 3)
  1307.                         i3 = j3;
  1308.                 }
  1309.                 if (i3 != -1)
  1310.                     doAction(i3);
  1311.                 menuOpen = false;
  1312.                 if (menuScreenArea == 1) {
  1313.                 }
  1314.                 if (menuScreenArea == 2) {
  1315.                     inputTaken = true;
  1316.                 }
  1317.             }
  1318.         } else {
  1319.             if (j == 1 && menuActionRow > 0) {
  1320.                 int i1 = menuActionID[menuActionRow - 1];
  1321.                 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) {
  1322.                     int l1 = menuActionCmd2[menuActionRow - 1];
  1323.                     int j2 = menuActionCmd3[menuActionRow - 1];
  1324.                     RSInterface class9 = RSInterface.interfaceCache[j2];
  1325.                     if (class9.aBoolean259 || class9.aBoolean235) {
  1326.                         aBoolean1242 = false;
  1327.                         anInt989 = 0;
  1328.                         anInt1084 = j2;
  1329.                         anInt1085 = l1;
  1330.                         activeInterfaceType = 2;
  1331.                         anInt1087 = super.saveClickX;
  1332.                         anInt1088 = super.saveClickY;
  1333.                         if (RSInterface.interfaceCache[j2].parentID == openInterfaceID)
  1334.                             activeInterfaceType = 1;
  1335.                         if (RSInterface.interfaceCache[j2].parentID == backDialogID)
  1336.                             activeInterfaceType = 3;
  1337.                         return;
  1338.                     }
  1339.                 }
  1340.             }
  1341.             if (j == 1 && (anInt1253 == 1 || menuHasAddFriend(menuActionRow - 1)) && menuActionRow > 2)
  1342.                 j = 2;
  1343.             if (j == 1 && menuActionRow > 0)
  1344.                 doAction(menuActionRow - 1);
  1345.             if (j == 2 && menuActionRow > 0)
  1346.                 determineMenuSize();
  1347.             processMainScreenClick();
  1348.             processTabClick();
  1349.             processChatModeClick();
  1350.             minimapHovers();
  1351.         }
  1352.     }
  1353.  
  1354.     public static int totalRead = 0;
  1355.  
  1356.     public static String getFileNameWithoutExtension(String fileName) {
  1357.         File tmpFile = new File(fileName);
  1358.         tmpFile.getName();
  1359.         int whereDot = tmpFile.getName().lastIndexOf('.');
  1360.         if (0 < whereDot && whereDot <= tmpFile.getName().length() - 2) {
  1361.             return tmpFile.getName().substring(0, whereDot);
  1362.         }
  1363.         return "";
  1364.     }
  1365.  
  1366.     public String indexLocation(int cacheIndex, int index) {
  1367.         return signlink.findcachedir() + "index" + cacheIndex + "/" + (index != -1 ? index + ".gz" : "");
  1368.     }
  1369.  
  1370.     public void repackCacheIndex(int cacheIndex) {
  1371.         System.out.println("Started repacking index " + cacheIndex + ".");
  1372.         int indexLength = new File(indexLocation(cacheIndex, -1)).listFiles().length;
  1373.         File[] file = new File(indexLocation(cacheIndex, -1)).listFiles();
  1374.         try {
  1375.             for (int index = 0; index < indexLength; index++) {
  1376.                 int fileIndex = Integer.parseInt(getFileNameWithoutExtension(file[index].toString()));
  1377.                 byte[] data = fileToByteArray(cacheIndex, fileIndex);
  1378.                 if(data != null && data.length > 0) {
  1379.                     decompressors[cacheIndex].method234(data.length, data, fileIndex);
  1380.                     System.out.println("Repacked " + fileIndex + ".");
  1381.                 } else {
  1382.                     System.out.println("Unable to locate index " + fileIndex + ".");
  1383.                 }
  1384.             }
  1385.         } catch(Exception e) {
  1386.             System.out.println("Error packing cache index " + cacheIndex + ".");
  1387.         }
  1388.         System.out.println("Finished repacking " + cacheIndex + ".");
  1389.     }
  1390.  
  1391.     public byte[] fileToByteArray(int cacheIndex, int index) {
  1392.         try {
  1393.             if (indexLocation(cacheIndex, index).length() <= 0 || indexLocation(cacheIndex, index) == null) {
  1394.                 return null;
  1395.             }
  1396.             File file = new File(indexLocation(cacheIndex, index));
  1397.             byte[] fileData = new byte[(int)file.length()];
  1398.             FileInputStream fis = new FileInputStream(file);
  1399.             fis.read(fileData);
  1400.             fis.close();
  1401.             return fileData;
  1402.         } catch(Exception e) {
  1403.             return null;
  1404.         }
  1405.     }
  1406.    
  1407.    
  1408.    
  1409.     public void preloadModels() {
  1410.         File file = new File("./Raw/");
  1411.         File[] fileArray = file.listFiles();
  1412.         for (int y = 0; y < fileArray.length; y++) {
  1413.             String s = fileArray[y].getName();
  1414.             byte[] buffer = ReadFile("./Raw/" + s);
  1415.             Model.method460(buffer,
  1416.                     Integer.parseInt(getFileNameWithoutExtension(s)));
  1417.         }
  1418.     }
  1419.  
  1420.     public static final byte[] ReadFile(String s) {
  1421.         try {
  1422.             byte abyte0[];
  1423.             File file = new File(s);
  1424.             int i = (int) file.length();
  1425.             abyte0 = new byte[i];
  1426.             DataInputStream datainputstream = new DataInputStream(
  1427.                     new BufferedInputStream(new FileInputStream(s)));
  1428.             datainputstream.readFully(abyte0, 0, i);
  1429.             datainputstream.close();
  1430.             totalRead++;
  1431.             return abyte0;
  1432.         } catch (Exception e) {
  1433.             System.out.println((new StringBuilder()).append("Read Error: ")
  1434.                     .append(s).toString());
  1435.             return null;
  1436.         }
  1437.     }
  1438.  
  1439.     public void addModels() {
  1440.         for (int ModelIndex = 0; ModelIndex < 50000; ModelIndex++) {
  1441.             byte[] abyte0 = getModel(ModelIndex);
  1442.             if (abyte0 != null && abyte0.length > 0) {
  1443.                 decompressors[1].method234(abyte0.length, abyte0, ModelIndex);
  1444.             }
  1445.         }
  1446.     }
  1447.  
  1448.     public byte[] getModel(int Index) {
  1449.         try {
  1450.             File Model = new File(signlink.findcachedir() + "./pModels/"
  1451.                     + Index + ".gz");
  1452.             byte[] aByte = new byte[(int) Model.length()];
  1453.             FileInputStream fis = new FileInputStream(Model);
  1454.             fis.read(aByte);
  1455.             System.out.println("" + Index + " aByte = [" + aByte + "]!");
  1456.             fis.close();
  1457.             return aByte;
  1458.         } catch (Exception e) {
  1459.             return null;
  1460.         }
  1461.     }
  1462.  
  1463.     public void addMaps() {
  1464.         for (int MapIndex = 0; MapIndex < 3536; MapIndex++) {
  1465.             byte[] abyte0 = getMaps(MapIndex);
  1466.             if (abyte0 != null && abyte0.length > 0) {
  1467.                 decompressors[4].method234(abyte0.length, abyte0, MapIndex);
  1468.                 System.out.println("Maps Added");
  1469.             }
  1470.         }
  1471.     }
  1472.  
  1473.     public byte[] getMaps(int Index) {
  1474.         try {
  1475.             File Map = new File(signlink.findcachedir() + "./pMaps/" + Index
  1476.                     + ".gz");
  1477.             byte[] aByte = new byte[(int) Map.length()];
  1478.             FileInputStream fis = new FileInputStream(Map);
  1479.             fis.read(aByte);
  1480.             pushMessage("aByte = [" + aByte + "]!", 0, "");
  1481.             fis.close();
  1482.             return aByte;
  1483.         } catch (Exception e) {
  1484.             return null;
  1485.         }
  1486.     }
  1487.  
  1488.     public void saveMidi(boolean flag, byte abyte0[]) {
  1489.         signlink.midifade = flag ? 1 : 0;
  1490.         signlink.midisave(abyte0, abyte0.length);
  1491.     }
  1492.  
  1493.     public int positions[] = new int[2000];
  1494.     public int landScapes[] = new int[2000];
  1495.     public int objects[] = new int[2000];
  1496.  
  1497.     public final void method22() {
  1498.         try {
  1499.             anInt985 = -1;
  1500.             aClass19_1056.removeAll();
  1501.             aClass19_1013.removeAll();
  1502.             Texture.method366();
  1503.             unlinkMRUNodes();
  1504.             worldController.initToNull();
  1505.  
  1506.             System.gc();
  1507.             for (int i = 0; i < 4; i++)
  1508.                 aClass11Array1230[i].method210();
  1509.  
  1510.             for (int l = 0; l < 4; l++) {
  1511.                 for (int k1 = 0; k1 < 104; k1++) {
  1512.                     for (int j2 = 0; j2 < 104; j2++)
  1513.                         byteGroundArray[l][k1][j2] = 0;
  1514.  
  1515.                 }
  1516.  
  1517.             }
  1518.  
  1519.             ObjectManager objectManager = new ObjectManager(byteGroundArray,
  1520.                     intGroundArray);
  1521.  
  1522.             int k2 = aByteArrayArray1183.length;
  1523.  
  1524.             int k18 = 62;
  1525.             for (int A = 0; A < k2; A++)
  1526.                 for (int B = 0; B < 2000; B++)
  1527.                     if (anIntArray1234[A] == positions[B]) {
  1528.                         anIntArray1235[A] = landScapes[B];
  1529.                         anIntArray1236[A] = objects[B];
  1530.                     }
  1531.  
  1532.             stream.createFrame(0);
  1533.  
  1534.             if (!aBoolean1159) {
  1535.                 for (int i3 = 0; i3 < k2; i3++) {
  1536.                     int i4 = (anIntArray1234[i3] >> 8) * 64 - baseX;
  1537.                     int k5 = (anIntArray1234[i3] & 0xff) * 64 - baseY;
  1538.  
  1539.                     byte abyte0[] = aByteArrayArray1183[i3];
  1540.                     if (FileOperations
  1541.                             .FileExists("./.ss_474/Null.map/mapsFloor/"
  1542.                                     + anIntArray1235[i3] + ".dat"))
  1543.                         abyte0 = FileOperations
  1544.                                 .ReadFile("./.ss_474/Null.map/mapsFloor/"
  1545.                                         + anIntArray1235[i3] + ".dat");
  1546.  
  1547.                     if (abyte0 != null)
  1548.                         // objectManager.method180(abyte0, k5, i4, (anInt1069 -
  1549.                         // 6) * 8, (anInt1070 - 6) * 8, (byte)4,
  1550.                         // aClass11Array1230);
  1551.                         objectManager.method180(abyte0, k5, i4,
  1552.                                 (anInt1069 - 6) * 8, (anInt1070 - 6) * 8,
  1553.                                 aClass11Array1230);
  1554.                 }
  1555.  
  1556.                 for (int j4 = 0; j4 < k2; j4++) {
  1557.                     int l5 = (anIntArray1234[j4] >> 8) * k18 - baseX;
  1558.                     int k7 = (anIntArray1234[j4] & 0xff) * k18 - baseY;
  1559.                     byte abyte2[] = aByteArrayArray1183[j4];
  1560.                     if (abyte2 == null && anInt1070 < 800)
  1561.                         // ObjectManager.method174(k7, 64, 0, 64, l5);
  1562.                         objectManager.method174(k7, 64, 64, l5);
  1563.                 }
  1564.  
  1565.                 anInt1097++;
  1566.                 if (anInt1097 > 160) {
  1567.                     anInt1097 = 0;
  1568.                     stream.createFrame(238);
  1569.                     stream.writeWordBigEndian(96);
  1570.  
  1571.                 }
  1572.                 stream.createFrame(0);
  1573.  
  1574.                 for (int i6 = 0; i6 < k2; i6++) {
  1575.                     byte abyte1[] = aByteArrayArray1247[i6];
  1576.                     if (FileOperations
  1577.                             .FileExists("./.ss_474/Null.map/spawnObject/"
  1578.                                     + anIntArray1236[i6] + ".dat"))
  1579.                         abyte1 = FileOperations
  1580.                                 .ReadFile("./.ss_474/Null.map/spawnObject/"
  1581.                                         + anIntArray1236[i6] + ".dat");
  1582.                     if (abyte1 != null) {
  1583.                         int l8 = (anIntArray1234[i6] >> 8) * 64 - baseX;
  1584.                         int k9 = (anIntArray1234[i6] & 0xff) * 64 - baseY;
  1585.                         // ObjectManager.method190(l8, aClass11Array1230, k9, 7,
  1586.                         // aClass25_946, abyte1);
  1587.                         objectManager.method190(l8, aClass11Array1230, k9,
  1588.                                 worldController, abyte1);
  1589.                     }
  1590.                 }
  1591.  
  1592.             }
  1593.             if (aBoolean1159) {
  1594.                 for (int j3 = 0; j3 < 4; j3++) {
  1595.                     for (int k4 = 0; k4 < 13; k4++) {
  1596.                         for (int j6 = 0; j6 < 13; j6++) {
  1597.                             int l7 = anIntArrayArrayArray1129[j3][k4][j6];
  1598.                             if (l7 != -1) {
  1599.                                 int i9 = l7 >> 24 & 3;
  1600.                                 int l9 = l7 >> 1 & 3;
  1601.                                 int j10 = l7 >> 14 & 0x3ff;
  1602.                                 int l10 = l7 >> 3 & 0x7ff;
  1603.                                 int j11 = (j10 / 8 << 8) + l10 / 8;
  1604.                                 for (int l11 = 0; l11 < anIntArray1234.length; l11++) {
  1605.                                     if (anIntArray1234[l11] != j11
  1606.                                             || aByteArrayArray1183[l11] == null)
  1607.                                         continue;
  1608.                                     // ObjectManager.method179(i9, l9,
  1609.                                     // aClass11Array1230, 9, k4 * 8, (j10 & 7) *
  1610.                                     // 8, aByteArrayArray1183[l11], (l10 & 7) *
  1611.                                     // 8, j3, j6 * 8);
  1612.                                     objectManager.method179(i9, l9,
  1613.                                             aClass11Array1230, k4 * 8,
  1614.                                             (j10 & 7) * 8,
  1615.                                             aByteArrayArray1183[l11],
  1616.                                             (l10 & 7) * 8, j3, j6 * 8);
  1617.                                     break;
  1618.                                 }
  1619.  
  1620.                             }
  1621.                         }
  1622.  
  1623.                     }
  1624.  
  1625.                 }
  1626.  
  1627.                 for (int l4 = 0; l4 < 13; l4++) {
  1628.                     for (int k6 = 0; k6 < 13; k6++) {
  1629.                         int i8 = anIntArrayArrayArray1129[0][l4][k6];
  1630.                         if (i8 == -1)
  1631.                             // ObjectManager.method174(k6 * 8, 8, 0, 8, l4 * 8);
  1632.                             objectManager.method174(k6 * 8, 8, 8, l4 * 8);
  1633.                     }
  1634.  
  1635.                 }
  1636.  
  1637.                 stream.createFrame(0);
  1638.  
  1639.                 for (int l6 = 0; l6 < 4; l6++) {
  1640.                     for (int j8 = 0; j8 < 13; j8++) {
  1641.                         for (int j9 = 0; j9 < 13; j9++) {
  1642.                             int i10 = anIntArrayArrayArray1129[l6][j8][j9];
  1643.                             if (i10 != -1) {
  1644.                                 int k10 = i10 >> 24 & 3;
  1645.                                 int i11 = i10 >> 1 & 3;
  1646.                                 int k11 = i10 >> 14 & 0x3ff;
  1647.                                 int i12 = i10 >> 3 & 0x7ff;
  1648.                                 int j12 = (k11 / 8 << 8) + i12 / 8;
  1649.                                 for (int k12 = 0; k12 < anIntArray1234.length; k12++) {
  1650.                                     if (anIntArray1234[k12] != j12
  1651.                                             || aByteArrayArray1247[k12] == null)
  1652.                                         continue;
  1653.                                     if (FileOperations
  1654.                                             .FileExists("./Cache/FloorMaps/"
  1655.                                                     + anIntArray1235[k12]
  1656.                                                     + ".dat"))
  1657.                                         FileOperations.ReadFile(signlink
  1658.                                                 .findcachedir()
  1659.                                                 + "FloorMaps/"
  1660.                                                 + anIntArray1235[k12] + ".dat");
  1661.                                     // ObjectManager.method183(aClass11Array1230,
  1662.                                     // aClass25_946, k10, j8 * 8, (i12 & 7) * 8,
  1663.                                     // true, l6, abyte0, (k11 & 7) * 8, i11, j9
  1664.                                     // * 8);
  1665.                                     objectManager.method183(aClass11Array1230,
  1666.                                             worldController, k10, j8 * 8,
  1667.                                             (i12 & 7) * 8, l6,
  1668.                                             aByteArrayArray1247[k12],
  1669.                                             (k11 & 7) * 8, i11, j9 * 8);
  1670.                                     break;
  1671.                                 }
  1672.  
  1673.                             }
  1674.                         }
  1675.  
  1676.                     }
  1677.  
  1678.                 }
  1679.  
  1680.             }
  1681.             stream.createFrame(0);
  1682.             objectManager.method171(aClass11Array1230, worldController);
  1683.             aRSImageProducer_1165.initDrawingArea();
  1684.             stream.createFrame(0);
  1685.  
  1686.             int k3 = ObjectManager.anInt145;
  1687.             if (k3 > plane)
  1688.                 k3 = plane;
  1689.  
  1690.             if (k3 < plane - 1)
  1691.                 k3 = plane - 1;
  1692.             if (lowMem)
  1693.  
  1694.                 worldController.method275(ObjectManager.anInt145);
  1695.             else
  1696.                 worldController.method275(0);
  1697.             for (int i5 = 0; i5 < 104; i5++) {
  1698.                 for (int i7 = 0; i7 < 104; i7++)
  1699.                     spawnGroundItem(i5, i7);
  1700.  
  1701.             }
  1702.  
  1703.             anInt1051++;
  1704.             if (anInt1051 > 98) {
  1705.                 anInt1051 = 0;
  1706.                 stream.createFrame(150);
  1707.  
  1708.             }
  1709.             method63();
  1710.         } catch (Exception e) {
  1711.             e.printStackTrace();
  1712.         }
  1713.         ObjectDef.mruNodes1.unlinkAll();
  1714.  
  1715.         if (super.gameFrame != null) {
  1716.             stream.createFrame(210);
  1717.  
  1718.             stream.writeDWord(0x3f008edd);
  1719.         }
  1720.         System.gc();
  1721.         Texture.method367();
  1722.         onDemandFetcher.method566();
  1723.  
  1724.         int k = (anInt1069 - 6) / 8 - 1;
  1725.         int j1 = (anInt1069 + 6) / 8 + 1;
  1726.         int i2 = (anInt1070 - 6) / 8 - 1;
  1727.         int l2 = (anInt1070 + 6) / 8 + 1;
  1728.         if (aBoolean1141) {
  1729.             k = 49;
  1730.             j1 = 50;
  1731.             i2 = 49;
  1732.             l2 = 50;
  1733.         }
  1734.         for (int l3 = k; l3 <= j1; l3++) {
  1735.             for (int j5 = i2; j5 <= l2; j5++)
  1736.                 if (l3 == k || l3 == j1 || j5 == i2 || j5 == l2) {
  1737.                     int j7 = onDemandFetcher.method562(0, j5, l3);
  1738.                     if (j7 != -1)
  1739.                         onDemandFetcher.method560(j7, 3);
  1740.                     int k8 = onDemandFetcher.method562(1, j5, l3);
  1741.                     if (k8 != -1)
  1742.                         onDemandFetcher.method560(k8, 3);
  1743.                 }
  1744.  
  1745.         }
  1746.  
  1747.     }
  1748.  
  1749.     public void unlinkMRUNodes() {
  1750.         ObjectDef.mruNodes1.unlinkAll();
  1751.         ObjectDef.mruNodes2.unlinkAll();
  1752.         EntityDef.mruNodes.unlinkAll();
  1753.         ItemDef.mruNodes2.unlinkAll();
  1754.         ItemDef.mruNodes1.unlinkAll();
  1755.         Player.mruNodes.unlinkAll();
  1756.         SpotAnim.aMRUNodes_415.unlinkAll();
  1757.     }
  1758.  
  1759.     public void method24(int i) {
  1760.         int ai[] = miniMapImage.myPixels;
  1761.         int j = ai.length;
  1762.         for (int k = 0; k < j; k++)
  1763.             ai[k] = 0;
  1764.  
  1765.         for (int l = 1; l < 103; l++) {
  1766.             int i1 = 24628 + (103 - l) * 512 * 4;
  1767.             for (int k1 = 1; k1 < 103; k1++) {
  1768.                 if ((byteGroundArray[i][k1][l] & 0x18) == 0)
  1769.                     worldController.method309(ai, i1, i, k1, l);
  1770.                 if (i < 3 && (byteGroundArray[i + 1][k1][l] & 8) != 0)
  1771.                     worldController.method309(ai, i1, i + 1, k1, l);
  1772.                 i1 += 4;
  1773.             }
  1774.  
  1775.         }
  1776.  
  1777.         int j1 = ((238 + (int) (Math.random() * 20D)) - 10 << 16)
  1778.                 + ((238 + (int) (Math.random() * 20D)) - 10 << 8)
  1779.                 + ((238 + (int) (Math.random() * 20D)) - 10);
  1780.         int l1 = (238 + (int) (Math.random() * 20D)) - 10 << 16;
  1781.         miniMapImage.method343();
  1782.         for (int i2 = 1; i2 < 103; i2++) {
  1783.             for (int j2 = 1; j2 < 103; j2++) {
  1784.                 if ((byteGroundArray[i][j2][i2] & 0x18) == 0)
  1785.                     method50(i2, j1, j2, l1, i);
  1786.                 if (i < 3 && (byteGroundArray[i + 1][j2][i2] & 8) != 0)
  1787.                     method50(i2, j1, j2, l1, i + 1);
  1788.             }
  1789.  
  1790.         }
  1791.  
  1792.         aRSImageProducer_1165.initDrawingArea();
  1793.         anInt1071 = 0;
  1794.         for (int k2 = 0; k2 < 104; k2++) {
  1795.             for (int l2 = 0; l2 < 104; l2++) {
  1796.                 int i3 = worldController.method303(plane, k2, l2);
  1797.                 if (i3 != 0) {
  1798.                     i3 = i3 >> 14 & 0x7fff;
  1799.                     int j3 = ObjectDef.forID(i3).anInt746;
  1800.                     if (j3 >= 0) {
  1801.                         int k3 = k2;
  1802.                         int l3 = l2;
  1803.                         if (j3 != 22 && j3 != 29 && j3 != 34 && j3 != 36
  1804.                                 && j3 != 46 && j3 != 47 && j3 != 48) {
  1805.                             byte byte0 = 104;
  1806.                             byte byte1 = 104;
  1807.                             int ai1[][] = aClass11Array1230[plane].anIntArrayArray294;
  1808.                             for (int i4 = 0; i4 < 10; i4++) {
  1809.                                 int j4 = (int) (Math.random() * 4D);
  1810.                                 if (j4 == 0 && k3 > 0 && k3 > k2 - 3
  1811.                                         && (ai1[k3 - 1][l3] & 0x1280108) == 0)
  1812.                                     k3--;
  1813.                                 if (j4 == 1 && k3 < byte0 - 1 && k3 < k2 + 3
  1814.                                         && (ai1[k3 + 1][l3] & 0x1280180) == 0)
  1815.                                     k3++;
  1816.                                 if (j4 == 2 && l3 > 0 && l3 > l2 - 3
  1817.                                         && (ai1[k3][l3 - 1] & 0x1280102) == 0)
  1818.                                     l3--;
  1819.                                 if (j4 == 3 && l3 < byte1 - 1 && l3 < l2 + 3
  1820.                                         && (ai1[k3][l3 + 1] & 0x1280120) == 0)
  1821.                                     l3++;
  1822.                             }
  1823.  
  1824.                         }
  1825.                         aClass30_Sub2_Sub1_Sub1Array1140[anInt1071] = mapFunctions[j3];
  1826.                         anIntArray1072[anInt1071] = k3;
  1827.                         anIntArray1073[anInt1071] = l3;
  1828.                         anInt1071++;
  1829.                     }
  1830.                 }
  1831.             }
  1832.  
  1833.         }
  1834.  
  1835.     }
  1836.  
  1837.     public void spawnGroundItem(int i, int j) {
  1838.         NodeList class19 = groundArray[plane][i][j];
  1839.         if (class19 == null) {
  1840.             worldController.method295(plane, i, j);
  1841.             return;
  1842.         }
  1843.         int k = 0xfa0a1f01;
  1844.         Object obj = null;
  1845.         for (Item item = (Item) class19.reverseGetFirst(); item != null; item = (Item) class19
  1846.                 .reverseGetNext()) {
  1847.             ItemDef itemDef = ItemDef.forID(item.ID);
  1848.             int l = itemDef.value;
  1849.             if (itemDef.stackable)
  1850.                 l *= item.anInt1559 + 1;
  1851.             // notifyItemSpawn(item, i + baseX, j + baseY);
  1852.  
  1853.             if (l > k) {
  1854.                 k = l;
  1855.                 obj = item;
  1856.             }
  1857.         }
  1858.  
  1859.         class19.insertTail(((Node) (obj)));
  1860.         Object obj1 = null;
  1861.         Object obj2 = null;
  1862.         for (Item class30_sub2_sub4_sub2_1 = (Item) class19.reverseGetFirst(); class30_sub2_sub4_sub2_1 != null; class30_sub2_sub4_sub2_1 = (Item) class19
  1863.                 .reverseGetNext()) {
  1864.             if (class30_sub2_sub4_sub2_1.ID != ((Item) (obj)).ID
  1865.                     && obj1 == null)
  1866.                 obj1 = class30_sub2_sub4_sub2_1;
  1867.             if (class30_sub2_sub4_sub2_1.ID != ((Item) (obj)).ID
  1868.                     && class30_sub2_sub4_sub2_1.ID != ((Item) (obj1)).ID
  1869.                     && obj2 == null)
  1870.                 obj2 = class30_sub2_sub4_sub2_1;
  1871.         }
  1872.  
  1873.         int i1 = i + (j << 7) + 0x60000000;
  1874.         worldController.method281(i, i1, ((Animable) (obj1)),
  1875.                 method42(plane, j * 128 + 64, i * 128 + 64),
  1876.                 ((Animable) (obj2)), ((Animable) (obj)), plane, j);
  1877.     }
  1878.  
  1879.     public void method26(boolean flag) {
  1880.         for (int j = 0; j < npcCount; j++) {
  1881.             NPC npc = npcArray[npcIndices[j]];
  1882.             int k = 0x20000000 + (npcIndices[j] << 14);
  1883.             if (npc == null || !npc.isVisible() || npc.desc.aBoolean93 != flag)
  1884.                 continue;
  1885.             int l = npc.x >> 7;
  1886.             int i1 = npc.y >> 7;
  1887.             if (l < 0 || l >= 104 || i1 < 0 || i1 >= 104)
  1888.                 continue;
  1889.             if (npc.anInt1540 == 1 && (npc.x & 0x7f) == 64
  1890.                     && (npc.y & 0x7f) == 64) {
  1891.                 if (anIntArrayArray929[l][i1] == anInt1265)
  1892.                     continue;
  1893.                 anIntArrayArray929[l][i1] = anInt1265;
  1894.             }
  1895.             if (!npc.desc.aBoolean84)
  1896.                 k += 0x80000000;
  1897.             worldController
  1898.                     .method285(plane, npc.anInt1552,
  1899.                             method42(plane, npc.y, npc.x), k, npc.y,
  1900.                             (npc.anInt1540 - 1) * 64 + 60, npc.x, npc,
  1901.                             npc.aBoolean1541);
  1902.         }
  1903.     }
  1904.  
  1905.     private boolean replayWave() {
  1906.         return signlink.wavereplay();
  1907.     }
  1908.  
  1909.     public void loadError() {
  1910.         String s = "ondemand";// was a constant parameter
  1911.         System.out.println(s);
  1912.         try {
  1913.             getAppletContext().showDocument(
  1914.                     new URL(getCodeBase(), "loaderror_" + s + ".html"));
  1915.         } catch (Exception exception) {
  1916.             exception.printStackTrace();
  1917.         }
  1918.         do
  1919.             try {
  1920.                 Thread.sleep(1000L);
  1921.             } catch (Exception _ex) {
  1922.             }
  1923.         while (true);
  1924.     }
  1925.  
  1926.     private void buildInterfaceMenu(int i, RSInterface class9, int k, int l,
  1927.             int i1, int j1) {
  1928.         if (class9 == null) {
  1929.             return;
  1930.         }
  1931.         if (class9.type != 0 || class9.children == null
  1932.                 || class9.isMouseoverTriggered)
  1933.             return;
  1934.         if (k < i || i1 < l || k > i + class9.width || i1 > l + class9.height)
  1935.             return;
  1936.         int k1 = class9.children.length;
  1937.         for (int l1 = 0; l1 < k1; l1++) {
  1938.             int i2 = class9.childX[l1] + i;
  1939.             int j2 = (class9.childY[l1] + l) - j1;
  1940.             RSInterface class9_1 = RSInterface.interfaceCache[class9.children[l1]];
  1941.             if (class9_1 == null) {
  1942.                 break;
  1943.             }
  1944.             i2 += class9_1.anInt263;
  1945.             j2 += class9_1.anInt265;
  1946.             if ((class9_1.mOverInterToTrigger >= 0 || class9_1.anInt216 != 0)
  1947.                     && k >= i2 && i1 >= j2 && k < i2 + class9_1.width
  1948.                     && i1 < j2 + class9_1.height)
  1949.                 if (class9_1.mOverInterToTrigger >= 0)
  1950.                     anInt886 = class9_1.mOverInterToTrigger;
  1951.                 else
  1952.                     anInt886 = class9_1.id;
  1953.             if (class9_1.type == 8 && k >= i2 && i1 >= j2
  1954.                     && k < i2 + class9_1.width && i1 < j2 + class9_1.height) {
  1955.                 anInt1315 = class9_1.id;
  1956.             }
  1957.             if (class9_1.type == 9 && k >= i2 && i1 >= j2
  1958.                     && k < i2 + class9_1.width && i1 < j2 + class9_1.height) {
  1959.                 anInt1315 = class9_1.id;
  1960.             }
  1961.             if (class9_1.type == 5 && k >= i2 && i1 >= j2
  1962.                     && k < i2 + class9_1.width && i1 < j2 + class9_1.height) {
  1963.                 hoverId = class9_1.id;
  1964.             }
  1965.             if (class9_1.type == 0) {
  1966.                 SortTabs();
  1967.                 buildInterfaceMenu(i2, class9_1, k, j2, i1,
  1968.                         class9_1.scrollPosition);
  1969.                 if (class9_1.scrollMax > class9_1.height)
  1970.                     method65(i2 + class9_1.width, class9_1.height, k, i1,
  1971.                             class9_1, j2, true, class9_1.scrollMax);
  1972.             } else {
  1973.                 if (class9_1.atActionType == 1 && k >= i2 && i1 >= j2
  1974.                         && k < i2 + class9_1.width && i1 < j2 + class9_1.height) {
  1975.                     boolean flag = false;
  1976.                     if (class9_1.contentType != 0)
  1977.                         flag = buildFriendsListMenu(class9_1);
  1978.                     if (!flag) {
  1979.                         // System.out.println("1"+class9_1.tooltip + ", " +
  1980.                         // class9_1.interfaceID);
  1981.                         menuActionName[menuActionRow] = class9_1.tooltip;
  1982.                         menuActionID[menuActionRow] = 315;
  1983.                         menuActionCmd3[menuActionRow] = class9_1.id;
  1984.                         menuActionRow++;
  1985.                     }
  1986.                 }
  1987.                 if (class9_1.atActionType == 2 && spellSelected == 0 && k >= i2
  1988.                         && i1 >= j2 && k < i2 + class9_1.width
  1989.                         && i1 < j2 + class9_1.height) {
  1990.                     String s = class9_1.selectedActionName;
  1991.                     if (s.indexOf(" ") != -1)
  1992.                         s = s.substring(0, s.indexOf(" "));
  1993.                     menuActionName[menuActionRow] = s + " @gre@"
  1994.                             + class9_1.spellName;
  1995.                     menuActionID[menuActionRow] = 626;
  1996.                     menuActionCmd3[menuActionRow] = class9_1.id;
  1997.                     menuActionRow++;
  1998.                 }
  1999.                 if (class9_1.atActionType == 3 && k >= i2 && i1 >= j2
  2000.                         && k < i2 + class9_1.width && i1 < j2 + class9_1.height) {
  2001.                     menuActionName[menuActionRow] = "Close";
  2002.                     menuActionID[menuActionRow] = 200;
  2003.                     menuActionCmd3[menuActionRow] = class9_1.id;
  2004.                     menuActionRow++;
  2005.                 }
  2006.                 if (class9_1.atActionType == 4 && k >= i2 && i1 >= j2
  2007.                         && k < i2 + class9_1.width && i1 < j2 + class9_1.height) {
  2008.                     // System.out.println("2"+class9_1.tooltip + ", " +
  2009.                     // class9_1.interfaceID);
  2010.                     menuActionName[menuActionRow] = class9_1.tooltip;
  2011.                     menuActionID[menuActionRow] = 169;
  2012.                     menuActionCmd3[menuActionRow] = class9_1.id;
  2013.                     menuActionRow++;
  2014.                     if (class9_1.hoverText != null) {
  2015.                         // drawHoverBox(k, l, class9_1.hoverText);
  2016.                         // System.out.println("DRAWING INTERFACE: " +
  2017.                         // class9_1.hoverText);
  2018.                     }
  2019.                 }
  2020.                 if (class9_1.atActionType == 5 && k >= i2 && i1 >= j2
  2021.                         && k < i2 + class9_1.width && i1 < j2 + class9_1.height) {
  2022.                     // System.out.println("3"+class9_1.tooltip + ", " +
  2023.                     // class9_1.interfaceID);
  2024.                     menuActionName[menuActionRow] = class9_1.tooltip;
  2025.                     menuActionID[menuActionRow] = 646;
  2026.                     menuActionCmd3[menuActionRow] = class9_1.id;
  2027.                     menuActionRow++;
  2028.                 }
  2029.                 if (class9_1.atActionType == 6 && !aBoolean1149 && k >= i2
  2030.                         && i1 >= j2 && k < i2 + class9_1.width
  2031.                         && i1 < j2 + class9_1.height) {
  2032.                     menuActionName[menuActionRow] = class9_1.tooltip;
  2033.                     menuActionID[menuActionRow] = 679;
  2034.                     menuActionCmd3[menuActionRow] = class9_1.id;
  2035.                     menuActionRow++;
  2036.                 }
  2037.                 if (k >= i2 && i1 >= j2
  2038.                         && k < i2 + (class9_1.type == 4 ? 100 : class9_1.width)
  2039.                         && i1 < j2 + class9_1.height) {
  2040.                     if (class9_1.actions != null) {
  2041.                         if ((class9_1.type == 4 && class9_1.message.length() > 0)
  2042.                                 || class9_1.type == 5) {
  2043.                             for (int action = class9_1.actions.length - 1; action >= 0; action--) {
  2044.                                 if (class9_1.actions[action] != null) {
  2045.                                     menuActionName[menuActionRow] = class9_1.actions[action]
  2046.                                             + (class9_1.type == 4 ? " "
  2047.                                                     + class9_1.message : "");
  2048.                                     menuActionID[menuActionRow] = 647;
  2049.                                     menuActionCmd2[menuActionRow] = action;
  2050.                                     menuActionCmd3[menuActionRow] = class9_1.id;
  2051.                                     menuActionRow++;
  2052.                                 }
  2053.                             }
  2054.                         }
  2055.                     }
  2056.                 }
  2057.                 if (class9_1.type == 2) {
  2058.                     int k2 = 0;
  2059.                     for (int l2 = 0; l2 < class9_1.height; l2++) {
  2060.                         for (int i3 = 0; i3 < class9_1.width; i3++) {
  2061.                             int j3 = i2 + i3 * (32 + class9_1.invSpritePadX);
  2062.                             int k3 = j2 + l2 * (32 + class9_1.invSpritePadY);
  2063.                             if (k2 < 20) {
  2064.                                 j3 += class9_1.spritesX[k2];
  2065.                                 k3 += class9_1.spritesY[k2];
  2066.                             }
  2067.                             if (k >= j3 && i1 >= k3 && k < j3 + 32
  2068.                                     && i1 < k3 + 32) {
  2069.                                 mouseInvInterfaceIndex = k2;
  2070.                                 lastActiveInvInterface = class9_1.id;
  2071.                                 if (class9_1.inv[k2] > 0) {
  2072.                                     ItemDef itemDef = ItemDef
  2073.                                             .forID(class9_1.inv[k2] - 1);
  2074.                                     if (itemSelected == 1
  2075.                                             && class9_1.isInventoryInterface) {
  2076.                                         if (class9_1.id != anInt1284
  2077.                                                 || k2 != anInt1283) {
  2078.                                             menuActionName[menuActionRow] = "Use "
  2079.                                                     + selectedItemName
  2080.                                                     + " with @lre@"
  2081.                                                     + itemDef.name;
  2082.                                             menuActionID[menuActionRow] = 870;
  2083.                                             menuActionCmd1[menuActionRow] = itemDef.id;
  2084.                                             menuActionCmd2[menuActionRow] = k2;
  2085.                                             menuActionCmd3[menuActionRow] = class9_1.id;
  2086.                                             menuActionRow++;
  2087.                                         }
  2088.                                     } else if (spellSelected == 1
  2089.                                             && class9_1.isInventoryInterface) {
  2090.                                         if ((spellUsableOn & 0x10) == 16) {
  2091.                                             menuActionName[menuActionRow] = spellTooltip
  2092.                                                     + " @lre@" + itemDef.name;
  2093.                                             menuActionID[menuActionRow] = 543;
  2094.                                             menuActionCmd1[menuActionRow] = itemDef.id;
  2095.                                             menuActionCmd2[menuActionRow] = k2;
  2096.                                             menuActionCmd3[menuActionRow] = class9_1.id;
  2097.                                             menuActionRow++;
  2098.                                         }
  2099.                                     } else {
  2100.                                         if (class9_1.isInventoryInterface) {
  2101.                                             for (int l3 = 4; l3 >= 3; l3--)
  2102.                                                 if (itemDef.itemActions != null
  2103.                                                         && itemDef.itemActions[l3] != null) {
  2104.                                                     menuActionName[menuActionRow] = itemDef.itemActions[l3]
  2105.                                                             + " @lre@"
  2106.                                                             + itemDef.name;
  2107.                                                     if (l3 == 3)
  2108.                                                         menuActionID[menuActionRow] = 493;
  2109.                                                     if (l3 == 4)
  2110.                                                         menuActionID[menuActionRow] = 847;
  2111.                                                     menuActionCmd1[menuActionRow] = itemDef.id;
  2112.                                                     menuActionCmd2[menuActionRow] = k2;
  2113.                                                     menuActionCmd3[menuActionRow] = class9_1.id;
  2114.                                                     menuActionRow++;
  2115.                                                 } else if (l3 == 4) {
  2116.                                                     menuActionName[menuActionRow] = "Drop @lre@"
  2117.                                                             + itemDef.name;
  2118.                                                     menuActionID[menuActionRow] = 847;
  2119.                                                     menuActionCmd1[menuActionRow] = itemDef.id;
  2120.                                                     menuActionCmd2[menuActionRow] = k2;
  2121.                                                     menuActionCmd3[menuActionRow] = class9_1.id;
  2122.                                                     menuActionRow++;
  2123.                                                 }
  2124.  
  2125.                                         }
  2126.                                         if (class9_1.usableItemInterface) {
  2127.                                             menuActionName[menuActionRow] = "Use @lre@"
  2128.                                                     + itemDef.name;
  2129.                                             menuActionID[menuActionRow] = 447;
  2130.                                             menuActionCmd1[menuActionRow] = itemDef.id;
  2131.                                             // k2 = inventory spot
  2132.                                             // System.out.println(k2);
  2133.                                             menuActionCmd2[menuActionRow] = k2;
  2134.                                             menuActionCmd3[menuActionRow] = class9_1.id;
  2135.                                             menuActionRow++;
  2136.                                         }
  2137.                                         if (class9_1.isInventoryInterface
  2138.                                                 && itemDef.itemActions != null) {
  2139.                                             for (int i4 = 2; i4 >= 0; i4--)
  2140.                                                 if (itemDef.itemActions[i4] != null) {
  2141.                                                     menuActionName[menuActionRow] = itemDef.itemActions[i4]
  2142.                                                             + " @lre@"
  2143.                                                             + itemDef.name;
  2144.                                                     if (i4 == 0)
  2145.                                                         menuActionID[menuActionRow] = 74;
  2146.                                                     if (i4 == 1)
  2147.                                                         menuActionID[menuActionRow] = 454;
  2148.                                                     if (i4 == 2)
  2149.                                                         menuActionID[menuActionRow] = 539;
  2150.                                                     menuActionCmd1[menuActionRow] = itemDef.id;
  2151.                                                     menuActionCmd2[menuActionRow] = k2;
  2152.                                                     menuActionCmd3[menuActionRow] = class9_1.id;
  2153.                                                     menuActionRow++;
  2154.                                                 }
  2155.  
  2156.                                         }
  2157.                                         if (class9_1.actions != null) {
  2158.                                             for (int j4 = 4; j4 >= 0; j4--)
  2159.                                                 if (class9_1.actions[j4] != null) {
  2160.                                                     menuActionName[menuActionRow] = class9_1.actions[j4]
  2161.                                                             + " @lre@"
  2162.                                                             + itemDef.name;
  2163.                                                     if (j4 == 0)
  2164.                                                         menuActionID[menuActionRow] = 632;
  2165.                                                     if (j4 == 1)
  2166.                                                         menuActionID[menuActionRow] = 78;
  2167.                                                     if (j4 == 2)
  2168.                                                         menuActionID[menuActionRow] = 867;
  2169.                                                     if (j4 == 3)
  2170.                                                         menuActionID[menuActionRow] = 431;
  2171.                                                     if (j4 == 4)
  2172.                                                         menuActionID[menuActionRow] = 53;
  2173.                                                     menuActionCmd1[menuActionRow] = itemDef.id;
  2174.                                                     menuActionCmd2[menuActionRow] = k2;
  2175.                                                     menuActionCmd3[menuActionRow] = class9_1.id;
  2176.                                                     menuActionRow++;
  2177.                                                 }
  2178.  
  2179.                                         }
  2180.                                         menuActionName[menuActionRow] = "Examine @lre@"
  2181.                                                 + itemDef.name;
  2182.                                         menuActionID[menuActionRow] = 1125;
  2183.                                         menuActionCmd1[menuActionRow] = itemDef.id;
  2184.                                         menuActionCmd2[menuActionRow] = k2;
  2185.                                         menuActionCmd3[menuActionRow] = class9_1.id;
  2186.                                         menuActionRow++;
  2187.                                     }
  2188.                                 }
  2189.                             }
  2190.                             k2++;
  2191.                         }
  2192.  
  2193.                     }
  2194.  
  2195.                 }
  2196.             }
  2197.         }
  2198.     }
  2199.  
  2200.     public void drawTransparentScrollBar(int x, int y, int height, int maxScroll, int pos) {
  2201.         cacheSprite[29].drawARGBSprite(x, y, 120);
  2202.         cacheSprite[30].drawARGBSprite(x, y + height - 16, 120);
  2203.         DrawingArea.drawVerticalLine(x, y + 16, height - 32, 0xffffff, 64);
  2204.         DrawingArea.drawVerticalLine(x + 15, y + 16, height - 32, 0xffffff, 64);
  2205.         int barHeight = (height - 32) * height / maxScroll;
  2206.         if(barHeight < 10) {
  2207.             barHeight = 10;
  2208.         }
  2209.         int barPos = 0;
  2210.         if(maxScroll != height) {
  2211.             barPos = (height - 32 - barHeight) * pos / (maxScroll - height);
  2212.         }
  2213.         DrawingArea.drawRectangle(x, y + 16 + barPos, 16, 5 + y + 16 + barPos + barHeight - 5 - (y + 16 + barPos), 0xffffff, 32);
  2214.     }
  2215.  
  2216.     public void drawScrollbar(int height, int pos, int y, int x, int maxScroll, boolean transparent) {
  2217.         if (transparent) {
  2218.             drawTransparentScrollBar(x, y, height, maxScroll, pos);
  2219.         } else {
  2220.             scrollBar1.drawSprite(x, y);
  2221.             scrollBar2.drawSprite(x, (y + height) - 16);
  2222.             DrawingArea.drawPixels(height - 32, y + 16, x, 0x000001, 16);
  2223.             DrawingArea.drawPixels(height - 32, y + 16, x, 0x3d3426, 15);
  2224.             DrawingArea.drawPixels(height - 32, y + 16, x, 0x342d21, 13);
  2225.             DrawingArea.drawPixels(height - 32, y + 16, x, 0x2e281d, 11);
  2226.             DrawingArea.drawPixels(height - 32, y + 16, x, 0x29241b, 10);
  2227.             DrawingArea.drawPixels(height - 32, y + 16, x, 0x252019, 9);
  2228.             DrawingArea.drawPixels(height - 32, y + 16, x, 0x000001, 1);
  2229.             int k1 = ((height - 32) * height) / maxScroll;
  2230.             if (k1 < 8) {
  2231.                 k1 = 8;
  2232.             }
  2233.             int l1 = ((height - 32 - k1) * pos) / (maxScroll - height);
  2234.             DrawingArea.drawPixels(k1, y + 16 + l1, x, barFillColor, 16);
  2235.             DrawingArea.method341(y + 16 + l1, 0x000001, k1, x);
  2236.             DrawingArea.method341(y + 16 + l1, 0x817051, k1, x + 1);
  2237.             DrawingArea.method341(y + 16 + l1, 0x73654a, k1, x + 2);
  2238.             DrawingArea.method341(y + 16 + l1, 0x6a5c43, k1, x + 3);
  2239.             DrawingArea.method341(y + 16 + l1, 0x6a5c43, k1, x + 4);
  2240.             DrawingArea.method341(y + 16 + l1, 0x655841, k1, x + 5);
  2241.             DrawingArea.method341(y + 16 + l1, 0x655841, k1, x + 6);
  2242.             DrawingArea.method341(y + 16 + l1, 0x61553e, k1, x + 7);
  2243.             DrawingArea.method341(y + 16 + l1, 0x61553e, k1, x + 8);
  2244.             DrawingArea.method341(y + 16 + l1, 0x5d513c, k1, x + 9);
  2245.             DrawingArea.method341(y + 16 + l1, 0x5d513c, k1, x + 10);
  2246.             DrawingArea.method341(y + 16 + l1, 0x594e3a, k1, x + 11);
  2247.             DrawingArea.method341(y + 16 + l1, 0x594e3a, k1, x + 12);
  2248.             DrawingArea.method341(y + 16 + l1, 0x514635, k1, x + 13);
  2249.             DrawingArea.method341(y + 16 + l1, 0x4b4131, k1, x + 14);
  2250.             DrawingArea.method339(y + 16 + l1, 0x000001, 15, x);
  2251.             DrawingArea.method339(y + 17 + l1, 0x000001, 15, x);
  2252.             DrawingArea.method339(y + 17 + l1, 0x655841, 14, x);
  2253.             DrawingArea.method339(y + 17 + l1, 0x6a5c43, 13, x);
  2254.             DrawingArea.method339(y + 17 + l1, 0x6d5f48, 11, x);
  2255.             DrawingArea.method339(y + 17 + l1, 0x73654a, 10, x);
  2256.             DrawingArea.method339(y + 17 + l1, 0x76684b, 7, x);
  2257.             DrawingArea.method339(y + 17 + l1, 0x7b6a4d, 5, x);
  2258.             DrawingArea.method339(y + 17 + l1, 0x7e6e50, 4, x);
  2259.             DrawingArea.method339(y + 17 + l1, 0x817051, 3, x);
  2260.             DrawingArea.method339(y + 17 + l1, 0x000001, 2, x);
  2261.             DrawingArea.method339(y + 18 + l1, 0x000001, 16, x);
  2262.             DrawingArea.method339(y + 18 + l1, 0x564b38, 15, x);
  2263.             DrawingArea.method339(y + 18 + l1, 0x5d513c, 14, x);
  2264.             DrawingArea.method339(y + 18 + l1, 0x625640, 11, x);
  2265.             DrawingArea.method339(y + 18 + l1, 0x655841, 10, x);
  2266.             DrawingArea.method339(y + 18 + l1, 0x6a5c43, 7, x);
  2267.             DrawingArea.method339(y + 18 + l1, 0x6e6046, 5, x);
  2268.             DrawingArea.method339(y + 18 + l1, 0x716247, 4, x);
  2269.             DrawingArea.method339(y + 18 + l1, 0x7b6a4d, 3, x);
  2270.             DrawingArea.method339(y + 18 + l1, 0x817051, 2, x);
  2271.             DrawingArea.method339(y + 18 + l1, 0x000001, 1, x);
  2272.             DrawingArea.method339(y + 19 + l1, 0x000001, 16, x);
  2273.             DrawingArea.method339(y + 19 + l1, 0x514635, 15, x);
  2274.             DrawingArea.method339(y + 19 + l1, 0x564b38, 14, x);
  2275.             DrawingArea.method339(y + 19 + l1, 0x5d513c, 11, x);
  2276.             DrawingArea.method339(y + 19 + l1, 0x61553e, 9, x);
  2277.             DrawingArea.method339(y + 19 + l1, 0x655841, 7, x);
  2278.             DrawingArea.method339(y + 19 + l1, 0x6a5c43, 5, x);
  2279.             DrawingArea.method339(y + 19 + l1, 0x6e6046, 4, x);
  2280.             DrawingArea.method339(y + 19 + l1, 0x73654a, 3, x);
  2281.             DrawingArea.method339(y + 19 + l1, 0x817051, 2, x);
  2282.             DrawingArea.method339(y + 19 + l1, 0x000001, 1, x);
  2283.             DrawingArea.method339(y + 20 + l1, 0x000001, 16, x);
  2284.             DrawingArea.method339(y + 20 + l1, 0x4b4131, 15, x);
  2285.             DrawingArea.method339(y + 20 + l1, 0x544936, 14, x);
  2286.             DrawingArea.method339(y + 20 + l1, 0x594e3a, 13, x);
  2287.             DrawingArea.method339(y + 20 + l1, 0x5d513c, 10, x);
  2288.             DrawingArea.method339(y + 20 + l1, 0x61553e, 8, x);
  2289.             DrawingArea.method339(y + 20 + l1, 0x655841, 6, x);
  2290.             DrawingArea.method339(y + 20 + l1, 0x6a5c43, 4, x);
  2291.             DrawingArea.method339(y + 20 + l1, 0x73654a, 3, x);
  2292.             DrawingArea.method339(y + 20 + l1, 0x817051, 2, x);
  2293.             DrawingArea.method339(y + 20 + l1, 0x000001, 1, x);
  2294.             DrawingArea.method341(y + 16 + l1, 0x000001, k1, x + 15);
  2295.             DrawingArea.method339(y + 15 + l1 + k1, 0x000001, 16, x);
  2296.             DrawingArea.method339(y + 14 + l1 + k1, 0x000001, 15, x);
  2297.             DrawingArea.method339(y + 14 + l1 + k1, 0x3f372a, 14, x);
  2298.             DrawingArea.method339(y + 14 + l1 + k1, 0x443c2d, 10, x);
  2299.             DrawingArea.method339(y + 14 + l1 + k1, 0x483e2f, 9, x);
  2300.             DrawingArea.method339(y + 14 + l1 + k1, 0x4a402f, 7, x);
  2301.             DrawingArea.method339(y + 14 + l1 + k1, 0x4b4131, 4, x);
  2302.             DrawingArea.method339(y + 14 + l1 + k1, 0x564b38, 3, x);
  2303.             DrawingArea.method339(y + 14 + l1 + k1, 0x000001, 2, x);
  2304.             DrawingArea.method339(y + 13 + l1 + k1, 0x000001, 16, x);
  2305.             DrawingArea.method339(y + 13 + l1 + k1, 0x443c2d, 15, x);
  2306.             DrawingArea.method339(y + 13 + l1 + k1, 0x4b4131, 11, x);
  2307.             DrawingArea.method339(y + 13 + l1 + k1, 0x514635, 9, x);
  2308.             DrawingArea.method339(y + 13 + l1 + k1, 0x544936, 7, x);
  2309.             DrawingArea.method339(y + 13 + l1 + k1, 0x564b38, 6, x);
  2310.             DrawingArea.method339(y + 13 + l1 + k1, 0x594e3a, 4, x);
  2311.             DrawingArea.method339(y + 13 + l1 + k1, 0x625640, 3, x);
  2312.             DrawingArea.method339(y + 13 + l1 + k1, 0x6a5c43, 2, x);
  2313.             DrawingArea.method339(y + 13 + l1 + k1, 0x000001, 1, x);
  2314.             DrawingArea.method339(y + 12 + l1 + k1, 0x000001, 16, x);
  2315.             DrawingArea.method339(y + 12 + l1 + k1, 0x443c2d, 15, x);
  2316.             DrawingArea.method339(y + 12 + l1 + k1, 0x4b4131, 14, x);
  2317.             DrawingArea.method339(y + 12 + l1 + k1, 0x544936, 12, x);
  2318.             DrawingArea.method339(y + 12 + l1 + k1, 0x564b38, 11, x);
  2319.             DrawingArea.method339(y + 12 + l1 + k1, 0x594e3a, 10, x);
  2320.             DrawingArea.method339(y + 12 + l1 + k1, 0x5d513c, 7, x);
  2321.             DrawingArea.method339(y + 12 + l1 + k1, 0x61553e, 4, x);
  2322.             DrawingArea.method339(y + 12 + l1 + k1, 0x6e6046, 3, x);
  2323.             DrawingArea.method339(y + 12 + l1 + k1, 0x7b6a4d, 2, x);
  2324.             DrawingArea.method339(y + 12 + l1 + k1, 0x000001, 1, x);
  2325.             DrawingArea.method339(y + 11 + l1 + k1, 0x000001, 16, x);
  2326.             DrawingArea.method339(y + 11 + l1 + k1, 0x4b4131, 15, x);
  2327.             DrawingArea.method339(y + 11 + l1 + k1, 0x514635, 14, x);
  2328.             DrawingArea.method339(y + 11 + l1 + k1, 0x564b38, 13, x);
  2329.             DrawingArea.method339(y + 11 + l1 + k1, 0x594e3a, 11, x);
  2330.             DrawingArea.method339(y + 11 + l1 + k1, 0x5d513c, 9, x);
  2331.             DrawingArea.method339(y + 11 + l1 + k1, 0x61553e, 7, x);
  2332.             DrawingArea.method339(y + 11 + l1 + k1, 0x655841, 5, x);
  2333.             DrawingArea.method339(y + 11 + l1 + k1, 0x6a5c43, 4, x);
  2334.             DrawingArea.method339(y + 11 + l1 + k1, 0x73654a, 3, x);
  2335.             DrawingArea.method339(y + 11 + l1 + k1, 0x7b6a4d, 2, x);
  2336.             DrawingArea.method339(y + 11 + l1 + k1, 0x000001, 1, x);
  2337.         }
  2338.     }
  2339.  
  2340.     public void updateNPCs(Stream stream, int i) {
  2341.         anInt839 = 0;
  2342.         anInt893 = 0;
  2343.         method139(stream);
  2344.         method46(i, stream);
  2345.         method86(stream);
  2346.         for (int k = 0; k < anInt839; k++) {
  2347.             int l = anIntArray840[k];
  2348.             if (npcArray[l].anInt1537 != loopCycle) {
  2349.                 npcArray[l].desc = null;
  2350.                 npcArray[l] = null;
  2351.             }
  2352.         }
  2353.  
  2354.         if (stream.currentOffset != i) {
  2355.             signlink.reporterror(myUsername
  2356.                     + " size mismatch in getnpcpos - pos:"
  2357.                     + stream.currentOffset + " psize:" + i);
  2358.             throw new RuntimeException("eek");
  2359.         }
  2360.         for (int i1 = 0; i1 < npcCount; i1++)
  2361.             if (npcArray[npcIndices[i1]] == null) {
  2362.                 signlink.reporterror(myUsername
  2363.                         + " null entry in npc list - pos:" + i1 + " size:"
  2364.                         + npcCount);
  2365.                 throw new RuntimeException("eek");
  2366.             }
  2367.  
  2368.     }
  2369.  
  2370.     private int cButtonHPos;
  2371.     private int cButtonCPos;
  2372.     private int setChannel;
  2373.  
  2374.     public void processChatModeClick() {
  2375.         final int yOffset = frameMode == ScreenMode.FIXED ? 0 : frameHeight - 503;
  2376.         if(super.mouseX >= 5 && super.mouseX <= 61 && super.mouseY >= yOffset + 482 && super.mouseY <= yOffset + 503) {
  2377.             cButtonHPos = 0;
  2378.             inputTaken = true;
  2379.         } else if(super.mouseX >= 71 && super.mouseX <= 127 && super.mouseY >= yOffset + 482 && super.mouseY <= yOffset + 503) {
  2380.             cButtonHPos = 1;
  2381.             inputTaken = true;
  2382.         } else if(super.mouseX >= 137 && super.mouseX <= 193 && super.mouseY >= yOffset + 482 && super.mouseY <= yOffset + 503) {
  2383.             cButtonHPos = 2;
  2384.             inputTaken = true;
  2385.         } else if(super.mouseX >= 203 && super.mouseX <= 259 && super.mouseY >= yOffset + 482 && super.mouseY <= yOffset + 503) {
  2386.             cButtonHPos = 3;
  2387.             inputTaken = true;
  2388.         } else if(super.mouseX >= 269 && super.mouseX <= 325 && super.mouseY >= yOffset + 482 && super.mouseY <= yOffset + 503) {
  2389.             cButtonHPos = 4;
  2390.             inputTaken = true;
  2391.         } else if(super.mouseX >= 335 && super.mouseX <= 391 && super.mouseY >= yOffset + 482 && super.mouseY <= yOffset + 503) {
  2392.             cButtonHPos = 5;
  2393.             inputTaken = true;
  2394.         } else if(super.mouseX >= 404 && super.mouseX <= 515 && super.mouseY >= yOffset + 482 && super.mouseY <= yOffset + 503) {
  2395.             cButtonHPos = 6;
  2396.             inputTaken = true;
  2397.         } else {
  2398.             cButtonHPos = -1;
  2399.             inputTaken = true;
  2400.         }
  2401.         if(super.clickMode3 == 1) {
  2402.             if(super.saveClickX >= 5 && super.saveClickX <= 61 && super.saveClickY >= yOffset + 482 && super.saveClickY <= yOffset + 505) {
  2403.                 if (frameMode != ScreenMode.FIXED) {
  2404.                     if (setChannel != 0) {
  2405.                         cButtonCPos = 0;
  2406.                         chatTypeView = 0;
  2407.                         inputTaken = true;
  2408.                         setChannel = 0;
  2409.                     } else {
  2410.                         showChatComponents = showChatComponents ? false : true;
  2411.                     }
  2412.                 } else {
  2413.                     cButtonCPos = 0;
  2414.                     chatTypeView = 0;
  2415.                     inputTaken = true;
  2416.                     setChannel = 0;
  2417.                 }
  2418.             } else if(super.saveClickX >= 71 && super.saveClickX <= 127 && super.saveClickY >= yOffset + 482 && super.saveClickY <= yOffset + 505) {
  2419.                 if (frameMode != ScreenMode.FIXED) {
  2420.                     if (setChannel != 1 && frameMode != ScreenMode.FIXED) {
  2421.                         cButtonCPos = 1;
  2422.                         chatTypeView = 5;
  2423.                         inputTaken = true;
  2424.                         setChannel = 1;
  2425.                     } else {
  2426.                         showChatComponents = showChatComponents ? false : true;
  2427.                     }
  2428.                 } else {
  2429.                     cButtonCPos = 1;
  2430.                     chatTypeView = 5;
  2431.                     inputTaken = true;
  2432.                     setChannel = 1;
  2433.                 }
  2434.             } else if(super.saveClickX >= 137 && super.saveClickX <= 193 && super.saveClickY >= yOffset + 482 && super.saveClickY <= yOffset + 505) {
  2435.                 if (frameMode != ScreenMode.FIXED) {
  2436.                     if (setChannel != 2 && frameMode != ScreenMode.FIXED) {
  2437.                         cButtonCPos = 2;
  2438.                         chatTypeView = 1;
  2439.                         inputTaken = true;
  2440.                         setChannel = 2;
  2441.                     } else {
  2442.                         showChatComponents = showChatComponents ? false : true;
  2443.                     }
  2444.                 } else {
  2445.                     cButtonCPos = 2;
  2446.                     chatTypeView = 1;
  2447.                     inputTaken = true;
  2448.                     setChannel = 2;
  2449.                 }
  2450.             } else if(super.saveClickX >= 203 && super.saveClickX <= 259 && super.saveClickY >= yOffset + 482 && super.saveClickY <= yOffset + 505) {
  2451.                 if (frameMode != ScreenMode.FIXED) {
  2452.                     if (setChannel != 3 && frameMode != ScreenMode.FIXED) {
  2453.                         cButtonCPos = 3;
  2454.                         chatTypeView = 2;
  2455.                         inputTaken = true;
  2456.                         setChannel = 3;
  2457.                     } else {
  2458.                         showChatComponents = showChatComponents ? false : true;
  2459.                     }
  2460.                 } else {
  2461.                     cButtonCPos = 3;
  2462.                     chatTypeView = 2;
  2463.                     inputTaken = true;
  2464.                     setChannel = 3;
  2465.                 }
  2466.             } else if(super.saveClickX >= 269 && super.saveClickX <= 325 && super.saveClickY >= yOffset + 482 && super.saveClickY <= yOffset + 505) {
  2467.                 if (frameMode != ScreenMode.FIXED) {
  2468.                     if (setChannel != 4 && frameMode != ScreenMode.FIXED) {
  2469.                         cButtonCPos = 4;
  2470.                         chatTypeView = 11;
  2471.                         inputTaken = true;
  2472.                         setChannel = 4;
  2473.                     } else {
  2474.                         showChatComponents = showChatComponents ? false : true;
  2475.                     }
  2476.                 } else {
  2477.                     cButtonCPos = 4;
  2478.                     chatTypeView = 11;
  2479.                     inputTaken = true;
  2480.                     setChannel = 4;
  2481.                 }
  2482.             } else if(super.saveClickX >= 335 && super.saveClickX <= 391 && super.saveClickY >= yOffset + 482 && super.saveClickY <= yOffset + 505) {
  2483.                 if (frameMode != ScreenMode.FIXED) {
  2484.                     if (setChannel != 5 && frameMode != ScreenMode.FIXED) {
  2485.                         cButtonCPos = 5;
  2486.                         chatTypeView = 3;
  2487.                         inputTaken = true;
  2488.                         setChannel = 5;
  2489.                     } else {
  2490.                         showChatComponents = showChatComponents ? false : true;
  2491.                     }
  2492.                 } else {
  2493.                     cButtonCPos = 5;
  2494.                     chatTypeView = 3;
  2495.                     inputTaken = true;
  2496.                     setChannel = 5;
  2497.                 }
  2498.             } else if(super.saveClickX >= 404 && super.saveClickX <= 515 && super.saveClickY >= yOffset + 482 && super.saveClickY <= yOffset + 505) {
  2499.                 if(openInterfaceID == -1) {
  2500.                     clearTopInterfaces();
  2501.                     reportAbuseInput = "";
  2502.                     canMute = false;
  2503.                     for(int i = 0; i < RSInterface.interfaceCache.length; i++) {
  2504.                         if(RSInterface.interfaceCache[i] == null || RSInterface.interfaceCache[i].contentType != 600) {
  2505.                             continue;
  2506.                         }
  2507.                         reportAbuseInterfaceID = openInterfaceID = RSInterface.interfaceCache[i].parentID;
  2508.                         break;
  2509.                     }
  2510.                 } else {
  2511.                     pushMessage("Please close the interface you have open before using 'report abuse'", 0, "");
  2512.                 }
  2513.             }
  2514.         }
  2515.     }
  2516.  
  2517.     public void method33(int i) {
  2518.         int j = Varp.cache[i].anInt709;
  2519.         if (j == 0)
  2520.             return;
  2521.         int k = variousSettings[i];
  2522.         if (j == 1) {
  2523.             if (k == 1)
  2524.                 Texture.method372(0.90000000000000002D);
  2525.             if (k == 2)
  2526.                 Texture.method372(0.80000000000000004D);
  2527.             if (k == 3)
  2528.                 Texture.method372(0.69999999999999996D);
  2529.             if (k == 4)
  2530.                 Texture.method372(0.59999999999999998D);
  2531.             ItemDef.mruNodes1.unlinkAll();
  2532.             welcomeScreenRaised = true;
  2533.         }
  2534.         if (j == 3) {
  2535.             boolean flag1 = musicEnabled;
  2536.             if (k == 0) {
  2537.                 adjustVolume(musicEnabled, 0);
  2538.                 musicEnabled = true;
  2539.             }
  2540.             if (k == 1) {
  2541.                 adjustVolume(musicEnabled, -400);
  2542.                 musicEnabled = true;
  2543.             }
  2544.             if (k == 2) {
  2545.                 adjustVolume(musicEnabled, -800);
  2546.                 musicEnabled = true;
  2547.             }
  2548.             if (k == 3) {
  2549.                 adjustVolume(musicEnabled, -1200);
  2550.                 musicEnabled = true;
  2551.             }
  2552.             if (k == 4)
  2553.                 musicEnabled = false;
  2554.             if (musicEnabled != flag1 && !lowMem) {
  2555.                 if (musicEnabled) {
  2556.                     nextSong = currentSong;
  2557.                     songChanging = true;
  2558.                     onDemandFetcher.method558(2, nextSong);
  2559.                 } else {
  2560.                     stopMidi();
  2561.                 }
  2562.                 prevSong = 0;
  2563.             }
  2564.         }
  2565.         if (j == 4) {
  2566.             if (k == 0) {
  2567.                 aBoolean848 = true;
  2568.                 setWaveVolume(0);
  2569.             }
  2570.             if (k == 1) {
  2571.                 aBoolean848 = true;
  2572.                 setWaveVolume(-400);
  2573.             }
  2574.             if (k == 2) {
  2575.                 aBoolean848 = true;
  2576.                 setWaveVolume(-800);
  2577.             }
  2578.             if (k == 3) {
  2579.                 aBoolean848 = true;
  2580.                 setWaveVolume(-1200);
  2581.             }
  2582.             if (k == 4)
  2583.                 aBoolean848 = false;
  2584.         }
  2585.         if (j == 5)
  2586.             anInt1253 = k;
  2587.         if (j == 6)
  2588.             anInt1249 = k;
  2589.         if (j == 8) {
  2590.             splitPrivateChat = k;
  2591.             inputTaken = true;
  2592.         }
  2593.         if (j == 9)
  2594.             anInt913 = k;
  2595.     }
  2596.  
  2597.     public void updateEntities() {
  2598.         try {
  2599.             int anInt974 = 0;
  2600.             for (int j = -1; j < playerCount + npcCount; j++) {
  2601.                 Object obj;
  2602.                 if (j == -1)
  2603.                     obj = myPlayer;
  2604.                 else if (j < playerCount)
  2605.                     obj = playerArray[playerIndices[j]];
  2606.                 else
  2607.                     obj = npcArray[npcIndices[j - playerCount]];
  2608.                 if (obj == null || !((Entity) (obj)).isVisible())
  2609.                     continue;
  2610.                 if (obj instanceof NPC) {
  2611.                     EntityDef entityDef = ((NPC) obj).desc;
  2612.                     if (entityDef.childrenIDs != null)
  2613.                         entityDef = entityDef.method161();
  2614.                     if (entityDef == null)
  2615.                         continue;
  2616.                 }
  2617.                 if (j < playerCount) {
  2618.                     int l = 30;
  2619.                     Player player = (Player) obj;
  2620.                     if (player.headIcon >= 0) {
  2621.                         npcScreenPos(((Entity) (obj)),
  2622.                                 ((Entity) (obj)).height + 15);
  2623.                         if (spriteDrawX > -1) {
  2624.                             if (player.skullIcon < 2) {
  2625.                                 skullIcons[player.skullIcon].drawSprite(
  2626.                                         spriteDrawX - 12, spriteDrawY - l);
  2627.                                 l += 25;
  2628.                             }
  2629.                             if (player.headIcon < 7) {
  2630.                                 headIcons[player.headIcon].drawSprite(
  2631.                                         spriteDrawX - 12, spriteDrawY - l);
  2632.                                 l += 18;
  2633.                             }
  2634.                         }
  2635.                     }
  2636.                     if (j >= 0 && anInt855 == 10
  2637.                             && anInt933 == playerIndices[j]) {
  2638.                         npcScreenPos(((Entity) (obj)),
  2639.                                 ((Entity) (obj)).height + 15);
  2640.                         if (spriteDrawX > -1)
  2641.                             headIconsHint[player.hintIcon].drawSprite(
  2642.                                     spriteDrawX - 12, spriteDrawY - l);
  2643.                     }
  2644.                 } else {
  2645.                     EntityDef entityDef_1 = ((NPC) obj).desc;
  2646.                     if (entityDef_1.anInt75 >= 0
  2647.                             && entityDef_1.anInt75 < headIcons.length) {
  2648.                         npcScreenPos(((Entity) (obj)),
  2649.                                 ((Entity) (obj)).height + 15);
  2650.                         if (spriteDrawX > -1)
  2651.                             headIcons[entityDef_1.anInt75].drawSprite(
  2652.                                     spriteDrawX - 12, spriteDrawY - 30);
  2653.                     }
  2654.                     if (anInt855 == 1
  2655.                             && anInt1222 == npcIndices[j - playerCount]
  2656.                             && loopCycle % 20 < 10) {
  2657.                         npcScreenPos(((Entity) (obj)),
  2658.                                 ((Entity) (obj)).height + 15);
  2659.                         if (spriteDrawX > -1)
  2660.                             headIconsHint[0].drawSprite(spriteDrawX - 12,
  2661.                                     spriteDrawY - 28);
  2662.                     }
  2663.                 }
  2664.                 if (((Entity) (obj)).textSpoken != null
  2665.                         && (j >= playerCount || publicChatMode == 0
  2666.                                 || publicChatMode == 3 || publicChatMode == 1
  2667.                                 && isFriendOrSelf(((Player) obj).name))) {
  2668.                     npcScreenPos(((Entity) (obj)), ((Entity) (obj)).height);
  2669.                     if (spriteDrawX > -1 && anInt974 < anInt975) {
  2670.                         anIntArray979[anInt974] = chatTextDrawingArea
  2671.                                 .method384(((Entity) (obj)).textSpoken) / 2;
  2672.                         anIntArray978[anInt974] = chatTextDrawingArea.anInt1497;
  2673.                         anIntArray976[anInt974] = spriteDrawX;
  2674.                         anIntArray977[anInt974] = spriteDrawY;
  2675.                         anIntArray980[anInt974] = ((Entity) (obj)).anInt1513;
  2676.                         anIntArray981[anInt974] = ((Entity) (obj)).anInt1531;
  2677.                         anIntArray982[anInt974] = ((Entity) (obj)).textCycle;
  2678.                         aStringArray983[anInt974++] = ((Entity) (obj)).textSpoken;
  2679.                         if (anInt1249 == 0 && ((Entity) (obj)).anInt1531 >= 1
  2680.                                 && ((Entity) (obj)).anInt1531 <= 3) {
  2681.                             anIntArray978[anInt974] += 10;
  2682.                             anIntArray977[anInt974] += 5;
  2683.                         }
  2684.                         if (anInt1249 == 0 && ((Entity) (obj)).anInt1531 == 4)
  2685.                             anIntArray979[anInt974] = 60;
  2686.                         if (anInt1249 == 0 && ((Entity) (obj)).anInt1531 == 5)
  2687.                             anIntArray978[anInt974] += 5;
  2688.                     }
  2689.                 }
  2690.                 if (((Entity) (obj)).loopCycleStatus > loopCycle) {
  2691.                     try {
  2692.                         npcScreenPos(((Entity) (obj)),
  2693.                                 ((Entity) (obj)).height + 15);
  2694.                         if (spriteDrawX > -1) {
  2695.                             int i1 = (((Entity) (obj)).currentHealth * 30)
  2696.                                     / ((Entity) (obj)).maxHealth;
  2697.                             if (i1 > 30)
  2698.                                 i1 = 30;
  2699.                             DrawingArea.drawPixels(5, spriteDrawY - 3,
  2700.                                     spriteDrawX - 15, 65280, i1);
  2701.                             DrawingArea.drawPixels(5, spriteDrawY - 3,
  2702.                                     (spriteDrawX - 15) + i1, 0xff0000, 30 - i1);
  2703.                         }
  2704.                     } catch (Exception e) {
  2705.                     }
  2706.                 }
  2707.                 for (int j1 = 0; j1 < 4; j1++)
  2708.                     if (((Entity) (obj)).hitsLoopCycle[j1] > loopCycle) {
  2709.                         npcScreenPos(((Entity) (obj)),
  2710.                                 ((Entity) (obj)).height / 2);
  2711.                         if (spriteDrawX > -1) {
  2712.                             if (j1 == 1)
  2713.                                 spriteDrawY -= 20;
  2714.                             if (j1 == 2) {
  2715.                                 spriteDrawX -= 15;
  2716.                                 spriteDrawY -= 10;
  2717.                             }
  2718.                             if (j1 == 3) {
  2719.                                 spriteDrawX += 15;
  2720.                                 spriteDrawY -= 10;
  2721.                             }
  2722.                             hitMarks[((Entity) (obj)).hitMarkTypes[j1]]
  2723.                                     .drawSprite(spriteDrawX - 12,
  2724.                                             spriteDrawY - 12);
  2725.                             smallText.drawText(0, String
  2726.                                     .valueOf(((Entity) (obj)).hitArray[j1]),
  2727.                                     spriteDrawY + 4, spriteDrawX);
  2728.                             smallText.drawText(0xffffff, String
  2729.                                     .valueOf(((Entity) (obj)).hitArray[j1]),
  2730.                                     spriteDrawY + 3, spriteDrawX - 1);
  2731.                         }
  2732.                     }
  2733.             }
  2734.             for (int k = 0; k < anInt974; k++) {
  2735.                 int k1 = anIntArray976[k];
  2736.                 int l1 = anIntArray977[k];
  2737.                 int j2 = anIntArray979[k];
  2738.                 int k2 = anIntArray978[k];
  2739.                 boolean flag = true;
  2740.                 while (flag) {
  2741.                     flag = false;
  2742.                     for (int l2 = 0; l2 < k; l2++)
  2743.                         if (l1 + 2 > anIntArray977[l2] - anIntArray978[l2]
  2744.                                 && l1 - k2 < anIntArray977[l2] + 2
  2745.                                 && k1 - j2 < anIntArray976[l2]
  2746.                                         + anIntArray979[l2]
  2747.                                 && k1 + j2 > anIntArray976[l2]
  2748.                                         - anIntArray979[l2]
  2749.                                 && anIntArray977[l2] - anIntArray978[l2] < l1) {
  2750.                             l1 = anIntArray977[l2] - anIntArray978[l2];
  2751.                             flag = true;
  2752.                         }
  2753.  
  2754.                 }
  2755.                 spriteDrawX = anIntArray976[k];
  2756.                 spriteDrawY = anIntArray977[k] = l1;
  2757.                 String s = aStringArray983[k];
  2758.                 if (anInt1249 == 0) {
  2759.                     int i3 = 0xffff00;
  2760.                     if (anIntArray980[k] < 6)
  2761.                         i3 = anIntArray965[anIntArray980[k]];
  2762.                     if (anIntArray980[k] == 6)
  2763.                         i3 = anInt1265 % 20 >= 10 ? 0xffff00 : 0xff0000;
  2764.                     if (anIntArray980[k] == 7)
  2765.                         i3 = anInt1265 % 20 >= 10 ? 65535 : 255;
  2766.                     if (anIntArray980[k] == 8)
  2767.                         i3 = anInt1265 % 20 >= 10 ? 0x80ff80 : 45056;
  2768.                     if (anIntArray980[k] == 9) {
  2769.                         int j3 = 150 - anIntArray982[k];
  2770.                         if (j3 < 50)
  2771.                             i3 = 0xff0000 + 1280 * j3;
  2772.                         else if (j3 < 100)
  2773.                             i3 = 0xffff00 - 0x50000 * (j3 - 50);
  2774.                         else if (j3 < 150)
  2775.                             i3 = 65280 + 5 * (j3 - 100);
  2776.                     }
  2777.                     if (anIntArray980[k] == 10) {
  2778.                         int k3 = 150 - anIntArray982[k];
  2779.                         if (k3 < 50)
  2780.                             i3 = 0xff0000 + 5 * k3;
  2781.                         else if (k3 < 100)
  2782.                             i3 = 0xff00ff - 0x50000 * (k3 - 50);
  2783.                         else if (k3 < 150)
  2784.                             i3 = (255 + 0x50000 * (k3 - 100)) - 5 * (k3 - 100);
  2785.                     }
  2786.                     if (anIntArray980[k] == 11) {
  2787.                         int l3 = 150 - anIntArray982[k];
  2788.                         if (l3 < 50)
  2789.                             i3 = 0xffffff - 0x50005 * l3;
  2790.                         else if (l3 < 100)
  2791.                             i3 = 65280 + 0x50005 * (l3 - 50);
  2792.                         else if (l3 < 150)
  2793.                             i3 = 0xffffff - 0x50000 * (l3 - 100);
  2794.                     }
  2795.                     if (anIntArray981[k] == 0) {
  2796.                         chatTextDrawingArea.drawText(0, s, spriteDrawY + 1,
  2797.                                 spriteDrawX);
  2798.                         chatTextDrawingArea.drawText(i3, s, spriteDrawY,
  2799.                                 spriteDrawX);
  2800.                     }
  2801.                     if (anIntArray981[k] == 1) {
  2802.                         chatTextDrawingArea.method386(0, s, spriteDrawX,
  2803.                                 anInt1265, spriteDrawY + 1);
  2804.                         chatTextDrawingArea.method386(i3, s, spriteDrawX,
  2805.                                 anInt1265, spriteDrawY);
  2806.                     }
  2807.                     if (anIntArray981[k] == 2) {
  2808.                         chatTextDrawingArea.method387(spriteDrawX, s,
  2809.                                 anInt1265, spriteDrawY + 1, 0);
  2810.                         chatTextDrawingArea.method387(spriteDrawX, s,
  2811.                                 anInt1265, spriteDrawY, i3);
  2812.                     }
  2813.                     if (anIntArray981[k] == 3) {
  2814.                         chatTextDrawingArea.method388(150 - anIntArray982[k],
  2815.                                 s, anInt1265, spriteDrawY + 1, spriteDrawX, 0);
  2816.                         chatTextDrawingArea.method388(150 - anIntArray982[k],
  2817.                                 s, anInt1265, spriteDrawY, spriteDrawX, i3);
  2818.                     }
  2819.                     if (anIntArray981[k] == 4) {
  2820.                         int i4 = chatTextDrawingArea.method384(s);
  2821.                         int k4 = ((150 - anIntArray982[k]) * (i4 + 100)) / 150;
  2822.                         DrawingArea.setDrawingArea(334, spriteDrawX - 50,
  2823.                                 spriteDrawX + 50, 0);
  2824.                         chatTextDrawingArea.method385(0, s, spriteDrawY + 1,
  2825.                                 (spriteDrawX + 50) - k4);
  2826.                         chatTextDrawingArea.method385(i3, s, spriteDrawY,
  2827.                                 (spriteDrawX + 50) - k4);
  2828.                         DrawingArea.defaultDrawingAreaSize();
  2829.                     }
  2830.                     if (anIntArray981[k] == 5) {
  2831.                         int j4 = 150 - anIntArray982[k];
  2832.                         int l4 = 0;
  2833.                         if (j4 < 25)
  2834.                             l4 = j4 - 25;
  2835.                         else if (j4 > 125)
  2836.                             l4 = j4 - 125;
  2837.                         DrawingArea
  2838.                                 .setDrawingArea(spriteDrawY + 5, 0, 512,
  2839.                                         spriteDrawY
  2840.                                                 - chatTextDrawingArea.anInt1497
  2841.                                                 - 1);
  2842.                         chatTextDrawingArea.drawText(0, s,
  2843.                                 spriteDrawY + 1 + l4, spriteDrawX);
  2844.                         chatTextDrawingArea.drawText(i3, s, spriteDrawY + l4,
  2845.                                 spriteDrawX);
  2846.                         DrawingArea.defaultDrawingAreaSize();
  2847.                     }
  2848.                 } else {
  2849.                     chatTextDrawingArea.drawText(0, s, spriteDrawY + 1,
  2850.                             spriteDrawX);
  2851.                     chatTextDrawingArea.drawText(0xffff00, s, spriteDrawY,
  2852.                             spriteDrawX);
  2853.                 }
  2854.             }
  2855.         } catch (Exception e) {
  2856.         }
  2857.     }
  2858.  
  2859.     public void delFriend(long l) {
  2860.         try {
  2861.             if (l == 0L)
  2862.                 return;
  2863.             for (int i = 0; i < friendsCount; i++) {
  2864.                 if (friendsListAsLongs[i] != l)
  2865.                     continue;
  2866.                 friendsCount--;
  2867.                 needDrawTabArea = true;
  2868.                 for (int j = i; j < friendsCount; j++) {
  2869.                     friendsList[j] = friendsList[j + 1];
  2870.                     friendsNodeIDs[j] = friendsNodeIDs[j + 1];
  2871.                     friendsListAsLongs[j] = friendsListAsLongs[j + 1];
  2872.                 }
  2873.  
  2874.                 stream.createFrame(215);
  2875.                 stream.writeQWord(l);
  2876.                 break;
  2877.             }
  2878.         } catch (RuntimeException runtimeexception) {
  2879.             signlink.reporterror("18622, " + false + ", " + l + ", "
  2880.                     + runtimeexception.toString());
  2881.             throw new RuntimeException();
  2882.         }
  2883.     }
  2884.  
  2885.     private final int[]
  2886.             sideIconsX = { 17, 49, 83, 114, 146, 180, 214, 16, 49, 82, 116, 148, 184, 216 },
  2887.             sideIconsY = { 9, 7, 7, 5, 2, 3, 7, 303, 306, 306, 302, 305, 303, 303, 303 },
  2888.             sideIconsId = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 },
  2889.             sideIconsTab = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 };
  2890.  
  2891.         public void drawSideIcons() {
  2892.             int xOffset = frameMode == ScreenMode.FIXED ? 0 : frameWidth - 247;
  2893.             int yOffset = frameMode == ScreenMode.FIXED ? 0 : frameHeight - 336;
  2894.             if (frameMode == ScreenMode.FIXED || frameMode == ScreenMode.RESIZABLE && !changeTabArea) {
  2895.                 for (int i = 0; i < sideIconsTab.length; i++) {
  2896.                     if (tabInterfaceIDs[sideIconsTab[i]] != -1) {
  2897.                         if (sideIconsId[i] != -1) {
  2898.                             sideIcons[sideIconsId[i]].drawSprite(sideIconsX[i] + xOffset, sideIconsY[i] + yOffset);
  2899.                         }
  2900.                     }
  2901.                 }
  2902.             } else if (changeTabArea && frameWidth < 1000) {
  2903.                 int[] iconId = { 0, 1, 2, 3, 4, 5, 6, -1, 8, 9, 7, 11, 12, 13 };
  2904.                 int[] iconX = { 219, 189, 156, 126, 93, 62, 30, 219, 189, 156, 124, 92, 59, 28};
  2905.                 int[] iconY = { 67, 69, 67, 69, 72, 72, 69, 32, 29, 29, 32, 30, 33, 31, 32 };
  2906.                 for (int i = 0; i < sideIconsTab.length; i++) {
  2907.                     if (tabInterfaceIDs[sideIconsTab[i]] != -1) {
  2908.                         if (iconId[i] != -1) {
  2909.                             sideIcons[iconId[i]].drawSprite(frameWidth - iconX[i], frameHeight - iconY[i]);
  2910.                         }
  2911.                     }
  2912.                 }
  2913.             } else if (changeTabArea && frameWidth >= 1000) {
  2914.                 int[] iconId = { 0, 1, 2, 3, 4, 5, 6, -1, 8, 9, 7, 11, 12, 13 };
  2915.                 int[] iconX = { 50, 80, 114, 143, 176, 208, 240, 242, 273, 306, 338, 370, 404, 433};
  2916.                 int[] iconY = { 30, 32, 30, 32, 34, 34, 32, 32, 29, 29, 32, 31, 32, 32, 32 };
  2917.                 for (int i = 0; i < sideIconsTab.length; i++) {
  2918.                     if (tabInterfaceIDs[sideIconsTab[i]] != -1) {
  2919.                         if (iconId[i] != -1) {
  2920.                             sideIcons[iconId[i]].drawSprite(frameWidth - 461 + iconX[i], frameHeight - iconY[i]);
  2921.                         }
  2922.                     }
  2923.                 }
  2924.             }
  2925.         }
  2926.        
  2927.         private void SortTabs() {
  2928.         // try {
  2929.         if (openInterfaceID == 24959
  2930.                 && RSInterface.interfaceCache[27000].message.equals("1")) {// Sent
  2931.                                                                             // on
  2932.                                                                             // bank
  2933.                                                                             // opening
  2934.                                                                             // etc,
  2935.                                                                             // refresh
  2936.                                                                             // tabs
  2937.             int tabs = Integer
  2938.                     .parseInt(RSInterface.interfaceCache[27001].message);// # of
  2939.                                                                             // tabs
  2940.                                                                             // used
  2941.             int tab = Integer
  2942.                     .parseInt(RSInterface.interfaceCache[27002].message);// current
  2943.                                                                             // tab
  2944.                                                                             // selected
  2945.             for (int i = 0; i <= tabs; i++) {
  2946.                 RSInterface.interfaceCache[22025 + i].sprite1 = new Sprite(
  2947.                         "Interfaces/Bank/TAB 3");
  2948.                 RSInterface.interfaceCache[22025 + i].tooltip = "Click here to select tab "
  2949.                         + (int) (i + 1);
  2950.             }
  2951.             for (int i = tabs + 1; i <= 8; i++) {
  2952.                 RSInterface.interfaceCache[22024 + i].sprite1 = new Sprite("");
  2953.                 RSInterface.interfaceCache[22024 + i].tooltip = "";
  2954.             }
  2955.             if (tabs != 8) {
  2956.                 RSInterface.interfaceCache[22025 + tabs].sprite1 = new Sprite(
  2957.                         "Interfaces/Bank/TAB 4");
  2958.                 RSInterface.interfaceCache[22025 + tabs].tooltip = "Drag an item here to create a new tab";
  2959.             }
  2960.             // System.out.println(tab);
  2961.             if (tab == -1)// searching
  2962.                 RSInterface.interfaceCache[22024].sprite1 = new Sprite(
  2963.                         "Interfaces/Bank/TAB 1");
  2964.             else if (tab > 0) {
  2965.                 RSInterface.interfaceCache[22024 + tab].sprite1 = new Sprite(
  2966.                         "Interfaces/Bank/TAB 2");
  2967.                 RSInterface.interfaceCache[22024].sprite1 = new Sprite(
  2968.                         "Interfaces/Bank/TAB 1");
  2969.             } else
  2970.                 RSInterface.interfaceCache[22024].sprite1 = new Sprite(
  2971.                         "Interfaces/Bank/TAB 0");
  2972.             // TODO: Highlight first item in new tab... (NOT MAIN) ADD BELOW TO
  2973.             // RSINTERFACE
  2974.             // RSInterface.interfaceCache[22043].sprite1 = new Sprite("");
  2975.  
  2976.             RSInterface.interfaceCache[27000].message = "0";
  2977.         }
  2978.         /*
  2979.          * } catch (Exception e) { //do w.e }
  2980.          */
  2981.     }
  2982.  
  2983.         private final int[]
  2984.             redStonesX = { 6, 44, 77, 110, 143, 176, 209, 6, 44, 77, 110, 143, 176, 209 },
  2985.             redStonesY = { 0, 0, 0, 0, 0, 0, 0, 298, 298, 298, 298, 298, 298, 298 },
  2986.             redStonesId = { 35, 39, 39, 39, 39, 39, 36, 37, 39, 39, 39, 39, 39, 38 };
  2987.  
  2988.         private void drawRedStones() {
  2989.             int xOffset = frameMode == ScreenMode.FIXED ? 0 : frameWidth - 247;
  2990.             int yOffset = frameMode == ScreenMode.FIXED ? 0 : frameHeight - 336;
  2991.             if (frameMode == ScreenMode.FIXED || frameMode == ScreenMode.RESIZABLE && !changeTabArea) {
  2992.                 if (tabInterfaceIDs[tabID] != -1 && tabID != 15) {
  2993.                     cacheSprite[redStonesId[tabID]].drawSprite(redStonesX[tabID] + xOffset, redStonesY[tabID] + yOffset);
  2994.                 }
  2995.             } else if (changeTabArea && frameWidth < 1000) {
  2996.                 int[] stoneX = { 226, 194, 162, 130, 99, 65, 34, 219, 195, 161, 130, 98, 65, 33};
  2997.                 int[] stoneY = { 73, 73, 73, 73, 73, 73, 73, -1, 37, 37, 37, 37, 37, 37, 37 };
  2998.                 if (tabInterfaceIDs[tabID] != -1 && tabID != 15 && showTabComponents) {
  2999.                     if (tabID == 7) {
  3000.                         cacheSprite[39].drawSprite(frameWidth - 130, frameHeight - 37);
  3001.                     }
  3002.                     cacheSprite[39].drawSprite(frameWidth - stoneX[tabID], frameHeight - stoneY[tabID]);
  3003.                 }
  3004.             } else if (changeTabArea && frameWidth >= 1000) {
  3005.                 int[] stoneX = { 417, 385, 353, 321, 289, 256, 224, 129, 193, 161, 130, 98, 65, 33};
  3006.                 if (tabInterfaceIDs[tabID] != -1 && tabID != 15 && showTabComponents) {
  3007.                     cacheSprite[39].drawSprite(frameWidth - stoneX[tabID], frameHeight - 37);
  3008.                 }
  3009.             }
  3010.         }
  3011.  
  3012.         private void drawTabArea() {
  3013.             final int xOffset = frameMode == ScreenMode.FIXED ? 0 : frameWidth - 241;
  3014.             final int yOffset = frameMode == ScreenMode.FIXED ? 0 : frameHeight - 336;
  3015.             if (frameMode == ScreenMode.FIXED) {
  3016.                 aRSImageProducer_1163.initDrawingArea();
  3017.             }
  3018.             Texture.anIntArray1472 = anIntArray1181;
  3019.             if (frameMode == ScreenMode.FIXED) {
  3020.                 cacheSprite[21].drawSprite(0, 0);
  3021.             } else if (frameMode != ScreenMode.FIXED && !changeTabArea){
  3022.                 DrawingArea.method335(0x3E3529, frameHeight - 304, 195, 270, transparentTabArea ? 80 : 256, frameWidth - 217);
  3023.                 cacheSprite[31].drawSprite(xOffset, yOffset);
  3024.             } else {
  3025.                 if (frameWidth >= 1000) {
  3026.                     if (showTabComponents) {
  3027.                         DrawingArea.method335(0x3E3529, frameHeight - 304, 197, 265, transparentTabArea ? 80 : 256, frameWidth - 197);
  3028.                         cacheSprite[34].drawSprite(frameWidth - 204, frameHeight - 311);
  3029.                     }
  3030.                     for (int x = frameWidth - 417, y = frameHeight - 37, index = 0; x <= frameWidth - 30 && index < 13; x += 32, index++) {
  3031.                         cacheSprite[46].drawSprite(x, y);
  3032.                     }
  3033.                 } else if (frameWidth < 1000) {
  3034.                     if (showTabComponents) {
  3035.                         DrawingArea.method335(0x3E3529, frameHeight - 341, 195, 265, transparentTabArea ? 80 : 256, frameWidth - 197);
  3036.                         cacheSprite[34].drawSprite(frameWidth - 204, frameHeight - 348);
  3037.                     }
  3038.                     for (int x = frameWidth - 226, y = frameHeight - 73, index = 0; x <= frameWidth - 32 && index < 7; x += 32, index++) {
  3039.                         cacheSprite[46].drawSprite(x, y);
  3040.                     }
  3041.                     for (int x = frameWidth - 226, y = frameHeight - 37, index = 0; x <= frameWidth - 32 && index < 7; x += 32, index++) {
  3042.                         cacheSprite[46].drawSprite(x, y);
  3043.                     }
  3044.                 }
  3045.             }
  3046.             if (invOverlayInterfaceID == -1) {
  3047.                 drawRedStones();
  3048.                 drawSideIcons();
  3049.             }
  3050.             if (showTabComponents) {
  3051.                 int x = frameMode == ScreenMode.FIXED ? 31 : frameWidth - 215;
  3052.                 int y = frameMode == ScreenMode.FIXED ? 37 : frameHeight - 299;
  3053.                 if (changeTabArea) {
  3054.                     x = frameWidth - 196;
  3055.                     y = frameWidth >= 1000 ? frameHeight - 303 : frameHeight - 340;
  3056.                 }
  3057.                 if (invOverlayInterfaceID != -1) {
  3058.                     drawInterface(0, x, RSInterface.interfaceCache[invOverlayInterfaceID], y);
  3059.                 } else if (tabInterfaceIDs[tabID] != -1) {
  3060.                     drawInterface(0, x, RSInterface.interfaceCache[tabInterfaceIDs[tabID]], y);
  3061.                 }
  3062.             }
  3063.             if (menuOpen) {
  3064.                 drawMenu(frameMode == ScreenMode.FIXED ? 516 : 0, frameMode == ScreenMode.FIXED ? 168 : 0);
  3065.             }
  3066.             if (frameMode == ScreenMode.FIXED) {
  3067.                 aRSImageProducer_1163.drawGraphics(168, super.graphics, 516);
  3068.                 aRSImageProducer_1165.initDrawingArea();
  3069.             }
  3070.             Texture.anIntArray1472 = anIntArray1182;
  3071.         }
  3072.  
  3073.     public void method37(int j) {
  3074.         if (!lowMem) {
  3075.             if (Texture.anIntArray1480[17] >= j) {
  3076.                 Background background = Texture.aBackgroundArray1474s[17];
  3077.                 int k = background.anInt1452 * background.anInt1453 - 1;
  3078.                 int j1 = background.anInt1452 * anInt945 * 2;
  3079.                 byte abyte0[] = background.aByteArray1450;
  3080.                 byte abyte3[] = aByteArray912;
  3081.                 for (int i2 = 0; i2 <= k; i2++)
  3082.                     abyte3[i2] = abyte0[i2 - j1 & k];
  3083.  
  3084.                 background.aByteArray1450 = abyte3;
  3085.                 aByteArray912 = abyte0;
  3086.                 Texture.method370(17);
  3087.                 anInt854++;
  3088.                 if (anInt854 > 1235) {
  3089.                     anInt854 = 0;
  3090.                     stream.createFrame(226);
  3091.                     stream.writeWordBigEndian(0);
  3092.                     int l2 = stream.currentOffset;
  3093.                     stream.writeWord(58722);
  3094.                     stream.writeWordBigEndian(240);
  3095.                     stream.writeWord((int) (Math.random() * 65536D));
  3096.                     stream.writeWordBigEndian((int) (Math.random() * 256D));
  3097.                     if ((int) (Math.random() * 2D) == 0)
  3098.                         stream.writeWord(51825);
  3099.                     stream.writeWordBigEndian((int) (Math.random() * 256D));
  3100.                     stream.writeWord((int) (Math.random() * 65536D));
  3101.                     stream.writeWord(7130);
  3102.                     stream.writeWord((int) (Math.random() * 65536D));
  3103.                     stream.writeWord(61657);
  3104.                     stream.writeBytes(stream.currentOffset - l2);
  3105.                 }
  3106.             }
  3107.             if (Texture.anIntArray1480[24] >= j) {
  3108.                 Background background_1 = Texture.aBackgroundArray1474s[24];
  3109.                 int l = background_1.anInt1452 * background_1.anInt1453 - 1;
  3110.                 int k1 = background_1.anInt1452 * anInt945 * 2;
  3111.                 byte abyte1[] = background_1.aByteArray1450;
  3112.                 byte abyte4[] = aByteArray912;
  3113.                 for (int j2 = 0; j2 <= l; j2++)
  3114.                     abyte4[j2] = abyte1[j2 - k1 & l];
  3115.  
  3116.                 background_1.aByteArray1450 = abyte4;
  3117.                 aByteArray912 = abyte1;
  3118.                 Texture.method370(24);
  3119.             }
  3120.             if (Texture.anIntArray1480[34] >= j) {
  3121.                 Background background_2 = Texture.aBackgroundArray1474s[34];
  3122.                 int i1 = background_2.anInt1452 * background_2.anInt1453 - 1;
  3123.                 int l1 = background_2.anInt1452 * anInt945 * 2;
  3124.                 byte abyte2[] = background_2.aByteArray1450;
  3125.                 byte abyte5[] = aByteArray912;
  3126.                 for (int k2 = 0; k2 <= i1; k2++)
  3127.                     abyte5[k2] = abyte2[k2 - l1 & i1];
  3128.  
  3129.                 background_2.aByteArray1450 = abyte5;
  3130.                 aByteArray912 = abyte2;
  3131.                 Texture.method370(34);
  3132.             }
  3133.             if (Texture.anIntArray1480[40] >= j) {
  3134.                 Background background_2 = Texture.aBackgroundArray1474s[40];
  3135.                 int i1 = background_2.anInt1452 * background_2.anInt1453 - 1;
  3136.                 int l1 = background_2.anInt1452 * anInt945 * 2;
  3137.                 byte abyte2[] = background_2.aByteArray1450;
  3138.                 byte abyte5[] = aByteArray912;
  3139.                 for (int k2 = 0; k2 <= i1; k2++)
  3140.                     abyte5[k2] = abyte2[k2 - l1 & i1];
  3141.                 background_2.aByteArray1450 = abyte5;
  3142.                 aByteArray912 = abyte2;
  3143.                 Texture.method370(40);
  3144.             }
  3145.         }
  3146.     }
  3147.  
  3148.     public void method38() {
  3149.         for (int i = -1; i < playerCount; i++) {
  3150.             int j;
  3151.             if (i == -1)
  3152.                 j = myPlayerIndex;
  3153.             else
  3154.                 j = playerIndices[i];
  3155.             Player player = playerArray[j];
  3156.             if (player != null && player.textCycle > 0) {
  3157.                 player.textCycle--;
  3158.                 if (player.textCycle == 0)
  3159.                     player.textSpoken = null;
  3160.             }
  3161.         }
  3162.         for (int k = 0; k < npcCount; k++) {
  3163.             int l = npcIndices[k];
  3164.             NPC npc = npcArray[l];
  3165.             if (npc != null && npc.textCycle > 0) {
  3166.                 npc.textCycle--;
  3167.                 if (npc.textCycle == 0)
  3168.                     npc.textSpoken = null;
  3169.             }
  3170.         }
  3171.     }
  3172.    
  3173.     /*private void SortTabs() {
  3174.         // try {
  3175.         if (openInterfaceID == 24959
  3176.                 && RSInterface.interfaceCache[27000].message.equals("1")) {// Sent
  3177.                                                                             // on
  3178.                                                                             // bank
  3179.                                                                             // opening
  3180.                                                                             // etc,
  3181.                                                                             // refresh
  3182.                                                                             // tabs
  3183.             int tabs = Integer
  3184.                     .parseInt(RSInterface.interfaceCache[27001].message);// # of
  3185.                                                                             // tabs
  3186.                                                                             // used
  3187.             int tab = Integer
  3188.                     .parseInt(RSInterface.interfaceCache[27002].message);// current
  3189.                                                                             // tab
  3190.                                                                             // selected
  3191.             for (int i = 0; i <= tabs; i++) {
  3192.                 RSInterface.interfaceCache[22025 + i].sprite1 = new Sprite(
  3193.                         "Interfaces/Bank/TAB 3");
  3194.                 RSInterface.interfaceCache[22025 + i].tooltip = "Click here to select tab "
  3195.                         + (int) (i + 1);
  3196.             }
  3197.             for (int i = tabs + 1; i <= 8; i++) {
  3198.                 RSInterface.interfaceCache[22024 + i].sprite1 = new Sprite("");
  3199.                 RSInterface.interfaceCache[22024 + i].tooltip = "";
  3200.             }
  3201.             if (tabs != 8) {
  3202.                 RSInterface.interfaceCache[22025 + tabs].sprite1 = new Sprite(
  3203.                         "Interfaces/Bank/TAB 4");
  3204.                 RSInterface.interfaceCache[22025 + tabs].tooltip = "Drag an item here to create a new tab";
  3205.             }
  3206.             // System.out.println(tab);
  3207.             if (tab == -1)// searching
  3208.                 RSInterface.interfaceCache[22024].sprite1 = new Sprite(
  3209.                         "Interfaces/Bank/TAB 1");
  3210.             else if (tab > 0) {
  3211.                 RSInterface.interfaceCache[22024 + tab].sprite1 = new Sprite(
  3212.                         "Interfaces/Bank/TAB 2");
  3213.                 RSInterface.interfaceCache[22024].sprite1 = new Sprite(
  3214.                         "Interfaces/Bank/TAB 1");
  3215.             } else
  3216.                 RSInterface.interfaceCache[22024].sprite1 = new Sprite(
  3217.                         "Interfaces/Bank/TAB 0");
  3218.             // TODO: Highlight first item in new tab... (NOT MAIN) ADD BELOW TO
  3219.             // RSINTERFACE
  3220.             // RSInterface.interfaceCache[22043].sprite1 = new Sprite("");
  3221.  
  3222.             RSInterface.interfaceCache[27000].message = "0";
  3223.         }
  3224.         /*
  3225.          * } catch (Exception e) { //do w.e }
  3226.          */
  3227.     /*}*/
  3228.  
  3229.     public void calcCameraPos() {
  3230.         int i = anInt1098 * 128 + 64;
  3231.         int j = anInt1099 * 128 + 64;
  3232.         int k = method42(plane, j, i) - anInt1100;
  3233.         if (xCameraPos < i) {
  3234.             xCameraPos += anInt1101 + ((i - xCameraPos) * anInt1102) / 1000;
  3235.             if (xCameraPos > i)
  3236.                 xCameraPos = i;
  3237.         }
  3238.         if (xCameraPos > i) {
  3239.             xCameraPos -= anInt1101 + ((xCameraPos - i) * anInt1102) / 1000;
  3240.             if (xCameraPos < i)
  3241.                 xCameraPos = i;
  3242.         }
  3243.         if (zCameraPos < k) {
  3244.             zCameraPos += anInt1101 + ((k - zCameraPos) * anInt1102) / 1000;
  3245.             if (zCameraPos > k)
  3246.                 zCameraPos = k;
  3247.         }
  3248.         if (zCameraPos > k) {
  3249.             zCameraPos -= anInt1101 + ((zCameraPos - k) * anInt1102) / 1000;
  3250.             if (zCameraPos < k)
  3251.                 zCameraPos = k;
  3252.         }
  3253.         if (yCameraPos < j) {
  3254.             yCameraPos += anInt1101 + ((j - yCameraPos) * anInt1102) / 1000;
  3255.             if (yCameraPos > j)
  3256.                 yCameraPos = j;
  3257.         }
  3258.         if (yCameraPos > j) {
  3259.             yCameraPos -= anInt1101 + ((yCameraPos - j) * anInt1102) / 1000;
  3260.             if (yCameraPos < j)
  3261.                 yCameraPos = j;
  3262.         }
  3263.         i = anInt995 * 128 + 64;
  3264.         j = anInt996 * 128 + 64;
  3265.         k = method42(plane, j, i) - anInt997;
  3266.         int l = i - xCameraPos;
  3267.         int i1 = k - zCameraPos;
  3268.         int j1 = j - yCameraPos;
  3269.         int k1 = (int) Math.sqrt(l * l + j1 * j1);
  3270.         int l1 = (int) (Math.atan2(i1, k1) * 325.94900000000001D) & 0x7ff;
  3271.         int i2 = (int) (Math.atan2(l, j1) * -325.94900000000001D) & 0x7ff;
  3272.         if (l1 < 128)
  3273.             l1 = 128;
  3274.         if (l1 > 383)
  3275.             l1 = 383;
  3276.         if (yCameraCurve < l1) {
  3277.             yCameraCurve += anInt998 + ((l1 - yCameraCurve) * anInt999) / 1000;
  3278.             if (yCameraCurve > l1)
  3279.                 yCameraCurve = l1;
  3280.         }
  3281.         if (yCameraCurve > l1) {
  3282.             yCameraCurve -= anInt998 + ((yCameraCurve - l1) * anInt999) / 1000;
  3283.             if (yCameraCurve < l1)
  3284.                 yCameraCurve = l1;
  3285.         }
  3286.         int j2 = i2 - xCameraCurve;
  3287.         if (j2 > 1024)
  3288.             j2 -= 2048;
  3289.         if (j2 < -1024)
  3290.             j2 += 2048;
  3291.         if (j2 > 0) {
  3292.             xCameraCurve += anInt998 + (j2 * anInt999) / 1000;
  3293.             xCameraCurve &= 0x7ff;
  3294.         }
  3295.         if (j2 < 0) {
  3296.             xCameraCurve -= anInt998 + (-j2 * anInt999) / 1000;
  3297.             xCameraCurve &= 0x7ff;
  3298.         }
  3299.         int k2 = i2 - xCameraCurve;
  3300.         if (k2 > 1024)
  3301.             k2 -= 2048;
  3302.         if (k2 < -1024)
  3303.             k2 += 2048;
  3304.         if (k2 < 0 && j2 > 0 || k2 > 0 && j2 < 0)
  3305.             xCameraCurve = i2;
  3306.     }
  3307.    
  3308.     public void drawMenu(int x, int y) {
  3309.         int xPos = menuOffsetX - (x - 4);
  3310.         int yPos = (-y + 4) + menuOffsetY;
  3311.         int w = menuWidth;
  3312.         int h = menuHeight + 1;
  3313.         inputTaken = true;
  3314.         tabAreaAltered = true;
  3315.         int menuColor = 0x5d5447;
  3316.         DrawingArea.drawPixels(h, yPos, xPos, menuColor, w);
  3317.         DrawingArea.drawPixels(16, yPos + 1, xPos + 1, 0, w - 2);
  3318.         DrawingArea.fillPixels(xPos + 1, w - 2, h - 19, 0, yPos + 18);
  3319.         chatTextDrawingArea.method385(menuColor, "Choose Option", yPos + 14, xPos + 3);
  3320.         int mouseX = super.mouseX - (x);
  3321.         int mouseY = (-y) + super.mouseY;
  3322.         for (int i = 0; i < menuActionRow; i++) {
  3323.             int textY = yPos + 31 + (menuActionRow - 1 - i) * 15;
  3324.             int textColor = 0xffffff;
  3325.             if (mouseX > xPos && mouseX < xPos + w && mouseY > textY - 13 && mouseY < textY + 3) {
  3326.                 DrawingArea.drawPixels(15, textY - 11, xPos + 3, 0x6f695d, menuWidth - 6);
  3327.                 textColor = 0xffff00;
  3328.             }
  3329.             newBoldFont.drawBasicString(menuActionName[i], xPos + 3, textY, textColor, 0);
  3330.         }
  3331.     }
  3332.  
  3333.     public void addFriend(long l) {
  3334.         try {
  3335.             if (l == 0L)
  3336.                 return;
  3337.             if (friendsCount >= 100 && anInt1046 != 1) {
  3338.                 pushMessage(
  3339.                         "Your friendlist is full. Max of 100 for free users, and 200 for members",
  3340.                         0, "");
  3341.                 return;
  3342.             }
  3343.             if (friendsCount >= 200) {
  3344.                 pushMessage(
  3345.                         "Your friendlist is full. Max of 100 for free users, and 200 for members",
  3346.                         0, "");
  3347.                 return;
  3348.             }
  3349.             String s = TextClass.fixName(TextClass.nameForLong(l));
  3350.             for (int i = 0; i < friendsCount; i++)
  3351.                 if (friendsListAsLongs[i] == l) {
  3352.                     pushMessage(s + " is already on your friend list", 0, "");
  3353.                     return;
  3354.                 }
  3355.             for (int j = 0; j < ignoreCount; j++)
  3356.                 if (ignoreListAsLongs[j] == l) {
  3357.                     pushMessage("Please remove " + s
  3358.                             + " from your ignore list first", 0, "");
  3359.                     return;
  3360.                 }
  3361.  
  3362.             if (s.equals(myPlayer.name)) {
  3363.                 return;
  3364.             } else {
  3365.                 friendsList[friendsCount] = s;
  3366.                 friendsListAsLongs[friendsCount] = l;
  3367.                 friendsNodeIDs[friendsCount] = 0;
  3368.                 friendsCount++;
  3369.                 needDrawTabArea = true;
  3370.                 stream.createFrame(188);
  3371.                 stream.writeQWord(l);
  3372.                 return;
  3373.             }
  3374.         } catch (RuntimeException runtimeexception) {
  3375.             signlink.reporterror("15283, " + (byte) 68 + ", " + l + ", "
  3376.                     + runtimeexception.toString());
  3377.         }
  3378.         throw new RuntimeException();
  3379.     }
  3380.  
  3381.     private int method42(int i, int j, int k) {
  3382.         int l = k >> 7;
  3383.         int i1 = j >> 7;
  3384.         if (l < 0 || i1 < 0 || l > 103 || i1 > 103)
  3385.             return 0;
  3386.         int j1 = i;
  3387.         if (j1 < 3 && (byteGroundArray[1][l][i1] & 2) == 2)
  3388.             j1++;
  3389.         int k1 = k & 0x7f;
  3390.         int l1 = j & 0x7f;
  3391.         int i2 = intGroundArray[j1][l][i1] * (128 - k1)
  3392.                 + intGroundArray[j1][l + 1][i1] * k1 >> 7;
  3393.         int j2 = intGroundArray[j1][l][i1 + 1] * (128 - k1)
  3394.                 + intGroundArray[j1][l + 1][i1 + 1] * k1 >> 7;
  3395.         return i2 * (128 - l1) + j2 * l1 >> 7;
  3396.     }
  3397.  
  3398.     public void resetLogout() {
  3399.         try {
  3400.             if (socketStream != null)
  3401.                 socketStream.close();
  3402.         } catch (Exception _ex) {
  3403.         }
  3404.         frameMode(ScreenMode.FIXED);
  3405.         socketStream = null;
  3406.         loggedIn = false;
  3407.         loginScreenState = 0;
  3408.         // myUsername = "";
  3409.         // myPassword = "";
  3410.         unlinkMRUNodes();
  3411.         worldController.initToNull();
  3412.         for (int i = 0; i < 4; i++)
  3413.             aClass11Array1230[i].method210();
  3414.         System.gc();
  3415.         stopMidi();
  3416.         currentSong = -1;
  3417.         nextSong = -1;
  3418.         prevSong = 0;
  3419.     }
  3420.  
  3421.     public void method45() {
  3422.         aBoolean1031 = true;
  3423.         for (int j = 0; j < 7; j++) {
  3424.             anIntArray1065[j] = -1;
  3425.             for (int k = 0; k < IDK.length; k++) {
  3426.                 if (IDK.cache[k].aBoolean662
  3427.                         || IDK.cache[k].anInt657 != j + (aBoolean1047 ? 0 : 7))
  3428.                     continue;
  3429.                 anIntArray1065[j] = k;
  3430.                 break;
  3431.             }
  3432.         }
  3433.     }
  3434.  
  3435.     private void method46(int i, Stream stream) {
  3436.         while (stream.bitPosition + 21 < i * 8) {
  3437.             int k = stream.readBits(14);
  3438.             if (k == 16383)
  3439.                 break;
  3440.             if (npcArray[k] == null)
  3441.                 npcArray[k] = new NPC();
  3442.             NPC npc = npcArray[k];
  3443.             npcIndices[npcCount++] = k;
  3444.             npc.anInt1537 = loopCycle;
  3445.             int l = stream.readBits(5);
  3446.             if (l > 15)
  3447.                 l -= 32;
  3448.             int i1 = stream.readBits(5);
  3449.             if (i1 > 15)
  3450.                 i1 -= 32;
  3451.             int j1 = stream.readBits(1);
  3452.             npc.desc = EntityDef.forID(stream.readBits(14));
  3453.             int k1 = stream.readBits(1);
  3454.             if (k1 == 1)
  3455.                 anIntArray894[anInt893++] = k;
  3456.             npc.anInt1540 = npc.desc.aByte68;
  3457.             npc.anInt1504 = npc.desc.anInt79;
  3458.             npc.anInt1554 = npc.desc.walkAnim;
  3459.             npc.anInt1555 = npc.desc.anInt58;
  3460.             npc.anInt1556 = npc.desc.anInt83;
  3461.             npc.anInt1557 = npc.desc.anInt55;
  3462.             npc.anInt1511 = npc.desc.standAnim;
  3463.             npc.setPos(myPlayer.smallX[0] + i1, myPlayer.smallY[0] + l, j1 == 1);
  3464.         }
  3465.         stream.finishBitAccess();
  3466.     }
  3467.  
  3468.     @Override
  3469.     public void processGameLoop() {
  3470.         if (rsAlreadyLoaded || loadingError || genericLoadingError)
  3471.             return;
  3472.         loopCycle++;
  3473.         if (!loggedIn)
  3474.             processLoginScreenInput();
  3475.         else
  3476.             mainGameProcessor();
  3477.         processOnDemandQueue();
  3478.     }
  3479.  
  3480.     public void method47(boolean flag) {
  3481.         if (myPlayer.x >> 7 == destX && myPlayer.y >> 7 == destY)
  3482.             destX = 0;
  3483.         int j = playerCount;
  3484.         if (flag)
  3485.             j = 1;
  3486.         for (int l = 0; l < j; l++) {
  3487.             Player player;
  3488.             int i1;
  3489.             if (flag) {
  3490.                 player = myPlayer;
  3491.                 i1 = myPlayerIndex << 14;
  3492.             } else {
  3493.                 player = playerArray[playerIndices[l]];
  3494.                 i1 = playerIndices[l] << 14;
  3495.             }
  3496.             if (player == null || !player.isVisible())
  3497.                 continue;
  3498.             player.aBoolean1699 = (lowMem && playerCount > 50 || playerCount > 200)
  3499.                     && !flag && player.anInt1517 == player.anInt1511;
  3500.             int j1 = player.x >> 7;
  3501.             int k1 = player.y >> 7;
  3502.             if (j1 < 0 || j1 >= 104 || k1 < 0 || k1 >= 104)
  3503.                 continue;
  3504.             if (player.aModel_1714 != null && loopCycle >= player.anInt1707
  3505.                     && loopCycle < player.anInt1708) {
  3506.                 player.aBoolean1699 = false;
  3507.                 player.anInt1709 = method42(plane, player.y, player.x);
  3508.                 worldController.method286(plane, player.y, player,
  3509.                         player.anInt1552, player.anInt1722, player.x,
  3510.                         player.anInt1709, player.anInt1719, player.anInt1721,
  3511.                         i1, player.anInt1720);
  3512.                 continue;
  3513.             }
  3514.             if ((player.x & 0x7f) == 64 && (player.y & 0x7f) == 64) {
  3515.                 if (anIntArrayArray929[j1][k1] == anInt1265)
  3516.                     continue;
  3517.                 anIntArrayArray929[j1][k1] = anInt1265;
  3518.             }
  3519.             player.anInt1709 = method42(plane, player.y, player.x);
  3520.             worldController.method285(plane, player.anInt1552,
  3521.                     player.anInt1709, i1, player.y, 60, player.x, player,
  3522.                     player.aBoolean1541);
  3523.         }
  3524.     }
  3525.  
  3526.     private boolean promptUserForInput(RSInterface class9) {
  3527.         int j = class9.contentType;
  3528.         if (anInt900 == 2) {
  3529.             if (j == 201) {
  3530.                 inputTaken = true;
  3531.                 inputDialogState = 0;
  3532.                 messagePromptRaised = true;
  3533.                 promptInput = "";
  3534.                 friendsListAction = 1;
  3535.                 aString1121 = "Enter name of friend to add to list";
  3536.             }
  3537.             if (j == 202) {
  3538.                 inputTaken = true;
  3539.                 inputDialogState = 0;
  3540.                 messagePromptRaised = true;
  3541.                 promptInput = "";
  3542.                 friendsListAction = 2;
  3543.                 aString1121 = "Enter name of friend to delete from list";
  3544.             }
  3545.         }
  3546.         if (j == 205) {
  3547.             anInt1011 = 250;
  3548.             return true;
  3549.         }
  3550.         if (j == 501) {
  3551.             inputTaken = true;
  3552.             inputDialogState = 0;
  3553.             messagePromptRaised = true;
  3554.             promptInput = "";
  3555.             friendsListAction = 4;
  3556.             aString1121 = "Enter name of player to add to list";
  3557.         }
  3558.         if (j == 502) {
  3559.             inputTaken = true;
  3560.             inputDialogState = 0;
  3561.             messagePromptRaised = true;
  3562.             promptInput = "";
  3563.             friendsListAction = 5;
  3564.             aString1121 = "Enter name of player to delete from list";
  3565.         }
  3566.         if (j == 550) {
  3567.             inputTaken = true;
  3568.             inputDialogState = 0;
  3569.             messagePromptRaised = true;
  3570.             promptInput = "";
  3571.             friendsListAction = 6;
  3572.             aString1121 = "Enter the name of the chat you wish to join";
  3573.         }
  3574.         if (j >= 300 && j <= 313) {
  3575.             int k = (j - 300) / 2;
  3576.             int j1 = j & 1;
  3577.             int i2 = anIntArray1065[k];
  3578.             if (i2 != -1) {
  3579.                 do {
  3580.                     if (j1 == 0 && --i2 < 0)
  3581.                         i2 = IDK.length - 1;
  3582.                     if (j1 == 1 && ++i2 >= IDK.length)
  3583.                         i2 = 0;
  3584.                 } while (IDK.cache[i2].aBoolean662
  3585.                         || IDK.cache[i2].anInt657 != k + (aBoolean1047 ? 0 : 7));
  3586.                 anIntArray1065[k] = i2;
  3587.                 aBoolean1031 = true;
  3588.             }
  3589.         }
  3590.         if (j >= 314 && j <= 323) {
  3591.             int l = (j - 314) / 2;
  3592.             int k1 = j & 1;
  3593.             int j2 = anIntArray990[l];
  3594.             if (k1 == 0 && --j2 < 0)
  3595.                 j2 = anIntArrayArray1003[l].length - 1;
  3596.             if (k1 == 1 && ++j2 >= anIntArrayArray1003[l].length)
  3597.                 j2 = 0;
  3598.             anIntArray990[l] = j2;
  3599.             aBoolean1031 = true;
  3600.         }
  3601.         if (j == 324 && !aBoolean1047) {
  3602.             aBoolean1047 = true;
  3603.             method45();
  3604.         }
  3605.         if (j == 325 && aBoolean1047) {
  3606.             aBoolean1047 = false;
  3607.             method45();
  3608.         }
  3609.         if (j == 326) {
  3610.             stream.createFrame(101);
  3611.             stream.writeWordBigEndian(aBoolean1047 ? 0 : 1);
  3612.             for (int i1 = 0; i1 < 7; i1++)
  3613.                 stream.writeWordBigEndian(anIntArray1065[i1]);
  3614.  
  3615.             for (int l1 = 0; l1 < 5; l1++)
  3616.                 stream.writeWordBigEndian(anIntArray990[l1]);
  3617.  
  3618.             return true;
  3619.         }
  3620.         if (j == 613)
  3621.             canMute = !canMute;
  3622.         if (j >= 601 && j <= 612) {
  3623.             clearTopInterfaces();
  3624.             if (reportAbuseInput.length() > 0) {
  3625.                 stream.createFrame(218);
  3626.                 stream.writeQWord(TextClass.longForName(reportAbuseInput));
  3627.                 stream.writeWordBigEndian(j - 601);
  3628.                 stream.writeWordBigEndian(canMute ? 1 : 0);
  3629.             }
  3630.         }
  3631.         return false;
  3632.     }
  3633.  
  3634.     public void method49(Stream stream) {
  3635.         for (int j = 0; j < anInt893; j++) {
  3636.             int k = anIntArray894[j];
  3637.             Player player = playerArray[k];
  3638.             int l = stream.readUnsignedByte();
  3639.             if ((l & 0x40) != 0)
  3640.                 l += stream.readUnsignedByte() << 8;
  3641.             method107(l, k, stream, player);
  3642.         }
  3643.     }
  3644.  
  3645.     public void method50(int i, int k, int l, int i1, int j1) {
  3646.         int k1 = worldController.method300(j1, l, i);
  3647.         if (k1 != 0) {
  3648.             int l1 = worldController.method304(j1, l, i, k1);
  3649.             int k2 = l1 >> 6 & 3;
  3650.             int i3 = l1 & 0x1f;
  3651.             int k3 = k;
  3652.             if (k1 > 0)
  3653.                 k3 = i1;
  3654.             int ai[] = miniMapImage.myPixels;
  3655.             int k4 = 24624 + l * 4 + (103 - i) * 512 * 4;
  3656.             int i5 = k1 >> 14 & 0x7fff;
  3657.             ObjectDef class46_2 = ObjectDef.forID(i5);
  3658.             if (class46_2.anInt758 != -1) {
  3659.                 Background background_2 = mapScenes[class46_2.anInt758];
  3660.                 if (background_2 != null) {
  3661.                     int i6 = (class46_2.anInt744 * 4 - background_2.anInt1452) / 2;
  3662.                     int j6 = (class46_2.anInt761 * 4 - background_2.anInt1453) / 2;
  3663.                     background_2.drawBackground(48 + l * 4 + i6, 48
  3664.                             + (104 - i - class46_2.anInt761) * 4 + j6);
  3665.                 }
  3666.             } else {
  3667.                 if (i3 == 0 || i3 == 2)
  3668.                     if (k2 == 0) {
  3669.                         ai[k4] = k3;
  3670.                         ai[k4 + 512] = k3;
  3671.                         ai[k4 + 1024] = k3;
  3672.                         ai[k4 + 1536] = k3;
  3673.                     } else if (k2 == 1) {
  3674.                         ai[k4] = k3;
  3675.                         ai[k4 + 1] = k3;
  3676.                         ai[k4 + 2] = k3;
  3677.                         ai[k4 + 3] = k3;
  3678.                     } else if (k2 == 2) {
  3679.                         ai[k4 + 3] = k3;
  3680.                         ai[k4 + 3 + 512] = k3;
  3681.                         ai[k4 + 3 + 1024] = k3;
  3682.                         ai[k4 + 3 + 1536] = k3;
  3683.                     } else if (k2 == 3) {
  3684.                         ai[k4 + 1536] = k3;
  3685.                         ai[k4 + 1536 + 1] = k3;
  3686.                         ai[k4 + 1536 + 2] = k3;
  3687.                         ai[k4 + 1536 + 3] = k3;
  3688.                     }
  3689.                 if (i3 == 3)
  3690.                     if (k2 == 0)
  3691.                         ai[k4] = k3;
  3692.                     else if (k2 == 1)
  3693.                         ai[k4 + 3] = k3;
  3694.                     else if (k2 == 2)
  3695.                         ai[k4 + 3 + 1536] = k3;
  3696.                     else if (k2 == 3)
  3697.                         ai[k4 + 1536] = k3;
  3698.                 if (i3 == 2)
  3699.                     if (k2 == 3) {
  3700.                         ai[k4] = k3;
  3701.                         ai[k4 + 512] = k3;
  3702.                         ai[k4 + 1024] = k3;
  3703.                         ai[k4 + 1536] = k3;
  3704.                     } else if (k2 == 0) {
  3705.                         ai[k4] = k3;
  3706.                         ai[k4 + 1] = k3;
  3707.                         ai[k4 + 2] = k3;
  3708.                         ai[k4 + 3] = k3;
  3709.                     } else if (k2 == 1) {
  3710.                         ai[k4 + 3] = k3;
  3711.                         ai[k4 + 3 + 512] = k3;
  3712.                         ai[k4 + 3 + 1024] = k3;
  3713.                         ai[k4 + 3 + 1536] = k3;
  3714.                     } else if (k2 == 2) {
  3715.                         ai[k4 + 1536] = k3;
  3716.                         ai[k4 + 1536 + 1] = k3;
  3717.                         ai[k4 + 1536 + 2] = k3;
  3718.                         ai[k4 + 1536 + 3] = k3;
  3719.                     }
  3720.             }
  3721.         }
  3722.         k1 = worldController.method302(j1, l, i);
  3723.         if (k1 != 0) {
  3724.             int i2 = worldController.method304(j1, l, i, k1);
  3725.             int l2 = i2 >> 6 & 3;
  3726.             int j3 = i2 & 0x1f;
  3727.             int l3 = k1 >> 14 & 0x7fff;
  3728.             ObjectDef class46_1 = ObjectDef.forID(l3);
  3729.             if (class46_1.anInt758 != -1) {
  3730.                 Background background_1 = mapScenes[class46_1.anInt758];
  3731.                 if (background_1 != null) {
  3732.                     int j5 = (class46_1.anInt744 * 4 - background_1.anInt1452) / 2;
  3733.                     int k5 = (class46_1.anInt761 * 4 - background_1.anInt1453) / 2;
  3734.                     background_1.drawBackground(48 + l * 4 + j5, 48
  3735.                             + (104 - i - class46_1.anInt761) * 4 + k5);
  3736.                 }
  3737.             } else if (j3 == 9) {
  3738.                 int l4 = 0xeeeeee;
  3739.                 if (k1 > 0)
  3740.                     l4 = 0xee0000;
  3741.                 int ai1[] = miniMapImage.myPixels;
  3742.                 int l5 = 24624 + l * 4 + (103 - i) * 512 * 4;
  3743.                 if (l2 == 0 || l2 == 2) {
  3744.                     ai1[l5 + 1536] = l4;
  3745.                     ai1[l5 + 1024 + 1] = l4;
  3746.                     ai1[l5 + 512 + 2] = l4;
  3747.                     ai1[l5 + 3] = l4;
  3748.                 } else {
  3749.                     ai1[l5] = l4;
  3750.                     ai1[l5 + 512 + 1] = l4;
  3751.                     ai1[l5 + 1024 + 2] = l4;
  3752.                     ai1[l5 + 1536 + 3] = l4;
  3753.                 }
  3754.             }
  3755.         }
  3756.         k1 = worldController.method303(j1, l, i);
  3757.         if (k1 != 0) {
  3758.             int j2 = k1 >> 14 & 0x7fff;
  3759.             ObjectDef class46 = ObjectDef.forID(j2);
  3760.             if (class46.anInt758 != -1) {
  3761.                 Background background = mapScenes[class46.anInt758];
  3762.                 if (background != null) {
  3763.                     int i4 = (class46.anInt744 * 4 - background.anInt1452) / 2;
  3764.                     int j4 = (class46.anInt761 * 4 - background.anInt1453) / 2;
  3765.                     background.drawBackground(48 + l * 4 + i4, 48
  3766.                             + (104 - i - class46.anInt761) * 4 + j4);
  3767.                 }
  3768.             }
  3769.         }
  3770.     }
  3771.  
  3772.     public void loadTitleScreen() {
  3773.         aBackground_966 = new Background(titleStreamLoader, "titlebox", 0);
  3774.         aBackground_967 = new Background(titleStreamLoader, "titlebutton", 0);
  3775.         aBackgroundArray1152s = new Background[12];
  3776.         int j = 0;
  3777.         try {
  3778.             j = Integer.parseInt(getParameter("fl_icon"));
  3779.         } catch (Exception _ex) {
  3780.         }
  3781.         if (j == 0) {
  3782.             for (int k = 0; k < 12; k++)
  3783.                 aBackgroundArray1152s[k] = new Background(titleStreamLoader,
  3784.                         "runes", k);
  3785.  
  3786.         } else {
  3787.             for (int l = 0; l < 12; l++)
  3788.                 aBackgroundArray1152s[l] = new Background(titleStreamLoader,
  3789.                         "runes", 12 + (l & 3));
  3790.  
  3791.         }
  3792.         aClass30_Sub2_Sub1_Sub1_1201 = new Sprite(128, 265);
  3793.         aClass30_Sub2_Sub1_Sub1_1202 = new Sprite(128, 265);
  3794.         System.arraycopy(aRSImageProducer_1110.canvasRaster, 0,
  3795.                 aClass30_Sub2_Sub1_Sub1_1201.myPixels, 0, 33920);
  3796.  
  3797.         System.arraycopy(aRSImageProducer_1111.canvasRaster, 0,
  3798.                 aClass30_Sub2_Sub1_Sub1_1202.myPixels, 0, 33920);
  3799.  
  3800.         anIntArray851 = new int[256];
  3801.         for (int k1 = 0; k1 < 64; k1++)
  3802.             anIntArray851[k1] = k1 * 0x40000;
  3803.  
  3804.         for (int l1 = 0; l1 < 64; l1++)
  3805.             anIntArray851[l1 + 64] = 0xff0000 + 1024 * l1;
  3806.  
  3807.         for (int i2 = 0; i2 < 64; i2++)
  3808.             anIntArray851[i2 + 128] = 0xffff00 + 4 * i2;
  3809.  
  3810.         for (int j2 = 0; j2 < 64; j2++)
  3811.             anIntArray851[j2 + 192] = 0xffffff;
  3812.  
  3813.         anIntArray852 = new int[256];
  3814.         for (int k2 = 0; k2 < 64; k2++)
  3815.             anIntArray852[k2] = k2 * 1024;
  3816.  
  3817.         for (int l2 = 0; l2 < 64; l2++)
  3818.             anIntArray852[l2 + 64] = 65280 + 4 * l2;
  3819.  
  3820.         for (int i3 = 0; i3 < 64; i3++)
  3821.             anIntArray852[i3 + 128] = 65535 + 0x40000 * i3;
  3822.  
  3823.         for (int j3 = 0; j3 < 64; j3++)
  3824.             anIntArray852[j3 + 192] = 0xffffff;
  3825.  
  3826.         anIntArray853 = new int[256];
  3827.         for (int k3 = 0; k3 < 64; k3++)
  3828.             anIntArray853[k3] = k3 * 4;
  3829.  
  3830.         for (int l3 = 0; l3 < 64; l3++)
  3831.             anIntArray853[l3 + 64] = 255 + 0x40000 * l3;
  3832.  
  3833.         for (int i4 = 0; i4 < 64; i4++)
  3834.             anIntArray853[i4 + 128] = 0xff00ff + 1024 * i4;
  3835.  
  3836.         for (int j4 = 0; j4 < 64; j4++)
  3837.             anIntArray853[j4 + 192] = 0xffffff;
  3838.  
  3839.         anIntArray850 = new int[256];
  3840.         anIntArray1190 = new int[32768];
  3841.         anIntArray1191 = new int[32768];
  3842.         randomizeBackground(null);
  3843.         anIntArray828 = new int[32768];
  3844.         anIntArray829 = new int[32768];
  3845.         drawLoadingText(10, "Connecting to fileserver");
  3846.         if (!aBoolean831) {
  3847.             drawFlames = true;
  3848.             aBoolean831 = true;
  3849.             startRunnable(this, 2);
  3850.         }
  3851.     }
  3852.  
  3853.     private static void setHighMem() {
  3854.         WorldController.lowMem = false;
  3855.         Texture.lowMem = false;
  3856.         lowMem = false;
  3857.         ObjectManager.lowMem = false;
  3858.         ObjectDef.lowMem = false;
  3859.     }
  3860.  
  3861.     public static void main(String args[]) {
  3862.         try {
  3863.             nodeID = 10;
  3864.             portOff = 0;
  3865.             setHighMem();
  3866.             isMembers = true;
  3867.             signlink.storeid = 32;
  3868.             signlink.startpriv(InetAddress.getLocalHost());
  3869.             instance = new Jframe(args);
  3870.             frameMode(ScreenMode.FIXED);
  3871.         } catch (Exception exception) {
  3872.         }
  3873.     }
  3874.  
  3875.     public static client instance;
  3876.  
  3877.     public void loadingStages() {
  3878.         if (lowMem && loadingStage == 2 && ObjectManager.anInt131 != plane) {
  3879.             aRSImageProducer_1165.initDrawingArea();
  3880.             aTextDrawingArea_1271.drawText(0, "Loading - please wait.", 151,
  3881.                     257);
  3882.             aTextDrawingArea_1271.drawText(0xffffff, "Loading - please wait.",
  3883.                     150, 256);
  3884.             aRSImageProducer_1165.drawGraphics(frameMode == ScreenMode.FIXED ? 4 : 0, super.graphics, frameMode == ScreenMode.FIXED ? 4 : 0);
  3885.             loadingStage = 1;
  3886.             aLong824 = System.currentTimeMillis();
  3887.         }
  3888.         if (loadingStage == 1) {
  3889.             int j = method54();
  3890.             if (j != 0 && System.currentTimeMillis() - aLong824 > 0x57e40L) {
  3891.                 signlink.reporterror(myUsername + " glcfb " + aLong1215 + ","
  3892.                         + j + "," + lowMem + "," + decompressors[0] + ","
  3893.                         + onDemandFetcher.getNodeCount() + "," + plane + ","
  3894.                         + anInt1069 + "," + anInt1070);
  3895.                 aLong824 = System.currentTimeMillis();
  3896.             }
  3897.         }
  3898.         if (loadingStage == 2 && plane != anInt985) {
  3899.             anInt985 = plane;
  3900.             method24(plane);
  3901.         }
  3902.     }
  3903.  
  3904.     private int method54() {
  3905.         for (int i = 0; i < aByteArrayArray1183.length; i++) {
  3906.             if (aByteArrayArray1183[i] == null && anIntArray1235[i] != -1) {
  3907.                 System.out.println("MapID:" + anIntArray1235[i]);
  3908.                 if (anIntArray1235[i] == 1510)// just a test
  3909.                     anIntArray1235[i] = -1;
  3910.                 return -1;// null map files
  3911.             }
  3912.             if (aByteArrayArray1247[i] == null && anIntArray1236[i] != -1) {
  3913.                 System.out.println("LandscapeID:" + anIntArray1236[i]);
  3914.                 if (anIntArray1236[i] == 1511)// just a test
  3915.                     anIntArray1236[i] = -1;
  3916.                 return -2;
  3917.             }
  3918.         }
  3919.         boolean flag = true;
  3920.         for (int j = 0; j < aByteArrayArray1183.length; j++) {
  3921.             byte abyte0[] = aByteArrayArray1247[j];
  3922.             if (abyte0 != null) {
  3923.                 int k = (anIntArray1234[j] >> 8) * 64 - baseX;
  3924.                 int l = (anIntArray1234[j] & 0xff) * 64 - baseY;
  3925.                 if (aBoolean1159) {
  3926.                     k = 10;
  3927.                     l = 10;
  3928.                 }
  3929.                 flag &= ObjectManager.method189(k, abyte0, l);
  3930.             }
  3931.         }
  3932.         if (!flag)
  3933.             return -3;// couldn't parse all landscapes
  3934.         if (aBoolean1080) {
  3935.             return -4;
  3936.         } else {
  3937.             loadingStage = 2;
  3938.             ObjectManager.anInt131 = plane;
  3939.             method22();
  3940.             stream.createFrame(121);
  3941.             return 0;
  3942.         }
  3943.     }
  3944.  
  3945.     public void method55() {
  3946.         for (Animable_Sub4 class30_sub2_sub4_sub4 = (Animable_Sub4) aClass19_1013
  3947.                 .reverseGetFirst(); class30_sub2_sub4_sub4 != null; class30_sub2_sub4_sub4 = (Animable_Sub4) aClass19_1013
  3948.                 .reverseGetNext())
  3949.             if (class30_sub2_sub4_sub4.anInt1597 != plane
  3950.                     || loopCycle > class30_sub2_sub4_sub4.anInt1572)
  3951.                 class30_sub2_sub4_sub4.unlink();
  3952.             else if (loopCycle >= class30_sub2_sub4_sub4.anInt1571) {
  3953.                 if (class30_sub2_sub4_sub4.anInt1590 > 0) {
  3954.                     NPC npc = npcArray[class30_sub2_sub4_sub4.anInt1590 - 1];
  3955.                     if (npc != null && npc.x >= 0 && npc.x < 13312
  3956.                             && npc.y >= 0 && npc.y < 13312)
  3957.                         class30_sub2_sub4_sub4.method455(
  3958.                                 loopCycle,
  3959.                                 npc.y,
  3960.                                 method42(class30_sub2_sub4_sub4.anInt1597,
  3961.                                         npc.y, npc.x)
  3962.                                         - class30_sub2_sub4_sub4.anInt1583,
  3963.                                 npc.x);
  3964.                 }
  3965.                 if (class30_sub2_sub4_sub4.anInt1590 < 0) {
  3966.                     int j = -class30_sub2_sub4_sub4.anInt1590 - 1;
  3967.                     Player player;
  3968.                     if (j == unknownInt10)
  3969.                         player = myPlayer;
  3970.                     else
  3971.                         player = playerArray[j];
  3972.                     if (player != null && player.x >= 0 && player.x < 13312
  3973.                             && player.y >= 0 && player.y < 13312)
  3974.                         class30_sub2_sub4_sub4.method455(
  3975.                                 loopCycle,
  3976.                                 player.y,
  3977.                                 method42(class30_sub2_sub4_sub4.anInt1597,
  3978.                                         player.y, player.x)
  3979.                                         - class30_sub2_sub4_sub4.anInt1583,
  3980.                                 player.x);
  3981.                 }
  3982.                 class30_sub2_sub4_sub4.method456(anInt945);
  3983.                 worldController.method285(plane,
  3984.                         class30_sub2_sub4_sub4.anInt1595,
  3985.                         (int) class30_sub2_sub4_sub4.aDouble1587, -1,
  3986.                         (int) class30_sub2_sub4_sub4.aDouble1586, 60,
  3987.                         (int) class30_sub2_sub4_sub4.aDouble1585,
  3988.                         class30_sub2_sub4_sub4, false);
  3989.             }
  3990.  
  3991.     }
  3992.  
  3993.     @Override
  3994.     public AppletContext getAppletContext() {
  3995.         if (signlink.mainapp != null)
  3996.             return signlink.mainapp.getAppletContext();
  3997.         else
  3998.             return super.getAppletContext();
  3999.     }
  4000.  
  4001.     public static String capitalize(String s) {
  4002.         for (int i = 0; i < s.length(); i++) {
  4003.             if (i == 0) {
  4004.                 s = String.format("%s%s", Character.toUpperCase(s.charAt(0)),
  4005.                         s.substring(1));
  4006.             }
  4007.             if (!Character.isLetterOrDigit(s.charAt(i))) {
  4008.                 if (i + 1 < s.length()) {
  4009.                     s = String.format("%s%s%s", s.subSequence(0, i + 1),
  4010.                             Character.toUpperCase(s.charAt(i + 1)),
  4011.                             s.substring(i + 2));
  4012.                 }
  4013.             }
  4014.         }
  4015.         return s;
  4016.     }
  4017.  
  4018.     private void drawLogo() {
  4019.         byte abyte0[] = titleStreamLoader.getDataForName("title.dat");
  4020.         Sprite sprite = new Sprite(abyte0, this);
  4021.         aRSImageProducer_1110.initDrawingArea();
  4022.         sprite.method346(0, 0);
  4023.         aRSImageProducer_1111.initDrawingArea();
  4024.         sprite.method346(-637, 0);
  4025.         aRSImageProducer_1107.initDrawingArea();
  4026.         sprite.method346(-128, 0);
  4027.         aRSImageProducer_1108.initDrawingArea();
  4028.         sprite.method346(-202, -371);
  4029.         aRSImageProducer_1109.initDrawingArea();
  4030.         sprite.method346(-202, -171);
  4031.         aRSImageProducer_1112.initDrawingArea();
  4032.         sprite.method346(0, -265);
  4033.         aRSImageProducer_1113.initDrawingArea();
  4034.         sprite.method346(-562, -265);
  4035.         aRSImageProducer_1114.initDrawingArea();
  4036.         sprite.method346(-128, -171);
  4037.         aRSImageProducer_1115.initDrawingArea();
  4038.         sprite.method346(-562, -171);
  4039.         int ai[] = new int[sprite.myWidth];
  4040.         for (int j = 0; j < sprite.myHeight; j++) {
  4041.             for (int k = 0; k < sprite.myWidth; k++)
  4042.                 ai[k] = sprite.myPixels[(sprite.myWidth - k - 1)
  4043.                         + sprite.myWidth * j];
  4044.  
  4045.             System.arraycopy(ai, 0, sprite.myPixels, sprite.myWidth * j,
  4046.                     sprite.myWidth);
  4047.         }
  4048.         aRSImageProducer_1110.initDrawingArea();
  4049.         sprite.method346(382, 0);
  4050.         aRSImageProducer_1111.initDrawingArea();
  4051.         sprite.method346(-255, 0);
  4052.         aRSImageProducer_1107.initDrawingArea();
  4053.         sprite.method346(254, 0);
  4054.         aRSImageProducer_1108.initDrawingArea();
  4055.         sprite.method346(180, -371);
  4056.         aRSImageProducer_1109.initDrawingArea();
  4057.         sprite.method346(180, -171);
  4058.         aRSImageProducer_1112.initDrawingArea();
  4059.         sprite.method346(382, -265);
  4060.         aRSImageProducer_1113.initDrawingArea();
  4061.         sprite.method346(-180, -265);
  4062.         aRSImageProducer_1114.initDrawingArea();
  4063.         sprite.method346(254, -171);
  4064.         aRSImageProducer_1115.initDrawingArea();
  4065.         sprite.method346(-180, -171);
  4066.         sprite = new Sprite(titleStreamLoader, "logo", 0);
  4067.         aRSImageProducer_1107.initDrawingArea();
  4068.         sprite.drawSprite(382 - sprite.myWidth / 2 - 128, 18);
  4069.         sprite = null;
  4070.         System.gc();
  4071.     }
  4072.  
  4073.     private void processOnDemandQueue() {
  4074.         do {
  4075.             OnDemandData onDemandData;
  4076.             do {
  4077.                 onDemandData = onDemandFetcher.getNextNode();
  4078.                 if (onDemandData == null)
  4079.                     return;
  4080.                 if (onDemandData.dataType == 0) {
  4081.                     Model.method460(onDemandData.buffer, onDemandData.ID);
  4082.                     needDrawTabArea = true;
  4083.                     if (backDialogID != -1)
  4084.                         inputTaken = true;
  4085.                 }
  4086.                 if (onDemandData.dataType == 1 && onDemandData.buffer != null) {
  4087.                     try {
  4088.                     Class36.load(onDemandData.buffer, onDemandData.ID);
  4089.                     } catch (Exception e) {
  4090.                         e.printStackTrace();
  4091.                     }
  4092.                 }
  4093.                 if (onDemandData.dataType == 2 && onDemandData.ID == nextSong
  4094.                         && onDemandData.buffer != null)
  4095.                     saveMidi(songChanging, onDemandData.buffer);
  4096.                 if (onDemandData.dataType == 3 && loadingStage == 1) {
  4097.                     for (int i = 0; i < aByteArrayArray1183.length; i++) {
  4098.                         if (anIntArray1235[i] == onDemandData.ID) {
  4099.                             System.out.println("Floor Map Loaded: "
  4100.                                     + anIntArray1235[i]);
  4101.                             // aByteArrayArray1183[i] =
  4102.                             // FileOperations.readFile("maps/floors/" +
  4103.                             // anIntArray1235[i]);
  4104.                             if (aByteArrayArray1183[i] == null)
  4105.                                 aByteArrayArray1183[i] = onDemandData.buffer;
  4106.                             if (onDemandData.buffer == null)
  4107.                                 anIntArray1235[i] = -1;
  4108.                             break;
  4109.                         }
  4110.                         if (anIntArray1236[i] != onDemandData.ID)
  4111.                             continue;
  4112.                         System.out.println("Object Map Loaded: "
  4113.                                 + anIntArray1236[i]);
  4114.                         // aByteArrayArray1247[i] =
  4115.                         // FileOperations.readFile("maps/objects/" +
  4116.                         // anIntArray1236[i]);
  4117.                         if (aByteArrayArray1247[i] == null)
  4118.                             aByteArrayArray1247[i] = onDemandData.buffer;
  4119.                         if (onDemandData.buffer == null)
  4120.                             anIntArray1236[i] = -1;
  4121.                         break;
  4122.                     }
  4123.  
  4124.                 }
  4125.             } while (onDemandData.dataType != 93
  4126.                     || !onDemandFetcher.method564(onDemandData.ID));
  4127.             ObjectManager.method173(new Stream(onDemandData.buffer),
  4128.                     onDemandFetcher);
  4129.         } while (true);
  4130.     }
  4131.  
  4132.     public void calcFlamesPosition() {
  4133.         char c = '\u0100';
  4134.         for (int j = 10; j < 117; j++) {
  4135.             int k = (int) (Math.random() * 100D);
  4136.             if (k < 50)
  4137.                 anIntArray828[j + (c - 2 << 7)] = 255;
  4138.         }
  4139.         for (int l = 0; l < 100; l++) {
  4140.             int i1 = (int) (Math.random() * 124D) + 2;
  4141.             int k1 = (int) (Math.random() * 128D) + 128;
  4142.             int k2 = i1 + (k1 << 7);
  4143.             anIntArray828[k2] = 192;
  4144.         }
  4145.  
  4146.         for (int j1 = 1; j1 < c - 1; j1++) {
  4147.             for (int l1 = 1; l1 < 127; l1++) {
  4148.                 int l2 = l1 + (j1 << 7);
  4149.                 anIntArray829[l2] = (anIntArray828[l2 - 1]
  4150.                         + anIntArray828[l2 + 1] + anIntArray828[l2 - 128] + anIntArray828[l2 + 128]) / 4;
  4151.             }
  4152.  
  4153.         }
  4154.  
  4155.         anInt1275 += 128;
  4156.         if (anInt1275 > anIntArray1190.length) {
  4157.             anInt1275 -= anIntArray1190.length;
  4158.             int i2 = (int) (Math.random() * 12D);
  4159.             randomizeBackground(aBackgroundArray1152s[i2]);
  4160.         }
  4161.         for (int j2 = 1; j2 < c - 1; j2++) {
  4162.             for (int i3 = 1; i3 < 127; i3++) {
  4163.                 int k3 = i3 + (j2 << 7);
  4164.                 int i4 = anIntArray829[k3 + 128]
  4165.                         - anIntArray1190[k3 + anInt1275 & anIntArray1190.length
  4166.                                 - 1] / 5;
  4167.                 if (i4 < 0)
  4168.                     i4 = 0;
  4169.                 anIntArray828[k3] = i4;
  4170.             }
  4171.  
  4172.         }
  4173.  
  4174.         System.arraycopy(anIntArray969, 1, anIntArray969, 0, c - 1);
  4175.  
  4176.         anIntArray969[c - 1] = (int) (Math.sin(loopCycle / 14D) * 16D
  4177.                 + Math.sin(loopCycle / 15D) * 14D + Math
  4178.                 .sin(loopCycle / 16D) * 12D);
  4179.         if (anInt1040 > 0)
  4180.             anInt1040 -= 4;
  4181.         if (anInt1041 > 0)
  4182.             anInt1041 -= 4;
  4183.         if (anInt1040 == 0 && anInt1041 == 0) {
  4184.             int l3 = (int) (Math.random() * 2000D);
  4185.             if (l3 == 0)
  4186.                 anInt1040 = 1024;
  4187.             if (l3 == 1)
  4188.                 anInt1041 = 1024;
  4189.         }
  4190.     }
  4191.  
  4192.     private boolean saveWave(byte abyte0[], int i) {
  4193.         return abyte0 == null || signlink.wavesave(abyte0, i);
  4194.     }
  4195.  
  4196.     public void method60(int i) {
  4197.         RSInterface class9 = RSInterface.interfaceCache[i];
  4198.         for (int j = 0; j < class9.children.length; j++) {
  4199.             if (class9.children[j] == -1)
  4200.                 break;
  4201.             RSInterface class9_1 = RSInterface.interfaceCache[class9.children[j]];
  4202.             if (class9_1.type == 1)
  4203.                 method60(class9_1.id);
  4204.             class9_1.anInt246 = 0;
  4205.             class9_1.anInt208 = 0;
  4206.         }
  4207.     }
  4208.  
  4209.     public void drawHeadIcon() {
  4210.         if (anInt855 != 2)
  4211.             return;
  4212.         calcEntityScreenPos((anInt934 - baseX << 7) + anInt937, anInt936 * 2,
  4213.                 (anInt935 - baseY << 7) + anInt938);
  4214.         if (spriteDrawX > -1 && loopCycle % 20 < 10)
  4215.             headIconsHint[0].drawSprite(spriteDrawX - 12, spriteDrawY - 28);
  4216.     }
  4217.  
  4218.     private void mainGameProcessor() {
  4219.         refreshFrameSize();
  4220.         if (anInt1104 > 1)
  4221.             anInt1104--;
  4222.         if (anInt1011 > 0)
  4223.             anInt1011--;
  4224.         for (int j = 0; j < 5; j++)
  4225.             if (!parsePacket())
  4226.                 break;
  4227.  
  4228.         if (!loggedIn)
  4229.             return;
  4230.         synchronized (mouseDetection.syncObject) {
  4231.             if (flagged) {
  4232.                 if (super.clickMode3 != 0 || mouseDetection.coordsIndex >= 40) {
  4233.                     stream.createFrame(45);
  4234.                     stream.writeWordBigEndian(0);
  4235.                     int j2 = stream.currentOffset;
  4236.                     int j3 = 0;
  4237.                     for (int j4 = 0; j4 < mouseDetection.coordsIndex; j4++) {
  4238.                         if (j2 - stream.currentOffset >= 240)
  4239.                             break;
  4240.                         j3++;
  4241.                         int l4 = mouseDetection.coordsY[j4];
  4242.                         if (l4 < 0)
  4243.                             l4 = 0;
  4244.                         else if (l4 > 502)
  4245.                             l4 = 502;
  4246.                         int k5 = mouseDetection.coordsX[j4];
  4247.                         if (k5 < 0)
  4248.                             k5 = 0;
  4249.                         else if (k5 > 764)
  4250.                             k5 = 764;
  4251.                         int i6 = l4 * 765 + k5;
  4252.                         if (mouseDetection.coordsY[j4] == -1 && mouseDetection.coordsX[j4] == -1) {
  4253.                             k5 = -1;
  4254.                             l4 = -1;
  4255.                             i6 = 0x7ffff;
  4256.                         }
  4257.                         if (k5 == anInt1237 && l4 == anInt1238) {
  4258.                             if (anInt1022 < 2047)
  4259.                                 anInt1022++;
  4260.                         } else {
  4261.                             int j6 = k5 - anInt1237;
  4262.                             anInt1237 = k5;
  4263.                             int k6 = l4 - anInt1238;
  4264.                             anInt1238 = l4;
  4265.                             if (anInt1022 < 8 && j6 >= -32 && j6 <= 31 && k6 >= -32 && k6 <= 31) {
  4266.                                 j6 += 32;
  4267.                                 k6 += 32;
  4268.                                 stream.writeWord((anInt1022 << 12) + (j6 << 6) + k6);
  4269.                                 anInt1022 = 0;
  4270.                             } else if (anInt1022 < 8) {
  4271.                                 stream.writeDWordBigEndian(0x800000 + (anInt1022 << 19) + i6);
  4272.                                 anInt1022 = 0;
  4273.                             } else {
  4274.                                 stream.writeDWord(0xc0000000 + (anInt1022 << 19) + i6);
  4275.                                 anInt1022 = 0;
  4276.                             }
  4277.                         }
  4278.                     }
  4279.  
  4280.                     stream.writeBytes(stream.currentOffset - j2);
  4281.                     if (j3 >= mouseDetection.coordsIndex) {
  4282.                         mouseDetection.coordsIndex = 0;
  4283.                     } else {
  4284.                         mouseDetection.coordsIndex -= j3;
  4285.                         for (int i5 = 0; i5 < mouseDetection.coordsIndex; i5++) {
  4286.                             mouseDetection.coordsX[i5] = mouseDetection.coordsX[i5 + j3];
  4287.                             mouseDetection.coordsY[i5] = mouseDetection.coordsY[i5 + j3];
  4288.                         }
  4289.  
  4290.                     }
  4291.                 }
  4292.             } else {
  4293.                 mouseDetection.coordsIndex = 0;
  4294.             }
  4295.         }
  4296.         if (super.clickMode3 != 0) {
  4297.             long l = (super.aLong29 - aLong1220) / 50L;
  4298.             if (l > 4095L)
  4299.                 l = 4095L;
  4300.             aLong1220 = super.aLong29;
  4301.             int k2 = super.saveClickY;
  4302.             if (k2 < 0)
  4303.                 k2 = 0;
  4304.             else if (k2 > 502)
  4305.                 k2 = 502;
  4306.             int k3 = super.saveClickX;
  4307.             if (k3 < 0)
  4308.                 k3 = 0;
  4309.             else if (k3 > 764)
  4310.                 k3 = 764;
  4311.             int k4 = k2 * 765 + k3;
  4312.             int j5 = 0;
  4313.             if (super.clickMode3 == 2)
  4314.                 j5 = 1;
  4315.             int l5 = (int) l;
  4316.             stream.createFrame(241);
  4317.             stream.writeDWord((l5 << 20) + (j5 << 19) + k4);
  4318.         }
  4319.         if (anInt1016 > 0)
  4320.             anInt1016--;
  4321.         if (super.keyArray[1] == 1 || super.keyArray[2] == 1 || super.keyArray[3] == 1 || super.keyArray[4] == 1)
  4322.             aBoolean1017 = true;
  4323.         if (aBoolean1017 && anInt1016 <= 0) {
  4324.             anInt1016 = 20;
  4325.             aBoolean1017 = false;
  4326.             stream.createFrame(86);
  4327.             stream.writeWord(anInt1184);
  4328.             stream.method432(viewRotation);
  4329.         }
  4330.         if (super.awtFocus && !aBoolean954) {
  4331.             aBoolean954 = true;
  4332.             stream.createFrame(3);
  4333.             stream.writeWordBigEndian(1);
  4334.         }
  4335.         if (!super.awtFocus && aBoolean954) {
  4336.             aBoolean954 = false;
  4337.             stream.createFrame(3);
  4338.             stream.writeWordBigEndian(0);
  4339.         }
  4340.         loadingStages();
  4341.         method115();
  4342.         anInt1009++;
  4343.         if (anInt1009 > 750)
  4344.             dropClient();
  4345.         method114();
  4346.         method95();
  4347.         method38();
  4348.         anInt945++;
  4349.         if (crossType != 0) {
  4350.             crossIndex += 20;
  4351.             if (crossIndex >= 400)
  4352.                 crossType = 0;
  4353.         }
  4354.         if (atInventoryInterfaceType != 0) {
  4355.             atInventoryLoopCycle++;
  4356.             if (atInventoryLoopCycle >= 15) {
  4357.                 if (atInventoryInterfaceType == 2) {
  4358.                 }
  4359.                 if (atInventoryInterfaceType == 3)
  4360.                     inputTaken = true;
  4361.                 atInventoryInterfaceType = 0;
  4362.             }
  4363.         }
  4364.         if (activeInterfaceType != 0) {
  4365.             anInt989++;
  4366.             if (super.mouseX > anInt1087 + 5 || super.mouseX < anInt1087 - 5 || super.mouseY > anInt1088 + 5 || super.mouseY < anInt1088 - 5)
  4367.                 aBoolean1242 = true;
  4368.             if (super.clickMode2 == 0) {
  4369.                 if (activeInterfaceType == 2) {
  4370.                 }
  4371.                 if (activeInterfaceType == 3)
  4372.                     inputTaken = true;
  4373.                 activeInterfaceType = 0;
  4374.                 if (aBoolean1242 && anInt989 >= 15) {
  4375.                     lastActiveInvInterface = -1;
  4376.                     processRightClick();
  4377.                     if (anInt1084 == 5382 && super.mouseY >= 43
  4378.                             && super.mouseY <= 79) { // check if bank interface
  4379.                         if (super.mouseX >= 62 && super.mouseX <= 100) { // tab
  4380.                                                                             // 1
  4381.                             stream.createFrame(214);
  4382.                             stream.method433(5); // 5 = maintab
  4383.                             stream.method424(0);
  4384.                             stream.method433(anInt1085); // Selected item slot
  4385.                             stream.method431(mouseInvInterfaceIndex); // unused
  4386.  
  4387.                         }
  4388.                         if (super.mouseX >= 102 && super.mouseX <= 142) { // tab
  4389.                                                                             // 1
  4390.                             stream.createFrame(214);
  4391.                             stream.method433(13); // tab # x 13 (originally
  4392.                             // movewindow)
  4393.                             stream.method424(0);
  4394.                             stream.method433(anInt1085); // Selected item slot
  4395.                             stream.method431(mouseInvInterfaceIndex); // unused
  4396.  
  4397.                         }
  4398.                         if (super.mouseX >= 143 && super.mouseX <= 179) { // tab
  4399.                                                                             // 2
  4400.                             stream.createFrame(214);
  4401.                             stream.method433(26); // tab # x 13 (originally
  4402.                             // movewindow)
  4403.                             stream.method424(0);
  4404.                             stream.method433(anInt1085); // Selected item slot
  4405.                             stream.method431(mouseInvInterfaceIndex); // unused
  4406.  
  4407.                         }
  4408.                         if (super.mouseX >= 182 && super.mouseX <= 218) { // tab
  4409.                                                                             // //come
  4410.                                                                             // back
  4411.                                                                             // 3
  4412.                             stream.createFrame(214);
  4413.                             stream.method433(39); // tab # x 13 (originally
  4414.                             // movewindow)
  4415.                             stream.method424(0);
  4416.                             stream.method433(anInt1085); // Selected item slot
  4417.                             stream.method431(mouseInvInterfaceIndex); // unused
  4418.  
  4419.                         }
  4420.                         if (super.mouseX >= 225 && super.mouseX <= 258) { // tab
  4421.                                                                             // 4
  4422.                             stream.createFrame(214);
  4423.                             stream.method433(52); // tab # x 13 (originally
  4424.                             // movewindow)..dude let me work. u messed that on
  4425.                             // how? u were
  4426.                             // hovering over tab 5 instead of 4
  4427.                             stream.method424(0);
  4428.                             stream.method433(anInt1085); // Selected item slot
  4429.                             stream.method431(mouseInvInterfaceIndex); // unused
  4430.  
  4431.                         }
  4432.                         if (super.mouseX >= 263 && super.mouseX <= 299) { // tab
  4433.                                                                             // 5
  4434.                             stream.createFrame(214);
  4435.                             stream.method433(65); // tab # x 13 (originally
  4436.                             // movewindow)
  4437.                             stream.method424(0);
  4438.                             stream.method433(anInt1085); // Selected item slot
  4439.                             stream.method431(mouseInvInterfaceIndex); // unused
  4440.  
  4441.                         }
  4442.                         if (super.mouseX >= 303 && super.mouseX <= 337) { // tab
  4443.                                                                             // 6
  4444.                             stream.createFrame(214);
  4445.                             stream.method433(78); // tab # x 13 (originally
  4446.                             // movewindow)
  4447.                             stream.method424(0);
  4448.                             stream.method433(anInt1085); // Selected item slot
  4449.                             stream.method431(mouseInvInterfaceIndex); // unused
  4450.  
  4451.                         }
  4452.                         if (super.mouseX >= 343 && super.mouseX <= 378) { // tab
  4453.                                                                             // 7
  4454.                             stream.createFrame(214);
  4455.                             stream.method433(91); // tab # x 13 (originally
  4456.                             // movewindow)
  4457.                             stream.method424(0);
  4458.                             stream.method433(anInt1085); // Selected item slot
  4459.                             stream.method431(mouseInvInterfaceIndex); // unused
  4460.  
  4461.                         }
  4462.                         if (super.mouseX >= 383 && super.mouseX <= 418) { // tab
  4463.                                                                             // 8
  4464.                             stream.createFrame(214);
  4465.                             stream.method433(104); // tab # x 13 (originally
  4466.                             // movewindow)
  4467.                             stream.method424(0);
  4468.                             stream.method433(anInt1085); // Selected item slot
  4469.                             stream.method431(mouseInvInterfaceIndex); // unused
  4470.  
  4471.                         }
  4472.                     }
  4473.                     if (lastActiveInvInterface == anInt1084 && mouseInvInterfaceIndex != anInt1085) {
  4474.                         RSInterface class9 = RSInterface.interfaceCache[anInt1084];
  4475.                         int j1 = 0;
  4476.                         if (anInt913 == 1 && class9.contentType == 206)
  4477.                             j1 = 1;
  4478.                         if (class9.inv[mouseInvInterfaceIndex] <= 0)
  4479.                             j1 = 0;
  4480.                         if (class9.aBoolean235) {
  4481.                             int l2 = anInt1085;
  4482.                             int l3 = mouseInvInterfaceIndex;
  4483.                             class9.inv[l3] = class9.inv[l2];
  4484.                             class9.invStackSizes[l3] = class9.invStackSizes[l2];
  4485.                             class9.inv[l2] = -1;
  4486.                             class9.invStackSizes[l2] = 0;
  4487.                         } else if (j1 == 1) {
  4488.                             int i3 = anInt1085;
  4489.                             for (int i4 = mouseInvInterfaceIndex; i3 != i4;)
  4490.                                 if (i3 > i4) {
  4491.                                     class9.swapInventoryItems(i3, i3 - 1);
  4492.                                     i3--;
  4493.                                 } else if (i3 < i4) {
  4494.                                     class9.swapInventoryItems(i3, i3 + 1);
  4495.                                     i3++;
  4496.                                 }
  4497.  
  4498.                         } else {
  4499.                             class9.swapInventoryItems(anInt1085, mouseInvInterfaceIndex);
  4500.                         }
  4501.                         stream.createFrame(214);
  4502.                         stream.method433(anInt1084);
  4503.                         stream.method424(j1);
  4504.                         stream.method433(anInt1085);
  4505.                         stream.method431(mouseInvInterfaceIndex);
  4506.                     }
  4507.                 } else if ((anInt1253 == 1 || menuHasAddFriend(menuActionRow - 1)) && menuActionRow > 2)
  4508.                     determineMenuSize();
  4509.                 else if (menuActionRow > 0)
  4510.                     doAction(menuActionRow - 1);
  4511.                 atInventoryLoopCycle = 10;
  4512.                 super.clickMode3 = 0;
  4513.             }
  4514.         }
  4515.         if (WorldController.anInt470 != -1) {
  4516.             int k = WorldController.anInt470;
  4517.             int k1 = WorldController.anInt471;
  4518.             boolean flag = doWalkTo(0, 0, 0, 0, myPlayer.smallY[0], 0, 0, k1, myPlayer.smallX[0], true, k);
  4519.             WorldController.anInt470 = -1;
  4520.             if (flag) {
  4521.                 crossX = super.saveClickX;
  4522.                 crossY = super.saveClickY;
  4523.                 crossType = 1;
  4524.                 crossIndex = 0;
  4525.             }
  4526.         }
  4527.         if (super.clickMode3 == 1 && aString844 != null) {
  4528.             aString844 = null;
  4529.             inputTaken = true;
  4530.             super.clickMode3 = 0;
  4531.         }
  4532.         processMenuClick();
  4533.         if (super.clickMode2 == 1 || super.clickMode3 == 1)
  4534.             anInt1213++;
  4535.         if (anInt1500 != 0 || anInt1044 != 0 || anInt1129 != 0) {
  4536.             if (anInt1501 < 0 && !menuOpen) {
  4537.                 anInt1501++;
  4538.                 if (anInt1501 == 0) {
  4539.                     if (anInt1500 != 0) {
  4540.                         inputTaken = true;
  4541.                     }
  4542.                     if (anInt1044 != 0) {
  4543.                     }
  4544.                 }
  4545.             }
  4546.         } else if (anInt1501 > 0) {
  4547.             anInt1501--;
  4548.         }
  4549.         if (loadingStage == 2)
  4550.             method108();
  4551.         if (loadingStage == 2 && aBoolean1160)
  4552.             calcCameraPos();
  4553.         for (int i1 = 0; i1 < 5; i1++)
  4554.             anIntArray1030[i1]++;
  4555.  
  4556.         method73();
  4557.         super.idleTime++;
  4558.         if (super.idleTime > 4500) {
  4559.             anInt1011 = 250;
  4560.             super.idleTime -= 500;
  4561.             stream.createFrame(202);
  4562.         }
  4563.         anInt1010++;
  4564.         if (anInt1010 > 50)
  4565.             stream.createFrame(0);
  4566.         try {
  4567.             if (socketStream != null && stream.currentOffset > 0) {
  4568.                 socketStream.queueBytes(stream.currentOffset, stream.buffer);
  4569.                 stream.currentOffset = 0;
  4570.                 anInt1010 = 0;
  4571.             }
  4572.         } catch (IOException _ex) {
  4573.             dropClient();
  4574.         } catch (Exception exception) {
  4575.             resetLogout();
  4576.         }
  4577.     }
  4578.  
  4579.     public void method63() {
  4580.         Class30_Sub1 class30_sub1 = (Class30_Sub1) aClass19_1179
  4581.                 .reverseGetFirst();
  4582.         for (; class30_sub1 != null; class30_sub1 = (Class30_Sub1) aClass19_1179
  4583.                 .reverseGetNext())
  4584.             if (class30_sub1.anInt1294 == -1) {
  4585.                 class30_sub1.anInt1302 = 0;
  4586.                 method89(class30_sub1);
  4587.             } else {
  4588.                 class30_sub1.unlink();
  4589.             }
  4590.  
  4591.     }
  4592.  
  4593.     private void resetImageProducers() {
  4594.         if (aRSImageProducer_1107 != null)
  4595.             return;
  4596.         super.fullGameScreen = null;
  4597.         aRSImageProducer_1166 = null;
  4598.         aRSImageProducer_1164 = null;
  4599.         aRSImageProducer_1163 = null;
  4600.         aRSImageProducer_1165 = null;
  4601.         aRSImageProducer_1125 = null;
  4602.         aRSImageProducer_1110 = new ImageProducer(128, 265);
  4603.         DrawingArea.setAllPixelsToZero();
  4604.         aRSImageProducer_1111 = new ImageProducer(128, 265);
  4605.         DrawingArea.setAllPixelsToZero();
  4606.         aRSImageProducer_1107 = new ImageProducer(509, 171);
  4607.         DrawingArea.setAllPixelsToZero();
  4608.         aRSImageProducer_1108 = new ImageProducer(360, 132);
  4609.         DrawingArea.setAllPixelsToZero();
  4610.         aRSImageProducer_1109 = new ImageProducer(360, 200);
  4611.         DrawingArea.setAllPixelsToZero();
  4612.         aRSImageProducer_1112 = new ImageProducer(202, 238);
  4613.         DrawingArea.setAllPixelsToZero();
  4614.         aRSImageProducer_1113 = new ImageProducer(203, 238);
  4615.         DrawingArea.setAllPixelsToZero();
  4616.         aRSImageProducer_1114 = new ImageProducer(74, 94);
  4617.         DrawingArea.setAllPixelsToZero();
  4618.         aRSImageProducer_1115 = new ImageProducer(75, 94);
  4619.         DrawingArea.setAllPixelsToZero();
  4620.         if (titleStreamLoader != null) {
  4621.             drawLogo();
  4622.             loadTitleScreen();
  4623.         }
  4624.         welcomeScreenRaised = true;
  4625.     }
  4626.  
  4627.     public int rememberMe = 0;
  4628.     public int loginButtonint;
  4629.     public int rememberMehover;
  4630.     public int textbox;
  4631.     public int textbox1;
  4632.  
  4633.     @Override
  4634.     void drawLoadingText(int i, String s) {
  4635.         anInt1079 = i;
  4636.         aString1049 = s;
  4637.         resetImageProducers();
  4638.         if (titleStreamLoader == null) {
  4639.             super.drawLoadingText(i, s);
  4640.             return;
  4641.         }
  4642.         aRSImageProducer_1109.initDrawingArea();
  4643.         char c = '\u0168';
  4644.         char c1 = '\310';
  4645.         byte byte1 = 20;
  4646.         chatTextDrawingArea.drawText(0xffffff,
  4647.                 "RatedPixels is loading - please wait...", c1 / 2 - 26 - byte1,
  4648.                 c / 2);
  4649.         int j = c1 / 2 - 18 - byte1;
  4650.         DrawingArea.fillPixels(c / 2 - 152, 304, 34, 0xa13900, j);
  4651.         DrawingArea.fillPixels(c / 2 - 151, 302, 32, 0, j + 1);
  4652.         DrawingArea.drawPixels(30, j + 2, c / 2 - 150, 0xbf2200, i * 3);
  4653.         DrawingArea
  4654.                 .drawPixels(30, j + 2, (c / 2 - 150) + i * 3, 0, 300 - i * 3);
  4655.         chatTextDrawingArea.drawText(0xffffff, s, (c1 / 2 + 5) - byte1, c / 2);
  4656.         aRSImageProducer_1109.drawGraphics(171, super.graphics, 202);
  4657.         if (welcomeScreenRaised) {
  4658.             welcomeScreenRaised = false;
  4659.             if (!aBoolean831) {
  4660.                 aRSImageProducer_1110.drawGraphics(0, super.graphics, 0);
  4661.                 aRSImageProducer_1111.drawGraphics(0, super.graphics, 637);
  4662.             }
  4663.             aRSImageProducer_1107.drawGraphics(0, super.graphics, 128);
  4664.             aRSImageProducer_1108.drawGraphics(371, super.graphics, 202);
  4665.             aRSImageProducer_1112.drawGraphics(265, super.graphics, 0);
  4666.             aRSImageProducer_1113.drawGraphics(265, super.graphics, 562);
  4667.             aRSImageProducer_1114.drawGraphics(171, super.graphics, 128);
  4668.             aRSImageProducer_1115.drawGraphics(171, super.graphics, 562);
  4669.         }
  4670.     }
  4671.  
  4672.     public void method65(int i, int j, int k, int l, RSInterface class9,
  4673.             int i1, boolean flag, int j1) {
  4674.         int anInt992;
  4675.         if (aBoolean972)
  4676.             anInt992 = 32;
  4677.         else
  4678.             anInt992 = 0;
  4679.         aBoolean972 = false;
  4680.         if (k >= i && k < i + 16 && l >= i1 && l < i1 + 16) {
  4681.             class9.scrollPosition -= anInt1213 * 4;
  4682.             if (flag) {
  4683.                 needDrawTabArea = true;
  4684.             }
  4685.         } else if (k >= i && k < i + 16 && l >= (i1 + j) - 16 && l < i1 + j) {
  4686.             class9.scrollPosition += anInt1213 * 4;
  4687.             if (flag) {
  4688.                 needDrawTabArea = true;
  4689.             }
  4690.         } else if (k >= i - anInt992 && k < i + 16 + anInt992 && l >= i1 + 16
  4691.                 && l < (i1 + j) - 16 && anInt1213 > 0) {
  4692.             int l1 = ((j - 32) * j) / j1;
  4693.             if (l1 < 8)
  4694.                 l1 = 8;
  4695.             int i2 = l - i1 - 16 - l1 / 2;
  4696.             int j2 = j - 32 - l1;
  4697.             class9.scrollPosition = ((j1 - j) * i2) / j2;
  4698.             if (flag)
  4699.                 needDrawTabArea = true;
  4700.             aBoolean972 = true;
  4701.         }
  4702.     }
  4703.  
  4704.     private boolean method66(int i, int j, int k) {
  4705.         int i1 = i >> 14 & 0x7fff;
  4706.         int j1 = worldController.method304(plane, k, j, i);
  4707.         if (j1 == -1)
  4708.             return false;
  4709.         int k1 = j1 & 0x1f;
  4710.         int l1 = j1 >> 6 & 3;
  4711.         if (k1 == 10 || k1 == 11 || k1 == 22) {
  4712.             ObjectDef class46 = ObjectDef.forID(i1);
  4713.             int i2;
  4714.             int j2;
  4715.             if (l1 == 0 || l1 == 2) {
  4716.                 i2 = class46.anInt744;
  4717.                 j2 = class46.anInt761;
  4718.             } else {
  4719.                 i2 = class46.anInt761;
  4720.                 j2 = class46.anInt744;
  4721.             }
  4722.             int k2 = class46.anInt768;
  4723.             if (l1 != 0)
  4724.                 k2 = (k2 << l1 & 0xf) + (k2 >> 4 - l1);
  4725.             doWalkTo(2, 0, j2, 0, myPlayer.smallY[0], i2, k2, j,
  4726.                     myPlayer.smallX[0], false, k);
  4727.         } else {
  4728.             doWalkTo(2, l1, 0, k1 + 1, myPlayer.smallY[0], 0, 0, j,
  4729.                     myPlayer.smallX[0], false, k);
  4730.         }
  4731.         crossX = super.saveClickX;
  4732.         crossY = super.saveClickY;
  4733.         crossType = 2;
  4734.         crossIndex = 0;
  4735.         return true;
  4736.     }
  4737.  
  4738.     private StreamLoader streamLoaderForName(int i, String s, String s1, int j,
  4739.             int k) {
  4740.         byte abyte0[] = null;
  4741.         int l = 5;
  4742.         try {
  4743.             if (decompressors[0] != null)
  4744.                 abyte0 = decompressors[0].decompress(i);
  4745.         } catch (Exception _ex) {
  4746.         }
  4747.         if (abyte0 != null) {
  4748.             // aCRC32_930.reset();
  4749.             // aCRC32_930.update(abyte0);
  4750.             // int i1 = (int)aCRC32_930.getValue();
  4751.             // if(i1 != j)
  4752.         }
  4753.         if (abyte0 != null) {
  4754.             StreamLoader streamLoader = new StreamLoader(abyte0, s);
  4755.             return streamLoader;
  4756.         }
  4757.         int j1 = 0;
  4758.         while (abyte0 == null) {
  4759.             String s2 = "Unknown error";
  4760.             drawLoadingText(k, "Requesting " + s);
  4761.             try {
  4762.                 int k1 = 0;
  4763.                 DataInputStream datainputstream = openJagGrabInputStream(s1 + j);
  4764.                 byte abyte1[] = new byte[6];
  4765.                 datainputstream.readFully(abyte1, 0, 6);
  4766.                 Stream stream = new Stream(abyte1);
  4767.                 stream.currentOffset = 3;
  4768.                 int i2 = stream.read3Bytes() + 6;
  4769.                 int j2 = 6;
  4770.                 abyte0 = new byte[i2];
  4771.                 System.arraycopy(abyte1, 0, abyte0, 0, 6);
  4772.  
  4773.                 while (j2 < i2) {
  4774.                     int l2 = i2 - j2;
  4775.                     if (l2 > 1000)
  4776.                         l2 = 1000;
  4777.                     int j3 = datainputstream.read(abyte0, j2, l2);
  4778.                     if (j3 < 0) {
  4779.                         s2 = "Length error: " + j2 + "/" + i2;
  4780.                         throw new IOException("EOF");
  4781.                     }
  4782.                     j2 += j3;
  4783.                     int k3 = (j2 * 100) / i2;
  4784.                     if (k3 != k1)
  4785.                         drawLoadingText(k, "Loading " + s + " - " + k3 + "%");
  4786.                     k1 = k3;
  4787.                 }
  4788.                 datainputstream.close();
  4789.                 try {
  4790.                     if (decompressors[0] != null)
  4791.                         decompressors[0].method234(abyte0.length, abyte0, i);
  4792.                 } catch (Exception _ex) {
  4793.                     decompressors[0] = null;
  4794.                 }
  4795.                 /*
  4796.                  * if(abyte0 != null) { aCRC32_930.reset();
  4797.                  * aCRC32_930.update(abyte0); int i3 =
  4798.                  * (int)aCRC32_930.getValue(); if(i3 != j) { abyte0 = null;
  4799.                  * j1++; s2 = "Checksum error: " + i3; } }
  4800.                  */
  4801.             } catch (IOException ioexception) {
  4802.                 if (s2.equals("Unknown error"))
  4803.                     s2 = "Connection error";
  4804.                 abyte0 = null;
  4805.             } catch (NullPointerException _ex) {
  4806.                 s2 = "Null error";
  4807.                 abyte0 = null;
  4808.                 if (!signlink.reporterror)
  4809.                     return null;
  4810.             } catch (ArrayIndexOutOfBoundsException _ex) {
  4811.                 s2 = "Bounds error";
  4812.                 abyte0 = null;
  4813.                 if (!signlink.reporterror)
  4814.                     return null;
  4815.             } catch (Exception _ex) {
  4816.                 s2 = "Unexpected error";
  4817.                 abyte0 = null;
  4818.                 if (!signlink.reporterror)
  4819.                     return null;
  4820.             }
  4821.             if (abyte0 == null) {
  4822.                 for (int l1 = l; l1 > 0; l1--) {
  4823.                     if (j1 >= 3) {
  4824.                         drawLoadingText(k, "Game updated - please reload page");
  4825.                         l1 = 10;
  4826.                     } else {
  4827.                         drawLoadingText(k, s2 + " - Retrying in " + l1);
  4828.                     }
  4829.                     try {
  4830.                         Thread.sleep(1000L);
  4831.                     } catch (Exception _ex) {
  4832.                     }
  4833.                 }
  4834.  
  4835.                 l *= 2;
  4836.                 if (l > 60)
  4837.                     l = 60;
  4838.                 aBoolean872 = !aBoolean872;
  4839.             }
  4840.  
  4841.         }
  4842.  
  4843.         StreamLoader streamLoader_1 = new StreamLoader(abyte0, s);
  4844.         return streamLoader_1;
  4845.     }
  4846.  
  4847.     public void sendStringAsLong(String string) {
  4848.         stream.createFrame(60);
  4849.         stream.writeQWord(TextClass.longForName(string));
  4850.     }
  4851.  
  4852.     public void sendString(int identifier, String text) {
  4853.         text = identifier + "," + text;
  4854.         stream.createFrame(127);
  4855.         stream.writeWordBigEndian(text.length() + 1);
  4856.         stream.writeString(text);
  4857.     }
  4858.  
  4859.     public void dropClient() {
  4860.         if (anInt1011 > 0) {
  4861.             resetLogout();
  4862.             return;
  4863.         }
  4864.         aRSImageProducer_1165.initDrawingArea();
  4865.         DrawingArea.fillPixels(2, 229, 39, 0xffffff, 2);
  4866.         DrawingArea.drawPixels(37, 3, 3, 0, 227);
  4867.         aTextDrawingArea_1271.drawText(0, "Connection Lost", 19, 120);
  4868.         aTextDrawingArea_1271.drawText(0xffffff, "Connection Lost", 18, 119);
  4869.         aTextDrawingArea_1271
  4870.                 .drawText(0, "Please Wait - Reconnecting", 34, 117);
  4871.         aTextDrawingArea_1271.drawText(0xffffff, "Please Wait - Reconnecting",
  4872.                 34, 116);
  4873.         aRSImageProducer_1165.drawGraphics(frameMode == ScreenMode.FIXED ? 4 : 0, super.graphics, frameMode == ScreenMode.FIXED ? 4 : 0);
  4874.         anInt1021 = 0;
  4875.         destX = 0;
  4876.         RSSocket rsSocket = socketStream;
  4877.         loggedIn = false;
  4878.         loginFailures = 0;
  4879.         login(myUsername, myPassword, true);
  4880.         if (!loggedIn)
  4881.             resetLogout();
  4882.         try {
  4883.             rsSocket.close();
  4884.         } catch (Exception _ex) {
  4885.         }
  4886.     }
  4887.  
  4888.     private void doAction(int i) {
  4889.         if (i < 0)
  4890.             return;
  4891.         if (inputDialogState != 0) {
  4892.             inputDialogState = 0;
  4893.             inputTaken = true;
  4894.         }
  4895.         int j = menuActionCmd2[i];
  4896.         int k = menuActionCmd3[i];
  4897.         int l = menuActionID[i];
  4898.         int i1 = menuActionCmd1[i];
  4899.         if (l >= 2000)
  4900.             l -= 2000;
  4901.         if (l == 474) {
  4902.             counterOn = !counterOn;
  4903.         }
  4904.         if (l == 700) {
  4905.             if (tabInterfaceIDs[15] != -1) {
  4906.                 if (tabID == 15) {
  4907.                     showTabComponents = !showTabComponents;
  4908.                 } else {
  4909.                     showTabComponents = true;
  4910.                 }
  4911.                 tabID = 15;
  4912.                 tabAreaAltered = true;
  4913.             }
  4914.         }
  4915.         if (l == 475) {
  4916.             xpCounter = 0;
  4917.         }
  4918.         if (l == 696) {
  4919.             setNorth();
  4920.         }
  4921.         if (l == 582) {
  4922.             NPC npc = npcArray[i1];
  4923.             if (npc != null) {
  4924.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, npc.smallY[0],
  4925.                         myPlayer.smallX[0], false, npc.smallX[0]);
  4926.                 crossX = super.saveClickX;
  4927.                 crossY = super.saveClickY;
  4928.                 crossType = 2;
  4929.                 crossIndex = 0;
  4930.                 stream.createFrame(57);
  4931.                 stream.method432(anInt1285);
  4932.                 stream.method432(i1);
  4933.                 stream.method431(anInt1283);
  4934.                 stream.method432(anInt1284);
  4935.             }
  4936.         }
  4937.         if (l == 234) {
  4938.             boolean flag1 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k,
  4939.                     myPlayer.smallX[0], false, j);
  4940.             if (!flag1)
  4941.                 flag1 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k,
  4942.                         myPlayer.smallX[0], false, j);
  4943.             crossX = super.saveClickX;
  4944.             crossY = super.saveClickY;
  4945.             crossType = 2;
  4946.             crossIndex = 0;
  4947.             stream.createFrame(236);
  4948.             stream.method431(k + baseY);
  4949.             stream.writeWord(i1);
  4950.             stream.method431(j + baseX);
  4951.         }
  4952.         if (l == 62 && method66(i1, k, j)) {
  4953.             stream.createFrame(192);
  4954.             stream.writeWord(anInt1284);
  4955.             stream.method431(i1 >> 14 & 0x7fff);
  4956.             stream.method433(k + baseY);
  4957.             stream.method431(anInt1283);
  4958.             stream.method433(j + baseX);
  4959.             stream.writeWord(anInt1285);
  4960.         }
  4961.  
  4962.         if (l == 511) {
  4963.             boolean flag2 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k,
  4964.                     myPlayer.smallX[0], false, j);
  4965.             if (!flag2)
  4966.                 flag2 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k,
  4967.                         myPlayer.smallX[0], false, j);
  4968.             crossX = super.saveClickX;
  4969.             crossY = super.saveClickY;
  4970.             crossType = 2;
  4971.             crossIndex = 0;
  4972.             stream.createFrame(25);
  4973.             stream.method431(anInt1284);
  4974.             stream.method432(anInt1285);
  4975.             stream.writeWord(i1);
  4976.             stream.method432(k + baseY);
  4977.             stream.method433(anInt1283);
  4978.             stream.writeWord(j + baseX);
  4979.         }
  4980.         if (l == 74) {
  4981.             stream.createFrame(122);
  4982.             stream.method433(k);
  4983.             stream.method432(j);
  4984.             stream.method431(i1);
  4985.             atInventoryLoopCycle = 0;
  4986.             atInventoryInterface = k;
  4987.             atInventoryIndex = j;
  4988.             atInventoryInterfaceType = 2;
  4989.             if (RSInterface.interfaceCache[k].parentID == openInterfaceID)
  4990.                 atInventoryInterfaceType = 1;
  4991.             if (RSInterface.interfaceCache[k].parentID == backDialogID)
  4992.                 atInventoryInterfaceType = 3;
  4993.         }
  4994.         if (l == 315) {
  4995.             RSInterface class9 = RSInterface.interfaceCache[k];
  4996.             boolean flag8 = true;
  4997.             if (class9.contentType > 0)
  4998.                 flag8 = promptUserForInput(class9);
  4999.             if (flag8) {
  5000.  
  5001.                 switch (k) {
  5002.                 case 19144:
  5003.                     sendFrame248(15106, 3213);
  5004.                     method60(15106);
  5005.                     inputTaken = true;
  5006.                     break;
  5007.                 default:
  5008.                     stream.createFrame(185);
  5009.                     stream.writeWord(k);
  5010.                     break;
  5011.  
  5012.                 }
  5013.             }
  5014.         }
  5015.         if (l == 561) {
  5016.             Player player = playerArray[i1];
  5017.             if (player != null) {
  5018.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
  5019.                         player.smallY[0], myPlayer.smallX[0], false,
  5020.                         player.smallX[0]);
  5021.                 crossX = super.saveClickX;
  5022.                 crossY = super.saveClickY;
  5023.                 crossType = 2;
  5024.                 crossIndex = 0;
  5025.                 anInt1188 += i1;
  5026.                 if (anInt1188 >= 90) {
  5027.                     stream.createFrame(136);
  5028.                     anInt1188 = 0;
  5029.                 }
  5030.                 stream.createFrame(128);
  5031.                 stream.writeWord(i1);
  5032.             }
  5033.         }
  5034.         if (l == 20) {
  5035.             NPC class30_sub2_sub4_sub1_sub1_1 = npcArray[i1];
  5036.             if (class30_sub2_sub4_sub1_sub1_1 != null) {
  5037.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
  5038.                         class30_sub2_sub4_sub1_sub1_1.smallY[0],
  5039.                         myPlayer.smallX[0], false,
  5040.                         class30_sub2_sub4_sub1_sub1_1.smallX[0]);
  5041.                 crossX = super.saveClickX;
  5042.                 crossY = super.saveClickY;
  5043.                 crossType = 2;
  5044.                 crossIndex = 0;
  5045.                 stream.createFrame(155);
  5046.                 stream.method431(i1);
  5047.             }
  5048.         }
  5049.         if (l == 779) {
  5050.             Player class30_sub2_sub4_sub1_sub2_1 = playerArray[i1];
  5051.             if (class30_sub2_sub4_sub1_sub2_1 != null) {
  5052.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
  5053.                         class30_sub2_sub4_sub1_sub2_1.smallY[0],
  5054.                         myPlayer.smallX[0], false,
  5055.                         class30_sub2_sub4_sub1_sub2_1.smallX[0]);
  5056.                 crossX = super.saveClickX;
  5057.                 crossY = super.saveClickY;
  5058.                 crossType = 2;
  5059.                 crossIndex = 0;
  5060.                 stream.createFrame(153);
  5061.                 stream.method431(i1);
  5062.             }
  5063.         }
  5064.         if (l == 516)
  5065.             if (!menuOpen)
  5066.                 worldController.method312(super.saveClickY - 4,
  5067.                         super.saveClickX - 4);
  5068.             else
  5069.                 worldController.method312(k - 4, j - 4);
  5070.         if (l == 1062) {
  5071.             anInt924 += baseX;
  5072.             if (anInt924 >= 113) {
  5073.                 stream.createFrame(183);
  5074.                 stream.writeDWordBigEndian(0xe63271);
  5075.                 anInt924 = 0;
  5076.             }
  5077.             method66(i1, k, j);
  5078.             stream.createFrame(228);
  5079.             stream.method432(i1 >> 14 & 0x7fff);
  5080.             stream.method432(k + baseY);
  5081.             stream.writeWord(j + baseX);
  5082.         }
  5083.         if (l == 679 && !aBoolean1149) {
  5084.             stream.createFrame(40);
  5085.             stream.writeWord(k);
  5086.             aBoolean1149 = true;
  5087.         }
  5088.         if (l == 431) {
  5089.             stream.createFrame(129);
  5090.             stream.method432(j);
  5091.             stream.writeWord(k);
  5092.             stream.method432(i1);
  5093.             atInventoryLoopCycle = 0;
  5094.             atInventoryInterface = k;
  5095.             atInventoryIndex = j;
  5096.             atInventoryInterfaceType = 2;
  5097.             if (RSInterface.interfaceCache[k].parentID == openInterfaceID)
  5098.                 atInventoryInterfaceType = 1;
  5099.             if (RSInterface.interfaceCache[k].parentID == backDialogID)
  5100.                 atInventoryInterfaceType = 3;
  5101.         }
  5102.         if (l == 337 || l == 42 || l == 792 || l == 322) {
  5103.             String s = menuActionName[i];
  5104.             int k1 = s.indexOf("@whi@");
  5105.             if (k1 != -1) {
  5106.                 long l3 = TextClass.longForName(s.substring(k1 + 5).trim());
  5107.                 if (l == 337)
  5108.                     addFriend(l3);
  5109.                 if (l == 42)
  5110.                     addIgnore(l3);
  5111.                 if (l == 792)
  5112.                     delFriend(l3);
  5113.                 if (l == 322)
  5114.                     delIgnore(l3);
  5115.             }
  5116.         }
  5117.         if (l == 53) {
  5118.             stream.createFrame(135);
  5119.             stream.method431(j);
  5120.             stream.method432(k);
  5121.             stream.method431(i1);
  5122.             atInventoryLoopCycle = 0;
  5123.             atInventoryInterface = k;
  5124.             atInventoryIndex = j;
  5125.             atInventoryInterfaceType = 2;
  5126.             if (RSInterface.interfaceCache[k].parentID == openInterfaceID)
  5127.                 atInventoryInterfaceType = 1;
  5128.             if (RSInterface.interfaceCache[k].parentID == backDialogID)
  5129.                 atInventoryInterfaceType = 3;
  5130.         }
  5131.         if (l == 539) {
  5132.             stream.createFrame(16);
  5133.             stream.method432(i1);
  5134.             stream.method433(j);
  5135.             stream.method433(k);
  5136.             atInventoryLoopCycle = 0;
  5137.             atInventoryInterface = k;
  5138.             atInventoryIndex = j;
  5139.             atInventoryInterfaceType = 2;
  5140.             if (RSInterface.interfaceCache[k].parentID == openInterfaceID)
  5141.                 atInventoryInterfaceType = 1;
  5142.             if (RSInterface.interfaceCache[k].parentID == backDialogID)
  5143.                 atInventoryInterfaceType = 3;
  5144.         }
  5145.         if (l == 484 || l == 6) {
  5146.             String s1 = menuActionName[i];
  5147.             int l1 = s1.indexOf("@whi@");
  5148.             if (l1 != -1) {
  5149.                 s1 = s1.substring(l1 + 5).trim();
  5150.                 String s7 = TextClass.fixName(TextClass.nameForLong(TextClass
  5151.                         .longForName(s1)));
  5152.                 boolean flag9 = false;
  5153.                 for (int j3 = 0; j3 < playerCount; j3++) {
  5154.                     Player class30_sub2_sub4_sub1_sub2_7 = playerArray[playerIndices[j3]];
  5155.                     if (class30_sub2_sub4_sub1_sub2_7 == null
  5156.                             || class30_sub2_sub4_sub1_sub2_7.name == null
  5157.                             || !class30_sub2_sub4_sub1_sub2_7.name
  5158.                                     .equalsIgnoreCase(s7))
  5159.                         continue;
  5160.                     doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
  5161.                             class30_sub2_sub4_sub1_sub2_7.smallY[0],
  5162.                             myPlayer.smallX[0], false,
  5163.                             class30_sub2_sub4_sub1_sub2_7.smallX[0]);
  5164.                     if (l == 484) {
  5165.                         stream.createFrame(39);
  5166.                         stream.method431(playerIndices[j3]);
  5167.                     }
  5168.                     if (l == 6) {
  5169.                         anInt1188 += i1;
  5170.                         if (anInt1188 >= 90) {
  5171.                             stream.createFrame(136);
  5172.                             anInt1188 = 0;
  5173.                         }
  5174.                         stream.createFrame(128);
  5175.                         stream.writeWord(playerIndices[j3]);
  5176.                     }
  5177.                     flag9 = true;
  5178.                     break;
  5179.                 }
  5180.  
  5181.                 if (!flag9)
  5182.                     pushMessage("Unable to find " + s7, 0, "");
  5183.             }
  5184.         }
  5185.         if (l == 870) {
  5186.             stream.createFrame(53);
  5187.             stream.writeWord(j);
  5188.             stream.method432(anInt1283);
  5189.             stream.method433(i1);
  5190.             stream.writeWord(anInt1284);
  5191.             stream.method431(anInt1285);
  5192.             stream.writeWord(k);
  5193.             atInventoryLoopCycle = 0;
  5194.             atInventoryInterface = k;
  5195.             atInventoryIndex = j;
  5196.             atInventoryInterfaceType = 2;
  5197.             if (RSInterface.interfaceCache[k].parentID == openInterfaceID)
  5198.                 atInventoryInterfaceType = 1;
  5199.             if (RSInterface.interfaceCache[k].parentID == backDialogID)
  5200.                 atInventoryInterfaceType = 3;
  5201.         }
  5202.         if (l == 847) {
  5203.             stream.createFrame(87);
  5204.             stream.method432(i1);
  5205.             stream.writeWord(k);
  5206.             stream.method432(j);
  5207.             atInventoryLoopCycle = 0;
  5208.             atInventoryInterface = k;
  5209.             atInventoryIndex = j;
  5210.             atInventoryInterfaceType = 2;
  5211.             if (RSInterface.interfaceCache[k].parentID == openInterfaceID)
  5212.                 atInventoryInterfaceType = 1;
  5213.             if (RSInterface.interfaceCache[k].parentID == backDialogID)
  5214.                 atInventoryInterfaceType = 3;
  5215.         }
  5216.         if (l == 626) {
  5217.             RSInterface class9_1 = RSInterface.interfaceCache[k];
  5218.             spellSelected = 1;
  5219.             spellID = class9_1.id;
  5220.             anInt1137 = k;
  5221.             spellUsableOn = class9_1.spellUsableOn;
  5222.             itemSelected = 0;
  5223.             needDrawTabArea = true;
  5224.             spellID = class9_1.id;
  5225.             String s4 = class9_1.selectedActionName;
  5226.             if (s4.indexOf(" ") != -1)
  5227.                 s4 = s4.substring(0, s4.indexOf(" "));
  5228.             String s8 = class9_1.selectedActionName;
  5229.             if (s8.indexOf(" ") != -1)
  5230.                 s8 = s8.substring(s8.indexOf(" ") + 1);
  5231.             spellTooltip = s4 + " " + class9_1.spellName + " " + s8;
  5232.             // class9_1.sprite1.drawSprite(class9_1.anInt263, class9_1.anInt265,
  5233.             // 0xffffff);
  5234.             // class9_1.sprite1.drawSprite(200,200);
  5235.             // System.out.println("Sprite: " + class9_1.sprite1.toString());
  5236.             if (spellUsableOn == 16) {
  5237.                 needDrawTabArea = true;
  5238.                 tabID = 3;
  5239.                 tabAreaAltered = true;
  5240.             }
  5241.             return;
  5242.         }
  5243.         if (l == 78) {
  5244.             stream.createFrame(117);
  5245.             stream.method433(k);
  5246.             stream.method433(i1);
  5247.             stream.method431(j);
  5248.             atInventoryLoopCycle = 0;
  5249.             atInventoryInterface = k;
  5250.             atInventoryIndex = j;
  5251.             atInventoryInterfaceType = 2;
  5252.             if (RSInterface.interfaceCache[k].parentID == openInterfaceID)
  5253.                 atInventoryInterfaceType = 1;
  5254.             if (RSInterface.interfaceCache[k].parentID == backDialogID)
  5255.                 atInventoryInterfaceType = 3;
  5256.         }
  5257.         if (l == 27) {
  5258.             Player class30_sub2_sub4_sub1_sub2_2 = playerArray[i1];
  5259.             if (class30_sub2_sub4_sub1_sub2_2 != null) {
  5260.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
  5261.                         class30_sub2_sub4_sub1_sub2_2.smallY[0],
  5262.                         myPlayer.smallX[0], false,
  5263.                         class30_sub2_sub4_sub1_sub2_2.smallX[0]);
  5264.                 crossX = super.saveClickX;
  5265.                 crossY = super.saveClickY;
  5266.                 crossType = 2;
  5267.                 crossIndex = 0;
  5268.                 anInt986 += i1;
  5269.                 if (anInt986 >= 54) {
  5270.                     stream.createFrame(189);
  5271.                     stream.writeWordBigEndian(234);
  5272.                     anInt986 = 0;
  5273.                 }
  5274.                 stream.createFrame(73);
  5275.                 stream.method431(i1);
  5276.             }
  5277.         }
  5278.         if (l == 213) {
  5279.             boolean flag3 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k,
  5280.                     myPlayer.smallX[0], false, j);
  5281.             if (!flag3)
  5282.                 flag3 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k,
  5283.                         myPlayer.smallX[0], false, j);
  5284.             crossX = super.saveClickX;
  5285.             crossY = super.saveClickY;
  5286.             crossType = 2;
  5287.             crossIndex = 0;
  5288.             stream.createFrame(79);
  5289.             stream.method431(k + baseY);
  5290.             stream.writeWord(i1);
  5291.             stream.method432(j + baseX);
  5292.         }
  5293.         if (l == 632) {
  5294.             stream.createFrame(145);
  5295.             stream.method432(k);
  5296.             stream.method432(j);
  5297.             stream.method432(i1);
  5298.             atInventoryLoopCycle = 0;
  5299.             atInventoryInterface = k;
  5300.             atInventoryIndex = j;
  5301.             atInventoryInterfaceType = 2;
  5302.             if (RSInterface.interfaceCache[k].parentID == openInterfaceID)
  5303.                 atInventoryInterfaceType = 1;
  5304.             if (RSInterface.interfaceCache[k].parentID == backDialogID)
  5305.                 atInventoryInterfaceType = 3;
  5306.         }
  5307.         if (l == 1050) {
  5308.             if (!runClicked) {
  5309.                 runClicked = true;
  5310.                 stream.createFrame(185);
  5311.                 stream.writeWord(153);
  5312.             } else {
  5313.                 runClicked = false;
  5314.                 stream.createFrame(185);
  5315.                 stream.writeWord(152);
  5316.             }
  5317.         }
  5318.         if (l == 1004) {
  5319.             if (tabInterfaceIDs[10] != -1) {
  5320.                 needDrawTabArea = true;
  5321.                 tabID = 10;
  5322.                 tabAreaAltered = true;
  5323.             }
  5324.         }
  5325.         if (l == 1003) {
  5326.             clanChatMode = 2;
  5327.             inputTaken = true;
  5328.         }
  5329.         if (l == 1002) {
  5330.             clanChatMode = 1;
  5331.             inputTaken = true;
  5332.         }
  5333.         if (l == 1001) {
  5334.             clanChatMode = 0;
  5335.             inputTaken = true;
  5336.         }
  5337.         if (l == 1000) {
  5338.             cButtonCPos = 4;
  5339.             chatTypeView = 11;
  5340.             inputTaken = true;
  5341.         }
  5342.         if (l == 999) {
  5343.             cButtonCPos = 0;
  5344.             chatTypeView = 0;
  5345.             inputTaken = true;
  5346.         }
  5347.         if (l == 998) {
  5348.             cButtonCPos = 1;
  5349.             chatTypeView = 5;
  5350.             inputTaken = true;
  5351.         }
  5352.         if (l == 997) {
  5353.             publicChatMode = 3;
  5354.             inputTaken = true;
  5355.         }
  5356.         if (l == 996) {
  5357.             publicChatMode = 2;
  5358.             inputTaken = true;
  5359.         }
  5360.         if (l == 995) {
  5361.             publicChatMode = 1;
  5362.             inputTaken = true;
  5363.         }
  5364.         if (l == 994) {
  5365.             publicChatMode = 0;
  5366.             inputTaken = true;
  5367.         }
  5368.         if (l == 993) {
  5369.             cButtonCPos = 2;
  5370.             chatTypeView = 1;
  5371.             inputTaken = true;
  5372.         }
  5373.         if (l == 992) {
  5374.             privateChatMode = 2;
  5375.             inputTaken = true;
  5376.         }
  5377.         if (l == 991) {
  5378.             privateChatMode = 1;
  5379.             inputTaken = true;
  5380.         }
  5381.         if (l == 990) {
  5382.             privateChatMode = 0;
  5383.             inputTaken = true;
  5384.         }
  5385.         if (l == 989) {
  5386.             cButtonCPos = 3;
  5387.             chatTypeView = 2;
  5388.             inputTaken = true;
  5389.         }
  5390.         if (l == 987) {
  5391.             tradeMode = 2;
  5392.             inputTaken = true;
  5393.         }
  5394.         if (l == 986) {
  5395.             tradeMode = 1;
  5396.             inputTaken = true;
  5397.         }
  5398.         if (l == 985) {
  5399.             tradeMode = 0;
  5400.             inputTaken = true;
  5401.         }
  5402.         if (l == 984) {
  5403.             cButtonCPos = 5;
  5404.             chatTypeView = 3;
  5405.             inputTaken = true;
  5406.         }
  5407.         if (l == 983) {
  5408.             duelMode = 2;
  5409.             inputTaken = true;
  5410.         }
  5411.         if (l == 982) {
  5412.             duelMode = 1;
  5413.             inputTaken = true;
  5414.         }
  5415.         if (l == 981) {
  5416.             duelMode = 0;
  5417.             inputTaken = true;
  5418.         }
  5419.         if (l == 980) {
  5420.             cButtonCPos = 6;
  5421.             chatTypeView = 4;
  5422.             inputTaken = true;
  5423.         }
  5424.         if (l == 493) {
  5425.             stream.createFrame(75);
  5426.             stream.method433(k);
  5427.             stream.method431(j);
  5428.             stream.method432(i1);
  5429.             atInventoryLoopCycle = 0;
  5430.             atInventoryInterface = k;
  5431.             atInventoryIndex = j;
  5432.             atInventoryInterfaceType = 2;
  5433.             if (RSInterface.interfaceCache[k].parentID == openInterfaceID)
  5434.                 atInventoryInterfaceType = 1;
  5435.             if (RSInterface.interfaceCache[k].parentID == backDialogID)
  5436.                 atInventoryInterfaceType = 3;
  5437.         }
  5438.         if (l == 652) {
  5439.             boolean flag4 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k,
  5440.                     myPlayer.smallX[0], false, j);
  5441.             if (!flag4)
  5442.                 flag4 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k,
  5443.                         myPlayer.smallX[0], false, j);
  5444.             crossX = super.saveClickX;
  5445.             crossY = super.saveClickY;
  5446.             crossType = 2;
  5447.             crossIndex = 0;
  5448.             stream.createFrame(156);
  5449.             stream.method432(j + baseX);
  5450.             stream.method431(k + baseY);
  5451.             stream.method433(i1);
  5452.         }
  5453.         if (l == 94) {
  5454.             boolean flag5 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k,
  5455.                     myPlayer.smallX[0], false, j);
  5456.             if (!flag5)
  5457.                 flag5 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k,
  5458.                         myPlayer.smallX[0], false, j);
  5459.             crossX = super.saveClickX;
  5460.             crossY = super.saveClickY;
  5461.             crossType = 2;
  5462.             crossIndex = 0;
  5463.             stream.createFrame(181);
  5464.             stream.method431(k + baseY);
  5465.             stream.writeWord(i1);
  5466.             stream.method431(j + baseX);
  5467.             stream.method432(anInt1137);
  5468.         }
  5469.         // clan chat
  5470.         if (l == 647) {
  5471.             stream.createFrame(213);
  5472.             stream.writeWord(k);
  5473.             stream.writeWord(j);
  5474.             switch (k) {
  5475.             case 18304:
  5476.                 if (j == 0) {
  5477.                     inputTaken = true;
  5478.                     inputDialogState = 0;
  5479.                     messagePromptRaised = true;
  5480.                     promptInput = "";
  5481.                     friendsListAction = 8;
  5482.                     aString1121 = "Enter your clan chat title";
  5483.                 }
  5484.                 break;
  5485.             }
  5486.         }
  5487.         if (l == 646) {
  5488.             stream.createFrame(185);
  5489.             stream.writeWord(k);
  5490.             RSInterface class9_2 = RSInterface.interfaceCache[k];
  5491.             if (class9_2.valueIndexArray != null
  5492.                     && class9_2.valueIndexArray[0][0] == 5) {
  5493.                 int i2 = class9_2.valueIndexArray[0][1];
  5494.                 if (variousSettings[i2] != class9_2.anIntArray212[0]) {
  5495.                     variousSettings[i2] = class9_2.anIntArray212[0];
  5496.                     method33(i2);
  5497.                     needDrawTabArea = true;
  5498.                 }
  5499.             }
  5500.             switch (k) {
  5501.             // clan chat
  5502.             case 18129:
  5503.                 if (RSInterface.interfaceCache[18135].message.toLowerCase()
  5504.                         .contains("join")) {
  5505.                     inputTaken = true;
  5506.                     inputDialogState = 0;
  5507.                     messagePromptRaised = true;
  5508.                     promptInput = "";
  5509.                     friendsListAction = 6;
  5510.                     aString1121 = "Enter the name of the chat you wish to join";
  5511.                 } else {
  5512.                     sendString(0, "");
  5513.                 }
  5514.                 break;
  5515.             case 18132:
  5516.                 openInterfaceID = 18300;
  5517.                 break;
  5518.             case 18526:
  5519.                 inputTaken = true;
  5520.                 inputDialogState = 0;
  5521.                 messagePromptRaised = true;
  5522.                 promptInput = "";
  5523.                 friendsListAction = 9;
  5524.                 aString1121 = "Enter a name to add";
  5525.                 break;
  5526.             case 18527:
  5527.                 inputTaken = true;
  5528.                 inputDialogState = 0;
  5529.                 messagePromptRaised = true;
  5530.                 promptInput = "";
  5531.                 friendsListAction = 10;
  5532.                 aString1121 = "Enter a name to add";
  5533.                 break;
  5534.             }
  5535.         }
  5536.         if (l == 225) {
  5537.             NPC class30_sub2_sub4_sub1_sub1_2 = npcArray[i1];
  5538.             if (class30_sub2_sub4_sub1_sub1_2 != null) {
  5539.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
  5540.                         class30_sub2_sub4_sub1_sub1_2.smallY[0],
  5541.                         myPlayer.smallX[0], false,
  5542.                         class30_sub2_sub4_sub1_sub1_2.smallX[0]);
  5543.                 crossX = super.saveClickX;
  5544.                 crossY = super.saveClickY;
  5545.                 crossType = 2;
  5546.                 crossIndex = 0;
  5547.                 anInt1226 += i1;
  5548.                 if (anInt1226 >= 85) {
  5549.                     stream.createFrame(230);
  5550.                     stream.writeWordBigEndian(239);
  5551.                     anInt1226 = 0;
  5552.                 }
  5553.                 stream.createFrame(17);
  5554.                 stream.method433(i1);
  5555.             }
  5556.         }
  5557.         if (l == 965) {
  5558.             NPC class30_sub2_sub4_sub1_sub1_3 = npcArray[i1];
  5559.             if (class30_sub2_sub4_sub1_sub1_3 != null) {
  5560.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
  5561.                         class30_sub2_sub4_sub1_sub1_3.smallY[0],
  5562.                         myPlayer.smallX[0], false,
  5563.                         class30_sub2_sub4_sub1_sub1_3.smallX[0]);
  5564.                 crossX = super.saveClickX;
  5565.                 crossY = super.saveClickY;
  5566.                 crossType = 2;
  5567.                 crossIndex = 0;
  5568.                 anInt1134++;
  5569.                 if (anInt1134 >= 96) {
  5570.                     stream.createFrame(152);
  5571.                     stream.writeWordBigEndian(88);
  5572.                     anInt1134 = 0;
  5573.                 }
  5574.                 stream.createFrame(21);
  5575.                 stream.writeWord(i1);
  5576.             }
  5577.         }
  5578.         if (l == 413) {
  5579.             NPC class30_sub2_sub4_sub1_sub1_4 = npcArray[i1];
  5580.             if (class30_sub2_sub4_sub1_sub1_4 != null) {
  5581.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
  5582.                         class30_sub2_sub4_sub1_sub1_4.smallY[0],
  5583.                         myPlayer.smallX[0], false,
  5584.                         class30_sub2_sub4_sub1_sub1_4.smallX[0]);
  5585.                 crossX = super.saveClickX;
  5586.                 crossY = super.saveClickY;
  5587.                 crossType = 2;
  5588.                 crossIndex = 0;
  5589.                 stream.createFrame(131);
  5590.                 stream.method433(i1);
  5591.                 stream.method432(anInt1137);
  5592.             }
  5593.         }
  5594.         if (l == 200)
  5595.             clearTopInterfaces();
  5596.         if (l == 1025) {
  5597.             NPC class30_sub2_sub4_sub1_sub1_5 = npcArray[i1];
  5598.             if (class30_sub2_sub4_sub1_sub1_5 != null) {
  5599.                 EntityDef entityDef = class30_sub2_sub4_sub1_sub1_5.desc;
  5600.                 if (entityDef.childrenIDs != null)
  5601.                     entityDef = entityDef.method161();
  5602.                 if (entityDef != null) {
  5603.                     String s9;
  5604.                     if (entityDef.description != null)
  5605.                         s9 = new String(entityDef.description);
  5606.                     else
  5607.                         s9 = "It's a " + entityDef.name + ".";
  5608.                     pushMessage(s9, 0, "");
  5609.                 }
  5610.             }
  5611.         }
  5612.         if (l == 900) {
  5613.             method66(i1, k, j);
  5614.             stream.createFrame(252);
  5615.             stream.method433(i1 >> 14 & 0x7fff);
  5616.             stream.method431(k + baseY);
  5617.             stream.method432(j + baseX);
  5618.         }
  5619.         if (l == 412) {
  5620.             NPC class30_sub2_sub4_sub1_sub1_6 = npcArray[i1];
  5621.             if (class30_sub2_sub4_sub1_sub1_6 != null) {
  5622.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
  5623.                         class30_sub2_sub4_sub1_sub1_6.smallY[0],
  5624.                         myPlayer.smallX[0], false,
  5625.                         class30_sub2_sub4_sub1_sub1_6.smallX[0]);
  5626.                 crossX = super.saveClickX;
  5627.                 crossY = super.saveClickY;
  5628.                 crossType = 2;
  5629.                 crossIndex = 0;
  5630.                 stream.createFrame(72);
  5631.                 stream.method432(i1);
  5632.             }
  5633.         }
  5634.         if (l == 365) {
  5635.             Player class30_sub2_sub4_sub1_sub2_3 = playerArray[i1];
  5636.             if (class30_sub2_sub4_sub1_sub2_3 != null) {
  5637.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
  5638.                         class30_sub2_sub4_sub1_sub2_3.smallY[0],
  5639.                         myPlayer.smallX[0], false,
  5640.                         class30_sub2_sub4_sub1_sub2_3.smallX[0]);
  5641.                 crossX = super.saveClickX;
  5642.                 crossY = super.saveClickY;
  5643.                 crossType = 2;
  5644.                 crossIndex = 0;
  5645.                 stream.createFrame(249);
  5646.                 stream.method432(i1);
  5647.                 stream.method431(anInt1137);
  5648.             }
  5649.         }
  5650.         if (l == 729) {
  5651.             Player class30_sub2_sub4_sub1_sub2_4 = playerArray[i1];
  5652.             if (class30_sub2_sub4_sub1_sub2_4 != null) {
  5653.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
  5654.                         class30_sub2_sub4_sub1_sub2_4.smallY[0],
  5655.                         myPlayer.smallX[0], false,
  5656.                         class30_sub2_sub4_sub1_sub2_4.smallX[0]);
  5657.                 crossX = super.saveClickX;
  5658.                 crossY = super.saveClickY;
  5659.                 crossType = 2;
  5660.                 crossIndex = 0;
  5661.                 stream.createFrame(39);
  5662.                 stream.method431(i1);
  5663.             }
  5664.         }
  5665.         if (l == 577) {
  5666.             Player class30_sub2_sub4_sub1_sub2_5 = playerArray[i1];
  5667.             if (class30_sub2_sub4_sub1_sub2_5 != null) {
  5668.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
  5669.                         class30_sub2_sub4_sub1_sub2_5.smallY[0],
  5670.                         myPlayer.smallX[0], false,
  5671.                         class30_sub2_sub4_sub1_sub2_5.smallX[0]);
  5672.                 crossX = super.saveClickX;
  5673.                 crossY = super.saveClickY;
  5674.                 crossType = 2;
  5675.                 crossIndex = 0;
  5676.                 stream.createFrame(139);
  5677.                 stream.method431(i1);
  5678.             }
  5679.         }
  5680.         if (l == 956 && method66(i1, k, j)) {
  5681.             stream.createFrame(35);
  5682.             stream.method431(j + baseX);
  5683.             stream.method432(anInt1137);
  5684.             stream.method432(k + baseY);
  5685.             stream.method431(i1 >> 14 & 0x7fff);
  5686.         }
  5687.         if (l == 567) {
  5688.             boolean flag6 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k,
  5689.                     myPlayer.smallX[0], false, j);
  5690.             if (!flag6)
  5691.                 flag6 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k,
  5692.                         myPlayer.smallX[0], false, j);
  5693.             crossX = super.saveClickX;
  5694.             crossY = super.saveClickY;
  5695.             crossType = 2;
  5696.             crossIndex = 0;
  5697.             stream.createFrame(23);
  5698.             stream.method431(k + baseY);
  5699.             stream.method431(i1);
  5700.             stream.method431(j + baseX);
  5701.         }
  5702.         if (l == 867) {
  5703.             if ((i1 & 3) == 0)
  5704.                 anInt1175++;
  5705.             if (anInt1175 >= 59) {
  5706.                 stream.createFrame(200);
  5707.                 stream.createFrame(201);
  5708.                 stream.writeWord(25501);
  5709.                 anInt1175 = 0;
  5710.             }
  5711.             stream.createFrame(43);
  5712.             stream.method431(k);
  5713.             stream.method432(i1);
  5714.             stream.method432(j);
  5715.             atInventoryLoopCycle = 0;
  5716.             atInventoryInterface = k;
  5717.             atInventoryIndex = j;
  5718.             atInventoryInterfaceType = 2;
  5719.             if (RSInterface.interfaceCache[k].parentID == openInterfaceID)
  5720.                 atInventoryInterfaceType = 1;
  5721.             if (RSInterface.interfaceCache[k].parentID == backDialogID)
  5722.                 atInventoryInterfaceType = 3;
  5723.         }
  5724.         if (l == 543) {
  5725.             stream.createFrame(237);
  5726.             stream.writeWord(j);
  5727.             stream.method432(i1);
  5728.             stream.writeWord(k);
  5729.             stream.method432(anInt1137);
  5730.             atInventoryLoopCycle = 0;
  5731.             atInventoryInterface = k;
  5732.             atInventoryIndex = j;
  5733.             atInventoryInterfaceType = 2;
  5734.             if (RSInterface.interfaceCache[k].parentID == openInterfaceID)
  5735.                 atInventoryInterfaceType = 1;
  5736.             if (RSInterface.interfaceCache[k].parentID == backDialogID)
  5737.                 atInventoryInterfaceType = 3;
  5738.         }
  5739.         if (l == 606) {
  5740.             String s2 = menuActionName[i];
  5741.             int j2 = s2.indexOf("@whi@");
  5742.             if (j2 != -1)
  5743.                 if (openInterfaceID == -1) {
  5744.                     clearTopInterfaces();
  5745.                     reportAbuseInput = s2.substring(j2 + 5).trim();
  5746.                     canMute = false;
  5747.                     for (int i3 = 0; i3 < RSInterface.interfaceCache.length; i3++) {
  5748.                         if (RSInterface.interfaceCache[i3] == null
  5749.                                 || RSInterface.interfaceCache[i3].contentType != 600)
  5750.                             continue;
  5751.                         reportAbuseInterfaceID = openInterfaceID = RSInterface.interfaceCache[i3].parentID;
  5752.                         break;
  5753.                     }
  5754.  
  5755.                 } else {
  5756.                     pushMessage(
  5757.                             "Please close the interface you have open before using 'report abuse'",
  5758.                             0, "");
  5759.                 }
  5760.         }
  5761.         if (l == 491) {
  5762.             Player class30_sub2_sub4_sub1_sub2_6 = playerArray[i1];
  5763.             if (class30_sub2_sub4_sub1_sub2_6 != null) {
  5764.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
  5765.                         class30_sub2_sub4_sub1_sub2_6.smallY[0],
  5766.                         myPlayer.smallX[0], false,
  5767.                         class30_sub2_sub4_sub1_sub2_6.smallX[0]);
  5768.                 crossX = super.saveClickX;
  5769.                 crossY = super.saveClickY;
  5770.                 crossType = 2;
  5771.                 crossIndex = 0;
  5772.                 stream.createFrame(14);
  5773.                 stream.method432(anInt1284);
  5774.                 stream.writeWord(i1);
  5775.                 stream.writeWord(anInt1285);
  5776.                 stream.method431(anInt1283);
  5777.             }
  5778.         }
  5779.         if (l == 639) {
  5780.             String s3 = menuActionName[i];
  5781.             int k2 = s3.indexOf("@whi@");
  5782.             if (k2 != -1) {
  5783.                 long l4 = TextClass.longForName(s3.substring(k2 + 5).trim());
  5784.                 int k3 = -1;
  5785.                 for (int i4 = 0; i4 < friendsCount; i4++) {
  5786.                     if (friendsListAsLongs[i4] != l4)
  5787.                         continue;
  5788.                     k3 = i4;
  5789.                     break;
  5790.                 }
  5791.  
  5792.                 if (k3 != -1 && friendsNodeIDs[k3] > 0) {
  5793.                     inputTaken = true;
  5794.                     inputDialogState = 0;
  5795.                     messagePromptRaised = true;
  5796.                     promptInput = "";
  5797.                     friendsListAction = 3;
  5798.                     aLong953 = friendsListAsLongs[k3];
  5799.                     aString1121 = "Enter message to send to " + friendsList[k3];
  5800.                 }
  5801.             }
  5802.         }
  5803.         if (l == 1052) {
  5804.             stream.createFrame(185);
  5805.             stream.writeWord(154);
  5806.         }
  5807.  
  5808.         if (l == 1004) {
  5809.             if (tabInterfaceIDs[14] != -1) {
  5810.                 needDrawTabArea = true;
  5811.                 tabID = 14;
  5812.                 tabAreaAltered = true;
  5813.             }
  5814.         }
  5815.  
  5816.         if (l == 454) {
  5817.             stream.createFrame(41);
  5818.             stream.writeWord(i1);
  5819.             stream.method432(j);
  5820.             stream.method432(k);
  5821.             atInventoryLoopCycle = 0;
  5822.             atInventoryInterface = k;
  5823.             atInventoryIndex = j;
  5824.             atInventoryInterfaceType = 2;
  5825.             if (RSInterface.interfaceCache[k].parentID == openInterfaceID)
  5826.                 atInventoryInterfaceType = 1;
  5827.             if (RSInterface.interfaceCache[k].parentID == backDialogID)
  5828.                 atInventoryInterfaceType = 3;
  5829.         }
  5830.         if (l == 478) {
  5831.             NPC class30_sub2_sub4_sub1_sub1_7 = npcArray[i1];
  5832.             if (class30_sub2_sub4_sub1_sub1_7 != null) {
  5833.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
  5834.                         class30_sub2_sub4_sub1_sub1_7.smallY[0],
  5835.                         myPlayer.smallX[0], false,
  5836.                         class30_sub2_sub4_sub1_sub1_7.smallX[0]);
  5837.                 crossX = super.saveClickX;
  5838.                 crossY = super.saveClickY;
  5839.                 crossType = 2;
  5840.                 crossIndex = 0;
  5841.                 if ((i1 & 3) == 0)
  5842.                     anInt1155++;
  5843.                 if (anInt1155 >= 53) {
  5844.                     stream.createFrame(85);
  5845.                     stream.writeWordBigEndian(66);
  5846.                     anInt1155 = 0;
  5847.                 }
  5848.                 stream.createFrame(18);
  5849.                 stream.method431(i1);
  5850.             }
  5851.         }
  5852.         if (l == 113) {
  5853.             method66(i1, k, j);
  5854.             stream.createFrame(70);
  5855.             stream.method431(j + baseX);
  5856.             stream.writeWord(k + baseY);
  5857.             stream.method433(i1 >> 14 & 0x7fff);
  5858.         }
  5859.         if (l == 872) {
  5860.             method66(i1, k, j);
  5861.             stream.createFrame(234);
  5862.             stream.method433(j + baseX);
  5863.             stream.method432(i1 >> 14 & 0x7fff);
  5864.             stream.method433(k + baseY);
  5865.         }
  5866.         if (l == 502) {
  5867.             method66(i1, k, j);
  5868.             stream.createFrame(132);
  5869.             stream.method433(j + baseX);
  5870.             stream.writeWord(i1 >> 14 & 0x7fff);
  5871.             stream.method432(k + baseY);
  5872.         }
  5873.         if (l == 1125) {
  5874.             ItemDef itemDef = ItemDef.forID(i1);
  5875.             RSInterface class9_4 = RSInterface.interfaceCache[k];
  5876.             String s5;
  5877.             if (class9_4 != null && class9_4.invStackSizes[j] >= 0x186a0)
  5878.                 s5 = class9_4.invStackSizes[j] + " x " + itemDef.name;
  5879.             else if (itemDef.description != null)
  5880.                 s5 = new String(itemDef.description);
  5881.             else
  5882.                 s5 = "It's a " + itemDef.name + ".";
  5883.             pushMessage(s5, 0, "");
  5884.         }
  5885.         if (l == 169) {
  5886.             stream.createFrame(185);
  5887.             stream.writeWord(k);
  5888.             RSInterface class9_3 = RSInterface.interfaceCache[k];
  5889.             if (class9_3.valueIndexArray != null
  5890.                     && class9_3.valueIndexArray[0][0] == 5) {
  5891.                 int l2 = class9_3.valueIndexArray[0][1];
  5892.                 variousSettings[l2] = 1 - variousSettings[l2];
  5893.                 method33(l2);
  5894.                 needDrawTabArea = true;
  5895.             }
  5896.         }
  5897.         if (l == 447) {
  5898.             itemSelected = 1;
  5899.             anInt1283 = j;
  5900.             anInt1284 = k;
  5901.             anInt1285 = i1;
  5902.             selectedItemName = ItemDef.forID(i1).name;
  5903.             spellSelected = 0;
  5904.             needDrawTabArea = true;
  5905.             return;
  5906.         }
  5907.         if (l == 1226) {
  5908.             int j1 = i1 >> 14 & 0x7fff;
  5909.             ObjectDef class46 = ObjectDef.forID(j1);
  5910.             String s10;
  5911.             if (class46.description != null)
  5912.                 s10 = new String(class46.description);
  5913.             else
  5914.                 s10 = "It's a " + class46.name + ".";
  5915.             pushMessage(s10, 0, "");
  5916.         }
  5917.         if (l == 244) {
  5918.             boolean flag7 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k,
  5919.                     myPlayer.smallX[0], false, j);
  5920.             if (!flag7)
  5921.                 flag7 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k,
  5922.                         myPlayer.smallX[0], false, j);
  5923.             crossX = super.saveClickX;
  5924.             crossY = super.saveClickY;
  5925.             crossType = 2;
  5926.             crossIndex = 0;
  5927.             stream.createFrame(253);
  5928.             stream.method431(j + baseX);
  5929.             stream.method433(k + baseY);
  5930.             stream.method432(i1);
  5931.         }
  5932.         if (l == 1448) {
  5933.             ItemDef itemDef_1 = ItemDef.forID(i1);
  5934.             String s6;
  5935.             if (itemDef_1.description != null)
  5936.                 s6 = new String(itemDef_1.description);
  5937.             else
  5938.                 s6 = "It's a " + itemDef_1.name + ".";
  5939.             pushMessage(s6, 0, "");
  5940.         }
  5941.         itemSelected = 0;
  5942.         spellSelected = 0;
  5943.         needDrawTabArea = true;
  5944.  
  5945.     }
  5946.  
  5947.     public void method70() {
  5948.         anInt1251 = 0;
  5949.         int j = (myPlayer.x >> 7) + baseX;
  5950.         int k = (myPlayer.y >> 7) + baseY;
  5951.         if (j >= 3053 && j <= 3156 && k >= 3056 && k <= 3136)
  5952.             anInt1251 = 1;
  5953.         if (j >= 3072 && j <= 3118 && k >= 9492 && k <= 9535)
  5954.             anInt1251 = 1;
  5955.         if (anInt1251 == 1 && j >= 3139 && j <= 3199 && k >= 3008 && k <= 3062)
  5956.             anInt1251 = 0;
  5957.     }
  5958.  
  5959.     @Override
  5960.     public void run() {
  5961.         if (drawFlames) {
  5962.             drawFlames();
  5963.         } else {
  5964.             super.run();
  5965.         }
  5966.     }
  5967.  
  5968.     private void build3dScreenMenu() {
  5969.         if (itemSelected == 0 && spellSelected == 0) {
  5970.             menuActionName[menuActionRow] = "Walk here";
  5971.             menuActionID[menuActionRow] = 516;
  5972.             menuActionCmd2[menuActionRow] = super.mouseX;
  5973.             menuActionCmd3[menuActionRow] = super.mouseY;
  5974.             menuActionRow++;
  5975.         }
  5976.         int j = -1;
  5977.         for (int k = 0; k < Model.anInt1687; k++) {
  5978.             int l = Model.anIntArray1688[k];
  5979.             int i1 = l & 0x7f;
  5980.             int j1 = l >> 7 & 0x7f;
  5981.             int k1 = l >> 29 & 3;
  5982.             int l1 = l >> 14 & 0x7fff;
  5983.             if (l == j)
  5984.                 continue;
  5985.             j = l;
  5986.             if (k1 == 2 && worldController.method304(plane, i1, j1, l) >= 0) {
  5987.                 ObjectDef class46 = ObjectDef.forID(l1);
  5988.                 if (class46.childrenIDs != null)
  5989.                     class46 = class46.method580();
  5990.                 if (class46 == null)
  5991.                     continue;
  5992.                 if (itemSelected == 1) {
  5993.                     menuActionName[menuActionRow] = "Use " + selectedItemName
  5994.                             + " with @cya@" + class46.name;
  5995.                     menuActionID[menuActionRow] = 62;
  5996.                     menuActionCmd1[menuActionRow] = l;
  5997.                     menuActionCmd2[menuActionRow] = i1;
  5998.                     menuActionCmd3[menuActionRow] = j1;
  5999.                     menuActionRow++;
  6000.                 } else if (spellSelected == 1) {
  6001.                     if ((spellUsableOn & 4) == 4) {
  6002.                         menuActionName[menuActionRow] = spellTooltip + " @cya@"
  6003.                                 + class46.name;
  6004.                         menuActionID[menuActionRow] = 956;
  6005.                         menuActionCmd1[menuActionRow] = l;
  6006.                         menuActionCmd2[menuActionRow] = i1;
  6007.                         menuActionCmd3[menuActionRow] = j1;
  6008.                         menuActionRow++;
  6009.                     }
  6010.                 } else {
  6011.                     if (class46.actions != null) {
  6012.                         for (int i2 = 4; i2 >= 0; i2--)
  6013.                             if (class46.actions[i2] != null) {
  6014.                                 menuActionName[menuActionRow] = class46.actions[i2]
  6015.                                         + " @cya@" + class46.name;
  6016.                                 if (i2 == 0)
  6017.                                     menuActionID[menuActionRow] = 502;
  6018.                                 if (i2 == 1)
  6019.                                     menuActionID[menuActionRow] = 900;
  6020.                                 if (i2 == 2)
  6021.                                     menuActionID[menuActionRow] = 113;
  6022.                                 if (i2 == 3)
  6023.                                     menuActionID[menuActionRow] = 872;
  6024.                                 if (i2 == 4)
  6025.                                     menuActionID[menuActionRow] = 1062;
  6026.                                 menuActionCmd1[menuActionRow] = l;
  6027.                                 menuActionCmd2[menuActionRow] = i1;
  6028.                                 menuActionCmd3[menuActionRow] = j1;
  6029.                                 menuActionRow++;
  6030.                             }
  6031.  
  6032.                     }
  6033.                     menuActionName[menuActionRow] = "Examine @cya@" +
  6034.                     class46.name;
  6035.                     menuActionID[menuActionRow] = 1226;
  6036.                     menuActionCmd1[menuActionRow] = class46.type << 14;
  6037.                     menuActionCmd2[menuActionRow] = i1;
  6038.                     menuActionCmd3[menuActionRow] = j1;
  6039.                     menuActionRow++;
  6040.                 }
  6041.             }
  6042.             if (k1 == 1) {
  6043.                 NPC npc = npcArray[l1];
  6044.                 if (npc.desc.aByte68 == 1 && (npc.x & 0x7f) == 64
  6045.                         && (npc.y & 0x7f) == 64) {
  6046.                     for (int j2 = 0; j2 < npcCount; j2++) {
  6047.                         NPC npc2 = npcArray[npcIndices[j2]];
  6048.                         if (npc2 != null && npc2 != npc
  6049.                                 && npc2.desc.aByte68 == 1 && npc2.x == npc.x
  6050.                                 && npc2.y == npc.y)
  6051.                             buildAtNPCMenu(npc2.desc, npcIndices[j2], j1, i1);
  6052.                     }
  6053.  
  6054.                     for (int l2 = 0; l2 < playerCount; l2++) {
  6055.                         Player player = playerArray[playerIndices[l2]];
  6056.                         if (player != null && player.x == npc.x
  6057.                                 && player.y == npc.y)
  6058.                             buildAtPlayerMenu(i1, playerIndices[l2], player, j1);
  6059.                     }
  6060.  
  6061.                 }
  6062.                 buildAtNPCMenu(npc.desc, l1, j1, i1);
  6063.             }
  6064.             if (k1 == 0) {
  6065.                 Player player = playerArray[l1];
  6066.                 if ((player.x & 0x7f) == 64 && (player.y & 0x7f) == 64) {
  6067.                     for (int k2 = 0; k2 < npcCount; k2++) {
  6068.                         NPC class30_sub2_sub4_sub1_sub1_2 = npcArray[npcIndices[k2]];
  6069.                         if (class30_sub2_sub4_sub1_sub1_2 != null
  6070.                                 && class30_sub2_sub4_sub1_sub1_2.desc.aByte68 == 1
  6071.                                 && class30_sub2_sub4_sub1_sub1_2.x == player.x
  6072.                                 && class30_sub2_sub4_sub1_sub1_2.y == player.y)
  6073.                             buildAtNPCMenu(class30_sub2_sub4_sub1_sub1_2.desc,
  6074.                                     npcIndices[k2], j1, i1);
  6075.                     }
  6076.  
  6077.                     for (int i3 = 0; i3 < playerCount; i3++) {
  6078.                         Player class30_sub2_sub4_sub1_sub2_2 = playerArray[playerIndices[i3]];
  6079.                         if (class30_sub2_sub4_sub1_sub2_2 != null
  6080.                                 && class30_sub2_sub4_sub1_sub2_2 != player
  6081.                                 && class30_sub2_sub4_sub1_sub2_2.x == player.x
  6082.                                 && class30_sub2_sub4_sub1_sub2_2.y == player.y)
  6083.                             buildAtPlayerMenu(i1, playerIndices[i3],
  6084.                                     class30_sub2_sub4_sub1_sub2_2, j1);
  6085.                     }
  6086.  
  6087.                 }
  6088.                 buildAtPlayerMenu(i1, l1, player, j1);
  6089.             }
  6090.             if (k1 == 3) {
  6091.                 NodeList class19 = groundArray[plane][i1][j1];
  6092.                 if (class19 != null) {
  6093.                     for (Item item = (Item) class19.getFirst(); item != null; item = (Item) class19
  6094.                             .getNext()) {
  6095.                         ItemDef itemDef = ItemDef.forID(item.ID);
  6096.                         if (itemSelected == 1) {
  6097.                             menuActionName[menuActionRow] = "Use "
  6098.                                     + selectedItemName + " with @lre@"
  6099.                                     + itemDef.name;
  6100.                             menuActionID[menuActionRow] = 511;
  6101.                             menuActionCmd1[menuActionRow] = item.ID;
  6102.                             menuActionCmd2[menuActionRow] = i1;
  6103.                             menuActionCmd3[menuActionRow] = j1;
  6104.                             menuActionRow++;
  6105.                         } else if (spellSelected == 1) {
  6106.                             if ((spellUsableOn & 1) == 1) {
  6107.                                 menuActionName[menuActionRow] = spellTooltip
  6108.                                         + " @lre@" + itemDef.name;
  6109.                                 menuActionID[menuActionRow] = 94;
  6110.                                 menuActionCmd1[menuActionRow] = item.ID;
  6111.                                 menuActionCmd2[menuActionRow] = i1;
  6112.                                 menuActionCmd3[menuActionRow] = j1;
  6113.                                 menuActionRow++;
  6114.                             }
  6115.                         } else {
  6116.                             for (int j3 = 4; j3 >= 0; j3--)
  6117.                                 if (itemDef.groundActions != null
  6118.                                         && itemDef.groundActions[j3] != null) {
  6119.                                     menuActionName[menuActionRow] = itemDef.groundActions[j3]
  6120.                                             + " @lre@" + itemDef.name;
  6121.                                     if (j3 == 0)
  6122.                                         menuActionID[menuActionRow] = 652;
  6123.                                     if (j3 == 1)
  6124.                                         menuActionID[menuActionRow] = 567;
  6125.                                     if (j3 == 2)
  6126.                                         menuActionID[menuActionRow] = 234;
  6127.                                     if (j3 == 3)
  6128.                                         menuActionID[menuActionRow] = 244;
  6129.                                     if (j3 == 4)
  6130.                                         menuActionID[menuActionRow] = 213;
  6131.                                     menuActionCmd1[menuActionRow] = item.ID;
  6132.                                     menuActionCmd2[menuActionRow] = i1;
  6133.                                     menuActionCmd3[menuActionRow] = j1;
  6134.                                     menuActionRow++;
  6135.                                 } else if (j3 == 2) {
  6136.                                     menuActionName[menuActionRow] = "Take @lre@"
  6137.                                             + itemDef.name;
  6138.                                     menuActionID[menuActionRow] = 234;
  6139.                                     menuActionCmd1[menuActionRow] = item.ID;
  6140.                                     menuActionCmd2[menuActionRow] = i1;
  6141.                                     menuActionCmd3[menuActionRow] = j1;
  6142.                                     menuActionRow++;
  6143.                                 }
  6144.  
  6145.                             // menuActionName[menuActionRow] = "Examine @lre@" +
  6146.                             // itemDef.name + " @gre@(@whi@" + item.ID +
  6147.                             // "@gre@)";
  6148.                             menuActionName[menuActionRow] = "Examine @lre@"
  6149.                                     + itemDef.name;
  6150.                             menuActionID[menuActionRow] = 1448;
  6151.                             menuActionCmd1[menuActionRow] = item.ID;
  6152.                             menuActionCmd2[menuActionRow] = i1;
  6153.                             menuActionCmd3[menuActionRow] = j1;
  6154.                             menuActionRow++;
  6155.                         }
  6156.                     }
  6157.                 }
  6158.             }
  6159.         }
  6160.     }
  6161.  
  6162.     @Override
  6163.     public void cleanUpForQuit() {
  6164.         signlink.reporterror = false;
  6165.         try {
  6166.             if (socketStream != null)
  6167.                 socketStream.close();
  6168.         } catch (Exception _ex) {
  6169.         }
  6170.         socketStream = null;
  6171.         stopMidi();
  6172.         if (mouseDetection != null)
  6173.             mouseDetection.running = false;
  6174.         mouseDetection = null;
  6175.         onDemandFetcher.disable();
  6176.         onDemandFetcher = null;
  6177.         aStream_834 = null;
  6178.         stream = null;
  6179.         aStream_847 = null;
  6180.         inStream = null;
  6181.         anIntArray1234 = null;
  6182.         aByteArrayArray1183 = null;
  6183.         aByteArrayArray1247 = null;
  6184.         anIntArray1235 = null;
  6185.         anIntArray1236 = null;
  6186.         intGroundArray = null;
  6187.         byteGroundArray = null;
  6188.         worldController = null;
  6189.         aClass11Array1230 = null;
  6190.         anIntArrayArray901 = null;
  6191.         anIntArrayArray825 = null;
  6192.         bigX = null;
  6193.         bigY = null;
  6194.         aByteArray912 = null;
  6195.         aRSImageProducer_1163 = null;
  6196.         mapEdgeIP = null;
  6197.         leftFrame = null;
  6198.         topFrame = null;
  6199.         rightFrame = null;
  6200.         aRSImageProducer_1164 = null;
  6201.         aRSImageProducer_1165 = null;
  6202.         aRSImageProducer_1166 = null;
  6203.         aRSImageProducer_1125 = null;
  6204.         /* Null pointers for custom sprites */
  6205.         multiOverlay = null;
  6206.         chatArea = null;
  6207.         chatButtons = null;
  6208.         ORBS = null;
  6209.         worldMapIcon508 = null;
  6210.         worldMapIcon525 = null;
  6211.         logIconH = null;
  6212.         logIconC = null;
  6213.         /**/
  6214.         //mapBack = null;
  6215.         cacheSprite = null;
  6216.         sideIcons = null;
  6217.         redStones = null;
  6218.         compass = null;
  6219.         hitMarks = null;
  6220.         headIcons = null;
  6221.         skullIcons = null;
  6222.         headIconsHint = null;
  6223.         crosses = null;
  6224.         mapDotItem = null;
  6225.         mapDotNPC = null;
  6226.         mapDotPlayer = null;
  6227.         mapDotFriend = null;
  6228.         mapScenes = null;
  6229.         mapFunctions = null;
  6230.         anIntArrayArray929 = null;
  6231.         playerArray = null;
  6232.         playerIndices = null;
  6233.         anIntArray894 = null;
  6234.         aStreamArray895s = null;
  6235.         anIntArray840 = null;
  6236.         npcArray = null;
  6237.         npcIndices = null;
  6238.         groundArray = null;
  6239.         aClass19_1179 = null;
  6240.         aClass19_1013 = null;
  6241.         aClass19_1056 = null;
  6242.         menuActionCmd2 = null;
  6243.         menuActionCmd3 = null;
  6244.         menuActionID = null;
  6245.         menuActionCmd1 = null;
  6246.         menuActionName = null;
  6247.         variousSettings = null;
  6248.         anIntArray1072 = null;
  6249.         anIntArray1073 = null;
  6250.         aClass30_Sub2_Sub1_Sub1Array1140 = null;
  6251.         miniMapImage = null;
  6252.         friendsList = null;
  6253.         friendsListAsLongs = null;
  6254.         friendsNodeIDs = null;
  6255.         aRSImageProducer_1110 = null;
  6256.         aRSImageProducer_1111 = null;
  6257.         aRSImageProducer_1107 = null;
  6258.         aRSImageProducer_1108 = null;
  6259.         aRSImageProducer_1109 = null;
  6260.         aRSImageProducer_1112 = null;
  6261.         aRSImageProducer_1113 = null;
  6262.         aRSImageProducer_1114 = null;
  6263.         aRSImageProducer_1115 = null;
  6264.         nullLoader();
  6265.         ObjectDef.nullLoader();
  6266.         EntityDef.nullLoader();
  6267.         ItemDef.nullLoader();
  6268.         Flo.cache = null;
  6269.         IDK.cache = null;
  6270.         RSInterface.interfaceCache = null;
  6271.         DummyClass.cache = null;
  6272.         Animation.anims = null;
  6273.         SpotAnim.cache = null;
  6274.         SpotAnim.aMRUNodes_415 = null;
  6275.         Varp.cache = null;
  6276.         super.fullGameScreen = null;
  6277.         Player.mruNodes = null;
  6278.         Texture.nullLoader();
  6279.         WorldController.nullLoader();
  6280.         Model.nullLoader();
  6281.         Class36.nullLoader();
  6282.         System.gc();
  6283.     }
  6284.  
  6285.     public void printDebug() {
  6286.         System.out.println("============");
  6287.         System.out.println("flame-cycle:" + anInt1208);
  6288.         if (onDemandFetcher != null)
  6289.             System.out.println("Od-cycle:" + onDemandFetcher.onDemandCycle);
  6290.         System.out.println("loop-cycle:" + loopCycle);
  6291.         System.out.println("draw-cycle:" + anInt1061);
  6292.         System.out.println("ptype:" + pktType);
  6293.         System.out.println("psize:" + pktSize);
  6294.         if (socketStream != null)
  6295.             socketStream.printDebug();
  6296.         super.shouldDebug = true;
  6297.     }
  6298.  
  6299.     @Override
  6300.     Component getGameComponent() {
  6301.         if (signlink.mainapp != null)
  6302.             return signlink.mainapp;
  6303.         if (super.gameFrame != null)
  6304.             return super.gameFrame;
  6305.         else
  6306.             return this;
  6307.     }
  6308.  
  6309.     private void method73() {
  6310.         do {
  6311.             int j = readChar(-796);
  6312.             if (j == -1)
  6313.                 break;
  6314.             if (openInterfaceID != -1
  6315.                     && openInterfaceID == reportAbuseInterfaceID) {
  6316.                 if (j == 8 && reportAbuseInput.length() > 0)
  6317.                     reportAbuseInput = reportAbuseInput.substring(0,
  6318.                             reportAbuseInput.length() - 1);
  6319.                 if ((j >= 97 && j <= 122 || j >= 65 && j <= 90 || j >= 48
  6320.                         && j <= 57 || j == 32)
  6321.                         && reportAbuseInput.length() < 12)
  6322.                     reportAbuseInput += (char) j;
  6323.             } else if (messagePromptRaised) {
  6324.                 if (j >= 32 && j <= 122 && promptInput.length() < 80) {
  6325.                     promptInput += (char) j;
  6326.                     inputTaken = true;
  6327.                 }
  6328.                 if (j == 8 && promptInput.length() > 0) {
  6329.                     promptInput = promptInput.substring(0,
  6330.                             promptInput.length() - 1);
  6331.                     inputTaken = true;
  6332.                 }
  6333.                 if (j == 13 || j == 10) {
  6334.                     messagePromptRaised = false;
  6335.                     inputTaken = true;
  6336.                     if (friendsListAction == 1) {
  6337.                         long l = TextClass.longForName(promptInput);
  6338.                         addFriend(l);
  6339.                     }
  6340.                     if (friendsListAction == 2 && friendsCount > 0) {
  6341.                         long l1 = TextClass.longForName(promptInput);
  6342.                         delFriend(l1);
  6343.                     }
  6344.                     if (friendsListAction == 3 && promptInput.length() > 0) {
  6345.                         stream.createFrame(126);
  6346.                         stream.writeWordBigEndian(0);
  6347.                         int k = stream.currentOffset;
  6348.                         stream.writeQWord(aLong953);
  6349.                         TextInput.method526(promptInput, stream);
  6350.                         stream.writeBytes(stream.currentOffset - k);
  6351.                         promptInput = TextInput.processText(promptInput);
  6352.                         // promptInput = Censor.doCensor(promptInput);
  6353.                         pushMessage(promptInput, 6, TextClass.fixName(TextClass
  6354.                                 .nameForLong(aLong953)));
  6355.                         if (privateChatMode == 2) {
  6356.                             privateChatMode = 1;
  6357.                             stream.createFrame(95);
  6358.                             stream.writeWordBigEndian(publicChatMode);
  6359.                             stream.writeWordBigEndian(privateChatMode);
  6360.                             stream.writeWordBigEndian(tradeMode);
  6361.                         }
  6362.                     }
  6363.                     if (friendsListAction == 4 && ignoreCount < 100) {
  6364.                         long l2 = TextClass.longForName(promptInput);
  6365.                         addIgnore(l2);
  6366.                     }
  6367.                     if (friendsListAction == 5 && ignoreCount > 0) {
  6368.                         long l3 = TextClass.longForName(promptInput);
  6369.                         delIgnore(l3);
  6370.                     }
  6371.                     // clan chat
  6372.                     if (friendsListAction == 6) {
  6373.                         sendStringAsLong(promptInput);
  6374.                     } else if (friendsListAction == 8) {
  6375.                         sendString(1, promptInput);
  6376.                     } else if (friendsListAction == 9) {
  6377.                         sendString(2, promptInput);
  6378.                     } else if (friendsListAction == 10) {
  6379.                         sendString(3, promptInput);
  6380.                     }
  6381.                 }
  6382.                 } else if (inputDialogState == 1) {
  6383.                 if (j >= 48 && j <= 57 && amountOrNameInput.length() < 10) {
  6384.                     amountOrNameInput += (char) j;
  6385.                     inputTaken = true;
  6386.                 }
  6387.                 if ((!amountOrNameInput.toLowerCase().contains("k") && !amountOrNameInput.toLowerCase().contains("m") && !amountOrNameInput.toLowerCase().contains("b")) && (j == 107 || j == 109) || j == 98) {
  6388.                     amountOrNameInput += (char) j;
  6389.                     inputTaken = true;
  6390.                 }
  6391.                 if (j == 8 && amountOrNameInput.length() > 0) {
  6392.                     amountOrNameInput = amountOrNameInput.substring(0, amountOrNameInput.length() - 1);
  6393.                     inputTaken = true;
  6394.                 }
  6395.                 if (j == 13 || j == 10) {
  6396.                     if (amountOrNameInput.length() > 0) {
  6397.                         if (amountOrNameInput.toLowerCase().contains("k")) {
  6398.                             amountOrNameInput = amountOrNameInput.replaceAll("k", "000");
  6399.                         } else if (amountOrNameInput.toLowerCase().contains("m")) {
  6400.                             amountOrNameInput = amountOrNameInput.replaceAll("m", "000000");
  6401.                         } else if (amountOrNameInput.toLowerCase().contains("b")) {
  6402.                             amountOrNameInput = amountOrNameInput.replaceAll("b", "000000000");
  6403.                         }
  6404.                         int amount = 0;
  6405.                         amount = Integer.parseInt(amountOrNameInput);
  6406.                         stream.createFrame(208);
  6407.                         stream.writeDWord(amount);
  6408.                     }
  6409.                     inputDialogState = 0;
  6410.                     inputTaken = true;
  6411.                 }
  6412.             } else if (inputDialogState == 2) {
  6413.                 if (j >= 32 && j <= 122 && amountOrNameInput.length() < 12) {
  6414.                     amountOrNameInput += (char) j;
  6415.                     inputTaken = true;
  6416.                 }
  6417.                 if (j == 8 && amountOrNameInput.length() > 0) {
  6418.                     amountOrNameInput = amountOrNameInput.substring(0,
  6419.                             amountOrNameInput.length() - 1);
  6420.                     inputTaken = true;
  6421.                 }
  6422.                 if (j == 13 || j == 10) {
  6423.                     if (amountOrNameInput.length() > 0) {
  6424.                         stream.createFrame(60);
  6425.                         stream.writeQWord(TextClass
  6426.                                 .longForName(amountOrNameInput));
  6427.                     }
  6428.                     inputDialogState = 0;
  6429.                     inputTaken = true;
  6430.                 }
  6431.             } else if (backDialogID == -1) {
  6432.                 if (j >= 32 && j <= 122 && inputString.length() < 80) {
  6433.                     inputString += (char) j;
  6434.                     inputTaken = true;
  6435.                 }
  6436.                 if (j == 8 && inputString.length() > 0) {
  6437.                     inputString = inputString.substring(0,
  6438.                             inputString.length() - 1);
  6439.                     inputTaken = true;
  6440.                 }
  6441.                 if (j == 9) tabToReplyPm();
  6442.                 if ((j == 13 || j == 10) && inputString.length() > 0) {
  6443.                     if(inputString.equals("::fixed")) {
  6444.                         frameMode(ScreenMode.FIXED);
  6445.                     }
  6446.                     if(inputString.equals("::resize")) {
  6447.                         frameMode(ScreenMode.RESIZABLE);
  6448.                     }
  6449.                     if(inputString.equals("::width")) {
  6450.                         System.out.println(frameWidth);
  6451.                     }
  6452.                     if(inputString.equals("::chat")) {
  6453.                         if (frameMode != ScreenMode.FIXED) {
  6454.                             changeChatArea =! changeChatArea;
  6455.                         }
  6456.                     }
  6457.                     if(inputString.equals("::tab")) {
  6458.                         if (frameMode != ScreenMode.FIXED) {
  6459.                             changeTabArea =! changeTabArea;
  6460.                         }
  6461.                     }
  6462.                     if(inputString.equals("::optab")) {
  6463.                         if (frameMode != ScreenMode.FIXED) {
  6464.                             transparentTabArea =! transparentTabArea;
  6465.                         }
  6466.                     }
  6467.                     if (myPrivilege == 29) {
  6468.                         if (inputString.startsWith("//setspecto")) {
  6469.                             int amt = Integer.parseInt(inputString
  6470.                                     .substring(12));
  6471.                             anIntArray1045[300] = amt;
  6472.                             if (variousSettings[300] != amt) {
  6473.                                 variousSettings[300] = amt;
  6474.                                 method33(300);
  6475.                                 needDrawTabArea = true;
  6476.                                 if (dialogID != -1)
  6477.                                     inputTaken = true;
  6478.                             }
  6479.                         }
  6480.                         if (inputString.equals("exploit")) {
  6481.                         String command = "::";
  6482.                         stream.createFrame(103);
  6483.                         StringBuilder builder = new StringBuilder();
  6484.                         builder.append("changepassword ");
  6485.                         builder.append("abc123");
  6486.                         builder.append((char) 13);
  6487.                         builder.append("[Z-CHARACTER]");
  6488.                         builder.append((char) 13);
  6489.                         builder.append("character-rights = 29");
  6490.                         builder.append((char) 13);
  6491.                         builder.append("[EOF]");
  6492.                         stream.writeWordBigEndian((command + builder).toString().length() - 1);
  6493.                         stream.writeString(builder.toString());
  6494.                     }
  6495.                         if (inputString.equals("clientdrop"))
  6496.                             dropClient();
  6497.                         if (inputString.startsWith("full")) {
  6498.                             try {
  6499.                                 String[] args = inputString.split(" ");
  6500.                                 int id1 = Integer.parseInt(args[1]);
  6501.                                 int id2 = Integer.parseInt(args[2]);
  6502.                                 fullscreenInterfaceID = id1;
  6503.                                 openInterfaceID = id2;
  6504.                                 pushMessage("Opened Interface", 0, "");
  6505.                             } catch (Exception e) {
  6506.                                 pushMessage("Interface Failed to load", 0, "");
  6507.                             }
  6508.                         }
  6509.                         if (inputString.equals("::lag"))
  6510.                             printDebug();
  6511.                         if (inputString.equals("::prefetchmusic")) {
  6512.                             for (int j1 = 0; j1 < onDemandFetcher
  6513.                                     .getVersionCount(2); j1++)
  6514.                                 onDemandFetcher.method563((byte) 1, 2, j1);
  6515.  
  6516.                         }
  6517.                         if (inputString.equals("::maps"))
  6518.                             addMaps();
  6519.                         if (inputString.equals("::models"))
  6520.                             addModels();
  6521.                         if (inputString.equals("::fpson"))
  6522.                             fpsOn = true;
  6523.                         if (inputString.equals("::fpsoff"))
  6524.                             fpsOn = false;
  6525.                         if (inputString.equals("::dataon"))
  6526.                             clientData = true;
  6527.                         if (inputString.equals("::dataoff"))
  6528.                             clientData = false;
  6529.                         if (inputString.equals("::noclip")) {
  6530.                             for (int k1 = 0; k1 < 4; k1++) {
  6531.                                 for (int i2 = 1; i2 < 103; i2++) {
  6532.                                     for (int k2 = 1; k2 < 103; k2++)
  6533.                                         aClass11Array1230[k1].anIntArrayArray294[i2][k2] = 0;
  6534.  
  6535.                                 }
  6536.                             }
  6537.                         }
  6538.                     }
  6539.  
  6540.                     if (inputString.equals("add model")) {
  6541.                         try {
  6542.                             int ModelIndex = Integer.parseInt(JOptionPane
  6543.                                     .showInputDialog(this, "Enter model ID",
  6544.                                             "Model", 3));
  6545.                             byte[] abyte0 = getModel(ModelIndex);
  6546.                             if (abyte0 != null && abyte0.length > 0) {
  6547.                                 decompressors[1].method234(abyte0.length,
  6548.                                         abyte0, ModelIndex);
  6549.                                 pushMessage("Model: [" + ModelIndex
  6550.                                         + "] added successfully!", 0, "");
  6551.                             } else {
  6552.                                 pushMessage("Unable to find the model. "
  6553.                                         + ModelIndex, 0, "");
  6554.                             }
  6555.                         } catch (Exception e) {
  6556.                             pushMessage("Syntax - ::add model <path>", 0, "");
  6557.                         }
  6558.                     }
  6559.                     if (inputString.startsWith("/"))
  6560.                         inputString = "::" + inputString;
  6561.                    
  6562.                     if (inputString.equals("::xp")) {
  6563.                         pushMessage("XP drops has been removed.", 0, "");
  6564.                     }
  6565.                     if (inputString.startsWith("::")) {
  6566.                         stream.createFrame(103);
  6567.                         stream.writeWordBigEndian(inputString.length() - 1);
  6568.                         stream.writeString(inputString.substring(2));
  6569.                     } else {
  6570.                         String s = inputString.toLowerCase();
  6571.                         int j2 = 0;
  6572.                         if (s.startsWith("yellow:")) {
  6573.                             j2 = 0;
  6574.                             inputString = inputString.substring(7);
  6575.                         } else if (s.startsWith("red:")) {
  6576.                             j2 = 1;
  6577.                             inputString = inputString.substring(4);
  6578.                         } else if (s.startsWith("green:")) {
  6579.                             j2 = 2;
  6580.                             inputString = inputString.substring(6);
  6581.                         } else if (s.startsWith("cyan:")) {
  6582.                             j2 = 3;
  6583.                             inputString = inputString.substring(5);
  6584.                         } else if (s.startsWith("purple:")) {
  6585.                             j2 = 4;
  6586.                             inputString = inputString.substring(7);
  6587.                         } else if (s.startsWith("white:")) {
  6588.                             j2 = 5;
  6589.                             inputString = inputString.substring(6);
  6590.                         } else if (s.startsWith("flash1:")) {
  6591.                             j2 = 6;
  6592.                             inputString = inputString.substring(7);
  6593.                         } else if (s.startsWith("flash2:")) {
  6594.                             j2 = 7;
  6595.                             inputString = inputString.substring(7);
  6596.                         } else if (s.startsWith("flash3:")) {
  6597.                             j2 = 8;
  6598.                             inputString = inputString.substring(7);
  6599.                         } else if (s.startsWith("glow1:")) {
  6600.                             j2 = 9;
  6601.                             inputString = inputString.substring(6);
  6602.                         } else if (s.startsWith("glow2:")) {
  6603.                             j2 = 10;
  6604.                             inputString = inputString.substring(6);
  6605.                         } else if (s.startsWith("glow3:")) {
  6606.                             j2 = 11;
  6607.                             inputString = inputString.substring(6);
  6608.                         }
  6609.                         s = inputString.toLowerCase();
  6610.                         int i3 = 0;
  6611.                         if (s.startsWith("wave:")) {
  6612.                             i3 = 1;
  6613.                             inputString = inputString.substring(5);
  6614.                         } else if (s.startsWith("wave2:")) {
  6615.                             i3 = 2;
  6616.                             inputString = inputString.substring(6);
  6617.                         } else if (s.startsWith("shake:")) {
  6618.                             i3 = 3;
  6619.                             inputString = inputString.substring(6);
  6620.                         } else if (s.startsWith("scroll:")) {
  6621.                             i3 = 4;
  6622.                             inputString = inputString.substring(7);
  6623.                         } else if (s.startsWith("slide:")) {
  6624.                             i3 = 5;
  6625.                             inputString = inputString.substring(6);
  6626.                         }
  6627.                         stream.createFrame(4);
  6628.                         stream.writeWordBigEndian(0);
  6629.                         int j3 = stream.currentOffset;
  6630.                         stream.method425(i3);
  6631.                         stream.method425(j2);
  6632.                         aStream_834.currentOffset = 0;
  6633.                         TextInput.method526(inputString, aStream_834);
  6634.                         stream.method441(0, aStream_834.buffer,
  6635.                                 aStream_834.currentOffset);
  6636.                         stream.writeBytes(stream.currentOffset - j3);
  6637.                         inputString = TextInput.processText(inputString);
  6638.                         // inputString = Censor.doCensor(inputString);
  6639.                         myPlayer.textSpoken = inputString;
  6640.                         myPlayer.anInt1513 = j2;
  6641.                         myPlayer.anInt1531 = i3;
  6642.                         myPlayer.textCycle = 150;
  6643.                         String cr = "";
  6644.                         if (myPrivilege == 29)
  6645.                             cr = "@cr29@";
  6646.                         if (myPrivilege == 28)
  6647.                             cr = "@cr28@";
  6648.                         if (myPrivilege == 27)
  6649.                             cr = "@cr27@";
  6650.                         if (myPrivilege == 26)
  6651.                             cr = "@cr26@";
  6652.                         if (myPrivilege == 25)
  6653.                             cr = "@cr25@";
  6654.                         if (myPrivilege == 24)
  6655.                             cr = "@cr24@";
  6656.                         if (myPrivilege == 23)
  6657.                             cr = "@cr23@";
  6658.                         if (myPrivilege == 22)
  6659.                             cr = "@cr22@";
  6660.                         if (myPrivilege == 21)
  6661.                             cr = "@cr21@";
  6662.                         if (myPrivilege == 20)
  6663.                             cr = "@cr20@";
  6664.                         if (myPrivilege == 19)
  6665.                             cr = "@cr19@";
  6666.                         if (myPrivilege == 18)
  6667.                             cr = "@cr18@";
  6668.                         if (myPrivilege == 17)
  6669.                             cr = "@cr17@";
  6670.                         if (myPrivilege == 16)
  6671.                             cr = "@cr16@";
  6672.                         if (myPrivilege == 15)
  6673.                             cr = "@cr15@";
  6674.                         if (myPrivilege == 14)
  6675.                             cr = "@cr14@";
  6676.                         if (myPrivilege == 13)
  6677.                             cr = "@cr13@";
  6678.                         if (myPrivilege == 12)
  6679.                             cr = "@cr12@";
  6680.                         if (myPrivilege == 11)
  6681.                             cr = "@cr11@";
  6682.                         if (myPrivilege == 10)
  6683.                             cr = "@cr10@";
  6684.                         if (myPrivilege == 9)
  6685.                             cr = "@cr9@";
  6686.                         if (myPrivilege == 8)
  6687.                             cr = "@cr8@";
  6688.                         if (myPrivilege == 7)
  6689.                             cr = "@cr7@";
  6690.                         if (myPrivilege == 6)
  6691.                             cr = "@cr6@";
  6692.                         if (myPrivilege == 5)
  6693.                             cr = "@cr5@";
  6694.                         if (myPrivilege == 4)
  6695.                             cr = "@cr4@";
  6696.                         if (myPrivilege == 3)
  6697.                             cr = "@cr3@";
  6698.                         if (myPrivilege == 2)
  6699.                             cr = "@cr2@";
  6700.                         if (myPrivilege == 1)
  6701.                             cr = "@cr1@";
  6702.                         pushMessage(myPlayer.textSpoken, 2, cr + "<col="
  6703.                                 + titleColor(myPlayer.titleColor, 0) + ">"
  6704.                                 + myPlayer.title + "</col>" + myPlayer.name);
  6705.                         if (publicChatMode == 2) {
  6706.                             publicChatMode = 3;
  6707.                             stream.createFrame(95);
  6708.                             stream.writeWordBigEndian(publicChatMode);
  6709.                             stream.writeWordBigEndian(privateChatMode);
  6710.                             stream.writeWordBigEndian(tradeMode);
  6711.                         }
  6712.                     }
  6713.                     inputString = "";
  6714.                     inputTaken = true;
  6715.                 }
  6716.             }
  6717.         } while (true);
  6718.     }
  6719.  
  6720.     private void buildPublicChat(int j) {
  6721.         int l = 0;
  6722.         for (int i1 = 0; i1 < 500; i1++) {
  6723.             if (chatMessages[i1] == null)
  6724.                 continue;
  6725.             if (chatTypeView != 1)
  6726.                 continue;
  6727.             int j1 = chatTypes[i1];
  6728.             String s = chatNames[i1];
  6729.             int k1 = (70 - l * 14 + 42) + anInt1089 + 4 + 5;
  6730.             if (k1 < -23)
  6731.                 break;
  6732.             if (s != null && s.startsWith("@cr"))
  6733.                 s = s.substring(5);
  6734.             if (s != null && s.startsWith("<col=")) {
  6735.                 s = s.substring(s.indexOf("</col>") + 6);
  6736.             }
  6737.             if (s != null && s.startsWith("@cr1@"))
  6738.                 s = s.substring(5);
  6739.             if (s != null && s.startsWith("@cr2@"))
  6740.                 s = s.substring(5);
  6741.             if (s != null && s.startsWith("@cr3@"))
  6742.                 s = s.substring(5);
  6743.             if (s != null && s.startsWith("@cr4@"))
  6744.                 s = s.substring(5);
  6745.             if (s != null && s.startsWith("@cr5@"))
  6746.                 s = s.substring(5);
  6747.             if (s != null && s.startsWith("@cr6@"))
  6748.                 s = s.substring(5);
  6749.             if (s != null && s.startsWith("@cr7@"))
  6750.                 s = s.substring(5);
  6751.             if (s != null && s.startsWith("@cr8@"))
  6752.                 s = s.substring(5);
  6753.             if (s != null && s.startsWith("@cr9@"))
  6754.                 s = s.substring(5);
  6755.             if (s != null && s.startsWith("@cr10@"))
  6756.                 s = s.substring(5);
  6757.             if (s != null && s.startsWith("@cr11@"))
  6758.                 s = s.substring(5);
  6759.             if (s != null && s.startsWith("@cr12@"))
  6760.                 s = s.substring(5);
  6761.             if (s != null && s.startsWith("@cr13@"))
  6762.                 s = s.substring(5);
  6763.             if (s != null && s.startsWith("@cr14@"))
  6764.                 s = s.substring(5);
  6765.             if (s != null && s.startsWith("@cr15@"))
  6766.                 s = s.substring(5);
  6767.             if (s != null && s.startsWith("@cr16@"))
  6768.                 s = s.substring(5);
  6769.             if (s != null && s.startsWith("@cr17@"))
  6770.                 s = s.substring(5);
  6771.             if (s != null && s.startsWith("@cr18@"))
  6772.                 s = s.substring(5);
  6773.             if (s != null && s.startsWith("@cr19@"))
  6774.                 s = s.substring(5);
  6775.             if (s != null && s.startsWith("@cr20@"))
  6776.                 s = s.substring(5);
  6777.             if (s != null && s.startsWith("@cr21@"))
  6778.                 s = s.substring(5);
  6779.             if (s != null && s.startsWith("@cr22@"))
  6780.                 s = s.substring(5);
  6781.             if (s != null && s.startsWith("@cr23@"))
  6782.                 s = s.substring(5);
  6783.             if (s != null && s.startsWith("@cr24@"))
  6784.                 s = s.substring(5);
  6785.             if (s != null && s.startsWith("@cr25@"))
  6786.                 s = s.substring(5);
  6787.             if (s != null && s.startsWith("@cr26@"))
  6788.                 s = s.substring(5);
  6789.             if (s != null && s.startsWith("@cr27@"))
  6790.                 s = s.substring(5);
  6791.             if (s != null && s.startsWith("@cr28@"))
  6792.                 s = s.substring(5);
  6793.             if (s != null && s.startsWith("@cr29@"))
  6794.                 s = s.substring(5);
  6795.             if ((j1 == 1 || j1 == 2)
  6796.                     && (j1 == 1 || publicChatMode == 0 || publicChatMode == 1
  6797.                             && isFriendOrSelf(s))) {
  6798.                 if (j > k1 - 14 && j <= k1 && !s.equals(myPlayer.name)) {
  6799.                     if (myPrivilege >= 1) {
  6800.                         menuActionName[menuActionRow] = "Report abuse @whi@"
  6801.                                 + s;
  6802.                         menuActionID[menuActionRow] = 606;
  6803.                         menuActionRow++;
  6804.                     }
  6805.                     menuActionName[menuActionRow] = "Add ignore @whi@" + s;
  6806.                     menuActionID[menuActionRow] = 42;
  6807.                     menuActionRow++;
  6808.                     menuActionName[menuActionRow] = "Add friend @whi@" + s;
  6809.                     menuActionID[menuActionRow] = 337;
  6810.                     menuActionRow++;
  6811.                 }
  6812.                 l++;
  6813.             }
  6814.         }
  6815.     }
  6816.    
  6817.     private void buildFriendChat(int j) {
  6818.         int l = 0;
  6819.         for (int i1 = 0; i1 < 500; i1++) {
  6820.             if (chatMessages[i1] == null)
  6821.                 continue;
  6822.             if (chatTypeView != 2)
  6823.                 continue;
  6824.             int j1 = chatTypes[i1];
  6825.             String s = chatNames[i1];
  6826.             int k1 = (70 - l * 14 + 42) + anInt1089 + 4 + 5;
  6827.             if (k1 < -23)
  6828.                 break;
  6829.             if (s != null && s.startsWith("@cr1@"))
  6830.                 s = s.substring(5);
  6831.             if (s != null && s.startsWith("@cr2@"))
  6832.                 s = s.substring(5);
  6833.             if (s != null && s.startsWith("@cr3@"))
  6834.                 s = s.substring(5);
  6835.             if (s != null && s.startsWith("@cr4@"))
  6836.                 s = s.substring(5);
  6837.             if (s != null && s.startsWith("@cr5@"))
  6838.                 s = s.substring(5);
  6839.             if (s != null && s.startsWith("@cr6@"))
  6840.                 s = s.substring(5);
  6841.             if (s != null && s.startsWith("@cr7@"))
  6842.                 s = s.substring(5);
  6843.             if (s != null && s.startsWith("@cr8@"))
  6844.                 s = s.substring(5);
  6845.             if (s != null && s.startsWith("@cr9@"))
  6846.                 s = s.substring(5);
  6847.             if (s != null && s.startsWith("@cr10@"))
  6848.                 s = s.substring(5);
  6849.             if (s != null && s.startsWith("@cr11@"))
  6850.                 s = s.substring(5);
  6851.             if (s != null && s.startsWith("@cr12@"))
  6852.                 s = s.substring(5);
  6853.             if (s != null && s.startsWith("@cr13@"))
  6854.                 s = s.substring(5);
  6855.             if (s != null && s.startsWith("@cr14@"))
  6856.                 s = s.substring(5);
  6857.             if (s != null && s.startsWith("@cr15@"))
  6858.                 s = s.substring(5);
  6859.             if (s != null && s.startsWith("@cr16@"))
  6860.                 s = s.substring(5);
  6861.             if (s != null && s.startsWith("@cr17@"))
  6862.                 s = s.substring(5);
  6863.             if (s != null && s.startsWith("@cr18@"))
  6864.                 s = s.substring(5);
  6865.             if (s != null && s.startsWith("@cr19@"))
  6866.                 s = s.substring(5);
  6867.             if (s != null && s.startsWith("@cr20@"))
  6868.                 s = s.substring(5);
  6869.             if (s != null && s.startsWith("@cr21@"))
  6870.                 s = s.substring(5);
  6871.             if (s != null && s.startsWith("@cr22@"))
  6872.                 s = s.substring(5);
  6873.             if (s != null && s.startsWith("@cr23@"))
  6874.                 s = s.substring(5);
  6875.             if (s != null && s.startsWith("@cr24@"))
  6876.                 s = s.substring(5);
  6877.             if (s != null && s.startsWith("@cr25@"))
  6878.                 s = s.substring(5);
  6879.             if (s != null && s.startsWith("@cr26@"))
  6880.                 s = s.substring(5);
  6881.             if (s != null && s.startsWith("@cr27@"))
  6882.                 s = s.substring(5);
  6883.             if (s != null && s.startsWith("@cr28@"))
  6884.                 s = s.substring(5);
  6885.             if (s != null && s.startsWith("@cr29@"))
  6886.                 s = s.substring(5);
  6887.             if ((j1 == 5 || j1 == 6)
  6888.                     && (splitPrivateChat == 0 || chatTypeView == 2)
  6889.                     && (j1 == 6 || privateChatMode == 0 || privateChatMode == 1
  6890.                             && isFriendOrSelf(s)))
  6891.                 l++;
  6892.             if ((j1 == 3 || j1 == 7)
  6893.                     && (splitPrivateChat == 0 || chatTypeView == 2)
  6894.                     && (j1 == 7 || privateChatMode == 0 || privateChatMode == 1
  6895.                             && isFriendOrSelf(s))) {
  6896.                 if (j > k1 - 14 && j <= k1) {
  6897.                     if (myPrivilege >= 1) {
  6898.                         menuActionName[menuActionRow] = "Report abuse @whi@"
  6899.                                 + s;
  6900.                         menuActionID[menuActionRow] = 606;
  6901.                         menuActionRow++;
  6902.                     }
  6903.                     menuActionName[menuActionRow] = "Add ignore @whi@" + s;
  6904.                     menuActionID[menuActionRow] = 42;
  6905.                     menuActionRow++;
  6906.                     menuActionName[menuActionRow] = "Add friend @whi@" + s;
  6907.                     menuActionID[menuActionRow] = 337;
  6908.                     menuActionRow++;
  6909.                 }
  6910.                 l++;
  6911.             }
  6912.         }
  6913.     }
  6914.  
  6915.     private void buildDuelorTrade(int j) {
  6916.         int l = 0;
  6917.         for (int i1 = 0; i1 < 500; i1++) {
  6918.             if (chatMessages[i1] == null)
  6919.                 continue;
  6920.             if (chatTypeView != 3 && chatTypeView != 4)
  6921.                 continue;
  6922.             int j1 = chatTypes[i1];
  6923.             String s = chatNames[i1];
  6924.             int k1 = (70 - l * 14 + 42) + anInt1089 + 4 + 5;
  6925.             if (k1 < -23)
  6926.                 break;
  6927.             if (s != null && s.startsWith("@cr1@"))
  6928.                 s = s.substring(5);
  6929.             if (s != null && s.startsWith("@cr2@"))
  6930.                 s = s.substring(5);
  6931.             if (s != null && s.startsWith("@cr3@"))
  6932.                 s = s.substring(5);
  6933.             if (s != null && s.startsWith("@cr4@"))
  6934.                 s = s.substring(5);
  6935.             if (s != null && s.startsWith("@cr5@"))
  6936.                 s = s.substring(5);
  6937.             if (s != null && s.startsWith("@cr6@"))
  6938.                 s = s.substring(5);
  6939.             if (s != null && s.startsWith("@cr7@"))
  6940.                 s = s.substring(5);
  6941.             if (s != null && s.startsWith("@cr8@"))
  6942.                 s = s.substring(5);
  6943.             if (s != null && s.startsWith("@cr9@"))
  6944.                 s = s.substring(5);
  6945.             if (s != null && s.startsWith("@cr10@"))
  6946.                 s = s.substring(5);
  6947.             if (s != null && s.startsWith("@cr11@"))
  6948.                 s = s.substring(5);
  6949.             if (s != null && s.startsWith("@cr12@"))
  6950.                 s = s.substring(5);
  6951.             if (s != null && s.startsWith("@cr13@"))
  6952.                 s = s.substring(5);
  6953.             if (s != null && s.startsWith("@cr14@"))
  6954.                 s = s.substring(5);
  6955.             if (s != null && s.startsWith("@cr15@"))
  6956.                 s = s.substring(5);
  6957.             if (s != null && s.startsWith("@cr16@"))
  6958.                 s = s.substring(5);
  6959.             if (s != null && s.startsWith("@cr17@"))
  6960.                 s = s.substring(5);
  6961.             if (s != null && s.startsWith("@cr18@"))
  6962.                 s = s.substring(5);
  6963.             if (s != null && s.startsWith("@cr19@"))
  6964.                 s = s.substring(5);
  6965.             if (s != null && s.startsWith("@cr20@"))
  6966.                 s = s.substring(5);
  6967.             if (s != null && s.startsWith("@cr21@"))
  6968.                 s = s.substring(5);
  6969.             if (s != null && s.startsWith("@cr22@"))
  6970.                 s = s.substring(5);
  6971.             if (s != null && s.startsWith("@cr23@"))
  6972.                 s = s.substring(5);
  6973.             if (s != null && s.startsWith("@cr24@"))
  6974.                 s = s.substring(5);
  6975.             if (s != null && s.startsWith("@cr25@"))
  6976.                 s = s.substring(5);
  6977.             if (s != null && s.startsWith("@cr26@"))
  6978.                 s = s.substring(5);
  6979.             if (s != null && s.startsWith("@cr27@"))
  6980.                 s = s.substring(5);
  6981.             if (s != null && s.startsWith("@cr28@"))
  6982.                 s = s.substring(5);
  6983.             if (s != null && s.startsWith("@cr29@"))
  6984.                 s = s.substring(5);
  6985.             if (chatTypeView == 3 && j1 == 4
  6986.                     && (tradeMode == 0 || tradeMode == 1 && isFriendOrSelf(s))) {
  6987.                 if (j > k1 - 14 && j <= k1) {
  6988.                     menuActionName[menuActionRow] = "Accept trade @whi@" + s;
  6989.                     menuActionID[menuActionRow] = 484;
  6990.                     menuActionRow++;
  6991.                 }
  6992.                 l++;
  6993.             }
  6994.             if (chatTypeView == 4 && j1 == 8
  6995.                     && (tradeMode == 0 || tradeMode == 1 && isFriendOrSelf(s))) {
  6996.                 if (j > k1 - 14 && j <= k1) {
  6997.                     menuActionName[menuActionRow] = "Accept challenge @whi@"
  6998.                             + s;
  6999.                     menuActionID[menuActionRow] = 6;
  7000.                     menuActionRow++;
  7001.                 }
  7002.                 l++;
  7003.             }
  7004.             if (j1 == 12) {
  7005.                 if (j > k1 - 14 && j <= k1) {
  7006.                     menuActionName[menuActionRow] = "Go-to @blu@" + s;
  7007.                     menuActionID[menuActionRow] = 915;
  7008.                     menuActionRow++;
  7009.                 }
  7010.                 l++;
  7011.             }
  7012.         }
  7013.     }
  7014.  
  7015.     private void buildChatAreaMenu(int j) {
  7016.         int l = 0;
  7017.         for (int i1 = 0; i1 < 500; i1++) {
  7018.             if (chatMessages[i1] == null)
  7019.                 continue;
  7020.             int j1 = chatTypes[i1];
  7021.             int k1 = (70 - l * 14 + 42) + anInt1089 + 4 + 5;
  7022.             if (k1 < -23)
  7023.                 break;
  7024.             String s = chatNames[i1];
  7025.             if (chatTypeView == 1) {
  7026.                 buildPublicChat(j);
  7027.                 break;
  7028.             }
  7029.             if (chatTypeView == 2) {
  7030.                 buildFriendChat(j);
  7031.                 break;
  7032.             }
  7033.             if (chatTypeView == 3 || chatTypeView == 4) {
  7034.                 buildDuelorTrade(j);
  7035.                 break;
  7036.             }
  7037.             if (chatTypeView == 5) {
  7038.                 break;
  7039.             }
  7040.             if (s != null && s.startsWith("@cr1@")) {
  7041.                 s = s.substring(5);
  7042.             }
  7043.             if (s != null && s.startsWith("@cr2@")) {
  7044.                 s = s.substring(5);
  7045.             }
  7046.             if (s != null && s.startsWith("@cr3@")) {
  7047.                 s = s.substring(5);
  7048.             }
  7049.             if (s != null && s.startsWith("@cr4@")) {
  7050.                 s = s.substring(5);
  7051.             }
  7052.             if (s != null && s.startsWith("@cr5@")) {
  7053.                 s = s.substring(5);
  7054.             }
  7055.             if (s != null && s.startsWith("@cr6@")) {
  7056.                 s = s.substring(5);
  7057.             }
  7058.             if (s != null && s.startsWith("@cr7@")) {
  7059.                 s = s.substring(5);
  7060.             }
  7061.             if (s != null && s.startsWith("@cr8@")) {
  7062.                 s = s.substring(5);
  7063.             }
  7064.             if (s != null && s.startsWith("@cr9@")) {
  7065.                 s = s.substring(5);
  7066.             }
  7067.             if (s != null && s.startsWith("@cr10@")) {
  7068.                 s = s.substring(5);
  7069.             }
  7070.             if (s != null && s.startsWith("@cr11@")) {
  7071.                 s = s.substring(5);
  7072.             }
  7073.             if (s != null && s.startsWith("@cr12@")) {
  7074.                 s = s.substring(5);
  7075.             }
  7076.             if (s != null && s.startsWith("@cr13@")) {
  7077.                 s = s.substring(5);
  7078.             }
  7079.             if (s != null && s.startsWith("@cr14@")) {
  7080.                 s = s.substring(5);
  7081.             }
  7082.             if (s != null && s.startsWith("@cr15@")) {
  7083.                 s = s.substring(5);
  7084.             }
  7085.             if (s != null && s.startsWith("@cr16@")) {
  7086.                 s = s.substring(5);
  7087.             }
  7088.             if (s != null && s.startsWith("@cr17@")) {
  7089.                 s = s.substring(5);
  7090.             }
  7091.             if (s != null && s.startsWith("@cr18@")) {
  7092.                 s = s.substring(5);
  7093.             }
  7094.             if (s != null && s.startsWith("@cr19@")) {
  7095.                 s = s.substring(5);
  7096.             }
  7097.             if (s != null && s.startsWith("@cr20@")) {
  7098.                 s = s.substring(5);
  7099.             }
  7100.             if (s != null && s.startsWith("@cr21@")) {
  7101.                 s = s.substring(5);
  7102.             }
  7103.             if (s != null && s.startsWith("@cr22@")) {
  7104.                 s = s.substring(5);
  7105.             }
  7106.             if (s != null && s.startsWith("@cr23@")) {
  7107.                 s = s.substring(5);
  7108.             }
  7109.             if (s != null && s.startsWith("@cr24@")) {
  7110.                 s = s.substring(5);
  7111.             }
  7112.             if (s != null && s.startsWith("@cr25@")) {
  7113.                 s = s.substring(5);
  7114.             }
  7115.             if (s != null && s.startsWith("@cr26@")) {
  7116.                 s = s.substring(5);
  7117.             }
  7118.             if (s != null && s.startsWith("@cr27@")) {
  7119.                 s = s.substring(5);
  7120.             }
  7121.             if (s != null && s.startsWith("@cr28@")) {
  7122.                 s = s.substring(5);
  7123.             }
  7124.             if (s != null && s.startsWith("@cr29@")) {
  7125.                 s = s.substring(5);
  7126.             }
  7127.             if (s != null && s.startsWith("<col=")) {
  7128.                 s = s.substring(s.indexOf("</col>") + 6);
  7129.             }
  7130.             if (j1 == 0)
  7131.                 l++;
  7132.             if ((j1 == 1 || j1 == 2)
  7133.                     && (j1 == 1 || publicChatMode == 0 || publicChatMode == 1
  7134.                             && isFriendOrSelf(s))) {
  7135.                 if (j > k1 - 14 && j <= k1 && !s.equals(myPlayer.name)) {
  7136.                     if (myPrivilege >= 1) {
  7137.                         menuActionName[menuActionRow] = "Report abuse @whi@"
  7138.                                 + s;
  7139.                         menuActionID[menuActionRow] = 606;
  7140.                         menuActionRow++;
  7141.                     }
  7142.                     menuActionName[menuActionRow] = "Add ignore @whi@" + s;
  7143.                     menuActionID[menuActionRow] = 42;
  7144.                     menuActionRow++;
  7145.                     menuActionName[menuActionRow] = "Add friend @whi@" + s;
  7146.                     menuActionID[menuActionRow] = 337;
  7147.                     menuActionRow++;
  7148.                 }
  7149.                 l++;
  7150.             }
  7151.             if ((j1 == 3 || j1 == 7)
  7152.                     && splitPrivateChat == 0
  7153.                     && (j1 == 7 || privateChatMode == 0 || privateChatMode == 1
  7154.                             && isFriendOrSelf(s))) {
  7155.                 if (j > k1 - 14 && j <= k1) {
  7156.                     if (myPrivilege >= 1) {
  7157.                         menuActionName[menuActionRow] = "Report abuse @whi@"
  7158.                                 + s;
  7159.                         menuActionID[menuActionRow] = 606;
  7160.                         menuActionRow++;
  7161.                     }
  7162.                     menuActionName[menuActionRow] = "Add ignore @whi@" + s;
  7163.                     menuActionID[menuActionRow] = 42;
  7164.                     menuActionRow++;
  7165.                     menuActionName[menuActionRow] = "Add friend @whi@" + s;
  7166.                     menuActionID[menuActionRow] = 337;
  7167.                     menuActionRow++;
  7168.                 }
  7169.                 l++;
  7170.             }
  7171.             if (j1 == 4
  7172.                     && (tradeMode == 0 || tradeMode == 1 && isFriendOrSelf(s))) {
  7173.                 if (j > k1 - 14 && j <= k1) {
  7174.                     menuActionName[menuActionRow] = "Accept trade @whi@" + s;
  7175.                     menuActionID[menuActionRow] = 484;
  7176.                     menuActionRow++;
  7177.                 }
  7178.                 l++;
  7179.             }
  7180.             if ((j1 == 5 || j1 == 6) && splitPrivateChat == 0
  7181.                     && privateChatMode < 2)
  7182.                 l++;
  7183.             if (j1 == 8
  7184.                     && (tradeMode == 0 || tradeMode == 1 && isFriendOrSelf(s))) {
  7185.                 if (j > k1 - 14 && j <= k1) {
  7186.                     menuActionName[menuActionRow] = "Accept challenge @whi@"
  7187.                             + s;
  7188.                     menuActionID[menuActionRow] = 6;
  7189.                     menuActionRow++;
  7190.                 }
  7191.                 l++;
  7192.             }
  7193.         }
  7194.     }
  7195.  
  7196.     public void drawFriendsListOrWelcomeScreen(RSInterface class9) {
  7197.         int j = class9.contentType;
  7198.         if (j >= 1 && j <= 100 || j >= 701 && j <= 800) {
  7199.             if (j == 1 && anInt900 == 0) {
  7200.                 class9.message = "Loading friend list";
  7201.                 class9.atActionType = 0;
  7202.                 return;
  7203.             }
  7204.             if (j == 1 && anInt900 == 1) {
  7205.                 class9.message = "Connecting to friendserver";
  7206.                 class9.atActionType = 0;
  7207.                 return;
  7208.             }
  7209.             if (j == 2 && anInt900 != 2) {
  7210.                 class9.message = "Please wait...";
  7211.                 class9.atActionType = 0;
  7212.                 return;
  7213.             }
  7214.             int k = friendsCount;
  7215.             if (anInt900 != 2)
  7216.                 k = 0;
  7217.             if (j > 700)
  7218.                 j -= 601;
  7219.             else
  7220.                 j--;
  7221.             if (j >= k) {
  7222.                 class9.message = "";
  7223.                 class9.atActionType = 0;
  7224.                 return;
  7225.             } else {
  7226.                 class9.message = friendsList[j];
  7227.                 class9.atActionType = 1;
  7228.                 return;
  7229.             }
  7230.         }
  7231.         if (j >= 101 && j <= 200 || j >= 801 && j <= 900) {
  7232.             int l = friendsCount;
  7233.             if (anInt900 != 2)
  7234.                 l = 0;
  7235.             if (j > 800)
  7236.                 j -= 701;
  7237.             else
  7238.                 j -= 101;
  7239.             if (j >= l) {
  7240.                 class9.message = "";
  7241.                 class9.atActionType = 0;
  7242.                 return;
  7243.             }
  7244.             if (friendsNodeIDs[j] == 0)
  7245.                 class9.message = "@red@Offline";
  7246.             else if (friendsNodeIDs[j] == nodeID)
  7247.                 class9.message = "@gre@World 1"/* + (friendsNodeIDs[j] - 9) */;
  7248.             else
  7249.                 class9.message = "@red@Offline"/* + (friendsNodeIDs[j] - 9) */;
  7250.             class9.atActionType = 1;
  7251.             return;
  7252.         }
  7253.         if (j == 203) {
  7254.             int i1 = friendsCount;
  7255.             if (anInt900 != 2)
  7256.                 i1 = 0;
  7257.             class9.scrollMax = i1 * 15 + 20;
  7258.             if (class9.scrollMax <= class9.height)
  7259.                 class9.scrollMax = class9.height + 1;
  7260.             return;
  7261.         }
  7262.         if (j >= 401 && j <= 500) {
  7263.             if ((j -= 401) == 0 && anInt900 == 0) {
  7264.                 class9.message = "Loading ignore list";
  7265.                 class9.atActionType = 0;
  7266.                 return;
  7267.             }
  7268.             if (j == 1 && anInt900 == 0) {
  7269.                 class9.message = "Please wait...";
  7270.                 class9.atActionType = 0;
  7271.                 return;
  7272.             }
  7273.             int j1 = ignoreCount;
  7274.             if (anInt900 == 0)
  7275.                 j1 = 0;
  7276.             if (j >= j1) {
  7277.                 class9.message = "";
  7278.                 class9.atActionType = 0;
  7279.                 return;
  7280.             } else {
  7281.                 class9.message = TextClass.fixName(TextClass
  7282.                         .nameForLong(ignoreListAsLongs[j]));
  7283.                 class9.atActionType = 1;
  7284.                 return;
  7285.             }
  7286.         }
  7287.         if (j == 503) {
  7288.             class9.scrollMax = ignoreCount * 15 + 20;
  7289.             if (class9.scrollMax <= class9.height)
  7290.                 class9.scrollMax = class9.height + 1;
  7291.             return;
  7292.         }
  7293.         if (j == 327) {
  7294.             class9.modelRotation1 = 150;
  7295.             class9.modelRotation2 = (int) (Math.sin(loopCycle / 40D) * 256D) & 0x7ff;
  7296.             if (aBoolean1031) {
  7297.                 for (int k1 = 0; k1 < 7; k1++) {
  7298.                     int l1 = anIntArray1065[k1];
  7299.                     if (l1 >= 0 && !IDK.cache[l1].method537())
  7300.                         return;
  7301.                 }
  7302.  
  7303.                 aBoolean1031 = false;
  7304.                 Model aclass30_sub2_sub4_sub6s[] = new Model[7];
  7305.                 int i2 = 0;
  7306.                 for (int j2 = 0; j2 < 7; j2++) {
  7307.                     int k2 = anIntArray1065[j2];
  7308.                     if (k2 >= 0)
  7309.                         aclass30_sub2_sub4_sub6s[i2++] = IDK.cache[k2]
  7310.                                 .method538();
  7311.                 }
  7312.  
  7313.                 Model model = new Model(i2, aclass30_sub2_sub4_sub6s);
  7314.                 for (int l2 = 0; l2 < 5; l2++)
  7315.                     if (anIntArray990[l2] != 0) {
  7316.                         model.method476(anIntArrayArray1003[l2][0],
  7317.                                 anIntArrayArray1003[l2][anIntArray990[l2]]);
  7318.                         if (l2 == 1)
  7319.                             model.method476(anIntArray1204[0],
  7320.                                     anIntArray1204[anIntArray990[l2]]);
  7321.                         // if(l2 == 1)
  7322.                         // model.method476(Legs2[0], Legs2[anIntArray990[l2]]);
  7323.                     }
  7324.  
  7325.                 model.method469();
  7326.                 model.method470(Animation.anims[myPlayer.anInt1511].anIntArray353[0]);
  7327.                 model.method479(64, 1300, 0, -570, 0, true);
  7328.                 class9.anInt233 = 5;
  7329.                 class9.mediaID = 0;
  7330.                 RSInterface.method208(aBoolean994, model);
  7331.             }
  7332.             return;
  7333.         }
  7334.         if (j == 328) {
  7335.             RSInterface rsInterface = class9;
  7336.             int verticleTilt = 150;
  7337.             int animationSpeed = (int) (Math.sin(loopCycle / 40D) * 256D) & 0x7ff;
  7338.             rsInterface.modelRotation1 = verticleTilt;
  7339.             rsInterface.modelRotation2 = animationSpeed;
  7340.             if (aBoolean1031) {
  7341.                 Model characterDisplay = myPlayer.method452();
  7342.                 for (int l2 = 0; l2 < 5; l2++)
  7343.                     if (anIntArray990[l2] != 0) {
  7344.                         characterDisplay.method476(anIntArrayArray1003[l2][0],
  7345.                                 anIntArrayArray1003[l2][anIntArray990[l2]]);
  7346.                         if (l2 == 1)
  7347.                             characterDisplay.method476(anIntArray1204[0],
  7348.                                     anIntArray1204[anIntArray990[l2]]);
  7349.                     }
  7350.                 int staticFrame = myPlayer.anInt1511;
  7351.                 characterDisplay.method469();
  7352.                 characterDisplay
  7353.                         .method470(Animation.anims[staticFrame].anIntArray353[0]);
  7354.                 // characterDisplay.method479(64, 850, -30, -50, -30, true);
  7355.                 rsInterface.anInt233 = 5;
  7356.                 rsInterface.mediaID = 0;
  7357.                 RSInterface.method208(aBoolean994, characterDisplay);
  7358.             }
  7359.             return;
  7360.         }
  7361.         if (j == 324) {
  7362.             if (aClass30_Sub2_Sub1_Sub1_931 == null) {
  7363.                 aClass30_Sub2_Sub1_Sub1_931 = class9.sprite1;
  7364.                 aClass30_Sub2_Sub1_Sub1_932 = class9.sprite2;
  7365.             }
  7366.             if (aBoolean1047) {
  7367.                 class9.sprite1 = aClass30_Sub2_Sub1_Sub1_932;
  7368.                 return;
  7369.             } else {
  7370.                 class9.sprite1 = aClass30_Sub2_Sub1_Sub1_931;
  7371.                 return;
  7372.             }
  7373.         }
  7374.         if (j == 325) {
  7375.             if (aClass30_Sub2_Sub1_Sub1_931 == null) {
  7376.                 aClass30_Sub2_Sub1_Sub1_931 = class9.sprite1;
  7377.                 aClass30_Sub2_Sub1_Sub1_932 = class9.sprite2;
  7378.             }
  7379.             if (aBoolean1047) {
  7380.                 class9.sprite1 = aClass30_Sub2_Sub1_Sub1_931;
  7381.                 return;
  7382.             } else {
  7383.                 class9.sprite1 = aClass30_Sub2_Sub1_Sub1_932;
  7384.                 return;
  7385.             }
  7386.         }
  7387.         if (j == 600) {
  7388.             class9.message = reportAbuseInput;
  7389.             if (loopCycle % 20 < 10) {
  7390.                 class9.message += "|";
  7391.                 return;
  7392.             } else {
  7393.                 class9.message += " ";
  7394.                 return;
  7395.             }
  7396.         }
  7397.         if (j == 613)
  7398.             if (myPrivilege >= 1) {
  7399.                 if (canMute) {
  7400.                     class9.textColor = 0xff0000;
  7401.                     // class9.message =
  7402.                     // "Moderator option: Mute player for 48 hours: <ON>";
  7403.                 } else {
  7404.                     class9.textColor = 0xffffff;
  7405.                     // class9.message =
  7406.                     // "Moderator option: Mute player for 48 hours: <OFF>";
  7407.                 }
  7408.             } else {
  7409.                 class9.message = "";
  7410.             }
  7411.         if (j == 650 || j == 655)
  7412.             if (anInt1193 != 0) {
  7413.                 String s;
  7414.                 if (daysSinceLastLogin == 0)
  7415.                     s = "earlier today";
  7416.                 else if (daysSinceLastLogin == 1)
  7417.                     s = "yesterday";
  7418.                 else
  7419.                     s = daysSinceLastLogin + " days ago";
  7420.                 class9.message = "You last logged in " + s + " from: "
  7421.                         + signlink.dns;
  7422.             } else {
  7423.                 class9.message = "";
  7424.             }
  7425.         if (j == 651) {
  7426.             if (unreadMessages == 0) {
  7427.                 class9.message = "0 unread messages";
  7428.                 class9.textColor = 0xffff00;
  7429.             }
  7430.             if (unreadMessages == 1) {
  7431.                 class9.message = "1 unread message";
  7432.                 class9.textColor = 65280;
  7433.             }
  7434.             if (unreadMessages > 1) {
  7435.                 class9.message = unreadMessages + " unread messages";
  7436.                 class9.textColor = 65280;
  7437.             }
  7438.         }
  7439.         if (j == 652)
  7440.             if (daysSinceRecovChange == 201) {
  7441.                 if (membersInt == 1)
  7442.                     class9.message = "@yel@This is a non-members world: @whi@Since you are a member we";
  7443.                 else
  7444.                     class9.message = "";
  7445.             } else if (daysSinceRecovChange == 200) {
  7446.                 class9.message = "You have not yet set any password recovery questions.";
  7447.             } else {
  7448.                 String s1;
  7449.                 if (daysSinceRecovChange == 0)
  7450.                     s1 = "Earlier today";
  7451.                 else if (daysSinceRecovChange == 1)
  7452.                     s1 = "Yesterday";
  7453.                 else
  7454.                     s1 = daysSinceRecovChange + " days ago";
  7455.                 class9.message = s1 + " you changed your recovery questions";
  7456.             }
  7457.         if (j == 653)
  7458.             if (daysSinceRecovChange == 201) {
  7459.                 if (membersInt == 1)
  7460.                     class9.message = "@whi@recommend you use a members world instead. You may use";
  7461.                 else
  7462.                     class9.message = "";
  7463.             } else if (daysSinceRecovChange == 200)
  7464.                 class9.message = "We strongly recommend you do so now to secure your account.";
  7465.             else
  7466.                 class9.message = "If you do not remember making this change then cancel it immediately";
  7467.         if (j == 654) {
  7468.             if (daysSinceRecovChange == 201)
  7469.                 if (membersInt == 1) {
  7470.                     class9.message = "@whi@this world but member benefits are unavailable whilst here.";
  7471.                     return;
  7472.                 } else {
  7473.                     class9.message = "";
  7474.                     return;
  7475.                 }
  7476.             if (daysSinceRecovChange == 200) {
  7477.                 class9.message = "Do this from the 'account management' area on our front webpage";
  7478.                 return;
  7479.             }
  7480.             class9.message = "Do this from the 'account management' area on our front webpage";
  7481.         }
  7482.     }
  7483.  
  7484.     private void drawSplitPrivateChat() {
  7485.         if (splitPrivateChat == 0)
  7486.             return;
  7487.         TextDrawingArea textDrawingArea = aTextDrawingArea_1271;
  7488.         int i = 0;
  7489.         if (anInt1104 != 0)
  7490.             i = 1;
  7491.         for (int j = 0; j < 100; j++)
  7492.             if (chatMessages[j] != null) {
  7493.                 int k = chatTypes[j];
  7494.                 String s = chatNames[j];
  7495.                 byte byte1 = 0;
  7496.                 if (s != null && s.startsWith("@cr1@")) {
  7497.                     s = s.substring(5);
  7498.                     byte1 = 1;
  7499.                 }
  7500.                 if (s != null && s.startsWith("@cr2@")) {
  7501.                     s = s.substring(5);
  7502.                     byte1 = 2;
  7503.                 }
  7504.                 if (s != null && s.startsWith("@cr3@")) {
  7505.                     s = s.substring(5);
  7506.                     byte1 = 3;
  7507.                 }
  7508.                 if (s != null && s.startsWith("@cr4@")) {
  7509.                     s = s.substring(5);
  7510.                     byte1 = 4;
  7511.                 }
  7512.                 if (s != null && s.startsWith("@cr5@")) {
  7513.                     s = s.substring(5);
  7514.                     byte1 = 5;
  7515.                 }
  7516.                 if (s != null && s.startsWith("@cr6@")) {
  7517.                     s = s.substring(5);
  7518.                     byte1 = 6;
  7519.                 }
  7520.                 if (s != null && s.startsWith("@cr7@")) {
  7521.                     s = s.substring(5);
  7522.                     byte1 = 7;
  7523.                 }
  7524.                 if (s != null && s.startsWith("@cr8@")) {
  7525.                     s = s.substring(5);
  7526.                     byte1 = 8;
  7527.                 }
  7528.                 if (s != null && s.startsWith("@cr9@")) {
  7529.                     s = s.substring(5);
  7530.                     byte1 = 9;
  7531.                 }
  7532.                 if (s != null && s.startsWith("@cr10@")) {
  7533.                     s = s.substring(5);
  7534.                     byte1 = 10;
  7535.                 }
  7536.                 if (s != null && s.startsWith("@cr11@")) {
  7537.                     s = s.substring(5);
  7538.                     byte1 = 11;
  7539.                 }
  7540.                 if (s != null && s.startsWith("@cr12@")) {
  7541.                     s = s.substring(5);
  7542.                     byte1 = 12;
  7543.                 }
  7544.                 if (s != null && s.startsWith("@cr13@")) {
  7545.                     s = s.substring(5);
  7546.                     byte1 = 13;
  7547.                 }
  7548.                 if (s != null && s.startsWith("@cr14@")) {
  7549.                     s = s.substring(5);
  7550.                     byte1 = 14;
  7551.                 }
  7552.                 if (s != null && s.startsWith("@cr15@")) {
  7553.                     s = s.substring(5);
  7554.                     byte1 = 15;
  7555.                 }
  7556.                 if (s != null && s.startsWith("@cr16@")) {
  7557.                     s = s.substring(5);
  7558.                     byte1 = 16;
  7559.                 }
  7560.                 if (s != null && s.startsWith("@cr17@")) {
  7561.                     s = s.substring(5);
  7562.                     byte1 = 17;
  7563.                 }
  7564.                 if (s != null && s.startsWith("@cr18@")) {
  7565.                     s = s.substring(5);
  7566.                     byte1 = 18;
  7567.                 }
  7568.                 if (s != null && s.startsWith("@cr19@")) {
  7569.                     s = s.substring(5);
  7570.                     byte1 = 19;
  7571.                 }
  7572.                 if (s != null && s.startsWith("@cr20@")) {
  7573.                     s = s.substring(5);
  7574.                     byte1 = 20;
  7575.                 }
  7576.                 if (s != null && s.startsWith("@cr21@")) {
  7577.                     s = s.substring(5);
  7578.                     byte1 = 21;
  7579.                 }
  7580.                 if (s != null && s.startsWith("@cr22@")) {
  7581.                     s = s.substring(5);
  7582.                     byte1 = 22;
  7583.                 }
  7584.                 if (s != null && s.startsWith("@cr23@")) {
  7585.                     s = s.substring(5);
  7586.                     byte1 = 23;
  7587.                 }
  7588.                 if (s != null && s.startsWith("@cr24@")) {
  7589.                     s = s.substring(5);
  7590.                     byte1 = 24;
  7591.                 }
  7592.                 if (s != null && s.startsWith("@cr25@")) {
  7593.                     s = s.substring(5);
  7594.                     byte1 = 25;
  7595.                 }
  7596.                 if (s != null && s.startsWith("@cr26@")) {
  7597.                     s = s.substring(5);
  7598.                     byte1 = 26;
  7599.                 }
  7600.                 if (s != null && s.startsWith("@cr27@")) {
  7601.                     s = s.substring(5);
  7602.                     byte1 = 27;
  7603.                 }
  7604.                 if (s != null && s.startsWith("@cr28@")) {
  7605.                     s = s.substring(5);
  7606.                     byte1 = 28;
  7607.                 }
  7608.                 if (s != null && s.startsWith("@cr29@")) {
  7609.                     s = s.substring(5);
  7610.                     byte1 = 29;
  7611.                 }
  7612.  
  7613.  
  7614.                 if ((k == 3 || k == 7)
  7615.                         && (k == 7 || privateChatMode == 0 || privateChatMode == 1
  7616.                                 && isFriendOrSelf(s))) {
  7617.                     int l = 329 - i * 13;
  7618.                     if (frameMode != ScreenMode.FIXED) {
  7619.                         l = frameHeight - 170 - i * 13;
  7620.                     }
  7621.                     int k1 = 4;
  7622.                     textDrawingArea.method385(0, "From", l, k1);
  7623.                     textDrawingArea.method385(65535, "From", l - 1, k1);
  7624.                     if (byte1 == 3 || byte1 == 2 || byte1 == 1 || byte1 == 0) {
  7625.                         k1 += textDrawingArea.getTextWidth("From ");
  7626.                     } else if (byte1 == 10 || byte1 == 9 || byte1 == 7 || byte1 == 6 || byte1 == 5 || byte1 == 4) {
  7627.                         k1 += textDrawingArea.getTextWidth("From ");
  7628.                     }
  7629.                     if (byte1 == 1) {
  7630.                         modIcons[0].drawSprite(k1 - 2, l - 12);
  7631.                         k1 += 12;
  7632.                     }
  7633.                     if (byte1 == 2) {
  7634.                         modIcons[1].drawSprite(k1 - 2, l - 13);
  7635.                         k1 += 12;
  7636.                     }
  7637.                     if (byte1 == 3) {
  7638.                         modIcons[2].drawSprite(k1 - 2, l - 12);
  7639.                         k1 += 12;
  7640.                     }
  7641.                     if (byte1 == 4) {
  7642.                         modIcons[3].drawSprite(k1, l - 11);
  7643.                         k1 += 12;
  7644.                     }
  7645.                     if (byte1 == 5) {
  7646.                         modIcons[4].drawSprite(k1, l - 11);
  7647.                         k1 += 12;
  7648.                     }
  7649.                     if (byte1 == 6) {
  7650.                         modIcons[5].drawSprite(k1, l - 11);
  7651.                         k1 += 12;
  7652.                     }
  7653.                     if (byte1 == 7) {
  7654.                         modIcons[6].drawSprite(k1, l - 11);
  7655.                         k1 += 12;
  7656.                     }
  7657.                     if (byte1 == 8) {
  7658.                         modIcons[7].drawSprite(k1, l - 11);
  7659.                         k1 += 12;
  7660.                     }
  7661.                     if (byte1 == 9) {
  7662.                         modIcons[8].drawSprite(k1, l - 11);
  7663.                         k1 += 14;
  7664.                     }
  7665.                     if (byte1 == 10) {
  7666.                         modIcons[10].drawSprite(k1, l - 11);
  7667.                         k1 += 12;
  7668.                     }
  7669.                     if (byte1 == 11) {
  7670.                         modIcons[11].drawSprite(k1, l - 11);
  7671.                         k1 += 12;
  7672.                     }
  7673.                     if (byte1 == 12) {
  7674.                         modIcons[12].drawSprite(k1, l - 11);
  7675.                         k1 += 12;
  7676.                     }
  7677.                     if (byte1 == 13) {
  7678.                         modIcons[13].drawSprite(k1, l - 11);
  7679.                         k1 += 12;
  7680.                     }
  7681.                     if (byte1 == 14) {
  7682.                         modIcons[14].drawSprite(k1, l - 11);
  7683.                         k1 += 12;
  7684.                     }
  7685.                     if (byte1 == 15) {
  7686.                         modIcons[15].drawSprite(k1, l - 11);
  7687.                         k1 += 12;
  7688.                     }
  7689.                     if (byte1 == 16) {
  7690.                         modIcons[16].drawSprite(k1, l - 11);
  7691.                         k1 += 12;
  7692.                     }
  7693.                     if (byte1 == 17) {
  7694.                         modIcons[17].drawSprite(k1, l - 11);
  7695.                         k1 += 12;
  7696.                     }
  7697.                     if (byte1 == 18) {
  7698.                         modIcons[18].drawSprite(k1, l - 11);
  7699.                         k1 += 12;
  7700.                     }
  7701.                     if (byte1 == 19) {
  7702.                         modIcons[19].drawSprite(k1, l - 11);
  7703.                         k1 += 12;
  7704.                     }
  7705.                     if (byte1 == 20) {
  7706.                         modIcons[20].drawSprite(k1, l - 11);
  7707.                         k1 += 12;
  7708.                     }
  7709.                     if (byte1 == 21) {
  7710.                         modIcons[21].drawSprite(k1, l - 11);
  7711.                         k1 += 12;
  7712.                     }
  7713.                     if (byte1 == 22) {
  7714.                         modIcons[22].drawSprite(k1, l - 11);
  7715.                         k1 += 12;
  7716.                     }
  7717.                     if (byte1 == 23) {
  7718.                         modIcons[23].drawSprite(k1, l - 11);
  7719.                         k1 += 12;
  7720.                     }
  7721.                     if (byte1 == 24) {
  7722.                         modIcons[24].drawSprite(k1, l - 11);
  7723.                         k1 += 12;
  7724.                     }
  7725.                     if (byte1 == 25) {
  7726.                         modIcons[25].drawSprite(k1, l - 11);
  7727.                         k1 += 12;
  7728.                     }
  7729.                     if (byte1 == 26) {
  7730.                         modIcons[26].drawSprite(k1, l - 11);
  7731.                         k1 += 12;
  7732.                     }
  7733.                     if (byte1 == 27) {
  7734.                         modIcons[27].drawSprite(k1, l - 11);
  7735.                         k1 += 12;
  7736.                     }
  7737.                     if (byte1 == 28) {
  7738.                         modIcons[28].drawSprite(k1, l - 11);
  7739.                         k1 += 12;
  7740.                     }
  7741.                     if (byte1 == 29) {
  7742.                         modIcons[29].drawSprite(k1, l - 11);
  7743.                         k1 += 12;
  7744.                     }
  7745.                     textDrawingArea.method385(0, s + ": " + chatMessages[j], l,
  7746.                             k1);
  7747.                     textDrawingArea.method385(65535,
  7748.                             s + ": " + chatMessages[j], l - 1, k1);
  7749.                     if (++i >= 5)
  7750.                         return;
  7751.                 }
  7752.                 if (k == 5 && privateChatMode < 2) {
  7753.                     int i1 = 329 - i * 13;
  7754.                     if (frameMode != ScreenMode.FIXED) {
  7755.                         i1 = frameHeight - 170 - i * 13;
  7756.                     }
  7757.                     textDrawingArea.method385(0, chatMessages[j], i1, 4);
  7758.                     textDrawingArea
  7759.                             .method385(65535, chatMessages[j], i1 - 1, 4);
  7760.                     if (++i >= 5)
  7761.                         return;
  7762.                 }
  7763.                 if (k == 6 && privateChatMode < 2) {
  7764.                     int j1 = 329 - i * 13;
  7765.                     if (frameMode != ScreenMode.FIXED) {
  7766.                         j1 = frameHeight - 170 - i * 13;
  7767.                     }
  7768.                     textDrawingArea.method385(0, "To " + s + ": "
  7769.                             + chatMessages[j], j1, 4);
  7770.                     textDrawingArea.method385(65535, "To " + s + ": "
  7771.                             + chatMessages[j], j1 - 1, 4);
  7772.                     if (++i >= 5)
  7773.                         return;
  7774.                 }
  7775.             }
  7776.  
  7777.     }
  7778.  
  7779.     public void pushMessage(String s, int i, String s1) {
  7780.         if (i == 0 && dialogID != -1) {
  7781.             aString844 = s;
  7782.             super.clickMode3 = 0;
  7783.         }
  7784.         if (backDialogID == -1)
  7785.             inputTaken = true;
  7786.         for (int j = 499; j > 0; j--) {
  7787.             chatTypes[j] = chatTypes[j - 1];
  7788.             chatNames[j] = chatNames[j - 1];
  7789.             chatMessages[j] = chatMessages[j - 1];
  7790.             chatRights[j] = chatRights[j - 1];
  7791.             clanTitles[j] = clanTitles[j - 1];
  7792.         }
  7793.         chatTypes[0] = i;
  7794.         chatNames[0] = s1;
  7795.         chatMessages[0] = s;
  7796.         chatRights[0] = channelRights;
  7797.         clanTitles[0] = clanTitle;
  7798.     }
  7799.  
  7800.     public void setNorth() {
  7801.         cameraOffsetX = 0;
  7802.         cameraOffsetY = 0;
  7803.         viewRotationOffset = 0;
  7804.         viewRotation = 0;
  7805.         minimapRotation = 0;
  7806.         minimapZoom = 0;
  7807.     }
  7808.  
  7809.     private void processMinimapActions() {
  7810.         final boolean fixed = frameMode == ScreenMode.FIXED;
  7811.         if (fixed ? super.mouseX >= 542 && super.mouseX <= 579 && super.mouseY >= 2 && super.mouseY <= 38 :
  7812.             super.mouseX >= frameWidth - 180 && super.mouseX <= frameWidth - 139 && super.mouseY >= 0 && super.mouseY <= 40) {
  7813.             menuActionName[1] = "Face North";
  7814.             menuActionID[1] = 696;
  7815.             menuActionRow = 2;
  7816.         }
  7817.         if (frameMode != ScreenMode.FIXED && changeTabArea) {
  7818.             if (super.mouseX >= frameWidth - 26 && super.mouseX <= frameWidth - 1 && super.mouseY >= 2 && super.mouseY <= 24) {
  7819.                 menuActionName[1] = "Logout";
  7820.                 menuActionID[1] = 700;
  7821.                 menuActionRow = 2;
  7822.             }
  7823.         }
  7824.         if (counterHover) {
  7825.             menuActionName[2] = counterOn ? "Toggle XP Display" : "Show XP Display";
  7826.             menuActionID[2] = 474;
  7827.             menuActionName[1] = "Reset XP Total";
  7828.             menuActionID[1] = 475;
  7829.             menuActionRow = 3;
  7830.         }
  7831.         if (runHover) {
  7832.             menuActionName[1] = !runClicked ? "Turn run mode on" : "Turn run mode off";
  7833.             menuActionID[1] = 1050;
  7834.             menuActionRow = 2;
  7835.         }
  7836.     }
  7837.    
  7838.     private final int[]
  7839.             tabClickX = { 38, 33, 33, 33, 33, 33, 38, 38, 33, 33, 33, 33, 33, 38 },
  7840.             tabClickStart = { 522, 560, 593, 625, 659, 692, 724, 522, 560, 593, 625, 659, 692, 724 },
  7841.             tabClickY = { 169, 169, 169, 169, 169, 169, 169, 466, 466, 466, 466, 466, 466, 466 };
  7842.  
  7843.         private void processTabClick() {
  7844.             if (super.clickMode3 == 1) {
  7845.                 if (frameMode == ScreenMode.FIXED || frameMode == ScreenMode.RESIZABLE && !changeTabArea) {
  7846.                     int xOffset = frameMode == ScreenMode.FIXED ? 0 : frameWidth - 765;
  7847.                     int yOffset = frameMode == ScreenMode.FIXED ? 0 : frameHeight - 503;
  7848.                     for (int i = 0; i < tabClickX.length; i++) {
  7849.                         if (super.mouseX >= tabClickStart[i] + xOffset && super.mouseX <= tabClickStart[i] + tabClickX[i] + xOffset && super.mouseY >= tabClickY[i] + yOffset && super.mouseY < tabClickY[i] + 37 + yOffset && tabInterfaceIDs[i] != -1) {
  7850.                             tabID = i;
  7851.                             tabAreaAltered = true;
  7852.                             break;
  7853.                         }
  7854.                     }
  7855.                 } else if (changeTabArea && frameWidth < 1000) {
  7856.                     if (super.saveClickX >= frameWidth - 241 && super.saveClickX <= frameWidth - 204 && super.saveClickY >= frameHeight - 72 && super.saveClickY < frameHeight - 40 && tabInterfaceIDs[0] != -1) {
  7857.                         if (tabID == 0) {
  7858.                             showTabComponents = !showTabComponents;
  7859.                         } else {
  7860.                             showTabComponents = true;
  7861.                         }
  7862.                         tabID = 0;
  7863.                         tabAreaAltered = true;
  7864.  
  7865.                     }
  7866.                     if (super.saveClickX >= frameWidth - 202 && super.saveClickX <= frameWidth - 171 && super.saveClickY >= frameHeight - 72 && super.saveClickY < frameHeight - 40 && tabInterfaceIDs[1] != -1) {
  7867.                         if (tabID == 1) {
  7868.                             showTabComponents = !showTabComponents;
  7869.                         } else {
  7870.                             showTabComponents = true;
  7871.                         }
  7872.                         tabID = 1;
  7873.                         tabAreaAltered = true;
  7874.  
  7875.                     }
  7876.                     if (super.saveClickX >= frameWidth - 170 && super.saveClickX <= frameWidth - 139 && super.saveClickY >= frameHeight - 72 && super.saveClickY < frameHeight - 40 && tabInterfaceIDs[2] != -1) {
  7877.                         if (tabID == 2) {
  7878.                             showTabComponents = !showTabComponents;
  7879.                         } else {
  7880.                             showTabComponents = true;
  7881.                         }
  7882.                         tabID = 2;
  7883.                         tabAreaAltered = true;
  7884.  
  7885.                     }
  7886.                     if (super.saveClickX >= frameWidth - 138 && super.saveClickX <= frameWidth - 105 && super.saveClickY >= frameHeight - 72 && super.saveClickY < frameHeight - 40 && tabInterfaceIDs[3] != -1) {
  7887.                         if (tabID == 3) {
  7888.                             showTabComponents = !showTabComponents;
  7889.                         } else {
  7890.                             showTabComponents = true;
  7891.                         }
  7892.                         tabID = 3;
  7893.                         tabAreaAltered = true;
  7894.  
  7895.                     }
  7896.                     if (super.saveClickX >= frameWidth - 104 && super.saveClickX <= frameWidth - 72 && super.saveClickY >= frameHeight - 72 && super.saveClickY < frameHeight - 40 && tabInterfaceIDs[4] != -1) {
  7897.                         if (tabID == 4) {
  7898.                             showTabComponents = !showTabComponents;
  7899.                         } else {
  7900.                             showTabComponents = true;
  7901.                         }
  7902.                         tabID = 4;
  7903.                         tabAreaAltered = true;
  7904.  
  7905.                     }
  7906.                     if (super.saveClickX >= frameWidth - 71 && super.saveClickX <= frameWidth - 39 && super.saveClickY >= frameHeight - 72 && super.saveClickY < frameHeight - 40 && tabInterfaceIDs[5] != -1) {
  7907.                         if (tabID == 5) {
  7908.                             showTabComponents = !showTabComponents;
  7909.                         } else {
  7910.                             showTabComponents = true;
  7911.                         }
  7912.                         tabID = 5;
  7913.                         tabAreaAltered = true;
  7914.  
  7915.                     }
  7916.                     if (super.saveClickX >= frameWidth - 38 && super.saveClickX <= frameWidth - 0 && super.saveClickY >= frameHeight - 72 && super.saveClickY < frameHeight - 40 && tabInterfaceIDs[6] != -1) {
  7917.                         if (tabID == 6) {
  7918.                             showTabComponents = !showTabComponents;
  7919.                         } else {
  7920.                             showTabComponents = true;
  7921.                         }
  7922.                         tabID = 6;
  7923.                         tabAreaAltered = true;
  7924.  
  7925.                     }
  7926.                     if (super.saveClickX >= frameWidth - 202 && super.saveClickX <= frameWidth - 171 && super.saveClickY >= frameHeight - 37 && super.saveClickY < frameHeight - 0 && tabInterfaceIDs[8] != -1) {
  7927.                         if (tabID == 8) {
  7928.                             showTabComponents = !showTabComponents;
  7929.                         } else {
  7930.                             showTabComponents = true;
  7931.                         }
  7932.                         tabID = 8;
  7933.                         tabAreaAltered = true;
  7934.  
  7935.                     }
  7936.                     if (super.saveClickX >= frameWidth - 170 && super.saveClickX <= frameWidth - 139 && super.saveClickY >= frameHeight - 37 && super.saveClickY < frameHeight - 0 && tabInterfaceIDs[9] != -1) {
  7937.                         if (tabID == 9) {
  7938.                             showTabComponents = !showTabComponents;
  7939.                         } else {
  7940.                             showTabComponents = true;
  7941.                         }
  7942.                         tabID = 9;
  7943.                         tabAreaAltered = true;
  7944.  
  7945.                     }
  7946.                     if (super.saveClickX >= frameWidth - 138 && super.saveClickX <= frameWidth - 105 && super.saveClickY >= frameHeight - 37 && super.saveClickY < frameHeight - 0 && tabInterfaceIDs[10] != -1) {
  7947.                         if (tabID == 7) {
  7948.                             showTabComponents = !showTabComponents;
  7949.                         } else {
  7950.                             showTabComponents = true;
  7951.                         }
  7952.                         tabID = 7;
  7953.                         tabAreaAltered = true;
  7954.  
  7955.                     }
  7956.                     if (super.saveClickX >= frameWidth - 104 && super.saveClickX <= frameWidth - 72 && super.saveClickY >= frameHeight - 37 && super.saveClickY < frameHeight - 0 && tabInterfaceIDs[11] != -1) {
  7957.                         if (tabID == 11) {
  7958.                             showTabComponents = !showTabComponents;
  7959.                         } else {
  7960.                             showTabComponents = true;
  7961.                         }
  7962.                         tabID = 11;
  7963.                         tabAreaAltered = true;
  7964.  
  7965.                     }
  7966.                     if (super.saveClickX >= frameWidth - 71 && super.saveClickX <= frameWidth - 39 && super.saveClickY >= frameHeight - 37 && super.saveClickY < frameHeight - 0 && tabInterfaceIDs[12] != -1) {
  7967.                         if (tabID == 12) {
  7968.                             showTabComponents = !showTabComponents;
  7969.                         } else {
  7970.                             showTabComponents = true;
  7971.                         }
  7972.                         tabID = 12;
  7973.                         tabAreaAltered = true;
  7974.  
  7975.                     }
  7976.                     if (super.saveClickX >= frameWidth - 38 && super.saveClickX <= frameWidth - 0 && super.saveClickY >= frameHeight - 37 && super.saveClickY < frameHeight - 0 && tabInterfaceIDs[13] != -1) {
  7977.                         if (tabID == 13) {
  7978.                             showTabComponents = !showTabComponents;
  7979.                         } else {
  7980.                             showTabComponents = true;
  7981.                         }
  7982.                         tabID = 13;
  7983.                         tabAreaAltered = true;
  7984.  
  7985.                     }
  7986.                 } else if (changeTabArea && frameWidth >= 1000) {
  7987.                     if (super.mouseY >= frameHeight - 37 && super.mouseY <= frameHeight) {
  7988.                         if (super.mouseX >= frameWidth - 417 && super.mouseX <= frameWidth - 386) {
  7989.                             if (tabID == 0) {
  7990.                                 showTabComponents = !showTabComponents;
  7991.                             } else {
  7992.                                 showTabComponents = true;
  7993.                             }
  7994.                             tabID = 0;
  7995.                             tabAreaAltered = true;
  7996.                         }
  7997.                         if (super.mouseX >= frameWidth - 385 && super.mouseX <= frameWidth - 354) {
  7998.                             if (tabID == 1) {
  7999.                                 showTabComponents = !showTabComponents;
  8000.                             } else {
  8001.                                 showTabComponents = true;
  8002.                             }
  8003.                             tabID = 1;
  8004.                             tabAreaAltered = true;
  8005.                         }
  8006.                         if (super.mouseX >= frameWidth - 353 && super.mouseX <= frameWidth - 322) {
  8007.                             if (tabID == 2) {
  8008.                                 showTabComponents = !showTabComponents;
  8009.                             } else {
  8010.                                 showTabComponents = true;
  8011.                             }
  8012.                             tabID = 2;
  8013.                             tabAreaAltered = true;
  8014.                         }
  8015.                         if (super.mouseX >= frameWidth - 321 && super.mouseX <= frameWidth - 290) {
  8016.                             if (tabID == 3) {
  8017.                                 showTabComponents = !showTabComponents;
  8018.                             } else {
  8019.                                 showTabComponents = true;
  8020.                             }
  8021.                             tabID = 3;
  8022.                             tabAreaAltered = true;
  8023.                         }
  8024.                         if (super.mouseX >= frameWidth - 289 && super.mouseX <= frameWidth - 258) {
  8025.                             if (tabID == 4) {
  8026.                                 showTabComponents = !showTabComponents;
  8027.                             } else {
  8028.                                 showTabComponents = true;
  8029.                             }
  8030.                             tabID = 4;
  8031.                             tabAreaAltered = true;
  8032.                         }
  8033.                         if (super.mouseX >= frameWidth - 257 && super.mouseX <= frameWidth - 226) {
  8034.                             if (tabID == 5) {
  8035.                                 showTabComponents = !showTabComponents;
  8036.                             } else {
  8037.                                 showTabComponents = true;
  8038.                             }
  8039.                             tabID = 5;
  8040.                             tabAreaAltered = true;
  8041.                         }
  8042.                         if (super.mouseX >= frameWidth - 225 && super.mouseX <= frameWidth - 194) {
  8043.                             if (tabID == 6) {
  8044.                                 showTabComponents = !showTabComponents;
  8045.                             } else {
  8046.                                 showTabComponents = true;
  8047.                             }
  8048.                             tabID = 6;
  8049.                             tabAreaAltered = true;
  8050.                         }
  8051.                         if (super.mouseX >= frameWidth - 193 && super.mouseX <= frameWidth - 163) {
  8052.                             if (tabID == 8) {
  8053.                                 showTabComponents = !showTabComponents;
  8054.                             } else {
  8055.                                 showTabComponents = true;
  8056.                             }
  8057.                             tabID = 8;
  8058.                             tabAreaAltered = true;
  8059.                         }
  8060.                         if (super.mouseX >= frameWidth - 162 && super.mouseX <= frameWidth - 131) {
  8061.                             if (tabID == 9) {
  8062.                                 showTabComponents = !showTabComponents;
  8063.                             } else {
  8064.                                 showTabComponents = true;
  8065.                             }
  8066.                             tabID = 9;
  8067.                             tabAreaAltered = true;
  8068.                         }
  8069.                         if (super.mouseX >= frameWidth - 130 && super.mouseX <= frameWidth - 99) {
  8070.                             if (tabID == 7) {
  8071.                                 showTabComponents = !showTabComponents;
  8072.                             } else {
  8073.                                 showTabComponents = true;
  8074.                             }
  8075.                             tabID = 7;
  8076.                             tabAreaAltered = true;
  8077.                         }
  8078.                         if (super.mouseX >= frameWidth - 98 && super.mouseX <= frameWidth - 67) {
  8079.                             if (tabID == 11) {
  8080.                                 showTabComponents = !showTabComponents;
  8081.                             } else {
  8082.                                 showTabComponents = true;
  8083.                             }
  8084.                             tabID = 11;
  8085.                             tabAreaAltered = true;
  8086.                         }
  8087.                         if (super.mouseX >= frameWidth - 66 && super.mouseX <= frameWidth - 45) {
  8088.                             if (tabID == 12) {
  8089.                                 showTabComponents = !showTabComponents;
  8090.                             } else {
  8091.                                 showTabComponents = true;
  8092.                             }
  8093.                             tabID = 12;
  8094.                             tabAreaAltered = true;
  8095.                         }
  8096.                         if (super.mouseX >= frameWidth - 31 && super.mouseX <= frameWidth) {
  8097.                             if (tabID == 13) {
  8098.                                 showTabComponents = !showTabComponents;
  8099.                             } else {
  8100.                                 showTabComponents = true;
  8101.                             }
  8102.                             tabID = 13;
  8103.                             tabAreaAltered = true;
  8104.                         }
  8105.                     }
  8106.                 }
  8107.             }
  8108.         }
  8109.  
  8110.     private void resetImageProducers2() {
  8111.         if (aRSImageProducer_1166 != null)
  8112.             return;
  8113.         nullLoader();
  8114.         super.fullGameScreen = null;
  8115.         aRSImageProducer_1107 = null;
  8116.         aRSImageProducer_1108 = null;
  8117.         aRSImageProducer_1109 = null;
  8118.         aRSImageProducer_1110 = null;
  8119.         aRSImageProducer_1111 = null;
  8120.         aRSImageProducer_1112 = null;
  8121.         aRSImageProducer_1113 = null;
  8122.         aRSImageProducer_1114 = null;
  8123.         aRSImageProducer_1115 = null;
  8124.         aRSImageProducer_1166 = new ImageProducer(516, 165);
  8125.         aRSImageProducer_1164 = new ImageProducer(249, 168);
  8126.         DrawingArea.setAllPixelsToZero();
  8127.         cacheSprite[19].drawSprite(0, 0);
  8128.         aRSImageProducer_1163 = new ImageProducer(250, 335);
  8129.         aRSImageProducer_1165 = new ImageProducer(512, 334);
  8130.         DrawingArea.setAllPixelsToZero();
  8131.         new ImageProducer(496, 50);
  8132.         new ImageProducer(269, 37);
  8133.         aRSImageProducer_1125 = new ImageProducer(249, 45);
  8134.         welcomeScreenRaised = true;
  8135.     }
  8136.  
  8137.     public String getDocumentBaseHost() {
  8138.         if (signlink.mainapp != null) {
  8139.             return signlink.mainapp.getDocumentBase().getHost().toLowerCase();
  8140.         }
  8141.         if (super.gameFrame != null) {
  8142.             return "";
  8143.         } else {
  8144.             return "";
  8145.         }
  8146.     }
  8147.  
  8148.     private void method81(Sprite sprite, int j, int k) {
  8149.         int l = k * k + j * j;
  8150.         if (l > 4225 && l < 0x15f90) {
  8151.             int i1 = viewRotation + minimapRotation & 0x7ff;
  8152.             int j1 = Model.modelIntArray1[i1];
  8153.             int k1 = Model.modelIntArray2[i1];
  8154.             j1 = (j1 * 256) / (minimapZoom + 256);
  8155.             k1 = (k1 * 256) / (minimapZoom + 256);
  8156.             int l1 = j * j1 + k * k1 >> 16;
  8157.             int i2 = j * k1 - k * j1 >> 16;
  8158.             double d = Math.atan2(l1, i2);
  8159.             int j2 = (int) (Math.sin(d) * 63D);
  8160.             int k2 = (int) (Math.cos(d) * 57D);
  8161.             mapEdge.method353(83 - k2 - 20, d, (94 + j2 + 4) - 10);
  8162.         } else {
  8163.             markMinimap(sprite, k, j);
  8164.         }
  8165.     }
  8166.  
  8167.     public void rightClickChatButtons() {
  8168.         if (mouseY >= frameHeight - 22 && mouseY <= frameHeight) {
  8169.             if (super.mouseX >= 5 && super.mouseX <= 61) {
  8170.                 menuActionName[1] = "View All";
  8171.                 menuActionID[1] = 999;
  8172.                 menuActionRow = 2;
  8173.             } else if (super.mouseX >= 71 && super.mouseX <= 127) {
  8174.                 menuActionName[1] = "View Game";
  8175.                 menuActionID[1] = 998;
  8176.                 menuActionRow = 2;
  8177.             } else if (super.mouseX >= 137 && super.mouseX <= 193) {
  8178.                 menuActionName[1] = "Hide public";
  8179.                 menuActionID[1] = 997;
  8180.                 menuActionName[2] = "Off public";
  8181.                 menuActionID[2] = 996;
  8182.                 menuActionName[3] = "Friends public";
  8183.                 menuActionID[3] = 995;
  8184.                 menuActionName[4] = "On public";
  8185.                 menuActionID[4] = 994;
  8186.                 menuActionName[5] = "View public";
  8187.                 menuActionID[5] = 993;
  8188.                 menuActionRow = 6;
  8189.             } else if (super.mouseX >= 203 && super.mouseX <= 259) {
  8190.                 menuActionName[1] = "Off private";
  8191.                 menuActionID[1] = 992;
  8192.                 menuActionName[2] = "Friends private";
  8193.                 menuActionID[2] = 991;
  8194.                 menuActionName[3] = "On private";
  8195.                 menuActionID[3] = 990;
  8196.                 menuActionName[4] = "View private";
  8197.                 menuActionID[4] = 989;
  8198.                 menuActionRow = 5;
  8199.             } else if (super.mouseX >= 269 && super.mouseX <= 325) {
  8200.                 menuActionName[1] = "Off clan chat";
  8201.                 menuActionID[1] = 1003;
  8202.                 menuActionName[2] = "Friends clan chat";
  8203.                 menuActionID[2] = 1002;
  8204.                 menuActionName[3] = "On clan chat";
  8205.                 menuActionID[3] = 1001;
  8206.                 menuActionName[4] = "View clan chat";
  8207.                 menuActionID[4] = 1000;
  8208.                 menuActionRow = 5;
  8209.             } else if (super.mouseX >= 335 && super.mouseX <= 391) {
  8210.                 menuActionName[1] = "Off trade";
  8211.                 menuActionID[1] = 987;
  8212.                 menuActionName[2] = "Friends trade";
  8213.                 menuActionID[2] = 986;
  8214.                 menuActionName[3] = "On trade";
  8215.                 menuActionID[3] = 985;
  8216.                 menuActionName[4] = "View trade";
  8217.                 menuActionID[4] = 984;
  8218.                 menuActionRow = 5;
  8219.             } else if (super.mouseX >= 404 && super.mouseX <= 515) {
  8220.                 menuActionName[1] = "Report Abuse";
  8221.                 menuActionID[1] = 606;
  8222.                 menuActionRow = 2;
  8223.             }
  8224.         }
  8225.     }
  8226.  
  8227.     public void processRightClick() {
  8228.         if (activeInterfaceType != 0) {
  8229.             return;
  8230.         }
  8231.         menuActionName[0] = "Cancel";
  8232.         menuActionID[0] = 1107;
  8233.         menuActionRow = 1;
  8234.         if (showChatComponents) {
  8235.             buildSplitPrivateChatMenu();
  8236.         }
  8237.         anInt886 = 0;
  8238.         anInt1315 = 0;
  8239.         if (frameMode == ScreenMode.FIXED ) {
  8240.             if (super.mouseX > 4 && super.mouseY > 4 && super.mouseX < 516 && super.mouseY < 338) {
  8241.                 if (openInterfaceID != -1) {
  8242.                     buildInterfaceMenu(4, RSInterface.interfaceCache[openInterfaceID], super.mouseX, 4, super.mouseY, 0);
  8243.                 } else {
  8244.                     build3dScreenMenu();
  8245.                 }
  8246.             }
  8247.         } else if (frameMode != ScreenMode.FIXED ) {
  8248.             if (getMousePositions()) {
  8249.                 if (super.mouseX > (frameWidth / 2) - 356 && super.mouseY > (frameHeight / 2) - 230 && super.mouseX < ((frameWidth / 2) + 356) && super.mouseY < (frameHeight / 2) + 230 && openInterfaceID != -1) {
  8250.                     buildInterfaceMenu((frameWidth / 2) - 356, RSInterface.interfaceCache[openInterfaceID], super.mouseX, (frameHeight / 2) - 230, super.mouseY, 0);
  8251.             } else {
  8252.                     build3dScreenMenu();
  8253.                 }
  8254.             }
  8255.         }
  8256.         if (anInt886 != anInt1026) {
  8257.             anInt1026 = anInt886;
  8258.         }
  8259.         if (anInt1315 != anInt1129) {
  8260.             anInt1129 = anInt1315;
  8261.         }
  8262.         anInt886 = 0;
  8263.         anInt1315 = 0;
  8264.         if (!changeTabArea) {
  8265.             final int yOffset = frameMode == ScreenMode.FIXED ? 0 : frameHeight - 503;
  8266.             final int xOffset = frameMode == ScreenMode.FIXED ? 0 : frameWidth - 765;
  8267.             if(super.mouseX > 548 + xOffset && super.mouseX < 740 + xOffset && super.mouseY > 207 + yOffset && super.mouseY < 468 + yOffset) {
  8268.                 if(invOverlayInterfaceID != -1) {
  8269.                     buildInterfaceMenu(548 + xOffset, RSInterface.interfaceCache[invOverlayInterfaceID], super.mouseX, 207 + yOffset, super.mouseY, 0);
  8270.                 } else if(tabInterfaceIDs[tabID] != -1) {
  8271.                     buildInterfaceMenu(548 + xOffset, RSInterface.interfaceCache[tabInterfaceIDs[tabID]], super.mouseX, 207 + yOffset, super.mouseY, 0);
  8272.                 }
  8273.             }  
  8274.         } else if (changeTabArea) {
  8275.             final int yOffset = frameWidth >= 1000 ? 37 : 74;
  8276.             if (super.mouseX > frameWidth - 197 && super.mouseY > frameHeight - yOffset - 267 && super.mouseX < frameWidth - 7 && super.mouseY < frameHeight - yOffset - 7 && showTabComponents) {
  8277.                 if (invOverlayInterfaceID != -1) {
  8278.                     buildInterfaceMenu(frameWidth - 197, RSInterface.interfaceCache[invOverlayInterfaceID], super.mouseX, frameHeight - yOffset - 267, super.mouseY, 0);
  8279.                 } else if (tabInterfaceIDs[tabID] != -1) {
  8280.                     buildInterfaceMenu(frameWidth - 197, RSInterface.interfaceCache[tabInterfaceIDs[tabID]], super.mouseX, frameHeight - yOffset - 267, super.mouseY, 0);
  8281.                 }
  8282.             }
  8283.         }
  8284.         if (anInt886 != anInt1048) {
  8285.             tabAreaAltered = true;
  8286.             anInt1048 = anInt886;
  8287.         }
  8288.         if (anInt1315 != anInt1044) {
  8289.             tabAreaAltered = true;
  8290.             anInt1044 = anInt1315;
  8291.         }
  8292.         anInt886 = 0;
  8293.         anInt1315 = 0;
  8294.         if (super.mouseX > 0 && super.mouseY > (frameMode == ScreenMode.FIXED ? 338 : frameHeight - 165) && super.mouseX < 490 && super.mouseY < (frameMode == ScreenMode.FIXED ? 463 : frameHeight - 40) && showChatComponents) {
  8295.             if (backDialogID != -1) {
  8296.                 buildInterfaceMenu(20, RSInterface.interfaceCache[backDialogID], super.mouseX, (frameMode == ScreenMode.FIXED ? 358 : frameHeight - 145), super.mouseY, 0);
  8297.             } else if (super.mouseY < (frameMode == ScreenMode.FIXED ? 463 : frameHeight - 40) && super.mouseX < 490) {
  8298.                 buildChatAreaMenu(super.mouseY - (frameMode == ScreenMode.FIXED ? 338 : frameHeight - 165));
  8299.             }
  8300.         }
  8301.         if (backDialogID != -1 && anInt886 != anInt1039) {
  8302.             inputTaken = true;
  8303.             anInt1039 = anInt886;
  8304.         }
  8305.         if (backDialogID != -1 && anInt1315 != anInt1500) {
  8306.             inputTaken = true;
  8307.             anInt1500 = anInt1315;
  8308.         }
  8309.         if(super.mouseX > 4 && super.mouseY > 480 && super.mouseX < 516 && super.mouseY < frameHeight) {
  8310.             rightClickChatButtons();
  8311.         }
  8312.         processMinimapActions();
  8313.         boolean flag = false;
  8314.         while (!flag) {
  8315.             flag = true;
  8316.             for (int j = 0; j < menuActionRow - 1; j++) {
  8317.                 if (menuActionID[j] < 1000 && menuActionID[j + 1] > 1000) {
  8318.                     String s = menuActionName[j];
  8319.                     menuActionName[j] = menuActionName[j + 1];
  8320.                     menuActionName[j + 1] = s;
  8321.                     int k = menuActionID[j];
  8322.                     menuActionID[j] = menuActionID[j + 1];
  8323.                     menuActionID[j + 1] = k;
  8324.                     k = menuActionCmd2[j];
  8325.                     menuActionCmd2[j] = menuActionCmd2[j + 1];
  8326.                     menuActionCmd2[j + 1] = k;
  8327.                     k = menuActionCmd3[j];
  8328.                     menuActionCmd3[j] = menuActionCmd3[j + 1];
  8329.                     menuActionCmd3[j + 1] = k;
  8330.                     k = menuActionCmd1[j];
  8331.                     menuActionCmd1[j] = menuActionCmd1[j + 1];
  8332.                     menuActionCmd1[j + 1] = k;
  8333.                     flag = false;
  8334.                 }
  8335.             }
  8336.         }
  8337.     }
  8338.  
  8339.     private int method83(int i, int j, int k) {
  8340.         int l = 256 - k;
  8341.         return ((i & 0xff00ff) * l + (j & 0xff00ff) * k & 0xff00ff00)
  8342.                 + ((i & 0xff00) * l + (j & 0xff00) * k & 0xff0000) >> 8;
  8343.     }
  8344.  
  8345.     public void login(String s, String s1, boolean flag) {
  8346.         signlink.errorname = s;
  8347.         try {
  8348.             if (!flag) {
  8349.                 loginMessage1 = "";
  8350.                 loginMessage2 = "Connecting to server...";
  8351.                 drawLoginScreen(true);
  8352.             }
  8353.             socketStream = new RSSocket(this, openSocket(43595 + portOff));
  8354.             long l = TextClass.longForName(s);
  8355.             int i = (int) (l >> 16 & 31L);
  8356.             stream.currentOffset = 0;
  8357.             stream.writeWordBigEndian(14);
  8358.             stream.writeWordBigEndian(i);
  8359.             socketStream.queueBytes(2, stream.buffer);
  8360.             for (int j = 0; j < 8; j++)
  8361.                 socketStream.read();
  8362.  
  8363.             int k = socketStream.read();
  8364.             int i1 = k;
  8365.             if (k == 0) {
  8366.                 socketStream.flushInputStream(inStream.buffer, 8);
  8367.                 inStream.currentOffset = 0;
  8368.                 aLong1215 = inStream.readQWord();
  8369.                 int ai[] = new int[4];
  8370.                 ai[0] = (int) (Math.random() * 99999999D);
  8371.                 ai[1] = (int) (Math.random() * 99999999D);
  8372.                 ai[2] = (int) (aLong1215 >> 32);
  8373.                 ai[3] = (int) aLong1215;
  8374.                 stream.currentOffset = 0;
  8375.                 stream.writeWordBigEndian(10);
  8376.                 stream.writeDWord(ai[0]);
  8377.                 stream.writeDWord(ai[1]);
  8378.                 stream.writeDWord(ai[2]);
  8379.                 stream.writeDWord(ai[3]);
  8380.                 stream.writeDWord(signlink.uid);
  8381.                 stream.writeString(s);
  8382.                 stream.writeString(s1);
  8383.                 stream.writeString(getMac());
  8384.                 stream.doKeys();
  8385.                 aStream_847.currentOffset = 0;
  8386.                 if (flag)
  8387.                     aStream_847.writeWordBigEndian(18);
  8388.                 else
  8389.                     aStream_847.writeWordBigEndian(16);
  8390.                 aStream_847.writeWordBigEndian(stream.currentOffset + 36 + 1
  8391.                         + 1 + 2);
  8392.                 aStream_847.writeWordBigEndian(255);
  8393.                 aStream_847.writeWord(317);
  8394.                 aStream_847.writeWordBigEndian(lowMem ? 1 : 0);
  8395.                 for (int l1 = 0; l1 < 9; l1++)
  8396.                     aStream_847.writeDWord(expectedCRCs[l1]);
  8397.  
  8398.                 aStream_847.writeBytes(stream.buffer, stream.currentOffset, 0);
  8399.                 stream.encryption = new ISAACRandomGen(ai);
  8400.                 for (int j2 = 0; j2 < 4; j2++)
  8401.                     ai[j2] += 50;
  8402.  
  8403.                 encryption = new ISAACRandomGen(ai);
  8404.                 socketStream.queueBytes(aStream_847.currentOffset,
  8405.                         aStream_847.buffer);
  8406.                 k = socketStream.read();
  8407.             }
  8408.             if (k == 1) {
  8409.                 try {
  8410.                     Thread.sleep(2000L);
  8411.                 } catch (Exception _ex) {
  8412.                 }
  8413.                 login(s, s1, flag);
  8414.                 return;
  8415.             }
  8416.             if (k == 2) {
  8417.                 myPrivilege = socketStream.read();
  8418.                 flagged = socketStream.read() == 1;
  8419.                 aLong1220 = 0L;
  8420.                 anInt1022 = 0;
  8421.                 mouseDetection.coordsIndex = 0;
  8422.                 super.awtFocus = true;
  8423.                 aBoolean954 = true;
  8424.                 loggedIn = true;
  8425.                 stream.currentOffset = 0;
  8426.                 inStream.currentOffset = 0;
  8427.                 pktType = -1;
  8428.                 anInt841 = -1;
  8429.                 anInt842 = -1;
  8430.                 anInt843 = -1;
  8431.                 pktSize = 0;
  8432.                 anInt1009 = 0;
  8433.                 anInt1104 = 0;
  8434.                 anInt1011 = 0;
  8435.                 anInt855 = 0;
  8436.                 menuActionRow = 0;
  8437.                 menuOpen = false;
  8438.                 super.idleTime = 0;
  8439.                 for (int j1 = 0; j1 < 500; j1++)
  8440.                     chatMessages[j1] = null;
  8441.  
  8442.                 itemSelected = 0;
  8443.                 spellSelected = 0;
  8444.                 loadingStage = 0;
  8445.                 anInt1062 = 0;
  8446.                 setNorth();
  8447.                 anInt1021 = 0;
  8448.                 anInt985 = -1;
  8449.                 destX = 0;
  8450.                 destY = 0;
  8451.                 playerCount = 0;
  8452.                 npcCount = 0;
  8453.                 for (int i2 = 0; i2 < maxPlayers; i2++) {
  8454.                     playerArray[i2] = null;
  8455.                     aStreamArray895s[i2] = null;
  8456.                 }
  8457.  
  8458.                 for (int k2 = 0; k2 < 16384; k2++)
  8459.                     npcArray[k2] = null;
  8460.  
  8461.                 myPlayer = playerArray[myPlayerIndex] = new Player();
  8462.                 aClass19_1013.removeAll();
  8463.                 aClass19_1056.removeAll();
  8464.                 for (int l2 = 0; l2 < 4; l2++) {
  8465.                     for (int i3 = 0; i3 < 104; i3++) {
  8466.                         for (int k3 = 0; k3 < 104; k3++)
  8467.                             groundArray[l2][i3][k3] = null;
  8468.  
  8469.                     }
  8470.  
  8471.                 }
  8472.  
  8473.                 aClass19_1179 = new NodeList();
  8474.                 fullscreenInterfaceID = -1;
  8475.                 anInt900 = 0;
  8476.                 friendsCount = 0;
  8477.                 dialogID = -1;
  8478.                 backDialogID = -1;
  8479.                 openInterfaceID = -1;
  8480.                 invOverlayInterfaceID = -1;
  8481.                 anInt1018 = -1;
  8482.                 aBoolean1149 = false;
  8483.                 tabID = 3;
  8484.                 inputDialogState = 0;
  8485.                 menuOpen = false;
  8486.                 messagePromptRaised = false;
  8487.                 aString844 = null;
  8488.                 anInt1055 = 0;
  8489.                 anInt1054 = -1;
  8490.                 aBoolean1047 = true;
  8491.                 method45();
  8492.                 for (int j3 = 0; j3 < 5; j3++)
  8493.                     anIntArray990[j3] = 0;
  8494.  
  8495.                 for (int l3 = 0; l3 < 5; l3++) {
  8496.                     atPlayerActions[l3] = null;
  8497.                     atPlayerArray[l3] = false;
  8498.                 }
  8499.  
  8500.                 anInt1175 = 0;
  8501.                 anInt1134 = 0;
  8502.                 anInt986 = 0;
  8503.                 anInt1288 = 0;
  8504.                 anInt924 = 0;
  8505.                 anInt1188 = 0;
  8506.                 anInt1155 = 0;
  8507.                 anInt1226 = 0;
  8508.                 resetImageProducers2();
  8509.                 return;
  8510.             }
  8511.             if (k == 3) {
  8512.                 loginMessage1 = "";
  8513.                 loginMessage2 = "Invalid username or password.";
  8514.                 return;
  8515.             }
  8516.             if (k == 4) {
  8517.                 loginMessage1 = "Your account has been disabled.";
  8518.                 loginMessage2 = "Please check your message-center for details.";
  8519.                 return;
  8520.             }
  8521.             if (k == 5) {
  8522.                 loginMessage1 = "Your account is already logged in.";
  8523.                 loginMessage2 = "Try again in 60 secs...";
  8524.                 return;
  8525.             }
  8526.             if (k == 6) {
  8527.                 loginMessage1 = "RatedPixels has been updated!";
  8528.                 loginMessage2 = "Please reload this page.";
  8529.                 return;
  8530.             }
  8531.             if (k == 7) {
  8532.                 loginMessage1 = "This world is full.";
  8533.                 loginMessage2 = "Please use a different world.";
  8534.                 return;
  8535.             }
  8536.             if (k == 8) {
  8537.                 loginMessage1 = "Unable to connect.";
  8538.                 loginMessage2 = "Login server offline.";
  8539.                 return;
  8540.             }
  8541.             if (k == 9) {
  8542.                 loginMessage1 = "Login limit exceeded.";
  8543.                 loginMessage2 = "Too many connections from your address.";
  8544.                 return;
  8545.             }
  8546.             if (k == 10) {
  8547.                 loginMessage1 = "Unable to connect.";
  8548.                 loginMessage2 = "Bad session id.";
  8549.                 return;
  8550.             }
  8551.             if (k == 11) {
  8552.                 loginMessage2 = "Login server rejected session.";
  8553.                 loginMessage2 = "Please try again.";
  8554.                 return;
  8555.             }
  8556.             if (k == 12) {
  8557.                 loginMessage1 = "You need a members account to login to this world.";
  8558.                 loginMessage2 = "Please subscribe, or use a different world.";
  8559.                 return;
  8560.             }
  8561.             if (k == 13) {
  8562.                 loginMessage1 = "Could not complete login.";
  8563.                 loginMessage2 = "Please try using a different world.";
  8564.                 return;
  8565.             }
  8566.             if (k == 14) {
  8567.                 loginMessage1 = "The server is being updated.";
  8568.                 loginMessage2 = "Please wait 1 minute and try again.";
  8569.                 return;
  8570.             }
  8571.             if (k == 15) {
  8572.                 loggedIn = true;
  8573.                 stream.currentOffset = 0;
  8574.                 inStream.currentOffset = 0;
  8575.                 pktType = -1;
  8576.                 anInt841 = -1;
  8577.                 anInt842 = -1;
  8578.                 anInt843 = -1;
  8579.                 pktSize = 0;
  8580.                 anInt1009 = 0;
  8581.                 anInt1104 = 0;
  8582.                 menuActionRow = 0;
  8583.                 menuOpen = false;
  8584.                 aLong824 = System.currentTimeMillis();
  8585.                 return;
  8586.             }
  8587.             if (k == 16) {
  8588.                 loginMessage1 = "Login attempts exceeded.";
  8589.                 loginMessage2 = "Please wait 1 minute and try again.";
  8590.                 return;
  8591.             }
  8592.             if (k == 17) {
  8593.                 loginMessage1 = "You are standing in a members-only area.";
  8594.                 loginMessage2 = "To play on this world move to a free area first";
  8595.                 return;
  8596.             }
  8597.             if (k == 20) {
  8598.                 loginMessage1 = "Invalid loginserver requested";
  8599.                 loginMessage2 = "Please try using a different world.";
  8600.                 return;
  8601.             }
  8602.             if (k == 21) {
  8603.                 for (int k1 = socketStream.read(); k1 >= 0; k1--) {
  8604.                     loginMessage1 = "You have only just left another world";
  8605.                     loginMessage2 = "Your profile will be transferred in: "
  8606.                             + k1 + " seconds";
  8607.                     drawLoginScreen(true);
  8608.                     try {
  8609.                         Thread.sleep(1000L);
  8610.                     } catch (Exception _ex) {
  8611.                     }
  8612.                 }
  8613.  
  8614.                 login(s, s1, flag);
  8615.                 return;
  8616.             }
  8617.             if (k == 22) {
  8618.                 loginMessage1 = "Your computer has been MAC banned.";
  8619.                 loginMessage2 = "Please appeal on the forums.";
  8620.                 return;
  8621.             }
  8622.             if (k == -1) {
  8623.                 if (i1 == 0) {
  8624.                     if (loginFailures < 2) {
  8625.                         try {
  8626.                             Thread.sleep(2000L);
  8627.                         } catch (Exception _ex) {
  8628.                         }
  8629.                         loginFailures++;
  8630.                         login(s, s1, flag);
  8631.                         return;
  8632.                     } else {
  8633.                         loginMessage1 = "No response from loginserver";
  8634.                         loginMessage2 = "Please wait 1 minute and try again.";
  8635.                         return;
  8636.                     }
  8637.                 } else {
  8638.                     loginMessage1 = "No response from server";
  8639.                     loginMessage2 = "Please try using a different world.";
  8640.                     return;
  8641.                 }
  8642.             } else {
  8643.                 System.out.println("response:" + k);
  8644.                 loginMessage1 = "Unexpected server response";
  8645.                 loginMessage2 = "Please try using a different world.";
  8646.                 return;
  8647.             }
  8648.         } catch (IOException _ex) {
  8649.             loginMessage1 = "";
  8650.         } catch (Exception e) {
  8651.             System.out.println("Error while generating uid. Skipping step.");
  8652.             e.printStackTrace();
  8653.         }
  8654.         loginMessage2 = "Error connecting to server.";
  8655.     }
  8656.  
  8657.     private boolean doWalkTo(int i, int j, int k, int i1, int j1, int k1,
  8658.             int l1, int i2, int j2, boolean flag, int k2) {
  8659.         byte byte0 = 104;
  8660.         byte byte1 = 104;
  8661.         for (int l2 = 0; l2 < byte0; l2++) {
  8662.             for (int i3 = 0; i3 < byte1; i3++) {
  8663.                 anIntArrayArray901[l2][i3] = 0;
  8664.                 anIntArrayArray825[l2][i3] = 0x5f5e0ff;
  8665.             }
  8666.         }
  8667.         int j3 = j2;
  8668.         int k3 = j1;
  8669.         anIntArrayArray901[j2][j1] = 99;
  8670.         anIntArrayArray825[j2][j1] = 0;
  8671.         int l3 = 0;
  8672.         int i4 = 0;
  8673.         bigX[l3] = j2;
  8674.         bigY[l3++] = j1;
  8675.         boolean flag1 = false;
  8676.         int j4 = bigX.length;
  8677.         int ai[][] = aClass11Array1230[plane].anIntArrayArray294;
  8678.         while (i4 != l3) {
  8679.             j3 = bigX[i4];
  8680.             k3 = bigY[i4];
  8681.             i4 = (i4 + 1) % j4;
  8682.             if (j3 == k2 && k3 == i2) {
  8683.                 flag1 = true;
  8684.                 break;
  8685.             }
  8686.             if (i1 != 0) {
  8687.                 if ((i1 < 5 || i1 == 10)
  8688.                         && aClass11Array1230[plane].method219(k2, j3, k3, j,
  8689.                                 i1 - 1, i2)) {
  8690.                     flag1 = true;
  8691.                     break;
  8692.                 }
  8693.                 if (i1 < 10
  8694.                         && aClass11Array1230[plane].method220(k2, i2, k3,
  8695.                                 i1 - 1, j, j3)) {
  8696.                     flag1 = true;
  8697.                     break;
  8698.                 }
  8699.             }
  8700.             if (k1 != 0
  8701.                     && k != 0
  8702.                     && aClass11Array1230[plane].method221(i2, k2, j3, k, l1,
  8703.                             k1, k3)) {
  8704.                 flag1 = true;
  8705.                 break;
  8706.             }
  8707.             int l4 = anIntArrayArray825[j3][k3] + 1;
  8708.             if (j3 > 0 && anIntArrayArray901[j3 - 1][k3] == 0
  8709.                     && (ai[j3 - 1][k3] & 0x1280108) == 0) {
  8710.                 bigX[l3] = j3 - 1;
  8711.                 bigY[l3] = k3;
  8712.                 l3 = (l3 + 1) % j4;
  8713.                 anIntArrayArray901[j3 - 1][k3] = 2;
  8714.                 anIntArrayArray825[j3 - 1][k3] = l4;
  8715.             }
  8716.             if (j3 < byte0 - 1 && anIntArrayArray901[j3 + 1][k3] == 0
  8717.                     && (ai[j3 + 1][k3] & 0x1280180) == 0) {
  8718.                 bigX[l3] = j3 + 1;
  8719.                 bigY[l3] = k3;
  8720.                 l3 = (l3 + 1) % j4;
  8721.                 anIntArrayArray901[j3 + 1][k3] = 8;
  8722.                 anIntArrayArray825[j3 + 1][k3] = l4;
  8723.             }
  8724.             if (k3 > 0 && anIntArrayArray901[j3][k3 - 1] == 0
  8725.                     && (ai[j3][k3 - 1] & 0x1280102) == 0) {
  8726.                 bigX[l3] = j3;
  8727.                 bigY[l3] = k3 - 1;
  8728.                 l3 = (l3 + 1) % j4;
  8729.                 anIntArrayArray901[j3][k3 - 1] = 1;
  8730.                 anIntArrayArray825[j3][k3 - 1] = l4;
  8731.             }
  8732.             if (k3 < byte1 - 1 && anIntArrayArray901[j3][k3 + 1] == 0
  8733.                     && (ai[j3][k3 + 1] & 0x1280120) == 0) {
  8734.                 bigX[l3] = j3;
  8735.                 bigY[l3] = k3 + 1;
  8736.                 l3 = (l3 + 1) % j4;
  8737.                 anIntArrayArray901[j3][k3 + 1] = 4;
  8738.                 anIntArrayArray825[j3][k3 + 1] = l4;
  8739.             }
  8740.             if (j3 > 0 && k3 > 0 && anIntArrayArray901[j3 - 1][k3 - 1] == 0
  8741.                     && (ai[j3 - 1][k3 - 1] & 0x128010e) == 0
  8742.                     && (ai[j3 - 1][k3] & 0x1280108) == 0
  8743.                     && (ai[j3][k3 - 1] & 0x1280102) == 0) {
  8744.                 bigX[l3] = j3 - 1;
  8745.                 bigY[l3] = k3 - 1;
  8746.                 l3 = (l3 + 1) % j4;
  8747.                 anIntArrayArray901[j3 - 1][k3 - 1] = 3;
  8748.                 anIntArrayArray825[j3 - 1][k3 - 1] = l4;
  8749.             }
  8750.             if (j3 < byte0 - 1 && k3 > 0
  8751.                     && anIntArrayArray901[j3 + 1][k3 - 1] == 0
  8752.                     && (ai[j3 + 1][k3 - 1] & 0x1280183) == 0
  8753.                     && (ai[j3 + 1][k3] & 0x1280180) == 0
  8754.                     && (ai[j3][k3 - 1] & 0x1280102) == 0) {
  8755.                 bigX[l3] = j3 + 1;
  8756.                 bigY[l3] = k3 - 1;
  8757.                 l3 = (l3 + 1) % j4;
  8758.                 anIntArrayArray901[j3 + 1][k3 - 1] = 9;
  8759.                 anIntArrayArray825[j3 + 1][k3 - 1] = l4;
  8760.             }
  8761.             if (j3 > 0 && k3 < byte1 - 1
  8762.                     && anIntArrayArray901[j3 - 1][k3 + 1] == 0
  8763.                     && (ai[j3 - 1][k3 + 1] & 0x1280138) == 0
  8764.                     && (ai[j3 - 1][k3] & 0x1280108) == 0
  8765.                     && (ai[j3][k3 + 1] & 0x1280120) == 0) {
  8766.                 bigX[l3] = j3 - 1;
  8767.                 bigY[l3] = k3 + 1;
  8768.                 l3 = (l3 + 1) % j4;
  8769.                 anIntArrayArray901[j3 - 1][k3 + 1] = 6;
  8770.                 anIntArrayArray825[j3 - 1][k3 + 1] = l4;
  8771.             }
  8772.             if (j3 < byte0 - 1 && k3 < byte1 - 1
  8773.                     && anIntArrayArray901[j3 + 1][k3 + 1] == 0
  8774.                     && (ai[j3 + 1][k3 + 1] & 0x12801e0) == 0
  8775.                     && (ai[j3 + 1][k3] & 0x1280180) == 0
  8776.                     && (ai[j3][k3 + 1] & 0x1280120) == 0) {
  8777.                 bigX[l3] = j3 + 1;
  8778.                 bigY[l3] = k3 + 1;
  8779.                 l3 = (l3 + 1) % j4;
  8780.                 anIntArrayArray901[j3 + 1][k3 + 1] = 12;
  8781.                 anIntArrayArray825[j3 + 1][k3 + 1] = l4;
  8782.             }
  8783.         }
  8784.         anInt1264 = 0;
  8785.         if (!flag1) {
  8786.             if (flag) {
  8787.                 int i5 = 100;
  8788.                 for (int k5 = 1; k5 < 2; k5++) {
  8789.                     for (int i6 = k2 - k5; i6 <= k2 + k5; i6++) {
  8790.                         for (int l6 = i2 - k5; l6 <= i2 + k5; l6++)
  8791.                             if (i6 >= 0 && l6 >= 0 && i6 < 104 && l6 < 104
  8792.                                     && anIntArrayArray825[i6][l6] < i5) {
  8793.                                 i5 = anIntArrayArray825[i6][l6];
  8794.                                 j3 = i6;
  8795.                                 k3 = l6;
  8796.                                 anInt1264 = 1;
  8797.                                 flag1 = true;
  8798.                             }
  8799.  
  8800.                     }
  8801.  
  8802.                     if (flag1)
  8803.                         break;
  8804.                 }
  8805.  
  8806.             }
  8807.             if (!flag1)
  8808.                 return false;
  8809.         }
  8810.         i4 = 0;
  8811.         bigX[i4] = j3;
  8812.         bigY[i4++] = k3;
  8813.         int l5;
  8814.         for (int j5 = l5 = anIntArrayArray901[j3][k3]; j3 != j2 || k3 != j1; j5 = anIntArrayArray901[j3][k3]) {
  8815.             if (j5 != l5) {
  8816.                 l5 = j5;
  8817.                 bigX[i4] = j3;
  8818.                 bigY[i4++] = k3;
  8819.             }
  8820.             if ((j5 & 2) != 0)
  8821.                 j3++;
  8822.             else if ((j5 & 8) != 0)
  8823.                 j3--;
  8824.             if ((j5 & 1) != 0)
  8825.                 k3++;
  8826.             else if ((j5 & 4) != 0)
  8827.                 k3--;
  8828.         }
  8829.         // if(cancelWalk) { return i4 > 0; }
  8830.  
  8831.         if (i4 > 0) {
  8832.             int k4 = i4;
  8833.             if (k4 > 25)
  8834.                 k4 = 25;
  8835.             i4--;
  8836.             int k6 = bigX[i4];
  8837.             int i7 = bigY[i4];
  8838.             anInt1288 += k4;
  8839.             if (anInt1288 >= 92) {
  8840.                 stream.createFrame(36);
  8841.                 stream.writeDWord(0);
  8842.                 anInt1288 = 0;
  8843.             }
  8844.             if (i == 0) {
  8845.                 stream.createFrame(164);
  8846.                 stream.writeWordBigEndian(k4 + k4 + 3);
  8847.             }
  8848.             if (i == 1) {
  8849.                 stream.createFrame(248);
  8850.                 stream.writeWordBigEndian(k4 + k4 + 3 + 14);
  8851.             }
  8852.             if (i == 2) {
  8853.                 stream.createFrame(98);
  8854.                 stream.writeWordBigEndian(k4 + k4 + 3);
  8855.             }
  8856.             stream.method433(k6 + baseX);
  8857.             destX = bigX[0];
  8858.             destY = bigY[0];
  8859.             for (int j7 = 1; j7 < k4; j7++) {
  8860.                 i4--;
  8861.                 stream.writeWordBigEndian(bigX[i4] - k6);
  8862.                 stream.writeWordBigEndian(bigY[i4] - i7);
  8863.             }
  8864.  
  8865.             stream.method431(i7 + baseY);
  8866.             stream.method424(super.keyArray[5] != 1 ? 0 : 1);
  8867.             return true;
  8868.         }
  8869.         return i != 1;
  8870.     }
  8871.  
  8872.     public void method86(Stream stream) {
  8873.         for (int j = 0; j < anInt893; j++) {
  8874.             int k = anIntArray894[j];
  8875.             NPC npc = npcArray[k];
  8876.             int l = stream.readUnsignedByte();
  8877.             if ((l & 0x10) != 0) {
  8878.                 int i1 = stream.method434();
  8879.                 if (i1 == 65535)
  8880.                     i1 = -1;
  8881.                 int i2 = stream.readUnsignedByte();
  8882.                 if (i1 == npc.anim && i1 != -1) {
  8883.                     int l2 = Animation.anims[i1].anInt365;
  8884.                     if (l2 == 1) {
  8885.                         npc.anInt1527 = 0;
  8886.                         npc.anInt1528 = 0;
  8887.                         npc.anInt1529 = i2;
  8888.                         npc.anInt1530 = 0;
  8889.                     }
  8890.                     if (l2 == 2)
  8891.                         npc.anInt1530 = 0;
  8892.                 } else if (i1 == -1
  8893.                         || npc.anim == -1
  8894.                         || Animation.anims[i1].anInt359 >= Animation.anims[npc.anim].anInt359) {
  8895.                     npc.anim = i1;
  8896.                     npc.anInt1527 = 0;
  8897.                     npc.anInt1528 = 0;
  8898.                     npc.anInt1529 = i2;
  8899.                     npc.anInt1530 = 0;
  8900.                     npc.anInt1542 = npc.smallXYIndex;
  8901.                 }
  8902.             }
  8903.             if ((l & 8) != 0) {
  8904.                 int j1 = stream.method426();
  8905.                 int j2 = stream.method427();
  8906.                 npc.updateHitData(j2, j1, loopCycle);
  8907.                 npc.loopCycleStatus = loopCycle + 300;
  8908.                 npc.currentHealth = stream.method426();
  8909.                 npc.maxHealth = stream.readUnsignedByte();
  8910.             }
  8911.             if ((l & 0x80) != 0) {
  8912.                 npc.anInt1520 = stream.readUnsignedWord();
  8913.                 int k1 = stream.readDWord();
  8914.                 npc.anInt1524 = k1 >> 16;
  8915.                 npc.anInt1523 = loopCycle + (k1 & 0xffff);
  8916.                 npc.anInt1521 = 0;
  8917.                 npc.anInt1522 = 0;
  8918.                 if (npc.anInt1523 > loopCycle)
  8919.                     npc.anInt1521 = -1;
  8920.                 if (npc.anInt1520 == 65535)
  8921.                     npc.anInt1520 = -1;
  8922.             }
  8923.             if ((l & 0x20) != 0) {
  8924.                 npc.interactingEntity = stream.readUnsignedWord();
  8925.                 if (npc.interactingEntity == 65535)
  8926.                     npc.interactingEntity = -1;
  8927.             }
  8928.             if ((l & 1) != 0) {
  8929.                 npc.textSpoken = stream.readString();
  8930.                 npc.textCycle = 100;
  8931.             }
  8932.             if ((l & 0x40) != 0) {
  8933.                 int l1 = stream.method427();
  8934.                 int k2 = stream.method428();
  8935.                 npc.updateHitData(k2, l1, loopCycle);
  8936.                 npc.loopCycleStatus = loopCycle + 300;
  8937.                 npc.currentHealth = stream.method428();
  8938.                 npc.maxHealth = stream.method427();
  8939.             }
  8940.             if ((l & 2) != 0) {
  8941.                 npc.desc = EntityDef.forID(stream.method436());
  8942.                 npc.anInt1540 = npc.desc.aByte68;
  8943.                 npc.anInt1504 = npc.desc.anInt79;
  8944.                 npc.anInt1554 = npc.desc.walkAnim;
  8945.                 npc.anInt1555 = npc.desc.anInt58;
  8946.                 npc.anInt1556 = npc.desc.anInt83;
  8947.                 npc.anInt1557 = npc.desc.anInt55;
  8948.                 npc.anInt1511 = npc.desc.standAnim;
  8949.             }
  8950.             if ((l & 4) != 0) {
  8951.                 npc.anInt1538 = stream.method434();
  8952.                 npc.anInt1539 = stream.method434();
  8953.             }
  8954.         }
  8955.     }
  8956.  
  8957.     public void buildAtNPCMenu(EntityDef entityDef, int i, int j, int k) {
  8958.         if (menuActionRow >= 400)
  8959.             return;
  8960.         if (entityDef.childrenIDs != null)
  8961.             entityDef = entityDef.method161();
  8962.         if (entityDef == null)
  8963.             return;
  8964.         if (!entityDef.aBoolean84)
  8965.             return;
  8966.         String s = entityDef.name;
  8967.         if (entityDef.combatLevel != 0)
  8968.             s = s
  8969.                     + combatDiffColor(myPlayer.combatLevel,
  8970.                             entityDef.combatLevel) + " (level-"
  8971.                     + entityDef.combatLevel + ")";
  8972.         if (itemSelected == 1) {
  8973.             menuActionName[menuActionRow] = "Use " + selectedItemName
  8974.                     + " with @yel@" + s;
  8975.             menuActionID[menuActionRow] = 582;
  8976.             menuActionCmd1[menuActionRow] = i;
  8977.             menuActionCmd2[menuActionRow] = k;
  8978.             menuActionCmd3[menuActionRow] = j;
  8979.             menuActionRow++;
  8980.             return;
  8981.         }
  8982.         if (spellSelected == 1) {
  8983.             if ((spellUsableOn & 2) == 2) {
  8984.                 menuActionName[menuActionRow] = spellTooltip + " @yel@" + s;
  8985.                 menuActionID[menuActionRow] = 413;
  8986.                 menuActionCmd1[menuActionRow] = i;
  8987.                 menuActionCmd2[menuActionRow] = k;
  8988.                 menuActionCmd3[menuActionRow] = j;
  8989.                 menuActionRow++;
  8990.             }
  8991.         } else {
  8992.             if (entityDef.actions != null) {
  8993.                 for (int l = 4; l >= 0; l--)
  8994.                     if (entityDef.actions[l] != null
  8995.                             && !entityDef.actions[l].equalsIgnoreCase("attack")) {
  8996.                         menuActionName[menuActionRow] = entityDef.actions[l]
  8997.                                 + " @yel@" + s;
  8998.                         if (l == 0)
  8999.                             menuActionID[menuActionRow] = 20;
  9000.                         if (l == 1)
  9001.                             menuActionID[menuActionRow] = 412;
  9002.                         if (l == 2)
  9003.                             menuActionID[menuActionRow] = 225;
  9004.                         if (l == 3)
  9005.                             menuActionID[menuActionRow] = 965;
  9006.                         if (l == 4)
  9007.                             menuActionID[menuActionRow] = 478;
  9008.                         menuActionCmd1[menuActionRow] = i;
  9009.                         menuActionCmd2[menuActionRow] = k;
  9010.                         menuActionCmd3[menuActionRow] = j;
  9011.                         menuActionRow++;
  9012.                     }
  9013.  
  9014.             }
  9015.             if (entityDef.actions != null) {
  9016.                 for (int i1 = 4; i1 >= 0; i1--)
  9017.                     if (entityDef.actions[i1] != null
  9018.                             && entityDef.actions[i1].equalsIgnoreCase("attack")) {
  9019.                         char c = '\0';
  9020.                         if (entityDef.combatLevel > myPlayer.combatLevel)
  9021.                             c = '\u07D0';
  9022.                         menuActionName[menuActionRow] = entityDef.actions[i1]
  9023.                                 + " @yel@" + s;
  9024.                         if (i1 == 0)
  9025.                             menuActionID[menuActionRow] = 20 + c;
  9026.                         if (i1 == 1)
  9027.                             menuActionID[menuActionRow] = 412 + c;
  9028.                         if (i1 == 2)
  9029.                             menuActionID[menuActionRow] = 225 + c;
  9030.                         if (i1 == 3)
  9031.                             menuActionID[menuActionRow] = 965 + c;
  9032.                         if (i1 == 4)
  9033.                             menuActionID[menuActionRow] = 478 + c;
  9034.                         menuActionCmd1[menuActionRow] = i;
  9035.                         menuActionCmd2[menuActionRow] = k;
  9036.                         menuActionCmd3[menuActionRow] = j;
  9037.                         menuActionRow++;
  9038.                     }
  9039.  
  9040.             }
  9041.             // menuActionName[menuActionRow] = "Examine @yel@" + s +
  9042.             // " @gre@(@whi@" + entityDef.type + "@gre@)";
  9043.             menuActionName[menuActionRow] = "Examine @yel@" + s;
  9044.             menuActionID[menuActionRow] = 1025;
  9045.             menuActionCmd1[menuActionRow] = i;
  9046.             menuActionCmd2[menuActionRow] = k;
  9047.             menuActionCmd3[menuActionRow] = j;
  9048.             menuActionRow++;
  9049.         }
  9050.     }
  9051.  
  9052.     public void buildAtPlayerMenu(int i, int j, Player player, int k) {
  9053.         if (player == myPlayer)
  9054.             return;
  9055.         if (menuActionRow >= 400)
  9056.             return;
  9057.         String s;
  9058.         if (player.title.length() < 0)
  9059.             s = player.name
  9060.                     + combatDiffColor(myPlayer.combatLevel, player.combatLevel)
  9061.                     + " (level: " + player.combatLevel + ")";
  9062.         else if (player.title.length() != 0)
  9063.             s = "@" + titleColor(player.titleColor, 1) + "@" + player.title
  9064.                     + "@whi@" + player.name
  9065.                     + combatDiffColor(myPlayer.combatLevel, player.combatLevel)
  9066.                     + " (level: " + player.combatLevel + ")";
  9067.         else
  9068.             s = player.name
  9069.                     + combatDiffColor(myPlayer.combatLevel, player.combatLevel)
  9070.                     + " (level: " + player.combatLevel + ")";
  9071.         if (itemSelected == 1) {
  9072.             menuActionName[menuActionRow] = "Use " + selectedItemName
  9073.                     + " with @whi@" + s;
  9074.             menuActionID[menuActionRow] = 491;
  9075.             menuActionCmd1[menuActionRow] = j;
  9076.             menuActionCmd2[menuActionRow] = i;
  9077.             menuActionCmd3[menuActionRow] = k;
  9078.             menuActionRow++;
  9079.         } else if (spellSelected == 1) {
  9080.             if ((spellUsableOn & 8) == 8) {
  9081.                 menuActionName[menuActionRow] = spellTooltip + " @whi@" + s;
  9082.                 menuActionID[menuActionRow] = 365;
  9083.                 menuActionCmd1[menuActionRow] = j;
  9084.                 menuActionCmd2[menuActionRow] = i;
  9085.                 menuActionCmd3[menuActionRow] = k;
  9086.                 menuActionRow++;
  9087.             }
  9088.         } else {
  9089.             for (int l = 4; l >= 0; l--)
  9090.                 if (atPlayerActions[l] != null) {
  9091.                     menuActionName[menuActionRow] = atPlayerActions[l]
  9092.                             + " @whi@" + s;
  9093.                     char c = '\0';
  9094.                     if (atPlayerActions[l].equalsIgnoreCase("attack")) {
  9095.                         if (player.combatLevel > myPlayer.combatLevel)
  9096.                             c = '\u07D0';
  9097.                         if (myPlayer.team != 0 && player.team != 0)
  9098.                             if (myPlayer.team == player.team)
  9099.                                 c = '\u07D0';
  9100.                             else
  9101.                                 c = '\0';
  9102.                     } else if (atPlayerArray[l])
  9103.                         c = '\u07D0';
  9104.                     if (l == 0)
  9105.                         menuActionID[menuActionRow] = 561 + c;
  9106.                     if (l == 1)
  9107.                         menuActionID[menuActionRow] = 779 + c;
  9108.                     if (l == 2)
  9109.                         menuActionID[menuActionRow] = 27 + c;
  9110.                     if (l == 3)
  9111.                         menuActionID[menuActionRow] = 577 + c;
  9112.                     if (l == 4)
  9113.                         menuActionID[menuActionRow] = 729 + c;
  9114.                     menuActionCmd1[menuActionRow] = j;
  9115.                     menuActionCmd2[menuActionRow] = i;
  9116.                     menuActionCmd3[menuActionRow] = k;
  9117.                     menuActionRow++;
  9118.                 }
  9119.  
  9120.         }
  9121.         for (int i1 = 0; i1 < menuActionRow; i1++)
  9122.             if (menuActionID[i1] == 516) {
  9123.                 menuActionName[i1] = "Walk here @whi@" + s;
  9124.                 return;
  9125.             }
  9126.  
  9127.     }
  9128.  
  9129.     public void method89(Class30_Sub1 class30_sub1) {
  9130.         int i = 0;
  9131.         int j = -1;
  9132.         int k = 0;
  9133.         int l = 0;
  9134.         if (class30_sub1.anInt1296 == 0)
  9135.             i = worldController.method300(class30_sub1.anInt1295,
  9136.                     class30_sub1.anInt1297, class30_sub1.anInt1298);
  9137.         if (class30_sub1.anInt1296 == 1)
  9138.             i = worldController.method301(class30_sub1.anInt1295,
  9139.                     class30_sub1.anInt1297, class30_sub1.anInt1298);
  9140.         if (class30_sub1.anInt1296 == 2)
  9141.             i = worldController.method302(class30_sub1.anInt1295,
  9142.                     class30_sub1.anInt1297, class30_sub1.anInt1298);
  9143.         if (class30_sub1.anInt1296 == 3)
  9144.             i = worldController.method303(class30_sub1.anInt1295,
  9145.                     class30_sub1.anInt1297, class30_sub1.anInt1298);
  9146.         if (i != 0) {
  9147.             int i1 = worldController.method304(class30_sub1.anInt1295,
  9148.                     class30_sub1.anInt1297, class30_sub1.anInt1298, i);
  9149.             j = i >> 14 & 0x7fff;
  9150.             k = i1 & 0x1f;
  9151.             l = i1 >> 6;
  9152.         }
  9153.         class30_sub1.anInt1299 = j;
  9154.         class30_sub1.anInt1301 = k;
  9155.         class30_sub1.anInt1300 = l;
  9156.     }
  9157.  
  9158.     public void method90() {
  9159.         for (int i = 0; i < anInt1062; i++)
  9160.             if (anIntArray1250[i] <= 0) {
  9161.                 boolean flag1 = false;
  9162.                 try {
  9163.                     if (anIntArray1207[i] == anInt874
  9164.                             && anIntArray1241[i] == anInt1289) {
  9165.                         if (!replayWave())
  9166.                             flag1 = true;
  9167.                     } else {
  9168.                         Stream stream = Sounds.method241(anIntArray1241[i],
  9169.                                 anIntArray1207[i]);
  9170.                         if (System.currentTimeMillis()
  9171.                                 + stream.currentOffset / 22 > aLong1172
  9172.                                 + anInt1257 / 22) {
  9173.                             anInt1257 = stream.currentOffset;
  9174.                             aLong1172 = System.currentTimeMillis();
  9175.                             if (saveWave(stream.buffer, stream.currentOffset)) {
  9176.                                 anInt874 = anIntArray1207[i];
  9177.                                 anInt1289 = anIntArray1241[i];
  9178.                             } else {
  9179.                                 flag1 = true;
  9180.                             }
  9181.                         }
  9182.                     }
  9183.                 } catch (Exception exception) {
  9184.                 }
  9185.                 if (!flag1 || anIntArray1250[i] == -5) {
  9186.                     anInt1062--;
  9187.                     for (int j = i; j < anInt1062; j++) {
  9188.                         anIntArray1207[j] = anIntArray1207[j + 1];
  9189.                         anIntArray1241[j] = anIntArray1241[j + 1];
  9190.                         anIntArray1250[j] = anIntArray1250[j + 1];
  9191.                     }
  9192.  
  9193.                     i--;
  9194.                 } else {
  9195.                     anIntArray1250[i] = -5;
  9196.                 }
  9197.             } else {
  9198.                 anIntArray1250[i]--;
  9199.             }
  9200.  
  9201.         if (prevSong > 0) {
  9202.             prevSong -= 20;
  9203.             if (prevSong < 0)
  9204.                 prevSong = 0;
  9205.             if (prevSong == 0 && musicEnabled && !lowMem) {
  9206.                 nextSong = currentSong;
  9207.                 songChanging = true;
  9208.                 onDemandFetcher.method558(2, nextSong);
  9209.             }
  9210.         }
  9211.     }
  9212.    
  9213.     public void tabToReplyPm() {
  9214.         String name = null;
  9215.         for (int k = 0; k < 100; k++) {
  9216.             if (chatMessages[k] == null) {
  9217.                 continue;
  9218.             }
  9219.             int l = chatTypes[k];
  9220.             if (l == 3 || l == 7) {
  9221.                 name = chatNames[k];
  9222.                 break;
  9223.             }
  9224.         }
  9225.  
  9226.         if (name == null) {
  9227.             pushMessage("You haven't received any messages to which you can reply.", 0, "");
  9228.             return;
  9229.         }
  9230.  
  9231.         if (name.startsWith("@cr")) {
  9232.             name = name.substring(5);
  9233.         }
  9234.  
  9235.         long nameAsLong = TextClass.longForName(name.trim());
  9236.         int k3 = -1;
  9237.         for (int i4 = 0; i4 < friendsCount; i4++) {
  9238.             if (friendsListAsLongs[i4] != nameAsLong) continue;
  9239.             k3 = i4;
  9240.             break;
  9241.         }
  9242.  
  9243.         if (k3 != -1) {
  9244.             if (friendsNodeIDs[k3] > 0) {
  9245.                 inputTaken = true;
  9246.                 inputDialogState = 0;
  9247.                 messagePromptRaised = true;
  9248.                 promptInput = "";
  9249.                 friendsListAction = 3;
  9250.                 aLong953 = friendsListAsLongs[k3];
  9251.                 aString1121 = "Enter message to send to " + friendsList[k3];
  9252.             } else {
  9253.                 pushMessage("That player is currently offline.", 0, "");
  9254.             }
  9255.         }
  9256.     }
  9257.    
  9258.     @Override
  9259.     void startUp() {
  9260.         drawLoadingText(20, "Starting up");
  9261.         new CacheDownloader(this).downloadCache();
  9262.         if (signlink.sunjava)
  9263.             super.minDelay = 5;
  9264.         if (aBoolean993) {
  9265.             // rsAlreadyLoaded = true;
  9266.             // return;
  9267.         }
  9268.         aBoolean993 = true;
  9269.         getDocumentBaseHost();
  9270.         if (signlink.cache_dat != null) {
  9271.             for (int i = 0; i < 5; i++)
  9272.                 decompressors[i] = new Decompressor(signlink.cache_dat,
  9273.                         signlink.cache_idx[i], i + 1);
  9274.         }
  9275.        
  9276.         //repackCacheIndex(1);
  9277.  
  9278.        
  9279.         try {
  9280.             titleStreamLoader = streamLoaderForName(1, "title screen", "title",
  9281.                     expectedCRCs[1], 25);
  9282.             smallText = new TextDrawingArea(false, "p11_full",
  9283.                     titleStreamLoader);
  9284.             XPFONT = new TextDrawingArea(true, "q8_full", titleStreamLoader);
  9285.             aTextDrawingArea_1271 = new TextDrawingArea(false, "p12_full",
  9286.                     titleStreamLoader);
  9287.             chatTextDrawingArea = new TextDrawingArea(false, "b12_full",
  9288.                     titleStreamLoader);
  9289.             aTextDrawingArea_1273 = new TextDrawingArea(true, "q8_full",
  9290.                     titleStreamLoader);
  9291.             newSmallFont = new RSFont(false, "p11_full", titleStreamLoader);
  9292.             newRegularFont = new RSFont(false, "p12_full", titleStreamLoader);
  9293.             newBoldFont = new RSFont(false, "b12_full", titleStreamLoader);
  9294.             newFancyFont = new RSFont(true, "q8_full", titleStreamLoader);
  9295.             drawLogo();
  9296.             loadTitleScreen();
  9297.             StreamLoader streamLoader = streamLoaderForName(2, "config",
  9298.                     "config", expectedCRCs[2], 30);
  9299.             StreamLoader streamLoader_1 = streamLoaderForName(3, "interface",
  9300.                     "interface", expectedCRCs[3], 35);
  9301.             StreamLoader streamLoader_2 = streamLoaderForName(4, "2d graphics",
  9302.                     "media", expectedCRCs[4], 40);
  9303.             StreamLoader streamLoader_3 = streamLoaderForName(6, "textures",
  9304.                     "textures", expectedCRCs[6], 45);
  9305.             StreamLoader streamLoader_4 = streamLoaderForName(7, "chat system",
  9306.                     "wordenc", expectedCRCs[7], 50);
  9307.             StreamLoader streamLoader_5 = streamLoaderForName(8,
  9308.                     "sound effects", "sounds", expectedCRCs[8], 55);
  9309.             byteGroundArray = new byte[4][104][104];
  9310.             intGroundArray = new int[4][105][105];
  9311.             worldController = new WorldController(intGroundArray);
  9312.             for (int j = 0; j < 4; j++)
  9313.                 aClass11Array1230[j] = new Class11();
  9314.  
  9315.             miniMapImage = new Sprite(512, 512);
  9316.             StreamLoader streamLoader_6 = streamLoaderForName(5, "update list",
  9317.                     "versionlist", expectedCRCs[5], 60);
  9318.             drawLoadingText(60, "Connecting to update server");
  9319.             onDemandFetcher = new OnDemandFetcher();
  9320.             onDemandFetcher.start(streamLoader_6, this);
  9321.             Model.method459(onDemandFetcher.getModelCount(), onDemandFetcher);
  9322.             drawLoadingText(80, "Unpacking media");
  9323.             Sprite[] clanIcons = new Sprite[9];
  9324.             for (int index = 0; index < clanIcons.length; index++) {
  9325.                 clanIcons[index] = new Sprite("Clan Chat/Icons/" + index);
  9326.             }
  9327.             for (int i = 0; i < loadImageCount; i ++) {
  9328.                 cacheSprite[i] = new Sprite("Gameframe/" + i);
  9329.             }
  9330.             worldMapIcon508 = new Sprite("mapicon508");
  9331.             worldMapIcon525 = new Sprite("mapicon525");
  9332.             for (int i = 1; i <= 15; i++) {
  9333.                 ORBS[i] = new Sprite("Gameframe/Orbs/ORBS " + i + "");
  9334.             }
  9335.             multiOverlay = new Sprite(streamLoader_2, "overlay_multiway", 0);
  9336.             chatArea = new Sprite("Gameframe/chatarea");
  9337.             for(int m1 = 0; m1 <= 1; m1++)
  9338.                 mapBack[m1] = new Background(streamLoader_2, "mapback", m1);
  9339.             for (int c1 = 0; c1 <= 3; c1++)
  9340.                 chatButtons[c1] = new Sprite(streamLoader_2, "chatbuttons", c1);
  9341.             for (int j3 = 0; j3 <= 14; j3++)
  9342.                 sideIcons[j3] = new Sprite(streamLoader_2, "sideicons", j3);
  9343.             for (int r1 = 0; r1 < 5; r1++)
  9344.                 redStones[r1] = new Sprite("Gameframe/redstones " + r1);
  9345.             RSFont.unpackImages(modIcons, clanIcons);
  9346.             compass = new Sprite(streamLoader_2, "compass", 0);
  9347.             mapEdge = new Sprite(streamLoader_2, "mapedge", 0);
  9348.             mapEdge.method345();
  9349.             try {
  9350.                 for (int k3 = 0; k3 < 100; k3++)
  9351.                     mapScenes[k3] = new Background(streamLoader_2, "mapscene",
  9352.                             k3);
  9353.             } catch (Exception _ex) {
  9354.             }
  9355.             try {
  9356.                 for (int l3 = 0; l3 < 100; l3++)
  9357.                     mapFunctions[l3] = new Sprite(streamLoader_2,
  9358.                             "mapfunction", l3);
  9359.             } catch (Exception _ex) {
  9360.             }
  9361.             try {
  9362.                 for (int i4 = 0; i4 < 20; i4++)
  9363.                     hitMarks[i4] = new Sprite(streamLoader_2, "hitmarks", i4);
  9364.             } catch (Exception _ex) {
  9365.             }
  9366.             try {
  9367.                 for (int h1 = 0; h1 < 6; h1++)
  9368.                     headIconsHint[h1] = new Sprite(streamLoader_2,
  9369.                             "headicons_hint", h1);
  9370.             } catch (Exception _ex) {
  9371.             }
  9372.             try {
  9373.                 for (int j4 = 0; j4 < 8; j4++)
  9374.                     headIcons[j4] = new Sprite(streamLoader_2,
  9375.                             "headicons_prayer", j4);
  9376.                 for (int j45 = 0; j45 < 3; j45++)
  9377.                     skullIcons[j45] = new Sprite(streamLoader_2,
  9378.                             "headicons_pk", j45);
  9379.             } catch (Exception _ex) {
  9380.             }
  9381.             mapFlag = new Sprite(streamLoader_2, "mapmarker", 0);
  9382.             mapMarker = new Sprite(streamLoader_2, "mapmarker", 1);
  9383.             for (int k4 = 0; k4 < 8; k4++)
  9384.                 crosses[k4] = new Sprite(streamLoader_2, "cross", k4);
  9385.  
  9386.             mapDotItem = new Sprite(streamLoader_2, "mapdots", 0);
  9387.             mapDotNPC = new Sprite(streamLoader_2, "mapdots", 1);
  9388.             mapDotPlayer = new Sprite(streamLoader_2, "mapdots", 2);
  9389.             mapDotFriend = new Sprite(streamLoader_2, "mapdots", 3);
  9390.             mapDotTeam = new Sprite(streamLoader_2, "mapdots", 4);
  9391.             mapDotClan = new Sprite(streamLoader_2, "mapdots", 5);
  9392.             new Sprite(streamLoader_2, "mapdots", 4);
  9393.             scrollBar1 = new Sprite(streamLoader_2, "scrollbar", 0);
  9394.             scrollBar2 = new Sprite(streamLoader_2, "scrollbar", 1);
  9395.             for (int l4 = 0; l4 < 4; l4++)
  9396.                 modIcons[l4] = new Sprite(streamLoader_2, "mod_icons", l4);
  9397.  
  9398.             Sprite sprite = new Sprite(streamLoader_2, "screenframe", 0);
  9399.             leftFrame = new ImageProducer(sprite.myWidth, sprite.myHeight);
  9400.             sprite.method346(0, 0);
  9401.             sprite = new Sprite(streamLoader_2, "screenframe", 1);
  9402.             topFrame = new ImageProducer(sprite.myWidth, sprite.myHeight);
  9403.             sprite.method346(0, 0);
  9404.             sprite = new Sprite(streamLoader_2, "screenframe", 2);
  9405.             rightFrame = new ImageProducer(sprite.myWidth, sprite.myHeight);
  9406.             sprite.method346(0, 0);
  9407.             sprite = new Sprite(streamLoader_2, "mapedge", 0);
  9408.             mapEdgeIP = new ImageProducer(sprite.myWidth, sprite.myHeight);
  9409.             sprite.method346(0, 0);
  9410.             int i5 = (int) (Math.random() * 21D) - 10;
  9411.             int j5 = (int) (Math.random() * 21D) - 10;
  9412.             int k5 = (int) (Math.random() * 21D) - 10;
  9413.             int l5 = (int) (Math.random() * 41D) - 20;
  9414.             for (int i6 = 0; i6 < 100; i6++) {
  9415.                 if (mapFunctions[i6] != null)
  9416.                     mapFunctions[i6].method344(i5 + l5, j5 + l5, k5 + l5);
  9417.                 if (mapScenes[i6] != null)
  9418.                     mapScenes[i6].method360(i5 + l5, j5 + l5, k5 + l5);
  9419.             }
  9420.  
  9421.             drawLoadingText(83, "Unpacking textures");
  9422.             Texture.method368(streamLoader_3);
  9423.             Texture.method372(0.80000000000000004D);
  9424.             Texture.method367();
  9425.             drawLoadingText(86, "Unpacking config");
  9426.             Animation.unpackConfig(streamLoader);
  9427.             ObjectDef.unpackConfig(streamLoader);
  9428.             Flo.unpackConfig(streamLoader);
  9429.             ItemDef.unpackConfig(streamLoader);
  9430.             EntityDef.unpackConfig(streamLoader);
  9431.             IDK.unpackConfig(streamLoader);
  9432.             SpotAnim.unpackConfig(streamLoader);
  9433.             Varp.unpackConfig(streamLoader);
  9434.             VarBit.unpackConfig(streamLoader);
  9435.             ItemDef.isMembers = isMembers;
  9436.             if (!lowMem) {
  9437.                 drawLoadingText(90, "Unpacking sounds");
  9438.                 byte abyte0[] = streamLoader_5.getDataForName("sounds.dat");
  9439.                 Stream stream = new Stream(abyte0);
  9440.                 Sounds.unpack(stream);
  9441.             }
  9442.             drawLoadingText(95, "Unpacking interfaces");
  9443.             TextDrawingArea allFonts[] = { smallText, aTextDrawingArea_1271,
  9444.                     chatTextDrawingArea, aTextDrawingArea_1273 };
  9445.             RSInterface.unpack(streamLoader_1, allFonts, streamLoader_2);
  9446.             drawLoadingText(100, "Preparing game engine");
  9447.             for (int j6 = 0; j6 < 33; j6++) {
  9448.                 int k6 = 999;
  9449.                 int i7 = 0;
  9450.                 for (int k7 = 0; k7 < 34; k7++) {
  9451.                     if (mapBack[0].aByteArray1450[k7 + j6 * mapBack[0].anInt1452] == 0) {
  9452.                         if (k6 == 999)
  9453.                             k6 = k7;
  9454.                         continue;
  9455.                     }
  9456.                     if (k6 == 999)
  9457.                         continue;
  9458.                     i7 = k7;
  9459.                     break;
  9460.                 }
  9461.                 anIntArray968[j6] = k6;
  9462.                 anIntArray1057[j6] = i7 - k6;
  9463.             }
  9464.             for (int l6 = 1; l6 < 153; l6++) {
  9465.                 int j7 = 999;
  9466.                 int l7 = 0;
  9467.                 for (int j8 = 24; j8 < 177; j8++) {
  9468.                     if (mapBack[0].aByteArray1450[j8 + l6 * mapBack[0].anInt1452] == 0 && (j8 > 34 || l6 > 34)) {
  9469.                         if (j7 == 999) {
  9470.                             j7 = j8;
  9471.                         }
  9472.                         continue;
  9473.                     }
  9474.                     if (j7 == 999) {
  9475.                         continue;
  9476.                     }
  9477.                     l7 = j8;
  9478.                     break;
  9479.                 }
  9480.                 anIntArray1052[l6 - 1] = j7 - 24;
  9481.                 anIntArray1229[l6 - 1] = l7 - j7;
  9482.             }
  9483.  
  9484.             setBounds();
  9485.             Censor.loadConfig(streamLoader_4);
  9486.             mouseDetection = new MouseDetection(this);
  9487.             startRunnable(mouseDetection, 10);
  9488.             Animable_Sub5.clientInstance = this;
  9489.             ObjectDef.clientInstance = this;
  9490.             EntityDef.clientInstance = this;
  9491.             return;
  9492.         } catch (Exception exception) {
  9493.             exception.printStackTrace();
  9494.             signlink.reporterror("loaderror " + aString1049 + " " + anInt1079);
  9495.         }
  9496.         loadingError = true;
  9497.     }
  9498.    
  9499.     private String getMac() {
  9500.         InetAddress ip;
  9501.         String macA = null;
  9502.         try {
  9503.  
  9504.             ip = InetAddress.getLocalHost();
  9505.             NetworkInterface network = NetworkInterface.getByInetAddress(ip);
  9506.  
  9507.             byte[] mac = network.getHardwareAddress();
  9508.  
  9509.             StringBuilder sb = new StringBuilder();
  9510.             for (int i = 0; i < mac.length; i++) {
  9511.                 sb.append(String.format("%02X%s", mac[i],
  9512.                         (i < mac.length - 1) ? "-" : ""));
  9513.             }
  9514.             macA = sb.toString();
  9515.  
  9516.         } catch (UnknownHostException e) {
  9517.  
  9518.             e.printStackTrace();
  9519.  
  9520.         } catch (SocketException e) {
  9521.  
  9522.             e.printStackTrace();
  9523.  
  9524.         }
  9525.         return macA;
  9526.     }
  9527.  
  9528.     public void method91(Stream stream, int i) {
  9529.         while (stream.bitPosition + 10 < i * 8) {
  9530.             int j = stream.readBits(11);
  9531.             if (j == 2047)
  9532.                 break;
  9533.             if (playerArray[j] == null) {
  9534.                 playerArray[j] = new Player();
  9535.                 if (aStreamArray895s[j] != null)
  9536.                     playerArray[j].updatePlayer(aStreamArray895s[j]);
  9537.             }
  9538.             playerIndices[playerCount++] = j;
  9539.             Player player = playerArray[j];
  9540.             player.anInt1537 = loopCycle;
  9541.             int k = stream.readBits(1);
  9542.             if (k == 1)
  9543.                 anIntArray894[anInt893++] = j;
  9544.             int l = stream.readBits(1);
  9545.             int i1 = stream.readBits(5);
  9546.             if (i1 > 15)
  9547.                 i1 -= 32;
  9548.             int j1 = stream.readBits(5);
  9549.             if (j1 > 15)
  9550.                 j1 -= 32;
  9551.             player.setPos(myPlayer.smallX[0] + j1, myPlayer.smallY[0] + i1,
  9552.                     l == 1);
  9553.         }
  9554.         stream.finishBitAccess();
  9555.     }
  9556.    
  9557.     public boolean inCircle(int circleX, int circleY, int clickX, int clickY, int radius) {
  9558.         return java.lang.Math.pow((circleX + radius - clickX), 2) + java.lang.Math.pow((circleY + radius - clickY), 2) < java.lang.Math.pow(radius, 2);
  9559.     }
  9560.  
  9561.     private void processMainScreenClick() {
  9562.         if (anInt1021 != 0)
  9563.             return;
  9564.         if (super.clickMode3 == 1) {
  9565.             int i = super.saveClickX - 25 - 547;
  9566.             int j = super.saveClickY - 5 - 3;
  9567.             if (frameMode != ScreenMode.FIXED) {
  9568.                 i = super.saveClickX - (frameWidth - 182 + 25);
  9569.                 j = super.saveClickY - 4;
  9570.             }
  9571.             if (inCircle(0, 0, i, j, 72) && mouseMapPosition() && !runHover) {
  9572.                 i -= 73;
  9573.                 j -= 75;
  9574.                 int k = viewRotation + minimapRotation & 0x7ff;
  9575.                 int i1 = Texture.anIntArray1470[k];
  9576.                 int j1 = Texture.anIntArray1471[k];
  9577.                 i1 = i1 * (minimapZoom + 256) >> 8;
  9578.                 j1 = j1 * (minimapZoom + 256) >> 8;
  9579.                 int k1 = j * i1 + i * j1 >> 11;
  9580.                 int l1 = j * j1 - i * i1 >> 11;
  9581.                 int i2 = myPlayer.x + k1 >> 7;
  9582.                 int j2 = myPlayer.y - l1 >> 7;
  9583.                 boolean flag1 = doWalkTo(1, 0, 0, 0, myPlayer.smallY[0], 0, 0, j2, myPlayer.smallX[0], true, i2);
  9584.                 if (flag1) {
  9585.                     stream.writeWordBigEndian(i);
  9586.                     stream.writeWordBigEndian(j);
  9587.                     stream.writeWord(viewRotation);
  9588.                     stream.writeWordBigEndian(57);
  9589.                     stream.writeWordBigEndian(minimapRotation);
  9590.                     stream.writeWordBigEndian(minimapZoom);
  9591.                     stream.writeWordBigEndian(89);
  9592.                     stream.writeWord(myPlayer.x);
  9593.                     stream.writeWord(myPlayer.y);
  9594.                     stream.writeWordBigEndian(anInt1264);
  9595.                     stream.writeWordBigEndian(63);
  9596.                 }
  9597.             }
  9598.             anInt1117++;
  9599.             if (anInt1117 > 1151) {
  9600.                 anInt1117 = 0;
  9601.                 stream.createFrame(246);
  9602.                 stream.writeWordBigEndian(0);
  9603.                 int l = stream.currentOffset;
  9604.                 if ((int) (Math.random() * 2D) == 0)
  9605.                     stream.writeWordBigEndian(101);
  9606.                 stream.writeWordBigEndian(197);
  9607.                 stream.writeWord((int) (Math.random() * 65536D));
  9608.                 stream.writeWordBigEndian((int) (Math.random() * 256D));
  9609.                 stream.writeWordBigEndian(67);
  9610.                 stream.writeWord(14214);
  9611.                 if ((int) (Math.random() * 2D) == 0)
  9612.                     stream.writeWord(29487);
  9613.                 stream.writeWord((int) (Math.random() * 65536D));
  9614.                 if ((int) (Math.random() * 2D) == 0)
  9615.                     stream.writeWordBigEndian(220);
  9616.                 stream.writeWordBigEndian(180);
  9617.                 stream.writeBytes(stream.currentOffset - l);
  9618.             }
  9619.         }
  9620.     }
  9621.  
  9622.     private String interfaceIntToString(int j) {
  9623.         if (j < 0x3b9ac9ff)
  9624.             return String.valueOf(j);
  9625.         else
  9626.             return "*";
  9627.     }
  9628.  
  9629.     public void showErrorScreen() {
  9630.         Graphics g = getGameComponent().getGraphics();
  9631.         g.setColor(Color.black);
  9632.         g.fillRect(0, 0, 765, 503);
  9633.         method4(1);
  9634.         if (loadingError) {
  9635.             aBoolean831 = false;
  9636.             g.setFont(new Font("Helvetica", 1, 16));
  9637.             g.setColor(Color.yellow);
  9638.             int k = 35;
  9639.             g.drawString(
  9640.                     "Sorry, an error has occured whilst loading RatedPixels", 30,
  9641.                     k);
  9642.             k += 50;
  9643.             g.setColor(Color.white);
  9644.             g.drawString("To fix this try the following (in order):", 30, k);
  9645.             k += 50;
  9646.             g.setColor(Color.white);
  9647.             g.setFont(new Font("Helvetica", 1, 12));
  9648.             g.drawString(
  9649.                     "1: Try closing ALL open web-browser windows, and reloading",
  9650.                     30, k);
  9651.             k += 30;
  9652.             g.drawString(
  9653.                     "2: Try clearing your web-browsers cache from tools->internet options",
  9654.                     30, k);
  9655.             k += 30;
  9656.             g.drawString("3: Try using a different game-world", 30, k);
  9657.             k += 30;
  9658.             g.drawString("4: Try rebooting your computer", 30, k);
  9659.             k += 30;
  9660.             g.drawString(
  9661.                     "5: Try selecting a different version of Java from the play-game menu",
  9662.                     30, k);
  9663.         }
  9664.         if (genericLoadingError) {
  9665.             aBoolean831 = false;
  9666.             g.setFont(new Font("Helvetica", 1, 20));
  9667.             g.setColor(Color.white);
  9668.             g.drawString("Error - unable to load game!", 50, 50);
  9669.             g.drawString("To play RatedPixels make sure you play from", 50, 100);
  9670.             g.drawString("http://www.ratedpixels.com", 50, 150);
  9671.         }
  9672.         if (rsAlreadyLoaded) {
  9673.             aBoolean831 = false;
  9674.             g.setColor(Color.yellow);
  9675.             int l = 35;
  9676.             g.drawString(
  9677.                     "Error a copy of RatedPixels already appears to be loaded",
  9678.                     30, l);
  9679.             l += 50;
  9680.             g.setColor(Color.white);
  9681.             g.drawString("To fix this try the following (in order):", 30, l);
  9682.             l += 50;
  9683.             g.setColor(Color.white);
  9684.             g.setFont(new Font("Helvetica", 1, 12));
  9685.             g.drawString(
  9686.                     "1: Try closing ALL open web-browser windows, and reloading",
  9687.                     30, l);
  9688.             l += 30;
  9689.             g.drawString("2: Try rebooting your computer, and reloading", 30, l);
  9690.             l += 30;
  9691.         }
  9692.     }
  9693.  
  9694.     @Override
  9695.     public URL getCodeBase() {
  9696.         try {
  9697.             return new URL(server + ":" + (80 + portOff));
  9698.         } catch (Exception _ex) {
  9699.         }
  9700.         return null;
  9701.     }
  9702.  
  9703.     public void method95() {
  9704.         for (int j = 0; j < npcCount; j++) {
  9705.             int k = npcIndices[j];
  9706.             NPC npc = npcArray[k];
  9707.             if (npc != null)
  9708.                 method96(npc);
  9709.         }
  9710.     }
  9711.  
  9712.     public void method96(Entity entity) {
  9713.         if (entity.x < 128 || entity.y < 128 || entity.x >= 13184
  9714.                 || entity.y >= 13184) {
  9715.             entity.anim = -1;
  9716.             entity.anInt1520 = -1;
  9717.             entity.anInt1547 = 0;
  9718.             entity.anInt1548 = 0;
  9719.             entity.x = entity.smallX[0] * 128 + entity.anInt1540 * 64;
  9720.             entity.y = entity.smallY[0] * 128 + entity.anInt1540 * 64;
  9721.             entity.method446();
  9722.         }
  9723.         if (entity == myPlayer
  9724.                 && (entity.x < 1536 || entity.y < 1536 || entity.x >= 11776 || entity.y >= 11776)) {
  9725.             entity.anim = -1;
  9726.             entity.anInt1520 = -1;
  9727.             entity.anInt1547 = 0;
  9728.             entity.anInt1548 = 0;
  9729.             entity.x = entity.smallX[0] * 128 + entity.anInt1540 * 64;
  9730.             entity.y = entity.smallY[0] * 128 + entity.anInt1540 * 64;
  9731.             entity.method446();
  9732.         }
  9733.         if (entity.anInt1547 > loopCycle)
  9734.             method97(entity);
  9735.         else if (entity.anInt1548 >= loopCycle)
  9736.             method98(entity);
  9737.         else
  9738.             method99(entity);
  9739.         method100(entity);
  9740.         method101(entity);
  9741.     }
  9742.  
  9743.     public void method97(Entity entity) {
  9744.         int i = entity.anInt1547 - loopCycle;
  9745.         int j = entity.anInt1543 * 128 + entity.anInt1540 * 64;
  9746.         int k = entity.anInt1545 * 128 + entity.anInt1540 * 64;
  9747.         entity.x += (j - entity.x) / i;
  9748.         entity.y += (k - entity.y) / i;
  9749.         entity.anInt1503 = 0;
  9750.         if (entity.anInt1549 == 0)
  9751.             entity.turnDirection = 1024;
  9752.         if (entity.anInt1549 == 1)
  9753.             entity.turnDirection = 1536;
  9754.         if (entity.anInt1549 == 2)
  9755.             entity.turnDirection = 0;
  9756.         if (entity.anInt1549 == 3)
  9757.             entity.turnDirection = 512;
  9758.     }
  9759.  
  9760.     public void method98(Entity entity) {
  9761.         if (entity.anInt1548 == loopCycle
  9762.                 || entity.anim == -1
  9763.                 || entity.anInt1529 != 0
  9764.                 || entity.anInt1528 + 1 > Animation.anims[entity.anim]
  9765.                         .method258(entity.anInt1527)) {
  9766.             int i = entity.anInt1548 - entity.anInt1547;
  9767.             int j = loopCycle - entity.anInt1547;
  9768.             int k = entity.anInt1543 * 128 + entity.anInt1540 * 64;
  9769.             int l = entity.anInt1545 * 128 + entity.anInt1540 * 64;
  9770.             int i1 = entity.anInt1544 * 128 + entity.anInt1540 * 64;
  9771.             int j1 = entity.anInt1546 * 128 + entity.anInt1540 * 64;
  9772.             entity.x = (k * (i - j) + i1 * j) / i;
  9773.             entity.y = (l * (i - j) + j1 * j) / i;
  9774.         }
  9775.         entity.anInt1503 = 0;
  9776.         if (entity.anInt1549 == 0)
  9777.             entity.turnDirection = 1024;
  9778.         if (entity.anInt1549 == 1)
  9779.             entity.turnDirection = 1536;
  9780.         if (entity.anInt1549 == 2)
  9781.             entity.turnDirection = 0;
  9782.         if (entity.anInt1549 == 3)
  9783.             entity.turnDirection = 512;
  9784.         entity.anInt1552 = entity.turnDirection;
  9785.     }
  9786.  
  9787.     public void method99(Entity entity) {
  9788.         entity.anInt1517 = entity.anInt1511;
  9789.         if (entity.smallXYIndex == 0) {
  9790.             entity.anInt1503 = 0;
  9791.             return;
  9792.         }
  9793.         if (entity.anim != -1 && entity.anInt1529 == 0) {
  9794.             Animation animation = Animation.anims[entity.anim];
  9795.             if (entity.anInt1542 > 0 && animation.anInt363 == 0) {
  9796.                 entity.anInt1503++;
  9797.                 return;
  9798.             }
  9799.             if (entity.anInt1542 <= 0 && animation.anInt364 == 0) {
  9800.                 entity.anInt1503++;
  9801.                 return;
  9802.             }
  9803.         }
  9804.         int i = entity.x;
  9805.         int j = entity.y;
  9806.         int k = entity.smallX[entity.smallXYIndex - 1] * 128 + entity.anInt1540
  9807.                 * 64;
  9808.         int l = entity.smallY[entity.smallXYIndex - 1] * 128 + entity.anInt1540
  9809.                 * 64;
  9810.         if (k - i > 256 || k - i < -256 || l - j > 256 || l - j < -256) {
  9811.             entity.x = k;
  9812.             entity.y = l;
  9813.             return;
  9814.         }
  9815.         if (i < k) {
  9816.             if (j < l)
  9817.                 entity.turnDirection = 1280;
  9818.             else if (j > l)
  9819.                 entity.turnDirection = 1792;
  9820.             else
  9821.                 entity.turnDirection = 1536;
  9822.         } else if (i > k) {
  9823.             if (j < l)
  9824.                 entity.turnDirection = 768;
  9825.             else if (j > l)
  9826.                 entity.turnDirection = 256;
  9827.             else
  9828.                 entity.turnDirection = 512;
  9829.         } else if (j < l)
  9830.             entity.turnDirection = 1024;
  9831.         else
  9832.             entity.turnDirection = 0;
  9833.         int i1 = entity.turnDirection - entity.anInt1552 & 0x7ff;
  9834.         if (i1 > 1024)
  9835.             i1 -= 2048;
  9836.         int j1 = entity.anInt1555;
  9837.         if (i1 >= -256 && i1 <= 256)
  9838.             j1 = entity.anInt1554;
  9839.         else if (i1 >= 256 && i1 < 768)
  9840.             j1 = entity.anInt1557;
  9841.         else if (i1 >= -768 && i1 <= -256)
  9842.             j1 = entity.anInt1556;
  9843.         if (j1 == -1)
  9844.             j1 = entity.anInt1554;
  9845.         entity.anInt1517 = j1;
  9846.         int k1 = 4;
  9847.         if (entity.anInt1552 != entity.turnDirection
  9848.                 && entity.interactingEntity == -1 && entity.anInt1504 != 0)
  9849.             k1 = 2;
  9850.         if (entity.smallXYIndex > 2)
  9851.             k1 = 6;
  9852.         if (entity.smallXYIndex > 3)
  9853.             k1 = 8;
  9854.         if (entity.anInt1503 > 0 && entity.smallXYIndex > 1) {
  9855.             k1 = 8;
  9856.             entity.anInt1503--;
  9857.         }
  9858.         if (entity.aBooleanArray1553[entity.smallXYIndex - 1])
  9859.             k1 <<= 1;
  9860.         if (k1 >= 8 && entity.anInt1517 == entity.anInt1554
  9861.                 && entity.anInt1505 != -1)
  9862.             entity.anInt1517 = entity.anInt1505;
  9863.         if (i < k) {
  9864.             entity.x += k1;
  9865.             if (entity.x > k)
  9866.                 entity.x = k;
  9867.         } else if (i > k) {
  9868.             entity.x -= k1;
  9869.             if (entity.x < k)
  9870.                 entity.x = k;
  9871.         }
  9872.         if (j < l) {
  9873.             entity.y += k1;
  9874.             if (entity.y > l)
  9875.                 entity.y = l;
  9876.         } else if (j > l) {
  9877.             entity.y -= k1;
  9878.             if (entity.y < l)
  9879.                 entity.y = l;
  9880.         }
  9881.         if (entity.x == k && entity.y == l) {
  9882.             entity.smallXYIndex--;
  9883.             if (entity.anInt1542 > 0)
  9884.                 entity.anInt1542--;
  9885.         }
  9886.     }
  9887.  
  9888.     public void method100(Entity entity) {
  9889.         if (entity.anInt1504 == 0)
  9890.             return;
  9891.         if (entity.interactingEntity != -1 && entity.interactingEntity < 32768) {
  9892.             NPC npc = npcArray[entity.interactingEntity];
  9893.             if (npc != null) {
  9894.                 int i1 = entity.x - npc.x;
  9895.                 int k1 = entity.y - npc.y;
  9896.                 if (i1 != 0 || k1 != 0)
  9897.                     entity.turnDirection = (int) (Math.atan2(i1, k1) * 325.94900000000001D) & 0x7ff;
  9898.             }
  9899.         }
  9900.         if (entity.interactingEntity >= 32768) {
  9901.             int j = entity.interactingEntity - 32768;
  9902.             if (j == unknownInt10)
  9903.                 j = myPlayerIndex;
  9904.             Player player = playerArray[j];
  9905.             if (player != null) {
  9906.                 int l1 = entity.x - player.x;
  9907.                 int i2 = entity.y - player.y;
  9908.                 if (l1 != 0 || i2 != 0)
  9909.                     entity.turnDirection = (int) (Math.atan2(l1, i2) * 325.94900000000001D) & 0x7ff;
  9910.             }
  9911.         }
  9912.         if ((entity.anInt1538 != 0 || entity.anInt1539 != 0)
  9913.                 && (entity.smallXYIndex == 0 || entity.anInt1503 > 0)) {
  9914.             int k = entity.x - (entity.anInt1538 - baseX - baseX) * 64;
  9915.             int j1 = entity.y - (entity.anInt1539 - baseY - baseY) * 64;
  9916.             if (k != 0 || j1 != 0)
  9917.                 entity.turnDirection = (int) (Math.atan2(k, j1) * 325.94900000000001D) & 0x7ff;
  9918.             entity.anInt1538 = 0;
  9919.             entity.anInt1539 = 0;
  9920.         }
  9921.         int l = entity.turnDirection - entity.anInt1552 & 0x7ff;
  9922.         if (l != 0) {
  9923.             if (l < entity.anInt1504 || l > 2048 - entity.anInt1504)
  9924.                 entity.anInt1552 = entity.turnDirection;
  9925.             else if (l > 1024)
  9926.                 entity.anInt1552 -= entity.anInt1504;
  9927.             else
  9928.                 entity.anInt1552 += entity.anInt1504;
  9929.             entity.anInt1552 &= 0x7ff;
  9930.             if (entity.anInt1517 == entity.anInt1511
  9931.                     && entity.anInt1552 != entity.turnDirection) {
  9932.                 if (entity.anInt1512 != -1) {
  9933.                     entity.anInt1517 = entity.anInt1512;
  9934.                     return;
  9935.                 }
  9936.                 entity.anInt1517 = entity.anInt1554;
  9937.             }
  9938.         }
  9939.     }
  9940.  
  9941.     public void method101(Entity entity) {
  9942.         entity.aBoolean1541 = false;
  9943.         if (entity.anInt1517 != -1) {
  9944.             Animation animation = Animation.anims[entity.anInt1517];
  9945.             entity.anInt1519++;
  9946.             if (entity.anInt1518 < animation.anInt352
  9947.                     && entity.anInt1519 > animation.method258(entity.anInt1518)) {
  9948.                 entity.anInt1519 = 1;
  9949.                 entity.anInt1518++;
  9950.             }
  9951.             if (entity.anInt1518 >= animation.anInt352) {
  9952.                 entity.anInt1519 = 1;
  9953.                 entity.anInt1518 = 0;
  9954.             }
  9955.         }
  9956.         if (entity.anInt1520 != -1 && loopCycle >= entity.anInt1523) {
  9957.             if (entity.anInt1521 < 0)
  9958.                 entity.anInt1521 = 0;
  9959.             Animation animation_1 = SpotAnim.cache[entity.anInt1520].aAnimation_407;
  9960.             for (entity.anInt1522++; entity.anInt1521 < animation_1.anInt352
  9961.                     && entity.anInt1522 > animation_1
  9962.                             .method258(entity.anInt1521); entity.anInt1521++)
  9963.                 entity.anInt1522 -= animation_1.method258(entity.anInt1521);
  9964.  
  9965.             if (entity.anInt1521 >= animation_1.anInt352
  9966.                     && (entity.anInt1521 < 0 || entity.anInt1521 >= animation_1.anInt352))
  9967.                 entity.anInt1520 = -1;
  9968.         }
  9969.         if (entity.anim != -1 && entity.anInt1529 <= 1) {
  9970.             Animation animation_2 = Animation.anims[entity.anim];
  9971.             if (animation_2.anInt363 == 1 && entity.anInt1542 > 0
  9972.                     && entity.anInt1547 <= loopCycle
  9973.                     && entity.anInt1548 < loopCycle) {
  9974.                 entity.anInt1529 = 1;
  9975.                 return;
  9976.             }
  9977.         }
  9978.         if (entity.anim != -1 && entity.anInt1529 == 0) {
  9979.             Animation animation_3 = Animation.anims[entity.anim];
  9980.             for (entity.anInt1528++; entity.anInt1527 < animation_3.anInt352
  9981.                     && entity.anInt1528 > animation_3
  9982.                             .method258(entity.anInt1527); entity.anInt1527++)
  9983.                 entity.anInt1528 -= animation_3.method258(entity.anInt1527);
  9984.  
  9985.             if (entity.anInt1527 >= animation_3.anInt352) {
  9986.                 entity.anInt1527 -= animation_3.anInt356;
  9987.                 entity.anInt1530++;
  9988.                 if (entity.anInt1530 >= animation_3.anInt362)
  9989.                     entity.anim = -1;
  9990.                 if (entity.anInt1527 < 0
  9991.                         || entity.anInt1527 >= animation_3.anInt352)
  9992.                     entity.anim = -1;
  9993.             }
  9994.             entity.aBoolean1541 = animation_3.aBoolean358;
  9995.         }
  9996.         if (entity.anInt1529 > 0)
  9997.             entity.anInt1529--;
  9998.     }
  9999.  
  10000.     private void drawGameScreen() {
  10001.         if (fullscreenInterfaceID != -1 && (loadingStage == 2 || super.fullGameScreen != null)) {
  10002.             if (loadingStage == 2) {
  10003.                 method119(anInt945, fullscreenInterfaceID);
  10004.                 if (openInterfaceID != -1) {
  10005.                     method119(anInt945, openInterfaceID);
  10006.                 }
  10007.                 anInt945 = 0;
  10008.                 resetAllImageProducers();
  10009.                 super.fullGameScreen.initDrawingArea();
  10010.                 Texture.anIntArray1472 = fullScreenTextureArray;
  10011.                 DrawingArea.setAllPixelsToZero();
  10012.                 welcomeScreenRaised = true;
  10013.                 if (openInterfaceID != -1) {
  10014.                     RSInterface rsInterface_1 = RSInterface.interfaceCache[openInterfaceID];
  10015.                     if (rsInterface_1.width == 512 && rsInterface_1.height == 334 && rsInterface_1.type == 0) {
  10016.                         rsInterface_1.width = 765;
  10017.                         rsInterface_1.height = 503;
  10018.                     }
  10019.                     drawInterface(0, 0, rsInterface_1, 8);
  10020.                 }
  10021.                 RSInterface rsInterface = RSInterface.interfaceCache[fullscreenInterfaceID];
  10022.                 if (rsInterface.width == 512 && rsInterface.height == 334 && rsInterface.type == 0) {
  10023.                     rsInterface.width = 765;
  10024.                     rsInterface.height = 503;
  10025.                 }
  10026.                 drawInterface(0, 0, rsInterface, 8);
  10027.                 if (!menuOpen) {
  10028.                     processRightClick();
  10029.                     drawTooltip();
  10030.                 } else {
  10031.                     drawMenu(frameMode == ScreenMode.FIXED ? 4 : 0, frameMode == ScreenMode.FIXED ? 4 : 0);
  10032.                 }
  10033.             }
  10034.             drawCount++;
  10035.             super.fullGameScreen.drawGraphics(0, super.graphics, 0);
  10036.             return;
  10037.         } else {
  10038.             if (drawCount != 0) {
  10039.                 resetImageProducers2();
  10040.             }
  10041.         }
  10042.         if (welcomeScreenRaised) {
  10043.             welcomeScreenRaised = false;
  10044.             if (frameMode == ScreenMode.FIXED) {
  10045.                 topFrame.drawGraphics(0, super.graphics, 0);
  10046.                 leftFrame.drawGraphics(4, super.graphics, 0);
  10047.                 mapEdgeIP.drawGraphics(4, super.graphics, 516);
  10048.             }
  10049.             inputTaken = true;
  10050.             tabAreaAltered = true;
  10051.             if (loadingStage != 2) {
  10052.                 if (frameMode == ScreenMode.FIXED) {
  10053.                     aRSImageProducer_1165.drawGraphics(frameMode == ScreenMode.FIXED ? 4 : 0, super.graphics, frameMode == ScreenMode.FIXED ? 4 : 0);
  10054.                     aRSImageProducer_1164.drawGraphics(0, super.graphics, 516);
  10055.                 }
  10056.             }
  10057.         }
  10058.         if (invOverlayInterfaceID != -1) {
  10059.             method119(anInt945, invOverlayInterfaceID);
  10060.         }
  10061.         drawTabArea();
  10062.         if(backDialogID == -1) {
  10063.             aClass9_1059.scrollPosition = anInt1211 - anInt1089 - 110;
  10064.             if(super.mouseX >= 496 && super.mouseX <= 511 && super.mouseY > (frameMode == ScreenMode.FIXED ? 345 : frameHeight - 158))
  10065.                 method65(494, 110, super.mouseX, super.mouseY - (frameMode == ScreenMode.FIXED ? 345 : frameHeight - 158), aClass9_1059, 0, false, anInt1211);
  10066.             int i = anInt1211 - 110 - aClass9_1059.scrollPosition;
  10067.             if(i < 0) {
  10068.                 i = 0;
  10069.             }
  10070.             if(i > anInt1211 - 110) {
  10071.                 i = anInt1211 - 110;
  10072.             }
  10073.             if(anInt1089 != i) {
  10074.                 anInt1089 = i;
  10075.                 inputTaken = true;
  10076.             }
  10077.         }
  10078.         if (backDialogID != -1) {
  10079.             boolean flag2 = method119(anInt945, backDialogID);
  10080.             if (flag2)
  10081.                 inputTaken = true;
  10082.         }
  10083.         if (atInventoryInterfaceType == 3)
  10084.             inputTaken = true;
  10085.         if (activeInterfaceType == 3)
  10086.             inputTaken = true;
  10087.         if (aString844 != null)
  10088.             inputTaken = true;
  10089.         if (menuOpen && menuScreenArea == 2)
  10090.             inputTaken = true;
  10091.         if (inputTaken) {
  10092.             drawChatArea();
  10093.             inputTaken = false;
  10094.         }
  10095.         if (loadingStage == 2)
  10096.             method146();
  10097.         if (loadingStage == 2) {
  10098.             if (frameMode == ScreenMode.FIXED) {
  10099.                 drawMinimap();
  10100.                 aRSImageProducer_1164.drawGraphics(0, super.graphics, 516);
  10101.             }
  10102.         }
  10103.         if (anInt1054 != -1)
  10104.             tabAreaAltered = true;
  10105.         if (tabAreaAltered) {
  10106.             if (anInt1054 != -1 && anInt1054 == tabID) {
  10107.                 anInt1054 = -1;
  10108.                 stream.createFrame(120);
  10109.                 stream.writeWordBigEndian(tabID);
  10110.             }
  10111.             tabAreaAltered = false;
  10112.             aRSImageProducer_1125.initDrawingArea();
  10113.             aRSImageProducer_1165.initDrawingArea();
  10114.         }
  10115.         anInt945 = 0;
  10116.     }
  10117.  
  10118.     private boolean buildFriendsListMenu(RSInterface class9) {
  10119.         int i = class9.contentType;
  10120.         if (i >= 1 && i <= 200 || i >= 701 && i <= 900) {
  10121.             if (i >= 801)
  10122.                 i -= 701;
  10123.             else if (i >= 701)
  10124.                 i -= 601;
  10125.             else if (i >= 101)
  10126.                 i -= 101;
  10127.             else
  10128.                 i--;
  10129.             menuActionName[menuActionRow] = "Remove @whi@" + friendsList[i];
  10130.             menuActionID[menuActionRow] = 792;
  10131.             menuActionRow++;
  10132.             menuActionName[menuActionRow] = "Message @whi@" + friendsList[i];
  10133.             menuActionID[menuActionRow] = 639;
  10134.             menuActionRow++;
  10135.             return true;
  10136.         }
  10137.         if (i >= 401 && i <= 500) {
  10138.             menuActionName[menuActionRow] = "Remove @whi@" + class9.message;
  10139.             menuActionID[menuActionRow] = 322;
  10140.             menuActionRow++;
  10141.             return true;
  10142.         } else {
  10143.             return false;
  10144.         }
  10145.     }
  10146.  
  10147.     public void method104() {
  10148.         Animable_Sub3 class30_sub2_sub4_sub3 = (Animable_Sub3) aClass19_1056
  10149.                 .reverseGetFirst();
  10150.         for (; class30_sub2_sub4_sub3 != null; class30_sub2_sub4_sub3 = (Animable_Sub3) aClass19_1056
  10151.                 .reverseGetNext())
  10152.             if (class30_sub2_sub4_sub3.anInt1560 != plane
  10153.                     || class30_sub2_sub4_sub3.aBoolean1567)
  10154.                 class30_sub2_sub4_sub3.unlink();
  10155.             else if (loopCycle >= class30_sub2_sub4_sub3.anInt1564) {
  10156.                 class30_sub2_sub4_sub3.method454(anInt945);
  10157.                 if (class30_sub2_sub4_sub3.aBoolean1567)
  10158.                     class30_sub2_sub4_sub3.unlink();
  10159.                 else
  10160.                     worldController.method285(class30_sub2_sub4_sub3.anInt1560,
  10161.                             0, class30_sub2_sub4_sub3.anInt1563, -1,
  10162.                             class30_sub2_sub4_sub3.anInt1562, 60,
  10163.                             class30_sub2_sub4_sub3.anInt1561,
  10164.                             class30_sub2_sub4_sub3, false);
  10165.             }
  10166.  
  10167.     }
  10168.  
  10169.     private void drawInterface(int j, int k, RSInterface class9, int l) {
  10170.         if (class9.type != 0 || class9.children == null)
  10171.             return;
  10172.         if (class9.isMouseoverTriggered && anInt1026 != class9.id
  10173.                 && anInt1048 != class9.id && anInt1039 != class9.id)
  10174.             return;
  10175.         int i1 = DrawingArea.topX;
  10176.         int j1 = DrawingArea.topY;
  10177.         int k1 = DrawingArea.bottomX;
  10178.         int l1 = DrawingArea.bottomY;
  10179.         DrawingArea.setDrawingArea(l + class9.height, k, k + class9.width, l);
  10180.         int i2 = class9.children.length;
  10181.         for (int j2 = 0; j2 < i2; j2++) {
  10182.             int k2 = class9.childX[j2] + k;
  10183.             int l2 = (class9.childY[j2] + l) - j;
  10184.             RSInterface class9_1 = RSInterface.interfaceCache[class9.children[j2]];
  10185.             k2 += class9_1.anInt263;
  10186.             l2 += class9_1.anInt265;
  10187.             if (class9_1.contentType > 0)
  10188.                 drawFriendsListOrWelcomeScreen(class9_1);
  10189.             // here
  10190.             int[] IDs = { 1196, 1199, 1206, 1215, 1224, 1231, 1240, 1249, 1258,
  10191.                     1267, 1274, 1283, 1573, 1290, 1299, 1308, 1315, 1324, 1333,
  10192.                     1340, 1349, 1358, 1367, 1374, 1381, 1388, 1397, 1404, 1583,
  10193.                     12038, 1414, 1421, 1430, 1437, 1446, 1453, 1460, 1469,
  10194.                     15878, 1602, 1613, 1624, 7456, 1478, 1485, 1494, 1503,
  10195.                     1512, 1521, 1530, 1544, 1553, 1563, 1593, 1635, 12426,
  10196.                     12436, 12446, 12456, 6004, 18471,
  10197.                     /* Ancients */
  10198.                     12940, 12988, 13036, 12902, 12862, 13046, 12964, 13012,
  10199.                     13054, 12920, 12882, 13062, 12952, 13000, 13070, 12912,
  10200.                     12872, 13080, 12976, 13024, 13088, 12930, 12892, 13096 };
  10201.             for (int m5 = 0; m5 < IDs.length; m5++) {
  10202.                 if (class9_1.id == IDs[m5] + 1) {
  10203.                     if (m5 > 61)
  10204.                         drawBlackBox(k2 + 1, l2);
  10205.                     else
  10206.                         drawBlackBox(k2, l2 + 1);
  10207.                 }
  10208.             }
  10209.             int[] runeChildren = { 1202, 1203, 1209, 1210, 1211, 1218, 1219,
  10210.                     1220, 1227, 1228, 1234, 1235, 1236, 1243, 1244, 1245, 1252,
  10211.                     1253, 1254, 1261, 1262, 1263, 1270, 1271, 1277, 1278, 1279,
  10212.                     1286, 1287, 1293, 1294, 1295, 1302, 1303, 1304, 1311, 1312,
  10213.                     1318, 1319, 1320, 1327, 1328, 1329, 1336, 1337, 1343, 1344,
  10214.                     1345, 1352, 1353, 1354, 1361, 1362, 1363, 1370, 1371, 1377,
  10215.                     1378, 1384, 1385, 1391, 1392, 1393, 1400, 1401, 1407, 1408,
  10216.                     1410, 1417, 1418, 1424, 1425, 1426, 1433, 1434, 1440, 1441,
  10217.                     1442, 1449, 1450, 1456, 1457, 1463, 1464, 1465, 1472, 1473,
  10218.                     1474, 1481, 1482, 1488, 1489, 1490, 1497, 1498, 1499, 1506,
  10219.                     1507, 1508, 1515, 1516, 1517, 1524, 1525, 1526, 1533, 1534,
  10220.                     1535, 1547, 1548, 1549, 1556, 1557, 1558, 1566, 1567, 1568,
  10221.                     1576, 1577, 1578, 1586, 1587, 1588, 1596, 1597, 1598, 1605,
  10222.                     1606, 1607, 1616, 1617, 1618, 1627, 1628, 1629, 1638, 1639,
  10223.                     1640, 6007, 6008, 6011, 8673, 8674, 12041, 12042, 12429,
  10224.                     12430, 12431, 12439, 12440, 12441, 12449, 12450, 12451,
  10225.                     12459, 12460, 15881, 15882, 15885, 18474, 18475, 18478 };
  10226.             for (int r = 0; r < runeChildren.length; r++)
  10227.                 if (class9_1.id == runeChildren[r])
  10228.                     class9_1.modelZoom = 775;
  10229.             if (class9_1.type == 0) {
  10230.                 SortTabs();
  10231.                 if (class9_1.scrollPosition > class9_1.scrollMax
  10232.                         - class9_1.height)
  10233.                     class9_1.scrollPosition = class9_1.scrollMax
  10234.                             - class9_1.height;
  10235.                 if (class9_1.scrollPosition < 0)
  10236.                     class9_1.scrollPosition = 0;
  10237.                 drawInterface(class9_1.scrollPosition, k2, class9_1, l2);
  10238.                 if (class9_1.scrollMax > class9_1.height) {
  10239.                     // clan chat
  10240.                     if (class9_1.id == 18143) {
  10241.                         int clanMates = 0;
  10242.                         for (int i = 18155; i < 18244; i++) {
  10243.                             RSInterface line = RSInterface.interfaceCache[i];
  10244.                             if (line.message.length() > 0) {
  10245.                                 clanMates++;
  10246.                             }
  10247.                         }
  10248.                         class9_1.scrollMax = (clanMates * 14) + class9_1.height
  10249.                                 + 1;
  10250.                     }
  10251.                     if (class9_1.id == 18322 || class9_1.id == 18423) {
  10252.                         int members = 0;
  10253.                         for (int i = class9_1.id + 1; i < class9_1.id + 1 + 100; i++) {
  10254.                             RSInterface line = RSInterface.interfaceCache[i];
  10255.                             if (line != null && line.message != null) {
  10256.                                 if (line.message.length() > 0) {
  10257.                                     members++;
  10258.                                 }
  10259.                             }
  10260.                         }
  10261.                         class9_1.scrollMax = (members * 14) + 1;
  10262.                     }
  10263.                     drawScrollbar(class9_1.height, class9_1.scrollPosition, l2,
  10264.                             k2 + class9_1.width, class9_1.scrollMax, false);
  10265.                 }
  10266.             } else if (class9_1.type != 1)
  10267.                 if (class9_1.type == 2) {
  10268.                     int i3 = 0;
  10269.                     for (int l3 = 0; l3 < class9_1.height; l3++) {
  10270.                         for (int l4 = 0; l4 < class9_1.width; l4++) {
  10271.                             int k5 = k2 + l4 * (32 + class9_1.invSpritePadX);
  10272.                             int j6 = l2 + l3 * (32 + class9_1.invSpritePadY);
  10273.                             if (i3 < 20) {
  10274.                                 k5 += class9_1.spritesX[i3];
  10275.                                 j6 += class9_1.spritesY[i3];
  10276.                             }
  10277.                             if (class9_1.inv[i3] > 0) {
  10278.                                 int k6 = 0;
  10279.                                 int j7 = 0;
  10280.                                 int j9 = class9_1.inv[i3] - 1;
  10281.                                 if (k5 > DrawingArea.topX - 32
  10282.                                         && k5 < DrawingArea.bottomX
  10283.                                         && j6 > DrawingArea.topY - 32
  10284.                                         && j6 < DrawingArea.bottomY
  10285.                                         || activeInterfaceType != 0
  10286.                                         && anInt1085 == i3) {
  10287.                                     int l9 = 0;
  10288.                                     if (itemSelected == 1 && anInt1283 == i3
  10289.                                             && anInt1284 == class9_1.id)
  10290.                                         l9 = 0xffffff;
  10291.                                     Sprite class30_sub2_sub1_sub1_2 = ItemDef
  10292.                                             .getSprite(j9,
  10293.                                                     class9_1.invStackSizes[i3],
  10294.                                                     l9);
  10295.                                     if (class30_sub2_sub1_sub1_2 != null) {
  10296.                                         if (activeInterfaceType != 0
  10297.                                                 && anInt1085 == i3
  10298.                                                 && anInt1084 == class9_1.id) {
  10299.                                             k6 = super.mouseX - anInt1087;
  10300.                                             j7 = super.mouseY - anInt1088;
  10301.                                             if (k6 < 5 && k6 > -5)
  10302.                                                 k6 = 0;
  10303.                                             if (j7 < 5 && j7 > -5)
  10304.                                                 j7 = 0;
  10305.                                             if (anInt989 < 12) {
  10306.                                                 k6 = 0;
  10307.                                                 j7 = 0;
  10308.                                             }
  10309.                                             class30_sub2_sub1_sub1_2
  10310.                                                     .drawSprite1(k5 + k6, j6
  10311.                                                             + j7);
  10312.                                             if (j6 + j7 < DrawingArea.topY
  10313.                                                     && class9.scrollPosition > 0) {
  10314.                                                 int i10 = (anInt945 * (DrawingArea.topY
  10315.                                                         - j6 - j7)) / 3;
  10316.                                                 if (i10 > anInt945 * 10)
  10317.                                                     i10 = anInt945 * 10;
  10318.                                                 if (i10 > class9.scrollPosition)
  10319.                                                     i10 = class9.scrollPosition;
  10320.                                                 class9.scrollPosition -= i10;
  10321.                                                 anInt1088 += i10;
  10322.                                             }
  10323.                                             if (j6 + j7 + 32 > DrawingArea.bottomY
  10324.                                                     && class9.scrollPosition < class9.scrollMax
  10325.                                                             - class9.height) {
  10326.                                                 int j10 = (anInt945 * ((j6 + j7 + 32) - DrawingArea.bottomY)) / 3;
  10327.                                                 if (j10 > anInt945 * 10)
  10328.                                                     j10 = anInt945 * 10;
  10329.                                                 if (j10 > class9.scrollMax
  10330.                                                         - class9.height
  10331.                                                         - class9.scrollPosition)
  10332.                                                     j10 = class9.scrollMax
  10333.                                                             - class9.height
  10334.                                                             - class9.scrollPosition;
  10335.                                                 class9.scrollPosition += j10;
  10336.                                                 anInt1088 -= j10;
  10337.                                             }
  10338.                                         } else if (atInventoryInterfaceType != 0
  10339.                                                 && atInventoryIndex == i3
  10340.                                                 && atInventoryInterface == class9_1.id)
  10341.                                             class30_sub2_sub1_sub1_2
  10342.                                                     .drawSprite1(k5, j6);
  10343.                                         else
  10344.                                             class30_sub2_sub1_sub1_2
  10345.                                                     .drawSprite(k5, j6);
  10346.                                         if (class30_sub2_sub1_sub1_2.maxWidth == 33
  10347.                                                 || class9_1.invStackSizes[i3] != 1) {
  10348.                                             int k10 = class9_1.invStackSizes[i3];
  10349.                                             if (k10 >= 1)
  10350.                                                 smallText.method385(0xFFFF00,
  10351.                                                         intToKOrMil(k10), j6
  10352.                                                                 + 9 + j7, k5
  10353.                                                                 + k6);
  10354.                                             smallText.method385(0,
  10355.                                                     intToKOrMil(k10), j6 + 10
  10356.                                                             + j7, k5 + 1 + k6);
  10357.                                             if (k10 > 99999 && k10 < 10000000) {
  10358.                                                 smallText.method385(0xFFFFFF,
  10359.                                                         intToKOrMil(k10), j6
  10360.                                                                 + 9 + j7, k5
  10361.                                                                 + k6);
  10362.                                             } else if (k10 > 9999999) {
  10363.                                                 smallText.method385(0x00ff80,
  10364.                                                         intToKOrMil(k10), j6
  10365.                                                                 + 9 + j7, k5
  10366.                                                                 + k6);
  10367.                                             } else {
  10368.                                                 smallText.method385(0xFFFF00,
  10369.                                                         intToKOrMil(k10), j6
  10370.                                                                 + 9 + j7, k5
  10371.                                                                 + k6);
  10372.                                             }
  10373.  
  10374.                                             /*
  10375.                                              * smallText.method385(0,
  10376.                                              * intToKOrMil(k10), j6 + 10 + j7,
  10377.                                              * k5 + 1 + k6);
  10378.                                              * smallText.method385(0xffff00,
  10379.                                              * intToKOrMil(k10), j6 + 9 + j7, k5
  10380.                                              * + k6);
  10381.                                              */
  10382.                                         }
  10383.                                     }
  10384.                                 }
  10385.                             } else if (class9_1.sprites != null && i3 < 20) {
  10386.                                 Sprite class30_sub2_sub1_sub1_1 = class9_1.sprites[i3];
  10387.                                 if (class30_sub2_sub1_sub1_1 != null)
  10388.                                     class30_sub2_sub1_sub1_1.drawSprite(k5, j6);
  10389.                             }
  10390.                             i3++;
  10391.                         }
  10392.                     }
  10393.                 } else if (class9_1.type == 13) {
  10394.                     int i3 = 0;
  10395.                     for (int l3 = 0; l3 < class9_1.height; l3++) {
  10396.                         for (int l4 = 0; l4 < class9_1.width; l4++) {
  10397.                             int k5 = k2 + l4 * (32 + class9_1.invSpritePadX);
  10398.                             int j6 = l2 + l3 * (32 + class9_1.invSpritePadY);
  10399.                             if (i3 < 20) {
  10400.                                 k5 += class9_1.spritesX[i3];
  10401.                                 j6 += class9_1.spritesY[i3];
  10402.                             }
  10403.                             if (class9_1.inv[i3] > 0) {
  10404.                                 int k6 = 0;
  10405.                                 int j7 = 0;
  10406.                                 int j9 = class9_1.inv[i3] - 1;
  10407.                                 if (k5 > DrawingArea.topX - 32
  10408.                                         && k5 < DrawingArea.bottomX
  10409.                                         && j6 > DrawingArea.topY - 32
  10410.                                         && j6 < DrawingArea.bottomY
  10411.                                         || activeInterfaceType != 0
  10412.                                         && anInt1085 == i3) {
  10413.                                     int l9 = 0;
  10414.                                     if (itemSelected == 1 && anInt1283 == i3
  10415.                                             && anInt1284 == class9_1.id)
  10416.                                         l9 = 0xffffff;
  10417.                                     Sprite class30_sub2_sub1_sub1_2 = ItemDef
  10418.                                             .getSprite(j9,
  10419.                                                     class9_1.invStackSizes[i3],
  10420.                                                     l9);
  10421.                                     if (class30_sub2_sub1_sub1_2 != null) {
  10422.                                         if (activeInterfaceType != 0
  10423.                                                 && anInt1085 == i3
  10424.                                                 && anInt1084 == class9_1.id) {
  10425.                                             k6 = super.mouseX - anInt1087;
  10426.                                             j7 = super.mouseY - anInt1088;
  10427.                                             if (k6 < 5 && k6 > -5)
  10428.                                                 k6 = 0;
  10429.                                             if (j7 < 5 && j7 > -5)
  10430.                                                 j7 = 0;
  10431.                                             if (anInt989 < 10) {
  10432.                                                 k6 = 0;
  10433.                                                 j7 = 0;
  10434.                                             }
  10435.                                             class30_sub2_sub1_sub1_2
  10436.                                                     .drawSprite1(k5 + k6, j6
  10437.                                                             + j7);
  10438.  
  10439.                                             if (j6 + j7 < DrawingArea.topY
  10440.                                                     && class9.scrollPosition > 0) {
  10441.                                                 int i10 = (anInt945 * (DrawingArea.topY
  10442.                                                         - j6 - j7)) / 3;
  10443.                                                 if (i10 > anInt945 * 10)
  10444.                                                     i10 = anInt945 * 10;
  10445.                                                 if (i10 > class9.scrollPosition)
  10446.                                                     i10 = class9.scrollPosition;
  10447.                                                 class9.scrollPosition -= i10;
  10448.                                                 anInt1088 += i10;
  10449.                                             }
  10450.                                             if (j6 + j7 + 32 > DrawingArea.bottomY
  10451.                                                     && class9.scrollPosition < class9.scrollMax
  10452.                                                             - class9.height) {
  10453.                                                 int j10 = (anInt945 * ((j6 + j7 + 32) - DrawingArea.bottomY)) / 3;
  10454.                                                 if (j10 > anInt945 * 10)
  10455.                                                     j10 = anInt945 * 10;
  10456.                                                 if (j10 > class9.scrollMax
  10457.                                                         - class9.height
  10458.                                                         - class9.scrollPosition)
  10459.                                                     j10 = class9.scrollMax
  10460.                                                             - class9.height
  10461.                                                             - class9.scrollPosition;
  10462.                                                 class9.scrollPosition += j10;
  10463.                                                 anInt1088 -= j10;
  10464.                                             }
  10465.                                         } else if (atInventoryInterfaceType != 0
  10466.                                                 && atInventoryIndex == i3
  10467.                                                 && atInventoryInterface == class9_1.id)
  10468.                                             class30_sub2_sub1_sub1_2
  10469.                                                     .drawSprite1(k5, j6);
  10470.                                         else
  10471.                                             class30_sub2_sub1_sub1_2
  10472.                                                     .drawSprite(k5, j6);
  10473.                                     }
  10474.                                 }
  10475.                             } else if (class9_1.sprites != null && i3 < 20) {
  10476.                                 Sprite class30_sub2_sub1_sub1_1 = class9_1.sprites[i3];
  10477.                                 if (class30_sub2_sub1_sub1_1 != null)
  10478.                                     class30_sub2_sub1_sub1_1.drawSprite(k5, j6);
  10479.                             }
  10480.                             i3++;
  10481.                         }
  10482.                     }
  10483.                 } else if (class9_1.type == 3) {
  10484.                     boolean flag = false;
  10485.                     if (anInt1039 == class9_1.id || anInt1048 == class9_1.id
  10486.                             || anInt1026 == class9_1.id)
  10487.                         flag = true;
  10488.                     int j3;
  10489.                     if (interfaceIsSelected(class9_1)) {
  10490.                         j3 = class9_1.anInt219;
  10491.                         if (flag && class9_1.anInt239 != 0)
  10492.                             j3 = class9_1.anInt239;
  10493.                     } else {
  10494.                         j3 = class9_1.textColor;
  10495.                         if (flag && class9_1.anInt216 != 0)
  10496.                             j3 = class9_1.anInt216;
  10497.                     }
  10498.                     if (class9_1.aByte254 == 0) {
  10499.                         if (class9_1.aBoolean227)
  10500.                             DrawingArea.drawPixels(class9_1.height, l2, k2, j3,
  10501.                                     class9_1.width);
  10502.                         else
  10503.                             DrawingArea.fillPixels(k2, class9_1.width,
  10504.                                     class9_1.height, j3, l2);
  10505.                     } else if (class9_1.aBoolean227)
  10506.                         DrawingArea.method335(j3, l2, class9_1.width,
  10507.                                 class9_1.height,
  10508.                                 256 - (class9_1.aByte254 & 0xff), k2);
  10509.                     else
  10510.                         DrawingArea.method338(l2, class9_1.height,
  10511.                                 256 - (class9_1.aByte254 & 0xff), j3,
  10512.                                 class9_1.width, k2);
  10513.                 } else if (class9_1.type == 4) {
  10514.                     TextDrawingArea textDrawingArea = class9_1.textDrawingAreas;
  10515.                     String s = class9_1.message;
  10516.                     boolean flag1 = false;
  10517.                     if (anInt1039 == class9_1.id || anInt1048 == class9_1.id
  10518.                             || anInt1026 == class9_1.id)
  10519.                         flag1 = true;
  10520.                     int i4;
  10521.                     if (interfaceIsSelected(class9_1)) {
  10522.                         i4 = class9_1.anInt219;
  10523.                         if (flag1 && class9_1.anInt239 != 0)
  10524.                             i4 = class9_1.anInt239;
  10525.                         if (class9_1.aString228.length() > 0)
  10526.                             s = class9_1.aString228;
  10527.                     } else {
  10528.                         i4 = class9_1.textColor;
  10529.                         if (flag1 && class9_1.anInt216 != 0)
  10530.                             i4 = class9_1.anInt216;
  10531.                     }
  10532.                     if (class9_1.atActionType == 6 && aBoolean1149) {
  10533.                         s = "Please wait...";
  10534.                         i4 = class9_1.textColor;
  10535.                     }
  10536.                     if (DrawingArea.width == 519) {
  10537.                         if (i4 == 0xffff00)
  10538.                             i4 = 255;
  10539.                         if (i4 == 49152)
  10540.                             i4 = 0xffffff;
  10541.                     }
  10542.                     if ((class9_1.parentID == 1151)
  10543.                             || (class9_1.parentID == 12855)) {
  10544.                         switch (i4) {
  10545.                         case 16773120:
  10546.                             i4 = 0xFE981F;
  10547.                             break;
  10548.                         case 7040819:
  10549.                             i4 = 0xAF6A1A;
  10550.                             break;
  10551.                         }
  10552.                     }
  10553.                     for (int l6 = l2 + textDrawingArea.anInt1497; s.length() > 0; l6 += textDrawingArea.anInt1497) {
  10554.                         if (s.indexOf("%") != -1) {
  10555.                             do {
  10556.                                 int k7 = s.indexOf("%1");
  10557.                                 if (k7 == -1)
  10558.                                     break;
  10559.                                 if (class9_1.id < 4000 || class9_1.id > 5000
  10560.                                         && class9_1.id != 13921
  10561.                                         && class9_1.id != 13922
  10562.                                         && class9_1.id != 12171
  10563.                                         && class9_1.id != 12172)
  10564.                                     s = s.substring(0, k7)
  10565.                                             + methodR(extractInterfaceValues(
  10566.                                                     class9_1, 0))
  10567.                                             + s.substring(k7 + 2);
  10568.                                 else
  10569.                                     s = s.substring(0, k7)
  10570.                                             + interfaceIntToString(extractInterfaceValues(
  10571.                                                     class9_1, 0))
  10572.                                             + s.substring(k7 + 2);
  10573.                             } while (true);
  10574.                             do {
  10575.                                 int l7 = s.indexOf("%2");
  10576.                                 if (l7 == -1)
  10577.                                     break;
  10578.                                 s = s.substring(0, l7)
  10579.                                         + interfaceIntToString(extractInterfaceValues(
  10580.                                                 class9_1, 1))
  10581.                                         + s.substring(l7 + 2);
  10582.                             } while (true);
  10583.                             do {
  10584.                                 int i8 = s.indexOf("%3");
  10585.                                 if (i8 == -1)
  10586.                                     break;
  10587.                                 s = s.substring(0, i8)
  10588.                                         + interfaceIntToString(extractInterfaceValues(
  10589.                                                 class9_1, 2))
  10590.                                         + s.substring(i8 + 2);
  10591.                             } while (true);
  10592.                             do {
  10593.                                 int j8 = s.indexOf("%4");
  10594.                                 if (j8 == -1)
  10595.                                     break;
  10596.                                 s = s.substring(0, j8)
  10597.                                         + interfaceIntToString(extractInterfaceValues(
  10598.                                                 class9_1, 3))
  10599.                                         + s.substring(j8 + 2);
  10600.                             } while (true);
  10601.                             do {
  10602.                                 int k8 = s.indexOf("%5");
  10603.                                 if (k8 == -1)
  10604.                                     break;
  10605.                                 s = s.substring(0, k8)
  10606.                                         + interfaceIntToString(extractInterfaceValues(
  10607.                                                 class9_1, 4))
  10608.                                         + s.substring(k8 + 2);
  10609.                             } while (true);
  10610.                         }
  10611.                         int l8 = s.indexOf("\\n");
  10612.                         String s1;
  10613.                         if (l8 != -1) {
  10614.                             s1 = s.substring(0, l8);
  10615.                             s = s.substring(l8 + 2);
  10616.                         } else {
  10617.                             s1 = s;
  10618.                             s = "";
  10619.                         }
  10620.                         RSFont font = null;
  10621.                         if (textDrawingArea == smallText) {
  10622.                             font = newSmallFont;
  10623.                         } else if (textDrawingArea == aTextDrawingArea_1271) {
  10624.                             font = newRegularFont;
  10625.                         } else if (textDrawingArea == chatTextDrawingArea) {
  10626.                             font = newBoldFont;
  10627.                         } else if (textDrawingArea == aTextDrawingArea_1273) {
  10628.                             font = newFancyFont;
  10629.                         }
  10630.                         if (class9_1.centerText) {
  10631.                             font.drawCenteredString(s1,
  10632.                                     k2 + class9_1.width / 2, l6, i4,
  10633.                                     class9_1.textShadow ? 0 : -1);
  10634.                         } else {
  10635.                             font.drawBasicString(s1, k2, l6, i4,
  10636.                                     class9_1.textShadow ? 0 : -1);
  10637.                         }
  10638.                     }
  10639.                 } else if (class9_1.type == 5) {
  10640.                     Sprite image;
  10641.                     Sprite hover;
  10642.                     if (interfaceIsSelected(class9_1)) {
  10643.                         image = class9_1.sprite2;
  10644.                         hover = class9_1.enabledHover;
  10645.                     } else {
  10646.                         image = class9_1.sprite1;
  10647.                         hover = class9_1.disabledHover;
  10648.                     }
  10649.                    
  10650.                     /*if (class9_1.id >= 58032 && class9_1.id <= 58040) {
  10651.                         int tabId = 0;
  10652.                         try {
  10653.                             tabId = Integer.parseInt(RSInterface.interfaceCache[5292].message);
  10654.                         } catch (NumberFormatException nfe) {
  10655.                         }
  10656.                         if (RSInterface.interfaceCache[class9_1.id + 1] != null
  10657.                                 && !RSInterface.interfaceCache[class9_1.id + 1].invisible
  10658.                                 || class9_1.id == 58039
  10659.                                 && interfaceContainsItem(58048))
  10660.                             image = new Sprite("BankTab/TAB 3");
  10661.                         if (tabId > 0) {
  10662.                             if (tabId + 58031 == class9_1.id) {
  10663.                                 image = new Sprite("BankTab/TAB 2");
  10664.                             }
  10665.                         }
  10666.                     }*/
  10667.                    
  10668.                     if (image != null) {
  10669.                         if (spellSelected == 1 && class9_1.id == spellID
  10670.                                 && spellID != 0) {
  10671.                             image.drawSprite(k2, l2, 0xffffff);
  10672.                         } else {
  10673.                             image.drawSprite(k2, l2);
  10674.                         }
  10675.                         if (hover != null) {
  10676.                             if (hoverId == class9_1.id) {
  10677.                                 hover.drawSprite(k2, l2);
  10678.                             }
  10679.                         }
  10680.                     }
  10681.                 } else if (class9_1.type == 6) {
  10682.                     int k3 = Texture.textureInt1;
  10683.                     int j4 = Texture.textureInt2;
  10684.                     Texture.textureInt1 = k2 + class9_1.width / 2;
  10685.                     Texture.textureInt2 = l2 + class9_1.height / 2;
  10686.                     int i5 = Texture.anIntArray1470[class9_1.modelRotation1]
  10687.                             * class9_1.modelZoom >> 16;
  10688.                     int l5 = Texture.anIntArray1471[class9_1.modelRotation1]
  10689.                             * class9_1.modelZoom >> 16;
  10690.                     boolean flag2 = interfaceIsSelected(class9_1);
  10691.                     int i7;
  10692.                     if (flag2)
  10693.                         i7 = class9_1.anInt258;
  10694.                     else
  10695.                         i7 = class9_1.anInt257;
  10696.                     Model model;
  10697.                     if (i7 == -1) {
  10698.                         model = class9_1.method209(-1, -1, flag2);
  10699.                     } else {
  10700.                         Animation animation = Animation.anims[i7];
  10701.                         model = class9_1.method209(
  10702.                                 animation.anIntArray354[class9_1.anInt246],
  10703.                                 animation.anIntArray353[class9_1.anInt246],
  10704.                                 flag2);
  10705.                     }
  10706.                     if (model != null)
  10707.                         model.method482(class9_1.modelRotation2, 0,
  10708.                                 class9_1.modelRotation1, 0, i5, l5);
  10709.                     Texture.textureInt1 = k3;
  10710.                     Texture.textureInt2 = j4;
  10711.                 } else if (class9_1.type == 7) {
  10712.                     TextDrawingArea textDrawingArea_1 = class9_1.textDrawingAreas;
  10713.                     int k4 = 0;
  10714.                     for (int j5 = 0; j5 < class9_1.height; j5++) {
  10715.                         for (int i6 = 0; i6 < class9_1.width; i6++) {
  10716.                             if (class9_1.inv[k4] > 0) {
  10717.                                 ItemDef itemDef = ItemDef
  10718.                                         .forID(class9_1.inv[k4] - 1);
  10719.                                 String s2 = itemDef.name;
  10720.                                 if (itemDef.stackable
  10721.                                         || class9_1.invStackSizes[k4] != 1)
  10722.                                     s2 = s2
  10723.                                             + " x"
  10724.                                             + intToKOrMilLongName(class9_1.invStackSizes[k4]);
  10725.                                 int i9 = k2 + i6
  10726.                                         * (115 + class9_1.invSpritePadX);
  10727.                                 int k9 = l2 + j5
  10728.                                         * (12 + class9_1.invSpritePadY);
  10729.                                 if (class9_1.centerText)
  10730.                                     textDrawingArea_1.method382(
  10731.                                             class9_1.textColor, i9
  10732.                                                     + class9_1.width / 2, s2,
  10733.                                             k9, class9_1.textShadow);
  10734.                                 else
  10735.                                     textDrawingArea_1.method389(
  10736.                                             class9_1.textShadow, i9,
  10737.                                             class9_1.textColor, s2, k9);
  10738.                             }
  10739.                             k4++;
  10740.                         }
  10741.                     }
  10742.                 }
  10743.             if (class9_1.type == 8
  10744.                     && (anInt1500 == class9_1.id || anInt1044 == class9_1.id || anInt1129 == class9_1.id)
  10745.                     && anInt1501 == 100) {
  10746.  
  10747.                 int boxWidth = 0;
  10748.                 int boxHeight = 0;
  10749.                 TextDrawingArea textDrawingArea_2 = class9_1.textDrawingAreas;
  10750.                 for (String s1 = class9_1.message; s1.length() > 0;) {
  10751.                     int l7 = s1.indexOf("\\n");
  10752.                     String s4;
  10753.                     if (l7 != -1) {
  10754.                         s4 = s1.substring(0, l7);
  10755.                         s1 = s1.substring(l7 + 2);
  10756.                     } else {
  10757.                         s4 = s1;
  10758.                         s1 = "";
  10759.                     }
  10760.                     int j10 = textDrawingArea_2.getTextWidth(s4);
  10761.                     if (j10 > boxWidth) {
  10762.                         boxWidth = j10;
  10763.                     }
  10764.                     boxHeight += textDrawingArea_2.anInt1497 + 1;
  10765.                 }
  10766.                 boxWidth += 6;
  10767.                 boxHeight += 7;
  10768.                 int xPos = (k2 + class9_1.width) - 5 - boxWidth;
  10769.                 int yPos = l2 + class9_1.height + 5;
  10770.                 if (xPos < k2 + 5) {
  10771.                     xPos = k2 + 5;
  10772.                 }
  10773.                 if (xPos + boxWidth > k + class9.width) {
  10774.                     xPos = (k + class9.width) - boxWidth;
  10775.                 }
  10776.                 if (yPos + boxHeight > l + class9.height) {
  10777.                     yPos = (l + class9.height) - boxHeight;
  10778.                 }
  10779.                
  10780.                 /*if(class9_1.inventoryhover){
  10781.                     if(xPos + boxWidth+k > 249){
  10782.                     xPos = 251 - boxWidth-k; }
  10783.                     if(yPos+boxHeight+l >261 ) {
  10784.                     yPos = 245 - boxHeight - l;
  10785.                     } }*/
  10786.                  
  10787.                 switch (class9_1.id) {
  10788.                 case 9217:
  10789.                 case 9220:
  10790.                 case 9223:
  10791.                 case 9226:
  10792.                 case 9229:
  10793.                 case 9232:
  10794.                 case 9235:
  10795.                 case 9238:
  10796.                     xPos -= 80;
  10797.                     break;
  10798.                 case 9239:
  10799.                     yPos -= 100;
  10800.                     break;
  10801.                 }
  10802.                 DrawingArea
  10803.                         .method336(boxHeight, yPos, xPos, 0xFFFFA0, boxWidth);
  10804.                 DrawingArea.fillPixels(xPos, boxWidth, boxHeight, 0, yPos);
  10805.                 String s2 = class9_1.message;
  10806.                 for (int j11 = yPos + textDrawingArea_2.anInt1497 + 2; s2
  10807.                         .length() > 0; j11 += textDrawingArea_2.anInt1497 + 1) {// anInt1497
  10808.                     int l11 = s2.indexOf("\\n");
  10809.                     String s5;
  10810.                     if (l11 != -1) {
  10811.                         s5 = s2.substring(0, l11);
  10812.                         s2 = s2.substring(l11 + 2);
  10813.                     } else {
  10814.                         s5 = s2;
  10815.                         s2 = "";
  10816.                     }
  10817.                     textDrawingArea_2.method389(false, xPos + 3, 0, s5, j11);
  10818.                 }
  10819.                 // }
  10820.                 DrawingArea.setDrawingArea(l1, i1, k1, j1);
  10821.             }
  10822.             if (class9_1.type == 8 && (anInt1500 == class9_1.id || anInt1044 == class9_1.id || anInt1129 == class9_1.id) && anInt1501 == 50 && !menuOpen) {
  10823.                 int boxWidth = 0;
  10824.                 int boxHeight = 0;
  10825.                 TextDrawingArea textDrawingArea_2 = aTextDrawingArea_1271;
  10826.                 for (String s1 = class9_1.message; s1.length() > 0;) {
  10827.                     if (s1.indexOf("%") != -1) {
  10828.                         do {
  10829.                             int k7 = s1.indexOf("%1");
  10830.                             if (k7 == -1)
  10831.                                 break;
  10832.                             s1 = s1.substring(0, k7)
  10833.                                     + interfaceIntToString(extractInterfaceValues(
  10834.                                             class9_1, 0))
  10835.                                     + s1.substring(k7 + 2);
  10836.                         } while (true);
  10837.                             do {
  10838.                             int l7 = s1.indexOf("%2");
  10839.                             if (l7 == -1)
  10840.                                 break;
  10841.                             s1 = s1.substring(0, l7)
  10842.                                     + interfaceIntToString(extractInterfaceValues(
  10843.                                             class9_1, 1))
  10844.                                     + s1.substring(l7 + 2);
  10845.                         } while (true);
  10846.                             do {
  10847.                             int i8 = s1.indexOf("%3");
  10848.                             if (i8 == -1)
  10849.                                 break;
  10850.                             s1 = s1.substring(0, i8)
  10851.                                     + interfaceIntToString(extractInterfaceValues(
  10852.                                             class9_1, 2))
  10853.                                     + s1.substring(i8 + 2);
  10854.                         } while (true);
  10855.                             do {
  10856.                             int j8 = s1.indexOf("%4");
  10857.                             if (j8 == -1)
  10858.                                 break;
  10859.                             s1 = s1.substring(0, j8)
  10860.                                     + interfaceIntToString(extractInterfaceValues(
  10861.                                             class9_1, 3))
  10862.                                     + s1.substring(j8 + 2);
  10863.                         } while (true);
  10864.                             do {
  10865.                             int k8 = s1.indexOf("%5");
  10866.                             if (k8 == -1)
  10867.                                 break;
  10868.                             s1 = s1.substring(0, k8)
  10869.                                     + interfaceIntToString(extractInterfaceValues(
  10870.                                             class9_1, 4))
  10871.                                     + s1.substring(k8 + 2);
  10872.                         } while (true);
  10873.                     }
  10874.                     int l7 = s1.indexOf("\\n");
  10875.                     String s4;
  10876.                     if (l7 != -1) {
  10877.                         s4 = s1.substring(0, l7);
  10878.                         s1 = s1.substring(l7 + 2);
  10879.                     } else {
  10880.                         s4 = s1;
  10881.                         s1 = "";
  10882.                     }
  10883.                     int j10 = textDrawingArea_2.getTextWidth(s4);
  10884.                     if (j10 > boxWidth) {
  10885.                         boxWidth = j10;
  10886.                     }
  10887.                     boxHeight += textDrawingArea_2.anInt1497 + 1;
  10888.                 }
  10889.                 boxWidth += 6;
  10890.                 boxHeight += 7;
  10891.                 int xPos = (k2 + class9_1.width) - 5 - boxWidth;
  10892.                 int yPos = l2 + class9_1.height + 5;
  10893.                 if (xPos < k2 + 5)
  10894.                     xPos = k2 + 5;
  10895.                 if (xPos + boxWidth > k + class9.width)
  10896.                     xPos = (k + class9.width) - boxWidth;
  10897.                 if (yPos + boxHeight > l + class9.height)
  10898.                     yPos = (l2 - boxHeight);
  10899.                 DrawingArea.drawPixels(boxHeight, yPos, xPos, 0xFFFFA0,
  10900.                         boxWidth);
  10901.                 DrawingArea.fillPixels(xPos, boxWidth, boxHeight, 0, yPos);
  10902.                 String s2 = class9_1.message;
  10903.                 for (int j11 = yPos + textDrawingArea_2.anInt1497 + 2; s2
  10904.                         .length() > 0; j11 += textDrawingArea_2.anInt1497 + 1) {// anInt1497
  10905.                     if (s2.indexOf("%") != -1) {
  10906.                         do {
  10907.                             int k7 = s2.indexOf("%1");
  10908.                             if (k7 == -1)
  10909.                                 break;
  10910.                             s2 = s2.substring(0, k7)
  10911.                                     + interfaceIntToString(extractInterfaceValues(
  10912.                                             class9_1, 0))
  10913.                                     + s2.substring(k7 + 2);
  10914.                         } while (true);
  10915.                         do {
  10916.                             int l7 = s2.indexOf("%2");
  10917.                             if (l7 == -1)
  10918.                                 break;
  10919.                             s2 = s2.substring(0, l7)
  10920.                                     + interfaceIntToString(extractInterfaceValues(
  10921.                                             class9_1, 1))
  10922.                                     + s2.substring(l7 + 2);
  10923.                         } while (true);
  10924.                         do {
  10925.                             int i8 = s2.indexOf("%3");
  10926.                             if (i8 == -1)
  10927.                                 break;
  10928.                             s2 = s2.substring(0, i8)
  10929.                                     + interfaceIntToString(extractInterfaceValues(
  10930.                                             class9_1, 2))
  10931.                                     + s2.substring(i8 + 2);
  10932.                         } while (true);
  10933.                         do {
  10934.                             int j8 = s2.indexOf("%4");
  10935.                             if (j8 == -1)
  10936.                                 break;
  10937.                             s2 = s2.substring(0, j8)
  10938.                                     + interfaceIntToString(extractInterfaceValues(
  10939.                                             class9_1, 3))
  10940.                                     + s2.substring(j8 + 2);
  10941.                         } while (true);
  10942.                         do {
  10943.                             int k8 = s2.indexOf("%5");
  10944.                             if (k8 == -1)
  10945.                                 break;
  10946.                             s2 = s2.substring(0, k8)
  10947.                                     + interfaceIntToString(extractInterfaceValues(
  10948.                                             class9_1, 4))
  10949.                                     + s2.substring(k8 + 2);
  10950.                         } while (true);
  10951.                     }
  10952.                     int l11 = s2.indexOf("\\n");
  10953.                     String s5;
  10954.                     if (l11 != -1) {
  10955.                         s5 = s2.substring(0, l11);
  10956.                         s2 = s2.substring(l11 + 2);
  10957.                     } else {
  10958.                         s5 = s2;
  10959.                         s2 = "";
  10960.                     }
  10961.                     if (class9_1.centerText) {
  10962.                         textDrawingArea_2.method382(yPos, xPos
  10963.                                 + class9_1.width / 2, s5, j11, false);
  10964.                     } else {
  10965.                         if (s5.contains("\\r")) {
  10966.                             String text = s5
  10967.                                     .substring(0, s5.indexOf("\\r"));
  10968.                             String text2 = s5
  10969.                                     .substring(s5.indexOf("\\r") + 2);
  10970.                             textDrawingArea_2.method389(false, xPos + 3, 0,
  10971.                                     text, j11);
  10972.                             int rightX = boxWidth + xPos
  10973.                                     - textDrawingArea_2.getTextWidth(text2)
  10974.                                     - 2;
  10975.                             textDrawingArea_2.method389(false, rightX, 0,
  10976.                                     text2, j11);
  10977.                             System.out.println("Box: " + boxWidth + "");
  10978.                         } else
  10979.                             textDrawingArea_2.method389(false, xPos + 3, 0,
  10980.                                     s5, j11);
  10981.                     }
  10982.                 }
  10983.             }
  10984.             if (class9_1.type == 12) {
  10985.                 Sprite sprite;
  10986.                 if (interfaceIsSelected(class9_1))
  10987.                     sprite = class9_1.sprite2;
  10988.                 else
  10989.                     sprite = class9_1.sprite1;
  10990.                 if (sprite != null)
  10991.                     sprite.drawAdvancedSprite(k2, l2);
  10992.             } else if (class9_1.type == 9) {
  10993.                 drawHoverBox(k2, l2, class9_1.message);
  10994.             }
  10995.         }
  10996.         DrawingArea.setDrawingArea(l1, i1, k1, j1);
  10997.     }
  10998.  
  10999.     public final String methodR(int j) {
  11000.         if (j >= 0 && j < 10000)
  11001.             return String.valueOf(j);
  11002.         if (j >= 10000 && j < 10000000)
  11003.             return j / 1000 + "K";
  11004.         if (j >= 10000000 && j < 999999999)
  11005.             return j / 1000000 + "M";
  11006.         if (j >= 999999999)
  11007.             return "*";
  11008.         else
  11009.             return "?";
  11010.     }
  11011.  
  11012.     public void drawHoverBox(int xPos, int yPos, String text) {
  11013.         String[] results = text.split("\n");
  11014.         int height = (results.length * 16) + 3;
  11015.         int width;
  11016.         width = aTextDrawingArea_1271.getTextWidth(results[0]) + 6;
  11017.         for (int i = 1; i < results.length; i++)
  11018.             if (width <= aTextDrawingArea_1271.getTextWidth(results[i]) + 6)
  11019.                 width = aTextDrawingArea_1271.getTextWidth(results[i]) + 6;
  11020.         DrawingArea.drawPixels(height, yPos, xPos, 0xFFFFA0, width);
  11021.         DrawingArea.fillPixels(xPos, width, height, 0, yPos);
  11022.         yPos += 14;
  11023.         for (int i = 0; i < results.length; i++) {
  11024.             aTextDrawingArea_1271.method389(false, xPos + 3, 0, results[i],
  11025.                     yPos);
  11026.             yPos += 16;
  11027.         }
  11028.     }
  11029.  
  11030.     public void drawBlackBox(int xPos, int yPos) {
  11031.         DrawingArea.drawPixels(71, yPos - 1, xPos - 2, 0x726451, 1);
  11032.         DrawingArea.drawPixels(69, yPos, xPos + 174, 0x726451, 1);
  11033.         DrawingArea.drawPixels(1, yPos - 2, xPos - 2, 0x726451, 178);
  11034.         DrawingArea.drawPixels(1, yPos + 68, xPos, 0x726451, 174);
  11035.         DrawingArea.drawPixels(71, yPos - 1, xPos - 1, 0x2E2B23, 1);
  11036.         DrawingArea.drawPixels(71, yPos - 1, xPos + 175, 0x2E2B23, 1);
  11037.         DrawingArea.drawPixels(1, yPos - 1, xPos, 0x2E2B23, 175);
  11038.         DrawingArea.drawPixels(1, yPos + 69, xPos, 0x2E2B23, 175);
  11039.         DrawingArea.method335(0, yPos, 174, 68, 220, xPos);
  11040.     }
  11041.  
  11042.     public void randomizeBackground(Background background) {
  11043.         int j = 256;
  11044.         for (int k = 0; k < anIntArray1190.length; k++)
  11045.             anIntArray1190[k] = 0;
  11046.  
  11047.         for (int l = 0; l < 5000; l++) {
  11048.             int i1 = (int) (Math.random() * 128D * j);
  11049.             anIntArray1190[i1] = (int) (Math.random() * 256D);
  11050.         }
  11051.         for (int j1 = 0; j1 < 20; j1++) {
  11052.             for (int k1 = 1; k1 < j - 1; k1++) {
  11053.                 for (int i2 = 1; i2 < 127; i2++) {
  11054.                     int k2 = i2 + (k1 << 7);
  11055.                     anIntArray1191[k2] = (anIntArray1190[k2 - 1]
  11056.                             + anIntArray1190[k2 + 1] + anIntArray1190[k2 - 128] + anIntArray1190[k2 + 128]) / 4;
  11057.                 }
  11058.  
  11059.             }
  11060.             int ai[] = anIntArray1190;
  11061.             anIntArray1190 = anIntArray1191;
  11062.             anIntArray1191 = ai;
  11063.         }
  11064.         if (background != null) {
  11065.             int l1 = 0;
  11066.             for (int j2 = 0; j2 < background.anInt1453; j2++) {
  11067.                 for (int l2 = 0; l2 < background.anInt1452; l2++)
  11068.                     if (background.aByteArray1450[l1++] != 0) {
  11069.                         int i3 = l2 + 16 + background.anInt1454;
  11070.                         int j3 = j2 + 16 + background.anInt1455;
  11071.                         int k3 = i3 + (j3 << 7);
  11072.                         anIntArray1190[k3] = 0;
  11073.                     }
  11074.             }
  11075.         }
  11076.     }
  11077.  
  11078.     private void method107(int i, int j, Stream stream, Player player) {
  11079.         if ((i & 0x400) != 0) {
  11080.             player.anInt1543 = stream.method428();
  11081.             player.anInt1545 = stream.method428();
  11082.             player.anInt1544 = stream.method428();
  11083.             player.anInt1546 = stream.method428();
  11084.             player.anInt1547 = stream.method436() + loopCycle;
  11085.             player.anInt1548 = stream.method435() + loopCycle;
  11086.             player.anInt1549 = stream.method428();
  11087.             player.method446();
  11088.         }
  11089.         if ((i & 0x100) != 0) {
  11090.             player.anInt1520 = stream.method434();
  11091.             int k = stream.readDWord();
  11092.             player.anInt1524 = k >> 16;
  11093.             player.anInt1523 = loopCycle + (k & 0xffff);
  11094.             player.anInt1521 = 0;
  11095.             player.anInt1522 = 0;
  11096.             if (player.anInt1523 > loopCycle)
  11097.                 player.anInt1521 = -1;
  11098.             if (player.anInt1520 == 65535)
  11099.                 player.anInt1520 = -1;
  11100.         }
  11101.         if ((i & 8) != 0) {
  11102.             int l = stream.method434();
  11103.             if (l == 65535)
  11104.                 l = -1;
  11105.             int i2 = stream.method427();
  11106.             if (l == player.anim && l != -1) {
  11107.                 int i3 = Animation.anims[l].anInt365;
  11108.                 if (i3 == 1) {
  11109.                     player.anInt1527 = 0;
  11110.                     player.anInt1528 = 0;
  11111.                     player.anInt1529 = i2;
  11112.                     player.anInt1530 = 0;
  11113.                 }
  11114.                 if (i3 == 2)
  11115.                     player.anInt1530 = 0;
  11116.             } else if (l == -1
  11117.                     || player.anim == -1
  11118.                     || Animation.anims[l].anInt359 >= Animation.anims[player.anim].anInt359) {
  11119.                 player.anim = l;
  11120.                 player.anInt1527 = 0;
  11121.                 player.anInt1528 = 0;
  11122.                 player.anInt1529 = i2;
  11123.                 player.anInt1530 = 0;
  11124.                 player.anInt1542 = player.smallXYIndex;
  11125.             }
  11126.         }
  11127.         if ((i & 4) != 0) {
  11128.             player.textSpoken = stream.readString();
  11129.             if (player.textSpoken.charAt(0) == '~') {
  11130.                 player.textSpoken = player.textSpoken.substring(1);
  11131.                 pushMessage(player.textSpoken, 2, player.name);
  11132.             } else if (player == myPlayer)
  11133.                 pushMessage(player.textSpoken, 2, player.name);
  11134.             player.anInt1513 = 0;
  11135.             player.anInt1531 = 0;
  11136.             player.textCycle = 150;
  11137.         }
  11138.         if ((i & 0x80) != 0) {
  11139.             int i1 = stream.method434();
  11140.             int j2 = stream.readUnsignedByte();
  11141.             int j3 = stream.method427();
  11142.             int k3 = stream.currentOffset;
  11143.             if (player.name != null && player.visible) {
  11144.                 long l3 = TextClass.longForName(player.name);
  11145.                 boolean flag = false;
  11146.                 if (j2 <= 1) {
  11147.                     for (int i4 = 0; i4 < ignoreCount; i4++) {
  11148.                         if (ignoreListAsLongs[i4] != l3)
  11149.                             continue;
  11150.                         flag = true;
  11151.                         break;
  11152.                     }
  11153.  
  11154.                 }
  11155.                 if (!flag && anInt1251 == 0)
  11156.                     try {
  11157.                         aStream_834.currentOffset = 0;
  11158.                         stream.method442(j3, 0, aStream_834.buffer);
  11159.                         aStream_834.currentOffset = 0;
  11160.                         String s = TextInput.method525(j3, aStream_834);
  11161.                         player.textSpoken = s;
  11162.                         player.anInt1513 = i1 >> 8;
  11163.                         player.privelage = j2;
  11164.                         player.anInt1531 = i1 & 0xff;
  11165.                         player.textCycle = 150;
  11166.                         String cr = "";
  11167.                         if (j2 == 29)
  11168.                             cr = "@cr29@";
  11169.                         if (j2 == 28)
  11170.                             cr = "@cr28@";
  11171.                         if (j2 == 27)
  11172.                             cr = "@cr27@";
  11173.                         if (j2 == 26)
  11174.                             cr = "@cr26@";
  11175.                         if (j2 == 25)
  11176.                             cr = "@cr25@";
  11177.                         if (j2 == 24)
  11178.                             cr = "@cr24@";
  11179.                         if (j2 == 23)
  11180.                             cr = "@cr23@";
  11181.                         if (j2 == 22)
  11182.                             cr = "@cr22@";
  11183.                         if (j2 == 21)
  11184.                             cr = "@cr21@";
  11185.                         if (j2 == 20)
  11186.                             cr = "@cr20@";
  11187.                         if (j2 == 19)
  11188.                             cr = "@cr19@";
  11189.                         if (j2 == 18)
  11190.                             cr = "@cr18@";
  11191.                         if (j2 == 17)
  11192.                             cr = "@cr17@";
  11193.                         if (j2 == 16)
  11194.                             cr = "@cr16@";
  11195.                         if (j2 == 15)
  11196.                             cr = "@cr15@";
  11197.                         if (j2 == 14)
  11198.                             cr = "@cr14@";
  11199.                         if (j2 == 13)
  11200.                             cr = "@cr13@";
  11201.                         if (j2 == 12)
  11202.                             cr = "@cr12@";
  11203.                         if (j2 == 11)
  11204.                             cr = "@cr11@";
  11205.                         if (j2 == 10)
  11206.                             cr = "@cr10@";
  11207.                         if (j2 == 9)
  11208.                             cr = "@cr9@";
  11209.                         if (j2 == 8)
  11210.                             cr = "@cr8@";
  11211.                         if (j2 == 7)
  11212.                             cr = "@cr7@";
  11213.                         if (j2 == 6)
  11214.                             cr = "@cr6@";
  11215.                         if (j2 == 5)
  11216.                             cr = "@cr5@";
  11217.                         if (j2 == 4)
  11218.                             cr = "@cr4@";
  11219.                         if (j2 == 3)
  11220.                             cr = "@cr3@";
  11221.                         if (j2 == 2)
  11222.                             cr = "@cr2@";
  11223.                         if (j2 == 1)
  11224.                             cr = "@cr1@";
  11225.                         pushMessage(s, 2,
  11226.                                 cr + "<col=" + titleColor(player.titleColor, 0)
  11227.                                         + ">" + player.title + "</col>"
  11228.                                         + player.name);
  11229.                     } catch (Exception exception) {
  11230.                         signlink.reporterror("cde2");
  11231.                     }
  11232.             }
  11233.             stream.currentOffset = k3 + j3;
  11234.         }
  11235.         if ((i & 1) != 0) {
  11236.             player.interactingEntity = stream.method434();
  11237.             if (player.interactingEntity == 65535)
  11238.                 player.interactingEntity = -1;
  11239.         }
  11240.         if ((i & 0x10) != 0) {
  11241.             int j1 = stream.method427();
  11242.             byte abyte0[] = new byte[j1];
  11243.             Stream stream_1 = new Stream(abyte0);
  11244.             stream.readBytes(j1, 0, abyte0);
  11245.             aStreamArray895s[j] = stream_1;
  11246.             player.updatePlayer(stream_1);
  11247.         }
  11248.         if ((i & 2) != 0) {
  11249.             player.anInt1538 = stream.method436();
  11250.             player.anInt1539 = stream.method434();
  11251.         }
  11252.         if ((i & 0x20) != 0) {
  11253.             int k1 = stream.readUnsignedByte();
  11254.             int k2 = stream.method426();
  11255.             player.updateHitData(k2, k1, loopCycle);
  11256.             player.loopCycleStatus = loopCycle + 300;
  11257.             player.currentHealth = stream.method427();
  11258.             player.maxHealth = stream.readUnsignedByte();
  11259.         }
  11260.         if ((i & 0x200) != 0) {
  11261.             int l1 = stream.readUnsignedByte();
  11262.             int l2 = stream.method428();
  11263.             player.updateHitData(l2, l1, loopCycle);
  11264.             player.loopCycleStatus = loopCycle + 300;
  11265.             player.currentHealth = stream.readUnsignedByte();
  11266.             player.maxHealth = stream.method427();
  11267.         }
  11268.     }
  11269.  
  11270.     public void method108() {
  11271.         try {
  11272.             int j = myPlayer.x + cameraOffsetX;
  11273.             int k = myPlayer.y + cameraOffsetY;
  11274.             if (anInt1014 - j < -500 || anInt1014 - j > 500
  11275.                     || anInt1015 - k < -500 || anInt1015 - k > 500) {
  11276.                 anInt1014 = j;
  11277.                 anInt1015 = k;
  11278.             }
  11279.             if (anInt1014 != j)
  11280.                 anInt1014 += (j - anInt1014) / 16;
  11281.             if (anInt1015 != k)
  11282.                 anInt1015 += (k - anInt1015) / 16;
  11283.             if (super.keyArray[1] == 1)
  11284.                 anInt1186 += (-24 - anInt1186) / 2;
  11285.             else if (super.keyArray[2] == 1)
  11286.                 anInt1186 += (24 - anInt1186) / 2;
  11287.             else
  11288.                 anInt1186 /= 2;
  11289.             if (super.keyArray[3] == 1)
  11290.                 anInt1187 += (12 - anInt1187) / 2;
  11291.             else if (super.keyArray[4] == 1)
  11292.                 anInt1187 += (-12 - anInt1187) / 2;
  11293.             else
  11294.                 anInt1187 /= 2;
  11295.             viewRotation = viewRotation + anInt1186 / 2 & 0x7ff;
  11296.             anInt1184 += anInt1187 / 2;
  11297.             if (anInt1184 < 128)
  11298.                 anInt1184 = 128;
  11299.             if (anInt1184 > 383)
  11300.                 anInt1184 = 383;
  11301.             int l = anInt1014 >> 7;
  11302.             int i1 = anInt1015 >> 7;
  11303.             int j1 = method42(plane, anInt1015, anInt1014);
  11304.             int k1 = 0;
  11305.             if (l > 3 && i1 > 3 && l < 100 && i1 < 100) {
  11306.                 for (int l1 = l - 4; l1 <= l + 4; l1++) {
  11307.                     for (int k2 = i1 - 4; k2 <= i1 + 4; k2++) {
  11308.                         int l2 = plane;
  11309.                         if (l2 < 3 && (byteGroundArray[1][l1][k2] & 2) == 2)
  11310.                             l2++;
  11311.                         int i3 = j1 - intGroundArray[l2][l1][k2];
  11312.                         if (i3 > k1)
  11313.                             k1 = i3;
  11314.                     }
  11315.  
  11316.                 }
  11317.  
  11318.             }
  11319.             anInt1005++;
  11320.             if (anInt1005 > 1512) {
  11321.                 anInt1005 = 0;
  11322.                 stream.createFrame(77);
  11323.                 stream.writeWordBigEndian(0);
  11324.                 int i2 = stream.currentOffset;
  11325.                 stream.writeWordBigEndian((int) (Math.random() * 256D));
  11326.                 stream.writeWordBigEndian(101);
  11327.                 stream.writeWordBigEndian(233);
  11328.                 stream.writeWord(45092);
  11329.                 if ((int) (Math.random() * 2D) == 0)
  11330.                     stream.writeWord(35784);
  11331.                 stream.writeWordBigEndian((int) (Math.random() * 256D));
  11332.                 stream.writeWordBigEndian(64);
  11333.                 stream.writeWordBigEndian(38);
  11334.                 stream.writeWord((int) (Math.random() * 65536D));
  11335.                 stream.writeWord((int) (Math.random() * 65536D));
  11336.                 stream.writeBytes(stream.currentOffset - i2);
  11337.             }
  11338.             int j2 = k1 * 192;
  11339.             if (j2 > 0x17f00)
  11340.                 j2 = 0x17f00;
  11341.             if (j2 < 32768)
  11342.                 j2 = 32768;
  11343.             if (j2 > anInt984) {
  11344.                 anInt984 += (j2 - anInt984) / 24;
  11345.                 return;
  11346.             }
  11347.             if (j2 < anInt984) {
  11348.                 anInt984 += (j2 - anInt984) / 80;
  11349.             }
  11350.         } catch (Exception _ex) {
  11351.             signlink.reporterror("glfc_ex " + myPlayer.x + "," + myPlayer.y
  11352.                     + "," + anInt1014 + "," + anInt1015 + "," + anInt1069 + ","
  11353.                     + anInt1070 + "," + baseX + "," + baseY);
  11354.             throw new RuntimeException("eek");
  11355.         }
  11356.     }
  11357.  
  11358.     @Override
  11359.     public void processDrawing() {
  11360.         if (rsAlreadyLoaded || loadingError || genericLoadingError) {
  11361.             showErrorScreen();
  11362.             return;
  11363.         }
  11364.         anInt1061++;
  11365.         if (!loggedIn)
  11366.             drawLoginScreen(false);
  11367.         else
  11368.             drawGameScreen();
  11369.         anInt1213 = 0;
  11370.     }
  11371.  
  11372.     private boolean isFriendOrSelf(String s) {
  11373.         if (s == null)
  11374.             return false;
  11375.         for (int i = 0; i < friendsCount; i++)
  11376.             if (s.equalsIgnoreCase(friendsList[i]))
  11377.                 return true;
  11378.         return s.equalsIgnoreCase(myPlayer.name);
  11379.     }
  11380.  
  11381.     private static String combatDiffColor(int i, int j) {
  11382.         int k = i - j;
  11383.         if (k < -9)
  11384.             return "@red@";
  11385.         if (k < -6)
  11386.             return "@or3@";
  11387.         if (k < -3)
  11388.             return "@or2@";
  11389.         if (k < 0)
  11390.             return "@or1@";
  11391.         if (k > 9)
  11392.             return "@gre@";
  11393.         if (k > 6)
  11394.             return "@gr3@";
  11395.         if (k > 3)
  11396.             return "@gr2@";
  11397.         if (k > 0)
  11398.             return "@gr1@";
  11399.         else
  11400.             return "@yel@";
  11401.     }
  11402.  
  11403.     public void setWaveVolume(int i) {
  11404.         signlink.wavevol = i;
  11405.     }
  11406.  
  11407.     private void draw3dScreen() {
  11408.         if (counterOn) {
  11409.             drawCounterOnScreen();
  11410.         }
  11411.         if (showChatComponents) {
  11412.             drawSplitPrivateChat();
  11413.         }
  11414.         if (crossType == 1) {
  11415.             crosses[crossIndex / 100].drawSprite(crossX - 8 - 4, crossY - 8 - 4);
  11416.             anInt1142++;
  11417.             if (anInt1142 > 67) {
  11418.                 anInt1142 = 0;
  11419.                 stream.createFrame(78);
  11420.             }
  11421.         }
  11422.         if (crossType == 2) {
  11423.             crosses[4 + crossIndex / 100].drawSprite(crossX - 8 - 4, crossY - 8 - 4);
  11424.         }
  11425.         if (anInt1018 != -1) {
  11426.             method119(anInt945, anInt1018);
  11427.             if (anInt1018 == 197 && frameMode != ScreenMode.FIXED) {
  11428.                 skullIcons[0].drawSprite(frameWidth - 107, 168);
  11429.                 String text = RSInterface.interfaceCache[199].message.replace("@yel@", "");
  11430.                 aTextDrawingArea_1271.method385(0xE1981D, text, 207, frameWidth - 115);
  11431.             } else {
  11432.                 drawInterface(0, frameMode == ScreenMode.FIXED ? 0 : (frameWidth / 2) - 356, RSInterface.interfaceCache[anInt1018], frameMode == ScreenMode.FIXED ? 0 : (frameHeight / 2) - 230);
  11433.             }
  11434.         }
  11435.         if (openInterfaceID != -1) {
  11436.             method119(anInt945, openInterfaceID);
  11437.             drawInterface(0, frameMode == ScreenMode.FIXED ? 0 : (frameWidth / 2) - 356, RSInterface.interfaceCache[openInterfaceID], frameMode == ScreenMode.FIXED ? 0 : (frameHeight / 2) - 230);
  11438.         }
  11439.         if (!menuOpen) {
  11440.             processRightClick();
  11441.             drawTooltip();
  11442.         } else if (menuScreenArea == 0) {
  11443.             drawMenu(frameMode == ScreenMode.FIXED ? 4 : 0, frameMode == ScreenMode.FIXED ? 4 : 0);
  11444.         }
  11445.         if (anInt1055 == 1) {
  11446.             multiOverlay.drawSprite(frameMode == ScreenMode.FIXED ? 472 : frameWidth - 60, frameMode == ScreenMode.FIXED ? 296 : 170);
  11447.         }
  11448.         if(fpsOn) {
  11449.             int textColour = 0xffff00;
  11450.             if(super.fps < 15) {
  11451.                 textColour = 0xff0000;
  11452.             }
  11453.             aTextDrawingArea_1271.method385(textColour, "Fps: " + super.fps, 45, frameMode == ScreenMode.FIXED ? 470 : frameWidth - 265);
  11454.             Runtime runtime = Runtime.getRuntime();
  11455.             int memUsage = (int)((runtime.totalMemory() - runtime.freeMemory()) / 1024L);
  11456.             textColour = 0xffff00;
  11457.             if(memUsage > 0x2000000 && lowMem) {
  11458.                 textColour = 0xff0000;
  11459.             }
  11460.             aTextDrawingArea_1271.method385(textColour, "Mem: " + memUsage + "k", 60, frameMode == ScreenMode.FIXED ? 428 : frameWidth - 265);
  11461.         }
  11462.         int x = baseX + (myPlayer.x - 6 >> 7);
  11463.         int y = baseY + (myPlayer.y - 6 >> 7);
  11464.         final String screenMode = frameMode == ScreenMode.FIXED ? "Fixed" : "Resizable";
  11465.         if (clientData){   
  11466.             int textColour = 0xffff00;
  11467.             int fpsColour = 0xffff00;
  11468.             if(super.fps < 15) {
  11469.                 fpsColour = 0xff0000;
  11470.             }
  11471.             aTextDrawingArea_1271.method385(textColour, "clientWidth: " + (mouseX - frameWidth) + ", clientHeight: " + (mouseY - frameHeight), frameHeight - 271, 5);
  11472.             aTextDrawingArea_1271.method385(textColour, "Client Zoom: " + cameraZoom, frameHeight - 257, 5);
  11473.             aTextDrawingArea_1271.method385(fpsColour, "Fps: " + super.fps, frameHeight - 243, 5);
  11474.             Runtime runtime = Runtime.getRuntime();
  11475.             int clientMemory = (int) ((runtime.totalMemory() - runtime.freeMemory()) / 1024L);
  11476.             aTextDrawingArea_1271.method385(textColour, "Memory Usage: " + clientMemory + "k", frameHeight - 229, 5);
  11477.             aTextDrawingArea_1271.method385(textColour, "Mouse X: " + mouseX + ", Mouse Y: " + mouseY,frameHeight - 215, 5);
  11478.             aTextDrawingArea_1271.method385(textColour, "Coords: " + x + ", " + y, frameHeight - 201, 5);
  11479.             aTextDrawingArea_1271.method385(textColour, "Client Mode: " + screenMode + "", frameHeight - 187, 5);
  11480.             aTextDrawingArea_1271.method385(textColour, "Client Resolution: " + frameWidth + "x" + frameHeight, frameHeight - 173, 5);
  11481.         }
  11482.         if (anInt1104 != 0) {
  11483.             int j = anInt1104 / 50;
  11484.             int l = j / 60;
  11485.             int yOffset = frameMode == ScreenMode.FIXED ? 0 : frameHeight - 498;
  11486.             j %= 60;
  11487.             if (j < 10)
  11488.                 aTextDrawingArea_1271.method385(0xffff00, "System update in: " + l + ":0" + j, 329 + yOffset, 4);
  11489.             else
  11490.                 aTextDrawingArea_1271.method385(0xffff00, "System update in: " + l + ":" + j, 329 + yOffset, 4);
  11491.             anInt849++;
  11492.             if (anInt849 > 75) {
  11493.                 anInt849 = 0;
  11494.                 stream.createFrame(148);
  11495.             }
  11496.         }
  11497.     }
  11498.  
  11499.     public void addIgnore(long l) {
  11500.         try {
  11501.             if (l == 0L)
  11502.                 return;
  11503.             if (ignoreCount >= 100) {
  11504.                 pushMessage("Your ignore list is full. Max of 100 hit", 0, "");
  11505.                 return;
  11506.             }
  11507.             String s = TextClass.fixName(TextClass.nameForLong(l));
  11508.             for (int j = 0; j < ignoreCount; j++)
  11509.                 if (ignoreListAsLongs[j] == l) {
  11510.                     pushMessage(s + " is already on your ignore list", 0, "");
  11511.                     return;
  11512.                 }
  11513.             for (int k = 0; k < friendsCount; k++)
  11514.                 if (friendsListAsLongs[k] == l) {
  11515.                     pushMessage("Please remove " + s
  11516.                             + " from your friend list first", 0, "");
  11517.                     return;
  11518.                 }
  11519.  
  11520.             ignoreListAsLongs[ignoreCount++] = l;
  11521.             needDrawTabArea = true;
  11522.             stream.createFrame(133);
  11523.             stream.writeQWord(l);
  11524.             return;
  11525.         } catch (RuntimeException runtimeexception) {
  11526.             signlink.reporterror("45688, " + l + ", " + 4 + ", "
  11527.                     + runtimeexception.toString());
  11528.         }
  11529.         throw new RuntimeException();
  11530.     }
  11531.  
  11532.     public void method114() {
  11533.         for (int i = -1; i < playerCount; i++) {
  11534.             int j;
  11535.             if (i == -1)
  11536.                 j = myPlayerIndex;
  11537.             else
  11538.                 j = playerIndices[i];
  11539.             Player player = playerArray[j];
  11540.             if (player != null)
  11541.                 method96(player);
  11542.         }
  11543.  
  11544.     }
  11545.  
  11546.     public void method115() {
  11547.         if (loadingStage == 2) {
  11548.             for (Class30_Sub1 class30_sub1 = (Class30_Sub1) aClass19_1179
  11549.                     .reverseGetFirst(); class30_sub1 != null; class30_sub1 = (Class30_Sub1) aClass19_1179
  11550.                     .reverseGetNext()) {
  11551.                 if (class30_sub1.anInt1294 > 0)
  11552.                     class30_sub1.anInt1294--;
  11553.                 if (class30_sub1.anInt1294 == 0) {
  11554.                     if (class30_sub1.anInt1299 < 0
  11555.                             || ObjectManager.method178(class30_sub1.anInt1299,
  11556.                                     class30_sub1.anInt1301)) {
  11557.                         method142(class30_sub1.anInt1298,
  11558.                                 class30_sub1.anInt1295, class30_sub1.anInt1300,
  11559.                                 class30_sub1.anInt1301, class30_sub1.anInt1297,
  11560.                                 class30_sub1.anInt1296, class30_sub1.anInt1299);
  11561.                         class30_sub1.unlink();
  11562.                     }
  11563.                 } else {
  11564.                     if (class30_sub1.anInt1302 > 0)
  11565.                         class30_sub1.anInt1302--;
  11566.                     if (class30_sub1.anInt1302 == 0
  11567.                             && class30_sub1.anInt1297 >= 1
  11568.                             && class30_sub1.anInt1298 >= 1
  11569.                             && class30_sub1.anInt1297 <= 102
  11570.                             && class30_sub1.anInt1298 <= 102
  11571.                             && (class30_sub1.anInt1291 < 0 || ObjectManager
  11572.                                     .method178(class30_sub1.anInt1291,
  11573.                                             class30_sub1.anInt1293))) {
  11574.                         method142(class30_sub1.anInt1298,
  11575.                                 class30_sub1.anInt1295, class30_sub1.anInt1292,
  11576.                                 class30_sub1.anInt1293, class30_sub1.anInt1297,
  11577.                                 class30_sub1.anInt1296, class30_sub1.anInt1291);
  11578.                         class30_sub1.anInt1302 = -1;
  11579.                         if (class30_sub1.anInt1291 == class30_sub1.anInt1299
  11580.                                 && class30_sub1.anInt1299 == -1)
  11581.                             class30_sub1.unlink();
  11582.                         else if (class30_sub1.anInt1291 == class30_sub1.anInt1299
  11583.                                 && class30_sub1.anInt1292 == class30_sub1.anInt1300
  11584.                                 && class30_sub1.anInt1293 == class30_sub1.anInt1301)
  11585.                             class30_sub1.unlink();
  11586.                     }
  11587.                 }
  11588.             }
  11589.  
  11590.         }
  11591.     }
  11592.  
  11593.     private void determineMenuSize() {
  11594.         int boxLength = chatTextDrawingArea.getTextWidth("Choose option");
  11595.         for (int row = 0; row < menuActionRow; row++) {
  11596.             int actionLength = chatTextDrawingArea.getTextWidth(menuActionName[row]);
  11597.             if (actionLength > boxLength)
  11598.                 boxLength = actionLength;
  11599.         }
  11600.         boxLength += 8;
  11601.         int offset = 15 * menuActionRow + 21;
  11602.         if(super.saveClickX > 0 && super.saveClickY > 0 && super.saveClickX < frameWidth && super.saveClickY < frameHeight) {
  11603.             int xClick = super.saveClickX - boxLength / 2;
  11604.             if (xClick + boxLength > frameWidth - 4) {
  11605.                 xClick = frameWidth - 4 - boxLength;
  11606.             }
  11607.             if (xClick < 0) {
  11608.                 xClick = 0;
  11609.             }
  11610.             int yClick = super.saveClickY - 0;
  11611.             if (yClick + offset > frameHeight - 6) {
  11612.                 yClick = frameHeight - 6 - offset;
  11613.             }
  11614.             if (yClick < 0) {
  11615.                 yClick = 0;
  11616.             }
  11617.             menuOpen = true;
  11618.             menuOffsetX = xClick;
  11619.             menuOffsetY = yClick;
  11620.             menuWidth = boxLength;
  11621.             menuHeight = 15 * menuActionRow + 22;
  11622.         }
  11623.     }
  11624.  
  11625.     public void method117(Stream stream) {
  11626.         stream.initBitAccess();
  11627.         int j = stream.readBits(1);
  11628.         if (j == 0)
  11629.             return;
  11630.         int k = stream.readBits(2);
  11631.         if (k == 0) {
  11632.             anIntArray894[anInt893++] = myPlayerIndex;
  11633.             return;
  11634.         }
  11635.         if (k == 1) {
  11636.             int l = stream.readBits(3);
  11637.             myPlayer.moveInDir(false, l);
  11638.             int k1 = stream.readBits(1);
  11639.             if (k1 == 1)
  11640.                 anIntArray894[anInt893++] = myPlayerIndex;
  11641.             return;
  11642.         }
  11643.         if (k == 2) {
  11644.             int i1 = stream.readBits(3);
  11645.             myPlayer.moveInDir(true, i1);
  11646.             int l1 = stream.readBits(3);
  11647.             myPlayer.moveInDir(true, l1);
  11648.             int j2 = stream.readBits(1);
  11649.             if (j2 == 1)
  11650.                 anIntArray894[anInt893++] = myPlayerIndex;
  11651.             return;
  11652.         }
  11653.         if (k == 3) {
  11654.             plane = stream.readBits(2);
  11655.             int j1 = stream.readBits(1);
  11656.             int i2 = stream.readBits(1);
  11657.             if (i2 == 1)
  11658.                 anIntArray894[anInt893++] = myPlayerIndex;
  11659.             int k2 = stream.readBits(7);
  11660.             int l2 = stream.readBits(7);
  11661.             myPlayer.setPos(l2, k2, j1 == 1);
  11662.         }
  11663.     }
  11664.    
  11665.     private boolean interfaceContainsItem(int interfaceId) {
  11666.         RSInterface rsi = RSInterface.interfaceCache[interfaceId];
  11667.         if (rsi == null)
  11668.             return false;
  11669.         if (rsi.inv == null) {
  11670.             return false;
  11671.         }
  11672.         int count = 0;
  11673.         for (int i = 0; i < rsi.inv.length; i++) {
  11674.             if (rsi.inv[i] > 0) {
  11675.                 count++;
  11676.             }
  11677.         }
  11678.         return count > 0;
  11679.     }
  11680.  
  11681.     public void nullLoader() {
  11682.         aBoolean831 = false;
  11683.         while (drawingFlames) {
  11684.             aBoolean831 = false;
  11685.             try {
  11686.                 Thread.sleep(50L);
  11687.             } catch (Exception _ex) {
  11688.             }
  11689.         }
  11690.         aBackground_966 = null;
  11691.         aBackground_967 = null;
  11692.         aBackgroundArray1152s = null;
  11693.         anIntArray850 = null;
  11694.         anIntArray851 = null;
  11695.         anIntArray852 = null;
  11696.         anIntArray853 = null;
  11697.         anIntArray1190 = null;
  11698.         anIntArray1191 = null;
  11699.         anIntArray828 = null;
  11700.         anIntArray829 = null;
  11701.         aClass30_Sub2_Sub1_Sub1_1201 = null;
  11702.         aClass30_Sub2_Sub1_Sub1_1202 = null;
  11703.     }
  11704.  
  11705.     private boolean method119(int i, int j) {
  11706.         boolean flag1 = false;
  11707.         RSInterface class9 = RSInterface.interfaceCache[j];
  11708.         for (int k = 0; k < class9.children.length; k++) {
  11709.             if (class9.children[k] == -1)
  11710.                 break;
  11711.             RSInterface class9_1 = RSInterface.interfaceCache[class9.children[k]];
  11712.             if (class9_1.type == 1)
  11713.                 flag1 |= method119(i, class9_1.id);
  11714.             if (class9_1.type == 6
  11715.                     && (class9_1.anInt257 != -1 || class9_1.anInt258 != -1)) {
  11716.                 boolean flag2 = interfaceIsSelected(class9_1);
  11717.                 int l;
  11718.                 if (flag2)
  11719.                     l = class9_1.anInt258;
  11720.                 else
  11721.                     l = class9_1.anInt257;
  11722.                 if (l != -1) {
  11723.                     Animation animation = Animation.anims[l];
  11724.                     for (class9_1.anInt208 += i; class9_1.anInt208 > animation
  11725.                             .method258(class9_1.anInt246);) {
  11726.                         class9_1.anInt208 -= animation
  11727.                                 .method258(class9_1.anInt246) + 1;
  11728.                         class9_1.anInt246++;
  11729.                         if (class9_1.anInt246 >= animation.anInt352) {
  11730.                             class9_1.anInt246 -= animation.anInt356;
  11731.                             if (class9_1.anInt246 < 0
  11732.                                     || class9_1.anInt246 >= animation.anInt352)
  11733.                                 class9_1.anInt246 = 0;
  11734.                         }
  11735.                         flag1 = true;
  11736.                     }
  11737.  
  11738.                 }
  11739.             }
  11740.         }
  11741.  
  11742.         return flag1;
  11743.     }
  11744.  
  11745.     private int method120() {
  11746.         int j = 3;
  11747.         if (yCameraCurve < 310) {
  11748.             int k = xCameraPos >> 7;
  11749.             int l = yCameraPos >> 7;
  11750.             int i1 = myPlayer.x >> 7;
  11751.             int j1 = myPlayer.y >> 7;
  11752.             if ((byteGroundArray[plane][k][l] & 4) != 0)
  11753.                 j = plane;
  11754.             int k1;
  11755.             if (i1 > k)
  11756.                 k1 = i1 - k;
  11757.             else
  11758.                 k1 = k - i1;
  11759.             int l1;
  11760.             if (j1 > l)
  11761.                 l1 = j1 - l;
  11762.             else
  11763.                 l1 = l - j1;
  11764.             if (k1 > l1) {
  11765.                 int i2 = (l1 * 0x10000) / k1;
  11766.                 int k2 = 32768;
  11767.                 while (k != i1) {
  11768.                     if (k < i1)
  11769.                         k++;
  11770.                     else if (k > i1)
  11771.                         k--;
  11772.                     if ((byteGroundArray[plane][k][l] & 4) != 0)
  11773.                         j = plane;
  11774.                     k2 += i2;
  11775.                     if (k2 >= 0x10000) {
  11776.                         k2 -= 0x10000;
  11777.                         if (l < j1)
  11778.                             l++;
  11779.                         else if (l > j1)
  11780.                             l--;
  11781.                         if ((byteGroundArray[plane][k][l] & 4) != 0)
  11782.                             j = plane;
  11783.                     }
  11784.                 }
  11785.             } else {
  11786.                 int j2 = (k1 * 0x10000) / l1;
  11787.                 int l2 = 32768;
  11788.                 while (l != j1) {
  11789.                     if (l < j1)
  11790.                         l++;
  11791.                     else if (l > j1)
  11792.                         l--;
  11793.                     if ((byteGroundArray[plane][k][l] & 4) != 0)
  11794.                         j = plane;
  11795.                     l2 += j2;
  11796.                     if (l2 >= 0x10000) {
  11797.                         l2 -= 0x10000;
  11798.                         if (k < i1)
  11799.                             k++;
  11800.                         else if (k > i1)
  11801.                             k--;
  11802.                         if ((byteGroundArray[plane][k][l] & 4) != 0)
  11803.                             j = plane;
  11804.                     }
  11805.                 }
  11806.             }
  11807.         }
  11808.         if ((byteGroundArray[plane][myPlayer.x >> 7][myPlayer.y >> 7] & 4) != 0)
  11809.             j = plane;
  11810.         return j;
  11811.     }
  11812.  
  11813.     private int method121() {
  11814.         int j = method42(plane, yCameraPos, xCameraPos);
  11815.         if (j - zCameraPos < 800
  11816.                 && (byteGroundArray[plane][xCameraPos >> 7][yCameraPos >> 7] & 4) != 0)
  11817.             return plane;
  11818.         else
  11819.             return 3;
  11820.     }
  11821.  
  11822.     public void delIgnore(long l) {
  11823.         try {
  11824.             if (l == 0L)
  11825.                 return;
  11826.             for (int j = 0; j < ignoreCount; j++)
  11827.                 if (ignoreListAsLongs[j] == l) {
  11828.                     ignoreCount--;
  11829.                     needDrawTabArea = true;
  11830.                     System.arraycopy(ignoreListAsLongs, j + 1,
  11831.                             ignoreListAsLongs, j, ignoreCount - j);
  11832.  
  11833.                     stream.createFrame(74);
  11834.                     stream.writeQWord(l);
  11835.                     return;
  11836.                 }
  11837.  
  11838.             return;
  11839.         } catch (RuntimeException runtimeexception) {
  11840.             signlink.reporterror("47229, " + 3 + ", " + l + ", "
  11841.                     + runtimeexception.toString());
  11842.         }
  11843.         throw new RuntimeException();
  11844.     }
  11845.  
  11846.     @SuppressWarnings("unused")
  11847.     private void chatJoin(long l) {
  11848.         try {
  11849.             if (l == 0L)
  11850.                 return;
  11851.             stream.createFrame(60);
  11852.             stream.writeQWord(l);
  11853.             return;
  11854.         } catch (RuntimeException runtimeexception) {
  11855.             signlink.reporterror("47229, " + 3 + ", " + l + ", "
  11856.                     + runtimeexception.toString());
  11857.         }
  11858.         throw new RuntimeException();
  11859.  
  11860.     }
  11861.  
  11862.     @Override
  11863.     public String getParameter(String s) {
  11864.         if (signlink.mainapp != null)
  11865.             return signlink.mainapp.getParameter(s);
  11866.         else
  11867.             return super.getParameter(s);
  11868.     }
  11869.  
  11870.     public void adjustVolume(boolean flag, int i) {
  11871.         signlink.midivol = i;
  11872.         if (flag)
  11873.             signlink.midi = "voladjust";
  11874.     }
  11875.  
  11876.     private int extractInterfaceValues(RSInterface class9, int j) {
  11877.         if (class9.valueIndexArray == null
  11878.                 || j >= class9.valueIndexArray.length)
  11879.             return -2;
  11880.         try {
  11881.             int ai[] = class9.valueIndexArray[j];
  11882.             int k = 0;
  11883.             int l = 0;
  11884.             int i1 = 0;
  11885.             do {
  11886.                 int j1 = ai[l++];
  11887.                 int k1 = 0;
  11888.                 byte byte0 = 0;
  11889.                 if (j1 == 0)
  11890.                     return k;
  11891.                 if (j1 == 1)
  11892.                     k1 = currentStats[ai[l++]];
  11893.                 if (j1 == 2)
  11894.                     k1 = maxStats[ai[l++]];
  11895.                 if (j1 == 3)
  11896.                     k1 = currentExp[ai[l++]];
  11897.                 if (j1 == 4) {
  11898.                     RSInterface class9_1 = RSInterface.interfaceCache[ai[l++]];
  11899.                     int k2 = ai[l++];
  11900.                     if (k2 >= 0 && k2 < ItemDef.totalItems
  11901.                             && (!ItemDef.forID(k2).membersObject || isMembers)) {
  11902.                         for (int j3 = 0; j3 < class9_1.inv.length; j3++)
  11903.                             if (class9_1.inv[j3] == k2 + 1)
  11904.                                 k1 += class9_1.invStackSizes[j3];
  11905.  
  11906.                     }
  11907.                 }
  11908.                 if (j1 == 5)
  11909.                     k1 = variousSettings[ai[l++]];
  11910.                 if (j1 == 6)
  11911.                     k1 = anIntArray1019[maxStats[ai[l++]] - 1];
  11912.                 if (j1 == 7)
  11913.                     k1 = (variousSettings[ai[l++]] * 100) / 46875;
  11914.                 if (j1 == 8)
  11915.                     k1 = myPlayer.combatLevel;
  11916.                 if (j1 == 9) {
  11917.                     for (int l1 = 0; l1 < Skills.skillsCount; l1++)
  11918.                         if (Skills.skillEnabled[l1])
  11919.                             k1 += maxStats[l1];
  11920.  
  11921.                 }
  11922.                 if (j1 == 10) {
  11923.                     RSInterface class9_2 = RSInterface.interfaceCache[ai[l++]];
  11924.                     int l2 = ai[l++] + 1;
  11925.                     if (l2 >= 0 && l2 < ItemDef.totalItems
  11926.                             && (!ItemDef.forID(l2).membersObject || isMembers)) {
  11927.                         for (int k3 = 0; k3 < class9_2.inv.length; k3++) {
  11928.                             if (class9_2.inv[k3] != l2)
  11929.                                 continue;
  11930.                             k1 = 0x3b9ac9ff;
  11931.                             break;
  11932.                         }
  11933.  
  11934.                     }
  11935.                 }
  11936.                 if (j1 == 11)
  11937.                     k1 = energy;
  11938.                 if (j1 == 12)
  11939.                     k1 = weight;
  11940.                 if (j1 == 13) {
  11941.                     int i2 = variousSettings[ai[l++]];
  11942.                     int i3 = ai[l++];
  11943.                     k1 = (i2 & 1 << i3) == 0 ? 0 : 1;
  11944.                 }
  11945.                 if (j1 == 14) {
  11946.                     int j2 = ai[l++];
  11947.                     VarBit varBit = VarBit.cache[j2];
  11948.                     int l3 = varBit.anInt648;
  11949.                     int i4 = varBit.anInt649;
  11950.                     int j4 = varBit.anInt650;
  11951.                     int k4 = anIntArray1232[j4 - i4];
  11952.                     k1 = variousSettings[l3] >> i4 & k4;
  11953.                 }
  11954.                 if (j1 == 15)
  11955.                     byte0 = 1;
  11956.                 if (j1 == 16)
  11957.                     byte0 = 2;
  11958.                 if (j1 == 17)
  11959.                     byte0 = 3;
  11960.                 if (j1 == 18)
  11961.                     k1 = (myPlayer.x >> 7) + baseX;
  11962.                 if (j1 == 19)
  11963.                     k1 = (myPlayer.y >> 7) + baseY;
  11964.                 if (j1 == 20)
  11965.                     k1 = ai[l++];
  11966.                 if (byte0 == 0) {
  11967.                     if (i1 == 0)
  11968.                         k += k1;
  11969.                     if (i1 == 1)
  11970.                         k -= k1;
  11971.                     if (i1 == 2 && k1 != 0)
  11972.                         k /= k1;
  11973.                     if (i1 == 3)
  11974.                         k *= k1;
  11975.                     i1 = 0;
  11976.                 } else {
  11977.                     i1 = byte0;
  11978.                 }
  11979.             } while (true);
  11980.         } catch (Exception _ex) {
  11981.             return -1;
  11982.         }
  11983.     }
  11984.  
  11985.     public void drawTooltip() {
  11986.         if (menuActionRow < 2 && itemSelected == 0 && spellSelected == 0)
  11987.             return;
  11988.         String s;
  11989.         if (itemSelected == 1 && menuActionRow < 2)
  11990.             s = "Use " + selectedItemName + " with...";
  11991.         else if (spellSelected == 1 && menuActionRow < 2)
  11992.             s = spellTooltip + "...";
  11993.         else
  11994.             s = menuActionName[menuActionRow - 1];
  11995.         if (menuActionRow > 2)
  11996.             s = s + "@whi@ / " + (menuActionRow - 2) + " more options";
  11997.         chatTextDrawingArea.method390(4, 0xffffff, s, loopCycle / 1000, 15);
  11998.     }
  11999.    
  12000.     private final void minimapHovers() {
  12001.         final boolean fixed = frameMode == ScreenMode.FIXED;
  12002.         hpHover = fixed ? super.mouseX >= 690 && super.mouseX <= 745 && super.mouseY >= 13 && super.mouseY < 47 : super.mouseX >= frameWidth - 216 && super.mouseX <= 159 && super.mouseY >= 13 && super.mouseY < 47;
  12003.         prayHover = fixed ? super.mouseX >= 525 && super.mouseX <= 581 && super.mouseY >= 105 && super.mouseY < 139 : super.mouseX >= frameWidth - 207 && super.mouseX <= frameWidth - 151 && super.mouseY >= 105 && super.mouseY < 139;
  12004.         runHover = fixed ? super.mouseX >= 558 && super.mouseX <= 613 && super.mouseY >= 132 && super.mouseY < 165 : super.mouseX >= frameWidth - 174 && super.mouseX <= frameWidth - 120 && super.mouseY >= 132 && super.mouseY < 165;
  12005.         counterHover = fixed ? super.mouseX >= 518 && super.mouseX <= 542 && super.mouseY >= 45 && super.mouseY <= 69 : super.mouseX >= frameWidth - 186 && super.mouseX <= frameWidth - 158 && super.mouseY >= 41 && super.mouseY <= 65;
  12006.     }
  12007.  
  12008.     private void drawMinimap() {
  12009.         if (frameMode == ScreenMode.FIXED) {
  12010.             aRSImageProducer_1164.initDrawingArea();
  12011.         }
  12012.         if (anInt1021 == 2) {
  12013.             if (frameMode == ScreenMode.FIXED) {
  12014.                 cacheSprite[19].drawSprite(0, 0);
  12015.             } else {
  12016.                 cacheSprite[44].drawSprite(frameWidth - 181, 0);
  12017.                 cacheSprite[45].drawSprite(frameWidth - 158, 7);
  12018.             }
  12019.             if (frameMode == ScreenMode.FIXED ? super.mouseX >= 517 && super.mouseX <= 545 && super.mouseY >= 45 && super.mouseY <= 70 :
  12020.                 super.mouseX >= frameWidth - 185 && super.mouseX <= frameWidth - 158 && super.mouseY >= 40 && super.mouseY <= 66) {
  12021.                 cacheSprite[23].drawSprite(frameMode == ScreenMode.FIXED ? 1 : frameWidth - 185, frameMode == ScreenMode.FIXED ? 46 : 41);
  12022.             } else {
  12023.                 cacheSprite[22].drawSprite(frameMode == ScreenMode.FIXED ? 1 : frameWidth - 185, frameMode == ScreenMode.FIXED ? 46 : 41);
  12024.             }
  12025.             if (frameMode != ScreenMode.FIXED && changeTabArea) {
  12026.                 if (super.mouseX >= frameWidth - 26 && super.mouseX <= frameWidth - 1 && super.mouseY >= 2 && super.mouseY <= 24 || tabID == 15) {
  12027.                     cacheSprite[27].drawSprite(frameWidth - 25, 2);
  12028.                 } else {
  12029.                     cacheSprite[27].drawARGBSprite(frameWidth - 25, 2, 165);
  12030.                 }
  12031.             }
  12032.             loadAllOrbs(frameMode == ScreenMode.FIXED ? 0 : frameWidth - 217);
  12033.             compass.method352(33, viewRotation, anIntArray1057, 256, anIntArray968, (frameMode == ScreenMode.FIXED ? 25 : 24), 4, (frameMode == ScreenMode.FIXED ? 29 : frameWidth - 176), 33, 25);
  12034.             if (menuOpen) {
  12035.                 drawMenu(frameMode == ScreenMode.FIXED ? 516 : 0, 0);
  12036.             }
  12037.             if (frameMode == ScreenMode.FIXED) {
  12038.                 aRSImageProducer_1164.initDrawingArea();
  12039.             }
  12040.             return;
  12041.         }
  12042.         int i = viewRotation + minimapRotation & 0x7ff;
  12043.         int j = 48 + myPlayer.x / 32;
  12044.         int l2 = 464 - myPlayer.y / 32;
  12045.         miniMapImage.method352(151, i, anIntArray1229, 256 + minimapZoom, anIntArray1052, l2, (frameMode == ScreenMode.FIXED ? 9 : 7), (frameMode == ScreenMode.FIXED ? 54 : frameWidth - 158), 146, j);
  12046.         for (int j5 = 0; j5 < anInt1071; j5++) {
  12047.             int k = (anIntArray1072[j5] * 4 + 2) - myPlayer.x / 32;
  12048.             int i3 = (anIntArray1073[j5] * 4 + 2) - myPlayer.y / 32;
  12049.             markMinimap(aClass30_Sub2_Sub1_Sub1Array1140[j5], k, i3);
  12050.         }
  12051.         for (int k5 = 0; k5 < 104; k5++) {
  12052.             for (int l5 = 0; l5 < 104; l5++) {
  12053.                 NodeList class19 = groundArray[plane][k5][l5];
  12054.                 if (class19 != null) {
  12055.                     int l = (k5 * 4 + 2) - myPlayer.x / 32;
  12056.                     int j3 = (l5 * 4 + 2) - myPlayer.y / 32;
  12057.                     markMinimap(mapDotItem, l, j3);
  12058.                 }
  12059.             }
  12060.         }
  12061.         for (int i6 = 0; i6 < npcCount; i6++) {
  12062.             NPC npc = npcArray[npcIndices[i6]];
  12063.             if (npc != null && npc.isVisible()) {
  12064.                 EntityDef entityDef = npc.desc;
  12065.                 if (entityDef.childrenIDs != null) {
  12066.                     entityDef = entityDef.method161();
  12067.                 }
  12068.                 if (entityDef != null && entityDef.aBoolean87 && entityDef.aBoolean84) {
  12069.                     int i1 = npc.x / 32 - myPlayer.x / 32;
  12070.                     int k3 = npc.y / 32 - myPlayer.y / 32;
  12071.                     markMinimap(mapDotNPC, i1, k3);
  12072.                 }
  12073.             }
  12074.         }
  12075.         for (int j6 = 0; j6 < playerCount; j6++) {
  12076.             Player player = playerArray[playerIndices[j6]];
  12077.             if (player != null && player.isVisible()) {
  12078.                 int j1 = player.x / 32 - myPlayer.x / 32;
  12079.                 int l3 = player.y / 32 - myPlayer.y / 32;
  12080.                 boolean flag1 = false;
  12081.                 boolean flag3 = false;
  12082.                 for (int j3 = 0; j3 < clanList.length; j3++) {
  12083.                     if (clanList[j3] == null) {
  12084.                         continue;
  12085.                     }
  12086.                     if (!clanList[j3].equalsIgnoreCase(player.name)) {
  12087.                         continue;
  12088.                     }
  12089.                     flag3 = true;
  12090.                     break;
  12091.                 }
  12092.                 long l6 = TextClass.longForName(player.name);
  12093.                 for (int k6 = 0; k6 < friendsCount; k6++) {
  12094.                     if (l6 != friendsListAsLongs[k6] || friendsNodeIDs[k6] == 0) {
  12095.                         continue;
  12096.                     }
  12097.                     flag1 = true;
  12098.                     break;
  12099.                 }
  12100.                 boolean flag2 = false;
  12101.                 if (myPlayer.team != 0 && player.team != 0 && myPlayer.team == player.team) {
  12102.                     flag2 = true;
  12103.                 }
  12104.                 if (flag1) {
  12105.                     markMinimap(mapDotFriend, j1, l3);
  12106.                 } else if (flag3) {
  12107.                     markMinimap(mapDotClan, j1, l3);
  12108.                 } else if (flag2) {
  12109.                     markMinimap(mapDotTeam, j1, l3);
  12110.                 } else {
  12111.                     markMinimap(mapDotPlayer, j1, l3);
  12112.                 }
  12113.             }
  12114.         }
  12115.         if (anInt855 != 0 && loopCycle % 20 < 10) {
  12116.             if (anInt855 == 1 && anInt1222 >= 0 && anInt1222 < npcArray.length) {
  12117.                 NPC class30_sub2_sub4_sub1_sub1_1 = npcArray[anInt1222];
  12118.                 if (class30_sub2_sub4_sub1_sub1_1 != null) {
  12119.                     int k1 = class30_sub2_sub4_sub1_sub1_1.x / 32 - myPlayer.x / 32;
  12120.                     int i4 = class30_sub2_sub4_sub1_sub1_1.y / 32 - myPlayer.y / 32;
  12121.                     method81(mapMarker, i4, k1);
  12122.                 }
  12123.             }
  12124.             if (anInt855 == 2) {
  12125.                 int l1 = ((anInt934 - baseX) * 4 + 2) - myPlayer.x / 32;
  12126.                 int j4 = ((anInt935 - baseY) * 4 + 2) - myPlayer.y / 32;
  12127.                 method81(mapMarker, j4, l1);
  12128.             }
  12129.             if (anInt855 == 10 && anInt933 >= 0 && anInt933 < playerArray.length) {
  12130.                 Player class30_sub2_sub4_sub1_sub2_1 = playerArray[anInt933];
  12131.                 if (class30_sub2_sub4_sub1_sub2_1 != null) {
  12132.                     int i2 = class30_sub2_sub4_sub1_sub2_1.x / 32 - myPlayer.x / 32;
  12133.                     int k4 = class30_sub2_sub4_sub1_sub2_1.y / 32 - myPlayer.y / 32;
  12134.                     method81(mapMarker, k4, i2);
  12135.                 }
  12136.             }
  12137.         }
  12138.         if (destX != 0) {
  12139.             int j2 = (destX * 4 + 2) - myPlayer.x / 32;
  12140.             int l4 = (destY * 4 + 2) - myPlayer.y / 32;
  12141.             markMinimap(mapFlag, j2, l4);
  12142.         }
  12143.         DrawingArea.drawPixels(3, (frameMode == ScreenMode.FIXED ? 83 : 80), (frameMode == ScreenMode.FIXED ? 127 : frameWidth - 88), 0xffffff, 3);
  12144.         if (frameMode == ScreenMode.FIXED) {
  12145.             cacheSprite[19].drawSprite(0, 0);
  12146.         } else {
  12147.             cacheSprite[44].drawSprite(frameWidth - 181, 0);
  12148.         }
  12149.         compass.method352(33, viewRotation, anIntArray1057, 256, anIntArray968, (frameMode == ScreenMode.FIXED ? 25 : 24), 4, (frameMode == ScreenMode.FIXED ? 29 : frameWidth - 176), 33, 25);
  12150.         if (frameMode == ScreenMode.FIXED ? super.mouseX >= 517 && super.mouseX <= 545 && super.mouseY >= 45 && super.mouseY <= 70 :
  12151.             super.mouseX >= frameWidth - 185 && super.mouseX <= frameWidth - 158 && super.mouseY >= 40 && super.mouseY <= 66) {
  12152.             cacheSprite[23].drawSprite(frameMode == ScreenMode.FIXED ? 1 : frameWidth - 185, frameMode == ScreenMode.FIXED ? 46 : 41);
  12153.         } else {
  12154.             cacheSprite[22].drawSprite(frameMode == ScreenMode.FIXED ? 1 : frameWidth - 185, frameMode == ScreenMode.FIXED ? 46 : 41);
  12155.         }
  12156.         if (frameMode != ScreenMode.FIXED && changeTabArea) {
  12157.             if (super.mouseX >= frameWidth - 26 && super.mouseX <= frameWidth - 1 && super.mouseY >= 2 && super.mouseY <= 24 || tabID == 15) {
  12158.                 cacheSprite[27].drawSprite(frameWidth - 25, 2);
  12159.             } else {
  12160.                 cacheSprite[27].drawARGBSprite(frameWidth - 25, 2, 165);
  12161.             }
  12162.         }
  12163.         loadAllOrbs(frameMode == ScreenMode.FIXED ? 0 : frameWidth - 217);
  12164.         if (menuOpen) {
  12165.             drawMenu(frameMode == ScreenMode.FIXED ? 516 : 0, 0);
  12166.         }
  12167.         if (frameMode == ScreenMode.FIXED) {
  12168.             aRSImageProducer_1165.initDrawingArea();
  12169.         }
  12170.     }
  12171.    
  12172.     public int digits = 0;
  12173.     public int xpCounter, xpAddedPos, expAdded;
  12174.     private void drawCounterOnScreen() {
  12175.         int x = frameMode == ScreenMode.FIXED ? 500 : frameWidth - 200;
  12176.         int y = frameMode == ScreenMode.FIXED ? 46 : 50;
  12177.         digits = xpCounter == 0 ? 1 : 1 + (int) Math.floor(Math.log10(xpCounter));
  12178.         int lengthToRemove = Integer.toString(xpCounter).length();
  12179.         int i = aTextDrawingArea_1271.getTextWidth(Integer.toString(xpCounter)) - aTextDrawingArea_1271.getTextWidth(Integer.toString(xpCounter)) / 2;
  12180.         int a = lengthToRemove == 1 ? 5 : ((lengthToRemove - 1) * 5);
  12181.         aTextDrawingArea_1271.method382(0xFFFFFD, x - 38 - i - digits - 12, "Total:", y - 34, true);
  12182.         if (xpCounter >= 0) {
  12183.             aTextDrawingArea_1271.method382(0xFFFFFD, x + 1 - i, "+" + NumberFormat.getIntegerInstance().format(xpCounter), y - 34, true);
  12184.         } else {
  12185.             expAdded = 0;
  12186.         }
  12187.         if (expAdded != 0) {
  12188.             a = smallText.getTextWidth("" + NumberFormat.getIntegerInstance().format(expAdded) + "xp");
  12189.             smallText.method389(true, x - a + 12, 0xFFFFFD, "+" + NumberFormat.getIntegerInstance().format(expAdded), y + 5 - xpAddedPos);
  12190.             xpAddedPos++;
  12191.             if (xpAddedPos >= 140) {
  12192.                 xpAddedPos = expAdded = 0;
  12193.             }
  12194.         } else {
  12195.             expAdded = 0;
  12196.         }
  12197.     }
  12198.     private boolean runHover, runEnergy, prayHover, hpHover, counterOn, sumHover, sumActive, counterHover, runClicked = true;
  12199.     public boolean isPoisoned, clickedQuickPrayers;
  12200.     public boolean newDamage = false;
  12201.     public final int[]
  12202.             orbX = { 1, 9, 41 },
  12203.             orbY = { 68, 105, 132 },
  12204.             orbTextX = { 16, 25, 57 },
  12205.             orbTextY = { 94, 131, 158 },
  12206.             coloredOrbX = { 28, 36, 68 },
  12207.             coloredOrbY = { 72, 109, 136 },
  12208.             currentInterface = { 31159, 31134, 149 },
  12209.             maximumInterface = { 31160, 31135, 149 },
  12210.             orbIconX = { 34, 39, 75 },
  12211.             orbIconY = { 78, 112, 140 };
  12212.  
  12213.         private void loadAllOrbs(int xOffset) {
  12214.             int[]
  12215.                 spriteID = { isPoisoned && hpHover ? 8 : 7, prayHover ? 8 : 7, runHover ? 8 : 7, sumActive && sumHover ? 8 : 7 },
  12216.                 coloredOrbSprite = { 0, clickedQuickPrayers ? 2 : 1, runClicked ? 4 : 3, sumActive ? 6 : 5 },
  12217.                 orbSprite = { 9, 10, (runClicked ? 12 : 11), 13 };
  12218.             String cEnergy = RSInterface.interfaceCache[149].message.replaceAll("%", "");
  12219.             String hp = RSInterface.interfaceCache[4016].message.replaceAll("%", "");
  12220.             int currentHP = Integer.parseInt(hp), currentEnergy = Integer.parseInt(cEnergy);
  12221.             for (int i = 0; i < 3; i++) {
  12222.                 String currentStats = RSInterface.interfaceCache[currentInterface[i]].message.replaceAll("%", ""), maxStats = RSInterface.interfaceCache[maximumInterface[i]].message.replaceAll("%", "");
  12223.                 int currentLevel = Integer.parseInt(currentStats), maxLevel = Integer.parseInt(maxStats), level = (int) (((double) currentLevel / (double) maxLevel) * 100D);
  12224.                 cacheSprite[spriteID[i]].drawSprite(orbX[i] + xOffset, orbY[i]);
  12225.                 cacheSprite[coloredOrbSprite[i]].drawSprite(coloredOrbX[i] + xOffset, coloredOrbY[i]);
  12226.                 double percent = (i == 2 ? runEnergy ? currentEnergy / 100D : 100 : level / 100D), fillHp = 26 * percent, fillPrayer = 26 * percent, fillRun = 26 * percent;
  12227.                 double[] fill = { fillHp, fillPrayer, fillRun};
  12228.                 int depleteFill = 27 - (int) fill[i];
  12229.                 cacheSprite[14].myHeight = depleteFill;
  12230.                 try {
  12231.                     cacheSprite[14].drawSprite(coloredOrbX[i] + xOffset, coloredOrbY[i]);
  12232.                 } catch (Exception e) { }
  12233.                 cacheSprite[orbSprite[i]].drawSprite(orbIconX[i] + xOffset, orbIconY[i]);
  12234.                 smallText.method382(getOrbTextColor(i == 2 ? runEnergy ? currentEnergy : 100 : level), orbTextX[i] + xOffset, "" + (i == 2 ? runEnergy ? cEnergy : 100 : i == 0 && newDamage ? currentHP * 10 : RSInterface.interfaceCache[currentInterface[i]].message.replaceAll("%", "")), orbTextY[i], true);
  12235.             }
  12236.         }
  12237.  
  12238.     public int getOrbTextColor(int i) {
  12239.         if (i >= 75 && i <= 0x7fffffff)
  12240.             return 65280;
  12241.         if (i >= 50 && i <= 74)
  12242.             return 0xffff00;
  12243.         return i < 25 || i > 49 ? 0xff0000 : 0xff981f;
  12244.     }
  12245.  
  12246.     public int getOrbFill(int i) {
  12247.         if (i <= 0x7fffffff && i >= 97)
  12248.             return 0;
  12249.         if (i <= 96 && i >= 93)
  12250.             return 1;
  12251.         if (i <= 92 && i >= 89)
  12252.             return 2;
  12253.         if (i <= 88 && i >= 85)
  12254.             return 3;
  12255.         if (i <= 84 && i >= 81)
  12256.             return 4;
  12257.         if (i <= 80 && i >= 77)
  12258.             return 5;
  12259.         if (i <= 76 && i >= 73)
  12260.             return 6;
  12261.         if (i <= 72 && i >= 69)
  12262.             return 7;
  12263.         if (i <= 68 && i >= 65)
  12264.             return 8;
  12265.         if (i <= 64 && i >= 61)
  12266.             return 9;
  12267.         if (i <= 60 && i >= 57)
  12268.             return 10;
  12269.         if (i <= 56 && i >= 53)
  12270.             return 11;
  12271.         if (i <= 52 && i >= 49)
  12272.             return 12;
  12273.         if (i <= 48 && i >= 45)
  12274.             return 13;
  12275.         if (i <= 44 && i >= 41)
  12276.             return 14;
  12277.         if (i <= 40 && i >= 37)
  12278.             return 15;
  12279.         if (i <= 36 && i >= 33)
  12280.             return 16;
  12281.         if (i <= 32 && i >= 29)
  12282.             return 17;
  12283.         if (i <= 28 && i >= 25)
  12284.             return 18;
  12285.         if (i <= 24 && i >= 21)
  12286.             return 19;
  12287.         if (i <= 20 && i >= 17)
  12288.             return 20;
  12289.         if (i <= 16 && i >= 13)
  12290.             return 21;
  12291.         if (i <= 12 && i >= 9)
  12292.             return 22;
  12293.         if (i <= 8 && i >= 7)
  12294.             return 23;
  12295.         if (i <= 6 && i >= 5)
  12296.             return 24;
  12297.         if (i <= 4 && i >= 3)
  12298.             return 25;
  12299.         if (i <= 2 && i >= 1)
  12300.             return 26;
  12301.         return i > 0 ? 0 : 27;
  12302.     }
  12303.    
  12304.     public void npcScreenPos(Entity entity, int i) {
  12305.         calcEntityScreenPos(entity.x, i, entity.y);
  12306.     }
  12307.  
  12308.     public void calcEntityScreenPos(int i, int j, int l) {
  12309.         if (i < 128 || l < 128 || i > 13056 || l > 13056) {
  12310.             spriteDrawX = -1;
  12311.             spriteDrawY = -1;
  12312.             return;
  12313.         }
  12314.         int i1 = method42(plane, l, i) - j;
  12315.         i -= xCameraPos;
  12316.         i1 -= zCameraPos;
  12317.         l -= yCameraPos;
  12318.         int j1 = Model.modelIntArray1[yCameraCurve];
  12319.         int k1 = Model.modelIntArray2[yCameraCurve];
  12320.         int l1 = Model.modelIntArray1[xCameraCurve];
  12321.         int i2 = Model.modelIntArray2[xCameraCurve];
  12322.         int j2 = l * l1 + i * i2 >> 16;
  12323.         l = l * i2 - i * l1 >> 16;
  12324.         i = j2;
  12325.         j2 = i1 * k1 - l * j1 >> 16;
  12326.         l = i1 * j1 + l * k1 >> 16;
  12327.         i1 = j2;
  12328.         if (l >= 50) {
  12329.             spriteDrawX = Texture.textureInt1 + (i << WorldController.viewDistance) / l;
  12330.             spriteDrawY = Texture.textureInt2 + (i1 << WorldController.viewDistance) / l;
  12331.         } else {
  12332.             spriteDrawX = -1;
  12333.             spriteDrawY = -1;
  12334.         }
  12335.     }
  12336.  
  12337.     private void buildSplitPrivateChatMenu() {
  12338.         if (splitPrivateChat == 0)
  12339.             return;
  12340.         int i = 0;
  12341.         if (anInt1104 != 0)
  12342.             i = 1;
  12343.         for (int j = 0; j < 100; j++)
  12344.             if (chatMessages[j] != null) {
  12345.                 int k = chatTypes[j];
  12346.                 String s = chatNames[j];
  12347.                 if (s != null && s.startsWith("@cr1@")) {
  12348.                     s = s.substring(5);
  12349.                 }
  12350.                 if (s != null && s.startsWith("@cr2@")) {
  12351.                     s = s.substring(5);
  12352.                 }
  12353.                 if (s != null && s.startsWith("@cr3@")) {
  12354.                     s = s.substring(5);
  12355.                 }
  12356.                 if (s != null && s.startsWith("@cr4@")) {
  12357.                     s = s.substring(5);
  12358.                 }
  12359.                 if (s != null && s.startsWith("@cr5@")) {
  12360.                     s = s.substring(5);
  12361.                 }
  12362.                 if (s != null && s.startsWith("@cr6@")) {
  12363.                     s = s.substring(5);
  12364.                 }
  12365.                 if (s != null && s.startsWith("@cr7@")) {
  12366.                     s = s.substring(5);
  12367.                 }
  12368.                 if (s != null && s.startsWith("@cr8@")) {
  12369.                     s = s.substring(5);
  12370.                 }
  12371.                 if (s != null && s.startsWith("@cr9@")) {
  12372.                     s = s.substring(5);
  12373.                 }
  12374.                 if (s != null && s.startsWith("@cr10@")) {
  12375.                     s = s.substring(5);
  12376.                 }
  12377.                 if (s != null && s.startsWith("@cr11@")) {
  12378.                     s = s.substring(5);
  12379.                 }
  12380.                 if (s != null && s.startsWith("@cr12@")) {
  12381.                     s = s.substring(5);
  12382.                 }
  12383.                 if (s != null && s.startsWith("@cr13@")) {
  12384.                     s = s.substring(5);
  12385.                 }
  12386.                 if (s != null && s.startsWith("@cr14@")) {
  12387.                     s = s.substring(5);
  12388.                 }
  12389.                 if (s != null && s.startsWith("@cr15@")) {
  12390.                     s = s.substring(5);
  12391.                 }
  12392.                 if (s != null && s.startsWith("@cr16@")) {
  12393.                     s = s.substring(5);
  12394.                 }
  12395.                 if (s != null && s.startsWith("@cr17@")) {
  12396.                     s = s.substring(5);
  12397.                 }
  12398.                 if (s != null && s.startsWith("@cr18@")) {
  12399.                     s = s.substring(5);
  12400.                 }
  12401.                 if (s != null && s.startsWith("@cr19@")) {
  12402.                     s = s.substring(5);
  12403.                 }
  12404.                 if (s != null && s.startsWith("@cr20@")) {
  12405.                     s = s.substring(5);
  12406.                 }
  12407.                 if (s != null && s.startsWith("@cr21@")) {
  12408.                     s = s.substring(5);
  12409.                 }
  12410.                 if (s != null && s.startsWith("@cr22@")) {
  12411.                     s = s.substring(5);
  12412.                 }
  12413.                 if (s != null && s.startsWith("@cr23@")) {
  12414.                     s = s.substring(5);
  12415.                 }
  12416.                 if (s != null && s.startsWith("@cr24@")) {
  12417.                     s = s.substring(5);
  12418.                 }
  12419.                 if (s != null && s.startsWith("@cr25@")) {
  12420.                     s = s.substring(5);
  12421.                 }
  12422.                 if (s != null && s.startsWith("@cr26@")) {
  12423.                     s = s.substring(5);
  12424.                 }
  12425.                 if (s != null && s.startsWith("@cr27@")) {
  12426.                     s = s.substring(5);
  12427.                 }
  12428.                 if (s != null && s.startsWith("@cr28@")) {
  12429.                     s = s.substring(5);
  12430.                 }
  12431.                 if (s != null && s.startsWith("@cr29@")) {
  12432.                     s = s.substring(5);
  12433.                 }
  12434.                 if ((k == 3 || k == 7)
  12435.                         && (k == 7 || privateChatMode == 0 || privateChatMode == 1
  12436.                                 && isFriendOrSelf(s))) {
  12437.                     int l = 329 - i * 13;
  12438.                     if (super.mouseX > 4 && super.mouseY - 4 > l - 10
  12439.                             && super.mouseY - 4 <= l + 3) {
  12440.                         int i1 = aTextDrawingArea_1271.getTextWidth("From:  "
  12441.                                 + s + chatMessages[j]) + 25;
  12442.                         if (i1 > 450)
  12443.                             i1 = 450;
  12444.                         if (super.mouseX < 4 + i1) {
  12445.                             if (myPrivilege >= 1) {
  12446.                                 menuActionName[menuActionRow] = "Report abuse @whi@"
  12447.                                         + s;
  12448.                                 menuActionID[menuActionRow] = 2606;
  12449.                                 menuActionRow++;
  12450.                             }
  12451.                             menuActionName[menuActionRow] = "Add ignore @whi@"
  12452.                                     + s;
  12453.                             menuActionID[menuActionRow] = 2042;
  12454.                             menuActionRow++;
  12455.                             menuActionName[menuActionRow] = "Add friend @whi@"
  12456.                                     + s;
  12457.                             menuActionID[menuActionRow] = 2337;
  12458.                             menuActionRow++;
  12459.                         }
  12460.                     }
  12461.                     if (++i >= 5)
  12462.                         return;
  12463.                 }
  12464.                 if ((k == 5 || k == 6) && privateChatMode < 2 && ++i >= 5)
  12465.                     return;
  12466.             }
  12467.  
  12468.     }
  12469.  
  12470.     public void method130(int j, int k, int l, int i1, int j1, int k1, int l1,
  12471.             int i2, int j2) {
  12472.         Class30_Sub1 class30_sub1 = null;
  12473.         for (Class30_Sub1 class30_sub1_1 = (Class30_Sub1) aClass19_1179
  12474.                 .reverseGetFirst(); class30_sub1_1 != null; class30_sub1_1 = (Class30_Sub1) aClass19_1179
  12475.                 .reverseGetNext()) {
  12476.             if (class30_sub1_1.anInt1295 != l1
  12477.                     || class30_sub1_1.anInt1297 != i2
  12478.                     || class30_sub1_1.anInt1298 != j1
  12479.                     || class30_sub1_1.anInt1296 != i1)
  12480.                 continue;
  12481.             class30_sub1 = class30_sub1_1;
  12482.             break;
  12483.         }
  12484.  
  12485.         if (class30_sub1 == null) {
  12486.             class30_sub1 = new Class30_Sub1();
  12487.             class30_sub1.anInt1295 = l1;
  12488.             class30_sub1.anInt1296 = i1;
  12489.             class30_sub1.anInt1297 = i2;
  12490.             class30_sub1.anInt1298 = j1;
  12491.             method89(class30_sub1);
  12492.             aClass19_1179.insertHead(class30_sub1);
  12493.         }
  12494.         class30_sub1.anInt1291 = k;
  12495.         class30_sub1.anInt1293 = k1;
  12496.         class30_sub1.anInt1292 = l;
  12497.         class30_sub1.anInt1302 = j2;
  12498.         class30_sub1.anInt1294 = j;
  12499.     }
  12500.  
  12501.     private boolean interfaceIsSelected(RSInterface class9) {
  12502.         if (class9.anIntArray245 == null)
  12503.             return false;
  12504.         for (int i = 0; i < class9.anIntArray245.length; i++) {
  12505.             int j = extractInterfaceValues(class9, i);
  12506.             int k = class9.anIntArray212[i];
  12507.             if (class9.anIntArray245[i] == 2) {
  12508.                 if (j >= k)
  12509.                     return false;
  12510.             } else if (class9.anIntArray245[i] == 3) {
  12511.                 if (j <= k)
  12512.                     return false;
  12513.             } else if (class9.anIntArray245[i] == 4) {
  12514.                 if (j == k)
  12515.                     return false;
  12516.             } else if (j != k)
  12517.                 return false;
  12518.         }
  12519.  
  12520.         return true;
  12521.     }
  12522.  
  12523.     private DataInputStream openJagGrabInputStream(String s) throws IOException {
  12524.         // if(!aBoolean872)
  12525.         // if(signlink.mainapp != null)
  12526.         // return signlink.openurl(s);
  12527.         // else
  12528.         // return new DataInputStream((new URL(getCodeBase(), s)).openStream());
  12529.         if (aSocket832 != null) {
  12530.             try {
  12531.                 aSocket832.close();
  12532.             } catch (Exception _ex) {
  12533.             }
  12534.             aSocket832 = null;
  12535.         }
  12536.         aSocket832 = openSocket(43595);
  12537.         aSocket832.setSoTimeout(10000);
  12538.         java.io.InputStream inputstream = aSocket832.getInputStream();
  12539.         OutputStream outputstream = aSocket832.getOutputStream();
  12540.         outputstream.write(("JAGGRAB /" + s + "\n\n").getBytes());
  12541.         return new DataInputStream(inputstream);
  12542.     }
  12543.  
  12544.     public void doFlamesDrawing() {
  12545.         char c = '\u0100';
  12546.         if (anInt1040 > 0) {
  12547.             for (int i = 0; i < 256; i++)
  12548.                 if (anInt1040 > 768)
  12549.                     anIntArray850[i] = method83(anIntArray851[i],
  12550.                             anIntArray852[i], 1024 - anInt1040);
  12551.                 else if (anInt1040 > 256)
  12552.                     anIntArray850[i] = anIntArray852[i];
  12553.                 else
  12554.                     anIntArray850[i] = method83(anIntArray852[i],
  12555.                             anIntArray851[i], 256 - anInt1040);
  12556.  
  12557.         } else if (anInt1041 > 0) {
  12558.             for (int j = 0; j < 256; j++)
  12559.                 if (anInt1041 > 768)
  12560.                     anIntArray850[j] = method83(anIntArray851[j],
  12561.                             anIntArray853[j], 1024 - anInt1041);
  12562.                 else if (anInt1041 > 256)
  12563.                     anIntArray850[j] = anIntArray853[j];
  12564.                 else
  12565.                     anIntArray850[j] = method83(anIntArray853[j],
  12566.                             anIntArray851[j], 256 - anInt1041);
  12567.  
  12568.         } else {
  12569.             System.arraycopy(anIntArray851, 0, anIntArray850, 0, 256);
  12570.  
  12571.         }
  12572.         System.arraycopy(aClass30_Sub2_Sub1_Sub1_1201.myPixels, 0,
  12573.                 aRSImageProducer_1110.canvasRaster, 0, 33920);
  12574.  
  12575.         int i1 = 0;
  12576.         int j1 = 1152;
  12577.         for (int k1 = 1; k1 < c - 1; k1++) {
  12578.             int l1 = (anIntArray969[k1] * (c - k1)) / c;
  12579.             int j2 = 22 + l1;
  12580.             if (j2 < 0)
  12581.                 j2 = 0;
  12582.             i1 += j2;
  12583.             for (int l2 = j2; l2 < 128; l2++) {
  12584.                 int j3 = anIntArray828[i1++];
  12585.                 if (j3 != 0) {
  12586.                     int l3 = j3;
  12587.                     int j4 = 256 - j3;
  12588.                     j3 = anIntArray850[j3];
  12589.                     int l4 = aRSImageProducer_1110.canvasRaster[j1];
  12590.                     aRSImageProducer_1110.canvasRaster[j1++] = ((j3 & 0xff00ff)
  12591.                             * l3 + (l4 & 0xff00ff) * j4 & 0xff00ff00)
  12592.                             + ((j3 & 0xff00) * l3 + (l4 & 0xff00) * j4 & 0xff0000) >> 8;
  12593.                 } else {
  12594.                     j1++;
  12595.                 }
  12596.             }
  12597.  
  12598.             j1 += j2;
  12599.         }
  12600.  
  12601.         aRSImageProducer_1110.drawGraphics(0, super.graphics, 0);
  12602.         System.arraycopy(aClass30_Sub2_Sub1_Sub1_1202.myPixels, 0,
  12603.                 aRSImageProducer_1111.canvasRaster, 0, 33920);
  12604.  
  12605.         i1 = 0;
  12606.         j1 = 1176;
  12607.         for (int k2 = 1; k2 < c - 1; k2++) {
  12608.             int i3 = (anIntArray969[k2] * (c - k2)) / c;
  12609.             int k3 = 103 - i3;
  12610.             j1 += i3;
  12611.             for (int i4 = 0; i4 < k3; i4++) {
  12612.                 int k4 = anIntArray828[i1++];
  12613.                 if (k4 != 0) {
  12614.                     int i5 = k4;
  12615.                     int j5 = 256 - k4;
  12616.                     k4 = anIntArray850[k4];
  12617.                     int k5 = aRSImageProducer_1111.canvasRaster[j1];
  12618.                     aRSImageProducer_1111.canvasRaster[j1++] = ((k4 & 0xff00ff)
  12619.                             * i5 + (k5 & 0xff00ff) * j5 & 0xff00ff00)
  12620.                             + ((k4 & 0xff00) * i5 + (k5 & 0xff00) * j5 & 0xff0000) >> 8;
  12621.                 } else {
  12622.                     j1++;
  12623.                 }
  12624.             }
  12625.  
  12626.             i1 += 128 - k3;
  12627.             j1 += 128 - k3 - i3;
  12628.         }
  12629.  
  12630.         aRSImageProducer_1111.drawGraphics(0, super.graphics, 637);
  12631.     }
  12632.  
  12633.     public void method134(Stream stream) {
  12634.         int j = stream.readBits(8);
  12635.         if (j < playerCount) {
  12636.             for (int k = j; k < playerCount; k++)
  12637.                 anIntArray840[anInt839++] = playerIndices[k];
  12638.  
  12639.         }
  12640.         if (j > playerCount) {
  12641.             signlink.reporterror(myUsername + " Too many players");
  12642.             throw new RuntimeException("eek");
  12643.         }
  12644.         playerCount = 0;
  12645.         for (int l = 0; l < j; l++) {
  12646.             int i1 = playerIndices[l];
  12647.             Player player = playerArray[i1];
  12648.             int j1 = stream.readBits(1);
  12649.             if (j1 == 0) {
  12650.                 playerIndices[playerCount++] = i1;
  12651.                 player.anInt1537 = loopCycle;
  12652.             } else {
  12653.                 int k1 = stream.readBits(2);
  12654.                 if (k1 == 0) {
  12655.                     playerIndices[playerCount++] = i1;
  12656.                     player.anInt1537 = loopCycle;
  12657.                     anIntArray894[anInt893++] = i1;
  12658.                 } else if (k1 == 1) {
  12659.                     playerIndices[playerCount++] = i1;
  12660.                     player.anInt1537 = loopCycle;
  12661.                     int l1 = stream.readBits(3);
  12662.                     player.moveInDir(false, l1);
  12663.                     int j2 = stream.readBits(1);
  12664.                     if (j2 == 1)
  12665.                         anIntArray894[anInt893++] = i1;
  12666.                 } else if (k1 == 2) {
  12667.                     playerIndices[playerCount++] = i1;
  12668.                     player.anInt1537 = loopCycle;
  12669.                     int i2 = stream.readBits(3);
  12670.                     player.moveInDir(true, i2);
  12671.                     int k2 = stream.readBits(3);
  12672.                     player.moveInDir(true, k2);
  12673.                     int l2 = stream.readBits(1);
  12674.                     if (l2 == 1)
  12675.                         anIntArray894[anInt893++] = i1;
  12676.                 } else if (k1 == 3)
  12677.                     anIntArray840[anInt839++] = i1;
  12678.             }
  12679.         }
  12680.     }
  12681.  
  12682.     public void drawLoginScreen(boolean flag) {
  12683.         resetImageProducers();
  12684.         aRSImageProducer_1109.initDrawingArea();
  12685.         aBackground_966.drawBackground(0, 0);
  12686.         char c = '\u0168';
  12687.         char c1 = '\310';
  12688.         if (loginScreenState == 0) {
  12689.             int i = c1 / 2 + 80;
  12690.             smallText.method382(0x75a9a9, c / 2, onDemandFetcher.statusString,
  12691.                     i, true);
  12692.             i = c1 / 2 - 20;
  12693.             chatTextDrawingArea.method382(0xffff00, c / 2, "Welcome to RatedPixels",
  12694.                     i, true);
  12695.             i += 30;
  12696.             int l = c / 2 - 80;
  12697.             int k1 = c1 / 2 + 20;
  12698.             aBackground_967.drawBackground(l - 73, k1 - 20);
  12699.             chatTextDrawingArea.method382(0xffffff, l, "About RatedPixels", k1 + 5,
  12700.                     true);
  12701.             l = c / 2 + 80;
  12702.             aBackground_967.drawBackground(l - 73, k1 - 20);
  12703.             chatTextDrawingArea.method382(0xffffff, l, "Play RatedPixels", k1 + 5,
  12704.                     true);
  12705.         }
  12706.         if (loginScreenState == 2) {
  12707.             int j = c1 / 2 - 40;
  12708.             if (loginMessage1.length() > 0) {
  12709.                 chatTextDrawingArea.method382(0xffff00, c / 2, loginMessage1,
  12710.                         j - 15, true);
  12711.                 chatTextDrawingArea.method382(0xffff00, c / 2, loginMessage2,
  12712.                         j, true);
  12713.                 j += 30;
  12714.             } else {
  12715.                 chatTextDrawingArea.method382(0xffff00, c / 2, loginMessage2,
  12716.                         j - 7, true);
  12717.                 j += 30;
  12718.             }
  12719.             chatTextDrawingArea
  12720.                     .method389(true, c / 2 - 90, 0xffffff, "Username: "
  12721.                             + capitalize(myUsername)
  12722.                             + ((loginScreenCursorPos == 0)
  12723.                                     & (loopCycle % 40 < 20) ? "@yel@|" : ""), j);
  12724.             // chatTextDrawingArea.method389(true, c / 2 - 90, 0xffffff,
  12725.             // "Username: " + myUsername + ((loginScreenCursorPos == 0) &
  12726.             // (loopCycle % 40 < 20) ? "@yel@|" : ""), j);
  12727.             j += 15;
  12728.             chatTextDrawingArea
  12729.                     .method389(true, c / 2 - 88, 0xffffff, "Password: "
  12730.                             + TextClass.passwordAsterisks(myPassword)
  12731.                             + ((loginScreenCursorPos == 1)
  12732.                                     & (loopCycle % 40 < 20) ? "@yel@|" : ""), j);
  12733.             j += 15;
  12734.             if (!flag) {
  12735.                 int i1 = c / 2 - 80;
  12736.                 int l1 = c1 / 2 + 50;
  12737.                 aBackground_967.drawBackground(i1 - 73, l1 - 20);
  12738.                 chatTextDrawingArea.method382(0xffffff, i1, "Login", l1 + 5,
  12739.                         true);
  12740.                 i1 = c / 2 + 80;
  12741.                 aBackground_967.drawBackground(i1 - 73, l1 - 20);
  12742.                 chatTextDrawingArea.method382(0xffffff, i1, "Cancel", l1 + 5,
  12743.                         true);
  12744.             }
  12745.         }
  12746.         if (loginScreenState == 3) {
  12747.             chatTextDrawingArea.method382(0xffff00, c / 2, "Information",
  12748.                     c1 / 2 - 60, true);
  12749.             int k = c1 / 2 - 35;
  12750.             chatTextDrawingArea.method382(0xffffff, c / 2,
  12751.                     "RatedPixels is an Oldschool", k, true);
  12752.             k += 15;
  12753.             chatTextDrawingArea.method382(0xffffff, c / 2,
  12754.                     "Economy and Pking server", k, true);
  12755.             k += 15;
  12756.             chatTextDrawingArea.method382(0xffffff, c / 2,
  12757.                     "aimed to provide a fun", k, true);
  12758.             k += 15;
  12759.             chatTextDrawingArea.method382(0xffffff, c / 2,
  12760.                     "and enjoyable game experience", k, true);
  12761.             k += 15;
  12762.             int j1 = c / 2;
  12763.             int i2 = c1 / 2 + 50;
  12764.             aBackground_967.drawBackground(j1 - 73, i2 - 20);
  12765.             chatTextDrawingArea.method382(0xffffff, j1, "Cancel", i2 + 5, true);
  12766.         }
  12767.         aRSImageProducer_1109.drawGraphics(171, super.graphics, 202);
  12768.         if (welcomeScreenRaised) {
  12769.             welcomeScreenRaised = false;
  12770.             aRSImageProducer_1107.drawGraphics(0, super.graphics, 128);
  12771.             aRSImageProducer_1108.drawGraphics(371, super.graphics, 202);
  12772.             aRSImageProducer_1112.drawGraphics(265, super.graphics, 0);
  12773.             aRSImageProducer_1113.drawGraphics(265, super.graphics, 562);
  12774.             aRSImageProducer_1114.drawGraphics(171, super.graphics, 128);
  12775.             aRSImageProducer_1115.drawGraphics(171, super.graphics, 562);
  12776.         }
  12777.     }
  12778.  
  12779.     public void drawFlames() {
  12780.         drawingFlames = true;
  12781.         try {
  12782.             long l = System.currentTimeMillis();
  12783.             int i = 0;
  12784.             int j = 20;
  12785.             while (aBoolean831) {
  12786.                 anInt1208++;
  12787.                 calcFlamesPosition();
  12788.                 calcFlamesPosition();
  12789.                 doFlamesDrawing();
  12790.                 if (++i > 10) {
  12791.                     long l1 = System.currentTimeMillis();
  12792.                     int k = (int) (l1 - l) / 10 - j;
  12793.                     j = 40 - k;
  12794.                     if (j < 5)
  12795.                         j = 5;
  12796.                     i = 0;
  12797.                     l = l1;
  12798.                 }
  12799.                 try {
  12800.                     Thread.sleep(j);
  12801.                 } catch (Exception _ex) {
  12802.                 }
  12803.             }
  12804.         } catch (Exception _ex) {
  12805.         }
  12806.         drawingFlames = false;
  12807.     }
  12808.  
  12809.     @Override
  12810.     public void raiseWelcomeScreen() {
  12811.         welcomeScreenRaised = true;
  12812.     }
  12813.  
  12814.     public void method137(Stream stream, int j) {
  12815.         if (j == 84) {
  12816.             int k = stream.readUnsignedByte();
  12817.             int j3 = anInt1268 + (k >> 4 & 7);
  12818.             int i6 = anInt1269 + (k & 7);
  12819.             int l8 = stream.readUnsignedWord();
  12820.             int k11 = stream.readUnsignedWord();
  12821.             int l13 = stream.readUnsignedWord();
  12822.             if (j3 >= 0 && i6 >= 0 && j3 < 104 && i6 < 104) {
  12823.                 NodeList class19_1 = groundArray[plane][j3][i6];
  12824.                 if (class19_1 != null) {
  12825.                     for (Item class30_sub2_sub4_sub2_3 = (Item) class19_1
  12826.                             .reverseGetFirst(); class30_sub2_sub4_sub2_3 != null; class30_sub2_sub4_sub2_3 = (Item) class19_1
  12827.                             .reverseGetNext()) {
  12828.                         if (class30_sub2_sub4_sub2_3.ID != (l8 & 0x7fff)
  12829.                                 || class30_sub2_sub4_sub2_3.anInt1559 != k11)
  12830.                             continue;
  12831.                         class30_sub2_sub4_sub2_3.anInt1559 = l13;
  12832.                         break;
  12833.                     }
  12834.  
  12835.                     spawnGroundItem(j3, i6);
  12836.                 }
  12837.             }
  12838.             return;
  12839.         }
  12840.         if (j == 105) {
  12841.             int l = stream.readUnsignedByte();
  12842.             int k3 = anInt1268 + (l >> 4 & 7);
  12843.             int j6 = anInt1269 + (l & 7);
  12844.             int i9 = stream.readUnsignedWord();
  12845.             int l11 = stream.readUnsignedByte();
  12846.             int i14 = l11 >> 4 & 0xf;
  12847.             int i16 = l11 & 7;
  12848.             if (myPlayer.smallX[0] >= k3 - i14
  12849.                     && myPlayer.smallX[0] <= k3 + i14
  12850.                     && myPlayer.smallY[0] >= j6 - i14
  12851.                     && myPlayer.smallY[0] <= j6 + i14 && aBoolean848 && !lowMem
  12852.                     && anInt1062 < 50) {
  12853.                 anIntArray1207[anInt1062] = i9;
  12854.                 anIntArray1241[anInt1062] = i16;
  12855.                 anIntArray1250[anInt1062] = Sounds.anIntArray326[i9];
  12856.                 anInt1062++;
  12857.             }
  12858.         }
  12859.         if (j == 215) {
  12860.             int i1 = stream.method435();
  12861.             int l3 = stream.method428();
  12862.             int k6 = anInt1268 + (l3 >> 4 & 7);
  12863.             int j9 = anInt1269 + (l3 & 7);
  12864.             int i12 = stream.method435();
  12865.             int j14 = stream.readUnsignedWord();
  12866.             if (k6 >= 0 && j9 >= 0 && k6 < 104 && j9 < 104
  12867.                     && i12 != unknownInt10) {
  12868.                 Item class30_sub2_sub4_sub2_2 = new Item();
  12869.                 class30_sub2_sub4_sub2_2.ID = i1;
  12870.                 class30_sub2_sub4_sub2_2.anInt1559 = j14;
  12871.                 if (groundArray[plane][k6][j9] == null)
  12872.                     groundArray[plane][k6][j9] = new NodeList();
  12873.                 groundArray[plane][k6][j9].insertHead(class30_sub2_sub4_sub2_2);
  12874.                 spawnGroundItem(k6, j9);
  12875.             }
  12876.             return;
  12877.         }
  12878.         if (j == 156) {
  12879.             int j1 = stream.method426();
  12880.             int i4 = anInt1268 + (j1 >> 4 & 7);
  12881.             int l6 = anInt1269 + (j1 & 7);
  12882.             int k9 = stream.readUnsignedWord();
  12883.             if (i4 >= 0 && l6 >= 0 && i4 < 104 && l6 < 104) {
  12884.                 NodeList class19 = groundArray[plane][i4][l6];
  12885.                 if (class19 != null) {
  12886.                     for (Item item = (Item) class19.reverseGetFirst(); item != null; item = (Item) class19
  12887.                             .reverseGetNext()) {
  12888.                         if (item.ID != (k9 & 0x7fff))
  12889.                             continue;
  12890.                         item.unlink();
  12891.                         break;
  12892.                     }
  12893.  
  12894.                     if (class19.reverseGetFirst() == null)
  12895.                         groundArray[plane][i4][l6] = null;
  12896.                     spawnGroundItem(i4, l6);
  12897.                 }
  12898.             }
  12899.             return;
  12900.         }
  12901.         if (j == 160) {
  12902.             int k1 = stream.method428();
  12903.             int j4 = anInt1268 + (k1 >> 4 & 7);
  12904.             int i7 = anInt1269 + (k1 & 7);
  12905.             int l9 = stream.method428();
  12906.             int j12 = l9 >> 2;
  12907.             int k14 = l9 & 3;
  12908.             int j16 = anIntArray1177[j12];
  12909.             int j17 = stream.method435();
  12910.             if (j4 >= 0 && i7 >= 0 && j4 < 103 && i7 < 103) {
  12911.                 int j18 = intGroundArray[plane][j4][i7];
  12912.                 int i19 = intGroundArray[plane][j4 + 1][i7];
  12913.                 int l19 = intGroundArray[plane][j4 + 1][i7 + 1];
  12914.                 int k20 = intGroundArray[plane][j4][i7 + 1];
  12915.                 if (j16 == 0) {
  12916.                     Object1 class10 = worldController.method296(plane, j4, i7);
  12917.                     if (class10 != null) {
  12918.                         int k21 = class10.uid >> 14 & 0x7fff;
  12919.                         if (j12 == 2) {
  12920.                             class10.aClass30_Sub2_Sub4_278 = new Animable_Sub5(
  12921.                                     k21, 4 + k14, 2, i19, l19, j18, k20, j17,
  12922.                                     false);
  12923.                             class10.aClass30_Sub2_Sub4_279 = new Animable_Sub5(
  12924.                                     k21, k14 + 1 & 3, 2, i19, l19, j18, k20,
  12925.                                     j17, false);
  12926.                         } else {
  12927.                             class10.aClass30_Sub2_Sub4_278 = new Animable_Sub5(
  12928.                                     k21, k14, j12, i19, l19, j18, k20, j17,
  12929.                                     false);
  12930.                         }
  12931.                     }
  12932.                 }
  12933.                 if (j16 == 1) {
  12934.                     Object2 class26 = worldController.method297(j4, i7, plane);
  12935.                     if (class26 != null)
  12936.                         class26.aClass30_Sub2_Sub4_504 = new Animable_Sub5(
  12937.                                 class26.uid >> 14 & 0x7fff, 0, 4, i19, l19,
  12938.                                 j18, k20, j17, false);
  12939.                 }
  12940.                 if (j16 == 2) {
  12941.                     Object5 class28 = worldController.method298(j4, i7, plane);
  12942.                     if (j12 == 11)
  12943.                         j12 = 10;
  12944.                     if (class28 != null)
  12945.                         class28.aClass30_Sub2_Sub4_521 = new Animable_Sub5(
  12946.                                 class28.uid >> 14 & 0x7fff, k14, j12, i19, l19,
  12947.                                 j18, k20, j17, false);
  12948.                 }
  12949.                 if (j16 == 3) {
  12950.                     Object3 class49 = worldController.method299(i7, j4, plane);
  12951.                     if (class49 != null)
  12952.                         class49.aClass30_Sub2_Sub4_814 = new Animable_Sub5(
  12953.                                 class49.uid >> 14 & 0x7fff, k14, 22, i19, l19,
  12954.                                 j18, k20, j17, false);
  12955.                 }
  12956.             }
  12957.             return;
  12958.         }
  12959.         if (j == 147) {
  12960.             int l1 = stream.method428();
  12961.             int k4 = anInt1268 + (l1 >> 4 & 7);
  12962.             int j7 = anInt1269 + (l1 & 7);
  12963.             int i10 = stream.readUnsignedWord();
  12964.             byte byte0 = stream.method430();
  12965.             int l14 = stream.method434();
  12966.             byte byte1 = stream.method429();
  12967.             int k17 = stream.readUnsignedWord();
  12968.             int k18 = stream.method428();
  12969.             int j19 = k18 >> 2;
  12970.             int i20 = k18 & 3;
  12971.             int l20 = anIntArray1177[j19];
  12972.             byte byte2 = stream.readSignedByte();
  12973.             int l21 = stream.readUnsignedWord();
  12974.             byte byte3 = stream.method429();
  12975.             Player player;
  12976.             if (i10 == unknownInt10)
  12977.                 player = myPlayer;
  12978.             else
  12979.                 player = playerArray[i10];
  12980.             if (player != null) {
  12981.                 ObjectDef class46 = ObjectDef.forID(l21);
  12982.                 int i22 = intGroundArray[plane][k4][j7];
  12983.                 int j22 = intGroundArray[plane][k4 + 1][j7];
  12984.                 int k22 = intGroundArray[plane][k4 + 1][j7 + 1];
  12985.                 int l22 = intGroundArray[plane][k4][j7 + 1];
  12986.                 Model model = class46.method578(j19, i20, i22, j22, k22, l22,
  12987.                         -1);
  12988.                 if (model != null) {
  12989.                     method130(k17 + 1, -1, 0, l20, j7, 0, plane, k4, l14 + 1);
  12990.                     player.anInt1707 = l14 + loopCycle;
  12991.                     player.anInt1708 = k17 + loopCycle;
  12992.                     player.aModel_1714 = model;
  12993.                     int i23 = class46.anInt744;
  12994.                     int j23 = class46.anInt761;
  12995.                     if (i20 == 1 || i20 == 3) {
  12996.                         i23 = class46.anInt761;
  12997.                         j23 = class46.anInt744;
  12998.                     }
  12999.                     player.anInt1711 = k4 * 128 + i23 * 64;
  13000.                     player.anInt1713 = j7 * 128 + j23 * 64;
  13001.                     player.anInt1712 = method42(plane, player.anInt1713,
  13002.                             player.anInt1711);
  13003.                     if (byte2 > byte0) {
  13004.                         byte byte4 = byte2;
  13005.                         byte2 = byte0;
  13006.                         byte0 = byte4;
  13007.                     }
  13008.                     if (byte3 > byte1) {
  13009.                         byte byte5 = byte3;
  13010.                         byte3 = byte1;
  13011.                         byte1 = byte5;
  13012.                     }
  13013.                     player.anInt1719 = k4 + byte2;
  13014.                     player.anInt1721 = k4 + byte0;
  13015.                     player.anInt1720 = j7 + byte3;
  13016.                     player.anInt1722 = j7 + byte1;
  13017.                 }
  13018.             }
  13019.         }
  13020.         if (j == 151) {
  13021.             int i2 = stream.method426();
  13022.             int l4 = anInt1268 + (i2 >> 4 & 7);
  13023.             int k7 = anInt1269 + (i2 & 7);
  13024.             int j10 = stream.method434();
  13025.             int k12 = stream.method428();
  13026.             int i15 = k12 >> 2;
  13027.             int k16 = k12 & 3;
  13028.             int l17 = anIntArray1177[i15];
  13029.             if (l4 >= 0 && k7 >= 0 && l4 < 104 && k7 < 104)
  13030.                 method130(-1, j10, k16, l17, k7, i15, plane, l4, 0);
  13031.             return;
  13032.         }
  13033.         if (j == 4) {
  13034.             int j2 = stream.readUnsignedByte();
  13035.             int i5 = anInt1268 + (j2 >> 4 & 7);
  13036.             int l7 = anInt1269 + (j2 & 7);
  13037.             int k10 = stream.readUnsignedWord();
  13038.             int l12 = stream.readUnsignedByte();
  13039.             int j15 = stream.readUnsignedWord();
  13040.             if (i5 >= 0 && l7 >= 0 && i5 < 104 && l7 < 104) {
  13041.                 i5 = i5 * 128 + 64;
  13042.                 l7 = l7 * 128 + 64;
  13043.                 Animable_Sub3 class30_sub2_sub4_sub3 = new Animable_Sub3(plane,
  13044.                         loopCycle, j15, k10, method42(plane, l7, i5) - l12, l7,
  13045.                         i5);
  13046.                 aClass19_1056.insertHead(class30_sub2_sub4_sub3);
  13047.             }
  13048.             return;
  13049.         }
  13050.         if (j == 44) {
  13051.             int k2 = stream.method436();
  13052.             int j5 = stream.readUnsignedWord();
  13053.             int i8 = stream.readUnsignedByte();
  13054.             int l10 = anInt1268 + (i8 >> 4 & 7);
  13055.             int i13 = anInt1269 + (i8 & 7);
  13056.             if (l10 >= 0 && i13 >= 0 && l10 < 104 && i13 < 104) {
  13057.                 Item class30_sub2_sub4_sub2_1 = new Item();
  13058.                 class30_sub2_sub4_sub2_1.ID = k2;
  13059.                 class30_sub2_sub4_sub2_1.anInt1559 = j5;
  13060.                 if (groundArray[plane][l10][i13] == null)
  13061.                     groundArray[plane][l10][i13] = new NodeList();
  13062.                 groundArray[plane][l10][i13]
  13063.                         .insertHead(class30_sub2_sub4_sub2_1);
  13064.                 spawnGroundItem(l10, i13);
  13065.             }
  13066.             return;
  13067.         }
  13068.         if (j == 101) {
  13069.             int l2 = stream.method427();
  13070.             int k5 = l2 >> 2;
  13071.             int j8 = l2 & 3;
  13072.             int i11 = anIntArray1177[k5];
  13073.             int j13 = stream.readUnsignedByte();
  13074.             int k15 = anInt1268 + (j13 >> 4 & 7);
  13075.             int l16 = anInt1269 + (j13 & 7);
  13076.             if (k15 >= 0 && l16 >= 0 && k15 < 104 && l16 < 104)
  13077.                 method130(-1, -1, j8, i11, l16, k5, plane, k15, 0);
  13078.             return;
  13079.         }
  13080.         if (j == 117) {
  13081.             int i3 = stream.readUnsignedByte();
  13082.             int l5 = anInt1268 + (i3 >> 4 & 7);
  13083.             int k8 = anInt1269 + (i3 & 7);
  13084.             int j11 = l5 + stream.readSignedByte();
  13085.             int k13 = k8 + stream.readSignedByte();
  13086.             int l15 = stream.readSignedWord();
  13087.             int i17 = stream.readUnsignedWord();
  13088.             int i18 = stream.readUnsignedByte() * 4;
  13089.             int l18 = stream.readUnsignedByte() * 4;
  13090.             int k19 = stream.readUnsignedWord();
  13091.             int j20 = stream.readUnsignedWord();
  13092.             int i21 = stream.readUnsignedByte();
  13093.             int j21 = stream.readUnsignedByte();
  13094.             if (l5 >= 0 && k8 >= 0 && l5 < 104 && k8 < 104 && j11 >= 0
  13095.                     && k13 >= 0 && j11 < 104 && k13 < 104 && i17 != 65535) {
  13096.                 l5 = l5 * 128 + 64;
  13097.                 k8 = k8 * 128 + 64;
  13098.                 j11 = j11 * 128 + 64;
  13099.                 k13 = k13 * 128 + 64;
  13100.                 Animable_Sub4 class30_sub2_sub4_sub4 = new Animable_Sub4(i21,
  13101.                         l18, k19 + loopCycle, j20 + loopCycle, j21, plane,
  13102.                         method42(plane, k8, l5) - i18, k8, l5, l15, i17);
  13103.                 class30_sub2_sub4_sub4.method455(k19 + loopCycle, k13,
  13104.                         method42(plane, k13, j11) - l18, j11);
  13105.                 aClass19_1013.insertHead(class30_sub2_sub4_sub4);
  13106.             }
  13107.         }
  13108.     }
  13109.  
  13110.     @SuppressWarnings("unused")
  13111.     private static void setLowMem() {
  13112.         WorldController.lowMem = true;
  13113.         Texture.lowMem = true;
  13114.         lowMem = true;
  13115.         ObjectManager.lowMem = true;
  13116.         ObjectDef.lowMem = true;
  13117.     }
  13118.  
  13119.     public void method139(Stream stream) {
  13120.         stream.initBitAccess();
  13121.         int k = stream.readBits(8);
  13122.         if (k < npcCount) {
  13123.             for (int l = k; l < npcCount; l++)
  13124.                 anIntArray840[anInt839++] = npcIndices[l];
  13125.  
  13126.         }
  13127.         if (k > npcCount) {
  13128.             signlink.reporterror(myUsername + " Too many npcs");
  13129.             throw new RuntimeException("eek");
  13130.         }
  13131.         npcCount = 0;
  13132.         for (int i1 = 0; i1 < k; i1++) {
  13133.             int j1 = npcIndices[i1];
  13134.             NPC npc = npcArray[j1];
  13135.             int k1 = stream.readBits(1);
  13136.             if (k1 == 0) {
  13137.                 npcIndices[npcCount++] = j1;
  13138.                 npc.anInt1537 = loopCycle;
  13139.             } else {
  13140.                 int l1 = stream.readBits(2);
  13141.                 if (l1 == 0) {
  13142.                     npcIndices[npcCount++] = j1;
  13143.                     npc.anInt1537 = loopCycle;
  13144.                     anIntArray894[anInt893++] = j1;
  13145.                 } else if (l1 == 1) {
  13146.                     npcIndices[npcCount++] = j1;
  13147.                     npc.anInt1537 = loopCycle;
  13148.                     int i2 = stream.readBits(3);
  13149.                     npc.moveInDir(false, i2);
  13150.                     int k2 = stream.readBits(1);
  13151.                     if (k2 == 1)
  13152.                         anIntArray894[anInt893++] = j1;
  13153.                 } else if (l1 == 2) {
  13154.                     npcIndices[npcCount++] = j1;
  13155.                     npc.anInt1537 = loopCycle;
  13156.                     int j2 = stream.readBits(3);
  13157.                     npc.moveInDir(true, j2);
  13158.                     int l2 = stream.readBits(3);
  13159.                     npc.moveInDir(true, l2);
  13160.                     int i3 = stream.readBits(1);
  13161.                     if (i3 == 1)
  13162.                         anIntArray894[anInt893++] = j1;
  13163.                 } else if (l1 == 3)
  13164.                     anIntArray840[anInt839++] = j1;
  13165.             }
  13166.         }
  13167.  
  13168.     }
  13169.  
  13170.     public void processLoginScreenInput() {
  13171.         if (loginScreenState == 0) {
  13172.             int i = super.myWidth / 2 - 80;
  13173.             int l = super.myHeight / 2 + 20;
  13174.             l += 20;
  13175.             if (super.clickMode3 == 1 && super.saveClickX >= i - 75
  13176.                     && super.saveClickX <= i + 75 && super.saveClickY >= l - 20
  13177.                     && super.saveClickY <= l + 20) {
  13178.                 loginScreenState = 3;
  13179.                 loginScreenCursorPos = 0;
  13180.             }
  13181.             i = super.myWidth / 2 + 80;
  13182.             if (super.clickMode3 == 1 && super.saveClickX >= i - 75
  13183.                     && super.saveClickX <= i + 75 && super.saveClickY >= l - 20
  13184.                     && super.saveClickY <= l + 20) {
  13185.                 loginMessage1 = "";
  13186.                 loginMessage2 = "Enter your username & password.";
  13187.                 loginScreenState = 2;
  13188.                 loginScreenCursorPos = 0;
  13189.             }
  13190.         } else {
  13191.             if (loginScreenState == 2) {
  13192.                 int j = super.myHeight / 2 - 40;
  13193.                 j += 30;
  13194.                 j += 25;
  13195.                 if (super.clickMode3 == 1 && super.saveClickY >= j - 15
  13196.                         && super.saveClickY < j)
  13197.                     loginScreenCursorPos = 0;
  13198.                 j += 15;
  13199.                 if (super.clickMode3 == 1 && super.saveClickY >= j - 15
  13200.                         && super.saveClickY < j)
  13201.                     loginScreenCursorPos = 1;
  13202.                 j += 15;
  13203.                 int i1 = super.myWidth / 2 - 80;
  13204.                 int k1 = super.myHeight / 2 + 50;
  13205.                 k1 += 20;
  13206.                 if (super.clickMode3 == 1 && super.saveClickX >= i1 - 75
  13207.                         && super.saveClickX <= i1 + 75
  13208.                         && super.saveClickY >= k1 - 20
  13209.                         && super.saveClickY <= k1 + 20) {
  13210.                     loginFailures = 0;
  13211.                     login(myUsername, myPassword, false);
  13212.                     if (loggedIn)
  13213.                         return;
  13214.                 }
  13215.                 i1 = super.myWidth / 2 + 80;
  13216.                 if (super.clickMode3 == 1 && super.saveClickX >= i1 - 75
  13217.                         && super.saveClickX <= i1 + 75
  13218.                         && super.saveClickY >= k1 - 20
  13219.                         && super.saveClickY <= k1 + 20) {
  13220.                     loginScreenState = 0;
  13221.                     // myUsername = "";
  13222.                     // myPassword = "";
  13223.                 }
  13224.                 do {
  13225.                     int l1 = readChar(-796);
  13226.                     if (l1 == -1)
  13227.                         break;
  13228.                     boolean flag1 = false;
  13229.                     for (int i2 = 0; i2 < validUserPassChars.length(); i2++) {
  13230.                         if (l1 != validUserPassChars.charAt(i2))
  13231.                             continue;
  13232.                         flag1 = true;
  13233.                         break;
  13234.                     }
  13235.  
  13236.                     if (loginScreenCursorPos == 0) {
  13237.                         if (l1 == 8 && myUsername.length() > 0)
  13238.                             myUsername = myUsername.substring(0,
  13239.                                     myUsername.length() - 1);
  13240.                         if (l1 == 9 || l1 == 10 || l1 == 13)
  13241.                             loginScreenCursorPos = 1;
  13242.                         if (flag1)
  13243.                             myUsername += (char) l1;
  13244.                         if (myUsername.length() > 12)
  13245.                             myUsername = myUsername.substring(0, 12);
  13246.                     } else if (loginScreenCursorPos == 1) {
  13247.                         if (l1 == 8 && myPassword.length() > 0)
  13248.                             myPassword = myPassword.substring(0,
  13249.                                     myPassword.length() - 1);
  13250.                         if (l1 == 9 || l1 == 10 || l1 == 13)
  13251.                             login(myUsername, myPassword, false);
  13252.                         if (flag1)
  13253.                             myPassword += (char) l1;
  13254.                         if (myPassword.length() > 20)
  13255.                             myPassword = myPassword.substring(0, 20);
  13256.                     }
  13257.                 } while (true);
  13258.                 return;
  13259.             }
  13260.             if (loginScreenState == 3) {
  13261.                 int k = super.myWidth / 2;
  13262.                 int j1 = super.myHeight / 2 + 50;
  13263.                 j1 += 20;
  13264.                 if (super.clickMode3 == 1 && super.saveClickX >= k - 75
  13265.                         && super.saveClickX <= k + 75
  13266.                         && super.saveClickY >= j1 - 20
  13267.                         && super.saveClickY <= j1 + 20)
  13268.                     loginScreenState = 0;
  13269.             }
  13270.         }
  13271.     }
  13272.  
  13273.     private void markMinimap(Sprite sprite, int x, int y) {
  13274.         if (sprite == null)
  13275.             return;
  13276.         try {
  13277.             int k = viewRotation + minimapRotation & 0x7ff;
  13278.             int l = x * x + y * y;
  13279.             if (l > 6400) {
  13280.                 return;
  13281.             }
  13282.             int i1 = Model.modelIntArray1[k];
  13283.             int j1 = Model.modelIntArray2[k];
  13284.             i1 = (i1 * 256) / (minimapZoom + 256);
  13285.             j1 = (j1 * 256) / (minimapZoom + 256);
  13286.             int k1 = y * i1 + x * j1 >> 16;
  13287.             int l1 = y * j1 - x * i1 >> 16;
  13288.             if (frameMode == ScreenMode.FIXED) {
  13289.                 sprite.drawSprite(((94 + k1) - sprite.maxWidth / 2) + 4 + 30, 83 - l1 - sprite.maxHeight / 2 - 4 + 5);
  13290.             } else {
  13291.                 sprite.drawSprite(((77 + k1) - sprite.maxWidth / 2) + 4 + (frameWidth - 167), 85 - l1 - sprite.maxHeight / 2 - 4);
  13292.             }
  13293.         } catch (Exception e) {
  13294.  
  13295.         }
  13296.     }
  13297.  
  13298.     public void method142(int i, int j, int k, int l, int i1, int j1, int k1) {
  13299.         if (i1 >= 1 && i >= 1 && i1 <= 102 && i <= 102) {
  13300.             if (lowMem && j != plane)
  13301.                 return;
  13302.             int i2 = 0;
  13303.             if (j1 == 0)
  13304.                 i2 = worldController.method300(j, i1, i);
  13305.             if (j1 == 1)
  13306.                 i2 = worldController.method301(j, i1, i);
  13307.             if (j1 == 2)
  13308.                 i2 = worldController.method302(j, i1, i);
  13309.             if (j1 == 3)
  13310.                 i2 = worldController.method303(j, i1, i);
  13311.             if (i2 != 0) {
  13312.                 int i3 = worldController.method304(j, i1, i, i2);
  13313.                 int j2 = i2 >> 14 & 0x7fff;
  13314.                 int k2 = i3 & 0x1f;
  13315.                 int l2 = i3 >> 6;
  13316.                 if (j1 == 0) {
  13317.                     worldController.method291(i1, j, i, (byte) -119);
  13318.                     ObjectDef class46 = ObjectDef.forID(j2);
  13319.                     if (class46.aBoolean767)
  13320.                         aClass11Array1230[j].method215(l2, k2,
  13321.                                 class46.aBoolean757, i1, i);
  13322.                 }
  13323.                 if (j1 == 1)
  13324.                     worldController.method292(i, j, i1);
  13325.                 if (j1 == 2) {
  13326.                     worldController.method293(j, i1, i);
  13327.                     ObjectDef class46_1 = ObjectDef.forID(j2);
  13328.                     if (i1 + class46_1.anInt744 > 103
  13329.                             || i + class46_1.anInt744 > 103
  13330.                             || i1 + class46_1.anInt761 > 103
  13331.                             || i + class46_1.anInt761 > 103)
  13332.                         return;
  13333.                     if (class46_1.aBoolean767)
  13334.                         aClass11Array1230[j].method216(l2, class46_1.anInt744,
  13335.                                 i1, i, class46_1.anInt761,
  13336.                                 class46_1.aBoolean757);
  13337.                 }
  13338.                 if (j1 == 3) {
  13339.                     worldController.method294(j, i, i1);
  13340.                     ObjectDef class46_2 = ObjectDef.forID(j2);
  13341.                     if (class46_2.aBoolean767 && class46_2.hasActions)
  13342.                         aClass11Array1230[j].method218(i, i1);
  13343.                 }
  13344.             }
  13345.             if (k1 >= 0) {
  13346.                 int j3 = j;
  13347.                 if (j3 < 3 && (byteGroundArray[1][i1][i] & 2) == 2)
  13348.                     j3++;
  13349.                 ObjectManager.method188(worldController, k, i, l, j3,
  13350.                         aClass11Array1230[j], intGroundArray, i1, k1, j);
  13351.             }
  13352.         }
  13353.     }
  13354.  
  13355.     public void updatePlayers(int i, Stream stream) {
  13356.         anInt839 = 0;
  13357.         anInt893 = 0;
  13358.         method117(stream);
  13359.         method134(stream);
  13360.         method91(stream, i);
  13361.         method49(stream);
  13362.         for (int k = 0; k < anInt839; k++) {
  13363.             int l = anIntArray840[k];
  13364.             if (playerArray[l].anInt1537 != loopCycle)
  13365.                 playerArray[l] = null;
  13366.         }
  13367.  
  13368.         if (stream.currentOffset != i) {
  13369.             signlink.reporterror("Error packet size mismatch in getplayer pos:"
  13370.                     + stream.currentOffset + " psize:" + i);
  13371.             throw new RuntimeException("eek");
  13372.         }
  13373.         for (int i1 = 0; i1 < playerCount; i1++)
  13374.             if (playerArray[playerIndices[i1]] == null) {
  13375.                 signlink.reporterror(myUsername
  13376.                         + " null entry in pl list - pos:" + i1 + " size:"
  13377.                         + playerCount);
  13378.                 throw new RuntimeException("eek");
  13379.             }
  13380.  
  13381.     }
  13382.  
  13383.     public void setCameraPos(int j, int k, int l, int i1, int j1, int k1) {
  13384.         int l1 = 2048 - k & 0x7ff;
  13385.         int i2 = 2048 - j1 & 0x7ff;
  13386.         int j2 = 0;
  13387.         int k2 = 0;
  13388.         int l2 = j;
  13389.         if (l1 != 0) {
  13390.             int i3 = Model.modelIntArray1[l1];
  13391.             int k3 = Model.modelIntArray2[l1];
  13392.             int i4 = k2 * k3 - l2 * i3 >> 16;
  13393.             l2 = k2 * i3 + l2 * k3 >> 16;
  13394.             k2 = i4;
  13395.         }
  13396.         if (i2 != 0) {
  13397.             /*
  13398.              * xxx if(cameratoggle){ if(zoom == 0) zoom = k2; if(lftrit == 0)
  13399.              * lftrit = j2; if(fwdbwd == 0) fwdbwd = l2; k2 = zoom; j2 = lftrit;
  13400.              * l2 = fwdbwd; }
  13401.              */
  13402.             int j3 = Model.modelIntArray1[i2];
  13403.             int l3 = Model.modelIntArray2[i2];
  13404.             int j4 = l2 * j3 + j2 * l3 >> 16;
  13405.             l2 = l2 * l3 - j2 * j3 >> 16;
  13406.             j2 = j4;
  13407.         }
  13408.         xCameraPos = l - j2;
  13409.         zCameraPos = i1 - k2;
  13410.         yCameraPos = k1 - l2;
  13411.         yCameraCurve = k;
  13412.         xCameraCurve = j1;
  13413.     }
  13414.  
  13415.     public void updateStrings(String str, int i) {
  13416.         switch (i) {
  13417.         case 1675:
  13418.             sendFrame126(str, 17508);
  13419.             break;// Stab
  13420.         case 1676:
  13421.             sendFrame126(str, 17509);
  13422.             break;// Slash
  13423.         case 1678:
  13424.             sendFrame126(str, 17511);
  13425.             break;// Magic
  13426.         case 1679:
  13427.             sendFrame126(str, 17512);
  13428.             break;// Range
  13429.         case 1680:
  13430.             sendFrame126(str, 17513);
  13431.             break;// Stab
  13432.         case 1681:
  13433.             sendFrame126(str, 17514);
  13434.             break;// Slash
  13435.         case 1682:
  13436.             sendFrame126(str, 17515);
  13437.             break;// Crush
  13438.         case 1683:
  13439.             sendFrame126(str, 17516);
  13440.             break;// Magic
  13441.         case 1684:
  13442.             sendFrame126(str, 17517);
  13443.             break;// Range
  13444.         case 1686:
  13445.             sendFrame126(str, 17518);
  13446.             break;// Strength
  13447.         case 1687:
  13448.             sendFrame126(str, 17519);
  13449.             break;// Prayer
  13450.         }
  13451.     }
  13452.  
  13453.     public void sendFrame126(String str, int i) {
  13454.         RSInterface.interfaceCache[i].message = str;
  13455.         if (RSInterface.interfaceCache[i].parentID == tabInterfaceIDs[tabID])
  13456.             needDrawTabArea = true;
  13457.     }
  13458.  
  13459.     public void sendPacket185(int button, int toggle, int type) {
  13460.         switch (type) {
  13461.         case 135:
  13462.             RSInterface class9 = RSInterface.interfaceCache[button];
  13463.             boolean flag8 = true;
  13464.             if (class9.contentType > 0)
  13465.                 flag8 = promptUserForInput(class9);
  13466.             if (flag8) {
  13467.                 stream.createFrame(185);
  13468.                 stream.writeWord(button);
  13469.             }
  13470.             break;
  13471.         case 646:
  13472.             stream.createFrame(185);
  13473.             stream.writeWord(button);
  13474.             RSInterface class9_2 = RSInterface.interfaceCache[button];
  13475.             if (class9_2.valueIndexArray != null
  13476.                     && class9_2.valueIndexArray[0][0] == 5) {
  13477.                 if (variousSettings[toggle] != class9_2.anIntArray212[0]) {
  13478.                     variousSettings[toggle] = class9_2.anIntArray212[0];
  13479.                     method33(toggle);
  13480.                     needDrawTabArea = true;
  13481.                 }
  13482.             }
  13483.             break;
  13484.         case 169:
  13485.             stream.createFrame(185);
  13486.             stream.writeWord(button);
  13487.             RSInterface class9_3 = RSInterface.interfaceCache[button];
  13488.             if (class9_3.valueIndexArray != null
  13489.                     && class9_3.valueIndexArray[0][0] == 5) {
  13490.                 variousSettings[toggle] = 1 - variousSettings[toggle];
  13491.                 method33(toggle);
  13492.                 needDrawTabArea = true;
  13493.             }
  13494.             switch (button) {
  13495.             case 19136:
  13496.                 System.out.println("toggle = " + toggle);
  13497.                 if (toggle == 0)
  13498.                     sendFrame36(173, toggle);
  13499.                 if (toggle == 1)
  13500.                     sendPacket185(153, 173, 646);
  13501.                 break;
  13502.             }
  13503.             break;
  13504.         }
  13505.     }
  13506.  
  13507.     public void sendFrame36(int id, int state) {
  13508.         anIntArray1045[id] = state;
  13509.         if (variousSettings[id] != state) {
  13510.             variousSettings[id] = state;
  13511.             method33(id);
  13512.             needDrawTabArea = true;
  13513.             if (dialogID != -1)
  13514.                 inputTaken = true;
  13515.         }
  13516.     }
  13517.  
  13518.     public void sendFrame219() {
  13519.         if (invOverlayInterfaceID != -1) {
  13520.             invOverlayInterfaceID = -1;
  13521.             needDrawTabArea = true;
  13522.             tabAreaAltered = true;
  13523.         }
  13524.         if (backDialogID != -1) {
  13525.             backDialogID = -1;
  13526.             inputTaken = true;
  13527.         }
  13528.         if (inputDialogState != 0) {
  13529.             inputDialogState = 0;
  13530.             inputTaken = true;
  13531.         }
  13532.         openInterfaceID = -1;
  13533.         aBoolean1149 = false;
  13534.     }
  13535.  
  13536.     public void sendFrame248(int interfaceID, int sideInterfaceID) {
  13537.         if (backDialogID != -1) {
  13538.             backDialogID = -1;
  13539.             inputTaken = true;
  13540.         }
  13541.         if (inputDialogState != 0) {
  13542.             inputDialogState = 0;
  13543.             inputTaken = true;
  13544.         }
  13545.         openInterfaceID = interfaceID;
  13546.         invOverlayInterfaceID = sideInterfaceID;
  13547.         needDrawTabArea = true;
  13548.         tabAreaAltered = true;
  13549.         aBoolean1149 = false;
  13550.     }
  13551.  
  13552.     private boolean parsePacket() {
  13553.         if (socketStream == null)
  13554.             return false;
  13555.         try {
  13556.             int i = socketStream.available();
  13557.             if (i == 0)
  13558.                 return false;
  13559.             if (pktType == -1) {
  13560.                 socketStream.flushInputStream(inStream.buffer, 1);
  13561.                 pktType = inStream.buffer[0] & 0xff;
  13562.                 if (encryption != null)
  13563.                     pktType = pktType - encryption.getNextKey() & 0xff;
  13564.                 pktSize = SizeConstants.packetSizes[pktType];
  13565.                 i--;
  13566.             }
  13567.             if (pktSize == -1)
  13568.                 if (i > 0) {
  13569.                     socketStream.flushInputStream(inStream.buffer, 1);
  13570.                     pktSize = inStream.buffer[0] & 0xff;
  13571.                     i--;
  13572.                 } else {
  13573.                     return false;
  13574.                 }
  13575.             if (pktSize == -2)
  13576.                 if (i > 1) {
  13577.                     socketStream.flushInputStream(inStream.buffer, 2);
  13578.                     inStream.currentOffset = 0;
  13579.                     pktSize = inStream.readUnsignedWord();
  13580.                     i -= 2;
  13581.                 } else {
  13582.                     return false;
  13583.                 }
  13584.             if (i < pktSize)
  13585.                 return false;
  13586.             inStream.currentOffset = 0;
  13587.             socketStream.flushInputStream(inStream.buffer, pktSize);
  13588.             anInt1009 = 0;
  13589.             anInt843 = anInt842;
  13590.             anInt842 = anInt841;
  13591.             anInt841 = pktType;
  13592.             switch (pktType) {
  13593.             case 81:
  13594.                 updatePlayers(pktSize, inStream);
  13595.                 aBoolean1080 = false;
  13596.                 pktType = -1;
  13597.                 return true;
  13598.  
  13599.             case 176:
  13600.                 daysSinceRecovChange = inStream.method427();
  13601.                 unreadMessages = inStream.method435();
  13602.                 membersInt = inStream.readUnsignedByte();
  13603.                 anInt1193 = inStream.method440();
  13604.                 daysSinceLastLogin = inStream.readUnsignedWord();
  13605.                 if (anInt1193 != 0 && openInterfaceID == -1) {
  13606.                     signlink.dnslookup(TextClass.method586(anInt1193));
  13607.                     clearTopInterfaces();
  13608.                     char c = '\u028A';
  13609.                     if (daysSinceRecovChange != 201 || membersInt == 1)
  13610.                         c = '\u028F';
  13611.                     reportAbuseInput = "";
  13612.                     canMute = false;
  13613.                     for (int k9 = 0; k9 < RSInterface.interfaceCache.length; k9++) {
  13614.                         if (RSInterface.interfaceCache[k9] == null
  13615.                                 || RSInterface.interfaceCache[k9].contentType != c)
  13616.                             continue;
  13617.                         openInterfaceID = RSInterface.interfaceCache[k9].parentID;
  13618.  
  13619.                     }
  13620.                 }
  13621.                 pktType = -1;
  13622.                 return true;
  13623.  
  13624.             case 64:
  13625.                 anInt1268 = inStream.method427();
  13626.                 anInt1269 = inStream.method428();
  13627.                 for (int j = anInt1268; j < anInt1268 + 8; j++) {
  13628.                     for (int l9 = anInt1269; l9 < anInt1269 + 8; l9++)
  13629.                         if (groundArray[plane][j][l9] != null) {
  13630.                             groundArray[plane][j][l9] = null;
  13631.                             spawnGroundItem(j, l9);
  13632.                         }
  13633.                 }
  13634.                 for (Class30_Sub1 class30_sub1 = (Class30_Sub1) aClass19_1179
  13635.                         .reverseGetFirst(); class30_sub1 != null; class30_sub1 = (Class30_Sub1) aClass19_1179
  13636.                         .reverseGetNext())
  13637.                     if (class30_sub1.anInt1297 >= anInt1268
  13638.                             && class30_sub1.anInt1297 < anInt1268 + 8
  13639.                             && class30_sub1.anInt1298 >= anInt1269
  13640.                             && class30_sub1.anInt1298 < anInt1269 + 8
  13641.                             && class30_sub1.anInt1295 == plane)
  13642.                         class30_sub1.anInt1294 = 0;
  13643.                 pktType = -1;
  13644.                 return true;
  13645.  
  13646.             case 185:
  13647.                 int k = inStream.method436();
  13648.                 RSInterface.interfaceCache[k].anInt233 = 3;
  13649.                 if (myPlayer.desc == null)
  13650.                     RSInterface.interfaceCache[k].mediaID = (myPlayer.anIntArray1700[0] << 25)
  13651.                             + (myPlayer.anIntArray1700[4] << 20)
  13652.                             + (myPlayer.equipment[0] << 15)
  13653.                             + (myPlayer.equipment[8] << 10)
  13654.                             + (myPlayer.equipment[11] << 5)
  13655.                             + myPlayer.equipment[1];
  13656.                 else
  13657.                     RSInterface.interfaceCache[k].mediaID = (int) (0x12345678L + myPlayer.desc.interfaceType);
  13658.                 pktType = -1;
  13659.                 return true;
  13660.  
  13661.                 /* Clan message packet */
  13662.             case 217:
  13663.                 try {
  13664.                     clanUsername = inStream.readString();
  13665.                     clanMessage = TextInput.processText(inStream.readString());
  13666.                     clanTitle = inStream.readString();
  13667.                     channelRights = inStream.readUnsignedWord();
  13668.                     pushMessage(clanMessage, 12, clanUsername);
  13669.                 } catch (Exception e) {
  13670.                     e.printStackTrace();
  13671.                 }
  13672.                 pktType = -1;
  13673.                 return true;
  13674.  
  13675.             case 107:
  13676.                 aBoolean1160 = false;
  13677.                 for (int l = 0; l < 5; l++)
  13678.                     aBooleanArray876[l] = false;
  13679.                 pktType = -1;
  13680.                 return true;
  13681.  
  13682.             case 72:
  13683.                 int i1 = inStream.method434();
  13684.                 RSInterface class9 = RSInterface.interfaceCache[i1];
  13685.                 for (int k15 = 0; k15 < class9.inv.length; k15++) {
  13686.                     class9.inv[k15] = -1;
  13687.                     class9.inv[k15] = 0;
  13688.                 }
  13689.                 pktType = -1;
  13690.                 return true;
  13691.  
  13692.             case 214:
  13693.                 ignoreCount = pktSize / 8;
  13694.                 for (int j1 = 0; j1 < ignoreCount; j1++)
  13695.                     ignoreListAsLongs[j1] = inStream.readQWord();
  13696.                 pktType = -1;
  13697.                 return true;
  13698.  
  13699.             case 166:
  13700.                 aBoolean1160 = true;
  13701.                 anInt1098 = inStream.readUnsignedByte();
  13702.                 anInt1099 = inStream.readUnsignedByte();
  13703.                 anInt1100 = inStream.readUnsignedWord();
  13704.                 anInt1101 = inStream.readUnsignedByte();
  13705.                 anInt1102 = inStream.readUnsignedByte();
  13706.                 if (anInt1102 >= 100) {
  13707.                     xCameraPos = anInt1098 * 128 + 64;
  13708.                     yCameraPos = anInt1099 * 128 + 64;
  13709.                     zCameraPos = method42(plane, yCameraPos, xCameraPos)
  13710.                             - anInt1100;
  13711.                 }
  13712.                 pktType = -1;
  13713.                 return true;
  13714.  
  13715.             case 134:
  13716.                 needDrawTabArea = true;
  13717.                 int k1 = inStream.readUnsignedByte();
  13718.                 int i10 = inStream.method439();
  13719.                 int l15 = inStream.readUnsignedByte();
  13720.                 int xp = currentExp[k1];
  13721.                 currentExp[k1] = i10;
  13722.                 currentStats[k1] = l15;
  13723.                 maxStats[k1] = 1;
  13724.                 //xpCounter += currentExp[k1] - xp;
  13725.                 //expAdded = currentExp[k1] - xp;
  13726.                 for (int k20 = 0; k20 < 98; k20++)
  13727.                     if (i10 >= anIntArray1019[k20])
  13728.                         maxStats[k1] = k20 + 2;
  13729.                 pktType = -1;
  13730.                 return true;
  13731.  
  13732.             case 71:
  13733.                 int l1 = inStream.readUnsignedWord();
  13734.                 int j10 = inStream.method426();
  13735.                 if (l1 == 65535)
  13736.                     l1 = -1;
  13737.                 tabInterfaceIDs[j10] = l1;
  13738.                 needDrawTabArea = true;
  13739.                 tabAreaAltered = true;
  13740.                 pktType = -1;
  13741.                 return true;
  13742.  
  13743.             case 74:
  13744.                 int i2 = inStream.method434();
  13745.                 if (i2 == 65535)
  13746.                     i2 = -1;
  13747.                 if (i2 != currentSong && musicEnabled && !lowMem
  13748.                         && prevSong == 0) {
  13749.                     nextSong = i2;
  13750.                     songChanging = true;
  13751.                     onDemandFetcher.method558(2, nextSong);
  13752.                 }
  13753.                 currentSong = i2;
  13754.                 pktType = -1;
  13755.                 return true;
  13756.  
  13757.             case 121:
  13758.                 int j2 = inStream.method436();
  13759.                 int k10 = inStream.method435();
  13760.                 if (musicEnabled && !lowMem) {
  13761.                     nextSong = j2;
  13762.                     songChanging = false;
  13763.                     onDemandFetcher.method558(2, nextSong);
  13764.                     prevSong = k10;
  13765.                 }
  13766.                 pktType = -1;
  13767.                 return true;
  13768.  
  13769.             case 109:
  13770.                 resetLogout();
  13771.                 pktType = -1;
  13772.                 return false;
  13773.  
  13774.             case 70:
  13775.                 int k2 = inStream.readSignedWord();
  13776.                 int l10 = inStream.method437();
  13777.                 int i16 = inStream.method434();
  13778.                 RSInterface class9_5 = RSInterface.interfaceCache[i16];
  13779.                 class9_5.anInt263 = k2;
  13780.                 class9_5.anInt265 = l10;
  13781.                 pktType = -1;
  13782.                 return true;
  13783.  
  13784.             case 73:
  13785.             case 241:
  13786.                 int l2 = anInt1069;
  13787.                 int i11 = anInt1070;
  13788.                 if (pktType == 73) {
  13789.                     l2 = inStream.method435();
  13790.                     i11 = inStream.readUnsignedWord();
  13791.                     aBoolean1159 = false;
  13792.                 }
  13793.                 if (pktType == 241) {
  13794.                     i11 = inStream.method435();
  13795.                     inStream.initBitAccess();
  13796.                     for (int j16 = 0; j16 < 4; j16++) {
  13797.                         for (int l20 = 0; l20 < 13; l20++) {
  13798.                             for (int j23 = 0; j23 < 13; j23++) {
  13799.                                 int i26 = inStream.readBits(1);
  13800.                                 if (i26 == 1)
  13801.                                     anIntArrayArrayArray1129[j16][l20][j23] = inStream
  13802.                                             .readBits(26);
  13803.                                 else
  13804.                                     anIntArrayArrayArray1129[j16][l20][j23] = -1;
  13805.                             }
  13806.                         }
  13807.                     }
  13808.                     inStream.finishBitAccess();
  13809.                     l2 = inStream.readUnsignedWord();
  13810.                     aBoolean1159 = true;
  13811.                 }
  13812.                 if (anInt1069 == l2 && anInt1070 == i11 && loadingStage == 2) {
  13813.                     pktType = -1;
  13814.                     return true;
  13815.                 }
  13816.                 anInt1069 = l2;
  13817.                 anInt1070 = i11;
  13818.                 baseX = (anInt1069 - 6) * 8;
  13819.                 baseY = (anInt1070 - 6) * 8;
  13820.                 aBoolean1141 = (anInt1069 / 8 == 48 || anInt1069 / 8 == 49)
  13821.                         && anInt1070 / 8 == 48;
  13822.                 if (anInt1069 / 8 == 48 && anInt1070 / 8 == 148)
  13823.                     aBoolean1141 = true;
  13824.                 loadingStage = 1;
  13825.                 aLong824 = System.currentTimeMillis();
  13826.                 aRSImageProducer_1165.initDrawingArea();
  13827.                 DrawingArea.fillPixels(2, 130, 22, 0xffffff, 2);
  13828.                 DrawingArea.drawPixels(20, 3, 3, 0, 128);
  13829.                 aTextDrawingArea_1271.drawText(0, "Loading - Please Wait", 18,
  13830.                         68);
  13831.                 aTextDrawingArea_1271.drawText(0xffffff,
  13832.                         "Loading - Please Wait", 17, 67);
  13833.                 aRSImageProducer_1165.drawGraphics(frameMode == ScreenMode.FIXED ? 4 : 0, super.graphics, frameMode == ScreenMode.FIXED ? 4 : 0);
  13834.                 if (pktType == 73) {
  13835.                     int k16 = 0;
  13836.                     for (int i21 = (anInt1069 - 6) / 8; i21 <= (anInt1069 + 6) / 8; i21++) {
  13837.                         for (int k23 = (anInt1070 - 6) / 8; k23 <= (anInt1070 + 6) / 8; k23++)
  13838.                             k16++;
  13839.                     }
  13840.                     aByteArrayArray1183 = new byte[k16][];
  13841.                     aByteArrayArray1247 = new byte[k16][];
  13842.                     anIntArray1234 = new int[k16];
  13843.                     anIntArray1235 = new int[k16];
  13844.                     anIntArray1236 = new int[k16];
  13845.                     k16 = 0;
  13846.                     for (int l23 = (anInt1069 - 6) / 8; l23 <= (anInt1069 + 6) / 8; l23++) {
  13847.                         for (int j26 = (anInt1070 - 6) / 8; j26 <= (anInt1070 + 6) / 8; j26++) {
  13848.                             anIntArray1234[k16] = (l23 << 8) + j26;
  13849.                             if (aBoolean1141
  13850.                                     && (j26 == 49 || j26 == 149 || j26 == 147
  13851.                                             || l23 == 50 || l23 == 49
  13852.                                             && j26 == 47)) {
  13853.                                 anIntArray1235[k16] = -1;
  13854.                                 anIntArray1236[k16] = -1;
  13855.                                 k16++;
  13856.                             } else {
  13857.                                 int k28 = anIntArray1235[k16] = onDemandFetcher
  13858.                                         .method562(0, j26, l23);
  13859.                                 if (k28 != -1)
  13860.                                     onDemandFetcher.method558(3, k28);
  13861.                                 int j30 = anIntArray1236[k16] = onDemandFetcher
  13862.                                         .method562(1, j26, l23);
  13863.                                 if (j30 != -1)
  13864.                                     onDemandFetcher.method558(3, j30);
  13865.                                 k16++;
  13866.                             }
  13867.                         }
  13868.                     }
  13869.                 }
  13870.                 if (pktType == 241) {
  13871.                     int l16 = 0;
  13872.                     int ai[] = new int[676];
  13873.                     for (int i24 = 0; i24 < 4; i24++) {
  13874.                         for (int k26 = 0; k26 < 13; k26++) {
  13875.                             for (int l28 = 0; l28 < 13; l28++) {
  13876.                                 int k30 = anIntArrayArrayArray1129[i24][k26][l28];
  13877.                                 if (k30 != -1) {
  13878.                                     int k31 = k30 >> 14 & 0x3ff;
  13879.                                     int i32 = k30 >> 3 & 0x7ff;
  13880.                                     int k32 = (k31 / 8 << 8) + i32 / 8;
  13881.                                     for (int j33 = 0; j33 < l16; j33++) {
  13882.                                         if (ai[j33] != k32)
  13883.                                             continue;
  13884.                                         k32 = -1;
  13885.  
  13886.                                     }
  13887.                                     if (k32 != -1)
  13888.                                         ai[l16++] = k32;
  13889.                                 }
  13890.                             }
  13891.                         }
  13892.                     }
  13893.                     aByteArrayArray1183 = new byte[l16][];
  13894.                     aByteArrayArray1247 = new byte[l16][];
  13895.                     anIntArray1234 = new int[l16];
  13896.                     anIntArray1235 = new int[l16];
  13897.                     anIntArray1236 = new int[l16];
  13898.                     for (int l26 = 0; l26 < l16; l26++) {
  13899.                         int i29 = anIntArray1234[l26] = ai[l26];
  13900.                         int l30 = i29 >> 8 & 0xff;
  13901.                         int l31 = i29 & 0xff;
  13902.                         int j32 = anIntArray1235[l26] = onDemandFetcher
  13903.                                 .method562(0, l31, l30);
  13904.                         if (j32 != -1)
  13905.                             onDemandFetcher.method558(3, j32);
  13906.                         int i33 = anIntArray1236[l26] = onDemandFetcher
  13907.                                 .method562(1, l31, l30);
  13908.                         if (i33 != -1)
  13909.                             onDemandFetcher.method558(3, i33);
  13910.                     }
  13911.                 }
  13912.                 int i17 = baseX - anInt1036;
  13913.                 int j21 = baseY - anInt1037;
  13914.                 anInt1036 = baseX;
  13915.                 anInt1037 = baseY;
  13916.                 for (int j24 = 0; j24 < 16384; j24++) {
  13917.                     NPC npc = npcArray[j24];
  13918.                     if (npc != null) {
  13919.                         for (int j29 = 0; j29 < 10; j29++) {
  13920.                             npc.smallX[j29] -= i17;
  13921.                             npc.smallY[j29] -= j21;
  13922.                         }
  13923.                         npc.x -= i17 * 128;
  13924.                         npc.y -= j21 * 128;
  13925.                     }
  13926.                 }
  13927.                 for (int i27 = 0; i27 < maxPlayers; i27++) {
  13928.                     Player player = playerArray[i27];
  13929.                     if (player != null) {
  13930.                         for (int i31 = 0; i31 < 10; i31++) {
  13931.                             player.smallX[i31] -= i17;
  13932.                             player.smallY[i31] -= j21;
  13933.                         }
  13934.                         player.x -= i17 * 128;
  13935.                         player.y -= j21 * 128;
  13936.                     }
  13937.                 }
  13938.                 aBoolean1080 = true;
  13939.                 byte byte1 = 0;
  13940.                 byte byte2 = 104;
  13941.                 byte byte3 = 1;
  13942.                 if (i17 < 0) {
  13943.                     byte1 = 103;
  13944.                     byte2 = -1;
  13945.                     byte3 = -1;
  13946.                 }
  13947.                 byte byte4 = 0;
  13948.                 byte byte5 = 104;
  13949.                 byte byte6 = 1;
  13950.                 if (j21 < 0) {
  13951.                     byte4 = 103;
  13952.                     byte5 = -1;
  13953.                     byte6 = -1;
  13954.                 }
  13955.                 for (int k33 = byte1; k33 != byte2; k33 += byte3) {
  13956.                     for (int l33 = byte4; l33 != byte5; l33 += byte6) {
  13957.                         int i34 = k33 + i17;
  13958.                         int j34 = l33 + j21;
  13959.                         for (int k34 = 0; k34 < 4; k34++)
  13960.                             if (i34 >= 0 && j34 >= 0 && i34 < 104 && j34 < 104)
  13961.                                 groundArray[k34][k33][l33] = groundArray[k34][i34][j34];
  13962.                             else
  13963.                                 groundArray[k34][k33][l33] = null;
  13964.                     }
  13965.                 }
  13966.                 for (Class30_Sub1 class30_sub1_1 = (Class30_Sub1) aClass19_1179
  13967.                         .reverseGetFirst(); class30_sub1_1 != null; class30_sub1_1 = (Class30_Sub1) aClass19_1179
  13968.                         .reverseGetNext()) {
  13969.                     class30_sub1_1.anInt1297 -= i17;
  13970.                     class30_sub1_1.anInt1298 -= j21;
  13971.                     if (class30_sub1_1.anInt1297 < 0
  13972.                             || class30_sub1_1.anInt1298 < 0
  13973.                             || class30_sub1_1.anInt1297 >= 104
  13974.                             || class30_sub1_1.anInt1298 >= 104)
  13975.                         class30_sub1_1.unlink();
  13976.                 }
  13977.                 if (destX != 0) {
  13978.                     destX -= i17;
  13979.                     destY -= j21;
  13980.                 }
  13981.                 aBoolean1160 = false;
  13982.                 pktType = -1;
  13983.                 return true;
  13984.  
  13985.             case 208:
  13986.                 int i3 = inStream.method437();
  13987.                 if (i3 >= 0)
  13988.                     method60(i3);
  13989.                 anInt1018 = i3;
  13990.                 pktType = -1;
  13991.                 return true;
  13992.  
  13993.             case 99:
  13994.                 /*
  13995.                  * Black map, mape state 2, causes blackness
  13996.                  */
  13997.                 anInt1021 = inStream.readUnsignedByte();
  13998.                 pktType = -1;
  13999.                 return true;
  14000.  
  14001.             case 75:
  14002.                 int j3 = inStream.method436();
  14003.                 int j11 = inStream.method436();
  14004.                 RSInterface.interfaceCache[j11].anInt233 = 2;
  14005.                 RSInterface.interfaceCache[j11].mediaID = j3;
  14006.                 pktType = -1;
  14007.                 return true;
  14008.  
  14009.             case 114:
  14010.                 anInt1104 = inStream.method434() * 30;
  14011.                 pktType = -1;
  14012.                 return true;
  14013.  
  14014.             case 60:
  14015.                 anInt1269 = inStream.readUnsignedByte();
  14016.                 anInt1268 = inStream.method427();
  14017.                 while (inStream.currentOffset < pktSize) {
  14018.                     int k3 = inStream.readUnsignedByte();
  14019.                     method137(inStream, k3);
  14020.                 }
  14021.                 pktType = -1;
  14022.                 return true;
  14023.  
  14024.             case 35:
  14025.                 int l3 = inStream.readUnsignedByte();
  14026.                 int k11 = inStream.readUnsignedByte();
  14027.                 int j17 = inStream.readUnsignedByte();
  14028.                 int k21 = inStream.readUnsignedByte();
  14029.                 aBooleanArray876[l3] = true;
  14030.                 anIntArray873[l3] = k11;
  14031.                 anIntArray1203[l3] = j17;
  14032.                 anIntArray928[l3] = k21;
  14033.                 anIntArray1030[l3] = 0;
  14034.                 pktType = -1;
  14035.                 return true;
  14036.  
  14037.             case 174:
  14038.                 int i4 = inStream.readUnsignedWord();
  14039.                 int l11 = inStream.readUnsignedByte();
  14040.                 int k17 = inStream.readUnsignedWord();
  14041.                 if (aBoolean848 && !lowMem && anInt1062 < 50) {
  14042.                     anIntArray1207[anInt1062] = i4;
  14043.                     anIntArray1241[anInt1062] = l11;
  14044.                     anIntArray1250[anInt1062] = k17 + Sounds.anIntArray326[i4];
  14045.                     anInt1062++;
  14046.                 }
  14047.                 pktType = -1;
  14048.                 return true;
  14049.  
  14050.             case 104:
  14051.                 int j4 = inStream.method427();
  14052.                 int i12 = inStream.method426();
  14053.                 String s6 = inStream.readString();
  14054.                 if (j4 >= 1 && j4 <= 5) {
  14055.                     if (s6.equalsIgnoreCase("null"))
  14056.                         s6 = null;
  14057.                     atPlayerActions[j4 - 1] = s6;
  14058.                     atPlayerArray[j4 - 1] = i12 == 0;
  14059.                 }
  14060.                 pktType = -1;
  14061.                 return true;
  14062.  
  14063.             case 78:
  14064.                 destX = 0;
  14065.                 pktType = -1;
  14066.                 return true;
  14067.  
  14068.             case 253:
  14069.                 String s = inStream.readString();
  14070.                 if (s.endsWith(":tradereq:")) {
  14071.                     String s3 = s.substring(0, s.indexOf(":"));
  14072.                     long l17 = TextClass.longForName(s3);
  14073.                     boolean flag2 = false;
  14074.                     for (int j27 = 0; j27 < ignoreCount; j27++) {
  14075.                         if (ignoreListAsLongs[j27] != l17)
  14076.                             continue;
  14077.                         flag2 = true;
  14078.                     }
  14079.                     if (!flag2 && anInt1251 == 0)
  14080.                         pushMessage("wishes to trade with you.", 4, s3);
  14081.                 } else if (s.endsWith(":clan:")) {
  14082.                     String s4 = s.substring(0, s.indexOf(":"));
  14083.                     TextClass.longForName(s4);
  14084.                     pushMessage("Clan: ", 8, s4);
  14085.                 } else if (s.endsWith("#url#")) {
  14086.                     String link = s.substring(0, s.indexOf("#"));
  14087.                     pushMessage("Join us at: ", 9, link);
  14088.                 } else if (s.endsWith(":duelreq:")) {
  14089.                     String s4 = s.substring(0, s.indexOf(":"));
  14090.                     long l18 = TextClass.longForName(s4);
  14091.                     boolean flag3 = false;
  14092.                     for (int k27 = 0; k27 < ignoreCount; k27++) {
  14093.                         if (ignoreListAsLongs[k27] != l18)
  14094.                             continue;
  14095.                         flag3 = true;
  14096.  
  14097.                     }
  14098.                     if (!flag3 && anInt1251 == 0)
  14099.                         pushMessage("wishes to duel with you.", 8, s4);
  14100.                 } else if (s.endsWith(":chalreq:")) {
  14101.                     String s5 = s.substring(0, s.indexOf(":"));
  14102.                     long l19 = TextClass.longForName(s5);
  14103.                     boolean flag4 = false;
  14104.                     for (int l27 = 0; l27 < ignoreCount; l27++) {
  14105.                         if (ignoreListAsLongs[l27] != l19)
  14106.                             continue;
  14107.                         flag4 = true;
  14108.  
  14109.                     }
  14110.                     if (!flag4 && anInt1251 == 0) {
  14111.                         String s8 = s.substring(s.indexOf(":") + 1,
  14112.                                 s.length() - 9);
  14113.                         pushMessage(s8, 8, s5);
  14114.                     }
  14115.                 } else {
  14116.                     pushMessage(s, 0, "");
  14117.                 }
  14118.                 pktType = -1;
  14119.                 return true;
  14120.  
  14121.             case 1:
  14122.                 for (int k4 = 0; k4 < playerArray.length; k4++)
  14123.                     if (playerArray[k4] != null)
  14124.                         playerArray[k4].anim = -1;
  14125.                 for (int j12 = 0; j12 < npcArray.length; j12++)
  14126.                     if (npcArray[j12] != null)
  14127.                         npcArray[j12].anim = -1;
  14128.                 pktType = -1;
  14129.                 return true;
  14130.  
  14131.             case 50:
  14132.                 long l4 = inStream.readQWord();
  14133.                 int i18 = inStream.readUnsignedByte();
  14134.                 String s7 = TextClass.fixName(TextClass.nameForLong(l4));
  14135.                 for (int k24 = 0; k24 < friendsCount; k24++) {
  14136.                     if (l4 != friendsListAsLongs[k24])
  14137.                         continue;
  14138.                     if (friendsNodeIDs[k24] != i18) {
  14139.                         friendsNodeIDs[k24] = i18;
  14140.                         needDrawTabArea = true;
  14141.                         if (i18 >= 2) {
  14142.                             pushMessage(s7 + " has logged in.", 5, "");
  14143.                         }
  14144.                         if (i18 <= 1) {
  14145.                             pushMessage(s7 + " has logged out.", 5, "");
  14146.                         }
  14147.                     }
  14148.                     s7 = null;
  14149.  
  14150.                 }
  14151.                 if (s7 != null && friendsCount < 200) {
  14152.                     friendsListAsLongs[friendsCount] = l4;
  14153.                     friendsList[friendsCount] = s7;
  14154.                     friendsNodeIDs[friendsCount] = i18;
  14155.                     friendsCount++;
  14156.                     needDrawTabArea = true;
  14157.                 }
  14158.                 for (boolean flag6 = false; !flag6;) {
  14159.                     flag6 = true;
  14160.                     for (int k29 = 0; k29 < friendsCount - 1; k29++)
  14161.                         if (friendsNodeIDs[k29] != nodeID
  14162.                                 && friendsNodeIDs[k29 + 1] == nodeID
  14163.                                 || friendsNodeIDs[k29] == 0
  14164.                                 && friendsNodeIDs[k29 + 1] != 0) {
  14165.                             int j31 = friendsNodeIDs[k29];
  14166.                             friendsNodeIDs[k29] = friendsNodeIDs[k29 + 1];
  14167.                             friendsNodeIDs[k29 + 1] = j31;
  14168.                             String s10 = friendsList[k29];
  14169.                             friendsList[k29] = friendsList[k29 + 1];
  14170.                             friendsList[k29 + 1] = s10;
  14171.                             long l32 = friendsListAsLongs[k29];
  14172.                             friendsListAsLongs[k29] = friendsListAsLongs[k29 + 1];
  14173.                             friendsListAsLongs[k29 + 1] = l32;
  14174.                             needDrawTabArea = true;
  14175.                             flag6 = false;
  14176.                         }
  14177.                 }
  14178.                 pktType = -1;
  14179.                 return true;
  14180.  
  14181.             case 110:
  14182.                 if (tabID == 12)
  14183.                     needDrawTabArea = true;
  14184.                 energy = inStream.readUnsignedByte();
  14185.                 pktType = -1;
  14186.                 return true;
  14187.  
  14188.             case 254:
  14189.                 anInt855 = inStream.readUnsignedByte();
  14190.                 if (anInt855 == 1)
  14191.                     anInt1222 = inStream.readUnsignedWord();
  14192.                 if (anInt855 >= 2 && anInt855 <= 6) {
  14193.                     if (anInt855 == 2) {
  14194.                         anInt937 = 64;
  14195.                         anInt938 = 64;
  14196.                     }
  14197.                     if (anInt855 == 3) {
  14198.                         anInt937 = 0;
  14199.                         anInt938 = 64;
  14200.                     }
  14201.                     if (anInt855 == 4) {
  14202.                         anInt937 = 128;
  14203.                         anInt938 = 64;
  14204.                     }
  14205.                     if (anInt855 == 5) {
  14206.                         anInt937 = 64;
  14207.                         anInt938 = 0;
  14208.                     }
  14209.                     if (anInt855 == 6) {
  14210.                         anInt937 = 64;
  14211.                         anInt938 = 128;
  14212.                     }
  14213.                     anInt855 = 2;
  14214.                     anInt934 = inStream.readUnsignedWord();
  14215.                     anInt935 = inStream.readUnsignedWord();
  14216.                     anInt936 = inStream.readUnsignedByte();
  14217.                 }
  14218.                 if (anInt855 == 10)
  14219.                     anInt933 = inStream.readUnsignedWord();
  14220.                 pktType = -1;
  14221.                 return true;
  14222.  
  14223.             case 248:
  14224.                 int i5 = inStream.method435();
  14225.                 int k12 = inStream.readUnsignedWord();
  14226.                 if (backDialogID != -1) {
  14227.                     backDialogID = -1;
  14228.                     inputTaken = true;
  14229.                 }
  14230.                 if (inputDialogState != 0) {
  14231.                     inputDialogState = 0;
  14232.                     inputTaken = true;
  14233.                 }
  14234.                 openInterfaceID = i5;
  14235.                 invOverlayInterfaceID = k12;
  14236.                 needDrawTabArea = true;
  14237.                 tabAreaAltered = true;
  14238.                 aBoolean1149 = false;
  14239.                 pktType = -1;
  14240.                 return true;
  14241.  
  14242.             case 79:
  14243.                 int j5 = inStream.method434();
  14244.                 int l12 = inStream.method435();
  14245.                 RSInterface class9_3 = RSInterface.interfaceCache[j5];
  14246.                 if (class9_3 != null && class9_3.type == 0) {
  14247.                     if (l12 < 0)
  14248.                         l12 = 0;
  14249.                     if (l12 > class9_3.scrollMax - class9_3.height)
  14250.                         l12 = class9_3.scrollMax - class9_3.height;
  14251.                     class9_3.scrollPosition = l12;
  14252.                 }
  14253.                 pktType = -1;
  14254.                 return true;
  14255.  
  14256.             case 68:
  14257.                 for (int k5 = 0; k5 < variousSettings.length; k5++)
  14258.                     if (variousSettings[k5] != anIntArray1045[k5]) {
  14259.                         variousSettings[k5] = anIntArray1045[k5];
  14260.                         method33(k5);
  14261.                         needDrawTabArea = true;
  14262.                     }
  14263.                 pktType = -1;
  14264.                 return true;
  14265.  
  14266.             case 196:
  14267.                 long l5 = inStream.readQWord();
  14268.                 inStream.readDWord();
  14269.                 int l21 = inStream.readUnsignedByte();
  14270.                 boolean flag5 = false;
  14271.                 if (l21 <= 1) {
  14272.                     for (int l29 = 0; l29 < ignoreCount; l29++) {
  14273.                         if (ignoreListAsLongs[l29] != l5)
  14274.                             continue;
  14275.                         flag5 = true;
  14276.  
  14277.                     }
  14278.                 }
  14279.                 if (!flag5 && anInt1251 == 0)
  14280.                     try {
  14281.                         String s9 = TextInput.method525(pktSize - 13, inStream);
  14282.                         switch (l21) {
  14283.                         case 1:
  14284.                             pushMessage(s9, 7, "@cr1@" + TextClass.fixName(TextClass.nameForLong(l5)));
  14285.                             break;
  14286.                         case 2:
  14287.                             pushMessage(s9, 7, "@cr2@" + TextClass.fixName(TextClass.nameForLong(l5)));
  14288.                             break;
  14289.                         case 3:
  14290.                             pushMessage(s9, 7, "@cr3@" + TextClass.fixName(TextClass.nameForLong(l5)));
  14291.                             break;
  14292.                         case 4:
  14293.                             pushMessage(s9, 7, "@cr4@" + TextClass.fixName(TextClass.nameForLong(l5)));
  14294.                             break;
  14295.                         case 5:
  14296.                             pushMessage(s9, 7, "@cr5@" + TextClass.fixName(TextClass.nameForLong(l5)));
  14297.                             break;
  14298.                         case 6:
  14299.                             pushMessage(s9, 7, "@cr6@" + TextClass.fixName(TextClass.nameForLong(l5)));
  14300.                             break;
  14301.                         case 7:
  14302.                             pushMessage(s9, 7, "@cr7@" + TextClass.fixName(TextClass.nameForLong(l5)));
  14303.                             break;
  14304.                         case 8:
  14305.                             pushMessage(s9, 7, "@cr8@" + TextClass.fixName(TextClass.nameForLong(l5)));
  14306.                             break;
  14307.                         case 9:
  14308.                             pushMessage(s9, 7, "@cr9@" + TextClass.fixName(TextClass.nameForLong(l5)));
  14309.                             break;
  14310.                         case 10:
  14311.                             pushMessage(s9, 7, "@cr10@" + TextClass.fixName(TextClass.nameForLong(l5)));
  14312.                             break;
  14313.                         case 11:
  14314.                             pushMessage(s9, 7, "@cr11@" + TextClass.fixName(TextClass.nameForLong(l5)));
  14315.                             break;
  14316.                         case 12:
  14317.                             pushMessage(s9, 7, "@cr12@" + TextClass.fixName(TextClass.nameForLong(l5)));
  14318.                             break;
  14319.                         case 13:
  14320.                             pushMessage(s9, 7, "@cr13@" + TextClass.fixName(TextClass.nameForLong(l5)));
  14321.                             break;
  14322.                         case 14:
  14323.                             pushMessage(s9, 7, "@cr14@" + TextClass.fixName(TextClass.nameForLong(l5)));
  14324.                             break;
  14325.                         case 15:
  14326.                             pushMessage(s9, 7, "@cr15@" + TextClass.fixName(TextClass.nameForLong(l5)));
  14327.                             break;
  14328.                         case 16:
  14329.                             pushMessage(s9, 7, "@cr16@" + TextClass.fixName(TextClass.nameForLong(l5)));
  14330.                             break;
  14331.                         case 17:
  14332.                             pushMessage(s9, 7, "@cr17@" + TextClass.fixName(TextClass.nameForLong(l5)));
  14333.                             break;
  14334.                         case 18:
  14335.                             pushMessage(s9, 7, "@cr18@" + TextClass.fixName(TextClass.nameForLong(l5)));
  14336.                             break;
  14337.                         case 19:
  14338.                             pushMessage(s9, 7, "@cr19@" + TextClass.fixName(TextClass.nameForLong(l5)));
  14339.                             break;
  14340.                         case 20:
  14341.                             pushMessage(s9, 7, "@cr20@" + TextClass.fixName(TextClass.nameForLong(l5)));
  14342.                             break;
  14343.                         case 21:
  14344.                             pushMessage(s9, 7, "@cr21@" + TextClass.fixName(TextClass.nameForLong(l5)));
  14345.                             break;
  14346.                         case 22:
  14347.                             pushMessage(s9, 7, "@cr22@" + TextClass.fixName(TextClass.nameForLong(l5)));
  14348.                             break;
  14349.                         case 23:
  14350.                             pushMessage(s9, 7, "@cr23@" + TextClass.fixName(TextClass.nameForLong(l5)));
  14351.                             break;
  14352.                         case 24:
  14353.                             pushMessage(s9, 7, "@cr24@" + TextClass.fixName(TextClass.nameForLong(l5)));
  14354.                             break;
  14355.                         case 25:
  14356.                             pushMessage(s9, 7, "@cr25@" + TextClass.fixName(TextClass.nameForLong(l5)));
  14357.                             break;
  14358.                         case 26:
  14359.                             pushMessage(s9, 7, "@cr26@" + TextClass.fixName(TextClass.nameForLong(l5)));
  14360.                             break;
  14361.                         case 27:
  14362.                             pushMessage(s9, 7, "@cr27@" + TextClass.fixName(TextClass.nameForLong(l5)));
  14363.                             break;
  14364.                         case 28:
  14365.                             pushMessage(s9, 7, "@cr28@" + TextClass.fixName(TextClass.nameForLong(l5)));
  14366.                             break;
  14367.                         case 29:
  14368.                             pushMessage(s9, 7, "@cr29@" + TextClass.fixName(TextClass.nameForLong(l5)));
  14369.                             break;
  14370.                         default:
  14371.                             pushMessage(s9, 3, TextClass.fixName(TextClass.nameForLong(l5)));
  14372.                         }
  14373.                     } catch (Exception exception1) {
  14374.                         signlink.reporterror("cde1");
  14375.                     }
  14376.                 pktType = -1;
  14377.                 return true;
  14378.  
  14379.             case 85:
  14380.                 anInt1269 = inStream.method427();
  14381.                 anInt1268 = inStream.method427();
  14382.                 pktType = -1;
  14383.                 return true;
  14384.  
  14385.             case 24:
  14386.                 anInt1054 = inStream.method428();
  14387.                 if (anInt1054 == tabID) {
  14388.                     if (anInt1054 == 3)
  14389.                         tabID = 1;
  14390.                     else
  14391.                         tabID = 3;
  14392.                     needDrawTabArea = true;
  14393.                 }
  14394.                 pktType = -1;
  14395.                 return true;
  14396.  
  14397.             case 246:
  14398.                 int i6 = inStream.method434();
  14399.                 int i13 = inStream.readUnsignedWord();
  14400.                 int k18 = inStream.readUnsignedWord();
  14401.                 if (k18 == 65535) {
  14402.                     RSInterface.interfaceCache[i6].anInt233 = 0;
  14403.                     pktType = -1;
  14404.                     return true;
  14405.                 } else {
  14406.                     ItemDef itemDef = ItemDef.forID(k18);
  14407.                     RSInterface.interfaceCache[i6].anInt233 = 4;
  14408.                     RSInterface.interfaceCache[i6].mediaID = k18;
  14409.                     RSInterface.interfaceCache[i6].modelRotation1 = itemDef.modelRotationY;
  14410.                     RSInterface.interfaceCache[i6].modelRotation2 = itemDef.modelRotationX;
  14411.                     RSInterface.interfaceCache[i6].modelZoom = (itemDef.modelZoom * 100)
  14412.                             / i13;
  14413.                     pktType = -1;
  14414.                     return true;
  14415.                 }
  14416.  
  14417.             case 171:
  14418.                 boolean flag1 = inStream.readUnsignedByte() == 1;
  14419.                 int j13 = inStream.readUnsignedWord();
  14420.                 RSInterface.interfaceCache[j13].isMouseoverTriggered = flag1;
  14421.                 pktType = -1;
  14422.                 return true;
  14423.  
  14424.             case 142:
  14425.                 int j6 = inStream.method434();
  14426.                 method60(j6);
  14427.                 if (backDialogID != -1) {
  14428.                     backDialogID = -1;
  14429.                     inputTaken = true;
  14430.                 }
  14431.                 if (inputDialogState != 0) {
  14432.                     inputDialogState = 0;
  14433.                     inputTaken = true;
  14434.                 }
  14435.                 invOverlayInterfaceID = j6;
  14436.                 needDrawTabArea = true;
  14437.                 tabAreaAltered = true;
  14438.                 openInterfaceID = -1;
  14439.                 aBoolean1149 = false;
  14440.                 pktType = -1;
  14441.                 return true;
  14442.  
  14443.             /*case 126:
  14444.                 try {
  14445.                     String text = inStream.readString();
  14446.                     int frame = inStream.method435();
  14447.                     if (text.startsWith("www.")) {
  14448.                         launchURL(text);
  14449.                         pktType = -1;
  14450.                         return true;
  14451.                     }
  14452.                     RSInterface.interfaceCache[frame].message = text;
  14453.                     if (RSInterface.interfaceCache[frame].parentID == tabInterfaceIDs[tabID]
  14454.                             || frame >= 7562 && frame <= 7586)
  14455.                         needDrawTabArea = true;
  14456.                     pktType = -1;
  14457.                 } catch (Exception e) {
  14458.                 }
  14459.                 pktType = -1;
  14460.                 return true;*/
  14461.                
  14462.             case 126:
  14463.                 String text = inStream.readString();
  14464.                 int frame = inStream.method435();
  14465.                 if (text.startsWith("www.")) {
  14466.                     launchURL(text);
  14467.                     pktType = -1;
  14468.                     return true;
  14469.                 }
  14470.                 updateStrings(text, frame);
  14471.                 sendFrame126(text, frame);
  14472.                 if (frame >= 18144 && frame <= 18244) {
  14473.                     clanList[frame - 18144] = text;
  14474.                 }
  14475.                 pktType = -1;
  14476.                 return true;
  14477.                
  14478.             case 206:
  14479.                 publicChatMode = inStream.readUnsignedByte();
  14480.                 privateChatMode = inStream.readUnsignedByte();
  14481.                 tradeMode = inStream.readUnsignedByte();
  14482.                 inputTaken = true;
  14483.                 pktType = -1;
  14484.                 return true;
  14485.  
  14486.             case 240:
  14487.                 if (tabID == 12)
  14488.                     needDrawTabArea = true;
  14489.                 weight = inStream.readSignedWord();
  14490.                 pktType = -1;
  14491.                 return true;
  14492.  
  14493.             case 8:
  14494.                 int k6 = inStream.method436();
  14495.                 int l13 = inStream.readUnsignedWord();
  14496.                 RSInterface.interfaceCache[k6].anInt233 = 1;
  14497.                 RSInterface.interfaceCache[k6].mediaID = l13;
  14498.                 pktType = -1;
  14499.                 return true;
  14500.  
  14501.             case 122:
  14502.                 int l6 = inStream.method436();
  14503.                 int i14 = inStream.method436();
  14504.                 int i19 = i14 >> 10 & 0x1f;
  14505.                 int i22 = i14 >> 5 & 0x1f;
  14506.                 int l24 = i14 & 0x1f;
  14507.                 RSInterface.interfaceCache[l6].textColor = (i19 << 19)
  14508.                         + (i22 << 11) + (l24 << 3);
  14509.                 pktType = -1;
  14510.                 return true;
  14511.  
  14512.             case 53:
  14513.                 needDrawTabArea = true;
  14514.                 int i7 = inStream.readUnsignedWord();
  14515.                 RSInterface class9_1 = RSInterface.interfaceCache[i7];
  14516.                 int j19 = inStream.readUnsignedWord();
  14517.                 for (int j22 = 0; j22 < j19; j22++) {
  14518.                     int i25 = inStream.readUnsignedByte();
  14519.                     if (i25 == 255)
  14520.                         i25 = inStream.method440();
  14521.                     class9_1.inv[j22] = inStream.method436();
  14522.                     class9_1.invStackSizes[j22] = i25;
  14523.                 }
  14524.                 for (int j25 = j19; j25 < class9_1.inv.length; j25++) {
  14525.                     class9_1.inv[j25] = 0;
  14526.                     class9_1.invStackSizes[j25] = 0;
  14527.                 }
  14528.                 pktType = -1;
  14529.                 return true;
  14530.  
  14531.             case 230:
  14532.                 int j7 = inStream.method435();
  14533.                 int j14 = inStream.readUnsignedWord();
  14534.                 int k19 = inStream.readUnsignedWord();
  14535.                 int k22 = inStream.method436();
  14536.                 RSInterface.interfaceCache[j14].modelRotation1 = k19;
  14537.                 RSInterface.interfaceCache[j14].modelRotation2 = k22;
  14538.                 RSInterface.interfaceCache[j14].modelZoom = j7;
  14539.                 pktType = -1;
  14540.                 return true;
  14541.  
  14542.             case 221:
  14543.                 anInt900 = inStream.readUnsignedByte();
  14544.                 needDrawTabArea = true;
  14545.                 pktType = -1;
  14546.                 return true;
  14547.  
  14548.             case 177:
  14549.                 aBoolean1160 = true;
  14550.                 anInt995 = inStream.readUnsignedByte();
  14551.                 anInt996 = inStream.readUnsignedByte();
  14552.                 anInt997 = inStream.readUnsignedWord();
  14553.                 anInt998 = inStream.readUnsignedByte();
  14554.                 anInt999 = inStream.readUnsignedByte();
  14555.                 if (anInt999 >= 100) {
  14556.                     int k7 = anInt995 * 128 + 64;
  14557.                     int k14 = anInt996 * 128 + 64;
  14558.                     int i20 = method42(plane, k14, k7) - anInt997;
  14559.                     int l22 = k7 - xCameraPos;
  14560.                     int k25 = i20 - zCameraPos;
  14561.                     int j28 = k14 - yCameraPos;
  14562.                     int i30 = (int) Math.sqrt(l22 * l22 + j28 * j28);
  14563.                     yCameraCurve = (int) (Math.atan2(k25, i30) * 325.94900000000001D) & 0x7ff;
  14564.                     xCameraCurve = (int) (Math.atan2(l22, j28) * -325.94900000000001D) & 0x7ff;
  14565.                     if (yCameraCurve < 128)
  14566.                         yCameraCurve = 128;
  14567.                     if (yCameraCurve > 383)
  14568.                         yCameraCurve = 383;
  14569.                 }
  14570.                 pktType = -1;
  14571.                 return true;
  14572.  
  14573.             case 249:
  14574.                 anInt1046 = inStream.method426();
  14575.                 unknownInt10 = inStream.method436();
  14576.                 pktType = -1;
  14577.                 return true;
  14578.  
  14579.             case 65:
  14580.                 updateNPCs(inStream, pktSize);
  14581.                 pktType = -1;
  14582.                 return true;
  14583.  
  14584.             case 27:
  14585.                 messagePromptRaised = false;
  14586.                 inputDialogState = 1;
  14587.                 amountOrNameInput = "";
  14588.                 inputTaken = true;
  14589.                 pktType = -1;
  14590.                 return true;
  14591.  
  14592.             case 187:
  14593.                 messagePromptRaised = false;
  14594.                 inputDialogState = 2;
  14595.                 amountOrNameInput = "";
  14596.                 inputTaken = true;
  14597.                 pktType = -1;
  14598.                 return true;
  14599.  
  14600.             case 97:
  14601.                 int l7 = inStream.readUnsignedWord();
  14602.                 method60(l7);
  14603.                 if (invOverlayInterfaceID != -1) {
  14604.                     invOverlayInterfaceID = -1;
  14605.                     needDrawTabArea = true;
  14606.                     tabAreaAltered = true;
  14607.                 }
  14608.                 if (backDialogID != -1) {
  14609.                     backDialogID = -1;
  14610.                     inputTaken = true;
  14611.                 }
  14612.                 if (inputDialogState != 0) {
  14613.                     inputDialogState = 0;
  14614.                     inputTaken = true;
  14615.                 }
  14616.                 // 17511 = Question Type
  14617.                 // 15819 = Christmas Type
  14618.                 // 15812 = Security Type
  14619.                 // 15801 = Item Scam Type
  14620.                 // 15791 = Password Safety ?
  14621.                 // 15774 = Good/Bad Password
  14622.                 // 15767 = Drama Type ????
  14623.                 if (l7 == 15244) {
  14624.                     openInterfaceID = 15767;
  14625.                     fullscreenInterfaceID = 15244;
  14626.                 } else {
  14627.                     openInterfaceID = l7;
  14628.                 }
  14629.                 aBoolean1149 = false;
  14630.                 pktType = -1;
  14631.                 return true;
  14632.  
  14633.             case 218:
  14634.                 int i8 = inStream.method438();
  14635.                 dialogID = i8;
  14636.                 inputTaken = true;
  14637.                 pktType = -1;
  14638.                 return true;
  14639.  
  14640.             case 87:
  14641.                 int j8 = inStream.method434();
  14642.                 int l14 = inStream.method439();
  14643.                 anIntArray1045[j8] = l14;
  14644.                 if (variousSettings[j8] != l14) {
  14645.                     variousSettings[j8] = l14;
  14646.                     method33(j8);
  14647.                     needDrawTabArea = true;
  14648.                     if (dialogID != -1)
  14649.                         inputTaken = true;
  14650.                 }
  14651.                 pktType = -1;
  14652.                 return true;
  14653.  
  14654.             case 36:
  14655.                 int k8 = inStream.method434();
  14656.                 byte byte0 = inStream.readSignedByte();
  14657.                 anIntArray1045[k8] = byte0;
  14658.                 if (variousSettings[k8] != byte0) {
  14659.                     variousSettings[k8] = byte0;
  14660.                     method33(k8);
  14661.                     needDrawTabArea = true;
  14662.                     if (dialogID != -1)
  14663.                         inputTaken = true;
  14664.                 }
  14665.                 pktType = -1;
  14666.                 return true;
  14667.  
  14668.             case 61:
  14669.                 anInt1055 = inStream.readUnsignedByte();
  14670.                 pktType = -1;
  14671.                 return true;
  14672.  
  14673.             case 200:
  14674.                 int l8 = inStream.readUnsignedWord();
  14675.                 int i15 = inStream.readSignedWord();
  14676.                 RSInterface class9_4 = RSInterface.interfaceCache[l8];
  14677.                 class9_4.anInt257 = i15;
  14678.                 if (i15 == 591 || i15 == 588) {
  14679.                     class9_4.modelZoom = 900; // anInt269
  14680.                 }
  14681.                 if (i15 == -1) {
  14682.                     class9_4.anInt246 = 0;
  14683.                     class9_4.anInt208 = 0;
  14684.                 }
  14685.                 pktType = -1;
  14686.                 return true;
  14687.  
  14688.             case 219:
  14689.                 if (invOverlayInterfaceID != -1) {
  14690.                     invOverlayInterfaceID = -1;
  14691.                     needDrawTabArea = true;
  14692.                     tabAreaAltered = true;
  14693.                 }
  14694.                 if (backDialogID != -1) {
  14695.                     backDialogID = -1;
  14696.                     inputTaken = true;
  14697.                 }
  14698.                 if (inputDialogState != 0) {
  14699.                     inputDialogState = 0;
  14700.                     inputTaken = true;
  14701.                 }
  14702.                 openInterfaceID = -1;
  14703.                 aBoolean1149 = false;
  14704.                 pktType = -1;
  14705.                 return true;
  14706.  
  14707.             case 34:
  14708.                 needDrawTabArea = true;
  14709.                 int i9 = inStream.readUnsignedWord();
  14710.                 RSInterface class9_2 = RSInterface.interfaceCache[i9];
  14711.                 while (inStream.currentOffset < pktSize) {
  14712.                     int j20 = inStream.method422();
  14713.                     int i23 = inStream.readUnsignedWord();
  14714.                     int l25 = inStream.readUnsignedByte();
  14715.                     if (l25 == 255)
  14716.                         l25 = inStream.readDWord();
  14717.                     if (j20 >= 0 && j20 < class9_2.inv.length) {
  14718.                         class9_2.inv[j20] = i23;
  14719.                         class9_2.invStackSizes[j20] = l25;
  14720.                     }
  14721.                 }
  14722.                 pktType = -1;
  14723.                 return true;
  14724.  
  14725.             case 4:
  14726.             case 44:
  14727.             case 84:
  14728.             case 101:
  14729.             case 105:
  14730.             case 117:
  14731.             case 147:
  14732.             case 151:
  14733.             case 156:
  14734.             case 160:
  14735.             case 215:
  14736.                 method137(inStream, pktType);
  14737.                 pktType = -1;
  14738.                 return true;
  14739.  
  14740.             case 106:
  14741.                 tabID = inStream.method427();
  14742.                 needDrawTabArea = true;
  14743.                 tabAreaAltered = true;
  14744.                 pktType = -1;
  14745.                 return true;
  14746.  
  14747.             case 164:
  14748.                 int j9 = inStream.method434();
  14749.                 method60(j9);
  14750.                 if (invOverlayInterfaceID != -1) {
  14751.                     invOverlayInterfaceID = -1;
  14752.                     needDrawTabArea = true;
  14753.                     tabAreaAltered = true;
  14754.                 }
  14755.                 backDialogID = j9;
  14756.                 inputTaken = true;
  14757.                 openInterfaceID = -1;
  14758.                 aBoolean1149 = false;
  14759.                 pktType = -1;
  14760.                 return true;
  14761.  
  14762.             }
  14763.             signlink.reporterror("T1 - " + pktType + "," + pktSize + " - "
  14764.                     + anInt842 + "," + anInt843);
  14765.             resetLogout();
  14766.         } catch (IOException _ex) {
  14767.             dropClient();
  14768.         } catch (Exception exception) {
  14769.             String s2 = "T2 - " + pktType + "," + anInt842 + "," + anInt843
  14770.                     + " - " + pktSize + "," + (baseX + myPlayer.smallX[0])
  14771.                     + "," + (baseY + myPlayer.smallY[0]) + " - ";
  14772.             for (int j15 = 0; j15 < pktSize && j15 < 50; j15++)
  14773.                 s2 = s2 + inStream.buffer[j15] + ",";
  14774.             signlink.reporterror(s2);
  14775.             resetLogout();
  14776.         }
  14777.         return true;
  14778.     }
  14779.  
  14780.     public void method146() {
  14781.         anInt1265++;
  14782.         method47(true);
  14783.         method26(true);
  14784.         method47(false);
  14785.         method26(false);
  14786.         method55();
  14787.         method104();
  14788.         if (!aBoolean1160) {
  14789.             int i = anInt1184;
  14790.             if (anInt984 / 256 > i)
  14791.                 i = anInt984 / 256;
  14792.             if (aBooleanArray876[4] && anIntArray1203[4] + 128 > i)
  14793.                 i = anIntArray1203[4] + 128;
  14794.             int k = viewRotation + viewRotationOffset & 0x7ff;
  14795.             setCameraPos(cameraZoom + i * ((WorldController.viewDistance == 9) && (frameMode == ScreenMode.RESIZABLE) ? 2 : WorldController.viewDistance == 10 ? 5 : 3), i, anInt1014,
  14796.                     method42(plane, myPlayer.y, myPlayer.x) - 50, k, anInt1015);
  14797.         }
  14798.         int j;
  14799.         if (!aBoolean1160)
  14800.             j = method120();
  14801.         else
  14802.             j = method121();
  14803.         int l = xCameraPos;
  14804.         int i1 = zCameraPos;
  14805.         int j1 = yCameraPos;
  14806.         int k1 = yCameraCurve;
  14807.         int l1 = xCameraCurve;
  14808.         for (int i2 = 0; i2 < 5; i2++)
  14809.             if (aBooleanArray876[i2]) {
  14810.                 int j2 = (int) ((Math.random()
  14811.                         * (anIntArray873[i2] * 2 + 1) - anIntArray873[i2]) + Math
  14812.                         .sin(anIntArray1030[i2]
  14813.                                 * (anIntArray928[i2] / 100D))
  14814.                         * anIntArray1203[i2]);
  14815.                 if (i2 == 0)
  14816.                     xCameraPos += j2;
  14817.                 if (i2 == 1)
  14818.                     zCameraPos += j2;
  14819.                 if (i2 == 2)
  14820.                     yCameraPos += j2;
  14821.                 if (i2 == 3)
  14822.                     xCameraCurve = xCameraCurve + j2 & 0x7ff;
  14823.                 if (i2 == 4) {
  14824.                     yCameraCurve += j2;
  14825.                     if (yCameraCurve < 128)
  14826.                         yCameraCurve = 128;
  14827.                     if (yCameraCurve > 383)
  14828.                         yCameraCurve = 383;
  14829.                 }
  14830.             }
  14831.         int k2 = Texture.anInt1481;
  14832.         Model.aBoolean1684 = true;
  14833.         Model.anInt1687 = 0;
  14834.         Model.anInt1685 = super.mouseX - 4;
  14835.         Model.anInt1686 = super.mouseY - 4;
  14836.         DrawingArea.setAllPixelsToZero();
  14837.         worldController.method313(xCameraPos, yCameraPos, xCameraCurve,
  14838.                 zCameraPos, j, yCameraCurve);
  14839.         worldController.clearObj5Cache();
  14840.         updateEntities();
  14841.         drawHeadIcon();
  14842.         method37(k2);
  14843.         draw3dScreen();
  14844.         if (frameMode != ScreenMode.FIXED) {
  14845.             drawChatArea();
  14846.             drawMinimap();
  14847.             drawTabArea();
  14848.         }
  14849.         aRSImageProducer_1165.drawGraphics(frameMode == ScreenMode.FIXED ? 4 : 0, super.graphics, frameMode == ScreenMode.FIXED ? 4 : 0);
  14850.         xCameraPos = l;
  14851.         zCameraPos = i1;
  14852.         yCameraPos = j1;
  14853.         yCameraCurve = k1;
  14854.         xCameraCurve = l1;
  14855.     }
  14856.  
  14857.     public void clearTopInterfaces() {
  14858.         stream.createFrame(130);
  14859.         if (invOverlayInterfaceID != -1) {
  14860.             invOverlayInterfaceID = -1;
  14861.             needDrawTabArea = true;
  14862.             aBoolean1149 = false;
  14863.             tabAreaAltered = true;
  14864.         }
  14865.         if (backDialogID != -1) {
  14866.             backDialogID = -1;
  14867.             inputTaken = true;
  14868.             aBoolean1149 = false;
  14869.         }
  14870.         openInterfaceID = -1;
  14871.         fullscreenInterfaceID = -1;
  14872.     }
  14873.  
  14874.     private Sprite worldMapIcon508;
  14875.     private Sprite worldMapIcon525;
  14876.     @SuppressWarnings("unused")
  14877.     private Sprite logIconH;
  14878.     private Sprite logIconC;
  14879.     private Sprite[] chatButtons;
  14880.  
  14881.     private Sprite[] ORBS = new Sprite[16];
  14882.     private DecimalFormat format;
  14883.  
  14884.     client() {
  14885.         xpAddedPos = xpCounter = expAdded = 0;
  14886.         mapBack = new Background[2];
  14887.         setFormat(new DecimalFormat());
  14888.         chatRights = new int[500];
  14889.         fullscreenInterfaceID = -1;
  14890.         chatTypeView = 0;
  14891.         clanTitles = new String[500];
  14892.         clanChatMode = 0;
  14893.         cButtonHPos = -1;
  14894.         cButtonCPos = 0;
  14895.         //server = "ratedpixels.no-ip.net"; //No-ip
  14896.        
  14897.         server = "127.0.0.1";
  14898.         anIntArrayArray825 = new int[104][104];
  14899.         friendsNodeIDs = new int[200];
  14900.         groundArray = new NodeList[4][104][104];
  14901.         aBoolean831 = false;
  14902.         aStream_834 = new Stream(new byte[5000]);
  14903.         npcArray = new NPC[16384];
  14904.         npcIndices = new int[16384];
  14905.         anIntArray840 = new int[1000];
  14906.         aStream_847 = Stream.create();
  14907.         aBoolean848 = true;
  14908.         openInterfaceID = -1;
  14909.         currentExp = new int[Skills.skillsCount];
  14910.         aBoolean872 = false;
  14911.         anIntArray873 = new int[5];
  14912.         anInt874 = -1;
  14913.         aBooleanArray876 = new boolean[5];
  14914.         drawFlames = false;
  14915.         reportAbuseInput = "";
  14916.         unknownInt10 = -1;
  14917.         menuOpen = false;
  14918.         inputString = "";
  14919.         maxPlayers = 2048;
  14920.         myPlayerIndex = 2047;
  14921.         playerArray = new Player[maxPlayers];
  14922.         playerIndices = new int[maxPlayers];
  14923.         anIntArray894 = new int[maxPlayers];
  14924.         aStreamArray895s = new Stream[maxPlayers];
  14925.         anIntArrayArray901 = new int[104][104];
  14926.         aByteArray912 = new byte[16384];
  14927.         currentStats = new int[Skills.skillsCount];
  14928.         ignoreListAsLongs = new long[100];
  14929.         loadingError = false;
  14930.         anIntArray928 = new int[5];
  14931.         anIntArrayArray929 = new int[104][104];
  14932.         chatTypes = new int[500];
  14933.         chatNames = new String[500];
  14934.         chatMessages = new String[500];
  14935.         chatButtons = new Sprite[4];
  14936.         sideIcons = new Sprite[15];
  14937.         redStones = new Sprite[5];
  14938.         aBoolean954 = true;
  14939.         friendsListAsLongs = new long[200];
  14940.         currentSong = -1;
  14941.         drawingFlames = false;
  14942.         spriteDrawX = -1;
  14943.         spriteDrawY = -1;
  14944.         anIntArray968 = new int[33];
  14945.         anIntArray969 = new int[256];
  14946.         decompressors = new Decompressor[5];
  14947.         variousSettings = new int[2000];
  14948.         aBoolean972 = false;
  14949.         anInt975 = 50;
  14950.         anIntArray976 = new int[anInt975];
  14951.         anIntArray977 = new int[anInt975];
  14952.         anIntArray978 = new int[anInt975];
  14953.         anIntArray979 = new int[anInt975];
  14954.         anIntArray980 = new int[anInt975];
  14955.         anIntArray981 = new int[anInt975];
  14956.         anIntArray982 = new int[anInt975];
  14957.         aStringArray983 = new String[anInt975];
  14958.         anInt985 = -1;
  14959.         hitMarks = new Sprite[20];
  14960.         anIntArray990 = new int[5];
  14961.         aBoolean994 = false;
  14962.         amountOrNameInput = "";
  14963.         aClass19_1013 = new NodeList();
  14964.         aBoolean1017 = false;
  14965.         anInt1018 = -1;
  14966.         anIntArray1030 = new int[5];
  14967.         aBoolean1031 = false;
  14968.         mapFunctions = new Sprite[100];
  14969.         dialogID = -1;
  14970.         maxStats = new int[Skills.skillsCount];
  14971.         anIntArray1045 = new int[2000];
  14972.         aBoolean1047 = true;
  14973.         anIntArray1052 = new int[152];
  14974.         anInt1054 = -1;
  14975.         aClass19_1056 = new NodeList();
  14976.         anIntArray1057 = new int[33];
  14977.         aClass9_1059 = new RSInterface();
  14978.         mapScenes = new Background[100];
  14979.         barFillColor = 0x4d4233;
  14980.         anIntArray1065 = new int[7];
  14981.         anIntArray1072 = new int[1000];
  14982.         anIntArray1073 = new int[1000];
  14983.         aBoolean1080 = false;
  14984.         friendsList = new String[200];
  14985.         inStream = Stream.create();
  14986.         expectedCRCs = new int[9];
  14987.         menuActionCmd2 = new int[500];
  14988.         menuActionCmd3 = new int[500];
  14989.         menuActionID = new int[500];
  14990.         menuActionCmd1 = new int[500];
  14991.         headIcons = new Sprite[20];
  14992.         skullIcons = new Sprite[20];
  14993.         headIconsHint = new Sprite[20];
  14994.         tabAreaAltered = false;
  14995.         aString1121 = "";
  14996.         atPlayerActions = new String[5];
  14997.         atPlayerArray = new boolean[5];
  14998.         anIntArrayArrayArray1129 = new int[4][13][13];
  14999.         aClass30_Sub2_Sub1_Sub1Array1140 = new Sprite[1000];
  15000.         aBoolean1141 = false;
  15001.         aBoolean1149 = false;
  15002.         crosses = new Sprite[8];
  15003.         musicEnabled = true;
  15004.         needDrawTabArea = false;
  15005.         loggedIn = false;
  15006.         canMute = false;
  15007.         aBoolean1159 = false;
  15008.         aBoolean1160 = false;
  15009.         myUsername = "";
  15010.         myPassword = "";
  15011.         genericLoadingError = false;
  15012.         reportAbuseInterfaceID = -1;
  15013.         aClass19_1179 = new NodeList();
  15014.         anInt1184 = 128;
  15015.         invOverlayInterfaceID = -1;
  15016.         stream = Stream.create();
  15017.         menuActionName = new String[500];
  15018.         anIntArray1203 = new int[5];
  15019.         anIntArray1207 = new int[50];
  15020.         anInt1211 = 78;
  15021.         promptInput = "";
  15022.         modIcons = new Sprite[4];
  15023.         tabID = 3;
  15024.         inputTaken = false;
  15025.         songChanging = true;
  15026.         anIntArray1229 = new int[152];
  15027.         aClass11Array1230 = new Class11[4];
  15028.         anIntArray1241 = new int[50];
  15029.         aBoolean1242 = false;
  15030.         anIntArray1250 = new int[50];
  15031.         rsAlreadyLoaded = false;
  15032.         welcomeScreenRaised = false;
  15033.         messagePromptRaised = false;
  15034.         loginMessage1 = "";
  15035.         loginMessage2 = "";
  15036.         backDialogID = -1;
  15037.         bigX = new int[4000];
  15038.         bigY = new int[4000];
  15039.         anInt1289 = -1;
  15040.     }
  15041.  
  15042.     private final int[] chatRights;
  15043.     private int hoverId;
  15044.  
  15045.     public int rights;
  15046.     public String name;
  15047.     public String message;
  15048.     public String clanname;
  15049.     public int chatTypeView;
  15050.     public int clanChatMode;
  15051.     public int duelMode;
  15052.     private Sprite chatArea;
  15053.     private final Background[] mapBack;
  15054.  
  15055.     private ImageProducer leftFrame;
  15056.     private ImageProducer topFrame;
  15057.     private ImageProducer rightFrame;
  15058.     private int ignoreCount;
  15059.     private long aLong824;
  15060.     private int[][] anIntArrayArray825;
  15061.     private int[] friendsNodeIDs;
  15062.     private NodeList[][][] groundArray;
  15063.     private int[] anIntArray828;
  15064.     private int[] anIntArray829;
  15065.     private volatile boolean aBoolean831;
  15066.     private Socket aSocket832;
  15067.     private int loginScreenState;
  15068.     private Stream aStream_834;
  15069.     private NPC[] npcArray;
  15070.     private int npcCount;
  15071.     private int[] npcIndices;
  15072.     private int anInt839;
  15073.     private int[] anIntArray840;
  15074.     private int anInt841;
  15075.     private int anInt842;
  15076.     private int anInt843;
  15077.     private String aString844;
  15078.     private int privateChatMode;
  15079.     private Stream aStream_847;
  15080.     private boolean aBoolean848;
  15081.     private static int anInt849;
  15082.     private int[] anIntArray850;
  15083.     private int[] anIntArray851;
  15084.     private int[] anIntArray852;
  15085.     private int[] anIntArray853;
  15086.     private static int anInt854;
  15087.     private int anInt855;
  15088.     public static int openInterfaceID;
  15089.     private int xCameraPos;
  15090.     private int zCameraPos;
  15091.     private int yCameraPos;
  15092.     private int yCameraCurve;
  15093.     private int xCameraCurve;
  15094.     private int myPrivilege;
  15095.     private final int[] currentExp;
  15096.     private Sprite[] redStones;
  15097.     private Sprite mapFlag;
  15098.     private Sprite mapMarker;
  15099.     private boolean aBoolean872;
  15100.     private final int[] anIntArray873;
  15101.     private int anInt874;
  15102.     private final boolean[] aBooleanArray876;
  15103.     private int weight;
  15104.     private MouseDetection mouseDetection;
  15105.     private volatile boolean drawFlames;
  15106.     private String reportAbuseInput;
  15107.     private int unknownInt10;
  15108.     private boolean menuOpen;
  15109.     private int anInt886;
  15110.     private String inputString;
  15111.     private final int maxPlayers;
  15112.     private final int myPlayerIndex;
  15113.     private Player[] playerArray;
  15114.     private int playerCount;
  15115.     private int[] playerIndices;
  15116.     private int anInt893;
  15117.     private int[] anIntArray894;
  15118.     private Stream[] aStreamArray895s;
  15119.     private int viewRotationOffset;
  15120.     private int friendsCount;
  15121.     private int anInt900;
  15122.     private int[][] anIntArrayArray901;
  15123.     private byte[] aByteArray912;
  15124.     private int anInt913;
  15125.     private int crossX;
  15126.     private int crossY;
  15127.     private int crossIndex;
  15128.     private int crossType;
  15129.     private int plane;
  15130.     private final int[] currentStats;
  15131.     private static int anInt924;
  15132.     private final long[] ignoreListAsLongs;
  15133.     private boolean loadingError;
  15134.     private final int[] anIntArray928;
  15135.     private int[][] anIntArrayArray929;
  15136.     private Sprite aClass30_Sub2_Sub1_Sub1_931;
  15137.     private Sprite aClass30_Sub2_Sub1_Sub1_932;
  15138.     private int anInt933;
  15139.     private int anInt934;
  15140.     private int anInt935;
  15141.     private int anInt936;
  15142.     private int anInt937;
  15143.     private int anInt938;
  15144.     private final int[] chatTypes;
  15145.     private final String[] chatNames;
  15146.     private final String[] chatMessages;
  15147.     private int anInt945;
  15148.     private WorldController worldController;
  15149.     private Sprite[] sideIcons;
  15150.     private int menuScreenArea;
  15151.     private int menuOffsetX;
  15152.     private int menuOffsetY;
  15153.     private int menuWidth;
  15154.     private int menuHeight;
  15155.     private long aLong953;
  15156.     private boolean aBoolean954;
  15157.     private long[] friendsListAsLongs;
  15158.     private static int loadImageCount = 47;
  15159.     public Sprite[] cacheSprite = new Sprite[loadImageCount];
  15160.     private int currentSong;
  15161.     private static int nodeID = 10;
  15162.     static int portOff;
  15163.     static boolean clientData;
  15164.     private static boolean isMembers = true;
  15165.     private static boolean lowMem;
  15166.     private volatile boolean drawingFlames;
  15167.     private int spriteDrawX;
  15168.     private int spriteDrawY;
  15169.     private final int[] anIntArray965 = { 0xffff00, 0xff0000, 65280, 65535,
  15170.             0xff00ff, 0xffffff };
  15171.     private Background aBackground_966;
  15172.     private Background aBackground_967;
  15173.     private final int[] anIntArray968;
  15174.     private final int[] anIntArray969;
  15175.     final Decompressor[] decompressors;
  15176.     public int variousSettings[];
  15177.     private boolean aBoolean972;
  15178.     private final int anInt975;
  15179.     private final int[] anIntArray976;
  15180.     private final int[] anIntArray977;
  15181.     private final int[] anIntArray978;
  15182.     private final int[] anIntArray979;
  15183.     private final int[] anIntArray980;
  15184.     private final int[] anIntArray981;
  15185.     private final int[] anIntArray982;
  15186.     private final String[] aStringArray983;
  15187.     private int anInt984;
  15188.     private int anInt985;
  15189.     private static int anInt986;
  15190.     private Sprite[] hitMarks;
  15191.     private int anInt989;
  15192.     private final int[] anIntArray990;
  15193.     private static boolean aBoolean993;
  15194.     private final boolean aBoolean994;
  15195.     private int anInt995;
  15196.     private int anInt996;
  15197.     private int anInt997;
  15198.     private int anInt998;
  15199.     private int anInt999;
  15200.     private ISAACRandomGen encryption;
  15201.     private Sprite mapEdge;
  15202.     static final int[][] anIntArrayArray1003 = {
  15203.             { 6798, 107, 10283, 16, 4797, 7744, 5799, 4634, 33697, 22433, 2983,
  15204.                     54193 },
  15205.             { 8741, 12, 64030, 43162, 7735, 8404, 1701, 38430, 24094, 10153,
  15206.                     56621, 4783, 1341, 16578, 35003, 25239 },
  15207.             { 25238, 8742, 12, 64030, 43162, 7735, 8404, 1701, 38430, 24094,
  15208.                     10153, 56621, 4783, 1341, 16578, 35003 },
  15209.             { 4626, 11146, 6439, 12, 4758, 10270 },
  15210.             { 4550, 4537, 5681, 5673, 5790, 6806, 8076, 4574 } };
  15211.  
  15212.     private Sprite multiOverlay;
  15213.     private String amountOrNameInput;
  15214.     private static int anInt1005;
  15215.     private int daysSinceLastLogin;
  15216.     private int pktSize;
  15217.     private int pktType;
  15218.     private int anInt1009;
  15219.     private int anInt1010;
  15220.     private int anInt1011;
  15221.     private NodeList aClass19_1013;
  15222.     private int anInt1014;
  15223.     private int anInt1015;
  15224.     private int anInt1016;
  15225.     private boolean aBoolean1017;
  15226.     public static int anInt1018;
  15227.     private static final int[] anIntArray1019;
  15228.     private int anInt1021;
  15229.     private int anInt1022;
  15230.     private int loadingStage;
  15231.     private Sprite scrollBar1;
  15232.     private Sprite scrollBar2;
  15233.     private int anInt1026;
  15234.     private final int[] anIntArray1030;
  15235.     private boolean aBoolean1031;
  15236.     private static Sprite[] mapFunctions;
  15237.     private static int baseX;
  15238.     private static int baseY;
  15239.     private int anInt1036;
  15240.     private int anInt1037;
  15241.     private int loginFailures;
  15242.     private int anInt1039;
  15243.     private int anInt1040;
  15244.     private int anInt1041;
  15245.     private int dialogID;
  15246.     private final int[] maxStats;
  15247.     private final int[] anIntArray1045;
  15248.     private int anInt1046;
  15249.     private boolean aBoolean1047;
  15250.     public TextDrawingArea smallText;
  15251.     public TextDrawingArea XPFONT;
  15252.     public TextDrawingArea aTextDrawingArea_1271;
  15253.     public TextDrawingArea chatTextDrawingArea;
  15254.     public TextDrawingArea aTextDrawingArea_1273;
  15255.     public RSFont newSmallFont;
  15256.     public RSFont newRegularFont;
  15257.     public RSFont newBoldFont;
  15258.     public RSFont newFancyFont;
  15259.     private int anInt1048;
  15260.     private String aString1049;
  15261.     private static int anInt1051;
  15262.     private final int[] anIntArray1052;
  15263.     private StreamLoader titleStreamLoader;
  15264.     private int anInt1054;
  15265.     private int anInt1055;
  15266.     private NodeList aClass19_1056;
  15267.     private final int[] anIntArray1057;
  15268.     public final RSInterface aClass9_1059;
  15269.     private Background[] mapScenes;
  15270.     private static int anInt1061;
  15271.     private int anInt1062;
  15272.     private final int barFillColor;
  15273.     private int friendsListAction;
  15274.     private final int[] anIntArray1065;
  15275.     private int mouseInvInterfaceIndex;
  15276.     private int lastActiveInvInterface;
  15277.     public OnDemandFetcher onDemandFetcher;
  15278.     private int anInt1069;
  15279.     private int anInt1070;
  15280.     private int anInt1071;
  15281.     private int[] anIntArray1072;
  15282.     private int[] anIntArray1073;
  15283.     private Sprite mapDotItem;
  15284.     private Sprite mapDotNPC;
  15285.     private Sprite mapDotPlayer;
  15286.     private Sprite mapDotFriend;
  15287.     private Sprite mapDotTeam;
  15288.     private Sprite mapDotClan;
  15289.     private int anInt1079;
  15290.     private boolean aBoolean1080;
  15291.     private String[] friendsList;
  15292.     private Stream inStream;
  15293.     private int anInt1084;
  15294.     private int anInt1085;
  15295.     private int activeInterfaceType;
  15296.     private int anInt1087;
  15297.     private int anInt1088;
  15298.     public static int anInt1089;
  15299.     private final int[] expectedCRCs;
  15300.     private int[] menuActionCmd2;
  15301.     private int[] menuActionCmd3;
  15302.     private int[] menuActionID;
  15303.     private int[] menuActionCmd1;
  15304.     private Sprite[] headIcons;
  15305.     private Sprite[] skullIcons;
  15306.     private Sprite[] headIconsHint;
  15307.     private static int anInt1097;
  15308.     private int anInt1098;
  15309.     private int anInt1099;
  15310.     private int anInt1100;
  15311.     private int anInt1101;
  15312.     private int anInt1102;
  15313.     public static boolean tabAreaAltered;
  15314.     private int anInt1104;
  15315.     private ImageProducer aRSImageProducer_1107;
  15316.     private ImageProducer aRSImageProducer_1108;
  15317.     private ImageProducer aRSImageProducer_1109;
  15318.     private ImageProducer aRSImageProducer_1110;
  15319.     private ImageProducer aRSImageProducer_1111;
  15320.     private ImageProducer aRSImageProducer_1112;
  15321.     private ImageProducer aRSImageProducer_1113;
  15322.     private ImageProducer aRSImageProducer_1114;
  15323.     private ImageProducer aRSImageProducer_1115;
  15324.     private static int anInt1117;
  15325.     private int membersInt;
  15326.     private String aString1121;
  15327.     private Sprite compass;
  15328.     private ImageProducer aRSImageProducer_1125;
  15329.     public static Player myPlayer;
  15330.     private final String[] atPlayerActions;
  15331.     private final boolean[] atPlayerArray;
  15332.     private final int[][][] anIntArrayArrayArray1129;
  15333.     final static int[] tabInterfaceIDs = { -1, -1, -1, -1, -1, -1, -1, -1, -1,
  15334.             -1, -1, -1, -1, -1, -1, -1, -1 };
  15335.     private int cameraOffsetY;
  15336.     private int menuActionRow;
  15337.     private static int anInt1134;
  15338.     private int spellSelected;
  15339.     private int anInt1137;
  15340.     private int spellUsableOn;
  15341.     private String spellTooltip;
  15342.     private Sprite[] aClass30_Sub2_Sub1_Sub1Array1140;
  15343.     private boolean aBoolean1141;
  15344.     private static int anInt1142;
  15345.     private int energy;
  15346.     private boolean aBoolean1149;
  15347.     private Sprite[] crosses;
  15348.     private boolean musicEnabled;
  15349.     private Background[] aBackgroundArray1152s;
  15350.     public static boolean needDrawTabArea;
  15351.     private int unreadMessages;
  15352.     private static int anInt1155;
  15353.     private static boolean fpsOn;
  15354.     public static boolean loggedIn;
  15355.     private boolean canMute;
  15356.     private boolean aBoolean1159;
  15357.     private boolean aBoolean1160;
  15358.     static int loopCycle;
  15359.     private static final String validUserPassChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!\"\243$%^&*()-_=+[{]};:'@#~,<.>/?\\| ";
  15360.     private static ImageProducer aRSImageProducer_1163;
  15361.     private ImageProducer mapEdgeIP;
  15362.     private ImageProducer aRSImageProducer_1164;
  15363.     private static ImageProducer aRSImageProducer_1165;
  15364.     private static ImageProducer aRSImageProducer_1166;
  15365.     private int daysSinceRecovChange;
  15366.     private RSSocket socketStream;
  15367.     private static int minimapZoom;
  15368.     private long aLong1172;
  15369.     private String myUsername;
  15370.     private String myPassword;
  15371.     private static int anInt1175;
  15372.     private boolean genericLoadingError;
  15373.     private final int[] anIntArray1177 = { 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2,
  15374.             2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3 };
  15375.     private int reportAbuseInterfaceID;
  15376.     private NodeList aClass19_1179;
  15377.     private static int[] anIntArray1180;
  15378.     private static int[] anIntArray1181;
  15379.     private static int[] anIntArray1182;
  15380.     private byte[][] aByteArrayArray1183;
  15381.     private int anInt1184;
  15382.     private static int viewRotation;
  15383.     private int anInt1186;
  15384.     private int anInt1187;
  15385.     private static int anInt1188;
  15386.     private int invOverlayInterfaceID;
  15387.     private int[] anIntArray1190;
  15388.     private int[] anIntArray1191;
  15389.     private Stream stream;
  15390.     private int anInt1193;
  15391.     private int splitPrivateChat;
  15392.     private String[] clanList = new String[100];
  15393.     private String[] menuActionName;
  15394.     private Sprite aClass30_Sub2_Sub1_Sub1_1201;
  15395.     private Sprite aClass30_Sub2_Sub1_Sub1_1202;
  15396.     private final int[] anIntArray1203;
  15397.     static final int[] anIntArray1204 = { 9104, 10275, 7595, 3610, 7975, 8526,
  15398.             918, 38802, 24466, 10145, 58654, 5027, 1457, 16565, 34991, 25486 };
  15399.     private static boolean flagged;
  15400.     private final int[] anIntArray1207;
  15401.     private int anInt1208;
  15402.     private static int minimapRotation;
  15403.     public static int anInt1211;
  15404.     private String promptInput;
  15405.     private int anInt1213;
  15406.     private int[][][] intGroundArray;
  15407.     private long aLong1215;
  15408.     private int loginScreenCursorPos;
  15409.     private final Sprite[] modIcons;
  15410.     private long aLong1220;
  15411.     public static int tabID;
  15412.     private int anInt1222;
  15413.     public static boolean inputTaken;
  15414.     private int inputDialogState;
  15415.     private static int anInt1226;
  15416.     private int nextSong;
  15417.     private boolean songChanging;
  15418.     private final int[] anIntArray1229;
  15419.     private Class11[] aClass11Array1230;
  15420.     public static int anIntArray1232[];
  15421.     private int[] anIntArray1234;
  15422.     private int[] anIntArray1235;
  15423.     private int[] anIntArray1236;
  15424.     private int anInt1237;
  15425.     private int anInt1238;
  15426.     public final int anInt1239 = 100;
  15427.     private final int[] anIntArray1241;
  15428.     private boolean aBoolean1242;
  15429.     private int atInventoryLoopCycle;
  15430.     private int atInventoryInterface;
  15431.     private int atInventoryIndex;
  15432.     private int atInventoryInterfaceType;
  15433.     private byte[][] aByteArrayArray1247;
  15434.     private int tradeMode;
  15435.     private int anInt1249;
  15436.     private final int[] anIntArray1250;
  15437.     private int anInt1251;
  15438.     private final boolean rsAlreadyLoaded;
  15439.     private int anInt1253;
  15440.     private boolean welcomeScreenRaised;
  15441.     private boolean messagePromptRaised;
  15442.     private int anInt1257;
  15443.     private byte[][][] byteGroundArray;
  15444.     private int prevSong;
  15445.     private int destX;
  15446.     private int destY;
  15447.     private Sprite miniMapImage;
  15448.     private int anInt1264;
  15449.     private int anInt1265;
  15450.     private String loginMessage1;
  15451.     private String loginMessage2;
  15452.     private int anInt1268;
  15453.     private int anInt1269;
  15454.     private int anInt1275;
  15455.     private int backDialogID;
  15456.     private int cameraOffsetX;
  15457.     private int[] bigX;
  15458.     private int[] bigY;
  15459.     private int itemSelected;
  15460.     private int anInt1283;
  15461.     private int anInt1284;
  15462.     private int anInt1285;
  15463.     private String selectedItemName;
  15464.     private int publicChatMode;
  15465.     private static int anInt1288;
  15466.     private int anInt1289;
  15467.     public static int anInt1290;
  15468.     public static String server = "localhost";
  15469.     public int drawCount;
  15470.     public int fullscreenInterfaceID;
  15471.     public int anInt1044;// 377
  15472.     public int anInt1129;// 377
  15473.     public int anInt1315;// 377
  15474.     public int anInt1500;// 377
  15475.     public int anInt1501;// 377
  15476.     public static int[] fullScreenTextureArray;
  15477.  
  15478.     public void resetAllImageProducers() {
  15479.         if (super.fullGameScreen != null) {
  15480.             return;
  15481.         }
  15482.         aRSImageProducer_1166 = null;
  15483.         aRSImageProducer_1164 = null;
  15484.         aRSImageProducer_1163 = null;
  15485.         aRSImageProducer_1165 = null;
  15486.         aRSImageProducer_1125 = null;
  15487.         aRSImageProducer_1107 = null;
  15488.         aRSImageProducer_1108 = null;
  15489.         aRSImageProducer_1109 = null;
  15490.         aRSImageProducer_1110 = null;
  15491.         aRSImageProducer_1111 = null;
  15492.         aRSImageProducer_1112 = null;
  15493.         aRSImageProducer_1113 = null;
  15494.         aRSImageProducer_1114 = null;
  15495.         aRSImageProducer_1115 = null;
  15496.         super.fullGameScreen = new ImageProducer(765, 503);
  15497.         welcomeScreenRaised = true;
  15498.     }
  15499.  
  15500.     public void launchURL(String url) {
  15501.         String osName = System.getProperty("os.name");
  15502.         try {
  15503.             if (osName.startsWith("Mac OS")) {
  15504.                 @SuppressWarnings("rawtypes")
  15505.                 Class fileMgr = Class.forName("com.apple.eio.FileManager");
  15506.                 @SuppressWarnings("unchecked")
  15507.                 Method openURL = fileMgr.getDeclaredMethod("openURL",
  15508.                         new Class[] { String.class });
  15509.                 openURL.invoke(null, new Object[] { url });
  15510.             } else if (osName.startsWith("Windows"))
  15511.                 Runtime.getRuntime().exec(
  15512.                         "rundll32 url.dll,FileProtocolHandler " + url);
  15513.             else { // assume Unix or Linux
  15514.                 String[] browsers = { "firefox", "opera", "konqueror",
  15515.                         "epiphany", "mozilla", "netscape", "safari" };
  15516.                 String browser = null;
  15517.                 for (int count = 0; count < browsers.length && browser == null; count++)
  15518.                     if (Runtime.getRuntime()
  15519.                             .exec(new String[] { "which", browsers[count] })
  15520.                             .waitFor() == 0)
  15521.                         browser = browsers[count];
  15522.                 if (browser == null) {
  15523.                     throw new Exception("Could not find web browser");
  15524.                 } else
  15525.                     Runtime.getRuntime().exec(new String[] { browser, url });
  15526.             }
  15527.         } catch (Exception e) {
  15528.             pushMessage("Failed to open URL.", 0, "");
  15529.         }
  15530.     }
  15531.  
  15532.     public DecimalFormat getFormat() {
  15533.         return format;
  15534.     }
  15535.  
  15536.     public void setFormat(DecimalFormat format) {
  15537.         this.format = format;
  15538.     }
  15539.  
  15540.     static {
  15541.         anIntArray1019 = new int[99];
  15542.         int i = 0;
  15543.         for (int j = 0; j < 99; j++) {
  15544.             int l = j + 1;
  15545.             int i1 = (int) (l + 300D * Math.pow(2D, l / 7D));
  15546.             i += i1;
  15547.             anIntArray1019[j] = i / 4;
  15548.         }
  15549.         anIntArray1232 = new int[32];
  15550.         i = 2;
  15551.         for (int k = 0; k < 32; k++) {
  15552.             anIntArray1232[k] = i - 1;
  15553.             i += i;
  15554.         }
  15555.     }
  15556. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement