Guest User

Firyze: Client class

a guest
Nov 22nd, 2013
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 466.04 KB | None | 0 0
  1. package firyze;
  2.  
  3. import java.applet.AppletContext;
  4. import java.awt.*;
  5. import java.io.*;
  6. import java.net.*;
  7. import java.lang.reflect.Method;
  8. import java.text.DecimalFormat;
  9. import java.text.DecimalFormatSymbols;
  10. import java.text.SimpleDateFormat;
  11. import java.util.Calendar;
  12.  
  13. import firyze.cache.CacheDownloader;
  14. import firyze.entity.Mobile;
  15. import firyze.entity.Item;
  16. import firyze.entity.ItemDef;
  17. import firyze.entity.Npc;
  18. import firyze.entity.NpcDef;
  19. import firyze.entity.ObjectDef;
  20. import firyze.entity.Player;
  21. import firyze.net.SignLink;
  22.  
  23. @SuppressWarnings("serial")
  24. public class Client extends RSApplet {
  25.    
  26.     public String indexLocation(int cacheIndex, int index) {
  27.         return SignLink.findCacheDir() + "index" + cacheIndex + "/" + (index != -1 ? index + ".gz" : "");
  28.     }
  29.  
  30.     public void repackCacheIndex(int cacheIndex) {
  31.         System.out.println("Started repacking index " + cacheIndex + ".");
  32.         int indexLength = new File(indexLocation(cacheIndex, -1)).listFiles().length;
  33.         File[] file = new File(indexLocation(cacheIndex, -1)).listFiles();
  34.         try {
  35.             for(int index = 0; index < indexLength; index++) {
  36.                 int fileIndex = Integer.parseInt(getFileNameWithoutExtension(file[index].toString()));
  37.                 byte[] data = fileToByteArray(cacheIndex, fileIndex);
  38.                 if(data != null && data.length > 0) {
  39.                     decompressors[cacheIndex].method234(data.length, data, fileIndex);
  40.                     System.out.println("Repacked " + fileIndex + ".");
  41.                 } else {
  42.                     System.out.println("Unable to locate index " + fileIndex + ".");
  43.                 }
  44.             }
  45.         } catch(Exception e) {
  46.             System.out.println("Error packing cache index " + cacheIndex + ".");
  47.         }
  48.         System.out.println("Finished repacking " + cacheIndex + ".");
  49.     }
  50.  
  51.     public byte[] fileToByteArray(int cacheIndex, int index) {
  52.         try {
  53.             if(indexLocation(cacheIndex, index).length() <= 0 || indexLocation(cacheIndex, index) == null) {
  54.                 return null;
  55.             }
  56.             File file = new File(indexLocation(cacheIndex, index));
  57.             byte[] fileData = new byte[(int)file.length()];
  58.             FileInputStream fis = new FileInputStream(file);
  59.             fis.read(fileData);
  60.             fis.close();
  61.             return fileData;
  62.         } catch(Exception e) {
  63.             return null;
  64.         }
  65.     }
  66.    
  67.    
  68.     int cacheSpriteAmount = 45;
  69.     String spriteLoc = SignLink.findCacheDir() + "/images/";
  70.     public static boolean fullScreenOn = false;
  71.  
  72.     public static String server = "127.0.0.1";
  73.  
  74.     Sprite taskBackground = new Sprite("Tasks/SPRITE 0");
  75.     Sprite taskCompleted = new Sprite("Tasks/SPRITE 1");
  76.     Sprite taskFailed = new Sprite("Tasks/SPRITE 2");
  77.     int taskYpos = -100;
  78.     int taskTimer = 0;
  79.     boolean drawingTask = false;
  80.     String taskInfo;
  81.     boolean taskSuccesful;
  82.     public void setTaskPopUp(String task, boolean succesful) {
  83.         if(!drawingTask) {
  84.             taskInfo = task;
  85.             taskSuccesful = succesful;
  86.             drawingTask = true;
  87.         }
  88.     }
  89.     public void processTaskDrawing() {
  90.         if(!drawingTask)
  91.             return;
  92.         taskTimer++;
  93.         if(taskTimer < 20)
  94.             taskYpos += 5;
  95.         if(taskTimer > 125)
  96.             taskYpos -= 5;
  97.         if(taskYpos == -100) {
  98.             drawingTask = false;
  99.             taskTimer = 0;
  100.         }
  101.         taskBackground.drawHDSprite(140, taskYpos);
  102.         if(taskSuccesful) {
  103.             taskCompleted.drawSprite(160, taskYpos + 20);
  104.             fancyText.drawCenterAlignedString("Task Completed!", 281, taskYpos + 40, 0xFF9820, 0, true);
  105.         } else {
  106.             taskFailed.drawSprite(160, taskYpos + 20);
  107.             fancyText.drawCenterAlignedString("Task Failed!", 281, taskYpos + 40, 0xFF9820, 0, true);
  108.         }
  109.         smallText.drawCenterAlignedString(taskInfo, 281, taskYpos + 60, 0xFF9820, 0, true);
  110.        
  111.     }
  112.  
  113.     public String fixChat(String s) {
  114.         String result = "";
  115.         boolean lastIsDot = true;
  116.         boolean lastIsNormal = false;
  117.         for(int i = 0; i < s.length(); i++) {
  118.             char s2 = s.charAt(i);
  119.             if(lastIsNormal) {
  120.                 s2 = Character.toLowerCase(s2);
  121.                 lastIsNormal = false;
  122.             }
  123.             if(lastIsDot && isNormalChar(s2))  {
  124.                 s2 = Character.toUpperCase(s2);
  125.                 lastIsDot = false;
  126.             }  
  127.             result += s2;
  128.             if(s2 == '.' || s2 == '!' || s2 == '?')
  129.                 lastIsDot = true;
  130.             if(isNormalChar(s2))
  131.                 lastIsNormal = true;
  132.         }
  133.         return result;
  134.     }
  135.     public boolean isNormalChar(char ch) {
  136.         return ch >= 'a' && ch <= 'z' || ch >= 'A' && ch <= 'Z' || ch >= '0' && ch <= '9';
  137.     }
  138.  
  139.     Sprite background = new Sprite(spriteLoc + "1.png", 2216, 1300);
  140.     Sprite logo = new Sprite(spriteLoc + "0.png", 304, 90);
  141.  
  142.     public static String getIndefiniteArticle(String thing) {
  143.         char first = thing.toLowerCase().charAt(0);
  144.         boolean vowel = first == 'a' || first == 'e' || first == 'i' || first == 'o' || first == 'u';
  145.         return (vowel ? "an" : "a");
  146.     }
  147.  
  148.     public static String addIndefiniteArticle(String thing) {
  149.         return getIndefiniteArticle(thing) + " " + thing;
  150.     }
  151.  
  152.     public static void writeLoginData() throws IOException {
  153.         if(!rememberMe) return;
  154.         try {
  155.             DataOutputStream out = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(SignLink.findCacheDir() + "logindata.dat")));
  156.             out.writeUTF(myUsername);
  157.             out.writeUTF(myPassword);
  158.             nameRemembered = true;
  159.             out.close();
  160.         } catch(Exception e) {  }
  161.     }
  162.     public static void readLoginData() throws IOException {
  163.         try {
  164.             DataInputStream in = new DataInputStream(new BufferedInputStream(new FileInputStream(SignLink.findCacheDir() + "logindata.dat")));
  165.             myUsername = in.readUTF();
  166.             myPassword = in.readUTF();
  167.             if(myUsername.length() > 0 && myPassword.length() > 0) {
  168.                 rememberMe = true;
  169.                 nameRemembered = true;
  170.             }
  171.             in.close();
  172.         } catch(Exception e) {  }
  173.     }
  174.     public static void deleteLoginData() throws IOException {
  175.         try {
  176.             DataOutputStream out = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(SignLink.findCacheDir() + "logindata.dat")));
  177.             out.writeUTF("");
  178.             out.writeUTF("");
  179.             nameRemembered = false;
  180.             rememberMe = false;
  181.             out.close();
  182.         } catch(Exception e) {  }
  183.     }
  184.  
  185.     static boolean showDeveloperConsole = false;
  186.  
  187. public static String cursorInfo[] = {
  188. "Walk-to", "Take", "Use", "Talk-to", "Open", "Net", "Bait", "Cage", "Harpoon",
  189. "Chop", "Bury", "Pray-at", "Mine", "Eat", "Drink", "Wield", "Wear", "Equip",
  190. "Attack", "Enter", "Exit", "Climb-up", "Climb-down", "Search", "Steal", "Smelt",
  191. "Clean", "Back", "Deposit Bank", "Inspect", "Pick", "Pointless", "Pointless", "Settings",
  192. "Pointless", "Pointless", "Confirm", "Decline",
  193. "Cast Ice Barrage", "Cast Blood Barrage on", "Cast Shadow Barrage on", "Cast Smoke Barrage on",  "Cast Ice Blitz on on", "Cast Blood Blitz on", "Cast Shadow Blitz on",
  194. "Cast Smoke Blitz on", "Cast Ice Burst on", "Cast BloodBurst on on", "Cast Shadow Burst on", "Cast Smoke Burst on", "Cast Ice Rush on", "Cast Blood Rush on on",
  195. "Cast Shadow Rush on", "Cast Smoke Rush on",
  196. "Link", "Split Private", "Graphics", "Audio", "Pointless", "Pointless", "Click", "Information", "Cast High level alchemy on", "Cast Low level alchemy on", "Value",
  197. "Select Starter", "Craft-rune", "Pointless", "Pointless", "Slash", "Pull", "Browse Item Database", "Browse Quick","Pointlsee (Cast )","Swap to ",
  198. };
  199.  
  200. private static boolean rememberMe = false, nameRemembered = false;
  201.  
  202.     public static boolean pvpWorld = true;
  203.  
  204.     private long yellTimer;
  205.  
  206.     private boolean rollingCharacter = false;
  207.  
  208.     /* Staff tab */
  209.     private String showedName = "";
  210.     private String fixedName = "";
  211.     private boolean StaffTabInUse = true;
  212.     private int StaffTabSelected = -1;
  213.     private boolean writingOnStaffTab = false;
  214.     private String staffTabInput = "";
  215.  
  216.     public static boolean adminMode = false;
  217.  
  218.     public Sprite magicAuto;
  219.     public boolean Autocast = false;
  220.     public int autocastId = 0;
  221.  
  222.     public static boolean snow = false;
  223.  
  224.     public boolean
  225.                 fogSky = true,
  226.                 staffTabOpen = false,
  227.                 idToggle = false,
  228.                 hitbarToggle = true,
  229.                 menuToggle = true,
  230.                 namesToggle = false,
  231.                 tooltipToggle = false;
  232.     public static boolean
  233.                 playerShadow = true,
  234.                 newDamage = true;
  235.    
  236.     public TextFont smallText;
  237.     public TextFont regularText;
  238.     public TextFont boldText;
  239.     public TextFont fancyText;
  240.     public Sprite[] chatImages = new Sprite[7];
  241.     public int CameraPos1 = 3;
  242.     public int CameraPos2 = 600;
  243.         public AlertHandler alertHandler;
  244.    
  245.     public int followPlayer = 0;
  246. public int followNPC = 0;
  247. public int followDistance = 1;
  248.     public boolean selectAction;
  249.     public int isClicked;
  250.     public Sprite[] LOGIN = new Sprite[27];
  251.     public Sprite[] combatIcons = new Sprite[4];
  252.     public Sprite qc;
  253.    
  254.     public void welcome() {
  255.     }
  256.  
  257.     public String formatValue(int i, String Separator) {
  258.         DecimalFormatSymbols separator = new DecimalFormatSymbols();
  259.         separator.setGroupingSeparator(',');
  260.         DecimalFormat formatter = new DecimalFormat("#,###,###,###", separator);
  261.         return formatter.format(i).replaceAll(",",Separator);
  262.     }
  263.  
  264.     public static String optimizeText(String text)
  265.     {
  266.         char buf[] = text.toCharArray();
  267.         boolean endMarker = true;  
  268.         for(int i = 0; i < buf.length; i++) {
  269.             char c = buf[i];
  270.             if(endMarker && c >= 'a' && c <= 'z') {
  271.                 buf[i] -= 0x20;
  272.                 endMarker = false;
  273.             }
  274.             if(c == '.' || c == '!' || c == '?') endMarker = true;
  275.         }
  276.         return new String(buf, 0, buf.length);
  277.     }
  278.     public void setSidebarInterface(int sidebarID, int interfaceID) {
  279.         tabInterfaceIDs[sidebarID] = interfaceID;
  280.         tabID = sidebarID;
  281.         needDrawTabArea = true;
  282.         tabAreaAltered = true;
  283.     }
  284.    
  285.     public int positions[] = new int[2000];
  286.     public int landScapes[] = new int[2000];
  287.     public int objects[] = new int[2000];
  288.  
  289.     public void setNewMaps() {
  290.         try {
  291.             BufferedReader in = new BufferedReader(new FileReader(SignLink.findCacheDir()+"maps/mapConfig.txt"));
  292.             String s;
  293.             int D = 0;
  294.             while((s = in.readLine()) != null)  {
  295.                 positions[D] = Integer.parseInt(s.substring(s.indexOf("=")+1,s.indexOf("(")));
  296.                 landScapes[D] = Integer.parseInt(s.substring(s.indexOf("(")+1,s.indexOf(")")));
  297.                 objects[D] = Integer.parseInt(s.substring(s.indexOf("[")+1,s.indexOf("]")));
  298.                     D++;
  299.             }
  300.             in.close();
  301.             System.out.println("D: "+D);
  302.         } catch (IOException e) {
  303.             e.printStackTrace();
  304.         }
  305.     }
  306.     public void maps() {
  307.         for(int MapIndex = 0; MapIndex < 3536; MapIndex++) {
  308.             byte[] abyte0 = GetMap(MapIndex);
  309.             if(abyte0 != null && abyte0.length > 0) {
  310.                 decompressors[4].method234(abyte0.length, abyte0, MapIndex);
  311.             }
  312.         }
  313.     }
  314.    
  315.     public byte[] GetMap(int Index) {
  316.         try {
  317.             File Map = new File(SignLink.findCacheDir()+"/maps/"+Index+".gz");
  318.             byte[] aByte = new byte[(int)Map.length()];
  319.             FileInputStream Fis = new FileInputStream(Map);
  320.                 Fis.read(aByte);
  321.                 System.out.println(""+Index+" aByte = ["+aByte+"]!");
  322.                 Fis.close();
  323.             return aByte;
  324.         } catch(Exception e) {
  325.             return null;
  326.         }
  327.     }
  328.  
  329. public final String titleColor(final int i, int type) {
  330.     String titleChatbox = "", titleRightclick = "";
  331.     switch (i) {
  332.  
  333.         case 0: //orange
  334.             titleChatbox = "13132800";
  335.             titleRightclick = "ort";
  336.             break;
  337.  
  338.         case 1://purple
  339.             titleChatbox = "11158698";
  340.             titleRightclick = "put";
  341.             break;
  342.  
  343.         case 2: //red
  344.             titleChatbox = "12656646";
  345.             titleRightclick = "ret";
  346.             break;
  347.  
  348.         case 3: //green
  349.             titleChatbox = "26112";
  350.             titleRightclick = "grt";
  351.             break;
  352.  
  353.         case 4: //blue
  354.             titleChatbox = "3368601";
  355.             titleRightclick = "369";
  356.             break;
  357.     }
  358.     if(type == 0)
  359.         return titleChatbox;
  360.     else
  361.         return titleRightclick;
  362. }
  363.  
  364.     public static String capitalize(String s) {
  365.         for(int i = 0; i < s.length(); i++) {
  366.             if(i == 0) {
  367.                 s = String.format( "%s%s",
  368.                          Character.toUpperCase(s.charAt(0)),
  369.                          s.substring(1) );
  370.             }
  371.             if(!Character.isLetterOrDigit(s.charAt(i))) {
  372.                 if(i + 1 < s.length()) {
  373.                     s = String.format( "%s%s%s",
  374.                              s.subSequence(0, i+1),
  375.                              Character.toUpperCase(s.charAt(i + 1)),
  376.                              s.substring(i+2) );
  377.                 }
  378.             }
  379.         }
  380.         return s;
  381.     }
  382.     public static int spellID = 0;
  383.     private static String intToKOrMilLongName(int i) {
  384.         String s = String.valueOf(i);
  385.         for(int k = s.length() - 3; k > 0; k -= 3)
  386.             s = s.substring(0, k) + "," + s.substring(k);
  387.         if(s.length() > 8)
  388.             s = "@gre@" + s.substring(0, s.length() - 8) + "M @whi@(" + s + ")";
  389.         else
  390.         if(s.length() > 4)
  391.             s = "@cya@" + s.substring(0, s.length() - 4) + "K @whi@(" + s + ")";
  392.         return " " + s;
  393.     }
  394.      public final String methodR(/*int i,*/ int j) {
  395.         //if(i <= 0)
  396.         //    pktType = inStream.readUnsignedByte();
  397.         if(j >= 0 && j < 10000)
  398.             return String.valueOf(j);
  399.         if(j >= 10000 && j < 10000000)
  400.             return j / 1000 + "K";
  401.         if(j >= 10000000 && j  < 999999999)
  402.             return j / 1000000 + "M";
  403.         if(j >= 999999999)
  404.             return "*";
  405.         else
  406.         return "?";
  407.     }
  408.  
  409.     public void models() {
  410.         for(int ModelIndex = 0; ModelIndex < 50000; ModelIndex++) {
  411.             byte[] abyte0 = getModel(ModelIndex);
  412.             if(abyte0 != null && abyte0.length > 0) {
  413.        
  414.                 decompressors[1].method234(abyte0.length, abyte0, ModelIndex);
  415.                 pushMessage("Model added successfully!", 0, "");
  416.             }
  417.         }
  418.     }
  419.     public byte[] getModel(int Index) {
  420.         try {
  421.             File Model = new File(SignLink.findCacheDir() + "/models/"+Index+".dat");//there we go.
  422.             byte[] aByte = new byte[(int)Model.length()];
  423.             FileInputStream fis = new FileInputStream(Model);
  424.             fis.read(aByte);
  425.             pushMessage("aByte = ["+aByte+"]!", 0, "");
  426.             fis.close();
  427.        
  428.             return aByte;
  429.         }
  430.         catch(Exception e)
  431.         {return null;}
  432.     }
  433.    
  434.     private void stopMidi() {
  435.         SignLink.midifade = 0;
  436.         SignLink.midi = "stop";
  437.     }
  438.    
  439.     private boolean menuHasAddFriend(int j) {
  440.         if(j < 0)
  441.             return false;
  442.         int k = menuActionID[j];
  443.         if(k >= 2000)
  444.             k -= 2000;
  445.         return k == 337;
  446.     }
  447.  
  448.     public void drawChannelButtons() {
  449.         String text[] = { "On", "Friends", "Off", "Hide" };
  450.         int disabledColor[] = { 65280, 0xffff00, 0xff0000, 65535 };
  451.         switch (cButtonCPos) {
  452.         case 0:
  453.             chatButtons[1].drawSprite(5, 143);
  454.             break;
  455.         case 1:
  456.             chatButtons[1].drawSprite(62, 143);
  457.             break;
  458.         case 2:
  459.             chatButtons[1].drawSprite(119, 143);
  460.             break;
  461.         case 3:
  462.             chatButtons[1].drawSprite(176, 143);
  463.             break;
  464.         case 4:
  465.             chatButtons[1].drawSprite(233, 143);
  466.             break;
  467.         case 5:
  468.             chatButtons[1].drawSprite(290, 143);
  469.             break;
  470.         case 6:
  471.             chatButtons[1].drawSprite(347, 143);
  472.             break;
  473.         }
  474.         if (cButtonHPos == cButtonCPos) {
  475.             switch (cButtonHPos) {
  476.             case 0:
  477.                 chatButtons[2].drawSprite(5, 143);
  478.                 break;
  479.             case 1:
  480.                 chatButtons[2].drawSprite(62, 143);
  481.                 break;
  482.             case 2:
  483.                 chatButtons[2].drawSprite(119, 143);
  484.                 break;
  485.             case 3:
  486.                 chatButtons[2].drawSprite(176, 143);
  487.                 break;
  488.             case 4:
  489.                 chatButtons[2].drawSprite(233, 143);
  490.                 break;
  491.             case 5:
  492.                 chatButtons[2].drawSprite(290, 143);
  493.                 break;
  494.             case 6:
  495.                 chatButtons[2].drawSprite(347, 143);
  496.                 break;
  497.             case 7:
  498.                 chatButtons[3].drawSprite(404, 143);
  499.                 break;
  500.             }
  501.         } else {
  502.             switch (cButtonHPos) {
  503.             case 0:
  504.                 chatButtons[0].drawSprite(5, 143);
  505.                 break;
  506.             case 1:
  507.                 chatButtons[0].drawSprite(62, 143);
  508.                 break;
  509.             case 2:
  510.                 chatButtons[0].drawSprite(119, 143);
  511.                 break;
  512.             case 3:
  513.                 chatButtons[0].drawSprite(176, 143);
  514.                 break;
  515.             case 4:
  516.                 chatButtons[0].drawSprite(233, 143);
  517.                 break;
  518.             case 5:
  519.                 chatButtons[0].drawSprite(290, 143);
  520.                 break;
  521.             case 6:
  522.                 chatButtons[0].drawSprite(347, 143);
  523.                 break;
  524.             case 7:
  525.                 chatButtons[3].drawSprite(404, 143);
  526.                 break;
  527.             }
  528.         }
  529.         smallText.drawLeftAlignedString("Report Abuse", 425, 157, 0xffffff, 0, true);
  530.         smallText.drawLeftAlignedString("All", 26, 157, 0xffffff, 0, true);
  531.         smallText.drawLeftAlignedString("Game", 76, 157, 0xffffff, 0, true);
  532.         smallText.drawLeftAlignedString("Public", 131, 153, 0xffffff, 0, true);
  533.         smallText.drawLeftAlignedString("Private", 184, 153, 0xffffff, 0, true);
  534.         smallText.drawLeftAlignedString("Clan", 249, 153, 0xffffff, 0, true);
  535.         smallText.drawLeftAlignedString("Trade", 304, 153, 0xffffff, 0, true);
  536.         smallText.drawLeftAlignedString("Yell", 365, 153, 0xffffff, 0, true);
  537.  
  538.         smallText.drawCenterAlignedString(text[publicChatMode], 147, 164, disabledColor[publicChatMode], 0, true);
  539.         smallText.drawCenterAlignedString(text[privateChatMode], 203, 164, disabledColor[privateChatMode], 0, true);
  540.         smallText.drawCenterAlignedString(text[clanChatMode], 261, 164, disabledColor[clanChatMode], 0, true);
  541.         smallText.drawCenterAlignedString(text[tradeMode], 318, 164, disabledColor[tradeMode], 0, true);
  542.         smallText.drawCenterAlignedString(text[yellChatMode], 374, 164, disabledColor[yellChatMode], 0, true);
  543.     }
  544.  
  545.     private void drawChatArea() {
  546.         int x = 0;
  547.         int y = 0;
  548.         int width = 500;
  549.         int height = 168;
  550.         chatArea.initDrawingArea();
  551.         Texture.anIntArray1472 = anIntArray1180;
  552.         chatBack[getSpriteID()].drawSprite(0, 0);
  553.         if(backDialogID == 26500 || backDialogID == 26600 || backDialogID == 26700) {
  554.             DrawingArea.fillRect(7, 7, 505, 85, 0, 200);
  555.             DrawingArea.fillRect(7, 7+85, 505, 129-85, 0, 100);
  556.         }
  557.         if(messagePromptRaised) {
  558.             boldText.drawCenterAlignedString(inputPromptTitle, 259, 60, 0, -1, true);
  559.             boldText.drawCenterAlignedString(promptInput + "*", 259, 80, 128, -1, true);
  560.         } else if(inputDialogState == 1) {
  561.             boldText.drawCenterAlignedString("Enter amount:", 259, 60, 0, -1, true);
  562.             boldText.drawCenterAlignedString(amountOrNameInput + "*", 259, 80, 128, -1, true);
  563.         } else if(inputDialogState == 2) {
  564.             boldText.drawCenterAlignedString("Enter name:", 259, 60, 0, -1, true);
  565.             boldText.drawCenterAlignedString(amountOrNameInput + "*", 259, 80, 128, -1, true);
  566.         } else if(chatBoxMessage != null) {
  567.             boldText.drawCenterAlignedString(chatBoxMessage, 259, 60, 0, -1, true);
  568.             boldText.drawCenterAlignedString("Click to continue", 259, 80, 128, -1, true);
  569.         } else if(backDialogID != -1) {
  570.             drawInterface(0, 20, 20, RSInterface.interfaceCache[backDialogID]);
  571.         } else if(dialogID != -1) {
  572.             drawInterface(0, 20, 20, RSInterface.interfaceCache[dialogID]);
  573.         } else {
  574.             int messageCount = 0;
  575.             DrawingArea.setClip(8, 7, 497, 122);
  576.             regularText.drawLeftAlignedString("message", 210, 310, 0, 0, true);
  577.             for(int i = 0; i < 500; i++)
  578.                 if(chatMessages[i] != null) {
  579.                     int yPos = 111 - 14 * messageCount + chatAreaScrollPos + 5;
  580.                     if(yPos < y || yPos > y + height)
  581.                         continue;
  582.                     int xPos = 11;
  583.                     int type = chatTypes[i];
  584.                     String name = chatNames[i];
  585.                     byte rights = 0;
  586.                     if(name != null && name.startsWith("@cr1@")) {
  587.                         name = name.substring(5);
  588.                         rights = 1;
  589.                     } else if(name != null && name.startsWith("@cr3@")) {
  590.                         name = name.substring(5);
  591.                         rights = 2;
  592.                     } else if(name != null && name.startsWith("@cr2@")) {
  593.                         name = name.substring(5);
  594.                         rights = 3;
  595.                     } else if(name != null && name.startsWith("@cr0@")) {
  596.                         name = name.substring(5);
  597.                         rights = 4;
  598.                     }
  599.                    
  600.                     if(type == 0)
  601.                         if(chatTypeView == 5 || chatTypeView == 0)
  602.                             regularText.drawLeftAlignedString(chatMessages[i], xPos, yPos, 0, -1, true);
  603.                    
  604.                     if(type == 9)
  605.                         if(chatTypeView == 5 || chatTypeView == 0)
  606.                             regularText.drawLeftAlignedString(chatMessages[i] + " <col=255>" + name, xPos, yPos, 0x7e3200, -1, true);
  607.                    
  608.                     if(type == 12) //yell
  609.                         if((chatTypeView == 6 || chatTypeView == 0) && (yellChatMode == 0 || yellChatMode == 1 && isFriendOrSelf(name)))
  610.                             regularText.drawLeftAlignedString(chatMessages[i], xPos, yPos, 0, -1, true);
  611.                    
  612.                     if((type == 1 || type == 2) && (type == 1 || publicChatMode == 0 || publicChatMode >= 2 && publicChatMode <= 3 && rights >= 1 && rights <= 3 || publicChatMode == 1 && isFriendOrSelf(name.substring(name.indexOf("</col>")+6))))
  613.                         if(chatTypeView == 1 || chatTypeView == 0) {
  614.                             switch(rights) {
  615.                                 case 1:
  616.                                     modIcons[1].drawSprite(xPos, yPos - 12);
  617.                                     xPos += 14;
  618.                                     break;
  619.                                 case 2:
  620.                                     modIcons[3].drawSprite(xPos, yPos - 12);
  621.                                     xPos += 14;
  622.                                     break;
  623.                                 case 3:
  624.                                     modIcons[2].drawSprite(xPos, yPos - 12);
  625.                                     xPos += 14;
  626.                                     break;
  627.                                 case 4:
  628.                                     modIcons[0].drawSprite(xPos, yPos - 12);
  629.                                     xPos += 14;
  630.                                     break;
  631.                                 }
  632.                                 regularText.drawLeftAlignedString(name + ":", xPos, yPos, 0, -1, true);
  633.                                 xPos += regularFont.getTextWidth(name) + 8;
  634.                                 regularText.drawLeftAlignedString(chatMessages[i], xPos, yPos, 255, -1, true);
  635.                         }
  636.                    
  637.                     if((type == 3 || type == 7) && (splitPrivateChat == 0 || chatTypeView == 2) && (type == 7 || privateChatMode == 0 || privateChatMode == 1 && isFriendOrSelf(name)))
  638.                         if(chatTypeView == 2 || chatTypeView == 0) {
  639.                             regularText.drawLeftAlignedString("From", xPos, yPos, 0, -1, true);
  640.                             xPos += regularFont.getTextWidth("From ");
  641.                             switch(rights) {
  642.                                 case 1:
  643.                                     modIcons[1].drawSprite(xPos, yPos - 12);
  644.                                     xPos += 14;
  645.                                     break;
  646.                                 case 2:
  647.                                     modIcons[3].drawSprite(xPos, yPos - 12);
  648.                                     xPos += 14;
  649.                                     break;
  650.                                 case 3:
  651.                                     modIcons[2].drawSprite(xPos, yPos - 12);
  652.                                     xPos += 14;
  653.                                     break;
  654.                                 case 4:
  655.                                     modIcons[0].drawSprite(xPos, yPos - 12);
  656.                                     xPos += 14;
  657.                                     break;
  658.                             }
  659.                             regularText.drawLeftAlignedString(name + ":", xPos, yPos, 0, -1, true);
  660.                             xPos += regularFont.getTextWidth(name) + 8;
  661.                             regularText.drawLeftAlignedString(chatMessages[i], xPos, yPos, 0x800000, -1, true);
  662.                         }
  663.                        
  664.                     if(type == 4 && (tradeMode == 0 || tradeMode == 1 && isFriendOrSelf(name)))
  665.                         if(chatTypeView == 3 || chatTypeView == 0) {
  666.                             regularText.drawLeftAlignedString( name + " " + chatMessages[i], xPos, yPos, 0x800080, -1, true);
  667.                         }
  668.                    
  669.                     if(type == 5 && splitPrivateChat == 0 && privateChatMode < 2)
  670.                         if(chatTypeView == 2 || chatTypeView == 0) {
  671.                             regularText.drawLeftAlignedString(chatMessages[i], xPos, yPos, 0x800000, -1, true);
  672.                         }
  673.  
  674.                     if(type == 6 && (splitPrivateChat == 0 || chatTypeView == 2) && privateChatMode < 2)
  675.                         if(chatTypeView == 2 || chatTypeView == 0) {
  676.                             regularText.drawLeftAlignedString("To " + name + ":", xPos, yPos, 0, -1, true);
  677.                             regularText.drawLeftAlignedString(chatMessages[i], xPos + 4 + regularFont.getTextWidth("To :" + name), yPos, 0x800000, -1, true);
  678.                         }
  679.  
  680.                     if(type == 8 && (tradeMode == 0 || tradeMode == 1 && isFriendOrSelf(name)))
  681.                         if(chatTypeView == 3 || chatTypeView == 0 || type == 11 && clanChatMode == 0 && chatTypeView == 11)
  682.                             regularText.drawLeftAlignedString(name + " " + chatMessages[i], xPos, yPos, 0x7e3200, -1, true);
  683.                    
  684.                     if(type == 16 && (clanChatMode == 0 || clanChatMode == 1 && isFriendOrSelf(chatNames[i]))) {
  685.                         if(chatTypeView == 11 || chatTypeView == 0) {
  686.                             int clanNameWidth = regularFont.getTextWidth(capitalize(clanNames[i].toLowerCase()));
  687.                             regularText.drawLeftAlignedString("[", xPos, yPos, 0, -1, true);
  688.                             regularText.drawLeftAlignedString("]", clanNameWidth + xPos + 5, yPos, 0, -1, true);
  689.                             xPos += 30;
  690.                             xPos += clanNameWidth;
  691.                             switch(rights) {
  692.                                 case 1:
  693.                                     modIcons[1].drawSprite(xPos - 18, yPos - 12);
  694.                                     xPos += 14;
  695.                                     break;
  696.                                 case 2:
  697.                                     modIcons[2].drawSprite(xPos - 18, yPos - 12);
  698.                                     xPos += 14;
  699.                                     break;
  700.                                 case 3:
  701.                                     modIcons[3].drawSprite(xPos - 18, yPos - 12);
  702.                                     xPos += 14;
  703.                                     break;
  704.                                 case 4:
  705.                                     modIcons[0].drawSprite(xPos - 18, yPos - 12);
  706.                                     xPos += 14;
  707.                                     break;
  708.                             }
  709.                             regularText.drawLeftAlignedString(""+capitalize(clanNames[i].toLowerCase())+"", 16, yPos, 255, -1, true); //14
  710.                             regularText.drawBasicString("<col=0>"+capitalize(chatNames[i]) + ":", xPos-17, yPos);
  711.                             xPos += regularFont.getTextWidth(chatNames[i]) + 7;
  712.                             regularText.drawLeftAlignedString(optimizeText(chatMessages[i].toLowerCase()), xPos-16, yPos, 0x800000, -1, true);
  713.                         }
  714.                     }
  715.                 messageCount++;
  716.             }
  717.             DrawingArea.removeClip();
  718.             chatAreaScrollMax = messageCount * 14 + 12;
  719.             if(chatAreaScrollMax < 111)
  720.                 chatAreaScrollMax = 111;
  721.             drawScrollbar(496, 7, 114, chatAreaScrollMax - chatAreaScrollPos - 113, chatAreaScrollMax);
  722.             String s;
  723.             if(myPlayer != null && myPlayer.name != null)
  724.                 s = "<col="+titleColor(myPlayer.titleColor, 0)+">" + myPlayer.title + "</col>" + myPlayer.name;
  725.             else
  726.                 s = TextClass.fixName(capitalize(myUsername));
  727.             regularText.drawLeftAlignedString(s + ":", 11, 133, 0, -1, true);
  728.             regularText.drawLeftAlignedString(inputString + (writingOnStaffTab ?  "" : "*"), 13 + regularFont.getTextWidth(s + ": "), 133, 255, -1, false);
  729.             DrawingArea.drawHorizontalLine(7, 121, 506, 0x807660);
  730.         }
  731.         drawChannelButtons();
  732.         if(menuOpen)
  733.             drawMenu(0, 338);
  734.         chatArea.drawGraphics(0, 338, super.graphics);
  735.         mainGameArea.initDrawingArea();
  736.         Texture.anIntArray1472 = anIntArray1182;
  737.     }
  738.  
  739.     public void init() {
  740.         try {
  741.             super.setCursor(0);
  742.             System.out.println("Firyze is loading...");
  743.             nodeID = 10;//friends list order
  744.             portOff = 0;
  745.             setHighMem();
  746.             isMembers = true;
  747.             SignLink.startpriv(InetAddress.getLocalHost());
  748.             instance = this;
  749.             initClientFrame(765, 503);
  750.             readLoginData();
  751.         } catch (Exception e) {
  752.             e.printStackTrace();
  753.         }
  754.     }
  755.    
  756.     public void drawTabHover() {
  757.         if(tabHPos == 0 && tabInterfaceIDs[0] != -1)
  758.             tabHover.drawSprite(3+3, 0);
  759.         else if(tabHPos == 1 && tabInterfaceIDs[1] != -1)
  760.             tabHover.drawSprite(33+3, 0);
  761.         else if(tabHPos == 2 && tabInterfaceIDs[2] != -1)
  762.             tabHover.drawSprite(63+3, 0);
  763.         else if(tabHPos == 3 && tabInterfaceIDs[14] != -1)
  764.             tabHover.drawSprite(93+3, 0);
  765.         else if(tabHPos == 4 && tabInterfaceIDs[3] != -1)
  766.             tabHover.drawSprite(123+3, 0);
  767.         else if(tabHPos == 5 && tabInterfaceIDs[4] != -1)
  768.             tabHover.drawSprite(153+3, 0);
  769.         else if(tabHPos == 6 && tabInterfaceIDs[5] != -1)
  770.             tabHover.drawSprite(183+3, 0);
  771.         else if(tabHPos == 7 && tabInterfaceIDs[6] != -1)
  772.             tabHover.drawSprite(213+3, 0);
  773.         else if(tabHPos == 15 && tabInterfaceIDs[16] != -1)
  774.             tabHover.drawSprite(3+3, 298);
  775.         else if(tabHPos == 8 && tabInterfaceIDs[9] != -1)
  776.             tabHover.drawSprite(33+3, 298);
  777.         else if(tabHPos == 9 && tabInterfaceIDs[8] != -1)
  778.             tabHover.drawSprite(63+3, 298);
  779.         else if(tabHPos == 10 && tabInterfaceIDs[7] != -1)
  780.             tabHover.drawSprite(93+3, 298);
  781.         else if(tabHPos == 11 && tabInterfaceIDs[11] != -1)
  782.             tabHover.drawSprite(123+3, 298);
  783.         else if(tabHPos == 12 && tabInterfaceIDs[12] != -1)
  784.             tabHover.drawSprite(153+3, 298);
  785.         else if(tabHPos == 13 && tabInterfaceIDs[13] != -1)
  786.             tabHover.drawSprite(183+3,298);
  787.         else if(tabHPos == 14 && tabInterfaceIDs[15] != -1)
  788.             tabHover.drawSprite(213+3, 298);
  789.     }
  790.  
  791.     public void startRunnable(Runnable runnable, int i) {
  792.         if(i > 10)
  793.             i = 10;
  794.         if(SignLink.mainapp != null) {
  795.             SignLink.startthread(runnable, i);
  796.         } else {
  797.             super.startRunnable(runnable, i);
  798.        
  799.         }
  800.     }
  801.  
  802.     public Socket openSocket(int port) throws IOException {
  803.             return new Socket(InetAddress.getByName(server), port);
  804.     }
  805.  
  806.     private boolean processMenuClick() {
  807.         if(activeInterfaceType != 0)
  808.             return false;
  809.         int j = super.clickMode3;
  810.         if(spellSelected == 1 && super.saveClickX >= 503 && super.saveClickY >= 160 && super.saveClickX <= 765 && super.saveClickY <= 205)
  811.             j = 0;
  812.         if(menuOpen) {
  813.             if(j != 1) {
  814.                 int k = super.mouseX;
  815.                 int j1 = super.mouseY;
  816.                 if(menuScreenArea == 0) {
  817.                     k -= 4;
  818.                     j1 -= 4;
  819.                 }
  820.                 if(menuScreenArea == 1) {
  821.                     k -= 516;
  822.                     j1 -= 168;
  823.                 }
  824.                 if(menuScreenArea == 2) {
  825.                     k -= 5;
  826.                     j1 -= 338;
  827.                 }
  828.                 if(menuScreenArea == 3) {
  829.                     k -= 516;
  830.                     j1 -= 0;
  831.                 }
  832.                 if(k < menuOffsetX - 10 || k > menuOffsetX + menuWidth + 10 || j1 < menuOffsetY - 10 || j1 > menuOffsetY + menuHeight + 10) {
  833.                     menuOpen = false;
  834.                     if(menuScreenArea == 1)
  835.                         needDrawTabArea = true;
  836.                     if(menuScreenArea == 2)
  837.                         inputTaken = true;
  838.                 }
  839.             }
  840.             if(j == 1) {
  841.                 int l = menuOffsetX;
  842.                 int k1 = menuOffsetY;
  843.                 int i2 = menuWidth;
  844.                 int k2 = super.saveClickX;
  845.                 int l2 = super.saveClickY;
  846.                 if(menuScreenArea == 0) {
  847.                     k2 -= 4;
  848.                     l2 -= 4;
  849.                 }
  850.                 if(menuScreenArea == 1) {
  851.                     k2 -= 516;
  852.                     l2 -= 168;
  853.                 }
  854.                 if(menuScreenArea == 2) {
  855.                     k2 -= 5;
  856.                     l2 -= 338;
  857.                 }
  858.                 if(menuScreenArea == 3) {
  859.                     k2 -= 516;
  860.                     l2 -= 0;
  861.                 }
  862.                 int i3 = -1;
  863.                 for(int j3 = 0; j3 < menuActionRow; j3++) {
  864.                     int k3 = k1 + 31 + (menuActionRow - 1 - j3) * 15;
  865.                     if(k2 > l && k2 < l + i2 && l2 > k3 - 13 && l2 < k3 + 3)
  866.                         i3 = j3;
  867.                 }
  868.                 System.out.println(i3);
  869.                 if(i3 != -1)
  870.                     doAction(i3);
  871.                 menuOpen = false;
  872.                 if(menuScreenArea == 1)
  873.                     needDrawTabArea = true;
  874.                 if(menuScreenArea == 2) {
  875.                     inputTaken = true;
  876.                 }
  877.             }
  878.             return true;
  879.         } else {
  880.             if(j == 1 && menuActionRow > 0) {
  881.                 int i1 = menuActionID[menuActionRow - 1];
  882.                 if(i1 == 632 || i1 == 78 || i1 == 867 || i1 == 431 || i1 == 53 || i1 == 74 || i1 == 454 || i1 == 539 || i1 == 493 || i1 == 847 || i1 == 447 || i1 == 1125) {
  883.                     int l1 = menuActionCmd2[menuActionRow - 1];
  884.                     int j2 = menuActionCmd3[menuActionRow - 1];
  885.                     RSInterface class9 = RSInterface.interfaceCache[j2];
  886.                     if(class9.aBoolean259 || class9.aBoolean235 || class9.allowSwapItems) { //item dragging
  887.                         aBoolean1242 = false;
  888.                         anInt989 = 0;
  889.                         anInt1084 = j2;
  890.                         anInt1085 = l1;
  891.                         activeInterfaceType = 2;
  892.                         anInt1087 = super.saveClickX;
  893.                         anInt1088 = super.saveClickY;
  894.                         if(RSInterface.interfaceCache[j2].parentID == openInterfaceID)
  895.                             activeInterfaceType = 1;
  896.                         if(RSInterface.interfaceCache[j2].parentID == backDialogID)
  897.                             activeInterfaceType = 3;
  898.                         return true;
  899.                     }
  900.                 }
  901.             }
  902.             if(j == 1 && (anInt1253 == 1 || menuHasAddFriend(menuActionRow - 1)) && menuActionRow > 2) {
  903.                 j = 2;
  904.             } else if(j == 1 && menuActionRow > 0) {
  905.                 doAction(menuActionRow - 1);
  906.             }
  907.             if(j == 2 && menuActionRow > 0) {
  908.                 determineMenuSize();
  909.             }
  910.             return false;
  911.         }
  912.        
  913.     }
  914.  
  915.     public static int totalRead = 0;
  916.  
  917.     public static String getFileNameWithoutExtension(String fileName) {
  918.         File tmpFile = new File(fileName);
  919.         tmpFile.getName();
  920.         int whereDot = tmpFile.getName().lastIndexOf('.');
  921.         if (0 < whereDot && whereDot <= tmpFile.getName().length() - 2) {
  922.             return tmpFile.getName().substring(0, whereDot);
  923.         }
  924.         return "";
  925.     }
  926.  
  927.     public void preloadModels() {
  928.         File file = new File(SignLink.findCacheDir()+"models/");
  929.         File[] fileArray = file.listFiles();
  930.         for(int y = 0; y < fileArray.length; y++) {
  931.             String s = fileArray[y].getName();
  932.             byte[] buffer = ReadFile(SignLink.findCacheDir()+"models/"+s);
  933.             Model.method460(buffer, Integer.parseInt(getFileNameWithoutExtension(s)));
  934.             drawLoadingText(loadingPercent, "Loading models ("+y+"/"+(fileArray.length - 1)+")");
  935.         }
  936.     }
  937.    
  938.     public static final byte[] ReadFile(String s) {
  939.         try {
  940.             byte abyte0[];
  941.             File file = new File(s);
  942.             int i = (int)file.length();
  943.             abyte0 = new byte[i];
  944.             DataInputStream datainputstream = new DataInputStream(new BufferedInputStream(new FileInputStream(s)));
  945.             datainputstream.readFully(abyte0, 0, i);
  946.             datainputstream.close();
  947.             return abyte0;
  948.         } catch(Exception e) {
  949.             System.out.println((new StringBuilder()).append("Read Error: ").append(s).toString());
  950.             return null;
  951.         }
  952.     }
  953.  
  954.     private void saveMidi(boolean flag, byte abyte0[]) {
  955.         SignLink.midifade = flag ? 1 : 0;
  956.         SignLink.midisave(abyte0, abyte0.length);
  957.     }
  958.        
  959.     public static void writeFile(byte[] data, String fileName) throws IOException{
  960.         OutputStream out = new FileOutputStream(fileName);
  961.         out.write(data);
  962.         out.close();
  963.     }
  964.    
  965.     public final void method22() {
  966.         try {
  967.             anInt985 = -1;
  968.             aClass19_1056.removeAll();
  969.             aClass19_1013.removeAll();
  970.             Texture.method366();
  971.             unlinkMRUNodes();
  972.             sceneGraph.initToNull();   
  973.             System.gc();
  974.             for(int i = 0; i < 4; i++)
  975.                 aClass11Array1230[i].method210();
  976.             for(int l = 0; l < 4; l++) {
  977.                 for(int k1 = 0; k1 < 104; k1++) {
  978.                     for(int j2 = 0; j2 < 104; j2++)
  979.                         byteGroundArray[l][k1][j2] = 0;
  980.                 }
  981.             }
  982.             ObjectManager objectManager = new ObjectManager(byteGroundArray, intGroundArray);
  983.             int k2 = terrainData.length;
  984.             int k18 = 64;
  985.              for(int A = 0; A < k2; A++)
  986.                 for(int B = 0; B < 2000; B++)
  987.                     if(mapCoordinates[A] == positions[B]){
  988.                         terrainIndices[A] = landScapes[B];
  989.                         anIntArray1236[A] = objects[B];
  990.                     }
  991.             stream.createFrame(0);
  992.             if(!loadGeneratedMap) {
  993.                 for(int i3 = 0; i3 < k2; i3++) {
  994.                     int i4 = (mapCoordinates[i3] >> 8) * 64 - baseX;
  995.                     int k5 = (mapCoordinates[i3] & 0xff) * 64 - baseY;
  996.                     byte abyte0[] = terrainData[i3];
  997.                     if(FileOperations.FileExists(SignLink.findCacheDir()+"maps/data/"+terrainIndices[i3]+".dat"))
  998.                     abyte0 = FileOperations.ReadFile(SignLink.findCacheDir()+"maps/data/"+terrainIndices[i3]+".dat");
  999.                     if(abyte0 != null)
  1000.                         objectManager.method180(abyte0, k5, i4, (anInt1069 - 6) * 8, (anInt1070 - 6) * 8, aClass11Array1230);
  1001.                 }
  1002.                 for(int j4 = 0; j4 < k2; j4++) {
  1003.                     int l5 = (mapCoordinates[j4] >> 8) * k18 - baseX;
  1004.                     int k7 = (mapCoordinates[j4] & 0xff) * k18 - baseY;
  1005.                     byte abyte2[] = terrainData[j4];
  1006.                     if(abyte2 == null && anInt1070 < 800)
  1007.                         objectManager.method174(k7, 64, 64, l5);
  1008.                 }
  1009.                 anInt1097++;
  1010.                 if(anInt1097 > 160) {
  1011.                     anInt1097 = 0;
  1012.                     stream.createFrame(238);
  1013.                     stream.writeWordBigEndian(96);
  1014.                 }
  1015.                 stream.createFrame(0);
  1016.                 for(int i6 = 0; i6 < k2; i6++) {
  1017.                     byte abyte1[] = aByteArrayArray1247[i6];
  1018.                     if(FileOperations.FileExists(SignLink.findCacheDir()+"maps/data/"+anIntArray1236[i6]+".dat"))
  1019.                     abyte1 = FileOperations.ReadFile(SignLink.findCacheDir()+"maps/data/"+anIntArray1236[i6]+".dat");
  1020.                     if(abyte1 != null) {
  1021.                         int l8 = (mapCoordinates[i6] >> 8) * 64 - baseX;
  1022.                         int k9 = (mapCoordinates[i6] & 0xff) * 64 - baseY;
  1023.                         objectManager.method190(l8, aClass11Array1230, k9, sceneGraph, abyte1);
  1024.                     }
  1025.                 }
  1026.             }
  1027.             if(loadGeneratedMap) {
  1028.                 for(int j3 = 0; j3 < 4; j3++) {
  1029.                     for(int k4 = 0; k4 < 13; k4++) {
  1030.                         for(int j6 = 0; j6 < 13; j6++) {
  1031.                             int l7 = anIntArrayArrayArray1129[j3][k4][j6];
  1032.                             if(l7 != -1) {
  1033.                                 int i9 = l7 >> 24 & 3;
  1034.                                 int l9 = l7 >> 1 & 3;
  1035.                                 int j10 = l7 >> 14 & 0x3ff;
  1036.                                 int l10 = l7 >> 3 & 0x7ff;
  1037.                                 int j11 = (j10 / 8 << 8) + l10 / 8;
  1038.                                 for(int l11 = 0; l11 < mapCoordinates.length; l11++)
  1039.                                 {
  1040.                                     if(mapCoordinates[l11] != j11 || terrainData[l11] == null)
  1041.                                         continue;
  1042.                                         objectManager.method179(i9, l9, aClass11Array1230, k4 * 8, (j10 & 7) * 8, terrainData[l11], (l10 & 7) * 8, j3, j6 * 8);
  1043.                                     break;
  1044.                                 }
  1045.  
  1046.                             }
  1047.                         }
  1048.  
  1049.                     }
  1050.  
  1051.                 }
  1052.                 for(int l4 = 0; l4 < 13; l4++) {
  1053.                     for(int k6 = 0; k6 < 13; k6++){
  1054.                         int i8 = anIntArrayArrayArray1129[0][l4][k6];
  1055.                         if(i8 == -1)
  1056.                             objectManager.method174(k6 * 8, 8, 8, l4 * 8);
  1057.                     }
  1058.                 }
  1059.                 stream.createFrame(0);
  1060.                 for(int l6 = 0; l6 < 4; l6++) {
  1061.                     for(int j8 = 0; j8 < 13; j8++) {
  1062.                         for(int j9 = 0; j9 < 13; j9++) {
  1063.                             int i10 = anIntArrayArrayArray1129[l6][j8][j9];
  1064.                             if(i10 != -1) {
  1065.                                 int k10 = i10 >> 24 & 3;
  1066.                                 int i11 = i10 >> 1 & 3;
  1067.                                 int k11 = i10 >> 14 & 0x3ff;
  1068.                                 int i12 = i10 >> 3 & 0x7ff;
  1069.                                 int j12 = (k11 / 8 << 8) + i12 / 8;
  1070.                                 for(int k12 = 0; k12 < mapCoordinates.length; k12++) {
  1071.                                     if(mapCoordinates[k12] != j12 || aByteArrayArray1247[k12] == null)
  1072.                                         continue;
  1073.                                     //byte abyte0[] = aByteArrayArray1247[k12];
  1074.                                     objectManager.method183(aClass11Array1230, sceneGraph, k10, j8 * 8, (i12 & 7) * 8, l6, aByteArrayArray1247[k12], (k11 & 7) * 8, i11, j9 * 8);
  1075.                                     break;
  1076.                                 }
  1077.                             }
  1078.                         }
  1079.                     }
  1080.                 }
  1081.             }
  1082.             stream.createFrame(0);
  1083.             objectManager.method171(aClass11Array1230, sceneGraph);
  1084.             mainGameArea.initDrawingArea();        
  1085.             stream.createFrame(0);
  1086.             int k3 = ObjectManager.anInt145;
  1087.             if(k3 > plane)
  1088.                 k3 = plane;
  1089.             if(k3 < plane - 1)
  1090.                 k3 = plane - 1;
  1091.             if(lowMem)
  1092.                 sceneGraph.method275(ObjectManager.anInt145);
  1093.             else
  1094.                 sceneGraph.method275(0);
  1095.             for(int i5 = 0; i5 < 104; i5++) {
  1096.                 for(int i7 = 0; i7 < 104; i7++)
  1097.                     spawnGroundItem(i5, i7);
  1098.             }
  1099.             anInt1051++;
  1100.             if(anInt1051 > 98) {
  1101.                 anInt1051 = 0;
  1102.                 stream.createFrame(150);
  1103.             }
  1104.             method63();
  1105.         } catch(Exception exception) { }
  1106.         ObjectDef.mruNodes1.unlinkAll();
  1107.         if(super.gameFrame != null) {
  1108.             stream.createFrame(210);
  1109.             stream.writeDWord(0x3f008edd);
  1110.         }
  1111.         System.gc();
  1112.         Texture.method367();
  1113.         onDemandFetcher.method566();
  1114.         int k = (anInt1069 - 6) / 8 - 1;
  1115.         int j1 = (anInt1069 + 6) / 8 + 1;
  1116.         int i2 = (anInt1070 - 6) / 8 - 1;
  1117.         int l2 = (anInt1070 + 6) / 8 + 1;
  1118.         if(aBoolean1141) {
  1119.             k = 49;
  1120.             j1 = 50;
  1121.             i2 = 49;
  1122.             l2 = 50;
  1123.         }
  1124.         //TODO what does this do?
  1125.         //causes crash when debugging with eclipse
  1126.         //when loggin in
  1127.         /*for(int l3 = k; l3 <= j1; l3++) {
  1128.             for(int j5 = i2; j5 <= l2; j5++)
  1129.                 if(l3 == k || l3 == j1 || j5 == i2 || j5 == l2) {
  1130.                     int j7 = onDemandFetcher.method562(0, j5, l3);
  1131.                     if(j7 != -1)
  1132.                         onDemandFetcher.method560(j7, 3);
  1133.                     int k8 = onDemandFetcher.method562(1, j5, l3);
  1134.                     if(k8 != -1)
  1135.                         onDemandFetcher.method560(k8, 3);
  1136.                 }
  1137.         }*/
  1138.     }
  1139.  
  1140.  
  1141.     private void unlinkMRUNodes() {
  1142.         ObjectDef.mruNodes1.unlinkAll();
  1143.         ObjectDef.mruNodes2.unlinkAll();
  1144.         NpcDef.mruNodes.unlinkAll();
  1145.         ItemDef.mruNodes2.unlinkAll();
  1146.         ItemDef.mruNodes1.unlinkAll();
  1147.         Player.mruNodes.unlinkAll();
  1148.         SpotAnim.aMRUNodes_415.unlinkAll();
  1149.     }
  1150.  
  1151.     private void method24(int i)
  1152.     {
  1153.         int ai[] = minimap.myPixels;
  1154.         int j = ai.length;
  1155.         for(int k = 0; k < j; k++)
  1156.             ai[k] = 0;
  1157.  
  1158.         for(int l = 1; l < 103; l++)
  1159.         {
  1160.             int i1 = 24628 + (103 - l) * 512 * 4;
  1161.             for(int k1 = 1; k1 < 103; k1++)
  1162.             {
  1163.        
  1164.                 if((byteGroundArray[i][k1][l] & 0x18) == 0)
  1165.                     sceneGraph.method309(ai, i1, i, k1, l);
  1166.                 if(i < 3 && (byteGroundArray[i + 1][k1][l] & 8) != 0)
  1167.                     sceneGraph.method309(ai, i1, i + 1, k1, l);
  1168.                 i1 += 4;
  1169.             }
  1170.  
  1171.         }
  1172.  
  1173.         int j1 = ((238 + (int)(Math.random() * 20D)) - 10 << 16) + ((238 + (int)(Math.random() * 20D)) - 10 << 8) + ((238 + (int)(Math.random() * 20D)) - 10);
  1174.         int l1 = (238 + (int)(Math.random() * 20D)) - 10 << 16;
  1175.         minimap.method343();
  1176.         for(int i2 = 1; i2 < 103; i2++)
  1177.         {
  1178.             for(int j2 = 1; j2 < 103; j2++)
  1179.             {
  1180.                 if((byteGroundArray[i][j2][i2] & 0x18) == 0)
  1181.                     drawMapScenes(i2, j1, j2, l1, i);
  1182.                 if(i < 3 && (byteGroundArray[i + 1][j2][i2] & 8) != 0)
  1183.                     drawMapScenes(i2, j1, j2, l1, i + 1);
  1184.             }
  1185.  
  1186.         }
  1187.  
  1188.         mainGameArea.initDrawingArea();
  1189.         anInt1071 = 0;
  1190.         for(int k2 = 0; k2 < 104; k2++)
  1191.         {
  1192.             for(int l2 = 0; l2 < 104; l2++)
  1193.             {
  1194.                 int i3 = sceneGraph.getGroundDecorationUID(plane, k2, l2);
  1195.                 if(i3 != 0)
  1196.                 {
  1197.                     i3 = i3 >> 14 & 0x7fff;
  1198.                     int j3 = ObjectDef.forID(i3).anInt746;
  1199.                     if(j3 >= 0)
  1200.                     {
  1201.                         int k3 = k2;
  1202.                         int l3 = l2;
  1203.                         if(j3 != 22 && j3 != 29 && j3 != 34 && j3 != 36 && j3 != 46 && j3 != 47 && j3 != 48)
  1204.                         {
  1205.                             byte byte0 = 104;
  1206.                             byte byte1 = 104;
  1207.                             int ai1[][] = aClass11Array1230[plane].anIntArrayArray294;
  1208.                             for(int i4 = 0; i4 < 10; i4++)
  1209.                             {
  1210.                                 int j4 = (int)(Math.random() * 4D);
  1211.                                 if(j4 == 0 && k3 > 0 && k3 > k2 - 3 && (ai1[k3 - 1][l3] & 0x1280108) == 0)
  1212.                                     k3--;
  1213.                                 if(j4 == 1 && k3 < byte0 - 1 && k3 < k2 + 3 && (ai1[k3 + 1][l3] & 0x1280180) == 0)
  1214.                                     k3++;
  1215.                                 if(j4 == 2 && l3 > 0 && l3 > l2 - 3 && (ai1[k3][l3 - 1] & 0x1280102) == 0)
  1216.                                     l3--;
  1217.                                 if(j4 == 3 && l3 < byte1 - 1 && l3 < l2 + 3 && (ai1[k3][l3 + 1] & 0x1280120) == 0)
  1218.                                     l3++;
  1219.                             }
  1220.  
  1221.                         }
  1222.                         aSpriteArray1140[anInt1071] = mapFunctions[j3];
  1223.                         anIntArray1072[anInt1071] = k3;
  1224.                         anIntArray1073[anInt1071] = l3;
  1225.                         anInt1071++;
  1226.                     }
  1227.                 }
  1228.             }
  1229.  
  1230.         }
  1231.  
  1232.     }
  1233.  
  1234.     private void spawnGroundItem(int x, int y) {
  1235.         NodeList class19 = groundArray[plane][x][y];
  1236.         if(class19 == null) {
  1237.             sceneGraph.method295(plane, x, y);
  1238.             return;
  1239.         }
  1240.         int k = 0xfa0a1f01;
  1241.         Object obj = null;
  1242.         for(Item item = (Item)class19.reverseGetFirst(); item != null; item = (Item)class19.reverseGetNext()) {
  1243.             ItemDef itemDef = ItemDef.forID(item.ID);
  1244.             int l = itemDef.value;
  1245.             if(itemDef.stackable)
  1246.                 l *= item.anInt1559 + 1;
  1247.         //  notifyItemSpawn(item, i + baseX, j + baseY);
  1248.             if(l > k)
  1249.             {
  1250.                 k = l;
  1251.                 obj = item;
  1252.             }
  1253.         }
  1254.         class19.insertTail(((Node) (obj)));
  1255.         Object obj1 = null;
  1256.         Object obj2 = null;
  1257.         for(Item item = (Item)class19.reverseGetFirst(); item != null; item = (Item)class19.reverseGetNext()) {
  1258.             if(item.ID != ((Item) (obj)).ID && obj1 == null)
  1259.                 obj1 = item;
  1260.             if(item.ID != ((Item) (obj)).ID && item.ID != ((Item) (obj1)).ID && obj2 == null)
  1261.                 obj2 = item;
  1262.         }
  1263.         int uid = x + (y << 7) + 0x60000000;
  1264.         sceneGraph.addGroundItemTile(x, uid, ((Entity) (obj1)), method42(plane, y * 128 + 64, x * 128 + 64), ((Entity) (obj2)), ((Entity) (obj)), plane, y);
  1265.     }
  1266.  
  1267.     private void method26(boolean flag) {
  1268.         for(int j = 0; j < npcCount; j++) {
  1269.             Npc npc = npcArray[npcIndices[j]];
  1270.             int k = 0x20000000 + (npcIndices[j] << 14);
  1271.             if(npc == null || !npc.isVisible() || npc.desc.aBoolean93 != flag)
  1272.                 continue;
  1273.             int l = npc.x >> 7;
  1274.             int i1 = npc.y >> 7;
  1275.             if(l < 0 || l >= 104 || i1 < 0 || i1 >= 104)
  1276.                 continue;
  1277.             if(npc.anInt1540 == 1 && (npc.x & 0x7f) == 64 && (npc.y & 0x7f) == 64)
  1278.             {
  1279.                 if(anIntArrayArray929[l][i1] == anInt1265)
  1280.                     continue;
  1281.                 anIntArrayArray929[l][i1] = anInt1265;
  1282.             }
  1283.             if(!npc.desc.canRightClick)
  1284.                 k += 0x80000000;
  1285.             sceneGraph.addEntityA(plane, npc.anInt1552, method42(plane, npc.y, npc.x), k, npc.y, (npc.anInt1540 - 1) * 64 + 60, npc.x, npc, npc.aBoolean1541);
  1286.         }
  1287.     }
  1288.  
  1289.     private boolean replayWave()
  1290.     {
  1291.             return SignLink.wavereplay();
  1292.     }
  1293.  
  1294.     public void drawHoverBox(int xPos, int yPos, String text) {
  1295.         String[] results = text.split("\n");
  1296.         int height = (results.length * 16) + 3;
  1297.         int width;
  1298.         width = regularFont.getTextWidth(results[0]) + 6;
  1299.         for(int i = 1; i < results.length; i++)
  1300.             if(width <= regularFont.getTextWidth(results[i]) + 6)
  1301.                 width = regularFont.getTextWidth(results[i]) + 6;
  1302.         DrawingArea.fillRect(xPos, yPos, width, height, 0xFFFFA0);
  1303.         DrawingArea.drawRect(xPos, yPos, width, height, 0);
  1304.         yPos += 14;
  1305.         for(int i = 0; i < results.length; i++) {
  1306.             regularFont.drawString(false, xPos + 3, 0, results[i], yPos);
  1307.             yPos += 16;
  1308.         }
  1309.     }
  1310.  
  1311.     public void drawPixelBox(int xPos, int yPos, int width, int height, int color, boolean filled) {
  1312.         if(filled) {
  1313.             int i = 0;
  1314.             DrawingArea.fillRect(xPos, yPos, width, height, color); i++;
  1315.             DrawingArea.fillRect(xPos+i, yPos+i, width-i, height-i, color); i++;
  1316.             DrawingArea.fillRect(xPos+i, yPos+i, width-i, height-i, color); i++;
  1317.             DrawingArea.fillRect(xPos+i, yPos+i, width-i, height-i, color); i++;
  1318.             DrawingArea.fillRect(xPos+i, yPos+i, width-i, height-i, color); i++;
  1319.             DrawingArea.fillRect(xPos+i, yPos+i, width-i, height-i, color); i++;
  1320.         } else
  1321.             DrawingArea.drawRect(xPos, yPos, width, height, color);
  1322.     }
  1323.     public void drawBorderPixelBox(int xPos, int yPos, int width, int height, int borderColor, int color, boolean filled) {
  1324.         DrawingArea.drawRect(xPos+1, yPos+1, width-1, height-1, color);
  1325.         DrawingArea.fillRect(xPos, yPos, width, height, borderColor);
  1326.     }
  1327.    
  1328.     public void drawBlackBox(int xPos, int yPos) {
  1329.         DrawingArea.fillRect(xPos - 2, yPos - 1, 1, 71, 0x726451);
  1330.         DrawingArea.fillRect(xPos + 174, yPos, 1, 69, 0x726451);
  1331.         DrawingArea.fillRect(xPos - 2, yPos - 2, 178, 1, 0x726451);
  1332.         DrawingArea.fillRect(xPos, yPos + 68, 174, 1, 0x726451);
  1333.         DrawingArea.fillRect(xPos - 1, yPos - 1, 1, 71, 0x2E2B23);
  1334.         DrawingArea.fillRect(xPos + 175, yPos - 1, 1, 71, 0x2E2B23);
  1335.         DrawingArea.fillRect(xPos, yPos - 1, 175, 1, 0x2E2B23);
  1336.         DrawingArea.fillRect(xPos, yPos + 69, 175, 1, 0x2E2B23);
  1337.         DrawingArea.fillRect(xPos, yPos, 174, 68, 0, 220);
  1338.     }
  1339.    
  1340.     private void buildInterfaceMenu(int i, RSInterface rsInterface, int k, int l, int i1, int j1)
  1341.     {
  1342.         if(rsInterface.interfaceType != 0 || rsInterface.children == null || rsInterface.interfaceShown)
  1343.             return;
  1344.         if(k < i || i1 < l || k > i + rsInterface.width || i1 > l + rsInterface.height)
  1345.             return;
  1346.         int k1 = rsInterface.children.length;
  1347.         for(int l1 = 0; l1 < k1; l1++)
  1348.         {
  1349.             int i2 = rsInterface.childX[l1] + i;
  1350.             int j2 = (rsInterface.childY[l1] + l) - j1;
  1351.             RSInterface class9_1 = RSInterface.interfaceCache[rsInterface.children[l1]];
  1352.             i2 += class9_1.xOffset;
  1353.             j2 += class9_1.yOffset;
  1354.             if((class9_1.hoverType >= 0 || class9_1.disabledHoverColor != 0) && k >= i2 && i1 >= j2 && k < i2 + class9_1.width && i1 < j2 + class9_1.height)
  1355.                 if(class9_1.hoverType >= 0)
  1356.                     anInt886 = class9_1.hoverType;
  1357.                 else
  1358.                     anInt886 = class9_1.id;
  1359.             if(class9_1.interfaceType == 8 && k >= i2 && i1 >= j2 && k < i2 + class9_1.width && i1 < j2 + class9_1.height) {
  1360.                 anInt1315 = class9_1.id;
  1361.             }
  1362.             if(class9_1.interfaceType == 0) {
  1363.                 buildInterfaceMenu(i2, class9_1, k, j2, i1, class9_1.scrollPosition);
  1364.                 if(class9_1.scrollMax > class9_1.height)
  1365.                     method65(i2 + class9_1.width, class9_1.height, k, i1, class9_1, j2, true, class9_1.scrollMax);
  1366.             } else {
  1367.                 if(class9_1.atActionType == 1 && k >= i2 && i1 >= j2 && k < i2 + class9_1.width && i1 < j2 + class9_1.height) {
  1368.                     boolean flag = false;
  1369.                     if(class9_1.contentType != 0)
  1370.                         flag = buildFriendsListMenu(class9_1);
  1371.                     if(!flag) {
  1372.                         //System.out.println("1"+class9_1.tooltip + ", " + class9_1.interfaceID);
  1373.                         if(idToggle) {
  1374.                             menuActionName[menuActionRow] = class9_1.tooltip + " @gre@(@whi@" + class9_1.id + "@gre@)";
  1375.                             menuActionID[menuActionRow] = 315;
  1376.                             menuActionCmd3[menuActionRow] = class9_1.id;
  1377.                             menuActionRow++;
  1378.                         } else {
  1379.                             menuActionName[menuActionRow] = class9_1.tooltip;
  1380.                             menuActionID[menuActionRow] = 315;
  1381.                             menuActionCmd3[menuActionRow] = class9_1.id;
  1382.                             menuActionRow++;
  1383.                         }
  1384.                     }
  1385.                 }
  1386.                 if(class9_1.atActionType == 2 && spellSelected == 0 && k >= i2 && i1 >= j2 && k < i2 + class9_1.width && i1 < j2 + class9_1.height) {
  1387.                     String s = class9_1.selectedActionName;
  1388.                     if(s.indexOf(" ") != -1)
  1389.                         s = s.substring(0, s.indexOf(" "));
  1390.                     menuActionName[menuActionRow] = "Autocast" + "@gre@ " + class9_1.spellName;
  1391.                     menuActionID[menuActionRow] = 104;// autocast
  1392.                     menuActionCmd3[menuActionRow] = class9_1.id;
  1393.                     menuActionRow++;
  1394.                     menuActionName[menuActionRow] = s + " @gre@" + class9_1.spellName;
  1395.                     menuActionID[menuActionRow] = 626;
  1396.                     menuActionCmd3[menuActionRow] = class9_1.id;
  1397.                     menuActionRow++;
  1398.                 }
  1399.                 if(class9_1.atActionType == 3 && k >= i2 && i1 >= j2 && k < i2 + class9_1.width && i1 < j2 + class9_1.height) {
  1400.                     menuActionName[menuActionRow] = "Close";
  1401.                     menuActionID[menuActionRow] = 200;
  1402.                     menuActionCmd3[menuActionRow] = class9_1.id;
  1403.                     menuActionRow++;
  1404.                 }
  1405.                 if(class9_1.atActionType == 4 && k >= i2 && i1 >= j2 && k < i2 + class9_1.width && i1 < j2 + class9_1.height) {
  1406.                     //System.out.println("2"+class9_1.tooltip + ", " + class9_1.interfaceID);
  1407.                     if(idToggle) {
  1408.                     menuActionName[menuActionRow] = class9_1.tooltip + " @gre@(@whi@" + class9_1.id + "@gre@)";
  1409.                     menuActionID[menuActionRow] = 169;
  1410.                     menuActionCmd3[menuActionRow] = class9_1.id;
  1411.                     menuActionRow++;
  1412.                     } else {
  1413.                     menuActionName[menuActionRow] = class9_1.tooltip;
  1414.                     menuActionID[menuActionRow] = 169;
  1415.                     menuActionCmd3[menuActionRow] = class9_1.id;
  1416.                     menuActionRow++;
  1417.                     }
  1418.                     if(class9_1.hoverText != null) {
  1419.                         //drawHoverBox(k, l, class9_1.hoverText);
  1420.                         //System.out.println("DRAWING INTERFACE: " + class9_1.hoverText);
  1421.                     }
  1422.                 }
  1423.                 if(class9_1.atActionType == 5 && k >= i2 && i1 >= j2 && k < i2 + class9_1.width && i1 < j2 + class9_1.height)
  1424.                 {
  1425.                     //System.out.println("3"+class9_1.tooltip + ", " + class9_1.interfaceID);
  1426.                     if(idToggle) {
  1427.                     menuActionName[menuActionRow] = class9_1.tooltip + " @gre@(@whi@" + class9_1.id + "@gre@)";
  1428.                     menuActionID[menuActionRow] = 646;
  1429.                     menuActionCmd3[menuActionRow] = class9_1.id;
  1430.                     menuActionRow++;
  1431.                     } else {
  1432.                     menuActionName[menuActionRow] = class9_1.tooltip;
  1433.                     menuActionID[menuActionRow] = 646;
  1434.                     menuActionCmd3[menuActionRow] = class9_1.id;
  1435.                     menuActionRow++;
  1436.                     }
  1437.                 }
  1438.                 if(class9_1.atActionType == 6 && !aBoolean1149 && k >= i2 && i1 >= j2 && k < i2 + class9_1.width && i1 < j2 + class9_1.height)
  1439.                 {
  1440.                     //System.out.println("4"+class9_1.tooltip + ", " + class9_1.interfaceID);
  1441.                     if(idToggle) {
  1442.                     menuActionName[menuActionRow] = class9_1.tooltip + " @gre@(@whi@" + class9_1.id + "@gre@)";
  1443.                     menuActionID[menuActionRow] = 679;
  1444.                     menuActionCmd3[menuActionRow] = class9_1.id;
  1445.                     menuActionRow++;
  1446.                     } else {
  1447.                     menuActionName[menuActionRow] = class9_1.tooltip;
  1448.                     menuActionID[menuActionRow] = 679;
  1449.                     menuActionCmd3[menuActionRow] = class9_1.id;
  1450.                     menuActionRow++;
  1451.                     }
  1452.                 }
  1453.                 if(class9_1.interfaceType == 2)
  1454.                 {
  1455.                     int k2 = 0;
  1456.                     for(int l2 = 0; l2 < class9_1.height; l2++)
  1457.                     {
  1458.                         for(int i3 = 0; i3 < class9_1.width; i3++)
  1459.                         {
  1460.                             int j3 = i2 + i3 * (32 + class9_1.invSpritePadX);
  1461.                             int k3 = j2 + l2 * (32 + class9_1.invSpritePadY);
  1462.                             if(k2 < 20)
  1463.                             {
  1464.                                 j3 += class9_1.spritesX[k2];
  1465.                                 k3 += class9_1.spritesY[k2];
  1466.                             }
  1467.                             if(k >= j3 && i1 >= k3 && k < j3 + 32 && i1 < k3 + 32)
  1468.                             {
  1469.                                 mouseInvInterfaceIndex = k2;
  1470.                                 lastActiveInvInterface = class9_1.id;
  1471.                                 if(class9_1.inventory[k2] > 0)
  1472.                                 {
  1473.                                     ItemDef itemDef = ItemDef.forID(class9_1.inventory[k2] - 1);
  1474.                                     if(itemSelected == 1 && class9_1.isInventoryInterface)
  1475.                                     {
  1476.                                         if(class9_1.id != anInt1284 || k2 != anInt1283)
  1477.                                         {
  1478.                                             menuActionName[menuActionRow] = "Use " + selectedItemName + " -> @lre@" + itemDef.name;
  1479.                                             menuActionID[menuActionRow] = 870;
  1480.                                             menuActionCmd1[menuActionRow] = itemDef.id;
  1481.                                             menuActionCmd2[menuActionRow] = k2;
  1482.                                             menuActionCmd3[menuActionRow] = class9_1.id;
  1483.                                             menuActionRow++;
  1484.                                         }
  1485.                                     } else
  1486.                                     if(spellSelected == 1 && class9_1.isInventoryInterface)
  1487.                                     {
  1488.                                         if((spellUsableOn & 0x10) == 16)
  1489.                                         {
  1490.                                             menuActionName[menuActionRow] = spellTooltip + " @lre@" + itemDef.name;
  1491.                                             menuActionID[menuActionRow] = 543;
  1492.                                             menuActionCmd1[menuActionRow] = itemDef.id;
  1493.                                             menuActionCmd2[menuActionRow] = k2;
  1494.                                             menuActionCmd3[menuActionRow] = class9_1.id;
  1495.                                             menuActionRow++;
  1496.                                         }
  1497.                                     } else
  1498.                                     {
  1499.                                         if(class9_1.isInventoryInterface)
  1500.                                         {
  1501.                                             for(int l3 = 4; l3 >= 3; l3--)
  1502.                                                 if(itemDef.inventoryActions != null && itemDef.inventoryActions[l3] != null)
  1503.                                                 {
  1504.                                                     menuActionName[menuActionRow] = itemDef.inventoryActions[l3] + " @lre@" + itemDef.name;
  1505.                                                     if(l3 == 3)
  1506.                                                         menuActionID[menuActionRow] = 493;
  1507.                                                     if(l3 == 4)
  1508.                                                         menuActionID[menuActionRow] = 847;
  1509.                                                     menuActionCmd1[menuActionRow] = itemDef.id;
  1510.                                                     menuActionCmd2[menuActionRow] = k2;
  1511.                                                     menuActionCmd3[menuActionRow] = class9_1.id;
  1512.                                                     menuActionRow++;
  1513.                                                 } else
  1514.                                                 if(l3 == 4)
  1515.                                                 {
  1516.                                                     menuActionName[menuActionRow] = "Drop @lre@" + itemDef.name;
  1517.                                                     menuActionID[menuActionRow] = 847;
  1518.                                                     menuActionCmd1[menuActionRow] = itemDef.id;
  1519.                                                     menuActionCmd2[menuActionRow] = k2;
  1520.                                                     menuActionCmd3[menuActionRow] = class9_1.id;
  1521.                                                     menuActionRow++;
  1522.                                                 }
  1523.  
  1524.                                         }
  1525.                                         if(class9_1.usableItemInterface)
  1526.                                         {
  1527.                                             menuActionName[menuActionRow] = "Use @lre@" + itemDef.name;
  1528.                                             menuActionID[menuActionRow] = 447;
  1529.                                             menuActionCmd1[menuActionRow] = itemDef.id;
  1530.                                             //k2 = inventory spot
  1531.                                             //System.out.println(k2);
  1532.                                             menuActionCmd2[menuActionRow] = k2;
  1533.                                             menuActionCmd3[menuActionRow] = class9_1.id;
  1534.                                             menuActionRow++;
  1535.                                         }
  1536.                                         if(class9_1.isInventoryInterface && itemDef.inventoryActions != null)
  1537.                                         {
  1538.                                             for(int i4 = 2; i4 >= 0; i4--)
  1539.                                                 if(itemDef.inventoryActions[i4] != null)
  1540.                                                 {
  1541.                                                     menuActionName[menuActionRow] = itemDef.inventoryActions[i4] + " @lre@" + itemDef.name;
  1542.                                                     if(i4 == 0)
  1543.                                                         menuActionID[menuActionRow] = 74;
  1544.                                                     if(i4 == 1)
  1545.                                                         menuActionID[menuActionRow] = 454;
  1546.                                                     if(i4 == 2)
  1547.                                                         menuActionID[menuActionRow] = 539;
  1548.                                                     menuActionCmd1[menuActionRow] = itemDef.id;
  1549.                                                     menuActionCmd2[menuActionRow] = k2;
  1550.                                                     menuActionCmd3[menuActionRow] = class9_1.id;
  1551.                                                     menuActionRow++;
  1552.                                                 }
  1553.  
  1554.                                         }
  1555.                                         if(class9_1.itemActions != null)
  1556.                                         {
  1557.                                             for(int j4 = 4; j4 >= 0; j4--)
  1558.                                                 if(class9_1.itemActions[j4] != null)
  1559.                                                 {
  1560.                                                     menuActionName[menuActionRow] = class9_1.itemActions[j4] + " @lre@" + itemDef.name;
  1561.                                                     if(j4 == 0)
  1562.                                                         menuActionID[menuActionRow] = 632;
  1563.                                                     if(j4 == 1)
  1564.                                                         menuActionID[menuActionRow] = 78;
  1565.                                                     if(j4 == 2)
  1566.                                                         menuActionID[menuActionRow] = 867;
  1567.                                                     if(j4 == 3)
  1568.                                                         menuActionID[menuActionRow] = 431;
  1569.                                                     if(j4 == 4)
  1570.                                                         menuActionID[menuActionRow] = 53;
  1571.                                                     menuActionCmd1[menuActionRow] = itemDef.id;
  1572.                                                     menuActionCmd2[menuActionRow] = k2;
  1573.                                                     menuActionCmd3[menuActionRow] = class9_1.id;
  1574.                                                     menuActionRow++;
  1575.                                                 }
  1576.  
  1577.                                         }
  1578.                                         if(idToggle) {
  1579.                                             menuActionName[menuActionRow] = "Examine @lre@" + itemDef.name + " @gre@(@whi@" + (class9_1.inventory[k2] - 1) + "@gre@)@whi@ " + ItemDef.itemModels(itemDef.id);
  1580.                                         } else {
  1581.                                             menuActionName[menuActionRow] = "Examine @lre@" + itemDef.name;
  1582.                                         }
  1583.                                         menuActionID[menuActionRow] = 1125;
  1584.                                         menuActionCmd1[menuActionRow] = itemDef.id;
  1585.                                         menuActionCmd2[menuActionRow] = k2;
  1586.                                         menuActionCmd3[menuActionRow] = class9_1.id;
  1587.                                         menuActionRow++;
  1588.                                     }
  1589.                                 }
  1590.                             }
  1591.                             k2++;
  1592.                         }
  1593.  
  1594.                     }
  1595.  
  1596.                 }
  1597.             }
  1598.         }
  1599.  
  1600.     }
  1601.  
  1602.     public void drawScrollbar(int x, int y, int height, int scrollPos, int scrollMax) {
  1603.         if(!fullScreenOn) {
  1604.             scrollBar1.drawSprite(x, y);
  1605.             scrollBar2.drawSprite(x, (y + height) - 16);
  1606.             DrawingArea.fillRect(x, y + 16, 16, height - 32, 0x000001);
  1607.             DrawingArea.fillRect(x, y + 16, 15, height - 32, 0x3d3426);
  1608.             DrawingArea.fillRect(x, y + 16, 13, height - 32, 0x342d21);
  1609.             DrawingArea.fillRect(x, y + 16, 11, height - 32, 0x2e281d);
  1610.             DrawingArea.fillRect(x, y + 16, 10, height - 32, 0x29241b);
  1611.             DrawingArea.fillRect(x, y + 16, 9, height - 32, 0x252019);
  1612.             DrawingArea.fillRect(x, y + 16, 1, height - 32, 0x000001);
  1613.             int k1 = ((height - 32) * height) / scrollMax;
  1614.             if(k1 < 8)
  1615.                 k1 = 8;
  1616.             int l1 = ((height - 32 - k1) * scrollPos) / (scrollMax - height);
  1617.             DrawingArea.fillRect(x, y + 16 + l1, 16, k1, barFillColor);
  1618.             DrawingArea.drawVerticalLine(x, y + 16 + l1, k1, 0x000001);
  1619.             DrawingArea.drawVerticalLine(x + 1, y + 16 + l1, k1, 0x817051);
  1620.             DrawingArea.drawVerticalLine(x + 2, y + 16 + l1, k1, 0x73654a);
  1621.             DrawingArea.drawVerticalLine(x + 3, y + 16 + l1, k1, 0x6a5c43);
  1622.             DrawingArea.drawVerticalLine(x + 4, y + 16 + l1, k1, 0x6a5c43);
  1623.             DrawingArea.drawVerticalLine(x + 5, y + 16 + l1, k1, 0x655841);
  1624.             DrawingArea.drawVerticalLine(x + 6, y + 16 + l1, k1, 0x655841);
  1625.             DrawingArea.drawVerticalLine(x + 7, y + 16 + l1, k1, 0x61553e);
  1626.             DrawingArea.drawVerticalLine(x + 8, y + 16 + l1, k1, 0x61553e);
  1627.             DrawingArea.drawVerticalLine(x + 9, y + 16 + l1, k1, 0x5d513c);
  1628.             DrawingArea.drawVerticalLine(x + 10, y + 16 + l1, k1, 0x5d513c);
  1629.             DrawingArea.drawVerticalLine(x + 11, y + 16 + l1, k1, 0x594e3a);
  1630.             DrawingArea.drawVerticalLine(x + 12, y + 16 + l1, k1, 0x594e3a);
  1631.             DrawingArea.drawVerticalLine(x + 13, y + 16 + l1, k1, 0x514635);
  1632.             DrawingArea.drawVerticalLine(x + 14, y + 16 + l1, k1, 0x4b4131);
  1633.             DrawingArea.drawHorizontalLine(x, y + 16 + l1, 15, 0x000001);
  1634.             DrawingArea.drawHorizontalLine(x, y + 17 + l1, 15, 0x000001);
  1635.             DrawingArea.drawHorizontalLine(x, y + 17 + l1, 14, 0x655841);
  1636.             DrawingArea.drawHorizontalLine(x, y + 17 + l1, 13, 0x6a5c43);
  1637.             DrawingArea.drawHorizontalLine(x, y + 17 + l1, 11, 0x6d5f48);
  1638.             DrawingArea.drawHorizontalLine(x, y + 17 + l1, 10, 0x73654a);
  1639.             DrawingArea.drawHorizontalLine(x, y + 17 + l1, 7, 0x76684b);
  1640.             DrawingArea.drawHorizontalLine(x, y + 17 + l1, 5, 0x7b6a4d);
  1641.             DrawingArea.drawHorizontalLine(x, y + 17 + l1, 4, 0x7e6e50);
  1642.             DrawingArea.drawHorizontalLine(x, y + 17 + l1, 3, 0x817051);
  1643.             DrawingArea.drawHorizontalLine(x, y + 17 + l1, 2, 0x000001);
  1644.             DrawingArea.drawHorizontalLine(x, y + 18 + l1, 16, 0x000001);
  1645.             DrawingArea.drawHorizontalLine(x, y + 18 + l1, 15, 0x564b38);
  1646.             DrawingArea.drawHorizontalLine(x, y + 18 + l1, 14, 0x5d513c);
  1647.             DrawingArea.drawHorizontalLine(x, y + 18 + l1, 11, 0x625640);
  1648.             DrawingArea.drawHorizontalLine(x, y + 18 + l1, 10, 0x655841);
  1649.             DrawingArea.drawHorizontalLine(x, y + 18 + l1, 7, 0x6a5c43);
  1650.             DrawingArea.drawHorizontalLine(x, y + 18 + l1, 5, 0x6e6046);
  1651.             DrawingArea.drawHorizontalLine(x, y + 18 + l1, 4, 0x716247);
  1652.             DrawingArea.drawHorizontalLine(x, y + 18 + l1, 3, 0x7b6a4d);
  1653.             DrawingArea.drawHorizontalLine(x, y + 18 + l1, 2, 0x817051);
  1654.             DrawingArea.drawHorizontalLine(x, y + 18 + l1, 1, 0x000001);
  1655.             DrawingArea.drawHorizontalLine(x, y + 19 + l1, 16, 0x000001);
  1656.             DrawingArea.drawHorizontalLine(x, y + 19 + l1, 15, 0x514635);
  1657.             DrawingArea.drawHorizontalLine(x, y + 19 + l1, 14, 0x564b38);
  1658.             DrawingArea.drawHorizontalLine(x, y + 19 + l1, 11, 0x5d513c);
  1659.             DrawingArea.drawHorizontalLine(x, y + 19 + l1, 9, 0x61553e);
  1660.             DrawingArea.drawHorizontalLine(x, y + 19 + l1, 7, 0x655841);
  1661.             DrawingArea.drawHorizontalLine(x, y + 19 + l1, 5, 0x6a5c43);
  1662.             DrawingArea.drawHorizontalLine(x, y + 19 + l1, 4, 0x6e6046);
  1663.             DrawingArea.drawHorizontalLine(x, y + 19 + l1, 3, 0x73654a);
  1664.             DrawingArea.drawHorizontalLine(x, y + 19 + l1, 2, 0x817051);
  1665.             DrawingArea.drawHorizontalLine(x, y + 19 + l1, 1, 0x000001);
  1666.             DrawingArea.drawHorizontalLine(x, y + 20 + l1, 16, 0x000001);
  1667.             DrawingArea.drawHorizontalLine(x, y + 20 + l1, 15, 0x4b4131);
  1668.             DrawingArea.drawHorizontalLine(x, y + 20 + l1, 14, 0x544936);
  1669.             DrawingArea.drawHorizontalLine(x, y + 20 + l1, 13, 0x594e3a);
  1670.             DrawingArea.drawHorizontalLine(x, y + 20 + l1, 10, 0x5d513c);
  1671.             DrawingArea.drawHorizontalLine(x, y + 20 + l1, 8, 0x61553e);
  1672.             DrawingArea.drawHorizontalLine(x, y + 20 + l1, 6, 0x655841);
  1673.             DrawingArea.drawHorizontalLine(x, y + 20 + l1, 4, 0x6a5c43);
  1674.             DrawingArea.drawHorizontalLine(x, y + 20 + l1, 3, 0x73654a);
  1675.             DrawingArea.drawHorizontalLine(x, y + 20 + l1, 2, 0x817051);
  1676.             DrawingArea.drawHorizontalLine(x, y + 20 + l1, 1, 0x000001);
  1677.             DrawingArea.drawVerticalLine(x + 15, y + 16 + l1, k1, 0x000001);
  1678.             DrawingArea.drawHorizontalLine(x, y + 15 + l1 + k1, 16, 0x000001);
  1679.             DrawingArea.drawHorizontalLine(x, y + 14 + l1 + k1, 15, 0x000001);
  1680.             DrawingArea.drawHorizontalLine(x, y + 14 + l1 + k1, 14, 0x3f372a);
  1681.             DrawingArea.drawHorizontalLine(x, y + 14 + l1 + k1, 10, 0x443c2d);
  1682.             DrawingArea.drawHorizontalLine(x, y + 14 + l1 + k1, 9, 0x483e2f);
  1683.             DrawingArea.drawHorizontalLine(x, y + 14 + l1 + k1, 7, 0x4a402f);
  1684.             DrawingArea.drawHorizontalLine(x, y + 14 + l1 + k1, 4, 0x4b4131);
  1685.             DrawingArea.drawHorizontalLine(x, y + 14 + l1 + k1, 3, 0x564b38);
  1686.             DrawingArea.drawHorizontalLine(x, y + 14 + l1 + k1, 2, 0x000001);
  1687.             DrawingArea.drawHorizontalLine(x, y + 13 + l1 + k1, 16, 0x000001);
  1688.             DrawingArea.drawHorizontalLine(x, y + 13 + l1 + k1, 15, 0x443c2d);
  1689.             DrawingArea.drawHorizontalLine(x, y + 13 + l1 + k1, 11, 0x4b4131);
  1690.             DrawingArea.drawHorizontalLine(x, y + 13 + l1 + k1, 9, 0x514635);
  1691.             DrawingArea.drawHorizontalLine(x, y + 13 + l1 + k1, 7, 0x544936);
  1692.             DrawingArea.drawHorizontalLine(x, y + 13 + l1 + k1, 6, 0x564b38);
  1693.             DrawingArea.drawHorizontalLine(x, y + 13 + l1 + k1, 4, 0x594e3a);
  1694.             DrawingArea.drawHorizontalLine(x, y + 13 + l1 + k1, 3, 0x625640);
  1695.             DrawingArea.drawHorizontalLine(x, y + 13 + l1 + k1, 2, 0x6a5c43);
  1696.             DrawingArea.drawHorizontalLine(x, y + 13 + l1 + k1, 1, 0x000001);
  1697.             DrawingArea.drawHorizontalLine(x, y + 12 + l1 + k1, 16, 0x000001);
  1698.             DrawingArea.drawHorizontalLine(x, y + 12 + l1 + k1, 15, 0x443c2d);
  1699.             DrawingArea.drawHorizontalLine(x, y + 12 + l1 + k1, 14, 0x4b4131);
  1700.             DrawingArea.drawHorizontalLine(x, y + 12 + l1 + k1, 12, 0x544936);
  1701.             DrawingArea.drawHorizontalLine(x, y + 12 + l1 + k1, 11, 0x564b38);
  1702.             DrawingArea.drawHorizontalLine(x, y + 12 + l1 + k1, 10, 0x594e3a);
  1703.             DrawingArea.drawHorizontalLine(x, y + 12 + l1 + k1, 7, 0x5d513c);
  1704.             DrawingArea.drawHorizontalLine(x, y + 12 + l1 + k1, 4, 0x61553e);
  1705.             DrawingArea.drawHorizontalLine(x, y + 12 + l1 + k1, 3, 0x6e6046);
  1706.             DrawingArea.drawHorizontalLine(x, y + 12 + l1 + k1, 2, 0x7b6a4d);
  1707.             DrawingArea.drawHorizontalLine(x, y + 12 + l1 + k1, 1, 0x000001);
  1708.             DrawingArea.drawHorizontalLine(x, y + 11 + l1 + k1, 16, 0x000001);
  1709.             DrawingArea.drawHorizontalLine(x, y + 11 + l1 + k1, 15, 0x4b4131);
  1710.             DrawingArea.drawHorizontalLine(x, y + 11 + l1 + k1, 14, 0x514635);
  1711.             DrawingArea.drawHorizontalLine(x, y + 11 + l1 + k1, 13, 0x564b38);
  1712.             DrawingArea.drawHorizontalLine(x, y + 11 + l1 + k1, 11, 0x594e3a);
  1713.             DrawingArea.drawHorizontalLine(x, y + 11 + l1 + k1, 9, 0x5d513c);
  1714.             DrawingArea.drawHorizontalLine(x, y + 11 + l1 + k1, 7, 0x61553e);
  1715.             DrawingArea.drawHorizontalLine(x, y + 11 + l1 + k1, 5, 0x655841);
  1716.             DrawingArea.drawHorizontalLine(x, y + 11 + l1 + k1, 4, 0x6a5c43);
  1717.             DrawingArea.drawHorizontalLine(x, y + 11 + l1 + k1, 3, 0x73654a);
  1718.             DrawingArea.drawHorizontalLine(x, y + 11 + l1 + k1, 2, 0x7b6a4d);
  1719.             DrawingArea.drawHorizontalLine(x, y + 11 + l1 + k1, 1, 0x000001);
  1720.         }
  1721.     }
  1722.  
  1723.  
  1724.  
  1725.     private void updateNPCs(Stream stream, int i)
  1726.     {
  1727.         anInt839 = 0;
  1728.         anInt893 = 0;
  1729.         method139(stream);
  1730.         method46(i, stream);
  1731.         method86(stream);
  1732.         for(int k = 0; k < anInt839; k++)
  1733.         {
  1734.             int l = anIntArray840[k];
  1735.             if(npcArray[l].anInt1537 != loopCycle)
  1736.             {
  1737.                 npcArray[l].desc = null;
  1738.                 npcArray[l] = null;
  1739.             }
  1740.         }
  1741.         if(stream.currentOffset != i)
  1742.         {
  1743.             SignLink.reporterror(myUsername + " size mismatch in getnpcpos - pos:" + stream.currentOffset + " psize:" + i);
  1744.             throw new RuntimeException("eek");
  1745.         }
  1746.         for(int i1 = 0; i1 < npcCount; i1++)
  1747.             if(npcArray[npcIndices[i1]] == null)
  1748.             {
  1749.                 SignLink.reporterror(myUsername + " null entry in npc list - pos:" + i1 + " size:" + npcCount);
  1750.                 throw new RuntimeException("eek");
  1751.             }
  1752.     }
  1753.  
  1754.     private int cButtonHPos;
  1755.     private int cButtonCPos;
  1756.  
  1757.     private void processChatModeClick() {
  1758.         if(!fullScreenOn) {
  1759.             if(super.mouseX >= 5 && super.mouseX <= 61 && super.mouseY >= 482 && super.mouseY <= 503) {
  1760.                 cButtonHPos = 0;
  1761.                 inputTaken = true;
  1762.             } else if(super.mouseX >= 62 && super.mouseX <= 117 && super.mouseY >= 482 && super.mouseY <= 503) {
  1763.                 cButtonHPos = 1;
  1764.                 inputTaken = true;
  1765.             } else if(super.mouseX >= 119 && super.mouseX <= 174 && super.mouseY >= 482 && super.mouseY <= 503) {
  1766.                 cButtonHPos = 2;
  1767.                 inputTaken = true;
  1768.             } else if(super.mouseX >= 176 && super.mouseX <= 231 && super.mouseY >= 482 && super.mouseY <= 503) {
  1769.                 cButtonHPos = 3;
  1770.                 inputTaken = true;
  1771.             } else if(super.mouseX >= 233 && super.mouseX <= 288 && super.mouseY >= 482 && super.mouseY <= 503) {
  1772.                 cButtonHPos = 4;
  1773.                 inputTaken = true;
  1774.             } else if(super.mouseX >= 290 && super.mouseX <= 345 && super.mouseY >= 482 && super.mouseY <= 503) {
  1775.                 cButtonHPos = 5;
  1776.                 inputTaken = true;
  1777.             } else if(super.mouseX >= 347 && super.mouseX <= 402 && super.mouseY >= 482 && super.mouseY <= 503) {
  1778.                 cButtonHPos = 6;
  1779.                 inputTaken = true;
  1780.             } else if(super.mouseX >= 404 && super.mouseX <= 514 && super.mouseY >= 480 && super.mouseY <= 501) {
  1781.                 cButtonHPos = 7;
  1782.                 inputTaken = true;
  1783.             } else {
  1784.                 cButtonHPos = -1;
  1785.                 inputTaken = true;
  1786.             }
  1787.             if(super.clickMode3 == 1) {
  1788.                 if(super.saveClickX >= 5 && super.saveClickX <= 61 && super.saveClickY >= 482 && super.saveClickY <= 505) {
  1789.                     cButtonCPos = 0;
  1790.                     chatTypeView = 0;
  1791.                     inputTaken = true;
  1792.                 } else if(super.saveClickX >= 62 && super.saveClickX <= 117 && super.saveClickY >= 482 && super.saveClickY <= 505) {
  1793.                     cButtonCPos = 1;
  1794.                     chatTypeView = 5;
  1795.                     inputTaken = true;
  1796.                 } else if(super.saveClickX >= 119 && super.saveClickX <= 174 && super.saveClickY >= 482 && super.saveClickY <= 505) {
  1797.                     cButtonCPos = 2;
  1798.                     chatTypeView = 1;
  1799.                     inputTaken = true;
  1800.                 } else if(super.saveClickX >= 176 && super.saveClickX <= 231 && super.saveClickY >= 482 && super.saveClickY <= 505) {
  1801.                     cButtonCPos = 3;
  1802.                     chatTypeView = 2;
  1803.                     inputTaken = true;
  1804.                 } else if(super.saveClickX >= 233 && super.saveClickX <= 288 && super.saveClickY >= 482 && super.saveClickY <= 505) {
  1805.                     cButtonCPos = 4;
  1806.                     chatTypeView = 11;
  1807.                     inputTaken = true;
  1808.                 } else if(super.saveClickX >= 290 && super.saveClickX <= 345 && super.saveClickY >= 482 && super.saveClickY <= 505) {
  1809.                     cButtonCPos = 5;
  1810.                     chatTypeView = 3;
  1811.                     inputTaken = true;
  1812.                 } else if(super.saveClickX >= 347 && super.saveClickX <= 402 && super.saveClickY >= 482 && super.saveClickY <= 505) {
  1813.                     cButtonCPos = 6;
  1814.                     chatTypeView = 6;
  1815.                     inputTaken = true;
  1816.                 } else if(super.saveClickX >= 404 && super.saveClickX <= 515 && super.saveClickY >= 482 && super.saveClickY <= 505) {
  1817.                     if(openInterfaceID == -1) {
  1818.                         clearTopInterfaces();
  1819.                         reportAbuseInput = "";
  1820.                         canMute = false;
  1821.                         for(int i = 0; i < RSInterface.interfaceCache.length; i++) {
  1822.                             if(RSInterface.interfaceCache[i] == null || RSInterface.interfaceCache[i].contentType != 600)
  1823.                                 continue;
  1824.                             reportAbuseInterfaceID = openInterfaceID = RSInterface.interfaceCache[i].parentID;
  1825.                             break;
  1826.                         }
  1827.                     } else {
  1828.                         pushMessage("Please close the interface you have open before using 'report abuse'", 0, "");
  1829.                     }
  1830.                 }
  1831.             }
  1832.         }
  1833.     }
  1834.  
  1835.     private void method33(int i) {
  1836.         int j = Varp.cache[i].anInt709;
  1837.         if(j == 0)
  1838.             return;
  1839.         int k = variousSettings[i];
  1840.         if(j == 1)
  1841.         {
  1842.             if(k == 1)
  1843.                 Texture.method372(0.90000000000000002D);
  1844.             if(k == 2)
  1845.                 Texture.method372(0.80000000000000004D);
  1846.             if(k == 3)
  1847.                 Texture.method372(0.69999999999999996D);
  1848.             if(k == 4)
  1849.                 Texture.method372(0.59999999999999998D);
  1850.             ItemDef.mruNodes1.unlinkAll();
  1851.             welcomeScreenRaised = true;
  1852.         }
  1853.         if(j == 3) {
  1854.             switch(k) { //Zoom
  1855.                 case 4:
  1856.                     CameraPos2 = 200;
  1857.                     break;
  1858.                 case 3:
  1859.                     CameraPos2 = 400;
  1860.                     break;
  1861.                 case 0://0
  1862.                     CameraPos2 = 600;
  1863.                     break;
  1864.                 case 1:
  1865.                     CameraPos2 = 800;
  1866.                     break;
  1867.                 case 2://2
  1868.                     CameraPos2 = 1000;
  1869.                     break;
  1870.             }
  1871.             /*boolean flag1 = musicEnabled;
  1872.             if(k == 0)
  1873.             {
  1874.                 adjustVolume(musicEnabled, 0);
  1875.                 musicEnabled = true;
  1876.             }
  1877.             if(k == 1)
  1878.             {
  1879.                 adjustVolume(musicEnabled, -400);
  1880.                 musicEnabled = true;
  1881.             }
  1882.             if(k == 2)
  1883.             {
  1884.                 adjustVolume(musicEnabled, -800);
  1885.                 musicEnabled = true;
  1886.             }
  1887.             if(k == 3)
  1888.             {
  1889.                 adjustVolume(musicEnabled, -1200);
  1890.                 musicEnabled = true;
  1891.             }
  1892.             if(k == 4)
  1893.                 musicEnabled = false;
  1894.             if(musicEnabled != flag1 && !lowMem)
  1895.             {
  1896.                 if(musicEnabled)
  1897.                 {
  1898.                     nextSong = currentSong;
  1899.                     songChanging = true;
  1900.                     onDemandFetcher.method558(2, nextSong);
  1901.                 } else
  1902.                 {
  1903.                     stopMidi();
  1904.                 }
  1905.                 prevSong = 0;
  1906.             }*/
  1907.         }
  1908.         if(j == 4) {
  1909.             if(k == 0)
  1910.             {
  1911.                 soundEffectsEnabled = true;
  1912.                 setWaveVolume(0);
  1913.             }
  1914.             if(k == 1)
  1915.             {
  1916.                 soundEffectsEnabled = true;
  1917.                 setWaveVolume(-400);
  1918.             }
  1919.             if(k == 2) {
  1920.                 soundEffectsEnabled = true;
  1921.                 setWaveVolume(-800);
  1922.             }
  1923.             if(k == 3) {
  1924.                 soundEffectsEnabled = true;
  1925.                 setWaveVolume(-1200);
  1926.             }
  1927.             if(k == 4)
  1928.                 soundEffectsEnabled = false;
  1929.         }
  1930.         if(j == 5)
  1931.             anInt1253 = k;
  1932.         if(j == 6)
  1933.             anInt1249 = k;
  1934.         if(j == 8)
  1935.         {
  1936.             splitPrivateChat = k;
  1937.             inputTaken = true;
  1938.         }
  1939.         if(j == 9)
  1940.             anInt913 = k;
  1941.     }
  1942.    
  1943.     private void updateEntities() {
  1944.  
  1945.         try{
  1946.             int anInt974 = 0;
  1947.             for(int j = -1; j < playerCount + npcCount; j++) {
  1948.             Object obj;
  1949.             if(j == -1)
  1950.                 obj = myPlayer;
  1951.             else
  1952.             if(j < playerCount)
  1953.                 obj = playerArray[playerIndices[j]];
  1954.             else
  1955.                 obj = npcArray[npcIndices[j - playerCount]];
  1956.             if(obj == null || !((Mobile)(obj)).isVisible())
  1957.                 continue;
  1958.             if(obj instanceof Npc) {
  1959.                 NpcDef npcDef = ((Npc)obj).desc;
  1960.                
  1961.             if(namesToggle) {
  1962.                 String s = npcDef.name;
  1963.                 s = s + combatDiffColor(myPlayer.combatLevel, npcDef.combatLevel) + " (level: " + npcDef.combatLevel + ")";
  1964.                 if(npcDef.combatLevel != 0) {
  1965.                     npcScreenPos(((Mobile) (obj)), ((Mobile) (obj)).height+15);
  1966.                     smallFont.drawCenteredString(0xFFFF33, spriteDrawX, s, spriteDrawY-8, true);
  1967.                 } else {
  1968.                     npcScreenPos(((Mobile) (obj)), ((Mobile) (obj)).height+15);
  1969.                     smallFont.drawCenteredString(0xFFFF33, spriteDrawX, npcDef.name, spriteDrawY-8, true);
  1970.                 }
  1971.             }
  1972.                
  1973.                 if(npcDef.childrenIDs != null)
  1974.                     npcDef = npcDef.method161();
  1975.                 if(npcDef == null)
  1976.                     continue;
  1977.             }
  1978.                 if(j < playerCount) {
  1979.                 int l = 45;
  1980.                 Player player = (Player)obj;
  1981.                 if(player.headIcon >= 0) {
  1982.                     npcScreenPos(((Mobile) (obj)), ((Mobile) (obj)).height + 15);
  1983.                     if(spriteDrawX > -1) {
  1984.                     if(player.skullIcon < 2) {
  1985.                         skullIcons[player.skullIcon].drawSprite(spriteDrawX - 12, spriteDrawY - l);
  1986.                         l += 25;//25
  1987.                     }
  1988.                     /*if(player.headIcon < 7) {
  1989.                         headIcons[player.headIcon].drawSprite(spriteDrawX - 12, spriteDrawY - l);
  1990.                         l += 20;//20
  1991.                     }*/
  1992.                     if(player.headIcon < 18)  {
  1993.                         headIcons[player.headIcon].drawSprite(spriteDrawX - 12, spriteDrawY - l);
  1994.                         l += 26;
  1995.                     }
  1996.                     }
  1997.                 }
  1998.                 if(j >= 0 && anInt855 == 10 && anInt933 == playerIndices[j]) {
  1999.                     npcScreenPos(((Mobile) (obj)), ((Mobile) (obj)).height + 15);
  2000.                     if(spriteDrawX > -1)
  2001.                         headIconsHint[player.hintIcon].drawSprite(spriteDrawX - 12, spriteDrawY - l);
  2002.                     l += 30;
  2003.                 }
  2004.                 npcScreenPos(((Mobile) (obj)), ((Mobile) (obj)).height + 15);
  2005.                 if(namesToggle)
  2006.                     smallText.drawCenterAlignedString("<col="+titleColor(myPlayer.titleColor, 0)+">" + player.name, spriteDrawX, spriteDrawY-8, 0xffffff, 100, true);
  2007.                 } else {
  2008.                 NpcDef entityDef_1 = ((Npc)obj).desc;
  2009.                 if(entityDef_1.anInt75 >= 0 && entityDef_1.anInt75 < headIcons.length) {
  2010.                     npcScreenPos(((Mobile) (obj)), ((Mobile) (obj)).height + 15);
  2011.                     if(spriteDrawX > -1)
  2012.                     headIcons[entityDef_1.anInt75].drawSprite(spriteDrawX - 12, spriteDrawY - 50);
  2013.                 }
  2014.                 if(anInt855 == 1 && anInt1222 == npcIndices[j - playerCount] && loopCycle % 20 < 10) {
  2015.                     npcScreenPos(((Mobile) (obj)), ((Mobile) (obj)).height + 15);
  2016.                     if(spriteDrawX > -1)
  2017.                     headIconsHint[0].drawSprite(spriteDrawX - 12, spriteDrawY - 50);
  2018.                 }
  2019.                 }
  2020.             if(((Mobile) (obj)).textSpoken != null && (j >= playerCount || publicChatMode == 0 || publicChatMode == 3 || publicChatMode == 1 && isFriendOrSelf(((Player)obj).name))) {
  2021.                 npcScreenPos(((Mobile) (obj)), ((Mobile) (obj)).height);
  2022.                 if(spriteDrawX > -1 && anInt974 < maxChatsAtTime) {
  2023.                     anIntArray979[anInt974] = boldFont.method384(((Mobile) (obj)).textSpoken) / 2;
  2024.                     anIntArray978[anInt974] = boldFont.anInt1497;
  2025.                     chatDrawXArray[anInt974] = spriteDrawX;
  2026.                     chatDrawYArray[anInt974] = spriteDrawY;
  2027.                     chatColorArray[anInt974] = ((Mobile) (obj)).textColor;
  2028.                     chatAnimArray[anInt974] = ((Mobile) (obj)).textAnim;
  2029.                     chatCycleArray[anInt974] = ((Mobile) (obj)).textCycle;
  2030.                     chatSpokenArray[anInt974++] = ((Mobile) (obj)).textSpoken;
  2031.                     if(anInt1249 == 0 && ((Mobile) (obj)).textAnim >= 1 && ((Mobile) (obj)).textAnim <= 3) {
  2032.                         anIntArray978[anInt974] += 10;
  2033.                         chatDrawYArray[anInt974] += 5;
  2034.                     }
  2035.                     if(anInt1249 == 0 && ((Mobile) (obj)).textAnim == 4)
  2036.                         anIntArray979[anInt974] = 60;
  2037.                     if(anInt1249 == 0 && ((Mobile) (obj)).textAnim == 5)
  2038.                         anIntArray978[anInt974] += 5;
  2039.                 }
  2040.             }
  2041.             if(((Mobile) (obj)).loopCycleStatus > loopCycle) {
  2042.                 try{
  2043.                     npcScreenPos(((Mobile) (obj)), ((Mobile) (obj)).height + 15);
  2044.                     if(spriteDrawX > -1) {
  2045.                         int i1 = (((Mobile) (obj)).currentHealth * 30) / ((Mobile) (obj)).maxHealth;
  2046.                             if(i1 > 30) {
  2047.                                 i1 = 30;
  2048.                             }
  2049.                         int HpPercent = (((Mobile) (obj)).currentHealth * 56) / ((Mobile) (obj)).maxHealth;
  2050.                             if(HpPercent > 56) {
  2051.                                 HpPercent = 56;
  2052.                             }
  2053.                         if(adminMode) //Draws hp amount above bar
  2054.                                         smallText.drawCenterAlignedString((new StringBuilder()).append(((Mobile) (Mobile) obj).currentHealth).append("/").append(((Mobile) (Mobile) obj).maxHealth).toString(), spriteDrawX, spriteDrawY - 19, 0x3399ff, 100, true);
  2055.                         //HPBar crap
  2056.                         if(!hitbarToggle){
  2057.                             DrawingArea.fillRect(spriteDrawX - 15, spriteDrawY - 3, i1, 5, 65280);
  2058.                             DrawingArea.fillRect((spriteDrawX - 15) + i1, spriteDrawY - 3, 30 - i1, 5, 0xff0000);
  2059.                         } else {
  2060.                             cacheSprite[41].drawSprite(spriteDrawX - 28, spriteDrawY - 5);
  2061.                             cacheSprite[42] = new Sprite(spriteLoc + "42.png", HpPercent, 7);
  2062.                             cacheSprite[42].drawSprite(spriteDrawX - 28, spriteDrawY - 5);
  2063.                         }
  2064.                     }
  2065.                 } catch(Exception e){ }
  2066.                 }
  2067.                 for(int j1 = 0; j1 < 4; j1++)
  2068.                     if(((Mobile) (obj)).hitsLoopCycle[j1] > loopCycle) {
  2069.                         npcScreenPos(((Mobile) (obj)), ((Mobile) (obj)).height / 2);
  2070.                         if(spriteDrawX > -1) {
  2071.                             switch(j1) {
  2072.                             case 0:
  2073.                                 spriteDrawY -= 22;
  2074.                                 break;
  2075.                             case 1:
  2076.                                 spriteDrawY += 0;
  2077.                                 break;
  2078.                             case 2:
  2079.                                 spriteDrawY += 22;
  2080.                                 break;
  2081.                             case 3:
  2082.                                 spriteDrawY += 44;
  2083.                                 break;
  2084.                             }
  2085.                            
  2086.                             //TODO hitmark anims
  2087.                             int anim = (loopCycle - ((Mobile) (obj)).hitsLoopCycle[j1]) / 2;
  2088.                             int opacity = 255;
  2089.                             if(anim >= -10)
  2090.                                 opacity = (int)((float)anim * -25.5);
  2091.                             spriteDrawY -= anim / 1.5;
  2092.                            
  2093.                             String amount = Integer.toString(((Mobile) (obj)).hitArray[j1]);
  2094.  
  2095.                             if(((Mobile) (obj)).hitArray[j1] == 0)
  2096.                                 newHitMark[6].drawSprite(spriteDrawX - 8, spriteDrawY - 12, opacity);
  2097.                             else {
  2098.                                 if(((Mobile)(obj)).hitMarkTypes[j1] != 2) {
  2099.                                
  2100.                                 spriteDrawX += 6;
  2101.                                
  2102.                                 combatIcons[((Mobile)(obj)).hitType[j1]].drawSprite(spriteDrawX - (22 + amount.length() * 4), spriteDrawY - 12, opacity);
  2103.  
  2104.                                 if(amount.length() == 1)
  2105.                                     newHitMark[0].drawHDSprite(spriteDrawX - 8, spriteDrawY - 12, opacity);
  2106.                                 else if(amount.length() == 2)
  2107.                                     newHitMark[1].drawHDSprite(spriteDrawX - 12, spriteDrawY - 12, opacity);
  2108.                                 else if(amount.length() == 3)
  2109.                                     newHitMark[2].drawHDSprite(spriteDrawX - 16, spriteDrawY - 12, opacity);
  2110.                                 else if(amount.length() == 4)
  2111.                                     newHitMark[3].drawHDSprite(spriteDrawX - 20, spriteDrawY - 12, opacity);
  2112.                                
  2113.                                 } else if(((Mobile) (obj)).hitMarkTypes[j1] == 2) {
  2114.                                
  2115.                                     if(amount.length() == 1)
  2116.                                         newHitMark[4].drawHDSprite(spriteDrawX - 8, spriteDrawY - 12, opacity);
  2117.                                     else if(amount.length() == 2)
  2118.                                         newHitMark[5].drawHDSprite(spriteDrawX - 12, spriteDrawY - 12, opacity);
  2119.                                
  2120.                                 }
  2121.                             }
  2122.                            
  2123.                             if(((Mobile)(obj)).hitArray[j1] > 0)
  2124.                                 smallText.drawCenterAlignedString("<trans=" + opacity + ">" + String.valueOf(((Mobile) (obj)).hitArray[j1]), spriteDrawX, spriteDrawY + 3, 0xffffff, 0, true);
  2125.                         }
  2126.                     }
  2127.             }
  2128.             for(int k = 0; k < anInt974; k++) {
  2129.                 int k1 = chatDrawXArray[k];
  2130.                 int l1 = chatDrawYArray[k];
  2131.                 int j2 = anIntArray979[k];
  2132.                 int k2 = anIntArray978[k];
  2133.                 boolean flag = true;
  2134.                 while(flag)
  2135.                 {
  2136.                     flag = false;
  2137.                     for(int l2 = 0; l2 < k; l2++)
  2138.                         if(l1 + 2 > chatDrawYArray[l2] - anIntArray978[l2] && l1 - k2 < chatDrawYArray[l2] + 2 && k1 - j2 < chatDrawXArray[l2] + anIntArray979[l2] && k1 + j2 > chatDrawXArray[l2] - anIntArray979[l2] && chatDrawYArray[l2] - anIntArray978[l2] < l1)
  2139.                         {
  2140.                             l1 = chatDrawYArray[l2] - anIntArray978[l2];
  2141.                             flag = true;
  2142.                         }
  2143.  
  2144.                 }
  2145.                 spriteDrawX = chatDrawXArray[k];
  2146.                 spriteDrawY = chatDrawYArray[k] = l1;
  2147.                 String s = chatSpokenArray[k];
  2148.                 if(publicChatMode != 2) {
  2149.                 if(anInt1249 == 0) {
  2150.                     int color = 0xffff00;
  2151.                     if(chatColorArray[k] < 6)
  2152.                         color = chatColor[chatColorArray[k]];
  2153.                     if(chatColorArray[k] == 6)
  2154.                         color = anInt1265 % 20 >= 10 ? 0xffff00 : 0xff0000;
  2155.                     if(chatColorArray[k] == 7)
  2156.                         color = anInt1265 % 20 >= 10 ? 65535 : 255;
  2157.                     if(chatColorArray[k] == 8)
  2158.                         color = anInt1265 % 20 >= 10 ? 0x80ff80 : 45056;
  2159.                     if(chatColorArray[k] == 9) {
  2160.                         int j3 = 150 - chatCycleArray[k];
  2161.                         if(j3 < 50)
  2162.                             color = 0xff0000 + 1280 * j3;
  2163.                         else
  2164.                         if(j3 < 100)
  2165.                             color = 0xffff00 - 0x50000 * (j3 - 50);
  2166.                         else
  2167.                         if(j3 < 150)
  2168.                             color = 65280 + 5 * (j3 - 100);
  2169.                     }
  2170.                     if(chatColorArray[k] == 10) {
  2171.                         int k3 = 150 - chatCycleArray[k];
  2172.                         if(k3 < 50)
  2173.                             color = 0xff0000 + 5 * k3;
  2174.                         else
  2175.                         if(k3 < 100)
  2176.                             color = 0xff00ff - 0x50000 * (k3 - 50);
  2177.                         else
  2178.                         if(k3 < 150)
  2179.                             color = (255 + 0x50000 * (k3 - 100)) - 5 * (k3 - 100);
  2180.                     }
  2181.                     if(chatColorArray[k] == 11) {
  2182.                         int l3 = 150 - chatCycleArray[k];
  2183.                         if(l3 < 50)
  2184.                             color = 0xffffff - 0x50005 * l3;
  2185.                         else
  2186.                         if(l3 < 100)
  2187.                             color = 65280 + 0x50005 * (l3 - 50);
  2188.                         else
  2189.                         if(l3 < 150)
  2190.                             color = 0xffffff - 0x50000 * (l3 - 100);
  2191.                     }
  2192.                     if(chatAnimArray[k] == 0) { //normal
  2193.                         boldFont.drawText(0, s, spriteDrawY + 1, spriteDrawX);
  2194.                         boldFont.drawText(color, s, spriteDrawY, spriteDrawX);
  2195.                     }
  2196.                     if(chatAnimArray[k] == 1) { //wave
  2197.                         boldFont.drawWaveText(0, s, spriteDrawX, anInt1265, spriteDrawY + 1);
  2198.                         boldFont.drawWaveText(color, s, spriteDrawX, anInt1265, spriteDrawY);
  2199.                     }
  2200.                     if(chatAnimArray[k] == 2) { //wave2
  2201.                         boldFont.drawWave2Text(spriteDrawX, s, anInt1265, spriteDrawY + 1, 0);
  2202.                         boldFont.drawWave2Text(spriteDrawX, s, anInt1265, spriteDrawY, color);
  2203.                     }
  2204.                     if(chatAnimArray[k] == 3) { //shake
  2205.                         boldFont.drawShakeText(150 - chatCycleArray[k], s, anInt1265, spriteDrawY + 1, spriteDrawX, 0);
  2206.                         boldFont.drawShakeText(150 - chatCycleArray[k], s, anInt1265, spriteDrawY, spriteDrawX, color);
  2207.                     }
  2208.                     if(chatAnimArray[k] == 4) { //scroll
  2209.                         int i4 = boldFont.method384(s);
  2210.                         int k4 = ((150 - chatCycleArray[k]) * (i4 + 100)) / 150;
  2211.                         DrawingArea.setClip(spriteDrawX - 50, 0, spriteDrawX + 50, 334);
  2212.                         boldFont.method385(0, s, spriteDrawY + 1, (spriteDrawX + 50) - k4);
  2213.                         boldFont.method385(color, s, spriteDrawY, (spriteDrawX + 50) - k4);
  2214.                         DrawingArea.removeClip();
  2215.                     }
  2216.                     if(chatAnimArray[k] == 5) { //slide
  2217.                         int j4 = 150 - chatCycleArray[k];
  2218.                         int l4 = 0;
  2219.                         if(j4 < 25)
  2220.                             l4 = j4 - 25;
  2221.                         else
  2222.                         if(j4 > 125)
  2223.                             l4 = j4 - 125;
  2224.                         DrawingArea.setClip(0, spriteDrawY - boldFont.anInt1497 - 1, 512, spriteDrawY + 5);
  2225.                         boldFont.drawText(0, s, spriteDrawY + 1 + l4, spriteDrawX);
  2226.                         boldFont.drawText(color, s, spriteDrawY + l4, spriteDrawX);
  2227.                         DrawingArea.removeClip();
  2228.                     }
  2229.                 } else {
  2230.                     boldFont.drawText(0, s, spriteDrawY + 1, spriteDrawX);
  2231.                     boldFont.drawText(0xffff00, s, spriteDrawY, spriteDrawX);
  2232.                 }
  2233.                 }
  2234.             }
  2235.         } catch(Exception e){ }
  2236.     }
  2237.  
  2238.     private void delFriend(long l)
  2239.     {
  2240.         try
  2241.         {
  2242.             if(l == 0L)
  2243.                 return;
  2244.             for(int i = 0; i < friendsCount; i++)
  2245.             {
  2246.                 if(friendsListAsLongs[i] != l)
  2247.                     continue;
  2248.                 friendsCount--;
  2249.                 needDrawTabArea = true;
  2250.                 for(int j = i; j < friendsCount; j++)
  2251.                 {
  2252.                     friendsList[j] = friendsList[j + 1];
  2253.                     friendsNodeIDs[j] = friendsNodeIDs[j + 1];
  2254.                     friendsListAsLongs[j] = friendsListAsLongs[j + 1];
  2255.                 }
  2256.  
  2257.                 stream.createFrame(215);
  2258.                 stream.writeQWord(l);
  2259.                 break;
  2260.             }
  2261.         }
  2262.         catch(RuntimeException runtimeexception)
  2263.         {
  2264.             SignLink.reporterror("18622, " + false + ", " + l + ", " + runtimeexception.toString());
  2265.             throw new RuntimeException();
  2266.         }
  2267.     }
  2268.    
  2269.     public void drawSideIcons(){
  2270.         if(!fullScreenOn){
  2271.            /* Top sideIcons */
  2272.             if(tabInterfaceIDs[0] != -1)
  2273.                 newSideIcons[0].drawSprite(8+3, 8);
  2274.             if(tabInterfaceIDs[1] != -1)
  2275.                 newSideIcons[1].drawSprite(37+3, 8);
  2276.             if(tabInterfaceIDs[2] != -1)
  2277.                 newSideIcons[2].drawSprite(67+3, 8);
  2278.             if(tabInterfaceIDs[14] != -1)
  2279.                 newSideIcons[3].drawSprite(97+3, 8);
  2280.             if(tabInterfaceIDs[3] != -1)
  2281.                 newSideIcons[4].drawSprite(127+3, 8);
  2282.             if(tabInterfaceIDs[4] != -1)
  2283.                 newSideIcons[5].drawSprite(159+3, 8);
  2284.             if(tabInterfaceIDs[5] != -1)
  2285.                 newSideIcons[6].drawSprite(187+3, 8);
  2286.             if(tabInterfaceIDs[6] != -1)
  2287.                 newSideIcons[7].drawSprite(217+3, 8);
  2288.         /* Bottom sideIcons */
  2289.             if(tabInterfaceIDs[10] != -1)
  2290.                 newSideIcons[15].drawSprite(8+3, 305);
  2291.             if(tabInterfaceIDs[9] != -1)
  2292.                 newSideIcons[8].drawSprite(38+3, 306);
  2293.             if(tabInterfaceIDs[8] != -1)
  2294.                 newSideIcons[9].drawSprite(70+3, 306);
  2295.             if(tabInterfaceIDs[7] != -1)
  2296.                 newSideIcons[13].drawSprite(97+3, 307);
  2297.             if(tabInterfaceIDs[11] != -1)
  2298.                 newSideIcons[10].drawSprite(127+3, 306);
  2299.             if(tabInterfaceIDs[12] != -1)
  2300.                 newSideIcons[11].drawSprite(157+3, 306);
  2301.             if(tabInterfaceIDs[13] != -1)
  2302.                 newSideIcons[12].drawSprite(187+3, 306);
  2303.             if(tabInterfaceIDs[15] != -1)
  2304.                 newSideIcons[14].drawSprite(216+3, 307);
  2305.         }
  2306.     }
  2307.     public void drawRedStones() {
  2308.         if(!fullScreenOn) {
  2309.             drawTabHover();
  2310.             if(tabInterfaceIDs[tabID] != -1){
  2311.                 if(tabID == 0)
  2312.                     tabClicked.drawSprite(2+3, 0);
  2313.                 if(tabID == 1)
  2314.                     tabClicked.drawSprite(32+3, 0);
  2315.                 if(tabID == 2)
  2316.                     tabClicked.drawSprite(62+3, 0);
  2317.                 if(tabID == 14)
  2318.                     tabClicked.drawSprite(92+3, 0);
  2319.                 if(tabID == 3)
  2320.                     tabClicked.drawSprite(122+3, 0);
  2321.                 if(tabID == 4)
  2322.                     tabClicked.drawSprite(152+3, 0);
  2323.                 if(tabID == 5)
  2324.                     tabClicked.drawSprite(182+3, 0);
  2325.                 if(tabID == 6)
  2326.                     tabClicked.drawSprite(212+3, 0);
  2327.                 if(tabID == 16)
  2328.                     tabClicked.drawSprite(2+3, 298);
  2329.                 if(tabID == 8)
  2330.                     tabClicked.drawSprite(32+3, 298);
  2331.                 if(tabID == 9)
  2332.                     tabClicked.drawSprite(62+3, 298);
  2333.                 if(tabID == 7)
  2334.                     tabClicked.drawSprite(92+3, 298);
  2335.                 if(tabID == 11)
  2336.                     tabClicked.drawSprite(122+3, 298);
  2337.                 if(tabID == 12)
  2338.                     tabClicked.drawSprite(152+3, 298);
  2339.                 if(tabID == 13)
  2340.                     tabClicked.drawSprite(182+3, 298);
  2341.                 if(tabID == 15)
  2342.                     tabClicked.drawSprite(212+3, 298);
  2343.             }
  2344.         }
  2345.     }
  2346.    
  2347.     private void drawTabArea() {
  2348.         tabArea.initDrawingArea();
  2349.         tabBack[getSpriteID()].drawSprite(0, 0);
  2350.         if(spriteChanged)
  2351.             needDrawTabArea = true;
  2352.         tabAreaAltered = true;
  2353.         if(invOverlayInterfaceID == -1) {
  2354.             drawRedStones();
  2355.             drawSideIcons();
  2356.         }
  2357.         if(invOverlayInterfaceID != -1)
  2358.             drawInterface(0, 31, 37, RSInterface.interfaceCache[invOverlayInterfaceID]);
  2359.         else if(tabInterfaceIDs[tabID] != -1)
  2360.             drawInterface(0, 31, 37, RSInterface.interfaceCache[tabInterfaceIDs[tabID]]);
  2361.         if(menuOpen)
  2362.             drawMenu(516, 168);
  2363.         drawDeveloperConsole(showDeveloperConsole, 516, 168);
  2364.         tabArea.drawGraphics(516, 168, graphics);
  2365.         mainGameArea.initDrawingArea();
  2366.         Texture.anIntArray1472 = anIntArray1182;
  2367.     }
  2368.  
  2369.     private void method37(int j) {
  2370.         if(!lowMem) {
  2371.             if(Texture.anIntArray1480[17] >= j) {
  2372.        
  2373.                 Background background = Texture.aBackgroundArray1474s[17];
  2374.                 int k = background.imgWidth * background.imgHeight - 1;
  2375.                 //fire cape apparently?
  2376.                 int j1 = background.imgWidth * animationTimePassed * 2;
  2377.                 byte abyte0[] = background.aByteArray1450;
  2378.                 byte abyte3[] = aByteArray912;
  2379.                 for(int i2 = 0; i2 <= k; i2++)
  2380.                     abyte3[i2] = abyte0[i2 - j1 & k];
  2381.  
  2382.                 background.aByteArray1450 = abyte3;
  2383.                 aByteArray912 = abyte0;
  2384.                 Texture.method370(17);
  2385.                 anInt854++;
  2386.                 if(anInt854 > 1235) {
  2387.                     anInt854 = 0;
  2388.                     stream.createFrame(226);
  2389.                     stream.writeWordBigEndian(0);
  2390.                     int l2 = stream.currentOffset;
  2391.                     stream.writeWord(58722);
  2392.                     stream.writeWordBigEndian(240);
  2393.                     stream.writeWord((int)(Math.random() * 65536D));
  2394.                     stream.writeWordBigEndian((int)(Math.random() * 256D));
  2395.                     if((int)(Math.random() * 2D) == 0)
  2396.                         stream.writeWord(51825);
  2397.                     stream.writeWordBigEndian((int)(Math.random() * 256D));
  2398.                     stream.writeWord((int)(Math.random() * 65536D));
  2399.                     stream.writeWord(7130);
  2400.                     stream.writeWord((int)(Math.random() * 65536D));
  2401.                     stream.writeWord(61657);
  2402.                     stream.writeBytes(stream.currentOffset - l2);
  2403.                 }
  2404.             }
  2405.             if(Texture.anIntArray1480[24] >= j) {
  2406.                 Background background_1 = Texture.aBackgroundArray1474s[24];
  2407.                 int l = background_1.imgWidth * background_1.imgHeight - 1;
  2408.                 int k1 = background_1.imgWidth * animationTimePassed * 2;
  2409.                 byte abyte1[] = background_1.aByteArray1450;
  2410.                 byte abyte4[] = aByteArray912;
  2411.                 for(int j2 = 0; j2 <= l; j2++)
  2412.                     abyte4[j2] = abyte1[j2 - k1 & l];
  2413.  
  2414.                 background_1.aByteArray1450 = abyte4;
  2415.                 aByteArray912 = abyte1;
  2416.                 Texture.method370(24);
  2417.             }
  2418.             if(Texture.anIntArray1480[34] >= j) {
  2419.                 Background background_2 = Texture.aBackgroundArray1474s[34];
  2420.                 int i1 = background_2.imgWidth * background_2.imgHeight - 1;
  2421.                 int l1 = background_2.imgWidth * animationTimePassed * 2;
  2422.                 byte abyte2[] = background_2.aByteArray1450;
  2423.                 byte abyte5[] = aByteArray912;
  2424.                 for(int k2 = 0; k2 <= i1; k2++)
  2425.                     abyte5[k2] = abyte2[k2 - l1 & i1];
  2426.  
  2427.                 background_2.aByteArray1450 = abyte5;
  2428.                 aByteArray912 = abyte2;
  2429.                 Texture.method370(34);
  2430.             }
  2431.             if(Texture.anIntArray1480[40] >= j)
  2432.             {
  2433.                 Background background_2 = Texture.aBackgroundArray1474s[40];
  2434.                 int i1 = background_2.imgWidth * background_2.imgHeight - 1;
  2435.                 int l1 = background_2.imgWidth * animationTimePassed * 2;
  2436.                 byte abyte2[] = background_2.aByteArray1450;
  2437.                 byte abyte5[] = aByteArray912;
  2438.                 for(int k2 = 0; k2 <= i1; k2++)
  2439.                     abyte5[k2] = abyte2[k2 - l1 & i1];
  2440.  
  2441.                 background_2.aByteArray1450 = abyte5;
  2442.                 aByteArray912 = abyte2;
  2443.                 Texture.method370(40);
  2444.        
  2445.             }
  2446.         }
  2447.     }
  2448.  
  2449.     private void method38() {
  2450.         for(int i = -1; i < playerCount; i++) {
  2451.             int j;
  2452.             if(i == -1)
  2453.                 j = myPlayerIndex;
  2454.             else
  2455.                 j = playerIndices[i];
  2456.             Player player = playerArray[j];
  2457.             if(player != null && player.textCycle > 0) {
  2458.                 player.textCycle--;
  2459.                 if(player.textCycle == 0)
  2460.                     player.textSpoken = null;
  2461.             }
  2462.         }
  2463.         for(int k = 0; k < npcCount; k++) {
  2464.             int l = npcIndices[k];
  2465.             Npc npc = npcArray[l];
  2466.             if(npc != null && npc.textCycle > 0) {
  2467.                 npc.textCycle--;
  2468.                 if(npc.textCycle == 0)
  2469.                     npc.textSpoken = null;
  2470.             }
  2471.         }
  2472.     }
  2473.  
  2474.     private void calcCameraPos() {
  2475.        
  2476.         int i = anInt1098 * 128 + 64;
  2477.         int j = anInt1099 * 128 + 64;
  2478.         int k = method42(plane, j, i) - anInt1100;
  2479.         if(xCameraPos < i) {
  2480.             xCameraPos += anInt1101 + ((i - xCameraPos) * anInt1102) / 1000;
  2481.             if(xCameraPos > i)
  2482.                 xCameraPos = i;
  2483.         }
  2484.         if(xCameraPos > i) {
  2485.             xCameraPos -= anInt1101 + ((xCameraPos - i) * anInt1102) / 1000;
  2486.             if(xCameraPos < i)
  2487.                 xCameraPos = i;
  2488.         }
  2489.         if(zCameraPos < k) {
  2490.             zCameraPos += anInt1101 + ((k - zCameraPos) * anInt1102) / 1000;
  2491.             if(zCameraPos > k)
  2492.                 zCameraPos = k;
  2493.         }
  2494.         if(zCameraPos > k) {
  2495.             zCameraPos -= anInt1101 + ((zCameraPos - k) * anInt1102) / 1000;
  2496.             if(zCameraPos < k)
  2497.                 zCameraPos = k;
  2498.         }
  2499.         if(yCameraPos < j) {
  2500.             yCameraPos += anInt1101 + ((j - yCameraPos) * anInt1102) / 1000;
  2501.             if(yCameraPos > j)
  2502.                 yCameraPos = j;
  2503.         }
  2504.         if(yCameraPos > j) {
  2505.             yCameraPos -= anInt1101 + ((yCameraPos - j) * anInt1102) / 1000;
  2506.             if(yCameraPos < j)
  2507.                 yCameraPos = j;
  2508.         }
  2509.         i = anInt995 * 128 + 64;
  2510.         j = anInt996 * 128 + 64;
  2511.         k = method42(plane, j, i) - anInt997;
  2512.         int l = i - xCameraPos;
  2513.         int i1 = k - zCameraPos;
  2514.         int j1 = j - yCameraPos;
  2515.         int k1 = (int)Math.sqrt(l * l + j1 * j1);
  2516.         int l1 = (int)(Math.atan2(i1, k1) * 325.94900000000001D) & 0x7ff;
  2517.         int i2 = (int)(Math.atan2(l, j1) * -325.94900000000001D) & 0x7ff;
  2518.         if(l1 < 128)
  2519.             l1 = 128;
  2520.         if(l1 > 383)
  2521.             l1 = 383;
  2522.         if(yCameraCurve < l1) {
  2523.             yCameraCurve += anInt998 + ((l1 - yCameraCurve) * anInt999) / 1000;
  2524.             if(yCameraCurve > l1)
  2525.                 yCameraCurve = l1;
  2526.         }
  2527.         if(yCameraCurve > l1) {
  2528.             yCameraCurve -= anInt998 + ((yCameraCurve - l1) * anInt999) / 1000;
  2529.             if(yCameraCurve < l1)
  2530.                 yCameraCurve = l1;
  2531.         }
  2532.         int j2 = i2 - xCameraCurve;
  2533.         if(j2 > 1024)
  2534.             j2 -= 2048;
  2535.         if(j2 < -1024)
  2536.             j2 += 2048;
  2537.         if(j2 > 0) {
  2538.             xCameraCurve += anInt998 + (j2 * anInt999) / 1000;
  2539.             xCameraCurve &= 0x7ff;
  2540.         }
  2541.         if(j2 < 0) {
  2542.             xCameraCurve -= anInt998 + (-j2 * anInt999) / 1000;
  2543.             xCameraCurve &= 0x7ff;
  2544.         }
  2545.         int k2 = i2 - xCameraCurve;
  2546.         if(k2 > 1024)
  2547.             k2 -= 2048;
  2548.         if(k2 < -1024)
  2549.             k2 += 2048;
  2550.         if(k2 < 0 && j2 > 0 || k2 > 0 && j2 < 0)
  2551.             xCameraCurve = i2;
  2552.     }
  2553.  
  2554.     private void drawMenu(int x, int y) {
  2555.         int xPos = menuOffsetX - x;
  2556.         int yPos = menuOffsetY - y;
  2557.         int menuW = menuWidth;
  2558.         int menuH = menuHeight;
  2559.         needDrawTabArea = true;
  2560.         inputTaken = true;
  2561.         tabAreaAltered = true;
  2562.         DrawingArea.fillRect(xPos, yPos, menuW, menuH, 0xffffff, 200);
  2563.         DrawingArea.fillRect(xPos + 1, yPos + 1, menuW - 2, 18, 0, 100);
  2564.         DrawingArea.drawRect(xPos, yPos, menuW, menuH, 0, 150);
  2565.         DrawingArea.drawVerticalLine(xPos + menuW, yPos + 1, menuH, 0, 100);
  2566.         DrawingArea.drawHorizontalLine(xPos + 1, yPos + menuH, menuW - 1, 0, 100);
  2567.         DrawingArea.drawVerticalLine(xPos + menuW + 1, yPos + 1, menuH, 0, 50);
  2568.         DrawingArea.drawHorizontalLine(xPos + 1, yPos + menuH + 1, menuW - 1, 0, 50);
  2569.         regularFont.method385(0xffffff, "Choose Option", yPos + 14, xPos + 3);
  2570.         int mouseX = super.mouseX;
  2571.         int mouseY = super.mouseY;
  2572.         for(int l1 = 0; l1 < menuActionRow; l1++) {
  2573.             int textY = yPos + 31 + (menuActionRow - 1 - l1) * 15;
  2574.             int disColor = 0x555555;
  2575.             if(mouseX > xPos && mouseX < xPos + menuW && mouseY > textY - 13 && mouseY < textY + 3) {
  2576.                 DrawingArea.fillRect(xPos + 2, textY - 11, menuWidth - 4, 15, 0, 50);
  2577.                 disColor = 0x333333;
  2578.             }
  2579.             regularFont.drawString(false, xPos + 3, disColor, menuActionName[l1], textY);
  2580.         }
  2581.         /*int xPos = menuOffsetX - (x - 4);
  2582.         int yPos = (-y + 4) + menuOffsetY;
  2583.         int menuW = menuWidth;
  2584.         int menuH = menuHeight + 1;
  2585.         inputTaken = true;
  2586.         tabAreaAltered = true;
  2587.         DrawingArea.fillRect(xPos, yPos + 2, menuW, menuH - 4, 0x706a5e);
  2588.         DrawingArea.fillRect(xPos + 1, yPos + 1, menuW - 2, menuH - 2,
  2589.                 0x706a5e);
  2590.         DrawingArea.fillRect(xPos + 2, yPos, menuW - 4, menuH, 0x706a5e);
  2591.         DrawingArea.fillRect(xPos + 3, yPos + 1, menuW - 6, menuH - 2,
  2592.                 0x2d2822);
  2593.         DrawingArea.fillRect(xPos + 2, yPos + 2, menuW - 4, menuH - 4,
  2594.                 0x2d2822);
  2595.         DrawingArea.fillRect(xPos + 1, yPos + 3, menuW - 2, menuH - 6,
  2596.                 0x2d2822);
  2597.         DrawingArea.fillRect(xPos + 2, yPos + 19, menuW - 4, menuH - 22,
  2598.                 0x524a3d);
  2599.         DrawingArea.fillRect(xPos + 3, yPos + 20, menuW - 6, menuH - 22,
  2600.                 0x524a3d);
  2601.         DrawingArea.fillRect(xPos + 3, yPos + 20, menuW - 6, menuH - 23,
  2602.                 0x2b271c);
  2603.         DrawingArea.drawRect(xPos + 3, yPos + 2, menuW - 6, 1, 0x2a291b);
  2604.         DrawingArea.drawRect(xPos + 2, yPos + 3, menuW - 4, 1, 0x2a261b);
  2605.         DrawingArea.drawRect(xPos + 2, yPos + 4, menuW - 4, 1, 0x252116);
  2606.         DrawingArea.drawRect(xPos + 2, yPos + 5, menuW - 4, 1, 0x211e15);
  2607.         DrawingArea.drawRect(xPos + 2, yPos + 6, menuW - 4, 1, 0x1e1b12);
  2608.         DrawingArea.drawRect(xPos + 2, yPos + 7, menuW - 4, 1, 0x1a170e);
  2609.         DrawingArea.drawRect(xPos + 2, yPos + 8, menuW - 4, 2, 0x15120b);
  2610.         DrawingArea.drawRect(xPos + 2, yPos + 10, menuW - 4, 1, 0x100d08);
  2611.         DrawingArea.drawRect(xPos + 2, yPos + 11, menuW - 4, 1, 0x090a04);
  2612.         DrawingArea.drawRect(xPos + 2, yPos + 12, menuW - 4, 1, 0x080703);
  2613.         DrawingArea.drawRect(xPos + 2, yPos + 13, menuW - 4, 1, 0x090a04);
  2614.         DrawingArea.drawRect(xPos + 2, yPos + 14, menuW - 4, 1, 0x070802);
  2615.         DrawingArea.drawRect(xPos + 2, yPos + 15, menuW - 4, 1, 0x090a04);
  2616.         DrawingArea.drawRect(xPos + 2, yPos + 16, menuW - 4, 1, 0x070802);
  2617.         DrawingArea.drawRect(xPos + 2, yPos + 17, menuW - 4, 1, 0x090a04);
  2618.         DrawingArea.drawRect(xPos + 2, yPos + 18, menuW - 4, 1, 0x2a291b);
  2619.         DrawingArea.drawRect(xPos + 3, yPos + 19, menuW - 6, 1, 0x564943);
  2620.         boldText.drawLeftAlignedString("Choose Option", xPos + 3, yPos + 14,
  2621.                 0xc6b895, -1, false);
  2622.         int mouseX = super.mouseX - (x);
  2623.         int mouseY = (-y) + super.mouseY;
  2624.         for (int l1 = 0; l1 < menuActionRow; l1++) {
  2625.             int textY = yPos + 31 + (menuActionRow - 1 - l1) * 15;
  2626.             int disColor = 0xc6b895;
  2627.             if (mouseX > xPos && mouseX < xPos + menuW
  2628.                     && mouseY > textY - 13 && mouseY < textY + 3) {
  2629.                 DrawingArea.fillRect(xPos + 3, textY - 11, menuWidth - 6,
  2630.                         15, 0x6f695d);
  2631.                 disColor = 0xeee5c6;
  2632.             }
  2633.             boldText.drawLeftAlignedString(menuActionName[l1], xPos + 3,
  2634.                     textY, disColor, 0, false);
  2635.         }*/
  2636.     }
  2637.  
  2638.     private void addFriend(long l) {
  2639.         try {
  2640.             if(l == 0L)
  2641.                 return;
  2642.             if(friendsCount >= 100 && anInt1046 != 1) {
  2643.                 pushMessage("Your friendlist is full. Max of 100 for free users, and 200 for members", 0, "");
  2644.                 return;
  2645.             }
  2646.             if(friendsCount >= 200) {
  2647.                 pushMessage("Your friendlist is full. Max of 100 for free users, and 200 for members", 0, "");
  2648.                 return;
  2649.             }
  2650.             String s = TextClass.fixName(TextClass.nameForLong(l));
  2651.             for(int i = 0; i < friendsCount; i++)
  2652.                 if(friendsListAsLongs[i] == l) {
  2653.                     pushMessage(s + " is already on your friend list", 0, "");
  2654.                     return;
  2655.                 }
  2656.             for(int j = 0; j < ignoreCount; j++)
  2657.                 if(ignoreListAsLongs[j] == l) {
  2658.                     pushMessage("Please remove " + s + " from your ignore list first", 0, "");
  2659.                     return;
  2660.                 }
  2661.  
  2662.             if(s.equals(myPlayer.name)) {
  2663.                 return;
  2664.             } else {
  2665.                 friendsList[friendsCount] = s;
  2666.                 friendsListAsLongs[friendsCount] = l;
  2667.                 friendsNodeIDs[friendsCount] = 0;
  2668.                 friendsCount++;
  2669.                 needDrawTabArea = true;
  2670.                 stream.createFrame(188);
  2671.                 stream.writeQWord(l);
  2672.                 return;
  2673.             }
  2674.         } catch(RuntimeException runtimeexception) {
  2675.             SignLink.reporterror("15283, " + (byte)68 + ", " + l + ", " + runtimeexception.toString());
  2676.         }
  2677.         throw new RuntimeException();
  2678.     }
  2679.  
  2680.     private int method42(int i, int j, int k) {
  2681.         int l = k >> 7;
  2682.         int i1 = j >> 7;
  2683.         if(l < 0 || i1 < 0 || l > 103 || i1 > 103)
  2684.             return 0;
  2685.         int j1 = i;
  2686.         if(j1 < 3 && (byteGroundArray[1][l][i1] & 2) == 2)
  2687.             j1++;
  2688.         int k1 = k & 0x7f;
  2689.         int l1 = j & 0x7f;
  2690.         int i2 = intGroundArray[j1][l][i1] * (128 - k1) + intGroundArray[j1][l + 1][i1] * k1 >> 7;
  2691.         int j2 = intGroundArray[j1][l][i1 + 1] * (128 - k1) + intGroundArray[j1][l + 1][i1 + 1] * k1 >> 7;
  2692.         return i2 * (128 - l1) + j2 * l1 >> 7;
  2693.     }
  2694.  
  2695.     private static String intToKOrMil(int j) {
  2696.         if(j < 0x186a0)
  2697.             return String.valueOf(j);
  2698.         if(j < 0x989680)
  2699.             return j / 1000 + "K";
  2700.         else
  2701.             return j / 0xf4240 + "M";
  2702.     }
  2703.     public int canWalkDelay = 0;
  2704.      public int getDis(int coordX1, int coordY1, int coordX2, int coordY2)
  2705.     {
  2706.         int deltaX = coordX2 - coordX1;
  2707.         int deltaY = coordY2 - coordY1;
  2708.         return ((int)Math.sqrt(Math.pow(deltaX, 2) + Math.pow(deltaY, 2)));
  2709.     }
  2710.      public int random(int range)
  2711.     {
  2712.         return (int)(Math.random() * range);
  2713.     }
  2714.    public boolean withinDistance(int x1, int y1, int x2, int y2, int dis)
  2715.     {
  2716.         for(int i = 0; i <= dis; i++)
  2717.         {
  2718.             try{
  2719.             if((x1 + i) == x2 && ((y1 + i) == y2 || (y1 - i) == y2 || y1 == y2))
  2720.                 return true;
  2721.             else
  2722.             if((x1 - i) == x2 && ((x1 + i) == y2 || (y1 - i) == y2 || y1 == y2))
  2723.                 return true;
  2724.             else
  2725.             if(x1 == x2 && ((x1 + i) == y2 || (y1 - i) == y2 || y1 == y2))
  2726.                 return true;
  2727.                                 } catch(Exception ex){
  2728.         System.out.println("Exception in following, method : WithingDistance");
  2729.         }
  2730.         }
  2731.         return false;
  2732.     }
  2733.  
  2734.     private void resetLogout() {
  2735.         try {
  2736.             if(socketStream != null)
  2737.                 socketStream.close();
  2738.         }
  2739.         catch(Exception _ex) { }
  2740.         socketStream = null;
  2741.         alertHandler.alert = null;
  2742.             loggedIn = false;
  2743.             runClicked = true;
  2744.             musicOrb = false;
  2745.             restOrb = false;
  2746.             followPlayer = 0;
  2747. followNPC = 0;
  2748. followDistance = 1;
  2749.             prayClicked = false;
  2750.             xpClicked = false;
  2751.             drawXpBar = false;
  2752.         loginScreenState = 0;
  2753.         //myUsername = "";
  2754.         //myPassword = "";
  2755.         unlinkMRUNodes();
  2756.         sceneGraph.initToNull();
  2757.         for(int i = 0; i < 4; i++)
  2758.             aClass11Array1230[i].method210();
  2759.         System.gc();
  2760.         stopMidi();
  2761.         currentSong = -1;
  2762.         nextSong = -1;
  2763.         prevSong = 0;
  2764.     }
  2765.  
  2766.     private void charEditChangeGender() {
  2767.         charEditChanged = true;
  2768.         for(int j = 0; j < 7; j++) {
  2769.             charEditIdKit[j] = -1;
  2770.             for(int k = 0; k < IdentityKit.length; k++) {
  2771.                 if(IdentityKit.cache[k].notSelected || IdentityKit.cache[k].bodyPartID != j + (charEditGender ? 0 : 7))
  2772.                     continue;
  2773.                 charEditIdKit[j] = k;
  2774.                 break;
  2775.             }
  2776.         }
  2777.     }
  2778.  
  2779.     private void method46(int i, Stream stream) {
  2780.         while(stream.bitPosition + 21 < i * 8) {
  2781.             int k = stream.readBits(14);
  2782.             if(k == 16383)
  2783.                 break;
  2784.             if(npcArray[k] == null)
  2785.                 npcArray[k] = new Npc();
  2786.             Npc npc = npcArray[k];
  2787.             npcIndices[npcCount++] = k;
  2788.             npc.anInt1537 = loopCycle;
  2789.             int l = stream.readBits(5);
  2790.             if(l > 15)
  2791.                 l -= 32;
  2792.             int i1 = stream.readBits(5);
  2793.             if(i1 > 15)
  2794.                 i1 -= 32;
  2795.             int j1 = stream.readBits(1);
  2796.             npc.desc = NpcDef.forID(stream.readBits(14));//NPC FIX
  2797.             int k1 = stream.readBits(1);
  2798.             if(k1 == 1)
  2799.                 anIntArray894[anInt893++] = k;
  2800.             npc.anInt1540 = npc.desc.aByte68;
  2801.             npc.anInt1504 = npc.desc.getDegreesToTurn;
  2802.             npc.anInt1554 = npc.desc.walkForwardsAnim;
  2803.             npc.anInt1555 = npc.desc.walkBackwardsAnim;
  2804.             npc.anInt1556 = npc.desc.walkLeftAnim;
  2805.             npc.anInt1557 = npc.desc.walkRightAnim;
  2806.             npc.anInt1511 = npc.desc.standAnim;
  2807.             npc.setPos(myPlayer.smallX[0] + i1, myPlayer.smallY[0] + l, j1 == 1);
  2808.         }
  2809.         stream.finishBitAccess();
  2810.     }
  2811.  
  2812.     public void processGameLoop() {
  2813.         if(rsAlreadyLoaded || loadingError || genericLoadingError)
  2814.             return;
  2815.         loopCycle++;
  2816.         if(!loggedIn)
  2817.             processLoginScreenInput();
  2818.         else
  2819.             mainGameProcessor();
  2820.         processOnDemandQueue();
  2821.         if(isNoclipping) Noclip();
  2822.     }
  2823.  
  2824.     private void method47(boolean flag) {
  2825.         if(myPlayer.x >> 7 == destX && myPlayer.y >> 7 == destY)
  2826.             destX = 0;
  2827.         int j = playerCount;
  2828.         if(flag)
  2829.             j = 1;
  2830.         for(int l = 0; l < j; l++) {
  2831.             Player player;
  2832.             int i1;
  2833.             if(flag) {
  2834.                 player = myPlayer;
  2835.                 i1 = myPlayerIndex << 14;
  2836.             } else {
  2837.                 player = playerArray[playerIndices[l]];
  2838.                 i1 = playerIndices[l] << 14;
  2839.             }
  2840.             if(player == null || !player.isVisible())
  2841.                 continue;
  2842.             player.aBoolean1699 = (lowMem && playerCount > 50 || playerCount > 200) && !flag && player.anInt1517 == player.anInt1511;
  2843.             int j1 = player.x >> 7;
  2844.             int k1 = player.y >> 7;
  2845.             if(j1 < 0 || j1 >= 104 || k1 < 0 || k1 >= 104)
  2846.                 continue;
  2847.             if(player.aModel_1714 != null && loopCycle >= player.anInt1707 && loopCycle < player.anInt1708) {
  2848.                 player.aBoolean1699 = false;
  2849.                 player.anInt1709 = method42(plane, player.y, player.x);
  2850.                 sceneGraph.method286(plane, player.y, player, player.anInt1552, player.anInt1722, player.x, player.anInt1709, player.anInt1719, player.anInt1721, i1, player.anInt1720);
  2851.                 continue;
  2852.             }
  2853.             if((player.x & 0x7f) == 64 && (player.y & 0x7f) == 64) {
  2854.                 if(anIntArrayArray929[j1][k1] == anInt1265)
  2855.                     continue;
  2856.                 anIntArrayArray929[j1][k1] = anInt1265;
  2857.             }
  2858.             player.anInt1709 = method42(plane, player.y, player.x);
  2859.             sceneGraph.addEntityA(plane, player.anInt1552, player.anInt1709, i1, player.y, 60, player.x, player, player.aBoolean1541);
  2860.         }
  2861.     }
  2862.  
  2863.     private boolean promptUserForInput(RSInterface class9) {
  2864.         int j = class9.contentType;
  2865.         if(anInt900 == 2) {
  2866.             if(j == 201) {
  2867.                 inputTaken = true;
  2868.                 inputDialogState = 0;
  2869.                 messagePromptRaised = true;
  2870.                 promptInput = "";
  2871.                 friendsListAction = 1;
  2872.                 inputPromptTitle = "Enter name of friend to add to list";
  2873.             }
  2874.             if(j == 202) {
  2875.                 inputTaken = true;
  2876.                 inputDialogState = 0;
  2877.                 messagePromptRaised = true;
  2878.                 promptInput = "";
  2879.                 friendsListAction = 2;
  2880.                 inputPromptTitle = "Enter name of friend to delete from list";
  2881.             }
  2882.         }
  2883.         if(j == 205) {
  2884.             anInt1011 = 250;
  2885.             return true;
  2886.         }
  2887.         if(j == 501) {
  2888.             inputTaken = true;
  2889.             inputDialogState = 0;
  2890.             messagePromptRaised = true;
  2891.             promptInput = "";
  2892.             friendsListAction = 4;
  2893.             inputPromptTitle = "Enter name of player to add to list";
  2894.         }
  2895.         if(j == 502) {
  2896.             inputTaken = true;
  2897.             inputDialogState = 0;
  2898.             messagePromptRaised = true;
  2899.             promptInput = "";
  2900.             friendsListAction = 5;
  2901.             inputPromptTitle = "Enter name of player to delete from list";
  2902.         }
  2903.         if(j == 550) {
  2904.             inputTaken = true;
  2905.             inputDialogState = 0;
  2906.             messagePromptRaised = true;
  2907.             promptInput = "";
  2908.             friendsListAction = 6;
  2909.             inputPromptTitle = "Enter the name of the chat you wish to join";
  2910.         }
  2911.         if(j >= 300 && j <= 313) {
  2912.             int type = (j - 300) / 2;
  2913.             int direction = j & 1;
  2914.             int id = charEditIdKit[type];
  2915.             if(id != -1) {
  2916.                 do {
  2917.                     if(direction == 0 && --id < 0)
  2918.                         id = IdentityKit.length - 1;
  2919.                     if(direction == 1 && ++id >= IdentityKit.length)
  2920.                         id = 0;
  2921.                 } while(IdentityKit.cache[id].notSelected || IdentityKit.cache[id].bodyPartID != type + (charEditGender ? 0 : 7));
  2922.                 charEditIdKit[type] = id;
  2923.                 charEditChanged = true;
  2924.             }
  2925.         }
  2926.         if(j >= 314 && j <= 323) {
  2927.             int type = (j - 314) / 2;
  2928.             int direction = j & 1;
  2929.             int color = charEditColors[type];
  2930.             if(direction == 0 && --color < 0)
  2931.                 color = charEditColorChoises[type].length - 1;
  2932.             if(direction == 1 && ++color >= charEditColorChoises[type].length)
  2933.                 color = 0;
  2934.             charEditColors[type] = color;
  2935.             charEditChanged = true;
  2936.         }
  2937.         if(j == 324 && !charEditGender) {
  2938.             charEditGender = true;
  2939.             charEditChangeGender();
  2940.         }
  2941.         if(j == 325 && charEditGender) {
  2942.             charEditGender = false;
  2943.             charEditChangeGender();
  2944.         }
  2945.         if(j == 326) {
  2946.             stream.createFrame(101);
  2947.             stream.writeWordBigEndian(charEditGender ? 0 : 1);
  2948.             for(int i1 = 0; i1 < 7; i1++)
  2949.                 stream.writeWordBigEndian(charEditIdKit[i1]);
  2950.             for(int l1 = 0; l1 < 5; l1++)
  2951.                 stream.writeWordBigEndian(charEditColors[l1]);
  2952.             return true;
  2953.         }
  2954.         if(j == 613)
  2955.             canMute = !canMute;
  2956.         if(j >= 601 && j <= 612) {
  2957.             clearTopInterfaces();
  2958.             if(reportAbuseInput.length() > 0) {
  2959.                 stream.createFrame(218);
  2960.                 stream.writeQWord(TextClass.longForName(reportAbuseInput));
  2961.                 stream.writeWordBigEndian(j - 601);
  2962.                 stream.writeWordBigEndian(canMute ? 1 : 0);
  2963.             }
  2964.         }
  2965.         return false;
  2966.     }
  2967.  
  2968.     private void method49(Stream stream) {
  2969.         for(int j = 0; j < anInt893; j++) {
  2970.             int k = anIntArray894[j];
  2971.             Player player = playerArray[k];
  2972.             int l = stream.readUnsignedByte();
  2973.             if((l & 0x40) != 0)
  2974.                 l += stream.readUnsignedByte() << 8;
  2975.             method107(l, k, stream, player);
  2976.         }
  2977.     }
  2978.  
  2979.     //method50
  2980.     private void drawMapScenes(int y, int primaryColor, int x, int secondaryColor, int z) {
  2981.         int interactableObjectUID = sceneGraph.getWallObjectUID(z, x, y);
  2982.         if(interactableObjectUID != 0) {
  2983.             int l1 = sceneGraph.getIDTAGForXYZ(z, x, y, interactableObjectUID);
  2984.             int direction = l1 >> 6 & 3;
  2985.             //east = 0, south = 1, west = 2, north = 3
  2986.             int type = l1 & 0x1f;
  2987.             int color = primaryColor; //white
  2988.             if(interactableObjectUID > 0)
  2989.                 color = secondaryColor; //red
  2990.             int mapPixels[] = minimap.myPixels;
  2991.             int px = 24624 + x * 4 + (103 - y) * 512 * 4;
  2992.             int objectID = interactableObjectUID >> 14 & 0x7fff;
  2993.             ObjectDef object = ObjectDef.forID(objectID);
  2994.             if(object.mapSceneID != -1) {
  2995.                 Background indexedImage_2 = mapScenes[object.mapSceneID];
  2996.                 if(indexedImage_2 != null) {
  2997.                     int width = (object.sizeX * 4 - indexedImage_2.imgWidth) / 2;
  2998.                     int height = (object.sizeY * 4 - indexedImage_2.imgHeight) / 2;
  2999.                     indexedImage_2.drawBackground(48 + x * 4 + width, 48 + (104 - y - object.sizeY) * 4 + height);
  3000.                 }
  3001.             } else {
  3002.                 if(type == 0 || type == 2)
  3003.                     if(direction == 0) {
  3004.                         mapPixels[px] = color;
  3005.                         mapPixels[px + 512] = color;
  3006.                         mapPixels[px + 1024] = color;
  3007.                         mapPixels[px + 1536] = color;
  3008.                     } else if(direction == 1) {
  3009.                         mapPixels[px] = color;
  3010.                         mapPixels[px + 1] = color;
  3011.                         mapPixels[px + 2] = color;
  3012.                         mapPixels[px + 3] = color;
  3013.                     } else if(direction == 2) {
  3014.                         mapPixels[px + 3] = color;
  3015.                         mapPixels[px + 3 + 512] = color;
  3016.                         mapPixels[px + 3 + 1024] = color;
  3017.                         mapPixels[px + 3 + 1536] = color;
  3018.                     } else if(direction == 3) {
  3019.                         mapPixels[px + 1536] = color;
  3020.                         mapPixels[px + 1536 + 1] = color;
  3021.                         mapPixels[px + 1536 + 2] = color;
  3022.                         mapPixels[px + 1536 + 3] = color;
  3023.                     }
  3024.                 if(type == 3)
  3025.                     if(direction == 0)
  3026.                         mapPixels[px] = color;
  3027.                     else if(direction == 1)
  3028.                         mapPixels[px + 3] = color;
  3029.                     else if(direction == 2)
  3030.                         mapPixels[px + 3 + 1536] = color;
  3031.                     else if(direction == 3)
  3032.                         mapPixels[px + 1536] = color;
  3033.                 if(type == 2)
  3034.                     if(direction == 3) {
  3035.                         mapPixels[px] = color;
  3036.                         mapPixels[px + 512] = color;
  3037.                         mapPixels[px + 1024] = color;
  3038.                         mapPixels[px + 1536] = color;
  3039.                     } else if(direction == 0) {
  3040.                         mapPixels[px] = color;
  3041.                         mapPixels[px + 1] = color;
  3042.                         mapPixels[px + 2] = color;
  3043.                         mapPixels[px + 3] = color;
  3044.                     } else if(direction == 1) {
  3045.                         mapPixels[px + 3] = color;
  3046.                         mapPixels[px + 3 + 512] = color;
  3047.                         mapPixels[px + 3 + 1024] = color;
  3048.                         mapPixels[px + 3 + 1536] = color;
  3049.                     } else if(direction == 2) {
  3050.                         mapPixels[px + 1536] = color;
  3051.                         mapPixels[px + 1536 + 1] = color;
  3052.                         mapPixels[px + 1536 + 2] = color;
  3053.                         mapPixels[px + 1536 + 3] = color;
  3054.                     }
  3055.             }
  3056.         }
  3057.         interactableObjectUID = sceneGraph.getInteractableObjectUID(z, x, y);
  3058.         if(interactableObjectUID != 0) {
  3059.             int i2 = sceneGraph.getIDTAGForXYZ(z, x, y, interactableObjectUID);
  3060.             int type2 = i2 >> 6 & 3;
  3061.             int j3 = i2 & 0x1f;
  3062.             int objectID2 = interactableObjectUID >> 14 & 0x7fff;
  3063.             ObjectDef object2 = ObjectDef.forID(objectID2);
  3064.             if(object2.mapSceneID != -1) {
  3065.                 Background scene = mapScenes[object2.mapSceneID];
  3066.                 if(scene != null) {
  3067.                     int width2 = (object2.sizeX * 4 - scene.imgWidth) / 2;
  3068.                     int height2 = (object2.sizeY * 4 - scene.imgHeight) / 2;
  3069.                     scene.drawBackground(48 + x * 4 + width2, 48 + (104 - y - object2.sizeY) * 4 + height2);
  3070.                 }
  3071.             } else if(j3 == 9) {
  3072.                 int color2 = 0xeeeeee;
  3073.                 if(interactableObjectUID > 0)
  3074.                     color2 = 0xee0000;
  3075.                 int mapPixels2[] = minimap.myPixels;
  3076.                 int px2 = 24624 + x * 4 + (103 - y) * 512 * 4;
  3077.                 if(type2 == 0 || type2 == 2) {
  3078.                     mapPixels2[px2 + 1536] = color2;
  3079.                     mapPixels2[px2 + 1024 + 1] = color2;
  3080.                     mapPixels2[px2 + 512 + 2] = color2;
  3081.                     mapPixels2[px2 + 3] = color2;
  3082.                 } else {
  3083.                     mapPixels2[px2] = color2;
  3084.                     mapPixels2[px2 + 512 + 1] = color2;
  3085.                     mapPixels2[px2 + 1024 + 2] = color2;
  3086.                     mapPixels2[px2 + 1536 + 3] = color2;
  3087.                 }
  3088.             }
  3089.         }
  3090.         interactableObjectUID = sceneGraph.getGroundDecorationUID(z, x, y);
  3091.         if(interactableObjectUID != 0) {
  3092.             int j2 = interactableObjectUID >> 14 & 0x7fff;
  3093.             ObjectDef class46 = ObjectDef.forID(j2);
  3094.             if(class46.mapSceneID != -1) {
  3095.                 Background background = mapScenes[class46.mapSceneID];
  3096.                 if(background != null) {
  3097.                     int i4 = (class46.sizeX * 4 - background.imgWidth) / 2;
  3098.                     int j4 = (class46.sizeY * 4 - background.imgHeight) / 2;
  3099.                     background.drawBackground(48 + x * 4 + i4, 48 + (104 - y - class46.sizeY) * 4 + j4);
  3100.                 }
  3101.             }
  3102.         }
  3103.     }
  3104.  
  3105.     private void loadTitleScreen() {
  3106.         //titleButton = new Sprite(titleStreamLoader, "titlebutton", 0);
  3107.         aBackgroundArray1152s = new Background[12];
  3108.         int j = 0;
  3109.         try {
  3110.             j = Integer.parseInt(getParameter("fl_icon"));
  3111.         } catch(Exception _ex) {
  3112.         }
  3113.         if(j == 0) {
  3114.             for(int k = 0; k < 12; k++)
  3115.                 aBackgroundArray1152s[k] = new Background(titleStreamLoader, "runes", k);
  3116.  
  3117.         } else {
  3118.             for(int l = 0; l < 12; l++)
  3119.                 aBackgroundArray1152s[l] = new Background(titleStreamLoader, "runes", 12 + (l & 3));
  3120.  
  3121.         }
  3122.         aSprite_1201 = new Sprite(128, 265);
  3123.         aSprite_1202 = new Sprite(128, 265);
  3124.         System.arraycopy(leftSideFlame.pixels, 0, aSprite_1201.myPixels, 0, 33920);
  3125.  
  3126.         System.arraycopy(rightSideFlame.pixels, 0, aSprite_1202.myPixels, 0, 33920);
  3127.  
  3128.         anIntArray851 = new int[256];
  3129.         for(int k1 = 0; k1 < 64; k1++)
  3130.             anIntArray851[k1] = k1 * 0x40000;
  3131.  
  3132.         for(int l1 = 0; l1 < 64; l1++)
  3133.             anIntArray851[l1 + 64] = 0xff0000 + 1024 * l1;
  3134.  
  3135.         for(int i2 = 0; i2 < 64; i2++)
  3136.             anIntArray851[i2 + 128] = 0xffff00 + 4 * i2;
  3137.  
  3138.         for(int j2 = 0; j2 < 64; j2++)
  3139.             anIntArray851[j2 + 192] = 0xffffff;
  3140.  
  3141.         anIntArray852 = new int[256];
  3142.         for(int k2 = 0; k2 < 64; k2++)
  3143.             anIntArray852[k2] = k2 * 1024;
  3144.  
  3145.         for(int l2 = 0; l2 < 64; l2++)
  3146.             anIntArray852[l2 + 64] = 65280 + 4 * l2;
  3147.  
  3148.         for(int i3 = 0; i3 < 64; i3++)
  3149.             anIntArray852[i3 + 128] = 65535 + 0x40000 * i3;
  3150.  
  3151.         for(int j3 = 0; j3 < 64; j3++)
  3152.             anIntArray852[j3 + 192] = 0xffffff;
  3153.  
  3154.         anIntArray853 = new int[256];
  3155.         for(int k3 = 0; k3 < 64; k3++)
  3156.             anIntArray853[k3] = k3 * 4;
  3157.  
  3158.         for(int l3 = 0; l3 < 64; l3++)
  3159.             anIntArray853[l3 + 64] = 255 + 0x40000 * l3;
  3160.  
  3161.         for(int i4 = 0; i4 < 64; i4++)
  3162.             anIntArray853[i4 + 128] = 0xff00ff + 1024 * i4;
  3163.  
  3164.         for(int j4 = 0; j4 < 64; j4++)
  3165.             anIntArray853[j4 + 192] = 0xffffff;
  3166.  
  3167.         //anIntArray850 = new int[256];
  3168.         anIntArray1190 = new int[32768];
  3169.         anIntArray1191 = new int[32768];
  3170.         randomizeBackground(null);
  3171.         //anIntArray828 = new int[32768];
  3172.         //anIntArray829 = new int[32768];
  3173.         if(!aBoolean831) {
  3174.             drawFlames = true;
  3175.             aBoolean831 = true;
  3176.             startRunnable(this, 2);
  3177.         }
  3178.     }
  3179.  
  3180.     public static void main(String args[]) {
  3181.         try {
  3182.             nodeID = 10;
  3183.             portOff = 0;
  3184.             setHighMem(); //sets high or low detail
  3185.             isMembers = true;
  3186.             SignLink.storeid = 32;
  3187.             SignLink.startpriv(InetAddress.getLocalHost());
  3188.             instance = new Client();
  3189.             instance.createClientFrame(765, 503);
  3190.         } catch(Exception e) {
  3191.             e.printStackTrace();
  3192.         }
  3193.     }
  3194.    
  3195.     public static Client instance;
  3196.  
  3197. private void loadingStages()
  3198.     {
  3199.         if(lowMem && loadingStage == 2 && ObjectManager.anInt131 != plane)
  3200.         {
  3201.             mainGameArea.initDrawingArea();
  3202.             cacheSprite[2].drawSprite(8, 9);
  3203.             mainGameArea.drawGraphics(4, 4, super.graphics);
  3204.             loadingStage = 1;
  3205.             aLong824 = System.currentTimeMillis();
  3206.         }
  3207.         if(loadingStage == 1)
  3208.         {
  3209.             int j = method54();
  3210.             if(j != 0 && System.currentTimeMillis() - aLong824 > 0x57e40L)
  3211.             {
  3212.                 SignLink.reporterror(myUsername + " glcfb " + aLong1215 + "," + j + "," + lowMem + "," + decompressors[0] + "," + onDemandFetcher.getNodeCount() + "," + plane + "," + anInt1069 + "," + anInt1070);
  3213.                 aLong824 = System.currentTimeMillis();
  3214.             }
  3215.         }
  3216.         if(loadingStage == 2 && plane != anInt985)
  3217.         {
  3218.             anInt985 = plane;
  3219.             method24(plane);
  3220.         }
  3221.     }
  3222.  
  3223.     private int method54() {
  3224.         for(int i = 0; i < terrainData.length; i++) {
  3225.             if(terrainData[i] == null && terrainIndices[i] != -1)
  3226.                 return -1;
  3227.             if(aByteArrayArray1247[i] == null && anIntArray1236[i] != -1)
  3228.                 return -2;
  3229.         }
  3230.         boolean flag = true;
  3231.         for(int j = 0; j < terrainData.length; j++) {
  3232.             byte abyte0[] = aByteArrayArray1247[j];
  3233.             if(abyte0 != null) {
  3234.                 int k = (mapCoordinates[j] >> 8) * 64 - baseX;
  3235.                 int l = (mapCoordinates[j] & 0xff) * 64 - baseY;
  3236.                 if(loadGeneratedMap) {
  3237.                     k = 10;
  3238.                     l = 10;
  3239.                 }
  3240.                 flag &= ObjectManager.method189(k, abyte0, l);
  3241.             }
  3242.         }
  3243.         if(!flag)
  3244.             return -3;
  3245.         if(aBoolean1080) {
  3246.             return -4;
  3247.         } else {
  3248.             loadingStage = 2;
  3249.             ObjectManager.anInt131 = plane;
  3250.             method22();
  3251.             stream.createFrame(121);
  3252.             return 0;
  3253.         }
  3254.     }
  3255.    
  3256.     //TODO rename
  3257.     private void method55() {
  3258.         for(Projectile class30_sub2_sub4_sub4 = (Projectile)aClass19_1013.reverseGetFirst(); class30_sub2_sub4_sub4 != null; class30_sub2_sub4_sub4 = (Projectile)aClass19_1013.reverseGetNext())
  3259.             if(class30_sub2_sub4_sub4.anInt1597 != plane || loopCycle > class30_sub2_sub4_sub4.anInt1572)
  3260.                 class30_sub2_sub4_sub4.unlink();
  3261.             else
  3262.             if(loopCycle >= class30_sub2_sub4_sub4.anInt1571)
  3263.             {
  3264.                 if(class30_sub2_sub4_sub4.anInt1590 > 0)
  3265.                 {
  3266.                     Npc npc = npcArray[class30_sub2_sub4_sub4.anInt1590 - 1];
  3267.                     if(npc != null && npc.x >= 0 && npc.x < 13312 && npc.y >= 0 && npc.y < 13312)
  3268.                         class30_sub2_sub4_sub4.method455(loopCycle, npc.y, method42(class30_sub2_sub4_sub4.anInt1597, npc.y, npc.x) - class30_sub2_sub4_sub4.anInt1583, npc.x);
  3269.                 }
  3270.                 if(class30_sub2_sub4_sub4.anInt1590 < 0)
  3271.                 {
  3272.                     int j = -class30_sub2_sub4_sub4.anInt1590 - 1;
  3273.                     Player player;
  3274.                     if(j == unknownInt10)
  3275.                         player = myPlayer;
  3276.                     else
  3277.                         player = playerArray[j];
  3278.                     if(player != null && player.x >= 0 && player.x < 13312 && player.y >= 0 && player.y < 13312)
  3279.                         class30_sub2_sub4_sub4.method455(loopCycle, player.y, method42(class30_sub2_sub4_sub4.anInt1597, player.y, player.x) - class30_sub2_sub4_sub4.anInt1583, player.x);
  3280.                 }
  3281.                 class30_sub2_sub4_sub4.method456(animationTimePassed);
  3282.                 sceneGraph.addEntityA(plane, class30_sub2_sub4_sub4.anInt1595, (int)class30_sub2_sub4_sub4.aDouble1587, -1, (int)class30_sub2_sub4_sub4.aDouble1586, 60, (int)class30_sub2_sub4_sub4.aDouble1585, class30_sub2_sub4_sub4, false);
  3283.             }
  3284.  
  3285.     }
  3286.  
  3287.     public AppletContext getAppletContext()
  3288.     {
  3289.         if(SignLink.mainapp != null)
  3290.             return SignLink.mainapp.getAppletContext();
  3291.         else
  3292.             return super.getAppletContext();
  3293.     }
  3294.  
  3295.     private void drawLogo() {
  3296.         byte abyte0[] = titleStreamLoader.getDataForName("title.dat");
  3297.         Sprite sprite = new Sprite(abyte0, this);
  3298.         sprite = new Sprite("Sprites/background.png", 764, 502);
  3299.             leftSideFlame.initDrawingArea();
  3300.             sprite.method346(0, 0);
  3301.             rightSideFlame.initDrawingArea();
  3302.             sprite.method346(-637, 0);
  3303.             aRSImageProducer_1107.initDrawingArea();
  3304.             sprite.method346(-128, 0);
  3305.             aRSImageProducer_1108.initDrawingArea();
  3306.             sprite.method346(-202, -371);
  3307.             loginScreenArea.initDrawingArea();
  3308.             sprite.method346(-202, -171);
  3309.             gameLogo.initDrawingArea();
  3310.             sprite.method346(0, -265);
  3311.             aRSImageProducer_1113.initDrawingArea();
  3312.             sprite.method346(-562, -265);
  3313.             aRSImageProducer_1114.initDrawingArea();
  3314.             sprite.method346(-128, -171);
  3315.             aRSImageProducer_1115.initDrawingArea();
  3316.             sprite.method346(-562, -171);
  3317.             int ai[] = new int[sprite.myWidth];
  3318.             for(int j = 0; j < sprite.myHeight; j++) {
  3319.                 for(int k = 0; k < sprite.myWidth; k++)
  3320.                     ai[k] = sprite.myPixels[(sprite.myWidth - k - 1) + sprite.myWidth * j];
  3321.                 System.arraycopy(ai, 0, sprite.myPixels, sprite.myWidth * j, sprite.myWidth);
  3322.             }
  3323.             /*leftSideFlame.initDrawingArea();
  3324.             sprite.method346(382, 0);
  3325.             rightSideFlame.initDrawingArea();
  3326.             sprite.method346(-255, 0);
  3327.             aRSImageProducer_1107.initDrawingArea();
  3328.             sprite.method346(254, 0);
  3329.             aRSImageProducer_1108.initDrawingArea();
  3330.             sprite.method346(180, -371);
  3331.             loginScreenArea.initDrawingArea();
  3332.             sprite.method346(180, -171);
  3333.             gameLogo.initDrawingArea();
  3334.             sprite.method346(382, -265);
  3335.             aRSImageProducer_1113.initDrawingArea();
  3336.             sprite.method346(-180, -265);
  3337.             aRSImageProducer_1114.initDrawingArea();
  3338.             sprite.method346(254, -171);
  3339.             aRSImageProducer_1115.initDrawingArea();
  3340.             sprite.method346(-180, -171);*/
  3341.             sprite = new Sprite(titleStreamLoader, "logo", 0);
  3342.                 aRSImageProducer_1107.initDrawingArea();
  3343.             //sprite.drawSprite(382 - sprite.myWidth / 2 - 128, 18);
  3344.         sprite = null;
  3345.         System.gc();
  3346.     }
  3347.  
  3348.     private void processOnDemandQueue()
  3349.     {
  3350.         do
  3351.         {
  3352.             OnDemandData onDemandData;
  3353.             do
  3354.             {
  3355.                 onDemandData = onDemandFetcher.getNextNode();
  3356.                 if(onDemandData == null)
  3357.                     return;
  3358.                 if(onDemandData.dataType == 0)
  3359.                 {
  3360.                     Model.method460(onDemandData.buffer, onDemandData.ID);
  3361.                     needDrawTabArea = true;
  3362.                     if(backDialogID != -1)
  3363.                         inputTaken = true;
  3364.                 }
  3365.                 //if(onDemandData.dataType == 1 && onDemandData.buffer != null)
  3366.                    // Class36.method529(onDemandData.buffer, onDemandData.ID);
  3367.                 if(onDemandData.dataType == 2 && onDemandData.ID == nextSong && onDemandData.buffer != null)
  3368.                     saveMidi(songChanging, onDemandData.buffer);
  3369.                 if(onDemandData.dataType == 3 && loadingStage == 1)
  3370.                 {
  3371.                     //System.out.println(onDemandData.ID);
  3372.                     try {
  3373.                     writeFile(onDemandData.buffer, "./maps/" + onDemandData.ID + ".dat");
  3374.                     } catch (Exception e) {}
  3375.                     for(int i = 0; i < terrainData.length; i++)
  3376.                     {
  3377.                         if(terrainIndices[i] == onDemandData.ID)
  3378.                         {
  3379.                             terrainData[i] = onDemandData.buffer;
  3380.                             if(onDemandData.buffer == null) {
  3381.                                 terrainIndices[i] = -1;
  3382.                             }
  3383.                             break;
  3384.                         }
  3385.                         if(anIntArray1236[i] != onDemandData.ID)
  3386.                             continue;
  3387.                         aByteArrayArray1247[i] = onDemandData.buffer;
  3388.                         if(onDemandData.buffer == null) {
  3389.                             anIntArray1236[i] = -1;
  3390.                         }
  3391.                         break;
  3392.                     }
  3393.  
  3394.                 }
  3395.             } while(onDemandData.dataType != 93 || !onDemandFetcher.method564(onDemandData.ID));
  3396.             ObjectManager.method173(new Stream(onDemandData.buffer), onDemandFetcher);
  3397.         } while(true);
  3398.     }
  3399.  
  3400.     /*private void calcFlamesPosition()
  3401.     {
  3402.         char c = '\u0100';
  3403.         for(int j = 10; j < 117; j++)
  3404.         {
  3405.             int k = (int)(Math.random() * 100D);
  3406.             if(k < 50)
  3407.                 anIntArray828[j + (c - 2 << 7)] = 255;
  3408.         }
  3409.         for(int l = 0; l < 100; l++)
  3410.         {
  3411.             int i1 = (int)(Math.random() * 124D) + 2;
  3412.             int k1 = (int)(Math.random() * 128D) + 128;
  3413.             int k2 = i1 + (k1 << 7);
  3414.             anIntArray828[k2] = 192;
  3415.         }
  3416.  
  3417.         for(int j1 = 1; j1 < c - 1; j1++)
  3418.         {
  3419.             for(int l1 = 1; l1 < 127; l1++)
  3420.             {
  3421.                 int l2 = l1 + (j1 << 7);
  3422.                 anIntArray829[l2] = (anIntArray828[l2 - 1] + anIntArray828[l2 + 1] + anIntArray828[l2 - 128] + anIntArray828[l2 + 128]) / 4;
  3423.             }
  3424.  
  3425.         }
  3426.  
  3427.         anInt1275 += 128;
  3428.         if(anInt1275 > anIntArray1190.length)
  3429.         {
  3430.             anInt1275 -= anIntArray1190.length;
  3431.             int i2 = (int)(Math.random() * 12D);
  3432.             randomizeBackground(aBackgroundArray1152s[i2]);
  3433.         }
  3434.         for(int j2 = 1; j2 < c - 1; j2++)
  3435.         {
  3436.             for(int i3 = 1; i3 < 127; i3++)
  3437.             {
  3438.                 int k3 = i3 + (j2 << 7);
  3439.                 int i4 = anIntArray829[k3 + 128] - anIntArray1190[k3 + anInt1275 & anIntArray1190.length - 1] / 5;
  3440.                 if(i4 < 0)
  3441.                     i4 = 0;
  3442.                 anIntArray828[k3] = i4;
  3443.             }
  3444.  
  3445.         }
  3446.  
  3447.         System.arraycopy(anIntArray969, 1, anIntArray969, 0, c - 1);
  3448.  
  3449.         anIntArray969[c - 1] = (int)(Math.sin((double)loopCycle / 14D) * 16D + Math.sin((double)loopCycle / 15D) * 14D + Math.sin((double)loopCycle / 16D) * 12D);
  3450.         if(anInt1040 > 0)
  3451.             anInt1040 -= 4;
  3452.         if(anInt1041 > 0)
  3453.             anInt1041 -= 4;
  3454.         if(anInt1040 == 0 && anInt1041 == 0)
  3455.         {
  3456.             int l3 = (int)(Math.random() * 2000D);
  3457.             if(l3 == 0)
  3458.                 anInt1040 = 1024;
  3459.             if(l3 == 1)
  3460.                 anInt1041 = 1024;
  3461.         }
  3462.     }*/
  3463.  
  3464.     private boolean saveWave(byte abyte0[], int i)
  3465.     {
  3466.         return abyte0 == null || SignLink.wavesave(abyte0, i);
  3467.     }
  3468.  
  3469.     private void method60(int i)
  3470.     {
  3471.         RSInterface class9 = RSInterface.interfaceCache[i];
  3472.         for(int j = 0; j < class9.children.length; j++)
  3473.         {
  3474.             if(class9.children[j] == -1)
  3475.                 break;
  3476.             RSInterface class9_1 = RSInterface.interfaceCache[class9.children[j]];
  3477.             if(class9_1.interfaceType == 1)
  3478.                 method60(class9_1.id);
  3479.             class9_1.animationLength = 0;
  3480.             class9_1.animationDelay = 0;
  3481.         }
  3482.     }
  3483.  
  3484.     private void drawHeadIcon()
  3485.     {
  3486.         if(anInt855 != 2)
  3487.             return;
  3488.         calcEntityScreenPos((anInt934 - baseX << 7) + anInt937, anInt936 * 2, (anInt935 - baseY << 7) + anInt938);
  3489.         if(spriteDrawX > -1 && loopCycle % 20 < 10)
  3490.             headIconsHint[0].drawSprite(spriteDrawX - 12, spriteDrawY - 28);
  3491.     }
  3492.  
  3493.     boolean restOpacityUp = true;
  3494.     public static int[][] charEditColorChoises;
  3495.     private void mainGameProcessor()
  3496.     {
  3497.         if(restOrb) {
  3498.             if(restOpacityUp)
  3499.                 restOpacity+=2;
  3500.             else
  3501.                 restOpacity-=2;
  3502.         }
  3503.         if(restOpacity == 125)
  3504.             restOpacityUp = true;
  3505.         if(restOpacity == 225)
  3506.             restOpacityUp = false;
  3507.  
  3508.         if(anInt1104 > 1)
  3509.             anInt1104--;
  3510.         if(anInt1011 > 0)
  3511.             anInt1011--;
  3512.         if(anInt1500 != 0 || anInt1044 != 0 || anInt1129 != 0) {
  3513.             if(anInt1501 < 100) {
  3514.                 anInt1501++;
  3515.                 if(anInt1501 == 100) {
  3516.                     if(anInt1500 != 0) {
  3517.                         inputTaken = true;
  3518.                     }
  3519.                     if(anInt1044 != 0) {
  3520.                         needDrawTabArea = true;
  3521.                     }
  3522.                 }
  3523.             }
  3524.         } else if(anInt1501 > 0) {
  3525.             anInt1501--;
  3526.         }
  3527.         for(int j = 0; j < 5; j++)
  3528.             if(!parsePacket())
  3529.                 break;
  3530.         if(!loggedIn)
  3531.             return;
  3532.             try {
  3533.              canWalkDelay--;
  3534.         if(followNPC > 0)
  3535.         {
  3536.             Npc n = npcArray[followNPC];
  3537.             if(n != null)
  3538.             {
  3539.                 if(!withinDistance(myPlayer.smallX[0], myPlayer.smallY[0], n.smallX[0], n.smallY[0], followDistance))
  3540.                 {
  3541.                     doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, n.smallY[0], myPlayer.smallX[0], false, n.smallX[0]);
  3542.                 }
  3543.             }
  3544.         }
  3545.         else if(followPlayer > 0 && canWalkDelay <= 0)
  3546.         {
  3547.             Player p = playerArray[followPlayer];
  3548.             if(p != null)
  3549.             {
  3550.                 int dis = getDis(myPlayer.smallX[0], myPlayer.smallY[0], p.smallX[0], p.smallY[0]);
  3551.                 if(dis > followDistance)
  3552.                 {
  3553.                     doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], followDistance, 0, p.smallY[0], myPlayer.smallX[0], false, p.smallX[0]);
  3554.                     canWalkDelay = 30;
  3555.                 }
  3556.                 else if(dis == 0)
  3557.                 {
  3558.                     int rnd = random(4);
  3559.                     if(rnd == 0)
  3560.                     {
  3561.                         doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, p.smallY[0], myPlayer.smallX[0], false, p.smallX[0] - 2);
  3562.                     }
  3563.                     else if(rnd == 1)
  3564.                     {
  3565.                         doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, p.smallY[0], myPlayer.smallX[0], false, p.smallX[0] + 2);
  3566.                     }
  3567.                     else if(rnd == 2)
  3568.                     {
  3569.                         doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, p.smallY[0] - 2, myPlayer.smallX[0], false, p.smallX[0]);
  3570.                     }
  3571.                     else if(rnd == 3)
  3572.                     {
  3573.                         doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, p.smallY[0] + 2, myPlayer.smallX[0], false, p.smallX[0]);
  3574.                     }
  3575.                     canWalkDelay = 60;
  3576.                 }
  3577.             }
  3578.         }
  3579.         } catch(Exception ex){
  3580.         System.out.println("Exception in following, method : in process.)");
  3581.         }
  3582.         synchronized(mouseDetection.syncObject)
  3583.         {
  3584.             if(flagged)
  3585.             {
  3586.                 if(super.clickMode3 != 0 || mouseDetection.coordsIndex >= 40)
  3587.                 {
  3588.                     stream.createFrame(45);
  3589.                     stream.writeWordBigEndian(0);
  3590.                     int j2 = stream.currentOffset;
  3591.                     int j3 = 0;
  3592.                     for(int j4 = 0; j4 < mouseDetection.coordsIndex; j4++)
  3593.                     {
  3594.                         if(j2 - stream.currentOffset >= 240)
  3595.                             break;
  3596.                         j3++;
  3597.                         int l4 = mouseDetection.coordsY[j4];
  3598.                         if(l4 < 0)
  3599.                             l4 = 0;
  3600.                         else
  3601.                         if(l4 > 502)
  3602.                             l4 = 502;
  3603.                         int k5 = mouseDetection.coordsX[j4];
  3604.                         if(k5 < 0)
  3605.                             k5 = 0;
  3606.                         else
  3607.                         if(k5 > 764)
  3608.                             k5 = 764;
  3609.                         int i6 = l4 * 765 + k5;
  3610.                         if(mouseDetection.coordsY[j4] == -1 && mouseDetection.coordsX[j4] == -1)
  3611.                         {
  3612.                             k5 = -1;
  3613.                             l4 = -1;
  3614.                             i6 = 0x7ffff;
  3615.                         }
  3616.                         if(k5 == anInt1237 && l4 == anInt1238)
  3617.                         {
  3618.                             if(anInt1022 < 2047)
  3619.                                 anInt1022++;
  3620.                         } else
  3621.                         {
  3622.                             int j6 = k5 - anInt1237;
  3623.                             anInt1237 = k5;
  3624.                             int k6 = l4 - anInt1238;
  3625.                             anInt1238 = l4;
  3626.                             if(anInt1022 < 8 && j6 >= -32 && j6 <= 31 && k6 >= -32 && k6 <= 31)
  3627.                             {
  3628.                                 j6 += 32;
  3629.                                 k6 += 32;
  3630.                                 stream.writeWord((anInt1022 << 12) + (j6 << 6) + k6);
  3631.                                 anInt1022 = 0;
  3632.                             } else
  3633.                             if(anInt1022 < 8)
  3634.                             {
  3635.                                 stream.writeDWordBigEndian(0x800000 + (anInt1022 << 19) + i6);
  3636.                                 anInt1022 = 0;
  3637.                             } else
  3638.                             {
  3639.                                 stream.writeDWord(0xc0000000 + (anInt1022 << 19) + i6);
  3640.                                 anInt1022 = 0;
  3641.                             }
  3642.                         }
  3643.                     }
  3644.  
  3645.                     stream.writeBytes(stream.currentOffset - j2);
  3646.                     if(j3 >= mouseDetection.coordsIndex)
  3647.                     {
  3648.                         mouseDetection.coordsIndex = 0;
  3649.                     } else
  3650.                     {
  3651.                         mouseDetection.coordsIndex -= j3;
  3652.                         for(int i5 = 0; i5 < mouseDetection.coordsIndex; i5++)
  3653.                         {
  3654.                             mouseDetection.coordsX[i5] = mouseDetection.coordsX[i5 + j3];
  3655.                             mouseDetection.coordsY[i5] = mouseDetection.coordsY[i5 + j3];
  3656.                         }
  3657.  
  3658.                     }
  3659.                 }
  3660.             } else
  3661.             {
  3662.                 mouseDetection.coordsIndex = 0;
  3663.             }
  3664.         }
  3665.         if(super.clickMode3 != 0)
  3666.         {
  3667.             long l = (super.saveClickTime - aLong1220) / 50L;
  3668.             if(l > 4095L)
  3669.                 l = 4095L;
  3670.             aLong1220 = super.saveClickTime;
  3671.             int k2 = super.saveClickY;
  3672.             if(k2 < 0)
  3673.                 k2 = 0;
  3674.             else
  3675.             if(k2 > 502)
  3676.                 k2 = 502;
  3677.             int k3 = super.saveClickX;
  3678.             if(k3 < 0)
  3679.                 k3 = 0;
  3680.             else
  3681.             if(k3 > 764)
  3682.                 k3 = 764;
  3683.             int k4 = k2 * 765 + k3;
  3684.             int j5 = 0;
  3685.             if(super.clickMode3 == 2)
  3686.                 j5 = 1;
  3687.             int l5 = (int)l;
  3688.             stream.createFrame(241);
  3689.             stream.writeDWord((l5 << 20) + (j5 << 19) + k4);
  3690.         }
  3691.         if(anInt1016 > 0)
  3692.             anInt1016--;
  3693.         if(super.keyArray[1] == 1 || super.keyArray[2] == 1 || super.keyArray[3] == 1 || super.keyArray[4] == 1)
  3694.             aBoolean1017 = true;
  3695.         if(aBoolean1017 && anInt1016 <= 0)
  3696.         {
  3697.             anInt1016 = 20;
  3698.             aBoolean1017 = false;
  3699.             stream.createFrame(86);
  3700.             stream.writeWord(anInt1184);
  3701.             stream.method432(minimapInt1);
  3702.         }
  3703.         if(super.awtFocus && !aBoolean954)
  3704.         {
  3705.             aBoolean954 = true;
  3706.             stream.createFrame(3);
  3707.             stream.writeWordBigEndian(1);
  3708.         }
  3709.         if(!super.awtFocus && aBoolean954)
  3710.         {
  3711.             aBoolean954 = false;
  3712.             stream.createFrame(3);
  3713.             stream.writeWordBigEndian(0);
  3714.         }
  3715.         loadingStages();
  3716.         method115();
  3717.         method90();
  3718.         anInt1009++;
  3719.         if(anInt1009 > 750)
  3720.             dropClient();
  3721.         method114();
  3722.         method95();
  3723.         method38();
  3724.        
  3725.         animationTimePassed++;
  3726.         if(crossType != 0)
  3727.         {
  3728.             crossIndex += 20;
  3729.             if(crossIndex >= 400)
  3730.                 crossType = 0;
  3731.         }
  3732.         if(atInventoryInterfaceType != 0)
  3733.         {
  3734.             atInventoryLoopCycle++;
  3735.             if(atInventoryLoopCycle >= 15)
  3736.             {
  3737.                 if(atInventoryInterfaceType == 2)
  3738.                     needDrawTabArea = true;
  3739.                 if(atInventoryInterfaceType == 3)
  3740.                     inputTaken = true;
  3741.                 atInventoryInterfaceType = 0;
  3742.             }
  3743.         }
  3744.         if(activeInterfaceType != 0)
  3745.         {
  3746.             anInt989++;
  3747.             if(super.mouseX > anInt1087 + 5 || super.mouseX < anInt1087 - 5 || super.mouseY > anInt1088 + 5 || super.mouseY < anInt1088 - 5)
  3748.                 aBoolean1242 = true;
  3749.             if(super.clickMode2 == 0)
  3750.             {
  3751.                 if(activeInterfaceType == 2)
  3752.                     needDrawTabArea = true;
  3753.                 if(activeInterfaceType == 3)
  3754.                     inputTaken = true;
  3755.                 activeInterfaceType = 0;
  3756.                 if(aBoolean1242 && anInt989 >= 10) //5 for lower switches
  3757.                 {
  3758.                     processRightClick();
  3759.                     lastActiveInvInterface = -1;
  3760.                     if(lastActiveInvInterface == anInt1084 && mouseInvInterfaceIndex != anInt1085)
  3761.                     {
  3762.                         RSInterface class9 = RSInterface.interfaceCache[anInt1084];
  3763.                         int j1 = 0;
  3764.                         if(anInt913 == 1 && class9.contentType == 206)
  3765.                             j1 = 1;
  3766.                         if(class9.inventory[mouseInvInterfaceIndex] <= 0)
  3767.                             j1 = 0;
  3768.                         if(class9.deletesTargetSlot)
  3769.                         {
  3770.                             int l2 = anInt1085;
  3771.                             int l3 = mouseInvInterfaceIndex;
  3772.                             class9.inventory[l3] = class9.inventory[l2];
  3773.                             class9.inventoryValue[l3] = class9.inventoryValue[l2];
  3774.                             class9.inventory[l2] = -1;
  3775.                             class9.inventoryValue[l2] = 0;
  3776.                         } else
  3777.                         if(j1 == 1)
  3778.                         {
  3779.                             int i3 = anInt1085;
  3780.                             for(int i4 = mouseInvInterfaceIndex; i3 != i4;)
  3781.                                 if(i3 > i4)
  3782.                                 {
  3783.                                     class9.swapInventoryItems(i3, i3 - 1);
  3784.                                     i3--;
  3785.                                 } else
  3786.                                 if(i3 < i4)
  3787.                                 {
  3788.                                     class9.swapInventoryItems(i3, i3 + 1);
  3789.                                     i3++;
  3790.                                 }
  3791.  
  3792.                         } else
  3793.                         {
  3794.                             class9.swapInventoryItems(anInt1085, mouseInvInterfaceIndex);
  3795.                         }
  3796.                         stream.createFrame(214);
  3797.                         stream.method433(anInt1084);
  3798.                         stream.method424(j1);
  3799.                         stream.method433(anInt1085);
  3800.                         stream.method431(mouseInvInterfaceIndex);
  3801.                     }
  3802.                 } else
  3803.                 if((anInt1253 == 1 || menuHasAddFriend(menuActionRow - 1)) && menuActionRow > 2)
  3804.                     determineMenuSize();
  3805.                 else
  3806.                 if(menuActionRow > 0)
  3807.                     doAction(menuActionRow - 1);
  3808.                 atInventoryLoopCycle = 10;
  3809.                 super.clickMode3 = 0;
  3810.             }
  3811.         }
  3812.         if(WorldController.anInt470 != -1)
  3813.         {
  3814.             int k = WorldController.anInt470;
  3815.             int k1 = WorldController.anInt471;
  3816.             boolean flag = doWalkTo(0, 0, 0, 0, myPlayer.smallY[0], 0, 0, k1, myPlayer.smallX[0], true, k);
  3817.             WorldController.anInt470 = -1;
  3818.             if(flag)
  3819.             {
  3820.                 crossX = super.saveClickX - 4;
  3821.                 crossY = super.saveClickY - 4;
  3822.                 crossType = 1;
  3823.                 crossIndex = 0;
  3824.             }
  3825.         }
  3826.         if(super.clickMode3 == 1 && chatBoxMessage != null)
  3827.         {
  3828.             chatBoxMessage = null;
  3829.             inputTaken = true;
  3830.             super.clickMode3 = 0;
  3831.         }
  3832.         if(!processMenuClick()) {
  3833.             processMainScreenClick();
  3834.             processTabClick();
  3835.             processChatModeClick();
  3836.         }
  3837.         if(super.clickMode2 == 1 || super.clickMode3 == 1)
  3838.             anInt1213++;
  3839.         if(anInt1500 != 0 || anInt1044 != 0 || anInt1129 != 0) {
  3840.             if(anInt1501 < 100) {
  3841.                 anInt1501++;
  3842.                 if(anInt1501 == 100) {
  3843.                     if(anInt1500 != 0) {
  3844.                         inputTaken = true;
  3845.                     }
  3846.                     if(anInt1044 != 0) {
  3847.                         needDrawTabArea = true;
  3848.                     }
  3849.                 }
  3850.             }
  3851.         } else if(anInt1501 > 0) {
  3852.             anInt1501--;
  3853.         }
  3854.         if(loadingStage == 2)
  3855.             method108();
  3856.         if(loadingStage == 2 && aBoolean1160)
  3857.             calcCameraPos();
  3858.         for(int i1 = 0; i1 < 5; i1++)
  3859.             anIntArray1030[i1]++;
  3860.  
  3861.         method73();
  3862.         super.idleTime++;
  3863.         if(super.idleTime > 4500)
  3864.         {
  3865.             anInt1011 = 250;
  3866.             super.idleTime -= 500;
  3867.             stream.createFrame(202);
  3868.         }
  3869.         anInt988++;
  3870.         if(anInt988 > 500)
  3871.         {
  3872.             anInt988 = 0;
  3873.             int l1 = (int)(Math.random() * 8D);
  3874.             if((l1 & 1) == 1)
  3875.                 anInt1278 += anInt1279;
  3876.             if((l1 & 2) == 2)
  3877.                 anInt1131 += anInt1132;
  3878.             if((l1 & 4) == 4)
  3879.                 anInt896 += anInt897;
  3880.         }
  3881.         if(anInt1278 < -50)
  3882.             anInt1279 = 2;
  3883.         if(anInt1278 > 50)
  3884.             anInt1279 = -2;
  3885.         if(anInt1131 < -55)
  3886.             anInt1132 = 2;
  3887.         if(anInt1131 > 55)
  3888.             anInt1132 = -2;
  3889.         if(anInt896 < -40)
  3890.             anInt897 = 1;
  3891.         if(anInt896 > 40)
  3892.             anInt897 = -1;
  3893.         anInt1254++;
  3894.         if(anInt1254 > 500)
  3895.         {
  3896.             anInt1254 = 0;
  3897.             int i2 = (int)(Math.random() * 8D);
  3898.             if((i2 & 1) == 1)
  3899.                 minimapInt2 += anInt1210;
  3900.             if((i2 & 2) == 2)
  3901.                 minimapInt3 += anInt1171;
  3902.         }
  3903.         if(minimapInt2 < -60)
  3904.             anInt1210 = 2;
  3905.         if(minimapInt2 > 60)
  3906.             anInt1210 = -2;
  3907.         if(minimapInt3 < -20)
  3908.             anInt1171 = 1;
  3909.         if(minimapInt3 > 10)
  3910.             anInt1171 = -1;
  3911.         anInt1010++;
  3912.         if(anInt1010 > 50)
  3913.             stream.createFrame(0);
  3914.         try
  3915.         {
  3916.             if(socketStream != null && stream.currentOffset > 0)
  3917.             {
  3918.                 socketStream.queueBytes(stream.currentOffset, stream.buffer);
  3919.                 stream.currentOffset = 0;
  3920.                 anInt1010 = 0;
  3921.             }
  3922.         } catch(IOException _ex) {
  3923.             dropClient();
  3924.         } catch(Exception exception) {
  3925.             resetLogout();
  3926.         }
  3927.     }
  3928.  
  3929.     private void method63()
  3930.     {
  3931.         Class30_Sub1 class30_sub1 = (Class30_Sub1)aClass19_1179.reverseGetFirst();
  3932.         for(; class30_sub1 != null; class30_sub1 = (Class30_Sub1)aClass19_1179.reverseGetNext())
  3933.             if(class30_sub1.anInt1294 == -1) {
  3934.                 class30_sub1.anInt1302 = 0;
  3935.                 method89(class30_sub1);
  3936.             } else {
  3937.                 class30_sub1.unlink();
  3938.             }
  3939.  
  3940.     }
  3941.  
  3942.     private void resetImageProducers() {
  3943.         if(aRSImageProducer_1107 != null)
  3944.             return;
  3945.         super.fullGameScreen = null;
  3946.         chatArea = null;
  3947.         miniMapArea = null;
  3948.         tabArea = null;
  3949.         mainGameArea = null;
  3950.        
  3951.         leftSideFlame = new RSImageProducer(128, 265, getGameComponent());
  3952.         DrawingArea.clear();
  3953.         rightSideFlame = new RSImageProducer(128, 265, getGameComponent());
  3954.         DrawingArea.clear();
  3955.         aRSImageProducer_1107 = new RSImageProducer(509, 171, getGameComponent());
  3956.         DrawingArea.clear();
  3957.         aRSImageProducer_1108 = new RSImageProducer(360, 132, getGameComponent());
  3958.         DrawingArea.clear();
  3959.         loginScreenArea = new RSImageProducer(clientWidth, clientHeight, getGameComponent());
  3960.         DrawingArea.clear();
  3961.         gameLogo = new RSImageProducer(202, 238, getGameComponent());
  3962.         DrawingArea.clear();
  3963.         aRSImageProducer_1113 = new RSImageProducer(203, 238, getGameComponent());
  3964.         DrawingArea.clear();
  3965.         aRSImageProducer_1114 = new RSImageProducer(74, 94, getGameComponent());
  3966.         DrawingArea.clear();
  3967.         aRSImageProducer_1115 = new RSImageProducer(75, 94, getGameComponent());
  3968.         DrawingArea.clear();
  3969.         if(titleStreamLoader != null) {
  3970.             //drawLogo();
  3971.             loadTitleScreen();
  3972.         }
  3973.         welcomeScreenRaised = true;
  3974.     }
  3975.  
  3976.     public void drawSmoothLoading(int i, String s) {
  3977.         for(float f = LP; f <= (float)i; f = (float)((double)f + 0.29999999999D))
  3978.             drawLoadingText((int)f, s);
  3979.         LP = i;
  3980.     }
  3981.  
  3982.     public void drawLoadingText(int i, String s) {
  3983.         if(titleStreamLoader == null) {
  3984.             super.drawLoadingText(i, s);
  3985.             return;
  3986.         }
  3987.         loginScreenArea.initDrawingArea();
  3988.         loadingPercent = i;
  3989.         loadingText = s;
  3990.         background.drawSprite(clientWidth / 2 - background.myWidth / 2, clientHeight / 2 - background.myHeight / 2);
  3991.         logo.drawHDSprite(15, clientHeight - 91 - 34, 255);
  3992.         DrawingArea.fillRect(0, clientHeight - 36, clientWidth, 36, 0);
  3993.         DrawingArea.fillRect(1, clientHeight - 35, clientWidth - 2, 34, 0x1F3D5C);
  3994.         int filled = (int)Math.round(loadingPercent*((float)clientWidth/100));
  3995.         DrawingArea.fillRect(1, clientHeight - 35, filled, 34, 0x336699);
  3996.         for(int a = 0; a <= 100; a++)
  3997.             DrawingArea.drawVerticalLine(1 - 100 + filled + a, clientHeight - 35, 34, 0xffffff, a / 2);
  3998.         regularText.drawLeftAlignedString("<trans=200>" + loadingText, clientWidth-regularFont.getTextWidth(loadingText) - 10, clientHeight - 13, 0xFFFFFD, -1, true);
  3999.                 //loginScreenArea.drawGraphics(171, super.graphics, 202);
  4000.                 loginScreenArea.drawGraphics(0, 0, super.graphics);
  4001.                 if(welcomeScreenRaised)
  4002.                 {
  4003.                     welcomeScreenRaised = false;
  4004.                     /*if(!aBoolean831)
  4005.                     {
  4006.                         leftSideFlame.drawGraphics(0, 0, super.graphics);
  4007.                         rightSideFlame.drawGraphics(637, 0, super.graphics);
  4008.                     }
  4009.                     aRSImageProducer_1107.drawGraphics(128, 0, super.graphics);
  4010.                     aRSImageProducer_1108.drawGraphics(202, 371, super.graphics);
  4011.                     gameLogo.drawGraphics(0, 265, super.graphics);
  4012.                     aRSImageProducer_1113.drawGraphics(562, 265, super.graphics);
  4013.                     aRSImageProducer_1114.drawGraphics(128, 171, super.graphics);
  4014.                     aRSImageProducer_1115.drawGraphics(562, 171, super.graphics);*/
  4015.                 }
  4016.     }
  4017.    
  4018.  
  4019.     private void method65(int i, int j, int k, int l, RSInterface class9, int i1, boolean flag, int j1) {
  4020.         int anInt992;
  4021.         if(aBoolean972)
  4022.             anInt992 = 32;
  4023.         else
  4024.             anInt992 = 0;
  4025.         aBoolean972 = false;
  4026.         if(k >= i && k < i + 16 && l >= i1 && l < i1 + 16) {
  4027.             class9.scrollPosition -= anInt1213 * 4;
  4028.             if(flag) {
  4029.                 needDrawTabArea = true;
  4030.             }
  4031.         } else if(k >= i && k < i + 16 && l >= (i1 + j) - 16 && l < i1 + j) {
  4032.             class9.scrollPosition += anInt1213 * 4;
  4033.             if(flag) {
  4034.                 needDrawTabArea = true;
  4035.             }
  4036.         } else if(k >= i - anInt992 && k < i + 16 + anInt992 && l >= i1 + 16 && l < (i1 + j) - 16 && anInt1213 > 0) {
  4037.             int l1 = ((j - 32) * j) / j1;
  4038.             if(l1 < 8)
  4039.                 l1 = 8;
  4040.             int i2 = l - i1 - 16 - l1 / 2;
  4041.             int j2 = j - 32 - l1;
  4042.             class9.scrollPosition = ((j1 - j) * i2) / j2;
  4043.             if(flag)
  4044.                 needDrawTabArea = true;
  4045.             aBoolean972 = true;
  4046.         }
  4047.     }
  4048.  
  4049.     private boolean method66(int i, int j, int k)
  4050.     {
  4051.         int i1 = i >> 14 & 0x7fff;
  4052.         int j1 = sceneGraph.getIDTAGForXYZ(plane, k, j, i);
  4053.         if(j1 == -1)
  4054.             return false;
  4055.         int k1 = j1 & 0x1f;
  4056.         int l1 = j1 >> 6 & 3;
  4057.         if(k1 == 10 || k1 == 11 || k1 == 22)
  4058.         {
  4059.             ObjectDef class46 = ObjectDef.forID(i1);
  4060.             int i2;
  4061.             int j2;
  4062.             if(l1 == 0 || l1 == 2)
  4063.             {
  4064.                 i2 = class46.sizeX;
  4065.                 j2 = class46.sizeY;
  4066.             } else
  4067.             {
  4068.                 i2 = class46.sizeY;
  4069.                 j2 = class46.sizeX;
  4070.             }
  4071.             int k2 = class46.anInt768;
  4072.             if(l1 != 0)
  4073.                 k2 = (k2 << l1 & 0xf) + (k2 >> 4 - l1);
  4074.             doWalkTo(2, 0, j2, 0, myPlayer.smallY[0], i2, k2, j, myPlayer.smallX[0], false, k);
  4075.         } else
  4076.         {
  4077.             doWalkTo(2, l1, 0, k1 + 1, myPlayer.smallY[0], 0, 0, j, myPlayer.smallX[0], false, k);
  4078.         }
  4079.         crossX = super.saveClickX - 4;
  4080.         crossY = super.saveClickY - 4;
  4081.         crossType = 2;
  4082.         crossIndex = 0;
  4083.         return true;
  4084.     }
  4085.  
  4086.     private NamedArchive streamLoaderForName(int i, String s, String s1, int j, int k) {
  4087.         byte abyte0[] = null;
  4088.         try {
  4089.             if(decompressors[0] != null) {
  4090.                 abyte0 = decompressors[0].decompress(i);
  4091.             }
  4092.             if(abyte0 == null) {
  4093.                 drawSmoothLoading(0, "Connecting to file server");
  4094.                 abyte0 = decompressors[0].decompress(i);
  4095.             }
  4096.         } catch (Exception e) {
  4097.             e.printStackTrace();
  4098.         }
  4099.         if(abyte0 != null) {
  4100.             NamedArchive archive = new NamedArchive(abyte0, s);
  4101.             return archive;
  4102.         }
  4103.         while(true) {
  4104.             drawSmoothLoading(0, "Error loading");
  4105.             try {
  4106.             Thread.sleep(1000);
  4107.             } catch (Exception e) {
  4108.             e.printStackTrace();
  4109.             }
  4110.             }
  4111.     }
  4112.  
  4113.     private void dropClient() {
  4114.         if(anInt1011 > 0) {
  4115.             resetLogout();
  4116.             return;
  4117.         }
  4118.         mainGameArea.initDrawingArea();
  4119.         cacheSprite[3].drawSprite(8,9);
  4120.         mainGameArea.drawGraphics(4, 4, super.graphics);
  4121.         miniMapOverlay = 0;
  4122.         destX = 0;
  4123.         RSSocket rsSocket = socketStream;
  4124.         loggedIn = false;
  4125.         loginFailures = 0;
  4126.         login(myUsername, myPassword, true);
  4127.         if(!loggedIn)
  4128.             resetLogout();
  4129.         try
  4130.         {
  4131.             rsSocket.close();
  4132.         }
  4133.         catch(Exception _ex)
  4134.         {
  4135.         }
  4136.     }
  4137.  
  4138.     private void doAction(int i)
  4139.     {
  4140.         if(i < 0)
  4141.             return;
  4142.         if(inputDialogState != 0)
  4143.         {
  4144.             inputDialogState = 0;
  4145.             inputTaken = true;
  4146.         }
  4147.         int j = menuActionCmd2[i];
  4148.         int k = menuActionCmd3[i];
  4149.         int l = menuActionID[i];
  4150.         int i1 = menuActionCmd1[i];
  4151.         if(l >= 2000)
  4152.             l -= 2000;
  4153.         if(l == 476) {
  4154.             alertHandler.close();
  4155.         }
  4156.         if(l == 582)
  4157.         {
  4158.             Npc npc = npcArray[i1];
  4159.             if(npc != null)
  4160.             {
  4161.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, npc.smallY[0], myPlayer.smallX[0], false, npc.smallX[0]);
  4162.                 crossX = super.saveClickX - 4;
  4163.                 crossY = super.saveClickY - 4;
  4164.                 crossType = 2;
  4165.                 crossIndex = 0;
  4166.                 stream.createFrame(57);
  4167.                 stream.method432(anInt1285);
  4168.                 stream.method432(i1);
  4169.                 stream.method431(anInt1283);
  4170.                 stream.method432(anInt1284);
  4171.             }
  4172.         }
  4173.         if(l == 234)
  4174.         {
  4175.             boolean flag1 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k, myPlayer.smallX[0], false, j);
  4176.             if(!flag1)
  4177.                 flag1 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k, myPlayer.smallX[0], false, j);
  4178.             crossX = super.saveClickX - 4;
  4179.             crossY = super.saveClickY - 4;
  4180.             crossType = 2;
  4181.             crossIndex = 0;
  4182.             stream.createFrame(236);
  4183.             stream.method431(k + baseY);
  4184.             stream.writeWord(i1);
  4185.             stream.method431(j + baseX);
  4186.         }
  4187.         if(l == 62 && method66(i1, k, j))
  4188.         {
  4189.             stream.createFrame(192);
  4190.             stream.writeWord(anInt1284);
  4191.             stream.method431(i1 >> 14 & 0x7fff);
  4192.             stream.method433(k + baseY);
  4193.             stream.method431(anInt1283);
  4194.             stream.method433(j + baseX);
  4195.             stream.writeWord(anInt1285);
  4196.         }
  4197.         if(l == 511)
  4198.         {
  4199.             boolean flag2 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k, myPlayer.smallX[0], false, j);
  4200.             if(!flag2)
  4201.                 flag2 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k, myPlayer.smallX[0], false, j);
  4202.             crossX = super.saveClickX - 4;
  4203.             crossY = super.saveClickY - 4;
  4204.             crossType = 2;
  4205.             crossIndex = 0;
  4206.             stream.createFrame(25);
  4207.             stream.method431(anInt1284);
  4208.             stream.method432(anInt1285);
  4209.             stream.writeWord(i1);
  4210.             stream.method432(k + baseY);
  4211.             stream.method433(anInt1283);
  4212.             stream.writeWord(j + baseX);
  4213.         }
  4214.         if(l == 74)
  4215.         {
  4216.             stream.createFrame(122);
  4217.             stream.method433(k);
  4218.             stream.method432(j);
  4219.             stream.method431(i1);
  4220.             atInventoryLoopCycle = 0;
  4221.             atInventoryInterface = k;
  4222.             atInventoryIndex = j;
  4223.             atInventoryInterfaceType = 2;
  4224.             if(RSInterface.interfaceCache[k].parentID == openInterfaceID)
  4225.                 atInventoryInterfaceType = 1;
  4226.             if(RSInterface.interfaceCache[k].parentID == backDialogID)
  4227.                 atInventoryInterfaceType = 3;
  4228.         }
  4229.         /*if(is480 || is508 || is525) {
  4230.             switch(l){
  4231.                 case 1014: setTab(13);  setSidebarInterface(13, 29500); break;//harp
  4232.                 case 1013: setTab(12);  setSidebarInterface(12, 147);   break;//emotes
  4233.                 case 1012: setTab(11);  setSidebarInterface(11, 904);   break;//options
  4234.                 case 1010: setTab(9);   setSidebarInterface(9, 5715);   break;//ignore
  4235.                 case 1009: setTab(8);   setSidebarInterface(8, 5065);   break;//friend
  4236.                 case 1027: setTab(6);   break;//spellbook
  4237.                 case 1026: setTab(5);   break;//prayer
  4238.                 case 1030: setTab(4);   setSidebarInterface(4, 1644);   break;//worn
  4239.                 case 1024: setTab(3);   setSidebarInterface(3, 3213);   break;//inventory
  4240.                 case 1023: setTab(2);   setSidebarInterface(2, 638);    break;//quests
  4241.                 case 1022: setTab(1);   setSidebarInterface(1, 3917);   break;//stats
  4242.                 case 1021: setTab(0);   break;//style
  4243.                 case 1008: setTab(10);  setSidebarInterface(10, 18128); break;//logout new clan
  4244.                 case 1011: setTab(14);  setSidebarInterface(14, 2449);  break;//logout
  4245.                 case 1502: setTab(7);   setSidebarInterface(7, 2449);   break;//clan
  4246.             }
  4247.         } else {
  4248.             switch(l){
  4249.                 case 1014: setTab(13);  setSidebarInterface(13, 29500); break;//harp
  4250.                 case 1013: setTab(12);  setSidebarInterface(12, 147);   break;//emotes
  4251.                 case 1012: setTab(11);  setSidebarInterface(11, 904);   break;//options
  4252.                 case 1010: setTab(9);   setSidebarInterface(9, 5715);   break;//ignore
  4253.                 case 1009: setTab(8);   setSidebarInterface(8, 5065);   break;//friend
  4254.                 case 1027: setTab(6);   break;//spellbook
  4255.                 case 1026: setTab(5);   break;//prayer
  4256.                 case 1030: setTab(4);   setSidebarInterface(4, 1644);   break;//worn
  4257.                 case 1024: setTab(3);   setSidebarInterface(3, 3213);   break;//inventory
  4258.                 case 1023: setTab(2);   setSidebarInterface(2, 638);    break;//quests
  4259.                 case 1022: setTab(1);   setSidebarInterface(1, 3917);   break;//stats
  4260.                 case 1021: setTab(0);   break;//style
  4261.                 case 1008: setTab(7);   setSidebarInterface(7, 18128);  break;
  4262.                 case 1011: setTab(10);  setSidebarInterface(10, 2449);  break;
  4263.             }
  4264.         }*/
  4265.         if(l >= 1902 && l <= 1911 && !showedName.equals("Error!") && !showedName.equals("") && StaffTabInUse) {
  4266.             StaffTabSelected = l - 1902;
  4267.         }
  4268.         switch(l){
  4269.             case 1050:
  4270.                 runState = 1;
  4271.                 if(!runClicked) {
  4272.                     runClicked = true;
  4273.                     stream.createFrame(185);
  4274.                     stream.writeWord(153);
  4275.                 } else {
  4276.                     runClicked = false;
  4277.                     stream.createFrame(185);
  4278.                     stream.writeWord(152);
  4279.                 }
  4280.             break;
  4281.             case 1500:
  4282.                 if(!prayClicked){
  4283.                     prayClicked = true;
  4284.                 } else {
  4285.                     prayClicked = false;
  4286.                 }
  4287.             break;
  4288.             case 1501:
  4289.                 runState = 2;
  4290.                 if(!restOrb)
  4291.                     restOrb = true;
  4292.                 else
  4293.                     restOrb = false;
  4294.                 stream.createFrame(185);
  4295.                 stream.writeWord(151);
  4296.                 /*if(!musicOrb && restOrb){
  4297.                     musicOrb = true;
  4298.                     restOrb = false;
  4299.                 } else if(musicOrb && !restOrb){
  4300.                     musicOrb = false;
  4301.                     restOrb = true;
  4302.                 } else if(!musicOrb && !restOrb){
  4303.                     musicOrb = false;
  4304.                     restOrb = true;
  4305.                 }*/
  4306.             break;
  4307.  
  4308.             /* Staff tab */
  4309.             case 1900: //Staff tab toggle
  4310.                 if(!staffTabOpen)
  4311.                     staffTabOpen = true;
  4312.                 else {
  4313.                     staffTabOpen = false;
  4314.                     showedName = "";
  4315.                     fixedName = "";
  4316.                     StaffTabSelected = -1;
  4317.                     writingOnStaffTab = false;
  4318.                     staffTabInput = "";
  4319.                 }
  4320.             break;
  4321.             case 1901: //Staff tab enter name
  4322.                 writingOnStaffTab = true;
  4323.                 showedName = "";
  4324.                 fixedName = "";
  4325.             break;
  4326.             case 1912: //Staff tab sending action
  4327.                 if(StaffTabSelected < 0) {
  4328.                     pushMessage("Select an action first.", 0, "");
  4329.                     return;
  4330.                 }
  4331.                 String action = "";
  4332.                 switch(StaffTabSelected) {
  4333.                     case 0: action = "mute";    break;
  4334.                     case 1: action = "ipmute";  break;
  4335.                     case 2: action = "unmute";  break;
  4336.                     case 3: action = "jail";    break;
  4337.                     case 4: action = "unjail";  break;
  4338.                     case 5: action = "ban";     break;
  4339.                     case 6: action = "ipban";   break;
  4340.                     case 7: action = "unban";   break;
  4341.                     case 8: action = "teleto";  break;
  4342.                     case 9: action = "teletome";break;
  4343.                 }
  4344.                 String actionString = action + " " + fixedName.toLowerCase();
  4345.                 stream.createFrame(103);
  4346.                 stream.writeWordBigEndian(actionString.length() + 1);
  4347.                 stream.writeString(actionString);
  4348.             break;
  4349.  
  4350.             case 1503:
  4351.                 if(!drawXpBar)
  4352.                     drawXpBar = true;
  4353.                 else
  4354.                     drawXpBar = false;
  4355.             break;
  4356.             case 1504:
  4357.                 stream.createFrame(185);
  4358.                 stream.writeWord(39480);
  4359.                 myPlayer.xpCount = 0;
  4360.             break;
  4361.         }
  4362.         if(l == 315) {
  4363.             System.out.println("sendPacket185("+k+")");
  4364.             RSInterface class9 = RSInterface.interfaceCache[k];
  4365.             boolean flag8 = true;
  4366.             if(class9.contentType > 0)
  4367.                 flag8 = promptUserForInput(class9);
  4368.             if(flag8) {
  4369.                
  4370.                 switch(k){
  4371.                     case 19144:
  4372.                         sendFrame248(15106,3213);
  4373.                         method60(15106);
  4374.                         inputTaken = true;
  4375.                         break;
  4376.                     case 27615:
  4377.                         setSidebarInterface(4, 1644);
  4378.                     break;
  4379.                     case 25843://arrow
  4380.                         setSidebarInterface(11, 24500);
  4381.                         break;
  4382.                     case 27610://return
  4383.                         setSidebarInterface(11, 904);
  4384.                         break;
  4385.                     case 27508://hp
  4386.                         sendFrame126("OFF", 27528);
  4387.                         if(hitbarToggle) {
  4388.                             hitbarToggle = false;
  4389.                             sendFrame126("OFF", 27528); sendFrame126("", 27524);
  4390.                         } else {
  4391.                             hitbarToggle = true;
  4392.                             sendFrame126("@gre@ON", 27524); sendFrame126("", 27528);
  4393.                         }
  4394.                         break;
  4395.                     case 27509://tooltips
  4396.                         sendFrame126("OFF", 27529);
  4397.                         if(tooltipToggle) {
  4398.                             tooltipToggle = false;
  4399.                             sendFrame126("OFF", 27529); sendFrame126("", 27525);
  4400.                         } else {
  4401.                             tooltipToggle= true;
  4402.                             sendFrame126("@gre@ON", 27525); sendFrame126("", 27529);
  4403.                         }
  4404.                         break;
  4405.                     case 27510://names
  4406.                         sendFrame126("OFF", 27530);
  4407.                         if(namesToggle) {
  4408.                             namesToggle = false;
  4409.                             sendFrame126("OFF", 27530); sendFrame126("", 27526);
  4410.                         } else {
  4411.                             namesToggle = true;
  4412.                             sendFrame126("@gre@ON", 27526); sendFrame126("", 27530);
  4413.                         }
  4414.                         break;
  4415.                     case 27532://gameframe
  4416.                         if(miniMapOverlay == 2) {
  4417.                             pushMessage("Switching gameframes is disabled while in barrows.", 0, "");
  4418.                         } else {
  4419.                             sendFrame126("459", 27531);
  4420.                             /*if(is459) {
  4421.                                 is459 = false;  is474 = true;
  4422.                                 sendFrame126("474", 27536);
  4423.                                 sendFrame126("", 27533);    sendFrame126("", 27537);    sendFrame126("", 27538);    sendFrame126("", 27531);
  4424.                             } else if(is474) {
  4425.                                 is474 = false;  is480 = true;
  4426.                                 sendFrame126("483", 27536);
  4427.                                 sendFrame126("", 27533);    sendFrame126("", 27537);    sendFrame126("", 27538);    sendFrame126("", 27531);
  4428.                             } else if(is480) {
  4429.                                 is480 = false;  is508 = true;
  4430.                                 sendFrame126("508", 27537);
  4431.                                 sendFrame126("", 27533);    sendFrame126("", 27536);    sendFrame126("", 27538);    sendFrame126("", 27531);
  4432.                             } else if(is508) {
  4433.                                 is508 = false;  is525 = true;
  4434.                                 sendFrame126("525", 27538);
  4435.                                 sendFrame126("", 27536);    sendFrame126("", 27537);    sendFrame126("", 27533);    sendFrame126("", 27531);
  4436.                             } else if(is525) {
  4437.                                 is525 = false;  is562 = true;
  4438.                                 sendFrame126("562", 27536);
  4439.                                 sendFrame126("", 27533);    sendFrame126("", 27537);    sendFrame126("", 27538);    sendFrame126("", 27531);
  4440.                             } else if(is562) {
  4441.                                 is562 = false;  is508 = false;  is525 = false;  is480 = false;  is474 = false;  is459 = true;
  4442.                                 sendFrame126("", 27533);    sendFrame126("", 27536);    sendFrame126("", 27537);    sendFrame126("", 27538);
  4443.                                 sendFrame126("377", 27531);
  4444.                             }*/
  4445.                         }
  4446.                     break;
  4447.                     case 27606://x10
  4448.                         sendFrame126("OFF", 27605);
  4449.                         if(newDamage) {
  4450.                             newDamage = false;
  4451.                             sendFrame126("OFF", 27605);
  4452.                             sendFrame126("", 27604);
  4453.                         } else {
  4454.                             newDamage = true;
  4455.                             sendFrame126("@gre@ON", 27604);
  4456.                             sendFrame126("", 27605);
  4457.                         }
  4458.                         break;
  4459.                     case 27521://shadow
  4460.                         sendFrame126("OFF", 27603);
  4461.                         if(playerShadow) {
  4462.                             playerShadow = false;
  4463.                             sendFrame126("OFF", 27603);
  4464.                             sendFrame126("", 27602);
  4465.                             unlinkMRUNodes();
  4466.                         } else {
  4467.                             playerShadow = true;
  4468.                             sendFrame126("@gre@ON", 27602);
  4469.                             sendFrame126("", 27603);
  4470.                             unlinkMRUNodes();
  4471.                         }
  4472.                         break;
  4473.                     case 29156://achievement
  4474.                         setSidebarInterface(2, 29265);
  4475.                         break;
  4476.                     case 29267://Quest
  4477.                         setSidebarInterface(2, 638);
  4478.                         break;
  4479.                        
  4480.                     default:
  4481.                         stream.createFrame(185);
  4482.                         stream.writeWord(k);
  4483.                         break;
  4484.                    
  4485.                 }
  4486.             }
  4487.         }
  4488.         if(l == 561)
  4489.         {
  4490.             Player player = playerArray[i1];
  4491.             if(player != null)
  4492.             {
  4493.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, player.smallY[0], myPlayer.smallX[0], false, player.smallX[0]);
  4494.                 crossX = super.saveClickX;
  4495.                 crossY = super.saveClickY;
  4496.                 crossType = 2;
  4497.                 crossIndex = 0;
  4498.                 anInt1188 += i1;
  4499.                 if(anInt1188 >= 90)
  4500.                 {
  4501.                     stream.createFrame(136);
  4502.                     anInt1188 = 0;
  4503.                 }
  4504.                 stream.createFrame(128);
  4505.                 stream.writeWord(i1);
  4506.             }
  4507.         }
  4508.         if(l == 20)
  4509.         {
  4510.             Npc class30_sub2_sub4_sub1_sub1_1 = npcArray[i1];
  4511.             if(class30_sub2_sub4_sub1_sub1_1 != null)
  4512.             {
  4513.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, class30_sub2_sub4_sub1_sub1_1.smallY[0], myPlayer.smallX[0], false, class30_sub2_sub4_sub1_sub1_1.smallX[0]);
  4514.                 crossX = super.saveClickX;
  4515.                 crossY = super.saveClickY;
  4516.                 crossType = 2;
  4517.                 crossIndex = 0;
  4518.                 stream.createFrame(155);
  4519.                 stream.method431(i1);
  4520.             }
  4521.         }
  4522.         if(l == 779)
  4523.         {
  4524.             Player class30_sub2_sub4_sub1_sub2_1 = playerArray[i1];
  4525.             if(class30_sub2_sub4_sub1_sub2_1 != null)
  4526.             {
  4527.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, class30_sub2_sub4_sub1_sub2_1.smallY[0], myPlayer.smallX[0], false, class30_sub2_sub4_sub1_sub2_1.smallX[0]);
  4528.                 crossX = super.saveClickX;
  4529.                 crossY = super.saveClickY;
  4530.                 crossType = 2;
  4531.                 crossIndex = 0;
  4532.                 stream.createFrame(153);
  4533.                 stream.method431(i1);
  4534.             }
  4535.         }
  4536.         if(l == 516)
  4537.             if(!menuOpen)
  4538.                 sceneGraph.gameScreenClick(super.saveClickY, super.saveClickX);
  4539.             else
  4540.                 sceneGraph.gameScreenClick(k, j);
  4541.         if(l == 1062)
  4542.         {
  4543.             anInt924 += baseX;
  4544.             if(anInt924 >= 113)
  4545.             {
  4546.                 stream.createFrame(183);
  4547.                 stream.writeDWordBigEndian(0xe63271);
  4548.                 anInt924 = 0;
  4549.             }
  4550.             method66(i1, k, j);
  4551.             stream.createFrame(228);
  4552.             stream.method432(i1 >> 14 & 0x7fff);
  4553.             stream.method432(k + baseY);
  4554.             stream.writeWord(j + baseX);
  4555.         }
  4556.         if(l == 679 && !aBoolean1149)
  4557.         {
  4558.             stream.createFrame(40);
  4559.             stream.writeWord(k);
  4560.             aBoolean1149 = true;
  4561.         }
  4562.         if(l == 431)
  4563.         {
  4564.             stream.createFrame(129);
  4565.             stream.method432(j);
  4566.             stream.writeWord(k);
  4567.             stream.method432(i1);
  4568.             atInventoryLoopCycle = 0;
  4569.             atInventoryInterface = k;
  4570.             atInventoryIndex = j;
  4571.             atInventoryInterfaceType = 2;
  4572.             if(RSInterface.interfaceCache[k].parentID == openInterfaceID)
  4573.                 atInventoryInterfaceType = 1;
  4574.             if(RSInterface.interfaceCache[k].parentID == backDialogID)
  4575.                 atInventoryInterfaceType = 3;
  4576.         }
  4577.         if(l == 337 || l == 42 || l == 792 || l == 322)
  4578.         {
  4579.             String s = menuActionName[i];
  4580.             int k1 = s.indexOf("@whi@");
  4581.             if(k1 != -1)
  4582.             {
  4583.                 long l3 = TextClass.longForName(s.substring(k1 + 5).trim());
  4584.                 if(l == 337)
  4585.                     addFriend(l3);
  4586.                 if(l == 42)
  4587.                     addIgnore(l3);
  4588.                 if(l == 792)
  4589.                     delFriend(l3);
  4590.                 if(l == 322)
  4591.                     delIgnore(l3);
  4592.             }
  4593.         }
  4594.         if(l == 53)
  4595.         {
  4596.             stream.createFrame(135);
  4597.             stream.method431(j);
  4598.             stream.method432(k);
  4599.             stream.method431(i1);
  4600.             atInventoryLoopCycle = 0;
  4601.             atInventoryInterface = k;
  4602.             atInventoryIndex = j;
  4603.             atInventoryInterfaceType = 2;
  4604.             if(RSInterface.interfaceCache[k].parentID == openInterfaceID)
  4605.                 atInventoryInterfaceType = 1;
  4606.             if(RSInterface.interfaceCache[k].parentID == backDialogID)
  4607.                 atInventoryInterfaceType = 3;
  4608.         }
  4609.         if(l == 539)
  4610.         {
  4611.             stream.createFrame(16);
  4612.             stream.method432(i1);
  4613.             stream.method433(j);
  4614.             stream.method433(k);
  4615.             atInventoryLoopCycle = 0;
  4616.             atInventoryInterface = k;
  4617.             atInventoryIndex = j;
  4618.             atInventoryInterfaceType = 2;
  4619.             if(RSInterface.interfaceCache[k].parentID == openInterfaceID)
  4620.                 atInventoryInterfaceType = 1;
  4621.             if(RSInterface.interfaceCache[k].parentID == backDialogID)
  4622.                 atInventoryInterfaceType = 3;
  4623.         }
  4624.         if(l == 927) {
  4625.             String s1 = menuActionName[i];
  4626.             int l1 = s1.indexOf("@lre@");
  4627.             s1 = s1.substring(l1 + 5).trim();
  4628.             launchURL(s1);//Launches the URL in a web browser when clicked
  4629.         }
  4630.         if(l == 484 || l == 6)
  4631.         {
  4632.             String s1 = menuActionName[i];
  4633.             int l1 = s1.indexOf("@whi@");
  4634.             if(l1 != -1)
  4635.             {
  4636.                 s1 = s1.substring(l1 + 5).trim();
  4637.                 String s7 = TextClass.fixName(TextClass.nameForLong(TextClass.longForName(s1)));
  4638.                 boolean flag9 = false;
  4639.                 for(int j3 = 0; j3 < playerCount; j3++)
  4640.                 {
  4641.                     Player class30_sub2_sub4_sub1_sub2_7 = playerArray[playerIndices[j3]];
  4642.                     if(class30_sub2_sub4_sub1_sub2_7 == null || class30_sub2_sub4_sub1_sub2_7.name == null || !class30_sub2_sub4_sub1_sub2_7.name.equalsIgnoreCase(s7))
  4643.                         continue;
  4644.                     doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, class30_sub2_sub4_sub1_sub2_7.smallY[0], myPlayer.smallX[0], false, class30_sub2_sub4_sub1_sub2_7.smallX[0]);
  4645.                     if(l == 484)
  4646.                     {
  4647.                         stream.createFrame(39); // 139, trade fix
  4648.                         stream.method431(playerIndices[j3]);
  4649.                     }
  4650.                     if(l == 6)
  4651.                     {
  4652.                         anInt1188 += i1;
  4653.                         if(anInt1188 >= 90)
  4654.                         {
  4655.                             stream.createFrame(136);
  4656.                             anInt1188 = 0;
  4657.                         }
  4658.                         stream.createFrame(128);
  4659.                         stream.writeWord(playerIndices[j3]);
  4660.                     }
  4661.                     flag9 = true;
  4662.                     break;
  4663.                 }
  4664.  
  4665.                 if(!flag9)
  4666.                     pushMessage("Unable to find " + s7, 0, "");
  4667.             }
  4668.         }
  4669.         if(l == 870)
  4670.         {
  4671.             stream.createFrame(53);
  4672.             stream.writeWord(j);
  4673.             stream.method432(anInt1283);
  4674.             stream.method433(i1);
  4675.             stream.writeWord(anInt1284);
  4676.             stream.method431(anInt1285);
  4677.             stream.writeWord(k);
  4678.             atInventoryLoopCycle = 0;
  4679.             atInventoryInterface = k;
  4680.             atInventoryIndex = j;
  4681.             atInventoryInterfaceType = 2;
  4682.             if(RSInterface.interfaceCache[k].parentID == openInterfaceID)
  4683.                 atInventoryInterfaceType = 1;
  4684.             if(RSInterface.interfaceCache[k].parentID == backDialogID)
  4685.                 atInventoryInterfaceType = 3;
  4686.         }
  4687.         if(l == 847)
  4688.         {
  4689.             stream.createFrame(87);
  4690.             stream.method432(i1);
  4691.             stream.writeWord(k);
  4692.             stream.method432(j);
  4693.             atInventoryLoopCycle = 0;
  4694.             atInventoryInterface = k;
  4695.             atInventoryIndex = j;
  4696.             atInventoryInterfaceType = 2;
  4697.             if(RSInterface.interfaceCache[k].parentID == openInterfaceID)
  4698.                 atInventoryInterfaceType = 1;
  4699.             if(RSInterface.interfaceCache[k].parentID == backDialogID)
  4700.                 atInventoryInterfaceType = 3;
  4701.         }
  4702.         if(l == 626)
  4703.         {
  4704.             RSInterface class9_1 = RSInterface.interfaceCache[k];
  4705.             spellSelected = 1;
  4706.             spellID = class9_1.id;
  4707.             anInt1137 = k;
  4708.             spellUsableOn = class9_1.spellUsableOn;
  4709.             itemSelected = 0;
  4710.             needDrawTabArea = true;
  4711.             spellID = class9_1.id;
  4712.             String s4 = class9_1.selectedActionName;
  4713.             if(s4.indexOf(" ") != -1)
  4714.                 s4 = s4.substring(0, s4.indexOf(" "));
  4715.             String s8 = class9_1.selectedActionName;
  4716.             if(s8.indexOf(" ") != -1)
  4717.                 s8 = s8.substring(s8.indexOf(" ") + 1);
  4718.             if(s8.equals("on")) s8 = "@whi@->";
  4719.                 spellTooltip = s4 + " " + "@gre@" + class9_1.spellName + " " + s8;
  4720.            
  4721.             //spellTooltip = s4 + " " + class9_1.spellName + " " + s8;
  4722.             //class9_1.disabledSprite.drawSprite(class9_1.xOffset, class9_1.yOffset, 0xffffff);
  4723.             //class9_1.disabledSprite.drawSprite(200,200);
  4724.             //System.out.println("Sprite: " + class9_1.disabledSprite.toString());
  4725.             if(spellUsableOn == 16)
  4726.             {
  4727.                 needDrawTabArea = true;
  4728.                 tabID = 3;
  4729.                 tabAreaAltered = true;
  4730.             }
  4731.             return;
  4732.         }
  4733.         if(l == 78)
  4734.         {
  4735.             stream.createFrame(117);
  4736.             stream.method433(k);
  4737.             stream.method433(i1);
  4738.             stream.method431(j);
  4739.             atInventoryLoopCycle = 0;
  4740.             atInventoryInterface = k;
  4741.             atInventoryIndex = j;
  4742.             atInventoryInterfaceType = 2;
  4743.             if(RSInterface.interfaceCache[k].parentID == openInterfaceID)
  4744.                 atInventoryInterfaceType = 1;
  4745.             if(RSInterface.interfaceCache[k].parentID == backDialogID)
  4746.                 atInventoryInterfaceType = 3;
  4747.         }
  4748.         if(l == 27)
  4749.         {
  4750.             Player class30_sub2_sub4_sub1_sub2_2 = playerArray[i1];
  4751.             if(class30_sub2_sub4_sub1_sub2_2 != null)
  4752.             {
  4753.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, class30_sub2_sub4_sub1_sub2_2.smallY[0], myPlayer.smallX[0], false, class30_sub2_sub4_sub1_sub2_2.smallX[0]);
  4754.                 crossX = super.saveClickX;
  4755.                 crossY = super.saveClickY;
  4756.                 crossType = 2;
  4757.                 crossIndex = 0;
  4758.                 anInt986 += i1;
  4759.                 if(anInt986 >= 54)
  4760.                 {
  4761.                     stream.createFrame(189);
  4762.                     stream.writeWordBigEndian(234);
  4763.                     anInt986 = 0;
  4764.                 }
  4765.                 stream.createFrame(73);
  4766.                 stream.method431(i1);
  4767.             }
  4768.         }
  4769.  
  4770.         /* Facing North */
  4771.         if(l == 1014) {
  4772.             minimapInt1 = 0;
  4773.             anInt1184 = 120;
  4774.                     //minimapInt1 = (int) 20D;
  4775.             }
  4776.  
  4777.        
  4778.         /*if(l == 1800) {
  4779.             if(CameraPos1 > 4) { // 6
  4780.                 pushMessage("You can't zoom out anymore.", 0, "");
  4781.             } else if(CameraPos1 < 5) { // 7
  4782.                 CameraPos1++;
  4783.                 CameraPos2 += 200;
  4784.             }
  4785.         }
  4786.         if(l == 1850) {
  4787.             if(CameraPos1 == 1) {
  4788.                 pushMessage("You can't zoom in anymore.", 0, "");
  4789.             } else if(CameraPos1 > 1) {
  4790.                 CameraPos1--;
  4791.                 CameraPos2 -= 200;
  4792.             }
  4793.         }*/
  4794.        
  4795.         if(l == 213)
  4796.         {
  4797.             boolean flag3 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k, myPlayer.smallX[0], false, j);
  4798.             if(!flag3)
  4799.                 flag3 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k, myPlayer.smallX[0], false, j);
  4800.             crossX = super.saveClickX;
  4801.             crossY = super.saveClickY;
  4802.             crossType = 2;
  4803.             crossIndex = 0;
  4804.             stream.createFrame(79);
  4805.             stream.method431(k + baseY);
  4806.             stream.writeWord(i1);
  4807.             stream.method432(j + baseX);
  4808.         }
  4809.         if(l == 632)
  4810.         {
  4811.             stream.createFrame(145);
  4812.             stream.method432(k);
  4813.             stream.method432(j);
  4814.             stream.method432(i1);
  4815.             atInventoryLoopCycle = 0;
  4816.             atInventoryInterface = k;
  4817.             atInventoryIndex = j;
  4818.             atInventoryInterfaceType = 2;
  4819.             if(RSInterface.interfaceCache[k].parentID == openInterfaceID)
  4820.                 atInventoryInterfaceType = 1;
  4821.             if(RSInterface.interfaceCache[k].parentID == backDialogID)
  4822.                 atInventoryInterfaceType = 3;
  4823.         }
  4824.         if(l == 1005) {
  4825.             launchURL(SignLink.findCacheDir() + "tools/world_map/client.jar");
  4826.             pushMessage("World map's not working at the moment, sorry.", 0, "");
  4827.         }
  4828.         if(l == 1004) {
  4829.             if(tabInterfaceIDs[10] != -1) {
  4830.                 needDrawTabArea = true;
  4831.                 tabID = 10;
  4832.                 tabAreaAltered = true;
  4833.             }
  4834.         }
  4835.         if(l == 1003) {
  4836.             clanChatMode = 2;
  4837.             inputTaken = true;
  4838.         }
  4839.         if(l == 1002) {
  4840.             clanChatMode = 1;
  4841.             inputTaken = true;
  4842.         }
  4843.         if(l == 1001) {
  4844.             clanChatMode = 0;
  4845.             inputTaken = true;
  4846.         }
  4847.         if(l == 1000) {
  4848.             cButtonCPos = 4;
  4849.             chatTypeView = 11;
  4850.             inputTaken = true;
  4851.         }
  4852.         if(l == 999) {
  4853.             cButtonCPos = 0;
  4854.             chatTypeView = 0;
  4855.             inputTaken = true;
  4856.         }
  4857.         if(l == 998) {
  4858.             cButtonCPos = 1;
  4859.             chatTypeView = 5;
  4860.             inputTaken = true;
  4861.         }
  4862.         if(l == 997) {
  4863.             publicChatMode = 3;
  4864.             inputTaken = true;
  4865.         }
  4866.         if(l == 996) {
  4867.             publicChatMode = 2;
  4868.             inputTaken = true;
  4869.         }
  4870.         if(l == 995) {
  4871.             publicChatMode = 1;
  4872.             inputTaken = true;
  4873.         }
  4874.         if(l == 994) {
  4875.             publicChatMode = 0;
  4876.             inputTaken = true;
  4877.         }
  4878.         if(l == 993) {
  4879.             cButtonCPos = 2;
  4880.             chatTypeView = 1;
  4881.             inputTaken = true;
  4882.         }
  4883.         if(l == 992) {
  4884.             privateChatMode = 2;
  4885.             inputTaken = true;
  4886.         }
  4887.         if(l == 991) {
  4888.             privateChatMode = 1;
  4889.             inputTaken = true;
  4890.         }
  4891.         if(l == 990) {
  4892.             privateChatMode = 0;
  4893.             inputTaken = true;
  4894.         }
  4895.         if(l == 989) {
  4896.             cButtonCPos = 3;
  4897.             chatTypeView = 2;
  4898.             inputTaken = true;
  4899.         }
  4900.         if(l == 987) {
  4901.             tradeMode = 2;
  4902.             inputTaken = true;
  4903.         }
  4904.         if(l == 986) {
  4905.             tradeMode = 1;
  4906.             inputTaken = true;
  4907.         }
  4908.         if(l == 985) {
  4909.             tradeMode = 0;
  4910.             inputTaken = true;
  4911.         }
  4912.         if(l == 1423) {
  4913.             yellChatMode = 2;
  4914.             inputTaken = true;
  4915.         }
  4916.         if(l == 1422) {
  4917.             yellChatMode = 1;
  4918.             inputTaken = true;
  4919.         }
  4920.         if(l == 1421) {
  4921.             yellChatMode = 0;
  4922.             inputTaken = true;
  4923.         }
  4924.         if(l == 984) {
  4925.             cButtonCPos = 5;
  4926.             chatTypeView = 3;
  4927.             inputTaken = true;
  4928.         }
  4929.         if(l == 1420) {
  4930.             chatTypeView = 6;
  4931.             inputTaken = true;
  4932.         }
  4933.         if(l == 983) {
  4934.             duelMode = 2;
  4935.             inputTaken = true;
  4936.         }
  4937.         if(l == 982) {
  4938.             duelMode = 1;
  4939.             inputTaken = true;
  4940.         }
  4941.         if(l == 981) {
  4942.             duelMode = 0;
  4943.             inputTaken = true;
  4944.         }
  4945.         if(l == 980) {
  4946.             cButtonCPos = 6;
  4947.             chatTypeView = 4;
  4948.             inputTaken = true;
  4949.         }
  4950.         if(l == 493)
  4951.         {
  4952.             stream.createFrame(75);
  4953.             stream.method433(k);
  4954.             stream.method431(j);
  4955.             stream.method432(i1);
  4956.             atInventoryLoopCycle = 0;
  4957.             atInventoryInterface = k;
  4958.             atInventoryIndex = j;
  4959.             atInventoryInterfaceType = 2;
  4960.             if(RSInterface.interfaceCache[k].parentID == openInterfaceID)
  4961.                 atInventoryInterfaceType = 1;
  4962.             if(RSInterface.interfaceCache[k].parentID == backDialogID)
  4963.                 atInventoryInterfaceType = 3;
  4964.         }
  4965.         if(l == 652)
  4966.         {
  4967.             boolean flag4 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k, myPlayer.smallX[0], false, j);
  4968.             if(!flag4)
  4969.                 flag4 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k, myPlayer.smallX[0], false, j);
  4970.             crossX = super.saveClickX;
  4971.             crossY = super.saveClickY;
  4972.             crossType = 2;
  4973.             crossIndex = 0;
  4974.             stream.createFrame(156);
  4975.             stream.method432(j + baseX);
  4976.             stream.method431(k + baseY);
  4977.             stream.method433(i1);
  4978.         }
  4979.         if(l == 94)
  4980.         {
  4981.             boolean flag5 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k, myPlayer.smallX[0], false, j);
  4982.             if(!flag5)
  4983.                 flag5 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k, myPlayer.smallX[0], false, j);
  4984.             crossX = super.saveClickX;
  4985.             crossY = super.saveClickY;
  4986.             crossType = 2;
  4987.             crossIndex = 0;
  4988.             stream.createFrame(181);
  4989.             stream.method431(k + baseY);
  4990.             stream.writeWord(i1);
  4991.             stream.method431(j + baseX);
  4992.             stream.method432(anInt1137);
  4993.         }
  4994.         if(l == 646)
  4995.         {
  4996.             stream.createFrame(185);
  4997.             stream.writeWord(k);
  4998.             RSInterface class9_2 = RSInterface.interfaceCache[k];
  4999.             if(class9_2.valueIndexArray != null && class9_2.valueIndexArray[0][0] == 5)
  5000.             {
  5001.                 int i2 = class9_2.valueIndexArray[0][1];
  5002.                 if(variousSettings[i2] != class9_2.requiredValues[0])
  5003.                 {
  5004.                     variousSettings[i2] = class9_2.requiredValues[0];
  5005.                     method33(i2);
  5006.                     needDrawTabArea = true;
  5007.                 }
  5008.             }
  5009.         }
  5010.         if(l == 225)
  5011.         {
  5012.             Npc class30_sub2_sub4_sub1_sub1_2 = npcArray[i1];
  5013.             if(class30_sub2_sub4_sub1_sub1_2 != null)
  5014.             {
  5015.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, class30_sub2_sub4_sub1_sub1_2.smallY[0], myPlayer.smallX[0], false, class30_sub2_sub4_sub1_sub1_2.smallX[0]);
  5016.                 crossX = super.saveClickX;
  5017.                 crossY = super.saveClickY;
  5018.                 crossType = 2;
  5019.                 crossIndex = 0;
  5020.                 anInt1226 += i1;
  5021.                 if(anInt1226 >= 85)
  5022.                 {
  5023.                     stream.createFrame(230);
  5024.                     stream.writeWordBigEndian(239);
  5025.                     anInt1226 = 0;
  5026.                 }
  5027.                 stream.createFrame(17);
  5028.                 stream.method433(i1);
  5029.             }
  5030.         }
  5031.         if(l == 965)
  5032.         {
  5033.             Npc class30_sub2_sub4_sub1_sub1_3 = npcArray[i1];
  5034.             if(class30_sub2_sub4_sub1_sub1_3 != null)
  5035.             {
  5036.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, class30_sub2_sub4_sub1_sub1_3.smallY[0], myPlayer.smallX[0], false, class30_sub2_sub4_sub1_sub1_3.smallX[0]);
  5037.                 crossX = super.saveClickX;
  5038.                 crossY = super.saveClickY;
  5039.                 crossType = 2;
  5040.                 crossIndex = 0;
  5041.                 anInt1134++;
  5042.                 if(anInt1134 >= 96)
  5043.                 {
  5044.                     stream.createFrame(152);
  5045.                     stream.writeWordBigEndian(88);
  5046.                     anInt1134 = 0;
  5047.                 }
  5048.                 stream.createFrame(21);
  5049.                 stream.writeWord(i1);
  5050.             }
  5051.         }
  5052.         if(l == 413)
  5053.         {
  5054.             Npc class30_sub2_sub4_sub1_sub1_4 = npcArray[i1];
  5055.             if(class30_sub2_sub4_sub1_sub1_4 != null)
  5056.             {
  5057.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, class30_sub2_sub4_sub1_sub1_4.smallY[0], myPlayer.smallX[0], false, class30_sub2_sub4_sub1_sub1_4.smallX[0]);
  5058.                 crossX = super.saveClickX;
  5059.                 crossY = super.saveClickY;
  5060.                 crossType = 2;
  5061.                 crossIndex = 0;
  5062.                 stream.createFrame(131);
  5063.                 stream.method433(i1);
  5064.                 stream.method432(anInt1137);
  5065.             }
  5066.         }
  5067.         if(l == 200)
  5068.             clearTopInterfaces();
  5069.         if(l == 1025)
  5070.         {
  5071.             Npc class30_sub2_sub4_sub1_sub1_5 = npcArray[i1];
  5072.             if(class30_sub2_sub4_sub1_sub1_5 != null)
  5073.             {
  5074.                 NpcDef entityDef = class30_sub2_sub4_sub1_sub1_5.desc;
  5075.                 if(entityDef.childrenIDs != null)
  5076.                     entityDef = entityDef.method161();
  5077.                 if(entityDef != null)
  5078.                 {
  5079.                     String s9;
  5080.                     if(entityDef.description != null)
  5081.                         s9 = new String(entityDef.description);
  5082.                     else
  5083.                         s9 = "It's " + addIndefiniteArticle(entityDef.name) + ".";
  5084.                     pushMessage(s9, 0, "");
  5085.                 }
  5086.             }
  5087.         }
  5088.         if(l == 900)
  5089.         {
  5090.             method66(i1, k, j);
  5091.             stream.createFrame(252);
  5092.             stream.method433(i1 >> 14 & 0x7fff);
  5093.             stream.method431(k + baseY);
  5094.             stream.method432(j + baseX);
  5095.         }
  5096.         if(l == 412)
  5097.         {
  5098.             Npc class30_sub2_sub4_sub1_sub1_6 = npcArray[i1];
  5099.             if(class30_sub2_sub4_sub1_sub1_6 != null)
  5100.             {
  5101.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, class30_sub2_sub4_sub1_sub1_6.smallY[0], myPlayer.smallX[0], false, class30_sub2_sub4_sub1_sub1_6.smallX[0]);
  5102.                 crossX = super.saveClickX;
  5103.                 crossY = super.saveClickY;
  5104.                 crossType = 2;
  5105.                 crossIndex = 0;
  5106.                 stream.createFrame(72);
  5107.                 stream.method432(i1);
  5108.             }
  5109.         }
  5110.         if(l == 365)
  5111.         {
  5112.             Player class30_sub2_sub4_sub1_sub2_3 = playerArray[i1];
  5113.             if(class30_sub2_sub4_sub1_sub2_3 != null)
  5114.             {
  5115.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, class30_sub2_sub4_sub1_sub2_3.smallY[0], myPlayer.smallX[0], false, class30_sub2_sub4_sub1_sub2_3.smallX[0]);
  5116.                 crossX = super.saveClickX;
  5117.                 crossY = super.saveClickY;
  5118.                 crossType = 2;
  5119.                 crossIndex = 0;
  5120.                 stream.createFrame(249);
  5121.                 stream.method432(i1);
  5122.                 stream.method431(anInt1137);
  5123.             }
  5124.         }
  5125.         if(l == 729)
  5126.         {
  5127.             Player class30_sub2_sub4_sub1_sub2_4 = playerArray[i1];
  5128.             if(class30_sub2_sub4_sub1_sub2_4 != null)
  5129.             {
  5130.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, class30_sub2_sub4_sub1_sub2_4.smallY[0], myPlayer.smallX[0], false, class30_sub2_sub4_sub1_sub2_4.smallX[0]);
  5131.                 crossX = super.saveClickX;
  5132.                 crossY = super.saveClickY;
  5133.                 crossType = 2;
  5134.                 crossIndex = 0;
  5135.                 stream.createFrame(39);
  5136.                 stream.method431(i1);
  5137.             }
  5138.         }
  5139.         if(l == 577)
  5140.         {
  5141.             Player class30_sub2_sub4_sub1_sub2_5 = playerArray[i1];
  5142.             if(class30_sub2_sub4_sub1_sub2_5 != null)
  5143.             {
  5144.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, class30_sub2_sub4_sub1_sub2_5.smallY[0], myPlayer.smallX[0], false, class30_sub2_sub4_sub1_sub2_5.smallX[0]);
  5145.                 crossX = super.saveClickX;
  5146.                 crossY = super.saveClickY;
  5147.                 crossType = 2;
  5148.                 crossIndex = 0;
  5149.                 stream.createFrame(139);
  5150.                 stream.method431(i1);
  5151.             }
  5152.         }
  5153.         if(l == 956 && method66(i1, k, j))
  5154.         {
  5155.             stream.createFrame(35);
  5156.             stream.method431(j + baseX);
  5157.             stream.method432(anInt1137);
  5158.             stream.method432(k + baseY);
  5159.             stream.method431(i1 >> 14 & 0x7fff);
  5160.         }
  5161.         if(l == 567)
  5162.         {
  5163.             boolean flag6 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k, myPlayer.smallX[0], false, j);
  5164.             if(!flag6)
  5165.                 flag6 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k, myPlayer.smallX[0], false, j);
  5166.             crossX = super.saveClickX;
  5167.             crossY = super.saveClickY;
  5168.             crossType = 2;
  5169.             crossIndex = 0;
  5170.             stream.createFrame(23);
  5171.             stream.method431(k + baseY);
  5172.             stream.method431(i1);
  5173.             stream.method431(j + baseX);
  5174.         }
  5175.         if(l == 867)
  5176.         {
  5177.             if((i1 & 3) == 0)
  5178.                 anInt1175++;
  5179.             if(anInt1175 >= 59)
  5180.             {
  5181.                 stream.createFrame(200);
  5182.                 stream.writeWord(25501);
  5183.                 anInt1175 = 0;
  5184.             }
  5185.             stream.createFrame(43);
  5186.             stream.method431(k);
  5187.             stream.method432(i1);
  5188.             stream.method432(j);
  5189.             atInventoryLoopCycle = 0;
  5190.             atInventoryInterface = k;
  5191.             atInventoryIndex = j;
  5192.             atInventoryInterfaceType = 2;
  5193.             if(RSInterface.interfaceCache[k].parentID == openInterfaceID)
  5194.                 atInventoryInterfaceType = 1;
  5195.             if(RSInterface.interfaceCache[k].parentID == backDialogID)
  5196.                 atInventoryInterfaceType = 3;
  5197.         }
  5198.         if(l == 543)
  5199.         {
  5200.             stream.createFrame(237);
  5201.             stream.writeWord(j);
  5202.             stream.method432(i1);
  5203.             stream.writeWord(k);
  5204.             stream.method432(anInt1137);
  5205.             atInventoryLoopCycle = 0;
  5206.             atInventoryInterface = k;
  5207.             atInventoryIndex = j;
  5208.             atInventoryInterfaceType = 2;
  5209.             if(RSInterface.interfaceCache[k].parentID == openInterfaceID)
  5210.                 atInventoryInterfaceType = 1;
  5211.             if(RSInterface.interfaceCache[k].parentID == backDialogID)
  5212.                 atInventoryInterfaceType = 3;
  5213.         }
  5214.         if(l == 606)
  5215.         {
  5216.             String s2 = menuActionName[i];
  5217.             int j2 = s2.indexOf("@whi@");
  5218.             if(j2 != -1)
  5219.                 if(openInterfaceID == -1)
  5220.                 {
  5221.                     clearTopInterfaces();
  5222.                     reportAbuseInput = s2.substring(j2 + 5).trim();
  5223.                     canMute = false;
  5224.                     for(int i3 = 0; i3 < RSInterface.interfaceCache.length; i3++)
  5225.                     {
  5226.                         if(RSInterface.interfaceCache[i3] == null || RSInterface.interfaceCache[i3].contentType != 600)
  5227.                             continue;
  5228.                         reportAbuseInterfaceID = openInterfaceID = RSInterface.interfaceCache[i3].parentID;
  5229.                         break;
  5230.                     }
  5231.  
  5232.                 } else
  5233.                 {
  5234.                     pushMessage("Please close the interface you have open before using 'report abuse'", 0, "");
  5235.                 }
  5236.         }
  5237.         if(l == 491)
  5238.         {
  5239.             Player class30_sub2_sub4_sub1_sub2_6 = playerArray[i1];
  5240.             if(class30_sub2_sub4_sub1_sub2_6 != null)
  5241.             {
  5242.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, class30_sub2_sub4_sub1_sub2_6.smallY[0], myPlayer.smallX[0], false, class30_sub2_sub4_sub1_sub2_6.smallX[0]);
  5243.                 crossX = super.saveClickX;
  5244.                 crossY = super.saveClickY;
  5245.                 crossType = 2;
  5246.                 crossIndex = 0;
  5247.                 stream.createFrame(14);
  5248.                 //stream.method432(anInt1284);
  5249.                 stream.writeWord(i1);
  5250.                 //stream.writeWord(anInt1285);
  5251.                 stream.method431(anInt1283);
  5252.             }
  5253.         }
  5254.         if(l == 639)
  5255.         {
  5256.             String s3 = menuActionName[i];
  5257.             int k2 = s3.indexOf("@whi@");
  5258.             if(k2 != -1)
  5259.             {
  5260.                 long l4 = TextClass.longForName(s3.substring(k2 + 5).trim());
  5261.                 int k3 = -1;
  5262.                 for(int i4 = 0; i4 < friendsCount; i4++)
  5263.                 {
  5264.                     if(friendsListAsLongs[i4] != l4)
  5265.                         continue;
  5266.                     k3 = i4;
  5267.                     break;
  5268.                 }
  5269.  
  5270.                 if(k3 != -1 && friendsNodeIDs[k3] > 0)
  5271.                 {
  5272.                     inputTaken = true;
  5273.                     inputDialogState = 0;
  5274.                     messagePromptRaised = true;
  5275.                     promptInput = "";
  5276.                     friendsListAction = 3;
  5277.                     aLong953 = friendsListAsLongs[k3];
  5278.                     inputPromptTitle = "Enter message to send to " + friendsList[k3];
  5279.                 }
  5280.             }
  5281.         }
  5282.         if(l == 454)
  5283.         {
  5284.             stream.createFrame(41);
  5285.             stream.writeWord(i1);
  5286.             stream.method432(j);
  5287.             stream.method432(k);
  5288.             atInventoryLoopCycle = 0;
  5289.             atInventoryInterface = k;
  5290.             atInventoryIndex = j;
  5291.             atInventoryInterfaceType = 2;
  5292.             if(RSInterface.interfaceCache[k].parentID == openInterfaceID)
  5293.                 atInventoryInterfaceType = 1;
  5294.             if(RSInterface.interfaceCache[k].parentID == backDialogID)
  5295.                 atInventoryInterfaceType = 3;
  5296.         }
  5297.         if(l == 478)
  5298.         {
  5299.             Npc class30_sub2_sub4_sub1_sub1_7 = npcArray[i1];
  5300.             if(class30_sub2_sub4_sub1_sub1_7 != null)
  5301.             {
  5302.                 doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, class30_sub2_sub4_sub1_sub1_7.smallY[0], myPlayer.smallX[0], false, class30_sub2_sub4_sub1_sub1_7.smallX[0]);
  5303.                 crossX = super.saveClickX;
  5304.                 crossY = super.saveClickY;
  5305.                 crossType = 2;
  5306.                 crossIndex = 0;
  5307.                 if((i1 & 3) == 0)
  5308.                     anInt1155++;
  5309.                 if(anInt1155 >= 53)
  5310.                 {
  5311.                     stream.createFrame(85);
  5312.                     stream.writeWordBigEndian(66);
  5313.                     anInt1155 = 0;
  5314.                 }
  5315.                 stream.createFrame(18);
  5316.                 stream.method431(i1);
  5317.             }
  5318.         }
  5319.         if(l == 113)
  5320.         {
  5321.             method66(i1, k, j);
  5322.             stream.createFrame(70);
  5323.             stream.method431(j + baseX);
  5324.             stream.writeWord(k + baseY);
  5325.             stream.method433(i1 >> 14 & 0x7fff);
  5326.         }
  5327.         if(l == 872)
  5328.         {
  5329.             method66(i1, k, j);
  5330.             stream.createFrame(234);
  5331.             stream.method433(j + baseX);
  5332.             stream.method432(i1 >> 14 & 0x7fff);
  5333.             stream.method433(k + baseY);
  5334.         }
  5335.         if(l == 502)
  5336.         {
  5337.             method66(i1, k, j);
  5338.             stream.createFrame(132);
  5339.             stream.method433(j + baseX);
  5340.             stream.writeWord(i1 >> 14 & 0x7fff);
  5341.             stream.method432(k + baseY);
  5342.         }
  5343.         if(l == 1125)
  5344.         {
  5345.             atInventoryLoopCycle = 0;
  5346.             atInventoryInterface = k;
  5347.             atInventoryIndex = j;
  5348.             atInventoryInterfaceType = 2;
  5349.             ItemDef itemDef = ItemDef.forID(i1);
  5350.             RSInterface class9_4 = RSInterface.interfaceCache[k];
  5351.             String s5;
  5352.             if(class9_4 != null && class9_4.inventoryValue[j] >= 0x186a0) {
  5353.                 s5 = formatValue(class9_4.inventoryValue[j], ".") + " x " + itemDef.name;
  5354.             } else
  5355.             /*if(itemDef.description != null)
  5356.                 s5 = new String(itemDef.description);
  5357.             else*/
  5358.                 s5 = "It's " + addIndefiniteArticle(itemDef.name) + ".";
  5359.             pushMessage(s5, 0, "");
  5360.         }
  5361.         if(l == 169)
  5362.         {
  5363.             stream.createFrame(185);
  5364.             stream.writeWord(k);
  5365.             RSInterface class9_3 = RSInterface.interfaceCache[k];
  5366.             if(class9_3.valueIndexArray != null && class9_3.valueIndexArray[0][0] == 5)
  5367.             {
  5368.                 int l2 = class9_3.valueIndexArray[0][1];
  5369.                 variousSettings[l2] = 1 - variousSettings[l2];
  5370.                 method33(l2);
  5371.                 needDrawTabArea = true;
  5372.             }
  5373.         }
  5374.         if(l == 447)
  5375.         {
  5376.             itemSelected = 1;
  5377.             anInt1283 = j;
  5378.             anInt1284 = k;
  5379.             anInt1285 = i1;
  5380.             selectedItemName = ItemDef.forID(i1).name;
  5381.             spellSelected = 0;
  5382.             needDrawTabArea = true;
  5383.             return;
  5384.         }
  5385.         if(l == 1226)
  5386.         {
  5387.             int j1 = i1 >> 14 & 0x7fff;
  5388.             ObjectDef class46 = ObjectDef.forID(j1);
  5389.             String s10;
  5390.             if(class46.description != null)
  5391.                 s10 = new String(class46.description);
  5392.             else
  5393.                 s10 = "It's " + addIndefiniteArticle(class46.name) + ".";
  5394.             pushMessage(s10, 0, "");
  5395.         }
  5396.         if(l == 244)
  5397.         {
  5398.             boolean flag7 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k, myPlayer.smallX[0], false, j);
  5399.             if(!flag7)
  5400.                 flag7 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k, myPlayer.smallX[0], false, j);
  5401.             crossX = super.saveClickX;
  5402.             crossY = super.saveClickY;
  5403.             crossType = 2;
  5404.             crossIndex = 0;
  5405.             stream.createFrame(253);
  5406.             stream.method431(j + baseX);
  5407.             stream.method433(k + baseY);
  5408.             stream.method432(i1);
  5409.         }
  5410.         if(l == 1448)
  5411.         {
  5412.             ItemDef itemDef_1 = ItemDef.forID(i1);
  5413.             String s6;
  5414.             if(itemDef_1.description != null)
  5415.                 s6 = new String(itemDef_1.description);
  5416.             else
  5417.                 s6 = "It's " + addIndefiniteArticle(itemDef_1.name) + ".";
  5418.             pushMessage(s6, 0, "");
  5419.         }
  5420.         itemSelected = 0;
  5421.             spellSelected = 0;
  5422.             needDrawTabArea = true;
  5423.  
  5424.     }
  5425.  
  5426.     /*private void method70()
  5427.     {
  5428.         anInt1251 = 0;
  5429.         int j = (myPlayer.x >> 7) + baseX;
  5430.         int k = (myPlayer.y >> 7) + baseY;
  5431.         if(j >= 3053 && j <= 3156 && k >= 3056 && k <= 3136)
  5432.             anInt1251 = 1;
  5433.         if(j >= 3072 && j <= 3118 && k >= 9492 && k <= 9535)
  5434.             anInt1251 = 1;
  5435.         if(anInt1251 == 1 && j >= 3139 && j <= 3199 && k >= 3008 && k <= 3062)
  5436.             anInt1251 = 0;
  5437.     }*/
  5438.  
  5439.     public void run() {
  5440.         resetImageProducers();
  5441.  
  5442.         if(drawFlames) {
  5443.             //drawFlames();
  5444.         } else {
  5445.             super.run();
  5446.         }
  5447.     }
  5448.  
  5449.     private void build3dScreenMenu()
  5450.     {
  5451.         if(itemSelected == 0 && spellSelected == 0)
  5452.         {
  5453.             menuActionName[menuActionRow] = "Walk here";
  5454.             menuActionID[menuActionRow] = 516;
  5455.             menuActionCmd2[menuActionRow] = super.mouseX;
  5456.             menuActionCmd3[menuActionRow] = super.mouseY;
  5457.             menuActionRow++;
  5458.         }
  5459.         int j = -1;
  5460.         for(int k = 0; k < Model.anInt1687; k++)
  5461.         {
  5462.             int l = Model.anIntArray1688[k];
  5463.             int i1 = l & 0x7f;
  5464.             int j1 = l >> 7 & 0x7f;
  5465.             int k1 = l >> 29 & 3;
  5466.             int l1 = l >> 14 & 0x7fff;
  5467.             if(l == j)
  5468.                 continue;
  5469.             j = l;
  5470.             if(k1 == 2 && sceneGraph.getIDTAGForXYZ(plane, i1, j1, l) >= 0)
  5471.             {
  5472.                 ObjectDef class46 = ObjectDef.forID(l1);
  5473.                 if(class46.childrenIDs != null)
  5474.                     class46 = class46.method580();
  5475.                 if(class46 == null)
  5476.                     continue;
  5477.                 if(itemSelected == 1)
  5478.                 {
  5479.                     menuActionName[menuActionRow] = "Use " + selectedItemName + " -> @cya@" + class46.name;
  5480.                     menuActionID[menuActionRow] = 62;
  5481.                     menuActionCmd1[menuActionRow] = l;
  5482.                     menuActionCmd2[menuActionRow] = i1;
  5483.                     menuActionCmd3[menuActionRow] = j1;
  5484.                     menuActionRow++;
  5485.                 } else
  5486.                 if(spellSelected == 1)
  5487.                 {
  5488.                     if((spellUsableOn & 4) == 4)
  5489.                     {
  5490.                         menuActionName[menuActionRow] = spellTooltip + " @cya@" + class46.name;
  5491.                         menuActionID[menuActionRow] = 956;
  5492.                         menuActionCmd1[menuActionRow] = l;
  5493.                         menuActionCmd2[menuActionRow] = i1;
  5494.                         menuActionCmd3[menuActionRow] = j1;
  5495.                         menuActionRow++;
  5496.                     }
  5497.                 } else
  5498.                 {
  5499.                     if(class46.itemActions != null)
  5500.                     {
  5501.                         for(int i2 = 4; i2 >= 0; i2--)
  5502.                             if(class46.itemActions[i2] != null)
  5503.                             {
  5504.                                 menuActionName[menuActionRow] = class46.itemActions[i2] + " @cya@" + class46.name;
  5505.                                 if(i2 == 0)
  5506.                                     menuActionID[menuActionRow] = 502;
  5507.                                 if(i2 == 1)
  5508.                                     menuActionID[menuActionRow] = 900;
  5509.                                 if(i2 == 2)
  5510.                                     menuActionID[menuActionRow] = 113;
  5511.                                 if(i2 == 3)
  5512.                                     menuActionID[menuActionRow] = 872;
  5513.                                 if(i2 == 4)
  5514.                                     menuActionID[menuActionRow] = 1062;
  5515.                                 menuActionCmd1[menuActionRow] = l;
  5516.                                 menuActionCmd2[menuActionRow] = i1;
  5517.                                 menuActionCmd3[menuActionRow] = j1;
  5518.                                 menuActionRow++;
  5519.                             }
  5520.  
  5521.                     }
  5522.                     if(idToggle) {
  5523.                         menuActionName[menuActionRow] = "Examine @cya@" + class46.name + " @gre@(@whi@" + l1 + "@gre@) (@whi@" + (i1 + baseX) + "," + (j1 + baseY) + "@gre@)";
  5524.                     } else {
  5525.                         menuActionName[menuActionRow] = "Examine @cya@" + class46.name;
  5526.                     }
  5527.                     menuActionID[menuActionRow] = 1226;
  5528.                     menuActionCmd1[menuActionRow] = class46.type << 14;
  5529.                     menuActionCmd2[menuActionRow] = i1;
  5530.                     menuActionCmd3[menuActionRow] = j1;
  5531.                     menuActionRow++;
  5532.                 }
  5533.             }
  5534.             if(k1 == 1)
  5535.             {
  5536.                 Npc npc = npcArray[l1];
  5537.                 if(npc.desc.aByte68 == 1 && (npc.x & 0x7f) == 64 && (npc.y & 0x7f) == 64)
  5538.                 {
  5539.                     for(int j2 = 0; j2 < npcCount; j2++)
  5540.                     {
  5541.                         Npc npc2 = npcArray[npcIndices[j2]];
  5542.                         if(npc2 != null && npc2 != npc && npc2.desc.aByte68 == 1 && npc2.x == npc.x && npc2.y == npc.y)
  5543.                             buildAtNPCMenu(npc2.desc, npcIndices[j2], j1, i1);
  5544.                     }
  5545.  
  5546.                     for(int l2 = 0; l2 < playerCount; l2++)
  5547.                     {
  5548.                         Player player = playerArray[playerIndices[l2]];
  5549.                         if(player != null && player.x == npc.x && player.y == npc.y)
  5550.                             buildAtPlayerMenu(i1, playerIndices[l2], player, j1);
  5551.                     }
  5552.  
  5553.                 }
  5554.                 buildAtNPCMenu(npc.desc, l1, j1, i1);
  5555.             }
  5556.             if(k1 == 0)
  5557.             {
  5558.                 Player player = playerArray[l1];
  5559.                 if((player.x & 0x7f) == 64 && (player.y & 0x7f) == 64)
  5560.                 {
  5561.                     for(int k2 = 0; k2 < npcCount; k2++)
  5562.                     {
  5563.                         Npc class30_sub2_sub4_sub1_sub1_2 = npcArray[npcIndices[k2]];
  5564.                         if(class30_sub2_sub4_sub1_sub1_2 != null && class30_sub2_sub4_sub1_sub1_2.desc.aByte68 == 1 && class30_sub2_sub4_sub1_sub1_2.x == player.x && class30_sub2_sub4_sub1_sub1_2.y == player.y)
  5565.                             buildAtNPCMenu(class30_sub2_sub4_sub1_sub1_2.desc, npcIndices[k2], j1, i1);
  5566.                     }
  5567.  
  5568.                     for(int i3 = 0; i3 < playerCount; i3++)
  5569.                     {
  5570.                         Player class30_sub2_sub4_sub1_sub2_2 = playerArray[playerIndices[i3]];
  5571.                         if(class30_sub2_sub4_sub1_sub2_2 != null && class30_sub2_sub4_sub1_sub2_2 != player && class30_sub2_sub4_sub1_sub2_2.x == player.x && class30_sub2_sub4_sub1_sub2_2.y == player.y)
  5572.                             buildAtPlayerMenu(i1, playerIndices[i3], class30_sub2_sub4_sub1_sub2_2, j1);
  5573.                     }
  5574.  
  5575.                 }
  5576.                 buildAtPlayerMenu(i1, l1, player, j1);
  5577.             }
  5578.             if(k1 == 3)
  5579.             {
  5580.                 NodeList class19 = groundArray[plane][i1][j1];
  5581.                 if(class19 != null)
  5582.                 {
  5583.                     for(Item item = (Item)class19.getFirst(); item != null; item = (Item)class19.getNext())
  5584.                     {
  5585.                         ItemDef itemDef = ItemDef.forID(item.ID);
  5586.                         if(itemSelected == 1)
  5587.                         {
  5588.                             menuActionName[menuActionRow] = "Use " + selectedItemName + " -> @lre@" + itemDef.name;
  5589.                             menuActionID[menuActionRow] = 511;
  5590.                             menuActionCmd1[menuActionRow] = item.ID;
  5591.                             menuActionCmd2[menuActionRow] = i1;
  5592.                             menuActionCmd3[menuActionRow] = j1;
  5593.                             menuActionRow++;
  5594.                         } else
  5595.                         if(spellSelected == 1)
  5596.                         {
  5597.                             if((spellUsableOn & 1) == 1)
  5598.                             {
  5599.                                 menuActionName[menuActionRow] = spellTooltip + " @lre@" + itemDef.name;
  5600.                                 menuActionID[menuActionRow] = 94;
  5601.                                 menuActionCmd1[menuActionRow] = item.ID;
  5602.                                 menuActionCmd2[menuActionRow] = i1;
  5603.                                 menuActionCmd3[menuActionRow] = j1;
  5604.                                 menuActionRow++;
  5605.                             }
  5606.                         } else
  5607.                         {
  5608.                             for(int j3 = 4; j3 >= 0; j3--)
  5609.                                 if(itemDef.groundActions != null && itemDef.groundActions[j3] != null)
  5610.                                 {
  5611.                                     menuActionName[menuActionRow] = itemDef.groundActions[j3] + " @lre@" + itemDef.name;
  5612.                                     if(j3 == 0)
  5613.                                         menuActionID[menuActionRow] = 652;
  5614.                                     if(j3 == 1)
  5615.                                         menuActionID[menuActionRow] = 567;
  5616.                                     if(j3 == 2)
  5617.                                         menuActionID[menuActionRow] = 234;
  5618.                                     if(j3 == 3)
  5619.                                         menuActionID[menuActionRow] = 244;
  5620.                                     if(j3 == 4)
  5621.                                         menuActionID[menuActionRow] = 213;
  5622.                                     menuActionCmd1[menuActionRow] = item.ID;
  5623.                                     menuActionCmd2[menuActionRow] = i1;
  5624.                                     menuActionCmd3[menuActionRow] = j1;
  5625.                                     menuActionRow++;
  5626.                                 } else
  5627.                                 if(j3 == 2)
  5628.                                 {
  5629.                                     menuActionName[menuActionRow] = "Take @lre@" + itemDef.name;
  5630.                                     menuActionID[menuActionRow] = 234;
  5631.                                     menuActionCmd1[menuActionRow] = item.ID;
  5632.                                     menuActionCmd2[menuActionRow] = i1;
  5633.                                     menuActionCmd3[menuActionRow] = j1;
  5634.                                     menuActionRow++;
  5635.                                 }
  5636.                         if(idToggle) {
  5637.                             menuActionName[menuActionRow] = "Examine @lre@" + itemDef.name + " @gre@(@whi@" + item.ID + "@gre@)";
  5638.                         } else {
  5639.                             menuActionName[menuActionRow] = "Examine @lre@" + itemDef.name;
  5640.                         }
  5641.                             menuActionID[menuActionRow] = 1448;
  5642.                             menuActionCmd1[menuActionRow] = item.ID;
  5643.                             menuActionCmd2[menuActionRow] = i1;
  5644.                             menuActionCmd3[menuActionRow] = j1;
  5645.                             menuActionRow++;
  5646.                         }
  5647.                     }
  5648.  
  5649.                 }
  5650.             }
  5651.         }
  5652.     }
  5653.  
  5654.     public void cleanUpForQuit() {
  5655.         SignLink.reporterror = false;
  5656.         try {
  5657.             if(socketStream != null)
  5658.                 socketStream.close();
  5659.         }
  5660.         catch(Exception _ex) { }
  5661.         socketStream = null;
  5662.         stopMidi();
  5663.         if(mouseDetection != null)
  5664.             mouseDetection.running = false;
  5665.         mouseDetection = null;
  5666.         onDemandFetcher.disable();
  5667.         onDemandFetcher = null;
  5668.         aStream_834 = null;
  5669.         stream = null;
  5670.         aStream_847 = null;
  5671.         inStream = null;
  5672.         mapCoordinates = null;
  5673.         terrainData = null;
  5674.         aByteArrayArray1247 = null;
  5675.         terrainIndices = null;
  5676.         anIntArray1236 = null;
  5677.         intGroundArray = null;
  5678.         byteGroundArray = null;
  5679.         sceneGraph = null;
  5680.         aClass11Array1230 = null;
  5681.         anIntArrayArray901 = null;
  5682.         anIntArrayArray825 = null;
  5683.         bigX = null;
  5684.         bigY = null;
  5685.         aByteArray912 = null;
  5686.         tabArea = null;
  5687.         mapEdgeIP = null;
  5688.         leftFrame = null;
  5689.         topFrame = null;
  5690.         rightFrame = null;
  5691.         miniMapArea = null;
  5692.         mainGameArea = null;
  5693.         chatArea = null;
  5694.         /* Null pointers for custom sprites */
  5695.         cacheSprite = null;
  5696.         chatBack = null;
  5697.         chatButtons = null;
  5698.         tabBack = null;
  5699.         magicAuto = null;
  5700.         tabHover = null;
  5701.         tabClicked = null;
  5702.         tabSelected = null;
  5703.         newSideIcons = null;
  5704.         mapBack = null;
  5705.         CustomMapback = null;
  5706.         sideIcons = null;
  5707.         sIcons483 = null;
  5708.         sIcons459 = null;
  5709.         redStones = null;
  5710.         compass = null;
  5711.         newHitMark = null;
  5712.         hitMarks = null;
  5713.         hitMark = null;
  5714.         headIcons = null;
  5715.         skullIcons = null;
  5716.         headIconsHint = null;
  5717.         crosses = null;
  5718.         mapDotItem = null;
  5719.         mapDotNPC = null;
  5720.         mapDotPlayer = null;
  5721.         mapDotFriend = null;
  5722.         mapDotTeam = null;
  5723.         mapScenes = null;
  5724.         mapFunctions = null;
  5725.         anIntArrayArray929 = null;
  5726.         playerArray = null;
  5727.         playerIndices = null;
  5728.         anIntArray894 = null;
  5729.         aStreamArray895s = null;
  5730.         anIntArray840 = null;
  5731.         npcArray = null;
  5732.         npcIndices = null;
  5733.         groundArray = null;
  5734.         aClass19_1179 = null;
  5735.         aClass19_1013 = null;
  5736.         aClass19_1056 = null;
  5737.         menuActionCmd2 = null;
  5738.         menuActionCmd3 = null;
  5739.         menuActionID = null;
  5740.         menuActionCmd1 = null;
  5741.         menuActionName = null;
  5742.         variousSettings = null;
  5743.         anIntArray1072 = null;
  5744.         anIntArray1073 = null;
  5745.         aSpriteArray1140 = null;
  5746.         minimap = null;
  5747.         friendsList = null;
  5748.         friendsListAsLongs = null;
  5749.         friendsNodeIDs = null;
  5750.         leftSideFlame = null;
  5751.         rightSideFlame = null;
  5752.         aRSImageProducer_1107 = null;
  5753.         aRSImageProducer_1108 = null;
  5754.         loginScreenArea = null;
  5755.         gameLogo = null;
  5756.         aRSImageProducer_1113 = null;
  5757.         aRSImageProducer_1114 = null;
  5758.         aRSImageProducer_1115 = null;
  5759.         multiOverlay = null;
  5760.         nullLoader();
  5761.         ObjectDef.nullLoader();
  5762.         NpcDef.nullLoader();
  5763.         ItemDef.nullLoader();
  5764.         Flo.cache = null;
  5765.         IdentityKit.cache = null;
  5766.         RSInterface.interfaceCache = null;
  5767.         Animation.anims = null;
  5768.         SpotAnim.cache = null;
  5769.         SpotAnim.aMRUNodes_415 = null;
  5770.         Varp.cache = null;
  5771.         super.fullGameScreen = null;
  5772.         Player.mruNodes = null;
  5773.         Texture.nullLoader();
  5774.         WorldController.nullLoader();
  5775.         Model.nullLoader();
  5776.         Class36.nullLoader();
  5777.         System.gc();
  5778.     }
  5779.  
  5780.     /*private void printDebug()
  5781.     {
  5782.         System.out.println("============");
  5783.         System.out.println("flame-cycle:" + anInt1208);
  5784.         if(onDemandFetcher != null)
  5785.             System.out.println("Od-cycle:" + onDemandFetcher.onDemandCycle);
  5786.         System.out.println("loop-cycle:" + loopCycle);
  5787.         System.out.println("draw-cycle:" + anInt1061);
  5788.         System.out.println("ptype:" + pktType);
  5789.         System.out.println("psize:" + pktSize);
  5790.         if(socketStream != null)
  5791.             socketStream.printDebug();
  5792.         super.shouldDebug = true;
  5793.     }*/
  5794.  
  5795.     Component getGameComponent() {
  5796.          
  5797.         if(SignLink.mainapp != null)
  5798.             return SignLink.mainapp;
  5799.         if(super.gameFrame != null)
  5800.             return super.gameFrame;
  5801.         else
  5802.             return this;
  5803.     }
  5804.  
  5805.     private void method73() {
  5806.         do {
  5807.             int j = readChar(-796);
  5808.             if(j == -1)
  5809.                 break;
  5810.             if(showDeveloperConsole)
  5811.                 handleDeveloperConsoleInput(j);
  5812.             else if(openInterfaceID != -1 && openInterfaceID == reportAbuseInterfaceID) {
  5813.                 if(j == 8 && reportAbuseInput.length() > 0)
  5814.                     reportAbuseInput = reportAbuseInput.substring(0, reportAbuseInput.length() - 1);
  5815.                 if((j >= 97 && j <= 122 || j >= 65 && j <= 90 || j >= 48 && j <= 57 || j == 32) && reportAbuseInput.length() < 12)
  5816.                     reportAbuseInput += (char)j;
  5817.             } else if(messagePromptRaised) {
  5818.                 if(j >= 32 && j <= 122 && promptInput.length() < 80) {
  5819.                     promptInput += (char)j;
  5820.                     inputTaken = true;
  5821.                 }
  5822.                 if(j == 8 && promptInput.length() > 0) {
  5823.                     promptInput = promptInput.substring(0, promptInput.length() - 1);
  5824.                     inputTaken = true;
  5825.                 }
  5826.                 if(j == 13 || j == 10) {
  5827.                     messagePromptRaised = false;
  5828.                     inputTaken = true;
  5829.                     if(friendsListAction == 1) {
  5830.                         long l = TextClass.longForName(promptInput);
  5831.                         addFriend(l);
  5832.                     }
  5833.                     if(friendsListAction == 2 && friendsCount > 0) {
  5834.                         long l1 = TextClass.longForName(promptInput);
  5835.                         delFriend(l1);
  5836.                     }
  5837.                     if(friendsListAction == 3 && promptInput.length() > 0) {
  5838.                         stream.createFrame(126);
  5839.                         stream.writeWordBigEndian(0);
  5840.                         int k = stream.currentOffset;
  5841.                         stream.writeQWord(aLong953);
  5842.                         TextInput.method526(promptInput, stream);
  5843.                         stream.writeBytes(stream.currentOffset - k);
  5844.                         promptInput = TextInput.processText(promptInput);
  5845.                         //promptInput = Censor.doCensor(promptInput);
  5846.                         pushMessage(promptInput, 6, TextClass.fixName(TextClass.nameForLong(aLong953)));
  5847.                         if(privateChatMode == 2) {
  5848.                             privateChatMode = 1;
  5849.                             ////aBoolean1233 = true;
  5850.                             stream.createFrame(95);
  5851.                             stream.writeWordBigEndian(publicChatMode);
  5852.                             stream.writeWordBigEndian(privateChatMode);
  5853.                             stream.writeWordBigEndian(tradeMode);
  5854.                         }
  5855.                     }
  5856.                     if(friendsListAction == 4 && ignoreCount < 100) {
  5857.                         long l2 = TextClass.longForName(promptInput);
  5858.                         addIgnore(l2);
  5859.                     }
  5860.                     if(friendsListAction == 5 && ignoreCount > 0) {
  5861.                         long l3 = TextClass.longForName(promptInput);
  5862.                         delIgnore(l3);
  5863.                     }
  5864.                     if(friendsListAction == 6) {
  5865.                         long l3 = TextClass.longForName(promptInput);
  5866.                         chatJoin(l3);
  5867.                     }
  5868.                 }
  5869.             } else if(inputDialogState == 1) {
  5870.                 if(j >= 48 && j <= 57 && amountOrNameInput.length() < 10 && !amountOrNameInput.toLowerCase().contains("k") && !amountOrNameInput.toLowerCase().contains("m") && !amountOrNameInput.toLowerCase().contains("b")) {
  5871.                     amountOrNameInput += (char)j;
  5872.                     inputTaken = true;
  5873.                 }
  5874.                 if(!amountOrNameInput.equals("") && amountOrNameInput.length() < 10 && (!amountOrNameInput.toLowerCase().contains("k") && !amountOrNameInput.toLowerCase().contains("m") && !amountOrNameInput.toLowerCase().contains("b")) && (j == 107 || j == 109 || j == 98)) {
  5875.                     amountOrNameInput += (char)j;
  5876.                     inputTaken = true;
  5877.                 }
  5878.                 if(j == 8 && amountOrNameInput.length() > 0) {
  5879.                     amountOrNameInput = amountOrNameInput.substring(0, amountOrNameInput.length() - 1);
  5880.                     inputTaken = true;
  5881.                 }
  5882.                 if(j == 13 || j == 10) {
  5883.                     if(amountOrNameInput.length() > 0) {
  5884.                         if(amountOrNameInput.toLowerCase().contains("k"))
  5885.                             amountOrNameInput = amountOrNameInput.replaceAll("k", "000");
  5886.                         else if(amountOrNameInput.toLowerCase().contains("m"))
  5887.                             amountOrNameInput = amountOrNameInput.replaceAll("m", "000000");
  5888.                         else if(amountOrNameInput.toLowerCase().contains("b"))
  5889.                             amountOrNameInput = amountOrNameInput.replaceAll("b", "000000000");
  5890.                         int i1 = 0;
  5891.                         try {
  5892.                             i1 = Integer.parseInt(amountOrNameInput);
  5893.                         } catch(Exception _ex) { }
  5894.                         stream.createFrame(208);
  5895.                         stream.writeDWord(i1);
  5896.                     }
  5897.                     inputDialogState = 0;
  5898.                     inputTaken = true;
  5899.                 }
  5900.             } else if(inputDialogState == 2) {
  5901.                 if(j >= 32 && j <= 122 && amountOrNameInput.length() < 12) {
  5902.                     amountOrNameInput += (char)j;
  5903.                     inputTaken = true;
  5904.                 }
  5905.                 if(j == 8 && amountOrNameInput.length() > 0) {
  5906.                     amountOrNameInput = amountOrNameInput.substring(0, amountOrNameInput.length() - 1);
  5907.                     inputTaken = true;
  5908.                 }
  5909.                 if(j == 13 || j == 10) {
  5910.                     if(amountOrNameInput.length() > 0) {
  5911.                         stream.createFrame(60);
  5912.                         stream.writeQWord(TextClass.longForName(amountOrNameInput));
  5913.                     }
  5914.                     inputDialogState = 0;
  5915.                     inputTaken = true;
  5916.                 }
  5917.             } else if(writingOnStaffTab) {
  5918.                 if((j >= 97 && j <= 122 || j >= 65 && j <= 90 || j >= 48 && j <= 57 || j == 32) && staffTabInput.length() < 12) {
  5919.                     staffTabInput += (char)j;
  5920.                     staffTabInput = TextClass.fixName(staffTabInput);
  5921.                 }
  5922.                 if((j == 13 || j == 10) && staffTabInput.length() > 0) {
  5923.                     long l3 = TextClass.longForName(staffTabInput);
  5924.                     String s = TextClass.nameForLong(l3);
  5925.                     fixedName = TextClass.fixName(s);
  5926.                     showedName = fixedName;
  5927.                     writingOnStaffTab = false;
  5928.                 }
  5929.                 if(j == 8 && staffTabInput.length() > 0)
  5930.                     staffTabInput = staffTabInput.substring(0, staffTabInput.length() - 1);
  5931.             } else if(backDialogID == -1 && !writingOnStaffTab) {
  5932.                 if(j >= 32 && j <= 122 && inputString.length() < 80) {
  5933.                     inputString += (char)j;
  5934.                     inputTaken = true;
  5935.                 }
  5936.                 if(j == 8 && inputString.length() > 0) {
  5937.                     inputString = inputString.substring(0, inputString.length() - 1);
  5938.                     inputTaken = true;
  5939.                 }
  5940.                 if(j == 9)
  5941.                     tabReply();
  5942.  
  5943.                 if((j == 13 || j == 10) && inputString.length() > 0) {
  5944.  
  5945.                     if((inputString.startsWith("::yell") || inputString.startsWith("**")) && myPrivilege != 0 && myPrivilege != 3) {
  5946.                         if(System.currentTimeMillis() - yellTimer < 10000) {
  5947.                             long seconds = 10-(System.currentTimeMillis() - yellTimer) / 1000;
  5948.                             pushMessage("You have to wait "+seconds+" seconds to yell again.", 0, "");
  5949.                             return;
  5950.                         } else
  5951.                             yellTimer = System.currentTimeMillis();
  5952.                     }
  5953.                     if(inputString.startsWith("/"))
  5954.                         inputString = "::" + inputString;
  5955.                     if(inputString.startsWith("**"))
  5956.                         inputString = "::" + inputString;
  5957.                     if(!inputString.startsWith("::") && myPlayer.isMuted == 1) {
  5958.                         inputString = "";
  5959.                         pushMessage("You are muted, no one can hear you.", 0, "");
  5960.                         return;
  5961.                     }
  5962.                     if(inputString.startsWith("::")) {
  5963.                         stream.createFrame(103);
  5964.                         stream.writeWordBigEndian(inputString.length() - 1);
  5965.                         stream.writeString(inputString.substring(2));
  5966.                     } else {
  5967.                         String s = inputString.toLowerCase();  
  5968.                         int color = 0;
  5969.                         if(s.startsWith("yellow:"))
  5970.                         {
  5971.                             color = 0;
  5972.                             inputString = inputString.substring(7);
  5973.                         } else if(s.startsWith("red:"))
  5974.                         {
  5975.                             color = 1;
  5976.                             inputString = inputString.substring(4);
  5977.                         } else if(s.startsWith("green:"))
  5978.                         {
  5979.                             color = 2;
  5980.                             inputString = inputString.substring(6);
  5981.                         } else if(s.startsWith("cyan:"))
  5982.                         {
  5983.                             color = 3;
  5984.                             inputString = inputString.substring(5);
  5985.                         } else if(s.startsWith("purple:"))
  5986.                         {
  5987.                             color = 4;
  5988.                             inputString = inputString.substring(7);
  5989.                         } else if(s.startsWith("white:"))
  5990.                         {
  5991.                             color = 5;
  5992.                             inputString = inputString.substring(6);
  5993.                         } else if(s.startsWith("flash1:"))
  5994.                         {
  5995.                             color = 6;
  5996.                             inputString = inputString.substring(7);
  5997.                         } else if(s.startsWith("flash2:"))
  5998.                         {
  5999.                             color = 7;
  6000.                             inputString = inputString.substring(7);
  6001.                         } else if(s.startsWith("flash3:"))
  6002.                         {
  6003.                             color = 8;
  6004.                             inputString = inputString.substring(7);
  6005.                         } else if(s.startsWith("glow1:"))
  6006.                         {
  6007.                             color = 9;
  6008.                             inputString = inputString.substring(6);
  6009.                         } else if(s.startsWith("glow2:"))
  6010.                         {
  6011.                             color = 10;
  6012.                             inputString = inputString.substring(6);
  6013.                         } else if(s.startsWith("glow3:"))
  6014.                         {
  6015.                             color = 11;
  6016.                             inputString = inputString.substring(6);
  6017.                         }
  6018.                         s = inputString.toLowerCase();
  6019.                         int anim = 0;
  6020.                         if(s.startsWith("wave:")) {
  6021.                             anim = 1;
  6022.                             inputString = inputString.substring(5);
  6023.                         } else if(s.startsWith("wave2:")) {
  6024.                             anim = 2;
  6025.                             inputString = inputString.substring(6);
  6026.                         } else if(s.startsWith("shake:")) {
  6027.                             anim = 3;
  6028.                             inputString = inputString.substring(6);
  6029.                         } else if(s.startsWith("scroll:")) {
  6030.                             anim = 4;
  6031.                             inputString = inputString.substring(7);
  6032.                         } else if(s.startsWith("slide:")) {
  6033.                             anim = 5;
  6034.                             inputString = inputString.substring(6);
  6035.                         }
  6036.                         stream.createFrame(4);
  6037.                         stream.writeWordBigEndian(0);
  6038.                         int j3 = stream.currentOffset;
  6039.                         stream.method425(anim);
  6040.                         stream.method425(color);
  6041.                         aStream_834.currentOffset = 0;
  6042.                         TextInput.method526(inputString, aStream_834);
  6043.                         stream.method441(0, aStream_834.buffer, aStream_834.currentOffset);
  6044.                         stream.writeBytes(stream.currentOffset - j3);
  6045.                         //inputString = TextInput.processText(inputString);
  6046.                         inputString = fixChat(inputString);
  6047.                         //inputString = Censor.doCensor(inputString);
  6048.                         myPlayer.textSpoken = inputString;
  6049.                         myPlayer.textColor = color;
  6050.                         myPlayer.textAnim = anim;
  6051.                         myPlayer.textCycle = 150;
  6052.                         //My players icons showing up when I speak
  6053.                         String cr = "";
  6054.                         if(myPrivilege == 4) cr = "@cr0@";
  6055.                         if(myPrivilege == 3) cr = "@cr3@";
  6056.                         if(myPrivilege == 2) cr = "@cr2@";
  6057.                         if(myPrivilege == 1) cr = "@cr1@";
  6058.                         pushMessage(myPlayer.textSpoken, 2, cr + "<col="+titleColor(myPlayer.titleColor, 0)+">" + myPlayer.title + "</col>" + myPlayer.name);
  6059.                         /*if(publicChatMode == 2)
  6060.                         {
  6061.                             publicChatMode = 3;
  6062.                             //aBoolean1233 = true;
  6063.                             stream.createFrame(95);
  6064.                             stream.writeWordBigEndian(publicChatMode);
  6065.                             stream.writeWordBigEndian(privateChatMode);
  6066.                             stream.writeWordBigEndian(tradeMode);
  6067.                         }*/
  6068.                     }
  6069.                         inputString = "";
  6070.                         inputTaken = true;
  6071.                 }
  6072.             }
  6073.         } while(true);
  6074.     }
  6075.  
  6076.     private void buildPublicChat(int j)
  6077.     {
  6078.         int l = 0;
  6079.         for(int i1 = 0; i1 < 500; i1++)
  6080.         {
  6081.             if(chatMessages[i1] == null)
  6082.                 continue;
  6083.             if(chatTypeView != 1)
  6084.                 continue;
  6085.             int j1 = chatTypes[i1];
  6086.             String s = chatNames[i1];
  6087.             //String ct = chatMessages[i1];
  6088.             int k1 = (70 - l * 14 + 42) + chatAreaScrollPos + 4 + 5;
  6089.             if(k1 < -23)
  6090.                 break;
  6091.             if(s != null && s.startsWith("@cr"))
  6092.                 s = s.substring(5);
  6093.             if(s != null && s.startsWith("<col=")) {
  6094.                 s = s.substring(s.indexOf("</col>")+6);
  6095.             }
  6096.  
  6097.             if((j1 == 1 || j1 == 2) && (j1 == 1 || publicChatMode == 0 || publicChatMode == 1 && isFriendOrSelf(s))) {
  6098.             if(j > k1 - 14 && j <= k1 && !s.equals(myPlayer.name)) {
  6099.                 /**if(myPrivilege >= 1) {
  6100.                     menuActionName[menuActionRow] = "Report abuse @whi@" + s); //TEST
  6101.                     menuActionID[menuActionRow] = 606;
  6102.                     menuActionRow++;
  6103.                 }**/
  6104.                 menuActionName[menuActionRow] = "Add ignore @whi@" + s;
  6105.                 menuActionID[menuActionRow] = 42;
  6106.                 menuActionRow++;
  6107.                 menuActionName[menuActionRow] = "Add friend @whi@" + s;
  6108.                 menuActionID[menuActionRow] = 337;
  6109.                 menuActionRow++;
  6110.             }
  6111.             l++;
  6112.             }
  6113.         }
  6114.     }
  6115.  
  6116.     private void buildFriendChat(int j)
  6117.     {
  6118.         int l = 0;
  6119.         for(int i1 = 0; i1 < 500; i1++) {
  6120.             if(chatMessages[i1] == null)
  6121.                 continue;
  6122.             if(chatTypeView != 2)
  6123.                 continue;
  6124.             int j1 = chatTypes[i1];
  6125.             String s = chatNames[i1];
  6126.             //String ct = chatMessages[i1];
  6127.             int k1 = (70 - l * 14 + 42) + chatAreaScrollPos + 4 + 5;
  6128.             if(k1 < -23)
  6129.                 break;
  6130.             if(s != null && s.startsWith("@cr1@"))
  6131.                 s = s.substring(5);
  6132.             if(s != null && s.startsWith("@cr3@"))
  6133.                 s = s.substring(5);
  6134.             if(s != null && s.startsWith("@cr2@"))
  6135.                 s = s.substring(5);
  6136.             if(s != null && s.startsWith("@cr0@"))
  6137.                 s = s.substring(5);
  6138.             if((j1 == 5 || j1 == 6) && (splitPrivateChat == 0 || chatTypeView == 2) && (j1 == 6 || privateChatMode == 0 || privateChatMode == 1 && isFriendOrSelf(s)))
  6139.                 l++;
  6140.             if((j1 == 3 || j1 == 7) && (splitPrivateChat == 0 || chatTypeView == 2) && (j1 == 7 || privateChatMode == 0 || privateChatMode == 1 && isFriendOrSelf(s)))
  6141.             {
  6142.                 if(j > k1 - 14 && j <= k1) {
  6143.                     /**if(myPrivilege >= 1) {
  6144.                         menuActionName[menuActionRow] = "Report abuse @whi@" + s;
  6145.                         menuActionID[menuActionRow] = 606;
  6146.                         menuActionRow++;
  6147.                     }**/
  6148.                     menuActionName[menuActionRow] = "Add ignore @whi@" + s;
  6149.                     menuActionID[menuActionRow] = 42;
  6150.                     menuActionRow++;
  6151.                     menuActionName[menuActionRow] = "Add friend @whi@" + s;
  6152.                     menuActionID[menuActionRow] = 337;
  6153.                     menuActionRow++;
  6154.                 }
  6155.             l++;
  6156.             }
  6157.         }
  6158.     }
  6159.  
  6160.     private void buildDuelorTrade(int j) {
  6161.         int l = 0;
  6162.         for(int i1 = 0; i1 < 500; i1++) {
  6163.             if(chatMessages[i1] == null)
  6164.                 continue;
  6165.             if(chatTypeView != 3 && chatTypeView != 4)
  6166.                 continue;
  6167.             int j1 = chatTypes[i1];
  6168.             String s = chatNames[i1];
  6169.             int k1 = (70 - l * 14 + 42) + chatAreaScrollPos + 4 + 5;
  6170.             if(k1 < -23)
  6171.                 break;
  6172.             if(s != null && s.startsWith("@cr1@"))
  6173.                 s = s.substring(5);
  6174.             if(s != null && s.startsWith("@cr3@"))
  6175.                 s = s.substring(5);
  6176.             if(s != null && s.startsWith("@cr2@"))
  6177.                 s = s.substring(5);
  6178.             if(s != null && s.startsWith("@cr0@"))
  6179.                 s = s.substring(5);
  6180.             if(chatTypeView == 3 && j1 == 4 && (tradeMode == 0 || tradeMode == 1 && isFriendOrSelf(s))) {
  6181.                 if(j > k1 - 14 && j <= k1) {
  6182.                     menuActionName[menuActionRow] = "Accept trade @whi@" + s;
  6183.                     menuActionID[menuActionRow] = 484;
  6184.                     menuActionRow++;
  6185.                 }
  6186.                 l++;
  6187.             }
  6188.             if(chatTypeView == 4 && j1 == 8 && (tradeMode == 0 || tradeMode == 1 && isFriendOrSelf(s))) {
  6189.                 if(j > k1 - 14 && j <= k1) {
  6190.                     menuActionName[menuActionRow] = "Accept challenge @whi@" + s;
  6191.                     menuActionID[menuActionRow] = 6;
  6192.                     menuActionRow++;
  6193.                 }
  6194.                 l++;
  6195.             }
  6196.             if(j1 == 12) {
  6197.                 if(j > k1 - 14 && j <= k1) {
  6198.                     menuActionName[menuActionRow] = "Go-to @cya@" + s;
  6199.                     menuActionID[menuActionRow] = 915;
  6200.                     menuActionRow++;
  6201.                 }
  6202.                 l++;
  6203.             }
  6204.         }
  6205.     }
  6206.  
  6207.     private void buildChatAreaMenu(int j) { //RIGHTCLICK OPTIONS ON CHATBOX
  6208.         int l = 0;
  6209.         for(int i1 = 0; i1 < 500; i1++) {
  6210.             if(chatMessages[i1] == null)
  6211.                 continue;
  6212.             int j1 = chatTypes[i1];
  6213.             int k1 = (70 - l * 14 + 42) + chatAreaScrollPos + 4 + 5;
  6214.             if(k1 < -23)
  6215.                 break;
  6216.             String s = chatNames[i1];
  6217.             //String ct = chatMessages[i1];
  6218.             //boolean flag = false;
  6219.             if(chatTypeView == 1) {
  6220.                 buildPublicChat(j);
  6221.                 break;
  6222.             }
  6223.             if(chatTypeView == 2) {
  6224.                 buildFriendChat(j);
  6225.                 break;
  6226.             }
  6227.             if(chatTypeView == 3 || chatTypeView == 4) {
  6228.                 buildDuelorTrade(j);
  6229.                 break;
  6230.             }
  6231.             if(chatTypeView == 5) {
  6232.                 break;
  6233.             }
  6234.  
  6235.             if(s != null && s.startsWith("@cr1")) {
  6236.                         s = s.substring(5);
  6237.                         //byte byte0 = 1;
  6238.                 }
  6239.             if(s != null && s.startsWith("@cr3@")) {
  6240.                 s = s.substring(5);
  6241.                 /*boolean flag1 = true;
  6242.                 byte byte0 = 2;*/
  6243.             }
  6244.             if(s != null && s.startsWith("@cr2@")) {
  6245.                 s = s.substring(5);
  6246.                 //byte byte0 = 3;
  6247.             }
  6248.             if(s != null && s.startsWith("@cr0@")) {
  6249.                 s = s.substring(5);
  6250.                 //byte byte0 = 4;
  6251.             }
  6252.             if(s != null && s.startsWith("<col=")) {
  6253.                 s = s.substring(s.indexOf("</col>")+6);
  6254.             }
  6255.             if(j1 == 0)
  6256.                 l++;
  6257.             if((j1 == 1 || j1 == 2) && (j1 == 1 || publicChatMode == 0 || publicChatMode == 1 && isFriendOrSelf(s))) {
  6258.                 if(j > k1 - 14 && j <= k1 && !s.equals(myPlayer.name)) {
  6259.                     /**if(myPrivilege >= 1) {
  6260.                         menuActionName[menuActionRow] = "Report abuse @whi@" + s; //LOL
  6261.                         menuActionID[menuActionRow] = 606;
  6262.                         menuActionRow++;
  6263.                     }**/
  6264.                         menuActionName[menuActionRow] = "Add ignore @whi@" + s;
  6265.                         menuActionID[menuActionRow] = 42;
  6266.                         menuActionRow++;
  6267.                         menuActionName[menuActionRow] = "Add friend @whi@" + s;
  6268.                         menuActionID[menuActionRow] = 337;
  6269.                         menuActionRow++;
  6270.                 }
  6271.                 l++;
  6272.             }
  6273.             if((j1 == 3 || j1 == 7) && splitPrivateChat == 0 && (j1 == 7 || privateChatMode == 0 || privateChatMode == 1 && isFriendOrSelf(s))) {
  6274.                 if(j > k1 - 14 && j <= k1) {
  6275.                     /*if(myPrivilege >= 1) {
  6276.                         menuActionName[menuActionRow] = "Report abuse @whi@" + s;
  6277.                         menuActionID[menuActionRow] = 606;
  6278.                         menuActionRow++;
  6279.                     }*/
  6280.                     menuActionName[menuActionRow] = "Add ignore @whi@" + s;
  6281.                     menuActionID[menuActionRow] = 42;
  6282.                     menuActionRow++;
  6283.                     menuActionName[menuActionRow] = "Add friend @whi@" + s;
  6284.                     menuActionID[menuActionRow] = 337;
  6285.                     menuActionRow++;
  6286.                 }
  6287.                 l++;
  6288.             }
  6289.             if(j1 == 4 && (tradeMode == 0 || tradeMode == 1 && isFriendOrSelf(s))) {
  6290.                 if(j > k1 - 14 && j <= k1) {
  6291.                     menuActionName[menuActionRow] = "Accept trade @whi@" + s;
  6292.                     menuActionID[menuActionRow] = 484;
  6293.                     menuActionRow++;
  6294.                 }
  6295.                 l++;
  6296.             }
  6297.             if((j1 == 5 || j1 == 6) && splitPrivateChat == 0 && privateChatMode < 2)
  6298.                 l++;
  6299.             if(j1 == 8 && (tradeMode == 0 || tradeMode == 1 && isFriendOrSelf(s))) {
  6300.                 if(j > k1 - 14 && j <= k1) {
  6301.                     menuActionName[menuActionRow] = "Accept challenge @whi@" + s;
  6302.                     menuActionID[menuActionRow] = 6;
  6303.                     menuActionRow++;
  6304.                 }
  6305.                 l++;
  6306.             }
  6307.             if(j1 == 9) {
  6308.                 if(j > k1 - 14 && j <= k1) {
  6309.                     menuActionName[menuActionRow] = "Go-to @cya@" + s;
  6310.                     menuActionID[menuActionRow] = 927;
  6311.                     menuActionRow++;
  6312.                 }
  6313.                 l++;
  6314.             }
  6315.             if(j1 == 10) {
  6316.                 if(j > k1 - 14 && j <= k1) {
  6317.                     menuActionName[menuActionRow] = s;
  6318.                     menuActionID[menuActionRow] = 1090;
  6319.                     menuActionRow++;
  6320.                 }
  6321.                 l++;
  6322.             }
  6323.         }
  6324.        
  6325.     }
  6326.    
  6327.    
  6328.    
  6329.     private void drawFriendsListOrWelcomeScreen(RSInterface class9)
  6330.     {
  6331.         int j = class9.contentType;
  6332.         if(j >= 1 && j <= 100 || j >= 701 && j <= 800)
  6333.         {
  6334.             if(j == 1 && anInt900 == 0)
  6335.             {
  6336.                 class9.disabledMessage = "Loading friend list";
  6337.                 class9.atActionType = 0;
  6338.                 return;
  6339.             }
  6340.             if(j == 1 && anInt900 == 1)
  6341.             {
  6342.                 class9.disabledMessage = "Connecting to friendserver";
  6343.                 class9.atActionType = 0;
  6344.                 return;
  6345.             }
  6346.             if(j == 2 && anInt900 != 2)
  6347.             {
  6348.                 class9.disabledMessage = "Please wait...";
  6349.                 class9.atActionType = 0;
  6350.                 return;
  6351.             }
  6352.             int k = friendsCount;
  6353.             if(anInt900 != 2)
  6354.                 k = 0;
  6355.             if(j > 700)
  6356.                 j -= 601;
  6357.             else
  6358.                 j--;
  6359.             if(j >= k)
  6360.             {
  6361.                 class9.disabledMessage = "";
  6362.                 class9.atActionType = 0;
  6363.                 return;
  6364.             } else
  6365.             {
  6366.                 class9.disabledMessage = friendsList[j];
  6367.                 class9.atActionType = 1;
  6368.                 return;
  6369.             }
  6370.         }
  6371.         if(j >= 101 && j <= 200 || j >= 801 && j <= 900)
  6372.         {
  6373.             int l = friendsCount;
  6374.             if(anInt900 != 2)
  6375.                 l = 0;
  6376.             if(j > 800)
  6377.                 j -= 701;
  6378.             else
  6379.                 j -= 101;
  6380.             if(j >= l)
  6381.             {
  6382.                 class9.disabledMessage = "";
  6383.                 class9.atActionType = 0;
  6384.                 return;
  6385.             }
  6386.             if(friendsNodeIDs[j] == 10)
  6387.                 class9.disabledMessage = "@gre@Online";
  6388.             else
  6389.             if(friendsNodeIDs[j] == nodeID)
  6390.                 class9.disabledMessage = "@red@Offline";
  6391.             else
  6392.                 class9.disabledMessage = "@red@Offline";
  6393.             class9.atActionType = 1;
  6394.             return;
  6395.         }
  6396.         if(j == 203)
  6397.         {
  6398.             int i1 = friendsCount;
  6399.             if(anInt900 != 2)
  6400.                 i1 = 0;
  6401.             class9.scrollMax = i1 * 15 + 20;
  6402.             if(class9.scrollMax <= class9.height)
  6403.                 class9.scrollMax = class9.height + 1;
  6404.             return;
  6405.         }
  6406.         if(j >= 401 && j <= 500)
  6407.         {
  6408.             if((j -= 401) == 0 && anInt900 == 0)
  6409.             {
  6410.                 class9.disabledMessage = "Loading ignore list";
  6411.                 class9.atActionType = 0;
  6412.                 return;
  6413.             }
  6414.             if(j == 1 && anInt900 == 0)
  6415.             {
  6416.                 class9.disabledMessage = "Please wait...";
  6417.                 class9.atActionType = 0;
  6418.                 return;
  6419.             }
  6420.             int j1 = ignoreCount;
  6421.             if(anInt900 == 0)
  6422.                 j1 = 0;
  6423.             if(j >= j1)
  6424.             {
  6425.                 class9.disabledMessage = "";
  6426.                 class9.atActionType = 0;
  6427.                 return;
  6428.             } else
  6429.             {
  6430.                 class9.disabledMessage = TextClass.fixName(TextClass.nameForLong(ignoreListAsLongs[j]));
  6431.                 class9.atActionType = 1;
  6432.                 return;
  6433.             }
  6434.         }
  6435.         if(j == 503)
  6436.         {
  6437.             class9.scrollMax = ignoreCount * 15 + 20;
  6438.             if(class9.scrollMax <= class9.height)
  6439.                 class9.scrollMax = class9.height + 1;
  6440.             return;
  6441.         }
  6442.         if(j == 327)
  6443.         {
  6444.             class9.modelRotationY = 150;
  6445.             class9.modelRotationX = (int)(Math.sin((double)loopCycle / 40D) * 256D) & 0x7ff;
  6446.             if(charEditChanged)
  6447.             {
  6448.                 for(int k1 = 0; k1 < 7; k1++)
  6449.                 {
  6450.                     int l1 = charEditIdKit[k1];
  6451.                     if(l1 >= 0 && !IdentityKit.cache[l1].method537())
  6452.                         return;
  6453.                 }
  6454.  
  6455.                 charEditChanged = false;
  6456.                 Model aclass30_sub2_sub4_sub6s[] = new Model[7];
  6457.                 int i2 = 0;
  6458.                 for(int j2 = 0; j2 < 7; j2++)
  6459.                 {
  6460.                     int k2 = charEditIdKit[j2];
  6461.                     if(k2 >= 0)
  6462.                         aclass30_sub2_sub4_sub6s[i2++] = IdentityKit.cache[k2].method538();
  6463.                 }
  6464.  
  6465.                 Model model = new Model(i2, aclass30_sub2_sub4_sub6s);
  6466.                 for(int l2 = 0; l2 < 5; l2++)
  6467.                     if(charEditColors[l2] != 0)
  6468.                     {
  6469.                         model.replaceColor(charEditColorChoises[l2][0], charEditColorChoises[l2][charEditColors[l2]]);
  6470.                         if(l2 == 1)
  6471.                             model.replaceColor(anIntArray1204[0], anIntArray1204[charEditColors[l2]]);
  6472.                     }
  6473.  
  6474.                 model.method469();
  6475.                 model.method470(Animation.anims[myPlayer.anInt1511].anIntArray353[0]);
  6476.                 model.method479(64, 850, -30, -50, -30, true);
  6477.                 class9.disabledMediaType = 5;
  6478.                 class9.disabledMediaID = 0;
  6479.                 RSInterface.method208(aBoolean994, model);
  6480.             }
  6481.             return;
  6482.         }
  6483.         if(j == 328) { //character in equipment interface etc.
  6484.             RSInterface charDisplayModel = class9;
  6485.             /*int verticleTilt = 150;
  6486.             int animationSpeed = (int)(Math.sin((double)loopCycle / 40D) * 256D) & 0x7ff;
  6487.             rsInterface.modelRotationY = verticleTilt;
  6488.             rsInterface.modelRotationX = animationSpeed;*/
  6489.  
  6490.             charDisplayModel.modelZoom = 525;
  6491.             charDisplayModel.modelRotationY = 50;
  6492.             charDisplayModel.yOffset = 25;
  6493.             charDisplayModel.xOffset = 3;
  6494.             if(rollingCharacter) {
  6495.                 if(charDisplayModel.modelRotationX >= 0)
  6496.                     charDisplayModel.modelRotationX -= 10;
  6497.                 if(charDisplayModel.modelRotationX < 0)
  6498.                     charDisplayModel.modelRotationX = 2047;
  6499.             } else {
  6500.                 if(charDisplayModel.modelRotationX != 0) {
  6501.                     if(charDisplayModel.modelRotationX > 1023)
  6502.                         charDisplayModel.modelRotationX += 20;
  6503.                     else
  6504.                         charDisplayModel.modelRotationX -= 20;
  6505.                     if(charDisplayModel.modelRotationX < 0 || charDisplayModel.modelRotationX > 2047)
  6506.                         charDisplayModel.modelRotationX = 0;
  6507.                 }
  6508.             }
  6509.  
  6510.             if(charEditChanged) {
  6511.                 Model characterDisplay = myPlayer.method452();
  6512.                 for(int l2 = 0; l2 < 5; l2++)
  6513.                     if(charEditColors[l2] != 0) {
  6514.                         characterDisplay.replaceColor(charEditColorChoises[l2][0], charEditColorChoises[l2][charEditColors[l2]]);
  6515.                         if(l2 == 1)
  6516.                             characterDisplay.replaceColor(anIntArray1204[0], anIntArray1204[charEditColors[l2]]);
  6517.                     }
  6518.                 int staticFrame = myPlayer.anInt1511;
  6519.                 characterDisplay.method469();
  6520.                 characterDisplay.method470(Animation.anims[staticFrame].anIntArray353[0]);
  6521.                 //characterDisplay.method479(64, 850, -30, -50, -30, true);
  6522.                 charDisplayModel.disabledMediaType = 5;
  6523.                 charDisplayModel.disabledMediaID = 0;
  6524.                 RSInterface.method208(aBoolean994, characterDisplay);
  6525.             }
  6526.             return;
  6527.         }
  6528.         if(j == 324)
  6529.         {
  6530.             if(aSprite_931 == null)
  6531.             {
  6532.                 aSprite_931 = class9.disabledSprite;
  6533.                 aSprite_932 = class9.enabledSprite;
  6534.             }
  6535.             if(charEditGender)
  6536.             {
  6537.                 class9.disabledSprite = aSprite_932;
  6538.                 return;
  6539.             } else
  6540.             {
  6541.                 class9.disabledSprite = aSprite_931;
  6542.                 return;
  6543.             }
  6544.         }
  6545.         if(j == 325)
  6546.         {
  6547.             if(aSprite_931 == null)
  6548.             {
  6549.                 aSprite_931 = class9.disabledSprite;
  6550.                 aSprite_932 = class9.enabledSprite;
  6551.             }
  6552.             if(charEditGender)
  6553.             {
  6554.                 class9.disabledSprite = aSprite_931;
  6555.                 return;
  6556.             } else
  6557.             {
  6558.                 class9.disabledSprite = aSprite_932;
  6559.                 return;
  6560.             }
  6561.         }
  6562.         if(j == 600)
  6563.         {
  6564.             class9.disabledMessage = reportAbuseInput;
  6565.             if(loopCycle % 20 < 10)
  6566.             {
  6567.                 class9.disabledMessage += "|";
  6568.                 return;
  6569.             } else
  6570.             {
  6571.                 class9.disabledMessage += " ";
  6572.                 return;
  6573.             }
  6574.         }
  6575.         if(j == 613)
  6576.             if(myPrivilege >= 1)
  6577.             {
  6578.                 if(canMute) {
  6579.                     class9.disabledColor = 0xff0000;
  6580.                     class9.disabledMessage = "Moderator option: Mute player for 48 hours: <ON>";
  6581.                 } else {
  6582.                     class9.disabledColor = 0xffffff;
  6583.                     class9.disabledMessage = "Moderator option: Mute player for 48 hours: <OFF>";
  6584.                 }
  6585.             } else {
  6586.                 class9.disabledMessage = "";
  6587.             }
  6588.         if(j == 650 || j == 655)
  6589.             if(anInt1193 != 0)
  6590.             {
  6591.                 String s;
  6592.                 if(daysSinceLastLogin == 0)
  6593.                     s = "earlier today";
  6594.                 else
  6595.                 if(daysSinceLastLogin == 1)
  6596.                     s = "yesterday";
  6597.                 else
  6598.                     s = daysSinceLastLogin + " days ago";
  6599.                 class9.disabledMessage = "You last logged in " + s + " from: " + SignLink.dns;
  6600.             } else
  6601.             {
  6602.                 class9.disabledMessage = "";
  6603.             }
  6604.         if(j == 651)
  6605.         {
  6606.             if(unreadMessages == 0)
  6607.             {
  6608.                 class9.disabledMessage = "0 unread messages";
  6609.                 class9.disabledColor = 0xffff00;
  6610.             }
  6611.             if(unreadMessages == 1)
  6612.             {
  6613.                 class9.disabledMessage = "1 unread disabledMessage";
  6614.                 class9.disabledColor = 65280;
  6615.             }
  6616.             if(unreadMessages > 1)
  6617.             {
  6618.                 class9.disabledMessage = unreadMessages + " unread messages";
  6619.                 class9.disabledColor = 65280;
  6620.             }
  6621.         }
  6622.         if(j == 652)
  6623.             if(daysSinceRecovChange == 201)
  6624.             {
  6625.                 if(membersInt == 1)
  6626.                     class9.disabledMessage = "@yel@This is a non-members world: @whi@Since you are a member we";
  6627.                 else
  6628.                     class9.disabledMessage = "";
  6629.             } else
  6630.             if(daysSinceRecovChange == 200)
  6631.             {
  6632.                 class9.disabledMessage = "You have not yet set any password recovery questions.";
  6633.             } else
  6634.             {
  6635.                 String s1;
  6636.                 if(daysSinceRecovChange == 0)
  6637.                     s1 = "Earlier today";
  6638.                 else
  6639.                 if(daysSinceRecovChange == 1)
  6640.                     s1 = "Yesterday";
  6641.                 else
  6642.                     s1 = daysSinceRecovChange + " days ago";
  6643.                 class9.disabledMessage = s1 + " you changed your recovery questions";
  6644.             }
  6645.         if(j == 653)
  6646.             if(daysSinceRecovChange == 201)
  6647.             {
  6648.                 if(membersInt == 1)
  6649.                     class9.disabledMessage = "@whi@recommend you use a members world instead. You may use";
  6650.                 else
  6651.                     class9.disabledMessage = "";
  6652.             } else
  6653.             if(daysSinceRecovChange == 200)
  6654.                 class9.disabledMessage = "We strongly recommend you do so now to secure your account.";
  6655.             else
  6656.                 class9.disabledMessage = "If you do not remember making this change then cancel it immediately";
  6657.         if(j == 654)
  6658.         {
  6659.             if(daysSinceRecovChange == 201)
  6660.                 if(membersInt == 1)
  6661.                 {
  6662.                     class9.disabledMessage = "@whi@this world but member benefits are unavailable whilst here.";
  6663.                     return;
  6664.                 } else
  6665.                 {
  6666.                     class9.disabledMessage = "";
  6667.                     return;
  6668.                 }
  6669.             if(daysSinceRecovChange == 200)
  6670.             {
  6671.                 class9.disabledMessage = "Do this from the 'account management' area on our front webpage";
  6672.                 return;
  6673.             }
  6674.             class9.disabledMessage = "Do this from the 'account management' area on our front webpage";
  6675.         }
  6676.     }
  6677.  
  6678.     public void tabReply() {
  6679.         String name = null;
  6680.         for(int j = 0; j < 100; j++)
  6681.             if(chatMessages[j] != null) {
  6682.                 int chatType = chatTypes[j];
  6683.                 if(chatType == 3 || chatType == 7) {
  6684.                             name = chatNames[j];
  6685.                             break;
  6686.                 }
  6687.             }
  6688.         if(name != null && name.startsWith("@cr"))
  6689.             name = name.substring(6);
  6690.         if(name == null)
  6691.             pushMessage("You haven't received any messages to which you can reply.", 0, "");
  6692.         try {
  6693.             if(name != null) {
  6694.                 long namel = TextClass.longForName(name.trim());
  6695.                 int node = -1;
  6696.                 for(int count = 0; count < friendsCount; count++) {
  6697.                     if(friendsListAsLongs[count] != namel)
  6698.                         continue;
  6699.                     node = count;
  6700.                     break;
  6701.                 }
  6702.                 if(node != -1 && friendsNodeIDs[node] > 0) {
  6703.                     inputTaken = true;
  6704.                     inputDialogState = 0;
  6705.                     messagePromptRaised = true;
  6706.                     promptInput = "";
  6707.                     friendsListAction = 3;
  6708.                     aLong953 = friendsListAsLongs[node];
  6709.                     inputPromptTitle = "Enter message to send to " + friendsList[node];
  6710.                 } else {
  6711.                     pushMessage(capitalize(name)+" is currently offline.", 0, "");
  6712.                 }
  6713.             }
  6714.         } catch (Exception e) {
  6715.             e.printStackTrace();
  6716.         }
  6717.     }
  6718.  
  6719.     private void drawSplitPrivateChat()
  6720.     {
  6721.         if(splitPrivateChat == 0)
  6722.             return;
  6723.         RSFont textDrawingArea = regularFont;
  6724.         int i = 0;
  6725.         if(anInt1104 != 0)
  6726.             i = 1;
  6727.         for(int j = 0; j < 100; j++)
  6728.             if(chatMessages[j] != null)
  6729.             {
  6730.                 int k = chatTypes[j];
  6731.                 String s = chatNames[j];
  6732.                 byte byte1 = 0;
  6733.                 if(s != null && s.startsWith("@cr1@")) {
  6734.                             s = s.substring(5);
  6735.                                 byte1 = 1;
  6736.                 }
  6737.                 if(s != null && s.startsWith("@cr3@")) {//TEST
  6738.                     s = s.substring(5);
  6739.                     byte1 = 2;
  6740.                 }
  6741.                 if(s != null && s.startsWith("@cr2@")) {
  6742.                     s = s.substring(5);
  6743.                     byte1 = 3;
  6744.                 }
  6745.                 if(s != null && s.startsWith("@cr0@")) {
  6746.                     s = s.substring(5);
  6747.                     byte1 = 4;
  6748.                 }
  6749.                 if((k == 3 || k == 7) && (k == 7 || privateChatMode == 0 || privateChatMode == 1 && isFriendOrSelf(s)))
  6750.                 {
  6751.                     int l = 329 - i * 13;
  6752.                     int k1 = 4;
  6753.                     textDrawingArea.method385(0, "From", l, k1); //PM
  6754.                     textDrawingArea.method385(65535, "From", l - 1, k1);
  6755.                     k1 += textDrawingArea.getTextWidth("From ");
  6756.                     if(byte1 == 1) {
  6757.                         modIcons[1].drawSprite(k1, l - 12);
  6758.                         k1 += 14;
  6759.                     }
  6760.                     if(byte1 == 2) {
  6761.                         modIcons[3].drawSprite(k1, l - 12);
  6762.                         k1 += 14;
  6763.                     }
  6764.                     if(byte1 == 3) {
  6765.                         modIcons[2].drawSprite(k1, l - 12);
  6766.                         k1 += 14;
  6767.                     }
  6768.                     if(byte1 == 4) {
  6769.                         modIcons[0].drawSprite(k1, l - 12);
  6770.                         k1 += 14;
  6771.                     }
  6772.                     textDrawingArea.method385(0, s + ": " + chatMessages[j], l, k1);
  6773.                     textDrawingArea.method385(65535, s + ": " + chatMessages[j], l - 1, k1);
  6774.                     if(++i >= 5)
  6775.                         return;
  6776.                 }
  6777.                 if(k == 5 && privateChatMode < 2)
  6778.                 {
  6779.                     int i1 = 329 - i * 13;
  6780.                     textDrawingArea.method385(0, chatMessages[j], i1, 4);
  6781.                     textDrawingArea.method385(65535, chatMessages[j], i1 - 1, 4);
  6782.                     if(++i >= 5)
  6783.                         return;
  6784.                 }
  6785.                 if(k == 6 && privateChatMode < 2)
  6786.                 {
  6787.                     int j1 = 329 - i * 13;
  6788.                     textDrawingArea.method385(0, "To " + s + ": " + chatMessages[j], j1, 4);
  6789.                     textDrawingArea.method385(65535, "To " + s + ": " + chatMessages[j], j1 - 1, 4);
  6790.                     if(++i >= 5)
  6791.                         return;
  6792.                 }
  6793.             }
  6794.  
  6795.     }
  6796.     public void pushMessage(String s, int i, String s1) {
  6797.         if(s.startsWith(":cmd:")) {
  6798.             sendDeveloperConsole(s.substring(5));
  6799.             return;
  6800.         }
  6801.         if(s.startsWith(":xpcount:")) {
  6802.             myPlayer.xpCount = Integer.parseInt(s.substring(9));
  6803.             return;
  6804.         }
  6805.         if(s.startsWith(":yell:")) {
  6806.             i = 12;
  6807.             s = s.substring(6);
  6808.             s1 = s.substring(s.indexOf("<col=1783434>")+13, s.lastIndexOf("</col>"));
  6809.         }
  6810.         if(i == 0 && dialogID != -1) {
  6811.             chatBoxMessage = s;
  6812.             super.clickMode3 = 0;
  6813.         }
  6814.         if(backDialogID == -1)
  6815.             inputTaken = true;
  6816.         for(int j = 499; j > 0; j--) {
  6817.             chatTypes[j] = chatTypes[j - 1];
  6818.             chatNames[j] = chatNames[j - 1];
  6819.             chatMessages[j] = chatMessages[j - 1];
  6820.             chatRights[j] = chatRights[j - 1];
  6821.             clanNames[j] = clanNames[j - 1];
  6822.         }
  6823.         chatTypes[0] = i;
  6824.         chatNames[0] = s1;
  6825.         chatMessages[0] = s;
  6826.         chatRights[0] = rights;
  6827.         clanNames[0] = clanname;
  6828.     }
  6829.    
  6830.     public static void setTab(int id) {
  6831.         needDrawTabArea = true;
  6832.         tabID = id;
  6833.         tabAreaAltered = true;
  6834.     }
  6835.     public int tabHPos;
  6836.     private void processTabClick() {
  6837.             if(!fullScreenOn) {
  6838.                 if(super.mouseX >= 706 && super.mouseX <= 762 && super.mouseY >= 95 && super.mouseY < 128){
  6839.                     runHover = true;
  6840.                 } else {
  6841.                     runHover = false;
  6842.                 }
  6843.                 if(super.mouseX >= 706 && super.mouseX <= 762 && super.mouseY >= 52 && super.mouseY < 87){
  6844.                     prayHover = true;
  6845.                 } else {
  6846.                     prayHover = false;
  6847.                 }
  6848.                 if(super.mouseX >= 765-24 && super.mouseX <= 765 && super.mouseY >= 3 && super.mouseY <= 25){
  6849.                     logHover = true;
  6850.                 } else {
  6851.                     logHover = false;
  6852.                 }
  6853.             }
  6854.             if(!fullScreenOn == false){
  6855.         if(super.clickMode3 == 1) {
  6856.             if(super.saveClickX >= 524 && super.saveClickX <= 561 && super.saveClickY >= 169 && super.saveClickY < 205 && tabInterfaceIDs[0] != -1)
  6857.             {
  6858.                 needDrawTabArea = true;
  6859.                 tabID = 0;
  6860.                 tabAreaAltered = true;
  6861.             }
  6862.             if(super.saveClickX >= 562 && super.saveClickX <= 594 && super.saveClickY >= 168 && super.saveClickY < 205 && tabInterfaceIDs[1] != -1)
  6863.             {
  6864.                 needDrawTabArea = true;
  6865.                 tabID = 1;
  6866.                 tabAreaAltered = true;
  6867.             }
  6868.             if(super.saveClickX >= 595 && super.saveClickX <= 626 && super.saveClickY >= 168 && super.saveClickY < 205 && tabInterfaceIDs[2] != -1)
  6869.             {
  6870.                 needDrawTabArea = true;
  6871.                 tabID = 2;
  6872.                 tabAreaAltered = true;
  6873.             }
  6874.             if(super.saveClickX >= 627 && super.saveClickX <= 660 && super.saveClickY >= 168 && super.saveClickY < 203 && tabInterfaceIDs[3] != -1)
  6875.             {
  6876.                 needDrawTabArea = true;
  6877.                 tabID = 3;
  6878.                 tabAreaAltered = true;
  6879.             }
  6880.             if(super.saveClickX >= 661 && super.saveClickX <= 693 && super.saveClickY >= 168 && super.saveClickY < 205 && tabInterfaceIDs[4] != -1)
  6881.             {
  6882.                 needDrawTabArea = true;
  6883.                 tabID = 4;
  6884.                 tabAreaAltered = true;
  6885.             }
  6886.             if(super.saveClickX >= 694 && super.saveClickX <= 725 && super.saveClickY >= 168 && super.saveClickY < 205 && tabInterfaceIDs[5] != -1)
  6887.             {
  6888.                 needDrawTabArea = true;
  6889.                 tabID = 5;
  6890.                 tabAreaAltered = true;
  6891.             }
  6892.             if(super.saveClickX >= 726 && super.saveClickX <= 765 && super.saveClickY >= 169 && super.saveClickY < 205 && tabInterfaceIDs[6] != -1)
  6893.             {
  6894.                 needDrawTabArea = true;
  6895.                 tabID = 6;
  6896.                 tabAreaAltered = true;
  6897.             }
  6898.             if(super.saveClickX >= 524 && super.saveClickX <= 561 && super.saveClickY >= 466 && super.saveClickY < 503 && tabInterfaceIDs[7] != -1)
  6899.             {
  6900.                 needDrawTabArea = true;
  6901.                 tabID = 7;
  6902.                 tabAreaAltered = true;
  6903.             }
  6904.             if(super.saveClickX >= 562 && super.saveClickX <= 594 && super.saveClickY >= 466 && super.saveClickY < 503 && tabInterfaceIDs[8] != -1)
  6905.             {
  6906.                 needDrawTabArea = true;
  6907.                 tabID = 8;
  6908.                 tabAreaAltered = true;
  6909.             }
  6910.             if(super.saveClickX >= 595 && super.saveClickX <= 627 && super.saveClickY >= 466 && super.saveClickY < 503 && tabInterfaceIDs[9] != -1)
  6911.             {
  6912.                 needDrawTabArea = true;
  6913.                 tabID = 9;
  6914.                 tabAreaAltered = true;
  6915.             }
  6916.             if(super.saveClickX >= 627 && super.saveClickX <= 664 && super.saveClickY >= 466 && super.saveClickY < 503 && tabInterfaceIDs[10] != -1)
  6917.             {
  6918.                 needDrawTabArea = true;
  6919.                 tabID = 10;
  6920.                 tabAreaAltered = true;
  6921.             }
  6922.             if(super.saveClickX >= 661 && super.saveClickX <= 694 && super.saveClickY >= 466 && super.saveClickY < 503 && tabInterfaceIDs[11] != -1)
  6923.             {
  6924.                 needDrawTabArea = true;
  6925.                 tabID = 11;
  6926.                 tabAreaAltered = true;
  6927.             }
  6928.             if(super.saveClickX >= 695 && super.saveClickX <= 725 && super.saveClickY >= 466 && super.saveClickY < 503 && tabInterfaceIDs[12] != -1)
  6929.             {
  6930.                 needDrawTabArea = true;
  6931.                 tabID = 12;
  6932.                 tabAreaAltered = true;
  6933.             }
  6934.             if(super.saveClickX >= 726 && super.saveClickX <= 765 && super.saveClickY >= 466 && super.saveClickY < 502 && tabInterfaceIDs[13] != -1)
  6935.             {
  6936.                 needDrawTabArea = true;
  6937.                 tabID = 13;
  6938.                 tabAreaAltered = true;
  6939.             }
  6940.         }
  6941.         } else {
  6942.         if(super.mouseX >= 521 && super.mouseX <= 550 && super.mouseY >= 169 && super.mouseY < 205) {
  6943.             tabHPos = 0;
  6944.             needDrawTabArea = true;
  6945.             tabAreaAltered = true;
  6946.         } else if(super.mouseX >= 552 && super.mouseX <= 581 && super.mouseY >= 168 && super.mouseY < 205) {
  6947.             tabHPos = 1;
  6948.             needDrawTabArea = true;
  6949.             tabAreaAltered = true;
  6950.         } else if(super.mouseX >= 582 && super.mouseX <= 611 && super.mouseY >= 168 && super.mouseY < 205) {
  6951.             tabHPos = 2;
  6952.             needDrawTabArea = true;
  6953.             tabAreaAltered = true;
  6954.         } else if(super.mouseX >= 612 && super.mouseX <= 641 && super.mouseY >= 168 && super.mouseY < 203) {
  6955.             tabHPos = 3;
  6956.             needDrawTabArea = true;
  6957.             tabAreaAltered = true;
  6958.         } else if(super.mouseX >= 642 && super.mouseX <= 671 && super.mouseY >= 168 && super.mouseY < 205) {
  6959.             tabHPos = 4;
  6960.             needDrawTabArea = true;
  6961.             tabAreaAltered = true;
  6962.         } else if(super.mouseX >= 672 && super.mouseX <= 701 && super.mouseY >= 168 && super.mouseY < 205) {
  6963.             tabHPos = 5;
  6964.             needDrawTabArea = true;
  6965.             tabAreaAltered = true;
  6966.         } else if(super.mouseX >= 702 && super.mouseX <= 731 && super.mouseY >= 169 && super.mouseY < 205) {
  6967.             tabHPos = 6;
  6968.             needDrawTabArea = true;
  6969.             tabAreaAltered = true;
  6970.         } else if(super.mouseX >= 732 && super.mouseX <= 761 && super.mouseY >= 169 && super.mouseY < 205) {
  6971.             tabHPos = 7;
  6972.             needDrawTabArea = true;
  6973.             tabAreaAltered = true;
  6974.         } else if(super.mouseX >= 522 && super.mouseX <= 551 && super.mouseY >= 466 && super.mouseY < 503) {
  6975.             tabHPos = 15;
  6976.             needDrawTabArea = true;
  6977.             tabAreaAltered = true;
  6978.         } else if(super.mouseX >= 552 && super.mouseX <= 581 && super.mouseY >= 466 && super.mouseY < 503) {
  6979.             tabHPos = 8;
  6980.             needDrawTabArea = true;
  6981.             tabAreaAltered = true;
  6982.         } else if(super.mouseX >= 582 && super.mouseX <= 611 && super.mouseY >= 466 && super.mouseY < 503) {
  6983.             tabHPos = 9;
  6984.             needDrawTabArea = true;
  6985.             tabAreaAltered = true;
  6986.         } else if(super.mouseX >= 612 && super.mouseX <= 641 && super.mouseY >= 466 && super.mouseY < 503) {
  6987.             tabHPos = 10;
  6988.             needDrawTabArea = true;
  6989.             tabAreaAltered = true;
  6990.         } else if(super.mouseX >= 642 && super.mouseX <= 671 && super.mouseY >= 466 && super.mouseY < 503) {
  6991.             tabHPos = 11;
  6992.             needDrawTabArea = true;
  6993.             tabAreaAltered = true;
  6994.         } else if(super.mouseX >= 672 && super.mouseX <= 701 && super.mouseY >= 466 && super.mouseY < 503) {
  6995.             tabHPos = 12;
  6996.             needDrawTabArea = true;
  6997.             tabAreaAltered = true;
  6998.         } else if(super.mouseX >= 702 && super.mouseX <= 731 && super.mouseY >= 466 && super.mouseY < 502) {
  6999.             tabHPos = 13;
  7000.             needDrawTabArea = true;
  7001.             tabAreaAltered = true;
  7002.         } else if(super.mouseX >= 732 && super.mouseX <= 761 && super.mouseY >= 466 && super.mouseY < 502) {
  7003.             tabHPos = 14;
  7004.             needDrawTabArea = true;
  7005.             tabAreaAltered = true;
  7006.         } else {
  7007.             tabHPos = -1;
  7008.             needDrawTabArea = true;
  7009.             tabAreaAltered = true;
  7010.         }
  7011.         if(super.clickMode3 == 1) {
  7012.             if(super.saveClickX >= 522 && super.saveClickX <= 551 && super.saveClickY >= 169 && super.saveClickY < 205 && tabInterfaceIDs[0] != -1) {
  7013.                 needDrawTabArea = true;
  7014.                 tabID = 0;
  7015.                 tabAreaAltered = true;
  7016.             } else if(super.saveClickX >= 552 && super.saveClickX <= 581 && super.saveClickY >= 168 && super.saveClickY < 205 && tabInterfaceIDs[1] != -1) {
  7017.                 needDrawTabArea = true;
  7018.                 tabID = 1;
  7019.                 tabAreaAltered = true;
  7020.             } else if(super.saveClickX >= 582 && super.saveClickX <= 611 && super.saveClickY >= 168 && super.saveClickY < 205 && tabInterfaceIDs[2] != -1) {
  7021.                 needDrawTabArea = true;
  7022.                 tabID = 2;
  7023.                 tabAreaAltered = true;
  7024.             } else if(super.saveClickX >= 612 && super.saveClickX <= 641 && super.saveClickY >= 168 && super.saveClickY < 203 && tabInterfaceIDs[14] != -1) {
  7025.                 needDrawTabArea = true;
  7026.                 tabID = 14;
  7027.                 tabAreaAltered = true;
  7028.             } else if(super.saveClickX >= 642 && super.saveClickX <= 671 && super.saveClickY >= 168 && super.saveClickY < 205 && tabInterfaceIDs[3] != -1) {
  7029.                 needDrawTabArea = true;
  7030.                 tabID = 3;
  7031.                 tabAreaAltered = true;
  7032.             } else if(super.saveClickX >= 672 && super.saveClickX <= 701 && super.saveClickY >= 168 && super.saveClickY < 205 && tabInterfaceIDs[4] != -1) {
  7033.                 needDrawTabArea = true;
  7034.                 tabID = 4;
  7035.                 tabAreaAltered = true;
  7036.             } else if(super.saveClickX >= 702 && super.saveClickX <= 731 && super.saveClickY >= 169 && super.saveClickY < 205 && tabInterfaceIDs[5] != -1) {
  7037.                 needDrawTabArea = true;
  7038.                 tabID = 5;
  7039.                 tabAreaAltered = true;
  7040.             } else if(super.saveClickX >= 732 && super.saveClickX <= 761 && super.saveClickY >= 169 && super.saveClickY < 205 && tabInterfaceIDs[6] != -1) {
  7041.                 needDrawTabArea = true;
  7042.                 tabID = 6;
  7043.                 tabAreaAltered = true;
  7044.             } else if(super.saveClickX >= 522 && super.saveClickX <= 551 && super.saveClickY >= 466 && super.saveClickY < 503 && tabInterfaceIDs[16] != -1) {
  7045.                 needDrawTabArea = true;
  7046.                 tabID = 16;
  7047.                 tabAreaAltered = true;
  7048.             } else if(super.saveClickX >= 552 && super.saveClickX <= 581 && super.saveClickY >= 466 && super.saveClickY < 503 && tabInterfaceIDs[8] != -1) {
  7049.                 needDrawTabArea = true;
  7050.                 tabID = 8;
  7051.                 tabAreaAltered = true;
  7052.             } else if(super.saveClickX >= 582 && super.saveClickX <= 611 && super.saveClickY >= 466 && super.saveClickY < 503 && tabInterfaceIDs[9] != -1) {
  7053.                 needDrawTabArea = true;
  7054.                 tabID = 9;
  7055.                 tabAreaAltered = true;
  7056.             } else if(super.saveClickX >= 612 && super.saveClickX <= 641 && super.saveClickY >= 466 && super.saveClickY < 503 && tabInterfaceIDs[7] != -1) {
  7057.                 needDrawTabArea = true;
  7058.                 tabID = 7;
  7059.                 tabAreaAltered = true;
  7060.             } else if(super.saveClickX >= 642 && super.saveClickX <= 671 && super.saveClickY >= 466 && super.saveClickY < 503 && tabInterfaceIDs[11] != -1) {
  7061.                 needDrawTabArea = true;
  7062.                 tabID = 11;
  7063.                 tabAreaAltered = true;
  7064.             } else if(super.saveClickX >= 672 && super.saveClickX <= 701 && super.saveClickY >= 466 && super.saveClickY < 503 && tabInterfaceIDs[12] != -1) {
  7065.                 needDrawTabArea = true;
  7066.                 tabID = 12;
  7067.                 tabAreaAltered = true;
  7068.             } else if(super.saveClickX >= 702 && super.saveClickX <= 731 && super.saveClickY >= 466 && super.saveClickY < 502 && tabInterfaceIDs[13] != -1) {
  7069.                 needDrawTabArea = true;
  7070.                 tabID = 13;
  7071.                 tabAreaAltered = true;
  7072.             } else if(super.saveClickX >= 732 && super.saveClickX <= 761 && super.saveClickY >= 466 && super.saveClickY < 502 && tabInterfaceIDs[15] != -1) {
  7073.                 needDrawTabArea = true;
  7074.                 tabID = 15;
  7075.                 tabAreaAltered = true;
  7076.             }
  7077.             /* Logout X */
  7078.             else if(super.saveClickX >= 742 && super.saveClickX <= 764 && super.saveClickY >= 1 && super.saveClickY < 24 && tabInterfaceIDs[10] != -1) {
  7079.                 needDrawTabArea = true;
  7080.                 tabID = 10;
  7081.                 tabAreaAltered = true;
  7082.             }
  7083.  
  7084.         }
  7085.     }
  7086.        
  7087.     }
  7088.  
  7089.     private void resetImageProducers2() {
  7090.         if(chatArea != null)
  7091.             return;
  7092.         nullLoader();
  7093.         super.fullGameScreen = null;
  7094.         aRSImageProducer_1107 = null;
  7095.         aRSImageProducer_1108 = null;
  7096.         loginScreenArea = null;
  7097.         leftSideFlame = null;
  7098.         rightSideFlame = null;
  7099.         gameLogo = null;
  7100.         aRSImageProducer_1113 = null;
  7101.         aRSImageProducer_1114 = null;
  7102.         aRSImageProducer_1115 = null;
  7103.         chatArea = new RSImageProducer(516, 165, getGameComponent());
  7104.         miniMapArea = new RSImageProducer(249, 168, getGameComponent());
  7105.         DrawingArea.clear();
  7106.         CustomMapback[getSpriteID()].drawSprite(0, 0);
  7107.         tabArea = new RSImageProducer(250, 335, getGameComponent());
  7108.         mainGameArea = new RSImageProducer(512, 334, getGameComponent());
  7109.         DrawingArea.clear();
  7110.         welcomeScreenRaised = true;
  7111.     }
  7112.  
  7113.     public String getDocumentBaseHost() {
  7114.         if(SignLink.mainapp != null) {
  7115.             return SignLink.mainapp.getDocumentBase().getHost().toLowerCase();
  7116.         }
  7117.         return null;
  7118.     }
  7119.  
  7120.     private void method81(Sprite sprite, int j, int k) {
  7121.         int l = k * k + j * j;
  7122.         if(l > 4225 && l < 0x15f90) {
  7123.             int i1 = minimapInt1 + minimapInt2 & 0x7ff;
  7124.             int j1 = Model.modelIntArray1[i1];
  7125.             int k1 = Model.modelIntArray2[i1];
  7126.             j1 = (j1 * 256) / (minimapInt3 + 256);
  7127.             k1 = (k1 * 256) / (minimapInt3 + 256);
  7128.             int l1 = j * j1 + k * k1 >> 16;
  7129.             int i2 = j * k1 - k * j1 >> 16;
  7130.             double d = Math.atan2(l1, i2);
  7131.             int j2 = (int)(Math.sin(d) * 63D);
  7132.             int k2 = (int)(Math.cos(d) * 57D);
  7133.             mapEdge.method353(83 - k2 - 20, d, (94 + j2 + 4) - 10);
  7134.             CustomMapback[getSpriteID()].drawSprite(0, 0);
  7135.             return;
  7136.         } else {
  7137.             markMinimap(sprite, k, j, false);
  7138.             CustomMapback[getSpriteID()].drawSprite(0, 0);
  7139.         }
  7140.     }
  7141.    
  7142.     public void processRightClick() {
  7143.         if(activeInterfaceType != 0) {
  7144.             return;
  7145.         }
  7146.         menuActionName[0] = "Cancel";
  7147.         menuActionID[0] = 1107;
  7148.         menuActionRow = 1;
  7149.         if(fullscreenInterfaceID != -1) {
  7150.             anInt886 = 0;
  7151.             anInt1315 = 0;
  7152.             buildInterfaceMenu(8, RSInterface.interfaceCache[fullscreenInterfaceID], super.mouseX, 8, super.mouseY, 0);
  7153.             if(anInt886 != anInt1026) {
  7154.                 anInt1026 = anInt886;
  7155.             }
  7156.             if(anInt1315 != anInt1129) {
  7157.                 anInt1129 = anInt1315;
  7158.             }
  7159.             return;
  7160.         }
  7161.         buildSplitPrivateChatMenu();
  7162.         anInt886 = 0;
  7163.         anInt1315 = 0;
  7164.         if (super.mouseX > 0 && super.mouseY > 0 && super.mouseX < 516
  7165.                 && super.mouseY < 338) {
  7166.             if(openInterfaceID != -1) {
  7167.                 buildInterfaceMenu(4, RSInterface.interfaceCache[openInterfaceID], super.mouseX, 4, super.mouseY, 0);
  7168.             } else {
  7169.                 build3dScreenMenu();
  7170.             }
  7171.         }
  7172.         if(anInt886 != anInt1026) {
  7173.             anInt1026 = anInt886;
  7174.         }
  7175.         if(anInt1315 != anInt1129) {
  7176.             anInt1129 = anInt1315;
  7177.         }
  7178.         anInt886 = 0;
  7179.         anInt1315 = 0;
  7180.        if (super.mouseX > 548 && super.mouseY > 207 && super.mouseX < 740 && super.mouseY < 468) {
  7181.             if(invOverlayInterfaceID != -1) {
  7182.                 buildInterfaceMenu(548, RSInterface.interfaceCache[invOverlayInterfaceID], super.mouseX, 207, super.mouseY, 0);
  7183.             } else if(tabInterfaceIDs[tabID] != -1) {
  7184.                 buildInterfaceMenu(548, RSInterface.interfaceCache[tabInterfaceIDs[tabID]], super.mouseX, 207, super.mouseY, 0);
  7185.             }
  7186.         }
  7187.         if(anInt886 != anInt1048) {
  7188.             needDrawTabArea = true;
  7189.             tabAreaAltered = true;
  7190.             anInt1048 = anInt886;
  7191.         }
  7192.         if(anInt1315 != anInt1044) {
  7193.             needDrawTabArea = true;
  7194.             tabAreaAltered = true;
  7195.             anInt1044 = anInt1315;
  7196.         }
  7197.         anInt886 = 0;
  7198.         anInt1315 = 0;
  7199.         if(super.mouseX > 0 && super.mouseY > 338 && super.mouseX < 490 && super.mouseY < 463) {
  7200.             if(backDialogID != -1) {
  7201.                 buildInterfaceMenu(20, RSInterface.interfaceCache[backDialogID], super.mouseX, 358, super.mouseY, 0);
  7202.             } else if(super.mouseY < 463 && super.mouseX < 490) {
  7203.                 buildChatAreaMenu(super.mouseY - 338);
  7204.             }
  7205.         }
  7206.         if(mouseLeftClickInArea(6, 512, 459, 475))
  7207.             writingOnStaffTab = false;
  7208.         if(backDialogID != -1 && anInt886 != anInt1039) {
  7209.             inputTaken = true;
  7210.             anInt1039 = anInt886;
  7211.         }
  7212.         if(backDialogID != -1 && anInt1315 != anInt1500) {
  7213.             inputTaken = true;
  7214.             anInt1500 = anInt1315;
  7215.         }
  7216.         /** Custom menu drawing */
  7217.         rightClickChatButtons();
  7218.         alertHandler.processMouse(super.mouseX, super.mouseY);
  7219.         determineBottomTabs();
  7220.        
  7221.         if(!fullScreenOn) {
  7222.             processMinimapActions();
  7223.         }
  7224.        
  7225.         boolean flag = false;
  7226.         while(!flag) {
  7227.             flag = true;
  7228.             for(int j = 0; j < menuActionRow - 1; j++) {
  7229.                 if(menuActionID[j] < 1000 && menuActionID[j + 1] > 1000) {
  7230.                     String s = menuActionName[j];
  7231.                     menuActionName[j] = menuActionName[j + 1];
  7232.                     menuActionName[j + 1] = s;
  7233.                     int k = menuActionID[j];
  7234.                     menuActionID[j] = menuActionID[j + 1];
  7235.                     menuActionID[j + 1] = k;
  7236.                     k = menuActionCmd2[j];
  7237.                     menuActionCmd2[j] = menuActionCmd2[j + 1];
  7238.                     menuActionCmd2[j + 1] = k;
  7239.                     k = menuActionCmd3[j];
  7240.                     menuActionCmd3[j] = menuActionCmd3[j + 1];
  7241.                     menuActionCmd3[j + 1] = k;
  7242.                     k = menuActionCmd1[j];
  7243.                     menuActionCmd1[j] = menuActionCmd1[j + 1];
  7244.                     menuActionCmd1[j + 1] = k;
  7245.                     flag = false;
  7246.                 }
  7247.             }
  7248.         }
  7249.     }
  7250.  
  7251.     /*private int method83(int i, int j, int k)
  7252.     {
  7253.         int l = 256 - k;
  7254.         return ((i & 0xff00ff) * l + (j & 0xff00ff) * k & 0xff00ff00) + ((i & 0xff00) * l + (j & 0xff00) * k & 0xff0000) >> 8;
  7255.     }*/
  7256.  
  7257.     private void login(String s, String s1, boolean flag)
  7258.     {
  7259.         if(s.length() == 0 || s1.length() == 0) {
  7260.             loginMessage1 = "You must input";
  7261.             loginMessage2 = "your username and password.";
  7262.             return;
  7263.         }
  7264.         SignLink.errorname = s;
  7265.         try
  7266.         {
  7267.             if(!flag)
  7268.             {
  7269.                 //loginMessage1 = "";
  7270.                 //loginMessage2 = "Connecting to server...";
  7271.                 drawLoginScreen(true);
  7272.             }
  7273.             socketStream = new RSSocket(this, openSocket(43594));
  7274.             long l = TextClass.longForName(s);
  7275.             int i = (int)(l >> 16 & 31L);
  7276.             stream.currentOffset = 0;
  7277.             stream.writeWordBigEndian(14);
  7278.             stream.writeWordBigEndian(i);
  7279.             socketStream.queueBytes(2, stream.buffer);
  7280.             for(int j = 0; j < 8; j++)
  7281.                 socketStream.read();
  7282.  
  7283.             int k = socketStream.read();
  7284.             int i1 = k;
  7285.             if(k == 0)
  7286.             {
  7287.                 socketStream.flushInputStream(inStream.buffer, 8);
  7288.                 inStream.currentOffset = 0;
  7289.                 aLong1215 = inStream.readQWord();
  7290.                 int ai[] = new int[4];
  7291.                 ai[0] = (int)(Math.random() * 99999999D);
  7292.                 ai[1] = (int)(Math.random() * 99999999D);
  7293.                 ai[2] = (int)(aLong1215 >> 32);
  7294.                 ai[3] = (int)aLong1215;
  7295.                 stream.currentOffset = 0;
  7296.                 stream.writeWordBigEndian(10);
  7297.                 stream.writeDWord(ai[0]);
  7298.                 stream.writeDWord(ai[1]);
  7299.                 stream.writeDWord(ai[2]);
  7300.                 stream.writeDWord(ai[3]);
  7301.                 stream.writeDWord(123456);
  7302.                 stream.writeString(s);
  7303.                 stream.writeString(s1);
  7304.                 stream.doKeys();
  7305.                 aStream_847.currentOffset = 0;
  7306.                 if(flag)
  7307.                     aStream_847.writeWordBigEndian(18);
  7308.                 else
  7309.                     aStream_847.writeWordBigEndian(16);
  7310.                 aStream_847.writeWordBigEndian(stream.currentOffset + 36 + 1 + 1 + 2);
  7311.                 aStream_847.writeWordBigEndian(255);
  7312.                 aStream_847.writeWord(317);
  7313.                 aStream_847.writeWordBigEndian(lowMem ? 1 : 0);
  7314.                 for(int l1 = 0; l1 < 9; l1++)
  7315.                     aStream_847.writeDWord(expectedCRCs[l1]);
  7316.  
  7317.                 aStream_847.writeBytes(stream.buffer, stream.currentOffset, 0);
  7318.                 stream.encryption = new ISAACRandomGen(ai);
  7319.                 for(int j2 = 0; j2 < 4; j2++)
  7320.                     ai[j2] += 50;
  7321.  
  7322.                 encryption = new ISAACRandomGen(ai);
  7323.                 socketStream.queueBytes(aStream_847.currentOffset, aStream_847.buffer);
  7324.                 k = socketStream.read();
  7325.             }
  7326.             if(k == 1)
  7327.             {
  7328.                 try
  7329.                 {
  7330.                     Thread.sleep(2000L);
  7331.                 }
  7332.                 catch(Exception _ex) { }
  7333.                 login(s, s1, flag);
  7334.                 return;
  7335.             }
  7336.             if(k == 2)
  7337.             {
  7338.                 myPrivilege = socketStream.read();
  7339.                 flagged = socketStream.read() == 1;
  7340.                 aLong1220 = 0L;
  7341.                 anInt1022 = 0;
  7342.                 mouseDetection.coordsIndex = 0;
  7343.                 super.awtFocus = true;
  7344.                 aBoolean954 = true;
  7345.                 loggedIn = true;
  7346.                 stream.currentOffset = 0;
  7347.                 inStream.currentOffset = 0;
  7348.                 pktType = -1;
  7349.                 anInt841 = -1;
  7350.                 anInt842 = -1;
  7351.                 anInt843 = -1;
  7352.                 pktSize = 0;
  7353.                 anInt1009 = 0;
  7354.                 anInt1104 = 0;
  7355.                 anInt1011 = 0;
  7356.                 anInt855 = 0;
  7357.                 menuActionRow = 0;
  7358.                 menuOpen = false;
  7359.                 super.idleTime = 0;
  7360.                 for(int j1 = 0; j1 < 100; j1++)
  7361.                     chatMessages[j1] = null;
  7362.  
  7363.                 itemSelected = 0;
  7364.                 spellSelected = 0;
  7365.                 loadingStage = 0;
  7366.                 anInt1062 = 0;
  7367.                 anInt1278 = (int)(Math.random() * 100D) - 50;
  7368.                 anInt1131 = (int)(Math.random() * 110D) - 55;
  7369.                 anInt896 = (int)(Math.random() * 80D) - 40;
  7370.                 minimapInt2 = (int)(Math.random() * 120D) - 60;
  7371.                 minimapInt3 = (int)(Math.random() * 30D) - 20;
  7372.                 minimapInt1 = (int)(Math.random() * 20D) - 10 & 0x7ff;
  7373.                 miniMapOverlay = 0;
  7374.                 anInt985 = -1;
  7375.                 destX = 0;
  7376.                 destY = 0;
  7377.                 playerCount = 0;
  7378.                 npcCount = 0;
  7379.                 for(int i2 = 0; i2 < maxPlayers; i2++)
  7380.                 {
  7381.                     playerArray[i2] = null;
  7382.                     aStreamArray895s[i2] = null;
  7383.                 }
  7384.  
  7385.                 for(int k2 = 0; k2 < 16384; k2++)
  7386.                     npcArray[k2] = null;
  7387.  
  7388.                 myPlayer = playerArray[myPlayerIndex] = new Player();
  7389.                 aClass19_1013.removeAll();
  7390.                 aClass19_1056.removeAll();
  7391.                 for(int l2 = 0; l2 < 4; l2++)
  7392.                 {
  7393.                     for(int i3 = 0; i3 < 104; i3++)
  7394.                     {
  7395.                         for(int k3 = 0; k3 < 104; k3++)
  7396.                             groundArray[l2][i3][k3] = null;
  7397.  
  7398.                     }
  7399.  
  7400.                 }
  7401.                 aClass19_1179 = new NodeList();
  7402.                 fullscreenInterfaceID = -1;
  7403.                 anInt900 = 0;
  7404.                 friendsCount = 0;
  7405.                 dialogID = -1;
  7406.                 backDialogID = -1;
  7407.                 openInterfaceID = -1;
  7408.                 invOverlayInterfaceID = -1;
  7409.                 anInt1018 = -1;
  7410.                 aBoolean1149 = false;
  7411.                 tabID = 3;
  7412.                 inputDialogState = 0;
  7413.                 menuOpen = false;
  7414.                 messagePromptRaised = false;
  7415.                 chatBoxMessage = null;
  7416.                 anInt1055 = 0;
  7417.                 anInt1054 = -1;
  7418.                 charEditGender = true;
  7419.                 charEditChangeGender();
  7420.                 welcome();
  7421.                 for(int j3 = 0; j3 < 5; j3++)
  7422.                     charEditColors[j3] = 0;
  7423.  
  7424.                 for(int l3 = 0; l3 < 5; l3++)
  7425.                 {
  7426.                     atPlayerActions[l3] = null;
  7427.                     atPlayerArray[l3] = false;
  7428.                 }
  7429.  
  7430.                 anInt1175 = 0;
  7431.                 anInt1134 = 0;
  7432.                 anInt986 = 0;
  7433.                 anInt1288 = 0;
  7434.                 anInt924 = 0;
  7435.                 anInt1188 = 0;
  7436.                 anInt1155 = 0;
  7437.                 anInt1226 = 0;
  7438.                 resetImageProducers2();
  7439.                 writeLoginData();
  7440.                 return;
  7441.             }
  7442.             if(k == 3)
  7443.             {
  7444.                 loginMessage1 = "";
  7445.                 loginMessage2 = "Invalid username or password.";
  7446.                 return;
  7447.             }
  7448.             if(k == 4)
  7449.             {
  7450.                 loginMessage1 = "Your account is currently banned.";
  7451.                 loginMessage2 = "You may appeal on forums.";
  7452.                 return;
  7453.             }
  7454.             if(k == 5)
  7455.             {
  7456.                 loginMessage1 = "Your account is already logged in.";
  7457.                 loginMessage2 = "Try again in 60 secs...";
  7458.                 return;
  7459.             }
  7460.             if(k == 6)
  7461.             {
  7462.                 loginMessage1 = "Firyze has been updated!";
  7463.                 loginMessage2 = "Please reload this page.";
  7464.                 return;
  7465.             }
  7466.             if(k == 7)
  7467.             {
  7468.                 loginMessage1 = "This world is full.";
  7469.                 loginMessage2 = "Please use a different world.";
  7470.                 return;
  7471.             }
  7472.             if(k == 8)
  7473.             {
  7474.                 loginMessage1 = "Unable to connect.";
  7475.                 loginMessage2 = "Login server offline.";
  7476.                 return;
  7477.             }
  7478.             if(k == 9)
  7479.             {
  7480.                 loginMessage1 = "Login limit exceeded.";
  7481.                 loginMessage2 = "Too many connections from your address.";
  7482.                 return;
  7483.             }
  7484.             if(k == 10)
  7485.             {
  7486.                 loginMessage1 = "Unable to connect.";
  7487.                 loginMessage2 = "Bad session id.";
  7488.                 return;
  7489.             }
  7490.             if(k == 11)
  7491.             {
  7492.                 loginMessage2 = "Login server rejected session.";
  7493.                 loginMessage2 = "Please try again.";
  7494.                 return;
  7495.             }
  7496.             if(k == 12)
  7497.             {
  7498.                 loginMessage1 = "You need a members account to login to this world.";
  7499.                 loginMessage2 = "Please subscribe, or use a different world.";
  7500.                 return;
  7501.             }
  7502.             if(k == 13)
  7503.             {
  7504.                 loginMessage1 = "Could not complete login.";
  7505.                 loginMessage2 = "Please try using a different world.";
  7506.                 return;
  7507.             }
  7508.             if(k == 14)
  7509.             {
  7510.                 loginMessage1 = "The server is being updated.";
  7511.                 loginMessage2 = "Please wait 1 minute and try again.";
  7512.                 return;
  7513.             }
  7514.             if(k == 15)
  7515.             {
  7516.                 loggedIn = true;
  7517.                 stream.currentOffset = 0;
  7518.                 inStream.currentOffset = 0;
  7519.                 pktType = -1;
  7520.                 anInt841 = -1;
  7521.                 anInt842 = -1;
  7522.                 anInt843 = -1;
  7523.                 pktSize = 0;
  7524.                 anInt1009 = 0;
  7525.                 anInt1104 = 0;
  7526.                 menuActionRow = 0;
  7527.                 menuOpen = false;
  7528.                 aLong824 = System.currentTimeMillis();
  7529.                 return;
  7530.             }
  7531.             if(k == 16)
  7532.             {
  7533.                 loginMessage1 = "Login attempts exceeded.";
  7534.                 loginMessage2 = "Please wait 1 minute and try again.";
  7535.                 return;
  7536.             }
  7537.             if(k == 17)
  7538.             {
  7539.                 loginMessage1 = "You are standing in a members-only area.";
  7540.                 loginMessage2 = "To play on this world move to a free area first";
  7541.                 return;
  7542.             }
  7543.             if(k == 20)
  7544.             {
  7545.                 loginMessage1 = "Invalid loginserver requested";
  7546.                 loginMessage2 = "Please try using a different world.";
  7547.                 return;
  7548.             }
  7549.             if(k == 21)
  7550.             {
  7551.                 for(int k1 = socketStream.read(); k1 >= 0; k1--)
  7552.                 {
  7553.                     loginMessage1 = "You have only just left another world";
  7554.                     loginMessage2 = "Your profile will be transferred in: " + k1 + " seconds";
  7555.                     drawLoginScreen(true);
  7556.                     try
  7557.                     {
  7558.                         Thread.sleep(1000L);
  7559.                     }
  7560.                     catch(Exception _ex) { }
  7561.                 }
  7562.  
  7563.                 login(s, s1, flag);
  7564.                 return;
  7565.             }
  7566.             if(k == -1)
  7567.             {
  7568.                 if(i1 == 0)
  7569.                 {
  7570.                     if(loginFailures < 2)
  7571.                     {
  7572.                         try
  7573.                         {
  7574.                             Thread.sleep(2000L);
  7575.                         }
  7576.                         catch(Exception _ex) { }
  7577.                         loginFailures++;
  7578.                         login(s, s1, flag);
  7579.                         return;
  7580.                     } else
  7581.                     {
  7582.                         loginMessage1 = "You must download the latest";
  7583.                         loginMessage2 = "client at google.com";
  7584.                         return;
  7585.                     }
  7586.                 } else
  7587.                 {
  7588.                     loginMessage1 = "No response from server.";
  7589.                     loginMessage2 = "Wait or reload the client.";
  7590.                     return;
  7591.                 }
  7592.             } else
  7593.             {
  7594.                 System.out.println("response:" + k);
  7595.                 loginMessage1 = "Unexpected server response";
  7596.                 loginMessage2 = "Please try using a different world.";
  7597.                 return;
  7598.             }
  7599.         } catch (Exception e) {
  7600.             e.printStackTrace();
  7601.             loginMessage1 = "";
  7602.         }
  7603.         loginMessage2 = "Error connecting to server.";
  7604.     }
  7605.  
  7606.     private boolean doWalkTo(int i, int j, int k, int i1, int j1, int k1, int l1, int i2, int j2, boolean flag, int k2) {
  7607.         byte byte0 = 104;
  7608.         byte byte1 = 104;
  7609.         for(int l2 = 0; l2 < byte0; l2++) {
  7610.             for(int i3 = 0; i3 < byte1; i3++) {
  7611.                 anIntArrayArray901[l2][i3] = 0;
  7612.                 anIntArrayArray825[l2][i3] = 0x5f5e0ff;
  7613.             }
  7614.         }
  7615.         int j3 = j2;
  7616.         int k3 = j1;
  7617.         anIntArrayArray901[j2][j1] = 99;
  7618.         anIntArrayArray825[j2][j1] = 0;
  7619.         int l3 = 0;
  7620.         int i4 = 0;
  7621.         bigX[l3] = j2;
  7622.         bigY[l3++] = j1;
  7623.         boolean flag1 = false;
  7624.         int j4 = bigX.length;
  7625.         int ai[][] = aClass11Array1230[plane].anIntArrayArray294;
  7626.         while(i4 != l3)
  7627.         {
  7628.             j3 = bigX[i4];
  7629.             k3 = bigY[i4];
  7630.             i4 = (i4 + 1) % j4;
  7631.             if(j3 == k2 && k3 == i2)
  7632.             {
  7633.                 flag1 = true;
  7634.                 break;
  7635.             }
  7636.             if(i1 != 0)
  7637.             {
  7638.                 if((i1 < 5 || i1 == 10) && aClass11Array1230[plane].method219(k2, j3, k3, j, i1 - 1, i2))
  7639.                 {
  7640.                     flag1 = true;
  7641.                     break;
  7642.                 }
  7643.                 if(i1 < 10 && aClass11Array1230[plane].method220(k2, i2, k3, i1 - 1, j, j3))
  7644.                 {
  7645.                     flag1 = true;
  7646.                     break;
  7647.                 }
  7648.             }
  7649.             if(k1 != 0 && k != 0 && aClass11Array1230[plane].method221(i2, k2, j3, k, l1, k1, k3))
  7650.             {
  7651.                 flag1 = true;
  7652.                 break;
  7653.             }
  7654.             int l4 = anIntArrayArray825[j3][k3] + 1;
  7655.             if(j3 > 0 && anIntArrayArray901[j3 - 1][k3] == 0 && (ai[j3 - 1][k3] & 0x1280108) == 0)
  7656.             {
  7657.                 bigX[l3] = j3 - 1;
  7658.                 bigY[l3] = k3;
  7659.                 l3 = (l3 + 1) % j4;
  7660.                 anIntArrayArray901[j3 - 1][k3] = 2;
  7661.                 anIntArrayArray825[j3 - 1][k3] = l4;
  7662.             }
  7663.             if(j3 < byte0 - 1 && anIntArrayArray901[j3 + 1][k3] == 0 && (ai[j3 + 1][k3] & 0x1280180) == 0)
  7664.             {
  7665.                 bigX[l3] = j3 + 1;
  7666.                 bigY[l3] = k3;
  7667.                 l3 = (l3 + 1) % j4;
  7668.                 anIntArrayArray901[j3 + 1][k3] = 8;
  7669.                 anIntArrayArray825[j3 + 1][k3] = l4;
  7670.             }
  7671.             if(k3 > 0 && anIntArrayArray901[j3][k3 - 1] == 0 && (ai[j3][k3 - 1] & 0x1280102) == 0)
  7672.             {
  7673.                 bigX[l3] = j3;
  7674.                 bigY[l3] = k3 - 1;
  7675.                 l3 = (l3 + 1) % j4;
  7676.                 anIntArrayArray901[j3][k3 - 1] = 1;
  7677.                 anIntArrayArray825[j3][k3 - 1] = l4;
  7678.             }
  7679.             if(k3 < byte1 - 1 && anIntArrayArray901[j3][k3 + 1] == 0 && (ai[j3][k3 + 1] & 0x1280120) == 0)
  7680.             {
  7681.                 bigX[l3] = j3;
  7682.                 bigY[l3] = k3 + 1;
  7683.                 l3 = (l3 + 1) % j4;
  7684.                 anIntArrayArray901[j3][k3 + 1] = 4;
  7685.                 anIntArrayArray825[j3][k3 + 1] = l4;
  7686.             }
  7687.             if(j3 > 0 && k3 > 0 && anIntArrayArray901[j3 - 1][k3 - 1] == 0 && (ai[j3 - 1][k3 - 1] & 0x128010e) == 0 && (ai[j3 - 1][k3] & 0x1280108) == 0 && (ai[j3][k3 - 1] & 0x1280102) == 0)
  7688.             {
  7689.                 bigX[l3] = j3 - 1;
  7690.                 bigY[l3] = k3 - 1;
  7691.                 l3 = (l3 + 1) % j4;
  7692.                 anIntArrayArray901[j3 - 1][k3 - 1] = 3;
  7693.                 anIntArrayArray825[j3 - 1][k3 - 1] = l4;
  7694.             }
  7695.             if(j3 < byte0 - 1 && k3 > 0 && anIntArrayArray901[j3 + 1][k3 - 1] == 0 && (ai[j3 + 1][k3 - 1] & 0x1280183) == 0 && (ai[j3 + 1][k3] & 0x1280180) == 0 && (ai[j3][k3 - 1] & 0x1280102) == 0)
  7696.             {
  7697.                 bigX[l3] = j3 + 1;
  7698.                 bigY[l3] = k3 - 1;
  7699.                 l3 = (l3 + 1) % j4;
  7700.                 anIntArrayArray901[j3 + 1][k3 - 1] = 9;
  7701.                 anIntArrayArray825[j3 + 1][k3 - 1] = l4;
  7702.             }
  7703.             if(j3 > 0 && k3 < byte1 - 1 && anIntArrayArray901[j3 - 1][k3 + 1] == 0 && (ai[j3 - 1][k3 + 1] & 0x1280138) == 0 && (ai[j3 - 1][k3] & 0x1280108) == 0 && (ai[j3][k3 + 1] & 0x1280120) == 0)
  7704.             {
  7705.                 bigX[l3] = j3 - 1;
  7706.                 bigY[l3] = k3 + 1;
  7707.                 l3 = (l3 + 1) % j4;
  7708.                 anIntArrayArray901[j3 - 1][k3 + 1] = 6;
  7709.                 anIntArrayArray825[j3 - 1][k3 + 1] = l4;
  7710.             }
  7711.             if(j3 < byte0 - 1 && k3 < byte1 - 1 && anIntArrayArray901[j3 + 1][k3 + 1] == 0 && (ai[j3 + 1][k3 + 1] & 0x12801e0) == 0 && (ai[j3 + 1][k3] & 0x1280180) == 0 && (ai[j3][k3 + 1] & 0x1280120) == 0)
  7712.             {
  7713.                 bigX[l3] = j3 + 1;
  7714.                 bigY[l3] = k3 + 1;
  7715.                 l3 = (l3 + 1) % j4;
  7716.                 anIntArrayArray901[j3 + 1][k3 + 1] = 12;
  7717.                 anIntArrayArray825[j3 + 1][k3 + 1] = l4;
  7718.             }
  7719.         }
  7720.         anInt1264 = 0;
  7721.         if(!flag1)
  7722.         {
  7723.             if(flag)
  7724.             {
  7725.                 int i5 = 100;
  7726.                 for(int k5 = 1; k5 < 2; k5++)
  7727.                 {
  7728.                     for(int i6 = k2 - k5; i6 <= k2 + k5; i6++)
  7729.                     {
  7730.                         for(int l6 = i2 - k5; l6 <= i2 + k5; l6++)
  7731.                             if(i6 >= 0 && l6 >= 0 && i6 < 104 && l6 < 104 && anIntArrayArray825[i6][l6] < i5)
  7732.                             {
  7733.                                 i5 = anIntArrayArray825[i6][l6];
  7734.                                 j3 = i6;
  7735.                                 k3 = l6;
  7736.                                 anInt1264 = 1;
  7737.                                 flag1 = true;
  7738.                             }
  7739.  
  7740.                     }
  7741.  
  7742.                     if(flag1)
  7743.                         break;
  7744.                 }
  7745.  
  7746.             }
  7747.             if(!flag1)
  7748.                 return false;
  7749.         }
  7750.         i4 = 0;
  7751.         bigX[i4] = j3;
  7752.         bigY[i4++] = k3;
  7753.         int l5;
  7754.         for(int j5 = l5 = anIntArrayArray901[j3][k3]; j3 != j2 || k3 != j1; j5 = anIntArrayArray901[j3][k3])
  7755.         {
  7756.             if(j5 != l5)
  7757.             {
  7758.                 l5 = j5;
  7759.                 bigX[i4] = j3;
  7760.                 bigY[i4++] = k3;
  7761.             }
  7762.             if((j5 & 2) != 0)
  7763.                 j3++;
  7764.             else
  7765.             if((j5 & 8) != 0)
  7766.                 j3--;
  7767.             if((j5 & 1) != 0)
  7768.                 k3++;
  7769.             else
  7770.             if((j5 & 4) != 0)
  7771.                 k3--;
  7772.         }
  7773. //  if(cancelWalk) { return i4 > 0; }
  7774.    
  7775.  
  7776.         if(i4 > 0)
  7777.         {
  7778.             int k4 = i4;
  7779.             if(k4 > 25)
  7780.                 k4 = 25;
  7781.             i4--;
  7782.             int k6 = bigX[i4];
  7783.             int i7 = bigY[i4];
  7784.             anInt1288 += k4;
  7785.             if(anInt1288 >= 92)
  7786.             {
  7787.                 stream.createFrame(36);
  7788.                 stream.writeDWord(0);
  7789.                 anInt1288 = 0;
  7790.             }
  7791.             if(i == 0) //on screen walking
  7792.             {
  7793.                 stream.createFrame(164);
  7794.                 stream.writeWordBigEndian(k4 + k4 + 3);
  7795.                 restOrb = false;
  7796.             }
  7797.             if(i == 1) //minimap walking
  7798.             {
  7799.                 stream.createFrame(248);
  7800.                 stream.writeWordBigEndian(k4 + k4 + 3 + 14);
  7801.                 restOrb = false;
  7802.             }
  7803.             if(i == 2)
  7804.             {
  7805.                 stream.createFrame(98);
  7806.                 stream.writeWordBigEndian(k4 + k4 + 3);
  7807.                 restOrb = false;
  7808.             }
  7809.             stream.method433(k6 + baseX);
  7810.             destX = bigX[0];
  7811.             destY = bigY[0];
  7812.             for(int j7 = 1; j7 < k4; j7++)
  7813.             {
  7814.                 i4--;
  7815.                 stream.writeWordBigEndian(bigX[i4] - k6);
  7816.                 stream.writeWordBigEndian(bigY[i4] - i7);
  7817.             }
  7818.  
  7819.             stream.method431(i7 + baseY);
  7820.             stream.method424(super.keyArray[5] != 1 ? 0 : 1);
  7821.             return true;
  7822.         }
  7823.         return i != 1;
  7824.     }
  7825.  
  7826.     private void method86(Stream stream)
  7827.     {
  7828.         for(int j = 0; j < anInt893; j++)
  7829.         {
  7830.             int k = anIntArray894[j];
  7831.             Npc npc = npcArray[k];
  7832.             int l = stream.readUnsignedByte();
  7833.             if((l & 0x10) != 0)
  7834.             {
  7835.                 int i1 = stream.method434();
  7836.                 if(i1 == 65535)
  7837.                     i1 = -1;
  7838.                 int i2 = stream.readUnsignedByte();
  7839.                 if(i1 == npc.anim && i1 != -1)
  7840.                 {
  7841.                     int l2 = Animation.anims[i1].anInt365;
  7842.                     if(l2 == 1)
  7843.                     {
  7844.                         npc.anInt1527 = 0;
  7845.                         npc.anInt1528 = 0;
  7846.                         npc.anInt1529 = i2;
  7847.                         npc.anInt1530 = 0;
  7848.                     }
  7849.                     if(l2 == 2)
  7850.                         npc.anInt1530 = 0;
  7851.                 } else
  7852.                 if(i1 == -1 || npc.anim == -1 || Animation.anims[i1].anInt359 >= Animation.anims[npc.anim].anInt359)
  7853.                 {
  7854.                     npc.anim = i1;
  7855.                     npc.anInt1527 = 0;
  7856.                     npc.anInt1528 = 0;
  7857.                     npc.anInt1529 = i2;
  7858.                     npc.anInt1530 = 0;
  7859.                     npc.anInt1542 = npc.smallXYIndex;
  7860.                 }
  7861.             }
  7862.             if((l & 8) != 0) {
  7863.                 int j1 = stream.method426();
  7864.                 int j2 = stream.method427();
  7865.                 int type1 = stream.readUnsignedByte();
  7866.                 npc.updateHitData(j2, j1, type1, loopCycle);
  7867.                 npc.loopCycleStatus = loopCycle + 300;
  7868.                 npc.currentHealth = stream.method426();
  7869.                 npc.maxHealth = stream.readUnsignedByte();
  7870.             }
  7871.             if((l & 0x80) != 0) {
  7872.                 npc.anInt1520 = stream.readUnsignedWord();
  7873.                 int k1 = stream.readDWord();
  7874.                 npc.anInt1524 = k1 >> 16;
  7875.                 npc.anInt1523 = loopCycle + (k1 & 0xffff);
  7876.                 npc.anInt1521 = 0;
  7877.                 npc.anInt1522 = 0;
  7878.                 if(npc.anInt1523 > loopCycle)
  7879.                     npc.anInt1521 = -1;
  7880.                 if(npc.anInt1520 == 65535)
  7881.                     npc.anInt1520 = -1;
  7882.             }
  7883.             if((l & 0x20) != 0) {
  7884.                 npc.interactingEntity = stream.readUnsignedWord();
  7885.                 if(npc.interactingEntity == 65535)
  7886.                     npc.interactingEntity = -1;
  7887.             }
  7888.             if((l & 1) != 0) {
  7889.                 npc.textSpoken = stream.readString();
  7890.                 npc.textCycle = 100;
  7891.             }
  7892.             if((l & 0x40) != 0) {
  7893.                 int l1 = stream.method427();
  7894.                 int k2 = stream.method428();
  7895.                 int type2 = stream.readUnsignedByte();
  7896.                 npc.updateHitData(k2, l1, type2, loopCycle);
  7897.                 npc.loopCycleStatus = loopCycle + 300;
  7898.                 npc.currentHealth = stream.method428();
  7899.                 npc.maxHealth = stream.method427();
  7900.             }
  7901.             if((l & 2) != 0) {
  7902.                 npc.desc = NpcDef.forID(stream.method436());
  7903.                 npc.anInt1540 = npc.desc.aByte68;
  7904.                 npc.anInt1504 = npc.desc.getDegreesToTurn;
  7905.                 npc.anInt1554 = npc.desc.walkForwardsAnim;
  7906.                 npc.anInt1555 = npc.desc.walkBackwardsAnim;
  7907.                 npc.anInt1556 = npc.desc.walkLeftAnim;
  7908.                 npc.anInt1557 = npc.desc.walkRightAnim;
  7909.                 npc.anInt1511 = npc.desc.standAnim;
  7910.             }
  7911.             if((l & 4) != 0) {
  7912.                 npc.anInt1538 = stream.method434();
  7913.                 npc.anInt1539 = stream.method434();
  7914.             }
  7915.         }
  7916.     }
  7917.  
  7918.     private void buildAtNPCMenu(NpcDef entityDef, int i, int j, int k)
  7919.     {
  7920.         if(menuActionRow >= 400)
  7921.             return;
  7922.         if(entityDef.childrenIDs != null)
  7923.             entityDef = entityDef.method161();
  7924.         if(entityDef == null)
  7925.             return;
  7926.         if(!entityDef.canRightClick)
  7927.             return;
  7928.         String s = entityDef.name;
  7929.         if(entityDef.combatLevel != 0)
  7930.             s = s + combatDiffColor(myPlayer.combatLevel, entityDef.combatLevel) + " (level: " + entityDef.combatLevel + ")";
  7931.         if(itemSelected == 1)
  7932.         {
  7933.             menuActionName[menuActionRow] = "Use " + selectedItemName + " -> @yel@" + s;
  7934.             menuActionID[menuActionRow] = 582;
  7935.             menuActionCmd1[menuActionRow] = i;
  7936.             menuActionCmd2[menuActionRow] = k;
  7937.             menuActionCmd3[menuActionRow] = j;
  7938.             menuActionRow++;
  7939.             return;
  7940.         }
  7941.         if(spellSelected == 1)
  7942.         {
  7943.             if((spellUsableOn & 2) == 2)
  7944.             {
  7945.                 menuActionName[menuActionRow] = spellTooltip + " @yel@" + s;
  7946.                 menuActionID[menuActionRow] = 413;
  7947.                 menuActionCmd1[menuActionRow] = i;
  7948.                 menuActionCmd2[menuActionRow] = k;
  7949.                 menuActionCmd3[menuActionRow] = j;
  7950.                 menuActionRow++;
  7951.             }
  7952.         } else
  7953.         {
  7954.             if(entityDef.actions != null)
  7955.             {
  7956.                 for(int l = 4; l >= 0; l--)
  7957.                     if(entityDef.actions[l] != null && !entityDef.actions[l].equalsIgnoreCase("attack"))
  7958.                     {
  7959.                         menuActionName[menuActionRow] = entityDef.actions[l] + " @yel@" + s;
  7960.                         if(l == 0)
  7961.                             menuActionID[menuActionRow] = 20;
  7962.                         if(l == 1)
  7963.                             menuActionID[menuActionRow] = 412;
  7964.                         if(l == 2)
  7965.                             menuActionID[menuActionRow] = 225;
  7966.                         if(l == 3)
  7967.                             menuActionID[menuActionRow] = 965;
  7968.                         if(l == 4)
  7969.                             menuActionID[menuActionRow] = 478;
  7970.                         menuActionCmd1[menuActionRow] = i;
  7971.                         menuActionCmd2[menuActionRow] = k;
  7972.                         menuActionCmd3[menuActionRow] = j;
  7973.                         menuActionRow++;
  7974.                     }
  7975.  
  7976.             }
  7977.             if(entityDef.actions != null)
  7978.             {
  7979.                 for(int i1 = 4; i1 >= 0; i1--)
  7980.                     if(entityDef.actions[i1] != null && entityDef.actions[i1].equalsIgnoreCase("attack"))
  7981.                     {
  7982.                         char c = '\0';
  7983.                         if(entityDef.combatLevel > myPlayer.combatLevel)
  7984.                             c = '\u07D0';
  7985.                         menuActionName[menuActionRow] = entityDef.actions[i1] + " @yel@" + s;
  7986.                         if(i1 == 0)
  7987.                             menuActionID[menuActionRow] = 20 + c;
  7988.                         if(i1 == 1)
  7989.                             menuActionID[menuActionRow] = 412 + c;
  7990.                         if(i1 == 2)
  7991.                             menuActionID[menuActionRow] = 225 + c;
  7992.                         if(i1 == 3)
  7993.                             menuActionID[menuActionRow] = 965 + c;
  7994.                         if(i1 == 4)
  7995.                             menuActionID[menuActionRow] = 478 + c;
  7996.                         menuActionCmd1[menuActionRow] = i;
  7997.                         menuActionCmd2[menuActionRow] = k;
  7998.                         menuActionCmd3[menuActionRow] = j;
  7999.                         menuActionRow++;
  8000.                     }
  8001.  
  8002.             }
  8003.             if(idToggle) {
  8004.                 menuActionName[menuActionRow] = "Examine @yel@" + s + " @gre@(@whi@" + entityDef.id + "@gre@)";
  8005.             } else {
  8006.                 menuActionName[menuActionRow] = "Examine @yel@" + s;
  8007.             }
  8008.             menuActionID[menuActionRow] = 1025;
  8009.             menuActionCmd1[menuActionRow] = i;
  8010.             menuActionCmd2[menuActionRow] = k;
  8011.             menuActionCmd3[menuActionRow] = j;
  8012.             menuActionRow++;
  8013.         }
  8014.     }
  8015.  
  8016.     private void buildAtPlayerMenu(int i, int j, Player player, int k)
  8017.     {
  8018.         if(player == myPlayer)
  8019.             return;
  8020.         if(menuActionRow >= 400)
  8021.             return;
  8022.         String s;
  8023.         if(player.title.length() == 0)
  8024.             s = player.name + combatDiffColor(myPlayer.combatLevel, player.combatLevel)
  8025.                     + " (level: " + player.combatLevel + ")";
  8026.         else if(player.title.length() != 0)
  8027.             s = "@" + titleColor(player.titleColor, 1) + "@" + player.title + "@whi@"
  8028.                     + player.name + combatDiffColor(myPlayer.combatLevel, player.combatLevel)
  8029.                     + " (level: " + player.combatLevel + ")";
  8030.         else
  8031.             s = player.name + " (skill: " + player.skill + ")";
  8032.  
  8033.         if(itemSelected == 1)
  8034.         {
  8035.             menuActionName[menuActionRow] = "Use " + selectedItemName + " -> @whi@" + s;
  8036.             menuActionID[menuActionRow] = 491;
  8037.             menuActionCmd1[menuActionRow] = j;
  8038.             menuActionCmd2[menuActionRow] = i;
  8039.             menuActionCmd3[menuActionRow] = k;
  8040.             menuActionRow++;
  8041.         } else
  8042.         if(spellSelected == 1)
  8043.         {
  8044.             if((spellUsableOn & 8) == 8)
  8045.             {
  8046.                 menuActionName[menuActionRow] = spellTooltip + " @whi@" + s;
  8047.                 menuActionID[menuActionRow] = 365;
  8048.                 menuActionCmd1[menuActionRow] = j;
  8049.                 menuActionCmd2[menuActionRow] = i;
  8050.                 menuActionCmd3[menuActionRow] = k;
  8051.                 menuActionRow++;
  8052.             }
  8053.         } else
  8054.         {
  8055.             for(int l = 4; l >= 0; l--)
  8056.                 if(atPlayerActions[l] != null)
  8057.                 {
  8058.                     menuActionName[menuActionRow] = atPlayerActions[l] + " @whi@" + s;
  8059.                     char c = '\0';
  8060.                     if(atPlayerActions[l].equals("Trade With"))
  8061.                         atPlayerActions[l] = "Trade with";
  8062.                     if(atPlayerActions[l].equalsIgnoreCase("attack"))
  8063.                     {
  8064.                         if(player.combatLevel > myPlayer.combatLevel)
  8065.                             c = '\u07D0';
  8066.                         if(myPlayer.team != 0 && player.team != 0)
  8067.                             if(myPlayer.team == player.team)
  8068.                                 c = '\u07D0';
  8069.                             else
  8070.                                 c = '\0';
  8071.                     } else
  8072.                     if(atPlayerArray[l])
  8073.                         c = '\u07D0';
  8074.                     if(l == 0)
  8075.                         menuActionID[menuActionRow] = 561 + c;
  8076.                     if(l == 1)
  8077.                         menuActionID[menuActionRow] = 779 + c;
  8078.                     if(l == 2)
  8079.                         menuActionID[menuActionRow] = 27 + c;
  8080.                     if(l == 3)
  8081.                         menuActionID[menuActionRow] = 577 + c;
  8082.                     if(l == 4)
  8083.                         menuActionID[menuActionRow] = 729 + c;
  8084.                     menuActionCmd1[menuActionRow] = j;
  8085.                     menuActionCmd2[menuActionRow] = i;
  8086.                     menuActionCmd3[menuActionRow] = k;
  8087.                     menuActionRow++;
  8088.                 }
  8089.  
  8090.         }
  8091.         for(int i1 = 0; i1 < menuActionRow; i1++)
  8092.             if(menuActionID[i1] == 516)
  8093.             {
  8094.                 menuActionName[i1] = "Walk here @whi@" + s;
  8095.                 return;
  8096.             }
  8097.  
  8098.     }
  8099.  
  8100.     private void method89(Class30_Sub1 class30_sub1)
  8101.     {
  8102.         int i = 0;
  8103.         int j = -1;
  8104.         int k = 0;
  8105.         int l = 0;
  8106.         if(class30_sub1.anInt1296 == 0)
  8107.             i = sceneGraph.getWallObjectUID(class30_sub1.anInt1295, class30_sub1.anInt1297, class30_sub1.anInt1298);
  8108.         if(class30_sub1.anInt1296 == 1)
  8109.             i = sceneGraph.method301(class30_sub1.anInt1295, class30_sub1.anInt1297, class30_sub1.anInt1298);
  8110.         if(class30_sub1.anInt1296 == 2)
  8111.             i = sceneGraph.getInteractableObjectUID(class30_sub1.anInt1295, class30_sub1.anInt1297, class30_sub1.anInt1298);
  8112.         if(class30_sub1.anInt1296 == 3)
  8113.             i = sceneGraph.getGroundDecorationUID(class30_sub1.anInt1295, class30_sub1.anInt1297, class30_sub1.anInt1298);
  8114.         if(i != 0)
  8115.         {
  8116.             int i1 = sceneGraph.getIDTAGForXYZ(class30_sub1.anInt1295, class30_sub1.anInt1297, class30_sub1.anInt1298, i);
  8117.             j = i >> 14 & 0x7fff;
  8118.             k = i1 & 0x1f;
  8119.             l = i1 >> 6;
  8120.         }
  8121.         class30_sub1.anInt1299 = j;
  8122.         class30_sub1.anInt1301 = k;
  8123.         class30_sub1.anInt1300 = l;
  8124.     }
  8125.  
  8126.     private void method90()
  8127.     {
  8128.         for(int i = 0; i < anInt1062; i++)
  8129.             if(anIntArray1250[i] <= 0)
  8130.             {
  8131.                 boolean flag1 = false;
  8132.                 try
  8133.                 {
  8134.                     if(anIntArray1207[i] == anInt874 && anIntArray1241[i] == anInt1289)
  8135.                     {
  8136.                         if(!replayWave())
  8137.                             flag1 = true;
  8138.                     } else
  8139.                     {
  8140.                         Stream stream = Sounds.method241(anIntArray1241[i], anIntArray1207[i]);
  8141.                         if(System.currentTimeMillis() + (long)(stream.currentOffset / 22) > aLong1172 + (long)(anInt1257 / 22))
  8142.                         {
  8143.                             anInt1257 = stream.currentOffset;
  8144.                             aLong1172 = System.currentTimeMillis();
  8145.                             if(saveWave(stream.buffer, stream.currentOffset))
  8146.                             {
  8147.                                 anInt874 = anIntArray1207[i];
  8148.                                 anInt1289 = anIntArray1241[i];
  8149.                             } else
  8150.                             {
  8151.                                 flag1 = true;
  8152.                             }
  8153.                         }
  8154.                     }
  8155.                 }
  8156.                 catch(Exception exception) { }
  8157.                 if(!flag1 || anIntArray1250[i] == -5)
  8158.                 {
  8159.                     anInt1062--;
  8160.                     for(int j = i; j < anInt1062; j++)
  8161.                     {
  8162.                         anIntArray1207[j] = anIntArray1207[j + 1];
  8163.                         anIntArray1241[j] = anIntArray1241[j + 1];
  8164.                         anIntArray1250[j] = anIntArray1250[j + 1];
  8165.                     }
  8166.  
  8167.                     i--;
  8168.                 } else
  8169.                 {
  8170.                     anIntArray1250[i] = -5;
  8171.                 }
  8172.             } else
  8173.             {
  8174.                 anIntArray1250[i]--;
  8175.             }
  8176.  
  8177.         if(prevSong > 0)
  8178.         {
  8179.             prevSong -= 20;
  8180.             if(prevSong < 0)
  8181.                 prevSong = 0;
  8182.             if(prevSong == 0 && musicEnabled && !lowMem)
  8183.             {
  8184.                 nextSong = currentSong;
  8185.                 songChanging = true;
  8186.                 onDemandFetcher.method558(2, nextSong);
  8187.             }
  8188.         }
  8189.     }
  8190.  
  8191.     void startUp()
  8192.     {
  8193. //main();
  8194. //models();
  8195.         new CacheDownloader(this).downloadCache();
  8196.         //setNewMaps();
  8197.         if(SignLink.sunjava)
  8198.             super.minDelay = 5;
  8199.         //aBoolean993 = true;
  8200.         String s = getDocumentBaseHost();
  8201.         if(SignLink.cache_dat != null) {
  8202.             for(int i = 0; i < 5; i++)
  8203.                 decompressors[i] = new Decompressor(SignLink.cache_dat, SignLink.cache_idx[i], i + 1);
  8204.         }
  8205.         //repackCacheIndex(1);
  8206.         try {
  8207.             //repackCacheIndex(1);
  8208.             //maps();
  8209.             titleStreamLoader = streamLoaderForName(1, "title screen", "title", expectedCRCs[1], 25);
  8210.             smallFont = new RSFont(false, "p11_full", titleStreamLoader);
  8211.             regularFont = new RSFont(false, "p12_full", titleStreamLoader);
  8212.             boldFont = new RSFont(false, "b12_full", titleStreamLoader);
  8213.             fancyFont = new RSFont(true, "q8_full", titleStreamLoader);
  8214.             smallText = new TextFont(false, "p11_full", titleStreamLoader);
  8215.             regularText = new TextFont(false, "p12_full", titleStreamLoader);
  8216.             boldText = new TextFont(false, "b12_full", titleStreamLoader);
  8217.             fancyText = new TextFont(true, "q8_full", titleStreamLoader);
  8218.             //UserInterface.fonts = newFonts;
  8219.             smallText.unpackChatImages(chatImages);
  8220.             regularText.unpackChatImages(chatImages);
  8221.             boldText.unpackChatImages(chatImages);
  8222.             fancyText.unpackChatImages(chatImages);
  8223.             //drawLogo();
  8224.             loadTitleScreen();
  8225.            
  8226.             NamedArchive archive = streamLoaderForName(2, "config", "config", expectedCRCs[2], 30);
  8227.             NamedArchive interfaceArchive = streamLoaderForName(3, "interface", "interface", expectedCRCs[3], 35);
  8228.             NamedArchive mediaArchive = streamLoaderForName(4, "2d graphics", "media", expectedCRCs[4], 40);
  8229.             NamedArchive textureArchive = streamLoaderForName(6, "textures", "textures", expectedCRCs[6], 45);
  8230.             NamedArchive streamLoader_4 = streamLoaderForName(7, "chat system", "wordenc", expectedCRCs[7], 50);
  8231.             NamedArchive soundArchive = streamLoaderForName(8, "sound effects", "sounds", expectedCRCs[8], 55);
  8232.             byteGroundArray = new byte[4][104][104];
  8233.             intGroundArray = new int[4][105][105];
  8234.             sceneGraph = new WorldController(intGroundArray);
  8235.             for(int j = 0; j < 4; j++)
  8236.                 aClass11Array1230[j] = new Class11();
  8237.             minimap = new Sprite(512, 512);
  8238.             NamedArchive streamLoader_6 = streamLoaderForName(5, "update list", "versionlist", expectedCRCs[5], 60);
  8239.             drawSmoothLoading(10, "Starting up");
  8240.             sendDeveloperConsole("This is developer console. To close, press ESC key on your keyboard.");
  8241.             onDemandFetcher = new OnDemandFetcher();
  8242.             onDemandFetcher.start(streamLoader_6, this);
  8243.             Class36.method528(onDemandFetcher.getAnimCount());
  8244.             Model.method459(onDemandFetcher.getModelCount(), onDemandFetcher);
  8245.             /* All 525 Models */
  8246.             drawSmoothLoading(20, "Loading gfx");
  8247.             ModelDecompressor.hdgfx();
  8248.             /* 525 End */
  8249.             ModelDecompressor.loadModelDataFile();
  8250.             drawSmoothLoading(30, "Loading models");
  8251.             preloadModels();
  8252.             drawSmoothLoading(40, "Loading animations");
  8253.             DataBase.loadAnimations();
  8254.            
  8255.             /* Custom sprite unpacking */
  8256.             drawSmoothLoading(50, "Loading images");
  8257.             loadExtraSprites();
  8258.             cacheSprite = new Sprite[cacheSpriteAmount];
  8259.             for(int i = 0; i < cacheSprite.length; i++)
  8260.                 cacheSprite[i] = new Sprite(Integer.toString(i));
  8261.  
  8262.         /* Staff tab */
  8263.         StaffToggle = new Sprite("stafftab/SPRITE 0");
  8264.         StaffType = new Sprite("stafftab/SPRITE 1");
  8265.         StaffSelectBg = new Sprite("stafftab/SPRITE 2");
  8266.         StaffSelect = new Sprite("stafftab/SPRITE 3");
  8267.         StaffSelectH = new Sprite("stafftab/SPRITE 4");
  8268.         StaffSelected = new Sprite("stafftab/SPRITE 5");
  8269.         StaffSend = new Sprite("stafftab/SPRITE 6");
  8270.         StaffError = new Sprite("stafftab/SPRITE 7");
  8271.  
  8272.         for(int i = 0; i < newHitMark.length; i++) {
  8273.             newHitMark[i] = new Sprite("Player/Combat/newHitMark "+i);
  8274.         }
  8275.             compass = new Sprite(mediaArchive, "compass", 0);
  8276.             multiOverlay = new Sprite(mediaArchive, "overlay_multiway", 0);
  8277.            
  8278.             mapBack = new Background(mediaArchive, "mapback", 0);
  8279.            
  8280.             for(int c1 = 0; c1 <= 3; c1++)
  8281.                 chatButtons[c1] = new Sprite(mediaArchive, "chatbuttons", c1);
  8282.                
  8283.             for(int j3 = 0; j3 <= 13; j3++)
  8284.                 sideIcons[j3] = new Sprite(mediaArchive, "sideicons", j3);
  8285.                
  8286.             for(int j3 = 0; j3 <= 13; j3++)
  8287.                 sIcons483[j3] = new Sprite("Gameframe/SIcons/483/"+j3+"");
  8288.                
  8289.             for(int j3 = 0; j3 <= 12; j3++)
  8290.                 sIcons459[j3] = new Sprite("Gameframe/SIcons/459/SIDEICONS "+j3+"");
  8291.            
  8292.             for(int nSI = 0; nSI <= 15; nSI++)
  8293.                 newSideIcons[nSI] = new Sprite("Gameframe/SIcons/562/icon "+nSI);
  8294.            
  8295.                 tabHover = new Sprite("Gameframe/SIcons/562/tabhover");
  8296.                 tabClicked = new Sprite("Gameframe/SIcons/562/tabclicked1");
  8297.                 for(int i = 0; i <= 2; i++)
  8298.                     tabSelected[i] = new Sprite("Gameframe/SIcons/562/tabselected " + i);
  8299.                
  8300.             for(int r1 = 0; r1 < 15; r1++)
  8301.                 redStones[r1] = new Sprite("Gameframe/redstones/REDSTONES " + r1);
  8302.             mapEdge = new Sprite(mediaArchive, "mapedge", 0);
  8303.             mapEdge.method345();
  8304.             try
  8305.             {
  8306.                 for(int k3 = 0; k3 < 100; k3++)
  8307.                     mapScenes[k3] = new Background(mediaArchive, "mapscene", k3);
  8308.             }
  8309.             catch(Exception _ex) { }
  8310.             try
  8311.             {
  8312.                 for(int l3 = 0; l3 < 100; l3++)
  8313.                     mapFunctions[l3] = new Sprite(mediaArchive, "mapfunction", l3);
  8314.             }
  8315.             catch(Exception _ex) { }
  8316.             try
  8317.             {
  8318.                 for(int i4 = 0; i4 < 20; i4++)
  8319.                     hitMarks[i4] = new Sprite(mediaArchive, "hitmarks", i4);
  8320.             }
  8321.             catch(Exception _ex) { }
  8322.             try
  8323.             {
  8324.                 for(int h1 = 0; h1 < 6; h1++)
  8325.                     headIconsHint[h1] = new Sprite(mediaArchive, "headicons_hint", h1);
  8326.             } catch(Exception _ex) { }
  8327.             try {
  8328.                 /*for(int j4 = 0; j4 < 8; j4++)
  8329.                     headIcons[j4] = new Sprite(mediaArchive, "headicons_prayer", j4);*/
  8330.                 for(int idx = 0; idx < 18; idx++)
  8331.                     headIcons[idx] = new Sprite("Player/Prayer/Prayer "+idx);
  8332.                 for(int j45 = 0; j45 < 3; j45++)
  8333.                     skullIcons[j45] = new Sprite(mediaArchive, "headicons_pk", j45 );
  8334.             }//HERE
  8335.             catch(Exception _ex) { }
  8336.             mapFlag = new Sprite(mediaArchive, "mapmarker", 0);
  8337.             mapMarker = new Sprite(mediaArchive, "mapmarker", 1);
  8338.             for(int k4 = 0; k4 < 8; k4++)
  8339.                 crosses[k4] = new Sprite(mediaArchive, "cross", k4);
  8340.  
  8341.             mapDotItem = new Sprite(mediaArchive, "mapdots", 0);
  8342.             mapDotNPC = new Sprite(mediaArchive, "mapdots", 1);
  8343.             mapDotPlayer = new Sprite(mediaArchive, "mapdots", 2);
  8344.             mapDotFriend = new Sprite(mediaArchive, "mapdots", 3);
  8345.             mapDotTeam = new Sprite(mediaArchive, "mapdots", 4);
  8346.             mapDotClan = new Sprite(mediaArchive, "mapdots", 5);
  8347.            
  8348.             scrollBar1 = new Sprite(mediaArchive, "scrollbar", 0);
  8349.             scrollBar2 = new Sprite(mediaArchive, "scrollbar", 1);
  8350.             scrollBar3 = new Sprite("Gameframe/SCROLLBAR 0");
  8351.             scrollBar4 = new Sprite("Gameframe/SCROLLBAR 1");
  8352.            
  8353.             Sprite sprite = new Sprite(mediaArchive, "screenframe", 2);
  8354.             rightFrame = new RSImageProducer(sprite.myWidth, sprite.myHeight, getGameComponent());
  8355.             sprite.method346(0, 0);
  8356.             sprite = new Sprite(mediaArchive, "mapedge", 0);
  8357.             mapEdgeIP = new RSImageProducer(sprite.myWidth, sprite.myHeight, getGameComponent());
  8358.             sprite.method346(0, 0);
  8359.  
  8360.             int i5 = (int)(Math.random() * 21D) - 10;
  8361.             int j5 = (int)(Math.random() * 21D) - 10;
  8362.             int k5 = (int)(Math.random() * 21D) - 10;
  8363.             int l5 = (int)(Math.random() * 41D) - 20;
  8364.             for(int i6 = 0; i6 < 100; i6++)
  8365.             {
  8366.                 if(mapFunctions[i6] != null)
  8367.                     mapFunctions[i6].method344(i5 + l5, j5 + l5, k5 + l5);
  8368.                 if(mapScenes[i6] != null)
  8369.                     mapScenes[i6].method360(i5 + l5, j5 + l5, k5 + l5);
  8370.             }
  8371.             drawSmoothLoading(60, "Loading textures");
  8372.             Texture.method368(textureArchive);
  8373.             Texture.method372(0.80000000000000004D);
  8374.             Texture.method367();
  8375.             drawSmoothLoading(70, "Loading config");
  8376.             try {
  8377.                 Animation.unpackConfig(archive);
  8378.                 ObjectDef.unpackConfig(archive);
  8379.                 Flo.unpackConfig(archive);
  8380.                 ItemDef.unpackConfig(archive);
  8381.                 NpcDef.unpackConfig(archive);
  8382.                 IdentityKit.unpackConfig(archive);
  8383.                 SpotAnim.unpackConfig(archive);
  8384.                 Varp.unpackConfig(archive);
  8385.                 VarBit.unpackConfig(archive);
  8386.                 ItemDef.isMembers = true;
  8387.             } catch(Exception e) {
  8388.                 e.printStackTrace();
  8389.             }
  8390.             drawSmoothLoading(80, "Loading interfaces");
  8391.             RSFont aclass30_sub2_sub1_sub4s[] = {
  8392.                 smallFont, regularFont, boldFont, fancyFont
  8393.             };
  8394.             RSInterface.fonts = aclass30_sub2_sub1_sub4s;
  8395.             RSInterface.unpack(interfaceArchive, aclass30_sub2_sub1_sub4s, mediaArchive);
  8396.             drawSmoothLoading(100, "Preparing game engine");
  8397.             for(int j6 = 0; j6 < 33; j6++)
  8398.             {
  8399.                 int k6 = 999;
  8400.                 int i7 = 0;
  8401.                 for(int k7 = 0; k7 < 34; k7++)
  8402.                 {
  8403.                     if(mapBack.aByteArray1450[k7 + j6 * mapBack.imgWidth] == 0)
  8404.                     {
  8405.                         if(k6 == 999)
  8406.                             k6 = k7;
  8407.                         continue;
  8408.                     }
  8409.                     if(k6 == 999)
  8410.                         continue;
  8411.                     i7 = k7;
  8412.                     break;
  8413.                 }
  8414.  
  8415.                 compassClipRight[j6] = k6;
  8416.                 compassClipLeft[j6] = i7 - k6;
  8417.             }
  8418.             for(int l6 = 1; l6 < 153; l6++) {
  8419.                 int j7 = 999;
  8420.                 int l7 = 0;
  8421.                 for(int j8 = 24; j8 < 177; j8++) {
  8422.                     if(mapBack.aByteArray1450[j8 + l6 * mapBack.imgWidth] == 0 && (j8 > 34 || l6 > 34)) {
  8423.                         if(j7 == 999) {
  8424.                             j7 = j8;
  8425.                         }
  8426.                         continue;
  8427.                     }
  8428.                     if(j7 == 999) {
  8429.                         continue;
  8430.                     }
  8431.                     l7 = j8;
  8432.                     break;
  8433.                 }
  8434.  
  8435.                 minimapClipRight[l6 - 1] = j7 - 24;
  8436.                 minimapClipLeft[l6 - 1] = l7 - j7;
  8437.             }
  8438.             //fullscreen texture bug
  8439.             Texture.method365(765, 503);
  8440.             fullScreenTextureArray = Texture.anIntArray1472;
  8441.             Texture.method365(516, 165);//519
  8442.             anIntArray1180 = Texture.anIntArray1472;
  8443.             Texture.method365(250, 335);
  8444.             anIntArray1181 = Texture.anIntArray1472;
  8445.             Texture.method365(512, 334);//512 334
  8446.             anIntArray1182 = Texture.anIntArray1472;
  8447.            
  8448.             int ai[] = new int[9];
  8449.             for(int i8 = 0; i8 < 9; i8++)
  8450.             {
  8451.                 int k8 = 128 + i8 * 32 + 15;
  8452.                 int l8 = 600 + k8 * 3;
  8453.                 int i9 = Texture.anIntArray1470[k8];
  8454.                 ai[i8] = l8 * i9 >> 16;
  8455.             }
  8456.  
  8457.             WorldController.method310(500, 800, 512, 334, ai);
  8458.            
  8459.             Censor.loadConfig(streamLoader_4);
  8460.             mouseDetection = new MouseDetection(this);
  8461.             startRunnable(mouseDetection, 10);
  8462.             ObjectOnTile.clientInstance = this;
  8463.             ObjectDef.clientInstance = this;
  8464.             NpcDef.clientInstance = this;
  8465.             return;
  8466.         }
  8467.         catch(Exception exception)
  8468.         {
  8469.             exception.printStackTrace();
  8470.             SignLink.reporterror("loaderror " + loadingText + " " + loadingPercent);
  8471.         }
  8472.         loadingError = true;
  8473.     }
  8474.  
  8475.     private void method91(Stream stream, int i)
  8476.     {
  8477.         while(stream.bitPosition + 10 < i * 8)
  8478.         {
  8479.             int j = stream.readBits(11);
  8480.             if(j == 2047)
  8481.                 break;
  8482.             if(playerArray[j] == null)
  8483.             {
  8484.                 playerArray[j] = new Player();
  8485.                 if(aStreamArray895s[j] != null)
  8486.                     playerArray[j].updatePlayer(aStreamArray895s[j]);
  8487.             }
  8488.             playerIndices[playerCount++] = j;
  8489.             Player player = playerArray[j];
  8490.             player.anInt1537 = loopCycle;
  8491.             int k = stream.readBits(1);
  8492.             if(k == 1)
  8493.                 anIntArray894[anInt893++] = j;
  8494.             int l = stream.readBits(1);
  8495.             int i1 = stream.readBits(5);
  8496.             if(i1 > 15)
  8497.                 i1 -= 32;
  8498.             int j1 = stream.readBits(5);
  8499.             if(j1 > 15)
  8500.                 j1 -= 32;
  8501.             player.setPos(myPlayer.smallX[0] + j1, myPlayer.smallY[0] + i1, l == 1);
  8502.         }
  8503.         stream.finishBitAccess();
  8504.     }
  8505.  
  8506.     private void processMainScreenClick() {
  8507.         if(miniMapOverlay != 0)
  8508.             return;
  8509.         if(super.clickMode3 == 1) {
  8510.             if(!fullScreenOn) {
  8511.                 int i = super.saveClickX - 25 - 530;
  8512.                 int j = super.saveClickY - 8;
  8513.             if(i >= 0 && j >= 0 && i < 146 && j < 151) {
  8514.                 i -= 73;
  8515.                 j -= 75;
  8516.                 int k = minimapInt1 + minimapInt2 & 0x7ff;
  8517.                 int i1 = Texture.anIntArray1470[k];
  8518.                 int j1 = Texture.anIntArray1471[k];
  8519.                 i1 = i1 * (minimapInt3 + 256) >> 8;
  8520.                 j1 = j1 * (minimapInt3 + 256) >> 8;
  8521.                 int k1 = j * i1 + i * j1 >> 11;
  8522.                 int l1 = j * j1 - i * i1 >> 11;
  8523.                 int i2 = myPlayer.x + k1 >> 7;
  8524.                 int j2 = myPlayer.y - l1 >> 7;
  8525.                 boolean flag1 = doWalkTo(1, 0, 0, 0, myPlayer.smallY[0], 0, 0, j2, myPlayer.smallX[0], true, i2);
  8526.                 if(flag1) {
  8527.                     stream.writeWordBigEndian(i);
  8528.                     stream.writeWordBigEndian(j);
  8529.                     stream.writeWord(minimapInt1);
  8530.                     stream.writeWordBigEndian(57);
  8531.                     stream.writeWordBigEndian(minimapInt2);
  8532.                     stream.writeWordBigEndian(minimapInt3);
  8533.                     stream.writeWordBigEndian(89);
  8534.                     stream.writeWord(myPlayer.x);
  8535.                     stream.writeWord(myPlayer.y);
  8536.                     stream.writeWordBigEndian(anInt1264);
  8537.                     stream.writeWordBigEndian(63);
  8538.                 }
  8539.             }
  8540.             }
  8541.             anInt1117++;
  8542.             if(anInt1117 > 1151) {
  8543.                 anInt1117 = 0;
  8544.                 stream.createFrame(246);
  8545.                 stream.writeWordBigEndian(0);
  8546.                 int l = stream.currentOffset;
  8547.                 if((int)(Math.random() * 2D) == 0)
  8548.                     stream.writeWordBigEndian(101);
  8549.                 stream.writeWordBigEndian(197);
  8550.                 stream.writeWord((int)(Math.random() * 65536D));
  8551.                 stream.writeWordBigEndian((int)(Math.random() * 256D));
  8552.                 stream.writeWordBigEndian(67);
  8553.                 stream.writeWord(14214);
  8554.                 if((int)(Math.random() * 2D) == 0)
  8555.                     stream.writeWord(29487);
  8556.                 stream.writeWord((int)(Math.random() * 65536D));
  8557.                 if((int)(Math.random() * 2D) == 0)
  8558.                     stream.writeWordBigEndian(220);
  8559.                 stream.writeWordBigEndian(180);
  8560.                 stream.writeBytes(stream.currentOffset - l);
  8561.             }
  8562.         }
  8563.     }
  8564.  
  8565.     private String interfaceIntToString(int j) {
  8566.         if(j < 0x3b9ac9ff)
  8567.             return String.valueOf(j);
  8568.         else
  8569.             return "*";
  8570.     }
  8571.  
  8572.     private void showErrorScreen()
  8573.     {
  8574.         Graphics g = getGameComponent().getGraphics();
  8575.         g.setColor(Color.black);
  8576.         g.fillRect(0, 0, 765, 503);
  8577.         method4(1);
  8578.         if(loadingError)
  8579.         {
  8580.             aBoolean831 = false;
  8581.             g.setFont(new Font("Helvetica", 1, 16));
  8582.             g.setColor(Color.yellow);
  8583.             int k = 35;
  8584.             g.drawString("Sorry, an error has occured whilst loading Firyze.", 30, k);
  8585.             k += 50;
  8586.             g.setColor(Color.white);
  8587.             g.drawString("To fix this try the following (in order):", 30, k);
  8588.             k += 50;
  8589.             g.setColor(Color.white);
  8590.             g.setFont(new Font("Helvetica", 1, 12));
  8591.             g.drawString("1: Try closing and reopening the client and/or web browser", 30, k);
  8592.             k += 30;
  8593.             g.drawString("2: Try clearing your web-browsers cache from tools->internet options", 30, k);
  8594.             k += 30;
  8595.             g.drawString("3: Try rebooting your computer", 30, k);
  8596.             k += 30;
  8597.             g.drawString(" ", 30, k);
  8598.             k += 30;
  8599.             g.drawString("If problems still occur, visit the forums at google.com and request help", 30, k);
  8600.         }
  8601.         if(genericLoadingError)
  8602.         {
  8603.             aBoolean831 = false;
  8604.             g.setFont(new Font("Helvetica", 1, 20));
  8605.             g.setColor(Color.white);
  8606.             g.drawString("Error - unable to load game!", 50, 50);
  8607.             g.drawString("To play Firyze make sure you play from", 50, 100);
  8608.             g.drawString("google.com", 50, 150);
  8609.         }
  8610.         if(rsAlreadyLoaded)
  8611.         {
  8612.             aBoolean831 = false;
  8613.             g.setColor(Color.yellow);
  8614.             int l = 35;
  8615.             g.drawString("Error a copy of Firyze already appears to be loaded", 30, l);
  8616.             l += 50;
  8617.             g.setColor(Color.white);
  8618.             g.drawString("To fix this try the following (in order):", 30, l);
  8619.             l += 50;
  8620.             g.setColor(Color.white);
  8621.             g.setFont(new Font("Helvetica", 1, 12));
  8622.             g.drawString("1: Try closing ALL open web-browser windows, and reloading", 30, l);
  8623.             l += 30;
  8624.             g.drawString("2: Try rebooting your computer, and reloading", 30, l);
  8625.             l += 30;
  8626.         }
  8627.     }
  8628.  
  8629.     public URL getCodeBase() {
  8630.          
  8631.                
  8632.         try {
  8633.             return new URL(server +":" + (80 + portOff));
  8634.         } catch(Exception _ex) {
  8635.         }
  8636.         return null;
  8637.     }
  8638.  
  8639.     private void method95() {
  8640.         for(int j = 0; j < npcCount; j++) {
  8641.             int k = npcIndices[j];
  8642.             Npc npc = npcArray[k];
  8643.             if(npc != null)
  8644.                 method96(npc);
  8645.         }
  8646.     }
  8647.  
  8648.     private void method96(Mobile entity)
  8649.     {
  8650.         if(entity.x < 128 || entity.y < 128 || entity.x >= 13184 || entity.y >= 13184)
  8651.         {
  8652.             entity.anim = -1;
  8653.             entity.anInt1520 = -1;
  8654.             entity.anInt1547 = 0;
  8655.             entity.anInt1548 = 0;
  8656.             entity.x = entity.smallX[0] * 128 + entity.anInt1540 * 64;
  8657.             entity.y = entity.smallY[0] * 128 + entity.anInt1540 * 64;
  8658.             entity.method446();
  8659.         }
  8660.         if(entity == myPlayer && (entity.x < 1536 || entity.y < 1536 || entity.x >= 11776 || entity.y >= 11776))
  8661.         {
  8662.             entity.anim = -1;
  8663.             entity.anInt1520 = -1;
  8664.             entity.anInt1547 = 0;
  8665.             entity.anInt1548 = 0;
  8666.             entity.x = entity.smallX[0] * 128 + entity.anInt1540 * 64;
  8667.             entity.y = entity.smallY[0] * 128 + entity.anInt1540 * 64;
  8668.             entity.method446();
  8669.         }
  8670.         if(entity.anInt1547 > loopCycle)
  8671.             method97(entity);
  8672.         else
  8673.         if(entity.anInt1548 >= loopCycle)
  8674.             method98(entity);
  8675.         else
  8676.             method99(entity);
  8677.         method100(entity);
  8678.         method101(entity);
  8679.     }
  8680.  
  8681.     private void method97(Mobile entity)
  8682.     {
  8683.         int i = entity.anInt1547 - loopCycle;
  8684.         int j = entity.anInt1543 * 128 + entity.anInt1540 * 64;
  8685.         int k = entity.anInt1545 * 128 + entity.anInt1540 * 64;
  8686.         entity.x += (j - entity.x) / i;
  8687.         entity.y += (k - entity.y) / i;
  8688.         entity.anInt1503 = 0;
  8689.         if(entity.anInt1549 == 0)
  8690.             entity.turnDirection = 1024;
  8691.         if(entity.anInt1549 == 1)
  8692.             entity.turnDirection = 1536;
  8693.         if(entity.anInt1549 == 2)
  8694.             entity.turnDirection = 0;
  8695.         if(entity.anInt1549 == 3)
  8696.             entity.turnDirection = 512;
  8697.     }
  8698.  
  8699.     private void method98(Mobile entity)
  8700.     {
  8701.         if(entity.anInt1548 == loopCycle || entity.anim == -1 || entity.anInt1529 != 0 || entity.anInt1528 + 1 > Animation.anims[entity.anim].method258(entity.anInt1527))
  8702.         {
  8703.             int i = entity.anInt1548 - entity.anInt1547;
  8704.             int j = loopCycle - entity.anInt1547;
  8705.             int k = entity.anInt1543 * 128 + entity.anInt1540 * 64;
  8706.             int l = entity.anInt1545 * 128 + entity.anInt1540 * 64;
  8707.             int i1 = entity.anInt1544 * 128 + entity.anInt1540 * 64;
  8708.             int j1 = entity.anInt1546 * 128 + entity.anInt1540 * 64;
  8709.             entity.x = (k * (i - j) + i1 * j) / i;
  8710.             entity.y = (l * (i - j) + j1 * j) / i;
  8711.         }
  8712.         entity.anInt1503 = 0;
  8713.         if(entity.anInt1549 == 0)
  8714.             entity.turnDirection = 1024;
  8715.         if(entity.anInt1549 == 1)
  8716.             entity.turnDirection = 1536;
  8717.         if(entity.anInt1549 == 2)
  8718.             entity.turnDirection = 0;
  8719.         if(entity.anInt1549 == 3)
  8720.             entity.turnDirection = 512;
  8721.         entity.anInt1552 = entity.turnDirection;
  8722.     }
  8723.  
  8724.     private void method99(Mobile entity)
  8725.     {
  8726.         entity.anInt1517 = entity.anInt1511;
  8727.         if(entity.smallXYIndex == 0)
  8728.         {
  8729.             entity.anInt1503 = 0;
  8730.             return;
  8731.         }
  8732.         if(entity.anim != -1 && entity.anInt1529 == 0)
  8733.         {
  8734.             Animation animation = Animation.anims[entity.anim];
  8735.             if(entity.anInt1542 > 0 && animation.anInt363 == 0)
  8736.             {
  8737.                 entity.anInt1503++;
  8738.                 return;
  8739.             }
  8740.             if(entity.anInt1542 <= 0 && animation.anInt364 == 0)
  8741.             {
  8742.                 entity.anInt1503++;
  8743.                 return;
  8744.             }
  8745.         }
  8746.         int i = entity.x;
  8747.         int j = entity.y;
  8748.         int k = entity.smallX[entity.smallXYIndex - 1] * 128 + entity.anInt1540 * 64;
  8749.         int l = entity.smallY[entity.smallXYIndex - 1] * 128 + entity.anInt1540 * 64;
  8750.         if(k - i > 256 || k - i < -256 || l - j > 256 || l - j < -256)
  8751.         {
  8752.             entity.x = k;
  8753.             entity.y = l;
  8754.             return;
  8755.         }
  8756.         if(i < k)
  8757.         {
  8758.             if(j < l)
  8759.                 entity.turnDirection = 1280;
  8760.             else
  8761.             if(j > l)
  8762.                 entity.turnDirection = 1792;
  8763.             else
  8764.                 entity.turnDirection = 1536;
  8765.         } else
  8766.         if(i > k)
  8767.         {
  8768.             if(j < l)
  8769.                 entity.turnDirection = 768;
  8770.             else
  8771.             if(j > l)
  8772.                 entity.turnDirection = 256;
  8773.             else
  8774.                 entity.turnDirection = 512;
  8775.         } else
  8776.         if(j < l)
  8777.             entity.turnDirection = 1024;
  8778.         else
  8779.             entity.turnDirection = 0;
  8780.         int i1 = entity.turnDirection - entity.anInt1552 & 0x7ff;
  8781.         if(i1 > 1024)
  8782.             i1 -= 2048;
  8783.         int j1 = entity.anInt1555;
  8784.         if(i1 >= -256 && i1 <= 256)
  8785.             j1 = entity.anInt1554;
  8786.         else
  8787.         if(i1 >= 256 && i1 < 768)
  8788.             j1 = entity.anInt1557;
  8789.         else
  8790.         if(i1 >= -768 && i1 <= -256)
  8791.             j1 = entity.anInt1556;
  8792.         if(j1 == -1)
  8793.             j1 = entity.anInt1554;
  8794.         entity.anInt1517 = j1;
  8795.         int k1 = 4;
  8796.         if(entity.anInt1552 != entity.turnDirection && entity.interactingEntity == -1 && entity.anInt1504 != 0)
  8797.             k1 = 2;
  8798.         if(entity.smallXYIndex > 2)
  8799.             k1 = 6;
  8800.         if(entity.smallXYIndex > 3)
  8801.             k1 = 8;
  8802.         if(entity.anInt1503 > 0 && entity.smallXYIndex > 1)
  8803.         {
  8804.             k1 = 8;
  8805.             entity.anInt1503--;
  8806.         }
  8807.         if(entity.aBooleanArray1553[entity.smallXYIndex - 1])
  8808.             k1 <<= 1;
  8809.         if(k1 >= 8 && entity.anInt1517 == entity.anInt1554 && entity.anInt1505 != -1)
  8810.             entity.anInt1517 = entity.anInt1505;
  8811.         if(i < k)
  8812.         {
  8813.             entity.x += k1;
  8814.             if(entity.x > k)
  8815.                 entity.x = k;
  8816.         } else
  8817.         if(i > k)
  8818.         {
  8819.             entity.x -= k1;
  8820.             if(entity.x < k)
  8821.                 entity.x = k;
  8822.         }
  8823.         if(j < l)
  8824.         {
  8825.             entity.y += k1;
  8826.             if(entity.y > l)
  8827.                 entity.y = l;
  8828.         } else
  8829.         if(j > l)
  8830.         {
  8831.             entity.y -= k1;
  8832.             if(entity.y < l)
  8833.                 entity.y = l;
  8834.         }
  8835.         if(entity.x == k && entity.y == l)
  8836.         {
  8837.             entity.smallXYIndex--;
  8838.             if(entity.anInt1542 > 0)
  8839.                 entity.anInt1542--;
  8840.         }
  8841.     }
  8842.  
  8843.     private void method100(Mobile entity)
  8844.     {
  8845.         if(entity.anInt1504 == 0)
  8846.             return;
  8847.         if(entity.interactingEntity != -1 && entity.interactingEntity < 32768)
  8848.         {
  8849.             Npc npc = npcArray[entity.interactingEntity];
  8850.             if(npc != null)
  8851.             {
  8852.                 int i1 = entity.x - npc.x;
  8853.                 int k1 = entity.y - npc.y;
  8854.                 if(i1 != 0 || k1 != 0)
  8855.                     entity.turnDirection = (int)(Math.atan2(i1, k1) * 325.94900000000001D) & 0x7ff;
  8856.             }
  8857.         }
  8858.         if(entity.interactingEntity >= 32768)
  8859.         {
  8860.             int j = entity.interactingEntity - 32768;
  8861.             if(j == unknownInt10)
  8862.                 j = myPlayerIndex;
  8863.             Player player = playerArray[j];
  8864.             if(player != null)
  8865.             {
  8866.                 int l1 = entity.x - player.x;
  8867.                 int i2 = entity.y - player.y;
  8868.                 if(l1 != 0 || i2 != 0)
  8869.                     entity.turnDirection = (int)(Math.atan2(l1, i2) * 325.94900000000001D) & 0x7ff;
  8870.             }
  8871.         }
  8872.         if((entity.anInt1538 != 0 || entity.anInt1539 != 0) && (entity.smallXYIndex == 0 || entity.anInt1503 > 0))
  8873.         {
  8874.             int k = entity.x - (entity.anInt1538 - baseX - baseX) * 64;
  8875.             int j1 = entity.y - (entity.anInt1539 - baseY - baseY) * 64;
  8876.             if(k != 0 || j1 != 0)
  8877.                 entity.turnDirection = (int)(Math.atan2(k, j1) * 325.94900000000001D) & 0x7ff;
  8878.             entity.anInt1538 = 0;
  8879.             entity.anInt1539 = 0;
  8880.         }
  8881.         int l = entity.turnDirection - entity.anInt1552 & 0x7ff;
  8882.         if(l != 0)
  8883.         {
  8884.             if(l < entity.anInt1504 || l > 2048 - entity.anInt1504)
  8885.                 entity.anInt1552 = entity.turnDirection;
  8886.             else
  8887.             if(l > 1024)
  8888.                 entity.anInt1552 -= entity.anInt1504;
  8889.             else
  8890.                 entity.anInt1552 += entity.anInt1504;
  8891.             entity.anInt1552 &= 0x7ff;
  8892.             if(entity.anInt1517 == entity.anInt1511 && entity.anInt1552 != entity.turnDirection)
  8893.             {
  8894.                 if(entity.anInt1512 != -1)
  8895.                 {
  8896.                     entity.anInt1517 = entity.anInt1512;
  8897.                     return;
  8898.                 }
  8899.                 entity.anInt1517 = entity.anInt1554;
  8900.             }
  8901.         }
  8902.     }
  8903.  
  8904.     private void method101(Mobile entity)
  8905.     {
  8906.         entity.aBoolean1541 = false;
  8907.         if(entity.anInt1517 != -1)
  8908.         {
  8909.             Animation animation = Animation.anims[entity.anInt1517];
  8910.             entity.anInt1519++;
  8911.             if(entity.anInt1518 < animation.anInt352 && entity.anInt1519 > animation.method258(entity.anInt1518))
  8912.             {
  8913.                 entity.anInt1519 = 1; //Faster anims, 0 = slower
  8914.                 entity.anInt1518++;
  8915.             }
  8916.             if(entity.anInt1518 >= animation.anInt352)
  8917.             {
  8918.                 entity.anInt1519 = 0;
  8919.                 entity.anInt1518 = 0;
  8920.             }
  8921.         }
  8922.         if(entity.anInt1520 != -1 && loopCycle >= entity.anInt1523)
  8923.         {
  8924.             if(entity.anInt1521 < 0)
  8925.                 entity.anInt1521 = 0;
  8926.             Animation animation_1 = SpotAnim.cache[entity.anInt1520].aAnimation_407;
  8927.             for(entity.anInt1522++; entity.anInt1521 < animation_1.anInt352 && entity.anInt1522 > animation_1.method258(entity.anInt1521); entity.anInt1521++)//huhhhhh
  8928.                 entity.anInt1522 -= animation_1.method258(entity.anInt1521);
  8929.  
  8930.             if(entity.anInt1521 >= animation_1.anInt352 && (entity.anInt1521 < 0 || entity.anInt1521 >= animation_1.anInt352))
  8931.                 entity.anInt1520 = -1;
  8932.         }
  8933.         if(entity.anim != -1 && entity.anInt1529 <= 1)
  8934.         {
  8935.             Animation animation_2 = Animation.anims[entity.anim];
  8936.             if(animation_2.anInt363 == 1 && entity.anInt1542 > 0 && entity.anInt1547 <= loopCycle && entity.anInt1548 < loopCycle)
  8937.             {
  8938.                 entity.anInt1529 = 1;
  8939.                 return;
  8940.             }
  8941.         }
  8942.         if(entity.anim != -1 && entity.anInt1529 == 0)
  8943.         {
  8944.             Animation animation_3 = Animation.anims[entity.anim];
  8945.             for(entity.anInt1528++; entity.anInt1527 < animation_3.anInt352 && entity.anInt1528 > animation_3.method258(entity.anInt1527); entity.anInt1527++)
  8946.                 entity.anInt1528 -= animation_3.method258(entity.anInt1527);
  8947.  
  8948.             if(entity.anInt1527 >= animation_3.anInt352)
  8949.             {
  8950.                 entity.anInt1527 -= animation_3.anInt356;
  8951.                 entity.anInt1530++;
  8952.                 if(entity.anInt1530 >= animation_3.anInt362)
  8953.                     entity.anim = -1;
  8954.                 if(entity.anInt1527 < 0 || entity.anInt1527 >= animation_3.anInt352)
  8955.                     entity.anim = -1;
  8956.             }
  8957.             entity.aBoolean1541 = animation_3.aBoolean358;
  8958.         }
  8959.         if(entity.anInt1529 > 0)
  8960.             entity.anInt1529--;
  8961.     }
  8962.  
  8963.     private void drawGameScreen() {
  8964.         if(fullscreenInterfaceID != -1 && (loadingStage == 2 || super.fullGameScreen != null)) {
  8965.             if(loadingStage == 2) {
  8966.                 method119(animationTimePassed, fullscreenInterfaceID);
  8967.                 if(openInterfaceID != -1) {
  8968.                     method119(animationTimePassed, openInterfaceID);
  8969.                 }
  8970.                 animationTimePassed = 0;
  8971.                 resetAllImageProducers();
  8972.                 super.fullGameScreen.initDrawingArea();
  8973.                 Texture.anIntArray1472 = fullScreenTextureArray;
  8974.                 DrawingArea.clear();
  8975.                 welcomeScreenRaised = true;
  8976.                 if(openInterfaceID != -1) {
  8977.                     RSInterface class9_1 = RSInterface.interfaceCache[openInterfaceID];
  8978.                     if(class9_1.width == 512 && class9_1.height == 334 && class9_1.interfaceType == 0) {
  8979.                         class9_1.width = 765;
  8980.                         class9_1.height = 503;
  8981.                     }
  8982.                     drawInterface(0, 0, 8, class9_1);
  8983.                 }
  8984.                 RSInterface rsInterface = RSInterface.interfaceCache[fullscreenInterfaceID];
  8985.                 if(rsInterface.width == 512 && rsInterface.height == 334 && rsInterface.interfaceType == 0) {
  8986.                     rsInterface.width = 765;
  8987.                     rsInterface.height = 503;
  8988.                 }
  8989.                 drawInterface(0, 0, 8, rsInterface);
  8990.             }
  8991.             drawCount++;
  8992.             super.fullGameScreen.drawGraphics(0, 0, super.graphics);
  8993.             return;
  8994.         } else {
  8995.             if(drawCount != 0) {
  8996.                 resetImageProducers2();
  8997.             }
  8998.         }
  8999.         if(welcomeScreenRaised) {
  9000.             welcomeScreenRaised = false;
  9001.             needDrawTabArea = true;
  9002.             inputTaken = true;
  9003.             tabAreaAltered = true;
  9004.             if(loadingStage != 2) {
  9005.                 if (!menuOpen) {
  9006.                     processRightClick();
  9007.                     drawTooltip();
  9008.                 } else {
  9009.                     drawMenu(4, 4);
  9010.                 }
  9011.                 mainGameArea.drawGraphics(4, 4, super.graphics);   
  9012.             }
  9013.         }
  9014.         if(invOverlayInterfaceID != -1) {
  9015.             boolean flag1 = method119(animationTimePassed, invOverlayInterfaceID);
  9016.             if(flag1)
  9017.                 needDrawTabArea = true;
  9018.         }
  9019.         if(loadingStage == 2) {
  9020.             mainGameArea.initDrawingArea();
  9021.             DrawingArea.clear();
  9022.             draw3DScreenMain();
  9023.             drawMinimap();
  9024.             drawTabArea();
  9025.             drawChatArea();
  9026.             drawFrames();
  9027.         }
  9028.         if(backDialogID == -1) {
  9029.                 aClass9_1059.scrollPosition = chatAreaScrollMax - chatAreaScrollPos - 110;
  9030.                 if(super.mouseX > 478 && super.mouseX < 580 && super.mouseY > 342)
  9031.                     method65(494, 110, super.mouseX - 0, super.mouseY - 348, aClass9_1059, 0, false, chatAreaScrollMax);
  9032.                 int i = chatAreaScrollMax - 110 - aClass9_1059.scrollPosition;
  9033.                 if(i < 0)
  9034.                     i = 0;
  9035.                 if(i > chatAreaScrollMax - 110)
  9036.                     i = chatAreaScrollMax - 110;
  9037.                 if(chatAreaScrollPos != i) {
  9038.                     chatAreaScrollPos = i;
  9039.                     inputTaken = true;
  9040.                 }
  9041.         }
  9042.         if(backDialogID != -1) {
  9043.             boolean flag2 = method119(animationTimePassed, backDialogID);
  9044.             if(flag2)
  9045.                 inputTaken = true;
  9046.         }
  9047.         if(atInventoryInterfaceType == 3)
  9048.             inputTaken = true;
  9049.         if(activeInterfaceType == 3)
  9050.             inputTaken = true;
  9051.         if(chatBoxMessage != null)
  9052.             inputTaken = true;
  9053.         if(menuOpen && menuScreenArea == 2)
  9054.             inputTaken = true;
  9055.         inputTaken = true; 
  9056.         if(anInt1054 != -1)
  9057.             tabAreaAltered = true;
  9058.         if(tabAreaAltered) {
  9059.             if(anInt1054 != -1 && anInt1054 == tabID) {
  9060.                 anInt1054 = -1;
  9061.                 stream.createFrame(120);
  9062.                 stream.writeWordBigEndian(tabID);
  9063.             }
  9064.             tabAreaAltered = false;
  9065.         }
  9066.         animationTimePassed = 0;
  9067.     }
  9068.  
  9069.     private boolean buildFriendsListMenu(RSInterface class9) {
  9070.         int i = class9.contentType;
  9071.         if(i >= 1 && i <= 200 || i >= 701 && i <= 900)
  9072.         {
  9073.             if(i >= 801)
  9074.                 i -= 701;
  9075.             else
  9076.             if(i >= 701)
  9077.                 i -= 601;
  9078.             else
  9079.             if(i >= 101)
  9080.                 i -= 101;
  9081.             else
  9082.                 i--;
  9083.             menuActionName[menuActionRow] = "Remove @whi@" + friendsList[i];
  9084.             menuActionID[menuActionRow] = 792;
  9085.             menuActionRow++;
  9086.             menuActionName[menuActionRow] = "Message @whi@" + friendsList[i];
  9087.             menuActionID[menuActionRow] = 639;
  9088.             menuActionRow++;
  9089.             return true;
  9090.         }
  9091.         if(i >= 401 && i <= 500)
  9092.         {
  9093.             menuActionName[menuActionRow] = "Remove @whi@" + class9.disabledMessage;
  9094.             menuActionID[menuActionRow] = 322;
  9095.             menuActionRow++;
  9096.             return true;
  9097.         } else {
  9098.             return false;
  9099.         }
  9100.     }
  9101.  
  9102.     //method104
  9103.     private void renderStationaryGraphics() {
  9104.         StillGraphic sg = (StillGraphic)aClass19_1056.reverseGetFirst();
  9105.         for(; sg != null; sg = (StillGraphic)aClass19_1056.reverseGetNext())
  9106.             if(sg.plane != plane || sg.transformCompleted)
  9107.                 sg.unlink();
  9108.             else
  9109.             if(loopCycle >= sg.loopCycle) {
  9110.                 sg.animationStep(animationTimePassed);
  9111.                 if(sg.transformCompleted)
  9112.                     sg.unlink();
  9113.                 else
  9114.                     sceneGraph.addEntityA(sg.plane, 0, sg.z, -1, sg.y, 60, sg.x, sg, false);
  9115.             }
  9116.  
  9117.     }
  9118.    
  9119.     private void drawInterface(int j, int x, int y, RSInterface i) {
  9120.         if(i.interfaceType != 0 || i.children == null)
  9121.             return;
  9122.         if(i.interfaceShown && anInt1026 != i.id && anInt1048 != i.id && anInt1039 != i.id)
  9123.             return;
  9124.         int i1 = DrawingArea.clipStartX;
  9125.         int j1 = DrawingArea.clipStartY;
  9126.         int k1 = DrawingArea.clipEndX;
  9127.         int l1 = DrawingArea.clipEndY;
  9128.         DrawingArea.setClip(x, y, x + i.width, y + i.height);
  9129.         int i2 = i.children.length;
  9130.         for(int j2 = 0; j2 < i2; j2++)  {
  9131.             int k2 = i.childX[j2] + x;
  9132.             int l2 = (i.childY[j2] + y) - j;
  9133.             RSInterface class9_1 = RSInterface.interfaceCache[i.children[j2]];
  9134.             k2 += class9_1.xOffset;
  9135.             l2 += class9_1.yOffset;
  9136.             if(class9_1.contentType > 0)
  9137.                 drawFriendsListOrWelcomeScreen(class9_1);
  9138.             //here
  9139.             int[] IDs = {
  9140.                 1196, 1199, 1206, 1215, 1224, 1231, 1240, 1249, 1258, 1267, 1274, 1283, 1573,
  9141.                 1290, 1299, 1308, 1315, 1324, 1333, 1340, 1349, 1358, 1367, 1374, 1381, 1388,
  9142.                 1397, 1404, 1583, 12038, 1414, 1421, 1430, 1437, 1446, 1453, 1460, 1469, 15878,
  9143.                 1602, 1613, 1624, 7456, 1478, 1485, 1494, 1503, 1512, 1521, 1530, 1544, 1553,
  9144.                 1563, 1593, 1635, 12426, 12436, 12446, 12456, 6004, 18471,
  9145.                 /* Ancients */
  9146.                 12940, 12988, 13036, 12902, 12862, 13046, 12964, 13012, 13054, 12920, 12882, 13062,
  9147.                 12952, 13000, 13070, 12912, 12872, 13080, 12976, 13024, 13088, 12930, 12892, 13096
  9148.             };
  9149.             for(int m5 = 0; m5 < IDs.length; m5++) {
  9150.                 if(class9_1.id == IDs[m5] + 1) {
  9151.                     if(m5 > 61)
  9152.                         drawBlackBox(k2 + 1, l2);
  9153.                     else
  9154.                         drawBlackBox(k2, l2 + 1);
  9155.                 }
  9156.             }
  9157.             int[] runeChildren = {
  9158.                 1202, 1203, 1209, 1210, 1211, 1218, 1219, 1220, 1227, 1228, 1234, 1235, 1236, 1243, 1244, 1245,
  9159.                 1252, 1253, 1254, 1261, 1262, 1263, 1270, 1271, 1277, 1278, 1279, 1286, 1287, 1293, 1294, 1295,
  9160.                 1302, 1303, 1304, 1311, 1312, 1318, 1319, 1320, 1327, 1328, 1329, 1336, 1337, 1343, 1344, 1345,
  9161.                 1352, 1353, 1354, 1361, 1362, 1363, 1370, 1371, 1377, 1378, 1384, 1385, 1391, 1392, 1393, 1400,
  9162.                 1401, 1407, 1408, 1410, 1417, 1418, 1424, 1425, 1426, 1433, 1434, 1440, 1441, 1442, 1449, 1450,
  9163.                 1456, 1457, 1463, 1464, 1465, 1472, 1473, 1474, 1481, 1482, 1488, 1489, 1490, 1497, 1498, 1499,
  9164.                 1506, 1507, 1508, 1515, 1516, 1517, 1524, 1525, 1526, 1533, 1534, 1535, 1547, 1548, 1549, 1556,
  9165.                 1557, 1558, 1566, 1567, 1568, 1576, 1577, 1578, 1586, 1587, 1588, 1596, 1597, 1598, 1605, 1606,
  9166.                 1607, 1616, 1617, 1618, 1627, 1628, 1629, 1638, 1639, 1640, 6007, 6008, 6011, 8673, 8674, 12041,
  9167.                 12042, 12429, 12430, 12431, 12439, 12440, 12441, 12449, 12450, 12451, 12459, 12460, 15881, 15882,
  9168.                 15885, 18474, 18475, 18478
  9169.             };
  9170.             for(int r = 0; r < runeChildren.length; r++)
  9171.                 if(class9_1.id == runeChildren[r])
  9172.                     class9_1.modelZoom = 775;
  9173.                    
  9174.            
  9175.             if(class9_1.interfaceType == 0) {
  9176.                 if(class9_1.scrollPosition > class9_1.scrollMax - class9_1.height)
  9177.                     class9_1.scrollPosition = class9_1.scrollMax - class9_1.height;
  9178.                 if(class9_1.scrollPosition < 0)
  9179.                     class9_1.scrollPosition = 0;
  9180.                 drawInterface(class9_1.scrollPosition, k2, l2, class9_1);
  9181.                 if(class9_1.scrollMax > class9_1.height)
  9182.                     drawScrollbar(k2 + class9_1.width, l2, class9_1.height, class9_1.scrollPosition, class9_1.scrollMax);
  9183.             } else if(class9_1.interfaceType != 1)
  9184.                 if(class9_1.interfaceType == 2) {
  9185.                     int i3 = 0;
  9186.                     for(int l3 = 0; l3 < class9_1.height; l3++) {
  9187.                         for(int l4 = 0; l4 < class9_1.width; l4++) {
  9188.                             int k5 = k2 + l4 * (32 + class9_1.invSpritePadX);
  9189.                             int j6 = l2 + l3 * (32 + class9_1.invSpritePadY);
  9190.                             if(i3 < 20) {
  9191.                                 k5 += class9_1.spritesX[i3];
  9192.                                 j6 += class9_1.spritesY[i3];
  9193.                             }
  9194.                             if(class9_1.inventory[i3] > 0) {
  9195.                                 int k6 = 0;
  9196.                                 int j7 = 0;
  9197.                                 int j9 = class9_1.inventory[i3] - 1;
  9198.                                 if(k5 > DrawingArea.clipStartX - 32 && k5 < DrawingArea.clipEndX && j6 > DrawingArea.clipStartY - 32 && j6 < DrawingArea.clipEndY || activeInterfaceType != 0 && anInt1085 == i3) {
  9199.                                     int l9 = 0;
  9200.                                     if(itemSelected == 1 && anInt1283 == i3 && anInt1284 == class9_1.id)
  9201.                                         l9 = 0xffffff;
  9202.                                     Sprite Sprite_2 = ItemDef.getSprite(j9, class9_1.inventoryValue[i3], l9);
  9203.                                     if(Sprite_2 != null) {
  9204.                                         if(activeInterfaceType != 0 && anInt1085 == i3 && anInt1084 == class9_1.id) {
  9205.                                             k6 = super.mouseX - anInt1087;
  9206.                                             j7 = super.mouseY - anInt1088;
  9207.                                             if(k6 < 5 && k6 > -5)
  9208.                                                 k6 = 0;
  9209.                                             if(j7 < 5 && j7 > -5)
  9210.                                                 j7 = 0;
  9211.                                             if(anInt989 < 10) { //5 for lower switches
  9212.                                                 k6 = 0;
  9213.                                                 j7 = 0;
  9214.                                             }
  9215.                                             Sprite_2.drawSprite1(k5 + k6, j6 + j7);
  9216.                                             if(j6 + j7 < DrawingArea.clipStartY && i.scrollPosition > 0) {
  9217.                                                 int i10 = (animationTimePassed * (DrawingArea.clipStartY - j6 - j7)) / 3;
  9218.                                                 if(i10 > animationTimePassed * 10)
  9219.                                                     i10 = animationTimePassed * 10;
  9220.                                                 if(i10 > i.scrollPosition)
  9221.                                                     i10 = i.scrollPosition;
  9222.                                                 i.scrollPosition -= i10;
  9223.                                                 anInt1088 += i10;
  9224.                                             }
  9225.                                             if(j6 + j7 + 32 > DrawingArea.clipEndY && i.scrollPosition < i.scrollMax - i.height) {
  9226.                                                 int j10 = (animationTimePassed * ((j6 + j7 + 32) - DrawingArea.clipEndY)) / 3;
  9227.                                                 if(j10 > animationTimePassed * 10)
  9228.                                                     j10 = animationTimePassed * 10;
  9229.                                                 if(j10 > i.scrollMax - i.height - i.scrollPosition)
  9230.                                                     j10 = i.scrollMax - i.height - i.scrollPosition;
  9231.                                                 i.scrollPosition += j10;
  9232.                                                 anInt1088 -= j10;
  9233.                                             }
  9234.                                         } else if(atInventoryInterfaceType != 0 && atInventoryIndex == i3 && atInventoryInterface == class9_1.id)
  9235.                                             Sprite_2.drawSprite1(k5, j6);
  9236.                                         else
  9237.                                             Sprite_2.drawSprite(k5, j6);
  9238.                                         if(Sprite_2.maxWidth == 33 || class9_1.inventoryValue[i3] != 1)
  9239.                                         {
  9240.                                         int k10 = class9_1.inventoryValue[i3];
  9241.                                             smallFont.method385(0, intToKOrMil(k10), j6 + 10 + j7, k5 + 1 + k6);
  9242.                                             if(k10 >= 1)
  9243.                                                 smallFont.method385(0xFFFF00, intToKOrMil(k10), j6 + 9 + j7, k5 + k6);
  9244.                                             if(k10 >= 100000)
  9245.                                                 smallFont.method385(0xFFFFFF, intToKOrMil(k10), j6 + 9 + j7, k5 + k6);
  9246.                                             if(k10 >= 10000000)
  9247.                                                 smallFont.method385(0x00FF80, intToKOrMil(k10), j6 + 9 + j7, k5 + k6);
  9248.                                         }
  9249.                                     }
  9250.                                 }
  9251.                             } else if(class9_1.sprites != null && i3 < 20) {
  9252.                                 Sprite Sprite_1 = class9_1.sprites[i3];
  9253.                                 if(Sprite_1 != null)
  9254.                                     Sprite_1.drawSprite(k5, j6);
  9255.                             }
  9256.                             i3++;
  9257.                         }
  9258.                     }
  9259.                 } else if(class9_1.interfaceType == 3) {
  9260.                     boolean flag = false;
  9261.                     if(anInt1039 == class9_1.id || anInt1048 == class9_1.id || anInt1026 == class9_1.id)
  9262.                         flag = true;
  9263.                     int j3;
  9264.                     if(interfaceIsSelected(class9_1)) {
  9265.                         j3 = class9_1.enabledColor;
  9266.                         if(flag && class9_1.enabledHoverColor != 0)
  9267.                             j3 = class9_1.enabledHoverColor;
  9268.                     } else {
  9269.                         j3 = class9_1.disabledColor;
  9270.                         if(flag && class9_1.disabledHoverColor != 0)
  9271.                             j3 = class9_1.disabledHoverColor;
  9272.                     }
  9273.                     if(class9_1.opacity == 0) {
  9274.                         if(class9_1.boxFilled)
  9275.                             DrawingArea.fillRect(k2, l2, class9_1.width, class9_1.height, j3);
  9276.                         else
  9277.                             DrawingArea.drawRect(k2, l2, class9_1.width, class9_1.height, j3);
  9278.                     } else if(class9_1.boxFilled)
  9279.                         DrawingArea.fillRect(k2, l2, class9_1.width, class9_1.height, j3, 256 - (class9_1.opacity & 0xff));
  9280.                     else
  9281.                         DrawingArea.drawRect(k2, l2, class9_1.width, class9_1.height, j3, 256 - (class9_1.opacity & 0xff));
  9282.                 } else if(class9_1.interfaceType == 4) {
  9283.                     RSFont textDrawingArea = class9_1.rsFonts;
  9284.                     String s = class9_1.disabledMessage;
  9285.                     boolean flag1 = false;
  9286.                     if(anInt1039 == class9_1.id || anInt1048 == class9_1.id || anInt1026 == class9_1.id)
  9287.                         flag1 = true;
  9288.                     int i4;
  9289.                     if(interfaceIsSelected(class9_1)) {
  9290.                         i4 = class9_1.enabledColor;
  9291.                         if(flag1 && class9_1.enabledHoverColor != 0)
  9292.                             i4 = class9_1.enabledHoverColor;
  9293.                         if(class9_1.enabledMessage.length() > 0)
  9294.                             s = class9_1.enabledMessage;
  9295.                     } else {
  9296.                         i4 = class9_1.disabledColor;
  9297.                         if(flag1 && class9_1.disabledHoverColor != 0)
  9298.                             i4 = class9_1.disabledHoverColor;
  9299.                     }
  9300.                     if(class9_1.atActionType == 6 && aBoolean1149) {
  9301.                         s = "Please wait...";
  9302.                         i4 = class9_1.disabledColor;
  9303.                     }
  9304.                     if(DrawingArea.width == 516) {//519
  9305.                         if(i4 == 0xffff00)
  9306.                             i4 = 255;
  9307.                         if(i4 == 49152)
  9308.                             i4 = 0xffffff;
  9309.                     }
  9310.                     //Magic interface
  9311.                     if((class9_1.parentID == 1151) || (class9_1.parentID == 12855)) {
  9312.                         switch (i4) {
  9313.                             case 16773120: i4 = 0xFE981F; break;
  9314.                             case 7040819: i4 = 0xAF6A1A; break;
  9315.                         }
  9316.                     }
  9317.                     //Skill interface
  9318.                     int id = 4004; int id2 = 4005;
  9319.                     if(class9_1.parentID == 3917 && class9_1.id != id && class9_1.id != id+2 && class9_1.id != id+4 && class9_1.id != id+6
  9320.                             && class9_1.id != id+8 && class9_1.id != id+10 && class9_1.id != id+12 && class9_1.id != id+14 && class9_1.id != id+16
  9321.                             && class9_1.id != id+18 && class9_1.id != id+20 && class9_1.id != id+23 && class9_1.id != id+24 && class9_1.id != id+26
  9322.                             && class9_1.id != id+28 && class9_1.id != id+30 && class9_1.id != id+32 && class9_1.id != id+34 && class9_1.id != 13926
  9323.                             && class9_1.id != 4152 && class9_1.id != 12166 && class9_1.id != id2 && class9_1.id != id2+2 && class9_1.id != id2+4 && class9_1.id != id2+6
  9324.                             && class9_1.id != id2+8 && class9_1.id != id2+10 && class9_1.id != id2+12 && class9_1.id != id2+14 && class9_1.id != id2+16
  9325.                             && class9_1.id != id2+18 && class9_1.id != id2+20 && class9_1.id != id2+23 && class9_1.id != id2+24 && class9_1.id != id2+26
  9326.                             && class9_1.id != id2+28 && class9_1.id != id2+30 && class9_1.id != id2+32 && class9_1.id != id2+34 && class9_1.id != 13927
  9327.                             && class9_1.id != 4153 && class9_1.id != 12167 && class9_1.id != 4026) {
  9328.                         if(i4 == 16776960)
  9329.                             i4 = 0x0000;
  9330.                         class9_1.textShadowed = false;
  9331.                     }
  9332.                     /*if(class9_1.parentID == 3917) {
  9333.                         for(int i = 4004; i < 4040; i++) {
  9334.                             int[] moreData = {
  9335.                                 13926, 4152, 12166, 13927,
  9336.                                 4153, 12167, 4026
  9337.                             };
  9338.                             if(class9_1.id == i || class9_1.id == moreData[i]) {
  9339.                                 return;
  9340.                             }
  9341.                             if(i4 == 16776960) {
  9342.                                 i4 = 0x0000;
  9343.                                 class9_1.textShadowed = false;
  9344.                             }
  9345.                         }
  9346.                     }*/
  9347.                     for(int l6 = l2 + textDrawingArea.anInt1497; s.length() > 0; l6 += textDrawingArea.anInt1497)
  9348.                     {
  9349.                         if(s.indexOf("%") != -1)
  9350.                         {
  9351.                             do
  9352.                             {
  9353.                                 int k7 = s.indexOf("%1");
  9354.                                 if(k7 == -1)
  9355.                                     break;
  9356.                                 if(class9_1.id < 4000 || class9_1.id > 5000 && class9_1.id !=13921 && class9_1.id !=13922 && class9_1.id !=12171 && class9_1.id !=12172)
  9357.                                     s = s.substring(0, k7) + methodR(extractInterfaceValues(class9_1, 0)) + s.substring(k7 + 2);
  9358.                                 else
  9359.                                     s = s.substring(0, k7) + interfaceIntToString(extractInterfaceValues(class9_1, 0)) + s.substring(k7 + 2);
  9360.                             } while(true);
  9361.                             do
  9362.                             {
  9363.                                 int l7 = s.indexOf("%2");
  9364.                                 if(l7 == -1)
  9365.                                     break;
  9366.                                 s = s.substring(0, l7) + interfaceIntToString(extractInterfaceValues(class9_1, 1)) + s.substring(l7 + 2);
  9367.                             } while(true);
  9368.                             do
  9369.                             {
  9370.                                 int i8 = s.indexOf("%3");
  9371.                                 if(i8 == -1)
  9372.                                     break;
  9373.                                 s = s.substring(0, i8) + interfaceIntToString(extractInterfaceValues(class9_1, 2)) + s.substring(i8 + 2);
  9374.                             } while(true);
  9375.                             do
  9376.                             {
  9377.                                 int j8 = s.indexOf("%4");
  9378.                                 if(j8 == -1)
  9379.                                     break;
  9380.                                 s = s.substring(0, j8) + interfaceIntToString(extractInterfaceValues(class9_1, 3)) + s.substring(j8 + 2);
  9381.                             } while(true);
  9382.                             do
  9383.                             {
  9384.                                 int k8 = s.indexOf("%5");
  9385.                                 if(k8 == -1)
  9386.                                     break;
  9387.                                 s = s.substring(0, k8) + interfaceIntToString(extractInterfaceValues(class9_1, 4)) + s.substring(k8 + 2);
  9388.                             } while(true);
  9389.                         }
  9390.                         int l8 = s.indexOf("\\n");
  9391.                         String s1;
  9392.                         if(l8 != -1)
  9393.                         {
  9394.                             s1 = s.substring(0, l8);
  9395.                             s = s.substring(l8 + 2);
  9396.                         } else
  9397.                         {
  9398.                             s1 = s;
  9399.                             s = "";
  9400.                         }
  9401.                         if(class9_1.textCentered)
  9402.                             textDrawingArea.drawCenteredString(i4, k2 + class9_1.width / 2, s1, l6, class9_1.textShadowed);
  9403.                         else
  9404.                             textDrawingArea.drawString(class9_1.textShadowed, k2, i4, s1, l6);
  9405.                     }
  9406.                 } else if(class9_1.interfaceType == 5) {
  9407.  
  9408.                     Sprite sprite;
  9409.                     if(interfaceIsSelected(class9_1))
  9410.                         sprite = class9_1.enabledSprite;
  9411.                     else
  9412.                         sprite = class9_1.disabledSprite;
  9413.                     if(spellSelected == 1 && class9_1.id == spellID && spellID != 0 && sprite != null)
  9414.                         sprite.drawSprite2(k2, l2, 0xffffff);
  9415.                     else {
  9416.                         if(Autocast && class9_1.id == autocastId)
  9417.                             magicAuto.drawSprite(k2-3, l2-3);
  9418.                         if(sprite != null)
  9419.                             sprite.drawSprite(k2, l2);
  9420.                     }
  9421.                     if(sprite != null)
  9422.                         sprite.drawSprite(k2, l2);
  9423.                 } else if(class9_1.interfaceType == 6) {
  9424.                     int k3 = Texture.textureInt1;
  9425.                     int j4 = Texture.textureInt2;
  9426.                     Texture.textureInt1 = k2 + class9_1.width / 2;
  9427.                     Texture.textureInt2 = l2 + class9_1.height / 2;
  9428.                     int i5 = Texture.anIntArray1470[class9_1.modelRotationY] * class9_1.modelZoom >> 16;
  9429.                     int l5 = Texture.anIntArray1471[class9_1.modelRotationY] * class9_1.modelZoom >> 16;
  9430.                     boolean flag2 = interfaceIsSelected(class9_1);
  9431.                     int i7;
  9432.                     if(flag2)
  9433.                         i7 = class9_1.enabledAnimation;
  9434.                     else
  9435.                         i7 = class9_1.disabledAnimation;
  9436.                     Model model;
  9437.                     if(i7 == -1) {
  9438.                         model = class9_1.method209(-1, -1, flag2);
  9439.                     } else {
  9440.                         Animation animation = Animation.anims[i7];
  9441.                         model = class9_1.method209(animation.anIntArray354[class9_1.animationLength], animation.anIntArray353[class9_1.animationLength], flag2);
  9442.                     }
  9443.                    
  9444.                     if(model != null)
  9445.                         model.setRotation(class9_1.modelRotationX, 0, class9_1.modelRotationY, 0, i5, l5);
  9446.                     DrawingArea.removeClip();
  9447.                     Texture.textureInt1 = k3;
  9448.                     Texture.textureInt2 = j4;
  9449.                 } else if(class9_1.interfaceType == 7) {
  9450.                     RSFont textDrawingArea_1 = class9_1.rsFonts;
  9451.                     int k4 = 0;
  9452.                     for(int j5 = 0; j5 < class9_1.height; j5++) {
  9453.                         for(int i6 = 0; i6 < class9_1.width; i6++) {
  9454.                             if(class9_1.inventory[k4] > 0) {
  9455.                                 ItemDef itemDef = ItemDef.forID(class9_1.inventory[k4] - 1);
  9456.                                 String s2 = itemDef.name;
  9457.                                 if(itemDef.description != null)
  9458.                                     s2 = itemDef.description;
  9459.                                 if(itemDef.stackable || class9_1.inventoryValue[k4] != 1)
  9460.                                     s2 = itemDef.name + " x" + intToKOrMilLongName(class9_1.inventoryValue[k4]);
  9461.                                 int i9 = k2 + i6 * (115 + class9_1.invSpritePadX);
  9462.                                 int k9 = l2 + j5 * (12 + class9_1.invSpritePadY);
  9463.                                 if(class9_1.textCentered)
  9464.                                     textDrawingArea_1.drawCenteredString(class9_1.disabledColor, i9 + class9_1.width / 2, s2, k9, class9_1.textShadowed);
  9465.                                 else
  9466.                                     textDrawingArea_1.drawString(class9_1.textShadowed, i9, class9_1.disabledColor, s2, k9);
  9467.                             }
  9468.                             k4++;
  9469.                         }
  9470.                     }
  9471.                 }
  9472.                 else if(class9_1.interfaceType == 8 && (anInt1500 == class9_1.id || anInt1044 == class9_1.id || anInt1129 == class9_1.id) && anInt1501 == 100) {
  9473.                     int boxWidth = 0;
  9474.                     int boxHeight = 0;
  9475.                     RSFont textDrawingArea_2 = regularFont;
  9476.                     for(String s1 = class9_1.disabledMessage; s1.length() > 0;) {
  9477.                         int l7 = s1.indexOf("\\n");
  9478.                         String s4;
  9479.                         if(l7 != -1) {
  9480.                             s4 = s1.substring(0, l7);
  9481.                             s1 = s1.substring(l7 + 2);
  9482.                         } else {
  9483.                             s4 = s1;
  9484.                             s1 = "";
  9485.                         }
  9486.                         int j10 = textDrawingArea_2.getTextWidth(s4);
  9487.                         if(j10 > boxWidth) {
  9488.                             boxWidth = j10;
  9489.                         }
  9490.                         boxHeight += textDrawingArea_2.anInt1497 + 1;
  9491.                     }
  9492.                     boxWidth += 6;
  9493.                     boxHeight += 7;
  9494.                     int xPos = (l2 + class9_1.width) - 5 - boxWidth;
  9495.                     int yPos = k2 + class9_1.height + 5;
  9496.                     if(xPos < l2 + 5) {
  9497.                         xPos = l2 + 5;
  9498.                     }
  9499.                     if(xPos + boxWidth > j + i.width) {
  9500.                         xPos = (j + i.width) - boxWidth;
  9501.                     }
  9502.                     if(yPos + boxHeight > x + i.height) {
  9503.                         yPos = (x + i.height) - boxHeight;
  9504.                     }
  9505.                     DrawingArea.fillRect(xPos, yPos, boxWidth, boxHeight, 0xFFFFA0);
  9506.                     DrawingArea.drawRect(xPos, yPos, boxWidth, boxHeight, 0);
  9507.                     String s2 = class9_1.disabledMessage;
  9508.                     for(int j11 = yPos + textDrawingArea_2.anInt1497 + 2; s2.length() > 0; j11 += textDrawingArea_2.anInt1497 + 1) {//anInt1497
  9509.                         int l11 = s2.indexOf("\\n");
  9510.                         String s5;
  9511.                         if(l11 != -1) {
  9512.                             s5 = s2.substring(0, l11);
  9513.                             s2 = s2.substring(l11 + 2);
  9514.                         } else {
  9515.                             s5 = s2;
  9516.                             s2 = "";
  9517.                         }
  9518.                         textDrawingArea_2.drawString(false, xPos + 3, 0, s5, j11);
  9519.                     }
  9520.                 } else if(class9_1.interfaceType == 9) {
  9521.             drawHoverBox(k2, l2, class9_1.disabledMessage);
  9522.         }
  9523.                 }
  9524.         DrawingArea.setClip(i1, j1, k1, l1);
  9525.     }
  9526.  
  9527.     private void randomizeBackground(Background background) {
  9528.         int j = 256;
  9529.         for(int k = 0; k < anIntArray1190.length; k++)
  9530.             anIntArray1190[k] = 0;
  9531.  
  9532.         for(int l = 0; l < 5000; l++) {
  9533.             int i1 = (int)(Math.random() * 128D * (double)j);
  9534.             anIntArray1190[i1] = (int)(Math.random() * 256D);
  9535.         }
  9536.         for(int j1 = 0; j1 < 20; j1++) {
  9537.             for(int k1 = 1; k1 < j - 1; k1++) {
  9538.                 for(int i2 = 1; i2 < 127; i2++) {
  9539.                     int k2 = i2 + (k1 << 7);
  9540.                     anIntArray1191[k2] = (anIntArray1190[k2 - 1] + anIntArray1190[k2 + 1] + anIntArray1190[k2 - 128] + anIntArray1190[k2 + 128]) / 4;
  9541.                 }
  9542.  
  9543.             }
  9544.             int ai[] = anIntArray1190;
  9545.             anIntArray1190 = anIntArray1191;
  9546.             anIntArray1191 = ai;
  9547.         }
  9548.         if(background != null) {
  9549.             int l1 = 0;
  9550.             for(int j2 = 0; j2 < background.imgHeight; j2++) {
  9551.                 for(int l2 = 0; l2 < background.imgWidth; l2++)
  9552.                     if(background.aByteArray1450[l1++] != 0) {
  9553.                         int i3 = l2 + 16 + background.anInt1454;
  9554.                         int j3 = j2 + 16 + background.anInt1455;
  9555.                         int k3 = i3 + (j3 << 7);
  9556.                         anIntArray1190[k3] = 0;
  9557.                     }
  9558.             }
  9559.         }
  9560.     }
  9561.  
  9562.     private void method107(int i, int j, Stream stream, Player player) {
  9563.         if((i & 0x400) != 0)
  9564.         {
  9565.             player.anInt1543 = stream.method428();
  9566.             player.anInt1545 = stream.method428();
  9567.             player.anInt1544 = stream.method428();
  9568.             player.anInt1546 = stream.method428();
  9569.             player.anInt1547 = stream.method436() + loopCycle;
  9570.             player.anInt1548 = stream.method435() + loopCycle;
  9571.             player.anInt1549 = stream.method428();
  9572.             player.method446();
  9573.         }
  9574.         if((i & 0x100) != 0) {
  9575.             player.anInt1520 = stream.method434();
  9576.             int k = stream.readDWord();
  9577.             player.anInt1524 = k >> 16;
  9578.             player.anInt1523 = loopCycle + (k & 0xffff);
  9579.             player.anInt1521 = 0;
  9580.             player.anInt1522 = 0;
  9581.             if(player.anInt1523 > loopCycle)
  9582.                 player.anInt1521 = -1;
  9583.             if(player.anInt1520 == 65535)
  9584.                 player.anInt1520 = -1;
  9585.         }
  9586.         if((i & 8) != 0) {
  9587.             int l = stream.method434();
  9588.             if(l == 65535)
  9589.                 l = -1;
  9590.             int i2 = stream.method427();
  9591.             if(l == player.anim && l != -1) {
  9592.                 int i3 = Animation.anims[l].anInt365;
  9593.                 if(i3 == 1)
  9594.                 {
  9595.                     player.anInt1527 = 0;
  9596.                     player.anInt1528 = 0;
  9597.                     player.anInt1529 = i2;
  9598.                     player.anInt1530 = 0;
  9599.                 }
  9600.                 if(i3 == 2)
  9601.                     player.anInt1530 = 0;
  9602.             } else if(l == -1 || player.anim == -1 || Animation.anims[l].anInt359 >= Animation.anims[player.anim].anInt359) {
  9603.                 player.anim = l;
  9604.                 player.anInt1527 = 0;
  9605.                 player.anInt1528 = 0;
  9606.                 player.anInt1529 = i2;
  9607.                 player.anInt1530 = 0;
  9608.                 player.anInt1542 = player.smallXYIndex;
  9609.             }
  9610.         }
  9611.         if((i & 4) != 0) {
  9612.             player.textSpoken = stream.readString();
  9613.             if(player.textSpoken.charAt(0) == '~')
  9614.             {
  9615.                 player.textSpoken = player.textSpoken.substring(1);
  9616.                 pushMessage(player.textSpoken, 2, player.name);
  9617.             } else
  9618.             if(player == myPlayer)
  9619.                 pushMessage(player.textSpoken, 2, player.name);
  9620.             player.textColor = 0;
  9621.             player.textAnim = 0;
  9622.             player.textCycle = 150;
  9623.         }
  9624.         if((i & 0x80) != 0) {
  9625.             //right fucking here
  9626.             int i1 = stream.method434();
  9627.             int j2 = stream.readUnsignedByte();
  9628.             int j3 = stream.method427();
  9629.             int k3 = stream.currentOffset;
  9630.             if(player.name != null && player.visible) {
  9631.                 long l3 = TextClass.longForName(player.name);
  9632.                 boolean flag = false;
  9633.                 if(j2 <= 1) {
  9634.                     for(int i4 = 0; i4 < ignoreCount; i4++) {
  9635.                         if(ignoreListAsLongs[i4] != l3)
  9636.                             continue;
  9637.                         flag = true;
  9638.                         break;
  9639.                     }
  9640.  
  9641.                 }
  9642.                 if(!flag && anInt1251 == 0)
  9643.                     try {
  9644.                         aStream_834.currentOffset = 0;
  9645.                         stream.method442(j3, 0, aStream_834.buffer);
  9646.                         aStream_834.currentOffset = 0;
  9647.                         String s = TextInput.method525(j3, aStream_834);
  9648.                         //s = Censor.doCensor(s);
  9649.                         player.textSpoken = s;
  9650.                         player.textColor = i1 >> 8;
  9651.                         player.privelage = j2;
  9652.                         player.textAnim = i1 & 0xff;
  9653.                         player.textCycle = 150;
  9654.                         //Other players see your icon
  9655.                         String cr = "";
  9656.                         if(j2 == 4) cr = "@cr0@";
  9657.                         if(j2 == 3) cr = "@cr3@";
  9658.                         if(j2 == 2) cr = "@cr2@";
  9659.                         if(j2 == 1) cr = "@cr1@";
  9660.                         pushMessage(s, 2, cr + "<col="+titleColor(player.titleColor, 0)+">" + player.title + "</col>" + player.name);
  9661.                     }
  9662.                     catch(Exception exception)
  9663.                     {
  9664.                         SignLink.reporterror("cde2");
  9665.                     }
  9666.             }
  9667.             stream.currentOffset = k3 + j3;
  9668.         }
  9669.         if((i & 1) != 0) {
  9670.             player.interactingEntity = stream.method434();
  9671.             if(player.interactingEntity == 65535)
  9672.                 player.interactingEntity = -1;
  9673.         }
  9674.         if((i & 0x10) != 0) {
  9675.             int j1 = stream.method427();
  9676.             byte abyte0[] = new byte[j1];
  9677.             Stream stream_1 = new Stream(abyte0);
  9678.             stream.readBytes(j1, 0, abyte0);
  9679.             aStreamArray895s[j] = stream_1;
  9680.             player.updatePlayer(stream_1);
  9681.         }
  9682.         if((i & 2) != 0) {
  9683.             player.anInt1538 = stream.method436();
  9684.             player.anInt1539 = stream.method434();
  9685.         }
  9686.         if((i & 0x20) != 0) {
  9687.             int k1 = stream.readUnsignedByte();
  9688.             int k2 = stream.method426();
  9689.             int type1 = stream.readUnsignedByte();
  9690.             player.updateHitData(k2, k1, type1, loopCycle);
  9691.             player.loopCycleStatus = loopCycle + 300;
  9692.             player.currentHealth = stream.method427();
  9693.             player.maxHealth = stream.readUnsignedByte();
  9694.         }
  9695.         if((i & 0x200) != 0) {
  9696.             int l1 = stream.readUnsignedByte();
  9697.             int l2 = stream.method428();
  9698.             int type2 = stream.readUnsignedByte();
  9699.             player.updateHitData(l2, l1, type2, loopCycle);
  9700.             player.loopCycleStatus = loopCycle + 300;
  9701.             player.currentHealth = stream.readUnsignedByte();
  9702.             player.maxHealth = stream.method427();
  9703.         }
  9704.     }
  9705.  
  9706.     private void method108()
  9707.     {
  9708.         try
  9709.         {
  9710.             int j = myPlayer.x + anInt1278;
  9711.             int k = myPlayer.y + anInt1131;
  9712.             if(anInt1014 - j < -500 || anInt1014 - j > 500 || anInt1015 - k < -500 || anInt1015 - k > 500)
  9713.             {
  9714.                 anInt1014 = j;
  9715.                 anInt1015 = k;
  9716.             }
  9717.             if(anInt1014 != j)
  9718.                 anInt1014 += (j - anInt1014) / 16;
  9719.             if(anInt1015 != k)
  9720.                 anInt1015 += (k - anInt1015) / 16;
  9721.             if(super.keyArray[1] == 1)
  9722.                 anInt1186 += (-24 - anInt1186) / 2;
  9723.             else
  9724.             if(super.keyArray[2] == 1)
  9725.                 anInt1186 += (24 - anInt1186) / 2;
  9726.             else
  9727.                 anInt1186 /= 2;
  9728.             if(super.keyArray[3] == 1)
  9729.                 anInt1187 += (12 - anInt1187) / 2;
  9730.             else
  9731.             if(super.keyArray[4] == 1)
  9732.                 anInt1187 += (-12 - anInt1187) / 2;
  9733.             else
  9734.                 anInt1187 /= 2;
  9735.               minimapInt1 = minimapInt1 + anInt1186 / 2 & 0x7ff;
  9736.               anInt1184 += anInt1187 / 2;
  9737.             if(anInt1184 < 128)
  9738.                 anInt1184 = 128;
  9739.             if(anInt1184 > 383)
  9740.                 anInt1184 = 383;
  9741.             int l = anInt1014 >> 7;
  9742.             int i1 = anInt1015 >> 7;
  9743.             int j1 = method42(plane, anInt1015, anInt1014);
  9744.             int k1 = 0;
  9745.             if(l > 3 && i1 > 3 && l < 100 && i1 < 100)
  9746.             {
  9747.                 for(int l1 = l - 4; l1 <= l + 4; l1++)
  9748.                 {
  9749.                     for(int k2 = i1 - 4; k2 <= i1 + 4; k2++)
  9750.                     {
  9751.                         int l2 = plane;
  9752.                         if(l2 < 3 && (byteGroundArray[1][l1][k2] & 2) == 2)
  9753.                             l2++;
  9754.                         int i3 = j1 - intGroundArray[l2][l1][k2];
  9755.                         if(i3 > k1)
  9756.                             k1 = i3;
  9757.                     }
  9758.  
  9759.                 }
  9760.  
  9761.             }
  9762.             anInt1005++;
  9763.             if(anInt1005 > 1512)
  9764.             {
  9765.                 anInt1005 = 0;
  9766.                 stream.createFrame(77);
  9767.                 stream.writeWordBigEndian(0);
  9768.                 int i2 = stream.currentOffset;
  9769.                 stream.writeWordBigEndian((int)(Math.random() * 256D));
  9770.                 stream.writeWordBigEndian(101);
  9771.                 stream.writeWordBigEndian(233);
  9772.                 stream.writeWord(45092);
  9773.                 if((int)(Math.random() * 2D) == 0)
  9774.                     stream.writeWord(35784);
  9775.                 stream.writeWordBigEndian((int)(Math.random() * 256D));
  9776.                 stream.writeWordBigEndian(64);
  9777.                 stream.writeWordBigEndian(38);
  9778.                 stream.writeWord((int)(Math.random() * 65536D));
  9779.                 stream.writeWord((int)(Math.random() * 65536D));
  9780.                 stream.writeBytes(stream.currentOffset - i2);
  9781.             }
  9782.             int j2 = k1 * 192;
  9783.             if(j2 > 0x17f00)
  9784.                 j2 = 0x17f00;
  9785.             if(j2 < 32768)
  9786.                 j2 = 32768;
  9787.             if(j2 > anInt984)
  9788.             {
  9789.                 anInt984 += (j2 - anInt984) / 24;
  9790.                 return;
  9791.             }
  9792.             if(j2 < anInt984)
  9793.             {
  9794.                 anInt984 += (j2 - anInt984) / 80;
  9795.             }
  9796.         }
  9797.         catch(Exception _ex)
  9798.         {
  9799.             SignLink.reporterror("glfc_ex " + myPlayer.x + "," + myPlayer.y + "," + anInt1014 + "," + anInt1015 + "," + anInt1069 + "," + anInt1070 + "," + baseX + "," + baseY);
  9800.             throw new RuntimeException("eek");
  9801.         }
  9802.     }
  9803.  
  9804.     public void processDrawing() {
  9805.         if(rsAlreadyLoaded || loadingError || genericLoadingError) {
  9806.             showErrorScreen();
  9807.             return;
  9808.         }
  9809.         //anInt1061++;
  9810.         if(!loggedIn) {
  9811.             drawLoginScreen(false);
  9812.         } else {
  9813.             drawGameScreen();
  9814.         }
  9815.         anInt1213 = 0;
  9816.     }
  9817.  
  9818.     private boolean isFriendOrSelf(String s) {
  9819.         if(s == null)
  9820.             return false;
  9821.         for(int i = 0; i < friendsCount; i++)
  9822.             if(s.equalsIgnoreCase(friendsList[i]))
  9823.                 return true;
  9824.         return s.equalsIgnoreCase(myPlayer.name);
  9825.     }
  9826.  
  9827.     private static String combatDiffColor(int i, int j)
  9828.     {
  9829.         int k = i - j;
  9830.         if(!pvpWorld) {
  9831.             if(k < -9)
  9832.                 return "@red@";
  9833.             if(k < -6)
  9834.                 return "@or3@";
  9835.             if(k < -3)
  9836.                 return "@or2@";
  9837.             if(k < 0)
  9838.                 return "@or1@";
  9839.             if(k > 9)
  9840.                 return "@gre@";
  9841.             if(k > 6)
  9842.                 return "@gr3@";
  9843.             if(k > 3)
  9844.                 return "@gr2@";
  9845.             if(k > 0)
  9846.                 return "@gr1@";
  9847.             else
  9848.                 return "@yel@";
  9849.         } else {
  9850.             if(k < -12)
  9851.                 return "@whi@";
  9852.             if(k < -9)
  9853.                 return "@red@";
  9854.             if(k < -6)
  9855.                 return "@or3@";
  9856.             if(k < -3)
  9857.                 return "@or2@";
  9858.             if(k < 0)
  9859.                 return "@or1@";
  9860.             if(k > 12)
  9861.                 return "@whi@";
  9862.             if(k > 9)
  9863.                 return "@gre@";
  9864.             if(k > 6)
  9865.                 return "@gr3@";
  9866.             if(k > 3)
  9867.                 return "@gr2@";
  9868.             if(k > 0)
  9869.                 return "@gr1@";
  9870.             else
  9871.                 return "@yel@";
  9872.         }
  9873.     }
  9874.  
  9875.     private void setWaveVolume(int i)
  9876.     {
  9877.         SignLink.wavevol = i;
  9878.     }
  9879.  
  9880. private int[] staffTabAnimations = {0,0,0};
  9881.     private void draw3dScreen() {
  9882.         if(snow) {
  9883.             method119(animationTimePassed, 11877);
  9884.             drawInterface(0, 0, 0, RSInterface.interfaceCache[11877]);
  9885.         }
  9886.         drawSplitPrivateChat();
  9887.         if(xpToDraw != 0 && drawFlag) {
  9888.             if(flagPos < 125)
  9889.                 flagPos += 2;
  9890.             boldText.drawCenterAlignedString("+" + formatValue(xpToDraw, ",") + " xp", 256, 150-flagPos, 0xf5b241, 1, true);
  9891.             if(flagPos >= 125) {
  9892.                 drawFlag = false;
  9893.                 flagPos = 0;
  9894.             }
  9895.         } else {
  9896.             drawFlag = false;
  9897.             flagPos = 0;
  9898.         }
  9899.         if(drawXpBar) {
  9900.             String text = formatValue(myPlayer.xpCount, ",");
  9901.             if(myPlayer.xpCount > 214748364)
  9902.                 text = "Lots!";
  9903.             if(xpToDraw > 0 && xpToDraw < 214748364)
  9904.                 text = "+" + formatValue(xpToDraw, ",") + " xp  " + text;
  9905.             int drawX = 483-regularFont.getTextWidth(text);
  9906.             cacheSprite[30].drawSprite(487, 49);
  9907.             regularText.drawLeftAlignedString(text, drawX, 65, 0xdcdcdc, 0, true);
  9908.         }
  9909.  
  9910.         if(anInt1055 == 1) {
  9911.             multiOverlay.drawSprite(472, 296-40); //MULTI ICON POSITION
  9912.             if(mouseInArea(479, 496, 263, 281) && openInterfaceID == -1)
  9913.                 drawHoverBox(465-regularFont.getTextWidth("Multiway Combat"), 256, "Multiway Combat");
  9914.         }
  9915.  
  9916.         if(crossType == 1)
  9917.         {
  9918.             crosses[crossIndex / 100].drawSprite(crossX - 8, crossY - 8);
  9919.             anInt1142++;
  9920.             if(anInt1142 > 67)
  9921.             {
  9922.                 anInt1142 = 0;
  9923.                 stream.createFrame(78);
  9924.             }
  9925.         }
  9926.         if(crossType == 2)
  9927.             crosses[4 + crossIndex / 100].drawSprite(crossX - 8, crossY - 8);
  9928.         if(anInt1018 != -1)
  9929.         {
  9930.             method119(animationTimePassed, anInt1018);
  9931.             drawInterface(0, 0, 0, RSInterface.interfaceCache[anInt1018]);
  9932.         }
  9933.         drawStaffTab();
  9934.         processTaskDrawing();
  9935.         if(openInterfaceID != -1) {
  9936.             method119(animationTimePassed, openInterfaceID);
  9937.             drawInterface(0, 0, 0, RSInterface.interfaceCache[openInterfaceID]);
  9938.         }
  9939.         //method70();
  9940.         int x = baseX + (myPlayer.x - 6 >> 7);
  9941.         int y = baseY + (myPlayer.y - 6 >> 7);
  9942.         if(clientData) {
  9943.             int xPos = DrawingArea.width - 4;
  9944.             regularText.drawRightAlignedString("Fps: " + super.fps, xPos, 15, 0xffff00, -1, true);
  9945.             Runtime runtime = Runtime.getRuntime();
  9946.             int usedMemory = (int)((runtime.totalMemory() - runtime.freeMemory()) / 1024L);
  9947.             int maxMemory = (int)(runtime.totalMemory() / 1024L);
  9948.             regularText.drawRightAlignedString("Mem: " + usedMemory + "k / " + maxMemory + "k", xPos, 30, 0xffff00, -1, true);
  9949.             regularText.drawRightAlignedString("Mouse: " + super.mouseX + ", " + super.mouseY, xPos, 45, 0xffff00, -1, true);
  9950.             regularText.drawRightAlignedString("Coords: " + x + ", " + y, xPos, 60, 0xffff00, -1, true);
  9951.             regularText.drawRightAlignedString("Client size: " + clientWidth + "x" + clientHeight, xPos, 75, 0xffff00, -1, true);
  9952.             regularText.drawRightAlignedString("Loop cycle: " + loopCycle, xPos, 90, 0xffff00, -1, true);
  9953.         }
  9954.         if(anInt1104 != 0) {
  9955.             int j = anInt1104 / 50;
  9956.             int l = j / 60;
  9957.             j %= 60;
  9958.             if(j < 10)
  9959.                 regularFont.method385(0xffff00, "System update in: " + l + ":0" + j, 329, 4);
  9960.             else
  9961.                 regularFont.method385(0xffff00, "System update in: " + l + ":" + j, 329, 4);
  9962.             anInt849++;
  9963.             if(anInt849 > 75)
  9964.             {
  9965.                 anInt849 = 0;
  9966.                 stream.createFrame(148);
  9967.             }
  9968.         }
  9969.         alertHandler.processAlerts();
  9970.     }
  9971.  
  9972.     private void drawStaffTab() {
  9973.         if(myPrivilege >= 1 && myPrivilege <= 3 && StaffTabInUse && openInterfaceID == -1) {
  9974.             if(!staffTabOpen) {
  9975.                 if(mouseInArea(496-staffTabAnimations[0], 515, 7, 38)) {
  9976.                     StaffToggle.drawSprite(496-staffTabAnimations[0], 3, 230+staffTabAnimations[0]);
  9977.                     if(staffTabAnimations[0] < 24)
  9978.                         staffTabAnimations[0] += 2;
  9979.                 } else {
  9980.                     StaffToggle.drawSprite(496-staffTabAnimations[0], 3, 150+staffTabAnimations[0]);
  9981.                     if(staffTabAnimations[0] > 0)  
  9982.                         staffTabAnimations[0] -= 2;
  9983.                 }
  9984.             } else {
  9985.                 StaffToggle.drawSprite(472, 3);
  9986.                 staffTabAnimations[0] = 24;
  9987.                 StaffType.drawSprite(343, 3);
  9988.                 //if(mouseInArea(363, 477, 9, 30))
  9989.                 if(showedName.length() == 0) {
  9990.                     DrawingArea.fillRect(9, 349, 120, 21, 0xFFFFA0);
  9991.                     if(staffTabInput.length() == 0 && !writingOnStaffTab)
  9992.                         regularText.drawLeftAlignedString("Enter name...", 351, 22, 0xFFFFFD, 0, true);
  9993.                         else if(staffTabInput.length() > 0 && !writingOnStaffTab)
  9994.                         regularText.drawLeftAlignedString(staffTabInput, 351, 22, 0xFFFFFD, 0, true);
  9995.                     else if(writingOnStaffTab)
  9996.                         regularText.drawLeftAlignedString(staffTabInput + ((loopCycle % 40 < 20) ? "|" : ""), 351, 22, 0xFFFFFD, 0, true);
  9997.                 } else if(showedName.equals("Error!")) {
  9998.                     StaffError.drawSprite(350, 9);
  9999.                     regularText.drawLeftAlignedString("Error!", 370, 22, 0xF3DE42, 0, true);
  10000.                 } else {
  10001.                     regularText.drawLeftAlignedString(showedName, 351, 22, 0xFFFFFD, 0, true);
  10002.                     StaffSelectBg.drawSprite(343, 33, 200);
  10003.                     smallFont.drawString(false, 376, 0xffffff, "Mute", 67);
  10004.                     smallFont.drawString(false, 376, 0xffffff, "IP Mute", 90);
  10005.                     smallFont.drawString(false, 376, 0xffffff, "Unmute", 113);
  10006.                     smallFont.drawString(false, 376, 0xffffff, "Jail", 136);
  10007.                     smallFont.drawString(false, 376, 0xffffff, "Unjail", 159);
  10008.                     smallFont.drawString(false, 442, 0xffffff, "Ban", 67);
  10009.                     smallFont.drawString(false, 442, 0xffffff, "IP Ban", 90);
  10010.                     smallFont.drawString(false, 442, 0xffffff, "Unban", 113);
  10011.                     smallFont.drawString(false, 442, 0xffffff, "Tele to", 136);
  10012.                     smallFont.drawString(false, 442, 0xffffff, "Tele to me", 159);
  10013.                     if(mouseInArea(355, 355+63, 54, 54+17))
  10014.                         StaffSelectH.drawSprite(355, 54);
  10015.                     else
  10016.                         StaffSelect.drawSprite(355, 54);
  10017.                     if(mouseInArea(355, 355+63, 77, 77+17))
  10018.                         StaffSelectH.drawSprite(355, 77);
  10019.                     else
  10020.                         StaffSelect.drawSprite(355, 77);
  10021.                     if(mouseInArea(355, 355+63, 100, 100+17))
  10022.                         StaffSelectH.drawSprite(355, 100);
  10023.                     else
  10024.                         StaffSelect.drawSprite(355, 100);
  10025.                     if(mouseInArea(355, 355+63, 123, 123+17))
  10026.                         StaffSelectH.drawSprite(355, 123);
  10027.                     else
  10028.                         StaffSelect.drawSprite(355, 123);
  10029.                     if(mouseInArea(355, 355+63, 146, 146+17))
  10030.                         StaffSelectH.drawSprite(355, 146);
  10031.                     else
  10032.                         StaffSelect.drawSprite(355, 146);
  10033.                     if(mouseInArea(421, 421+75, 54, 54+17))
  10034.                         StaffSelectH.drawSprite(421, 54);
  10035.                     else
  10036.                         StaffSelect.drawSprite(421, 54);
  10037.                     if(mouseInArea(421, 421+75, 77, 77+17))
  10038.                         StaffSelectH.drawSprite(421, 77);
  10039.                     else
  10040.                         StaffSelect.drawSprite(421, 77);
  10041.                     if(mouseInArea(421, 421+75, 100, 100+17))
  10042.                         StaffSelectH.drawSprite(421, 100);
  10043.                     else
  10044.                         StaffSelect.drawSprite(421, 100);
  10045.                     if(mouseInArea(421, 421+75, 123, 123+17))
  10046.                         StaffSelectH.drawSprite(421, 123);
  10047.                     else
  10048.                         StaffSelect.drawSprite(421, 123);
  10049.                     if(mouseInArea(421, 431+75, 146, 146+17))
  10050.                         StaffSelectH.drawSprite(421, 146);
  10051.                     else
  10052.                         StaffSelect.drawSprite(421, 146);
  10053.                     if(StaffTabSelected != -1) {
  10054.                         int x = 0, y = 0;
  10055.                         switch(StaffTabSelected) {
  10056.                             case 0: x = 355; y = 54; break;
  10057.                             case 1: x = 355; y = 77; break;
  10058.                             case 2: x = 355; y = 100; break;
  10059.                             case 3: x = 355; y = 123; break;
  10060.                             case 4: x = 355; y = 146; break;
  10061.                             case 5: x = 421; y = 54; break;
  10062.                             case 6: x = 421; y = 77; break;
  10063.                             case 7: x = 421; y = 100; break;
  10064.                             case 8: x = 421; y = 123; break;
  10065.                             case 9: x = 421; y = 146; break;
  10066.                         }
  10067.                         StaffSelected.drawSprite(x, y);
  10068.                         StaffSend.drawSprite(430+staffTabAnimations[2], 182, staffTabAnimations[1]);
  10069.                         if(staffTabAnimations[1] + 5 < 256)
  10070.                             staffTabAnimations[1] += 5;
  10071.                         if(mouseInArea(430, 490, 182, 213) && staffTabAnimations[2] <= 8)
  10072.                             staffTabAnimations[2] += 2;
  10073.                         if(!mouseInArea(430, 490, 182, 213) && staffTabAnimations[2] >= 2)
  10074.                             staffTabAnimations[2] -= 2;
  10075.                     } else {
  10076.                         staffTabAnimations[1] = 0;
  10077.                         staffTabAnimations[2] = 0;
  10078.                     }
  10079.                 }
  10080.             }
  10081.         }
  10082.     }
  10083.  
  10084.     private void addIgnore(long l)
  10085.     {
  10086.         try
  10087.         {
  10088.             if(l == 0L)
  10089.                 return;
  10090.             if(ignoreCount >= 100)
  10091.             {
  10092.                 pushMessage("Your ignore list is full. Max of 100 hit", 0, "");
  10093.                 return;
  10094.             }
  10095.             String s = TextClass.fixName(TextClass.nameForLong(l));
  10096.             for(int j = 0; j < ignoreCount; j++)
  10097.                 if(ignoreListAsLongs[j] == l)
  10098.                 {
  10099.                     pushMessage(s + " is already on your ignore list", 0, "");
  10100.                     return;
  10101.                 }
  10102.             for(int k = 0; k < friendsCount; k++)
  10103.                 if(friendsListAsLongs[k] == l)
  10104.                 {
  10105.                     pushMessage("Please remove " + s + " from your friend list first", 0, "");
  10106.                     return;
  10107.                 }
  10108.  
  10109.             ignoreListAsLongs[ignoreCount++] = l;
  10110.             needDrawTabArea = true;
  10111.             stream.createFrame(133);
  10112.             stream.writeQWord(l);
  10113.             return;
  10114.         }
  10115.         catch(RuntimeException runtimeexception)
  10116.         {
  10117.             SignLink.reporterror("45688, " + l + ", " + 4 + ", " + runtimeexception.toString());
  10118.         }
  10119.         throw new RuntimeException();
  10120.     }
  10121.  
  10122.     private void method114()
  10123.     {
  10124.         for(int i = -1; i < playerCount; i++)
  10125.         {
  10126.             int j;
  10127.             if(i == -1)
  10128.                 j = myPlayerIndex;
  10129.             else
  10130.                 j = playerIndices[i];
  10131.             Player player = playerArray[j];
  10132.             if(player != null)
  10133.                 method96(player);
  10134.         }
  10135.  
  10136.     }
  10137.  
  10138.     private void method115()
  10139.     {
  10140.         if(loadingStage == 2)
  10141.         {
  10142.             for(Class30_Sub1 class30_sub1 = (Class30_Sub1)aClass19_1179.reverseGetFirst(); class30_sub1 != null; class30_sub1 = (Class30_Sub1)aClass19_1179.reverseGetNext())
  10143.             {
  10144.                 if(class30_sub1.anInt1294 > 0)
  10145.                     class30_sub1.anInt1294--;
  10146.                 if(class30_sub1.anInt1294 == 0)
  10147.                 {
  10148.                     if(class30_sub1.anInt1299 < 0 || ObjectManager.method178(class30_sub1.anInt1299, class30_sub1.anInt1301))
  10149.                     {
  10150.                         method142(class30_sub1.anInt1298, class30_sub1.anInt1295, class30_sub1.anInt1300, class30_sub1.anInt1301, class30_sub1.anInt1297, class30_sub1.anInt1296, class30_sub1.anInt1299);
  10151.                         class30_sub1.unlink();
  10152.                     }
  10153.                 } else
  10154.                 {
  10155.                     if(class30_sub1.anInt1302 > 0)
  10156.                         class30_sub1.anInt1302--;
  10157.                     if(class30_sub1.anInt1302 == 0 && class30_sub1.anInt1297 >= 1 && class30_sub1.anInt1298 >= 1 && class30_sub1.anInt1297 <= 102 && class30_sub1.anInt1298 <= 102 && (class30_sub1.anInt1291 < 0 || ObjectManager.method178(class30_sub1.anInt1291, class30_sub1.anInt1293)))
  10158.                     {
  10159.                         method142(class30_sub1.anInt1298, class30_sub1.anInt1295, class30_sub1.anInt1292, class30_sub1.anInt1293, class30_sub1.anInt1297, class30_sub1.anInt1296, class30_sub1.anInt1291);
  10160.                         class30_sub1.anInt1302 = -1;
  10161.                         if(class30_sub1.anInt1291 == class30_sub1.anInt1299 && class30_sub1.anInt1299 == -1)
  10162.                             class30_sub1.unlink();
  10163.                         else
  10164.                         if(class30_sub1.anInt1291 == class30_sub1.anInt1299 && class30_sub1.anInt1292 == class30_sub1.anInt1300 && class30_sub1.anInt1293 == class30_sub1.anInt1301)
  10165.                             class30_sub1.unlink();
  10166.                     }
  10167.                 }
  10168.             }
  10169.  
  10170.         }
  10171.     }
  10172.  
  10173.     private void determineMenuSize() {
  10174.         int w = regularFont.getTextWidth("Choose Option");
  10175.         for(int j = 0; j < menuActionRow; j++) {
  10176.             int optW = 0;
  10177.             optW = regularFont.getTextWidth(menuActionName[j]);
  10178.             if(optW > w)
  10179.                 w = optW;
  10180.         }
  10181.         w += 8;
  10182.         int h = 15 * menuActionRow + 22;
  10183.         int x = super.saveClickX - w / 2;
  10184.         if(x + w > 765)
  10185.             x = 765 - w;
  10186.         if(x < 0)
  10187.             x = 0;
  10188.         int y = super.saveClickY - 10;
  10189.         if(y + h > 503)
  10190.             y = 503 - h;
  10191.         if(y < 0)
  10192.             y = 0;
  10193.         menuOpen = true;
  10194.         menuScreenArea = 0;
  10195.         menuOffsetX = x;
  10196.         menuOffsetY = y;
  10197.         menuWidth = w;
  10198.         menuHeight = h;
  10199.     }
  10200.  
  10201.     private void method117(Stream stream)
  10202.     {
  10203.         stream.initBitAccess();
  10204.         int j = stream.readBits(1);
  10205.         if(j == 0)
  10206.             return;
  10207.         int k = stream.readBits(2);
  10208.         if(k == 0)
  10209.         {
  10210.             anIntArray894[anInt893++] = myPlayerIndex;
  10211.             return;
  10212.         }
  10213.         if(k == 1)
  10214.         {
  10215.             int l = stream.readBits(3);
  10216.             myPlayer.moveInDir(false, l);
  10217.             int k1 = stream.readBits(1);
  10218.             if(k1 == 1)
  10219.                 anIntArray894[anInt893++] = myPlayerIndex;
  10220.             return;
  10221.         }
  10222.         if(k == 2)
  10223.         {
  10224.             int i1 = stream.readBits(3);
  10225.             myPlayer.moveInDir(true, i1);
  10226.             int l1 = stream.readBits(3);
  10227.             myPlayer.moveInDir(true, l1);
  10228.             int j2 = stream.readBits(1);
  10229.             if(j2 == 1)
  10230.                 anIntArray894[anInt893++] = myPlayerIndex;
  10231.             return;
  10232.         }
  10233.         if(k == 3)
  10234.         {
  10235.             plane = stream.readBits(2);
  10236.             int j1 = stream.readBits(1);
  10237.             int i2 = stream.readBits(1);
  10238.             if(i2 == 1)
  10239.                 anIntArray894[anInt893++] = myPlayerIndex;
  10240.             int k2 = stream.readBits(7);
  10241.             int l2 = stream.readBits(7);
  10242.             myPlayer.setPos(l2, k2, j1 == 1);
  10243.         }
  10244.     }
  10245.  
  10246.     private void nullLoader()
  10247.     {
  10248.         aBoolean831 = false;
  10249.         while(drawingFlames)
  10250.         {
  10251.             aBoolean831 = false;
  10252.             try
  10253.             {
  10254.                 Thread.sleep(50L);
  10255.             }
  10256.             catch(Exception _ex) { }
  10257.         }
  10258.         //titleBox = null;
  10259.         titleBox1 = null;
  10260.         //titleButton = null;
  10261.         aBackgroundArray1152s = null;
  10262.         //anIntArray850 = null;
  10263.         anIntArray851 = null;
  10264.         anIntArray852 = null;
  10265.         anIntArray853 = null;
  10266.         anIntArray1190 = null;
  10267.         anIntArray1191 = null;
  10268.         //anIntArray828 = null;
  10269.         //anIntArray829 = null;
  10270.         aSprite_1201 = null;
  10271.         aSprite_1202 = null;
  10272.     }
  10273.  
  10274.     private boolean method119(int i, int j)
  10275.     {
  10276.         boolean flag1 = false;
  10277.         RSInterface class9 = RSInterface.interfaceCache[j];
  10278.         for(int k = 0; k < class9.children.length; k++)
  10279.         {
  10280.             if(class9.children[k] == -1)
  10281.                 break;
  10282.             RSInterface class9_1 = RSInterface.interfaceCache[class9.children[k]];
  10283.             if(class9_1.interfaceType == 1)
  10284.                 flag1 |= method119(i, class9_1.id);
  10285.             if(class9_1.interfaceType == 6 && (class9_1.disabledAnimation != -1 || class9_1.enabledAnimation != -1))
  10286.             {
  10287.                 boolean flag2 = interfaceIsSelected(class9_1);
  10288.                 int l;
  10289.                 if(flag2)
  10290.                     l = class9_1.enabledAnimation;
  10291.                 else
  10292.                     l = class9_1.disabledAnimation;
  10293.                 if(l != -1)
  10294.                 {
  10295.                     Animation animation = Animation.anims[l];
  10296.                     for(class9_1.animationDelay += i; class9_1.animationDelay > animation.method258(class9_1.animationLength);)
  10297.                     {
  10298.                         class9_1.animationDelay -= animation.method258(class9_1.animationLength) + 1;
  10299.                         class9_1.animationLength++;
  10300.                         if(class9_1.animationLength >= animation.anInt352)
  10301.                         {
  10302.                             class9_1.animationLength -= animation.anInt356;
  10303.                             if(class9_1.animationLength < 0 || class9_1.animationLength >= animation.anInt352)
  10304.                                 class9_1.animationLength = 0;
  10305.                         }
  10306.                         flag1 = true;
  10307.                     }
  10308.  
  10309.                 }
  10310.             }
  10311.         }
  10312.  
  10313.         return flag1;
  10314.     }
  10315.  
  10316.     private int method120()
  10317.     {
  10318.         int j = 3;
  10319.         if(yCameraCurve < 310)
  10320.         {
  10321.             int k = xCameraPos >> 7;
  10322.             int l = yCameraPos >> 7;
  10323.             int i1 = myPlayer.x >> 7;
  10324.             int j1 = myPlayer.y >> 7;
  10325.             if((byteGroundArray[plane][k][l] & 4) != 0)
  10326.                 j = plane;
  10327.             int k1;
  10328.             if(i1 > k)
  10329.                 k1 = i1 - k;
  10330.             else
  10331.                 k1 = k - i1;
  10332.             int l1;
  10333.             if(j1 > l)
  10334.                 l1 = j1 - l;
  10335.             else
  10336.                 l1 = l - j1;
  10337.             if(k1 > l1)
  10338.             {
  10339.                 int i2 = (l1 * 0x10000) / k1;
  10340.                 int k2 = 32768;
  10341.                 while(k != i1)
  10342.                 {
  10343.                     if(k < i1)
  10344.                         k++;
  10345.                     else
  10346.                     if(k > i1)
  10347.                         k--;
  10348.                     if((byteGroundArray[plane][k][l] & 4) != 0)
  10349.                         j = plane;
  10350.                     k2 += i2;
  10351.                     if(k2 >= 0x10000)
  10352.                     {
  10353.                         k2 -= 0x10000;
  10354.                         if(l < j1)
  10355.                             l++;
  10356.                         else
  10357.                         if(l > j1)
  10358.                             l--;
  10359.                         if((byteGroundArray[plane][k][l] & 4) != 0)
  10360.                             j = plane;
  10361.                     }
  10362.                 }
  10363.             } else
  10364.             {
  10365.                 int j2 = (k1 * 0x10000) / l1;
  10366.                 int l2 = 32768;
  10367.                 while(l != j1)
  10368.                 {
  10369.                     if(l < j1)
  10370.                         l++;
  10371.                     else
  10372.                     if(l > j1)
  10373.                         l--;
  10374.                     if((byteGroundArray[plane][k][l] & 4) != 0)
  10375.                         j = plane;
  10376.                     l2 += j2;
  10377.                     if(l2 >= 0x10000)
  10378.                     {
  10379.                         l2 -= 0x10000;
  10380.                         if(k < i1)
  10381.                             k++;
  10382.                         else
  10383.                         if(k > i1)
  10384.                             k--;
  10385.                         if((byteGroundArray[plane][k][l] & 4) != 0)
  10386.                             j = plane;
  10387.                     }
  10388.                 }
  10389.             }
  10390.         }
  10391.         if((byteGroundArray[plane][myPlayer.x >> 7][myPlayer.y >> 7] & 4) != 0)
  10392.             j = plane;
  10393.         return j;
  10394.     }
  10395.  
  10396.     private int method121()
  10397.     {
  10398.         int j = method42(plane, yCameraPos, xCameraPos);
  10399.         if(j - zCameraPos < 800 && (byteGroundArray[plane][xCameraPos >> 7][yCameraPos >> 7] & 4) != 0)
  10400.             return plane;
  10401.         else
  10402.             return 3;
  10403.     }
  10404.  
  10405.     private void delIgnore(long l)
  10406.     {
  10407.         try
  10408.         {
  10409.             if(l == 0L)
  10410.                 return;
  10411.             for(int j = 0; j < ignoreCount; j++)
  10412.                 if(ignoreListAsLongs[j] == l)
  10413.                 {
  10414.                     ignoreCount--;
  10415.                     needDrawTabArea = true;
  10416.                     System.arraycopy(ignoreListAsLongs, j + 1, ignoreListAsLongs, j, ignoreCount - j);
  10417.  
  10418.                     stream.createFrame(74);
  10419.                     stream.writeQWord(l);
  10420.                     return;
  10421.                 }
  10422.  
  10423.             return;
  10424.         }
  10425.         catch(RuntimeException runtimeexception)
  10426.         {
  10427.             SignLink.reporterror("47229, " + 3 + ", " + l + ", " + runtimeexception.toString());
  10428.         }
  10429.         throw new RuntimeException();
  10430.     }
  10431.    
  10432.    
  10433.     private void chatJoin(long l) {
  10434.         try {
  10435.             if(l == 0L)
  10436.                 return;
  10437.             stream.createFrame(60);
  10438.             stream.writeQWord(l);
  10439.             return;
  10440.         }
  10441.         catch(RuntimeException runtimeexception)
  10442.         {
  10443.             SignLink.reporterror("47229, " + 3 + ", " + l + ", " + runtimeexception.toString());
  10444.         }
  10445.         throw new RuntimeException();
  10446.    
  10447.     }
  10448.    
  10449.     public String getParameter(String s)
  10450.     {
  10451.         if(SignLink.mainapp != null)
  10452.             return SignLink.mainapp.getParameter(s);
  10453.         else
  10454.             return super.getParameter(s);
  10455.     }
  10456.  
  10457.     /*private void adjustVolume(boolean flag, int i)
  10458.     {
  10459.         SignLink.midivol = i;
  10460.         if(flag)
  10461.             SignLink.midi = "voladjust";
  10462.     }*/
  10463.  
  10464.     private int extractInterfaceValues(RSInterface class9, int j)
  10465.     {
  10466.         if(class9.valueIndexArray == null || j >= class9.valueIndexArray.length)
  10467.             return -2;
  10468.         try
  10469.         {
  10470.             int ai[] = class9.valueIndexArray[j];
  10471.             int k = 0;
  10472.             int l = 0;
  10473.             int i1 = 0;
  10474.             do
  10475.             {
  10476.                 int j1 = ai[l++];
  10477.                 int k1 = 0;
  10478.                 byte byte0 = 0;
  10479.                 if(j1 == 0)
  10480.                     return k;
  10481.                 if(j1 == 1)
  10482.                     k1 = currentStats[ai[l++]];
  10483.                 if(j1 == 2)
  10484.                     k1 = maxStats[ai[l++]];
  10485.                 if(j1 == 3)
  10486.                     k1 = currentExp[ai[l++]];
  10487.                 if(j1 == 4)
  10488.                 {
  10489.                     RSInterface class9_1 = RSInterface.interfaceCache[ai[l++]];
  10490.                     int k2 = ai[l++];
  10491.                     if(k2 >= 0 && k2 < ItemDef.totalItems && (!ItemDef.forID(k2).membersObject || isMembers))
  10492.                     {
  10493.                         for(int j3 = 0; j3 < class9_1.inventory.length; j3++)
  10494.                             if(class9_1.inventory[j3] == k2 + 1)
  10495.                                 k1 += class9_1.inventoryValue[j3];
  10496.  
  10497.                     }
  10498.                 }
  10499.                 if(j1 == 5)
  10500.                     k1 = variousSettings[ai[l++]];
  10501.                 if(j1 == 6)
  10502.                     k1 = anIntArray1019[maxStats[ai[l++]] - 1];
  10503.                 if(j1 == 7)
  10504.                     k1 = (variousSettings[ai[l++]] * 100) / 46875;
  10505.                 if(j1 == 8)
  10506.                     k1 = myPlayer.combatLevel;
  10507.                 if(j1 == 9)
  10508.                 {
  10509.                     for(int l1 = 0; l1 < Skills.skillsCount; l1++)
  10510.                         if(Skills.skillEnabled[l1])
  10511.                             k1 += maxStats[l1];
  10512.  
  10513.                 }
  10514.                 if(j1 == 10)
  10515.                 {
  10516.                     RSInterface class9_2 = RSInterface.interfaceCache[ai[l++]];
  10517.                     int l2 = ai[l++] + 1;
  10518.                     if(l2 >= 0 && l2 < ItemDef.totalItems && (!ItemDef.forID(l2).membersObject || isMembers))
  10519.                     {
  10520.                         for(int k3 = 0; k3 < class9_2.inventory.length; k3++)
  10521.                         {
  10522.                             if(class9_2.inventory[k3] != l2)
  10523.                                 continue;
  10524.                             k1 = 0x3b9ac9ff;
  10525.                             break;
  10526.                         }
  10527.  
  10528.                     }
  10529.                 }
  10530.                 if(j1 == 11)
  10531.                     k1 = energy;
  10532.                 if(j1 == 12)
  10533.                     k1 = weight;
  10534.                 if(j1 == 13)
  10535.                 {
  10536.                     int i2 = variousSettings[ai[l++]];
  10537.                     int i3 = ai[l++];
  10538.                     k1 = (i2 & 1 << i3) == 0 ? 0 : 1;
  10539.                 }
  10540.                 if(j1 == 14)
  10541.                 {
  10542.                     int j2 = ai[l++];
  10543.                     VarBit varBit = VarBit.cache[j2];
  10544.                     int l3 = varBit.anInt648;
  10545.                     int i4 = varBit.anInt649;
  10546.                     int j4 = varBit.anInt650;
  10547.                     int k4 = anIntArray1232[j4 - i4];
  10548.                     k1 = variousSettings[l3] >> i4 & k4;
  10549.                 }
  10550.                 if(j1 == 15)
  10551.                     byte0 = 1;
  10552.                 if(j1 == 16)
  10553.                     byte0 = 2;
  10554.                 if(j1 == 17)
  10555.                     byte0 = 3;
  10556.                 if(j1 == 18)
  10557.                     k1 = (myPlayer.x >> 7) + baseX;
  10558.                 if(j1 == 19)
  10559.                     k1 = (myPlayer.y >> 7) + baseY;
  10560.                 if(j1 == 20)
  10561.                     k1 = ai[l++];
  10562.                 if(byte0 == 0)
  10563.                 {
  10564.                     if(i1 == 0)
  10565.                         k += k1;
  10566.                     if(i1 == 1)
  10567.                         k -= k1;
  10568.                     if(i1 == 2 && k1 != 0)
  10569.                         k /= k1;
  10570.                     if(i1 == 3)
  10571.                         k *= k1;
  10572.                     i1 = 0;
  10573.                 } else
  10574.                 {
  10575.                     i1 = byte0;
  10576.                 }
  10577.             } while(true);
  10578.         }
  10579.         catch(Exception _ex)
  10580.         {
  10581.             return -1;
  10582.         }
  10583.     }
  10584.  
  10585.     private void drawTooltip() {
  10586.         String s;
  10587.         if(itemSelected == 1 && menuActionRow < 2)
  10588.             s = "Use " + selectedItemName + " ->";
  10589.         else if(spellSelected == 1 && menuActionRow < 2)
  10590.             s = spellTooltip + " ->";
  10591.         else
  10592.             s = menuActionName[menuActionRow - 1];
  10593.         if(menuActionRow > 2)
  10594.             s = s + "@whi@ / " + (menuActionRow - 2) + " more options";
  10595.         if(s.equals("Cancel"))
  10596.             return;
  10597.         regularFont.method390(4, 0xffffff, s, loopCycle / 1000, 15); //chatTextDrawingArea for bolded, aTextDrawingArea_1271 for non-bolded
  10598.     }
  10599.    
  10600.     private void drawTooltipBox() {
  10601.         if(menuActionRow < 2 && itemSelected == 0 && spellSelected == 0)
  10602.             return;
  10603.         String s;
  10604.         if(itemSelected == 1 && menuActionRow < 2)
  10605.             s = "Use " + selectedItemName + " ->";
  10606.         else if(spellSelected == 1 && menuActionRow < 2)
  10607.             s = spellTooltip + "...";
  10608.         else
  10609.             s = menuActionName[menuActionRow - 1];
  10610.         if(tooltipToggle && !s.contains("Walk here") && !s.equals("Ok") && !s.equals("Select") && !s.equals("Auto Retaliate") && !s.contains("guide") &&
  10611.             !s.contains("Friend") && !s.contains("Name") && !s.contains("Chat") && !s.startsWith("Activate") && !s.contains("View") && !s.contains("Report") &&
  10612.             !s.startsWith("Toggle") && !s.equals("") && !s.equals(" ") && !s.startsWith("Show") && !s.equals("Hide") && !s.equals("Close") && !s.startsWith("Accept") &&
  10613.             !s.startsWith("Decline") && !s.startsWith("Confirm") && !s.startsWith("Cancel") && !s.equals("World Map")) {
  10614.             int Xpos = 0, Ypos = 0;
  10615.             int text = (boldFont.getTextWidth(menuActionName[menuActionRow - 1].replaceAll("@...@", "")))/9;
  10616.             if(super.mouseY + 38 > 501 - 12)
  10617.                 Ypos = super.mouseY + 38 - 501 + 12;
  10618.             if(super.mouseX + 20 + text*10 + 10 > 764 - 13)
  10619.                 Xpos = super.mouseX + 20 + text*10 + 10 - 764 + 13;
  10620.             cacheSprite[31].drawHDSprite(super.mouseX + 20 - Xpos, super.mouseY + 20 - Ypos);
  10621.             cacheSprite[37].drawHDSprite(super.mouseX + 20 - Xpos, super.mouseY + 31 - Ypos);
  10622.             cacheSprite[34].drawHDSprite(super.mouseX + 20 - Xpos, super.mouseY + 38 - Ypos);
  10623.            
  10624.             int size = (boldFont.getTextWidth(menuActionName[menuActionRow - 1].replaceAll("@...@", "")))/9;
  10625.             for(int i=0; i<size; i++) {
  10626.                 cacheSprite[32].drawHDSprite(super.mouseX + 30 + (i*10) - Xpos, super.mouseY + 20 - Ypos);
  10627.                 cacheSprite[35].drawHDSprite(super.mouseX + 30 + (i*10) - Xpos, super.mouseY + 38 - Ypos);
  10628.                 cacheSprite[38].drawHDSprite(super.mouseX + 30 + (i*10) - Xpos, super.mouseY + 31 - Ypos);
  10629.             }
  10630.             cacheSprite[33].drawHDSprite(super.mouseX + 20 + size*10 + 10 - Xpos, super.mouseY + 20 - Ypos);
  10631.             cacheSprite[36].drawHDSprite(super.mouseX + 20 + size*10 + 10 - Xpos, super.mouseY + 38 - Ypos);
  10632.             cacheSprite[39].drawHDSprite(super.mouseX + 20 + size*10 + 10 - Xpos, super.mouseY + 31 - Ypos);
  10633.             boldFont.method390(super.mouseX + 33 - Xpos, 0xffffff, menuActionName[menuActionRow - 1], loopCycle / 1000, super.mouseY + 40 - Ypos);
  10634.         }
  10635.     }
  10636.  
  10637.     private void drawMinimap() {
  10638.         miniMapArea.initDrawingArea();
  10639.         if(miniMapOverlay == 2) {
  10640.             Black[getSpriteID()].drawSprite(0, 0);
  10641.             loadOrbs();
  10642.             return;
  10643.         }
  10644.         int i = minimapInt1 + minimapInt2 & 0x7ff;
  10645.         int j = 48 + myPlayer.x / 32;
  10646.         int l2 = 464 - myPlayer.y / 32;
  10647.        
  10648.         for(int j1 = 0; j1 < minimapClipLeft.length; j1++) {
  10649.             minimapClipLeft[j1] = 172;
  10650.             minimapClipRight[j1] = -22;
  10651.         }
  10652.         minimap.drawRotatedSprite(152, i, minimapClipLeft, 256 + minimapInt3, minimapClipRight, l2, 9, 38, 146, j);
  10653.         compass.drawRotatedSprite(33, minimapInt1, compassClipLeft, 256, compassClipRight, 25, 8, 11, 33, 25);
  10654.  
  10655.         for(int j5 = 0; j5 < anInt1071; j5++) {
  10656.             try {
  10657.                 int k = (anIntArray1072[j5] * 4 + 2) - myPlayer.x / 32;
  10658.                 int i3 = (anIntArray1073[j5] * 4 + 2) - myPlayer.y / 32;
  10659.                 markMinimap(aSpriteArray1140[j5], k, i3, false);
  10660.                 } catch(Exception exception) {
  10661.             }
  10662.         }
  10663.        
  10664.         for(int k5 = 0; k5 < 104; k5++) {
  10665.             for(int l5 = 0; l5 < 104; l5++) {
  10666.                 NodeList class19 = groundArray[plane][k5][l5];
  10667.                 if(class19 != null) {
  10668.                     int l = (k5 * 4 + 2) - myPlayer.x / 32;
  10669.                     int j3 = (l5 * 4 + 2) - myPlayer.y / 32;
  10670.                     markMinimap(mapDotItem, l, j3, false);
  10671.                 }
  10672.             }
  10673.         }
  10674.        
  10675.         for(int i6 = 0; i6 < npcCount; i6++) {
  10676.             Npc npc = npcArray[npcIndices[i6]];
  10677.             if(npc != null && npc.isVisible()) {
  10678.                 NpcDef entityDef = npc.desc;
  10679.                 if(entityDef.childrenIDs != null)
  10680.                     entityDef = entityDef.method161();
  10681.                 if(entityDef != null && entityDef.drawMinimapDot && entityDef.canRightClick) {
  10682.                     int i1 = npc.x / 32 - myPlayer.x / 32;
  10683.                     int k3 = npc.y / 32 - myPlayer.y / 32;
  10684.                     markMinimap(mapDotNPC, i1, k3, false);
  10685.                 }
  10686.             }
  10687.         }
  10688.         for(int j6 = 0; j6 < playerCount; j6++) {
  10689.             Player player = playerArray[playerIndices[j6]];
  10690.             if(player != null && player.isVisible()) {
  10691.                 int j1 = player.x / 32 - myPlayer.x / 32;
  10692.                 int l3 = player.y / 32 - myPlayer.y / 32;
  10693.                 boolean flag1 = false;
  10694.                 boolean flag3 = false;
  10695.                 for(int j3 = 0; j3 < clanList.length; j3++) {
  10696.                     if(clanList[j3] == null)
  10697.                         continue;
  10698.                     if(!clanList[j3].equalsIgnoreCase(player.name))
  10699.                         continue;
  10700.                     flag3 = true;
  10701.                     break;
  10702.                 }
  10703.                 long l6 = TextClass.longForName(player.name);
  10704.                 for(int k6 = 0; k6 < friendsCount; k6++) {
  10705.                     if(l6 != friendsListAsLongs[k6] || friendsNodeIDs[k6] == 0)
  10706.                         continue;
  10707.                     flag1 = true;
  10708.                     break;
  10709.                 }
  10710.                 boolean flag2 = false;
  10711.                 if(myPlayer.team != 0 && player.team != 0 && myPlayer.team == player.team)
  10712.                     flag2 = true;
  10713.                 if(flag1)
  10714.                     markMinimap(mapDotFriend, j1, l3, false);
  10715.                 else if(flag3)
  10716.                     markMinimap(mapDotClan, j1, l3, false);
  10717.                 else if(flag2)
  10718.                     markMinimap(mapDotTeam, j1, l3, false);
  10719.                 else
  10720.                     markMinimap(mapDotPlayer, j1, l3, false);
  10721.             }
  10722.         }
  10723.         if(anInt855 != 0 && loopCycle % 20 < 10) {
  10724.             if(anInt855 == 1 && anInt1222 >= 0 && anInt1222 < npcArray.length) {
  10725.                 Npc class30_sub2_sub4_sub1_sub1_1 = npcArray[anInt1222];
  10726.                 if(class30_sub2_sub4_sub1_sub1_1 != null) {
  10727.                     int k1 = class30_sub2_sub4_sub1_sub1_1.x / 32 - myPlayer.x / 32;
  10728.                     int i4 = class30_sub2_sub4_sub1_sub1_1.y / 32 - myPlayer.y / 32;
  10729.                     method81(mapMarker, i4, k1);
  10730.                 }
  10731.             }
  10732.             if(anInt855 == 2) {
  10733.                 int l1 = ((anInt934 - baseX) * 4 + 2) - myPlayer.x / 32;
  10734.                 int j4 = ((anInt935 - baseY) * 4 + 2) - myPlayer.y / 32;
  10735.                 method81(mapMarker, j4, l1);
  10736.             }
  10737.             if(anInt855 == 10 && anInt933 >= 0 && anInt933 < playerArray.length) {
  10738.                 Player class30_sub2_sub4_sub1_sub2_1 = playerArray[anInt933];
  10739.                 if(class30_sub2_sub4_sub1_sub2_1 != null) {
  10740.                     int i2 = class30_sub2_sub4_sub1_sub2_1.x / 32 - myPlayer.x / 32;
  10741.                     int k4 = class30_sub2_sub4_sub1_sub2_1.y / 32 - myPlayer.y / 32;
  10742.                     method81(mapMarker, k4, i2);
  10743.                 }
  10744.             }
  10745.         }
  10746.         if(destX != 0) {
  10747.             int j2 = (destX * 4 + 2) - myPlayer.x / 32;
  10748.             int l4 = (destY * 4 + 2) - myPlayer.y / 32;
  10749.             markMinimap(mapFlag, j2, l4, false);
  10750.         }
  10751.         CustomMapback[getSpriteID()].drawSprite(0, 0);
  10752.         loadOrbs();
  10753.         DrawingArea.fillRect(108, 84, 3, 3, 0xffffff);
  10754.         if(menuOpen)
  10755.             drawMenu(516, 0);
  10756.         drawDeveloperConsole(showDeveloperConsole, 516, 0);
  10757.         miniMapArea.drawGraphics(516, 0, graphics);
  10758.         mainGameArea.initDrawingArea();
  10759.     }
  10760.  
  10761.     private void npcScreenPos(Mobile entity, int i) {
  10762.         calcEntityScreenPos(entity.x, i, entity.y);
  10763.     }
  10764.  
  10765.     private void calcEntityScreenPos(int i, int j, int l) {
  10766.         if(i < 128 || l < 128 || i > 13056 || l > 13056) {
  10767.             spriteDrawX = -1;
  10768.             spriteDrawY = -1;
  10769.             return;
  10770.         }
  10771.         int i1 = method42(plane, l, i) - j;
  10772.         i -= xCameraPos;
  10773.         i1 -= zCameraPos;
  10774.         l -= yCameraPos;
  10775.         int j1 = Model.modelIntArray1[yCameraCurve];
  10776.         int k1 = Model.modelIntArray2[yCameraCurve];
  10777.         int l1 = Model.modelIntArray1[xCameraCurve];
  10778.         int i2 = Model.modelIntArray2[xCameraCurve];
  10779.         int j2 = l * l1 + i * i2 >> 16;
  10780.         l = l * i2 - i * l1 >> 16;
  10781.         i = j2;
  10782.         j2 = i1 * k1 - l * j1 >> 16;
  10783.         l = i1 * j1 + l * k1 >> 16;
  10784.         i1 = j2;
  10785.         if(l >= 50) {
  10786.             spriteDrawX = Texture.textureInt1 + (i << 9) / l;
  10787.             spriteDrawY = Texture.textureInt2 + (i1 << 9) / l;
  10788.         } else {
  10789.             spriteDrawX = -1;
  10790.             spriteDrawY = -1;
  10791.         }
  10792.     }
  10793.  
  10794.     private void buildSplitPrivateChatMenu()
  10795.     {
  10796.         if(splitPrivateChat == 0)
  10797.             return;
  10798.         int i = 0;
  10799.         if(anInt1104 != 0)
  10800.             i = 1;
  10801.         for(int j = 0; j < 100; j++)
  10802.             if(chatMessages[j] != null)
  10803.             {
  10804.                 int k = chatTypes[j];
  10805.                 String s = chatNames[j];
  10806.                 if(s != null && s.startsWith("@cr1@")) {
  10807.                     s = s.substring(6);
  10808.                 }
  10809.                 if(s != null && s.startsWith("@cr2@")) {
  10810.                     s = s.substring(6);
  10811.                 }
  10812.                 if(s != null && s.startsWith("@cr3@")) {
  10813.                     s = s.substring(6);
  10814.                 }
  10815.                 if(s != null && s.startsWith("@cr0@")) {
  10816.                     s = s.substring(6);
  10817.                 }
  10818.                 if((k == 3 || k == 7) && (k == 7 || privateChatMode == 0 || privateChatMode == 1 && isFriendOrSelf(s)))
  10819.                 {
  10820.                     int l = 329 - i * 13;
  10821.                     if(super.mouseX > 0 && super.mouseY > l - 10 && super.mouseY <= l + 3)
  10822.                     {
  10823.                         int i1 = regularFont.getTextWidth("From:  " + s + chatMessages[j]) + 25;
  10824.                         if(i1 > 450)
  10825.                             i1 = 450;
  10826.                         if(super.mouseX < 4 + i1)
  10827.                         {
  10828.                             menuActionName[menuActionRow] = "Add ignore @whi@" + s;
  10829.                             menuActionID[menuActionRow] = 2042;
  10830.                             menuActionRow++;
  10831.                             menuActionName[menuActionRow] = "Add friend @whi@" + s;
  10832.                             menuActionID[menuActionRow] = 2337;
  10833.                             menuActionRow++;
  10834.                         }
  10835.                     }
  10836.                     if(++i >= 5)
  10837.                         return;
  10838.                 }
  10839.                 if((k == 5 || k == 6) && privateChatMode < 2 && ++i >= 5)
  10840.                     return;
  10841.             }
  10842.  
  10843.     }
  10844.  
  10845.     private void method130(int j, int k, int l, int i1, int j1, int k1,
  10846.                            int l1, int i2, int j2)
  10847.     {
  10848.         Class30_Sub1 class30_sub1 = null;
  10849.         for(Class30_Sub1 class30_sub1_1 = (Class30_Sub1)aClass19_1179.reverseGetFirst(); class30_sub1_1 != null; class30_sub1_1 = (Class30_Sub1)aClass19_1179.reverseGetNext())
  10850.         {
  10851.             if(class30_sub1_1.anInt1295 != l1 || class30_sub1_1.anInt1297 != i2 || class30_sub1_1.anInt1298 != j1 || class30_sub1_1.anInt1296 != i1)
  10852.                 continue;
  10853.             class30_sub1 = class30_sub1_1;
  10854.             break;
  10855.         }
  10856.  
  10857.         if(class30_sub1 == null)
  10858.         {
  10859.             class30_sub1 = new Class30_Sub1();
  10860.             class30_sub1.anInt1295 = l1;
  10861.             class30_sub1.anInt1296 = i1;
  10862.             class30_sub1.anInt1297 = i2;
  10863.             class30_sub1.anInt1298 = j1;
  10864.             method89(class30_sub1);
  10865.             aClass19_1179.insertHead(class30_sub1);
  10866.         }
  10867.         class30_sub1.anInt1291 = k;
  10868.         class30_sub1.anInt1293 = k1;
  10869.         class30_sub1.anInt1292 = l;
  10870.         class30_sub1.anInt1302 = j2;
  10871.         class30_sub1.anInt1294 = j;
  10872.     }
  10873.  
  10874.     private boolean interfaceIsSelected(RSInterface class9)
  10875.     {
  10876.         if(class9.valueCompareType == null)
  10877.             return false;
  10878.         for(int i = 0; i < class9.valueCompareType.length; i++)
  10879.         {
  10880.             int j = extractInterfaceValues(class9, i);
  10881.             int k = class9.requiredValues[i];
  10882.             if(class9.valueCompareType[i] == 2)
  10883.             {
  10884.                 if(j >= k)
  10885.                     return false;
  10886.             } else
  10887.             if(class9.valueCompareType[i] == 3)
  10888.             {
  10889.                 if(j <= k)
  10890.                     return false;
  10891.             } else
  10892.             if(class9.valueCompareType[i] == 4)
  10893.             {
  10894.                 if(j == k)
  10895.                     return false;
  10896.             } else
  10897.             if(j != k)
  10898.                 return false;
  10899.         }
  10900.  
  10901.         return true;
  10902.     }
  10903.  
  10904.     /*private DataInputStream openJagGrabInputStream(String s)
  10905.         throws IOException
  10906.     {
  10907.  //    if(!aBoolean872)
  10908.  //        if(SignLink.mainapp != null)
  10909.  //            return SignLink.openurl(s);
  10910.  //        else
  10911.  //            return new DataInputStream((new URL(getCodeBase(), s)).openStream());
  10912.         if(aSocket832 != null)
  10913.         {
  10914.             try
  10915.             {
  10916.                 aSocket832.close();
  10917.                 System.out.println("Here5");
  10918.             }
  10919.             catch(Exception _ex) { }
  10920.             aSocket832 = null;
  10921.         }
  10922.         aSocket832 = openSocket(43594);//43594
  10923.         aSocket832.setSoTimeout(10000);
  10924.         java.io.InputStream inputstream = aSocket832.getInputStream();
  10925.         OutputStream outputstream = aSocket832.getOutputStream();
  10926.         outputstream.write(("JAGGRAB /" + s + "\n\n").getBytes());
  10927.         return new DataInputStream(inputstream);
  10928.     }*/
  10929.  
  10930.     /*private void doFlamesDrawing()
  10931.     {
  10932.         char c = '\u0100';
  10933.         if(anInt1040 > 0)
  10934.         {
  10935.             for(int i = 0; i < 256; i++)
  10936.                 if(anInt1040 > 768)
  10937.                     anIntArray850[i] = method83(anIntArray851[i], anIntArray852[i], 1024 - anInt1040);
  10938.                 else
  10939.                 if(anInt1040 > 256)
  10940.                     anIntArray850[i] = anIntArray852[i];
  10941.                 else
  10942.                     anIntArray850[i] = method83(anIntArray852[i], anIntArray851[i], 256 - anInt1040);
  10943.  
  10944.         } else
  10945.         if(anInt1041 > 0)
  10946.         {
  10947.             for(int j = 0; j < 256; j++)
  10948.                 if(anInt1041 > 768)
  10949.                     anIntArray850[j] = method83(anIntArray851[j], anIntArray853[j], 1024 - anInt1041);
  10950.                 else
  10951.                 if(anInt1041 > 256)
  10952.                     anIntArray850[j] = anIntArray853[j];
  10953.                 else
  10954.                     anIntArray850[j] = method83(anIntArray853[j], anIntArray851[j], 256 - anInt1041);
  10955.  
  10956.         } else
  10957.         {
  10958.             System.arraycopy(anIntArray851, 0, anIntArray850, 0, 256);
  10959.  
  10960.         }
  10961.         System.arraycopy(aSprite_1201.myPixels, 0, leftSideFlame.anIntArray315, 0, 33920);
  10962.  
  10963.         int i1 = 0;
  10964.         int j1 = 1152;
  10965.         for(int k1 = 1; k1 < c - 1; k1++)
  10966.         {
  10967.             int l1 = (anIntArray969[k1] * (c - k1)) / c;
  10968.             int j2 = 22 + l1;
  10969.             if(j2 < 0)
  10970.                 j2 = 0;
  10971.             i1 += j2;
  10972.             for(int l2 = j2; l2 < 128; l2++)
  10973.             {
  10974.                 int j3 = anIntArray828[i1++];
  10975.                 if(j3 != 0)
  10976.                 {
  10977.                     int l3 = j3;
  10978.                     int j4 = 256 - j3;
  10979.                     j3 = anIntArray850[j3];
  10980.                     int l4 = leftSideFlame.anIntArray315[j1];
  10981.                     leftSideFlame.anIntArray315[j1++] = ((j3 & 0xff00ff) * l3 + (l4 & 0xff00ff) * j4 & 0xff00ff00) + ((j3 & 0xff00) * l3 + (l4 & 0xff00) * j4 & 0xff0000) >> 8;
  10982.                 } else
  10983.                 {
  10984.                     j1++;
  10985.                 }
  10986.             }
  10987.  
  10988.             j1 += j2;
  10989.         }
  10990.  
  10991.         leftSideFlame.drawGraphics(0, super.graphics, 0);
  10992.         System.arraycopy(aSprite_1202.myPixels, 0, rightSideFlame.anIntArray315, 0, 33920);
  10993.  
  10994.         i1 = 0;
  10995.         j1 = 1176;
  10996.         for(int k2 = 1; k2 < c - 1; k2++)
  10997.         {
  10998.             int i3 = (anIntArray969[k2] * (c - k2)) / c;
  10999.             int k3 = 103 - i3;
  11000.             j1 += i3;
  11001.             for(int i4 = 0; i4 < k3; i4++)
  11002.             {
  11003.                 int k4 = anIntArray828[i1++];
  11004.                 if(k4 != 0)
  11005.                 {
  11006.                     int i5 = k4;
  11007.                     int j5 = 256 - k4;
  11008.                     k4 = anIntArray850[k4];
  11009.                     int k5 = rightSideFlame.anIntArray315[j1];
  11010.                     rightSideFlame.anIntArray315[j1++] = ((k4 & 0xff00ff) * i5 + (k5 & 0xff00ff) * j5 & 0xff00ff00) + ((k4 & 0xff00) * i5 + (k5 & 0xff00) * j5 & 0xff0000) >> 8;
  11011.                 } else
  11012.                 {
  11013.                     j1++;
  11014.                 }
  11015.             }
  11016.  
  11017.             i1 += 128 - k3;
  11018.             j1 += 128 - k3 - i3;
  11019.         }
  11020.  
  11021.         rightSideFlame.drawGraphics(0, super.graphics, 637);
  11022.     }*/
  11023.  
  11024.     private void method134(Stream stream)
  11025.     {
  11026.         int j = stream.readBits(8);
  11027.         if(j < playerCount)
  11028.         {
  11029.             for(int k = j; k < playerCount; k++)
  11030.                 anIntArray840[anInt839++] = playerIndices[k];
  11031.  
  11032.         }
  11033.         if(j > playerCount)
  11034.         {
  11035.             SignLink.reporterror(myUsername + " Too many players");
  11036.             throw new RuntimeException("eek");
  11037.         }
  11038.         playerCount = 0;
  11039.         for(int l = 0; l < j; l++)
  11040.         {
  11041.             int i1 = playerIndices[l];
  11042.             Player player = playerArray[i1];
  11043.             int j1 = stream.readBits(1);
  11044.             if(j1 == 0)
  11045.             {
  11046.                 playerIndices[playerCount++] = i1;
  11047.                 player.anInt1537 = loopCycle;
  11048.             } else
  11049.             {
  11050.                 int k1 = stream.readBits(2);
  11051.                 if(k1 == 0)
  11052.                 {
  11053.                     playerIndices[playerCount++] = i1;
  11054.                     player.anInt1537 = loopCycle;
  11055.                     anIntArray894[anInt893++] = i1;
  11056.                 } else
  11057.                 if(k1 == 1)
  11058.                 {
  11059.                     playerIndices[playerCount++] = i1;
  11060.                     player.anInt1537 = loopCycle;
  11061.                     int l1 = stream.readBits(3);
  11062.                     player.moveInDir(false, l1);
  11063.                     int j2 = stream.readBits(1);
  11064.                     if(j2 == 1)
  11065.                         anIntArray894[anInt893++] = i1;
  11066.                 } else
  11067.                 if(k1 == 2)
  11068.                 {
  11069.                     playerIndices[playerCount++] = i1;
  11070.                     player.anInt1537 = loopCycle;
  11071.                     int i2 = stream.readBits(3);
  11072.                     player.moveInDir(true, i2);
  11073.                     int k2 = stream.readBits(3);
  11074.                     player.moveInDir(true, k2);
  11075.                     int l2 = stream.readBits(1);
  11076.                     if(l2 == 1)
  11077.                         anIntArray894[anInt893++] = i1;
  11078.                 } else
  11079.                 if(k1 == 3)
  11080.                     anIntArray840[anInt839++] = i1;
  11081.             }
  11082.         }
  11083.     }
  11084.     void drawFrames() {
  11085.         if(fullScreenOn)
  11086.             return;
  11087.         NamedArchive mediaArchive = streamLoaderForName(4, "2d graphics", "media", expectedCRCs[4], 40);
  11088.         Sprite sprite = new Sprite(mediaArchive, "screenframe", 0);
  11089.         leftFrame = new RSImageProducer(sprite.myWidth, sprite.myHeight, getGameComponent());
  11090.         sprite.method346(0, 0);
  11091.         if (menuOpen) {
  11092.             drawMenu(0, 4);
  11093.         }
  11094.         drawDeveloperConsole(showDeveloperConsole, 0, 4);
  11095.         sprite = new Sprite(mediaArchive, "screenframe", 1);
  11096.         topFrame = new RSImageProducer(516, sprite.myHeight, getGameComponent());
  11097.         sprite.method346(0, 0);
  11098.         if (menuOpen) {
  11099.             drawMenu(0, 0);
  11100.         }
  11101.         drawDeveloperConsole(showDeveloperConsole, 0, 0);
  11102.         topFrame.drawGraphics(0, 0, super.graphics);
  11103.         leftFrame.drawGraphics(0, 4, super.graphics);
  11104.         mainGameArea.initDrawingArea();
  11105.     }
  11106.  
  11107.     String developerConsoleInput = "";
  11108.     private void drawDeveloperConsole(boolean draw, int xOff, int yOff) {
  11109.         if(!draw)
  11110.             return;
  11111.         DrawingArea.fillRect(0-xOff, 0-yOff, clientWidth, 300, 0x2D1D6B, 100);
  11112.         DrawingArea.fillRect(0-xOff, 282-yOff, clientWidth, 1, 0xffffff, 255);
  11113.         boldFont.drawString(true, 10-xOff, 0xffffff, "-->", 295-yOff);
  11114.         boldFont.drawString(true, 37-xOff, 0xffffff, developerConsoleInput, 295-yOff);
  11115.         regularText.drawLeftAlignedString(loopCycle % 40 < 20 ? "|" : "", 36+boldFont.getTextWidth(developerConsoleInput)-xOff, 297-yOff, 0xffffff, -1, false);
  11116.         int yPos = 290 - yOff - 100 * 18;
  11117.         for(int i = 99; i >= 0; i--) {
  11118.             regularText.drawLeftAlignedString(developerConsoleHistory[i], 8-xOff, yPos, 0xffffff, 0, false);
  11119.             yPos += 18;
  11120.         }
  11121.     }
  11122.     private void handleDeveloperConsoleInput(int j) {
  11123.         if(j >= 32 && j <= 122 && developerConsoleInput.length() < 80) {
  11124.             developerConsoleInput += (char)j;
  11125.             inputTaken = true;
  11126.         }
  11127.         if(j == 8 && developerConsoleInput.length() > 0) {
  11128.             developerConsoleInput = developerConsoleInput.substring(0, developerConsoleInput.length() - 1);
  11129.             inputTaken = true;
  11130.         }
  11131.         if((j == 13 || j == 10) && developerConsoleInput.length() > 0) {
  11132.             sendDeveloperConsole("--> " + developerConsoleInput);
  11133.             if(loggedIn) {
  11134.                 stream.createFrame(103);
  11135.                 stream.writeWordBigEndian(developerConsoleInput.length() + 1);
  11136.                 stream.writeString(developerConsoleInput);
  11137.             }
  11138.             developerConsoleInput = "";
  11139.         }
  11140.     }
  11141.     private String[] developerConsoleHistory = new String[100];
  11142.     private void sendDeveloperConsole(String message) {
  11143.         if(message.equalsIgnoreCase("--> cls")) {
  11144.             for(int i = 0; i < developerConsoleHistory.length; i++)
  11145.                 developerConsoleHistory[i] = "";
  11146.         } else {
  11147.             for(int j = 99; j > 0; j--)
  11148.                 developerConsoleHistory[j] = developerConsoleHistory[j - 1];       
  11149.             developerConsoleHistory[0] = getTime() + ": " + message;
  11150.         }
  11151.         if(message.startsWith("-->"))
  11152.             handleDeveloperConsoleCommand(message.substring(4).toLowerCase());
  11153.     }
  11154.     private String getTime() {
  11155.         Calendar cal = Calendar.getInstance();
  11156.         SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
  11157.         return sdf.format(cal.getTime());
  11158.     }
  11159.     private void handleDeveloperConsoleCommand(String cmd) {
  11160.         if(cmd.equals("commands") || cmd.equals("help")) {
  11161.             sendDeveloperConsole("cls - Clear console");
  11162.             sendDeveloperConsole("adminmode - Toggle administrator mode");
  11163.             sendDeveloperConsole("mem - Toggle high and low");
  11164.             sendDeveloperConsole("src - Toggle resizable and fixed screen modes");
  11165.             if(myPrivilege == 3) {
  11166.                 sendDeveloperConsole("noclip - Toggle noclip on and off");
  11167.             }
  11168.         }
  11169.         /*if(cmd.equals("src")) {
  11170.             fullScreenOn = !fullScreenOn;
  11171.             sendDeveloperConsole("Screen mode: " + (fullScreenOn ? "resizable" : "fixed"));
  11172.             if(fullScreenOn)
  11173.                 setFullScreen();
  11174.             else
  11175.                 setFixedScreen();
  11176.         }*/
  11177.         if(cmd.equals("adminmode")) {
  11178.             if(adminMode) {
  11179.                 sendDeveloperConsole("Administator mode off");
  11180.                 clientData = false;
  11181.                 adminMode = false;
  11182.                 idToggle = false;
  11183.             } else {
  11184.                 sendDeveloperConsole("Administator mode on");
  11185.                 clientData = true;
  11186.                 adminMode = true;
  11187.                 idToggle = true;
  11188.             }
  11189.         }
  11190.         if(cmd.equals("mem")) {
  11191.             if(lowMem) {
  11192.                 setHighMem();
  11193.                 sendDeveloperConsole("High memory set");
  11194.             } else {
  11195.                 setLowMem();
  11196.                 sendDeveloperConsole("Low memory set");
  11197.             }
  11198.         }
  11199.         if(myPrivilege == 3) {
  11200.             if(cmd.equals("noclip")) {
  11201.                 isNoclipping = !isNoclipping;
  11202.                 sendDeveloperConsole("Noclip " + (isNoclipping ? "on" : "off"));
  11203.             }
  11204.         }
  11205.     }
  11206.     boolean isNoclipping = false;
  11207.     private void Noclip() {
  11208.         for(int k1 = 0; k1 < 4; k1++) {
  11209.             for(int i2 = 1; i2 < 103; i2++) {
  11210.                 for(int k2 = 1; k2 < 103; k2++) {
  11211.                     aClass11Array1230[k1].anIntArrayArray294[i2][k2] = 0;
  11212.                 }
  11213.             }
  11214.         }
  11215.     }
  11216.  
  11217.     void drawGlowBorderRect(int x, int y, int w, int h, int color, int maxOpacity, int thickness, boolean inset) {
  11218.         for(int i = 0; i < thickness; i++) {
  11219.             DrawingArea.drawRect(x+i, y+i, w-i*2, h-i*2, color, (int)((float)maxOpacity/thickness*(!inset ? i : thickness-i)));
  11220.         }
  11221.     }
  11222.     void drawGlowBorderRect2(int x, int y, int w, int h, int color, int maxOpacity, int thickness, boolean inset) {
  11223.         for(int i = 0; i < thickness; i++) {
  11224.             DrawingArea.drawRect(inset ? x+i : x-i, inset ? y+i : y-i, inset ? w-i*2 : w+i*2, inset ? h-i*2 : h+i*2, color, (int)((float)maxOpacity/thickness*(thickness-i)));
  11225.         }
  11226.     }
  11227.     private void drawLoginBox(int centerX, int centerY) {
  11228.         DrawingArea.fillRect(centerX - 240, centerY - 70, 480, 190, 0xffffff, 25); //outside border
  11229.         DrawingArea.fillRect(centerX - 235, centerY - 65, 470, 180, 0, 75); //block box
  11230.         Sprite shadow = new Sprite(firyze.net.SignLink.findCacheDir() + "images/Gameframe/Login/shadow.png", 498, 302);
  11231.         shadow.drawHDSprite(centerX - 250, centerY - 172);
  11232.         Sprite login = new Sprite(firyze.net.SignLink.findCacheDir() + "images/Gameframe/Login/login.png", 30, 30);
  11233.         login.drawSprite(centerX + 150, centerY, mouseInArea(centerX + 150, centerX + 180, centerY, centerY + 30) ? 70 : 50);
  11234.         DrawingArea.fillRect(centerX - 180, centerY, 160, 30, 0xffffff, mouseInArea(centerX - 180, centerX - 180 + 160, centerY, centerY + 30) ? 70 : 50); //username bg
  11235.         DrawingArea.fillRect(centerX - 15, centerY, 160, 30, 0xffffff, mouseInArea(centerX - 15, centerX - 15 + 160, centerY, centerY + 30) ? 70 : 50); //password bg
  11236.         boldText.drawLeftAlignedString("<trans=100>Username:", centerX - 180, centerY - 10, 0xffffff, -1, true);
  11237.         boldText.drawLeftAlignedString("<trans=100>Password:", centerX - 15, centerY - 10, 0xffffff, -1, true);
  11238.         boldFont.drawString(true, centerX - 172, 0xffffff, capitalize(myUsername) + ((loginScreenCursorPos == 0) & (loopCycle % 40 < 20) ? "@yel@|" : ""), centerY + 20);
  11239.         boldFont.drawString(true, centerX - 7, 0xffffff, TextClass.passwordAsterisks(myPassword) + ((loginScreenCursorPos == 1) & (loopCycle % 40 < 20) ? "@yel@|" : ""), centerY + 20);
  11240.         DrawingArea.fillRect(centerX - 175, centerY + 50, 20, 20, 0xffffff, mouseInArea(centerX - 175, centerX - 45, centerY + 50, centerY + 70) ? 75 : 50); //remember me box bg
  11241.         boldText.drawLeftAlignedString("<trans=100>Remember me?", centerX - 150, centerY + 67, 0xffffff, -1, true);
  11242.         if(rememberMe) {
  11243.             Sprite rememberme = new Sprite(firyze.net.SignLink.findCacheDir() + "images/Gameframe/Login/rememberme.png", 20, 20);
  11244.             rememberme.setTransparency(255, 0, 255);
  11245.             rememberme.drawSprite(centerX - 175, centerY + 50, 100);
  11246.         }
  11247.         if(nameRemembered) {
  11248.             Sprite delete = new Sprite(firyze.net.SignLink.findCacheDir() + "images/Gameframe/Login/delete.png", 24, 25);
  11249.             delete.drawHDSprite(353, 350, mouseInArea(353, 377, 350, 375) ? 150 : 75);
  11250.             if(mouseInArea(353, 377, 350, 375)) {
  11251.                 Sprite pointer = new Sprite(firyze.net.SignLink.findCacheDir() + "images/Gameframe/Login/pointer.png", 47, 17);
  11252.                 pointer.drawHDSprite(318, 337, 100);
  11253.             }      
  11254.         }
  11255.         if(loginMessage1.length() > 0 || loginMessage2.length() > 0) {
  11256.             //DrawingArea.method335(0, 200, 324, 250, 230, 220); //error bg
  11257.             DrawingArea.fillRect(0, 0, clientWidth, clientHeight, 0, 150);
  11258.             Sprite errorfade = new Sprite(firyze.net.SignLink.findCacheDir() + "images/Gameframe/Login/errorfade.png", 300, 300);
  11259.             Sprite error = new Sprite(firyze.net.SignLink.findCacheDir() + "images/Gameframe/Login/error.png", 125, 109);
  11260.             errorfade.drawHDSprite(clientWidth / 2 - errorfade.myWidth / 2, clientHeight / 2 - 150);
  11261.             error.drawSprite(clientWidth / 2 - error.myWidth / 2, clientHeight / 2 - 100);
  11262.             if(loginMessage1.length() > 0) {
  11263.                 boldFont.drawCenteredString(0xffff00, clientWidth / 2, loginMessage1, clientHeight / 2 + 38, true);
  11264.                 boldFont.drawCenteredString(0xffff00, clientWidth / 2, loginMessage2, clientHeight / 2 + 56, true);
  11265.             } else
  11266.                 boldFont.drawCenteredString(0xffff00, clientWidth / 2, loginMessage2, clientHeight / 2 + 45, true);
  11267.         }
  11268.     }
  11269.     int anim = 0, anim2 = 100;
  11270.     private void drawLoginScreen(boolean flag) {
  11271.         int centerX = clientWidth / 2;
  11272.         int centerY = clientHeight / 2;
  11273.         resetImageProducers();
  11274.         if(loopCycle < 15) {
  11275.             background.drawSprite(centerX - background.myWidth / 2, centerY - background.myHeight / 2, loopCycle);
  11276.             loginScreenArea.drawGraphics(0, 0, super.graphics);
  11277.             return;
  11278.         }
  11279.         loginScreenArea.initDrawingArea();
  11280.         background.drawSprite(centerX - background.myWidth / 2, centerY - background.myHeight / 2);
  11281.         if(loginScreenState == 0) {
  11282.             Sprite play = new Sprite(firyze.net.SignLink.findCacheDir() + "images/Gameframe/Login/continue.png", 120, 120);
  11283.             play.drawHDSprite(325, 255, anim);
  11284.             if(mouseInArea(325, 445, 255, 375) && anim < 200 || anim < 100)
  11285.                 anim += 10;
  11286.             else if(!mouseInArea(325, 445, 255, 375) && anim > 100)
  11287.                 anim -= 10;
  11288.             logo.drawHDSprite(clientWidth / 2 - 160, clientHeight / 2 - 165, 40);
  11289.         }
  11290.         if(loginScreenState == 1) {
  11291.             Sprite play = new Sprite(firyze.net.SignLink.findCacheDir() + "images/Gameframe/Login/continue.png", 120, 120);
  11292.             play.drawHDSprite(325, 255, anim);
  11293.             if(anim > 0)
  11294.                 anim -= 10;
  11295.             else
  11296.                 loginScreenState = 2;
  11297.             logo.drawHDSprite(clientWidth / 2 - 160, clientHeight / 2 - 165, 40);
  11298.         }
  11299.         if(loginScreenState == 2) {
  11300.             drawLoginBox(centerX, centerY);
  11301.             if(anim2 > 0) {
  11302.                 background.drawSprite(centerX - background.myWidth / 2, centerY - background.myHeight / 2, (int)(2.55*anim2));
  11303.                 logo.drawHDSprite(clientWidth / 2 - 160, clientHeight / 2 - 165, (int)(.4*anim2));
  11304.                 anim2 -= 7;
  11305.             }
  11306.         }
  11307.         //logo.drawRGBAImage(centerX - logo.myWidth / 2 - 9, centerY - logo.myHeight - 74, 35);
  11308.         drawDeveloperConsole(showDeveloperConsole, 0, 0);
  11309.         loginScreenArea.drawGraphics(0, 0, super.graphics);
  11310.         if(welcomeScreenRaised) {
  11311.             welcomeScreenRaised = false;
  11312.             /*aRSImageProducer_1107.drawGraphics(128, 0, super.graphics);
  11313.             aRSImageProducer_1108.drawGraphics(202, 371, super.graphics);
  11314.             gameLogo.drawGraphics(0, 265, super.graphics);
  11315.             aRSImageProducer_1113.drawGraphics(562, 265, super.graphics);
  11316.             aRSImageProducer_1114.drawGraphics(128, 171, super.graphics);
  11317.             aRSImageProducer_1115.drawGraphics(562, 171, super.graphics);*/
  11318.         }
  11319.     }
  11320.  
  11321.     /*private void drawFlames()
  11322.     {
  11323.         try
  11324.         {
  11325.             long l = System.currentTimeMillis();
  11326.             int i = 0;
  11327.             int j = 20;
  11328.             while(aBoolean831)
  11329.             {
  11330.                 doFlamesDrawing();
  11331.                 if(++i > 10)
  11332.                 {
  11333.                     long l1 = System.currentTimeMillis();
  11334.                     int k = (int)(l1 - l) / 10 - j;
  11335.                     j = 40 - k;
  11336.                     if(j < 5)
  11337.                         j = 5;
  11338.                     i = 0;
  11339.                     l = l1;
  11340.                 }
  11341.                 try
  11342.                 {
  11343.                     Thread.sleep(j);
  11344.                 }
  11345.                 catch(Exception _ex) { }
  11346.             }
  11347.         } catch(Exception _ex) { }
  11348.             drawingFlames = false;
  11349.         }
  11350.     }*/
  11351.  
  11352.     public void raiseWelcomeScreen()
  11353.     {
  11354.         welcomeScreenRaised = true;
  11355.     }
  11356.  
  11357.     private void method137(Stream stream, int j)
  11358.     {
  11359.         if(j == 84)
  11360.         {
  11361.             int k = stream.readUnsignedByte();
  11362.             int j3 = anInt1268 + (k >> 4 & 7);
  11363.             int i6 = anInt1269 + (k & 7);
  11364.             int l8 = stream.readUnsignedWord();
  11365.             int k11 = stream.readUnsignedWord();
  11366.             int l13 = stream.readUnsignedWord();
  11367.             if(j3 >= 0 && i6 >= 0 && j3 < 104 && i6 < 104)
  11368.             {
  11369.                 NodeList class19_1 = groundArray[plane][j3][i6];
  11370.                 if(class19_1 != null)
  11371.                 {
  11372.                     for(Item class30_sub2_sub4_sub2_3 = (Item)class19_1.reverseGetFirst(); class30_sub2_sub4_sub2_3 != null; class30_sub2_sub4_sub2_3 = (Item)class19_1.reverseGetNext())
  11373.                     {
  11374.                         if(class30_sub2_sub4_sub2_3.ID != (l8 & 0x7fff) || class30_sub2_sub4_sub2_3.anInt1559 != k11)
  11375.                             continue;
  11376.                         class30_sub2_sub4_sub2_3.anInt1559 = l13;
  11377.                         break;
  11378.                     }
  11379.  
  11380.                     spawnGroundItem(j3, i6);
  11381.                 }
  11382.             }
  11383.             return;
  11384.         }
  11385.         if(j == 105)
  11386.         {
  11387.             int l = stream.readUnsignedByte();
  11388.             int k3 = anInt1268 + (l >> 4 & 7);
  11389.             int j6 = anInt1269 + (l & 7);
  11390.             int i9 = stream.readUnsignedWord();
  11391.             int l11 = stream.readUnsignedByte();
  11392.             int i14 = l11 >> 4 & 0xf;
  11393.             int i16 = l11 & 7;
  11394.             if(myPlayer.smallX[0] >= k3 - i14 && myPlayer.smallX[0] <= k3 + i14 && myPlayer.smallY[0] >= j6 - i14 && myPlayer.smallY[0] <= j6 + i14 && soundEffectsEnabled && !lowMem && anInt1062 < 50)
  11395.             {
  11396.                 anIntArray1207[anInt1062] = i9;
  11397.                 anIntArray1241[anInt1062] = i16;
  11398.                 anIntArray1250[anInt1062] = Sounds.anIntArray326[i9];
  11399.                 anInt1062++;
  11400.             }
  11401.         }
  11402.         if(j == 215)
  11403.         {
  11404.             int i1 = stream.method435();
  11405.             int l3 = stream.method428();
  11406.             int k6 = anInt1268 + (l3 >> 4 & 7);
  11407.             int j9 = anInt1269 + (l3 & 7);
  11408.             int i12 = stream.method435();
  11409.             int j14 = stream.readUnsignedWord();
  11410.             if(k6 >= 0 && j9 >= 0 && k6 < 104 && j9 < 104 && i12 != unknownInt10)
  11411.             {
  11412.                 Item class30_sub2_sub4_sub2_2 = new Item();
  11413.                 class30_sub2_sub4_sub2_2.ID = i1;
  11414.                 class30_sub2_sub4_sub2_2.anInt1559 = j14;
  11415.                 if(groundArray[plane][k6][j9] == null)
  11416.                     groundArray[plane][k6][j9] = new NodeList();
  11417.                 groundArray[plane][k6][j9].insertHead(class30_sub2_sub4_sub2_2);
  11418.                 spawnGroundItem(k6, j9);
  11419.             }
  11420.             return;
  11421.         }
  11422.         if(j == 156)
  11423.         {
  11424.             int j1 = stream.method426();
  11425.             int i4 = anInt1268 + (j1 >> 4 & 7);
  11426.             int l6 = anInt1269 + (j1 & 7);
  11427.             int k9 = stream.readUnsignedWord();
  11428.             if(i4 >= 0 && l6 >= 0 && i4 < 104 && l6 < 104)
  11429.             {
  11430.                 NodeList class19 = groundArray[plane][i4][l6];
  11431.                 if(class19 != null)
  11432.                 {
  11433.                     for(Item item = (Item)class19.reverseGetFirst(); item != null; item = (Item)class19.reverseGetNext())
  11434.                     {
  11435.                         if(item.ID != (k9 & 0x7fff))
  11436.                             continue;
  11437.                         item.unlink();
  11438.                         break;
  11439.                     }
  11440.  
  11441.                     if(class19.reverseGetFirst() == null)
  11442.                         groundArray[plane][i4][l6] = null;
  11443.                     spawnGroundItem(i4, l6);
  11444.                 }
  11445.             }
  11446.             return;
  11447.         }
  11448.         if(j == 160)
  11449.         {
  11450.             int k1 = stream.method428();
  11451.             int j4 = anInt1268 + (k1 >> 4 & 7);
  11452.             int i7 = anInt1269 + (k1 & 7);
  11453.             int l9 = stream.method428();
  11454.             int j12 = l9 >> 2;
  11455.             int k14 = l9 & 3;
  11456.             int j16 = anIntArray1177[j12];
  11457.             int j17 = stream.method435();
  11458.             if(j4 >= 0 && i7 >= 0 && j4 < 103 && i7 < 103)
  11459.             {
  11460.                 int j18 = intGroundArray[plane][j4][i7];
  11461.                 int i19 = intGroundArray[plane][j4 + 1][i7];
  11462.                 int l19 = intGroundArray[plane][j4 + 1][i7 + 1];
  11463.                 int k20 = intGroundArray[plane][j4][i7 + 1];
  11464.                 if(j16 == 0)
  11465.                 {
  11466.                     Object1 class10 = sceneGraph.method296(plane, j4, i7);
  11467.                     if(class10 != null)
  11468.                     {
  11469.                         int k21 = class10.uid >> 14 & 0x7fff;
  11470.                         if(j12 == 2)
  11471.                         {
  11472.                             class10.aClass30_Sub2_Sub4_278 = new ObjectOnTile(k21, 4 + k14, 2, i19, l19, j18, k20, j17, false);
  11473.                             class10.aClass30_Sub2_Sub4_279 = new ObjectOnTile(k21, k14 + 1 & 3, 2, i19, l19, j18, k20, j17, false);
  11474.                         } else
  11475.                         {
  11476.                             class10.aClass30_Sub2_Sub4_278 = new ObjectOnTile(k21, k14, j12, i19, l19, j18, k20, j17, false);
  11477.                         }
  11478.                     }
  11479.                 }
  11480.                 if(j16 == 1)
  11481.                 {
  11482.                     Object2 class26 = sceneGraph.method297(j4, i7, plane);
  11483.                     if(class26 != null)
  11484.                         class26.aClass30_Sub2_Sub4_504 = new ObjectOnTile(class26.uid >> 14 & 0x7fff, 0, 4, i19, l19, j18, k20, j17, false);
  11485.                 }
  11486.                 if(j16 == 2)
  11487.                 {
  11488.                     Object5 class28 = sceneGraph.method298(j4, i7, plane);
  11489.                     if(j12 == 11)
  11490.                         j12 = 10;
  11491.                     if(class28 != null)
  11492.                         class28.aClass30_Sub2_Sub4_521 = new ObjectOnTile(class28.uid >> 14 & 0x7fff, k14, j12, i19, l19, j18, k20, j17, false);
  11493.                 }
  11494.                 if(j16 == 3)
  11495.                 {
  11496.                     Object3 class49 = sceneGraph.method299(i7, j4, plane);
  11497.                     if(class49 != null)
  11498.                         class49.aClass30_Sub2_Sub4_814 = new ObjectOnTile(class49.uid >> 14 & 0x7fff, k14, 22, i19, l19, j18, k20, j17, false);
  11499.                 }
  11500.             }
  11501.             return;
  11502.         }
  11503.         if(j == 147)
  11504.         {
  11505.             int l1 = stream.method428();
  11506.             int k4 = anInt1268 + (l1 >> 4 & 7);
  11507.             int j7 = anInt1269 + (l1 & 7);
  11508.             int i10 = stream.readUnsignedWord();
  11509.             byte byte0 = stream.method430();
  11510.             int l14 = stream.method434();
  11511.             byte byte1 = stream.method429();
  11512.             int k17 = stream.readUnsignedWord();
  11513.             int k18 = stream.method428();
  11514.             int j19 = k18 >> 2;
  11515.             int i20 = k18 & 3;
  11516.             int l20 = anIntArray1177[j19];
  11517.             byte byte2 = stream.readSignedByte();
  11518.             int l21 = stream.readUnsignedWord();
  11519.             byte byte3 = stream.method429();
  11520.             Player player;
  11521.             if(i10 == unknownInt10)
  11522.                 player = myPlayer;
  11523.             else
  11524.                 player = playerArray[i10];
  11525.             if(player != null)
  11526.             {
  11527.                 ObjectDef class46 = ObjectDef.forID(l21);
  11528.                 int i22 = intGroundArray[plane][k4][j7];
  11529.                 int j22 = intGroundArray[plane][k4 + 1][j7];
  11530.                 int k22 = intGroundArray[plane][k4 + 1][j7 + 1];
  11531.                 int l22 = intGroundArray[plane][k4][j7 + 1];
  11532.                 Model model = class46.method578(j19, i20, i22, j22, k22, l22, -1);
  11533.                 if(model != null)
  11534.                 {
  11535.                     method130(k17 + 1, -1, 0, l20, j7, 0, plane, k4, l14 + 1);
  11536.                     player.anInt1707 = l14 + loopCycle;
  11537.                     player.anInt1708 = k17 + loopCycle;
  11538.                     player.aModel_1714 = model;
  11539.                     int i23 = class46.sizeX;
  11540.                     int j23 = class46.sizeY;
  11541.                     if(i20 == 1 || i20 == 3)
  11542.                     {
  11543.                         i23 = class46.sizeY;
  11544.                         j23 = class46.sizeX;
  11545.                     }
  11546.                     player.anInt1711 = k4 * 128 + i23 * 64;
  11547.                     player.anInt1713 = j7 * 128 + j23 * 64;
  11548.                     player.anInt1712 = method42(plane, player.anInt1713, player.anInt1711);
  11549.                     if(byte2 > byte0)
  11550.                     {
  11551.                         byte byte4 = byte2;
  11552.                         byte2 = byte0;
  11553.                         byte0 = byte4;
  11554.                     }
  11555.                     if(byte3 > byte1)
  11556.                     {
  11557.                         byte byte5 = byte3;
  11558.                         byte3 = byte1;
  11559.                         byte1 = byte5;
  11560.                     }
  11561.                     player.anInt1719 = k4 + byte2;
  11562.                     player.anInt1721 = k4 + byte0;
  11563.                     player.anInt1720 = j7 + byte3;
  11564.                     player.anInt1722 = j7 + byte1;
  11565.                 }
  11566.             }
  11567.         }
  11568.         if(j == 151)
  11569.         {
  11570.             int i2 = stream.method426();
  11571.             int l4 = anInt1268 + (i2 >> 4 & 7);
  11572.             int k7 = anInt1269 + (i2 & 7);
  11573.             int j10 = stream.method434();
  11574.             int k12 = stream.method428();
  11575.             int i15 = k12 >> 2;
  11576.             int k16 = k12 & 3;
  11577.             int l17 = anIntArray1177[i15];
  11578.             if(l4 >= 0 && k7 >= 0 && l4 < 104 && k7 < 104)
  11579.                 method130(-1, j10, k16, l17, k7, i15, plane, l4, 0);
  11580.             return;
  11581.         }
  11582.         if(j == 4)
  11583.         {
  11584.             int j2 = stream.readUnsignedByte();
  11585.             int i5 = anInt1268 + (j2 >> 4 & 7);
  11586.             int l7 = anInt1269 + (j2 & 7);
  11587.             int k10 = stream.readUnsignedWord();
  11588.             int l12 = stream.readUnsignedByte();
  11589.             int j15 = stream.readUnsignedWord();
  11590.             if(i5 >= 0 && l7 >= 0 && i5 < 104 && l7 < 104)
  11591.             {
  11592.                 i5 = i5 * 128 + 64;
  11593.                 l7 = l7 * 128 + 64;
  11594.                 StillGraphic class30_sub2_sub4_sub3 = new StillGraphic(plane, loopCycle, j15, k10, method42(plane, l7, i5) - l12, l7, i5);
  11595.                 aClass19_1056.insertHead(class30_sub2_sub4_sub3);
  11596.             }
  11597.             return;
  11598.         }
  11599.         if(j == 44)
  11600.         {
  11601.             int k2 = stream.method436();
  11602.             int j5 = stream.readUnsignedWord();
  11603.             int i8 = stream.readUnsignedByte();
  11604.             int l10 = anInt1268 + (i8 >> 4 & 7);
  11605.             int i13 = anInt1269 + (i8 & 7);
  11606.             if(l10 >= 0 && i13 >= 0 && l10 < 104 && i13 < 104)
  11607.             {
  11608.                 Item class30_sub2_sub4_sub2_1 = new Item();
  11609.                 class30_sub2_sub4_sub2_1.ID = k2;
  11610.                 class30_sub2_sub4_sub2_1.anInt1559 = j5;
  11611.                 if(groundArray[plane][l10][i13] == null)
  11612.                     groundArray[plane][l10][i13] = new NodeList();
  11613.                 groundArray[plane][l10][i13].insertHead(class30_sub2_sub4_sub2_1);
  11614.                 spawnGroundItem(l10, i13);
  11615.             }
  11616.             return;
  11617.         }
  11618.         if(j == 101)
  11619.         {
  11620.             int l2 = stream.method427();
  11621.             int k5 = l2 >> 2;
  11622.             int j8 = l2 & 3;
  11623.             int i11 = anIntArray1177[k5];
  11624.             int j13 = stream.readUnsignedByte();
  11625.             int k15 = anInt1268 + (j13 >> 4 & 7);
  11626.             int l16 = anInt1269 + (j13 & 7);
  11627.             if(k15 >= 0 && l16 >= 0 && k15 < 104 && l16 < 104)
  11628.                 method130(-1, -1, j8, i11, l16, k5, plane, k15, 0);
  11629.             return;
  11630.         }
  11631.         if(j == 117)
  11632.         {
  11633.             int i3 = stream.readUnsignedByte();
  11634.             int l5 = anInt1268 + (i3 >> 4 & 7);
  11635.             int k8 = anInt1269 + (i3 & 7);
  11636.             int j11 = l5 + stream.readSignedByte();
  11637.             int k13 = k8 + stream.readSignedByte();
  11638.             int l15 = stream.readSignedWord();
  11639.             int i17 = stream.readUnsignedWord();
  11640.             int i18 = stream.readUnsignedByte() * 4;
  11641.             int l18 = stream.readUnsignedByte() * 4;
  11642.             int k19 = stream.readUnsignedWord();
  11643.             int j20 = stream.readUnsignedWord();
  11644.             int i21 = stream.readUnsignedByte();
  11645.             int j21 = stream.readUnsignedByte();
  11646.             if(l5 >= 0 && k8 >= 0 && l5 < 104 && k8 < 104 && j11 >= 0 && k13 >= 0 && j11 < 104 && k13 < 104 && i17 != 65535)
  11647.             {
  11648.                 l5 = l5 * 128 + 64;
  11649.                 k8 = k8 * 128 + 64;
  11650.                 j11 = j11 * 128 + 64;
  11651.                 k13 = k13 * 128 + 64;
  11652.                 Projectile class30_sub2_sub4_sub4 = new Projectile(i21, l18, k19 + loopCycle, j20 + loopCycle, j21, plane, method42(plane, k8, l5) - i18, k8, l5, l15, i17);
  11653.                 class30_sub2_sub4_sub4.method455(k19 + loopCycle, k13, method42(plane, k13, j11) - l18, j11);
  11654.                 aClass19_1013.insertHead(class30_sub2_sub4_sub4);
  11655.             }
  11656.         }
  11657.     }
  11658.  
  11659.     private static void setLowMem()
  11660.     {
  11661.         WorldController.lowMem = true;
  11662.         Texture.lowMem = true;
  11663.         lowMem = true;
  11664.         ObjectManager.lowMem = false;
  11665.         ObjectDef.lowMem = true;
  11666.     }
  11667.    
  11668.     private static void setHighMem() {
  11669.         WorldController.lowMem = false;
  11670.         Texture.lowMem = false;
  11671.         lowMem = false;
  11672.         ObjectManager.lowMem = false;
  11673.         ObjectDef.lowMem = false;
  11674.     }
  11675.  
  11676.     private void method139(Stream stream)
  11677.     {
  11678.         stream.initBitAccess();
  11679.         int k = stream.readBits(8);
  11680.         if(k < npcCount)
  11681.         {
  11682.             for(int l = k; l < npcCount; l++)
  11683.                 anIntArray840[anInt839++] = npcIndices[l];
  11684.  
  11685.         }
  11686.         if(k > npcCount)
  11687.         {
  11688.             SignLink.reporterror(myUsername + " Too many npcs");
  11689.             throw new RuntimeException("eek");
  11690.         }
  11691.         npcCount = 0;
  11692.         for(int i1 = 0; i1 < k; i1++)
  11693.         {
  11694.             int j1 = npcIndices[i1];
  11695.             Npc npc = npcArray[j1];
  11696.             int k1 = stream.readBits(1);
  11697.             if(k1 == 0)
  11698.             {
  11699.                 npcIndices[npcCount++] = j1;
  11700.                 npc.anInt1537 = loopCycle;
  11701.             } else
  11702.             {
  11703.                 int l1 = stream.readBits(2);
  11704.                 if(l1 == 0)
  11705.                 {
  11706.                     npcIndices[npcCount++] = j1;
  11707.                     npc.anInt1537 = loopCycle;
  11708.                     anIntArray894[anInt893++] = j1;
  11709.                 } else
  11710.                 if(l1 == 1)
  11711.                 {
  11712.                     npcIndices[npcCount++] = j1;
  11713.                     npc.anInt1537 = loopCycle;
  11714.                     int i2 = stream.readBits(3);
  11715.                     npc.moveInDir(false, i2);
  11716.                     int k2 = stream.readBits(1);
  11717.                     if(k2 == 1)
  11718.                         anIntArray894[anInt893++] = j1;
  11719.                 } else
  11720.                 if(l1 == 2)
  11721.                 {
  11722.                     npcIndices[npcCount++] = j1;
  11723.                     npc.anInt1537 = loopCycle;
  11724.                     int j2 = stream.readBits(3);
  11725.                     npc.moveInDir(true, j2);
  11726.                     int l2 = stream.readBits(3);
  11727.                     npc.moveInDir(true, l2);
  11728.                     int i3 = stream.readBits(1);
  11729.                     if(i3 == 1)
  11730.                         anIntArray894[anInt893++] = j1;
  11731.                 } else
  11732.                 if(l1 == 3)
  11733.                     anIntArray840[anInt839++] = j1;
  11734.             }
  11735.         }
  11736.  
  11737.     }
  11738.  
  11739.     private void processLoginScreenInput() {
  11740.         if(showDeveloperConsole) {
  11741.             int j = readChar(-796);
  11742.             if(j != -1)
  11743.                 handleDeveloperConsoleInput(j);
  11744.         }
  11745.         int centerX = clientWidth / 2;
  11746.         int centerY = clientHeight / 2;
  11747.             if(loginScreenState == 0) {
  11748.                 if(mouseLeftClickInArea(325, 445, 255, 375)) {
  11749.                     loginScreenState = 1;
  11750.                     loginScreenCursorPos = 0;
  11751.                 }
  11752.             } else {
  11753.                 if(loginScreenState == 2) {
  11754.                     if((loginMessage1.length() > 0 || loginMessage2.length() > 0) && super.clickMode3 == 1) {
  11755.                         loginMessage1 = "";
  11756.                         loginMessage2 = "";
  11757.                         return;
  11758.                     }
  11759.                     if(mouseLeftClickInArea(centerX - 175, centerX - 45, centerY + 50, centerY + 70))
  11760.                         rememberMe = !rememberMe;
  11761.                     if(mouseLeftClickInArea(353, 377, 350, 375)) {
  11762.                         try { deleteLoginData(); } catch (Exception e) { }
  11763.                     }
  11764.                     if(mouseLeftClickInArea(centerX - 180, centerX - 20, centerY, centerY + 30))
  11765.                         loginScreenCursorPos = 0;
  11766.                     if(mouseLeftClickInArea(centerX - 15, centerX + 145, centerY, centerY + 30))
  11767.                         loginScreenCursorPos = 1;
  11768.                     if(mouseLeftClickInArea(centerX + 150, centerX + 180, centerY, centerY + 30)) {
  11769.                         loginFailures = 0;
  11770.                         login(capitalize(myUsername), myPassword, false);
  11771.                         if(loggedIn)
  11772.                             return;
  11773.                     }
  11774.                     if(showDeveloperConsole) {
  11775.                         drawDeveloperConsole(true, 0, 0);
  11776.                         return;
  11777.                     }
  11778.                     do {
  11779.                         int l1 = readChar(-796);
  11780.                         if(l1 == -1)
  11781.                             break;
  11782.                         boolean flag1 = false;
  11783.                         for(int i2 = 0; i2 < validUserPassChars.length(); i2++) {
  11784.                             if(l1 != validUserPassChars.charAt(i2))
  11785.                                 continue;
  11786.                             flag1 = true;
  11787.                             break;
  11788.                         }
  11789.                         if(loginScreenCursorPos == 0) {
  11790.                             if(l1 == 8 && myUsername.length() > 0)
  11791.                                 myUsername = myUsername.substring(0, myUsername.length() - 1);
  11792.                             if(l1 == 9 || l1 == 10 || l1 == 13)
  11793.                                 loginScreenCursorPos = 1;
  11794.                             if(flag1)
  11795.                                 myUsername += (char)l1;
  11796.                             if(myUsername.length() > 12)
  11797.                                 myUsername = capitalize(myUsername.substring(0, 12));
  11798.                         } else if(loginScreenCursorPos == 1) {
  11799.                             if(l1 == 8 && myPassword.length() > 0)
  11800.                                 myPassword = myPassword.substring(0, myPassword.length() - 1);
  11801.                             if(l1 == 9 || l1 == 10 || l1 == 13) {
  11802.                                 if(myUsername.length() == 0 || myPassword.length() == 0)
  11803.                                     loginScreenCursorPos = 0;
  11804.                                 else
  11805.                                     login(myUsername, myPassword, false);
  11806.                             }
  11807.                             if(flag1)
  11808.                                 myPassword += (char)l1;
  11809.                             if(myPassword.length() > 20)
  11810.                                 myPassword = myPassword.substring(0, 20);
  11811.                         }
  11812.                     } while(true);
  11813.                     return;
  11814.                 }
  11815.                 if(loginScreenState == 3) {
  11816.                     int k = super.clientWidth / 2;
  11817.                     int j1 = super.clientHeight / 2 + 50;
  11818.                     j1 += 20;
  11819.                     if(super.clickMode3 == 1 && super.saveClickX >= k - 75 && super.saveClickX <= k + 75 && super.saveClickY >= j1 - 20 && super.saveClickY <= j1 + 20)
  11820.                         loginScreenState = 0;
  11821.                 }
  11822.             }
  11823.     }
  11824.  
  11825.     private void markMinimap(Sprite sprite, int i, int j, boolean flag) {
  11826.         int k = minimapInt1 + minimapInt2 & 0x7ff;
  11827.         int l = i * i + j * j;
  11828.         if(flag)
  11829.             return;
  11830.         if(l > 6400)
  11831.             return;
  11832.         int i1 = Model.modelIntArray1[k];
  11833.         int j1 = Model.modelIntArray2[k];
  11834.         i1 = (i1 * 256) / (minimapInt3 + 256);
  11835.         j1 = (j1 * 256) / (minimapInt3 + 256);
  11836.         int k1 = j * i1 + i * j1 >> 16;
  11837.         int l1 = j * j1 - i * i1 >> 16;
  11838.         if(!fullScreenOn) {
  11839.             sprite.drawSprite(((106 + k1) - sprite.maxWidth / 2) + 4 , 89 - l1 - sprite.maxHeight / 2 - 4);
  11840.         }
  11841.         CustomMapback[getSpriteID()].drawSprite(0, 0);
  11842.     }
  11843.    
  11844.     public boolean mouseInArea(int xMin, int xMax, int yMin, int yMax) {
  11845.         return super.mouseX >= xMin && super.mouseX <= xMax && super.mouseY >= yMin && super.mouseY <= yMax;
  11846.     }
  11847.     public boolean mouseLeftClickInArea(int xMin, int xMax, int yMin, int yMax) {
  11848.         return super.clickMode3 == 1 && super.saveClickX >= xMin && super.saveClickX <= xMax && super.saveClickY >= yMin && super.saveClickY <= yMax;
  11849.     }
  11850.  
  11851.     public int flagPos = 72;
  11852.     public int runState = 1;
  11853.     public boolean logHover = false;
  11854.     public boolean xpHover = false;
  11855.     public boolean xpClicked = false;
  11856.     public boolean drawXpBar = false;
  11857.     public boolean drawFlag = false;
  11858.     public int xpToDraw = 0;
  11859.     public Sprite[] globe = new Sprite[5];
  11860.    
  11861.     public static boolean globeState[] = {
  11862.         false, false
  11863.     };
  11864.     public void drawXpOrb() {
  11865.     if(super.mouseX >= 516 && super.mouseX <= 550 && super.mouseY >= 46 && super.mouseY <= 80){
  11866.         xpHover = true;
  11867.     } else {
  11868.         xpHover = false;
  11869.     }
  11870.     if(super.clickMode3 == 1 && super.saveClickX >= 516 && super.saveClickX <= 550 && super.saveClickY >= 46 && super.saveClickY <= 80) {
  11871.         if(!xpClicked) {
  11872.             xpClicked = true;
  11873.             drawXpBar = true;
  11874.         } else {
  11875.             xpClicked = false;
  11876.             drawXpBar = false;
  11877.         }
  11878.     }
  11879.         if(!xpHover) {
  11880.             cacheSprite[26].drawSprite(0, 46);
  11881.         } else {
  11882.             cacheSprite[25].drawSprite(0, 46);
  11883.         }
  11884.     }
  11885.     public void drawGlobe(){
  11886.         if(!fullScreenOn) {
  11887.             if(super.clickMode3 == 1){
  11888.                 if(super.saveClickX >= 522 && super.saveClickX <= 558 && super.saveClickY >= 124 && super.saveClickY < 161){
  11889.                     if(globeState[0]){
  11890.                             globeState[0] = false;
  11891.                         } else {
  11892.                             globeState[0] = true;
  11893.                         }
  11894.                 }
  11895.             }
  11896.             if(super.mouseX >= 522 && super.mouseX <= 558 && super.mouseY >= 124 && super.mouseY < 161){
  11897.                     globeState[1] = true;
  11898.                 } else {
  11899.                     globeState[1] = false;
  11900.             }
  11901.         }
  11902.     }
  11903.    
  11904.     public void drawLogout(){
  11905.         if(!fullScreenOn) {
  11906.             if(!logHover){
  11907.                 cacheSprite[27].drawSprite(226, 1);
  11908.             } else {
  11909.                 cacheSprite[28].drawSprite(226, 1);
  11910.             }
  11911.             if(super.clickMode2 == 1 && super.mouseX >= 765-24 && super.mouseX <= 765 && super.mouseY >= 1 && super.mouseY <= 25){
  11912.                 cacheSprite[29].drawSprite(226, 1);
  11913.             }
  11914.         }
  11915.     }
  11916.  
  11917.     public void loadOrbs() {
  11918.         drawLogout();
  11919.         drawHP();
  11920.         drawXpOrb();
  11921.         drawPrayer();
  11922.         drawRunOrb();
  11923.         drawSummo();
  11924.         if(!fullScreenOn) {
  11925.             drawGlobe();
  11926.             if(globeState[0] && globeState[1]) {
  11927.                 cacheSprite[44].drawSprite(10, 123);
  11928.             } else if(globeState[1]) {
  11929.                 cacheSprite[44].drawSprite(10, 123);
  11930.             } else if(globeState[0]) {
  11931.                 cacheSprite[43].drawSprite(10, 123);
  11932.             } else {
  11933.                 cacheSprite[43].drawSprite(10, 123);
  11934.             }
  11935.         }
  11936.     }
  11937.     public Sprite[] Black = new Sprite[5];
  11938.    
  11939.     public void loadExtraSprites(){
  11940.         magicAuto = new Sprite("Misc/magicAuto");
  11941.         for(int j3 = 0; j3 <= 26; j3++) {
  11942.             LOGIN[j3] = new Sprite("Login/Buttons/BUTTON "+j3+"");
  11943.         }
  11944.         for(int i = 0; i < globe.length; i++) {
  11945.             globe[i] = new Sprite("Gameframe/Globes/Globe "+i+"");
  11946.         }
  11947.         for(int i = 0; i <= 4; i++){
  11948.             chatBack[i] = new Sprite("Gameframe/Gameframes/chatArea "+i+"");
  11949.         }
  11950.         for(int i = 0; i <= 4; i++){
  11951.             tabBack[i] = new Sprite("Gameframe/Gameframes/tabArea "+i+"");
  11952.         }
  11953.         for(int i = 0; i <= 4; i++){
  11954.             CustomMapback[i] = new Sprite("Gameframe/Gameframes/Mapback "+i+"");
  11955.         }
  11956.         for(int i = 0; i <= 6; i++){
  11957.             modIcons[i] = new Sprite("Player/MODICONS "+i+"");
  11958.             chatImages[i] = new Sprite("Player/MODICONS "+i+"");
  11959.         }
  11960.         for(int i = 0; i <= 3; i++) {
  11961.             combatIcons[i] = new Sprite("Player/combatIcon "+i+"");
  11962.         }
  11963.         for(int i = 0; i <= 4; i++){
  11964.             Black[i] = new Sprite("Gameframe/Gameframes/Black "+i+"");
  11965.         }
  11966.         for(int i4 = 0; i4 < 3; i4++) {
  11967.             hitMark[i4] = new Sprite("Player/Hits "+i4+"");
  11968.         }
  11969.         qc = new Sprite("Gameframe/Quickchat");
  11970.     }
  11971.  
  11972.     public boolean restOrb = false;
  11973.     public boolean musicOrb = false;
  11974.     public boolean prayClicked = false;
  11975.     public boolean prayHover = false;
  11976.     public boolean runClicked = true;
  11977.     public boolean runHover = false;
  11978.     private int[] anIntArray1019;
  11979.  
  11980.     private void rightClickChatButtons() {
  11981.         if(!fullScreenOn) {
  11982.             if(super.mouseX >= 5 && super.mouseX <= 61 && super.mouseY >= 482 && super.mouseY <= 503) {
  11983.                 menuActionName[1] = "View all";
  11984.                 menuActionID[1] = 999;
  11985.                 menuActionRow = 2;
  11986.             } else if(super.mouseX >= 62 && super.mouseX <= 117 && super.mouseY >= 482 && super.mouseY <= 503) {
  11987.                 menuActionName[1] = "View game";
  11988.                 menuActionID[1] = 998;
  11989.                 menuActionRow = 2;
  11990.             } else if(super.mouseX >= 119 && super.mouseX <= 174 && super.mouseY >= 482 && super.mouseY <= 503) {
  11991.                 menuActionName[1] = "Hide public";
  11992.                 menuActionID[1] = 997;
  11993.                 menuActionName[2] = "Off public";
  11994.                 menuActionID[2] = 996;
  11995.                 menuActionName[3] = "Friends public";
  11996.                 menuActionID[3] = 995;
  11997.                 menuActionName[4] = "On public";
  11998.                 menuActionID[4] = 994;
  11999.                 menuActionName[5] = "View public";
  12000.                 menuActionID[5] = 993;
  12001.                 menuActionRow = 6;
  12002.             } else if(super.mouseX >= 176 && super.mouseX <= 231 && super.mouseY >= 482 && super.mouseY <= 503) {
  12003.                 menuActionName[1] = "Off private";
  12004.                 menuActionID[1] = 992;
  12005.                 menuActionName[2] = "Friends private";
  12006.                 menuActionID[2] = 991;
  12007.                 menuActionName[3] = "On private";
  12008.                 menuActionID[3] = 990;
  12009.                 menuActionName[4] = "View private";
  12010.                 menuActionID[4] = 989;
  12011.                 menuActionRow = 5;
  12012.             } else if(super.mouseX >= 233 && super.mouseX <= 288 && super.mouseY >= 482 && super.mouseY <= 503) {
  12013.                 menuActionName[1] = "Off clan chat";
  12014.                 menuActionID[1] = 1003;
  12015.                 menuActionName[2] = "Friends clan chat";
  12016.                 menuActionID[2] = 1002;
  12017.                 menuActionName[3] = "On clan chat";
  12018.                 menuActionID[3] = 1001;
  12019.                 menuActionName[4] = "View clan chat";
  12020.                 menuActionID[4] = 1000;
  12021.                 menuActionRow = 5;
  12022.             } else if(super.mouseX >= 290 && super.mouseX <= 345 && super.mouseY >= 482 && super.mouseY <= 503) {
  12023.                 menuActionName[1] = "Off trade";
  12024.                 menuActionID[1] = 987;
  12025.                 menuActionName[2] = "Friends trade";
  12026.                 menuActionID[2] = 986;
  12027.                 menuActionName[3] = "On trade";
  12028.                 menuActionID[3] = 985;
  12029.                 menuActionName[4] = "View trade";
  12030.                 menuActionID[4] = 984;
  12031.                 menuActionRow = 5;
  12032.             } else if(super.mouseX >= 347 && super.mouseX <= 402 && super.mouseY >= 482 && super.mouseY <= 503) {
  12033.                 menuActionName[1] = "Off yell";
  12034.                 menuActionID[1] = 1423;
  12035.                 menuActionName[2] = "Friends yell";
  12036.                 menuActionID[2] = 1422;
  12037.                 menuActionName[3] = "On yell";
  12038.                 menuActionID[3] = 1421;
  12039.                 menuActionName[4] = "View yell";
  12040.                 menuActionID[4] = 1420;
  12041.                 menuActionRow = 5;
  12042.             } else if(super.mouseX >= 404 && super.mouseX <= 514 && super.mouseY >= 480 && super.mouseY <= 501) {
  12043.                 menuActionName[1] = "Report abuse";
  12044.                 menuActionID[1] = 606;
  12045.                 menuActionRow = 2;
  12046.             }
  12047.         }
  12048.     }
  12049.    
  12050.     public void determineBottomTabs() {
  12051.           if ((this.mouseX >= 521) && (this.mouseX <= 550) && (this.mouseY >= 169) && (this.mouseY < 205)) {
  12052.               this.tabHPos = 0;
  12053.               needDrawTabArea = true;
  12054.               tabAreaAltered = true;
  12055.             } else if ((this.mouseX >= 552) && (this.mouseX <= 581) && (this.mouseY >= 168) && (this.mouseY < 205)) {
  12056.               this.tabHPos = 1;
  12057.               needDrawTabArea = true;
  12058.               tabAreaAltered = true;
  12059.             } else if ((this.mouseX >= 582) && (this.mouseX <= 611) && (this.mouseY >= 168) && (this.mouseY < 205)) {
  12060.               this.tabHPos = 2;
  12061.               needDrawTabArea = true;
  12062.               tabAreaAltered = true;
  12063.             } else if ((this.mouseX >= 612) && (this.mouseX <= 641) && (this.mouseY >= 168) && (this.mouseY < 203)) {
  12064.               this.tabHPos = 3;
  12065.               needDrawTabArea = true;
  12066.               tabAreaAltered = true;
  12067.             } else if ((this.mouseX >= 642) && (this.mouseX <= 671) && (this.mouseY >= 168) && (this.mouseY < 205)) {
  12068.               this.tabHPos = 4;
  12069.               needDrawTabArea = true;
  12070.               tabAreaAltered = true;
  12071.             } else if ((this.mouseX >= 672) && (this.mouseX <= 701) && (this.mouseY >= 168) && (this.mouseY < 205)) {
  12072.               this.tabHPos = 5;
  12073.               needDrawTabArea = true;
  12074.               tabAreaAltered = true;
  12075.             } else if ((this.mouseX >= 702) && (this.mouseX <= 731) && (this.mouseY >= 169) && (this.mouseY < 205)) {
  12076.               this.tabHPos = 6;
  12077.               needDrawTabArea = true;
  12078.               tabAreaAltered = true;
  12079.             } else if ((this.mouseX >= 732) && (this.mouseX <= 761) && (this.mouseY >= 169) && (this.mouseY < 205)) {
  12080.               this.tabHPos = 7;
  12081.               needDrawTabArea = true;
  12082.               tabAreaAltered = true;
  12083.             } else if ((this.mouseX >= 522) && (this.mouseX <= 551) && (this.mouseY >= 466) && (this.mouseY < 503)) {
  12084.               this.tabHPos = 15;
  12085.               needDrawTabArea = true;
  12086.               tabAreaAltered = true;
  12087.             } else if ((this.mouseX >= 552) && (this.mouseX <= 581) && (this.mouseY >= 466) && (this.mouseY < 503)) {
  12088.               this.tabHPos = 8;
  12089.               needDrawTabArea = true;
  12090.               tabAreaAltered = true;
  12091.             } else if ((this.mouseX >= 582) && (this.mouseX <= 611) && (this.mouseY >= 466) && (this.mouseY < 503)) {
  12092.               this.tabHPos = 9;
  12093.               needDrawTabArea = true;
  12094.               tabAreaAltered = true;
  12095.             } else if ((this.mouseX >= 612) && (this.mouseX <= 641) && (this.mouseY >= 466) && (this.mouseY < 503)) {
  12096.               this.tabHPos = 10;
  12097.               needDrawTabArea = true;
  12098.               tabAreaAltered = true;
  12099.             } else if ((this.mouseX >= 642) && (this.mouseX <= 671) && (this.mouseY >= 466) && (this.mouseY < 503)) {
  12100.               this.tabHPos = 11;
  12101.               needDrawTabArea = true;
  12102.               tabAreaAltered = true;
  12103.             } else if ((this.mouseX >= 672) && (this.mouseX <= 701) && (this.mouseY >= 466) && (this.mouseY < 503)) {
  12104.               this.tabHPos = 12;
  12105.               needDrawTabArea = true;
  12106.               tabAreaAltered = true;
  12107.             } else if ((this.mouseX >= 702) && (this.mouseX <= 731) && (this.mouseY >= 466) && (this.mouseY < 502)) {
  12108.               this.tabHPos = 13;
  12109.               needDrawTabArea = true;
  12110.               tabAreaAltered = true;
  12111.             } else if ((this.mouseX >= 732) && (this.mouseX <= 761) && (this.mouseY >= 466) && (this.mouseY < 502)) {
  12112.               this.tabHPos = 14;
  12113.               needDrawTabArea = true;
  12114.               tabAreaAltered = true;
  12115.             } else {
  12116.               this.tabHPos = -1;
  12117.               needDrawTabArea = true;
  12118.               tabAreaAltered = true;
  12119.             }
  12120.             if (this.clickMode3 == 1) {
  12121.               if ((this.saveClickX >= 522) && (this.saveClickX <= 551) && (this.saveClickY >= 169) && (this.saveClickY < 205) && (tabInterfaceIDs[0] != -1)) {
  12122.                 needDrawTabArea = true;
  12123.                 tabID = 0;
  12124.                 tabAreaAltered = true;
  12125.               } else if ((this.saveClickX >= 552) && (this.saveClickX <= 581) && (this.saveClickY >= 168) && (this.saveClickY < 205) && (tabInterfaceIDs[1] != -1)) {
  12126.                 needDrawTabArea = true;
  12127.                 tabID = 1;
  12128.                 tabAreaAltered = true;
  12129.               } else if ((this.saveClickX >= 582) && (this.saveClickX <= 611) && (this.saveClickY >= 168) && (this.saveClickY < 205) && (tabInterfaceIDs[2] != -1)) {
  12130.                 needDrawTabArea = true;
  12131.                 tabID = 2;
  12132.                 tabAreaAltered = true;
  12133.               } else if ((this.saveClickX >= 612) && (this.saveClickX <= 641) && (this.saveClickY >= 168) && (this.saveClickY < 203) && (tabInterfaceIDs[14] != -1)) {
  12134.                 needDrawTabArea = true;
  12135.                 tabID = 14;
  12136.                 tabAreaAltered = true;
  12137.               } else if ((this.saveClickX >= 642) && (this.saveClickX <= 671) && (this.saveClickY >= 168) && (this.saveClickY < 205) && (tabInterfaceIDs[3] != -1)) {
  12138.                 needDrawTabArea = true;
  12139.                 tabID = 3;
  12140.                 tabAreaAltered = true;
  12141.               } else if ((this.saveClickX >= 672) && (this.saveClickX <= 701) && (this.saveClickY >= 168) && (this.saveClickY < 205) && (tabInterfaceIDs[4] != -1)) {
  12142.                 needDrawTabArea = true;
  12143.                 tabID = 4;
  12144.                 tabAreaAltered = true;
  12145.               } else if ((this.saveClickX >= 702) && (this.saveClickX <= 731) && (this.saveClickY >= 169) && (this.saveClickY < 205) && (tabInterfaceIDs[5] != -1)) {
  12146.                 needDrawTabArea = true;
  12147.                 tabID = 5;
  12148.                 tabAreaAltered = true;
  12149.               } else if ((this.saveClickX >= 732) && (this.saveClickX <= 761) && (this.saveClickY >= 169) && (this.saveClickY < 205) && (tabInterfaceIDs[6] != -1)) {
  12150.                 needDrawTabArea = true;
  12151.                 tabID = 6;
  12152.                 tabAreaAltered = true;
  12153.               } else if ((this.saveClickX >= 522) && (this.saveClickX <= 551) && (this.saveClickY >= 466) && (this.saveClickY < 503) && (tabInterfaceIDs[16] != -1)) {
  12154.                 needDrawTabArea = true;
  12155.                 tabID = 16;
  12156.                 tabAreaAltered = true;
  12157.               } else if ((this.saveClickX >= 552) && (this.saveClickX <= 581) && (this.saveClickY >= 466) && (this.saveClickY < 503) && (tabInterfaceIDs[8] != -1)) {
  12158.                 needDrawTabArea = true;
  12159.                 tabID = 8;
  12160.                 tabAreaAltered = true;
  12161.               } else if ((this.saveClickX >= 582) && (this.saveClickX <= 611) && (this.saveClickY >= 466) && (this.saveClickY < 503) && (tabInterfaceIDs[9] != -1)) {
  12162.                 needDrawTabArea = true;
  12163.                 tabID = 9;
  12164.                 tabAreaAltered = true;
  12165.               } else if ((this.saveClickX >= 612) && (this.saveClickX <= 641) && (this.saveClickY >= 466) && (this.saveClickY < 503) && (tabInterfaceIDs[7] != -1)) {
  12166.                 needDrawTabArea = true;
  12167.                 tabID = 7;
  12168.                 tabAreaAltered = true;
  12169.               } else if ((this.saveClickX >= 642) && (this.saveClickX <= 671) && (this.saveClickY >= 466) && (this.saveClickY < 503) && (tabInterfaceIDs[11] != -1)) {
  12170.                 needDrawTabArea = true;
  12171.                 tabID = 11;
  12172.                 tabAreaAltered = true;
  12173.               } else if ((this.saveClickX >= 672) && (this.saveClickX <= 701) && (this.saveClickY >= 466) && (this.saveClickY < 503) && (tabInterfaceIDs[12] != -1)) {
  12174.                 needDrawTabArea = true;
  12175.                 tabID = 12;
  12176.                 tabAreaAltered = true;
  12177.               } else if ((this.saveClickX >= 702) && (this.saveClickX <= 731) && (this.saveClickY >= 466) && (this.saveClickY < 502) && (tabInterfaceIDs[13] != -1)) {
  12178.                 needDrawTabArea = true;
  12179.                 tabID = 13;
  12180.                 tabAreaAltered = true;
  12181.               } else if ((this.saveClickX >= 732) && (this.saveClickX <= 761) && (this.saveClickY >= 466) && (this.saveClickY < 502) && (tabInterfaceIDs[15] != -1)) {
  12182.                 needDrawTabArea = true;
  12183.                 tabID = 15;
  12184.                 tabAreaAltered = true;
  12185.               }
  12186.             }
  12187.     }
  12188. private void processMinimapActions()
  12189. {
  12190.   if ((openInterfaceID == 19148) && (mouseLeftClickInArea(185, 343, 34, 313))) {
  12191.     if (this.rollingCharacter)
  12192.       this.rollingCharacter = false;
  12193.     else {
  12194.       this.rollingCharacter = true;
  12195.     }
  12196.   }
  12197.  
  12198.   if ((this.mouseX >= 531) && (this.mouseX <= 557) && (this.mouseY >= 7) && (this.mouseY <= 40)) {
  12199.     this.menuActionName[1] = "Face North";
  12200.     this.menuActionID[1] = 1014;
  12201.     this.menuActionRow = 2;
  12202.   }
  12203.  
  12204.   if ((this.myPrivilege >= 1) && (this.myPrivilege <= 3) && (this.StaffTabInUse) && (openInterfaceID == -1)) {
  12205.     if (mouseInArea(484, 515, 0, 35)) {
  12206.       this.menuActionName[1] = "Toggle staff options";
  12207.       this.menuActionID[1] = 1900;
  12208.       this.menuActionRow = 2;
  12209.     }
  12210.     if ((mouseInArea(363, 477, 9, 30)) && (this.staffTabOpen)) {
  12211.       this.menuActionName[1] = "Enter name";
  12212.       this.menuActionID[1] = 1901;
  12213.       this.menuActionRow = 2;
  12214.     }
  12215.     if ((mouseInArea(430, 490, 182, 213)) && (this.StaffTabSelected != -1)) {
  12216.       this.menuActionName[1] = "Send action";
  12217.       this.menuActionID[1] = 1912;
  12218.       this.menuActionRow = 2;
  12219.     }
  12220.     if ((!this.showedName.equals("Error!")) && (!this.showedName.equals(""))) {
  12221.       if (mouseInArea(355, 418, 54, 71)) {
  12222.         this.menuActionName[1] = "Select";
  12223.         this.menuActionID[1] = 1902;
  12224.         this.menuActionRow = 2;
  12225.       } else if (mouseInArea(355, 418, 77, 94)) {
  12226.         this.menuActionName[1] = "Select";
  12227.         this.menuActionID[1] = 1903;
  12228.         this.menuActionRow = 2;
  12229.       } else if (mouseInArea(355, 418, 100, 117)) {
  12230.         this.menuActionName[1] = "Select";
  12231.         this.menuActionID[1] = 1904;
  12232.         this.menuActionRow = 2;
  12233.       } else if (mouseInArea(355, 418, 123, 140)) {
  12234.         this.menuActionName[1] = "Select";
  12235.         this.menuActionID[1] = 1905;
  12236.         this.menuActionRow = 2;
  12237.       } else if (mouseInArea(355, 418, 146, 163)) {
  12238.         this.menuActionName[1] = "Select";
  12239.         this.menuActionID[1] = 1906;
  12240.         this.menuActionRow = 2;
  12241.       } else if (mouseInArea(421, 496, 54, 71)) {
  12242.         this.menuActionName[1] = "Select";
  12243.         this.menuActionID[1] = 1907;
  12244.         this.menuActionRow = 2;
  12245.       } else if (mouseInArea(421, 496, 77, 94)) {
  12246.         this.menuActionName[1] = "Select";
  12247.         this.menuActionID[1] = 1908;
  12248.         this.menuActionRow = 2;
  12249.       } else if (mouseInArea(421, 496, 100, 117)) {
  12250.         this.menuActionName[1] = "Select";
  12251.         this.menuActionID[1] = 1909;
  12252.         this.menuActionRow = 2;
  12253.       } else if (mouseInArea(421, 496, 123, 140)) {
  12254.         this.menuActionName[1] = "Select";
  12255.         this.menuActionID[1] = 1910;
  12256.         this.menuActionRow = 2;
  12257.       } else if (mouseInArea(421, 496, 146, 163)) {
  12258.         this.menuActionName[1] = "Select";
  12259.         this.menuActionID[1] = 1911;
  12260.         this.menuActionRow = 2;
  12261.       }
  12262.  
  12263.     }
  12264.  
  12265.   }
  12266.  
  12267.   if ((this.is508) || (this.is525) || (this.is562)) {
  12268.     if ((this.mouseX >= 527) && (this.mouseX <= 560) && (this.mouseY >= 126) && (this.mouseY <= 159)) {
  12269.       this.menuActionName[1] = "World Map";
  12270.       this.menuActionID[1] = 1005;
  12271.       this.menuActionRow = 2;
  12272.     }
  12273.     if ((this.mouseX >= 706) && (this.mouseX <= 762) && (this.mouseY >= 95) && (this.mouseY < 128)) {
  12274.       if (!this.runClicked)
  12275.         this.menuActionName[2] = "Turn run mode on";
  12276.       else if (this.runClicked) {
  12277.         this.menuActionName[2] = "Turn run mode off";
  12278.       }
  12279.       this.menuActionID[2] = 1050;
  12280.       this.menuActionRow = 2;
  12281.       this.menuActionName[1] = "Rest";
  12282.       this.menuActionID[1] = 1501;
  12283.       this.menuActionRow = 3;
  12284.     }
  12285.     if ((this.mouseX >= 516) && (this.mouseX <= 550) && (this.mouseY >= 46) && (this.mouseY < 80)) {
  12286.       if (!this.drawXpBar)
  12287.         this.menuActionName[2] = "Show XP counter";
  12288.       else
  12289.         this.menuActionName[2] = "Hide XP counter";
  12290.       this.menuActionID[2] = 1503;
  12291.       this.menuActionRow = 2;
  12292.       this.menuActionName[1] = "Reset";
  12293.       this.menuActionID[1] = 1504;
  12294.       this.menuActionRow = 3;
  12295.     }
  12296.     if ((this.mouseX >= 706) && (this.mouseX <= 762) && (this.mouseY >= 52) && (this.mouseY < 87)) {
  12297.       if (!this.prayClicked)
  12298.         this.menuActionName[1] = "Turn quick prayers on";
  12299.       else if (this.prayClicked) {
  12300.         this.menuActionName[1] = "Turn quick prayers off";
  12301.       }
  12302.       this.menuActionID[1] = 1500;
  12303.       this.menuActionRow = 2;
  12304.     }
  12305.   }
  12306. }
  12307.  
  12308. public int getOrbTextColor(int statusInt) {
  12309.   if ((statusInt >= 75) && (statusInt <= 100))
  12310.     return 65280;
  12311.   if ((statusInt >= 50) && (statusInt <= 74))
  12312.     return 16776960;
  12313.   if ((statusInt >= 25) && (statusInt <= 49)) {
  12314.     return 16750623;
  12315.   }
  12316.   return 16711680;
  12317. }
  12318.  
  12319. public int getOrbFill(int statusInt) {
  12320.     return (100 - statusInt) * 27 / 100;
  12321. }
  12322.  
  12323. public void drawHP()
  12324. {
  12325.   String cHP = RSInterface.interfaceCache[4016].disabledMessage; cHP = cHP.replaceAll("%", "");
  12326.   int currentHP = Integer.parseInt(cHP);
  12327.   String mHP = RSInterface.interfaceCache[4017].disabledMessage; mHP = mHP.replaceAll("%", "");
  12328.   int maxHP2 = Integer.parseInt(mHP);
  12329.   int health = (int)(currentHP / maxHP2 * 100.0D);
  12330.   cacheSprite[4].drawSprite(174, 14);
  12331.   cacheSprite[9 + myPlayer.isPoisoned].drawSprite(177, 17);
  12332.   if (health != 100) {
  12333.       DrawingArea.setClip(117, 17, 144, 17 + getOrbFill(health));
  12334.       cacheSprite[8].drawSprite(177, 17);
  12335.       DrawingArea.removeClip();
  12336.   }
  12337.   if (health > 20 || loopCycle % 20 < 10) {
  12338.       cacheSprite[16].drawSprite(183, 25);
  12339.   }
  12340.   smallText.drawCenterAlignedString(""+currentHP, 215, 40, getOrbTextColor(health), 0, false);
  12341. }
  12342.  
  12343. public void drawPrayer()
  12344. {
  12345.   String cPR = RSInterface.interfaceCache[4012].disabledMessage;
  12346.   int currentPR = Integer.parseInt(cPR);
  12347.   String mPR = RSInterface.interfaceCache[4013].disabledMessage;
  12348.   int maxPR2 = Integer.parseInt(mPR);
  12349.   int prayer = (int)(currentPR / maxPR2 * 100.0D);
  12350.   cacheSprite[prayHover ? 5 : 4].drawSprite(190, 53);
  12351.   cacheSprite[prayClicked ? 12 : 11].drawSprite(193, 56);
  12352.   if (prayer != 100) {
  12353.       DrawingArea.setClip(194, 56, 221, 56 + getOrbFill(prayer));
  12354.       cacheSprite[8].drawSprite(194, 56);
  12355.       DrawingArea.removeClip();
  12356.   }
  12357.  
  12358.   if (prayer == 0 || prayer > 25 || loopCycle % 20 < 10) {
  12359.       cacheSprite[17].drawSprite(197, 60);
  12360.   }
  12361.   smallText.drawCenterAlignedString(RSInterface.interfaceCache[4012].disabledMessage, 231, 79, getOrbTextColor(prayer), 0, false);
  12362. }
  12363.  
  12364. public void drawRunOrb()
  12365. {
  12366.   if (energy < 1) {
  12367.     runClicked = false;
  12368.   }
  12369.   cacheSprite[runHover ? 5 : 4].drawSprite(190, 92);
  12370.   cacheSprite[runClicked ? 14 : 13].drawSprite(193, 95);
  12371.   if (energy != 100) {
  12372.       DrawingArea.setClip(194, 95, 221, 95 + getOrbFill(energy));
  12373.       cacheSprite[8].drawSprite(194, 95);
  12374.       DrawingArea.removeClip();
  12375.   }
  12376.   cacheSprite[restOrb ? 20 : runClicked ? 19 : 18].drawSprite(199, 99);
  12377.   smallText.drawCenterAlignedString(""+energy, 231, 117, getOrbTextColor(energy), 0, false);
  12378.   if (restOrb) {
  12379.     cacheSprite[24].drawHDSprite(175, 75, restOpacity);
  12380.   }
  12381. }
  12382.  
  12383. public void drawSummo() {
  12384.   String cSummo = RSInterface.interfaceCache[29802].disabledMessage; cSummo = cSummo.replaceAll("%", "");
  12385.   int currentSummo = Integer.parseInt(cSummo);
  12386.   String mSummo = RSInterface.interfaceCache[29803].disabledMessage; mSummo = mSummo.replaceAll("%", "");
  12387.   int maxSummo = Integer.parseInt(mSummo);
  12388.   int summo = (int)(currentSummo / maxSummo * 100.0D);
  12389.   cacheSprite[4].drawSprite(174, 128);
  12390.   cacheSprite[15].drawSprite(177, 131);
  12391.   if (summo != 100) {
  12392.       DrawingArea.setClip(177, 131, 205, 131 + getOrbFill(summo));
  12393.       cacheSprite[8].drawSprite(177, 131);
  12394.       DrawingArea.removeClip();
  12395.   }
  12396.   cacheSprite[22].drawSprite(183, 137);
  12397.   smallText.drawCenterAlignedString(""+currentSummo, 215, 154, getOrbTextColor(summo), 0, false);
  12398. }
  12399.  
  12400. private void method142(int i, int j, int k, int l, int i1, int j1, int k1)
  12401. {
  12402.   if ((i1 >= 1) && (i >= 1) && (i1 <= 102) && (i <= 102))
  12403.   {
  12404.     if ((lowMem) && (j != this.plane))
  12405.       return;
  12406.     int i2 = 0;
  12407.     if (j1 == 0)
  12408.       i2 = this.sceneGraph.getWallObjectUID(j, i1, i);
  12409.     if (j1 == 1)
  12410.       i2 = this.sceneGraph.method301(j, i1, i);
  12411.     if (j1 == 2)
  12412.       i2 = this.sceneGraph.getInteractableObjectUID(j, i1, i);
  12413.     if (j1 == 3)
  12414.       i2 = this.sceneGraph.getGroundDecorationUID(j, i1, i);
  12415.     if (i2 != 0)
  12416.     {
  12417.       int i3 = this.sceneGraph.getIDTAGForXYZ(j, i1, i, i2);
  12418.       int j2 = i2 >> 14 & 0x7FFF;
  12419.       int k2 = i3 & 0x1F;
  12420.       int l2 = i3 >> 6;
  12421.       if (j1 == 0)
  12422.       {
  12423.         this.sceneGraph.method291(i1, j, i, (byte)-119);
  12424.         ObjectDef class46 = ObjectDef.forID(j2);
  12425.         if (class46.aBoolean767)
  12426.           this.aClass11Array1230[j].method215(l2, k2, class46.aBoolean757, i1, i);
  12427.       }
  12428.       if (j1 == 1)
  12429.         this.sceneGraph.method292(i, j, i1);
  12430.       if (j1 == 2)
  12431.       {
  12432.         this.sceneGraph.method293(j, i1, i);
  12433.         ObjectDef class46_1 = ObjectDef.forID(j2);
  12434.         if ((i1 + class46_1.sizeX > 103) || (i + class46_1.sizeX > 103) || (i1 + class46_1.sizeY > 103) || (i + class46_1.sizeY > 103))
  12435.           return;
  12436.         if (class46_1.aBoolean767)
  12437.           this.aClass11Array1230[j].method216(l2, class46_1.sizeX, i1, i, class46_1.sizeY, class46_1.aBoolean757);
  12438.       }
  12439.       if (j1 == 3)
  12440.       {
  12441.         this.sceneGraph.method294(j, i, i1);
  12442.         ObjectDef class46_2 = ObjectDef.forID(j2);
  12443.         if ((class46_2.aBoolean767) && (class46_2.hasActions))
  12444.           this.aClass11Array1230[j].method218(i, i1);
  12445.       }
  12446.     }
  12447.     if (k1 >= 0)
  12448.     {
  12449.       int j3 = j;
  12450.       if ((j3 < 3) && ((this.byteGroundArray[1][i1][i] & 0x2) == 2))
  12451.         j3++;
  12452.       ObjectManager.method188(this.sceneGraph, k, i, l, j3, this.aClass11Array1230[j], this.intGroundArray, i1, k1, j);
  12453.     }
  12454.   }
  12455. }
  12456.  
  12457. private void updatePlayers(int i, Stream stream)
  12458. {
  12459.   this.anInt839 = 0;
  12460.   this.anInt893 = 0;
  12461.   method117(stream);
  12462.   method134(stream);
  12463.   method91(stream, i);
  12464.   method49(stream);
  12465.   for (int k = 0; k < this.anInt839; k++)
  12466.   {
  12467.     int l = this.anIntArray840[k];
  12468.     if (this.playerArray[l].anInt1537 != loopCycle) {
  12469.       this.playerArray[l] = null;
  12470.     }
  12471.   }
  12472.   if (stream.currentOffset != i)
  12473.   {
  12474.     SignLink.reporterror("Error packet size mismatch in getplayer pos:" + stream.currentOffset + " psize:" + i);
  12475.     throw new RuntimeException("eek");
  12476.   }
  12477.   for (int i1 = 0; i1 < this.playerCount; i1++)
  12478.     if (this.playerArray[this.playerIndices[i1]] == null)
  12479.     {
  12480.       SignLink.reporterror(myUsername + " null entry in pl list - pos:" + i1 + " size:" + this.playerCount);
  12481.       throw new RuntimeException("eek");
  12482.     }
  12483. }
  12484.  
  12485. private void setCameraPos(int j, int k, int l, int i1, int j1, int k1)
  12486. {
  12487.   int l1 = 2048 - k & 0x7FF;
  12488.   int i2 = 2048 - j1 & 0x7FF;
  12489.   int j2 = 0;
  12490.   int k2 = 0;
  12491.   int l2 = j;
  12492.   if (l1 != 0)
  12493.   {
  12494.     int i3 = Model.modelIntArray1[l1];
  12495.     int k3 = Model.modelIntArray2[l1];
  12496.     int i4 = k2 * k3 - l2 * i3 >> 16;
  12497.     l2 = k2 * i3 + l2 * k3 >> 16;
  12498.     k2 = i4;
  12499.   }
  12500.   if (i2 != 0)
  12501.   {
  12502.     int j3 = Model.modelIntArray1[i2];
  12503.     int l3 = Model.modelIntArray2[i2];
  12504.     int j4 = l2 * j3 + j2 * l3 >> 16;
  12505.     l2 = l2 * l3 - j2 * j3 >> 16;
  12506.     j2 = j4;
  12507.   }
  12508.   this.xCameraPos = (l - j2);
  12509.   this.zCameraPos = (i1 - k2);
  12510.   this.yCameraPos = (k1 - l2);
  12511.   this.yCameraCurve = k;
  12512.   this.xCameraCurve = j1;
  12513. }
  12514.  
  12515. public void updateStrings(String str, int i) {
  12516.   switch (i) { case 1675:
  12517.     sendFrame126(str, 17508); break;
  12518.   case 1676:
  12519.     sendFrame126(str, 17509); break;
  12520.   case 1677:
  12521.     sendFrame126(str, 17510); break;
  12522.   case 1678:
  12523.     sendFrame126(str, 17511); break;
  12524.   case 1679:
  12525.     sendFrame126(str, 17512); break;
  12526.   case 1680:
  12527.     sendFrame126(str, 17513); break;
  12528.   case 1681:
  12529.     sendFrame126(str, 17514); break;
  12530.   case 1682:
  12531.     sendFrame126(str, 17515); break;
  12532.   case 1683:
  12533.     sendFrame126(str, 17516); break;
  12534.   case 1684:
  12535.     sendFrame126(str, 17517); break;
  12536.   case 1686:
  12537.     sendFrame126(str, 17518); break;
  12538.   case 1687:
  12539.     sendFrame126(str, 17519);
  12540.   case 1685: }
  12541. }
  12542.  
  12543. public void sendFrame126(String str, int i) {
  12544.   RSInterface.interfaceCache[i].disabledMessage = str;
  12545.   if (RSInterface.interfaceCache[i].parentID == tabInterfaceIDs[tabID])
  12546.     needDrawTabArea = true;
  12547. }
  12548.  
  12549. public void sendPacket185(int button, int toggle, int interfaceType) {
  12550.   switch (interfaceType) {
  12551.   case 135:
  12552.     RSInterface class9 = RSInterface.interfaceCache[button];
  12553.     boolean flag8 = true;
  12554.     if (class9.contentType > 0)
  12555.       flag8 = promptUserForInput(class9);
  12556.     if (flag8) {
  12557.       this.stream.createFrame(185);
  12558.       this.stream.writeWord(button);
  12559.     }
  12560.     break;
  12561.   case 646:
  12562.     this.stream.createFrame(185);
  12563.     this.stream.writeWord(button);
  12564.     RSInterface class9_2 = RSInterface.interfaceCache[button];
  12565.     if ((class9_2.valueIndexArray != null) && (class9_2.valueIndexArray[0][0] == 5) &&
  12566.       (this.variousSettings[toggle] != class9_2.requiredValues[0])) {
  12567.       this.variousSettings[toggle] = class9_2.requiredValues[0];
  12568.       method33(toggle);
  12569.       needDrawTabArea = true;
  12570.     }
  12571.  
  12572.     break;
  12573.   case 169:
  12574.     this.stream.createFrame(185);
  12575.     this.stream.writeWord(button);
  12576.     RSInterface class9_3 = RSInterface.interfaceCache[button];
  12577.     if ((class9_3.valueIndexArray != null) && (class9_3.valueIndexArray[0][0] == 5)) {
  12578.       this.variousSettings[toggle] = (1 - this.variousSettings[toggle]);
  12579.       method33(toggle);
  12580.       needDrawTabArea = true;
  12581.     }
  12582.     switch (button) {
  12583.     case 19136:
  12584.       System.out.println("toggle = " + toggle);
  12585.       if (toggle == 0)
  12586.         sendFrame36(173, toggle);
  12587.       if (toggle == 1)
  12588.         sendPacket185(153, 173, 646);
  12589.       break;
  12590.     }
  12591.     break;
  12592.   }
  12593. }
  12594.  
  12595. public void sendFrame36(int id, int state) {
  12596.   this.anIntArray1045[id] = state;
  12597.   if (this.variousSettings[id] != state) {
  12598.     this.variousSettings[id] = state;
  12599.     method33(id);
  12600.     needDrawTabArea = true;
  12601.     if (this.dialogID != -1)
  12602.       inputTaken = true;
  12603.   }
  12604. }
  12605.  
  12606. public void sendFrame219()
  12607. {
  12608.   if (this.invOverlayInterfaceID != -1) {
  12609.     this.invOverlayInterfaceID = -1;
  12610.     needDrawTabArea = true;
  12611.     tabAreaAltered = true;
  12612.   }
  12613.   if (this.backDialogID != -1) {
  12614.     this.backDialogID = -1;
  12615.     inputTaken = true;
  12616.   }
  12617.   if (this.inputDialogState != 0) {
  12618.     this.inputDialogState = 0;
  12619.     inputTaken = true;
  12620.   }
  12621.   openInterfaceID = -1;
  12622.   this.aBoolean1149 = false;
  12623. }
  12624.  
  12625. public void sendFrame248(int interfaceID, int sideInterfaceID) {
  12626.   if (this.backDialogID != -1) {
  12627.     this.backDialogID = -1;
  12628.     inputTaken = true;
  12629.   }
  12630.   if (this.inputDialogState != 0) {
  12631.     this.inputDialogState = 0;
  12632.     inputTaken = true;
  12633.   }
  12634.   openInterfaceID = interfaceID;
  12635.   this.invOverlayInterfaceID = sideInterfaceID;
  12636.   needDrawTabArea = true;
  12637.   tabAreaAltered = true;
  12638.   this.aBoolean1149 = false;
  12639. }
  12640.  
  12641. private boolean parsePacket()
  12642. {
  12643.   if (this.socketStream == null)
  12644.     return false;
  12645.   try {
  12646.     int i = this.socketStream.available();
  12647.     if (i == 0)
  12648.       return false;
  12649.     if (this.pktType == -1) {
  12650.       this.socketStream.flushInputStream(this.inStream.buffer, 1);
  12651.       this.pktType = (this.inStream.buffer[0] & 0xFF);
  12652.       if (this.encryption != null)
  12653.         this.pktType = (this.pktType - this.encryption.getNextKey() & 0xFF);
  12654.       this.pktSize = SizeConstants.packetSizes[this.pktType];
  12655.       i--;
  12656.     }
  12657.     if (this.pktSize == -1)
  12658.       if (i > 0) {
  12659.         this.socketStream.flushInputStream(this.inStream.buffer, 1);
  12660.         this.pktSize = (this.inStream.buffer[0] & 0xFF);
  12661.         i--;
  12662.       } else {
  12663.         return false;
  12664.       }
  12665.     if (this.pktSize == -2)
  12666.       if (i > 1) {
  12667.         this.socketStream.flushInputStream(this.inStream.buffer, 2);
  12668.         this.inStream.currentOffset = 0;
  12669.         this.pktSize = this.inStream.readUnsignedWord();
  12670.         i -= 2;
  12671.       } else {
  12672.         return false;
  12673.       }
  12674.     if (i < this.pktSize)
  12675.       return false;
  12676.     this.inStream.currentOffset = 0;
  12677.     this.socketStream.flushInputStream(this.inStream.buffer, this.pktSize);
  12678.     this.anInt1009 = 0;
  12679.     this.anInt843 = this.anInt842;
  12680.     this.anInt842 = this.anInt841;
  12681.     this.anInt841 = this.pktType;
  12682.     switch (this.pktType)
  12683.     {
  12684.     case 81:
  12685.       updatePlayers(this.pktSize, this.inStream);
  12686.       this.aBoolean1080 = false;
  12687.       this.pktType = -1;
  12688.       return true;
  12689.     case 176:
  12690.       this.daysSinceRecovChange = this.inStream.method427();
  12691.       this.unreadMessages = this.inStream.method435();
  12692.       this.membersInt = this.inStream.readUnsignedByte();
  12693.       this.anInt1193 = this.inStream.method440();
  12694.       this.daysSinceLastLogin = this.inStream.readUnsignedWord();
  12695.       if ((this.anInt1193 != 0) && (openInterfaceID == -1)) {
  12696.         SignLink.dnslookup(TextClass.method586(this.anInt1193));
  12697.         clearTopInterfaces();
  12698.         char c = 'ʊ';
  12699.         if ((this.daysSinceRecovChange != 201) || (this.membersInt == 1))
  12700.           c = 'ʏ';
  12701.         this.reportAbuseInput = "";
  12702.         this.canMute = false;
  12703.         for (int k9 = 0; k9 < RSInterface.interfaceCache.length; k9++) {
  12704.           if ((RSInterface.interfaceCache[k9] != null) && (RSInterface.interfaceCache[k9].contentType == c))
  12705.           {
  12706.             openInterfaceID = RSInterface.interfaceCache[k9].parentID;
  12707.           }
  12708.         }
  12709.       }
  12710.       this.pktType = -1;
  12711.       return true;
  12712.     case 64:
  12713.       this.anInt1268 = this.inStream.method427();
  12714.       this.anInt1269 = this.inStream.method428();
  12715.       for (int j = this.anInt1268; j < this.anInt1268 + 8; j++) {
  12716.         for (int l9 = this.anInt1269; l9 < this.anInt1269 + 8; l9++)
  12717.           if (this.groundArray[this.plane][j][l9] != null) {
  12718.             this.groundArray[this.plane][j][l9] = null;
  12719.             spawnGroundItem(j, l9);
  12720.           }
  12721.       }
  12722.       for (Class30_Sub1 class30_sub1 = (Class30_Sub1)this.aClass19_1179.reverseGetFirst(); class30_sub1 != null; class30_sub1 = (Class30_Sub1)this.aClass19_1179.reverseGetNext())
  12723.         if ((class30_sub1.anInt1297 >= this.anInt1268) && (class30_sub1.anInt1297 < this.anInt1268 + 8) && (class30_sub1.anInt1298 >= this.anInt1269) && (class30_sub1.anInt1298 < this.anInt1269 + 8) && (class30_sub1.anInt1295 == this.plane))
  12724.           class30_sub1.anInt1294 = 0;
  12725.       this.pktType = -1;
  12726.       return true;
  12727.     case 185:
  12728.       int k = this.inStream.method436();
  12729.       RSInterface.interfaceCache[k].disabledMediaType = 3;
  12730.       if (myPlayer.desc == null)
  12731.         RSInterface.interfaceCache[k].disabledMediaID = ((myPlayer.anIntArray1700[0] << 25) + (myPlayer.anIntArray1700[4] << 20) + (myPlayer.equipment[0] << 15) + (myPlayer.equipment[8] << 10) + (myPlayer.equipment[11] << 5) + myPlayer.equipment[1]);
  12732.       else
  12733.         RSInterface.interfaceCache[k].disabledMediaID = ((int)(305419896L + myPlayer.desc.id));
  12734.       this.pktType = -1;
  12735.       return true;
  12736.     case 217:
  12737.       try
  12738.       {
  12739.         this.name = this.inStream.readString();
  12740.         this.disabledMessage = this.inStream.readString();
  12741.         this.clanname = this.inStream.readString();
  12742.         this.rights = this.inStream.readUnsignedWord();
  12743.  
  12744.         System.out.println(this.clanname);
  12745.         pushMessage(this.disabledMessage, 16, this.name);
  12746.       } catch (Exception e) {
  12747.         e.printStackTrace();
  12748.       }
  12749.       this.pktType = -1;
  12750.       return true;
  12751.     case 107:
  12752.       this.aBoolean1160 = false;
  12753.       for (int l = 0; l < 5; l++)
  12754.         this.aBooleanArray876[l] = false;
  12755.       this.pktType = -1;
  12756.       return true;
  12757.     case 72:
  12758.       int i1 = this.inStream.method434();
  12759.       RSInterface class9 = RSInterface.interfaceCache[i1];
  12760.       for (int k15 = 0; k15 < class9.inventory.length; k15++) {
  12761.         class9.inventory[k15] = -1;
  12762.         class9.inventory[k15] = 0;
  12763.       }
  12764.       this.pktType = -1;
  12765.       return true;
  12766.     case 214:
  12767.       this.ignoreCount = (this.pktSize / 8);
  12768.       for (int j1 = 0; j1 < this.ignoreCount; j1++)
  12769.         this.ignoreListAsLongs[j1] = this.inStream.readQWord();
  12770.       this.pktType = -1;
  12771.       return true;
  12772.     case 166:
  12773.       this.aBoolean1160 = true;
  12774.       this.anInt1098 = this.inStream.readUnsignedByte();
  12775.       this.anInt1099 = this.inStream.readUnsignedByte();
  12776.       this.anInt1100 = this.inStream.readUnsignedWord();
  12777.       this.anInt1101 = this.inStream.readUnsignedByte();
  12778.       this.anInt1102 = this.inStream.readUnsignedByte();
  12779.       if (this.anInt1102 >= 100) {
  12780.         this.xCameraPos = (this.anInt1098 * 128 + 64);
  12781.         this.yCameraPos = (this.anInt1099 * 128 + 64);
  12782.         this.zCameraPos = (method42(this.plane, this.yCameraPos, this.xCameraPos) - this.anInt1100);
  12783.       }
  12784.       this.pktType = -1;
  12785.       return true;
  12786.     case 134:
  12787.       needDrawTabArea = true;
  12788.       int k1 = this.inStream.readUnsignedByte();
  12789.       int i10 = this.inStream.method439();
  12790.       int l15 = this.inStream.readUnsignedByte();
  12791.       int oldXp = this.currentExp[k1];
  12792.       this.currentExp[k1] = i10;
  12793.       this.currentStats[k1] = l15;
  12794.       this.maxStats[k1] = 1;
  12795.       if (i10 - oldXp > 0) {
  12796.         this.xpToDraw = (i10 - oldXp);
  12797.         if (this.drawXpBar) {
  12798.           this.drawFlag = true;
  12799.         }
  12800.  
  12801.       }
  12802.  
  12803.       for (int k20 = 0; k20 < 98; k20++)
  12804.         if (i10 >= anIntArray1019[k20])
  12805.           this.maxStats[k1] = (k20 + 2);
  12806.       this.pktType = -1;
  12807.       return true;
  12808.     case 71:
  12809.       int l1 = this.inStream.readUnsignedWord();
  12810.       int j10 = this.inStream.method426();
  12811.       if (l1 == 65535)
  12812.         l1 = -1;
  12813.       tabInterfaceIDs[j10] = l1;
  12814.       needDrawTabArea = true;
  12815.       tabAreaAltered = true;
  12816.       this.pktType = -1;
  12817.       return true;
  12818.     case 74:
  12819.       int i2 = this.inStream.method434();
  12820.       if (i2 == 65535)
  12821.         i2 = -1;
  12822.       if ((i2 != this.currentSong) && (this.musicEnabled) && (!lowMem) && (this.prevSong == 0)) {
  12823.         this.nextSong = i2;
  12824.         this.songChanging = true;
  12825.         this.onDemandFetcher.method558(2, this.nextSong);
  12826.       }
  12827.       this.currentSong = i2;
  12828.       this.pktType = -1;
  12829.       return true;
  12830.     case 121:
  12831.       int j2 = this.inStream.method436();
  12832.       int k10 = this.inStream.method435();
  12833.       if ((this.musicEnabled) && (!lowMem)) {
  12834.         this.nextSong = j2;
  12835.         this.songChanging = false;
  12836.         this.onDemandFetcher.method558(2, this.nextSong);
  12837.         this.prevSong = k10;
  12838.       }
  12839.       this.pktType = -1;
  12840.       return true;
  12841.     case 109:
  12842.       resetLogout();
  12843.       this.pktType = -1;
  12844.       return false;
  12845.     case 70:
  12846.       int k2 = this.inStream.readSignedWord();
  12847.       int l10 = this.inStream.method437();
  12848.       int i16 = this.inStream.method434();
  12849.       RSInterface class9_5 = RSInterface.interfaceCache[i16];
  12850.       class9_5.xOffset = k2;
  12851.       class9_5.yOffset = l10;
  12852.       this.pktType = -1;
  12853.       return true;
  12854.     case 73:
  12855.     case 241:
  12856.       int l2 = this.anInt1069;
  12857.       int i11 = this.anInt1070;
  12858.       if (this.pktType == 73) {
  12859.         l2 = this.inStream.method435();
  12860.         i11 = this.inStream.readUnsignedWord();
  12861.         this.loadGeneratedMap = false;
  12862.       }
  12863.       if (this.pktType == 241) {
  12864.         i11 = this.inStream.method435();
  12865.         this.inStream.initBitAccess();
  12866.         for (int j16 = 0; j16 < 4; j16++) {
  12867.           for (int l20 = 0; l20 < 13; l20++) {
  12868.             for (int j23 = 0; j23 < 13; j23++) {
  12869.               int i26 = this.inStream.readBits(1);
  12870.               if (i26 == 1)
  12871.                 this.anIntArrayArrayArray1129[j16][l20][j23] = this.inStream.readBits(26);
  12872.               else
  12873.                 this.anIntArrayArrayArray1129[j16][l20][j23] = -1;
  12874.             }
  12875.           }
  12876.         }
  12877.         this.inStream.finishBitAccess();
  12878.         l2 = this.inStream.readUnsignedWord();
  12879.         this.loadGeneratedMap = true;
  12880.       }
  12881.       if ((this.anInt1069 == l2) && (this.anInt1070 == i11) && (this.loadingStage == 2)) {
  12882.         this.pktType = -1;
  12883.         return true;
  12884.       }
  12885.       this.anInt1069 = l2;
  12886.       this.anInt1070 = i11;
  12887.       this.baseX = ((this.anInt1069 - 6) * 8);
  12888.       this.baseY = ((this.anInt1070 - 6) * 8);
  12889.       this.aBoolean1141 = (((this.anInt1069 / 8 == 48) || (this.anInt1069 / 8 == 49)) && (this.anInt1070 / 8 == 48));
  12890.       if ((this.anInt1069 / 8 == 48) && (this.anInt1070 / 8 == 148))
  12891.         this.aBoolean1141 = true;
  12892.       this.loadingStage = 1;
  12893.       this.aLong824 = System.currentTimeMillis();
  12894.       mainGameArea.initDrawingArea();
  12895.       this.cacheSprite[2].drawSprite(8, 9);
  12896.       mainGameArea.drawGraphics(4, 4, this.graphics);
  12897.       if (this.pktType == 73) {
  12898.         int k16 = 0;
  12899.         for (int i21 = (this.anInt1069 - 6) / 8; i21 <= (this.anInt1069 + 6) / 8; i21++) {
  12900.           for (int k23 = (this.anInt1070 - 6) / 8; k23 <= (this.anInt1070 + 6) / 8; k23++)
  12901.             k16++;
  12902.         }
  12903.         this.terrainData = new byte[k16][];
  12904.         this.aByteArrayArray1247 = new byte[k16][];
  12905.         this.mapCoordinates = new int[k16];
  12906.         this.terrainIndices = new int[k16];
  12907.         this.anIntArray1236 = new int[k16];
  12908.         k16 = 0;
  12909.         for (int l23 = (this.anInt1069 - 6) / 8; l23 <= (this.anInt1069 + 6) / 8; l23++) {
  12910.           for (int j26 = (this.anInt1070 - 6) / 8; j26 <= (this.anInt1070 + 6) / 8; j26++) {
  12911.             this.mapCoordinates[k16] = ((l23 << 8) + j26);
  12912.             if ((this.aBoolean1141) && ((j26 == 49) || (j26 == 149) || (j26 == 147) || (l23 == 50) || ((l23 == 49) && (j26 == 47)))) {
  12913.               this.terrainIndices[k16] = -1;
  12914.               this.anIntArray1236[k16] = -1;
  12915.               k16++;
  12916.             } else {
  12917.               int k28 = this.terrainIndices[k16] = this.onDemandFetcher.method562(0, j26, l23);
  12918.               if (k28 != -1)
  12919.                 this.onDemandFetcher.method558(3, k28);
  12920.               int j30 = this.anIntArray1236[k16] = this.onDemandFetcher.method562(1, j26, l23);
  12921.               if (j30 != -1)
  12922.                 this.onDemandFetcher.method558(3, j30);
  12923.               k16++;
  12924.             }
  12925.           }
  12926.         }
  12927.       }
  12928.       if (this.pktType == 241) {
  12929.         int l16 = 0;
  12930.         int[] ai = new int[676];
  12931.         for (int i24 = 0; i24 < 4; i24++) {
  12932.           for (int k26 = 0; k26 < 13; k26++) {
  12933.             for (int l28 = 0; l28 < 13; l28++) {
  12934.               int k30 = this.anIntArrayArrayArray1129[i24][k26][l28];
  12935.               if (k30 != -1) {
  12936.                 int k31 = k30 >> 14 & 0x3FF;
  12937.                 int i32 = k30 >> 3 & 0x7FF;
  12938.                 int k32 = (k31 / 8 << 8) + i32 / 8;
  12939.                 for (int j33 = 0; j33 < l16; j33++) {
  12940.                   if (ai[j33] == k32)
  12941.                   {
  12942.                     k32 = -1;
  12943.                   }
  12944.                 }
  12945.                 if (k32 != -1)
  12946.                   ai[(l16++)] = k32;
  12947.               }
  12948.             }
  12949.           }
  12950.         }
  12951.         this.terrainData = new byte[l16][];
  12952.         this.aByteArrayArray1247 = new byte[l16][];
  12953.         this.mapCoordinates = new int[l16];
  12954.         this.terrainIndices = new int[l16];
  12955.         this.anIntArray1236 = new int[l16];
  12956.         for (int l26 = 0; l26 < l16; l26++) {
  12957.           int i29 = this.mapCoordinates[l26] = ai[l26];
  12958.           int l30 = i29 >> 8 & 0xFF;
  12959.           int l31 = i29 & 0xFF;
  12960.           int j32 = this.terrainIndices[l26] = this.onDemandFetcher.method562(0, l31, l30);
  12961.           if (j32 != -1)
  12962.             this.onDemandFetcher.method558(3, j32);
  12963.           int i33 = this.anIntArray1236[l26] = this.onDemandFetcher.method562(1, l31, l30);
  12964.           if (i33 != -1)
  12965.             this.onDemandFetcher.method558(3, i33);
  12966.         }
  12967.       }
  12968.       int i17 = this.baseX - this.anInt1036;
  12969.       int j21 = this.baseY - this.anInt1037;
  12970.       this.anInt1036 = this.baseX;
  12971.       this.anInt1037 = this.baseY;
  12972.       for (int j24 = 0; j24 < 16384; j24++) {
  12973.         Npc npc = this.npcArray[j24];
  12974.         if (npc != null) {
  12975.           for (int j29 = 0; j29 < 10; j29++) {
  12976.             npc.smallX[j29] -= i17;
  12977.             npc.smallY[j29] -= j21;
  12978.           }
  12979.           npc.x -= i17 * 128;
  12980.           npc.y -= j21 * 128;
  12981.         }
  12982.       }
  12983.       for (int i27 = 0; i27 < this.maxPlayers; i27++) {
  12984.         Player player = this.playerArray[i27];
  12985.         if (player != null) {
  12986.           for (int i31 = 0; i31 < 10; i31++) {
  12987.             player.smallX[i31] -= i17;
  12988.             player.smallY[i31] -= j21;
  12989.           }
  12990.           player.x -= i17 * 128;
  12991.           player.y -= j21 * 128;
  12992.         }
  12993.       }
  12994.       this.aBoolean1080 = true;
  12995.       byte byte1 = 0;
  12996.       byte byte2 = 104;
  12997.       byte byte3 = 1;
  12998.       if (i17 < 0) {
  12999.         byte1 = 103;
  13000.         byte2 = -1;
  13001.         byte3 = -1;
  13002.       }
  13003.       byte byte4 = 0;
  13004.       byte byte5 = 104;
  13005.       byte byte6 = 1;
  13006.       if (j21 < 0) {
  13007.         byte4 = 103;
  13008.         byte5 = -1;
  13009.         byte6 = -1;
  13010.       }
  13011.       for (int k33 = byte1; k33 != byte2; k33 += byte3) {
  13012.         for (int l33 = byte4; l33 != byte5; l33 += byte6) {
  13013.           int i34 = k33 + i17;
  13014.           int j34 = l33 + j21;
  13015.           for (int k34 = 0; k34 < 4; k34++)
  13016.             if ((i34 >= 0) && (j34 >= 0) && (i34 < 104) && (j34 < 104))
  13017.               this.groundArray[k34][k33][l33] = this.groundArray[k34][i34][j34];
  13018.             else
  13019.               this.groundArray[k34][k33][l33] = null;
  13020.         }
  13021.       }
  13022.       for (Class30_Sub1 class30_sub1_1 = (Class30_Sub1)this.aClass19_1179.reverseGetFirst(); class30_sub1_1 != null; class30_sub1_1 = (Class30_Sub1)this.aClass19_1179.reverseGetNext()) {
  13023.         class30_sub1_1.anInt1297 -= i17;
  13024.         class30_sub1_1.anInt1298 -= j21;
  13025.         if ((class30_sub1_1.anInt1297 < 0) || (class30_sub1_1.anInt1298 < 0) || (class30_sub1_1.anInt1297 >= 104) || (class30_sub1_1.anInt1298 >= 104))
  13026.           class30_sub1_1.unlink();
  13027.       }
  13028.       if (this.destX != 0) {
  13029.         this.destX -= i17;
  13030.         this.destY -= j21;
  13031.       }
  13032.       this.aBoolean1160 = false;
  13033.       this.pktType = -1;
  13034.       return true;
  13035.     case 208:
  13036.       int i3 = this.inStream.method437();
  13037.       if (i3 >= 0)
  13038.         method60(i3);
  13039.       this.anInt1018 = i3;
  13040.       this.pktType = -1;
  13041.       return true;
  13042.     case 99:
  13043.       this.miniMapOverlay = this.inStream.readUnsignedByte();
  13044.       this.pktType = -1;
  13045.       return true;
  13046.     case 75:
  13047.       int j3 = this.inStream.method436();
  13048.       int j11 = this.inStream.method436();
  13049.       RSInterface.interfaceCache[j11].disabledMediaType = 2;
  13050.       RSInterface.interfaceCache[j11].disabledMediaID = j3;
  13051.       this.pktType = -1;
  13052.       return true;
  13053.     case 114:
  13054.       this.anInt1104 = (this.inStream.method434() * 30);
  13055.       this.pktType = -1;
  13056.       return true;
  13057.     case 60:
  13058.       this.anInt1269 = this.inStream.readUnsignedByte();
  13059.       this.anInt1268 = this.inStream.method427();
  13060.       while (this.inStream.currentOffset < this.pktSize) {
  13061.         int k3 = this.inStream.readUnsignedByte();
  13062.         method137(this.inStream, k3);
  13063.       }
  13064.       this.pktType = -1;
  13065.       return true;
  13066.     case 35:
  13067.       int l3 = this.inStream.readUnsignedByte();
  13068.       int k11 = this.inStream.readUnsignedByte();
  13069.       int j17 = this.inStream.readUnsignedByte();
  13070.       int k21 = this.inStream.readUnsignedByte();
  13071.       this.aBooleanArray876[l3] = true;
  13072.       this.anIntArray873[l3] = k11;
  13073.       this.anIntArray1203[l3] = j17;
  13074.       this.anIntArray928[l3] = k21;
  13075.       this.anIntArray1030[l3] = 0;
  13076.       this.pktType = -1;
  13077.       return true;
  13078.     case 174:
  13079.       this.followPlayer = 0;
  13080.       this.followNPC = 0;
  13081.       int l11z = this.inStream.readUnsignedWord();
  13082.       int iq = this.inStream.readUnsignedByte();
  13083.       this.followDistance = this.inStream.readUnsignedWord();
  13084.       if (iq == 0)
  13085.       {
  13086.         this.followNPC = l11z;
  13087.       }
  13088.       else if (iq == 1)
  13089.       {
  13090.         this.followPlayer = l11z;
  13091.       }
  13092.       this.pktType = -1;
  13093.       return true;
  13094.     case 104:
  13095.       int j4 = this.inStream.method427();
  13096.       int i12 = this.inStream.method426();
  13097.       String s6 = this.inStream.readString();
  13098.       if ((j4 >= 1) && (j4 <= 5)) {
  13099.         if (s6.equalsIgnoreCase("null"))
  13100.           s6 = null;
  13101.         this.atPlayerActions[(j4 - 1)] = s6;
  13102.         this.atPlayerArray[(j4 - 1)] = i12 == 0;
  13103.       }
  13104.       this.pktType = -1;
  13105.       return true;
  13106.     case 78:
  13107.       this.destX = 0;
  13108.       this.pktType = -1;
  13109.       return true;
  13110.     case 253:
  13111.       String s = this.inStream.readString();
  13112.       if (s.startsWith("Alert##")) {
  13113.         String[] args = s.split("##");
  13114.         if (args.length == 3)
  13115.           this.alertHandler.alert = new Alert("Notification", args[1], args[2]);
  13116.         else if (args.length == 4) {
  13117.           this.alertHandler.alert = new Alert(args[1], args[2], args[3]);
  13118.         }
  13119.         this.pktType = -1;
  13120.         return true;
  13121.       }
  13122.       if (s.endsWith(":tradereq:")) {
  13123.         String s3 = s.substring(0, s.indexOf(":"));
  13124.         long l17 = TextClass.longForName(s3);
  13125.         boolean flag2 = false;
  13126.         for (int j27 = 0; j27 < this.ignoreCount; j27++)
  13127.           if (this.ignoreListAsLongs[j27] == l17)
  13128.           {
  13129.             flag2 = true;
  13130.           }
  13131.         if ((!flag2) && (this.anInt1251 == 0))
  13132.           pushMessage("wishes to trade with you.", 4, s3);
  13133.       } else if (s.endsWith(":clan:")) {
  13134.         String s4 = s.substring(0, s.indexOf(":"));
  13135.  
  13136.         pushMessage("Clan: ", 8, s4);
  13137.       } else if (s.endsWith("#url#")) {
  13138.         String text = s.substring(0, s.indexOf("-"));
  13139.         s = s.substring(text.length() + 1).trim();
  13140.         String link = s.substring(0, s.indexOf("#"));
  13141.         pushMessage(text, 9, link);
  13142.       } else if (s.endsWith(":resetautocast:")) {
  13143.         this.Autocast = false;
  13144.         this.autocastId = 0;
  13145.         this.magicAuto.drawSprite(1000, 1000);
  13146.       } else if (s.endsWith(":duelreq:")) {
  13147.         String s4 = s.substring(0, s.indexOf(":"));
  13148.         long l18 = TextClass.longForName(s4);
  13149.         boolean flag3 = false;
  13150.         for (int k27 = 0; k27 < this.ignoreCount; k27++) {
  13151.           if (this.ignoreListAsLongs[k27] == l18)
  13152.           {
  13153.             flag3 = true;
  13154.           }
  13155.         }
  13156.         if ((!flag3) && (this.anInt1251 == 0))
  13157.           pushMessage("wishes to duel with you.", 8, s4);
  13158.       } else if (s.endsWith(":chalreq:")) {
  13159.         String s5 = s.substring(0, s.indexOf(":"));
  13160.         long l19 = TextClass.longForName(s5);
  13161.         boolean flag4 = false;
  13162.         for (int l27 = 0; l27 < this.ignoreCount; l27++) {
  13163.           if (this.ignoreListAsLongs[l27] == l19)
  13164.           {
  13165.             flag4 = true;
  13166.           }
  13167.         }
  13168.         if ((!flag4) && (this.anInt1251 == 0)) {
  13169.           String s8 = s.substring(s.indexOf(":") + 1, s.length() - 9);
  13170.           pushMessage(s8, 8, s5);
  13171.         }
  13172.       } else {
  13173.         pushMessage(s, 0, "");
  13174.       }
  13175.       this.pktType = -1;
  13176.       return true;
  13177.     case 1:
  13178.       for (int k4 = 0; k4 < this.playerArray.length; k4++)
  13179.         if (this.playerArray[k4] != null)
  13180.           this.playerArray[k4].anim = -1;
  13181.       for (int j12 = 0; j12 < this.npcArray.length; j12++)
  13182.         if (this.npcArray[j12] != null)
  13183.           this.npcArray[j12].anim = -1;
  13184.       this.pktType = -1;
  13185.       return true;
  13186.     case 50:
  13187.       long l4 = this.inStream.readQWord();
  13188.       int i18 = this.inStream.readUnsignedByte();
  13189.       String s7 = TextClass.fixName(TextClass.nameForLong(l4));
  13190.       for (int k24 = 0; k24 < this.friendsCount; k24++) {
  13191.         if (l4 == this.friendsListAsLongs[k24])
  13192.         {
  13193.           if (this.friendsNodeIDs[k24] != i18) {
  13194.             this.friendsNodeIDs[k24] = i18;
  13195.             needDrawTabArea = true;
  13196.             if (i18 >= 2) {
  13197.               pushMessage(s7 + " has logged in.", 5, "");
  13198.             }
  13199.             if (i18 <= 1) {
  13200.               pushMessage(s7 + " has logged out.", 5, "");
  13201.             }
  13202.           }
  13203.           s7 = null;
  13204.         }
  13205.       }
  13206.       if ((s7 != null) && (this.friendsCount < 200)) {
  13207.         this.friendsListAsLongs[this.friendsCount] = l4;
  13208.         this.friendsList[this.friendsCount] = s7;
  13209.         this.friendsNodeIDs[this.friendsCount] = i18;
  13210.         this.friendsCount += 1;
  13211.         needDrawTabArea = true;
  13212.       }
  13213.       for (boolean flag6 = false; !flag6;)
  13214.       {
  13215.         flag6 = true;
  13216.         for (int index = 0; index < friendsCount - 1; index++) {
  13217.         if (((this.friendsNodeIDs[index] != nodeID) && (this.friendsNodeIDs[(index + 1)] == nodeID)) || ((this.friendsNodeIDs[index] == 0) && (this.friendsNodeIDs[(index + 1)] != 0))) {
  13218.           int j31 = this.friendsNodeIDs[index];
  13219.           this.friendsNodeIDs[index] = this.friendsNodeIDs[(index + 1)];
  13220.           this.friendsNodeIDs[(index + 1)] = j31;
  13221.           String s10 = this.friendsList[index];
  13222.           this.friendsList[index] = this.friendsList[(index + 1)];
  13223.           this.friendsList[(index + 1)] = s10;
  13224.           long l32 = this.friendsListAsLongs[index];
  13225.           this.friendsListAsLongs[index] = this.friendsListAsLongs[(index + 1)];
  13226.           this.friendsListAsLongs[(index + 1)] = l32;
  13227.           needDrawTabArea = true;
  13228.           flag6 = false;
  13229.         }
  13230.         }
  13231.       }
  13232.  
  13233.       this.pktType = -1;
  13234.       return true;
  13235.     case 110:
  13236.       if (tabID == 12)
  13237.         needDrawTabArea = true;
  13238.       this.energy = this.inStream.readUnsignedByte();
  13239.       this.pktType = -1;
  13240.       return true;
  13241.     case 254:
  13242.       this.anInt855 = this.inStream.readUnsignedByte();
  13243.       if (this.anInt855 == 1)
  13244.         this.anInt1222 = this.inStream.readUnsignedWord();
  13245.       if ((this.anInt855 >= 2) && (this.anInt855 <= 6)) {
  13246.         if (this.anInt855 == 2) {
  13247.           this.anInt937 = 64;
  13248.           this.anInt938 = 64;
  13249.         }
  13250.         if (this.anInt855 == 3) {
  13251.           this.anInt937 = 0;
  13252.           this.anInt938 = 64;
  13253.         }
  13254.         if (this.anInt855 == 4) {
  13255.           this.anInt937 = 128;
  13256.           this.anInt938 = 64;
  13257.         }
  13258.         if (this.anInt855 == 5) {
  13259.           this.anInt937 = 64;
  13260.           this.anInt938 = 0;
  13261.         }
  13262.         if (this.anInt855 == 6) {
  13263.           this.anInt937 = 64;
  13264.           this.anInt938 = 128;
  13265.         }
  13266.         this.anInt855 = 2;
  13267.         this.anInt934 = this.inStream.readUnsignedWord();
  13268.         this.anInt935 = this.inStream.readUnsignedWord();
  13269.         this.anInt936 = this.inStream.readUnsignedByte();
  13270.       }
  13271.       if (this.anInt855 == 10)
  13272.         this.anInt933 = this.inStream.readUnsignedWord();
  13273.       this.pktType = -1;
  13274.       return true;
  13275.     case 248:
  13276.       int i5 = this.inStream.method435();
  13277.       int k12 = this.inStream.readUnsignedWord();
  13278.       if (this.backDialogID != -1) {
  13279.         this.backDialogID = -1;
  13280.         inputTaken = true;
  13281.       }
  13282.       if (this.inputDialogState != 0) {
  13283.         this.inputDialogState = 0;
  13284.         inputTaken = true;
  13285.       }
  13286.       openInterfaceID = i5;
  13287.       this.invOverlayInterfaceID = k12;
  13288.       needDrawTabArea = true;
  13289.       tabAreaAltered = true;
  13290.       this.aBoolean1149 = false;
  13291.       this.pktType = -1;
  13292.       return true;
  13293.     case 79:
  13294.       int j5 = this.inStream.method434();
  13295.       int l12 = this.inStream.method435();
  13296.       RSInterface class9_3 = RSInterface.interfaceCache[j5];
  13297.       if ((class9_3 != null) && (class9_3.interfaceType == 0)) {
  13298.         if (l12 < 0)
  13299.           l12 = 0;
  13300.         if (l12 > class9_3.scrollMax - class9_3.height)
  13301.           l12 = class9_3.scrollMax - class9_3.height;
  13302.         class9_3.scrollPosition = l12;
  13303.       }
  13304.       this.pktType = -1;
  13305.       return true;
  13306.     case 68:
  13307.       for (int k5 = 0; k5 < this.variousSettings.length; k5++)
  13308.         if (this.variousSettings[k5] != this.anIntArray1045[k5]) {
  13309.           this.variousSettings[k5] = this.anIntArray1045[k5];
  13310.           method33(k5);
  13311.           needDrawTabArea = true;
  13312.         }
  13313.       this.pktType = -1;
  13314.       return true;
  13315.     case 196:
  13316.       long l5 = this.inStream.readQWord();
  13317.       int j18 = this.inStream.readDWord();
  13318.       int l21 = this.inStream.readUnsignedByte();
  13319.       boolean flag5 = false;
  13320.  
  13321.       if (l21 <= 1) {
  13322.         for (int l29 = 0; l29 < this.ignoreCount; l29++) {
  13323.           if (this.ignoreListAsLongs[l29] == l5)
  13324.           {
  13325.             flag5 = true;
  13326.           }
  13327.         }
  13328.       }
  13329.       if ((!flag5) && (this.anInt1251 == 0))
  13330.       {
  13331.         try
  13332.         {
  13333.           String s9 = TextInput.method525(this.pktSize - 13, this.inStream);
  13334.  
  13335.           if (l21 == 4)
  13336.             pushMessage(s9, 7, "@cr0@ " + TextClass.fixName(TextClass.nameForLong(l5)));
  13337.           else if (l21 == 3)
  13338.             pushMessage(s9, 7, "@cr3@ " + TextClass.fixName(TextClass.nameForLong(l5)));
  13339.           else if (l21 == 2)
  13340.             pushMessage(s9, 7, "@cr2@ " + TextClass.fixName(TextClass.nameForLong(l5)));
  13341.           else if (l21 == 1)
  13342.             pushMessage(s9, 7, "@cr1@ " + TextClass.fixName(TextClass.nameForLong(l5)));
  13343.           else
  13344.             pushMessage(s9, 3, TextClass.fixName(TextClass.nameForLong(l5)));
  13345.         }
  13346.         catch (Exception exception1) {
  13347.           SignLink.reporterror("cde1");
  13348.         }
  13349.       }
  13350.       this.pktType = -1;
  13351.       return true;
  13352.     case 85:
  13353.       this.anInt1269 = this.inStream.method427();
  13354.       this.anInt1268 = this.inStream.method427();
  13355.       this.pktType = -1;
  13356.       return true;
  13357.     case 24:
  13358.       this.anInt1054 = this.inStream.method428();
  13359.       if (this.anInt1054 == tabID) {
  13360.         if (this.anInt1054 == 3)
  13361.           tabID = 1;
  13362.         else
  13363.           tabID = 3;
  13364.         needDrawTabArea = true;
  13365.       }
  13366.       this.pktType = -1;
  13367.       return true;
  13368.     case 246:
  13369.       int i6 = this.inStream.method434();
  13370.       int i13 = this.inStream.readUnsignedWord();
  13371.       int k18 = this.inStream.readUnsignedWord();
  13372.       if (k18 == 65535) {
  13373.         RSInterface.interfaceCache[i6].disabledMediaType = 0;
  13374.         this.pktType = -1;
  13375.         return true;
  13376.       }
  13377.       ItemDef itemDef = ItemDef.forID(k18);
  13378.       RSInterface.interfaceCache[i6].disabledMediaType = 4;
  13379.       RSInterface.interfaceCache[i6].disabledMediaID = k18;
  13380.       RSInterface.interfaceCache[i6].modelRotationY = itemDef.modelRotationY;
  13381.       RSInterface.interfaceCache[i6].modelRotationX = itemDef.modelRotationX;
  13382.       RSInterface.interfaceCache[i6].modelZoom = (itemDef.modelZoom * 100 / i13);
  13383.       this.pktType = -1;
  13384.       return true;
  13385.     case 171:
  13386.       boolean flag1 = this.inStream.readUnsignedByte() == 1;
  13387.       int j13 = this.inStream.readUnsignedWord();
  13388.       RSInterface.interfaceCache[j13].interfaceShown = flag1;
  13389.       this.pktType = -1;
  13390.       return true;
  13391.     case 142:
  13392.       int j6 = this.inStream.method434();
  13393.       method60(j6);
  13394.       if (this.backDialogID != -1) {
  13395.         this.backDialogID = -1;
  13396.         inputTaken = true;
  13397.       }
  13398.       if (this.inputDialogState != 0) {
  13399.         this.inputDialogState = 0;
  13400.         inputTaken = true;
  13401.       }
  13402.       this.invOverlayInterfaceID = j6;
  13403.       needDrawTabArea = true;
  13404.       tabAreaAltered = true;
  13405.       openInterfaceID = -1;
  13406.       this.aBoolean1149 = false;
  13407.       this.pktType = -1;
  13408.       return true;
  13409.     case 126:
  13410.       String text = this.inStream.readString();
  13411.       int frame = this.inStream.method435();
  13412.       if (text.startsWith("www.")) {
  13413.         launchURL(text);
  13414.         this.pktType = -1;
  13415.         return true;
  13416.       }
  13417.       updateStrings(text, frame);
  13418.       sendFrame126(text, frame);
  13419.       if ((frame >= 18144) && (frame <= 18244)) {
  13420.         this.clanList[(frame - 18144)] = text;
  13421.       }
  13422.       this.pktType = -1;
  13423.       return true;
  13424.     case 206:
  13425.       this.publicChatMode = this.inStream.readUnsignedByte();
  13426.       this.privateChatMode = this.inStream.readUnsignedByte();
  13427.       this.tradeMode = this.inStream.readUnsignedByte();
  13428.  
  13429.       inputTaken = true;
  13430.       this.pktType = -1;
  13431.       return true;
  13432.     case 240:
  13433.       if (tabID == 12)
  13434.         needDrawTabArea = true;
  13435.       this.weight = this.inStream.readSignedWord();
  13436.       this.pktType = -1;
  13437.       return true;
  13438.     case 8:
  13439.       int k6 = this.inStream.method436();
  13440.       int l13 = this.inStream.readUnsignedWord();
  13441.       RSInterface.interfaceCache[k6].disabledMediaType = 1;
  13442.       RSInterface.interfaceCache[k6].disabledMediaID = l13;
  13443.       this.pktType = -1;
  13444.       return true;
  13445.     case 122:
  13446.       int l6 = this.inStream.method436();
  13447.       int i14 = this.inStream.method436();
  13448.       int i19 = i14 >> 10 & 0x1F;
  13449.       int i22 = i14 >> 5 & 0x1F;
  13450.       int l24 = i14 & 0x1F;
  13451.       RSInterface.interfaceCache[l6].disabledColor = ((i19 << 19) + (i22 << 11) + (l24 << 3));
  13452.       this.pktType = -1;
  13453.       return true;
  13454.     case 53:
  13455.       needDrawTabArea = true;
  13456.       int i7 = this.inStream.readUnsignedWord();
  13457.       RSInterface class9_1 = RSInterface.interfaceCache[i7];
  13458.       int j19 = this.inStream.readUnsignedWord();
  13459.       for (int j22 = 0; j22 < j19; j22++) {
  13460.         int i25 = this.inStream.readUnsignedByte();
  13461.         if (i25 == 255)
  13462.           i25 = this.inStream.method440();
  13463.         class9_1.inventory[j22] = this.inStream.method436();
  13464.         class9_1.inventoryValue[j22] = i25;
  13465.       }
  13466.       for (int j25 = j19; j25 < class9_1.inventory.length; j25++) {
  13467.         class9_1.inventory[j25] = 0;
  13468.         class9_1.inventoryValue[j25] = 0;
  13469.       }
  13470.       this.pktType = -1;
  13471.       return true;
  13472.     case 230:
  13473.       int j7 = this.inStream.method435();
  13474.       int j14 = this.inStream.readUnsignedWord();
  13475.       int k19 = this.inStream.readUnsignedWord();
  13476.       int k22 = this.inStream.method436();
  13477.       RSInterface.interfaceCache[j14].modelRotationY = k19;
  13478.       RSInterface.interfaceCache[j14].modelRotationX = k22;
  13479.       RSInterface.interfaceCache[j14].modelZoom = j7;
  13480.       this.pktType = -1;
  13481.       return true;
  13482.     case 221:
  13483.       this.anInt900 = this.inStream.readUnsignedByte();
  13484.       needDrawTabArea = true;
  13485.       this.pktType = -1;
  13486.       return true;
  13487.     case 177:
  13488.       this.aBoolean1160 = true;
  13489.       this.anInt995 = this.inStream.readUnsignedByte();
  13490.       this.anInt996 = this.inStream.readUnsignedByte();
  13491.       this.anInt997 = this.inStream.readUnsignedWord();
  13492.       this.anInt998 = this.inStream.readUnsignedByte();
  13493.       this.anInt999 = this.inStream.readUnsignedByte();
  13494.       if (this.anInt999 >= 100) {
  13495.         int k7 = this.anInt995 * 128 + 64;
  13496.         int k14 = this.anInt996 * 128 + 64;
  13497.         int i20 = method42(this.plane, k14, k7) - this.anInt997;
  13498.         int l22 = k7 - this.xCameraPos;
  13499.         int k25 = i20 - this.zCameraPos;
  13500.         int j28 = k14 - this.yCameraPos;
  13501.         int i30 = (int)Math.sqrt(l22 * l22 + j28 * j28);
  13502.         this.yCameraCurve = ((int)(Math.atan2(k25, i30) * 325.94900000000001D) & 0x7FF);
  13503.         this.xCameraCurve = ((int)(Math.atan2(l22, j28) * -325.94900000000001D) & 0x7FF);
  13504.         if (this.yCameraCurve < 128)
  13505.           this.yCameraCurve = 128;
  13506.         if (this.yCameraCurve > 383)
  13507.           this.yCameraCurve = 383;
  13508.       }
  13509.       this.pktType = -1;
  13510.       return true;
  13511.     case 249:
  13512.       this.anInt1046 = this.inStream.method426();
  13513.       this.unknownInt10 = this.inStream.method436();
  13514.       this.pktType = -1;
  13515.       return true;
  13516.     case 65:
  13517.       updateNPCs(this.inStream, this.pktSize);
  13518.       this.pktType = -1;
  13519.       return true;
  13520.     case 27:
  13521.       this.messagePromptRaised = false;
  13522.       this.inputDialogState = 1;
  13523.       this.amountOrNameInput = "";
  13524.       inputTaken = true;
  13525.       this.pktType = -1;
  13526.       return true;
  13527.     case 187:
  13528.       this.messagePromptRaised = false;
  13529.       this.inputDialogState = 2;
  13530.       this.amountOrNameInput = "";
  13531.       inputTaken = true;
  13532.       this.pktType = -1;
  13533.       return true;
  13534.     case 97:
  13535.       int l7 = this.inStream.readUnsignedWord();
  13536.       method60(l7);
  13537.       if (this.invOverlayInterfaceID != -1) {
  13538.         this.invOverlayInterfaceID = -1;
  13539.         needDrawTabArea = true;
  13540.         tabAreaAltered = true;
  13541.       }
  13542.       if (this.backDialogID != -1) {
  13543.         this.backDialogID = -1;
  13544.         inputTaken = true;
  13545.       }
  13546.       if (this.inputDialogState != 0) {
  13547.         this.inputDialogState = 0;
  13548.         inputTaken = true;
  13549.       }
  13550.  
  13551.       if (l7 == 15244) {
  13552.         openInterfaceID = 15774;
  13553.         this.fullscreenInterfaceID = 15244;
  13554.       } else {
  13555.         openInterfaceID = l7;
  13556.       }
  13557.       this.aBoolean1149 = false;
  13558.       this.pktType = -1;
  13559.       return true;
  13560.     case 218:
  13561.       int i8 = this.inStream.method438();
  13562.       this.dialogID = i8;
  13563.       inputTaken = true;
  13564.       this.pktType = -1;
  13565.       return true;
  13566.     case 87:
  13567.       int j8 = this.inStream.method434();
  13568.       int l14 = this.inStream.method439();
  13569.       this.anIntArray1045[j8] = l14;
  13570.       if (this.variousSettings[j8] != l14) {
  13571.         this.variousSettings[j8] = l14;
  13572.         method33(j8);
  13573.         needDrawTabArea = true;
  13574.         if (this.dialogID != -1)
  13575.           inputTaken = true;
  13576.       }
  13577.       this.pktType = -1;
  13578.       return true;
  13579.     case 36:
  13580.       int k8 = this.inStream.method434();
  13581.       byte byte0 = this.inStream.readSignedByte();
  13582.       this.anIntArray1045[k8] = byte0;
  13583.       if (this.variousSettings[k8] != byte0) {
  13584.         this.variousSettings[k8] = byte0;
  13585.         method33(k8);
  13586.         needDrawTabArea = true;
  13587.         if (this.dialogID != -1)
  13588.           inputTaken = true;
  13589.       }
  13590.       this.pktType = -1;
  13591.       return true;
  13592.     case 61:
  13593.       this.anInt1055 = this.inStream.readUnsignedByte();
  13594.       this.pktType = -1;
  13595.       return true;
  13596.     case 200:
  13597.       int l8 = this.inStream.readUnsignedWord();
  13598.       int i15 = this.inStream.readSignedWord();
  13599.       RSInterface class9_4 = RSInterface.interfaceCache[l8];
  13600.       class9_4.disabledAnimation = i15;
  13601.       class9_4.modelZoom = 1600;
  13602.       if (i15 == -1) {
  13603.         class9_4.animationLength = 0;
  13604.         class9_4.animationDelay = 0;
  13605.       }
  13606.       this.pktType = -1;
  13607.       return true;
  13608.     case 219:
  13609.       if (this.invOverlayInterfaceID != -1) {
  13610.         this.invOverlayInterfaceID = -1;
  13611.         needDrawTabArea = true;
  13612.         tabAreaAltered = true;
  13613.       }
  13614.       if (this.backDialogID != -1) {
  13615.         this.backDialogID = -1;
  13616.         inputTaken = true;
  13617.       }
  13618.       if (this.inputDialogState != 0) {
  13619.         this.inputDialogState = 0;
  13620.         inputTaken = true;
  13621.       }
  13622.       openInterfaceID = -1;
  13623.       this.aBoolean1149 = false;
  13624.       this.pktType = -1;
  13625.       return true;
  13626.     case 34:
  13627.       needDrawTabArea = true;
  13628.       int i9 = this.inStream.readUnsignedWord();
  13629.       RSInterface class9_2 = RSInterface.interfaceCache[i9];
  13630.       while (this.inStream.currentOffset < this.pktSize) {
  13631.         int j20 = this.inStream.method422();
  13632.         int i23 = this.inStream.readUnsignedWord();
  13633.         int l25 = this.inStream.readUnsignedByte();
  13634.         if (l25 == 255)
  13635.           l25 = this.inStream.readDWord();
  13636.         if ((j20 >= 0) && (j20 < class9_2.inventory.length)) {
  13637.           class9_2.inventory[j20] = i23;
  13638.           class9_2.inventoryValue[j20] = l25;
  13639.         }
  13640.       }
  13641.       this.pktType = -1;
  13642.       return true;
  13643.     case 4:
  13644.     case 44:
  13645.     case 84:
  13646.     case 101:
  13647.     case 105:
  13648.     case 117:
  13649.     case 147:
  13650.     case 151:
  13651.     case 156:
  13652.     case 160:
  13653.     case 215:
  13654.       method137(this.inStream, this.pktType);
  13655.       this.pktType = -1;
  13656.       return true;
  13657.     case 106:
  13658.       tabID = this.inStream.method427();
  13659.       needDrawTabArea = true;
  13660.       tabAreaAltered = true;
  13661.       this.pktType = -1;
  13662.       return true;
  13663.     case 164:
  13664.       int j9 = this.inStream.method434();
  13665.       method60(j9);
  13666.       if (this.invOverlayInterfaceID != -1) {
  13667.         this.invOverlayInterfaceID = -1;
  13668.         needDrawTabArea = true;
  13669.         tabAreaAltered = true;
  13670.       }
  13671.       this.backDialogID = j9;
  13672.       inputTaken = true;
  13673.       openInterfaceID = -1;
  13674.       this.aBoolean1149 = false;
  13675.       this.pktType = -1;
  13676.       return true;
  13677.     }
  13678.     SignLink.reporterror("T1 - " + this.pktType + "," + this.pktSize + " - " + this.anInt842 + "," + this.anInt843);
  13679.   }
  13680.   catch (IOException _ex) {
  13681.     dropClient();
  13682.   } catch (Exception exception) {
  13683.       exception.printStackTrace();
  13684.     String s2 = "T2 - " + this.pktType + "," + this.anInt842 + "," + this.anInt843 + " - " + this.pktSize + "," + (this.baseX + myPlayer.smallX[0]) + "," + (this.baseY + myPlayer.smallY[0]) + " - ";
  13685.     for (int j15 = 0; (j15 < this.pktSize) && (j15 < 50); j15++)
  13686.       s2 = s2 + this.inStream.buffer[j15] + ",";
  13687.     SignLink.reporterror(s2);
  13688.   }
  13689.  
  13690.   this.pktType = -1;
  13691.   return true;
  13692. }
  13693.  
  13694. private void draw3DScreenMain()
  13695. {
  13696.   this.anInt1265 += 1;
  13697.   method47(true);
  13698.   method26(true);
  13699.   method47(false);
  13700.   method26(false);
  13701.   method55();
  13702.   renderStationaryGraphics();
  13703.   if (!this.aBoolean1160) {
  13704.     int i = this.anInt1184;
  13705.     if (this.anInt984 / 256 > i)
  13706.       i = this.anInt984 / 256;
  13707.     if ((this.aBooleanArray876[4]) && (this.anIntArray1203[4] + 128 > i))
  13708.       i = this.anIntArray1203[4] + 128;
  13709.     int k = this.minimapInt1 + this.anInt896 & 0x7FF;
  13710.     setCameraPos(this.CameraPos2 + i * this.CameraPos1, i, this.anInt1014, method42(this.plane, myPlayer.y, myPlayer.x) - 50, k, this.anInt1015);
  13711.   }
  13712.   int j;
  13713.   if (!this.aBoolean1160)
  13714.     j = method120();
  13715.   else
  13716.     j = method121();
  13717.   int l = this.xCameraPos;
  13718.   int i1 = this.zCameraPos;
  13719.   int j1 = this.yCameraPos;
  13720.   int k1 = this.yCameraCurve;
  13721.   int l1 = this.xCameraCurve;
  13722.   for (int i2 = 0; i2 < 5; i2++)
  13723.     if (this.aBooleanArray876[i2]) {
  13724.       int j2 = (int)(Math.random() * (this.anIntArray873[i2] * 2 + 1) - this.anIntArray873[i2] + Math.sin(this.anIntArray1030[i2] * (this.anIntArray928[i2] / 100.0D)) * this.anIntArray1203[i2]);
  13725.       if (i2 == 0)
  13726.         this.xCameraPos += j2;
  13727.       if (i2 == 1)
  13728.         this.zCameraPos += j2;
  13729.       if (i2 == 2)
  13730.         this.yCameraPos += j2;
  13731.       if (i2 == 3)
  13732.         this.xCameraCurve = (this.xCameraCurve + j2 & 0x7FF);
  13733.       if (i2 == 4) {
  13734.         this.yCameraCurve += j2;
  13735.         if (this.yCameraCurve < 128)
  13736.           this.yCameraCurve = 128;
  13737.         if (this.yCameraCurve > 383)
  13738.           this.yCameraCurve = 383;
  13739.       }
  13740.     }
  13741.   int k2 = Texture.anInt1481;
  13742.   Model.aBoolean1684 = true;
  13743.   Model.anInt1687 = 0;
  13744.   Model.modelClickX = this.mouseX - 4;
  13745.   Model.modelClickY = this.mouseY - 4;
  13746.   DrawingArea.clear();
  13747.   if (this.fogSky)
  13748.     DrawingArea.fillRect(0, 0, 512, 334, 13156520);
  13749.   this.sceneGraph.draw3DScreen(this.xCameraPos, this.yCameraPos, this.xCameraCurve, this.zCameraPos, j, this.yCameraCurve);
  13750.   this.sceneGraph.clearObj5Cache();
  13751.   updateEntities();
  13752.   drawHeadIcon();
  13753.   method37(k2);
  13754.   draw3dScreen();
  13755.  
  13756.     if (!menuOpen) {
  13757.         processRightClick();
  13758.         drawTooltip();
  13759.     } else {
  13760.         drawMenu(4, 4);
  13761.     }
  13762.  
  13763.   drawDeveloperConsole(showDeveloperConsole, 4, 4);
  13764.  
  13765.   mainGameArea.drawGraphics(4, 4, this.graphics);
  13766.   xCameraPos = l;
  13767.   zCameraPos = i1;
  13768.   yCameraPos = j1;
  13769.   yCameraCurve = k1;
  13770.   xCameraCurve = l1;
  13771. }
  13772.  
  13773. public void sendFrame97(int interfaceID)
  13774. {
  13775.   method60(interfaceID);
  13776.   if (this.invOverlayInterfaceID != -1) {
  13777.     this.invOverlayInterfaceID = -1;
  13778.     needDrawTabArea = true;
  13779.     tabAreaAltered = true;
  13780.   }
  13781.   if (this.backDialogID != -1) {
  13782.     this.backDialogID = -1;
  13783.     inputTaken = true;
  13784.   }
  13785.   if (this.inputDialogState != 0) {
  13786.     this.inputDialogState = 0;
  13787.     inputTaken = true;
  13788.   }
  13789.   openInterfaceID = interfaceID;
  13790.   this.aBoolean1149 = false;
  13791. }
  13792.  
  13793. public void clearTopInterfaces() {
  13794.   this.stream.createFrame(130);
  13795.   if (this.invOverlayInterfaceID != -1) {
  13796.     this.invOverlayInterfaceID = -1;
  13797.     needDrawTabArea = true;
  13798.     this.aBoolean1149 = false;
  13799.     tabAreaAltered = true;
  13800.   }
  13801.   if (this.backDialogID != -1) {
  13802.     this.backDialogID = -1;
  13803.     inputTaken = true;
  13804.     this.aBoolean1149 = false;
  13805.   }
  13806.   openInterfaceID = -1;
  13807.   this.fullscreenInterfaceID = -1;
  13808. }
  13809.  
  13810. public Client() {
  13811.   this.LP = 0.0F;
  13812.   this.tabHPos = -1;
  13813.   this.alertHandler = new AlertHandler(this);
  13814.   this.fullscreenInterfaceID = -1;
  13815.   this.chatRights = new int[500];
  13816.   this.clanNames = new String[500];
  13817.   this.chatTypeView = 0;
  13818.   this.clanChatMode = 0;
  13819.   this.cButtonHPos = -1;
  13820.  
  13821.   this.cButtonCPos = 0;
  13822.   server = "127.0.0.1";
  13823.  
  13824.   this.anIntArrayArray825 = new int[104][104];
  13825.   this.friendsNodeIDs = new int['È'];
  13826.   this.groundArray = new NodeList[4][104][104];
  13827.   this.aBoolean831 = false;
  13828.   this.aStream_834 = new Stream(new byte[17000]);
  13829.   this.npcArray = new Npc[16384];
  13830.   this.npcIndices = new int[16384];
  13831.   this.anIntArray840 = new int[1000];
  13832.   this.aStream_847 = Stream.create();
  13833.   this.soundEffectsEnabled = true;
  13834.   openInterfaceID = -1;
  13835.   this.currentExp = new int[27];
  13836.  
  13837.   this.anIntArray873 = new int[5];
  13838.   this.anInt874 = -1;
  13839.   this.aBooleanArray876 = new boolean[5];
  13840.   this.drawFlames = false;
  13841.   this.reportAbuseInput = "";
  13842.   this.unknownInt10 = -1;
  13843.   this.menuOpen = false;
  13844.   this.inputString = "";
  13845.   this.maxPlayers = 2048;
  13846.   this.myPlayerIndex = 2047;
  13847.   this.playerArray = new Player[this.maxPlayers];
  13848.   this.playerIndices = new int[this.maxPlayers];
  13849.   this.anIntArray894 = new int[this.maxPlayers];
  13850.   this.aStreamArray895s = new Stream[this.maxPlayers];
  13851.   this.anInt897 = 1;
  13852.   this.anIntArrayArray901 = new int[104][104];
  13853.   this.anInt902 = 7759444;
  13854.   this.aByteArray912 = new byte[16384];
  13855.   this.currentStats = new int[27];
  13856.   this.ignoreListAsLongs = new long[100];
  13857.   this.loadingError = false;
  13858.   this.anInt927 = 3353893;
  13859.   this.anIntArray928 = new int[5];
  13860.   this.anIntArrayArray929 = new int[104][104];
  13861.   this.chatTypes = new int[500];
  13862.   this.chatNames = new String[500];
  13863.   this.chatMessages = new String[500];
  13864.   this.chatButtons = new Sprite[4];
  13865.   this.sideIcons = new Sprite[14];
  13866.   this.sIcons483 = new Sprite[14];
  13867.   this.tabSelected = new Sprite[3];
  13868.   this.newSideIcons = new Sprite[16];
  13869.   this.sIcons459 = new Sprite[13];
  13870.  
  13871.   this.redStones = new Sprite[16];
  13872.   this.aBoolean954 = true;
  13873.   this.friendsListAsLongs = new long['È'];
  13874.   this.currentSong = -1;
  13875.   this.drawingFlames = false;
  13876.   this.spriteDrawX = -1;
  13877.   this.spriteDrawY = -1;
  13878.   this.compassClipRight = new int[33];
  13879.  
  13880.   this.decompressors = new Decompressor[5];
  13881.   this.variousSettings = new int[2000];
  13882.   this.aBoolean972 = false;
  13883.   this.maxChatsAtTime = 50;
  13884.   this.chatDrawXArray = new int[this.maxChatsAtTime];
  13885.   this.chatDrawYArray = new int[this.maxChatsAtTime];
  13886.   this.anIntArray978 = new int[this.maxChatsAtTime];
  13887.   this.anIntArray979 = new int[this.maxChatsAtTime];
  13888.   this.chatColorArray = new int[this.maxChatsAtTime];
  13889.   this.chatAnimArray = new int[this.maxChatsAtTime];
  13890.   this.chatCycleArray = new int[this.maxChatsAtTime];
  13891.   this.chatSpokenArray = new String[this.maxChatsAtTime];
  13892.   this.anInt985 = -1;
  13893.   this.hitMarks = new Sprite[24];
  13894.   this.hitMark = new Sprite[4];
  13895.   this.charEditColors = new int[5];
  13896.   this.aBoolean994 = false;
  13897.   this.anInt1002 = 2301979;
  13898.   this.amountOrNameInput = "";
  13899.   this.aClass19_1013 = new NodeList();
  13900.   this.aBoolean1017 = false;
  13901.   this.anInt1018 = -1;
  13902.   this.anIntArray1030 = new int[5];
  13903.   this.charEditChanged = false;
  13904.   this.mapFunctions = new Sprite[100];
  13905.   this.dialogID = -1;
  13906.   this.maxStats = new int[27];
  13907.   this.anIntArray1045 = new int[2000];
  13908.   this.charEditGender = true;
  13909.   this.minimapClipRight = new int['˜'];
  13910.   this.anInt1054 = -1;
  13911.   this.aClass19_1056 = new NodeList();
  13912.   this.compassClipLeft = new int[33];
  13913.   this.aClass9_1059 = new RSInterface();
  13914.   this.mapScenes = new Background[100];
  13915.   this.barFillColor = 5063219;
  13916.   this.charEditIdKit = new int[7];
  13917.   this.anIntArray1072 = new int[1000];
  13918.   this.anIntArray1073 = new int[1000];
  13919.   this.aBoolean1080 = false;
  13920.   this.friendsList = new String['È'];
  13921.   this.inStream = Stream.create();
  13922.   this.expectedCRCs = new int[9];
  13923.   this.menuActionCmd2 = new int[500];
  13924.   this.menuActionCmd3 = new int[500];
  13925.   this.menuActionID = new int[500];
  13926.   this.menuActionCmd1 = new int[500];
  13927.   this.headIcons = new Sprite[29];
  13928.   this.skullIcons = new Sprite[20];
  13929.   this.headIconsHint = new Sprite[20];
  13930.   tabAreaAltered = false;
  13931.   this.inputPromptTitle = "";
  13932.   this.atPlayerActions = new String[5];
  13933.   this.atPlayerArray = new boolean[5];
  13934.   this.anIntArrayArrayArray1129 = new int[4][13][13];
  13935.   this.anInt1132 = 2;
  13936.   this.aSpriteArray1140 = new Sprite[1000];
  13937.   this.aBoolean1141 = false;
  13938.   this.aBoolean1149 = false;
  13939.   this.crosses = new Sprite[8];
  13940.   this.musicEnabled = true;
  13941.   needDrawTabArea = false;
  13942.   this.loggedIn = false;
  13943.   this.canMute = false;
  13944.   this.loadGeneratedMap = false;
  13945.   this.aBoolean1160 = false;
  13946.   this.anInt1171 = 1;
  13947.   myUsername = "";
  13948.   myPassword = "";
  13949.   this.genericLoadingError = false;
  13950.   this.reportAbuseInterfaceID = -1;
  13951.   this.aClass19_1179 = new NodeList();
  13952.   this.anInt1184 = 128;
  13953.   this.invOverlayInterfaceID = -1;
  13954.   this.stream = Stream.create();
  13955.   this.menuActionName = new String[500];
  13956.   this.anIntArray1203 = new int[5];
  13957.   this.anIntArray1207 = new int[50];
  13958.   this.anInt1210 = 2;
  13959.   chatAreaScrollPos = 78;
  13960.   this.promptInput = "";
  13961.  
  13962.   this.modIcons = new Sprite[7];
  13963.   this.chatImages = new Sprite[7];
  13964.   tabID = 3;
  13965.   inputTaken = false;
  13966.   this.songChanging = true;
  13967.   this.minimapClipLeft = new int['˜'];
  13968.   this.aClass11Array1230 = new Class11[4];
  13969.  
  13970.   this.anIntArray1241 = new int[50];
  13971.   this.aBoolean1242 = false;
  13972.   this.anIntArray1250 = new int[50];
  13973.   this.rsAlreadyLoaded = false;
  13974.   this.welcomeScreenRaised = true;
  13975.   this.messagePromptRaised = false;
  13976.   this.loginMessage1 = "";
  13977.   this.loginMessage2 = "";
  13978.   this.backDialogID = -1;
  13979.   this.anInt1279 = 2;
  13980.   this.bigX = new int[4000];
  13981.   this.bigY = new int[4000];
  13982.   this.anInt1289 = -1;
  13983. }
  13984.  
  13985. public void resetAllImageProducers()
  13986. {
  13987.   if (this.fullGameScreen != null) {
  13988.     return;
  13989.   }
  13990.   this.chatArea = null;
  13991.   this.miniMapArea = null;
  13992.   this.tabArea = null;
  13993.   this.mainGameArea = null;
  13994.  
  13995.   this.aRSImageProducer_1125 = null;
  13996.   this.aRSImageProducer_1107 = null;
  13997.   this.aRSImageProducer_1108 = null;
  13998.   this.loginScreenArea = null;
  13999.   this.leftSideFlame = null;
  14000.   this.rightSideFlame = null;
  14001.   this.gameLogo = null;
  14002.   this.aRSImageProducer_1113 = null;
  14003.   this.aRSImageProducer_1114 = null;
  14004.   this.aRSImageProducer_1115 = null;
  14005.   this.fullGameScreen = new RSImageProducer(765, 503, getGameComponent());
  14006.   this.welcomeScreenRaised = true;
  14007. }
  14008.  
  14009. public int getSpriteID() {
  14010.   this.spriteChanged = true;
  14011.   if (this.is562)
  14012.     return 4;
  14013.   if (this.is459)
  14014.     return 3;
  14015.   if (this.is480)
  14016.     return 2;
  14017.   if ((this.is508) || (this.is525))
  14018.     return 1;
  14019.   if (this.is474) {
  14020.     return 0;
  14021.   }
  14022.   return 0;
  14023. }
  14024. public void launchURL(String url) {
  14025.   String osName = System.getProperty("os.name");
  14026.   try {
  14027.     if (osName.startsWith("Mac OS")) {
  14028.       Class fileMgr = Class.forName("com.apple.eio.FileManager");
  14029.       Method openURL = fileMgr.getDeclaredMethod("openURL", new Class[] { String.class });
  14030.       openURL.invoke(null, new Object[] { url });
  14031.     } else if (osName.startsWith("Windows")) {
  14032.       Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + url);
  14033.     } else {
  14034.       String[] browsers = { "firefox", "opera", "konqueror", "epiphany", "mozilla", "netscape", "safari" };
  14035.       String browser = null;
  14036.       for (int count = 0; (count < browsers.length) && (browser == null); count++)
  14037.         if (Runtime.getRuntime().exec(new String[] { "which", browsers[count] }).waitFor() == 0)
  14038.           browser = browsers[count];
  14039.       if (browser == null) {
  14040.         throw new Exception("Could not find web browser");
  14041.       }
  14042.       Runtime.getRuntime().exec(new String[] { browser, url });
  14043.     }
  14044.   } catch (Exception e) {
  14045.     pushMessage("Failed to open URL.", 0, "");
  14046.   }
  14047. }
  14048.  
  14049. public boolean is459 = false;
  14050. public boolean is474 = false;
  14051. public boolean is480 = false;
  14052. public boolean is508 = false;
  14053. public boolean is525 = false;
  14054. public boolean is562 = true;
  14055. public Sprite alertBack;
  14056. public Sprite alertBorder;
  14057. public Sprite alertBorderH;
  14058. Sprite[] interactionHovers = new Sprite[9];
  14059. public int MapX;
  14060. public int MapY;
  14061. private Sprite HPBarFull;
  14062. private Sprite HPBarEmpty;
  14063. public Sprite[] ORBS = new Sprite[23];
  14064. public Sprite[] LOGOUT = new Sprite[5];
  14065. public Sprite xpOrb;
  14066. public Sprite xpCounter;
  14067. public Sprite xpFlag;
  14068. int restOpacity = 125;
  14069. public int rights;
  14070. public Sprite Increase;
  14071. public Sprite Decrease;
  14072. private Sprite StaffToggle;
  14073. private Sprite StaffType;
  14074. private Sprite StaffSelectBg;
  14075. private Sprite StaffSelect;
  14076. private Sprite StaffSelectH;
  14077. private Sprite StaffSelected;
  14078. private Sprite StaffSend;
  14079. private Sprite StaffError;
  14080. public String name;
  14081. public String disabledMessage;
  14082. public String clanname;
  14083. private final int[] chatRights;
  14084. private final String[] clanNames;
  14085. public int chatTypeView;
  14086. public int clanChatMode;
  14087. public int duelMode;
  14088. private Sprite reestablish;
  14089. private Sprite[] chatButtons;
  14090. private Sprite mapArea;
  14091. private Sprite tabHover;
  14092. private Sprite tabClicked;
  14093. private Sprite[] tabSelected;
  14094. private Sprite[] newSideIcons;
  14095. public Sprite[] CustomMapback = new Sprite[5];
  14096. public Sprite[] chatBack = new Sprite[5];
  14097. public Sprite[] tabBack = new Sprite[5];
  14098. private RSImageProducer leftFrame;
  14099. private RSImageProducer topFrame;
  14100. private RSImageProducer rightFrame;
  14101. private int ignoreCount;
  14102. private long aLong824;
  14103. private int[][] anIntArrayArray825;
  14104. private int[] friendsNodeIDs;
  14105. private NodeList[][][] groundArray;
  14106. private volatile boolean aBoolean831;
  14107. private int loginScreenState;
  14108. private Stream aStream_834;
  14109. private Npc[] npcArray;
  14110. private int npcCount;
  14111. private int[] npcIndices;
  14112. private int anInt839;
  14113. private int[] anIntArray840;
  14114. private int anInt841;
  14115. private int anInt842;
  14116. private int anInt843;
  14117. private String chatBoxMessage;
  14118. private int privateChatMode;
  14119. private Stream aStream_847;
  14120. private boolean soundEffectsEnabled;
  14121. private static int anInt849;
  14122. private int[] anIntArray851;
  14123. private int[] anIntArray852;
  14124. private int[] anIntArray853;
  14125. private static int anInt854;
  14126. private int anInt855;
  14127. public static int openInterfaceID;
  14128. private int xCameraPos;
  14129. private int zCameraPos;
  14130. private int yCameraPos;
  14131. private int yCameraCurve;
  14132. private int xCameraCurve;
  14133. public int myPrivilege;
  14134. private final int[] currentExp;
  14135. private Sprite[] redStones;
  14136. private Sprite mapFlag;
  14137. private Sprite mapMarker;
  14138. private final int[] anIntArray873;
  14139. private int anInt874;
  14140. private final boolean[] aBooleanArray876;
  14141. private int weight;
  14142. private MouseDetection mouseDetection;
  14143. private volatile boolean drawFlames;
  14144. private String reportAbuseInput;
  14145. private int unknownInt10;
  14146. private boolean menuOpen;
  14147. private int anInt886;
  14148. private String inputString;
  14149. private final int maxPlayers;
  14150. private final int myPlayerIndex;
  14151. private Player[] playerArray;
  14152. private int playerCount;
  14153. private int[] playerIndices;
  14154. private int anInt893;
  14155. private int[] anIntArray894;
  14156. private Stream[] aStreamArray895s;
  14157. private int anInt896;
  14158. private int anInt897;
  14159. private int friendsCount;
  14160. private int anInt900;
  14161. private int[][] anIntArrayArray901;
  14162. private final int anInt902;
  14163. private byte[] aByteArray912;
  14164. private int anInt913;
  14165. private int crossX;
  14166. private int crossY;
  14167. private int crossIndex;
  14168. private int crossType;
  14169. private int plane;
  14170. private final int[] currentStats;
  14171. private static int anInt924;
  14172. private final long[] ignoreListAsLongs;
  14173. private boolean loadingError;
  14174. private final int anInt927;
  14175. private final int[] anIntArray928;
  14176. private int[][] anIntArrayArray929;
  14177. private Sprite aSprite_931;
  14178. private Sprite aSprite_932;
  14179. private int anInt933;
  14180. private int anInt934;
  14181. private int anInt935;
  14182. private int anInt936;
  14183. private int anInt937;
  14184. private int anInt938;
  14185. private final int[] chatTypes;
  14186. private final String[] chatNames;
  14187. private final String[] chatMessages;
  14188. private int animationTimePassed;
  14189. private WorldController sceneGraph;
  14190. private Sprite[] sideIcons;
  14191. private Sprite[] sIcons483;
  14192. private Sprite[] sIcons459;
  14193. private int menuScreenArea;
  14194. private int menuOffsetX;
  14195. private int menuOffsetY;
  14196. private int menuWidth;
  14197. private int menuHeight;
  14198. private long aLong953;
  14199. private boolean aBoolean954;
  14200. private long[] friendsListAsLongs;
  14201. private String[] clanList = new String[100];
  14202. private int currentSong;
  14203. private static int nodeID = 10;
  14204. static int portOff;
  14205. static boolean clientData;
  14206. private static boolean isMembers = true;
  14207. private static boolean lowMem;
  14208. private volatile boolean drawingFlames;
  14209. private int spriteDrawX;
  14210. private int spriteDrawY;
  14211. private final int[] chatColor = {
  14212.   16776960, 16711680, 65280, 65535, 16711935, 16777215 };
  14213. public Sprite titleBox1;
  14214. private final int[] compassClipRight;
  14215. final Decompressor[] decompressors;
  14216. public int[] variousSettings;
  14217. private boolean aBoolean972;
  14218. private final int maxChatsAtTime;
  14219. private final int[] chatDrawXArray;
  14220. private final int[] chatDrawYArray;
  14221. private final int[] anIntArray978;
  14222. private final int[] anIntArray979;
  14223. private final int[] chatColorArray;
  14224. private final int[] chatAnimArray;
  14225. private final int[] chatCycleArray;
  14226. private final String[] chatSpokenArray;
  14227. private int anInt984;
  14228. private int anInt985;
  14229. private static int anInt986;
  14230. private Sprite[] hitMarks;
  14231. private Sprite[] hitMark;
  14232. private Sprite[] newHitMark = new Sprite[7];
  14233. private int anInt988;
  14234. private int anInt989;
  14235. private final int[] charEditColors;
  14236. private final boolean aBoolean994;
  14237. private int anInt995;
  14238. private int anInt996;
  14239. private int anInt997;
  14240. private int anInt998;
  14241. private int anInt999;
  14242. private ISAACRandomGen encryption;
  14243. private Sprite mapEdge;
  14244. private Sprite multiOverlay;
  14245. private final int anInt1002;
  14246. static final int[][] chatEditColorChoises = {
  14247.   {
  14248.   6798, 107, 10283, 16, 4797, 7744, 5799, 4634, 33697, 22433,
  14249.   2983, 54193 },
  14250.   {
  14251.   8741, 12, 64030, 43162, 7735, 8404, 1701, 38430, 24094, 10153,
  14252.   56621, 4783, 1341, 16578, 35003, 25239 },
  14253.   {
  14254.   25238, 8742, 12, 64030, 43162, 7735, 8404, 1701, 38430, 24094,
  14255.   10153, 56621, 4783, 1341, 16578, 35003 },
  14256.   {
  14257.   4626, 11146, 6439, 12, 4758, 10270 },
  14258.   {
  14259.   4550, 4537, 5681, 5673, 5790, 6806, 8076, 4574 } };
  14260. private String amountOrNameInput;
  14261. private static int anInt1005;
  14262. private int daysSinceLastLogin;
  14263. private int pktSize;
  14264. private int pktType;
  14265. private int anInt1009;
  14266. private int anInt1010;
  14267. private int anInt1011;
  14268. private NodeList aClass19_1013;
  14269. private int anInt1014;
  14270. private int anInt1015;
  14271. private int anInt1016;
  14272. private boolean aBoolean1017;
  14273. private int anInt1018;
  14274. private int miniMapOverlay;
  14275. private int anInt1022;
  14276. private int loadingStage;
  14277. private Sprite scrollBar1;
  14278. private Sprite scrollBar2;
  14279. private Sprite scrollBar3;
  14280. private Sprite scrollBar4;
  14281. private int anInt1026;
  14282. private final int[] anIntArray1030;
  14283. private boolean charEditChanged;
  14284. private Sprite[] mapFunctions;
  14285. private int baseX;
  14286. private int baseY;
  14287. private int anInt1036;
  14288. private int anInt1037;
  14289. private int loginFailures;
  14290. private int anInt1039;
  14291. private int dialogID;
  14292. private final int[] maxStats;
  14293. private final int[] anIntArray1045;
  14294. private int anInt1046;
  14295. private boolean charEditGender;
  14296. private int anInt1048;
  14297. private String loadingText;
  14298. private static int anInt1051;
  14299. private final int[] minimapClipRight;
  14300. private NamedArchive titleStreamLoader;
  14301. private int anInt1054;
  14302. private int anInt1055;
  14303. private NodeList aClass19_1056;
  14304. private final int[] compassClipLeft;
  14305. public final RSInterface aClass9_1059;
  14306. private Background[] mapScenes;
  14307. private int anInt1062;
  14308. private final int barFillColor;
  14309. private int friendsListAction;
  14310. private final int[] charEditIdKit;
  14311. private int mouseInvInterfaceIndex;
  14312. private int lastActiveInvInterface;
  14313. public OnDemandFetcher onDemandFetcher;
  14314. private int anInt1069;
  14315. private int anInt1070;
  14316. private int anInt1071;
  14317. private int[] anIntArray1072;
  14318. private int[] anIntArray1073;
  14319. private Sprite mapDotItem;
  14320. private Sprite mapDotNPC;
  14321. private Sprite mapDotPlayer;
  14322. private Sprite mapDotFriend;
  14323. private Sprite mapDotTeam;
  14324. private Sprite mapDotClan;
  14325. private int loadingPercent;
  14326. public float LP;
  14327. private boolean aBoolean1080;
  14328. private String[] friendsList;
  14329. private Stream inStream;
  14330. private int anInt1084;
  14331. private int anInt1085;
  14332. private int activeInterfaceType;
  14333. private int anInt1087;
  14334. private int anInt1088;
  14335. public static int chatAreaScrollMax;
  14336. private final int[] expectedCRCs;
  14337. public int[] menuActionCmd2;
  14338. public int[] menuActionCmd3;
  14339. public int[] menuActionID;
  14340. public int[] menuActionCmd1;
  14341. private Sprite[] headIcons;
  14342. private Sprite[] skullIcons;
  14343. private Sprite[] headIconsHint;
  14344. private static int anInt1097;
  14345. private int anInt1098;
  14346. private int anInt1099;
  14347. private int anInt1100;
  14348. private int anInt1101;
  14349. private int anInt1102;
  14350. public static boolean tabAreaAltered;
  14351. private int anInt1104;
  14352. private RSImageProducer aRSImageProducer_1107;
  14353. private RSImageProducer aRSImageProducer_1108;
  14354. private RSImageProducer loginScreenArea;
  14355. private RSImageProducer leftSideFlame;
  14356. private RSImageProducer rightSideFlame;
  14357. private RSImageProducer gameLogo;
  14358. private RSImageProducer aRSImageProducer_1113;
  14359. private RSImageProducer aRSImageProducer_1114;
  14360. private RSImageProducer aRSImageProducer_1115;
  14361. private static int anInt1117;
  14362. private int membersInt;
  14363. private String inputPromptTitle;
  14364. private Sprite compass;
  14365. private RSImageProducer aRSImageProducer_1125;
  14366. public static Player myPlayer;
  14367. private final String[] atPlayerActions;
  14368. private final boolean[] atPlayerArray;
  14369. private final int[][][] anIntArrayArrayArray1129;
  14370. public static final int[] tabInterfaceIDs = {
  14371.   -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  14372.   -1, -1, -1, -1, -1, -1, -1 };
  14373. private int anInt1131;
  14374. private int anInt1132;
  14375. public int menuActionRow;
  14376. private static int anInt1134;
  14377. private int spellSelected;
  14378. private int anInt1137;
  14379. private int spellUsableOn;
  14380. private String spellTooltip;
  14381. private Sprite[] aSpriteArray1140;
  14382. private boolean aBoolean1141;
  14383. private static int anInt1142;
  14384. public int energy;
  14385. private boolean aBoolean1149;
  14386. private Sprite[] crosses;
  14387. private boolean musicEnabled;
  14388. private Background[] aBackgroundArray1152s;
  14389. public static boolean needDrawTabArea;
  14390. private int unreadMessages;
  14391. private static int anInt1155;
  14392. private static boolean fpsOn;
  14393. public boolean loggedIn;
  14394. private boolean canMute;
  14395. private boolean loadGeneratedMap;
  14396. private boolean aBoolean1160;
  14397. public static int loopCycle;
  14398. private static final String validUserPassChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!\"£$%^&*()-_=+[{]};:'@#~,<.>/?\\| ";
  14399. private RSImageProducer tabArea;
  14400. private RSImageProducer mapEdgeIP;
  14401. private RSImageProducer miniMapArea;
  14402. static RSImageProducer mainGameArea;
  14403. private RSImageProducer chatArea;
  14404. private int daysSinceRecovChange;
  14405. private RSSocket socketStream;
  14406. private int minimapInt3;
  14407. private int anInt1171;
  14408. private long aLong1172;
  14409. private static String myUsername;
  14410. private static String myPassword;
  14411. private static int anInt1175;
  14412. private boolean genericLoadingError;
  14413. private final int[] anIntArray1177 = {
  14414.   0, 0, 0, 0, 1, 1, 1, 1, 1, 2,
  14415.   2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  14416.   2, 2, 3 };
  14417. private int reportAbuseInterfaceID;
  14418. private NodeList aClass19_1179;
  14419. private int[] anIntArray1180;
  14420. private int[] anIntArray1181;
  14421. static int[] anIntArray1182;
  14422. private byte[][] terrainData;
  14423. private int anInt1184;
  14424. private int minimapInt1;
  14425. private int anInt1186;
  14426. private int anInt1187;
  14427. private static int anInt1188;
  14428. private int invOverlayInterfaceID;
  14429. private int[] anIntArray1190;
  14430. private int[] anIntArray1191;
  14431. public Stream stream;
  14432. private int anInt1193;
  14433. private int splitPrivateChat;
  14434. private Background mapBack;
  14435. public String[] menuActionName;
  14436. private Sprite aSprite_1201;
  14437. private Sprite aSprite_1202;
  14438. private final int[] anIntArray1203;
  14439. public static final int[] anIntArray1204 = {
  14440.   9104, 10275, 7595, 3610, 7975, 8526, 918, 38802, 24466, 10145,
  14441.   58654, 5027, 1457, 16565, 34991, 25486 };
  14442. private static boolean flagged;
  14443. private final int[] anIntArray1207;
  14444. private int minimapInt2;
  14445. private int anInt1210;
  14446. public static int chatAreaScrollPos;
  14447. private String promptInput;
  14448. private int anInt1213;
  14449. private int[][][] intGroundArray;
  14450. private long aLong1215;
  14451. private int loginScreenCursorPos;
  14452. public final Sprite[] modIcons;
  14453. private long aLong1220;
  14454. public static int tabID;
  14455. private int anInt1222;
  14456. public static boolean inputTaken;
  14457. public int inputDialogState;
  14458. private static int anInt1226;
  14459. private int nextSong;
  14460. private boolean songChanging;
  14461. private final int[] minimapClipLeft;
  14462. private Class11[] aClass11Array1230;
  14463. public static int[] anIntArray1232;
  14464. private int[] mapCoordinates;
  14465. private int[] terrainIndices;
  14466. private int[] anIntArray1236;
  14467. private int anInt1237;
  14468. private int anInt1238;
  14469. public final int anInt1239 = 100;
  14470. private final int[] anIntArray1241;
  14471. private boolean aBoolean1242;
  14472. private int atInventoryLoopCycle;
  14473. private int atInventoryInterface;
  14474. private int atInventoryIndex;
  14475. private int atInventoryInterfaceType;
  14476. private byte[][] aByteArrayArray1247;
  14477. private int tradeMode;
  14478. private int anInt1249;
  14479. private final int[] anIntArray1250;
  14480. private int anInt1251;
  14481. private final boolean rsAlreadyLoaded;
  14482. private int anInt1253;
  14483. private int anInt1254;
  14484. private boolean welcomeScreenRaised;
  14485. private boolean messagePromptRaised;
  14486. private int anInt1257;
  14487. private byte[][][] byteGroundArray;
  14488. private int prevSong;
  14489. private int destX;
  14490. private int destY;
  14491. private Sprite minimap;
  14492. private int anInt1264;
  14493. private int anInt1265;
  14494. private String loginMessage1;
  14495. private String loginMessage2;
  14496. private int anInt1268;
  14497. private int anInt1269;
  14498. public RSFont smallFont;
  14499. public RSFont regularFont;
  14500. private RSFont boldFont;
  14501. private RSFont fancyFont;
  14502. private int backDialogID;
  14503. private int anInt1278;
  14504. private int anInt1279;
  14505. private int[] bigX;
  14506. private int[] bigY;
  14507. private int itemSelected;
  14508. private int anInt1283;
  14509. private int anInt1284;
  14510. private int anInt1285;
  14511. private String selectedItemName;
  14512. private int publicChatMode;
  14513. private int yellChatMode;
  14514. private static int anInt1288;
  14515. private int anInt1289;
  14516. public static int anInt1290;
  14517. public int drawCount;
  14518. public int fullscreenInterfaceID;
  14519. public int anInt1044;
  14520. public int anInt1129;
  14521. public int anInt1315;
  14522. public int anInt1500;
  14523. public int anInt1501;
  14524. public int[] fullScreenTextureArray;
  14525. public boolean spriteChanged = false;
  14526. public Sprite[] cacheSprite;
  14527. }
Advertisement
Add Comment
Please, Sign In to add comment