Advertisement
Guest User

Untitled

a guest
Feb 6th, 2017
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 409.23 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.     private static final long serialVersionUID = 1L;
  16.  
  17.     private boolean revision474;
  18.     private boolean revision498;
  19.     private boolean revision508;
  20.     private boolean OSOrbs;
  21.     public int followPlayer = 0;
  22.     public int followNPC = 0;
  23.     public int followDistance = 1;
  24.     public int CameraPos1 = 3;
  25.     public int CameraPos2 = 600;
  26.     public boolean counterOn = true;
  27.  
  28.     private static String intToKOrMilLongName(int i) {
  29.         String s = String.valueOf(i);
  30.         for (int k = s.length() - 3; k > 0; k -= 3)
  31.             s = s.substring(0, k) + "," + s.substring(k);
  32.         if (s.length() > 8)
  33.             s = "@gre@" + s.substring(0, s.length() - 8) + " million @whi@("
  34.                     + s + ")";
  35.         else if (s.length() > 4)
  36.             s = "@cya@" + s.substring(0, s.length() - 4) + "K @whi@(" + s + ")";
  37.         return " " + s;
  38.     }
  39.  
  40.     private static String intToKOrMil(int j) {
  41.         if (j < 0x186a0)
  42.             return String.valueOf(j);
  43.         if (j < 0x989680)
  44.             return j / 1000 + "K";
  45.         else
  46.             return j / 0xf4240 + "M";
  47.     }
  48.  
  49.     public final String titleColor(final int i, int type) {
  50.         String titleChatbox = "", titleRightclick = "";
  51.         switch (i) {
  52.  
  53.         case 0: // orange
  54.             titleChatbox = "A67711";
  55.             titleRightclick = "or0";
  56.             break;
  57.  
  58.         case 1: // purple
  59.             titleChatbox = "FF00CD";
  60.             titleRightclick = "pur";
  61.             break;
  62.  
  63.         case 2: // red
  64.             titleChatbox = "ff0000";
  65.             titleRightclick = "red";
  66.             break;
  67.  
  68.         case 3: // green
  69.             titleChatbox = "148200";
  70.             titleRightclick = "gr0";
  71.             break;
  72.  
  73.         case 4: // black
  74.             titleChatbox = "0";
  75.             titleRightclick = "bla";
  76.             break;
  77.  
  78.         case 5: // yellow
  79.             titleChatbox = "ffff00";
  80.             titleRightclick = "yel";
  81.             break;
  82.  
  83.         case 6: // cyan
  84.             titleChatbox = "65535";
  85.             titleRightclick = "cya";
  86.             break;
  87.  
  88.         case 7: // white
  89.             titleChatbox = "ffffff";
  90.             titleRightclick = "whi";
  91.             break;
  92.         }
  93.         if (type == 0)
  94.             return titleChatbox;
  95.         else
  96.             return titleRightclick;
  97.     }
  98.  
  99.     public void stopMidi() {
  100.         signlink.midifade = 0;
  101.         signlink.midi = "stop";
  102.     }
  103.  
  104.     public Sprite[] chatImages = new Sprite[2];
  105.     public static int spellID = 0;
  106.     public int MapX, MapY;
  107.  
  108.     public static void setTab(int id) {
  109.         needDrawTabArea = true;
  110.         tabID = id;
  111.         tabAreaAltered = true;
  112.     }
  113.  
  114.     boolean noClipIsOn = false;
  115.  
  116.     private boolean menuHasAddFriend(int j) {
  117.         if (j < 0)
  118.             return false;
  119.         int k = menuActionID[j];
  120.         if (k >= 2000)
  121.             k -= 2000;
  122.         return k == 337;
  123.     }
  124.  
  125.     private static String findcachedir() {
  126.         return "./ProjectOS/";
  127.     }
  128.  
  129.     public void drawChannelButtons() {
  130.         String text[] = { "On", "Friends", "Off", "Hide" };
  131.         int textColor[] = { 65280, 0xffff00, 0xff0000, 65535 };
  132.         switch (cButtonCPos) {
  133.         case 0:
  134.             chatButtons[1].drawSprite(5, 142);
  135.             break;
  136.         case 1:
  137.             chatButtons[1].drawSprite(71, 142);
  138.             break;
  139.         case 2:
  140.             chatButtons[1].drawSprite(137, 142);
  141.             break;
  142.         case 3:
  143.             chatButtons[1].drawSprite(203, 142);
  144.             break;
  145.         case 4:
  146.             chatButtons[1].drawSprite(269, 142);
  147.             break;
  148.         case 5:
  149.             chatButtons[1].drawSprite(335, 142);
  150.             break;
  151.         }
  152.         if (cButtonHPos == cButtonCPos) {
  153.             switch (cButtonHPos) {
  154.             case 0:
  155.                 chatButtons[2].drawSprite(5, 142);
  156.                 break;
  157.             case 1:
  158.                 chatButtons[2].drawSprite(71, 142);
  159.                 break;
  160.             case 2:
  161.                 chatButtons[2].drawSprite(137, 142);
  162.                 break;
  163.             case 3:
  164.                 chatButtons[2].drawSprite(203, 142);
  165.                 break;
  166.             case 4:
  167.                 chatButtons[2].drawSprite(269, 142);
  168.                 break;
  169.             case 5:
  170.                 chatButtons[2].drawSprite(335, 142);
  171.                 break;
  172.             case 6:
  173.                 chatButtons[3].drawSprite(404, 142);
  174.                 break;
  175.             }
  176.         } else {
  177.             switch (cButtonHPos) {
  178.             case 0:
  179.                 chatButtons[0].drawSprite(5, 142);
  180.                 break;
  181.             case 1:
  182.                 chatButtons[0].drawSprite(71, 142);
  183.                 break;
  184.             case 2:
  185.                 chatButtons[0].drawSprite(137, 142);
  186.                 break;
  187.             case 3:
  188.                 chatButtons[0].drawSprite(203, 142);
  189.                 break;
  190.             case 4:
  191.                 chatButtons[0].drawSprite(269, 142);
  192.                 break;
  193.             case 5:
  194.                 chatButtons[0].drawSprite(335, 142);
  195.                 break;
  196.             case 6:
  197.                 chatButtons[3].drawSprite(404, 142);
  198.                 break;
  199.             }
  200.         }
  201.         smallText.method389(true, 425, 0xffffff, "Report Abuse", 157);
  202.         smallText.method389(true, 26, 0xffffff, "All", 157);
  203.         smallText.method389(true, 86, 0xffffff, "Game", 157);
  204.         smallText.method389(true, 150, 0xffffff, "Public", 152);
  205.         smallText.method389(true, 212, 0xffffff, "Private", 152);
  206.         smallText.method389(true, 286, 0xffffff, "Clan", 152);
  207.         smallText.method389(true, 349, 0xffffff, "Trade", 152);
  208.         smallText.method382(textColor[publicChatMode], 164,
  209.                 text[publicChatMode], 163, true);
  210.         smallText.method382(textColor[privateChatMode], 230,
  211.                 text[privateChatMode], 163, true);
  212.         smallText.method382(textColor[clanChatMode], 296, text[clanChatMode],
  213.                 163, true);
  214.         smallText.method382(textColor[tradeMode], 362, text[tradeMode], 163,
  215.                 true);
  216.     }
  217.  
  218.     private void drawChatArea() {
  219.         aRSImageProducer_1166.initDrawingArea();
  220.         Texture.anIntArray1472 = anIntArray1180;
  221.         chatArea.drawSprite(0, 0);
  222.         drawChannelButtons();
  223.         TextDrawingArea textDrawingArea = aTextDrawingArea_1271;
  224.         if (messagePromptRaised) {
  225.             newBoldFont.drawCenteredString(aString1121, 259, 60, 0, -1);
  226.             newBoldFont.drawCenteredString(promptInput + "*", 259, 80, 128, -1);
  227.         } else if (inputDialogState == 1) {
  228.             newBoldFont.drawCenteredString("Enter amount:", 259, 60, 0, -1);
  229.             newBoldFont.drawCenteredString(amountOrNameInput + "*", 259, 80,
  230.                     128, -1);
  231.         } else if (inputDialogState == 2) {
  232.             newBoldFont.drawCenteredString("Enter name:", 259, 60, 0, -1);
  233.             newBoldFont.drawCenteredString(amountOrNameInput + "*", 259, 80,
  234.                     128, -1);
  235.         } else if (aString844 != null) {
  236.             newBoldFont.drawCenteredString(aString844, 259, 60, 0, -1);
  237.             newBoldFont.drawCenteredString("Click to continue", 259, 80, 128,
  238.                     -1);
  239.         } else if (backDialogID != -1) {
  240.             drawInterface(0, 20, RSInterface.interfaceCache[backDialogID], 20);
  241.         } else if (dialogID != -1) {
  242.             drawInterface(0, 20, RSInterface.interfaceCache[dialogID], 20);
  243.         } else {
  244.             int j77 = -3;
  245.             int j = 0;
  246.             DrawingArea.setDrawingArea(122, 8, 497, 7);
  247.             for (int k = 0; k < 500; k++)
  248.                 if (chatMessages[k] != null) {
  249.                     int chatType = chatTypes[k];
  250.                     int yPos = (70 - j77 * 14) + anInt1089 + 5;
  251.                     String s1 = chatNames[k];
  252.                     byte byte0 = 0;
  253.                     if (s1 != null && s1.startsWith("@cr1@")) {
  254.                         s1 = s1.substring(5);
  255.                         byte0 = 1;
  256.                     } else if (s1 != null && s1.startsWith("@cr2@")) {
  257.                         s1 = s1.substring(5);
  258.                         byte0 = 2;
  259.                     } else if (s1 != null && s1.startsWith("@cr3@")) {
  260.                         s1 = s1.substring(5);
  261.                         byte0 = 3;
  262.                     } else if (s1 != null && s1.startsWith("@cr4@")) {
  263.                         s1 = s1.substring(5);
  264.                         byte0 = 4;
  265.                     } else if (s1 != null && s1.startsWith("@cr5@")) {
  266.                         s1 = s1.substring(5);
  267.                         byte0 = 5;
  268.                     } else if (s1 != null && s1.startsWith("@cr6@")) {
  269.                         s1 = s1.substring(5);
  270.                         byte0 = 6;
  271.                     } else if (s1 != null && s1.startsWith("@cr7@")) {
  272.                         s1 = s1.substring(5);
  273.                         byte0 = 7;
  274.                     } else if (s1 != null && s1.startsWith("@cr8@")) {
  275.                         s1 = s1.substring(5);
  276.                         byte0 = 8;
  277.                     } else if (s1 != null && s1.startsWith("@cr9@")) {
  278.                         s1 = s1.substring(5);
  279.                         byte0 = 9;
  280.                     }
  281.                     if (chatType == 0) {
  282.                         if (chatTypeView == 5 || chatTypeView == 0) {
  283.                             if (yPos > 0 && yPos < 210)
  284.                                 // textDrawingArea.method389(false, 11, 0,
  285.                                 // chatMessages[k], yPos);//chat color enabled
  286.                                 newRegularFont.drawBasicString(chatMessages[k],
  287.                                         11, yPos, 0, -1);
  288.                             j++;
  289.                             j77++;
  290.                         }
  291.                     }
  292.                     if ((chatType == 1 || chatType == 2)
  293.                             && (chatType == 1 || publicChatMode == 0 || publicChatMode == 1
  294.                                     && isFriendOrSelf(s1))) {
  295.                         if (chatTypeView == 1 || chatTypeView == 0) {
  296.                             if (yPos > 0 && yPos < 210) {
  297.                                 int xPos = 11;
  298.                                 if (byte0 == 1) {
  299.                                     modIcons[0].drawSprite(xPos + 1, yPos - 11);
  300.                                     xPos += 14;
  301.                                 } else if (byte0 == 2) {
  302.                                     modIcons[1].drawSprite(xPos, yPos - 11);
  303.                                     xPos += 14;
  304.                                 } else if (byte0 == 3) {
  305.                                     modIcons[2].drawSprite(xPos + 1, yPos - 11);
  306.                                     xPos += 14;
  307.                                 } else if (byte0 == 4) {
  308.                                     modIcons[3].drawSprite(xPos + 1, yPos - 11);
  309.                                     xPos += 14;
  310.                                 } else if (byte0 == 5) {
  311.                                     modIcons[4].drawSprite(xPos + 1, yPos - 11);
  312.                                     xPos += 14;
  313.                                 } else if (byte0 == 6) {
  314.                                     modIcons[5].drawSprite(xPos + 1, yPos - 11);
  315.                                     xPos += 14;
  316.  
  317.                                 } else if (byte0 == 7) {
  318.                                     modIcons[6].drawSprite(xPos + 1, yPos - 11);
  319.                                     xPos += 14;
  320.  
  321.                                 } else if (byte0 == 8) {
  322.                                     modIcons[7].drawSprite(xPos + 1, yPos - 11);
  323.                                     xPos += 14;
  324.                                 } else if (byte0 == 9) {
  325.                                     modIcons[8].drawSprite(xPos + 1, yPos - 11);
  326.                                     xPos += 14;
  327.                                 }
  328.                                 newRegularFont.drawBasicString(s1 + ":", xPos,
  329.                                         yPos, 0, -1);
  330.                                 xPos += newRegularFont.getTextWidth(s1) + 8;
  331.                                 newRegularFont.drawBasicString(chatMessages[k],
  332.                                         xPos, yPos, 255, -1);
  333.                             }
  334.                             j++;
  335.                             j77++;
  336.                         }
  337.                     }
  338.                     if ((chatType == 3 || chatType == 7)
  339.                             && (splitPrivateChat == 0 || chatTypeView == 2)
  340.                             && (chatType == 7 || privateChatMode == 0 || privateChatMode == 1
  341.                                     && isFriendOrSelf(s1))) {
  342.                         if (chatTypeView == 2 || chatTypeView == 0) {
  343.                             if (yPos > 0 && yPos < 210) {
  344.                                 int k1 = 11;
  345.                                 newRegularFont.drawBasicString("From", k1,
  346.                                         yPos, 0, -1);
  347.                                 if (byte0 == 3 || byte0 == 2 || byte0 == 1
  348.                                         || byte0 == 0) {
  349.                                     k1 += textDrawingArea.getTextWidth("From ");
  350.                                 } else if (byte0 == 6 || byte0 == 5
  351.                                         || byte0 == 4 || byte0 == 7
  352.                                         || byte0 == 8 || byte0 == 9) {
  353.                                     k1 += textDrawingArea.getTextWidth("From ");
  354.                                 }
  355.                                 if (byte0 == 1) {
  356.                                     modIcons[0].drawSprite(k1 - 2, yPos - 11);
  357.                                     k1 += 12;
  358.                                 } else if (byte0 == 2) {
  359.                                     modIcons[1].drawSprite(k1 - 2, yPos - 11);
  360.                                     k1 += 12;
  361.                                 } else if (byte0 == 3) {
  362.                                     modIcons[2].drawSprite(k1 - 2, yPos - 11);
  363.                                     k1 += 12;
  364.                                 } else if (byte0 == 4) {
  365.                                     modIcons[3].drawSprite(k1 - 2, yPos - 11);
  366.                                     k1 += 12;
  367.                                 } else if (byte0 == 5) {
  368.                                     modIcons[4].drawSprite(k1 - 2, yPos - 11);
  369.                                     k1 += 12;
  370.                                 } else if (byte0 == 6) {
  371.                                     modIcons[5].drawSprite(k1 - 2, yPos - 11);
  372.                                     k1 += 12;
  373.                                 } else if (byte0 == 7) {
  374.                                     modIcons[6].drawSprite(k1 - 2, yPos - 11);
  375.                                     k1 += 12;
  376.                                 } else if (byte0 == 8) {
  377.                                     modIcons[7].drawSprite(k1 - 2, yPos - 11);
  378.                                     k1 += 12;
  379.                                 } else if (byte0 == 9) {
  380.                                     modIcons[8].drawSprite(k1 - 2, yPos - 11);
  381.                                     k1 += 12;
  382.                                 }
  383.                                 newRegularFont.drawBasicString(s1 + ":", k1,
  384.                                         yPos, 0, -1);
  385.                                 k1 += newRegularFont.getTextWidth(s1) + 8;
  386.                                 newRegularFont.drawBasicString(chatMessages[k],
  387.                                         k1, yPos, 0x800000, -1);
  388.                             }
  389.                             j++;
  390.                             j77++;
  391.                         }
  392.                     }
  393.                     if (chatType == 4
  394.                             && (tradeMode == 0 || tradeMode == 1
  395.                                     && isFriendOrSelf(s1))) {
  396.                         if (chatTypeView == 3 || chatTypeView == 0) {
  397.                             if (yPos > 0 && yPos < 210)
  398.                                 newRegularFont.drawBasicString(s1 + " "
  399.                                         + chatMessages[k], 11, yPos, 0x800080,
  400.                                         -1);
  401.                             j++;
  402.                             j77++;
  403.                         }
  404.                     }
  405.                     if (chatType == 5 && splitPrivateChat == 0
  406.                             && privateChatMode < 2) {
  407.                         if (chatTypeView == 2 || chatTypeView == 0) {
  408.                             if (yPos > 0 && yPos < 210)
  409.                                 newRegularFont.drawBasicString(chatMessages[k],
  410.                                         11, yPos, 0x800000, -1);
  411.                             j++;
  412.                             j77++;
  413.                         }
  414.                     }
  415.                     if (chatType == 6
  416.                             && (splitPrivateChat == 0 || chatTypeView == 2)
  417.                             && privateChatMode < 2) {
  418.                         if (chatTypeView == 2 || chatTypeView == 0) {
  419.                             if (yPos > 0 && yPos < 210) {
  420.                                 newRegularFont.drawBasicString(
  421.                                         "To " + s1 + ":", 11, yPos, 0, -1);
  422.                                 newRegularFont.drawBasicString(
  423.                                         chatMessages[k],
  424.                                         15 + newRegularFont.getTextWidth("To :"
  425.                                                 + s1), yPos, 0x800000, -1);
  426.                             }
  427.                             j++;
  428.                             j77++;
  429.                         }
  430.                     }
  431.                     if (chatType == 8
  432.                             && (tradeMode == 0 || tradeMode == 1
  433.                                     && isFriendOrSelf(s1))) {
  434.                         if (chatTypeView == 3 || chatTypeView == 0) {
  435.                             if (yPos > 0 && yPos < 210)
  436.                                 newRegularFont.drawBasicString(s1 + " "
  437.                                         + chatMessages[k], 11, yPos, 0x7e3200,
  438.                                         -1);
  439.                             j++;
  440.                             j77++;
  441.                         }
  442.                         if (chatType == 11 && (clanChatMode == 0)) {
  443.                             if (chatTypeView == 11) {
  444.                                 if (yPos > 0 && yPos < 110)
  445.                                     newRegularFont.drawBasicString(s1 + " "
  446.                                             + chatMessages[k], 19, yPos,
  447.                                             0x7e3200, -1);
  448.                                 j++;
  449.                                 j77++;
  450.                             }
  451.                         }
  452.                         if (chatType == 12) {
  453.                             if (chatTypeView == 11 || chatTypeView == 0) {
  454.                                 if (yPos > 3 && yPos < 130) {
  455.                                     String title = "<col=0000FF>"
  456.                                             + clanTitles[k] + "</col>";
  457.                                     String username = (chatRights[k] > 0 ? "<img="
  458.                                             + (chatRights[k] - 1) + ">"
  459.                                             : "")
  460.                                             + TextClass.fixName(chatNames[k]);
  461.                                     String message = "<col=800000>"
  462.                                             + chatMessages[k] + "</col>";
  463.                                     newRegularFont.drawBasicString("[" + title
  464.                                             + "] " + username + ": " + message,
  465.                                             11, yPos, 0, -1);
  466.                                 }
  467.                                 j++;
  468.                                 j77++;
  469.                             }
  470.                         }
  471.                     }
  472.                     if (chatType == 16) {
  473.                         int j2 = 40 + 11;
  474.                         int clanNameWidth = textDrawingArea
  475.                                 .getTextWidth(clanname);
  476.                         if (chatTypeView == 11 || chatTypeView == 0) {
  477.                             if (yPos > 0 && yPos < 110)
  478.                                 switch (chatRights[k]) {
  479.                                 case 1:
  480.                                     j2 += clanNameWidth;
  481.                                     modIcons[0].drawSprite(j2 - 18, yPos - 12);
  482.                                     j2 += 15;
  483.                                     break;
  484.                                 case 2:
  485.                                     j2 += clanNameWidth;
  486.                                     modIcons[1].drawSprite(j2 - 18, yPos - 12);
  487.                                     j2 += 15;
  488.                                     break;
  489.                                 case 3:
  490.                                     j2 += clanNameWidth;
  491.                                     modIcons[2].drawSprite(j2 - 18, yPos - 12);
  492.                                     j2 += 15;
  493.                                     break;
  494.                                 case 4:
  495.                                     j2 += clanNameWidth;
  496.                                     modIcons[3].drawSprite(j2 - 18, yPos - 12);
  497.                                     j2 += 15;
  498.                                     break;
  499.                                 case 5:
  500.                                     j2 += clanNameWidth;
  501.                                     modIcons[4].drawSprite(j2 - 18, yPos - 12);
  502.                                     j2 += 15;
  503.                                     break;
  504.                                 case 6:
  505.                                     j2 += clanNameWidth;
  506.                                     modIcons[5].drawSprite(j2 - 18, yPos - 12);
  507.                                     j2 += 15;
  508.                                     break;
  509.                                 case 7:
  510.                                     j2 += clanNameWidth;
  511.                                     modIcons[6].drawSprite(j2 - 18, yPos - 12);
  512.                                     j2 += 15;
  513.                                     break;
  514.                                 default:
  515.                                     j2 += clanNameWidth;
  516.                                     break;
  517.                                 }
  518.                             newRegularFont
  519.                                     .drawBasicString("[", 19, yPos, 0, -1);
  520.                             newRegularFont.drawBasicString("]",
  521.                                     clanNameWidth + 16 + 11, yPos, 0, -1);
  522.                             newRegularFont.drawBasicString(""
  523.                                     + capitalize(clanname) + "", 25, yPos, 255,
  524.                                     -1);
  525.                             newRegularFont.drawBasicString(
  526.                                     capitalize(chatNames[k]) + ":", j2 - 17,
  527.                                     yPos);
  528.                             j2 += newRegularFont.getTextWidth(chatNames[k]) + 7;
  529.                             newRegularFont.drawBasicString(
  530.                                     capitalize(chatMessages[k]), j2 - 16, yPos,
  531.                                     0x800000, -1);
  532.  
  533.                             j++;
  534.                             j77++;
  535.                         }
  536.                     }
  537.                 }
  538.             DrawingArea.defaultDrawingAreaSize();
  539.             anInt1211 = j * 14 + 7 + 5;
  540.             if (anInt1211 < 111)
  541.                 anInt1211 = 111;
  542.             drawScrollbar(114, anInt1211 - anInt1089 - 113, 7, 496, anInt1211);
  543.             String fixedString;
  544.  
  545.             if (myPlayer != null && myPlayer.name != null)
  546.                 fixedString = "<col=" + titleColor(myPlayer.titleColor, 0)
  547.                         + ">" + myPlayer.title + "</col>" + myPlayer.name;
  548.             else
  549.                 fixedString = TextClass.fixName(capitalize(myUsername));
  550.  
  551.             String s;
  552.             if (myPlayer != null && myPlayer.name != null)
  553.                 s = /*
  554.                      * "<col="+titleColor(myPlayer.titleColor, 0)+">" +
  555.                      * myPlayer.title + "</col>" + myPlayer.name;
  556.                      */"" + myPlayer.title + "" + myPlayer.name;
  557.             else
  558.                 s = TextClass.fixName(capitalize(myUsername));
  559.             int xPos = 0;
  560.             int yPos = 0;
  561.             if (myPrivilege == 0) { // Player
  562.                 newRegularFont
  563.                         .drawBasicString(fixedString + "", 11, 133, 0, -1);
  564.                 modIcons[9].drawSprite(textDrawingArea.getTextWidth(s) + 12,
  565.                         123);
  566.                 textDrawingArea.method385(0, ": ", 133,
  567.                         (26) + textDrawingArea.getTextWidth(s));
  568.                 newRegularFont.drawBasicString(inputString
  569.                         + ((loopCycle % 40 < 20) ? "|" : ""),
  570.                         24 + textDrawingArea.getTextWidth(s + ": "), 133, 255,
  571.                         -1);
  572.                 DrawingArea.method339(121, 0x807660, 506, 7);
  573.             } else if (myPrivilege == 1) { // Moderator
  574.                 modIcons[0].drawSprite(10 + xPos, 122 + yPos);
  575.                 xPos += 14;
  576.                 newRegularFont
  577.                         .drawBasicString(fixedString + "", 23, 133, 0, -1);
  578.                 modIcons[9].drawSprite(textDrawingArea.getTextWidth(s) + 24,
  579.                         123);
  580.                 textDrawingArea.method385(0, ": ", 133,
  581.                         (38 + textDrawingArea.getTextWidth(s)));
  582.                 newRegularFont.drawBasicString(inputString
  583.                         + ((loopCycle % 40 < 20) ? "|" : ""),
  584.                         36 + textDrawingArea.getTextWidth(s + ": "), 133, 255,
  585.                         -1);
  586.                 DrawingArea.method339(121, 0x807660, 506, 7);
  587.             } else if (myPrivilege == 2) { // Administrator
  588.                 modIcons[1].drawSprite(10 + xPos, 122 + yPos);
  589.                 xPos += 14;
  590.                 newRegularFont
  591.                         .drawBasicString(fixedString + "", 23, 133, 0, -1);
  592.                 modIcons[9].drawSprite(textDrawingArea.getTextWidth(s) + 24,
  593.                         123);
  594.                 textDrawingArea.method385(0, ": ", 133,
  595.                         (38 + textDrawingArea.getTextWidth(s)));
  596.                 newRegularFont.drawBasicString(inputString
  597.                         + ((loopCycle % 40 < 20) ? "|" : ""),
  598.                         36 + textDrawingArea.getTextWidth(s + ": "), 133, 255,
  599.                         -1);
  600.                 DrawingArea.method339(121, 0x807660, 506, 7);
  601.             } else if (myPrivilege == 3) { // Developer
  602.                 modIcons[2].drawSprite(10 + xPos, 121 + yPos);
  603.                 xPos += 14;
  604.                 newRegularFont
  605.                         .drawBasicString(fixedString + "", 23, 133, 0, -1);
  606.                 modIcons[9].drawSprite(24, 123);// was 124
  607.                 textDrawingArea.method385(0, ": ", 10,
  608.                         (38 + textDrawingArea.getTextWidth(s)));
  609.                 newRegularFont.drawBasicString(inputString
  610.                         + ((loopCycle % 40 < 20) ? "|" : ""),
  611.                         36 + textDrawingArea.getTextWidth(s + ": "), 133, 255,
  612.                         -1);
  613.                 DrawingArea.method339(121, 0x807660, 506, 7);
  614.             } else if (myPrivilege == 4) { // Donator
  615.                 modIcons[3].drawSprite(10 + xPos, 122 + yPos);
  616.                 xPos += 14;
  617.                 newRegularFont
  618.                         .drawBasicString(fixedString + "", 23, 133, 0, -1);
  619.                 modIcons[9].drawSprite(textDrawingArea.getTextWidth(s) + 24,
  620.                         123);
  621.                 textDrawingArea.method385(0, ": ", 133,
  622.                         (38 + textDrawingArea.getTextWidth(s)));
  623.                 newRegularFont.drawBasicString(inputString
  624.                         + ((loopCycle % 40 < 20) ? "|" : ""),
  625.                         36 + textDrawingArea.getTextWidth(s + ": "), 133, 255,
  626.                         -1);
  627.                 DrawingArea.method339(121, 0x807660, 506, 7);
  628.             } else if (myPrivilege == 5) { // Super Donator
  629.                 modIcons[4].drawSprite(10 + xPos, 122 + yPos);
  630.                 xPos += 14;
  631.                 newRegularFont
  632.                         .drawBasicString(fixedString + "", 23, 133, 0, -1);
  633.                 modIcons[9].drawSprite(textDrawingArea.getTextWidth(s) + 24,
  634.                         123);
  635.                 textDrawingArea.method385(0, ": ", 133,
  636.                         (38 + textDrawingArea.getTextWidth(s)));
  637.                 newRegularFont.drawBasicString(inputString
  638.                         + ((loopCycle % 40 < 20) ? "|" : ""),
  639.                         36 + textDrawingArea.getTextWidth(s + ": "), 133, 255,
  640.                         -1);
  641.                 DrawingArea.method339(121, 0x807660, 506, 7);
  642.             } else if (myPrivilege == 6) { // Extreme Donator
  643.                 modIcons[5].drawSprite(10 + xPos, 122 + yPos);
  644.                 xPos += 14;
  645.                 newRegularFont
  646.                         .drawBasicString(fixedString + "", 23, 133, 0, -1);
  647.                 modIcons[9].drawSprite(textDrawingArea.getTextWidth(s) + 24,
  648.                         123);
  649.                 textDrawingArea.method385(0, ": ", 133,
  650.                         (38 + textDrawingArea.getTextWidth(s)));
  651.                 newRegularFont.drawBasicString(inputString
  652.                         + ((loopCycle % 40 < 20) ? "|" : ""),
  653.                         36 + textDrawingArea.getTextWidth(s + ": "), 133, 255,
  654.                         -1);
  655.                 DrawingArea.method339(121, 0x807660, 506, 7);
  656.             } else if (myPrivilege == 7) { // Legendary Donator
  657.                 modIcons[6].drawSprite(10 + xPos, 122 + yPos);
  658.                 xPos += 14;
  659.                 newRegularFont
  660.                         .drawBasicString(fixedString + "", 23, 133, 0, -1);
  661.                 modIcons[9].drawSprite(textDrawingArea.getTextWidth(s) + 24,
  662.                         123);
  663.                 textDrawingArea.method385(0, ": ", 133,
  664.                         (38 + textDrawingArea.getTextWidth(s)));
  665.                 newRegularFont.drawBasicString(inputString
  666.                         + ((loopCycle % 40 < 20) ? "|" : ""),
  667.                         36 + textDrawingArea.getTextWidth(s + ": "), 133, 255,
  668.                         -1);
  669.                 DrawingArea.method339(121, 0x807660, 506, 7);
  670.             } else if (myPrivilege == 8) { // Veteran
  671.                 modIcons[7].drawSprite(9 + xPos, 122 + yPos);
  672.                 xPos += 14;
  673.                 newRegularFont
  674.                         .drawBasicString(fixedString + "", 23, 133, 0, -1);
  675.                 modIcons[9].drawSprite(textDrawingArea.getTextWidth(s) + 24,
  676.                         123);
  677.                 textDrawingArea.method385(0, ": ", 133,
  678.                         (38 + textDrawingArea.getTextWidth(s)));
  679.                 newRegularFont.drawBasicString(inputString
  680.                         + ((loopCycle % 40 < 20) ? "|" : ""),
  681.                         36 + textDrawingArea.getTextWidth(s + ": "), 133, 255,
  682.                         -1);
  683.                 DrawingArea.method339(121, 0x807660, 506, 7);
  684.             } else if (myPrivilege == 9) { // Dev
  685.                 modIcons[8].drawSprite(10 + xPos, 122 + yPos);
  686.                 xPos += 14;
  687.                 newRegularFont
  688.                         .drawBasicString(fixedString + "", 23, 133, 0, -1);
  689.                 modIcons[9].drawSprite(textDrawingArea.getTextWidth(s) + 24,
  690.                         123);
  691.                 textDrawingArea.method385(0, ": ", 133,
  692.                         (38 + textDrawingArea.getTextWidth(s)));
  693.                 newRegularFont.drawBasicString(inputString
  694.                         + ((loopCycle % 40 < 20) ? "|" : ""),
  695.                         36 + textDrawingArea.getTextWidth(s + ": "), 133, 255,
  696.                         -1);
  697.                 DrawingArea.method339(121, 0x807660, 506, 7);
  698.             }
  699.         }
  700.         if (menuOpen && menuScreenArea == 2) {
  701.             drawMenu();
  702.         }
  703.         aRSImageProducer_1166.drawGraphics(338, super.graphics, 0);
  704.         aRSImageProducer_1165.initDrawingArea();
  705.         Texture.anIntArray1472 = anIntArray1182;
  706.     }
  707.  
  708.     private String clanUsername;
  709.     private String clanMessage;
  710.     private String clanTitle;
  711.     private final String[] clanTitles;
  712.     private int channelRights;
  713.  
  714.     @Override
  715.     public void init() {
  716.         try {
  717.             nodeID = 10;
  718.             portOff = 0;
  719.             setHighMem();
  720.             isMembers = true;
  721.             signlink.storeid = 32;
  722.             signlink.startpriv(InetAddress.getLocalHost());
  723.             initClientFrame(503, 765);
  724.             instance = this;
  725.         } catch (Exception exception) {
  726.             return;
  727.         }
  728.     }
  729.  
  730.     @Override
  731.     public void startRunnable(Runnable runnable, int i) {
  732.         if (i > 10)
  733.             i = 10;
  734.         if (signlink.mainapp != null) {
  735.             signlink.startthread(runnable, i);
  736.         } else {
  737.             super.startRunnable(runnable, i);
  738.         }
  739.     }
  740.  
  741.     public Socket openSocket(int port) throws IOException {
  742.         return new Socket(InetAddress.getByName("rsts.ddns.net"), port);
  743.     }
  744.  
  745.     public boolean processMenuClick() {
  746.         if (activeInterfaceType != 0)
  747.             return false;
  748.         int j = super.clickMode3;
  749.         if (spellSelected == 1 && super.saveClickX >= 516
  750.                 && super.saveClickY >= 160 && super.saveClickX <= 765
  751.                 && super.saveClickY <= 205)
  752.             j = 0;
  753.         if (menuOpen) {
  754.             if (j != 1) {
  755.                 int k = super.mouseX;
  756.                 int j1 = super.mouseY;
  757.                 if (menuScreenArea == 0) {
  758.                     k -= 4;
  759.                     j1 -= 4;
  760.                 }
  761.                 if (menuScreenArea == 1) {
  762.                     k -= 519;
  763.                     j1 -= 168;
  764.                 }
  765.                 if (menuScreenArea == 2) {
  766.                     k -= 17;
  767.                     j1 -= 338;
  768.                 }
  769.                 if (menuScreenArea == 3) {
  770.                     k -= 519;
  771.                     j1 -= 0;
  772.                 }
  773.                 if (k < menuOffsetX - 10 || k > menuOffsetX + menuWidth + 10
  774.                         || j1 < menuOffsetY - 10
  775.                         || j1 > menuOffsetY + menuHeight + 10) {
  776.                     menuOpen = false;
  777.                     if (menuScreenArea == 1)
  778.                         needDrawTabArea = true;
  779.                     if (menuScreenArea == 2)
  780.                         inputTaken = true;
  781.                 }
  782.             }
  783.             if (j == 1) {
  784.                 int l = menuOffsetX;
  785.                 int k1 = menuOffsetY;
  786.                 int i2 = menuWidth;
  787.                 int k2 = super.saveClickX;
  788.                 int l2 = super.saveClickY;
  789.                 if (menuScreenArea == 0) {
  790.                     k2 -= 4;
  791.                     l2 -= 4;
  792.                 }
  793.                 if (menuScreenArea == 1) {
  794.                     k2 -= 519;
  795.                     l2 -= 168;
  796.                 }
  797.                 if (menuScreenArea == 2) {
  798.                     k2 -= 17;
  799.                     l2 -= 338;
  800.                 }
  801.                 if (menuScreenArea == 3) {
  802.                     k2 -= 519;
  803.                     l2 -= 0;
  804.                 }
  805.                 int i3 = -1;
  806.                 for (int j3 = 0; j3 < menuActionRow; j3++) {
  807.                     int k3 = k1 + 31 + (menuActionRow - 1 - j3) * 15;
  808.                     if (k2 > l && k2 < l + i2 && l2 > k3 - 13 && l2 < k3 + 3)
  809.                         i3 = j3;
  810.                 }
  811.                 if (i3 != -1)
  812.                     doAction(i3);
  813.                 menuOpen = false;
  814.                 if (menuScreenArea == 1)
  815.                     needDrawTabArea = true;
  816.                 if (menuScreenArea == 2) {
  817.                     inputTaken = true;
  818.                 }
  819.             }
  820.             return true;
  821.         } else {
  822.             if (j == 1 && menuActionRow > 0) {
  823.                 int i1 = menuActionID[menuActionRow - 1];
  824.                 if (i1 == 632 || i1 == 78 || i1 == 867 || i1 == 431 || i1 == 53
  825.                         || i1 == 74 || i1 == 454 || i1 == 539 || i1 == 493
  826.                         || i1 == 847 || i1 == 447 || i1 == 1125) {
  827.                     int l1 = menuActionCmd2[menuActionRow - 1];
  828.                     int j2 = menuActionCmd3[menuActionRow - 1];
  829.                     RSInterface class9 = RSInterface.interfaceCache[j2];
  830.                     if (class9.aBoolean259 || class9.aBoolean235) {
  831.                         aBoolean1242 = false;
  832.                         anInt989 = 0;
  833.                         anInt1084 = j2;
  834.                         anInt1085 = l1;
  835.                         activeInterfaceType = 2;
  836.                         anInt1087 = super.saveClickX;
  837.                         anInt1088 = super.saveClickY;
  838.                         if (RSInterface.interfaceCache[j2].parentID == openInterfaceID)
  839.                             activeInterfaceType = 1;
  840.                         if (RSInterface.interfaceCache[j2].parentID == backDialogID)
  841.                             activeInterfaceType = 3;
  842.                         return true;
  843.                     }
  844.                 }
  845.             }
  846.             if (j == 1
  847.                     && (anInt1253 == 1 || menuHasAddFriend(menuActionRow - 1))
  848.                     && menuActionRow > 2)
  849.                 j = 2;
  850.             if (j == 1 && menuActionRow > 0)
  851.                 doAction(menuActionRow - 1);
  852.             if (j == 2 && menuActionRow > 0)
  853.                 determineMenuSize();
  854.             return false;
  855.         }
  856.     }
  857.  
  858.     public static int totalRead = 0;
  859.  
  860.     public static String getFileNameWithoutExtension(String fileName) {
  861.         File tmpFile = new File(fileName);
  862.         tmpFile.getName();
  863.         int whereDot = tmpFile.getName().lastIndexOf('.');
  864.         if (0 < whereDot && whereDot <= tmpFile.getName().length() - 2) {
  865.             return tmpFile.getName().substring(0, whereDot);
  866.         }
  867.         return "";
  868.     }
  869.  
  870.     public String indexLocation(int cacheIndex, int index) {
  871.         return signlink.findcachedir() + "index" + cacheIndex + "/"
  872.                 + (index != -1 ? index + ".gz" : "");
  873.     }
  874.  
  875.     public void repackCacheIndex(int cacheIndex) {
  876.         System.out.println("Started repacking index " + cacheIndex + ".");
  877.         int indexLength = new File(indexLocation(cacheIndex, -1)).listFiles().length;
  878.         File[] file = new File(indexLocation(cacheIndex, -1)).listFiles();
  879.         try {
  880.             for (int index = 0; index < indexLength; index++) {
  881.                 int fileIndex = Integer
  882.                         .parseInt(getFileNameWithoutExtension(file[index]
  883.                                 .toString()));
  884.                 byte[] data = fileToByteArray(cacheIndex, fileIndex);
  885.                 if (data != null && data.length > 0) {
  886.                     decompressors[cacheIndex].method234(data.length, data,
  887.                             fileIndex);
  888.                     System.out.println("Repacked " + fileIndex + ".");
  889.                 } else {
  890.                     System.out.println("Unable to locate index " + fileIndex
  891.                             + ".");
  892.                 }
  893.             }
  894.         } catch (Exception e) {
  895.             System.out.println("Error packing cache index " + cacheIndex + ".");
  896.         }
  897.         System.out.println("Finished repacking " + cacheIndex + ".");
  898.     }
  899.  
  900.     public byte[] fileToByteArray(int cacheIndex, int index) {
  901.         try {
  902.             if (indexLocation(cacheIndex, index).length() <= 0
  903.                     || indexLocation(cacheIndex, index) == null) {
  904.                 return null;
  905.             }
  906.             File file = new File(indexLocation(cacheIndex, index));
  907.             byte[] fileData = new byte[(int) file.length()];
  908.             FileInputStream fis = new FileInputStream(file);
  909.             fis.read(fileData);
  910.             fis.close();
  911.             return fileData;
  912.         } catch (Exception e) {
  913.             return null;
  914.         }
  915.     }
  916.  
  917.     public void preloadModels() {
  918.         File file = new File("./Raw/");
  919.         File[] fileArray = file.listFiles();
  920.         for (int y = 0; y < fileArray.length; y++) {
  921.             String s = fileArray[y].getName();
  922.             byte[] buffer = ReadFile("./Raw/" + s);
  923.             Model.method460(buffer,
  924.                     Integer.parseInt(getFileNameWithoutExtension(s)));
  925.         }
  926.     }
  927.  
  928.     public void drawWorldMapButton() {
  929.         worldMapIcon525.drawSprite(8, 124);
  930.     }
  931.  
  932.     public static final byte[] ReadFile(String s) {
  933.         try {
  934.             byte abyte0[];
  935.             File file = new File(s);
  936.             int i = (int) file.length();
  937.             abyte0 = new byte[i];
  938.             DataInputStream datainputstream = new DataInputStream(
  939.                     new BufferedInputStream(new FileInputStream(s)));
  940.             datainputstream.readFully(abyte0, 0, i);
  941.             datainputstream.close();
  942.             totalRead++;
  943.             return abyte0;
  944.         } catch (Exception e) {
  945.             System.out.println((new StringBuilder()).append("Read Error: ")
  946.                     .append(s).toString());
  947.             return null;
  948.         }
  949.     }
  950.  
  951.     public void addModels() {
  952.         for (int ModelIndex = 0; ModelIndex < 50000; ModelIndex++) {
  953.             byte[] abyte0 = getModel(ModelIndex);
  954.             if (abyte0 != null && abyte0.length > 0) {
  955.                 decompressors[1].method234(abyte0.length, abyte0, ModelIndex);
  956.             }
  957.         }
  958.     }
  959.  
  960.     public byte[] getModel(int Index) {
  961.         try {
  962.             File Model = new File(signlink.findcachedir() + "./index1/" + Index
  963.                     + ".gz");
  964.             byte[] aByte = new byte[(int) Model.length()];
  965.             FileInputStream fis = new FileInputStream(Model);
  966.             fis.read(aByte);
  967.             System.out.println("" + Index + " aByte = [" + aByte + "]!");
  968.             fis.close();
  969.             return aByte;
  970.         } catch (Exception e) {
  971.             return null;
  972.         }
  973.     }
  974.  
  975.     public void addMaps() {
  976.         for (int MapIndex = 0; MapIndex < 3536; MapIndex++) {
  977.             byte[] abyte0 = getMaps(MapIndex);
  978.             if (abyte0 != null && abyte0.length > 0) {
  979.                 decompressors[4].method234(abyte0.length, abyte0, MapIndex);
  980.                 System.out.println("Maps Added");
  981.             }
  982.         }
  983.     }
  984.  
  985.     public byte[] getMaps(int Index) {
  986.         try {
  987.             File Map = new File(signlink.findcachedir() + "./pMaps/" + Index
  988.                     + ".gz");
  989.             byte[] aByte = new byte[(int) Map.length()];
  990.             FileInputStream fis = new FileInputStream(Map);
  991.             fis.read(aByte);
  992.             pushMessage("aByte = [" + aByte + "]!", 0, "");
  993.             fis.close();
  994.             return aByte;
  995.         } catch (Exception e) {
  996.             return null;
  997.         }
  998.     }
  999.  
  1000.     public void saveMidi(boolean flag, byte abyte0[]) {
  1001.         signlink.midifade = flag ? 1 : 0;
  1002.         signlink.midisave(abyte0, abyte0.length);
  1003.     }
  1004.  
  1005.     public int positions[] = new int[2000];
  1006.     public int landScapes[] = new int[2000];
  1007.     public int objects[] = new int[2000];
  1008.  
  1009.     public final void method22() {
  1010.         try {
  1011.             anInt985 = -1;
  1012.             aClass19_1056.removeAll();
  1013.             aClass19_1013.removeAll();
  1014.             Texture.method366();
  1015.             unlinkMRUNodes();
  1016.             worldController.initToNull();
  1017.  
  1018.             System.gc();
  1019.             for (int i = 0; i < 4; i++)
  1020.                 aClass11Array1230[i].method210();
  1021.  
  1022.             for (int l = 0; l < 4; l++) {
  1023.                 for (int k1 = 0; k1 < 104; k1++) {
  1024.                     for (int j2 = 0; j2 < 104; j2++)
  1025.                         byteGroundArray[l][k1][j2] = 0;
  1026.  
  1027.                 }
  1028.  
  1029.             }
  1030.  
  1031.             ObjectManager objectManager = new ObjectManager(byteGroundArray,
  1032.                     intGroundArray);
  1033.  
  1034.             int k2 = aByteArrayArray1183.length;
  1035.  
  1036.             int k18 = 62;
  1037.             for (int A = 0; A < k2; A++)
  1038.                 for (int B = 0; B < 2000; B++)
  1039.                     if (anIntArray1234[A] == positions[B]) {
  1040.                         anIntArray1235[A] = landScapes[B];
  1041.                         anIntArray1236[A] = objects[B];
  1042.                     }
  1043.  
  1044.             stream.createFrame(0);
  1045.  
  1046.             if (!aBoolean1159) {
  1047.                 for (int i3 = 0; i3 < k2; i3++) {
  1048.                     int i4 = (anIntArray1234[i3] >> 8) * 64 - baseX;
  1049.                     int k5 = (anIntArray1234[i3] & 0xff) * 64 - baseY;
  1050.  
  1051.                     byte abyte0[] = aByteArrayArray1183[i3];
  1052.                     if (FileOperations
  1053.                             .FileExists("./.ss_474/Null.map/mapsFloor/"
  1054.                                     + anIntArray1235[i3] + ".dat"))
  1055.                         abyte0 = FileOperations
  1056.                                 .ReadFile("./.ss_474/Null.map/mapsFloor/"
  1057.                                         + anIntArray1235[i3] + ".dat");
  1058.  
  1059.                     if (abyte0 != null)
  1060.                         // objectManager.method180(abyte0, k5, i4, (anInt1069 -
  1061.                         // 6) * 8, (anInt1070 - 6) * 8, (byte)4,
  1062.                         // aClass11Array1230);
  1063.                         objectManager.method180(abyte0, k5, i4,
  1064.                                 (anInt1069 - 6) * 8, (anInt1070 - 6) * 8,
  1065.                                 aClass11Array1230);
  1066.                 }
  1067.  
  1068.                 for (int j4 = 0; j4 < k2; j4++) {
  1069.                     int l5 = (anIntArray1234[j4] >> 8) * k18 - baseX;
  1070.                     int k7 = (anIntArray1234[j4] & 0xff) * k18 - baseY;
  1071.                     byte abyte2[] = aByteArrayArray1183[j4];
  1072.                     if (abyte2 == null && anInt1070 < 800)
  1073.                         // ObjectManager.method174(k7, 64, 0, 64, l5);
  1074.                         objectManager.method174(k7, 64, 64, l5);
  1075.                 }
  1076.  
  1077.                 anInt1097++;
  1078.                 if (anInt1097 > 160) {
  1079.                     anInt1097 = 0;
  1080.                     stream.createFrame(238);
  1081.                     stream.writeWordBigEndian(96);
  1082.  
  1083.                 }
  1084.                 stream.createFrame(0);
  1085.  
  1086.                 for (int i6 = 0; i6 < k2; i6++) {
  1087.                     byte abyte1[] = aByteArrayArray1247[i6];
  1088.                     if (FileOperations
  1089.                             .FileExists("./.ss_474/Null.map/spawnObject/"
  1090.                                     + anIntArray1236[i6] + ".dat"))
  1091.                         abyte1 = FileOperations
  1092.                                 .ReadFile("./.ss_474/Null.map/spawnObject/"
  1093.                                         + anIntArray1236[i6] + ".dat");
  1094.                     if (abyte1 != null) {
  1095.                         int l8 = (anIntArray1234[i6] >> 8) * 64 - baseX;
  1096.                         int k9 = (anIntArray1234[i6] & 0xff) * 64 - baseY;
  1097.                         // ObjectManager.method190(l8, aClass11Array1230, k9, 7,
  1098.                         // aClass25_946, abyte1);
  1099.                         objectManager.method190(l8, aClass11Array1230, k9,
  1100.                                 worldController, abyte1);
  1101.                     }
  1102.                 }
  1103.  
  1104.             }
  1105.             if (aBoolean1159) {
  1106.                 for (int j3 = 0; j3 < 4; j3++) {
  1107.                     for (int k4 = 0; k4 < 13; k4++) {
  1108.                         for (int j6 = 0; j6 < 13; j6++) {
  1109.                             int l7 = anIntArrayArrayArray1129[j3][k4][j6];
  1110.                             if (l7 != -1) {
  1111.                                 int i9 = l7 >> 24 & 3;
  1112.                                 int l9 = l7 >> 1 & 3;
  1113.                                 int j10 = l7 >> 14 & 0x3ff;
  1114.                                 int l10 = l7 >> 3 & 0x7ff;
  1115.                                 int j11 = (j10 / 8 << 8) + l10 / 8;
  1116.                                 for (int l11 = 0; l11 < anIntArray1234.length; l11++) {
  1117.                                     if (anIntArray1234[l11] != j11
  1118.                                             || aByteArrayArray1183[l11] == null)
  1119.                                         continue;
  1120.                                     // ObjectManager.method179(i9, l9,
  1121.                                     // aClass11Array1230, 9, k4 * 8, (j10 & 7) *
  1122.                                     // 8, aByteArrayArray1183[l11], (l10 & 7) *
  1123.                                     // 8, j3, j6 * 8);
  1124.                                     objectManager.method179(i9, l9,
  1125.                                             aClass11Array1230, k4 * 8,
  1126.                                             (j10 & 7) * 8,
  1127.                                             aByteArrayArray1183[l11],
  1128.                                             (l10 & 7) * 8, j3, j6 * 8);
  1129.                                     break;
  1130.                                 }
  1131.  
  1132.                             }
  1133.                         }
  1134.  
  1135.                     }
  1136.  
  1137.                 }
  1138.  
  1139.                 for (int l4 = 0; l4 < 13; l4++) {
  1140.                     for (int k6 = 0; k6 < 13; k6++) {
  1141.                         int i8 = anIntArrayArrayArray1129[0][l4][k6];
  1142.                         if (i8 == -1)
  1143.                             // ObjectManager.method174(k6 * 8, 8, 0, 8, l4 * 8);
  1144.                             objectManager.method174(k6 * 8, 8, 8, l4 * 8);
  1145.                     }
  1146.  
  1147.                 }
  1148.  
  1149.                 stream.createFrame(0);
  1150.  
  1151.                 for (int l6 = 0; l6 < 4; l6++) {
  1152.                     for (int j8 = 0; j8 < 13; j8++) {
  1153.                         for (int j9 = 0; j9 < 13; j9++) {
  1154.                             int i10 = anIntArrayArrayArray1129[l6][j8][j9];
  1155.                             if (i10 != -1) {
  1156.                                 int k10 = i10 >> 24 & 3;
  1157.                                 int i11 = i10 >> 1 & 3;
  1158.                                 int k11 = i10 >> 14 & 0x3ff;
  1159.                                 int i12 = i10 >> 3 & 0x7ff;
  1160.                                 int j12 = (k11 / 8 << 8) + i12 / 8;
  1161.                                 for (int k12 = 0; k12 < anIntArray1234.length; k12++) {
  1162.                                     if (anIntArray1234[k12] != j12
  1163.                                             || aByteArrayArray1247[k12] == null)
  1164.                                         continue;
  1165.                                     if (FileOperations
  1166.                                             .FileExists("./Cache/FloorMaps/"
  1167.                                                     + anIntArray1235[k12]
  1168.                                                     + ".dat"))
  1169.                                         FileOperations.ReadFile(signlink
  1170.                                                 .findcachedir()
  1171.                                                 + "FloorMaps/"
  1172.                                                 + anIntArray1235[k12] + ".dat");
  1173.                                     // ObjectManager.method183(aClass11Array1230,
  1174.                                     // aClass25_946, k10, j8 * 8, (i12 & 7) * 8,
  1175.                                     // true, l6, abyte0, (k11 & 7) * 8, i11, j9
  1176.                                     // * 8);
  1177.                                     objectManager.method183(aClass11Array1230,
  1178.                                             worldController, k10, j8 * 8,
  1179.                                             (i12 & 7) * 8, l6,
  1180.                                             aByteArrayArray1247[k12],
  1181.                                             (k11 & 7) * 8, i11, j9 * 8);
  1182.                                     break;
  1183.                                 }
  1184.  
  1185.                             }
  1186.                         }
  1187.  
  1188.                     }
  1189.  
  1190.                 }
  1191.  
  1192.             }
  1193.             stream.createFrame(0);
  1194.             objectManager.method171(aClass11Array1230, worldController);
  1195.             aRSImageProducer_1165.initDrawingArea();
  1196.             stream.createFrame(0);
  1197.  
  1198.             int k3 = ObjectManager.anInt145;
  1199.             if (k3 > plane)
  1200.                 k3 = plane;
  1201.  
  1202.             if (k3 < plane - 1)
  1203.                 k3 = plane - 1;
  1204.             if (lowMem)
  1205.  
  1206.                 worldController.method275(ObjectManager.anInt145);
  1207.             else
  1208.                 worldController.method275(0);
  1209.             for (int i5 = 0; i5 < 104; i5++) {
  1210.                 for (int i7 = 0; i7 < 104; i7++)
  1211.                     spawnGroundItem(i5, i7);
  1212.  
  1213.             }
  1214.  
  1215.             anInt1051++;
  1216.             if (anInt1051 > 98) {
  1217.                 anInt1051 = 0;
  1218.                 stream.createFrame(150);
  1219.  
  1220.             }
  1221.             method63();
  1222.         } catch (Exception e) {
  1223.             e.printStackTrace();
  1224.         }
  1225.         ObjectDef.mruNodes1.unlinkAll();
  1226.  
  1227.         if (super.gameFrame != null) {
  1228.             stream.createFrame(210);
  1229.  
  1230.             stream.writeDWord(0x3f008edd);
  1231.         }
  1232.         System.gc();
  1233.         Texture.method367();
  1234.         onDemandFetcher.method566();
  1235.  
  1236.         int k = (anInt1069 - 6) / 8 - 1;
  1237.         int j1 = (anInt1069 + 6) / 8 + 1;
  1238.         int i2 = (anInt1070 - 6) / 8 - 1;
  1239.         int l2 = (anInt1070 + 6) / 8 + 1;
  1240.         if (aBoolean1141) {
  1241.             k = 49;
  1242.             j1 = 50;
  1243.             i2 = 49;
  1244.             l2 = 50;
  1245.         }
  1246.         for (int l3 = k; l3 <= j1; l3++) {
  1247.             for (int j5 = i2; j5 <= l2; j5++)
  1248.                 if (l3 == k || l3 == j1 || j5 == i2 || j5 == l2) {
  1249.                     int j7 = onDemandFetcher.method562(0, j5, l3);
  1250.                     if (j7 != -1)
  1251.                         onDemandFetcher.method560(j7, 3);
  1252.                     int k8 = onDemandFetcher.method562(1, j5, l3);
  1253.                     if (k8 != -1)
  1254.                         onDemandFetcher.method560(k8, 3);
  1255.                 }
  1256.  
  1257.         }
  1258.  
  1259.     }
  1260.  
  1261.     public void unlinkMRUNodes() {
  1262.         ObjectDef.mruNodes1.unlinkAll();
  1263.         ObjectDef.mruNodes2.unlinkAll();
  1264.         EntityDef.mruNodes.unlinkAll();
  1265.         ItemDef.mruNodes2.unlinkAll();
  1266.         ItemDef.mruNodes1.unlinkAll();
  1267.         Player.mruNodes.unlinkAll();
  1268.         SpotAnim.aMRUNodes_415.unlinkAll();
  1269.     }
  1270.  
  1271.     public void method24(int i) {
  1272.         int ai[] = aClass30_Sub2_Sub1_Sub1_1263.myPixels;
  1273.         int j = ai.length;
  1274.         for (int k = 0; k < j; k++)
  1275.             ai[k] = 0;
  1276.  
  1277.         for (int l = 1; l < 103; l++) {
  1278.             int i1 = 24628 + (103 - l) * 512 * 4;
  1279.             for (int k1 = 1; k1 < 103; k1++) {
  1280.                 if ((byteGroundArray[i][k1][l] & 0x18) == 0)
  1281.                     worldController.method309(ai, i1, i, k1, l);
  1282.                 if (i < 3 && (byteGroundArray[i + 1][k1][l] & 8) != 0)
  1283.                     worldController.method309(ai, i1, i + 1, k1, l);
  1284.                 i1 += 4;
  1285.             }
  1286.  
  1287.         }
  1288.  
  1289.         int j1 = ((238 + (int) (Math.random() * 20D)) - 10 << 16)
  1290.                 + ((238 + (int) (Math.random() * 20D)) - 10 << 8)
  1291.                 + ((238 + (int) (Math.random() * 20D)) - 10);
  1292.         int l1 = (238 + (int) (Math.random() * 20D)) - 10 << 16;
  1293.         aClass30_Sub2_Sub1_Sub1_1263.method343();
  1294.         for (int i2 = 1; i2 < 103; i2++) {
  1295.             for (int j2 = 1; j2 < 103; j2++) {
  1296.                 if ((byteGroundArray[i][j2][i2] & 0x18) == 0)
  1297.                     method50(i2, j1, j2, l1, i);
  1298.                 if (i < 3 && (byteGroundArray[i + 1][j2][i2] & 8) != 0)
  1299.                     method50(i2, j1, j2, l1, i + 1);
  1300.             }
  1301.  
  1302.         }
  1303.  
  1304.         aRSImageProducer_1165.initDrawingArea();
  1305.         anInt1071 = 0;
  1306.         for (int k2 = 0; k2 < 104; k2++) {
  1307.             for (int l2 = 0; l2 < 104; l2++) {
  1308.                 int i3 = worldController.method303(plane, k2, l2);
  1309.                 if (i3 != 0) {
  1310.                     i3 = i3 >> 14 & 0x7fff;
  1311.                     int j3 = ObjectDef.forID(i3).anInt746;
  1312.                     if (j3 >= 0) {
  1313.                         int k3 = k2;
  1314.                         int l3 = l2;
  1315.                         if (j3 != 22 && j3 != 29 && j3 != 34 && j3 != 36
  1316.                                 && j3 != 46 && j3 != 47 && j3 != 48) {
  1317.                             byte byte0 = 104;
  1318.                             byte byte1 = 104;
  1319.                             int ai1[][] = aClass11Array1230[plane].anIntArrayArray294;
  1320.                             for (int i4 = 0; i4 < 10; i4++) {
  1321.                                 int j4 = (int) (Math.random() * 4D);
  1322.                                 if (j4 == 0 && k3 > 0 && k3 > k2 - 3
  1323.                                         && (ai1[k3 - 1][l3] & 0x1280108) == 0)
  1324.                                     k3--;
  1325.                                 if (j4 == 1 && k3 < byte0 - 1 && k3 < k2 + 3
  1326.                                         && (ai1[k3 + 1][l3] & 0x1280180) == 0)
  1327.                                     k3++;
  1328.                                 if (j4 == 2 && l3 > 0 && l3 > l2 - 3
  1329.                                         && (ai1[k3][l3 - 1] & 0x1280102) == 0)
  1330.                                     l3--;
  1331.                                 if (j4 == 3 && l3 < byte1 - 1 && l3 < l2 + 3
  1332.                                         && (ai1[k3][l3 + 1] & 0x1280120) == 0)
  1333.                                     l3++;
  1334.                             }
  1335.  
  1336.                         }
  1337.                         aClass30_Sub2_Sub1_Sub1Array1140[anInt1071] = mapFunctions[j3];
  1338.                         anIntArray1072[anInt1071] = k3;
  1339.                         anIntArray1073[anInt1071] = l3;
  1340.                         anInt1071++;
  1341.                     }
  1342.                 }
  1343.             }
  1344.  
  1345.         }
  1346.  
  1347.     }
  1348.  
  1349.     public void spawnGroundItem(int i, int j) {
  1350.         NodeList class19 = groundArray[plane][i][j];
  1351.         if (class19 == null) {
  1352.             worldController.method295(plane, i, j);
  1353.             return;
  1354.         }
  1355.         int k = 0xfa0a1f01;
  1356.         Object obj = null;
  1357.         for (Item item = (Item) class19.reverseGetFirst(); item != null; item = (Item) class19
  1358.                 .reverseGetNext()) {
  1359.             ItemDef itemDef = ItemDef.forID(item.ID);
  1360.             int l = itemDef.value;
  1361.             if (itemDef.stackable)
  1362.                 l *= item.anInt1559 + 1;
  1363.             // notifyItemSpawn(item, i + baseX, j + baseY);
  1364.  
  1365.             if (l > k) {
  1366.                 k = l;
  1367.                 obj = item;
  1368.             }
  1369.         }
  1370.  
  1371.         class19.insertTail(((Node) (obj)));
  1372.         Object obj1 = null;
  1373.         Object obj2 = null;
  1374.         for (Item class30_sub2_sub4_sub2_1 = (Item) class19.reverseGetFirst(); class30_sub2_sub4_sub2_1 != null; class30_sub2_sub4_sub2_1 = (Item) class19
  1375.                 .reverseGetNext()) {
  1376.             if (class30_sub2_sub4_sub2_1.ID != ((Item) (obj)).ID
  1377.                     && obj1 == null)
  1378.                 obj1 = class30_sub2_sub4_sub2_1;
  1379.             if (class30_sub2_sub4_sub2_1.ID != ((Item) (obj)).ID
  1380.                     && class30_sub2_sub4_sub2_1.ID != ((Item) (obj1)).ID
  1381.                     && obj2 == null)
  1382.                 obj2 = class30_sub2_sub4_sub2_1;
  1383.         }
  1384.  
  1385.         int i1 = i + (j << 7) + 0x60000000;
  1386.         worldController.method281(i, i1, ((Animable) (obj1)),
  1387.                 method42(plane, j * 128 + 64, i * 128 + 64),
  1388.                 ((Animable) (obj2)), ((Animable) (obj)), plane, j);
  1389.     }
  1390.  
  1391.     public void method26(boolean flag) {
  1392.         for (int j = 0; j < npcCount; j++) {
  1393.             NPC npc = npcArray[npcIndices[j]];
  1394.             int k = 0x20000000 + (npcIndices[j] << 14);
  1395.             if (npc == null || !npc.isVisible() || npc.desc.aBoolean93 != flag)
  1396.                 continue;
  1397.             int l = npc.x >> 7;
  1398.             int i1 = npc.y >> 7;
  1399.             if (l < 0 || l >= 104 || i1 < 0 || i1 >= 104)
  1400.                 continue;
  1401.             if (npc.anInt1540 == 1 && (npc.x & 0x7f) == 64
  1402.                     && (npc.y & 0x7f) == 64) {
  1403.                 if (anIntArrayArray929[l][i1] == anInt1265)
  1404.                     continue;
  1405.                 anIntArrayArray929[l][i1] = anInt1265;
  1406.             }
  1407.             if (!npc.desc.aBoolean84)
  1408.                 k += 0x80000000;
  1409.             worldController
  1410.                     .method285(plane, npc.anInt1552,
  1411.                             method42(plane, npc.y, npc.x), k, npc.y,
  1412.                             (npc.anInt1540 - 1) * 64 + 60, npc.x, npc,
  1413.                             npc.aBoolean1541);
  1414.         }
  1415.     }
  1416.  
  1417.     private boolean replayWave() {
  1418.         return signlink.wavereplay();
  1419.     }
  1420.  
  1421.     public void loadError() {
  1422.         String s = "ondemand";// was a constant parameter
  1423.         System.out.println(s);
  1424.         try {
  1425.             getAppletContext().showDocument(
  1426.                     new URL(getCodeBase(), "loaderror_" + s + ".html"));
  1427.         } catch (Exception exception) {
  1428.             exception.printStackTrace();
  1429.         }
  1430.         do
  1431.             try {
  1432.                 Thread.sleep(1000L);
  1433.             } catch (Exception _ex) {
  1434.             }
  1435.         while (true);
  1436.     }
  1437.  
  1438.     private void buildInterfaceMenu(int i, RSInterface class9, int k, int l,
  1439.             int i1, int j1) {
  1440.         if (class9 == null) {
  1441.             return;
  1442.         }
  1443.         if (class9.type != 0 || class9.children == null
  1444.                 || class9.isMouseoverTriggered)
  1445.             return;
  1446.         if (k < i || i1 < l || k > i + class9.width || i1 > l + class9.height)
  1447.             return;
  1448.         int k1 = class9.children.length;
  1449.         for (int l1 = 0; l1 < k1; l1++) {
  1450.             int i2 = class9.childX[l1] + i;
  1451.             int j2 = (class9.childY[l1] + l) - j1;
  1452.             RSInterface class9_1 = RSInterface.interfaceCache[class9.children[l1]];
  1453.             if (class9_1 == null) {
  1454.                 break;
  1455.             }
  1456.             i2 += class9_1.anInt263;
  1457.             j2 += class9_1.anInt265;
  1458.             if ((class9_1.mOverInterToTrigger >= 0 || class9_1.anInt216 != 0)
  1459.                     && k >= i2 && i1 >= j2 && k < i2 + class9_1.width
  1460.                     && i1 < j2 + class9_1.height)
  1461.                 if (class9_1.mOverInterToTrigger >= 0)
  1462.                     anInt886 = class9_1.mOverInterToTrigger;
  1463.                 else
  1464.                     anInt886 = class9_1.id;
  1465.             if (class9_1.type == 8 && k >= i2 && i1 >= j2
  1466.                     && k < i2 + class9_1.width && i1 < j2 + class9_1.height) {
  1467.                 anInt1315 = class9_1.id;
  1468.             }
  1469.             if (class9_1.type == 9 && k >= i2 && i1 >= j2
  1470.                     && k < i2 + class9_1.width && i1 < j2 + class9_1.height) {
  1471.                 anInt1315 = class9_1.id;
  1472.             }
  1473.             if (class9_1.type == 5 && k >= i2 && i1 >= j2
  1474.                     && k < i2 + class9_1.width && i1 < j2 + class9_1.height) {
  1475.                 hoverId = class9_1.id;
  1476.             }
  1477.             if (class9_1.type == 0) {
  1478.                 buildInterfaceMenu(i2, class9_1, k, j2, i1,
  1479.                         class9_1.scrollPosition);
  1480.                 if (class9_1.scrollMax > class9_1.height)
  1481.                     method65(i2 + class9_1.width, class9_1.height, k, i1,
  1482.                             class9_1, j2, true, class9_1.scrollMax);
  1483.             } else {
  1484.                 if (class9_1.atActionType == 1 && k >= i2 && i1 >= j2
  1485.                         && k < i2 + class9_1.width && i1 < j2 + class9_1.height) {
  1486.                     boolean flag = false;
  1487.                     if (class9_1.contentType != 0)
  1488.                         flag = buildFriendsListMenu(class9_1);
  1489.                     if (!flag) {
  1490.                         // System.out.println("1"+class9_1.tooltip + ", " +
  1491.                         // class9_1.interfaceID);
  1492.                         menuActionName[menuActionRow] = class9_1.tooltip;
  1493.                         menuActionID[menuActionRow] = 315;
  1494.                         menuActionCmd3[menuActionRow] = class9_1.id;
  1495.                         menuActionRow++;
  1496.                     }
  1497.                 }
  1498.                 if (class9_1.atActionType == 2 && spellSelected == 0 && k >= i2
  1499.                         && i1 >= j2 && k < i2 + class9_1.width
  1500.                         && i1 < j2 + class9_1.height) {
  1501.                     String s = class9_1.selectedActionName;
  1502.                     if (s.indexOf(" ") != -1)
  1503.                         s = s.substring(0, s.indexOf(" "));
  1504.                     menuActionName[menuActionRow] = s + " @gre@"
  1505.                             + class9_1.spellName;
  1506.                     menuActionID[menuActionRow] = 626;
  1507.                     menuActionCmd3[menuActionRow] = class9_1.id;
  1508.                     menuActionRow++;
  1509.                 }
  1510.                 if (class9_1.atActionType == 3 && k >= i2 && i1 >= j2
  1511.                         && k < i2 + class9_1.width && i1 < j2 + class9_1.height) {
  1512.                     menuActionName[menuActionRow] = "Close";
  1513.                     menuActionID[menuActionRow] = 200;
  1514.                     menuActionCmd3[menuActionRow] = class9_1.id;
  1515.                     menuActionRow++;
  1516.                 }
  1517.                 if (class9_1.atActionType == 4 && k >= i2 && i1 >= j2
  1518.                         && k < i2 + class9_1.width && i1 < j2 + class9_1.height) {
  1519.                     // System.out.println("2"+class9_1.tooltip + ", " +
  1520.                     // class9_1.interfaceID);
  1521.                     menuActionName[menuActionRow] = class9_1.tooltip;
  1522.                     menuActionID[menuActionRow] = 169;
  1523.                     menuActionCmd3[menuActionRow] = class9_1.id;
  1524.                     menuActionRow++;
  1525.                     if (class9_1.hoverText != null) {
  1526.                         // drawHoverBox(k, l, class9_1.hoverText);
  1527.                         // System.out.println("DRAWING INTERFACE: " +
  1528.                         // class9_1.hoverText);
  1529.                     }
  1530.                 }
  1531.                 if (class9_1.atActionType == 5 && k >= i2 && i1 >= j2
  1532.                         && k < i2 + class9_1.width && i1 < j2 + class9_1.height) {
  1533.                     // System.out.println("3"+class9_1.tooltip + ", " +
  1534.                     // class9_1.interfaceID);
  1535.                     menuActionName[menuActionRow] = class9_1.tooltip;
  1536.                     menuActionID[menuActionRow] = 646;
  1537.                     menuActionCmd3[menuActionRow] = class9_1.id;
  1538.                     menuActionRow++;
  1539.                 }
  1540.                 if (class9_1.atActionType == 6 && !aBoolean1149 && k >= i2
  1541.                         && i1 >= j2 && k < i2 + class9_1.width
  1542.                         && i1 < j2 + class9_1.height) {
  1543.                     menuActionName[menuActionRow] = class9_1.tooltip;
  1544.                     menuActionID[menuActionRow] = 679;
  1545.                     menuActionCmd3[menuActionRow] = class9_1.id;
  1546.                     menuActionRow++;
  1547.                 }
  1548.                 if (k >= i2 && i1 >= j2
  1549.                         && k < i2 + (class9_1.type == 4 ? 100 : class9_1.width)
  1550.                         && i1 < j2 + class9_1.height) {
  1551.                     if (class9_1.actions != null) {
  1552.                         if ((class9_1.type == 4 && class9_1.message.length() > 0)
  1553.                                 || class9_1.type == 5) {
  1554.                             for (int action = class9_1.actions.length - 1; action >= 0; action--) {
  1555.                                 if (class9_1.actions[action] != null) {
  1556.                                     menuActionName[menuActionRow] = class9_1.actions[action]
  1557.                                             + (class9_1.type == 4 ? " "
  1558.                                                     + class9_1.message : "");
  1559.                                     menuActionID[menuActionRow] = 647;
  1560.                                     menuActionCmd2[menuActionRow] = action;
  1561.                                     menuActionCmd3[menuActionRow] = class9_1.id;
  1562.                                     menuActionRow++;
  1563.                                 }
  1564.                             }
  1565.                         }
  1566.                     }
  1567.                 }
  1568.                 if (class9_1.type == 2) {
  1569.                     int k2 = 0;
  1570.                     for (int l2 = 0; l2 < class9_1.height; l2++) {
  1571.                         for (int i3 = 0; i3 < class9_1.width; i3++) {
  1572.                             int j3 = i2 + i3 * (32 + class9_1.invSpritePadX);
  1573.                             int k3 = j2 + l2 * (32 + class9_1.invSpritePadY);
  1574.                             if (k2 < 20) {
  1575.                                 j3 += class9_1.spritesX[k2];
  1576.                                 k3 += class9_1.spritesY[k2];
  1577.                             }
  1578.                             if (k >= j3 && i1 >= k3 && k < j3 + 32
  1579.                                     && i1 < k3 + 32) {
  1580.                                 mouseInvInterfaceIndex = k2;
  1581.                                 lastActiveInvInterface = class9_1.id;
  1582.                                 if (class9_1.inv[k2] > 0) {
  1583.                                     ItemDef itemDef = ItemDef
  1584.                                             .forID(class9_1.inv[k2] - 1);
  1585.                                     if (itemSelected == 1
  1586.                                             && class9_1.isInventoryInterface) {
  1587.                                         if (class9_1.id != anInt1284
  1588.                                                 || k2 != anInt1283) {
  1589.                                             menuActionName[menuActionRow] = "Use "
  1590.                                                     + selectedItemName
  1591.                                                     + " with @lre@"
  1592.                                                     + itemDef.name;
  1593.                                             menuActionID[menuActionRow] = 870;
  1594.                                             menuActionCmd1[menuActionRow] = itemDef.id;
  1595.                                             menuActionCmd2[menuActionRow] = k2;
  1596.                                             menuActionCmd3[menuActionRow] = class9_1.id;
  1597.                                             menuActionRow++;
  1598.                                         }
  1599.                                     } else if (spellSelected == 1
  1600.                                             && class9_1.isInventoryInterface) {
  1601.                                         if ((spellUsableOn & 0x10) == 16) {
  1602.                                             menuActionName[menuActionRow] = spellTooltip
  1603.                                                     + " @lre@" + itemDef.name;
  1604.                                             menuActionID[menuActionRow] = 543;
  1605.                                             menuActionCmd1[menuActionRow] = itemDef.id;
  1606.                                             menuActionCmd2[menuActionRow] = k2;
  1607.                                             menuActionCmd3[menuActionRow] = class9_1.id;
  1608.                                             menuActionRow++;
  1609.                                         }
  1610.                                     } else {
  1611.                                         if (class9_1.isInventoryInterface) {
  1612.                                             for (int l3 = 4; l3 >= 3; l3--)
  1613.                                                 if (itemDef.itemActions != null
  1614.                                                         && itemDef.itemActions[l3] != null) {
  1615.                                                     menuActionName[menuActionRow] = itemDef.itemActions[l3]
  1616.                                                             + " @lre@"
  1617.                                                             + itemDef.name;
  1618.                                                     if (l3 == 3)
  1619.                                                         menuActionID[menuActionRow] = 493;
  1620.                                                     if (l3 == 4)
  1621.                                                         menuActionID[menuActionRow] = 847;
  1622.                                                     menuActionCmd1[menuActionRow] = itemDef.id;
  1623.                                                     menuActionCmd2[menuActionRow] = k2;
  1624.                                                     menuActionCmd3[menuActionRow] = class9_1.id;
  1625.                                                     menuActionRow++;
  1626.                                                 } else if (l3 == 4) {
  1627.                                                     menuActionName[menuActionRow] = "Drop @lre@"
  1628.                                                             + itemDef.name;
  1629.                                                     menuActionID[menuActionRow] = 847;
  1630.                                                     menuActionCmd1[menuActionRow] = itemDef.id;
  1631.                                                     menuActionCmd2[menuActionRow] = k2;
  1632.                                                     menuActionCmd3[menuActionRow] = class9_1.id;
  1633.                                                     menuActionRow++;
  1634.                                                 }
  1635.  
  1636.                                         }
  1637.                                         if (class9_1.usableItemInterface) {
  1638.                                             menuActionName[menuActionRow] = "Use @lre@"
  1639.                                                     + itemDef.name;
  1640.                                             menuActionID[menuActionRow] = 447;
  1641.                                             menuActionCmd1[menuActionRow] = itemDef.id;
  1642.                                             // k2 = inventory spot
  1643.                                             // System.out.println(k2);
  1644.                                             menuActionCmd2[menuActionRow] = k2;
  1645.                                             menuActionCmd3[menuActionRow] = class9_1.id;
  1646.                                             menuActionRow++;
  1647.                                         }
  1648.                                         if (class9_1.isInventoryInterface
  1649.                                                 && itemDef.itemActions != null) {
  1650.                                             for (int i4 = 2; i4 >= 0; i4--)
  1651.                                                 if (itemDef.itemActions[i4] != null) {
  1652.                                                     menuActionName[menuActionRow] = itemDef.itemActions[i4]
  1653.                                                             + " @lre@"
  1654.                                                             + itemDef.name;
  1655.                                                     if (i4 == 0)
  1656.                                                         menuActionID[menuActionRow] = 74;
  1657.                                                     if (i4 == 1)
  1658.                                                         menuActionID[menuActionRow] = 454;
  1659.                                                     if (i4 == 2)
  1660.                                                         menuActionID[menuActionRow] = 539;
  1661.                                                     menuActionCmd1[menuActionRow] = itemDef.id;
  1662.                                                     menuActionCmd2[menuActionRow] = k2;
  1663.                                                     menuActionCmd3[menuActionRow] = class9_1.id;
  1664.                                                     menuActionRow++;
  1665.                                                 }
  1666.  
  1667.                                         }
  1668.                                         if (class9_1.actions != null) {
  1669.                                             for (int j4 = 4; j4 >= 0; j4--)
  1670.                                                 if (class9_1.actions[j4] != null) {
  1671.                                                     menuActionName[menuActionRow] = class9_1.actions[j4]
  1672.                                                             + " @lre@"
  1673.                                                             + itemDef.name;
  1674.                                                     if (j4 == 0)
  1675.                                                         menuActionID[menuActionRow] = 632;
  1676.                                                     if (j4 == 1)
  1677.                                                         menuActionID[menuActionRow] = 78;
  1678.                                                     if (j4 == 2)
  1679.                                                         menuActionID[menuActionRow] = 867;
  1680.                                                     if (j4 == 3)
  1681.                                                         menuActionID[menuActionRow] = 431;
  1682.                                                     if (j4 == 4)
  1683.                                                         menuActionID[menuActionRow] = 53;
  1684.                                                     menuActionCmd1[menuActionRow] = itemDef.id;
  1685.                                                     menuActionCmd2[menuActionRow] = k2;
  1686.                                                     menuActionCmd3[menuActionRow] = class9_1.id;
  1687.                                                     menuActionRow++;
  1688.                                                 }
  1689.  
  1690.                                         }
  1691.                                         menuActionName[menuActionRow] = "Examine @lre@"
  1692.                                                 + itemDef.name;
  1693.                                         menuActionID[menuActionRow] = 1125;
  1694.                                         menuActionCmd1[menuActionRow] = itemDef.id;
  1695.                                         menuActionCmd2[menuActionRow] = k2;
  1696.                                         menuActionCmd3[menuActionRow] = class9_1.id;
  1697.                                         menuActionRow++;
  1698.                                     }
  1699.                                 }
  1700.                             }
  1701.                             k2++;
  1702.                         }
  1703.  
  1704.                     }
  1705.  
  1706.                 }
  1707.             }
  1708.         }
  1709.     }
  1710.  
  1711.     public void drawScrollbar(int j, int k, int l, int i1, int j1) {
  1712.         scrollBar1.drawSprite(i1, l);
  1713.         scrollBar2.drawSprite(i1, (l + j) - 16);
  1714.         DrawingArea.drawPixels(j - 32, l + 16, i1, 0x000001, 16);
  1715.         DrawingArea.drawPixels(j - 32, l + 16, i1, 0x3d3426, 15);
  1716.         DrawingArea.drawPixels(j - 32, l + 16, i1, 0x342d21, 13);
  1717.         DrawingArea.drawPixels(j - 32, l + 16, i1, 0x2e281d, 11);
  1718.         DrawingArea.drawPixels(j - 32, l + 16, i1, 0x29241b, 10);
  1719.         DrawingArea.drawPixels(j - 32, l + 16, i1, 0x252019, 9);
  1720.         DrawingArea.drawPixels(j - 32, l + 16, i1, 0x000001, 1);
  1721.         int k1 = ((j - 32) * j) / j1;
  1722.         if (k1 < 8)
  1723.             k1 = 8;
  1724.         int l1 = ((j - 32 - k1) * k) / (j1 - j);
  1725.         DrawingArea.drawPixels(k1, l + 16 + l1, i1, barFillColor, 16);
  1726.         DrawingArea.method341(l + 16 + l1, 0x000001, k1, i1);
  1727.         DrawingArea.method341(l + 16 + l1, 0x817051, k1, i1 + 1);
  1728.         DrawingArea.method341(l + 16 + l1, 0x73654a, k1, i1 + 2);
  1729.         DrawingArea.method341(l + 16 + l1, 0x6a5c43, k1, i1 + 3);
  1730.         DrawingArea.method341(l + 16 + l1, 0x6a5c43, k1, i1 + 4);
  1731.         DrawingArea.method341(l + 16 + l1, 0x655841, k1, i1 + 5);
  1732.         DrawingArea.method341(l + 16 + l1, 0x655841, k1, i1 + 6);
  1733.         DrawingArea.method341(l + 16 + l1, 0x61553e, k1, i1 + 7);
  1734.         DrawingArea.method341(l + 16 + l1, 0x61553e, k1, i1 + 8);
  1735.         DrawingArea.method341(l + 16 + l1, 0x5d513c, k1, i1 + 9);
  1736.         DrawingArea.method341(l + 16 + l1, 0x5d513c, k1, i1 + 10);
  1737.         DrawingArea.method341(l + 16 + l1, 0x594e3a, k1, i1 + 11);
  1738.         DrawingArea.method341(l + 16 + l1, 0x594e3a, k1, i1 + 12);
  1739.         DrawingArea.method341(l + 16 + l1, 0x514635, k1, i1 + 13);
  1740.         DrawingArea.method341(l + 16 + l1, 0x4b4131, k1, i1 + 14);
  1741.         DrawingArea.method339(l + 16 + l1, 0x000001, 15, i1);
  1742.         DrawingArea.method339(l + 17 + l1, 0x000001, 15, i1);
  1743.         DrawingArea.method339(l + 17 + l1, 0x655841, 14, i1);
  1744.         DrawingArea.method339(l + 17 + l1, 0x6a5c43, 13, i1);
  1745.         DrawingArea.method339(l + 17 + l1, 0x6d5f48, 11, i1);
  1746.         DrawingArea.method339(l + 17 + l1, 0x73654a, 10, i1);
  1747.         DrawingArea.method339(l + 17 + l1, 0x76684b, 7, i1);
  1748.         DrawingArea.method339(l + 17 + l1, 0x7b6a4d, 5, i1);
  1749.         DrawingArea.method339(l + 17 + l1, 0x7e6e50, 4, i1);
  1750.         DrawingArea.method339(l + 17 + l1, 0x817051, 3, i1);
  1751.         DrawingArea.method339(l + 17 + l1, 0x000001, 2, i1);
  1752.         DrawingArea.method339(l + 18 + l1, 0x000001, 16, i1);
  1753.         DrawingArea.method339(l + 18 + l1, 0x564b38, 15, i1);
  1754.         DrawingArea.method339(l + 18 + l1, 0x5d513c, 14, i1);
  1755.         DrawingArea.method339(l + 18 + l1, 0x625640, 11, i1);
  1756.         DrawingArea.method339(l + 18 + l1, 0x655841, 10, i1);
  1757.         DrawingArea.method339(l + 18 + l1, 0x6a5c43, 7, i1);
  1758.         DrawingArea.method339(l + 18 + l1, 0x6e6046, 5, i1);
  1759.         DrawingArea.method339(l + 18 + l1, 0x716247, 4, i1);
  1760.         DrawingArea.method339(l + 18 + l1, 0x7b6a4d, 3, i1);
  1761.         DrawingArea.method339(l + 18 + l1, 0x817051, 2, i1);
  1762.         DrawingArea.method339(l + 18 + l1, 0x000001, 1, i1);
  1763.         DrawingArea.method339(l + 19 + l1, 0x000001, 16, i1);
  1764.         DrawingArea.method339(l + 19 + l1, 0x514635, 15, i1);
  1765.         DrawingArea.method339(l + 19 + l1, 0x564b38, 14, i1);
  1766.         DrawingArea.method339(l + 19 + l1, 0x5d513c, 11, i1);
  1767.         DrawingArea.method339(l + 19 + l1, 0x61553e, 9, i1);
  1768.         DrawingArea.method339(l + 19 + l1, 0x655841, 7, i1);
  1769.         DrawingArea.method339(l + 19 + l1, 0x6a5c43, 5, i1);
  1770.         DrawingArea.method339(l + 19 + l1, 0x6e6046, 4, i1);
  1771.         DrawingArea.method339(l + 19 + l1, 0x73654a, 3, i1);
  1772.         DrawingArea.method339(l + 19 + l1, 0x817051, 2, i1);
  1773.         DrawingArea.method339(l + 19 + l1, 0x000001, 1, i1);
  1774.         DrawingArea.method339(l + 20 + l1, 0x000001, 16, i1);
  1775.         DrawingArea.method339(l + 20 + l1, 0x4b4131, 15, i1);
  1776.         DrawingArea.method339(l + 20 + l1, 0x544936, 14, i1);
  1777.         DrawingArea.method339(l + 20 + l1, 0x594e3a, 13, i1);
  1778.         DrawingArea.method339(l + 20 + l1, 0x5d513c, 10, i1);
  1779.         DrawingArea.method339(l + 20 + l1, 0x61553e, 8, i1);
  1780.         DrawingArea.method339(l + 20 + l1, 0x655841, 6, i1);
  1781.         DrawingArea.method339(l + 20 + l1, 0x6a5c43, 4, i1);
  1782.         DrawingArea.method339(l + 20 + l1, 0x73654a, 3, i1);
  1783.         DrawingArea.method339(l + 20 + l1, 0x817051, 2, i1);
  1784.         DrawingArea.method339(l + 20 + l1, 0x000001, 1, i1);
  1785.         DrawingArea.method341(l + 16 + l1, 0x000001, k1, i1 + 15);
  1786.         DrawingArea.method339(l + 15 + l1 + k1, 0x000001, 16, i1);
  1787.         DrawingArea.method339(l + 14 + l1 + k1, 0x000001, 15, i1);
  1788.         DrawingArea.method339(l + 14 + l1 + k1, 0x3f372a, 14, i1);
  1789.         DrawingArea.method339(l + 14 + l1 + k1, 0x443c2d, 10, i1);
  1790.         DrawingArea.method339(l + 14 + l1 + k1, 0x483e2f, 9, i1);
  1791.         DrawingArea.method339(l + 14 + l1 + k1, 0x4a402f, 7, i1);
  1792.         DrawingArea.method339(l + 14 + l1 + k1, 0x4b4131, 4, i1);
  1793.         DrawingArea.method339(l + 14 + l1 + k1, 0x564b38, 3, i1);
  1794.         DrawingArea.method339(l + 14 + l1 + k1, 0x000001, 2, i1);
  1795.         DrawingArea.method339(l + 13 + l1 + k1, 0x000001, 16, i1);
  1796.         DrawingArea.method339(l + 13 + l1 + k1, 0x443c2d, 15, i1);
  1797.         DrawingArea.method339(l + 13 + l1 + k1, 0x4b4131, 11, i1);
  1798.         DrawingArea.method339(l + 13 + l1 + k1, 0x514635, 9, i1);
  1799.         DrawingArea.method339(l + 13 + l1 + k1, 0x544936, 7, i1);
  1800.         DrawingArea.method339(l + 13 + l1 + k1, 0x564b38, 6, i1);
  1801.         DrawingArea.method339(l + 13 + l1 + k1, 0x594e3a, 4, i1);
  1802.         DrawingArea.method339(l + 13 + l1 + k1, 0x625640, 3, i1);
  1803.         DrawingArea.method339(l + 13 + l1 + k1, 0x6a5c43, 2, i1);
  1804.         DrawingArea.method339(l + 13 + l1 + k1, 0x000001, 1, i1);
  1805.         DrawingArea.method339(l + 12 + l1 + k1, 0x000001, 16, i1);
  1806.         DrawingArea.method339(l + 12 + l1 + k1, 0x443c2d, 15, i1);
  1807.         DrawingArea.method339(l + 12 + l1 + k1, 0x4b4131, 14, i1);
  1808.         DrawingArea.method339(l + 12 + l1 + k1, 0x544936, 12, i1);
  1809.         DrawingArea.method339(l + 12 + l1 + k1, 0x564b38, 11, i1);
  1810.         DrawingArea.method339(l + 12 + l1 + k1, 0x594e3a, 10, i1);
  1811.         DrawingArea.method339(l + 12 + l1 + k1, 0x5d513c, 7, i1);
  1812.         DrawingArea.method339(l + 12 + l1 + k1, 0x61553e, 4, i1);
  1813.         DrawingArea.method339(l + 12 + l1 + k1, 0x6e6046, 3, i1);
  1814.         DrawingArea.method339(l + 12 + l1 + k1, 0x7b6a4d, 2, i1);
  1815.         DrawingArea.method339(l + 12 + l1 + k1, 0x000001, 1, i1);
  1816.         DrawingArea.method339(l + 11 + l1 + k1, 0x000001, 16, i1);
  1817.         DrawingArea.method339(l + 11 + l1 + k1, 0x4b4131, 15, i1);
  1818.         DrawingArea.method339(l + 11 + l1 + k1, 0x514635, 14, i1);
  1819.         DrawingArea.method339(l + 11 + l1 + k1, 0x564b38, 13, i1);
  1820.         DrawingArea.method339(l + 11 + l1 + k1, 0x594e3a, 11, i1);
  1821.         DrawingArea.method339(l + 11 + l1 + k1, 0x5d513c, 9, i1);
  1822.         DrawingArea.method339(l + 11 + l1 + k1, 0x61553e, 7, i1);
  1823.         DrawingArea.method339(l + 11 + l1 + k1, 0x655841, 5, i1);
  1824.         DrawingArea.method339(l + 11 + l1 + k1, 0x6a5c43, 4, i1);
  1825.         DrawingArea.method339(l + 11 + l1 + k1, 0x73654a, 3, i1);
  1826.         DrawingArea.method339(l + 11 + l1 + k1, 0x7b6a4d, 2, i1);
  1827.         DrawingArea.method339(l + 11 + l1 + k1, 0x000001, 1, i1);
  1828.     }
  1829.  
  1830.     public void updateNPCs(Stream stream, int i) {
  1831.         anInt839 = 0;
  1832.         anInt893 = 0;
  1833.         method139(stream);
  1834.         method46(i, stream);
  1835.         method86(stream);
  1836.         for (int k = 0; k < anInt839; k++) {
  1837.             int l = anIntArray840[k];
  1838.             if (npcArray[l].anInt1537 != loopCycle) {
  1839.                 npcArray[l].desc = null;
  1840.                 npcArray[l] = null;
  1841.             }
  1842.         }
  1843.  
  1844.         if (stream.currentOffset != i) {
  1845.             signlink.reporterror(myUsername
  1846.                     + " size mismatch in getnpcpos - pos:"
  1847.                     + stream.currentOffset + " psize:" + i);
  1848.             throw new RuntimeException("eek");
  1849.         }
  1850.         for (int i1 = 0; i1 < npcCount; i1++)
  1851.             if (npcArray[npcIndices[i1]] == null) {
  1852.                 signlink.reporterror(myUsername
  1853.                         + " null entry in npc list - pos:" + i1 + " size:"
  1854.                         + npcCount);
  1855.                 throw new RuntimeException("eek");
  1856.             }
  1857.  
  1858.     }
  1859.  
  1860.     private int cButtonHPos;
  1861.     private int cButtonCPos;
  1862.  
  1863.     public void processChatModeClick() {
  1864.         if (super.mouseX >= 5 && super.mouseX <= 61 && super.mouseY >= 482
  1865.                 && super.mouseY <= 503) {
  1866.             cButtonHPos = 0;
  1867.             inputTaken = true;
  1868.         } else if (super.mouseX >= 71 && super.mouseX <= 127
  1869.                 && super.mouseY >= 482 && super.mouseY <= 503) {
  1870.             cButtonHPos = 1;
  1871.             inputTaken = true;
  1872.         } else if (super.mouseX >= 137 && super.mouseX <= 193
  1873.                 && super.mouseY >= 482 && super.mouseY <= 503) {
  1874.             cButtonHPos = 2;
  1875.             inputTaken = true;
  1876.         } else if (super.mouseX >= 203 && super.mouseX <= 259
  1877.                 && super.mouseY >= 482 && super.mouseY <= 503) {
  1878.             cButtonHPos = 3;
  1879.             inputTaken = true;
  1880.         } else if (super.mouseX >= 269 && super.mouseX <= 325
  1881.                 && super.mouseY >= 482 && super.mouseY <= 503) {
  1882.             cButtonHPos = 4;
  1883.             inputTaken = true;
  1884.         } else if (super.mouseX >= 335 && super.mouseX <= 391
  1885.                 && super.mouseY >= 482 && super.mouseY <= 503) {
  1886.             cButtonHPos = 5;
  1887.             inputTaken = true;
  1888.         } else if (super.mouseX >= 404 && super.mouseX <= 515
  1889.                 && super.mouseY >= 482 && super.mouseY <= 503) {
  1890.             cButtonHPos = 6;
  1891.             inputTaken = true;
  1892.         } else {
  1893.             cButtonHPos = -1;
  1894.             inputTaken = true;
  1895.         }
  1896.         if (super.clickMode3 == 1) {
  1897.             if (super.saveClickX >= 5 && super.saveClickX <= 61
  1898.                     && super.saveClickY >= 482 && super.saveClickY <= 505) {
  1899.                 cButtonCPos = 0;
  1900.                 chatTypeView = 0;
  1901.                 inputTaken = true;
  1902.             } else if (super.saveClickX >= 71 && super.saveClickX <= 127
  1903.                     && super.saveClickY >= 482 && super.saveClickY <= 505) {
  1904.                 cButtonCPos = 1;
  1905.                 chatTypeView = 5;
  1906.                 inputTaken = true;
  1907.             } else if (super.saveClickX >= 137 && super.saveClickX <= 193
  1908.                     && super.saveClickY >= 482 && super.saveClickY <= 505) {
  1909.                 cButtonCPos = 2;
  1910.                 chatTypeView = 1;
  1911.                 inputTaken = true;
  1912.             } else if (super.saveClickX >= 203 && super.saveClickX <= 259
  1913.                     && super.saveClickY >= 482 && super.saveClickY <= 505) {
  1914.                 cButtonCPos = 3;
  1915.                 chatTypeView = 2;
  1916.                 inputTaken = true;
  1917.             } else if (super.saveClickX >= 269 && super.saveClickX <= 325
  1918.                     && super.saveClickY >= 482 && super.saveClickY <= 505) {
  1919.                 cButtonCPos = 4;
  1920.                 chatTypeView = 11;
  1921.                 inputTaken = true;
  1922.             } else if (super.saveClickX >= 335 && super.saveClickX <= 391
  1923.                     && super.saveClickY >= 482 && super.saveClickY <= 505) {
  1924.                 cButtonCPos = 5;
  1925.                 chatTypeView = 3;
  1926.                 inputTaken = true;
  1927.             }
  1928.         }
  1929.     }
  1930.  
  1931.     public void method33(int i) {
  1932.         int j = Varp.cache[i].anInt709;
  1933.         if (j == 0)
  1934.             return;
  1935.         int k = variousSettings[i];
  1936.         if (j == 1) {
  1937.             if (k == 1)
  1938.                 Texture.method372(0.90000000000000002D);
  1939.             if (k == 2)
  1940.                 Texture.method372(0.80000000000000004D);
  1941.             if (k == 3)
  1942.                 Texture.method372(0.69999999999999996D);
  1943.             if (k == 4)
  1944.                 Texture.method372(0.59999999999999998D);
  1945.             ItemDef.mruNodes1.unlinkAll();
  1946.             welcomeScreenRaised = true;
  1947.         }
  1948.         if (j == 3) {
  1949.             boolean flag1 = musicEnabled;
  1950.             if (k == 0) {
  1951.                 adjustVolume(musicEnabled, 0);
  1952.                 musicEnabled = true;
  1953.             }
  1954.             if (k == 1) {
  1955.                 adjustVolume(musicEnabled, -400);
  1956.                 musicEnabled = true;
  1957.             }
  1958.             if (k == 2) {
  1959.                 adjustVolume(musicEnabled, -800);
  1960.                 musicEnabled = true;
  1961.             }
  1962.             if (k == 3) {
  1963.                 adjustVolume(musicEnabled, -1200);
  1964.                 musicEnabled = true;
  1965.             }
  1966.             if (k == 4)
  1967.                 musicEnabled = false;
  1968.             if (musicEnabled != flag1 && !lowMem) {
  1969.                 if (musicEnabled) {
  1970.                     nextSong = currentSong;
  1971.                     songChanging = true;
  1972.                     onDemandFetcher.method558(2, nextSong);
  1973.                 } else {
  1974.                     stopMidi();
  1975.                 }
  1976.                 prevSong = 0;
  1977.             }
  1978.         }
  1979.         if (j == 4) {
  1980.             if (k == 0) {
  1981.                 aBoolean848 = true;
  1982.                 setWaveVolume(0);
  1983.             }
  1984.             if (k == 1) {
  1985.                 aBoolean848 = true;
  1986.                 setWaveVolume(-400);
  1987.             }
  1988.             if (k == 2) {
  1989.                 aBoolean848 = true;
  1990.                 setWaveVolume(-800);
  1991.             }
  1992.             if (k == 3) {
  1993.                 aBoolean848 = true;
  1994.                 setWaveVolume(-1200);
  1995.             }
  1996.             if (k == 4)
  1997.                 aBoolean848 = false;
  1998.         }
  1999.         if (j == 5)
  2000.             anInt1253 = k;
  2001.         if (j == 6)
  2002.             anInt1249 = k;
  2003.         if (j == 8) {
  2004.             splitPrivateChat = k;
  2005.             inputTaken = true;
  2006.         }
  2007.         if (j == 9)
  2008.             anInt913 = k;
  2009.     }
  2010.  
  2011.     public void updateEntities() {
  2012.         try {
  2013.             int anInt974 = 0;
  2014.             for (int j = -1; j < playerCount + npcCount; j++) {
  2015.                 Object obj;
  2016.                 if (j == -1)
  2017.                     obj = myPlayer;
  2018.                 else if (j < playerCount)
  2019.                     obj = playerArray[playerIndices[j]];
  2020.                 else
  2021.                     obj = npcArray[npcIndices[j - playerCount]];
  2022.                 if (obj == null || !((Entity) (obj)).isVisible())
  2023.                     continue;
  2024.                 if (obj instanceof NPC) {
  2025.                     EntityDef entityDef = ((NPC) obj).desc;
  2026.                     if (entityDef.childrenIDs != null)
  2027.                         entityDef = entityDef.method161();
  2028.                     if (entityDef == null)
  2029.                         continue;
  2030.                 }
  2031.                 if (j < playerCount) {
  2032.                     int l = 30;
  2033.                     Player player = (Player) obj;
  2034.                     if (player.headIcon >= 0) {
  2035.                         npcScreenPos(((Entity) (obj)),
  2036.                                 ((Entity) (obj)).height + 15);
  2037.                         if (spriteDrawX > -1) {
  2038.                             if (player.skullIcon < 2) {
  2039.                                 skullIcons[player.skullIcon].drawSprite(
  2040.                                         spriteDrawX - 12, spriteDrawY - l);
  2041.                                 l += 25;
  2042.                             }
  2043.                             if (player.headIcon < 7) {
  2044.                                 headIcons[player.headIcon].drawSprite(
  2045.                                         spriteDrawX - 12, spriteDrawY - l);
  2046.                                 l += 18;
  2047.                             }
  2048.                         }
  2049.                     }
  2050.                     if (j >= 0 && anInt855 == 10
  2051.                             && anInt933 == playerIndices[j]) {
  2052.                         npcScreenPos(((Entity) (obj)),
  2053.                                 ((Entity) (obj)).height + 15);
  2054.                         if (spriteDrawX > -1)
  2055.                             headIconsHint[player.hintIcon].drawSprite(
  2056.                                     spriteDrawX - 12, spriteDrawY - l);
  2057.                     }
  2058.                 } else {
  2059.                     EntityDef entityDef_1 = ((NPC) obj).desc;
  2060.                     if (entityDef_1.anInt75 >= 0
  2061.                             && entityDef_1.anInt75 < headIcons.length) {
  2062.                         npcScreenPos(((Entity) (obj)),
  2063.                                 ((Entity) (obj)).height + 15);
  2064.                         if (spriteDrawX > -1)
  2065.                             headIcons[entityDef_1.anInt75].drawSprite(
  2066.                                     spriteDrawX - 12, spriteDrawY - 30);
  2067.                     }
  2068.                     if (anInt855 == 1
  2069.                             && anInt1222 == npcIndices[j - playerCount]
  2070.                             && loopCycle % 20 < 10) {
  2071.                         npcScreenPos(((Entity) (obj)),
  2072.                                 ((Entity) (obj)).height + 15);
  2073.                         if (spriteDrawX > -1)
  2074.                             headIconsHint[0].drawSprite(spriteDrawX - 12,
  2075.                                     spriteDrawY - 28);
  2076.                     }
  2077.                 }
  2078.                 if (((Entity) (obj)).textSpoken != null
  2079.                         && (j >= playerCount || publicChatMode == 0
  2080.                                 || publicChatMode == 3 || publicChatMode == 1
  2081.                                 && isFriendOrSelf(((Player) obj).name))) {
  2082.                     npcScreenPos(((Entity) (obj)), ((Entity) (obj)).height);
  2083.                     if (spriteDrawX > -1 && anInt974 < anInt975) {
  2084.                         anIntArray979[anInt974] = chatTextDrawingArea
  2085.                                 .method384(((Entity) (obj)).textSpoken) / 2;
  2086.                         anIntArray978[anInt974] = chatTextDrawingArea.anInt1497;
  2087.                         anIntArray976[anInt974] = spriteDrawX;
  2088.                         anIntArray977[anInt974] = spriteDrawY;
  2089.                         anIntArray980[anInt974] = ((Entity) (obj)).anInt1513;
  2090.                         anIntArray981[anInt974] = ((Entity) (obj)).anInt1531;
  2091.                         anIntArray982[anInt974] = ((Entity) (obj)).textCycle;
  2092.                         aStringArray983[anInt974++] = ((Entity) (obj)).textSpoken;
  2093.                         if (anInt1249 == 0 && ((Entity) (obj)).anInt1531 >= 1
  2094.                                 && ((Entity) (obj)).anInt1531 <= 3) {
  2095.                             anIntArray978[anInt974] += 10;
  2096.                             anIntArray977[anInt974] += 5;
  2097.                         }
  2098.                         if (anInt1249 == 0 && ((Entity) (obj)).anInt1531 == 4)
  2099.                             anIntArray979[anInt974] = 60;
  2100.                         if (anInt1249 == 0 && ((Entity) (obj)).anInt1531 == 5)
  2101.                             anIntArray978[anInt974] += 5;
  2102.                     }
  2103.                 }
  2104.                 if (((Entity) (obj)).loopCycleStatus > loopCycle) {
  2105.                     try {
  2106.                         npcScreenPos(((Entity) (obj)),
  2107.                                 ((Entity) (obj)).height + 15);
  2108.                         if (spriteDrawX > -1) {
  2109.                             int i1 = (((Entity) (obj)).currentHealth * 30)
  2110.                                     / ((Entity) (obj)).maxHealth;
  2111.                             if (i1 > 30)
  2112.                                 i1 = 30;
  2113.                             DrawingArea.drawPixels(5, spriteDrawY - 3,
  2114.                                     spriteDrawX - 15, 65280, i1);
  2115.                             DrawingArea.drawPixels(5, spriteDrawY - 3,
  2116.                                     (spriteDrawX - 15) + i1, 0xff0000, 30 - i1);
  2117.                         }
  2118.                     } catch (Exception e) {
  2119.                     }
  2120.                 }
  2121.                 for (int j1 = 0; j1 < 4; j1++)
  2122.                     if (((Entity) (obj)).hitsLoopCycle[j1] > loopCycle) {
  2123.                         npcScreenPos(((Entity) (obj)),
  2124.                                 ((Entity) (obj)).height / 2);
  2125.                         if (spriteDrawX > -1) {
  2126.                             if (j1 == 1)
  2127.                                 spriteDrawY -= 20;
  2128.                             if (j1 == 2) {
  2129.                                 spriteDrawX -= 15;
  2130.                                 spriteDrawY -= 10;
  2131.                             }
  2132.                             if (j1 == 3) {
  2133.                                 spriteDrawX += 15;
  2134.                                 spriteDrawY -= 10;
  2135.                             }
  2136.                             hitMarks[((Entity) (obj)).hitMarkTypes[j1]]
  2137.                                     .drawSprite(spriteDrawX - 12,
  2138.                                             spriteDrawY - 12);
  2139.                             smallText.drawText(0, String
  2140.                                     .valueOf(((Entity) (obj)).hitArray[j1]),
  2141.                                     spriteDrawY + 4, spriteDrawX);
  2142.                             smallText.drawText(0xffffff, String
  2143.                                     .valueOf(((Entity) (obj)).hitArray[j1]),
  2144.                                     spriteDrawY + 3, spriteDrawX - 1);
  2145.                         }
  2146.                     }
  2147.             }
  2148.             for (int k = 0; k < anInt974; k++) {
  2149.                 int k1 = anIntArray976[k];
  2150.                 int l1 = anIntArray977[k];
  2151.                 int j2 = anIntArray979[k];
  2152.                 int k2 = anIntArray978[k];
  2153.                 boolean flag = true;
  2154.                 while (flag) {
  2155.                     flag = false;
  2156.                     for (int l2 = 0; l2 < k; l2++)
  2157.                         if (l1 + 2 > anIntArray977[l2] - anIntArray978[l2]
  2158.                                 && l1 - k2 < anIntArray977[l2] + 2
  2159.                                 && k1 - j2 < anIntArray976[l2]
  2160.                                         + anIntArray979[l2]
  2161.                                 && k1 + j2 > anIntArray976[l2]
  2162.                                         - anIntArray979[l2]
  2163.                                 && anIntArray977[l2] - anIntArray978[l2] < l1) {
  2164.                             l1 = anIntArray977[l2] - anIntArray978[l2];
  2165.                             flag = true;
  2166.                         }
  2167.  
  2168.                 }
  2169.                 spriteDrawX = anIntArray976[k];
  2170.                 spriteDrawY = anIntArray977[k] = l1;
  2171.                 String s = aStringArray983[k];
  2172.                 if (anInt1249 == 0) {
  2173.                     int i3 = 0xffff00;
  2174.                     if (anIntArray980[k] < 6)
  2175.                         i3 = anIntArray965[anIntArray980[k]];
  2176.                     if (anIntArray980[k] == 6)
  2177.                         i3 = anInt1265 % 20 >= 10 ? 0xffff00 : 0xff0000;
  2178.                     if (anIntArray980[k] == 7)
  2179.                         i3 = anInt1265 % 20 >= 10 ? 65535 : 255;
  2180.                     if (anIntArray980[k] == 8)
  2181.                         i3 = anInt1265 % 20 >= 10 ? 0x80ff80 : 45056;
  2182.                     if (anIntArray980[k] == 9) {
  2183.                         int j3 = 150 - anIntArray982[k];
  2184.                         if (j3 < 50)
  2185.                             i3 = 0xff0000 + 1280 * j3;
  2186.                         else if (j3 < 100)
  2187.                             i3 = 0xffff00 - 0x50000 * (j3 - 50);
  2188.                         else if (j3 < 150)
  2189.                             i3 = 65280 + 5 * (j3 - 100);
  2190.                     }
  2191.                     if (anIntArray980[k] == 10) {
  2192.                         int k3 = 150 - anIntArray982[k];
  2193.                         if (k3 < 50)
  2194.                             i3 = 0xff0000 + 5 * k3;
  2195.                         else if (k3 < 100)
  2196.                             i3 = 0xff00ff - 0x50000 * (k3 - 50);
  2197.                         else if (k3 < 150)
  2198.                             i3 = (255 + 0x50000 * (k3 - 100)) - 5 * (k3 - 100);
  2199.                     }
  2200.                     if (anIntArray980[k] == 11) {
  2201.                         int l3 = 150 - anIntArray982[k];
  2202.                         if (l3 < 50)
  2203.                             i3 = 0xffffff - 0x50005 * l3;
  2204.                         else if (l3 < 100)
  2205.                             i3 = 65280 + 0x50005 * (l3 - 50);
  2206.                         else if (l3 < 150)
  2207.                             i3 = 0xffffff - 0x50000 * (l3 - 100);
  2208.                     }
  2209.                     if (anIntArray981[k] == 0) {
  2210.                         chatTextDrawingArea.drawText(0, s, spriteDrawY + 1,
  2211.                                 spriteDrawX);
  2212.                         chatTextDrawingArea.drawText(i3, s, spriteDrawY,
  2213.                                 spriteDrawX);
  2214.                     }
  2215.                     if (anIntArray981[k] == 1) {
  2216.                         chatTextDrawingArea.method386(0, s, spriteDrawX,
  2217.                                 anInt1265, spriteDrawY + 1);
  2218.                         chatTextDrawingArea.method386(i3, s, spriteDrawX,
  2219.                                 anInt1265, spriteDrawY);
  2220.                     }
  2221.                     if (anIntArray981[k] == 2) {
  2222.                         chatTextDrawingArea.method387(spriteDrawX, s,
  2223.                                 anInt1265, spriteDrawY + 1, 0);
  2224.                         chatTextDrawingArea.method387(spriteDrawX, s,
  2225.                                 anInt1265, spriteDrawY, i3);
  2226.                     }
  2227.                     if (anIntArray981[k] == 3) {
  2228.                         chatTextDrawingArea.method388(150 - anIntArray982[k],
  2229.                                 s, anInt1265, spriteDrawY + 1, spriteDrawX, 0);
  2230.                         chatTextDrawingArea.method388(150 - anIntArray982[k],
  2231.                                 s, anInt1265, spriteDrawY, spriteDrawX, i3);
  2232.                     }
  2233.                     if (anIntArray981[k] == 4) {
  2234.                         int i4 = chatTextDrawingArea.method384(s);
  2235.                         int k4 = ((150 - anIntArray982[k]) * (i4 + 100)) / 150;
  2236.                         DrawingArea.setDrawingArea(334, spriteDrawX - 50,
  2237.                                 spriteDrawX + 50, 0);
  2238.                         chatTextDrawingArea.method385(0, s, spriteDrawY + 1,
  2239.                                 (spriteDrawX + 50) - k4);
  2240.                         chatTextDrawingArea.method385(i3, s, spriteDrawY,
  2241.                                 (spriteDrawX + 50) - k4);
  2242.                         DrawingArea.defaultDrawingAreaSize();
  2243.                     }
  2244.                     if (anIntArray981[k] == 5) {
  2245.                         int j4 = 150 - anIntArray982[k];
  2246.                         int l4 = 0;
  2247.                         if (j4 < 25)
  2248.                             l4 = j4 - 25;
  2249.                         else if (j4 > 125)
  2250.                             l4 = j4 - 125;
  2251.                         DrawingArea
  2252.                                 .setDrawingArea(spriteDrawY + 5, 0, 512,
  2253.                                         spriteDrawY
  2254.                                                 - chatTextDrawingArea.anInt1497
  2255.                                                 - 1);
  2256.                         chatTextDrawingArea.drawText(0, s,
  2257.                                 spriteDrawY + 1 + l4, spriteDrawX);
  2258.                         chatTextDrawingArea.drawText(i3, s, spriteDrawY + l4,
  2259.                                 spriteDrawX);
  2260.                         DrawingArea.defaultDrawingAreaSize();
  2261.                     }
  2262.                 } else {
  2263.                     chatTextDrawingArea.drawText(0, s, spriteDrawY + 1,
  2264.                             spriteDrawX);
  2265.                     chatTextDrawingArea.drawText(0xffff00, s, spriteDrawY,
  2266.                             spriteDrawX);
  2267.                 }
  2268.             }
  2269.         } catch (Exception e) {
  2270.         }
  2271.     }
  2272.  
  2273.     public void delFriend(long l) {
  2274.         try {
  2275.             if (l == 0L)
  2276.                 return;
  2277.             for (int i = 0; i < friendsCount; i++) {
  2278.                 if (friendsListAsLongs[i] != l)
  2279.                     continue;
  2280.                 friendsCount--;
  2281.                 needDrawTabArea = true;
  2282.                 for (int j = i; j < friendsCount; j++) {
  2283.                     friendsList[j] = friendsList[j + 1];
  2284.                     friendsNodeIDs[j] = friendsNodeIDs[j + 1];
  2285.                     friendsListAsLongs[j] = friendsListAsLongs[j + 1];
  2286.                 }
  2287.  
  2288.                 stream.createFrame(215);
  2289.                 stream.writeQWord(l);
  2290.                 break;
  2291.             }
  2292.         } catch (RuntimeException runtimeexception) {
  2293.             signlink.reporterror("18622, " + false + ", " + l + ", "
  2294.                     + runtimeexception.toString());
  2295.             throw new RuntimeException();
  2296.         }
  2297.     }
  2298.  
  2299.     public void drawSideIcons() {
  2300.         /* Top sideIcons */
  2301.         if (tabInterfaceIDs[0] != -1)// attack
  2302.             sideIcons[0].drawSprite(10, 4);
  2303.         if (tabInterfaceIDs[1] != -1)// stat
  2304.             sideIcons[1].drawSprite(43, 4);
  2305.         if (tabInterfaceIDs[2] != -1)// quest
  2306.             sideIcons[2].drawSprite(76, 3);
  2307.         if (tabInterfaceIDs[3] != -1)// inventory
  2308.             sideIcons[3].drawSprite(111, 5);
  2309.         if (tabInterfaceIDs[4] != -1)// equipment
  2310.             sideIcons[4].drawSprite(140, 1);
  2311.         if (tabInterfaceIDs[5] != -1)// prayer
  2312.             sideIcons[5].drawSprite(174, 1);
  2313.         if (tabInterfaceIDs[6] != -1)// magic
  2314.             sideIcons[6].drawSprite(208, 4);
  2315.         /* Bottom sideIcons */
  2316.         if (tabInterfaceIDs[7] != -1)// clan
  2317.             sideIcons[7].drawSprite(11, 303);
  2318.         if (tabInterfaceIDs[8] != -1)// friends
  2319.             sideIcons[8].drawSprite(46, 306);
  2320.         if (tabInterfaceIDs[9] != -1)// ignore
  2321.             sideIcons[9].drawSprite(79, 306);
  2322.         if (tabInterfaceIDs[10] != -1)// options
  2323.             sideIcons[10].drawSprite(113, 300);
  2324.         if (tabInterfaceIDs[11] != -1)// options
  2325.             sideIcons[11].drawSprite(145, 304);
  2326.         if (tabInterfaceIDs[12] != -1)// emotes
  2327.             sideIcons[12].drawSprite(181, 302);
  2328.         if (tabInterfaceIDs[13] != -1)// music
  2329.             sideIcons[13].drawSprite(213, 303);
  2330.     }
  2331.  
  2332.     public void drawRedStones() {
  2333.         if (tabInterfaceIDs[tabID] != -1) {
  2334.             switch (tabID) {
  2335.             case 0:
  2336.                 redStones[0].drawSprite(3, 0);
  2337.                 break;
  2338.             case 1:
  2339.                 redStones[4].drawSprite(41, 0);
  2340.                 break;
  2341.             case 2:
  2342.                 redStones[4].drawSprite(74, 0);
  2343.                 break;
  2344.             case 3:
  2345.                 redStones[4].drawSprite(107, 0);
  2346.                 break;
  2347.             case 4:
  2348.                 redStones[4].drawSprite(140, 0);
  2349.                 break;
  2350.             case 5:
  2351.                 redStones[4].drawSprite(173, 0);
  2352.                 break;
  2353.             case 6:
  2354.                 redStones[1].drawSprite(206, 0);
  2355.                 break;
  2356.             case 7:
  2357.                 redStones[2].drawSprite(3, 298);
  2358.                 break;
  2359.             case 8:
  2360.                 redStones[4].drawSprite(41, 298);
  2361.                 break;
  2362.             case 9:
  2363.                 redStones[4].drawSprite(74, 298);
  2364.                 break;
  2365.             case 10:
  2366.                 redStones[4].drawSprite(107, 298);
  2367.                 break;
  2368.             case 11:
  2369.                 redStones[4].drawSprite(140, 298);
  2370.                 break;
  2371.             case 12:
  2372.                 redStones[4].drawSprite(173, 298);
  2373.                 break;
  2374.             case 13:
  2375.                 redStones[3].drawSprite(206, 298);
  2376.                 break;
  2377.             }
  2378.         }
  2379.     }
  2380.  
  2381.     private void drawTabArea() {
  2382.         if (revision508 == true) {
  2383.             aRSImageProducer_1163.initDrawingArea();
  2384.             Texture.anIntArray1472 = anIntArray1181;
  2385.             tabArea508.drawSprite(0, 0);
  2386.             if (invOverlayInterfaceID == -1) {
  2387.                 drawRedStones();
  2388.                 drawSideIcons();
  2389.             }
  2390.             if (invOverlayInterfaceID != -1)
  2391.                 drawInterface(0, 30,
  2392.                         RSInterface.interfaceCache[invOverlayInterfaceID], 37);
  2393.             else if (tabInterfaceIDs[tabID] != -1)
  2394.                 drawInterface(0, 30,
  2395.                         RSInterface.interfaceCache[tabInterfaceIDs[tabID]], 37);
  2396.             if (menuOpen && menuScreenArea == 1)
  2397.                 drawMenu();
  2398.             aRSImageProducer_1163.drawGraphics(168, super.graphics, 519);
  2399.             aRSImageProducer_1165.initDrawingArea();
  2400.             Texture.anIntArray1472 = anIntArray1182;
  2401.         }
  2402.         if (revision474 == true) {
  2403.             aRSImageProducer_1163.initDrawingArea();
  2404.             Texture.anIntArray1472 = anIntArray1181;
  2405.             tabArea474.drawSprite(0, 0);
  2406.             if (invOverlayInterfaceID == -1) {
  2407.                 drawRedStones();
  2408.                 drawSideIcons();
  2409.             }
  2410.             if (invOverlayInterfaceID != -1)
  2411.                 drawInterface(0, 30,
  2412.                         RSInterface.interfaceCache[invOverlayInterfaceID], 37);
  2413.             else if (tabInterfaceIDs[tabID] != -1)
  2414.                 drawInterface(0, 30,
  2415.                         RSInterface.interfaceCache[tabInterfaceIDs[tabID]], 37);
  2416.             if (menuOpen && menuScreenArea == 1)
  2417.                 drawMenu();
  2418.             aRSImageProducer_1163.drawGraphics(168, super.graphics, 519);
  2419.             aRSImageProducer_1165.initDrawingArea();
  2420.             Texture.anIntArray1472 = anIntArray1182;
  2421.         }
  2422.         if (revision498 == true) {
  2423.             aRSImageProducer_1163.initDrawingArea();
  2424.             Texture.anIntArray1472 = anIntArray1181;
  2425.             tabArea.drawSprite(0, 0);
  2426.             if (invOverlayInterfaceID == -1) {
  2427.                 drawRedStones();
  2428.                 drawSideIcons();
  2429.             }
  2430.             if (invOverlayInterfaceID != -1)
  2431.                 drawInterface(0, 28,
  2432.                         RSInterface.interfaceCache[invOverlayInterfaceID], 37);
  2433.             else if (tabInterfaceIDs[tabID] != -1)
  2434.                 drawInterface(0, 28,
  2435.                         RSInterface.interfaceCache[tabInterfaceIDs[tabID]], 37);
  2436.             if (menuOpen && menuScreenArea == 1)
  2437.                 drawMenu();
  2438.             aRSImageProducer_1163.drawGraphics(168, super.graphics, 519);
  2439.             aRSImageProducer_1165.initDrawingArea();
  2440.             Texture.anIntArray1472 = anIntArray1182;
  2441.         }
  2442.     }
  2443.  
  2444.     public void method37(int j) {
  2445.         if (!lowMem) {
  2446.             if (Texture.anIntArray1480[17] >= j) {
  2447.                 Background background = Texture.aBackgroundArray1474s[17];
  2448.                 int k = background.anInt1452 * background.anInt1453 - 1;
  2449.                 int j1 = background.anInt1452 * anInt945 * 2;
  2450.                 byte abyte0[] = background.aByteArray1450;
  2451.                 byte abyte3[] = aByteArray912;
  2452.                 for (int i2 = 0; i2 <= k; i2++)
  2453.                     abyte3[i2] = abyte0[i2 - j1 & k];
  2454.  
  2455.                 background.aByteArray1450 = abyte3;
  2456.                 aByteArray912 = abyte0;
  2457.                 Texture.method370(17);
  2458.                 anInt854++;
  2459.                 if (anInt854 > 1235) {
  2460.                     anInt854 = 0;
  2461.                     stream.createFrame(226);
  2462.                     stream.writeWordBigEndian(0);
  2463.                     int l2 = stream.currentOffset;
  2464.                     stream.writeWord(58722);
  2465.                     stream.writeWordBigEndian(240);
  2466.                     stream.writeWord((int) (Math.random() * 65536D));
  2467.                     stream.writeWordBigEndian((int) (Math.random() * 256D));
  2468.                     if ((int) (Math.random() * 2D) == 0)
  2469.                         stream.writeWord(51825);
  2470.                     stream.writeWordBigEndian((int) (Math.random() * 256D));
  2471.                     stream.writeWord((int) (Math.random() * 65536D));
  2472.                     stream.writeWord(7130);
  2473.                     stream.writeWord((int) (Math.random() * 65536D));
  2474.                     stream.writeWord(61657);
  2475.                     stream.writeBytes(stream.currentOffset - l2);
  2476.                 }
  2477.             }
  2478.             if (Texture.anIntArray1480[24] >= j) {
  2479.                 Background background_1 = Texture.aBackgroundArray1474s[24];
  2480.                 int l = background_1.anInt1452 * background_1.anInt1453 - 1;
  2481.                 int k1 = background_1.anInt1452 * anInt945 * 2;
  2482.                 byte abyte1[] = background_1.aByteArray1450;
  2483.                 byte abyte4[] = aByteArray912;
  2484.                 for (int j2 = 0; j2 <= l; j2++)
  2485.                     abyte4[j2] = abyte1[j2 - k1 & l];
  2486.  
  2487.                 background_1.aByteArray1450 = abyte4;
  2488.                 aByteArray912 = abyte1;
  2489.                 Texture.method370(24);
  2490.             }
  2491.             if (Texture.anIntArray1480[34] >= j) {
  2492.                 Background background_2 = Texture.aBackgroundArray1474s[34];
  2493.                 int i1 = background_2.anInt1452 * background_2.anInt1453 - 1;
  2494.                 int l1 = background_2.anInt1452 * anInt945 * 2;
  2495.                 byte abyte2[] = background_2.aByteArray1450;
  2496.                 byte abyte5[] = aByteArray912;
  2497.                 for (int k2 = 0; k2 <= i1; k2++)
  2498.                     abyte5[k2] = abyte2[k2 - l1 & i1];
  2499.  
  2500.                 background_2.aByteArray1450 = abyte5;
  2501.                 aByteArray912 = abyte2;
  2502.                 Texture.method370(34);
  2503.             }
  2504.             if (Texture.anIntArray1480[40] >= j) {
  2505.                 Background background_2 = Texture.aBackgroundArray1474s[40];
  2506.                 int i1 = background_2.anInt1452 * background_2.anInt1453 - 1;
  2507.                 int l1 = background_2.anInt1452 * anInt945 * 2;
  2508.                 byte abyte2[] = background_2.aByteArray1450;
  2509.                 byte abyte5[] = aByteArray912;
  2510.                 for (int k2 = 0; k2 <= i1; k2++)
  2511.                     abyte5[k2] = abyte2[k2 - l1 & i1];
  2512.                 background_2.aByteArray1450 = abyte5;
  2513.                 aByteArray912 = abyte2;
  2514.                 Texture.method370(40);
  2515.             }
  2516.         }
  2517.     }
  2518.  
  2519.     public void method38() {
  2520.         for (int i = -1; i < playerCount; i++) {
  2521.             int j;
  2522.             if (i == -1)
  2523.                 j = myPlayerIndex;
  2524.             else
  2525.                 j = playerIndices[i];
  2526.             Player player = playerArray[j];
  2527.             if (player != null && player.textCycle > 0) {
  2528.                 player.textCycle--;
  2529.                 if (player.textCycle == 0)
  2530.                     player.textSpoken = null;
  2531.             }
  2532.         }
  2533.         for (int k = 0; k < npcCount; k++) {
  2534.             int l = npcIndices[k];
  2535.             NPC npc = npcArray[l];
  2536.             if (npc != null && npc.textCycle > 0) {
  2537.                 npc.textCycle--;
  2538.                 if (npc.textCycle == 0)
  2539.                     npc.textSpoken = null;
  2540.             }
  2541.         }
  2542.     }
  2543.  
  2544.     public void calcCameraPos() {
  2545.         int i = anInt1098 * 128 + 64;
  2546.         int j = anInt1099 * 128 + 64;
  2547.         int k = method42(plane, j, i) - anInt1100;
  2548.         if (xCameraPos < i) {
  2549.             xCameraPos += anInt1101 + ((i - xCameraPos) * anInt1102) / 1000;
  2550.             if (xCameraPos > i)
  2551.                 xCameraPos = i;
  2552.         }
  2553.         if (xCameraPos > i) {
  2554.             xCameraPos -= anInt1101 + ((xCameraPos - i) * anInt1102) / 1000;
  2555.             if (xCameraPos < i)
  2556.                 xCameraPos = i;
  2557.         }
  2558.         if (zCameraPos < k) {
  2559.             zCameraPos += anInt1101 + ((k - zCameraPos) * anInt1102) / 1000;
  2560.             if (zCameraPos > k)
  2561.                 zCameraPos = k;
  2562.         }
  2563.         if (zCameraPos > k) {
  2564.             zCameraPos -= anInt1101 + ((zCameraPos - k) * anInt1102) / 1000;
  2565.             if (zCameraPos < k)
  2566.                 zCameraPos = k;
  2567.         }
  2568.         if (yCameraPos < j) {
  2569.             yCameraPos += anInt1101 + ((j - yCameraPos) * anInt1102) / 1000;
  2570.             if (yCameraPos > j)
  2571.                 yCameraPos = j;
  2572.         }
  2573.         if (yCameraPos > j) {
  2574.             yCameraPos -= anInt1101 + ((yCameraPos - j) * anInt1102) / 1000;
  2575.             if (yCameraPos < j)
  2576.                 yCameraPos = j;
  2577.         }
  2578.         i = anInt995 * 128 + 64;
  2579.         j = anInt996 * 128 + 64;
  2580.         k = method42(plane, j, i) - anInt997;
  2581.         int l = i - xCameraPos;
  2582.         int i1 = k - zCameraPos;
  2583.         int j1 = j - yCameraPos;
  2584.         int k1 = (int) Math.sqrt(l * l + j1 * j1);
  2585.         int l1 = (int) (Math.atan2(i1, k1) * 325.94900000000001D) & 0x7ff;
  2586.         int i2 = (int) (Math.atan2(l, j1) * -325.94900000000001D) & 0x7ff;
  2587.         if (l1 < 128)
  2588.             l1 = 128;
  2589.         if (l1 > 383)
  2590.             l1 = 383;
  2591.         if (yCameraCurve < l1) {
  2592.             yCameraCurve += anInt998 + ((l1 - yCameraCurve) * anInt999) / 1000;
  2593.             if (yCameraCurve > l1)
  2594.                 yCameraCurve = l1;
  2595.         }
  2596.         if (yCameraCurve > l1) {
  2597.             yCameraCurve -= anInt998 + ((yCameraCurve - l1) * anInt999) / 1000;
  2598.             if (yCameraCurve < l1)
  2599.                 yCameraCurve = l1;
  2600.         }
  2601.         int j2 = i2 - xCameraCurve;
  2602.         if (j2 > 1024)
  2603.             j2 -= 2048;
  2604.         if (j2 < -1024)
  2605.             j2 += 2048;
  2606.         if (j2 > 0) {
  2607.             xCameraCurve += anInt998 + (j2 * anInt999) / 1000;
  2608.             xCameraCurve &= 0x7ff;
  2609.         }
  2610.         if (j2 < 0) {
  2611.             xCameraCurve -= anInt998 + (-j2 * anInt999) / 1000;
  2612.             xCameraCurve &= 0x7ff;
  2613.         }
  2614.         int k2 = i2 - xCameraCurve;
  2615.         if (k2 > 1024)
  2616.             k2 -= 2048;
  2617.         if (k2 < -1024)
  2618.             k2 += 2048;
  2619.         if (k2 < 0 && j2 > 0 || k2 > 0 && j2 < 0)
  2620.             xCameraCurve = i2;
  2621.     }
  2622.  
  2623. private void drawMenu() {
  2624.         int i = menuOffsetX;
  2625.         int j = menuOffsetY;
  2626.         int k = menuWidth;
  2627.         int l = menuHeight + 1;
  2628.         int i1 = 0x5d5447;
  2629.         DrawingArea.transparentBox(l, j, i, i1, k, 0, 115);
  2630.         DrawingArea.drawPixels(16, j + 1, i + 1, 0, k - 2);
  2631.         DrawingArea.fillPixels(i + 1, k - 2, l - 19, 0, j + 18);
  2632.         chatTextDrawingArea.method385(i1, "Choose Option", j + 14, i + 3);
  2633.         int j1 = super.mouseX;
  2634.         int k1 = super.mouseY;
  2635.         if(menuScreenArea == 0) {
  2636.             j1 -= 4;
  2637.             k1 -= 4;
  2638.         }
  2639.         if(menuScreenArea == 1) {
  2640.             j1 -= 519;
  2641.             k1 -= 168;
  2642.         }
  2643.         if(menuScreenArea == 2) {
  2644.             j1 -= 17;
  2645.             k1 -= 338;
  2646.         }
  2647.         if(menuScreenArea == 3) {
  2648.             j1 -= 519;
  2649.             k1 -= 0;
  2650.         }
  2651.         for(int l1 = 0; l1 < menuActionRow; l1++) {
  2652.             int i2 = j + 31 + (menuActionRow - 1 - l1) * 15;
  2653.             int j2 = 0xffffff;
  2654.             if(j1 > i && j1 < i + k && k1 > i2 - 13 && k1 < i2 + 3)
  2655.                 j2 = 0xffff00;
  2656.             chatTextDrawingArea.method389(true, i + 3, j2, menuActionName[l1], i2);
  2657.         }
  2658.     }
  2659.  
  2660.     public void addFriend(long l) {
  2661.         try {
  2662.             if (l == 0L)
  2663.                 return;
  2664.             if (friendsCount >= 100 && anInt1046 != 1) {
  2665.                 pushMessage(
  2666.                         "Your friendlist is full. Max of 100 for free users, and 200 for members",
  2667.                         0, "");
  2668.                 return;
  2669.             }
  2670.             if (friendsCount >= 200) {
  2671.                 pushMessage(
  2672.                         "Your friendlist is full. Max of 100 for free users, and 200 for members",
  2673.                         0, "");
  2674.                 return;
  2675.             }
  2676.             String s = TextClass.fixName(TextClass.nameForLong(l));
  2677.             for (int i = 0; i < friendsCount; i++)
  2678.                 if (friendsListAsLongs[i] == l) {
  2679.                     pushMessage(s + " is already on your friend list", 0, "");
  2680.                     return;
  2681.                 }
  2682.             for (int j = 0; j < ignoreCount; j++)
  2683.                 if (ignoreListAsLongs[j] == l) {
  2684.                     pushMessage("Please remove " + s
  2685.                             + " from your ignore list first", 0, "");
  2686.                     return;
  2687.                 }
  2688.  
  2689.             if (s.equals(myPlayer.name)) {
  2690.                 return;
  2691.             } else {
  2692.                 friendsList[friendsCount] = s;
  2693.                 friendsListAsLongs[friendsCount] = l;
  2694.                 friendsNodeIDs[friendsCount] = 0;
  2695.                 friendsCount++;
  2696.                 needDrawTabArea = true;
  2697.                 stream.createFrame(188);
  2698.                 stream.writeQWord(l);
  2699.                 return;
  2700.             }
  2701.         } catch (RuntimeException runtimeexception) {
  2702.             signlink.reporterror("15283, " + (byte) 68 + ", " + l + ", "
  2703.                     + runtimeexception.toString());
  2704.         }
  2705.         throw new RuntimeException();
  2706.     }
  2707.  
  2708.     private int method42(int i, int j, int k) {
  2709.         int l = k >> 7;
  2710.         int i1 = j >> 7;
  2711.         if (l < 0 || i1 < 0 || l > 103 || i1 > 103)
  2712.             return 0;
  2713.         int j1 = i;
  2714.         if (j1 < 3 && (byteGroundArray[1][l][i1] & 2) == 2)
  2715.             j1++;
  2716.         int k1 = k & 0x7f;
  2717.         int l1 = j & 0x7f;
  2718.         int i2 = intGroundArray[j1][l][i1] * (128 - k1)
  2719.                 + intGroundArray[j1][l + 1][i1] * k1 >> 7;
  2720.         int j2 = intGroundArray[j1][l][i1 + 1] * (128 - k1)
  2721.                 + intGroundArray[j1][l + 1][i1 + 1] * k1 >> 7;
  2722.         return i2 * (128 - l1) + j2 * l1 >> 7;
  2723.     }
  2724.  
  2725.     public int canWalkDelay = 0;
  2726.  
  2727.     public int getDis(int coordX1, int coordY1, int coordX2, int coordY2) {
  2728.         int deltaX = coordX2 - coordX1;
  2729.         int deltaY = coordY2 - coordY1;
  2730.         return ((int) Math.sqrt(Math.pow(deltaX, 2) + Math.pow(deltaY, 2)));
  2731.     }
  2732.  
  2733.     public int random(int range) {
  2734.         return (int) (Math.random() * range);
  2735.     }
  2736.  
  2737.     public boolean withinDistance(int x1, int y1, int x2, int y2, int dis) {
  2738.         for (int i = 0; i <= dis; i++) {
  2739.             try {
  2740.                 if ((x1 + i) == x2
  2741.                         && ((y1 + i) == y2 || (y1 - i) == y2 || y1 == y2))
  2742.                     return true;
  2743.                 else if ((x1 - i) == x2
  2744.                         && ((x1 + i) == y2 || (y1 - i) == y2 || y1 == y2))
  2745.                     return true;
  2746.                 else if (x1 == x2
  2747.                         && ((x1 + i) == y2 || (y1 - i) == y2 || y1 == y2))
  2748.                     return true;
  2749.             } catch (Exception ex) {
  2750.                 System.out
  2751.                         .println("Exception in following, method : WithingDistance");
  2752.             }
  2753.         }
  2754.         return false;
  2755.     }
  2756.  
  2757.     public void resetLogout() {
  2758.  
  2759.         try {
  2760.             if (socketStream != null)
  2761.                 socketStream.close();
  2762.         } catch (Exception _ex) {
  2763.         }
  2764.         socketStream = null;
  2765.         loggedIn = false;
  2766.         loginScreenState = 0;
  2767.         followPlayer = 0;
  2768.         followNPC = 0;
  2769.         followDistance = 1;
  2770.         // myUsername = "";
  2771.         // myPassword = "";
  2772.         unlinkMRUNodes();
  2773.         worldController.initToNull();
  2774.         for (int i = 0; i < 4; i++)
  2775.             aClass11Array1230[i].method210();
  2776.         System.gc();
  2777.         stopMidi();
  2778.         currentSong = -1;
  2779.         nextSong = -1;
  2780.         prevSong = 0;
  2781.     }
  2782.  
  2783.     public void method45() {
  2784.         aBoolean1031 = true;
  2785.         for (int j = 0; j < 7; j++) {
  2786.             anIntArray1065[j] = -1;
  2787.             for (int k = 0; k < IDK.length; k++) {
  2788.                 if (IDK.cache[k].aBoolean662
  2789.                         || IDK.cache[k].anInt657 != j + (aBoolean1047 ? 0 : 7))
  2790.                     continue;
  2791.                 anIntArray1065[j] = k;
  2792.                 break;
  2793.             }
  2794.         }
  2795.     }
  2796.  
  2797.     private void method46(int i, Stream stream) {
  2798.         while (stream.bitPosition + 21 < i * 8) {
  2799.             int k = stream.readBits(14);
  2800.             if (k == 16383)
  2801.                 break;
  2802.             if (npcArray[k] == null)
  2803.                 npcArray[k] = new NPC();
  2804.             NPC npc = npcArray[k];
  2805.             npcIndices[npcCount++] = k;
  2806.             npc.anInt1537 = loopCycle;
  2807.             int l = stream.readBits(5);
  2808.             if (l > 15)
  2809.                 l -= 32;
  2810.             int i1 = stream.readBits(5);
  2811.             if (i1 > 15)
  2812.                 i1 -= 32;
  2813.             int j1 = stream.readBits(1);
  2814.             npc.desc = EntityDef.forID(stream.readBits(14));
  2815.             int k1 = stream.readBits(1);
  2816.             if (k1 == 1)
  2817.                 anIntArray894[anInt893++] = k;
  2818.             npc.anInt1540 = npc.desc.aByte68;
  2819.             npc.anInt1504 = npc.desc.anInt79;
  2820.             npc.anInt1554 = npc.desc.walkAnim;
  2821.             npc.anInt1555 = npc.desc.anInt58;
  2822.             npc.anInt1556 = npc.desc.anInt83;
  2823.             npc.anInt1557 = npc.desc.anInt55;
  2824.             npc.anInt1511 = npc.desc.standAnim;
  2825.             npc.setPos(myPlayer.smallX[0] + i1, myPlayer.smallY[0] + l, j1 == 1);
  2826.         }
  2827.         stream.finishBitAccess();
  2828.     }
  2829.  
  2830.     @Override
  2831.     public void processGameLoop() {
  2832.         if (rsAlreadyLoaded || loadingError || genericLoadingError)
  2833.             return;
  2834.         loopCycle++;
  2835.         if (!loggedIn)
  2836.             processLoginScreenInput();
  2837.         else
  2838.             mainGameProcessor();
  2839.         processOnDemandQueue();
  2840.     }
  2841.  
  2842.     public void method47(boolean flag) {
  2843.         if (myPlayer.x >> 7 == destX && myPlayer.y >> 7 == destY)
  2844.             destX = 0;
  2845.         int j = playerCount;
  2846.         if (flag)
  2847.             j = 1;
  2848.         for (int l = 0; l < j; l++) {
  2849.             Player player;
  2850.             int i1;
  2851.             if (flag) {
  2852.                 player = myPlayer;
  2853.                 i1 = myPlayerIndex << 14;
  2854.             } else {
  2855.                 player = playerArray[playerIndices[l]];
  2856.                 i1 = playerIndices[l] << 14;
  2857.             }
  2858.             if (player == null || !player.isVisible())
  2859.                 continue;
  2860.             player.aBoolean1699 = (lowMem && playerCount > 50 || playerCount > 200)
  2861.                     && !flag && player.anInt1517 == player.anInt1511;
  2862.             int j1 = player.x >> 7;
  2863.             int k1 = player.y >> 7;
  2864.             if (j1 < 0 || j1 >= 104 || k1 < 0 || k1 >= 104)
  2865.                 continue;
  2866.             if (player.aModel_1714 != null && loopCycle >= player.anInt1707
  2867.                     && loopCycle < player.anInt1708) {
  2868.                 player.aBoolean1699 = false;
  2869.                 player.anInt1709 = method42(plane, player.y, player.x);
  2870.                 worldController.method286(plane, player.y, player,
  2871.                         player.anInt1552, player.anInt1722, player.x,
  2872.                         player.anInt1709, player.anInt1719, player.anInt1721,
  2873.                         i1, player.anInt1720);
  2874.                 continue;
  2875.             }
  2876.             if ((player.x & 0x7f) == 64 && (player.y & 0x7f) == 64) {
  2877.                 if (anIntArrayArray929[j1][k1] == anInt1265)
  2878.                     continue;
  2879.                 anIntArrayArray929[j1][k1] = anInt1265;
  2880.             }
  2881.             player.anInt1709 = method42(plane, player.y, player.x);
  2882.             worldController.method285(plane, player.anInt1552,
  2883.                     player.anInt1709, i1, player.y, 60, player.x, player,
  2884.                     player.aBoolean1541);
  2885.         }
  2886.     }
  2887.  
  2888.     private boolean promptUserForInput(RSInterface class9) {
  2889.         int j = class9.contentType;
  2890.         if (anInt900 == 2) {
  2891.             if (j == 201) {
  2892.                 inputTaken = true;
  2893.                 inputDialogState = 0;
  2894.                 messagePromptRaised = true;
  2895.                 promptInput = "";
  2896.                 friendsListAction = 1;
  2897.                 aString1121 = "Enter name of friend to add to list";
  2898.             }
  2899.             if (j == 202) {
  2900.                 inputTaken = true;
  2901.                 inputDialogState = 0;
  2902.                 messagePromptRaised = true;
  2903.                 promptInput = "";
  2904.                 friendsListAction = 2;
  2905.                 aString1121 = "Enter name of friend to delete from list";
  2906.             }
  2907.         }
  2908.         if (j == 205) {
  2909.             anInt1011 = 250;
  2910.             return true;
  2911.         }
  2912.         if (j == 501) {
  2913.             inputTaken = true;
  2914.             inputDialogState = 0;
  2915.             messagePromptRaised = true;
  2916.             promptInput = "";
  2917.             friendsListAction = 4;
  2918.             aString1121 = "Enter name of player to add to list";
  2919.         }
  2920.         if (j == 502) {
  2921.             inputTaken = true;
  2922.             inputDialogState = 0;
  2923.             messagePromptRaised = true;
  2924.             promptInput = "";
  2925.             friendsListAction = 5;
  2926.             aString1121 = "Enter name of player to delete from list";
  2927.         }
  2928.         if (j == 550) {
  2929.             inputTaken = true;
  2930.             inputDialogState = 0;
  2931.             messagePromptRaised = true;
  2932.             promptInput = "";
  2933.             friendsListAction = 6;
  2934.             aString1121 = "Enter the name of the chat you wish to join";
  2935.         }
  2936.         if (j >= 300 && j <= 313) {
  2937.             int k = (j - 300) / 2;
  2938.             int j1 = j & 1;
  2939.             int i2 = anIntArray1065[k];
  2940.             if (i2 != -1) {
  2941.                 do {
  2942.                     if (j1 == 0 && --i2 < 0)
  2943.                         i2 = IDK.length - 1;
  2944.                     if (j1 == 1 && ++i2 >= IDK.length)
  2945.                         i2 = 0;
  2946.                 } while (IDK.cache[i2].aBoolean662
  2947.                         || IDK.cache[i2].anInt657 != k + (aBoolean1047 ? 0 : 7));
  2948.                 anIntArray1065[k] = i2;
  2949.                 aBoolean1031 = true;
  2950.             }
  2951.         }
  2952.         if (j >= 314 && j <= 323) {
  2953.             int l = (j - 314) / 2;
  2954.             int k1 = j & 1;
  2955.             int j2 = anIntArray990[l];
  2956.             if (k1 == 0 && --j2 < 0)
  2957.                 j2 = anIntArrayArray1003[l].length - 1;
  2958.             if (k1 == 1 && ++j2 >= anIntArrayArray1003[l].length)
  2959.                 j2 = 0;
  2960.             anIntArray990[l] = j2;
  2961.             aBoolean1031 = true;
  2962.         }
  2963.         if (j == 324 && !aBoolean1047) {
  2964.             aBoolean1047 = true;
  2965.             method45();
  2966.         }
  2967.         if (j == 325 && aBoolean1047) {
  2968.             aBoolean1047 = false;
  2969.             method45();
  2970.         }
  2971.         if (j == 326) {
  2972.             stream.createFrame(101);
  2973.             stream.writeWordBigEndian(aBoolean1047 ? 0 : 1);
  2974.             for (int i1 = 0; i1 < 7; i1++)
  2975.                 stream.writeWordBigEndian(anIntArray1065[i1]);
  2976.  
  2977.             for (int l1 = 0; l1 < 5; l1++)
  2978.                 stream.writeWordBigEndian(anIntArray990[l1]);
  2979.  
  2980.             return true;
  2981.         }
  2982.         if (j == 613)
  2983.             canMute = !canMute;
  2984.         if (j >= 601 && j <= 612) {
  2985.             clearTopInterfaces();
  2986.             if (reportAbuseInput.length() > 0) {
  2987.                 stream.createFrame(218);
  2988.                 stream.writeQWord(TextClass.longForName(reportAbuseInput));
  2989.                 stream.writeWordBigEndian(j - 601);
  2990.                 stream.writeWordBigEndian(canMute ? 1 : 0);
  2991.             }
  2992.         }
  2993.         return false;
  2994.     }
  2995.  
  2996.     public void method49(Stream stream) {
  2997.         for (int j = 0; j < anInt893; j++) {
  2998.             int k = anIntArray894[j];
  2999.             Player player = playerArray[k];
  3000.             int l = stream.readUnsignedByte();
  3001.             if ((l & 0x40) != 0)
  3002.                 l += stream.readUnsignedByte() << 8;
  3003.             method107(l, k, stream, player);
  3004.         }
  3005.     }
  3006.  
  3007.     public void method50(int i, int k, int l, int i1, int j1) {
  3008.         int k1 = worldController.method300(j1, l, i);
  3009.         if (k1 != 0) {
  3010.             int l1 = worldController.method304(j1, l, i, k1);
  3011.             int k2 = l1 >> 6 & 3;
  3012.             int i3 = l1 & 0x1f;
  3013.             int k3 = k;
  3014.             if (k1 > 0)
  3015.                 k3 = i1;
  3016.             int ai[] = aClass30_Sub2_Sub1_Sub1_1263.myPixels;
  3017.             int k4 = 24624 + l * 4 + (103 - i) * 512 * 4;
  3018.             int i5 = k1 >> 14 & 0x7fff;
  3019.             ObjectDef class46_2 = ObjectDef.forID(i5);
  3020.             if (class46_2.anInt758 != -1) {
  3021.                 Background background_2 = mapScenes[class46_2.anInt758];
  3022.                 if (background_2 != null) {
  3023.                     int i6 = (class46_2.anInt744 * 4 - background_2.anInt1452) / 2;
  3024.                     int j6 = (class46_2.anInt761 * 4 - background_2.anInt1453) / 2;
  3025.                     background_2.drawBackground(48 + l * 4 + i6, 48
  3026.                             + (104 - i - class46_2.anInt761) * 4 + j6);
  3027.                 }
  3028.             } else {
  3029.                 if (i3 == 0 || i3 == 2)
  3030.                     if (k2 == 0) {
  3031.                         ai[k4] = k3;
  3032.                         ai[k4 + 512] = k3;
  3033.                         ai[k4 + 1024] = k3;
  3034.                         ai[k4 + 1536] = k3;
  3035.                     } else if (k2 == 1) {
  3036.                         ai[k4] = k3;
  3037.                         ai[k4 + 1] = k3;
  3038.                         ai[k4 + 2] = k3;
  3039.                         ai[k4 + 3] = k3;
  3040.                     } else if (k2 == 2) {
  3041.                         ai[k4 + 3] = k3;
  3042.                         ai[k4 + 3 + 512] = k3;
  3043.                         ai[k4 + 3 + 1024] = k3;
  3044.                         ai[k4 + 3 + 1536] = k3;
  3045.                     } else if (k2 == 3) {
  3046.                         ai[k4 + 1536] = k3;
  3047.                         ai[k4 + 1536 + 1] = k3;
  3048.                         ai[k4 + 1536 + 2] = k3;
  3049.                         ai[k4 + 1536 + 3] = k3;
  3050.                     }
  3051.                 if (i3 == 3)
  3052.                     if (k2 == 0)
  3053.                         ai[k4] = k3;
  3054.                     else if (k2 == 1)
  3055.                         ai[k4 + 3] = k3;
  3056.                     else if (k2 == 2)
  3057.                         ai[k4 + 3 + 1536] = k3;
  3058.                     else if (k2 == 3)
  3059.                         ai[k4 + 1536] = k3;
  3060.                 if (i3 == 2)
  3061.                     if (k2 == 3) {
  3062.                         ai[k4] = k3;
  3063.                         ai[k4 + 512] = k3;
  3064.                         ai[k4 + 1024] = k3;
  3065.                         ai[k4 + 1536] = k3;
  3066.                     } else if (k2 == 0) {
  3067.                         ai[k4] = k3;
  3068.                         ai[k4 + 1] = k3;
  3069.                         ai[k4 + 2] = k3;
  3070.                         ai[k4 + 3] = k3;
  3071.                     } else if (k2 == 1) {
  3072.                         ai[k4 + 3] = k3;
  3073.                         ai[k4 + 3 + 512] = k3;
  3074.                         ai[k4 + 3 + 1024] = k3;
  3075.                         ai[k4 + 3 + 1536] = k3;
  3076.                     } else if (k2 == 2) {
  3077.                         ai[k4 + 1536] = k3;
  3078.                         ai[k4 + 1536 + 1] = k3;
  3079.                         ai[k4 + 1536 + 2] = k3;
  3080.                         ai[k4 + 1536 + 3] = k3;
  3081.                     }
  3082.             }
  3083.         }
  3084.         k1 = worldController.method302(j1, l, i);
  3085.         if (k1 != 0) {
  3086.             int i2 = worldController.method304(j1, l, i, k1);
  3087.             int l2 = i2 >> 6 & 3;
  3088.             int j3 = i2 & 0x1f;
  3089.             int l3 = k1 >> 14 & 0x7fff;
  3090.             ObjectDef class46_1 = ObjectDef.forID(l3);
  3091.             if (class46_1.anInt758 != -1) {
  3092.                 Background background_1 = mapScenes[class46_1.anInt758];
  3093.                 if (background_1 != null) {
  3094.                     int j5 = (class46_1.anInt744 * 4 - background_1.anInt1452) / 2;
  3095.                     int k5 = (class46_1.anInt761 * 4 - background_1.anInt1453) / 2;
  3096.                     background_1.drawBackground(48 + l * 4 + j5, 48
  3097.                             + (104 - i - class46_1.anInt761) * 4 + k5);
  3098.                 }
  3099.             } else if (j3 == 9) {
  3100.                 int l4 = 0xeeeeee;
  3101.                 if (k1 > 0)
  3102.                     l4 = 0xee0000;
  3103.                 int ai1[] = aClass30_Sub2_Sub1_Sub1_1263.myPixels;
  3104.                 int l5 = 24624 + l * 4 + (103 - i) * 512 * 4;
  3105.                 if (l2 == 0 || l2 == 2) {
  3106.                     ai1[l5 + 1536] = l4;
  3107.                     ai1[l5 + 1024 + 1] = l4;
  3108.                     ai1[l5 + 512 + 2] = l4;
  3109.                     ai1[l5 + 3] = l4;
  3110.                 } else {
  3111.                     ai1[l5] = l4;
  3112.                     ai1[l5 + 512 + 1] = l4;
  3113.                     ai1[l5 + 1024 + 2] = l4;
  3114.                     ai1[l5 + 1536 + 3] = l4;
  3115.                 }
  3116.             }
  3117.         }
  3118.         k1 = worldController.method303(j1, l, i);
  3119.         if (k1 != 0) {
  3120.             int j2 = k1 >> 14 & 0x7fff;
  3121.             ObjectDef class46 = ObjectDef.forID(j2);
  3122.             if (class46.anInt758 != -1) {
  3123.                 Background background = mapScenes[class46.anInt758];
  3124.                 if (background != null) {
  3125.                     int i4 = (class46.anInt744 * 4 - background.anInt1452) / 2;
  3126.                     int j4 = (class46.anInt761 * 4 - background.anInt1453) / 2;
  3127.                     background.drawBackground(48 + l * 4 + i4, 48
  3128.                             + (104 - i - class46.anInt761) * 4 + j4);
  3129.                 }
  3130.             }
  3131.         }
  3132.     }
  3133.  
  3134.     public void loadTitleScreen() {
  3135.         aBackground_966 = new Background(titleStreamLoader, "titlebox", 0);
  3136.         aBackground_967 = new Background(titleStreamLoader, "titlebutton", 0);
  3137.         aBackgroundArray1152s = new Background[12];
  3138.         int j = 0;
  3139.         try {
  3140.             j = Integer.parseInt(getParameter("fl_icon"));
  3141.         } catch (Exception _ex) {
  3142.         }
  3143.         if (j == 0) {
  3144.             for (int k = 0; k < 12; k++)
  3145.                 aBackgroundArray1152s[k] = new Background(titleStreamLoader,
  3146.                         "runes", k);
  3147.  
  3148.         } else {
  3149.             for (int l = 0; l < 12; l++)
  3150.                 aBackgroundArray1152s[l] = new Background(titleStreamLoader,
  3151.                         "runes", 12 + (l & 3));
  3152.  
  3153.         }
  3154.         aClass30_Sub2_Sub1_Sub1_1201 = new Sprite(128, 265);
  3155.         aClass30_Sub2_Sub1_Sub1_1202 = new Sprite(128, 265);
  3156.         System.arraycopy(aRSImageProducer_1110.anIntArray315, 0,
  3157.                 aClass30_Sub2_Sub1_Sub1_1201.myPixels, 0, 33920);
  3158.  
  3159.         System.arraycopy(aRSImageProducer_1111.anIntArray315, 0,
  3160.                 aClass30_Sub2_Sub1_Sub1_1202.myPixels, 0, 33920);
  3161.  
  3162.         anIntArray851 = new int[256];
  3163.         for (int k1 = 0; k1 < 64; k1++)
  3164.             anIntArray851[k1] = k1 * 0x40000;
  3165.  
  3166.         for (int l1 = 0; l1 < 64; l1++)
  3167.             anIntArray851[l1 + 64] = 0xff0000 + 1024 * l1;
  3168.  
  3169.         for (int i2 = 0; i2 < 64; i2++)
  3170.             anIntArray851[i2 + 128] = 0xFFFF00 + 4 * i2;
  3171.  
  3172.         for (int j2 = 0; j2 < 64; j2++)
  3173.             anIntArray851[j2 + 192] = 0xffffff;
  3174.  
  3175.         anIntArray852 = new int[256];
  3176.         for (int k2 = 0; k2 < 64; k2++)
  3177.             anIntArray852[k2] = k2 * 1024;
  3178.  
  3179.         for (int l2 = 0; l2 < 64; l2++)
  3180.             anIntArray852[l2 + 64] = 65280 + 4 * l2;
  3181.  
  3182.         for (int i3 = 0; i3 < 64; i3++)
  3183.             anIntArray852[i3 + 128] = 65535 + 0x40000 * i3;
  3184.  
  3185.         for (int j3 = 0; j3 < 64; j3++)
  3186.             anIntArray852[j3 + 192] = 0xffffff;
  3187.  
  3188.         anIntArray853 = new int[256];
  3189.         for (int k3 = 0; k3 < 64; k3++)
  3190.             anIntArray853[k3] = k3 * 4;
  3191.  
  3192.         for (int l3 = 0; l3 < 64; l3++)
  3193.             anIntArray853[l3 + 64] = 255 + 0x40000 * l3;
  3194.  
  3195.         for (int i4 = 0; i4 < 64; i4++)
  3196.             anIntArray853[i4 + 128] = 0xff00ff + 1024 * i4;
  3197.  
  3198.         for (int j4 = 0; j4 < 64; j4++)
  3199.             anIntArray853[j4 + 192] = 0xffffff;
  3200.  
  3201.         anIntArray850 = new int[256];
  3202.         anIntArray1190 = new int[32768];
  3203.         anIntArray1191 = new int[32768];
  3204.         randomizeBackground(null);
  3205.         anIntArray828 = new int[32768];
  3206.         anIntArray829 = new int[32768];
  3207.         drawLoadingText(10, "Connecting to fileserver");
  3208.         if (!aBoolean831) {
  3209.             drawFlames = true;
  3210.             aBoolean831 = true;
  3211.             startRunnable(this, 2);
  3212.         }
  3213.     }
  3214.  
  3215.     private static void setHighMem() {
  3216.         WorldController.lowMem = false;
  3217.         Texture.lowMem = false;
  3218.         lowMem = false;
  3219.         ObjectManager.lowMem = false;
  3220.         ObjectDef.lowMem = false;
  3221.     }
  3222.  
  3223.     public static void main(String args[]) {
  3224.         try {
  3225.             nodeID = 10;
  3226.             portOff = 0;
  3227.             setHighMem();
  3228.             isMembers = true;
  3229.             signlink.storeid = 32;
  3230.             signlink.startpriv(InetAddress.getLocalHost());
  3231.             instance = new Jframe(args);
  3232.         } catch (Exception exception) {
  3233.         }
  3234.     }
  3235.    
  3236.         void mouseWheelDragged(int i, int j) {
  3237.         if (!mouseWheelDown)
  3238.             return;
  3239.         this.anInt1186 += i * 3;
  3240.         this.anInt1187 += (j << 1);
  3241.     }
  3242.  
  3243.     public static client instance;
  3244.  
  3245.     public void loadingStages() {
  3246.         if (lowMem && loadingStage == 2 && ObjectManager.anInt131 != plane) {
  3247.             aRSImageProducer_1165.initDrawingArea();
  3248.             aTextDrawingArea_1271.drawText(0, "Loading - please wait.", 151,
  3249.                     257);
  3250.             aTextDrawingArea_1271.drawText(0xFFFFFF, "Loading - please wait.",
  3251.                     150, 256);
  3252.             aRSImageProducer_1165.drawGraphics(4, super.graphics, 4);
  3253.             loadingStage = 1;
  3254.             aLong824 = System.currentTimeMillis();
  3255.         }
  3256.         if (noClipIsOn)
  3257.             noClip();
  3258.  
  3259.         if (loadingStage == 1) {
  3260.             int j = method54();
  3261.             if (j != 0 && System.currentTimeMillis() - aLong824 > 0x57e40L) {
  3262.                 signlink.reporterror(myUsername + " glcfb " + aLong1215 + ","
  3263.                         + j + "," + lowMem + "," + decompressors[0] + ","
  3264.                         + onDemandFetcher.getNodeCount() + "," + plane + ","
  3265.                         + anInt1069 + "," + anInt1070);
  3266.                 aLong824 = System.currentTimeMillis();
  3267.             }
  3268.         }
  3269.         if (loadingStage == 2 && plane != anInt985) {
  3270.             anInt985 = plane;
  3271.             method24(plane);
  3272.         }
  3273.     }
  3274.  
  3275.     private int method54() {
  3276.         for (int i = 0; i < aByteArrayArray1183.length; i++) {
  3277.             if (aByteArrayArray1183[i] == null && anIntArray1235[i] != -1) {
  3278.                 System.out.println("MapID:" + anIntArray1235[i]);
  3279.                 if (anIntArray1235[i] == 1510)// just a test
  3280.                     anIntArray1235[i] = -1;
  3281.                 return -1;// null map files
  3282.             }
  3283.             if (aByteArrayArray1247[i] == null && anIntArray1236[i] != -1) {
  3284.                 System.out.println("LandscapeID:" + anIntArray1236[i]);
  3285.                 if (anIntArray1236[i] == 1511)// just a test
  3286.                     anIntArray1236[i] = -1;
  3287.                 return -2;
  3288.             }
  3289.         }
  3290.         boolean flag = true;
  3291.         for (int j = 0; j < aByteArrayArray1183.length; j++) {
  3292.             byte abyte0[] = aByteArrayArray1247[j];
  3293.             if (abyte0 != null) {
  3294.                 int k = (anIntArray1234[j] >> 8) * 64 - baseX;
  3295.                 int l = (anIntArray1234[j] & 0xff) * 64 - baseY;
  3296.                 if (aBoolean1159) {
  3297.                     k = 10;
  3298.                     l = 10;
  3299.                 }
  3300.                 flag &= ObjectManager.method189(k, abyte0, l);
  3301.             }
  3302.         }
  3303.         if (!flag)
  3304.             return -3;// couldn't parse all landscapes
  3305.         if (aBoolean1080) {
  3306.             return -4;
  3307.         } else {
  3308.             loadingStage = 2;
  3309.             ObjectManager.anInt131 = plane;
  3310.             method22();
  3311.             stream.createFrame(121);
  3312.             return 0;
  3313.         }
  3314.     }
  3315.  
  3316.     public void method55() {
  3317.         for (Animable_Sub4 class30_sub2_sub4_sub4 = (Animable_Sub4) aClass19_1013
  3318.                 .reverseGetFirst(); class30_sub2_sub4_sub4 != null; class30_sub2_sub4_sub4 = (Animable_Sub4) aClass19_1013
  3319.                 .reverseGetNext())
  3320.             if (class30_sub2_sub4_sub4.anInt1597 != plane
  3321.                     || loopCycle > class30_sub2_sub4_sub4.anInt1572)
  3322.                 class30_sub2_sub4_sub4.unlink();
  3323.             else if (loopCycle >= class30_sub2_sub4_sub4.anInt1571) {
  3324.                 if (class30_sub2_sub4_sub4.anInt1590 > 0) {
  3325.                     NPC npc = npcArray[class30_sub2_sub4_sub4.anInt1590 - 1];
  3326.                     if (npc != null && npc.x >= 0 && npc.x < 13312
  3327.                             && npc.y >= 0 && npc.y < 13312)
  3328.                         class30_sub2_sub4_sub4.method455(
  3329.                                 loopCycle,
  3330.                                 npc.y,
  3331.                                 method42(class30_sub2_sub4_sub4.anInt1597,
  3332.                                         npc.y, npc.x)
  3333.                                         - class30_sub2_sub4_sub4.anInt1583,
  3334.                                 npc.x);
  3335.                 }
  3336.                 if (class30_sub2_sub4_sub4.anInt1590 < 0) {
  3337.                     int j = -class30_sub2_sub4_sub4.anInt1590 - 1;
  3338.                     Player player;
  3339.                     if (j == unknownInt10)
  3340.                         player = myPlayer;
  3341.                     else
  3342.                         player = playerArray[j];
  3343.                     if (player != null && player.x >= 0 && player.x < 13312
  3344.                             && player.y >= 0 && player.y < 13312)
  3345.                         class30_sub2_sub4_sub4.method455(
  3346.                                 loopCycle,
  3347.                                 player.y,
  3348.                                 method42(class30_sub2_sub4_sub4.anInt1597,
  3349.                                         player.y, player.x)
  3350.                                         - class30_sub2_sub4_sub4.anInt1583,
  3351.                                 player.x);
  3352.                 }
  3353.                 class30_sub2_sub4_sub4.method456(anInt945);
  3354.                 worldController.method285(plane,
  3355.                         class30_sub2_sub4_sub4.anInt1595,
  3356.                         (int) class30_sub2_sub4_sub4.aDouble1587, -1,
  3357.                         (int) class30_sub2_sub4_sub4.aDouble1586, 60,
  3358.                         (int) class30_sub2_sub4_sub4.aDouble1585,
  3359.                         class30_sub2_sub4_sub4, false);
  3360.             }
  3361.  
  3362.     }
  3363.  
  3364.     @Override
  3365.     public AppletContext getAppletContext() {
  3366.         if (signlink.mainapp != null)
  3367.             return signlink.mainapp.getAppletContext();
  3368.         else
  3369.             return super.getAppletContext();
  3370.     }
  3371.  
  3372.     public static String capitalize(String s) {
  3373.         for (int i = 0; i < s.length(); i++) {
  3374.             if (i == 0) {
  3375.                 s = String.format("%s%s", Character.toUpperCase(s.charAt(0)),
  3376.                         s.substring(1));
  3377.             }
  3378.             if (!Character.isLetterOrDigit(s.charAt(i))) {
  3379.                 if (i + 1 < s.length()) {
  3380.                     s = String.format("%s%s%s", s.subSequence(0, i + 1),
  3381.                             Character.toUpperCase(s.charAt(i + 1)),
  3382.                             s.substring(i + 2));
  3383.                 }
  3384.             }
  3385.         }
  3386.         return s;
  3387.     }
  3388.  
  3389.     private void drawLogo() {
  3390.         byte abyte0[] = titleStreamLoader.getDataForName("title.dat");
  3391.         Sprite sprite = new Sprite(abyte0, this);
  3392.         aRSImageProducer_1110.initDrawingArea();
  3393.         sprite.method346(0, 0);
  3394.         aRSImageProducer_1111.initDrawingArea();
  3395.         sprite.method346(-637, 0);
  3396.         aRSImageProducer_1107.initDrawingArea();
  3397.         sprite.method346(-128, 0);
  3398.         aRSImageProducer_1108.initDrawingArea();
  3399.         sprite.method346(-202, -371);
  3400.         aRSImageProducer_1109.initDrawingArea();
  3401.         sprite.method346(-202, -171);
  3402.         aRSImageProducer_1112.initDrawingArea();
  3403.         sprite.method346(0, -265);
  3404.         aRSImageProducer_1113.initDrawingArea();
  3405.         sprite.method346(-562, -265);
  3406.         aRSImageProducer_1114.initDrawingArea();
  3407.         sprite.method346(-128, -171);
  3408.         aRSImageProducer_1115.initDrawingArea();
  3409.         sprite.method346(-562, -171);
  3410.         int ai[] = new int[sprite.myWidth];
  3411.         for (int j = 0; j < sprite.myHeight; j++) {
  3412.             for (int k = 0; k < sprite.myWidth; k++)
  3413.                 ai[k] = sprite.myPixels[(sprite.myWidth - k - 1)
  3414.                         + sprite.myWidth * j];
  3415.  
  3416.             System.arraycopy(ai, 0, sprite.myPixels, sprite.myWidth * j,
  3417.                     sprite.myWidth);
  3418.         }
  3419.         /*
  3420.          * aRSImageProducer_1110.initDrawingArea(); sprite.method346(382, 0);
  3421.          * aRSImageProducer_1111.initDrawingArea(); sprite.method346(-255, 0);
  3422.          * aRSImageProducer_1107.initDrawingArea(); sprite.method346(254, 0);
  3423.          * aRSImageProducer_1108.initDrawingArea(); sprite.method346(180, -371);
  3424.          * aRSImageProducer_1109.initDrawingArea(); sprite.method346(180, -171);
  3425.          * aRSImageProducer_1112.initDrawingArea(); sprite.method346(382, -265);
  3426.          * aRSImageProducer_1113.initDrawingArea(); sprite.method346(-180,
  3427.          * -265); aRSImageProducer_1114.initDrawingArea(); sprite.method346(254,
  3428.          * -171); aRSImageProducer_1115.initDrawingArea();
  3429.          */
  3430.         // sprite.method346(-180, -171);
  3431.         // sprite = new Sprite(titleStreamLoader, "logo", 0);
  3432.         // aRSImageProducer_1107.initDrawingArea();
  3433.         // sprite.drawSprite(382 - sprite.myWidth / 2 - 128, 18);
  3434.         sprite = null;
  3435.         System.gc();
  3436.     }
  3437.  
  3438.     private void processOnDemandQueue() {
  3439.         do {
  3440.             OnDemandData onDemandData;
  3441.             do {
  3442.                 onDemandData = onDemandFetcher.getNextNode();
  3443.                 if (onDemandData == null)
  3444.                     return;
  3445.                 if (onDemandData.dataType == 0) {
  3446.                     Model.method460(onDemandData.buffer, onDemandData.ID);
  3447.                     needDrawTabArea = true;
  3448.                     if (backDialogID != -1)
  3449.                         inputTaken = true;
  3450.                 }
  3451.                 if (onDemandData.dataType == 1 && onDemandData.buffer != null)
  3452.                     Class36.method529(onDemandData.buffer, onDemandData.ID);
  3453.                 if (onDemandData.dataType == 2 && onDemandData.ID == nextSong
  3454.                         && onDemandData.buffer != null)
  3455.                     saveMidi(songChanging, onDemandData.buffer);
  3456.                 if (onDemandData.dataType == 3 && loadingStage == 1) {
  3457.                     for (int i = 0; i < aByteArrayArray1183.length; i++) {
  3458.                         if (anIntArray1235[i] == onDemandData.ID) {
  3459.                             System.out.println("Floor Map Loaded: "
  3460.                                     + anIntArray1235[i]);
  3461.                             // aByteArrayArray1183[i] =
  3462.                             // FileOperations.readFile("maps/floors/" +
  3463.                             // anIntArray1235[i]);
  3464.                             if (aByteArrayArray1183[i] == null)
  3465.                                 aByteArrayArray1183[i] = onDemandData.buffer;
  3466.                             if (onDemandData.buffer == null)
  3467.                                 anIntArray1235[i] = -1;
  3468.                             break;
  3469.                         }
  3470.                         if (anIntArray1236[i] != onDemandData.ID)
  3471.                             continue;
  3472.                         System.out.println("Object Map Loaded: "
  3473.                                 + anIntArray1236[i]);
  3474.                         // aByteArrayArray1247[i] =
  3475.                         // FileOperations.readFile("maps/objects/" +
  3476.                         // anIntArray1236[i]);
  3477.                         if (aByteArrayArray1247[i] == null)
  3478.                             aByteArrayArray1247[i] = onDemandData.buffer;
  3479.                         if (onDemandData.buffer == null)
  3480.                             anIntArray1236[i] = -1;
  3481.                         break;
  3482.                     }
  3483.  
  3484.                 }
  3485.             } while (onDemandData.dataType != 93
  3486.                     || !onDemandFetcher.method564(onDemandData.ID));
  3487.             ObjectManager.method173(new Stream(onDemandData.buffer),
  3488.                     onDemandFetcher);
  3489.         } while (true);
  3490.     }
  3491.  
  3492.     public void calcFlamesPosition() {
  3493.         char c = '\u0100';
  3494.         for (int j = 10; j < 117; j++) {
  3495.             int k = (int) (Math.random() * 100D);
  3496.             if (k < 50)
  3497.                 anIntArray828[j + (c - 2 << 7)] = 255;
  3498.         }
  3499.         for (int l = 0; l < 100; l++) {
  3500.             int i1 = (int) (Math.random() * 124D) + 2;
  3501.             int k1 = (int) (Math.random() * 128D) + 128;
  3502.             int k2 = i1 + (k1 << 7);
  3503.             anIntArray828[k2] = 192;
  3504.         }
  3505.  
  3506.         for (int j1 = 1; j1 < c - 1; j1++) {
  3507.             for (int l1 = 1; l1 < 127; l1++) {
  3508.                 int l2 = l1 + (j1 << 7);
  3509.                 anIntArray829[l2] = (anIntArray828[l2 - 1]
  3510.                         + anIntArray828[l2 + 1] + anIntArray828[l2 - 128] + anIntArray828[l2 + 128]) / 4;
  3511.             }
  3512.  
  3513.         }
  3514.  
  3515.         anInt1275 += 128;
  3516.         if (anInt1275 > anIntArray1190.length) {
  3517.             anInt1275 -= anIntArray1190.length;
  3518.             int i2 = (int) (Math.random() * 12D);
  3519.             randomizeBackground(aBackgroundArray1152s[i2]);
  3520.         }
  3521.         for (int j2 = 1; j2 < c - 1; j2++) {
  3522.             for (int i3 = 1; i3 < 127; i3++) {
  3523.                 int k3 = i3 + (j2 << 7);
  3524.                 int i4 = anIntArray829[k3 + 128]
  3525.                         - anIntArray1190[k3 + anInt1275 & anIntArray1190.length
  3526.                                 - 1] / 5;
  3527.                 if (i4 < 0)
  3528.                     i4 = 0;
  3529.                 anIntArray828[k3] = i4;
  3530.             }
  3531.  
  3532.         }
  3533.  
  3534.         System.arraycopy(anIntArray969, 1, anIntArray969, 0, c - 1);
  3535.  
  3536.         anIntArray969[c - 1] = (int) (Math.sin(loopCycle / 14D) * 16D
  3537.                 + Math.sin(loopCycle / 15D) * 14D + Math.sin(loopCycle / 16D) * 12D);
  3538.         if (anInt1040 > 0)
  3539.             anInt1040 -= 4;
  3540.         if (anInt1041 > 0)
  3541.             anInt1041 -= 4;
  3542.         if (anInt1040 == 0 && anInt1041 == 0) {
  3543.             int l3 = (int) (Math.random() * 2000D);
  3544.             if (l3 == 0)
  3545.                 anInt1040 = 1024;
  3546.             if (l3 == 1)
  3547.                 anInt1041 = 1024;
  3548.         }
  3549.     }
  3550.  
  3551.     private boolean saveWave(byte abyte0[], int i) {
  3552.         return abyte0 == null || signlink.wavesave(abyte0, i);
  3553.     }
  3554.  
  3555.     public void method60(int i) {
  3556.         RSInterface class9 = RSInterface.interfaceCache[i];
  3557.         for (int j = 0; j < class9.children.length; j++) {
  3558.             if (class9.children[j] == -1)
  3559.                 break;
  3560.             RSInterface class9_1 = RSInterface.interfaceCache[class9.children[j]];
  3561.             if (class9_1.type == 1)
  3562.                 method60(class9_1.id);
  3563.             class9_1.anInt246 = 0;
  3564.             class9_1.anInt208 = 0;
  3565.         }
  3566.     }
  3567.  
  3568.     public void drawHeadIcon() {
  3569.         if (anInt855 != 2)
  3570.             return;
  3571.         calcEntityScreenPos((anInt934 - baseX << 7) + anInt937, anInt936 * 2,
  3572.                 (anInt935 - baseY << 7) + anInt938);
  3573.         if (spriteDrawX > -1 && loopCycle % 20 < 10)
  3574.             headIconsHint[0].drawSprite(spriteDrawX - 12, spriteDrawY - 28);
  3575.     }
  3576.  
  3577.     private void mainGameProcessor() {
  3578.         if (anInt1104 > 1)
  3579.             anInt1104--;
  3580.         if (anInt1011 > 0)
  3581.             anInt1011--;
  3582.         for (int j = 0; j < 5; j++)
  3583.             if (!parsePacket())
  3584.                 break;
  3585.  
  3586.         if (!loggedIn)
  3587.             return;
  3588.         try {
  3589.             canWalkDelay--;
  3590.             if (followNPC > 0) {
  3591.                 NPC n = npcArray[followNPC];
  3592.                 if (n != null) {
  3593.                     if (!withinDistance(myPlayer.smallX[0], myPlayer.smallY[0],
  3594.                             n.smallX[0], n.smallY[0], followDistance)) {
  3595.                         doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
  3596.                                 n.smallY[0], myPlayer.smallX[0], false,
  3597.                                 n.smallX[0]);
  3598.                     }
  3599.                 }
  3600.             } else if (followPlayer > 0 && canWalkDelay <= 0) {
  3601.                 Player p = playerArray[followPlayer];
  3602.                 if (p != null) {
  3603.                     int dis = getDis(myPlayer.smallX[0], myPlayer.smallY[0],
  3604.                             p.smallX[0], p.smallY[0]);
  3605.                     if (dis > followDistance) {
  3606.                         doWalkTo(2, 0, 1, 0, myPlayer.smallY[0],
  3607.                                 followDistance, 0, p.smallY[0],
  3608.                                 myPlayer.smallX[0], false, p.smallX[0]);
  3609.                         canWalkDelay = 30;
  3610.                     } else if (dis == 0) {
  3611.                         int rnd = random(4);
  3612.                         if (rnd == 0) {
  3613.                             doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
  3614.                                     p.smallY[0], myPlayer.smallX[0], false,
  3615.                                     p.smallX[0] - 2);
  3616.                         } else if (rnd == 1) {
  3617.                             doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
  3618.                                     p.smallY[0], myPlayer.smallX[0], false,
  3619.                                     p.smallX[0] + 2);
  3620.                         } else if (rnd == 2) {
  3621.                             doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
  3622.                                     p.smallY[0] - 2, myPlayer.smallX[0], false,
  3623.                                     p.smallX[0]);
  3624.                         } else if (rnd == 3) {
  3625.                             doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
  3626.                                     p.smallY[0] + 2, myPlayer.smallX[0], false,
  3627.                                     p.smallX[0]);
  3628.                         }
  3629.                         canWalkDelay = 60;
  3630.                     }
  3631.                 }
  3632.             }
  3633.         } catch (Exception ex) {
  3634.             System.out.println("Exception in following, method : in process.)");
  3635.         }
  3636.         synchronized (mouseDetection.syncObject) {
  3637.             if (flagged) {
  3638.                 if (super.clickMode3 != 0 || mouseDetection.coordsIndex >= 40) {
  3639.                     stream.createFrame(45);
  3640.                     stream.writeWordBigEndian(0);
  3641.                     int j2 = stream.currentOffset;
  3642.                     int j3 = 0;
  3643.                     for (int j4 = 0; j4 < mouseDetection.coordsIndex; j4++) {
  3644.                         if (j2 - stream.currentOffset >= 240)
  3645.                             break;
  3646.                         j3++;
  3647.                         int l4 = mouseDetection.coordsY[j4];
  3648.                         if (l4 < 0)
  3649.                             l4 = 0;
  3650.                         else if (l4 > 502)
  3651.                             l4 = 502;
  3652.                         int k5 = mouseDetection.coordsX[j4];
  3653.                         if (k5 < 0)
  3654.                             k5 = 0;
  3655.                         else if (k5 > 764)
  3656.                             k5 = 764;
  3657.                         int i6 = l4 * 765 + k5;
  3658.                         if (mouseDetection.coordsY[j4] == -1
  3659.                                 && mouseDetection.coordsX[j4] == -1) {
  3660.                             k5 = -1;
  3661.                             l4 = -1;
  3662.                             i6 = 0x7ffff;
  3663.                         }
  3664.                         if (k5 == anInt1237 && l4 == anInt1238) {
  3665.                             if (anInt1022 < 2047)
  3666.                                 anInt1022++;
  3667.                         } else {
  3668.                             int j6 = k5 - anInt1237;
  3669.                             anInt1237 = k5;
  3670.                             int k6 = l4 - anInt1238;
  3671.                             anInt1238 = l4;
  3672.                             if (anInt1022 < 8 && j6 >= -32 && j6 <= 31
  3673.                                     && k6 >= -32 && k6 <= 31) {
  3674.                                 j6 += 32;
  3675.                                 k6 += 32;
  3676.                                 stream.writeWord((anInt1022 << 12) + (j6 << 6)
  3677.                                         + k6);
  3678.                                 anInt1022 = 0;
  3679.                             } else if (anInt1022 < 8) {
  3680.                                 stream.writeDWordBigEndian(0x800000
  3681.                                         + (anInt1022 << 19) + i6);
  3682.                                 anInt1022 = 0;
  3683.                             } else {
  3684.                                 stream.writeDWord(0xc0000000
  3685.                                         + (anInt1022 << 19) + i6);
  3686.                                 anInt1022 = 0;
  3687.                             }
  3688.                         }
  3689.                     }
  3690.  
  3691.                     stream.writeBytes(stream.currentOffset - j2);
  3692.                     if (j3 >= mouseDetection.coordsIndex) {
  3693.                         mouseDetection.coordsIndex = 0;
  3694.                     } else {
  3695.                         mouseDetection.coordsIndex -= j3;
  3696.                         for (int i5 = 0; i5 < mouseDetection.coordsIndex; i5++) {
  3697.                             mouseDetection.coordsX[i5] = mouseDetection.coordsX[i5
  3698.                                     + j3];
  3699.                             mouseDetection.coordsY[i5] = mouseDetection.coordsY[i5
  3700.                                     + j3];
  3701.                         }
  3702.  
  3703.                     }
  3704.                 }
  3705.             } else {
  3706.                 mouseDetection.coordsIndex = 0;
  3707.             }
  3708.         }
  3709.         if (super.clickMode3 != 0) {
  3710.             long l = (super.aLong29 - aLong1220) / 50L;
  3711.             if (l > 4095L)
  3712.                 l = 4095L;
  3713.             aLong1220 = super.aLong29;
  3714.             int k2 = super.saveClickY;
  3715.             if (k2 < 0)
  3716.                 k2 = 0;
  3717.             else if (k2 > 502)
  3718.                 k2 = 502;
  3719.             int k3 = super.saveClickX;
  3720.             if (k3 < 0)
  3721.                 k3 = 0;
  3722.             else if (k3 > 764)
  3723.                 k3 = 764;
  3724.             int k4 = k2 * 765 + k3;
  3725.             int j5 = 0;
  3726.             if (super.clickMode3 == 2)
  3727.                 j5 = 1;
  3728.             int l5 = (int) l;
  3729.             stream.createFrame(241);
  3730.             stream.writeDWord((l5 << 20) + (j5 << 19) + k4);
  3731.         }
  3732.         if (anInt1016 > 0)
  3733.             anInt1016--;
  3734.         if (super.keyArray[1] == 1 || super.keyArray[2] == 1
  3735.                 || super.keyArray[3] == 1 || super.keyArray[4] == 1)
  3736.             aBoolean1017 = true;
  3737.         if (aBoolean1017 && anInt1016 <= 0) {
  3738.             anInt1016 = 20;
  3739.             aBoolean1017 = false;
  3740.             stream.createFrame(86);
  3741.             stream.writeWord(anInt1184);
  3742.             stream.method432(viewRotation);
  3743.         }
  3744.         if (super.awtFocus && !aBoolean954) {
  3745.             aBoolean954 = true;
  3746.             stream.createFrame(3);
  3747.             stream.writeWordBigEndian(1);
  3748.         }
  3749.         if (!super.awtFocus && aBoolean954) {
  3750.             aBoolean954 = false;
  3751.             stream.createFrame(3);
  3752.             stream.writeWordBigEndian(0);
  3753.         }
  3754.         loadingStages();
  3755.         method115();
  3756.         method90();
  3757.         anInt1009++;
  3758.         if (anInt1009 > 750)
  3759.             dropClient();
  3760.         method114();
  3761.         method95();
  3762.         method38();
  3763.         anInt945++;
  3764.         if (crossType != 0) {
  3765.             crossIndex += 20;
  3766.             if (crossIndex >= 400)
  3767.                 crossType = 0;
  3768.         }
  3769.         if (atInventoryInterfaceType != 0) {
  3770.             atInventoryLoopCycle++;
  3771.             if (atInventoryLoopCycle >= 15) {
  3772.                 if (atInventoryInterfaceType == 2)
  3773.                     needDrawTabArea = true;
  3774.                 if (atInventoryInterfaceType == 3)
  3775.                     inputTaken = true;
  3776.                 atInventoryInterfaceType = 0;
  3777.             }
  3778.         }
  3779.         if (activeInterfaceType != 0) {
  3780.             anInt989++;
  3781.             if (super.mouseX > anInt1087 + 5 || super.mouseX < anInt1087 - 5
  3782.                     || super.mouseY > anInt1088 + 5
  3783.                     || super.mouseY < anInt1088 - 5)
  3784.                 aBoolean1242 = true;
  3785.             if (super.clickMode2 == 0) {
  3786.                 if (activeInterfaceType == 2)
  3787.                     needDrawTabArea = true;
  3788.                 if (activeInterfaceType == 3)
  3789.                     inputTaken = true;
  3790.                 activeInterfaceType = 0;
  3791.                 if (aBoolean1242 && anInt989 >= 12) {
  3792.                     lastActiveInvInterface = -1;
  3793.                     processRightClick();
  3794.                     if (lastActiveInvInterface == anInt1084
  3795.                             && mouseInvInterfaceIndex != anInt1085) {
  3796.                         RSInterface class9 = RSInterface.interfaceCache[anInt1084];
  3797.                         int j1 = 0;
  3798.                         if (anInt913 == 1 && class9.contentType == 206)
  3799.                             j1 = 1;
  3800.                         if (class9.inv[mouseInvInterfaceIndex] <= 0)
  3801.                             j1 = 0;
  3802.                         if (class9.aBoolean235) {
  3803.                             int l2 = anInt1085;
  3804.                             int l3 = mouseInvInterfaceIndex;
  3805.                             class9.inv[l3] = class9.inv[l2];
  3806.                             class9.invStackSizes[l3] = class9.invStackSizes[l2];
  3807.                             class9.inv[l2] = -1;
  3808.                             class9.invStackSizes[l2] = 0;
  3809.                         } else if (j1 == 1) {
  3810.                             int i3 = anInt1085;
  3811.                             for (int i4 = mouseInvInterfaceIndex; i3 != i4;)
  3812.                                 if (i3 > i4) {
  3813.                                     class9.swapInventoryItems(i3, i3 - 1);
  3814.                                     i3--;
  3815.                                 } else if (i3 < i4) {
  3816.                                     class9.swapInventoryItems(i3, i3 + 1);
  3817.                                     i3++;
  3818.                                 }
  3819.  
  3820.                         } else {
  3821.                             class9.swapInventoryItems(anInt1085,
  3822.                                     mouseInvInterfaceIndex);
  3823.                         }
  3824.                         stream.createFrame(214);
  3825.                         stream.method433(anInt1084);
  3826.                         stream.method424(j1);
  3827.                         stream.method433(anInt1085);
  3828.                         stream.method431(mouseInvInterfaceIndex);
  3829.                     }
  3830.                 } else if ((anInt1253 == 1 || menuHasAddFriend(menuActionRow - 1))
  3831.                         && menuActionRow > 2)
  3832.                     determineMenuSize();
  3833.                 else if (menuActionRow > 0)
  3834.                     doAction(menuActionRow - 1);
  3835.                 atInventoryLoopCycle = 10;
  3836.                 super.clickMode3 = 0;
  3837.             }
  3838.         }
  3839.         if (WorldController.anInt470 != -1) {
  3840.             int k = WorldController.anInt470;
  3841.             int k1 = WorldController.anInt471;
  3842.             boolean flag = doWalkTo(0, 0, 0, 0, myPlayer.smallY[0], 0, 0, k1,
  3843.                     myPlayer.smallX[0], true, k);
  3844.             WorldController.anInt470 = -1;
  3845.             if (flag) {
  3846.                 crossX = super.saveClickX;
  3847.                 crossY = super.saveClickY;
  3848.                 crossType = 1;
  3849.                 crossIndex = 0;
  3850.             }
  3851.         }
  3852.         if (super.clickMode3 == 1 && aString844 != null) {
  3853.             aString844 = null;
  3854.             inputTaken = true;
  3855.             super.clickMode3 = 0;
  3856.         }
  3857.         if (!processMenuClick()) {
  3858.             processMainScreenClick();
  3859.             processTabClick();
  3860.             processChatModeClick();
  3861.         }
  3862.         if (super.clickMode2 == 1 || super.clickMode3 == 1)
  3863.             anInt1213++;
  3864.         if (anInt1500 != 0 || anInt1044 != 0 || anInt1129 != 0) {
  3865.             if (anInt1501 < 50 && !menuOpen) {
  3866.                 anInt1501++;
  3867.                 if (anInt1501 == 50) {
  3868.                     if (anInt1500 != 0) {
  3869.                         inputTaken = true;
  3870.                     }
  3871.                     if (anInt1044 != 0) {
  3872.                         needDrawTabArea = true;
  3873.                     }
  3874.                 }
  3875.             }
  3876.         } else if (anInt1501 > 0) {
  3877.             anInt1501--;
  3878.         }
  3879.         if (loadingStage == 2)
  3880.             method108();
  3881.         if (loadingStage == 2 && aBoolean1160)
  3882.             calcCameraPos();
  3883.         for (int i1 = 0; i1 < 5; i1++)
  3884.             anIntArray1030[i1]++;
  3885.  
  3886.         method73();
  3887.         super.idleTime++;
  3888.         if (super.idleTime > 4500) {
  3889.             anInt1011 = 250;
  3890.             super.idleTime -= 500;
  3891.             stream.createFrame(202);
  3892.         }
  3893.         anInt1010++;
  3894.         if (anInt1010 > 50)
  3895.             stream.createFrame(0);
  3896.         try {
  3897.             if (socketStream != null && stream.currentOffset > 0) {
  3898.                 socketStream.queueBytes(stream.currentOffset, stream.buffer);
  3899.                 stream.currentOffset = 0;
  3900.                 anInt1010 = 0;
  3901.             }
  3902.         } catch (IOException _ex) {
  3903.             dropClient();
  3904.         } catch (Exception exception) {
  3905.             resetLogout();
  3906.         }
  3907.     }
  3908.  
  3909.     public void method63() {
  3910.         Class30_Sub1 class30_sub1 = (Class30_Sub1) aClass19_1179
  3911.                 .reverseGetFirst();
  3912.         for (; class30_sub1 != null; class30_sub1 = (Class30_Sub1) aClass19_1179
  3913.                 .reverseGetNext())
  3914.             if (class30_sub1.anInt1294 == -1) {
  3915.                 class30_sub1.anInt1302 = 0;
  3916.                 method89(class30_sub1);
  3917.             } else {
  3918.                 class30_sub1.unlink();
  3919.             }
  3920.  
  3921.     }
  3922.  
  3923.     private void resetImageProducers() {
  3924.         if (aRSImageProducer_1107 != null)
  3925.             return;
  3926.         super.fullGameScreen = null;
  3927.         aRSImageProducer_1166 = null;
  3928.         aRSImageProducer_1164 = null;
  3929.         aRSImageProducer_1163 = null;
  3930.         aRSImageProducer_1165 = null;
  3931.         aRSImageProducer_1125 = null;
  3932.         aRSImageProducer_1110 = new RSImageProducer(128, 265,
  3933.                 getGameComponent());
  3934.         DrawingArea.setAllPixelsToZero();
  3935.         aRSImageProducer_1111 = new RSImageProducer(128, 265,
  3936.                 getGameComponent());
  3937.         DrawingArea.setAllPixelsToZero();
  3938.         aRSImageProducer_1107 = new RSImageProducer(509, 171,
  3939.                 getGameComponent());
  3940.         DrawingArea.setAllPixelsToZero();
  3941.         aRSImageProducer_1108 = new RSImageProducer(360, 132,
  3942.                 getGameComponent());
  3943.         DrawingArea.setAllPixelsToZero();
  3944.         aRSImageProducer_1109 = new RSImageProducer(360, 200,
  3945.                 getGameComponent());
  3946.         DrawingArea.setAllPixelsToZero();
  3947.         aRSImageProducer_1112 = new RSImageProducer(202, 238,
  3948.                 getGameComponent());
  3949.         DrawingArea.setAllPixelsToZero();
  3950.         aRSImageProducer_1113 = new RSImageProducer(203, 238,
  3951.                 getGameComponent());
  3952.         DrawingArea.setAllPixelsToZero();
  3953.         aRSImageProducer_1114 = new RSImageProducer(74, 94, getGameComponent());
  3954.         DrawingArea.setAllPixelsToZero();
  3955.         aRSImageProducer_1115 = new RSImageProducer(75, 94, getGameComponent());
  3956.         DrawingArea.setAllPixelsToZero();
  3957.         if (titleStreamLoader != null) {
  3958.             drawLogo();
  3959.             loadTitleScreen();
  3960.         }
  3961.         welcomeScreenRaised = true;
  3962.     }
  3963.  
  3964.     public int rememberMe = 0;
  3965.     public int loginButtonint;
  3966.     public int rememberMehover;
  3967.     public int textbox;
  3968.     public int textbox1;
  3969.  
  3970.     @Override
  3971.     void drawLoadingText(int i, String s) {
  3972.         anInt1079 = i;
  3973.         aString1049 = s;
  3974.         resetImageProducers();
  3975.         if (titleStreamLoader == null) {
  3976.             super.drawLoadingText(i, s);
  3977.             return;
  3978.         }
  3979.         aRSImageProducer_1109.initDrawingArea();
  3980.         char c = '\u0168';
  3981.         char c1 = '\310';
  3982.         byte byte1 = 20;
  3983.         chatTextDrawingArea.drawText(0xffffff,
  3984.                 "Project-OS is loading - please wait...", c1 / 2 - 26 - byte1,
  3985.                 c / 2);
  3986.         int j = c1 / 2 - 18 - byte1;
  3987.         DrawingArea.fillPixels(c / 2 - 152, 304, 34, 0x8B0000, j);
  3988.         DrawingArea.fillPixels(c / 2 - 151, 302, 32, 0, j + 1);
  3989.         DrawingArea.drawPixels(30, j + 2, c / 2 - 150, 0x8B0000, i * 3);
  3990.         DrawingArea
  3991.                 .drawPixels(30, j + 2, (c / 2 - 150) + i * 3, 0, 300 - i * 3);
  3992.         chatTextDrawingArea.drawText(0xffffff, s, (c1 / 2 + 5) - byte1, c / 2);
  3993.         aRSImageProducer_1109.drawGraphics(171, super.graphics, 202);
  3994.         if (welcomeScreenRaised) {
  3995.             welcomeScreenRaised = false;
  3996.             if (!aBoolean831) {
  3997.                 aRSImageProducer_1110.drawGraphics(0, super.graphics, 0);
  3998.                 aRSImageProducer_1111.drawGraphics(0, super.graphics, 637);
  3999.             }
  4000.             aRSImageProducer_1107.drawGraphics(0, super.graphics, 128);
  4001.             aRSImageProducer_1108.drawGraphics(371, super.graphics, 202);
  4002.             aRSImageProducer_1112.drawGraphics(265, super.graphics, 0);
  4003.             aRSImageProducer_1113.drawGraphics(265, super.graphics, 562);
  4004.             aRSImageProducer_1114.drawGraphics(171, super.graphics, 128);
  4005.             aRSImageProducer_1115.drawGraphics(171, super.graphics, 562);
  4006.         }
  4007.     }
  4008.  
  4009.     public void method65(int i, int j, int k, int l, RSInterface class9,
  4010.             int i1, boolean flag, int j1) {
  4011.         int anInt992;
  4012.         if (aBoolean972)
  4013.             anInt992 = 32;
  4014.         else
  4015.             anInt992 = 0;
  4016.         aBoolean972 = false;
  4017.         if (k >= i && k < i + 16 && l >= i1 && l < i1 + 16) {
  4018.             class9.scrollPosition -= anInt1213 * 4;
  4019.             if (flag) {
  4020.                 needDrawTabArea = true;
  4021.             }
  4022.         } else if (k >= i && k < i + 16 && l >= (i1 + j) - 16 && l < i1 + j) {
  4023.             class9.scrollPosition += anInt1213 * 4;
  4024.             if (flag) {
  4025.                 needDrawTabArea = true;
  4026.             }
  4027.         } else if (k >= i - anInt992 && k < i + 16 + anInt992 && l >= i1 + 16
  4028.                 && l < (i1 + j) - 16 && anInt1213 > 0) {
  4029.             int l1 = ((j - 32) * j) / j1;
  4030.             if (l1 < 8)
  4031.                 l1 = 8;
  4032.             int i2 = l - i1 - 16 - l1 / 2;
  4033.             int j2 = j - 32 - l1;
  4034.             class9.scrollPosition = ((j1 - j) * i2) / j2;
  4035.             if (flag)
  4036.                 needDrawTabArea = true;
  4037.             aBoolean972 = true;
  4038.         }
  4039.     }
  4040.  
  4041.     private boolean method66(int i, int j, int k) {
  4042.         int i1 = i >> 14 & 0x7fff;
  4043.         int j1 = worldController.method304(plane, k, j, i);
  4044.         if (j1 == -1)
  4045.             return false;
  4046.         int k1 = j1 & 0x1f;
  4047.         int l1 = j1 >> 6 & 3;
  4048.         if (k1 == 10 || k1 == 11 || k1 == 22) {
  4049.             ObjectDef class46 = ObjectDef.forID(i1);
  4050.             int i2;
  4051.             int j2;
  4052.             if (l1 == 0 || l1 == 2) {
  4053.                 i2 = class46.anInt744;
  4054.                 j2 = class46.anInt761;
  4055.             } else {
  4056.                 i2 = class46.anInt761;
  4057.                 j2 = class46.anInt744;
  4058.             }
  4059.             int k2 = class46.anInt768;
  4060.             if (l1 != 0)
  4061.                 k2 = (k2 << l1 & 0xf) + (k2 >> 4 - l1);
  4062.             doWalkTo(2, 0, j2, 0, myPlayer.smallY[0], i2, k2, j,
  4063.                     myPlayer.smallX[0], false, k);
  4064.         } else {
  4065.             doWalkTo(2, l1, 0, k1 + 1, myPlayer.smallY[0], 0, 0, j,
  4066.                     myPlayer.smallX[0], false, k);
  4067.         }
  4068.         crossX = super.saveClickX;
  4069.         crossY = super.saveClickY;
  4070.         crossType = 2;
  4071.         crossIndex = 0;
  4072.         return true;
  4073.     }
  4074.  
  4075.     private StreamLoader streamLoaderForName(int i, String s, String s1, int j,
  4076.             int k) {
  4077.         byte abyte0[] = null;
  4078.         int l = 5;
  4079.         try {
  4080.             if (decompressors[0] != null)
  4081.                 abyte0 = decompressors[0].decompress(i);
  4082.         } catch (Exception _ex) {
  4083.         }
  4084.         if (abyte0 != null) {
  4085.             // aCRC32_930.reset();
  4086.             // aCRC32_930.update(abyte0);
  4087.             // int i1 = (int)aCRC32_930.getValue();
  4088.             // if(i1 != j)
  4089.         }
  4090.         if (abyte0 != null) {
  4091.             StreamLoader streamLoader = new StreamLoader(abyte0, s);
  4092.             return streamLoader;
  4093.         }
  4094.         int j1 = 0;
  4095.         while (abyte0 == null) {
  4096.             String s2 = "Unknown error";
  4097.             drawLoadingText(k, "Requesting " + s);
  4098.             try {
  4099.                 int k1 = 0;
  4100.                 DataInputStream datainputstream = openJagGrabInputStream(s1 + j);
  4101.                 byte abyte1[] = new byte[6];
  4102.                 datainputstream.readFully(abyte1, 0, 6);
  4103.                 Stream stream = new Stream(abyte1);
  4104.                 stream.currentOffset = 3;
  4105.                 int i2 = stream.read3Bytes() + 6;
  4106.                 int j2 = 6;
  4107.                 abyte0 = new byte[i2];
  4108.                 System.arraycopy(abyte1, 0, abyte0, 0, 6);
  4109.  
  4110.                 while (j2 < i2) {
  4111.                     int l2 = i2 - j2;
  4112.                     if (l2 > 1000)
  4113.                         l2 = 1000;
  4114.                     int j3 = datainputstream.read(abyte0, j2, l2);
  4115.                     if (j3 < 0) {
  4116.                         s2 = "Length error: " + j2 + "/" + i2;
  4117.                         throw new IOException("EOF");
  4118.                     }
  4119.                     j2 += j3;
  4120.                     int k3 = (j2 * 100) / i2;
  4121.                     if (k3 != k1)
  4122.                         drawLoadingText(k, "Loading " + s + " - " + k3 + "%");
  4123.                     k1 = k3;
  4124.                 }
  4125.                 datainputstream.close();
  4126.                 try {
  4127.                     if (decompressors[0] != null)
  4128.                         decompressors[0].method234(abyte0.length, abyte0, i);
  4129.                 } catch (Exception _ex) {
  4130.                     decompressors[0] = null;
  4131.                 }
  4132.                 /*
  4133.                  * if(abyte0 != null) { aCRC32_930.reset();
  4134.                  * aCRC32_930.update(abyte0); int i3 =
  4135.                  * (int)aCRC32_930.getValue(); if(i3 != j) { abyte0 = null;
  4136.                  * j1++; s2 = "Checksum error: " + i3; } }
  4137.                  */
  4138.             } catch (IOException ioexception) {
  4139.                 if (s2.equals("Unknown error"))
  4140.                     s2 = "Connection error";
  4141.                 abyte0 = null;
  4142.             } catch (NullPointerException _ex) {
  4143.                 s2 = "Null error";
  4144.                 abyte0 = null;
  4145.                 if (!signlink.reporterror)
  4146.                     return null;
  4147.             } catch (ArrayIndexOutOfBoundsException _ex) {
  4148.                 s2 = "Bounds error";
  4149.                 abyte0 = null;
  4150.                 if (!signlink.reporterror)
  4151.                     return null;
  4152.             } catch (Exception _ex) {
  4153.                 s2 = "Unexpected error";
  4154.                 abyte0 = null;
  4155.                 if (!signlink.reporterror)
  4156.                     return null;
  4157.             }
  4158.             if (abyte0 == null) {
  4159.                 for (int l1 = l; l1 > 0; l1--) {
  4160.                     if (j1 >= 3) {
  4161.                         drawLoadingText(k, "Game updated - please reload page");
  4162.                         l1 = 10;
  4163.                     } else {
  4164.                         drawLoadingText(k, s2 + " - Retrying in " + l1);
  4165.                     }
  4166.                     try {
  4167.                         Thread.sleep(1000L);
  4168.                     } catch (Exception _ex) {
  4169.                     }
  4170.                 }
  4171.  
  4172.                 l *= 2;
  4173.                 if (l > 60)
  4174.                     l = 60;
  4175.                 aBoolean872 = !aBoolean872;
  4176.             }
  4177.  
  4178.         }
  4179.  
  4180.         StreamLoader streamLoader_1 = new StreamLoader(abyte0, s);
  4181.         return streamLoader_1;
  4182.     }
  4183.  
  4184.     public void sendStringAsLong(String string) {
  4185.         stream.createFrame(60);
  4186.         stream.writeQWord(TextClass.longForName(string));
  4187.     }
  4188.  
  4189.     public void sendString(int identifier, String text) {
  4190.         text = identifier + "," + text;
  4191.         stream.createFrame(127);
  4192.         stream.writeWordBigEndian(text.length() + 1);
  4193.         stream.writeString(text);
  4194.     }
  4195.  
  4196.     public void dropClient() {
  4197.         if (anInt1011 > 0) {
  4198.             resetLogout();
  4199.             return;
  4200.         }
  4201.         aRSImageProducer_1165.initDrawingArea();
  4202.         DrawingArea.fillPixels(2, 229, 39, 0xffffff, 2);
  4203.         DrawingArea.drawPixels(37, 3, 3, 0, 227);
  4204.         aTextDrawingArea_1271.drawText(0, "Connection Lost", 19, 120);
  4205.         aTextDrawingArea_1271.drawText(0xffffff, "Connection Lost", 18, 119);
  4206.         aTextDrawingArea_1271
  4207.                 .drawText(0, "Please Wait - Reconnecting", 34, 117);
  4208.         aTextDrawingArea_1271.drawText(0xffffff, "Please Wait - Reconnecting",
  4209.                 34, 116);
  4210.         aRSImageProducer_1165.drawGraphics(4, super.graphics, 4);
  4211.         anInt1021 = 0;
  4212.         destX = 0;
  4213.         RSSocket rsSocket = socketStream;
  4214.         loggedIn = false;
  4215.         loginFailures = 0;
  4216.         login(myUsername, myPassword, true);
  4217.         if (!loggedIn)
  4218.             resetLogout();
  4219.         try {
  4220.             rsSocket.close();
  4221.         } catch (Exception _ex) {
  4222.         }
  4223.     }
  4224.  
  4225.     private void doAction(int i) {
  4226.         if (i < 0)
  4227.             return;
  4228.         if (inputDialogState != 0) {
  4229.             inputDialogState = 0;
  4230.             inputTaken = true;
  4231.         }
  4232.         int j = menuActionCmd2[i];
  4233.         int k = menuActionCmd3[i];
  4234.         int l = menuActionID[i];
  4235.         int i1 = menuActionCmd1[i];
  4236.         if (l >= 2000)
  4237.             l -= 2000;
  4238.         if (l == 474) {
  4239.             counterOn = !counterOn;
  4240.         }
  4241.         if (l == 475) {
  4242.             xpCounter = 0;
  4243.         }
  4244.         if (menuActionName[i].contains("Toggle Run")) {
  4245.             int currentHP = Integer
  4246.                     .parseInt(RSInterface.interfaceCache[4016].message);
  4247.             if (!(currentHP <= 0)) {
  4248.                 runClicked = !runClicked;
  4249.                 sendFrame36(429, runClicked ? 0 : 1);
  4250.             }
  4251.         }
  4252.         if (l == 696) {
  4253.             setNorth();
  4254.         }
  4255.         if (l == 582) {
  4256.             NPC npc = npcArray[i1];
  4257.             if (npc != null) {
  4258.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, npc.smallY[0],
  4259.                         myPlayer.smallX[0], false, npc.smallX[0]);
  4260.                 crossX = super.saveClickX;
  4261.                 crossY = super.saveClickY;
  4262.                 crossType = 2;
  4263.                 crossIndex = 0;
  4264.                 stream.createFrame(57);
  4265.                 stream.method432(anInt1285);
  4266.                 stream.method432(i1);
  4267.                 stream.method431(anInt1283);
  4268.                 stream.method432(anInt1284);
  4269.             }
  4270.         }
  4271.         if (l == 234) {
  4272.             boolean flag1 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k,
  4273.                     myPlayer.smallX[0], false, j);
  4274.             if (!flag1)
  4275.                 flag1 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k,
  4276.                         myPlayer.smallX[0], false, j);
  4277.             crossX = super.saveClickX;
  4278.             crossY = super.saveClickY;
  4279.             crossType = 2;
  4280.             crossIndex = 0;
  4281.             stream.createFrame(236);
  4282.             stream.method431(k + baseY);
  4283.             stream.writeWord(i1);
  4284.             stream.method431(j + baseX);
  4285.         }
  4286.         if (l == 62 && method66(i1, k, j)) {
  4287.             stream.createFrame(192);
  4288.             stream.writeWord(anInt1284);
  4289.             stream.method431(i1 >> 14 & 0x7fff);
  4290.             stream.method433(k + baseY);
  4291.             stream.method431(anInt1283);
  4292.             stream.method433(j + baseX);
  4293.             stream.writeWord(anInt1285);
  4294.         }
  4295.  
  4296.         if (l == 511) {
  4297.             boolean flag2 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k,
  4298.                     myPlayer.smallX[0], false, j);
  4299.             if (!flag2)
  4300.                 flag2 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k,
  4301.                         myPlayer.smallX[0], false, j);
  4302.             crossX = super.saveClickX;
  4303.             crossY = super.saveClickY;
  4304.             crossType = 2;
  4305.             crossIndex = 0;
  4306.             stream.createFrame(25);
  4307.             stream.method431(anInt1284);
  4308.             stream.method432(anInt1285);
  4309.             stream.writeWord(i1);
  4310.             stream.method432(k + baseY);
  4311.             stream.method433(anInt1283);
  4312.             stream.writeWord(j + baseX);
  4313.         }
  4314.         if (l == 74) {
  4315.             stream.createFrame(122);
  4316.             stream.method433(k);
  4317.             stream.method432(j);
  4318.             stream.method431(i1);
  4319.             atInventoryLoopCycle = 0;
  4320.             atInventoryInterface = k;
  4321.             atInventoryIndex = j;
  4322.             atInventoryInterfaceType = 2;
  4323.             if (RSInterface.interfaceCache[k].parentID == openInterfaceID)
  4324.                 atInventoryInterfaceType = 1;
  4325.             if (RSInterface.interfaceCache[k].parentID == backDialogID)
  4326.                 atInventoryInterfaceType = 3;
  4327.         }
  4328.         if (l == 315) {
  4329.             RSInterface class9 = RSInterface.interfaceCache[k];
  4330.             boolean flag8 = true;
  4331.             if (class9.contentType > 0)
  4332.                 flag8 = promptUserForInput(class9);
  4333.             if (flag8) {
  4334.  
  4335.                 switch (k) {
  4336.                 case 19144:
  4337.                     sendFrame248(15106, 3213);
  4338.                     method60(15106);
  4339.                     inputTaken = true;
  4340.                     break;
  4341.                 default:
  4342.                     stream.createFrame(185);
  4343.                     stream.writeWord(k);
  4344.                     break;
  4345.  
  4346.                 }
  4347.             }
  4348.         }
  4349.         if (l == 561) {
  4350.             Player player = playerArray[i1];
  4351.             if (player != null) {
  4352.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
  4353.                         player.smallY[0], myPlayer.smallX[0], false,
  4354.                         player.smallX[0]);
  4355.                 crossX = super.saveClickX;
  4356.                 crossY = super.saveClickY;
  4357.                 crossType = 2;
  4358.                 crossIndex = 0;
  4359.                 anInt1188 += i1;
  4360.                 if (anInt1188 >= 90) {
  4361.                     stream.createFrame(136);
  4362.                     anInt1188 = 0;
  4363.                 }
  4364.                 stream.createFrame(128);
  4365.                 stream.writeWord(i1);
  4366.             }
  4367.         }
  4368.         if (l == 20) {
  4369.             NPC class30_sub2_sub4_sub1_sub1_1 = npcArray[i1];
  4370.             if (class30_sub2_sub4_sub1_sub1_1 != null) {
  4371.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
  4372.                         class30_sub2_sub4_sub1_sub1_1.smallY[0],
  4373.                         myPlayer.smallX[0], false,
  4374.                         class30_sub2_sub4_sub1_sub1_1.smallX[0]);
  4375.                 crossX = super.saveClickX;
  4376.                 crossY = super.saveClickY;
  4377.                 crossType = 2;
  4378.                 crossIndex = 0;
  4379.                 stream.createFrame(155);
  4380.                 stream.method431(i1);
  4381.             }
  4382.         }
  4383.         if (l == 779) {
  4384.             Player class30_sub2_sub4_sub1_sub2_1 = playerArray[i1];
  4385.             if (class30_sub2_sub4_sub1_sub2_1 != null) {
  4386.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
  4387.                         class30_sub2_sub4_sub1_sub2_1.smallY[0],
  4388.                         myPlayer.smallX[0], false,
  4389.                         class30_sub2_sub4_sub1_sub2_1.smallX[0]);
  4390.                 crossX = super.saveClickX;
  4391.                 crossY = super.saveClickY;
  4392.                 crossType = 2;
  4393.                 crossIndex = 0;
  4394.                 stream.createFrame(153);
  4395.                 stream.method431(i1);
  4396.             }
  4397.         }
  4398.         if (l == 516)
  4399.             if (!menuOpen)
  4400.                 worldController.method312(super.saveClickY - 4,
  4401.                         super.saveClickX - 4);
  4402.             else
  4403.                 worldController.method312(k - 4, j - 4);
  4404.         if (l == 1062) {
  4405.             anInt924 += baseX;
  4406.             if (anInt924 >= 113) {
  4407.                 stream.createFrame(183);
  4408.                 stream.writeDWordBigEndian(0xe63271);
  4409.                 anInt924 = 0;
  4410.             }
  4411.             method66(i1, k, j);
  4412.             stream.createFrame(228);
  4413.             stream.method432(i1 >> 14 & 0x7fff);
  4414.             stream.method432(k + baseY);
  4415.             stream.writeWord(j + baseX);
  4416.         }
  4417.         if (l == 679 && !aBoolean1149) {
  4418.             stream.createFrame(40);
  4419.             stream.writeWord(k);
  4420.             aBoolean1149 = true;
  4421.         }
  4422.         if (l == 431) {
  4423.             stream.createFrame(129);
  4424.             stream.method432(j);
  4425.             stream.writeWord(k);
  4426.             stream.method432(i1);
  4427.             atInventoryLoopCycle = 0;
  4428.             atInventoryInterface = k;
  4429.             atInventoryIndex = j;
  4430.             atInventoryInterfaceType = 2;
  4431.             if (RSInterface.interfaceCache[k].parentID == openInterfaceID)
  4432.                 atInventoryInterfaceType = 1;
  4433.             if (RSInterface.interfaceCache[k].parentID == backDialogID)
  4434.                 atInventoryInterfaceType = 3;
  4435.         }
  4436.         if (l == 337 || l == 42 || l == 792 || l == 322) {
  4437.             String s = menuActionName[i];
  4438.             int k1 = s.indexOf("@whi@");
  4439.             if (k1 != -1) {
  4440.                 long l3 = TextClass.longForName(s.substring(k1 + 5).trim());
  4441.                 if (l == 337)
  4442.                     addFriend(l3);
  4443.                 if (l == 42)
  4444.                     addIgnore(l3);
  4445.                 if (l == 792)
  4446.                     delFriend(l3);
  4447.                 if (l == 322)
  4448.                     delIgnore(l3);
  4449.             }
  4450.         }
  4451.         if (l == 53) {
  4452.             stream.createFrame(135);
  4453.             stream.method431(j);
  4454.             stream.method432(k);
  4455.             stream.method431(i1);
  4456.             atInventoryLoopCycle = 0;
  4457.             atInventoryInterface = k;
  4458.             atInventoryIndex = j;
  4459.             atInventoryInterfaceType = 2;
  4460.             if (RSInterface.interfaceCache[k].parentID == openInterfaceID)
  4461.                 atInventoryInterfaceType = 1;
  4462.             if (RSInterface.interfaceCache[k].parentID == backDialogID)
  4463.                 atInventoryInterfaceType = 3;
  4464.         }
  4465.         if (l == 539) {
  4466.             stream.createFrame(16);
  4467.             stream.method432(i1);
  4468.             stream.method433(j);
  4469.             stream.method433(k);
  4470.             atInventoryLoopCycle = 0;
  4471.             atInventoryInterface = k;
  4472.             atInventoryIndex = j;
  4473.             atInventoryInterfaceType = 2;
  4474.             if (RSInterface.interfaceCache[k].parentID == openInterfaceID)
  4475.                 atInventoryInterfaceType = 1;
  4476.             if (RSInterface.interfaceCache[k].parentID == backDialogID)
  4477.                 atInventoryInterfaceType = 3;
  4478.         }
  4479.         if (l == 484 || l == 6) {
  4480.             String s1 = menuActionName[i];
  4481.             int l1 = s1.indexOf("@whi@");
  4482.             if (l1 != -1) {
  4483.                 s1 = s1.substring(l1 + 5).trim();
  4484.                 String s7 = TextClass.fixName(TextClass.nameForLong(TextClass
  4485.                         .longForName(s1)));
  4486.                 boolean flag9 = false;
  4487.                 for (int j3 = 0; j3 < playerCount; j3++) {
  4488.                     Player class30_sub2_sub4_sub1_sub2_7 = playerArray[playerIndices[j3]];
  4489.                     if (class30_sub2_sub4_sub1_sub2_7 == null
  4490.                             || class30_sub2_sub4_sub1_sub2_7.name == null
  4491.                             || !class30_sub2_sub4_sub1_sub2_7.name
  4492.                                     .equalsIgnoreCase(s7))
  4493.                         continue;
  4494.                     doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
  4495.                             class30_sub2_sub4_sub1_sub2_7.smallY[0],
  4496.                             myPlayer.smallX[0], false,
  4497.                             class30_sub2_sub4_sub1_sub2_7.smallX[0]);
  4498.                     if (l == 484) {
  4499.                         stream.createFrame(39);
  4500.                         stream.method431(playerIndices[j3]);
  4501.                     }
  4502.                     if (l == 6) {
  4503.                         anInt1188 += i1;
  4504.                         if (anInt1188 >= 90) {
  4505.                             stream.createFrame(136);
  4506.                             anInt1188 = 0;
  4507.                         }
  4508.                         stream.createFrame(128);
  4509.                         stream.writeWord(playerIndices[j3]);
  4510.                     }
  4511.                     flag9 = true;
  4512.                     break;
  4513.                 }
  4514.  
  4515.                 if (!flag9)
  4516.                     pushMessage("Unable to find " + s7, 0, "");
  4517.             }
  4518.         }
  4519.         if (l == 870) {
  4520.             stream.createFrame(53);
  4521.             stream.writeWord(j);
  4522.             stream.method432(anInt1283);
  4523.             stream.method433(i1);
  4524.             stream.writeWord(anInt1284);
  4525.             stream.method431(anInt1285);
  4526.             stream.writeWord(k);
  4527.             atInventoryLoopCycle = 0;
  4528.             atInventoryInterface = k;
  4529.             atInventoryIndex = j;
  4530.             atInventoryInterfaceType = 2;
  4531.             if (RSInterface.interfaceCache[k].parentID == openInterfaceID)
  4532.                 atInventoryInterfaceType = 1;
  4533.             if (RSInterface.interfaceCache[k].parentID == backDialogID)
  4534.                 atInventoryInterfaceType = 3;
  4535.         }
  4536.         if (l == 847) {
  4537.             stream.createFrame(87);
  4538.             stream.method432(i1);
  4539.             stream.writeWord(k);
  4540.             stream.method432(j);
  4541.             atInventoryLoopCycle = 0;
  4542.             atInventoryInterface = k;
  4543.             atInventoryIndex = j;
  4544.             atInventoryInterfaceType = 2;
  4545.             if (RSInterface.interfaceCache[k].parentID == openInterfaceID)
  4546.                 atInventoryInterfaceType = 1;
  4547.             if (RSInterface.interfaceCache[k].parentID == backDialogID)
  4548.                 atInventoryInterfaceType = 3;
  4549.         }
  4550.         if (l == 626) {
  4551.             RSInterface class9_1 = RSInterface.interfaceCache[k];
  4552.             spellSelected = 1;
  4553.             spellID = class9_1.id;
  4554.             anInt1137 = k;
  4555.             spellUsableOn = class9_1.spellUsableOn;
  4556.             itemSelected = 0;
  4557.             needDrawTabArea = true;
  4558.             spellID = class9_1.id;
  4559.             String s4 = class9_1.selectedActionName;
  4560.             if (s4.indexOf(" ") != -1)
  4561.                 s4 = s4.substring(0, s4.indexOf(" "));
  4562.             String s8 = class9_1.selectedActionName;
  4563.             if (s8.indexOf(" ") != -1)
  4564.                 s8 = s8.substring(s8.indexOf(" ") + 1);
  4565.             spellTooltip = s4 + " " + class9_1.spellName + " " + s8;
  4566.             // class9_1.sprite1.drawSprite(class9_1.anInt263, class9_1.anInt265,
  4567.             // 0xffffff);
  4568.             // class9_1.sprite1.drawSprite(200,200);
  4569.             // System.out.println("Sprite: " + class9_1.sprite1.toString());
  4570.             if (spellUsableOn == 16) {
  4571.                 needDrawTabArea = true;
  4572.                 tabID = 3;
  4573.                 tabAreaAltered = true;
  4574.             }
  4575.             return;
  4576.         }
  4577.         if (l == 78) {
  4578.             stream.createFrame(117);
  4579.             stream.method433(k);
  4580.             stream.method433(i1);
  4581.             stream.method431(j);
  4582.             atInventoryLoopCycle = 0;
  4583.             atInventoryInterface = k;
  4584.             atInventoryIndex = j;
  4585.             atInventoryInterfaceType = 2;
  4586.             if (RSInterface.interfaceCache[k].parentID == openInterfaceID)
  4587.                 atInventoryInterfaceType = 1;
  4588.             if (RSInterface.interfaceCache[k].parentID == backDialogID)
  4589.                 atInventoryInterfaceType = 3;
  4590.         }
  4591.         if (l == 27) {
  4592.             Player class30_sub2_sub4_sub1_sub2_2 = playerArray[i1];
  4593.             if (class30_sub2_sub4_sub1_sub2_2 != null) {
  4594.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
  4595.                         class30_sub2_sub4_sub1_sub2_2.smallY[0],
  4596.                         myPlayer.smallX[0], false,
  4597.                         class30_sub2_sub4_sub1_sub2_2.smallX[0]);
  4598.                 crossX = super.saveClickX;
  4599.                 crossY = super.saveClickY;
  4600.                 crossType = 2;
  4601.                 crossIndex = 0;
  4602.                 anInt986 += i1;
  4603.                 if (anInt986 >= 54) {
  4604.                     stream.createFrame(189);
  4605.                     stream.writeWordBigEndian(234);
  4606.                     anInt986 = 0;
  4607.                 }
  4608.                 stream.createFrame(73);
  4609.                 stream.method431(i1);
  4610.             }
  4611.         }
  4612.         if (l == 1800) {
  4613.             if (CameraPos1 > 6) {
  4614.                 pushMessage("You can't zoom out anymore.", 0, "");
  4615.             } else if (CameraPos1 < 7) {
  4616.                 CameraPos1 += 1;
  4617.                 CameraPos2 += 200;
  4618.             }
  4619.         }
  4620.         if (l == 1850) {
  4621.             if (CameraPos1 == 1) {
  4622.                 pushMessage("You can't zoom in anymore.", 0, "");
  4623.             } else if (CameraPos1 > 1) {
  4624.                 CameraPos1 -= 1;
  4625.                 CameraPos2 -= 200;
  4626.             }
  4627.         }
  4628.         if (l == 213) {
  4629.             boolean flag3 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k,
  4630.                     myPlayer.smallX[0], false, j);
  4631.             if (!flag3)
  4632.                 flag3 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k,
  4633.                         myPlayer.smallX[0], false, j);
  4634.             crossX = super.saveClickX;
  4635.             crossY = super.saveClickY;
  4636.             crossType = 2;
  4637.             crossIndex = 0;
  4638.             stream.createFrame(79);
  4639.             stream.method431(k + baseY);
  4640.             stream.writeWord(i1);
  4641.             stream.method432(j + baseX);
  4642.         }
  4643.         if (l == 632) {
  4644.             stream.createFrame(145);
  4645.             stream.method432(k);
  4646.             stream.method432(j);
  4647.             stream.method432(i1);
  4648.             atInventoryLoopCycle = 0;
  4649.             atInventoryInterface = k;
  4650.             atInventoryIndex = j;
  4651.             atInventoryInterfaceType = 2;
  4652.             if (RSInterface.interfaceCache[k].parentID == openInterfaceID)
  4653.                 atInventoryInterfaceType = 1;
  4654.             if (RSInterface.interfaceCache[k].parentID == backDialogID)
  4655.                 atInventoryInterfaceType = 3;
  4656.         }
  4657.         if (l == 1050) {
  4658.             if (!runClicked) {
  4659.                 runClicked = true;
  4660.                 stream.createFrame(185);
  4661.                 stream.writeWord(153);
  4662.             } else {
  4663.                 runClicked = false;
  4664.                 stream.createFrame(185);
  4665.                 stream.writeWord(152);
  4666.             }
  4667.         }
  4668.         if (l == 1004) {
  4669.             if (tabInterfaceIDs[10] != -1) {
  4670.                 needDrawTabArea = true;
  4671.                 tabID = 10;
  4672.                 tabAreaAltered = true;
  4673.             }
  4674.         }
  4675.         if (l == 1003) {
  4676.             clanChatMode = 2;
  4677.             inputTaken = true;
  4678.         }
  4679.         if (l == 1002) {
  4680.             clanChatMode = 1;
  4681.             inputTaken = true;
  4682.         }
  4683.         if (l == 1001) {
  4684.             clanChatMode = 0;
  4685.             inputTaken = true;
  4686.         }
  4687.         if (l == 1000) {
  4688.             cButtonCPos = 4;
  4689.             chatTypeView = 11;
  4690.             inputTaken = true;
  4691.         }
  4692.         if (l == 999) {
  4693.             cButtonCPos = 0;
  4694.             chatTypeView = 0;
  4695.             inputTaken = true;
  4696.         }
  4697.         if (l == 998) {
  4698.             cButtonCPos = 1;
  4699.             chatTypeView = 5;
  4700.             inputTaken = true;
  4701.         }
  4702.         if (l == 997) {
  4703.             publicChatMode = 3;
  4704.             inputTaken = true;
  4705.         }
  4706.         if (l == 996) {
  4707.             publicChatMode = 2;
  4708.             inputTaken = true;
  4709.         }
  4710.         if (l == 995) {
  4711.             publicChatMode = 1;
  4712.             inputTaken = true;
  4713.         }
  4714.         if (l == 994) {
  4715.             publicChatMode = 0;
  4716.             inputTaken = true;
  4717.         }
  4718.         if (l == 993) {
  4719.             cButtonCPos = 2;
  4720.             chatTypeView = 1;
  4721.             inputTaken = true;
  4722.         }
  4723.         if (l == 992) {
  4724.             privateChatMode = 2;
  4725.             inputTaken = true;
  4726.         }
  4727.         if (l == 991) {
  4728.             privateChatMode = 1;
  4729.             inputTaken = true;
  4730.         }
  4731.         if (l == 990) {
  4732.             privateChatMode = 0;
  4733.             inputTaken = true;
  4734.         }
  4735.         if (l == 989) {
  4736.             cButtonCPos = 3;
  4737.             chatTypeView = 2;
  4738.             inputTaken = true;
  4739.         }
  4740.         if (l == 987) {
  4741.             tradeMode = 2;
  4742.             inputTaken = true;
  4743.         }
  4744.         if (l == 986) {
  4745.             tradeMode = 1;
  4746.             inputTaken = true;
  4747.         }
  4748.         if (l == 985) {
  4749.             tradeMode = 0;
  4750.             inputTaken = true;
  4751.         }
  4752.         if (l == 984) {
  4753.             cButtonCPos = 5;
  4754.             chatTypeView = 3;
  4755.             inputTaken = true;
  4756.         }
  4757.         if (l == 983) {
  4758.             duelMode = 2;
  4759.             inputTaken = true;
  4760.         }
  4761.         if (l == 982) {
  4762.             duelMode = 1;
  4763.             inputTaken = true;
  4764.         }
  4765.         if (l == 981) {
  4766.             duelMode = 0;
  4767.             inputTaken = true;
  4768.         }
  4769.         if (l == 980) {
  4770.             cButtonCPos = 6;
  4771.             chatTypeView = 4;
  4772.             inputTaken = true;
  4773.         }
  4774.         if (l == 493) {
  4775.             stream.createFrame(75);
  4776.             stream.method433(k);
  4777.             stream.method431(j);
  4778.             stream.method432(i1);
  4779.             atInventoryLoopCycle = 0;
  4780.             atInventoryInterface = k;
  4781.             atInventoryIndex = j;
  4782.             atInventoryInterfaceType = 2;
  4783.             if (RSInterface.interfaceCache[k].parentID == openInterfaceID)
  4784.                 atInventoryInterfaceType = 1;
  4785.             if (RSInterface.interfaceCache[k].parentID == backDialogID)
  4786.                 atInventoryInterfaceType = 3;
  4787.         }
  4788.         if (l == 652) {
  4789.             boolean flag4 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k,
  4790.                     myPlayer.smallX[0], false, j);
  4791.             if (!flag4)
  4792.                 flag4 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k,
  4793.                         myPlayer.smallX[0], false, j);
  4794.             crossX = super.saveClickX;
  4795.             crossY = super.saveClickY;
  4796.             crossType = 2;
  4797.             crossIndex = 0;
  4798.             stream.createFrame(156);
  4799.             stream.method432(j + baseX);
  4800.             stream.method431(k + baseY);
  4801.             stream.method433(i1);
  4802.         }
  4803.         if (l == 94) {
  4804.             boolean flag5 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k,
  4805.                     myPlayer.smallX[0], false, j);
  4806.             if (!flag5)
  4807.                 flag5 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k,
  4808.                         myPlayer.smallX[0], false, j);
  4809.             crossX = super.saveClickX;
  4810.             crossY = super.saveClickY;
  4811.             crossType = 2;
  4812.             crossIndex = 0;
  4813.             stream.createFrame(181);
  4814.             stream.method431(k + baseY);
  4815.             stream.writeWord(i1);
  4816.             stream.method431(j + baseX);
  4817.             stream.method432(anInt1137);
  4818.         }
  4819.         // clan chat
  4820.         if (l == 647) {
  4821.             stream.createFrame(213);
  4822.             stream.writeWord(k);
  4823.             stream.writeWord(j);
  4824.             switch (k) {
  4825.             case 18304:
  4826.                 if (j == 0) {
  4827.                     inputTaken = true;
  4828.                     inputDialogState = 0;
  4829.                     messagePromptRaised = true;
  4830.                     promptInput = "";
  4831.                     friendsListAction = 8;
  4832.                     aString1121 = "Enter your clan chat title";
  4833.                 }
  4834.                 break;
  4835.             }
  4836.         }
  4837.         if (l == 646) {
  4838.             stream.createFrame(185);
  4839.             stream.writeWord(k);
  4840.             RSInterface class9_2 = RSInterface.interfaceCache[k];
  4841.             if (class9_2.valueIndexArray != null
  4842.                     && class9_2.valueIndexArray[0][0] == 5) {
  4843.                 int i2 = class9_2.valueIndexArray[0][1];
  4844.                 if (variousSettings[i2] != class9_2.anIntArray212[0]) {
  4845.                     variousSettings[i2] = class9_2.anIntArray212[0];
  4846.                     method33(i2);
  4847.                     needDrawTabArea = true;
  4848.                 }
  4849.             }
  4850.             switch (k) {
  4851.             // clan chat
  4852.             case 18129:
  4853.                 if (RSInterface.interfaceCache[18135].message.toLowerCase()
  4854.                         .contains("join")) {
  4855.                     inputTaken = true;
  4856.                     inputDialogState = 0;
  4857.                     messagePromptRaised = true;
  4858.                     promptInput = "";
  4859.                     friendsListAction = 6;
  4860.                     aString1121 = "Enter the name of the chat you wish to join";
  4861.                 } else {
  4862.                     sendString(0, "");
  4863.                 }
  4864.                 break;
  4865.             case 18132:
  4866.                 openInterfaceID = 18300;
  4867.                 break;
  4868.             case 18526:
  4869.                 inputTaken = true;
  4870.                 inputDialogState = 0;
  4871.                 messagePromptRaised = true;
  4872.                 promptInput = "";
  4873.                 friendsListAction = 9;
  4874.                 aString1121 = "Enter a name to add";
  4875.                 break;
  4876.             case 18527:
  4877.                 inputTaken = true;
  4878.                 inputDialogState = 0;
  4879.                 messagePromptRaised = true;
  4880.                 promptInput = "";
  4881.                 friendsListAction = 10;
  4882.                 aString1121 = "Enter a name to add";
  4883.                 break;
  4884.             }
  4885.         }
  4886.         if (l == 225) {
  4887.             NPC class30_sub2_sub4_sub1_sub1_2 = npcArray[i1];
  4888.             if (class30_sub2_sub4_sub1_sub1_2 != null) {
  4889.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
  4890.                         class30_sub2_sub4_sub1_sub1_2.smallY[0],
  4891.                         myPlayer.smallX[0], false,
  4892.                         class30_sub2_sub4_sub1_sub1_2.smallX[0]);
  4893.                 crossX = super.saveClickX;
  4894.                 crossY = super.saveClickY;
  4895.                 crossType = 2;
  4896.                 crossIndex = 0;
  4897.                 anInt1226 += i1;
  4898.                 if (anInt1226 >= 85) {
  4899.                     stream.createFrame(230);
  4900.                     stream.writeWordBigEndian(239);
  4901.                     anInt1226 = 0;
  4902.                 }
  4903.                 stream.createFrame(17);
  4904.                 stream.method433(i1);
  4905.             }
  4906.         }
  4907.         if (l == 965) {
  4908.             NPC class30_sub2_sub4_sub1_sub1_3 = npcArray[i1];
  4909.             if (class30_sub2_sub4_sub1_sub1_3 != null) {
  4910.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
  4911.                         class30_sub2_sub4_sub1_sub1_3.smallY[0],
  4912.                         myPlayer.smallX[0], false,
  4913.                         class30_sub2_sub4_sub1_sub1_3.smallX[0]);
  4914.                 crossX = super.saveClickX;
  4915.                 crossY = super.saveClickY;
  4916.                 crossType = 2;
  4917.                 crossIndex = 0;
  4918.                 anInt1134++;
  4919.                 if (anInt1134 >= 96) {
  4920.                     stream.createFrame(152);
  4921.                     stream.writeWordBigEndian(88);
  4922.                     anInt1134 = 0;
  4923.                 }
  4924.                 stream.createFrame(21);
  4925.                 stream.writeWord(i1);
  4926.             }
  4927.         }
  4928.         if (l == 413) {
  4929.             NPC class30_sub2_sub4_sub1_sub1_4 = npcArray[i1];
  4930.             if (class30_sub2_sub4_sub1_sub1_4 != null) {
  4931.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
  4932.                         class30_sub2_sub4_sub1_sub1_4.smallY[0],
  4933.                         myPlayer.smallX[0], false,
  4934.                         class30_sub2_sub4_sub1_sub1_4.smallX[0]);
  4935.                 crossX = super.saveClickX;
  4936.                 crossY = super.saveClickY;
  4937.                 crossType = 2;
  4938.                 crossIndex = 0;
  4939.                 stream.createFrame(131);
  4940.                 stream.method433(i1);
  4941.                 stream.method432(anInt1137);
  4942.             }
  4943.         }
  4944.         if (l == 200)
  4945.             clearTopInterfaces();
  4946.         if (l == 1025) {
  4947.             NPC class30_sub2_sub4_sub1_sub1_5 = npcArray[i1];
  4948.             if (class30_sub2_sub4_sub1_sub1_5 != null) {
  4949.                 EntityDef entityDef = class30_sub2_sub4_sub1_sub1_5.desc;
  4950.                 if (entityDef.childrenIDs != null)
  4951.                     entityDef = entityDef.method161();
  4952.                 if (entityDef != null) {
  4953.                     String s9;
  4954.                     if (entityDef.description != null)
  4955.                         s9 = new String(entityDef.description);
  4956.                     else
  4957.                         s9 = "It's a " + entityDef.name + ".";
  4958.                     pushMessage(s9, 0, "");
  4959.                 }
  4960.             }
  4961.         }
  4962.         if (l == 900) {
  4963.             method66(i1, k, j);
  4964.             stream.createFrame(252);
  4965.             stream.method433(i1 >> 14 & 0x7fff);
  4966.             stream.method431(k + baseY);
  4967.             stream.method432(j + baseX);
  4968.         }
  4969.         if (l == 412) {
  4970.             NPC class30_sub2_sub4_sub1_sub1_6 = npcArray[i1];
  4971.             if (class30_sub2_sub4_sub1_sub1_6 != null) {
  4972.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
  4973.                         class30_sub2_sub4_sub1_sub1_6.smallY[0],
  4974.                         myPlayer.smallX[0], false,
  4975.                         class30_sub2_sub4_sub1_sub1_6.smallX[0]);
  4976.                 crossX = super.saveClickX;
  4977.                 crossY = super.saveClickY;
  4978.                 crossType = 2;
  4979.                 crossIndex = 0;
  4980.                 stream.createFrame(72);
  4981.                 stream.method432(i1);
  4982.             }
  4983.         }
  4984.         if (l == 365) {
  4985.             Player class30_sub2_sub4_sub1_sub2_3 = playerArray[i1];
  4986.             if (class30_sub2_sub4_sub1_sub2_3 != null) {
  4987.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
  4988.                         class30_sub2_sub4_sub1_sub2_3.smallY[0],
  4989.                         myPlayer.smallX[0], false,
  4990.                         class30_sub2_sub4_sub1_sub2_3.smallX[0]);
  4991.                 crossX = super.saveClickX;
  4992.                 crossY = super.saveClickY;
  4993.                 crossType = 2;
  4994.                 crossIndex = 0;
  4995.                 stream.createFrame(249);
  4996.                 stream.method432(i1);
  4997.                 stream.method431(anInt1137);
  4998.             }
  4999.         }
  5000.         if (l == 729) {
  5001.             Player class30_sub2_sub4_sub1_sub2_4 = playerArray[i1];
  5002.             if (class30_sub2_sub4_sub1_sub2_4 != null) {
  5003.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
  5004.                         class30_sub2_sub4_sub1_sub2_4.smallY[0],
  5005.                         myPlayer.smallX[0], false,
  5006.                         class30_sub2_sub4_sub1_sub2_4.smallX[0]);
  5007.                 crossX = super.saveClickX;
  5008.                 crossY = super.saveClickY;
  5009.                 crossType = 2;
  5010.                 crossIndex = 0;
  5011.                 stream.createFrame(39);
  5012.                 stream.method431(i1);
  5013.             }
  5014.         }
  5015.         if (l == 577) {
  5016.             Player class30_sub2_sub4_sub1_sub2_5 = playerArray[i1];
  5017.             if (class30_sub2_sub4_sub1_sub2_5 != null) {
  5018.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
  5019.                         class30_sub2_sub4_sub1_sub2_5.smallY[0],
  5020.                         myPlayer.smallX[0], false,
  5021.                         class30_sub2_sub4_sub1_sub2_5.smallX[0]);
  5022.                 crossX = super.saveClickX;
  5023.                 crossY = super.saveClickY;
  5024.                 crossType = 2;
  5025.                 crossIndex = 0;
  5026.                 stream.createFrame(139);
  5027.                 stream.method431(i1);
  5028.             }
  5029.         }
  5030.         if (l == 956 && method66(i1, k, j)) {
  5031.             stream.createFrame(35);
  5032.             stream.method431(j + baseX);
  5033.             stream.method432(anInt1137);
  5034.             stream.method432(k + baseY);
  5035.             stream.method431(i1 >> 14 & 0x7fff);
  5036.         }
  5037.         if (l == 567) {
  5038.             boolean flag6 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k,
  5039.                     myPlayer.smallX[0], false, j);
  5040.             if (!flag6)
  5041.                 flag6 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k,
  5042.                         myPlayer.smallX[0], false, j);
  5043.             crossX = super.saveClickX;
  5044.             crossY = super.saveClickY;
  5045.             crossType = 2;
  5046.             crossIndex = 0;
  5047.             stream.createFrame(23);
  5048.             stream.method431(k + baseY);
  5049.             stream.method431(i1);
  5050.             stream.method431(j + baseX);
  5051.         }
  5052.         if (l == 867) {
  5053.             if ((i1 & 3) == 0)
  5054.                 anInt1175++;
  5055.             if (anInt1175 >= 59) {
  5056.                 stream.createFrame(200);
  5057.                 stream.createFrame(201);
  5058.                 stream.writeWord(25501);
  5059.                 anInt1175 = 0;
  5060.             }
  5061.             stream.createFrame(43);
  5062.             stream.method431(k);
  5063.             stream.method432(i1);
  5064.             stream.method432(j);
  5065.             atInventoryLoopCycle = 0;
  5066.             atInventoryInterface = k;
  5067.             atInventoryIndex = j;
  5068.             atInventoryInterfaceType = 2;
  5069.             if (RSInterface.interfaceCache[k].parentID == openInterfaceID)
  5070.                 atInventoryInterfaceType = 1;
  5071.             if (RSInterface.interfaceCache[k].parentID == backDialogID)
  5072.                 atInventoryInterfaceType = 3;
  5073.         }
  5074.         if (l == 543) {
  5075.             stream.createFrame(237);
  5076.             stream.writeWord(j);
  5077.             stream.method432(i1);
  5078.             stream.writeWord(k);
  5079.             stream.method432(anInt1137);
  5080.             atInventoryLoopCycle = 0;
  5081.             atInventoryInterface = k;
  5082.             atInventoryIndex = j;
  5083.             atInventoryInterfaceType = 2;
  5084.             if (RSInterface.interfaceCache[k].parentID == openInterfaceID)
  5085.                 atInventoryInterfaceType = 1;
  5086.             if (RSInterface.interfaceCache[k].parentID == backDialogID)
  5087.                 atInventoryInterfaceType = 3;
  5088.         }
  5089.         if (l == 606) {
  5090.             String s2 = menuActionName[i];
  5091.             int j2 = s2.indexOf("@whi@");
  5092.             if (j2 != -1)
  5093.                 if (openInterfaceID == -1) {
  5094.                     clearTopInterfaces();
  5095.                     reportAbuseInput = s2.substring(j2 + 5).trim();
  5096.                     canMute = false;
  5097.                     for (int i3 = 0; i3 < RSInterface.interfaceCache.length; i3++) {
  5098.                         if (RSInterface.interfaceCache[i3] == null
  5099.                                 || RSInterface.interfaceCache[i3].contentType != 600)
  5100.                             continue;
  5101.                         reportAbuseInterfaceID = openInterfaceID = RSInterface.interfaceCache[i3].parentID;
  5102.                         break;
  5103.                     }
  5104.  
  5105.                 } else {
  5106.                     pushMessage(
  5107.                             "Please close the interface you have open before using 'report abuse'",
  5108.                             0, "");
  5109.                 }
  5110.         }
  5111.         if (l == 491) {
  5112.             Player class30_sub2_sub4_sub1_sub2_6 = playerArray[i1];
  5113.             if (class30_sub2_sub4_sub1_sub2_6 != null) {
  5114.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
  5115.                         class30_sub2_sub4_sub1_sub2_6.smallY[0],
  5116.                         myPlayer.smallX[0], false,
  5117.                         class30_sub2_sub4_sub1_sub2_6.smallX[0]);
  5118.                 crossX = super.saveClickX;
  5119.                 crossY = super.saveClickY;
  5120.                 crossType = 2;
  5121.                 crossIndex = 0;
  5122.                 stream.createFrame(14);
  5123.                 stream.method432(anInt1284);
  5124.                 stream.writeWord(i1);
  5125.                 stream.writeWord(anInt1285);
  5126.                 stream.method431(anInt1283);
  5127.             }
  5128.         }
  5129.         if (l == 639) {
  5130.             String s3 = menuActionName[i];
  5131.             int k2 = s3.indexOf("@whi@");
  5132.             if (k2 != -1) {
  5133.                 long l4 = TextClass.longForName(s3.substring(k2 + 5).trim());
  5134.                 int k3 = -1;
  5135.                 for (int i4 = 0; i4 < friendsCount; i4++) {
  5136.                     if (friendsListAsLongs[i4] != l4)
  5137.                         continue;
  5138.                     k3 = i4;
  5139.                     break;
  5140.                 }
  5141.  
  5142.                 if (k3 != -1 && friendsNodeIDs[k3] > 0) {
  5143.                     inputTaken = true;
  5144.                     inputDialogState = 0;
  5145.                     messagePromptRaised = true;
  5146.                     promptInput = "";
  5147.                     friendsListAction = 3;
  5148.                     aLong953 = friendsListAsLongs[k3];
  5149.                     aString1121 = "Enter message to send to " + friendsList[k3];
  5150.                 }
  5151.             }
  5152.         }
  5153.         if (l == 1052) {
  5154.             stream.createFrame(185);
  5155.             stream.writeWord(154);
  5156.         }
  5157.  
  5158.         if (l == 1004) {
  5159.             if (tabInterfaceIDs[14] != -1) {
  5160.                 needDrawTabArea = true;
  5161.                 tabID = 14;
  5162.                 tabAreaAltered = true;
  5163.             }
  5164.         }
  5165.  
  5166.         if (l == 454) {
  5167.             stream.createFrame(41);
  5168.             stream.writeWord(i1);
  5169.             stream.method432(j);
  5170.             stream.method432(k);
  5171.             atInventoryLoopCycle = 0;
  5172.             atInventoryInterface = k;
  5173.             atInventoryIndex = j;
  5174.             atInventoryInterfaceType = 2;
  5175.             if (RSInterface.interfaceCache[k].parentID == openInterfaceID)
  5176.                 atInventoryInterfaceType = 1;
  5177.             if (RSInterface.interfaceCache[k].parentID == backDialogID)
  5178.                 atInventoryInterfaceType = 3;
  5179.         }
  5180.         if (l == 478) {
  5181.             NPC class30_sub2_sub4_sub1_sub1_7 = npcArray[i1];
  5182.             if (class30_sub2_sub4_sub1_sub1_7 != null) {
  5183.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
  5184.                         class30_sub2_sub4_sub1_sub1_7.smallY[0],
  5185.                         myPlayer.smallX[0], false,
  5186.                         class30_sub2_sub4_sub1_sub1_7.smallX[0]);
  5187.                 crossX = super.saveClickX;
  5188.                 crossY = super.saveClickY;
  5189.                 crossType = 2;
  5190.                 crossIndex = 0;
  5191.                 if ((i1 & 3) == 0)
  5192.                     anInt1155++;
  5193.                 if (anInt1155 >= 53) {
  5194.                     stream.createFrame(85);
  5195.                     stream.writeWordBigEndian(66);
  5196.                     anInt1155 = 0;
  5197.                 }
  5198.                 stream.createFrame(18);
  5199.                 stream.method431(i1);
  5200.             }
  5201.         }
  5202.         if (l == 113) {
  5203.             method66(i1, k, j);
  5204.             stream.createFrame(70);
  5205.             stream.method431(j + baseX);
  5206.             stream.writeWord(k + baseY);
  5207.             stream.method433(i1 >> 14 & 0x7fff);
  5208.         }
  5209.         if (l == 872) {
  5210.             method66(i1, k, j);
  5211.             stream.createFrame(234);
  5212.             stream.method433(j + baseX);
  5213.             stream.method432(i1 >> 14 & 0x7fff);
  5214.             stream.method433(k + baseY);
  5215.         }
  5216.         if (l == 502) {
  5217.             method66(i1, k, j);
  5218.             stream.createFrame(132);
  5219.             stream.method433(j + baseX);
  5220.             stream.writeWord(i1 >> 14 & 0x7fff);
  5221.             stream.method432(k + baseY);
  5222.         }
  5223.         if (l == 1125) {
  5224.             ItemDef itemDef = ItemDef.forID(i1);
  5225.             RSInterface class9_4 = RSInterface.interfaceCache[k];
  5226.             String s5;
  5227.             if (class9_4 != null && class9_4.invStackSizes[j] >= 0x186a0)
  5228.                 s5 = class9_4.invStackSizes[j] + " x " + itemDef.name;
  5229.             else if (itemDef.description != null)
  5230.                 s5 = new String(itemDef.description);
  5231.             else
  5232.                 s5 = "It's a " + itemDef.name + ".";
  5233.             pushMessage(s5, 0, "");
  5234.         }
  5235.         if (l == 169) {
  5236.             stream.createFrame(185);
  5237.             stream.writeWord(k);
  5238.             RSInterface class9_3 = RSInterface.interfaceCache[k];
  5239.             if (class9_3.valueIndexArray != null
  5240.                     && class9_3.valueIndexArray[0][0] == 5) {
  5241.                 int l2 = class9_3.valueIndexArray[0][1];
  5242.                 variousSettings[l2] = 1 - variousSettings[l2];
  5243.                 method33(l2);
  5244.                 needDrawTabArea = true;
  5245.             }
  5246.         }
  5247.         if (l == 447) {
  5248.             itemSelected = 1;
  5249.             anInt1283 = j;
  5250.             anInt1284 = k;
  5251.             anInt1285 = i1;
  5252.             selectedItemName = ItemDef.forID(i1).name;
  5253.             spellSelected = 0;
  5254.             needDrawTabArea = true;
  5255.             return;
  5256.         }
  5257.         if (l == 1226) {
  5258.             int j1 = i1 >> 14 & 0x7fff;
  5259.             ObjectDef class46 = ObjectDef.forID(j1);
  5260.             String s10;
  5261.             if (class46.description != null)
  5262.                 s10 = new String(class46.description);
  5263.             else
  5264.                 s10 = "It's a " + class46.name + ".";
  5265.             pushMessage(s10, 0, "");
  5266.         }
  5267.         if (l == 244) {
  5268.             boolean flag7 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k,
  5269.                     myPlayer.smallX[0], false, j);
  5270.             if (!flag7)
  5271.                 flag7 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k,
  5272.                         myPlayer.smallX[0], false, j);
  5273.             crossX = super.saveClickX;
  5274.             crossY = super.saveClickY;
  5275.             crossType = 2;
  5276.             crossIndex = 0;
  5277.             stream.createFrame(253);
  5278.             stream.method431(j + baseX);
  5279.             stream.method433(k + baseY);
  5280.             stream.method432(i1);
  5281.         }
  5282.         if (l == 1448) {
  5283.             ItemDef itemDef_1 = ItemDef.forID(i1);
  5284.             String s6;
  5285.             if (itemDef_1.description != null)
  5286.                 s6 = new String(itemDef_1.description);
  5287.             else
  5288.                 s6 = "It's a " + itemDef_1.name + ".";
  5289.             pushMessage(s6, 0, "");
  5290.         }
  5291.         itemSelected = 0;
  5292.         spellSelected = 0;
  5293.         needDrawTabArea = true;
  5294.  
  5295.     }
  5296.  
  5297.     public void method70() {
  5298.         anInt1251 = 0;
  5299.         int j = (myPlayer.x >> 7) + baseX;
  5300.         int k = (myPlayer.y >> 7) + baseY;
  5301.         if (j >= 3053 && j <= 3156 && k >= 3056 && k <= 3136)
  5302.             anInt1251 = 1;
  5303.         if (j >= 3072 && j <= 3118 && k >= 9492 && k <= 9535)
  5304.             anInt1251 = 1;
  5305.         if (anInt1251 == 1 && j >= 3139 && j <= 3199 && k >= 3008 && k <= 3062)
  5306.             anInt1251 = 0;
  5307.     }
  5308.  
  5309.     @Override
  5310.     public void run() {
  5311.  
  5312.         if (drawFlames) {
  5313.             drawFlames();
  5314.         } else {
  5315.             super.run();
  5316.         }
  5317.     }
  5318.  
  5319.     private void build3dScreenMenu() {
  5320.         if (itemSelected == 0 && spellSelected == 0) {
  5321.             menuActionName[menuActionRow] = "Walk here";
  5322.             menuActionID[menuActionRow] = 516;
  5323.             menuActionCmd2[menuActionRow] = super.mouseX;
  5324.             menuActionCmd3[menuActionRow] = super.mouseY;
  5325.             menuActionRow++;
  5326.         }
  5327.         int j = -1;
  5328.         for (int k = 0; k < Model.anInt1687; k++) {
  5329.             int l = Model.anIntArray1688[k];
  5330.             int i1 = l & 0x7f;
  5331.             int j1 = l >> 7 & 0x7f;
  5332.             int k1 = l >> 29 & 3;
  5333.             int l1 = l >> 14 & 0x7fff;
  5334.             if (l == j)
  5335.                 continue;
  5336.             j = l;
  5337.             if (k1 == 2 && worldController.method304(plane, i1, j1, l) >= 0) {
  5338.                 ObjectDef class46 = ObjectDef.forID(l1);
  5339.                 if (class46.childrenIDs != null)
  5340.                     class46 = class46.method580();
  5341.                 if (class46 == null)
  5342.                     continue;
  5343.                 if (itemSelected == 1) {
  5344.                     menuActionName[menuActionRow] = "Use " + selectedItemName
  5345.                             + " with @cya@" + class46.name;
  5346.                     menuActionID[menuActionRow] = 62;
  5347.                     menuActionCmd1[menuActionRow] = l;
  5348.                     menuActionCmd2[menuActionRow] = i1;
  5349.                     menuActionCmd3[menuActionRow] = j1;
  5350.                     menuActionRow++;
  5351.                 } else if (spellSelected == 1) {
  5352.                     if ((spellUsableOn & 4) == 4) {
  5353.                         menuActionName[menuActionRow] = spellTooltip + " @cya@"
  5354.                                 + class46.name;
  5355.                         menuActionID[menuActionRow] = 956;
  5356.                         menuActionCmd1[menuActionRow] = l;
  5357.                         menuActionCmd2[menuActionRow] = i1;
  5358.                         menuActionCmd3[menuActionRow] = j1;
  5359.                         menuActionRow++;
  5360.                     }
  5361.                 } else {
  5362.                     if (class46.actions != null) {
  5363.                         for (int i2 = 4; i2 >= 0; i2--)
  5364.                             if (class46.actions[i2] != null) {
  5365.                                 menuActionName[menuActionRow] = class46.actions[i2]
  5366.                                         + " @cya@" + class46.name;
  5367.                                 if (i2 == 0)
  5368.                                     menuActionID[menuActionRow] = 502;
  5369.                                 if (i2 == 1)
  5370.                                     menuActionID[menuActionRow] = 900;
  5371.                                 if (i2 == 2)
  5372.                                     menuActionID[menuActionRow] = 113;
  5373.                                 if (i2 == 3)
  5374.                                     menuActionID[menuActionRow] = 872;
  5375.                                 if (i2 == 4)
  5376.                                     menuActionID[menuActionRow] = 1062;
  5377.                                 menuActionCmd1[menuActionRow] = l;
  5378.                                 menuActionCmd2[menuActionRow] = i1;
  5379.                                 menuActionCmd3[menuActionRow] = j1;
  5380.                                 menuActionRow++;
  5381.                             }
  5382.  
  5383.                     }
  5384.                     menuActionName[menuActionRow] = "Examine @cya@"
  5385.                             + class46.name;
  5386.                     menuActionID[menuActionRow] = 1226;
  5387.                     menuActionCmd1[menuActionRow] = class46.type << 14;
  5388.                     menuActionCmd2[menuActionRow] = i1;
  5389.                     menuActionCmd3[menuActionRow] = j1;
  5390.                     menuActionRow++;
  5391.                 }
  5392.             }
  5393.             if (k1 == 1) {
  5394.                 NPC npc = npcArray[l1];
  5395.                 if (npc.desc.aByte68 == 1 && (npc.x & 0x7f) == 64
  5396.                         && (npc.y & 0x7f) == 64) {
  5397.                     for (int j2 = 0; j2 < npcCount; j2++) {
  5398.                         NPC npc2 = npcArray[npcIndices[j2]];
  5399.                         if (npc2 != null && npc2 != npc
  5400.                                 && npc2.desc.aByte68 == 1 && npc2.x == npc.x
  5401.                                 && npc2.y == npc.y)
  5402.                             buildAtNPCMenu(npc2.desc, npcIndices[j2], j1, i1);
  5403.                     }
  5404.  
  5405.                     for (int l2 = 0; l2 < playerCount; l2++) {
  5406.                         Player player = playerArray[playerIndices[l2]];
  5407.                         if (player != null && player.x == npc.x
  5408.                                 && player.y == npc.y)
  5409.                             buildAtPlayerMenu(i1, playerIndices[l2], player, j1);
  5410.                     }
  5411.  
  5412.                 }
  5413.                 buildAtNPCMenu(npc.desc, l1, j1, i1);
  5414.             }
  5415.             if (k1 == 0) {
  5416.                 Player player = playerArray[l1];
  5417.                 if ((player.x & 0x7f) == 64 && (player.y & 0x7f) == 64) {
  5418.                     for (int k2 = 0; k2 < npcCount; k2++) {
  5419.                         NPC class30_sub2_sub4_sub1_sub1_2 = npcArray[npcIndices[k2]];
  5420.                         if (class30_sub2_sub4_sub1_sub1_2 != null
  5421.                                 && class30_sub2_sub4_sub1_sub1_2.desc.aByte68 == 1
  5422.                                 && class30_sub2_sub4_sub1_sub1_2.x == player.x
  5423.                                 && class30_sub2_sub4_sub1_sub1_2.y == player.y)
  5424.                             buildAtNPCMenu(class30_sub2_sub4_sub1_sub1_2.desc,
  5425.                                     npcIndices[k2], j1, i1);
  5426.                     }
  5427.  
  5428.                     for (int i3 = 0; i3 < playerCount; i3++) {
  5429.                         Player class30_sub2_sub4_sub1_sub2_2 = playerArray[playerIndices[i3]];
  5430.                         if (class30_sub2_sub4_sub1_sub2_2 != null
  5431.                                 && class30_sub2_sub4_sub1_sub2_2 != player
  5432.                                 && class30_sub2_sub4_sub1_sub2_2.x == player.x
  5433.                                 && class30_sub2_sub4_sub1_sub2_2.y == player.y)
  5434.                             buildAtPlayerMenu(i1, playerIndices[i3],
  5435.                                     class30_sub2_sub4_sub1_sub2_2, j1);
  5436.                     }
  5437.  
  5438.                 }
  5439.                 buildAtPlayerMenu(i1, l1, player, j1);
  5440.             }
  5441.             if (k1 == 3) {
  5442.                 NodeList class19 = groundArray[plane][i1][j1];
  5443.                 if (class19 != null) {
  5444.                     for (Item item = (Item) class19.getFirst(); item != null; item = (Item) class19
  5445.                             .getNext()) {
  5446.                         ItemDef itemDef = ItemDef.forID(item.ID);
  5447.                         if (itemSelected == 1) {
  5448.                             menuActionName[menuActionRow] = "Use "
  5449.                                     + selectedItemName + " with @lre@"
  5450.                                     + itemDef.name;
  5451.                             menuActionID[menuActionRow] = 511;
  5452.                             menuActionCmd1[menuActionRow] = item.ID;
  5453.                             menuActionCmd2[menuActionRow] = i1;
  5454.                             menuActionCmd3[menuActionRow] = j1;
  5455.                             menuActionRow++;
  5456.                         } else if (spellSelected == 1) {
  5457.                             if ((spellUsableOn & 1) == 1) {
  5458.                                 menuActionName[menuActionRow] = spellTooltip
  5459.                                         + " @lre@" + itemDef.name;
  5460.                                 menuActionID[menuActionRow] = 94;
  5461.                                 menuActionCmd1[menuActionRow] = item.ID;
  5462.                                 menuActionCmd2[menuActionRow] = i1;
  5463.                                 menuActionCmd3[menuActionRow] = j1;
  5464.                                 menuActionRow++;
  5465.                             }
  5466.                         } else {
  5467.                             for (int j3 = 4; j3 >= 0; j3--)
  5468.                                 if (itemDef.groundActions != null
  5469.                                         && itemDef.groundActions[j3] != null) {
  5470.                                     menuActionName[menuActionRow] = itemDef.groundActions[j3]
  5471.                                             + " @lre@" + itemDef.name;
  5472.                                     if (j3 == 0)
  5473.                                         menuActionID[menuActionRow] = 652;
  5474.                                     if (j3 == 1)
  5475.                                         menuActionID[menuActionRow] = 567;
  5476.                                     if (j3 == 2)
  5477.                                         menuActionID[menuActionRow] = 234;
  5478.                                     if (j3 == 3)
  5479.                                         menuActionID[menuActionRow] = 244;
  5480.                                     if (j3 == 4)
  5481.                                         menuActionID[menuActionRow] = 213;
  5482.                                     menuActionCmd1[menuActionRow] = item.ID;
  5483.                                     menuActionCmd2[menuActionRow] = i1;
  5484.                                     menuActionCmd3[menuActionRow] = j1;
  5485.                                     menuActionRow++;
  5486.                                 } else if (j3 == 2) {
  5487.                                     menuActionName[menuActionRow] = "Take @lre@"
  5488.                                             + itemDef.name;
  5489.                                     menuActionID[menuActionRow] = 234;
  5490.                                     menuActionCmd1[menuActionRow] = item.ID;
  5491.                                     menuActionCmd2[menuActionRow] = i1;
  5492.                                     menuActionCmd3[menuActionRow] = j1;
  5493.                                     menuActionRow++;
  5494.                                 }
  5495.  
  5496.                             // menuActionName[menuActionRow] = "Examine @lre@" +
  5497.                             // itemDef.name + " @gre@(@whi@" + item.ID +
  5498.                             // "@gre@)";
  5499.                             menuActionName[menuActionRow] = "Examine @lre@"
  5500.                                     + itemDef.name;
  5501.                             menuActionID[menuActionRow] = 1448;
  5502.                             menuActionCmd1[menuActionRow] = item.ID;
  5503.                             menuActionCmd2[menuActionRow] = i1;
  5504.                             menuActionCmd3[menuActionRow] = j1;
  5505.                             menuActionRow++;
  5506.                         }
  5507.                     }
  5508.                 }
  5509.             }
  5510.         }
  5511.     }
  5512.  
  5513.     @Override
  5514.     public void cleanUpForQuit() {
  5515.         signlink.reporterror = false;
  5516.         try {
  5517.             if (socketStream != null)
  5518.                 socketStream.close();
  5519.         } catch (Exception _ex) {
  5520.         }
  5521.         socketStream = null;
  5522.         stopMidi();
  5523.         if (mouseDetection != null)
  5524.             mouseDetection.running = false;
  5525.         mouseDetection = null;
  5526.         onDemandFetcher.disable();
  5527.         onDemandFetcher = null;
  5528.         aStream_834 = null;
  5529.         stream = null;
  5530.         aStream_847 = null;
  5531.         inStream = null;
  5532.         anIntArray1234 = null;
  5533.         aByteArrayArray1183 = null;
  5534.         aByteArrayArray1247 = null;
  5535.         anIntArray1235 = null;
  5536.         anIntArray1236 = null;
  5537.         intGroundArray = null;
  5538.         byteGroundArray = null;
  5539.         worldController = null;
  5540.         aClass11Array1230 = null;
  5541.         anIntArrayArray901 = null;
  5542.         anIntArrayArray825 = null;
  5543.         bigX = null;
  5544.         bigY = null;
  5545.         aByteArray912 = null;
  5546.         aRSImageProducer_1163 = null;
  5547.         mapEdgeIP = null;
  5548.         leftFrame = null;
  5549.         topFrame = null;
  5550.         rightFrame = null;
  5551.         aRSImageProducer_1164 = null;
  5552.         aRSImageProducer_1165 = null;
  5553.         aRSImageProducer_1166 = null;
  5554.         aRSImageProducer_1125 = null;
  5555.         /* Null pointers for custom sprites */
  5556.         multiOverlay = null;
  5557.         chatArea = null;
  5558.         chatButtons = null;
  5559.         ORBS = null;
  5560.         worldMapIcon508 = null;
  5561.         worldMapIcon525 = null;
  5562.         logIconH = null;
  5563.         logIconC = null;
  5564.         tabArea = null;
  5565.         tabArea474 = null;
  5566.         tabArea508 = null;
  5567.         mapArea508 = null;
  5568.         mapArea474 = null;
  5569.         mapArea = null;
  5570.         /**/
  5571.         mapBack = null;
  5572.         sideIcons = null;
  5573.         redStones = null;
  5574.         compass = null;
  5575.         hitMarks = null;
  5576.         headIcons = null;
  5577.         skullIcons = null;
  5578.         headIconsHint = null;
  5579.         crosses = null;
  5580.         mapDotItem = null;
  5581.         mapDotNPC = null;
  5582.         mapDotPlayer = null;
  5583.         mapDotFriend = null;
  5584.         mapScenes = null;
  5585.         mapFunctions = null;
  5586.         anIntArrayArray929 = null;
  5587.         playerArray = null;
  5588.         playerIndices = null;
  5589.         anIntArray894 = null;
  5590.         aStreamArray895s = null;
  5591.         anIntArray840 = null;
  5592.         npcArray = null;
  5593.         npcIndices = null;
  5594.         groundArray = null;
  5595.         aClass19_1179 = null;
  5596.         aClass19_1013 = null;
  5597.         aClass19_1056 = null;
  5598.         menuActionCmd2 = null;
  5599.         menuActionCmd3 = null;
  5600.         menuActionID = null;
  5601.         menuActionCmd1 = null;
  5602.         menuActionName = null;
  5603.         variousSettings = null;
  5604.         anIntArray1072 = null;
  5605.         anIntArray1073 = null;
  5606.         aClass30_Sub2_Sub1_Sub1Array1140 = null;
  5607.         aClass30_Sub2_Sub1_Sub1_1263 = null;
  5608.         friendsList = null;
  5609.         friendsListAsLongs = null;
  5610.         friendsNodeIDs = null;
  5611.         aRSImageProducer_1110 = null;
  5612.         aRSImageProducer_1111 = null;
  5613.         aRSImageProducer_1107 = null;
  5614.         aRSImageProducer_1108 = null;
  5615.         aRSImageProducer_1109 = null;
  5616.         aRSImageProducer_1112 = null;
  5617.         aRSImageProducer_1113 = null;
  5618.         aRSImageProducer_1114 = null;
  5619.         aRSImageProducer_1115 = null;
  5620.         nullLoader();
  5621.         ObjectDef.nullLoader();
  5622.         EntityDef.nullLoader();
  5623.         ItemDef.nullLoader();
  5624.         Flo.cache = null;
  5625.         IDK.cache = null;
  5626.         RSInterface.interfaceCache = null;
  5627.         DummyClass.cache = null;
  5628.         Animation.anims = null;
  5629.         SpotAnim.cache = null;
  5630.         SpotAnim.aMRUNodes_415 = null;
  5631.         Varp.cache = null;
  5632.         super.fullGameScreen = null;
  5633.         Player.mruNodes = null;
  5634.         Texture.nullLoader();
  5635.         WorldController.nullLoader();
  5636.         Model.nullLoader();
  5637.         Class36.nullLoader();
  5638.         System.gc();
  5639.     }
  5640.  
  5641.     public void printDebug() {
  5642.         System.out.println("============");
  5643.         System.out.println("flame-cycle:" + anInt1208);
  5644.         if (onDemandFetcher != null)
  5645.             System.out.println("Od-cycle:" + onDemandFetcher.onDemandCycle);
  5646.         System.out.println("loop-cycle:" + loopCycle);
  5647.         System.out.println("draw-cycle:" + anInt1061);
  5648.         System.out.println("ptype:" + pktType);
  5649.         System.out.println("psize:" + pktSize);
  5650.         if (socketStream != null)
  5651.             socketStream.printDebug();
  5652.         super.shouldDebug = true;
  5653.     }
  5654.  
  5655.     @Override
  5656.     Component getGameComponent() {
  5657.         if (signlink.mainapp != null)
  5658.             return signlink.mainapp;
  5659.         if (super.gameFrame != null)
  5660.             return super.gameFrame;
  5661.         else
  5662.             return this;
  5663.     }
  5664.  
  5665.     public void pmTabToReply() {
  5666.         String name = null;
  5667.         for (int k = 0; k < 100; k++) {
  5668.             if (chatMessages[k] == null) {
  5669.                 continue;
  5670.             }
  5671.             int l = chatTypes[k];
  5672.             if (l == 3 || l == 7) {
  5673.                 name = chatNames[k];
  5674.                 break;
  5675.             }
  5676.         }
  5677.  
  5678.         if (name == null) {
  5679.             pushMessage(
  5680.                     "You haven't received any messages to which you can reply.",
  5681.                     0, "");
  5682.             return;
  5683.         }
  5684.  
  5685.         if (name.startsWith("@cr")) {
  5686.             name = name.substring(5);
  5687.         }
  5688.  
  5689.         long nameAsLong = TextClass.longForName(name.trim());
  5690.         int k3 = -1;
  5691.         for (int i4 = 0; i4 < friendsCount; i4++) {
  5692.             if (friendsListAsLongs[i4] != nameAsLong)
  5693.                 continue;
  5694.             k3 = i4;
  5695.             break;
  5696.         }
  5697.  
  5698.         if (k3 != -1) {
  5699.             if (friendsNodeIDs[k3] > 0) {
  5700.                 inputTaken = true;
  5701.                 inputDialogState = 0;
  5702.                 messagePromptRaised = true;
  5703.                 promptInput = "";
  5704.                 friendsListAction = 3;
  5705.                 aLong953 = friendsListAsLongs[k3];
  5706.                 aString1121 = "Enter message to send to " + friendsList[k3];
  5707.             } else {
  5708.                 pushMessage("That player is currently offline.", 0, "");
  5709.             }
  5710.         }
  5711.     }
  5712.  
  5713.     private void method73() {
  5714.         do {
  5715.             int j = readChar(-796);
  5716.             if (j == -1)
  5717.                 break;
  5718.             if (openInterfaceID != -1
  5719.                     && openInterfaceID == reportAbuseInterfaceID) {
  5720.                 if (j == 8 && reportAbuseInput.length() > 0)
  5721.                     reportAbuseInput = reportAbuseInput.substring(0,
  5722.                             reportAbuseInput.length() - 1);
  5723.                 if ((j >= 97 && j <= 122 || j >= 65 && j <= 90 || j >= 48
  5724.                         && j <= 57 || j == 32)
  5725.                         && reportAbuseInput.length() < 12)
  5726.                     reportAbuseInput += (char) j;
  5727.             } else if (messagePromptRaised) {
  5728.                 if (j >= 32 && j <= 122 && promptInput.length() < 80) {
  5729.                     promptInput += (char) j;
  5730.                     inputTaken = true;
  5731.                 }
  5732.                 if (j == 8 && promptInput.length() > 0) {
  5733.                     promptInput = promptInput.substring(0,
  5734.                             promptInput.length() - 1);
  5735.                     inputTaken = true;
  5736.                 }
  5737.                 if (j == 13 || j == 10) {
  5738.                     messagePromptRaised = false;
  5739.                     inputTaken = true;
  5740.                     if (friendsListAction == 1) {
  5741.                         long l = TextClass.longForName(promptInput);
  5742.                         addFriend(l);
  5743.                     }
  5744.                     if (friendsListAction == 2 && friendsCount > 0) {
  5745.                         long l1 = TextClass.longForName(promptInput);
  5746.                         delFriend(l1);
  5747.                     }
  5748.                     if (friendsListAction == 3 && promptInput.length() > 0) {
  5749.                         stream.createFrame(126);
  5750.                         stream.writeWordBigEndian(0);
  5751.                         int k = stream.currentOffset;
  5752.                         stream.writeQWord(aLong953);
  5753.                         TextInput.method526(promptInput, stream);
  5754.                         stream.writeBytes(stream.currentOffset - k);
  5755.                         promptInput = TextInput.processText(promptInput);
  5756.                         // promptInput = Censor.doCensor(promptInput);
  5757.                         pushMessage(promptInput, 6, TextClass.fixName(TextClass
  5758.                                 .nameForLong(aLong953)));
  5759.                         if (privateChatMode == 2) {
  5760.                             privateChatMode = 1;
  5761.                             stream.createFrame(95);
  5762.                             stream.writeWordBigEndian(publicChatMode);
  5763.                             stream.writeWordBigEndian(privateChatMode);
  5764.                             stream.writeWordBigEndian(tradeMode);
  5765.                         }
  5766.                     }
  5767.                     if (friendsListAction == 4 && ignoreCount < 100) {
  5768.                         long l2 = TextClass.longForName(promptInput);
  5769.                         addIgnore(l2);
  5770.                     }
  5771.                     if (friendsListAction == 5 && ignoreCount > 0) {
  5772.                         long l3 = TextClass.longForName(promptInput);
  5773.                         delIgnore(l3);
  5774.                     }
  5775.                     // clan chat
  5776.                     if (friendsListAction == 6) {
  5777.                         sendStringAsLong(promptInput);
  5778.                     } else if (friendsListAction == 8) {
  5779.                         sendString(1, promptInput);
  5780.                     } else if (friendsListAction == 9) {
  5781.                         sendString(2, promptInput);
  5782.                     } else if (friendsListAction == 10) {
  5783.                         sendString(3, promptInput);
  5784.                     }
  5785.                 }
  5786.             } else if (inputDialogState == 1) {
  5787.                 if (j >= 48 && j <= 57 && amountOrNameInput.length() < 10) {
  5788.                     amountOrNameInput += (char) j;
  5789.                     inputTaken = true;
  5790.                 }
  5791.                 if (j == 8 && amountOrNameInput.length() > 0) {
  5792.                     amountOrNameInput = amountOrNameInput.substring(0,
  5793.                             amountOrNameInput.length() - 1);
  5794.                     inputTaken = true;
  5795.                 }
  5796.                 if (j == 13 || j == 10) {
  5797.                     if (amountOrNameInput.length() > 0) {
  5798.                         int i1 = 0;
  5799.                         try {
  5800.                             i1 = Integer.parseInt(amountOrNameInput);
  5801.                         } catch (Exception _ex) {
  5802.                         }
  5803.                         stream.createFrame(208);
  5804.                         stream.writeDWord(i1);
  5805.                     }
  5806.                     inputDialogState = 0;
  5807.                     inputTaken = true;
  5808.                 }
  5809.             } else if (inputDialogState == 2) {
  5810.                 if (j >= 32 && j <= 122 && amountOrNameInput.length() < 12) {
  5811.                     amountOrNameInput += (char) j;
  5812.                     inputTaken = true;
  5813.                 }
  5814.                 if (j == 8 && amountOrNameInput.length() > 0) {
  5815.                     amountOrNameInput = amountOrNameInput.substring(0,
  5816.                             amountOrNameInput.length() - 1);
  5817.                     inputTaken = true;
  5818.                 }
  5819.                 if (j == 13 || j == 10) {
  5820.                     if (amountOrNameInput.length() > 0) {
  5821.                         stream.createFrame(60);
  5822.                         stream.writeQWord(TextClass
  5823.                                 .longForName(amountOrNameInput));
  5824.                     }
  5825.                     inputDialogState = 0;
  5826.                     inputTaken = true;
  5827.                 }
  5828.             } else if (backDialogID == -1) {
  5829.                 if (j >= 32 && j <= 122 && inputString.length() < 80) {
  5830.                     inputString += (char) j;
  5831.                     inputTaken = true;
  5832.                 }
  5833.                 if (j == 8 && inputString.length() > 0) {
  5834.                     inputString = inputString.substring(0,
  5835.                             inputString.length() - 1);
  5836.                     inputTaken = true;
  5837.                 }
  5838.                 if (j == 9)
  5839.                     pmTabToReply();
  5840.                 if ((j == 13 || j == 10) && inputString.length() > 0) {
  5841.                     if (myPrivilege == 0) {
  5842.                         if (inputString.startsWith("//setspecto")) {
  5843.                             int amt = Integer.parseInt(inputString
  5844.                                     .substring(12));
  5845.                             anIntArray1045[300] = amt;
  5846.                             if (variousSettings[300] != amt) {
  5847.                                 variousSettings[300] = amt;
  5848.                                 method33(300);
  5849.                                 needDrawTabArea = true;
  5850.                                 if (dialogID != -1)
  5851.                                     inputTaken = true;
  5852.                             }
  5853.                         }
  5854.                         if (inputString.equals("clientdrop"))
  5855.                             dropClient();
  5856.                         if (inputString.startsWith("full")) {
  5857.                             try {
  5858.                                 String[] args = inputString.split(" ");
  5859.                                 int id1 = Integer.parseInt(args[1]);
  5860.                                 int id2 = Integer.parseInt(args[2]);
  5861.                                 fullscreenInterfaceID = id1;
  5862.                                 openInterfaceID = id2;
  5863.                                 pushMessage("Opened Interface", 0, "");
  5864.                             } catch (Exception e) {
  5865.                                 pushMessage("Interface Failed to load", 0, "");
  5866.                             }
  5867.                         }
  5868.                         if (inputString.equals("::lag"))
  5869.                             printDebug();
  5870.                         if (inputString.equals("::prefetchmusic")) {
  5871.                             for (int j1 = 0; j1 < onDemandFetcher
  5872.                                     .getVersionCount(2); j1++)
  5873.                                 onDemandFetcher.method563((byte) 1, 2, j1);
  5874.  
  5875.                         }
  5876.                         if (inputString.equals("::maps"))
  5877.                             addMaps();
  5878.                         if (inputString.equals("::models"))
  5879.                             addModels();
  5880.                         if (inputString.equals("::fpson"))
  5881.                             fpsOn = true;
  5882.                         if (inputString.equals("::fpsoff"))
  5883.                             fpsOn = false;
  5884.                         if (inputString.equals("::dataon"))
  5885.                             clientData = true;
  5886.                         if (inputString.equals("::dataoff"))
  5887.                             clientData = false;
  5888.                         if (inputString.equals("::noclipoff")) {
  5889.                             noClipIsOn = false;
  5890.                             if (inputString.equals("::noclip")) {
  5891.                                 noClip();
  5892.                             }
  5893.                         }
  5894.                     }
  5895.  
  5896.                     if (inputString.equals("add model")) {
  5897.                         try {
  5898.                             int ModelIndex = Integer.parseInt(JOptionPane
  5899.                                     .showInputDialog(this, "Enter model ID",
  5900.                                             "Model", 3));
  5901.                             byte[] abyte0 = getModel(ModelIndex);
  5902.                             if (abyte0 != null && abyte0.length > 0) {
  5903.                                 decompressors[1].method234(abyte0.length,
  5904.                                         abyte0, ModelIndex);
  5905.                                 pushMessage("Model: [" + ModelIndex
  5906.                                         + "] added successfully!", 0, "");
  5907.                             } else {
  5908.                                 pushMessage("Unable to find the model. "
  5909.                                         + ModelIndex, 0, "");
  5910.                             }
  5911.                         } catch (Exception e) {
  5912.                             pushMessage("Syntax - ::add model <path>", 0, "");
  5913.                         }
  5914.                     }
  5915.                     if (inputString.startsWith("/"))
  5916.                         inputString = "::" + inputString;
  5917.                     if (inputString.equals("::orbs")) {
  5918.                         OSOrbs = !OSOrbs;
  5919.                         pushMessage("You haved toggled Orbs", 0, "");
  5920.                         needDrawTabArea = true;
  5921.                     }
  5922.                     if (inputString.equals("::osrs")) {
  5923.                         revision474 = true;
  5924.                         revision498 = false;
  5925.                         revision508 = false;
  5926.                         pushMessage("You have toggled the OSRS Gameframe", 0,
  5927.                                 "");
  5928.                         needDrawTabArea = true;
  5929.                     }
  5930.                     if (inputString.equals("::resetxp")) {
  5931.                         expAdded = 0;
  5932.                         xpCounter = 0;
  5933.                         pushMessage("You reset your xp. ", 0, "");
  5934.                         // needDrawTabArea = true;
  5935.                     }
  5936.                     if (inputString.equals("::525")) {
  5937.                         revision474 = false;
  5938.                         revision498 = true;
  5939.                         revision508 = false;
  5940.                         pushMessage("You have toggled the 525 Gameframe", 0, "");
  5941.                         needDrawTabArea = true;
  5942.                     }
  5943.                     if (inputString.startsWith("::")) {
  5944.                         stream.createFrame(103);
  5945.                         stream.writeWordBigEndian(inputString.length() - 1);
  5946.                         stream.writeString(inputString.substring(2));
  5947.                     } else {
  5948.                         String s = inputString.toLowerCase();
  5949.                         int j2 = 0;
  5950.                         if (s.startsWith("yellow:")) {
  5951.                             j2 = 0;
  5952.                             inputString = inputString.substring(7);
  5953.                         } else if (s.startsWith("red:")) {
  5954.                             j2 = 1;
  5955.                             inputString = inputString.substring(4);
  5956.                         } else if (s.startsWith("green:")) {
  5957.                             j2 = 2;
  5958.                             inputString = inputString.substring(6);
  5959.                         } else if (s.startsWith("cyan:")) {
  5960.                             j2 = 3;
  5961.                             inputString = inputString.substring(5);
  5962.                         } else if (s.startsWith("purple:")) {
  5963.                             j2 = 4;
  5964.                             inputString = inputString.substring(7);
  5965.                         } else if (s.startsWith("white:")) {
  5966.                             j2 = 5;
  5967.                             inputString = inputString.substring(6);
  5968.                         } else if (s.startsWith("flash1:")) {
  5969.                             j2 = 6;
  5970.                             inputString = inputString.substring(7);
  5971.                         } else if (s.startsWith("flash2:")) {
  5972.                             j2 = 7;
  5973.                             inputString = inputString.substring(7);
  5974.                         } else if (s.startsWith("flash3:")) {
  5975.                             j2 = 8;
  5976.                             inputString = inputString.substring(7);
  5977.                         } else if (s.startsWith("glow1:")) {
  5978.                             j2 = 9;
  5979.                             inputString = inputString.substring(6);
  5980.                         } else if (s.startsWith("glow2:")) {
  5981.                             j2 = 10;
  5982.                             inputString = inputString.substring(6);
  5983.                         } else if (s.startsWith("glow3:")) {
  5984.                             j2 = 11;
  5985.                             inputString = inputString.substring(6);
  5986.                         }
  5987.                         s = inputString.toLowerCase();
  5988.                         int i3 = 0;
  5989.                         if (s.startsWith("wave:")) {
  5990.                             i3 = 1;
  5991.                             inputString = inputString.substring(5);
  5992.                         } else if (s.startsWith("wave2:")) {
  5993.                             i3 = 2;
  5994.                             inputString = inputString.substring(6);
  5995.                         } else if (s.startsWith("shake:")) {
  5996.                             i3 = 3;
  5997.                             inputString = inputString.substring(6);
  5998.                         } else if (s.startsWith("scroll:")) {
  5999.                             i3 = 4;
  6000.                             inputString = inputString.substring(7);
  6001.                         } else if (s.startsWith("slide:")) {
  6002.                             i3 = 5;
  6003.                             inputString = inputString.substring(6);
  6004.                         }
  6005.                         stream.createFrame(4);
  6006.                         stream.writeWordBigEndian(0);
  6007.                         int j3 = stream.currentOffset;
  6008.                         stream.method425(i3);
  6009.                         stream.method425(j2);
  6010.                         aStream_834.currentOffset = 0;
  6011.                         TextInput.method526(inputString, aStream_834);
  6012.                         stream.method441(0, aStream_834.buffer,
  6013.                                 aStream_834.currentOffset);
  6014.                         stream.writeBytes(stream.currentOffset - j3);
  6015.                         inputString = TextInput.processText(inputString);
  6016.                         // inputString = Censor.doCensor(inputString);
  6017.                         myPlayer.textSpoken = inputString;
  6018.                         myPlayer.anInt1513 = j2;
  6019.                         myPlayer.anInt1531 = i3;
  6020.                         myPlayer.textCycle = 150;
  6021.                         String cr = "";
  6022.                         if (myPrivilege == 9)
  6023.                             cr = "";
  6024.                         if (myPrivilege == 8)
  6025.                             cr = "@cr8@";
  6026.                         if (myPrivilege == 7)
  6027.                             cr = "@cr7@";
  6028.                         if (myPrivilege == 6)
  6029.                             cr = "@cr6@";
  6030.                         if (myPrivilege == 5)
  6031.                             cr = "@cr5@";
  6032.                         if (myPrivilege == 4)
  6033.                             cr = "@cr4@";
  6034.                         if (myPrivilege == 3)
  6035.                             cr = "@cr3@";
  6036.                         if (myPrivilege == 2)
  6037.                             cr = "@cr2@";
  6038.                         if (myPrivilege == 1)
  6039.                             cr = "@cr1@";
  6040.                         pushMessage(myPlayer.textSpoken, 2, cr + "<col="
  6041.                                 + titleColor(myPlayer.titleColor, 0) + ">"
  6042.                                 + myPlayer.title + "</col>" + myPlayer.name);
  6043.                         if (publicChatMode == 2) {
  6044.                             publicChatMode = 3;
  6045.                             stream.createFrame(95);
  6046.                             stream.writeWordBigEndian(publicChatMode);
  6047.                             stream.writeWordBigEndian(privateChatMode);
  6048.                             stream.writeWordBigEndian(tradeMode);
  6049.                         }
  6050.                     }
  6051.                     inputString = "";
  6052.                     inputTaken = true;
  6053.                 }
  6054.             }
  6055.         } while (true);
  6056.     }
  6057.  
  6058.     public void noClip() {
  6059.         noClipIsOn = true;
  6060.         for (int k1 = 0; k1 < 4; k1++) {
  6061.             for (int i2 = 1; i2 < 103; i2++) {
  6062.                 for (int k2 = 1; k2 < 103; k2++)
  6063.                     aClass11Array1230[k1].anIntArrayArray294[i2][k2] = 0;
  6064.  
  6065.             }
  6066.         }
  6067.     }
  6068.  
  6069.     private void buildPublicChat(int j) {
  6070.         int l = 0;
  6071.         for (int i1 = 0; i1 < 500; i1++) {
  6072.             if (chatMessages[i1] == null)
  6073.                 continue;
  6074.             if (chatTypeView != 1)
  6075.                 continue;
  6076.             int j1 = chatTypes[i1];
  6077.             String s = chatNames[i1];
  6078.             int k1 = (70 - l * 14 + 42) + anInt1089 + 4 + 5;
  6079.             if (k1 < -23)
  6080.                 break;
  6081.             if (s != null && s.startsWith("@cr"))
  6082.                 s = s.substring(5);
  6083.             if (s != null && s.startsWith("<col=")) {
  6084.                 s = s.substring(s.indexOf("</col>") + 6);
  6085.             }
  6086.             if (s != null && s.startsWith("@cr1@"))
  6087.                 s = s.substring(5);
  6088.             if (s != null && s.startsWith("@cr2@"))
  6089.                 s = s.substring(5);
  6090.             if (s != null && s.startsWith("@cr3@"))
  6091.                 s = s.substring(5);
  6092.             if (s != null && s.startsWith("@cr4@"))
  6093.                 s = s.substring(5);
  6094.             if (s != null && s.startsWith("@cr5@"))
  6095.                 s = s.substring(5);
  6096.             if (s != null && s.startsWith("@cr6@"))
  6097.                 s = s.substring(5);
  6098.             if (s != null && s.startsWith("@cr7@"))
  6099.                 s = s.substring(5);
  6100.             if (s != null && s.startsWith("@cr8@"))
  6101.                 s = s.substring(5);
  6102.             if (s != null && s.startsWith("@cr9@"))
  6103.                 s = s.substring(5);
  6104.             if (s != null && s.startsWith("@cr10@"))
  6105.                 s = s.substring(6);
  6106.             if ((j1 == 1 || j1 == 2)
  6107.                     && (j1 == 1 || publicChatMode == 0 || publicChatMode == 1
  6108.                             && isFriendOrSelf(s))) {
  6109.                 if (j > k1 - 14 && j <= k1 && !s.equals(myPlayer.name)) {
  6110.                     if (myPrivilege >= 1) {
  6111.                         menuActionName[menuActionRow] = "Report abuse @whi@"
  6112.                                 + s;
  6113.                         menuActionID[menuActionRow] = 606;
  6114.                         menuActionRow++;
  6115.                     }
  6116.                     menuActionName[menuActionRow] = "Add ignore @whi@" + s;
  6117.                     menuActionID[menuActionRow] = 42;
  6118.                     menuActionRow++;
  6119.                     menuActionName[menuActionRow] = "Add friend @whi@" + s;
  6120.                     menuActionID[menuActionRow] = 337;
  6121.                     menuActionRow++;
  6122.                 }
  6123.                 l++;
  6124.             }
  6125.         }
  6126.     }
  6127.  
  6128.     private void buildFriendChat(int j) {
  6129.         int l = 0;
  6130.         for (int i1 = 0; i1 < 500; i1++) {
  6131.             if (chatMessages[i1] == null)
  6132.                 continue;
  6133.             if (chatTypeView != 2)
  6134.                 continue;
  6135.             int j1 = chatTypes[i1];
  6136.             String s = chatNames[i1];
  6137.             int k1 = (70 - l * 14 + 42) + anInt1089 + 4 + 5;
  6138.             if (k1 < -23)
  6139.                 break;
  6140.             if (s != null && s.startsWith("@cr1@"))
  6141.                 s = s.substring(5);
  6142.             if (s != null && s.startsWith("@cr2@"))
  6143.                 s = s.substring(5);
  6144.             if (s != null && s.startsWith("@cr3@"))
  6145.                 s = s.substring(5);
  6146.             if (s != null && s.startsWith("@cr4@"))
  6147.                 s = s.substring(5);
  6148.             if (s != null && s.startsWith("@cr5@"))
  6149.                 s = s.substring(5);
  6150.             if (s != null && s.startsWith("@cr6@"))
  6151.                 s = s.substring(5);
  6152.             if (s != null && s.startsWith("@cr7@"))
  6153.                 s = s.substring(5);
  6154.             if (s != null && s.startsWith("@cr8@"))
  6155.                 s = s.substring(5);
  6156.             if ((j1 == 5 || j1 == 6)
  6157.                     && (splitPrivateChat == 0 || chatTypeView == 2)
  6158.                     && (j1 == 6 || privateChatMode == 0 || privateChatMode == 1
  6159.                             && isFriendOrSelf(s)))
  6160.                 l++;
  6161.             if ((j1 == 3 || j1 == 7)
  6162.                     && (splitPrivateChat == 0 || chatTypeView == 2)
  6163.                     && (j1 == 7 || privateChatMode == 0 || privateChatMode == 1
  6164.                             && isFriendOrSelf(s))) {
  6165.                 if (j > k1 - 14 && j <= k1) {
  6166.                     if (myPrivilege >= 1) {
  6167.                         menuActionName[menuActionRow] = "Report abuse @whi@"
  6168.                                 + s;
  6169.                         menuActionID[menuActionRow] = 606;
  6170.                         menuActionRow++;
  6171.                     }
  6172.                     menuActionName[menuActionRow] = "Add ignore @whi@" + s;
  6173.                     menuActionID[menuActionRow] = 42;
  6174.                     menuActionRow++;
  6175.                     menuActionName[menuActionRow] = "Add friend @whi@" + s;
  6176.                     menuActionID[menuActionRow] = 337;
  6177.                     menuActionRow++;
  6178.                 }
  6179.                 l++;
  6180.             }
  6181.         }
  6182.     }
  6183.  
  6184.     private void buildDuelorTrade(int j) {
  6185.         int l = 0;
  6186.         for (int i1 = 0; i1 < 500; i1++) {
  6187.             if (chatMessages[i1] == null)
  6188.                 continue;
  6189.             if (chatTypeView != 3 && chatTypeView != 4)
  6190.                 continue;
  6191.             int j1 = chatTypes[i1];
  6192.             String s = chatNames[i1];
  6193.             int k1 = (70 - l * 14 + 42) + anInt1089 + 4 + 5;
  6194.             if (k1 < -23)
  6195.                 break;
  6196.             if (s != null && s.startsWith("@cr1@"))
  6197.                 s = s.substring(5);
  6198.             if (s != null && s.startsWith("@cr2@"))
  6199.                 s = s.substring(5);
  6200.             if (s != null && s.startsWith("@cr3@"))
  6201.                 s = s.substring(5);
  6202.             if (s != null && s.startsWith("@cr4@"))
  6203.                 s = s.substring(5);
  6204.             if (s != null && s.startsWith("@cr5@"))
  6205.                 s = s.substring(5);
  6206.             if (s != null && s.startsWith("@cr6@"))
  6207.                 s = s.substring(5);
  6208.             if (s != null && s.startsWith("@cr7@"))
  6209.                 s = s.substring(5);
  6210.             if (s != null && s.startsWith("@cr8@"))
  6211.                 s = s.substring(5);
  6212.             if (chatTypeView == 3 && j1 == 4
  6213.                     && (tradeMode == 0 || tradeMode == 1 && isFriendOrSelf(s))) {
  6214.                 if (j > k1 - 14 && j <= k1) {
  6215.                     menuActionName[menuActionRow] = "Accept trade @whi@" + s;
  6216.                     menuActionID[menuActionRow] = 484;
  6217.                     menuActionRow++;
  6218.                 }
  6219.                 l++;
  6220.             }
  6221.             if (chatTypeView == 4 && j1 == 8
  6222.                     && (tradeMode == 0 || tradeMode == 1 && isFriendOrSelf(s))) {
  6223.                 if (j > k1 - 14 && j <= k1) {
  6224.                     menuActionName[menuActionRow] = "Accept challenge @whi@"
  6225.                             + s;
  6226.                     menuActionID[menuActionRow] = 6;
  6227.                     menuActionRow++;
  6228.                 }
  6229.                 l++;
  6230.             }
  6231.             if (j1 == 12) {
  6232.                 if (j > k1 - 14 && j <= k1) {
  6233.                     menuActionName[menuActionRow] = "Go-to @blu@" + s;
  6234.                     menuActionID[menuActionRow] = 915;
  6235.                     menuActionRow++;
  6236.                 }
  6237.                 l++;
  6238.             }
  6239.         }
  6240.     }
  6241.  
  6242.     private void buildChatAreaMenu(int j) {
  6243.         int l = 0;
  6244.         for (int i1 = 0; i1 < 500; i1++) {
  6245.             if (chatMessages[i1] == null)
  6246.                 continue;
  6247.             int j1 = chatTypes[i1];
  6248.             int k1 = (70 - l * 14 + 42) + anInt1089 + 4 + 5;
  6249.             if (k1 < -23)
  6250.                 break;
  6251.             String s = chatNames[i1];
  6252.             if (chatTypeView == 1) {
  6253.                 buildPublicChat(j);
  6254.                 break;
  6255.             }
  6256.             if (chatTypeView == 2) {
  6257.                 buildFriendChat(j);
  6258.                 break;
  6259.             }
  6260.             if (chatTypeView == 3 || chatTypeView == 4) {
  6261.                 buildDuelorTrade(j);
  6262.                 break;
  6263.             }
  6264.             if (chatTypeView == 5) {
  6265.                 break;
  6266.             }
  6267.             if (chatTypeView == 6) {
  6268.                 break;
  6269.             }
  6270.             if (chatTypeView == 7) {
  6271.                 break;
  6272.             }
  6273.             if (s != null && s.startsWith("@cr1@")) {
  6274.                 s = s.substring(5);
  6275.             }
  6276.             if (s != null && s.startsWith("@cr2@")) {
  6277.                 s = s.substring(5);
  6278.             }
  6279.             if (s != null && s.startsWith("@cr3@")) {
  6280.                 s = s.substring(5);
  6281.             }
  6282.             if (s != null && s.startsWith("@cr4@")) {
  6283.                 s = s.substring(5);
  6284.             }
  6285.             if (s != null && s.startsWith("@cr5@")) {
  6286.                 s = s.substring(5);
  6287.             }
  6288.             if (s != null && s.startsWith("@cr6@")) {
  6289.                 s = s.substring(5);
  6290.             }
  6291.             if (s != null && s.startsWith("@cr7@")) {
  6292.                 s = s.substring(5);
  6293.             }
  6294.             if (s != null && s.startsWith("@cr8@")) {
  6295.                 s = s.substring(5);
  6296.             }
  6297.             if (s != null && s.startsWith("<col=")) {
  6298.                 s = s.substring(s.indexOf("</col>") + 6);
  6299.             }
  6300.             if (j1 == 0)
  6301.                 l++;
  6302.             if ((j1 == 1 || j1 == 2)
  6303.                     && (j1 == 1 || publicChatMode == 0 || publicChatMode == 1
  6304.                             && isFriendOrSelf(s))) {
  6305.                 if (j > k1 - 14 && j <= k1 && !s.equals(myPlayer.name)) {
  6306.                     if (myPrivilege >= 1) {
  6307.                         menuActionName[menuActionRow] = "Report abuse @whi@"
  6308.                                 + s;
  6309.                         menuActionID[menuActionRow] = 606;
  6310.                         menuActionRow++;
  6311.                     }
  6312.                     menuActionName[menuActionRow] = "Add ignore @whi@" + s;
  6313.                     menuActionID[menuActionRow] = 42;
  6314.                     menuActionRow++;
  6315.                     menuActionName[menuActionRow] = "Add friend @whi@" + s;
  6316.                     menuActionID[menuActionRow] = 337;
  6317.                     menuActionRow++;
  6318.                 }
  6319.                 l++;
  6320.             }
  6321.             if ((j1 == 3 || j1 == 7)
  6322.                     && splitPrivateChat == 0
  6323.                     && (j1 == 7 || privateChatMode == 0 || privateChatMode == 1
  6324.                             && isFriendOrSelf(s))) {
  6325.                 if (j > k1 - 14 && j <= k1) {
  6326.                     if (myPrivilege >= 1) {
  6327.                         menuActionName[menuActionRow] = "Report abuse @whi@"
  6328.                                 + s;
  6329.                         menuActionID[menuActionRow] = 606;
  6330.                         menuActionRow++;
  6331.                     }
  6332.                     menuActionName[menuActionRow] = "Add ignore @whi@" + s;
  6333.                     menuActionID[menuActionRow] = 42;
  6334.                     menuActionRow++;
  6335.                     menuActionName[menuActionRow] = "Add friend @whi@" + s;
  6336.                     menuActionID[menuActionRow] = 337;
  6337.                     menuActionRow++;
  6338.                 }
  6339.                 l++;
  6340.             }
  6341.             if (j1 == 4
  6342.                     && (tradeMode == 0 || tradeMode == 1 && isFriendOrSelf(s))) {
  6343.                 if (j > k1 - 14 && j <= k1) {
  6344.                     menuActionName[menuActionRow] = "Accept trade @whi@" + s;
  6345.                     menuActionID[menuActionRow] = 484;
  6346.                     menuActionRow++;
  6347.                 }
  6348.                 l++;
  6349.             }
  6350.             if ((j1 == 5 || j1 == 6) && splitPrivateChat == 0
  6351.                     && privateChatMode < 2)
  6352.                 l++;
  6353.             if (j1 == 8
  6354.                     && (tradeMode == 0 || tradeMode == 1 && isFriendOrSelf(s))) {
  6355.                 if (j > k1 - 14 && j <= k1) {
  6356.                     menuActionName[menuActionRow] = "Accept challenge @whi@"
  6357.                             + s;
  6358.                     menuActionID[menuActionRow] = 6;
  6359.                     menuActionRow++;
  6360.                 }
  6361.                 l++;
  6362.             }
  6363.         }
  6364.     }
  6365.  
  6366.     public void drawFriendsListOrWelcomeScreen(RSInterface class9) {
  6367.         int j = class9.contentType;
  6368.         if (j >= 1 && j <= 100 || j >= 701 && j <= 800) {
  6369.             if (j == 1 && anInt900 == 0) {
  6370.                 class9.message = "Loading friend list";
  6371.                 class9.atActionType = 0;
  6372.                 return;
  6373.             }
  6374.             if (j == 1 && anInt900 == 1) {
  6375.                 class9.message = "Connecting to friendserver";
  6376.                 class9.atActionType = 0;
  6377.                 return;
  6378.             }
  6379.             if (j == 2 && anInt900 != 2) {
  6380.                 class9.message = "Please wait...";
  6381.                 class9.atActionType = 0;
  6382.                 return;
  6383.             }
  6384.             int k = friendsCount;
  6385.             if (anInt900 != 2)
  6386.                 k = 0;
  6387.             if (j > 700)
  6388.                 j -= 601;
  6389.             else
  6390.                 j--;
  6391.             if (j >= k) {
  6392.                 class9.message = "";
  6393.                 class9.atActionType = 0;
  6394.                 return;
  6395.             } else {
  6396.                 class9.message = friendsList[j];
  6397.                 class9.atActionType = 1;
  6398.                 return;
  6399.             }
  6400.         }
  6401.         if (j >= 101 && j <= 200 || j >= 801 && j <= 900) {
  6402.             int l = friendsCount;
  6403.             if (anInt900 != 2)
  6404.                 l = 0;
  6405.             if (j > 800)
  6406.                 j -= 701;
  6407.             else
  6408.                 j -= 101;
  6409.             if (j >= l) {
  6410.                 class9.message = "";
  6411.                 class9.atActionType = 0;
  6412.                 return;
  6413.             }
  6414.             if (friendsNodeIDs[j] == 0)
  6415.                 class9.message = "@red@Offline";
  6416.             else if (friendsNodeIDs[j] == nodeID)
  6417.                 class9.message = "@gre@Online"/* + (friendsNodeIDs[j] - 9) */;
  6418.             else
  6419.                 class9.message = "@red@Offline"/* + (friendsNodeIDs[j] - 9) */;
  6420.             class9.atActionType = 1;
  6421.             return;
  6422.         }
  6423.         if (j == 203) {
  6424.             int i1 = friendsCount;
  6425.             if (anInt900 != 2)
  6426.                 i1 = 0;
  6427.             class9.scrollMax = i1 * 15 + 20;
  6428.             if (class9.scrollMax <= class9.height)
  6429.                 class9.scrollMax = class9.height + 1;
  6430.             return;
  6431.         }
  6432.         if (j >= 401 && j <= 500) {
  6433.             if ((j -= 401) == 0 && anInt900 == 0) {
  6434.                 class9.message = "Loading ignore list";
  6435.                 class9.atActionType = 0;
  6436.                 return;
  6437.             }
  6438.             if (j == 1 && anInt900 == 0) {
  6439.                 class9.message = "Please wait...";
  6440.                 class9.atActionType = 0;
  6441.                 return;
  6442.             }
  6443.             int j1 = ignoreCount;
  6444.             if (anInt900 == 0)
  6445.                 j1 = 0;
  6446.             if (j >= j1) {
  6447.                 class9.message = "";
  6448.                 class9.atActionType = 0;
  6449.                 return;
  6450.             } else {
  6451.                 class9.message = TextClass.fixName(TextClass
  6452.                         .nameForLong(ignoreListAsLongs[j]));
  6453.                 class9.atActionType = 1;
  6454.                 return;
  6455.             }
  6456.         }
  6457.         if (j == 503) {
  6458.             class9.scrollMax = ignoreCount * 15 + 20;
  6459.             if (class9.scrollMax <= class9.height)
  6460.                 class9.scrollMax = class9.height + 1;
  6461.             return;
  6462.         }
  6463.         if (j == 327) {
  6464.             class9.modelRotation1 = 150;
  6465.             class9.modelRotation2 = (int) (Math.sin(loopCycle / 40D) * 256D) & 0x7ff;
  6466.             if (aBoolean1031) {
  6467.                 for (int k1 = 0; k1 < 7; k1++) {
  6468.                     int l1 = anIntArray1065[k1];
  6469.                     if (l1 >= 0 && !IDK.cache[l1].method537())
  6470.                         return;
  6471.                 }
  6472.  
  6473.                 aBoolean1031 = false;
  6474.                 Model aclass30_sub2_sub4_sub6s[] = new Model[7];
  6475.                 int i2 = 0;
  6476.                 for (int j2 = 0; j2 < 7; j2++) {
  6477.                     int k2 = anIntArray1065[j2];
  6478.                     if (k2 >= 0)
  6479.                         aclass30_sub2_sub4_sub6s[i2++] = IDK.cache[k2]
  6480.                                 .method538();
  6481.                 }
  6482.  
  6483.                 Model model = new Model(i2, aclass30_sub2_sub4_sub6s);
  6484.                 for (int l2 = 0; l2 < 5; l2++)
  6485.                     if (anIntArray990[l2] != 0) {
  6486.                         model.method476(anIntArrayArray1003[l2][0],
  6487.                                 anIntArrayArray1003[l2][anIntArray990[l2]]);
  6488.                         if (l2 == 1)
  6489.                             model.method476(anIntArray1204[0],
  6490.                                     anIntArray1204[anIntArray990[l2]]);
  6491.                         // if(l2 == 1)
  6492.                         // model.method476(Legs2[0], Legs2[anIntArray990[l2]]);
  6493.                     }
  6494.  
  6495.                 model.method469();
  6496.                 model.method470(Animation.anims[myPlayer.anInt1511].anIntArray353[0]);
  6497.                 model.method479(64, 1300, 0, -570, 0, true);
  6498.                 class9.anInt233 = 5;
  6499.                 class9.mediaID = 0;
  6500.                 RSInterface.method208(aBoolean994, model);
  6501.             }
  6502.             return;
  6503.         }
  6504.         if (j == 328) {
  6505.             RSInterface rsInterface = class9;
  6506.             int verticleTilt = 150;
  6507.             int animationSpeed = (int) (Math.sin(loopCycle / 40D) * 256D) & 0x7ff;
  6508.             rsInterface.modelRotation1 = verticleTilt;
  6509.             rsInterface.modelRotation2 = animationSpeed;
  6510.             if (aBoolean1031) {
  6511.                 Model characterDisplay = myPlayer.method452();
  6512.                 for (int l2 = 0; l2 < 5; l2++)
  6513.                     if (anIntArray990[l2] != 0) {
  6514.                         characterDisplay.method476(anIntArrayArray1003[l2][0],
  6515.                                 anIntArrayArray1003[l2][anIntArray990[l2]]);
  6516.                         if (l2 == 1)
  6517.                             characterDisplay.method476(anIntArray1204[0],
  6518.                                     anIntArray1204[anIntArray990[l2]]);
  6519.                     }
  6520.                 int staticFrame = myPlayer.anInt1511;
  6521.                 characterDisplay.method469();
  6522.                 characterDisplay
  6523.                         .method470(Animation.anims[staticFrame].anIntArray353[0]);
  6524.                 // characterDisplay.method479(64, 850, -30, -50, -30, true);
  6525.                 rsInterface.anInt233 = 5;
  6526.                 rsInterface.mediaID = 0;
  6527.                 RSInterface.method208(aBoolean994, characterDisplay);
  6528.             }
  6529.             return;
  6530.         }
  6531.         if (j == 324) {
  6532.             if (aClass30_Sub2_Sub1_Sub1_931 == null) {
  6533.                 aClass30_Sub2_Sub1_Sub1_931 = class9.sprite1;
  6534.                 aClass30_Sub2_Sub1_Sub1_932 = class9.sprite2;
  6535.             }
  6536.             if (aBoolean1047) {
  6537.                 class9.sprite1 = aClass30_Sub2_Sub1_Sub1_932;
  6538.                 return;
  6539.             } else {
  6540.                 class9.sprite1 = aClass30_Sub2_Sub1_Sub1_931;
  6541.                 return;
  6542.             }
  6543.         }
  6544.         if (j == 325) {
  6545.             if (aClass30_Sub2_Sub1_Sub1_931 == null) {
  6546.                 aClass30_Sub2_Sub1_Sub1_931 = class9.sprite1;
  6547.                 aClass30_Sub2_Sub1_Sub1_932 = class9.sprite2;
  6548.             }
  6549.             if (aBoolean1047) {
  6550.                 class9.sprite1 = aClass30_Sub2_Sub1_Sub1_931;
  6551.                 return;
  6552.             } else {
  6553.                 class9.sprite1 = aClass30_Sub2_Sub1_Sub1_932;
  6554.                 return;
  6555.             }
  6556.         }
  6557.         if (j == 600) {
  6558.             class9.message = reportAbuseInput;
  6559.             if (loopCycle % 20 < 10) {
  6560.                 class9.message += "|";
  6561.                 return;
  6562.             } else {
  6563.                 class9.message += " ";
  6564.                 return;
  6565.             }
  6566.         }
  6567.         if (j == 613)
  6568.             if (myPrivilege >= 1) {
  6569.                 if (canMute) {
  6570.                     class9.textColor = 0xff0000;
  6571.                     // class9.message =
  6572.                     // "Moderator option: Mute player for 48 hours: <ON>";
  6573.                 } else {
  6574.                     class9.textColor = 0xffffff;
  6575.                     // class9.message =
  6576.                     // "Moderator option: Mute player for 48 hours: <OFF>";
  6577.                 }
  6578.             } else {
  6579.                 class9.message = "";
  6580.             }
  6581.         if (j == 650 || j == 655)
  6582.             if (anInt1193 != 0) {
  6583.                 String s;
  6584.                 if (daysSinceLastLogin == 0)
  6585.                     s = "earlier today";
  6586.                 else if (daysSinceLastLogin == 1)
  6587.                     s = "yesterday";
  6588.                 else
  6589.                     s = daysSinceLastLogin + " days ago";
  6590.                 class9.message = "You last logged in " + s + " from: "
  6591.                         + signlink.dns;
  6592.             } else {
  6593.                 class9.message = "";
  6594.             }
  6595.         if (j == 651) {
  6596.             if (unreadMessages == 0) {
  6597.                 class9.message = "0 unread messages";
  6598.                 class9.textColor = 0xffff00;
  6599.             }
  6600.             if (unreadMessages == 1) {
  6601.                 class9.message = "1 unread message";
  6602.                 class9.textColor = 65280;
  6603.             }
  6604.             if (unreadMessages > 1) {
  6605.                 class9.message = unreadMessages + " unread messages";
  6606.                 class9.textColor = 65280;
  6607.             }
  6608.         }
  6609.         if (j == 652)
  6610.             if (daysSinceRecovChange == 201) {
  6611.                 if (membersInt == 1)
  6612.                     class9.message = "@yel@This is a non-members world: @whi@Since you are a member we";
  6613.                 else
  6614.                     class9.message = "";
  6615.             } else if (daysSinceRecovChange == 200) {
  6616.                 class9.message = "You have not yet set any password recovery questions.";
  6617.             } else {
  6618.                 String s1;
  6619.                 if (daysSinceRecovChange == 0)
  6620.                     s1 = "Earlier today";
  6621.                 else if (daysSinceRecovChange == 1)
  6622.                     s1 = "Yesterday";
  6623.                 else
  6624.                     s1 = daysSinceRecovChange + " days ago";
  6625.                 class9.message = s1 + " you changed your recovery questions";
  6626.             }
  6627.         if (j == 653)
  6628.             if (daysSinceRecovChange == 201) {
  6629.                 if (membersInt == 1)
  6630.                     class9.message = "@whi@recommend you use a members world instead. You may use";
  6631.                 else
  6632.                     class9.message = "";
  6633.             } else if (daysSinceRecovChange == 200)
  6634.                 class9.message = "We strongly recommend you do so now to secure your account.";
  6635.             else
  6636.                 class9.message = "If you do not remember making this change then cancel it immediately";
  6637.         if (j == 654) {
  6638.             if (daysSinceRecovChange == 201)
  6639.                 if (membersInt == 1) {
  6640.                     class9.message = "@whi@this world but member benefits are unavailable whilst here.";
  6641.                     return;
  6642.                 } else {
  6643.                     class9.message = "";
  6644.                     return;
  6645.                 }
  6646.             if (daysSinceRecovChange == 200) {
  6647.                 class9.message = "Do this from the 'account management' area on our front webpage";
  6648.                 return;
  6649.             }
  6650.             class9.message = "Do this from the 'account management' area on our front webpage";
  6651.         }
  6652.     }
  6653.  
  6654.     private void drawSplitPrivateChat() {
  6655.         if (splitPrivateChat == 0)
  6656.             return;
  6657.         TextDrawingArea textDrawingArea = aTextDrawingArea_1271;
  6658.         int i = 0;
  6659.         if (anInt1104 != 0)
  6660.             i = 1;
  6661.         for (int j = 0; j < 100; j++)
  6662.             if (chatMessages[j] != null) {
  6663.                 int k = chatTypes[j];
  6664.                 String s = chatNames[j];
  6665.                 byte byte1 = 0;
  6666.                 if (s != null && s.startsWith("@cr1@")) {
  6667.                     s = s.substring(5);
  6668.                     byte1 = 1;
  6669.                 }
  6670.                 if (s != null && s.startsWith("@cr2@")) {
  6671.                     s = s.substring(5);
  6672.                     byte1 = 2;
  6673.                 }
  6674.                 if (s != null && s.startsWith("@cr3@")) {
  6675.                     s = s.substring(5);
  6676.                     byte1 = 3;
  6677.                 }
  6678.                 if (s != null && s.startsWith("@cr4@")) {
  6679.                     s = s.substring(5);
  6680.                     byte1 = 4;
  6681.                 }
  6682.                 if (s != null && s.startsWith("@cr5@")) {
  6683.                     s = s.substring(5);
  6684.                     byte1 = 5;
  6685.                 }
  6686.                 if (s != null && s.startsWith("@cr6@")) {
  6687.                     s = s.substring(5);
  6688.                     byte1 = 6;
  6689.                 }
  6690.                 if (s != null && s.startsWith("@cr7@")) {
  6691.                     s = s.substring(5);
  6692.                     byte1 = 7;
  6693.                 }
  6694.                 if (s != null && s.startsWith("@cr8@")) {
  6695.                     s = s.substring(5);
  6696.                     byte1 = 8;
  6697.                 }
  6698.  
  6699.                 if ((k == 3 || k == 7)
  6700.                         && (k == 7 || privateChatMode == 0 || privateChatMode == 1
  6701.                                 && isFriendOrSelf(s))) {
  6702.                     int l = 329 - i * 13;
  6703.                     int k1 = 4;
  6704.                     textDrawingArea.method385(0, "From", l, k1);
  6705.                     textDrawingArea.method385(65535, "From", l - 1, k1);
  6706.                     if (byte1 == 3 || byte1 == 2 || byte1 == 1 || byte1 == 0) {
  6707.                         k1 += textDrawingArea.getTextWidth("From ");
  6708.                     } else if (byte1 == 9 || byte1 == 8 || byte1 == 7
  6709.                             || byte1 == 6 || byte1 == 5 || byte1 == 4) {
  6710.                         k1 += textDrawingArea.getTextWidth("From ");
  6711.                     }
  6712.                     if (byte1 == 1) {
  6713.                         modIcons[0].drawSprite(k1 - 2, l - 12);
  6714.                         k1 += 12;
  6715.                     }
  6716.                     if (byte1 == 2) {
  6717.                         modIcons[1].drawSprite(k1 - 2, l - 12);
  6718.                         k1 += 12;
  6719.                     }
  6720.                     if (byte1 == 3) {
  6721.                         modIcons[2].drawSprite(k1 - 2, l - 12);
  6722.                         k1 += 12;
  6723.                     }
  6724.                     if (byte1 == 4) {
  6725.                         modIcons[3].drawSprite(k1 - 1, l - 11);
  6726.                         k1 += 12;
  6727.                     }
  6728.                     if (byte1 == 5) {
  6729.                         modIcons[4].drawSprite(k1 - 1, l - 11);
  6730.                         k1 += 12;
  6731.                     }
  6732.                     if (byte1 == 6) {
  6733.                         modIcons[5].drawSprite(k1 - 2, l - 11);
  6734.                         k1 += 12;
  6735.                     }
  6736.                     if (byte1 == 7) {
  6737.                         modIcons[6].drawSprite(k1 - 2, l - 12);
  6738.                         k1 += 12;
  6739.                     }
  6740.                     if (byte1 == 8) {
  6741.                         modIcons[7].drawSprite(k1 - 2, l - 12);
  6742.                         k1 += 12;
  6743.                     }
  6744.                     // if (byte1 == 9) {
  6745.                     // modIcons[8].drawSprite(k1 - 2, l - 12);
  6746.                     // k1 += 12;
  6747.                     // }
  6748.                     textDrawingArea.method385(0, s + ": " + chatMessages[j], l,
  6749.                             k1);
  6750.                     textDrawingArea.method385(65535,
  6751.                             s + ": " + chatMessages[j], l - 1, k1);
  6752.                     if (++i >= 5)
  6753.                         return;
  6754.                 }
  6755.                 if (k == 5 && privateChatMode < 2) {
  6756.                     int i1 = 329 - i * 13;
  6757.                     textDrawingArea.method385(0, chatMessages[j], i1, 4);
  6758.                     textDrawingArea
  6759.                             .method385(65535, chatMessages[j], i1 - 1, 4);
  6760.                     if (++i >= 5)
  6761.                         return;
  6762.                 }
  6763.                 if (k == 6 && privateChatMode < 2) {
  6764.                     int j1 = 329 - i * 13;
  6765.                     textDrawingArea.method385(0, "To " + s + ": "
  6766.                             + chatMessages[j], j1, 4);
  6767.                     textDrawingArea.method385(65535, "To " + s + ": "
  6768.                             + chatMessages[j], j1 - 1, 4);
  6769.                     if (++i >= 5)
  6770.                         return;
  6771.                 }
  6772.             }
  6773.  
  6774.     }
  6775.  
  6776.     public void pushMessage(String s, int i, String s1) {
  6777.         if (i == 0 && dialogID != -1) {
  6778.             aString844 = s;
  6779.             super.clickMode3 = 0;
  6780.         }
  6781.         if (backDialogID == -1)
  6782.             inputTaken = true;
  6783.         for (int j = 499; j > 0; j--) {
  6784.             chatTypes[j] = chatTypes[j - 1];
  6785.             chatNames[j] = chatNames[j - 1];
  6786.             chatMessages[j] = chatMessages[j - 1];
  6787.             chatRights[j] = chatRights[j - 1];
  6788.             clanTitles[j] = clanTitles[j - 1];
  6789.         }
  6790.         chatTypes[0] = i;
  6791.         chatNames[0] = s1;
  6792.         chatMessages[0] = s;
  6793.         chatRights[0] = channelRights;
  6794.         clanTitles[0] = clanTitle;
  6795.     }
  6796.  
  6797.     public void setNorth() {
  6798.         cameraOffsetX = 0;
  6799.         cameraOffsetY = 0;
  6800.         viewRotationOffset = 0;
  6801.         viewRotation = 0;
  6802.         minimapRotation = 0;
  6803.         minimapZoom = 0;
  6804.     }
  6805.  
  6806.     public void processTabClick() {
  6807.         if (super.clickMode3 == 1) {
  6808.             if (super.saveClickX >= 524 && super.saveClickX <= 561
  6809.                     && super.saveClickY >= 169 && super.saveClickY < 205
  6810.                     && tabInterfaceIDs[0] != -1) {
  6811.                 needDrawTabArea = true;
  6812.                 tabID = 0;
  6813.                 tabAreaAltered = true;
  6814.             }
  6815.             if (super.saveClickX >= 562 && super.saveClickX <= 594
  6816.                     && super.saveClickY >= 168 && super.saveClickY < 205
  6817.                     && tabInterfaceIDs[1] != -1) {
  6818.                 needDrawTabArea = true;
  6819.                 tabID = 1;
  6820.                 tabAreaAltered = true;
  6821.             }
  6822.             if (super.saveClickX >= 595 && super.saveClickX <= 626
  6823.                     && super.saveClickY >= 168 && super.saveClickY < 205
  6824.                     && tabInterfaceIDs[2] != -1) {
  6825.                 needDrawTabArea = true;
  6826.                 tabID = 2;
  6827.                 tabAreaAltered = true;
  6828.             }
  6829.             if (super.saveClickX >= 627 && super.saveClickX <= 660
  6830.                     && super.saveClickY >= 168 && super.saveClickY < 203
  6831.                     && tabInterfaceIDs[3] != -1) {
  6832.                 needDrawTabArea = true;
  6833.                 tabID = 3;
  6834.                 tabAreaAltered = true;
  6835.             }
  6836.             if (super.saveClickX >= 661 && super.saveClickX <= 693
  6837.                     && super.saveClickY >= 168 && super.saveClickY < 205
  6838.                     && tabInterfaceIDs[4] != -1) {
  6839.                 needDrawTabArea = true;
  6840.                 tabID = 4;
  6841.                 tabAreaAltered = true;
  6842.             }
  6843.             if (super.saveClickX >= 694 && super.saveClickX <= 725
  6844.                     && super.saveClickY >= 168 && super.saveClickY < 205
  6845.                     && tabInterfaceIDs[5] != -1) {
  6846.                 needDrawTabArea = true;
  6847.                 tabID = 5;
  6848.                 tabAreaAltered = true;
  6849.             }
  6850.             if (super.saveClickX >= 726 && super.saveClickX <= 765
  6851.                     && super.saveClickY >= 169 && super.saveClickY < 205
  6852.                     && tabInterfaceIDs[6] != -1) {
  6853.                 needDrawTabArea = true;
  6854.                 tabID = 6;
  6855.                 tabAreaAltered = true;
  6856.             }
  6857.             if (super.saveClickX >= 524 && super.saveClickX <= 561
  6858.                     && super.saveClickY >= 466 && super.saveClickY < 503
  6859.                     && tabInterfaceIDs[7] != -1) {
  6860.                 needDrawTabArea = true;
  6861.                 tabID = 7;
  6862.                 tabAreaAltered = true;
  6863.             }
  6864.             if (super.saveClickX >= 562 && super.saveClickX <= 594
  6865.                     && super.saveClickY >= 466 && super.saveClickY < 503
  6866.                     && tabInterfaceIDs[8] != -1) {
  6867.                 needDrawTabArea = true;
  6868.                 tabID = 8;
  6869.                 tabAreaAltered = true;
  6870.             }
  6871.             if (super.saveClickX >= 595 && super.saveClickX <= 627
  6872.                     && super.saveClickY >= 466 && super.saveClickY < 503
  6873.                     && tabInterfaceIDs[9] != -1) {
  6874.                 needDrawTabArea = true;
  6875.                 tabID = 9;
  6876.                 tabAreaAltered = true;
  6877.             }
  6878.             if (super.saveClickX >= 627 && super.saveClickX <= 664
  6879.                     && super.saveClickY >= 466 && super.saveClickY < 503
  6880.                     && tabInterfaceIDs[10] != -1) {
  6881.                 needDrawTabArea = true;
  6882.                 tabID = 10;
  6883.                 tabAreaAltered = true;
  6884.             }
  6885.             if (super.saveClickX >= 661 && super.saveClickX <= 694
  6886.                     && super.saveClickY >= 466 && super.saveClickY < 503
  6887.                     && tabInterfaceIDs[11] != -1) {
  6888.                 needDrawTabArea = true;
  6889.                 tabID = 11;
  6890.                 tabAreaAltered = true;
  6891.             }
  6892.             if (super.saveClickX >= 695 && super.saveClickX <= 725
  6893.                     && super.saveClickY >= 466 && super.saveClickY < 503
  6894.                     && tabInterfaceIDs[12] != -1) {
  6895.                 needDrawTabArea = true;
  6896.                 tabID = 12;
  6897.                 tabAreaAltered = true;
  6898.             }
  6899.             if (super.saveClickX >= 726 && super.saveClickX <= 765
  6900.                     && super.saveClickY >= 466 && super.saveClickY < 502
  6901.                     && tabInterfaceIDs[13] != -1) {
  6902.                 needDrawTabArea = true;
  6903.                 tabID = 13;
  6904.                 tabAreaAltered = true;
  6905.             }
  6906.         }
  6907.     }
  6908.  
  6909.     private void resetImageProducers2() {
  6910.         if (aRSImageProducer_1166 != null)
  6911.             return;
  6912.         nullLoader();
  6913.         super.fullGameScreen = null;
  6914.         aRSImageProducer_1107 = null;
  6915.         aRSImageProducer_1108 = null;
  6916.         aRSImageProducer_1109 = null;
  6917.         aRSImageProducer_1110 = null;
  6918.         aRSImageProducer_1111 = null;
  6919.         aRSImageProducer_1112 = null;
  6920.         aRSImageProducer_1113 = null;
  6921.         aRSImageProducer_1114 = null;
  6922.         aRSImageProducer_1115 = null;
  6923.         aRSImageProducer_1166 = new RSImageProducer(519, 165,
  6924.                 getGameComponent());
  6925.         aRSImageProducer_1164 = new RSImageProducer(246, 168,
  6926.                 getGameComponent());
  6927.         DrawingArea.setAllPixelsToZero();
  6928.         if (revision508 == true) {
  6929.             mapArea508.drawSprite(0, 0);
  6930.         }
  6931.         if (revision474 == true) {
  6932.             mapArea474.drawSprite(0, 0);
  6933.         }
  6934.         if (revision498 == true) {
  6935.             mapArea.drawSprite(0, 0);
  6936.         }
  6937.         aRSImageProducer_1163 = new RSImageProducer(246, 335,
  6938.                 getGameComponent());
  6939.         aRSImageProducer_1165 = new RSImageProducer(512, 334,
  6940.                 getGameComponent());
  6941.         DrawingArea.setAllPixelsToZero();
  6942.         new RSImageProducer(496, 50, getGameComponent());
  6943.         new RSImageProducer(269, 37, getGameComponent());
  6944.         aRSImageProducer_1125 = new RSImageProducer(249, 45, getGameComponent());
  6945.         welcomeScreenRaised = true;
  6946.     }
  6947.  
  6948.     public String getDocumentBaseHost() {
  6949.         if (signlink.mainapp != null) {
  6950.             return signlink.mainapp.getDocumentBase().getHost().toLowerCase();
  6951.         }
  6952.         if (super.gameFrame != null) {
  6953.             return "";
  6954.         } else {
  6955.             return "";
  6956.         }
  6957.     }
  6958.  
  6959.     private void method81(Sprite sprite, int j, int k) {
  6960.         int l = k * k + j * j;
  6961.         if (l > 4225 && l < 0x15f90) {
  6962.             int i1 = viewRotation + minimapRotation & 0x7ff;
  6963.             int j1 = Model.modelIntArray1[i1];
  6964.             int k1 = Model.modelIntArray2[i1];
  6965.             j1 = (j1 * 256) / (minimapZoom + 256);
  6966.             k1 = (k1 * 256) / (minimapZoom + 256);
  6967.             int l1 = j * j1 + k * k1 >> 16;
  6968.             int i2 = j * k1 - k * j1 >> 16;
  6969.             double d = Math.atan2(l1, i2);
  6970.             int j2 = (int) (Math.sin(d) * 63D);
  6971.             int k2 = (int) (Math.cos(d) * 57D);
  6972.             mapEdge.method353(83 - k2 - 20, d, (94 + j2 + 4) - 10);
  6973.         } else {
  6974.             markMinimap(sprite, k, j);
  6975.         }
  6976.     }
  6977.  
  6978.     public void rightClickChatButtons() {
  6979.         if (super.mouseX >= 5 && super.mouseX <= 61 && super.mouseY >= 482
  6980.                 && super.mouseY <= 503) {
  6981.             menuActionName[1] = "View All";
  6982.             menuActionID[1] = 999;
  6983.             menuActionRow = 2;
  6984.         } else if (super.mouseX >= 71 && super.mouseX <= 127
  6985.                 && super.mouseY >= 482 && super.mouseY <= 503) {
  6986.             menuActionName[1] = "View Game";
  6987.             menuActionID[1] = 998;
  6988.             menuActionRow = 2;
  6989.         } else if (super.mouseX >= 137 && super.mouseX <= 193
  6990.                 && super.mouseY >= 482 && super.mouseY <= 503) {
  6991.             menuActionName[1] = "Hide public";
  6992.             menuActionID[1] = 997;
  6993.             menuActionName[2] = "Off public";
  6994.             menuActionID[2] = 996;
  6995.             menuActionName[3] = "Friends public";
  6996.             menuActionID[3] = 995;
  6997.             menuActionName[4] = "On public";
  6998.             menuActionID[4] = 994;
  6999.             menuActionName[5] = "View public";
  7000.             menuActionID[5] = 993;
  7001.             menuActionRow = 6;
  7002.         } else if (super.mouseX >= 203 && super.mouseX <= 259
  7003.                 && super.mouseY >= 482 && super.mouseY <= 503) {
  7004.             menuActionName[1] = "Off private";
  7005.             menuActionID[1] = 992;
  7006.             menuActionName[2] = "Friends private";
  7007.             menuActionID[2] = 991;
  7008.             menuActionName[3] = "On private";
  7009.             menuActionID[3] = 990;
  7010.             menuActionName[4] = "View private";
  7011.             menuActionID[4] = 989;
  7012.             menuActionRow = 5;
  7013.         } else if (super.mouseX >= 269 && super.mouseX <= 325
  7014.                 && super.mouseY >= 482 && super.mouseY <= 503) {
  7015.             menuActionName[1] = "Off clan chat";
  7016.             menuActionID[1] = 1003;
  7017.             menuActionName[2] = "Friends clan chat";
  7018.             menuActionID[2] = 1002;
  7019.             menuActionName[3] = "On clan chat";
  7020.             menuActionID[3] = 1001;
  7021.             menuActionName[4] = "View clan chat";
  7022.             menuActionID[4] = 1000;
  7023.             menuActionRow = 5;
  7024.         } else if (super.mouseX >= 335 && super.mouseX <= 391
  7025.                 && super.mouseY >= 482 && super.mouseY <= 503) {
  7026.             menuActionName[1] = "Off trade";
  7027.             menuActionID[1] = 987;
  7028.             menuActionName[2] = "Friends trade";
  7029.             menuActionID[2] = 986;
  7030.             menuActionName[3] = "On trade";
  7031.             menuActionID[3] = 985;
  7032.             menuActionName[4] = "View trade";
  7033.             menuActionID[4] = 984;
  7034.             menuActionRow = 5;
  7035.         }
  7036.     }
  7037.  
  7038.     public void processRightClick() {
  7039.         if (activeInterfaceType != 0) {
  7040.             return;
  7041.         }
  7042.         menuActionName[0] = "Cancel";
  7043.         menuActionID[0] = 1107;
  7044.         menuActionRow = 1;
  7045.         if (fullscreenInterfaceID != -1) {
  7046.             anInt886 = 0;
  7047.             anInt1315 = 0;
  7048.             buildInterfaceMenu(8,
  7049.                     RSInterface.interfaceCache[fullscreenInterfaceID],
  7050.                     super.mouseX, 8, super.mouseY, 0);
  7051.             if (anInt886 != anInt1026) {
  7052.                 anInt1026 = anInt886;
  7053.             }
  7054.             if (anInt1315 != anInt1129) {
  7055.                 anInt1129 = anInt1315;
  7056.             }
  7057.             return;
  7058.         }
  7059.         buildSplitPrivateChatMenu();
  7060.         anInt886 = 0;
  7061.         anInt1315 = 0;
  7062.         if (super.mouseX > 0 && super.mouseY > 0 && super.mouseX < 516
  7063.                 && super.mouseY < 338) {
  7064.             if (openInterfaceID != -1) {
  7065.                 buildInterfaceMenu(4,
  7066.                         RSInterface.interfaceCache[openInterfaceID],
  7067.                         super.mouseX, 4, super.mouseY, 0);
  7068.             } else {
  7069.                 build3dScreenMenu();
  7070.             }
  7071.         }
  7072.         if (anInt886 != anInt1026) {
  7073.             anInt1026 = anInt886;
  7074.         }
  7075.         if (anInt1315 != anInt1129) {
  7076.             anInt1129 = anInt1315;
  7077.         }
  7078.         anInt886 = 0;
  7079.         anInt1315 = 0;
  7080.         if (super.mouseX > 548 && super.mouseY > 207 && super.mouseX < 740
  7081.                 && super.mouseY < 468) {
  7082.             if (invOverlayInterfaceID != -1) {
  7083.                 buildInterfaceMenu(548,
  7084.                         RSInterface.interfaceCache[invOverlayInterfaceID],
  7085.                         super.mouseX, 207, super.mouseY, 0);
  7086.             } else if (tabInterfaceIDs[tabID] != -1) {
  7087.                 buildInterfaceMenu(548,
  7088.                         RSInterface.interfaceCache[tabInterfaceIDs[tabID]],
  7089.                         super.mouseX, 207, super.mouseY, 0);
  7090.             }
  7091.         }
  7092.         if (anInt886 != anInt1048) {
  7093.             needDrawTabArea = true;
  7094.             tabAreaAltered = true;
  7095.             anInt1048 = anInt886;
  7096.         }
  7097.         if (anInt1315 != anInt1044) {
  7098.             needDrawTabArea = true;
  7099.             tabAreaAltered = true;
  7100.             anInt1044 = anInt1315;
  7101.         }
  7102.         anInt886 = 0;
  7103.         anInt1315 = 0;
  7104.         if (super.mouseX > 0 && super.mouseY > 338 && super.mouseX < 490
  7105.                 && super.mouseY < 463) {
  7106.             if (backDialogID != -1) {
  7107.                 buildInterfaceMenu(20,
  7108.                         RSInterface.interfaceCache[backDialogID], super.mouseX,
  7109.                         358, super.mouseY, 0);
  7110.             } else if (super.mouseY < 463 && super.mouseX < 490) {
  7111.                 buildChatAreaMenu(super.mouseY - 338);
  7112.             }
  7113.         }
  7114.         if (backDialogID != -1 && anInt886 != anInt1039) {
  7115.             inputTaken = true;
  7116.             anInt1039 = anInt886;
  7117.         }
  7118.         if (backDialogID != -1 && anInt1315 != anInt1500) {
  7119.             inputTaken = true;
  7120.             anInt1500 = anInt1315;
  7121.         }
  7122.         /* Enable custom right click areas */
  7123.         if (super.mouseX > 4 && super.mouseY > 480 && super.mouseX < 516
  7124.                 && super.mouseY < 503)
  7125.             rightClickChatButtons();
  7126.         /**/
  7127.     //  processXPCounterClick();
  7128.         processMinimapActions();
  7129.         boolean flag = false;
  7130.         while (!flag) {
  7131.             flag = true;
  7132.             for (int j = 0; j < menuActionRow - 1; j++) {
  7133.                 if (menuActionID[j] < 1000 && menuActionID[j + 1] > 1000) {
  7134.                     String s = menuActionName[j];
  7135.                     menuActionName[j] = menuActionName[j + 1];
  7136.                     menuActionName[j + 1] = s;
  7137.                     int k = menuActionID[j];
  7138.                     menuActionID[j] = menuActionID[j + 1];
  7139.                     menuActionID[j + 1] = k;
  7140.                     k = menuActionCmd2[j];
  7141.                     menuActionCmd2[j] = menuActionCmd2[j + 1];
  7142.                     menuActionCmd2[j + 1] = k;
  7143.                     k = menuActionCmd3[j];
  7144.                     menuActionCmd3[j] = menuActionCmd3[j + 1];
  7145.                     menuActionCmd3[j + 1] = k;
  7146.                     k = menuActionCmd1[j];
  7147.                     menuActionCmd1[j] = menuActionCmd1[j + 1];
  7148.                     menuActionCmd1[j + 1] = k;
  7149.                     flag = false;
  7150.                 }
  7151.             }
  7152.         }
  7153.     }
  7154.  
  7155.     private int method83(int i, int j, int k) {
  7156.         int l = 256 - k;
  7157.         return ((i & 0xff00ff) * l + (j & 0xff00ff) * k & 0xff00ff00)
  7158.                 + ((i & 0xff00) * l + (j & 0xff00) * k & 0xff0000) >> 8;
  7159.     }
  7160.  
  7161.     public void login(String s, String s1, boolean flag) {
  7162.         signlink.errorname = s;
  7163.         try {
  7164.             if (!flag) {
  7165.                 loginMessage1 = "";
  7166.                 loginMessage2 = "Connecting to server...";
  7167.                 drawLoginScreen(true);
  7168.             }
  7169.             socketStream = new RSSocket(this, openSocket(43594 + portOff));
  7170.             long l = TextClass.longForName(s);
  7171.             int i = (int) (l >> 16 & 31L);
  7172.             stream.currentOffset = 0;
  7173.             stream.writeWordBigEndian(14);
  7174.             stream.writeWordBigEndian(i);
  7175.             socketStream.queueBytes(2, stream.buffer);
  7176.             for (int j = 0; j < 8; j++)
  7177.                 socketStream.read();
  7178.  
  7179.             int k = socketStream.read();
  7180.             int i1 = k;
  7181.             if (k == 0) {
  7182.                 socketStream.flushInputStream(inStream.buffer, 8);
  7183.                 inStream.currentOffset = 0;
  7184.                 aLong1215 = inStream.readQWord();
  7185.                 int ai[] = new int[4];
  7186.                 ai[0] = (int) (Math.random() * 99999999D);
  7187.                 ai[1] = (int) (Math.random() * 99999999D);
  7188.                 ai[2] = (int) (aLong1215 >> 32);
  7189.                 ai[3] = (int) aLong1215;
  7190.                 stream.currentOffset = 0;
  7191.                 stream.writeWordBigEndian(10);
  7192.                 stream.writeDWord(ai[0]);
  7193.                 stream.writeDWord(ai[1]);
  7194.                 stream.writeDWord(ai[2]);
  7195.                 stream.writeDWord(ai[3]);
  7196.                 stream.writeDWord(signlink.uid);
  7197.                 // stream.writeString(CreateUID.generateUID());
  7198.                 stream.writeString(s);
  7199.                 stream.writeString(s1);
  7200.                 stream.doKeys();
  7201.                 aStream_847.currentOffset = 0;
  7202.                 if (flag)
  7203.                     aStream_847.writeWordBigEndian(18);
  7204.                 else
  7205.                     aStream_847.writeWordBigEndian(16);
  7206.                 aStream_847.writeWordBigEndian(stream.currentOffset + 36 + 1
  7207.                         + 1 + 2);
  7208.                 aStream_847.writeWordBigEndian(255);
  7209.                 aStream_847.writeWord(317);
  7210.                 aStream_847.writeWordBigEndian(lowMem ? 1 : 0);
  7211.                 for (int l1 = 0; l1 < 9; l1++)
  7212.                     aStream_847.writeDWord(expectedCRCs[l1]);
  7213.  
  7214.                 aStream_847.writeBytes(stream.buffer, stream.currentOffset, 0);
  7215.                 stream.encryption = new ISAACRandomGen(ai);
  7216.                 for (int j2 = 0; j2 < 4; j2++)
  7217.                     ai[j2] += 50;
  7218.  
  7219.                 encryption = new ISAACRandomGen(ai);
  7220.                 socketStream.queueBytes(aStream_847.currentOffset,
  7221.                         aStream_847.buffer);
  7222.                 k = socketStream.read();
  7223.             }
  7224.             if (k == 1) {
  7225.                 try {
  7226.                     Thread.sleep(2000L);
  7227.                 } catch (Exception _ex) {
  7228.                 }
  7229.                 login(s, s1, flag);
  7230.                 return;
  7231.             }
  7232.             if (k == 2) {
  7233.                 myPrivilege = socketStream.read();
  7234.                 flagged = socketStream.read() == 1;
  7235.                 aLong1220 = 0L;
  7236.                 anInt1022 = 0;
  7237.                 mouseDetection.coordsIndex = 0;
  7238.                 super.awtFocus = true;
  7239.                 aBoolean954 = true;
  7240.                 loggedIn = true;
  7241.                 stream.currentOffset = 0;
  7242.                 inStream.currentOffset = 0;
  7243.                 pktType = -1;
  7244.                 anInt841 = -1;
  7245.                 anInt842 = -1;
  7246.                 anInt843 = -1;
  7247.                 pktSize = 0;
  7248.                 anInt1009 = 0;
  7249.                 anInt1104 = 0;
  7250.                 anInt1011 = 0;
  7251.                 anInt855 = 0;
  7252.                 menuActionRow = 0;
  7253.                 menuOpen = false;
  7254.                 super.idleTime = 0;
  7255.                 for (int j1 = 0; j1 < 500; j1++)
  7256.                     chatMessages[j1] = null;
  7257.  
  7258.                 itemSelected = 0;
  7259.                 spellSelected = 0;
  7260.                 loadingStage = 0;
  7261.                 anInt1062 = 0;
  7262.                 setNorth();
  7263.                 anInt1021 = 0;
  7264.                 anInt985 = -1;
  7265.                 destX = 0;
  7266.                 destY = 0;
  7267.                 playerCount = 0;
  7268.                 npcCount = 0;
  7269.                 for (int i2 = 0; i2 < maxPlayers; i2++) {
  7270.                     playerArray[i2] = null;
  7271.                     aStreamArray895s[i2] = null;
  7272.                 }
  7273.  
  7274.                 for (int k2 = 0; k2 < 16384; k2++)
  7275.                     npcArray[k2] = null;
  7276.  
  7277.                 myPlayer = playerArray[myPlayerIndex] = new Player();
  7278.                 aClass19_1013.removeAll();
  7279.                 aClass19_1056.removeAll();
  7280.                 for (int l2 = 0; l2 < 4; l2++) {
  7281.                     for (int i3 = 0; i3 < 104; i3++) {
  7282.                         for (int k3 = 0; k3 < 104; k3++)
  7283.                             groundArray[l2][i3][k3] = null;
  7284.  
  7285.                     }
  7286.  
  7287.                 }
  7288.  
  7289.                 aClass19_1179 = new NodeList();
  7290.                 fullscreenInterfaceID = -1;
  7291.                 anInt900 = 0;
  7292.                 friendsCount = 0;
  7293.                 dialogID = -1;
  7294.                 backDialogID = -1;
  7295.                 openInterfaceID = -1;
  7296.                 invOverlayInterfaceID = -1;
  7297.                 anInt1018 = -1;
  7298.                 aBoolean1149 = false;
  7299.                 tabID = 3;
  7300.                 inputDialogState = 0;
  7301.                 menuOpen = false;
  7302.                 messagePromptRaised = false;
  7303.                 aString844 = null;
  7304.                 anInt1055 = 0;
  7305.                 anInt1054 = -1;
  7306.                 aBoolean1047 = true;
  7307.                 method45();
  7308.                 for (int j3 = 0; j3 < 5; j3++)
  7309.                     anIntArray990[j3] = 0;
  7310.  
  7311.                 for (int l3 = 0; l3 < 5; l3++) {
  7312.                     atPlayerActions[l3] = null;
  7313.                     atPlayerArray[l3] = false;
  7314.                 }
  7315.  
  7316.                 anInt1175 = 0;
  7317.                 anInt1134 = 0;
  7318.                 anInt986 = 0;
  7319.                 anInt1288 = 0;
  7320.                 anInt924 = 0;
  7321.                 anInt1188 = 0;
  7322.                 anInt1155 = 0;
  7323.                 anInt1226 = 0;
  7324.                 resetImageProducers2();
  7325.                 return;
  7326.             }
  7327.             if (k == 3) {
  7328.                 loginMessage1 = "";
  7329.                 loginMessage2 = "Invalid username or password.";
  7330.                 return;
  7331.             }
  7332.             if (k == 4) {
  7333.                 loginMessage1 = "Your account has been disabled.";
  7334.                 loginMessage2 = "Please check your message-center for details.";
  7335.                 return;
  7336.             }
  7337.             if (k == 5) {
  7338.                 loginMessage1 = "Your account is already logged in.";
  7339.                 loginMessage2 = "Try again in 60 secs...";
  7340.                 return;
  7341.             }
  7342.             if (k == 6) {
  7343.                 loginMessage1 = "Project-OS has been updated!";
  7344.                 loginMessage2 = "Please reload this page.";
  7345.                 return;
  7346.             }
  7347.             if (k == 7) {
  7348.                 loginMessage1 = "This world is full.";
  7349.                 loginMessage2 = "Please use a different world.";
  7350.                 return;
  7351.             }
  7352.             if (k == 8) {
  7353.                 loginMessage1 = "Unable to connect.";
  7354.                 loginMessage2 = "Login server offline.";
  7355.                 return;
  7356.             }
  7357.             if (k == 9) {
  7358.                 loginMessage1 = "Login limit exceeded.";
  7359.                 loginMessage2 = "Too many connections from your address.";
  7360.                 return;
  7361.             }
  7362.             if (k == 10) {
  7363.                 loginMessage1 = "Unable to connect.";
  7364.                 loginMessage2 = "Bad session id.";
  7365.                 return;
  7366.             }
  7367.             if (k == 11) {
  7368.                 loginMessage2 = "Login server rejected session.";
  7369.                 loginMessage2 = "Please try again.";
  7370.                 return;
  7371.             }
  7372.             if (k == 12) {
  7373.                 loginMessage1 = "You need a members account to login to this world.";
  7374.                 loginMessage2 = "Please subscribe, or use a different world.";
  7375.                 return;
  7376.             }
  7377.             if (k == 13) {
  7378.                 loginMessage1 = "Could not complete login.";
  7379.                 loginMessage2 = "Please try using a different world.";
  7380.                 return;
  7381.             }
  7382.             if (k == 14) {
  7383.                 loginMessage1 = "The server is being updated.";
  7384.                 loginMessage2 = "Please wait 1 minute and try again.";
  7385.                 return;
  7386.             }
  7387.             if (k == 15) {
  7388.                 loggedIn = true;
  7389.                 stream.currentOffset = 0;
  7390.                 inStream.currentOffset = 0;
  7391.                 pktType = -1;
  7392.                 anInt841 = -1;
  7393.                 anInt842 = -1;
  7394.                 anInt843 = -1;
  7395.                 pktSize = 0;
  7396.                 anInt1009 = 0;
  7397.                 anInt1104 = 0;
  7398.                 menuActionRow = 0;
  7399.                 menuOpen = false;
  7400.                 aLong824 = System.currentTimeMillis();
  7401.                 return;
  7402.             }
  7403.             if (k == 16) {
  7404.                 loginMessage1 = "Login attempts exceeded.";
  7405.                 loginMessage2 = "Please wait 1 minute and try again.";
  7406.                 return;
  7407.             }
  7408.             if (k == 17) {
  7409.                 loginMessage1 = "You are standing in a members-only area.";
  7410.                 loginMessage2 = "To play on this world move to a free area first";
  7411.                 return;
  7412.             }
  7413.             if (k == 20) {
  7414.                 loginMessage1 = "Invalid loginserver requested";
  7415.                 loginMessage2 = "Please try using a different world.";
  7416.                 return;
  7417.             }
  7418.             if (k == 22) {
  7419.                 loginMessage1 = "Your computer has been UUID banned.";
  7420.                 loginMessage2 = "Please appeal on the forums.";
  7421.                 return;
  7422.             }
  7423.             if (k == 22) {
  7424.                 loginMessage1 = "Your computer has been UUID banned.";
  7425.                 loginMessage2 = "Please appeal on the forums.";
  7426.                 return;
  7427.             }
  7428.             if (k == -1) {
  7429.                 if (i1 == 0) {
  7430.                     if (loginFailures < 2) {
  7431.                         try {
  7432.                             Thread.sleep(2000L);
  7433.                         } catch (Exception _ex) {
  7434.                         }
  7435.                         loginFailures++;
  7436.                         login(s, s1, flag);
  7437.                         return;
  7438.                     } else {
  7439.                         loginMessage1 = "No response from loginserver";
  7440.                         loginMessage2 = "Please wait 1 minute and try again.";
  7441.                         return;
  7442.                     }
  7443.                 } else {
  7444.                     loginMessage1 = "No response from server";
  7445.                     loginMessage2 = "Please try using a different world.";
  7446.                     return;
  7447.                 }
  7448.             } else {
  7449.                 System.out.println("response:" + k);
  7450.                 loginMessage1 = "Unexpected server response";
  7451.                 loginMessage2 = "Please try using a different world.";
  7452.                 return;
  7453.             }
  7454.         } catch (IOException _ex) {
  7455.             loginMessage1 = "";
  7456.         } catch (Exception e) {
  7457.             System.out.println("Error while generating uid. Skipping step.");
  7458.             e.printStackTrace();
  7459.         }
  7460.         loginMessage2 = "Error connecting to server.";
  7461.     }
  7462.  
  7463.     private boolean doWalkTo(int i, int j, int k, int i1, int j1, int k1,
  7464.             int l1, int i2, int j2, boolean flag, int k2) {
  7465.         byte byte0 = 104;
  7466.         byte byte1 = 104;
  7467.         for (int l2 = 0; l2 < byte0; l2++) {
  7468.             for (int i3 = 0; i3 < byte1; i3++) {
  7469.                 anIntArrayArray901[l2][i3] = 0;
  7470.                 anIntArrayArray825[l2][i3] = 0x5f5e0ff;
  7471.             }
  7472.         }
  7473.         int j3 = j2;
  7474.         int k3 = j1;
  7475.         anIntArrayArray901[j2][j1] = 99;
  7476.         anIntArrayArray825[j2][j1] = 0;
  7477.         int l3 = 0;
  7478.         int i4 = 0;
  7479.         bigX[l3] = j2;
  7480.         bigY[l3++] = j1;
  7481.         boolean flag1 = false;
  7482.         int j4 = bigX.length;
  7483.         int ai[][] = aClass11Array1230[plane].anIntArrayArray294;
  7484.         while (i4 != l3) {
  7485.             j3 = bigX[i4];
  7486.             k3 = bigY[i4];
  7487.             i4 = (i4 + 1) % j4;
  7488.             if (j3 == k2 && k3 == i2) {
  7489.                 flag1 = true;
  7490.                 break;
  7491.             }
  7492.             if (i1 != 0) {
  7493.                 if ((i1 < 5 || i1 == 10)
  7494.                         && aClass11Array1230[plane].method219(k2, j3, k3, j,
  7495.                                 i1 - 1, i2)) {
  7496.                     flag1 = true;
  7497.                     break;
  7498.                 }
  7499.                 if (i1 < 10
  7500.                         && aClass11Array1230[plane].method220(k2, i2, k3,
  7501.                                 i1 - 1, j, j3)) {
  7502.                     flag1 = true;
  7503.                     break;
  7504.                 }
  7505.             }
  7506.             if (k1 != 0
  7507.                     && k != 0
  7508.                     && aClass11Array1230[plane].method221(i2, k2, j3, k, l1,
  7509.                             k1, k3)) {
  7510.                 flag1 = true;
  7511.                 break;
  7512.             }
  7513.             int l4 = anIntArrayArray825[j3][k3] + 1;
  7514.             if (j3 > 0 && anIntArrayArray901[j3 - 1][k3] == 0
  7515.                     && (ai[j3 - 1][k3] & 0x1280108) == 0) {
  7516.                 bigX[l3] = j3 - 1;
  7517.                 bigY[l3] = k3;
  7518.                 l3 = (l3 + 1) % j4;
  7519.                 anIntArrayArray901[j3 - 1][k3] = 2;
  7520.                 anIntArrayArray825[j3 - 1][k3] = l4;
  7521.             }
  7522.             if (j3 < byte0 - 1 && anIntArrayArray901[j3 + 1][k3] == 0
  7523.                     && (ai[j3 + 1][k3] & 0x1280180) == 0) {
  7524.                 bigX[l3] = j3 + 1;
  7525.                 bigY[l3] = k3;
  7526.                 l3 = (l3 + 1) % j4;
  7527.                 anIntArrayArray901[j3 + 1][k3] = 8;
  7528.                 anIntArrayArray825[j3 + 1][k3] = l4;
  7529.             }
  7530.             if (k3 > 0 && anIntArrayArray901[j3][k3 - 1] == 0
  7531.                     && (ai[j3][k3 - 1] & 0x1280102) == 0) {
  7532.                 bigX[l3] = j3;
  7533.                 bigY[l3] = k3 - 1;
  7534.                 l3 = (l3 + 1) % j4;
  7535.                 anIntArrayArray901[j3][k3 - 1] = 1;
  7536.                 anIntArrayArray825[j3][k3 - 1] = l4;
  7537.             }
  7538.             if (k3 < byte1 - 1 && anIntArrayArray901[j3][k3 + 1] == 0
  7539.                     && (ai[j3][k3 + 1] & 0x1280120) == 0) {
  7540.                 bigX[l3] = j3;
  7541.                 bigY[l3] = k3 + 1;
  7542.                 l3 = (l3 + 1) % j4;
  7543.                 anIntArrayArray901[j3][k3 + 1] = 4;
  7544.                 anIntArrayArray825[j3][k3 + 1] = l4;
  7545.             }
  7546.             if (j3 > 0 && k3 > 0 && anIntArrayArray901[j3 - 1][k3 - 1] == 0
  7547.                     && (ai[j3 - 1][k3 - 1] & 0x128010e) == 0
  7548.                     && (ai[j3 - 1][k3] & 0x1280108) == 0
  7549.                     && (ai[j3][k3 - 1] & 0x1280102) == 0) {
  7550.                 bigX[l3] = j3 - 1;
  7551.                 bigY[l3] = k3 - 1;
  7552.                 l3 = (l3 + 1) % j4;
  7553.                 anIntArrayArray901[j3 - 1][k3 - 1] = 3;
  7554.                 anIntArrayArray825[j3 - 1][k3 - 1] = l4;
  7555.             }
  7556.             if (j3 < byte0 - 1 && k3 > 0
  7557.                     && anIntArrayArray901[j3 + 1][k3 - 1] == 0
  7558.                     && (ai[j3 + 1][k3 - 1] & 0x1280183) == 0
  7559.                     && (ai[j3 + 1][k3] & 0x1280180) == 0
  7560.                     && (ai[j3][k3 - 1] & 0x1280102) == 0) {
  7561.                 bigX[l3] = j3 + 1;
  7562.                 bigY[l3] = k3 - 1;
  7563.                 l3 = (l3 + 1) % j4;
  7564.                 anIntArrayArray901[j3 + 1][k3 - 1] = 9;
  7565.                 anIntArrayArray825[j3 + 1][k3 - 1] = l4;
  7566.             }
  7567.             if (j3 > 0 && k3 < byte1 - 1
  7568.                     && anIntArrayArray901[j3 - 1][k3 + 1] == 0
  7569.                     && (ai[j3 - 1][k3 + 1] & 0x1280138) == 0
  7570.                     && (ai[j3 - 1][k3] & 0x1280108) == 0
  7571.                     && (ai[j3][k3 + 1] & 0x1280120) == 0) {
  7572.                 bigX[l3] = j3 - 1;
  7573.                 bigY[l3] = k3 + 1;
  7574.                 l3 = (l3 + 1) % j4;
  7575.                 anIntArrayArray901[j3 - 1][k3 + 1] = 6;
  7576.                 anIntArrayArray825[j3 - 1][k3 + 1] = l4;
  7577.             }
  7578.             if (j3 < byte0 - 1 && k3 < byte1 - 1
  7579.                     && anIntArrayArray901[j3 + 1][k3 + 1] == 0
  7580.                     && (ai[j3 + 1][k3 + 1] & 0x12801e0) == 0
  7581.                     && (ai[j3 + 1][k3] & 0x1280180) == 0
  7582.                     && (ai[j3][k3 + 1] & 0x1280120) == 0) {
  7583.                 bigX[l3] = j3 + 1;
  7584.                 bigY[l3] = k3 + 1;
  7585.                 l3 = (l3 + 1) % j4;
  7586.                 anIntArrayArray901[j3 + 1][k3 + 1] = 12;
  7587.                 anIntArrayArray825[j3 + 1][k3 + 1] = l4;
  7588.             }
  7589.         }
  7590.         anInt1264 = 0;
  7591.         if (!flag1) {
  7592.             if (flag) {
  7593.                 int i5 = 100;
  7594.                 for (int k5 = 1; k5 < 2; k5++) {
  7595.                     for (int i6 = k2 - k5; i6 <= k2 + k5; i6++) {
  7596.                         for (int l6 = i2 - k5; l6 <= i2 + k5; l6++)
  7597.                             if (i6 >= 0 && l6 >= 0 && i6 < 104 && l6 < 104
  7598.                                     && anIntArrayArray825[i6][l6] < i5) {
  7599.                                 i5 = anIntArrayArray825[i6][l6];
  7600.                                 j3 = i6;
  7601.                                 k3 = l6;
  7602.                                 anInt1264 = 1;
  7603.                                 flag1 = true;
  7604.                             }
  7605.  
  7606.                     }
  7607.  
  7608.                     if (flag1)
  7609.                         break;
  7610.                 }
  7611.  
  7612.             }
  7613.             if (!flag1)
  7614.                 return false;
  7615.         }
  7616.         i4 = 0;
  7617.         bigX[i4] = j3;
  7618.         bigY[i4++] = k3;
  7619.         int l5;
  7620.         for (int j5 = l5 = anIntArrayArray901[j3][k3]; j3 != j2 || k3 != j1; j5 = anIntArrayArray901[j3][k3]) {
  7621.             if (j5 != l5) {
  7622.                 l5 = j5;
  7623.                 bigX[i4] = j3;
  7624.                 bigY[i4++] = k3;
  7625.             }
  7626.             if ((j5 & 2) != 0)
  7627.                 j3++;
  7628.             else if ((j5 & 8) != 0)
  7629.                 j3--;
  7630.             if ((j5 & 1) != 0)
  7631.                 k3++;
  7632.             else if ((j5 & 4) != 0)
  7633.                 k3--;
  7634.         }
  7635.         // if(cancelWalk) { return i4 > 0; }
  7636.  
  7637.         if (i4 > 0) {
  7638.             int k4 = i4;
  7639.             if (k4 > 25)
  7640.                 k4 = 25;
  7641.             i4--;
  7642.             int k6 = bigX[i4];
  7643.             int i7 = bigY[i4];
  7644.             anInt1288 += k4;
  7645.             if (anInt1288 >= 92) {
  7646.                 stream.createFrame(36);
  7647.                 stream.writeDWord(0);
  7648.                 anInt1288 = 0;
  7649.             }
  7650.             if (i == 0) {
  7651.                 stream.createFrame(164);
  7652.                 stream.writeWordBigEndian(k4 + k4 + 3);
  7653.             }
  7654.             if (i == 1) {
  7655.                 stream.createFrame(248);
  7656.                 stream.writeWordBigEndian(k4 + k4 + 3 + 14);
  7657.             }
  7658.             if (i == 2) {
  7659.                 stream.createFrame(98);
  7660.                 stream.writeWordBigEndian(k4 + k4 + 3);
  7661.             }
  7662.             stream.method433(k6 + baseX);
  7663.             destX = bigX[0];
  7664.             destY = bigY[0];
  7665.             for (int j7 = 1; j7 < k4; j7++) {
  7666.                 i4--;
  7667.                 stream.writeWordBigEndian(bigX[i4] - k6);
  7668.                 stream.writeWordBigEndian(bigY[i4] - i7);
  7669.             }
  7670.  
  7671.             stream.method431(i7 + baseY);
  7672.             stream.method424(super.keyArray[5] != 1 ? 0 : 1);
  7673.             return true;
  7674.         }
  7675.         return i != 1;
  7676.     }
  7677.  
  7678.     public void method86(Stream stream) {
  7679.         for (int j = 0; j < anInt893; j++) {
  7680.             int k = anIntArray894[j];
  7681.             NPC npc = npcArray[k];
  7682.             int l = stream.readUnsignedByte();
  7683.             if ((l & 0x10) != 0) {
  7684.                 int i1 = stream.method434();
  7685.                 if (i1 == 65535)
  7686.                     i1 = -1;
  7687.                 int i2 = stream.readUnsignedByte();
  7688.                 if (i1 == npc.anim && i1 != -1) {
  7689.                     int l2 = Animation.anims[i1].anInt365;
  7690.                     if (l2 == 1) {
  7691.                         npc.anInt1527 = 0;
  7692.                         npc.anInt1528 = 0;
  7693.                         npc.anInt1529 = i2;
  7694.                         npc.anInt1530 = 0;
  7695.                     }
  7696.                     if (l2 == 2)
  7697.                         npc.anInt1530 = 0;
  7698.                 } else if (i1 == -1
  7699.                         || npc.anim == -1
  7700.                         || Animation.anims[i1].anInt359 >= Animation.anims[npc.anim].anInt359) {
  7701.                     npc.anim = i1;
  7702.                     npc.anInt1527 = 0;
  7703.                     npc.anInt1528 = 0;
  7704.                     npc.anInt1529 = i2;
  7705.                     npc.anInt1530 = 0;
  7706.                     npc.anInt1542 = npc.smallXYIndex;
  7707.                 }
  7708.             }
  7709.             if ((l & 8) != 0) {
  7710.                 int j1 = stream.method426();
  7711.                 int j2 = stream.method427();
  7712.                 npc.updateHitData(j2, j1, loopCycle);
  7713.                 npc.loopCycleStatus = loopCycle + 300;
  7714.                 npc.currentHealth = stream.method426();
  7715.                 npc.maxHealth = stream.readUnsignedByte();
  7716.             }
  7717.             if ((l & 0x80) != 0) {
  7718.                 npc.anInt1520 = stream.readUnsignedWord();
  7719.                 int k1 = stream.readDWord();
  7720.                 npc.anInt1524 = k1 >> 16;
  7721.                 npc.anInt1523 = loopCycle + (k1 & 0xffff);
  7722.                 npc.anInt1521 = 0;
  7723.                 npc.anInt1522 = 0;
  7724.                 if (npc.anInt1523 > loopCycle)
  7725.                     npc.anInt1521 = -1;
  7726.                 if (npc.anInt1520 == 65535)
  7727.                     npc.anInt1520 = -1;
  7728.             }
  7729.             if ((l & 0x20) != 0) {
  7730.                 npc.interactingEntity = stream.readUnsignedWord();
  7731.                 if (npc.interactingEntity == 65535)
  7732.                     npc.interactingEntity = -1;
  7733.             }
  7734.             if ((l & 1) != 0) {
  7735.                 npc.textSpoken = stream.readString();
  7736.                 npc.textCycle = 100;
  7737.             }
  7738.             if ((l & 0x40) != 0) {
  7739.                 int l1 = stream.method427();
  7740.                 int k2 = stream.method428();
  7741.                 npc.updateHitData(k2, l1, loopCycle);
  7742.                 npc.loopCycleStatus = loopCycle + 300;
  7743.                 npc.currentHealth = stream.method428();
  7744.                 npc.maxHealth = stream.method427();
  7745.             }
  7746.             if ((l & 2) != 0) {
  7747.                 npc.desc = EntityDef.forID(stream.method436());
  7748.                 npc.anInt1540 = npc.desc.aByte68;
  7749.                 npc.anInt1504 = npc.desc.anInt79;
  7750.                 npc.anInt1554 = npc.desc.walkAnim;
  7751.                 npc.anInt1555 = npc.desc.anInt58;
  7752.                 npc.anInt1556 = npc.desc.anInt83;
  7753.                 npc.anInt1557 = npc.desc.anInt55;
  7754.                 npc.anInt1511 = npc.desc.standAnim;
  7755.             }
  7756.             if ((l & 4) != 0) {
  7757.                 npc.anInt1538 = stream.method434();
  7758.                 npc.anInt1539 = stream.method434();
  7759.             }
  7760.         }
  7761.     }
  7762.  
  7763.     public void buildAtNPCMenu(EntityDef entityDef, int i, int j, int k) {
  7764.         if (menuActionRow >= 400)
  7765.             return;
  7766.         if (entityDef.childrenIDs != null)
  7767.             entityDef = entityDef.method161();
  7768.         if (entityDef == null)
  7769.             return;
  7770.         if (!entityDef.aBoolean84)
  7771.             return;
  7772.         String s = entityDef.name;
  7773.         if (entityDef.combatLevel != 0)
  7774.             s = s
  7775.                     + combatDiffColor(myPlayer.combatLevel,
  7776.                             entityDef.combatLevel) + " (level-"
  7777.                     + entityDef.combatLevel + ")";
  7778.         if (itemSelected == 1) {
  7779.             menuActionName[menuActionRow] = "Use " + selectedItemName
  7780.                     + " with @yel@" + s;
  7781.             menuActionID[menuActionRow] = 582;
  7782.             menuActionCmd1[menuActionRow] = i;
  7783.             menuActionCmd2[menuActionRow] = k;
  7784.             menuActionCmd3[menuActionRow] = j;
  7785.             menuActionRow++;
  7786.             return;
  7787.         }
  7788.         if (spellSelected == 1) {
  7789.             if ((spellUsableOn & 2) == 2) {
  7790.                 menuActionName[menuActionRow] = spellTooltip + " @yel@" + s;
  7791.                 menuActionID[menuActionRow] = 413;
  7792.                 menuActionCmd1[menuActionRow] = i;
  7793.                 menuActionCmd2[menuActionRow] = k;
  7794.                 menuActionCmd3[menuActionRow] = j;
  7795.                 menuActionRow++;
  7796.             }
  7797.         } else {
  7798.             if (entityDef.actions != null) {
  7799.                 for (int l = 4; l >= 0; l--)
  7800.                     if (entityDef.actions[l] != null
  7801.                             && !entityDef.actions[l].equalsIgnoreCase("attack")) {
  7802.                         menuActionName[menuActionRow] = entityDef.actions[l]
  7803.                                 + " @yel@" + s;
  7804.                         if (l == 0)
  7805.                             menuActionID[menuActionRow] = 20;
  7806.                         if (l == 1)
  7807.                             menuActionID[menuActionRow] = 412;
  7808.                         if (l == 2)
  7809.                             menuActionID[menuActionRow] = 225;
  7810.                         if (l == 3)
  7811.                             menuActionID[menuActionRow] = 965;
  7812.                         if (l == 4)
  7813.                             menuActionID[menuActionRow] = 478;
  7814.                         menuActionCmd1[menuActionRow] = i;
  7815.                         menuActionCmd2[menuActionRow] = k;
  7816.                         menuActionCmd3[menuActionRow] = j;
  7817.                         menuActionRow++;
  7818.                     }
  7819.  
  7820.             }
  7821.             if (entityDef.actions != null) {
  7822.                 for (int i1 = 4; i1 >= 0; i1--)
  7823.                     if (entityDef.actions[i1] != null
  7824.                             && entityDef.actions[i1].equalsIgnoreCase("attack")) {
  7825.                         char c = '\0';
  7826.                         if (entityDef.combatLevel > myPlayer.combatLevel)
  7827.                             c = '\u07D0';
  7828.                         menuActionName[menuActionRow] = entityDef.actions[i1]
  7829.                                 + " @yel@" + s;
  7830.                         if (i1 == 0)
  7831.                             menuActionID[menuActionRow] = 20 + c;
  7832.                         if (i1 == 1)
  7833.                             menuActionID[menuActionRow] = 412 + c;
  7834.                         if (i1 == 2)
  7835.                             menuActionID[menuActionRow] = 225 + c;
  7836.                         if (i1 == 3)
  7837.                             menuActionID[menuActionRow] = 965 + c;
  7838.                         if (i1 == 4)
  7839.                             menuActionID[menuActionRow] = 478 + c;
  7840.                         menuActionCmd1[menuActionRow] = i;
  7841.                         menuActionCmd2[menuActionRow] = k;
  7842.                         menuActionCmd3[menuActionRow] = j;
  7843.                         menuActionRow++;
  7844.                     }
  7845.  
  7846.             }
  7847.             // menuActionName[menuActionRow] = "Examine @yel@" + s +
  7848.             // " @gre@(@whi@" + entityDef.type + "@gre@)";
  7849.             menuActionName[menuActionRow] = "Examine @yel@" + s;
  7850.             menuActionID[menuActionRow] = 1025;
  7851.             menuActionCmd1[menuActionRow] = i;
  7852.             menuActionCmd2[menuActionRow] = k;
  7853.             menuActionCmd3[menuActionRow] = j;
  7854.             menuActionRow++;
  7855.         }
  7856.     }
  7857.  
  7858.     public void buildAtPlayerMenu(int i, int j, Player player, int k) {
  7859.         if (player == myPlayer)
  7860.             return;
  7861.         if (menuActionRow >= 400)
  7862.             return;
  7863.         String s;
  7864.         if (player.title.length() < 0)
  7865.             s = player.name
  7866.                     + combatDiffColor(myPlayer.combatLevel, player.combatLevel)
  7867.                     + " (level: " + player.combatLevel + ")";
  7868.         else if (player.title.length() != 0)
  7869.             s = "@" + titleColor(player.titleColor, 1) + "@" + player.title
  7870.                     + "@whi@" + player.name
  7871.                     + combatDiffColor(myPlayer.combatLevel, player.combatLevel)
  7872.                     + " (level: " + player.combatLevel + ")";
  7873.         else
  7874.             s = player.name
  7875.                     + combatDiffColor(myPlayer.combatLevel, player.combatLevel)
  7876.                     + " (level: " + player.combatLevel + ")";
  7877.         if (itemSelected == 1) {
  7878.             menuActionName[menuActionRow] = "Use " + selectedItemName
  7879.                     + " with @whi@" + s;
  7880.             menuActionID[menuActionRow] = 491;
  7881.             menuActionCmd1[menuActionRow] = j;
  7882.             menuActionCmd2[menuActionRow] = i;
  7883.             menuActionCmd3[menuActionRow] = k;
  7884.             menuActionRow++;
  7885.         } else if (spellSelected == 1) {
  7886.             if ((spellUsableOn & 8) == 8) {
  7887.                 menuActionName[menuActionRow] = spellTooltip + " @whi@" + s;
  7888.                 menuActionID[menuActionRow] = 365;
  7889.                 menuActionCmd1[menuActionRow] = j;
  7890.                 menuActionCmd2[menuActionRow] = i;
  7891.                 menuActionCmd3[menuActionRow] = k;
  7892.                 menuActionRow++;
  7893.             }
  7894.         } else {
  7895.             for (int l = 4; l >= 0; l--)
  7896.                 if (atPlayerActions[l] != null) {
  7897.                     menuActionName[menuActionRow] = atPlayerActions[l]
  7898.                             + " @whi@" + s;
  7899.                     char c = '\0';
  7900.                     if (atPlayerActions[l].equalsIgnoreCase("attack")) {
  7901.                         if (player.combatLevel > myPlayer.combatLevel)
  7902.                             c = '\u07D0';
  7903.                         if (myPlayer.team != 0 && player.team != 0)
  7904.                             if (myPlayer.team == player.team)
  7905.                                 c = '\u07D0';
  7906.                             else
  7907.                                 c = '\0';
  7908.                     } else if (atPlayerArray[l])
  7909.                         c = '\u07D0';
  7910.                     if (l == 0)
  7911.                         menuActionID[menuActionRow] = 561 + c;
  7912.                     if (l == 1)
  7913.                         menuActionID[menuActionRow] = 779 + c;
  7914.                     if (l == 2)
  7915.                         menuActionID[menuActionRow] = 27 + c;
  7916.                     if (l == 3)
  7917.                         menuActionID[menuActionRow] = 577 + c;
  7918.                     if (l == 4)
  7919.                         menuActionID[menuActionRow] = 729 + c;
  7920.                     menuActionCmd1[menuActionRow] = j;
  7921.                     menuActionCmd2[menuActionRow] = i;
  7922.                     menuActionCmd3[menuActionRow] = k;
  7923.                     menuActionRow++;
  7924.                 }
  7925.  
  7926.         }
  7927.         for (int i1 = 0; i1 < menuActionRow; i1++)
  7928.             if (menuActionID[i1] == 516) {
  7929.                 menuActionName[i1] = "Walk here @whi@" + s;
  7930.                 return;
  7931.             }
  7932.  
  7933.     }
  7934.  
  7935.     public void method89(Class30_Sub1 class30_sub1) {
  7936.         int i = 0;
  7937.         int j = -1;
  7938.         int k = 0;
  7939.         int l = 0;
  7940.         if (class30_sub1.anInt1296 == 0)
  7941.             i = worldController.method300(class30_sub1.anInt1295,
  7942.                     class30_sub1.anInt1297, class30_sub1.anInt1298);
  7943.         if (class30_sub1.anInt1296 == 1)
  7944.             i = worldController.method301(class30_sub1.anInt1295,
  7945.                     class30_sub1.anInt1297, class30_sub1.anInt1298);
  7946.         if (class30_sub1.anInt1296 == 2)
  7947.             i = worldController.method302(class30_sub1.anInt1295,
  7948.                     class30_sub1.anInt1297, class30_sub1.anInt1298);
  7949.         if (class30_sub1.anInt1296 == 3)
  7950.             i = worldController.method303(class30_sub1.anInt1295,
  7951.                     class30_sub1.anInt1297, class30_sub1.anInt1298);
  7952.         if (i != 0) {
  7953.             int i1 = worldController.method304(class30_sub1.anInt1295,
  7954.                     class30_sub1.anInt1297, class30_sub1.anInt1298, i);
  7955.             j = i >> 14 & 0x7fff;
  7956.             k = i1 & 0x1f;
  7957.             l = i1 >> 6;
  7958.         }
  7959.         class30_sub1.anInt1299 = j;
  7960.         class30_sub1.anInt1301 = k;
  7961.         class30_sub1.anInt1300 = l;
  7962.     }
  7963.  
  7964.     public void method90() {
  7965.         for (int i = 0; i < anInt1062; i++)
  7966.             if (anIntArray1250[i] <= 0) {
  7967.                 boolean flag1 = false;
  7968.                 try {
  7969.                     if (anIntArray1207[i] == anInt874
  7970.                             && anIntArray1241[i] == anInt1289) {
  7971.                         if (!replayWave())
  7972.                             flag1 = true;
  7973.                     } else {
  7974.                         Stream stream = Sounds.method241(anIntArray1241[i],
  7975.                                 anIntArray1207[i]);
  7976.                         if (System.currentTimeMillis() + stream.currentOffset
  7977.                                 / 22 > aLong1172 + anInt1257 / 22) {
  7978.                             anInt1257 = stream.currentOffset;
  7979.                             aLong1172 = System.currentTimeMillis();
  7980.                             if (saveWave(stream.buffer, stream.currentOffset)) {
  7981.                                 anInt874 = anIntArray1207[i];
  7982.                                 anInt1289 = anIntArray1241[i];
  7983.                             } else {
  7984.                                 flag1 = true;
  7985.                             }
  7986.                         }
  7987.                     }
  7988.                 } catch (Exception exception) {
  7989.                 }
  7990.                 if (!flag1 || anIntArray1250[i] == -5) {
  7991.                     anInt1062--;
  7992.                     for (int j = i; j < anInt1062; j++) {
  7993.                         anIntArray1207[j] = anIntArray1207[j + 1];
  7994.                         anIntArray1241[j] = anIntArray1241[j + 1];
  7995.                         anIntArray1250[j] = anIntArray1250[j + 1];
  7996.                     }
  7997.  
  7998.                     i--;
  7999.                 } else {
  8000.                     anIntArray1250[i] = -5;
  8001.                 }
  8002.             } else {
  8003.                 anIntArray1250[i]--;
  8004.             }
  8005.  
  8006.         if (prevSong > 0) {
  8007.             prevSong -= 20;
  8008.             if (prevSong < 0)
  8009.                 prevSong = 0;
  8010.             if (prevSong == 0 && musicEnabled && !lowMem) {
  8011.                 nextSong = currentSong;
  8012.                 songChanging = true;
  8013.                 onDemandFetcher.method558(2, nextSong);
  8014.             }
  8015.         }
  8016.     }
  8017.  
  8018.     @Override
  8019.     void startUp() {
  8020.         // drawSmoothLoading(0, "Checking for client updates");
  8021.         // if(!this.isApplet())
  8022. //      new Update(this).run();
  8023.  
  8024.         drawLoadingText(20, "Starting up");
  8025.         // new UpdateCache(this).run();
  8026.         new CacheDownloader(this).downloadCache();
  8027.         if (signlink.sunjava)
  8028.             super.minDelay = 5;
  8029.         if (aBoolean993) {
  8030.             // rsAlreadyLoaded = true;
  8031.             // return;
  8032.         }
  8033.         aBoolean993 = true;
  8034.         getDocumentBaseHost();
  8035.         if (signlink.cache_dat != null) {
  8036.             for (int i = 0; i < 5; i++)
  8037.                 decompressors[i] = new Decompressor(signlink.cache_dat,
  8038.                         signlink.cache_idx[i], i + 1);
  8039.         }
  8040.         try {
  8041.             titleStreamLoader = streamLoaderForName(1, "title screen", "title",
  8042.                     expectedCRCs[1], 25);
  8043.             smallText = new TextDrawingArea(false, "p11_full",
  8044.                     titleStreamLoader);
  8045.             XPFONT = new TextDrawingArea(true, "q8_full", titleStreamLoader);
  8046.             aTextDrawingArea_1271 = new TextDrawingArea(false, "p12_full",
  8047.                     titleStreamLoader);
  8048.             chatTextDrawingArea = new TextDrawingArea(false, "b12_full",
  8049.                     titleStreamLoader);
  8050.             aTextDrawingArea_1273 = new TextDrawingArea(true, "q8_full",
  8051.                     titleStreamLoader);
  8052.             newSmallFont = new RSFont(false, "p11_full", titleStreamLoader);
  8053.             newRegularFont = new RSFont(false, "p12_full", titleStreamLoader);
  8054.             newBoldFont = new RSFont(false, "b12_full", titleStreamLoader);
  8055.             newFancyFont = new RSFont(true, "q8_full", titleStreamLoader);
  8056. //          drawLogo();
  8057.             loadTitleScreen();
  8058.             StreamLoader streamLoader = streamLoaderForName(2, "config",
  8059.                     "config", expectedCRCs[2], 30);
  8060.             StreamLoader streamLoader_1 = streamLoaderForName(3, "interface",
  8061.                     "interface", expectedCRCs[3], 35);
  8062.             StreamLoader streamLoader_2 = streamLoaderForName(4, "2d graphics",
  8063.                     "media", expectedCRCs[4], 40);
  8064.             StreamLoader streamLoader_3 = streamLoaderForName(6, "textures",
  8065.                     "textures", expectedCRCs[6], 45);
  8066.             StreamLoader streamLoader_4 = streamLoaderForName(7, "chat system",
  8067.                     "wordenc", expectedCRCs[7], 50);
  8068.             StreamLoader streamLoader_5 = streamLoaderForName(8,
  8069.                     "sound effects", "sounds", expectedCRCs[8], 55);
  8070.             byteGroundArray = new byte[4][104][104];
  8071.             intGroundArray = new int[4][105][105];
  8072.             worldController = new WorldController(intGroundArray);
  8073.             for (int j = 0; j < 4; j++)
  8074.                 aClass11Array1230[j] = new Class11();
  8075.  
  8076.             aClass30_Sub2_Sub1_Sub1_1263 = new Sprite(512, 512);
  8077.             StreamLoader streamLoader_6 = streamLoaderForName(5, "update list",
  8078.                     "versionlist", expectedCRCs[5], 60);
  8079.             drawLoadingText(60, "Connecting to update server");
  8080.             onDemandFetcher = new OnDemandFetcher();
  8081.             onDemandFetcher.start(streamLoader_6, this);
  8082.             Model.method459(onDemandFetcher.getModelCount(), onDemandFetcher);
  8083.             drawLoadingText(80, "Unpacking media");
  8084.             //repackCacheIndex(1);
  8085.             Increase = new Sprite("INCREASE");
  8086.             Decrease = new Sprite("DECREASE");
  8087.             // worldMapIcon = new Sprite("mapicon");
  8088.             Sprite[] clanIcons = new Sprite[9];
  8089.             for (int index = 0; index < clanIcons.length; index++) {
  8090.                 clanIcons[index] = new Sprite("Clan Chat/Icons/" + index);
  8091.             }
  8092.             mapArea = new Sprite("maparea");
  8093.             worldMapIcon508 = new Sprite("mapicon508");
  8094.             worldMapIcon525 = new Sprite("mapicon525");
  8095.             for (int i = 1; i <= 15; i++) {
  8096.                 ORBS[i] = new Sprite("Gameframe/Orbs/ORBS " + i + "");
  8097.             }
  8098.             multiOverlay = new Sprite(streamLoader_2, "overlay_multiway", 0);
  8099.             chatArea = new Sprite("Gameframe/chatarea");
  8100.             tabArea = new Sprite("Gameframe/tabarea");
  8101.             tabArea474 = new Sprite("tabarea474");
  8102.             mapArea474 = new Sprite("maparea474");
  8103.             mapArea508 = new Sprite("maparea508");
  8104.             tabArea508 = new Sprite("tabarea508");
  8105.             mapBack = new Background(streamLoader_2, "mapback", 0);
  8106.             for (int c1 = 0; c1 <= 3; c1++)
  8107.                 chatButtons[c1] = new Sprite(streamLoader_2, "chatbuttons", c1);
  8108.             for (int j3 = 0; j3 <= 14; j3++)
  8109.                 sideIcons[j3] = new Sprite(streamLoader_2, "sideicons", j3);
  8110.             for (int r1 = 0; r1 < 5; r1++)
  8111.                 redStones[r1] = new Sprite("Gameframe/redstones " + r1);
  8112.             RSFont.unpackImages(modIcons, clanIcons);
  8113.             compass = new Sprite(streamLoader_2, "compass", 0);
  8114.             mapEdge = new Sprite(streamLoader_2, "mapedge", 0);
  8115.             mapEdge.method345();
  8116.             try {
  8117.                 for (int k3 = 0; k3 < 100; k3++)
  8118.                     mapScenes[k3] = new Background(streamLoader_2, "mapscene",
  8119.                             k3);
  8120.             } catch (Exception _ex) {
  8121.             }
  8122.             try {
  8123.                 for (int l3 = 0; l3 < 100; l3++)
  8124.                     mapFunctions[l3] = new Sprite(streamLoader_2,
  8125.                             "mapfunction", l3);
  8126.             } catch (Exception _ex) {
  8127.             }
  8128.             try {
  8129.                 for (int i4 = 0; i4 < 20; i4++)
  8130.                     hitMarks[i4] = new Sprite(streamLoader_2, "hitmarks", i4);
  8131.             } catch (Exception _ex) {
  8132.             }
  8133.             try {
  8134.                 for (int h1 = 0; h1 < 6; h1++)
  8135.                     headIconsHint[h1] = new Sprite(streamLoader_2,
  8136.                             "headicons_hint", h1);
  8137.             } catch (Exception _ex) {
  8138.             }
  8139.             try {
  8140.                 for (int j4 = 0; j4 < 8; j4++)
  8141.                     headIcons[j4] = new Sprite(streamLoader_2,
  8142.                             "headicons_prayer", j4);
  8143.                 for (int j45 = 0; j45 < 3; j45++)
  8144.                     skullIcons[j45] = new Sprite(streamLoader_2,
  8145.                             "headicons_pk", j45);
  8146.             } catch (Exception _ex) {
  8147.             }
  8148.             mapFlag = new Sprite(streamLoader_2, "mapmarker", 0);
  8149.             mapMarker = new Sprite(streamLoader_2, "mapmarker", 1);
  8150.             for (int k4 = 0; k4 < 8; k4++)
  8151.                 crosses[k4] = new Sprite(streamLoader_2, "cross", k4);
  8152.  
  8153.             mapDotItem = new Sprite(streamLoader_2, "mapdots", 0);
  8154.             mapDotNPC = new Sprite(streamLoader_2, "mapdots", 1);
  8155.             mapDotPlayer = new Sprite(streamLoader_2, "mapdots", 2);
  8156.             mapDotFriend = new Sprite(streamLoader_2, "mapdots", 3);
  8157.             mapDotTeam = new Sprite(streamLoader_2, "mapdots", 4);
  8158.             mapDotClan = new Sprite(streamLoader_2, "mapdots", 5);
  8159.             new Sprite(streamLoader_2, "mapdots", 4);
  8160.             scrollBar1 = new Sprite(streamLoader_2, "scrollbar", 0);
  8161.             scrollBar2 = new Sprite(streamLoader_2, "scrollbar", 1);
  8162.             for (int l4 = 0; l4 < 10; l4++)
  8163.                 modIcons[l4] = new Sprite(streamLoader_2, "mod_icons", l4);
  8164.  
  8165.             Sprite sprite = new Sprite(streamLoader_2, "screenframe", 0);
  8166.             leftFrame = new RSImageProducer(sprite.myWidth, sprite.myHeight,
  8167.                     getGameComponent());
  8168.             sprite.method346(0, 0);
  8169.             sprite = new Sprite(streamLoader_2, "screenframe", 1);
  8170.             topFrame = new RSImageProducer(sprite.myWidth, sprite.myHeight,
  8171.                     getGameComponent());
  8172.             sprite.method346(0, 0);
  8173.             sprite = new Sprite(streamLoader_2, "screenframe", 2);
  8174.             rightFrame = new RSImageProducer(sprite.myWidth, sprite.myHeight,
  8175.                     getGameComponent());
  8176.             sprite.method346(0, 0);
  8177.             sprite = new Sprite(streamLoader_2, "mapedge", 0);
  8178.             mapEdgeIP = new RSImageProducer(sprite.myWidth, sprite.myHeight,
  8179.                     getGameComponent());
  8180.             sprite.method346(0, 0);
  8181.             int i5 = (int) (Math.random() * 21D) - 10;
  8182.             int j5 = (int) (Math.random() * 21D) - 10;
  8183.             int k5 = (int) (Math.random() * 21D) - 10;
  8184.             int l5 = (int) (Math.random() * 41D) - 20;
  8185.             for (int i6 = 0; i6 < 100; i6++) {
  8186.                 if (mapFunctions[i6] != null)
  8187.                     mapFunctions[i6].method344(i5 + l5, j5 + l5, k5 + l5);
  8188.                 if (mapScenes[i6] != null)
  8189.                     mapScenes[i6].method360(i5 + l5, j5 + l5, k5 + l5);
  8190.             }
  8191.  
  8192.             drawLoadingText(83, "Unpacking textures");
  8193.             Texture.method368(streamLoader_3);
  8194.             Texture.method372(0.80000000000000004D);
  8195.             Texture.method367();
  8196.             drawLoadingText(86, "Unpacking config");
  8197.             Animation.unpackConfig(streamLoader);
  8198.             ObjectDef.unpackConfig(streamLoader);
  8199.             Flo.unpackConfig(streamLoader);
  8200.             ItemDef.unpackConfig(streamLoader);
  8201.             EntityDef.unpackConfig(streamLoader);
  8202.             IDK.unpackConfig(streamLoader);
  8203.             SpotAnim.unpackConfig(streamLoader);
  8204.             Varp.unpackConfig(streamLoader);
  8205.             VarBit.unpackConfig(streamLoader);
  8206.             ItemDef.isMembers = isMembers;
  8207.             if (!lowMem) {
  8208.                 drawLoadingText(90, "Unpacking sounds");
  8209.                 byte abyte0[] = streamLoader_5.getDataForName("sounds.dat");
  8210.                 Stream stream = new Stream(abyte0);
  8211.                 Sounds.unpack(stream);
  8212.             }
  8213.             drawLoadingText(95, "Unpacking interfaces");
  8214.             TextDrawingArea allFonts[] = { smallText, aTextDrawingArea_1271,
  8215.                     chatTextDrawingArea, aTextDrawingArea_1273 };
  8216.             RSInterface.unpack(streamLoader_1, allFonts, streamLoader_2);
  8217.             drawLoadingText(100, "Preparing game engine");
  8218.             for (int j6 = 0; j6 < 33; j6++) {
  8219.                 int k6 = 999;
  8220.                 int i7 = 0;
  8221.                 for (int k7 = 0; k7 < 34; k7++) {
  8222.                     if (mapBack.aByteArray1450[k7 + j6 * mapBack.anInt1452] == 0) {
  8223.                         if (k6 == 999)
  8224.                             k6 = k7;
  8225.                         continue;
  8226.                     }
  8227.                     if (k6 == 999)
  8228.                         continue;
  8229.                     i7 = k7;
  8230.                     break;
  8231.                 }
  8232.  
  8233.                 anIntArray968[j6] = k6;
  8234.                 anIntArray1057[j6] = i7 - k6;
  8235.             }
  8236.  
  8237.             for (int l6 = 5; l6 < 156; l6++) {
  8238.                 int j7 = 999;
  8239.                 int l7 = 0;
  8240.                 for (int j8 = 25; j8 < 172; j8++) {
  8241.                     if (mapBack.aByteArray1450[j8 + l6 * mapBack.anInt1452] == 0
  8242.                             && (j8 > 34 || l6 > 34)) {
  8243.                         if (j7 == 999)
  8244.                             j7 = j8;
  8245.                         continue;
  8246.                     }
  8247.                     if (j7 == 999)
  8248.                         continue;
  8249.                     l7 = j8;
  8250.                     break;
  8251.                 }
  8252.  
  8253.                 anIntArray1052[l6 - 5] = j7 - 25;
  8254.                 anIntArray1229[l6 - 5] = l7 - j7;
  8255.             }
  8256.  
  8257.             Texture.method365(765, 503);
  8258.             fullScreenTextureArray = Texture.anIntArray1472;
  8259.             Texture.method365(519, 165);
  8260.             anIntArray1180 = Texture.anIntArray1472;
  8261.             Texture.method365(246, 335);
  8262.             anIntArray1181 = Texture.anIntArray1472;
  8263.             Texture.method365(512, 334);
  8264.             anIntArray1182 = Texture.anIntArray1472;
  8265.             int ai[] = new int[9];
  8266.             for (int i8 = 0; i8 < 9; i8++) {
  8267.                 int k8 = 128 + i8 * 32 + 15;
  8268.                 int l8 = 600 + k8 * 3;
  8269.                 int i9 = Texture.anIntArray1470[k8];
  8270.                 ai[i8] = l8 * i9 >> 16;
  8271.             }
  8272.  
  8273.             WorldController.method310(500, 800, 512, 334, ai);
  8274.             Censor.loadConfig(streamLoader_4);
  8275.             mouseDetection = new MouseDetection(this);
  8276.             startRunnable(mouseDetection, 10);
  8277.             Animable_Sub5.clientInstance = this;
  8278.             ObjectDef.clientInstance = this;
  8279.             EntityDef.clientInstance = this;
  8280.             return;
  8281.         } catch (Exception exception) {
  8282.             exception.printStackTrace();
  8283.             signlink.reporterror("loaderror " + aString1049 + " " + anInt1079);
  8284.         }
  8285.         loadingError = true;
  8286.     }
  8287.  
  8288.     public void method91(Stream stream, int i) {
  8289.         while (stream.bitPosition + 10 < i * 8) {
  8290.             int j = stream.readBits(11);
  8291.             if (j == 2047)
  8292.                 break;
  8293.             if (playerArray[j] == null) {
  8294.                 playerArray[j] = new Player();
  8295.                 if (aStreamArray895s[j] != null)
  8296.                     playerArray[j].updatePlayer(aStreamArray895s[j]);
  8297.             }
  8298.             playerIndices[playerCount++] = j;
  8299.             Player player = playerArray[j];
  8300.             player.anInt1537 = loopCycle;
  8301.             int k = stream.readBits(1);
  8302.             if (k == 1)
  8303.                 anIntArray894[anInt893++] = j;
  8304.             int l = stream.readBits(1);
  8305.             int i1 = stream.readBits(5);
  8306.             if (i1 > 15)
  8307.                 i1 -= 32;
  8308.             int j1 = stream.readBits(5);
  8309.             if (j1 > 15)
  8310.                 j1 -= 32;
  8311.             player.setPos(myPlayer.smallX[0] + j1, myPlayer.smallY[0] + i1,
  8312.                     l == 1);
  8313.         }
  8314.         stream.finishBitAccess();
  8315.     }
  8316.  
  8317.     private void processMainScreenClick() {
  8318.         if (revision474 == true) {
  8319.             if (anInt1021 != 0)
  8320.                 return;
  8321.             if (super.clickMode3 == 1) {
  8322.                 int i = super.saveClickX - 25 - 550;
  8323.                 int j = super.saveClickY - 5 - 4;
  8324.                 if (i >= 0 && j >= 0 && i < 146 && j < 151) {
  8325.                     i -= 73;
  8326.                     j -= 75;
  8327.                     int k = viewRotation + minimapRotation & 0x7ff;
  8328.                     int i1 = Texture.anIntArray1470[k];
  8329.                     int j1 = Texture.anIntArray1471[k];
  8330.                     i1 = i1 * (minimapZoom + 256) >> 8;
  8331.                     j1 = j1 * (minimapZoom + 256) >> 8;
  8332.                     int k1 = j * i1 + i * j1 >> 11;
  8333.                     int l1 = j * j1 - i * i1 >> 11;
  8334.                     int i2 = myPlayer.x + k1 >> 7;
  8335.                     int j2 = myPlayer.y - l1 >> 7;
  8336.                     boolean flag1 = doWalkTo(1, 0, 0, 0, myPlayer.smallY[0], 0,
  8337.                             0, j2, myPlayer.smallX[0], true, i2);
  8338.                     if (flag1) {
  8339.                         stream.writeWordBigEndian(i);
  8340.                         stream.writeWordBigEndian(j);
  8341.                         stream.writeWord(viewRotation);
  8342.                         stream.writeWordBigEndian(57);
  8343.                         stream.writeWordBigEndian(minimapRotation);
  8344.                         stream.writeWordBigEndian(minimapZoom);
  8345.                         stream.writeWordBigEndian(89);
  8346.                         stream.writeWord(myPlayer.x);
  8347.                         stream.writeWord(myPlayer.y);
  8348.                         stream.writeWordBigEndian(anInt1264);
  8349.                         stream.writeWordBigEndian(63);
  8350.                     }
  8351.                 }
  8352.                 anInt1117++;
  8353.                 if (anInt1117 > 1151) {
  8354.                     anInt1117 = 0;
  8355.                     stream.createFrame(246);
  8356.                     stream.writeWordBigEndian(0);
  8357.                     int l = stream.currentOffset;
  8358.                     if ((int) (Math.random() * 2D) == 0)
  8359.                         stream.writeWordBigEndian(101);
  8360.                     stream.writeWordBigEndian(197);
  8361.                     stream.writeWord((int) (Math.random() * 65536D));
  8362.                     stream.writeWordBigEndian((int) (Math.random() * 256D));
  8363.                     stream.writeWordBigEndian(67);
  8364.                     stream.writeWord(14214);
  8365.                     if ((int) (Math.random() * 2D) == 0)
  8366.                         stream.writeWord(29487);
  8367.                     stream.writeWord((int) (Math.random() * 65536D));
  8368.                     if ((int) (Math.random() * 2D) == 0)
  8369.                         stream.writeWordBigEndian(220);
  8370.                     stream.writeWordBigEndian(180);
  8371.                     stream.writeBytes(stream.currentOffset - l);
  8372.                 }
  8373.             }
  8374.         } else if (revision498 == true || revision508 == true) {
  8375.             if (anInt1021 != 0)
  8376.                 return;
  8377.             if (super.clickMode3 == 1) {
  8378.                 if (super.clickMode3 == 1) {
  8379.                     int i = super.saveClickX - 20 - 545;
  8380.                     int j = super.saveClickY - 4 - 4;
  8381.                     if (i >= 0 && j >= 0 && i < 146 && j < 151) {
  8382.                         i -= 73;
  8383.                         j -= 75;
  8384.                         int k = viewRotation + minimapRotation & 0x7ff;
  8385.                         int i1 = Texture.anIntArray1470[k];
  8386.                         int j1 = Texture.anIntArray1471[k];
  8387.                         i1 = i1 * (minimapZoom + 256) >> 8;
  8388.                         j1 = j1 * (minimapZoom + 256) >> 8;
  8389.                         int k1 = j * i1 + i * j1 >> 11;
  8390.                         int l1 = j * j1 - i * i1 >> 11;
  8391.                         int i2 = myPlayer.x + k1 >> 7;
  8392.                         int j2 = myPlayer.y - l1 >> 7;
  8393.                         boolean flag1 = doWalkTo(1, 0, 0, 0,
  8394.                                 myPlayer.smallY[0], 0, 0, j2,
  8395.                                 myPlayer.smallX[0], true, i2);
  8396.                         if (flag1) {
  8397.                             stream.writeWordBigEndian(i);
  8398.                             stream.writeWordBigEndian(j);
  8399.                             stream.writeWord(viewRotation);
  8400.                             stream.writeWordBigEndian(57);
  8401.                             stream.writeWordBigEndian(minimapRotation);
  8402.                             stream.writeWordBigEndian(minimapZoom);
  8403.                             stream.writeWordBigEndian(89);
  8404.                             stream.writeWord(myPlayer.x);
  8405.                             stream.writeWord(myPlayer.y);
  8406.                             stream.writeWordBigEndian(anInt1264);
  8407.                             stream.writeWordBigEndian(63);
  8408.                         }
  8409.                     }
  8410.                 }
  8411.                 anInt1117++;
  8412.                 if (anInt1117 > 1151) {
  8413.                     anInt1117 = 0;
  8414.                     stream.createFrame(246);
  8415.                     stream.writeWordBigEndian(0);
  8416.                     int l = stream.currentOffset;
  8417.                     if ((int) (Math.random() * 2D) == 0)
  8418.                         stream.writeWordBigEndian(101);
  8419.                     stream.writeWordBigEndian(197);
  8420.                     stream.writeWord((int) (Math.random() * 65536D));
  8421.                     stream.writeWordBigEndian((int) (Math.random() * 256D));
  8422.                     stream.writeWordBigEndian(67);
  8423.                     stream.writeWord(14214);
  8424.                     if ((int) (Math.random() * 2D) == 0)
  8425.                         stream.writeWord(29487);
  8426.                     stream.writeWord((int) (Math.random() * 65536D));
  8427.                     if ((int) (Math.random() * 2D) == 0)
  8428.                         stream.writeWordBigEndian(220);
  8429.                     stream.writeWordBigEndian(180);
  8430.                     stream.writeBytes(stream.currentOffset - l);
  8431.                 }
  8432.             }
  8433.         }
  8434.     }
  8435.  
  8436.     private String interfaceIntToString(int j) {
  8437.         if (j < 0x3b9ac9ff)
  8438.             return String.valueOf(j);
  8439.         else
  8440.             return "*";
  8441.     }
  8442.  
  8443.     public void showErrorScreen() {
  8444.         Graphics g = getGameComponent().getGraphics();
  8445.         g.setColor(Color.black);
  8446.         g.fillRect(0, 0, 765, 503);
  8447.         method4(1);
  8448.         if (loadingError) {
  8449.             aBoolean831 = false;
  8450.             g.setFont(new Font("Helvetica", 1, 16));
  8451.             g.setColor(Color.yellow);
  8452.             int k = 35;
  8453.             g.drawString(
  8454.                     "Sorry, an error has occured whilst loading Project-OS",
  8455.                     30, k);
  8456.             k += 50;
  8457.             g.setColor(Color.white);
  8458.             g.drawString("To fix this try the following (in order):", 30, k);
  8459.             k += 50;
  8460.             g.setColor(Color.white);
  8461.             g.setFont(new Font("Helvetica", 1, 12));
  8462.             g.drawString(
  8463.                     "1: Try closing ALL open web-browser windows, and reloading",
  8464.                     30, k);
  8465.             k += 30;
  8466.             g.drawString(
  8467.                     "2: Try clearing your web-browsers cache from tools->internet options",
  8468.                     30, k);
  8469.             k += 30;
  8470.             g.drawString("3: Try using a different game-world", 30, k);
  8471.             k += 30;
  8472.             g.drawString("4: Try rebooting your computer", 30, k);
  8473.             k += 30;
  8474.             g.drawString(
  8475.                     "5: Try selecting a different version of Java from the play-game menu",
  8476.                     30, k);
  8477.         }
  8478.         if (genericLoadingError) {
  8479.             aBoolean831 = false;
  8480.             g.setFont(new Font("Helvetica", 1, 20));
  8481.             g.setColor(Color.white);
  8482.             g.drawString("Error - unable to load game!", 50, 50);
  8483.             g.drawString("To play Project-OS make sure you play from", 50, 100);
  8484.             g.drawString("www.pr-forum.net", 50, 150);
  8485.         }
  8486.         if (rsAlreadyLoaded) {
  8487.             aBoolean831 = false;
  8488.             g.setColor(Color.yellow);
  8489.             int l = 35;
  8490.             g.drawString(
  8491.                     "Error a copy of Project-OS already appears to be loaded",
  8492.                     30, l);
  8493.             l += 50;
  8494.             g.setColor(Color.white);
  8495.             g.drawString("To fix this try the following (in order):", 30, l);
  8496.             l += 50;
  8497.             g.setColor(Color.white);
  8498.             g.setFont(new Font("Helvetica", 1, 12));
  8499.             g.drawString(
  8500.                     "1: Try closing ALL open web-browser windows, and reloading",
  8501.                     30, l);
  8502.             l += 30;
  8503.             g.drawString("2: Try rebooting your computer, and reloading", 30, l);
  8504.             l += 30;
  8505.         }
  8506.     }
  8507.  
  8508.     @Override
  8509.     public URL getCodeBase() {
  8510.  
  8511.         try {
  8512.             return new URL("rsts.ddns.net" + ":" + (80 + portOff));
  8513.         } catch (Exception _ex) {
  8514.         }
  8515.         return null;
  8516.     }
  8517.  
  8518.     public void method95() {
  8519.         for (int j = 0; j < npcCount; j++) {
  8520.             int k = npcIndices[j];
  8521.             NPC npc = npcArray[k];
  8522.             if (npc != null)
  8523.                 method96(npc);
  8524.         }
  8525.     }
  8526.  
  8527.     public void method96(Entity entity) {
  8528.         if (entity.x < 128 || entity.y < 128 || entity.x >= 13184
  8529.                 || entity.y >= 13184) {
  8530.             entity.anim = -1;
  8531.             entity.anInt1520 = -1;
  8532.             entity.anInt1547 = 0;
  8533.             entity.anInt1548 = 0;
  8534.             entity.x = entity.smallX[0] * 128 + entity.anInt1540 * 64;
  8535.             entity.y = entity.smallY[0] * 128 + entity.anInt1540 * 64;
  8536.             entity.method446();
  8537.         }
  8538.         if (entity == myPlayer
  8539.                 && (entity.x < 1536 || entity.y < 1536 || entity.x >= 11776 || entity.y >= 11776)) {
  8540.             entity.anim = -1;
  8541.             entity.anInt1520 = -1;
  8542.             entity.anInt1547 = 0;
  8543.             entity.anInt1548 = 0;
  8544.             entity.x = entity.smallX[0] * 128 + entity.anInt1540 * 64;
  8545.             entity.y = entity.smallY[0] * 128 + entity.anInt1540 * 64;
  8546.             entity.method446();
  8547.         }
  8548.         if (entity.anInt1547 > loopCycle)
  8549.             method97(entity);
  8550.         else if (entity.anInt1548 >= loopCycle)
  8551.             method98(entity);
  8552.         else
  8553.             method99(entity);
  8554.         method100(entity);
  8555.         method101(entity);
  8556.     }
  8557.  
  8558.     public void method97(Entity entity) {
  8559.         int i = entity.anInt1547 - loopCycle;
  8560.         int j = entity.anInt1543 * 128 + entity.anInt1540 * 64;
  8561.         int k = entity.anInt1545 * 128 + entity.anInt1540 * 64;
  8562.         entity.x += (j - entity.x) / i;
  8563.         entity.y += (k - entity.y) / i;
  8564.         entity.anInt1503 = 0;
  8565.         if (entity.anInt1549 == 0)
  8566.             entity.turnDirection = 1024;
  8567.         if (entity.anInt1549 == 1)
  8568.             entity.turnDirection = 1536;
  8569.         if (entity.anInt1549 == 2)
  8570.             entity.turnDirection = 0;
  8571.         if (entity.anInt1549 == 3)
  8572.             entity.turnDirection = 512;
  8573.     }
  8574.  
  8575.     public void method98(Entity entity) {
  8576.         if (entity.anInt1548 == loopCycle
  8577.                 || entity.anim == -1
  8578.                 || entity.anInt1529 != 0
  8579.                 || entity.anInt1528 + 1 > Animation.anims[entity.anim]
  8580.                         .method258(entity.anInt1527)) {
  8581.             int i = entity.anInt1548 - entity.anInt1547;
  8582.             int j = loopCycle - entity.anInt1547;
  8583.             int k = entity.anInt1543 * 128 + entity.anInt1540 * 64;
  8584.             int l = entity.anInt1545 * 128 + entity.anInt1540 * 64;
  8585.             int i1 = entity.anInt1544 * 128 + entity.anInt1540 * 64;
  8586.             int j1 = entity.anInt1546 * 128 + entity.anInt1540 * 64;
  8587.             entity.x = (k * (i - j) + i1 * j) / i;
  8588.             entity.y = (l * (i - j) + j1 * j) / i;
  8589.         }
  8590.         entity.anInt1503 = 0;
  8591.         if (entity.anInt1549 == 0)
  8592.             entity.turnDirection = 1024;
  8593.         if (entity.anInt1549 == 1)
  8594.             entity.turnDirection = 1536;
  8595.         if (entity.anInt1549 == 2)
  8596.             entity.turnDirection = 0;
  8597.         if (entity.anInt1549 == 3)
  8598.             entity.turnDirection = 512;
  8599.         entity.anInt1552 = entity.turnDirection;
  8600.     }
  8601.  
  8602.     public void method99(Entity entity) {
  8603.         entity.anInt1517 = entity.anInt1511;
  8604.         if (entity.smallXYIndex == 0) {
  8605.             entity.anInt1503 = 0;
  8606.             return;
  8607.         }
  8608.         if (entity.anim != -1 && entity.anInt1529 == 0) {
  8609.             Animation animation = Animation.anims[entity.anim];
  8610.             if (entity.anInt1542 > 0 && animation.anInt363 == 0) {
  8611.                 entity.anInt1503++;
  8612.                 return;
  8613.             }
  8614.             if (entity.anInt1542 <= 0 && animation.anInt364 == 0) {
  8615.                 entity.anInt1503++;
  8616.                 return;
  8617.             }
  8618.         }
  8619.         int i = entity.x;
  8620.         int j = entity.y;
  8621.         int k = entity.smallX[entity.smallXYIndex - 1] * 128 + entity.anInt1540
  8622.                 * 64;
  8623.         int l = entity.smallY[entity.smallXYIndex - 1] * 128 + entity.anInt1540
  8624.                 * 64;
  8625.         if (k - i > 256 || k - i < -256 || l - j > 256 || l - j < -256) {
  8626.             entity.x = k;
  8627.             entity.y = l;
  8628.             return;
  8629.         }
  8630.         if (i < k) {
  8631.             if (j < l)
  8632.                 entity.turnDirection = 1280;
  8633.             else if (j > l)
  8634.                 entity.turnDirection = 1792;
  8635.             else
  8636.                 entity.turnDirection = 1536;
  8637.         } else if (i > k) {
  8638.             if (j < l)
  8639.                 entity.turnDirection = 768;
  8640.             else if (j > l)
  8641.                 entity.turnDirection = 256;
  8642.             else
  8643.                 entity.turnDirection = 512;
  8644.         } else if (j < l)
  8645.             entity.turnDirection = 1024;
  8646.         else
  8647.             entity.turnDirection = 0;
  8648.         int i1 = entity.turnDirection - entity.anInt1552 & 0x7ff;
  8649.         if (i1 > 1024)
  8650.             i1 -= 2048;
  8651.         int j1 = entity.anInt1555;
  8652.         if (i1 >= -256 && i1 <= 256)
  8653.             j1 = entity.anInt1554;
  8654.         else if (i1 >= 256 && i1 < 768)
  8655.             j1 = entity.anInt1557;
  8656.         else if (i1 >= -768 && i1 <= -256)
  8657.             j1 = entity.anInt1556;
  8658.         if (j1 == -1)
  8659.             j1 = entity.anInt1554;
  8660.         entity.anInt1517 = j1;
  8661.         int k1 = 4;
  8662.         if (entity.anInt1552 != entity.turnDirection
  8663.                 && entity.interactingEntity == -1 && entity.anInt1504 != 0)
  8664.             k1 = 2;
  8665.         if (entity.smallXYIndex > 2)
  8666.             k1 = 6;
  8667.         if (entity.smallXYIndex > 3)
  8668.             k1 = 8;
  8669.         if (entity.anInt1503 > 0 && entity.smallXYIndex > 1) {
  8670.             k1 = 8;
  8671.             entity.anInt1503--;
  8672.         }
  8673.         if (entity.aBooleanArray1553[entity.smallXYIndex - 1])
  8674.             k1 <<= 1;
  8675.         if (k1 >= 8 && entity.anInt1517 == entity.anInt1554
  8676.                 && entity.anInt1505 != -1)
  8677.             entity.anInt1517 = entity.anInt1505;
  8678.         if (i < k) {
  8679.             entity.x += k1;
  8680.             if (entity.x > k)
  8681.                 entity.x = k;
  8682.         } else if (i > k) {
  8683.             entity.x -= k1;
  8684.             if (entity.x < k)
  8685.                 entity.x = k;
  8686.         }
  8687.         if (j < l) {
  8688.             entity.y += k1;
  8689.             if (entity.y > l)
  8690.                 entity.y = l;
  8691.         } else if (j > l) {
  8692.             entity.y -= k1;
  8693.             if (entity.y < l)
  8694.                 entity.y = l;
  8695.         }
  8696.         if (entity.x == k && entity.y == l) {
  8697.             entity.smallXYIndex--;
  8698.             if (entity.anInt1542 > 0)
  8699.                 entity.anInt1542--;
  8700.         }
  8701.     }
  8702.  
  8703.     public void method100(Entity entity) {
  8704.         if (entity.anInt1504 == 0)
  8705.             return;
  8706.         if (entity.interactingEntity != -1 && entity.interactingEntity < 32768) {
  8707.             NPC npc = npcArray[entity.interactingEntity];
  8708.             if (npc != null) {
  8709.                 int i1 = entity.x - npc.x;
  8710.                 int k1 = entity.y - npc.y;
  8711.                 if (i1 != 0 || k1 != 0)
  8712.                     entity.turnDirection = (int) (Math.atan2(i1, k1) * 325.94900000000001D) & 0x7ff;
  8713.             }
  8714.         }
  8715.         if (entity.interactingEntity >= 32768) {
  8716.             int j = entity.interactingEntity - 32768;
  8717.             if (j == unknownInt10)
  8718.                 j = myPlayerIndex;
  8719.             Player player = playerArray[j];
  8720.             if (player != null) {
  8721.                 int l1 = entity.x - player.x;
  8722.                 int i2 = entity.y - player.y;
  8723.                 if (l1 != 0 || i2 != 0)
  8724.                     entity.turnDirection = (int) (Math.atan2(l1, i2) * 325.94900000000001D) & 0x7ff;
  8725.             }
  8726.         }
  8727.         if ((entity.anInt1538 != 0 || entity.anInt1539 != 0)
  8728.                 && (entity.smallXYIndex == 0 || entity.anInt1503 > 0)) {
  8729.             int k = entity.x - (entity.anInt1538 - baseX - baseX) * 64;
  8730.             int j1 = entity.y - (entity.anInt1539 - baseY - baseY) * 64;
  8731.             if (k != 0 || j1 != 0)
  8732.                 entity.turnDirection = (int) (Math.atan2(k, j1) * 325.94900000000001D) & 0x7ff;
  8733.             entity.anInt1538 = 0;
  8734.             entity.anInt1539 = 0;
  8735.         }
  8736.         int l = entity.turnDirection - entity.anInt1552 & 0x7ff;
  8737.         if (l != 0) {
  8738.             if (l < entity.anInt1504 || l > 2048 - entity.anInt1504)
  8739.                 entity.anInt1552 = entity.turnDirection;
  8740.             else if (l > 1024)
  8741.                 entity.anInt1552 -= entity.anInt1504;
  8742.             else
  8743.                 entity.anInt1552 += entity.anInt1504;
  8744.             entity.anInt1552 &= 0x7ff;
  8745.             if (entity.anInt1517 == entity.anInt1511
  8746.                     && entity.anInt1552 != entity.turnDirection) {
  8747.                 if (entity.anInt1512 != -1) {
  8748.                     entity.anInt1517 = entity.anInt1512;
  8749.                     return;
  8750.                 }
  8751.                 entity.anInt1517 = entity.anInt1554;
  8752.             }
  8753.         }
  8754.     }
  8755.  
  8756.     public void method101(Entity entity) {
  8757.         entity.aBoolean1541 = false;
  8758.         if (entity.anInt1517 != -1) {
  8759.             Animation animation = Animation.anims[entity.anInt1517];
  8760.             entity.anInt1519++;
  8761.             if (entity.anInt1518 < animation.anInt352
  8762.                     && entity.anInt1519 > animation.method258(entity.anInt1518)) {
  8763.                 entity.anInt1519 = 1;
  8764.                 entity.anInt1518++;
  8765.             }
  8766.             if (entity.anInt1518 >= animation.anInt352) {
  8767.                 entity.anInt1519 = 1;
  8768.                 entity.anInt1518 = 0;
  8769.             }
  8770.         }
  8771.         if (entity.anInt1520 != -1 && loopCycle >= entity.anInt1523) {
  8772.             if (entity.anInt1521 < 0)
  8773.                 entity.anInt1521 = 0;
  8774.             Animation animation_1 = SpotAnim.cache[entity.anInt1520].aAnimation_407;
  8775.             for (entity.anInt1522++; entity.anInt1521 < animation_1.anInt352
  8776.                     && entity.anInt1522 > animation_1
  8777.                             .method258(entity.anInt1521); entity.anInt1521++)
  8778.                 entity.anInt1522 -= animation_1.method258(entity.anInt1521);
  8779.  
  8780.             if (entity.anInt1521 >= animation_1.anInt352
  8781.                     && (entity.anInt1521 < 0 || entity.anInt1521 >= animation_1.anInt352))
  8782.                 entity.anInt1520 = -1;
  8783.         }
  8784.         if (entity.anim != -1 && entity.anInt1529 <= 1) {
  8785.             Animation animation_2 = Animation.anims[entity.anim];
  8786.             if (animation_2.anInt363 == 1 && entity.anInt1542 > 0
  8787.                     && entity.anInt1547 <= loopCycle
  8788.                     && entity.anInt1548 < loopCycle) {
  8789.                 entity.anInt1529 = 1;
  8790.                 return;
  8791.             }
  8792.         }
  8793.         if (entity.anim != -1 && entity.anInt1529 == 0) {
  8794.             Animation animation_3 = Animation.anims[entity.anim];
  8795.             for (entity.anInt1528++; entity.anInt1527 < animation_3.anInt352
  8796.                     && entity.anInt1528 > animation_3
  8797.                             .method258(entity.anInt1527); entity.anInt1527++)
  8798.                 entity.anInt1528 -= animation_3.method258(entity.anInt1527);
  8799.  
  8800.             if (entity.anInt1527 >= animation_3.anInt352) {
  8801.                 entity.anInt1527 -= animation_3.anInt356;
  8802.                 entity.anInt1530++;
  8803.                 if (entity.anInt1530 >= animation_3.anInt362)
  8804.                     entity.anim = -1;
  8805.                 if (entity.anInt1527 < 0
  8806.                         || entity.anInt1527 >= animation_3.anInt352)
  8807.                     entity.anim = -1;
  8808.             }
  8809.             entity.aBoolean1541 = animation_3.aBoolean358;
  8810.         }
  8811.         if (entity.anInt1529 > 0)
  8812.             entity.anInt1529--;
  8813.     }
  8814.  
  8815.     private void drawGameScreen() {
  8816.         if (fullscreenInterfaceID != -1
  8817.                 && (loadingStage == 2 || super.fullGameScreen != null)) {
  8818.             if (loadingStage == 2) {
  8819.                 method119(anInt945, fullscreenInterfaceID);
  8820.                 if (openInterfaceID != -1) {
  8821.                     method119(anInt945, openInterfaceID);
  8822.                 }
  8823.                 anInt945 = 0;
  8824.                 resetAllImageProducers();
  8825.                 super.fullGameScreen.initDrawingArea();
  8826.                 Texture.anIntArray1472 = fullScreenTextureArray;
  8827.                 DrawingArea.setAllPixelsToZero();
  8828.                 welcomeScreenRaised = true;
  8829.                 if (openInterfaceID != -1) {
  8830.                     RSInterface rsInterface_1 = RSInterface.interfaceCache[openInterfaceID];
  8831.                     if (rsInterface_1.width == 512
  8832.                             && rsInterface_1.height == 334
  8833.                             && rsInterface_1.type == 0) {
  8834.                         rsInterface_1.width = 765;
  8835.                         rsInterface_1.height = 503;
  8836.                     }
  8837.                     drawInterface(0, 0, rsInterface_1, 8);
  8838.                 }
  8839.                 RSInterface rsInterface = RSInterface.interfaceCache[fullscreenInterfaceID];
  8840.                 if (rsInterface.width == 512 && rsInterface.height == 334
  8841.                         && rsInterface.type == 0) {
  8842.                     rsInterface.width = 765;
  8843.                     rsInterface.height = 503;
  8844.                 }
  8845.                 drawInterface(0, 0, rsInterface, 8);
  8846.  
  8847.                 if (!menuOpen) {
  8848.                     processRightClick();
  8849.                     drawTooltip();
  8850.                 } else {
  8851.                     drawMenu();
  8852.                 }
  8853.             }
  8854.             drawCount++;
  8855.             super.fullGameScreen.drawGraphics(0, super.graphics, 0);
  8856.             return;
  8857.         } else {
  8858.             if (drawCount != 0) {
  8859.                 resetImageProducers2();
  8860.             }
  8861.         }
  8862.         if (welcomeScreenRaised) {
  8863.             welcomeScreenRaised = false;
  8864.             topFrame.drawGraphics(0, super.graphics, 0);
  8865.             leftFrame.drawGraphics(4, super.graphics, 0);
  8866.             rightFrame.drawGraphics(4, super.graphics, 516);
  8867.             mapEdgeIP.drawGraphics(4, super.graphics, 519);
  8868.             needDrawTabArea = true;
  8869.             inputTaken = true;
  8870.             tabAreaAltered = true;
  8871.             if (loadingStage != 2) {
  8872.                 aRSImageProducer_1165.drawGraphics(4, super.graphics, 4);
  8873.                 aRSImageProducer_1164.drawGraphics(0, super.graphics, 519);
  8874.             }
  8875.         }
  8876.         if (menuOpen && menuScreenArea == 1)
  8877.             needDrawTabArea = true;
  8878.         if (invOverlayInterfaceID != -1) {
  8879.             boolean flag1 = method119(anInt945, invOverlayInterfaceID);
  8880.             if (flag1)
  8881.                 needDrawTabArea = true;
  8882.         }
  8883.         if (atInventoryInterfaceType == 2)
  8884.             needDrawTabArea = true;
  8885.         if (activeInterfaceType == 2)
  8886.             needDrawTabArea = true;
  8887.         if (needDrawTabArea) {
  8888.             drawTabArea();
  8889.             needDrawTabArea = false;
  8890.         }
  8891.         if (backDialogID == -1) {
  8892.             aClass9_1059.scrollPosition = anInt1211 - anInt1089 - 110;
  8893.             if (super.mouseX > 478 && super.mouseX < 580 && super.mouseY > 342)
  8894.                 method65(494, 110, super.mouseX - 0, super.mouseY - 348,
  8895.                         aClass9_1059, 0, false, anInt1211);
  8896.             int i = anInt1211 - 110 - aClass9_1059.scrollPosition;
  8897.             if (i < 0)
  8898.                 i = 0;
  8899.             if (i > anInt1211 - 110)
  8900.                 i = anInt1211 - 110;
  8901.             if (anInt1089 != i) {
  8902.                 anInt1089 = i;
  8903.                 inputTaken = true;
  8904.             }
  8905.         }
  8906.         if (backDialogID != -1) {
  8907.             boolean flag2 = method119(anInt945, backDialogID);
  8908.             if (flag2)
  8909.                 inputTaken = true;
  8910.         }
  8911.         if (atInventoryInterfaceType == 3)
  8912.             inputTaken = true;
  8913.         if (activeInterfaceType == 3)
  8914.             inputTaken = true;
  8915.         if (aString844 != null)
  8916.             inputTaken = true;
  8917.         if (menuOpen && menuScreenArea == 2)
  8918.             inputTaken = true;
  8919.         if (inputTaken) {
  8920.             drawChatArea();
  8921.             inputTaken = false;
  8922.         }
  8923.         if (loadingStage == 2)
  8924.             method146();
  8925.         if (loadingStage == 2) {
  8926.             drawMinimap();
  8927.             aRSImageProducer_1164.drawGraphics(0, super.graphics, 519);
  8928.         }
  8929.         if (anInt1054 != -1)
  8930.             tabAreaAltered = true;
  8931.         if (tabAreaAltered) {
  8932.             if (anInt1054 != -1 && anInt1054 == tabID) {
  8933.                 anInt1054 = -1;
  8934.                 stream.createFrame(120);
  8935.                 stream.writeWordBigEndian(tabID);
  8936.             }
  8937.             tabAreaAltered = false;
  8938.             aRSImageProducer_1125.initDrawingArea();
  8939.             aRSImageProducer_1165.initDrawingArea();
  8940.         }
  8941.         anInt945 = 0;
  8942.     }
  8943.  
  8944.     private boolean buildFriendsListMenu(RSInterface class9) {
  8945.         int i = class9.contentType;
  8946.         if (i >= 1 && i <= 200 || i >= 701 && i <= 900) {
  8947.             if (i >= 801)
  8948.                 i -= 701;
  8949.             else if (i >= 701)
  8950.                 i -= 601;
  8951.             else if (i >= 101)
  8952.                 i -= 101;
  8953.             else
  8954.                 i--;
  8955.             menuActionName[menuActionRow] = "Remove @whi@" + friendsList[i];
  8956.             menuActionID[menuActionRow] = 792;
  8957.             menuActionRow++;
  8958.             menuActionName[menuActionRow] = "Message @whi@" + friendsList[i];
  8959.             menuActionID[menuActionRow] = 639;
  8960.             menuActionRow++;
  8961.             return true;
  8962.         }
  8963.         if (i >= 401 && i <= 500) {
  8964.             menuActionName[menuActionRow] = "Remove @whi@" + class9.message;
  8965.             menuActionID[menuActionRow] = 322;
  8966.             menuActionRow++;
  8967.             return true;
  8968.         } else {
  8969.             return false;
  8970.         }
  8971.     }
  8972.  
  8973.     public void method104() {
  8974.         Animable_Sub3 class30_sub2_sub4_sub3 = (Animable_Sub3) aClass19_1056
  8975.                 .reverseGetFirst();
  8976.         for (; class30_sub2_sub4_sub3 != null; class30_sub2_sub4_sub3 = (Animable_Sub3) aClass19_1056
  8977.                 .reverseGetNext())
  8978.             if (class30_sub2_sub4_sub3.anInt1560 != plane
  8979.                     || class30_sub2_sub4_sub3.aBoolean1567)
  8980.                 class30_sub2_sub4_sub3.unlink();
  8981.             else if (loopCycle >= class30_sub2_sub4_sub3.anInt1564) {
  8982.                 class30_sub2_sub4_sub3.method454(anInt945);
  8983.                 if (class30_sub2_sub4_sub3.aBoolean1567)
  8984.                     class30_sub2_sub4_sub3.unlink();
  8985.                 else
  8986.                     worldController.method285(class30_sub2_sub4_sub3.anInt1560,
  8987.                             0, class30_sub2_sub4_sub3.anInt1563, -1,
  8988.                             class30_sub2_sub4_sub3.anInt1562, 60,
  8989.                             class30_sub2_sub4_sub3.anInt1561,
  8990.                             class30_sub2_sub4_sub3, false);
  8991.             }
  8992.  
  8993.     }
  8994.  
  8995.     private void drawInterface(int j, int k, RSInterface class9, int l) {
  8996.         if (class9.type != 0 || class9.children == null)
  8997.             return;
  8998.         if (class9.isMouseoverTriggered && anInt1026 != class9.id
  8999.                 && anInt1048 != class9.id && anInt1039 != class9.id)
  9000.             return;
  9001.         int i1 = DrawingArea.topX;
  9002.         int j1 = DrawingArea.topY;
  9003.         int k1 = DrawingArea.bottomX;
  9004.         int l1 = DrawingArea.bottomY;
  9005.         DrawingArea.setDrawingArea(l + class9.height, k, k + class9.width, l);
  9006.         int i2 = class9.children.length;
  9007.         for (int j2 = 0; j2 < i2; j2++) {
  9008.             int k2 = class9.childX[j2] + k;
  9009.             int l2 = (class9.childY[j2] + l) - j;
  9010.             RSInterface class9_1 = RSInterface.interfaceCache[class9.children[j2]];
  9011.             k2 += class9_1.anInt263;
  9012.             l2 += class9_1.anInt265;
  9013.             if (class9_1.contentType > 0)
  9014.                 drawFriendsListOrWelcomeScreen(class9_1);
  9015.             // here
  9016.             int[] IDs = { 1196, 1199, 1206, 1215, 1224, 1231, 1240, 1249, 1258,
  9017.                     1267, 1274, 1283, 1573, 1290, 1299, 1308, 1315, 1324, 1333,
  9018.                     1340, 1349, 1358, 1367, 1374, 1381, 1388, 1397, 1404, 1583,
  9019.                     12038, 1414, 1421, 1430, 1437, 1446, 1453, 1460, 1469,
  9020.                     15878, 1602, 1613, 1624, 7456, 1478, 1485, 1494, 1503,
  9021.                     1512, 1521, 1530, 1544, 1553, 1563, 1593, 1635, 12426,
  9022.                     12436, 12446, 12456, 6004, 18471,
  9023.                     /* Ancients */
  9024.                     12940, 12988, 13036, 12902, 12862, 13046, 12964, 13012,
  9025.                     13054, 12920, 12882, 13062, 12952, 13000, 13070, 12912,
  9026.                     12872, 13080, 12976, 13024, 13088, 12930, 12892, 13096 };
  9027.             for (int m5 = 0; m5 < IDs.length; m5++) {
  9028.                 if (class9_1.id == IDs[m5] + 1) {
  9029.                     if (m5 > 61)
  9030.                         drawBlackBox(k2 + 1, l2);
  9031.                     else
  9032.                         drawBlackBox(k2, l2 + 1);
  9033.                 }
  9034.             }
  9035.             int[] runeChildren = { 1202, 1203, 1209, 1210, 1211, 1218, 1219,
  9036.                     1220, 1227, 1228, 1234, 1235, 1236, 1243, 1244, 1245, 1252,
  9037.                     1253, 1254, 1261, 1262, 1263, 1270, 1271, 1277, 1278, 1279,
  9038.                     1286, 1287, 1293, 1294, 1295, 1302, 1303, 1304, 1311, 1312,
  9039.                     1318, 1319, 1320, 1327, 1328, 1329, 1336, 1337, 1343, 1344,
  9040.                     1345, 1352, 1353, 1354, 1361, 1362, 1363, 1370, 1371, 1377,
  9041.                     1378, 1384, 1385, 1391, 1392, 1393, 1400, 1401, 1407, 1408,
  9042.                     1410, 1417, 1418, 1424, 1425, 1426, 1433, 1434, 1440, 1441,
  9043.                     1442, 1449, 1450, 1456, 1457, 1463, 1464, 1465, 1472, 1473,
  9044.                     1474, 1481, 1482, 1488, 1489, 1490, 1497, 1498, 1499, 1506,
  9045.                     1507, 1508, 1515, 1516, 1517, 1524, 1525, 1526, 1533, 1534,
  9046.                     1535, 1547, 1548, 1549, 1556, 1557, 1558, 1566, 1567, 1568,
  9047.                     1576, 1577, 1578, 1586, 1587, 1588, 1596, 1597, 1598, 1605,
  9048.                     1606, 1607, 1616, 1617, 1618, 1627, 1628, 1629, 1638, 1639,
  9049.                     1640, 6007, 6008, 6011, 8673, 8674, 12041, 12042, 12429,
  9050.                     12430, 12431, 12439, 12440, 12441, 12449, 12450, 12451,
  9051.                     12459, 12460, 15881, 15882, 15885, 18474, 18475, 18478 };
  9052.             for (int r = 0; r < runeChildren.length; r++)
  9053.                 if (class9_1.id == runeChildren[r])
  9054.                     class9_1.modelZoom = 775;
  9055.             if (class9_1.type == 0) {
  9056.                 if (class9_1.scrollPosition > class9_1.scrollMax
  9057.                         - class9_1.height)
  9058.                     class9_1.scrollPosition = class9_1.scrollMax
  9059.                             - class9_1.height;
  9060.                 if (class9_1.scrollPosition < 0)
  9061.                     class9_1.scrollPosition = 0;
  9062.                 drawInterface(class9_1.scrollPosition, k2, class9_1, l2);
  9063.                 if (class9_1.scrollMax > class9_1.height) {
  9064.                     // clan chat
  9065.                     if (class9_1.id == 18143) {
  9066.                         int clanMates = 0;
  9067.                         for (int i = 18155; i < 18244; i++) {
  9068.                             RSInterface line = RSInterface.interfaceCache[i];
  9069.                             if (line.message.length() > 0) {
  9070.                                 clanMates++;
  9071.                             }
  9072.                         }
  9073.                         class9_1.scrollMax = (clanMates * 14) + class9_1.height
  9074.                                 + 1;
  9075.                     }
  9076.                     if (class9_1.id == 18322 || class9_1.id == 18423) {
  9077.                         int members = 0;
  9078.                         for (int i = class9_1.id + 1; i < class9_1.id + 1 + 100; i++) {
  9079.                             RSInterface line = RSInterface.interfaceCache[i];
  9080.                             if (line != null && line.message != null) {
  9081.                                 if (line.message.length() > 0) {
  9082.                                     members++;
  9083.                                 }
  9084.                             }
  9085.                         }
  9086.                         class9_1.scrollMax = (members * 14) + 1;
  9087.                     }
  9088.                     drawScrollbar(class9_1.height, class9_1.scrollPosition, l2,
  9089.                             k2 + class9_1.width, class9_1.scrollMax);
  9090.                 }
  9091.             } else if (class9_1.type != 1)
  9092.                 if (class9_1.type == 2) {
  9093.                     int i3 = 0;
  9094.                     for (int l3 = 0; l3 < class9_1.height; l3++) {
  9095.                         for (int l4 = 0; l4 < class9_1.width; l4++) {
  9096.                             int k5 = k2 + l4 * (32 + class9_1.invSpritePadX);
  9097.                             int j6 = l2 + l3 * (32 + class9_1.invSpritePadY);
  9098.                             if (i3 < 20) {
  9099.                                 k5 += class9_1.spritesX[i3];
  9100.                                 j6 += class9_1.spritesY[i3];
  9101.                             }
  9102.                             if (class9_1.inv[i3] > 0) {
  9103.                                 int k6 = 0;
  9104.                                 int j7 = 0;
  9105.                                 int j9 = class9_1.inv[i3] - 1;
  9106.                                 if (k5 > DrawingArea.topX - 32
  9107.                                         && k5 < DrawingArea.bottomX
  9108.                                         && j6 > DrawingArea.topY - 32
  9109.                                         && j6 < DrawingArea.bottomY
  9110.                                         || activeInterfaceType != 0
  9111.                                         && anInt1085 == i3) {
  9112.                                     int l9 = 0;
  9113.                                     if (itemSelected == 1 && anInt1283 == i3
  9114.                                             && anInt1284 == class9_1.id)
  9115.                                         l9 = 0xffffff;
  9116.                                     Sprite class30_sub2_sub1_sub1_2 = ItemDef
  9117.                                             .getSprite(j9,
  9118.                                                     class9_1.invStackSizes[i3],
  9119.                                                     l9);
  9120.                                     if (class30_sub2_sub1_sub1_2 != null) {
  9121.                                         if (activeInterfaceType != 0
  9122.                                                 && anInt1085 == i3
  9123.                                                 && anInt1084 == class9_1.id) {
  9124.                                             k6 = super.mouseX - anInt1087;
  9125.                                             j7 = super.mouseY - anInt1088;
  9126.                                             if (k6 < 5 && k6 > -5)
  9127.                                                 k6 = 0;
  9128.                                             if (j7 < 5 && j7 > -5)
  9129.                                                 j7 = 0;
  9130.                                             if (anInt989 < 12) {
  9131.                                                 k6 = 0;
  9132.                                                 j7 = 0;
  9133.                                             }
  9134.                                             class30_sub2_sub1_sub1_2
  9135.                                                     .drawSprite1(k5 + k6, j6
  9136.                                                             + j7);
  9137.                                             if (j6 + j7 < DrawingArea.topY
  9138.                                                     && class9.scrollPosition > 0) {
  9139.                                                 int i10 = (anInt945 * (DrawingArea.topY
  9140.                                                         - j6 - j7)) / 3;
  9141.                                                 if (i10 > anInt945 * 10)
  9142.                                                     i10 = anInt945 * 10;
  9143.                                                 if (i10 > class9.scrollPosition)
  9144.                                                     i10 = class9.scrollPosition;
  9145.                                                 class9.scrollPosition -= i10;
  9146.                                                 anInt1088 += i10;
  9147.                                             }
  9148.                                             if (j6 + j7 + 32 > DrawingArea.bottomY
  9149.                                                     && class9.scrollPosition < class9.scrollMax
  9150.                                                             - class9.height) {
  9151.                                                 int j10 = (anInt945 * ((j6 + j7 + 32) - DrawingArea.bottomY)) / 3;
  9152.                                                 if (j10 > anInt945 * 10)
  9153.                                                     j10 = anInt945 * 10;
  9154.                                                 if (j10 > class9.scrollMax
  9155.                                                         - class9.height
  9156.                                                         - class9.scrollPosition)
  9157.                                                     j10 = class9.scrollMax
  9158.                                                             - class9.height
  9159.                                                             - class9.scrollPosition;
  9160.                                                 class9.scrollPosition += j10;
  9161.                                                 anInt1088 -= j10;
  9162.                                             }
  9163.                                         } else if (atInventoryInterfaceType != 0
  9164.                                                 && atInventoryIndex == i3
  9165.                                                 && atInventoryInterface == class9_1.id)
  9166.                                             class30_sub2_sub1_sub1_2
  9167.                                                     .drawSprite1(k5, j6);
  9168.                                         else
  9169.                                             class30_sub2_sub1_sub1_2
  9170.                                                     .drawSprite(k5, j6);
  9171.                                         if (class30_sub2_sub1_sub1_2.maxWidth == 33
  9172.                                                 || class9_1.invStackSizes[i3] != 1) {
  9173.                                             int k10 = class9_1.invStackSizes[i3];
  9174.                                             if (k10 >= 1)
  9175.                                                 smallText.method385(0xFFFF00,
  9176.                                                         intToKOrMil(k10), j6
  9177.                                                                 + 9 + j7, k5
  9178.                                                                 + k6);
  9179.                                             smallText.method385(0,
  9180.                                                     intToKOrMil(k10), j6 + 10
  9181.                                                             + j7, k5 + 1 + k6);
  9182.                                             if (k10 > 99999 && k10 < 10000000) {
  9183.                                                 smallText.method385(0xFFFFFF,
  9184.                                                         intToKOrMil(k10), j6
  9185.                                                                 + 9 + j7, k5
  9186.                                                                 + k6);
  9187.                                             } else if (k10 > 9999999) {
  9188.                                                 smallText.method385(0x00ff80,
  9189.                                                         intToKOrMil(k10), j6
  9190.                                                                 + 9 + j7, k5
  9191.                                                                 + k6);
  9192.                                             } else {
  9193.                                                 smallText.method385(0xFFFF00,
  9194.                                                         intToKOrMil(k10), j6
  9195.                                                                 + 9 + j7, k5
  9196.                                                                 + k6);
  9197.                                             }
  9198.  
  9199.                                             /*
  9200.                                              * smallText.method385(0,
  9201.                                              * intToKOrMil(k10), j6 + 10 + j7,
  9202.                                              * k5 + 1 + k6);
  9203.                                              * smallText.method385(0xffff00,
  9204.                                              * intToKOrMil(k10), j6 + 9 + j7, k5
  9205.                                              * + k6);
  9206.                                              */
  9207.                                         }
  9208.                                     }
  9209.                                 }
  9210.                             } else if (class9_1.sprites != null && i3 < 20) {
  9211.                                 Sprite class30_sub2_sub1_sub1_1 = class9_1.sprites[i3];
  9212.                                 if (class30_sub2_sub1_sub1_1 != null)
  9213.                                     class30_sub2_sub1_sub1_1.drawSprite(k5, j6);
  9214.                             }
  9215.                             i3++;
  9216.                         }
  9217.                     }
  9218.                 } else if (class9_1.type == 3) {
  9219.                     boolean flag = false;
  9220.                     if (anInt1039 == class9_1.id || anInt1048 == class9_1.id
  9221.                             || anInt1026 == class9_1.id)
  9222.                         flag = true;
  9223.                     int j3;
  9224.                     if (interfaceIsSelected(class9_1)) {
  9225.                         j3 = class9_1.anInt219;
  9226.                         if (flag && class9_1.anInt239 != 0)
  9227.                             j3 = class9_1.anInt239;
  9228.                     } else {
  9229.                         j3 = class9_1.textColor;
  9230.                         if (flag && class9_1.anInt216 != 0)
  9231.                             j3 = class9_1.anInt216;
  9232.                     }
  9233.                     if (class9_1.aByte254 == 0) {
  9234.                         if (class9_1.aBoolean227)
  9235.                             DrawingArea.drawPixels(class9_1.height, l2, k2, j3,
  9236.                                     class9_1.width);
  9237.                         else
  9238.                             DrawingArea.fillPixels(k2, class9_1.width,
  9239.                                     class9_1.height, j3, l2);
  9240.                     } else if (class9_1.aBoolean227)
  9241.                         DrawingArea.method335(j3, l2, class9_1.width,
  9242.                                 class9_1.height,
  9243.                                 256 - (class9_1.aByte254 & 0xff), k2);
  9244.                     else
  9245.                         DrawingArea.method338(l2, class9_1.height,
  9246.                                 256 - (class9_1.aByte254 & 0xff), j3,
  9247.                                 class9_1.width, k2);
  9248.                 } else if (class9_1.type == 4) {
  9249.                     TextDrawingArea textDrawingArea = class9_1.textDrawingAreas;
  9250.                     String s = class9_1.message;
  9251.                     boolean flag1 = false;
  9252.                     if (anInt1039 == class9_1.id || anInt1048 == class9_1.id
  9253.                             || anInt1026 == class9_1.id)
  9254.                         flag1 = true;
  9255.                     int i4;
  9256.                     if (interfaceIsSelected(class9_1)) {
  9257.                         i4 = class9_1.anInt219;
  9258.                         if (flag1 && class9_1.anInt239 != 0)
  9259.                             i4 = class9_1.anInt239;
  9260.                         if (class9_1.aString228.length() > 0)
  9261.                             s = class9_1.aString228;
  9262.                     } else {
  9263.                         i4 = class9_1.textColor;
  9264.                         if (flag1 && class9_1.anInt216 != 0)
  9265.                             i4 = class9_1.anInt216;
  9266.                     }
  9267.                     if (class9_1.atActionType == 6 && aBoolean1149) {
  9268.                         s = "Please wait...";
  9269.                         i4 = class9_1.textColor;
  9270.                     }
  9271.                     if (DrawingArea.width == 519) {
  9272.                         if (i4 == 0xffff00)
  9273.                             i4 = 255;
  9274.                         if (i4 == 49152)
  9275.                             i4 = 0xffffff;
  9276.                     }
  9277.                     if ((class9_1.parentID == 1151)
  9278.                             || (class9_1.parentID == 12855)) {
  9279.                         switch (i4) {
  9280.                         case 16773120:
  9281.                             i4 = 0xFE981F;
  9282.                             break;
  9283.                         case 7040819:
  9284.                             i4 = 0xAF6A1A;
  9285.                             break;
  9286.                         }
  9287.                     }
  9288.                     for (int l6 = l2 + textDrawingArea.anInt1497; s.length() > 0; l6 += textDrawingArea.anInt1497) {
  9289.                         if (s.indexOf("%") != -1) {
  9290.                             do {
  9291.                                 int k7 = s.indexOf("%1");
  9292.                                 if (k7 == -1)
  9293.                                     break;
  9294.                                 if (class9_1.id < 4000 || class9_1.id > 5000
  9295.                                         && class9_1.id != 13921
  9296.                                         && class9_1.id != 13922
  9297.                                         && class9_1.id != 12171
  9298.                                         && class9_1.id != 12172)
  9299.                                     s = s.substring(0, k7)
  9300.                                             + methodR(extractInterfaceValues(
  9301.                                                     class9_1, 0))
  9302.                                             + s.substring(k7 + 2);
  9303.                                 else
  9304.                                     s = s.substring(0, k7)
  9305.                                             + interfaceIntToString(extractInterfaceValues(
  9306.                                                     class9_1, 0))
  9307.                                             + s.substring(k7 + 2);
  9308.                             } while (true);
  9309.                             do {
  9310.                                 int l7 = s.indexOf("%2");
  9311.                                 if (l7 == -1)
  9312.                                     break;
  9313.                                 s = s.substring(0, l7)
  9314.                                         + interfaceIntToString(extractInterfaceValues(
  9315.                                                 class9_1, 1))
  9316.                                         + s.substring(l7 + 2);
  9317.                             } while (true);
  9318.                             do {
  9319.                                 int i8 = s.indexOf("%3");
  9320.                                 if (i8 == -1)
  9321.                                     break;
  9322.                                 s = s.substring(0, i8)
  9323.                                         + interfaceIntToString(extractInterfaceValues(
  9324.                                                 class9_1, 2))
  9325.                                         + s.substring(i8 + 2);
  9326.                             } while (true);
  9327.                             do {
  9328.                                 int j8 = s.indexOf("%4");
  9329.                                 if (j8 == -1)
  9330.                                     break;
  9331.                                 s = s.substring(0, j8)
  9332.                                         + interfaceIntToString(extractInterfaceValues(
  9333.                                                 class9_1, 3))
  9334.                                         + s.substring(j8 + 2);
  9335.                             } while (true);
  9336.                             do {
  9337.                                 int k8 = s.indexOf("%5");
  9338.                                 if (k8 == -1)
  9339.                                     break;
  9340.                                 s = s.substring(0, k8)
  9341.                                         + interfaceIntToString(extractInterfaceValues(
  9342.                                                 class9_1, 4))
  9343.                                         + s.substring(k8 + 2);
  9344.                             } while (true);
  9345.                         }
  9346.                         int l8 = s.indexOf("\\n");
  9347.                         String s1;
  9348.                         if (l8 != -1) {
  9349.                             s1 = s.substring(0, l8);
  9350.                             s = s.substring(l8 + 2);
  9351.                         } else {
  9352.                             s1 = s;
  9353.                             s = "";
  9354.                         }
  9355.                         RSFont font = null;
  9356.                         if (textDrawingArea == smallText) {
  9357.                             font = newSmallFont;
  9358.                         } else if (textDrawingArea == aTextDrawingArea_1271) {
  9359.                             font = newRegularFont;
  9360.                         } else if (textDrawingArea == chatTextDrawingArea) {
  9361.                             font = newBoldFont;
  9362.                         } else if (textDrawingArea == aTextDrawingArea_1273) {
  9363.                             font = newFancyFont;
  9364.                         }
  9365.                         if (class9_1.centerText) {
  9366.                             font.drawCenteredString(s1,
  9367.                                     k2 + class9_1.width / 2, l6, i4,
  9368.                                     class9_1.textShadow ? 0 : -1);
  9369.                         } else {
  9370.                             font.drawBasicString(s1, k2, l6, i4,
  9371.                                     class9_1.textShadow ? 0 : -1);
  9372.                         }
  9373.                     }
  9374.                 } else if (class9_1.type == 5) {
  9375.                     Sprite image;
  9376.                     Sprite hover;
  9377.                     if (interfaceIsSelected(class9_1)) {
  9378.                         image = class9_1.sprite2;
  9379.                         hover = class9_1.enabledHover;
  9380.                     } else {
  9381.                         image = class9_1.sprite1;
  9382.                         hover = class9_1.disabledHover;
  9383.                     }
  9384.                     if (image != null) {
  9385.                         if (spellSelected == 1 && class9_1.id == spellID
  9386.                                 && spellID != 0) {
  9387.                             image.drawSprite(k2, l2, 0xffffff);
  9388.                         } else {
  9389.                             image.drawSprite(k2, l2);
  9390.                         }
  9391.                         if (hover != null) {
  9392.                             if (hoverId == class9_1.id) {
  9393.                                 hover.drawSprite(k2, l2);
  9394.                             }
  9395.                         }
  9396.                     }
  9397.                 } else if (class9_1.type == 6) {
  9398.                     int k3 = Texture.textureInt1;
  9399.                     int j4 = Texture.textureInt2;
  9400.                     Texture.textureInt1 = k2 + class9_1.width / 2;
  9401.                     Texture.textureInt2 = l2 + class9_1.height / 2;
  9402.                     int i5 = Texture.anIntArray1470[class9_1.modelRotation1]
  9403.                             * class9_1.modelZoom >> 16;
  9404.                     int l5 = Texture.anIntArray1471[class9_1.modelRotation1]
  9405.                             * class9_1.modelZoom >> 16;
  9406.                     boolean flag2 = interfaceIsSelected(class9_1);
  9407.                     int i7;
  9408.                     if (flag2)
  9409.                         i7 = class9_1.anInt258;
  9410.                     else
  9411.                         i7 = class9_1.anInt257;
  9412.                     Model model;
  9413.                     if (i7 == -1) {
  9414.                         model = class9_1.method209(-1, -1, flag2);
  9415.                     } else {
  9416.                         Animation animation = Animation.anims[i7];
  9417.                         model = class9_1.method209(
  9418.                                 animation.anIntArray354[class9_1.anInt246],
  9419.                                 animation.anIntArray353[class9_1.anInt246],
  9420.                                 flag2);
  9421.                     }
  9422.                     if (model != null)
  9423.                         model.method482(class9_1.modelRotation2, 0,
  9424.                                 class9_1.modelRotation1, 0, i5, l5);
  9425.                     Texture.textureInt1 = k3;
  9426.                     Texture.textureInt2 = j4;
  9427.                 } else if (class9_1.type == 7) {
  9428.                     TextDrawingArea textDrawingArea_1 = class9_1.textDrawingAreas;
  9429.                     int k4 = 0;
  9430.                     for (int j5 = 0; j5 < class9_1.height; j5++) {
  9431.                         for (int i6 = 0; i6 < class9_1.width; i6++) {
  9432.                             if (class9_1.inv[k4] > 0) {
  9433.                                 ItemDef itemDef = ItemDef
  9434.                                         .forID(class9_1.inv[k4] - 1);
  9435.                                 String s2 = itemDef.name;
  9436.                                 if (itemDef.stackable
  9437.                                         || class9_1.invStackSizes[k4] != 1)
  9438.                                     s2 = s2
  9439.                                             + " x"
  9440.                                             + intToKOrMilLongName(class9_1.invStackSizes[k4]);
  9441.                                 int i9 = k2 + i6
  9442.                                         * (115 + class9_1.invSpritePadX);
  9443.                                 int k9 = l2 + j5
  9444.                                         * (12 + class9_1.invSpritePadY);
  9445.                                 if (class9_1.centerText)
  9446.                                     textDrawingArea_1.method382(
  9447.                                             class9_1.textColor, i9
  9448.                                                     + class9_1.width / 2, s2,
  9449.                                             k9, class9_1.textShadow);
  9450.                                 else
  9451.                                     textDrawingArea_1.method389(
  9452.                                             class9_1.textShadow, i9,
  9453.                                             class9_1.textColor, s2, k9);
  9454.                             }
  9455.                             k4++;
  9456.                         }
  9457.                     }
  9458.                 }
  9459.             if (class9_1.type == 8
  9460.                     && (anInt1500 == class9_1.id || anInt1044 == class9_1.id || anInt1129 == class9_1.id)
  9461.                     && anInt1501 == 100) {
  9462.  
  9463.                 int boxWidth = 0;
  9464.                 int boxHeight = 0;
  9465.                 TextDrawingArea textDrawingArea_2 = class9_1.textDrawingAreas;
  9466.                 for (String s1 = class9_1.message; s1.length() > 0;) {
  9467.                     int l7 = s1.indexOf("\\n");
  9468.                     String s4;
  9469.                     if (l7 != -1) {
  9470.                         s4 = s1.substring(0, l7);
  9471.                         s1 = s1.substring(l7 + 2);
  9472.                     } else {
  9473.                         s4 = s1;
  9474.                         s1 = "";
  9475.                     }
  9476.                     int j10 = textDrawingArea_2.getTextWidth(s4);
  9477.                     if (j10 > boxWidth) {
  9478.                         boxWidth = j10;
  9479.                     }
  9480.                     boxHeight += textDrawingArea_2.anInt1497 + 1;
  9481.                 }
  9482.                 boxWidth += 6;
  9483.                 boxHeight += 7;
  9484.                 int xPos = (k2 + class9_1.width) - 5 - boxWidth;
  9485.                 int yPos = l2 + class9_1.height + 5;
  9486.                 if (xPos < k2 + 5) {
  9487.                     xPos = k2 + 5;
  9488.                 }
  9489.                 if (xPos + boxWidth > k + class9.width) {
  9490.                     xPos = (k + class9.width) - boxWidth;
  9491.                 }
  9492.                 if (yPos + boxHeight > l + class9.height) {
  9493.                     yPos = (l + class9.height) - boxHeight;
  9494.                 }
  9495.                 /*
  9496.                  * if(class9_1.inventoryhover){ if(xPos + boxWidth+k > 249){
  9497.                  * xPos = 251 - boxWidth-k; } if(yPos+boxHeight+l >261 ){ yPos =
  9498.                  * 245 - boxHeight - l; } }
  9499.                  */
  9500.                 switch (class9_1.id) {
  9501.                 case 9217:
  9502.                 case 9220:
  9503.                 case 9223:
  9504.                 case 9226:
  9505.                 case 9229:
  9506.                 case 9232:
  9507.                 case 9235:
  9508.                 case 9238:
  9509.                     xPos -= 80;
  9510.                     break;
  9511.                 case 9239:
  9512.                     yPos -= 100;
  9513.                     break;
  9514.                 }
  9515.                 DrawingArea
  9516.                         .method336(boxHeight, yPos, xPos, 0xFFFFA0, boxWidth);
  9517.                 DrawingArea.fillPixels(xPos, boxWidth, boxHeight, 0, yPos);
  9518.                 String s2 = class9_1.message;
  9519.                 for (int j11 = yPos + textDrawingArea_2.anInt1497 + 2; s2
  9520.                         .length() > 0; j11 += textDrawingArea_2.anInt1497 + 1) {// anInt1497
  9521.                     int l11 = s2.indexOf("\\n");
  9522.                     String s5;
  9523.                     if (l11 != -1) {
  9524.                         s5 = s2.substring(0, l11);
  9525.                         s2 = s2.substring(l11 + 2);
  9526.                     } else {
  9527.                         s5 = s2;
  9528.                         s2 = "";
  9529.                     }
  9530.                     textDrawingArea_2.method389(false, xPos + 3, 0, s5, j11);
  9531.                 }
  9532.                 // }
  9533.                 DrawingArea.setDrawingArea(l1, i1, k1, j1);
  9534.             }
  9535.             if (class9_1.type == 12) {
  9536.                 Sprite sprite;
  9537.                 if (interfaceIsSelected(class9_1))
  9538.                     sprite = class9_1.sprite2;
  9539.                 else
  9540.                     sprite = class9_1.sprite1;
  9541.                 if (sprite != null)
  9542.                     sprite.drawAdvancedSprite(k2, l2);
  9543.             } else if (class9_1.type == 9) {
  9544.                 drawHoverBox(k2, l2, class9_1.message);
  9545.             }
  9546.         }
  9547.         DrawingArea.setDrawingArea(l1, i1, k1, j1);
  9548.     }
  9549.  
  9550.     public final String methodR(int j) {
  9551.         if (j >= 0 && j < 10000)
  9552.             return String.valueOf(j);
  9553.         if (j >= 10000 && j < 10000000)
  9554.             return j / 1000 + "K";
  9555.         if (j >= 10000000 && j < 999999999)
  9556.             return j / 1000000 + "M";
  9557.         if (j >= 999999999)
  9558.             return "*";
  9559.         else
  9560.             return "?";
  9561.     }
  9562.  
  9563.     public void drawHoverBox(int xPos, int yPos, String text) {
  9564.         String[] results = text.split("\n");
  9565.         int height = (results.length * 16) + 3;
  9566.         int width;
  9567.         width = aTextDrawingArea_1271.getTextWidth(results[0]) + 6;
  9568.         for (int i = 1; i < results.length; i++)
  9569.             if (width <= aTextDrawingArea_1271.getTextWidth(results[i]) + 6)
  9570.                 width = aTextDrawingArea_1271.getTextWidth(results[i]) + 6;
  9571.         DrawingArea.drawPixels(height, yPos, xPos, 0xFFFFA0, width);
  9572.         DrawingArea.fillPixels(xPos, width, height, 0, yPos);
  9573.         yPos += 14;
  9574.         for (int i = 0; i < results.length; i++) {
  9575.             aTextDrawingArea_1271.method389(false, xPos + 3, 0, results[i],
  9576.                     yPos);
  9577.             yPos += 16;
  9578.         }
  9579.     }
  9580.  
  9581.     public void drawBlackBox(int xPos, int yPos) {
  9582.         DrawingArea.drawPixels(71, yPos - 1, xPos - 2, 0x726451, 1);
  9583.         DrawingArea.drawPixels(69, yPos, xPos + 174, 0x726451, 1);
  9584.         DrawingArea.drawPixels(1, yPos - 2, xPos - 2, 0x726451, 178);
  9585.         DrawingArea.drawPixels(1, yPos + 68, xPos, 0x726451, 174);
  9586.         DrawingArea.drawPixels(71, yPos - 1, xPos - 1, 0x2E2B23, 1);
  9587.         DrawingArea.drawPixels(71, yPos - 1, xPos + 175, 0x2E2B23, 1);
  9588.         DrawingArea.drawPixels(1, yPos - 1, xPos, 0x2E2B23, 175);
  9589.         DrawingArea.drawPixels(1, yPos + 69, xPos, 0x2E2B23, 175);
  9590.         DrawingArea.method335(0, yPos, 174, 68, 220, xPos);
  9591.     }
  9592.  
  9593.     public void randomizeBackground(Background background) {
  9594.         int j = 256;
  9595.         for (int k = 0; k < anIntArray1190.length; k++)
  9596.             anIntArray1190[k] = 0;
  9597.  
  9598.         for (int l = 0; l < 5000; l++) {
  9599.             int i1 = (int) (Math.random() * 128D * j);
  9600.             anIntArray1190[i1] = (int) (Math.random() * 256D);
  9601.         }
  9602.         for (int j1 = 0; j1 < 20; j1++) {
  9603.             for (int k1 = 1; k1 < j - 1; k1++) {
  9604.                 for (int i2 = 1; i2 < 127; i2++) {
  9605.                     int k2 = i2 + (k1 << 7);
  9606.                     anIntArray1191[k2] = (anIntArray1190[k2 - 1]
  9607.                             + anIntArray1190[k2 + 1] + anIntArray1190[k2 - 128] + anIntArray1190[k2 + 128]) / 4;
  9608.                 }
  9609.  
  9610.             }
  9611.             int ai[] = anIntArray1190;
  9612.             anIntArray1190 = anIntArray1191;
  9613.             anIntArray1191 = ai;
  9614.         }
  9615.         if (background != null) {
  9616.             int l1 = 0;
  9617.             for (int j2 = 0; j2 < background.anInt1453; j2++) {
  9618.                 for (int l2 = 0; l2 < background.anInt1452; l2++)
  9619.                     if (background.aByteArray1450[l1++] != 0) {
  9620.                         int i3 = l2 + 16 + background.anInt1454;
  9621.                         int j3 = j2 + 16 + background.anInt1455;
  9622.                         int k3 = i3 + (j3 << 7);
  9623.                         anIntArray1190[k3] = 0;
  9624.                     }
  9625.             }
  9626.         }
  9627.     }
  9628.  
  9629.     private void method107(int i, int j, Stream stream, Player player) {
  9630.         if ((i & 0x400) != 0) {
  9631.             player.anInt1543 = stream.method428();
  9632.             player.anInt1545 = stream.method428();
  9633.             player.anInt1544 = stream.method428();
  9634.             player.anInt1546 = stream.method428();
  9635.             player.anInt1547 = stream.method436() + loopCycle;
  9636.             player.anInt1548 = stream.method435() + loopCycle;
  9637.             player.anInt1549 = stream.method428();
  9638.             player.method446();
  9639.         }
  9640.         if ((i & 0x100) != 0) {
  9641.             player.anInt1520 = stream.method434();
  9642.             int k = stream.readDWord();
  9643.             player.anInt1524 = k >> 16;
  9644.             player.anInt1523 = loopCycle + (k & 0xffff);
  9645.             player.anInt1521 = 0;
  9646.             player.anInt1522 = 0;
  9647.             if (player.anInt1523 > loopCycle)
  9648.                 player.anInt1521 = -1;
  9649.             if (player.anInt1520 == 65535)
  9650.                 player.anInt1520 = -1;
  9651.         }
  9652.         if ((i & 8) != 0) {
  9653.             int l = stream.method434();
  9654.             if (l == 65535)
  9655.                 l = -1;
  9656.             int i2 = stream.method427();
  9657.             if (l == player.anim && l != -1) {
  9658.                 int i3 = Animation.anims[l].anInt365;
  9659.                 if (i3 == 1) {
  9660.                     player.anInt1527 = 0;
  9661.                     player.anInt1528 = 0;
  9662.                     player.anInt1529 = i2;
  9663.                     player.anInt1530 = 0;
  9664.                 }
  9665.                 if (i3 == 2)
  9666.                     player.anInt1530 = 0;
  9667.             } else if (l == -1
  9668.                     || player.anim == -1
  9669.                     || Animation.anims[l].anInt359 >= Animation.anims[player.anim].anInt359) {
  9670.                 player.anim = l;
  9671.                 player.anInt1527 = 0;
  9672.                 player.anInt1528 = 0;
  9673.                 player.anInt1529 = i2;
  9674.                 player.anInt1530 = 0;
  9675.                 player.anInt1542 = player.smallXYIndex;
  9676.             }
  9677.         }
  9678.         if ((i & 4) != 0) {
  9679.             player.textSpoken = stream.readString();
  9680.             if (player.textSpoken.charAt(0) == '~') {
  9681.                 player.textSpoken = player.textSpoken.substring(1);
  9682.                 pushMessage(player.textSpoken, 2, player.name);
  9683.             } else if (player == myPlayer)
  9684.                 pushMessage(player.textSpoken, 2, player.name);
  9685.             player.anInt1513 = 0;
  9686.             player.anInt1531 = 0;
  9687.             player.textCycle = 150;
  9688.         }
  9689.         if ((i & 0x80) != 0) {
  9690.             int i1 = stream.method434();
  9691.             int j2 = stream.readUnsignedByte();
  9692.             int j3 = stream.method427();
  9693.             int k3 = stream.currentOffset;
  9694.             if (player.name != null && player.visible) {
  9695.                 long l3 = TextClass.longForName(player.name);
  9696.                 boolean flag = false;
  9697.                 if (j2 <= 1) {
  9698.                     for (int i4 = 0; i4 < ignoreCount; i4++) {
  9699.                         if (ignoreListAsLongs[i4] != l3)
  9700.                             continue;
  9701.                         flag = true;
  9702.                         break;
  9703.                     }
  9704.  
  9705.                 }
  9706.                 // how others see when you type in clientg
  9707.                 if (!flag && anInt1251 == 0)
  9708.                     try {
  9709.                         aStream_834.currentOffset = 0;
  9710.                         stream.method442(j3, 0, aStream_834.buffer);
  9711.                         aStream_834.currentOffset = 0;
  9712.                         String s = TextInput.method525(j3, aStream_834);
  9713.                         player.textSpoken = s;
  9714.                         player.anInt1513 = i1 >> 8;
  9715.                         player.privelage = j2;
  9716.                         player.anInt1531 = i1 & 0xff;
  9717.                         player.textCycle = 150;
  9718.                         String cr = "";
  9719.                         if (j2 == 9)
  9720.                             cr = "@cr9@";
  9721.                         if (j2 == 8)
  9722.                             cr = "@cr8@";
  9723.                         if (j2 == 7)
  9724.                             cr = "@cr7@";
  9725.                         if (j2 == 6)
  9726.                             cr = "@cr6@";
  9727.                         if (j2 == 5)
  9728.                             cr = "@cr5@";
  9729.                         if (j2 == 4)
  9730.                             cr = "@cr4@";
  9731.                         if (j2 == 3)
  9732.                             cr = "@cr3@";
  9733.                         if (j2 == 2)
  9734.                             cr = "@cr2@";
  9735.                         if (j2 == 1)
  9736.                             cr = "@cr1@";
  9737.                         pushMessage(s, 2,
  9738.                                 cr + "<col=" + titleColor(player.titleColor, 0)
  9739.                                         + ">" + player.title + "</col>"
  9740.                                         + player.name);
  9741.                     } catch (Exception exception) {
  9742.                         signlink.reporterror("cde2");
  9743.                     }
  9744.             }
  9745.             stream.currentOffset = k3 + j3;
  9746.         }
  9747.         if ((i & 1) != 0) {
  9748.             player.interactingEntity = stream.method434();
  9749.             if (player.interactingEntity == 65535)
  9750.                 player.interactingEntity = -1;
  9751.         }
  9752.         if ((i & 0x10) != 0) {
  9753.             int j1 = stream.method427();
  9754.             byte abyte0[] = new byte[j1];
  9755.             Stream stream_1 = new Stream(abyte0);
  9756.             stream.readBytes(j1, 0, abyte0);
  9757.             aStreamArray895s[j] = stream_1;
  9758.             player.updatePlayer(stream_1);
  9759.         }
  9760.         if ((i & 2) != 0) {
  9761.             player.anInt1538 = stream.method436();
  9762.             player.anInt1539 = stream.method434();
  9763.         }
  9764.         if ((i & 0x20) != 0) {
  9765.             int k1 = stream.readUnsignedByte();
  9766.             int k2 = stream.method426();
  9767.             player.updateHitData(k2, k1, loopCycle);
  9768.             player.loopCycleStatus = loopCycle + 300;
  9769.             player.currentHealth = stream.method427();
  9770.             player.maxHealth = stream.readUnsignedByte();
  9771.         }
  9772.         if ((i & 0x200) != 0) {
  9773.             int l1 = stream.readUnsignedByte();
  9774.             int l2 = stream.method428();
  9775.             player.updateHitData(l2, l1, loopCycle);
  9776.             player.loopCycleStatus = loopCycle + 300;
  9777.             player.currentHealth = stream.readUnsignedByte();
  9778.             player.maxHealth = stream.method427();
  9779.         }
  9780.     }
  9781.  
  9782.     public void method108() {
  9783.         try {
  9784.             int j = myPlayer.x + cameraOffsetX;
  9785.             int k = myPlayer.y + cameraOffsetY;
  9786.             if (anInt1014 - j < -500 || anInt1014 - j > 500
  9787.                     || anInt1015 - k < -500 || anInt1015 - k > 500) {
  9788.                 anInt1014 = j;
  9789.                 anInt1015 = k;
  9790.             }
  9791.             if (anInt1014 != j)
  9792.                 anInt1014 += (j - anInt1014) / 16;
  9793.             if (anInt1015 != k)
  9794.                 anInt1015 += (k - anInt1015) / 16;
  9795.             if (super.keyArray[1] == 1)
  9796.                 anInt1186 += (-24 - anInt1186) / 2;
  9797.             else if (super.keyArray[2] == 1)
  9798.                 anInt1186 += (24 - anInt1186) / 2;
  9799.             else
  9800.                 anInt1186 /= 2;
  9801.             if (super.keyArray[3] == 1)
  9802.                 anInt1187 += (12 - anInt1187) / 2;
  9803.             else if (super.keyArray[4] == 1)
  9804.                 anInt1187 += (-12 - anInt1187) / 2;
  9805.             else
  9806.                 anInt1187 /= 2;
  9807.             viewRotation = viewRotation + anInt1186 / 2 & 0x7ff;
  9808.             anInt1184 += anInt1187 / 2;
  9809.             if (anInt1184 < 128)
  9810.                 anInt1184 = 128;
  9811.             if (anInt1184 > 383)
  9812.                 anInt1184 = 383;
  9813.             int l = anInt1014 >> 7;
  9814.             int i1 = anInt1015 >> 7;
  9815.             int j1 = method42(plane, anInt1015, anInt1014);
  9816.             int k1 = 0;
  9817.             if (l > 3 && i1 > 3 && l < 100 && i1 < 100) {
  9818.                 for (int l1 = l - 4; l1 <= l + 4; l1++) {
  9819.                     for (int k2 = i1 - 4; k2 <= i1 + 4; k2++) {
  9820.                         int l2 = plane;
  9821.                         if (l2 < 3 && (byteGroundArray[1][l1][k2] & 2) == 2)
  9822.                             l2++;
  9823.                         int i3 = j1 - intGroundArray[l2][l1][k2];
  9824.                         if (i3 > k1)
  9825.                             k1 = i3;
  9826.                     }
  9827.  
  9828.                 }
  9829.  
  9830.             }
  9831.             anInt1005++;
  9832.             if (anInt1005 > 1512) {
  9833.                 anInt1005 = 0;
  9834.                 stream.createFrame(77);
  9835.                 stream.writeWordBigEndian(0);
  9836.                 int i2 = stream.currentOffset;
  9837.                 stream.writeWordBigEndian((int) (Math.random() * 256D));
  9838.                 stream.writeWordBigEndian(101);
  9839.                 stream.writeWordBigEndian(233);
  9840.                 stream.writeWord(45092);
  9841.                 if ((int) (Math.random() * 2D) == 0)
  9842.                     stream.writeWord(35784);
  9843.                 stream.writeWordBigEndian((int) (Math.random() * 256D));
  9844.                 stream.writeWordBigEndian(64);
  9845.                 stream.writeWordBigEndian(38);
  9846.                 stream.writeWord((int) (Math.random() * 65536D));
  9847.                 stream.writeWord((int) (Math.random() * 65536D));
  9848.                 stream.writeBytes(stream.currentOffset - i2);
  9849.             }
  9850.             int j2 = k1 * 192;
  9851.             if (j2 > 0x17f00)
  9852.                 j2 = 0x17f00;
  9853.             if (j2 < 32768)
  9854.                 j2 = 32768;
  9855.             if (j2 > anInt984) {
  9856.                 anInt984 += (j2 - anInt984) / 24;
  9857.                 return;
  9858.             }
  9859.             if (j2 < anInt984) {
  9860.                 anInt984 += (j2 - anInt984) / 80;
  9861.             }
  9862.         } catch (Exception _ex) {
  9863.             signlink.reporterror("glfc_ex " + myPlayer.x + "," + myPlayer.y
  9864.                     + "," + anInt1014 + "," + anInt1015 + "," + anInt1069 + ","
  9865.                     + anInt1070 + "," + baseX + "," + baseY);
  9866.             throw new RuntimeException("eek");
  9867.         }
  9868.     }
  9869.  
  9870.     @Override
  9871.     public void processDrawing() {
  9872.         if (rsAlreadyLoaded || loadingError || genericLoadingError) {
  9873.             showErrorScreen();
  9874.             return;
  9875.         }
  9876.         anInt1061++;
  9877.         if (!loggedIn)
  9878.             drawLoginScreen(false);
  9879.         else
  9880.             drawGameScreen();
  9881.         anInt1213 = 0;
  9882.     }
  9883.  
  9884.     private boolean isFriendOrSelf(String s) {
  9885.         if (s == null)
  9886.             return false;
  9887.         for (int i = 0; i < friendsCount; i++)
  9888.             if (s.equalsIgnoreCase(friendsList[i]))
  9889.                 return true;
  9890.         return s.equalsIgnoreCase(myPlayer.name);
  9891.     }
  9892.  
  9893.     private static String combatDiffColor(int i, int j) {
  9894.         int k = i - j;
  9895.         if (k < -9)
  9896.             return "@red@";
  9897.         if (k < -6)
  9898.             return "@or3@";
  9899.         if (k < -3)
  9900.             return "@or2@";
  9901.         if (k < 0)
  9902.             return "@or1@";
  9903.         if (k > 9)
  9904.             return "@gre@";
  9905.         if (k > 6)
  9906.             return "@gr3@";
  9907.         if (k > 3)
  9908.             return "@gr2@";
  9909.         if (k > 0)
  9910.             return "@gr1@";
  9911.         else
  9912.             return "@yel@";
  9913.     }
  9914.  
  9915.     public void setWaveVolume(int i) {
  9916.         signlink.wavevol = i;
  9917.     }
  9918.  
  9919.     private void processMinimapActions() {
  9920.         if (super.mouseX >= 542 && super.mouseX <= 579 && super.mouseY >= 2
  9921.                 && super.mouseY <= 38) {
  9922.             menuActionName[1] = "Face North";
  9923.             menuActionID[1] = 696;
  9924.             menuActionRow = 2;
  9925.         }
  9926.         if (counterHover) {
  9927.             menuActionName[2] = counterOn ? "Toggle XP Display"
  9928.                     : "Toggle XP Display";
  9929.             menuActionID[2] = 474;
  9930.             menuActionName[1] = "Reset XP Total";
  9931.             menuActionID[1] = 475;
  9932.             menuActionRow = 3;
  9933.         }
  9934.         if (runHover) {
  9935.             menuActionName[1] = !runClicked ? "Turn run mode on"
  9936.                     : "Turn run mode off";
  9937.             menuActionID[1] = 1050;
  9938.             menuActionRow = 2;
  9939.         }
  9940.  
  9941.         /* Camera Buttons */
  9942.         else if (super.mouseX >= 746 && super.mouseX <= 759
  9943.                 && super.mouseY >= 134 &&
  9944.  
  9945.                 super.mouseY < 146) {
  9946.             menuActionName[1] = "Zoom In";
  9947.             menuActionID[1] = 1850;
  9948.             menuActionRow = 2;
  9949.         } else if (super.mouseX >= 746 && super.mouseX <= 759
  9950.                 && super.mouseY >= 151 &&
  9951.  
  9952.                 super.mouseY < 163) {
  9953.             menuActionName[1] = "Zoom Out";
  9954.             menuActionID[1] = 1800;
  9955.             menuActionRow = 2;
  9956.         }
  9957.     }
  9958.  
  9959.     private void draw3dScreen() {
  9960.         if (counterOn) {
  9961.             drawCounterOnScreen();
  9962.         }
  9963.         drawSplitPrivateChat();
  9964.         if (crossType == 1) {
  9965.             crosses[crossIndex / 100]
  9966.                     .drawSprite(crossX - 8 - 4, crossY - 8 - 4);
  9967.             anInt1142++;
  9968.             if (anInt1142 > 67) {
  9969.                 anInt1142 = 0;
  9970.                 stream.createFrame(78);
  9971.             }
  9972.         }
  9973.         if (crossType == 2)
  9974.             crosses[4 + crossIndex / 100].drawSprite(crossX - 8 - 4,
  9975.                     crossY - 8 - 4);
  9976.         if (anInt1018 != -1) {
  9977.             method119(anInt945, anInt1018);
  9978.             drawInterface(0, 0, RSInterface.interfaceCache[anInt1018], 0);
  9979.         }
  9980.         if (openInterfaceID != -1) {
  9981.             method119(anInt945, openInterfaceID);
  9982.             drawInterface(0, 0, RSInterface.interfaceCache[openInterfaceID], 0);
  9983.         }
  9984.         method70();
  9985.         if (!menuOpen) {
  9986.             processRightClick();
  9987.             drawTooltip();
  9988.         } else if (menuScreenArea == 0)
  9989.             drawMenu();
  9990.         if (anInt1055 == 1)
  9991.             multiOverlay.drawSprite(472, 296);
  9992.         if (fpsOn) {
  9993.             char c = '\u01FB';
  9994.             int k = 20;
  9995.             int i1 = 0xffff00;
  9996.             if (super.fps < 15)
  9997.                 i1 = 0xff0000;
  9998.             aTextDrawingArea_1271.method380("Fps:" + super.fps, c, i1, k);
  9999.             k += 15;
  10000.             Runtime runtime = Runtime.getRuntime();
  10001.             int j1 = (int) ((runtime.totalMemory() - runtime.freeMemory()) / 1024L);
  10002.             i1 = 0xffff00;
  10003.             if (j1 > 0x2000000 && lowMem)
  10004.                 i1 = 0xff0000;
  10005.             aTextDrawingArea_1271.method380("Mem:" + j1 + "k", c, 0xffff00, k);
  10006.             k += 15;
  10007.         }
  10008.         int x = baseX + (myPlayer.x - 6 >> 7);
  10009.         int y = baseY + (myPlayer.y - 6 >> 7);
  10010.         if (clientData) {
  10011.             if (super.fps < 15) {
  10012.             }
  10013.             aTextDrawingArea_1271.method385(0xffff00, "Fps: " + super.fps, 285,
  10014.                     5);
  10015.             Runtime runtime = Runtime.getRuntime();
  10016.             int j1 = (int) ((runtime.totalMemory() - runtime.freeMemory()) / 1024L);
  10017.             if (j1 > 0x2000000 && lowMem) {
  10018.             }
  10019.             aTextDrawingArea_1271.method385(0xffff00, "Mem: " + j1 + "k", 299,
  10020.                     5);
  10021.             aTextDrawingArea_1271.method385(0xffff00, "Mouse X: "
  10022.                     + super.mouseX + " , Mouse Y: " + super.mouseY, 314, 5);
  10023.             aTextDrawingArea_1271.method385(0xffff00,
  10024.                     "Coords: " + x + ", " + y, 329, 5);
  10025.         }
  10026.         if (anInt1104 != 0) {
  10027.             int j = anInt1104 / 50;
  10028.             int l = j / 60;
  10029.             j %= 60;
  10030.             if (j < 10)
  10031.                 aTextDrawingArea_1271.method385(0xffff00, "System update in: "
  10032.                         + l + ":0" + j, 329, 4);
  10033.             else
  10034.                 aTextDrawingArea_1271.method385(0xffff00, "System update in: "
  10035.                         + l + ":" + j, 329, 4);
  10036.             anInt849++;
  10037.             if (anInt849 > 75) {
  10038.                 anInt849 = 0;
  10039.                 stream.createFrame(148);
  10040.             }
  10041.         }
  10042.     }
  10043.  
  10044.     public void addIgnore(long l) {
  10045.         try {
  10046.             if (l == 0L)
  10047.                 return;
  10048.             if (ignoreCount >= 100) {
  10049.                 pushMessage("Your ignore list is full. Max of 100 hit", 0, "");
  10050.                 return;
  10051.             }
  10052.             String s = TextClass.fixName(TextClass.nameForLong(l));
  10053.             for (int j = 0; j < ignoreCount; j++)
  10054.                 if (ignoreListAsLongs[j] == l) {
  10055.                     pushMessage(s + " is already on your ignore list", 0, "");
  10056.                     return;
  10057.                 }
  10058.             for (int k = 0; k < friendsCount; k++)
  10059.                 if (friendsListAsLongs[k] == l) {
  10060.                     pushMessage("Please remove " + s
  10061.                             + " from your friend list first", 0, "");
  10062.                     return;
  10063.                 }
  10064.  
  10065.             ignoreListAsLongs[ignoreCount++] = l;
  10066.             needDrawTabArea = true;
  10067.             stream.createFrame(133);
  10068.             stream.writeQWord(l);
  10069.             return;
  10070.         } catch (RuntimeException runtimeexception) {
  10071.             signlink.reporterror("45688, " + l + ", " + 4 + ", "
  10072.                     + runtimeexception.toString());
  10073.         }
  10074.         throw new RuntimeException();
  10075.     }
  10076.  
  10077.     public void method114() {
  10078.         for (int i = -1; i < playerCount; i++) {
  10079.             int j;
  10080.             if (i == -1)
  10081.                 j = myPlayerIndex;
  10082.             else
  10083.                 j = playerIndices[i];
  10084.             Player player = playerArray[j];
  10085.             if (player != null)
  10086.                 method96(player);
  10087.         }
  10088.  
  10089.     }
  10090.  
  10091.     public void method115() {
  10092.         if (loadingStage == 2) {
  10093.             for (Class30_Sub1 class30_sub1 = (Class30_Sub1) aClass19_1179
  10094.                     .reverseGetFirst(); class30_sub1 != null; class30_sub1 = (Class30_Sub1) aClass19_1179
  10095.                     .reverseGetNext()) {
  10096.                 if (class30_sub1.anInt1294 > 0)
  10097.                     class30_sub1.anInt1294--;
  10098.                 if (class30_sub1.anInt1294 == 0) {
  10099.                     if (class30_sub1.anInt1299 < 0
  10100.                             || ObjectManager.method178(class30_sub1.anInt1299,
  10101.                                     class30_sub1.anInt1301)) {
  10102.                         method142(class30_sub1.anInt1298,
  10103.                                 class30_sub1.anInt1295, class30_sub1.anInt1300,
  10104.                                 class30_sub1.anInt1301, class30_sub1.anInt1297,
  10105.                                 class30_sub1.anInt1296, class30_sub1.anInt1299);
  10106.                         class30_sub1.unlink();
  10107.                     }
  10108.                 } else {
  10109.                     if (class30_sub1.anInt1302 > 0)
  10110.                         class30_sub1.anInt1302--;
  10111.                     if (class30_sub1.anInt1302 == 0
  10112.                             && class30_sub1.anInt1297 >= 1
  10113.                             && class30_sub1.anInt1298 >= 1
  10114.                             && class30_sub1.anInt1297 <= 102
  10115.                             && class30_sub1.anInt1298 <= 102
  10116.                             && (class30_sub1.anInt1291 < 0 || ObjectManager
  10117.                                     .method178(class30_sub1.anInt1291,
  10118.                                             class30_sub1.anInt1293))) {
  10119.                         method142(class30_sub1.anInt1298,
  10120.                                 class30_sub1.anInt1295, class30_sub1.anInt1292,
  10121.                                 class30_sub1.anInt1293, class30_sub1.anInt1297,
  10122.                                 class30_sub1.anInt1296, class30_sub1.anInt1291);
  10123.                         class30_sub1.anInt1302 = -1;
  10124.                         if (class30_sub1.anInt1291 == class30_sub1.anInt1299
  10125.                                 && class30_sub1.anInt1299 == -1)
  10126.                             class30_sub1.unlink();
  10127.                         else if (class30_sub1.anInt1291 == class30_sub1.anInt1299
  10128.                                 && class30_sub1.anInt1292 == class30_sub1.anInt1300
  10129.                                 && class30_sub1.anInt1293 == class30_sub1.anInt1301)
  10130.                             class30_sub1.unlink();
  10131.                     }
  10132.                 }
  10133.             }
  10134.  
  10135.         }
  10136.     }
  10137.  
  10138.     public void determineMenuSize() {
  10139.         int i = chatTextDrawingArea.getTextWidth("Choose Option");
  10140.         for (int j = 0; j < menuActionRow; j++) {
  10141.             int k = chatTextDrawingArea.getTextWidth(menuActionName[j]);
  10142.             if (k > i)
  10143.                 i = k;
  10144.         }
  10145.  
  10146.         i += 8;
  10147.         int l = 15 * menuActionRow + 21;
  10148.         if (super.saveClickX > 4 && super.saveClickY > 4
  10149.                 && super.saveClickX < 516 && super.saveClickY < 338) {
  10150.             int i1 = super.saveClickX - 4 - i / 2;
  10151.             if (i1 + i > 512)
  10152.                 i1 = 512 - i;
  10153.             if (i1 < 0)
  10154.                 i1 = 0;
  10155.             int l1 = super.saveClickY - 4;
  10156.             if (l1 + l > 334)
  10157.                 l1 = 334 - l;
  10158.             if (l1 < 0)
  10159.                 l1 = 0;
  10160.             menuOpen = true;
  10161.             menuScreenArea = 0;
  10162.             menuOffsetX = i1;
  10163.             menuOffsetY = l1;
  10164.             menuWidth = i;
  10165.             menuHeight = 15 * menuActionRow + 22;
  10166.         }
  10167.         if (super.saveClickX > 519 && super.saveClickY > 168
  10168.                 && super.saveClickX < 765 && super.saveClickY < 503) {
  10169.             int j1 = super.saveClickX - 519 - i / 2;
  10170.             if (j1 < 0)
  10171.                 j1 = 0;
  10172.             else if (j1 + i > 245)
  10173.                 j1 = 245 - i;
  10174.             int i2 = super.saveClickY - 168;
  10175.             if (i2 < 0)
  10176.                 i2 = 0;
  10177.             else if (i2 + l > 333)
  10178.                 i2 = 333 - l;
  10179.             menuOpen = true;
  10180.             menuScreenArea = 1;
  10181.             menuOffsetX = j1;
  10182.             menuOffsetY = i2;
  10183.             menuWidth = i;
  10184.             menuHeight = 15 * menuActionRow + 22;
  10185.         }
  10186.         if (super.saveClickX > 0 && super.saveClickY > 338
  10187.                 && super.saveClickX < 516 && super.saveClickY < 503) {
  10188.             int k1 = super.saveClickX - 0 - i / 2;
  10189.             if (k1 < 0)
  10190.                 k1 = 0;
  10191.             else if (k1 + i > 516)
  10192.                 k1 = 516 - i;
  10193.             int j2 = super.saveClickY - 338;
  10194.             if (j2 < 0)
  10195.                 j2 = 0;
  10196.             else if (j2 + l > 165)
  10197.                 j2 = 165 - l;
  10198.             menuOpen = true;
  10199.             menuScreenArea = 2;
  10200.             menuOffsetX = k1;
  10201.             menuOffsetY = j2;
  10202.             menuWidth = i;
  10203.             menuHeight = 15 * menuActionRow + 22;
  10204.         }
  10205.     }
  10206.  
  10207.     public void method117(Stream stream) {
  10208.         stream.initBitAccess();
  10209.         int j = stream.readBits(1);
  10210.         if (j == 0)
  10211.             return;
  10212.         int k = stream.readBits(2);
  10213.         if (k == 0) {
  10214.             anIntArray894[anInt893++] = myPlayerIndex;
  10215.             return;
  10216.         }
  10217.         if (k == 1) {
  10218.             int l = stream.readBits(3);
  10219.             myPlayer.moveInDir(false, l);
  10220.             int k1 = stream.readBits(1);
  10221.             if (k1 == 1)
  10222.                 anIntArray894[anInt893++] = myPlayerIndex;
  10223.             return;
  10224.         }
  10225.         if (k == 2) {
  10226.             int i1 = stream.readBits(3);
  10227.             myPlayer.moveInDir(true, i1);
  10228.             int l1 = stream.readBits(3);
  10229.             myPlayer.moveInDir(true, l1);
  10230.             int j2 = stream.readBits(1);
  10231.             if (j2 == 1)
  10232.                 anIntArray894[anInt893++] = myPlayerIndex;
  10233.             return;
  10234.         }
  10235.         if (k == 3) {
  10236.             plane = stream.readBits(2);
  10237.             int j1 = stream.readBits(1);
  10238.             int i2 = stream.readBits(1);
  10239.             if (i2 == 1)
  10240.                 anIntArray894[anInt893++] = myPlayerIndex;
  10241.             int k2 = stream.readBits(7);
  10242.             int l2 = stream.readBits(7);
  10243.             myPlayer.setPos(l2, k2, j1 == 1);
  10244.         }
  10245.     }
  10246.  
  10247.     public void nullLoader() {
  10248.         aBoolean831 = false;
  10249.         while (drawingFlames) {
  10250.             aBoolean831 = false;
  10251.             try {
  10252.                 Thread.sleep(50L);
  10253.             } catch (Exception _ex) {
  10254.             }
  10255.         }
  10256.         aBackground_966 = null;
  10257.         aBackground_967 = null;
  10258.         aBackgroundArray1152s = null;
  10259.         anIntArray850 = null;
  10260.         anIntArray851 = null;
  10261.         anIntArray852 = null;
  10262.         anIntArray853 = null;
  10263.         anIntArray1190 = null;
  10264.         anIntArray1191 = null;
  10265.         anIntArray828 = null;
  10266.         anIntArray829 = null;
  10267.         aClass30_Sub2_Sub1_Sub1_1201 = null;
  10268.         aClass30_Sub2_Sub1_Sub1_1202 = null;
  10269.     }
  10270.  
  10271.     private boolean method119(int i, int j) {
  10272.         boolean flag1 = false;
  10273.         RSInterface class9 = RSInterface.interfaceCache[j];
  10274.         for (int k = 0; k < class9.children.length; k++) {
  10275.             if (class9.children[k] == -1)
  10276.                 break;
  10277.             RSInterface class9_1 = RSInterface.interfaceCache[class9.children[k]];
  10278.             if (class9_1.type == 1)
  10279.                 flag1 |= method119(i, class9_1.id);
  10280.             if (class9_1.type == 6
  10281.                     && (class9_1.anInt257 != -1 || class9_1.anInt258 != -1)) {
  10282.                 boolean flag2 = interfaceIsSelected(class9_1);
  10283.                 int l;
  10284.                 if (flag2)
  10285.                     l = class9_1.anInt258;
  10286.                 else
  10287.                     l = class9_1.anInt257;
  10288.                 if (l != -1) {
  10289.                     Animation animation = Animation.anims[l];
  10290.                     for (class9_1.anInt208 += i; class9_1.anInt208 > animation
  10291.                             .method258(class9_1.anInt246);) {
  10292.                         class9_1.anInt208 -= animation
  10293.                                 .method258(class9_1.anInt246) + 1;
  10294.                         class9_1.anInt246++;
  10295.                         if (class9_1.anInt246 >= animation.anInt352) {
  10296.                             class9_1.anInt246 -= animation.anInt356;
  10297.                             if (class9_1.anInt246 < 0
  10298.                                     || class9_1.anInt246 >= animation.anInt352)
  10299.                                 class9_1.anInt246 = 0;
  10300.                         }
  10301.                         flag1 = true;
  10302.                     }
  10303.  
  10304.                 }
  10305.             }
  10306.         }
  10307.  
  10308.         return flag1;
  10309.     }
  10310.  
  10311.     private int method120() {
  10312.         int j = 3;
  10313.         if (yCameraCurve < 310) {
  10314.             int k = xCameraPos >> 7;
  10315.             int l = yCameraPos >> 7;
  10316.             int i1 = myPlayer.x >> 7;
  10317.             int j1 = myPlayer.y >> 7;
  10318.             if ((byteGroundArray[plane][k][l] & 4) != 0)
  10319.                 j = plane;
  10320.             int k1;
  10321.             if (i1 > k)
  10322.                 k1 = i1 - k;
  10323.             else
  10324.                 k1 = k - i1;
  10325.             int l1;
  10326.             if (j1 > l)
  10327.                 l1 = j1 - l;
  10328.             else
  10329.                 l1 = l - j1;
  10330.             if (k1 > l1) {
  10331.                 int i2 = (l1 * 0x10000) / k1;
  10332.                 int k2 = 32768;
  10333.                 while (k != i1) {
  10334.                     if (k < i1)
  10335.                         k++;
  10336.                     else if (k > i1)
  10337.                         k--;
  10338.                     if ((byteGroundArray[plane][k][l] & 4) != 0)
  10339.                         j = plane;
  10340.                     k2 += i2;
  10341.                     if (k2 >= 0x10000) {
  10342.                         k2 -= 0x10000;
  10343.                         if (l < j1)
  10344.                             l++;
  10345.                         else if (l > j1)
  10346.                             l--;
  10347.                         if ((byteGroundArray[plane][k][l] & 4) != 0)
  10348.                             j = plane;
  10349.                     }
  10350.                 }
  10351.             } else {
  10352.                 int j2 = (k1 * 0x10000) / l1;
  10353.                 int l2 = 32768;
  10354.                 while (l != j1) {
  10355.                     if (l < j1)
  10356.                         l++;
  10357.                     else if (l > j1)
  10358.                         l--;
  10359.                     if ((byteGroundArray[plane][k][l] & 4) != 0)
  10360.                         j = plane;
  10361.                     l2 += j2;
  10362.                     if (l2 >= 0x10000) {
  10363.                         l2 -= 0x10000;
  10364.                         if (k < i1)
  10365.                             k++;
  10366.                         else if (k > i1)
  10367.                             k--;
  10368.                         if ((byteGroundArray[plane][k][l] & 4) != 0)
  10369.                             j = plane;
  10370.                     }
  10371.                 }
  10372.             }
  10373.         }
  10374.         if ((byteGroundArray[plane][myPlayer.x >> 7][myPlayer.y >> 7] & 4) != 0)
  10375.             j = plane;
  10376.         return j;
  10377.     }
  10378.  
  10379.     private int method121() {
  10380.         int j = method42(plane, yCameraPos, xCameraPos);
  10381.         if (j - zCameraPos < 800
  10382.                 && (byteGroundArray[plane][xCameraPos >> 7][yCameraPos >> 7] & 4) != 0)
  10383.             return plane;
  10384.         else
  10385.             return 3;
  10386.     }
  10387.  
  10388.     public void delIgnore(long l) {
  10389.         try {
  10390.             if (l == 0L)
  10391.                 return;
  10392.             for (int j = 0; j < ignoreCount; j++)
  10393.                 if (ignoreListAsLongs[j] == l) {
  10394.                     ignoreCount--;
  10395.                     needDrawTabArea = true;
  10396.                     System.arraycopy(ignoreListAsLongs, j + 1,
  10397.                             ignoreListAsLongs, j, ignoreCount - j);
  10398.  
  10399.                     stream.createFrame(74);
  10400.                     stream.writeQWord(l);
  10401.                     return;
  10402.                 }
  10403.  
  10404.             return;
  10405.         } catch (RuntimeException runtimeexception) {
  10406.             signlink.reporterror("47229, " + 3 + ", " + l + ", "
  10407.                     + runtimeexception.toString());
  10408.         }
  10409.         throw new RuntimeException();
  10410.     }
  10411.  
  10412.     @SuppressWarnings("unused")
  10413.     private void chatJoin(long l) {
  10414.         try {
  10415.             if (l == 0L)
  10416.                 return;
  10417.             stream.createFrame(60);
  10418.             stream.writeQWord(l);
  10419.             return;
  10420.         } catch (RuntimeException runtimeexception) {
  10421.             signlink.reporterror("47229, " + 3 + ", " + l + ", "
  10422.                     + runtimeexception.toString());
  10423.         }
  10424.         throw new RuntimeException();
  10425.  
  10426.     }
  10427.  
  10428.     @Override
  10429.     public String getParameter(String s) {
  10430.         if (signlink.mainapp != null)
  10431.             return signlink.mainapp.getParameter(s);
  10432.         else
  10433.             return super.getParameter(s);
  10434.     }
  10435.  
  10436.     public void adjustVolume(boolean flag, int i) {
  10437.         signlink.midivol = i;
  10438.         if (flag)
  10439.             signlink.midi = "voladjust";
  10440.     }
  10441.  
  10442.     private int extractInterfaceValues(RSInterface class9, int j) {
  10443.         if (class9.valueIndexArray == null
  10444.                 || j >= class9.valueIndexArray.length)
  10445.             return -2;
  10446.         try {
  10447.             int ai[] = class9.valueIndexArray[j];
  10448.             int k = 0;
  10449.             int l = 0;
  10450.             int i1 = 0;
  10451.             do {
  10452.                 int j1 = ai[l++];
  10453.                 int k1 = 0;
  10454.                 byte byte0 = 0;
  10455.                 if (j1 == 0)
  10456.                     return k;
  10457.                 if (j1 == 1)
  10458.                     k1 = currentStats[ai[l++]];
  10459.                 if (j1 == 2)
  10460.                     k1 = maxStats[ai[l++]];
  10461.                 if (j1 == 3)
  10462.                     k1 = currentExp[ai[l++]];
  10463.                 if (j1 == 4) {
  10464.                     RSInterface class9_1 = RSInterface.interfaceCache[ai[l++]];
  10465.                     int k2 = ai[l++];
  10466.                     if (k2 >= 0 && k2 < ItemDef.totalItems
  10467.                             && (!ItemDef.forID(k2).membersObject || isMembers)) {
  10468.                         for (int j3 = 0; j3 < class9_1.inv.length; j3++)
  10469.                             if (class9_1.inv[j3] == k2 + 1)
  10470.                                 k1 += class9_1.invStackSizes[j3];
  10471.  
  10472.                     }
  10473.                 }
  10474.                 if (j1 == 5)
  10475.                     k1 = variousSettings[ai[l++]];
  10476.                 if (j1 == 6)
  10477.                     k1 = anIntArray1019[maxStats[ai[l++]] - 1];
  10478.                 if (j1 == 7)
  10479.                     k1 = (variousSettings[ai[l++]] * 100) / 46875;
  10480.                 if (j1 == 8)
  10481.                     k1 = myPlayer.combatLevel;
  10482.                 if (j1 == 9) {
  10483.                     for (int l1 = 0; l1 < Skills.skillsCount; l1++)
  10484.                         if (Skills.skillEnabled[l1])
  10485.                             k1 += maxStats[l1];
  10486.  
  10487.                 }
  10488.                 if (j1 == 10) {
  10489.                     RSInterface class9_2 = RSInterface.interfaceCache[ai[l++]];
  10490.                     int l2 = ai[l++] + 1;
  10491.                     if (l2 >= 0 && l2 < ItemDef.totalItems
  10492.                             && (!ItemDef.forID(l2).membersObject || isMembers)) {
  10493.                         for (int k3 = 0; k3 < class9_2.inv.length; k3++) {
  10494.                             if (class9_2.inv[k3] != l2)
  10495.                                 continue;
  10496.                             k1 = 0x3b9ac9ff;
  10497.                             break;
  10498.                         }
  10499.  
  10500.                     }
  10501.                 }
  10502.                 if (j1 == 11)
  10503.                     k1 = energy;
  10504.                 if (j1 == 12)
  10505.                     k1 = weight;
  10506.                 if (j1 == 13) {
  10507.                     int i2 = variousSettings[ai[l++]];
  10508.                     int i3 = ai[l++];
  10509.                     k1 = (i2 & 1 << i3) == 0 ? 0 : 1;
  10510.                 }
  10511.                 if (j1 == 14) {
  10512.                     int j2 = ai[l++];
  10513.                     VarBit varBit = VarBit.cache[j2];
  10514.                     int l3 = varBit.anInt648;
  10515.                     int i4 = varBit.anInt649;
  10516.                     int j4 = varBit.anInt650;
  10517.                     int k4 = anIntArray1232[j4 - i4];
  10518.                     k1 = variousSettings[l3] >> i4 & k4;
  10519.                 }
  10520.                 if (j1 == 15)
  10521.                     byte0 = 1;
  10522.                 if (j1 == 16)
  10523.                     byte0 = 2;
  10524.                 if (j1 == 17)
  10525.                     byte0 = 3;
  10526.                 if (j1 == 18)
  10527.                     k1 = (myPlayer.x >> 7) + baseX;
  10528.                 if (j1 == 19)
  10529.                     k1 = (myPlayer.y >> 7) + baseY;
  10530.                 if (j1 == 20)
  10531.                     k1 = ai[l++];
  10532.                 if (byte0 == 0) {
  10533.                     if (i1 == 0)
  10534.                         k += k1;
  10535.                     if (i1 == 1)
  10536.                         k -= k1;
  10537.                     if (i1 == 2 && k1 != 0)
  10538.                         k /= k1;
  10539.                     if (i1 == 3)
  10540.                         k *= k1;
  10541.                     i1 = 0;
  10542.                 } else {
  10543.                     i1 = byte0;
  10544.                 }
  10545.             } while (true);
  10546.         } catch (Exception _ex) {
  10547.             return -1;
  10548.         }
  10549.     }
  10550.  
  10551.     public void drawTooltip() {
  10552.         if (menuActionRow < 2 && itemSelected == 0 && spellSelected == 0)
  10553.             return;
  10554.         String s;
  10555.         if (itemSelected == 1 && menuActionRow < 2)
  10556.             s = "Use " + selectedItemName + " with...";
  10557.         else if (spellSelected == 1 && menuActionRow < 2)
  10558.             s = spellTooltip + "...";
  10559.         else
  10560.             s = menuActionName[menuActionRow - 1];
  10561.         if (menuActionRow > 2)
  10562.             s = s + "@whi@ / " + (menuActionRow - 2) + " more options";
  10563.         chatTextDrawingArea.method390(4, 0xffffff, s, loopCycle / 1000, 15);
  10564.     }
  10565.  
  10566.     private void drawMinimap() {
  10567.         if (revision474 == true) {
  10568.             aRSImageProducer_1164.initDrawingArea();
  10569.             if (anInt1021 == 2) {
  10570.                 byte abyte0[] = mapBack.aByteArray1450;
  10571.                 Increase.drawSprite(230, 135);
  10572.                 Decrease.drawSprite(230, 150);
  10573.                 int ai[] = DrawingArea.pixels;
  10574.                 int k2 = abyte0.length;
  10575.                 for (int i5 = 0; i5 < k2; i5++)
  10576.                     if (abyte0[i5] == 0)
  10577.                         ai[i5] = 0;
  10578.                 compass.method352(33, viewRotation, anIntArray1057, 256,
  10579.                         anIntArray968, 25, 0, 0, 33, 25);
  10580.                 aRSImageProducer_1165.initDrawingArea();
  10581.                 return;
  10582.             }
  10583.             int i = viewRotation + minimapRotation & 0x7ff;
  10584.             int j = 48 + myPlayer.x / 32;
  10585.             int l2 = 464 - myPlayer.y / 32;
  10586.                                 Increase.drawSprite(230, 135);
  10587.                     Decrease.drawSprite(230, 150);
  10588.             for (int x = 0; x < anIntArray1229.length; x++) {
  10589.                 anIntArray1229[x] = 170;
  10590.                 anIntArray1052[x] = -23;
  10591.             }
  10592.             aClass30_Sub2_Sub1_Sub1_1263.method352(151, i, anIntArray1229,
  10593.                     256 + minimapZoom, anIntArray1052, l2, 9, 54, 146, j);
  10594.             compass.method352(33, viewRotation, anIntArray1057, 256,
  10595.                     anIntArray968, 25, 4, 25, 33, 25);
  10596.             for (int j5 = 0; j5 < anInt1071; j5++) {
  10597.                 int k = (anIntArray1072[j5] * 4 + 2) - myPlayer.x / 32;
  10598.                 int i3 = (anIntArray1073[j5] * 4 + 2) - myPlayer.y / 32;
  10599.                 markMinimap(aClass30_Sub2_Sub1_Sub1Array1140[j5], k, i3);
  10600.             }
  10601.             for (int k5 = 0; k5 < 104; k5++) {
  10602.                 for (int l5 = 0; l5 < 104; l5++) {
  10603.                     NodeList class19 = groundArray[plane][k5][l5];
  10604.                     if (class19 != null) {
  10605.                         int l = (k5 * 4 + 2) - myPlayer.x / 32;
  10606.                         int j3 = (l5 * 4 + 2) - myPlayer.y / 32;
  10607.                         markMinimap(mapDotItem, l, j3);
  10608.                     }
  10609.                 }
  10610.             }
  10611.  
  10612.             for (int i6 = 0; i6 < npcCount; i6++) {
  10613.                 NPC npc = npcArray[npcIndices[i6]];
  10614.                 if (npc != null && npc.isVisible()) {
  10615.                     EntityDef entityDef = npc.desc;
  10616.                     if (entityDef.childrenIDs != null)
  10617.                         entityDef = entityDef.method161();
  10618.                     if (entityDef != null && entityDef.aBoolean87
  10619.                             && entityDef.aBoolean84) {
  10620.                         int i1 = npc.x / 32 - myPlayer.x / 32;
  10621.                         int k3 = npc.y / 32 - myPlayer.y / 32;
  10622.                         markMinimap(mapDotNPC, i1, k3);
  10623.                     }
  10624.                 }
  10625.             }
  10626.             for (int j6 = 0; j6 < playerCount; j6++) {
  10627.                 Player player = playerArray[playerIndices[j6]];
  10628.                 if (player != null && player.isVisible()) {
  10629.                     int j1 = player.x / 32 - myPlayer.x / 32;
  10630.                     int l3 = player.y / 32 - myPlayer.y / 32;
  10631.                     boolean flag1 = false;
  10632.                     boolean flag3 = false;
  10633.                     for (int j3 = 0; j3 < clanList.length; j3++) {
  10634.                         if (clanList[j3] == null)
  10635.                             continue;
  10636.                         if (!clanList[j3].equalsIgnoreCase(player.name))
  10637.                             continue;
  10638.                         flag3 = true;
  10639.                         break;
  10640.                     }
  10641.                     long l6 = TextClass.longForName(player.name);
  10642.                     for (int k6 = 0; k6 < friendsCount; k6++) {
  10643.                         if (l6 != friendsListAsLongs[k6]
  10644.                                 || friendsNodeIDs[k6] == 0)
  10645.                             continue;
  10646.                         flag1 = true;
  10647.                         break;
  10648.                     }
  10649.                     boolean flag2 = false;
  10650.                     if (myPlayer.team != 0 && player.team != 0
  10651.                             && myPlayer.team == player.team)
  10652.                         flag2 = true;
  10653.                     if (flag1)
  10654.                         markMinimap(mapDotFriend, j1, l3);
  10655.                     else if (flag3)
  10656.                         markMinimap(mapDotClan, j1, l3);
  10657.                     else if (flag2)
  10658.                         markMinimap(mapDotTeam, j1, l3);
  10659.                     else
  10660.                         markMinimap(mapDotPlayer, j1, l3);
  10661.                 }
  10662.             }
  10663.             if (anInt855 != 0 && loopCycle % 20 < 10) {
  10664.                 if (anInt855 == 1 && anInt1222 >= 0
  10665.                         && anInt1222 < npcArray.length) {
  10666.                     NPC class30_sub2_sub4_sub1_sub1_1 = npcArray[anInt1222];
  10667.                     if (class30_sub2_sub4_sub1_sub1_1 != null) {
  10668.                         int k1 = class30_sub2_sub4_sub1_sub1_1.x / 32
  10669.                                 - myPlayer.x / 32;
  10670.                         int i4 = class30_sub2_sub4_sub1_sub1_1.y / 32
  10671.                                 - myPlayer.y / 32;
  10672.                         method81(mapMarker, i4, k1);
  10673.                     }
  10674.                 }
  10675.                 if (anInt855 == 2) {
  10676.                     int l1 = ((anInt934 - baseX) * 4 + 2) - myPlayer.x / 32;
  10677.                     int j4 = ((anInt935 - baseY) * 4 + 2) - myPlayer.y / 32;
  10678.                     method81(mapMarker, j4, l1);
  10679.                 }
  10680.                 if (anInt855 == 10 && anInt933 >= 0
  10681.                         && anInt933 < playerArray.length) {
  10682.                     Player class30_sub2_sub4_sub1_sub2_1 = playerArray[anInt933];
  10683.                     if (class30_sub2_sub4_sub1_sub2_1 != null) {
  10684.                         int i2 = class30_sub2_sub4_sub1_sub2_1.x / 32
  10685.                                 - myPlayer.x / 32;
  10686.                         int k4 = class30_sub2_sub4_sub1_sub2_1.y / 32
  10687.                                 - myPlayer.y / 32;
  10688.                         method81(mapMarker, k4, i2);
  10689.                     }
  10690.                 }
  10691.             }
  10692.             if (destX != 0) {
  10693.                 int j2 = (destX * 4 + 2) - myPlayer.x / 32;
  10694.                 int l4 = (destY * 4 + 2) - myPlayer.y / 32;
  10695.                 markMinimap(mapFlag, j2, l4);
  10696.             }
  10697.             DrawingArea.drawPixels(3, 78 + 5, 97 + 30, 0xffffff, 3);
  10698.             mapArea474.drawSprite(0, 0);
  10699.             if (revision474 == true && OSOrbs == true) {
  10700.                 draw07Orbs();
  10701.             }
  10702.             if (menuOpen && menuScreenArea == 3) {
  10703.                 drawMenu();
  10704.             }
  10705.             aRSImageProducer_1165.initDrawingArea();
  10706.         }
  10707.         if (revision498 == true) {
  10708.             aRSImageProducer_1164.initDrawingArea();
  10709.             if (anInt1021 == 2) {
  10710.                 byte abyte0[] = mapBack.aByteArray1450;
  10711.                 int ai[] = DrawingArea.pixels;
  10712.                 int k2 = abyte0.length;
  10713.                 for (int i5 = 0; i5 < k2; i5++)
  10714.                     if (abyte0[i5] == 0)
  10715.                         ai[i5] = 0;
  10716.                 compass.method352(33, viewRotation, anIntArray1057, 256,
  10717.                         anIntArray968, 25, 8, 8, 33, 25);
  10718.                 aRSImageProducer_1165.initDrawingArea();
  10719.                 return;
  10720.             }
  10721.             int i = viewRotation + minimapRotation & 0x7ff;
  10722.             int j = 48 + myPlayer.x / 32;
  10723.             int l2 = 464 - myPlayer.y / 32;
  10724.             for (int x = 0; x < anIntArray1229.length; x++) {
  10725.                 anIntArray1229[x] = 170;
  10726.                 anIntArray1052[x] = -23;
  10727.             }
  10728.             aClass30_Sub2_Sub1_Sub1_1263.method352(151, i, anIntArray1229,
  10729.                     256 + minimapZoom, anIntArray1052, l2, 10, 45, 146, j);
  10730.             compass.method352(33, viewRotation, anIntArray1057, 256,
  10731.                     anIntArray968, 25, 8, 8, 33, 25);
  10732.             for (int j5 = 0; j5 < anInt1071; j5++) {
  10733.                 int k = (anIntArray1072[j5] * 4 + 2) - myPlayer.x / 32;
  10734.                 int i3 = (anIntArray1073[j5] * 4 + 2) - myPlayer.y / 32;
  10735.                 markMinimap(aClass30_Sub2_Sub1_Sub1Array1140[j5], k, i3);
  10736.             }
  10737.             for (int k5 = 0; k5 < 104; k5++) {
  10738.                 for (int l5 = 0; l5 < 104; l5++) {
  10739.                     NodeList class19 = groundArray[plane][k5][l5];
  10740.                     if (class19 != null) {
  10741.                         int l = (k5 * 4 + 2) - myPlayer.x / 32;
  10742.                         int j3 = (l5 * 4 + 2) - myPlayer.y / 32;
  10743.                         markMinimap(mapDotItem, l, j3);
  10744.                     }
  10745.                 }
  10746.             }
  10747.  
  10748.             for (int i6 = 0; i6 < npcCount; i6++) {
  10749.                 NPC npc = npcArray[npcIndices[i6]];
  10750.                 if (npc != null && npc.isVisible()) {
  10751.                     EntityDef entityDef = npc.desc;
  10752.                     if (entityDef.childrenIDs != null)
  10753.                         entityDef = entityDef.method161();
  10754.                     if (entityDef != null && entityDef.aBoolean87
  10755.                             && entityDef.aBoolean84) {
  10756.                         int i1 = npc.x / 32 - myPlayer.x / 32;
  10757.                         int k3 = npc.y / 32 - myPlayer.y / 32;
  10758.                         markMinimap(mapDotNPC, i1, k3);
  10759.                     }
  10760.                 }
  10761.             }
  10762.  
  10763.             for (int j6 = 0; j6 < playerCount; j6++) {
  10764.                 Player player = playerArray[playerIndices[j6]];
  10765.                 if (player != null && player.isVisible()) {
  10766.                     int j1 = player.x / 32 - myPlayer.x / 32;
  10767.                     int l3 = player.y / 32 - myPlayer.y / 32;
  10768.                     boolean flag1 = false;
  10769.                     long l6 = TextClass.longForName(player.name);
  10770.                     for (int k6 = 0; k6 < friendsCount; k6++) {
  10771.                         if (l6 != friendsListAsLongs[k6]
  10772.                                 || friendsNodeIDs[k6] == 0)
  10773.                             continue;
  10774.                         flag1 = true;
  10775.                         break;
  10776.                     }
  10777.                     @SuppressWarnings("unused")
  10778.                     boolean flag2 = false;
  10779.                     if (myPlayer.team != 0 && player.team != 0
  10780.                             && myPlayer.team == player.team)
  10781.                         flag2 = true;
  10782.                     if (flag1)
  10783.                         markMinimap(mapDotFriend, j1, l3);
  10784.                     else
  10785.                         markMinimap(mapDotPlayer, j1, l3);
  10786.                 }
  10787.             }
  10788.  
  10789.             if (anInt855 != 0 && loopCycle % 20 < 10) {
  10790.                 if (anInt855 == 1 && anInt1222 >= 0
  10791.                         && anInt1222 < npcArray.length) {
  10792.                     NPC class30_sub2_sub4_sub1_sub1_1 = npcArray[anInt1222];
  10793.                     if (class30_sub2_sub4_sub1_sub1_1 != null) {
  10794.                         int k1 = class30_sub2_sub4_sub1_sub1_1.x / 32
  10795.                                 - myPlayer.x / 32;
  10796.                         int i4 = class30_sub2_sub4_sub1_sub1_1.y / 32
  10797.                                 - myPlayer.y / 32;
  10798.                         method81(mapMarker, i4, k1);
  10799.                     }
  10800.                 }
  10801.                 if (anInt855 == 2) {
  10802.                     int l1 = ((anInt934 - baseX) * 4 + 2) - myPlayer.x / 32;
  10803.                     int j4 = ((anInt935 - baseY) * 4 + 2) - myPlayer.y / 32;
  10804.                     method81(mapMarker, j4, l1);
  10805.                 }
  10806.                 if (anInt855 == 10 && anInt933 >= 0
  10807.                         && anInt933 < playerArray.length) {
  10808.                     Player class30_sub2_sub4_sub1_sub2_1 = playerArray[anInt933];
  10809.                     if (class30_sub2_sub4_sub1_sub2_1 != null) {
  10810.                         int i2 = class30_sub2_sub4_sub1_sub2_1.x / 32
  10811.                                 - myPlayer.x / 32;
  10812.                         int k4 = class30_sub2_sub4_sub1_sub2_1.y / 32
  10813.                                 - myPlayer.y / 32;
  10814.                         method81(mapMarker, k4, i2);
  10815.                     }
  10816.                 }
  10817.             }
  10818.             if (destX != 0) {
  10819.                 int j2 = (destX * 4 + 2) - myPlayer.x / 32;
  10820.                 int l4 = (destY * 4 + 2) - myPlayer.y / 32;
  10821.                 markMinimap(mapFlag, j2, l4);
  10822.             }
  10823.             DrawingArea.drawPixels(3, 78 + 5, 97 + 20, 0xffffff, 3);
  10824.             mapArea.drawSprite(0, 0);
  10825.             drawHP();
  10826.             drawWorldMapButton();
  10827.             Increase.drawSprite(230, 135);
  10828.             Decrease.drawSprite(230, 150);
  10829.             drawPrayer();
  10830.             drawRunOrb();
  10831.             aRSImageProducer_1165.initDrawingArea();
  10832.         }
  10833.     }
  10834.  
  10835.     // public boolean runClicked = false;
  10836.     public boolean Resting = false;
  10837.  
  10838.     // public boolean runHover;
  10839.  
  10840.     public void drawPrayer() {
  10841.         String s = (new StringBuilder()).append(signlink.findcachedir())
  10842.                 .append("/Sprites/Frame/").toString();
  10843.         String s1 = RSInterface.interfaceCache[4012].message;
  10844.         String s2 = RSInterface.interfaceCache[4013].message;
  10845.         int i = Integer.parseInt(s1);
  10846.         int j = Integer.parseInt(s2);
  10847.         int k = (int) (((double) i / (double) j) * 100D);
  10848.         ORBS[0] = new Sprite((new StringBuilder()).append(s)
  10849.                 .append("ORBS 0.png").toString(), 27, getOrbFill(k));
  10850.         ORBS[1].drawSprite(190, 53);
  10851.         ORBS[4].drawSprite(193, 56);
  10852.         ORBS[0].drawSprite(194, 56);
  10853.         ORBS[6].drawSprite(197, 60);
  10854.         smallText.method382(getOrbTextColor(k), 234, (new StringBuilder())
  10855.                 .append("").append(i).toString(), 82, true);
  10856.     }
  10857.  
  10858.     public int getOrbTextColor(int i) {
  10859.         if (i >= 75 && i <= 0x7fffffff)
  10860.             return 65280;
  10861.         if (i >= 50 && i <= 74)
  10862.             return 0xffff00;
  10863.         return i < 25 || i > 49 ? 0xff0000 : 0xff981f;
  10864.     }
  10865.  
  10866.     public int getOrbFill(int i) {
  10867.         if (i <= 0x7fffffff && i >= 97)
  10868.             return 0;
  10869.         if (i <= 96 && i >= 93)
  10870.             return 1;
  10871.         if (i <= 92 && i >= 89)
  10872.             return 2;
  10873.         if (i <= 88 && i >= 85)
  10874.             return 3;
  10875.         if (i <= 84 && i >= 81)
  10876.             return 4;
  10877.         if (i <= 80 && i >= 77)
  10878.             return 5;
  10879.         if (i <= 76 && i >= 73)
  10880.             return 6;
  10881.         if (i <= 72 && i >= 69)
  10882.             return 7;
  10883.         if (i <= 68 && i >= 65)
  10884.             return 8;
  10885.         if (i <= 64 && i >= 61)
  10886.             return 9;
  10887.         if (i <= 60 && i >= 57)
  10888.             return 10;
  10889.         if (i <= 56 && i >= 53)
  10890.             return 11;
  10891.         if (i <= 52 && i >= 49)
  10892.             return 12;
  10893.         if (i <= 48 && i >= 45)
  10894.             return 13;
  10895.         if (i <= 44 && i >= 41)
  10896.             return 14;
  10897.         if (i <= 40 && i >= 37)
  10898.             return 15;
  10899.         if (i <= 36 && i >= 33)
  10900.             return 16;
  10901.         if (i <= 32 && i >= 29)
  10902.             return 17;
  10903.         if (i <= 28 && i >= 25)
  10904.             return 18;
  10905.         if (i <= 24 && i >= 21)
  10906.             return 19;
  10907.         if (i <= 20 && i >= 17)
  10908.             return 20;
  10909.         if (i <= 16 && i >= 13)
  10910.             return 21;
  10911.         if (i <= 12 && i >= 9)
  10912.             return 22;
  10913.         if (i <= 8 && i >= 7)
  10914.             return 23;
  10915.         if (i <= 6 && i >= 5)
  10916.             return 24;
  10917.         if (i <= 4 && i >= 3)
  10918.             return 25;
  10919.         if (i <= 2 && i >= 1)
  10920.             return 26;
  10921.         return i > 0 ? 0 : 27;
  10922.     }
  10923.  
  10924.     public void drawLogoutButton() {
  10925.         if (tabInterfaceIDs[10] != -1 && anInt1054 == 9)
  10926.             if (loopCycle % 20 >= 10)
  10927.                 ;
  10928.         sideIcons[10].drawSprite(223, 1);
  10929.         if (tabID == 10)
  10930.             logIconC.drawSprite(223, 1);
  10931.     }
  10932.  
  10933.     public void drawPrayer07() {
  10934.         String s = (new StringBuilder()).append(signlink.findcachedir())
  10935.                 .append("/Sprites/Frame/").toString();
  10936.         String s1 = RSInterface.interfaceCache[4012].message;
  10937.         String s2 = RSInterface.interfaceCache[4013].message;
  10938.         int i = Integer.parseInt(s1);
  10939.         int j = Integer.parseInt(s2);
  10940.         int k = (int) (((double) i / (double) j) * 100D);
  10941.         ORBS[0] = new Sprite((new StringBuilder()).append(s)
  10942.                 .append("ORBS 0.png").toString(), 28, getOrbFill(k));
  10943.         ORBS[12].drawSprite(-1, 80);
  10944.         ORBS[4].drawSprite(27, 85);
  10945.         ORBS[0].drawSprite(27, 85);
  10946.         ORBS[6].drawSprite(30, 88);
  10947.         smallText.method382(getOrbTextColor(k), 15, (new StringBuilder())
  10948.                 .append("").append(i).toString(), 106, true);
  10949.     }
  10950.  
  10951.     public void drawRun07() {
  10952.         String s = (new StringBuilder()).append(signlink.findcachedir())
  10953.                 .append("/Sprites/Frame/").toString();
  10954.         ORBS[0] = new Sprite((new StringBuilder()).append(s)
  10955.                 .append("ORBS 0.png").toString(), 27, getOrbFill(100));
  10956.         if (energy != 100)
  10957.             ORBS[0].drawSprite(53, 124);
  10958.         runClicked = anIntArray1045[173] == 1;
  10959.         ORBS[runHover ? 12 : 12].drawSprite(25, 120);
  10960.         ORBS[runClicked ? 11 : 10].drawSprite(53, 124);
  10961.         ORBS[runClicked ? 9 : 8].drawSprite(59, 128);
  10962.         smallText.method382(getOrbTextColor(100), 40, "100", 146, true);
  10963.     }
  10964.  
  10965.     public void drawHP07() {
  10966.         int health;
  10967.         String OrbDirectory = signlink.findcachedir()
  10968.                 + "/Sprites/Gameframe/Orbs/";
  10969.         String cHP = RSInterface.interfaceCache[4016].message;
  10970.         cHP = cHP.replaceAll("%", "");
  10971.         int currentHP = Integer.parseInt(cHP);
  10972.         String mHP = RSInterface.interfaceCache[4017].message;
  10973.         mHP = mHP.replaceAll("%", "");
  10974.         int maxHP2 = Integer.parseInt(mHP);
  10975.         health = (int) (((double) currentHP / (double) maxHP2) * 100D);
  10976.         ORBS[0] = new Sprite(OrbDirectory + "ORBS 0.PNG", 27,
  10977.                 getOrbFill(health));
  10978.         ORBS[12].drawSprite(-2, 40);
  10979.         ORBS[2].drawSprite(26, 45);
  10980.         ORBS[0].drawSprite(25, 45);
  10981.         if (health <= 20) {
  10982.             if (loopCycle % 20 < 10) {
  10983.                 ORBS[3].drawSprite(32, 52);
  10984.             }
  10985.         } else {
  10986.             ORBS[3].drawSprite(32, 52);
  10987.         }
  10988.         smallText.method382(getOrbTextColor(health), 14, currentHP + "", 66,
  10989.                 true);
  10990.     }
  10991.  
  10992.     public void draw07Orbs() {
  10993.         drawHP07();
  10994.         drawPrayer07();
  10995.         drawRun07();
  10996.         ORBS[13].drawSprite(0, 20);
  10997.     }
  10998.  
  10999.     public void drawRunOrb() {
  11000.         String s = (new StringBuilder()).append(signlink.findcachedir())
  11001.                 .append("/Sprites/Frame/").toString();
  11002.         ORBS[0] = new Sprite((new StringBuilder()).append(s)
  11003.                 .append("ORBS 0.png").toString(), 27, getOrbFill(100));
  11004.         if (energy != 100)
  11005.             ORBS[0].drawSprite(193, 95);
  11006.         runClicked = anIntArray1045[173] == 1;
  11007.         ORBS[runHover ? 7 : 1].drawSprite(190, 92);
  11008.         ORBS[runClicked ? 11 : 10].drawSprite(193, 95);
  11009.         ORBS[runClicked ? 9 : 8].drawSprite(199, 100);
  11010.         smallText.method382(getOrbTextColor(100), 232, "100", 119, true);
  11011.     }
  11012.  
  11013.     public void drawHP() {
  11014.         int health;
  11015.         String OrbDirectory = signlink.findcachedir()
  11016.                 + "/Sprites/Gameframe/Orbs/";
  11017.         String cHP = RSInterface.interfaceCache[4016].message;
  11018.         cHP = cHP.replaceAll("%", "");
  11019.         int currentHP = Integer.parseInt(cHP);
  11020.         String mHP = RSInterface.interfaceCache[4017].message;
  11021.         mHP = mHP.replaceAll("%", "");
  11022.         int maxHP2 = Integer.parseInt(mHP);
  11023.         health = (int) (((double) currentHP / (double) maxHP2) * 100D);
  11024.         ORBS[0] = new Sprite(OrbDirectory + "ORBS 0.PNG", 27,
  11025.                 getOrbFill(health));
  11026.         ORBS[1].drawSprite(174, 14);
  11027.  
  11028.         ORBS[2].drawSprite(177, 17);
  11029.         ORBS[0].drawSprite(177, 17);
  11030.         if (health <= 20) {
  11031.             if (loopCycle % 20 < 10) {
  11032.                 ORBS[3].drawSprite(183, 25);
  11033.             }
  11034.         } else {
  11035.             ORBS[3].drawSprite(183, 25);
  11036.         }
  11037.         int Y = 42;
  11038.         smallText.method382(getOrbTextColor(health), 218, currentHP + "", Y,
  11039.                 true);
  11040.     }
  11041.  
  11042.     public int digits = 0;
  11043.  
  11044.     private void drawCounterOnScreen() {
  11045.         int x = 500;
  11046.         int y = 46;
  11047.         digits = xpCounter == 0 ? 1 : 1 + (int) Math.floor(Math
  11048.                 .log10(xpCounter));
  11049.         int lengthToRemove = Integer.toString(xpCounter).length();
  11050.         int i = aTextDrawingArea_1271.getTextWidth(Integer.toString(xpCounter))
  11051.                 - aTextDrawingArea_1271.getTextWidth(Integer
  11052.                         .toString(xpCounter)) / 2;
  11053.         int a = lengthToRemove == 1 ? 5 : ((lengthToRemove - 1) * 5);
  11054.         aTextDrawingArea_1271.method382(0xffb000, x - 38 - i - digits - 12,
  11055.                 "Total:", y - 34, true);
  11056.         if (xpCounter >= 0) {
  11057.             aTextDrawingArea_1271.method382(0xffb000, x + 1 - i, "+"
  11058.                     + NumberFormat.getIntegerInstance().format(xpCounter),
  11059.                     y - 34, true);
  11060.         } else {
  11061.             expAdded = 0;
  11062.         }
  11063.         if (expAdded > 0) {
  11064.             // a = smallText.getTextWidth("" +
  11065.             // NumberFormat.getIntegerInstance().format(expAdded) + "xp");
  11066.             // smallText.method389(true, x - a + 12, 0xffb000, "+" +
  11067.             // NumberFormat.getIntegerInstance().format(expAdded), y + 120 -
  11068.             // xpAddedPos);
  11069.             // xpAddedPos++;
  11070.             /*
  11071.              * if (xpAddedPos >= 140) { xpAddedPos = expAdded = 0; }
  11072.              */
  11073.         } else {
  11074.             expAdded = 0;
  11075.         }
  11076.     }
  11077.  
  11078.     public int xpCounter, xpAddedPos, expAdded;
  11079.  
  11080.     private boolean runHover, counterHover, runClicked = true;
  11081.  
  11082.     private final void minimapHovers() {
  11083.         runHover = super.mouseX >= 584 && super.mouseX <= 613
  11084.                 && super.mouseY >= 132 && super.mouseY < 165
  11085.                 || super.mouseX >= 557 && super.mouseX <= 584
  11086.                 && super.mouseY >= 142 && super.mouseY < 165;
  11087.         counterHover = super.mouseX >= 518 && super.mouseX <= 542
  11088.                 && super.mouseY >= 45 && super.mouseY <= 69;
  11089.     }
  11090.  
  11091.     public void loadExtraSprites() {
  11092.         for (int k = 1; k <= 15; k++)
  11093.             ORBS[k] = new Sprite((new StringBuilder()).append("Frame/ORBS ")
  11094.                     .append(k).append("").toString());
  11095.     }
  11096.  
  11097.     public void World508() {
  11098.         worldMapIcon508.drawSprite(8, 124);
  11099.     }
  11100.  
  11101.     public void World525() {
  11102.         worldMapIcon525.drawSprite(8, 124);
  11103.     }
  11104.  
  11105.     @SuppressWarnings("unused")
  11106.     private void rightClickMapArea() {
  11107.         if (super.mouseX >= 742 && super.mouseX <= 764 && super.mouseY >= 1
  11108.                 && super.mouseY <= 23 && tabInterfaceIDs[10] != -1) {
  11109.             menuActionName[1] = "Logout";
  11110.             menuActionID[1] = 1004;
  11111.             menuActionRow = 2;
  11112.         } else if (super.mouseX > 713 && super.mouseX < 765
  11113.                 && super.mouseY > 83 && super.mouseY < 118) {
  11114.             menuActionName[1] = "Run";
  11115.             menuActionID[1] = 1051;
  11116.             menuActionRow = 2;
  11117.         }
  11118.     }
  11119.  
  11120.     public void npcScreenPos(Entity entity, int i) {
  11121.         calcEntityScreenPos(entity.x, i, entity.y);
  11122.     }
  11123.  
  11124.     public void calcEntityScreenPos(int i, int j, int l) {
  11125.         if (i < 128 || l < 128 || i > 13056 || l > 13056) {
  11126.             spriteDrawX = -1;
  11127.             spriteDrawY = -1;
  11128.             return;
  11129.         }
  11130.         int i1 = method42(plane, l, i) - j;
  11131.         i -= xCameraPos;
  11132.         i1 -= zCameraPos;
  11133.         l -= yCameraPos;
  11134.         int j1 = Model.modelIntArray1[yCameraCurve];
  11135.         int k1 = Model.modelIntArray2[yCameraCurve];
  11136.         int l1 = Model.modelIntArray1[xCameraCurve];
  11137.         int i2 = Model.modelIntArray2[xCameraCurve];
  11138.         int j2 = l * l1 + i * i2 >> 16;
  11139.         l = l * i2 - i * l1 >> 16;
  11140.         i = j2;
  11141.         j2 = i1 * k1 - l * j1 >> 16;
  11142.         l = i1 * j1 + l * k1 >> 16;
  11143.         i1 = j2;
  11144.         if (l >= 50) {
  11145.             spriteDrawX = Texture.textureInt1 + (i << 9) / l;
  11146.             spriteDrawY = Texture.textureInt2 + (i1 << 9) / l;
  11147.         } else {
  11148.             spriteDrawX = -1;
  11149.             spriteDrawY = -1;
  11150.         }
  11151.     }
  11152.  
  11153.     private void buildSplitPrivateChatMenu() {
  11154.         if (splitPrivateChat == 0)
  11155.             return;
  11156.         int i = 0;
  11157.         if (anInt1104 != 0)
  11158.             i = 1;
  11159.         for (int j = 0; j < 100; j++)
  11160.             if (chatMessages[j] != null) {
  11161.                 int k = chatTypes[j];
  11162.                 String s = chatNames[j];
  11163.                 if (s != null && s.startsWith("@cr1@")) {
  11164.                     s = s.substring(5);
  11165.                 }
  11166.                 if (s != null && s.startsWith("@cr2@")) {
  11167.                     s = s.substring(5);
  11168.                 }
  11169.                 if (s != null && s.startsWith("@cr3@")) {
  11170.                     s = s.substring(5);
  11171.                 }
  11172.                 if (s != null && s.startsWith("@cr4@")) {
  11173.                     s = s.substring(5);
  11174.                 }
  11175.                 if (s != null && s.startsWith("@cr5@")) {
  11176.                     s = s.substring(5);
  11177.                 }
  11178.                 if (s != null && s.startsWith("@cr6@")) {
  11179.                     s = s.substring(5);
  11180.                 }
  11181.                 if (s != null && s.startsWith("@cr7@")) {
  11182.                     s = s.substring(5);
  11183.                 }
  11184.                 if (s != null && s.startsWith("@cr8@")) {
  11185.                     s = s.substring(5);
  11186.                 }
  11187.                 if ((k == 3 || k == 7)
  11188.                         && (k == 7 || privateChatMode == 0 || privateChatMode == 1
  11189.                                 && isFriendOrSelf(s))) {
  11190.                     int l = 329 - i * 13;
  11191.                     if (super.mouseX > 4 && super.mouseY - 4 > l - 10
  11192.                             && super.mouseY - 4 <= l + 3) {
  11193.                         int i1 = aTextDrawingArea_1271.getTextWidth("From:  "
  11194.                                 + s + chatMessages[j]) + 25;
  11195.                         if (i1 > 450)
  11196.                             i1 = 450;
  11197.                         if (super.mouseX < 4 + i1) {
  11198.                             if (myPrivilege >= 1) {
  11199.                                 menuActionName[menuActionRow] = "Report abuse @whi@"
  11200.                                         + s;
  11201.                                 menuActionID[menuActionRow] = 2606;
  11202.                                 menuActionRow++;
  11203.                             }
  11204.                             menuActionName[menuActionRow] = "Add ignore @whi@"
  11205.                                     + s;
  11206.                             menuActionID[menuActionRow] = 2042;
  11207.                             menuActionRow++;
  11208.                             menuActionName[menuActionRow] = "Add friend @whi@"
  11209.                                     + s;
  11210.                             menuActionID[menuActionRow] = 2337;
  11211.                             menuActionRow++;
  11212.                         }
  11213.                     }
  11214.                     if (++i >= 5)
  11215.                         return;
  11216.                 }
  11217.                 if ((k == 5 || k == 6) && privateChatMode < 2 && ++i >= 5)
  11218.                     return;
  11219.             }
  11220.  
  11221.     }
  11222.  
  11223.     public void method130(int j, int k, int l, int i1, int j1, int k1, int l1,
  11224.             int i2, int j2) {
  11225.         Class30_Sub1 class30_sub1 = null;
  11226.         for (Class30_Sub1 class30_sub1_1 = (Class30_Sub1) aClass19_1179
  11227.                 .reverseGetFirst(); class30_sub1_1 != null; class30_sub1_1 = (Class30_Sub1) aClass19_1179
  11228.                 .reverseGetNext()) {
  11229.             if (class30_sub1_1.anInt1295 != l1
  11230.                     || class30_sub1_1.anInt1297 != i2
  11231.                     || class30_sub1_1.anInt1298 != j1
  11232.                     || class30_sub1_1.anInt1296 != i1)
  11233.                 continue;
  11234.             class30_sub1 = class30_sub1_1;
  11235.             break;
  11236.         }
  11237.  
  11238.         if (class30_sub1 == null) {
  11239.             class30_sub1 = new Class30_Sub1();
  11240.             class30_sub1.anInt1295 = l1;
  11241.             class30_sub1.anInt1296 = i1;
  11242.             class30_sub1.anInt1297 = i2;
  11243.             class30_sub1.anInt1298 = j1;
  11244.             method89(class30_sub1);
  11245.             aClass19_1179.insertHead(class30_sub1);
  11246.         }
  11247.         class30_sub1.anInt1291 = k;
  11248.         class30_sub1.anInt1293 = k1;
  11249.         class30_sub1.anInt1292 = l;
  11250.         class30_sub1.anInt1302 = j2;
  11251.         class30_sub1.anInt1294 = j;
  11252.     }
  11253.  
  11254.     private boolean interfaceIsSelected(RSInterface class9) {
  11255.         if (class9.anIntArray245 == null)
  11256.             return false;
  11257.         for (int i = 0; i < class9.anIntArray245.length; i++) {
  11258.             int j = extractInterfaceValues(class9, i);
  11259.             int k = class9.anIntArray212[i];
  11260.             if (class9.anIntArray245[i] == 2) {
  11261.                 if (j >= k)
  11262.                     return false;
  11263.             } else if (class9.anIntArray245[i] == 3) {
  11264.                 if (j <= k)
  11265.                     return false;
  11266.             } else if (class9.anIntArray245[i] == 4) {
  11267.                 if (j == k)
  11268.                     return false;
  11269.             } else if (j != k)
  11270.                 return false;
  11271.         }
  11272.  
  11273.         return true;
  11274.     }
  11275.  
  11276.     private DataInputStream openJagGrabInputStream(String s) throws IOException {
  11277.         // if(!aBoolean872)
  11278.         // if(signlink.mainapp != null)
  11279.         // return signlink.openurl(s);
  11280.         // else
  11281.         // return new DataInputStream((new URL(getCodeBase(), s)).openStream());
  11282.         if (aSocket832 != null) {
  11283.             try {
  11284.                 aSocket832.close();
  11285.             } catch (Exception _ex) {
  11286.             }
  11287.             aSocket832 = null;
  11288.         }
  11289.         aSocket832 = openSocket(43595);
  11290.         aSocket832.setSoTimeout(10000);
  11291.         java.io.InputStream inputstream = aSocket832.getInputStream();
  11292.         OutputStream outputstream = aSocket832.getOutputStream();
  11293.         outputstream.write(("JAGGRAB /" + s + "\n\n").getBytes());
  11294.         return new DataInputStream(inputstream);
  11295.     }
  11296.  
  11297.     public void doFlamesDrawing() {
  11298.         char c = '\u0100';
  11299.         if (anInt1040 > 0) {
  11300.             for (int i = 0; i < 256; i++)
  11301.                 if (anInt1040 > 768)
  11302.                     anIntArray850[i] = method83(anIntArray851[i],
  11303.                             anIntArray852[i], 1024 - anInt1040);
  11304.                 else if (anInt1040 > 256)
  11305.                     anIntArray850[i] = anIntArray852[i];
  11306.                 else
  11307.                     anIntArray850[i] = method83(anIntArray852[i],
  11308.                             anIntArray851[i], 256 - anInt1040);
  11309.  
  11310.         } else if (anInt1041 > 0) {
  11311.             for (int j = 0; j < 256; j++)
  11312.                 if (anInt1041 > 768)
  11313.                     anIntArray850[j] = method83(anIntArray851[j],
  11314.                             anIntArray853[j], 1024 - anInt1041);
  11315.                 else if (anInt1041 > 256)
  11316.                     anIntArray850[j] = anIntArray853[j];
  11317.                 else
  11318.                     anIntArray850[j] = method83(anIntArray853[j],
  11319.                             anIntArray851[j], 256 - anInt1041);
  11320.  
  11321.         } else {
  11322.             System.arraycopy(anIntArray851, 0, anIntArray850, 0, 256);
  11323.  
  11324.         }
  11325.         System.arraycopy(aClass30_Sub2_Sub1_Sub1_1201.myPixels, 0,
  11326.                 aRSImageProducer_1110.anIntArray315, 0, 33920);
  11327.  
  11328.         int i1 = 0;
  11329.         int j1 = 1152;
  11330.         for (int k1 = 1; k1 < c - 1; k1++) {
  11331.             int l1 = (anIntArray969[k1] * (c - k1)) / c;
  11332.             int j2 = 22 + l1;
  11333.             if (j2 < 0)
  11334.                 j2 = 0;
  11335.             i1 += j2;
  11336.             for (int l2 = j2; l2 < 128; l2++) {
  11337.                 int j3 = anIntArray828[i1++];
  11338.                 if (j3 != 0) {
  11339.                     int l3 = j3;
  11340.                     int j4 = 256 - j3;
  11341.                     j3 = anIntArray850[j3];
  11342.                     int l4 = aRSImageProducer_1110.anIntArray315[j1];
  11343.                     aRSImageProducer_1110.anIntArray315[j1++] = ((j3 & 0xff00ff)
  11344.                             * l3 + (l4 & 0xff00ff) * j4 & 0xff00ff00)
  11345.                             + ((j3 & 0xff00) * l3 + (l4 & 0xff00) * j4 & 0xff0000) >> 8;
  11346.                 } else {
  11347.                     j1++;
  11348.                 }
  11349.             }
  11350.  
  11351.             j1 += j2;
  11352.         }
  11353.  
  11354.         aRSImageProducer_1110.drawGraphics(0, super.graphics, 0);
  11355.         System.arraycopy(aClass30_Sub2_Sub1_Sub1_1202.myPixels, 0,
  11356.                 aRSImageProducer_1111.anIntArray315, 0, 33920);
  11357.  
  11358.         i1 = 0;
  11359.         j1 = 1176;
  11360.         for (int k2 = 1; k2 < c - 1; k2++) {
  11361.             int i3 = (anIntArray969[k2] * (c - k2)) / c;
  11362.             int k3 = 103 - i3;
  11363.             j1 += i3;
  11364.             for (int i4 = 0; i4 < k3; i4++) {
  11365.                 int k4 = anIntArray828[i1++];
  11366.                 if (k4 != 0) {
  11367.                     int i5 = k4;
  11368.                     int j5 = 256 - k4;
  11369.                     k4 = anIntArray850[k4];
  11370.                     int k5 = aRSImageProducer_1111.anIntArray315[j1];
  11371.                     aRSImageProducer_1111.anIntArray315[j1++] = ((k4 & 0xff00ff)
  11372.                             * i5 + (k5 & 0xff00ff) * j5 & 0xff00ff00)
  11373.                             + ((k4 & 0xff00) * i5 + (k5 & 0xff00) * j5 & 0xff0000) >> 8;
  11374.                 } else {
  11375.                     j1++;
  11376.                 }
  11377.             }
  11378.  
  11379.             i1 += 128 - k3;
  11380.             j1 += 128 - k3 - i3;
  11381.         }
  11382.  
  11383.         aRSImageProducer_1111.drawGraphics(0, super.graphics, 637);
  11384.     }
  11385.  
  11386.     public void method134(Stream stream) {
  11387.         int j = stream.readBits(8);
  11388.         if (j < playerCount) {
  11389.             for (int k = j; k < playerCount; k++)
  11390.                 anIntArray840[anInt839++] = playerIndices[k];
  11391.  
  11392.         }
  11393.         if (j > playerCount) {
  11394.             signlink.reporterror(myUsername + " Too many players");
  11395.             throw new RuntimeException("eek");
  11396.         }
  11397.         playerCount = 0;
  11398.         for (int l = 0; l < j; l++) {
  11399.             int i1 = playerIndices[l];
  11400.             Player player = playerArray[i1];
  11401.             int j1 = stream.readBits(1);
  11402.             if (j1 == 0) {
  11403.                 playerIndices[playerCount++] = i1;
  11404.                 player.anInt1537 = loopCycle;
  11405.             } else {
  11406.                 int k1 = stream.readBits(2);
  11407.                 if (k1 == 0) {
  11408.                     playerIndices[playerCount++] = i1;
  11409.                     player.anInt1537 = loopCycle;
  11410.                     anIntArray894[anInt893++] = i1;
  11411.                 } else if (k1 == 1) {
  11412.                     playerIndices[playerCount++] = i1;
  11413.                     player.anInt1537 = loopCycle;
  11414.                     int l1 = stream.readBits(3);
  11415.                     player.moveInDir(false, l1);
  11416.                     int j2 = stream.readBits(1);
  11417.                     if (j2 == 1)
  11418.                         anIntArray894[anInt893++] = i1;
  11419.                 } else if (k1 == 2) {
  11420.                     playerIndices[playerCount++] = i1;
  11421.                     player.anInt1537 = loopCycle;
  11422.                     int i2 = stream.readBits(3);
  11423.                     player.moveInDir(true, i2);
  11424.                     int k2 = stream.readBits(3);
  11425.                     player.moveInDir(true, k2);
  11426.                     int l2 = stream.readBits(1);
  11427.                     if (l2 == 1)
  11428.                         anIntArray894[anInt893++] = i1;
  11429.                 } else if (k1 == 3)
  11430.                     anIntArray840[anInt839++] = i1;
  11431.             }
  11432.         }
  11433.     }
  11434.  
  11435.     public void drawLoginScreen(boolean flag) {
  11436.         resetImageProducers();
  11437.         aRSImageProducer_1109.initDrawingArea();
  11438.         aBackground_966.drawBackground(0, 0);
  11439.         char c = '\u0168';
  11440.         char c1 = '\310';
  11441.         if (loginScreenState == 0) {
  11442.             int i = c1 / 2 + 80;
  11443.             smallText.method382(0x75a9a9, c / 2, onDemandFetcher.statusString,
  11444.                     i, true);
  11445.             i = c1 / 2 - 20;
  11446.             chatTextDrawingArea.method382(0xffffff, c / 2,
  11447.                     "Welcome to Project-OS", i, true);
  11448.             i += 30;
  11449.             int l = c / 2 - 80;
  11450.             int k1 = c1 / 2 + 20;
  11451.             aBackground_967.drawBackground(l - 73, k1 - 20);
  11452.             chatTextDrawingArea.method382(0xffffff, l, "About", k1 + 5, true);
  11453.             l = c / 2 + 80;
  11454.             aBackground_967.drawBackground(l - 73, k1 - 20);
  11455.             chatTextDrawingArea.method382(0xffffff, l, "Login", k1 + 5, true);
  11456.         }
  11457.         if (loginScreenState == 2) {
  11458.             int j = c1 / 2 - 40;
  11459.             if (loginMessage1.length() > 0) {
  11460.                 chatTextDrawingArea.method382(0xffff00, c / 2, loginMessage1,
  11461.                         j - 15, true);
  11462.                 chatTextDrawingArea.method382(0xa1a1a1, c / 2, loginMessage2,
  11463.                         j, true);
  11464.                 j += 30;
  11465.             } else {
  11466.                 chatTextDrawingArea.method382(0xa1a1a1, c / 2, loginMessage2,
  11467.                         j - 7, true);
  11468.                 j += 30;
  11469.             }
  11470.             chatTextDrawingArea
  11471.                     .method389(true, c / 2 - 90, 0xffffff, "Username: "
  11472.                             + capitalize(myUsername)
  11473.                             + ((loginScreenCursorPos == 0)
  11474.                                     & (loopCycle % 40 < 20) ? "@yel@|" : ""), j);
  11475.             // chatTextDrawingArea.method389(true, c / 2 - 90, 0xffffff,
  11476.             // "Username: " + myUsername + ((loginScreenCursorPos == 0) &
  11477.             // (loopCycle % 40 < 20) ? "@yel@|" : ""), j);
  11478.             j += 15;
  11479.             chatTextDrawingArea
  11480.                     .method389(true, c / 2 - 88, 0xffffff, "Password: "
  11481.                             + TextClass.passwordAsterisks(myPassword)
  11482.                             + ((loginScreenCursorPos == 1)
  11483.                                     & (loopCycle % 40 < 20) ? "@yel@|" : ""), j);
  11484.             j += 15;
  11485.             if (!flag) {
  11486.                 int i1 = c / 2 - 80;
  11487.                 int l1 = c1 / 2 + 50;
  11488.                 aBackground_967.drawBackground(i1 - 73, l1 - 20);
  11489.                 chatTextDrawingArea.method382(0xffffff, i1, "Login", l1 + 5,
  11490.                         true);
  11491.                 i1 = c / 2 + 80;
  11492.                 aBackground_967.drawBackground(i1 - 73, l1 - 20);
  11493.                 chatTextDrawingArea.method382(0xffffff, i1, "Cancel", l1 + 5,
  11494.                         true);
  11495.             }
  11496.         }
  11497.         if (loginScreenState == 3) {
  11498.             chatTextDrawingArea.method382(0xD19A15, c / 2, "Information",
  11499.                     c1 / 2 - 60, true);
  11500.             int k = c1 / 2 - 35;
  11501.             chatTextDrawingArea.method382(0xD19A15, c / 2,
  11502.                     "Be sure you register", k, true);
  11503.             k += 15;
  11504.             chatTextDrawingArea.method382(0xD19A15, c / 2, "on the forums", k,
  11505.                     true);
  11506.             k += 15;
  11507.             chatTextDrawingArea.method382(0xD19A15, c / 2, "www.pr-forum.net",
  11508.                     k, true);
  11509.             k += 15;
  11510.             chatTextDrawingArea.method382(0xD19A15, c / 2,
  11511.                     "Enjoy!", k, true);
  11512.             k += 15;
  11513.             int j1 = c / 2;
  11514.             int i2 = c1 / 2 + 50;
  11515.             aBackground_967.drawBackground(j1 - 73, i2 - 20);
  11516.             chatTextDrawingArea.method382(0xffffff, j1, "Cancel", i2 + 5, true);
  11517.         }
  11518.         aRSImageProducer_1109.drawGraphics(171, super.graphics, 202);
  11519.         if (welcomeScreenRaised) {
  11520.             welcomeScreenRaised = false;
  11521.             aRSImageProducer_1107.drawGraphics(0, super.graphics, 128);
  11522.             aRSImageProducer_1108.drawGraphics(371, super.graphics, 202);
  11523.             aRSImageProducer_1112.drawGraphics(265, super.graphics, 0);
  11524.             aRSImageProducer_1113.drawGraphics(265, super.graphics, 562);
  11525.             aRSImageProducer_1114.drawGraphics(171, super.graphics, 128);
  11526.             aRSImageProducer_1115.drawGraphics(171, super.graphics, 562);
  11527.         }
  11528.     }
  11529.  
  11530.     public void drawFlames() {
  11531.         drawingFlames = true;
  11532.         try {
  11533.             long l = System.currentTimeMillis();
  11534.             int i = 0;
  11535.             int j = 20;
  11536.             while (aBoolean831) {
  11537.                 anInt1208++;
  11538.                 // calcFlamesPosition();
  11539.                 // calcFlamesPosition();
  11540.                 doFlamesDrawing();
  11541.                 if (++i > 10) {
  11542.                     long l1 = System.currentTimeMillis();
  11543.                     int k = (int) (l1 - l) / 10 - j;
  11544.                     j = 40 - k;
  11545.                     if (j < 5)
  11546.                         j = 5;
  11547.                     i = 0;
  11548.                     l = l1;
  11549.                 }
  11550.                 try {
  11551.                     Thread.sleep(j);
  11552.                 } catch (Exception _ex) {
  11553.                 }
  11554.             }
  11555.         } catch (Exception _ex) {
  11556.         }
  11557.         drawingFlames = false;
  11558.     }
  11559.  
  11560.     @Override
  11561.     public void raiseWelcomeScreen() {
  11562.         welcomeScreenRaised = true;
  11563.     }
  11564.  
  11565.     public void method137(Stream stream, int j) {
  11566.         if (j == 84) {
  11567.             int k = stream.readUnsignedByte();
  11568.             int j3 = anInt1268 + (k >> 4 & 7);
  11569.             int i6 = anInt1269 + (k & 7);
  11570.             int l8 = stream.readUnsignedWord();
  11571.             int k11 = stream.readUnsignedWord();
  11572.             int l13 = stream.readUnsignedWord();
  11573.             if (j3 >= 0 && i6 >= 0 && j3 < 104 && i6 < 104) {
  11574.                 NodeList class19_1 = groundArray[plane][j3][i6];
  11575.                 if (class19_1 != null) {
  11576.                     for (Item class30_sub2_sub4_sub2_3 = (Item) class19_1
  11577.                             .reverseGetFirst(); class30_sub2_sub4_sub2_3 != null; class30_sub2_sub4_sub2_3 = (Item) class19_1
  11578.                             .reverseGetNext()) {
  11579.                         if (class30_sub2_sub4_sub2_3.ID != (l8 & 0x7fff)
  11580.                                 || class30_sub2_sub4_sub2_3.anInt1559 != k11)
  11581.                             continue;
  11582.                         class30_sub2_sub4_sub2_3.anInt1559 = l13;
  11583.                         break;
  11584.                     }
  11585.  
  11586.                     spawnGroundItem(j3, i6);
  11587.                 }
  11588.             }
  11589.             return;
  11590.         }
  11591.         if (j == 105) {
  11592.             int l = stream.readUnsignedByte();
  11593.             int k3 = anInt1268 + (l >> 4 & 7);
  11594.             int j6 = anInt1269 + (l & 7);
  11595.             int i9 = stream.readUnsignedWord();
  11596.             int l11 = stream.readUnsignedByte();
  11597.             int i14 = l11 >> 4 & 0xf;
  11598.             int i16 = l11 & 7;
  11599.             if (myPlayer.smallX[0] >= k3 - i14
  11600.                     && myPlayer.smallX[0] <= k3 + i14
  11601.                     && myPlayer.smallY[0] >= j6 - i14
  11602.                     && myPlayer.smallY[0] <= j6 + i14 && aBoolean848 && !lowMem
  11603.                     && anInt1062 < 50) {
  11604.                 anIntArray1207[anInt1062] = i9;
  11605.                 anIntArray1241[anInt1062] = i16;
  11606.                 anIntArray1250[anInt1062] = Sounds.anIntArray326[i9];
  11607.                 anInt1062++;
  11608.             }
  11609.         }
  11610.         if (j == 215) {
  11611.             int i1 = stream.method435();
  11612.             int l3 = stream.method428();
  11613.             int k6 = anInt1268 + (l3 >> 4 & 7);
  11614.             int j9 = anInt1269 + (l3 & 7);
  11615.             int i12 = stream.method435();
  11616.             int j14 = stream.readUnsignedWord();
  11617.             if (k6 >= 0 && j9 >= 0 && k6 < 104 && j9 < 104
  11618.                     && i12 != unknownInt10) {
  11619.                 Item class30_sub2_sub4_sub2_2 = new Item();
  11620.                 class30_sub2_sub4_sub2_2.ID = i1;
  11621.                 class30_sub2_sub4_sub2_2.anInt1559 = j14;
  11622.                 if (groundArray[plane][k6][j9] == null)
  11623.                     groundArray[plane][k6][j9] = new NodeList();
  11624.                 groundArray[plane][k6][j9].insertHead(class30_sub2_sub4_sub2_2);
  11625.                 spawnGroundItem(k6, j9);
  11626.             }
  11627.             return;
  11628.         }
  11629.         if (j == 156) {
  11630.             int j1 = stream.method426();
  11631.             int i4 = anInt1268 + (j1 >> 4 & 7);
  11632.             int l6 = anInt1269 + (j1 & 7);
  11633.             int k9 = stream.readUnsignedWord();
  11634.             if (i4 >= 0 && l6 >= 0 && i4 < 104 && l6 < 104) {
  11635.                 NodeList class19 = groundArray[plane][i4][l6];
  11636.                 if (class19 != null) {
  11637.                     for (Item item = (Item) class19.reverseGetFirst(); item != null; item = (Item) class19
  11638.                             .reverseGetNext()) {
  11639.                         if (item.ID != (k9 & 0x7fff))
  11640.                             continue;
  11641.                         item.unlink();
  11642.                         break;
  11643.                     }
  11644.  
  11645.                     if (class19.reverseGetFirst() == null)
  11646.                         groundArray[plane][i4][l6] = null;
  11647.                     spawnGroundItem(i4, l6);
  11648.                 }
  11649.             }
  11650.             return;
  11651.         }
  11652.         if (j == 160) {
  11653.             int k1 = stream.method428();
  11654.             int j4 = anInt1268 + (k1 >> 4 & 7);
  11655.             int i7 = anInt1269 + (k1 & 7);
  11656.             int l9 = stream.method428();
  11657.             int j12 = l9 >> 2;
  11658.             int k14 = l9 & 3;
  11659.             int j16 = anIntArray1177[j12];
  11660.             int j17 = stream.method435();
  11661.             if (j4 >= 0 && i7 >= 0 && j4 < 103 && i7 < 103) {
  11662.                 int j18 = intGroundArray[plane][j4][i7];
  11663.                 int i19 = intGroundArray[plane][j4 + 1][i7];
  11664.                 int l19 = intGroundArray[plane][j4 + 1][i7 + 1];
  11665.                 int k20 = intGroundArray[plane][j4][i7 + 1];
  11666.                 if (j16 == 0) {
  11667.                     Object1 class10 = worldController.method296(plane, j4, i7);
  11668.                     if (class10 != null) {
  11669.                         int k21 = class10.uid >> 14 & 0x7fff;
  11670.                         if (j12 == 2) {
  11671.                             class10.aClass30_Sub2_Sub4_278 = new Animable_Sub5(
  11672.                                     k21, 4 + k14, 2, i19, l19, j18, k20, j17,
  11673.                                     false);
  11674.                             class10.aClass30_Sub2_Sub4_279 = new Animable_Sub5(
  11675.                                     k21, k14 + 1 & 3, 2, i19, l19, j18, k20,
  11676.                                     j17, false);
  11677.                         } else {
  11678.                             class10.aClass30_Sub2_Sub4_278 = new Animable_Sub5(
  11679.                                     k21, k14, j12, i19, l19, j18, k20, j17,
  11680.                                     false);
  11681.                         }
  11682.                     }
  11683.                 }
  11684.                 if (j16 == 1) {
  11685.                     Object2 class26 = worldController.method297(j4, i7, plane);
  11686.                     if (class26 != null)
  11687.                         class26.aClass30_Sub2_Sub4_504 = new Animable_Sub5(
  11688.                                 class26.uid >> 14 & 0x7fff, 0, 4, i19, l19,
  11689.                                 j18, k20, j17, false);
  11690.                 }
  11691.                 if (j16 == 2) {
  11692.                     Object5 class28 = worldController.method298(j4, i7, plane);
  11693.                     if (j12 == 11)
  11694.                         j12 = 10;
  11695.                     if (class28 != null)
  11696.                         class28.aClass30_Sub2_Sub4_521 = new Animable_Sub5(
  11697.                                 class28.uid >> 14 & 0x7fff, k14, j12, i19, l19,
  11698.                                 j18, k20, j17, false);
  11699.                 }
  11700.                 if (j16 == 3) {
  11701.                     Object3 class49 = worldController.method299(i7, j4, plane);
  11702.                     if (class49 != null)
  11703.                         class49.aClass30_Sub2_Sub4_814 = new Animable_Sub5(
  11704.                                 class49.uid >> 14 & 0x7fff, k14, 22, i19, l19,
  11705.                                 j18, k20, j17, false);
  11706.                 }
  11707.             }
  11708.             return;
  11709.         }
  11710.         if (j == 147) {
  11711.             int l1 = stream.method428();
  11712.             int k4 = anInt1268 + (l1 >> 4 & 7);
  11713.             int j7 = anInt1269 + (l1 & 7);
  11714.             int i10 = stream.readUnsignedWord();
  11715.             byte byte0 = stream.method430();
  11716.             int l14 = stream.method434();
  11717.             byte byte1 = stream.method429();
  11718.             int k17 = stream.readUnsignedWord();
  11719.             int k18 = stream.method428();
  11720.             int j19 = k18 >> 2;
  11721.             int i20 = k18 & 3;
  11722.             int l20 = anIntArray1177[j19];
  11723.             byte byte2 = stream.readSignedByte();
  11724.             int l21 = stream.readUnsignedWord();
  11725.             byte byte3 = stream.method429();
  11726.             Player player;
  11727.             if (i10 == unknownInt10)
  11728.                 player = myPlayer;
  11729.             else
  11730.                 player = playerArray[i10];
  11731.             if (player != null) {
  11732.                 ObjectDef class46 = ObjectDef.forID(l21);
  11733.                 int i22 = intGroundArray[plane][k4][j7];
  11734.                 int j22 = intGroundArray[plane][k4 + 1][j7];
  11735.                 int k22 = intGroundArray[plane][k4 + 1][j7 + 1];
  11736.                 int l22 = intGroundArray[plane][k4][j7 + 1];
  11737.                 Model model = class46.method578(j19, i20, i22, j22, k22, l22,
  11738.                         -1);
  11739.                 if (model != null) {
  11740.                     method130(k17 + 1, -1, 0, l20, j7, 0, plane, k4, l14 + 1);
  11741.                     player.anInt1707 = l14 + loopCycle;
  11742.                     player.anInt1708 = k17 + loopCycle;
  11743.                     player.aModel_1714 = model;
  11744.                     int i23 = class46.anInt744;
  11745.                     int j23 = class46.anInt761;
  11746.                     if (i20 == 1 || i20 == 3) {
  11747.                         i23 = class46.anInt761;
  11748.                         j23 = class46.anInt744;
  11749.                     }
  11750.                     player.anInt1711 = k4 * 128 + i23 * 64;
  11751.                     player.anInt1713 = j7 * 128 + j23 * 64;
  11752.                     player.anInt1712 = method42(plane, player.anInt1713,
  11753.                             player.anInt1711);
  11754.                     if (byte2 > byte0) {
  11755.                         byte byte4 = byte2;
  11756.                         byte2 = byte0;
  11757.                         byte0 = byte4;
  11758.                     }
  11759.                     if (byte3 > byte1) {
  11760.                         byte byte5 = byte3;
  11761.                         byte3 = byte1;
  11762.                         byte1 = byte5;
  11763.                     }
  11764.                     player.anInt1719 = k4 + byte2;
  11765.                     player.anInt1721 = k4 + byte0;
  11766.                     player.anInt1720 = j7 + byte3;
  11767.                     player.anInt1722 = j7 + byte1;
  11768.                 }
  11769.             }
  11770.         }
  11771.         if (j == 151) {
  11772.             int i2 = stream.method426();
  11773.             int l4 = anInt1268 + (i2 >> 4 & 7);
  11774.             int k7 = anInt1269 + (i2 & 7);
  11775.             int j10 = stream.method434();
  11776.             int k12 = stream.method428();
  11777.             int i15 = k12 >> 2;
  11778.             int k16 = k12 & 3;
  11779.             int l17 = anIntArray1177[i15];
  11780.             if (l4 >= 0 && k7 >= 0 && l4 < 104 && k7 < 104)
  11781.                 method130(-1, j10, k16, l17, k7, i15, plane, l4, 0);
  11782.             return;
  11783.         }
  11784.         if (j == 4) {
  11785.             int j2 = stream.readUnsignedByte();
  11786.             int i5 = anInt1268 + (j2 >> 4 & 7);
  11787.             int l7 = anInt1269 + (j2 & 7);
  11788.             int k10 = stream.readUnsignedWord();
  11789.             int l12 = stream.readUnsignedByte();
  11790.             int j15 = stream.readUnsignedWord();
  11791.             if (i5 >= 0 && l7 >= 0 && i5 < 104 && l7 < 104) {
  11792.                 i5 = i5 * 128 + 64;
  11793.                 l7 = l7 * 128 + 64;
  11794.                 Animable_Sub3 class30_sub2_sub4_sub3 = new Animable_Sub3(plane,
  11795.                         loopCycle, j15, k10, method42(plane, l7, i5) - l12, l7,
  11796.                         i5);
  11797.                 aClass19_1056.insertHead(class30_sub2_sub4_sub3);
  11798.             }
  11799.             return;
  11800.         }
  11801.         if (j == 44) {
  11802.             int k2 = stream.method436();
  11803.             int j5 = stream.readUnsignedWord();
  11804.             int i8 = stream.readUnsignedByte();
  11805.             int l10 = anInt1268 + (i8 >> 4 & 7);
  11806.             int i13 = anInt1269 + (i8 & 7);
  11807.             if (l10 >= 0 && i13 >= 0 && l10 < 104 && i13 < 104) {
  11808.                 Item class30_sub2_sub4_sub2_1 = new Item();
  11809.                 class30_sub2_sub4_sub2_1.ID = k2;
  11810.                 class30_sub2_sub4_sub2_1.anInt1559 = j5;
  11811.                 if (groundArray[plane][l10][i13] == null)
  11812.                     groundArray[plane][l10][i13] = new NodeList();
  11813.                 groundArray[plane][l10][i13]
  11814.                         .insertHead(class30_sub2_sub4_sub2_1);
  11815.                 spawnGroundItem(l10, i13);
  11816.             }
  11817.             return;
  11818.         }
  11819.         if (j == 101) {
  11820.             int l2 = stream.method427();
  11821.             int k5 = l2 >> 2;
  11822.             int j8 = l2 & 3;
  11823.             int i11 = anIntArray1177[k5];
  11824.             int j13 = stream.readUnsignedByte();
  11825.             int k15 = anInt1268 + (j13 >> 4 & 7);
  11826.             int l16 = anInt1269 + (j13 & 7);
  11827.             if (k15 >= 0 && l16 >= 0 && k15 < 104 && l16 < 104)
  11828.                 method130(-1, -1, j8, i11, l16, k5, plane, k15, 0);
  11829.             return;
  11830.         }
  11831.         if (j == 117) {
  11832.             int i3 = stream.readUnsignedByte();
  11833.             int l5 = anInt1268 + (i3 >> 4 & 7);
  11834.             int k8 = anInt1269 + (i3 & 7);
  11835.             int j11 = l5 + stream.readSignedByte();
  11836.             int k13 = k8 + stream.readSignedByte();
  11837.             int l15 = stream.readSignedWord();
  11838.             int i17 = stream.readUnsignedWord();
  11839.             int i18 = stream.readUnsignedByte() * 4;
  11840.             int l18 = stream.readUnsignedByte() * 4;
  11841.             int k19 = stream.readUnsignedWord();
  11842.             int j20 = stream.readUnsignedWord();
  11843.             int i21 = stream.readUnsignedByte();
  11844.             int j21 = stream.readUnsignedByte();
  11845.             if (l5 >= 0 && k8 >= 0 && l5 < 104 && k8 < 104 && j11 >= 0
  11846.                     && k13 >= 0 && j11 < 104 && k13 < 104 && i17 != 65535) {
  11847.                 l5 = l5 * 128 + 64;
  11848.                 k8 = k8 * 128 + 64;
  11849.                 j11 = j11 * 128 + 64;
  11850.                 k13 = k13 * 128 + 64;
  11851.                 Animable_Sub4 class30_sub2_sub4_sub4 = new Animable_Sub4(i21,
  11852.                         l18, k19 + loopCycle, j20 + loopCycle, j21, plane,
  11853.                         method42(plane, k8, l5) - i18, k8, l5, l15, i17);
  11854.                 class30_sub2_sub4_sub4.method455(k19 + loopCycle, k13,
  11855.                         method42(plane, k13, j11) - l18, j11);
  11856.                 aClass19_1013.insertHead(class30_sub2_sub4_sub4);
  11857.             }
  11858.         }
  11859.     }
  11860.  
  11861.     @SuppressWarnings("unused")
  11862.     private static void setLowMem() {
  11863.         WorldController.lowMem = true;
  11864.         Texture.lowMem = true;
  11865.         lowMem = true;
  11866.         ObjectManager.lowMem = true;
  11867.         ObjectDef.lowMem = true;
  11868.     }
  11869.  
  11870.     public void method139(Stream stream) {
  11871.         stream.initBitAccess();
  11872.         int k = stream.readBits(8);
  11873.         if (k < npcCount) {
  11874.             for (int l = k; l < npcCount; l++)
  11875.                 anIntArray840[anInt839++] = npcIndices[l];
  11876.  
  11877.         }
  11878.         if (k > npcCount) {
  11879.             signlink.reporterror(myUsername + " Too many npcs");
  11880.             throw new RuntimeException("eek");
  11881.         }
  11882.         npcCount = 0;
  11883.         for (int i1 = 0; i1 < k; i1++) {
  11884.             int j1 = npcIndices[i1];
  11885.             NPC npc = npcArray[j1];
  11886.             int k1 = stream.readBits(1);
  11887.             if (k1 == 0) {
  11888.                 npcIndices[npcCount++] = j1;
  11889.                 npc.anInt1537 = loopCycle;
  11890.             } else {
  11891.                 int l1 = stream.readBits(2);
  11892.                 if (l1 == 0) {
  11893.                     npcIndices[npcCount++] = j1;
  11894.                     npc.anInt1537 = loopCycle;
  11895.                     anIntArray894[anInt893++] = j1;
  11896.                 } else if (l1 == 1) {
  11897.                     npcIndices[npcCount++] = j1;
  11898.                     npc.anInt1537 = loopCycle;
  11899.                     int i2 = stream.readBits(3);
  11900.                     npc.moveInDir(false, i2);
  11901.                     int k2 = stream.readBits(1);
  11902.                     if (k2 == 1)
  11903.                         anIntArray894[anInt893++] = j1;
  11904.                 } else if (l1 == 2) {
  11905.                     npcIndices[npcCount++] = j1;
  11906.                     npc.anInt1537 = loopCycle;
  11907.                     int j2 = stream.readBits(3);
  11908.                     npc.moveInDir(true, j2);
  11909.                     int l2 = stream.readBits(3);
  11910.                     npc.moveInDir(true, l2);
  11911.                     int i3 = stream.readBits(1);
  11912.                     if (i3 == 1)
  11913.                         anIntArray894[anInt893++] = j1;
  11914.                 } else if (l1 == 3)
  11915.                     anIntArray840[anInt839++] = j1;
  11916.             }
  11917.         }
  11918.  
  11919.     }
  11920.  
  11921.     public void processLoginScreenInput() {
  11922.         if (loginScreenState == 0) {
  11923.             int i = super.myWidth / 2 - 80;
  11924.             int l = super.myHeight / 2 + 20;
  11925.             l += 20;
  11926.             if (super.clickMode3 == 1 && super.saveClickX >= i - 75
  11927.                     && super.saveClickX <= i + 75 && super.saveClickY >= l - 20
  11928.                     && super.saveClickY <= l + 20) {
  11929.                 loginScreenState = 3;
  11930.                 loginScreenCursorPos = 0;
  11931.             }
  11932.             i = super.myWidth / 2 + 80;
  11933.             if (super.clickMode3 == 1 && super.saveClickX >= i - 75
  11934.                     && super.saveClickX <= i + 75 && super.saveClickY >= l - 20
  11935.                     && super.saveClickY <= l + 20) {
  11936.                 loginMessage1 = "";
  11937.                 loginMessage2 = "Enter your username & password.";
  11938.                 loginScreenState = 2;
  11939.                 loginScreenCursorPos = 0;
  11940.             }
  11941.         } else {
  11942.             if (loginScreenState == 2) {
  11943.                 int j = super.myHeight / 2 - 40;
  11944.                 j += 30;
  11945.                 j += 25;
  11946.                 if (super.clickMode3 == 1 && super.saveClickY >= j - 15
  11947.                         && super.saveClickY < j)
  11948.                     loginScreenCursorPos = 0;
  11949.                 j += 15;
  11950.                 if (super.clickMode3 == 1 && super.saveClickY >= j - 15
  11951.                         && super.saveClickY < j)
  11952.                     loginScreenCursorPos = 1;
  11953.                 j += 15;
  11954.                 int i1 = super.myWidth / 2 - 80;
  11955.                 int k1 = super.myHeight / 2 + 50;
  11956.                 k1 += 20;
  11957.                 if (super.clickMode3 == 1 && super.saveClickX >= i1 - 75
  11958.                         && super.saveClickX <= i1 + 75
  11959.                         && super.saveClickY >= k1 - 20
  11960.                         && super.saveClickY <= k1 + 20) {
  11961.                     loginFailures = 0;
  11962.                     login(myUsername, myPassword, false);
  11963.                     if (loggedIn)
  11964.                         return;
  11965.                 }
  11966.                 i1 = super.myWidth / 2 + 80;
  11967.                 if (super.clickMode3 == 1 && super.saveClickX >= i1 - 75
  11968.                         && super.saveClickX <= i1 + 75
  11969.                         && super.saveClickY >= k1 - 20
  11970.                         && super.saveClickY <= k1 + 20) {
  11971.                     loginScreenState = 0;
  11972.                     // myUsername = "";
  11973.                     // myPassword = "";
  11974.                 }
  11975.                 do {
  11976.                     int l1 = readChar(-796);
  11977.                     if (l1 == -1)
  11978.                         break;
  11979.                     boolean flag1 = false;
  11980.                     for (int i2 = 0; i2 < validUserPassChars.length(); i2++) {
  11981.                         if (l1 != validUserPassChars.charAt(i2))
  11982.                             continue;
  11983.                         flag1 = true;
  11984.                         break;
  11985.                     }
  11986.  
  11987.                     if (loginScreenCursorPos == 0) {
  11988.                         if (l1 == 8 && myUsername.length() > 0)
  11989.                             myUsername = myUsername.substring(0,
  11990.                                     myUsername.length() - 1);
  11991.                         if (l1 == 9 || l1 == 10 || l1 == 13)
  11992.                             loginScreenCursorPos = 1;
  11993.                         if (flag1)
  11994.                             myUsername += (char) l1;
  11995.                         if (myUsername.length() > 12)
  11996.                             myUsername = myUsername.substring(0, 12);
  11997.                     } else if (loginScreenCursorPos == 1) {
  11998.                         if (l1 == 8 && myPassword.length() > 0)
  11999.                             myPassword = myPassword.substring(0,
  12000.                                     myPassword.length() - 1);
  12001.                         if (l1 == 9 || l1 == 10 || l1 == 13)
  12002.                             if (myUsername == "")
  12003.                                 loginScreenCursorPos = 0;
  12004.                             else if (myPassword == "") {
  12005.                             } else
  12006.                                 login(myUsername, myPassword, false);
  12007.                         if (flag1)
  12008.                             myPassword += (char) l1;
  12009.                         if (myPassword.length() > 20)
  12010.                             myPassword = myPassword.substring(0, 20);
  12011.                     }
  12012.                 } while (true);
  12013.                 return;
  12014.             }
  12015.             if (loginScreenState == 3) {
  12016.                 int k = super.myWidth / 2;
  12017.                 int j1 = super.myHeight / 2 + 50;
  12018.                 j1 += 20;
  12019.                 if (super.clickMode3 == 1 && super.saveClickX >= k - 75
  12020.                         && super.saveClickX <= k + 75
  12021.                         && super.saveClickY >= j1 - 20
  12022.                         && super.saveClickY <= j1 + 20)
  12023.                     loginScreenState = 0;
  12024.             }
  12025.         }
  12026.     }
  12027.  
  12028.     private void markMinimap(Sprite sprite, int i, int j) {
  12029.         if (revision474 == true) {
  12030.             int k = viewRotation + minimapRotation & 0x7ff;
  12031.             int l = i * i + j * j;
  12032.             if (l > 6400)
  12033.                 return;
  12034.             int i1 = Model.modelIntArray1[k];
  12035.             int j1 = Model.modelIntArray2[k];
  12036.             i1 = (i1 * 256) / (minimapZoom + 256);
  12037.             j1 = (j1 * 256) / (minimapZoom + 256);
  12038.             int k1 = j * i1 + i * j1 >> 16;
  12039.             int l1 = j * j1 - i * i1 >> 16;
  12040.             if (l > 2500) {
  12041.                 sprite.drawSprite(((94 + k1) - sprite.maxWidth / 2) + 4 + 30,
  12042.                         83 - l1 - sprite.maxHeight / 2 - 4 + 5);
  12043.             } else {
  12044.                 sprite.drawSprite(((94 + k1) - sprite.maxWidth / 2) + 4 + 30,
  12045.                         83 - l1 - sprite.maxHeight / 2 - 4 + 5);
  12046.             }
  12047.         } else {
  12048.             int k = viewRotation + minimapRotation & 0x7ff;
  12049.             int l = i * i + j * j;
  12050.             if (l > 6400)
  12051.                 return;
  12052.             int i1 = Model.modelIntArray1[k];
  12053.             int j1 = Model.modelIntArray2[k];
  12054.             i1 = (i1 * 256) / (minimapZoom + 256);
  12055.             j1 = (j1 * 256) / (minimapZoom + 256);
  12056.             int k1 = j * i1 + i * j1 >> 16;
  12057.             int l1 = j * j1 - i * i1 >> 16;
  12058.             try {
  12059.                 sprite.drawSprite(((94 + k1) - sprite.maxWidth / 2) + 4 + 20,
  12060.                         83 - l1 - sprite.maxHeight / 2 - 4 + 5);
  12061.             } catch (Exception e) {
  12062.                 e.printStackTrace();
  12063.                 return;
  12064.             }
  12065.         }
  12066.     }
  12067.  
  12068.     public void method142(int i, int j, int k, int l, int i1, int j1, int k1) {
  12069.         if (i1 >= 1 && i >= 1 && i1 <= 102 && i <= 102) {
  12070.             if (lowMem && j != plane)
  12071.                 return;
  12072.             int i2 = 0;
  12073.             if (j1 == 0)
  12074.                 i2 = worldController.method300(j, i1, i);
  12075.             if (j1 == 1)
  12076.                 i2 = worldController.method301(j, i1, i);
  12077.             if (j1 == 2)
  12078.                 i2 = worldController.method302(j, i1, i);
  12079.             if (j1 == 3)
  12080.                 i2 = worldController.method303(j, i1, i);
  12081.             if (i2 != 0) {
  12082.                 int i3 = worldController.method304(j, i1, i, i2);
  12083.                 int j2 = i2 >> 14 & 0x7fff;
  12084.                 int k2 = i3 & 0x1f;
  12085.                 int l2 = i3 >> 6;
  12086.                 if (j1 == 0) {
  12087.                     worldController.method291(i1, j, i, (byte) -119);
  12088.                     ObjectDef class46 = ObjectDef.forID(j2);
  12089.                     if (class46.aBoolean767)
  12090.                         aClass11Array1230[j].method215(l2, k2,
  12091.                                 class46.aBoolean757, i1, i);
  12092.                 }
  12093.                 if (j1 == 1)
  12094.                     worldController.method292(i, j, i1);
  12095.                 if (j1 == 2) {
  12096.                     worldController.method293(j, i1, i);
  12097.                     ObjectDef class46_1 = ObjectDef.forID(j2);
  12098.                     if (i1 + class46_1.anInt744 > 103
  12099.                             || i + class46_1.anInt744 > 103
  12100.                             || i1 + class46_1.anInt761 > 103
  12101.                             || i + class46_1.anInt761 > 103)
  12102.                         return;
  12103.                     if (class46_1.aBoolean767)
  12104.                         aClass11Array1230[j].method216(l2, class46_1.anInt744,
  12105.                                 i1, i, class46_1.anInt761,
  12106.                                 class46_1.aBoolean757);
  12107.                 }
  12108.                 if (j1 == 3) {
  12109.                     worldController.method294(j, i, i1);
  12110.                     ObjectDef class46_2 = ObjectDef.forID(j2);
  12111.                     if (class46_2.aBoolean767 && class46_2.hasActions)
  12112.                         aClass11Array1230[j].method218(i, i1);
  12113.                 }
  12114.             }
  12115.             if (k1 >= 0) {
  12116.                 int j3 = j;
  12117.                 if (j3 < 3 && (byteGroundArray[1][i1][i] & 2) == 2)
  12118.                     j3++;
  12119.                 ObjectManager.method188(worldController, k, i, l, j3,
  12120.                         aClass11Array1230[j], intGroundArray, i1, k1, j);
  12121.             }
  12122.         }
  12123.     }
  12124.  
  12125.     public void updatePlayers(int i, Stream stream) {
  12126.         anInt839 = 0;
  12127.         anInt893 = 0;
  12128.         method117(stream);
  12129.         method134(stream);
  12130.         method91(stream, i);
  12131.         method49(stream);
  12132.         for (int k = 0; k < anInt839; k++) {
  12133.             int l = anIntArray840[k];
  12134.             if (playerArray[l].anInt1537 != loopCycle)
  12135.                 playerArray[l] = null;
  12136.         }
  12137.  
  12138.         if (stream.currentOffset != i) {
  12139.             signlink.reporterror("Error packet size mismatch in getplayer pos:"
  12140.                     + stream.currentOffset + " psize:" + i);
  12141.             throw new RuntimeException("eek");
  12142.         }
  12143.         for (int i1 = 0; i1 < playerCount; i1++)
  12144.             if (playerArray[playerIndices[i1]] == null) {
  12145.                 signlink.reporterror(myUsername
  12146.                         + " null entry in pl list - pos:" + i1 + " size:"
  12147.                         + playerCount);
  12148.                 throw new RuntimeException("eek");
  12149.             }
  12150.  
  12151.     }
  12152.  
  12153.     public void setCameraPos(int j, int k, int l, int i1, int j1, int k1) {
  12154.         int l1 = 2048 - k & 0x7ff;
  12155.         int i2 = 2048 - j1 & 0x7ff;
  12156.         int j2 = 0;
  12157.         int k2 = 0;
  12158.         int l2 = j;
  12159.         if (l1 != 0) {
  12160.             int i3 = Model.modelIntArray1[l1];
  12161.             int k3 = Model.modelIntArray2[l1];
  12162.             int i4 = k2 * k3 - l2 * i3 >> 16;
  12163.             l2 = k2 * i3 + l2 * k3 >> 16;
  12164.             k2 = i4;
  12165.         }
  12166.         if (i2 != 0) {
  12167.             /*
  12168.              * xxx if(cameratoggle){ if(zoom == 0) zoom = k2; if(lftrit == 0)
  12169.              * lftrit = j2; if(fwdbwd == 0) fwdbwd = l2; k2 = zoom; j2 = lftrit;
  12170.              * l2 = fwdbwd; }
  12171.              */
  12172.             int j3 = Model.modelIntArray1[i2];
  12173.             int l3 = Model.modelIntArray2[i2];
  12174.             int j4 = l2 * j3 + j2 * l3 >> 16;
  12175.             l2 = l2 * l3 - j2 * j3 >> 16;
  12176.             j2 = j4;
  12177.         }
  12178.         xCameraPos = l - j2;
  12179.         zCameraPos = i1 - k2;
  12180.         yCameraPos = k1 - l2;
  12181.         yCameraCurve = k;
  12182.         xCameraCurve = j1;
  12183.     }
  12184.  
  12185.     public void updateStrings(String str, int i) {
  12186.         switch (i) {
  12187.         case 1675:
  12188.             sendFrame126(str, 17508);
  12189.             break;// Stab
  12190.         case 1676:
  12191.             sendFrame126(str, 17509);
  12192.             break;// Slash
  12193.         case 1678:
  12194.             sendFrame126(str, 17511);
  12195.             break;// Magic
  12196.         case 1679:
  12197.             sendFrame126(str, 17512);
  12198.             break;// Range
  12199.         case 1680:
  12200.             sendFrame126(str, 17513);
  12201.             break;// Stab
  12202.         case 1681:
  12203.             sendFrame126(str, 17514);
  12204.             break;// Slash
  12205.         case 1682:
  12206.             sendFrame126(str, 17515);
  12207.             break;// Crush
  12208.         case 1683:
  12209.             sendFrame126(str, 17516);
  12210.             break;// Magic
  12211.         case 1684:
  12212.             sendFrame126(str, 17517);
  12213.             break;// Range
  12214.         case 1686:
  12215.             sendFrame126(str, 17518);
  12216.             break;// Strength
  12217.         case 1687:
  12218.             sendFrame126(str, 17519);
  12219.             break;// Prayer
  12220.         }
  12221.     }
  12222.  
  12223.     public void sendFrame126(String str, int i) {
  12224.         RSInterface.interfaceCache[i].message = str;
  12225.         if (RSInterface.interfaceCache[i].parentID == tabInterfaceIDs[tabID])
  12226.             needDrawTabArea = true;
  12227.     }
  12228.  
  12229.     public void sendPacket185(int button, int toggle, int type) {
  12230.         switch (type) {
  12231.         case 135:
  12232.             RSInterface class9 = RSInterface.interfaceCache[button];
  12233.             boolean flag8 = true;
  12234.             if (class9.contentType > 0)
  12235.                 flag8 = promptUserForInput(class9);
  12236.             if (flag8) {
  12237.                 stream.createFrame(185);
  12238.                 stream.writeWord(button);
  12239.             }
  12240.             break;
  12241.         case 646:
  12242.             stream.createFrame(185);
  12243.             stream.writeWord(button);
  12244.             RSInterface class9_2 = RSInterface.interfaceCache[button];
  12245.             if (class9_2.valueIndexArray != null
  12246.                     && class9_2.valueIndexArray[0][0] == 5) {
  12247.                 if (variousSettings[toggle] != class9_2.anIntArray212[0]) {
  12248.                     variousSettings[toggle] = class9_2.anIntArray212[0];
  12249.                     method33(toggle);
  12250.                     needDrawTabArea = true;
  12251.                 }
  12252.             }
  12253.             break;
  12254.         case 169:
  12255.             stream.createFrame(185);
  12256.             stream.writeWord(button);
  12257.             RSInterface class9_3 = RSInterface.interfaceCache[button];
  12258.             if (class9_3.valueIndexArray != null
  12259.                     && class9_3.valueIndexArray[0][0] == 5) {
  12260.                 variousSettings[toggle] = 1 - variousSettings[toggle];
  12261.                 method33(toggle);
  12262.                 needDrawTabArea = true;
  12263.             }
  12264.             switch (button) {
  12265.             case 19136:
  12266.                 System.out.println("toggle = " + toggle);
  12267.                 if (toggle == 0)
  12268.                     sendFrame36(173, toggle);
  12269.                 if (toggle == 1)
  12270.                     sendPacket185(153, 173, 646);
  12271.                 break;
  12272.             }
  12273.             break;
  12274.         }
  12275.     }
  12276.  
  12277.     public void sendFrame36(int id, int state) {
  12278.         anIntArray1045[id] = state;
  12279.         if (variousSettings[id] != state) {
  12280.             variousSettings[id] = state;
  12281.             method33(id);
  12282.             needDrawTabArea = true;
  12283.             if (dialogID != -1)
  12284.                 inputTaken = true;
  12285.         }
  12286.     }
  12287.  
  12288.     public void sendFrame219() {
  12289.         if (invOverlayInterfaceID != -1) {
  12290.             invOverlayInterfaceID = -1;
  12291.             needDrawTabArea = true;
  12292.             tabAreaAltered = true;
  12293.         }
  12294.         if (backDialogID != -1) {
  12295.             backDialogID = -1;
  12296.             inputTaken = true;
  12297.         }
  12298.         if (inputDialogState != 0) {
  12299.             inputDialogState = 0;
  12300.             inputTaken = true;
  12301.         }
  12302.         openInterfaceID = -1;
  12303.         aBoolean1149 = false;
  12304.     }
  12305.  
  12306.     public void sendFrame248(int interfaceID, int sideInterfaceID) {
  12307.         if (backDialogID != -1) {
  12308.             backDialogID = -1;
  12309.             inputTaken = true;
  12310.         }
  12311.         if (inputDialogState != 0) {
  12312.             inputDialogState = 0;
  12313.             inputTaken = true;
  12314.         }
  12315.         openInterfaceID = interfaceID;
  12316.         invOverlayInterfaceID = sideInterfaceID;
  12317.         needDrawTabArea = true;
  12318.         tabAreaAltered = true;
  12319.         aBoolean1149 = false;
  12320.     }
  12321.  
  12322.     private boolean parsePacket() {
  12323.         if (socketStream == null)
  12324.             return false;
  12325.         try {
  12326.             int i = socketStream.available();
  12327.             if (i == 0)
  12328.                 return false;
  12329.             if (pktType == -1) {
  12330.                 socketStream.flushInputStream(inStream.buffer, 1);
  12331.                 pktType = inStream.buffer[0] & 0xff;
  12332.                 if (encryption != null)
  12333.                     pktType = pktType - encryption.getNextKey() & 0xff;
  12334.                 pktSize = SizeConstants.packetSizes[pktType];
  12335.                 i--;
  12336.             }
  12337.             if (pktSize == -1)
  12338.                 if (i > 0) {
  12339.                     socketStream.flushInputStream(inStream.buffer, 1);
  12340.                     pktSize = inStream.buffer[0] & 0xff;
  12341.                     i--;
  12342.                 } else {
  12343.                     return false;
  12344.                 }
  12345.             if (pktSize == -2)
  12346.                 if (i > 1) {
  12347.                     socketStream.flushInputStream(inStream.buffer, 2);
  12348.                     inStream.currentOffset = 0;
  12349.                     pktSize = inStream.readUnsignedWord();
  12350.                     i -= 2;
  12351.                 } else {
  12352.                     return false;
  12353.                 }
  12354.             if (i < pktSize)
  12355.                 return false;
  12356.             inStream.currentOffset = 0;
  12357.             socketStream.flushInputStream(inStream.buffer, pktSize);
  12358.             anInt1009 = 0;
  12359.             anInt843 = anInt842;
  12360.             anInt842 = anInt841;
  12361.             anInt841 = pktType;
  12362.             switch (pktType) {
  12363.             case 81:
  12364.                 updatePlayers(pktSize, inStream);
  12365.                 aBoolean1080 = false;
  12366.                 pktType = -1;
  12367.                 return true;
  12368.  
  12369.             case 176:
  12370.                 daysSinceRecovChange = inStream.method427();
  12371.                 unreadMessages = inStream.method435();
  12372.                 membersInt = inStream.readUnsignedByte();
  12373.                 anInt1193 = inStream.method440();
  12374.                 daysSinceLastLogin = inStream.readUnsignedWord();
  12375.                 if (anInt1193 != 0 && openInterfaceID == -1) {
  12376.                     signlink.dnslookup(TextClass.method586(anInt1193));
  12377.                     clearTopInterfaces();
  12378.                     char c = '\u028A';
  12379.                     if (daysSinceRecovChange != 201 || membersInt == 1)
  12380.                         c = '\u028F';
  12381.                     reportAbuseInput = "";
  12382.                     canMute = false;
  12383.                     for (int k9 = 0; k9 < RSInterface.interfaceCache.length; k9++) {
  12384.                         if (RSInterface.interfaceCache[k9] == null
  12385.                                 || RSInterface.interfaceCache[k9].contentType != c)
  12386.                             continue;
  12387.                         openInterfaceID = RSInterface.interfaceCache[k9].parentID;
  12388.  
  12389.                     }
  12390.                 }
  12391.                 pktType = -1;
  12392.                 return true;
  12393.  
  12394.             case 64:
  12395.                 anInt1268 = inStream.method427();
  12396.                 anInt1269 = inStream.method428();
  12397.                 for (int j = anInt1268; j < anInt1268 + 8; j++) {
  12398.                     for (int l9 = anInt1269; l9 < anInt1269 + 8; l9++)
  12399.                         if (groundArray[plane][j][l9] != null) {
  12400.                             groundArray[plane][j][l9] = null;
  12401.                             spawnGroundItem(j, l9);
  12402.                         }
  12403.                 }
  12404.                 for (Class30_Sub1 class30_sub1 = (Class30_Sub1) aClass19_1179
  12405.                         .reverseGetFirst(); class30_sub1 != null; class30_sub1 = (Class30_Sub1) aClass19_1179
  12406.                         .reverseGetNext())
  12407.                     if (class30_sub1.anInt1297 >= anInt1268
  12408.                             && class30_sub1.anInt1297 < anInt1268 + 8
  12409.                             && class30_sub1.anInt1298 >= anInt1269
  12410.                             && class30_sub1.anInt1298 < anInt1269 + 8
  12411.                             && class30_sub1.anInt1295 == plane)
  12412.                         class30_sub1.anInt1294 = 0;
  12413.                 pktType = -1;
  12414.                 return true;
  12415.  
  12416.             case 185:
  12417.                 int k = inStream.method436();
  12418.                 RSInterface.interfaceCache[k].anInt233 = 3;
  12419.                 if (myPlayer.desc == null)
  12420.                     RSInterface.interfaceCache[k].mediaID = (myPlayer.anIntArray1700[0] << 25)
  12421.                             + (myPlayer.anIntArray1700[4] << 20)
  12422.                             + (myPlayer.equipment[0] << 15)
  12423.                             + (myPlayer.equipment[8] << 10)
  12424.                             + (myPlayer.equipment[11] << 5)
  12425.                             + myPlayer.equipment[1];
  12426.                 else
  12427.                     RSInterface.interfaceCache[k].mediaID = (int) (0x12345678L + myPlayer.desc.interfaceType);
  12428.                 pktType = -1;
  12429.                 return true;
  12430.  
  12431.                 /* Clan message packet */
  12432.             case 217:
  12433.                 try {
  12434.                     clanUsername = inStream.readString();
  12435.                     clanMessage = TextInput.processText(inStream.readString());
  12436.                     clanTitle = inStream.readString();
  12437.                     channelRights = inStream.readUnsignedWord();
  12438.                     pushMessage(clanMessage, 12, clanUsername);
  12439.                 } catch (Exception e) {
  12440.                     e.printStackTrace();
  12441.                 }
  12442.                 pktType = -1;
  12443.                 return true;
  12444.  
  12445.             case 107:
  12446.                 aBoolean1160 = false;
  12447.                 for (int l = 0; l < 5; l++)
  12448.                     aBooleanArray876[l] = false;
  12449.                 pktType = -1;
  12450.                 return true;
  12451.  
  12452.             case 72:
  12453.                 int i1 = inStream.method434();
  12454.                 RSInterface class9 = RSInterface.interfaceCache[i1];
  12455.                 for (int k15 = 0; k15 < class9.inv.length; k15++) {
  12456.                     class9.inv[k15] = -1;
  12457.                     class9.inv[k15] = 0;
  12458.                 }
  12459.                 pktType = -1;
  12460.                 return true;
  12461.  
  12462.             case 214:
  12463.                 ignoreCount = pktSize / 8;
  12464.                 for (int j1 = 0; j1 < ignoreCount; j1++)
  12465.                     ignoreListAsLongs[j1] = inStream.readQWord();
  12466.                 pktType = -1;
  12467.                 return true;
  12468.  
  12469.             case 166:
  12470.                 aBoolean1160 = true;
  12471.                 anInt1098 = inStream.readUnsignedByte();
  12472.                 anInt1099 = inStream.readUnsignedByte();
  12473.                 anInt1100 = inStream.readUnsignedWord();
  12474.                 anInt1101 = inStream.readUnsignedByte();
  12475.                 anInt1102 = inStream.readUnsignedByte();
  12476.                 if (anInt1102 >= 100) {
  12477.                     xCameraPos = anInt1098 * 128 + 64;
  12478.                     yCameraPos = anInt1099 * 128 + 64;
  12479.                     zCameraPos = method42(plane, yCameraPos, xCameraPos)
  12480.                             - anInt1100;
  12481.                 }
  12482.                 pktType = -1;
  12483.                 return true;
  12484.  
  12485.             case 134:
  12486.                 needDrawTabArea = true;
  12487.                 int k1 = inStream.readUnsignedByte();
  12488.                 int i10 = inStream.method439();
  12489.                 int l15 = inStream.readUnsignedByte();
  12490.                 int xp = currentExp[k1];
  12491.                 currentExp[k1] = i10;
  12492.                 currentStats[k1] = l15;
  12493.                 maxStats[k1] = 1;
  12494.                 xpCounter += currentExp[k1] - xp;
  12495.                 expAdded = currentExp[k1] - xp;
  12496.                 for (int k20 = 0; k20 < 98; k20++)
  12497.                     if (i10 >= anIntArray1019[k20])
  12498.                         maxStats[k1] = k20 + 2;
  12499.                 pktType = -1;
  12500.                 return true;
  12501.  
  12502.             case 71:
  12503.                 int l1 = inStream.readUnsignedWord();
  12504.                 int j10 = inStream.method426();
  12505.                 if (l1 == 65535)
  12506.                     l1 = -1;
  12507.                 tabInterfaceIDs[j10] = l1;
  12508.                 needDrawTabArea = true;
  12509.                 tabAreaAltered = true;
  12510.                 pktType = -1;
  12511.                 return true;
  12512.  
  12513.             case 74:
  12514.                 int i2 = inStream.method434();
  12515.                 if (i2 == 65535)
  12516.                     i2 = -1;
  12517.                 if (i2 != currentSong && musicEnabled && !lowMem
  12518.                         && prevSong == 0) {
  12519.                     nextSong = i2;
  12520.                     songChanging = true;
  12521.                     onDemandFetcher.method558(2, nextSong);
  12522.                 }
  12523.                 currentSong = i2;
  12524.                 pktType = -1;
  12525.                 return true;
  12526.  
  12527.             case 121:
  12528.                 int j2 = inStream.method436();
  12529.                 int k10 = inStream.method435();
  12530.                 if (musicEnabled && !lowMem) {
  12531.                     nextSong = j2;
  12532.                     songChanging = false;
  12533.                     onDemandFetcher.method558(2, nextSong);
  12534.                     prevSong = k10;
  12535.                 }
  12536.                 pktType = -1;
  12537.                 return true;
  12538.  
  12539.             case 109:
  12540.                 resetLogout();
  12541.                 pktType = -1;
  12542.                 return false;
  12543.  
  12544.             case 70:
  12545.                 int k2 = inStream.readSignedWord();
  12546.                 int l10 = inStream.method437();
  12547.                 int i16 = inStream.method434();
  12548.                 RSInterface class9_5 = RSInterface.interfaceCache[i16];
  12549.                 class9_5.anInt263 = k2;
  12550.                 class9_5.anInt265 = l10;
  12551.                 pktType = -1;
  12552.                 return true;
  12553.  
  12554.             case 73:
  12555.             case 241:
  12556.                 int l2 = anInt1069;
  12557.                 int i11 = anInt1070;
  12558.                 if (pktType == 73) {
  12559.                     l2 = inStream.method435();
  12560.                     i11 = inStream.readUnsignedWord();
  12561.                     aBoolean1159 = false;
  12562.                 }
  12563.                 if (pktType == 241) {
  12564.                     i11 = inStream.method435();
  12565.                     inStream.initBitAccess();
  12566.                     for (int j16 = 0; j16 < 4; j16++) {
  12567.                         for (int l20 = 0; l20 < 13; l20++) {
  12568.                             for (int j23 = 0; j23 < 13; j23++) {
  12569.                                 int i26 = inStream.readBits(1);
  12570.                                 if (i26 == 1)
  12571.                                     anIntArrayArrayArray1129[j16][l20][j23] = inStream
  12572.                                             .readBits(26);
  12573.                                 else
  12574.                                     anIntArrayArrayArray1129[j16][l20][j23] = -1;
  12575.                             }
  12576.                         }
  12577.                     }
  12578.                     inStream.finishBitAccess();
  12579.                     l2 = inStream.readUnsignedWord();
  12580.                     aBoolean1159 = true;
  12581.                 }
  12582.                 if (anInt1069 == l2 && anInt1070 == i11 && loadingStage == 2) {
  12583.                     pktType = -1;
  12584.                     return true;
  12585.                 }
  12586.                 anInt1069 = l2;
  12587.                 anInt1070 = i11;
  12588.                 baseX = (anInt1069 - 6) * 8;
  12589.                 baseY = (anInt1070 - 6) * 8;
  12590.                 aBoolean1141 = (anInt1069 / 8 == 48 || anInt1069 / 8 == 49)
  12591.                         && anInt1070 / 8 == 48;
  12592.                 if (anInt1069 / 8 == 48 && anInt1070 / 8 == 148)
  12593.                     aBoolean1141 = true;
  12594.                 loadingStage = 1;
  12595.                 aLong824 = System.currentTimeMillis();
  12596.                 aRSImageProducer_1165.initDrawingArea();
  12597.                 DrawingArea.fillPixels(2, 130, 22, 0xffffff, 2);
  12598.                 DrawingArea.drawPixels(20, 3, 3, 0, 128);
  12599.                 aTextDrawingArea_1271.drawText(0, "Loading - Please Wait", 18,
  12600.                         68);
  12601.                 aTextDrawingArea_1271.drawText(0xffffff,
  12602.                         "Loading - Please Wait", 17, 67);
  12603.                 aRSImageProducer_1165.drawGraphics(4, super.graphics, 4);
  12604.                 if (pktType == 73) {
  12605.                     int k16 = 0;
  12606.                     for (int i21 = (anInt1069 - 6) / 8; i21 <= (anInt1069 + 6) / 8; i21++) {
  12607.                         for (int k23 = (anInt1070 - 6) / 8; k23 <= (anInt1070 + 6) / 8; k23++)
  12608.                             k16++;
  12609.                     }
  12610.                     aByteArrayArray1183 = new byte[k16][];
  12611.                     aByteArrayArray1247 = new byte[k16][];
  12612.                     anIntArray1234 = new int[k16];
  12613.                     anIntArray1235 = new int[k16];
  12614.                     anIntArray1236 = new int[k16];
  12615.                     k16 = 0;
  12616.                     for (int l23 = (anInt1069 - 6) / 8; l23 <= (anInt1069 + 6) / 8; l23++) {
  12617.                         for (int j26 = (anInt1070 - 6) / 8; j26 <= (anInt1070 + 6) / 8; j26++) {
  12618.                             anIntArray1234[k16] = (l23 << 8) + j26;
  12619.                             if (aBoolean1141
  12620.                                     && (j26 == 49 || j26 == 149 || j26 == 147
  12621.                                             || l23 == 50 || l23 == 49
  12622.                                             && j26 == 47)) {
  12623.                                 anIntArray1235[k16] = -1;
  12624.                                 anIntArray1236[k16] = -1;
  12625.                                 k16++;
  12626.                             } else {
  12627.                                 int k28 = anIntArray1235[k16] = onDemandFetcher
  12628.                                         .method562(0, j26, l23);
  12629.                                 if (k28 != -1)
  12630.                                     onDemandFetcher.method558(3, k28);
  12631.                                 int j30 = anIntArray1236[k16] = onDemandFetcher
  12632.                                         .method562(1, j26, l23);
  12633.                                 if (j30 != -1)
  12634.                                     onDemandFetcher.method558(3, j30);
  12635.                                 k16++;
  12636.                             }
  12637.                         }
  12638.                     }
  12639.                 }
  12640.                 if (pktType == 241) {
  12641.                     int l16 = 0;
  12642.                     int ai[] = new int[676];
  12643.                     for (int i24 = 0; i24 < 4; i24++) {
  12644.                         for (int k26 = 0; k26 < 13; k26++) {
  12645.                             for (int l28 = 0; l28 < 13; l28++) {
  12646.                                 int k30 = anIntArrayArrayArray1129[i24][k26][l28];
  12647.                                 if (k30 != -1) {
  12648.                                     int k31 = k30 >> 14 & 0x3ff;
  12649.                                     int i32 = k30 >> 3 & 0x7ff;
  12650.                                     int k32 = (k31 / 8 << 8) + i32 / 8;
  12651.                                     for (int j33 = 0; j33 < l16; j33++) {
  12652.                                         if (ai[j33] != k32)
  12653.                                             continue;
  12654.                                         k32 = -1;
  12655.  
  12656.                                     }
  12657.                                     if (k32 != -1)
  12658.                                         ai[l16++] = k32;
  12659.                                 }
  12660.                             }
  12661.                         }
  12662.                     }
  12663.                     aByteArrayArray1183 = new byte[l16][];
  12664.                     aByteArrayArray1247 = new byte[l16][];
  12665.                     anIntArray1234 = new int[l16];
  12666.                     anIntArray1235 = new int[l16];
  12667.                     anIntArray1236 = new int[l16];
  12668.                     for (int l26 = 0; l26 < l16; l26++) {
  12669.                         int i29 = anIntArray1234[l26] = ai[l26];
  12670.                         int l30 = i29 >> 8 & 0xff;
  12671.                         int l31 = i29 & 0xff;
  12672.                         int j32 = anIntArray1235[l26] = onDemandFetcher
  12673.                                 .method562(0, l31, l30);
  12674.                         if (j32 != -1)
  12675.                             onDemandFetcher.method558(3, j32);
  12676.                         int i33 = anIntArray1236[l26] = onDemandFetcher
  12677.                                 .method562(1, l31, l30);
  12678.                         if (i33 != -1)
  12679.                             onDemandFetcher.method558(3, i33);
  12680.                     }
  12681.                 }
  12682.                 int i17 = baseX - anInt1036;
  12683.                 int j21 = baseY - anInt1037;
  12684.                 anInt1036 = baseX;
  12685.                 anInt1037 = baseY;
  12686.                 for (int j24 = 0; j24 < 16384; j24++) {
  12687.                     NPC npc = npcArray[j24];
  12688.                     if (npc != null) {
  12689.                         for (int j29 = 0; j29 < 10; j29++) {
  12690.                             npc.smallX[j29] -= i17;
  12691.                             npc.smallY[j29] -= j21;
  12692.                         }
  12693.                         npc.x -= i17 * 128;
  12694.                         npc.y -= j21 * 128;
  12695.                     }
  12696.                 }
  12697.                 for (int i27 = 0; i27 < maxPlayers; i27++) {
  12698.                     Player player = playerArray[i27];
  12699.                     if (player != null) {
  12700.                         for (int i31 = 0; i31 < 10; i31++) {
  12701.                             player.smallX[i31] -= i17;
  12702.                             player.smallY[i31] -= j21;
  12703.                         }
  12704.                         player.x -= i17 * 128;
  12705.                         player.y -= j21 * 128;
  12706.                     }
  12707.                 }
  12708.                 aBoolean1080 = true;
  12709.                 byte byte1 = 0;
  12710.                 byte byte2 = 104;
  12711.                 byte byte3 = 1;
  12712.                 if (i17 < 0) {
  12713.                     byte1 = 103;
  12714.                     byte2 = -1;
  12715.                     byte3 = -1;
  12716.                 }
  12717.                 byte byte4 = 0;
  12718.                 byte byte5 = 104;
  12719.                 byte byte6 = 1;
  12720.                 if (j21 < 0) {
  12721.                     byte4 = 103;
  12722.                     byte5 = -1;
  12723.                     byte6 = -1;
  12724.                 }
  12725.                 for (int k33 = byte1; k33 != byte2; k33 += byte3) {
  12726.                     for (int l33 = byte4; l33 != byte5; l33 += byte6) {
  12727.                         int i34 = k33 + i17;
  12728.                         int j34 = l33 + j21;
  12729.                         for (int k34 = 0; k34 < 4; k34++)
  12730.                             if (i34 >= 0 && j34 >= 0 && i34 < 104 && j34 < 104)
  12731.                                 groundArray[k34][k33][l33] = groundArray[k34][i34][j34];
  12732.                             else
  12733.                                 groundArray[k34][k33][l33] = null;
  12734.                     }
  12735.                 }
  12736.                 for (Class30_Sub1 class30_sub1_1 = (Class30_Sub1) aClass19_1179
  12737.                         .reverseGetFirst(); class30_sub1_1 != null; class30_sub1_1 = (Class30_Sub1) aClass19_1179
  12738.                         .reverseGetNext()) {
  12739.                     class30_sub1_1.anInt1297 -= i17;
  12740.                     class30_sub1_1.anInt1298 -= j21;
  12741.                     if (class30_sub1_1.anInt1297 < 0
  12742.                             || class30_sub1_1.anInt1298 < 0
  12743.                             || class30_sub1_1.anInt1297 >= 104
  12744.                             || class30_sub1_1.anInt1298 >= 104)
  12745.                         class30_sub1_1.unlink();
  12746.                 }
  12747.                 if (destX != 0) {
  12748.                     destX -= i17;
  12749.                     destY -= j21;
  12750.                 }
  12751.                 aBoolean1160 = false;
  12752.                 pktType = -1;
  12753.                 return true;
  12754.  
  12755.             case 208:
  12756.                 int i3 = inStream.method437();
  12757.                 if (i3 >= 0)
  12758.                     method60(i3);
  12759.                 anInt1018 = i3;
  12760.                 pktType = -1;
  12761.                 return true;
  12762.  
  12763.             case 99:
  12764.                 /*
  12765.                  * Black map, mape state 2, causes blackness
  12766.                  */
  12767.                 anInt1021 = inStream.readUnsignedByte();
  12768.                 pktType = -1;
  12769.                 return true;
  12770.  
  12771.             case 75:
  12772.                 int j3 = inStream.method436();
  12773.                 int j11 = inStream.method436();
  12774.                 RSInterface.interfaceCache[j11].anInt233 = 2;
  12775.                 RSInterface.interfaceCache[j11].mediaID = j3;
  12776.                 pktType = -1;
  12777.                 return true;
  12778.  
  12779.             case 114:
  12780.                 anInt1104 = inStream.method434() * 30;
  12781.                 pktType = -1;
  12782.                 return true;
  12783.  
  12784.             case 60:
  12785.                 anInt1269 = inStream.readUnsignedByte();
  12786.                 anInt1268 = inStream.method427();
  12787.                 while (inStream.currentOffset < pktSize) {
  12788.                     int k3 = inStream.readUnsignedByte();
  12789.                     method137(inStream, k3);
  12790.                 }
  12791.                 pktType = -1;
  12792.                 return true;
  12793.  
  12794.             case 35:
  12795.                 int l3 = inStream.readUnsignedByte();
  12796.                 int k11 = inStream.readUnsignedByte();
  12797.                 int j17 = inStream.readUnsignedByte();
  12798.                 int k21 = inStream.readUnsignedByte();
  12799.                 aBooleanArray876[l3] = true;
  12800.                 anIntArray873[l3] = k11;
  12801.                 anIntArray1203[l3] = j17;
  12802.                 anIntArray928[l3] = k21;
  12803.                 anIntArray1030[l3] = 0;
  12804.                 pktType = -1;
  12805.                 return true;
  12806.  
  12807.                 /* Empty Following Packet */
  12808.             case 174:
  12809.  
  12810.                 followPlayer = 0;
  12811.  
  12812.                 followNPC = 0;
  12813.  
  12814.                 int l11z = inStream.readUnsignedWord();
  12815.  
  12816.                 int iq = inStream.readUnsignedByte();
  12817.  
  12818.                 followDistance = inStream.readUnsignedWord();
  12819.  
  12820.                 if (iq == 0)
  12821.  
  12822.                 {
  12823.  
  12824.                     followNPC = l11z;
  12825.  
  12826.                 }
  12827.  
  12828.                 else if (iq == 1)
  12829.  
  12830.                 {
  12831.  
  12832.                     followPlayer = l11z;
  12833.  
  12834.                 }
  12835.  
  12836.                 pktType = -1;
  12837.  
  12838.                 return true;
  12839.  
  12840.             case 104:
  12841.                 int j4 = inStream.method427();
  12842.                 int i12 = inStream.method426();
  12843.                 String s6 = inStream.readString();
  12844.                 if (j4 >= 1 && j4 <= 5) {
  12845.                     if (s6.equalsIgnoreCase("null"))
  12846.                         s6 = null;
  12847.                     atPlayerActions[j4 - 1] = s6;
  12848.                     atPlayerArray[j4 - 1] = i12 == 0;
  12849.                 }
  12850.                 pktType = -1;
  12851.                 return true;
  12852.  
  12853.             case 78:
  12854.                 destX = 0;
  12855.                 pktType = -1;
  12856.                 return true;
  12857.  
  12858.             case 253:
  12859.                 String s = inStream.readString();
  12860.                 if (s.endsWith(":tradereq:")) {
  12861.                     String s3 = s.substring(0, s.indexOf(":"));
  12862.                     long l17 = TextClass.longForName(s3);
  12863.                     boolean flag2 = false;
  12864.                     for (int j27 = 0; j27 < ignoreCount; j27++) {
  12865.                         if (ignoreListAsLongs[j27] != l17)
  12866.                             continue;
  12867.                         flag2 = true;
  12868.                     }
  12869.                     if (!flag2 && anInt1251 == 0)
  12870.                         pushMessage("wishes to trade with you.", 4, s3);
  12871.                 } else if (s.endsWith(":clan:")) {
  12872.                     String s4 = s.substring(0, s.indexOf(":"));
  12873.                     TextClass.longForName(s4);
  12874.                     pushMessage("Clan: ", 8, s4);
  12875.                 } else if (s.endsWith("#url#")) {
  12876.                     String link = s.substring(0, s.indexOf("#"));
  12877.                     pushMessage("Join us at: ", 9, link);
  12878.                 } else if (s.endsWith(":duelreq:")) {
  12879.                     String s4 = s.substring(0, s.indexOf(":"));
  12880.                     long l18 = TextClass.longForName(s4);
  12881.                     boolean flag3 = false;
  12882.                     for (int k27 = 0; k27 < ignoreCount; k27++) {
  12883.                         if (ignoreListAsLongs[k27] != l18)
  12884.                             continue;
  12885.                         flag3 = true;
  12886.  
  12887.                     }
  12888.                     if (!flag3 && anInt1251 == 0)
  12889.                         pushMessage("wishes to duel with you.", 8, s4);
  12890.                 } else if (s.endsWith(":chalreq:")) {
  12891.                     String s5 = s.substring(0, s.indexOf(":"));
  12892.                     long l19 = TextClass.longForName(s5);
  12893.                     boolean flag4 = false;
  12894.                     for (int l27 = 0; l27 < ignoreCount; l27++) {
  12895.                         if (ignoreListAsLongs[l27] != l19)
  12896.                             continue;
  12897.                         flag4 = true;
  12898.  
  12899.                     }
  12900.                     if (!flag4 && anInt1251 == 0) {
  12901.                         String s8 = s.substring(s.indexOf(":") + 1,
  12902.                                 s.length() - 9);
  12903.                         pushMessage(s8, 8, s5);
  12904.                     }
  12905.                 } else {
  12906.                     pushMessage(s, 0, "");
  12907.                 }
  12908.                 pktType = -1;
  12909.                 return true;
  12910.  
  12911.             case 1:
  12912.                 for (int k4 = 0; k4 < playerArray.length; k4++)
  12913.                     if (playerArray[k4] != null)
  12914.                         playerArray[k4].anim = -1;
  12915.                 for (int j12 = 0; j12 < npcArray.length; j12++)
  12916.                     if (npcArray[j12] != null)
  12917.                         npcArray[j12].anim = -1;
  12918.                 pktType = -1;
  12919.                 return true;
  12920.  
  12921.             case 50:
  12922.                 long l4 = inStream.readQWord();
  12923.                 int i18 = inStream.readUnsignedByte();
  12924.                 String s7 = TextClass.fixName(TextClass.nameForLong(l4));
  12925.                 for (int k24 = 0; k24 < friendsCount; k24++) {
  12926.                     if (l4 != friendsListAsLongs[k24])
  12927.                         continue;
  12928.                     if (friendsNodeIDs[k24] != i18) {
  12929.                         friendsNodeIDs[k24] = i18;
  12930.                         needDrawTabArea = true;
  12931.                         if (i18 >= 2) {
  12932.                             pushMessage(s7 + " has logged in.", 5, "");
  12933.                         }
  12934.                         if (i18 <= 1) {
  12935.                             pushMessage(s7 + " has logged out.", 5, "");
  12936.                         }
  12937.                     }
  12938.                     s7 = null;
  12939.  
  12940.                 }
  12941.                 if (s7 != null && friendsCount < 200) {
  12942.                     friendsListAsLongs[friendsCount] = l4;
  12943.                     friendsList[friendsCount] = s7;
  12944.                     friendsNodeIDs[friendsCount] = i18;
  12945.                     friendsCount++;
  12946.                     needDrawTabArea = true;
  12947.                 }
  12948.                 for (boolean flag6 = false; !flag6;) {
  12949.                     flag6 = true;
  12950.                     for (int k29 = 0; k29 < friendsCount - 1; k29++)
  12951.                         if (friendsNodeIDs[k29] != nodeID
  12952.                                 && friendsNodeIDs[k29 + 1] == nodeID
  12953.                                 || friendsNodeIDs[k29] == 0
  12954.                                 && friendsNodeIDs[k29 + 1] != 0) {
  12955.                             int j31 = friendsNodeIDs[k29];
  12956.                             friendsNodeIDs[k29] = friendsNodeIDs[k29 + 1];
  12957.                             friendsNodeIDs[k29 + 1] = j31;
  12958.                             String s10 = friendsList[k29];
  12959.                             friendsList[k29] = friendsList[k29 + 1];
  12960.                             friendsList[k29 + 1] = s10;
  12961.                             long l32 = friendsListAsLongs[k29];
  12962.                             friendsListAsLongs[k29] = friendsListAsLongs[k29 + 1];
  12963.                             friendsListAsLongs[k29 + 1] = l32;
  12964.                             needDrawTabArea = true;
  12965.                             flag6 = false;
  12966.                         }
  12967.                 }
  12968.                 pktType = -1;
  12969.                 return true;
  12970.  
  12971.             case 110:
  12972.                 if (tabID == 12)
  12973.                     needDrawTabArea = true;
  12974.                 energy = inStream.readUnsignedByte();
  12975.                 pktType = -1;
  12976.                 return true;
  12977.  
  12978.             case 254:
  12979.                 anInt855 = inStream.readUnsignedByte();
  12980.                 if (anInt855 == 1)
  12981.                     anInt1222 = inStream.readUnsignedWord();
  12982.                 if (anInt855 >= 2 && anInt855 <= 6) {
  12983.                     if (anInt855 == 2) {
  12984.                         anInt937 = 64;
  12985.                         anInt938 = 64;
  12986.                     }
  12987.                     if (anInt855 == 3) {
  12988.                         anInt937 = 0;
  12989.                         anInt938 = 64;
  12990.                     }
  12991.                     if (anInt855 == 4) {
  12992.                         anInt937 = 128;
  12993.                         anInt938 = 64;
  12994.                     }
  12995.                     if (anInt855 == 5) {
  12996.                         anInt937 = 64;
  12997.                         anInt938 = 0;
  12998.                     }
  12999.                     if (anInt855 == 6) {
  13000.                         anInt937 = 64;
  13001.                         anInt938 = 128;
  13002.                     }
  13003.                     anInt855 = 2;
  13004.                     anInt934 = inStream.readUnsignedWord();
  13005.                     anInt935 = inStream.readUnsignedWord();
  13006.                     anInt936 = inStream.readUnsignedByte();
  13007.                 }
  13008.                 if (anInt855 == 10)
  13009.                     anInt933 = inStream.readUnsignedWord();
  13010.                 pktType = -1;
  13011.                 return true;
  13012.  
  13013.             case 248:
  13014.                 int i5 = inStream.method435();
  13015.                 int k12 = inStream.readUnsignedWord();
  13016.                 if (backDialogID != -1) {
  13017.                     backDialogID = -1;
  13018.                     inputTaken = true;
  13019.                 }
  13020.                 if (inputDialogState != 0) {
  13021.                     inputDialogState = 0;
  13022.                     inputTaken = true;
  13023.                 }
  13024.                 openInterfaceID = i5;
  13025.                 invOverlayInterfaceID = k12;
  13026.                 needDrawTabArea = true;
  13027.                 tabAreaAltered = true;
  13028.                 aBoolean1149 = false;
  13029.                 pktType = -1;
  13030.                 return true;
  13031.  
  13032.             case 79:
  13033.                 int j5 = inStream.method434();
  13034.                 int l12 = inStream.method435();
  13035.                 RSInterface class9_3 = RSInterface.interfaceCache[j5];
  13036.                 if (class9_3 != null && class9_3.type == 0) {
  13037.                     if (l12 < 0)
  13038.                         l12 = 0;
  13039.                     if (l12 > class9_3.scrollMax - class9_3.height)
  13040.                         l12 = class9_3.scrollMax - class9_3.height;
  13041.                     class9_3.scrollPosition = l12;
  13042.                 }
  13043.                 pktType = -1;
  13044.                 return true;
  13045.  
  13046.             case 68:
  13047.                 for (int k5 = 0; k5 < variousSettings.length; k5++)
  13048.                     if (variousSettings[k5] != anIntArray1045[k5]) {
  13049.                         variousSettings[k5] = anIntArray1045[k5];
  13050.                         method33(k5);
  13051.                         needDrawTabArea = true;
  13052.                     }
  13053.                 pktType = -1;
  13054.                 return true;
  13055.  
  13056.             case 196:
  13057.                 long l5 = inStream.readQWord();
  13058.                 inStream.readDWord();
  13059.                 int l21 = inStream.readUnsignedByte();
  13060.                 boolean flag5 = false;
  13061.                 if (l21 <= 1) {
  13062.                     for (int l29 = 0; l29 < ignoreCount; l29++) {
  13063.                         if (ignoreListAsLongs[l29] != l5)
  13064.                             continue;
  13065.                         flag5 = true;
  13066.  
  13067.                     }
  13068.                 }
  13069.                 if (!flag5 && anInt1251 == 0)
  13070.                     try {
  13071.                         String s9 = TextInput.method525(pktSize - 13, inStream);
  13072.                         switch (l21) {
  13073.                         case 1:
  13074.                             pushMessage(
  13075.                                     s9,
  13076.                                     7,
  13077.                                     "@cr1@"
  13078.                                             + TextClass.fixName(TextClass
  13079.                                                     .nameForLong(l5)));
  13080.                             break;
  13081.                         case 2:
  13082.                             pushMessage(
  13083.                                     s9,
  13084.                                     7,
  13085.                                     "@cr2@"
  13086.                                             + TextClass.fixName(TextClass
  13087.                                                     .nameForLong(l5)));
  13088.                             break;
  13089.                         case 3:
  13090.                             pushMessage(
  13091.                                     s9,
  13092.                                     7,
  13093.                                     "@cr3@"
  13094.                                             + TextClass.fixName(TextClass
  13095.                                                     .nameForLong(l5)));
  13096.                             break;
  13097.                         case 4:
  13098.                             pushMessage(
  13099.                                     s9,
  13100.                                     7,
  13101.                                     "@cr4@"
  13102.                                             + TextClass.fixName(TextClass
  13103.                                                     .nameForLong(l5)));
  13104.                             break;
  13105.                         case 5:
  13106.                             pushMessage(
  13107.                                     s9,
  13108.                                     7,
  13109.                                     "@cr5@"
  13110.                                             + TextClass.fixName(TextClass
  13111.                                                     .nameForLong(l5)));
  13112.                             break;
  13113.                         case 6:
  13114.                             pushMessage(
  13115.                                     s9,
  13116.                                     7,
  13117.                                     "@cr6@"
  13118.                                             + TextClass.fixName(TextClass
  13119.                                                     .nameForLong(l5)));
  13120.                             break;
  13121.                         case 7:
  13122.                             pushMessage(
  13123.                                     s9,
  13124.                                     7,
  13125.                                     "@cr7@"
  13126.                                             + TextClass.fixName(TextClass
  13127.                                                     .nameForLong(l5)));
  13128.                             break;
  13129.                         case 8:
  13130.                             pushMessage(
  13131.                                     s9,
  13132.                                     7,
  13133.                                     "@cr8@"
  13134.                                             + TextClass.fixName(TextClass
  13135.                                                     .nameForLong(l5)));
  13136.                             break;
  13137.                         case 9:
  13138.                             pushMessage(
  13139.                                     s9,
  13140.                                     7,
  13141.                                     "@cr9@"
  13142.                                             + TextClass.fixName(TextClass
  13143.                                                     .nameForLong(l5)));
  13144.                             break;
  13145.                         default:
  13146.                             pushMessage(s9, 3, TextClass.fixName(TextClass
  13147.                                     .nameForLong(l5)));
  13148.                         }
  13149.                     } catch (Exception exception1) {
  13150.                         signlink.reporterror("cde1");
  13151.                     }
  13152.                 pktType = -1;
  13153.                 return true;
  13154.  
  13155.             case 85:
  13156.                 anInt1269 = inStream.method427();
  13157.                 anInt1268 = inStream.method427();
  13158.                 pktType = -1;
  13159.                 return true;
  13160.  
  13161.             case 24:
  13162.                 anInt1054 = inStream.method428();
  13163.                 if (anInt1054 == tabID) {
  13164.                     if (anInt1054 == 3)
  13165.                         tabID = 1;
  13166.                     else
  13167.                         tabID = 3;
  13168.                     needDrawTabArea = true;
  13169.                 }
  13170.                 pktType = -1;
  13171.                 return true;
  13172.  
  13173.             case 246:
  13174.                 int i6 = inStream.method434();
  13175.                 int i13 = inStream.readUnsignedWord();
  13176.                 int k18 = inStream.readUnsignedWord();
  13177.                 if (k18 == 65535) {
  13178.                     RSInterface.interfaceCache[i6].anInt233 = 0;
  13179.                     pktType = -1;
  13180.                     return true;
  13181.                 } else {
  13182.                     ItemDef itemDef = ItemDef.forID(k18);
  13183.                     RSInterface.interfaceCache[i6].anInt233 = 4;
  13184.                     RSInterface.interfaceCache[i6].mediaID = k18;
  13185.                     RSInterface.interfaceCache[i6].modelRotation1 = itemDef.modelRotationY;
  13186.                     RSInterface.interfaceCache[i6].modelRotation2 = itemDef.modelRotationX;
  13187.                     RSInterface.interfaceCache[i6].modelZoom = (itemDef.modelZoom * 100)
  13188.                             / i13;
  13189.                     pktType = -1;
  13190.                     return true;
  13191.                 }
  13192.  
  13193.             case 171:
  13194.                 boolean flag1 = inStream.readUnsignedByte() == 1;
  13195.                 int j13 = inStream.readUnsignedWord();
  13196.                 RSInterface.interfaceCache[j13].isMouseoverTriggered = flag1;
  13197.                 pktType = -1;
  13198.                 return true;
  13199.  
  13200.             case 142:
  13201.                 int j6 = inStream.method434();
  13202.                 method60(j6);
  13203.                 if (backDialogID != -1) {
  13204.                     backDialogID = -1;
  13205.                     inputTaken = true;
  13206.                 }
  13207.                 if (inputDialogState != 0) {
  13208.                     inputDialogState = 0;
  13209.                     inputTaken = true;
  13210.                 }
  13211.                 invOverlayInterfaceID = j6;
  13212.                 needDrawTabArea = true;
  13213.                 tabAreaAltered = true;
  13214.                 openInterfaceID = -1;
  13215.                 aBoolean1149 = false;
  13216.                 pktType = -1;
  13217.                 return true;
  13218.  
  13219.                 /*
  13220.                  * case 126: try { String text = inStream.readString(); int
  13221.                  * frame = inStream.method435(); if (text.startsWith("www.")) {
  13222.                  * launchURL(text); pktType = -1; return true; }
  13223.                  * RSInterface.interfaceCache[frame].message = text; if
  13224.                  * (RSInterface.interfaceCache[frame].parentID ==
  13225.                  * tabInterfaceIDs[tabID] || frame >= 7562 && frame <= 7586)
  13226.                  * needDrawTabArea = true; pktType = -1; } catch (Exception e) {
  13227.                  * } pktType = -1; return true;
  13228.                  */
  13229.  
  13230.             case 126:
  13231.                 String text = inStream.readString();
  13232.                 int frame = inStream.method435();
  13233.                 if (text.startsWith("www.")) {
  13234.                     launchURL(text);
  13235.                     pktType = -1;
  13236.                     return true;
  13237.                 }
  13238.                 updateStrings(text, frame);
  13239.                 sendFrame126(text, frame);
  13240.                 if (frame >= 18144 && frame <= 18244) {
  13241.                     clanList[frame - 18144] = text;
  13242.                 }
  13243.                 pktType = -1;
  13244.                 return true;
  13245.  
  13246.             case 206:
  13247.                 publicChatMode = inStream.readUnsignedByte();
  13248.                 privateChatMode = inStream.readUnsignedByte();
  13249.                 tradeMode = inStream.readUnsignedByte();
  13250.                 inputTaken = true;
  13251.                 pktType = -1;
  13252.                 return true;
  13253.  
  13254.             case 240:
  13255.                 if (tabID == 12)
  13256.                     needDrawTabArea = true;
  13257.                 weight = inStream.readSignedWord();
  13258.                 pktType = -1;
  13259.                 return true;
  13260.  
  13261.             case 8:
  13262.                 int k6 = inStream.method436();
  13263.                 int l13 = inStream.readUnsignedWord();
  13264.                 RSInterface.interfaceCache[k6].anInt233 = 1;
  13265.                 RSInterface.interfaceCache[k6].mediaID = l13;
  13266.                 pktType = -1;
  13267.                 return true;
  13268.  
  13269.             case 122:
  13270.                 int l6 = inStream.method436();
  13271.                 int i14 = inStream.method436();
  13272.                 int i19 = i14 >> 10 & 0x1f;
  13273.                 int i22 = i14 >> 5 & 0x1f;
  13274.                 int l24 = i14 & 0x1f;
  13275.                 RSInterface.interfaceCache[l6].textColor = (i19 << 19)
  13276.                         + (i22 << 11) + (l24 << 3);
  13277.                 pktType = -1;
  13278.                 return true;
  13279.  
  13280.             case 53:
  13281.                 needDrawTabArea = true;
  13282.                 int i7 = inStream.readUnsignedWord();
  13283.                 RSInterface class9_1 = RSInterface.interfaceCache[i7];
  13284.                 int j19 = inStream.readUnsignedWord();
  13285.                 for (int j22 = 0; j22 < j19; j22++) {
  13286.                     int i25 = inStream.readUnsignedByte();
  13287.                     if (i25 == 255)
  13288.                         i25 = inStream.method440();
  13289.                     class9_1.inv[j22] = inStream.method436();
  13290.                     class9_1.invStackSizes[j22] = i25;
  13291.                 }
  13292.                 for (int j25 = j19; j25 < class9_1.inv.length; j25++) {
  13293.                     class9_1.inv[j25] = 0;
  13294.                     class9_1.invStackSizes[j25] = 0;
  13295.                 }
  13296.                 pktType = -1;
  13297.                 return true;
  13298.  
  13299.             case 230:
  13300.                 int j7 = inStream.method435();
  13301.                 int j14 = inStream.readUnsignedWord();
  13302.                 int k19 = inStream.readUnsignedWord();
  13303.                 int k22 = inStream.method436();
  13304.                 RSInterface.interfaceCache[j14].modelRotation1 = k19;
  13305.                 RSInterface.interfaceCache[j14].modelRotation2 = k22;
  13306.                 RSInterface.interfaceCache[j14].modelZoom = j7;
  13307.                 pktType = -1;
  13308.                 return true;
  13309.  
  13310.             case 221:
  13311.                 anInt900 = inStream.readUnsignedByte();
  13312.                 needDrawTabArea = true;
  13313.                 pktType = -1;
  13314.                 return true;
  13315.  
  13316.             case 177:
  13317.                 aBoolean1160 = true;
  13318.                 anInt995 = inStream.readUnsignedByte();
  13319.                 anInt996 = inStream.readUnsignedByte();
  13320.                 anInt997 = inStream.readUnsignedWord();
  13321.                 anInt998 = inStream.readUnsignedByte();
  13322.                 anInt999 = inStream.readUnsignedByte();
  13323.                 if (anInt999 >= 100) {
  13324.                     int k7 = anInt995 * 128 + 64;
  13325.                     int k14 = anInt996 * 128 + 64;
  13326.                     int i20 = method42(plane, k14, k7) - anInt997;
  13327.                     int l22 = k7 - xCameraPos;
  13328.                     int k25 = i20 - zCameraPos;
  13329.                     int j28 = k14 - yCameraPos;
  13330.                     int i30 = (int) Math.sqrt(l22 * l22 + j28 * j28);
  13331.                     yCameraCurve = (int) (Math.atan2(k25, i30) * 325.94900000000001D) & 0x7ff;
  13332.                     xCameraCurve = (int) (Math.atan2(l22, j28) * -325.94900000000001D) & 0x7ff;
  13333.                     if (yCameraCurve < 128)
  13334.                         yCameraCurve = 128;
  13335.                     if (yCameraCurve > 383)
  13336.                         yCameraCurve = 383;
  13337.                 }
  13338.                 pktType = -1;
  13339.                 return true;
  13340.  
  13341.             case 249:
  13342.                 anInt1046 = inStream.method426();
  13343.                 unknownInt10 = inStream.method436();
  13344.                 pktType = -1;
  13345.                 return true;
  13346.  
  13347.             case 65:
  13348.                 updateNPCs(inStream, pktSize);
  13349.                 pktType = -1;
  13350.                 return true;
  13351.  
  13352.             case 27:
  13353.                 messagePromptRaised = false;
  13354.                 inputDialogState = 1;
  13355.                 amountOrNameInput = "";
  13356.                 inputTaken = true;
  13357.                 pktType = -1;
  13358.                 return true;
  13359.  
  13360.             case 187:
  13361.                 messagePromptRaised = false;
  13362.                 inputDialogState = 2;
  13363.                 amountOrNameInput = "";
  13364.                 inputTaken = true;
  13365.                 pktType = -1;
  13366.                 return true;
  13367.  
  13368.             case 97:
  13369.                 int l7 = inStream.readUnsignedWord();
  13370.                 method60(l7);
  13371.                 if (invOverlayInterfaceID != -1) {
  13372.                     invOverlayInterfaceID = -1;
  13373.                     needDrawTabArea = true;
  13374.                     tabAreaAltered = true;
  13375.                 }
  13376.                 if (backDialogID != -1) {
  13377.                     backDialogID = -1;
  13378.                     inputTaken = true;
  13379.                 }
  13380.                 if (inputDialogState != 0) {
  13381.                     inputDialogState = 0;
  13382.                     inputTaken = true;
  13383.                 }
  13384.                 if (l7 == 15244) {// check for main fullscreen interface to be
  13385.                                     // called server side
  13386.                     openInterfaceID = 15801;// secondary/bottom part
  13387.                     fullscreenInterfaceID = 15244;// main fullscreen interface
  13388.                 } else {
  13389.                     openInterfaceID = l7;
  13390.                 }
  13391.                 aBoolean1149 = false;
  13392.                 pktType = -1;
  13393.                 return true;
  13394.  
  13395.             case 218:
  13396.                 int i8 = inStream.method438();
  13397.                 dialogID = i8;
  13398.                 inputTaken = true;
  13399.                 pktType = -1;
  13400.                 return true;
  13401.  
  13402.             case 87:
  13403.                 int j8 = inStream.method434();
  13404.                 int l14 = inStream.method439();
  13405.                 anIntArray1045[j8] = l14;
  13406.                 if (variousSettings[j8] != l14) {
  13407.                     variousSettings[j8] = l14;
  13408.                     method33(j8);
  13409.                     needDrawTabArea = true;
  13410.                     if (dialogID != -1)
  13411.                         inputTaken = true;
  13412.                 }
  13413.                 pktType = -1;
  13414.                 return true;
  13415.  
  13416.             case 36:
  13417.                 int k8 = inStream.method434();
  13418.                 byte byte0 = inStream.readSignedByte();
  13419.                 anIntArray1045[k8] = byte0;
  13420.                 if (variousSettings[k8] != byte0) {
  13421.                     variousSettings[k8] = byte0;
  13422.                     method33(k8);
  13423.                     needDrawTabArea = true;
  13424.                     if (dialogID != -1)
  13425.                         inputTaken = true;
  13426.                 }
  13427.                 pktType = -1;
  13428.                 return true;
  13429.  
  13430.             case 61:
  13431.                 anInt1055 = inStream.readUnsignedByte();
  13432.                 pktType = -1;
  13433.                 return true;
  13434.  
  13435.             case 200:
  13436.                 int l8 = inStream.readUnsignedWord();
  13437.                 int i15 = inStream.readSignedWord();
  13438.                 RSInterface class9_4 = RSInterface.interfaceCache[l8];
  13439.                 class9_4.anInt257 = i15;
  13440.                 if (i15 == 591 || i15 == 588) {
  13441.                     class9_4.modelZoom = 900; // anInt269
  13442.                 }
  13443.                 if (i15 == -1) {
  13444.                     class9_4.anInt246 = 0;
  13445.                     class9_4.anInt208 = 0;
  13446.                 }
  13447.                 pktType = -1;
  13448.                 return true;
  13449.  
  13450.             case 219:
  13451.                 if (invOverlayInterfaceID != -1) {
  13452.                     invOverlayInterfaceID = -1;
  13453.                     needDrawTabArea = true;
  13454.                     tabAreaAltered = true;
  13455.                 }
  13456.                 if (backDialogID != -1) {
  13457.                     backDialogID = -1;
  13458.                     inputTaken = true;
  13459.                 }
  13460.                 if (inputDialogState != 0) {
  13461.                     inputDialogState = 0;
  13462.                     inputTaken = true;
  13463.                 }
  13464.                 openInterfaceID = -1;
  13465.                 aBoolean1149 = false;
  13466.                 pktType = -1;
  13467.                 return true;
  13468.  
  13469.             case 34:
  13470.                 needDrawTabArea = true;
  13471.                 int i9 = inStream.readUnsignedWord();
  13472.                 RSInterface class9_2 = RSInterface.interfaceCache[i9];
  13473.                 while (inStream.currentOffset < pktSize) {
  13474.                     int j20 = inStream.method422();
  13475.                     int i23 = inStream.readUnsignedWord();
  13476.                     int l25 = inStream.readUnsignedByte();
  13477.                     if (l25 == 255)
  13478.                         l25 = inStream.readDWord();
  13479.                     if (j20 >= 0 && j20 < class9_2.inv.length) {
  13480.                         class9_2.inv[j20] = i23;
  13481.                         class9_2.invStackSizes[j20] = l25;
  13482.                     }
  13483.                 }
  13484.                 pktType = -1;
  13485.                 return true;
  13486.  
  13487.             case 4:
  13488.             case 44:
  13489.             case 84:
  13490.             case 101:
  13491.             case 105:
  13492.             case 117:
  13493.             case 147:
  13494.             case 151:
  13495.             case 156:
  13496.             case 160:
  13497.             case 215:
  13498.                 method137(inStream, pktType);
  13499.                 pktType = -1;
  13500.                 return true;
  13501.  
  13502.             case 106:
  13503.                 tabID = inStream.method427();
  13504.                 needDrawTabArea = true;
  13505.                 tabAreaAltered = true;
  13506.                 pktType = -1;
  13507.                 return true;
  13508.  
  13509.             case 164:
  13510.                 int j9 = inStream.method434();
  13511.                 method60(j9);
  13512.                 if (invOverlayInterfaceID != -1) {
  13513.                     invOverlayInterfaceID = -1;
  13514.                     needDrawTabArea = true;
  13515.                     tabAreaAltered = true;
  13516.                 }
  13517.                 backDialogID = j9;
  13518.                 inputTaken = true;
  13519.                 openInterfaceID = -1;
  13520.                 aBoolean1149 = false;
  13521.                 pktType = -1;
  13522.                 return true;
  13523.  
  13524.             }
  13525.             signlink.reporterror("T1 - " + pktType + "," + pktSize + " - "
  13526.                     + anInt842 + "," + anInt843);
  13527.             resetLogout();
  13528.         } catch (IOException _ex) {
  13529.             dropClient();
  13530.         } catch (Exception exception) {
  13531.             String s2 = "T2 - " + pktType + "," + anInt842 + "," + anInt843
  13532.                     + " - " + pktSize + "," + (baseX + myPlayer.smallX[0])
  13533.                     + "," + (baseY + myPlayer.smallY[0]) + " - ";
  13534.             for (int j15 = 0; j15 < pktSize && j15 < 50; j15++)
  13535.                 s2 = s2 + inStream.buffer[j15] + ",";
  13536.             signlink.reporterror(s2);
  13537.             resetLogout();
  13538.         }
  13539.         return true;
  13540.     }
  13541.  
  13542.     public void method146() {
  13543.         anInt1265++;
  13544.         method47(true);
  13545.         method26(true);
  13546.         method47(false);
  13547.         method26(false);
  13548.         method55();
  13549.         method104();
  13550.         if (!aBoolean1160) {
  13551.             int i = anInt1184;
  13552.             if (anInt984 / 256 > i)
  13553.                 i = anInt984 / 256;
  13554.             if (aBooleanArray876[4] && anIntArray1203[4] + 128 > i)
  13555.                 i = anIntArray1203[4] + 128;
  13556.             int k = viewRotation + viewRotationOffset & 0x7ff;
  13557.             setCameraPos(CameraPos2 + i * CameraPos1, i, anInt1014, method42(plane, myPlayer.y, myPlayer.x) - 50, k, anInt1015);
  13558.         }
  13559.         int j;
  13560.         if (!aBoolean1160)
  13561.             j = method120();
  13562.         else
  13563.             j = method121();
  13564.         int l = xCameraPos;
  13565.         int i1 = zCameraPos;
  13566.         int j1 = yCameraPos;
  13567.         int k1 = yCameraCurve;
  13568.         int l1 = xCameraCurve;
  13569.         for (int i2 = 0; i2 < 5; i2++)
  13570.             if (aBooleanArray876[i2]) {
  13571.                 int j2 = (int) ((Math.random() * (anIntArray873[i2] * 2 + 1) - anIntArray873[i2]) + Math
  13572.                         .sin(anIntArray1030[i2] * (anIntArray928[i2] / 100D))
  13573.                         * anIntArray1203[i2]);
  13574.                 if (i2 == 0)
  13575.                     xCameraPos += j2;
  13576.                 if (i2 == 1)
  13577.                     zCameraPos += j2;
  13578.                 if (i2 == 2)
  13579.                     yCameraPos += j2;
  13580.                 if (i2 == 3)
  13581.                     xCameraCurve = xCameraCurve + j2 & 0x7ff;
  13582.                 if (i2 == 4) {
  13583.                     yCameraCurve += j2;
  13584.                     if (yCameraCurve < 128)
  13585.                         yCameraCurve = 128;
  13586.                     if (yCameraCurve > 383)
  13587.                         yCameraCurve = 383;
  13588.                 }
  13589.             }
  13590.         int k2 = Texture.anInt1481;
  13591.         Model.aBoolean1684 = true;
  13592.         Model.anInt1687 = 0;
  13593.         Model.anInt1685 = super.mouseX - 4;
  13594.         Model.anInt1686 = super.mouseY - 4;
  13595.         DrawingArea.setAllPixelsToZero();
  13596.         worldController.method313(xCameraPos, yCameraPos, xCameraCurve,
  13597.                 zCameraPos, j, yCameraCurve);
  13598.         worldController.clearObj5Cache();
  13599.         updateEntities();
  13600.         drawHeadIcon();
  13601.         method37(k2);
  13602.         draw3dScreen();
  13603.         aRSImageProducer_1165.drawGraphics(4, super.graphics, 4);
  13604.         xCameraPos = l;
  13605.         zCameraPos = i1;
  13606.         yCameraPos = j1;
  13607.         yCameraCurve = k1;
  13608.         xCameraCurve = l1;
  13609.     }
  13610.  
  13611.     public void clearTopInterfaces() {
  13612.         stream.createFrame(130);
  13613.         if (invOverlayInterfaceID != -1) {
  13614.             invOverlayInterfaceID = -1;
  13615.             needDrawTabArea = true;
  13616.             aBoolean1149 = false;
  13617.             tabAreaAltered = true;
  13618.         }
  13619.         if (backDialogID != -1) {
  13620.             backDialogID = -1;
  13621.             inputTaken = true;
  13622.             aBoolean1149 = false;
  13623.         }
  13624.         openInterfaceID = -1;
  13625.         fullscreenInterfaceID = -1;
  13626.     }
  13627.  
  13628.     private Sprite worldMapIcon508;
  13629.     private Sprite worldMapIcon525;
  13630.     @SuppressWarnings("unused")
  13631.     private Sprite logIconH;
  13632.     private Sprite logIconC;
  13633.     private Sprite[] chatButtons;
  13634.  
  13635.     private Sprite[] ORBS = new Sprite[16];
  13636.     private DecimalFormat format;
  13637.  
  13638.     client() {
  13639.         xpAddedPos = xpCounter = expAdded = 0;
  13640.         revision474 = true;
  13641.         OSOrbs = true;
  13642.         // xpAddedPos = expAdded = 0;
  13643.         // xpLock = false;
  13644.         // xpCounter = 0;
  13645.         setFormat(new DecimalFormat());
  13646.         chatRights = new int[500];
  13647.         fullscreenInterfaceID = -1;
  13648.         chatTypeView = 0;
  13649.         clanTitles = new String[500];
  13650.         clanChatMode = 0;
  13651.         cButtonHPos = -1;
  13652.         cButtonCPos = 0;
  13653.         server = "rsts.ddns.net";
  13654.         anIntArrayArray825 = new int[104][104];
  13655.         friendsNodeIDs = new int[200];
  13656.         groundArray = new NodeList[4][104][104];
  13657.         aBoolean831 = false;
  13658.         aStream_834 = new Stream(new byte[5000]);
  13659.         npcArray = new NPC[16384];
  13660.         npcIndices = new int[16384];
  13661.         anIntArray840 = new int[1000];
  13662.         aStream_847 = Stream.create();
  13663.         aBoolean848 = true;
  13664.         openInterfaceID = -1;
  13665.         currentExp = new int[Skills.skillsCount];
  13666.         aBoolean872 = false;
  13667.         anIntArray873 = new int[5];
  13668.         anInt874 = -1;
  13669.         aBooleanArray876 = new boolean[5];
  13670.         drawFlames = false;
  13671.         reportAbuseInput = "";
  13672.         unknownInt10 = -1;
  13673.         menuOpen = false;
  13674.         inputString = "";
  13675.         maxPlayers = 2048;
  13676.         myPlayerIndex = 2047;
  13677.         playerArray = new Player[maxPlayers];
  13678.         playerIndices = new int[maxPlayers];
  13679.         anIntArray894 = new int[maxPlayers];
  13680.         aStreamArray895s = new Stream[maxPlayers];
  13681.         anIntArrayArray901 = new int[104][104];
  13682.         aByteArray912 = new byte[16384];
  13683.         currentStats = new int[Skills.skillsCount];
  13684.         ignoreListAsLongs = new long[100];
  13685.         loadingError = false;
  13686.         anIntArray928 = new int[5];
  13687.         anIntArrayArray929 = new int[104][104];
  13688.         chatTypes = new int[500];
  13689.         chatNames = new String[500];
  13690.         chatMessages = new String[500];
  13691.         chatButtons = new Sprite[4];
  13692.         sideIcons = new Sprite[15];
  13693.         redStones = new Sprite[5];
  13694.         aBoolean954 = true;
  13695.         friendsListAsLongs = new long[200];
  13696.         currentSong = -1;
  13697.         drawingFlames = false;
  13698.         spriteDrawX = -1;
  13699.         spriteDrawY = -1;
  13700.         anIntArray968 = new int[33];
  13701.         anIntArray969 = new int[256];
  13702.         decompressors = new Decompressor[5];
  13703.         variousSettings = new int[2000];
  13704.         aBoolean972 = false;
  13705.         anInt975 = 50;
  13706.         anIntArray976 = new int[anInt975];
  13707.         anIntArray977 = new int[anInt975];
  13708.         anIntArray978 = new int[anInt975];
  13709.         anIntArray979 = new int[anInt975];
  13710.         anIntArray980 = new int[anInt975];
  13711.         anIntArray981 = new int[anInt975];
  13712.         anIntArray982 = new int[anInt975];
  13713.         aStringArray983 = new String[anInt975];
  13714.         anInt985 = -1;
  13715.         hitMarks = new Sprite[20];
  13716.         anIntArray990 = new int[5];
  13717.         aBoolean994 = false;
  13718.         amountOrNameInput = "";
  13719.         aClass19_1013 = new NodeList();
  13720.         aBoolean1017 = false;
  13721.         anInt1018 = -1;
  13722.         anIntArray1030 = new int[5];
  13723.         aBoolean1031 = false;
  13724.         mapFunctions = new Sprite[100];
  13725.         dialogID = -1;
  13726.         maxStats = new int[Skills.skillsCount];
  13727.         anIntArray1045 = new int[2000];
  13728.         aBoolean1047 = true;
  13729.         anIntArray1052 = new int[151];
  13730.         anInt1054 = -1;
  13731.         aClass19_1056 = new NodeList();
  13732.         anIntArray1057 = new int[33];
  13733.         aClass9_1059 = new RSInterface();
  13734.         mapScenes = new Background[100];
  13735.         barFillColor = 0x4d4233;
  13736.         anIntArray1065 = new int[7];
  13737.         anIntArray1072 = new int[1000];
  13738.         anIntArray1073 = new int[1000];
  13739.         aBoolean1080 = false;
  13740.         friendsList = new String[200];
  13741.         inStream = Stream.create();
  13742.         expectedCRCs = new int[9];
  13743.         menuActionCmd2 = new int[500];
  13744.         menuActionCmd3 = new int[500];
  13745.         menuActionID = new int[500];
  13746.         menuActionCmd1 = new int[500];
  13747.         headIcons = new Sprite[20];
  13748.         skullIcons = new Sprite[20];
  13749.         headIconsHint = new Sprite[20];
  13750.         tabAreaAltered = false;
  13751.         aString1121 = "";
  13752.         atPlayerActions = new String[5];
  13753.         atPlayerArray = new boolean[5];
  13754.         anIntArrayArrayArray1129 = new int[4][13][13];
  13755.         aClass30_Sub2_Sub1_Sub1Array1140 = new Sprite[1000];
  13756.         aBoolean1141 = false;
  13757.         aBoolean1149 = false;
  13758.         crosses = new Sprite[8];
  13759.         musicEnabled = true;
  13760.         needDrawTabArea = false;
  13761.         loggedIn = false;
  13762.         canMute = false;
  13763.         aBoolean1159 = false;
  13764.         aBoolean1160 = false;
  13765.         myUsername = "";
  13766.         myPassword = "";
  13767.         genericLoadingError = false;
  13768.         reportAbuseInterfaceID = -1;
  13769.         aClass19_1179 = new NodeList();
  13770.         anInt1184 = 128;
  13771.         invOverlayInterfaceID = -1;
  13772.         stream = Stream.create();
  13773.         menuActionName = new String[500];
  13774.         anIntArray1203 = new int[5];
  13775.         anIntArray1207 = new int[50];
  13776.         anInt1211 = 78;
  13777.         promptInput = "";
  13778.         modIcons = new Sprite[10];
  13779.         tabID = 3;
  13780.         inputTaken = false;
  13781.         songChanging = true;
  13782.         anIntArray1229 = new int[151];
  13783.         aClass11Array1230 = new Class11[4];
  13784.         anIntArray1241 = new int[50];
  13785.         aBoolean1242 = false;
  13786.         anIntArray1250 = new int[50];
  13787.         rsAlreadyLoaded = false;
  13788.         welcomeScreenRaised = false;
  13789.         messagePromptRaised = false;
  13790.         loginMessage1 = "";
  13791.         loginMessage2 = "";
  13792.         backDialogID = -1;
  13793.         bigX = new int[4000];
  13794.         bigY = new int[4000];
  13795.         anInt1289 = -1;
  13796.     }
  13797.  
  13798.     private final int[] chatRights;
  13799.     private int hoverId;
  13800.  
  13801.     /**
  13802.      * Gameframes
  13803.      */
  13804.  
  13805.     private Sprite tabArea;
  13806.     private Sprite tabArea474;
  13807.     private Sprite tabArea508;
  13808.     private Sprite mapArea;
  13809.     private Sprite mapArea474;
  13810.     private Sprite mapArea508;
  13811.  
  13812.     public int rights;
  13813.     public Sprite Increase;
  13814.     public Sprite Decrease;
  13815.     public String name;
  13816.     public String message;
  13817.     public String clanname;
  13818.     public int chatTypeView;
  13819.     public int clanChatMode;
  13820.     public int duelMode;
  13821.     private Sprite chatArea;
  13822.     private Background mapBack;
  13823.  
  13824.     private RSImageProducer leftFrame;
  13825.     private RSImageProducer topFrame;
  13826.     private RSImageProducer rightFrame;
  13827.     private int ignoreCount;
  13828.     private long aLong824;
  13829.     private int[][] anIntArrayArray825;
  13830.     private int[] friendsNodeIDs;
  13831.     private NodeList[][][] groundArray;
  13832.     private int[] anIntArray828;
  13833.     private int[] anIntArray829;
  13834.     private volatile boolean aBoolean831;
  13835.     private Socket aSocket832;
  13836.     private int loginScreenState;
  13837.     private Stream aStream_834;
  13838.     private NPC[] npcArray;
  13839.     private int npcCount;
  13840.     private int[] npcIndices;
  13841.     private int anInt839;
  13842.     private int[] anIntArray840;
  13843.     private int anInt841;
  13844.     private int anInt842;
  13845.     private int anInt843;
  13846.     private String aString844;
  13847.     private int privateChatMode;
  13848.     private Stream aStream_847;
  13849.     private boolean aBoolean848;
  13850.     private static int anInt849;
  13851.     private int[] anIntArray850;
  13852.     private int[] anIntArray851;
  13853.     private int[] anIntArray852;
  13854.     private int[] anIntArray853;
  13855.     private static int anInt854;
  13856.     private int anInt855;
  13857.     public static int openInterfaceID;
  13858.     private int xCameraPos;
  13859.     private int zCameraPos;
  13860.     private int yCameraPos;
  13861.     private int yCameraCurve;
  13862.     private int xCameraCurve;
  13863.     private int myPrivilege;
  13864.     private final int[] currentExp;
  13865.     private Sprite[] redStones;
  13866.     private Sprite mapFlag;
  13867.     private Sprite mapMarker;
  13868.     private boolean aBoolean872;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement