Advertisement
Guest User

Untitled

a guest
Oct 24th, 2016
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 492.23 KB | None | 0 0
  1. package org.ruse.client;
  2.  
  3. import java.applet.AppletContext;
  4. import java.awt.Color;
  5. import java.awt.Component;
  6. import java.awt.Cursor;
  7. import java.awt.Dimension;
  8. import java.awt.Font;
  9. import java.awt.Graphics;
  10. import java.awt.Toolkit;
  11. import java.awt.image.BufferedImage;
  12. import java.io.BufferedInputStream;
  13. import java.io.DataInputStream;
  14. import java.io.DataOutputStream;
  15. import java.io.EOFException;
  16. import java.io.File;
  17. import java.io.FileInputStream;
  18. import java.io.FileOutputStream;
  19. import java.io.IOException;
  20. import java.io.OutputStream;
  21. import java.lang.reflect.Method;
  22. import java.net.InetAddress;
  23. import java.net.Socket;
  24. import java.net.URL;
  25. import java.net.UnknownHostException;
  26. import java.text.DecimalFormat;
  27. import java.text.SimpleDateFormat;
  28. import java.util.ArrayList;
  29. import java.util.Arrays;
  30. import java.util.Date;
  31. import java.util.Objects;
  32. import java.util.Random;
  33. import java.util.regex.Pattern;
  34. import java.util.zip.CRC32;
  35. import javax.imageio.ImageIO;
  36.  
  37. import org.ruse.Configuration;
  38. import org.ruse.client.accounts.Account;
  39. import org.ruse.client.accounts.AccountManager;
  40. import org.ruse.client.cache.Archive;
  41. import org.ruse.client.cache.definition.Animation;
  42. import org.ruse.client.cache.definition.Flo;
  43. import org.ruse.client.cache.definition.IdentityKit;
  44. import org.ruse.client.cache.definition.ItemDefinition;
  45. import org.ruse.client.cache.definition.MobDefinition;
  46. import org.ruse.client.cache.definition.ObjectDefinition;
  47. import org.ruse.client.cache.definition.OverLayFlo317;
  48. import org.ruse.client.cache.definition.SpotAnimDefinition;
  49. import org.ruse.client.cache.definition.VarBit;
  50. import org.ruse.client.cache.definition.Varp;
  51. import org.ruse.client.cache.node.Deque;
  52. import org.ruse.client.cache.node.Node;
  53. import org.ruse.client.cache.ondemand.OnDemandFetcher;
  54. import org.ruse.client.cache.ondemand.OnDemandRequest;
  55. import org.ruse.client.constants.GameFrameConstants;
  56. import org.ruse.client.constants.SizeConstants;
  57. import org.ruse.client.constants.GameFrameConstants.GameFrameType;
  58. import org.ruse.client.entity.player.Player;
  59. import org.ruse.client.entity.player.PlayerHandler;
  60. import org.ruse.client.graphics.Background;
  61. import org.ruse.client.graphics.CursorData;
  62. import org.ruse.client.graphics.DrawingArea;
  63. import org.ruse.client.graphics.RSImageProducer;
  64. import org.ruse.client.graphics.Sprite;
  65. import org.ruse.client.graphics.SpriteLoader;
  66. import org.ruse.client.graphics.fonts.Censor;
  67. import org.ruse.client.graphics.fonts.RSFontSystem;
  68. import org.ruse.client.graphics.fonts.TextClass;
  69. import org.ruse.client.graphics.fonts.TextDrawingArea;
  70. import org.ruse.client.graphics.fonts.TextInput;
  71. import org.ruse.client.graphics.gameframe.GameFrame;
  72. import org.ruse.client.graphics.gameframe.GameFrame.ScreenMode;
  73. import org.ruse.client.graphics.gameframe.impl.ChatArea;
  74. import org.ruse.client.graphics.gameframe.impl.MapArea;
  75. import org.ruse.client.graphics.gameframe.impl.TabArea;
  76. import org.ruse.client.graphics.rsinterface.DamageDealer;
  77. import org.ruse.client.graphics.rsinterface.GrandExchange;
  78. import org.ruse.client.graphics.rsinterface.MagicInterfaceData;
  79. import org.ruse.client.graphics.rsinterface.PetSystem;
  80. import org.ruse.client.io.ByteBuffer;
  81. import org.ruse.client.io.ISAACCipher;
  82. import org.ruse.client.net.Connection;
  83. import org.ruse.client.net.HttpDownloadUtility;
  84. import org.ruse.client.renderable.Animable;
  85. import org.ruse.client.renderable.Animable_Sub3;
  86. import org.ruse.client.renderable.Animable_Sub5;
  87. import org.ruse.client.renderable.Entity;
  88. import org.ruse.client.renderable.Item;
  89. import org.ruse.client.renderable.NPC;
  90. import org.ruse.client.renderable.PlayerProjectile;
  91. import org.ruse.client.tools.FileUtilities;
  92. import org.ruse.client.world.CollisionMap;
  93. import org.ruse.client.world.CustomObjects;
  94. import org.ruse.client.world.Model;
  95. import org.ruse.client.world.Object1;
  96. import org.ruse.client.world.Object2;
  97. import org.ruse.client.world.Object3;
  98. import org.ruse.client.world.Object5;
  99. import org.ruse.client.world.ObjectManager;
  100. import org.ruse.client.world.Rasterizer;
  101. import org.ruse.client.world.Texture;
  102. import org.ruse.client.world.WorldController;
  103. import org.ruse.client.world.background.ScriptManager;
  104. import org.ruse.client.world.music.Class56;
  105. import org.ruse.client.world.music.Class56_Sub1_Sub1;
  106. import org.ruse.client.world.sound.Class25;
  107. import org.ruse.client.world.sound.Class3_Sub7;
  108. import org.ruse.client.world.sound.Class3_Sub7_Sub1;
  109. import org.ruse.client.world.sound.Class3_Sub7_Sub2;
  110. import org.ruse.client.world.sound.Class3_Sub9_Sub1;
  111. import org.ruse.client.world.sound.Class5;
  112. import org.ruse.client.world.sound.Class5_Sub1;
  113. import org.ruse.client.world.sound.Class5_Sub2;
  114. import org.ruse.client.world.sound.Class5_Sub2_Sub1;
  115. import org.ruse.client.world.sound.Class5_Sub2_Sub2;
  116. import org.ruse.client.world.sound.Sound;
  117. import org.ruse.client.world.sound.Sounds;
  118.  
  119. public class Client extends GameRenderer {
  120.  
  121. private AccountManager accountManager;
  122. private GrandExchange grandExchange;
  123.  
  124. public int mouseX() {
  125. return super.mouseX;
  126. }
  127.  
  128. public int mouseY() {
  129. return super.mouseY;
  130. }
  131.  
  132. public boolean mouseInRegion(int x1, int x2, int y1, int y2) {
  133. if (super.mouseX >= x1 && super.mouseX <= x2 && super.mouseY >= y1
  134. && super.mouseY <= y2) {
  135. return true;
  136. }
  137. return false;
  138. }
  139.  
  140. public static int clientZoom = 0;
  141.  
  142. public static final int CACHE_INDEX_COUNT = 6;
  143.  
  144. /**
  145. * The split chat color, by default its 65535
  146. */
  147. public int splitChatColor = 0;
  148.  
  149. /**
  150. * Is looting bag open
  151. */
  152. public boolean lootingBag = false;
  153.  
  154. /**
  155. * The split chat interface is open
  156. */
  157. public boolean splitChatInterfaceOpen = false;
  158. private static boolean aBoolean475;
  159. private static boolean aBoolean995;
  160. private static byte[] aByteArray347;
  161. private static Sound aClass1418;
  162. private static Class25 aClass25_1948;
  163. private static Sound[] aClass26Array1468 = new Sound[50];
  164. private static Class3_Sub7 aClass3_Sub7_1345;
  165. private static Class3_Sub7_Sub1 aClass3_Sub7_Sub1_1493;
  166. private static Class5 aClass5_932;
  167. private static Class56 aClass56_749;
  168. public static long aLong1432;
  169. private static int anInt1005;
  170. private long clientId;
  171. public static int anInt1089;
  172. private static int anInt1117;
  173. private static int anInt1134;
  174. private static int anInt1142;
  175. private static int anInt1155;
  176. private static int anInt116;
  177. private static int anInt1175;
  178. private static int anInt1188;
  179. public static int anInt1211;
  180. private static int anInt1226;
  181. private static int anInt1288;
  182. private static int anInt139;
  183. public static int anInt1401 = 256;
  184. private static int anInt1408;
  185. private static int anInt1478;
  186. private static int anInt1526;
  187. private static int anInt155 = 0;
  188. public static int anInt197;
  189. private static int anInt2200 = 0;
  190. private static int anInt478 = -1;
  191. private static int anInt720 = 0;
  192. private static int anInt849;
  193. private static int anInt854;
  194. private static int anInt924;
  195. private static int anInt986;
  196. private static final int[] anIntArray1019;
  197. public static final int[] anIntArray1204 = { 9104, 10275, 7595, 3610, 7975,
  198. 8526, 918, 38802, 24466, 10145, 58654, 5027, 1457, 16565, 34991,
  199. 25486 };
  200. public static int[] anIntArray1232;
  201. public static int[] anIntArray385 = new int[] { 12800, 12800, 12800, 12800,
  202. 12800, 12800, 12800, 12800, 12800, 12800, 12800, 12800, 12800,
  203. 12800, 12800, 12800 };
  204. public static final int[][] anIntArrayArray1003 = {
  205. { 6798, 107, 10283, 16, 4797, 7744, 5799, 4634, 33697, 22433, 2983,
  206. 54193 },
  207. { 8741, 12, 64030, 43162, 7735, 8404, 1701, 38430, 24094, 10153,
  208. 56621, 4783, 1341, 16578, 35003, 25239 },
  209. { 25238, 8742, 12, 64030, 43162, 7735, 8404, 1701, 38430, 24094,
  210. 10153, 56621, 4783, 1341, 16578, 35003 },
  211. { 4626, 11146, 6439, 12, 4758, 10270 },
  212. { 4550, 4537, 5681, 5673, 5790, 6806, 8076, 4574 } };
  213. public static Sprite[] cacheSprite;
  214. public static int clientHeight = 503;
  215. public static int clientWidth = 765;
  216. private static boolean fetchMusic = false;
  217. public static boolean flagged;
  218. private static final int[] IDs = { 1196, 1199, 1206, 1215, 1224, 1231,
  219. 1240, 1249, 1258, 1267, 1274, 1283, 1573, 1290, 1299, 1308, 1315,
  220. 1324, 1333, 1340, 1349, 1358, 1367, 1374, 1381, 1388, 1397, 1404,
  221. 1583, 12038, 1414, 1421, 1430, 1437, 1446, 1453, 1460, 1469, 15878,
  222. 1602, 1613, 1624, 7456, 1478, 1485, 1494, 1503, 1512, 1521, 1530,
  223. 1544, 1553, 1563, 1593, 1635, 12426, 12436, 12446, 12456, 6004,
  224. 18471,
  225. /* Ancients */
  226. 12940, 12988, 13036, 12902, 12862, 13046, 12964, 13012, 13054,
  227. 12920, 12882, 13062, 12952, 13000, 13070, 12912, 12872, 13080,
  228. 12976, 13024, 13088, 12930, 12892, 13096 };
  229. public static Client instance;
  230. private static boolean isMembers = true;
  231. private static ArrayList<Character> letterArray = new ArrayList<>();
  232. public static int log_view_dist = (int) (Math.log(clientWidth) / Math.log(2));
  233. public static int loopCycle;
  234. private static boolean lowDetail;
  235. private static byte[] musicData;
  236. private static int musicVolume2;
  237. public static Player myPlayer;
  238. private static String myUsername;
  239. private static final Pattern NAME_PATTERN = Pattern.compile("@.+@");
  240. private static int nodeID = 10;
  241. public static int openInterfaceID;
  242. private static ByteBuffer out;
  243. public static int portOff;
  244. private static final int[] runeChildren = { 1202, 1203, 1209, 1210, 1211,
  245. 1218, 1219, 1220, 1227, 1228, 1234, 1235, 1236, 1243, 1244, 1245,
  246. 1252, 1253, 1254, 1261, 1262, 1263, 1270, 1271, 1277, 1278, 1279,
  247. 1286, 1287, 1293, 1294, 1295, 1302, 1303, 1304, 1311, 1312, 1318,
  248. 1319, 1320, 1327, 1328, 1329, 1336, 1337, 1343, 1344, 1345, 1352,
  249. 1353, 1354, 1361, 1362, 1363, 1370, 1371, 1377, 1378, 1384, 1385,
  250. 1391, 1392, 1393, 1400, 1401, 1407, 1408, 1410, 1417, 1418, 1424,
  251. 1425, 1426, 1433, 1434, 1440, 1441, 1442, 1449, 1450, 1456, 1457,
  252. 1463, 1464, 1465, 1472, 1473, 1474, 1481, 1482, 1488, 1489, 1490,
  253. 1497, 1498, 1499, 1506, 1507, 1508, 1515, 1516, 1517, 1524, 1525,
  254. 1526, 1533, 1534, 1535, 1547, 1548, 1549, 1556, 1557, 1558, 1566,
  255. 1567, 1568, 1576, 1577, 1578, 1586, 1587, 1588, 1596, 1597, 1598,
  256. 1605, 1606, 1607, 1616, 1617, 1618, 1627, 1628, 1629, 1638, 1639,
  257. 1640, 6007, 6008, 6011, 8673, 8674, 12041, 12042, 12429, 12430,
  258. 12431, 12439, 12440, 12441, 12449, 12450, 12451, 12459, 12460,
  259. 15881, 15882, 15885, 18474, 18475, 18478 };
  260. private static final long serialVersionUID = -1913853327056220406L;
  261. private static String[] skillNames = { "Attack", "Constitution", "Mining",
  262. "Strength", "Agility", "Smithing", "Defence", "Herblore",
  263. "Fishing", "Range", "Thieving", "Cooking", "Prayer", "Crafting",
  264. "Firemaking", "Magic", "Fletching", "Woodcutting", "Runecrafting",
  265. "Slayer", "Farming", "Construction", "Hunter", "Summoning" };
  266. private static int soundEffectVolume = 127;
  267. private static int spellID = 0;
  268. public static boolean tabAreaAltered;
  269. public static int tabID;
  270. public static boolean LOOP_MUSIC;
  271. public final static int[] tabInterfaceIDs = { -1, -1, -1, -1, -1, -1, -1,
  272. -1, -1, -1, -1, -1, -1, -1, -1, -1 };
  273. private static final String validUserPassChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!\"\243$%^&*()-_=+[{]};:'@#~,<.>/?\\| ";
  274. public static final boolean Z_BUFFER_REPRESENTATION = false;
  275. public static final boolean GROUND_DECORATIONS = false;
  276. private String consoleInput;
  277. public static boolean consoleOpen;
  278. private final String[] consoleMessages;
  279. private int mapX, mapY;
  280.  
  281. public void addObject(int x, int y, int objectId, int face, int type, int height) {
  282. int mX = mapX - 6;
  283. int mY = mapY - 6;
  284. int x2 = x - mX * 8;
  285. int y2 = y - mY * 8;
  286. int i15 = 40 >> 2;
  287. int l17 = anIntArray1177[i15];
  288. if (y2 > 0 && y2 < 103 && x2 > 0 && x2 < 103) {
  289. method130(-1, objectId, face, l17, y2, type, height, x2, 0);
  290. }
  291. }
  292.  
  293. static {
  294. anIntArray1019 = new int[99];
  295. int points = 0;
  296.  
  297. for (int i = 0; i < 99; i++) {
  298. int l = i + 1;
  299. int i1 = (int) (l + 300D * Math.pow(2D, l / 7D));
  300. points += i1;
  301. anIntArray1019[i] = points >> 2;
  302. }
  303.  
  304. anIntArray1232 = new int[32];
  305. points = 2;
  306.  
  307. for (int i = 0; i < 32; i++) {
  308. anIntArray1232[i] = points - 1;
  309. points += points;
  310. }
  311. }
  312.  
  313. public static String getFileNameWithoutExtension(String fileName) {
  314. File tmpFile = new File(fileName);
  315. tmpFile.getName();
  316. int whereDot = tmpFile.getName().lastIndexOf('.');
  317. if (0 < whereDot && whereDot <= tmpFile.getName().length() - 2) {
  318. return tmpFile.getName().substring(0, whereDot);
  319. }
  320. return "";
  321. }
  322.  
  323. public String indexLocation(int cacheIndex, int index) {
  324. return Signlink.getCacheDirectory().toString() + "/index" + cacheIndex + "/" + (index != -1 ? index + ".gz" : "");
  325.  
  326. }
  327.  
  328. public void repackCacheIndex(int cacheIndex) {
  329. System.out.println("Started repacking index " + cacheIndex + ".");
  330. int indexLength = new File(indexLocation(cacheIndex, -1)).listFiles().length;
  331. File[] file = new File(indexLocation(cacheIndex, -1)).listFiles();
  332. if(file == null || file.length == 0)
  333. return;
  334. try {
  335. for (int index = 0; index < indexLength; index++) {
  336. int fileIndex = Integer.parseInt(getFileNameWithoutExtension(file[index].toString()));
  337. byte[] data = fileToByteArray(cacheIndex, fileIndex);
  338. if (data != null && data.length > 0) {
  339. decompressors[cacheIndex].method234(data.length, data, fileIndex);
  340. System.out.println("Repacked Archive: " + cacheIndex + " File: " + fileIndex + ".");
  341. } else {
  342. System.out.println("Unable to locate index " + fileIndex + ".");
  343. }
  344. }
  345. } catch (Exception e) {
  346. System.out.println("Error packing cache index " + cacheIndex + ".");
  347. }
  348. System.out.println("Finished repacking " + cacheIndex + ".");
  349. }
  350.  
  351. public void updateSetting(int settingI, boolean b) {
  352. int l2 = RSInterface.interfaceCache[settingI].valueIndexArray[0][1];
  353. variousSettings[l2] = b ? 1 : 0;
  354. }
  355.  
  356. public void updateSettingsInterface() {
  357. updateSetting(26007, Configuration.NEW_FUNCTION_KEYS);
  358. updateSetting(26008, Configuration.NEW_HEALTH_BARS);
  359. updateSetting(26010, Configuration.NEW_CURSORS);
  360. updateSetting(26014, Configuration.NEW_HITMARKS);
  361. updateSetting(26026, Configuration.DISPLAY_HP_ABOVE_HEAD);
  362. updateSetting(26027, Configuration.DISPLAY_USERNAMES_ABOVE_HEAD);
  363. updateSetting(26029, Configuration.CONSTITUTION_ENABLED);
  364. updateSetting(26031, GameFrameConstants.gameframeType != GameFrameType.FRAME_525);
  365. updateSetting(26033, Configuration.NOTIFICATIONS_ENABLED);
  366. updateSetting(26054, !Configuration.HIGH_DETAIL);
  367. updateSetting(26058, Configuration.HIGH_DETAIL);
  368. }
  369.  
  370. /**
  371. * Saves the players data
  372. *
  373. * @throws IOException
  374. */
  375. public void savePlayerData() {
  376. try {
  377. File file = new File(Signlink.getCacheDirectory() + "/settings.dat");
  378. if (!file.exists()) {
  379. file.createNewFile();
  380. }
  381. DataOutputStream stream = new DataOutputStream(new FileOutputStream(file));
  382. if (stream != null) {
  383. stream.writeBoolean(Configuration.SAVE_ACCOUNTS);
  384. stream.writeBoolean(Configuration.NEW_FUNCTION_KEYS);
  385. stream.writeBoolean(Configuration.NEW_HEALTH_BARS);
  386. stream.writeBoolean(Configuration.NEW_HITMARKS);
  387. stream.writeBoolean(Configuration.CONSTITUTION_ENABLED);
  388. stream.writeBoolean(Configuration.NEW_CURSORS);
  389. stream.writeBoolean(Configuration.DISPLAY_HP_ABOVE_HEAD);
  390. stream.writeBoolean(Configuration.DISPLAY_USERNAMES_ABOVE_HEAD);
  391. stream.writeBoolean(GameFrameConstants.gameframeType == GameFrameType.FRAME_525 ? false : true);
  392. stream.writeBoolean(Configuration.NOTIFICATIONS_ENABLED);
  393. stream.writeBoolean(Configuration.HIGH_DETAIL);
  394. stream.writeInt(splitChatColor);
  395. stream.writeByte(variousSettings[502]); //Split private chat?
  396.  
  397. /*
  398. * Quick prayers & curses saving
  399. */
  400. String stringSave = "";
  401. for(int i = 0; i < quickPrayers.length; i++) {
  402. stringSave = stringSave + quickPrayers[i];
  403. }
  404. stream.writeUTF(stringSave);
  405. stringSave = "";
  406. for(int i = 0; i < quickCurses.length; i++) {
  407. stringSave = stringSave + quickCurses[i];
  408. }
  409. stream.writeUTF(stringSave);
  410.  
  411. stream.close();
  412. }
  413. } catch (IOException e) {
  414. e.printStackTrace();
  415. }
  416. }
  417.  
  418. /**
  419. * Loads the players data
  420. *
  421. * @throws IOException
  422. */
  423. private void loadPlayerData() throws IOException {
  424. File file = new File(Signlink.getCacheDirectory() + "/settings.dat");
  425.  
  426. if (!file.exists()) {
  427. return;
  428. }
  429.  
  430. DataInputStream stream = new DataInputStream(new FileInputStream(file));
  431.  
  432. try {
  433. Configuration.SAVE_ACCOUNTS = stream.readBoolean();
  434. Configuration.NEW_FUNCTION_KEYS = stream.readBoolean();
  435. Configuration.NEW_HEALTH_BARS = stream.readBoolean();
  436. Configuration.NEW_HITMARKS = stream.readBoolean();
  437. Configuration.CONSTITUTION_ENABLED = stream.readBoolean();
  438. Configuration.NEW_CURSORS = stream.readBoolean();
  439. Configuration.DISPLAY_HP_ABOVE_HEAD = stream.readBoolean();
  440. Configuration.DISPLAY_USERNAMES_ABOVE_HEAD = stream.readBoolean();
  441. GameFrameConstants.gameframeType = stream.readBoolean() ? GameFrameType.FRAME_554 : GameFrameType.FRAME_525;
  442. Configuration.NOTIFICATIONS_ENABLED = stream.readBoolean();
  443. Configuration.HIGH_DETAIL = stream.readBoolean();
  444. splitChatColor = stream.readInt();
  445. variousSettings[287] = variousSettings[502] = stream.readByte();
  446. updateConfig(287);
  447. if (!Configuration.HIGH_DETAIL) {
  448. setLowDetail();
  449. } else {
  450. setHighDetail();
  451. }
  452.  
  453. /*
  454. * Quick prayers / curses
  455. */
  456. String q = stream.readUTF();
  457. for (int i = 0; i < q.length(); i++)
  458. quickPrayers[i] = Integer.parseInt(q.substring(i, i+1));
  459. q = stream.readUTF();
  460. for (int i = 0; i < q.length(); i++)
  461. quickCurses[i] = Integer.parseInt(q.substring(i, i+1));
  462.  
  463. } catch (IOException e) {
  464. file.delete();
  465. } finally {
  466. stream.close();
  467. }
  468. }
  469.  
  470. public byte[] fileToByteArray(int cacheIndex, int index) {
  471. try {
  472. if (indexLocation(cacheIndex, index).length() <= 0 || indexLocation(cacheIndex, index) == null) {
  473. return null;
  474. }
  475. File file = new File(indexLocation(cacheIndex, index));
  476. byte[] fileData = new byte[(int) file.length()];
  477. FileInputStream fis = new FileInputStream(file);
  478. fis.read(fileData);
  479. fis.close();
  480. return fileData;
  481. } catch (Exception e) {
  482. return null;
  483. }
  484. }
  485.  
  486. public static String capitalize(String s) {
  487. return s.length() > 0 ? Character.toUpperCase(s.charAt(0)) + s.substring(1) : s;
  488. }
  489.  
  490. private static String combatDiffColor(int myCombatLevel, int targetCombatLevel) {
  491. int difference = myCombatLevel - targetCombatLevel;
  492.  
  493. if (difference < -9) {
  494. return "@red@";
  495. }
  496.  
  497. if (difference < -6) {
  498. return "@or3@";
  499. }
  500.  
  501. if (difference < -3) {
  502. return "@or2@";
  503. }
  504.  
  505. if (difference < 0) {
  506. return "@or1@";
  507. }
  508.  
  509. if (difference > 9) {
  510. return "@gre@";
  511. }
  512.  
  513. if (difference > 6) {
  514. return "@gr3@";
  515. }
  516.  
  517. if (difference > 3) {
  518. return "@gr2@";
  519. }
  520.  
  521. if (difference > 0) {
  522. return "@gr1@";
  523. }
  524.  
  525. return "@yel@";
  526. }
  527.  
  528. private static final boolean constructMusic() {
  529. anInt720 = 20;
  530.  
  531. try {
  532. aClass56_749 = new Class56_Sub1_Sub1();
  533. } catch (Throwable throwable) {
  534. return false;
  535. }
  536.  
  537. return true;
  538. }
  539.  
  540. private static String formatValue(double value, int digits) {
  541. PlayerHandler.format.setMaximumFractionDigits(digits);
  542. return PlayerHandler.format.format(value);
  543. }
  544.  
  545. private static final void handleSounds() {
  546. if (aClass5_932 != null) {
  547. long l = System.currentTimeMillis();
  548.  
  549. if (l > aLong1432) {
  550. aClass5_932.method489(l);
  551. int i_0_ = (int) (-aLong1432 + l);
  552. aLong1432 = l;
  553.  
  554. synchronized (Client.aClass1418 != null ? Client.aClass1418 : (Client.aClass1418 = new Sound())) {
  555. anInt1526 += anInt197 * i_0_;
  556. int i_1_ = (anInt1526 - anInt197 * 2000) / 1000;
  557.  
  558. if (i_1_ > 0) {
  559. if (aClass3_Sub7_1345 != null) {
  560. aClass3_Sub7_1345.method380(i_1_);
  561. }
  562.  
  563. anInt1526 -= i_1_ * 1000;
  564. }
  565. }
  566. }
  567. }
  568. }
  569.  
  570. private static String intToKOrMil(int value) {
  571. if (value < 0x186a0) {
  572. return String.valueOf(value);
  573. }
  574.  
  575. if (value < 0x989680) {
  576. return value / 1000 + "K";
  577. } else {
  578. return value / 0xf4240 + "M";
  579. }
  580. }
  581.  
  582. private static String intToKOrMilLongName(int i) {
  583. String s = String.valueOf(i);
  584.  
  585. for (int k = s.length() - 3; k > 0; k -= 3) {
  586. s = s.substring(0, k) + "," + s.substring(k);
  587. }
  588.  
  589. if (s.length() > 8) {
  590. s = "@gre@" + s.substring(0, s.length() - 8) + " million @whi@(" + s + ")";
  591. } else if (s.length() > 4) {
  592. s = "@cya@" + s.substring(0, s.length() - 4) + "K @whi@(" + s + ")";
  593. }
  594.  
  595. return " " + s;
  596. }
  597.  
  598. public static void main(String[] args) {
  599. portOff = 0;
  600. if (!Configuration.HIGH_DETAIL) {
  601. setLowDetail();
  602. } else {
  603. setHighDetail();
  604. }
  605. isMembers = true;
  606. Signlink.storeid = 32;
  607. try {
  608. Signlink.startpriv(InetAddress.getLocalHost());
  609. } catch (UnknownHostException e) {
  610. System.err.printf("Unable to determine localhost for your machine [localhost=%s]%n", e.getMessage());
  611. }
  612. GameFrame.setScreenMode(ScreenMode.FIXED);
  613. instance = new Client();
  614. instance.createClientFrame(clientWidth, clientHeight);
  615. }
  616.  
  617. public static Client getClient() {
  618. return instance;
  619. }
  620.  
  621. private static final int method1004(int i) {
  622. return (int) (Math.log(i * 0.00390625) * 868.5889638065036 + 0.5);
  623. }
  624.  
  625. private static final void method368(int i) {
  626. if (aClass56_749 != null) {
  627. if (anInt478 < i) {
  628. if (anInt720 > 0) {
  629. anInt720--;
  630.  
  631. if (anInt720 == 0) {
  632. if (aByteArray347 == null) {
  633. aClass56_749.method831(256);
  634. } else {
  635. aClass56_749.method831(anInt1478);
  636. anInt478 = anInt1478;
  637. aClass56_749.method827(anInt1478, aByteArray347, 0, aBoolean475);
  638. aByteArray347 = null;
  639. }
  640.  
  641. anInt155 = 0;
  642. }
  643. }
  644. } else if (anInt720 > 0) {
  645. anInt155 += anInt2200;
  646. aClass56_749.method830(anInt478, anInt155);
  647. anInt720--;
  648.  
  649. if (anInt720 == 0) {
  650. aClass56_749.method833();
  651. anInt720 = 20;
  652. anInt478 = -1;
  653. }
  654. }
  655.  
  656. aClass56_749.method832(i - 122);
  657. }
  658. }
  659.  
  660. private static final Class3_Sub7_Sub1 method407(Component component) {
  661. Client.method509(component);
  662. Class3_Sub7_Sub1 class3_sub7_sub1 = new Class3_Sub7_Sub1();
  663. method484(class3_sub7_sub1);
  664. return class3_sub7_sub1;
  665. }
  666.  
  667. private static final synchronized void method484(Class3_Sub7 class3_sub7) {
  668. aClass3_Sub7_1345 = class3_sub7;
  669. }
  670.  
  671. public static final synchronized void method486(int[] is, int i) {
  672. int i_2_ = 0;
  673. i -= 7;
  674.  
  675. while (i_2_ < i) {
  676. is[i_2_++] = 0;
  677. is[i_2_++] = 0;
  678. is[i_2_++] = 0;
  679. is[i_2_++] = 0;
  680. is[i_2_++] = 0;
  681. is[i_2_++] = 0;
  682. is[i_2_++] = 0;
  683. is[i_2_++] = 0;
  684. }
  685.  
  686. i += 7;
  687.  
  688. while (i_2_ < i) {
  689. is[i_2_++] = 0;
  690. }
  691.  
  692. if (aClass3_Sub7_1345 != null) {
  693. aClass3_Sub7_1345.method378(is, 0, i);
  694. }
  695.  
  696. method689(i);
  697. }
  698.  
  699. private static final synchronized void method49() {
  700. if (musicIsntNull()) {
  701. if (fetchMusic) {
  702. byte[] is = musicData;
  703.  
  704. if (is != null) {
  705. if (anInt116 >= 0) {
  706. method684(aBoolean995, anInt116, musicVolume2, is);
  707. } else if (anInt139 >= 0) {
  708. method899(anInt139, -1, aBoolean995, is, musicVolume2);
  709. } else {
  710. method853(musicVolume2, is, aBoolean995);
  711. }
  712.  
  713. fetchMusic = false;
  714. }
  715. }
  716.  
  717. method368(0);
  718. }
  719. }
  720.  
  721. public static final synchronized void method493(int i) {
  722. if (aClass3_Sub7_1345 != null) {
  723. aClass3_Sub7_1345.method380(i);
  724. }
  725.  
  726. method689(i);
  727. }
  728.  
  729. private static final void method509(Component component) {
  730. try {
  731. Class5_Sub2 class5_sub2 = new Class5_Sub2_Sub2();
  732. class5_sub2.method502(2048);
  733. aClass5_932 = class5_sub2;
  734. } catch (Throwable throwable) {
  735. try {
  736. aClass5_932 = new Class5_Sub2_Sub1(component);
  737. } catch (Throwable throwable_16_) {
  738. do {
  739. if (System.getProperty("java.vendor").toLowerCase().indexOf("microsoft") >= 0) {
  740. try {
  741. aClass5_932 = new Class5_Sub1();
  742. } catch (Throwable throwable_17_) {
  743. break;
  744. }
  745.  
  746. return;
  747. }
  748. } while (false);
  749.  
  750. aClass5_932 = new Class5(8000);
  751. }
  752. }
  753. }
  754.  
  755. private static final synchronized void method55(boolean bool) {
  756. if (musicIsntNull()) {
  757. method891(bool);
  758. fetchMusic = false;
  759. }
  760. }
  761.  
  762. public static final int method670(int i, int i_0_) {
  763. if (i > i_0_) {
  764. int i_2_ = i_0_;
  765. i_0_ = i;
  766. i = i_2_;
  767. }
  768.  
  769. for (int i_3_; i != 0; i = i_3_) {
  770. i_3_ = i_0_ % i;
  771. i_0_ = i;
  772. }
  773.  
  774. return i_0_;
  775. }
  776.  
  777. private static final void method684(boolean bool, int i, int i_2_, byte[] is) {
  778. if (aClass56_749 != null) {
  779. if (anInt478 >= 0) {
  780. anInt2200 = i;
  781.  
  782. if (anInt478 != 0) {
  783. int i_4_ = method1004(anInt478);
  784. i_4_ -= anInt155;
  785. anInt720 = (i_4_ + 3600) / i;
  786.  
  787. if (anInt720 < 1) {
  788. anInt720 = 1;
  789. }
  790. } else {
  791. anInt720 = 1;
  792. }
  793.  
  794. aByteArray347 = is;
  795. anInt1478 = i_2_;
  796. aBoolean475 = bool;
  797. } else if (anInt720 == 0) {
  798. method853(i_2_, is, bool);
  799. } else {
  800. anInt1478 = i_2_;
  801. aBoolean475 = bool;
  802. aByteArray347 = is;
  803. }
  804. }
  805. }
  806.  
  807. private static final void method689(int i) {
  808. Client.anInt1408 += i;
  809.  
  810. while (Client.anInt1408 >= Client.anInt197) {
  811. Client.anInt1408 -= Client.anInt197;
  812. anInt1526 -= anInt1526 >> 2;
  813. }
  814.  
  815. anInt1526 -= i * 1000;
  816.  
  817. if (anInt1526 < 0) {
  818. anInt1526 = 0;
  819. }
  820. }
  821.  
  822. public static final void method790() {
  823. if (aClass56_749 != null) {
  824. method891(false);
  825.  
  826. if (anInt720 > 0) {
  827. aClass56_749.method831(256);
  828. anInt720 = 0;
  829. }
  830.  
  831. aClass56_749.method828();
  832. aClass56_749 = null;
  833. }
  834. }
  835.  
  836. private static final void method853(int i_2_, byte[] is, boolean bool) {
  837. if (aClass56_749 != null) {
  838. if (anInt478 >= 0) {
  839. aClass56_749.method833();
  840. anInt478 = -1;
  841. aByteArray347 = null;
  842. anInt720 = 20;
  843. anInt155 = 0;
  844. }
  845.  
  846. if (is != null) {
  847. if (anInt720 > 0) {
  848. aClass56_749.method831(i_2_);
  849. anInt720 = 0;
  850. }
  851.  
  852. anInt478 = i_2_;
  853. aClass56_749.method827(i_2_, is, 0, bool);
  854. }
  855. }
  856. }
  857.  
  858. private static final void method891(boolean bool) {
  859. method853(0, null, bool);
  860. }
  861.  
  862. private static final void method899(int i, int i_29_, boolean bool, byte[] is, int i_30_) {
  863. if (aClass56_749 != null) {
  864. if (i_29_ >= (anInt478 ^ 0xffffffff)) {
  865. i -= 20;
  866.  
  867. if (i < 1) {
  868. i = 1;
  869. }
  870.  
  871. anInt720 = i;
  872.  
  873. if (anInt478 == 0) {
  874. anInt2200 = 0;
  875. } else {
  876. int i_31_ = method1004(anInt478);
  877. i_31_ -= anInt155;
  878. anInt2200 = (anInt2200 - 1 + i_31_ + 3600) / anInt2200;
  879. }
  880.  
  881. aBoolean475 = bool;
  882. aByteArray347 = is;
  883. anInt1478 = i_30_;
  884. } else if (anInt720 != 0) {
  885. aBoolean475 = bool;
  886. aByteArray347 = is;
  887. anInt1478 = i_30_;
  888. } else {
  889. method853(i_30_, is, bool);
  890. }
  891. }
  892. }
  893.  
  894. private static final void method900(int i) {
  895. if (aClass56_749 != null) {
  896. if (anInt720 == 0) {
  897. if (anInt478 >= 0) {
  898. anInt478 = i;
  899. aClass56_749.method830(i, 0);
  900. }
  901. } else if (aByteArray347 != null) {
  902. anInt1478 = i;
  903. }
  904. }
  905. }
  906.  
  907. private static final boolean musicIsntNull() {
  908. return aClass56_749 != null;
  909. }
  910.  
  911. private static void setLowDetail() {
  912. setLowDetail(true);
  913. WorldController.lowDetail = true;
  914. Rasterizer.lowDetail = false;
  915. ObjectManager.lowDetail = true;
  916. ObjectDefinition.lowDetail = true;
  917. Configuration.HIGH_DETAIL = false;
  918. Configuration.hdTexturing = false;
  919. Configuration.hdMinimap = false;
  920. Configuration.hdShading = true;
  921. }
  922.  
  923. private static void setHighDetail() {
  924. setLowDetail(false);
  925. WorldController.lowDetail = false;
  926. Rasterizer.lowDetail = false;
  927. ObjectManager.lowDetail = false;
  928. ObjectDefinition.lowDetail = false;
  929. Configuration.hdTexturing = true;
  930. Configuration.hdMinimap = true;
  931. Configuration.hdShading = true;
  932. Configuration.HIGH_DETAIL = true;
  933. }
  934.  
  935. public static void setTab(int id) {
  936. tabID = id;
  937. tabAreaAltered = true;
  938. }
  939.  
  940. private static final void setVolume(int i) {
  941. if (musicIsntNull()) {
  942. if (fetchMusic) {
  943. musicVolume2 = i;
  944. } else {
  945. method900(i);
  946. }
  947. }
  948. }
  949.  
  950. public static final void sleep(long time) {
  951. if (time > 0L) {
  952. if (time % 10L != 0L) {
  953. threadSleep(time);
  954. } else {
  955. threadSleep(time - 1L);
  956. threadSleep(1L);
  957. }
  958. }
  959. }
  960.  
  961. private static final void threadSleep(long time) {
  962. try {
  963. Thread.sleep(time);
  964. } catch (InterruptedException ex) {
  965. }
  966. }
  967.  
  968. public boolean doingDungeoneering;
  969. private boolean aBoolean1017;
  970. private boolean aBoolean1031;
  971. public boolean isMale;
  972. private boolean aBoolean1080;
  973. private boolean aBoolean1141;
  974. public boolean aBoolean1149;
  975. private boolean aBoolean1159;
  976. private boolean cameraViewChanged;
  977. private boolean aBoolean1242;
  978. private volatile boolean aBoolean831;
  979. private final boolean aBoolean848;
  980. private boolean httpFallback;
  981. public boolean aBoolean954;
  982. private boolean aBoolean972;
  983. private final boolean aBoolean994;
  984. private final boolean[] aBooleanArray876;
  985. private byte[] aByteArray912;
  986. private byte[][] aByteArrayArray1183;
  987. private byte[][] aByteArrayArray1247;
  988. private CollisionMap[] clippingPlanes;
  989. private Deque aClass19_1013;
  990. private Deque aClass19_1056;
  991. private Deque aClass19_1179;
  992. private Sprite aClass30_Sub2_Sub1_Sub1_931;
  993. private Sprite aClass30_Sub2_Sub1_Sub1_932;
  994. public Sprite[] aClass30_Sub2_Sub1_Sub1Array1140;
  995. private final RSInterface aClass9_1059;
  996. private int activeInterfaceType;
  997. private long aLong824;
  998. private long aLong953;
  999. public String amountOrNameInput;
  1000. public int anInt1009;
  1001. private int anInt1010;
  1002. public int anInt1011;
  1003. private int currentCameraDisplayX;
  1004. private int currentCameraDisplayY;
  1005. private int anInt1016;
  1006. private int walkableInterfaceId;
  1007. public int anInt1021;
  1008. private int anInt1026;
  1009. private int anInt1036;
  1010. private int anInt1037;
  1011. private int anInt1039;
  1012. private int anInt1044;// 377
  1013. private int anInt1046;
  1014. private int anInt1048;
  1015. public int anInt1054;
  1016. public int drawMultiwayIcon;
  1017. private int anInt1069;
  1018. private int anInt1070;
  1019. public int anInt1071;
  1020. private int anInt1079;
  1021. private int anInt1084;
  1022. private int anInt1085;
  1023. private int anInt1087;
  1024. private int anInt1088;
  1025. private int spinPacketX;
  1026. private int spinPacketY;
  1027. private int spinPacketHeight;
  1028. private int spinPacketConstantSpeed;
  1029. private int spinPacketVariableSpeed;
  1030. public int systemUpdateTimer;
  1031. private int anInt1129;// 377
  1032. private int selectedSpellId;
  1033. private int cameraRotationZ;
  1034. private int cameraRotationLeft;
  1035. private int cameraRotationRight;
  1036. private int anInt1193;
  1037. private int anInt1213;
  1038. public int anInt1222;
  1039. private int anInt1249;
  1040. private int anInt1251;
  1041. private int anInt1253;
  1042. private int anInt1264;
  1043. private int anInt1265;
  1044. private int anInt1268;
  1045. private int anInt1269;
  1046. private int anInt1283;
  1047. private int anInt1284;
  1048. private int anInt1285;
  1049. private int anInt1315;// 377
  1050. private int anInt1500;// 377
  1051. private int anInt1501;// 377
  1052. private int anInt839;
  1053. public int anInt841;
  1054. public int anInt842;
  1055. public int anInt843;
  1056. public int anInt855;
  1057. private int anInt886;
  1058. private int anInt893;
  1059. private int anInt900;
  1060. private int anInt913;
  1061. public int anInt933;
  1062. public int anInt934;
  1063. public int anInt935;
  1064. private int anInt936;
  1065. private int anInt937;
  1066. private int anInt938;
  1067. private int anInt945;
  1068. private final int anInt975;
  1069. private int anInt984;
  1070. private int lastKnownPlane;
  1071. private int anInt989;
  1072. private int moveCameraX;
  1073. private int moveCameraY;
  1074. private int moveCameraZ;
  1075. private int moveCameraSpeed;
  1076. private int moveCameraAngle;
  1077. private final int[] anIntArray1030;
  1078. private final int[] settings;
  1079. private final int[] myAppearance;
  1080. public int[] anIntArray1072;
  1081. public int[] anIntArray1073;
  1082. private final int[] anIntArray1177 = { 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2,
  1083. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3 };
  1084. public int[] anIntArray1180;
  1085. public int[] anIntArray1181;
  1086. public int[] anIntArray1182;
  1087. private final int[] anIntArray1203;
  1088. private int[] anIntArray1234;
  1089. private int[] anIntArray840;
  1090. private final int[] anIntArray873;
  1091. private int[] anIntArray894;
  1092. private final int[] anIntArray928;
  1093. private final int[] anIntArray965 = { 0xffff00, 0xff0000, 65280, 65535,
  1094. 0xff00ff, 0xffffff };
  1095. private final int[] anIntArray976;
  1096. private final int[] anIntArray977;
  1097. private final int[] anIntArray978;
  1098. private final int[] anIntArray979;
  1099. private final int[] anIntArray980;
  1100. private final int[] anIntArray981;
  1101. private final int[] anIntArray982;
  1102. public final int[] anIntArray990;
  1103. private int[][] anIntArrayArray825;
  1104. private int[][] anIntArrayArray901;
  1105. private int[][] anIntArrayArray929;
  1106. private final int[][][] anIntArrayArrayArray1129;
  1107. private RSImageProducer aRSImageProducer_1107;
  1108. private RSImageProducer aRSImageProducer_1125;
  1109. private Socket aSocket832;
  1110. private ByteBuffer aStream_834;
  1111. private ByteBuffer[] aStreamArray895s;
  1112. public String aString844;
  1113. private final String[] aStringArray983;
  1114. private int atInventoryIndex;
  1115. private int atInventoryInterface;
  1116. private int atInventoryInterfaceType;
  1117. private int atInventoryLoopCycle;
  1118. public final String[] atPlayerActions;
  1119. public final boolean[] atPlayerArray;
  1120. public int backDialogID;
  1121. public int baseX;
  1122. public int baseY;
  1123. private int[] bigX;
  1124. private int[] bigY;
  1125. private byte[][][] byteGroundArray;
  1126. private int cameraOffsetX;
  1127. private int cameraOffsetY;
  1128. public int cButtonCPos;
  1129. public int cButtonHPos;
  1130. ChatArea chatArea = new ChatArea(0, 338, 516, 150);
  1131. public RSImageProducer chatAreaIP;
  1132. public String[] chatMessages;
  1133. public String[] chatNames;
  1134. public String[] chatTitles;
  1135. public int[] chatPosition;
  1136. public final int[] chatRights;
  1137. public TextDrawingArea chatTextDrawingArea;
  1138. public TextDrawingArea aTextDrawingArea_1273;
  1139. public int[] chatTypes;
  1140. public int chatTypeView;
  1141. public String[] clanMembers = new String[100];
  1142. public String clanName;
  1143. public Sprite compass;
  1144. public final int[] compassArray1;
  1145. public final int[] compassArray2;
  1146. private Connection connection;
  1147. private ISAACCipher connectionCipher;
  1148. private final CRC32 crc32Instance;
  1149. private Sprite[] crosses;
  1150. private int crossIndex;
  1151. private int crossType;
  1152. private int crossX;
  1153. private int crossY;
  1154. public final int[] currentExp;
  1155. private int currentSong;
  1156. public final int[] currentStats;
  1157. private int daysSinceLastLogin;
  1158. private int daysSinceRecovChange;
  1159. public final Decompressor[] decompressors;
  1160. public int destX;
  1161. public int destY;
  1162. public int dialogID;
  1163. private int drawCount;
  1164. private volatile boolean drawFlames;
  1165. private volatile boolean drawingFlames;
  1166. public int energy = 100;
  1167. private final int[] expectedCRCs;
  1168. private int[] floorMap;
  1169. private String floorMaps = "";
  1170. public int friendCount;
  1171. private String[] friendsList;
  1172. private int friendsListAction;
  1173. public long[] friendsListAsLongs;
  1174. public int[] friendsNodeIDs;
  1175. private int fullscreenInterfaceID;
  1176. private int[] fullScreenTextureArray;
  1177. private int gameAreaWidth = 512, gameAreaHeight = 334;
  1178. private boolean gameFrameVisible = true;
  1179. public RSImageProducer gameScreenIP;
  1180. public Deque[][][] groundArray;
  1181. private Sprite[] headIcons;
  1182. private Sprite[] headIconsHint;
  1183. private int ignoreCount;
  1184. private final long[] ignoreListAsLongs;
  1185. private ByteBuffer inputBuffer;
  1186. public int inputDialogState;
  1187. public String inputString;
  1188. private boolean inputTaken;
  1189. private int interfaceButtonAction = 0;
  1190. private int[][][] intGroundArray;
  1191. public int invOverlayInterfaceID;
  1192. public int itemSelected;
  1193. private int lastActiveInvInterface;
  1194. private RSImageProducer leftFrame;
  1195. private boolean loadingError;
  1196. public int loadingStage;
  1197. public boolean loggedIn;
  1198. private ByteBuffer loginBuffer;
  1199. private int loginFailures;
  1200. private String loginMessage1;
  1201. private String loginMessage2;
  1202. private int loginScreenCursorPos;
  1203. private int loginScreenState;
  1204. private int loginState = -1;
  1205. private final MapArea mapArea = new MapArea(519, 0, 0, 0);
  1206. public RSImageProducer mapAreaIP;
  1207. private Background mapBack;
  1208. public Sprite mapDotClan;
  1209. public Sprite mapDotFriend;
  1210. public Sprite mapDotItem;
  1211. public Sprite mapDotNPC;
  1212. public Sprite mapDotPlayer;
  1213. public Sprite mapDotTeam;
  1214. private Sprite mapEdge;
  1215. public Sprite mapFlag;
  1216. private Sprite[] mapFunctions;
  1217. public final int[] mapImagePixelCutLeft;
  1218. public final int[] mapImagePixelCutRight;
  1219. public Sprite mapMarker;
  1220. private Background[] mapScenes;
  1221. private final int maxPlayers;
  1222. public final int[] maxStats;
  1223. private int membersInt;
  1224. private int[] menuActionCmd1;
  1225. private int[] menuActionCmd2;
  1226. private int[] menuActionCmd3;
  1227. public int[] menuActionID;
  1228. public String[] menuActionName;
  1229. public String[] menuActionTitle;
  1230. public int[] menuActionColor;
  1231. public int menuActionRow;
  1232. private int menuHeight;
  1233. private int menuOffsetX;
  1234. private int menuOffsetY;
  1235. public boolean menuOpen;
  1236. public int menuScreenArea;
  1237. private int menuWidth;
  1238. private String message;
  1239. public boolean messagePromptRaised;
  1240. public Sprite miniMapRegions;
  1241. public int minimapRotation;
  1242. public int minimapZoom;
  1243. public final Sprite[] modIcons;
  1244. public MouseDetection mouseDetection;
  1245. private int mouseInvInterfaceIndex;
  1246. private Sprite multiOverlay;
  1247. private int musicVolume = 255;
  1248. private final int myPlayerIndex;
  1249. public int myRights;
  1250. public int ironman;
  1251. private String name;
  1252. public RSFontSystem newSmallFont, newRegularFont, newBoldFont;
  1253. private int nextSong;
  1254. public TextDrawingArea normalText;
  1255. public NPC[] npcArray;
  1256. public int npcCount;
  1257. public int[] npcIndices;
  1258. private int[] objectMap;
  1259. private String objectMaps = "";
  1260. public OnDemandFetcher onDemandFetcher;
  1261. private String password;
  1262. public int pktSize;
  1263. public int pktType;
  1264. public int plane;
  1265. public Player[] playerArray;
  1266. public int playerCount;
  1267. public int[] playerIndices;
  1268. private int prevSong;
  1269. public int privateChatMode;
  1270. public String promptInput;
  1271. public String promptMessage;
  1272. public int publicChatMode;
  1273. public int reportAbuseInterfaceID;
  1274. private RSImageProducer rightFrame;
  1275. private int rights;
  1276. private boolean running;
  1277. private ScriptManager scriptManager;
  1278. private final Sprite[] scrollBar;
  1279. private final Sprite[] scrollPart;
  1280. private String selectedItemName;
  1281. private long serverSeed;
  1282. private Sprite[] skullIcons;
  1283. public TextDrawingArea smallText;
  1284. private final int[] sound;
  1285. public int soundCount;
  1286. private final int[] soundDelay;
  1287. private final int[] soundType;
  1288. public int spellSelected;
  1289. private String spellTooltip;
  1290. private int spellUsableOn;
  1291. public int splitPrivateChat;
  1292. private int spriteDrawX;
  1293. private int spriteDrawY;
  1294. public TabArea tabArea = new TabArea(516, 168, 250, 335);
  1295. public RSImageProducer tabAreaIP;
  1296. public int terrainRegionX;
  1297. public int terrainRegionY;
  1298. private int titleAlpha;
  1299. private int titleHeight = -1;
  1300. private RSImageProducer titleScreenIP;
  1301. private int[] titleScreenOffsets = null;
  1302. private Archive titleStreamLoader;
  1303. private int titleWidth = -1;
  1304. private RSImageProducer topFrame;
  1305. public int tradeMode;
  1306. private int playerId;
  1307. private int unreadMessages;
  1308. public int variousSettings[];
  1309. public int viewRotation;
  1310. private int viewRotationOffset;
  1311. private int weight;
  1312. private boolean welcomeScreenRaised;
  1313. private WorldController worldController;
  1314. public int xCameraCurve;
  1315. public int xCameraPos;
  1316. public int yCameraCurve;
  1317. public int yCameraPos;
  1318. public int zCameraPos;
  1319. private boolean fpsOn;
  1320. public boolean autoCast = false;
  1321. public int autocastId = 0;
  1322. private Sprite bankItemDragSprite;
  1323. private int bankItemDragSpriteX, bankItemDragSpriteY;
  1324. public static int[] myHeadAndJaw = new int[2];
  1325.  
  1326.  
  1327. private void setAutoCastOff() {
  1328. autoCast = false;
  1329. autocastId = 0;
  1330. getOut().putOpcode(185);
  1331. getOut().putShort(6667);
  1332. }
  1333.  
  1334. public Client() {
  1335. accountManager = new AccountManager();
  1336. grandExchange = new GrandExchange();
  1337. loadingImages = new BufferedImage[4];
  1338. menuActionCmd4 = new int[500];
  1339. setFullscreenInterfaceID(-1);
  1340. chatRights = new int[500];
  1341. chatTypeView = 0;
  1342. cButtonHPos = -1;
  1343. cButtonCPos = 0;
  1344. anIntArrayArray825 = new int[104][104];
  1345. crc32Instance = new CRC32();
  1346. groundArray = new Deque[4][104][104];
  1347. aBoolean831 = false;
  1348. aStream_834 = new ByteBuffer(new byte[5000]);
  1349. npcArray = new NPC[50000];
  1350. npcIndices = new int[50000];
  1351. anIntArray840 = new int[1000];
  1352. setLoginBuffer(ByteBuffer.create());
  1353. aBoolean848 = true;
  1354. openInterfaceID = -1;
  1355. currentExp = new int[Skills.SKILL_COUNT];
  1356. httpFallback = false;
  1357. anIntArray873 = new int[5];
  1358. aBooleanArray876 = new boolean[5];
  1359. drawFlames = false;
  1360. playerId = -1;
  1361. menuOpen = false;
  1362. inputString = "";
  1363. maxPlayers = 2048;
  1364. myPlayerIndex = 2047;
  1365. friendsNodeIDs = new int[200];
  1366. playerArray = new Player[getMaxPlayers()];
  1367. playerIndices = new int[getMaxPlayers()];
  1368. anIntArray894 = new int[getMaxPlayers()];
  1369. setaStreamArray895s(new ByteBuffer[getMaxPlayers()]);
  1370. anIntArrayArray901 = new int[104][104];
  1371. aByteArray912 = new byte[16384];
  1372. currentStats = new int[Skills.SKILL_COUNT];
  1373. ignoreListAsLongs = new long[100];
  1374. loadingError = false;
  1375. anIntArray928 = new int[5];
  1376. anIntArrayArray929 = new int[104][104];
  1377. chatTypes = new int[500];
  1378. chatNames = new String[500];
  1379. chatMessages = new String[500];
  1380. chatTitles = new String[500];
  1381. chatPosition = new int[500];
  1382. Arrays.fill(chatTitles, "");
  1383. Arrays.fill(chatPosition, 0);
  1384. Arrays.fill(chatColor, 0);
  1385. aBoolean954 = true;
  1386. friendsListAsLongs = new long[200];
  1387. friendsList = new String[200];
  1388. currentSong = -1;
  1389. drawingFlames = false;
  1390. spriteDrawX = -1;
  1391. spriteDrawY = -1;
  1392. compassArray1 = new int[33];
  1393. decompressors = new Decompressor[CACHE_INDEX_COUNT];
  1394. variousSettings = new int[2000];
  1395. aBoolean972 = false;
  1396. anInt975 = 50;
  1397. anIntArray976 = new int[anInt975];
  1398. anIntArray977 = new int[anInt975];
  1399. anIntArray978 = new int[anInt975];
  1400. anIntArray979 = new int[anInt975];
  1401. anIntArray980 = new int[anInt975];
  1402. anIntArray981 = new int[anInt975];
  1403. anIntArray982 = new int[anInt975];
  1404. aStringArray983 = new String[anInt975];
  1405. setLastKnownPlane(-1);
  1406. anIntArray990 = new int[5];
  1407. aBoolean994 = false;
  1408. amountOrNameInput = "";
  1409. setaClass19_1013(new Deque());
  1410. aBoolean1017 = false;
  1411. setWalkableInterfaceId(-1);
  1412. anIntArray1030 = new int[5];
  1413. aBoolean1031 = false;
  1414. mapFunctions = new Sprite[100];
  1415. dialogID = -1;
  1416. maxStats = new int[Skills.SKILL_COUNT];
  1417. settings = new int[5000]; // use up from 2000 for custom client configs
  1418. isMale = true;
  1419. mapImagePixelCutLeft = new int[152];
  1420. anInt1054 = -1;
  1421. setaClass19_1056(new Deque());
  1422. compassArray2 = new int[33];
  1423. aClass9_1059 = new RSInterface();
  1424. mapScenes = new Background[100];
  1425. myAppearance = new int[7];
  1426. anIntArray1072 = new int[1000];
  1427. anIntArray1073 = new int[1000];
  1428. aBoolean1080 = false;
  1429. setInputBuffer(ByteBuffer.create());
  1430. expectedCRCs = new int[9];
  1431. menuActionCmd2 = new int[500];
  1432. menuActionCmd3 = new int[500];
  1433. menuActionID = new int[500];
  1434. menuActionCmd1 = new int[500];
  1435. headIcons = new Sprite[20];
  1436. skullIcons = new Sprite[7];
  1437. headIconsHint = new Sprite[20];
  1438. scrollPart = new Sprite[12];
  1439. scrollBar = new Sprite[6];
  1440. tabAreaAltered = false;
  1441. promptMessage = "";
  1442. atPlayerActions = new String[5];
  1443. atPlayerArray = new boolean[5];
  1444. anIntArrayArrayArray1129 = new int[4][13][13];
  1445. aClass30_Sub2_Sub1_Sub1Array1140 = new Sprite[1000];
  1446. aBoolean1141 = false;
  1447. aBoolean1149 = false;
  1448. crosses = new Sprite[8];
  1449. loggedIn = false;
  1450. aBoolean1159 = false;
  1451. cameraViewChanged = false;
  1452. myUsername = "";
  1453. setPassword("");
  1454. reportAbuseInterfaceID = -1;
  1455. setaClass19_1179(new Deque());
  1456. cameraRotationZ = 128;
  1457. invOverlayInterfaceID = -1;
  1458. setOut(ByteBuffer.create());
  1459. menuActionName = new String[500];
  1460. menuActionTitle = new String[500];
  1461. menuActionColor = new int[500];
  1462. anIntArray1203 = new int[5];
  1463. sound = new int[50];
  1464. anInt1211 = 78;
  1465. promptInput = "";
  1466. modIcons = new Sprite[14];
  1467. tabID = 3;
  1468. setInputTaken(false);
  1469. mapImagePixelCutRight = new int[152];
  1470. clippingPlanes = new CollisionMap[4];
  1471. soundType = new int[50];
  1472. aBoolean1242 = false;
  1473. soundDelay = new int[50];
  1474. welcomeScreenRaised = false;
  1475. messagePromptRaised = false;
  1476. backDialogID = -1;
  1477. consoleInput = "";
  1478. consoleOpen = false;
  1479. consoleMessages = new String[50];
  1480. bigX = new int[4000];
  1481. bigY = new int[4000];
  1482. loginMessage1 = loginMessage2 = "";
  1483. }
  1484.  
  1485. private void drawConsole() {
  1486. if (consoleOpen) {
  1487. DrawingArea.transparentBox(334, 0, 0, 5320850, getGameComponent().getWidth(), 0, 97);
  1488. DrawingArea.drawPixels(1, 315, 0, 16777215, getGameComponent().getWidth());
  1489. newBoldFont.drawBasicString("-->", 11, 328, 16777215, 0, false);
  1490. if (loopCycle % 20 < 10) {
  1491. newBoldFont.drawBasicString(consoleInput + "|", 38, 328, 16777215, 0, false);
  1492. } else {
  1493. newBoldFont.drawBasicString(consoleInput, 38, 328, 16777215, 0, false);
  1494. }
  1495. }
  1496. }
  1497.  
  1498. private void drawConsoleArea() {
  1499. if (consoleOpen) {
  1500. for (int i = 0, j = 308; i < 17; i++, j -= 18) {
  1501. if (consoleMessages[i] != null) {
  1502. newRegularFont.drawBasicString(consoleMessages[i], 9, j, 16777215, 0, false);
  1503. // textDrawingArea.method385(16777215,consoleMessages[i], 9,
  1504. // j);
  1505. }
  1506. }
  1507. }
  1508. }
  1509.  
  1510. public void printConsoleMessage(String s, int i) {
  1511. if (backDialogID == -1) {
  1512. inputTaken = true;
  1513. }
  1514. for (int j = 16; j > 0; j--) {
  1515. consoleMessages[j] = consoleMessages[j - 1];
  1516. }
  1517. if (i == 0) {
  1518. consoleMessages[0] = date() + " " + s;
  1519. } else {
  1520. consoleMessages[0] = s;
  1521. }
  1522. }
  1523.  
  1524. public String date() {
  1525. Date date = new Date();
  1526. SimpleDateFormat sd = new SimpleDateFormat("HH:mm:ss");
  1527. return sd.format(date);
  1528. }
  1529.  
  1530. private void sendCommandPacket(String cmd) {
  1531. if (cmd.equalsIgnoreCase("cls")) {
  1532. for (int j = 0; j < 17; j++) {
  1533. consoleMessages[j] = null;
  1534. }
  1535. }
  1536. switch(cmd) {
  1537. case "repack":
  1538. repackCacheIndex(1);
  1539. //loadRegion();
  1540. break;
  1541. case "hitmarks":
  1542. Configuration.NEW_HITMARKS = !Configuration.NEW_HITMARKS;
  1543. break;
  1544. case "customobj":
  1545. CustomObjects.spawn();
  1546. break;
  1547. case "cursors":
  1548. Configuration.NEW_CURSORS = !Configuration.NEW_CURSORS;
  1549. break;
  1550. case "fps":
  1551. case "data":
  1552. fpsOn = !fpsOn;
  1553. break;
  1554. case "noclip":
  1555. if(myRights >= 1 && myRights <= 4) {
  1556. for (int k1 = 0; k1 < 4; k1++) {
  1557. for (int i2 = 1; i2 < 103; i2++) {
  1558. for (int k2 = 1; k2 < 103; k2++)
  1559. clippingPlanes[k1].clipData[i2][k2] = 0;
  1560.  
  1561. }
  1562. }
  1563. }
  1564. break;
  1565. case "rsi":
  1566. Archive streamLoader_1 = getArchive(3, "interface", "interface", expectedCRCs[3], 35);
  1567. Archive mediaArchive = getArchive(4, "2d graphics", "media", expectedCRCs[4], 40);
  1568. TextDrawingArea[] aclass30_sub2_sub1_sub4s = { smallText, normalText, chatTextDrawingArea, aTextDrawingArea_1273 };
  1569. RSInterface.unpack(streamLoader_1, aclass30_sub2_sub1_sub4s, mediaArchive);
  1570. break;
  1571. }
  1572. /** Add Commands Here **/
  1573. if (loggedIn) {
  1574. getOut().putOpcode(103);
  1575. getOut().putByte(cmd.length() + 1);
  1576. getOut().putString(cmd);
  1577. }
  1578. }
  1579.  
  1580. private void addFriend(long nameAsLong) {
  1581. try {
  1582. if (nameAsLong == 0L) {
  1583. return;
  1584. }
  1585.  
  1586. if (friendCount >= 100 && anInt1046 != 1) {
  1587. pushMessage("Your friendlist is full. Max of 100 for free users, and 200 for members", 0, "");
  1588. return;
  1589. }
  1590.  
  1591. if (friendCount >= 200) {
  1592. pushMessage("Your friendlist is full. Max of 100 for free users, and 200 for members", 0, "");
  1593. return;
  1594. }
  1595.  
  1596. String s = TextClass.fixName(TextClass.nameForLong(nameAsLong));
  1597.  
  1598. if (s != null) {
  1599. if (s.indexOf("@") == 0) {
  1600. int prefixSubstring = getPrefixSubstringLength(name);
  1601. s = name.substring(prefixSubstring);
  1602. }
  1603. }
  1604.  
  1605. for (int i = 0; i < friendCount; i++) {
  1606. if (friendsListAsLongs[i] == nameAsLong) {
  1607. pushMessage(s + " is already on your friend list", 0, "");
  1608. return;
  1609. }
  1610. }
  1611.  
  1612. for (int i = 0; i < ignoreCount; i++) {
  1613. if (ignoreListAsLongs[i] == nameAsLong) {
  1614. pushMessage("Please remove " + s + " from your ignore list first", 0, "");
  1615. return;
  1616. }
  1617. }
  1618.  
  1619. if (s.equals(myPlayer.name)) {
  1620. return;
  1621. } else {
  1622. friendsList[friendCount] = s;
  1623. friendsListAsLongs[friendCount] = nameAsLong;
  1624. friendsNodeIDs[friendCount] = 0;
  1625. friendCount++;
  1626. getOut().putOpcode(188);
  1627. getOut().putLong(nameAsLong);
  1628. return;
  1629. }
  1630. } catch (RuntimeException ex) {
  1631. Signlink.reportError("15283, " + (byte) 68 + ", " + nameAsLong + ", " + ex.toString());
  1632. ex.printStackTrace();
  1633. }
  1634.  
  1635. throw new RuntimeException();
  1636. }
  1637.  
  1638. private void addIgnore(long nameAsLong) {
  1639. try {
  1640. if (nameAsLong == 0L) {
  1641. return;
  1642. }
  1643.  
  1644. if (ignoreCount >= 100) {
  1645. pushMessage("Your ignore list is full. Max of 100 hit", 0, "");
  1646. return;
  1647. }
  1648.  
  1649. String name = TextClass.fixName(TextClass.nameForLong(nameAsLong));
  1650.  
  1651. if (name != null) {
  1652. if (name.indexOf("@") == 0) {
  1653. int prefixSubstring = getPrefixSubstringLength(name);
  1654. name = name.substring(prefixSubstring);
  1655. }
  1656. }
  1657.  
  1658. for (int i = 0; i < ignoreCount; i++) {
  1659. if (ignoreListAsLongs[i] == nameAsLong) {
  1660. pushMessage(name + " is already on your ignore list", 0, "");
  1661. return;
  1662. }
  1663. }
  1664.  
  1665. for (int i = 0; i < friendCount; i++) {
  1666. if (friendsListAsLongs[i] == nameAsLong) {
  1667. pushMessage("Please remove " + name + " from your friend list first", 0, "");
  1668. return;
  1669. }
  1670. }
  1671.  
  1672. ignoreListAsLongs[ignoreCount++] = nameAsLong;
  1673. getOut().putOpcode(133);
  1674. getOut().putLong(nameAsLong);
  1675. return;
  1676. } catch (RuntimeException ex) {
  1677. Signlink.reportError("45688, " + nameAsLong + ", " + 4 + ", " + ex.toString());
  1678. }
  1679.  
  1680. throw new RuntimeException();
  1681. }
  1682.  
  1683. private void build3dScreenMenu() {
  1684. if (itemSelected == 0 && spellSelected == 0) {
  1685. menuActionName[menuActionRow] = "Walk here";
  1686. menuActionID[menuActionRow] = 516;
  1687. menuActionCmd2[menuActionRow] = super.mouseX;
  1688. menuActionCmd3[menuActionRow] = super.mouseY;
  1689. menuActionRow++;
  1690. }
  1691. int j = -1;
  1692. for (int k = 0; k < Model.anInt1687; k++) {
  1693. int modelData = Model.anIntArray1688[k];// data
  1694. int x = modelData & 0x7f;// x
  1695. int y = modelData >> 7 & 0x7f;// y
  1696. int face = modelData >> 29 & 3;// face
  1697. int index = -1;// objId
  1698. if (face != 2) {
  1699. index = modelData >> 14 & 32767;
  1700. }
  1701. if (modelData == j) {
  1702. continue;
  1703. }
  1704. j = modelData;
  1705.  
  1706. // objects
  1707. if (face == 2 && worldController.fetchObjectIDTagForPosition(plane, x, y, modelData) >= 0) {
  1708. index = Model.mapObjIds[k];
  1709. ObjectDefinition class46 = ObjectDefinition.forID(index);
  1710. if (class46.configObjectIDs != null) {
  1711. class46 = class46.method580();
  1712. }
  1713.  
  1714. if (baseX + x == 3090 && baseY + y == 3956) {
  1715. menuActionName[menuActionRow] = "Pull @cya@Lever";
  1716. menuActionID[menuActionRow] = 502;
  1717. menuActionCmd1[menuActionRow] = modelData;
  1718. menuActionCmd2[menuActionRow] = x;
  1719. menuActionCmd3[menuActionRow] = y;
  1720. menuActionCmd4[menuActionRow] = 5959;
  1721. menuActionRow++;
  1722.  
  1723. menuActionName[menuActionRow] = "Examine @cya@ Lever";
  1724. menuActionID[menuActionRow] = 1226;
  1725. menuActionCmd1[menuActionRow] = 950;
  1726. menuActionCmd2[menuActionRow] = x;
  1727. menuActionCmd3[menuActionRow] = y;
  1728. menuActionCmd4[menuActionRow] = 5959;
  1729. menuActionRow++;
  1730. return;
  1731. }
  1732. if (baseX + x == 2539 && baseY + y == 4712) {
  1733.  
  1734. menuActionName[menuActionRow] = "Pull @cya@Lever";
  1735. menuActionID[menuActionRow] = 502;
  1736. menuActionCmd1[menuActionRow] = modelData;
  1737. menuActionCmd2[menuActionRow] = x;
  1738. menuActionCmd3[menuActionRow] = y;
  1739. menuActionCmd4[menuActionRow] = 5960;
  1740. menuActionRow++;
  1741.  
  1742. menuActionName[menuActionRow] = "Examine @cya@ Lever";
  1743. menuActionID[menuActionRow] = 1226;
  1744. menuActionCmd1[menuActionRow] = 950;
  1745. menuActionCmd2[menuActionRow] = x;
  1746. menuActionCmd3[menuActionRow] = y;
  1747. menuActionCmd4[menuActionRow] = 5960;
  1748. menuActionRow++;
  1749. return;
  1750. }
  1751. if (class46 == null) {
  1752. continue;
  1753. }
  1754. if (itemSelected == 1) {
  1755. menuActionName[menuActionRow] = "Use " + selectedItemName + " with @cya@" + class46.name;
  1756. menuActionID[menuActionRow] = 62;
  1757. menuActionCmd1[menuActionRow] = modelData;
  1758. menuActionCmd2[menuActionRow] = x;
  1759. menuActionCmd3[menuActionRow] = y;
  1760. menuActionCmd4[menuActionRow] = index;
  1761. menuActionRow++;
  1762. } else if (spellSelected == 1) {
  1763. if ((spellUsableOn & 4) == 4) {
  1764. menuActionName[menuActionRow] = spellTooltip + " @cya@" + class46.name;
  1765. menuActionID[menuActionRow] = 956;
  1766. menuActionCmd1[menuActionRow] = modelData;
  1767. menuActionCmd2[menuActionRow] = x;
  1768. menuActionCmd3[menuActionRow] = y;
  1769. menuActionCmd4[menuActionRow] = index;
  1770. menuActionRow++;
  1771. }
  1772. } else {
  1773. if (class46 != null && class46.actions != null) {
  1774. for (int i2 = 4; i2 >= 0; i2--) {
  1775. if (class46.actions[i2] != null) {
  1776. menuActionName[menuActionRow] = class46.actions[i2] + " @cya@" + class46.name;
  1777.  
  1778. if (i2 == 0) {
  1779. menuActionID[menuActionRow] = 502;
  1780. }
  1781.  
  1782. if (i2 == 1) {
  1783. menuActionID[menuActionRow] = 900;
  1784. }
  1785.  
  1786. if (i2 == 2) {
  1787. menuActionID[menuActionRow] = 113;
  1788. }
  1789.  
  1790. if (i2 == 3) {
  1791. menuActionID[menuActionRow] = 872;
  1792. }
  1793.  
  1794. if (i2 == 4) {
  1795. menuActionID[menuActionRow] = 1062;
  1796. }
  1797.  
  1798. menuActionCmd1[menuActionRow] = modelData;
  1799. menuActionCmd2[menuActionRow] = x;
  1800. menuActionCmd3[menuActionRow] = y;
  1801. menuActionCmd4[menuActionRow] = index;
  1802. menuActionRow++;
  1803. }
  1804. }
  1805. }
  1806. menuActionName[menuActionRow] = myRights == 4 ? "Examine @cya@"
  1807. + class46.name + " @gre@(@whi@" + class46.type
  1808. + "@gre@) (@whi@" + (x + baseX) + "," + (y + baseY)
  1809. + "@gre@)" : "Examine @cya@"
  1810. + class46.name;
  1811. menuActionID[menuActionRow] = 1226;
  1812. menuActionCmd1[menuActionRow] = class46 == null ? -1 : class46.type << 14;
  1813. menuActionCmd2[menuActionRow] = x;
  1814. menuActionCmd3[menuActionRow] = y;
  1815. menuActionCmd4[menuActionRow] = index;
  1816. menuActionRow++;
  1817. }
  1818. }
  1819.  
  1820. /**
  1821. * npcs
  1822. */
  1823. if (face == 1) {
  1824. NPC npc = npcArray[index];
  1825. if (npc.definitionOverride.npcSizeInSquares == 1 && (npc.x & 0x7f) == 64 && (npc.y & 0x7f) == 64) {
  1826. for (int j2 = 0; j2 < npcCount; j2++) {
  1827. NPC npc2 = npcArray[npcIndices[j2]];
  1828. if (npc2 != null && npc2 != npc && npc2.definitionOverride.npcSizeInSquares == 1 && npc2.x == npc.x && npc2.y == npc.y) {
  1829. buildAtNPCMenu(npc2.definitionOverride, npcIndices[j2], y, x);
  1830. }
  1831. }
  1832.  
  1833. for (int l2 = 0; l2 < playerCount; l2++) {
  1834. Player player = playerArray[playerIndices[l2]];
  1835.  
  1836. if (player != null && player.x == npc.x && player.y == npc.y) {
  1837. buildAtPlayerMenu(x, playerIndices[l2], player, y);
  1838. }
  1839. }
  1840. }
  1841. buildAtNPCMenu(npc.definitionOverride, index, y, x);
  1842. }
  1843.  
  1844. /**
  1845. * Players
  1846. */
  1847. if (face == 0) {
  1848. Player player = playerArray[index];
  1849.  
  1850. if ((player.x & 0x7f) == 64 && (player.y & 0x7f) == 64) {
  1851. for (int k2 = 0; k2 < npcCount; k2++) {
  1852. NPC class30_sub2_sub4_sub1_sub1_2 = npcArray[npcIndices[k2]];
  1853.  
  1854. try {
  1855. if (class30_sub2_sub4_sub1_sub1_2 != null && class30_sub2_sub4_sub1_sub1_2.definitionOverride.npcSizeInSquares == 1 && class30_sub2_sub4_sub1_sub1_2.x == player.x && class30_sub2_sub4_sub1_sub1_2.y == player.y) {
  1856. buildAtNPCMenu(class30_sub2_sub4_sub1_sub1_2.definitionOverride, npcIndices[k2], y, x);
  1857. }
  1858. } catch (Exception _ex) {
  1859. }
  1860. }
  1861.  
  1862. for (int i3 = 0; i3 < playerCount; i3++) {
  1863. Player player1 = playerArray[playerIndices[i3]];
  1864.  
  1865. if (player1 != null && player1 != player && player1.x == player.x && player1.y == player.y) {
  1866. buildAtPlayerMenu(x, playerIndices[i3], player1, y);
  1867. }
  1868. }
  1869. }
  1870.  
  1871. buildAtPlayerMenu(x, index, player, y);
  1872. }
  1873.  
  1874. /**
  1875. * i assume items
  1876. */
  1877. if (face == 3) {
  1878. Deque class19 = groundArray[plane][x][y];
  1879.  
  1880. if (class19 != null) {
  1881. for (Item item = (Item) class19.getFirst(); item != null; item = (Item) class19.getNext()) {
  1882. ItemDefinition itemDef = ItemDefinition.get(item.id);
  1883.  
  1884. if (itemSelected == 1) {
  1885. menuActionName[menuActionRow] = "Use " + selectedItemName + " with @lre@" + itemDef.name;
  1886. menuActionID[menuActionRow] = 511;
  1887. menuActionCmd1[menuActionRow] = item.id;
  1888. menuActionCmd2[menuActionRow] = x;
  1889. menuActionCmd3[menuActionRow] = y;
  1890. menuActionCmd4[menuActionRow] = index;
  1891. menuActionRow++;
  1892. } else if (spellSelected == 1) {
  1893. if ((spellUsableOn & 1) == 1) {
  1894. menuActionName[menuActionRow] = spellTooltip + " @lre@" + itemDef.name;
  1895. menuActionID[menuActionRow] = 94;
  1896. menuActionCmd1[menuActionRow] = item.id;
  1897. menuActionCmd2[menuActionRow] = x;
  1898. menuActionCmd3[menuActionRow] = y;
  1899. menuActionCmd4[menuActionRow] = index;
  1900. menuActionRow++;
  1901. }
  1902. } else {
  1903. for (int j3 = 4; j3 >= 0; j3--) {
  1904. if (itemDef.groundActions != null && itemDef.groundActions[j3] != null) {
  1905. menuActionName[menuActionRow] = itemDef.groundActions[j3] + " @lre@" + itemDef.name;
  1906.  
  1907. if (j3 == 0) {
  1908. menuActionID[menuActionRow] = 652;
  1909. }
  1910.  
  1911. if (j3 == 1) {
  1912. menuActionID[menuActionRow] = 567;
  1913. }
  1914.  
  1915. if (j3 == 2) {
  1916. menuActionID[menuActionRow] = 234;
  1917. }
  1918.  
  1919. if (j3 == 3) {
  1920. menuActionID[menuActionRow] = 244;
  1921. }
  1922.  
  1923. if (j3 == 4) {
  1924. menuActionID[menuActionRow] = 213;
  1925. }
  1926.  
  1927. menuActionCmd1[menuActionRow] = item.id;
  1928. menuActionCmd2[menuActionRow] = x;
  1929. menuActionCmd3[menuActionRow] = y;
  1930. menuActionCmd4[menuActionRow] = index;
  1931. menuActionRow++;
  1932. } else if (j3 == 2) {
  1933. menuActionName[menuActionRow] = "Take @lre@" + itemDef.name;
  1934. menuActionID[menuActionRow] = 234;
  1935. menuActionCmd1[menuActionRow] = item.id;
  1936. menuActionCmd2[menuActionRow] = x;
  1937. menuActionCmd3[menuActionRow] = y;
  1938. menuActionCmd4[menuActionRow] = index;
  1939. menuActionRow++;
  1940. }
  1941. }
  1942.  
  1943. menuActionName[menuActionRow] = "Examine @lre@" + itemDef.name + (myRights == 4 ? " (" + itemDef.id + ")" : "");
  1944. menuActionID[menuActionRow] = 1448;
  1945. menuActionCmd1[menuActionRow] = item.id;
  1946. menuActionCmd2[menuActionRow] = x;
  1947. menuActionCmd3[menuActionRow] = y;
  1948. menuActionCmd4[menuActionRow] = index;
  1949. menuActionRow++;
  1950. }
  1951. }
  1952. }
  1953. }
  1954. }
  1955. }
  1956.  
  1957. private void buildAtNPCMenu(MobDefinition entityDef, int index, int y, int x) {
  1958.  
  1959. if (menuActionRow >= 400) {
  1960. return;
  1961. }
  1962.  
  1963. if (entityDef.childrenIDs != null) {
  1964. entityDef = entityDef.method161();
  1965. }
  1966. if (entityDef == null) {
  1967. return;
  1968. }
  1969. if (!entityDef.disableRightClick) {
  1970. return;
  1971. }
  1972. String s = entityDef.name;
  1973. if (entityDef.combatLevel != 0)
  1974. s = s
  1975. + combatDiffColor(myPlayer.combatLevel,
  1976. entityDef.combatLevel) + " (level: "
  1977. + entityDef.combatLevel + ")";
  1978.  
  1979. if (itemSelected == 1) {
  1980. menuActionName[menuActionRow] = "Use " + selectedItemName + " with @yel@" + s;
  1981. menuActionID[menuActionRow] = 582;
  1982. menuActionCmd1[menuActionRow] = index;
  1983. menuActionCmd2[menuActionRow] = x;
  1984. menuActionCmd3[menuActionRow] = y;
  1985. menuActionRow++;
  1986. return;
  1987. }
  1988.  
  1989. if (spellSelected == 1) {
  1990. if ((spellUsableOn & 2) == 2) {
  1991. menuActionName[menuActionRow] = spellTooltip + " @yel@" + s;
  1992. menuActionID[menuActionRow] = 413;
  1993. menuActionCmd1[menuActionRow] = index;
  1994. menuActionCmd2[menuActionRow] = x;
  1995. menuActionCmd3[menuActionRow] = y;
  1996. menuActionRow++;
  1997. }
  1998. } else {
  1999. if (entityDef.actions != null) {
  2000. for (int l = 4; l >= 0; l--)
  2001. if (entityDef.actions[l] != null
  2002. && !entityDef.actions[l].equalsIgnoreCase("attack")) {
  2003. menuActionName[menuActionRow] = entityDef.actions[l]
  2004. + " @yel@" + s;
  2005. if (l == 0)
  2006. menuActionID[menuActionRow] = 20;
  2007. if (l == 1)
  2008. menuActionID[menuActionRow] = 412;
  2009. if (l == 2)
  2010. menuActionID[menuActionRow] = 225;
  2011. if (l == 3)
  2012. menuActionID[menuActionRow] = 965;
  2013. if (l == 4)
  2014. menuActionID[menuActionRow] = 478;
  2015. menuActionCmd1[menuActionRow] = index;
  2016. menuActionCmd2[menuActionRow] = x;
  2017. menuActionCmd3[menuActionRow] = y;
  2018. menuActionRow++;
  2019. }
  2020.  
  2021. }
  2022. if (entityDef.actions != null) {
  2023. for (int i1 = 4; i1 >= 0; i1--)
  2024. if (entityDef.actions[i1] != null
  2025. && entityDef.actions[i1].equalsIgnoreCase("attack")) {
  2026. char c = '\0';
  2027. //if (entityDef.combatLevel > myPlayer.combatLevel) 1 CLICK ATTACK
  2028. //c = '\u07D0';
  2029. menuActionName[menuActionRow] = entityDef.actions[i1]
  2030. + " @yel@" + s;
  2031. if (i1 == 0)
  2032. menuActionID[menuActionRow] = 20 + c;
  2033. if (i1 == 1)
  2034. menuActionID[menuActionRow] = 412 + c;
  2035. if (i1 == 2)
  2036. menuActionID[menuActionRow] = 225 + c;
  2037. if (i1 == 3)
  2038. menuActionID[menuActionRow] = 965 + c;
  2039. if (i1 == 4)
  2040. menuActionID[menuActionRow] = 478 + c;
  2041. menuActionCmd1[menuActionRow] = index;
  2042. menuActionCmd2[menuActionRow] = x;
  2043. menuActionCmd3[menuActionRow] = y;
  2044. menuActionRow++;
  2045. }
  2046.  
  2047. }
  2048. if(myRights == 4) {
  2049. s += " @whi@(@gre@"+entityDef.id+"@whi@)";
  2050. }
  2051.  
  2052. menuActionName[menuActionRow] = "Examine @yel@" + s;
  2053. menuActionID[menuActionRow] = 1025;
  2054. menuActionCmd1[menuActionRow] = index;
  2055. menuActionCmd2[menuActionRow] = x;
  2056. menuActionCmd3[menuActionRow] = y;
  2057. menuActionRow++;
  2058. }
  2059. }
  2060.  
  2061. private final String[] menuPlayerName = new String[500];
  2062.  
  2063. private void buildAtPlayerMenu(int i, int j, Player player, int k) {
  2064. if (player == myPlayer) {
  2065. return;
  2066. }
  2067.  
  2068. if (menuActionRow >= 400) {
  2069. return;
  2070. }
  2071.  
  2072. String menuTooltip = "";
  2073. String title = "";
  2074.  
  2075. if (player.loyaltyTitle != null && !player.loyaltyTitle.isEmpty()) {
  2076. title = "<col=" + Integer.toHexString(player.loyaltyColor) + ">" + player.loyaltyTitle.trim() + "</col> ";
  2077. }
  2078.  
  2079. if(player.playerRights >= 5 && player.playerRights <= 9) {
  2080. menuTooltip += "@yel@[$]@whi@ ";
  2081. }
  2082.  
  2083. if (player.combatLevel == 0) {
  2084. menuTooltip = title + player.name + combatDiffColor(myPlayer.combatLevel, player.combatLevel) + " (level-" + player.combatLevel + ")";
  2085. } else {
  2086. menuTooltip += title + player.name
  2087. + combatDiffColor(myPlayer.combatLevel, player.combatLevel)
  2088. + " (level-" + player.combatLevel + ")";
  2089. }
  2090.  
  2091. if (itemSelected == 1) {
  2092. menuActionName[menuActionRow] = "Use " + selectedItemName + " with @whi@" + menuTooltip;
  2093. menuActionID[menuActionRow] = 491;
  2094. menuActionCmd1[menuActionRow] = j;
  2095. menuActionCmd2[menuActionRow] = i;
  2096. menuActionCmd3[menuActionRow] = k;
  2097. menuActionRow++;
  2098. } else if (spellSelected == 1) {
  2099. if ((spellUsableOn & 8) == 8) {
  2100. menuActionName[menuActionRow] = spellTooltip + " @whi@" + menuTooltip;
  2101. menuActionID[menuActionRow] = 365;
  2102. menuActionCmd1[menuActionRow] = j;
  2103. menuActionCmd2[menuActionRow] = i;
  2104. menuActionCmd3[menuActionRow] = k;
  2105. menuActionRow++;
  2106. }
  2107. } else {
  2108. for (int index = 4; index >= 0; index--) {
  2109. if (atPlayerActions[index] != null) {
  2110. menuActionName[menuActionRow] = atPlayerActions[index] + " @whi@" + menuTooltip;
  2111. char c = '\0';
  2112.  
  2113. if (atPlayerActions[index].equalsIgnoreCase("attack")) {
  2114. // if (player.combatLevel > myPlayer.combatLevel) { //1 CLICK ATTACK
  2115. //c = '\u07D0';
  2116. // }
  2117. if (myPlayer.team != 0 && player.team != 0) {
  2118. if (myPlayer.team == player.team) {
  2119. c = '\u07D0';
  2120. } else {
  2121. c = '\0';
  2122. }
  2123. }
  2124. } else if (atPlayerArray[index]) {
  2125. c = '\u07D0';
  2126. }
  2127.  
  2128. if (index == 0) {
  2129. menuActionID[menuActionRow] = 561 + c;
  2130. }
  2131.  
  2132. if (index == 1) {
  2133. menuActionID[menuActionRow] = 779 + c;
  2134. }
  2135.  
  2136. if (index == 2) {
  2137. menuActionID[menuActionRow] = 27 + c;
  2138. }
  2139.  
  2140. if (index == 3) {
  2141. menuActionID[menuActionRow] = 577 + c;
  2142. }
  2143.  
  2144. if (index == 4) {
  2145. menuActionID[menuActionRow] = 729 + c;
  2146. }
  2147.  
  2148. menuActionCmd1[menuActionRow] = j;
  2149. menuActionCmd2[menuActionRow] = i;
  2150. menuActionCmd3[menuActionRow] = k;
  2151. menuActionRow++;
  2152. }
  2153. }
  2154. }
  2155.  
  2156. for (int i1 = 0; i1 < menuActionRow; i1++) {
  2157. if (menuActionID[i1] == 516) {
  2158. menuActionName[i1] = "Walk here @whi@" + menuTooltip;
  2159. return;
  2160. }
  2161. }
  2162. }
  2163.  
  2164. private void buildChatAreaMenu(int yOffset) {
  2165. if (!isGameFrameVisible() || chatArea.componentHidden()) {
  2166. return;
  2167. }
  2168.  
  2169. int messages = 0;
  2170.  
  2171. for (int index = 0; index < 500; index++) {
  2172. if (chatMessages[index] == null) {
  2173. continue;
  2174. }
  2175.  
  2176. int currentType = chatTypes[index];
  2177. int k1 = 70 - messages * 14 + 42 + anInt1089 + 4 + 5;
  2178. if (k1 < -23) {
  2179. break;
  2180. }
  2181.  
  2182. String player_name = chatNames[index];
  2183.  
  2184. if (chatTypeView == 1) {
  2185. buildPublicChat(yOffset);
  2186. break;
  2187. }
  2188.  
  2189. if (chatTypeView == 2) {
  2190. buildFriendChat(yOffset);
  2191. break;
  2192. }
  2193.  
  2194. if (chatTypeView == 3 || chatTypeView == 4) {
  2195. buildDuelorTrade(yOffset);
  2196. break;
  2197. }
  2198.  
  2199. if (inputDialogState == 3) {
  2200. getGrandExchange().buildItemSearch(yOffset);
  2201. break;
  2202. }
  2203.  
  2204. if (chatTypeView == 5) {
  2205. break;
  2206. }
  2207.  
  2208. if (player_name != null) {
  2209. if (player_name.indexOf("@") == 0) {
  2210. int prefixSubstring = getPrefixSubstringLength(player_name);
  2211. player_name = player_name.substring(prefixSubstring);
  2212. }
  2213. }
  2214. if (player_name != null && player_name.startsWith("<col=")) {
  2215. player_name = player_name.substring(player_name.indexOf("</col>") + 6);
  2216. }
  2217. if (currentType == 0) {
  2218. messages++;
  2219. }
  2220.  
  2221. if ((currentType == 1 || currentType == 2) && (currentType == 1 || publicChatMode == 0 || publicChatMode == 1 && isFriendOrSelf(player_name))) {
  2222. if (yOffset > k1 - 14 && yOffset <= k1 && !myPlayer.name.equals(NAME_PATTERN.matcher(player_name).replaceAll(""))) {
  2223. if (!isFriendOrSelf(player_name)) {
  2224. menuActionName[menuActionRow] = "Add ignore @whi@" + player_name;
  2225. menuActionID[menuActionRow] = 42;
  2226. menuActionRow++;
  2227. menuActionName[menuActionRow] = "Add friend @whi@" + player_name;
  2228. menuActionID[menuActionRow] = 337;
  2229. menuActionRow++;
  2230. } else if (isFriendOrSelf(player_name)) {
  2231. menuActionName[menuActionRow] = "Message @whi@" + player_name;
  2232. menuActionID[menuActionRow] = 2639;
  2233. menuActionRow++;
  2234. }
  2235. }
  2236.  
  2237. messages++;
  2238. }
  2239.  
  2240. if ((currentType == 3 || currentType == 7) && splitPrivateChat == 0 && (currentType == 7 || privateChatMode == 0 || privateChatMode == 1 && isFriendOrSelf(player_name))) {
  2241. if (yOffset > k1 - 14 && yOffset <= k1) {
  2242. if (!isFriendOrSelf(player_name)) {
  2243. menuActionName[menuActionRow] = "Add ignore @whi@" + player_name;
  2244. menuActionID[menuActionRow] = 42;
  2245. menuActionRow++;
  2246. menuActionName[menuActionRow] = "Add friend @whi@" + player_name;
  2247. menuActionID[menuActionRow] = 337;
  2248. menuActionRow++;
  2249. } else if (isFriendOrSelf(player_name)) {
  2250. menuActionName[menuActionRow] = "Message @whi@" + player_name;
  2251. menuActionID[menuActionRow] = 2639;
  2252. menuActionRow++;
  2253. }
  2254.  
  2255. }
  2256.  
  2257. messages++;
  2258. }
  2259.  
  2260. if (currentType == 4 && (tradeMode == 0 || tradeMode == 1 && isFriendOrSelf(player_name))) {
  2261. if (yOffset > k1 - 14 && yOffset <= k1) {
  2262. menuActionName[menuActionRow] = "Accept trade @whi@" + player_name;
  2263. menuActionID[menuActionRow] = 484;
  2264. menuActionRow++;
  2265. }
  2266.  
  2267. messages++;
  2268. }
  2269.  
  2270. if ((currentType == 5 || currentType == 6) && splitPrivateChat == 0 && privateChatMode < 2) {
  2271. messages++;
  2272. }
  2273. if (currentType == 8 && (duelStatus == 0 || duelStatus == 1 && isFriendOrSelf(player_name))) {
  2274. if (yOffset > k1 - 14 && yOffset <= k1) {
  2275. menuActionName[menuActionRow] = "Accept challenge @whi@" + player_name;
  2276. menuActionID[menuActionRow] = 6;
  2277. menuActionRow++;
  2278. }
  2279.  
  2280. messages++;
  2281. }
  2282. }
  2283. }
  2284.  
  2285. private void buildDuelorTrade(int yOffset) {
  2286. int l = 0;
  2287.  
  2288. for (int i1 = 0; i1 < 500; i1++) {
  2289. if (chatMessages[i1] == null) {
  2290. continue;
  2291. }
  2292.  
  2293. if (chatTypeView != 3 && chatTypeView != 4) {
  2294. continue;
  2295. }
  2296.  
  2297. int chatType = chatTypes[i1];
  2298. String name = chatNames[i1];
  2299. int k1 = 70 - l * 14 + 42 + anInt1089 + 4 + 5;
  2300.  
  2301. if (k1 < -23) {
  2302. break;
  2303. }
  2304.  
  2305. if (name != null) {
  2306. if (name.indexOf("@") == 0) {
  2307. int prefixSubstring = getPrefixSubstringLength(name);
  2308. name = name.substring(prefixSubstring);
  2309. }
  2310. }
  2311.  
  2312. if (chatTypeView == 3 && chatType == 4 && (tradeMode == 0 || tradeMode == 1 && isFriendOrSelf(name))) {
  2313. if (yOffset > k1 - 14 && yOffset <= k1) {
  2314. menuActionName[menuActionRow] = "Accept trade @whi@" + name;
  2315. menuActionID[menuActionRow] = 484;
  2316. menuActionRow++;
  2317. }
  2318.  
  2319. l++;
  2320. }
  2321.  
  2322. if (chatTypeView == 4 && chatType == 8 && (duelStatus == 0 || duelStatus == 1 && isFriendOrSelf(name))) {
  2323. if (yOffset > k1 - 14 && yOffset <= k1) {
  2324. menuActionName[menuActionRow] = "Accept challenge @whi@" + name;
  2325. menuActionID[menuActionRow] = 6;
  2326. menuActionRow++;
  2327. }
  2328.  
  2329. l++;
  2330. }
  2331.  
  2332. if (chatType == 12) {
  2333. if (yOffset > k1 - 14 && yOffset <= k1) {
  2334. menuActionName[menuActionRow] = "Go-to @blu@" + name;
  2335. menuActionID[menuActionRow] = 915;
  2336. menuActionRow++;
  2337. }
  2338.  
  2339. l++;
  2340. }
  2341. }
  2342. }
  2343.  
  2344. private void buildFriendChat(int yOffset) {
  2345. int count = 0;
  2346.  
  2347. for (int index = 0; index < 500; index++) {
  2348. if (chatMessages[index] == null) {
  2349. continue;
  2350. }
  2351.  
  2352. if (chatTypeView != 2) {
  2353. continue;
  2354. }
  2355.  
  2356. int type = chatTypes[index];
  2357. String player_name = chatNames[index];
  2358. int k1 = 70 - count * 14 + 42 + anInt1089 + 4 + 5;
  2359. if (k1 < -23) {
  2360. break;
  2361. }
  2362.  
  2363. if (player_name != null) {
  2364. if (player_name.indexOf("@") == 0) {
  2365. int prefixSubstring = getPrefixSubstringLength(name);
  2366. player_name = player_name.substring(prefixSubstring);
  2367. }
  2368. }
  2369.  
  2370. if ((type == 5 || type == 6) && (splitPrivateChat == 0 || chatTypeView == 2) && (type == 6 || privateChatMode == 0 || privateChatMode == 1 && isFriendOrSelf(player_name))) {
  2371. count++;
  2372. }
  2373.  
  2374. if ((type == 3 || type == 7) && (splitPrivateChat == 0 || chatTypeView == 2) && (type == 7 || privateChatMode == 0 || privateChatMode == 1 && isFriendOrSelf(player_name))) {
  2375. if (yOffset > k1 - 14 && yOffset <= k1) {
  2376. if (!isFriendOrSelf(player_name)) {
  2377. menuActionName[menuActionRow] = "Add ignore @whi@" + player_name;
  2378. menuActionID[menuActionRow] = 42;
  2379. menuActionRow++;
  2380. menuActionName[menuActionRow] = "Add friend @whi@" + player_name;
  2381. menuActionID[menuActionRow] = 337;
  2382. menuActionRow++;
  2383. } else if (isFriendOrSelf(player_name)) {
  2384. menuActionName[menuActionRow] = "Message @whi@" + player_name;
  2385. menuActionID[menuActionRow] = 2639;
  2386. menuActionRow++;
  2387. }
  2388. }
  2389.  
  2390. count++;
  2391. }
  2392. }
  2393. }
  2394.  
  2395. private boolean buildFriendsListMenu(RSInterface class9) {
  2396. int i = class9.contentType;
  2397.  
  2398. if (i >= 1 && i <= 200 || i >= 701 && i <= 900) {
  2399. if (i >= 801) {
  2400. i -= 701;
  2401. } else if (i >= 701) {
  2402. i -= 601;
  2403. } else if (i >= 101) {
  2404. i -= 101;
  2405. } else {
  2406. i--;
  2407. }
  2408.  
  2409. menuActionName[menuActionRow] = "Remove @whi@" + friendsList[i];
  2410. menuActionID[menuActionRow] = 792;
  2411. menuActionRow++;
  2412. menuActionName[menuActionRow] = "Message @whi@" + friendsList[i];
  2413. menuActionID[menuActionRow] = 639;
  2414. menuActionRow++;
  2415. return true;
  2416. }
  2417.  
  2418. if (i >= 401 && i <= 500) {
  2419. menuActionName[menuActionRow] = "Remove @whi@" + class9.message;
  2420. menuActionID[menuActionRow] = 322;
  2421. menuActionRow++;
  2422. return true;
  2423. } else {
  2424. return false;
  2425. }
  2426. }
  2427.  
  2428. private void buildInterfaceMenu(int xPadding, RSInterface rsInterface, int xPos, int yPadding, int yPos, int scrollPoint) {
  2429. if (rsInterface == null) {
  2430. rsInterface = RSInterface.interfaceCache[21356];
  2431. }
  2432.  
  2433. if (rsInterface.type != 0 || rsInterface.children == null || rsInterface.interfaceShown) {
  2434. return;
  2435. }
  2436.  
  2437. if (xPos < xPadding || yPos < yPadding || xPos > xPadding + rsInterface.width || yPos > yPadding + rsInterface.height) {
  2438. return;
  2439. }
  2440.  
  2441. int totalChildren = rsInterface.children.length;
  2442.  
  2443. for (int index = 0; index < totalChildren; index++) {
  2444. int xSpritePos = rsInterface.childX[index] + xPadding;
  2445. int ySpritePos = rsInterface.childY[index] + yPadding - scrollPoint;
  2446. RSInterface children = RSInterface.interfaceCache[rsInterface.children[index]];
  2447. if(children == null)
  2448. continue;
  2449. int offset = children.xOffset;
  2450. xSpritePos += offset;
  2451. ySpritePos += children.yOffset;
  2452.  
  2453. if (super.clickMode3 != 0) {
  2454. xPos = super.clickX;
  2455. yPos = super.clickY;
  2456. }
  2457.  
  2458. if ((children.hoverType >= 0 || children.anInt216 != 0) && xPos >= xSpritePos && yPos >= ySpritePos && xPos < xSpritePos + children.width && yPos < ySpritePos + children.height) {
  2459. if (children.hoverType >= 0) {
  2460. anInt886 = children.hoverType;
  2461. } else {
  2462. anInt886 = children.id;
  2463. }
  2464. }
  2465.  
  2466. if ((children.type == 8 || children.type == 10) && xPos >= xSpritePos && yPos >= ySpritePos && xPos < xSpritePos + children.width && yPos < ySpritePos + children.height) {
  2467. anInt1315 = children.id;
  2468. if(children.id != skillTabHoverChild) {
  2469. skillTabHoverChild = children.id;
  2470. }
  2471. }
  2472. if (children.type == 0) {
  2473. buildInterfaceMenu(xSpritePos, children, xPos, ySpritePos, yPos, children.scrollPosition);
  2474.  
  2475. if (children.scrollMax > children.height) {
  2476. method65(xSpritePos + children.width, children.height, xPos, yPos, children, ySpritePos, true, children.scrollMax);
  2477. }
  2478. } else {
  2479.  
  2480. if (children.atActionType == 1 && xPos >= xSpritePos && yPos >= ySpritePos && xPos < xSpritePos + children.width && yPos < ySpritePos + children.height) {
  2481. boolean flag = false, flag1 = false;
  2482.  
  2483. if (children.contentType != 0) {
  2484. flag = buildFriendsListMenu(children);
  2485. }
  2486.  
  2487. if (!flag && !flag1) {
  2488. if(children.actions != null) {
  2489. for(int i = children.actions.length - 1; i >= 0; i--) {
  2490. String s = children.actions[i];
  2491. if(s != null) {
  2492. menuActionName[menuActionRow] = s;
  2493. menuActionID[menuActionRow] = 222;
  2494. menuActionCmd3[menuActionRow] = children.id;
  2495. currentActionMenu = menuActionRow;
  2496. menuActionRow++;
  2497. }
  2498. }
  2499. }
  2500. String tooltip = children.tooltip;
  2501. if(tooltip != null) {
  2502. if (myRights == 4) {
  2503. tooltip += " - Id: " + children.id;
  2504. }
  2505. if(tooltip.contains("[GE")) {
  2506. continue;
  2507. }
  2508. menuActionName[menuActionRow] = tooltip;
  2509. menuActionID[menuActionRow] = 315;
  2510. menuActionCmd3[menuActionRow] = children.id;
  2511. menuActionRow++;
  2512. }
  2513. }
  2514. }
  2515. if (children.atActionType == 2 && xPos >= xSpritePos && yPos >= ySpritePos && xPos < xSpritePos + children.width && yPos < ySpritePos + children.height) {
  2516. String s = children.selectedActionName;
  2517.  
  2518. if (s.indexOf(" ") != -1) {
  2519. s = s.substring(0, s.indexOf(" "));
  2520. }
  2521.  
  2522. if (children.spellName.endsWith("Rush") || children.spellName.endsWith("Burst") || children.spellName.endsWith("Blitz") || children.spellName.endsWith("Barrage") || children.spellName.endsWith("strike") || children.spellName.endsWith("bolt") || children.spellName.equals("Crumble undead") || children.spellName.endsWith("blast") || children.spellName.endsWith("wave") || children.spellName.equals("Claws of Guthix") || children.spellName.equals("Flames of Zamorak") || children.spellName.equals("Magic Dart")) {
  2523. menuActionName[menuActionRow] = "Autocast @gre@" + children.spellName;
  2524. menuActionID[menuActionRow] = 104;
  2525. menuActionCmd3[menuActionRow] = children.id;
  2526. menuActionRow++;
  2527. }
  2528.  
  2529. menuActionName[menuActionRow] = s + " @gre@" + children.spellName + (myRights == 4 ? ", " + children.id : "");
  2530. menuActionID[menuActionRow] = 626;
  2531. menuActionCmd3[menuActionRow] = children.id;
  2532. menuActionRow++;
  2533. }
  2534.  
  2535. if (children.atActionType == 3 && xPos >= xSpritePos && yPos >= ySpritePos && xPos < xSpritePos + children.width && yPos < ySpritePos + children.height) {
  2536. menuActionName[menuActionRow] = "Close";
  2537. menuActionID[menuActionRow] = 200;
  2538. menuActionCmd3[menuActionRow] = children.id;
  2539. menuActionRow++;
  2540. }
  2541.  
  2542. if (children.atActionType == 4 && xPos >= xSpritePos && yPos >= ySpritePos && xPos < xSpritePos + children.width && yPos < ySpritePos + children.height) {
  2543. // System.out.println("2"+class9_1.tooltip + ", " +
  2544. // class9_1.interfaceID);
  2545.  
  2546. menuActionName[menuActionRow] = children.tooltip + (myRights == 4 ? ", " + children.id : "");
  2547. menuActionID[menuActionRow] = 169;
  2548. menuActionCmd3[menuActionRow] = children.id;
  2549. menuActionRow++;
  2550.  
  2551. if (children.tooltipBoxText != null) {
  2552. // drawHoverBox(k, l, class9_1.hoverText);
  2553. // System.out.println("DRAWING INTERFACE: " +
  2554. // class9_1.hoverText);
  2555. }
  2556. }
  2557.  
  2558. if (children.atActionType == 5 && xPos >= xSpritePos && yPos >= ySpritePos && xPos < xSpritePos + children.width && yPos < ySpritePos + children.height) {
  2559. // System.out.println("3"+class9_1.tooltip + ", " +
  2560. // class9_1.interfaceID);
  2561. menuActionName[menuActionRow] = children.tooltip + (myRights == 4 ? ", " + children.id : "");
  2562. menuActionID[menuActionRow] = 646;
  2563. menuActionCmd3[menuActionRow] = children.id;
  2564. menuActionRow++;
  2565. }
  2566.  
  2567. if (children.atActionType == 6 && !aBoolean1149 && xPos >= xSpritePos && yPos >= ySpritePos && xPos < xSpritePos + children.width && yPos < ySpritePos + children.height) {
  2568. // System.out.println("4"+class9_1.tooltip + ", " +
  2569. // class9_1.interfaceID);
  2570.  
  2571. menuActionName[menuActionRow] = children.tooltip + (myRights == 4 ? ", " + children.id : "");
  2572. menuActionID[menuActionRow] = 679;
  2573. menuActionCmd3[menuActionRow] = children.id;
  2574. menuActionRow++;
  2575. }
  2576.  
  2577. if (children.type == 2 && children.parentID != 0) {
  2578. int k2 = 0;
  2579.  
  2580. for (int l2 = 0; l2 < children.height; l2++) {
  2581. for (int i3 = 0; i3 < children.width; i3++) {
  2582. int j3 = xSpritePos + i3 * (32 + children.invSpritePadX);
  2583. int k3 = ySpritePos + l2 * (32 + children.invSpritePadY);
  2584.  
  2585. if (k2 < children.spritesX.length) {
  2586. j3 += children.spritesX[k2];
  2587. k3 += children.spritesY[k2];
  2588. }
  2589.  
  2590. if (xPos >= j3 && yPos >= k3 && xPos < j3 + 32 && yPos < k3 + 32) {
  2591. mouseInvInterfaceIndex = k2;
  2592. lastActiveInvInterface = children.id;
  2593. if (children.inv[k2] > 0) {
  2594. int id = children.inv[k2] - 1;
  2595. if(id > ItemDefinition.totalItems) {
  2596. continue;
  2597. }
  2598. ItemDefinition definition = ItemDefinition.get(id);
  2599.  
  2600. if (itemSelected == 1 && children.isInventoryInterface) {
  2601. if (children.id != anInt1284 || k2 != anInt1283) {
  2602. menuActionName[menuActionRow] = "Use " + selectedItemName + " with @lre@" + definition.name;
  2603. menuActionID[menuActionRow] = 870;
  2604. menuActionCmd1[menuActionRow] = definition.id;
  2605. menuActionCmd2[menuActionRow] = k2;
  2606. menuActionCmd3[menuActionRow] = children.id;
  2607. menuActionRow++;
  2608. }
  2609. } else if (spellSelected == 1 && children.isInventoryInterface) {
  2610. if ((spellUsableOn & 0x10) == 16) {
  2611. menuActionName[menuActionRow] = spellTooltip + " @lre@" + definition.name;
  2612. menuActionID[menuActionRow] = 543;
  2613. menuActionCmd1[menuActionRow] = definition.id;
  2614. menuActionCmd2[menuActionRow] = k2;
  2615. menuActionCmd3[menuActionRow] = children.id;
  2616. menuActionRow++;
  2617. }
  2618. } else {
  2619. if (children.isInventoryInterface) {
  2620. if (openInterfaceID != 24700 && openInterfaceID != 2700) {
  2621. for (int l3 = 4; l3 >= 3; l3--) {
  2622. if (definition.actions != null && definition.actions[l3] != null || lootingBag) {
  2623. if (lootingBag) {
  2624. menuActionCmd1[menuActionRow] = definition.id;
  2625. menuActionCmd2[menuActionRow] = k2;
  2626. menuActionCmd3[menuActionRow] = children.id;
  2627.  
  2628. if (l3 == 1) {
  2629. menuActionName[menuActionRow] = "Deposit" + " @lre@" + definition.name;
  2630. } else {
  2631. menuActionName[menuActionRow] = null;
  2632. }
  2633.  
  2634. if (l3 == 3) {
  2635. menuActionID[menuActionRow] = 493;
  2636. }
  2637.  
  2638. if (l3 == 4) {
  2639. menuActionID[menuActionRow] = 847;
  2640. }
  2641.  
  2642. menuActionCmd1[menuActionRow] = definition.id;
  2643. menuActionCmd2[menuActionRow] = k2;
  2644. menuActionCmd3[menuActionRow] = children.id;
  2645. menuActionRow++;
  2646. continue;
  2647. }
  2648. menuActionName[menuActionRow] = definition.actions[l3] + " @lre@" + definition.name;
  2649.  
  2650. if (l3 == 3) {
  2651. menuActionID[menuActionRow] = 493;
  2652. }
  2653.  
  2654. if (l3 == 4) {
  2655. menuActionID[menuActionRow] = 847;
  2656. }
  2657.  
  2658. menuActionCmd1[menuActionRow] = definition.id;
  2659. menuActionCmd2[menuActionRow] = k2;
  2660. menuActionCmd3[menuActionRow] = children.id;
  2661. menuActionRow++;
  2662. } else if (l3 == 4) {
  2663. menuActionName[menuActionRow] = "Drop @lre@" + definition.name;
  2664. menuActionID[menuActionRow] = 847;
  2665. menuActionCmd1[menuActionRow] = definition.id;
  2666. menuActionCmd2[menuActionRow] = k2;
  2667. menuActionCmd3[menuActionRow] = children.id;
  2668. menuActionRow++;
  2669. }
  2670. }
  2671. }
  2672. }
  2673.  
  2674. if (children.usableItemInterface) {
  2675. if (openInterfaceID == 24700) {
  2676. menuActionName[menuActionRow] = "Offer @lre@" + definition.name;
  2677. menuActionID[menuActionRow] = 24700;
  2678. menuActionCmd1[menuActionRow] = definition.id;
  2679. getGrandExchange().itemSelected = definition.id;
  2680. } else if (openInterfaceID == 2700) {
  2681. menuActionName[menuActionRow] = "Store @lre@" + definition.name;
  2682. menuActionID[menuActionRow] = 2700;
  2683. menuActionCmd1[menuActionRow] = definition.id;
  2684. } else {
  2685. menuActionName[menuActionRow] = "Use @lre@"
  2686. + definition.name;
  2687. menuActionID[menuActionRow] = 447;
  2688. menuActionCmd1[menuActionRow] = definition.id;
  2689. }
  2690. menuActionCmd2[menuActionRow] = k2;
  2691. menuActionCmd3[menuActionRow] = children.id;
  2692. menuActionRow++;
  2693. }
  2694.  
  2695. if (openInterfaceID != 24700 && children.isInventoryInterface && definition.actions != null) {
  2696. for (int i4 = 2; i4 >= 0; i4--) {
  2697. if (definition.actions[i4] != null) {
  2698. menuActionName[menuActionRow] = definition.actions[i4] + " @lre@" + definition.name;
  2699.  
  2700. if (i4 == 0) {
  2701. menuActionID[menuActionRow] = 74;
  2702. }
  2703.  
  2704. if (i4 == 1) {
  2705. menuActionID[menuActionRow] = 454;
  2706. }
  2707.  
  2708. if (i4 == 2) {
  2709. menuActionID[menuActionRow] = 539;
  2710. }
  2711.  
  2712. menuActionCmd1[menuActionRow] = definition.id;
  2713. menuActionCmd2[menuActionRow] = k2;
  2714. menuActionCmd3[menuActionRow] = children.id;
  2715. menuActionRow++;
  2716. }
  2717. }
  2718. }
  2719.  
  2720. if (children.actions != null) {
  2721. for (int j4 = 4; j4 >= 0; j4--) {
  2722. if (children.actions[j4] != null) {
  2723. String s = myRights == 4 ? children.actions[j4] + " @lre@" + definition.name + " " + definition.id : children.actions[j4] + " @lre@" + definition.name;
  2724. int interfaceId = children.id;
  2725. if(children.parentID == 3321 && openInterfaceID == 42000) {
  2726. s = s.replaceAll("Offer", "Pricecheck");
  2727. interfaceId = 2100;
  2728. } else if(children.parentID == 3321 && openInterfaceID == 2700) {
  2729. s = s.replaceAll("Offer", "Store");
  2730. interfaceId = 2700;
  2731. }
  2732.  
  2733. menuActionName[menuActionRow] = s;
  2734. if (j4 == 0) {
  2735. menuActionID[menuActionRow] = 632;
  2736. }
  2737.  
  2738. if (j4 == 1) {
  2739. menuActionID[menuActionRow] = 78;
  2740. }
  2741.  
  2742. if (j4 == 2) {
  2743. menuActionID[menuActionRow] = 867;
  2744. }
  2745.  
  2746. if (j4 == 3) {
  2747. menuActionID[menuActionRow] = 431;
  2748. }
  2749.  
  2750. if (j4 == 4) {
  2751. menuActionID[menuActionRow] = 53;
  2752. }
  2753.  
  2754. menuActionCmd1[menuActionRow] = definition.id;
  2755. menuActionCmd2[menuActionRow] = k2;
  2756. menuActionCmd3[menuActionRow] = interfaceId;
  2757. menuActionRow++;
  2758. }
  2759. }
  2760. }
  2761. if(openInterfaceID != 24700) {
  2762. if (!children.hideExamine) {
  2763. menuActionName[menuActionRow] = "Examine @lre@" + definition.name + (myRights == 4 ? " (" + definition.id +")" : "");
  2764. menuActionID[menuActionRow] = 1125;
  2765. menuActionCmd1[menuActionRow] = definition.id;
  2766. menuActionCmd2[menuActionRow] = k2;
  2767. menuActionCmd3[menuActionRow] = children.id;
  2768. menuActionRow++;
  2769. } else {
  2770. if(children.parentID == 3822 && openInterfaceID == 3824) {
  2771. menuActionName[menuActionRow] = "Sell All @lre@" + definition.name;
  2772. menuActionID[menuActionRow] = 1126;
  2773. menuActionCmd1[menuActionRow] = definition.id;
  2774. menuActionCmd2[menuActionRow] = k2;
  2775. menuActionCmd3[menuActionRow] = children.id;
  2776. menuActionRow++;
  2777. }
  2778. }
  2779. }
  2780. }
  2781. }
  2782. }
  2783.  
  2784. k2++;
  2785. }
  2786. }
  2787. }
  2788. }
  2789. }
  2790. }
  2791.  
  2792. private void buildPublicChat(int yOffset) {
  2793. int messages = 0;
  2794.  
  2795. for (int index = 0; index < 500; index++) {
  2796. if (chatMessages[index] == null) {
  2797. continue;
  2798. }
  2799.  
  2800. if (chatTypeView != 1) {
  2801. continue;
  2802. }
  2803.  
  2804. int type = chatTypes[index];
  2805. String name = chatNames[index];
  2806. int k1 = 70 - messages * 14 + 42 + anInt1089 + 4 + 5;
  2807.  
  2808. if (k1 < -23) {
  2809. break;
  2810. }
  2811.  
  2812. if (name != null) {
  2813. if (name.indexOf("@") == 0) {
  2814. int prefixSubstring = getPrefixSubstringLength(name);
  2815. name = name.substring(prefixSubstring);
  2816. }
  2817. }
  2818.  
  2819. if ((type == 1 || type == 2) && (type == 1 || publicChatMode == 0 || publicChatMode == 1 && isFriendOrSelf(name))) {
  2820. if (yOffset > k1 - 14 && yOffset <= k1 && !name.equals(myPlayer.name)) {
  2821. if (!isFriendOrSelf(name)) {
  2822. menuActionName[menuActionRow] = "Add ignore @whi@" + name;
  2823. menuActionID[menuActionRow] = 42;
  2824. menuActionRow++;
  2825. menuActionName[menuActionRow] = "Add friend @whi@" + name;
  2826. menuActionID[menuActionRow] = 337;
  2827. menuActionRow++;
  2828. } else if (isFriendOrSelf(name)) {
  2829. menuActionName[menuActionRow] = "Message @whi@" + name;
  2830. menuActionID[menuActionRow] = 2639;
  2831. menuActionRow++;
  2832. }
  2833. }
  2834.  
  2835. messages++;
  2836. }
  2837. }
  2838. }
  2839.  
  2840. private void buildSplitPrivateChatMenu() {
  2841. if (splitPrivateChat == 0) {
  2842. return;
  2843. }
  2844.  
  2845. int yOffsetPos = 0;
  2846.  
  2847. if (systemUpdateTimer != 0) {
  2848. yOffsetPos = 1;
  2849. }
  2850.  
  2851. for (int index = 0; index < 500; index++) {
  2852. if (chatMessages[index] != null) {
  2853. int type = chatTypes[index];
  2854. String name = chatNames[index];
  2855. boolean fixed = GameFrame.getScreenMode() == ScreenMode.FIXED;
  2856.  
  2857. if (name != null && name.indexOf("@") == 0) {
  2858. name = NAME_PATTERN.matcher(name).replaceAll("");
  2859. }
  2860.  
  2861. if ((type == 3 || type == 7) && (type == 7 || privateChatMode == 0 || privateChatMode == 1 && isFriendOrSelf(name))) {
  2862. int l = chatArea.getyPos() - 9 - yOffsetPos * 13;
  2863.  
  2864. if (super.mouseX > (fixed ? 4 : 0) && super.mouseY - (fixed ? 4 : 0) > l - 10 && super.mouseY - (fixed ? 4 : 0) <= l + 3) {
  2865. int i1 = normalText.getTextWidth("From: " + name + chatMessages[index]) + 25;
  2866.  
  2867. if (i1 > 450) {
  2868. i1 = 450;
  2869. }
  2870.  
  2871. if (super.mouseX < (fixed ? 4 : 0) + i1) {
  2872. if (!isFriendOrSelf(name)) {
  2873. menuActionName[menuActionRow] = "Add ignore @whi@" + name;
  2874. menuActionID[menuActionRow] = 2042;
  2875. menuActionRow++;
  2876. menuActionName[menuActionRow] = "Add friend @whi@" + name;
  2877. menuActionID[menuActionRow] = 2337;
  2878. menuActionRow++;
  2879. } else if (isFriendOrSelf(name)) {
  2880. menuActionName[menuActionRow] = "Message @whi@" + name;
  2881. menuActionID[menuActionRow] = 2639;
  2882. menuActionRow++;
  2883. }
  2884. }
  2885. }
  2886.  
  2887. if (++yOffsetPos >= 5) {
  2888. return;
  2889. }
  2890. }
  2891.  
  2892. if ((type == 5 || type == 6) && privateChatMode < 2 && ++yOffsetPos >= 5) {
  2893. return;
  2894. }
  2895. }
  2896. }
  2897. }
  2898.  
  2899. private void calcCameraPos() {
  2900. int xPos = spinPacketX * 128 + 64;
  2901. int yPos = spinPacketY * 128 + 64;
  2902. int zPos = method42(plane, yPos, xPos) - spinPacketHeight;
  2903.  
  2904. if (xCameraPos < xPos) {
  2905. xCameraPos += spinPacketConstantSpeed + (xPos - xCameraPos) * spinPacketVariableSpeed / 1000;
  2906.  
  2907. if (xCameraPos > xPos) {
  2908. xCameraPos = xPos;
  2909. }
  2910. }
  2911.  
  2912. if (xCameraPos > xPos) {
  2913. xCameraPos -= spinPacketConstantSpeed + (xCameraPos - xPos) * spinPacketVariableSpeed / 1000;
  2914.  
  2915. if (xCameraPos < xPos) {
  2916. xCameraPos = xPos;
  2917. }
  2918. }
  2919.  
  2920. if (zCameraPos < zPos) {
  2921. zCameraPos += spinPacketConstantSpeed + (zPos - zCameraPos) * spinPacketVariableSpeed / 1000;
  2922.  
  2923. if (zCameraPos > zPos) {
  2924. zCameraPos = zPos;
  2925. }
  2926. }
  2927.  
  2928. if (zCameraPos > zPos) {
  2929. zCameraPos -= spinPacketConstantSpeed + (zCameraPos - zPos) * spinPacketVariableSpeed / 1000;
  2930.  
  2931. if (zCameraPos < zPos) {
  2932. zCameraPos = zPos;
  2933. }
  2934. }
  2935.  
  2936. if (yCameraPos < yPos) {
  2937. yCameraPos += spinPacketConstantSpeed + (yPos - yCameraPos) * spinPacketVariableSpeed / 1000;
  2938.  
  2939. if (yCameraPos > yPos) {
  2940. yCameraPos = yPos;
  2941. }
  2942. }
  2943.  
  2944. if (yCameraPos > yPos) {
  2945. yCameraPos -= spinPacketConstantSpeed + (yCameraPos - yPos) * spinPacketVariableSpeed / 1000;
  2946.  
  2947. if (yCameraPos < yPos) {
  2948. yCameraPos = yPos;
  2949. }
  2950. }
  2951.  
  2952. xPos = moveCameraX * 128 + 64;
  2953. yPos = moveCameraY * 128 + 64;
  2954. zPos = method42(plane, yPos, xPos) - moveCameraZ;
  2955. int l = xPos - xCameraPos;
  2956. int i1 = zPos - zCameraPos;
  2957. int j1 = yPos - yCameraPos;
  2958. int k1 = (int) Math.sqrt(l * l + j1 * j1);
  2959. int l1 = (int) (Math.atan2(i1, k1) * 325.94900000000001D) & 0x7ff;
  2960. int i2 = (int) (Math.atan2(l, j1) * -325.94900000000001D) & 0x7ff;
  2961.  
  2962. if (l1 < 128) {
  2963. l1 = 128;
  2964. }
  2965.  
  2966. if (l1 > 383) {
  2967. l1 = 383;
  2968. }
  2969.  
  2970. if (yCameraCurve < l1) {
  2971. yCameraCurve += moveCameraSpeed + (l1 - yCameraCurve) * moveCameraAngle / 1000;
  2972.  
  2973. if (yCameraCurve > l1) {
  2974. yCameraCurve = l1;
  2975. }
  2976. }
  2977.  
  2978. if (yCameraCurve > l1) {
  2979. yCameraCurve -= moveCameraSpeed + (yCameraCurve - l1) * moveCameraAngle / 1000;
  2980.  
  2981. if (yCameraCurve < l1) {
  2982. yCameraCurve = l1;
  2983. }
  2984. }
  2985.  
  2986. int j2 = i2 - xCameraCurve;
  2987.  
  2988. if (j2 > 1024) {
  2989. j2 -= 2048;
  2990. }
  2991.  
  2992. if (j2 < -1024) {
  2993. j2 += 2048;
  2994. }
  2995.  
  2996. if (j2 > 0) {
  2997. xCameraCurve += moveCameraSpeed + j2 * moveCameraAngle / 1000;
  2998. xCameraCurve &= 0x7ff;
  2999. }
  3000.  
  3001. if (j2 < 0) {
  3002. xCameraCurve -= moveCameraSpeed + -j2 * moveCameraAngle / 1000;
  3003. xCameraCurve &= 0x7ff;
  3004. }
  3005.  
  3006. int k2 = i2 - xCameraCurve;
  3007.  
  3008. if (k2 > 1024) {
  3009. k2 -= 2048;
  3010. }
  3011.  
  3012. if (k2 < -1024) {
  3013. k2 += 2048;
  3014. }
  3015.  
  3016. if (k2 < 0 && j2 > 0 || k2 > 0 && j2 < 0) {
  3017. xCameraCurve = i2;
  3018. }
  3019. }
  3020.  
  3021. private void calcEntityScreenPos(int i, int j, int l) {
  3022. if (i < 128 || l < 128 || i > 13056 || l > 13056) {
  3023. spriteDrawX = -1;
  3024. spriteDrawY = -1;
  3025. return;
  3026. }
  3027.  
  3028. int i1 = method42(plane, l, i) - j;
  3029. i -= xCameraPos;
  3030. i1 -= zCameraPos;
  3031. l -= yCameraPos;
  3032. int j1 = Model.SINE[yCameraCurve];
  3033. int k1 = Model.COSINE[yCameraCurve];
  3034. int l1 = Model.SINE[xCameraCurve];
  3035. int i2 = Model.COSINE[xCameraCurve];
  3036. int j2 = l * l1 + i * i2 >> 16;
  3037. l = l * i2 - i * l1 >> 16;
  3038. i = j2;
  3039. j2 = i1 * k1 - l * j1 >> 16;
  3040. l = i1 * j1 + l * k1 >> 16;
  3041. i1 = j2;
  3042.  
  3043. if (l >= 50) {
  3044. spriteDrawX = Rasterizer.centerX + (i << log_view_dist) / l;
  3045. spriteDrawY = Rasterizer.centerY + (i1 << log_view_dist) / l;
  3046. } else {
  3047. spriteDrawX = -1;
  3048. spriteDrawY = -1;
  3049. }
  3050. }
  3051.  
  3052. private void chatJoin(long l) {
  3053. try {
  3054. if (l == 0L) {
  3055. return;
  3056. }
  3057.  
  3058. getOut().putOpcode(60);
  3059. getOut().putLong(l);
  3060. return;
  3061. } catch (RuntimeException runtimeexception) {
  3062. Signlink.reportError("47229, " + 3 + ", " + l + ", " + runtimeexception.toString());
  3063. }
  3064.  
  3065. throw new RuntimeException();
  3066. }
  3067.  
  3068. private void checkSize() {
  3069. int width = getScreenWidth();
  3070. int height = getScreenHeight();
  3071. if (GameFrame.getScreenMode() == ScreenMode.RESIZABLE) {
  3072. if (!isApplet) {
  3073. if (clientWidth != width && width >= 782) {
  3074. setResizing(true);
  3075. clientWidth = width;
  3076. super.myWidth = clientWidth;
  3077. updateScreen();
  3078. setResizing(false);
  3079. }
  3080. if (clientHeight != height && height >= 555) {
  3081. setResizing(true);
  3082. clientHeight = height;
  3083. super.myHeight = clientHeight;
  3084. updateScreen();
  3085. setResizing(false);
  3086. }
  3087. } else {
  3088. if (clientWidth != width && width >= 782) {
  3089. setResizing(true);
  3090. clientWidth = super.getWidth();
  3091. super.myWidth = clientWidth;
  3092. updateScreen();
  3093. setResizing(false);
  3094. }
  3095. if (clientHeight != height && height >= 555) {
  3096. setResizing(true);
  3097. clientHeight = super.getHeight();
  3098. super.myHeight = clientHeight;
  3099. updateScreen();
  3100. setResizing(false);
  3101. }
  3102. }
  3103. }
  3104. }
  3105.  
  3106. @Override
  3107. public void cleanUpForQuit() {
  3108. Signlink.reporterror = false;
  3109.  
  3110. try {
  3111. if (getConnection() != null) {
  3112. getConnection().close();
  3113. }
  3114. } catch (Exception _ex) {
  3115. }
  3116.  
  3117. cacheSprite = null;
  3118. setConnection(null);
  3119. stopMidi();
  3120.  
  3121. if (mouseDetection != null) {
  3122. mouseDetection.running = false;
  3123. }
  3124.  
  3125. mouseDetection = null;
  3126.  
  3127. if (onDemandFetcher != null) {
  3128. onDemandFetcher.dispose();
  3129. }
  3130.  
  3131. onDemandFetcher = null;
  3132. aStream_834 = null;
  3133. setOut(null);
  3134. setLoginBuffer(null);
  3135. setInputBuffer(null);
  3136. anIntArray1234 = null;
  3137. aByteArrayArray1183 = null;
  3138. aByteArrayArray1247 = null;
  3139. floorMap = null;
  3140. objectMap = null;
  3141. intGroundArray = null;
  3142. byteGroundArray = null;
  3143. worldController = null;
  3144. clippingPlanes = null;
  3145. anIntArrayArray901 = null;
  3146. anIntArrayArray825 = null;
  3147. bigX = null;
  3148. bigY = null;
  3149. aByteArray912 = null;
  3150. tabAreaIP = null;
  3151. leftFrame = null;
  3152. topFrame = null;
  3153. rightFrame = null;
  3154. mapAreaIP = null;
  3155. gameScreenIP = null;
  3156. chatAreaIP = null;
  3157. aRSImageProducer_1125 = null;
  3158. mapBack = null;
  3159. compass = null;
  3160. headIcons = null;
  3161. skullIcons = null;
  3162. headIconsHint = null;
  3163. crosses = null;
  3164. mapDotItem = null;
  3165. mapDotNPC = null;
  3166. mapDotPlayer = null;
  3167. mapDotFriend = null;
  3168. mapDotTeam = null;
  3169. mapDotClan = null;
  3170. mapScenes = null;
  3171. mapFunctions = null;
  3172. anIntArrayArray929 = null;
  3173. playerArray = null;
  3174. playerIndices = null;
  3175. anIntArray894 = null;
  3176. setaStreamArray895s(null);
  3177. anIntArray840 = null;
  3178. npcArray = null;
  3179. npcIndices = null;
  3180. groundArray = null;
  3181. setaClass19_1179(null);
  3182. setaClass19_1013(null);
  3183. setaClass19_1056(null);
  3184. menuActionCmd2 = null;
  3185. menuActionCmd3 = null;
  3186. menuActionCmd4 = null;
  3187. menuActionID = null;
  3188. menuActionCmd1 = null;
  3189. menuActionName = null;
  3190. variousSettings = null;
  3191. anIntArray1072 = null;
  3192. anIntArray1073 = null;
  3193. aClass30_Sub2_Sub1_Sub1Array1140 = null;
  3194. miniMapRegions = null;
  3195. friendsList = null;
  3196. friendsListAsLongs = null;
  3197. friendsNodeIDs = null;
  3198. aRSImageProducer_1107 = null;
  3199. titleScreenIP = null;
  3200. multiOverlay = null;
  3201. nullLoader();
  3202. ObjectDefinition.nullify();
  3203. MobDefinition.nullify();
  3204. ItemDefinition.nullify();
  3205. FrameReader.nullify();
  3206. Flo.cache = null;
  3207. IdentityKit.cache = null;
  3208. RSInterface.interfaceCache = null;
  3209. Animation.cache = null;
  3210. SpotAnimDefinition.cache = null;
  3211. SpotAnimDefinition.list = null;
  3212. Varp.setCache(null);
  3213. super.fullGameScreen = null;
  3214. Player.mruNodes = null;
  3215. Rasterizer.nullify();
  3216. WorldController.nullify();
  3217. Model.nullify();
  3218. Texture.reset();
  3219. System.gc();
  3220. }
  3221.  
  3222. public void closeGameInterfaces() {
  3223. getOut().putOpcode(130);
  3224.  
  3225. if (invOverlayInterfaceID != -1) {
  3226. invOverlayInterfaceID = -1;
  3227. aBoolean1149 = false;
  3228. tabAreaAltered = true;
  3229. }
  3230.  
  3231. if (backDialogID != -1) {
  3232. backDialogID = -1;
  3233. inputTaken = true;
  3234. aBoolean1149 = false;
  3235. }
  3236.  
  3237. openInterfaceID = -1;
  3238. setFullscreenInterfaceID(-1);
  3239. }
  3240.  
  3241. private void compareCrcValues() {
  3242. int secondsToWait = 5;
  3243. expectedCRCs[8] = 0;
  3244. int checksumCount = 0;
  3245.  
  3246. while (expectedCRCs[8] == 0) {
  3247. String error = "Unknown problem";
  3248. ////drawSmoothLoading(20, "Connecting to web server");
  3249.  
  3250. try {
  3251. DataInputStream in = openJagGrabInputStream("crc" + (int) (Math.random() * 99999999D) + "-" + 317);
  3252. ByteBuffer buffer = new ByteBuffer(new byte[40]);
  3253. in.readFully(buffer.buffer, 0, 40);
  3254. in.close();
  3255.  
  3256. for (int index = 0; index < 9; index++) {
  3257. expectedCRCs[index] = buffer.getIntLittleEndian();
  3258. }
  3259.  
  3260. int checksumValue = buffer.getIntLittleEndian();
  3261. int expectedValue = 1234;
  3262.  
  3263. for (int index = 0; index < 9; index++) {
  3264. expectedValue = (expectedValue << 1) + expectedCRCs[index];
  3265. }
  3266.  
  3267. if (checksumValue != expectedValue) {
  3268. error = "checksum problem";
  3269. expectedCRCs[8] = 0;
  3270. }
  3271. } catch (EOFException _ex) {
  3272. error = "EOF problem";
  3273. expectedCRCs[8] = 0;
  3274. } catch (IOException _ex) {
  3275. error = "connection problem";
  3276. expectedCRCs[8] = 0;
  3277. } catch (Exception _ex) {
  3278. error = "logic problem";
  3279. expectedCRCs[8] = 0;
  3280.  
  3281. if (!Signlink.reporterror) {
  3282. return;
  3283. }
  3284. }
  3285.  
  3286. if (expectedCRCs[8] == 0) {
  3287. checksumCount++;
  3288.  
  3289. for (int seconds = secondsToWait; seconds > 0; seconds--) {
  3290. if (checksumCount >= 10) {
  3291. //drawSmoothLoading(10, "Game updated - please reload page");
  3292. seconds = 10;
  3293. } else {
  3294. //drawSmoothLoading(10, error + " - Will retry in " + seconds + " secs.");
  3295. }
  3296.  
  3297. try {
  3298. Thread.sleep(1000L);
  3299. } catch (Exception _ex) {
  3300. }
  3301. }
  3302.  
  3303. secondsToWait *= 2;
  3304.  
  3305. if (secondsToWait > 60) {
  3306. secondsToWait = 60;
  3307. }
  3308.  
  3309. httpFallback = !httpFallback;
  3310. }
  3311. }
  3312. }
  3313.  
  3314. public Socket createFileServerSocket(int port) throws IOException {
  3315. return new Socket(InetAddress.getByName(Configuration.JAGCACHED_HOST), port);
  3316. }
  3317.  
  3318. public Socket createGameServerSocket(int port) throws IOException {
  3319. return new Socket(InetAddress.getByName(Configuration.SERVER_HOST), port);
  3320. }
  3321.  
  3322. public void hitmarkDrawOld(int spriteDrawX, int spriteDrawY, int j1, Entity e) {
  3323. if(spriteDrawX > -1)
  3324. {
  3325. if(j1 == 1)
  3326. spriteDrawY -= 20;
  3327. if(j1 == 2)
  3328. {
  3329. spriteDrawX -= 15;
  3330. spriteDrawY -= 10;
  3331. }
  3332. if(j1 == 3)
  3333. {
  3334. spriteDrawX += 15;
  3335. spriteDrawY -= 10;
  3336. }
  3337. int dmg = e.hitArray[j1];
  3338. if(dmg > 0) {
  3339. if(!Configuration.CONSTITUTION_ENABLED) {
  3340. dmg = dmg / 10;
  3341. if(dmg == 0)
  3342. dmg = 1;
  3343. }
  3344. cacheSprite[784].drawSprite(spriteDrawX - 11, spriteDrawY - 12);
  3345. } else {
  3346. cacheSprite[785].drawSprite(spriteDrawX - 12, spriteDrawY - 13);
  3347. }
  3348. smallText.drawText(0, String.valueOf(dmg), spriteDrawY + 4, spriteDrawX);
  3349. smallText.drawText(0xffffff, String.valueOf(dmg), spriteDrawY + 3, spriteDrawX - 1);
  3350. }
  3351. }
  3352.  
  3353. public void hitmarkDrawNew(Entity e, int hitLength, int type, int icon,
  3354. int damage, int soak, int move, int opacity, int mask) {
  3355. if (spriteDrawX > -1) {
  3356. int drawPos = 0;
  3357. if (mask == 0) {
  3358. e.hitMarkPos[0] = spriteDrawY + move;
  3359. drawPos = e.hitMarkPos[0];
  3360. }
  3361. if (mask != 0) {
  3362. e.hitMarkPos[mask] = e.hitMarkPos[0] + (19 * mask);
  3363. drawPos = e.hitMarkPos[mask];
  3364. }
  3365. if(soak > 0) {
  3366. //if(!getOption("absorb_damage")) {
  3367. // soak = 0;
  3368. //}
  3369. soak = 0;
  3370. }
  3371. if (damage > 0) {
  3372. Sprite end1 = null, middle = null, end2 = null;
  3373. int x = 0;
  3374. if(!Configuration.CONSTITUTION_ENABLED) {
  3375. damage = (damage / 10);
  3376. if(damage == 0) {
  3377. damage = 1;
  3378. }
  3379. }
  3380. switch (hitLength) {
  3381. /* Trial and error shit, terrible hardcoding :( */
  3382. case 1:
  3383. x = 8;
  3384. break;
  3385. case 2:
  3386. x = 4;
  3387. break;
  3388. case 3:
  3389. x = 1;
  3390. break;
  3391. }
  3392. if (soak > 0) {
  3393. x -= 16;
  3394. }
  3395. end1 = cacheSprite[792 + (type * 3)];
  3396. middle = cacheSprite[792 + (type * 3) + 1];
  3397. end2 = cacheSprite[792 + (type * 3) + 2];
  3398. if (icon != 255 && icon != 8) {
  3399. cacheSprite[786 + icon].drawSprite3(spriteDrawX
  3400. - 31 + x, drawPos - 9, opacity);
  3401. }
  3402. end1.drawSprite3(spriteDrawX - 12 + x, drawPos - 12, opacity);
  3403. x += 4;
  3404. for (int i = 0; i < hitLength * 2; i++) {
  3405. middle.drawSprite3(spriteDrawX - 12 + x, drawPos - 12, opacity);
  3406. x += 4;
  3407. }
  3408. end2.drawSprite3(spriteDrawX - 12 + x, drawPos - 12, opacity);
  3409. (type == 1 ? bigHit : smallHit).drawOpacityText(0xffffff,
  3410. String.valueOf(damage), drawPos + (type == 1 ? 2 : 32),
  3411. spriteDrawX + 4 + (soak > 0 ? -16 : 0), opacity);
  3412. if (soak > 0)
  3413. drawSoak(soak, opacity, drawPos, x);
  3414. } else {
  3415. int decrX = soak > 0 ? 26 : 12;
  3416. cacheSprite[543].drawSprite3(spriteDrawX - decrX, drawPos - 14, opacity);
  3417. if (soak > 0) {
  3418. drawSoak(soak, opacity, drawPos, 4);
  3419. }
  3420. }
  3421. }
  3422. }
  3423.  
  3424. public void drawSoak(int damage, int opacity, int drawPos, int x) {
  3425. x -= 12;
  3426. int soakLength = String.valueOf(damage).length();
  3427. cacheSprite[793 + 5].drawSprite3(spriteDrawX + x,
  3428. drawPos - 12, opacity);
  3429. x += 20;
  3430. cacheSprite[792 + 30].drawSprite3(spriteDrawX + x,
  3431. drawPos - 12, opacity);
  3432. x += 4;
  3433. for (int i = 0; i < soakLength * 2; i++) {
  3434. cacheSprite[792 + 31].drawSprite3(spriteDrawX + x,
  3435. drawPos - 12, opacity);
  3436. x += 4;
  3437. }
  3438. cacheSprite[792 + 32].drawSprite3(spriteDrawX + x,
  3439. drawPos - 10, opacity);
  3440. if(damage > 99) {
  3441. x -= 5;
  3442. }
  3443. if(damage > 999) {
  3444. x -= 5;
  3445. }
  3446. smallHit.drawOpacityText(0xffffff, String.valueOf(damage),
  3447. drawPos + 32, spriteDrawX - 8 + x + (soakLength == 1 ? 5 : 0),
  3448. opacity);
  3449. }
  3450.  
  3451. private TextDrawingArea smallHit;
  3452. private TextDrawingArea bigHit;
  3453.  
  3454. private void delFriend(long nameHash) {
  3455. try {
  3456. if (nameHash == 0L) {
  3457. return;
  3458. }
  3459.  
  3460. for (int i = 0; i < friendCount; i++) {
  3461. if (friendsListAsLongs[i] != nameHash) {
  3462. continue;
  3463. }
  3464.  
  3465. friendCount--;
  3466.  
  3467. for (int n = i; n < friendCount; n++) {
  3468. friendsList[n] = friendsList[n + 1];
  3469. friendsNodeIDs[n] = friendsNodeIDs[n + 1];
  3470. friendsListAsLongs[n] = friendsListAsLongs[n + 1];
  3471. }
  3472.  
  3473. getOut().putOpcode(215);
  3474. getOut().putLong(nameHash);
  3475. break;
  3476. }
  3477. } catch (RuntimeException runtimeexception) {
  3478. Signlink.reportError("18622, " + false + ", " + nameHash + ", " + runtimeexception.toString());
  3479. throw new RuntimeException();
  3480. }
  3481. }
  3482.  
  3483. private void delIgnore(long nameHash) {
  3484. try {
  3485. if (nameHash == 0L) {
  3486. return;
  3487. }
  3488.  
  3489. for (int i = 0; i < ignoreCount; i++) {
  3490. if (ignoreListAsLongs[i] == nameHash) {
  3491. ignoreCount--;
  3492. System.arraycopy(ignoreListAsLongs, i + 1, ignoreListAsLongs, i, ignoreCount - i);
  3493. getOut().putOpcode(74);
  3494. getOut().putLong(nameHash);
  3495. return;
  3496. }
  3497. }
  3498.  
  3499. return;
  3500. } catch (RuntimeException runtimeexception) {
  3501. Signlink.reportError("47229, " + 3 + ", " + nameHash + ", " + runtimeexception.toString());
  3502. }
  3503.  
  3504. throw new RuntimeException();
  3505. }
  3506.  
  3507. private void determineMenuSize() {
  3508. int width = newBoldFont.getTextWidth("Choose Option");
  3509. for (int index = 0; index < menuActionRow; index++) {
  3510. int menuWidth = newBoldFont.getTextWidth(menuActionName[index]);
  3511. if (menuPlayerName[index] != null) {
  3512. menuWidth += newBoldFont.getTextWidth(menuPlayerName[index]);
  3513. }
  3514. if (menuActionTitle[index] != null) {
  3515. menuWidth += newBoldFont.getTextWidth(menuActionTitle[index]);
  3516. }
  3517. if (menuWidth > width) {
  3518. width = menuWidth;
  3519. }
  3520. }
  3521. width += 8;
  3522. int menHeight = 15 * menuActionRow + 21;
  3523. if (GameFrame.getScreenMode() == ScreenMode.FIXED) {
  3524. if (super.saveClickX > 4 && super.saveClickY > 4 && super.saveClickX < 516 && super.saveClickY < 338) {
  3525. int offsetX = super.saveClickX - 4 - width / 2;
  3526. if (offsetX + width > 512) {
  3527. offsetX = 512 - width;
  3528. }
  3529. if (offsetX < 0) {
  3530. offsetX = 0;
  3531. }
  3532. int offsetY = super.saveClickY - 4;
  3533. if (offsetY + menHeight > 334) {
  3534. offsetY = 334 - menHeight;
  3535. }
  3536. if (offsetY < 0) {
  3537. offsetY = 0;
  3538. }
  3539. menuOpen = true;
  3540. menuScreenArea = 0;
  3541. menuOffsetX = offsetX;
  3542. menuOffsetY = offsetY;
  3543. menuWidth = width;
  3544. menuHeight = 15 * menuActionRow + 22;
  3545. }
  3546. if (super.saveClickX > 519 && super.saveClickY > 168 && super.saveClickX < 765 && super.saveClickY < 503) {
  3547. int offsetX = super.saveClickX - 519 - width / 2;
  3548. if (offsetX < 0) {
  3549. offsetX = 0;
  3550. } else if (offsetX + width > 245) {
  3551. offsetX = 245 - width;
  3552. }
  3553. int offsetY = super.saveClickY - 168;
  3554. if (offsetY < 0) {
  3555. offsetY = 0;
  3556. } else if (offsetY + menHeight > 333) {
  3557. offsetY = 333 - menHeight;
  3558. }
  3559. menuOpen = true;
  3560. menuScreenArea = 1;
  3561. menuOffsetX = offsetX;
  3562. menuOffsetY = offsetY;
  3563. menuWidth = width;
  3564. menuHeight = 15 * menuActionRow + 22;
  3565. }
  3566. if (super.saveClickX > 0 && super.saveClickY > 338 && super.saveClickX < 516 && super.saveClickY < 503) {
  3567. int offsetX = super.saveClickX - 0 - width / 2;
  3568. if (offsetX < 0) {
  3569. offsetX = 0;
  3570. } else if (offsetX + width > 516) {
  3571. offsetX = 516 - width;
  3572. }
  3573. int offsetY = super.saveClickY - 338;
  3574. if (offsetY < 0) {
  3575. offsetY = 0;
  3576. } else if (offsetY + menHeight > 165) {
  3577. offsetY = 165 - menHeight;
  3578. }
  3579. menuOpen = true;
  3580. menuScreenArea = 2;
  3581. menuOffsetX = offsetX;
  3582. menuOffsetY = offsetY;
  3583. menuWidth = width;
  3584. menuHeight = 15 * menuActionRow + 22;
  3585. }
  3586. // if(super.saveClickX > 0 && super.saveClickY > 338 &&
  3587. // super.saveClickX < 516 && super.saveClickY < 503) {
  3588. if (super.saveClickX > 519 && super.saveClickY > 0 && super.saveClickX < 765 && super.saveClickY < 168) {
  3589. int offsetX = super.saveClickX - 519 - width / 2;
  3590. if (offsetX < 0) {
  3591. offsetX = 0;
  3592. } else if (offsetX + width > 245) {
  3593. offsetX = 245 - width;
  3594. }
  3595. int offsetY = super.saveClickY - 0;
  3596. if (offsetY < 0) {
  3597. offsetY = 0;
  3598. } else if (offsetY + menHeight > 168) {
  3599. offsetY = 168 - menHeight;
  3600. }
  3601. menuOpen = true;
  3602. menuScreenArea = 3;
  3603. menuOffsetX = offsetX;
  3604. menuOffsetY = offsetY;
  3605. menuWidth = width;
  3606. menuHeight = 15 * menuActionRow + 22;
  3607. }
  3608. } else {
  3609. if (super.saveClickX > 0 && super.saveClickY > 0 && super.saveClickX < getScreenWidth() && super.saveClickY < getScreenHeight()) {
  3610. int offsetX = super.saveClickX - 0 - width / 2;
  3611. if (offsetX + width > getScreenWidth()) {
  3612. offsetX = getScreenWidth() - width;
  3613. }
  3614. if (offsetX < 0) {
  3615. offsetX = 0;
  3616. }
  3617. int offsetY = super.saveClickY - 0;
  3618. if (offsetY + menHeight > getScreenHeight()) {
  3619. offsetY = getScreenHeight() - menHeight;
  3620. }
  3621. if (offsetY < 0) {
  3622. offsetY = 0;
  3623. }
  3624. menuOpen = true;
  3625. menuScreenArea = 0;
  3626. menuOffsetX = offsetX;
  3627. menuOffsetY = offsetY;
  3628. menuWidth = width;
  3629. menuHeight = 15 * menuActionRow + 22;
  3630. }
  3631. }
  3632. }
  3633.  
  3634. public String getMoneyInPouch() {
  3635. String Cash = RSInterface.interfaceCache[8135].message;
  3636. long convertedMoney = Long.parseLong(Cash);
  3637. Cash = formatAmount(convertedMoney);
  3638. return Cash;
  3639. }
  3640.  
  3641. public final String formatAmount(long amount) {
  3642. String format = "Too high!";
  3643. if (amount >= 0 && amount < 100000) {
  3644. format = String.valueOf(amount);
  3645. } else if (amount >= 100000 && amount < 1000000) {
  3646. format = amount / 1000 + "K";
  3647. } else if (amount >= 1000000 && amount < 1000000000L) {
  3648. format = amount / 1000000 + "M";
  3649. } else if (amount >= 1000000000L && amount < 1000000000000L) {
  3650. format = amount / 1000000000 + "B";
  3651. } else if (amount >= 10000000000000L && amount < 10000000000000000L) {
  3652. format = amount / 1000000000000L + "T";
  3653. } else if (amount >= 10000000000000000L && amount < 1000000000000000000L) {
  3654. format = amount / 1000000000000000L + "QD";
  3655. } else if (amount >= 1000000000000000000L && amount < Long.MAX_VALUE) {
  3656. format = amount / 1000000000000000000L + "QT";
  3657. }
  3658. return format;
  3659. }
  3660.  
  3661. private int currentActionMenu;
  3662.  
  3663. private void doAction(int actionId) {
  3664. if (actionId < 0) {
  3665. return;
  3666. }
  3667.  
  3668. if (inputDialogState != 0) {
  3669. inputDialogState = 0;
  3670. inputTaken = true;
  3671. }
  3672.  
  3673. bankItemDragSprite = null;
  3674.  
  3675. int nodeId = menuActionCmd1[actionId];
  3676. int slot = menuActionCmd2[actionId];
  3677. int interfaceId = menuActionCmd3[actionId];
  3678. int fourthMenuAction = menuActionCmd4[actionId];
  3679. int action = menuActionID[actionId];
  3680. int x = slot;
  3681. int y = interfaceId;
  3682. int id = nodeId > 0x7fff ? fourthMenuAction : nodeId >> 14 & 0x7fff;
  3683.  
  3684. if (action == 1045) {// Toggle quick prayers / curses
  3685. if (openInterfaceID != -1)
  3686. pushMessage("Please close the open interface first.", 0, "");
  3687. else {
  3688. if ((currentStats[5] / 10) > 0)
  3689. handleQuickAidsActive();
  3690. else
  3691. pushMessage(
  3692. "You need to recharge your Prayer points at an altar.", 0,
  3693. "");
  3694. return;
  3695. }
  3696. return;
  3697. } else if (action == 1046) {// Select quick prayers / curses
  3698. toggleQuickAidsSelection();
  3699. return;
  3700. }
  3701.  
  3702. if (action >= 2000) {
  3703. action -= 2000;
  3704. }
  3705.  
  3706. if(interfaceId == 24630 || interfaceId == 24632) {
  3707. if(inputDialogState == 3) {
  3708. getGrandExchange().searching = false;
  3709. getGrandExchange().totalItemResults = 0;
  3710. amountOrNameInput = "";
  3711. }
  3712. }
  3713.  
  3714. if(action == 22700 || action == 1251) {
  3715. getGrandExchange().searching = false;
  3716. getOut().putOpcode(204);
  3717. getOut().putShort(getGrandExchange().itemSelected);
  3718. return;
  3719. }
  3720.  
  3721. if(action >= 990 && action <= 992) {
  3722. getOut().putOpcode(8);
  3723. getOut().putInt(action);
  3724. inputString = "";
  3725. privateChatMode = action - 990;
  3726. return;
  3727. }
  3728.  
  3729. if (action == 712) {
  3730. Configuration.MONEY_POUCH_ENABLED = !Configuration.MONEY_POUCH_ENABLED;
  3731. } else if(action == 713) {
  3732. if(openInterfaceID > 0 && openInterfaceID != 3323 && openInterfaceID != 6575) {
  3733. pushMessage("Please close the interface you have open before opening another one.", 0, "");
  3734. return;
  3735. }
  3736. inputTitle = "Enter amount of coins to withdraw:";
  3737. amountOrNameInput = "";
  3738. interfaceButtonAction = 557;
  3739. inputDialogState = 1;
  3740. inputTaken = true;
  3741. withdrawingMoneyFromPouch = true;
  3742. return;
  3743. } else if(action == 715) {
  3744. String cash = getMoneyInPouch();
  3745. pushMessage("Your money pouch currently contains "+cash+" ("+Long.parseLong(RSInterface.interfaceCache[8135].message)+") coins.", 0, "");
  3746. } else {
  3747. withdrawingMoneyFromPouch = false;
  3748. }
  3749.  
  3750. //System.out.println(action);
  3751.  
  3752. switch (action) {
  3753. case 1050:
  3754. getOut().putOpcode(185);
  3755. getOut().putShort(152);
  3756. break;
  3757. case 1013:
  3758. PlayerHandler.totalXP = 0;
  3759. getOut().putOpcode(185);
  3760. getOut().putShort(1013);
  3761. break;
  3762. case 1036:
  3763. getOut().putOpcode(185);
  3764. getOut().putShort(1036);
  3765. break;
  3766. }
  3767.  
  3768. if (action == 1014) {
  3769. setNorth();
  3770. }
  3771.  
  3772.  
  3773. if (action == 1007) {
  3774. PlayerHandler.canGainXP = PlayerHandler.canGainXP ? false : true;
  3775. }
  3776.  
  3777. if (action == 1006 && !PlayerHandler.showBonus) {
  3778. if (!PlayerHandler.gains.isEmpty()) {
  3779. PlayerHandler.gains.removeAll(PlayerHandler.gains);
  3780. }
  3781. PlayerHandler.showXP = PlayerHandler.showXP ? false : true;
  3782. }
  3783.  
  3784. if (action == 1030 && !PlayerHandler.showXP) {
  3785. PlayerHandler.showBonus = PlayerHandler.showBonus ? false : true;
  3786. }
  3787.  
  3788. if (action == 104) {
  3789. spellID = interfaceId;
  3790. if (!autoCast || (autocastId != spellID)) {
  3791. autoCast = true;
  3792. autocastId = spellID;
  3793. sendPacket185(autocastId, -1, 135);
  3794. //pushMessage("Autocast spell selected.", 0, "");
  3795. } else if (autocastId == spellID) {
  3796. setAutoCastOff();
  3797. }
  3798. }
  3799.  
  3800. if (action == 582) {
  3801. NPC npc = npcArray[nodeId];
  3802.  
  3803. if (npc != null) {
  3804. doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, npc.smallY[0], myPlayer.smallX[0], false, npc.smallX[0]);
  3805. crossX = super.saveClickX;
  3806. crossY = super.saveClickY;
  3807. crossType = 2;
  3808. crossIndex = 0;
  3809. getOut().putOpcode(57);
  3810. getOut().writeUnsignedWordA(anInt1285);
  3811. getOut().writeUnsignedWordA(nodeId);
  3812. getOut().writeUnsignedWordBigEndian(anInt1283);
  3813. getOut().writeUnsignedWordA(anInt1284);
  3814. }
  3815. }
  3816.  
  3817. if (action == 234) {
  3818. boolean flag1 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, interfaceId, myPlayer.smallX[0], false, x);
  3819.  
  3820. if (!flag1) {
  3821. flag1 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, interfaceId, myPlayer.smallX[0], false, x);
  3822. }
  3823.  
  3824. crossX = super.saveClickX;
  3825. crossY = super.saveClickY;
  3826. crossType = 2;
  3827. crossIndex = 0;
  3828. getOut().putOpcode(236);
  3829. getOut().writeUnsignedWordBigEndian(interfaceId + baseY);
  3830. getOut().putShort(nodeId);
  3831. getOut().writeUnsignedWordBigEndian(slot + baseX);
  3832. }
  3833.  
  3834. if (action == 62 && method66(nodeId, y, x, id)) {
  3835. getOut().putOpcode(192);
  3836. getOut().putShort(anInt1284);
  3837. getOut().putShort(id);
  3838. getOut().writeSignedBigEndian(y + baseY);
  3839. getOut().writeUnsignedWordBigEndian(anInt1283);
  3840. getOut().writeSignedBigEndian(x + baseX);
  3841. getOut().putShort(anInt1285);
  3842. }
  3843.  
  3844. if (action == 511) {
  3845. boolean flag2 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, y, myPlayer.smallX[0], false, x);
  3846.  
  3847. if (!flag2) {
  3848. flag2 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, y, myPlayer.smallX[0], false, x);
  3849. }
  3850.  
  3851. crossX = super.saveClickX;
  3852. crossY = super.saveClickY;
  3853. crossType = 2;
  3854. crossIndex = 0;
  3855. getOut().putOpcode(109);
  3856. getOut().writeUnsignedWordBigEndian(anInt1284);
  3857. getOut().writeUnsignedWordA(anInt1285);
  3858. getOut().putShort(nodeId);
  3859. getOut().writeUnsignedWordA(y + baseY);
  3860. getOut().writeSignedBigEndian(anInt1283);
  3861. getOut().putShort(x + baseX);
  3862. }
  3863.  
  3864. if (action == 74) {
  3865. System.out.println("HI");
  3866. getOut().putOpcode(122);
  3867. getOut().putShort(interfaceId);
  3868. getOut().putShort(slot);
  3869. getOut().putShort(nodeId);
  3870. atInventoryLoopCycle = 0;
  3871. atInventoryInterface = y;
  3872. atInventoryIndex = x;
  3873. atInventoryInterfaceType = 2;
  3874.  
  3875. if (RSInterface.interfaceCache[y].parentID == openInterfaceID) {
  3876. atInventoryInterfaceType = 1;
  3877. }
  3878.  
  3879. if (RSInterface.interfaceCache[y].parentID == backDialogID) {
  3880. atInventoryInterfaceType = 3;
  3881. }
  3882. }
  3883. if (action == 222) {
  3884. getOut().putOpcode(222);
  3885. getOut().putShort(interfaceId);
  3886. getOut().putByte(currentActionMenu);
  3887. }
  3888. if (action == 315) {
  3889. switch (interfaceId) {
  3890. case 24654:
  3891. amountOrNameInput = "";
  3892. getGrandExchange().totalItemResults = 0;
  3893. getGrandExchange().searching = !getGrandExchange().searching;//inputDialogState == 3 ? false : true;
  3894. inputDialogState = inputDialogState == 3 ? 0 : 3;
  3895. break;
  3896. case 26016: // fixed
  3897. toggleSize(ScreenMode.FIXED);
  3898. break;
  3899.  
  3900. case 26019: // resizable
  3901. toggleSize(ScreenMode.RESIZABLE);
  3902. break;
  3903.  
  3904. case 26022: // fullscreen
  3905. toggleSize(ScreenMode.FULLSCREEN);
  3906. }
  3907.  
  3908. RSInterface class9 = RSInterface.interfaceCache[interfaceId];
  3909. boolean flag8 = true;
  3910. if ((class9.contentType == 1321) || (class9.contentType == 1322) || (class9.contentType == 1323)) {
  3911. int index = class9.id - 79924;
  3912. if (index >= 50)
  3913. index -= 50;
  3914. if (index >= 25)
  3915. index -= 25;
  3916. Skills.selectedSkillId = Skills.SKILL_ID_NAME(Skills.SKILL_NAMES[index]);
  3917. }
  3918. if (class9.contentType > 0) {
  3919. flag8 = promptUserForInput(class9);
  3920. }
  3921.  
  3922. if (flag8) {
  3923. switch (interfaceId) {
  3924. case 21341:
  3925. sendFrame248(21172, 3213);
  3926. resetInterfaceAnimation(21172);
  3927. inputTaken = true;
  3928. break;
  3929. case 17231://Quick prayer confirm
  3930. saveQuickSelection();
  3931. break;
  3932. default:
  3933. if(interfaceId >= 17202 && interfaceId <= 17227 || interfaceId == 17279 || interfaceId == 17280) {
  3934. try {
  3935. togglePrayerState(interfaceId);
  3936. } catch(Exception e) {
  3937. e.printStackTrace();
  3938. }
  3939. } else {
  3940. getOut().putOpcode(185);
  3941. getOut().putShort(interfaceId);
  3942. }
  3943. break;
  3944. }
  3945. }
  3946. }
  3947.  
  3948. if (action == 561) {
  3949. Player player = playerArray[nodeId];
  3950.  
  3951. if (player != null) {
  3952. doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, player.smallY[0], myPlayer.smallX[0], false, player.smallX[0]);
  3953. crossX = super.saveClickX;
  3954. crossY = super.saveClickY;
  3955. crossType = 2;
  3956. crossIndex = 0;
  3957. setAnInt1188(getAnInt1188() + id);
  3958.  
  3959. if (getAnInt1188() >= 90) {
  3960. getOut().putOpcode(136);
  3961. setAnInt1188(0);
  3962. }
  3963.  
  3964. getOut().putOpcode(128);
  3965. getOut().putShort(nodeId);
  3966. }
  3967. }
  3968.  
  3969. if (action == 20) {
  3970. NPC npc = npcArray[nodeId];
  3971. if (npc != null) {
  3972. doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, npc.smallY[0], myPlayer.smallX[0], false, npc.smallX[0]);
  3973. crossX = super.saveClickX;
  3974. crossY = super.saveClickY;
  3975. crossType = 2;
  3976. crossIndex = 0;
  3977. getOut().putOpcode(155);
  3978. getOut().writeUnsignedWordBigEndian(nodeId);
  3979. }
  3980. }
  3981.  
  3982. if (action == 779) {
  3983. Player player = playerArray[nodeId];
  3984.  
  3985. if (player != null) {
  3986. doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, player.smallY[0], myPlayer.smallX[0], false, player.smallX[0]);
  3987. crossX = super.saveClickX;
  3988. crossY = super.saveClickY;
  3989. crossType = 2;
  3990. crossIndex = 0;
  3991. getOut().putOpcode(153);
  3992. getOut().writeUnsignedWordBigEndian(nodeId);
  3993. }
  3994. }
  3995.  
  3996. if (action == 516) {
  3997. if (!menuOpen) {
  3998. worldController.method312(super.saveClickY - 4, super.saveClickX - 4);
  3999. } else {
  4000. worldController.method312(interfaceId - 4, slot - 4);
  4001. }
  4002. }
  4003.  
  4004. if (action == 1062) {
  4005. setAnInt924(getAnInt924() + baseX);
  4006.  
  4007. if (getAnInt924() >= 113) {
  4008. getOut().putOpcode(183);
  4009. getOut().putDWordBigEndian(0xe63271);
  4010. setAnInt924(0);
  4011. }
  4012.  
  4013. method66(nodeId, y, x, id);
  4014. getOut().putOpcode(228);
  4015. getOut().writeUnsignedWordA(id);
  4016. getOut().writeUnsignedWordA(y + baseY);
  4017. getOut().putShort(x + baseX);
  4018. }
  4019. if (action == 679 && !aBoolean1149) {
  4020. getOut().putOpcode(40);
  4021. getOut().putShort(interfaceId);
  4022. aBoolean1149 = true;
  4023. }
  4024.  
  4025. if (action == 431) {
  4026. getOut().putOpcode(129);
  4027. getOut().writeUnsignedWordA(slot);
  4028. getOut().putShort(interfaceId);
  4029. getOut().writeUnsignedWordA(nodeId);
  4030. atInventoryLoopCycle = 0;
  4031. atInventoryInterface = interfaceId;
  4032. atInventoryIndex = slot;
  4033. atInventoryInterfaceType = 2;
  4034.  
  4035. if (RSInterface.interfaceCache[interfaceId].parentID == openInterfaceID) {
  4036. atInventoryInterfaceType = 1;
  4037. }
  4038.  
  4039. if (RSInterface.interfaceCache[interfaceId].parentID == backDialogID) {
  4040. atInventoryInterfaceType = 3;
  4041. }
  4042. }
  4043.  
  4044. if (action == 337 || action == 42 || action == 792 || action == 322) {
  4045. String s = menuActionName[actionId];
  4046. int k1 = s.indexOf("@whi@");
  4047.  
  4048. if (k1 != -1) {
  4049. long l3 = TextClass.longForName(NAME_PATTERN.matcher(s.substring(k1 + 5)).replaceAll(""));
  4050.  
  4051. if (action == 337) {
  4052. addFriend(l3);
  4053. } else if (action == 42) {
  4054. addIgnore(l3);
  4055. } else if (action == 792) {
  4056. delFriend(l3);
  4057. } else if (action == 322) {
  4058. delIgnore(l3);
  4059. }
  4060. }
  4061. }
  4062.  
  4063. if (action == 53) {
  4064. getOut().putOpcode(135);
  4065. getOut().writeUnsignedWordBigEndian(slot);
  4066. getOut().writeUnsignedWordA(interfaceId);
  4067. getOut().writeUnsignedWordBigEndian(nodeId);
  4068. atInventoryLoopCycle = 0;
  4069. atInventoryInterface = interfaceId;
  4070. atInventoryIndex = slot;
  4071. atInventoryInterfaceType = 2;
  4072.  
  4073. if (RSInterface.interfaceCache[interfaceId].parentID == openInterfaceID) {
  4074. atInventoryInterfaceType = 1;
  4075. }
  4076. if (RSInterface.interfaceCache[interfaceId].parentID == backDialogID) {
  4077. atInventoryInterfaceType = 3;
  4078. }
  4079. }
  4080.  
  4081. if (action == 539) {
  4082. getOut().putOpcode(16);
  4083. getOut().writeUnsignedWordA(nodeId);
  4084. getOut().writeSignedBigEndian(slot);
  4085. getOut().writeSignedBigEndian(interfaceId);
  4086. atInventoryLoopCycle = 0;
  4087. atInventoryInterface = interfaceId;
  4088. atInventoryIndex = slot;
  4089. atInventoryInterfaceType = 2;
  4090.  
  4091. if (RSInterface.interfaceCache[interfaceId].parentID == openInterfaceID) {
  4092. atInventoryInterfaceType = 1;
  4093. }
  4094.  
  4095. if (RSInterface.interfaceCache[interfaceId].parentID == backDialogID) {
  4096. atInventoryInterfaceType = 3;
  4097. }
  4098. }
  4099.  
  4100. if (action == 484 || action == 6) {
  4101. String s1 = menuActionName[actionId];
  4102. int l1 = s1.indexOf("@whi@");
  4103.  
  4104. if (l1 != -1) {
  4105. s1 = s1.substring(l1 + 5).trim();
  4106. String s7 = TextClass.fixName(TextClass.nameForLong(TextClass.longForName(s1)));
  4107. boolean flag9 = false;
  4108.  
  4109. for (int j3 = 0; j3 < playerCount; j3++) {
  4110. Player player = playerArray[playerIndices[j3]];
  4111.  
  4112. if (player == null || player.name == null || !player.name.equalsIgnoreCase(s7)) {
  4113. continue;
  4114. }
  4115.  
  4116. doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, player.smallY[0], myPlayer.smallX[0], false, player.smallX[0]);
  4117.  
  4118. if (action == 484) {
  4119. getOut().putOpcode(139);
  4120. getOut().writeUnsignedWordBigEndian(playerIndices[j3]);
  4121. }
  4122.  
  4123. if (action == 6) {
  4124. setAnInt1188(getAnInt1188() + nodeId);
  4125.  
  4126. if (getAnInt1188() >= 90) {
  4127. getOut().putOpcode(136);
  4128. setAnInt1188(0);
  4129. }
  4130.  
  4131. getOut().putOpcode(128);
  4132. getOut().putShort(playerIndices[j3]);
  4133. }
  4134.  
  4135. flag9 = true;
  4136. break;
  4137. }
  4138.  
  4139. if (!flag9) {
  4140. pushMessage("Unable to find " + s7, 0, "");
  4141. }
  4142. }
  4143. }
  4144.  
  4145. if (action == 870) {
  4146. getOut().putOpcode(53);
  4147. getOut().putShort(slot);
  4148. getOut().writeUnsignedWordA(anInt1283);
  4149. getOut().writeSignedBigEndian(nodeId);
  4150. getOut().putShort(anInt1284);
  4151. getOut().writeUnsignedWordBigEndian(anInt1285);
  4152. getOut().putShort(interfaceId);
  4153. atInventoryLoopCycle = 0;
  4154. atInventoryInterface = interfaceId;
  4155. atInventoryIndex = slot;
  4156. atInventoryInterfaceType = 2;
  4157.  
  4158. if (RSInterface.interfaceCache[interfaceId].parentID == openInterfaceID) {
  4159. atInventoryInterfaceType = 1;
  4160. }
  4161.  
  4162. if (RSInterface.interfaceCache[interfaceId].parentID == backDialogID) {
  4163. atInventoryInterfaceType = 3;
  4164. }
  4165. }
  4166.  
  4167. if (action == 847) {
  4168. getOut().putOpcode(87);
  4169. getOut().writeUnsignedWordA(nodeId);
  4170. getOut().putShort(interfaceId);
  4171. getOut().writeUnsignedWordA(slot);
  4172. atInventoryLoopCycle = 0;
  4173. atInventoryInterface = interfaceId;
  4174. atInventoryIndex = slot;
  4175. atInventoryInterfaceType = 2;
  4176.  
  4177. if (RSInterface.interfaceCache[interfaceId].parentID == openInterfaceID) {
  4178. atInventoryInterfaceType = 1;
  4179. }
  4180.  
  4181. if (RSInterface.interfaceCache[interfaceId].parentID == backDialogID) {
  4182. atInventoryInterfaceType = 3;
  4183. }
  4184. }
  4185.  
  4186. if (action == 626) {
  4187. RSInterface class9_1 = RSInterface.interfaceCache[interfaceId];
  4188. int childId = interfaceId;
  4189. spellSelected = 1;
  4190. spellUsableOn = Integer.parseInt(MagicInterfaceData.getSpellData(childId, "spellUsableOn"));
  4191. itemSelected = 0;
  4192. spellID = childId;
  4193. String s4 = MagicInterfaceData.getSpellData(childId, "selectedActionName");
  4194. if (s4.indexOf(" ") != -1)
  4195. s4 = s4.substring(0, s4.indexOf(" "));
  4196. String s8 = MagicInterfaceData.getSpellData(childId, "selectedActionName");
  4197. if (s8.indexOf(" ") != -1)
  4198. s8 = s8.substring(s8.indexOf(" ") + 1);
  4199. spellTooltip = s4 + " " + MagicInterfaceData.getSpellData(childId, "spellname") + " " + s8;
  4200. if (spellUsableOn == 16) {
  4201. tabID = 3;
  4202. tabAreaAltered = true;
  4203. }
  4204. selectedSpellId = spellID;
  4205. return;
  4206. }
  4207.  
  4208. if (action == 78) {
  4209. getOut().putOpcode(117);
  4210. getOut().writeSignedBigEndian(interfaceId);
  4211. getOut().writeSignedBigEndian(nodeId);
  4212. getOut().writeUnsignedWordBigEndian(slot);
  4213. atInventoryLoopCycle = 0;
  4214. atInventoryInterface = interfaceId;
  4215. atInventoryIndex = slot;
  4216. atInventoryInterfaceType = 2;
  4217.  
  4218. if (RSInterface.interfaceCache[interfaceId].parentID == openInterfaceID) {
  4219. atInventoryInterfaceType = 1;
  4220. }
  4221.  
  4222. if (RSInterface.interfaceCache[interfaceId].parentID == backDialogID) {
  4223. atInventoryInterfaceType = 3;
  4224. }
  4225. }
  4226.  
  4227. if (action == 27) {
  4228. Player class30_sub2_sub4_sub1_sub2_2 = playerArray[nodeId];
  4229.  
  4230. if (class30_sub2_sub4_sub1_sub2_2 != null) {
  4231. 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]);
  4232. crossX = super.saveClickX;
  4233. crossY = super.saveClickY;
  4234. crossType = 2;
  4235. crossIndex = 0;
  4236. setAnInt986(getAnInt986() + nodeId);
  4237.  
  4238. if (getAnInt986() >= 54) {
  4239. getOut().putOpcode(189);
  4240. getOut().putByte(234);
  4241. setAnInt986(0);
  4242. }
  4243.  
  4244. getOut().putOpcode(73);
  4245. getOut().writeUnsignedWordBigEndian(nodeId);
  4246. }
  4247. }
  4248.  
  4249. if (action == 213) {
  4250. boolean flag3 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, interfaceId, myPlayer.smallX[0], false, slot);
  4251.  
  4252. if (!flag3) {
  4253. flag3 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, interfaceId, myPlayer.smallX[0], false, slot);
  4254. }
  4255.  
  4256. crossX = super.saveClickX;
  4257. crossY = super.saveClickY;
  4258. crossType = 2;
  4259. crossIndex = 0;
  4260. getOut().putOpcode(79);
  4261. getOut().writeUnsignedWordBigEndian(interfaceId + baseY);
  4262. getOut().putShort(nodeId);
  4263. getOut().writeUnsignedWordA(slot + baseX);
  4264. }
  4265.  
  4266. if (action == 632) {
  4267. if(openInterfaceID == 53700 || openInterfaceID == 54700) {
  4268. if(interfaceId == 53781) {
  4269. interfaceId = 2901;
  4270. slot = 0;
  4271. } else if(interfaceId == 53782) {
  4272. interfaceId = 2901;
  4273. slot = 1;
  4274. } else if(interfaceId == 54781) {
  4275. interfaceId = 2902;
  4276. slot = 0;
  4277. } else if(interfaceId == 54782) {
  4278. interfaceId = 2902;
  4279. slot = 1;
  4280. }
  4281. }
  4282. getOut().putOpcode(145);
  4283. getOut().writeUnsignedWordA(interfaceId);
  4284. getOut().writeUnsignedWordA(slot);
  4285. getOut().writeUnsignedWordA(nodeId);
  4286. atInventoryLoopCycle = 0;
  4287. atInventoryInterface = interfaceId;
  4288. atInventoryIndex = slot;
  4289. atInventoryInterfaceType = 2;
  4290.  
  4291. if (RSInterface.interfaceCache[interfaceId].parentID == openInterfaceID) {
  4292. atInventoryInterfaceType = 1;
  4293. }
  4294.  
  4295. if (RSInterface.interfaceCache[interfaceId].parentID == backDialogID) {
  4296. atInventoryInterfaceType = 3;
  4297. }
  4298. }
  4299.  
  4300. if (action == 1004) {
  4301. if (tabInterfaceIDs[10] != -1) {
  4302. tabID = 10;
  4303. tabAreaAltered = true;
  4304. }
  4305. }
  4306.  
  4307. if (action == 1003) {
  4308. inputTaken = true;
  4309. }
  4310.  
  4311. if (action == 1002) {
  4312. inputTaken = true;
  4313. }
  4314.  
  4315. if (action == 1001) {
  4316. inputTaken = true;
  4317. }
  4318.  
  4319. if (action == 1000) {
  4320. chatArea.toggleButton(this, 4);
  4321. cButtonCPos = 4;
  4322. chatTypeView = 11;
  4323. inputTaken = true;
  4324. }
  4325.  
  4326. if (action == 999) {
  4327. chatArea.toggleButton(this, 0);
  4328. cButtonCPos = 0;
  4329. chatTypeView = 0;
  4330. inputTaken = true;
  4331. }
  4332.  
  4333. if (action == 998) {
  4334. chatArea.toggleButton(this, 1);
  4335. cButtonCPos = 1;
  4336. chatTypeView = 5;
  4337. inputTaken = true;
  4338. }
  4339.  
  4340. if (action == 997) {
  4341. publicChatMode = 3;
  4342. inputTaken = true;
  4343. }
  4344.  
  4345. if (action == 996) {
  4346. publicChatMode = 2;
  4347. inputTaken = true;
  4348. }
  4349.  
  4350. if (action == 995) {
  4351. publicChatMode = 1;
  4352. inputTaken = true;
  4353. }
  4354.  
  4355. if (action == 994) {
  4356. publicChatMode = 0;
  4357. inputTaken = true;
  4358. }
  4359.  
  4360. if (action == 993) {
  4361. chatArea.toggleButton(this, 2);
  4362. cButtonCPos = 2;
  4363. chatTypeView = 1;
  4364. inputTaken = true;
  4365. }
  4366.  
  4367. if (action == 992) {
  4368. privateChatMode = 2;
  4369. inputTaken = true;
  4370. privateChatMode = 2;
  4371. getOut().putOpcode(95);
  4372. getOut().putByte(publicChatMode);
  4373. getOut().putByte(privateChatMode);
  4374. getOut().putByte(tradeMode);
  4375. }
  4376.  
  4377. if (action == 991) {
  4378. privateChatMode = 1;
  4379. inputTaken = true;
  4380. getOut().putOpcode(95);
  4381. getOut().putByte(publicChatMode);
  4382. getOut().putByte(privateChatMode);
  4383. getOut().putByte(tradeMode);
  4384. }
  4385.  
  4386. if (action == 990) {
  4387. privateChatMode = 0;
  4388. inputTaken = true;
  4389. getOut().putOpcode(95);
  4390. getOut().putByte(publicChatMode);
  4391. getOut().putByte(privateChatMode);
  4392. getOut().putByte(tradeMode);
  4393. }
  4394.  
  4395. if (action == 989) {
  4396. chatArea.toggleButton(this, 3);
  4397. cButtonCPos = 3;
  4398. chatTypeView = 2;
  4399. inputTaken = true;
  4400. getOut().putOpcode(95);
  4401. getOut().putByte(publicChatMode);
  4402. getOut().putByte(privateChatMode);
  4403. getOut().putByte(tradeMode);
  4404. }
  4405.  
  4406. if (action == 987) {
  4407. tradeMode = 2;
  4408. inputTaken = true;
  4409. }
  4410.  
  4411. if (action == 986) {
  4412. tradeMode = 1;
  4413. inputTaken = true;
  4414. }
  4415.  
  4416. if (action == 985) {
  4417. tradeMode = 0;
  4418. inputTaken = true;
  4419. }
  4420.  
  4421. if (action == 984) {
  4422. chatArea.toggleButton(this, 5);
  4423. cButtonCPos = 5;
  4424. chatTypeView = 3;
  4425. inputTaken = true;
  4426. }
  4427.  
  4428. if (action == 983) {
  4429. duelStatus = 2;
  4430. }
  4431. if (action == 982) {
  4432. duelStatus = 1;
  4433. }
  4434. if (action == 981) {
  4435. duelStatus = 0;
  4436. }
  4437.  
  4438. if (action == 980) {
  4439. chatArea.toggleButton(this, 6);
  4440. cButtonCPos = 6;
  4441. chatTypeView = 14;
  4442. inputTaken = true;
  4443. }
  4444.  
  4445. if (action == 983) {
  4446. inputTaken = true;
  4447. }
  4448.  
  4449. if (action == 982) {
  4450. inputTaken = true;
  4451. }
  4452.  
  4453. if (action == 981) {
  4454. inputTaken = true;
  4455. }
  4456.  
  4457. if (action == 980) {
  4458. chatArea.toggleButton(this, 6);
  4459. cButtonCPos = 6;
  4460. chatTypeView = 4;
  4461. inputTaken = true;
  4462. }
  4463.  
  4464. if (action == 493) {
  4465. getOut().putOpcode(75);
  4466. getOut().writeSignedBigEndian(interfaceId);
  4467. getOut().writeUnsignedWordBigEndian(slot);
  4468. getOut().writeUnsignedWordA(nodeId);
  4469. atInventoryLoopCycle = 0;
  4470. atInventoryInterface = interfaceId;
  4471. atInventoryIndex = slot;
  4472. atInventoryInterfaceType = 2;
  4473.  
  4474. if (RSInterface.interfaceCache[interfaceId].parentID == openInterfaceID) {
  4475. atInventoryInterfaceType = 1;
  4476. }
  4477.  
  4478. if (RSInterface.interfaceCache[interfaceId].parentID == backDialogID) {
  4479. atInventoryInterfaceType = 3;
  4480. }
  4481. }
  4482.  
  4483. if (action == 652) {
  4484. boolean flag4 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, interfaceId, myPlayer.smallX[0], false, slot);
  4485.  
  4486. if (!flag4) {
  4487. flag4 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, interfaceId, myPlayer.smallX[0], false, slot);
  4488. }
  4489.  
  4490. crossX = super.saveClickX;
  4491. crossY = super.saveClickY;
  4492. crossType = 2;
  4493. crossIndex = 0;
  4494. getOut().putOpcode(156);
  4495. getOut().writeUnsignedWordA(slot + baseX);
  4496. getOut().writeUnsignedWordBigEndian(interfaceId + baseY);
  4497. getOut().writeSignedBigEndian(nodeId);
  4498. }
  4499.  
  4500. if (action == 94) {
  4501. boolean flag5 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, interfaceId, myPlayer.smallX[0], false, slot);
  4502.  
  4503. if (!flag5) {
  4504. flag5 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, interfaceId, myPlayer.smallX[0], false, slot);
  4505. }
  4506.  
  4507. crossX = super.saveClickX;
  4508. crossY = super.saveClickY;
  4509. crossType = 2;
  4510. crossIndex = 0;
  4511. getOut().putOpcode(181);
  4512. getOut().writeUnsignedWordBigEndian(interfaceId + baseY);
  4513. getOut().putShort(nodeId);
  4514. getOut().writeUnsignedWordBigEndian(slot + baseX);
  4515. getOut().writeUnsignedWordA(selectedSpellId);
  4516. }
  4517.  
  4518. if (action == 646) {
  4519. getOut().putOpcode(185);
  4520. getOut().putShort(interfaceId);
  4521. RSInterface class9_2 = RSInterface.interfaceCache[interfaceId];
  4522.  
  4523. if (class9_2.valueIndexArray != null && class9_2.valueIndexArray[0][0] == 5) {
  4524. int i2 = class9_2.valueIndexArray[0][1];
  4525.  
  4526. if (variousSettings[i2] != class9_2.requiredValues[0]) {
  4527. variousSettings[i2] = class9_2.requiredValues[0];
  4528. updateConfig(i2);
  4529. }
  4530.  
  4531. switch (interfaceId) {
  4532. case 25841:// More options
  4533. i2 = openInterfaceID == 26000 ? 0 : 1;
  4534. sendFrame36(175, i2);
  4535.  
  4536. if (i2 == 1) {
  4537. openInterfaceID = 26000;
  4538. } else {
  4539. openInterfaceID = -1;
  4540. }
  4541.  
  4542. break;
  4543. }
  4544. }
  4545. }
  4546.  
  4547. if (action == 225) {
  4548. NPC npc = npcArray[nodeId];
  4549.  
  4550. if (npc != null) {
  4551. doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, npc.smallY[0], myPlayer.smallX[0], false, npc.smallX[0]);
  4552. crossX = super.saveClickX;
  4553. crossY = super.saveClickY;
  4554. crossType = 2;
  4555. crossIndex = 0;
  4556. setAnInt1226(getAnInt1226() + nodeId);
  4557. getOut().putOpcode(17);
  4558. getOut().writeSignedBigEndian(nodeId);
  4559. }
  4560. }
  4561.  
  4562. if (action == 965) {
  4563. NPC npc = npcArray[nodeId];
  4564.  
  4565. if (npc != null) {
  4566. doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, npc.smallY[0], myPlayer.smallX[0], false, npc.smallX[0]);
  4567. crossX = super.saveClickX;
  4568. crossY = super.saveClickY;
  4569. crossType = 2;
  4570. crossIndex = 0;
  4571. setAnInt1134(getAnInt1134() + 1);
  4572. getOut().putOpcode(21);
  4573. getOut().putShort(nodeId);
  4574. }
  4575. }
  4576.  
  4577. if (action == 413) {
  4578. NPC npc = npcArray[nodeId];
  4579.  
  4580. if (npc != null) {
  4581. doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, npc.smallY[0], myPlayer.smallX[0], false, npc.smallX[0]);
  4582. crossX = super.saveClickX;
  4583. crossY = super.saveClickY;
  4584. crossType = 2;
  4585. crossIndex = 0;
  4586. getOut().putOpcode(131);
  4587. getOut().writeSignedBigEndian(nodeId);
  4588. getOut().writeUnsignedWordA(selectedSpellId);
  4589. }
  4590. }
  4591.  
  4592. if (action == 200) {
  4593. closeGameInterfaces();
  4594. }
  4595.  
  4596. if (action == 1025) {
  4597. NPC npc = npcArray[nodeId];
  4598. if (npc != null) {
  4599. MobDefinition entityDef = npc.definitionOverride;
  4600. if (entityDef != null) {
  4601. getOut().putOpcode(6); //examine npc
  4602. getOut().putShort(entityDef.id);
  4603. }
  4604. }
  4605. }
  4606.  
  4607. if (action == 900) {
  4608. method66(nodeId, y, x, id);
  4609. getOut().putOpcode(252);
  4610. getOut().writeSignedBigEndian(id);
  4611. getOut().writeUnsignedWordBigEndian(y + baseY);
  4612. getOut().writeUnsignedWordA(x + baseX);
  4613. }
  4614.  
  4615. if (action == 412) {
  4616. NPC npc = npcArray[nodeId];
  4617.  
  4618. if (npc != null) {
  4619. doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, npc.smallY[0], myPlayer.smallX[0], false, npc.smallX[0]);
  4620. crossX = super.saveClickX;
  4621. crossY = super.saveClickY;
  4622. crossType = 2;
  4623. crossIndex = 0;
  4624. getOut().putOpcode(72);
  4625. getOut().writeUnsignedWordA(nodeId);
  4626. }
  4627. }
  4628.  
  4629. if (action == 365) {
  4630. Player player = playerArray[nodeId];
  4631.  
  4632. if (player != null) {
  4633. doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, player.smallY[0], myPlayer.smallX[0], false, player.smallX[0]);
  4634. crossX = super.saveClickX;
  4635. crossY = super.saveClickY;
  4636. crossType = 2;
  4637. crossIndex = 0;
  4638. getOut().putOpcode(249);
  4639. getOut().writeUnsignedWordA(nodeId);
  4640. getOut().writeUnsignedWordBigEndian(selectedSpellId);
  4641. }
  4642. }
  4643.  
  4644. if (action == 729) {
  4645. Player player = playerArray[nodeId];
  4646.  
  4647. if (player != null) {
  4648. doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, player.smallY[0], myPlayer.smallX[0], false, player.smallX[0]);
  4649. crossX = super.saveClickX;
  4650. crossY = super.saveClickY;
  4651. crossType = 2;
  4652. crossIndex = 0;
  4653. getOut().putOpcode(39);
  4654. getOut().writeUnsignedWordBigEndian(nodeId);
  4655. }
  4656. }
  4657.  
  4658. if (action == 577) {
  4659. Player player = playerArray[nodeId];
  4660.  
  4661. if (player != null) {
  4662. doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, player.smallY[0], myPlayer.smallX[0], false, player.smallX[0]);
  4663. crossX = super.saveClickX;
  4664. crossY = super.saveClickY;
  4665. crossType = 2;
  4666. crossIndex = 0;
  4667. getOut().putOpcode(139);
  4668. getOut().writeUnsignedWordBigEndian(nodeId);
  4669. }
  4670. }
  4671.  
  4672. if (action == 956 && method66(nodeId, y, x, id)) {
  4673. getOut().putOpcode(35);
  4674. getOut().writeUnsignedWordBigEndian(slot + baseX);
  4675. getOut().writeUnsignedWordA(selectedSpellId);
  4676. getOut().writeUnsignedWordA(interfaceId + baseY);
  4677. getOut().writeUnsignedWordBigEndian(id);
  4678. }
  4679.  
  4680. if (action == 567) {
  4681. boolean flag6 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, interfaceId, myPlayer.smallX[0], false, slot);
  4682.  
  4683. if (!flag6) {
  4684. flag6 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, interfaceId, myPlayer.smallX[0], false, slot);
  4685. }
  4686.  
  4687. crossX = super.saveClickX;
  4688. crossY = super.saveClickY;
  4689. crossType = 2;
  4690. crossIndex = 0;
  4691. getOut().putOpcode(23);
  4692. getOut().writeUnsignedWordBigEndian(interfaceId + baseY);
  4693. getOut().writeUnsignedWordBigEndian(nodeId);
  4694. getOut().writeUnsignedWordBigEndian(slot + baseX);
  4695. }
  4696.  
  4697. if (action == 867) {
  4698. if ((id & 3) == 0) {
  4699. setAnInt1175(getAnInt1175() + 1);
  4700. }
  4701.  
  4702. if (getAnInt1175() >= 59) {
  4703. getOut().putOpcode(200);
  4704. getOut().putShort(25501);
  4705. setAnInt1175(0);
  4706. }
  4707.  
  4708. getOut().putOpcode(43);
  4709. getOut().writeUnsignedWordBigEndian(interfaceId);
  4710. getOut().writeUnsignedWordA(nodeId);
  4711. getOut().writeUnsignedWordA(slot);
  4712. atInventoryLoopCycle = 0;
  4713. atInventoryInterface = interfaceId;
  4714. atInventoryIndex = slot;
  4715. atInventoryInterfaceType = 2;
  4716.  
  4717. if (RSInterface.interfaceCache[interfaceId].parentID == openInterfaceID) {
  4718. atInventoryInterfaceType = 1;
  4719. }
  4720.  
  4721. if (RSInterface.interfaceCache[interfaceId].parentID == backDialogID) {
  4722. atInventoryInterfaceType = 3;
  4723. }
  4724. }
  4725.  
  4726. if (action == 543) {
  4727. getOut().putOpcode(237);
  4728. getOut().putShort(slot);
  4729. getOut().writeUnsignedWordA(nodeId);
  4730. getOut().putShort(interfaceId);
  4731. getOut().writeUnsignedWordA(selectedSpellId);
  4732. atInventoryLoopCycle = 0;
  4733. atInventoryInterface = interfaceId;
  4734. atInventoryIndex = slot;
  4735. atInventoryInterfaceType = 2;
  4736.  
  4737. if (RSInterface.interfaceCache[interfaceId].parentID == openInterfaceID) {
  4738. atInventoryInterfaceType = 1;
  4739. }
  4740.  
  4741. if (RSInterface.interfaceCache[interfaceId].parentID == backDialogID) {
  4742. atInventoryInterfaceType = 3;
  4743. }
  4744. }
  4745.  
  4746. if (action == 491) {
  4747. Player player = playerArray[nodeId];
  4748.  
  4749. if (player != null) {
  4750. doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, player.smallY[0], myPlayer.smallX[0], false, player.smallX[0]);
  4751. crossX = super.saveClickX;
  4752. crossY = super.saveClickY;
  4753. crossType = 2;
  4754. crossIndex = 0;
  4755. getOut().putOpcode(14);
  4756. getOut().writeUnsignedWordA(anInt1284);
  4757. getOut().putShort(nodeId);
  4758. getOut().putShort(anInt1285);
  4759. getOut().writeUnsignedWordBigEndian(anInt1283);
  4760. }
  4761. }
  4762.  
  4763. if (action == 639) {
  4764. String s3 = menuActionName[actionId];
  4765. int k2 = s3.indexOf("@whi@");
  4766.  
  4767. if (k2 != -1) {
  4768. long l4 = TextClass.longForName(s3.substring(k2 + 5).trim());
  4769. int k3 = -1;
  4770.  
  4771. for (int i4 = 0; i4 < friendCount; i4++) {
  4772. if (friendsListAsLongs[i4] != l4) {
  4773. continue;
  4774. }
  4775. k3 = i4;
  4776. break;
  4777. }
  4778.  
  4779. if (k3 != -1 && friendsNodeIDs[k3] > 0) {
  4780. inputTaken = true;
  4781. inputDialogState = 0;
  4782. messagePromptRaised = true;
  4783. promptInput = "";
  4784. friendsListAction = 3;
  4785. aLong953 = friendsListAsLongs[k3];
  4786. promptMessage = "Enter message to send to " + friendsList[k3];
  4787. }
  4788. }
  4789. }
  4790.  
  4791. if (action == 454) {
  4792. getOut().putOpcode(41);
  4793. getOut().putShort(nodeId);
  4794. getOut().writeUnsignedWordA(slot);
  4795. getOut().writeUnsignedWordA(interfaceId);
  4796. atInventoryLoopCycle = 0;
  4797. atInventoryInterface = interfaceId;
  4798. atInventoryIndex = slot;
  4799. atInventoryInterfaceType = 2;
  4800.  
  4801. if (RSInterface.interfaceCache[interfaceId].parentID == openInterfaceID) {
  4802. atInventoryInterfaceType = 1;
  4803. }
  4804.  
  4805. if (RSInterface.interfaceCache[interfaceId].parentID == backDialogID) {
  4806. atInventoryInterfaceType = 3;
  4807. }
  4808. }
  4809.  
  4810. if (action == 478) {
  4811. NPC npc = npcArray[nodeId];
  4812.  
  4813. if (npc != null) {
  4814. doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, npc.smallY[0], myPlayer.smallX[0], false, npc.smallX[0]);
  4815. crossX = super.saveClickX;
  4816. crossY = super.saveClickY;
  4817. crossType = 2;
  4818. crossIndex = 0;
  4819.  
  4820. if ((id & 3) == 0) {
  4821. setAnInt1155(getAnInt1155() + 1);
  4822. }
  4823.  
  4824. if (getAnInt1155() >= 53) {
  4825. getOut().putOpcode(85);
  4826. getOut().putByte(66);
  4827. setAnInt1155(0);
  4828. }
  4829.  
  4830. getOut().putOpcode(18);
  4831. getOut().writeUnsignedWordBigEndian(nodeId);
  4832. }
  4833. }
  4834.  
  4835. if (action == 113) {
  4836. method66(nodeId, y, x, id);
  4837. getOut().putOpcode(70);
  4838. getOut().writeUnsignedWordBigEndian(slot + baseX);
  4839. getOut().putShort(interfaceId + baseY);
  4840. getOut().writeSignedBigEndian(id);
  4841. }
  4842.  
  4843. if (action == 872) {
  4844. method66(nodeId, y, x, id);
  4845. getOut().putOpcode(234);
  4846. getOut().writeSignedBigEndian(x + baseX);
  4847. getOut().writeUnsignedWordA(id);
  4848. getOut().writeSignedBigEndian(y + baseY);
  4849. }
  4850.  
  4851. if (action == 502) {
  4852. method66(nodeId, y, x, id);
  4853. getOut().putOpcode(132);
  4854. getOut().writeSignedBigEndian(x + baseX);
  4855. getOut().putShort(id);
  4856. getOut().writeUnsignedWordA(y + baseY);
  4857. }
  4858.  
  4859. if (action == 1125) {
  4860. ItemDefinition definition = ItemDefinition.get(nodeId);
  4861. if (interfaceId == 38274) {
  4862. getOut().putOpcode(122);
  4863. getOut().putShort(interfaceId);
  4864. getOut().putShort(slot);
  4865. getOut().putShort(nodeId);
  4866. } else {
  4867. getOut().putOpcode(2); //examine item
  4868. getOut().putShort(definition.id);
  4869. }
  4870. }
  4871. if (action == 1126) {
  4872. getOut().putOpcode(138);
  4873. getOut().writeUnsignedWordA(interfaceId);
  4874. getOut().writeUnsignedWordA(slot);
  4875. getOut().writeUnsignedWordA(nodeId);
  4876.  
  4877. atInventoryLoopCycle = 0;
  4878. atInventoryInterface = interfaceId;
  4879. atInventoryIndex = slot;
  4880. atInventoryInterfaceType = 2;
  4881. if (RSInterface.interfaceCache[interfaceId].parentID == openInterfaceID)
  4882. atInventoryInterfaceType = 1;
  4883. if (RSInterface.interfaceCache[interfaceId].parentID == backDialogID)
  4884. atInventoryInterfaceType = 3;
  4885. }
  4886. if (action == 169) {
  4887. switch (interfaceId) {
  4888. case 26026:
  4889. Configuration.DISPLAY_HP_ABOVE_HEAD = !Configuration.DISPLAY_HP_ABOVE_HEAD;
  4890. pushMessage("Displaying hp above head turned " + (Configuration.DISPLAY_HP_ABOVE_HEAD ? "on" : "off") + ".", 0, "");
  4891. savePlayerData();
  4892. updateSetting(interfaceId, !Configuration.DISPLAY_HP_ABOVE_HEAD);
  4893. break;
  4894. case 26027:
  4895. Configuration.DISPLAY_USERNAMES_ABOVE_HEAD = !Configuration.DISPLAY_USERNAMES_ABOVE_HEAD;
  4896. pushMessage("Displaying usernames above head turned " + (Configuration.DISPLAY_USERNAMES_ABOVE_HEAD ? "on" : "off") + ".", 0, "");
  4897. savePlayerData();
  4898. updateSetting(interfaceId, !Configuration.DISPLAY_USERNAMES_ABOVE_HEAD);
  4899. break;
  4900. case 26031:
  4901. GameFrameConstants.gameframeType = GameFrameConstants.gameframeType == GameFrameType.FRAME_525 ? GameFrameType.FRAME_554 : GameFrameType.FRAME_525;
  4902. pushMessage("Gameframe toggled.", 0, "");
  4903. savePlayerData();
  4904. updateSetting(interfaceId, GameFrameConstants.gameframeType == GameFrameType.FRAME_525);
  4905. break;
  4906. case 26014:
  4907. Configuration.NEW_HITMARKS = !Configuration.NEW_HITMARKS;
  4908. pushMessage("New hitmarks turned " + (Configuration.NEW_HITMARKS ? "on" : "off") + ".", 0, "");
  4909. savePlayerData();
  4910. updateSetting(interfaceId, !Configuration.NEW_HITMARKS);
  4911. break;
  4912. case 26007:
  4913. Configuration.NEW_FUNCTION_KEYS = !Configuration.NEW_FUNCTION_KEYS;
  4914. pushMessage("New function keys turned " + (Configuration.NEW_FUNCTION_KEYS ? "on" : "off") + ".", 0, "");
  4915. savePlayerData();
  4916. updateSetting(interfaceId, !Configuration.NEW_FUNCTION_KEYS);
  4917. break;
  4918. case 26010:
  4919. Configuration.NEW_CURSORS = !Configuration.NEW_CURSORS;
  4920. pushMessage("New cursors turned " + (Configuration.NEW_CURSORS ? "on" : "off") + ".", 0, "");
  4921. savePlayerData();
  4922. updateSetting(interfaceId, !Configuration.NEW_CURSORS);
  4923. oldCursor = null;
  4924. if(!Configuration.NEW_CURSORS) {
  4925. getGameComponent().setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
  4926. } else {
  4927. super.setCursor(CursorData.CURSOR_0);
  4928. }
  4929. break;
  4930. case 26008:
  4931. Configuration.NEW_HEALTH_BARS = !Configuration.NEW_HEALTH_BARS;
  4932. pushMessage("New health bars turned " + (Configuration.NEW_HEALTH_BARS ? "on" : "off") + ".", 0, "");
  4933. savePlayerData();
  4934. updateSetting(interfaceId, !Configuration.NEW_HEALTH_BARS);
  4935. break;
  4936. case 26029:
  4937. Configuration.CONSTITUTION_ENABLED = !Configuration.CONSTITUTION_ENABLED;
  4938. pushMessage("Constitution turned " + (Configuration.CONSTITUTION_ENABLED ? "on" : "off") + ".", 0, "");
  4939. savePlayerData();
  4940. updateSetting(interfaceId, !Configuration.CONSTITUTION_ENABLED);
  4941. break;
  4942. case 26033:
  4943. Configuration.NOTIFICATIONS_ENABLED = !Configuration.NOTIFICATIONS_ENABLED;
  4944. pushMessage("Push notifications turned " + (Configuration.NOTIFICATIONS_ENABLED ? "on" : "off") + ".", 0, "");
  4945. savePlayerData();
  4946. updateSetting(interfaceId, !Configuration.NOTIFICATIONS_ENABLED);
  4947. break;
  4948. case 26054:
  4949. setLowDetail();
  4950. loadRegion();
  4951. pushMessage("Set to low detail.", 0, "");
  4952. savePlayerData();
  4953. updateSetting(interfaceId, false);
  4954. updateSetting(26058, false);
  4955. break;
  4956. case 26058:
  4957. setHighDetail();
  4958. loadRegion();
  4959. pushMessage("Set to high detail.", 0, "");
  4960. savePlayerData();
  4961. updateSetting(interfaceId, false);
  4962. updateSetting(26054, false);
  4963. break;
  4964.  
  4965. default:
  4966. getOut().putOpcode(185);
  4967. getOut().putShort(interfaceId);
  4968. if(interfaceId == 26003) {
  4969. return;
  4970. }
  4971. }
  4972.  
  4973. RSInterface rsinterface = RSInterface.interfaceCache[interfaceId];
  4974.  
  4975. if (rsinterface.valueIndexArray != null && rsinterface.valueIndexArray[0][0] == 5) {
  4976. int l2 = rsinterface.valueIndexArray[0][1];
  4977. variousSettings[l2] = 1 - variousSettings[l2];
  4978. updateConfig(l2);
  4979. }
  4980. }
  4981.  
  4982. if (action == 447) {
  4983. itemSelected = 1;
  4984. anInt1283 = slot;
  4985. anInt1284 = interfaceId;
  4986. anInt1285 = nodeId;
  4987. selectedItemName = ItemDefinition.get(nodeId).name;
  4988. spellSelected = 0;
  4989. return;
  4990. }
  4991.  
  4992. if (action == 1226) {
  4993. ObjectDefinition definition = ObjectDefinition.forID(id);
  4994. String examine;
  4995.  
  4996. if (definition.description != null) {
  4997. examine = new String(definition.description);
  4998. } else {
  4999. examine = "It's a " + definition.name + ".";
  5000. }
  5001.  
  5002. pushMessage(examine, 0, "");
  5003. }
  5004.  
  5005. if (action == 244) {
  5006. boolean flag7 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, interfaceId, myPlayer.smallX[0], false, slot);
  5007.  
  5008. if (!flag7) {
  5009. flag7 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, interfaceId, myPlayer.smallX[0], false, slot);
  5010. }
  5011.  
  5012. crossX = super.saveClickX;
  5013. crossY = super.saveClickY;
  5014. crossType = 2;
  5015. crossIndex = 0;
  5016. getOut().putOpcode(253);
  5017. getOut().writeUnsignedWordBigEndian(slot + baseX);
  5018. getOut().writeSignedBigEndian(interfaceId + baseY);
  5019. getOut().writeUnsignedWordA(nodeId);
  5020. }
  5021.  
  5022. if (action == 1448) {
  5023. ItemDefinition definition = ItemDefinition.get(nodeId);
  5024. String examine;
  5025.  
  5026. if (definition.description != null) {
  5027. examine = new String(definition.description);
  5028. } else {
  5029. examine = "It's a " + definition.name + ".";
  5030. }
  5031.  
  5032. pushMessage(examine, 0, "");
  5033. }
  5034.  
  5035. itemSelected = 0; // RIGHT HERE
  5036.  
  5037. if (action != 626) {
  5038. spellSelected = 0;
  5039. }
  5040. if(interfaceId == 957) {
  5041. variousSettings[287] = variousSettings[502] = variousSettings[502] == 1 ? 0 : 1;
  5042. updateConfig(287);
  5043. savePlayerData();
  5044. }
  5045. }
  5046.  
  5047. private void doFlamesDrawing() {
  5048. }
  5049.  
  5050. public void sendPacket185(int button, int toggle, int type) {
  5051. switch (type) {
  5052. case 135:
  5053. RSInterface class9 = RSInterface.interfaceCache[button];
  5054. boolean flag8 = true;
  5055. if (class9.contentType > 0)
  5056. flag8 = promptUserForInput(class9);
  5057. if (flag8) {
  5058. getOut().putOpcode(185);
  5059. getOut().putShort(button);
  5060. }
  5061. break;
  5062. }
  5063. }
  5064.  
  5065. private boolean doWalkTo(int type, int j, int k, int i1, int j1, int k1, int l1, int i2, int j2, boolean flag, int k2) {
  5066. byte byte0 = 104;
  5067. byte byte1 = 104;
  5068.  
  5069. for (int l2 = 0; l2 < byte0; l2++) {
  5070. for (int i3 = 0; i3 < byte1; i3++) {
  5071. anIntArrayArray901[l2][i3] = 0;
  5072. anIntArrayArray825[l2][i3] = 0x5f5e0ff;
  5073. }
  5074. }
  5075.  
  5076. int j3 = j2;
  5077. int k3 = j1;
  5078. anIntArrayArray901[j2][j1] = 99;
  5079. anIntArrayArray825[j2][j1] = 0;
  5080. int l3 = 0;
  5081. int i4 = 0;
  5082. bigX[l3] = j2;
  5083. bigY[l3++] = j1;
  5084. boolean flag1 = false;
  5085. int j4 = bigX.length;
  5086. int[][] ai = clippingPlanes[plane].clipData;
  5087.  
  5088. while (i4 != l3) {
  5089. j3 = bigX[i4];
  5090. k3 = bigY[i4];
  5091. i4 = (i4 + 1) % j4;
  5092.  
  5093. if (j3 == k2 && k3 == i2) {
  5094. flag1 = true;
  5095. break;
  5096. }
  5097.  
  5098. if (i1 != 0) {
  5099. if ((i1 < 5 || i1 == 10) && clippingPlanes[plane].method219(k2, j3, k3, j, i1 - 1, i2)) {
  5100. flag1 = true;
  5101. break;
  5102. }
  5103.  
  5104. if (i1 < 10 && clippingPlanes[plane].method220(k2, i2, k3, i1 - 1, j, j3)) {
  5105. flag1 = true;
  5106. break;
  5107. }
  5108. }
  5109.  
  5110. if (k1 != 0 && k != 0 && clippingPlanes[plane].method221(i2, k2, j3, k, l1, k1, k3)) {
  5111. flag1 = true;
  5112. break;
  5113. }
  5114.  
  5115. int l4 = anIntArrayArray825[j3][k3] + 1;
  5116.  
  5117. if (j3 > 0 && anIntArrayArray901[j3 - 1][k3] == 0 && (ai[j3 - 1][k3] & 0x1280108) == 0) {
  5118. bigX[l3] = j3 - 1;
  5119. bigY[l3] = k3;
  5120. l3 = (l3 + 1) % j4;
  5121. anIntArrayArray901[j3 - 1][k3] = 2;
  5122. anIntArrayArray825[j3 - 1][k3] = l4;
  5123. }
  5124.  
  5125. if (j3 < byte0 - 1 && anIntArrayArray901[j3 + 1][k3] == 0 && (ai[j3 + 1][k3] & 0x1280180) == 0) {
  5126. bigX[l3] = j3 + 1;
  5127. bigY[l3] = k3;
  5128. l3 = (l3 + 1) % j4;
  5129. anIntArrayArray901[j3 + 1][k3] = 8;
  5130. anIntArrayArray825[j3 + 1][k3] = l4;
  5131. }
  5132.  
  5133. if (k3 > 0 && anIntArrayArray901[j3][k3 - 1] == 0 && (ai[j3][k3 - 1] & 0x1280102) == 0) {
  5134. bigX[l3] = j3;
  5135. bigY[l3] = k3 - 1;
  5136. l3 = (l3 + 1) % j4;
  5137. anIntArrayArray901[j3][k3 - 1] = 1;
  5138. anIntArrayArray825[j3][k3 - 1] = l4;
  5139. }
  5140.  
  5141. if (k3 < byte1 - 1 && anIntArrayArray901[j3][k3 + 1] == 0 && (ai[j3][k3 + 1] & 0x1280120) == 0) {
  5142. bigX[l3] = j3;
  5143. bigY[l3] = k3 + 1;
  5144. l3 = (l3 + 1) % j4;
  5145. anIntArrayArray901[j3][k3 + 1] = 4;
  5146. anIntArrayArray825[j3][k3 + 1] = l4;
  5147. }
  5148.  
  5149. 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) {
  5150. bigX[l3] = j3 - 1;
  5151. bigY[l3] = k3 - 1;
  5152. l3 = (l3 + 1) % j4;
  5153. anIntArrayArray901[j3 - 1][k3 - 1] = 3;
  5154. anIntArrayArray825[j3 - 1][k3 - 1] = l4;
  5155. }
  5156.  
  5157. 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) {
  5158. bigX[l3] = j3 + 1;
  5159. bigY[l3] = k3 - 1;
  5160. l3 = (l3 + 1) % j4;
  5161. anIntArrayArray901[j3 + 1][k3 - 1] = 9;
  5162. anIntArrayArray825[j3 + 1][k3 - 1] = l4;
  5163. }
  5164.  
  5165. 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) {
  5166. bigX[l3] = j3 - 1;
  5167. bigY[l3] = k3 + 1;
  5168. l3 = (l3 + 1) % j4;
  5169. anIntArrayArray901[j3 - 1][k3 + 1] = 6;
  5170. anIntArrayArray825[j3 - 1][k3 + 1] = l4;
  5171. }
  5172.  
  5173. 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) {
  5174. bigX[l3] = j3 + 1;
  5175. bigY[l3] = k3 + 1;
  5176. l3 = (l3 + 1) % j4;
  5177. anIntArrayArray901[j3 + 1][k3 + 1] = 12;
  5178. anIntArrayArray825[j3 + 1][k3 + 1] = l4;
  5179. }
  5180. }
  5181.  
  5182. anInt1264 = 0;
  5183.  
  5184. if (!flag1) {
  5185. if (flag) {
  5186. int i5 = 100;
  5187.  
  5188. for (int k5 = 1; k5 < 2; k5++) {
  5189. for (int i6 = k2 - k5; i6 <= k2 + k5; i6++) {
  5190. for (int l6 = i2 - k5; l6 <= i2 + k5; l6++) {
  5191. if (i6 >= 0 && l6 >= 0 && i6 < 104 && l6 < 104 && anIntArrayArray825[i6][l6] < i5) {
  5192. i5 = anIntArrayArray825[i6][l6];
  5193. j3 = i6;
  5194. k3 = l6;
  5195. anInt1264 = 1;
  5196. flag1 = true;
  5197. }
  5198. }
  5199. }
  5200.  
  5201. if (flag1) {
  5202. break;
  5203. }
  5204. }
  5205.  
  5206. }
  5207.  
  5208. if (!flag1) {
  5209. return false;
  5210. }
  5211. }
  5212.  
  5213. i4 = 0;
  5214. bigX[i4] = j3;
  5215. bigY[i4++] = k3;
  5216. int l5;
  5217.  
  5218. for (int j5 = l5 = anIntArrayArray901[j3][k3]; j3 != j2 || k3 != j1; j5 = anIntArrayArray901[j3][k3]) {
  5219. if (j5 != l5) {
  5220. l5 = j5;
  5221. bigX[i4] = j3;
  5222. bigY[i4++] = k3;
  5223. }
  5224.  
  5225. if ((j5 & 2) != 0) {
  5226. j3++;
  5227. } else if ((j5 & 8) != 0) {
  5228. j3--;
  5229. }
  5230.  
  5231. if ((j5 & 1) != 0) {
  5232. k3++;
  5233. } else if ((j5 & 4) != 0) {
  5234. k3--;
  5235. }
  5236. }
  5237.  
  5238. if (i4 > 0) {
  5239. int k4 = i4;
  5240.  
  5241. if (k4 > 25) {
  5242. k4 = 25;
  5243. }
  5244.  
  5245. i4--;
  5246. int k6 = bigX[i4];
  5247. int i7 = bigY[i4];
  5248. setAnInt1288(getAnInt1288() + k4);
  5249.  
  5250. if (getAnInt1288() >= 92) {
  5251. getOut().putOpcode(36);
  5252. getOut().putInt(0);
  5253. setAnInt1288(0);
  5254. }
  5255.  
  5256. if (type == 0) {
  5257. getOut().putOpcode(229);
  5258. getOut().putByte(plane);
  5259. getOut().putOpcode(164);
  5260. getOut().putByte(k4 + k4 + 3);
  5261. }
  5262.  
  5263. if (type == 1) {
  5264. getOut().putOpcode(229);
  5265. getOut().putByte(plane);
  5266. getOut().putOpcode(248);
  5267. getOut().putByte(k4 + k4 + 3 + 14);
  5268. }
  5269.  
  5270. if (type == 2) {
  5271. getOut().putOpcode(229);
  5272. getOut().putByte(plane);
  5273. getOut().putOpcode(98);
  5274. getOut().putByte(k4 + k4 + 3);
  5275. }
  5276.  
  5277. getOut().writeSignedBigEndian(k6 + baseX);
  5278. destX = bigX[0];
  5279. destY = bigY[0];
  5280.  
  5281. for (int j7 = 1; j7 < k4; j7++) {
  5282. i4--;
  5283. getOut().putByte(bigX[i4] - k6);
  5284. getOut().putByte(bigY[i4] - i7);
  5285. }
  5286.  
  5287. getOut().writeUnsignedWordBigEndian(i7 + baseY);
  5288. getOut().method424(super.keyArray[5] != 1 ? 0 : 1);
  5289. return true;
  5290. }
  5291.  
  5292. return type != 1;
  5293. }
  5294.  
  5295. private void draw3dScreen() {
  5296. if (!chatArea.componentHidden()) {
  5297. drawSplitPrivateChat();
  5298. }
  5299.  
  5300. if (crossType == 1) {
  5301. crosses[crossIndex / 100].drawSprite(crossX - 8 - 4, crossY - 8 - 4);
  5302. anInt1142++;
  5303.  
  5304. if (anInt1142 > 67) {
  5305. anInt1142 = 0;
  5306. }
  5307. }
  5308.  
  5309. if (crossType == 2) {
  5310. crosses[4 + crossIndex / 100].drawSprite(crossX - 8 - 4, crossY - 8 - 4);
  5311. }
  5312.  
  5313. if (getWalkableInterfaceId() > 0) {
  5314. processInterfaceAnimation(anInt945, getWalkableInterfaceId());
  5315. if (getWalkableInterfaceId() == 15892 && GameFrame.getScreenMode() != ScreenMode.FIXED) {
  5316. drawInterface(0, getScreenWidth() / 2 - RSInterface.interfaceCache[getWalkableInterfaceId()].width + 20, RSInterface.interfaceCache[getWalkableInterfaceId()], 0);
  5317. } else if ((getWalkableInterfaceId() == 201 || getWalkableInterfaceId() == 197) && GameFrame.getScreenMode() != ScreenMode.FIXED) {
  5318. drawInterface(0, getScreenWidth() - 765 + 15, RSInterface.interfaceCache[getWalkableInterfaceId()], 0 - 255 + 10 + 4);
  5319. } else {
  5320. drawInterface(0, 0, RSInterface.interfaceCache[getWalkableInterfaceId()], 0);
  5321. }
  5322. if (getWalkableInterfaceId() == 197) {
  5323. drawInterface(0, getScreenWidth() - 765 - (GameFrame.getScreenMode() != ScreenMode.FIXED ? 30 : 0), RSInterface.interfaceCache[42020], 10);
  5324. }
  5325. }
  5326.  
  5327. if (openInterfaceID != -1) {
  5328. processInterfaceAnimation(anInt945, openInterfaceID);
  5329. RSInterface rsInterface = RSInterface.interfaceCache[openInterfaceID];
  5330. int width = GameFrame.getScreenMode() != ScreenMode.FIXED ? getScreenWidth() : 516;
  5331. int height = GameFrame.getScreenMode() != ScreenMode.FIXED ? getScreenHeight() : 338;
  5332.  
  5333. if (GameFrame.getScreenMode() != ScreenMode.FIXED) {
  5334. drawInterface(0, (width - 765) / 2, rsInterface, (height - 503) / 2);
  5335. } else {
  5336. drawInterface(0, 0, rsInterface, 0);// first 1
  5337. }
  5338.  
  5339. if(openInterfaceID == 5292) {
  5340. drawOnBankInterface();
  5341. if(bankItemDragSprite != null) {
  5342. bankItemDragSprite.drawSprite(bankItemDragSpriteX, bankItemDragSpriteY);
  5343. }
  5344. }
  5345. getGrandExchange().drawGrandExchange();
  5346. }
  5347.  
  5348. method70();
  5349.  
  5350. if (!menuOpen) {
  5351. processRightClick();
  5352. drawTooltip();
  5353. } else if (menuScreenArea == 0) {
  5354. drawMenu();
  5355. }
  5356.  
  5357. if (drawMultiwayIcon == 1) {
  5358. multiOverlay.drawSprite(GameFrame.getScreenMode() == ScreenMode.FIXED ? 472 : 516 + getScreenWidth() - 765 + 52 + 157, GameFrame.getScreenMode() == ScreenMode.FIXED ? 296 : 175);
  5359. }
  5360.  
  5361. if(Objects.nonNull(currentTarget)) {
  5362. showCombatBox();
  5363. }
  5364.  
  5365. int x = baseX + (myPlayer.x - 6 >> 7);
  5366. int y = baseY + (myPlayer.y - 6 >> 7);
  5367. /* if (isDebugMode()) {
  5368. int minus = 45;
  5369. normalText.method385(0xffff00, "Fps: " + super.fps, 285 - minus, 5);
  5370. Runtime runtime = Runtime.getRuntime();
  5371. int textColor = 0xFFFF00;
  5372. int memory = (int) ((runtime.totalMemory() - runtime.freeMemory()) / 1024L);
  5373. if (memory > 0x2000000 && lowDetail) {
  5374. textColor = 0xff0000;
  5375. }
  5376.  
  5377. normalText.method385(textColor, "Mem: " + memory + "k", 299 - minus, 5);
  5378. normalText.method385(0xffff00, "Mouse X: " + super.mouseX + " , Mouse Y: " + super.mouseY, 314 - minus, 5);
  5379. normalText.method385(0xffff00, "Coords: " + x + ", " + y, 329 - minus, 5);
  5380. normalText.method385(0xffff00, "Client resolution: " + getScreenWidth() + "x" + getScreenHeight(), 344 - minus, 5);
  5381. normalText.method385(0xffff00, "Object Maps: " + objectMaps + ";", 359 - minus, 5);
  5382. normalText.method385(0xffff00, "Floor Maps: " + floorMaps + ";", 374 - minus, 5);
  5383. }*/
  5384. if (fpsOn) {
  5385. int textX = mapArea.getxPos() - 90;
  5386. int textY = 20;
  5387. int textColor = 0xffff00;
  5388. if (super.fps < 15) {
  5389. textColor = 0xff0000;
  5390. }
  5391. normalText.method385(textColor, "Fps:" + super.fps, textY, textX);
  5392. textY += 15;
  5393. Runtime runtime = Runtime.getRuntime();
  5394. int memory = (int) ((runtime.totalMemory() - runtime.freeMemory()) / 1024L);
  5395. if (memory > 0x2000000 && lowDetail) {
  5396. textColor = 0xff0000;
  5397. }
  5398. normalText.method385(textColor, "Mem:" + memory + "k", textY, textX);
  5399. textY += 15;
  5400. normalText.method385(textColor, "MouseX:" + super.mouseX + "", textY, textX);
  5401. textY += 15;
  5402. normalText.method385(textColor, "MouseY:" + super.mouseY + "", textY, textX);
  5403. textY += 15;
  5404. normalText.method385(0xffff00, "Object Maps: " + objectMaps + ";", textY, 5);
  5405. textY += 15;
  5406. normalText.method385(0xffff00, "Floor Maps: " + floorMaps + ";", textY, 5);
  5407. }
  5408.  
  5409. if (systemUpdateTimer != 0) {
  5410. int j = systemUpdateTimer / 50;
  5411. int l = j / 60;
  5412. j %= 60;
  5413.  
  5414. if (j < 10) {
  5415. normalText.method385(0xffff00, "System update in: " + l + ":0" + j, GameFrame.isFixed() ? 329 : getScreenHeight() - 168, 4);
  5416. } else {
  5417. normalText.method385(0xffff00, "System update in: " + l + ":" + j, GameFrame.isFixed() ? 329 : getScreenHeight() - 168, 4);
  5418. }
  5419.  
  5420. if (++anInt849 > 75) {
  5421. anInt849 = 0;
  5422. getOut().putOpcode(148);
  5423. }
  5424. }
  5425. }
  5426.  
  5427. private void drawAnimatedWorldBackground(boolean display) {
  5428. if (display) {
  5429. int centerX = getScreenWidth() / 2;
  5430. int centerY = getScreenHeight() / 2;
  5431.  
  5432. if (getScriptManager() == null) {
  5433. loginScreenBG(true);
  5434. }
  5435.  
  5436. int canvasCenterX = Rasterizer.centerX;
  5437. int canvasCenterY = Rasterizer.centerY;
  5438. int canvasPixels[] = Rasterizer.lineOffsets;
  5439.  
  5440. if (titleScreenOffsets != null && (titleWidth != getScreenWidth() || titleHeight != getScreenHeight())) {
  5441. titleScreenOffsets = null;
  5442. }
  5443.  
  5444. if (titleScreenOffsets == null) {
  5445. titleWidth = getScreenWidth();
  5446. titleHeight = getScreenHeight();
  5447. titleScreenOffsets = Rasterizer.getOffsets(titleWidth, titleHeight);
  5448. }
  5449.  
  5450. Rasterizer.centerX = centerX;
  5451. Rasterizer.centerY = centerY;
  5452. Rasterizer.lineOffsets = titleScreenOffsets;
  5453.  
  5454. if (loadingStage == 2 && ObjectManager.anInt131 != plane) {
  5455. loadingStage = 1;
  5456. }
  5457.  
  5458. if (!loggedIn && loadingStage == 1) {
  5459. getMapLoadingState();
  5460. }
  5461.  
  5462. if (!loggedIn && loadingStage == 2 && plane != getLastKnownPlane()) {
  5463. setLastKnownPlane(plane);
  5464. renderedMapScene(plane);
  5465. }
  5466.  
  5467. if (loadingStage == 2) {
  5468. try {
  5469. worldController.method313(xCameraPos, yCameraPos, xCameraCurve, zCameraPos, method121(), yCameraCurve, Configuration.FOG_ENABLED);
  5470. worldController.clearObj5Cache();
  5471. } catch (Exception ex) {
  5472. ex.printStackTrace();
  5473. }
  5474. }
  5475.  
  5476. if (getScriptManager() != null && loadingStage == 2 && plane == getLastKnownPlane() && !loggedIn) {
  5477. getScriptManager().cycle();
  5478. }
  5479.  
  5480. Rasterizer.centerX = canvasCenterX;
  5481. Rasterizer.centerY = canvasCenterY;
  5482. Rasterizer.lineOffsets = canvasPixels;
  5483. }
  5484. }
  5485.  
  5486. private void drawBlackBox(int x, int y) {
  5487. DrawingArea.drawPixels(71, y - 1, x - 2, 0x726451, 1);
  5488. DrawingArea.drawPixels(69, y, x + 174, 0x726451, 1);
  5489. DrawingArea.drawPixels(1, y - 2, x - 2, 0x726451, 178);
  5490. DrawingArea.drawPixels(1, y + 68, x, 0x726451, 174);
  5491. DrawingArea.drawPixels(71, y - 1, x - 1, 0x2E2B23, 1);
  5492. DrawingArea.drawPixels(71, y - 1, x + 175, 0x2E2B23, 1);
  5493. DrawingArea.drawPixels(1, y - 1, x, 0x2E2B23, 175);
  5494. DrawingArea.drawPixels(1, y + 69, x, 0x2E2B23, 175);
  5495. DrawingArea.method335(0, y, 174, 68, 220, x);
  5496. }
  5497.  
  5498. public String inputTitle = null;
  5499.  
  5500. private void drawChatArea() {
  5501. chatArea.setxPos(0);
  5502. chatArea.setyPos(GameFrame.getScreenMode() == ScreenMode.FIXED ? 338 : getScreenHeight() - 165);
  5503. chatArea.render(this);
  5504. }
  5505.  
  5506. private void drawFlames() {
  5507. drawingFlames = true;
  5508.  
  5509. try {
  5510. long l = System.currentTimeMillis();
  5511. int i = 0;
  5512. int j = 20;
  5513.  
  5514. while (aBoolean831) {
  5515. doFlamesDrawing();
  5516.  
  5517. if (++i > 10) {
  5518. long l1 = System.currentTimeMillis();
  5519. int k = (int) (l1 - l) / 10 - j;
  5520. j = 40 - k;
  5521.  
  5522. if (j < 5) {
  5523. j = 5;
  5524. }
  5525.  
  5526. i = 0;
  5527. l = l1;
  5528. }
  5529.  
  5530. try {
  5531. Thread.sleep(j);
  5532. } catch (Exception _ex) {
  5533. }
  5534. }
  5535. } catch (Exception _ex) {
  5536. }
  5537.  
  5538. drawingFlames = false;
  5539. }
  5540.  
  5541. private void drawFriendsListOrWelcomeScreen(RSInterface class9) {
  5542. int j = class9.contentType;
  5543.  
  5544. if (j >= 205 && j <= 231) {
  5545. j -= 205;
  5546. class9.message = setMessage(j);
  5547. return;
  5548. }
  5549.  
  5550. if (j >= 1 && j <= 100 || j >= 701 && j <= 800) {
  5551. if (j == 1 && getAnInt900() == 0) {
  5552. class9.message = "Loading friend list";
  5553. class9.atActionType = 0;
  5554. return;
  5555. }
  5556.  
  5557. if (j == 1 && getAnInt900() == 1) {
  5558. class9.message = "Connecting to friendserver";
  5559. class9.atActionType = 0;
  5560. return;
  5561. }
  5562.  
  5563. if (j == 2 && getAnInt900() != 2) {
  5564. class9.message = "Please wait...";
  5565. class9.atActionType = 0;
  5566. return;
  5567. }
  5568.  
  5569. int k = friendCount;
  5570.  
  5571. if (getAnInt900() != 2) {
  5572. k = 0;
  5573. }
  5574.  
  5575. if (j > 700) {
  5576. j -= 601;
  5577. } else {
  5578. j--;
  5579. }
  5580.  
  5581. if (j >= k) {
  5582. class9.message = "";
  5583. class9.atActionType = 0;
  5584. return;
  5585. } else {
  5586. class9.message = friendsList[j];
  5587. class9.atActionType = 1;
  5588. return;
  5589. }
  5590. }
  5591.  
  5592. if (j == 901) {
  5593. class9.message = friendCount + "";
  5594. return;
  5595. }
  5596.  
  5597. if (j == 902) {
  5598. class9.message = ignoreCount + "";
  5599. return;
  5600. }
  5601.  
  5602. if (j >= 101 && j <= 200 || j >= 801 && j <= 900) {
  5603. int l = friendCount;
  5604.  
  5605. if (getAnInt900() != 2) {
  5606. l = 0;
  5607. }
  5608.  
  5609. if (j > 800) {
  5610. j -= 701;
  5611. } else {
  5612. j -= 101;
  5613. }
  5614.  
  5615. if (j >= l) {
  5616. class9.message = "";
  5617. class9.atActionType = 0;
  5618. return;
  5619. }
  5620.  
  5621. if (friendsNodeIDs[j] == 0) {
  5622. class9.message = "@red@Offline";
  5623. } else if (friendsNodeIDs[j] == nodeID) {
  5624. class9.message = "@gre@Online"/* + (friendsNodeIDs[j] - 9) */;
  5625. } else {
  5626. class9.message = "@red@Offline"/* + (friendsNodeIDs[j] - 9) */;
  5627. }
  5628.  
  5629. class9.atActionType = 1;
  5630. return;
  5631. }
  5632.  
  5633. if (j == 203) {
  5634. int i1 = friendCount;
  5635.  
  5636. if (getAnInt900() != 2) {
  5637. i1 = 0;
  5638. }
  5639.  
  5640. class9.scrollMax = i1 * 15 + 20;
  5641.  
  5642. if (class9.scrollMax <= class9.height) {
  5643. class9.scrollMax = class9.height + 1;
  5644. }
  5645.  
  5646. return;
  5647. }
  5648.  
  5649. if (j >= 401 && j <= 500) {
  5650. if ((j -= 401) == 0 && getAnInt900() == 0) {
  5651. class9.message = "Loading ignore list";
  5652. class9.atActionType = 0;
  5653. return;
  5654. }
  5655.  
  5656. if (j == 1 && getAnInt900() == 0) {
  5657. class9.message = "Please wait...";
  5658. class9.atActionType = 0;
  5659. return;
  5660. }
  5661.  
  5662. int j1 = ignoreCount;
  5663.  
  5664. if (getAnInt900() == 0) {
  5665. j1 = 0;
  5666. }
  5667.  
  5668. if (j >= j1) {
  5669. class9.message = "";
  5670. class9.atActionType = 0;
  5671. return;
  5672. } else {
  5673. class9.message = TextClass.fixName(TextClass.nameForLong(ignoreListAsLongs[j]));
  5674. class9.atActionType = 1;
  5675. return;
  5676. }
  5677. }
  5678.  
  5679. if (j == 503) {
  5680. class9.scrollMax = ignoreCount * 15 + 20;
  5681.  
  5682. if (class9.scrollMax <= class9.height) {
  5683. class9.scrollMax = class9.height + 1;
  5684. }
  5685.  
  5686. return;
  5687. }
  5688.  
  5689. if (j == 327) {
  5690. class9.modelRotation1 = 150;
  5691. class9.modelRotation2 = (int) (Math.sin(loopCycle / 40D) * 256D) & 0x7FF;
  5692.  
  5693. if (aBoolean1031) {
  5694. for (int k1 = 0; k1 < 7; k1++) {
  5695. int l1 = myAppearance[k1];
  5696.  
  5697. if (l1 >= 0 && !IdentityKit.cache[l1].method537()) {
  5698. return;
  5699. }
  5700. }
  5701.  
  5702. aBoolean1031 = false;
  5703. Model aclass30_sub2_sub4_sub6s[] = new Model[7];
  5704. int i2 = 0;
  5705.  
  5706. for (int j2 = 0; j2 < 7; j2++) {
  5707. int k2 = myAppearance[j2];
  5708.  
  5709. if (k2 >= 0) {
  5710. aclass30_sub2_sub4_sub6s[i2++] = IdentityKit.cache[k2].method538();
  5711. }
  5712. }
  5713.  
  5714. Model model = new Model(i2, aclass30_sub2_sub4_sub6s);
  5715.  
  5716. for (int l2 = 0; l2 < 5; l2++) {
  5717. if (anIntArray990[l2] != 0) {
  5718. model.method476(anIntArrayArray1003[l2][0], anIntArrayArray1003[l2][anIntArray990[l2]]);
  5719.  
  5720. if (l2 == 1) {
  5721. model.method476(anIntArray1204[0], anIntArray1204[anIntArray990[l2]]);
  5722. }
  5723. }
  5724. }
  5725.  
  5726. model.createBones();
  5727. model.applyTransform(Animation.cache[myPlayer.anInt1511].frameIDs[0]);
  5728. model.light(64, 850, -30, -50, -30, true);
  5729. class9.mediaType = 5;
  5730. class9.mediaID = 0;
  5731. RSInterface.clearModelCache(aBoolean994, model);
  5732. }
  5733.  
  5734. return;
  5735. }
  5736.  
  5737. if (j == 3291) {
  5738. if(!(PetSystem.petSelected > 0)) {
  5739. return;
  5740. }
  5741. PetSystem petDef = new PetSystem(MobDefinition.get(PetSystem.petSelected));
  5742. RSInterface rsInterface = class9;
  5743. int verticleTilt = 150;
  5744. rsInterface.modelRotation1 = verticleTilt;
  5745. rsInterface.modelRotation2 = (int)(double)(loopCycle / 100D * 1024D) & 2047;
  5746. Model model;
  5747. final Model[] parts = new Model[petDef.getModelArrayLength()];
  5748. for (int i = 0; i < petDef.getModelArrayLength(); i++) {
  5749. parts[i] = Model.fetchModel(petDef.getModelArray()[i]);
  5750. }
  5751. if (parts.length == 1) {
  5752. model = parts[0];
  5753. } else {
  5754. model = new Model(parts.length, parts);
  5755. }
  5756.  
  5757.  
  5758. if (model == null) {
  5759. return;
  5760. }
  5761.  
  5762.  
  5763. model.createBones();
  5764. model.scale2((int) 1.5);
  5765. model.applyTransform(Animation.cache[petDef.getAnimation()].frameIDs[PetSystem.animationFrame]);
  5766. model.light(64, 850, -30, -50, -30, true);
  5767. rsInterface.mediaType = 5;
  5768. rsInterface.mediaID = 0;
  5769. RSInterface.clearModelCache(aBoolean994, model);
  5770. return;
  5771. }
  5772.  
  5773. if (j == 328) {
  5774. RSInterface rsInterface = class9;
  5775. int verticleTilt = 150;
  5776. int animationSpeed = (int) (Math.sin(loopCycle / 40D) * 256D) & 0x7ff;
  5777. rsInterface.modelRotation1 = verticleTilt;
  5778. rsInterface.modelRotation2 = animationSpeed;
  5779.  
  5780. if (aBoolean1031) {
  5781. Model characterDisplay = myPlayer.method452();
  5782.  
  5783. for (int l2 = 0; l2 < 5; l2++) {
  5784. if (anIntArray990[l2] != 0) {
  5785. characterDisplay.method476(anIntArrayArray1003[l2][0], anIntArrayArray1003[l2][anIntArray990[l2]]);
  5786. if (l2 == 1) {
  5787. characterDisplay.method476(anIntArray1204[0], anIntArray1204[anIntArray990[l2]]);
  5788. }
  5789. }
  5790. }
  5791.  
  5792. int staticFrame = myPlayer.anInt1511;
  5793. characterDisplay.createBones();
  5794. characterDisplay.applyTransform(Animation.cache[staticFrame].frameIDs[0]);
  5795. rsInterface.mediaType = 5;
  5796. rsInterface.mediaID = 0;
  5797. RSInterface.clearModelCache(aBoolean994, characterDisplay);
  5798. }
  5799.  
  5800. return;
  5801. }
  5802.  
  5803. if (j == 324) {
  5804. if (aClass30_Sub2_Sub1_Sub1_931 == null) {
  5805. aClass30_Sub2_Sub1_Sub1_931 = class9.sprite1;
  5806. aClass30_Sub2_Sub1_Sub1_932 = class9.sprite2;
  5807. }
  5808.  
  5809. if (isMale) {
  5810. class9.sprite1 = aClass30_Sub2_Sub1_Sub1_932;
  5811. return;
  5812. } else {
  5813. class9.sprite1 = aClass30_Sub2_Sub1_Sub1_931;
  5814. return;
  5815. }
  5816. }
  5817.  
  5818. if (j == 325) {
  5819. if (aClass30_Sub2_Sub1_Sub1_931 == null) {
  5820. aClass30_Sub2_Sub1_Sub1_931 = class9.sprite1;
  5821. aClass30_Sub2_Sub1_Sub1_932 = class9.sprite2;
  5822. }
  5823.  
  5824. if (isMale) {
  5825. class9.sprite1 = aClass30_Sub2_Sub1_Sub1_931;
  5826. return;
  5827. } else {
  5828. class9.sprite1 = aClass30_Sub2_Sub1_Sub1_932;
  5829. return;
  5830. }
  5831. }
  5832.  
  5833. if (j == 650 || j == 655) {
  5834. if (anInt1193 != 0) {
  5835. String lastVisit;
  5836.  
  5837. if (daysSinceLastLogin == 0) {
  5838. lastVisit = "earlier today";
  5839. } else if (daysSinceLastLogin == 1) {
  5840. lastVisit = "yesterday";
  5841. } else {
  5842. lastVisit = daysSinceLastLogin + " days ago";
  5843. }
  5844.  
  5845. class9.message = "You last logged in " + lastVisit + " from: " + Signlink.dns;
  5846. } else {
  5847. class9.message = "";
  5848. }
  5849. }
  5850.  
  5851. if (j == 651) {
  5852. if (unreadMessages == 0) {
  5853. class9.message = "0 unread messages";
  5854. class9.textColor = 0xffff00;
  5855. } else if (unreadMessages == 1) {
  5856. class9.message = "1 unread message";
  5857. class9.textColor = 65280;
  5858. } else if (unreadMessages > 1) {
  5859. class9.message = unreadMessages + " unread messages";
  5860. class9.textColor = 65280;
  5861. }
  5862. }
  5863.  
  5864. if (j == 652) {
  5865. if (daysSinceRecovChange == 201) {
  5866. if (membersInt == 1) {
  5867. class9.message = "@yel@This is a non-members world: @whi@Since you are a member we";
  5868. } else {
  5869. class9.message = "";
  5870. }
  5871. } else if (daysSinceRecovChange == 200) {
  5872. class9.message = "You have not yet set any password recovery questions.";
  5873. } else {
  5874. String s1;
  5875.  
  5876. if (daysSinceRecovChange == 0) {
  5877. s1 = "Earlier today";
  5878. } else if (daysSinceRecovChange == 1) {
  5879. s1 = "Yesterday";
  5880. } else {
  5881. s1 = daysSinceRecovChange + " days ago";
  5882. }
  5883.  
  5884. class9.message = s1 + " you changed your recovery questions";
  5885. }
  5886. }
  5887.  
  5888. if (j == 653) {
  5889. if (daysSinceRecovChange == 201) {
  5890. if (membersInt == 1) {
  5891. class9.message = "@whi@recommend you use a members world instead. You may use";
  5892. } else {
  5893. class9.message = "";
  5894. }
  5895. } else if (daysSinceRecovChange == 200) {
  5896. class9.message = "We strongly recommend you do so now to secure your account.";
  5897. } else {
  5898. class9.message = "If you do not remember making this change then cancel it immediately";
  5899. }
  5900. }
  5901.  
  5902. if (j == 654) {
  5903. if (daysSinceRecovChange == 201) {
  5904. if (membersInt == 1) {
  5905. class9.message = "@whi@this world but member benefits are unavailable whilst here.";
  5906. return;
  5907. } else {
  5908. class9.message = "";
  5909. return;
  5910. }
  5911. }
  5912.  
  5913. if (daysSinceRecovChange == 200) {
  5914. class9.message = "Do this from the 'account management' area on our front webpage";
  5915. return;
  5916. }
  5917.  
  5918. class9.message = "Do this from the 'account management' area on our front webpage";
  5919. }
  5920. }
  5921.  
  5922. private void drawGameScreen() {
  5923. if (getFullscreenInterfaceID() != -1 && (loadingStage == 2 || super.fullGameScreen != null)) {
  5924. if (loadingStage == 2) {
  5925. processInterfaceAnimation(anInt945, getFullscreenInterfaceID());
  5926. if (openInterfaceID != -1) {
  5927. processInterfaceAnimation(anInt945, openInterfaceID);
  5928. }
  5929. anInt945 = 0;
  5930. resetAllImageProducers();
  5931. super.fullGameScreen.initDrawingArea();
  5932. Rasterizer.lineOffsets = fullScreenTextureArray;
  5933. DrawingArea.setAllPixelsToZero();
  5934. welcomeScreenRaised = true;
  5935. if (openInterfaceID != -1) {
  5936. RSInterface rsInterface_1 = RSInterface.interfaceCache[openInterfaceID];
  5937. if (rsInterface_1.width == 512 && rsInterface_1.height == 334 && rsInterface_1.type == 0) {
  5938. rsInterface_1.width = 765;
  5939. rsInterface_1.height = 503;
  5940. }
  5941. drawInterface(0, 0, rsInterface_1, 8);
  5942. }
  5943. RSInterface rsInterface = RSInterface.interfaceCache[getFullscreenInterfaceID()];
  5944. if (rsInterface.width == 512 && rsInterface.height == 334 && rsInterface.type == 0) {
  5945. rsInterface.width = 765;
  5946. rsInterface.height = 503;
  5947. }
  5948. drawInterface(0, 0, rsInterface, 8);
  5949.  
  5950. if (!menuOpen) {
  5951. processRightClick();
  5952. drawTooltip();
  5953. } else {
  5954. drawMenu();
  5955. }
  5956. }
  5957. drawCount++;
  5958. super.fullGameScreen.drawGraphics(0, super.graphics, 0);
  5959. return;
  5960. } else {
  5961. if (drawCount != 0) {
  5962. resetImageProducers2();
  5963. }
  5964. }
  5965. if (welcomeScreenRaised) {
  5966. welcomeScreenRaised = false;
  5967. if (GameFrame.getScreenMode() == ScreenMode.FIXED) {
  5968. topFrame.drawGraphics(0, super.graphics, 0);
  5969. leftFrame.drawGraphics(4, super.graphics, 0);
  5970.  
  5971. rightFrame.drawGraphics(4, super.graphics, 516);
  5972. rightFrame.drawGraphics(4, super.graphics, 515);
  5973. }
  5974.  
  5975. setInputTaken(true);
  5976. tabAreaAltered = true;
  5977.  
  5978. if (loadingStage != 2) {
  5979. if (!resizing) {
  5980. gameScreenIP.drawGraphics(gameScreenDrawY, super.graphics, gameScreenDrawX);
  5981. }
  5982. mapAreaIP.drawGraphics(mapArea.getyPos(), super.graphics, mapArea.getxPos());
  5983. }
  5984. }
  5985.  
  5986. drawTabArea();
  5987.  
  5988. if (backDialogID == -1 && inputDialogState == 3) {
  5989. int position = getGrandExchange().totalItemResults * 14 + 7;
  5990. aClass9_1059.scrollPosition = getGrandExchange().itemResultScrollPos;
  5991. if (super.mouseX > 478 && super.mouseX < 580
  5992. && super.mouseY > (clientHeight - 161)) {
  5993. method65(494, 110, super.mouseX - 0, super.mouseY
  5994. - (clientHeight - 155), aClass9_1059, 0, false,
  5995. getGrandExchange().totalItemResults);
  5996. }
  5997. int scrollPosition = aClass9_1059.scrollPosition;
  5998. if (scrollPosition < 0) {
  5999. scrollPosition = 0;
  6000. }
  6001. if (scrollPosition > position - 110) {
  6002. scrollPosition = position - 110;
  6003. }
  6004. if (getGrandExchange().itemResultScrollPos != scrollPosition) {
  6005. getGrandExchange().itemResultScrollPos = scrollPosition;
  6006. inputTaken = true;
  6007. }
  6008. }
  6009. if (backDialogID == -1 && inputDialogState != 3) {
  6010. aClass9_1059.scrollPosition = anInt1211 - anInt1089 - 110;
  6011. if (super.mouseX > chatArea.getxPos() + 478 && super.mouseX < chatArea.getxPos() + 580 && super.mouseY > chatArea.getyPos() + 4) {
  6012. method65(494, 110, super.mouseX - chatArea.getxPos(), super.mouseY - chatArea.getyPos() - 10, aClass9_1059, 0, false, anInt1211);
  6013. }
  6014. int i = anInt1211 - 110 - aClass9_1059.scrollPosition;
  6015. if (i < 0) {
  6016. i = 0;
  6017. }
  6018. if (i > anInt1211 - 110) {
  6019. i = anInt1211 - 110;
  6020. }
  6021. if (anInt1089 != i) {
  6022. anInt1089 = i;
  6023. setInputTaken(true);
  6024. }
  6025. }
  6026. if (backDialogID != -1) {
  6027. boolean flag2 = processInterfaceAnimation(anInt945, backDialogID);
  6028. if (flag2) {
  6029. setInputTaken(true);
  6030. }
  6031. }
  6032.  
  6033. if (atInventoryInterfaceType == 3) {
  6034. setInputTaken(true);
  6035. }
  6036.  
  6037. if (activeInterfaceType == 3) {
  6038. setInputTaken(true);
  6039. }
  6040.  
  6041. if (aString844 != null) {
  6042. setInputTaken(true);
  6043. }
  6044.  
  6045. if (menuOpen && menuScreenArea == 2) {
  6046. setInputTaken(true);
  6047. }
  6048.  
  6049. if (inputTaken) {
  6050. drawChatArea();
  6051. drawConsoleArea();
  6052. setInputTaken(false);
  6053. }
  6054.  
  6055. if (loadingStage == 2) {
  6056. method146();
  6057. }
  6058.  
  6059. if (loadingStage == 2) {
  6060. if (GameFrame.getScreenMode() == ScreenMode.FIXED) {
  6061. drawMinimap();
  6062. if (mapArea.isVisible()) {
  6063. mapAreaIP.drawGraphics(mapArea.getyPos(), super.graphics, mapArea.getxPos());
  6064. }
  6065. }
  6066. }
  6067.  
  6068. if (anInt1054 != -1) {
  6069. tabAreaAltered = true;
  6070. }
  6071.  
  6072. if (tabAreaAltered) {
  6073. if (anInt1054 != -1 && anInt1054 == tabID) {
  6074. anInt1054 = -1;
  6075. getOut().putOpcode(120);
  6076. getOut().putByte(tabID);
  6077. }
  6078.  
  6079. tabAreaAltered = false;
  6080. aRSImageProducer_1125.initDrawingArea();
  6081. gameScreenIP.initDrawingArea();
  6082. }
  6083.  
  6084. if (menuOpen) {
  6085. drawMenu();
  6086. }
  6087.  
  6088. anInt945 = 0;
  6089. }
  6090.  
  6091. private void drawHeadIcon() {
  6092. if (anInt855 != 2) {
  6093. return;
  6094. }
  6095.  
  6096. calcEntityScreenPos((anInt934 - baseX << 7) + anInt937, anInt936 * 2, (anInt935 - baseY << 7) + anInt938);
  6097.  
  6098. if (spriteDrawX > -1 && loopCycle % 20 < 10) {
  6099. headIconsHint[0].drawSprite(spriteDrawX - 12, spriteDrawY - 28);
  6100. }
  6101. }
  6102.  
  6103. private void drawHoverBox(int xPos, int yPos, String text) {
  6104. String[] results = text.split("\n");
  6105. int height = results.length * 16 + 6;
  6106. int width = chatTextDrawingArea.getTextWidth(results[0]) + 6;
  6107.  
  6108. for (int i = 1; i < results.length; i++) {
  6109. if (width <= chatTextDrawingArea.getTextWidth(results[i]) + 6) {
  6110. width = chatTextDrawingArea.getTextWidth(results[i]) + 6;
  6111. }
  6112. }
  6113.  
  6114. DrawingArea.drawPixels(height, yPos, xPos, 0xFFFFA0, width);
  6115. DrawingArea.fillPixels(xPos, width, height, 0, yPos);
  6116. yPos += 14;
  6117.  
  6118. for (String result : results) {
  6119. normalText.drawRegularText(false, xPos + 3, 0, result, yPos);
  6120. yPos += 16;
  6121. }
  6122. }
  6123.  
  6124. public void drawInterface(int scrollOffset, int interfaceX, RSInterface class9, int interfaceY) {
  6125. if (class9 == null)
  6126. return;
  6127.  
  6128. if (class9.children == null || class9.type != 0) {
  6129. return;
  6130. }
  6131.  
  6132. if (class9.interfaceShown && anInt1026 != class9.id && anInt1048 != class9.id && anInt1039 != class9.id) {
  6133. return;
  6134. }
  6135.  
  6136. int i1 = DrawingArea.topX;
  6137. int j1 = DrawingArea.topY;
  6138. int k1 = DrawingArea.bottomX;
  6139. int l1 = DrawingArea.bottomY;
  6140. DrawingArea.setBounds(interfaceX, interfaceY, interfaceX + class9.width, interfaceY + class9.height);
  6141. int i2 = class9.children.length;
  6142.  
  6143. for (int j2 = 0; j2 < i2; j2++) {
  6144. int childX = class9.childX[j2] + interfaceX;
  6145. int childY = class9.childY[j2] + interfaceY - scrollOffset;
  6146. RSInterface childInterface = RSInterface.interfaceCache[class9.children[j2]];
  6147. if(childInterface == null)
  6148. continue;
  6149. //System.out.println(childInterface.type);
  6150. childX += childInterface.xOffset;
  6151. childY += childInterface.yOffset;
  6152.  
  6153. if (childInterface.contentType > 0) {
  6154. drawFriendsListOrWelcomeScreen(childInterface);
  6155. }
  6156.  
  6157. for (int m5 = 0; m5 < IDs.length; m5++) {
  6158. if (childInterface.id == IDs[m5] + 1) {
  6159. if (m5 > 61) {
  6160. drawBlackBox(childX + 1, childY);
  6161. } else {
  6162. drawBlackBox(childX, childY + 1);
  6163. }
  6164. }
  6165. }
  6166.  
  6167. for (int element : runeChildren) {
  6168. if (childInterface.id == element) {
  6169. childInterface.modelZoom = 775;
  6170. }
  6171. }
  6172. if(childInterface.id == 1194 || childInterface.id == 12856) //Removes black box when not hovering in spellbooks
  6173. continue;
  6174. if (childInterface.type == 0) {
  6175. //System.out.println(childInterface.id);
  6176. if (childInterface.scrollPosition > childInterface.scrollMax - childInterface.height) {
  6177. childInterface.scrollPosition = childInterface.scrollMax - childInterface.height;
  6178. }
  6179.  
  6180. if (childInterface.scrollPosition < 0) {
  6181. childInterface.scrollPosition = 0;
  6182. }
  6183.  
  6184. drawInterface(childInterface.scrollPosition, childX, childInterface, childY);
  6185.  
  6186. if (childInterface.scrollMax > childInterface.height) {
  6187. drawScrollbar(childInterface.height, childInterface.scrollPosition, childY, childX + childInterface.width, childInterface.scrollMax, false, false);
  6188. }
  6189. } else if (childInterface.type != 1) {
  6190. if (childInterface.type == 2) {
  6191. int i3 = 0;
  6192. for (int l3 = 0; l3 < childInterface.height; l3++) {
  6193. for (int l4 = 0; l4 < childInterface.width; l4++) {
  6194. int k5 = childX + l4 * (32 + childInterface.invSpritePadX);
  6195. int j6 = childY + l3 * (32 + childInterface.invSpritePadY);
  6196.  
  6197. if (i3 < 20) {
  6198. k5 += childInterface.spritesX[i3];
  6199. j6 += childInterface.spritesY[i3];
  6200. }
  6201.  
  6202. if (i3 < childInterface.inv.length && childInterface.inv[i3] > 0) {
  6203. int k6 = 0;
  6204. int j7 = 0;
  6205. int j9 = childInterface.inv[i3] - 1;
  6206.  
  6207. if (k5 > DrawingArea.topX - 32 && k5 < DrawingArea.bottomX && j6 > DrawingArea.topY - 32 && j6 < DrawingArea.bottomY || activeInterfaceType != 0 && anInt1085 == i3) {
  6208. int l9 = 0;
  6209. if (itemSelected == 1 && anInt1283 == i3 && anInt1284 == childInterface.id) {
  6210. l9 = 0xffffff;
  6211. }
  6212.  
  6213. Sprite selectedItem = ItemDefinition.getSprite(j9, childInterface.invStackSizes[i3], l9);
  6214.  
  6215. if (selectedItem != null) {
  6216. if (activeInterfaceType != 0 && anInt1085 == i3 && anInt1084 == childInterface.id) {
  6217. k6 = super.mouseX - anInt1087;
  6218. j7 = super.mouseY - anInt1088;
  6219.  
  6220. if (k6 < 5 && k6 > -5) {
  6221. k6 = 0;
  6222. }
  6223.  
  6224. if (j7 < 5 && j7 > -5) {
  6225. j7 = 0;
  6226. }
  6227.  
  6228. if (anInt989 < 10) {
  6229. k6 = 0;
  6230. j7 = 0;
  6231. }
  6232.  
  6233. selectedItem.drawSprite1(k5 + k6, j6 + j7);
  6234. int yy = GameFrame.getScreenMode() == ScreenMode.FIXED ? 40 : 40 + (clientHeight / 2) - 167;
  6235. if(openInterfaceID == 5292) {
  6236. if(super.mouseY >= yy && super.mouseY <= yy+37) {
  6237. bankItemDragSprite = selectedItem;
  6238. bankItemDragSpriteX = super.mouseX;
  6239. bankItemDragSpriteY = super.mouseY;
  6240. } else {
  6241. bankItemDragSprite = null;
  6242. }
  6243. }
  6244. if (j6 + j7 < DrawingArea.topY && class9.scrollPosition > 0) {
  6245. int i10 = anInt945 * (DrawingArea.topY - j6 - j7) / 3;
  6246.  
  6247. if (i10 > anInt945 * 10) {
  6248. i10 = anInt945 * 10;
  6249. }
  6250.  
  6251. if (i10 > class9.scrollPosition) {
  6252. i10 = class9.scrollPosition;
  6253. }
  6254.  
  6255. class9.scrollPosition -= i10;
  6256. anInt1088 += i10;
  6257. }
  6258.  
  6259. if (j6 + j7 + 32 > DrawingArea.bottomY && class9.scrollPosition < class9.scrollMax - class9.height) {
  6260. int j10 = anInt945 * (j6 + j7 + 32 - DrawingArea.bottomY) / 3;
  6261.  
  6262. if (j10 > anInt945 * 10) {
  6263. j10 = anInt945 * 10;
  6264. }
  6265.  
  6266. if (j10 > class9.scrollMax - class9.height - class9.scrollPosition) {
  6267. j10 = class9.scrollMax - class9.height - class9.scrollPosition;
  6268. }
  6269.  
  6270. class9.scrollPosition += j10;
  6271. anInt1088 -= j10;
  6272. }
  6273. } else if (atInventoryInterfaceType != 0 && atInventoryIndex == i3 && atInventoryInterface == childInterface.id) {
  6274. selectedItem.drawSprite1(k5, j6);
  6275. } else {
  6276. selectedItem.drawSprite(k5, j6);
  6277. }
  6278.  
  6279. if (selectedItem.maxWidth == 33 || childInterface.invStackSizes[i3] != 1) {
  6280. int k10 = childInterface.invStackSizes[i3];
  6281.  
  6282. if (!childInterface.hideStackSize) {
  6283. if(k10 >= 1500000000 && childInterface.drawInfinity) {
  6284. cacheSprite[780].drawSprite(k5, j6);
  6285. } else {
  6286. smallText.method385(0,
  6287. intToKOrMil(k10),
  6288. j6 + 10 + j7,
  6289. k5 + 1 + k6);
  6290. if (k10 > 99999
  6291. && k10 < 10000000)
  6292. smallText.method385(
  6293. 0xFFFFFF,
  6294. intToKOrMil(k10),
  6295. j6 + 9
  6296. + j7,
  6297. k5 + k6);
  6298. else if (k10 > 9999999)
  6299. smallText.method385(
  6300. 0x00ff80,
  6301. intToKOrMil(k10),
  6302. j6 + 9
  6303. + j7,
  6304. k5 + k6);
  6305. else
  6306. smallText.method385(
  6307. 0xFFFF00,
  6308. intToKOrMil(k10),
  6309. j6 + 9
  6310. + j7,
  6311. k5 + k6);
  6312. }
  6313. }
  6314. }
  6315. }
  6316. }
  6317. } else if (childInterface.sprites != null && i3 < 20) {
  6318. Sprite class30_sub2_sub1_sub1_1 = childInterface.sprites[i3];
  6319.  
  6320. if (class30_sub2_sub1_sub1_1 != null) {
  6321. class30_sub2_sub1_sub1_1.drawSprite(k5, j6);
  6322. }
  6323. }
  6324.  
  6325. i3++;
  6326. }
  6327. }
  6328. } else if (childInterface.type == 3) {
  6329. boolean flag = false;
  6330.  
  6331. if (anInt1039 == childInterface.id || anInt1048 == childInterface.id || anInt1026 == childInterface.id) {
  6332. flag = true;
  6333. }
  6334.  
  6335. int j3;
  6336.  
  6337. if (interfaceIsSelected(childInterface)) {
  6338. j3 = childInterface.anInt219;
  6339.  
  6340. if (flag && childInterface.anInt239 != 0) {
  6341. j3 = childInterface.anInt239;
  6342. }
  6343. } else {
  6344. j3 = childInterface.textColor;
  6345.  
  6346. if (flag && childInterface.anInt216 != 0) {
  6347. j3 = childInterface.anInt216;
  6348. }
  6349. }
  6350.  
  6351. if (childInterface.opacity == 0) {
  6352. if (childInterface.filled) {
  6353. DrawingArea.drawPixels(childInterface.height, childY, childX, j3, childInterface.width);
  6354. } else {
  6355. DrawingArea.fillPixels(childX, childInterface.width, childInterface.height, j3, childY);
  6356. }
  6357. } else if (childInterface.filled) {
  6358. DrawingArea.method335(j3, childY, childInterface.width, childInterface.height, 256 - (childInterface.opacity & 0xff), childX);
  6359. } else {
  6360. DrawingArea.method338(childY, childInterface.height, 256 - (childInterface.opacity & 0xff), j3, childInterface.width, childX);
  6361. }
  6362. } else if (childInterface.type == 4) {
  6363. TextDrawingArea textDrawingArea = childInterface.textDrawingAreas;
  6364. String s = childInterface.message;
  6365. int xOffset = 0;
  6366. int imageDraw = 0;
  6367. final String INITIAL_MESSAGE = s;
  6368. if (s.contains("<img=")) {
  6369. int prefix = s.indexOf("<img=");
  6370. int suffix = s.indexOf(">");
  6371. try {
  6372. imageDraw = Integer.parseInt(s.substring(prefix + 5, suffix));
  6373. s = s.replaceAll(s.substring(prefix + 5, suffix), "");
  6374. s = s.replaceAll("</img>", "");
  6375. s = s.replaceAll("<img=>", "");
  6376. } catch (NumberFormatException nfe) {
  6377. //System.out.println("Unable to draw player crown on interface. Unable to read rights.");
  6378. s = INITIAL_MESSAGE;
  6379. } catch (IllegalStateException ise) {
  6380. //System.out.println("Unable to draw player crown on interface, rights too low or high.");
  6381. s = INITIAL_MESSAGE;
  6382. }
  6383. if(suffix > prefix) {
  6384. xOffset += 14;
  6385. }
  6386. }
  6387. boolean flag1 = false;
  6388. if (anInt1039 == childInterface.id || anInt1048 == childInterface.id || anInt1026 == childInterface.id) {
  6389. flag1 = true;
  6390. }
  6391. int i4;
  6392. if (interfaceIsSelected(childInterface)) {
  6393. i4 = childInterface.anInt219;
  6394. if (flag1 && childInterface.anInt239 != 0) {
  6395. i4 = childInterface.anInt239;
  6396. }
  6397. if (childInterface.aString228.length() > 0) {
  6398. s = childInterface.aString228;
  6399. }
  6400. } else {
  6401. if (childInterface.drawSecondary) {
  6402. i4 = childInterface.anInt219;
  6403. } else {
  6404. i4 = childInterface.textColor;
  6405. }
  6406. if (flag1 && childInterface.anInt216 != 0) {
  6407. i4 = childInterface.anInt216;
  6408. }
  6409. }
  6410. if (childInterface.atActionType == 6 && aBoolean1149) {
  6411. s = "Please wait...";
  6412. i4 = childInterface.textColor;
  6413. }
  6414. if (DrawingArea.width == 516) {
  6415. if (i4 == 0xffff00) {
  6416. i4 = 255;
  6417. }
  6418. if (i4 == 49152) {
  6419. i4 = 0xffffff;
  6420. }
  6421. }
  6422. if (childInterface.parentID == 1151 || childInterface.parentID == 12855) {
  6423. switch (i4) {
  6424. case 16773120:
  6425. i4 = 0xFE981F;
  6426. break;
  6427. case 7040819:
  6428. i4 = 0xAF6A1A;
  6429. break;
  6430. }
  6431. }
  6432. for (int l6 = childY + textDrawingArea.anInt1497; s.length() > 0; l6 += textDrawingArea.anInt1497) {
  6433. if (s.indexOf("%") != -1) {
  6434. do {
  6435. int k7 = s.indexOf("%1");
  6436. if (k7 == -1) {
  6437. break;
  6438. }
  6439. if (childInterface.id < 4000 || childInterface.id > 5000 && childInterface.id != 13921 && childInterface.id != 13922 && childInterface.id != 12171 && childInterface.id != 12172) {
  6440. s = s.substring(0, k7) + methodR(extractInterfaceValues(childInterface, 0)) + s.substring(k7 + 2);
  6441. } else {
  6442. s = s.substring(0, k7) + interfaceIntToString(extractInterfaceValues(childInterface, 0)) + s.substring(k7 + 2);
  6443. }
  6444. } while (true);
  6445. do {
  6446. int l7 = s.indexOf("%2");
  6447. if (l7 == -1) {
  6448. break;
  6449. }
  6450. s = s.substring(0, l7) + interfaceIntToString(extractInterfaceValues(childInterface, 1)) + s.substring(l7 + 2);
  6451. } while (true);
  6452. do {
  6453. int i8 = s.indexOf("%3");
  6454. if (i8 == -1) {
  6455. break;
  6456. }
  6457. s = s.substring(0, i8) + interfaceIntToString(extractInterfaceValues(childInterface, 2)) + s.substring(i8 + 2);
  6458. } while (true);
  6459. do {
  6460. int j8 = s.indexOf("%4");
  6461. if (j8 == -1) {
  6462. break;
  6463. }
  6464. s = s.substring(0, j8) + interfaceIntToString(extractInterfaceValues(childInterface, 3)) + s.substring(j8 + 2);
  6465. } while (true);
  6466. do {
  6467. int k8 = s.indexOf("%5");
  6468. if (k8 == -1) {
  6469. break;
  6470. }
  6471. s = s.substring(0, k8) + interfaceIntToString(extractInterfaceValues(childInterface, 4)) + s.substring(k8 + 2);
  6472. } while (true);
  6473. }
  6474. int l8 = s.indexOf("\\n");
  6475. String s1;
  6476. if (l8 != -1) {
  6477. s1 = s.substring(0, l8);
  6478. s = s.substring(l8 + 2);
  6479. } else {
  6480. s1 = s;
  6481. s = "";
  6482. }
  6483. if (imageDraw > 0 && xOffset > 0) {
  6484. int drawImageY = childY + 14;
  6485. if(imageDraw >= 841 && imageDraw <= 849) { // Clan chat images
  6486. xOffset -= 5;
  6487. drawImageY -= 7;
  6488. }
  6489. newRegularFont.drawBasicString("<img="+imageDraw+">", childX, drawImageY, true);
  6490. }
  6491. if (childInterface.centerText) {
  6492. textDrawingArea.drawCenteredText(i4, childX + childInterface.width / 2 + xOffset, s1, l6, childInterface.textShadow);
  6493. } else {
  6494. textDrawingArea.drawRegularText(childInterface.textShadow, childX + xOffset, i4, s1, l6);
  6495. }
  6496. }
  6497. } else if (childInterface.type == 5) {
  6498. Sprite sprite;
  6499.  
  6500. if (childInterface.itemSpriteId > 0
  6501. && childInterface.sprite1 == null && childInterface.sprite2 == null) {
  6502. childInterface.sprite1 = ItemDefinition.getSprite(
  6503. childInterface.itemSpriteId, 1,
  6504. (childInterface.itemSpriteZoom == -1) ? 0 : -1,
  6505. childInterface.itemSpriteZoom);
  6506. childInterface.sprite2 = ItemDefinition.getSprite(
  6507. childInterface.itemSpriteId, 1,
  6508. (childInterface.itemSpriteZoom == -1) ? 0 : -1,
  6509. childInterface.itemSpriteZoom);
  6510.  
  6511. }
  6512.  
  6513. if (interfaceIsSelected(childInterface)) {
  6514. sprite = childInterface.sprite2;
  6515. } else {
  6516. sprite = childInterface.sprite1;
  6517. }
  6518.  
  6519. if (childInterface.id == 1164 || childInterface.id == 1167 || childInterface.id == 1170 || childInterface.id == 1174 || childInterface.id == 1540 || childInterface.id == 1541 || childInterface.id == 7455 || childInterface.id == 18470 || childInterface.id == 13035 || childInterface.id == 13045 || childInterface.id == 13053 || childInterface.id == 13061 || childInterface.id == 13069 || childInterface.id == 13079 || childInterface.id == 30064 || childInterface.id == 30075 || childInterface.id == 30083 || childInterface.id == 30106 || childInterface.id == 30114 || childInterface.id == 30106 || childInterface.id == 30170 || childInterface.id == 13087 || childInterface.id == 30162 || childInterface.id == 13095) {
  6520. sprite = childInterface.sprite2;
  6521. }
  6522.  
  6523. if(childInterface.summonReq > 0 && childInterface.sprite1 != null && childInterface.sprite2 != null) {
  6524. childInterface.greyScale = (childInterface.summonReq > maxStats[23]);
  6525. if(childInterface.greyScale) {
  6526. childInterface.sprite1.greyScale();
  6527. sprite = childInterface.sprite1;
  6528. } else {
  6529. sprite = childInterface.sprite2;
  6530. }
  6531. }
  6532.  
  6533. if (spellSelected == 1 && childInterface.id == spellID && spellID != 0 && sprite != null) {
  6534. sprite.drawSprite(childX, childY, 0xffffff);
  6535. } else {
  6536. if (sprite != null) {
  6537. if(childInterface.advancedSprite) {
  6538. sprite.drawAdvancedSprite(childX, childY);
  6539. } else {
  6540. sprite.drawSprite(childX, childY);
  6541. }
  6542. }
  6543. }
  6544. if (autoCast && childInterface.id == autocastId) {
  6545. cacheSprite[497].drawSprite(childX - 3, childY - 3);
  6546. }
  6547. } else if (childInterface.type == 6) {
  6548. int k3 = Rasterizer.centerX;
  6549. int j4 = Rasterizer.centerY;
  6550. Rasterizer.centerX = childX + childInterface.width / 2;
  6551. Rasterizer.centerY = childY + childInterface.height / 2;
  6552. int i5 = Rasterizer.SINE[childInterface.modelRotation1] * childInterface.modelZoom >> 16;
  6553. int l5 = Rasterizer.COSINE[childInterface.modelRotation1] * childInterface.modelZoom >> 16;
  6554. boolean flag2 = interfaceIsSelected(childInterface);
  6555. int i7;
  6556. if (flag2) {
  6557. i7 = childInterface.enabledAnimationId;
  6558. } else {
  6559. i7 = childInterface.disabledAnimationId;
  6560. }
  6561. Model model;
  6562. if (i7 == -1) {
  6563. model = childInterface.method209(-1, -1, flag2);
  6564. } else {
  6565. Animation animation = Animation.cache[i7];
  6566. model = childInterface.method209(animation.frameIDs2[childInterface.anInt246], animation.frameIDs[childInterface.anInt246], flag2);
  6567. }
  6568. if (model != null) {
  6569. model.renderSingle(childInterface.modelRotation2, 0, childInterface.modelRotation1, 0, i5, l5);
  6570. }
  6571. Rasterizer.centerX = k3;
  6572. Rasterizer.centerY = j4;
  6573. } else if (childInterface.type == 7) {
  6574. TextDrawingArea textDrawingArea_1 = childInterface.textDrawingAreas;
  6575. int k4 = 0;
  6576. for (int j5 = 0; j5 < childInterface.height; j5++) {
  6577. for (int i6 = 0; i6 < childInterface.width; i6++) {
  6578. if (childInterface.inv[k4] > 0) {
  6579. ItemDefinition itemDef = ItemDefinition.get(childInterface.inv[k4] - 1);
  6580. String s2 = itemDef.name;
  6581. if (itemDef.stackable || childInterface.invStackSizes[k4] != 1) {
  6582. s2 = s2 + " x" + intToKOrMilLongName(childInterface.invStackSizes[k4]);
  6583. }
  6584. int i9 = childX + i6 * (115 + childInterface.invSpritePadX);
  6585. int k9 = childY + j5 * (12 + childInterface.invSpritePadY);
  6586. if (childInterface.centerText) {
  6587. textDrawingArea_1.drawCenteredText(childInterface.textColor, i9 + childInterface.width / 2, s2, k9, childInterface.textShadow);
  6588. } else {
  6589. textDrawingArea_1.drawRegularText(childInterface.textShadow, i9, childInterface.textColor, s2, k9);
  6590. }
  6591. }
  6592. k4++;
  6593. }
  6594. }
  6595. } else if (childInterface.type == 8 && (anInt1500 == childInterface.id || anInt1044 == childInterface.id || anInt1129 == childInterface.id) && anInt1501 == 30 && !menuOpen) {
  6596. int boxWidth = 0;
  6597. int boxHeight = 0;
  6598. TextDrawingArea textDrawingArea_2 = normalText;
  6599. for (String s1 = childInterface.message; s1.length() > 0;) {
  6600. if (s1.indexOf("%") != -1) {
  6601. do {
  6602. int k7 = s1.indexOf("%1");
  6603. if (k7 == -1) {
  6604. break;
  6605. }
  6606. s1 = s1.substring(0, k7) + interfaceIntToString(extractInterfaceValues(childInterface, 0)) + s1.substring(k7 + 2);
  6607. } while (true);
  6608. do {
  6609. int l7 = s1.indexOf("%2");
  6610. if (l7 == -1) {
  6611. break;
  6612. }
  6613. s1 = s1.substring(0, l7) + interfaceIntToString(extractInterfaceValues(childInterface, 1)) + s1.substring(l7 + 2);
  6614. } while (true);
  6615. do {
  6616. int i8 = s1.indexOf("%3");
  6617. if (i8 == -1) {
  6618. break;
  6619. }
  6620. s1 = s1.substring(0, i8) + interfaceIntToString(extractInterfaceValues(childInterface, 2)) + s1.substring(i8 + 2);
  6621. } while (true);
  6622. do {
  6623. int j8 = s1.indexOf("%4");
  6624. if (j8 == -1) {
  6625. break;
  6626. }
  6627. s1 = s1.substring(0, j8) + interfaceIntToString(extractInterfaceValues(childInterface, 3)) + s1.substring(j8 + 2);
  6628. } while (true);
  6629. do {
  6630. int k8 = s1.indexOf("%5");
  6631. if (k8 == -1) {
  6632. break;
  6633. }
  6634. s1 = s1.substring(0, k8) + interfaceIntToString(extractInterfaceValues(childInterface, 4)) + s1.substring(k8 + 2);
  6635. } while (true);
  6636. }
  6637. int l7 = s1.indexOf("\\n");
  6638. String s4;
  6639. if (l7 != -1) {
  6640. s4 = s1.substring(0, l7);
  6641. s1 = s1.substring(l7 + 2);
  6642. } else {
  6643. s4 = s1;
  6644. s1 = "";
  6645. }
  6646. int j10 = textDrawingArea_2.getTextWidth(s4);
  6647. if (j10 > boxWidth) {
  6648. boxWidth = j10;
  6649. }
  6650. boxHeight += textDrawingArea_2.anInt1497 + 1;
  6651. }
  6652. boxWidth += 6;
  6653. boxHeight += 7;
  6654. int xPos = childX + childInterface.width - 5 - boxWidth;
  6655. int yPos = childY + childInterface.height + 5;
  6656. if (xPos < childX + 5) {
  6657. xPos = childX + 5;
  6658. }
  6659. if (xPos + boxWidth > interfaceX + class9.width) {
  6660. xPos = interfaceX + class9.width - boxWidth;
  6661. }
  6662. if (yPos + boxHeight > interfaceY + class9.height) {
  6663. yPos = childY - boxHeight;
  6664. }
  6665. DrawingArea.drawPixels(boxHeight, yPos, xPos, 0xFFFFA0, boxWidth);
  6666. DrawingArea.fillPixels(xPos, boxWidth, boxHeight, 0, yPos);
  6667. String s2 = childInterface.message;
  6668. for (int j11 = yPos + textDrawingArea_2.anInt1497 + 2; s2.length() > 0; j11 += textDrawingArea_2.anInt1497 + 1) {// anInt1497
  6669. if (s2.indexOf("%") != -1) {
  6670. do {
  6671. int k7 = s2.indexOf("%1");
  6672. if (k7 == -1) {
  6673. break;
  6674. }
  6675. s2 = s2.substring(0, k7) + interfaceIntToString(extractInterfaceValues(childInterface, 0)) + s2.substring(k7 + 2);
  6676. } while (true);
  6677. do {
  6678. int l7 = s2.indexOf("%2");
  6679. if (l7 == -1) {
  6680. break;
  6681. }
  6682. s2 = s2.substring(0, l7) + interfaceIntToString(extractInterfaceValues(childInterface, 1)) + s2.substring(l7 + 2);
  6683. } while (true);
  6684. do {
  6685. int i8 = s2.indexOf("%3");
  6686. if (i8 == -1) {
  6687. break;
  6688. }
  6689. s2 = s2.substring(0, i8) + interfaceIntToString(extractInterfaceValues(childInterface, 2)) + s2.substring(i8 + 2);
  6690. } while (true);
  6691. do {
  6692. int j8 = s2.indexOf("%4");
  6693. if (j8 == -1) {
  6694. break;
  6695. }
  6696. s2 = s2.substring(0, j8) + interfaceIntToString(extractInterfaceValues(childInterface, 3)) + s2.substring(j8 + 2);
  6697. } while (true);
  6698. do {
  6699. int k8 = s2.indexOf("%5");
  6700. if (k8 == -1) {
  6701. break;
  6702. }
  6703. s2 = s2.substring(0, k8) + interfaceIntToString(extractInterfaceValues(childInterface, 4)) + s2.substring(k8 + 2);
  6704. } while (true);
  6705. }
  6706. int l11 = s2.indexOf("\\n");
  6707. String s5;
  6708. if (l11 != -1) {
  6709. s5 = s2.substring(0, l11);
  6710. s2 = s2.substring(l11 + 2);
  6711. } else {
  6712. s5 = s2;
  6713. s2 = "";
  6714. }
  6715. if (childInterface.centerText) {
  6716. textDrawingArea_2.drawCenteredText(yPos, xPos + childInterface.width / 2, s5, j11, false);
  6717. } else {
  6718. if (s5.contains("\\r")) {
  6719. String text = s5.substring(0, s5.indexOf("\\r"));
  6720. String text2 = s5.substring(s5.indexOf("\\r") + 2);
  6721. textDrawingArea_2.drawRegularText(false, xPos + 3, 0, text, j11);
  6722. int rightX = boxWidth + xPos - textDrawingArea_2.getTextWidth(text2) - 2;
  6723. textDrawingArea_2.drawRegularText(false, rightX, 0, text2, j11);
  6724. System.out.println("Box: " + boxWidth + "");
  6725. } else {
  6726. textDrawingArea_2.drawRegularText(false, xPos + 3, 0, s5, j11);
  6727. }
  6728. }
  6729. }
  6730. } else if (childInterface.type == 9) {
  6731. //if (interfaceIsSelected(childInterface)) {
  6732. // } else {
  6733. try {
  6734. drawHoverBox(childX, childY, childInterface.tooltipBoxText);
  6735. } catch (Exception e) {
  6736. e.printStackTrace();
  6737. }
  6738. /// }
  6739. } else if (childInterface.type == 10 && !menuOpen && skillTabHoverChild > 0 && anInt1501 == 30) {
  6740. if(childInterface.id != skillTabHoverChild)
  6741. continue;
  6742. int boxWidth = 0;
  6743. int boxHeight = 0;
  6744. TextDrawingArea textDrawingArea_2 = normalText;
  6745. for (String s1 = childInterface.message; s1.length() > 0;) {
  6746. int l7 = s1.indexOf("\\n");
  6747. String s4;
  6748. if (l7 != -1) {
  6749. s4 = s1.substring(0, l7);
  6750. s1 = s1.substring(l7 + 2);
  6751. } else {
  6752. s4 = s1;
  6753. s1 = "";
  6754. }
  6755. int j10 = textDrawingArea_2.getTextWidth(s4);
  6756. if (j10 > boxWidth) {
  6757. boxWidth = j10;
  6758. }
  6759. boxHeight += textDrawingArea_2.anInt1497 + 1;
  6760. }
  6761. boxWidth += 6;
  6762. boxHeight += 7;
  6763. boolean canDrawPercent = currentExp[skillIdForButton(childInterface.id)] < 1000000000 && Skills.goalData[skillIdForButton(childInterface.id)][0] != -1 && Skills.goalData[skillIdForButton(childInterface.id)][1] != -1 && Skills.goalData[skillIdForButton(childInterface.id)][2] != -1;
  6764. int xPos = (childX + childInterface.width) - 5 - boxWidth;
  6765. int yPos = childY + childInterface.height + 5;
  6766. if (canDrawPercent && Skills.SKILL_ID(childInterface.id) == childInterface.id) {
  6767. boxHeight += canDrawPercent ? 11 : 0;
  6768. } else {
  6769. boxHeight += - 2;
  6770. canDrawPercent = false;
  6771. }
  6772. if(GameFrame.getScreenMode() == ScreenMode.FIXED) {
  6773. if (xPos < childX + 5) {
  6774. xPos = childX + 5;
  6775. }
  6776. if (xPos + boxWidth > interfaceX + class9.width) {
  6777. xPos = (interfaceX + class9.width) - boxWidth;
  6778. }
  6779. if (yPos + boxHeight > interfaceY + class9.height) {
  6780. yPos = (childY - boxHeight);
  6781. }
  6782. if (Skills.SKILL_ID(childInterface.id) == childInterface.id && xPos + boxWidth + interfaceX + class9.width > 765) {
  6783. xPos = 765 - boxWidth - interfaceX - class9.width - 3;
  6784. }
  6785. if (Skills.SKILL_ID(childInterface.id) == childInterface.id && yPos + boxHeight > 503 - yPos + boxHeight - 118) {
  6786. yPos -= boxHeight + 35;
  6787. }
  6788. } else {
  6789. if (xPos < childX + 5) {
  6790. xPos = childX + 5;
  6791. }
  6792. if(xPos > 1560 && xPos < 1600) {
  6793. xPos -= 40;
  6794. } else if(xPos >= 1600) {
  6795. xPos -= 90;
  6796. }
  6797. }
  6798. DrawingArea.drawPixels(boxHeight, yPos, xPos, 0xFFFFA0, boxWidth);
  6799. if (canDrawPercent && currentExp[skillIdForButton(childInterface.id)] < 1000000000 && Skills.goalData[skillIdForButton(childInterface.id)][0] != -1 && Skills.goalData[skillIdForButton(childInterface.id)][1] != -1 && Skills.goalData[skillIdForButton(childInterface.id)][2] != -1) {
  6800. int goalPercentage = Skills.goalData[skillIdForButton(childInterface.id)][2];
  6801. DrawingArea.fillPixels(xPos + 4, boxWidth - 7, 12, 0, yPos + boxHeight - 14);
  6802. DrawingArea.drawPixels(10, yPos + boxHeight - 13, 4 + xPos + 1, Color.RED.getRGB(), boxWidth - 9);
  6803. DrawingArea.drawPixels(10, yPos + boxHeight - 13, 4 + xPos + 1, Color.GREEN.getRGB(), (int) ((boxWidth - 7) * .01 * goalPercentage) - 2);
  6804. if (goalPercentage == 100) {
  6805. smallText.drawText(0, "Goal Completed!", yPos - 3 + boxHeight, (int) (xPos + (boxWidth - 7 - (textDrawingArea_2.getTextWidth("Goal Completed!") + 10)) / 2.0 + 54));
  6806. } else {
  6807. smallText.drawText(0, goalPercentage + "%", yPos - 3 + boxHeight, (int) (xPos + (boxWidth - 6 - (textDrawingArea_2.getTextWidth(goalPercentage + "%") + 10)) / 2.0 + 24));
  6808. }
  6809. }
  6810. DrawingArea.fillPixels(xPos, boxWidth, boxHeight, 0, yPos);
  6811. String s2 = childInterface.message;
  6812. for (int j11 = yPos + textDrawingArea_2.anInt1497 + 2; s2
  6813. .length() > 0; j11 += textDrawingArea_2.anInt1497 + 1) {
  6814. int l11 = s2.indexOf("\\n");
  6815. String s5;
  6816. if (l11 != -1) {
  6817. s5 = s2.substring(0, l11);
  6818. s2 = s2.substring(l11 + 2);
  6819. } else {
  6820. s5 = s2;
  6821. s2 = "";
  6822. }
  6823. textDrawingArea_2.drawRegularText(false, xPos + 3, 0,
  6824. s5, j11);
  6825. }
  6826. } else if (childInterface.type == 12) {
  6827. //if (interfaceIsSelected(childInterface)) {
  6828. // } else {
  6829. try {
  6830. drawHoverBox(childX, childY, childInterface.message);
  6831. } catch (Exception e) {
  6832. e.printStackTrace();
  6833. }
  6834. /// }
  6835. } else if(childInterface.type == 13) {
  6836. Sprite sprite;
  6837. if (interfaceIsSelected(childInterface)) {
  6838. sprite = childInterface.sprite2;
  6839. } else {
  6840. sprite = childInterface.sprite1;
  6841. }
  6842. if (sprite != null) {
  6843. if(childInterface.opacity > 0)
  6844. sprite.drawTransparentSprite(childX, childY, childInterface.opacity);
  6845. else
  6846. sprite.drawSprite(childX, childY);
  6847. }
  6848. }
  6849. }
  6850. }
  6851. DrawingArea.setBounds(i1, j1, k1, l1);
  6852. }
  6853.  
  6854. public void drawOnBankInterface()
  6855. {
  6856. if(openInterfaceID == 5292 && RSInterface.interfaceCache[27000].message.equals("1"))
  6857. {
  6858. int i = Integer.parseInt(RSInterface.interfaceCache[27001].message);
  6859. int j = Integer.parseInt(RSInterface.interfaceCache[27002].message);
  6860. for(int k = 0; k <= i; k++)
  6861. {
  6862. RSInterface.interfaceCache[27014 + k].sprite1 = cacheSprite[1009];
  6863. RSInterface.interfaceCache[27014 + k].message = (new StringBuilder()).append("Click here to select tab ").append(k + 1).toString();
  6864. }
  6865.  
  6866. for(int l = i + 1; l <= 8; l++)
  6867. {
  6868. RSInterface.interfaceCache[27014+ l].sprite1 = null;
  6869. RSInterface.interfaceCache[27014 + l].message = "";
  6870. }
  6871.  
  6872. if(i != 8)
  6873. {
  6874. RSInterface.interfaceCache[27015 + i].sprite1 = cacheSprite[1010];
  6875. RSInterface.interfaceCache[27015 + i].message = "Drag an item here to create a new tab";
  6876. }
  6877. if(j == -1)
  6878. {
  6879. RSInterface.interfaceCache[27013].sprite1 = cacheSprite[1011];
  6880. } else
  6881. if(j > 0)
  6882. {
  6883. RSInterface.interfaceCache[27014 + j].sprite1 = cacheSprite[1012];
  6884. RSInterface.interfaceCache[27014].sprite1 = cacheSprite[1011];
  6885. } else
  6886. {
  6887. RSInterface.interfaceCache[27014].sprite1 = cacheSprite[1008];
  6888. }
  6889. RSInterface.interfaceCache[27000].message = "0";
  6890. }
  6891. }
  6892.  
  6893. private int loadingPercentage;
  6894. private BufferedImage[] loadingImages;
  6895.  
  6896. public void displayLoadingScreen() {
  6897.  
  6898. if(loadingImages[0] == null
  6899. || loadingImages[1] == null
  6900. || loadingImages[2] == null
  6901. || loadingImages[3] == null) {
  6902. return;
  6903. }
  6904.  
  6905. super.graphics.drawImage(loadingImages[0], 0, 0, null);
  6906. super.graphics.drawImage(loadingImages[1], 80, 443, null);
  6907. if(loadingPercentage > 0) {
  6908. int scaleX = (loadingPercentage * 790 / 560) * 4;
  6909. if(scaleX > 559) {
  6910. scaleX = 559;
  6911. }
  6912.  
  6913. super.graphics.drawImage(loadingImages[3], 72+scaleX, 410, null);
  6914. super.graphics.setFont(new Font("Serif", Font.BOLD, 16));
  6915.  
  6916. int drawTextX = 80+scaleX;
  6917. if(loadingPercentage < 10) {
  6918. drawTextX += 4;
  6919. } else if(loadingPercentage == 100) {
  6920. drawTextX -= 4;
  6921. }
  6922.  
  6923. super.graphics.drawString(""+loadingPercentage+"", drawTextX, 432);
  6924.  
  6925. super.graphics.drawImage(loadingImages[2].getSubimage(0, 0, scaleX, 32), 89, 453, null);
  6926. // super.graphics.drawImage(loadingImages[4], 18+scaleX, 453, null);
  6927. }
  6928. }
  6929.  
  6930. public int skillIdForButton(int buttonId) {
  6931. int[] buttonIds = { 4040, 4076, 4112, 4046, 4082, 4118, 4052, 4088, 4124, 4058, 4094, 4130, 4064, 4100, 4136, 4070, 4106, 4142, 4160, 2832, 13917, 28173, 28174, 28175, 28176 };
  6932. int[] skillID = { 0, 3, 14, 2, 16, 13, 1, 15, 10, 4, 17, 7, 5, 12, 11, 6, 9, 8, 20, 18, 19, 21, 22, 23, 24, 25 };
  6933. for (int i = 0; i < buttonIds.length; i++) {
  6934. if (buttonIds[i] == buttonId) {
  6935. buttonId = i;
  6936. return skillID[buttonId];
  6937. }
  6938. }
  6939. return 0;
  6940. }
  6941.  
  6942. private int loginFade;
  6943. public boolean shiftLogin;
  6944. public int duelStatus;
  6945. private boolean resizing;
  6946. public final int REGULAR_WIDTH = 765, REGULAR_HEIGHT = 503,
  6947. RESIZABLE_WIDTH = 800, RESIZABLE_HEIGHT = 600;
  6948. public int gameScreenDrawX = 4, gameScreenDrawY = 4;
  6949.  
  6950. public void recreateClientFrame(boolean undecorative, int width, int height, boolean resizable, int displayMode, boolean toggle) {
  6951. recreateClientFrame(undecorative, width, height, resizable);
  6952. }
  6953.  
  6954. boolean loginHover;
  6955. boolean rememberMeHover;
  6956. boolean textArea1Hover, textArea2Hover;
  6957. boolean backButtonHover;
  6958. boolean[] accountHovers = new boolean[5];
  6959. boolean[] accountDeletion = new boolean[5];
  6960.  
  6961. public void handleHovers(boolean alertScreen) {
  6962. int cursor = -1;
  6963. oldCursor = null;
  6964.  
  6965. loginHover = rememberMeHover = textArea1Hover = textArea2Hover = backButtonHover = false; //Reset hovers
  6966. for(int i = 0; i < accountHovers.length; i++) {
  6967. accountHovers[i] = false;
  6968. accountDeletion[i] = false;
  6969. }
  6970.  
  6971. if(!alertScreen) {
  6972.  
  6973. if(mouseX >= 402 && mouseX <= 491 && mouseY >= 304 && mouseY <= 334) {
  6974. cursor = Configuration.NEW_CURSORS ? 1061 : Cursor.HAND_CURSOR;
  6975. loginHover = true;
  6976. }
  6977.  
  6978. if(mouseX >= 367 && mouseX <= 379 && mouseY >= 310 && mouseY <= 325) {
  6979. cursor = Configuration.NEW_CURSORS ? 1061 : Cursor.HAND_CURSOR;
  6980. rememberMeHover = true;
  6981. }
  6982.  
  6983. if(mouseX >= 277 && mouseX <= 491) {
  6984. if(mouseY >= 223 && mouseY <= 253) {
  6985. cursor = Cursor.TEXT_CURSOR;
  6986. textArea1Hover = true;
  6987. } else if(mouseY >= 265 && mouseY <= 293) {
  6988. cursor = Cursor.TEXT_CURSOR;
  6989. textArea2Hover = true;
  6990. }
  6991. }
  6992.  
  6993. if(mouseX >= 205 && mouseX <= 565) {
  6994. if(mouseY >= 434) {
  6995. accountHovers[0] = mouseX >= 206 + offsetX && mouseX <= 271;
  6996. accountHovers[1] = mouseX >= 280 + offsetX && mouseX <= 342;
  6997. accountHovers[2] = mouseX >= 352 + offsetX && mouseX <= 414;
  6998. accountHovers[3] = mouseX >= 432 + offsetX && mouseX <= 474;
  6999. accountHovers[4] = mouseX >= 495 + offsetX && mouseX <= 557;
  7000. accountDeletion[0] = mouseX >= 247 && mouseX <= 268 && mouseY <= 453;
  7001. accountDeletion[1] = mouseX >= 318 && mouseX <= 340 && mouseY <= 453;
  7002. accountDeletion[2] = mouseX >= 390 && mouseX <= 411 && mouseY <= 453;
  7003. accountDeletion[3] = mouseX >= 464 && mouseX <= 490 && mouseY <= 453;
  7004. accountDeletion[4] = mouseX >= 537 && mouseX <= 563 && mouseY <= 453;
  7005.  
  7006. for(int i = 0; i < accountHovers.length; i++) {
  7007. if(accountHovers[i] || accountDeletion[i]) {
  7008. cursor = Configuration.NEW_CURSORS ? 1061 : Cursor.HAND_CURSOR;
  7009. break;
  7010. }
  7011. }
  7012. }
  7013. }
  7014. } else {
  7015. if(mouseX >= 338 && mouseX <= 430 && mouseY >= 297 && mouseY <= 325) {
  7016. cursor = Configuration.NEW_CURSORS ? 1061 : Cursor.HAND_CURSOR;
  7017. backButtonHover = true;
  7018. }
  7019. }
  7020.  
  7021. if(cursor == Cursor.HAND_CURSOR || cursor == Cursor.TEXT_CURSOR) {
  7022. getGameComponent().setCursor(new Cursor(cursor));
  7023. } else if(cursor == 1061) {
  7024. super.setCursor(CursorData.CURSOR_55);
  7025. } else {
  7026. if(Configuration.NEW_CURSORS) {
  7027. super.setCursor(CursorData.CURSOR_0);
  7028. } else {
  7029. getGameComponent().setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
  7030. }
  7031. }
  7032. }
  7033.  
  7034. public void drawLoginScreen(boolean flag) {
  7035. resetImageProducers();
  7036. titleScreenIP.initDrawingArea();
  7037. DrawingArea.drawFilledPixels(0, 0, getScreenWidth(), getScreenHeight(), 0x000000);
  7038. int centerX = getScreenWidth() / 2;
  7039. int centerY = getScreenHeight() / 2;
  7040. // titleAlpha = 0;
  7041. titleAlpha += titleAlpha < 250 ? 8 : 0;
  7042. if (Configuration.DISPLAY_GAMEWORLD_ON_LOGIN) {
  7043. drawAnimatedWorldBackground(true);
  7044. } else {
  7045. if (titleAlpha < 250) {
  7046. cacheSprite[449].drawTransparentSprite(centerX - cacheSprite[449].myWidth / 2, centerY - cacheSprite[449].myHeight / 2, titleAlpha);
  7047. } else {
  7048. if(loginMessage1.isEmpty() && loginMessage2.isEmpty()) {
  7049. handleHovers(false);
  7050. cacheSprite[449].drawAdvancedSprite(0, 0);
  7051. //cacheSprite[1177].drawAdvancedSprite(310, 115);
  7052.  
  7053. if(loginHover) {
  7054. cacheSprite[1174].drawAdvancedSprite(403, 302);
  7055. }
  7056. if(textArea1Hover) {
  7057. cacheSprite[1175].drawAdvancedSprite(275, 222);
  7058. } else if(textArea2Hover) {
  7059. cacheSprite[1175].drawAdvancedSprite(275, 263);
  7060. }
  7061. if(Configuration.SAVE_ACCOUNTS) {
  7062. cacheSprite[1176].drawAdvancedSprite(367, 308);
  7063. }
  7064.  
  7065. if(loginScreenCursorPos == 0 && loopCycle % 45 < 10) {
  7066. chatTextDrawingArea.drawRegularText(true, 280, 16777215, myUsername + "|", 242);
  7067. } else {
  7068. chatTextDrawingArea.drawRegularText(true, 280, 16777215, myUsername, 242);
  7069. }
  7070.  
  7071. if(loginScreenCursorPos == 1 && loopCycle % 45 < 10) {
  7072. chatTextDrawingArea.drawRegularText(true, 280, 16777215, getStars(password)+"|", 285);
  7073. } else {
  7074. chatTextDrawingArea.drawRegularText(true, 280, 16777215, getStars(password), 285);
  7075. }
  7076.  
  7077. int drawAccountX = 221;
  7078. int drawAcountDeletionX = 254;
  7079.  
  7080. for(int i = 0; i < accountHovers.length; i++) {
  7081. Account account = accountManager.getAccounts()[i];
  7082. if(account == null) {
  7083. if(accountDeletion[i]) {
  7084. cacheSprite[1180].drawAdvancedSprite(drawAcountDeletionX, 434);
  7085. cacheSprite[1178].drawAdvancedSprite(drawAccountX, 450);
  7086. } else {
  7087. if(accountHovers[i]) {
  7088. cacheSprite[1179].drawAdvancedSprite(drawAccountX, 450);
  7089. } else {
  7090. cacheSprite[1178].drawAdvancedSprite(drawAccountX, 450);
  7091. }
  7092. }
  7093. } else {
  7094. //drawInterface(0, 0, RSInterface.interfaceCache[31000], 6);
  7095. //handleAccountHeadRotation();
  7096. //processInterfaceAnimation(1, 31000);
  7097. if(account.getHelmet() > 0) {
  7098. Sprite s = ItemDefinition.getSprite(account.getHelmet(), 0, 4, 110);
  7099. if(s != null) {
  7100. s.drawSprite(drawAccountX, 450);
  7101. }
  7102. }
  7103. }
  7104. drawAcountDeletionX += 72;
  7105. drawAccountX += (i == 2 ? 73 : 72);
  7106. }
  7107.  
  7108. } else {
  7109. handleHovers(true);
  7110. cacheSprite[1183].drawAdvancedSprite(0, 0);
  7111. cacheSprite[1181].drawAdvancedSprite(215, 150);
  7112. chatTextDrawingArea.drawRegularText(true, 240, 16777215, loginMessage1, 242);
  7113. chatTextDrawingArea.drawRegularText(true, 240, 16777215, loginMessage2, 262);
  7114. }
  7115. //normalText.drawText(0xffffff, "MouseX: "+mouseX+", MouseY: "+mouseY, 80, 200);
  7116. }
  7117. }
  7118.  
  7119. if (!resizing) {
  7120. titleScreenIP.drawGraphics(0, super.graphics, 0);
  7121. }
  7122. if (welcomeScreenRaised) {
  7123. welcomeScreenRaised = false;
  7124. }
  7125. }
  7126.  
  7127. public int getXTextOffset(int index) {
  7128. switch(index) {
  7129. case 1:
  7130. return 280;
  7131. case 2:
  7132. return 351;
  7133. case 3:
  7134. return 427;
  7135. case 4:
  7136. return 495;
  7137. }
  7138. return 206;
  7139. }
  7140.  
  7141. private void handleAccountHeadRotation() {
  7142. for (int i = 0; i < accountManager.getAccounts().length; i++) {
  7143. RSInterface rsi = RSInterface.interfaceCache[31001 + i];
  7144. if(rsi == null)
  7145. continue;
  7146. int x = RSInterface.interfaceCache[31000].childX[i];
  7147. int y = RSInterface.interfaceCache[31000].childY[i];
  7148. int diffX = mouseX - x;
  7149. int diffY = y - mouseY;
  7150. if(mouseX <= 0 && mouseY <= 0)
  7151. return;
  7152. if(diffY <= -100)
  7153. diffY = -100;
  7154. if(diffY >= 100)
  7155. diffY = 100;
  7156. if (diffX < 0)
  7157. diffX = (-diffX);
  7158. else
  7159. diffX = 2000 - diffX;
  7160. if (diffY < 0)
  7161. diffY = (-diffY);
  7162. else
  7163. diffY = 2000-diffY;
  7164.  
  7165. if (diffX >= 2000)
  7166. diffX = 2000;
  7167. if (diffX <= 0)
  7168. diffX = 0;
  7169.  
  7170. if(diffY >= 2000)
  7171. diffY = 2000;
  7172. if(diffY <= 0)
  7173. diffY = 0;
  7174. rsi.modelRotation2 = diffX;
  7175. rsi.modelRotation1 = diffY;
  7176. }
  7177. }
  7178.  
  7179. public static String optimizeText(String s) {
  7180. for (int i = 0; i < s.length(); i++) {
  7181. if (i == 0) {
  7182. s = String.format("%s%s", Character.toUpperCase(s.charAt(0)),
  7183. s.substring(1));
  7184. }
  7185. if (!Character.isLetterOrDigit(s.charAt(i))) {
  7186. if (i + 1 < s.length()) {
  7187. s = String.format("%s%s%s", s.subSequence(0, i + 1),
  7188. Character.toUpperCase(s.charAt(i + 1)),
  7189. s.substring(i + 2));
  7190. }
  7191. }
  7192. }
  7193. return s.replace("_", " ");
  7194. }
  7195.  
  7196. public static String capitalizeFirstChar(String s) {
  7197. try {
  7198. if (s != "")
  7199. return (s.substring(0, 1).toUpperCase() + s.substring(1)
  7200. .toLowerCase()).trim();
  7201. } catch (Exception e) {
  7202. }
  7203. return s;
  7204. }
  7205.  
  7206. public static String getStars(String s) {
  7207. StringBuffer stars = new StringBuffer();
  7208. for(int i = 0; i < s.length(); i++)
  7209. stars.append("*");
  7210. return stars.toString();
  7211. }
  7212.  
  7213. private void drawLogo() {
  7214. resetImageProducers();
  7215. System.gc();
  7216. }
  7217.  
  7218. public void drawMenu() {
  7219. int xPos = menuOffsetX;
  7220. int yPos = menuOffsetY;
  7221. int menuW = menuWidth;
  7222. int x = super.mouseX;
  7223. int y = super.mouseY;
  7224. int menuH = menuHeight + 1;
  7225. if (menuScreenArea == 1 && GameFrame.getScreenMode() != ScreenMode.FIXED) {
  7226. xPos += 519;// +extraWidth;
  7227. yPos += 168;// +extraHeight;
  7228. }
  7229. if (menuScreenArea == 2 && GameFrame.getScreenMode() != ScreenMode.FIXED) {
  7230. yPos += 338;
  7231. }
  7232. if (menuScreenArea == 3 && GameFrame.getScreenMode() != ScreenMode.FIXED) {
  7233. xPos += 515;
  7234. yPos += 0;
  7235. }
  7236. if (menuScreenArea == 0) {
  7237. x -= 4;
  7238. y -= 4;
  7239. }
  7240. if (menuScreenArea == 1) {
  7241. if (!(GameFrame.getScreenMode() != ScreenMode.FIXED)) {
  7242. x -= 519;
  7243. y -= 168;
  7244. }
  7245. }
  7246. if (menuScreenArea == 2) {
  7247. if (!(GameFrame.getScreenMode() != ScreenMode.FIXED)) {
  7248. x -= 17;
  7249. y -= 338;
  7250. }
  7251. }
  7252. if (menuScreenArea == 3 && !(GameFrame.getScreenMode() != ScreenMode.FIXED)) {
  7253. x -= 515;
  7254. y -= 0;
  7255. }
  7256. DrawingArea.drawPixels(menuH - 4, yPos + 2, xPos, 0x706a5e, menuW);
  7257. DrawingArea.drawPixels(menuH - 2, yPos + 1, xPos + 1, 0x706a5e, menuW - 2);
  7258. DrawingArea.drawPixels(menuH, yPos, xPos + 2, 0x706a5e, menuW - 4);
  7259. DrawingArea.drawPixels(menuH - 2, yPos + 1, xPos + 3, 0x2d2822, menuW - 6);
  7260. DrawingArea.drawPixels(menuH - 4, yPos + 2, xPos + 2, 0x2d2822, menuW - 4);
  7261. DrawingArea.drawPixels(menuH - 6, yPos + 3, xPos + 1, 0x2d2822, menuW - 2);
  7262. DrawingArea.drawPixels(menuH - 22, yPos + 19, xPos + 2, 0x524a3d, menuW - 4);
  7263. DrawingArea.drawPixels(menuH - 22, yPos + 20, xPos + 3, 0x524a3d, menuW - 6);
  7264. DrawingArea.drawPixels(menuH - 23, yPos + 20, xPos + 3, 0x2b271c, menuW - 6);
  7265. DrawingArea.fillPixels(xPos + 3, menuW - 6, 1, 0x2a291b, yPos + 2);
  7266. DrawingArea.fillPixels(xPos + 2, menuW - 4, 1, 0x2a261b, yPos + 3);
  7267. DrawingArea.fillPixels(xPos + 2, menuW - 4, 1, 0x252116, yPos + 4);
  7268. DrawingArea.fillPixels(xPos + 2, menuW - 4, 1, 0x211e15, yPos + 5);
  7269. DrawingArea.fillPixels(xPos + 2, menuW - 4, 1, 0x1e1b12, yPos + 6);
  7270. DrawingArea.fillPixels(xPos + 2, menuW - 4, 1, 0x1a170e, yPos + 7);
  7271. DrawingArea.fillPixels(xPos + 2, menuW - 4, 2, 0x15120b, yPos + 8);
  7272. DrawingArea.fillPixels(xPos + 2, menuW - 4, 1, 0x100d08, yPos + 10);
  7273. DrawingArea.fillPixels(xPos + 2, menuW - 4, 1, 0x090a04, yPos + 11);
  7274. DrawingArea.fillPixels(xPos + 2, menuW - 4, 1, 0x080703, yPos + 12);
  7275. DrawingArea.fillPixels(xPos + 2, menuW - 4, 1, 0x090a04, yPos + 13);
  7276. DrawingArea.fillPixels(xPos + 2, menuW - 4, 1, 0x070802, yPos + 14);
  7277. DrawingArea.fillPixels(xPos + 2, menuW - 4, 1, 0x090a04, yPos + 15);
  7278. DrawingArea.fillPixels(xPos + 2, menuW - 4, 1, 0x070802, yPos + 16);
  7279. DrawingArea.fillPixels(xPos + 2, menuW - 4, 1, 0x090a04, yPos + 17);
  7280. DrawingArea.fillPixels(xPos + 2, menuW - 4, 1, 0x2a291b, yPos + 18);
  7281. DrawingArea.fillPixels(xPos + 3, menuW - 6, 1, 0x564943, yPos + 19);
  7282. newBoldFont.drawBasicString("Choose Option", xPos + 3, yPos + 14, 0xc6b895, 0, true);
  7283. int beforeX = xPos;
  7284. for (int index = 0; index < menuActionRow; index++) {
  7285. int yOffset = yPos + 31 + (menuActionRow - 1 - index) * 15;
  7286. int color = 0xffffff;
  7287. if (x > xPos && x < xPos + menuW && y > yOffset - 11 && y < yOffset + 5) {
  7288. DrawingArea.drawPixels(15, yOffset - 11, xPos + 3, 0x6f695d, menuWidth - 6);
  7289. detectCursor(menuActionName[index]);
  7290. color = 0xffff00;
  7291. currentActionMenu = index;
  7292. }
  7293. xPos += 3;
  7294. newBoldFont.drawBasicString(menuActionName[index], xPos, yOffset, color, 0, true);
  7295. xPos = beforeX;
  7296. }
  7297. }
  7298.  
  7299. public void detectCursor(String tooltip) {
  7300. if(!Configuration.NEW_CURSORS)
  7301. return;
  7302. if(tooltip == null || tooltip.isEmpty())
  7303. return;
  7304. CursorData newCursor = null;
  7305. tooltip = tooltip.replaceAll("@gre@", "");
  7306. tooltip = tooltip.replaceAll("@yel@", "");
  7307. for(CursorData cursorData : CursorData.values()) {
  7308. if(tooltip.startsWith(cursorData.tooltip)) {
  7309. newCursor = cursorData;
  7310. break;
  7311. }
  7312. }
  7313. if(newCursor == null) {
  7314. newCursor = CursorData.CURSOR_0;
  7315. }
  7316. super.setCursor(newCursor);
  7317. }
  7318.  
  7319. public CursorData oldCursor;
  7320.  
  7321. private void drawMinimap() {
  7322. mapArea.setxPos(GameFrame.getScreenMode() == ScreenMode.FIXED ? 519 : getScreenWidth() - 170);
  7323. mapArea.setyPos(GameFrame.getScreenMode() == ScreenMode.FIXED ? 0 : 1);
  7324. mapArea.render(this);
  7325. }
  7326.  
  7327. public void drawMinimapFlag(Sprite sprite, int j, int k) {
  7328. int l = k * k + j * j;
  7329. if (l > 4225 && l < 0x15f90) {
  7330. int i1 = viewRotation + minimapRotation & 0x7ff;
  7331. int j1 = Model.SINE[i1];
  7332. int k1 = Model.COSINE[i1];
  7333. j1 = j1 * 256 / (minimapZoom + 256);
  7334. k1 = k1 * 256 / (minimapZoom + 256);
  7335. int l1 = j * j1 + k * k1 >> 16;
  7336. int i2 = j * k1 - k * j1 >> 16;
  7337. double d = Math.atan2(l1, i2);
  7338. int j2 = (int) (Math.sin(d) * 63D);
  7339. int k2 = (int) (Math.cos(d) * 57D);
  7340. mapEdge.rotate(83 - k2 - 20, d, 94 + j2 + 4 - 10);
  7341. } else {
  7342. markMinimap(sprite, k, j);
  7343. }
  7344. }
  7345.  
  7346. public void drawScrollbar(int barHeight, int scrollPos, int yPos, int xPos, int contentHeight, boolean newScroller, boolean isTransparent) {
  7347. int backingAmount = (barHeight - 32) / 5;
  7348. int scrollPartHeight = (barHeight - 32) * barHeight / contentHeight;
  7349. int scrollerID;
  7350. if (newScroller) {
  7351. scrollerID = 4;
  7352. } else if (isTransparent) {
  7353. scrollerID = 8;
  7354. } else {
  7355. scrollerID = 0;
  7356. }
  7357. if (scrollPartHeight < 10) {
  7358. scrollPartHeight = 10;
  7359. }
  7360. int scrollPartAmount = scrollPartHeight / 5 - 2;
  7361. int scrollPartPos = (barHeight - 32 - scrollPartHeight) * scrollPos / (contentHeight - barHeight) + 16 + yPos;
  7362. /* Bar fill */
  7363. for (int i = 0, yyPos = yPos + 16; i <= backingAmount; i++, yyPos += 5) {
  7364. scrollPart[scrollerID + 1].drawSprite(xPos, yyPos);
  7365. }
  7366. /* Top of bar */
  7367. scrollPart[scrollerID + 2].drawSprite(xPos, scrollPartPos);
  7368. scrollPartPos += 5;
  7369. /* Middle of bar */
  7370. for (int i = 0; i <= scrollPartAmount; i++) {
  7371. scrollPart[scrollerID + 3].drawSprite(xPos, scrollPartPos);
  7372. scrollPartPos += 5;
  7373. }
  7374. scrollPartPos = (barHeight - 32 - scrollPartHeight) * scrollPos / (contentHeight - barHeight) + 16 + yPos + scrollPartHeight - 5;
  7375. /* Bottom of bar */
  7376. scrollPart[scrollerID].drawSprite(xPos, scrollPartPos);
  7377. /* Arrows */
  7378. if (newScroller) {
  7379. scrollBar[2].drawSprite(xPos, yPos);
  7380. scrollBar[3].drawSprite(xPos, yPos + barHeight - 16);
  7381. } else if (isTransparent) {
  7382. scrollBar[4].drawSprite(xPos, yPos);
  7383. scrollBar[5].drawSprite(xPos, yPos + barHeight - 16);
  7384. } else {
  7385. scrollBar[0].drawSprite(xPos, yPos);
  7386. scrollBar[1].drawSprite(xPos, yPos + barHeight - 16);
  7387. }
  7388. }
  7389.  
  7390. private void drawSplitPrivateChat() {
  7391. if (splitPrivateChat == 0) {
  7392. return;
  7393. }
  7394. TextDrawingArea textDrawingArea = normalText;
  7395. int messages = 0;
  7396. if (systemUpdateTimer != 0) {
  7397. messages = 1;
  7398. }
  7399. for (int index = 0; index < 100; index++) {
  7400. if (chatMessages[index] != null) {
  7401. int type = chatTypes[index];
  7402. String name = chatNames[index];
  7403. String prefixName = name;
  7404. int rights = 0;
  7405. if (name != null) {
  7406. if (name.indexOf("@") == 0) {
  7407. int prefixSubstring = getPrefixSubstringLength(name);
  7408. name = name.substring(prefixSubstring);
  7409. }
  7410. }
  7411.  
  7412. int paddingY = GameFrame.getScreenMode() == ScreenMode.FIXED ? 0 : getScreenHeight() - 500;
  7413.  
  7414. if ((type == 3 || type == 7) && (type == 7 || privateChatMode == 0 || privateChatMode == 1 && isFriendOrSelf(name))) {
  7415. int yOffset = 329 + paddingY - messages * 13;
  7416. int xOffset = 4;
  7417. textDrawingArea.method385(0, "From", yOffset, xOffset);
  7418. textDrawingArea.method385(ChatArea.SPLIT_CHAT_COLORS[splitChatColor], "From", yOffset - 1, xOffset);
  7419. xOffset += textDrawingArea.getTextWidth("From ");
  7420.  
  7421. if (prefixName != null && prefixName.indexOf("@") == 0) {
  7422. int substringLength = Client.getClient().getPrefixSubstringLength(prefixName);
  7423. rights = Client.getClient().getPrefixRights(prefixName.substring(0, prefixName.indexOf(name)), new Boolean(substringLength == 6));
  7424. }
  7425.  
  7426. if (rights != 0) {
  7427. modIcons[rights].drawTransparentSprite(xOffset, yOffset - 12, 255);
  7428. xOffset += modIcons[rights].maxWidth + 2;
  7429. }
  7430.  
  7431. textDrawingArea.method385(0, name + ": " + chatMessages[index], yOffset, xOffset);
  7432. textDrawingArea.method385(ChatArea.SPLIT_CHAT_COLORS[splitChatColor], name + ": " + chatMessages[index], yOffset - 1, xOffset);
  7433.  
  7434. if (++messages >= 5) {
  7435. return;
  7436. }
  7437. }
  7438.  
  7439. if (type == 5 && privateChatMode < 2) {
  7440. int yOffset = 329 + paddingY - messages * 13;
  7441. textDrawingArea.method385(0, chatMessages[index], yOffset, 4);
  7442. textDrawingArea.method385(ChatArea.SPLIT_CHAT_COLORS[splitChatColor], chatMessages[index], yOffset - 1, 4);
  7443.  
  7444. if (++messages >= 5) {
  7445. return;
  7446. }
  7447. }
  7448.  
  7449. if (type == 6 && privateChatMode < 2) {
  7450. int yOffset = 329 + paddingY - messages * 13;
  7451. int xOffset = 4;
  7452. textDrawingArea.method385(0, "To", yOffset, xOffset);
  7453. textDrawingArea.method385(ChatArea.SPLIT_CHAT_COLORS[splitChatColor], "To", yOffset - 1, xOffset);
  7454. xOffset += textDrawingArea.getTextWidth("To ");
  7455.  
  7456. if (rights != 0) {
  7457. modIcons[rights].drawTransparentSprite(xOffset, yOffset - 12, 255);
  7458. xOffset += 12;
  7459. }
  7460.  
  7461. textDrawingArea.method385(0, name + ": " + chatMessages[index], yOffset, xOffset);
  7462. textDrawingArea.method385(ChatArea.SPLIT_CHAT_COLORS[splitChatColor], name + ": " + chatMessages[index], yOffset - 1, xOffset);
  7463.  
  7464. if (++messages >= 5) {
  7465. return;
  7466. }
  7467. }
  7468. }
  7469. }
  7470. }
  7471.  
  7472. public void updateBankInterface() {
  7473. int tabAmount = settings[2000] & 0xFF;
  7474. int activeTab = settings[2000] >> 8 & 0xFF;
  7475. Sprite activeTabSprite = cacheSprite[617];
  7476. Sprite tabSprite = cacheSprite[613];
  7477. Sprite newTabSprite = cacheSprite[614];
  7478. Sprite emptySprite = new Sprite(0, 0);
  7479. for (int i = 0; i < 9; i++) {
  7480. if (i < tabAmount) {
  7481. RSInterface.interfaceCache[41018 + i].sprite1 = tabSprite;
  7482. RSInterface.interfaceCache[41018 + i].tooltip = "Click here to select tab " + (i + 1);
  7483. } else {
  7484. RSInterface.interfaceCache[41018 + i].sprite1 = emptySprite;
  7485. RSInterface.interfaceCache[41018 + i].tooltip = "";
  7486. }
  7487. RSInterface.interfaceCache[41027 + i].inv[0] = -1;
  7488. RSInterface.interfaceCache[41027 + i].invStackSizes[0] = 0;
  7489. }
  7490. if (tabAmount < 9) {
  7491. RSInterface.interfaceCache[41018 + tabAmount].sprite1 = newTabSprite;
  7492. RSInterface.interfaceCache[41018 + tabAmount].tooltip = "Drag an item here to create a new tab";
  7493. }
  7494. RSInterface.interfaceCache[41018 + activeTab].sprite1 = activeTabSprite;
  7495.  
  7496. }
  7497.  
  7498. public void processBankInterface() {
  7499. if(openInterfaceID != 5292)
  7500. return;
  7501. boolean fixed = GameFrame.getScreenMode() == ScreenMode.FIXED;
  7502. int offsetX = fixed ? 0 : (getScreenWidth() - 765) / 2;
  7503. int offsetY = fixed ? 0 : (getScreenHeight() - 503) / 2;
  7504. int[] offsets = { 74, 121, 168, 215, 262, 309, 356, 403, 450 };
  7505. if (anInt1084 == 5382 && super.mouseY >= 40 + offsetY && super.mouseY <= 77 + offsetY) {
  7506. for (int i = 0; i < offsets.length; i++) {
  7507. if (super.mouseX < offsets[i] + offsetX) {
  7508. getOut().putOpcode(214);
  7509. getOut().writeSignedBigEndian(5383);
  7510. getOut().method424(0);
  7511. getOut().writeSignedBigEndian(anInt1085);
  7512. getOut().writeUnsignedWordBigEndian(i);
  7513. break;
  7514. }
  7515. }
  7516. }
  7517. }
  7518.  
  7519. private void drawTabArea() {
  7520. tabArea.setxPos(GameFrame.getScreenMode() == ScreenMode.FIXED ? 516 : getScreenWidth() - tabArea.getWidth() + 12);
  7521. tabArea.setyPos(GameFrame.getScreenMode() == ScreenMode.FIXED ? 168 : getScreenHeight() - tabArea.getHeight() + 2);
  7522. tabArea.render(this);
  7523. }
  7524.  
  7525. private void drawTooltip() {
  7526. // XXX: here tooltip
  7527. if (menuActionRow < 2 && itemSelected == 0 && spellSelected == 0) {
  7528. if(Configuration.NEW_CURSORS) {
  7529. super.setCursor(CursorData.CURSOR_0);
  7530. }
  7531. return;
  7532. }
  7533. String tooltip;
  7534. if (itemSelected == 1 && menuActionRow < 2) {
  7535. tooltip = "Use " + selectedItemName + " with...";
  7536. } else if (spellSelected == 1 && menuActionRow < 2) {
  7537. tooltip = spellTooltip + "...";
  7538. } else {
  7539. tooltip = menuActionName[menuActionRow - 1];
  7540. }
  7541. if (menuActionRow > 2) {
  7542. tooltip = tooltip + "@whi@ / " + (menuActionRow - 2) + " more options";
  7543. }
  7544. newBoldFont.drawBasicString(tooltip, 4, 15, 0xFFFFFF, 0, true);
  7545. // chatTextDrawingArea.method390(4, 0xffffff, tooltip, loopCycle / 1000,
  7546. // 15);
  7547. if(Configuration.NEW_CURSORS) {
  7548. detectCursor(menuActionName[menuActionRow - 1]);
  7549. }
  7550. }
  7551.  
  7552. private void dropClient() {
  7553. if (anInt1011 > 0) {
  7554. resetLogout();
  7555. return;
  7556. }
  7557. if (gameScreenIP != null) {
  7558. gameScreenIP.initDrawingArea();
  7559. }
  7560. //DrawingArea.fillPixels(2, 229, 39, 0xffffff, 2); // white box around
  7561. //DrawingArea.drawPixels(37, 3, 3, 0, 227); // black fill
  7562. //normalText.drawText(0, "Connection lost.", 19, 120);
  7563. //normalText.drawText(0xffffff, "Connection lost.", 18, 119);
  7564. //normalText.drawText(0, "Please wait - attempting to reestablish.", 34, 117);
  7565. //normalText.drawText(0xffffff, "Please wait - attempting to reestablish.", 34, 116);
  7566. cacheSprite[1106].drawSprite(7, 4);
  7567. if (!resizing && gameScreenIP != null) {
  7568. gameScreenIP.drawGraphics(gameScreenDrawY, super.graphics, gameScreenDrawX);
  7569. }
  7570. anInt1021 = 0;
  7571. destX = 0;
  7572. Connection rsSocket = getConnection();
  7573. loggedIn = false;
  7574. setLoginFailures(0);
  7575. login(getPassword(), true, myUsername, this);
  7576.  
  7577. if (!loggedIn) {
  7578. resetLogout();
  7579. }
  7580.  
  7581. try {
  7582. rsSocket.close();
  7583. } catch (Exception _ex) {
  7584. }
  7585. }
  7586.  
  7587. private int extractInterfaceValues(RSInterface class9, int j) {
  7588. if (class9.valueIndexArray == null || j >= class9.valueIndexArray.length) {
  7589. return -2;
  7590. }
  7591.  
  7592. try {
  7593. int[] ai = class9.valueIndexArray[j];
  7594. int k = 0;
  7595. int l = 0;
  7596. int i1 = 0;
  7597.  
  7598. do {
  7599. int j1 = ai[l++];
  7600. int k1 = 0;
  7601. byte byte0 = 0;
  7602. if (j1 == 0) {
  7603. return k;
  7604. }
  7605. if (j1 == 1) {
  7606. k1 = currentStats[ai[l++]];
  7607. }
  7608. if (j1 == 2) {
  7609. k1 = maxStats[ai[l++]];
  7610. }
  7611. if (j1 == 3) {
  7612. k1 = currentExp[ai[l++]];
  7613. }
  7614. if (j1 == 4) {
  7615. RSInterface class9_1 = RSInterface.interfaceCache[ai[l++]];
  7616. int k2 = ai[l++];
  7617. if (k2 >= 0 && k2 < ItemDefinition.totalItems && (!ItemDefinition.get(k2).membersObject || isMembers)) {
  7618. for (int j3 = 0; j3 < class9_1.inv.length; j3++) {
  7619. if (class9_1.inv[j3] == k2 + 1) {
  7620. k1 += class9_1.invStackSizes[j3];
  7621. }
  7622. }
  7623.  
  7624. }
  7625. }
  7626. if (j1 == 5) {
  7627. k1 = variousSettings[ai[l++]];
  7628. }
  7629. if (j1 == 6) {
  7630. k1 = anIntArray1019[maxStats[ai[l++]] - 1];
  7631. }
  7632. if (j1 == 7) {
  7633. k1 = variousSettings[ai[l++]] * 100 / 46875;
  7634. }
  7635. if (j1 == 8) {
  7636. k1 = myPlayer.combatLevel;
  7637. }
  7638. if (j1 == 9) {
  7639. for (int l1 = 0; l1 < Skills.SKILL_COUNT; l1++) {
  7640. if (Skills.SKILLS_ENABLED[l1]) {
  7641. k1 += maxStats[l1];
  7642. }
  7643. }
  7644.  
  7645. }
  7646. if (j1 == 10) {
  7647. RSInterface class9_2 = RSInterface.interfaceCache[ai[l++]];
  7648. int l2 = ai[l++] + 1;
  7649. if (l2 >= 0 && l2 < ItemDefinition.totalItems && (!ItemDefinition.get(l2).membersObject || isMembers)) {
  7650. for (int element : class9_2.inv) {
  7651. if (element != l2) {
  7652. continue;
  7653. }
  7654. k1 = 0x3b9ac9ff;
  7655. break;
  7656. }
  7657.  
  7658. }
  7659. }
  7660. if (j1 == 11) {
  7661. k1 = energy;
  7662. }
  7663. if (j1 == 12) {
  7664. k1 = weight;
  7665. }
  7666. if (j1 == 13) {
  7667. int i2 = variousSettings[ai[l++]];
  7668. int i3 = ai[l++];
  7669. k1 = (i2 & 1 << i3) == 0 ? 0 : 1;
  7670. }
  7671. if (j1 == 14) {
  7672. int j2 = ai[l++];
  7673. VarBit varBit = VarBit.cache[j2];
  7674. int l3 = varBit.configId;
  7675. int i4 = varBit.configValue;
  7676. int j4 = varBit.anInt650;
  7677. int k4 = anIntArray1232[j4 - i4];
  7678. k1 = variousSettings[l3] >> i4 & k4;
  7679. }
  7680. if (j1 == 15) {
  7681. byte0 = 1;
  7682. }
  7683. if (j1 == 16) {
  7684. byte0 = 2;
  7685. }
  7686. if (j1 == 17) {
  7687. byte0 = 3;
  7688. }
  7689. if (j1 == 18) {
  7690. k1 = (myPlayer.x >> 7) + baseX;
  7691. }
  7692. if (j1 == 19) {
  7693. k1 = (myPlayer.y >> 7) + baseY;
  7694. }
  7695. if (j1 == 20) {
  7696. k1 = ai[l++];
  7697. }
  7698. if (byte0 == 0) {
  7699. if (i1 == 0) {
  7700. k += k1;
  7701. }
  7702. if (i1 == 1) {
  7703. k -= k1;
  7704. }
  7705. if (i1 == 2 && k1 != 0) {
  7706. k /= k1;
  7707. }
  7708. if (i1 == 3) {
  7709. k *= k1;
  7710. }
  7711. i1 = 0;
  7712. } else {
  7713. i1 = byte0;
  7714. }
  7715. } while (true);
  7716. } catch (Exception _ex) {
  7717. return -1;
  7718. }
  7719. }
  7720.  
  7721. public void generateWorld(int x, int y) {
  7722. terrainRegionX = x;
  7723. terrainRegionY = y;
  7724. aBoolean1159 = false;
  7725. if (anInt1069 == x && anInt1070 == y && loadingStage == 2) {
  7726. return;
  7727. }
  7728. anInt1069 = x;
  7729. anInt1070 = y;
  7730. baseX = (anInt1069 - 6) * 8;
  7731. baseY = (anInt1070 - 6) * 8;
  7732. aBoolean1141 = (anInt1069 / 8 == 48 || anInt1069 / 8 == 49) && anInt1070 / 8 == 48;
  7733. if (anInt1069 / 8 == 48 && anInt1070 / 8 == 148) {
  7734. aBoolean1141 = true;
  7735. }
  7736. loadingStage = 1;
  7737. aLong824 = System.currentTimeMillis();
  7738. int k16 = 0;
  7739. for (int i21 = (anInt1069 - 6) / 8; i21 <= (anInt1069 + 6) / 8; i21++) {
  7740. for (int k23 = (anInt1070 - 6) / 8; k23 <= (anInt1070 + 6) / 8; k23++) {
  7741. k16++;
  7742. }
  7743. }
  7744. aByteArrayArray1183 = new byte[k16][];
  7745. aByteArrayArray1247 = new byte[k16][];
  7746. anIntArray1234 = new int[k16];
  7747. floorMap = new int[k16];
  7748. objectMap = new int[k16];
  7749. k16 = 0;
  7750. for (int l23 = (anInt1069 - 6) / 8; l23 <= (anInt1069 + 6) / 8; l23++) {
  7751. for (int j26 = (anInt1070 - 6) / 8; j26 <= (anInt1070 + 6) / 8; j26++) {
  7752. anIntArray1234[k16] = (l23 << 8) + j26;
  7753. if (aBoolean1141 && (j26 == 49 || j26 == 149 || j26 == 147 || l23 == 50 || l23 == 49 && j26 == 47)) {
  7754. floorMap[k16] = -1;
  7755. objectMap[k16] = -1;
  7756. k16++;
  7757. } else {
  7758. int k28 = floorMap[k16] = onDemandFetcher.getMapCount(0, j26, l23);
  7759. if (k28 != -1) {
  7760. onDemandFetcher.requestFileData(3, k28);
  7761. }
  7762. int j30 = objectMap[k16] = onDemandFetcher.getMapCount(1, j26, l23);
  7763. if (j30 != -1) {
  7764. onDemandFetcher.requestFileData(3, j30);
  7765. }
  7766. k16++;
  7767. }
  7768. }
  7769. }
  7770. int i17 = baseX - anInt1036;
  7771. int j21 = baseY - anInt1037;
  7772. anInt1036 = baseX;
  7773. anInt1037 = baseY;
  7774. for (int j24 = 0; j24 < 16384; j24++) {
  7775. NPC npc = npcArray[j24];
  7776. if (npc != null) {
  7777. for (int j29 = 0; j29 < 10; j29++) {
  7778. npc.smallX[j29] -= i17;
  7779. npc.smallY[j29] -= j21;
  7780. }
  7781. npc.x -= i17 * 128;
  7782. npc.y -= j21 * 128;
  7783. }
  7784. }
  7785. for (int i27 = 0; i27 < getMaxPlayers(); i27++) {
  7786. Player player = playerArray[i27];
  7787. if (player != null) {
  7788. for (int i31 = 0; i31 < 10; i31++) {
  7789. player.smallX[i31] -= i17;
  7790. player.smallY[i31] -= j21;
  7791. }
  7792. player.x -= i17 * 128;
  7793. player.y -= j21 * 128;
  7794. }
  7795. }
  7796. aBoolean1080 = true;
  7797. byte byte1 = 0;
  7798. byte byte2 = 104;
  7799. byte byte3 = 1;
  7800. if (i17 < 0) {
  7801. byte1 = 103;
  7802. byte2 = -1;
  7803. byte3 = -1;
  7804. }
  7805. byte byte4 = 0;
  7806. byte byte5 = 104;
  7807. byte byte6 = 1;
  7808. if (j21 < 0) {
  7809. byte4 = 103;
  7810. byte5 = -1;
  7811. byte6 = -1;
  7812. }
  7813. for (int k33 = byte1; k33 != byte2; k33 += byte3) {
  7814. for (int l33 = byte4; l33 != byte5; l33 += byte6) {
  7815. int i34 = k33 + i17;
  7816. int j34 = l33 + j21;
  7817. for (int k34 = 0; k34 < 4; k34++) {
  7818. if (i34 >= 0 && j34 >= 0 && i34 < 104 && j34 < 104) {
  7819. groundArray[k34][k33][l33] = groundArray[k34][i34][j34];
  7820. } else {
  7821. groundArray[k34][k33][l33] = null;
  7822. }
  7823. }
  7824. }
  7825. }
  7826. for (Class30_Sub1 class30_sub1_1 = (Class30_Sub1) getaClass19_1179().reverseGetFirst(); class30_sub1_1 != null; class30_sub1_1 = (Class30_Sub1) getaClass19_1179().reverseGetNext()) {
  7827. class30_sub1_1.anInt1297 -= i17;
  7828. class30_sub1_1.anInt1298 -= j21;
  7829. if (class30_sub1_1.anInt1297 < 0 || class30_sub1_1.anInt1298 < 0 || class30_sub1_1.anInt1297 >= 104 || class30_sub1_1.anInt1298 >= 104) {
  7830. class30_sub1_1.unlink();
  7831. }
  7832. }
  7833. if (destX != 0) {
  7834. destX -= i17;
  7835. destY -= j21;
  7836. }
  7837. cameraViewChanged = false;
  7838. }
  7839.  
  7840. @Override
  7841. public AppletContext getAppletContext() {
  7842. if (Signlink.mainapp != null) {
  7843. return Signlink.mainapp.getAppletContext();
  7844. } else {
  7845. return super.getAppletContext();
  7846. }
  7847. }
  7848.  
  7849. private Archive getArchive(int index, String fileName, String cacheArchive, int crc, int loadingBarValue) {
  7850. byte[] buffer = null;
  7851. int timeToWait = 5;
  7852.  
  7853. try {
  7854. if (decompressors[0] != null) {
  7855. buffer = decompressors[0].decompress(index);
  7856. }
  7857. } catch (Exception _ex) {
  7858. }
  7859.  
  7860. if (buffer != null) {
  7861. if (Configuration.JAGCACHED_ENABLED) {
  7862. crc32Instance.reset();
  7863. crc32Instance.update(buffer);
  7864. int crcValue = (int) crc32Instance.getValue();
  7865.  
  7866. if (crcValue != crc) {
  7867. buffer = null;
  7868. }
  7869. }
  7870. }
  7871.  
  7872. if (buffer != null) {
  7873. Archive streamLoader = new Archive(buffer);
  7874. return streamLoader;
  7875. }
  7876.  
  7877. int errorCount = 0;
  7878.  
  7879. while (buffer == null) {
  7880. String error = "Unknown error";
  7881. //drawSmoothLoading(loadingBarValue, "Requesting " + fileName);
  7882.  
  7883. try {
  7884. int lastPercentage = 0;
  7885. DataInputStream datainputstream = openJagGrabInputStream(cacheArchive + crc);
  7886. byte temp[] = new byte[6];
  7887. datainputstream.readFully(temp, 0, 6);
  7888. ByteBuffer stream = new ByteBuffer(temp);
  7889. stream.position = 3;
  7890. int totalLength = stream.getTribyte() + 6;
  7891. int currentLength = 6;
  7892. buffer = new byte[totalLength];
  7893. System.arraycopy(temp, 0, buffer, 0, 6);
  7894.  
  7895. while (currentLength < totalLength) {
  7896. int remainingAmount = totalLength - currentLength;
  7897.  
  7898. if (remainingAmount > 1000) {
  7899. remainingAmount = 1000;
  7900. }
  7901.  
  7902. int remaining = datainputstream.read(buffer, currentLength, remainingAmount);
  7903.  
  7904. if (remaining < 0) {
  7905. error = "Length error: " + currentLength + "/" + totalLength;
  7906. throw new IOException("EOF");
  7907. }
  7908.  
  7909. currentLength += remaining;
  7910. int percentage = currentLength * 100 / totalLength;
  7911.  
  7912. if (percentage != lastPercentage) {
  7913. //drawSmoothLoading(loadingBarValue, "Loading " + fileName + " - " + percentage + "%");
  7914. }
  7915.  
  7916. lastPercentage = percentage;
  7917. }
  7918.  
  7919. datainputstream.close();
  7920.  
  7921. try {
  7922. if (decompressors[0] != null) {
  7923. decompressors[0].method234(buffer.length, buffer, index);
  7924. }
  7925. } catch (Exception _ex) {
  7926. decompressors[0] = null;
  7927. }
  7928.  
  7929. if (buffer != null) {
  7930. if (Configuration.JAGCACHED_ENABLED) {
  7931. crc32Instance.reset();
  7932. crc32Instance.update(buffer);
  7933. int currentCrc = (int) crc32Instance.getValue();
  7934.  
  7935. if (currentCrc != crc) {
  7936. buffer = null;
  7937. errorCount++;
  7938. error = "Checksum error: " + currentCrc;
  7939. }
  7940. }
  7941. }
  7942. } catch (IOException ioexception) {
  7943. if (error.equals("Unknown error")) {
  7944. error = "Connection error";
  7945. }
  7946.  
  7947. buffer = null;
  7948. } catch (NullPointerException _ex) {
  7949. error = "Null error";
  7950. buffer = null;
  7951.  
  7952. if (!Signlink.reporterror) {
  7953. return null;
  7954. }
  7955. } catch (ArrayIndexOutOfBoundsException _ex) {
  7956. error = "Bounds error";
  7957. buffer = null;
  7958.  
  7959. if (!Signlink.reporterror) {
  7960. return null;
  7961. }
  7962. } catch (Exception _ex) {
  7963. error = "Unexpected error";
  7964. buffer = null;
  7965.  
  7966. if (!Signlink.reporterror) {
  7967. return null;
  7968. }
  7969. }
  7970. if (buffer == null) {
  7971. for (int seconds = timeToWait; seconds > 0; seconds--) {
  7972. if (errorCount >= 3) {
  7973. //drawSmoothLoading(loadingBarValue, "Game updated - please reload page");
  7974. seconds = 10;
  7975. } else {
  7976. throw new RuntimeException("Unable to find archive: " + name);
  7977. }
  7978.  
  7979. try {
  7980. Thread.sleep(1000L);
  7981. } catch (Exception _ex) {
  7982. }
  7983. }
  7984.  
  7985. timeToWait *= 2;
  7986.  
  7987. if (timeToWait > 60) {
  7988. timeToWait = 60;
  7989. }
  7990.  
  7991. httpFallback = !httpFallback;
  7992. }
  7993. }
  7994.  
  7995. Archive archive = new Archive(buffer);
  7996. return archive;
  7997. }
  7998.  
  7999. @Override
  8000. public URL getCodeBase() {
  8001. try {
  8002. return new URL(Configuration.SERVER_HOST + ":" + (80 + portOff));
  8003. } catch (Exception _ex) {
  8004. }
  8005. return null;
  8006. }
  8007.  
  8008. public String getDocumentBaseHost() {
  8009. return Signlink.mainapp != null ? Signlink.mainapp.getDocumentBase().getHost().toLowerCase() : "";
  8010. }
  8011.  
  8012. private int getExperienceForLevel(int level) {
  8013. int points = 0;
  8014. int output = 0;
  8015.  
  8016. for (int lvl = 1; lvl <= level; lvl++) {
  8017. points += Math.floor(lvl + 300.0 * Math.pow(2.0, lvl / 7.0));
  8018.  
  8019. if (lvl >= level) {
  8020. return output;
  8021. }
  8022.  
  8023. output = (int) Math.floor(points / 4);
  8024. }
  8025.  
  8026. return 0;
  8027. }
  8028.  
  8029. @Override
  8030. public Component getGameComponent() {
  8031. if (Signlink.mainapp != null) {
  8032. return Signlink.mainapp;
  8033. }
  8034. if (super.mainFrame != null) {
  8035. return super.mainFrame;
  8036. } else {
  8037. return this;
  8038. }
  8039. }
  8040.  
  8041. @Override
  8042. public String getParameter(String s) {
  8043. if (Signlink.mainapp != null) {
  8044. return Signlink.mainapp.getParameter(s);
  8045. } else {
  8046. return super.getParameter(s);
  8047. }
  8048. }
  8049.  
  8050. public String getPrayerBook() {
  8051. return tabInterfaceIDs[5] == 5608 ? "Prayers" : "Curses";
  8052. }
  8053.  
  8054. private String getPrefix(int rights) {
  8055. String prefix = "cr";
  8056.  
  8057. if (rights > 10) {
  8058. prefix = "c";
  8059. }
  8060.  
  8061. return "@" + prefix + rights + "@";
  8062. }
  8063.  
  8064. public int getPrefixSubstringLength(String prefix) {
  8065. if(prefix == null)
  8066. return 5;
  8067. return prefix.contains("cr10") || prefix.contains("cr11") ? 6 : 5;
  8068. }
  8069.  
  8070. public byte getPrefixRights(String prefix, boolean highRights) {
  8071. byte rights = 0;
  8072. int start = 3;
  8073. int end = highRights ? 5 : 4;
  8074. if (!prefix.contains("cr")) {
  8075. start = 2;
  8076. }
  8077. try {
  8078. rights = (byte) Integer.parseInt(prefix.substring(start, end));
  8079. } catch (Exception e) {
  8080. e.printStackTrace();
  8081. }
  8082. return rights;
  8083. }
  8084.  
  8085.  
  8086. public void mouseWheelDragged(int i, int j) {
  8087. if (!mouseWheelDown)
  8088. return;
  8089.  
  8090. this.cameraRotationLeft += i * 3;
  8091. this.cameraRotationRight += (j << 1);
  8092. }
  8093.  
  8094. private boolean inCircle(int circleX, int circleY, int clickX, int clickY, int radius) {
  8095. return Math.pow(circleX + radius - clickX, 2) + Math.pow(circleY + radius - clickY, 2) < Math.pow(radius, 2);
  8096. }
  8097.  
  8098. @Override
  8099. public void init() {
  8100. try {
  8101. nodeID = 10;
  8102. portOff = 0;
  8103. setHighDetail();
  8104. isMembers = true;
  8105. GameFrame.setScreenMode(ScreenMode.FIXED);
  8106. Signlink.storeid = 32;
  8107. instance = this;
  8108. Signlink.startpriv(InetAddress.getLocalHost());
  8109. initClientFrame(765, 503);
  8110. } catch (Exception exception) {
  8111. exception.printStackTrace();
  8112. return;
  8113. }
  8114. }
  8115.  
  8116. public boolean inSprite(boolean Click, Sprite sprite, int xCoord, int yCoord) {
  8117. if (Click && super.clickMode3 != 1) {
  8118. return false;
  8119. }
  8120.  
  8121. return (Click ? saveClickX : mouseX) >= xCoord && (Click ? saveClickX : mouseX) <= xCoord + sprite.myWidth && (Click ? saveClickY : mouseY) >= yCoord && (Click ? saveClickY : mouseY) <= yCoord + sprite.myHeight;
  8122. }
  8123.  
  8124. private String interfaceIntToString(int j) {
  8125. if (j < 0x3B9AC9FF) {
  8126. return String.valueOf(j);
  8127. } else {
  8128. return "*";
  8129. }
  8130. }
  8131.  
  8132. private boolean interfaceIsSelected(RSInterface class9) {
  8133. if (class9.valueCompareType == null) {
  8134. return false;
  8135. }
  8136.  
  8137. for (int i = 0; i < class9.valueCompareType.length; i++) {
  8138. int j = extractInterfaceValues(class9, i);
  8139. int k = class9.requiredValues[i];
  8140.  
  8141. if (class9.valueCompareType[i] == 2) {
  8142. if (j >= k) {
  8143. return false;
  8144. }
  8145. } else if (class9.valueCompareType[i] == 3) {
  8146. if (j <= k) {
  8147. return false;
  8148. }
  8149. } else if (class9.valueCompareType[i] == 4) {
  8150. if (j == k) {
  8151. return false;
  8152. }
  8153. } else if (j != k) {
  8154. return false;
  8155. }
  8156. }
  8157.  
  8158. return true;
  8159. }
  8160.  
  8161. public boolean isFriendOrSelf(String name) {
  8162. if (name == null) {
  8163. return false;
  8164. }
  8165.  
  8166. if (name.contains("@")) {
  8167. name = NAME_PATTERN.matcher(name).replaceAll("");
  8168. }
  8169.  
  8170. for (int i = 0; i < friendCount; i++) {
  8171. if (name.equalsIgnoreCase(friendsList[i])) {
  8172. return true;
  8173. }
  8174. }
  8175.  
  8176. return name.equalsIgnoreCase(myPlayer.name);
  8177. }
  8178.  
  8179. public boolean isGameFrameVisible() {
  8180. return gameFrameVisible;
  8181. }
  8182.  
  8183. public boolean isWebclient() {
  8184. return super.mainFrame == null;
  8185. }
  8186.  
  8187. private void launchURL(String url) {
  8188. String osName = System.getProperty("os.name");
  8189.  
  8190. try {
  8191. if (osName.startsWith("Mac OS")) {
  8192. Class<?> fileMgr = Class.forName("com.apple.eio.FileManager");
  8193. Method openURL = fileMgr.getDeclaredMethod("openURL", new Class[] { String.class });
  8194. openURL.invoke(null, new Object[] { url });
  8195. } else if (osName.startsWith("Windows")) {
  8196. Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + url);
  8197. } else {
  8198. // assume Unix or Linux
  8199. String[] browsers = { "firefox", "opera", "konqueror",
  8200. "epiphany", "mozilla", "netscape", "safari" };
  8201. String browser = null;
  8202.  
  8203. for (int count = 0; count < browsers.length && browser == null; count++) {
  8204. if (Runtime.getRuntime().exec(new String[] { "which",
  8205. browsers[count] }).waitFor() == 0) {
  8206. browser = browsers[count];
  8207. }
  8208. }
  8209.  
  8210. if (browser == null) {
  8211. throw new Exception("Could not find web browser");
  8212. } else {
  8213. Runtime.getRuntime().exec(new String[] { browser, url });
  8214. }
  8215. }
  8216. } catch (Exception e) {
  8217. pushMessage("Failed to open URL.", 0, "");
  8218. }
  8219. }
  8220.  
  8221. public static boolean forceRegionLoad;
  8222.  
  8223. private void loadingStages() {
  8224. if (isLowDetail() && loadingStage == 2 && ObjectManager.anInt131 != plane) {
  8225. gameScreenIP.initDrawingArea();
  8226. cacheSprite[1105].drawSprite(8, 9);
  8227. if (!resizing) {
  8228. gameScreenIP.drawGraphics(gameScreenDrawY, super.graphics, gameScreenDrawX);
  8229. }
  8230. loadingStage = 1;
  8231. aLong824 = System.currentTimeMillis();
  8232. }
  8233.  
  8234. if (loadingStage == 1) {
  8235. int j = getMapLoadingState();
  8236.  
  8237. if (j != 0 && System.currentTimeMillis() - aLong824 > 0x57e40L) {
  8238. Signlink.reportError(myUsername + " glcfb " + getServerSeed() + "," + j + "," + isLowDetail() + "," + decompressors[0] + "," + onDemandFetcher.getRemaining() + "," + plane + "," + anInt1069 + "," + anInt1070);
  8239. aLong824 = System.currentTimeMillis();
  8240. }
  8241. }
  8242.  
  8243. if (loadingStage == 2 && plane != getLastKnownPlane()) {
  8244. setLastKnownPlane(plane);
  8245. renderedMapScene(plane);
  8246. }
  8247. }
  8248.  
  8249. private void loadTitleScreen() {
  8250. /*
  8251. * byte abyte0[] = titleStreamLoader.getDataForName("title.dat");
  8252. * backGround = new Sprite(abyte0, this); aBackground_966 = new
  8253. * Background(titleStreamLoader, "titlebox", 0); aBackground_967 = new
  8254. * Background(titleStreamLoader, "titlebutton", 0);
  8255. * aBackgroundArray1152s = new Background[12]; int j = 0; try { j =
  8256. * Integer.parseInt(getParameter("fl_icon")); } catch (Exception _ex) {
  8257. * } if (j == 0) { for (int k = 0; k < 12; k++) aBackgroundArray1152s[k]
  8258. * = new Background(titleStreamLoader, "runes", k);
  8259. *
  8260. * } else { for (int l = 0; l < 12; l++) aBackgroundArray1152s[l] = new
  8261. * Background(titleStreamLoader, "runes", 12 + (l & 3));
  8262. *
  8263. * } new Sprite(128, 265); new Sprite(128, 265);
  8264. *
  8265. * anIntArray851 = new int[256]; for (int k1 = 0; k1 < 64; k1++)
  8266. * anIntArray851[k1] = k1 * 0x40000;
  8267. *
  8268. * for (int l1 = 0; l1 < 64; l1++) anIntArray851[l1 + 64] = 0xff0000 +
  8269. * 1024 * l1;
  8270. *
  8271. * for (int i2 = 0; i2 < 64; i2++) anIntArray851[i2 + 128] = 0xffff00 +
  8272. * 4 * i2;
  8273. *
  8274. * for (int j2 = 0; j2 < 64; j2++) anIntArray851[j2 + 192] = 0xffffff;
  8275. *
  8276. * anIntArray852 = new int[256]; for (int k2 = 0; k2 < 64; k2++)
  8277. * anIntArray852[k2] = k2 * 1024;
  8278. *
  8279. * for (int l2 = 0; l2 < 64; l2++) anIntArray852[l2 + 64] = 65280 + 4 *
  8280. * l2;
  8281. *
  8282. * for (int i3 = 0; i3 < 64; i3++) anIntArray852[i3 + 128] = 65535 +
  8283. * 0x40000 * i3;
  8284. *
  8285. * for (int j3 = 0; j3 < 64; j3++) anIntArray852[j3 + 192] = 0xffffff;
  8286. *
  8287. * anIntArray853 = new int[256]; for (int k3 = 0; k3 < 64; k3++)
  8288. * anIntArray853[k3] = k3 * 4;
  8289. *
  8290. * for (int l3 = 0; l3 < 64; l3++) anIntArray853[l3 + 64] = 255 +
  8291. * 0x40000 * l3;
  8292. *
  8293. * for (int i4 = 0; i4 < 64; i4++) anIntArray853[i4 + 128] = 0xff00ff +
  8294. * 1024 * i4;
  8295. *
  8296. * for (int j4 = 0; j4 < 64; j4++) anIntArray853[j4 + 192] = 0xffffff;
  8297. *
  8298. * anIntArray1190 = new int[32768]; anIntArray1191 = new int[32768];
  8299. */
  8300. // randomizeBackground(null);
  8301. //drawSmoothLoading(10, "Connecting to fileserver");
  8302. }
  8303.  
  8304. private void loginScreenBG(boolean b) {
  8305. xCameraPos = 6100;
  8306. yCameraPos = 6867;
  8307. zCameraPos = -750;
  8308. xCameraCurve = 2040;
  8309. yCameraCurve = 383;
  8310. resetWorld(0);
  8311.  
  8312. if (b || getScriptManager() == null) {
  8313. setScriptManager(new ScriptManager(this));
  8314. } else {
  8315. getScriptManager().update();
  8316. }
  8317.  
  8318. plane = getScriptManager().regionPlane;
  8319. generateWorld(getScriptManager().terrainRegionX, getScriptManager().terrainRegionY);
  8320. resetWorld(1);
  8321. }
  8322.  
  8323. private void magicOnItem(int id) {
  8324. spellSelected = 1;
  8325. spellID = id;
  8326. selectedSpellId = id;
  8327. spellUsableOn = 16;
  8328. itemSelected = 0;
  8329. spellTooltip = "Cast on";
  8330. tabID = 3;
  8331. tabAreaAltered = true;
  8332. }
  8333.  
  8334. private void mainGameProcessor() {
  8335. if (openInterfaceID == 24600 && !getGrandExchange().searching
  8336. && interfaceButtonAction != 1558
  8337. && interfaceButtonAction != 1557 && inputDialogState != 1) {
  8338. inputDialogState = 0;
  8339. }
  8340. if (systemUpdateTimer > 1) {
  8341. systemUpdateTimer--;
  8342. }
  8343.  
  8344. if (anInt1011 > 0) {
  8345. anInt1011--;
  8346. }
  8347.  
  8348. for (int j = 0; j < 5; j++) {
  8349. if (!parsePacket()) {
  8350. break;
  8351. }
  8352. }
  8353.  
  8354. if (!loggedIn) {
  8355. return;
  8356. }
  8357.  
  8358. synchronized (mouseDetection.locker) {
  8359. if (!flagged) {
  8360. mouseDetection.coordsIndex = 0;
  8361. }
  8362. }
  8363.  
  8364. if (anInt1016 > 0) {
  8365. anInt1016--;
  8366. }
  8367.  
  8368. if (super.keyArray[1] == 1 || super.keyArray[2] == 1 || super.keyArray[3] == 1 || super.keyArray[4] == 1) {
  8369. aBoolean1017 = true;
  8370. }
  8371.  
  8372. if (aBoolean1017 && anInt1016 <= 0) {
  8373. anInt1016 = 20;
  8374. aBoolean1017 = false;
  8375. }
  8376.  
  8377. if (super.awtFocus && !aBoolean954) {
  8378. aBoolean954 = true;
  8379. getOut().putOpcode(3);
  8380. getOut().putByte(1);
  8381. }
  8382.  
  8383. if (!super.awtFocus && aBoolean954) {
  8384. aBoolean954 = false;
  8385. getOut().putOpcode(3);
  8386. getOut().putByte(0);
  8387. }
  8388.  
  8389. loadingStages();
  8390. method115();
  8391. method90();
  8392. anInt1009++;
  8393.  
  8394. if (anInt1009 > 750) {
  8395. dropClient();
  8396. }
  8397.  
  8398. updatePlayerInstances();
  8399. readNPCUpdateBlockForced();
  8400. processTextCycles();
  8401.  
  8402. if (tabID >= 0 && tabInterfaceIDs[tabID] == 54017) {
  8403. if (!PetSystem.isPetAnimationRunning) {
  8404. // PetSystem.updateAnimations();
  8405. }
  8406. }
  8407.  
  8408. anInt945++;
  8409.  
  8410. if (crossType != 0) {
  8411. crossIndex += 20;
  8412.  
  8413. if (crossIndex >= 400) {
  8414. crossType = 0;
  8415. }
  8416. }
  8417.  
  8418. if (atInventoryInterfaceType != 0) {
  8419. atInventoryLoopCycle++;
  8420.  
  8421. if (atInventoryLoopCycle >= 15) {
  8422. if (atInventoryInterfaceType == 3) {
  8423. setInputTaken(true);
  8424. }
  8425. atInventoryInterfaceType = 0;
  8426. }
  8427. }
  8428.  
  8429. if (activeInterfaceType != 0) {
  8430. anInt989++;
  8431.  
  8432. if (super.mouseX > anInt1087 + 5 || super.mouseX < anInt1087 - 5 || super.mouseY > anInt1088 + 5 || super.mouseY < anInt1088 - 5) {
  8433. aBoolean1242 = true;
  8434. }
  8435.  
  8436. if (super.getClickMode2() == 0) {
  8437. if (activeInterfaceType == 3) {
  8438. setInputTaken(true);
  8439. }
  8440.  
  8441. activeInterfaceType = 0;
  8442.  
  8443. if (aBoolean1242 && anInt989 >= 15) {
  8444. bankItemDragSprite = null;
  8445. lastActiveInvInterface = -1;
  8446. processRightClick();
  8447. processBankInterface();
  8448.  
  8449. if (lastActiveInvInterface == anInt1084 && mouseInvInterfaceIndex == anInt1085) {
  8450. if (menuActionRow > 0) {
  8451. doAction(menuActionRow - 1);
  8452. }
  8453. }
  8454.  
  8455. if (lastActiveInvInterface == anInt1084 && mouseInvInterfaceIndex != anInt1085) {
  8456.  
  8457. RSInterface class9 = RSInterface.interfaceCache[anInt1084];
  8458. int j1 = 0;
  8459.  
  8460. if (anInt913 == 1 && class9.contentType == 206) {
  8461. j1 = 1;
  8462. }
  8463.  
  8464. if (class9.inv[mouseInvInterfaceIndex] <= 0) {
  8465. j1 = 0;
  8466. }
  8467.  
  8468. if (class9.deletesTargetSlot) {
  8469. int l2 = anInt1085;
  8470. int l3 = mouseInvInterfaceIndex;
  8471. class9.inv[l3] = class9.inv[l2];
  8472. class9.invStackSizes[l3] = class9.invStackSizes[l2];
  8473. class9.inv[l2] = -1;
  8474. class9.invStackSizes[l2] = 0;
  8475. } else if (j1 == 1) {
  8476. int i3 = anInt1085;
  8477.  
  8478. for (int i4 = mouseInvInterfaceIndex; i3 != i4;) {
  8479. if (i3 > i4) {
  8480. class9.swapInventoryItems(i3, i3 - 1);
  8481. i3--;
  8482. } else if (i3 < i4) {
  8483. class9.swapInventoryItems(i3, i3 + 1);
  8484. i3++;
  8485. }
  8486. }
  8487. } else {
  8488. class9.swapInventoryItems(anInt1085, mouseInvInterfaceIndex);
  8489. }
  8490.  
  8491. getOut().putOpcode(214);
  8492. getOut().writeSignedBigEndian(anInt1084);
  8493. getOut().method424(j1);
  8494. getOut().writeSignedBigEndian(anInt1085);
  8495. getOut().writeUnsignedWordBigEndian(mouseInvInterfaceIndex);
  8496. }
  8497. } else if ((anInt1253 == 1 || menuHasAddFriend(menuActionRow - 1)) && menuActionRow > 2) {
  8498. determineMenuSize();
  8499. } else if (menuActionRow > 0) {
  8500. doAction(menuActionRow - 1);
  8501. }
  8502.  
  8503. atInventoryLoopCycle = 10;
  8504. super.clickMode3 = 0;
  8505. }
  8506. }
  8507.  
  8508. if (WorldController.anInt470 != -1) {
  8509. int k = WorldController.anInt470;
  8510. int k1 = WorldController.anInt471;
  8511. boolean flag = doWalkTo(0, 0, 0, 0, myPlayer.smallY[0], 0, 0, k1, myPlayer.smallX[0], true, k);
  8512. WorldController.anInt470 = -1;
  8513.  
  8514. if (flag) {
  8515. crossX = super.saveClickX;
  8516. crossY = super.saveClickY;
  8517. crossType = 1;
  8518. crossIndex = 0;
  8519. }
  8520. }
  8521.  
  8522. if (super.clickMode3 == 1 && aString844 != null) {
  8523. aString844 = null;
  8524. setInputTaken(true);
  8525. super.clickMode3 = 0;
  8526. }
  8527.  
  8528. if (!processMenuClick()) {
  8529. processMainScreenClick();
  8530. tabArea.processTabClick(this, GameFrame.getScreenMode());
  8531. }
  8532.  
  8533. if (super.getClickMode2() == 1 || super.clickMode3 == 1) {
  8534. anInt1213++;
  8535. }
  8536.  
  8537. if (anInt1500 != 0 || anInt1044 != 0 || anInt1129 != 0) {
  8538. if (anInt1501 < 30 && !menuOpen) {
  8539. if (++anInt1501 == 30) {
  8540. if (anInt1500 != 0) {
  8541. inputTaken = true;
  8542. }
  8543. }
  8544. }
  8545. } else if (anInt1501 > 0) {
  8546. anInt1501--;
  8547. }
  8548. //System.out.println(":anInt150: "+anInt1500);
  8549.  
  8550. if (PlayerHandler.quedBalloonX > -1 && PlayerHandler.quedBalloonY > -1) {
  8551. int x = (myPlayer.x >> 7) + baseX;
  8552. int y = (myPlayer.y >> 7) + baseY;
  8553.  
  8554. if (PlayerHandler.quedBalloonX == x && PlayerHandler.quedBalloonY == y) {
  8555. getOut().putOpcode(159);
  8556. getOut().putShort(PlayerHandler.quedBalloonX);
  8557. getOut().putShort(PlayerHandler.quedBalloonY);
  8558. PlayerHandler.quedBalloonX = PlayerHandler.quedBalloonY = -1;
  8559. }
  8560. }
  8561.  
  8562. if (loadingStage == 2) {
  8563. method108();
  8564. }
  8565.  
  8566. if (loadingStage == 2 && cameraViewChanged) {
  8567. calcCameraPos();
  8568. }
  8569.  
  8570. for (int i1 = 0; i1 < 5; i1++) {
  8571. anIntArray1030[i1]++;
  8572. }
  8573.  
  8574. manageTextInput();
  8575. super.idleTime++;
  8576.  
  8577. if (super.idleTime > 9000) {
  8578. anInt1011 = 250;
  8579. super.idleTime = 0;
  8580. getOut().putOpcode(202);
  8581. }
  8582.  
  8583. if (cameraOffsetX < -50) {
  8584. }
  8585.  
  8586. if (cameraOffsetX > 50) {
  8587. }
  8588.  
  8589. if (cameraOffsetY < -55) {
  8590. }
  8591.  
  8592. if (cameraOffsetY > 55) {
  8593. }
  8594.  
  8595. if (viewRotationOffset < -40) {
  8596. }
  8597.  
  8598. if (viewRotationOffset > 40) {
  8599. }
  8600.  
  8601. if (minimapRotation < -60) {
  8602. }
  8603.  
  8604. if (minimapRotation > 60) {
  8605. }
  8606.  
  8607. if (minimapZoom < -20) {
  8608. }
  8609.  
  8610. if (minimapZoom > 10) {
  8611. }
  8612.  
  8613. if (++anInt1010 > 50) {
  8614. getOut().putOpcode(0);
  8615. }
  8616.  
  8617. try {
  8618. if (getConnection() != null && getOut().position > 0) {
  8619. getConnection().queueBytes(getOut().position, getOut().buffer);
  8620. getOut().position = 0;
  8621. anInt1010 = 0;
  8622. }
  8623. } catch (IOException _ex) {
  8624. dropClient();
  8625. } catch (Exception exception) {
  8626. resetLogout();
  8627. }
  8628. }
  8629.  
  8630. public void markMinimap(Sprite sprite, int x, int y) {
  8631. if (sprite == null) {
  8632. return;
  8633. }
  8634.  
  8635. boolean fixed = GameFrame.getScreenMode() == ScreenMode.FIXED;
  8636. int rotation = viewRotation + minimapRotation & 0x7ff;
  8637. int xPadding = mapArea.getOffSetX();
  8638. int yPadding = mapArea.getyPos();
  8639. int distance = x * x + y * y;
  8640.  
  8641. if (distance > 6400) {
  8642. return;
  8643. }
  8644.  
  8645. int spriteX = Model.SINE[rotation];
  8646. int spriteY = Model.COSINE[rotation];
  8647. spriteX = spriteX * 256 / (minimapZoom + 256);
  8648. spriteY = spriteY * 256 / (minimapZoom + 256);
  8649. int drawX = y * spriteX + x * spriteY >> 16;
  8650. int drawY = y * spriteY - x * spriteX >> 16;
  8651. int finalX = (fixed ? 104 : 83) + drawX - sprite.maxWidth / 2 + 4;
  8652. int finalY = (fixed ? 89 : 85) - drawY - sprite.maxHeight / 2 - 4;
  8653.  
  8654. try {
  8655. sprite.drawSprite(finalX + xPadding, finalY + yPadding);
  8656. } catch (Exception _ex) {
  8657. }
  8658. }
  8659.  
  8660. private boolean menuHasAddFriend(int j) {
  8661. if (j < 0) {
  8662. return false;
  8663. }
  8664.  
  8665. int k = menuActionID[j];
  8666.  
  8667. if (k >= 2000) {
  8668. k -= 2000;
  8669. }
  8670.  
  8671. return k == 337;
  8672. }
  8673.  
  8674. private void appendFocusDest(Entity entity) {
  8675. if (entity.anInt1504 == 0) {
  8676. return;
  8677. }
  8678. if (entity.interactingEntity != -1 && entity.interactingEntity < 32768) {
  8679. try {
  8680. NPC npc = npcArray[entity.interactingEntity];
  8681.  
  8682. if (npc != null) {
  8683. int i1 = entity.x - npc.x;
  8684. int k1 = entity.y - npc.y;
  8685.  
  8686. if (i1 != 0 || k1 != 0) {
  8687. entity.turnDirection = (int) (Math.atan2(i1, k1) * 325.94900000000001D) & 0x7ff;
  8688. }
  8689. }
  8690. } catch (Exception ex) {
  8691. ex.printStackTrace();
  8692. }
  8693. }
  8694.  
  8695. if (entity.interactingEntity >= 32768) {
  8696. int j = entity.interactingEntity - 32768;
  8697. if (j == playerId) {
  8698. j = myPlayerIndex;
  8699. }
  8700. Player player = playerArray[j];
  8701. if (player != null) {
  8702. int l1 = entity.x - player.x;
  8703. int i2 = entity.y - player.y;
  8704. if (l1 != 0 || i2 != 0) {
  8705. entity.turnDirection = (int) (Math.atan2(l1, i2) * 325.94900000000001D) & 0x7ff;
  8706. }
  8707. }
  8708. }
  8709.  
  8710. if ((entity.anInt1538 != 0 || entity.anInt1539 != 0) && (entity.smallXYIndex == 0 || entity.anInt1503 > 0)) {
  8711. int k = entity.x - (entity.anInt1538 - baseX - baseX) * 64;
  8712. int j1 = entity.y - (entity.anInt1539 - baseY - baseY) * 64;
  8713.  
  8714. if (k != 0 || j1 != 0) {
  8715. entity.turnDirection = (int) (Math.atan2(k, j1) * 325.94900000000001D) & 0x7ff;
  8716. }
  8717.  
  8718. entity.anInt1538 = 0;
  8719. entity.anInt1539 = 0;
  8720. }
  8721.  
  8722. int l = entity.turnDirection - entity.anInt1552 & 0x7ff;
  8723.  
  8724. if (l != 0) {
  8725. if (l < entity.anInt1504 || l > 2048 - entity.anInt1504) {
  8726. entity.anInt1552 = entity.turnDirection;
  8727. } else if (l > 1024) {
  8728. entity.anInt1552 -= entity.anInt1504;
  8729. } else {
  8730. entity.anInt1552 += entity.anInt1504;
  8731. }
  8732.  
  8733. entity.anInt1552 &= 0x7ff;
  8734.  
  8735. if (entity.anInt1517 == entity.anInt1511 && entity.anInt1552 != entity.turnDirection) {
  8736. if (entity.anInt1512 != -1) {
  8737. entity.anInt1517 = entity.anInt1512;
  8738. return;
  8739. }
  8740.  
  8741. entity.anInt1517 = entity.anInt1554;
  8742. }
  8743. }
  8744. }
  8745.  
  8746. private void appendAnimation(Entity entity) {
  8747. try {
  8748. entity.aBoolean1541 = false;
  8749.  
  8750. if (entity.anInt1517 != -1) {
  8751. if (entity.anInt1517 > Animation.cache.length)
  8752. entity.anInt1517 = 0;
  8753. Animation animation = Animation.cache[entity.anInt1517];
  8754. entity.frameDelay++;
  8755.  
  8756. if (entity.currentForcedAnimFrame < animation.frameCount && entity.frameDelay > animation.getFrameLength(entity.currentForcedAnimFrame)) {
  8757. entity.frameDelay = 1; //this is the frame delay. 0 is what it's normally at. higher number = faster animations.
  8758. entity.currentForcedAnimFrame++;
  8759. entity.nextIdleAnimationFrame++;
  8760. }
  8761. entity.nextIdleAnimationFrame = entity.currentForcedAnimFrame + 1;
  8762. if (entity.nextIdleAnimationFrame >= animation.frameCount) {
  8763. if (entity.nextIdleAnimationFrame >= animation.frameCount) {
  8764. entity.nextIdleAnimationFrame = 0;
  8765. }
  8766. }
  8767. if (entity.currentForcedAnimFrame >= animation.frameCount) {
  8768. entity.frameDelay = 1;
  8769. entity.currentForcedAnimFrame = 0;
  8770. }
  8771. }
  8772.  
  8773. if (entity.gfxId != -1 && loopCycle >= entity.graphicDelay) {
  8774. if (entity.currentAnim < 0) {
  8775. entity.currentAnim = 0;
  8776. }
  8777.  
  8778. Animation animation_1 = SpotAnimDefinition.cache[entity.gfxId].animation;
  8779. for (entity.animCycle++; entity.currentAnim < animation_1.frameCount && entity.animCycle > animation_1.getFrameLength(entity.currentAnim); entity.currentAnim++) {
  8780. entity.animCycle -= animation_1.getFrameLength(entity.currentAnim);
  8781. }
  8782.  
  8783. if (entity.currentAnim >= animation_1.frameCount && (entity.currentAnim < 0 || entity.currentAnim >= animation_1.frameCount)) {
  8784. entity.gfxId = -1;
  8785. }
  8786. entity.nextGraphicsAnimationFrame = entity.currentAnim + 1;
  8787. if (entity.nextGraphicsAnimationFrame >= animation_1.frameCount) {
  8788. if (entity.nextGraphicsAnimationFrame < 0 || entity.nextGraphicsAnimationFrame >= animation_1.frameCount) {
  8789. entity.gfxId = -1;
  8790. }
  8791. }
  8792. }
  8793.  
  8794. if (entity.anim != -1 && entity.animationDelay <= 1) {
  8795. Animation animation_2 = Animation.cache[entity.anim];
  8796.  
  8797. if (animation_2.resetWhenWalk == 1 && entity.anInt1542 > 0 && entity.anInt1547 <= loopCycle && entity.anInt1548 < loopCycle) {
  8798. entity.animationDelay = 1;
  8799. return;
  8800. }
  8801. }
  8802.  
  8803. if (entity.anim != -1 && entity.animationDelay == 0) {
  8804. Animation animation_3 = Animation.cache[entity.anim];
  8805.  
  8806. for (entity.anInt1528++; entity.currentAnimFrame < animation_3.frameCount && entity.anInt1528 > animation_3.getFrameLength(entity.currentAnimFrame); entity.currentAnimFrame++) {
  8807. entity.anInt1528 -= animation_3.getFrameLength(entity.currentAnimFrame);
  8808. }
  8809.  
  8810. if (entity.currentAnimFrame >= animation_3.frameCount) {
  8811. entity.currentAnimFrame -= animation_3.loopDelay;
  8812. entity.anInt1530++;
  8813.  
  8814. if (entity.anInt1530 >= animation_3.frameStep) {
  8815. entity.anim = -1;
  8816. }
  8817.  
  8818. if (entity.currentAnimFrame < 0 || entity.currentAnimFrame >= animation_3.frameCount) {
  8819. entity.anim = -1;
  8820. }
  8821. }
  8822. entity.nextAnimationFrame = entity.currentAnimFrame + 1;
  8823. if (entity.nextAnimationFrame >= animation_3.frameCount) {
  8824. if (entity.anInt1530 >= animation_3.frameStep) {
  8825. entity.anim = -1;
  8826. }
  8827. if (entity.nextAnimationFrame < 0 || entity.nextAnimationFrame >= animation_3.frameCount) {
  8828. entity.anim = -1;
  8829. }
  8830. }
  8831. entity.aBoolean1541 = animation_3.oneSquareAnimation;
  8832. }
  8833.  
  8834. if (entity.animationDelay > 0) {
  8835. entity.animationDelay--;
  8836. }
  8837. } catch(Exception e) {
  8838. e.printStackTrace();
  8839. }
  8840. }
  8841.  
  8842. private void method104() {
  8843. Animable_Sub3 class30_sub2_sub4_sub3 = (Animable_Sub3) getaClass19_1056().reverseGetFirst();
  8844.  
  8845. for (; class30_sub2_sub4_sub3 != null; class30_sub2_sub4_sub3 = (Animable_Sub3) getaClass19_1056().reverseGetNext()) {
  8846. if (class30_sub2_sub4_sub3.anInt1560 != plane || class30_sub2_sub4_sub3.aBoolean1567) {
  8847. class30_sub2_sub4_sub3.unlink();
  8848. } else if (loopCycle >= class30_sub2_sub4_sub3.anInt1564) {
  8849. class30_sub2_sub4_sub3.method454(anInt945);
  8850.  
  8851. if (class30_sub2_sub4_sub3.aBoolean1567) {
  8852. class30_sub2_sub4_sub3.unlink();
  8853. } else {
  8854. worldController.method285(class30_sub2_sub4_sub3.anInt1560, 0, class30_sub2_sub4_sub3.anInt1563, -1, class30_sub2_sub4_sub3.anInt1562, 60, class30_sub2_sub4_sub3.anInt1561, class30_sub2_sub4_sub3, false);
  8855. }
  8856. }
  8857. }
  8858. }
  8859.  
  8860. private void readPlayerUpdateMask(int bitmap, int j, ByteBuffer buffer, Player player) {
  8861. if ((bitmap & 0x400) != 0) {
  8862. player.anInt1543 = buffer.method428();
  8863. player.anInt1545 = buffer.method428();
  8864. player.anInt1544 = buffer.method428();
  8865. player.anInt1546 = buffer.method428();
  8866. player.anInt1547 = buffer.getShortBigEndianA() + loopCycle;
  8867. player.anInt1548 = buffer.method435() + loopCycle;
  8868. player.anInt1549 = buffer.method428();
  8869. player.method446();
  8870. }
  8871.  
  8872. if ((bitmap & 0x100) != 0) {
  8873. player.gfxId = buffer.getShortBigEndian(); // GFX Id
  8874. int k = buffer.getIntLittleEndian();
  8875. player.graphicHeight = k >> 16;
  8876. player.graphicDelay = loopCycle + (k & 0xffff);
  8877. player.currentAnim = 0;
  8878. player.animCycle = 0;
  8879.  
  8880. if (player.graphicDelay > loopCycle) {
  8881. player.currentAnim = -1;
  8882. }
  8883.  
  8884. if (player.gfxId == 65535) {
  8885. player.gfxId = -1;
  8886. }
  8887.  
  8888. try {
  8889. if (FrameReader.animationlist[Integer
  8890. .parseInt(
  8891. Integer.toHexString(
  8892. SpotAnimDefinition.cache[player.gfxId].animation.frameIDs[0])
  8893. .substring(
  8894. 0,
  8895. Integer.toHexString(
  8896. SpotAnimDefinition.cache[player.gfxId].animation.frameIDs[0])
  8897. .length() - 4), 16)].length == 0)
  8898. onDemandFetcher
  8899. .requestFileData(
  8900. 1,
  8901. Integer.parseInt(
  8902. Integer.toHexString(
  8903. SpotAnimDefinition.cache[player.gfxId].animation.frameIDs[0])
  8904. .substring(
  8905. 0,
  8906. Integer.toHexString(
  8907. SpotAnimDefinition.cache[player.gfxId].animation.frameIDs[0])
  8908. .length() - 4),
  8909. 16));
  8910. } catch (Exception e) {
  8911. }
  8912. }
  8913.  
  8914. if ((bitmap & 8) != 0) {
  8915. int l = buffer.getShortBigEndian();
  8916.  
  8917. if (l == 65535) {
  8918. l = -1;
  8919. }
  8920.  
  8921. int i2 = buffer.method427();
  8922.  
  8923. if (l == player.anim && l != -1) {
  8924. int i3 = Animation.cache[l].delayType;
  8925.  
  8926. if (i3 == 1) {
  8927. player.currentAnimFrame = 0;
  8928. player.anInt1528 = 0;
  8929. player.animationDelay = i2;
  8930. player.anInt1530 = 0;
  8931. }
  8932.  
  8933. if (i3 == 2) {
  8934. player.anInt1530 = 0;
  8935. }
  8936. } else if (l == -1
  8937. || player.anim == -1
  8938. || Animation.cache[l].forcedPriority >= Animation.cache[player.anim].forcedPriority) {
  8939. player.anim = l;
  8940. player.currentAnimFrame = 0;
  8941. player.anInt1528 = 0;
  8942. player.animationDelay = i2;
  8943. player.anInt1530 = 0;
  8944. player.anInt1542 = player.smallXYIndex;
  8945.  
  8946. try {
  8947. if (FrameReader.animationlist[Integer
  8948. .parseInt(
  8949. Integer.toHexString(
  8950. Animation.cache[l].frameIDs[0])
  8951. .substring(
  8952. 0,
  8953. Integer.toHexString(
  8954. Animation.cache[l].frameIDs[0])
  8955. .length() - 4), 16)].length == 0)
  8956. onDemandFetcher
  8957. .requestFileData(
  8958. 1,
  8959. Integer.parseInt(
  8960. Integer.toHexString(
  8961. Animation.cache[l].frameIDs[0])
  8962. .substring(
  8963. 0,
  8964. Integer.toHexString(
  8965. Animation.cache[l].frameIDs[0])
  8966. .length() - 4),
  8967. 16));
  8968. } catch (Exception e) {
  8969. }
  8970. }
  8971. }
  8972.  
  8973. if ((bitmap & 4) != 0) {
  8974. player.textSpoken = buffer.getString();
  8975.  
  8976. if (player.textSpoken.charAt(0) == '~') {
  8977. player.textSpoken = player.textSpoken.substring(1);
  8978. pushMessage(player.textSpoken, 2, player.name);
  8979. } else if (player == myPlayer) {
  8980. pushMessage(player.textSpoken, 2, player.name);
  8981. }
  8982.  
  8983. player.anInt1513 = 0;
  8984. player.anInt1531 = 0;
  8985. player.textCycle = 150;
  8986. }
  8987.  
  8988. if ((bitmap & 0x80) != 0) {
  8989. int effects = buffer.getShortBigEndian();
  8990. int rights = buffer.getUnsignedByte();
  8991. int ironman = buffer.getUnsignedByte();
  8992. int chatTextSize = buffer.method427();
  8993. int currentOffset = buffer.position;
  8994.  
  8995. if (player.name != null && player.visible) {
  8996. long l3 = TextClass.longForName(player.name);
  8997. boolean flag = false;
  8998.  
  8999. if (rights <= 1) {
  9000. for (int i = 0; i < ignoreCount; i++) {
  9001. if (ignoreListAsLongs[i] != l3) {
  9002. continue;
  9003. }
  9004.  
  9005. flag = true;
  9006. break;
  9007. }
  9008. }
  9009.  
  9010. if (!flag && anInt1251 == 0) {
  9011. try {
  9012. aStream_834.position = 0;
  9013. buffer.method442(chatTextSize, 0, aStream_834.buffer);
  9014. aStream_834.position = 0;
  9015. String s = TextInput.readChatboxText(chatTextSize, aStream_834);
  9016. player.textSpoken = s;
  9017. player.anInt1513 = effects >> 8;
  9018. // player.privilegeLevel = j2;
  9019. player.anInt1531 = effects & 0xff;
  9020. player.textCycle = 150;
  9021. if(rights == 0 && ironman > 0) {
  9022. rights = 11 + ironman;
  9023. }
  9024. pushMessage(s, 2, getPrefix(rights) + player.name, player.loyaltyTitle, player.loyaltyColor, player.loyaltyPosition);
  9025. } catch (Exception exception) {
  9026. Signlink.reportError("cde2");
  9027. }
  9028. }
  9029. }
  9030.  
  9031. buffer.position = currentOffset + chatTextSize;
  9032. }
  9033.  
  9034. if ((bitmap & 1) != 0) {
  9035. player.interactingEntity = buffer.getShortBigEndian();
  9036.  
  9037. if (player.interactingEntity == 65535) {
  9038. player.interactingEntity = -1;
  9039. }
  9040. }
  9041.  
  9042. if ((bitmap & 0x10) != 0) {
  9043. int j1 = buffer.method427();
  9044. byte abyte0[] = new byte[j1];
  9045. ByteBuffer stream_1 = new ByteBuffer(abyte0);
  9046. buffer.getBytes(j1, 0, abyte0);
  9047. getaStreamArray895s()[j] = stream_1;
  9048. player.updatePlayer(stream_1);
  9049. }
  9050.  
  9051. if ((bitmap & 2) != 0) {
  9052. player.anInt1538 = buffer.getShortBigEndianA();
  9053. player.anInt1539 = buffer.getShortBigEndian();
  9054. }
  9055.  
  9056. if ((bitmap & 0x20) != 0) {
  9057.  
  9058. int k1 = getInputBuffer().getByteA();
  9059. int k2 = buffer.getUnsignedByte();
  9060. int icon = buffer.getUnsignedByte();
  9061. int soakDamage = getInputBuffer().getByteA();
  9062. player.updateHitData(k2, k1, loopCycle, icon, soakDamage);
  9063. player.loopCycleStatus = loopCycle + 300;
  9064. player.currentHealth = getInputBuffer().getByteA();
  9065. player.maxHealth = getInputBuffer().getByteA();
  9066. }
  9067.  
  9068. if ((bitmap & 0x200) != 0) {
  9069. int l1 = buffer.getByteA();
  9070. int l2 = buffer.getUnsignedByte();
  9071. int icon = buffer.getUnsignedByte();
  9072. int soakDamage = buffer.getByteA();
  9073. player.updateHitData(l2, l1, loopCycle, icon, soakDamage);
  9074. player.loopCycleStatus = loopCycle + 300;
  9075. player.currentHealth = buffer.getByteA();
  9076. player.maxHealth = buffer.getByteA();
  9077. }
  9078. }
  9079.  
  9080. private void method108() {
  9081. try {
  9082. int cameraDisplayX = myPlayer.x + cameraOffsetX;
  9083. int cameraDisplayY = myPlayer.y + cameraOffsetY;
  9084.  
  9085. if (currentCameraDisplayX - cameraDisplayX < -500 || currentCameraDisplayX - cameraDisplayX > 500 || currentCameraDisplayY - cameraDisplayY < -500 || currentCameraDisplayY - cameraDisplayY > 500) {
  9086. currentCameraDisplayX = cameraDisplayX;
  9087. currentCameraDisplayY = cameraDisplayY;
  9088. }
  9089.  
  9090. if (currentCameraDisplayX != cameraDisplayX) {
  9091. currentCameraDisplayX += (cameraDisplayX - currentCameraDisplayX) / 16;
  9092. }
  9093.  
  9094. if (currentCameraDisplayY != cameraDisplayY) {
  9095. currentCameraDisplayY += (cameraDisplayY - currentCameraDisplayY) / 16;
  9096. }
  9097.  
  9098. if (super.keyArray[1] == 1) {
  9099. cameraRotationLeft += (-24 - cameraRotationLeft) / 2;
  9100. } else if (super.keyArray[2] == 1) {
  9101. cameraRotationLeft += (24 - cameraRotationLeft) / 2;
  9102. } else {
  9103. cameraRotationLeft /= 2;
  9104. }
  9105.  
  9106. if (super.keyArray[3] == 1) {
  9107. cameraRotationRight += (12 - cameraRotationRight) / 2;
  9108. } else if (super.keyArray[4] == 1) {
  9109. cameraRotationRight += (-12 - cameraRotationRight) / 2;
  9110. } else {
  9111. cameraRotationRight /= 2;
  9112. }
  9113.  
  9114. viewRotation = viewRotation + cameraRotationLeft / 2 & 0x7ff;
  9115. cameraRotationZ += cameraRotationRight / 2;
  9116.  
  9117. if (cameraRotationZ < 128) {
  9118. cameraRotationZ = 128;
  9119. }
  9120.  
  9121. if (cameraRotationZ > 383) {
  9122. cameraRotationZ = 383;
  9123. }
  9124.  
  9125. int l = currentCameraDisplayX >> 7;
  9126. int i1 = currentCameraDisplayY >> 7;
  9127. int j1 = method42(plane, currentCameraDisplayY, currentCameraDisplayX);
  9128. int k1 = 0;
  9129.  
  9130. if (l > 3 && i1 > 3 && l < 100 && i1 < 100) {
  9131. for (int l1 = l - 4; l1 <= l + 4; l1++) {
  9132. for (int k2 = i1 - 4; k2 <= i1 + 4; k2++) {
  9133. int l2 = plane;
  9134.  
  9135. if (l2 < 3 && (byteGroundArray[1][l1][k2] & 2) == 2) {
  9136. l2++;
  9137. }
  9138.  
  9139. int i3 = j1 - intGroundArray[l2][l1][k2];
  9140.  
  9141. if (i3 > k1) {
  9142. k1 = i3;
  9143. }
  9144. }
  9145. }
  9146. }
  9147.  
  9148. anInt1005++;
  9149.  
  9150. if (anInt1005 > 1512) {
  9151. anInt1005 = 0;
  9152. getOut().putOpcode(77);
  9153. getOut().putByte(0);
  9154. int i2 = getOut().position;
  9155. getOut().putByte((int) (Math.random() * 256D));
  9156. getOut().putByte(101);
  9157. getOut().putByte(233);
  9158. getOut().putShort(45092);
  9159.  
  9160. if ((int) (Math.random() * 2D) == 0) {
  9161. getOut().putShort(35784);
  9162. }
  9163.  
  9164. getOut().putByte((int) (Math.random() * 256D));
  9165. getOut().putByte(64);
  9166. getOut().putByte(38);
  9167. getOut().putShort((int) (Math.random() * 65536D));
  9168. getOut().putShort((int) (Math.random() * 65536D));
  9169. getOut().putVariableSizeByte(getOut().position - i2);
  9170. }
  9171.  
  9172. int j2 = k1 * 192;
  9173.  
  9174. if (j2 > 0x17f00) {
  9175. j2 = 0x17f00;
  9176. }
  9177. if (j2 < 32768) {
  9178. j2 = 32768;
  9179. }
  9180. if (j2 > anInt984) {
  9181. anInt984 += (j2 - anInt984) / 24;
  9182. return;
  9183. }
  9184. if (j2 < anInt984) {
  9185. anInt984 += (j2 - anInt984) / 80;
  9186. }
  9187. } catch (Exception _ex) {
  9188. Signlink.reportError("glfc_ex " + myPlayer.x + "," + myPlayer.y + "," + currentCameraDisplayX + "," + currentCameraDisplayY + "," + anInt1069 + "," + anInt1070 + "," + baseX + "," + baseY);
  9189. throw new RuntimeException("eek");
  9190. }
  9191. }
  9192.  
  9193. private void updatePlayerInstances() {
  9194. for (int i = -1; i < playerCount; i++) {
  9195. int j;
  9196.  
  9197. if (i == -1) {
  9198. j = getMyPlayerIndex();
  9199. } else {
  9200. j = playerIndices[i];
  9201. }
  9202.  
  9203. Player player = playerArray[j];
  9204.  
  9205. if (player != null) {
  9206. entityUpdateBlock(player);
  9207. }
  9208. }
  9209. }
  9210.  
  9211. private void method115() {
  9212. if (loadingStage == 2) {
  9213. for (Class30_Sub1 class30_sub1 = (Class30_Sub1) getaClass19_1179().reverseGetFirst(); class30_sub1 != null; class30_sub1 = (Class30_Sub1) getaClass19_1179().reverseGetNext()) {
  9214. if (class30_sub1.anInt1294 > 0) {
  9215. class30_sub1.anInt1294--;
  9216. }
  9217. if (class30_sub1.anInt1294 == 0) {
  9218. if (class30_sub1.anInt1299 < 0 || ObjectManager.method178(class30_sub1.anInt1299, class30_sub1.anInt1301)) {
  9219. method142(class30_sub1.anInt1298, class30_sub1.anInt1295, class30_sub1.anInt1300, class30_sub1.anInt1301, class30_sub1.anInt1297, class30_sub1.anInt1296, class30_sub1.anInt1299);
  9220. class30_sub1.unlink();
  9221. }
  9222. } else {
  9223. if (class30_sub1.anInt1302 > 0) {
  9224. class30_sub1.anInt1302--;
  9225. }
  9226. 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))) {
  9227. method142(class30_sub1.anInt1298, class30_sub1.anInt1295, class30_sub1.anInt1292, class30_sub1.anInt1293, class30_sub1.anInt1297, class30_sub1.anInt1296, class30_sub1.anInt1291);
  9228. class30_sub1.anInt1302 = -1;
  9229. if (class30_sub1.anInt1291 == class30_sub1.anInt1299 && class30_sub1.anInt1299 == -1) {
  9230. class30_sub1.unlink();
  9231. } else if (class30_sub1.anInt1291 == class30_sub1.anInt1299 && class30_sub1.anInt1292 == class30_sub1.anInt1300 && class30_sub1.anInt1293 == class30_sub1.anInt1301) {
  9232. class30_sub1.unlink();
  9233. }
  9234. }
  9235. }
  9236. }
  9237.  
  9238. }
  9239. }
  9240.  
  9241. private void updatePlayerMovement(ByteBuffer stream) {
  9242. stream.initBitAccess();
  9243. int j = stream.getBits(1);
  9244. if (j == 0) {
  9245. return;
  9246. }
  9247. int k = stream.getBits(2);
  9248. if (k == 0) {
  9249. anIntArray894[anInt893++] = getMyPlayerIndex();
  9250. return;
  9251. }
  9252. if (k == 1) {
  9253. int l = stream.getBits(3);
  9254. myPlayer.moveInDir(false, l);
  9255. int k1 = stream.getBits(1);
  9256. if (k1 == 1) {
  9257. anIntArray894[anInt893++] = getMyPlayerIndex();
  9258. }
  9259. return;
  9260. }
  9261. if (k == 2) {
  9262. int i1 = stream.getBits(3);
  9263. myPlayer.moveInDir(true, i1);
  9264. int l1 = stream.getBits(3);
  9265. myPlayer.moveInDir(true, l1);
  9266. int j2 = stream.getBits(1);
  9267. if (j2 == 1) {
  9268. anIntArray894[anInt893++] = getMyPlayerIndex();
  9269. }
  9270. return;
  9271. }
  9272. if (k == 3) {
  9273. plane = stream.getBits(2);
  9274. if(getLastKnownPlane() != plane)
  9275. loadingStage = 1;
  9276. setLastKnownPlane(plane);
  9277. int j1 = stream.getBits(1);
  9278. int i2 = stream.getBits(1);
  9279. if (i2 == 1) {
  9280. anIntArray894[anInt893++] = getMyPlayerIndex();
  9281. }
  9282. int k2 = stream.getBits(7);
  9283. int l2 = stream.getBits(7);
  9284. myPlayer.setPos(l2, k2, j1 == 1);
  9285. }
  9286. }
  9287.  
  9288. private boolean withdrawingMoneyFromPouch;
  9289.  
  9290. private boolean processInterfaceAnimation(int i, int j) {
  9291. boolean flag1 = false;
  9292. if(j < 0 || j > RSInterface.interfaceCache.length) {
  9293. return false;
  9294. }
  9295. RSInterface class9 = RSInterface.interfaceCache[j];
  9296. if (class9 == null)
  9297. return false;
  9298. if (class9.children == null)
  9299. return false;
  9300. for (int element : class9.children) {
  9301. if (element == -1) {
  9302. break;
  9303. }
  9304. RSInterface class9_1 = RSInterface.interfaceCache[element];
  9305. if (class9_1.type == 1) {
  9306. flag1 |= processInterfaceAnimation(i, class9_1.id);
  9307. }
  9308. if (class9_1.type == 6 && (class9_1.disabledAnimationId != -1 || class9_1.enabledAnimationId != -1)) {
  9309. boolean flag2 = interfaceIsSelected(class9_1);
  9310. int l;
  9311. if (flag2) {
  9312. l = class9_1.enabledAnimationId;
  9313. } else {
  9314. l = class9_1.disabledAnimationId;
  9315. }
  9316. if (l != -1) {
  9317. Animation animation = Animation.cache[l];
  9318. for (class9_1.anInt208 += i; class9_1.anInt208 > animation.getFrameLength(class9_1.anInt246);) {
  9319. class9_1.anInt208 -= animation.getFrameLength(class9_1.anInt246) + 1;
  9320. class9_1.anInt246++;
  9321. if (class9_1.anInt246 >= animation.frameCount) {
  9322. class9_1.anInt246 -= animation.loopDelay;
  9323. if (class9_1.anInt246 < 0 || class9_1.anInt246 >= animation.frameCount) {
  9324. class9_1.anInt246 = 0;
  9325. }
  9326. }
  9327. flag1 = true;
  9328. }
  9329.  
  9330. }
  9331. }
  9332. }
  9333.  
  9334. return flag1;
  9335. }
  9336.  
  9337. private int method120() {
  9338. int j = 3;
  9339. if (yCameraCurve < 310) {
  9340. int k = xCameraPos >> 7;
  9341. int l = yCameraPos >> 7;
  9342. int i1 = myPlayer.x >> 7;
  9343. int j1 = myPlayer.y >> 7;
  9344. if ((byteGroundArray[plane][k][l] & 4) != 0) {
  9345. j = plane;
  9346. }
  9347. int k1;
  9348. if (i1 > k) {
  9349. k1 = i1 - k;
  9350. } else {
  9351. k1 = k - i1;
  9352. }
  9353. int l1;
  9354. if (j1 > l) {
  9355. l1 = j1 - l;
  9356. } else {
  9357. l1 = l - j1;
  9358. }
  9359. if (k1 > l1) {
  9360. int i2 = l1 * 0x10000 / k1;
  9361. int k2 = 32768;
  9362. while (k != i1) {
  9363. if (k < i1) {
  9364. k++;
  9365. } else if (k > i1) {
  9366. k--;
  9367. }
  9368. if ((byteGroundArray[plane][k][l] & 4) != 0) {
  9369. j = plane;
  9370. }
  9371. k2 += i2;
  9372. if (k2 >= 0x10000) {
  9373. k2 -= 0x10000;
  9374. if (l < j1) {
  9375. l++;
  9376. } else if (l > j1) {
  9377. l--;
  9378. }
  9379. if ((byteGroundArray[plane][k][l] & 4) != 0) {
  9380. j = plane;
  9381. }
  9382. }
  9383. }
  9384. } else {
  9385. int j2 = k1 * 0x10000 / l1;
  9386. int l2 = 32768;
  9387. while (l != j1) {
  9388. if (l < j1) {
  9389. l++;
  9390. } else if (l > j1) {
  9391. l--;
  9392. }
  9393. if ((byteGroundArray[plane][k][l] & 4) != 0) {
  9394. j = plane;
  9395. }
  9396. l2 += j2;
  9397. if (l2 >= 0x10000) {
  9398. l2 -= 0x10000;
  9399. if (k < i1) {
  9400. k++;
  9401. } else if (k > i1) {
  9402. k--;
  9403. }
  9404. if ((byteGroundArray[plane][k][l] & 4) != 0) {
  9405. j = plane;
  9406. }
  9407. }
  9408. }
  9409. }
  9410. }
  9411. if ((byteGroundArray[plane][myPlayer.x >> 7][myPlayer.y >> 7] & 4) != 0) {
  9412. j = plane;
  9413. }
  9414. return j;
  9415. }
  9416.  
  9417. private int method121() {
  9418. int j = method42(plane, yCameraPos, xCameraPos);
  9419. if (j - zCameraPos < 800 && (byteGroundArray[plane][xCameraPos >> 7][yCameraPos >> 7] & 4) != 0) {
  9420. return plane;
  9421. } else {
  9422. return 3;
  9423. }
  9424. }
  9425.  
  9426. private void method130(int j, int k, int l, int i1, int j1, int k1, int l1, int i2, int j2) {
  9427. Class30_Sub1 class30_sub1 = null;
  9428. for (Class30_Sub1 class30_sub1_1 = (Class30_Sub1) getaClass19_1179().reverseGetFirst(); class30_sub1_1 != null; class30_sub1_1 = (Class30_Sub1) getaClass19_1179().reverseGetNext()) {
  9429. if (class30_sub1_1.anInt1295 != l1 || class30_sub1_1.anInt1297 != i2 || class30_sub1_1.anInt1298 != j1 || class30_sub1_1.anInt1296 != i1) {
  9430. continue;
  9431. }
  9432. class30_sub1 = class30_sub1_1;
  9433. break;
  9434. }
  9435.  
  9436. if (class30_sub1 == null) {
  9437. class30_sub1 = new Class30_Sub1();
  9438. class30_sub1.anInt1295 = l1;
  9439. class30_sub1.anInt1296 = i1;
  9440. class30_sub1.anInt1297 = i2;
  9441. class30_sub1.anInt1298 = j1;
  9442. method89(class30_sub1);
  9443. getaClass19_1179().insertHead(class30_sub1);
  9444. }
  9445. class30_sub1.anInt1291 = k;
  9446. class30_sub1.anInt1293 = k1;
  9447. class30_sub1.anInt1292 = l;
  9448. class30_sub1.anInt1302 = j2;
  9449. class30_sub1.anInt1294 = j;
  9450. }
  9451.  
  9452. private void updatePlayer(ByteBuffer stream) {
  9453. int j = stream.getBits(8);
  9454. if (j < playerCount) {
  9455. for (int k = j; k < playerCount; k++) {
  9456. anIntArray840[anInt839++] = playerIndices[k];
  9457. }
  9458.  
  9459. }
  9460. if (j > playerCount) {
  9461. Signlink.reportError(myUsername + " Too many players");
  9462. throw new RuntimeException("eek");
  9463. }
  9464. playerCount = 0;
  9465. for (int l = 0; l < j; l++) {
  9466. int i1 = playerIndices[l];
  9467. Player player = playerArray[i1];
  9468. int j1 = stream.getBits(1);
  9469. if (j1 == 0) {
  9470. playerIndices[playerCount++] = i1;
  9471. player.anInt1537 = loopCycle;
  9472. } else {
  9473. int k1 = stream.getBits(2);
  9474. if (k1 == 0) {
  9475. playerIndices[playerCount++] = i1;
  9476. player.anInt1537 = loopCycle;
  9477. anIntArray894[anInt893++] = i1;
  9478. } else if (k1 == 1) {
  9479. playerIndices[playerCount++] = i1;
  9480. player.anInt1537 = loopCycle;
  9481. int l1 = stream.getBits(3);
  9482. player.moveInDir(false, l1);
  9483. int j2 = stream.getBits(1);
  9484. if (j2 == 1) {
  9485. anIntArray894[anInt893++] = i1;
  9486. }
  9487. } else if (k1 == 2) {
  9488. playerIndices[playerCount++] = i1;
  9489. player.anInt1537 = loopCycle;
  9490. int i2 = stream.getBits(3);
  9491. player.moveInDir(true, i2);
  9492. int k2 = stream.getBits(3);
  9493. player.moveInDir(true, k2);
  9494. int l2 = stream.getBits(1);
  9495. if (l2 == 1) {
  9496. anIntArray894[anInt893++] = i1;
  9497. }
  9498. } else if (k1 == 3) {
  9499. anIntArray840[anInt839++] = i1;
  9500. }
  9501. }
  9502. }
  9503. }
  9504.  
  9505. private void parseEntityPacket(ByteBuffer stream, int j) {
  9506. if (j == 84) {
  9507. int k = stream.getUnsignedByte();
  9508. int j3 = anInt1268 + (k >> 4 & 7);
  9509. int i6 = anInt1269 + (k & 7);
  9510. int l8 = stream.getUnsignedShort();
  9511. int k11 = stream.getUnsignedShort();
  9512. int l13 = stream.getUnsignedShort();
  9513. if (j3 >= 0 && i6 >= 0 && j3 < 104 && i6 < 104) {
  9514. Deque class19_1 = groundArray[plane][j3][i6];
  9515. if (class19_1 != null) {
  9516. 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()) {
  9517. if (class30_sub2_sub4_sub2_3.id != (l8 & 0x7fff) || class30_sub2_sub4_sub2_3.amount != k11) {
  9518. continue;
  9519. }
  9520. class30_sub2_sub4_sub2_3.amount = l13;
  9521. break;
  9522. }
  9523.  
  9524. spawnGroundItem(j3, i6);
  9525. }
  9526. }
  9527. return;
  9528. }
  9529. if (j == 105) {
  9530. int l = stream.getUnsignedByte();
  9531. int k3 = anInt1268 + (l >> 4 & 7);
  9532. int j6 = anInt1269 + (l & 7);
  9533. int i9 = stream.getUnsignedShort();
  9534. int l11 = stream.getUnsignedByte();
  9535. int i14 = l11 >> 4 & 0xf;
  9536. int i16 = l11 & 7;
  9537. if (myPlayer.smallX[0] >= k3 - i14 && myPlayer.smallX[0] <= k3 + i14 && myPlayer.smallY[0] >= j6 - i14 && myPlayer.smallY[0] <= j6 + i14 && soundEffectVolume != 0 && aBoolean848 && !isLowDetail() && soundCount < 50) {
  9538. sound[soundCount] = i9;
  9539. soundType[soundCount] = i16;
  9540. soundDelay[soundCount] = Sounds.anIntArray326[i9];
  9541. aClass26Array1468[soundCount] = null;
  9542. soundCount++;
  9543. }
  9544. }
  9545. if (j == 215) {
  9546. int i1 = stream.method435();
  9547. int l3 = stream.method428();
  9548. int k6 = anInt1268 + (l3 >> 4 & 7);
  9549. int j9 = anInt1269 + (l3 & 7);
  9550. int i12 = stream.method435();
  9551. int j14 = stream.getUnsignedShort();
  9552. if (k6 >= 0 && j9 >= 0 && k6 < 104 && j9 < 104 && i12 != playerId) {
  9553. Item class30_sub2_sub4_sub2_2 = new Item();
  9554. class30_sub2_sub4_sub2_2.id = i1;
  9555. class30_sub2_sub4_sub2_2.amount = j14;
  9556. if (groundArray[plane][k6][j9] == null) {
  9557. groundArray[plane][k6][j9] = new Deque();
  9558. }
  9559. groundArray[plane][k6][j9].insertHead(class30_sub2_sub4_sub2_2);
  9560. spawnGroundItem(k6, j9);
  9561. }
  9562. return;
  9563. }
  9564. if (j == 156) {
  9565. int j1 = stream.method426();
  9566. int i4 = anInt1268 + (j1 >> 4 & 7);
  9567. int l6 = anInt1269 + (j1 & 7);
  9568. int k9 = stream.getUnsignedShort();
  9569. if (i4 >= 0 && l6 >= 0 && i4 < 104 && l6 < 104) {
  9570. Deque class19 = groundArray[plane][i4][l6];
  9571. if (class19 != null) {
  9572. for (Item item = (Item) class19.reverseGetFirst(); item != null; item = (Item) class19.reverseGetNext()) {
  9573. if (item.id != (k9 & 0x7fff)) {
  9574. continue;
  9575. }
  9576. item.unlink();
  9577. break;
  9578. }
  9579.  
  9580. if (class19.reverseGetFirst() == null) {
  9581. groundArray[plane][i4][l6] = null;
  9582. }
  9583. spawnGroundItem(i4, l6);
  9584. }
  9585. }
  9586. return;
  9587. }
  9588. if (j == 160) {
  9589. int k1 = stream.method428();
  9590. int j4 = anInt1268 + (k1 >> 4 & 7);
  9591. int i7 = anInt1269 + (k1 & 7);
  9592. int l9 = stream.method428();
  9593. int j12 = l9 >> 2;
  9594. int k14 = l9 & 3;
  9595. int objectType = anIntArray1177[j12];
  9596. int j17 = stream.method435();
  9597. if (j4 >= 0 && i7 >= 0 && j4 < 103 && i7 < 103) {
  9598. int j18 = intGroundArray[plane][j4][i7];
  9599. int i19 = intGroundArray[plane][j4 + 1][i7];
  9600. int l19 = intGroundArray[plane][j4 + 1][i7 + 1];
  9601. int k20 = intGroundArray[plane][j4][i7 + 1];
  9602. if (objectType == 0) {
  9603. Object1 class10 = worldController.method296(plane, j4, i7);
  9604. if (class10 != null) {
  9605. int k21 = class10.uid >> 14 & 0x7fff;
  9606. if (j12 == 2) {
  9607. class10.aClass30_Sub2_Sub4_278 = new Animable_Sub5(k21, 4 + k14, 2, i19, l19, j18, k20, j17, false);
  9608. class10.aClass30_Sub2_Sub4_279 = new Animable_Sub5(k21, k14 + 1 & 3, 2, i19, l19, j18, k20, j17, false);
  9609. } else {
  9610. class10.aClass30_Sub2_Sub4_278 = new Animable_Sub5(k21, k14, j12, i19, l19, j18, k20, j17, false);
  9611. }
  9612. }
  9613. }
  9614.  
  9615. if (objectType == 1) {
  9616. Object2 class26 = worldController.method297(j4, i7, plane);
  9617. if (class26 != null) {
  9618. class26.aClass30_Sub2_Sub4_504 = new Animable_Sub5(class26.uid >> 14 & 0x7fff, 0, 4, i19, l19, j18, k20, j17, false);
  9619. }
  9620. }
  9621.  
  9622. if (objectType == 2) {
  9623. Object5 class28 = worldController.method298(j4, i7, plane);
  9624.  
  9625. if (j12 == 11) {
  9626. j12 = 10;
  9627. }
  9628.  
  9629. if (class28 != null) {
  9630. class28.aClass30_Sub2_Sub4_521 = new Animable_Sub5(class28.uid >> 14 & 0x7fff, k14, j12, i19, l19, j18, k20, j17, false);
  9631. }
  9632. }
  9633.  
  9634. if (objectType == 3) {
  9635. Object3 class49 = worldController.method299(i7, j4, plane);
  9636.  
  9637. if (class49 != null) {
  9638. class49.aClass30_Sub2_Sub4_814 = new Animable_Sub5(class49.uid >> 14 & 0x7fff, k14, 22, i19, l19, j18, k20, j17, false);
  9639. }
  9640. }
  9641. }
  9642.  
  9643. return;
  9644. }
  9645.  
  9646. if (j == 147) {
  9647. int l1 = stream.method428();
  9648. int k4 = anInt1268 + (l1 >> 4 & 7);
  9649. int j7 = anInt1269 + (l1 & 7);
  9650. int i10 = stream.getUnsignedShort();
  9651. byte byte0 = stream.method430();
  9652. int l14 = stream.getShortBigEndian();
  9653. byte byte1 = stream.method429();
  9654. int k17 = stream.getUnsignedShort();
  9655. int k18 = stream.method428();
  9656. int j19 = k18 >> 2;
  9657. int i20 = k18 & 3;
  9658. int l20 = anIntArray1177[j19];
  9659. byte byte2 = stream.getSignedByte();
  9660. int l21 = stream.getUnsignedShort();
  9661. byte byte3 = stream.method429();
  9662. Player player;
  9663.  
  9664. if (i10 == playerId) {
  9665. player = myPlayer;
  9666. } else {
  9667. player = playerArray[i10];
  9668. }
  9669.  
  9670. if (player != null) {
  9671. ObjectDefinition class46 = ObjectDefinition.forID(l21);
  9672. int i22 = intGroundArray[plane][k4][j7];
  9673. int j22 = intGroundArray[plane][k4 + 1][j7];
  9674. int k22 = intGroundArray[plane][k4 + 1][j7 + 1];
  9675. int l22 = intGroundArray[plane][k4][j7 + 1];
  9676. Model model = class46.renderObject(j19, i20, i22, j22, k22, l22, -1);
  9677.  
  9678. if (model != null) {
  9679. method130(k17 + 1, -1, 0, l20, j7, 0, plane, k4, l14 + 1);
  9680. player.anInt1707 = l14 + loopCycle;
  9681. player.anInt1708 = k17 + loopCycle;
  9682. player.aModel_1714 = model;
  9683. int i23 = class46.sizeX;
  9684. int j23 = class46.sizeY;
  9685.  
  9686. if (i20 == 1 || i20 == 3) {
  9687. i23 = class46.sizeY;
  9688. j23 = class46.sizeX;
  9689. }
  9690.  
  9691. player.anInt1711 = k4 * 128 + i23 * 64;
  9692. player.anInt1713 = j7 * 128 + j23 * 64;
  9693. player.anInt1712 = method42(plane, player.anInt1713, player.anInt1711);
  9694.  
  9695. if (byte2 > byte0) {
  9696. byte byte4 = byte2;
  9697. byte2 = byte0;
  9698. byte0 = byte4;
  9699. }
  9700.  
  9701. if (byte3 > byte1) {
  9702. byte byte5 = byte3;
  9703. byte3 = byte1;
  9704. byte1 = byte5;
  9705. }
  9706.  
  9707. player.anInt1719 = k4 + byte2;
  9708. player.anInt1721 = k4 + byte0;
  9709. player.anInt1720 = j7 + byte3;
  9710. player.anInt1722 = j7 + byte1;
  9711. }
  9712. }
  9713. }
  9714.  
  9715. if (j == 151) {
  9716. int i2 = stream.method426();
  9717. int l4 = anInt1268 + (i2 >> 4 & 7);
  9718. int k7 = anInt1269 + (i2 & 7);
  9719. int objectId = stream.getShortBigEndian();
  9720. int k12 = stream.method428();
  9721. int i15 = k12 >> 2;
  9722. int k16 = k12 & 3;
  9723. int l17 = anIntArray1177[i15];
  9724. if (objectId < -1) {
  9725. objectId = Short.MAX_VALUE + -objectId;
  9726. }
  9727.  
  9728. if (l4 >= 0 && k7 >= 0 && l4 < 104 && k7 < 104) {
  9729. method130(-1, objectId, k16, l17, k7, i15, plane, l4, 0);
  9730. }
  9731.  
  9732. return;
  9733. }
  9734.  
  9735. if (j == 4) {
  9736. int j2 = stream.getUnsignedByte();
  9737. int i5 = anInt1268 + (j2 >> 4 & 7);
  9738. int l7 = anInt1269 + (j2 & 7);
  9739. int k10 = stream.getUnsignedShort();
  9740. int l12 = stream.getUnsignedByte();
  9741. int j15 = stream.getUnsignedShort();
  9742.  
  9743. if (i5 >= 0 && l7 >= 0 && i5 < 104 && l7 < 104) {
  9744. i5 = i5 * 128 + 64;
  9745. l7 = l7 * 128 + 64;
  9746. Animable_Sub3 class30_sub2_sub4_sub3 = new Animable_Sub3(plane, loopCycle, j15, k10, method42(plane, l7, i5) - l12, l7, i5);
  9747. getaClass19_1056().insertHead(class30_sub2_sub4_sub3);
  9748. }
  9749.  
  9750. return;
  9751. }
  9752.  
  9753. if (j == 44) {
  9754. int k2 = stream.getShortBigEndianA();
  9755. int j5 = stream.getUnsignedShort();
  9756. int i8 = stream.getUnsignedByte();
  9757. int l10 = anInt1268 + (i8 >> 4 & 7);
  9758. int i13 = anInt1269 + (i8 & 7);
  9759.  
  9760. if (l10 >= 0 && i13 >= 0 && l10 < 104 && i13 < 104) {
  9761. Item class30_sub2_sub4_sub2_1 = new Item();
  9762. class30_sub2_sub4_sub2_1.id = k2;
  9763. class30_sub2_sub4_sub2_1.amount = j5;
  9764.  
  9765. if (groundArray[plane][l10][i13] == null) {
  9766. groundArray[plane][l10][i13] = new Deque();
  9767. }
  9768.  
  9769. groundArray[plane][l10][i13].insertHead(class30_sub2_sub4_sub2_1);
  9770. spawnGroundItem(l10, i13);
  9771. }
  9772.  
  9773. return;
  9774. }
  9775.  
  9776. if (j == 101) {
  9777. int l2 = stream.method427();
  9778. int k5 = l2 >> 2;
  9779. int j8 = l2 & 3;
  9780. int i11 = anIntArray1177[k5];
  9781. int j13 = stream.getUnsignedByte();
  9782. int k15 = anInt1268 + (j13 >> 4 & 7);
  9783. int l16 = anInt1269 + (j13 & 7);
  9784.  
  9785. if (k15 >= 0 && l16 >= 0 && k15 < 104 && l16 < 104) {
  9786. method130(-1, -1, j8, i11, l16, k5, plane, k15, 0);
  9787. }
  9788.  
  9789. return;
  9790. }
  9791.  
  9792. if (j == 117) {
  9793. int i3 = stream.getUnsignedByte();
  9794. int l5 = anInt1268 + (i3 >> 4 & 7);
  9795. int k8 = anInt1269 + (i3 & 7);
  9796. int j11 = l5 + stream.getSignedByte();
  9797. int k13 = k8 + stream.getSignedByte();
  9798. int l15 = stream.getSignedShort();
  9799. int i17 = stream.getUnsignedShort();
  9800. int i18 = stream.getUnsignedByte() * 4;
  9801. int l18 = stream.getUnsignedByte() * 4;
  9802. int k19 = stream.getUnsignedShort();
  9803. int j20 = stream.getUnsignedShort();
  9804. int i21 = stream.getUnsignedByte();
  9805. int j21 = stream.getUnsignedByte();
  9806.  
  9807. if (l5 >= 0 && k8 >= 0 && l5 < 104 && k8 < 104 && j11 >= 0 && k13 >= 0 && j11 < 104 && k13 < 104 && i17 != 65535) {
  9808. l5 = l5 * 128 + 64;
  9809. k8 = k8 * 128 + 64;
  9810. j11 = j11 * 128 + 64;
  9811. k13 = k13 * 128 + 64;
  9812. PlayerProjectile class30_sub2_sub4_sub4 = new PlayerProjectile(i21, l18, k19 + loopCycle, j20 + loopCycle, j21, plane, method42(plane, k8, l5) - i18, k8, l5, l15, i17);
  9813. class30_sub2_sub4_sub4.method455(k19 + loopCycle, k13, method42(plane, k13, j11) - l18, j11);
  9814. getaClass19_1013().insertHead(class30_sub2_sub4_sub4);
  9815. }
  9816. }
  9817. }
  9818.  
  9819. private void updateNpcAmount(ByteBuffer stream) {
  9820. stream.initBitAccess();
  9821. int k = stream.getBits(8);
  9822.  
  9823. if (k < npcCount) {
  9824. for (int l = k; l < npcCount; l++) {
  9825. anIntArray840[anInt839++] = npcIndices[l];
  9826. }
  9827. }
  9828.  
  9829. if (k > npcCount) {
  9830. Signlink.reportError(myUsername + " Too many npcs");
  9831. throw new RuntimeException("eek");
  9832. }
  9833.  
  9834. npcCount = 0;
  9835.  
  9836. for (int i1 = 0; i1 < k; i1++) {
  9837. int j1 = npcIndices[i1];
  9838. NPC npc = npcArray[j1];
  9839. int k1 = stream.getBits(1);
  9840.  
  9841. if (k1 == 0) {
  9842. npcIndices[npcCount++] = j1;
  9843. npc.anInt1537 = loopCycle;
  9844. } else {
  9845. int l1 = stream.getBits(2);
  9846.  
  9847. if (l1 == 0) {
  9848. npcIndices[npcCount++] = j1;
  9849. npc.anInt1537 = loopCycle;
  9850. anIntArray894[anInt893++] = j1;
  9851. } else if (l1 == 1) {
  9852. npcIndices[npcCount++] = j1;
  9853. npc.anInt1537 = loopCycle;
  9854. int i2 = stream.getBits(3);
  9855. npc.moveInDir(false, i2);
  9856. int k2 = stream.getBits(1);
  9857.  
  9858. if (k2 == 1) {
  9859. anIntArray894[anInt893++] = j1;
  9860. }
  9861. } else if (l1 == 2) {
  9862. npcIndices[npcCount++] = j1;
  9863. npc.anInt1537 = loopCycle;
  9864. int j2 = stream.getBits(3);
  9865. npc.moveInDir(true, j2);
  9866. int l2 = stream.getBits(3);
  9867. npc.moveInDir(true, l2);
  9868. int i3 = stream.getBits(1);
  9869.  
  9870. if (i3 == 1) {
  9871. anIntArray894[anInt893++] = j1;
  9872. }
  9873. } else if (l1 == 3) {
  9874. anIntArray840[anInt839++] = j1;
  9875. }
  9876. }
  9877. }
  9878. }
  9879.  
  9880. private void method142(int i, int j, int k, int l, int i1, int j1, int k1) {
  9881. if (i1 >= 1 && i >= 1 && i1 <= 102 && i <= 102) {
  9882. if (isLowDetail() && j != plane) {
  9883. return;
  9884. }
  9885.  
  9886. int i2 = 0;
  9887.  
  9888. if (j1 == 0) {
  9889. i2 = worldController.method300(j, i1, i);
  9890. }
  9891.  
  9892. if (j1 == 1) {
  9893. i2 = worldController.method301(j, i1, i);
  9894. }
  9895.  
  9896. if (j1 == 2) {
  9897. i2 = worldController.method302(j, i1, i);
  9898. }
  9899.  
  9900. if (j1 == 3) {
  9901. i2 = worldController.method303(j, i1, i);
  9902. }
  9903.  
  9904. if (i2 != 0) {
  9905. int i3 = worldController.fetchObjectIDTagForPosition(j, i1, i, i2);
  9906. int j2 = i2 >> 14 & 0x7fff;
  9907. int k2 = i3 & 0x1f;
  9908. int l2 = i3 >> 6;
  9909.  
  9910. if (j1 == 0) {
  9911. worldController.method291(i1, j, i, (byte) -119);
  9912. ObjectDefinition class46 = ObjectDefinition.forID(j2);
  9913.  
  9914. if (class46.isUnwalkable) {
  9915. clippingPlanes[j].method215(l2, k2, class46.aBoolean757, i1, i);
  9916. }
  9917. }
  9918.  
  9919. if (j1 == 1) {
  9920. worldController.method292(i, j, i1);
  9921. }
  9922.  
  9923. if (j1 == 2) {
  9924. worldController.method293(j, i1, i);
  9925. ObjectDefinition class46_1 = ObjectDefinition.forID(j2);
  9926.  
  9927. if (i1 + class46_1.sizeX > 103 || i + class46_1.sizeX > 103 || i1 + class46_1.sizeY > 103 || i + class46_1.sizeY > 103) {
  9928. return;
  9929. }
  9930.  
  9931. if (class46_1.isUnwalkable) {
  9932. clippingPlanes[j].method216(l2, class46_1.sizeX, i1, i, class46_1.sizeY, class46_1.aBoolean757);
  9933. }
  9934. }
  9935.  
  9936. if (j1 == 3) {
  9937. worldController.method294(j, i, i1);
  9938. ObjectDefinition class46_2 = ObjectDefinition.forID(j2);
  9939.  
  9940. if (class46_2.isUnwalkable && class46_2.hasActions) {
  9941. clippingPlanes[j].method218(i, i1);
  9942. }
  9943. }
  9944. }
  9945.  
  9946. if (k1 >= 0) {
  9947. int j3 = j;
  9948.  
  9949. if (j3 < 3 && (byteGroundArray[1][i1][i] & 2) == 2) {
  9950. j3++;
  9951. }
  9952.  
  9953. if (j == 4) {
  9954. j = 0;
  9955. }
  9956. ObjectManager.method188(worldController, k, i, l, j3, clippingPlanes[j], intGroundArray, i1, k1, j);
  9957. }
  9958. }
  9959. }
  9960.  
  9961. private void method146() {
  9962. anInt1265++;
  9963. int j = 0;
  9964. int l = xCameraPos;
  9965. int i1 = zCameraPos;
  9966. int j1 = yCameraPos;
  9967. int k1 = yCameraCurve;
  9968. int l1 = xCameraCurve;
  9969.  
  9970. if (loggedIn) {
  9971. method47(true);
  9972. method26(true);
  9973. method47(false);
  9974. method26(false);
  9975. method55();
  9976. method104();
  9977.  
  9978. if (!cameraViewChanged) {
  9979. int i = cameraRotationZ;
  9980.  
  9981. if (anInt984 / 256 > i) {
  9982. i = anInt984 / 256;
  9983. }
  9984.  
  9985. if (aBooleanArray876[4] && anIntArray1203[4] + 128 > i) {
  9986. i = anIntArray1203[4] + 128;
  9987. }
  9988.  
  9989. if (Configuration.TOGGLE_FOV) {
  9990. log_view_dist = getScreenWidth() >= 1024 ? 10 : 9;
  9991. } else {
  9992. log_view_dist = 9;
  9993. }
  9994. int k = viewRotation + viewRotationOffset & 0x7ff;
  9995. int zoom = i + (Configuration.TOGGLE_FOV ? 1200 : 650) - getScreenHeight() / 400;
  9996. zoom += clientZoom;
  9997. setCameraPos(GameFrame.getScreenMode() == ScreenMode.FIXED ? 600 + i * 3 + clientZoom : getScreenWidth() >= 1024 ? zoom : 450 + i * 3 + clientZoom, i, currentCameraDisplayX, method42(plane, myPlayer.y, myPlayer.x) - 50, k, currentCameraDisplayY);
  9998. }
  9999.  
  10000. if (!cameraViewChanged) {
  10001. j = method120();
  10002. } else {
  10003. j = method121();
  10004. }
  10005.  
  10006. }
  10007.  
  10008. int k2 = Rasterizer.anInt1481;
  10009. Model.aBoolean1684 = true;
  10010. Model.anInt1687 = 0;
  10011. Model.anInt1685 = super.mouseX - 4;
  10012. Model.anInt1686 = super.mouseY - 4;
  10013.  
  10014. //blue fog: 0x5DA4C9, white: 0xc8c0a8
  10015. DrawingArea.drawPixels(getScreenHeight(), 0, 0, Configuration.FOG_ENABLED ? 0x5DA4C9 : 0, getScreenWidth());
  10016. // DrawingArea.drawAlphaGradient(0, 0, getScreenWidth(),
  10017. // getScreenHeight(), 0x5DA4C9, 0x9DA4C2, 255);
  10018.  
  10019. if (loggedIn) {
  10020. worldController.method313(xCameraPos, yCameraPos, xCameraCurve, zCameraPos, j, yCameraCurve, Configuration.FOG_ENABLED);
  10021. worldController.clearObj5Cache();
  10022. }
  10023.  
  10024. updateEntities();
  10025. drawHeadIcon();
  10026. method37(k2);
  10027.  
  10028. if (GameFrame.getScreenMode() != ScreenMode.FIXED && loggedIn) {
  10029. drawTabArea();
  10030. drawChatArea();
  10031. drawMinimap();
  10032. }
  10033.  
  10034. if (loggedIn) {
  10035. draw3dScreen();
  10036. drawConsoleArea();
  10037. drawConsole();
  10038. }
  10039.  
  10040. if (loggedIn && Configuration.MONEY_POUCH_ENABLED) {
  10041. mapArea.displayMoneyPouch(this);
  10042. }
  10043.  
  10044. if (PlayerHandler.showXP && loggedIn) {
  10045. mapArea.displayXPCounter(this);
  10046. }
  10047.  
  10048. if (loggedIn) {
  10049. if (!resizing) {
  10050. gameScreenIP.drawGraphics(gameScreenDrawY, super.graphics, gameScreenDrawX);
  10051. }
  10052. xCameraPos = l;
  10053. zCameraPos = i1;
  10054. yCameraPos = j1;
  10055. yCameraCurve = k1;
  10056. xCameraCurve = l1;
  10057. }
  10058. }
  10059.  
  10060. public int positions[] = new int[2000];
  10061. public int landScapes[] = new int[2000];
  10062. public int objects[] = new int[2000];
  10063. private int[] menuActionCmd4;
  10064. private boolean isLoading;
  10065.  
  10066. private void loadRegion() {
  10067. try {
  10068. setLastKnownPlane(-1);
  10069. getaClass19_1056().removeAll();
  10070. getaClass19_1013().removeAll();
  10071. Rasterizer.method366();
  10072. unlinkMRUNodes();
  10073. worldController.initToNull();
  10074. System.gc();
  10075.  
  10076. for (int i = 0; i < 4; i++) {
  10077. clippingPlanes[i].method210();
  10078. }
  10079.  
  10080. for (int l = 0; l < 4; l++) {
  10081. for (int k1 = 0; k1 < 104; k1++) {
  10082. for (int j2 = 0; j2 < 104; j2++) {
  10083. byteGroundArray[l][k1][j2] = 0;
  10084. }
  10085. }
  10086. }
  10087.  
  10088. ObjectManager objectManager = new ObjectManager(byteGroundArray, intGroundArray);
  10089. int k2 = aByteArrayArray1183.length;
  10090. for (int i1 = 0; i1 < k2; i1++) {
  10091. for (int i2 = 0; i2 < 2000; i2++) {
  10092. if (anIntArray1234[i1] == positions[i2]) {
  10093. floorMap[i1] = landScapes[i2];
  10094. objectMap[i1] = objects[i2];
  10095. }
  10096. }
  10097. }
  10098.  
  10099. if (loggedIn) {
  10100. getOut().putOpcode(0);
  10101. }
  10102.  
  10103. if (!aBoolean1159) {
  10104. for (int i3 = 0; i3 < k2; i3++) {
  10105. int i4 = (anIntArray1234[i3] >> 8) * 64 - baseX;
  10106. int k5 = (anIntArray1234[i3] & 0xff) * 64 - baseY;
  10107. byte abyte0[] = aByteArrayArray1183[i3];
  10108. if (abyte0 != null) {
  10109. objectManager.method180(abyte0, k5, i4, (anInt1069 - 6) * 8, (anInt1070 - 6) * 8, clippingPlanes);
  10110. }
  10111. }
  10112.  
  10113. for (int j4 = 0; j4 < k2; j4++) {
  10114. int l5 = (anIntArray1234[j4] >> 8) * 62 - baseX;
  10115. int k7 = (anIntArray1234[j4] & 0xff) * 62 - baseY;
  10116. byte abyte2[] = aByteArrayArray1183[j4];
  10117.  
  10118. if (abyte2 == null && anInt1070 < 800) {
  10119. objectManager.method174(k7, 64, 64, l5);
  10120. }
  10121. }
  10122.  
  10123. if (loggedIn) {
  10124. getOut().putOpcode(0);
  10125. }
  10126.  
  10127. for (int i6 = 0; i6 < k2; i6++) {
  10128. byte abyte1[] = aByteArrayArray1247[i6];
  10129. if (abyte1 != null) {
  10130. int l8 = (anIntArray1234[i6] >> 8) * 64 - baseX;
  10131. int k9 = (anIntArray1234[i6] & 0xff) * 64 - baseY;
  10132. objectManager.method190(l8, clippingPlanes, k9, worldController, abyte1);
  10133. }
  10134. }
  10135. CustomObjects.spawn();
  10136. }
  10137.  
  10138. if (aBoolean1159) {
  10139. for (int j3 = 0; j3 < 4; j3++) {
  10140. for (int k4 = 0; k4 < 13; k4++) {
  10141. for (int j6 = 0; j6 < 13; j6++) {
  10142. int l7 = anIntArrayArrayArray1129[j3][k4][j6];
  10143.  
  10144. if (l7 != -1) {
  10145. int i9 = l7 >> 24 & 3;
  10146. int l9 = l7 >> 1 & 3;
  10147. int j10 = l7 >> 14 & 0x3ff;
  10148. int l10 = l7 >> 3 & 0x7ff;
  10149. int j11 = (j10 / 8 << 8) + l10 / 8;
  10150.  
  10151. for (int l11 = 0; l11 < anIntArray1234.length; l11++) {
  10152. if (anIntArray1234[l11] != j11 || aByteArrayArray1183[l11] == null) {
  10153. continue;
  10154. }
  10155.  
  10156. objectManager.method179(i9, l9, clippingPlanes, k4 * 8, (j10 & 7) * 8, aByteArrayArray1183[l11], (l10 & 7) * 8, j3, j6 * 8);
  10157. break;
  10158. }
  10159. }
  10160. }
  10161. }
  10162. }
  10163.  
  10164. for (int l4 = 0; l4 < 13; l4++) {
  10165. for (int k6 = 0; k6 < 13; k6++) {
  10166. int i8 = anIntArrayArrayArray1129[0][l4][k6];
  10167.  
  10168. if (i8 == -1) {
  10169. objectManager.method174(k6 * 8, 8, 8, l4 * 8);
  10170. }
  10171. }
  10172. }
  10173.  
  10174. if (loggedIn) {
  10175. getOut().putOpcode(0);
  10176. }
  10177.  
  10178. for (int l6 = 0; l6 < 4; l6++) {
  10179. for (int j8 = 0; j8 < 13; j8++) {
  10180. for (int j9 = 0; j9 < 13; j9++) {
  10181. int i10 = anIntArrayArrayArray1129[l6][j8][j9];
  10182.  
  10183. if (i10 != -1) {
  10184. int k10 = i10 >> 24 & 3;
  10185. int i11 = i10 >> 1 & 3;
  10186. int k11 = i10 >> 14 & 0x3ff;
  10187. int i12 = i10 >> 3 & 0x7ff;
  10188. int j12 = (k11 / 8 << 8) + i12 / 8;
  10189.  
  10190. for (int k12 = 0; k12 < anIntArray1234.length; k12++) {
  10191. if (anIntArray1234[k12] != j12 || aByteArrayArray1247[k12] == null) {
  10192. continue;
  10193. }
  10194. objectManager.method183(clippingPlanes, worldController, k10, j8 * 8, (i12 & 7) * 8, l6, aByteArrayArray1247[k12], (k11 & 7) * 8, i11, j9 * 8);
  10195. break;
  10196. }
  10197. }
  10198. }
  10199. }
  10200. }
  10201. }
  10202.  
  10203. if (loggedIn) {
  10204. getOut().putOpcode(0);
  10205. }
  10206.  
  10207. objectManager.method171(clippingPlanes, worldController);
  10208.  
  10209. if (loggedIn) {
  10210.  
  10211. gameScreenIP.initDrawingArea();
  10212. }
  10213.  
  10214. if (loggedIn) {
  10215. getOut().putOpcode(0);
  10216. }
  10217.  
  10218. int k3 = ObjectManager.anInt145;
  10219.  
  10220. if (k3 > plane) {
  10221. k3 = plane;
  10222. }
  10223.  
  10224. if (k3 < plane - 1) {
  10225. k3 = plane - 1;
  10226. }
  10227.  
  10228. if (isLowDetail()) {
  10229. worldController.method275(ObjectManager.anInt145);
  10230. } else {
  10231. worldController.method275(0);
  10232. }
  10233.  
  10234. for (int i5 = 0; i5 < 104; i5++) {
  10235. for (int i7 = 0; i7 < 104; i7++) {
  10236. spawnGroundItem(i5, i7);
  10237. }
  10238. }
  10239.  
  10240. method63();
  10241. } catch (Exception exception) {
  10242. exception.printStackTrace();
  10243. }
  10244.  
  10245. ObjectDefinition.mruNodes1.unlinkAll();
  10246.  
  10247. if (super.mainFrame != null && loggedIn) {
  10248. getOut().putOpcode(210);
  10249. getOut().putInt(0x3f008edd);
  10250. }
  10251.  
  10252. System.gc();
  10253. Rasterizer.method367();
  10254. onDemandFetcher.method566();
  10255. int k = (anInt1069 - 6) / 8 - 1;
  10256. int j1 = (anInt1069 + 6) / 8 + 1;
  10257. int i2 = (anInt1070 - 6) / 8 - 1;
  10258. int l2 = (anInt1070 + 6) / 8 + 1;
  10259.  
  10260. if (aBoolean1141) {
  10261. k = 49;
  10262. j1 = 50;
  10263. i2 = 49;
  10264. l2 = 50;
  10265. }
  10266.  
  10267. for (int l3 = k; l3 <= j1; l3++) {
  10268. for (int j5 = i2; j5 <= l2; j5++) {
  10269. if (l3 == k || l3 == j1 || j5 == i2 || j5 == l2) {
  10270. int j7 = onDemandFetcher.getMapCount(0, j5, l3);
  10271.  
  10272. if (j7 != -1) {
  10273. onDemandFetcher.method560(j7, 3);
  10274. }
  10275.  
  10276. int k8 = onDemandFetcher.getMapCount(1, j5, l3);
  10277.  
  10278. if (k8 != -1) {
  10279. onDemandFetcher.method560(k8, 3);
  10280. }
  10281. }
  10282. }
  10283. }
  10284. }
  10285.  
  10286. private void renderedMapScene(int i) {
  10287. int[] ai = miniMapRegions.myPixels;
  10288. int j = ai.length;
  10289.  
  10290. for (int k = 0; k < j; k++) {
  10291. ai[k] = 0;
  10292. }
  10293.  
  10294. for (int l = 1; l < 103; l++) {
  10295. int i1 = 24628 + (103 - l) * 512 * 4;
  10296.  
  10297. for (int k1 = 1; k1 < 103; k1++) {
  10298. if ((byteGroundArray[i][k1][l] & 0x18) == 0) {
  10299. worldController.method309(ai, i1, i, k1, l);
  10300. }
  10301.  
  10302. if (i < 3 && (byteGroundArray[i + 1][k1][l] & 8) != 0) {
  10303. worldController.method309(ai, i1, i + 1, k1, l);
  10304. }
  10305.  
  10306. i1 += 4;
  10307. }
  10308. }
  10309.  
  10310. int j1 = Color.WHITE.getRGB();
  10311. int l1 = Color.RED.getRGB();
  10312.  
  10313. if (loggedIn) {
  10314. miniMapRegions.method343();
  10315. }
  10316.  
  10317. for (int i2 = 1; i2 < 103; i2++) {
  10318. for (int j2 = 1; j2 < 103; j2++) {
  10319. if ((byteGroundArray[i][j2][i2] & 0x18) == 0) {
  10320. method50(i2, j1, j2, l1, i);
  10321. }
  10322.  
  10323. if (i < 3 && (byteGroundArray[i + 1][j2][i2] & 8) != 0) {
  10324. method50(i2, j1, j2, l1, i + 1);
  10325. }
  10326. }
  10327. }
  10328.  
  10329. if (loggedIn) {
  10330. gameScreenIP.initDrawingArea();
  10331. }
  10332.  
  10333. anInt1071 = 0;
  10334.  
  10335. for (int k2 = 0; k2 < 104; k2++) {
  10336. for (int l2 = 0; l2 < 104; l2++) {
  10337. int i3 = worldController.method303(plane, k2, l2);
  10338.  
  10339. if (i3 != 0) {
  10340. i3 = i3 >> 14 & 0x7fff;
  10341. int j3 = ObjectDefinition.forID(i3).mapFunctionID;
  10342.  
  10343. if (j3 >= 0) {
  10344. aClass30_Sub2_Sub1_Sub1Array1140[anInt1071] = mapFunctions[j3];
  10345. anIntArray1072[anInt1071] = k2;
  10346. anIntArray1073[anInt1071] = l2;
  10347. anInt1071++;
  10348. }
  10349. }
  10350. }
  10351. }
  10352. }
  10353.  
  10354. private void method26(boolean flag) {
  10355. for (int i = 0; i < npcCount; i++) {
  10356. NPC npc = npcArray[npcIndices[i]];
  10357. int k = 0x20000000 + (npcIndices[i] << 14);
  10358.  
  10359. if (npc == null || !npc.isVisible() || npc.definitionOverride.visibilityOrRendering != flag) {
  10360. continue;
  10361. }
  10362.  
  10363. int l = npc.x >> 7;
  10364. int i1 = npc.y >> 7;
  10365.  
  10366. if (l < 0 || l >= 104 || i1 < 0 || i1 >= 104) {
  10367. continue;
  10368. }
  10369.  
  10370. if (npc.anInt1540 == 1 && (npc.x & 0x7f) == 64 && (npc.y & 0x7f) == 64) {
  10371. if (anIntArrayArray929[l][i1] == anInt1265) {
  10372. continue;
  10373. }
  10374.  
  10375. anIntArrayArray929[l][i1] = anInt1265;
  10376. }
  10377.  
  10378. if (!npc.definitionOverride.disableRightClick) {
  10379. k += 0x80000000;
  10380. }
  10381.  
  10382. worldController.method285(plane, npc.anInt1552, method42(plane, npc.y, npc.x), k, npc.y, (npc.anInt1540 - 1) * 64 + 60, npc.x, npc, npc.aBoolean1541);
  10383. }
  10384. }
  10385.  
  10386. private void method37(int j) {
  10387. // Textures
  10388. int speed = 1;
  10389.  
  10390. if (Rasterizer.anIntArray1480[17] >= j) {
  10391. Background background = Rasterizer.aBackgroundArray1474s[17];
  10392. int k = background.imgWidth * background.imgHeight - 1;
  10393. int j1 = background.imgWidth * anInt945 * speed;
  10394. byte abyte0[] = background.imgPixels;
  10395. byte abyte3[] = aByteArray912;
  10396.  
  10397. for (int i2 = 0; i2 <= k; i2++) {
  10398. abyte3[i2] = abyte0[i2 - j1 & k];
  10399. }
  10400.  
  10401. background.imgPixels = abyte3;
  10402. aByteArray912 = abyte0;
  10403. Rasterizer.method370(17);
  10404. anInt854++;
  10405.  
  10406. if (anInt854 > 1235) {
  10407. anInt854 = 0;
  10408. getOut().putOpcode(226);
  10409. getOut().putByte(0);
  10410. int l2 = getOut().position;
  10411. getOut().putShort(58722);
  10412. getOut().putByte(240);
  10413. getOut().putShort((int) (Math.random() * 65536D));
  10414. getOut().putByte((int) (Math.random() * 256D));
  10415.  
  10416. if ((int) (Math.random() * 2D) == 0) {
  10417. getOut().putShort(51825);
  10418. }
  10419.  
  10420. getOut().putByte((int) (Math.random() * 256D));
  10421. getOut().putShort((int) (Math.random() * 65536D));
  10422. getOut().putShort(7130);
  10423. getOut().putShort((int) (Math.random() * 65536D));
  10424. getOut().putShort(61657);
  10425. getOut().putVariableSizeByte(getOut().position - l2);
  10426. }
  10427. }
  10428.  
  10429. if (Rasterizer.anIntArray1480[24] >= j) {
  10430. Background background_1 = Rasterizer.aBackgroundArray1474s[24];
  10431. int l = background_1.imgWidth * background_1.imgHeight - 1;
  10432. int k1 = background_1.imgWidth * anInt945 * 2;
  10433. byte abyte1[] = background_1.imgPixels;
  10434. byte abyte4[] = aByteArray912;
  10435.  
  10436. for (int j2 = 0; j2 <= l; j2++) {
  10437. abyte4[j2] = abyte1[j2 - k1 & l];
  10438. }
  10439.  
  10440. background_1.imgPixels = abyte4;
  10441. aByteArray912 = abyte1;
  10442. Rasterizer.method370(24);
  10443. }
  10444.  
  10445. if (Rasterizer.anIntArray1480[34] >= j) {
  10446. Background background_2 = Rasterizer.aBackgroundArray1474s[34];
  10447. int i1 = background_2.imgWidth * background_2.imgHeight - 1;
  10448. int l1 = background_2.imgWidth * anInt945 * 2;
  10449. byte abyte2[] = background_2.imgPixels;
  10450. byte abyte5[] = aByteArray912;
  10451.  
  10452. for (int k2 = 0; k2 <= i1; k2++) {
  10453. abyte5[k2] = abyte2[k2 - l1 & i1];
  10454. }
  10455.  
  10456. background_2.imgPixels = abyte5;
  10457. aByteArray912 = abyte2;
  10458. Rasterizer.method370(34);
  10459. }
  10460.  
  10461. if (Rasterizer.anIntArray1480[1] >= j) {
  10462. Background background_2 = Rasterizer.aBackgroundArray1474s[1];
  10463. int i1 = background_2.imgWidth * background_2.imgHeight - 1;
  10464. int l1 = background_2.imgWidth * anInt945 * 2;
  10465. byte abyte2[] = background_2.imgPixels;
  10466. byte abyte5[] = aByteArray912;
  10467.  
  10468. for (int k2 = 0; k2 <= i1; k2++) {
  10469. abyte5[k2] = abyte2[k2 - l1 & i1];
  10470. }
  10471.  
  10472. background_2.imgPixels = abyte5;
  10473. aByteArray912 = abyte2;
  10474. Rasterizer.method370(1);
  10475. }
  10476.  
  10477. if (Rasterizer.anIntArray1480[40] >= j) {
  10478. Background background_2 = Rasterizer.aBackgroundArray1474s[40];
  10479. int i1 = background_2.imgWidth * background_2.imgHeight - 1;
  10480. int l1 = background_2.imgWidth * anInt945 * 1;
  10481. byte abyte2[] = background_2.imgPixels;
  10482. byte abyte5[] = aByteArray912;
  10483.  
  10484. for (int k2 = 0; k2 <= i1; k2++) {
  10485. abyte5[k2] = abyte2[k2 - l1 & i1];
  10486. }
  10487.  
  10488. background_2.imgPixels = abyte5;
  10489. aByteArray912 = abyte2;
  10490. Rasterizer.method370(40);
  10491. }
  10492. }
  10493.  
  10494. private void processTextCycles() {
  10495. for (int i = -1; i < playerCount; i++) {
  10496. int j;
  10497. if (i == -1) {
  10498. j = getMyPlayerIndex();
  10499. } else {
  10500. j = playerIndices[i];
  10501. }
  10502. Player player = playerArray[j];
  10503. if (player != null && player.textCycle > 0) {
  10504. player.textCycle--;
  10505. if (player.textCycle == 0) {
  10506. player.textSpoken = null;
  10507. }
  10508. }
  10509. }
  10510. for (int k = 0; k < npcCount; k++) {
  10511. int l = npcIndices[k];
  10512. NPC npc = npcArray[l];
  10513. if (npc != null && npc.textCycle > 0) {
  10514. npc.textCycle--;
  10515. if (npc.textCycle == 0) {
  10516. npc.textSpoken = null;
  10517. }
  10518. }
  10519. }
  10520. }
  10521.  
  10522. private int method42(int i, int j, int k) {
  10523. int l = k >> 7;
  10524. int i1 = j >> 7;
  10525. if (l < 0 || i1 < 0 || l > 103 || i1 > 103) {
  10526. return 0;
  10527. }
  10528. int j1 = i;
  10529. if (j1 < 3 && (byteGroundArray[1][l][i1] & 2) == 2) {
  10530. j1++;
  10531. }
  10532. int k1 = k & 0x7f;
  10533. int l1 = j & 0x7f;
  10534. int i2 = intGroundArray[j1][l][i1] * (128 - k1) + intGroundArray[j1][l + 1][i1] * k1 >> 7;
  10535. int j2 = intGroundArray[j1][l][i1 + 1] * (128 - k1) + intGroundArray[j1][l + 1][i1 + 1] * k1 >> 7;
  10536. return i2 * (128 - l1) + j2 * l1 >> 7;
  10537. }
  10538.  
  10539. public void method45() {
  10540. aBoolean1031 = true;
  10541. for (int j = 0; j < 7; j++) {
  10542. myAppearance[j] = -1;
  10543. for (int k = 0; k < IdentityKit.getLength(); k++) {
  10544. if (IdentityKit.cache[k].isaBoolean662() || IdentityKit.cache[k].getAnInt657() != j + (isMale ? 0 : 7)) {
  10545. continue;
  10546. }
  10547. myAppearance[j] = k;
  10548. break;
  10549. }
  10550. }
  10551. }
  10552.  
  10553. private void updateNpcMovement(int i, ByteBuffer stream) {
  10554. while (stream.bitPosition + 21 < i * 8) {
  10555. int k = stream.getBits(14);
  10556. if (k == 16383) {
  10557. break;
  10558. }
  10559. if (npcArray[k] == null) {
  10560. npcArray[k] = new NPC();
  10561. }
  10562. NPC npc = npcArray[k];
  10563. npcIndices[npcCount++] = k;
  10564. npc.anInt1537 = loopCycle;
  10565. int l = stream.getBits(5);
  10566. if (l > 15) {
  10567. l -= 32;
  10568. }
  10569. int i1 = stream.getBits(5);
  10570. if (i1 > 15) {
  10571. i1 -= 32;
  10572. }
  10573. int j1 = stream.getBits(1);
  10574. npc.definitionOverride = MobDefinition.get(stream.getBits(Configuration.NPC_BITS));
  10575. int k1 = stream.getBits(1);
  10576. if (k1 == 1) {
  10577. anIntArray894[anInt893++] = k;
  10578. }
  10579. npc.anInt1540 = npc.definitionOverride.npcSizeInSquares;
  10580. npc.anInt1504 = npc.definitionOverride.degreesToTurn;
  10581. npc.anInt1554 = npc.definitionOverride.walkAnimation;
  10582. npc.anInt1555 = npc.definitionOverride.walkingBackwardsAnimation;
  10583. npc.anInt1556 = npc.definitionOverride.walkLeftAnimation;
  10584. npc.anInt1557 = npc.definitionOverride.walkRightAnimation;
  10585. npc.anInt1511 = npc.definitionOverride.standAnimation;
  10586. npc.setPos(myPlayer.smallX[0] + i1, myPlayer.smallY[0] + l, j1 == 1);
  10587. }
  10588. stream.finishBitAccess();
  10589. }
  10590.  
  10591. private void method47(boolean flag) {
  10592. if (myPlayer.x >> 7 == destX && myPlayer.y >> 7 == destY) {
  10593. destX = 0;
  10594. }
  10595. int j = playerCount;
  10596. if (flag) {
  10597. j = 1;
  10598. }
  10599. for (int l = 0; l < j; l++) {
  10600. Player player;
  10601. int i1;
  10602. if (flag) {
  10603. player = myPlayer;
  10604. i1 = getMyPlayerIndex() << 14;
  10605. } else {
  10606. player = playerArray[playerIndices[l]];
  10607. i1 = playerIndices[l] << 14;
  10608. }
  10609. if (player == null || !player.isVisible()) {
  10610. continue;
  10611. }
  10612. // here
  10613. player.aBoolean1699 = playerCount > 200 && !flag && player.anInt1517 == player.anInt1511;
  10614. int j1 = player.x >> 7;
  10615. int k1 = player.y >> 7;
  10616. if (j1 < 0 || j1 >= 104 || k1 < 0 || k1 >= 104) {
  10617. continue;
  10618. }
  10619. if (player.aModel_1714 != null && loopCycle >= player.anInt1707 && loopCycle < player.anInt1708) {
  10620. player.aBoolean1699 = false;
  10621. player.anInt1709 = method42(plane, player.y, player.x);
  10622. worldController.method286(plane, player.y, player, player.anInt1552, player.anInt1722, player.x, player.anInt1709, player.anInt1719, player.anInt1721, i1, player.anInt1720);
  10623. continue;
  10624. }
  10625. if ((player.x & 0x7f) == 64 && (player.y & 0x7f) == 64) {
  10626. if (anIntArrayArray929[j1][k1] == anInt1265) {
  10627. continue;
  10628. }
  10629. anIntArrayArray929[j1][k1] = anInt1265;
  10630. }
  10631. player.anInt1709 = method42(plane, player.y, player.x);
  10632. worldController.method285(plane, player.anInt1552, player.anInt1709, i1, player.y, 60, player.x, player, player.aBoolean1541);
  10633. }
  10634. }
  10635.  
  10636. private void processPlayerUpdating(ByteBuffer stream) {
  10637. for (int j = 0; j < anInt893; j++) {
  10638. int k = anIntArray894[j];
  10639. Player player = playerArray[k];
  10640. int l = stream.getUnsignedByte();
  10641. if ((l & 0x40) != 0) {
  10642. l += stream.getUnsignedByte() << 8;
  10643. }
  10644. readPlayerUpdateMask(l, k, stream, player);
  10645. }
  10646. }
  10647.  
  10648. private void method50(int y, int primaryColor, int x, int secondaryColor, int z) {
  10649. int uid = worldController.method300(z, x, y);
  10650. if ((uid ^ 0xffffffffffffffffL) != -1L) {
  10651. int resourceTag = worldController.fetchObjectIDTagForPosition(z, x, y, uid);
  10652. int direction = resourceTag >> 6 & 3;// direction
  10653. int type = resourceTag & 0x1f;// type
  10654. int color = primaryColor;// color
  10655. if (uid > 0) {
  10656. color = secondaryColor;
  10657. }
  10658. int mapPixels[] = miniMapRegions.myPixels;
  10659. int pixel = 24624 + x * 4 + (103 - y) * 512 * 4;
  10660. int objectId = worldController.fetchWallDecorationNewUID(z, x, y);
  10661. ObjectDefinition objDef = ObjectDefinition.forID(objectId);
  10662. if ((objDef.mapSceneID ^ 0xffffffff) == 0) {
  10663. if (type == 0 || type == 2) {
  10664. if (direction == 0) {
  10665. mapPixels[pixel] = color;
  10666. mapPixels[pixel + 512] = color;
  10667. mapPixels[1024 + pixel] = color;
  10668. mapPixels[1536 + pixel] = color;
  10669. } else if ((direction ^ 0xffffffff) == -2) {
  10670. mapPixels[pixel] = color;
  10671. mapPixels[pixel + 1] = color;
  10672. mapPixels[pixel + 2] = color;
  10673. mapPixels[3 + pixel] = color;
  10674. } else if (direction == 2) {
  10675. mapPixels[pixel - -3] = color;
  10676. mapPixels[3 + pixel + 512] = color;
  10677. mapPixels[3 + pixel + 1024] = color;
  10678. mapPixels[1536 + pixel - -3] = color;
  10679. } else if (direction == 3) {
  10680. mapPixels[pixel + 1536] = color;
  10681. mapPixels[pixel + 1536 + 1] = color;
  10682. mapPixels[2 + pixel + 1536] = color;
  10683. mapPixels[pixel + 1539] = color;
  10684. }
  10685. }
  10686. if (type == 3) {
  10687. if (direction == 0) {
  10688. mapPixels[pixel] = color;
  10689. } else if (direction == 1) {
  10690. mapPixels[pixel + 3] = color;
  10691. } else if (direction == 2) {
  10692. mapPixels[pixel + 3 + 1536] = color;
  10693. } else if (direction == 3) {
  10694. mapPixels[pixel + 1536] = color;
  10695. }
  10696. }
  10697. if (type == 2) {
  10698. if (direction == 3) {
  10699. mapPixels[pixel] = color;
  10700. mapPixels[pixel + 512] = color;
  10701. mapPixels[pixel + 1024] = color;
  10702. mapPixels[pixel + 1536] = color;
  10703. } else if (direction == 0) {
  10704. mapPixels[pixel] = color;
  10705. mapPixels[pixel + 1] = color;
  10706. mapPixels[pixel + 2] = color;
  10707. mapPixels[pixel + 3] = color;
  10708. } else if (direction == 1) {
  10709. mapPixels[pixel + 3] = color;
  10710. mapPixels[pixel + 3 + 512] = color;
  10711. mapPixels[pixel + 3 + 1024] = color;
  10712. mapPixels[pixel + 3 + 1536] = color;
  10713. } else if (direction == 2) {
  10714. mapPixels[pixel + 1536] = color;
  10715. mapPixels[pixel + 1536 + 1] = color;
  10716. mapPixels[pixel + 1536 + 2] = color;
  10717. mapPixels[pixel + 1536 + 3] = color;
  10718. }
  10719. }
  10720. }
  10721. }
  10722. uid = worldController.method302(z, x, y);
  10723. if (uid != 0) {
  10724. int resourceTag = worldController.fetchObjectIDTagForPosition(z, x, y, uid);
  10725. int direction = resourceTag >> 6 & 3;
  10726. int type = resourceTag & 0x1f;
  10727. int objectId = worldController.fetchObjectMeshNewUID(z, x, y);
  10728. ObjectDefinition objDef = ObjectDefinition.forID(objectId);
  10729. if (objDef.mapSceneID != -1) {
  10730. Background scene = mapScenes[objDef.mapSceneID];
  10731. if (scene != null) {
  10732. int sceneX = (objDef.sizeX * 4 - scene.imgWidth) / 2;
  10733. int sceneY = (objDef.sizeY * 4 - scene.imgHeight) / 2;
  10734. scene.method361(48 + x * 4 + sceneX, 48 + (104 - y - objDef.sizeY) * 4 + sceneY);
  10735. }
  10736. } else if (type == 9) {
  10737. int color = 0xeeeeee;
  10738. if (uid > 0) {
  10739. color = 0xee0000;
  10740. }
  10741. int mapPixels[] = miniMapRegions.myPixels;
  10742. int pixel = 24624 + x * 4 + (103 - y) * 512 * 4;
  10743. if (direction == 0 || direction == 2) {
  10744. mapPixels[pixel + 1536] = color;
  10745. mapPixels[pixel + 1024 + 1] = color;
  10746. mapPixels[pixel + 512 + 2] = color;
  10747. mapPixels[pixel + 3] = color;
  10748. } else {
  10749. mapPixels[pixel] = color;
  10750. mapPixels[pixel + 512 + 1] = color;
  10751. mapPixels[pixel + 1024 + 2] = color;
  10752. mapPixels[pixel + 1536 + 3] = color;
  10753. }
  10754. }
  10755. }
  10756. uid = worldController.fetchGroundDecorationNewUID(z, x, y);
  10757. if (uid > 0) {
  10758. ObjectDefinition objDef = ObjectDefinition.forID(uid);
  10759. if (objDef.mapSceneID != -1) {
  10760. Background scene = mapScenes[objDef.mapSceneID];
  10761. if (scene != null) {
  10762. int sceneX = (objDef.sizeX * 4 - scene.imgWidth) / 2;
  10763. int sceneY = (objDef.sizeY * 4 - scene.imgHeight) / 2;
  10764. scene.method361(48 + x * 4 + sceneX, 48 + (104 - y - objDef.sizeY) * 4 + sceneY);
  10765. }
  10766. }
  10767. }
  10768. }
  10769.  
  10770. private int getMapLoadingState() {
  10771. if (!floorMaps.equals("") || !objectMaps.equals("")) {
  10772. floorMaps = "";
  10773. objectMaps = "";
  10774. }
  10775. for (int i = 0; i < aByteArrayArray1183.length; i++) {
  10776. floorMaps += " " + floorMap[i];
  10777. objectMaps += " " + objectMap[i];
  10778. if (aByteArrayArray1183[i] == null && floorMap[i] != -1) {
  10779. return -1;
  10780. }
  10781. if (aByteArrayArray1247[i] == null && objectMap[i] != -1) {
  10782. return -2;
  10783. }
  10784. }
  10785. boolean flag = true;
  10786. for (int j = 0; j < aByteArrayArray1183.length; j++) {
  10787. byte abyte0[] = aByteArrayArray1247[j];
  10788. if (abyte0 != null) {
  10789. int k = (anIntArray1234[j] >> 8) * 64 - baseX;
  10790. int l = (anIntArray1234[j] & 0xff) * 64 - baseY;
  10791. if (aBoolean1159) {
  10792. k = 10;
  10793. l = 10;
  10794. }
  10795. flag &= ObjectManager.method189(k, abyte0, l);
  10796. }
  10797. }
  10798. if (!flag) {
  10799. return -3;
  10800. }
  10801. if (aBoolean1080) {
  10802. return -4;
  10803. } else {
  10804. loadingStage = 2;
  10805. ObjectManager.anInt131 = plane;
  10806. loadRegion();
  10807. if (loggedIn) {
  10808. getOut().putOpcode(121);
  10809. }
  10810. return 0;
  10811. }
  10812. }
  10813.  
  10814. private void method55() {
  10815. for (PlayerProjectile class30_sub2_sub4_sub4 = (PlayerProjectile) getaClass19_1013().reverseGetFirst(); class30_sub2_sub4_sub4 != null; class30_sub2_sub4_sub4 = (PlayerProjectile) getaClass19_1013().reverseGetNext()) {
  10816. if (class30_sub2_sub4_sub4.anInt1597 != plane || loopCycle > class30_sub2_sub4_sub4.anInt1572) {
  10817. class30_sub2_sub4_sub4.unlink();
  10818. } else if (loopCycle >= class30_sub2_sub4_sub4.anInt1571) {
  10819. if (class30_sub2_sub4_sub4.anInt1590 > 0) {
  10820. NPC npc = npcArray[class30_sub2_sub4_sub4.anInt1590 - 1];
  10821. if (npc != null && npc.x >= 0 && npc.x < 13312 && npc.y >= 0 && npc.y < 13312) {
  10822. 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);
  10823. }
  10824. }
  10825. if (class30_sub2_sub4_sub4.anInt1590 < 0) {
  10826. int j = -class30_sub2_sub4_sub4.anInt1590 - 1;
  10827. Player player;
  10828. if (j == playerId) {
  10829. player = myPlayer;
  10830. } else {
  10831. player = playerArray[j];
  10832. }
  10833. if (player != null && player.x >= 0 && player.x < 13312 && player.y >= 0 && player.y < 13312) {
  10834. 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);
  10835. }
  10836. }
  10837. class30_sub2_sub4_sub4.method456(anInt945);
  10838. worldController.method285(plane, class30_sub2_sub4_sub4.rotationY, (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);
  10839. }
  10840. }
  10841.  
  10842. }
  10843.  
  10844. private final synchronized void method56(int i, boolean bool, int music) {
  10845. if (musicIsntNull()) {
  10846. nextSong = music;
  10847. onDemandFetcher.requestFileData(2, nextSong);
  10848. musicVolume2 = i;
  10849. anInt139 = -1;
  10850. aBoolean995 = true;
  10851. anInt116 = -1;
  10852. }
  10853. }
  10854.  
  10855. private final synchronized void method58(int i_30_, int volume, boolean bool, int music) {
  10856. if (musicIsntNull()) {
  10857. nextSong = music;
  10858. onDemandFetcher.requestFileData(2, nextSong);
  10859. musicVolume2 = volume;
  10860. anInt139 = -1;
  10861. aBoolean995 = true;
  10862. anInt116 = i_30_;
  10863. }
  10864. }
  10865.  
  10866. private void resetInterfaceAnimation(int i) {
  10867. RSInterface class9 = RSInterface.interfaceCache[i];
  10868. if(class9 == null || class9.children == null)
  10869. return;
  10870. for (int element : class9.children) {
  10871. if (element == -1) {
  10872. break;
  10873. }
  10874. RSInterface class9_1 = RSInterface.interfaceCache[element];
  10875. if (class9_1.type == 1) {
  10876. resetInterfaceAnimation(class9_1.id);
  10877. }
  10878. class9_1.anInt246 = 0;
  10879. class9_1.anInt208 = 0;
  10880. }
  10881. }
  10882.  
  10883. private void method63() {
  10884. Class30_Sub1 class30_sub1 = (Class30_Sub1) getaClass19_1179().reverseGetFirst();
  10885. for (; class30_sub1 != null; class30_sub1 = (Class30_Sub1) getaClass19_1179().reverseGetNext()) {
  10886. if (class30_sub1.anInt1294 == -1) {
  10887. class30_sub1.anInt1302 = 0;
  10888. method89(class30_sub1);
  10889. } else {
  10890. class30_sub1.unlink();
  10891. }
  10892. }
  10893.  
  10894. }
  10895.  
  10896. private void method65(int i, int j, int k, int l, RSInterface class9, int i1, boolean flag, int j1) {
  10897. int anInt992;
  10898. if (aBoolean972) {
  10899. anInt992 = 32;
  10900. } else {
  10901. anInt992 = 0;
  10902. }
  10903. aBoolean972 = false;
  10904. if (k >= i && k < i + 16 && l >= i1 && l < i1 + 16) {
  10905. class9.scrollPosition -= anInt1213 * 4;
  10906. if (flag) {
  10907. }
  10908. } else if (k >= i && k < i + 16 && l >= i1 + j - 16 && l < i1 + j) {
  10909. class9.scrollPosition += anInt1213 * 4;
  10910. if (flag) {
  10911. }
  10912. } else if (k >= i - anInt992 && k < i + 16 + anInt992 && l >= i1 + 16 && l < i1 + j - 16 && anInt1213 > 0) {
  10913. int l1 = (j - 32) * j / j1;
  10914. if (l1 < 8) {
  10915. l1 = 8;
  10916. }
  10917. int i2 = l - i1 - 16 - l1 / 2;
  10918. int j2 = j - 32 - l1;
  10919. class9.scrollPosition = (j1 - j) * i2 / j2;
  10920. if (flag) {
  10921. }
  10922. aBoolean972 = true;
  10923. }
  10924. }
  10925.  
  10926. // might be needed
  10927. private boolean method66(int i, int j, int k, int id) {
  10928. int j1 = worldController.fetchObjectIDTagForPosition(plane, k, j, i);
  10929. if (i == -1) {
  10930. return false;
  10931. }
  10932. int k1 = j1 & 0x1f;
  10933. int l1 = j1 >> 6 & 3;
  10934. if (k1 == 10 || k1 == 11 || k1 == 22) {
  10935. ObjectDefinition class46 = ObjectDefinition.forID(id);
  10936. int i2;
  10937. int j2;
  10938. if (l1 == 0 || l1 == 2) {
  10939. i2 = class46.sizeX;
  10940. j2 = class46.sizeY;
  10941. } else {
  10942. i2 = class46.sizeX;
  10943. j2 = class46.sizeY;
  10944. }
  10945. int k2 = class46.plane;
  10946. if (l1 != 0) {
  10947. k2 = (k2 << l1 & 0xf) + (k2 >> 4 - l1);
  10948. }
  10949. doWalkTo(2, 0, j2, 0, myPlayer.smallY[0], i2, k2, j, myPlayer.smallX[0], false, k);
  10950. } else {
  10951. doWalkTo(2, l1, 0, k1 + 1, myPlayer.smallY[0], 0, 0, j, myPlayer.smallX[0], false, k);
  10952. }
  10953. crossX = super.saveClickX;
  10954. crossY = super.saveClickY;
  10955. crossType = 2;
  10956. crossIndex = 0;
  10957. return true;
  10958. }
  10959.  
  10960. private void method70() {
  10961. anInt1251 = 0;
  10962. int j = (myPlayer.x >> 7) + baseX;
  10963. int k = (myPlayer.y >> 7) + baseY;
  10964. if (j >= 3053 && j <= 3156 && k >= 3056 && k <= 3136) {
  10965. anInt1251 = 1;
  10966. }
  10967. if (j >= 3072 && j <= 3118 && k >= 9492 && k <= 9535) {
  10968. anInt1251 = 1;
  10969. }
  10970. if (anInt1251 == 1 && j >= 3139 && j <= 3199 && k >= 3008 && k <= 3062) {
  10971. anInt1251 = 0;
  10972. }
  10973. }
  10974.  
  10975. private void manageTextInput() {
  10976. do {
  10977. int key = readChar(-796);
  10978.  
  10979. if (key == -1) {
  10980. break;
  10981. }
  10982.  
  10983. if (key == 96) {
  10984. break;
  10985. }
  10986.  
  10987. if(key == 167 || key == 96) {
  10988. if(myRights >= 1 && myRights <= 4) {
  10989. consoleOpen = !consoleOpen;
  10990. }
  10991. return;
  10992. }
  10993. if (consoleOpen) {
  10994. if (key == 8 && consoleInput.length() > 0)
  10995. consoleInput = consoleInput.substring(0,
  10996. consoleInput.length() - 1);
  10997. if (key >= 32 && key <= 122
  10998. && consoleInput.length() < 80)
  10999. consoleInput += (char) key;
  11000.  
  11001. if ((key == 13 || key == 10)
  11002. && consoleInput.length() >= 1) {
  11003. printConsoleMessage(consoleInput, 0);
  11004. sendCommandPacket(consoleInput);
  11005. consoleInput = "";
  11006. inputTaken = true;
  11007. }
  11008. return;
  11009. } else if (messagePromptRaised) {
  11010. if (key >= 32 && key <= 122 && promptInput.length() < 80) {
  11011. promptInput += (char) key;
  11012. inputTaken = true;
  11013. }
  11014.  
  11015. if (key == 8 && promptInput.length() > 0) {
  11016. promptInput = promptInput.substring(0, promptInput.length() - 1);
  11017. inputTaken = true;
  11018. }
  11019. if (key == 13 || key == 10) {
  11020. messagePromptRaised = false;
  11021. inputTaken = true;
  11022.  
  11023. if (friendsListAction == 1) {
  11024. long l = TextClass.longForName(promptInput);
  11025. addFriend(l);
  11026. }
  11027.  
  11028. if (friendsListAction == 2 && friendCount > 0) {
  11029. long l1 = TextClass.longForName(promptInput);
  11030. delFriend(l1);
  11031. }
  11032.  
  11033. if (interfaceButtonAction == 6199
  11034. && promptInput.length() > 0) {
  11035. String inp = "";
  11036. inp = inputString;
  11037. inputString = "::[CN] " + promptInput;
  11038. sendPacket(103);
  11039. inputString = inp;
  11040. }
  11041.  
  11042. if (interfaceButtonAction == 557 && promptInput.length() > 0) {
  11043. int length = promptInput.length();
  11044. char lastChar = promptInput.charAt(length - 1);
  11045.  
  11046. if (lastChar == 'k') {
  11047. promptInput = promptInput.substring(0, length - 1) + "000";
  11048. } else if (lastChar == 'm') {
  11049. promptInput = promptInput.substring(0, length - 1) + "000000";
  11050. } else if (lastChar == 'b') {
  11051. promptInput = promptInput.substring(0, length - 1) + "000000000";
  11052. }
  11053. inputString = "::mpremove " + promptInput;
  11054. sendPacket(103);
  11055. }
  11056.  
  11057. if (interfaceButtonAction == 558 && promptInput.length() > 0) {
  11058. int length = promptInput.length();
  11059. char lastChar = promptInput.charAt(length - 1);
  11060.  
  11061. if (lastChar == 'k') {
  11062. promptInput = promptInput.substring(0, length - 1) + "000";
  11063. } else if (lastChar == 'm') {
  11064. promptInput = promptInput.substring(0, length - 1) + "000000";
  11065. } else if (lastChar == 'b') {
  11066. promptInput = promptInput.substring(0, length - 1) + "000000000";
  11067. }
  11068. inputString = "::mpadd " + promptInput;
  11069. sendPacket(103);
  11070. }
  11071.  
  11072. if (interfaceButtonAction == 6199 && promptInput.length() > 0) {
  11073. String inp = inputString;
  11074. inputString = "::changeclanname " + promptInput;
  11075. sendPacket(103);
  11076. inputString = inp;
  11077. }
  11078.  
  11079. if (friendsListAction == 3 && promptInput.length() > 0) {
  11080. getOut().putOpcode(126);
  11081. getOut().putByte(0);
  11082. int k = getOut().position;
  11083. getOut().putLong(aLong953);
  11084. TextInput.writeChatboxText(promptInput, getOut());
  11085. getOut().putVariableSizeByte(getOut().position - k);
  11086. promptInput = TextInput.processText(promptInput);
  11087. // promptInput = Censor.doCensor(promptInput);
  11088. pushMessage(promptInput, 6, TextClass.fixName(TextClass.nameForLong(aLong953)));
  11089. if (privateChatMode == 2) {
  11090. privateChatMode = 1;
  11091. getOut().putOpcode(95);
  11092. getOut().putByte(publicChatMode);
  11093. getOut().putByte(privateChatMode);
  11094. getOut().putByte(tradeMode);
  11095. }
  11096. }
  11097.  
  11098. if (friendsListAction == 4 && ignoreCount < 100) {
  11099. long l2 = TextClass.longForName(promptInput);
  11100. addIgnore(l2);
  11101. }
  11102.  
  11103. if (friendsListAction == 5 && ignoreCount > 0) {
  11104. long l3 = TextClass.longForName(promptInput);
  11105. delIgnore(l3);
  11106. }
  11107.  
  11108. if (friendsListAction == 6) {
  11109. long l3 = TextClass.longForName(promptInput);
  11110. chatJoin(l3);
  11111. } else if ((this.friendsListAction == 12) && (this.promptInput.length() > 0)) {
  11112. if (promptInput.toLowerCase().matches("\\d+")) {
  11113. int goalLevel = Integer.parseInt(this.promptInput);
  11114. if (goalLevel > 99) {
  11115. goalLevel = 99;
  11116. }
  11117. int currentMaxLevel = maxStats[Skills.selectedSkillId];
  11118. if(Skills.selectedSkillId == 5 || Skills.selectedSkillId == 3) {
  11119. currentMaxLevel /= 100;
  11120. }
  11121. if ((goalLevel < 0) || (currentMaxLevel >= goalLevel)) {
  11122. Skills.selectedSkillId = -1;
  11123. return;
  11124. }
  11125. Skills.goalType = "Target Level: ";
  11126. Skills.goalData[Skills.selectedSkillId][0] = currentExp[Skills.selectedSkillId];
  11127. Skills.goalData[Skills.selectedSkillId][1] = PlayerHandler.getXPForLevel(goalLevel) + 1;
  11128. Skills.goalData[Skills.selectedSkillId][2] = (Skills.goalData[Skills.selectedSkillId][0] / Skills.goalData[Skills.selectedSkillId][1]) * 100;
  11129. saveGoals(myUsername);
  11130. Skills.selectedSkillId = -1;
  11131. }
  11132. } else if ((this.friendsListAction == 13) && (this.promptInput.length() > 0) && ((this.promptInput.toLowerCase().matches("\\d+[a-z&&[kmb]]")) || (this.promptInput.matches("\\d+")))) {
  11133. int goalExp = 0;
  11134. try {
  11135. goalExp = Integer.parseInt(promptInput.trim().toLowerCase().replaceAll("k", "000").replaceAll("m", "000000").replaceAll("b", "000000000"));
  11136. } catch (Exception e) {
  11137. e.printStackTrace();
  11138. }
  11139. if ((goalExp <= 0) || (goalExp <= currentExp[Skills.selectedSkillId])) {
  11140. Skills.selectedSkillId = -1;
  11141. return;
  11142. } else if (goalExp > 1000000000) {
  11143. goalExp = 1000000000;
  11144. }
  11145. Skills.goalType = "Target Exp: ";
  11146. Skills.goalData[Skills.selectedSkillId][0] = currentExp[Skills.selectedSkillId];
  11147. Skills.goalData[Skills.selectedSkillId][1] = ((int) goalExp);
  11148. Skills.goalData[Skills.selectedSkillId][2] = (Skills.goalData[Skills.selectedSkillId][0] / Skills.goalData[Skills.selectedSkillId][1] * 100);
  11149. saveGoals(myUsername);
  11150. Skills.selectedSkillId = -1;
  11151. }
  11152. }
  11153. } else if (inputDialogState == 1) {
  11154. if (key >= 48 && key <= 57 && amountOrNameInput.length() < 10) {
  11155. amountOrNameInput += (char) key;
  11156. inputTaken = true;
  11157. }
  11158.  
  11159. if (!amountOrNameInput.toLowerCase().contains("k") && !amountOrNameInput.toLowerCase().contains("m") && !amountOrNameInput.toLowerCase().contains("b") && (key == 107 || key == 109) || key == 98) {
  11160. amountOrNameInput += (char) key;
  11161. inputTaken = true;
  11162. }
  11163.  
  11164. if (key == 8 && amountOrNameInput.length() > 0) {
  11165. amountOrNameInput = amountOrNameInput.substring(0, amountOrNameInput.length() - 1);
  11166. inputTaken = true;
  11167. }
  11168.  
  11169. if (key == 13 || key == 10) {
  11170. if (amountOrNameInput.length() > 0) {
  11171. if (amountOrNameInput.toLowerCase().contains("k")) {
  11172. amountOrNameInput = amountOrNameInput.replaceAll(
  11173. "k", "000");
  11174. } else if (amountOrNameInput.toLowerCase()
  11175. .contains("m")) {
  11176. amountOrNameInput = amountOrNameInput.replaceAll(
  11177. "m", "000000");
  11178. } else if (amountOrNameInput.toLowerCase()
  11179. .contains("b")) {
  11180. amountOrNameInput = amountOrNameInput.replaceAll(
  11181. "b", "000000000");
  11182. }
  11183. long l = Long.valueOf(amountOrNameInput);
  11184.  
  11185. if (l > 2147483647) {
  11186. amountOrNameInput = "2147483647";
  11187. }
  11188.  
  11189. int amount = 0;
  11190. amount = Integer.parseInt(amountOrNameInput);
  11191. if(interfaceButtonAction == 557 && withdrawingMoneyFromPouch) {
  11192. getOut().putOpcode(7);
  11193. getOut().putInt(amount);
  11194. inputDialogState = 0;
  11195. inputTaken = true;
  11196. withdrawingMoneyFromPouch = false;
  11197. return;
  11198. }
  11199. getOut().putOpcode(208);
  11200. getOut().putInt(amount);
  11201. }
  11202.  
  11203. inputDialogState = 0;
  11204. inputTaken = true;
  11205. }
  11206. } else if (inputDialogState == 2) {
  11207. if (key >= 32 && key <= 122 && amountOrNameInput.length() < 12) {
  11208. amountOrNameInput += (char) key;
  11209. inputTaken = true;
  11210. }
  11211.  
  11212. if (key == 8 && amountOrNameInput.length() > 0) {
  11213. amountOrNameInput = amountOrNameInput.substring(0, amountOrNameInput.length() - 1);
  11214. inputTaken = true;
  11215. }
  11216.  
  11217. if (key == 13 || key == 10) {
  11218. if (amountOrNameInput.length() > 0) {
  11219. getOut().putOpcode(60);
  11220. getOut().putByte(amountOrNameInput.length() + 1);
  11221. getOut().putString(amountOrNameInput);
  11222. }
  11223.  
  11224. inputDialogState = 0;
  11225. inputTaken = true;
  11226. }
  11227. } else if(inputDialogState == 3) {
  11228. if (key == 10) {
  11229. getGrandExchange().totalItemResults = 0;
  11230. amountOrNameInput = "";
  11231. inputDialogState = 0;
  11232. inputTaken = true;
  11233. }
  11234. if (key == 13 || key == 10) {
  11235. if (amountOrNameInput.length() == 0) {
  11236. getGrandExchange().searching = false;
  11237. interfaceButtonAction = 0;
  11238. }
  11239. }
  11240. if (key >= 32 && key <= 122 && amountOrNameInput.length() < 40) {
  11241. amountOrNameInput += (char) key;
  11242. inputTaken = true;
  11243. }
  11244. if (key == 8 && amountOrNameInput.length() > 0) {
  11245. amountOrNameInput = amountOrNameInput.substring(0,
  11246. amountOrNameInput.length() - 1);
  11247. inputTaken = true;
  11248. }
  11249. } else if (backDialogID == -1) {
  11250. if (key >= 32 && key <= 122 && inputString.length() < 80) {
  11251. inputString += (char) key;
  11252. inputTaken = true;
  11253. }
  11254.  
  11255. if (key == 8 && inputString.length() > 0) {
  11256. inputString = inputString.substring(0, inputString.length() - 1);
  11257. inputTaken = true;
  11258. }
  11259.  
  11260. if (key == 9) {
  11261. tabToReplyPm();
  11262. }
  11263.  
  11264. if ((key == 13 || key == 10) && inputString.length() > 0) {
  11265. if (inputString.startsWith("/")) {
  11266. getOut().putOpcode(5);
  11267. getOut().putByte(inputString.substring(1).length() +1);
  11268. getOut().putString(inputString.substring(1));
  11269. inputString = "";
  11270. return;
  11271. }
  11272. if (inputString.startsWith("::")
  11273. && !inputString.startsWith("::[")) {
  11274. getOut().putOpcode(103);
  11275. getOut().putByte(inputString.length() - 1);
  11276. getOut().putString(inputString.substring(2));
  11277. } else {
  11278.  
  11279. String s = inputString.toLowerCase();
  11280. int j2 = 0;
  11281. if (s.startsWith("yellow:")) {
  11282. j2 = 0;
  11283. inputString = inputString.substring(7);
  11284. } else if (s.startsWith("red:")) {
  11285. j2 = 1;
  11286. inputString = inputString.substring(4);
  11287. } else if (s.startsWith("green:")) {
  11288. j2 = 2;
  11289. inputString = inputString.substring(6);
  11290. } else if (s.startsWith("cyan:")) {
  11291. j2 = 3;
  11292. inputString = inputString.substring(5);
  11293. } else if (s.startsWith("purple:")) {
  11294. j2 = 4;
  11295. inputString = inputString.substring(7);
  11296. } else if (s.startsWith("white:")) {
  11297. j2 = 5;
  11298. inputString = inputString.substring(6);
  11299. } else if (s.startsWith("flash1:")) {
  11300. j2 = 6;
  11301. inputString = inputString.substring(7);
  11302. } else if (s.startsWith("flash2:")) {
  11303. j2 = 7;
  11304. inputString = inputString.substring(7);
  11305. } else if (s.startsWith("flash3:")) {
  11306. j2 = 8;
  11307. inputString = inputString.substring(7);
  11308. } else if (s.startsWith("glow1:")) {
  11309. j2 = 9;
  11310. inputString = inputString.substring(6);
  11311. } else if (s.startsWith("glow2:")) {
  11312. j2 = 10;
  11313. inputString = inputString.substring(6);
  11314. } else if (s.startsWith("glow3:")) {
  11315. j2 = 11;
  11316. inputString = inputString.substring(6);
  11317. }
  11318. s = inputString.toLowerCase();
  11319. int i3 = 0;
  11320. if (s.startsWith("wave:")) {
  11321. i3 = 1;
  11322. inputString = inputString.substring(5);
  11323. } else if (s.startsWith("wave2:")) {
  11324. i3 = 2;
  11325. inputString = inputString.substring(6);
  11326. } else if (s.startsWith("shake:")) {
  11327. i3 = 3;
  11328. inputString = inputString.substring(6);
  11329. } else if (s.startsWith("scroll:")) {
  11330. i3 = 4;
  11331. inputString = inputString.substring(7);
  11332. } else if (s.startsWith("slide:")) {
  11333. i3 = 5;
  11334. inputString = inputString.substring(6);
  11335. }
  11336. getOut().putOpcode(4);
  11337. getOut().putByte(0);
  11338. int j3 = getOut().position;
  11339. getOut().method425(i3);
  11340. getOut().method425(j2);
  11341. aStream_834.position = 0;
  11342. TextInput.writeChatboxText(inputString, aStream_834);
  11343. getOut().method441(0, aStream_834.buffer, aStream_834.position);
  11344. getOut().putVariableSizeByte(getOut().position - j3);
  11345. inputString = TextInput.processText(inputString);
  11346. // inputString = Censor.doCensor(inputString);
  11347. myPlayer.textSpoken = inputString;
  11348. myPlayer.anInt1513 = j2;
  11349. myPlayer.anInt1531 = i3;
  11350. myPlayer.textCycle = 150;
  11351. int prefixRights = myRights;
  11352. if(prefixRights == 0 && ironman > 0) {
  11353. prefixRights = 11 + ironman;
  11354. }
  11355. pushMessage(myPlayer.textSpoken, 2, getPrefix(prefixRights) + myPlayer.name, myPlayer.loyaltyTitle, myPlayer.loyaltyColor, myPlayer.loyaltyPosition);
  11356.  
  11357. if (publicChatMode == 2) {
  11358. publicChatMode = 3;
  11359. getOut().putOpcode(95);
  11360. getOut().putByte(publicChatMode);
  11361. getOut().putByte(privateChatMode);
  11362. getOut().putByte(tradeMode);
  11363. }
  11364. }
  11365. inputString = "";
  11366. inputTaken = true;
  11367. withdrawingMoneyFromPouch = false;
  11368. }
  11369. }
  11370. } while (true);
  11371. }
  11372.  
  11373. private void readNPCUpdateMask(ByteBuffer stream) {
  11374. for (int j = 0; j < anInt893; j++) {
  11375. int k = anIntArray894[j];
  11376. NPC npc = npcArray[k];
  11377. int l = stream.getUnsignedByte();
  11378. if ((l & 0x10) != 0) {
  11379. int i1 = stream.getShortBigEndian();
  11380. if (i1 == 65535) {
  11381. i1 = -1;
  11382. }
  11383. int i2 = stream.getUnsignedByte();
  11384. if (i1 == npc.anim && i1 != -1) {
  11385. int l2 = Animation.cache[i1].delayType;
  11386. if (l2 == 1) {
  11387. npc.currentAnimFrame = 0;
  11388. npc.anInt1528 = 0;
  11389. npc.animationDelay = i2;
  11390. npc.anInt1530 = 0;
  11391. }
  11392. if (l2 == 2) {
  11393. npc.anInt1530 = 0;
  11394. }
  11395. } else if (i1 == -1
  11396. || npc.anim == -1
  11397. || Animation.cache[i1].forcedPriority >= Animation.cache[npc.anim].forcedPriority) {
  11398. npc.anim = i1;
  11399. npc.currentAnimFrame = 0;
  11400. npc.anInt1528 = 0;
  11401. npc.animationDelay = i2;
  11402. npc.anInt1530 = 0;
  11403. npc.anInt1542 = npc.smallXYIndex;
  11404. try {
  11405. if (FrameReader.animationlist[Integer
  11406. .parseInt(
  11407. Integer.toHexString(
  11408. Animation.cache[i1].frameIDs[0])
  11409. .substring(
  11410. 0,
  11411. Integer.toHexString(
  11412. Animation.cache[i1].frameIDs[0])
  11413. .length() - 4),
  11414. 16)].length == 0)
  11415. onDemandFetcher
  11416. .requestFileData(
  11417. 1,
  11418. Integer.parseInt(
  11419. Integer.toHexString(
  11420. Animation.cache[i1].frameIDs[0])
  11421. .substring(
  11422. 0,
  11423. Integer.toHexString(
  11424. Animation.cache[i1].frameIDs[0])
  11425. .length() - 4),
  11426. 16));
  11427. } catch (Exception e) {
  11428. }
  11429. }
  11430. }
  11431. if ((l & 8) != 0) {
  11432. int j1 = getInputBuffer().getByteA();
  11433. int j2 = stream.method427();
  11434. int icon = stream.getUnsignedByte();
  11435. npc.updateHitData(j2, j1, loopCycle, icon, 0);
  11436. npc.loopCycleStatus = loopCycle + 300;
  11437. npc.currentHealth = getInputBuffer().getByteA();
  11438. npc.maxHealth = getInputBuffer().getByteA();
  11439. }
  11440. if ((l & 0x80) != 0) {
  11441. npc.gfxId = stream.getUnsignedShort();
  11442. int k1 = stream.getIntLittleEndian();
  11443. npc.graphicHeight = k1 >> 16;
  11444. npc.graphicDelay = loopCycle + (k1 & 0xffff);
  11445. npc.currentAnim = 0;
  11446. npc.animCycle = 0;
  11447. if (npc.graphicDelay > loopCycle) {
  11448. npc.currentAnim = -1;
  11449. }
  11450. if (npc.gfxId == 65535) {
  11451. npc.gfxId = -1;
  11452. }
  11453. try {
  11454. if (FrameReader.animationlist[Integer
  11455. .parseInt(
  11456. Integer.toHexString(
  11457. SpotAnimDefinition.cache[npc.gfxId].animation.frameIDs[0])
  11458. .substring(
  11459. 0,
  11460. Integer.toHexString(
  11461. SpotAnimDefinition.cache[npc.gfxId].animation.frameIDs[0])
  11462. .length() - 4), 16)].length == 0)
  11463. onDemandFetcher
  11464. .requestFileData(
  11465. 1,
  11466. Integer.parseInt(
  11467. Integer.toHexString(
  11468. SpotAnimDefinition.cache[npc.gfxId].animation.frameIDs[0])
  11469. .substring(
  11470. 0,
  11471. Integer.toHexString(
  11472. SpotAnimDefinition.cache[npc.gfxId].animation.frameIDs[0])
  11473. .length() - 4),
  11474. 16));
  11475. } catch (Exception e) {
  11476. }
  11477. }
  11478. if ((l & 0x20) != 0) {
  11479. npc.interactingEntity = stream.getUnsignedShort();
  11480. if (npc.interactingEntity == 65535) {
  11481. npc.interactingEntity = -1;
  11482. }
  11483. }
  11484. if ((l & 1) != 0) {
  11485. npc.textSpoken = stream.getString();
  11486. npc.textCycle = 100;
  11487. }
  11488. if ((l & 0x40) != 0) {
  11489. int l1 = getInputBuffer().getByteA();
  11490. int k2 = stream.method428();
  11491. int icon = stream.getUnsignedByte();
  11492. npc.updateHitData(k2, l1, loopCycle, icon, 0);
  11493. npc.loopCycleStatus = loopCycle + 300;
  11494. npc.currentHealth = getInputBuffer().getByteA();
  11495. npc.maxHealth = getInputBuffer().getByteA();
  11496. }
  11497. if ((l & 2) != 0) {
  11498. npc.definitionOverride = MobDefinition.get(stream.getShortBigEndianA());
  11499. npc.anInt1540 = npc.definitionOverride.npcSizeInSquares;
  11500. npc.anInt1504 = npc.definitionOverride.degreesToTurn;
  11501. npc.anInt1554 = npc.definitionOverride.walkAnimation;
  11502. npc.anInt1555 = npc.definitionOverride.walkingBackwardsAnimation;
  11503. npc.anInt1556 = npc.definitionOverride.walkLeftAnimation;
  11504. npc.anInt1557 = npc.definitionOverride.walkRightAnimation;
  11505. npc.anInt1511 = npc.definitionOverride.standAnimation;
  11506. }
  11507. if ((l & 4) != 0) {
  11508. npc.anInt1538 = stream.getShortBigEndian();
  11509. npc.anInt1539 = stream.getShortBigEndian();
  11510. }
  11511. }
  11512. }
  11513.  
  11514. private void method89(Class30_Sub1 class30_sub1) {
  11515. int i = 0;
  11516. int j = -1;
  11517. int k = 0;
  11518. int l = 0;
  11519. if (class30_sub1.anInt1296 == 0) {
  11520. i = worldController.method300(class30_sub1.anInt1295, class30_sub1.anInt1297, class30_sub1.anInt1298);
  11521. }
  11522. if (class30_sub1.anInt1296 == 1) {
  11523. i = worldController.method301(class30_sub1.anInt1295, class30_sub1.anInt1297, class30_sub1.anInt1298);
  11524. }
  11525. if (class30_sub1.anInt1296 == 2) {
  11526. i = worldController.method302(class30_sub1.anInt1295, class30_sub1.anInt1297, class30_sub1.anInt1298);
  11527. }
  11528. if (class30_sub1.anInt1296 == 3) {
  11529. i = worldController.method303(class30_sub1.anInt1295, class30_sub1.anInt1297, class30_sub1.anInt1298);
  11530. }
  11531. if (i != 0) {
  11532. int i1 = worldController.fetchObjectIDTagForPosition(class30_sub1.anInt1295, class30_sub1.anInt1297, class30_sub1.anInt1298, i);
  11533. j = i >> 14 & 0x7fff;
  11534. k = i1 & 0x1f;
  11535. l = i1 >> 6;
  11536. }
  11537. class30_sub1.anInt1299 = j;
  11538. class30_sub1.anInt1301 = k;
  11539. class30_sub1.anInt1300 = l;
  11540. }
  11541.  
  11542. private final void method90() {
  11543. for (int index = 0; soundCount > index; index++) {
  11544. soundDelay[index]--;
  11545.  
  11546. if (soundDelay[index] < -10) {
  11547. soundCount--;
  11548.  
  11549. for (int lastSound = index; soundCount > lastSound; lastSound++) {
  11550. sound[lastSound] = sound[lastSound + 1];
  11551. aClass26Array1468[lastSound] = aClass26Array1468[lastSound + 1];
  11552. soundType[lastSound] = soundType[lastSound + 1];
  11553. soundDelay[lastSound] = soundDelay[lastSound + 1];
  11554. }
  11555.  
  11556. index--;
  11557. } else {
  11558. Sound class26 = aClass26Array1468[index];
  11559.  
  11560. if (class26 == null) {
  11561. class26 = Sound.cache[sound[index]];
  11562.  
  11563. if (class26 == null) {
  11564. continue;
  11565. }
  11566.  
  11567. soundDelay[index] += class26.method652();
  11568. aClass26Array1468[index] = class26;
  11569. }
  11570.  
  11571. if (soundDelay[index] < 0) {
  11572. Class3_Sub9_Sub1 class3_sub9_sub1 = class26.method651().method405(aClass25_1948);
  11573. Class3_Sub7_Sub2 class3_sub7_sub2 = Class3_Sub7_Sub2.method396(class3_sub9_sub1, 100, soundEffectVolume);
  11574. class3_sub7_sub2.method394(soundType[index] - 1);
  11575. aClass3_Sub7_Sub1_1493.method384(class3_sub7_sub2);
  11576. soundDelay[index] = -100;
  11577. }
  11578. }
  11579. }
  11580.  
  11581. if (prevSong > 0) {
  11582. prevSong -= 20;
  11583.  
  11584. if (prevSong < 0) {
  11585. prevSong = 0;
  11586. }
  11587.  
  11588. if (prevSong == 0 && musicVolume != 0 && currentSong != -1) {
  11589. method56(musicVolume, false, currentSong);
  11590. }
  11591. }
  11592. }
  11593.  
  11594. private void updatePlayerMovement(ByteBuffer stream, int i) {
  11595. while (stream.bitPosition + 10 < i * 8) {
  11596. int j = stream.getBits(11);
  11597. if (j == 2047) {
  11598. break;
  11599. }
  11600. if (playerArray[j] == null) {
  11601. playerArray[j] = new Player();
  11602. if (getaStreamArray895s()[j] != null) {
  11603. playerArray[j].updatePlayer(getaStreamArray895s()[j]);
  11604. }
  11605. }
  11606. playerIndices[playerCount++] = j;
  11607. Player player = playerArray[j];
  11608. player.anInt1537 = loopCycle;
  11609. int k = stream.getBits(1);
  11610. if (k == 1) {
  11611. anIntArray894[anInt893++] = j;
  11612. }
  11613. int l = stream.getBits(1);
  11614. int i1 = stream.getBits(5);
  11615. if (i1 > 15) {
  11616. i1 -= 32;
  11617. }
  11618. int j1 = stream.getBits(5);
  11619. if (j1 > 15) {
  11620. j1 -= 32;
  11621. }
  11622. player.setPos(myPlayer.smallX[0] + j1, myPlayer.smallY[0] + i1, l == 1);
  11623. }
  11624. stream.finishBitAccess();
  11625. }
  11626.  
  11627. private void readNPCUpdateBlockForced() {
  11628. for (int j = 0; j < npcCount; j++) {
  11629. int k = npcIndices[j];
  11630. NPC npc = npcArray[k];
  11631. if (npc != null) {
  11632. entityUpdateBlock(npc);
  11633. }
  11634. }
  11635. }
  11636.  
  11637. private void entityUpdateBlock(Entity entity) {
  11638. if (entity.x < 128 || entity.y < 128 || entity.x >= 13184 || entity.y >= 13184) {
  11639. entity.anim = -1;
  11640. entity.gfxId = -1;
  11641. entity.anInt1547 = 0;
  11642. entity.anInt1548 = 0;
  11643. entity.x = entity.smallX[0] * 128 + entity.anInt1540 * 64;
  11644. entity.y = entity.smallY[0] * 128 + entity.anInt1540 * 64;
  11645. entity.method446();
  11646. }
  11647. if (entity == myPlayer && (entity.x < 1536 || entity.y < 1536 || entity.x >= 11776 || entity.y >= 11776)) {
  11648. entity.anim = -1;
  11649. entity.gfxId = -1;
  11650. entity.anInt1547 = 0;
  11651. entity.anInt1548 = 0;
  11652. entity.x = entity.smallX[0] * 128 + entity.anInt1540 * 64;
  11653. entity.y = entity.smallY[0] * 128 + entity.anInt1540 * 64;
  11654. entity.method446();
  11655. }
  11656. if (entity.anInt1547 > loopCycle) {
  11657. updateEntityPos(entity);
  11658. } else if (entity.anInt1548 >= loopCycle) {
  11659. updateEntityFace(entity);
  11660. } else {
  11661. processWalkingStep(entity);
  11662. }
  11663. appendFocusDest(entity);
  11664. appendAnimation(entity);
  11665. }
  11666.  
  11667. private void updateEntityPos(Entity entity) {
  11668. int i = entity.anInt1547 - loopCycle;
  11669. int j = entity.anInt1543 * 128 + entity.anInt1540 * 64;
  11670. int k = entity.anInt1545 * 128 + entity.anInt1540 * 64;
  11671. entity.x += (j - entity.x) / i;
  11672. entity.y += (k - entity.y) / i;
  11673. entity.anInt1503 = 0;
  11674. if (entity.anInt1549 == 0) {
  11675. entity.turnDirection = 1024;
  11676. }
  11677. if (entity.anInt1549 == 1) {
  11678. entity.turnDirection = 1536;
  11679. }
  11680. if (entity.anInt1549 == 2) {
  11681. entity.turnDirection = 0;
  11682. }
  11683. if (entity.anInt1549 == 3) {
  11684. entity.turnDirection = 512;
  11685. }
  11686. }
  11687.  
  11688. private void updateEntityFace(Entity entity) {
  11689. if (entity.anInt1548 == loopCycle || entity.anim == -1 || entity.animationDelay != 0 || entity.anInt1528 + 1 > Animation.cache[entity.anim].getFrameLength(entity.currentAnimFrame)) {
  11690. int i = entity.anInt1548 - entity.anInt1547;
  11691. int j = loopCycle - entity.anInt1547;
  11692. int k = entity.anInt1543 * 128 + entity.anInt1540 * 64;
  11693. int l = entity.anInt1545 * 128 + entity.anInt1540 * 64;
  11694. int i1 = entity.anInt1544 * 128 + entity.anInt1540 * 64;
  11695. int j1 = entity.anInt1546 * 128 + entity.anInt1540 * 64;
  11696. entity.x = (k * (i - j) + i1 * j) / i;
  11697. entity.y = (l * (i - j) + j1 * j) / i;
  11698. }
  11699. entity.anInt1503 = 0;
  11700. if (entity.anInt1549 == 0) {
  11701. entity.turnDirection = 1024;
  11702. }
  11703. if (entity.anInt1549 == 1) {
  11704. entity.turnDirection = 1536;
  11705. }
  11706. if (entity.anInt1549 == 2) {
  11707. entity.turnDirection = 0;
  11708. }
  11709. if (entity.anInt1549 == 3) {
  11710. entity.turnDirection = 512;
  11711. }
  11712. entity.anInt1552 = entity.turnDirection;
  11713. }
  11714.  
  11715. private void processWalkingStep(Entity entity) {
  11716. entity.anInt1517 = entity.anInt1511;
  11717. if (entity.smallXYIndex == 0) {
  11718. entity.anInt1503 = 0;
  11719. return;
  11720. }
  11721. if (entity.anim != -1 && entity.animationDelay == 0) {
  11722. Animation animation = Animation.cache[entity.anim];
  11723. /*
  11724. * for (int i = 0; i < animation.anIntArray357.length; i++) {
  11725. * animation.anIntArray357[i] = -1; }
  11726. */
  11727. if (entity.anInt1542 > 0 && animation.resetWhenWalk == 0) {
  11728. entity.anInt1503++;
  11729. return;
  11730. }
  11731. if (entity.anInt1542 <= 0 && animation.priority == 0) {
  11732. entity.anInt1503++;
  11733. return;
  11734. }
  11735. }
  11736. int i = entity.x;
  11737. int j = entity.y;
  11738. int k = entity.smallX[entity.smallXYIndex - 1] * 128 + entity.anInt1540 * 64;
  11739. int l = entity.smallY[entity.smallXYIndex - 1] * 128 + entity.anInt1540 * 64;
  11740. if (k - i > 256 || k - i < -256 || l - j > 256 || l - j < -256) {
  11741. entity.x = k;
  11742. entity.y = l;
  11743. return;
  11744. }
  11745. if (i < k) {
  11746. if (j < l) {
  11747. entity.turnDirection = 1280;
  11748. } else if (j > l) {
  11749. entity.turnDirection = 1792;
  11750. } else {
  11751. entity.turnDirection = 1536;
  11752. }
  11753. } else if (i > k) {
  11754. if (j < l) {
  11755. entity.turnDirection = 768;
  11756. } else if (j > l) {
  11757. entity.turnDirection = 256;
  11758. } else {
  11759. entity.turnDirection = 512;
  11760. }
  11761. } else if (j < l) {
  11762. entity.turnDirection = 1024;
  11763. } else {
  11764. entity.turnDirection = 0;
  11765. }
  11766. int i1 = entity.turnDirection - entity.anInt1552 & 0x7ff;
  11767. if (i1 > 1024) {
  11768. i1 -= 2048;
  11769. }
  11770. int j1 = entity.anInt1555;
  11771. if (i1 >= -256 && i1 <= 256) {
  11772. j1 = entity.anInt1554;
  11773. } else if (i1 >= 256 && i1 < 768) {
  11774. j1 = entity.anInt1557;
  11775. } else if (i1 >= -768 && i1 <= -256) {
  11776. j1 = entity.anInt1556;
  11777. }
  11778. if (j1 == -1) {
  11779. j1 = entity.anInt1554;
  11780. }
  11781. entity.anInt1517 = j1;
  11782. int k1 = 4;
  11783. if (entity.anInt1552 != entity.turnDirection && entity.interactingEntity == -1 && entity.anInt1504 != 0) {
  11784. k1 = 2;
  11785. }
  11786. if (entity.smallXYIndex > 2) {
  11787. k1 = 6;
  11788. }
  11789. if (entity.smallXYIndex > 3) {
  11790. k1 = 8;
  11791. }
  11792. if (entity.anInt1503 > 0 && entity.smallXYIndex > 1) {
  11793. k1 = 8;
  11794. entity.anInt1503--;
  11795. }
  11796. if (entity.aBooleanArray1553[entity.smallXYIndex - 1]) {
  11797. k1 <<= 1;
  11798. }
  11799. if (k1 >= 8 && entity.anInt1517 == entity.anInt1554 && entity.runAnimation != -1) {
  11800. entity.anInt1517 = entity.runAnimation;
  11801. }
  11802. if (i < k) {
  11803. entity.x += k1;
  11804. if (entity.x > k) {
  11805. entity.x = k;
  11806. }
  11807. } else if (i > k) {
  11808. entity.x -= k1;
  11809. if (entity.x < k) {
  11810. entity.x = k;
  11811. }
  11812. }
  11813. if (j < l) {
  11814. entity.y += k1;
  11815. if (entity.y > l) {
  11816. entity.y = l;
  11817. }
  11818. } else if (j > l) {
  11819. entity.y -= k1;
  11820. if (entity.y < l) {
  11821. entity.y = l;
  11822. }
  11823. }
  11824. if (entity.x == k && entity.y == l) {
  11825. entity.smallXYIndex--;
  11826. if (entity.anInt1542 > 0) {
  11827. entity.anInt1542--;
  11828. }
  11829. }
  11830. }
  11831.  
  11832. public final String methodR(int i) {
  11833. if (i >= 0 && i < 10000) {
  11834. return String.valueOf(i);
  11835. }
  11836.  
  11837. if (i >= 10000 && i < 10000000) {
  11838. return i / 1000 + "K";
  11839. }
  11840.  
  11841. if (i >= 10000000 && i <= Integer.MAX_VALUE) {
  11842. return i / 1000000 + "M";
  11843. }
  11844.  
  11845. if (i > Integer.MAX_VALUE) {
  11846. return "*";
  11847. } else {
  11848. return "?";
  11849. }
  11850. }
  11851.  
  11852. public boolean mouseInCircle(int centerX, int centerY, int radius) {
  11853. return (super.mouseX - centerX) * (super.mouseX - centerX) + (super.mouseY - centerY) * (super.mouseY - centerY) < radius * radius;
  11854. }
  11855.  
  11856. private void npcScreenPos(Entity entity, int i) {
  11857. calcEntityScreenPos(entity.x, i, entity.y);
  11858. }
  11859.  
  11860. private void nullLoader() {
  11861. aBoolean831 = false;
  11862. while (drawingFlames) {
  11863. aBoolean831 = false;
  11864. try {
  11865. Thread.sleep(50L);
  11866. } catch (Exception _ex) {
  11867. }
  11868. }
  11869.  
  11870. // anIntArray1190 = null;
  11871. // anIntArray1191 = null;
  11872. }
  11873.  
  11874. private DataInputStream openJagGrabInputStream(String s) throws IOException {
  11875. // if(!aBoolean872)
  11876. // if(signlink.mainapp != null)
  11877. // return signlink.openurl(s);
  11878. // else
  11879. // return new DataInputStream((new URL(getCodeBase(), s)).openStream());
  11880. if (aSocket832 != null) {
  11881. try {
  11882. aSocket832.close();
  11883. } catch (Exception _ex) {
  11884. }
  11885. aSocket832 = null;
  11886. }
  11887. aSocket832 = createFileServerSocket(43595);
  11888. aSocket832.setSoTimeout(10000);
  11889. java.io.InputStream inputstream = aSocket832.getInputStream();
  11890. OutputStream outputstream = aSocket832.getOutputStream();
  11891. outputstream.write(("JAGGRAB /" + s + "\n\n").getBytes());
  11892. return new DataInputStream(inputstream);
  11893. }
  11894.  
  11895. private boolean parsePacket() {
  11896. if (getConnection() == null) {
  11897. return false;
  11898. }
  11899. try {
  11900. int available = getConnection().available();
  11901.  
  11902. if (available == 0) {
  11903. return false;
  11904. }
  11905.  
  11906. if (pktType == -1) {
  11907. getConnection().flushInputStream(getInputBuffer().buffer, 1);
  11908. pktType = getInputBuffer().buffer[0] & 0xff;
  11909.  
  11910. if (getConnectionCipher() != null) {
  11911. pktType = pktType - getConnectionCipher().next() & 0xff;
  11912. }
  11913.  
  11914. pktSize = SizeConstants.PACKET_SIZES[pktType];
  11915. available--;
  11916. }
  11917.  
  11918. if (pktSize == -1) {
  11919. if (available > 0) {
  11920. getConnection().flushInputStream(getInputBuffer().buffer, 1);
  11921. pktSize = getInputBuffer().buffer[0] & 0xff;
  11922. available--;
  11923. } else {
  11924. return false;
  11925. }
  11926. }
  11927.  
  11928. if (pktSize == -2) {
  11929. if (available > 1) {
  11930. getConnection().flushInputStream(getInputBuffer().buffer, 2);
  11931. getInputBuffer().position = 0;
  11932. pktSize = getInputBuffer().getUnsignedShort();
  11933. available -= 2;
  11934. } else {
  11935. return false;
  11936. }
  11937. }
  11938.  
  11939. if (available < pktSize) {
  11940. return false;
  11941. }
  11942.  
  11943. getInputBuffer().position = 0;
  11944. getConnection().flushInputStream(getInputBuffer().buffer, pktSize);
  11945. anInt1009 = 0;
  11946. anInt843 = anInt842;
  11947. anInt842 = anInt841;
  11948. anInt841 = pktType;
  11949.  
  11950. switch (pktType) {
  11951. case 81:
  11952. updatePlayers(pktSize, getInputBuffer());
  11953. sendFrame36(175, openInterfaceID == 26000 ? 1 : 0);
  11954. aBoolean1080 = false;
  11955. pktType = -1;
  11956. return true;
  11957.  
  11958. case 88:
  11959. int xface = getInputBuffer().getSignedShort();
  11960. int yface = getInputBuffer().getSignedShort();
  11961. int npcindex = getInputBuffer().getShortBigEndian();
  11962. if(npcindex < npcArray.length) {
  11963. NPC npc = npcArray[npcindex];
  11964. if(npc != null) {
  11965. npc.anInt1538 = xface;
  11966. npc.anInt1539 = yface;
  11967. }
  11968. }
  11969. pktType = -1;
  11970. return true;
  11971.  
  11972. case 176:
  11973. daysSinceRecovChange = getInputBuffer().method427();
  11974. unreadMessages = getInputBuffer().method435();
  11975. membersInt = getInputBuffer().getUnsignedByte();
  11976. anInt1193 = getInputBuffer().method440();
  11977. daysSinceLastLogin = getInputBuffer().getUnsignedShort();
  11978.  
  11979. pktType = -1;
  11980. return true;
  11981.  
  11982. case 64:
  11983. anInt1268 = getInputBuffer().method427();
  11984. anInt1269 = getInputBuffer().method428();
  11985.  
  11986. for (int j = anInt1268; j < anInt1268 + 8; j++) {
  11987. for (int l9 = anInt1269; l9 < anInt1269 + 8; l9++) {
  11988. if (groundArray[plane][j][l9] != null) {
  11989. groundArray[plane][j][l9] = null;
  11990. spawnGroundItem(j, l9);
  11991. }
  11992. }
  11993. }
  11994.  
  11995. for (Class30_Sub1 class30_sub1 = (Class30_Sub1) getaClass19_1179().reverseGetFirst(); class30_sub1 != null; class30_sub1 = (Class30_Sub1) getaClass19_1179().reverseGetNext()) {
  11996. if (class30_sub1.anInt1297 >= anInt1268 && class30_sub1.anInt1297 < anInt1268 + 8 && class30_sub1.anInt1298 >= anInt1269 && class30_sub1.anInt1298 < anInt1269 + 8 && class30_sub1.anInt1295 == plane) {
  11997. class30_sub1.anInt1294 = 0;
  11998. }
  11999. }
  12000. pktType = -1;
  12001. return true;
  12002.  
  12003. case 185:
  12004.  
  12005. int k = getInputBuffer().getShortBigEndianA();
  12006.  
  12007. RSInterface.interfaceCache[k].mediaType = 3;
  12008. if (myPlayer.desc == null) {
  12009. RSInterface.interfaceCache[k].mediaID = (myPlayer.anIntArray1700[0] << 25) + (myPlayer.anIntArray1700[4] << 20) + (myPlayer.equipment[0] << 15) + (myPlayer.equipment[8] << 10) + (myPlayer.equipment[11] << 5) + myPlayer.equipment[1];
  12010. } else {
  12011. RSInterface.interfaceCache[k].mediaID = (int) (0x12345678L + myPlayer.desc.id);
  12012. }
  12013. pktType = -1;
  12014. return true;
  12015.  
  12016. /* Clan chat packet */
  12017. case 217:
  12018. try {
  12019. name = getInputBuffer().getString();
  12020. message = getInputBuffer().getString();
  12021. clanName = getInputBuffer().getString();
  12022. rights = getInputBuffer().getUnsignedShort();
  12023. /*
  12024. * String addon = null; if(rights < 4) addon =
  12025. * "@cr"+rights+"@";
  12026. */
  12027. String tag = name.replaceAll("null", "");
  12028. message = TextInput.processText(message);
  12029. // message = Censor.doCensor(message);
  12030. pushMessage(message, 16, tag);
  12031. } catch (Exception e) {
  12032. e.printStackTrace();
  12033. }
  12034. pktType = -1;
  12035. return true;
  12036.  
  12037. case 107:
  12038. cameraViewChanged = false;
  12039. for (int l = 0; l < 5; l++) {
  12040. aBooleanArray876[l] = false;
  12041. }
  12042. pktType = -1;
  12043. return true;
  12044.  
  12045. case 72:
  12046. int i1 = getInputBuffer().getShortBigEndian();
  12047. RSInterface class9 = RSInterface.interfaceCache[i1];
  12048. for (int k15 = 0; k15 < class9.inv.length; k15++) {
  12049. class9.inv[k15] = -1;
  12050. class9.inv[k15] = 0;
  12051. }
  12052. pktType = -1;
  12053. return true;
  12054.  
  12055. case 214:
  12056. ignoreCount = getInputBuffer().getShort();
  12057. for(int i2 = 0; i2 < ignoreCount; i2++) {
  12058. ignoreListAsLongs[i2] = Long.parseLong(getInputBuffer().getString());
  12059. }
  12060. pktType = -1;
  12061. return true;
  12062.  
  12063. case 244:
  12064. String data = getInputBuffer().getString();
  12065. getGrandExchange().update(data);
  12066. pktType = -1;
  12067. return true;
  12068.  
  12069. case 166:
  12070. cameraViewChanged = true;
  12071. spinPacketX = getInputBuffer().getUnsignedByte();
  12072. spinPacketY = getInputBuffer().getUnsignedByte();
  12073. spinPacketHeight = getInputBuffer().getUnsignedShort();
  12074. spinPacketConstantSpeed = getInputBuffer().getUnsignedByte();
  12075. spinPacketVariableSpeed = getInputBuffer().getUnsignedByte();
  12076. if (spinPacketVariableSpeed >= 100) {
  12077. xCameraPos = spinPacketX * 128 + 64;
  12078. yCameraPos = spinPacketY * 128 + 64;
  12079.  
  12080. zCameraPos = method42(plane, yCameraPos, xCameraPos) - spinPacketHeight;
  12081. }
  12082. pktType = -1;
  12083. return true;
  12084.  
  12085. case 134:
  12086. // needDrawTabArea = true;
  12087.  
  12088. int skillId = getInputBuffer().getUnsignedByte();
  12089. int exp = getInputBuffer().method439();
  12090. int level = getInputBuffer().getUnsignedShort();
  12091. int maxLevel = getInputBuffer().getUnsignedShort();
  12092. int gainedExperience = exp - currentExp[skillId];
  12093. currentExp[skillId] = exp;
  12094. currentStats[skillId] = level;
  12095. maxStats[skillId] = maxLevel;
  12096. if(gainedExperience > 0)
  12097. PlayerHandler.addXP(skillId, gainedExperience);
  12098. if(skillId == 23) {
  12099. setInterfaceText(""+maxLevel+"", 28171);
  12100. }
  12101. pktType = -1;
  12102. return true;
  12103.  
  12104. case 71:
  12105. int l1 = getInputBuffer().getUnsignedShort();
  12106. int j10 = getInputBuffer().method426();
  12107. if (l1 == 65535) {
  12108. l1 = -1;
  12109. }
  12110. tabInterfaceIDs[j10] = l1;
  12111. prayerInterfaceType = tabInterfaceIDs[5];
  12112. tabAreaAltered = true;
  12113. pktType = -1;
  12114. return true;
  12115.  
  12116. case 74:
  12117. int songId = getInputBuffer().getShortBigEndian();
  12118. if (songId == 65535) {
  12119. songId = -1;
  12120. }
  12121. if (songId != -1 || prevSong != 0) {
  12122. if (songId != -1 && currentSong != songId && musicVolume != 0 && prevSong == 0) {
  12123. method58(10, musicVolume, false, songId);
  12124. }
  12125. } else {
  12126. method55(false);
  12127. }
  12128. currentSong = songId;
  12129. pktType = -1;
  12130. return true;
  12131.  
  12132. case 121:
  12133. int tempSongId = getInputBuffer().getShortBigEndianA();
  12134. int tempSongDelay = getInputBuffer().method435();
  12135. if (tempSongId == 65535) {
  12136. tempSongId = -1;
  12137. }
  12138. if (musicVolume != 0 && tempSongDelay != -1) {
  12139. method56(musicVolume, false, tempSongId);
  12140. prevSong = tempSongDelay * 20;
  12141. }
  12142. pktType = -1;
  12143. return true;
  12144.  
  12145. case 109:
  12146. resetLogout();
  12147. pktType = -1;
  12148. return false;
  12149.  
  12150. case 70:
  12151. int modifierX = getInputBuffer().getSignedShort();
  12152. int modifierY = getInputBuffer().method437();
  12153. int widgetId = getInputBuffer().getShortBigEndian();
  12154. RSInterface widget = RSInterface.interfaceCache[widgetId];
  12155. widget.xOffset = modifierX;
  12156. widget.yOffset = modifierY;
  12157. pktType = -1;
  12158. return true;
  12159.  
  12160. case 73:
  12161. case 241:
  12162. int l2 = anInt1069;
  12163. int i11 = anInt1070;
  12164. if (pktType == 73) {
  12165. l2 = mapX = getInputBuffer().method435();
  12166. i11 = mapY = getInputBuffer().getUnsignedShort();
  12167. aBoolean1159 = false;
  12168. }
  12169. if (pktType == 241) {
  12170. i11 = getInputBuffer().method435();
  12171. getInputBuffer().initBitAccess();
  12172. for (int j16 = 0; j16 < 4; j16++) {
  12173. for (int l20 = 0; l20 < 13; l20++) {
  12174. for (int j23 = 0; j23 < 13; j23++) {
  12175. int emptyFloor = getInputBuffer().getBits(1);
  12176. if (emptyFloor == 1) {
  12177. anIntArrayArrayArray1129[j16][l20][j23] = getInputBuffer().getBits(26);
  12178. } else {
  12179. anIntArrayArrayArray1129[j16][l20][j23] = -1;
  12180. }
  12181. }
  12182. }
  12183. }
  12184. getInputBuffer().finishBitAccess();
  12185. l2 = getInputBuffer().getUnsignedShort();
  12186. aBoolean1159 = true;
  12187. }
  12188. if (anInt1069 == l2 && anInt1070 == i11 && loadingStage == 2) {
  12189. pktType = -1;
  12190. return true;
  12191. }
  12192. anInt1069 = l2;
  12193. anInt1070 = i11;
  12194. baseX = (anInt1069 - 6) * 8;
  12195. baseY = (anInt1070 - 6) * 8;
  12196. aBoolean1141 = (anInt1069 / 8 == 48 || anInt1069 / 8 == 49) && anInt1070 / 8 == 48;
  12197. if (anInt1069 / 8 == 48 && anInt1070 / 8 == 148) {
  12198. aBoolean1141 = true;
  12199. }
  12200. loadingStage = 1;
  12201. aLong824 = System.currentTimeMillis();
  12202. gameScreenIP.initDrawingArea();
  12203. cacheSprite[1105].drawSprite(8, 9);
  12204. //drawLoadingMessages(1, "Loading - please wait.", null);
  12205. if (!resizing) {
  12206. gameScreenIP.drawGraphics(gameScreenDrawY, super.graphics, gameScreenDrawX);
  12207. }
  12208. if (pktType == 73) {
  12209. int k16 = 0;
  12210. for (int i21 = (anInt1069 - 6) / 8; i21 <= (anInt1069 + 6) / 8; i21++) {
  12211. for (int k23 = (anInt1070 - 6) / 8; k23 <= (anInt1070 + 6) / 8; k23++) {
  12212. k16++;
  12213. }
  12214. }
  12215. aByteArrayArray1183 = new byte[k16][];
  12216. aByteArrayArray1247 = new byte[k16][];
  12217. anIntArray1234 = new int[k16];
  12218. floorMap = new int[k16];
  12219. objectMap = new int[k16];
  12220. k16 = 0;
  12221. for (int l23 = (anInt1069 - 6) / 8; l23 <= (anInt1069 + 6) / 8; l23++) {
  12222. for (int j26 = (anInt1070 - 6) / 8; j26 <= (anInt1070 + 6) / 8; j26++) {
  12223. anIntArray1234[k16] = (l23 << 8) + j26;
  12224. if (aBoolean1141 && (j26 == 49 || j26 == 149 || j26 == 147 || l23 == 50 || l23 == 49 && j26 == 47)) {
  12225. floorMap[k16] = -1;
  12226. objectMap[k16] = -1;
  12227. k16++;
  12228. } else {
  12229. int k28 = floorMap[k16] = onDemandFetcher.getMapCount(0, j26, l23);
  12230. if (k28 != -1) {
  12231. onDemandFetcher.requestFileData(3, k28);
  12232. }
  12233. int j30 = objectMap[k16] = onDemandFetcher.getMapCount(1, j26, l23);
  12234. if (j30 != -1) {
  12235. onDemandFetcher.requestFileData(3, j30);
  12236. }
  12237. k16++;
  12238. }
  12239. }
  12240. }
  12241. }
  12242. if (pktType == 241) {
  12243. int l16 = 0;
  12244. int ai[] = new int[676];
  12245. for (int i24 = 0; i24 < 4; i24++) {
  12246. for (int k26 = 0; k26 < 13; k26++) {
  12247. for (int l28 = 0; l28 < 13; l28++) {
  12248. int k30 = anIntArrayArrayArray1129[i24][k26][l28];
  12249. if (k30 != -1) {
  12250. int k31 = k30 >> 14 & 0x3ff;
  12251. int i32 = k30 >> 3 & 0x7ff;
  12252. int k32 = (k31 / 8 << 8) + i32 / 8;
  12253. for (int j33 = 0; j33 < l16; j33++) {
  12254. if (ai[j33] != k32) {
  12255. continue;
  12256. }
  12257. k32 = -1;
  12258.  
  12259. }
  12260. if (k32 != -1) {
  12261. ai[l16++] = k32;
  12262. }
  12263. }
  12264. }
  12265. }
  12266. }
  12267. aByteArrayArray1183 = new byte[l16][];
  12268. aByteArrayArray1247 = new byte[l16][];
  12269. anIntArray1234 = new int[l16];
  12270. floorMap = new int[l16];
  12271. objectMap = new int[l16];
  12272. for (int l26 = 0; l26 < l16; l26++) {
  12273. int i29 = anIntArray1234[l26] = ai[l26];
  12274. int l30 = i29 >> 8 & 0xff;
  12275. int l31 = i29 & 0xff;
  12276. int j32 = floorMap[l26] = onDemandFetcher.getMapCount(0, l31, l30);
  12277. if (j32 != -1) {
  12278. onDemandFetcher.requestFileData(3, j32);
  12279. }
  12280. int i33 = objectMap[l26] = onDemandFetcher.getMapCount(1, l31, l30);
  12281. if (i33 != -1) {
  12282. onDemandFetcher.requestFileData(3, i33);
  12283. }
  12284. }
  12285. }
  12286. int i17 = baseX - anInt1036;
  12287. int j21 = baseY - anInt1037;
  12288. anInt1036 = baseX;
  12289. anInt1037 = baseY;
  12290. for (int j24 = 0; j24 < 16384; j24++) {
  12291. NPC npc = npcArray[j24];
  12292. if (npc != null) {
  12293. for (int j29 = 0; j29 < 10; j29++) {
  12294. npc.smallX[j29] -= i17;
  12295. npc.smallY[j29] -= j21;
  12296. }
  12297. npc.x -= i17 * 128;
  12298. npc.y -= j21 * 128;
  12299. }
  12300. }
  12301. for (int i27 = 0; i27 < getMaxPlayers(); i27++) {
  12302. Player player = playerArray[i27];
  12303. if (player != null) {
  12304. for (int i31 = 0; i31 < 10; i31++) {
  12305. player.smallX[i31] -= i17;
  12306. player.smallY[i31] -= j21;
  12307. }
  12308. player.x -= i17 * 128;
  12309. player.y -= j21 * 128;
  12310. }
  12311. }
  12312. aBoolean1080 = true;
  12313. byte byte1 = 0;
  12314. byte byte2 = 104;
  12315. byte byte3 = 1;
  12316. if (i17 < 0) {
  12317. byte1 = 103;
  12318. byte2 = -1;
  12319. byte3 = -1;
  12320. }
  12321. byte byte4 = 0;
  12322. byte byte5 = 104;
  12323. byte byte6 = 1;
  12324. if (j21 < 0) {
  12325. byte4 = 103;
  12326. byte5 = -1;
  12327. byte6 = -1;
  12328. }
  12329. for (int k33 = byte1; k33 != byte2; k33 += byte3) {
  12330. for (int l33 = byte4; l33 != byte5; l33 += byte6) {
  12331. int i34 = k33 + i17;
  12332. int j34 = l33 + j21;
  12333. for (int k34 = 0; k34 < 4; k34++) {
  12334. if (i34 >= 0 && j34 >= 0 && i34 < 104 && j34 < 104) {
  12335. groundArray[k34][k33][l33] = groundArray[k34][i34][j34];
  12336. } else {
  12337. groundArray[k34][k33][l33] = null;
  12338. }
  12339. }
  12340. }
  12341. }
  12342. for (Class30_Sub1 class30_sub1_1 = (Class30_Sub1) getaClass19_1179().reverseGetFirst(); class30_sub1_1 != null; class30_sub1_1 = (Class30_Sub1) getaClass19_1179().reverseGetNext()) {
  12343. class30_sub1_1.anInt1297 -= i17;
  12344. class30_sub1_1.anInt1298 -= j21;
  12345. if (class30_sub1_1.anInt1297 < 0 || class30_sub1_1.anInt1298 < 0 || class30_sub1_1.anInt1297 >= 104 || class30_sub1_1.anInt1298 >= 104) {
  12346. class30_sub1_1.unlink();
  12347. }
  12348. }
  12349. if (destX != 0) {
  12350. destX -= i17;
  12351. destY -= j21;
  12352. }
  12353. cameraViewChanged = false;
  12354. pktType = -1;
  12355. return true;
  12356.  
  12357. case 208:
  12358. int i3 = getInputBuffer().getUnsignedShort();
  12359. if(i3 == 65535)
  12360. i3 = -1;
  12361. if (i3 >= 0)
  12362. resetInterfaceAnimation(i3);
  12363. setWalkableInterfaceId(i3);
  12364. pktType = -1;
  12365. return true;
  12366.  
  12367. case 99:
  12368. anInt1021 = getInputBuffer().getUnsignedByte();
  12369. pktType = -1;
  12370. return true;
  12371.  
  12372. case 75:
  12373. int j3 = getInputBuffer().getShortBigEndianA();
  12374. int j11 = getInputBuffer().getShortBigEndianA();
  12375. RSInterface.interfaceCache[j11].mediaType = 2;
  12376. RSInterface.interfaceCache[j11].mediaID = j3;
  12377. pktType = -1;
  12378. return true;
  12379.  
  12380. case 114:
  12381. systemUpdateTimer = getInputBuffer().getShortBigEndian() * 30;
  12382. pktType = -1;
  12383. return true;
  12384.  
  12385. case 60:
  12386. anInt1269 = getInputBuffer().getUnsignedByte();
  12387. anInt1268 = getInputBuffer().method427();
  12388. while (getInputBuffer().position < pktSize) {
  12389. int k3 = getInputBuffer().getUnsignedByte();
  12390. parseEntityPacket(getInputBuffer(), k3);
  12391. }
  12392. pktType = -1;
  12393. return true;
  12394.  
  12395. case 35:
  12396. int l3 = getInputBuffer().getUnsignedByte();
  12397. int k11 = getInputBuffer().getUnsignedByte();
  12398. int j17 = getInputBuffer().getUnsignedByte();
  12399. int k21 = getInputBuffer().getUnsignedByte();
  12400. aBooleanArray876[l3] = true;
  12401. anIntArray873[l3] = k11;
  12402. anIntArray1203[l3] = j17;
  12403. anIntArray928[l3] = k21;
  12404. anIntArray1030[l3] = 0;
  12405. pktType = -1;
  12406. return true;
  12407.  
  12408. case 174:
  12409. int id = getInputBuffer().getUnsignedShort();
  12410. int type = getInputBuffer().getUnsignedByte();
  12411. int delay = getInputBuffer().getUnsignedShort();
  12412. if (soundEffectVolume != 0 && type != 0 && soundCount < 50) {
  12413. sound[soundCount] = id;
  12414. soundType[soundCount] = type;
  12415. soundDelay[soundCount] = delay;
  12416. aClass26Array1468[soundCount] = null;
  12417. soundCount++;
  12418. }
  12419. pktType = -1;
  12420. return true;
  12421.  
  12422. case 104:
  12423. int j4 = getInputBuffer().method427();
  12424. int i12 = getInputBuffer().method426();
  12425. String s6 = getInputBuffer().getString();
  12426. if (j4 >= 1 && j4 <= 5) {
  12427. if (s6.equalsIgnoreCase("null")) {
  12428. s6 = null;
  12429. }
  12430. atPlayerActions[j4 - 1] = s6;
  12431. atPlayerArray[j4 - 1] = i12 == 0;
  12432. }
  12433. pktType = -1;
  12434. return true;
  12435.  
  12436. case 78:
  12437. destX = 0;
  12438. pktType = -1;
  12439. return true;
  12440. case 253:
  12441. String s = getInputBuffer().getString();
  12442. if (consoleOpen) {
  12443. printConsoleMessage(s, 0);
  12444. } else if (s.endsWith(":tradereq:")) {
  12445. String s3 = s.substring(0, s.indexOf(":"));
  12446. long l17 = TextClass.longForName(s3);
  12447. boolean flag2 = false;
  12448. for (int j27 = 0; j27 < ignoreCount; j27++) {
  12449. if (ignoreListAsLongs[j27] != l17) {
  12450. continue;
  12451. }
  12452. flag2 = true;
  12453.  
  12454. }
  12455. if (!flag2 && anInt1251 == 0) {
  12456. pushMessage("wishes to trade with you.", 4, s3);
  12457. }
  12458. } else if (s.startsWith(":clan:")) {
  12459. pushMessage(s.substring(6, s.length()), 16, "");
  12460. } else if (s.endsWith("#url#")) {
  12461. String link = s.substring(0, s.indexOf("#"));
  12462. pushMessage("Join us at: ", 9, link);
  12463. } else if (s.endsWith(":duelreq:")) {
  12464. String s4 = s.substring(0, s.indexOf(":"));
  12465. long l18 = TextClass.longForName(s4);
  12466. boolean flag3 = false;
  12467. for (int k27 = 0; k27 < ignoreCount; k27++) {
  12468. if (ignoreListAsLongs[k27] != l18) {
  12469. continue;
  12470. }
  12471. flag3 = true;
  12472.  
  12473. }
  12474. if (!flag3 && anInt1251 == 0) {
  12475. pushMessage("wishes to duel with you.", 8, s4);
  12476. }
  12477. } else if (s.endsWith(":chalreq:")) {
  12478. String s5 = s.substring(0, s.indexOf(":"));
  12479. long l19 = TextClass.longForName(s5);
  12480. boolean flag4 = false;
  12481. for (int l27 = 0; l27 < ignoreCount; l27++) {
  12482. if (ignoreListAsLongs[l27] != l19) {
  12483. continue;
  12484. }
  12485. flag4 = true;
  12486.  
  12487. }
  12488. if (!flag4 && anInt1251 == 0) {
  12489. String s8 = s.substring(s.indexOf(":") + 1, s.length() - 9);
  12490. pushMessage(s8, 8, s5);
  12491. }
  12492. } else {
  12493. pushMessage(s, 0, "");
  12494. }
  12495. pktType = -1;
  12496. return true;
  12497.  
  12498. case 1:
  12499. for (int k4 = 0; k4 < playerArray.length; k4++) {
  12500. if (playerArray[k4] != null) {
  12501. playerArray[k4].anim = -1;
  12502. }
  12503. }
  12504. for (int j12 = 0; j12 < npcArray.length; j12++) {
  12505. if (npcArray[j12] != null) {
  12506. npcArray[j12].anim = -1;
  12507. }
  12508. }
  12509. pktType = -1;
  12510. return true;
  12511.  
  12512. case 50:
  12513. long l4 = getInputBuffer().getLong();
  12514. int i18 = getInputBuffer().getUnsignedByte();
  12515. String s7 = TextClass.fixName(TextClass.nameForLong(l4));
  12516. for (int k24 = 0; k24 < friendCount; k24++) {
  12517. if (l4 != friendsListAsLongs[k24]) {
  12518. continue;
  12519. }
  12520. if (friendsNodeIDs[k24] != i18) {
  12521. friendsNodeIDs[k24] = i18;
  12522. /*if (i18 >= 2) {
  12523. pushMessage(s7 + " has logged in.", 5, "");
  12524. }
  12525. if (i18 <= 1) {
  12526. pushMessage(s7 + " has logged out.", 5, "");
  12527. }*/
  12528. }
  12529. s7 = null;
  12530.  
  12531. }
  12532. if (s7 != null && friendCount < 200) {
  12533. friendsListAsLongs[friendCount] = l4;
  12534. friendsList[friendCount] = s7;
  12535. friendsNodeIDs[friendCount] = i18;
  12536. friendCount++;
  12537. }
  12538. for (boolean flag6 = false; !flag6;) {
  12539. flag6 = true;
  12540. for (int k29 = 0; k29 < friendCount - 1; k29++) {
  12541. if (friendsNodeIDs[k29] != nodeID && friendsNodeIDs[k29 + 1] == nodeID || friendsNodeIDs[k29] == 0 && friendsNodeIDs[k29 + 1] != 0) {
  12542. int j31 = friendsNodeIDs[k29];
  12543. friendsNodeIDs[k29] = friendsNodeIDs[k29 + 1];
  12544. friendsNodeIDs[k29 + 1] = j31;
  12545. String s10 = friendsList[k29];
  12546. friendsList[k29] = friendsList[k29 + 1];
  12547. friendsList[k29 + 1] = s10;
  12548. long l32 = friendsListAsLongs[k29];
  12549. friendsListAsLongs[k29] = friendsListAsLongs[k29 + 1];
  12550. friendsListAsLongs[k29 + 1] = l32;
  12551. flag6 = false;
  12552. }
  12553. }
  12554. }
  12555. pktType = -1;
  12556. return true;
  12557.  
  12558. case 110:
  12559. energy = getInputBuffer().getUnsignedByte();
  12560. pktType = -1;
  12561. return true;
  12562.  
  12563. case 113:
  12564. running = getInputBuffer().getUnsignedByte() > 0;
  12565. variousSettings[173] = running ? 1 : 0;
  12566. mapArea.run.setOrbState(running);
  12567. pktType = -1;
  12568. return true;
  12569.  
  12570. case 254:
  12571. anInt855 = getInputBuffer().getUnsignedByte();
  12572. if (anInt855 == 1) {
  12573. anInt1222 = getInputBuffer().getUnsignedShort();
  12574. }
  12575. if (anInt855 >= 2 && anInt855 <= 6) {
  12576. if (anInt855 == 2) {
  12577. anInt937 = 64;
  12578. anInt938 = 64;
  12579. }
  12580. if (anInt855 == 3) {
  12581. anInt937 = 0;
  12582. anInt938 = 64;
  12583. }
  12584. if (anInt855 == 4) {
  12585. anInt937 = 128;
  12586. anInt938 = 64;
  12587. }
  12588. if (anInt855 == 5) {
  12589. anInt937 = 64;
  12590. anInt938 = 0;
  12591. }
  12592. if (anInt855 == 6) {
  12593. anInt937 = 64;
  12594. anInt938 = 128;
  12595. }
  12596. anInt855 = 5;
  12597. anInt934 = getInputBuffer().getUnsignedShort();
  12598. anInt935 = getInputBuffer().getUnsignedShort();
  12599. anInt936 = getInputBuffer().getUnsignedByte();
  12600. }
  12601. if (anInt855 == 10) {
  12602. anInt933 = getInputBuffer().getUnsignedShort();
  12603. }
  12604. pktType = -1;
  12605. return true;
  12606.  
  12607. case 248:
  12608. int i5 = getInputBuffer().method435();
  12609. int k12 = getInputBuffer().getUnsignedShort();
  12610. if (backDialogID != -1) {
  12611. backDialogID = -1;
  12612. inputTaken = true;
  12613. }
  12614. if (inputDialogState != 0) {
  12615. inputDialogState = 0;
  12616. inputTaken = true;
  12617. }
  12618. openInterfaceID = i5;
  12619. invOverlayInterfaceID = k12;
  12620. tabAreaAltered = true;
  12621. aBoolean1149 = false;
  12622. pktType = -1;
  12623. return true;
  12624.  
  12625. case 79:
  12626. int j5 = getInputBuffer().getShortBigEndian();
  12627. int l12 = getInputBuffer().method435();
  12628. RSInterface class9_3 = RSInterface.interfaceCache[j5];
  12629. if (class9_3 != null && class9_3.type == 0) {
  12630. if (l12 < 0) {
  12631. l12 = 0;
  12632. }
  12633. if (l12 > class9_3.scrollMax - class9_3.height) {
  12634. l12 = class9_3.scrollMax - class9_3.height;
  12635. }
  12636. class9_3.scrollPosition = l12;
  12637. }
  12638. pktType = -1;
  12639. return true;
  12640.  
  12641. case 68:
  12642. for (int k5 = 0; k5 < variousSettings.length; k5++) {
  12643. if (variousSettings[k5] != settings[k5]) {
  12644. variousSettings[k5] = settings[k5];
  12645. updateConfig(k5);
  12646. }
  12647. }
  12648.  
  12649. pktType = -1;
  12650. return true;
  12651.  
  12652. case 196:
  12653. final long l5 = getInputBuffer().getLong();
  12654. getInputBuffer().getIntLittleEndian();
  12655. int playerRights = getInputBuffer().getUnsignedByte();
  12656. boolean flag5 = false;
  12657.  
  12658. if (playerRights <= 1) {
  12659. for (int l29 = 0; l29 < ignoreCount; l29++) {
  12660. if (ignoreListAsLongs[l29] != l5) {
  12661. continue;
  12662. }
  12663.  
  12664. flag5 = true;
  12665. }
  12666. }
  12667.  
  12668. if (!flag5 && anInt1251 == 0) {
  12669. try {
  12670. String message = TextInput.readChatboxText(pktSize - 13, getInputBuffer());
  12671. final String name = TextClass.fixName(TextClass.nameForLong(l5));
  12672.  
  12673. /* if (Configuration.NOTIFICATIONS_ENABLED) {
  12674. AlertifyBuilder bldr = new AlertifyBuilder();
  12675.  
  12676. if (playerRights == 4 || playerRights == 2 || playerRights == 3) {
  12677. bldr.type(AlertifyType.WARNING);
  12678. } else {
  12679. bldr.type(AlertifyType.SUCCESS);
  12680. }
  12681.  
  12682. Alertify.show(bldr.text(name + ": " + message).autoClose(5000L).callback(new AlertifyWindowClick() {
  12683. @Override
  12684. public void alertClicked(AlertifyWindow window) {
  12685. // Request window focus if the client is
  12686. // minimized
  12687. requestFocusInWindow();
  12688. instance.requestFocus();
  12689. mainFrame.toFront();
  12690. mainFrame.setState(Frame.NORMAL);
  12691. instance.setVisible(true);
  12692.  
  12693. // Upon click, open the reply box
  12694. inputTaken = true;
  12695. inputDialogState = 0;
  12696. messagePromptRaised = true;
  12697. promptInput = "";
  12698. friendsListAction = 3;
  12699. aLong953 = l5;
  12700. promptMessage = "Enter message to send to " + name;
  12701. }
  12702. }).build());
  12703. }*/
  12704. if (playerRights != 0) {
  12705. pushMessage(message, 7, getPrefix(playerRights) + name);
  12706. } else {
  12707. pushMessage(message, 3, name);
  12708. }
  12709. } catch (Exception exception1) {
  12710. exception1.printStackTrace();
  12711. Signlink.reportError("cde1");
  12712. }
  12713. }
  12714.  
  12715. pktType = -1;
  12716. return true;
  12717.  
  12718. case 85:
  12719. anInt1269 = getInputBuffer().method427();
  12720. anInt1268 = getInputBuffer().method427();
  12721. pktType = -1;
  12722. return true;
  12723.  
  12724. case 123:
  12725. printConsoleMessage(getInputBuffer().getString(), 1);
  12726. pktType = -1;
  12727. return true;
  12728.  
  12729. case 128:
  12730. currentTarget = null;
  12731. pktType = -1;
  12732. return true;
  12733.  
  12734. case 125:
  12735. int targetIndex = getInputBuffer().getShort();
  12736. int targetType = getInputBuffer().getByte();
  12737. if(targetType == 0) { /* DONT READ DAMAGE LIST FOR PLRS */
  12738. currentTarget = targetIndex < playerArray.length ? playerArray[targetIndex] : null;
  12739. pktType = -1;
  12740. return true;
  12741. } else {
  12742. currentTarget = targetIndex < npcArray.length ? npcArray[targetIndex] : null;
  12743. }
  12744. if(currentTarget == null) {
  12745. pktType = -1;
  12746. return true;
  12747. }
  12748. NPC npc = (NPC)currentTarget;
  12749. npc.damageDealers.clear();
  12750. boolean readDamageList = getInputBuffer().getByte() == 1;
  12751. if(readDamageList) {
  12752. int length = getInputBuffer().getByte();
  12753. for(int t = 0; t < length; t++) {
  12754. String player = getInputBuffer().getString();
  12755. int damage = getInputBuffer().getShort();
  12756. npc.damageDealers.add(new DamageDealer(player, damage));
  12757. }
  12758. }
  12759. pktType = -1;
  12760. return true;
  12761.  
  12762. case 24:
  12763. anInt1054 = getInputBuffer().method428();
  12764.  
  12765. if (anInt1054 == tabID) {
  12766. if (anInt1054 == 3) {
  12767. tabID = 1;
  12768. } else {
  12769. tabID = 3;
  12770. }
  12771. }
  12772.  
  12773. pktType = -1;
  12774. return true;
  12775.  
  12776. case 246:
  12777. int i6 = getInputBuffer().getShortBigEndian();
  12778. int i13 = getInputBuffer().getUnsignedShort();
  12779. int k18 = getInputBuffer().getUnsignedShort();
  12780.  
  12781. if (k18 == 65535) {
  12782. RSInterface.interfaceCache[i6].mediaType = 0;
  12783. pktType = -1;
  12784. return true;
  12785. } else {
  12786. ItemDefinition itemDef = ItemDefinition.get(k18);
  12787. RSInterface.interfaceCache[i6].mediaType = 4;
  12788. RSInterface.interfaceCache[i6].mediaID = k18;
  12789. RSInterface.interfaceCache[i6].modelRotation1 = itemDef.modelRotation1;
  12790. RSInterface.interfaceCache[i6].modelRotation2 = itemDef.modelRotation2;
  12791. RSInterface.interfaceCache[i6].modelZoom = itemDef.modelZoom * 100 / i13;
  12792. pktType = -1;
  12793. return true;
  12794. }
  12795.  
  12796. case 171:
  12797. boolean flag1 = getInputBuffer().getUnsignedByte() == 1;
  12798. int j13 = getInputBuffer().getUnsignedShort();
  12799. RSInterface.interfaceCache[j13].interfaceShown = flag1;
  12800. pktType = -1;
  12801. return true;
  12802.  
  12803. case 142:
  12804. int j6 = getInputBuffer().getShortBigEndian();
  12805. resetInterfaceAnimation(j6);
  12806.  
  12807. if (backDialogID != -1) {
  12808. backDialogID = -1;
  12809. inputTaken = true;
  12810. }
  12811.  
  12812. if (inputDialogState != 0) {
  12813. inputDialogState = 0;
  12814. inputTaken = true;
  12815. }
  12816.  
  12817. invOverlayInterfaceID = j6;
  12818. tabAreaAltered = true;
  12819. openInterfaceID = -1;
  12820. aBoolean1149 = false;
  12821. pktType = -1;
  12822. return true;
  12823.  
  12824. case 45:
  12825. long totalxp = getInputBuffer().getLong();
  12826. PlayerHandler.totalXP = totalxp;
  12827. pktType = -1;
  12828. return true;
  12829.  
  12830. case 124:
  12831. int skillID = getInputBuffer().getUnsignedByte();
  12832. int gainedXP = getInputBuffer().getIntLittleEndian();
  12833. int totalEXP = getInputBuffer().getIntLittleEndian();
  12834. PlayerHandler.addXP(skillID, gainedXP);
  12835. PlayerHandler.totalXP = totalEXP;
  12836. pktType = -1;
  12837. return true;
  12838.  
  12839. case 126:
  12840. String text = getInputBuffer().getString();
  12841. int frame = getInputBuffer().getShort();
  12842. if (text.startsWith("http://") || text.startsWith("www.")) {
  12843. launchURL(text);
  12844. pktType = -1;
  12845. return true;
  12846. } else if(text.equals("[CLOSEMENU]") && frame == 0) {
  12847. menuOpen = false;
  12848. pktType = -1;
  12849. return true;
  12850. }
  12851. updateStrings(text, frame);
  12852. setInterfaceText(text, frame);
  12853. pktType = -1;
  12854. return true;
  12855.  
  12856. case 180:
  12857. int rankId = getInputBuffer().getUnsignedShort();
  12858. int frameId = getInputBuffer().getUnsignedShort();
  12859. int rankSpriteIDs[] = { 93, 102, 96, 97, 98, 99, 100, 101, 94,
  12860. -1, -1, 95 };
  12861. /**
  12862. * 94 = owner 95 = admin 96 = one arrow up 97 = 2x arrow up 98 =
  12863. * 3 arrow up 99 = orange star 100 = silver star 101 = golden
  12864. * star 102 = friend
  12865. */
  12866. RSInterface icons = RSInterface.interfaceCache[frameId];
  12867.  
  12868. if (icons != null) {
  12869. icons.sprite1 = icons.sprite2 = Client.cacheSprite[rankSpriteIDs[rankId]];
  12870. }
  12871.  
  12872. rankSpriteIDs = null;
  12873. icons = null;
  12874. pktType = -1;
  12875. return true;
  12876.  
  12877. case 181:
  12878.  
  12879. pktType = -1;
  12880. return true;
  12881.  
  12882. case 182:
  12883. pktType = -1;
  12884. return true;
  12885.  
  12886. case 206:
  12887. publicChatMode = getInputBuffer().getUnsignedByte();
  12888. privateChatMode = getInputBuffer().getUnsignedByte();
  12889. tradeMode = getInputBuffer().getUnsignedByte();
  12890. inputTaken = true;
  12891. pktType = -1;
  12892. return true;
  12893.  
  12894. case 86:
  12895. int l = getInputBuffer().getUnsignedByte();
  12896. if(plane != l && l >= 0 && l < 4) {
  12897. plane = l;
  12898. }
  12899. pktType = -1;
  12900. return true;
  12901.  
  12902. case 240:
  12903. weight = getInputBuffer().getSignedShort();
  12904. pktType = -1;
  12905. return true;
  12906.  
  12907. case 8:
  12908. int k6 = getInputBuffer().getShortBigEndianA();
  12909. int l13 = getInputBuffer().getUnsignedShort();
  12910. RSInterface.interfaceCache[k6].mediaType = 1;
  12911. RSInterface.interfaceCache[k6].mediaID = l13;
  12912. pktType = -1;
  12913. return true;
  12914.  
  12915. case 122:
  12916. int l6 = getInputBuffer().getShortBigEndianA();
  12917. int i14 = getInputBuffer().getShortBigEndianA();
  12918. int i19 = i14 >> 10 & 0x1f;
  12919. int i22 = i14 >> 5 & 0x1f;
  12920. int l24 = i14 & 0x1f;
  12921. RSInterface.interfaceCache[l6].textColor = (i19 << 19) + (i22 << 11) + (l24 << 3);
  12922. pktType = -1;
  12923. return true;
  12924.  
  12925. case 53:
  12926. //needDrawTabArea = true;
  12927. try {
  12928.  
  12929. int rsi_frame = getInputBuffer().getUnsignedShort();
  12930. RSInterface class9_1 = RSInterface.interfaceCache[rsi_frame];
  12931. int totalItems = getInputBuffer().getUnsignedShort();
  12932. if(class9_1 == null || class9_1.inv == null || class9_1.invStackSizes == null) {
  12933. pktType = -1;
  12934. return true;
  12935. }
  12936. int it = -1;
  12937. for (int idx = 0; idx < totalItems; idx++) {
  12938. int itemAmt = getInputBuffer().getUnsignedByte();
  12939. if (itemAmt == 255)
  12940. itemAmt = getInputBuffer().method440();
  12941. it = getInputBuffer().getShortBigEndianA();
  12942. class9_1.inv[idx] = it;
  12943. class9_1.invStackSizes[idx] = itemAmt;
  12944. }
  12945.  
  12946. for (int idx = totalItems; idx < class9_1.inv.length && idx < class9_1.invStackSizes.length; idx++) {
  12947. class9_1.inv[idx] = 0;
  12948. class9_1.invStackSizes[idx] = 0;
  12949. }
  12950. if(rsi_frame == 24680) {
  12951. getGrandExchange().itemSelected = it;
  12952. }
  12953. } catch(Exception e) {
  12954. e.printStackTrace();
  12955. }
  12956. pktType = -1;
  12957. return true;
  12958.  
  12959. case 230:
  12960. int j7 = getInputBuffer().method435();
  12961. int j14 = getInputBuffer().getUnsignedShort();
  12962. int k19 = getInputBuffer().getUnsignedShort();
  12963. int k22 = getInputBuffer().getShortBigEndianA();
  12964. RSInterface.interfaceCache[j14].modelRotation1 = k19;
  12965. RSInterface.interfaceCache[j14].modelRotation2 = k22;
  12966. RSInterface.interfaceCache[j14].modelZoom = j7;
  12967. pktType = -1;
  12968. return true;
  12969.  
  12970. case 221:
  12971. setAnInt900(getInputBuffer().getUnsignedByte());
  12972. pktType = -1;
  12973. return true;
  12974.  
  12975. case 112:
  12976. ironman = getInputBuffer().getUnsignedByte();
  12977. pktType = -1;
  12978. return true;
  12979.  
  12980. case 115:
  12981. showClanOptions = getInputBuffer().getUnsignedByte();
  12982. updateClanChatTab();
  12983. pktType = -1;
  12984. return true;
  12985.  
  12986. case 177:
  12987. cameraViewChanged = true;
  12988. moveCameraX = getInputBuffer().getUnsignedByte();
  12989. moveCameraY = getInputBuffer().getUnsignedByte();
  12990. moveCameraZ = getInputBuffer().getUnsignedShort();
  12991. moveCameraSpeed = getInputBuffer().getUnsignedByte();
  12992. moveCameraAngle = getInputBuffer().getUnsignedByte();
  12993.  
  12994. if (moveCameraAngle >= 100) {
  12995. int k7 = moveCameraX * 128 + 64;
  12996. int k14 = moveCameraY * 128 + 64;
  12997. int i20 = method42(plane, k14, k7) - moveCameraZ;
  12998. int l22 = k7 - xCameraPos;
  12999. int k25 = i20 - zCameraPos;
  13000. int j28 = k14 - yCameraPos;
  13001. int i30 = (int) Math.sqrt(l22 * l22 + j28 * j28);
  13002. yCameraCurve = (int) (Math.atan2(k25, i30) * 325.94900000000001D) & 0x7ff;
  13003. xCameraCurve = (int) (Math.atan2(l22, j28) * -325.94900000000001D) & 0x7ff;
  13004.  
  13005. if (yCameraCurve < 128) {
  13006. yCameraCurve = 128;
  13007. }
  13008.  
  13009. if (yCameraCurve > 383) {
  13010. yCameraCurve = 383;
  13011. }
  13012. }
  13013.  
  13014. pktType = -1;
  13015. return true;
  13016.  
  13017. case 38:
  13018. int auto = getInputBuffer().getUnsignedShort();
  13019. if(auto == -1) {
  13020. autoCast = false;
  13021. autocastId = 0;
  13022. } else {
  13023. autoCast = true;
  13024. autocastId = auto;
  13025. }
  13026. pktType = -1;
  13027. return true;
  13028.  
  13029. case 127:
  13030. myRights = getInputBuffer().getUnsignedByte();
  13031. pktType = -1;
  13032. return true;
  13033.  
  13034. case 249:
  13035. anInt1046 = getInputBuffer().method426();
  13036. playerId = getInputBuffer().getUnsignedShort();
  13037. pktType = -1;
  13038. return true;
  13039.  
  13040. case 65:
  13041. updateNPCs(getInputBuffer(), pktSize);
  13042. pktType = -1;
  13043. return true;
  13044.  
  13045. case 27:
  13046. inputTitle = new String(getInputBuffer().getString());
  13047. messagePromptRaised = false;
  13048. inputDialogState = 1;
  13049. amountOrNameInput = "";
  13050. inputTaken = true;
  13051. pktType = -1;
  13052. return true;
  13053.  
  13054. case 187:
  13055. inputTitle = new String(getInputBuffer().getString());
  13056. messagePromptRaised = false;
  13057. inputDialogState = 2;
  13058. amountOrNameInput = "";
  13059. inputTaken = true;
  13060. pktType = -1;
  13061. return true;
  13062.  
  13063. case 97:
  13064. int l7 = getInputBuffer().getUnsignedShort();
  13065. resetInterfaceAnimation(l7);
  13066.  
  13067. if (invOverlayInterfaceID != -1) {
  13068. invOverlayInterfaceID = -1;
  13069. tabAreaAltered = true;
  13070. }
  13071.  
  13072. if (backDialogID != -1) {
  13073. backDialogID = -1;
  13074. inputTaken = true;
  13075. }
  13076.  
  13077. if (inputDialogState != 0) {
  13078. inputDialogState = 0;
  13079. inputTaken = true;
  13080. }
  13081.  
  13082. openInterfaceID = l7;
  13083. aBoolean1149 = false;
  13084. pktType = -1;
  13085. return true;
  13086.  
  13087. case 218:
  13088. int i8 = getInputBuffer().method438();
  13089. dialogID = i8;
  13090. inputTaken = true;
  13091. pktType = -1;
  13092. return true;
  13093.  
  13094. case 87:
  13095. int conigId = getInputBuffer().getShortBigEndian();
  13096. int configValue = getInputBuffer().method439();
  13097. settings[conigId] = configValue;
  13098.  
  13099. switch (conigId) {
  13100. case 2000:
  13101. updateBankInterface();
  13102. break;
  13103. }
  13104.  
  13105. if (conigId < 2000) {
  13106. if (variousSettings[conigId] != configValue) {
  13107. variousSettings[conigId] = configValue;
  13108. updateConfig(conigId);
  13109.  
  13110. if (dialogID != -1) {
  13111. inputTaken = true;
  13112. }
  13113. }
  13114. }
  13115.  
  13116. pktType = -1;
  13117. return true;
  13118.  
  13119. case 89:
  13120. loadRegion();
  13121. pktType = -1;
  13122. return true;
  13123.  
  13124. case 36:
  13125. int settingId = getInputBuffer().getShortBigEndian();
  13126. byte settingValue = getInputBuffer().getSignedByte();
  13127. if (settingId == -55) {
  13128. for (int i : RSInterface.interfaceCache[3213].children) {
  13129. RSInterface.interfaceCache[i].invSpritePadY = settingValue >= 1 ? 0 : 6;
  13130. }
  13131. if (settingValue >= 1) {
  13132. RSInterface.interfaceCache[16546].message = settingValue == 1 ? "Add to bag" : "View bag contents";
  13133. lootingBag = true;
  13134. } else {
  13135. lootingBag = false;
  13136. }
  13137. pktType = -1;
  13138. return true;
  13139. }
  13140. settings[settingId] = settingValue;
  13141. switch (settingId) {
  13142. case 2000:
  13143. updateBankInterface();
  13144. break;
  13145. case 19:
  13146. LOOP_MUSIC = settingValue == 1 ? true : false;
  13147. break;
  13148. case 293:
  13149. int sprite = settingValue == 0 ? 607 : settingValue == 1 ? 606 : settingValue == 2 ? 608 : settingValue == 3 ? 609 : 610;
  13150. RSInterface.interfaceCache[12348].sprite1 = Client.cacheSprite[sprite];
  13151. break;
  13152. }
  13153. if (settingId < 2000) {
  13154. if (variousSettings[settingId] != settingValue) {
  13155. variousSettings[settingId] = settingValue;
  13156. updateConfig(settingId);
  13157. if (dialogID != -1) {
  13158. inputTaken = true;
  13159. }
  13160. }
  13161. }
  13162. pktType = -1;
  13163. return true;
  13164.  
  13165. case 61:
  13166. drawMultiwayIcon = getInputBuffer().getUnsignedByte();
  13167. pktType = -1;
  13168. return true;
  13169.  
  13170. case 103:
  13171. doingDungeoneering = getInputBuffer().getUnsignedByte() == 1;
  13172. pktType = -1;
  13173. return true;
  13174.  
  13175. case 200:
  13176. int l8 = getInputBuffer().getUnsignedShort();
  13177. int animId = getInputBuffer().getSignedShort();
  13178. RSInterface class9_4 = RSInterface.interfaceCache[l8];
  13179. class9_4.disabledAnimationId = animId;
  13180. class9_4.modelZoom = 2000;
  13181.  
  13182. if (animId == -1) {
  13183. class9_4.anInt246 = 0;
  13184. class9_4.anInt208 = 0;
  13185. }
  13186.  
  13187. pktType = -1;
  13188. return true;
  13189.  
  13190. case 219:
  13191. if (invOverlayInterfaceID != -1) {
  13192. invOverlayInterfaceID = -1;
  13193. tabAreaAltered = true;
  13194. }
  13195.  
  13196. if (backDialogID != -1) {
  13197. backDialogID = -1;
  13198. inputTaken = true;
  13199. }
  13200.  
  13201. if (inputDialogState != 0) {
  13202. inputDialogState = 0;
  13203. inputTaken = true;
  13204. }
  13205.  
  13206. openInterfaceID = -1;
  13207. aBoolean1149 = false;
  13208. pktType = -1;
  13209. return true;
  13210.  
  13211. case 34:
  13212. int rsIntId = getInputBuffer().getUnsignedShort();
  13213. RSInterface rsInt = RSInterface.interfaceCache[rsIntId];
  13214.  
  13215. while (getInputBuffer().position < pktSize) {
  13216. int itemSlot = getInputBuffer().getSmart();
  13217. int itemInvId = getInputBuffer().getUnsignedShort();
  13218. int itemAmount = getInputBuffer().getUnsignedByte();
  13219.  
  13220. if (itemAmount == 255) {
  13221. itemAmount = getInputBuffer().getIntLittleEndian();
  13222. }
  13223.  
  13224. if (itemSlot >= 0 && itemSlot < rsInt.inv.length) {
  13225. rsInt.inv[itemSlot] = itemInvId;
  13226. rsInt.invStackSizes[itemSlot] = itemAmount;
  13227. }
  13228. }
  13229.  
  13230. pktType = -1;
  13231. return true;
  13232.  
  13233. case 4:
  13234. case 44:
  13235. case 84:
  13236. case 101:
  13237. case 105:
  13238. case 117:
  13239. case 147:
  13240. case 151:
  13241. case 156:
  13242. case 160:
  13243. case 215:
  13244. parseEntityPacket(getInputBuffer(), pktType);
  13245. pktType = -1;
  13246. return true;
  13247.  
  13248. case 106:
  13249. tabID = getInputBuffer().method427();
  13250. tabAreaAltered = true;
  13251. pktType = -1;
  13252. return true;
  13253.  
  13254. case 164:
  13255. int j9 = getInputBuffer().getShortBigEndian();
  13256. if (chatArea.componentHidden()) {
  13257. chatArea.setHideComponent(false);
  13258. }
  13259. resetInterfaceAnimation(j9);
  13260.  
  13261. if (invOverlayInterfaceID != -1) {
  13262. invOverlayInterfaceID = -1;
  13263. tabAreaAltered = true;
  13264. }
  13265.  
  13266. backDialogID = j9;
  13267. inputTaken = true;
  13268. openInterfaceID = -1;
  13269. aBoolean1149 = false;
  13270. pktType = -1;
  13271. return true;
  13272.  
  13273. }
  13274.  
  13275. Signlink.reportError("T1 - " + pktType + "," + pktSize + " - " + anInt842 + "," + anInt843);
  13276. // resetLogout();
  13277. } catch (IOException _ex) {
  13278. dropClient();
  13279. } catch (Exception exception) {
  13280. String s2 = "T2 - " + pktType + "," + anInt842 + "," + anInt843 + " - " + pktSize + "," + (baseX + myPlayer.smallX[0]) + "," + (baseY + myPlayer.smallY[0]) + " - ";
  13281.  
  13282. for (int j15 = 0; j15 < pktSize && j15 < 50; j15++) {
  13283. s2 = s2 + getInputBuffer().buffer[j15] + ",";
  13284. }
  13285.  
  13286. Signlink.reportError(s2);
  13287. }
  13288.  
  13289. pktType = -1;
  13290. return true;
  13291. }
  13292.  
  13293. private int showClanOptions;
  13294.  
  13295. private void updateClanChatTab() {
  13296. if(showClanOptions > 0) {
  13297. RSInterface.getCustomInterfaces().rebuildClanChatList(true, myUsername, showClanOptions == 2);
  13298. } else {
  13299. RSInterface.getCustomInterfaces().rebuildClanChatList(false, "", false);
  13300. }
  13301. }
  13302.  
  13303. public static int getChatColor(String hex) {
  13304. int convertHexCode = Integer.parseInt(hex, 16);
  13305. return convertHexCode;
  13306. }
  13307.  
  13308. protected static void processLoadingError(String... msgs) {
  13309. Runtime.getRuntime().addShutdownHook(new Thread() {
  13310. @Override
  13311. public void run() {
  13312. try {
  13313. Signlink.release();
  13314. FileUtilities.delete(Signlink.getCacheDirectory().toString());
  13315. } catch (IOException e) {
  13316. e.printStackTrace();
  13317. showErrorScreen(instance, "A fatal error occured while attempting to fix the previous loading error", "Please screenshot this message and report it to the developers immediately", e.getMessage());
  13318. }
  13319. }
  13320. });
  13321.  
  13322. showErrorScreen(instance, msgs);
  13323.  
  13324. try {
  13325. Thread.sleep(10_000L);
  13326. } catch (InterruptedException e) {
  13327. e.printStackTrace();
  13328. }
  13329.  
  13330. System.exit(0);
  13331. }
  13332.  
  13333. @Override
  13334. public void processDrawing() {
  13335. if (loadingError) {
  13336. processLoadingError("An internal error occured whilst loading the "+Configuration.CLIENT_NAME+" client", "The client's common error quick fix system is attempting to repair the cause", "The client will automatically close in 10 seconds...");
  13337. return;
  13338. }
  13339. if(isLoading)
  13340. return;
  13341. if (!loggedIn) {
  13342. drawLoginScreen(false);
  13343. } else {
  13344. drawGameScreen();
  13345. }
  13346.  
  13347. anInt1213 = 0;
  13348. }
  13349.  
  13350. @Override
  13351. public void processGameLoop() {
  13352. if (loadingError) {
  13353. return;
  13354. }
  13355.  
  13356. loopCycle++;
  13357.  
  13358. if (!loggedIn) {
  13359. processLoginScreenInput();
  13360. } else {
  13361. mainGameProcessor();
  13362. }
  13363.  
  13364. processOnDemandQueue();
  13365. checkSize();
  13366. method49();
  13367. handleSounds();
  13368. }
  13369.  
  13370. private void processLoginScreenInput() {
  13371. if(super.clickMode3 == 1) {
  13372. if(rememberMeHover) {
  13373. Configuration.SAVE_ACCOUNTS = !Configuration.SAVE_ACCOUNTS;
  13374. savePlayerData();
  13375. return;
  13376. } else if(textArea1Hover) {
  13377. loginScreenCursorPos = 0;
  13378. return;
  13379. } else if(textArea2Hover) {
  13380. loginScreenCursorPos = 1;
  13381. return;
  13382. } else if(loginHover) {
  13383. login(password, false, myUsername, this);
  13384. return;
  13385. } else if(backButtonHover) {
  13386. loginMessage1 = loginMessage2 = "";
  13387. return;
  13388. }
  13389. for(int i = 0; i < accountHovers.length; i++) {
  13390. if(accountHovers[i] || accountDeletion[i]) {
  13391. Account account = accountManager.getAccounts()[i];
  13392. if(account == null) {
  13393. continue;
  13394. }
  13395. if(accountDeletion[i]) {
  13396. accountManager.removeAccount(account, true);
  13397. break;
  13398. } else if(accountHovers[i]) {
  13399. myUsername = account.getUsername();
  13400. password = account.getPassword();
  13401. login(password, false, myUsername, this);
  13402. break;
  13403. }
  13404. }
  13405. }
  13406. }
  13407.  
  13408. if (getLoginScreenState() == 0) {
  13409.  
  13410.  
  13411. do {
  13412. int keyChar = readChar(-796);
  13413.  
  13414. if (keyChar == -1) {
  13415. return;
  13416. }
  13417.  
  13418. if (keyChar == 96) {
  13419. return;
  13420. }
  13421.  
  13422. if(loggedIn || loggingIn) {
  13423. return;
  13424. }
  13425.  
  13426. if(!loginMessage1.isEmpty() || !loginMessage2.isEmpty()) {
  13427. if(keyChar == 32 || keyChar == 10 || keyChar == 8) {
  13428. loginMessage1 = loginMessage2 = "";
  13429. loggingIn = false;
  13430. }
  13431. return;
  13432. }
  13433.  
  13434. if (consoleOpen) {
  13435. if (keyChar == 8 && consoleInput.length() > 0) {
  13436. consoleInput = consoleInput.substring(0, consoleInput.length() - 1);
  13437. }
  13438. if (keyChar >= 32 && keyChar <= 122 && consoleInput.length() < 80) {
  13439. consoleInput += (char) keyChar;
  13440. }
  13441.  
  13442. if ((keyChar == 13 || keyChar == 10) && consoleInput.length() > 0) {
  13443. printConsoleMessage(consoleInput, 0);
  13444. sendCommandPacket(consoleInput);
  13445. consoleInput = "";
  13446. inputTaken = true;
  13447. }
  13448. return;
  13449. }
  13450.  
  13451. boolean flag1 = false;
  13452.  
  13453. for (int i2 = 0; i2 < validUserPassChars.length(); i2++) {
  13454. if (keyChar != validUserPassChars.charAt(i2)) {
  13455. continue;
  13456. }
  13457.  
  13458. flag1 = true;
  13459. break;
  13460. }
  13461.  
  13462. if (getLoginScreenCursorPos() == 0) {
  13463. if (keyChar == 8 && myUsername.length() > 0) {
  13464. myUsername = myUsername.substring(0, myUsername.length() - 1);
  13465. }
  13466.  
  13467. if (keyChar == 9 || keyChar == 10 || keyChar == 13) {
  13468. setLoginScreenCursorPos(1);
  13469. }
  13470.  
  13471. if (myUsername.length() >= 24) {
  13472. letterArray.add((char) keyChar);
  13473. }
  13474.  
  13475. if (flag1) {
  13476. myUsername += (char) keyChar;
  13477. myUsername = optimizeText(myUsername);
  13478. }
  13479. if (myUsername.length() > 12) {
  13480. myUsername = myUsername.substring(0, 12);
  13481. }
  13482. } else if (getLoginScreenCursorPos() == 1) {
  13483. if (keyChar == 8 && getPassword().length() > 0) {
  13484. setPassword(getPassword().substring(0, getPassword().length() - 1));
  13485. }
  13486.  
  13487. if (keyChar == 9 || keyChar == 10 || keyChar == 13) {
  13488. login(getPassword(), false, myUsername, this);
  13489. if(loggedIn || loggingIn)
  13490. return;
  13491. }
  13492.  
  13493. if (flag1) {
  13494. setPassword(getPassword() + (char) keyChar);
  13495. }
  13496.  
  13497. if (getPassword().length() > 15) {
  13498. setPassword(getPassword().substring(0, 15));
  13499. }
  13500. }
  13501. } while (true);
  13502.  
  13503. }
  13504. }
  13505.  
  13506. private boolean loggingIn = false;
  13507.  
  13508. /**
  13509. * Handles the login for the player
  13510. *
  13511. * @param username The username of the player
  13512. * @param password The password if the player
  13513. * @param reconnecting The player is reconnecting
  13514. */
  13515. private void login(String password, boolean reconnecting, String username, Client client) {
  13516. if(loggingIn) {
  13517. return;
  13518. }
  13519. username = TextClass.fixName(username);
  13520. username = optimizeText(username);
  13521. if(username.toLowerCase().contains("admin") || username.toLowerCase().contains("mod") || username.toLowerCase().contains("dev") || username.toLowerCase().contains("owner")) {
  13522. loginMessage1 = "This username cannot be used.";
  13523. loginMessage2 = "Please pick another one.";
  13524. return;
  13525. }
  13526. if(username.startsWith(" ") || username.startsWith("_")) {
  13527. loginMessage1 = "Your username cannot start with a space.";
  13528. return;
  13529. }
  13530. if(username.endsWith(" ") || username.endsWith("_")) {
  13531. loginMessage1 = "Your username cannot end with a space.";
  13532. return;
  13533. }
  13534. if(username.length() < 1 && password.length() < 1) {
  13535. loginMessage1 = "Please enter a valid username and password.";
  13536. return;
  13537. } else if(password.length() < 3) {
  13538. loginMessage1 = "Your password is too short.";
  13539. return;
  13540. } else if(username.length() < 1) {
  13541. loginMessage1 = "Your username is too short.";
  13542. return;
  13543. } else if(username.length() > 12) {
  13544. loginMessage1 = "Your username is too long.";
  13545. return;
  13546. } else if(password.length() > 20) {
  13547. loginMessage1 = "Your password is too long.";
  13548. return;
  13549. }
  13550.  
  13551. if (client.getLoginState() == 0) {
  13552. client.setLoginFailures(0);
  13553. }
  13554.  
  13555. try {
  13556. loggingIn = true;
  13557.  
  13558. loginMessage1 = "Attempting to login";
  13559. drawLoginScreen(false);
  13560.  
  13561. Thread t = new Thread(new Runnable() {
  13562. @Override
  13563. public void run() {
  13564. while (loggingIn && !loggedIn && loginMessage1.contains("Attempting to login") && loginMessage1.length() <= 29) {
  13565. try {
  13566. loginMessage1 += ".";
  13567. drawLoginScreen(false);
  13568. Thread.sleep(250);
  13569. } catch(Exception e) {}
  13570. }
  13571. }
  13572. }, "Login");
  13573. t.start();
  13574.  
  13575.  
  13576. initiateConnection(client);
  13577.  
  13578. int responseCode = receiveResponse(client);
  13579. handleResponse(client, responseCode, username, password, reconnecting);
  13580.  
  13581. } catch (IOException _ex) {
  13582. client.setLoginMessage1("Error connecting to server.");
  13583. client.setLoginMessage2("");
  13584. loggedIn = loggingIn = false;
  13585. }
  13586. }
  13587.  
  13588. public int receiveResponse(Client client) throws IOException {
  13589. int responseCode = client.getConnection().read();
  13590. return responseCode;
  13591. }
  13592.  
  13593. public void initiateConnection(Client client) throws IOException {
  13594. client.setConnection(new Connection(client, client.createGameServerSocket(Configuration.SERVER_PORT)));
  13595. Client.getOut().position = 0;
  13596. Client.getOut().putByte(14);
  13597. client.getConnection().queueBytes(1, Client.getOut().buffer);
  13598. }
  13599.  
  13600. public int[] handleEncryption(String password, Client client, String username) {
  13601. client.setServerSeed(client.getInputBuffer().getLong());
  13602. int[] seed = new int[4];
  13603. seed[0] = (int) (Math.random() * 99999999D);
  13604. seed[1] = (int) (Math.random() * 99999999D);
  13605. seed[2] = (int) (client.getServerSeed() >> 32);
  13606. seed[3] = (int) client.getServerSeed();
  13607. Client.getOut().position = 0;
  13608. Client.getOut().putByte(10);
  13609. Client.getOut().putInt(seed[0]);
  13610. Client.getOut().putInt(seed[1]);
  13611. Client.getOut().putInt(seed[2]);
  13612. Client.getOut().putInt(seed[3]);
  13613. Client.getOut().putInt(23); //Client IDENTIFIER
  13614. Client.getOut().putString(username);
  13615. Client.getOut().putString(password);
  13616. Client.getOut().encryptRSAContent();
  13617. return seed;
  13618. }
  13619.  
  13620. private void writeData(boolean reconnecting, Client client) {
  13621. client.getLoginBuffer().position = 0;
  13622. client.getLoginBuffer().putByte(reconnecting ? 18 : 16); //login type
  13623. client.getLoginBuffer().putByte(Client.getOut().position + 1 + 1 + 2);
  13624. client.getLoginBuffer().putByte(255);
  13625. client.getLoginBuffer().putShort(Configuration.CLIENT_VERSION);
  13626. client.getLoginBuffer().putByte(Client.isLowDetail() ? 1 : 0);
  13627. client.getLoginBuffer().putBytes(Client.getOut().buffer, Client.getOut().position, 0);
  13628. }
  13629.  
  13630. /**
  13631. * Handles the response from the client
  13632. *
  13633. * @param response The response code from the client
  13634. * @param username The username of the player
  13635. * @param password The password of the player
  13636. * @param reconnecting The player is reconnecting
  13637. * @throws IOException
  13638. */
  13639. public boolean handleResponse(Client client, int response, String username, String password, boolean reconnecting) throws IOException {
  13640. int initialResponseCode = response;
  13641.  
  13642. if (response == 0) {
  13643. client.getConnection().flushInputStream(client.getInputBuffer().buffer, 8);
  13644. client.getInputBuffer().position = 0;
  13645. int[] seed = handleEncryption(password, client, username);
  13646. writeData(reconnecting, client);
  13647. Client.getOut().cipher = new ISAACCipher(seed);
  13648.  
  13649. for (int i = 0; i < 4; i++) {
  13650. seed[i] += 50;
  13651. }
  13652.  
  13653. client.setConnectionCipher(new ISAACCipher(seed));
  13654. client.getConnection().queueBytes(client.getLoginBuffer().position, client.getLoginBuffer().buffer);
  13655. response = client.getConnection().read();
  13656. }
  13657.  
  13658. if (response == 1) {
  13659. loggingIn = false;
  13660. try {
  13661. Thread.sleep(2000L);
  13662. } catch (Exception _ex) {
  13663. }
  13664.  
  13665. login(password, reconnecting, username, client);
  13666. return false;
  13667. }
  13668.  
  13669. System.out.println(response);
  13670.  
  13671. if (response == 2) {
  13672. finishLogin(client);
  13673. PlayerHandler.load(client);
  13674. return false;
  13675. }
  13676.  
  13677. if (!handleRejection(response, username, reconnecting, client, password)) {
  13678. loggingIn = false;
  13679. return false;
  13680. }
  13681.  
  13682. if (response == -1) {
  13683. loggingIn = false;
  13684. if (initialResponseCode == 0 && client.getLoginState() != 0) {
  13685. if (client.getLoginFailures() < 2) {
  13686. try {
  13687. Thread.sleep(2000L);
  13688. } catch (Exception _ex) {
  13689. }
  13690.  
  13691. client.setLoginFailures(client.getLoginFailures() + 1);
  13692. login(password, reconnecting, username, client);
  13693. return false;
  13694. } else {
  13695. client.setLoginMessage1("Invalid client UID specified.");
  13696. client.setLoginMessage2("Download the latest client.");
  13697. return false;
  13698. }
  13699. } else {
  13700. client.setLoginMessage1("No response from server");
  13701. client.setLoginMessage2("Please try using a different world.");
  13702. return false;
  13703. }
  13704. } else {
  13705. client.setLoginMessage1("Unexpected server response");
  13706. client.setLoginMessage2("Please try using a different world.");
  13707. return false;
  13708. }
  13709. }
  13710.  
  13711. public boolean handleRejection(int loginCode, String username, boolean reconnecting, Client client, String password) throws IOException {
  13712. if (loginCode == 3) {
  13713. loginMessage1 = "Invalid username or password.";
  13714. return false;
  13715. }
  13716. if (loginCode == 4) {
  13717. loginMessage1 = "This account has been banned!";
  13718. loginMessage2 = "Appeal on the forum.";
  13719. return false;
  13720. }
  13721. if (loginCode == 5) {
  13722. loginMessage1 = "This account is already logged in.";
  13723. loginMessage2 = "Please try again in 60 seconds..";
  13724. return false;
  13725. }
  13726. if (loginCode == 6) {
  13727. loginMessage1 = ""+Configuration.CLIENT_NAME+" is currently being updated.";
  13728. loginMessage2 = "Please try again in 60 seconds..";
  13729. return false;
  13730. }
  13731. if (loginCode == 7) {
  13732. loginMessage1 = ""+Configuration.CLIENT_NAME+" is currently busy.";
  13733. loginMessage2 = "Please try again.";
  13734. return false;
  13735. }
  13736. if (loginCode == 8) {
  13737. loginMessage1 = ""+Configuration.CLIENT_NAME+"'s login server is down.";
  13738. loginMessage2 = "Please try again in 60 seconds..";
  13739. return false;
  13740. }
  13741. if (loginCode == 9) {
  13742. loginMessage1 = "Login limit exceeded. Too many connections";
  13743. loginMessage2 = "from your address.";
  13744. return false;
  13745. }
  13746. if (loginCode == 10) {
  13747. loginMessage1 = "Unable to connect!";
  13748. loginMessage2 = "Server responded: bad session id!";
  13749. return false;
  13750. }
  13751. if (loginCode == 11) {
  13752. loginMessage1 = "Unable to connect!";
  13753. loginMessage2 = "Server responded: rejected session!";
  13754. return false;
  13755. }
  13756. if (loginCode == 12) {
  13757. loginMessage1 = "You need to be a member to login to this world.";
  13758. return false;
  13759. }
  13760. if (loginCode == 13) {
  13761. loginMessage1 = "Login could not be completed. Try again!";
  13762. return false;
  13763. }
  13764. if (loginCode == 14) {
  13765. loginMessage1 = ""+Configuration.CLIENT_NAME+" is currently being updated.";
  13766. loginMessage2 = "Please try again in 60 seconds..";
  13767. return false;
  13768. }
  13769. if (loginCode == 23) {
  13770. loginMessage1 = ""+Configuration.CLIENT_NAME+" is currently being launched.";
  13771. loginMessage2 = "Please try again in 60 seconds..";
  13772. return false;
  13773. }
  13774. if (loginCode == 27) {
  13775. loginMessage1 = "Your IP-Adress has been banned.";
  13776. loginMessage2 = "Please appeal on the forums.";
  13777. return false;
  13778. }
  13779. if (loginCode == 28) {
  13780. loginMessage1 = "Your username contains invalid letters.";
  13781. return false;
  13782. }
  13783. if (loginCode == 29) {
  13784. loginMessage1 = "Old client usage detected.";
  13785. loginMessage2 = "Download the latest one!";
  13786. return false;
  13787. }
  13788. if (loginCode == 31) {
  13789. loginMessage1 = "Your username cannot start with a space.";
  13790. return false;
  13791. }
  13792. if(loginCode == 22) {
  13793. loginMessage1 = "This computer has been banned.";
  13794. loginMessage2 = "Appeal on the forum!";
  13795. return false;
  13796. }
  13797. if(loginCode == 30) {
  13798. loginMessage1 = ""+Configuration.CLIENT_NAME+" has been updated!";
  13799. loginMessage2 = isWebclient() ? "Refresh this page." : "Download the latest client.";
  13800. return false;
  13801. }
  13802. if (loginCode == 16) {
  13803. loginMessage1 = "Login attempts exceeded.";
  13804. loginMessage2 = "Please wait 1 minute and try again.";
  13805. return false;
  13806. }
  13807. if (loginCode == 17) {
  13808. loginMessage1 = "You are standing in a members-only area.";
  13809. loginMessage2 = "To play on this world move to a free area first.";
  13810. return false;
  13811. }
  13812. if (loginCode == 20) {
  13813. loginMessage1 = "Invalid loginserver requested";
  13814. loginMessage2 = "Please try using a different world.";
  13815. return false;
  13816. }
  13817. if (loginCode == 21) {
  13818. for (int loginCode1 = client.getConnection().read(); loginCode1 >= 0; loginCode1--) {
  13819. loginMessage1 = "You have only just left another world";
  13820. loginMessage2 = "Your profile will be transferred in: "
  13821. + loginCode1 + " seconds";
  13822. drawLoginScreen(false);
  13823. try {
  13824. Thread.sleep(1000L);
  13825. } catch (Exception _ex) {
  13826. }
  13827. }
  13828.  
  13829. login(username, reconnecting, password, this);
  13830. return false;
  13831. }
  13832. return true;
  13833. }
  13834.  
  13835. /**
  13836. * Finishes the successful login for the player
  13837. *
  13838. * @throws IOException
  13839. */
  13840. public void finishLogin(Client client) throws IOException {
  13841. client.myRights = client.getConnection().read();
  13842. Client.flagged = client.getConnection().read() == 1;
  13843. client.mouseDetection.coordsIndex = 0;
  13844. client.awtFocus = true;
  13845. client.aBoolean954 = true;
  13846. client.loggedIn = true;
  13847. Client.getOut().position = 0;
  13848. client.getInputBuffer().position = 0;
  13849. client.pktType = -1;
  13850. client.anInt841 = -1;
  13851. client.anInt842 = -1;
  13852. client.anInt843 = -1;
  13853. client.pktSize = 0;
  13854. client.anInt1009 = 0;
  13855. client.systemUpdateTimer = 0;
  13856. client.anInt1011 = 0;
  13857. client.anInt855 = 0;
  13858. client.menuActionRow = 0;
  13859. client.menuOpen = false;
  13860. client.idleTime = 0;
  13861. client.itemSelected = 0;
  13862. client.spellSelected = 0;
  13863. client.loadingStage = 0;
  13864. client.soundCount = 0;
  13865. client.setNorth();
  13866. client.setScriptManager(null);
  13867. client.anInt1021 = 0;
  13868. client.setLastKnownPlane(-1);
  13869. client.destX = 0;
  13870. client.destY = 0;
  13871. client.playerCount = 0;
  13872. client.npcCount = 0;
  13873. loadGoals(myUsername);
  13874. for (int i = 0; i < client.getMaxPlayers(); i++) {
  13875. client.playerArray[i] = null;
  13876. client.getaStreamArray895s()[i] = null;
  13877. }
  13878.  
  13879. for (int i = 0; i < 16384; i++) {
  13880. client.npcArray[i] = null;
  13881. }
  13882.  
  13883.  
  13884. Client.myPlayer = client.playerArray[client.getMyPlayerIndex()] = new Player();
  13885. client.getaClass19_1013().removeAll();
  13886. client.getaClass19_1056().removeAll();
  13887.  
  13888. for (int l2 = 0; l2 < 4; l2++) {
  13889. for (int i3 = 0; i3 < 104; i3++) {
  13890. for (int k3 = 0; k3 < 104; k3++) {
  13891. client.groundArray[l2][i3][k3] = null;
  13892. }
  13893. }
  13894. }
  13895.  
  13896. client.setaClass19_1179(new Deque());
  13897. client.setFullscreenInterfaceID(-1);
  13898. client.setAnInt900(0);
  13899. client.friendCount = 0;
  13900. client.dialogID = -1;
  13901. client.backDialogID = -1;
  13902. Client.openInterfaceID = -1;
  13903. client.invOverlayInterfaceID = -1;
  13904. client.setWalkableInterfaceId(-1);
  13905. client.aBoolean1149 = false;
  13906. Client.tabID = 3;
  13907. client.inputDialogState = 0;
  13908. client.menuOpen = false;
  13909. client.messagePromptRaised = false;
  13910. client.aString844 = null;
  13911. client.drawMultiwayIcon = 0;
  13912. client.anInt1054 = -1;
  13913. client.isMale = true;
  13914. client.method45();
  13915.  
  13916. for (int j3 = 0; j3 < 5; j3++) {
  13917. client.anIntArray990[j3] = 0;
  13918. }
  13919.  
  13920. for (int l3 = 0; l3 < 5; l3++) {
  13921. client.atPlayerActions[l3] = null;
  13922. client.atPlayerArray[l3] = false;
  13923. }
  13924.  
  13925. Client.setAnInt1175(0);
  13926. Client.setAnInt1134(0);
  13927. Client.setAnInt986(0);
  13928. Client.setAnInt1288(0);
  13929. Client.setAnInt924(0);
  13930. Client.setAnInt1188(0);
  13931. Client.setAnInt1155(0);
  13932. Client.setAnInt1226(0);
  13933. client.chatTypes = new int[500];
  13934. client.chatNames = new String[500];
  13935. client.chatMessages = new String[500];
  13936. client.resetImageProducers2();
  13937. client.updateGraphics(true);
  13938. if (GameFrame.getScreenMode() == ScreenMode.FIXED) {
  13939. client.updateGameArea();
  13940. }
  13941. updateSettingsInterface();
  13942. loginMessage1 = loginMessage2 = "";
  13943. loggingIn = false;
  13944. }
  13945.  
  13946. private void processMainScreenClick() {
  13947. if (anInt1021 != 0) {
  13948. return;
  13949. }
  13950.  
  13951. if (super.clickMode3 == 1) {
  13952. int clickX = super.saveClickX - (GameFrame.getScreenMode() == ScreenMode.FIXED ? 553 : mapArea.getOffSetX() + 14);
  13953. int clickY = super.saveClickY - (GameFrame.getScreenMode() == ScreenMode.FIXED ? 9 : 5);
  13954.  
  13955. if (inCircle(0, 0, clickX, clickY, 76)) {
  13956. clickX -= 73;
  13957. clickY -= 75;
  13958. int k = viewRotation + minimapRotation & 0x7ff;
  13959. int i1 = Rasterizer.SINE[k];
  13960. int j1 = Rasterizer.COSINE[k];
  13961. i1 = i1 * (minimapZoom + 256) >> 8;
  13962. j1 = j1 * (minimapZoom + 256) >> 8;
  13963. int k1 = clickY * i1 + clickX * j1 >> 11;
  13964. int l1 = clickY * j1 - clickX * i1 >> 11;
  13965. int i2 = myPlayer.x + k1 >> 7;
  13966. int j2 = myPlayer.y - l1 >> 7;
  13967. boolean flag1 = doWalkTo(1, 0, 0, 0, myPlayer.smallY[0], 0, 0, j2, myPlayer.smallX[0], true, i2);
  13968.  
  13969. if (flag1) {
  13970. getOut().getByte(clickX);
  13971. getOut().getByte(clickY);
  13972. getOut().putShort(viewRotation);
  13973. getOut().putByte(57);
  13974. getOut().putByte(minimapRotation);
  13975. getOut().putByte(minimapZoom);
  13976. getOut().getByte(89);
  13977. getOut().putShort(myPlayer.x);
  13978. getOut().putShort(myPlayer.y);
  13979. getOut().getByte(anInt1264);
  13980. getOut().getByte(63);
  13981. }
  13982. }
  13983.  
  13984. anInt1117++;
  13985.  
  13986. if (anInt1117 > 1151) {
  13987. anInt1117 = 0;
  13988. getOut().putOpcode(246);
  13989. getOut().getByte(0);
  13990. int l = getOut().position;
  13991.  
  13992. if ((int) (Math.random() * 2D) == 0) {
  13993. getOut().getByte(101);
  13994. }
  13995.  
  13996. getOut().getByte(197);
  13997. getOut().putShort((int) (Math.random() * 65536D));
  13998. getOut().getByte((int) (Math.random() * 256D));
  13999. getOut().getByte(67);
  14000. getOut().putShort(14214);
  14001.  
  14002. if ((int) (Math.random() * 2D) == 0) {
  14003. getOut().putShort(29487);
  14004. }
  14005.  
  14006. getOut().putShort((int) (Math.random() * 65536D));
  14007.  
  14008. if ((int) (Math.random() * 2D) == 0) {
  14009. getOut().getByte(220);
  14010. }
  14011.  
  14012. getOut().getByte(180);
  14013. getOut().putVariableSizeByte(getOut().position - l);
  14014. }
  14015. }
  14016. }
  14017.  
  14018. private boolean processMenuClick() {
  14019. if (activeInterfaceType != 0) {
  14020. return false;
  14021. }
  14022.  
  14023. int clickType = super.clickMode3;
  14024.  
  14025. if (spellSelected == 1 && super.saveClickX >= 516 && super.saveClickY >= 160 && super.saveClickX <= 765 && super.saveClickY <= 205) {
  14026. clickType = 0;
  14027. }
  14028.  
  14029. if (menuOpen) {
  14030. if (clickType != 1) {
  14031. int clickX = super.mouseX;
  14032. int clickY = super.mouseY;
  14033.  
  14034. if (menuScreenArea == 0) {
  14035. clickX -= GameFrame.getScreenMode() == ScreenMode.FIXED ? 4 : 0;
  14036. clickY -= GameFrame.getScreenMode() == ScreenMode.FIXED ? 4 : 0;
  14037. }
  14038.  
  14039. if (menuScreenArea == 1) {
  14040. clickX -= 519;
  14041. clickY -= 168;
  14042. }
  14043.  
  14044. if (menuScreenArea == 2) {
  14045. clickX -= 17;
  14046. clickY -= 338;
  14047. }
  14048.  
  14049. if (menuScreenArea == 3) {
  14050. clickX -= 519;
  14051. clickY -= 0;
  14052. }
  14053.  
  14054. if (clickX < menuOffsetX - 10 || clickX > menuOffsetX + menuWidth + 10 || clickY < menuOffsetY - 10 || clickY > menuOffsetY + menuHeight + 10) {
  14055. menuOpen = false;
  14056. // if (menuScreenArea == 1)
  14057. // {
  14058. // needDrawTabArea = true;
  14059. // }
  14060. if (menuScreenArea == 2) {
  14061. inputTaken = true;
  14062. }
  14063. }
  14064. }
  14065.  
  14066. if (clickType == 1) {
  14067. int xOffset = menuOffsetX;
  14068. int yOffset = menuOffsetY;
  14069. int width = menuWidth;
  14070. int clickX = super.saveClickX;
  14071. int clickY = super.saveClickY;
  14072.  
  14073. if (menuScreenArea == 0) {
  14074. clickX -= GameFrame.getScreenMode() == ScreenMode.FIXED ? 4 : 0;
  14075. clickY -= GameFrame.getScreenMode() == ScreenMode.FIXED ? 4 : 0;
  14076. }
  14077.  
  14078. if (menuScreenArea == 1) {
  14079. clickX -= 519;
  14080. clickY -= 168;
  14081. }
  14082.  
  14083. if (menuScreenArea == 2) {
  14084. clickX -= 17;
  14085. clickY -= 338;
  14086. }
  14087.  
  14088. if (menuScreenArea == 3) {
  14089. clickX -= 519;
  14090. clickY -= 0;
  14091. }
  14092.  
  14093. int actionIndex = -1;
  14094.  
  14095. for (int index = 0; index < menuActionRow; index++) {
  14096. int row = yOffset + 31 + (menuActionRow - 1 - index) * 15;
  14097.  
  14098. if (clickX > xOffset && clickX < xOffset + width && clickY > row - 11 && clickY < row + 5) {
  14099. actionIndex = index;
  14100. }
  14101. }
  14102.  
  14103. if (actionIndex != -1) {
  14104. doAction(actionIndex);
  14105. }
  14106.  
  14107. menuOpen = false;
  14108.  
  14109. if (menuScreenArea == 2) {
  14110. inputTaken = true;
  14111. }
  14112. }
  14113.  
  14114. return true;
  14115. } else {
  14116. if (clickType == 1 && menuActionRow > 0) {
  14117. int actionId = menuActionID[menuActionRow - 1];
  14118.  
  14119. if (actionId == 632 || actionId == 78 || actionId == 867 || actionId == 431 || actionId == 53 || actionId == 74 || actionId == 454 || actionId == 539 || actionId == 493 || actionId == 847 || actionId == 447 || actionId == 1125) {
  14120. int actionOne = menuActionCmd2[menuActionRow - 1];
  14121. int actionTwo = menuActionCmd3[menuActionRow - 1];
  14122. RSInterface rsi = RSInterface.interfaceCache[actionTwo];
  14123.  
  14124. if (rsi.allowSwapItems || rsi.deletesTargetSlot) {
  14125. aBoolean1242 = false;
  14126. anInt989 = 0;
  14127. anInt1084 = actionTwo;
  14128. anInt1085 = actionOne;
  14129. activeInterfaceType = 2;
  14130. anInt1087 = super.saveClickX;
  14131. anInt1088 = super.saveClickY;
  14132.  
  14133. if (RSInterface.interfaceCache[actionTwo].parentID == openInterfaceID) {
  14134. activeInterfaceType = 1;
  14135. }
  14136.  
  14137. if (RSInterface.interfaceCache[actionTwo].parentID == backDialogID) {
  14138. activeInterfaceType = 3;
  14139. }
  14140.  
  14141. return true;
  14142. }
  14143. }
  14144. }
  14145.  
  14146. if (clickType == 1 && (anInt1253 == 1 || menuHasAddFriend(menuActionRow - 1)) && menuActionRow > 2) {
  14147. clickType = 2;
  14148. }
  14149.  
  14150. if (clickType == 1 && menuActionRow > 0) {
  14151. doAction(menuActionRow - 1);
  14152. }
  14153.  
  14154. if (clickType == 2 && menuActionRow > 0) {
  14155. determineMenuSize();
  14156. }
  14157.  
  14158. return false;
  14159. }
  14160. }
  14161.  
  14162. private void processOnDemandQueue() {
  14163. do {
  14164. OnDemandRequest onDemandData;
  14165.  
  14166. do {
  14167. onDemandData = onDemandFetcher.getNextNode();
  14168.  
  14169. if (onDemandData == null) {
  14170. return;
  14171. }
  14172.  
  14173. if (onDemandData.getDataType() == 0) {
  14174. Model.method460(onDemandData.getBuffer(), onDemandData.getId());
  14175. // needDrawTabArea = true;
  14176.  
  14177. if (backDialogID != -1) {
  14178. setInputTaken(true);
  14179. }
  14180. }
  14181.  
  14182. if (onDemandData.getDataType() == 1) {
  14183. FrameReader.load(onDemandData.getId(), onDemandData.getBuffer());
  14184. }
  14185.  
  14186. if (onDemandData.getDataType() == 2 && onDemandData.getId() == nextSong && onDemandData.getBuffer() != null) {
  14187. musicData = new byte[onDemandData.getBuffer().length];
  14188. ArrayUtils.arraycopy(onDemandData.getBuffer(), 0, musicData, 0, musicData.length);
  14189. fetchMusic = true;
  14190. }
  14191.  
  14192. if (onDemandData.getDataType() == 3 && loadingStage == 1) {
  14193. for (int i = 0; i < aByteArrayArray1183.length; i++) {
  14194. if (floorMap[i] == onDemandData.getId()) {
  14195. aByteArrayArray1183[i] = onDemandData.getBuffer();
  14196.  
  14197. if (onDemandData.getBuffer() == null) {
  14198. floorMap[i] = -1;
  14199. }
  14200.  
  14201. break;
  14202. }
  14203.  
  14204. if (objectMap[i] != onDemandData.getId()) {
  14205. continue;
  14206. }
  14207.  
  14208. aByteArrayArray1247[i] = onDemandData.getBuffer();
  14209.  
  14210. if (onDemandData.getBuffer() == null) {
  14211. objectMap[i] = -1;
  14212. }
  14213.  
  14214. break;
  14215. }
  14216. }
  14217. if (onDemandData.getDataType() == 4) {
  14218. Texture.decode(onDemandData.getId(), onDemandData.getBuffer());
  14219. }
  14220. } while (onDemandData.getDataType() != 93 || !onDemandFetcher.method564(onDemandData.getId()));
  14221.  
  14222. ObjectManager.method173(new ByteBuffer(onDemandData.getBuffer()), onDemandFetcher);
  14223. } while (true);
  14224. }
  14225.  
  14226. int skillTabHoverChild;
  14227.  
  14228.  
  14229. private void processRightClick() {
  14230. if (activeInterfaceType != 0) {
  14231. return;
  14232. }
  14233.  
  14234. menuActionName[0] = "Cancel";
  14235. menuActionID[0] = 1107;
  14236. menuActionRow = 1;
  14237.  
  14238. int splitBoxX = 495;
  14239. int splitBoxY = 122 + (GameFrame.getScreenMode() == ScreenMode.FIXED ? 0 : 2);
  14240.  
  14241. if (getFullscreenInterfaceID() != -1) {
  14242. anInt886 = 0;
  14243. anInt1315 = 0;
  14244. skillTabHoverChild = 0;
  14245. buildInterfaceMenu(GameFrame.getScreenMode() == ScreenMode.FIXED ? 8 : getScreenWidth() / 2 - RSInterface.interfaceCache[getFullscreenInterfaceID()].width / 2, RSInterface.interfaceCache[getFullscreenInterfaceID()], super.mouseX, GameFrame.getScreenMode() == ScreenMode.FIXED ? 8 : getScreenHeight() / 2 - RSInterface.interfaceCache[getFullscreenInterfaceID()].height / 2, super.mouseY, 0);
  14246.  
  14247. if (anInt886 != anInt1026) {
  14248. anInt1026 = anInt886;
  14249. }
  14250.  
  14251. if (anInt1315 != anInt1129) {
  14252. anInt1129 = anInt1315;
  14253. }
  14254.  
  14255. return;
  14256. }
  14257.  
  14258. if (!chatArea.componentHidden() && isGameFrameVisible()) {
  14259. buildSplitPrivateChatMenu();
  14260. }
  14261.  
  14262. boolean inSplitChatSelectionBox = mouseX >= splitBoxX && mouseX <= splitBoxX + 15 && mouseY >= splitBoxY + chatArea.getyPos() && mouseY <= splitBoxY + chatArea.getyPos() + 13;
  14263. if (inSplitChatSelectionBox) {
  14264. chatArea.channel.processChatModeActions(this, GameFrame.getScreenMode());
  14265. return;
  14266. }
  14267.  
  14268. anInt886 = 0;
  14269. anInt1315 = 0;
  14270. skillTabHoverChild = 0;
  14271. int width = GameFrame.getScreenMode() != ScreenMode.FIXED ? getScreenWidth() : 516;
  14272. int height = GameFrame.getScreenMode() != ScreenMode.FIXED ? getScreenHeight() : 338;
  14273.  
  14274. if (super.mouseX > gameScreenDrawX && super.mouseY > gameScreenDrawY && super.mouseX < width && super.mouseY < height) {
  14275. if (openInterfaceID != -1 && isGameFrameVisible()) {
  14276. RSInterface rsInterface = RSInterface.interfaceCache[openInterfaceID];
  14277.  
  14278. if (GameFrame.getScreenMode() != ScreenMode.FIXED) {
  14279. int interfaceWidth = GameFrame.getScreenMode() != ScreenMode.FIXED ? getScreenWidth() : 516;
  14280. int interfaceHeight = GameFrame.getScreenMode() != ScreenMode.FIXED ? getScreenHeight() : 338;
  14281. buildInterfaceMenu(gameScreenDrawX + (interfaceWidth - 765) / 2, rsInterface, super.mouseX, gameScreenDrawY + (interfaceHeight - 503) / 2, super.mouseY, 0);
  14282. } else {
  14283. buildInterfaceMenu(4, rsInterface, super.mouseX, 4, super.mouseY, 0);
  14284. }
  14285. } else {
  14286. try {
  14287. if (GameFrame.getScreenMode() != ScreenMode.FIXED) {
  14288. if (!mapArea.isHovering(this, GameFrame.getScreenMode()) && !chatArea.isHovering(this, GameFrame.getScreenMode()) && !tabArea.isHovering(this, GameFrame.getScreenMode())) {
  14289. build3dScreenMenu();
  14290. }
  14291. } else {
  14292. build3dScreenMenu();
  14293. }
  14294. } catch (Exception e) {
  14295. e.printStackTrace();
  14296. }
  14297. }
  14298. }
  14299.  
  14300. chatArea.channel.processChatModeActions(this, GameFrame.getScreenMode());
  14301.  
  14302. if (anInt886 != anInt1026) {
  14303. anInt1026 = anInt886;
  14304. }
  14305.  
  14306. if (anInt1315 != anInt1129) {
  14307. anInt1129 = anInt1315;
  14308. }
  14309.  
  14310. anInt886 = 0;
  14311. anInt1315 = 0;
  14312. skillTabHoverChild = 0;
  14313. if (tabArea.isHovering(this, GameFrame.getScreenMode()) && !tabArea.componentHidden()) {
  14314. if (invOverlayInterfaceID != -1) {
  14315. buildInterfaceMenu(tabArea.getxPos() + (GameFrame.getScreenMode() == ScreenMode.FIXED ? 31 : 40), RSInterface.interfaceCache[invOverlayInterfaceID], super.mouseX, tabArea.getyPos() + (GameFrame.getScreenMode() == ScreenMode.FIXED ? 36 : getScreenWidth() <= GameFrameConstants.smallTabs ? -6 : 30), super.mouseY, 0);
  14316. } else if (tabInterfaceIDs[tabID] != -1) {
  14317. buildInterfaceMenu(tabArea.getxPos() + (GameFrame.getScreenMode() == ScreenMode.FIXED ? 31 : 40), RSInterface.interfaceCache[tabInterfaceIDs[tabID]], super.mouseX, tabArea.getyPos() + (GameFrame.getScreenMode() == ScreenMode.FIXED ? 36 : getScreenWidth() <= GameFrameConstants.smallTabs ? -6 : 30), super.mouseY, 0);
  14318. }
  14319. }
  14320.  
  14321. if (anInt886 != anInt1048) {
  14322. // needDrawTabArea = true;
  14323. tabAreaAltered = true;
  14324. anInt1048 = anInt886;
  14325. }
  14326.  
  14327. if (anInt1315 != anInt1044) {
  14328. // needDrawTabArea = true;
  14329. tabAreaAltered = true;
  14330. anInt1044 = anInt1315;
  14331. }
  14332.  
  14333. anInt886 = 0;
  14334. anInt1315 = 0;
  14335. if (super.mouseX > chatArea.getxPos() && super.mouseY > chatArea.getyPos() && super.mouseX < chatArea.getxPos() + 490 && super.mouseY < chatArea.getyPos() + 125) {
  14336. if (backDialogID != -1) {
  14337. buildInterfaceMenu(20, RSInterface.interfaceCache[backDialogID], super.mouseX, chatArea.getyPos() + 20, super.mouseY, chatArea.getxPos());
  14338. } else if (super.mouseY < chatArea.getyPos() + 125 && super.mouseX < chatArea.getxPos() + 490) {
  14339. buildChatAreaMenu(super.mouseY - chatArea.getyPos());
  14340. }
  14341. }
  14342.  
  14343. if (backDialogID != -1 && anInt886 != anInt1039) {
  14344. setInputTaken(true);
  14345. anInt1039 = anInt886;
  14346. }
  14347.  
  14348. if (backDialogID != -1 && anInt1315 != anInt1500) {
  14349. setInputTaken(true);
  14350. anInt1500 = anInt1315;
  14351. }
  14352.  
  14353. mapArea.processMinimapActions(this);
  14354. boolean flag = false;
  14355.  
  14356. while (!flag) {
  14357. flag = true;
  14358.  
  14359. for (int j = 0; j < menuActionRow - 1; j++) {
  14360. if (menuActionID[j] < 1000 && menuActionID[j + 1] > 1000) {
  14361. String s = menuActionName[j];
  14362. menuActionName[j] = menuActionName[j + 1];
  14363. menuActionName[j + 1] = s;
  14364. int k = menuActionID[j];
  14365. menuActionID[j] = menuActionID[j + 1];
  14366. menuActionID[j + 1] = k;
  14367. k = menuActionCmd2[j];
  14368. menuActionCmd2[j] = menuActionCmd2[j + 1];
  14369. menuActionCmd2[j + 1] = k;
  14370. k = menuActionCmd3[j];
  14371. menuActionCmd3[j] = menuActionCmd3[j + 1];
  14372. menuActionCmd3[j + 1] = k;
  14373. k = menuActionCmd4[j];
  14374. menuActionCmd4[j] = menuActionCmd4[j + 1];
  14375. menuActionCmd4[j + 1] = k;
  14376. k = menuActionCmd1[j];
  14377. menuActionCmd1[j] = menuActionCmd1[j + 1];
  14378. menuActionCmd1[j + 1] = k;
  14379. flag = false;
  14380. }
  14381. }
  14382. }
  14383. }
  14384.  
  14385. private boolean promptUserForInput(RSInterface rsinterface) {
  14386. int id = rsinterface.contentType;
  14387. int index = rsinterface.id - 79924;
  14388. if (getAnInt900() == 2) {
  14389. if (id == 201) {
  14390. inputTaken = true;
  14391. inputDialogState = 0;
  14392. messagePromptRaised = true;
  14393. promptInput = "";
  14394. friendsListAction = 1;
  14395. promptMessage = "Enter name of friend to add to list";
  14396. }
  14397.  
  14398. if (id == 202) {
  14399. inputTaken = true;
  14400. inputDialogState = 0;
  14401. messagePromptRaised = true;
  14402. promptInput = "";
  14403. friendsListAction = 2;
  14404. promptMessage = "Enter name of friend to delete from list";
  14405. }
  14406. }
  14407.  
  14408. if (id == 205) {
  14409. anInt1011 = 250;
  14410. return true;
  14411. }
  14412.  
  14413. if (id == 501) {
  14414. inputTaken = true;
  14415. inputDialogState = 0;
  14416. messagePromptRaised = true;
  14417. promptInput = "";
  14418. friendsListAction = 4;
  14419. promptMessage = "Enter the name of a player to add to the list";
  14420. }
  14421.  
  14422. if (id == 502) {
  14423. inputTaken = true;
  14424. inputDialogState = 0;
  14425. messagePromptRaised = true;
  14426. promptInput = "";
  14427. friendsListAction = 5;
  14428. promptMessage = "Enter the name of a player to delete from the list";
  14429. }
  14430. if (id == 1321) {
  14431. inputTaken = true;
  14432. inputDialogState = 0;
  14433. messagePromptRaised = true;
  14434. promptInput = "";
  14435. friendsListAction = 12;
  14436. promptMessage = "Enter your " +Skills.SKILL_NAMES[index]+ " level goal below.";
  14437. }
  14438. if (id == 1322) {
  14439. inputTaken = true;
  14440. inputDialogState = 0;
  14441. messagePromptRaised = true;
  14442. promptInput = "";
  14443. friendsListAction = 13;
  14444. promptMessage = "Enter your experience goal below.";
  14445. }
  14446. if (id == 1323) {
  14447. if (Skills.goalData[Skills.selectedSkillId][0] == -1 && Skills.goalData[Skills.selectedSkillId][1] == -1 && Skills.goalData[Skills.selectedSkillId][2] == -1) {
  14448. pushMessage("You do not have a goal to clear for that level.", 0, "");
  14449. }
  14450. if (Skills.selectedSkillId > -1) {
  14451. Skills.goalData[Skills.selectedSkillId][0] = -1;
  14452. Skills.goalData[Skills.selectedSkillId][1] = -1;
  14453. Skills.goalData[Skills.selectedSkillId][2] = -1;
  14454. saveGoals(myUsername);
  14455. }
  14456. } else if(id >= 5000 && id <= 5025) {
  14457. getOut().putOpcode(223);
  14458. index = id - 5000;
  14459. getOut().putShort(index);
  14460. return true;
  14461. }
  14462.  
  14463. if (id == 550) {
  14464. if (RSInterface.interfaceCache[18135].message.startsWith("Join")) {
  14465. inputTaken = true;
  14466. inputDialogState = 0;
  14467. messagePromptRaised = true;
  14468. promptInput = "";
  14469. friendsListAction = 6;
  14470. promptMessage = "Enter the name of the chat you wish to join";
  14471. } else {
  14472. getOut().putOpcode(185);
  14473. getOut().putShort(49627);
  14474. }
  14475. }
  14476.  
  14477. if (id == 22222) {
  14478. inputTaken = true;
  14479. messagePromptRaised = true;
  14480. amountOrNameInput = "";
  14481. promptInput = "";
  14482. inputDialogState = 0;
  14483. interfaceButtonAction = 6199;
  14484. promptMessage = "Enter a name for the clan chat.";
  14485. }
  14486.  
  14487. if (id == 677) {
  14488. inputTaken = true;
  14489. messagePromptRaised = true;
  14490. amountOrNameInput = "";
  14491. promptInput = "";
  14492. inputDialogState = 0;
  14493. interfaceButtonAction = 6200;
  14494. promptMessage = "Enter name of the player you would like kicked.";
  14495. }
  14496.  
  14497. if (id >= 300 && id <= 313) {
  14498. int k = (id - 300) / 2;
  14499. int j1 = id & 1;
  14500. int i2 = myAppearance[k];
  14501.  
  14502. if (i2 != -1) {
  14503. do {
  14504. if (j1 == 0 && --i2 < 0) {
  14505. i2 = IdentityKit.getLength() - 1;
  14506. }
  14507.  
  14508. if (j1 == 1 && ++i2 >= IdentityKit.getLength()) {
  14509. i2 = 0;
  14510. }
  14511. } while (IdentityKit.cache[i2].isaBoolean662() || IdentityKit.cache[i2].getAnInt657() != k + (isMale ? 0 : 7));
  14512.  
  14513. myAppearance[k] = i2;
  14514. aBoolean1031 = true;
  14515. }
  14516. }
  14517.  
  14518. if (id >= 314 && id <= 323) {
  14519. int l = (id - 314) / 2;
  14520. int k1 = id & 1;
  14521. int j2 = anIntArray990[l];
  14522.  
  14523. if (k1 == 0 && --j2 < 0) {
  14524. j2 = anIntArrayArray1003[l].length - 1;
  14525. }
  14526.  
  14527. if (k1 == 1 && ++j2 >= anIntArrayArray1003[l].length) {
  14528. j2 = 0;
  14529. }
  14530.  
  14531. anIntArray990[l] = j2;
  14532. aBoolean1031 = true;
  14533. }
  14534.  
  14535. if (id == 324 && !isMale) {
  14536. isMale = true;
  14537. method45();
  14538. }
  14539.  
  14540. if (id == 325 && isMale) {
  14541. isMale = false;
  14542. method45();
  14543. }
  14544.  
  14545. if (id == 326) {
  14546. String s = " "+(isMale ? 0 : 1)+"";
  14547. for (int i1 = 0; i1 < 7; i1++)
  14548. s += " "+(myAppearance[i1]);
  14549. for (int l1 = 0; l1 < 5; l1++)
  14550. s += " "+(anIntArray990[l1]);
  14551. getOut().putOpcode(11);
  14552. getOut().putByte(s.substring(1).length() +1);
  14553. getOut().putString(s.substring(1));
  14554. return true;
  14555. }
  14556.  
  14557. return false;
  14558. }
  14559.  
  14560. public final int[] chatColor = new int[500];
  14561.  
  14562. public void pushMessage(String chatMessage, int chatType, String chatName, String title, int color, int position) {
  14563. if (chatType == 0 && dialogID != -1) {
  14564. aString844 = chatMessage;
  14565. super.clickMode3 = 0;
  14566. }
  14567.  
  14568. if (backDialogID == -1) {
  14569. inputTaken = true;
  14570. }
  14571.  
  14572. for (int j = 499; j > 0; j--) {
  14573. chatTypes[j] = chatTypes[j - 1];
  14574. chatNames[j] = chatNames[j - 1];
  14575. chatMessages[j] = chatMessages[j - 1];
  14576. chatRights[j] = chatRights[j - 1];
  14577. chatTitles[j] = chatTitles[j - 1];
  14578. chatPosition[j] = chatPosition[j - 1];
  14579. chatColor[j] = chatColor[j - 1];
  14580. }
  14581.  
  14582. if(chatType == 2 || chatType == 16 || chatType == 0) {
  14583. chatMessage = RSFontSystem.handleOldSyntax(chatMessage);
  14584. }
  14585.  
  14586. chatTypes[0] = chatType;
  14587. chatNames[0] = chatName;
  14588. chatMessages[0] = chatMessage.trim();
  14589. chatRights[0] = rights;
  14590. chatTitles[0] = title;
  14591. chatColor[0] = color;
  14592. chatPosition[0] = position;
  14593. }
  14594.  
  14595. public void pushMessage(String chatMessage, int chatType, String chatName) {
  14596. if (chatType == 0 && dialogID != -1) {
  14597. aString844 = chatMessage;
  14598. super.clickMode3 = 0;
  14599. }
  14600.  
  14601. if (backDialogID == -1) {
  14602. inputTaken = true;
  14603. }
  14604.  
  14605. for (int j = 499; j > 0; j--) {
  14606. chatTypes[j] = chatTypes[j - 1];
  14607. chatNames[j] = chatNames[j - 1];
  14608. chatMessages[j] = chatMessages[j - 1];
  14609. chatRights[j] = chatRights[j - 1];
  14610. chatTitles[j] = chatTitles[j - 1];
  14611. chatPosition[j] = chatPosition[j - 1];
  14612. chatColor[j] = chatColor[j - 1];
  14613. }
  14614.  
  14615. chatTypes[0] = chatType;
  14616. chatNames[0] = chatName;
  14617. chatMessages[0] = chatMessage.trim();
  14618. chatRights[0] = rights;
  14619. chatTitles[0] = "";
  14620. chatColor[0] = 0;
  14621. chatPosition[0] = 0;
  14622. }
  14623.  
  14624. @Override
  14625. public void raiseWelcomeScreen() {
  14626. welcomeScreenRaised = true;
  14627. }
  14628.  
  14629. private void resetAllImageProducers() {
  14630. if (super.fullGameScreen != null) {
  14631. return;
  14632. }
  14633.  
  14634. chatAreaIP = null;
  14635. mapAreaIP = null;
  14636. tabAreaIP = null;
  14637. gameScreenIP = null;
  14638. aRSImageProducer_1125 = null;
  14639. aRSImageProducer_1107 = null;
  14640. titleScreenIP = null;
  14641. super.fullGameScreen = new RSImageProducer(765, 503, getGameComponent());
  14642. welcomeScreenRaised = true;
  14643. }
  14644.  
  14645. private void resetImageProducers() {
  14646. if (aRSImageProducer_1107 != null) {
  14647. return;
  14648. }
  14649. super.fullGameScreen = null;
  14650. chatAreaIP = null;
  14651. mapAreaIP = null;
  14652. tabAreaIP = null;
  14653. gameScreenIP = null;
  14654. aRSImageProducer_1125 = null;
  14655. aRSImageProducer_1107 = new RSImageProducer(509, 171, getGameComponent());
  14656. DrawingArea.setAllPixelsToZero();
  14657. titleScreenIP = new RSImageProducer(getScreenWidth(), getScreenHeight(), getGameComponent());
  14658. DrawingArea.setAllPixelsToZero();
  14659. new RSImageProducer(203, 238, getGameComponent());
  14660. DrawingArea.setAllPixelsToZero();
  14661. new RSImageProducer(74, 94, getGameComponent());
  14662. DrawingArea.setAllPixelsToZero();
  14663. if (titleStreamLoader != null) {
  14664. drawLogo();
  14665. loadTitleScreen();
  14666. }
  14667. welcomeScreenRaised = true;
  14668. }
  14669.  
  14670. public void resetImageProducers2() {
  14671. if (chatAreaIP != null) {
  14672. return;
  14673. }
  14674. nullLoader();
  14675. super.fullGameScreen = null;
  14676. aRSImageProducer_1107 = null;
  14677. titleScreenIP = null;
  14678. chatAreaIP = new RSImageProducer(516, 165, getGameComponent());
  14679. mapAreaIP = new RSImageProducer(249, 168, getGameComponent());
  14680. DrawingArea.setAllPixelsToZero();
  14681. if (GameFrame.getScreenMode() == ScreenMode.FIXED) {
  14682. cacheSprite[14].drawSprite(0, 0);
  14683. }
  14684. tabAreaIP = new RSImageProducer(250, 335, getGameComponent());
  14685. gameScreenIP = new RSImageProducer(GameFrame.getScreenMode() == ScreenMode.FIXED && isGameFrameVisible() ? 512 : getScreenWidth(), GameFrame.getScreenMode() == ScreenMode.FIXED && isGameFrameVisible() ? 334 : getScreenHeight(), getGameComponent());
  14686. DrawingArea.setAllPixelsToZero();
  14687. aRSImageProducer_1125 = new RSImageProducer(249, 45, getGameComponent());
  14688. welcomeScreenRaised = true;
  14689. }
  14690.  
  14691. public void resetLogout() {
  14692. try {
  14693. if (getConnection() != null) {
  14694. getConnection().close();
  14695. }
  14696. } catch (Exception _ex) {
  14697. }
  14698.  
  14699. if(Configuration.SAVE_ACCOUNTS) {
  14700.  
  14701. boolean updated = false;
  14702. for(Account account : accountManager.getAccounts()) {
  14703. if(account == null)
  14704. continue;
  14705. if(account.getUsername().equalsIgnoreCase(myUsername)) {
  14706. account.setIDKHead(myPlayer.equipment[0] < 1164 ? myAppearance[0] == 0 ? myHeadAndJaw[0] : myAppearance[0] : 0);
  14707. account.setHelmet(myPlayer.equipment[0] >= 1164 ? myPlayer.equipment[0] - 512 : 0);
  14708. account.setJaw(myHeadAndJaw[1]);
  14709. account.setGender(myPlayer.myGender);
  14710. account.setPassword(password);
  14711. updated = true;
  14712. break;
  14713. }
  14714. }
  14715.  
  14716. if(!updated) {
  14717. accountManager.addAccount(new Account(
  14718. myUsername,
  14719. password,
  14720. myPlayer.myGender, myPlayer.equipment[0] >= 1164 ? myPlayer.equipment[0] - 512
  14721. : 0,
  14722. myPlayer.equipment[0] < 1164 ? myAppearance[0] == 0 ? myHeadAndJaw[0]
  14723. : myAppearance[0]
  14724. : 0, myAppearance[1] == 0 ? myHeadAndJaw[1]
  14725. : myAppearance[1]), false);
  14726. } else {
  14727. accountManager.updateInterface();
  14728. }
  14729.  
  14730. accountManager.save();
  14731. }
  14732. currentTarget = null;
  14733. loggingIn = false;
  14734. loginMessage1 = loginMessage2 = "";
  14735. consoleOpen = false;
  14736. lootingBag = false;
  14737. setConnection(null);
  14738. loggedIn = false;
  14739. setLoginScreenState(0);
  14740. setLoginScreenCursorPos(0);
  14741. unlinkMRUNodes();
  14742. worldController.initToNull();
  14743.  
  14744. for (int i = 0; i < 4; i++) {
  14745. clippingPlanes[i].method210();
  14746. }
  14747.  
  14748. System.gc();
  14749. stopMidi();
  14750. currentSong = -1;
  14751. nextSong = -1;
  14752. prevSong = 0;
  14753. if (!GameFrame.isFixed()) {
  14754. updateScreen();
  14755. }
  14756. method58(10, 0, false, 0);
  14757. updateGraphics(true);
  14758. savePlayerData();
  14759. }
  14760.  
  14761. public void resetWorld(int stage) {
  14762. if (stage == 0) {
  14763. soundCount = 0;
  14764. cameraOffsetX = 0;
  14765. cameraOffsetY = 0;
  14766. viewRotationOffset = 0;
  14767. minimapRotation = 0;
  14768. minimapZoom = 0;
  14769. viewRotation = 0;
  14770. anInt1021 = 0;
  14771. loadingStage = 1;
  14772. } else if (stage == 1) {
  14773. aBoolean1080 = false;
  14774. }
  14775. }
  14776.  
  14777. @Override
  14778. public void run() {
  14779. if (drawFlames) {
  14780. drawFlames();
  14781. } else {
  14782. super.run();
  14783. }
  14784. }
  14785.  
  14786. private void sendFrame248(int interfaceID, int sideInterfaceID) {
  14787. if (backDialogID != -1) {
  14788. backDialogID = -1;
  14789. inputTaken = true;
  14790. }
  14791. if (inputDialogState != 0) {
  14792. inputDialogState = 0;
  14793. inputTaken = true;
  14794. }
  14795. openInterfaceID = interfaceID;
  14796. invOverlayInterfaceID = sideInterfaceID;
  14797. tabAreaAltered = true;
  14798. aBoolean1149 = false;
  14799. }
  14800.  
  14801. private void sendFrame36(int id, int state) {
  14802. settings[id] = state;
  14803.  
  14804. if (variousSettings[id] != state) {
  14805. variousSettings[id] = state;
  14806. updateConfig(id);
  14807.  
  14808. if (dialogID != -1) {
  14809. inputTaken = true;
  14810. }
  14811. }
  14812. }
  14813.  
  14814. private void sendPacket(int packet) {
  14815. if (packet == 103) {
  14816. getOut().putOpcode(103);
  14817. getOut().putByte(inputString.length() - 1);
  14818. getOut().putString(inputString.substring(2));
  14819. inputString = "";
  14820. promptInput = "";
  14821. interfaceButtonAction = 0;
  14822. }
  14823.  
  14824. if (packet == 1003) {
  14825. getOut().putOpcode(103);
  14826. inputString = "::" + inputString;
  14827. getOut().putByte(inputString.length() - 1);
  14828. getOut().putString(inputString.substring(2));
  14829. inputString = "";
  14830. promptInput = "";
  14831. interfaceButtonAction = 0;
  14832. }
  14833. }
  14834.  
  14835. private void setCameraPos(int j, int k, int l, int i1, int j1, int k1) {
  14836. int l1 = 2048 - k & 0x7ff;
  14837. int i2 = 2048 - j1 & 0x7ff;
  14838. int j2 = 0;
  14839. int k2 = 0;
  14840. int l2 = j;
  14841. if (l1 != 0) {
  14842. int i3 = Model.SINE[l1];
  14843. int k3 = Model.COSINE[l1];
  14844. int i4 = k2 * k3 - l2 * i3 >> 16;
  14845. l2 = k2 * i3 + l2 * k3 >> 16;
  14846. k2 = i4;
  14847. }
  14848. if (i2 != 0) {
  14849. int j3 = Model.SINE[i2];
  14850. int l3 = Model.COSINE[i2];
  14851. int j4 = l2 * j3 + j2 * l3 >> 16;
  14852. l2 = l2 * l3 - j2 * j3 >> 16;
  14853. j2 = j4;
  14854. }
  14855. xCameraPos = l - j2;
  14856. zCameraPos = i1 - k2;
  14857. yCameraPos = k1 - l2;
  14858. yCameraCurve = k;
  14859. xCameraCurve = j1;
  14860. }
  14861.  
  14862. private void setGameFrameVisible(boolean visible, GameFrame[] area) {
  14863. for (GameFrame a : area) {
  14864. a.setVisible(visible);
  14865. }
  14866.  
  14867. gameAreaWidth = GameFrame.getScreenMode() == ScreenMode.FIXED && visible ? 512 : getScreenWidth();
  14868. gameAreaHeight = GameFrame.getScreenMode() == ScreenMode.FIXED && visible ? 334 : getScreenHeight();
  14869. gameFrameVisible = visible;
  14870. }
  14871.  
  14872. public void setInputTaken(boolean inputTaken) {
  14873. this.inputTaken = inputTaken;
  14874. }
  14875.  
  14876. /**
  14877. * The line ids in order
  14878. */
  14879. private static int[] lines = { 640, 663, 7332, 7333, 7334, 7336, 7383,
  14880. 7339, 7338, 7340, 7346, 7341, 7342, 7337, 7343, 7335, 7344, 7345,
  14881. 7347, 7348, 682, 12772, 673, 7352, 17510, 7353, 12129, 8438, 12852,
  14882. 15841, 7354, 7355, 7356, 8679, 7459, 16149, 6987, 7357, 12836,
  14883. 7358, 7359, 14169, 10115, 14604, 7360, 12282, 13577, 12839, 7361,
  14884. 16128, 11857, 7362, 7363, 7364, 10135, 4508, 18517, 11907, 7365,
  14885. 7366, 7367, 13389, 15487, 7368, 11132, 7369, 12389, 13974, 6027,
  14886. 7370, 8137, 7371, 12345, 7372, 8115, 18684, 15499, 18306, 668,
  14887. 8576, 12139, 14912, 7373, 7374, 8969, 15352, 7375, 7376, 15098,
  14888. 15592, 249, 1740, 15235, 3278, 7378, 6518, 7379, 7380, 7381, 11858,
  14889. 191, 9927, 6024, 7349, 7350, 7351, 13356
  14890.  
  14891. };
  14892.  
  14893. public void setInterfaceText(String str, int i) {
  14894. try {
  14895. RSInterface _interface = RSInterface.interfaceCache[i];
  14896. _interface.message = str;
  14897.  
  14898. // if (_interface.parentID == tabInterfaceIDs[tabID])
  14899. // {
  14900. // needDrawTabArea = true;
  14901. // }
  14902.  
  14903. if (_interface.type == 9) {
  14904. _interface.tooltipBoxText = str;
  14905. }
  14906.  
  14907. if (_interface.secondaryText != null && _interface.secondaryText.length() > 0) {
  14908. _interface.secondaryText = "";
  14909. }
  14910. } catch (Exception exception) {
  14911. exception.getStackTrace();
  14912. // System.out.println(i);
  14913. }
  14914. }
  14915.  
  14916. private String setMessage(int skillLevel) {
  14917. if(skillLevel == 26) {
  14918. long totalXp = 0;
  14919. for(int i = 0; i < currentExp.length; i++) {
  14920. totalXp += currentExp[i];
  14921. }
  14922. return "Total XP: "+String.format("%, d", totalXp)+"";
  14923. }
  14924. String[] getToolTipText = new String[6];
  14925. String toolTiptext = "";
  14926. int[] getSkillIds = { 0, 3, 14, 2, 16, 13, 1, 15, 10, 4, 17, 7, 5, 12, 11, 6, 9, 8, 20, 18, 19, 21, 22, 23, 24, 25 };
  14927. int init = Skills.goalData[getSkillIds[skillLevel]][0];
  14928. int goal = Skills.goalData[getSkillIds[skillLevel]][1];
  14929. int stat = getSkillIds[skillLevel];
  14930. int currentLevel = currentStats[stat];
  14931. int maxLevel = maxStats[stat];
  14932. if(stat == 3 || stat == 5) {
  14933. currentLevel /= 10;
  14934. maxLevel /= 10;
  14935. }
  14936. getToolTipText[0] = (Skills.SKILL_NAMES[skillLevel] + ": " + currentLevel + "/" + maxLevel + "\\n");
  14937. getToolTipText[1] = ("Current Exp: " + (maxLevel < 99 ? "" : "") + String.format("%, d", currentExp[getSkillIds[skillLevel]]) + "\\n");
  14938. getToolTipText[2] = ("Next level: " + String.format("%, d", PlayerHandler.getXPForLevel(maxLevel + 1) - currentExp[getSkillIds[skillLevel]]));
  14939. toolTiptext = getToolTipText[0] + getToolTipText[1];
  14940. boolean onNewLine = false;
  14941. if (maxLevel < 99) {
  14942. toolTiptext += getToolTipText[2]; //+ getToolTipText[3];
  14943. onNewLine = true;
  14944. }
  14945. if ((currentExp[getSkillIds[skillLevel]] < 1000000000) && init > -1 && goal > -1) {
  14946. getToolTipText[4] = ((onNewLine ? "\\n" : "") + Skills.goalType + "" + (Skills.goalType.endsWith("Level: ") ? Integer.valueOf(PlayerHandler.getLevelForXP(goal)) : String.format("%,d", goal)) + "\\n");
  14947. int remainder = goal - currentExp[getSkillIds[skillLevel]] - (Skills.goalType.endsWith("Level: ") ? 1 : 0);
  14948. if (remainder < 0) {
  14949. remainder = 0;
  14950. }
  14951. getToolTipText[5] = ("Remainder: " + String.format("%,d", remainder));
  14952. Skills.goalData[getSkillIds[skillLevel]][2] = (int) ( ((currentExp[getSkillIds[skillLevel]] - init) / (double) (goal - init)) * 100 );
  14953. if (Skills.goalData[getSkillIds[skillLevel]][2] > 100) {
  14954. Skills.goalData[getSkillIds[skillLevel]][2] = 100;
  14955. }
  14956. toolTiptext += getToolTipText[4] + getToolTipText[5];
  14957. }
  14958. return toolTiptext;
  14959. }
  14960.  
  14961. public void setNorth() {
  14962. cameraOffsetX = 0;
  14963. cameraOffsetY = 0;
  14964. viewRotationOffset = 0;
  14965. viewRotation = 0;
  14966. minimapRotation = 0;
  14967. minimapZoom = 0;
  14968. }
  14969.  
  14970. private static void showErrorScreen(Client client, String... messages) {
  14971. client.method4(1);
  14972. Graphics g = client.getGameComponent().getGraphics();
  14973. Color titleTextColor = new Color(50, 205, 50);
  14974. Color textColor = new Color(30, 191, 30);
  14975. g.setColor(Color.BLACK);
  14976. g.fillRect(0, 0, 765, 503);
  14977. g.setFont(new Font("Verdana", 1, 18));
  14978. g.setColor(titleTextColor);
  14979. g.drawString("Sorry, an error has occured whilst starting up "+Configuration.CLIENT_NAME+"", 30, 35);
  14980. g.drawLine(30, 40, 645, 40);
  14981. g.setFont(new Font("Arial", 1, 90));
  14982. g.setColor(textColor);
  14983. g.setFont(new Font("Verdana", 1, 16));
  14984. int startingX = 30, startingY = 40;
  14985. for (String message : messages) {
  14986. startingY += 40;
  14987. g.drawString(message, startingX, startingY);
  14988. }
  14989. }
  14990.  
  14991. private void spawnGroundItem(int i, int j) {
  14992. Deque class19 = groundArray[plane][i][j];
  14993. if (class19 == null) {
  14994. worldController.method295(plane, i, j);
  14995. return;
  14996. }
  14997. int k = 0xfa0a1f01;
  14998. Object obj = null;
  14999. for (Item item = (Item) class19.reverseGetFirst(); item != null; item = (Item) class19.reverseGetNext()) {
  15000. ItemDefinition itemDef = ItemDefinition.get(item.id);
  15001. int l = itemDef.value;
  15002. if (itemDef.stackable) {
  15003. l *= item.amount + 1;
  15004. }
  15005. if (l > k) {
  15006. k = l;
  15007. obj = item;
  15008. }
  15009. }
  15010.  
  15011. class19.insertTail((Node) obj);
  15012. Object obj1 = null;
  15013. Object obj2 = null;
  15014. for (Item class30_sub2_sub4_sub2_1 = (Item) class19.reverseGetFirst(); class30_sub2_sub4_sub2_1 != null; class30_sub2_sub4_sub2_1 = (Item) class19.reverseGetNext()) {
  15015. if (class30_sub2_sub4_sub2_1.id != ((Item) obj).id && obj1 == null) {
  15016. obj1 = class30_sub2_sub4_sub2_1;
  15017. }
  15018. if (class30_sub2_sub4_sub2_1.id != ((Item) obj).id && class30_sub2_sub4_sub2_1.id != ((Item) obj1).id && obj2 == null) {
  15019. obj2 = class30_sub2_sub4_sub2_1;
  15020. }
  15021. }
  15022.  
  15023. int i1 = i + (j << 7) + 0x60000000;
  15024. worldController.method281(i, i1, (Animable) obj1, method42(plane, j * 128 + 64, i * 128 + 64), (Animable) obj2, (Animable) obj, plane, j);
  15025. }
  15026.  
  15027. @Override
  15028. public void startRunnable(Runnable runnable, int i) {
  15029. if (i > 10) {
  15030. i = 10;
  15031. }
  15032. if (Signlink.mainapp != null) {
  15033. Signlink.startthread(runnable, i);
  15034. } else {
  15035. super.startRunnable(runnable, i);
  15036. }
  15037. }
  15038.  
  15039. public static int TotalRead = 0;
  15040.  
  15041. public void preloadModels() {
  15042. File file = new File(Signlink.getCacheDirectory() + "raw/");
  15043. File[] fileArray = file.listFiles();
  15044. for (File element : fileArray) {
  15045. String sss = element.getName();
  15046. System.out.println("Parsing model file " + sss);
  15047. byte[] buffer = ReadFile(Signlink.getCacheDirectory() + "/raw/" + sss);
  15048. Model.method460(buffer, Integer.parseInt(getFileNameWithoutExtension(sss)));
  15049. }
  15050. }
  15051.  
  15052. public static final byte[] ReadFile(String s) {
  15053. try {
  15054. byte abyte0[];
  15055. File file = new File(s);
  15056. int i = (int) file.length();
  15057. abyte0 = new byte[i];
  15058. DataInputStream datainputstream = new DataInputStream(new BufferedInputStream(new FileInputStream(s)));
  15059. datainputstream.readFully(abyte0, 0, i);
  15060. datainputstream.close();
  15061. TotalRead++;
  15062. return abyte0;
  15063. } catch (Exception e) {
  15064. System.out.println(new StringBuilder().append("Read Error: ").append(s).toString());
  15065. return null;
  15066. }
  15067. }
  15068.  
  15069. public void setLoadingPercentage(int loadingPercentage) {
  15070. this.loadingPercentage = loadingPercentage;
  15071. }
  15072.  
  15073. void processLoadingScreen() {
  15074. Thread t = new Thread(new Runnable() {
  15075. @Override
  15076. public void run() {
  15077. while (isLoading) {
  15078. try {
  15079.  
  15080. if(!CacheDownloader.UPDATING) {
  15081. loadingPercentage += 2;
  15082. if(loadingPercentage > 100) {
  15083. loadingPercentage = 100;
  15084. if(isLoading) {
  15085. // loadingPercentage = 0;
  15086. }
  15087. }
  15088. }
  15089.  
  15090. displayLoadingScreen();
  15091.  
  15092. // if (onDemandFetcher != null) {
  15093. // processOnDemandQueue();
  15094. // }
  15095.  
  15096. Thread.sleep(50);
  15097. } catch (Exception e) {
  15098. e.printStackTrace();
  15099. }
  15100. }
  15101. }
  15102. });
  15103. t.setPriority(10);
  15104. t.start();
  15105. }
  15106.  
  15107. @Override
  15108. void startUp() {
  15109. isLoading = true;
  15110. super.resetGraphic();
  15111. processLoadingScreen();
  15112. new Thread(new MemoryMonitor()).start();
  15113. if (Signlink.sunjava) {
  15114. super.minDelay = 5;
  15115. }
  15116. getDocumentBaseHost();
  15117.  
  15118. /** CACHE DOWNLOADS **/
  15119. for(int i = 0; i < loadingImages.length; i++) {
  15120. File dir = new File(Signlink.getCacheDirectory() + i + ".png");
  15121. if(!dir.exists()) {
  15122. boolean downloadedImage = HttpDownloadUtility.downloadFile(CacheDownloader.URL_TO_LOADING_IMAGES + i + ".png", Signlink.getCacheDirectory());
  15123. if(!downloadedImage) {
  15124. HttpDownloadUtility.downloadFile(CacheDownloader.MIRROR_URL_TO_LOADING_IMAGES + i + ".png", Signlink.getCacheDirectory());
  15125. }
  15126. }
  15127. try {
  15128. loadingImages[i] = ImageIO.read(dir);
  15129. } catch(Exception e){}
  15130. }
  15131.  
  15132. if(CacheDownloader.updatedCache()) {
  15133. if (super.mainFrame != null) {
  15134. super.mainFrame.setClientIcon();
  15135. }
  15136. setLoadingPercentage(0);
  15137. }
  15138.  
  15139. if (Signlink.cache_dat != null) {
  15140. for (int i = 0; i < Client.CACHE_INDEX_COUNT; i++) {
  15141. decompressors[i] = new Decompressor(Signlink.cache_dat, Signlink.cache_idx[i], i + 1);
  15142. }
  15143. }
  15144.  
  15145. try {
  15146. ////drawSmoothLoading(10, "Getting archives...");
  15147. titleStreamLoader = getArchive(1, "title screen", "title", expectedCRCs[1], 25);
  15148. smallText = new TextDrawingArea(false, "p11_full", titleStreamLoader);
  15149. normalText = new TextDrawingArea(false, "p12_full", titleStreamLoader);
  15150. smallHit = new TextDrawingArea(false, "hit_full", titleStreamLoader);
  15151. bigHit = new TextDrawingArea(true, "critical_full", titleStreamLoader);
  15152. chatTextDrawingArea = new TextDrawingArea(false, "b12_full", titleStreamLoader);
  15153. aTextDrawingArea_1273 = new TextDrawingArea(true, "q8_full", titleStreamLoader);
  15154. newSmallFont = new RSFontSystem(false, "p11_full", titleStreamLoader);
  15155. newRegularFont = new RSFontSystem(false, "p12_full", titleStreamLoader);
  15156. newBoldFont = new RSFontSystem(false, "b12_full", titleStreamLoader);
  15157. drawLogo();
  15158. loadTitleScreen();
  15159. aClass3_Sub7_Sub1_1493 = method407(instance);
  15160. aClass25_1948 = new Class25(22050, anInt197);
  15161. Archive streamLoader = getArchive(2, "config", "config", expectedCRCs[2], 30);
  15162. Archive streamLoader_1 = getArchive(3, "interface", "interface", expectedCRCs[3], 35);
  15163. Archive mediaArchive = getArchive(4, "2d graphics", "media", expectedCRCs[4], 40);
  15164. Archive streamLoader_3 = getArchive(6, "textures", "textures", expectedCRCs[6], 45);
  15165. Archive streamLoader_4 = getArchive(7, "chat system", "wordenc", expectedCRCs[7], 50);
  15166. Archive soundArchive = getArchive(8, "sound effects", "sounds", expectedCRCs[8], 55);
  15167. byteGroundArray = new byte[4][104][104];
  15168. intGroundArray = new int[4][105][105];
  15169. worldController = new WorldController(intGroundArray);
  15170.  
  15171. for (int j = 0; j < 4; j++) {
  15172. clippingPlanes[j] = new CollisionMap();
  15173. }
  15174.  
  15175. miniMapRegions = new Sprite(512, 512);
  15176. Archive streamLoader_6 = getArchive(5, "update list", "versionlist", expectedCRCs[5], 60);
  15177. ////drawSmoothLoading(10, "Unpacking archives..");
  15178. onDemandFetcher = new OnDemandFetcher();
  15179. onDemandFetcher.start(streamLoader_6, this);
  15180. Model.method459(onDemandFetcher.getFileCount(0), onDemandFetcher);
  15181. ////drawSmoothLoading(20, "Unpacked archives!");
  15182. constructMusic();
  15183. ////drawSmoothLoading(30, "Unpacking media..");
  15184. SpriteLoader.loadSprites();
  15185. cacheSprite = SpriteLoader.sprites;
  15186. SpriteLoader.sprites = null;
  15187. ////drawSmoothLoading(40, "Unpacked media!");
  15188. mapBack = new Background(mediaArchive, "mapback", 0);
  15189.  
  15190. mapEdge = new Sprite(mediaArchive, "mapedge", 0);
  15191. mapEdge.method345();
  15192.  
  15193. try {
  15194. for (int k3 = 0; k3 < 100; k3++) {
  15195. mapScenes[k3] = new Background(mediaArchive, "mapscene", k3);
  15196. }
  15197. } catch (Exception _ex) {
  15198. }
  15199.  
  15200. try {
  15201. for (int l3 = 0; l3 < 100; l3++) {
  15202. if (l3 < 75) {
  15203. mapFunctions[l3] = new Sprite(mediaArchive, "mapfunction", l3);
  15204. } else {
  15205. mapFunctions[l3] = new Sprite(mediaArchive, "mapfunctions2", l3 - 76);
  15206. }
  15207. }
  15208. } catch (Exception _ex) {
  15209. }
  15210.  
  15211. try {
  15212. for (int j4 = 0; j4 <= 8; j4++) {
  15213. headIcons[j4] = new Sprite(mediaArchive, "headicons_prayer", j4);
  15214. }
  15215.  
  15216. for (int j6 = 9; j6 < 18; j6++) {
  15217. headIcons[j6] = Client.cacheSprite[j6 + 357 - 9];
  15218. }
  15219.  
  15220. for (int j45 = 0; j45 < 7; j45++) {
  15221. skullIcons[j45] = new Sprite(mediaArchive, "headicons_pk", j45);
  15222. }
  15223. } catch (Exception _ex) {
  15224. }
  15225.  
  15226. mapFlag = new Sprite(mediaArchive, "mapmarker", 0);
  15227. mapMarker = new Sprite(mediaArchive, "mapmarker", 1);
  15228.  
  15229. for (int k4 = 0; k4 < 8; k4++) {
  15230. crosses[k4] = new Sprite(mediaArchive, "cross", k4);
  15231. }
  15232.  
  15233. mapDotItem = new Sprite(mediaArchive, "mapdots", 0);
  15234. mapDotNPC = new Sprite(mediaArchive, "mapdots", 1);
  15235. mapDotPlayer = new Sprite(mediaArchive, "mapdots", 2);
  15236. mapDotFriend = new Sprite(mediaArchive, "mapdots", 3);
  15237. mapDotTeam = new Sprite(mediaArchive, "mapdots", 4);
  15238. mapDotClan = cacheSprite[398];
  15239.  
  15240. for (int j3 = 0; j3 < 12; j3++) {
  15241. scrollPart[j3] = new Sprite(mediaArchive, "scrollpart", j3);
  15242. }
  15243.  
  15244. for (int id = 0; id < 6; id++) {
  15245. scrollBar[id] = new Sprite(mediaArchive, "scrollbar", id);
  15246. }
  15247.  
  15248. for (int l4 = 0; l4 < modIcons.length; l4++) {
  15249. modIcons[l4] = cacheSprite[827+l4];
  15250. }
  15251. multiOverlay = cacheSprite[1025];
  15252.  
  15253. Sprite sprite = new Sprite(mediaArchive, "screenframe", 0);
  15254. leftFrame = new RSImageProducer(sprite.myWidth, sprite.myHeight, getGameComponent());
  15255. sprite.method346(0, 0);
  15256. sprite = new Sprite(mediaArchive, "screenframe", 1);
  15257. topFrame = new RSImageProducer(sprite.myWidth, sprite.myHeight, getGameComponent());
  15258. sprite.method346(0, 0);
  15259. sprite = new Sprite(mediaArchive, "screenframe", 2);
  15260. rightFrame = new RSImageProducer(sprite.myWidth, sprite.myHeight, getGameComponent());
  15261. sprite.method346(0, 0);
  15262. sprite = new Sprite(mediaArchive, "mapedge", 0);
  15263. new RSImageProducer(sprite.myWidth, sprite.myHeight, getGameComponent());
  15264. sprite.method346(0, 0);
  15265. compass = new Sprite(mediaArchive, "compass", 0);
  15266. clientId = Signlink.uid;
  15267. ////drawSmoothLoading(50, "Unpacking textures..");
  15268. Rasterizer.method368(streamLoader_3);
  15269. Rasterizer.method372(0.80000000000000004D);
  15270. Rasterizer.method367();
  15271. ////drawSmoothLoading(60, "Unpacked textures!");
  15272. FrameReader.initialise(onDemandFetcher.getAnimCount());
  15273. Animation.unpackConfig(streamLoader);
  15274. ////drawSmoothLoading(70, "Unpacking config..");
  15275. ObjectDefinition.unpackConfig(streamLoader);
  15276. Flo.unpackConfig(streamLoader);
  15277. OverLayFlo317.load(streamLoader);
  15278. ItemDefinition.unpackConfig(streamLoader);
  15279. MobDefinition.load(streamLoader);
  15280. IdentityKit.unpackConfig(streamLoader);
  15281. SpotAnimDefinition.load(streamLoader);
  15282. Varp.load(streamLoader);
  15283. VarBit.unpackConfig(streamLoader);
  15284. ItemDefinition.isMembers = isMembers;
  15285. ////drawSmoothLoading(80, "Unpacked config!");
  15286. // ItemDefinition.dumpItemModelsForId(13653);
  15287. // onDemandFetcher.dump();
  15288.  
  15289. if (!isLowDetail()) {
  15290. ////drawSmoothLoading(85, "Unpacking sounds..");
  15291. byte[] data = soundArchive.get("sounds.dat");
  15292. ByteBuffer buffer = new ByteBuffer(data);
  15293. Sound.unpack(buffer);
  15294. ////drawSmoothLoading(90, "Unpacked sounds!");
  15295.  
  15296. }
  15297.  
  15298. ////drawSmoothLoading(95, "Unpacking interfaces");
  15299. TextDrawingArea[] aclass30_sub2_sub1_sub4s = { smallText,
  15300. normalText, chatTextDrawingArea, aTextDrawingArea_1273 };
  15301.  
  15302. try {
  15303. RSInterface.unpack(streamLoader_1, aclass30_sub2_sub1_sub4s, mediaArchive);
  15304. } catch (Exception e) {
  15305. e.printStackTrace();
  15306. }
  15307.  
  15308. ////drawSmoothLoading(100, "Unpacked interfaces!");
  15309.  
  15310. try {
  15311. for (int j6 = 0; j6 < 33; j6++) {
  15312. int k6 = 999;
  15313. int i7 = 0;
  15314.  
  15315. for (int k7 = 0; k7 < 34; k7++) {
  15316. if (mapBack.imgPixels[k7 + j6 * mapBack.imgWidth] == 0) {
  15317. if (k6 == 999) {
  15318. k6 = k7;
  15319. }
  15320.  
  15321. continue;
  15322. }
  15323.  
  15324. if (k6 == 999) {
  15325. continue;
  15326. }
  15327.  
  15328. i7 = k7;
  15329. break;
  15330. }
  15331.  
  15332. compassArray1[j6] = k6;
  15333. compassArray2[j6] = i7 - k6;
  15334. }
  15335.  
  15336. for (int l6 = 5; l6 < 156; l6++) {
  15337. int j7 = 999;
  15338. int l7 = 0;
  15339.  
  15340. for (int j8 = 20; j8 < 172; j8++) {
  15341. if (mapBack.imgPixels[j8 + l6 * mapBack.imgWidth] == 0 && (j8 > 34 || l6 > 34)) {
  15342. if (j7 == 999) {
  15343. j7 = j8;
  15344. }
  15345.  
  15346. continue;
  15347. }
  15348.  
  15349. if (j7 == 999) {
  15350. continue;
  15351. }
  15352.  
  15353. l7 = j8;
  15354. break;
  15355. }
  15356.  
  15357. mapImagePixelCutLeft[l6 - 5] = j7 - 20;
  15358. mapImagePixelCutRight[l6 - 5] = l7 - j7;
  15359.  
  15360. if (mapImagePixelCutRight[l6 - 5] == -20) {
  15361. mapImagePixelCutRight[l6 - 5] = 152;
  15362. }
  15363. }
  15364. } catch (Exception _ex) {
  15365. }
  15366.  
  15367. updateGameArea();
  15368. Censor.loadConfig(streamLoader_4);
  15369. mouseDetection = new MouseDetection(this);
  15370. startRunnable(mouseDetection, 10);
  15371. Animable_Sub5.clientInstance = this;
  15372. ObjectDefinition.clientInstance = this;
  15373. MobDefinition.clientInstance = this;
  15374. loadPlayerData();
  15375. isLoading = false;
  15376. if(Configuration.NEW_CURSORS) {
  15377. super.setCursor(CursorData.CURSOR_0);
  15378. }
  15379. return;
  15380. } catch (Exception exception) {
  15381. isLoading = false;
  15382. exception.printStackTrace();
  15383. Signlink.reportError("loaderror " + anInt1079);
  15384. }
  15385.  
  15386. loadingError = true;
  15387. }
  15388.  
  15389. public void dumpArchive(int archive) {
  15390. int[] ids = new int[] {};
  15391. for (int i : ids) {
  15392. try {
  15393. byte abyte[] = decompressors[archive].decompress(onDemandFetcher.getModelIndex(i));
  15394. File map = new File(Signlink.getCacheDirectory() + "/itemdata/" + onDemandFetcher.getModelIndex(i) + ".gz");
  15395. FileOutputStream fos = new FileOutputStream(map);
  15396. fos.write(abyte);
  15397. fos.close();
  15398. } catch (IOException e) {
  15399. e.printStackTrace();
  15400. }
  15401. }
  15402. }
  15403.  
  15404. private void stopMidi() {
  15405. // Signlink.midifade = 0;
  15406. // Signlink.midi = "stop";
  15407. }
  15408.  
  15409. private void tabToReplyPm() {
  15410. String name = null;
  15411.  
  15412. for (int k = 0; k < 100; k++) {
  15413. if (chatMessages[k] == null) {
  15414. continue;
  15415. }
  15416.  
  15417. int l = chatTypes[k];
  15418.  
  15419. if (l == 3 || l == 7) {
  15420. name = chatNames[k];
  15421. break;
  15422. }
  15423. }
  15424.  
  15425. if (name == null) {
  15426. pushMessage("You haven't received any messages to which you can reply.", 0, "");
  15427. return;
  15428. }
  15429.  
  15430. if (name != null) {
  15431. if (name.indexOf("@") == 0) {
  15432. int prefixSubstring = getPrefixSubstringLength(name);
  15433. name = name.substring(prefixSubstring);
  15434. }
  15435. }
  15436.  
  15437. long nameAsLong = TextClass.longForName(name.trim());
  15438.  
  15439. if (nameAsLong != -1) {
  15440. inputTaken = true;
  15441. inputDialogState = 0;
  15442. messagePromptRaised = true;
  15443. promptInput = "";
  15444. friendsListAction = 3;
  15445. aLong953 = nameAsLong;
  15446. promptMessage = "Enter message to send to " + TextClass.fixName(TextClass.nameForLong(nameAsLong));
  15447. }
  15448. }
  15449.  
  15450. private void updateScreen() {
  15451. gameAreaWidth = GameFrame.isFixed() ? 512 : getScreenWidth();
  15452. gameAreaHeight = GameFrame.isFixed() ? 334 : getScreenHeight();
  15453. if (gameScreenIP == null || gameScreenIP.anInt316 != gameAreaWidth || gameScreenIP.anInt317 != gameAreaHeight) {
  15454. gameScreenIP = new RSImageProducer(gameAreaWidth, gameAreaHeight, getGameComponent());
  15455. }
  15456. updateGameArea();
  15457. updateGraphics(false);
  15458. }
  15459.  
  15460. public void setResizing(boolean resizing) {
  15461. if (resizing) {
  15462. this.resizing = true;
  15463. (loggedIn ? gameScreenIP : titleScreenIP).initDrawingArea();
  15464. } else {
  15465. this.resizing = false;
  15466. (loggedIn ? gameScreenIP : titleScreenIP).drawGraphics(gameScreenDrawY, graphics, GameFrame.isFixed() ? 4 : gameScreenDrawX);
  15467. }
  15468. }
  15469.  
  15470. public void toggleSize(ScreenMode mode) {
  15471. if (GameFrame.getScreenMode() != mode) {
  15472. setResizing(true);
  15473. super.setClickMode2(0);
  15474. if (mode == ScreenMode.FIXED) {
  15475. GameFrame.setScreenMode(mode);
  15476. gameScreenDrawX = 4;
  15477. gameScreenDrawY = 4;
  15478. forceWidth = REGULAR_WIDTH;
  15479. forceHeight = REGULAR_HEIGHT;
  15480. clientWidth = REGULAR_WIDTH;
  15481. clientHeight = REGULAR_HEIGHT;
  15482. sendFrame36(652, 0);
  15483. recreateClientFrame(false, 765, 503, false, 1, false);
  15484. welcomeScreenRaised = true;
  15485. clientZoom = 0;
  15486. } else if (mode == ScreenMode.RESIZABLE) {
  15487. GameFrame.setScreenMode(mode);
  15488. gameScreenDrawX = 0;
  15489. gameScreenDrawY = 0;
  15490. forceWidth = forceHeight = -1;
  15491. sendFrame36(652, 2);
  15492. recreateClientFrame(false, RESIZABLE_WIDTH, RESIZABLE_HEIGHT, true, 0, true);
  15493. clientZoom = 480;
  15494. } else {
  15495. GameFrame.setScreenMode(ScreenMode.FULLSCREEN);
  15496. gameScreenDrawX = 0;
  15497. gameScreenDrawY = 0;
  15498. sendFrame36(652, 1);
  15499. Dimension size = Toolkit.getDefaultToolkit().getScreenSize();
  15500. clientWidth = size.width;
  15501. clientHeight = size.height;
  15502. recreateClientFrame(true, size.width, size.height, false, 0, true);
  15503. forceWidth = forceHeight = -1;
  15504. super.myWidth = size.width;
  15505. super.myHeight = size.height;
  15506. clientZoom = 480;
  15507. }
  15508. if (mode == ScreenMode.FIXED) {
  15509. inputTaken = true;
  15510. }
  15511. if (!loggedIn) {
  15512. resetImageProducers();
  15513. } else {
  15514. resetImageProducers2();
  15515. }
  15516. chatArea.setHideComponent(false);
  15517. tabArea.setHideComponent(false);
  15518. updateScreen();
  15519.  
  15520. setResizing(false);
  15521. }
  15522. }
  15523.  
  15524. private void unlinkMRUNodes() {
  15525. ObjectDefinition.mruNodes1.unlinkAll();
  15526. ObjectDefinition.mruNodes2.unlinkAll();
  15527. MobDefinition.mruNodes.unlinkAll();
  15528. ItemDefinition.mruNodes2.unlinkAll();
  15529. ItemDefinition.mruNodes1.unlinkAll();
  15530. Player.mruNodes.unlinkAll();
  15531. SpotAnimDefinition.list.unlinkAll();
  15532. }
  15533.  
  15534. private void updateConfig(int configId) {
  15535. try {
  15536. int j = 0;
  15537. if (configId < Varp.getCache().length)
  15538. j = Varp.getCache()[configId].getAnInt709();
  15539.  
  15540. if (j == 0)
  15541. return;
  15542.  
  15543. int k = variousSettings[configId];
  15544.  
  15545. if (j == 1) {
  15546. if (k == 1) {
  15547. Rasterizer.method372(0.90000000000000002D);
  15548. } else if (k == 2) {
  15549. Rasterizer.method372(0.80000000000000004D);
  15550. } else if (k == 3) {
  15551. Rasterizer.method372(0.69999999999999996D);
  15552. } else if (k == 4) {
  15553. Rasterizer.method372(0.59999999999999998D);
  15554. }
  15555.  
  15556. ItemDefinition.mruNodes1.unlinkAll();
  15557. welcomeScreenRaised = true;
  15558. } else if (j == 3) {
  15559. int volume = 0;
  15560.  
  15561. if (k == 0) {
  15562. volume = 255;
  15563. } else if (k == 1) {
  15564. volume = 192;
  15565. } else if (k == 2) {
  15566. volume = 128;
  15567. } else if (k == 3) {
  15568. volume = 64;
  15569. } else if (k == 4) {
  15570. volume = 0;
  15571. }
  15572.  
  15573. if (volume != musicVolume) {
  15574. if (musicVolume != 0 || currentSong == -1) {
  15575. if (volume != 0) {
  15576. setVolume(volume);
  15577. } else {
  15578. method55(false);
  15579. prevSong = 0;
  15580. }
  15581. } else {
  15582. method56(volume, false, currentSong);
  15583. prevSong = 0;
  15584. }
  15585.  
  15586. musicVolume = volume;
  15587. }
  15588. } else if (j == 4) {
  15589. if (k == 0) {
  15590. soundEffectVolume = 127;
  15591. } else if (k == 1) {
  15592. soundEffectVolume = 96;
  15593. } else if (k == 2) {
  15594. soundEffectVolume = 64;
  15595. } else if (k == 3) {
  15596. soundEffectVolume = 32;
  15597. } else if (k == 4) {
  15598. soundEffectVolume = 0;
  15599. }
  15600. } else if (j == 5) {
  15601. anInt1253 = k;
  15602. } else if (j == 6) {
  15603. anInt1249 = k;
  15604. } else if (j == 7) {
  15605. running = !running;
  15606. final boolean run = running;
  15607. mapArea.run.setOrbState(run);
  15608. } else if (j == 8) {
  15609. splitPrivateChat = k;
  15610. inputTaken = true;
  15611. } else if (j == 9) {
  15612. anInt913 = k;
  15613. }
  15614. } catch (Exception e) {
  15615. e.printStackTrace();
  15616. }
  15617. }
  15618.  
  15619. private void updateEntities() {
  15620. try {
  15621. int anInt974 = 0;
  15622. for (int j = -1; j < playerCount + npcCount; j++) {
  15623. Object obj;
  15624. if (j == -1) {
  15625. obj = myPlayer;
  15626. } else if (j < playerCount) {
  15627. obj = playerArray[playerIndices[j]];
  15628. } else {
  15629. obj = npcArray[npcIndices[j - playerCount]];
  15630. }
  15631. if (obj == null || !((Entity) obj).isVisible()) {
  15632. continue;
  15633. }
  15634. if (obj instanceof NPC) {
  15635. MobDefinition entityDef = ((NPC) obj).definitionOverride;
  15636. if (entityDef.childrenIDs != null) {
  15637. entityDef = entityDef.method161();
  15638. }
  15639. if (entityDef == null) {
  15640. continue;
  15641. }
  15642. }
  15643. if (j < playerCount) {
  15644. int l = Configuration.DISPLAY_HP_ABOVE_HEAD || Configuration.DISPLAY_USERNAMES_ABOVE_HEAD ? 42 : 32;
  15645. if (Configuration.DISPLAY_HP_ABOVE_HEAD) {
  15646. l += 20;
  15647. }
  15648. if (Configuration.DISPLAY_USERNAMES_ABOVE_HEAD) {
  15649. l += 10;
  15650. }
  15651. Player player = (Player) obj;
  15652. if (player.headIcon >= 0) {
  15653. npcScreenPos((Entity) obj, ((Entity) obj).height + 15);
  15654. if (spriteDrawX > -1) {
  15655. if (player.skulled) {
  15656. l += 2;
  15657. skullIcons[0].drawSprite(spriteDrawX - 12, spriteDrawY - l);
  15658. l += 19;
  15659. }
  15660. if (player.bountyHunterIcon >= 0 && player.bountyHunterIcon <= 4) {
  15661. cacheSprite[1026 + player.bountyHunterIcon].drawSprite(spriteDrawX - (player.skulled ? 8 : 10), spriteDrawY - l);
  15662. l += 28;
  15663. }
  15664. if (player.headIcon < 20) {
  15665. headIcons[player.headIcon].drawSprite(spriteDrawX - 12, spriteDrawY - l);
  15666. l += 29;
  15667. }
  15668. if (Configuration.DISPLAY_USERNAMES_ABOVE_HEAD) {
  15669. newSmallFont.drawCenteredString("{" + (player.name != null ? player.name : "null username") + "}", spriteDrawX, spriteDrawY - 10, 0x15FF00, 0x000000);
  15670. }
  15671. }
  15672. }
  15673. if (j >= 0 && anInt855 == 10 && anInt933 == playerIndices[j]) {
  15674. npcScreenPos((Entity) obj, ((Entity) obj).height + 15);
  15675. if (spriteDrawX > -1) {
  15676. headIcons[7].drawSprite(spriteDrawX - 12, spriteDrawY - l);
  15677. }
  15678. }
  15679. } else {
  15680. MobDefinition entityDef_1 = ((NPC) obj).definitionOverride;
  15681. if (entityDef_1.headIcon >= 0 && entityDef_1.headIcon < headIcons.length) {
  15682. npcScreenPos((Entity) obj, ((Entity) obj).height + 15);
  15683. if (spriteDrawX > -1) {
  15684. headIcons[entityDef_1.headIcon].drawSprite(spriteDrawX - 12, spriteDrawY - 30);
  15685. }
  15686. }
  15687. if (anInt855 == 1 && anInt1222 == npcIndices[j - playerCount] && loopCycle % 20 < 10) {
  15688. npcScreenPos((Entity) obj, ((Entity) obj).height + 15);
  15689. if (spriteDrawX > -1) {
  15690. headIcons[2].drawSprite(spriteDrawX - 12, spriteDrawY - 28);
  15691. }
  15692. }
  15693. }
  15694. if (((Entity) obj).textSpoken != null && (j >= playerCount || publicChatMode == 0 || publicChatMode == 3 || publicChatMode == 1 && isFriendOrSelf(((Player) obj).name))) {
  15695. npcScreenPos((Entity) obj, ((Entity) obj).height);
  15696. if (spriteDrawX > -1 && anInt974 < anInt975) {
  15697. anIntArray979[anInt974] = chatTextDrawingArea.method384(((Entity) obj).textSpoken) / 2;
  15698. anIntArray978[anInt974] = chatTextDrawingArea.anInt1497;
  15699. anIntArray976[anInt974] = spriteDrawX;
  15700. anIntArray977[anInt974] = spriteDrawY;
  15701. anIntArray980[anInt974] = ((Entity) obj).anInt1513;
  15702. anIntArray981[anInt974] = ((Entity) obj).anInt1531;
  15703. anIntArray982[anInt974] = ((Entity) obj).textCycle;
  15704. aStringArray983[anInt974++] = ((Entity) obj).textSpoken;
  15705. if (anInt1249 == 0 && ((Entity) obj).anInt1531 >= 1 && ((Entity) obj).anInt1531 <= 3) {
  15706. anIntArray978[anInt974] += 10;
  15707. anIntArray977[anInt974] += 5;
  15708. }
  15709. if (anInt1249 == 0 && ((Entity) obj).anInt1531 == 4) {
  15710. anIntArray979[anInt974] = 60;
  15711. }
  15712. if (anInt1249 == 0 && ((Entity) obj).anInt1531 == 5) {
  15713. anIntArray978[anInt974] += 5;
  15714. }
  15715. }
  15716. }
  15717. if (((Entity) obj).loopCycleStatus > loopCycle) {
  15718.  
  15719. try {
  15720. npcScreenPos((Entity) obj, ((Entity) obj).height + 15);
  15721. if (spriteDrawX > -1) {
  15722. if (Configuration.NEW_HEALTH_BARS) {
  15723. int currentHealth = ((Entity) obj).currentHealth;
  15724. int maxHealth = ((Entity) obj).maxHealth;
  15725. if(maxHealth > 0) {
  15726. if(((Entity) obj) instanceof Player) {
  15727. currentHealth = currentHealth / 10;
  15728. maxHealth = maxHealth / 10;
  15729. }
  15730. }
  15731. int i1 = (currentHealth * 30 / maxHealth);
  15732. if (i1 > 30) {
  15733. i1 = 30;
  15734. }
  15735. int hpPercent = (currentHealth * 90 / maxHealth);
  15736. if (hpPercent > 90) {
  15737. hpPercent = 90;
  15738. }
  15739. int HpPercent = (currentHealth * 56 / maxHealth);
  15740. if (HpPercent > 56) {
  15741. HpPercent = 56;
  15742. }
  15743. if (maxHealth >= 2000) {
  15744. cacheSprite[396].drawSprite(spriteDrawX - 44, spriteDrawY - 5);
  15745. Sprite HPBarFull = new Sprite(SpriteLoader.cache[397].spriteData, hpPercent, 7, 1);
  15746. HPBarFull.drawSprite(spriteDrawX - 44, spriteDrawY - 5);
  15747. HPBarFull = null;
  15748. } else {
  15749. cacheSprite[349].drawSprite(spriteDrawX - 28, spriteDrawY - 5);
  15750. Sprite HPBarFull = new Sprite(SpriteLoader.cache[348].spriteData, HpPercent, 7, 1);
  15751. HPBarFull.drawSprite(spriteDrawX - 28, spriteDrawY - 5);
  15752. HPBarFull = null;
  15753. }
  15754. } else {
  15755.  
  15756. int i1 = ((Entity) obj).currentHealth * 30 / ((Entity) obj).maxHealth;
  15757. if (i1 > 30) {
  15758. i1 = 30;
  15759. }
  15760. DrawingArea.drawPixels(5, spriteDrawY - 3, spriteDrawX - 15, 65280, i1);
  15761. DrawingArea.drawPixels(5, spriteDrawY - 3, spriteDrawX - 15 + i1, 0xff0000, 30 - i1);
  15762. }
  15763. if (Configuration.DISPLAY_HP_ABOVE_HEAD && obj instanceof Player) {
  15764. Entity o = (Entity) obj;
  15765. double currentHitpoints = o.currentHealth;
  15766. double maxHitpoints = o.maxHealth;
  15767. double percentage = (int) (currentHitpoints / maxHitpoints * 100);
  15768. int color = calculateHitpointsColor((int) Math.round(percentage));
  15769. newRegularFont.drawCenteredString(new StringBuilder().append((int) currentHitpoints).append("/").append((int) maxHitpoints).toString(), spriteDrawX, spriteDrawY - 22, color, 0x000000);
  15770. }
  15771. }
  15772. } catch (Exception e) {
  15773. }
  15774. }
  15775. /**
  15776. * Hitmarks
  15777. */
  15778. for (int j1 = 0; j1 < 4; j1++) {
  15779. if (((Entity) obj).hitsLoopCycle[j1] > loopCycle) {
  15780. Entity entity = (Entity) obj;
  15781. npcScreenPos(entity, entity.height / 2);
  15782.  
  15783. if(!Configuration.NEW_HITMARKS) {
  15784.  
  15785. hitmarkDrawOld(spriteDrawX, spriteDrawY, j1, entity);
  15786.  
  15787.  
  15788. } else {
  15789.  
  15790.  
  15791. if (entity.moveTimer[j1] == 0) {
  15792. if (entity.hitmarkMove[j1] > -14)
  15793. entity.hitmarkMove[j1]--;
  15794. entity.moveTimer[j1] = 2;
  15795. } else {
  15796. entity.moveTimer[j1]--;
  15797. }
  15798. if (entity.hitmarkMove[j1] <= -14)
  15799. entity.hitmarkTrans[j1] -= 10;
  15800. hitmarkDrawNew(entity, String.valueOf(entity.hitArray[j1]).length(), entity.hitMarkTypes[j1],
  15801. entity.hitIcon[j1], entity.hitArray[j1],
  15802. entity.soakDamage[j1], entity.hitmarkMove[j1],
  15803. entity.hitmarkTrans[j1], j1);
  15804. }
  15805.  
  15806.  
  15807. }
  15808. }
  15809. }
  15810.  
  15811. for (int k = 0; k < anInt974; k++) {
  15812. int k1 = anIntArray976[k];
  15813. int l1 = anIntArray977[k];
  15814. int j2 = anIntArray979[k];
  15815. int k2 = anIntArray978[k];
  15816. boolean flag = true;
  15817.  
  15818. while (flag) {
  15819. flag = false;
  15820.  
  15821. for (int l2 = 0; l2 < k; l2++) {
  15822. if (l1 + 2 > anIntArray977[l2] - anIntArray978[l2] && l1 - k2 < anIntArray977[l2] + 2 && k1 - j2 < anIntArray976[l2] + anIntArray979[l2] && k1 + j2 > anIntArray976[l2] - anIntArray979[l2] && anIntArray977[l2] - anIntArray978[l2] < l1) {
  15823. l1 = anIntArray977[l2] - anIntArray978[l2];
  15824. flag = true;
  15825. }
  15826. }
  15827. }
  15828.  
  15829. spriteDrawX = anIntArray976[k];
  15830. spriteDrawY = anIntArray977[k] = l1;
  15831. String s = aStringArray983[k];
  15832.  
  15833. if (anInt1249 == 0) {
  15834. int i3 = 0xffff00;
  15835.  
  15836. if (anIntArray980[k] < 6) {
  15837. i3 = anIntArray965[anIntArray980[k]];
  15838. }
  15839.  
  15840. if (anIntArray980[k] == 6) {
  15841. i3 = anInt1265 % 20 >= 10 ? 0xffff00 : 0xff0000;
  15842. }
  15843.  
  15844. if (anIntArray980[k] == 7) {
  15845. i3 = anInt1265 % 20 >= 10 ? 65535 : 255;
  15846. }
  15847.  
  15848. if (anIntArray980[k] == 8) {
  15849. i3 = anInt1265 % 20 >= 10 ? 0x80ff80 : 45056;
  15850. }
  15851.  
  15852. if (anIntArray980[k] == 9) {
  15853. int j3 = 150 - anIntArray982[k];
  15854.  
  15855. if (j3 < 50) {
  15856. i3 = 0xff0000 + 1280 * j3;
  15857. } else if (j3 < 100) {
  15858. i3 = 0xffff00 - 0x50000 * (j3 - 50);
  15859. } else if (j3 < 150) {
  15860. i3 = 65280 + 5 * (j3 - 100);
  15861. }
  15862. }
  15863.  
  15864. if (anIntArray980[k] == 10) {
  15865. int k3 = 150 - anIntArray982[k];
  15866.  
  15867. if (k3 < 50) {
  15868. i3 = 0xff0000 + 5 * k3;
  15869. } else if (k3 < 100) {
  15870. i3 = 0xff00ff - 0x50000 * (k3 - 50);
  15871. } else if (k3 < 150) {
  15872. i3 = 255 + 0x50000 * (k3 - 100) - 5 * (k3 - 100);
  15873. }
  15874. }
  15875.  
  15876. if (anIntArray980[k] == 11) {
  15877. int l3 = 150 - anIntArray982[k];
  15878.  
  15879. if (l3 < 50) {
  15880. i3 = 0xffffff - 0x50005 * l3;
  15881. } else if (l3 < 100) {
  15882. i3 = 65280 + 0x50005 * (l3 - 50);
  15883. } else if (l3 < 150) {
  15884. i3 = 0xffffff - 0x50000 * (l3 - 100);
  15885. }
  15886. }
  15887.  
  15888. if (anIntArray981[k] == 0) {
  15889. chatTextDrawingArea.drawText(0, s, spriteDrawY + 1, spriteDrawX + 1);
  15890. chatTextDrawingArea.drawText(i3, s, spriteDrawY, spriteDrawX);
  15891. }
  15892.  
  15893. if (anIntArray981[k] == 1) {
  15894. chatTextDrawingArea.method386(0, s, spriteDrawX + 1, anInt1265, spriteDrawY + 1);
  15895. chatTextDrawingArea.method386(i3, s, spriteDrawX, anInt1265, spriteDrawY);
  15896. }
  15897.  
  15898. if (anIntArray981[k] == 2) {
  15899. chatTextDrawingArea.method387(spriteDrawX + 1, s, anInt1265, spriteDrawY + 1, 0);
  15900. chatTextDrawingArea.method387(spriteDrawX, s, anInt1265, spriteDrawY, i3);
  15901. }
  15902.  
  15903. if (anIntArray981[k] == 3) {
  15904. chatTextDrawingArea.method388(150 - anIntArray982[k], s, anInt1265, spriteDrawY + 1, spriteDrawX + 1, 0);
  15905. chatTextDrawingArea.method388(150 - anIntArray982[k], s, anInt1265, spriteDrawY, spriteDrawX, i3);
  15906. }
  15907.  
  15908. if (anIntArray981[k] == 4) {
  15909. int i4 = chatTextDrawingArea.method384(s);
  15910. int k4 = (150 - anIntArray982[k]) * (i4 + 100) / 150;
  15911. DrawingArea.setBounds(spriteDrawX - 50, 0, spriteDrawX + 50, 334);
  15912. chatTextDrawingArea.method385(0, s, spriteDrawY + 1, spriteDrawX + 51 - k4);
  15913. chatTextDrawingArea.method385(i3, s, spriteDrawY, spriteDrawX + 50 - k4);
  15914. DrawingArea.defaultDrawingAreaSize();
  15915. }
  15916.  
  15917. if (anIntArray981[k] == 5) {
  15918. int j4 = 150 - anIntArray982[k];
  15919. int l4 = 0;
  15920.  
  15921. if (j4 < 25) {
  15922. l4 = j4 - 25;
  15923. } else if (j4 > 125) {
  15924. l4 = j4 - 125;
  15925. }
  15926.  
  15927. DrawingArea.setBounds(0, spriteDrawY - chatTextDrawingArea.anInt1497 - 1, 512, spriteDrawY + 5);
  15928. chatTextDrawingArea.drawText(0, s, spriteDrawY + 1 + l4, spriteDrawX + 1);
  15929. chatTextDrawingArea.drawText(i3, s, spriteDrawY + l4, spriteDrawX);
  15930. DrawingArea.defaultDrawingAreaSize();
  15931. }
  15932. } else {
  15933. chatTextDrawingArea.drawText(0, s, spriteDrawY + 1, spriteDrawX + 1);
  15934. chatTextDrawingArea.drawText(0xffff00, s, spriteDrawY, spriteDrawX);
  15935. }
  15936. }
  15937. } catch (Exception e) {
  15938. }
  15939. }
  15940.  
  15941. private int calculateHitpointsColor(int percentage) {
  15942. int[] colorArray = new int[] { 0x01DF01, 0x3ADF00, 0x74DF00, 0xA5DF00,
  15943. 0xD7DF01, 0xDBA901, 0xDF7401, 0xDF3A01, 0xFA5858, 0xFE2E2E,
  15944. 0xDF0101, };
  15945. int color = colorArray[0];
  15946. for (int i = 0; i < colorArray.length; i++) {
  15947. if (percentage >= 100 - i * 10) {
  15948. color = colorArray[i];
  15949. break;
  15950. }
  15951. }
  15952. return color;
  15953. }
  15954.  
  15955. public void updateGameArea() {
  15956. try {
  15957. Rasterizer.setBounds(getScreenWidth(), getScreenHeight());
  15958. fullScreenTextureArray = Rasterizer.lineOffsets;
  15959. Rasterizer.setBounds(GameFrame.getScreenMode() == ScreenMode.FIXED && isGameFrameVisible() ? chatAreaIP != null ? chatAreaIP.anInt316 : 519 : getScreenWidth(), GameFrame.getScreenMode() == ScreenMode.FIXED && isGameFrameVisible() ? chatAreaIP != null ? chatAreaIP.anInt317 : 165 : getScreenHeight());
  15960. anIntArray1180 = Rasterizer.lineOffsets;
  15961. Rasterizer.setBounds(GameFrame.getScreenMode() == ScreenMode.FIXED && isGameFrameVisible() ? tabAreaIP != null ? tabAreaIP.anInt316 : 346 : getScreenWidth(), GameFrame.getScreenMode() == ScreenMode.FIXED && isGameFrameVisible() ? tabAreaIP != null ? tabAreaIP.anInt317 : 335 : getScreenHeight());
  15962. anIntArray1181 = Rasterizer.lineOffsets;
  15963. Rasterizer.setBounds(gameAreaWidth, gameAreaHeight);
  15964. anIntArray1182 = Rasterizer.lineOffsets;
  15965. int ai[] = new int[9];
  15966.  
  15967. for (int i8 = 0; i8 < 9; i8++) {
  15968. int k8 = 128 + i8 * 32 + 15;
  15969. int l8 = 600 + k8 * 3;
  15970. int i9 = Rasterizer.SINE[k8];
  15971. ai[i8] = l8 * i9 >> 16;
  15972. }
  15973.  
  15974. WorldController.method310(500, 800, !loggedIn ? getScreenWidth() : gameAreaWidth, !loggedIn ? getScreenHeight() : gameAreaHeight, ai);
  15975.  
  15976. if (loggedIn) {
  15977. gameScreenIP = new RSImageProducer(gameAreaWidth, gameAreaHeight, getGameComponent());
  15978. } else {
  15979. titleScreenIP = new RSImageProducer(getScreenWidth(), getScreenHeight(), getGameComponent());
  15980. }
  15981. updateGraphics(true);
  15982. } catch (Exception e) {
  15983. e.printStackTrace();
  15984. }
  15985. }
  15986.  
  15987. private void updateNPCs(ByteBuffer buffer, int i) {
  15988. anInt839 = 0;
  15989. anInt893 = 0;
  15990. updateNpcAmount(buffer);
  15991. updateNpcMovement(i, buffer);
  15992. readNPCUpdateMask(buffer);
  15993.  
  15994. for (int k = 0; k < anInt839; k++) {
  15995. int l = anIntArray840[k];
  15996.  
  15997. if (npcArray[l].anInt1537 != loopCycle) {
  15998. npcArray[l].definitionOverride = null;
  15999. npcArray[l] = null;
  16000. }
  16001. }
  16002.  
  16003. if (buffer.position != i) {
  16004. Signlink.reportError(myUsername + " size mismatch in getnpcpos - pos:" + buffer.position + " psize:" + i);
  16005. throw new RuntimeException("eek");
  16006. }
  16007.  
  16008. for (int i1 = 0; i1 < npcCount; i1++) {
  16009. if (npcArray[npcIndices[i1]] == null) {
  16010. Signlink.reportError(myUsername + " null entry in npc list - pos:" + i1 + " size:" + npcCount);
  16011. throw new RuntimeException("eek");
  16012. }
  16013. }
  16014. }
  16015.  
  16016. private void updatePlayers(int i, ByteBuffer buffer) {
  16017. anInt839 = 0;
  16018. anInt893 = 0;
  16019. updatePlayerMovement(buffer);
  16020. updatePlayer(buffer);
  16021. updatePlayerMovement(buffer, i);
  16022. processPlayerUpdating(buffer);
  16023.  
  16024. for (int k = 0; k < anInt839; k++) {
  16025. int l = anIntArray840[k];
  16026.  
  16027. if (playerArray[l].anInt1537 != loopCycle) {
  16028. playerArray[l] = null;
  16029. }
  16030. }
  16031.  
  16032. if (buffer.position != i) {
  16033. Signlink.reportError("Error packet size mismatch in getplayer pos:" + buffer.position + " psize:" + i);
  16034. throw new RuntimeException("eek");
  16035. }
  16036.  
  16037. for (int i1 = 0; i1 < playerCount; i1++) {
  16038. if (playerArray[playerIndices[i1]] == null) {
  16039. Signlink.reportError(myUsername + " null entry in pl list - pos:" + i1 + " size:" + playerCount);
  16040. throw new RuntimeException("eek");
  16041. }
  16042. }
  16043.  
  16044. }
  16045.  
  16046. private void handleQuickAidsActive() {
  16047. int toggle = -1;
  16048. if(prayerInterfaceType == 5608) {
  16049. if(getQuickPrayersSet() > 0) {
  16050. if(!mapArea.prayer.getOrbState()) {
  16051. for(int i = 0; i < quickPrayers.length; i++) {
  16052. int button = i == 26 ? 18018 : i == 27 ? 18025 : (i * 2) + 25000;
  16053. RSInterface rsInterface = RSInterface.interfaceCache[button];
  16054. if(rsInterface.valueIndexArray != null && rsInterface.valueIndexArray[0][0] == 5) {
  16055. toggle = rsInterface.valueIndexArray[0][1];
  16056. if(variousSettings[toggle] == 0 && quickPrayers[i] == 1) {
  16057. getOut().putOpcode(185);
  16058. getOut().putShort(button);
  16059. mapArea.prayer.setOrbState(true);
  16060. } else if(quickPrayers[i] == 1 && variousSettings[toggle] == 1) {
  16061. mapArea.prayer.setOrbState(true);
  16062. }
  16063. }
  16064. }
  16065. } else {
  16066. turnOffPrayers();
  16067. mapArea.prayer.setOrbState(false);
  16068. }
  16069. } else {
  16070. if(mapArea.prayer.getOrbState()) {
  16071. turnOffPrayers();
  16072. } else {
  16073. pushMessage("You don't have any quick prayers selected.", 0, "");
  16074. pushMessage("Right-click the Prayer button next to the minimap to select some.", 0, "");
  16075. }
  16076. mapArea.prayer.setOrbState(false);
  16077. }
  16078. } else if(prayerInterfaceType == 32500) {
  16079. if(getQuickCursesSet() > 0) {
  16080. if(!mapArea.prayer.getOrbState()) {
  16081. for(int i = 0; i < quickCurses.length; i++) {
  16082. int button = (i * 2) + 32500 + 3;
  16083. RSInterface rsInterface = RSInterface.interfaceCache[button];
  16084. if(rsInterface.valueIndexArray != null && rsInterface.valueIndexArray[0][0] == 5) {
  16085. toggle = rsInterface.valueIndexArray[0][1];
  16086. if(variousSettings[toggle] == 0 && quickCurses[i] == 1) {
  16087. getOut().putOpcode(185);
  16088. getOut().putShort(button);
  16089. mapArea.prayer.setOrbState(true);
  16090. }
  16091. } else if(quickCurses[i] == 1 && variousSettings[toggle] == 1) {
  16092. mapArea.prayer.setOrbState(true);
  16093. }
  16094. }
  16095. } else {
  16096. turnOffCurses();
  16097. mapArea.prayer.setOrbState(false);
  16098. }
  16099. } else {
  16100. if(mapArea.prayer.getOrbState()) {
  16101. turnOffCurses();
  16102. mapArea.prayer.setOrbState(false);
  16103. } else {
  16104. pushMessage("You don't have any quick curses selected.", 0, "");
  16105. pushMessage("Right-click the Curses button next to the minimap to select some.", 0, "");
  16106. }
  16107. }
  16108. }
  16109. }
  16110.  
  16111. private int getQuickPrayersSet() {
  16112. int amount = 0;
  16113. for(int i = 0; i < quickPrayers.length; i++)
  16114. if(quickPrayers[i] == 1) {
  16115. amount++;
  16116. }
  16117. return amount;
  16118. }
  16119.  
  16120. private int getQuickCursesSet() {
  16121. int amount = 0;
  16122. for(int i = 0; i < quickCurses.length; i++)
  16123. if(quickCurses[i] == 1) {
  16124. amount++;
  16125. }
  16126. return amount;
  16127. }
  16128.  
  16129. private int[] quickPrayers = new int[28];
  16130. private int[] quickCurses = new int[20];
  16131.  
  16132. private int[] getCurseTypeForIndex(int index) {
  16133. int[] types = null;
  16134. for(int g = 0; g < leechCurse.length; g++) {
  16135. if(index == leechCurse[g])
  16136. types = sapCurse;
  16137. }
  16138. for(int g = 0; g < sapCurse.length; g++) {
  16139. if(index == sapCurse[g])
  16140. types = leechCurse;
  16141. }
  16142. for(int g = 0; g < deflectCurse.length; g++) {
  16143. if(index == deflectCurse[g])
  16144. types = deflectCurse;
  16145. }
  16146. if(index == 6) {
  16147. int[] type = {17,18};
  16148. types = type;
  16149. }
  16150. if(index == 17 || index == 18) {
  16151. int[] type = {6,7,8,9,17,18};
  16152. types = type;
  16153. }
  16154. if(index == 19) {
  16155. int[] turmoilCurseOff = {1,2,3,4,10,11,12,13,14,15,16,19};
  16156. types = turmoilCurseOff;
  16157. }
  16158. return types;
  16159. }
  16160.  
  16161. public void togglePrayerState(int button) {
  16162. int index = button == 17279 ? 26 : button == 17280 ? 27 : button - 17202;
  16163. if(prayerInterfaceType == 5608) {
  16164. if((maxStats[5] / 10) >= prayerLevelRequirements[index]) {
  16165. int[] types = getPrayerTypeForIndex(index);
  16166. if(types != null) {
  16167. for(int g = 0; g < rangeAndMagePray.length; g++) {
  16168. if(index == rangeAndMagePray[g]) {
  16169. types = rangeAndMagePrayOff;
  16170. }
  16171. }
  16172. for(int i = 0; i < types.length; i++) {
  16173. if(index != types[i]) {
  16174. if(index == 24 || index == 25) {
  16175. types = superiorPray;
  16176. }
  16177. quickPrayers[types[i]] = 0;
  16178. variousSettings[quickConfigIDs[types[i]]] = 0;
  16179. updateConfig(quickConfigIDs[types[i]]);
  16180. if(dialogID != -1)
  16181. inputTaken = true;
  16182. } else {
  16183. quickPrayers[index] = (quickPrayers[index] + 1) % 2;
  16184. variousSettings[quickConfigIDs[index]] = quickPrayers[index];
  16185. updateConfig(quickConfigIDs[index]);
  16186. if(dialogID != -1)
  16187. inputTaken = true;
  16188. }
  16189. }
  16190. } else {
  16191. quickPrayers[index] = (quickPrayers[index] + 1) % 2;
  16192. variousSettings[quickConfigIDs[index]] = quickPrayers[index];
  16193. updateConfig(quickConfigIDs[index]);
  16194. if(dialogID != -1)
  16195. inputTaken = true;
  16196. }
  16197. } else {
  16198. pushMessage("You need a Prayer level of atleast " + prayerLevelRequirements[index] + " to use " + prayerName[index] + ".", 0, "");
  16199. }
  16200. } else if(prayerInterfaceType == 32500) {
  16201. if((maxStats[5] / 10) >= curseLevelRequirements[index]) {
  16202. int[] types = getCurseTypeForIndex(index);
  16203. if(types != null) {
  16204. for(int i = 0; i < types.length; i++) {
  16205. if(index != types[i]) {
  16206. quickCurses[types[i]] = 0;
  16207. variousSettings[quickConfigIDs[types[i]]] = 0;
  16208. updateConfig(quickConfigIDs[types[i]]);
  16209. if(dialogID != -1)
  16210. inputTaken = true;
  16211. }
  16212. }
  16213. }
  16214. quickCurses[index] = (quickCurses[index] + 1) % 2;
  16215. variousSettings[quickConfigIDs[index]] = quickCurses[index];
  16216. updateConfig(quickConfigIDs[index]);
  16217. if(dialogID != -1)
  16218. inputTaken = true;
  16219. } else {
  16220. pushMessage("You need a Prayer level of atleast " + curseLevelRequirements[index] + " to use " + curseName[index] + ".", 0, "");
  16221. }
  16222. }
  16223. }
  16224.  
  16225. private void turnOffPrayers() {
  16226. int toggle = -1;
  16227. for(int i = 0; i < quickPrayers.length; i++) {
  16228. int x = i == 26 ? 18018 : i == 27 ? 18025 : (i * 2) + 25000;;
  16229. RSInterface rsInterface = RSInterface.interfaceCache[x];
  16230. if(rsInterface.valueIndexArray != null && rsInterface.valueIndexArray[0][0] == 5) {
  16231. toggle = rsInterface.valueIndexArray[0][1];
  16232. if(variousSettings[toggle] == 1 && quickPrayers[i] == 1) {
  16233. getOut().putOpcode(185);
  16234. getOut().putShort(x);
  16235. }
  16236. }
  16237. }
  16238. }
  16239.  
  16240. private void turnOffCurses() {
  16241. int toggle = -1;
  16242. for(int i = 0; i < quickCurses.length; i++) {
  16243. RSInterface rsInterface = RSInterface.interfaceCache[(i * 2) + 32503];
  16244. if(rsInterface.valueIndexArray != null && rsInterface.valueIndexArray[0][0] == 5) {
  16245. toggle = rsInterface.valueIndexArray[0][1];
  16246. if(variousSettings[toggle] == 1 && quickCurses[i] == 1) {
  16247. getOut().putOpcode(185);
  16248. getOut().putShort((i * 2) + 32503);
  16249. }
  16250. }
  16251. }
  16252. }
  16253.  
  16254. public int prayerInterfaceType;
  16255. public final int[] curseLevelRequirements = {50,50,52,54,56,59,62,65,68,71,74,76,78,80,82,84,86,89,92,95};
  16256. public final String[] curseName = {
  16257. "Protect Item", "Sap Warrior", "Sap Ranger", "Sap Mage", "Sap Spirit",
  16258. "Berserker", "Deflect Summoning", "Deflect Magic","Deflect Missiles", "Deflect Melee",
  16259. "Leech Attack", "Leech Ranged", "Leech Magic", "Leech Defence", "Leech Strength",
  16260. "Leech Energy", "Leech Special Attack", "Wrath", "Soul Split", "Turmoil"
  16261. };
  16262. public int[] quickConfigIDs = {630,631,632,633,634,635,636,637,638,639,640,641,642,643,644,645,646,647,648,649,650,651,652,653,654,655,658, 659};
  16263. public final int[] prayerLevelRequirements = {1,4,7,8,9,10,13,16,19,22,25,26,27,28,31,34,37,40,43,44,45,46,49,52,60,70, 80, 80};
  16264. public final String[] prayerName = {
  16265. "Thick Skin", "Burst of Strength", "Clarity of Thought", "Sharp Eye", "Mystic Will", "Rock Skin", "Superhuman Strength", "Improved Reflexes","Rapid Restore",
  16266. "Rapid Heal", "Protect Item", "Hawk Eye", "Mystic Lore", "Steel Skin", "Ultimate Strength", "Incredible Reflexes","Protect from Magic", "Protect from Missiles",
  16267. "Protect from Melee","Eagle Eye", "Mystic Might", "Retribution", "Redemption", "Smite", "Chivalry", "Piety", "Rigour", "Augury"
  16268. };
  16269. private int[] defPray = {0,5,13,24,25, 26, 27};
  16270. private int[] strPray = {1,3,4,6,11,12,14,19,20,24,25, 26, 27};
  16271. private int[] atkPray = {2,3,4,7,11,12,15,19,20,24,25, 26, 27};
  16272. private int[] rangeAndMagePray = {3,4,11,12,19,20,24,25, 26, 27};
  16273. private int[] rangeAndMagePrayOff = {1,2,3,4,6,7,11,12,14,15,19,20,24,25, 26, 27};
  16274. private int[] headPray = {16,17,18,21,22,23};
  16275. private int[] superiorPray = {0,1,2,3,4,5,6,7,11,12,13,14,15,19,20,24,25, 26, 27};
  16276. private int[][] prayer = {defPray,strPray,atkPray,rangeAndMagePray,headPray};
  16277.  
  16278. private int[] getPrayerTypeForIndex(int index) {
  16279. int[] type = null;
  16280. for(int i = 0; i < prayer.length; i++) {
  16281. for(int il = 0; il < prayer[i].length; il++) {
  16282. if(index == prayer[i][il]) {
  16283. type = prayer[i];
  16284. }
  16285. }
  16286. }
  16287. return type;
  16288. }
  16289.  
  16290. private int[] sapCurse = {1,2,3,4,19};
  16291. private int[] leechCurse = {10,11,12,13,14,15,16,19};
  16292. private int[] deflectCurse = {7,8,9,17,18};
  16293.  
  16294. private void saveQuickSelection() {
  16295. savePlayerData();
  16296. tabInterfaceIDs[5] = prayerInterfaceType;
  16297. }
  16298.  
  16299. public void toggleQuickAidsSelection() {
  16300. boolean inProcess = (tabInterfaceIDs[5] == 17200 || tabInterfaceIDs[5] == 17234);
  16301. if(inProcess)
  16302. saveQuickSelection();
  16303. else {
  16304. if(prayerInterfaceType == 5608) {
  16305. if(!inProcess) {
  16306. tabInterfaceIDs[5] = 17200;
  16307. tabAreaAltered = true;
  16308. } else {
  16309. tabInterfaceIDs[5] = 5608;
  16310. tabAreaAltered = true;
  16311. }
  16312. } else if(prayerInterfaceType == 32500) {
  16313. if(!inProcess) {
  16314. tabInterfaceIDs[5] = 17234;
  16315. tabAreaAltered = true;
  16316. } else {
  16317. tabInterfaceIDs[5] = 32500;
  16318. tabAreaAltered = true;
  16319. }
  16320. }
  16321. tabID = 5;
  16322. }
  16323. }
  16324. private void saveGoals(String name) {
  16325. try {
  16326. File file = new File(Signlink.getCacheDirectory().toString() + "/" + name.trim().toLowerCase() + ".goals");
  16327. DataOutputStream out = new DataOutputStream(new FileOutputStream(file));
  16328. for (int index = 0; index < Skills.goalData.length; index++) {
  16329. out.writeInt(Skills.goalData[index][0]);
  16330. out.writeInt(Skills.goalData[index][1]);
  16331. out.writeInt(Skills.goalData[index][2]);
  16332. out.writeUTF(Skills.goalType);
  16333. }
  16334. out.close();
  16335. } catch (Exception e) {
  16336. e.printStackTrace();
  16337. }
  16338. }
  16339.  
  16340. public static void loadGoals(String name) {
  16341. try {
  16342. File file = new File(Signlink.getCacheDirectory().toString() + "/" + name.trim().toLowerCase() + ".goals");
  16343. if (!file.exists()) {
  16344. for (int index = 0; index < Skills.goalData.length; index++) {
  16345. Skills.goalData[index][0] = -1;
  16346. Skills.goalData[index][1] = -1;
  16347. Skills.goalData[index][2] = -1;
  16348. }
  16349. return;
  16350. }
  16351. DataInputStream in = new DataInputStream(new FileInputStream(file));
  16352. for (int index = 0; index < Skills.goalData.length; index++) {
  16353. Skills.goalData[index][0] = in.readInt();
  16354. Skills.goalData[index][1] = in.readInt();
  16355. Skills.goalData[index][2] = in.readInt();
  16356. Skills.goalType = in.readUTF();
  16357. }
  16358. in.close();
  16359. } catch (Exception e) {
  16360. e.printStackTrace();
  16361. }
  16362. }
  16363.  
  16364. public static int getRandom(int number, boolean greaterThan0) {
  16365. Random random = new Random();
  16366. int randomNr = random.nextInt(number) + (greaterThan0 ? 1 : 0);
  16367. return randomNr;
  16368. }
  16369.  
  16370. private void updateStrings(String str, int i) {
  16371. switch (i) {
  16372. case 1675:
  16373. setInterfaceText(str, 17508);
  16374. break;// Stab
  16375.  
  16376. case 1676:
  16377. setInterfaceText(str, 17509);
  16378. break;// Slash
  16379.  
  16380. case 1677:
  16381. setInterfaceText(str, 17510);
  16382. break;// Cursh
  16383.  
  16384. case 1678:
  16385. setInterfaceText(str, 17511);
  16386. break;// Magic
  16387.  
  16388. case 1679:
  16389. setInterfaceText(str, 17512);
  16390. break;// Range
  16391.  
  16392. case 1680:
  16393. setInterfaceText(str, 17513);
  16394. break;// Stab
  16395.  
  16396. case 1681:
  16397. setInterfaceText(str, 17514);
  16398. break;// Slash
  16399.  
  16400. case 1682:
  16401. setInterfaceText(str, 17515);
  16402. break;// Crush
  16403.  
  16404. case 1683:
  16405. setInterfaceText(str, 17516);
  16406. break;// Magic
  16407.  
  16408. case 1684:
  16409. setInterfaceText(str, 17517);
  16410. break;// Range
  16411.  
  16412. case 1686:
  16413. setInterfaceText(str, 17518);
  16414. break;// Strength
  16415.  
  16416. case 1687:
  16417. setInterfaceText(str, 17519);
  16418. }
  16419. }
  16420.  
  16421. private Entity currentTarget;
  16422.  
  16423. public void showCombatBox() {
  16424. if(openInterfaceID > 0) {
  16425. return;
  16426. }
  16427. int currentHp = currentTarget.currentHealth;
  16428. int maxHp = currentTarget.maxHealth;
  16429. boolean rounded = false;
  16430. int height = 35;
  16431. int width = 106;
  16432. int xPos = 10;
  16433. int yPos = 30;
  16434. if (!Configuration.CONSTITUTION_ENABLED) {
  16435. currentHp = Math.round(currentHp/10);
  16436. maxHp /= 10;
  16437. rounded = true;
  16438. }
  16439. int hpBarXPps = (xPos + 3);
  16440. if(currentTarget instanceof Player) {
  16441. Player player = (Player)currentTarget;
  16442. drawCombatBox(xPos, yPos, width, height, currentHp, maxHp, hpBarXPps);
  16443. newSmallFont.drawCenteredString(player.name, xPos+(width/2), yPos + 10,16777215,0);
  16444. } else {
  16445. NPC npc = (NPC)currentTarget;
  16446. boolean boss = maxHp > (rounded ? 250 : 2500);
  16447. if(boss) {
  16448. hpBarXPps = (xPos + 13);
  16449. height = 25 + getYPosAddition(npc.damageDealers.size());
  16450. width = 125;
  16451. }
  16452. drawCombatBox(xPos, yPos, width, height, currentHp, maxHp, hpBarXPps);
  16453. if(npc.definitionOverride == null) {
  16454. currentTarget = null;
  16455. return;
  16456. }
  16457. newSmallFont.drawCenteredString(npc.definitionOverride.name, xPos+(width/2), yPos + 10,16777215,0);
  16458. if(boss) {
  16459. yPos += 10;
  16460. xPos += 5;
  16461. for(int i = 0; i < 5; i++) {
  16462. newSmallFont.drawBasicString("", xPos, yPos + getYPosAddition(i), false);
  16463. newSmallFont.drawBasicString("", xPos+90, yPos + getYPosAddition(i), false);
  16464. if(i >= npc.damageDealers.size()) {
  16465. continue;
  16466. }
  16467. String p = npc.damageDealers.get(i).getPlayer();
  16468. int damage = npc.damageDealers.get(i).getDamage();
  16469. if (!Configuration.CONSTITUTION_ENABLED && damage > 0) {
  16470. damage /= 10;
  16471. }
  16472. DecimalFormat df = new DecimalFormat("#");
  16473. newSmallFont.drawBasicString(p, xPos, yPos + getYPosAddition(i), false);
  16474. newSmallFont.drawBasicString(""+df.format(damage)+"", xPos+90, yPos + getYPosAddition(i), false);
  16475. }
  16476. }
  16477. }
  16478. }
  16479.  
  16480. public void drawCombatBox(int xPos, int yPos, int width, int height, int currentHp, int maxHp, int hpBarXPps) {
  16481. double percentOfHpLeft = (((double) currentHp / (double) maxHp) * 100);
  16482. double percentOfHpLost = 100-percentOfHpLeft;
  16483. int hpBarYPos = yPos + height - 20;
  16484. TextDrawingArea.drawAlphaFilledPixels(xPos, yPos, width, height, 000000, 50);
  16485. DrawingArea.drawPixels(15, hpBarYPos, hpBarXPps + (int) percentOfHpLeft, 11740160, (int) percentOfHpLost);//red
  16486. DrawingArea.drawPixels(15, hpBarYPos, hpBarXPps/*-(int)percentOfHpLost*/, 31744, (int) percentOfHpLeft);//green
  16487. newBoldFont.drawCenteredString(currentHp + "/" + maxHp, xPos + (width/2), hpBarYPos + 13,16777215,0);
  16488. }
  16489.  
  16490. public int getYPosAddition(int index) {
  16491. return (index * 10) + 10;
  16492. }
  16493.  
  16494.  
  16495. public String getLoginMessage1() {
  16496. return loginMessage1;
  16497. }
  16498.  
  16499. public void setLoginMessage1(String loginMessage1) {
  16500. this.loginMessage1 = loginMessage1;
  16501. }
  16502.  
  16503. public String getLoginMessage2() {
  16504. return loginMessage2;
  16505. }
  16506.  
  16507. public void setLoginMessage2(String loginMessage2) {
  16508. this.loginMessage2 = loginMessage2;
  16509. }
  16510.  
  16511. public Connection getConnection() {
  16512. return connection;
  16513. }
  16514.  
  16515. public void setConnection(Connection connection) {
  16516. this.connection = connection;
  16517. }
  16518.  
  16519. public int getLoginState() {
  16520. return loginState;
  16521. }
  16522.  
  16523. public void setLoginState(int loginState) {
  16524. this.loginState = loginState;
  16525. }
  16526.  
  16527. public int getLoginScreenState() {
  16528. return loginScreenState;
  16529. }
  16530.  
  16531. public void setLoginScreenState(int loginScreenState) {
  16532. this.loginScreenState = loginScreenState;
  16533. }
  16534.  
  16535. public int getLoginScreenCursorPos() {
  16536. return loginScreenCursorPos;
  16537. }
  16538.  
  16539. public void setLoginScreenCursorPos(int loginScreenCursorPos) {
  16540. this.loginScreenCursorPos = loginScreenCursorPos;
  16541. }
  16542.  
  16543. public String getPassword() {
  16544. return password;
  16545. }
  16546.  
  16547. public void setPassword(String password) {
  16548. this.password = password;
  16549. }
  16550.  
  16551. public ByteBuffer getInputBuffer() {
  16552. return inputBuffer;
  16553. }
  16554.  
  16555. public void setInputBuffer(ByteBuffer inputBuffer) {
  16556. this.inputBuffer = inputBuffer;
  16557. }
  16558.  
  16559. public long getServerSeed() {
  16560. return serverSeed;
  16561. }
  16562.  
  16563. public void setServerSeed(long serverSeed) {
  16564. this.serverSeed = serverSeed;
  16565. }
  16566.  
  16567. public static ByteBuffer getOut() {
  16568. return out;
  16569. }
  16570.  
  16571. public static void setOut(ByteBuffer out) {
  16572. Client.out = out;
  16573. }
  16574.  
  16575. public ByteBuffer getLoginBuffer() {
  16576. return loginBuffer;
  16577. }
  16578.  
  16579. public void setLoginBuffer(ByteBuffer loginBuffer) {
  16580. this.loginBuffer = loginBuffer;
  16581. }
  16582.  
  16583. public static boolean isLowDetail() {
  16584. return lowDetail;
  16585. }
  16586.  
  16587. public static void setLowDetail(boolean lowDetail) {
  16588. Client.lowDetail = lowDetail;
  16589. }
  16590.  
  16591. public ISAACCipher getConnectionCipher() {
  16592. return connectionCipher;
  16593. }
  16594.  
  16595. public void setConnectionCipher(ISAACCipher connectionCipher) {
  16596. this.connectionCipher = connectionCipher;
  16597. }
  16598.  
  16599. public int getLoginFailures() {
  16600. return loginFailures;
  16601. }
  16602.  
  16603. public void setLoginFailures(int loginFailures) {
  16604. this.loginFailures = loginFailures;
  16605. }
  16606.  
  16607. public static int getAnInt1226() {
  16608. return anInt1226;
  16609. }
  16610.  
  16611. public static void setAnInt1226(int anInt1226) {
  16612. Client.anInt1226 = anInt1226;
  16613. }
  16614.  
  16615. public static int getAnInt1155() {
  16616. return anInt1155;
  16617. }
  16618.  
  16619. public static void setAnInt1155(int anInt1155) {
  16620. Client.anInt1155 = anInt1155;
  16621. }
  16622.  
  16623. public static int getAnInt1188() {
  16624. return anInt1188;
  16625. }
  16626.  
  16627. public static void setAnInt1188(int anInt1188) {
  16628. Client.anInt1188 = anInt1188;
  16629. }
  16630.  
  16631. public static int getAnInt924() {
  16632. return anInt924;
  16633. }
  16634.  
  16635. public static void setAnInt924(int anInt924) {
  16636. Client.anInt924 = anInt924;
  16637. }
  16638.  
  16639. public static int getAnInt1288() {
  16640. return anInt1288;
  16641. }
  16642.  
  16643. public static void setAnInt1288(int anInt1288) {
  16644. Client.anInt1288 = anInt1288;
  16645. }
  16646.  
  16647. public static int getAnInt986() {
  16648. return anInt986;
  16649. }
  16650.  
  16651. public static void setAnInt986(int anInt986) {
  16652. Client.anInt986 = anInt986;
  16653. }
  16654.  
  16655. public static int getAnInt1134() {
  16656. return anInt1134;
  16657. }
  16658.  
  16659. public static void setAnInt1134(int anInt1134) {
  16660. Client.anInt1134 = anInt1134;
  16661. }
  16662.  
  16663. public static int getAnInt1175() {
  16664. return anInt1175;
  16665. }
  16666.  
  16667. public static void setAnInt1175(int anInt1175) {
  16668. Client.anInt1175 = anInt1175;
  16669. }
  16670.  
  16671. public int getWalkableInterfaceId() {
  16672. return walkableInterfaceId;
  16673. }
  16674.  
  16675. public void setWalkableInterfaceId(int anInt1018) {
  16676. this.walkableInterfaceId = anInt1018;
  16677. }
  16678.  
  16679. public int getAnInt900() {
  16680. return anInt900;
  16681. }
  16682.  
  16683. public void setAnInt900(int anInt900) {
  16684. this.anInt900 = anInt900;
  16685. }
  16686.  
  16687. public int getFullscreenInterfaceID() {
  16688. return fullscreenInterfaceID;
  16689. }
  16690.  
  16691. public void setFullscreenInterfaceID(int fullscreenInterfaceID) {
  16692. this.fullscreenInterfaceID = fullscreenInterfaceID;
  16693. }
  16694.  
  16695. public Deque getaClass19_1179() {
  16696. return aClass19_1179;
  16697. }
  16698.  
  16699. public void setaClass19_1179(Deque aClass19_1179) {
  16700. this.aClass19_1179 = aClass19_1179;
  16701. }
  16702.  
  16703. public int getLastKnownPlane() {
  16704. return lastKnownPlane;
  16705. }
  16706.  
  16707. public void setLastKnownPlane(int anInt985) {
  16708. this.lastKnownPlane = anInt985;
  16709. }
  16710.  
  16711. public int getMyPlayerIndex() {
  16712. return myPlayerIndex;
  16713. }
  16714.  
  16715. public Deque getaClass19_1013() {
  16716. return aClass19_1013;
  16717. }
  16718.  
  16719. public void setaClass19_1013(Deque aClass19_1013) {
  16720. this.aClass19_1013 = aClass19_1013;
  16721. }
  16722.  
  16723. public ByteBuffer[] getaStreamArray895s() {
  16724. return aStreamArray895s;
  16725. }
  16726.  
  16727. public void setaStreamArray895s(ByteBuffer[] aStreamArray895s) {
  16728. this.aStreamArray895s = aStreamArray895s;
  16729. }
  16730.  
  16731. public int getMaxPlayers() {
  16732. return maxPlayers;
  16733. }
  16734.  
  16735. public Deque getaClass19_1056() {
  16736. return aClass19_1056;
  16737. }
  16738.  
  16739. public void setaClass19_1056(Deque aClass19_1056) {
  16740. this.aClass19_1056 = aClass19_1056;
  16741. }
  16742.  
  16743. public ScriptManager getScriptManager() {
  16744. return scriptManager;
  16745. }
  16746.  
  16747. public void setScriptManager(ScriptManager scriptManager) {
  16748. this.scriptManager = scriptManager;
  16749. }
  16750.  
  16751. public GrandExchange getGrandExchange() {
  16752. return grandExchange;
  16753. }
  16754.  
  16755. public AccountManager getAccountManager() {
  16756. return accountManager;
  16757. }
  16758. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement