Advertisement
Guest User

Untitled

a guest
Dec 3rd, 2016
368
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 481.31 KB | None | 0 0
  1. package net.zamorak.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.Frame;
  10. import java.awt.Graphics;
  11. import java.awt.Toolkit;
  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.FileNotFoundException;
  19. import java.io.FileOutputStream;
  20. import java.io.IOException;
  21. import java.io.OutputStream;
  22. import java.lang.reflect.Method;
  23. import java.net.InetAddress;
  24. import java.net.Socket;
  25. import java.net.URL;
  26. import java.net.UnknownHostException;
  27. import java.text.DateFormat;
  28. import java.text.NumberFormat;
  29. import java.text.SimpleDateFormat;
  30. import java.util.AbstractMap;
  31. import java.util.ArrayList;
  32. import java.util.Arrays;
  33. import java.util.Date;
  34. import java.util.Iterator;
  35. import java.util.Locale;
  36. import java.util.Queue;
  37. import java.util.concurrent.ConcurrentLinkedDeque;
  38. import java.util.regex.Pattern;
  39. import java.util.zip.CRC32;
  40.  
  41. import net.zamorak.client.Configuration.ConfigType;
  42. import net.zamorak.client.alertify4j.Alertify;
  43. import net.zamorak.client.alertify4j.AlertifyBuilder;
  44. import net.zamorak.client.alertify4j.AlertifyType;
  45. import net.zamorak.client.alertify4j.ui.AlertifyWindow;
  46. import net.zamorak.client.alertify4j.ui.AlertifyWindowClick;
  47. import net.zamorak.client.cache.Archive;
  48. import net.zamorak.client.cache.definition.Animation;
  49. import net.zamorak.client.cache.definition.Flo;
  50. import net.zamorak.client.cache.definition.IdentityKit;
  51. import net.zamorak.client.cache.definition.ItemDefinition;
  52. import net.zamorak.client.cache.definition.MobDefinition;
  53. import net.zamorak.client.cache.definition.ObjectDefinition;
  54. import net.zamorak.client.cache.definition.OverLayFlo317;
  55. import net.zamorak.client.cache.definition.SpotAnimDefinition;
  56. import net.zamorak.client.cache.definition.VarBit;
  57. import net.zamorak.client.cache.definition.Varp;
  58. import net.zamorak.client.cache.node.Deque;
  59. import net.zamorak.client.cache.node.Node;
  60. import net.zamorak.client.cache.ondemand.OnDemandFetcher;
  61. import net.zamorak.client.cache.ondemand.OnDemandRequest;
  62. import net.zamorak.client.constants.Constants;
  63. import net.zamorak.client.constants.GameFrameConstants;
  64. import net.zamorak.client.constants.GameFrameConstants.GameFrameType;
  65. import net.zamorak.client.constants.SizeConstants;
  66. import net.zamorak.client.entity.player.ClanMember;
  67. import net.zamorak.client.entity.player.Player;
  68. import net.zamorak.client.entity.player.PlayerHandler;
  69. import net.zamorak.client.file.CacheDownloader;
  70. import net.zamorak.client.file.CacheDownloader.FileType;
  71. import net.zamorak.client.file.CacheUpdater;
  72. import net.zamorak.client.graphics.Background;
  73. import net.zamorak.client.graphics.DrawingArea;
  74. import net.zamorak.client.graphics.Sprite;
  75. import net.zamorak.client.graphics.SpriteLoader;
  76. import net.zamorak.client.graphics.fonts.Censor;
  77. import net.zamorak.client.graphics.fonts.RSFontSystem;
  78. import net.zamorak.client.graphics.fonts.TextClass;
  79. import net.zamorak.client.graphics.fonts.TextDrawingArea;
  80. import net.zamorak.client.graphics.fonts.TextInput;
  81. import net.zamorak.client.graphics.gameframe.GameFrame;
  82. import net.zamorak.client.graphics.gameframe.GameFrame.ScreenMode;
  83. import net.zamorak.client.graphics.gameframe.impl.ChatArea;
  84. import net.zamorak.client.graphics.gameframe.impl.MapArea;
  85. import net.zamorak.client.graphics.gameframe.impl.MapArea.PouchModifyType;
  86. import net.zamorak.client.graphics.gameframe.impl.TabArea;
  87. import net.zamorak.client.io.ByteBuffer;
  88. import net.zamorak.client.io.ISAACCipher;
  89. import net.zamorak.client.net.Connection;
  90. import net.zamorak.client.net.InetAddressUtils;
  91. import net.zamorak.client.renderable.Animable;
  92. import net.zamorak.client.renderable.Animable_Sub3;
  93. import net.zamorak.client.renderable.Animable_Sub5;
  94. import net.zamorak.client.renderable.Entity;
  95. import net.zamorak.client.renderable.Item;
  96. import net.zamorak.client.renderable.NPC;
  97. import net.zamorak.client.renderable.PlayerProjectile;
  98. import net.zamorak.client.task.TaskType;
  99. import net.zamorak.client.task.TimedTask;
  100. import net.zamorak.client.task.TimedTaskHandler;
  101. import net.zamorak.client.tools.FileUtilities;
  102. import net.zamorak.client.world.CollisionMap;
  103. import net.zamorak.client.world.CustomObjectSpawns;
  104. import net.zamorak.client.world.Model;
  105. import net.zamorak.client.world.Object1;
  106. import net.zamorak.client.world.Object2;
  107. import net.zamorak.client.world.Object3;
  108. import net.zamorak.client.world.Object5;
  109. import net.zamorak.client.world.ObjectManager;
  110. import net.zamorak.client.world.Rasterizer;
  111. import net.zamorak.client.world.Texture;
  112. import net.zamorak.client.world.WorldController;
  113. import net.zamorak.client.world.background.ScriptManager;
  114. import net.zamorak.client.world.fog.FogHandler;
  115. import net.zamorak.client.world.music.Class56;
  116. import net.zamorak.client.world.music.Class56_Sub1_Sub1;
  117. import net.zamorak.client.world.sound.Class25;
  118. import net.zamorak.client.world.sound.Class3_Sub7;
  119. import net.zamorak.client.world.sound.Class3_Sub7_Sub1;
  120. import net.zamorak.client.world.sound.Class3_Sub7_Sub2;
  121. import net.zamorak.client.world.sound.Class3_Sub9_Sub1;
  122. import net.zamorak.client.world.sound.Class5;
  123. import net.zamorak.client.world.sound.Class5_Sub1;
  124. import net.zamorak.client.world.sound.Class5_Sub2;
  125. import net.zamorak.client.world.sound.Class5_Sub2_Sub1;
  126. import net.zamorak.client.world.sound.Class5_Sub2_Sub2;
  127. import net.zamorak.client.world.sound.Sound;
  128. import net.zamorak.client.world.sound.Sounds;
  129.  
  130. public class Client extends GameApplet {
  131.  
  132. public FogHandler fogHandler = new FogHandler();
  133.  
  134. public static final java.util.List<ClanUser> CLAN_CHAT_USERS = new ArrayList<>();
  135. public static final java.util.List<ClanUser> CONFIGURE_INTERFACE_USERS = new ArrayList<>();
  136.  
  137. public static final int CACHE_INDEX_COUNT = 6;
  138.  
  139. private static Configuration config = new Configuration();
  140.  
  141. public JFont testFont;
  142. public JFont testFont2;
  143.  
  144. /**
  145. * The previous plane the player was on
  146. */
  147. private int previousPlane;
  148.  
  149. public static Configuration getConfig() {
  150. return config;
  151. }
  152.  
  153. protected Queue<TimedTask> tasks = new ConcurrentLinkedDeque<>();
  154.  
  155. /**
  156. * The split chat color, by default its 65535
  157. */
  158. public int splitChatColor = 0;
  159.  
  160. public enum CrownIconState {
  161. NONE, STAFF, ALL;
  162.  
  163. public String getTitle() {
  164. return TextClass.fixName(toString().toLowerCase());
  165. }
  166. }
  167.  
  168. private CrownIconState crownState = CrownIconState.NONE;
  169.  
  170. public CrownIconState getState() {
  171. return crownState;
  172. }
  173.  
  174. /**
  175. * Is looting bag open
  176. */
  177. public boolean lootingBag = false;
  178.  
  179. private final AccountManager accountManager;
  180.  
  181. public AccountManager getAccountManager() {
  182. return accountManager;
  183. }
  184.  
  185. /**
  186. * The split chat interface is open
  187. */
  188. public boolean splitChatInterfaceOpen = false;
  189. private static boolean aBoolean475;
  190. private static boolean aBoolean995;
  191. private static byte[] aByteArray347;
  192. private static Sound aClass1418;
  193. private static Class25 aClass25_1948;
  194. private static Sound[] aClass26Array1468 = new Sound[50];
  195. private static Class3_Sub7 aClass3_Sub7_1345;
  196. private static Class3_Sub7_Sub1 aClass3_Sub7_Sub1_1493;
  197. private static Class5 aClass5_932;
  198. private static Class56 aClass56_749;
  199. public static long aLong1432;
  200. private static int anInt1005;
  201. public static int anInt1089;
  202. private static int anInt1117;
  203. private static int anInt1134;
  204. private static int anInt1142;
  205. private static int anInt1155;
  206. private static int anInt116;
  207. private static int anInt1175;
  208. private static int anInt1188;
  209. public static int anInt1211;
  210. private static int anInt1226;
  211. private static int anInt1288;
  212. private static int anInt139;
  213. public static int anInt1401 = 256;
  214. private static int anInt1408;
  215. private static int anInt1478;
  216. private static int anInt1526;
  217. private static int anInt155 = 0;
  218. public static int anInt197;
  219. private static int anInt2200 = 0;
  220. private static int anInt478 = -1;
  221. private static int anInt720 = 0;
  222. private static int anInt849;
  223. private static int anInt854;
  224. private static int anInt924;
  225. private static int anInt986;
  226. static final int[] anIntArray1019;
  227. public static final int[] anIntArray1204 = { 9104, 10275, 7595, 3610, 7975, 8526, 918, 38802, 24466, 10145, 58654, 5027, 1457, 16565, 34991, 25486 };
  228. public static int[] anIntArray1232;
  229. public static int[] anIntArray385 = new int[] { 12800, 12800, 12800, 12800, 12800, 12800, 12800, 12800, 12800, 12800, 12800, 12800, 12800, 12800, 12800, 12800 };
  230. public static final int[][] anIntArrayArray1003 = { { 6798, 107, 10283, 16, 4797, 7744, 5799, 4634, 33697, 22433, 2983, 54193 },
  231. { 8741, 12, 64030, 43162, 7735, 8404, 1701, 38430, 24094, 10153, 56621, 4783, 1341, 16578, 35003, 25239 },
  232. { 25238, 8742, 12, 64030, 43162, 7735, 8404, 1701, 38430, 24094, 10153, 56621, 4783, 1341, 16578, 35003 }, { 4626, 11146, 6439, 12, 4758, 10270 },
  233. { 4550, 4537, 5681, 5673, 5790, 6806, 8076, 4574 } };
  234. public static Sprite[] cacheSprite;
  235. private static int clientHeight = 503;
  236. public static int clientWidth = 765;
  237. private static boolean fetchMusic = false;
  238. public static boolean flagged;
  239. private static final int[] IDs = { 1196, 1199, 1206, 1215, 1224, 1231, 1240, 1249, 1258, 1267, 1274, 1283, 1573, 1290, 1299, 1308, 1315, 1324, 1333, 1340, 1349, 1358, 1367, 1374, 1381, 1388, 1397,
  240. 1404, 1583, 12038, 1414, 1421, 1430, 1437, 1446, 1453, 1460, 1469, 15878, 1602, 1613, 1624, 7456, 1478, 1485, 1494, 1503, 1512, 1521, 1530, 1544, 1553, 1563, 1593, 1635, 12426, 12436,
  241. 12446, 12456, 6004, 18471,
  242. /* Ancients */
  243. 12940, 12988, 13036, 12902, 12862, 13046, 12964, 13012, 13054, 12920, 12882, 13062, 12952, 13000, 13070, 12912, 12872, 13080, 12976, 13024, 13088, 12930, 12892, 13096 };
  244. public static Client instance;
  245. private static boolean isMembers = true;
  246. public static int log_view_dist = (int) (Math.log(clientWidth) / Math.log(2));
  247. public static int loopCycle;
  248. private static boolean lowDetail;
  249. private static byte[] musicData;
  250. private static int musicVolume2;
  251. public static Player myPlayer;
  252. private static String myUsername;
  253. private static final Pattern NAME_PATTERN = Pattern.compile("@.+@");
  254. private static int nodeID = 10;
  255. public static int openInterfaceID;
  256. private static ByteBuffer out;
  257. public static int portOff;
  258. private static final int[] runeChildren = { 1202, 1203, 1209, 1210, 1211, 1218, 1219, 1220, 1227, 1228, 1234, 1235, 1236, 1243, 1244, 1245, 1252, 1253, 1254, 1261, 1262, 1263, 1270, 1271, 1277,
  259. 1278, 1279, 1286, 1287, 1293, 1294, 1295, 1302, 1303, 1304, 1311, 1312, 1318, 1319, 1320, 1327, 1328, 1329, 1336, 1337, 1343, 1344, 1345, 1352, 1353, 1354, 1361, 1362, 1363, 1370, 1371,
  260. 1377, 1378, 1384, 1385, 1391, 1392, 1393, 1400, 1401, 1407, 1408, 1410, 1417, 1418, 1424, 1425, 1426, 1433, 1434, 1440, 1441, 1442, 1449, 1450, 1456, 1457, 1463, 1464, 1465, 1472, 1473,
  261. 1474, 1481, 1482, 1488, 1489, 1490, 1497, 1498, 1499, 1506, 1507, 1508, 1515, 1516, 1517, 1524, 1525, 1526, 1533, 1534, 1535, 1547, 1548, 1549, 1556, 1557, 1558, 1566, 1567, 1568, 1576,
  262. 1577, 1578, 1586, 1587, 1588, 1596, 1597, 1598, 1605, 1606, 1607, 1616, 1617, 1618, 1627, 1628, 1629, 1638, 1639, 1640, 6007, 6008, 6011, 8673, 8674, 12041, 12042, 12429, 12430, 12431,
  263. 12439, 12440, 12441, 12449, 12450, 12451, 12459, 12460, 15881, 15882, 15885, 18474, 18475, 18478 };
  264. private static final long serialVersionUID = -1913853327056220406L;
  265. public static String[] skillNames = { "Attack", "Constitution", "Mining", "Strength", "Agility", "Smithing", "Defence", "Herblore", "Fishing", "Range", "Thieving", "Cooking", "Prayer", "Crafting",
  266. "Firemaking", "Magic", "Fletching", "Woodcutting", "Runecrafting", "Slayer", "Farming", "Construction", "Hunter", "Summoning" };
  267. private static int soundEffectVolume = 127;
  268. private static int spellID = 0;
  269. public static boolean tabAreaAltered;
  270. public static int tabID;
  271. public static boolean LOOP_MUSIC;
  272. public final static int[] tabInterfaceIDs = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 };
  273. private static final String validUserPassChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!\"\243$%^&*()-_=+[{]};:'@#~,<.>/?\\| ";
  274. private String consoleInput;
  275. public static boolean consoleOpen;
  276. private final String[] consoleMessages;
  277. public int mapX;
  278.  
  279. public int 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 regionX = x - mX * 8;
  285. int regionY = y - mY * 8;
  286. int i15 = 40 >> 2;
  287. int l17 = anIntArray1177[i15];
  288. if (regionY > 0 && regionY < 103 && regionX > 0 && regionX < 103) {
  289. if (height == realPlane) {
  290. method130(-1, objectId, face, l17, regionY, type, height, regionX, 0);
  291. } else {
  292. method130(-1, CustomObjectSpawns.BLANK_OBJECT_ID, face, l17, regionY, type, plane, regionX, 0);
  293. }
  294. }
  295. }
  296.  
  297. public int getCursorID() {
  298. for (int x = 0; x < cursorInfo.length; x++) {
  299. if (menuActionName[menuActionRow - 1].toLowerCase().startsWith(cursorInfo[x].toLowerCase())) {
  300. return x;
  301. }
  302. }
  303. return 0;
  304. }
  305.  
  306. public static String cursorInfo[] = { "Walk-to", "Take", "Use", "Talk-to", "Open", "Net", "Bait", "Cage", "Harpoon", "Chop", "Bury", "Pray-at", "Mine", "Eat", "Drink", "Wield", "Wear", "Remove",
  307. "Attack", "Enter", "Exit", "Climb-up", "Climb-down", "Search", "Steal", "Smelt", "Clean", "Back", "Deposit Bank", "Inspect", "Pick", "Zoom", "Pointless", "Settings", "Pointless",
  308. "Pointless", "Accept", "Decline", "Cast Ice Barrage on", "Cast Blood Barrage on", "Cast Shadow Barrage on", "Cast Smoke Barrage on", "Cast Ice Blitz on", "Cast Blood Blitz on",
  309. "Cast Shadow Blitz on", "Cast Smoke Blitz on", "Cast Ice Burst on", "Cast Blood Burst on", "Cast Shadow Burst on", "Cast Smoke Burst on", "Cast Ice Rush on", "Cast Blood Rush on",
  310. "Cast Shadow Rush on", "Cast Smoke Rush on", "Link", "Split Private", "Graphics", "Audio", "Pointless", "Pointless", "Click", "Information", "Cast High level alchemy on",
  311. "Cast Low level alchemy on", "Value", "Select Starter", "Craft-rune", "Pointless", "Withdraw", "Slash", "Pull", "Browse Item Database", "Browse Quick", };
  312.  
  313. public void drawTasks() {
  314. int offset = 0;
  315.  
  316. for (TimedTask task : tasks) {
  317. final int timer = task.getTimer();
  318. final int sprite = task.getTaskType().getSpriteId();
  319. int xOffset = (80 * offset++);
  320. DrawingArea.drawAlphaPixels(150 + xOffset, 305, 75, 25, 0x3A3B3A, 150);
  321. DrawingArea.fillPixels(150 + xOffset, 75, 25, 0x000000, 305);
  322. int seconds = timer;
  323. int minutes = timer / 60;
  324. if (minutes > 0) {
  325. seconds -= (minutes * 60);
  326. }
  327. if (sprite >= 0 && sprite < cacheSprite.length && cacheSprite[sprite] != null) {
  328. cacheSprite[sprite].drawAdvancedSprite(160 + xOffset, 309);
  329. }
  330.  
  331. newRegularFont.drawCenteredString(minutes + ":" + (seconds < 10 ? ("0" + seconds) : seconds), 200 + xOffset, 323, 0xeb981f, 0);
  332. }
  333. }
  334.  
  335. public void tickTasks() {
  336. synchronized (tasks) {
  337. for (Iterator<TimedTask> t = tasks.iterator(); t.hasNext();) {
  338. TimedTask task = t.next();
  339. if (task.getTimer() > 0) {
  340. task.setTimer(task.getTimer() - 1);
  341. } else {
  342. t.remove();
  343. }
  344. }
  345. }
  346. }
  347.  
  348. static {
  349. anIntArray1019 = new int[99];
  350. int points = 0;
  351.  
  352. for (int i = 0; i < 99; i++) {
  353. int l = i + 1;
  354. int i1 = (int) (l + 300D * Math.pow(2D, l / 7D));
  355. points += i1;
  356. anIntArray1019[i] = points >> 2;
  357. }
  358.  
  359. anIntArray1232 = new int[32];
  360. points = 2;
  361.  
  362. for (int i = 0; i < 32; i++) {
  363. anIntArray1232[i] = points - 1;
  364. points += points;
  365. }
  366. }
  367.  
  368. public static String getFileNameWithoutExtension(String fileName) {
  369. File tmpFile = new File(fileName);
  370. tmpFile.getName();
  371. int whereDot = tmpFile.getName().lastIndexOf('.');
  372. if (0 < whereDot && whereDot <= tmpFile.getName().length() - 2) {
  373. return tmpFile.getName().substring(0, whereDot);
  374. }
  375. return "";
  376. }
  377.  
  378. public String indexLocation(int cacheIndex, int index) {
  379. return Signlink.getWorkingDirectory() + "/index" + cacheIndex + "/" + (index != -1 ? index + ".gz" : "");
  380.  
  381. }
  382.  
  383. public void repackCacheIndex(int cacheIndex, boolean deleteDirectory) {
  384. File directory = new File(Signlink.getWorkingDirectory() + "/index" + cacheIndex + "/");
  385.  
  386. if (!directory.exists()) {
  387. return;
  388. }
  389. System.out.println("Started repacking index " + cacheIndex + ".");
  390. int indexLength = new File(indexLocation(cacheIndex, -1)).listFiles().length;
  391. File[] file = new File(indexLocation(cacheIndex, -1)).listFiles();
  392. try {
  393. for (int index = 0; index < indexLength; index++) {
  394. int fileIndex = Integer.parseInt(getFileNameWithoutExtension(file[index].toString()));
  395. byte[] data = fileToByteArray(cacheIndex, fileIndex);
  396. if (data != null && data.length > 0) {
  397. decompressors[cacheIndex].method234(data.length, data, fileIndex);
  398. System.out.println("Repacked Archive: " + cacheIndex + " File: " + fileIndex + ".");
  399. } else {
  400. System.out.println("Unable to locate index " + fileIndex + ".");
  401. }
  402. }
  403.  
  404. } catch (Exception e) {
  405. e.printStackTrace();
  406. System.out.println("Error packing cache index " + cacheIndex + ".");
  407. }
  408. if (deleteDirectory)
  409. deleteDir(directory);
  410. System.out.println("Finished repacking " + cacheIndex + ".");
  411. }
  412.  
  413. private boolean deleteDir(File dir) {
  414. if (dir.isDirectory()) {
  415. String[] children = dir.list();
  416. for (int i = 0; i < children.length; i++) {
  417. boolean success = deleteDir(new File(dir, children[i]));
  418. if (!success) {
  419. return false;
  420. }
  421. }
  422. }
  423.  
  424. return dir.delete(); // The directory is empty now and can be deleted.
  425. }
  426.  
  427. /**
  428. * Saves the players data
  429. *
  430. * @throws IOException
  431. */
  432. public void savePlayerData() {
  433. try {
  434. File file = new File(Signlink.getDataDirectory() + "/settings.dat");
  435. if (!file.exists()) {
  436. file.createNewFile();
  437. }
  438. DataOutputStream stream = new DataOutputStream(new FileOutputStream(file));
  439. if (stream != null) {
  440. stream.writeUTF(Constants.REMEMBER_ME_SELECTED ? getMyUsername() : "");
  441. stream.writeUTF(Constants.REMEMBER_ME_SELECTED ? getPassword() : "");
  442. stream.writeBoolean(Constants.REMEMBER_ME_SELECTED);
  443. stream.writeBoolean(config.getStatus(ConfigType.FOG));
  444. stream.writeBoolean(config.getStatus(ConfigType.X10_DAMAGE));
  445. stream.writeBoolean(config.getStatus(ConfigType.NEW_HITBARS));
  446. stream.writeBoolean(config.getStatus(ConfigType.FUNCTION_KEYS));
  447. stream.writeBoolean(config.getStatus(ConfigType.HP_ABOVE_HEAD));
  448. stream.writeBoolean(config.getStatus(ConfigType.NAMES_ABOVE_HEAD));
  449. stream.writeBoolean(config.getStatus(ConfigType.TWEENING));
  450. stream.writeBoolean(config.getStatus(ConfigType.HITMARKS));
  451. stream.writeBoolean(GameFrameConstants.gameframeType == GameFrameType.FRAME_525 ? false : true);
  452. stream.writeBoolean(config.getStatus(ConfigType.TOGGLE_FOV));
  453. stream.writeBoolean(config.getStatus(ConfigType.TOGGLE_ROOFS));
  454. stream.writeBoolean(config.getStatus(ConfigType.HIGH_DETAIL));
  455. stream.writeInt(splitChatColor);
  456. stream.writeBoolean(config.getStatus(ConfigType.HD_MINIMAP));
  457. stream.writeBoolean(config.getStatus(ConfigType.HD_SHADING));
  458. stream.writeBoolean(config.getStatus(ConfigType.HD_TEXTURES));
  459. stream.writeBoolean(config.getStatus(ConfigType.NEW_CURSORS));
  460. stream.writeBoolean(config.getStatus(ConfigType.TOGGLE_TARGET_INTERFACE));
  461. stream.writeBoolean(config.getStatus(ConfigType.PUSH_NOTIFICATIONS));
  462. stream.writeBoolean(config.getStatus(ConfigType.DISPLAY_COMBAT_OVERLAY));
  463. stream.writeBoolean(config.getStatus(ConfigType.ONE_CLICK_ATTACK));
  464. stream.writeBoolean(config.getStatus(ConfigType.DISPLAY_COMBAT_TIMERS));
  465. stream.writeUTF(crownState.toString());
  466. stream.close();
  467. }
  468.  
  469. file = new File(Signlink.getDataDirectory() + "/zamorak_prefs.dat");
  470. if (!file.exists()) {
  471. file.createNewFile();
  472. }
  473. stream = new DataOutputStream(new FileOutputStream(file));
  474.  
  475. if (stream != null) {
  476. for (int i = 0; i < AccountManager.MAX_ACCOUNTS; i++) {
  477. Account account = null;
  478. if (accountManager.getAccounts().size() > i) {
  479. account = accountManager.getAccounts().get(i);
  480. }
  481.  
  482. stream.writeUTF((account == null || account.getUsername().isEmpty()) ? "" : account.getUsername());
  483. stream.writeUTF((account == null || account.getPassword().isEmpty()) ? "" : account.getPassword());
  484. }
  485. stream.close();
  486. }
  487. } catch (IOException e) {
  488. e.printStackTrace();
  489. }
  490. }
  491.  
  492. /**
  493. * Loads the players data
  494. *
  495. * @throws IOException
  496. */
  497. private void loadPlayerData() throws IOException {
  498. File file = new File(Signlink.getDataDirectory() + "/settings.dat");
  499.  
  500. if (file.exists()) {
  501.  
  502. DataInputStream stream = new DataInputStream(new FileInputStream(file));
  503.  
  504. try {
  505. setMyUsername(stream.readUTF());
  506. password = stream.readUTF();
  507. Constants.REMEMBER_ME_SELECTED = stream.readBoolean();
  508. config.set(ConfigType.FOG, stream.readBoolean());
  509. config.set(ConfigType.X10_DAMAGE, stream.readBoolean());
  510. config.set(ConfigType.NEW_HITBARS, stream.readBoolean());
  511. config.set(ConfigType.FUNCTION_KEYS, stream.readBoolean());
  512. config.set(ConfigType.HP_ABOVE_HEAD, stream.readBoolean());
  513. config.set(ConfigType.NAMES_ABOVE_HEAD, stream.readBoolean());
  514. config.set(ConfigType.TWEENING, stream.readBoolean());
  515. config.set(ConfigType.HITMARKS, stream.readBoolean());
  516. GameFrameConstants.gameframeType = stream.readBoolean() ? GameFrameType.FRAME_554 : GameFrameType.FRAME_525;
  517. config.set(ConfigType.TOGGLE_FOV, stream.readBoolean());
  518. config.set(ConfigType.TOGGLE_ROOFS, stream.readBoolean());
  519. config.set(ConfigType.HIGH_DETAIL, stream.readBoolean());
  520. splitChatColor = stream.readInt();
  521. config.set(ConfigType.HD_MINIMAP, stream.readBoolean());
  522. stream.readBoolean();
  523. config.set(ConfigType.HD_SHADING, true);
  524. config.set(ConfigType.HD_TEXTURES, stream.readBoolean());
  525. config.set(ConfigType.NEW_CURSORS, stream.readBoolean());
  526. config.set(ConfigType.TOGGLE_TARGET_INTERFACE, stream.readBoolean());
  527. config.set(ConfigType.PUSH_NOTIFICATIONS, stream.readBoolean());
  528. config.set(ConfigType.DISPLAY_COMBAT_OVERLAY, stream.readBoolean());
  529. config.set(ConfigType.ONE_CLICK_ATTACK, stream.readBoolean());
  530. config.set(ConfigType.DISPLAY_COMBAT_TIMERS, stream.readBoolean());
  531. crownState = CrownIconState.valueOf(stream.readUTF().toUpperCase());
  532.  
  533. if (!config.getStatus(ConfigType.HIGH_DETAIL)) {
  534. setLowDetail();
  535. } else {
  536. setHighDetail();
  537. }
  538.  
  539. sendSettingConfigs();
  540.  
  541. } catch (IOException e) {
  542. } finally {
  543. stream.close();
  544. }
  545. }
  546.  
  547. file = new File(Signlink.getDataDirectory() + "/zamorak_prefs.dat");
  548.  
  549. if (file.exists()) {
  550. DataInputStream stream = new DataInputStream(new FileInputStream(file));
  551.  
  552. try {
  553. for (int i = 0; i < AccountManager.MAX_ACCOUNTS; i++) {
  554. String username = stream.readUTF();
  555. String password = stream.readUTF();
  556.  
  557. if (username != null && password != null && !username.isEmpty() && !password.isEmpty()) {
  558. accountManager.addAccount(username, password);
  559. }
  560. }
  561. } catch (IOException e) {
  562. } finally {
  563. stream.close();
  564. }
  565. }
  566. }
  567.  
  568. public void sendSettingConfigs() {
  569. sendFrame36(516, GameFrameConstants.gameframeType == GameFrameConstants.GameFrameType.FRAME_554 ? 1 : 0);
  570. sendFrame36(521, !config.getStatus(ConfigType.FUNCTION_KEYS) ? 1 : 0);
  571. sendFrame36(523, config.getStatus(ConfigType.FOG) ? 1 : 0);
  572. sendFrame36(519, config.getStatus(ConfigType.NEW_HITBARS) ? 1 : 0);
  573. sendFrame36(522, config.getStatus(ConfigType.X10_DAMAGE) ? 1 : 0);
  574. sendFrame36(518, config.getStatus(ConfigType.HP_ABOVE_HEAD) ? 1 : 0);
  575. sendFrame36(517, config.getStatus(ConfigType.NAMES_ABOVE_HEAD) ? 1 : 0);
  576. sendFrame36(524, config.getStatus(ConfigType.NEW_CURSORS) ? 1 : 0);
  577. sendFrame36(520, config.getStatus(ConfigType.HITMARKS) ? 1 : 0);
  578. sendFrame36(525, config.getStatus(ConfigType.TOGGLE_ROOFS) ? 1 : 0);
  579. sendFrame36(526, config.getStatus(ConfigType.TOGGLE_FOV) ? 1 : 0);
  580. sendFrame36(RSInterface.SETTING_CONFIGS[11], config.getStatus(ConfigType.PUSH_NOTIFICATIONS) ? 1 : 0);
  581. sendFrame36(531, lowDetail ? 1 : 0);
  582. sendFrame36(532, lowDetail ? 0 : 1);
  583. sendFrame36(528, config.getStatus(ConfigType.HD_TEXTURES) ? 1 : 0);
  584. sendFrame36(529, config.getStatus(ConfigType.DISPLAY_COMBAT_TIMERS) ? 1 : 0);
  585. sendFrame36(RSInterface.SETTING_CONFIGS[17], config.getStatus(ConfigType.DISPLAY_COMBAT_OVERLAY) ? 1 : 0);
  586. sendFrame36(RSInterface.SETTING_CONFIGS[18], config.getStatus(ConfigType.ONE_CLICK_ATTACK) ? 1 : 0);
  587. sendFrame36(RSInterface.SETTING_CONFIGS[19], config.getStatus(ConfigType.TOGGLE_TARGET_INTERFACE) ? 1 : 0);
  588. sendFrame36(RSInterface.SETTING_CONFIGS[20], config.getStatus(ConfigType.DISPLAY_COMBAT_TIMERS) ? 1 : 0);
  589. RSInterface.interfaceCache[25017].message = "Crowns: " + crownState.getTitle();
  590. }
  591.  
  592. public byte[] fileToByteArray(int cacheIndex, int index) {
  593. try {
  594. if (indexLocation(cacheIndex, index).length() <= 0 || indexLocation(cacheIndex, index) == null) {
  595. return null;
  596. }
  597. File file = new File(indexLocation(cacheIndex, index));
  598. byte[] fileData = new byte[(int) file.length()];
  599. FileInputStream fis = new FileInputStream(file);
  600. fis.read(fileData);
  601. fis.close();
  602. return fileData;
  603. } catch (Exception e) {
  604. return null;
  605. }
  606. }
  607.  
  608. public static String capitalize(String s) {
  609. return s.length() > 0 ? Character.toUpperCase(s.charAt(0)) + s.substring(1) : s;
  610. }
  611.  
  612. private static String combatDiffColor(int myCombatLevel, int targetCombatLevel) {
  613. int difference = myCombatLevel - targetCombatLevel;
  614.  
  615. if (difference < -9) {
  616. return "@red@";
  617. }
  618.  
  619. if (difference < -6) {
  620. return "@or3@";
  621. }
  622.  
  623. if (difference < -3) {
  624. return "@or2@";
  625. }
  626.  
  627. if (difference < 0) {
  628. return "@or1@";
  629. }
  630.  
  631. if (difference > 9) {
  632. return "@gre@";
  633. }
  634.  
  635. if (difference > 6) {
  636. return "@gr3@";
  637. }
  638.  
  639. if (difference > 3) {
  640. return "@gr2@";
  641. }
  642.  
  643. if (difference > 0) {
  644. return "@gr1@";
  645. }
  646.  
  647. return "@yel@";
  648. }
  649.  
  650. private static final boolean constructMusic() {
  651. anInt720 = 20;
  652.  
  653. try {
  654. aClass56_749 = new Class56_Sub1_Sub1();
  655. } catch (Throwable throwable) {
  656. return false;
  657. }
  658.  
  659. return true;
  660. }
  661.  
  662. public static String formatValue(double value, int digits) {
  663. PlayerHandler.format.setMaximumFractionDigits(digits);
  664. return PlayerHandler.format.format(value);
  665. }
  666.  
  667. private static final void handleSounds() {
  668. if (aClass5_932 != null) {
  669. long l = System.currentTimeMillis();
  670.  
  671. if (l > aLong1432) {
  672. aClass5_932.method489(l);
  673. int i_0_ = (int) (-aLong1432 + l);
  674. aLong1432 = l;
  675.  
  676. synchronized (Client.aClass1418 != null ? Client.aClass1418 : (Client.aClass1418 = new Sound())) {
  677. anInt1526 += anInt197 * i_0_;
  678. int i_1_ = (anInt1526 - anInt197 * 2000) / 1000;
  679.  
  680. if (i_1_ > 0) {
  681. if (aClass3_Sub7_1345 != null) {
  682. aClass3_Sub7_1345.method380(i_1_);
  683. }
  684.  
  685. anInt1526 -= i_1_ * 1000;
  686. }
  687. }
  688. }
  689. }
  690. }
  691.  
  692. private static String intToKOrMil(int value) {
  693. if (value < 0x186a0) {
  694. return String.valueOf(value);
  695. }
  696.  
  697. if (value < 0x989680) {
  698. return value / 1000 + "K";
  699. } else {
  700. return value / 0xf4240 + "M";
  701. }
  702. }
  703.  
  704. private static String intToKOrMilLongName(int i) {
  705. String s = String.valueOf(i);
  706.  
  707. for (int k = s.length() - 3; k > 0; k -= 3) {
  708. s = s.substring(0, k) + "," + s.substring(k);
  709. }
  710.  
  711. if (s.length() > 8) {
  712. s = "@gre@" + s.substring(0, s.length() - 8) + " million @whi@(" + s + ")";
  713. } else if (s.length() > 4) {
  714. s = "@cya@" + s.substring(0, s.length() - 4) + "K @whi@(" + s + ")";
  715. }
  716.  
  717. return " " + s;
  718. }
  719.  
  720. public static ZamorakFrame jFrame;
  721.  
  722. public static void main(String[] args) throws FileNotFoundException {
  723. portOff = 0;
  724. // setHighDetail();
  725. isMembers = true;
  726. Signlink.storeid = 32;
  727. try {
  728. Signlink.startpriv(InetAddress.getLocalHost());
  729. } catch (UnknownHostException e) {
  730. System.err.printf("Unable to determine localhost for your machine [localhost=%s]%n", e.getMessage());
  731. }
  732. GameFrame.setScreenMode(ScreenMode.FIXED);
  733. instance = new Client();
  734. jFrame = new ZamorakFrame(args);
  735. // instance.createClientFrame(clientWidth, clientHeight);
  736. }
  737.  
  738. public static Client getClient() {
  739. return instance;
  740. }
  741.  
  742. private static final int method1004(int i) {
  743. return (int) (Math.log(i * 0.00390625) * 868.5889638065036 + 0.5);
  744. }
  745.  
  746. private static final void method368(int i) {
  747. if (aClass56_749 != null) {
  748. if (anInt478 < i) {
  749. if (anInt720 > 0) {
  750. anInt720--;
  751.  
  752. if (anInt720 == 0) {
  753. if (aByteArray347 == null) {
  754. aClass56_749.method831(256);
  755. } else {
  756. aClass56_749.method831(anInt1478);
  757. anInt478 = anInt1478;
  758. aClass56_749.method827(anInt1478, aByteArray347, 0, aBoolean475);
  759. aByteArray347 = null;
  760. }
  761.  
  762. anInt155 = 0;
  763. }
  764. }
  765. } else if (anInt720 > 0) {
  766. anInt155 += anInt2200;
  767. aClass56_749.method830(anInt478, anInt155);
  768. anInt720--;
  769.  
  770. if (anInt720 == 0) {
  771. aClass56_749.method833();
  772. anInt720 = 20;
  773. anInt478 = -1;
  774. }
  775. }
  776.  
  777. aClass56_749.method832(i - 122);
  778. }
  779. }
  780.  
  781. private static final Class3_Sub7_Sub1 method407(Component component) {
  782. Client.method509(component);
  783. Class3_Sub7_Sub1 class3_sub7_sub1 = new Class3_Sub7_Sub1();
  784. method484(class3_sub7_sub1);
  785. return class3_sub7_sub1;
  786. }
  787.  
  788. private static final synchronized void method484(Class3_Sub7 class3_sub7) {
  789. aClass3_Sub7_1345 = class3_sub7;
  790. }
  791.  
  792. public static final synchronized void method486(int[] is, int i) {
  793. int i_2_ = 0;
  794. i -= 7;
  795.  
  796. while (i_2_ < i) {
  797. is[i_2_++] = 0;
  798. is[i_2_++] = 0;
  799. is[i_2_++] = 0;
  800. is[i_2_++] = 0;
  801. is[i_2_++] = 0;
  802. is[i_2_++] = 0;
  803. is[i_2_++] = 0;
  804. is[i_2_++] = 0;
  805. }
  806.  
  807. i += 7;
  808.  
  809. while (i_2_ < i) {
  810. is[i_2_++] = 0;
  811. }
  812.  
  813. if (aClass3_Sub7_1345 != null) {
  814. aClass3_Sub7_1345.method378(is, 0, i);
  815. }
  816.  
  817. method689(i);
  818. }
  819.  
  820. private static final synchronized void method49() {
  821. if (musicIsntNull()) {
  822. if (fetchMusic) {
  823. byte[] is = musicData;
  824.  
  825. if (is != null) {
  826. if (anInt116 >= 0) {
  827. method684(aBoolean995, anInt116, musicVolume2, is);
  828. } else if (anInt139 >= 0) {
  829. method899(anInt139, -1, aBoolean995, is, musicVolume2);
  830. } else {
  831. method853(musicVolume2, is, aBoolean995);
  832. }
  833.  
  834. fetchMusic = false;
  835. }
  836. }
  837.  
  838. method368(0);
  839. }
  840. }
  841.  
  842. public static final synchronized void method493(int i) {
  843. if (aClass3_Sub7_1345 != null) {
  844. aClass3_Sub7_1345.method380(i);
  845. }
  846.  
  847. method689(i);
  848. }
  849.  
  850. private static final void method509(Component component) {
  851. try {
  852. Class5_Sub2 class5_sub2 = new Class5_Sub2_Sub2();
  853. class5_sub2.method502(2048);
  854. aClass5_932 = class5_sub2;
  855. } catch (Throwable throwable) {
  856. try {
  857. aClass5_932 = new Class5_Sub2_Sub1(component);
  858. } catch (Throwable throwable_16_) {
  859. do {
  860. if (System.getProperty("java.vendor").toLowerCase().indexOf("microsoft") >= 0) {
  861. try {
  862. aClass5_932 = new Class5_Sub1();
  863. } catch (Throwable throwable_17_) {
  864. break;
  865. }
  866.  
  867. return;
  868. }
  869. } while (false);
  870.  
  871. aClass5_932 = new Class5(8000);
  872. }
  873. }
  874. }
  875.  
  876. private static final synchronized void method55(boolean bool) {
  877. if (musicIsntNull()) {
  878. method891(bool);
  879. fetchMusic = false;
  880. }
  881. }
  882.  
  883. public static final int method670(int i, int i_0_) {
  884. if (i > i_0_) {
  885. int i_2_ = i_0_;
  886. i_0_ = i;
  887. i = i_2_;
  888. }
  889.  
  890. for (int i_3_; i != 0; i = i_3_) {
  891. i_3_ = i_0_ % i;
  892. i_0_ = i;
  893. }
  894.  
  895. return i_0_;
  896. }
  897.  
  898. private static final void method684(boolean bool, int i, int i_2_, byte[] is) {
  899. if (aClass56_749 != null) {
  900. if (anInt478 >= 0) {
  901. anInt2200 = i;
  902.  
  903. if (anInt478 != 0) {
  904. int i_4_ = method1004(anInt478);
  905. i_4_ -= anInt155;
  906. anInt720 = (i_4_ + 3600) / i;
  907.  
  908. if (anInt720 < 1) {
  909. anInt720 = 1;
  910. }
  911. } else {
  912. anInt720 = 1;
  913. }
  914.  
  915. aByteArray347 = is;
  916. anInt1478 = i_2_;
  917. aBoolean475 = bool;
  918. } else if (anInt720 == 0) {
  919. method853(i_2_, is, bool);
  920. } else {
  921. anInt1478 = i_2_;
  922. aBoolean475 = bool;
  923. aByteArray347 = is;
  924. }
  925. }
  926. }
  927.  
  928. private static final void method689(int i) {
  929. Client.anInt1408 += i;
  930.  
  931. while (Client.anInt1408 >= Client.anInt197) {
  932. Client.anInt1408 -= Client.anInt197;
  933. anInt1526 -= anInt1526 >> 2;
  934. }
  935.  
  936. anInt1526 -= i * 1000;
  937.  
  938. if (anInt1526 < 0) {
  939. anInt1526 = 0;
  940. }
  941. }
  942.  
  943. public static final void method790() {
  944. if (aClass56_749 != null) {
  945. method891(false);
  946.  
  947. if (anInt720 > 0) {
  948. aClass56_749.method831(256);
  949. anInt720 = 0;
  950. }
  951.  
  952. aClass56_749.method828();
  953. aClass56_749 = null;
  954. }
  955. }
  956.  
  957. private static final void method853(int i_2_, byte[] is, boolean bool) {
  958. if (aClass56_749 != null) {
  959. if (anInt478 >= 0) {
  960. aClass56_749.method833();
  961. anInt478 = -1;
  962. aByteArray347 = null;
  963. anInt720 = 20;
  964. anInt155 = 0;
  965. }
  966.  
  967. if (is != null) {
  968. if (anInt720 > 0) {
  969. aClass56_749.method831(i_2_);
  970. anInt720 = 0;
  971. }
  972.  
  973. anInt478 = i_2_;
  974. aClass56_749.method827(i_2_, is, 0, bool);
  975. }
  976. }
  977. }
  978.  
  979. private static final void method891(boolean bool) {
  980. method853(0, null, bool);
  981. }
  982.  
  983. private static final void method899(int i, int i_29_, boolean bool, byte[] is, int i_30_) {
  984. if (aClass56_749 != null) {
  985. if (i_29_ >= (anInt478 ^ 0xffffffff)) {
  986. i -= 20;
  987.  
  988. if (i < 1) {
  989. i = 1;
  990. }
  991.  
  992. anInt720 = i;
  993.  
  994. if (anInt478 == 0) {
  995. anInt2200 = 0;
  996. } else {
  997. int i_31_ = method1004(anInt478);
  998. i_31_ -= anInt155;
  999. anInt2200 = (anInt2200 - 1 + i_31_ + 3600) / anInt2200;
  1000. }
  1001.  
  1002. aBoolean475 = bool;
  1003. aByteArray347 = is;
  1004. anInt1478 = i_30_;
  1005. } else if (anInt720 != 0) {
  1006. aBoolean475 = bool;
  1007. aByteArray347 = is;
  1008. anInt1478 = i_30_;
  1009. } else {
  1010. method853(i_30_, is, bool);
  1011. }
  1012. }
  1013. }
  1014.  
  1015. private static final void method900(int i) {
  1016. if (aClass56_749 != null) {
  1017. if (anInt720 == 0) {
  1018. if (anInt478 >= 0) {
  1019. anInt478 = i;
  1020. aClass56_749.method830(i, 0);
  1021. }
  1022. } else if (aByteArray347 != null) {
  1023. anInt1478 = i;
  1024. }
  1025. }
  1026. }
  1027.  
  1028. private static final boolean musicIsntNull() {
  1029. return aClass56_749 != null;
  1030. }
  1031.  
  1032. private static void setLowDetail() {
  1033. setLowDetail(true);
  1034. WorldController.lowDetail = true;
  1035. Rasterizer.lowDetail = true;
  1036. ObjectManager.lowDetail = true;
  1037. ObjectDefinition.lowDetail = true;
  1038. }
  1039.  
  1040. private static void setHighDetail() {
  1041. setLowDetail(false);
  1042. WorldController.lowDetail = false;
  1043. Rasterizer.lowDetail = false;
  1044. ObjectManager.lowDetail = false;
  1045. ObjectDefinition.lowDetail = false;
  1046. }
  1047.  
  1048. public static void setTab(int id) {
  1049. tabID = id;
  1050. tabAreaAltered = true;
  1051. }
  1052.  
  1053. private static final void setVolume(int i) {
  1054. if (musicIsntNull()) {
  1055. if (fetchMusic) {
  1056. musicVolume2 = i;
  1057. } else {
  1058. method900(i);
  1059. }
  1060. }
  1061. }
  1062.  
  1063. public static final void sleep(long time) {
  1064. if (time > 0L) {
  1065. if (time % 10L != 0L) {
  1066. threadSleep(time);
  1067. } else {
  1068. threadSleep(time - 1L);
  1069. threadSleep(1L);
  1070. }
  1071. }
  1072. }
  1073.  
  1074. private static final void threadSleep(long time) {
  1075. try {
  1076. Thread.sleep(time);
  1077. } catch (InterruptedException ex) {
  1078. }
  1079. }
  1080.  
  1081. private boolean aBoolean1017;
  1082. private boolean aBoolean1031;
  1083. public boolean aBoolean1047;
  1084. private boolean aBoolean1080;
  1085. private boolean aBoolean1141;
  1086. public boolean dialogueOptionsShowing;
  1087. private boolean aBoolean1159;
  1088. private boolean cameraViewChanged;
  1089. private boolean aBoolean1242;
  1090. private volatile boolean aBoolean831;
  1091. private final boolean aBoolean848;
  1092. private boolean httpFallback;
  1093. public boolean aBoolean954;
  1094. private boolean aBoolean972;
  1095. private final boolean aBoolean994;
  1096. private final boolean[] aBooleanArray876;
  1097. private byte[] aByteArray912;
  1098. private byte[][] aByteArrayArray1183;
  1099. private byte[][] aByteArrayArray1247;
  1100. private CollisionMap[] aClass11Array1230;
  1101. private Deque aClass19_1013;
  1102. private Deque aClass19_1056;
  1103. private Deque aClass19_1179;
  1104. private Sprite aClass30_Sub2_Sub1_Sub1_931;
  1105. private Sprite aClass30_Sub2_Sub1_Sub1_932;
  1106. public Sprite[] aClass30_Sub2_Sub1_Sub1Array1140;
  1107. private final RSInterface aClass9_1059;
  1108. private int activeInterfaceType;
  1109. private long aLong824;
  1110. private long aLong953;
  1111. public String amountOrNameInput;
  1112. public int timeSinceLastPacket;
  1113. private int keepAlive;
  1114. public int idleStatus;
  1115. private int currentCameraDisplayX;
  1116. private int currentCameraDisplayY;
  1117. private int anInt1016;
  1118. private int walkableInterface;
  1119. public int anInt1021;
  1120. private int anInt1026;
  1121. private int anInt1036;
  1122. private int anInt1037;
  1123. private int anInt1039;
  1124. private int anInt1044;// 377
  1125. private int anInt1046;
  1126. private int anInt1048;
  1127. public int anInt1054;
  1128. public int anInt1055;
  1129. private int anInt1069;
  1130. private int anInt1070;
  1131. public int anInt1071;
  1132. private int anInt1079;
  1133. private int anInt1084;
  1134. private int anInt1085;
  1135. private int anInt1087;
  1136. private int anInt1088;
  1137. private int spinPacketX;
  1138. private int spinPacketY;
  1139. private int spinPacketHeight;
  1140. private int spinPacketConstantSpeed;
  1141. private int spinPacketVariableSpeed;
  1142. public int systemUpdateTimer;
  1143. private int anInt1129;// 377
  1144. private int anInt1137;
  1145. private int cameraRotationZ;
  1146. private int cameraRotationLeft;
  1147. private int cameraRotationRight;
  1148. private int anInt1193;
  1149. private int anInt1213;
  1150. public int anInt1222;
  1151. private int anInt1249;
  1152. private int anInt1251;
  1153. private int anInt1253;
  1154. private int anInt1264;
  1155. private int anInt1265;
  1156. private int anInt1268;
  1157. private int anInt1269;
  1158. private int anInt1283;
  1159. private int anInt1284;
  1160. private int anInt1285;
  1161. private int anInt1315;// 377
  1162. private int anInt1500;// 377
  1163. private int anInt1501;// 377
  1164. private int anInt839;
  1165. public int anInt841;
  1166. public int anInt842;
  1167. public int anInt843;
  1168. public int anInt855;
  1169. private int anInt886;
  1170. private int anInt893;
  1171. private int anInt900;
  1172. private int anInt913;
  1173. public int anInt933;
  1174. public int anInt934;
  1175. public int anInt935;
  1176. private int anInt936;
  1177. private int anInt937;
  1178. private int anInt938;
  1179. private int anInt945;
  1180. private final int anInt975;
  1181. private int anInt984;
  1182. private int anInt985;
  1183. private int anInt989;
  1184. private int moveCameraX;
  1185. private int moveCameraY;
  1186. private int moveCameraZ;
  1187. private int moveCameraSpeed;
  1188. private int moveCameraAngle;
  1189. private final int[] anIntArray1030;
  1190. private final int[] settings;
  1191. private final int[] anIntArray1065;
  1192. public int[] anIntArray1072;
  1193. public int[] anIntArray1073;
  1194. private final int[] anIntArray1177 = { 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3 };
  1195. public int[] anIntArray1180;
  1196. public int[] anIntArray1181;
  1197. public int[] anIntArray1182;
  1198. private final int[] anIntArray1203;
  1199. private int[] anIntArray1234;
  1200. private int[] anIntArray840;
  1201. private final int[] anIntArray873;
  1202. private int[] anIntArray894;
  1203. private final int[] anIntArray928;
  1204. private final int[] anIntArray965 = { 0xffff00, 0xff0000, 65280, 65535, 0xff00ff, 0xffffff };
  1205. private final int[] anIntArray976;
  1206. private final int[] anIntArray977;
  1207. private final int[] anIntArray978;
  1208. private final int[] anIntArray979;
  1209. private final int[] anIntArray980;
  1210. private final int[] anIntArray981;
  1211. private final int[] anIntArray982;
  1212. public final int[] anIntArray990;
  1213. private int[][] anIntArrayArray825;
  1214. private int[][] anIntArrayArray901;
  1215. private int[][] anIntArrayArray929;
  1216. private final int[][][] anIntArrayArrayArray1129;
  1217. private GraphicsBuffer aRSImageProducer_1107;
  1218. private GraphicsBuffer aRSImageProducer_1125;
  1219. private Socket aSocket832;
  1220. private ByteBuffer aStream_834;
  1221. private ByteBuffer[] aStreamArray895s;
  1222. private String[] startupMessage = new String[2];
  1223. public String aString844;
  1224. private final String[] aStringArray983;
  1225. private int atInventoryIndex;
  1226. private int atInventoryInterface;
  1227. private int atInventoryInterfaceType;
  1228. private int atInventoryLoopCycle;
  1229. public final String[] atPlayerActions;
  1230. public final boolean[] atPlayerArray;
  1231. private boolean autocast = false;
  1232. private int autocastId = 0;
  1233. public int backDialogID;
  1234. public int baseX;
  1235. public int baseY;
  1236. private int[] bigX;
  1237. private int[] bigY;
  1238. private byte[][][] byteGroundArray;
  1239. private int cameraOffsetX;
  1240. private int cameraOffsetY;
  1241. public int cButtonCPos;
  1242. public int cButtonHPos;
  1243. ChatArea chatArea = new ChatArea(0, 338, 516, 150);
  1244. public GraphicsBuffer chatAreaIP;
  1245. public String[] chatMessages;
  1246. public String[] chatNames;
  1247. public String[] chatTitles;
  1248. public int[] chatPosition;
  1249. public final int[] chatRights;
  1250. public TextDrawingArea chatTextDrawingArea;
  1251. public int[] chatTypes;
  1252. public int chatTypeView;
  1253. public String[] clanMembers = new String[100];
  1254. public String clanName;
  1255. public Sprite compass;
  1256. public final int[] compassArray1;
  1257. public final int[] compassArray2;
  1258. private Connection connection;
  1259. private ISAACCipher connectionCipher;
  1260. private final CRC32 crc32Instance;
  1261. private Sprite[] crosses;
  1262. private int crossIndex;
  1263. private int crossType;
  1264. private int crossX;
  1265. private int crossY;
  1266. public final int[] currentExp;
  1267. private int currentSong;
  1268. public final int[] currentStats;
  1269. private int daysSinceLastLogin;
  1270. private int daysSinceRecovChange;
  1271. private boolean debugMode = false;
  1272. public final Decompressor[] decompressors;
  1273. public int destX;
  1274. public int destY;
  1275. public int dialogID;
  1276. private int drawCount;
  1277. private volatile boolean drawFlames;
  1278. private volatile boolean drawingFlames;
  1279. private int energy;
  1280. private final int[] expectedCRCs;
  1281. private int[] floorMap;
  1282. private String floorMaps = "";
  1283. public int friendCount;
  1284. private String[] friendsList;
  1285. private int friendsListAction;
  1286. public long[] friendsListAsLongs;
  1287. public int[] friendsNodeIDs;
  1288. private int fullscreenInterfaceID;
  1289. int[] fullScreenTextureArray;
  1290. private int gameAreaWidth = 512, gameAreaHeight = 334;
  1291. private boolean gameFrameVisible = true;
  1292. public GraphicsBuffer gameScreenIP;
  1293. public Deque[][][] groundArray;
  1294. private Sprite[] headIcons;
  1295. private Sprite[] headIconsHint;
  1296. private Sprite[] hitMarks;
  1297. private int ignoreCount;
  1298. private final long[] ignoreListAsLongs;
  1299. private ByteBuffer inputBuffer;
  1300. public int inputDialogState;
  1301. public String inputString;
  1302. private boolean inputTaken;
  1303. private int interfaceButtonAction = 0;
  1304. private int[][][] intGroundArray;
  1305. public int invOverlayInterfaceID;
  1306. public int itemSelected;
  1307. private int lastActiveInvInterface;
  1308. private GraphicsBuffer leftFrame;
  1309. private boolean loadingError;
  1310. public int loadingStage;
  1311. public static boolean loggedIn;
  1312. private ByteBuffer loginBuffer;
  1313. private int loginFailures;
  1314. private String loginMessage1;
  1315. private String loginMessage2;
  1316. private int loginScreenCursorPos;
  1317. private int loginScreenState;
  1318. private int loginState = -1;
  1319. private final MapArea mapArea = new MapArea(519, 0, 0, 0);
  1320. public GraphicsBuffer mapAreaIP;
  1321. private Background mapBack;
  1322. public Sprite mapDotClan;
  1323. public Sprite mapDotFriend;
  1324. public Sprite mapDotItem;
  1325. public Sprite mapDotNPC;
  1326. public Sprite mapDotPlayer;
  1327. public Sprite mapDotTeam;
  1328. private Sprite mapEdge;
  1329. public Sprite mapFlag;
  1330. private Sprite[] mapFunctions;
  1331. public final int[] mapImagePixelCutLeft;
  1332. public final int[] mapImagePixelCutRight;
  1333. public Sprite mapMarker;
  1334. private Background[] mapScenes;
  1335. private final int maxPlayers;
  1336. private final int[] maxStats;
  1337. private int membersInt;
  1338. private int[] menuActionCmd1;
  1339. private int[] menuActionCmd2;
  1340. private int[] menuActionCmd3;
  1341. public int[] menuActionID;
  1342. public String[] menuActionName;
  1343. public String[] menuActionTitle;
  1344. public int[] menuActionColor;
  1345. public int menuActionRow;
  1346. private int menuHeight;
  1347. private int menuOffsetX;
  1348. private int menuOffsetY;
  1349. public boolean menuOpen;
  1350. public int menuScreenArea;
  1351. private int menuWidth;
  1352. private String message;
  1353. public boolean messagePromptRaised;
  1354. public Sprite miniMapRegions;
  1355. public int minimapRotation;
  1356. public int minimapZoom;
  1357. public final Sprite[] modIcons;
  1358. public MouseDetection mouseDetection;
  1359. private int mouseInvInterfaceIndex;
  1360. private Sprite[] multiOverlay = new Sprite[2];
  1361. private int musicVolume = 255;
  1362. private final int myPlayerIndex;
  1363. public int myRights;
  1364. private String name;
  1365. RSFontSystem newFancyFont;
  1366. public RSFontSystem newSmallFont, newRegularFont, newBoldFont;
  1367. private int nextSong;
  1368. public TextDrawingArea normalText;
  1369. public NPC[] npcArray;
  1370. public int npcCount;
  1371. public int[] npcIndices;
  1372. private int[] objectMap;
  1373. private String objectMaps = "";
  1374. public OnDemandFetcher onDemandFetcher;
  1375. private String password;
  1376. public int pktSize;
  1377. public int currentPacketOpcode;
  1378. public int plane;
  1379. public Player[] playerArray;
  1380. public int playerCount;
  1381. public int[] playerIndices;
  1382. private int prevSong;
  1383. public int privateChatMode;
  1384. public String promptInput;
  1385. public String promptMessage;
  1386. public int publicChatMode;
  1387. public int reportAbuseInterfaceID;
  1388. private GraphicsBuffer rightFrame;
  1389. private int rights;
  1390. private boolean running;
  1391. private ScriptManager scriptManager;
  1392. private final Sprite[] scrollBar;
  1393. private final Sprite[] scrollPart;
  1394. private String selectedItemName;
  1395. private long serverSeed;
  1396. public Sprite[] sideIcons;
  1397. private Sprite[] skullIcons;
  1398. public TextDrawingArea smallText;
  1399. private final int[] sound;
  1400. public int soundCount;
  1401. private final int[] soundDelay;
  1402. private final int[] soundType;
  1403. public int spellSelected;
  1404. private String spellTooltip;
  1405. private int spellUsableOn;
  1406. public int splitPrivateChat;
  1407. private int spriteDrawX;
  1408. private int spriteDrawY;
  1409. public TabArea tabArea = new TabArea(516, 168, 250, 335);
  1410. public GraphicsBuffer tabAreaIP;
  1411. public int terrainRegionX;
  1412. public int terrainRegionY;
  1413. private int titleHeight = -1;
  1414. private GraphicsBuffer titleScreenIP;
  1415. private int[] titleScreenOffsets = null;
  1416. private Archive titleStreamLoader;
  1417. private int titleWidth = -1;
  1418. private GraphicsBuffer topFrame;
  1419. public int tradeMode;
  1420. private int playerIndex;
  1421. private int unreadMessages;
  1422. public int variousSettings[];
  1423. public int viewRotation;
  1424. private int viewRotationOffset;
  1425. private int weight;
  1426. private boolean welcomeScreenRaised;
  1427. private WorldController worldController;
  1428. public int xCameraCurve;
  1429. public int xCameraPos;
  1430. public int yCameraCurve;
  1431. public int yCameraPos;
  1432. public int zCameraPos;
  1433. private boolean fpsOn;
  1434. private int lastPercent;
  1435.  
  1436. public void resetMap2() {
  1437. aBoolean1080 = false;
  1438. }
  1439.  
  1440. public void resetMap1() {
  1441. soundCount = 0;
  1442. cameraOffsetX = (int) (Math.random() * 100D) - 50;
  1443. cameraOffsetY = (int) (Math.random() * 110D) - 55;
  1444. viewRotationOffset = (int) (Math.random() * 80D) - 40;
  1445. minimapRotation = (int) (Math.random() * 120D) - 60;
  1446. minimapZoom = (int) (Math.random() * 30D) - 20;
  1447. viewRotation = (int) (Math.random() * 20D) - 10 & 0x7ff;
  1448. anInt1021 = 0;
  1449. loadingStage = 1;
  1450. }
  1451.  
  1452. public void loadMap(int l2, int i11) {
  1453. mapX = l2;
  1454. mapY = i11;
  1455. aBoolean1159 = false;
  1456. if (anInt1069 == l2 && anInt1070 == i11 && loadingStage == 2) {
  1457. return;
  1458. }
  1459. anInt1069 = l2;
  1460. anInt1070 = i11;
  1461. baseX = (anInt1069 - 6) * 8;
  1462. baseY = (anInt1070 - 6) * 8;
  1463. aBoolean1141 = (anInt1069 / 8 == 48 || anInt1069 / 8 == 49) && anInt1070 / 8 == 48;
  1464. if (anInt1069 / 8 == 48 && anInt1070 / 8 == 148) {
  1465. aBoolean1141 = true;
  1466. }
  1467. loadingStage = 1;
  1468. aLong824 = System.currentTimeMillis();
  1469. int k16 = 0;
  1470. for (int i21 = (anInt1069 - 6) / 8; i21 <= (anInt1069 + 6) / 8; i21++) {
  1471. for (int k23 = (anInt1070 - 6) / 8; k23 <= (anInt1070 + 6) / 8; k23++) {
  1472. k16++;
  1473. }
  1474. }
  1475. aByteArrayArray1183 = new byte[k16][];
  1476. aByteArrayArray1247 = new byte[k16][];
  1477. anIntArray1234 = new int[k16];
  1478. floorMap = new int[k16];
  1479. objectMap = new int[k16];
  1480. k16 = 0;
  1481. for (int l23 = (anInt1069 - 6) / 8; l23 <= (anInt1069 + 6) / 8; l23++) {
  1482. for (int j26 = (anInt1070 - 6) / 8; j26 <= (anInt1070 + 6) / 8; j26++) {
  1483. anIntArray1234[k16] = (l23 << 8) + j26;
  1484. if (aBoolean1141 && (j26 == 49 || j26 == 149 || j26 == 147 || l23 == 50 || l23 == 49 && j26 == 47)) {
  1485. floorMap[k16] = -1;
  1486. objectMap[k16] = -1;
  1487. k16++;
  1488. } else {
  1489. int k28 = floorMap[k16] = onDemandFetcher.getMapCount(0, j26, l23);
  1490. if (k28 != -1) {
  1491. onDemandFetcher.requestFileData(3, k28);
  1492. }
  1493. int j30 = objectMap[k16] = onDemandFetcher.getMapCount(1, j26, l23);
  1494. if (j30 != -1) {
  1495. onDemandFetcher.requestFileData(3, j30);
  1496. }
  1497. k16++;
  1498. }
  1499. }
  1500. }
  1501. int i17 = baseX - anInt1036;
  1502. int j21 = baseY - anInt1037;
  1503. anInt1036 = baseX;
  1504. anInt1037 = baseY;
  1505. for (int j24 = 0; j24 < 16384; j24++) {
  1506. NPC npc = npcArray[j24];
  1507. if (npc != null) {
  1508. for (int j29 = 0; j29 < 10; j29++) {
  1509. npc.smallX[j29] -= i17;
  1510. npc.smallY[j29] -= j21;
  1511. }
  1512. npc.x -= i17 * 128;
  1513. npc.y -= j21 * 128;
  1514. }
  1515. }
  1516. for (int i27 = 0; i27 < maxPlayers; i27++) {
  1517. Player player = playerArray[i27];
  1518. if (player != null) {
  1519. for (int i31 = 0; i31 < 10; i31++) {
  1520. player.smallX[i31] -= i17;
  1521. player.smallY[i31] -= j21;
  1522. }
  1523. player.x -= i17 * 128;
  1524. player.y -= j21 * 128;
  1525. }
  1526. }
  1527. aBoolean1080 = true;
  1528. byte byte1 = 0;
  1529. byte byte2 = 104;
  1530. byte byte3 = 1;
  1531. if (i17 < 0) {
  1532. byte1 = 103;
  1533. byte2 = -1;
  1534. byte3 = -1;
  1535. }
  1536. byte byte4 = 0;
  1537. byte byte5 = 104;
  1538. byte byte6 = 1;
  1539. if (j21 < 0) {
  1540. byte4 = 103;
  1541. byte5 = -1;
  1542. byte6 = -1;
  1543. }
  1544. for (int k33 = byte1; k33 != byte2; k33 += byte3) {
  1545. for (int l33 = byte4; l33 != byte5; l33 += byte6) {
  1546. int i34 = k33 + i17;
  1547. int j34 = l33 + j21;
  1548. for (int k34 = 0; k34 < 4; k34++)
  1549. if (i34 >= 0 && j34 >= 0 && i34 < 104 && j34 < 104)
  1550. groundArray[k34][k33][l33] = groundArray[k34][i34][j34];
  1551. else
  1552. groundArray[k34][k33][l33] = null;
  1553. }
  1554. }
  1555. if (aClass19_1179 != null)
  1556. for (GameObject gameObject = (GameObject) aClass19_1179.popHead(); gameObject != null; gameObject = (GameObject) aClass19_1179.getNext()) {
  1557. gameObject.anInt1297 -= i17;
  1558. gameObject.anInt1298 -= j21;
  1559. if (gameObject.anInt1297 < 0 || gameObject.anInt1298 < 0 || gameObject.anInt1297 >= 104 || gameObject.anInt1298 >= 104)
  1560. gameObject.unlink();
  1561. }
  1562. if (destX != 0) {
  1563. destX -= i17;
  1564. destY -= j21;
  1565. }
  1566. cameraViewChanged = false;
  1567. }
  1568.  
  1569. public Client() {
  1570. accountManager = new AccountManager(this);
  1571. new TimedTaskHandler(this);
  1572. menuActionCmd4 = new int[500];
  1573. setFullscreenInterfaceID(-1);
  1574. chatRights = new int[500];
  1575. chatTypeView = 0;
  1576. cButtonHPos = -1;
  1577. cButtonCPos = 0;
  1578. anIntArrayArray825 = new int[104][104];
  1579. crc32Instance = new CRC32();
  1580. groundArray = new Deque[4][104][104];
  1581. aBoolean831 = false;
  1582. aStream_834 = new ByteBuffer(new byte[5000]);
  1583. npcArray = new NPC[50000];
  1584. npcIndices = new int[50000];
  1585. anIntArray840 = new int[1000];
  1586. setLoginBuffer(ByteBuffer.create());
  1587. aBoolean848 = true;
  1588. openInterfaceID = -1;
  1589. currentExp = new int[Skills.SKILL_COUNT];
  1590. httpFallback = false;
  1591. anIntArray873 = new int[5];
  1592. aBooleanArray876 = new boolean[5];
  1593. drawFlames = false;
  1594. playerIndex = -1;
  1595. menuOpen = false;
  1596. inputString = "";
  1597. maxPlayers = 2048;
  1598. myPlayerIndex = 2047;
  1599. friendsNodeIDs = new int[200];
  1600. playerArray = new Player[getMaxPlayers()];
  1601. playerIndices = new int[getMaxPlayers()];
  1602. anIntArray894 = new int[getMaxPlayers()];
  1603. setaStreamArray895s(new ByteBuffer[getMaxPlayers()]);
  1604. anIntArrayArray901 = new int[104][104];
  1605. aByteArray912 = new byte[16384];
  1606. currentStats = new int[Skills.SKILL_COUNT];
  1607. ignoreListAsLongs = new long[100];
  1608. loadingError = false;
  1609. anIntArray928 = new int[5];
  1610. anIntArrayArray929 = new int[104][104];
  1611. chatTypes = new int[500];
  1612. chatNames = new String[500];
  1613. chatMessages = new String[500];
  1614. chatTitles = new String[500];
  1615. chatPosition = new int[500];
  1616. Arrays.fill(chatTitles, "");
  1617. Arrays.fill(chatPosition, 0);
  1618. Arrays.fill(chatColor, 0);
  1619. sideIcons = new Sprite[15];
  1620. aBoolean954 = true;
  1621. friendsListAsLongs = new long[200];
  1622. friendsList = new String[200];
  1623. currentSong = -1;
  1624. drawingFlames = false;
  1625. spriteDrawX = -1;
  1626. spriteDrawY = -1;
  1627. compassArray1 = new int[33];
  1628. decompressors = new Decompressor[CACHE_INDEX_COUNT];
  1629. variousSettings = new int[2000];
  1630. aBoolean972 = false;
  1631. anInt975 = 50;
  1632. anIntArray976 = new int[anInt975];
  1633. anIntArray977 = new int[anInt975];
  1634. anIntArray978 = new int[anInt975];
  1635. anIntArray979 = new int[anInt975];
  1636. anIntArray980 = new int[anInt975];
  1637. anIntArray981 = new int[anInt975];
  1638. anIntArray982 = new int[anInt975];
  1639. aStringArray983 = new String[anInt975];
  1640. setAnInt985(-1);
  1641. hitMarks = new Sprite[20];
  1642. anIntArray990 = new int[5];
  1643. aBoolean994 = false;
  1644. amountOrNameInput = "";
  1645. setaClass19_1013(new Deque());
  1646. aBoolean1017 = false;
  1647. setWalkableInterface(-1);
  1648. anIntArray1030 = new int[5];
  1649. aBoolean1031 = false;
  1650. mapFunctions = new Sprite[100];
  1651. dialogID = -1;
  1652. maxStats = new int[Skills.SKILL_COUNT];
  1653. settings = new int[5000]; // use up from 2000 for custom client configs
  1654. aBoolean1047 = true;
  1655. mapImagePixelCutLeft = new int[152];
  1656. anInt1054 = -1;
  1657. setaClass19_1056(new Deque());
  1658. compassArray2 = new int[33];
  1659. aClass9_1059 = new RSInterface();
  1660. mapScenes = new Background[100];
  1661. anIntArray1065 = new int[7];
  1662. anIntArray1072 = new int[1000];
  1663. anIntArray1073 = new int[1000];
  1664. aBoolean1080 = false;
  1665. setInputBuffer(ByteBuffer.create());
  1666. expectedCRCs = new int[9];
  1667. menuActionCmd2 = new int[500];
  1668. menuActionCmd3 = new int[500];
  1669. menuActionID = new int[500];
  1670. menuActionCmd1 = new int[500];
  1671. headIcons = new Sprite[20];
  1672. skullIcons = new Sprite[7];
  1673. headIconsHint = new Sprite[20];
  1674. scrollPart = new Sprite[12];
  1675. scrollBar = new Sprite[6];
  1676. tabAreaAltered = false;
  1677. promptMessage = "";
  1678. atPlayerActions = new String[5];
  1679. atPlayerArray = new boolean[5];
  1680. anIntArrayArrayArray1129 = new int[4][13][13];
  1681. aClass30_Sub2_Sub1_Sub1Array1140 = new Sprite[1000];
  1682. aBoolean1141 = false;
  1683. dialogueOptionsShowing = false;
  1684. crosses = new Sprite[8];
  1685. loggedIn = false;
  1686. aBoolean1159 = false;
  1687. cameraViewChanged = false;
  1688. setMyUsername("");
  1689. setPassword("");
  1690. reportAbuseInterfaceID = -1;
  1691. setaClass19_1179(new Deque());
  1692. cameraRotationZ = 128;
  1693. invOverlayInterfaceID = -1;
  1694. setOut(ByteBuffer.create());
  1695. menuActionName = new String[500];
  1696. menuActionTitle = new String[500];
  1697. menuActionColor = new int[500];
  1698. anIntArray1203 = new int[5];
  1699. sound = new int[50];
  1700. anInt1211 = 78;
  1701. promptInput = "";
  1702. modIcons = new Sprite[13];
  1703. tabID = 3;
  1704. setInputTaken(false);
  1705. mapImagePixelCutRight = new int[152];
  1706. aClass11Array1230 = new CollisionMap[4];
  1707. soundType = new int[50];
  1708. aBoolean1242 = false;
  1709. soundDelay = new int[50];
  1710. welcomeScreenRaised = false;
  1711. messagePromptRaised = false;
  1712. setLoginMessage1("Enter your username & password.");
  1713. backDialogID = -1;
  1714. consoleInput = "";
  1715. consoleOpen = false;
  1716. consoleMessages = new String[50];
  1717. bigX = new int[4000];
  1718. bigY = new int[4000];
  1719. }
  1720.  
  1721. void drawConsole() {
  1722. if (consoleOpen) {
  1723. DrawingArea.transparentBox(!loggedIn ? getScreenHeight() : 334, 0, 0, 5320850, !loggedIn ? getScreenWidth() : 512, 0, 97);
  1724. DrawingArea.drawPixels(1, 315, 0, 16777215, !loggedIn ? getScreenWidth() : 512);
  1725. newBoldFont.drawBasicString("-->", 11, 328, 16777215, 0);
  1726. // textDrawingArea.method385(16777215,"-->", 11, 328);
  1727. if (loopCycle % 20 < 10) {
  1728. newBoldFont.drawBasicString(consoleInput + "|", 38, 328, 16777215, 0);
  1729. // textDrawingArea.method385(16777215,consoleInput+"|", 38,
  1730. // 328);
  1731. return;
  1732. } else {
  1733. newBoldFont.drawBasicString(consoleInput, 38, 328, 16777215, 0);
  1734. // textDrawingArea.method385(16777215,consoleInput, 38, 328);
  1735. return;
  1736. }
  1737. }
  1738. }
  1739.  
  1740. void drawConsoleArea() {
  1741. if (consoleOpen) {
  1742. for (int i = 0, j = 308; i < 17; i++, j -= 18) {
  1743. if (consoleMessages[i] != null) {
  1744. newRegularFont.drawBasicString(consoleMessages[i], 9, j, 16777215, 0);
  1745. // textDrawingArea.method385(16777215,consoleMessages[i], 9,
  1746. // j);
  1747. }
  1748. }
  1749. }
  1750. }
  1751.  
  1752. public void printConsoleMessage(String s, int i) {
  1753. if (backDialogID == -1) {
  1754. inputTaken = true;
  1755. }
  1756. for (int j = 16; j > 0; j--) {
  1757. consoleMessages[j] = consoleMessages[j - 1];
  1758. }
  1759. if (i == 0) {
  1760. consoleMessages[0] = date() + " " + s;
  1761. } else {
  1762. consoleMessages[0] = s;
  1763. }
  1764. }
  1765.  
  1766. public String date() {
  1767. Date date = new Date();
  1768. SimpleDateFormat sd = new SimpleDateFormat("HH:mm:ss");
  1769. return sd.format(date);
  1770. }
  1771.  
  1772. private void sendCommandPacket(String cmd) {
  1773. if (cmd.equalsIgnoreCase("cls")) {
  1774. for (int j = 0; j < 17; j++) {
  1775. consoleMessages[j] = null;
  1776. }
  1777. }
  1778. /** Add Commands Here **/
  1779. if (loggedIn) {
  1780. getOut().putOpcode(103);
  1781. getOut().putShortBigEndian(cmd.length() + 1);
  1782. getOut().putString(cmd);
  1783. }
  1784. }
  1785.  
  1786. private void addFriend(long nameAsLong) {
  1787. try {
  1788. if (nameAsLong == 0L) {
  1789. return;
  1790. }
  1791.  
  1792. if (friendCount >= 100 && anInt1046 != 1) {
  1793. pushMessage("Your friendlist is full. Max of 100 for free users, and 200 for members", 0, "");
  1794. return;
  1795. }
  1796.  
  1797. if (friendCount >= 200) {
  1798. pushMessage("Your friendlist is full. Max of 100 for free users, and 200 for members", 0, "");
  1799. return;
  1800. }
  1801.  
  1802. String s = TextClass.fixName(TextClass.nameForLong(nameAsLong));
  1803.  
  1804. if (s != null) {
  1805. if (s.indexOf("@") == 0) {
  1806. s = name.substring(5);
  1807. }
  1808. }
  1809.  
  1810. for (int i = 0; i < friendCount; i++) {
  1811. if (friendsListAsLongs[i] == nameAsLong) {
  1812. pushMessage(s + " is already on your friend list", 0, "");
  1813. return;
  1814. }
  1815. }
  1816.  
  1817. for (int i = 0; i < ignoreCount; i++) {
  1818. if (ignoreListAsLongs[i] == nameAsLong) {
  1819. pushMessage("Please remove " + s + " from your ignore list first", 0, "");
  1820. return;
  1821. }
  1822. }
  1823.  
  1824. if (s.equals(myPlayer.name)) {
  1825. return;
  1826. } else {
  1827. friendsList[friendCount] = s;
  1828. friendsListAsLongs[friendCount] = nameAsLong;
  1829. friendsNodeIDs[friendCount] = 0;
  1830. friendCount++;
  1831. getOut().putOpcode(188);
  1832. getOut().putLong(nameAsLong);
  1833. return;
  1834. }
  1835. } catch (RuntimeException ex) {
  1836. Signlink.reportError("15283, " + (byte) 68 + ", " + nameAsLong + ", " + ex.toString());
  1837. ex.printStackTrace();
  1838. }
  1839.  
  1840. throw new RuntimeException();
  1841. }
  1842.  
  1843. private void addIgnore(long nameAsLong) {
  1844. try {
  1845. if (nameAsLong == 0L) {
  1846. return;
  1847. }
  1848.  
  1849. if (ignoreCount >= 100) {
  1850. pushMessage("Your ignore list is full. Max of 100 hit", 0, "");
  1851. return;
  1852. }
  1853.  
  1854. String name = TextClass.fixName(TextClass.nameForLong(nameAsLong));
  1855.  
  1856. if (name != null) {
  1857. if (name.indexOf("@") == 0) {
  1858. name = name.substring(5);
  1859. }
  1860. }
  1861.  
  1862. for (int i = 0; i < ignoreCount; i++) {
  1863. if (ignoreListAsLongs[i] == nameAsLong) {
  1864. pushMessage(name + " is already on your ignore list", 0, "");
  1865. return;
  1866. }
  1867. }
  1868.  
  1869. for (int i = 0; i < friendCount; i++) {
  1870. if (friendsListAsLongs[i] == nameAsLong) {
  1871. pushMessage("Please remove " + name + " from your friend list first", 0, "");
  1872. return;
  1873. }
  1874. }
  1875.  
  1876. ignoreListAsLongs[ignoreCount++] = nameAsLong;
  1877. getOut().putOpcode(133);
  1878. getOut().putLong(nameAsLong);
  1879. return;
  1880. } catch (RuntimeException ex) {
  1881. Signlink.reportError("45688, " + nameAsLong + ", " + 4 + ", " + ex.toString());
  1882. }
  1883.  
  1884. throw new RuntimeException();
  1885. }
  1886.  
  1887. private void build3dScreenMenu() {
  1888. if (itemSelected == 0 && spellSelected == 0) {
  1889. menuActionName[menuActionRow] = "Walk here";
  1890. menuActionID[menuActionRow] = 516;
  1891. menuActionCmd2[menuActionRow] = super.mouseX;
  1892. menuActionCmd3[menuActionRow] = super.mouseY;
  1893. menuActionRow++;
  1894. }
  1895. int j = -1;
  1896. for (int k = 0; k < Model.anInt1687; k++) {
  1897. int modelData = Model.anIntArray1688[k];// data
  1898. int x = modelData & 0x7f;// x
  1899. int y = modelData >> 7 & 0x7f;// y
  1900. int face = modelData >> 29 & 3;// face
  1901. int index = -1;// objId
  1902. if (face != 2) {
  1903. index = modelData >> 14 & 32767;
  1904. }
  1905. if (modelData == j) {
  1906. continue;
  1907. }
  1908. j = modelData;
  1909.  
  1910. // objects
  1911. if (face == 2 && worldController.fetchObjectIDTagForPosition(plane, x, y, modelData) >= 0) {
  1912. index = Model.mapObjIds[k];
  1913. ObjectDefinition class46 = ObjectDefinition.forID(index);
  1914. if (class46.configObjectIDs != null) {
  1915. class46 = class46.method580();
  1916. }
  1917.  
  1918. if ((baseX + x == 3090 && baseY + y == 3956) || (baseX + x == 3153 && baseY + y == 3923)) {
  1919. menuActionName[menuActionRow] = "Pull @cya@Lever";
  1920. menuActionID[menuActionRow] = 502;
  1921. menuActionCmd1[menuActionRow] = modelData;
  1922. menuActionCmd2[menuActionRow] = x;
  1923. menuActionCmd3[menuActionRow] = y;
  1924. menuActionCmd4[menuActionRow] = 5959;
  1925. menuActionRow++;
  1926.  
  1927. menuActionName[menuActionRow] = "Examine @cya@ Lever";
  1928. menuActionID[menuActionRow] = 1226;
  1929. menuActionCmd1[menuActionRow] = 950;
  1930. menuActionCmd2[menuActionRow] = x;
  1931. menuActionCmd3[menuActionRow] = y;
  1932. menuActionCmd4[menuActionRow] = 5959;
  1933. menuActionRow++;
  1934. return;
  1935. }
  1936. if (baseX + x == 2539 && baseY + y == 4712) {
  1937.  
  1938. menuActionName[menuActionRow] = "Pull @cya@Lever";
  1939. menuActionID[menuActionRow] = 502;
  1940. menuActionCmd1[menuActionRow] = modelData;
  1941. menuActionCmd2[menuActionRow] = x;
  1942. menuActionCmd3[menuActionRow] = y;
  1943. menuActionCmd4[menuActionRow] = 5960;
  1944. menuActionRow++;
  1945.  
  1946. menuActionName[menuActionRow] = "Examine @cya@ Lever";
  1947. menuActionID[menuActionRow] = 1226;
  1948. menuActionCmd1[menuActionRow] = 950;
  1949. menuActionCmd2[menuActionRow] = x;
  1950. menuActionCmd3[menuActionRow] = y;
  1951. menuActionCmd4[menuActionRow] = 5960;
  1952. menuActionRow++;
  1953. return;
  1954. }
  1955. if (!isDebugMode()) {
  1956. if (class46 == null) {
  1957. continue;
  1958. }
  1959. }
  1960. if (itemSelected == 1) {
  1961. menuActionName[menuActionRow] = "Use " + selectedItemName + " with @cya@" + class46.name;
  1962. menuActionID[menuActionRow] = 62;
  1963. menuActionCmd1[menuActionRow] = modelData;
  1964. menuActionCmd2[menuActionRow] = x;
  1965. menuActionCmd3[menuActionRow] = y;
  1966. menuActionCmd4[menuActionRow] = index;
  1967. menuActionRow++;
  1968. } else if (spellSelected == 1) {
  1969. if ((spellUsableOn & 4) == 4) {
  1970. menuActionName[menuActionRow] = spellTooltip + " @cya@" + class46.name;
  1971. menuActionID[menuActionRow] = 956;
  1972. menuActionCmd1[menuActionRow] = modelData;
  1973. menuActionCmd2[menuActionRow] = x;
  1974. menuActionCmd3[menuActionRow] = y;
  1975. menuActionCmd4[menuActionRow] = index;
  1976. menuActionRow++;
  1977. }
  1978. } else {
  1979. if (class46 != null && class46.actions != null) {
  1980. for (int i2 = 4; i2 >= 0; i2--) {
  1981. if (class46.actions[i2] != null) {
  1982. menuActionName[menuActionRow] = class46.actions[i2] + " @cya@" + class46.name;
  1983.  
  1984. if (i2 == 0) {
  1985. menuActionID[menuActionRow] = 502;
  1986. }
  1987.  
  1988. if (i2 == 1) {
  1989. menuActionID[menuActionRow] = 900;
  1990. }
  1991.  
  1992. if (i2 == 2) {
  1993. menuActionID[menuActionRow] = 113;
  1994. }
  1995.  
  1996. if (i2 == 3) {
  1997. menuActionID[menuActionRow] = 872;
  1998. }
  1999.  
  2000. if (i2 == 4) {
  2001. menuActionID[menuActionRow] = 1062;
  2002. }
  2003.  
  2004. menuActionCmd1[menuActionRow] = modelData;
  2005. menuActionCmd2[menuActionRow] = x;
  2006. menuActionCmd3[menuActionRow] = y;
  2007. menuActionCmd4[menuActionRow] = index;
  2008. menuActionRow++;
  2009. }
  2010. }
  2011. }
  2012. menuActionName[menuActionRow] = "Examine @cya@" + (class46 == null ? "null" : class46.name) + (isDebugMode() ? " (" + (class46 == null ? "null" : class46.type) + ")" : "");
  2013. menuActionID[menuActionRow] = 1226;
  2014. menuActionCmd1[menuActionRow] = class46 == null ? -1 : class46.type << 14;
  2015. menuActionCmd2[menuActionRow] = x;
  2016. menuActionCmd3[menuActionRow] = y;
  2017. menuActionCmd4[menuActionRow] = index;
  2018. menuActionRow++;
  2019. }
  2020. }
  2021.  
  2022. /**
  2023. * npcs
  2024. */
  2025. if (face == 1) {
  2026. NPC npc = npcArray[index];
  2027. if (npc.definitionOverride.npcSizeInSquares == 1 && (npc.x & 0x7f) == 64 && (npc.y & 0x7f) == 64) {
  2028. for (int j2 = 0; j2 < npcCount; j2++) {
  2029. NPC npc2 = npcArray[npcIndices[j2]];
  2030. if (npc2 != null && npc2 != npc && npc2.definitionOverride.npcSizeInSquares == 1 && npc2.x == npc.x && npc2.y == npc.y) {
  2031. buildAtNPCMenu(npc2.definitionOverride, npcIndices[j2], y, x);
  2032. }
  2033. }
  2034.  
  2035. for (int l2 = 0; l2 < playerCount; l2++) {
  2036. Player player = playerArray[playerIndices[l2]];
  2037.  
  2038. if (player != null && player.x == npc.x && player.y == npc.y) {
  2039. buildAtPlayerMenu(x, playerIndices[l2], player, y);
  2040. }
  2041. }
  2042. }
  2043. buildAtNPCMenu(npc.definitionOverride, index, y, x);
  2044. }
  2045.  
  2046. /**
  2047. * Players
  2048. */
  2049. if (face == 0) {
  2050. Player player = playerArray[index];
  2051.  
  2052. if ((player.x & 0x7f) == 64 && (player.y & 0x7f) == 64) {
  2053. for (int k2 = 0; k2 < npcCount; k2++) {
  2054. NPC class30_sub2_sub4_sub1_sub1_2 = npcArray[npcIndices[k2]];
  2055.  
  2056. try {
  2057. 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
  2058. && class30_sub2_sub4_sub1_sub1_2.y == player.y) {
  2059. buildAtNPCMenu(class30_sub2_sub4_sub1_sub1_2.definitionOverride, npcIndices[k2], y, x);
  2060. }
  2061. } catch (Exception _ex) {
  2062. }
  2063. }
  2064.  
  2065. for (int i3 = 0; i3 < playerCount; i3++) {
  2066. Player player1 = playerArray[playerIndices[i3]];
  2067.  
  2068. if (player1 != null && player1 != player && player1.x == player.x && player1.y == player.y) {
  2069. buildAtPlayerMenu(x, playerIndices[i3], player1, y);
  2070. }
  2071. }
  2072. }
  2073.  
  2074. buildAtPlayerMenu(x, index, player, y);
  2075. }
  2076.  
  2077. /**
  2078. * i assume items
  2079. */
  2080. if (face == 3) {
  2081. Deque class19 = groundArray[plane][x][y];
  2082.  
  2083. if (class19 != null) {
  2084. for (Item item = (Item) class19.getFirst(); item != null; item = (Item) class19.getNext()) {
  2085. ItemDefinition itemDef = ItemDefinition.get(item.id);
  2086.  
  2087. if (itemSelected == 1) {
  2088. menuActionName[menuActionRow] = "Use " + selectedItemName + " with @lre@" + itemDef.name;
  2089. menuActionID[menuActionRow] = 511;
  2090. menuActionCmd1[menuActionRow] = item.id;
  2091. menuActionCmd2[menuActionRow] = x;
  2092. menuActionCmd3[menuActionRow] = y;
  2093. menuActionCmd4[menuActionRow] = index;
  2094. menuActionRow++;
  2095. } else if (spellSelected == 1) {
  2096. if ((spellUsableOn & 1) == 1) {
  2097. menuActionName[menuActionRow] = spellTooltip + " @lre@" + itemDef.name;
  2098. menuActionID[menuActionRow] = 94;
  2099. menuActionCmd1[menuActionRow] = item.id;
  2100. menuActionCmd2[menuActionRow] = x;
  2101. menuActionCmd3[menuActionRow] = y;
  2102. menuActionCmd4[menuActionRow] = index;
  2103. menuActionRow++;
  2104. }
  2105. } else {
  2106. for (int j3 = 4; j3 >= 0; j3--) {
  2107. if (itemDef.groundActions != null && itemDef.groundActions[j3] != null) {
  2108. menuActionName[menuActionRow] = itemDef.groundActions[j3] + " @lre@" + itemDef.name;
  2109.  
  2110. if (j3 == 0) {
  2111. menuActionID[menuActionRow] = 652;
  2112. }
  2113.  
  2114. if (j3 == 1) {
  2115. menuActionID[menuActionRow] = 567;
  2116. }
  2117.  
  2118. if (j3 == 2) {
  2119. menuActionID[menuActionRow] = 234;
  2120. }
  2121.  
  2122. if (j3 == 3) {
  2123. menuActionID[menuActionRow] = 244;
  2124. }
  2125.  
  2126. if (j3 == 4) {
  2127. menuActionID[menuActionRow] = 213;
  2128. }
  2129.  
  2130. menuActionCmd1[menuActionRow] = item.id;
  2131. menuActionCmd2[menuActionRow] = x;
  2132. menuActionCmd3[menuActionRow] = y;
  2133. menuActionCmd4[menuActionRow] = index;
  2134. menuActionRow++;
  2135. } else if (j3 == 2) {
  2136. menuActionName[menuActionRow] = "Take @lre@" + itemDef.name;
  2137. menuActionID[menuActionRow] = 234;
  2138. menuActionCmd1[menuActionRow] = item.id;
  2139. menuActionCmd2[menuActionRow] = x;
  2140. menuActionCmd3[menuActionRow] = y;
  2141. menuActionCmd4[menuActionRow] = index;
  2142. menuActionRow++;
  2143. }
  2144. }
  2145.  
  2146. menuActionName[menuActionRow] = "Examine @lre@" + itemDef.name + (isDebugMode() ? " (" + itemDef.id + ":" + itemDef.modelID + ")" : "");
  2147. menuActionID[menuActionRow] = 1448;
  2148. menuActionCmd1[menuActionRow] = item.id;
  2149. menuActionCmd2[menuActionRow] = x;
  2150. menuActionCmd3[menuActionRow] = y;
  2151. menuActionCmd4[menuActionRow] = index;
  2152. menuActionRow++;
  2153. }
  2154. }
  2155. }
  2156. }
  2157. }
  2158. }
  2159.  
  2160. private void buildAtNPCMenu(MobDefinition entityDef, int index, int y, int x) {
  2161.  
  2162. if (menuActionRow >= 400) {
  2163. return;
  2164. }
  2165.  
  2166. if (entityDef.childrenIDs != null) {
  2167. entityDef = entityDef.method161();
  2168. }
  2169. if (entityDef == null) {
  2170. return;
  2171. }
  2172. if (!entityDef.disableRightClick) {
  2173. return;
  2174. }
  2175. String s = entityDef.name;
  2176. if (entityDef.combatLevel != 0) {
  2177. s = s + combatDiffColor(myPlayer.combatLevel, entityDef.combatLevel) + " (level-" + entityDef.combatLevel + ")";
  2178. }
  2179.  
  2180. if (itemSelected == 1) {
  2181. menuActionName[menuActionRow] = "Use " + selectedItemName + " with @yel@" + s;
  2182. menuActionID[menuActionRow] = 582;
  2183. menuActionCmd1[menuActionRow] = index;
  2184. menuActionCmd2[menuActionRow] = x;
  2185. menuActionCmd3[menuActionRow] = y;
  2186. menuActionRow++;
  2187. return;
  2188. }
  2189.  
  2190. if (spellSelected == 1) {
  2191. if ((spellUsableOn & 2) == 2) {
  2192. menuActionName[menuActionRow] = spellTooltip + " @yel@" + s;
  2193. menuActionID[menuActionRow] = 413;
  2194. menuActionCmd1[menuActionRow] = index;
  2195. menuActionCmd2[menuActionRow] = x;
  2196. menuActionCmd3[menuActionRow] = y;
  2197. menuActionRow++;
  2198. }
  2199. } else {
  2200. if (entityDef.actions != null) {
  2201. for (int l = 4; l >= 0; l--) {
  2202. if (entityDef.actions[l] != null && !entityDef.actions[l].equalsIgnoreCase("attack")) {
  2203. menuActionName[menuActionRow] = entityDef.actions[l] + " @yel@" + s;
  2204.  
  2205. if (l == 0) {
  2206. menuActionID[menuActionRow] = 20;
  2207. }
  2208.  
  2209. if (l == 1) {
  2210. menuActionID[menuActionRow] = 412;
  2211. }
  2212.  
  2213. if (l == 2) {
  2214. menuActionID[menuActionRow] = 225;
  2215. }
  2216.  
  2217. if (l == 3) {
  2218. menuActionID[menuActionRow] = 965;
  2219. }
  2220.  
  2221. if (l == 4) {
  2222. menuActionID[menuActionRow] = 478;
  2223. }
  2224. menuActionCmd1[menuActionRow] = index;
  2225. menuActionCmd2[menuActionRow] = x;
  2226. menuActionCmd3[menuActionRow] = y;
  2227. menuActionRow++;
  2228. }
  2229. }
  2230. }
  2231.  
  2232. if (entityDef.actions != null) {
  2233. for (int i1 = 4; i1 >= 0; i1--) {
  2234. if (entityDef.actions[i1] != null && entityDef.actions[i1].equalsIgnoreCase("attack")) {
  2235. char c = '\0';
  2236. if (!config.getStatus(ConfigType.ONE_CLICK_ATTACK)) {
  2237. if (entityDef.combatLevel > myPlayer.combatLevel)
  2238. c = '\u07D0';
  2239. }
  2240.  
  2241. menuActionName[menuActionRow] = entityDef.actions[i1] + " @yel@" + s;
  2242.  
  2243. if (i1 == 0) {
  2244. menuActionID[menuActionRow] = 20 + c;
  2245. }
  2246.  
  2247. if (i1 == 1) {
  2248. menuActionID[menuActionRow] = 412 + c;
  2249. }
  2250.  
  2251. if (i1 == 2) {
  2252. menuActionID[menuActionRow] = 225 + c;
  2253. }
  2254.  
  2255. if (i1 == 3) {
  2256. menuActionID[menuActionRow] = 965 + c;
  2257. }
  2258.  
  2259. if (i1 == 4) {
  2260. menuActionID[menuActionRow] = 478 + c;
  2261. }
  2262.  
  2263. menuActionCmd1[menuActionRow] = index;
  2264. menuActionCmd2[menuActionRow] = x;
  2265. menuActionCmd3[menuActionRow] = y;
  2266. menuActionRow++;
  2267. }
  2268. }
  2269. }
  2270.  
  2271. menuActionName[menuActionRow] = "Examine @yel@" + s + (isDebugMode() ? " (" + entityDef.id + ")" : "");
  2272. menuActionID[menuActionRow] = 1025;
  2273. menuActionCmd1[menuActionRow] = index;
  2274. menuActionCmd2[menuActionRow] = x;
  2275. menuActionCmd3[menuActionRow] = y;
  2276. menuActionRow++;
  2277. }
  2278. }
  2279.  
  2280. private final String[] menuPlayerName = new String[500];
  2281.  
  2282. private boolean allButOneInitialized;
  2283.  
  2284. private void buildAtPlayerMenu(int i, int j, Player player, int k) {
  2285. if (player == myPlayer) {
  2286. return;
  2287. }
  2288.  
  2289. if (menuActionRow >= 400) {
  2290. return;
  2291. }
  2292.  
  2293. String menuTooltip;
  2294. boolean before = player.loyaltyPosition == 0 ? true : false;
  2295. String title = "";
  2296. if (player.loyaltyTitle != null) {
  2297. title = "<col=" + Integer.toHexString(player.loyaltyColor) + ">" + player.loyaltyTitle.trim() + "</col>";
  2298. }
  2299. if (player.skill == 0) {
  2300. if (!before || player.loyaltyTitle == null) {
  2301. menuTooltip = player.name + (title.isEmpty() ? "" : " ") + title + combatDiffColor(myPlayer.combatLevel, player.combatLevel) + " (level-" + player.combatLevel + ")";
  2302. } else {
  2303. menuTooltip = title + (player.loyaltyTitle.isEmpty() ? "" : " ") + player.name + combatDiffColor(myPlayer.combatLevel, player.combatLevel) + " (level-" + player.combatLevel + ")";
  2304. }
  2305. } else {
  2306. menuTooltip = player.name + " (skill-" + player.skill + ")";
  2307. }
  2308.  
  2309. if (itemSelected == 1) {
  2310. menuActionName[menuActionRow] = "Use " + selectedItemName + " with @whi@" + menuTooltip;
  2311. menuActionID[menuActionRow] = 491;
  2312. menuActionCmd1[menuActionRow] = j;
  2313. menuActionCmd2[menuActionRow] = i;
  2314. menuActionCmd3[menuActionRow] = k;
  2315. menuActionRow++;
  2316. } else if (spellSelected == 1) {
  2317. if ((spellUsableOn & 8) == 8) {
  2318. menuActionName[menuActionRow] = spellTooltip + " @whi@" + menuTooltip;
  2319. menuActionID[menuActionRow] = 365;
  2320. menuActionCmd1[menuActionRow] = j;
  2321. menuActionCmd2[menuActionRow] = i;
  2322. menuActionCmd3[menuActionRow] = k;
  2323. menuActionRow++;
  2324. }
  2325. } else {
  2326. for (int index = 4; index >= 0; index--) {
  2327. if (atPlayerActions[index] != null) {
  2328. menuActionName[menuActionRow] = atPlayerActions[index] + " @whi@" + menuTooltip;
  2329. char c = '\0';
  2330.  
  2331. if (atPlayerActions[index].equalsIgnoreCase("attack")) {
  2332. if (!config.getStatus(ConfigType.ONE_CLICK_ATTACK)) {
  2333. if (player.combatLevel > myPlayer.combatLevel)
  2334. c = '\u07D0';
  2335. }
  2336. if (myPlayer.team != 0 && player.team != 0) {
  2337. if (myPlayer.team == player.team) {
  2338. c = '\u07D0';
  2339. } else {
  2340. c = '\0';
  2341. }
  2342. }
  2343. } else if (atPlayerArray[index]) {
  2344. c = '\u07D0';
  2345. }
  2346.  
  2347. if (index == 0) {
  2348. menuActionID[menuActionRow] = 561 + c;
  2349. }
  2350.  
  2351. if (index == 1) {
  2352. menuActionID[menuActionRow] = 779 + c;
  2353. }
  2354.  
  2355. if (index == 2) {
  2356. menuActionID[menuActionRow] = 27 + c;
  2357. }
  2358.  
  2359. if (index == 3) {
  2360. menuActionID[menuActionRow] = 577 + c;
  2361. }
  2362.  
  2363. if (index == 4) {
  2364. menuActionID[menuActionRow] = 729 + c;
  2365. }
  2366.  
  2367. menuActionCmd1[menuActionRow] = j;
  2368. menuActionCmd2[menuActionRow] = i;
  2369. menuActionCmd3[menuActionRow] = k;
  2370. menuActionRow++;
  2371. }
  2372. }
  2373. }
  2374.  
  2375. for (int i1 = 0; i1 < menuActionRow; i1++) {
  2376. if (menuActionID[i1] == 516) {
  2377. menuActionName[i1] = "Walk here @whi@" + menuTooltip;
  2378. return;
  2379. }
  2380. }
  2381. }
  2382.  
  2383. private void buildChatAreaMenu(int yOffset) {
  2384. if (!isGameFrameVisible() || chatArea.componentHidden()) {
  2385. return;
  2386. }
  2387.  
  2388. int messages = 0;
  2389.  
  2390. for (int index = 0; index < 500; index++) {
  2391. if (chatMessages[index] == null) {
  2392. continue;
  2393. }
  2394.  
  2395. int currentType = chatTypes[index];
  2396. int k1 = 70 - messages * 14 + 42 + anInt1089 + 4 + 5;
  2397. if (k1 < -23) {
  2398. break;
  2399. }
  2400.  
  2401. String player_name = chatNames[index];
  2402.  
  2403. if (chatTypeView == 1) {
  2404. buildPublicChat(yOffset);
  2405. break;
  2406. }
  2407.  
  2408. if (chatTypeView == 2) {
  2409. buildFriendChat(yOffset);
  2410. break;
  2411. }
  2412.  
  2413. if (chatTypeView == 3 || chatTypeView == 4) {
  2414. buildDuelorTrade(yOffset);
  2415. break;
  2416. }
  2417.  
  2418. if (chatTypeView == 5) {
  2419. break;
  2420. }
  2421.  
  2422. if (player_name != null) {
  2423. if (player_name.indexOf("@") == 0) {
  2424. player_name = player_name.substring(5);
  2425. }
  2426. }
  2427. if (player_name != null && player_name.startsWith("<col=")) {
  2428. player_name = player_name.substring(player_name.indexOf("</col>") + 6);
  2429. }
  2430. if (currentType == 0) {
  2431. messages++;
  2432. }
  2433.  
  2434. if ((currentType == 1 || currentType == 2) && (currentType == 1 || publicChatMode == 0 || publicChatMode == 1 && isFriendOrSelf(player_name))) {
  2435. if (yOffset > k1 - 14 && yOffset <= k1 && !myPlayer.name.equals(NAME_PATTERN.matcher(player_name).replaceAll(""))) {
  2436. if (!isFriendOrSelf(player_name)) {
  2437. menuActionName[menuActionRow] = "Add ignore @whi@" + player_name;
  2438. menuActionID[menuActionRow] = 42;
  2439. menuActionRow++;
  2440. menuActionName[menuActionRow] = "Add friend @whi@" + player_name;
  2441. menuActionID[menuActionRow] = 337;
  2442. menuActionRow++;
  2443. } // else if (isFriendOrSelf(player_name)) {
  2444. menuActionName[menuActionRow] = "Message @whi@" + player_name;
  2445. menuActionID[menuActionRow] = 2639;
  2446. menuActionRow++;
  2447. // }
  2448. }
  2449.  
  2450. messages++;
  2451. }
  2452.  
  2453. if ((currentType == 3 || currentType == 7) && splitPrivateChat == 0 && (currentType == 7 || privateChatMode == 0 || privateChatMode == 1 && isFriendOrSelf(player_name))) {
  2454. if (yOffset > k1 - 14 && yOffset <= k1) {
  2455. if (!isFriendOrSelf(player_name)) {
  2456. menuActionName[menuActionRow] = "Add ignore @whi@" + player_name;
  2457. menuActionID[menuActionRow] = 42;
  2458. menuActionRow++;
  2459. menuActionName[menuActionRow] = "Add friend @whi@" + player_name;
  2460. menuActionID[menuActionRow] = 337;
  2461. menuActionRow++;
  2462. } // else if (isFriendOrSelf(player_name)) {
  2463. menuActionName[menuActionRow] = "Message @whi@" + player_name;
  2464. menuActionID[menuActionRow] = 2639;
  2465. menuActionRow++;
  2466. // }
  2467.  
  2468. }
  2469.  
  2470. messages++;
  2471. }
  2472.  
  2473. if (currentType == 4 && (tradeMode == 0 || tradeMode == 1 && isFriendOrSelf(player_name))) {
  2474. if (yOffset > k1 - 14 && yOffset <= k1) {
  2475. menuActionName[menuActionRow] = "Accept trade @whi@" + player_name;
  2476. menuActionID[menuActionRow] = 484;
  2477. menuActionRow++;
  2478. }
  2479.  
  2480. messages++;
  2481. }
  2482.  
  2483. if ((currentType == 5 || currentType == 6) && splitPrivateChat == 0 && privateChatMode < 2) {
  2484. messages++;
  2485. }
  2486. if (currentType == 8 && (duelStatus == 0 || duelStatus == 1 && isFriendOrSelf(player_name))) {
  2487. if (yOffset > k1 - 14 && yOffset <= k1) {
  2488. menuActionName[menuActionRow] = "Accept challenge @whi@" + player_name;
  2489. menuActionID[menuActionRow] = 6;
  2490. menuActionRow++;
  2491. }
  2492.  
  2493. messages++;
  2494. }
  2495.  
  2496. if (currentType == 17) {
  2497. if (yOffset > k1 - 14 && yOffset <= k1) {
  2498. menuActionName[menuActionRow] = "Accept gamble @whi@" + player_name;
  2499. menuActionID[menuActionRow] = 17;
  2500. menuActionRow++;
  2501. }
  2502.  
  2503. messages++;
  2504. }
  2505. }
  2506. }
  2507.  
  2508. private void buildDuelorTrade(int yOffset) {
  2509. int l = 0;
  2510.  
  2511. for (int i1 = 0; i1 < 500; i1++) {
  2512. if (chatMessages[i1] == null) {
  2513. continue;
  2514. }
  2515.  
  2516. if (chatTypeView != 3 && chatTypeView != 4) {
  2517. continue;
  2518. }
  2519.  
  2520. int chatType = chatTypes[i1];
  2521. String name = chatNames[i1];
  2522. int k1 = 70 - l * 14 + 42 + anInt1089 + 4 + 5;
  2523.  
  2524. if (k1 < -23) {
  2525. break;
  2526. }
  2527.  
  2528. if (name != null) {
  2529. if (name.indexOf("@") == 0) {
  2530. name = name.substring(5);
  2531. }
  2532. }
  2533.  
  2534. if (chatTypeView == 3 && chatType == 4 && (tradeMode == 0 || tradeMode == 1 && isFriendOrSelf(name))) {
  2535. if (yOffset > k1 - 14 && yOffset <= k1) {
  2536. menuActionName[menuActionRow] = "Accept trade @whi@" + name;
  2537. menuActionID[menuActionRow] = 484;
  2538. menuActionRow++;
  2539. }
  2540.  
  2541. l++;
  2542. }
  2543.  
  2544. if (chatTypeView == 4 && chatType == 8 && (duelStatus == 0 || duelStatus == 1 && isFriendOrSelf(name))) {
  2545. if (yOffset > k1 - 14 && yOffset <= k1) {
  2546. menuActionName[menuActionRow] = "Accept challenge @whi@" + name;
  2547. menuActionID[menuActionRow] = 6;
  2548. menuActionRow++;
  2549. }
  2550.  
  2551. l++;
  2552. }
  2553.  
  2554. if (chatType == 12) {
  2555. if (yOffset > k1 - 14 && yOffset <= k1) {
  2556. menuActionName[menuActionRow] = "Go-to @blu@" + name;
  2557. menuActionID[menuActionRow] = 915;
  2558. menuActionRow++;
  2559. }
  2560.  
  2561. l++;
  2562. }
  2563. }
  2564. }
  2565.  
  2566. private void buildFriendChat(int yOffset) {
  2567. int count = 0;
  2568.  
  2569. for (int index = 0; index < 500; index++) {
  2570. if (chatMessages[index] == null) {
  2571. continue;
  2572. }
  2573.  
  2574. if (chatTypeView != 2) {
  2575. continue;
  2576. }
  2577.  
  2578. int type = chatTypes[index];
  2579. String player_name = chatNames[index];
  2580. int k1 = 70 - count * 14 + 42 + anInt1089 + 4 + 5;
  2581. if (k1 < -23) {
  2582. break;
  2583. }
  2584.  
  2585. if (player_name != null) {
  2586. if (player_name.indexOf("@") == 0) {
  2587. player_name = player_name.substring(5);
  2588. }
  2589. }
  2590.  
  2591. if ((type == 5 || type == 6) && (splitPrivateChat == 0 || chatTypeView == 2) && (type == 6 || privateChatMode == 0 || privateChatMode == 1 && isFriendOrSelf(player_name))) {
  2592. count++;
  2593. }
  2594.  
  2595. if ((type == 3 || type == 7) && (splitPrivateChat == 0 || chatTypeView == 2) && (type == 7 || privateChatMode == 0 || privateChatMode == 1 && isFriendOrSelf(player_name))) {
  2596. if (yOffset > k1 - 14 && yOffset <= k1) {
  2597. if (!isFriendOrSelf(player_name)) {
  2598. menuActionName[menuActionRow] = "Add ignore @whi@" + player_name;
  2599. menuActionID[menuActionRow] = 42;
  2600. menuActionRow++;
  2601. menuActionName[menuActionRow] = "Add friend @whi@" + player_name;
  2602. menuActionID[menuActionRow] = 337;
  2603. menuActionRow++;
  2604. } // else if (isFriendOrSelf(player_name)) {
  2605. menuActionName[menuActionRow] = "Message @whi@" + player_name;
  2606. menuActionID[menuActionRow] = 2639;
  2607. menuActionRow++;
  2608. // }
  2609. }
  2610.  
  2611. count++;
  2612. }
  2613. }
  2614. }
  2615.  
  2616. private boolean buildFriendsListMenu(RSInterface class9) {
  2617. int i = class9.contentType;
  2618.  
  2619. if (i >= 1 && i <= 200 || i >= 701 && i <= 900) {
  2620. if (i >= 801) {
  2621. i -= 701;
  2622. } else if (i >= 701) {
  2623. i -= 601;
  2624. } else if (i >= 101) {
  2625. i -= 101;
  2626. } else {
  2627. i--;
  2628. }
  2629.  
  2630. menuActionName[menuActionRow] = "Remove @whi@" + friendsList[i];
  2631. menuActionID[menuActionRow] = 792;
  2632. menuActionRow++;
  2633. menuActionName[menuActionRow] = "Message @whi@" + friendsList[i];
  2634. menuActionID[menuActionRow] = 639;
  2635. menuActionRow++;
  2636. return true;
  2637. }
  2638.  
  2639. if (i >= 401 && i <= 500) {
  2640. menuActionName[menuActionRow] = "Remove @whi@" + class9.message;
  2641. menuActionID[menuActionRow] = 322;
  2642. menuActionRow++;
  2643. return true;
  2644. } else {
  2645. return false;
  2646. }
  2647. }
  2648.  
  2649. private void buildInterfaceMenu(int xPadding, RSInterface rsInterface, int xPos, int yPadding, int yPos, int scrollPoint) {
  2650. if (rsInterface == null) {
  2651. rsInterface = RSInterface.interfaceCache[21356];
  2652. }
  2653.  
  2654. if (rsInterface.type != 0 || rsInterface.children == null || rsInterface.interfaceShown) {
  2655. return;
  2656. }
  2657.  
  2658. if (xPos < xPadding || yPos < yPadding || xPos > xPadding + rsInterface.width || yPos > yPadding + rsInterface.height) {
  2659. return;
  2660. }
  2661.  
  2662. int totalChildren = rsInterface.children.length;
  2663.  
  2664. for (int index = 0; index < totalChildren; index++) {
  2665. int xSpritePos = rsInterface.childX[index] + xPadding;
  2666. int ySpritePos = rsInterface.childY[index] + yPadding - scrollPoint;
  2667. RSInterface children = RSInterface.interfaceCache[rsInterface.children[index]];
  2668. int offset = children.xOffset;
  2669. xSpritePos += offset;
  2670. ySpritePos += children.yOffset;
  2671.  
  2672. if (super.clickMode3 != 0) {
  2673. xPos = super.clickX;
  2674. yPos = super.clickY;
  2675. }
  2676.  
  2677. if ((children.hoverType >= 0 || children.textColorSelected != 0) && xPos >= xSpritePos && yPos >= ySpritePos && xPos < xSpritePos + children.width && yPos < ySpritePos + children.height) {
  2678. if (children.hoverType >= 0) {
  2679. anInt886 = children.hoverType;
  2680. } else {
  2681. anInt886 = children.id;
  2682. }
  2683. }
  2684.  
  2685. if (children.type == 8 && xPos >= xSpritePos && yPos >= ySpritePos && xPos < xSpritePos + children.width && yPos < ySpritePos + children.height) {
  2686. anInt1315 = children.id;
  2687. }
  2688. if (children.type == 0) {
  2689. buildInterfaceMenu(xSpritePos, children, xPos, ySpritePos, yPos, children.scrollPosition);
  2690.  
  2691. if (children.scrollMax > children.height) {
  2692. method65(xSpritePos + children.width, children.height, xPos, yPos, children, ySpritePos, true, children.scrollMax);
  2693. }
  2694. } else {
  2695. // Quest tab extra lines size fit
  2696. int extra = 0;
  2697. for (int e : lines) {
  2698. if (children.id == e) {
  2699. extra = 60;
  2700. break;
  2701. }
  2702. }
  2703. if (children.atActionType == 1 && xPos >= xSpritePos && yPos >= ySpritePos && xPos < xSpritePos + children.width + extra && yPos < ySpritePos + children.height) {
  2704. boolean flag = false, flag1 = false;
  2705.  
  2706. if (children.contentType != 0) {
  2707. flag = buildFriendsListMenu(children);
  2708. }
  2709.  
  2710. if (children.tooltip != null && children.tooltip.startsWith("[CC]")) {
  2711. flag1 = true;
  2712. PlayerHandler.clanName = RSInterface.interfaceCache[children.id - 800].message;
  2713. }
  2714.  
  2715. if (!flag && !flag1) {
  2716. if (children.tooltip.length() > 0) {
  2717. menuActionName[menuActionRow] = children.tooltip;
  2718. menuActionID[menuActionRow] = 315;
  2719. menuActionCmd3[menuActionRow] = children.id;
  2720. menuActionRow++;
  2721. }
  2722. }
  2723.  
  2724. if (flag1 && RSInterface.interfaceCache[children.id - 800].message != "") {
  2725. menuActionName[menuActionRow] = "General";
  2726. menuActionID[menuActionRow] = 1321;
  2727. menuActionCmd3[menuActionRow] = children.id;
  2728. menuActionRow++;
  2729. menuActionName[menuActionRow] = "Captain";
  2730. menuActionID[menuActionRow] = 1320;
  2731. menuActionCmd3[menuActionRow] = children.id;
  2732. menuActionRow++;
  2733. menuActionName[menuActionRow] = "Lieutenant";
  2734. menuActionID[menuActionRow] = 1319;
  2735. menuActionCmd3[menuActionRow] = children.id;
  2736. menuActionRow++;
  2737. menuActionName[menuActionRow] = "Sergeant";
  2738. menuActionID[menuActionRow] = 1318;
  2739. menuActionCmd3[menuActionRow] = children.id;
  2740. menuActionRow++;
  2741. menuActionName[menuActionRow] = "Corporal";
  2742. menuActionID[menuActionRow] = 1317;
  2743. menuActionCmd3[menuActionRow] = children.id;
  2744. menuActionRow++;
  2745. menuActionName[menuActionRow] = "Recruit";
  2746. menuActionID[menuActionRow] = 1316;
  2747. menuActionCmd3[menuActionRow] = children.id;
  2748. menuActionRow++;
  2749. menuActionName[menuActionRow] = "Not ranked";
  2750. menuActionID[menuActionRow] = 1315;
  2751. menuActionCmd3[menuActionRow] = children.id;
  2752. menuActionRow++;
  2753. }
  2754. }
  2755.  
  2756. if (children.atActionType == 2 && xPos >= xSpritePos && yPos >= ySpritePos && xPos < xSpritePos + children.width && yPos < ySpritePos + children.height) {
  2757. String s = children.selectedActionName;
  2758.  
  2759. if (s.indexOf(" ") != -1) {
  2760. s = s.substring(0, s.indexOf(" "));
  2761. }
  2762.  
  2763. if (children.spellName.endsWith("Rush") || children.spellName.endsWith("Burst") || children.spellName.endsWith("Blitz") || children.spellName.endsWith("Barrage")
  2764. || children.spellName.endsWith("strike") || children.spellName.endsWith("bolt") || children.spellName.equals("Crumble undead") || children.spellName.endsWith("blast")
  2765. || children.spellName.endsWith("wave") || children.spellName.equals("Claws of Guthix") || children.spellName.equals("Flames of Zamorak")
  2766. || children.spellName.equals("Magic Dart")) {
  2767. menuActionName[menuActionRow] = "Autocast @gre@" + children.spellName;
  2768. menuActionID[menuActionRow] = 104;
  2769. menuActionCmd3[menuActionRow] = children.id;
  2770. menuActionRow++;
  2771. }
  2772.  
  2773. menuActionName[menuActionRow] = s + " @gre@" + children.spellName + (isDebugMode() ? ", " + children.id : "");
  2774. menuActionID[menuActionRow] = 626;
  2775. menuActionCmd3[menuActionRow] = children.id;
  2776. menuActionRow++;
  2777. }
  2778.  
  2779. if (children.atActionType == 3 && xPos >= xSpritePos && yPos >= ySpritePos && xPos < xSpritePos + children.width && yPos < ySpritePos + children.height) {
  2780. menuActionName[menuActionRow] = "Close";
  2781. menuActionID[menuActionRow] = 200;
  2782. menuActionCmd3[menuActionRow] = children.id;
  2783. menuActionRow++;
  2784. }
  2785.  
  2786. if (children.atActionType == 4 && xPos >= xSpritePos && yPos >= ySpritePos && xPos < xSpritePos + children.width && yPos < ySpritePos + children.height) {
  2787. // System.out.println("2"+class9_1.tooltip + ", " +
  2788. // class9_1.interfaceID);
  2789.  
  2790. menuActionName[menuActionRow] = children.tooltip + (isDebugMode() ? ", " + children.id : "");
  2791. menuActionID[menuActionRow] = 169;
  2792. menuActionCmd3[menuActionRow] = children.id;
  2793. menuActionRow++;
  2794.  
  2795. if (children.tooltipBoxText != null) {
  2796. // drawHoverBox(k, l, class9_1.hoverText);
  2797. // System.out.println("DRAWING INTERFACE: " +
  2798. // class9_1.hoverText);
  2799. }
  2800. }
  2801.  
  2802. if (children.atActionType == 5 && xPos >= xSpritePos && yPos >= ySpritePos && xPos < xSpritePos + children.width && yPos < ySpritePos + children.height) {
  2803. // System.out.println("3"+class9_1.tooltip + ", " +
  2804. // class9_1.interfaceID);
  2805. menuActionName[menuActionRow] = children.tooltip + (isDebugMode() ? ", " + children.id : "");
  2806. menuActionID[menuActionRow] = 646;
  2807. menuActionCmd3[menuActionRow] = children.id;
  2808. menuActionRow++;
  2809. }
  2810.  
  2811. if (children.atActionType == 6 && !dialogueOptionsShowing && xPos >= xSpritePos && yPos >= ySpritePos && xPos < xSpritePos + children.width && yPos < ySpritePos + children.height) {
  2812. // System.out.println("4"+class9_1.tooltip + ", " +
  2813. // class9_1.interfaceID);
  2814.  
  2815. menuActionName[menuActionRow] = children.tooltip + (isDebugMode() ? ", " + children.id : "");
  2816. menuActionID[menuActionRow] = 679;
  2817. menuActionCmd3[menuActionRow] = children.id;
  2818. menuActionRow++;
  2819. }
  2820.  
  2821. if (children.type == 2 && children.parentID != 0) {
  2822. int k2 = 0;
  2823.  
  2824. for (int l2 = 0; l2 < children.height; l2++) {
  2825. for (int i3 = 0; i3 < children.width; i3++) {
  2826. int j3 = xSpritePos + i3 * (32 + children.invSpritePadX);
  2827. int k3 = ySpritePos + l2 * (32 + children.invSpritePadY);
  2828.  
  2829. if (k2 < children.spritesX.length) {
  2830. j3 += children.spritesX[k2];
  2831. k3 += children.spritesY[k2];
  2832. }
  2833.  
  2834. if (xPos >= j3 && yPos >= k3 && xPos < j3 + 32 && yPos < k3 + 32) {
  2835. mouseInvInterfaceIndex = k2;
  2836. lastActiveInvInterface = children.id;
  2837. if (children.inv[k2] > 0) {
  2838. ItemDefinition definition = ItemDefinition.get(children.inv[k2] - 1);
  2839.  
  2840. if (itemSelected == 1 && children.isInventoryInterface) {
  2841. if (children.id != anInt1284 || k2 != anInt1283) {
  2842. menuActionName[menuActionRow] = "Use " + selectedItemName + " with @lre@" + definition.name;
  2843. menuActionID[menuActionRow] = 870;
  2844. menuActionCmd1[menuActionRow] = definition.id;
  2845. menuActionCmd2[menuActionRow] = k2;
  2846. menuActionCmd3[menuActionRow] = children.id;
  2847. menuActionRow++;
  2848. }
  2849. } else if (spellSelected == 1 && children.isInventoryInterface) {
  2850. if ((spellUsableOn & 0x10) == 16) {
  2851. menuActionName[menuActionRow] = spellTooltip + " @lre@" + definition.name;
  2852. menuActionID[menuActionRow] = 543;
  2853. menuActionCmd1[menuActionRow] = definition.id;
  2854. menuActionCmd2[menuActionRow] = k2;
  2855. menuActionCmd3[menuActionRow] = children.id;
  2856. menuActionRow++;
  2857. }
  2858. } else {
  2859. if (children.isInventoryInterface) {
  2860. for (int l3 = 4; l3 >= 3; l3--) {
  2861. if (definition.actions != null && definition.actions[l3] != null || lootingBag) {
  2862. if (lootingBag) {
  2863. menuActionCmd1[menuActionRow] = definition.id;
  2864. menuActionCmd2[menuActionRow] = k2;
  2865. menuActionCmd3[menuActionRow] = children.id;
  2866.  
  2867. if (l3 == 1) {
  2868. menuActionName[menuActionRow] = "Deposit" + " @lre@" + definition.name;
  2869. } else {
  2870. menuActionName[menuActionRow] = null;
  2871. }
  2872.  
  2873. if (l3 == 3) {
  2874. menuActionID[menuActionRow] = 493;
  2875. }
  2876.  
  2877. if (l3 == 4) {
  2878. menuActionID[menuActionRow] = 847;
  2879. }
  2880.  
  2881. menuActionCmd1[menuActionRow] = definition.id;
  2882. menuActionCmd2[menuActionRow] = k2;
  2883. menuActionCmd3[menuActionRow] = children.id;
  2884. menuActionRow++;
  2885. continue;
  2886. }
  2887. menuActionName[menuActionRow] = definition.actions[l3] + " @lre@" + definition.name;
  2888.  
  2889. if (l3 == 3) {
  2890. menuActionID[menuActionRow] = 493;
  2891. }
  2892.  
  2893. if (l3 == 4) {
  2894. menuActionID[menuActionRow] = 847;
  2895. }
  2896.  
  2897. menuActionCmd1[menuActionRow] = definition.id;
  2898. menuActionCmd2[menuActionRow] = k2;
  2899. menuActionCmd3[menuActionRow] = children.id;
  2900. menuActionRow++;
  2901. } else if (l3 == 4) {
  2902. menuActionName[menuActionRow] = "Drop @lre@" + definition.name;
  2903. menuActionID[menuActionRow] = 847;
  2904. menuActionCmd1[menuActionRow] = definition.id;
  2905. menuActionCmd2[menuActionRow] = k2;
  2906. menuActionCmd3[menuActionRow] = children.id;
  2907. menuActionRow++;
  2908. }
  2909. }
  2910. }
  2911.  
  2912. if (children.usableItemInterface) {
  2913. menuActionName[menuActionRow] = "Use @lre@" + definition.name;
  2914. menuActionID[menuActionRow] = 447;
  2915. menuActionCmd1[menuActionRow] = definition.id;
  2916. menuActionCmd2[menuActionRow] = k2;
  2917. menuActionCmd3[menuActionRow] = children.id;
  2918. menuActionRow++;
  2919. }
  2920.  
  2921. if (children.isInventoryInterface && definition.actions != null) {
  2922. for (int i4 = 2; i4 >= 0; i4--) {
  2923. if (definition.actions[i4] != null) {
  2924. menuActionName[menuActionRow] = definition.actions[i4] + " @lre@" + definition.name;
  2925.  
  2926. if (i4 == 0) {
  2927. menuActionID[menuActionRow] = 74;
  2928. }
  2929.  
  2930. if (i4 == 1) {
  2931. menuActionID[menuActionRow] = 454;
  2932. }
  2933.  
  2934. if (i4 == 2) {
  2935. menuActionID[menuActionRow] = 539;
  2936. }
  2937.  
  2938. menuActionCmd1[menuActionRow] = definition.id;
  2939. menuActionCmd2[menuActionRow] = k2;
  2940. menuActionCmd3[menuActionRow] = children.id;
  2941. menuActionRow++;
  2942. }
  2943. }
  2944. }
  2945.  
  2946. if (children.actions != null) {
  2947. for (int j4 = (allButOneInitialized ? 5 : 4); j4 >= 0; j4--) {
  2948. if (children.actions.length - 1 < j4) {
  2949. continue;
  2950. }
  2951.  
  2952. if (children.actions[j4] != null) {
  2953. if (children.parentID == 5292) {
  2954. if (children.actions.length < 6) {
  2955. allButOneInitialized = true;
  2956. children.actions = new String[] { "Withdraw 1", "Withdraw 5", "Withdraw 10", "Withdraw All", "Withdraw X", "Withdraw All but one" };
  2957. }
  2958. }
  2959.  
  2960. menuActionName[menuActionRow] = children.actions[j4] + " @lre@" + definition.name;
  2961.  
  2962. if (j4 == 0) {
  2963. menuActionID[menuActionRow] = 632;
  2964. }
  2965.  
  2966. if (j4 == 1) {
  2967. menuActionID[menuActionRow] = 78;
  2968. }
  2969.  
  2970. if (j4 == 2) {
  2971. menuActionID[menuActionRow] = 867;
  2972. }
  2973.  
  2974. if (j4 == 3) {
  2975. menuActionID[menuActionRow] = 431;
  2976. }
  2977.  
  2978. if (j4 == 4) {
  2979. menuActionID[menuActionRow] = 53;
  2980. }
  2981.  
  2982. if (children.parentID == 5292) {
  2983. if (j4 == 5)
  2984. menuActionID[menuActionRow] = 291;
  2985. }
  2986.  
  2987. menuActionCmd1[menuActionRow] = definition.id;
  2988. menuActionCmd2[menuActionRow] = k2;
  2989. menuActionCmd3[menuActionRow] = children.id;
  2990. menuActionRow++;
  2991. }
  2992. }
  2993. }
  2994. if (!children.hideExamine) {
  2995. menuActionName[menuActionRow] = "Examine @lre@" + definition.name
  2996. + (isDebugMode() ? " (" + definition.id + ":" + definition.modelID + ":" + definition.maleWearId + " : " + definition.femaleWearId + ")" : "");
  2997. menuActionID[menuActionRow] = 1125;
  2998. menuActionCmd1[menuActionRow] = definition.id;
  2999. menuActionCmd2[menuActionRow] = k2;
  3000. menuActionCmd3[menuActionRow] = children.id;
  3001. menuActionRow++;
  3002. }
  3003. }
  3004. }
  3005. }
  3006.  
  3007. k2++;
  3008. }
  3009. }
  3010. }
  3011. }
  3012. }
  3013. }
  3014.  
  3015. private void buildPublicChat(int yOffset) {
  3016. int messages = 0;
  3017.  
  3018. for (int index = 0; index < 500; index++) {
  3019. if (chatMessages[index] == null) {
  3020. continue;
  3021. }
  3022.  
  3023. if (chatTypeView != 1) {
  3024. continue;
  3025. }
  3026.  
  3027. int type = chatTypes[index];
  3028. String name = chatNames[index];
  3029. int k1 = 70 - messages * 14 + 42 + anInt1089 + 4 + 5;
  3030.  
  3031. if (k1 < -23) {
  3032. break;
  3033. }
  3034.  
  3035. if (name != null) {
  3036. if (name.indexOf("@") == 0) {
  3037. name = name.substring(5);
  3038. }
  3039. }
  3040.  
  3041. if ((type == 1 || type == 2) && (type == 1 || publicChatMode == 0 || publicChatMode == 1 && isFriendOrSelf(name))) {
  3042. if (yOffset > k1 - 14 && yOffset <= k1 && !name.equals(myPlayer.name)) {
  3043. if (!isFriendOrSelf(name)) {
  3044. menuActionName[menuActionRow] = "Add ignore @whi@" + name;
  3045. menuActionID[menuActionRow] = 42;
  3046. menuActionRow++;
  3047. menuActionName[menuActionRow] = "Add friend @whi@" + name;
  3048. menuActionID[menuActionRow] = 337;
  3049. menuActionRow++;
  3050. } // else if (isFriendOrSelf(name)) {
  3051. menuActionName[menuActionRow] = "Message @whi@" + name;
  3052. menuActionID[menuActionRow] = 2639;
  3053. menuActionRow++;
  3054. // }
  3055. }
  3056.  
  3057. messages++;
  3058. }
  3059. }
  3060. }
  3061.  
  3062. private void buildSplitPrivateChatMenu() {
  3063. if (splitPrivateChat == 0) {
  3064. return;
  3065. }
  3066.  
  3067. int yOffsetPos = 0;
  3068.  
  3069. if (systemUpdateTimer != 0) {
  3070. yOffsetPos = 1;
  3071. }
  3072.  
  3073. for (int index = 0; index < 500; index++) {
  3074. if (chatMessages[index] != null) {
  3075. int type = chatTypes[index];
  3076. String name = chatNames[index];
  3077. boolean fixed = GameFrame.getScreenMode() == ScreenMode.FIXED;
  3078.  
  3079. if (name != null && name.indexOf("@") == 0) {
  3080. name = NAME_PATTERN.matcher(name).replaceAll("");
  3081. }
  3082.  
  3083. if ((type == 3 || type == 7) && (type == 7 || privateChatMode == 0 || privateChatMode == 1 && isFriendOrSelf(name))) {
  3084. int l = chatArea.getyPos() - 9 - yOffsetPos * 13;
  3085.  
  3086. if (super.mouseX > (fixed ? 4 : 0) && super.mouseY - (fixed ? 4 : 0) > l - 10 && super.mouseY - (fixed ? 4 : 0) <= l + 3) {
  3087. int i1 = normalText.getTextWidth("From: " + name + chatMessages[index]) + 25;
  3088.  
  3089. if (i1 > 450) {
  3090. i1 = 450;
  3091. }
  3092.  
  3093. if (super.mouseX < (fixed ? 4 : 0) + i1) {
  3094. if (!isFriendOrSelf(name)) {
  3095. menuActionName[menuActionRow] = "Add ignore @whi@" + name;
  3096. menuActionID[menuActionRow] = 2042;
  3097. menuActionRow++;
  3098. menuActionName[menuActionRow] = "Add friend @whi@" + name;
  3099. menuActionID[menuActionRow] = 2337;
  3100. menuActionRow++;
  3101. } // else if (isFriendOrSelf(name)) {
  3102. menuActionName[menuActionRow] = "Message @whi@" + name;
  3103. menuActionID[menuActionRow] = 2639;
  3104. menuActionRow++;
  3105. // }
  3106. }
  3107. }
  3108.  
  3109. if (++yOffsetPos >= 5) {
  3110. return;
  3111. }
  3112. }
  3113.  
  3114. if ((type == 5 || type == 6) && privateChatMode < 2 && ++yOffsetPos >= 5) {
  3115. return;
  3116. }
  3117. }
  3118. }
  3119. }
  3120.  
  3121. private void calcCameraPos() {
  3122. int xPos = spinPacketX * 128 + 64;
  3123. int yPos = spinPacketY * 128 + 64;
  3124. int zPos = method42(plane, yPos, xPos) - spinPacketHeight;
  3125.  
  3126. if (xCameraPos < xPos) {
  3127. xCameraPos += spinPacketConstantSpeed + (xPos - xCameraPos) * spinPacketVariableSpeed / 1000;
  3128.  
  3129. if (xCameraPos > xPos) {
  3130. xCameraPos = xPos;
  3131. }
  3132. }
  3133.  
  3134. if (xCameraPos > xPos) {
  3135. xCameraPos -= spinPacketConstantSpeed + (xCameraPos - xPos) * spinPacketVariableSpeed / 1000;
  3136.  
  3137. if (xCameraPos < xPos) {
  3138. xCameraPos = xPos;
  3139. }
  3140. }
  3141.  
  3142. if (zCameraPos < zPos) {
  3143. zCameraPos += spinPacketConstantSpeed + (zPos - zCameraPos) * spinPacketVariableSpeed / 1000;
  3144.  
  3145. if (zCameraPos > zPos) {
  3146. zCameraPos = zPos;
  3147. }
  3148. }
  3149.  
  3150. if (zCameraPos > zPos) {
  3151. zCameraPos -= spinPacketConstantSpeed + (zCameraPos - zPos) * spinPacketVariableSpeed / 1000;
  3152.  
  3153. if (zCameraPos < zPos) {
  3154. zCameraPos = zPos;
  3155. }
  3156. }
  3157.  
  3158. if (yCameraPos < yPos) {
  3159. yCameraPos += spinPacketConstantSpeed + (yPos - yCameraPos) * spinPacketVariableSpeed / 1000;
  3160.  
  3161. if (yCameraPos > yPos) {
  3162. yCameraPos = yPos;
  3163. }
  3164. }
  3165.  
  3166. if (yCameraPos > yPos) {
  3167. yCameraPos -= spinPacketConstantSpeed + (yCameraPos - yPos) * spinPacketVariableSpeed / 1000;
  3168.  
  3169. if (yCameraPos < yPos) {
  3170. yCameraPos = yPos;
  3171. }
  3172. }
  3173.  
  3174. xPos = moveCameraX * 128 + 64;
  3175. yPos = moveCameraY * 128 + 64;
  3176. zPos = method42(plane, yPos, xPos) - moveCameraZ;
  3177. int l = xPos - xCameraPos;
  3178. int i1 = zPos - zCameraPos;
  3179. int j1 = yPos - yCameraPos;
  3180. int k1 = (int) Math.sqrt(l * l + j1 * j1);
  3181. int l1 = (int) (Math.atan2(i1, k1) * 325.94900000000001D) & 0x7ff;
  3182. int i2 = (int) (Math.atan2(l, j1) * -325.94900000000001D) & 0x7ff;
  3183.  
  3184. if (l1 < cameraAngleLimit) {
  3185. l1 = cameraAngleLimit;
  3186. }
  3187.  
  3188. if (l1 > 383) {
  3189. l1 = 383;
  3190. }
  3191.  
  3192. if (yCameraCurve < l1) {
  3193. yCameraCurve += moveCameraSpeed + (l1 - yCameraCurve) * moveCameraAngle / 1000;
  3194.  
  3195. if (yCameraCurve > l1) {
  3196. yCameraCurve = l1;
  3197. }
  3198. }
  3199.  
  3200. if (yCameraCurve > l1) {
  3201. yCameraCurve -= moveCameraSpeed + (yCameraCurve - l1) * moveCameraAngle / 1000;
  3202.  
  3203. if (yCameraCurve < l1) {
  3204. yCameraCurve = l1;
  3205. }
  3206. }
  3207.  
  3208. int j2 = i2 - xCameraCurve;
  3209.  
  3210. if (j2 > 1024) {
  3211. j2 -= 2048;
  3212. }
  3213.  
  3214. if (j2 < -1024) {
  3215. j2 += 2048;
  3216. }
  3217.  
  3218. if (j2 > 0) {
  3219. xCameraCurve += moveCameraSpeed + j2 * moveCameraAngle / 1000;
  3220. xCameraCurve &= 0x7ff;
  3221. }
  3222.  
  3223. if (j2 < 0) {
  3224. xCameraCurve -= moveCameraSpeed + -j2 * moveCameraAngle / 1000;
  3225. xCameraCurve &= 0x7ff;
  3226. }
  3227.  
  3228. int k2 = i2 - xCameraCurve;
  3229.  
  3230. if (k2 > 1024) {
  3231. k2 -= 2048;
  3232. }
  3233.  
  3234. if (k2 < -1024) {
  3235. k2 += 2048;
  3236. }
  3237.  
  3238. if (k2 < 0 && j2 > 0 || k2 > 0 && j2 < 0) {
  3239. xCameraCurve = i2;
  3240. }
  3241. }
  3242.  
  3243. private void calcEntityScreenPos(int i, int j, int l) {
  3244. if (i < 128 || l < 128 || i > 13056 || l > 13056) {
  3245. spriteDrawX = -1;
  3246. spriteDrawY = -1;
  3247. return;
  3248. }
  3249.  
  3250. int i1 = method42(plane, l, i) - j;
  3251. i -= xCameraPos;
  3252. i1 -= zCameraPos;
  3253. l -= yCameraPos;
  3254. int j1 = Model.modelIntArray1[yCameraCurve];
  3255. int k1 = Model.modelIntArray2[yCameraCurve];
  3256. int l1 = Model.modelIntArray1[xCameraCurve];
  3257. int i2 = Model.modelIntArray2[xCameraCurve];
  3258. int j2 = l * l1 + i * i2 >> 16;
  3259. l = l * i2 - i * l1 >> 16;
  3260. i = j2;
  3261. j2 = i1 * k1 - l * j1 >> 16;
  3262. l = i1 * j1 + l * k1 >> 16;
  3263. i1 = j2;
  3264.  
  3265. if (l >= 50) {
  3266. spriteDrawX = Rasterizer.centerX + (i << log_view_dist) / l;
  3267. spriteDrawY = Rasterizer.centerY + (i1 << log_view_dist) / l;
  3268. } else {
  3269. spriteDrawX = -1;
  3270. spriteDrawY = -1;
  3271. }
  3272. }
  3273.  
  3274. private void chatJoin(long l) {
  3275. try {
  3276. if (l == 0L) {
  3277. return;
  3278. }
  3279.  
  3280. getOut().putOpcode(60);
  3281. getOut().putLong(l);
  3282. return;
  3283. } catch (RuntimeException runtimeexception) {
  3284. Signlink.reportError("47229, " + 3 + ", " + l + ", " + runtimeexception.toString());
  3285. }
  3286.  
  3287. throw new RuntimeException();
  3288. }
  3289.  
  3290. private void checkSize() {
  3291. int width = getScreenWidth();
  3292. int height = getScreenHeight();
  3293. if (GameFrame.getScreenMode() == ScreenMode.RESIZABLE) {
  3294. if (!isApplet) {
  3295. if (clientWidth != width && width >= 782) {
  3296. setResizing(true);
  3297. clientWidth = width;
  3298. super.myWidth = clientWidth;
  3299. updateScreen();
  3300. setResizing(false);
  3301. }
  3302. if (clientHeight != height && height >= 555) {
  3303. setResizing(true);
  3304. clientHeight = height;
  3305. super.myHeight = clientHeight;
  3306. updateScreen();
  3307. setResizing(false);
  3308. }
  3309. } else {
  3310. if (clientWidth != width && width >= 782) {
  3311. setResizing(true);
  3312. clientWidth = super.getWidth();
  3313. super.myWidth = clientWidth;
  3314. updateScreen();
  3315. setResizing(false);
  3316. }
  3317. if (clientHeight != height && height >= 555) {
  3318. setResizing(true);
  3319. clientHeight = super.getHeight();
  3320. super.myHeight = clientHeight;
  3321. updateScreen();
  3322. setResizing(false);
  3323. }
  3324. }
  3325. }
  3326. }
  3327.  
  3328. @Override
  3329. public void cleanUpForQuit() {
  3330. Signlink.reporterror = false;
  3331.  
  3332. try {
  3333. if (getConnection() != null) {
  3334. getConnection().close();
  3335. }
  3336. } catch (Exception _ex) {
  3337. }
  3338.  
  3339. cacheSprite = null;
  3340. setConnection(null);
  3341. stopMidi();
  3342.  
  3343. if (mouseDetection != null) {
  3344. mouseDetection.running = false;
  3345. }
  3346.  
  3347. mouseDetection = null;
  3348.  
  3349. if (onDemandFetcher != null) {
  3350. onDemandFetcher.dispose();
  3351. }
  3352.  
  3353. onDemandFetcher = null;
  3354. aStream_834 = null;
  3355. setOut(null);
  3356. setLoginBuffer(null);
  3357. setInputBuffer(null);
  3358. anIntArray1234 = null;
  3359. aByteArrayArray1183 = null;
  3360. aByteArrayArray1247 = null;
  3361. floorMap = null;
  3362. objectMap = null;
  3363. intGroundArray = null;
  3364. byteGroundArray = null;
  3365. worldController = null;
  3366. aClass11Array1230 = null;
  3367. anIntArrayArray901 = null;
  3368. anIntArrayArray825 = null;
  3369. bigX = null;
  3370. bigY = null;
  3371. aByteArray912 = null;
  3372. tabAreaIP = null;
  3373. leftFrame = null;
  3374. topFrame = null;
  3375. rightFrame = null;
  3376. mapAreaIP = null;
  3377. gameScreenIP = null;
  3378. chatAreaIP = null;
  3379. aRSImageProducer_1125 = null;
  3380. mapBack = null;
  3381. sideIcons = null;
  3382. compass = null;
  3383. hitMarks = null;
  3384. headIcons = null;
  3385. skullIcons = null;
  3386. headIconsHint = null;
  3387. crosses = null;
  3388. mapDotItem = null;
  3389. mapDotNPC = null;
  3390. mapDotPlayer = null;
  3391. mapDotFriend = null;
  3392. mapDotTeam = null;
  3393. mapDotClan = null;
  3394. mapScenes = null;
  3395. mapFunctions = null;
  3396. anIntArrayArray929 = null;
  3397. playerArray = null;
  3398. playerIndices = null;
  3399. anIntArray894 = null;
  3400. setaStreamArray895s(null);
  3401. anIntArray840 = null;
  3402. npcArray = null;
  3403. npcIndices = null;
  3404. groundArray = null;
  3405. setaClass19_1179(null);
  3406. setaClass19_1013(null);
  3407. setaClass19_1056(null);
  3408. menuActionCmd2 = null;
  3409. menuActionCmd3 = null;
  3410. menuActionCmd4 = null;
  3411. menuActionID = null;
  3412. menuActionCmd1 = null;
  3413. menuActionName = null;
  3414. variousSettings = null;
  3415. anIntArray1072 = null;
  3416. anIntArray1073 = null;
  3417. aClass30_Sub2_Sub1_Sub1Array1140 = null;
  3418. miniMapRegions = null;
  3419. friendsList = null;
  3420. friendsListAsLongs = null;
  3421. friendsNodeIDs = null;
  3422. aRSImageProducer_1107 = null;
  3423. titleScreenIP = null;
  3424. multiOverlay = null;
  3425. nullLoader();
  3426. ObjectDefinition.nullify();
  3427. MobDefinition.nullify();
  3428. ItemDefinition.nullify();
  3429. Flo.cache = null;
  3430. IdentityKit.cache = null;
  3431. RSInterface.interfaceCache = null;
  3432. Animation.cache = null;
  3433. SpotAnimDefinition.cache = null;
  3434. SpotAnimDefinition.list = null;
  3435. Varp.setCache(null);
  3436. super.fullGameScreen = null;
  3437. Player.mruNodes = null;
  3438. Rasterizer.nullify();
  3439. WorldController.nullify();
  3440. Model.nullify();
  3441. FrameReader.nullify();
  3442. Texture.reset();
  3443. System.gc();
  3444. }
  3445.  
  3446. public void closeGameInterfaces() {
  3447. getOut().putOpcode(130);
  3448.  
  3449. if (invOverlayInterfaceID != -1) {
  3450. invOverlayInterfaceID = -1;
  3451. dialogueOptionsShowing = false;
  3452. tabAreaAltered = true;
  3453. }
  3454.  
  3455. if (backDialogID != -1) {
  3456. backDialogID = -1;
  3457. inputTaken = true;
  3458. dialogueOptionsShowing = false;
  3459. }
  3460.  
  3461. openInterfaceID = -1;
  3462. setFullscreenInterfaceID(-1);
  3463. }
  3464.  
  3465. private void compareCrcValues() {
  3466. int secondsToWait = 5;
  3467. expectedCRCs[8] = 0;
  3468. int checksumCount = 0;
  3469.  
  3470. while (expectedCRCs[8] == 0) {
  3471. String error = "Unknown problem";
  3472. drawSmoothLoading(20, "Connecting to web server");
  3473.  
  3474. try {
  3475. DataInputStream in = openJagGrabInputStream("crc" + (int) (Math.random() * 99999999D) + "-" + 317);
  3476. ByteBuffer buffer = new ByteBuffer(new byte[40]);
  3477. in.readFully(buffer.buffer, 0, 40);
  3478. in.close();
  3479.  
  3480. for (int index = 0; index < 9; index++) {
  3481. expectedCRCs[index] = buffer.getIntLittleEndian();
  3482. }
  3483.  
  3484. int checksumValue = buffer.getIntLittleEndian();
  3485. int expectedValue = 1234;
  3486.  
  3487. for (int index = 0; index < 9; index++) {
  3488. expectedValue = (expectedValue << 1) + expectedCRCs[index];
  3489. }
  3490.  
  3491. if (checksumValue != expectedValue) {
  3492. error = "checksum problem";
  3493. expectedCRCs[8] = 0;
  3494. }
  3495. } catch (EOFException _ex) {
  3496. error = "EOF problem";
  3497. expectedCRCs[8] = 0;
  3498. } catch (IOException _ex) {
  3499. error = "connection problem";
  3500. expectedCRCs[8] = 0;
  3501. } catch (Exception _ex) {
  3502. error = "logic problem";
  3503. expectedCRCs[8] = 0;
  3504.  
  3505. if (!Signlink.reporterror) {
  3506. return;
  3507. }
  3508. }
  3509.  
  3510. if (expectedCRCs[8] == 0) {
  3511. checksumCount++;
  3512.  
  3513. for (int seconds = secondsToWait; seconds > 0; seconds--) {
  3514. if (checksumCount >= 10) {
  3515. drawSmoothLoading(10, "Game updated - please reload page");
  3516. seconds = 10;
  3517. } else {
  3518. drawSmoothLoading(10, error + " - Will retry in " + seconds + " secs.");
  3519. }
  3520.  
  3521. try {
  3522. Thread.sleep(1000L);
  3523. } catch (Exception _ex) {
  3524. }
  3525. }
  3526.  
  3527. secondsToWait *= 2;
  3528.  
  3529. if (secondsToWait > 60) {
  3530. secondsToWait = 60;
  3531. }
  3532.  
  3533. httpFallback = !httpFallback;
  3534. }
  3535. }
  3536. }
  3537.  
  3538. public Socket createFileServerSocket(int port) throws IOException {
  3539. return new Socket(InetAddress.getByName(InetAddressUtils.toString(Constants.FILE_SERVER_ADDRESS)), port);
  3540. }
  3541.  
  3542. public Socket createGameServerSocket(int port) throws IOException {
  3543. return new Socket(InetAddress.getByName(Constants.connectionStatus.getAddress()), port);
  3544. }
  3545.  
  3546. public void hitmarkDraw(Entity e, int hitLength, int markType, int icon, int damage, int move, int opacity) {
  3547. hitLength *= 2;
  3548. if (damage > 0) {
  3549. if (icon > 0) {
  3550. spriteDrawX += 10;
  3551. Client.cacheSprite[icon + 552].drawTransparentSprite(spriteDrawX - 37, spriteDrawY - 14 + move, opacity);
  3552. }
  3553. markType -= 1;
  3554. int beginning = 543 + markType * 3 + 1;
  3555. Client.cacheSprite[beginning].drawTransparentSprite(spriteDrawX - 14, spriteDrawY - 12 + move, opacity);
  3556. for (int i = 0; i < hitLength; i++) {
  3557. Client.cacheSprite[beginning + 1].drawTransparentSprite(spriteDrawX - 10 + i * 4, spriteDrawY - 12 + move, opacity);
  3558. }
  3559. Client.cacheSprite[beginning + 2].drawTransparentSprite(spriteDrawX - 12 + hitLength * 4, spriteDrawY - 12 + move, opacity);
  3560.  
  3561. if (hitLength == 6) {
  3562. newRegularFont.drawCenteredString(String.valueOf(damage), spriteDrawX + 1, spriteDrawY + 3 + move, 0xffffff, 0x00000);
  3563. } else if (hitLength == 4) {
  3564. newRegularFont.drawCenteredString(String.valueOf(damage), spriteDrawX - 3, spriteDrawY + 3 + move, 0xffffff, 0x00000);
  3565. } else {
  3566. newRegularFont.drawCenteredString(String.valueOf(damage), spriteDrawX - 7, spriteDrawY + 3 + move, 0xffffff, 0x00000);
  3567. }
  3568. } else {
  3569. Client.cacheSprite[543].drawTransparentSprite(spriteDrawX - 12, spriteDrawY - 14 + move, opacity);
  3570. }
  3571. }
  3572.  
  3573. private void delFriend(long nameHash) {
  3574. try {
  3575. if (nameHash == 0L) {
  3576. return;
  3577. }
  3578.  
  3579. for (int i = 0; i < friendCount; i++) {
  3580. if (friendsListAsLongs[i] != nameHash) {
  3581. continue;
  3582. }
  3583.  
  3584. friendCount--;
  3585.  
  3586. for (int n = i; n < friendCount; n++) {
  3587. friendsList[n] = friendsList[n + 1];
  3588. friendsNodeIDs[n] = friendsNodeIDs[n + 1];
  3589. friendsListAsLongs[n] = friendsListAsLongs[n + 1];
  3590. }
  3591.  
  3592. getOut().putOpcode(215);
  3593. getOut().putLong(nameHash);
  3594. break;
  3595. }
  3596. } catch (RuntimeException runtimeexception) {
  3597. Signlink.reportError("18622, " + false + ", " + nameHash + ", " + runtimeexception.toString());
  3598. throw new RuntimeException();
  3599. }
  3600. }
  3601.  
  3602. private void delIgnore(long nameHash) {
  3603. try {
  3604. if (nameHash == 0L) {
  3605. return;
  3606. }
  3607.  
  3608. for (int i = 0; i < ignoreCount; i++) {
  3609. if (ignoreListAsLongs[i] == nameHash) {
  3610. ignoreCount--;
  3611. System.arraycopy(ignoreListAsLongs, i + 1, ignoreListAsLongs, i, ignoreCount - i);
  3612. getOut().putOpcode(74);
  3613. getOut().putLong(nameHash);
  3614. return;
  3615. }
  3616. }
  3617.  
  3618. return;
  3619. } catch (RuntimeException runtimeexception) {
  3620. Signlink.reportError("47229, " + 3 + ", " + nameHash + ", " + runtimeexception.toString());
  3621. }
  3622.  
  3623. throw new RuntimeException();
  3624. }
  3625.  
  3626. private void determineMenuSize() {
  3627. int width = newBoldFont.getTextWidth("Choose Option");
  3628. for (int index = 0; index < menuActionRow; index++) {
  3629. int menuWidth = newBoldFont.getTextWidth(menuActionName[index]);
  3630. if (menuPlayerName[index] != null) {
  3631. menuWidth += newBoldFont.getTextWidth(menuPlayerName[index]);
  3632. }
  3633. if (menuActionTitle[index] != null) {
  3634. menuWidth += newBoldFont.getTextWidth(menuActionTitle[index]);
  3635. }
  3636. if (menuWidth > width) {
  3637. width = menuWidth;
  3638. }
  3639. }
  3640. width += 8;
  3641. int menHeight = 15 * menuActionRow + 21;
  3642. if (GameFrame.getScreenMode() == ScreenMode.FIXED) {
  3643. if (super.saveClickX > 4 && super.saveClickY > 4 && super.saveClickX < 516 && super.saveClickY < 338) {
  3644. int offsetX = super.saveClickX - 4 - width / 2;
  3645. if (offsetX + width > 512) {
  3646. offsetX = 512 - width;
  3647. }
  3648. if (offsetX < 0) {
  3649. offsetX = 0;
  3650. }
  3651. int offsetY = super.saveClickY - 4;
  3652. if (offsetY + menHeight > 334) {
  3653. offsetY = 334 - menHeight;
  3654. }
  3655. if (offsetY < 0) {
  3656. offsetY = 0;
  3657. }
  3658. menuOpen = true;
  3659. menuScreenArea = 0;
  3660. menuOffsetX = offsetX;
  3661. menuOffsetY = offsetY;
  3662. menuWidth = width;
  3663. menuHeight = 15 * menuActionRow + 22;
  3664. }
  3665. if (super.saveClickX > 519 && super.saveClickY > 168 && super.saveClickX < 765 && super.saveClickY < 503) {
  3666. int offsetX = super.saveClickX - 519 - width / 2;
  3667. if (offsetX < 0) {
  3668. offsetX = 0;
  3669. } else if (offsetX + width > 245) {
  3670. offsetX = 245 - width;
  3671. }
  3672. int offsetY = super.saveClickY - 168;
  3673. if (offsetY < 0) {
  3674. offsetY = 0;
  3675. } else if (offsetY + menHeight > 333) {
  3676. offsetY = 333 - menHeight;
  3677. }
  3678. menuOpen = true;
  3679. menuScreenArea = 1;
  3680. menuOffsetX = offsetX;
  3681. menuOffsetY = offsetY;
  3682. menuWidth = width;
  3683. menuHeight = 15 * menuActionRow + 22;
  3684. }
  3685. if (super.saveClickX > 0 && super.saveClickY > 338 && super.saveClickX < 516 && super.saveClickY < 503) {
  3686. int offsetX = super.saveClickX - 0 - width / 2;
  3687. if (offsetX < 0) {
  3688. offsetX = 0;
  3689. } else if (offsetX + width > 516) {
  3690. offsetX = 516 - width;
  3691. }
  3692. int offsetY = super.saveClickY - 338;
  3693. if (offsetY < 0) {
  3694. offsetY = 0;
  3695. } else if (offsetY + menHeight > 165) {
  3696. offsetY = 165 - menHeight;
  3697. }
  3698. menuOpen = true;
  3699. menuScreenArea = 2;
  3700. menuOffsetX = offsetX;
  3701. menuOffsetY = offsetY;
  3702. menuWidth = width;
  3703. menuHeight = 15 * menuActionRow + 22;
  3704. }
  3705. // if(super.saveClickX > 0 && super.saveClickY > 338 &&
  3706. // super.saveClickX < 516 && super.saveClickY < 503) {
  3707. if (super.saveClickX > 519 && super.saveClickY > 0 && super.saveClickX < 765 && super.saveClickY < 168) {
  3708. int offsetX = super.saveClickX - 519 - width / 2;
  3709. if (offsetX < 0) {
  3710. offsetX = 0;
  3711. } else if (offsetX + width > 245) {
  3712. offsetX = 245 - width;
  3713. }
  3714. int offsetY = super.saveClickY - 0;
  3715. if (offsetY < 0) {
  3716. offsetY = 0;
  3717. } else if (offsetY + menHeight > 168) {
  3718. offsetY = 168 - menHeight;
  3719. }
  3720. menuOpen = true;
  3721. menuScreenArea = 3;
  3722. menuOffsetX = offsetX;
  3723. menuOffsetY = offsetY;
  3724. menuWidth = width;
  3725. menuHeight = 15 * menuActionRow + 22;
  3726. }
  3727. } else {
  3728. if (super.saveClickX > 0 && super.saveClickY > 0 && super.saveClickX < getScreenWidth() && super.saveClickY < getScreenHeight()) {
  3729. int offsetX = super.saveClickX - 0 - width / 2;
  3730. if (offsetX + width > getScreenWidth()) {
  3731. offsetX = getScreenWidth() - width;
  3732. }
  3733. if (offsetX < 0) {
  3734. offsetX = 0;
  3735. }
  3736. int offsetY = super.saveClickY - 0;
  3737. if (offsetY + menHeight > getScreenHeight()) {
  3738. offsetY = getScreenHeight() - menHeight;
  3739. }
  3740. if (offsetY < 0) {
  3741. offsetY = 0;
  3742. }
  3743. menuOpen = true;
  3744. menuScreenArea = 0;
  3745. menuOffsetX = offsetX;
  3746. menuOffsetY = offsetY;
  3747. menuWidth = width;
  3748. menuHeight = 15 * menuActionRow + 22;
  3749. }
  3750. }
  3751. }
  3752.  
  3753. @SuppressWarnings("unused")
  3754. private void doAction(int actionId) {
  3755. if (actionId < 0) {
  3756. return;
  3757. }
  3758.  
  3759. if (inputDialogState != 0) {
  3760. inputDialogState = 0;
  3761. inputTaken = true;
  3762. }
  3763.  
  3764. int firstMenuAction = menuActionCmd1[actionId];
  3765. int secondMenuAction = menuActionCmd2[actionId];
  3766. int thirdMenuAction = menuActionCmd3[actionId];
  3767. int fourthMenuAction = menuActionCmd4[actionId];
  3768. int action = menuActionID[actionId];
  3769. int x = secondMenuAction;
  3770. int y = thirdMenuAction;
  3771. int id = firstMenuAction > 0x7fff ? fourthMenuAction : firstMenuAction >> 14 & 0x7fff;
  3772.  
  3773. if (action >= 2000) {
  3774. action -= 2000;
  3775. }
  3776.  
  3777. if (menuActionName[actionId].contains("Close")) {
  3778. closeGameInterfaces();
  3779. }
  3780.  
  3781. if (action >= 1315 && action <= 1321) {
  3782. getOut().putOpcode(200);
  3783. getOut().putShortBigEndian(PlayerHandler.clanName.length() - 1);
  3784. int k2 = getOut().position;
  3785. getOut().putString(PlayerHandler.clanName);
  3786. getOut().getByte(action - 1314);
  3787. getOut().putVariableSizeByte(getOut().position - k2);
  3788. }
  3789.  
  3790. if (action == 712) {
  3791. // Toggle
  3792. Constants.MONEY_POUCH_ENABLED = !Constants.MONEY_POUCH_ENABLED;
  3793. }
  3794. if (action == 713) {
  3795. inputTaken = true;
  3796. messagePromptRaised = true;
  3797. amountOrNameInput = "";
  3798. inputString = "";
  3799. inputDialogState = 0;
  3800. interfaceButtonAction = 557;
  3801. friendsListAction = 0;
  3802. promptInput = "";
  3803. promptMessage = "How much would you like to withdraw?";
  3804. }
  3805. if (action == 714) {
  3806. inputTaken = true;
  3807. messagePromptRaised = true;
  3808. amountOrNameInput = "";
  3809. inputDialogState = 0;
  3810. interfaceButtonAction = 558;
  3811. friendsListAction = 0;
  3812. promptInput = "";
  3813. promptMessage = "How much would you like to deposit?";
  3814. }
  3815. if (action == 715) {
  3816. sendPacket(108);
  3817. }
  3818.  
  3819. switch (action) {
  3820. case 1044:
  3821. int currentPray;
  3822. currentPray = Integer.parseInt(RSInterface.interfaceCache[4012].message);
  3823.  
  3824. if (currentPray != 0) {
  3825. getMapArea().prayer.setOrbState(!getMapArea().prayer.getOrbState());
  3826. } else {
  3827. getMapArea().prayer.setOrbState(false);
  3828. pushMessage("You have run out of prayer points!", 0, "");
  3829. }
  3830.  
  3831. getOut().putOpcode(243);
  3832. getOut().putShort(6000);
  3833. break;
  3834.  
  3835. case 1506: // Select quick prayers
  3836. getOut().putOpcode(243);
  3837. getOut().putShort(6001);
  3838. break;
  3839.  
  3840. case 1050:
  3841. getMapArea().run.setOrbState(running);
  3842. getOut().putOpcode(243);
  3843. getOut().putShort(152);
  3844. }
  3845.  
  3846. if (action == 1014) {
  3847. setNorth();
  3848. }
  3849.  
  3850. if (action == 10424) {
  3851. getOut().putOpcode(243);
  3852. getOut().putShort(12424);
  3853. }
  3854.  
  3855. if (action == 13004) {
  3856. getOut().putOpcode(243);
  3857. getOut().putShort(15005);
  3858. }
  3859.  
  3860. if (action == 13005) {
  3861. getOut().putOpcode(243);
  3862. getOut().putShort(15006);
  3863. }
  3864.  
  3865. if (action == 13006) {
  3866. getOut().putOpcode(243);
  3867. getOut().putShort(15007);
  3868. }
  3869.  
  3870. if (action == 13007) {
  3871. getOut().putOpcode(243);
  3872. getOut().putShort(15008);
  3873. }
  3874.  
  3875. if (action == 1506) {
  3876. // Select quick prayers
  3877. getOut().putOpcode(243);
  3878. getOut().putShort(5001);
  3879. }
  3880.  
  3881. if (action == 1007) {
  3882. PlayerHandler.canGainXP = PlayerHandler.canGainXP ? false : true;
  3883. }
  3884.  
  3885. if (action == 1006 && !PlayerHandler.showBonus) {
  3886. if (!PlayerHandler.gains.isEmpty()) {
  3887. PlayerHandler.gains.removeAll(PlayerHandler.gains);
  3888. }
  3889.  
  3890. PlayerHandler.showXP = PlayerHandler.showXP ? false : true;
  3891. } else if (action == 1013) {
  3892. sendCommandPacket("resetexperiencecounter");
  3893. }
  3894.  
  3895. if (action == 1030 && !PlayerHandler.showXP) {
  3896. PlayerHandler.showBonus = PlayerHandler.showBonus ? false : true;
  3897. }
  3898.  
  3899. if (action == 104) {
  3900. RSInterface class9_1 = RSInterface.interfaceCache[thirdMenuAction];
  3901. spellID = class9_1.id;
  3902.  
  3903. if (!autocast) {
  3904. autocast = true;
  3905. pushMessage("Autocast spell selected.", 0, "");
  3906. autocastId = class9_1.id;
  3907. getOut().putOpcode(243);
  3908. getOut().putShort(class9_1.id);
  3909. } else if (autocastId == class9_1.id) {
  3910. autocast = false;
  3911. autocastId = 0;
  3912. pushMessage("Autocast spell cleared.", 0, "");
  3913. getOut().putOpcode(243);
  3914. getOut().putShort(6666); // reset server side
  3915. } else if (autocastId != class9_1.id) {
  3916. autocast = true;
  3917. pushMessage("Autocast spell selected.", 0, "");
  3918. autocastId = class9_1.id;
  3919. getOut().putOpcode(243);
  3920. getOut().putShort(class9_1.id);
  3921. }
  3922. }
  3923.  
  3924. if (action == 582) {
  3925. NPC npc = npcArray[firstMenuAction];
  3926.  
  3927. if (npc != null) {
  3928. doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, npc.smallY[0], myPlayer.smallX[0], false, npc.smallX[0]);
  3929. crossX = super.saveClickX;
  3930. crossY = super.saveClickY;
  3931. crossType = 2;
  3932. crossIndex = 0;
  3933. getOut().putOpcode(57);
  3934. getOut().putShortSpecialA(anInt1285);
  3935. getOut().putShortSpecialA(firstMenuAction);
  3936. getOut().method431(anInt1283);
  3937. getOut().putShortSpecialA(anInt1284);
  3938. }
  3939. }
  3940.  
  3941. if (action == 234) {
  3942. boolean flag1 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, thirdMenuAction, myPlayer.smallX[0], false, x);
  3943.  
  3944. if (!flag1) {
  3945. flag1 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, thirdMenuAction, myPlayer.smallX[0], false, x);
  3946. }
  3947.  
  3948. crossX = super.saveClickX;
  3949. crossY = super.saveClickY;
  3950. crossType = 2;
  3951. crossIndex = 0;
  3952. getOut().putOpcode(223);
  3953. getOut().method431(y + baseY);
  3954. getOut().putShort(firstMenuAction);
  3955. getOut().method431(x + baseX);
  3956. }
  3957.  
  3958. if (action == 62 && method66(firstMenuAction, y, x, id)) {
  3959. getOut().putOpcode(192);
  3960. getOut().putShort(anInt1284);
  3961. getOut().method431(id);
  3962. getOut().method433(y + baseY);
  3963. getOut().method431(anInt1283);
  3964. getOut().method433(x + baseX);
  3965. getOut().putShort(anInt1285);
  3966. }
  3967.  
  3968. if (action == 511) {
  3969. boolean flag2 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, y, myPlayer.smallX[0], false, x);
  3970.  
  3971. if (!flag2) {
  3972. flag2 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, y, myPlayer.smallX[0], false, x);
  3973. }
  3974.  
  3975. crossX = super.saveClickX;
  3976. crossY = super.saveClickY;
  3977. crossType = 2;
  3978. crossIndex = 0;
  3979. getOut().putOpcode(109);
  3980. getOut().method431(anInt1284);
  3981. getOut().putShortSpecialA(anInt1285);
  3982. getOut().putShort(firstMenuAction);
  3983. getOut().putShortSpecialA(y + baseY);
  3984. getOut().method433(anInt1283);
  3985. getOut().putShort(x + baseX);
  3986. }
  3987.  
  3988. if (action == 74) {
  3989. getOut().putOpcode(122);
  3990. getOut().method433(y);
  3991. getOut().putShortSpecialA(secondMenuAction);
  3992. getOut().method431(firstMenuAction);
  3993. atInventoryLoopCycle = 0;
  3994. atInventoryInterface = y;
  3995. atInventoryIndex = x;
  3996. atInventoryInterfaceType = 2;
  3997.  
  3998. if (RSInterface.interfaceCache[y].parentID == openInterfaceID) {
  3999. atInventoryInterfaceType = 1;
  4000. }
  4001.  
  4002. if (RSInterface.interfaceCache[y].parentID == backDialogID) {
  4003. atInventoryInterfaceType = 3;
  4004. }
  4005. }
  4006. if (action == 315) {
  4007. switch (thirdMenuAction) {
  4008. case 24018: // fixed
  4009. toggleSize(ScreenMode.FIXED);
  4010. break;
  4011.  
  4012. case 24021: // resizable
  4013. toggleSize(ScreenMode.RESIZABLE);
  4014. break;
  4015.  
  4016. case 24024: // fullscreen
  4017. toggleSize(ScreenMode.FULLSCREEN);
  4018. }
  4019.  
  4020. RSInterface class9 = RSInterface.interfaceCache[thirdMenuAction];
  4021. boolean flag8 = true;
  4022.  
  4023. if (class9.contentType > 0) {
  4024. flag8 = promptUserForInput(class9);
  4025. }
  4026.  
  4027. if (flag8) {
  4028. switch (thirdMenuAction) {
  4029. case 21341:
  4030. sendFrame248(21172, 3213);
  4031. resetInterfaceSequence(21172);
  4032. inputTaken = true;
  4033. break;
  4034.  
  4035. default:
  4036. getOut().putOpcode(243);
  4037. getOut().putShort(thirdMenuAction);
  4038. }
  4039. }
  4040. }
  4041.  
  4042. if (action == 561) {
  4043. Player player = playerArray[firstMenuAction];
  4044.  
  4045. if (player != null) {
  4046. doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, player.smallY[0], myPlayer.smallX[0], false, player.smallX[0]);
  4047. crossX = super.saveClickX;
  4048. crossY = super.saveClickY;
  4049. crossType = 2;
  4050. crossIndex = 0;
  4051. setAnInt1188(getAnInt1188() + id);
  4052.  
  4053. if (getAnInt1188() >= 90) {
  4054. getOut().putOpcode(136);
  4055. setAnInt1188(0);
  4056. }
  4057.  
  4058. getOut().putOpcode(158);
  4059. getOut().putShort(firstMenuAction);
  4060. }
  4061. }
  4062.  
  4063. if (action == 20) {
  4064. NPC npc = npcArray[firstMenuAction];
  4065. if (npc != null) {
  4066. doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, npc.smallY[0], myPlayer.smallX[0], false, npc.smallX[0]);
  4067. crossX = super.saveClickX;
  4068. crossY = super.saveClickY;
  4069. crossType = 2;
  4070. crossIndex = 0;
  4071. getOut().putOpcode(102);
  4072. getOut().method431(firstMenuAction);
  4073. }
  4074. }
  4075.  
  4076. if (action == 779) {
  4077. Player player = playerArray[firstMenuAction];
  4078.  
  4079. if (player != null) {
  4080. doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, player.smallY[0], myPlayer.smallX[0], false, player.smallX[0]);
  4081. crossX = super.saveClickX;
  4082. crossY = super.saveClickY;
  4083. crossType = 2;
  4084. crossIndex = 0;
  4085. getOut().putOpcode(153);
  4086. getOut().method431(firstMenuAction);
  4087. }
  4088. }
  4089.  
  4090. if (action == 516) {
  4091. if (!menuOpen) {
  4092. worldController.method312(super.saveClickY - 4, super.saveClickX - 4);
  4093. } else {
  4094. worldController.method312(thirdMenuAction - 4, secondMenuAction - 4);
  4095. }
  4096. }
  4097.  
  4098. if (action == 1062) {
  4099. setAnInt924(getAnInt924() + baseX);
  4100.  
  4101. if (getAnInt924() >= 113) {
  4102. getOut().putOpcode(183);
  4103. getOut().putDWordBigEndian(0xe63271);
  4104. setAnInt924(0);
  4105. }
  4106.  
  4107. method66(firstMenuAction, y, x, id);
  4108. getOut().putOpcode(228);
  4109. getOut().putShortSpecialA(id);
  4110. getOut().putShortSpecialA(thirdMenuAction + baseY);
  4111. getOut().putShort(secondMenuAction + baseX);
  4112. }
  4113. if (action == 679 && !dialogueOptionsShowing) {
  4114. getOut().putOpcode(45);
  4115. getOut().putShort(thirdMenuAction);
  4116. dialogueOptionsShowing = true;
  4117. }
  4118.  
  4119. if (action == 431) {
  4120. getOut().putOpcode(129);
  4121. getOut().putShortSpecialA(secondMenuAction);
  4122. getOut().putShort(thirdMenuAction);
  4123. getOut().putShortSpecialA(firstMenuAction);
  4124. atInventoryLoopCycle = 0;
  4125. atInventoryInterface = thirdMenuAction;
  4126. atInventoryIndex = secondMenuAction;
  4127. atInventoryInterfaceType = 2;
  4128.  
  4129. if (RSInterface.interfaceCache[thirdMenuAction].parentID == openInterfaceID) {
  4130. atInventoryInterfaceType = 1;
  4131. }
  4132.  
  4133. if (RSInterface.interfaceCache[thirdMenuAction].parentID == backDialogID) {
  4134. atInventoryInterfaceType = 3;
  4135. }
  4136. }
  4137.  
  4138. if (action == 337 || action == 42 || action == 792 || action == 322) {
  4139. String s = menuActionName[actionId];
  4140. int k1 = s.indexOf("@whi@");
  4141.  
  4142. if (k1 != -1) {
  4143. long l3 = TextClass.longForName(NAME_PATTERN.matcher(s.substring(k1 + 5)).replaceAll(""));
  4144.  
  4145. if (action == 337) {
  4146. addFriend(l3);
  4147. } else if (action == 42) {
  4148. addIgnore(l3);
  4149. } else if (action == 792) {
  4150. delFriend(l3);
  4151. } else if (action == 322) {
  4152. delIgnore(l3);
  4153. }
  4154. }
  4155. }
  4156.  
  4157. if (action == 53) {
  4158. getOut().putOpcode(135);
  4159. getOut().putShortSpecialA(thirdMenuAction);
  4160. getOut().method431(secondMenuAction);
  4161. getOut().method431(firstMenuAction);
  4162. atInventoryLoopCycle = 0;
  4163. atInventoryInterface = thirdMenuAction;
  4164. atInventoryIndex = secondMenuAction;
  4165. atInventoryInterfaceType = 2;
  4166.  
  4167. if (RSInterface.interfaceCache[thirdMenuAction].parentID == openInterfaceID) {
  4168. atInventoryInterfaceType = 1;
  4169. }
  4170. if (RSInterface.interfaceCache[thirdMenuAction].parentID == backDialogID) {
  4171. atInventoryInterfaceType = 3;
  4172. }
  4173. }
  4174.  
  4175. if (action == 539) {
  4176. getOut().putOpcode(16);
  4177. getOut().putShortSpecialA(firstMenuAction);
  4178. getOut().method433(secondMenuAction);
  4179. getOut().method433(thirdMenuAction);
  4180. atInventoryLoopCycle = 0;
  4181. atInventoryInterface = thirdMenuAction;
  4182. atInventoryIndex = secondMenuAction;
  4183. atInventoryInterfaceType = 2;
  4184.  
  4185. if (RSInterface.interfaceCache[thirdMenuAction].parentID == openInterfaceID) {
  4186. atInventoryInterfaceType = 1;
  4187. }
  4188.  
  4189. if (RSInterface.interfaceCache[thirdMenuAction].parentID == backDialogID) {
  4190. atInventoryInterfaceType = 3;
  4191. }
  4192. }
  4193.  
  4194. if (action == 484 || action == 6 || action == 17) {
  4195. String name = menuActionName[actionId];
  4196. int l1 = name.indexOf("@whi@");
  4197.  
  4198. if (l1 != -1) {
  4199. name = name.substring(l1 + 5).trim();
  4200. String username = TextClass.fixName(TextClass.nameForLong(TextClass.longForName(name)));
  4201. boolean sent = false;
  4202.  
  4203. for (int index = 0; index < playerCount; index++) {
  4204. Player player = playerArray[playerIndices[index]];
  4205.  
  4206. if (player == null || player.name == null || !player.name.equalsIgnoreCase(username)) {
  4207. continue;
  4208. }
  4209.  
  4210. doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, player.smallY[0], myPlayer.smallX[0], false, player.smallX[0]);
  4211.  
  4212. if (action == 484) {
  4213. getOut().putOpcode(140);
  4214. getOut().method431(playerIndices[index]);
  4215. }
  4216.  
  4217. if (action == 6) {
  4218. setAnInt1188(getAnInt1188() + firstMenuAction);
  4219.  
  4220. if (getAnInt1188() >= 90) {
  4221. getOut().putOpcode(136);
  4222. setAnInt1188(0);
  4223. }
  4224.  
  4225. getOut().putOpcode(158);
  4226. getOut().putShort(playerIndices[index]);
  4227. }
  4228. if (action == 17) {
  4229. getOut().putOpcode(159);
  4230. getOut().putShort(playerIndices[index]);
  4231. }
  4232.  
  4233. sent = true;
  4234. break;
  4235. }
  4236.  
  4237. if (!sent) {
  4238. pushMessage("Unable to find " + username, 0, "");
  4239. }
  4240. }
  4241. }
  4242.  
  4243. if (action == 870) {
  4244. getOut().putOpcode(53);
  4245. getOut().putShort(secondMenuAction);
  4246. getOut().putShortSpecialA(anInt1283);
  4247. getOut().method433(firstMenuAction);
  4248. getOut().putShort(anInt1284);
  4249. getOut().method431(anInt1285);
  4250. getOut().putShort(thirdMenuAction);
  4251. atInventoryLoopCycle = 0;
  4252. atInventoryInterface = thirdMenuAction;
  4253. atInventoryIndex = secondMenuAction;
  4254. atInventoryInterfaceType = 2;
  4255.  
  4256. if (RSInterface.interfaceCache[thirdMenuAction].parentID == openInterfaceID) {
  4257. atInventoryInterfaceType = 1;
  4258. }
  4259.  
  4260. if (RSInterface.interfaceCache[thirdMenuAction].parentID == backDialogID) {
  4261. atInventoryInterfaceType = 3;
  4262. }
  4263. }
  4264.  
  4265. if (action == 847) {
  4266. getOut().putOpcode(71);
  4267. getOut().putShort(thirdMenuAction);
  4268. getOut().putShortSpecialA(secondMenuAction);
  4269. getOut().putShortSpecialA(firstMenuAction);
  4270. atInventoryLoopCycle = 0;
  4271. atInventoryInterface = thirdMenuAction;
  4272. atInventoryIndex = secondMenuAction;
  4273. atInventoryInterfaceType = 2;
  4274.  
  4275. if (RSInterface.interfaceCache[thirdMenuAction].parentID == openInterfaceID) {
  4276. atInventoryInterfaceType = 1;
  4277. }
  4278.  
  4279. if (RSInterface.interfaceCache[thirdMenuAction].parentID == backDialogID) {
  4280. atInventoryInterfaceType = 3;
  4281. }
  4282. }
  4283.  
  4284. if (action == 626) {
  4285. RSInterface class9_1 = RSInterface.interfaceCache[thirdMenuAction];
  4286. spellSelected = 1;
  4287. spellID = class9_1.id;
  4288. anInt1137 = thirdMenuAction;
  4289. spellUsableOn = class9_1.spellUsableOn;
  4290. itemSelected = 0;
  4291. String s4 = class9_1.selectedActionName;
  4292.  
  4293. if (s4.indexOf(" ") != -1) {
  4294. s4 = s4.substring(0, s4.indexOf(" "));
  4295. }
  4296.  
  4297. String s8 = class9_1.selectedActionName;
  4298.  
  4299. if (s8.indexOf(" ") != -1) {
  4300. s8 = s8.substring(s8.indexOf(" ") + 1);
  4301. }
  4302.  
  4303. spellTooltip = s4 + " " + class9_1.spellName + " " + s8;
  4304. // class9_1.sprite1.drawSprite(class9_1.anInt263, class9_1.anInt265,
  4305. // 0xffffff);
  4306. // class9_1.sprite1.drawSprite(200,200);
  4307. // System.out.println("Sprite: " + class9_1.sprite1.toString());
  4308.  
  4309. if (spellUsableOn == 16) {
  4310. tabID = 3;
  4311. tabAreaAltered = true;
  4312. }
  4313.  
  4314. return;
  4315. }
  4316.  
  4317. if (action == 78) {
  4318. getOut().putOpcode(117);
  4319. getOut().method433(thirdMenuAction);
  4320. getOut().method431(secondMenuAction);
  4321. getOut().method433(firstMenuAction);
  4322. atInventoryLoopCycle = 0;
  4323. atInventoryInterface = thirdMenuAction;
  4324. atInventoryIndex = secondMenuAction;
  4325. atInventoryInterfaceType = 2;
  4326.  
  4327. if (RSInterface.interfaceCache[thirdMenuAction].parentID == openInterfaceID) {
  4328. atInventoryInterfaceType = 1;
  4329. }
  4330.  
  4331. if (RSInterface.interfaceCache[thirdMenuAction].parentID == backDialogID) {
  4332. atInventoryInterfaceType = 3;
  4333. }
  4334. }
  4335.  
  4336. // XXX
  4337. if (action == 291) {
  4338. getOut().putOpcode(145);
  4339. getOut().putShortSpecialA(thirdMenuAction);
  4340. getOut().putShortSpecialA(secondMenuAction);
  4341. getOut().putShortSpecialA(firstMenuAction);
  4342. }
  4343.  
  4344. if (action == 27) {
  4345. Player class30_sub2_sub4_sub1_sub2_2 = playerArray[firstMenuAction];
  4346.  
  4347. if (class30_sub2_sub4_sub1_sub2_2 != null) {
  4348. 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]);
  4349. crossX = super.saveClickX;
  4350. crossY = super.saveClickY;
  4351. crossType = 2;
  4352. crossIndex = 0;
  4353. setAnInt986(getAnInt986() + firstMenuAction);
  4354.  
  4355. if (getAnInt986() >= 54) {
  4356. getOut().putOpcode(189);
  4357. getOut().putShortBigEndian(234);
  4358. setAnInt986(0);
  4359. }
  4360.  
  4361. getOut().putOpcode(73);
  4362. getOut().method431(firstMenuAction);
  4363. }
  4364. }
  4365.  
  4366. if (action == 213) {
  4367. boolean flag3 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, thirdMenuAction, myPlayer.smallX[0], false, secondMenuAction);
  4368.  
  4369. if (!flag3) {
  4370. flag3 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, thirdMenuAction, myPlayer.smallX[0], false, secondMenuAction);
  4371. }
  4372.  
  4373. crossX = super.saveClickX;
  4374. crossY = super.saveClickY;
  4375. crossType = 2;
  4376. crossIndex = 0;
  4377. getOut().putOpcode(79);
  4378. getOut().method431(thirdMenuAction + baseY);
  4379. getOut().putShort(firstMenuAction);
  4380. getOut().putShortSpecialA(secondMenuAction + baseX);
  4381. }
  4382.  
  4383. if (action == 632) {
  4384. getOut().putOpcode(149);
  4385. getOut().putShortSpecialA(thirdMenuAction);
  4386. getOut().putShortSpecialA(secondMenuAction);
  4387. getOut().putShortSpecialA(firstMenuAction);
  4388. atInventoryLoopCycle = 0;
  4389. atInventoryInterface = thirdMenuAction;
  4390. atInventoryIndex = secondMenuAction;
  4391. atInventoryInterfaceType = 2;
  4392.  
  4393. if (RSInterface.interfaceCache[thirdMenuAction].parentID == openInterfaceID) {
  4394. atInventoryInterfaceType = 1;
  4395. }
  4396.  
  4397. if (RSInterface.interfaceCache[thirdMenuAction].parentID == backDialogID) {
  4398. atInventoryInterfaceType = 3;
  4399. }
  4400. }
  4401.  
  4402. if (action == 1004) {
  4403. if (tabInterfaceIDs[10] != -1) {
  4404. tabID = 10;
  4405. tabAreaAltered = true;
  4406. }
  4407. }
  4408.  
  4409. if (action == 1003) {
  4410. inputTaken = true;
  4411. }
  4412.  
  4413. if (action == 1002) {
  4414. inputTaken = true;
  4415. }
  4416.  
  4417. if (action == 1001) {
  4418. inputTaken = true;
  4419. }
  4420.  
  4421. if (action == 1000) {
  4422. chatArea.toggleButton(this, 4);
  4423. cButtonCPos = 4;
  4424. chatTypeView = 11;
  4425. inputTaken = true;
  4426. }
  4427.  
  4428. if (action == 999) {
  4429. chatArea.toggleButton(this, 0);
  4430. cButtonCPos = 0;
  4431. chatTypeView = 0;
  4432. inputTaken = true;
  4433. }
  4434.  
  4435. if (action == 998) {
  4436. chatArea.toggleButton(this, 1);
  4437. cButtonCPos = 1;
  4438. chatTypeView = 5;
  4439. inputTaken = true;
  4440. }
  4441.  
  4442. if (action == 997) {
  4443. publicChatMode = 3;
  4444. inputTaken = true;
  4445. }
  4446.  
  4447. if (action == 996) {
  4448. publicChatMode = 2;
  4449. inputTaken = true;
  4450. }
  4451.  
  4452. if (action == 995) {
  4453. publicChatMode = 1;
  4454. inputTaken = true;
  4455. }
  4456.  
  4457. if (action == 994) {
  4458. publicChatMode = 0;
  4459. inputTaken = true;
  4460. }
  4461.  
  4462. if (action == 993) {
  4463. chatArea.toggleButton(this, 2);
  4464. cButtonCPos = 2;
  4465. chatTypeView = 1;
  4466. inputTaken = true;
  4467. }
  4468.  
  4469. if (action == 992) {
  4470. privateChatMode = 2;
  4471. inputTaken = true;
  4472. privateChatMode = 2;
  4473. getOut().putOpcode(95);
  4474. getOut().putShortBigEndian(publicChatMode);
  4475. getOut().putShortBigEndian(privateChatMode);
  4476. getOut().putShortBigEndian(tradeMode);
  4477. }
  4478.  
  4479. if (action == 991) {
  4480. privateChatMode = 1;
  4481. inputTaken = true;
  4482. getOut().putOpcode(95);
  4483. getOut().putShortBigEndian(publicChatMode);
  4484. getOut().putShortBigEndian(privateChatMode);
  4485. getOut().putShortBigEndian(tradeMode);
  4486. }
  4487.  
  4488. if (action == 990) {
  4489. privateChatMode = 0;
  4490. inputTaken = true;
  4491. getOut().putOpcode(95);
  4492. getOut().putShortBigEndian(publicChatMode);
  4493. getOut().putShortBigEndian(privateChatMode);
  4494. getOut().putShortBigEndian(tradeMode);
  4495. }
  4496.  
  4497. if (action == 989) {
  4498. chatArea.toggleButton(this, 3);
  4499. cButtonCPos = 3;
  4500. chatTypeView = 2;
  4501. inputTaken = true;
  4502. getOut().putOpcode(95);
  4503. getOut().putShortBigEndian(publicChatMode);
  4504. getOut().putShortBigEndian(privateChatMode);
  4505. getOut().putShortBigEndian(tradeMode);
  4506. }
  4507.  
  4508. if (action == 987) {
  4509. tradeMode = 2;
  4510. inputTaken = true;
  4511. }
  4512.  
  4513. if (action == 986) {
  4514. tradeMode = 1;
  4515. inputTaken = true;
  4516. }
  4517.  
  4518. if (action == 985) {
  4519. tradeMode = 0;
  4520. inputTaken = true;
  4521. }
  4522.  
  4523. if (action == 984) {
  4524. chatArea.toggleButton(this, 5);
  4525. cButtonCPos = 5;
  4526. chatTypeView = 3;
  4527. inputTaken = true;
  4528. }
  4529.  
  4530. if (action == 983) {
  4531. duelStatus = 2;
  4532. }
  4533. if (action == 982) {
  4534. duelStatus = 1;
  4535. }
  4536. if (action == 981) {
  4537. duelStatus = 0;
  4538. }
  4539.  
  4540. if (action == 980) {
  4541. chatArea.toggleButton(this, 6);
  4542. cButtonCPos = 6;
  4543. chatTypeView = 14;
  4544. inputTaken = true;
  4545. }
  4546.  
  4547. if (action == 983) {
  4548. inputTaken = true;
  4549. }
  4550.  
  4551. if (action == 982) {
  4552. inputTaken = true;
  4553. }
  4554.  
  4555. if (action == 981) {
  4556. inputTaken = true;
  4557. }
  4558.  
  4559. if (action == 980) {
  4560. chatArea.toggleButton(this, 6);
  4561. cButtonCPos = 6;
  4562. chatTypeView = 4;
  4563. inputTaken = true;
  4564. }
  4565.  
  4566. if (action == 493) {
  4567. if (firstMenuAction == 995) {
  4568. inputTaken = true;
  4569. messagePromptRaised = true;
  4570. amountOrNameInput = "";
  4571. inputDialogState = 0;
  4572. interfaceButtonAction = 558;
  4573. friendsListAction = 0;
  4574. promptInput = "";
  4575. promptMessage = "How much would you like to deposit?";
  4576. } else {
  4577. }
  4578.  
  4579. getOut().putOpcode(75);
  4580. getOut().method433(thirdMenuAction);
  4581. getOut().method431(secondMenuAction);
  4582. getOut().putShortSpecialA(firstMenuAction);
  4583. atInventoryLoopCycle = 0;
  4584. atInventoryInterface = thirdMenuAction;
  4585. atInventoryIndex = secondMenuAction;
  4586. atInventoryInterfaceType = 2;
  4587.  
  4588. if (RSInterface.interfaceCache[thirdMenuAction].parentID == openInterfaceID) {
  4589. atInventoryInterfaceType = 1;
  4590. }
  4591.  
  4592. if (RSInterface.interfaceCache[thirdMenuAction].parentID == backDialogID) {
  4593. atInventoryInterfaceType = 3;
  4594. }
  4595. }
  4596.  
  4597. if (action == 652) {
  4598. boolean flag4 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, thirdMenuAction, myPlayer.smallX[0], false, secondMenuAction);
  4599.  
  4600. if (!flag4) {
  4601. flag4 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, thirdMenuAction, myPlayer.smallX[0], false, secondMenuAction);
  4602. }
  4603.  
  4604. crossX = super.saveClickX;
  4605. crossY = super.saveClickY;
  4606. crossType = 2;
  4607. crossIndex = 0;
  4608. getOut().putOpcode(156);
  4609. getOut().putShortSpecialA(secondMenuAction + baseX);
  4610. getOut().method431(thirdMenuAction + baseY);
  4611. getOut().method433(firstMenuAction);
  4612. }
  4613.  
  4614. if (action == 94) {
  4615. boolean flag5 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, thirdMenuAction, myPlayer.smallX[0], false, secondMenuAction);
  4616.  
  4617. if (!flag5) {
  4618. flag5 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, thirdMenuAction, myPlayer.smallX[0], false, secondMenuAction);
  4619. }
  4620.  
  4621. crossX = super.saveClickX;
  4622. crossY = super.saveClickY;
  4623. crossType = 2;
  4624. crossIndex = 0;
  4625. getOut().putOpcode(181);
  4626. getOut().method431(thirdMenuAction + baseY);
  4627. getOut().putShort(firstMenuAction);
  4628. getOut().method431(secondMenuAction + baseX);
  4629. getOut().putShortSpecialA(anInt1137);
  4630. }
  4631.  
  4632. if (action == 646) {
  4633. getOut().putOpcode(243);
  4634. getOut().putShort(thirdMenuAction);
  4635. RSInterface class9_2 = RSInterface.interfaceCache[thirdMenuAction];
  4636.  
  4637. if (class9_2.valueIndexArray != null && class9_2.valueIndexArray[0][0] == 5) {
  4638. int i2 = class9_2.valueIndexArray[0][1];
  4639.  
  4640. if (variousSettings[i2] != class9_2.requiredValues[0]) {
  4641. variousSettings[i2] = class9_2.requiredValues[0];
  4642. updateConfig(i2);
  4643. }
  4644.  
  4645. switch (thirdMenuAction) {
  4646. case 25841:// More options
  4647. i2 = openInterfaceID == 24000 ? 0 : 1;
  4648. sendFrame36(175, i2);
  4649.  
  4650. if (i2 == 1) {
  4651. openInterfaceID = 24000;
  4652. } else {
  4653. openInterfaceID = -1;
  4654. }
  4655.  
  4656. break;
  4657. }
  4658. }
  4659. }
  4660.  
  4661. if (action == 225) {
  4662. NPC npc = npcArray[firstMenuAction];
  4663.  
  4664. if (npc != null) {
  4665. doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, npc.smallY[0], myPlayer.smallX[0], false, npc.smallX[0]);
  4666. crossX = super.saveClickX;
  4667. crossY = super.saveClickY;
  4668. crossType = 2;
  4669. crossIndex = 0;
  4670. setAnInt1226(getAnInt1226() + firstMenuAction);
  4671.  
  4672. if (getAnInt1226() >= 85) {
  4673. getOut().putOpcode(230);
  4674. getOut().putShortBigEndian(239);
  4675. setAnInt1226(0);
  4676. }
  4677.  
  4678. getOut().putOpcode(6);
  4679. getOut().method433(firstMenuAction);
  4680. }
  4681. }
  4682.  
  4683. if (action == 965) {
  4684. NPC npc = npcArray[firstMenuAction];
  4685.  
  4686. if (npc != null) {
  4687. doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, npc.smallY[0], myPlayer.smallX[0], false, npc.smallX[0]);
  4688. crossX = super.saveClickX;
  4689. crossY = super.saveClickY;
  4690. crossType = 2;
  4691. crossIndex = 0;
  4692. setAnInt1134(getAnInt1134() + 1);
  4693.  
  4694. if (getAnInt1134() >= 96) {
  4695. getOut().putOpcode(152);
  4696. getOut().putShortBigEndian(88);
  4697. setAnInt1134(0);
  4698. }
  4699.  
  4700. getOut().putOpcode(7);
  4701. getOut().putShort(firstMenuAction);
  4702. }
  4703. }
  4704.  
  4705. if (action == 413) {
  4706. NPC npc = npcArray[firstMenuAction];
  4707.  
  4708. if (npc != null) {
  4709. doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, npc.smallY[0], myPlayer.smallX[0], false, npc.smallX[0]);
  4710. crossX = super.saveClickX;
  4711. crossY = super.saveClickY;
  4712. crossType = 2;
  4713. crossIndex = 0;
  4714. getOut().putOpcode(186);
  4715. getOut().method433(firstMenuAction);
  4716. getOut().putShortSpecialA(anInt1137);
  4717. }
  4718. }
  4719.  
  4720. if (action == 200) {
  4721. closeGameInterfaces();
  4722. }
  4723.  
  4724. if (action == 1025) {
  4725. NPC npc = npcArray[firstMenuAction];
  4726.  
  4727. if (npc != null) {
  4728. MobDefinition definition = npc.definitionOverride;
  4729.  
  4730. if (definition.childrenIDs != null) {
  4731. definition = definition.method161();
  4732. }
  4733.  
  4734. if (definition != null) {
  4735. String examine;
  4736.  
  4737. if (definition.description != null) {
  4738. examine = new String(definition.description);
  4739. } else {
  4740. examine = "It's a " + definition.name + ".";
  4741. }
  4742.  
  4743. pushMessage(examine, 0, "");
  4744. }
  4745. }
  4746. }
  4747.  
  4748. if (action == 900) {
  4749. method66(firstMenuAction, y, x, id);
  4750. getOut().putOpcode(247);
  4751. getOut().method433(id);
  4752. getOut().method431(y + baseY);
  4753. getOut().putShortSpecialA(x + baseX);
  4754. }
  4755.  
  4756. if (action == 412) {
  4757. NPC npc = npcArray[firstMenuAction];
  4758.  
  4759. if (npc != null) {
  4760. doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, npc.smallY[0], myPlayer.smallX[0], false, npc.smallX[0]);
  4761. crossX = super.saveClickX;
  4762. crossY = super.saveClickY;
  4763. crossType = 2;
  4764. crossIndex = 0;
  4765. getOut().putOpcode(89);
  4766. getOut().putShortSpecialA(firstMenuAction);
  4767. }
  4768. }
  4769.  
  4770. if (action == 365) {
  4771. Player player = playerArray[firstMenuAction];
  4772.  
  4773. if (player != null) {
  4774. doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, player.smallY[0], myPlayer.smallX[0], false, player.smallX[0]);
  4775. crossX = super.saveClickX;
  4776. crossY = super.saveClickY;
  4777. crossType = 2;
  4778. crossIndex = 0;
  4779. getOut().putOpcode(249);
  4780. getOut().putShortSpecialA(firstMenuAction);
  4781. getOut().method431(anInt1137);
  4782. }
  4783. }
  4784.  
  4785. if (action == 729) {
  4786. Player player = playerArray[firstMenuAction];
  4787.  
  4788. if (player != null) {
  4789. doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, player.smallY[0], myPlayer.smallX[0], false, player.smallX[0]);
  4790. crossX = super.saveClickX;
  4791. crossY = super.saveClickY;
  4792. crossType = 2;
  4793. crossIndex = 0;
  4794. getOut().putOpcode(40);
  4795. getOut().method431(firstMenuAction);
  4796. }
  4797. }
  4798.  
  4799. if (action == 577) {
  4800. Player player = playerArray[firstMenuAction];
  4801.  
  4802. if (player != null) {
  4803. doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, player.smallY[0], myPlayer.smallX[0], false, player.smallX[0]);
  4804. crossX = super.saveClickX;
  4805. crossY = super.saveClickY;
  4806. crossType = 2;
  4807. crossIndex = 0;
  4808. getOut().putOpcode(140);
  4809. getOut().method431(firstMenuAction);
  4810. }
  4811. }
  4812.  
  4813. if (action == 956 && method66(firstMenuAction, y, x, id)) {
  4814. getOut().putOpcode(35);
  4815. getOut().method431(secondMenuAction + baseX);
  4816. getOut().putShortSpecialA(anInt1137);
  4817. getOut().putShortSpecialA(thirdMenuAction + baseY);
  4818. getOut().method431(id);
  4819. }
  4820.  
  4821. if (action == 567) {
  4822. boolean flag6 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, thirdMenuAction, myPlayer.smallX[0], false, secondMenuAction);
  4823.  
  4824. if (!flag6) {
  4825. flag6 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, thirdMenuAction, myPlayer.smallX[0], false, secondMenuAction);
  4826. }
  4827.  
  4828. crossX = super.saveClickX;
  4829. crossY = super.saveClickY;
  4830. crossType = 2;
  4831. crossIndex = 0;
  4832. getOut().putOpcode(23);
  4833. getOut().method431(thirdMenuAction + baseY);
  4834. getOut().method431(firstMenuAction);
  4835. getOut().method431(secondMenuAction + baseX);
  4836. }
  4837.  
  4838. if (action == 867) {
  4839. if ((id & 3) == 0) {
  4840. setAnInt1175(getAnInt1175() + 1);
  4841. }
  4842.  
  4843. if (getAnInt1175() >= 59) {
  4844. getOut().putOpcode(200);
  4845. getOut().putShort(25501);
  4846. setAnInt1175(0);
  4847. }
  4848.  
  4849. getOut().putOpcode(43);
  4850. getOut().putShortSpecialA(secondMenuAction);
  4851. getOut().method431(thirdMenuAction);
  4852. getOut().putShortSpecialA(firstMenuAction);
  4853. atInventoryLoopCycle = 0;
  4854. atInventoryInterface = thirdMenuAction;
  4855. atInventoryIndex = secondMenuAction;
  4856. atInventoryInterfaceType = 2;
  4857.  
  4858. if (RSInterface.interfaceCache[thirdMenuAction].parentID == openInterfaceID) {
  4859. atInventoryInterfaceType = 1;
  4860. }
  4861.  
  4862. if (RSInterface.interfaceCache[thirdMenuAction].parentID == backDialogID) {
  4863. atInventoryInterfaceType = 3;
  4864. }
  4865. }
  4866.  
  4867. if (action == 543) {
  4868. getOut().putOpcode(237);
  4869. getOut().putShort(secondMenuAction);
  4870. getOut().putShortSpecialA(firstMenuAction);
  4871. getOut().putShort(thirdMenuAction);
  4872. getOut().putShortSpecialA(anInt1137);
  4873. atInventoryLoopCycle = 0;
  4874. atInventoryInterface = thirdMenuAction;
  4875. atInventoryIndex = secondMenuAction;
  4876. atInventoryInterfaceType = 2;
  4877.  
  4878. if (RSInterface.interfaceCache[thirdMenuAction].parentID == openInterfaceID) {
  4879. atInventoryInterfaceType = 1;
  4880. }
  4881.  
  4882. if (RSInterface.interfaceCache[thirdMenuAction].parentID == backDialogID) {
  4883. atInventoryInterfaceType = 3;
  4884. }
  4885. }
  4886.  
  4887. if (action == 491) {
  4888. Player player = playerArray[firstMenuAction];
  4889.  
  4890. if (player != null) {
  4891. doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, player.smallY[0], myPlayer.smallX[0], false, player.smallX[0]);
  4892. crossX = super.saveClickX;
  4893. crossY = super.saveClickY;
  4894. crossType = 2;
  4895. crossIndex = 0;
  4896. getOut().putOpcode(14);
  4897. getOut().putShortSpecialA(anInt1284);
  4898. getOut().putShort(firstMenuAction);
  4899. getOut().putShort(anInt1285);
  4900. getOut().method431(anInt1283);
  4901. }
  4902. }
  4903.  
  4904. if (action == 639) {
  4905. String actionName = menuActionName[actionId];
  4906. int spot = actionName.indexOf("@whi@");
  4907.  
  4908. if (spot != -1) {
  4909. String username = actionName.substring(spot + 5).trim();
  4910. long usernameHash = TextClass.longForName(username);
  4911. int friendIndex = -1;
  4912.  
  4913. for (int i4 = 0; i4 < friendCount; i4++) {
  4914. if (friendsListAsLongs[i4] != usernameHash) {
  4915. continue;
  4916. }
  4917. friendIndex = i4;
  4918. break;
  4919. }
  4920.  
  4921. // if (friendIndex != -1 && friendsNodeIDs[friendIndex] > 0) {
  4922. inputTaken = true;
  4923. inputDialogState = 0;
  4924. messagePromptRaised = true;
  4925. promptInput = "";
  4926. friendsListAction = 3;
  4927. aLong953 = usernameHash;
  4928. promptMessage = "Enter message to send to " + username;
  4929. // aLong953 = friendsListAsLongs[friendIndex];
  4930. // promptMessage = "Enter message to send to " +
  4931. // friendsList[friendIndex];
  4932. // }
  4933. }
  4934. }
  4935.  
  4936. if (action == 454) {
  4937. getOut().putOpcode(42);
  4938. getOut().putShort(firstMenuAction);
  4939. getOut().putShortSpecialA(secondMenuAction);
  4940. getOut().putShortSpecialA(thirdMenuAction);
  4941. atInventoryLoopCycle = 0;
  4942. atInventoryInterface = thirdMenuAction;
  4943. atInventoryIndex = secondMenuAction;
  4944. atInventoryInterfaceType = 2;
  4945.  
  4946. if (RSInterface.interfaceCache[thirdMenuAction].parentID == openInterfaceID) {
  4947. atInventoryInterfaceType = 1;
  4948. }
  4949.  
  4950. if (RSInterface.interfaceCache[thirdMenuAction].parentID == backDialogID) {
  4951. atInventoryInterfaceType = 3;
  4952. }
  4953. }
  4954.  
  4955. if (action == 478) {
  4956. NPC npc = npcArray[firstMenuAction];
  4957.  
  4958. if (npc != null) {
  4959. doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, npc.smallY[0], myPlayer.smallX[0], false, npc.smallX[0]);
  4960. crossX = super.saveClickX;
  4961. crossY = super.saveClickY;
  4962. crossType = 2;
  4963. crossIndex = 0;
  4964.  
  4965. if ((id & 3) == 0) {
  4966. setAnInt1155(getAnInt1155() + 1);
  4967. }
  4968.  
  4969. if (getAnInt1155() >= 53) {
  4970. getOut().putOpcode(85);
  4971. getOut().putShortBigEndian(66);
  4972. setAnInt1155(0);
  4973. }
  4974.  
  4975. getOut().putOpcode(18);
  4976. getOut().method431(firstMenuAction);
  4977. }
  4978. }
  4979.  
  4980. if (action == 113) {
  4981. method66(firstMenuAction, y, x, id);
  4982. getOut().putOpcode(25);
  4983. getOut().method431(secondMenuAction + baseX);
  4984. getOut().putShort(thirdMenuAction + baseY);
  4985. getOut().method433(id);
  4986. }
  4987.  
  4988. if (action == 872) {
  4989. method66(firstMenuAction, y, x, id);
  4990. getOut().putOpcode(234);
  4991. getOut().method433(secondMenuAction + baseX);
  4992. getOut().putShortSpecialA(id);
  4993. getOut().method433(thirdMenuAction + baseY);
  4994. }
  4995.  
  4996. if (action == 502) {
  4997. method66(firstMenuAction, y, x, id);
  4998. getOut().putOpcode(138);
  4999. getOut().method433(secondMenuAction + baseX);
  5000. getOut().putShortSpecialA(thirdMenuAction + baseY);
  5001. getOut().putShort(id);
  5002. }
  5003.  
  5004. if (action == 1125) {
  5005. ItemDefinition definition = ItemDefinition.get(firstMenuAction);
  5006. RSInterface rsinterface = RSInterface.interfaceCache[thirdMenuAction];
  5007. String examine;
  5008.  
  5009. if (rsinterface != null && rsinterface.invStackSizes[secondMenuAction] >= 0x186a0) {
  5010. examine = NumberFormat.getInstance(Locale.US).format(rsinterface.invStackSizes[secondMenuAction]) + " x " + definition.name;
  5011. } else if (definition.description != null) {
  5012. examine = new String(definition.description);
  5013. } else {
  5014. examine = "It's a " + definition.name + ".";
  5015. }
  5016.  
  5017. pushMessage(examine, 0, "");
  5018. }
  5019. if (action == 169) {
  5020. switch (thirdMenuAction) {
  5021. case 24107:
  5022. getConfig().toggle(ConfigType.HP_ABOVE_HEAD);
  5023. savePlayerData();
  5024. break;
  5025. case 24103:
  5026. getConfig().toggle(ConfigType.NAMES_ABOVE_HEAD);
  5027. savePlayerData();
  5028. break;
  5029. case 24131:
  5030. getConfig().toggle(ConfigType.NEW_CURSORS);
  5031. savePlayerData();
  5032. break;
  5033. case 24099:
  5034. GameFrameConstants.gameframeType = GameFrameConstants.gameframeType == GameFrameType.FRAME_525 ? GameFrameType.FRAME_554 : GameFrameType.FRAME_525;
  5035. savePlayerData();
  5036. break;
  5037. case 24139:
  5038. getConfig().toggle(ConfigType.TOGGLE_FOV);
  5039. savePlayerData();
  5040. break;
  5041. case 24115:
  5042. getConfig().toggle(ConfigType.HITMARKS);
  5043. savePlayerData();
  5044. break;
  5045. case 24119:// Toggle function keys
  5046. getConfig().toggle(ConfigType.FUNCTION_KEYS);
  5047. savePlayerData();
  5048. break;
  5049.  
  5050. case 24127:
  5051. getConfig().toggle(ConfigType.FOG);
  5052. savePlayerData();
  5053. break;
  5054.  
  5055. case 24111:// Toggle halth bars
  5056. getConfig().toggle(ConfigType.NEW_HITBARS);
  5057. savePlayerData();
  5058. break;
  5059.  
  5060. case 24123:// Toggle x10 damage
  5061. getConfig().toggle(ConfigType.X10_DAMAGE);
  5062. savePlayerData();
  5063. break;
  5064. case 24135:
  5065. getConfig().toggle(ConfigType.TOGGLE_ROOFS);
  5066. method22();
  5067. savePlayerData();
  5068. break;
  5069. case 24143:
  5070. getConfig().toggle(ConfigType.PUSH_NOTIFICATIONS);
  5071. pushMessage("Push notifications turned " + (getConfig().getStatus(ConfigType.PUSH_NOTIFICATIONS) ? "on" : "off") + ".", 0, "");
  5072. savePlayerData();
  5073. break;
  5074. case 24147:
  5075. getConfig().toggle(ConfigType.HD_TEXTURES);
  5076. savePlayerData();
  5077. break;
  5078. case 24151:
  5079. getConfig().toggle(ConfigType.DISPLAY_COMBAT_TIMERS);
  5080. savePlayerData();
  5081. break;
  5082. case 24155:
  5083. crownState = (crownState == CrownIconState.ALL ? CrownIconState.NONE : crownState == CrownIconState.NONE ? CrownIconState.STAFF : CrownIconState.ALL);
  5084. sendFrame36(530, 1);
  5085. RSInterface.interfaceCache[25017].message = "Crowns: " + crownState.getTitle();
  5086. break;
  5087. case 24159:
  5088. /*
  5089. * if high mem, set to low mem
  5090. */
  5091. if (config.getStatus(ConfigType.HIGH_DETAIL)) {
  5092. setLowDetail();
  5093. loadingStage = 1;
  5094. pushMessage("Set to low detail.", 0, "");
  5095. config.set(ConfigType.HIGH_DETAIL, false);
  5096. savePlayerData();
  5097. sendFrame36(RSInterface.SETTING_CONFIGS[16], 0);
  5098. sendFrame36(RSInterface.SETTING_CONFIGS[15], 1);
  5099. method22();
  5100. } else {
  5101. sendFrame36(RSInterface.SETTING_CONFIGS[15], 1);
  5102. }
  5103. return;
  5104. case 24163:
  5105. /*
  5106. * If low mem, set to high mem
  5107. */
  5108. if (!config.getStatus(ConfigType.HIGH_DETAIL)) {
  5109. setHighDetail();
  5110. loadingStage = 1;
  5111. pushMessage("Set to high detail.", 0, "");
  5112. config.set(ConfigType.HIGH_DETAIL, true);
  5113. savePlayerData();
  5114. sendFrame36(RSInterface.SETTING_CONFIGS[15], 0);
  5115. sendFrame36(RSInterface.SETTING_CONFIGS[16], 1);
  5116. method22();
  5117. } else {
  5118. sendFrame36(RSInterface.SETTING_CONFIGS[16], 1);
  5119. }
  5120. return;
  5121. case 24168:
  5122. getConfig().set(ConfigType.DISPLAY_COMBAT_OVERLAY, !config.getStatus(ConfigType.DISPLAY_COMBAT_OVERLAY));
  5123. savePlayerData();
  5124. break;
  5125. case 24172:
  5126. getConfig().set(ConfigType.ONE_CLICK_ATTACK, !config.getStatus(ConfigType.ONE_CLICK_ATTACK));
  5127. savePlayerData();
  5128. break;
  5129. case 24176:
  5130. getConfig().set(ConfigType.TOGGLE_TARGET_INTERFACE, !config.getStatus(ConfigType.TOGGLE_TARGET_INTERFACE));
  5131. savePlayerData();
  5132. break;
  5133. case 24180:
  5134. getConfig().set(ConfigType.TWEENING, !config.getStatus(ConfigType.TWEENING));
  5135. savePlayerData();
  5136. break;
  5137. case 24184:
  5138. cameraAngleLimit = cameraAngleLimit == 128 ? 98 : 128;
  5139. break;
  5140.  
  5141. case 21357:
  5142. case 21359:
  5143. case 21361:
  5144. case 21363:
  5145. case 21365:
  5146. case 21367:
  5147. case 21369:
  5148. case 21371:
  5149. case 21373:
  5150. case 21375:
  5151. case 21377:
  5152. case 21379:
  5153. case 21381:
  5154. case 21383:
  5155. case 21385:
  5156. case 21387:
  5157. case 21389:
  5158. case 21391:
  5159. case 21393:
  5160. case 21395:
  5161. getOut().putOpcode(243);
  5162. getOut().putShort(thirdMenuAction + 22541 - 21395);
  5163. break;
  5164.  
  5165. default:
  5166. // System.out.println(thirdMenuAction);
  5167. getOut().putOpcode(243);
  5168. getOut().putShort(thirdMenuAction);
  5169. }
  5170.  
  5171. RSInterface rsinterface = RSInterface.interfaceCache[thirdMenuAction];
  5172.  
  5173. if (rsinterface.valueIndexArray != null && rsinterface.valueIndexArray[0][0] == 5) {
  5174. int l2 = rsinterface.valueIndexArray[0][1];
  5175. variousSettings[l2] = 1 - variousSettings[l2];
  5176. updateConfig(l2);
  5177. }
  5178. }
  5179.  
  5180. if (action == 447) {
  5181. itemSelected = 1;
  5182. anInt1283 = secondMenuAction;
  5183. anInt1284 = thirdMenuAction;
  5184. anInt1285 = firstMenuAction;
  5185. selectedItemName = ItemDefinition.get(firstMenuAction).name;
  5186. spellSelected = 0;
  5187. return;
  5188. }
  5189.  
  5190. if (action == 1226) {
  5191. ObjectDefinition definition = ObjectDefinition.forID(id);
  5192. String examine;
  5193.  
  5194. if (definition.description != null) {
  5195. examine = new String(definition.description);
  5196. } else {
  5197. examine = "It's a " + definition.name + ".";
  5198. }
  5199.  
  5200. pushMessage(examine, 0, "");
  5201. }
  5202.  
  5203. if (action == 244) {
  5204. boolean flag7 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, thirdMenuAction, myPlayer.smallX[0], false, secondMenuAction);
  5205.  
  5206. if (!flag7) {
  5207. flag7 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, thirdMenuAction, myPlayer.smallX[0], false, secondMenuAction);
  5208. }
  5209.  
  5210. crossX = super.saveClickX;
  5211. crossY = super.saveClickY;
  5212. crossType = 2;
  5213. crossIndex = 0;
  5214. getOut().putOpcode(253);
  5215. getOut().method431(secondMenuAction + baseX);
  5216. getOut().method433(thirdMenuAction + baseY);
  5217. getOut().putShortSpecialA(firstMenuAction);
  5218. }
  5219.  
  5220. if (action == 1448) {
  5221. ItemDefinition definition = ItemDefinition.get(firstMenuAction);
  5222. String examine;
  5223.  
  5224. if (definition.description != null) {
  5225. examine = new String(definition.description);
  5226. } else {
  5227. examine = "It's a " + definition.name + ".";
  5228. }
  5229.  
  5230. pushMessage(examine, 0, "");
  5231. }
  5232.  
  5233. itemSelected = 0; // RIGHT HERE
  5234.  
  5235. if (action != 626) {
  5236. spellSelected = 0;
  5237. }
  5238. }
  5239.  
  5240. private void doFlamesDrawing() {
  5241. }
  5242.  
  5243. 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) {
  5244. byte byte0 = 104;
  5245. byte byte1 = 104;
  5246.  
  5247. for (int l2 = 0; l2 < byte0; l2++) {
  5248. for (int i3 = 0; i3 < byte1; i3++) {
  5249. anIntArrayArray901[l2][i3] = 0;
  5250. anIntArrayArray825[l2][i3] = 0x5f5e0ff;
  5251. }
  5252. }
  5253.  
  5254. int j3 = j2;
  5255. int k3 = j1;
  5256. anIntArrayArray901[j2][j1] = 99;
  5257. anIntArrayArray825[j2][j1] = 0;
  5258. int l3 = 0;
  5259. int i4 = 0;
  5260. bigX[l3] = j2;
  5261. bigY[l3++] = j1;
  5262. boolean flag1 = false;
  5263. int j4 = bigX.length;
  5264. int[][] ai = aClass11Array1230[plane].anIntArrayArray294;
  5265.  
  5266. while (i4 != l3) {
  5267. j3 = bigX[i4];
  5268. k3 = bigY[i4];
  5269. i4 = (i4 + 1) % j4;
  5270.  
  5271. if (j3 == k2 && k3 == i2) {
  5272. flag1 = true;
  5273. break;
  5274. }
  5275.  
  5276. if (i1 != 0) {
  5277. if ((i1 < 5 || i1 == 10) && aClass11Array1230[plane].method219(k2, j3, k3, j, i1 - 1, i2)) {
  5278. flag1 = true;
  5279. break;
  5280. }
  5281.  
  5282. if (i1 < 10 && aClass11Array1230[plane].method220(k2, i2, k3, i1 - 1, j, j3)) {
  5283. flag1 = true;
  5284. break;
  5285. }
  5286. }
  5287.  
  5288. if (k1 != 0 && k != 0 && aClass11Array1230[plane].method221(i2, k2, j3, k, l1, k1, k3)) {
  5289. flag1 = true;
  5290. break;
  5291. }
  5292.  
  5293. int l4 = anIntArrayArray825[j3][k3] + 1;
  5294.  
  5295. if (j3 > 0 && anIntArrayArray901[j3 - 1][k3] == 0 && (ai[j3 - 1][k3] & 0x1280108) == 0) {
  5296. bigX[l3] = j3 - 1;
  5297. bigY[l3] = k3;
  5298. l3 = (l3 + 1) % j4;
  5299. anIntArrayArray901[j3 - 1][k3] = 2;
  5300. anIntArrayArray825[j3 - 1][k3] = l4;
  5301. }
  5302.  
  5303. if (j3 < byte0 - 1 && anIntArrayArray901[j3 + 1][k3] == 0 && (ai[j3 + 1][k3] & 0x1280180) == 0) {
  5304. bigX[l3] = j3 + 1;
  5305. bigY[l3] = k3;
  5306. l3 = (l3 + 1) % j4;
  5307. anIntArrayArray901[j3 + 1][k3] = 8;
  5308. anIntArrayArray825[j3 + 1][k3] = l4;
  5309. }
  5310.  
  5311. if (k3 > 0 && anIntArrayArray901[j3][k3 - 1] == 0 && (ai[j3][k3 - 1] & 0x1280102) == 0) {
  5312. bigX[l3] = j3;
  5313. bigY[l3] = k3 - 1;
  5314. l3 = (l3 + 1) % j4;
  5315. anIntArrayArray901[j3][k3 - 1] = 1;
  5316. anIntArrayArray825[j3][k3 - 1] = l4;
  5317. }
  5318.  
  5319. if (k3 < byte1 - 1 && anIntArrayArray901[j3][k3 + 1] == 0 && (ai[j3][k3 + 1] & 0x1280120) == 0) {
  5320. bigX[l3] = j3;
  5321. bigY[l3] = k3 + 1;
  5322. l3 = (l3 + 1) % j4;
  5323. anIntArrayArray901[j3][k3 + 1] = 4;
  5324. anIntArrayArray825[j3][k3 + 1] = l4;
  5325. }
  5326.  
  5327. 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) {
  5328. bigX[l3] = j3 - 1;
  5329. bigY[l3] = k3 - 1;
  5330. l3 = (l3 + 1) % j4;
  5331. anIntArrayArray901[j3 - 1][k3 - 1] = 3;
  5332. anIntArrayArray825[j3 - 1][k3 - 1] = l4;
  5333. }
  5334.  
  5335. 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
  5336. && (ai[j3][k3 - 1] & 0x1280102) == 0) {
  5337. bigX[l3] = j3 + 1;
  5338. bigY[l3] = k3 - 1;
  5339. l3 = (l3 + 1) % j4;
  5340. anIntArrayArray901[j3 + 1][k3 - 1] = 9;
  5341. anIntArrayArray825[j3 + 1][k3 - 1] = l4;
  5342. }
  5343.  
  5344. 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
  5345. && (ai[j3][k3 + 1] & 0x1280120) == 0) {
  5346. bigX[l3] = j3 - 1;
  5347. bigY[l3] = k3 + 1;
  5348. l3 = (l3 + 1) % j4;
  5349. anIntArrayArray901[j3 - 1][k3 + 1] = 6;
  5350. anIntArrayArray825[j3 - 1][k3 + 1] = l4;
  5351. }
  5352.  
  5353. 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
  5354. && (ai[j3][k3 + 1] & 0x1280120) == 0) {
  5355. bigX[l3] = j3 + 1;
  5356. bigY[l3] = k3 + 1;
  5357. l3 = (l3 + 1) % j4;
  5358. anIntArrayArray901[j3 + 1][k3 + 1] = 12;
  5359. anIntArrayArray825[j3 + 1][k3 + 1] = l4;
  5360. }
  5361. }
  5362.  
  5363. anInt1264 = 0;
  5364.  
  5365. if (!flag1) {
  5366. if (flag) {
  5367. int i5 = 100;
  5368.  
  5369. for (int k5 = 1; k5 < 2; k5++) {
  5370. for (int i6 = k2 - k5; i6 <= k2 + k5; i6++) {
  5371. for (int l6 = i2 - k5; l6 <= i2 + k5; l6++) {
  5372. if (i6 >= 0 && l6 >= 0 && i6 < 104 && l6 < 104 && anIntArrayArray825[i6][l6] < i5) {
  5373. i5 = anIntArrayArray825[i6][l6];
  5374. j3 = i6;
  5375. k3 = l6;
  5376. anInt1264 = 1;
  5377. flag1 = true;
  5378. }
  5379. }
  5380. }
  5381.  
  5382. if (flag1) {
  5383. break;
  5384. }
  5385. }
  5386.  
  5387. }
  5388.  
  5389. if (!flag1) {
  5390. return false;
  5391. }
  5392. }
  5393.  
  5394. i4 = 0;
  5395. bigX[i4] = j3;
  5396. bigY[i4++] = k3;
  5397. int l5;
  5398.  
  5399. for (int j5 = l5 = anIntArrayArray901[j3][k3]; j3 != j2 || k3 != j1; j5 = anIntArrayArray901[j3][k3]) {
  5400. if (j5 != l5) {
  5401. l5 = j5;
  5402. bigX[i4] = j3;
  5403. bigY[i4++] = k3;
  5404. }
  5405.  
  5406. if ((j5 & 2) != 0) {
  5407. j3++;
  5408. } else if ((j5 & 8) != 0) {
  5409. j3--;
  5410. }
  5411.  
  5412. if ((j5 & 1) != 0) {
  5413. k3++;
  5414. } else if ((j5 & 4) != 0) {
  5415. k3--;
  5416. }
  5417. }
  5418.  
  5419. if (i4 > 0) {
  5420. int k4 = i4;
  5421.  
  5422. if (k4 > 25) {
  5423. k4 = 25;
  5424. }
  5425.  
  5426. i4--;
  5427. int k6 = bigX[i4];
  5428. int i7 = bigY[i4];
  5429. setAnInt1288(getAnInt1288() + k4);
  5430.  
  5431. if (getAnInt1288() >= 92) {
  5432. getOut().putOpcode(36);
  5433. getOut().putInt(0);
  5434. setAnInt1288(0);
  5435. }
  5436.  
  5437. if (type == 0) {
  5438. getOut().putOpcode(169);
  5439. getOut().putShortBigEndian(k4 + k4 + 3);
  5440. }
  5441.  
  5442. if (type == 1) {
  5443. getOut().putOpcode(242);
  5444. getOut().putShortBigEndian(k4 + k4 + 3 + 14);
  5445. }
  5446.  
  5447. if (type == 2) {
  5448. getOut().putOpcode(90);
  5449. getOut().putShortBigEndian(k4 + k4 + 3);
  5450. }
  5451.  
  5452. getOut().method433(k6 + baseX);
  5453. destX = bigX[0];
  5454. destY = bigY[0];
  5455.  
  5456. for (int j7 = 1; j7 < k4; j7++) {
  5457. i4--;
  5458. getOut().putShortBigEndian(bigX[i4] - k6);
  5459. getOut().putShortBigEndian(bigY[i4] - i7);
  5460. }
  5461.  
  5462. getOut().method431(i7 + baseY);
  5463. getOut().method424(super.keyArray[5] != 1 ? 0 : 1);
  5464. return true;
  5465. }
  5466.  
  5467. return type != 1;
  5468. }
  5469.  
  5470. private void draw3dScreen() {
  5471.  
  5472. if (!chatArea.componentHidden()) {
  5473. drawSplitPrivateChat();
  5474. }
  5475.  
  5476. if (crossType == 1) {
  5477. crosses[crossIndex / 100].drawSprite(crossX - 8 - 4, crossY - 8 - 4);
  5478. anInt1142++;
  5479.  
  5480. if (anInt1142 > 67) {
  5481. anInt1142 = 0;
  5482. }
  5483. }
  5484.  
  5485. if (crossType == 2) {
  5486. crosses[4 + crossIndex / 100].drawSprite(crossX - 8 - 4, crossY - 8 - 4);
  5487. }
  5488.  
  5489. if (getWalkableInterface() != -1) {
  5490. method119(anInt945, getWalkableInterface());
  5491. RSInterface rsInterface = RSInterface.interfaceCache[getWalkableInterface()];
  5492. if (getWalkableInterface() == 15892 && GameFrame.getScreenMode() != ScreenMode.FIXED) {
  5493. drawInterface(0, getScreenWidth() / 2 - rsInterface.width + 20, rsInterface, 0);
  5494. } else if ((getWalkableInterface() == 201 || getWalkableInterface() == 197) && GameFrame.getScreenMode() != ScreenMode.FIXED) {
  5495. drawInterface(0, getScreenWidth() - 765 + 15, rsInterface, 0 - 255 + 10 + 4);
  5496. } else if (getWalkableInterface() == 16128) {
  5497. if ((GameFrame.getScreenMode() != ScreenMode.FIXED)) {
  5498. RSInterface.setBounds(16136, 320, 220, 7, rsInterface);
  5499. RSInterface.setBounds(16137, 358, 220, 8, rsInterface);
  5500. drawInterface(0, getScreenWidth() - 765 + 15, rsInterface, 0 - 255 + 40);
  5501. } else {
  5502. RSInterface.setBounds(16136, 30, 318, 7, rsInterface);
  5503. RSInterface.setBounds(16137, 68, 318, 8, rsInterface);
  5504. drawInterface(0, 0, rsInterface, 0);
  5505. }
  5506. } else {
  5507. drawInterface(0, 0, rsInterface, 0);
  5508. }
  5509.  
  5510. if (getWalkableInterface() == 197) {
  5511. if (config.getStatus(ConfigType.TOGGLE_TARGET_INTERFACE)) {
  5512. drawInterface(0, getScreenWidth() - 765 - (GameFrame.getScreenMode() != ScreenMode.FIXED ? 30 : 0), RSInterface.interfaceCache[23300], 10);
  5513. }
  5514. }
  5515. }
  5516.  
  5517. if (openInterfaceID != -1) {
  5518. method119(anInt945, openInterfaceID);
  5519. RSInterface rsInterface = RSInterface.interfaceCache[openInterfaceID];
  5520. int width = GameFrame.getScreenMode() != ScreenMode.FIXED ? getScreenWidth() : 516;
  5521. int height = GameFrame.getScreenMode() != ScreenMode.FIXED ? getScreenHeight() : 338;
  5522.  
  5523. if (GameFrame.getScreenMode() != ScreenMode.FIXED) {
  5524. drawInterface(0, (width - 765) / 2, rsInterface, (height - 503) / 2);
  5525. } else {
  5526. drawInterface(0, 0, rsInterface, 0);// first 1
  5527. }
  5528. }
  5529.  
  5530. method70();
  5531.  
  5532. if (!menuOpen) {
  5533. processRightClick();
  5534. drawTooltip();
  5535. } else if (menuScreenArea == 0) {
  5536. drawMenu();
  5537. }
  5538.  
  5539. if (anInt1055 == 1) {
  5540. multiOverlay[GameFrame.getScreenMode() == ScreenMode.FIXED ? 0 : 1].drawSprite(GameFrame.getScreenMode() == ScreenMode.FIXED ? 472 : 516 + getScreenWidth() - 765 + 52 + 157,
  5541. GameFrame.getScreenMode() == ScreenMode.FIXED ? 296 : 175);
  5542. }
  5543.  
  5544. int x = baseX + (myPlayer.x - 6 >> 7);
  5545. int y = baseY + (myPlayer.y - 6 >> 7);
  5546. if (isDebugMode()) {
  5547. int minus = 45;
  5548. int textColor = 0xffff00;
  5549. if (super.fps < 15) {
  5550. textColor = 0xff0000;
  5551. }
  5552. if (systemUpdateTimer != 0) {
  5553. minus = 60;
  5554. }
  5555. newRegularFont.drawBasicString("Fps: " + super.fps, 5, 270 - minus, textColor, 0);
  5556. newRegularFont.drawBasicString("Local Players: " + this.playerCount + ", Local Mobs: " + npcCount, 5, 285 - minus, 0xffff00, 0);
  5557. Runtime runtime = Runtime.getRuntime();
  5558. textColor = 0xFFFF00;
  5559. int memory = (int) ((runtime.totalMemory() - runtime.freeMemory()) / 1024L);
  5560. if (memory > 0x2000000 && lowDetail) {
  5561. textColor = 0xff0000;
  5562. }
  5563. newRegularFont.drawBasicString("Mem: " + formatValue(memory, 2) + "k", 5, 300 - minus, textColor, 0);
  5564. newRegularFont.drawBasicString("Mouse X: " + super.mouseX + " , Mouse Y: " + super.mouseY, 5, 315 - minus, 0xffff00, 0);
  5565. newRegularFont.drawBasicString("Coords: " + x + ", " + y, 5, 330 - minus, 0xffff00, 0);
  5566. newRegularFont.drawBasicString("Client resolution: " + getScreenWidth() + "x" + getScreenHeight(), 5, 345 - minus, 0xffff00, 0);
  5567. newRegularFont.drawBasicString("Object Maps: " + objectMaps + ";", 5, 360 - minus, 0xffff00, 0);
  5568. newRegularFont.drawBasicString("Floor Maps: " + floorMaps + ";", 5, 375 - minus, 0xffff00, 0);
  5569. }
  5570. if (fpsOn) {
  5571. int textX = (GameFrame.isFixed() ? (mapArea.getxPos() - 90) : (getScreenWidth() - 100));
  5572. int textY = (GameFrame.isFixed() ? 20 : 230);
  5573. int textColor = 0xffff00;
  5574. if (super.fps < 15) {
  5575. textColor = 0xff0000;
  5576. }
  5577. newRegularFont.drawBasicString("Fps: " + super.fps, textX, textY, textColor, 0);
  5578. textY += 15;
  5579. Runtime runtime = Runtime.getRuntime();
  5580. int memory = (int) ((runtime.totalMemory() - runtime.freeMemory()) / 1024L);
  5581. if (memory > 0x2000000 && lowDetail) {
  5582. textColor = 0xff0000;
  5583. }
  5584. newRegularFont.drawBasicString("Mem:" + formatValue(memory, 2) + "k", textX, textY, textColor, 0);
  5585. textY += 15;
  5586. }
  5587.  
  5588. if (systemUpdateTimer != 0) {
  5589. int j = systemUpdateTimer / 50;
  5590. int l = j / 60;
  5591. j %= 60;
  5592.  
  5593. if (j < 10) {
  5594. normalText.method385(0xffff00, "System update in: " + l + ":0" + j, GameFrame.isFixed() ? 329 : getScreenHeight() - 168, 4);
  5595. } else {
  5596. normalText.method385(0xffff00, "System update in: " + l + ":" + j, GameFrame.isFixed() ? 329 : getScreenHeight() - 168, 4);
  5597. }
  5598.  
  5599. if (++anInt849 > 75) {
  5600. anInt849 = 0;
  5601. getOut().putOpcode(148);
  5602. }
  5603. }
  5604.  
  5605. }
  5606.  
  5607. void drawAnimatedWorldBackground(boolean display) {
  5608. if (scriptManager == null) {
  5609. try {
  5610. loginScreenBG(true);
  5611. } catch (Exception e) {
  5612. e.printStackTrace();
  5613. }
  5614. }
  5615. int canvasCenterX = Rasterizer.centerX;
  5616. int canvasCenterY = Rasterizer.centerY;
  5617. int canvasPixels[] = Rasterizer.lineOffsets;
  5618. if (titleScreenOffsets != null && (titleWidth != clientWidth || titleHeight != clientHeight)) {
  5619. titleScreenOffsets = null;
  5620. }
  5621.  
  5622. if (titleScreenOffsets == null) {
  5623. titleWidth = clientWidth;
  5624. titleHeight = clientHeight;
  5625. titleScreenOffsets = Rasterizer.getOffsets(titleWidth, titleHeight);
  5626. }
  5627.  
  5628. Rasterizer.centerX = getScreenWidth() / 2;
  5629. Rasterizer.centerY = getScreenHeight() / 2;
  5630. Rasterizer.lineOffsets = titleScreenOffsets;
  5631. if (loadingStage == 2 && ObjectManager.anInt131 != plane)
  5632. loadingStage = 1;
  5633.  
  5634. if (!loggedIn && loadingStage == 1) {
  5635. method54();
  5636. }
  5637. if (!loggedIn && loadingStage == 2 && plane != anInt985) {
  5638. anInt985 = plane;
  5639. method24(plane);
  5640. }
  5641. if (loadingStage == 2) {
  5642. try {
  5643. DrawingArea.setAllPixelsToZero();
  5644. worldController.method313(xCameraPos, yCameraPos, xCameraCurve, zCameraPos, method121(), yCameraCurve);
  5645. worldController.clearObj5Cache();
  5646. } catch (Exception ex) {
  5647. ex.printStackTrace();
  5648. }
  5649. }
  5650.  
  5651. if (Client.getConfig().getStatus(ConfigType.FOG)) {
  5652. if (!switchColor) {
  5653. if (fogHandler.fogColor != fadeColors(new Color(fogHandler.fogColor), new Color(fadingToColor), fadeStep)) {
  5654. switchColor = true;
  5655. }
  5656. }
  5657. int x = baseX + (myPlayer.x - 6 >> 7);
  5658. int y = baseY + (myPlayer.y - 6 >> 7);
  5659. if (x >= 3060 && x <= 3140 && y >= 3050 && y <= 3530) {
  5660. if (fogHandler.fogColor != 13092807) {
  5661. fogHandler.fogColor = 13092807;
  5662. }
  5663. } else {
  5664. if (switchColor) {
  5665. fadeStep += 5;
  5666. if (fadeStep >= 100) {
  5667. fadeStep = 1;
  5668. switchColor = false;
  5669. fogHandler.fogColor = fadeColors(new Color(fogHandler.fogColor), new Color(fadingToColor), fadeStep);
  5670. } else {
  5671. fogHandler.fogColor = fadeColors(new Color(fogHandler.fogColor), new Color(fadingToColor), fadeStep);
  5672. }
  5673. }
  5674. }
  5675. fogHandler.renderFog(gameScreenIP.pixels, gameScreenIP.depth);
  5676. }
  5677. if (scriptManager != null && loadingStage == 2 && plane == anInt985 && !loggedIn) {
  5678. scriptManager.cycle();
  5679. }
  5680. Rasterizer.centerX = canvasCenterX;
  5681. Rasterizer.centerY = canvasCenterY;
  5682. Rasterizer.lineOffsets = canvasPixels;
  5683. }
  5684.  
  5685. private void drawBlackBox(int x, int y) {
  5686. DrawingArea.drawPixels(71, y - 1, x - 2, 0x726451, 1);
  5687. DrawingArea.drawPixels(69, y, x + 174, 0x726451, 1);
  5688. DrawingArea.drawPixels(1, y - 2, x - 2, 0x726451, 178);
  5689. DrawingArea.drawPixels(1, y + 68, x, 0x726451, 174);
  5690. DrawingArea.drawPixels(71, y - 1, x - 1, 0x2E2B23, 1);
  5691. DrawingArea.drawPixels(71, y - 1, x + 175, 0x2E2B23, 1);
  5692. DrawingArea.drawPixels(1, y - 1, x, 0x2E2B23, 175);
  5693. DrawingArea.drawPixels(1, y + 69, x, 0x2E2B23, 175);
  5694. DrawingArea.method335(0, y, 174, 68, 220, x);
  5695. }
  5696.  
  5697. private void drawChatArea() {
  5698. chatArea.setxPos(0);
  5699. chatArea.setyPos(GameFrame.getScreenMode() == ScreenMode.FIXED ? 338 : getScreenHeight() - 165);
  5700. chatArea.render(this);
  5701. }
  5702.  
  5703. private void drawFlames() {
  5704. drawingFlames = true;
  5705.  
  5706. try {
  5707. long l = System.currentTimeMillis();
  5708. int i = 0;
  5709. int j = 20;
  5710.  
  5711. while (aBoolean831) {
  5712. doFlamesDrawing();
  5713.  
  5714. if (++i > 10) {
  5715. long l1 = System.currentTimeMillis();
  5716. int k = (int) (l1 - l) / 10 - j;
  5717. j = 40 - k;
  5718.  
  5719. if (j < 5) {
  5720. j = 5;
  5721. }
  5722.  
  5723. i = 0;
  5724. l = l1;
  5725. }
  5726.  
  5727. try {
  5728. Thread.sleep(j);
  5729. } catch (Exception _ex) {
  5730. }
  5731. }
  5732. } catch (Exception _ex) {
  5733. }
  5734.  
  5735. drawingFlames = false;
  5736. }
  5737.  
  5738. private void drawFriendsListOrWelcomeScreen(RSInterface class9) {
  5739. int j = class9.contentType;
  5740.  
  5741. if (j >= 206 && j <= 206 + 25) {
  5742. j -= 206;
  5743. class9.message = setMessage(j);
  5744. return;
  5745. }
  5746.  
  5747. if (j >= 1 && j <= 100 || j >= 701 && j <= 800) {
  5748. if (j == 1 && getAnInt900() == 0) {
  5749. class9.message = "Loading friend list";
  5750. class9.atActionType = 0;
  5751. return;
  5752. }
  5753.  
  5754. if (j == 1 && getAnInt900() == 1) {
  5755. class9.message = "Connecting to friendserver";
  5756. class9.atActionType = 0;
  5757. return;
  5758. }
  5759.  
  5760. if (j == 2 && getAnInt900() != 2) {
  5761. class9.message = "Please wait...";
  5762. class9.atActionType = 0;
  5763. return;
  5764. }
  5765.  
  5766. int k = friendCount;
  5767.  
  5768. if (getAnInt900() != 2) {
  5769. k = 0;
  5770. }
  5771.  
  5772. if (j > 700) {
  5773. j -= 601;
  5774. } else {
  5775. j--;
  5776. }
  5777.  
  5778. if (j >= k) {
  5779. class9.message = "";
  5780. class9.atActionType = 0;
  5781. return;
  5782. } else {
  5783. class9.message = friendsList[j];
  5784. class9.atActionType = 1;
  5785. return;
  5786. }
  5787. }
  5788.  
  5789. if (j == 901) {
  5790. class9.message = friendCount + "";
  5791. return;
  5792. }
  5793.  
  5794. if (j == 902) {
  5795. class9.message = ignoreCount + "";
  5796. return;
  5797. }
  5798.  
  5799. if (j >= 101 && j <= 200 || j >= 801 && j <= 900) {
  5800. int l = friendCount;
  5801.  
  5802. if (getAnInt900() != 2) {
  5803. l = 0;
  5804. }
  5805.  
  5806. if (j > 800) {
  5807. j -= 701;
  5808. } else {
  5809. j -= 101;
  5810. }
  5811.  
  5812. if (j >= l) {
  5813. class9.message = "";
  5814. class9.atActionType = 0;
  5815. return;
  5816. }
  5817.  
  5818. if (friendsNodeIDs[j] == 0) {
  5819. class9.message = "@red@Offline";
  5820. } else if (friendsNodeIDs[j] == nodeID) {
  5821. class9.message = "@gre@Online"/* + (friendsNodeIDs[j] - 9) */;
  5822. } else {
  5823. class9.message = "@red@Offline"/* + (friendsNodeIDs[j] - 9) */;
  5824. }
  5825.  
  5826. class9.atActionType = 1;
  5827. return;
  5828. }
  5829.  
  5830. if (j == 203) {
  5831. int i1 = friendCount;
  5832.  
  5833. if (getAnInt900() != 2) {
  5834. i1 = 0;
  5835. }
  5836.  
  5837. class9.scrollMax = i1 * 15 + 20;
  5838.  
  5839. if (class9.scrollMax <= class9.height) {
  5840. class9.scrollMax = class9.height + 1;
  5841. }
  5842.  
  5843. return;
  5844. }
  5845.  
  5846. if (j >= 401 && j <= 500) {
  5847. if ((j -= 401) == 0 && getAnInt900() == 0) {
  5848. class9.message = "Loading ignore list";
  5849. class9.atActionType = 0;
  5850. return;
  5851. }
  5852.  
  5853. if (j == 1 && getAnInt900() == 0) {
  5854. class9.message = "Please wait...";
  5855. class9.atActionType = 0;
  5856. return;
  5857. }
  5858.  
  5859. int j1 = ignoreCount;
  5860.  
  5861. if (getAnInt900() == 0) {
  5862. j1 = 0;
  5863. }
  5864.  
  5865. if (j >= j1) {
  5866. class9.message = "";
  5867. class9.atActionType = 0;
  5868. return;
  5869. } else {
  5870. class9.message = TextClass.fixName(TextClass.nameForLong(ignoreListAsLongs[j]));
  5871. class9.atActionType = 1;
  5872. return;
  5873. }
  5874. }
  5875.  
  5876. if (j == 503) {
  5877. class9.scrollMax = ignoreCount * 15 + 20;
  5878.  
  5879. if (class9.scrollMax <= class9.height) {
  5880. class9.scrollMax = class9.height + 1;
  5881. }
  5882.  
  5883. return;
  5884. }
  5885.  
  5886. if (j == 327) {
  5887. class9.modelRotation1 = 150;
  5888. class9.modelRotation2 = (int) (Math.sin(loopCycle / 40D) * 256D) & 0x7FF;
  5889.  
  5890. if (aBoolean1031) {
  5891. for (int k1 = 0; k1 < 7; k1++) {
  5892. int l1 = anIntArray1065[k1];
  5893.  
  5894. if (l1 >= 0 && !IdentityKit.cache[l1].method537()) {
  5895. return;
  5896. }
  5897. }
  5898.  
  5899. aBoolean1031 = false;
  5900. Model aclass30_sub2_sub4_sub6s[] = new Model[7];
  5901. int i2 = 0;
  5902.  
  5903. for (int j2 = 0; j2 < 7; j2++) {
  5904. int k2 = anIntArray1065[j2];
  5905.  
  5906. if (k2 >= 0) {
  5907. aclass30_sub2_sub4_sub6s[i2++] = IdentityKit.cache[k2].method538();
  5908. }
  5909. }
  5910.  
  5911. Model model = new Model(i2, aclass30_sub2_sub4_sub6s);
  5912.  
  5913. for (int l2 = 0; l2 < 5; l2++) {
  5914. if (anIntArray990[l2] != 0) {
  5915. model.method476(anIntArrayArray1003[l2][0], anIntArrayArray1003[l2][anIntArray990[l2]]);
  5916.  
  5917. if (l2 == 1) {
  5918. model.method476(anIntArray1204[0], anIntArray1204[anIntArray990[l2]]);
  5919. }
  5920. }
  5921. }
  5922.  
  5923. model.method469();
  5924. model.method470(Animation.cache[myPlayer.anInt1511].frame2IDS[0]);
  5925. model.method479(64, 850, -30, -50, -30, true);
  5926. class9.anInt233 = 5;
  5927. class9.mediaID = 0;
  5928. RSInterface.method208(aBoolean994, model);
  5929. }
  5930.  
  5931. return;
  5932. }
  5933.  
  5934. if (j == 328) {
  5935. RSInterface rsInterface = class9;
  5936. int verticleTilt = 150;
  5937. int animationSpeed = (int) (Math.sin(loopCycle / 40D) * 256D) & 0x7ff;
  5938. rsInterface.modelRotation1 = verticleTilt;
  5939. rsInterface.modelRotation2 = animationSpeed;
  5940.  
  5941. if (aBoolean1031) {
  5942. Model characterDisplay = myPlayer.method452();
  5943.  
  5944. for (int l2 = 0; l2 < 5; l2++) {
  5945. if (anIntArray990[l2] != 0) {
  5946. characterDisplay.method476(anIntArrayArray1003[l2][0], anIntArrayArray1003[l2][anIntArray990[l2]]);
  5947. if (l2 == 1) {
  5948. characterDisplay.method476(anIntArray1204[0], anIntArray1204[anIntArray990[l2]]);
  5949. }
  5950. }
  5951. }
  5952.  
  5953. int staticFrame = myPlayer.anInt1511;
  5954. characterDisplay.method469();
  5955. characterDisplay.method470(Animation.cache[staticFrame].frame2IDS[0]);
  5956. rsInterface.anInt233 = 5;
  5957. rsInterface.mediaID = 0;
  5958. RSInterface.method208(aBoolean994, characterDisplay);
  5959. }
  5960.  
  5961. return;
  5962. }
  5963.  
  5964. if (j == 324) {
  5965. if (aClass30_Sub2_Sub1_Sub1_931 == null) {
  5966. aClass30_Sub2_Sub1_Sub1_931 = class9.sprite1;
  5967. aClass30_Sub2_Sub1_Sub1_932 = class9.sprite2;
  5968. }
  5969.  
  5970. if (aBoolean1047) {
  5971. class9.sprite1 = aClass30_Sub2_Sub1_Sub1_932;
  5972. return;
  5973. } else {
  5974. class9.sprite1 = aClass30_Sub2_Sub1_Sub1_931;
  5975. return;
  5976. }
  5977. }
  5978.  
  5979. if (j == 325) {
  5980. if (aClass30_Sub2_Sub1_Sub1_931 == null) {
  5981. aClass30_Sub2_Sub1_Sub1_931 = class9.sprite1;
  5982. aClass30_Sub2_Sub1_Sub1_932 = class9.sprite2;
  5983. }
  5984.  
  5985. if (aBoolean1047) {
  5986. class9.sprite1 = aClass30_Sub2_Sub1_Sub1_931;
  5987. return;
  5988. } else {
  5989. class9.sprite1 = aClass30_Sub2_Sub1_Sub1_932;
  5990. return;
  5991. }
  5992. }
  5993.  
  5994. if (j == 650 || j == 655) {
  5995. if (anInt1193 != 0) {
  5996. String lastVisit;
  5997.  
  5998. if (daysSinceLastLogin == 0) {
  5999. lastVisit = "earlier today";
  6000. } else if (daysSinceLastLogin == 1) {
  6001. lastVisit = "yesterday";
  6002. } else {
  6003. lastVisit = daysSinceLastLogin + " days ago";
  6004. }
  6005.  
  6006. class9.message = "You last logged in " + lastVisit + " from: " + Signlink.dns;
  6007. } else {
  6008. class9.message = "";
  6009. }
  6010. }
  6011.  
  6012. if (j == 651) {
  6013. if (unreadMessages == 0) {
  6014. class9.message = "0 unread messages";
  6015. class9.textColor = 0xffff00;
  6016. } else if (unreadMessages == 1) {
  6017. class9.message = "1 unread message";
  6018. class9.textColor = 65280;
  6019. } else if (unreadMessages > 1) {
  6020. class9.message = unreadMessages + " unread messages";
  6021. class9.textColor = 65280;
  6022. }
  6023. }
  6024.  
  6025. if (j == 652) {
  6026. if (daysSinceRecovChange == 201) {
  6027. if (membersInt == 1) {
  6028. class9.message = "@yel@This is a non-members world: @whi@Since you are a member we";
  6029. } else {
  6030. class9.message = "";
  6031. }
  6032. } else if (daysSinceRecovChange == 200) {
  6033. class9.message = "You have not yet set any password recovery questions.";
  6034. } else {
  6035. String s1;
  6036.  
  6037. if (daysSinceRecovChange == 0) {
  6038. s1 = "Earlier today";
  6039. } else if (daysSinceRecovChange == 1) {
  6040. s1 = "Yesterday";
  6041. } else {
  6042. s1 = daysSinceRecovChange + " days ago";
  6043. }
  6044.  
  6045. class9.message = s1 + " you changed your recovery questions";
  6046. }
  6047. }
  6048.  
  6049. if (j == 653) {
  6050. if (daysSinceRecovChange == 201) {
  6051. if (membersInt == 1) {
  6052. class9.message = "@whi@recommend you use a members world instead. You may use";
  6053. } else {
  6054. class9.message = "";
  6055. }
  6056. } else if (daysSinceRecovChange == 200) {
  6057. class9.message = "We strongly recommend you do so now to secure your account.";
  6058. } else {
  6059. class9.message = "If you do not remember making this change then cancel it immediately";
  6060. }
  6061. }
  6062.  
  6063. if (j == 654) {
  6064. if (daysSinceRecovChange == 201) {
  6065. if (membersInt == 1) {
  6066. class9.message = "@whi@this world but member benefits are unavailable whilst here.";
  6067. return;
  6068. } else {
  6069. class9.message = "";
  6070. return;
  6071. }
  6072. }
  6073.  
  6074. if (daysSinceRecovChange == 200) {
  6075. class9.message = "Do this from the 'account management' area on our front webpage";
  6076. return;
  6077. }
  6078.  
  6079. class9.message = "Do this from the 'account management' area on our front webpage";
  6080. }
  6081. }
  6082.  
  6083. private void drawGameScreen() {
  6084. if (getFullscreenInterfaceID() != -1 && (loadingStage == 2 || super.fullGameScreen != null)) {
  6085. if (loadingStage == 2) {
  6086. method119(anInt945, getFullscreenInterfaceID());
  6087. if (openInterfaceID != -1) {
  6088. method119(anInt945, openInterfaceID);
  6089. }
  6090. anInt945 = 0;
  6091. resetAllImageProducers();
  6092. super.fullGameScreen.initDrawingArea();
  6093. Rasterizer.lineOffsets = fullScreenTextureArray;
  6094. DrawingArea.setAllPixelsToZero();
  6095. welcomeScreenRaised = true;
  6096. if (openInterfaceID != -1) {
  6097. RSInterface rsInterface_1 = RSInterface.interfaceCache[openInterfaceID];
  6098. if (rsInterface_1.width == 512 && rsInterface_1.height == 334 && rsInterface_1.type == 0) {
  6099. rsInterface_1.width = 765;
  6100. rsInterface_1.height = 503;
  6101. }
  6102. drawInterface(0, 0, rsInterface_1, 8);
  6103. }
  6104. RSInterface rsInterface = RSInterface.interfaceCache[getFullscreenInterfaceID()];
  6105. if (rsInterface.width == 512 && rsInterface.height == 334 && rsInterface.type == 0) {
  6106. rsInterface.width = 765;
  6107. rsInterface.height = 503;
  6108. }
  6109. drawInterface(0, 0, rsInterface, 8);
  6110.  
  6111. if (!menuOpen) {
  6112. processRightClick();
  6113. drawTooltip();
  6114. } else {
  6115. drawMenu();
  6116. }
  6117. }
  6118. drawCount++;
  6119. super.fullGameScreen.drawGraphics(0, super.graphics, 0);
  6120. return;
  6121. } else {
  6122. if (drawCount != 0) {
  6123. resetImageProducers2();
  6124. }
  6125. }
  6126. if (welcomeScreenRaised) {
  6127. welcomeScreenRaised = false;
  6128. if (GameFrame.getScreenMode() == ScreenMode.FIXED) {
  6129. topFrame.drawGraphics(0, super.graphics, 0);
  6130. leftFrame.drawGraphics(4, super.graphics, 0);
  6131.  
  6132. rightFrame.drawGraphics(4, super.graphics, 516);
  6133. rightFrame.drawGraphics(4, super.graphics, 515);
  6134. }
  6135.  
  6136. setInputTaken(true);
  6137. tabAreaAltered = true;
  6138.  
  6139. if (loadingStage != 2) {
  6140. if (!resizing) {
  6141. gameScreenIP.drawGraphics(gameScreenDrawY, super.graphics, gameScreenDrawX);
  6142. }
  6143. mapAreaIP.drawGraphics(getMapArea().getyPos(), super.graphics, getMapArea().getxPos());
  6144. }
  6145. }
  6146.  
  6147. drawTabArea();
  6148.  
  6149. if (backDialogID == -1) {
  6150. aClass9_1059.scrollPosition = anInt1211 - anInt1089 - 110;
  6151. if (super.mouseX > chatArea.getxPos() + 478 && super.mouseX < chatArea.getxPos() + 580 && super.mouseY > chatArea.getyPos() + 4) {
  6152. method65(494, 110, super.mouseX - chatArea.getxPos(), super.mouseY - chatArea.getyPos() - 10, aClass9_1059, 0, false, anInt1211);
  6153. }
  6154. int i = anInt1211 - 110 - aClass9_1059.scrollPosition;
  6155. if (i < 0) {
  6156. i = 0;
  6157. }
  6158. if (i > anInt1211 - 110) {
  6159. i = anInt1211 - 110;
  6160. }
  6161. if (anInt1089 != i) {
  6162. anInt1089 = i;
  6163. setInputTaken(true);
  6164. }
  6165. }
  6166. if (backDialogID != -1) {
  6167. boolean flag2 = method119(anInt945, backDialogID);
  6168. if (flag2) {
  6169. setInputTaken(true);
  6170. }
  6171. }
  6172.  
  6173. if (atInventoryInterfaceType == 3) {
  6174. setInputTaken(true);
  6175. }
  6176.  
  6177. if (activeInterfaceType == 3) {
  6178. setInputTaken(true);
  6179. }
  6180.  
  6181. if (aString844 != null) {
  6182. setInputTaken(true);
  6183. }
  6184.  
  6185. if (menuOpen && menuScreenArea == 2) {
  6186. setInputTaken(true);
  6187. }
  6188.  
  6189. if (inputTaken) {
  6190. drawChatArea();
  6191. drawConsoleArea();
  6192. setInputTaken(false);
  6193. }
  6194.  
  6195. if (loadingStage == 2) {
  6196. method146();
  6197. }
  6198.  
  6199. if (loadingStage == 2) {
  6200. if (GameFrame.getScreenMode() == ScreenMode.FIXED) {
  6201. drawMinimap();
  6202. if (getMapArea().isVisible()) {
  6203. mapAreaIP.drawGraphics(getMapArea().getyPos(), super.graphics, getMapArea().getxPos());
  6204. }
  6205. }
  6206. }
  6207.  
  6208. if (anInt1054 != -1) {
  6209. tabAreaAltered = true;
  6210. }
  6211.  
  6212. if (tabAreaAltered) {
  6213. if (anInt1054 != -1 && anInt1054 == tabID) {
  6214. anInt1054 = -1;
  6215. getOut().putOpcode(120);
  6216. getOut().putShortBigEndian(tabID);
  6217. }
  6218.  
  6219. tabAreaAltered = false;
  6220. aRSImageProducer_1125.initDrawingArea();
  6221. gameScreenIP.initDrawingArea();
  6222. }
  6223.  
  6224. if (menuOpen) {
  6225. drawMenu();
  6226. }
  6227.  
  6228. anInt945 = 0;
  6229. }
  6230.  
  6231. private void drawHeadIcon() {
  6232. if (anInt855 != 2) {
  6233. return;
  6234. }
  6235.  
  6236. calcEntityScreenPos((anInt934 - baseX << 7) + anInt937, anInt936 * 2, (anInt935 - baseY << 7) + anInt938);
  6237.  
  6238. if (spriteDrawX > -1 && loopCycle % 20 < 10) {
  6239. headIconsHint[0].drawSprite(spriteDrawX - 12, spriteDrawY - 28);
  6240. }
  6241. }
  6242.  
  6243. private void drawHoverBox(int xPos, int yPos, String text) {
  6244. String[] results = text.split("\n");
  6245. int height = results.length * 16 + 6;
  6246. int width = chatTextDrawingArea.getTextWidth(results[0]) + 6;
  6247.  
  6248. for (int i = 1; i < results.length; i++) {
  6249. if (width <= chatTextDrawingArea.getTextWidth(results[i]) + 6) {
  6250. width = chatTextDrawingArea.getTextWidth(results[i]) + 6;
  6251. }
  6252. }
  6253.  
  6254. DrawingArea.drawPixels(height, yPos, xPos, 0xFFFFA0, width);
  6255. DrawingArea.fillPixels(xPos, width, height, 0, yPos);
  6256. yPos += 14;
  6257.  
  6258. for (String result : results) {
  6259. normalText.method389(false, xPos + 3, 0, result, yPos);
  6260. yPos += 16;
  6261. }
  6262. }
  6263.  
  6264. public void drawInterface(int scrollOffset, int interfaceX, RSInterface class9, int interfaceY) {
  6265. if (class9 == null) {
  6266. class9 = RSInterface.interfaceCache[21356];
  6267. }
  6268.  
  6269. if (class9.children == null || class9.type != 0) {
  6270. return;
  6271. }
  6272.  
  6273. if (class9.interfaceShown && anInt1026 != class9.id && anInt1048 != class9.id && anInt1039 != class9.id) {
  6274. return;
  6275. }
  6276.  
  6277. int i1 = DrawingArea.topX;
  6278. int j1 = DrawingArea.topY;
  6279. int k1 = DrawingArea.bottomX;
  6280. int l1 = DrawingArea.bottomY;
  6281. int alpha = class9.opacity;
  6282. DrawingArea.setBounds(interfaceX, interfaceY, interfaceX + class9.width, interfaceY + class9.height);
  6283. int i2 = class9.children.length;
  6284.  
  6285. for (int j2 = 0; j2 < i2; j2++) {
  6286. int childX = class9.childX[j2] + interfaceX;
  6287. int childY = class9.childY[j2] + interfaceY - scrollOffset;
  6288. RSInterface childInterface = RSInterface.interfaceCache[class9.children[j2]];
  6289. childX += childInterface.xOffset;
  6290. childY += childInterface.yOffset;
  6291.  
  6292. if (childInterface.contentType > 0) {
  6293. drawFriendsListOrWelcomeScreen(childInterface);
  6294. }
  6295.  
  6296. for (int m5 = 0; m5 < IDs.length; m5++) {
  6297. if (childInterface.id == IDs[m5] + 1) {
  6298. if (m5 > 61) {
  6299. drawBlackBox(childX + 1, childY);
  6300. } else {
  6301. drawBlackBox(childX, childY + 1);
  6302. }
  6303. }
  6304. }
  6305.  
  6306. for (int element : runeChildren) {
  6307. if (childInterface.id == element) {
  6308. childInterface.modelZoom = 775;
  6309. }
  6310. }
  6311.  
  6312. if (childInterface.type == 0) {
  6313. if (childInterface.scrollPosition > childInterface.scrollMax - childInterface.height) {
  6314. childInterface.scrollPosition = childInterface.scrollMax - childInterface.height;
  6315. }
  6316.  
  6317. if (childInterface.scrollPosition < 0) {
  6318. childInterface.scrollPosition = 0;
  6319. }
  6320.  
  6321. drawInterface(childInterface.scrollPosition, childX, childInterface, childY);
  6322.  
  6323. if (childInterface.scrollMax > childInterface.height) {
  6324. drawScrollbar(childInterface.height, childInterface.scrollPosition, childY, childX + childInterface.width, childInterface.scrollMax, false, false);
  6325. }
  6326. } else if (childInterface.type != 1) {
  6327. if (childInterface.type == 2) {
  6328. int i3 = 0;
  6329. for (int l3 = 0; l3 < childInterface.height; l3++) {
  6330. for (int l4 = 0; l4 < childInterface.width; l4++) {
  6331. int k5 = childX + l4 * (32 + childInterface.invSpritePadX);
  6332. int j6 = childY + l3 * (32 + childInterface.invSpritePadY);
  6333.  
  6334. if (i3 < 20) {
  6335. k5 += childInterface.spritesX[i3];
  6336. j6 += childInterface.spritesY[i3];
  6337. }
  6338.  
  6339. if (i3 < childInterface.inv.length && childInterface.inv[i3] > 0) {
  6340. int k6 = 0;
  6341. int j7 = 0;
  6342. int j9 = childInterface.inv[i3] - 1;
  6343.  
  6344. if (k5 > DrawingArea.topX - 32 && k5 < DrawingArea.bottomX && j6 > DrawingArea.topY - 32 && j6 < DrawingArea.bottomY || activeInterfaceType != 0 && anInt1085 == i3) {
  6345. int l9 = 0;
  6346. if (itemSelected == 1 && anInt1283 == i3 && anInt1284 == childInterface.id) {
  6347. l9 = 0xffffff;
  6348. }
  6349.  
  6350. Sprite selectedItem = ItemDefinition.getSprite(j9, childInterface.invStackSizes[i3], l9);
  6351.  
  6352. if (selectedItem != null) {
  6353. if (activeInterfaceType != 0 && anInt1085 == i3 && anInt1084 == childInterface.id) {
  6354. k6 = super.mouseX - anInt1087;
  6355. j7 = super.mouseY - anInt1088;
  6356.  
  6357. if (k6 < 5 && k6 > -5) {
  6358. k6 = 0;
  6359. }
  6360.  
  6361. if (j7 < 5 && j7 > -5) {
  6362. j7 = 0;
  6363. }
  6364.  
  6365. if (anInt989 < 10) {
  6366. k6 = 0;
  6367. j7 = 0;
  6368. }
  6369.  
  6370. selectedItem.drawSprite1(k5 + k6, j6 + j7);
  6371.  
  6372. if (j6 + j7 < DrawingArea.topY && class9.scrollPosition > 0) {
  6373. int i10 = anInt945 * (DrawingArea.topY - j6 - j7) / 3;
  6374.  
  6375. if (i10 > anInt945 * 10) {
  6376. i10 = anInt945 * 10;
  6377. }
  6378.  
  6379. if (i10 > class9.scrollPosition) {
  6380. i10 = class9.scrollPosition;
  6381. }
  6382.  
  6383. class9.scrollPosition -= i10;
  6384. anInt1088 += i10;
  6385. }
  6386.  
  6387. if (j6 + j7 + 32 > DrawingArea.bottomY && class9.scrollPosition < class9.scrollMax - class9.height) {
  6388. int j10 = anInt945 * (j6 + j7 + 32 - DrawingArea.bottomY) / 3;
  6389.  
  6390. if (j10 > anInt945 * 10) {
  6391. j10 = anInt945 * 10;
  6392. }
  6393.  
  6394. if (j10 > class9.scrollMax - class9.height - class9.scrollPosition) {
  6395. j10 = class9.scrollMax - class9.height - class9.scrollPosition;
  6396. }
  6397.  
  6398. class9.scrollPosition += j10;
  6399. anInt1088 -= j10;
  6400. }
  6401. } else if (atInventoryInterfaceType != 0 && atInventoryIndex == i3 && atInventoryInterface == childInterface.id) {
  6402. selectedItem.drawSprite1(k5, j6);
  6403. } else {
  6404. selectedItem.drawSprite(k5, j6);
  6405. }
  6406.  
  6407. if (selectedItem.maxWidth == 33 || childInterface.invStackSizes[i3] != 1) {
  6408. int k10 = childInterface.invStackSizes[i3];
  6409.  
  6410. if (!childInterface.hideStackSize) {
  6411.  
  6412. smallText.method385(0, intToKOrMil(k10), j6 + 10 + j7, k5 + 1 + k6);
  6413.  
  6414. if (k10 > 99999 && k10 < 10000000) {
  6415. smallText.method385(0xFFFFFF, intToKOrMil(k10), j6 + 9 + j7, k5 + k6);
  6416. } else if (k10 > 9999999) {
  6417. smallText.method385(0x00ff80, intToKOrMil(k10), j6 + 9 + j7, k5 + k6);
  6418. } else {
  6419. smallText.method385(0xFFFF00, intToKOrMil(k10), j6 + 9 + j7, k5 + k6);
  6420. }
  6421. }
  6422. }
  6423. }
  6424. }
  6425. } else if (childInterface.sprites != null && i3 < 20) {
  6426. Sprite class30_sub2_sub1_sub1_1 = childInterface.sprites[i3];
  6427.  
  6428. if (class30_sub2_sub1_sub1_1 != null) {
  6429. class30_sub2_sub1_sub1_1.drawSprite(k5, j6);
  6430. }
  6431. }
  6432.  
  6433. i3++;
  6434. }
  6435. }
  6436. } else if (childInterface.type == 3) {
  6437. boolean flag = false;
  6438.  
  6439. if (anInt1039 == childInterface.id || anInt1048 == childInterface.id || anInt1026 == childInterface.id) {
  6440. flag = true;
  6441. }
  6442.  
  6443. int j3;
  6444.  
  6445. if (interfaceIsSelected(childInterface)) {
  6446. j3 = childInterface.anInt219;
  6447.  
  6448. if (flag && childInterface.anInt239 != 0) {
  6449. j3 = childInterface.anInt239;
  6450. }
  6451. } else {
  6452. j3 = childInterface.textColor;
  6453.  
  6454. if (flag && childInterface.textColorSelected != 0) {
  6455. j3 = childInterface.textColorSelected;
  6456. }
  6457. }
  6458.  
  6459. if (childInterface.opacity == 0) {
  6460. if (childInterface.aBoolean227) {
  6461. DrawingArea.drawPixels(childInterface.height, childY, childX, j3, childInterface.width);
  6462. } else {
  6463. DrawingArea.fillPixels(childX, childInterface.width, childInterface.height, j3, childY);
  6464. }
  6465. } else if (childInterface.aBoolean227) {
  6466. DrawingArea.method335(j3, childY, childInterface.width, childInterface.height, 256 - (childInterface.opacity & 0xff), childX);
  6467. } else {
  6468. DrawingArea.method338(childY, childInterface.height, 256 - (childInterface.opacity & 0xff), j3, childInterface.width, childX);
  6469. }
  6470. } else if (childInterface.type == 4) {
  6471. TextDrawingArea textDrawingArea = childInterface.textDrawingAreas;
  6472. String s = childInterface.message;
  6473. int xOffset = 0;
  6474. int imageDraw = 0;
  6475. final String INITIAL_MESSAGE = s;
  6476. if (s.contains("<img=")) {
  6477. int prefix = s.indexOf("<img=");
  6478. int suffix = s.indexOf(">");
  6479. try {
  6480. imageDraw = Integer.parseInt(s.substring(prefix + 5, suffix));
  6481. s = s.replaceAll(s.substring(prefix + 5, suffix), "");
  6482. s = s.replaceAll("</img>", "");
  6483. s = s.replaceAll("<img=>", "");
  6484. } catch (NumberFormatException nfe) {
  6485. // System.out.println("Unable to draw player
  6486. // crown on interface. Unable to read rights.");
  6487. s = INITIAL_MESSAGE;
  6488. } catch (IllegalStateException ise) {
  6489. // System.out.println("Unable to draw player
  6490. // crown on interface, rights too low or
  6491. // high.");
  6492. s = INITIAL_MESSAGE;
  6493. }
  6494. if (suffix > prefix) {
  6495. xOffset += 14;
  6496. }
  6497. }
  6498. boolean flag1 = false;
  6499. if (anInt1039 == childInterface.id || anInt1048 == childInterface.id || anInt1026 == childInterface.id) {
  6500. flag1 = true;
  6501. }
  6502. int i4;
  6503. if (interfaceIsSelected(childInterface)) {
  6504. i4 = childInterface.anInt219;
  6505. if (flag1 && childInterface.anInt239 != 0) {
  6506. i4 = childInterface.anInt239;
  6507. }
  6508. if (childInterface.disabledText.length() > 0) {
  6509. s = childInterface.disabledText;
  6510. }
  6511. } else {
  6512. if (childInterface.drawSecondary) {
  6513. i4 = childInterface.anInt219;
  6514. } else {
  6515. i4 = childInterface.textColor;
  6516. }
  6517. if (flag1 && childInterface.textColorSelected != 0) {
  6518. i4 = childInterface.textColorSelected;
  6519. }
  6520. }
  6521. if (childInterface.atActionType == 6 && dialogueOptionsShowing) {
  6522. s = "Please wait...";
  6523. i4 = childInterface.textColor;
  6524. }
  6525. if (DrawingArea.width == 516) {
  6526. if (i4 == 0xffff00) {
  6527. i4 = 255;
  6528. }
  6529. if (i4 == 49152) {
  6530. i4 = 0xffffff;
  6531. }
  6532. }
  6533. if (childInterface.parentID == 1151 || childInterface.parentID == 12855) {
  6534. switch (i4) {
  6535. case 16773120:
  6536. i4 = 0xFE981F;
  6537. break;
  6538. case 7040819:
  6539. i4 = 0xAF6A1A;
  6540. break;
  6541. }
  6542. }
  6543. for (int l6 = childY + textDrawingArea.anInt1497; s.length() > 0; l6 += textDrawingArea.anInt1497) {
  6544. if (s.indexOf("%") != -1) {
  6545. do {
  6546. int k7 = s.indexOf("%1");
  6547. if (k7 == -1) {
  6548. break;
  6549. }
  6550. if (childInterface.id < 4000
  6551. || childInterface.id > 5000 && childInterface.id != 13921 && childInterface.id != 13922 && childInterface.id != 12171 && childInterface.id != 12172) {
  6552. s = s.substring(0, k7) + methodR(extractInterfaceValues(childInterface, 0)) + s.substring(k7 + 2);
  6553. } else {
  6554. s = s.substring(0, k7) + interfaceIntToString(extractInterfaceValues(childInterface, 0)) + s.substring(k7 + 2);
  6555. }
  6556. } while (true);
  6557. do {
  6558. int l7 = s.indexOf("%2");
  6559. if (l7 == -1) {
  6560. break;
  6561. }
  6562. s = s.substring(0, l7) + interfaceIntToString(extractInterfaceValues(childInterface, 1)) + s.substring(l7 + 2);
  6563. } while (true);
  6564. do {
  6565. int i8 = s.indexOf("%3");
  6566. if (i8 == -1) {
  6567. break;
  6568. }
  6569. s = s.substring(0, i8) + interfaceIntToString(extractInterfaceValues(childInterface, 2)) + s.substring(i8 + 2);
  6570. } while (true);
  6571. do {
  6572. int j8 = s.indexOf("%4");
  6573. if (j8 == -1) {
  6574. break;
  6575. }
  6576. s = s.substring(0, j8) + interfaceIntToString(extractInterfaceValues(childInterface, 3)) + s.substring(j8 + 2);
  6577. } while (true);
  6578. do {
  6579. int k8 = s.indexOf("%5");
  6580. if (k8 == -1) {
  6581. break;
  6582. }
  6583. s = s.substring(0, k8) + interfaceIntToString(extractInterfaceValues(childInterface, 4)) + s.substring(k8 + 2);
  6584. } while (true);
  6585. }
  6586. int l8 = s.indexOf("\\n");
  6587. String s1;
  6588. if (l8 != -1) {
  6589. s1 = s.substring(0, l8);
  6590. s = s.substring(l8 + 2);
  6591. } else {
  6592. s1 = s;
  6593. s = "";
  6594. }
  6595.  
  6596. if (imageDraw > 0 && xOffset > 0) {
  6597. int drawImageY = childY + 14;
  6598. if (imageDraw >= 34) { // Clan chat images
  6599. xOffset -= 5;
  6600. drawImageY -= 7;
  6601. }
  6602. newRegularFont.drawBasicString("<img=" + (imageDraw - 1) + ">", childX, drawImageY);
  6603. }
  6604. if (childInterface.centerText) {
  6605. textDrawingArea.method382(i4, childX + childInterface.width / 2 + xOffset, s1, l6, childInterface.textShadow);
  6606. } else {
  6607. textDrawingArea.method389(childInterface.textShadow, childX + xOffset, i4, s1, l6);
  6608. }
  6609. }
  6610. } else if (childInterface.type == 5) {
  6611. Sprite sprite;
  6612. if (interfaceIsSelected(childInterface)) {
  6613. sprite = childInterface.sprite2;
  6614. } else {
  6615. sprite = childInterface.sprite1;
  6616. }
  6617. if (childInterface.id == 1164 || childInterface.id == 1167 || childInterface.id == 1170 || childInterface.id == 1174 || childInterface.id == 1540 || childInterface.id == 1541
  6618. || childInterface.id == 7455 || childInterface.id == 18470 || childInterface.id == 13035 || childInterface.id == 13045 || childInterface.id == 13053
  6619. || childInterface.id == 13061 || childInterface.id == 13069 || childInterface.id == 13079 || childInterface.id == 30064 || childInterface.id == 30075
  6620. || childInterface.id == 30083 || childInterface.id == 30106 || childInterface.id == 30114 || childInterface.id == 30106 || childInterface.id == 30170
  6621. || childInterface.id == 13087 || childInterface.id == 30162 || childInterface.id == 13095) {
  6622. sprite = childInterface.sprite2;
  6623. }
  6624. if (childInterface.id == 21746) {
  6625. childInterface.valueIndexArray[1][2] = 560;
  6626. }
  6627. // Makes teleports always lit up
  6628. if (spellSelected == 1 && childInterface.id == spellID && spellID != 0 && sprite != null) {
  6629. sprite.drawSprite(childX, childY, 0xffffff);
  6630. } else {
  6631. if (sprite != null) {
  6632. if (childInterface.drawsTransparent) {
  6633. sprite.drawTransparentSprite(childX, childY, alpha);
  6634. } else {
  6635. sprite.drawSprite(childX, childY);
  6636. }
  6637. }
  6638. }
  6639. if (autocast && childInterface.id == spellID && childInterface.id == autocastId) {
  6640. cacheSprite[497].drawSprite(childX - 3, childY - 3);
  6641. }
  6642. if (sprite != null) {
  6643. if (childInterface.drawsTransparent) {
  6644. sprite.drawTransparentSprite(childX, childY, alpha);
  6645. } else {
  6646. sprite.drawSprite(childX, childY);
  6647. }
  6648. }
  6649.  
  6650. } else if (childInterface.type == 6) {
  6651. int k3 = Rasterizer.centerX;
  6652. int j4 = Rasterizer.centerY;
  6653. Rasterizer.centerX = childX + childInterface.width / 2;
  6654. Rasterizer.centerY = childY + childInterface.height / 2;
  6655. int i5 = Rasterizer.SINE[childInterface.modelRotation1] * childInterface.modelZoom >> 16;
  6656. int l5 = Rasterizer.COSINE[childInterface.modelRotation1] * childInterface.modelZoom >> 16;
  6657. boolean flag2 = interfaceIsSelected(childInterface);
  6658. int i7;
  6659. if (flag2) {
  6660. i7 = childInterface.anInt258;
  6661. } else {
  6662. i7 = childInterface.anInt257;
  6663. }
  6664. Model model;
  6665. if (i7 == -1) {
  6666. model = childInterface.method209(-1, -1, flag2);
  6667. } else {
  6668. Animation animation = Animation.cache[i7];
  6669. model = childInterface.method209(animation.frame1IDS[childInterface.anInt246], animation.frame2IDS[childInterface.anInt246], flag2);
  6670. }
  6671. if (model != null) {
  6672. // model.method482(childInterface.modelRotation2, 0,
  6673. // childInterface.modelRotation1, 0, i5, l5);
  6674. model.method482(childInterface.modelRotation2, 0, childInterface.modelRotation1, 0, i5, l5);
  6675.  
  6676. }
  6677. Rasterizer.centerX = k3;
  6678. Rasterizer.centerY = j4;
  6679. } else if (childInterface.type == 7) {
  6680. TextDrawingArea textDrawingArea_1 = childInterface.textDrawingAreas;
  6681. int k4 = 0;
  6682. for (int j5 = 0; j5 < childInterface.height; j5++) {
  6683. for (int i6 = 0; i6 < childInterface.width; i6++) {
  6684. if (childInterface.inv[k4] > 0) {
  6685. ItemDefinition itemDef = ItemDefinition.get(childInterface.inv[k4] - 1);
  6686. String s2 = itemDef.name;
  6687. if (itemDef.stackable || childInterface.invStackSizes[k4] != 1) {
  6688. s2 = s2 + " x" + intToKOrMilLongName(childInterface.invStackSizes[k4]);
  6689. }
  6690. int i9 = childX + i6 * (115 + childInterface.invSpritePadX);
  6691. int k9 = childY + j5 * (12 + childInterface.invSpritePadY);
  6692. if (childInterface.centerText) {
  6693. textDrawingArea_1.method382(childInterface.textColor, i9 + childInterface.width / 2, s2, k9, childInterface.textShadow);
  6694. } else {
  6695. textDrawingArea_1.method389(childInterface.textShadow, i9, childInterface.textColor, s2, k9);
  6696. }
  6697. }
  6698. k4++;
  6699. }
  6700. }
  6701. } else if (childInterface.type == 8 && (anInt1500 == childInterface.id || anInt1044 == childInterface.id || anInt1129 == childInterface.id) && anInt1501 == 50 && !menuOpen) {
  6702. int boxWidth = 0;
  6703. int boxHeight = 0;
  6704. TextDrawingArea textDrawingArea_2 = normalText;
  6705. for (String s1 = childInterface.message; s1.length() > 0;) {
  6706. if (s1.indexOf("%") != -1) {
  6707. do {
  6708. int k7 = s1.indexOf("%1");
  6709. if (k7 == -1) {
  6710. break;
  6711. }
  6712. s1 = s1.substring(0, k7) + interfaceIntToString(extractInterfaceValues(childInterface, 0)) + s1.substring(k7 + 2);
  6713. } while (true);
  6714. do {
  6715. int l7 = s1.indexOf("%2");
  6716. if (l7 == -1) {
  6717. break;
  6718. }
  6719. s1 = s1.substring(0, l7) + interfaceIntToString(extractInterfaceValues(childInterface, 1)) + s1.substring(l7 + 2);
  6720. } while (true);
  6721. do {
  6722. int i8 = s1.indexOf("%3");
  6723. if (i8 == -1) {
  6724. break;
  6725. }
  6726. s1 = s1.substring(0, i8) + interfaceIntToString(extractInterfaceValues(childInterface, 2)) + s1.substring(i8 + 2);
  6727. } while (true);
  6728. do {
  6729. int j8 = s1.indexOf("%4");
  6730. if (j8 == -1) {
  6731. break;
  6732. }
  6733. s1 = s1.substring(0, j8) + interfaceIntToString(extractInterfaceValues(childInterface, 3)) + s1.substring(j8 + 2);
  6734. } while (true);
  6735. do {
  6736. int k8 = s1.indexOf("%5");
  6737. if (k8 == -1) {
  6738. break;
  6739. }
  6740. s1 = s1.substring(0, k8) + interfaceIntToString(extractInterfaceValues(childInterface, 4)) + s1.substring(k8 + 2);
  6741. } while (true);
  6742. }
  6743. int l7 = s1.indexOf("\\n");
  6744. String s4;
  6745. if (l7 != -1) {
  6746. s4 = s1.substring(0, l7);
  6747. s1 = s1.substring(l7 + 2);
  6748. } else {
  6749. s4 = s1;
  6750. s1 = "";
  6751. }
  6752. int j10 = textDrawingArea_2.getTextWidth(s4);
  6753. if (j10 > boxWidth) {
  6754. boxWidth = j10;
  6755. }
  6756. boxHeight += textDrawingArea_2.anInt1497 + 1;
  6757. }
  6758. boxWidth += 6;
  6759. boxHeight += 7;
  6760. int xPos = childX + childInterface.width - 5 - boxWidth;
  6761. int yPos = childY + childInterface.height + 5;
  6762. if (xPos < childX + 5) {
  6763. xPos = childX + 5;
  6764. }
  6765. if (xPos + boxWidth > interfaceX + class9.width) {
  6766. xPos = interfaceX + class9.width - boxWidth;
  6767. }
  6768. if (yPos + boxHeight > interfaceY + class9.height) {
  6769. yPos = childY - boxHeight;
  6770. }
  6771. DrawingArea.drawPixels(boxHeight, yPos, xPos, 0xFFFFA0, boxWidth);
  6772. DrawingArea.fillPixels(xPos, boxWidth, boxHeight, 0, yPos);
  6773. String s2 = childInterface.message;
  6774. for (int j11 = yPos + textDrawingArea_2.anInt1497 + 2; s2.length() > 0; j11 += textDrawingArea_2.anInt1497 + 1) {// anInt1497
  6775. if (s2.indexOf("%") != -1) {
  6776. do {
  6777. int k7 = s2.indexOf("%1");
  6778. if (k7 == -1) {
  6779. break;
  6780. }
  6781. s2 = s2.substring(0, k7) + interfaceIntToString(extractInterfaceValues(childInterface, 0)) + s2.substring(k7 + 2);
  6782. } while (true);
  6783. do {
  6784. int l7 = s2.indexOf("%2");
  6785. if (l7 == -1) {
  6786. break;
  6787. }
  6788. s2 = s2.substring(0, l7) + interfaceIntToString(extractInterfaceValues(childInterface, 1)) + s2.substring(l7 + 2);
  6789. } while (true);
  6790. do {
  6791. int i8 = s2.indexOf("%3");
  6792. if (i8 == -1) {
  6793. break;
  6794. }
  6795. s2 = s2.substring(0, i8) + interfaceIntToString(extractInterfaceValues(childInterface, 2)) + s2.substring(i8 + 2);
  6796. } while (true);
  6797. do {
  6798. int j8 = s2.indexOf("%4");
  6799. if (j8 == -1) {
  6800. break;
  6801. }
  6802. s2 = s2.substring(0, j8) + interfaceIntToString(extractInterfaceValues(childInterface, 3)) + s2.substring(j8 + 2);
  6803. } while (true);
  6804. do {
  6805. int k8 = s2.indexOf("%5");
  6806. if (k8 == -1) {
  6807. break;
  6808. }
  6809. s2 = s2.substring(0, k8) + interfaceIntToString(extractInterfaceValues(childInterface, 4)) + s2.substring(k8 + 2);
  6810. } while (true);
  6811. }
  6812. int l11 = s2.indexOf("\\n");
  6813. String s5;
  6814. if (l11 != -1) {
  6815. s5 = s2.substring(0, l11);
  6816. s2 = s2.substring(l11 + 2);
  6817. } else {
  6818. s5 = s2;
  6819. s2 = "";
  6820. }
  6821. if (childInterface.centerText) {
  6822. textDrawingArea_2.method382(yPos, xPos + childInterface.width / 2, s5, j11, false);
  6823. } else {
  6824. if (s5.contains("\\r")) {
  6825. String text = s5.substring(0, s5.indexOf("\\r"));
  6826. String text2 = s5.substring(s5.indexOf("\\r") + 2);
  6827. textDrawingArea_2.method389(false, xPos + 3, 0, text, j11);
  6828. int rightX = boxWidth + xPos - textDrawingArea_2.getTextWidth(text2) - 2;
  6829. textDrawingArea_2.method389(false, rightX, 0, text2, j11);
  6830. System.out.println("Box: " + boxWidth + "");
  6831. } else {
  6832. textDrawingArea_2.method389(false, xPos + 3, 0, s5, j11);
  6833. }
  6834. }
  6835. }
  6836. } else if (childInterface.type == 9) {
  6837. if (interfaceIsSelected(childInterface)) {
  6838. } else {
  6839. try {
  6840. drawHoverBox(childX, childY, childInterface.tooltipBoxText);
  6841. } catch (Exception e) {
  6842.  
  6843. }
  6844. }
  6845. } else if (childInterface.type == 10) {
  6846. Sprite sprite;
  6847. if (interfaceIsSelected(childInterface)) {
  6848. sprite = childInterface.sprite2;
  6849. } else {
  6850. sprite = childInterface.sprite1;
  6851. }
  6852. if (sprite != null) {
  6853. sprite.drawSpriteWithOpacity(childX, childY, childInterface.opacity);
  6854. }
  6855. }
  6856. }
  6857. }
  6858. DrawingArea.setBounds(i1, j1, k1, l1);
  6859. }
  6860.  
  6861. private void drawLoadingMessages(int used, String s, String s1) {
  6862. int width = normalText.getTextWidth(used == 1 ? s : s1);
  6863. int height = s1 == null ? 25 : 38;
  6864. DrawingArea.drawPixels(height, 1, 1, 0, width + 6);
  6865. DrawingArea.drawPixels(1, 1, 1, 0xffffff, width + 6);
  6866. DrawingArea.drawPixels(height, 1, 1, 0xffffff, 1);
  6867. DrawingArea.drawPixels(1, height, 1, 0xffffff, width + 6);
  6868. DrawingArea.drawPixels(height, 1, width + 6, 0xffffff, 1);
  6869. normalText.drawText(0xffffff, s, 18, width / 2 + 5);
  6870. if (s1 != null) {
  6871. normalText.drawText(0xffffff, s1, 31, width / 2 + 5);
  6872. }
  6873. }
  6874.  
  6875. @Override
  6876. public void drawLoadingText(int i, String... s) {
  6877. resetImageProducers();
  6878. if (titleStreamLoader == null) {
  6879. super.drawLoadingText(i, s);
  6880. return;
  6881. }
  6882. if (cacheSprite != null) {
  6883. this.titleScreenIP.initDrawingArea();
  6884. final int centerX = 765 / 2, centerY = 503 / 2;
  6885. int y = centerY - 18;
  6886.  
  6887. titleScreenIP.initDrawingArea();
  6888. DrawingArea.fillPixels(centerX - 152, 304, 34, 0x8C1111, y);
  6889. DrawingArea.fillPixels(centerX - 151, 302, 32, 0, y + 1);
  6890. DrawingArea.drawPixels(30, y + 2, centerX - 150, 0x8C1111, i * 3);
  6891. DrawingArea.drawPixels(30, y + 2, (centerX - 150) + i * 3, 0, 300 - i * 3);
  6892. newBoldFont.drawCenteredString(s[0] + " - " + i + "%", centerX, (y + 22), 0xffffff, -1);
  6893. titleScreenIP.drawGraphics(0, super.graphics, 0);
  6894. }
  6895. }
  6896.  
  6897. public void drawSmoothLoading(int percent, String... loadingMessage) {
  6898.  
  6899. for (float f = lastPercent; f < percent; f = (float) (f + 0.39999999999999999D)) {
  6900. drawLoadingText((int) f + 1, loadingMessage);
  6901. }
  6902. lastPercent = percent;
  6903. for (int i = 0; i < startupMessage.length; i++) {
  6904. if (i < loadingMessage.length && loadingMessage[i] != null) {
  6905. startupMessage[i] = loadingMessage[i];
  6906. } else {
  6907. startupMessage[i] = "";
  6908. }
  6909. }
  6910. }
  6911.  
  6912. public int duelStatus;
  6913. private boolean resizing;
  6914. public final int REGULAR_WIDTH = 765, REGULAR_HEIGHT = 503, RESIZABLE_WIDTH = 800, RESIZABLE_HEIGHT = 600;
  6915. public int gameScreenDrawX = 4, gameScreenDrawY = 4;
  6916.  
  6917. public void recreateClientFrame(boolean undecorative, int width, int height, boolean resizable, int displayMode, boolean toggle) {
  6918. recreateClientFrame(undecorative, width, height, resizable);
  6919. }
  6920.  
  6921. private LoginScreen loginScreen = new LoginScreen();
  6922.  
  6923. public void drawLoginScreen(boolean flag) {
  6924.  
  6925. resetImageProducers();
  6926. titleScreenIP.initDrawingArea();
  6927.  
  6928. loginScreen.draw(this);
  6929.  
  6930. if (!resizing) {
  6931. titleScreenIP.drawGraphics(0, super.graphics, 0);
  6932. }
  6933. if (welcomeScreenRaised) {
  6934. welcomeScreenRaised = false;
  6935. }
  6936. }
  6937.  
  6938. private void drawLogo() {
  6939. resetImageProducers();
  6940. System.gc();
  6941. }
  6942.  
  6943. public void drawMenu() {
  6944. int xPos = menuOffsetX;
  6945. int yPos = menuOffsetY;
  6946. int menuW = menuWidth;
  6947. int x = super.mouseX;
  6948. int y = super.mouseY;
  6949. int menuH = menuHeight + 1;
  6950. if (menuScreenArea == 1 && GameFrame.getScreenMode() != ScreenMode.FIXED) {
  6951. xPos += 519;// +extraWidth;
  6952. yPos += 168;// +extraHeight;
  6953. }
  6954. if (menuScreenArea == 2 && GameFrame.getScreenMode() != ScreenMode.FIXED) {
  6955. yPos += 338;
  6956. }
  6957. if (menuScreenArea == 3 && GameFrame.getScreenMode() != ScreenMode.FIXED) {
  6958. xPos += 515;
  6959. yPos += 0;
  6960. }
  6961. if (menuScreenArea == 0) {
  6962. x -= 4;
  6963. y -= 4;
  6964. }
  6965. if (menuScreenArea == 1) {
  6966. if (!(GameFrame.getScreenMode() != ScreenMode.FIXED)) {
  6967. x -= 519;
  6968. y -= 168;
  6969. }
  6970. }
  6971. if (menuScreenArea == 2) {
  6972. if (!(GameFrame.getScreenMode() != ScreenMode.FIXED)) {
  6973. x -= 17;
  6974. y -= 338;
  6975. }
  6976. }
  6977. if (menuScreenArea == 3 && !(GameFrame.getScreenMode() != ScreenMode.FIXED)) {
  6978. x -= 515;
  6979. y -= 0;
  6980. }
  6981. DrawingArea.drawPixels(menuH - 4, yPos + 2, xPos, 0x706a5e, menuW);
  6982. DrawingArea.drawPixels(menuH - 2, yPos + 1, xPos + 1, 0x706a5e, menuW - 2);
  6983. DrawingArea.drawPixels(menuH, yPos, xPos + 2, 0x706a5e, menuW - 4);
  6984. DrawingArea.drawPixels(menuH - 2, yPos + 1, xPos + 3, 0x2d2822, menuW - 6);
  6985. DrawingArea.drawPixels(menuH - 4, yPos + 2, xPos + 2, 0x2d2822, menuW - 4);
  6986. DrawingArea.drawPixels(menuH - 6, yPos + 3, xPos + 1, 0x2d2822, menuW - 2);
  6987. DrawingArea.drawPixels(menuH - 22, yPos + 19, xPos + 2, 0x524a3d, menuW - 4);
  6988. DrawingArea.drawPixels(menuH - 22, yPos + 20, xPos + 3, 0x524a3d, menuW - 6);
  6989. DrawingArea.drawPixels(menuH - 23, yPos + 20, xPos + 3, 0x2b271c, menuW - 6);
  6990. DrawingArea.fillPixels(xPos + 3, menuW - 6, 1, 0x2a291b, yPos + 2);
  6991. DrawingArea.fillPixels(xPos + 2, menuW - 4, 1, 0x2a261b, yPos + 3);
  6992. DrawingArea.fillPixels(xPos + 2, menuW - 4, 1, 0x252116, yPos + 4);
  6993. DrawingArea.fillPixels(xPos + 2, menuW - 4, 1, 0x211e15, yPos + 5);
  6994. DrawingArea.fillPixels(xPos + 2, menuW - 4, 1, 0x1e1b12, yPos + 6);
  6995. DrawingArea.fillPixels(xPos + 2, menuW - 4, 1, 0x1a170e, yPos + 7);
  6996. DrawingArea.fillPixels(xPos + 2, menuW - 4, 2, 0x15120b, yPos + 8);
  6997. DrawingArea.fillPixels(xPos + 2, menuW - 4, 1, 0x100d08, yPos + 10);
  6998. DrawingArea.fillPixels(xPos + 2, menuW - 4, 1, 0x090a04, yPos + 11);
  6999. DrawingArea.fillPixels(xPos + 2, menuW - 4, 1, 0x080703, yPos + 12);
  7000. DrawingArea.fillPixels(xPos + 2, menuW - 4, 1, 0x090a04, yPos + 13);
  7001. DrawingArea.fillPixels(xPos + 2, menuW - 4, 1, 0x070802, yPos + 14);
  7002. DrawingArea.fillPixels(xPos + 2, menuW - 4, 1, 0x090a04, yPos + 15);
  7003. DrawingArea.fillPixels(xPos + 2, menuW - 4, 1, 0x070802, yPos + 16);
  7004. DrawingArea.fillPixels(xPos + 2, menuW - 4, 1, 0x090a04, yPos + 17);
  7005. DrawingArea.fillPixels(xPos + 2, menuW - 4, 1, 0x2a291b, yPos + 18);
  7006. DrawingArea.fillPixels(xPos + 3, menuW - 6, 1, 0x564943, yPos + 19);
  7007. newBoldFont.drawBasicString("Choose Option", xPos + 3, yPos + 14, 0xc6b895, 0);
  7008. int beforeX = xPos;
  7009. for (int index = 0; index < menuActionRow; index++) {
  7010. int yOffset = yPos + 31 + (menuActionRow - 1 - index) * 15;
  7011. int color = 0xffffff;
  7012. if (x > xPos && x < xPos + menuW && y > yOffset - 11 && y < yOffset + 5) {
  7013. DrawingArea.drawPixels(15, yOffset - 11, xPos + 3, 0x6f695d, menuWidth - 6);
  7014. color = 0xffff00;
  7015. }
  7016. xPos += 3;
  7017. newBoldFont.drawBasicString(menuActionName[index], xPos, yOffset, color, 0);
  7018. xPos = beforeX;
  7019. }
  7020. }
  7021.  
  7022. private void drawMinimap() {
  7023. getMapArea().setxPos(GameFrame.getScreenMode() == ScreenMode.FIXED ? 519 : getScreenWidth() - 170);
  7024. getMapArea().setyPos(GameFrame.getScreenMode() == ScreenMode.FIXED ? 0 : 1);
  7025. getMapArea().render(this);
  7026. }
  7027.  
  7028. public void drawMinimapFlag(Sprite sprite, int j, int k) {
  7029. int l = k * k + j * j;
  7030. if (l > 4225 && l < 0x15f90) {
  7031. int i1 = viewRotation + minimapRotation & 0x7ff;
  7032. int j1 = Model.modelIntArray1[i1];
  7033. int k1 = Model.modelIntArray2[i1];
  7034. j1 = j1 * 256 / (minimapZoom + 256);
  7035. k1 = k1 * 256 / (minimapZoom + 256);
  7036. int l1 = j * j1 + k * k1 >> 16;
  7037. int i2 = j * k1 - k * j1 >> 16;
  7038. double d = Math.atan2(l1, i2);
  7039. int j2 = (int) (Math.sin(d) * 63D);
  7040. int k2 = (int) (Math.cos(d) * 57D);
  7041. mapEdge.method353(83 - k2 - 20, d, 94 + j2 + 4 - 10);
  7042. } else {
  7043. markMinimap(sprite, k, j);
  7044. }
  7045. }
  7046.  
  7047. public void drawScrollbar(int barHeight, int scrollPos, int yPos, int xPos, int contentHeight, boolean newScroller, boolean isTransparent) {
  7048. int backingAmount = (barHeight - 32) / 5;
  7049. int scrollPartHeight = (barHeight - 32) * barHeight / contentHeight;
  7050. int scrollerID;
  7051. if (newScroller) {
  7052. scrollerID = 4;
  7053. } else if (isTransparent) {
  7054. scrollerID = 8;
  7055. } else {
  7056. scrollerID = 0;
  7057. }
  7058. if (scrollPartHeight < 10) {
  7059. scrollPartHeight = 10;
  7060. }
  7061. int scrollPartAmount = scrollPartHeight / 5 - 2;
  7062. int scrollPartPos = (barHeight - 32 - scrollPartHeight) * scrollPos / (contentHeight - barHeight) + 16 + yPos;
  7063. /* Bar fill */
  7064. for (int i = 0, yyPos = yPos + 16; i <= backingAmount; i++, yyPos += 5) {
  7065. scrollPart[scrollerID + 1].drawSprite(xPos, yyPos);
  7066. }
  7067. /* Top of bar */
  7068. scrollPart[scrollerID + 2].drawSprite(xPos, scrollPartPos);
  7069. scrollPartPos += 5;
  7070. /* Middle of bar */
  7071. for (int i = 0; i <= scrollPartAmount; i++) {
  7072. scrollPart[scrollerID + 3].drawSprite(xPos, scrollPartPos);
  7073. scrollPartPos += 5;
  7074. }
  7075. scrollPartPos = (barHeight - 32 - scrollPartHeight) * scrollPos / (contentHeight - barHeight) + 16 + yPos + scrollPartHeight - 5;
  7076. /* Bottom of bar */
  7077. scrollPart[scrollerID].drawSprite(xPos, scrollPartPos);
  7078. /* Arrows */
  7079. if (newScroller) {
  7080. scrollBar[2].drawSprite(xPos, yPos);
  7081. scrollBar[3].drawSprite(xPos, yPos + barHeight - 16);
  7082. } else if (isTransparent) {
  7083. scrollBar[4].drawSprite(xPos, yPos);
  7084. scrollBar[5].drawSprite(xPos, yPos + barHeight - 16);
  7085. } else {
  7086. scrollBar[0].drawSprite(xPos, yPos);
  7087. scrollBar[1].drawSprite(xPos, yPos + barHeight - 16);
  7088. }
  7089. }
  7090.  
  7091. private void drawSplitPrivateChat() {
  7092. if (splitPrivateChat == 0) {
  7093. return;
  7094. }
  7095. TextDrawingArea textDrawingArea = normalText;
  7096. int messages = 0;
  7097. if (systemUpdateTimer != 0) {
  7098. messages = 1;
  7099. }
  7100. for (int index = 0; index < 100; index++) {
  7101. if (chatMessages[index] != null) {
  7102. int type = chatTypes[index];
  7103. String name = chatNames[index];
  7104. String prefixName = name;
  7105. int rights = 0;
  7106. if (name != null) {
  7107. if (name.indexOf("@") == 0) {
  7108. name = name.substring(5);
  7109. }
  7110. }
  7111.  
  7112. int paddingY = GameFrame.getScreenMode() == ScreenMode.FIXED ? 0 : getScreenHeight() - 500;
  7113.  
  7114. if ((type == 3 || type == 7) && (type == 7 || privateChatMode == 0 || privateChatMode == 1 && isFriendOrSelf(name))) {
  7115. int yOffset = 329 + paddingY - messages * 13;
  7116. int xOffset = 4;
  7117. textDrawingArea.method385(0, "From", yOffset, xOffset);
  7118. textDrawingArea.method385(ChatArea.SPLIT_CHAT_COLORS[splitChatColor], "From", yOffset - 1, xOffset);
  7119. xOffset += textDrawingArea.getTextWidth("From ");
  7120.  
  7121. if (prefixName != null && prefixName.indexOf("@") == 0) {
  7122. rights = getPrefixRights(prefixName.substring(0, prefixName.indexOf(name)));
  7123. }
  7124.  
  7125. if (rights != 0) {
  7126. modIcons[rights - 1].drawTransparentSprite(xOffset, yOffset - 12, 255);
  7127. xOffset += modIcons[rights - 1].maxWidth + 2;
  7128. }
  7129.  
  7130. textDrawingArea.method385(0, name + ": " + chatMessages[index], yOffset, xOffset);
  7131. textDrawingArea.method385(ChatArea.SPLIT_CHAT_COLORS[splitChatColor], name + ": " + chatMessages[index], yOffset - 1, xOffset);
  7132.  
  7133. if (++messages >= 5) {
  7134. return;
  7135. }
  7136. }
  7137.  
  7138. if (type == 5 && privateChatMode < 2) {
  7139. int yOffset = 329 + paddingY - messages * 13;
  7140. textDrawingArea.method385(0, chatMessages[index], yOffset, 4);
  7141. textDrawingArea.method385(ChatArea.SPLIT_CHAT_COLORS[splitChatColor], chatMessages[index], yOffset - 1, 4);
  7142.  
  7143. if (++messages >= 5) {
  7144. return;
  7145. }
  7146. }
  7147.  
  7148. if (type == 6 && privateChatMode < 2) {
  7149. int yOffset = 329 + paddingY - messages * 13;
  7150. int xOffset = 4;
  7151. textDrawingArea.method385(0, "To", yOffset, xOffset);
  7152. textDrawingArea.method385(ChatArea.SPLIT_CHAT_COLORS[splitChatColor], "To", yOffset - 1, xOffset);
  7153. xOffset += textDrawingArea.getTextWidth("To ");
  7154.  
  7155. if (rights != 0) {
  7156. modIcons[rights - 1].drawTransparentSprite(xOffset, yOffset - 12, 255);
  7157. xOffset += 12;
  7158. }
  7159.  
  7160. textDrawingArea.method385(0, name + ": " + chatMessages[index], yOffset, xOffset);
  7161. textDrawingArea.method385(ChatArea.SPLIT_CHAT_COLORS[splitChatColor], name + ": " + chatMessages[index], yOffset - 1, xOffset);
  7162.  
  7163. if (++messages >= 5) {
  7164. return;
  7165. }
  7166. }
  7167. }
  7168. }
  7169. }
  7170.  
  7171. public void updateBankInterface() {
  7172. int tabAmount = settings[2000] & 0xFF;
  7173. int activeTab = settings[2000] >> 8 & 0xFF;
  7174. Sprite activeTabSprite = cacheSprite[617];
  7175. Sprite tabSprite = cacheSprite[613];
  7176. Sprite newTabSprite = cacheSprite[614];
  7177. Sprite emptySprite = new Sprite(0, 0);
  7178. for (int i = 0; i < 9; i++) {
  7179. if (i < tabAmount) {
  7180. RSInterface.interfaceCache[41018 + i].sprite1 = tabSprite;
  7181. RSInterface.interfaceCache[41018 + i].tooltip = "Click here to select tab " + (i + 1);
  7182. } else {
  7183. RSInterface.interfaceCache[41018 + i].sprite1 = emptySprite;
  7184. RSInterface.interfaceCache[41018 + i].tooltip = "";
  7185. }
  7186. RSInterface.interfaceCache[41027 + i].inv[0] = -1;
  7187. RSInterface.interfaceCache[41027 + i].invStackSizes[0] = 0;
  7188. }
  7189. if (tabAmount < 9) {
  7190. RSInterface.interfaceCache[41018 + tabAmount].sprite1 = newTabSprite;
  7191. RSInterface.interfaceCache[41018 + tabAmount].tooltip = "Drag an item here to create a new tab";
  7192. }
  7193. RSInterface.interfaceCache[41018 + activeTab].sprite1 = activeTabSprite;
  7194.  
  7195. }
  7196.  
  7197. public void processBankInterface() {
  7198. boolean fixed = GameFrame.getScreenMode() == ScreenMode.FIXED;
  7199. int offsetX = fixed ? 0 : (getScreenWidth() - 765) / 2;
  7200. int offsetY = fixed ? 0 : (getScreenHeight() - 503) / 2;
  7201. int[] offsets = { 74, 121, 168, 215, 262, 309, 356, 403, 450 };
  7202. if (anInt1084 == 5382 && super.mouseY >= 40 + offsetY && super.mouseY <= 77 + offsetY) {
  7203. for (int i = 0; i < offsets.length; i++) {
  7204. if (super.mouseX < offsets[i] + offsetX) {
  7205. getOut().putOpcode(209);
  7206. getOut().method433(5383);
  7207. getOut().method424(0);
  7208. getOut().method433(anInt1085);
  7209. getOut().method431(i);
  7210. break;
  7211. }
  7212. }
  7213. }
  7214. }
  7215.  
  7216. private void drawTabArea() {
  7217. tabArea.setxPos(GameFrame.getScreenMode() == ScreenMode.FIXED ? 516 : getScreenWidth() - tabArea.getWidth() + 12);
  7218. tabArea.setyPos(GameFrame.getScreenMode() == ScreenMode.FIXED ? 168 : getScreenHeight() - tabArea.getHeight() + 2);
  7219. tabArea.render(this);
  7220. }
  7221.  
  7222. private int cursor;
  7223.  
  7224. private void drawTooltip() {
  7225. if (!config.getStatus(ConfigType.NEW_CURSORS)) {
  7226. if (cursor != -1) {
  7227. super.getGameComponent().setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
  7228. cursor = -1;
  7229. }
  7230. } else {
  7231. if (jFrame != null) {
  7232. int newCursor = getCursorID() + 648;
  7233. if (cursor != newCursor) {
  7234. if (SpriteLoader.cache != null) {
  7235. jFrame.setCursor(SpriteLoader.cache[newCursor].spriteData);
  7236. } else {
  7237. jFrame.setCursor(newCursor);
  7238. }
  7239. cursor = newCursor;
  7240. }
  7241. }
  7242. }
  7243. if (menuActionRow < 2 && itemSelected == 0 && spellSelected == 0) {
  7244. return;
  7245. }
  7246. String tooltip;
  7247. if (itemSelected == 1 && menuActionRow < 2) {
  7248. tooltip = "Use " + selectedItemName + " with...";
  7249. } else if (spellSelected == 1 && menuActionRow < 2) {
  7250. tooltip = spellTooltip + "...";
  7251. } else {
  7252. tooltip = menuActionName[menuActionRow - 1];
  7253. }
  7254. if (menuActionRow > 2) {
  7255. tooltip = tooltip + "@whi@ / " + (menuActionRow - 2) + " more options";
  7256. }
  7257. newBoldFont.drawBasicString(tooltip, 4, 15, 0xFFFFFF, 0);
  7258. // chatTextDrawingArea.method390(4, 0xffffff, tooltip, loopCycle / 1000,
  7259. // 15);
  7260. }
  7261.  
  7262. private void dropClient() {
  7263. if (idleStatus > 0) {
  7264. resetLogout();
  7265. return;
  7266. }
  7267.  
  7268. if (gameScreenIP != null) {
  7269. gameScreenIP.initDrawingArea();
  7270. }
  7271. DrawingArea.fillPixels(2, 229, 39, 0xffffff, 2); // white box around
  7272. DrawingArea.drawPixels(37, 3, 3, 0, 227); // black fill
  7273. normalText.drawText(0, "Connection lost.", 19, 120);
  7274. normalText.drawText(0xffffff, "Connection lost.", 18, 119);
  7275. normalText.drawText(0, "Please wait - attempting to reestablish.", 34, 117);
  7276. normalText.drawText(0xffffff, "Please wait - attempting to reestablish.", 34, 116);
  7277. if (!resizing && gameScreenIP != null) {
  7278. gameScreenIP.drawGraphics(gameScreenDrawY, super.graphics, gameScreenDrawX);
  7279. }
  7280. anInt1021 = 0;
  7281. destX = 0;
  7282. Connection rsSocket = getConnection();
  7283. loggedIn = false;
  7284. setLoginFailures(0);
  7285. login(getPassword(), true, getMyUsername());
  7286.  
  7287. if (!loggedIn) {
  7288. resetLogout();
  7289. }
  7290.  
  7291. try {
  7292. rsSocket.close();
  7293. } catch (Exception _ex) {
  7294. }
  7295. }
  7296.  
  7297. private int extractInterfaceValues(RSInterface class9, int j) {
  7298. if (class9.valueIndexArray == null || j >= class9.valueIndexArray.length) {
  7299. return -2;
  7300. }
  7301.  
  7302. try {
  7303. int[] ai = class9.valueIndexArray[j];
  7304. int k = 0;
  7305. int l = 0;
  7306. int i1 = 0;
  7307.  
  7308. do {
  7309. int j1 = ai[l++];
  7310. int k1 = 0;
  7311. byte byte0 = 0;
  7312. if (j1 == 0) {
  7313. return k;
  7314. }
  7315. if (j1 == 1) {
  7316. k1 = currentStats[ai[l++]];
  7317. }
  7318. if (j1 == 2) {
  7319. k1 = maxStats[ai[l++]];
  7320. }
  7321. if (j1 == 3) {
  7322. k1 = currentExp[ai[l++]];
  7323. }
  7324. if (j1 == 4) {
  7325. RSInterface class9_1 = RSInterface.interfaceCache[ai[l++]];
  7326. int k2 = ai[l++];
  7327. if (k2 >= 0 && k2 < ItemDefinition.totalItems && (!ItemDefinition.get(k2).membersObject || isMembers)) {
  7328. for (int j3 = 0; j3 < class9_1.inv.length; j3++) {
  7329. if (class9_1.inv[j3] == k2 + 1) {
  7330. k1 += class9_1.invStackSizes[j3];
  7331. }
  7332. }
  7333.  
  7334. }
  7335. }
  7336. if (j1 == 5) {
  7337. k1 = variousSettings[ai[l++]];
  7338. }
  7339. if (j1 == 6) {
  7340. k1 = anIntArray1019[maxStats[ai[l++]] - 1];
  7341. }
  7342. if (j1 == 7) {
  7343. k1 = variousSettings[ai[l++]] * 100 / 46875;
  7344. }
  7345. if (j1 == 8) {
  7346. k1 = myPlayer.combatLevel;
  7347. }
  7348. if (j1 == 9) {
  7349. for (int l1 = 0; l1 < Skills.SKILL_COUNT; l1++) {
  7350. if (Skills.SKILL_ENABLED[l1]) {
  7351. k1 += maxStats[l1];
  7352. }
  7353. }
  7354.  
  7355. }
  7356. if (j1 == 10) {
  7357. RSInterface class9_2 = RSInterface.interfaceCache[ai[l++]];
  7358. int l2 = ai[l++] + 1;
  7359. if (l2 >= 0 && l2 < ItemDefinition.totalItems && (!ItemDefinition.get(l2).membersObject || isMembers)) {
  7360. for (int element : class9_2.inv) {
  7361. if (element != l2) {
  7362. continue;
  7363. }
  7364. k1 = 0x3b9ac9ff;
  7365. break;
  7366. }
  7367.  
  7368. }
  7369. }
  7370. if (j1 == 11) {
  7371. k1 = energy;
  7372. }
  7373. if (j1 == 12) {
  7374. k1 = weight;
  7375. }
  7376. if (j1 == 13) {
  7377. int i2 = variousSettings[ai[l++]];
  7378. int i3 = ai[l++];
  7379. k1 = (i2 & 1 << i3) == 0 ? 0 : 1;
  7380. }
  7381. if (j1 == 14) {
  7382. int j2 = ai[l++];
  7383. VarBit varBit = VarBit.cache[j2];
  7384. int l3 = varBit.configId;
  7385. int i4 = varBit.configValue;
  7386. int j4 = varBit.anInt650;
  7387. int k4 = anIntArray1232[j4 - i4];
  7388. k1 = variousSettings[l3] >> i4 & k4;
  7389. }
  7390. if (j1 == 15) {
  7391. byte0 = 1;
  7392. }
  7393. if (j1 == 16) {
  7394. byte0 = 2;
  7395. }
  7396. if (j1 == 17) {
  7397. byte0 = 3;
  7398. }
  7399. if (j1 == 18) {
  7400. k1 = (myPlayer.x >> 7) + baseX;
  7401. }
  7402. if (j1 == 19) {
  7403. k1 = (myPlayer.y >> 7) + baseY;
  7404. }
  7405. if (j1 == 20) {
  7406. k1 = ai[l++];
  7407. }
  7408. if (byte0 == 0) {
  7409. if (i1 == 0) {
  7410. k += k1;
  7411. }
  7412. if (i1 == 1) {
  7413. k -= k1;
  7414. }
  7415. if (i1 == 2 && k1 != 0) {
  7416. k /= k1;
  7417. }
  7418. if (i1 == 3) {
  7419. k *= k1;
  7420. }
  7421. i1 = 0;
  7422. } else {
  7423. i1 = byte0;
  7424. }
  7425. } while (true);
  7426. } catch (Exception _ex) {
  7427. return -1;
  7428. }
  7429. }
  7430.  
  7431. public void generateWorld(int x, int y) {
  7432. terrainRegionX = x;
  7433. terrainRegionY = y;
  7434. aBoolean1159 = false;
  7435. if (anInt1069 == x && anInt1070 == y && loadingStage == 2) {
  7436. return;
  7437. }
  7438. anInt1069 = x;
  7439. anInt1070 = y;
  7440. baseX = (anInt1069 - 6) * 8;
  7441. baseY = (anInt1070 - 6) * 8;
  7442. aBoolean1141 = (anInt1069 / 8 == 48 || anInt1069 / 8 == 49) && anInt1070 / 8 == 48;
  7443. if (anInt1069 / 8 == 48 && anInt1070 / 8 == 148) {
  7444. aBoolean1141 = true;
  7445. }
  7446. loadingStage = 1;
  7447. aLong824 = System.currentTimeMillis();
  7448. int k16 = 0;
  7449. for (int i21 = (anInt1069 - 6) / 8; i21 <= (anInt1069 + 6) / 8; i21++) {
  7450. for (int k23 = (anInt1070 - 6) / 8; k23 <= (anInt1070 + 6) / 8; k23++) {
  7451. k16++;
  7452. }
  7453. }
  7454. aByteArrayArray1183 = new byte[k16][];
  7455. aByteArrayArray1247 = new byte[k16][];
  7456. anIntArray1234 = new int[k16];
  7457. floorMap = new int[k16];
  7458. objectMap = new int[k16];
  7459. k16 = 0;
  7460. for (int l23 = (anInt1069 - 6) / 8; l23 <= (anInt1069 + 6) / 8; l23++) {
  7461. for (int j26 = (anInt1070 - 6) / 8; j26 <= (anInt1070 + 6) / 8; j26++) {
  7462. anIntArray1234[k16] = (l23 << 8) + j26;
  7463. if (aBoolean1141 && (j26 == 49 || j26 == 149 || j26 == 147 || l23 == 50 || l23 == 49 && j26 == 47)) {
  7464. floorMap[k16] = -1;
  7465. objectMap[k16] = -1;
  7466. k16++;
  7467. } else {
  7468. int k28 = floorMap[k16] = onDemandFetcher.getMapCount(0, j26, l23);
  7469. if (k28 != -1) {
  7470. onDemandFetcher.requestFileData(3, k28);
  7471. }
  7472. int j30 = objectMap[k16] = onDemandFetcher.getMapCount(1, j26, l23);
  7473. if (j30 != -1) {
  7474. onDemandFetcher.requestFileData(3, j30);
  7475. }
  7476. k16++;
  7477. }
  7478. }
  7479. }
  7480. int i17 = baseX - anInt1036;
  7481. int j21 = baseY - anInt1037;
  7482. anInt1036 = baseX;
  7483. anInt1037 = baseY;
  7484. for (int j24 = 0; j24 < 16384; j24++) {
  7485. NPC npc = npcArray[j24];
  7486. if (npc != null) {
  7487. for (int j29 = 0; j29 < 10; j29++) {
  7488. npc.smallX[j29] -= i17;
  7489. npc.smallY[j29] -= j21;
  7490. }
  7491. npc.x -= i17 * 128;
  7492. npc.y -= j21 * 128;
  7493. }
  7494. }
  7495. for (int i27 = 0; i27 < getMaxPlayers(); i27++) {
  7496. Player player = playerArray[i27];
  7497. if (player != null) {
  7498. for (int i31 = 0; i31 < 10; i31++) {
  7499. player.smallX[i31] -= i17;
  7500. player.smallY[i31] -= j21;
  7501. }
  7502. player.x -= i17 * 128;
  7503. player.y -= j21 * 128;
  7504. }
  7505. }
  7506. aBoolean1080 = true;
  7507. byte byte1 = 0;
  7508. byte byte2 = 104;
  7509. byte byte3 = 1;
  7510. if (i17 < 0) {
  7511. byte1 = 103;
  7512. byte2 = -1;
  7513. byte3 = -1;
  7514. }
  7515. byte byte4 = 0;
  7516. byte byte5 = 104;
  7517. byte byte6 = 1;
  7518. if (j21 < 0) {
  7519. byte4 = 103;
  7520. byte5 = -1;
  7521. byte6 = -1;
  7522. }
  7523. for (int k33 = byte1; k33 != byte2; k33 += byte3) {
  7524. for (int l33 = byte4; l33 != byte5; l33 += byte6) {
  7525. int i34 = k33 + i17;
  7526. int j34 = l33 + j21;
  7527. for (int k34 = 0; k34 < 4; k34++) {
  7528. if (i34 >= 0 && j34 >= 0 && i34 < 104 && j34 < 104) {
  7529. groundArray[k34][k33][l33] = groundArray[k34][i34][j34];
  7530. } else {
  7531. groundArray[k34][k33][l33] = null;
  7532. }
  7533. }
  7534. }
  7535. }
  7536. for (GameObject gameObject = (GameObject) getaClass19_1179().reverseGetFirst(); gameObject != null; gameObject = (GameObject) getaClass19_1179().reverseGetNext()) {
  7537. gameObject.anInt1297 -= i17;
  7538. gameObject.anInt1298 -= j21;
  7539. if (gameObject.anInt1297 < 0 || gameObject.anInt1298 < 0 || gameObject.anInt1297 >= 104 || gameObject.anInt1298 >= 104) {
  7540. gameObject.unlink();
  7541. }
  7542. }
  7543. if (destX != 0) {
  7544. destX -= i17;
  7545. destY -= j21;
  7546. }
  7547. cameraViewChanged = false;
  7548. }
  7549.  
  7550. @Override
  7551. public AppletContext getAppletContext() {
  7552. if (Signlink.mainapp != null) {
  7553. return Signlink.mainapp.getAppletContext();
  7554. } else {
  7555. return super.getAppletContext();
  7556. }
  7557. }
  7558.  
  7559. private Archive getArchive(int index, String fileName, String cacheArchive, int crc, int loadingBarValue) {
  7560. byte[] buffer = null;
  7561. int timeToWait = 5;
  7562.  
  7563. try {
  7564. if (decompressors[0] != null) {
  7565. buffer = decompressors[0].decompress(index);
  7566. }
  7567. } catch (Exception _ex) {
  7568. _ex.printStackTrace();
  7569. }
  7570.  
  7571. if (buffer != null) {
  7572. if (Constants.JAGCACHED_ENABLED) {
  7573. crc32Instance.reset();
  7574. crc32Instance.update(buffer);
  7575. int crcValue = (int) crc32Instance.getValue();
  7576.  
  7577. if (crcValue != crc) {
  7578. buffer = null;
  7579. }
  7580. }
  7581. }
  7582.  
  7583. if (buffer != null) {
  7584. Archive streamLoader = new Archive(buffer);
  7585. return streamLoader;
  7586. }
  7587.  
  7588. int errorCount = 0;
  7589.  
  7590. while (buffer == null) {
  7591. String error = "Unknown error";
  7592. drawSmoothLoading(loadingBarValue, "Requesting " + fileName);
  7593.  
  7594. try {
  7595. int lastPercentage = 0;
  7596. DataInputStream datainputstream = openJagGrabInputStream(cacheArchive + crc);
  7597. byte temp[] = new byte[6];
  7598. datainputstream.readFully(temp, 0, 6);
  7599. ByteBuffer stream = new ByteBuffer(temp);
  7600. stream.position = 3;
  7601. int totalLength = stream.getTribyte() + 6;
  7602. int currentLength = 6;
  7603. buffer = new byte[totalLength];
  7604. System.arraycopy(temp, 0, buffer, 0, 6);
  7605.  
  7606. while (currentLength < totalLength) {
  7607. int remainingAmount = totalLength - currentLength;
  7608.  
  7609. if (remainingAmount > 1000) {
  7610. remainingAmount = 1000;
  7611. }
  7612.  
  7613. int remaining = datainputstream.read(buffer, currentLength, remainingAmount);
  7614.  
  7615. if (remaining < 0) {
  7616. error = "Length error: " + currentLength + "/" + totalLength;
  7617. throw new IOException("EOF");
  7618. }
  7619.  
  7620. currentLength += remaining;
  7621. int percentage = currentLength * 100 / totalLength;
  7622.  
  7623. if (percentage != lastPercentage) {
  7624. drawSmoothLoading(loadingBarValue, "Loading " + fileName + " - " + percentage + "%");
  7625. }
  7626.  
  7627. lastPercentage = percentage;
  7628. }
  7629.  
  7630. datainputstream.close();
  7631.  
  7632. try {
  7633. if (decompressors[0] != null) {
  7634. decompressors[0].method234(buffer.length, buffer, index);
  7635. }
  7636. } catch (Exception _ex) {
  7637. _ex.printStackTrace();
  7638. decompressors[0] = null;
  7639. }
  7640.  
  7641. if (buffer != null) {
  7642. if (Constants.JAGCACHED_ENABLED) {
  7643. crc32Instance.reset();
  7644. crc32Instance.update(buffer);
  7645. int currentCrc = (int) crc32Instance.getValue();
  7646.  
  7647. if (currentCrc != crc) {
  7648. buffer = null;
  7649. errorCount++;
  7650. error = "Checksum error: " + currentCrc;
  7651. }
  7652. }
  7653. }
  7654. } catch (IOException ioexception) {
  7655. if (error.equals("Unknown error")) {
  7656. error = "Connection error";
  7657. }
  7658.  
  7659. ioexception.printStackTrace();
  7660. buffer = null;
  7661. } catch (NullPointerException _ex) {
  7662. error = "Null error";
  7663. buffer = null;
  7664.  
  7665. _ex.printStackTrace();
  7666. if (!Signlink.reporterror) {
  7667. return null;
  7668. }
  7669. } catch (ArrayIndexOutOfBoundsException _ex) {
  7670. error = "Bounds error";
  7671. buffer = null;
  7672.  
  7673. _ex.printStackTrace();
  7674. if (!Signlink.reporterror) {
  7675. return null;
  7676. }
  7677. } catch (Exception _ex) {
  7678. error = "Unexpected error";
  7679. buffer = null;
  7680.  
  7681. _ex.printStackTrace();
  7682. if (!Signlink.reporterror) {
  7683. return null;
  7684. }
  7685. }
  7686. if (buffer == null) {
  7687. for (int seconds = timeToWait; seconds > 0; seconds--) {
  7688. if (errorCount >= 3) {
  7689. drawSmoothLoading(loadingBarValue, "Game updated - please reload page");
  7690. seconds = 10;
  7691. } else {
  7692. throw new RuntimeException("Unable to find archive: " + name);
  7693. }
  7694.  
  7695. try {
  7696. Thread.sleep(1000L);
  7697. } catch (Exception _ex) {
  7698. _ex.printStackTrace();
  7699. }
  7700. }
  7701.  
  7702. timeToWait *= 2;
  7703.  
  7704. if (timeToWait > 60) {
  7705. timeToWait = 60;
  7706. }
  7707.  
  7708. httpFallback = !httpFallback;
  7709. }
  7710. }
  7711.  
  7712. Archive archive = new Archive(buffer);
  7713. return archive;
  7714. }
  7715.  
  7716. @Override
  7717. public URL getCodeBase() {
  7718. try {
  7719. return new URL(Constants.connectionStatus.getAddress() + ":" + (80 + portOff));
  7720. } catch (Exception _ex) {
  7721. }
  7722. return null;
  7723. }
  7724.  
  7725. public String getDocumentBaseHost() {
  7726. return Signlink.mainapp != null ? Signlink.mainapp.getDocumentBase().getHost().toLowerCase() : "";
  7727. }
  7728.  
  7729. private int getExperienceForLevel(int level) {
  7730. int points = 0;
  7731. int output = 0;
  7732.  
  7733. for (int lvl = 1; lvl <= level; lvl++) {
  7734. points += Math.floor(lvl + 300.0 * Math.pow(2.0, lvl / 7.0));
  7735.  
  7736. if (lvl >= level) {
  7737. return output;
  7738. }
  7739.  
  7740. output = (int) Math.floor(points / 4);
  7741. }
  7742.  
  7743. return 0;
  7744. }
  7745.  
  7746. @Override
  7747. public Component getGameComponent() {
  7748. if (Signlink.mainapp != null) {
  7749. return Signlink.mainapp;
  7750. }
  7751. if (super.mainFrame != null) {
  7752. return super.mainFrame;
  7753. } else {
  7754. return this;
  7755. }
  7756. }
  7757.  
  7758. @Override
  7759. public String getParameter(String s) {
  7760. if (Signlink.mainapp != null) {
  7761. return Signlink.mainapp.getParameter(s);
  7762. } else {
  7763. return super.getParameter(s);
  7764. }
  7765. }
  7766.  
  7767. public String getPrayerBook() {
  7768. return tabInterfaceIDs[5] == 5608 ? "Prayers" : "Curses";
  7769. }
  7770.  
  7771. private String getPrefix(int rights) {
  7772. String prefix = "cr";
  7773.  
  7774. if (rights >= 10) {
  7775. prefix = "c";
  7776. }
  7777.  
  7778. return "@" + prefix + rights + "@";
  7779. }
  7780.  
  7781. public byte getPrefixRights(String prefix) {
  7782. byte rights = 0;
  7783. int start = 3;
  7784. int end = 4;
  7785. if (!prefix.contains("cr")) {
  7786. start = 2;
  7787. }
  7788. try {
  7789. rights = (byte) Integer.parseInt(prefix.substring(start, end));
  7790. } catch (Exception e) {
  7791. e.printStackTrace();
  7792. }
  7793. return rights;
  7794. }
  7795.  
  7796. public void mouseWheelDragged(int i, int j) {
  7797. if (!mouseWheelDown)
  7798. return;
  7799.  
  7800. this.cameraRotationLeft += i * 3;
  7801. this.cameraRotationRight += (j << 1);
  7802. }
  7803.  
  7804. private boolean inCircle(int circleX, int circleY, int clickX, int clickY, int radius) {
  7805. return Math.pow(circleX + radius - clickX, 2) + Math.pow(circleY + radius - clickY, 2) < Math.pow(radius, 2);
  7806. }
  7807.  
  7808. @Override
  7809. public void init() {
  7810. try {
  7811. nodeID = 10;
  7812. portOff = 0;
  7813. // setHighDetail();
  7814. isMembers = true;
  7815. GameFrame.setScreenMode(ScreenMode.FIXED);
  7816. Signlink.storeid = 32;
  7817. instance = this;
  7818. Signlink.startpriv(InetAddress.getLocalHost());
  7819. initClientFrame(765, 503);
  7820. } catch (Exception exception) {
  7821. exception.printStackTrace();
  7822. return;
  7823. }
  7824. }
  7825.  
  7826. public boolean inSprite(boolean Click, Sprite sprite, int xCoord, int yCoord) {
  7827. if (Click && super.clickMode3 != 1) {
  7828. return false;
  7829. }
  7830.  
  7831. return (Click ? saveClickX : mouseX) >= xCoord && (Click ? saveClickX : mouseX) <= xCoord + sprite.myWidth && (Click ? saveClickY : mouseY) >= yCoord
  7832. && (Click ? saveClickY : mouseY) <= yCoord + sprite.myHeight;
  7833. }
  7834.  
  7835. public boolean mouseInCoords(boolean click, int x, int y, int width, int height) {
  7836. return (click ? saveClickX : mouseX) >= x && (click ? saveClickX : mouseX) <= x + width && (click ? saveClickY : mouseY) >= y && (click ? saveClickY : mouseY) <= y + height;
  7837. }
  7838.  
  7839. private String interfaceIntToString(int j) {
  7840. if (j < 0x3B9AC9FF) {
  7841. return String.valueOf(j);
  7842. } else {
  7843. return "*";
  7844. }
  7845. }
  7846.  
  7847. private boolean interfaceIsSelected(RSInterface class9) {
  7848. if (class9.valueCompareType == null) {
  7849. return false;
  7850. }
  7851.  
  7852. for (int i = 0; i < class9.valueCompareType.length; i++) {
  7853. int j = extractInterfaceValues(class9, i);
  7854. int k = class9.requiredValues[i];
  7855.  
  7856. if (class9.valueCompareType[i] == 2) {
  7857. if (j >= k) {
  7858. return false;
  7859. }
  7860. } else if (class9.valueCompareType[i] == 3) {
  7861. if (j <= k) {
  7862. return false;
  7863. }
  7864. } else if (class9.valueCompareType[i] == 4) {
  7865. if (j == k) {
  7866. return false;
  7867. }
  7868. } else if (j != k) {
  7869. return false;
  7870. }
  7871. }
  7872.  
  7873. return true;
  7874. }
  7875.  
  7876. public boolean isDebugMode() {
  7877. return debugMode;
  7878. }
  7879.  
  7880. public boolean isFriendOrSelf(String name) {
  7881. if (name == null) {
  7882. return false;
  7883. }
  7884.  
  7885. if (name.contains("@")) {
  7886. name = NAME_PATTERN.matcher(name).replaceAll("");
  7887. }
  7888.  
  7889. for (int i = 0; i < friendCount; i++) {
  7890. if (name.equalsIgnoreCase(friendsList[i])) {
  7891. return true;
  7892. }
  7893. }
  7894.  
  7895. return name.equalsIgnoreCase(myPlayer.name);
  7896. }
  7897.  
  7898. public boolean isGameFrameVisible() {
  7899. return gameFrameVisible;
  7900. }
  7901.  
  7902. public boolean isWebclient() {
  7903. return super.mainFrame == null;
  7904. }
  7905.  
  7906. void launchURL(String url) {
  7907. String osName = System.getProperty("os.name");
  7908.  
  7909. try {
  7910. if (osName.startsWith("Mac OS")) {
  7911. Class<?> fileMgr = Class.forName("com.apple.eio.FileManager");
  7912. Method openURL = fileMgr.getDeclaredMethod("openURL", new Class[] { String.class });
  7913. openURL.invoke(null, new Object[] { url });
  7914. } else if (osName.startsWith("Windows")) {
  7915. Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + url);
  7916. } else {
  7917. // assume Unix or Linux
  7918. String[] browsers = { "firefox", "opera", "konqueror", "epiphany", "mozilla", "netscape", "safari" };
  7919. String browser = null;
  7920.  
  7921. for (int count = 0; count < browsers.length && browser == null; count++) {
  7922. if (Runtime.getRuntime().exec(new String[] { "which", browsers[count] }).waitFor() == 0) {
  7923. browser = browsers[count];
  7924. }
  7925. }
  7926.  
  7927. if (browser == null) {
  7928. throw new Exception("Could not find web browser");
  7929. } else {
  7930. Runtime.getRuntime().exec(new String[] { browser, url });
  7931. }
  7932. }
  7933. } catch (Exception e) {
  7934. pushMessage("Failed to open URL.", 0, "");
  7935. }
  7936. }
  7937.  
  7938. public static boolean forceRegionLoad;
  7939.  
  7940. private void loadingStages() {
  7941. if (isLowDetail() && loadingStage == 2 && ObjectManager.anInt131 != plane) {
  7942. gameScreenIP.initDrawingArea();
  7943. drawLoadingMessages(1, "Loading - please wait.", null);
  7944. if (!resizing) {
  7945. gameScreenIP.drawGraphics(gameScreenDrawY, super.graphics, gameScreenDrawX);
  7946. }
  7947. loadingStage = 1;
  7948. aLong824 = System.currentTimeMillis();
  7949. }
  7950.  
  7951. if (loadingStage == 1) {
  7952. int j = method54();
  7953.  
  7954. if (j != 0 && System.currentTimeMillis() - aLong824 > 0x57e40L) {
  7955. Signlink.reportError(getMyUsername() + " glcfb " + getServerSeed() + "," + j + "," + isLowDetail() + "," + decompressors[0] + "," + onDemandFetcher.getRemaining() + "," + plane + ","
  7956. + anInt1069 + "," + anInt1070);
  7957. aLong824 = System.currentTimeMillis();
  7958. }
  7959. }
  7960.  
  7961. if (loadingStage == 2 && plane != getAnInt985()) {
  7962. setAnInt985(plane);
  7963. method24(plane);
  7964. }
  7965. }
  7966.  
  7967. private void loadTitleScreen() {
  7968. /*
  7969. * byte abyte0[] = titleStreamLoader.getDataForName("title.dat");
  7970. * backGround = new Sprite(abyte0, this); aBackground_966 = new
  7971. * Background(titleStreamLoader, "titlebox", 0); aBackground_967 = new
  7972. * Background(titleStreamLoader, "titlebutton", 0);
  7973. * aBackgroundArray1152s = new Background[12]; int j = 0; try { j =
  7974. * Integer.parseInt(getParameter("fl_icon")); } catch (Exception _ex) {
  7975. * } if (j == 0) { for (int k = 0; k < 12; k++) aBackgroundArray1152s[k]
  7976. * = new Background(titleStreamLoader, "runes", k);
  7977. *
  7978. * } else { for (int l = 0; l < 12; l++) aBackgroundArray1152s[l] = new
  7979. * Background(titleStreamLoader, "runes", 12 + (l & 3));
  7980. *
  7981. * } new Sprite(128, 265); new Sprite(128, 265);
  7982. *
  7983. * anIntArray851 = new int[256]; for (int k1 = 0; k1 < 64; k1++)
  7984. * anIntArray851[k1] = k1 * 0x40000;
  7985. *
  7986. * for (int l1 = 0; l1 < 64; l1++) anIntArray851[l1 + 64] = 0xff0000 +
  7987. * 1024 * l1;
  7988. *
  7989. * for (int i2 = 0; i2 < 64; i2++) anIntArray851[i2 + 128] = 0xffff00 +
  7990. * 4 * i2;
  7991. *
  7992. * for (int j2 = 0; j2 < 64; j2++) anIntArray851[j2 + 192] = 0xffffff;
  7993. *
  7994. * anIntArray852 = new int[256]; for (int k2 = 0; k2 < 64; k2++)
  7995. * anIntArray852[k2] = k2 * 1024;
  7996. *
  7997. * for (int l2 = 0; l2 < 64; l2++) anIntArray852[l2 + 64] = 65280 + 4 *
  7998. * l2;
  7999. *
  8000. * for (int i3 = 0; i3 < 64; i3++) anIntArray852[i3 + 128] = 65535 +
  8001. * 0x40000 * i3;
  8002. *
  8003. * for (int j3 = 0; j3 < 64; j3++) anIntArray852[j3 + 192] = 0xffffff;
  8004. *
  8005. * anIntArray853 = new int[256]; for (int k3 = 0; k3 < 64; k3++)
  8006. * anIntArray853[k3] = k3 * 4;
  8007. *
  8008. * for (int l3 = 0; l3 < 64; l3++) anIntArray853[l3 + 64] = 255 +
  8009. * 0x40000 * l3;
  8010. *
  8011. * for (int i4 = 0; i4 < 64; i4++) anIntArray853[i4 + 128] = 0xff00ff +
  8012. * 1024 * i4;
  8013. *
  8014. * for (int j4 = 0; j4 < 64; j4++) anIntArray853[j4 + 192] = 0xffffff;
  8015. *
  8016. * anIntArray1190 = new int[32768]; anIntArray1191 = new int[32768];
  8017. */
  8018. // randomizeBackground(null);
  8019. drawSmoothLoading(10, "Connecting to fileserver");
  8020. }
  8021.  
  8022. public void loginScreenBG(boolean b) {
  8023. xCameraPos = 6100;
  8024. yCameraPos = 6867;
  8025. zCameraPos = -750;
  8026. xCameraCurve = 2040;
  8027. yCameraCurve = 383;
  8028. resetMap1();
  8029. if (b || scriptManager == null) {
  8030. scriptManager = new ScriptManager(this);
  8031. } else {
  8032. scriptManager.update();
  8033. }
  8034. System.out.println(plane + ":" + scriptManager.mapX + ":" + scriptManager.mapY);
  8035. plane = scriptManager.mapZ;
  8036. loadMap(scriptManager.mapX, scriptManager.mapY);
  8037. resetMap2();
  8038. }
  8039.  
  8040. private void magicOnItem(int id) {
  8041. spellSelected = 1;
  8042. spellID = id;
  8043. anInt1137 = id;
  8044. spellUsableOn = 16;
  8045. itemSelected = 0;
  8046. spellTooltip = "Cast on";
  8047. tabID = 3;
  8048. tabAreaAltered = true;
  8049. }
  8050.  
  8051. private void mainGameProcessor() {
  8052. if (systemUpdateTimer > 1) {
  8053. systemUpdateTimer--;
  8054. }
  8055.  
  8056. if (idleStatus > 0) {
  8057. idleStatus--;
  8058. }
  8059.  
  8060. for (int j = 0; j < 5; j++) {
  8061. if (!parsePacket()) {
  8062. break;
  8063. }
  8064. }
  8065. if (!loggedIn) {
  8066. return;
  8067. }
  8068. synchronized (mouseDetection.locker) {
  8069. if (!flagged) {
  8070. mouseDetection.coordsIndex = 0;
  8071. }
  8072. }
  8073.  
  8074. if (anInt1016 > 0) {
  8075. anInt1016--;
  8076. }
  8077.  
  8078. if (super.keyArray[1] == 1 || super.keyArray[2] == 1 || super.keyArray[3] == 1 || super.keyArray[4] == 1) {
  8079. aBoolean1017 = true;
  8080. }
  8081.  
  8082. if (aBoolean1017 && anInt1016 <= 0) {
  8083. anInt1016 = 20;
  8084. aBoolean1017 = false;
  8085. }
  8086.  
  8087. if (super.awtFocus && !aBoolean954) {
  8088. aBoolean954 = true;
  8089. getOut().putOpcode(3);
  8090. getOut().putShortBigEndian(1);
  8091. }
  8092.  
  8093. if (!super.awtFocus && aBoolean954) {
  8094. aBoolean954 = false;
  8095. getOut().putOpcode(3);
  8096. getOut().putShortBigEndian(0);
  8097. }
  8098.  
  8099. loadingStages();
  8100. method115();
  8101. method90();
  8102. timeSinceLastPacket++;
  8103.  
  8104. if (timeSinceLastPacket > 750) {
  8105. dropClient();
  8106. }
  8107. method114();
  8108. method95();
  8109. method38();
  8110. anInt945++;
  8111.  
  8112. if (crossType != 0) {
  8113. crossIndex += 20;
  8114.  
  8115. if (crossIndex >= 400) {
  8116. crossType = 0;
  8117. }
  8118. }
  8119.  
  8120. if (atInventoryInterfaceType != 0) {
  8121. atInventoryLoopCycle++;
  8122.  
  8123. if (atInventoryLoopCycle >= 15) {
  8124. if (atInventoryInterfaceType == 3) {
  8125. setInputTaken(true);
  8126. }
  8127. atInventoryInterfaceType = 0;
  8128. }
  8129. }
  8130.  
  8131. if (activeInterfaceType != 0) {
  8132. anInt989++;
  8133.  
  8134. if (super.mouseX > anInt1087 + 5 || super.mouseX < anInt1087 - 5 || super.mouseY > anInt1088 + 5 || super.mouseY < anInt1088 - 5) {
  8135. aBoolean1242 = true;
  8136. }
  8137.  
  8138. if (super.getClickMode2() == 0) {
  8139. if (activeInterfaceType == 3) {
  8140. setInputTaken(true);
  8141. }
  8142.  
  8143. activeInterfaceType = 0;
  8144.  
  8145. if (aBoolean1242 && anInt989 >= 15) {
  8146. lastActiveInvInterface = -1;
  8147. processRightClick();
  8148. processBankInterface();
  8149.  
  8150. if (lastActiveInvInterface == anInt1084 && mouseInvInterfaceIndex == anInt1085) {
  8151. if (menuActionRow > 0) {
  8152. doAction(menuActionRow - 1);
  8153. }
  8154. }
  8155.  
  8156. if (lastActiveInvInterface == anInt1084 && mouseInvInterfaceIndex != anInt1085) {
  8157.  
  8158. RSInterface class9 = RSInterface.interfaceCache[anInt1084];
  8159. int j1 = 0;
  8160.  
  8161. if (anInt913 == 1 && class9.contentType == 206) {
  8162. j1 = 1;
  8163. }
  8164.  
  8165. if (class9.inv[mouseInvInterfaceIndex] <= 0) {
  8166. j1 = 0;
  8167. }
  8168.  
  8169. if (class9.deletesTargetSlot) {
  8170. int l2 = anInt1085;
  8171. int l3 = mouseInvInterfaceIndex;
  8172. class9.inv[l3] = class9.inv[l2];
  8173. class9.invStackSizes[l3] = class9.invStackSizes[l2];
  8174. class9.inv[l2] = -1;
  8175. class9.invStackSizes[l2] = 0;
  8176. } else if (j1 == 1) {
  8177. int i3 = anInt1085;
  8178.  
  8179. for (int i4 = mouseInvInterfaceIndex; i3 != i4;) {
  8180. if (i3 > i4) {
  8181. class9.swapInventoryItems(i3, i3 - 1);
  8182. i3--;
  8183. } else if (i3 < i4) {
  8184. class9.swapInventoryItems(i3, i3 + 1);
  8185. i3++;
  8186. }
  8187. }
  8188. } else {
  8189. class9.swapInventoryItems(anInt1085, mouseInvInterfaceIndex);
  8190. }
  8191.  
  8192. getOut().putOpcode(209);
  8193. getOut().method433(anInt1084);
  8194. getOut().method424(j1);
  8195. getOut().method433(anInt1085);
  8196. getOut().method431(mouseInvInterfaceIndex);
  8197. }
  8198. } else if ((anInt1253 == 1 || menuHasAddFriend(menuActionRow - 1)) && menuActionRow > 2) {
  8199. determineMenuSize();
  8200. } else if (menuActionRow > 0) {
  8201. doAction(menuActionRow - 1);
  8202. }
  8203.  
  8204. atInventoryLoopCycle = 10;
  8205. super.clickMode3 = 0;
  8206. }
  8207. }
  8208.  
  8209. if (WorldController.anInt470 != -1) {
  8210. int k = WorldController.anInt470;
  8211. int k1 = WorldController.anInt471;
  8212. boolean flag = doWalkTo(0, 0, 0, 0, myPlayer.smallY[0], 0, 0, k1, myPlayer.smallX[0], true, k);
  8213. WorldController.anInt470 = -1;
  8214.  
  8215. if (flag) {
  8216. crossX = super.saveClickX;
  8217. crossY = super.saveClickY;
  8218. crossType = 1;
  8219. crossIndex = 0;
  8220. }
  8221. }
  8222.  
  8223. if (super.clickMode3 == 1 && aString844 != null) {
  8224. aString844 = null;
  8225. setInputTaken(true);
  8226. super.clickMode3 = 0;
  8227. }
  8228.  
  8229. if (!processMenuClick()) {
  8230. processMainScreenClick();
  8231. tabArea.processTabClick(this, GameFrame.getScreenMode());
  8232. }
  8233.  
  8234. if (super.getClickMode2() == 1 || super.clickMode3 == 1) {
  8235. anInt1213++;
  8236. }
  8237.  
  8238. if (anInt1500 != 0 || anInt1044 != 0 || anInt1129 != 0) {
  8239. if (anInt1501 < 50 && !menuOpen) {
  8240. if (++anInt1501 == 50) {
  8241. if (anInt1500 != 0) {
  8242. inputTaken = true;
  8243. }
  8244. }
  8245. }
  8246. } else if (anInt1501 > 0) {
  8247. anInt1501--;
  8248. }
  8249.  
  8250. if (PlayerHandler.quedBalloonX > -1 && PlayerHandler.quedBalloonY > -1) {
  8251. int x = (myPlayer.x >> 7) + baseX;
  8252. int y = (myPlayer.y >> 7) + baseY;
  8253.  
  8254. if (PlayerHandler.quedBalloonX == x && PlayerHandler.quedBalloonY == y) {
  8255. getOut().putOpcode(159);
  8256. getOut().putShort(PlayerHandler.quedBalloonX);
  8257. getOut().putShort(PlayerHandler.quedBalloonY);
  8258. PlayerHandler.quedBalloonX = PlayerHandler.quedBalloonY = -1;
  8259. }
  8260. }
  8261.  
  8262. if (loadingStage == 2) {
  8263. method108();
  8264. }
  8265.  
  8266. if (loadingStage == 2 && cameraViewChanged) {
  8267. calcCameraPos();
  8268. }
  8269.  
  8270. for (int i1 = 0; i1 < 5; i1++) {
  8271. anIntArray1030[i1]++;
  8272. }
  8273.  
  8274. method73();
  8275. super.idleTime++;
  8276.  
  8277. /**
  8278. * Idle logout packet
  8279. */
  8280. if (super.idleTime > 22500) {
  8281. idleStatus = 250;
  8282. super.idleTime -= 1500;
  8283. getOut().putOpcode(202);
  8284. }
  8285.  
  8286. if (cameraOffsetX < -50) {
  8287. }
  8288.  
  8289. if (cameraOffsetX > 50) {
  8290. }
  8291.  
  8292. if (cameraOffsetY < -55) {
  8293. }
  8294.  
  8295. if (cameraOffsetY > 55) {
  8296. }
  8297.  
  8298. if (viewRotationOffset < -40) {
  8299. }
  8300.  
  8301. if (viewRotationOffset > 40) {
  8302. }
  8303.  
  8304. if (minimapRotation < -60) {
  8305. }
  8306.  
  8307. if (minimapRotation > 60) {
  8308. }
  8309.  
  8310. if (minimapZoom < -20) {
  8311. }
  8312.  
  8313. if (minimapZoom > 10) {
  8314. }
  8315.  
  8316. if (++keepAlive > 50) {
  8317. getOut().putOpcode(0);
  8318. }
  8319.  
  8320. /**
  8321. * Writes data to the out socket
  8322. */
  8323. try {
  8324. if (getConnection() != null && getOut().position > 0) {
  8325. getConnection().queueBytes(getOut().position, getOut().buffer);
  8326. getOut().position = 0;
  8327. keepAlive = 0;
  8328. }
  8329. } catch (IOException _ex) {
  8330. // _ex.printStackTrace();
  8331. dropClient();
  8332. } catch (Exception exception) {
  8333. resetLogout();
  8334. }
  8335. }
  8336.  
  8337. public void markMinimap(Sprite sprite, int x, int y) {
  8338. if (sprite == null) {
  8339. return;
  8340. }
  8341.  
  8342. boolean fixed = GameFrame.getScreenMode() == ScreenMode.FIXED;
  8343. int rotation = viewRotation + minimapRotation & 0x7ff;
  8344. int xPadding = getMapArea().getOffSetX();
  8345. int yPadding = getMapArea().getyPos();
  8346. int distance = x * x + y * y;
  8347.  
  8348. if (distance > 6400) {
  8349. return;
  8350. }
  8351.  
  8352. int spriteX = Model.modelIntArray1[rotation];
  8353. int spriteY = Model.modelIntArray2[rotation];
  8354. spriteX = spriteX * 256 / (minimapZoom + 256);
  8355. spriteY = spriteY * 256 / (minimapZoom + 256);
  8356. int drawX = y * spriteX + x * spriteY >> 16;
  8357. int drawY = y * spriteY - x * spriteX >> 16;
  8358. int finalX = (fixed ? 104 : 83) + drawX - sprite.maxWidth / 2 + 4;
  8359. int finalY = (fixed ? 89 : 85) - drawY - sprite.maxHeight / 2 - 4;
  8360.  
  8361. try {
  8362. sprite.drawSprite(finalX + xPadding, finalY + yPadding);
  8363. } catch (Exception _ex) {
  8364. }
  8365. }
  8366.  
  8367. private boolean menuHasAddFriend(int j) {
  8368. if (j < 0) {
  8369. return false;
  8370. }
  8371.  
  8372. int k = menuActionID[j];
  8373.  
  8374. if (k >= 2000) {
  8375. k -= 2000;
  8376. }
  8377.  
  8378. return k == 337;
  8379. }
  8380.  
  8381. private Entity interactingWith;
  8382.  
  8383. private void handleFacingEntity(Entity entity) {
  8384.  
  8385. if (entity.anInt1504 == 0) {
  8386. return;
  8387. }
  8388.  
  8389. /**
  8390. * Facing mob
  8391. */
  8392. if (entity.interactingEntity != -1 && entity.interactingEntity < 32768 && entity.interactingEntity < npcArray.length) {
  8393. try {
  8394. NPC npc = npcArray[entity.interactingEntity];
  8395.  
  8396. if (entity == myPlayer)
  8397. interactingWith = npc;
  8398. if (npc != null) {
  8399. int i1 = entity.x - npc.x;
  8400. int k1 = entity.y - npc.y;
  8401. if (i1 != 0 || k1 != 0) {
  8402. entity.turnDirection = (int) (Math.atan2(i1, k1) * 325.94900000000001D) & 0x7ff;
  8403. }
  8404. }
  8405. } catch (Exception ex) {
  8406. }
  8407. }
  8408.  
  8409. /**
  8410. * Handle facing a player
  8411. */
  8412. if (entity.interactingEntity >= 32768) {
  8413.  
  8414. int index = entity.interactingEntity - 32768;
  8415.  
  8416. if (index == playerIndex) {
  8417. index = myPlayerIndex;
  8418. }
  8419.  
  8420. Player player = playerArray[index];
  8421.  
  8422. if (player != null) {
  8423.  
  8424. if (entity == myPlayer && player != myPlayer)
  8425. interactingWith = player;
  8426.  
  8427. int deltaX = entity.x - player.x;
  8428. int deltaY = entity.y - player.y;
  8429. if (deltaX != 0 || deltaY != 0) {
  8430. entity.turnDirection = (int) (Math.atan2(deltaX, deltaY) * 325.94900000000001D) & 0x7ff;
  8431. }
  8432. }
  8433. }
  8434.  
  8435. /**
  8436. * Handle facing a direction
  8437. */
  8438. if ((entity.faceDirectionX != 0 || entity.faceDirectionY != 0) && (entity.smallXYIndex == 0 || entity.anInt1503 > 0)) {
  8439. int k = entity.x - (entity.faceDirectionX - baseX - baseX) * 64;
  8440. int j1 = entity.y - (entity.faceDirectionY - baseY - baseY) * 64;
  8441.  
  8442. if (k != 0 || j1 != 0) {
  8443. entity.turnDirection = (int) (Math.atan2(k, j1) * 325.94900000000001D) & 0x7ff;
  8444. }
  8445.  
  8446. entity.faceDirectionX = 0;
  8447. entity.faceDirectionY = 0;
  8448. }
  8449.  
  8450. int l = entity.turnDirection - entity.anInt1552 & 0x7ff;
  8451.  
  8452. if (l != 0) {
  8453. if (l < entity.anInt1504 || l > 2048 - entity.anInt1504) {
  8454. entity.anInt1552 = entity.turnDirection;
  8455. } else if (l > 1024) {
  8456. entity.anInt1552 -= entity.anInt1504;
  8457. } else {
  8458. entity.anInt1552 += entity.anInt1504;
  8459. }
  8460.  
  8461. entity.anInt1552 &= 0x7ff;
  8462.  
  8463. if (entity.anInt1517 == entity.anInt1511 && entity.anInt1552 != entity.turnDirection) {
  8464. if (entity.anInt1512 != -1) {
  8465. entity.anInt1517 = entity.anInt1512;
  8466. return;
  8467. }
  8468.  
  8469. entity.anInt1517 = entity.anInt1554;
  8470. }
  8471. }
  8472. }
  8473.  
  8474. private void handleEntityAnimation(Entity entity) {
  8475.  
  8476. entity.aBoolean1541 = false;
  8477.  
  8478. if (entity.anInt1517 != -1) {
  8479.  
  8480. if (entity.anInt1517 >= Animation.cache.length) {
  8481. System.out.println("Invalid Animation3: " + entity + " : " + entity.anInt1517);
  8482. entity.anInt1517 = -1;
  8483. return;
  8484. }
  8485.  
  8486. Animation animation = Animation.cache[entity.anInt1517];
  8487.  
  8488. if (animation == null) {
  8489. System.out.println("Null Animation 1517: " + entity + " : " + entity.anInt1517);
  8490. entity.anInt1517 = -1;
  8491. return;
  8492. }
  8493.  
  8494. entity.frameDelay++;
  8495.  
  8496. if (entity.anInt1518 < animation.frameCount && entity.frameDelay > animation.method258(entity.anInt1518)) {
  8497. entity.frameDelay = 1;
  8498. entity.anInt1518++;
  8499. entity.nextIdleAnimationFrame++;
  8500. }
  8501. entity.nextIdleAnimationFrame = entity.anInt1518 + 1;
  8502. if (entity.nextIdleAnimationFrame >= animation.frameCount) {
  8503. if (entity.nextIdleAnimationFrame >= animation.frameCount) {
  8504. entity.nextIdleAnimationFrame = 0;
  8505. }
  8506. }
  8507. if (entity.anInt1518 >= animation.frameCount) {
  8508. entity.frameDelay = 1;
  8509. entity.anInt1518 = 0;
  8510. }
  8511. }
  8512.  
  8513. if (entity.gfxId != -1 && loopCycle >= entity.gfxDelay) {
  8514.  
  8515. if (entity.currentAnim < 0) {
  8516. entity.currentAnim = 0;
  8517. }
  8518.  
  8519. if (entity.gfxId >= SpotAnimDefinition.cache.length) {
  8520. System.out.println("Invalid Graphic: " + entity + " : " + entity.gfxId);
  8521. entity.gfxId = -1;
  8522. return;
  8523. }
  8524.  
  8525. Animation animation_1 = SpotAnimDefinition.cache[entity.gfxId].animFrameSequence;
  8526.  
  8527. if (animation_1 == null) {
  8528. System.out.println("Null Graphic: " + entity + " : " + entity.gfxId);
  8529. entity.gfxId = -1;
  8530. return;
  8531. }
  8532.  
  8533. for (entity.anInt1522++; entity.currentAnim < animation_1.frameCount && entity.anInt1522 > animation_1.method258(entity.currentAnim); entity.currentAnim++) {
  8534. entity.anInt1522 -= animation_1.method258(entity.currentAnim);
  8535. }
  8536.  
  8537. if (entity.currentAnim >= animation_1.frameCount && (entity.currentAnim < 0 || entity.currentAnim >= animation_1.frameCount)) {
  8538. entity.gfxId = -1;
  8539. }
  8540. entity.nextGraphicsAnimationFrame = entity.currentAnim + 1;
  8541. if (entity.nextGraphicsAnimationFrame >= animation_1.frameCount) {
  8542. if (entity.nextGraphicsAnimationFrame < 0 || entity.nextGraphicsAnimationFrame >= animation_1.frameCount) {
  8543. entity.gfxId = -1;
  8544. }
  8545. }
  8546. }
  8547.  
  8548. if (entity.anim != -1 && entity.anInt1529 <= 1) {
  8549.  
  8550. if (entity.anim >= Animation.cache.length) {
  8551. System.out.println("Invalid Animation1: " + entity + " : " + entity.anim);
  8552. entity.anim = -1;
  8553. return;
  8554. }
  8555.  
  8556. Animation animation_2 = Animation.cache[entity.anim];
  8557.  
  8558. if (animation_2 == null) {
  8559. System.out.println("Null Animation_2: " + entity + " : " + entity.anim);
  8560. entity.anim = -1;
  8561. return;
  8562. }
  8563.  
  8564. if (animation_2.anInt363 == 1 && entity.anInt1542 > 0 && entity.anInt1547 <= loopCycle && entity.anInt1548 < loopCycle) {
  8565. entity.anInt1529 = 1;
  8566. return;
  8567. }
  8568. }
  8569.  
  8570. if (entity.anim != -1 && entity.anInt1529 == 0) {
  8571.  
  8572. if (entity.anim >= Animation.cache.length) {
  8573. System.out.println("Invalid Animation2: " + entity + " : " + entity.anim);
  8574. entity.anim = -1;
  8575. return;
  8576. }
  8577. Animation animation_3 = Animation.cache[entity.anim];
  8578.  
  8579. if (animation_3 == null) {
  8580. System.out.println("Null Animation_3: " + entity + " : " + entity.anim);
  8581. entity.anim = -1;
  8582. return;
  8583. }
  8584.  
  8585. for (entity.anInt1528++; entity.anInt1527 < animation_3.frameCount && entity.anInt1528 > animation_3.method258(entity.anInt1527); entity.anInt1527++) {
  8586. entity.anInt1528 -= animation_3.method258(entity.anInt1527);
  8587. }
  8588.  
  8589. if (entity.anInt1527 >= animation_3.frameCount) {
  8590. entity.anInt1527 -= animation_3.frameStep;
  8591. entity.anInt1530++;
  8592.  
  8593. if (entity.anInt1530 >= animation_3.anInt362) {
  8594. entity.anim = -1;
  8595. }
  8596.  
  8597. if (entity.anInt1527 < 0 || entity.anInt1527 >= animation_3.frameCount) {
  8598. entity.anim = -1;
  8599. }
  8600. }
  8601. entity.nextAnimationFrame = entity.anInt1527 + 1;
  8602. if (entity.nextAnimationFrame >= animation_3.frameCount) {
  8603. if (entity.anInt1530 >= animation_3.anInt362) {
  8604. entity.anim = -1;
  8605. }
  8606. if (entity.nextAnimationFrame < 0 || entity.nextAnimationFrame >= animation_3.frameCount) {
  8607. entity.anim = -1;
  8608. }
  8609. }
  8610. entity.aBoolean1541 = animation_3.aBoolean358;
  8611. }
  8612.  
  8613. if (entity.anInt1529 > 0) {
  8614. entity.anInt1529--;
  8615. }
  8616. }
  8617.  
  8618. private void method104() {
  8619. Animable_Sub3 class30_sub2_sub4_sub3 = (Animable_Sub3) getaClass19_1056().reverseGetFirst();
  8620.  
  8621. for (; class30_sub2_sub4_sub3 != null; class30_sub2_sub4_sub3 = (Animable_Sub3) getaClass19_1056().reverseGetNext()) {
  8622. if (class30_sub2_sub4_sub3.anInt1560 != plane || class30_sub2_sub4_sub3.aBoolean1567) {
  8623. class30_sub2_sub4_sub3.unlink();
  8624. } else if (loopCycle >= class30_sub2_sub4_sub3.anInt1564) {
  8625. class30_sub2_sub4_sub3.method454(anInt945);
  8626.  
  8627. if (class30_sub2_sub4_sub3.aBoolean1567) {
  8628. class30_sub2_sub4_sub3.unlink();
  8629. } else {
  8630. 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,
  8631. class30_sub2_sub4_sub3, false);
  8632. }
  8633. }
  8634. }
  8635. }
  8636.  
  8637. private void handlePlayerUpdateBlock(int bitmap, int j, ByteBuffer buffer, Player player) {
  8638.  
  8639. /**
  8640. * Forced movement
  8641. */
  8642. if ((bitmap & 0x400) != 0) {
  8643. player.anInt1543 = buffer.method428();
  8644. player.anInt1545 = buffer.method428();
  8645. player.anInt1544 = buffer.method428();
  8646. player.anInt1546 = buffer.method428();
  8647. player.anInt1547 = buffer.getShortBigEndianA() + loopCycle;
  8648. player.anInt1548 = buffer.method435() + loopCycle;
  8649. player.anInt1549 = buffer.method428();
  8650. player.method446();
  8651. }
  8652.  
  8653. /**
  8654. * Graphic mask
  8655. */
  8656. if ((bitmap & 0x100) != 0) {
  8657. player.gfxId = buffer.getShortBigEndian(); // GFX Id
  8658. int delay = buffer.getIntLittleEndian();
  8659. player.gfxHeight = delay >> 16;
  8660. player.gfxDelay = loopCycle + (delay & 0xffff);
  8661. player.currentAnim = 0;
  8662. player.anInt1522 = 0;
  8663.  
  8664. if (player.gfxDelay > loopCycle) {
  8665. player.currentAnim = -1;
  8666. }
  8667.  
  8668. if (player.gfxId == 65535) {
  8669. player.gfxId = -1;
  8670. }
  8671.  
  8672. try {
  8673. if (FrameReader.animationlist[Integer.parseInt(Integer.toHexString(SpotAnimDefinition.cache[player.gfxId].animFrameSequence.frame2IDS[0]).substring(0,
  8674. Integer.toHexString(SpotAnimDefinition.cache[player.gfxId].animFrameSequence.frame2IDS[0]).length() - 4), 16)].length == 0)
  8675. onDemandFetcher.requestFileData(1, Integer.parseInt(Integer.toHexString(SpotAnimDefinition.cache[player.gfxId].animFrameSequence.frame2IDS[0]).substring(0,
  8676. Integer.toHexString(SpotAnimDefinition.cache[player.gfxId].animFrameSequence.frame2IDS[0]).length() - 4), 16));
  8677. } catch (Exception e) {
  8678. }
  8679.  
  8680. }
  8681.  
  8682. /**
  8683. * Animation mask
  8684. */
  8685. if ((bitmap & 8) != 0) {
  8686. int animationId = buffer.getShortBigEndian();
  8687.  
  8688. if (animationId == 65535) {
  8689. animationId = -1;
  8690. }
  8691.  
  8692. int animationDelay = buffer.method427();
  8693.  
  8694. if (animationId == player.anim && animationId != -1) {
  8695. int i3 = Animation.cache[animationId].anInt365;
  8696.  
  8697. if (i3 == 1) {
  8698. player.anInt1527 = 0;
  8699. player.anInt1528 = 0;
  8700. player.anInt1529 = animationDelay;
  8701. player.anInt1530 = 0;
  8702. }
  8703.  
  8704. if (i3 == 2) {
  8705. player.anInt1530 = 0;
  8706. }
  8707. } else if (animationId == -1 || player.anim == -1 || Animation.cache[animationId].anInt359 >= Animation.cache[player.anim].anInt359) {
  8708. player.anim = animationId;
  8709. player.anInt1527 = 0;
  8710. player.anInt1528 = 0;
  8711. player.anInt1529 = animationDelay;
  8712. player.anInt1530 = 0;
  8713. player.anInt1542 = player.smallXYIndex;
  8714.  
  8715. try {
  8716. if (FrameReader.animationlist[Integer.parseInt(
  8717. Integer.toHexString(Animation.cache[animationId].frame2IDS[0]).substring(0, Integer.toHexString(Animation.cache[animationId].frame2IDS[0]).length() - 4), 16)].length == 0)
  8718. onDemandFetcher.requestFileData(1, Integer.parseInt(
  8719. Integer.toHexString(Animation.cache[animationId].frame2IDS[0]).substring(0, Integer.toHexString(Animation.cache[animationId].frame2IDS[0]).length() - 4), 16));
  8720. } catch (Exception e) {
  8721. }
  8722. }
  8723. }
  8724.  
  8725. /**
  8726. * Force Chat mask
  8727. */
  8728. if ((bitmap & 4) != 0) {
  8729. // XXX
  8730. player.textSpoken = buffer.getString();
  8731.  
  8732. if (player.textSpoken.charAt(0) == '~') {
  8733. player.textSpoken = player.textSpoken.substring(1);
  8734. pushMessage(player.textSpoken, 2, player.name);
  8735. } else if (player == myPlayer) {
  8736. pushMessage(player.textSpoken, 2, player.name);
  8737. }
  8738.  
  8739. player.anInt1513 = 0;
  8740. player.anInt1531 = 0;
  8741. player.textCycle = 150;
  8742. }
  8743.  
  8744. /**
  8745. * Chat mask
  8746. */
  8747. if ((bitmap & 0x80) != 0) {
  8748. int chatEffects = buffer.getShortBigEndian();
  8749. int chatRights = buffer.getUnsignedByte();
  8750. int chatLength = buffer.method427();
  8751. int currentPosition = buffer.position;
  8752.  
  8753. if (player.name != null && player.visible) {
  8754. long username = TextClass.longForName(player.name.toLowerCase());
  8755. boolean ignored = false;
  8756.  
  8757. if (chatRights <= 10) {
  8758. for (int i = 0; i < ignoreCount; i++) {
  8759. if (ignoreListAsLongs[i] != username) {
  8760. continue;
  8761. }
  8762.  
  8763. ignored = true;
  8764. break;
  8765. }
  8766. }
  8767.  
  8768. if (!ignored && anInt1251 == 0) {
  8769. try {
  8770. aStream_834.position = 0;
  8771. buffer.method442(chatLength, 0, aStream_834.buffer);
  8772. aStream_834.position = 0;
  8773. String s = TextInput.readChatboxText(chatLength, aStream_834);
  8774. player.textSpoken = s;
  8775. player.anInt1513 = chatEffects >> 8;
  8776. player.anInt1531 = chatEffects & 0xff;
  8777. player.textCycle = 150;
  8778. pushMessage(s, 2, getPrefix(chatRights) + player.name, player.loyaltyTitle, player.loyaltyColor, player.loyaltyPosition);
  8779. } catch (Exception exception) {
  8780. Signlink.reportError("cde2");
  8781. }
  8782. }
  8783. }
  8784.  
  8785. buffer.position = currentPosition + chatLength;
  8786. }
  8787.  
  8788. /**
  8789. * Face entity mask
  8790. */
  8791. if ((bitmap & 1) != 0) {
  8792. player.interactingEntity = buffer.getShortBigEndian();
  8793. if (player.interactingEntity == 65535) {
  8794. player.interactingEntity = -1;
  8795. if (player == myPlayer) {
  8796. interactingWith = null;
  8797. }
  8798. }
  8799. }
  8800.  
  8801. /**
  8802. * Appearance mask
  8803. */
  8804. if ((bitmap & 0x10) != 0) {
  8805. int length = buffer.method427();
  8806. byte data[] = new byte[length];
  8807. ByteBuffer buff = new ByteBuffer(data);
  8808. buffer.getBytes(length, 0, data);
  8809. getaStreamArray895s()[j] = buff;
  8810. player.updatePlayer(buff);
  8811. }
  8812.  
  8813. /**
  8814. * Face direction mask
  8815. */
  8816. if ((bitmap & 2) != 0) {
  8817. player.faceDirectionX = buffer.getShortBigEndianA();
  8818. player.faceDirectionY = buffer.getShortBigEndian();
  8819. }
  8820.  
  8821. /**
  8822. * Hit mask 1
  8823. */
  8824. if ((bitmap & 0x20) != 0) {
  8825. int hitType = buffer.getUnsignedByte();
  8826. int damage = buffer.method426();
  8827. int icon = buffer.getUnsignedByte();
  8828. player.updateHitData(damage, hitType, loopCycle, icon);
  8829. player.loopCycleStatus = loopCycle + 300;
  8830. player.currentHealth = buffer.getShort();
  8831. player.maxHealth = buffer.getShort();
  8832. }
  8833.  
  8834. /**
  8835. * hit mask 2
  8836. */
  8837. if ((bitmap & 0x200) != 0) {
  8838. int hitType = buffer.getUnsignedByte();
  8839. int damage = buffer.method428();
  8840. int icon = buffer.getUnsignedByte();
  8841. player.updateHitData(damage, hitType, loopCycle, icon);
  8842. player.loopCycleStatus = loopCycle + 300;
  8843. player.currentHealth = buffer.getShort();
  8844. player.maxHealth = buffer.getShort();
  8845. }
  8846. }
  8847.  
  8848. private void method108() {
  8849. try {
  8850. int cameraDisplayX = myPlayer.x + cameraOffsetX;
  8851. int cameraDisplayY = myPlayer.y + cameraOffsetY;
  8852.  
  8853. if (currentCameraDisplayX - cameraDisplayX < -500 || currentCameraDisplayX - cameraDisplayX > 500 || currentCameraDisplayY - cameraDisplayY < -500
  8854. || currentCameraDisplayY - cameraDisplayY > 500) {
  8855. currentCameraDisplayX = cameraDisplayX;
  8856. currentCameraDisplayY = cameraDisplayY;
  8857. }
  8858.  
  8859. if (currentCameraDisplayX != cameraDisplayX) {
  8860. currentCameraDisplayX += (cameraDisplayX - currentCameraDisplayX) / 16;
  8861. }
  8862.  
  8863. if (currentCameraDisplayY != cameraDisplayY) {
  8864. currentCameraDisplayY += (cameraDisplayY - currentCameraDisplayY) / 16;
  8865. }
  8866.  
  8867. if (super.keyArray[1] == 1) {
  8868. cameraRotationLeft += (-26 - cameraRotationLeft) / 2;
  8869. } else if (super.keyArray[2] == 1) {
  8870. cameraRotationLeft += (26 - cameraRotationLeft) / 2;
  8871. } else {
  8872. cameraRotationLeft /= 2;
  8873. }
  8874.  
  8875. if (super.keyArray[3] == 1) {
  8876. cameraRotationRight += (14 - cameraRotationRight) / 2;
  8877. } else if (super.keyArray[4] == 1) {
  8878. cameraRotationRight += (-14 - cameraRotationRight) / 2;
  8879. } else {
  8880. cameraRotationRight /= 2;
  8881. }
  8882.  
  8883. viewRotation = viewRotation + cameraRotationLeft / 2 & 0x7ff;
  8884. cameraRotationZ += cameraRotationRight / 2;
  8885.  
  8886. if (cameraRotationZ < cameraAngleLimit) {
  8887. cameraRotationZ = cameraAngleLimit;
  8888. }
  8889.  
  8890. if (cameraRotationZ > 383) {
  8891. cameraRotationZ = 383;
  8892. }
  8893.  
  8894. int l = currentCameraDisplayX >> 7;
  8895. int i1 = currentCameraDisplayY >> 7;
  8896. int j1 = method42(plane, currentCameraDisplayY, currentCameraDisplayX);
  8897. int k1 = 0;
  8898.  
  8899. if (l > 3 && i1 > 3 && l < 100 && i1 < 100) {
  8900. for (int l1 = l - 4; l1 <= l + 4; l1++) {
  8901. for (int k2 = i1 - 4; k2 <= i1 + 4; k2++) {
  8902. int l2 = plane;
  8903.  
  8904. if (l2 < 3 && (byteGroundArray[1][l1][k2] & 2) == 2) {
  8905. l2++;
  8906. }
  8907.  
  8908. int i3 = j1 - intGroundArray[l2][l1][k2];
  8909.  
  8910. if (i3 > k1) {
  8911. k1 = i3;
  8912. }
  8913. }
  8914. }
  8915. }
  8916.  
  8917. anInt1005++;
  8918.  
  8919. if (anInt1005 > 1512) {
  8920. anInt1005 = 0;
  8921. getOut().putOpcode(77);
  8922. getOut().putShortBigEndian(0);
  8923. int i2 = getOut().position;
  8924. getOut().putShortBigEndian((int) (Math.random() * 256D));
  8925. getOut().putShortBigEndian(101);
  8926. getOut().putShortBigEndian(233);
  8927. getOut().putShort(45092);
  8928.  
  8929. if ((int) (Math.random() * 2D) == 0) {
  8930. getOut().putShort(35784);
  8931. }
  8932.  
  8933. getOut().putShortBigEndian((int) (Math.random() * 256D));
  8934. getOut().putShortBigEndian(64);
  8935. getOut().putShortBigEndian(38);
  8936. getOut().putShort((int) (Math.random() * 65536D));
  8937. getOut().putShort((int) (Math.random() * 65536D));
  8938. getOut().putVariableSizeByte(getOut().position - i2);
  8939. }
  8940.  
  8941. int j2 = k1 * 192;
  8942.  
  8943. if (j2 > 0x17f00) {
  8944. j2 = 0x17f00;
  8945. }
  8946. if (j2 < 32768) {
  8947. j2 = 32768;
  8948. }
  8949. if (j2 > anInt984) {
  8950. anInt984 += (j2 - anInt984) / 24;
  8951. return;
  8952. }
  8953. if (j2 < anInt984) {
  8954. anInt984 += (j2 - anInt984) / 80;
  8955. }
  8956. } catch (Exception _ex) {
  8957. Signlink.reportError(
  8958. "glfc_ex " + myPlayer.x + "," + myPlayer.y + "," + currentCameraDisplayX + "," + currentCameraDisplayY + "," + anInt1069 + "," + anInt1070 + "," + baseX + "," + baseY);
  8959. throw new RuntimeException("eek");
  8960. }
  8961. }
  8962.  
  8963. private void method114() {
  8964. for (int i = -1; i < playerCount; i++) {
  8965. int j;
  8966.  
  8967. if (i == -1) {
  8968. j = getMyPlayerIndex();
  8969. } else {
  8970. j = playerIndices[i];
  8971. }
  8972.  
  8973. Player player = playerArray[j];
  8974.  
  8975. if (player != null) {
  8976. method96(player);
  8977. }
  8978. }
  8979. }
  8980.  
  8981. private void method115() {
  8982. if (loadingStage == 2) {
  8983. for (GameObject class30_sub1 = (GameObject) getaClass19_1179().reverseGetFirst(); class30_sub1 != null; class30_sub1 = (GameObject) getaClass19_1179().reverseGetNext()) {
  8984. if (class30_sub1.anInt1294 > 0) {
  8985. class30_sub1.anInt1294--;
  8986. }
  8987. if (class30_sub1.anInt1294 == 0) {
  8988. if (class30_sub1.anInt1299 < 0 || ObjectManager.method178(class30_sub1.anInt1299, class30_sub1.anInt1301)) {
  8989. method142(class30_sub1.anInt1298, class30_sub1.anInt1295, class30_sub1.anInt1300, class30_sub1.anInt1301, class30_sub1.anInt1297, class30_sub1.anInt1296,
  8990. class30_sub1.anInt1299);
  8991. class30_sub1.unlink();
  8992. }
  8993. } else {
  8994. if (class30_sub1.anInt1302 > 0) {
  8995. class30_sub1.anInt1302--;
  8996. }
  8997. if (class30_sub1.anInt1302 == 0 && class30_sub1.anInt1297 >= 1 && class30_sub1.anInt1298 >= 1 && class30_sub1.anInt1297 <= 102 && class30_sub1.anInt1298 <= 102
  8998. && (class30_sub1.anInt1291 < 0 || ObjectManager.method178(class30_sub1.anInt1291, class30_sub1.anInt1293))) {
  8999. method142(class30_sub1.anInt1298, class30_sub1.anInt1295, class30_sub1.anInt1292, class30_sub1.anInt1293, class30_sub1.anInt1297, class30_sub1.anInt1296,
  9000. class30_sub1.anInt1291);
  9001. class30_sub1.anInt1302 = -1;
  9002. if (class30_sub1.anInt1291 == class30_sub1.anInt1299 && class30_sub1.anInt1299 == -1) {
  9003. class30_sub1.unlink();
  9004. } else if (class30_sub1.anInt1291 == class30_sub1.anInt1299 && class30_sub1.anInt1292 == class30_sub1.anInt1300 && class30_sub1.anInt1293 == class30_sub1.anInt1301) {
  9005. class30_sub1.unlink();
  9006. }
  9007. }
  9008. }
  9009. }
  9010.  
  9011. }
  9012. }
  9013.  
  9014. private void processMovementBuffer(ByteBuffer stream) {
  9015. stream.initBitAccess();
  9016. int movementStatus = stream.getBits(1);
  9017. if (movementStatus == 0) {
  9018. return;
  9019. }
  9020. int flagType = stream.getBits(2);
  9021. if (flagType == 0) {
  9022. anIntArray894[anInt893++] = getMyPlayerIndex();
  9023. return;
  9024. }
  9025. if (flagType == 1) {
  9026. int direction = stream.getBits(3);
  9027. myPlayer.moveInDir(false, direction);
  9028. int updateRequired = stream.getBits(1);
  9029. if (updateRequired == 1) {
  9030. anIntArray894[anInt893++] = getMyPlayerIndex();
  9031. }
  9032. return;
  9033. }
  9034. if (flagType == 2) {
  9035. int walkingDirection = stream.getBits(3);
  9036. myPlayer.moveInDir(true, walkingDirection);
  9037. int runningDirection = stream.getBits(3);
  9038. myPlayer.moveInDir(true, runningDirection);
  9039. int updateRequired = stream.getBits(1);
  9040. if (updateRequired == 1) {
  9041. anIntArray894[anInt893++] = getMyPlayerIndex();
  9042. }
  9043. return;
  9044. }
  9045. // this is the cause i think
  9046. if (flagType == 3) {
  9047. plane = stream.getBits(2);
  9048. if (previousPlane != plane) {
  9049. previousPlane = plane;
  9050. loadingStage = 1;
  9051. }
  9052. int j1 = stream.getBits(1);
  9053. int updateRequired = stream.getBits(1);
  9054. if (updateRequired == 1) {
  9055. anIntArray894[anInt893++] = getMyPlayerIndex();
  9056. }
  9057. int localY = stream.getBits(7);
  9058. int localX = stream.getBits(7);
  9059. myPlayer.setPos(localX, localY, j1 == 1);
  9060. }
  9061. }
  9062.  
  9063. public static int realPlane;
  9064.  
  9065. private boolean method119(int i, int j) {
  9066. boolean flag1 = false;
  9067. RSInterface class9 = RSInterface.interfaceCache[j];
  9068.  
  9069. if (class9 == null) {
  9070. // System.out.println("Null Interface: " + j + ", " + i);
  9071. return false;
  9072. }
  9073. for (int element : class9.children) {
  9074. if (element == -1) {
  9075. break;
  9076. }
  9077. RSInterface class9_1 = RSInterface.interfaceCache[element];
  9078. if (class9_1.type == 1) {
  9079. flag1 |= method119(i, class9_1.id);
  9080. }
  9081. if (class9_1.type == 6 && (class9_1.anInt257 != -1 || class9_1.anInt258 != -1)) {
  9082. boolean flag2 = interfaceIsSelected(class9_1);
  9083. int l;
  9084. if (flag2) {
  9085. l = class9_1.anInt258;
  9086. } else {
  9087. l = class9_1.anInt257;
  9088. }
  9089. if (l != -1) {
  9090. Animation animation = Animation.cache[l];
  9091. for (class9_1.anInt208 += i; class9_1.anInt208 > animation.method258(class9_1.anInt246);) {
  9092. class9_1.anInt208 -= animation.method258(class9_1.anInt246) + 1;
  9093. class9_1.anInt246++;
  9094. if (class9_1.anInt246 >= animation.frameCount) {
  9095. class9_1.anInt246 -= animation.frameStep;
  9096. if (class9_1.anInt246 < 0 || class9_1.anInt246 >= animation.frameCount) {
  9097. class9_1.anInt246 = 0;
  9098. }
  9099. }
  9100. flag1 = true;
  9101. }
  9102.  
  9103. }
  9104. }
  9105. }
  9106.  
  9107. return flag1;
  9108. }
  9109.  
  9110. private int method120() {
  9111. if (getConfig().getStatus(ConfigType.TOGGLE_ROOFS)) {
  9112. return plane;
  9113. }
  9114. int heightPlane = 3;
  9115. if (yCameraCurve < 310) {
  9116. int localCameraX = xCameraPos >> 7;
  9117. int localCameraY = yCameraPos >> 7;
  9118. int localX = myPlayer.x >> 7;
  9119. int localY = myPlayer.y >> 7;
  9120. try {
  9121. if ((byteGroundArray[plane][localCameraX][localCameraY] & 4) != 0) {
  9122. heightPlane = plane;
  9123. }
  9124. } catch (Exception e) {
  9125. System.out.println(plane + ":" + localCameraX + ":" + localCameraY);
  9126. e.printStackTrace();
  9127. }
  9128. int cameraOffsetX;
  9129. if (localX > localCameraX) {
  9130. cameraOffsetX = localX - localCameraX;
  9131. } else {
  9132. cameraOffsetX = localCameraX - localX;
  9133. }
  9134. int cameraOffsetY;
  9135. if (localY > localCameraY) {
  9136. cameraOffsetY = localY - localCameraY;
  9137. } else {
  9138. cameraOffsetY = localCameraY - localY;
  9139. }
  9140. if (cameraOffsetX > cameraOffsetY) {
  9141. int i2 = cameraOffsetY * 0x10000 / cameraOffsetX;
  9142. int k2 = 32768;
  9143. while (localCameraX != localX) {
  9144. if (localCameraX < localX) {
  9145. localCameraX++;
  9146. } else if (localCameraX > localX) {
  9147. localCameraX--;
  9148. }
  9149. try {
  9150. if ((byteGroundArray[plane][localCameraX][localCameraY] & 4) != 0) {
  9151. heightPlane = plane;
  9152. }
  9153. } catch (Exception e) {
  9154. System.out.println(plane + ":" + localCameraX + ":" + localCameraY);
  9155. e.printStackTrace();
  9156. }
  9157. k2 += i2;
  9158. if (k2 >= 0x10000) {
  9159. k2 -= 0x10000;
  9160. if (localCameraY < localY) {
  9161. localCameraY++;
  9162. } else if (localCameraY > localY) {
  9163. localCameraY--;
  9164. }
  9165. try {
  9166. if ((byteGroundArray[plane][localCameraX][localCameraY] & 4) != 0) {
  9167. heightPlane = plane;
  9168. }
  9169. } catch (Exception e) {
  9170. System.out.println(plane + ":" + localCameraX + ":" + localCameraY);
  9171. e.printStackTrace();
  9172. }
  9173. }
  9174. }
  9175. } else {
  9176. int j2 = cameraOffsetX * 0x10000 / cameraOffsetY;
  9177. int l2 = 32768;
  9178. while (localCameraY != localY) {
  9179. if (localCameraY < localY) {
  9180. localCameraY++;
  9181. } else if (localCameraY > localY) {
  9182. localCameraY--;
  9183. }
  9184.  
  9185. try {
  9186. if ((byteGroundArray[plane][localCameraX][localCameraY] & 4) != 0) {
  9187. heightPlane = plane;
  9188. }
  9189. } catch (Exception e) {
  9190. System.out.println(plane + ":" + localCameraX + ":" + localCameraY);
  9191. e.printStackTrace();
  9192. }
  9193. l2 += j2;
  9194. if (l2 >= 0x10000) {
  9195. l2 -= 0x10000;
  9196. if (localCameraX < localX) {
  9197. localCameraX++;
  9198. } else if (localCameraX > localX) {
  9199. localCameraX--;
  9200. }
  9201. try {
  9202. if ((byteGroundArray[plane][localCameraX][localCameraY] & 4) != 0) {
  9203. heightPlane = plane;
  9204. }
  9205. } catch (Exception e) {
  9206. System.out.println(plane + ":" + localCameraX + ":" + localCameraY);
  9207. e.printStackTrace();
  9208. }
  9209. }
  9210. }
  9211. }
  9212. }
  9213. try {
  9214. if ((byteGroundArray[plane][myPlayer.x >> 7][myPlayer.y >> 7] & 4) != 0) {
  9215. heightPlane = plane;
  9216. }
  9217. } catch (Exception e) {
  9218. e.printStackTrace();
  9219. System.out.println((myPlayer.x >> 7) + ", " + (myPlayer.y >> 7));
  9220. }
  9221. return heightPlane;
  9222. }
  9223.  
  9224. private int method121() {
  9225. if (getConfig().getStatus(ConfigType.TOGGLE_ROOFS)) {
  9226. return plane;
  9227. }
  9228. int j = method42(plane, yCameraPos, xCameraPos);
  9229. if (j - zCameraPos < 800 && (byteGroundArray[plane][xCameraPos >> 7][yCameraPos >> 7] & 4) != 0) {
  9230. return plane;
  9231. } else {
  9232. return 3;
  9233. }
  9234. }
  9235.  
  9236. private void method130(int j, int id, int l, int i1, int j1, int type, int l1, int i2, int j2) {
  9237. GameObject class30_sub1 = null;
  9238. for (GameObject class30_sub1_1 = (GameObject) getaClass19_1179().reverseGetFirst(); class30_sub1_1 != null; class30_sub1_1 = (GameObject) getaClass19_1179().reverseGetNext()) {
  9239. if (class30_sub1_1.anInt1295 != l1 || class30_sub1_1.anInt1297 != i2 || class30_sub1_1.anInt1298 != j1 || class30_sub1_1.anInt1296 != i1) {
  9240. continue;
  9241. }
  9242. class30_sub1 = class30_sub1_1;
  9243. break;
  9244. }
  9245.  
  9246. if (class30_sub1 == null) {
  9247. class30_sub1 = new GameObject();
  9248. class30_sub1.anInt1295 = l1;
  9249. class30_sub1.anInt1296 = i1;
  9250. class30_sub1.anInt1297 = i2;
  9251. class30_sub1.anInt1298 = j1;
  9252. method89(class30_sub1);
  9253. getaClass19_1179().insertHead(class30_sub1);
  9254. }
  9255. class30_sub1.anInt1291 = id;
  9256. class30_sub1.anInt1293 = type;
  9257. class30_sub1.anInt1292 = l;
  9258. class30_sub1.anInt1302 = j2;
  9259. class30_sub1.anInt1294 = j;
  9260. }
  9261.  
  9262. private void method134(ByteBuffer stream) {
  9263. int j = stream.getBits(8);
  9264. if (j < playerCount) {
  9265. for (int k = j; k < playerCount; k++) {
  9266. anIntArray840[anInt839++] = playerIndices[k];
  9267. }
  9268.  
  9269. }
  9270. if (j > playerCount) {
  9271. Signlink.reportError(getMyUsername() + " Too many players");
  9272. throw new RuntimeException("eek");
  9273. }
  9274. playerCount = 0;
  9275. for (int l = 0; l < j; l++) {
  9276. int i1 = playerIndices[l];
  9277. Player player = playerArray[i1];
  9278. int j1 = stream.getBits(1);
  9279. if (j1 == 0) {
  9280. playerIndices[playerCount++] = i1;
  9281. player.anInt1537 = loopCycle;
  9282. } else {
  9283. int k1 = stream.getBits(2);
  9284. if (k1 == 0) {
  9285. playerIndices[playerCount++] = i1;
  9286. player.anInt1537 = loopCycle;
  9287. anIntArray894[anInt893++] = i1;
  9288. } else if (k1 == 1) {
  9289. playerIndices[playerCount++] = i1;
  9290. player.anInt1537 = loopCycle;
  9291. int l1 = stream.getBits(3);
  9292. player.moveInDir(false, l1);
  9293. int j2 = stream.getBits(1);
  9294. if (j2 == 1) {
  9295. anIntArray894[anInt893++] = i1;
  9296. }
  9297. } else if (k1 == 2) {
  9298. playerIndices[playerCount++] = i1;
  9299. player.anInt1537 = loopCycle;
  9300. int i2 = stream.getBits(3);
  9301. player.moveInDir(true, i2);
  9302. int k2 = stream.getBits(3);
  9303. player.moveInDir(true, k2);
  9304. int l2 = stream.getBits(1);
  9305. if (l2 == 1) {
  9306. anIntArray894[anInt893++] = i1;
  9307. }
  9308. } else if (k1 == 3) {
  9309. anIntArray840[anInt839++] = i1;
  9310. }
  9311. }
  9312. }
  9313. }
  9314.  
  9315. private void method137(ByteBuffer stream, int j) {
  9316. if (j == 84) {
  9317. int k = stream.getUnsignedByte();
  9318. int j3 = anInt1268 + (k >> 4 & 7);
  9319. int i6 = anInt1269 + (k & 7);
  9320. int l8 = stream.getUnsignedShort();
  9321. int k11 = stream.getUnsignedShort();
  9322. int l13 = stream.getUnsignedShort();
  9323. if (j3 >= 0 && i6 >= 0 && j3 < 104 && i6 < 104) {
  9324. Deque class19_1 = groundArray[plane][j3][i6];
  9325. if (class19_1 != null) {
  9326. 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()) {
  9327. if (class30_sub2_sub4_sub2_3.id != (l8 & 0x7fff) || class30_sub2_sub4_sub2_3.amount != k11) {
  9328. continue;
  9329. }
  9330. class30_sub2_sub4_sub2_3.amount = l13;
  9331. break;
  9332. }
  9333.  
  9334. spawnGroundItem(j3, i6);
  9335. }
  9336. }
  9337. return;
  9338. }
  9339. if (j == 105) {
  9340. int l = stream.getUnsignedByte();
  9341. int k3 = anInt1268 + (l >> 4 & 7);
  9342. int j6 = anInt1269 + (l & 7);
  9343. int i9 = stream.getUnsignedShort();
  9344. int l11 = stream.getUnsignedByte();
  9345. int i14 = l11 >> 4 & 0xf;
  9346. int i16 = l11 & 7;
  9347. if (myPlayer.smallX[0] >= k3 - i14 && myPlayer.smallX[0] <= k3 + i14 && myPlayer.smallY[0] >= j6 - i14 && myPlayer.smallY[0] <= j6 + i14 && soundEffectVolume != 0 && aBoolean848
  9348. && !isLowDetail() && soundCount < 50) {
  9349. sound[soundCount] = i9;
  9350. soundType[soundCount] = i16;
  9351. soundDelay[soundCount] = Sounds.anIntArray326[i9];
  9352. aClass26Array1468[soundCount] = null;
  9353. soundCount++;
  9354. }
  9355. }
  9356. if (j == 215) {
  9357. int i1 = stream.method435();
  9358. int l3 = stream.method428();
  9359. int k6 = anInt1268 + (l3 >> 4 & 7);
  9360. int j9 = anInt1269 + (l3 & 7);
  9361. int i12 = stream.method435();
  9362. int j14 = stream.getUnsignedShort();
  9363. if (k6 >= 0 && j9 >= 0 && k6 < 104 && j9 < 104 && i12 != playerIndex) {
  9364. Item class30_sub2_sub4_sub2_2 = new Item();
  9365. class30_sub2_sub4_sub2_2.id = i1;
  9366. class30_sub2_sub4_sub2_2.amount = j14;
  9367. if (groundArray[plane][k6][j9] == null) {
  9368. groundArray[plane][k6][j9] = new Deque();
  9369. }
  9370. groundArray[plane][k6][j9].insertHead(class30_sub2_sub4_sub2_2);
  9371. spawnGroundItem(k6, j9);
  9372. }
  9373. return;
  9374. }
  9375. if (j == 156) {
  9376. int j1 = stream.method426();
  9377. int i4 = anInt1268 + (j1 >> 4 & 7);
  9378. int l6 = anInt1269 + (j1 & 7);
  9379. int k9 = stream.getUnsignedShort();
  9380. if (i4 >= 0 && l6 >= 0 && i4 < 104 && l6 < 104) {
  9381. Deque class19 = groundArray[plane][i4][l6];
  9382. if (class19 != null) {
  9383. for (Item item = (Item) class19.reverseGetFirst(); item != null; item = (Item) class19.reverseGetNext()) {
  9384. if (item.id != (k9 & 0x7fff)) {
  9385. continue;
  9386. }
  9387. item.unlink();
  9388. break;
  9389. }
  9390.  
  9391. if (class19.reverseGetFirst() == null) {
  9392. groundArray[plane][i4][l6] = null;
  9393. }
  9394. spawnGroundItem(i4, l6);
  9395. }
  9396. }
  9397. return;
  9398. }
  9399. if (j == 160) {
  9400. int k1 = stream.method428();
  9401. int j4 = anInt1268 + (k1 >> 4 & 7);
  9402. int i7 = anInt1269 + (k1 & 7);
  9403. int l9 = stream.method428();
  9404. int j12 = l9 >> 2;
  9405. int k14 = l9 & 3;
  9406. int j16 = anIntArray1177[j12];
  9407. int j17 = stream.method435();
  9408. if (j4 >= 0 && i7 >= 0 && j4 < 103 && i7 < 103) {
  9409. int j18 = intGroundArray[plane][j4][i7];
  9410. int i19 = intGroundArray[plane][j4 + 1][i7];
  9411. int l19 = intGroundArray[plane][j4 + 1][i7 + 1];
  9412. int k20 = intGroundArray[plane][j4][i7 + 1];
  9413. if (j16 == 0) {
  9414. Object1 class10 = worldController.method296(plane, j4, i7);
  9415. if (class10 != null) {
  9416. int k21 = class10.uid >> 14 & 0x7fff;
  9417. if (j12 == 2) {
  9418. class10.aClass30_Sub2_Sub4_278 = new Animable_Sub5(k21, 4 + k14, 2, i19, l19, j18, k20, j17, false);
  9419. class10.aClass30_Sub2_Sub4_279 = new Animable_Sub5(k21, k14 + 1 & 3, 2, i19, l19, j18, k20, j17, false);
  9420. } else {
  9421. class10.aClass30_Sub2_Sub4_278 = new Animable_Sub5(k21, k14, j12, i19, l19, j18, k20, j17, false);
  9422. }
  9423. }
  9424. }
  9425.  
  9426. if (j16 == 1) {
  9427. Object2 class26 = worldController.method297(j4, i7, plane);
  9428. if (class26 != null) {
  9429. class26.aClass30_Sub2_Sub4_504 = new Animable_Sub5(class26.uid >> 14 & 0x7fff, 0, 4, i19, l19, j18, k20, j17, false);
  9430. }
  9431. }
  9432.  
  9433. if (j16 == 2) {
  9434. Object5 class28 = worldController.method298(j4, i7, plane);
  9435.  
  9436. if (j12 == 11) {
  9437. j12 = 10;
  9438. }
  9439.  
  9440. if (class28 != null) {
  9441. class28.aClass30_Sub2_Sub4_521 = new Animable_Sub5(class28.uid >> 14 & 0x7fff, k14, j12, i19, l19, j18, k20, j17, false);
  9442. }
  9443. }
  9444.  
  9445. if (j16 == 3) {
  9446. Object3 class49 = worldController.method299(i7, j4, plane);
  9447.  
  9448. if (class49 != null) {
  9449. class49.aClass30_Sub2_Sub4_814 = new Animable_Sub5(class49.uid >> 14 & 0x7fff, k14, 22, i19, l19, j18, k20, j17, false);
  9450. }
  9451. }
  9452. }
  9453.  
  9454. return;
  9455. }
  9456.  
  9457. if (j == 147) {
  9458. int l1 = stream.method428();
  9459. int k4 = anInt1268 + (l1 >> 4 & 7);
  9460. int j7 = anInt1269 + (l1 & 7);
  9461. int i10 = stream.getUnsignedShort();
  9462. byte byte0 = stream.method430();
  9463. int l14 = stream.getShortBigEndian();
  9464. byte byte1 = stream.method429();
  9465. int k17 = stream.getUnsignedShort();
  9466. int k18 = stream.method428();
  9467. int j19 = k18 >> 2;
  9468. int i20 = k18 & 3;
  9469. int l20 = anIntArray1177[j19];
  9470. byte byte2 = stream.getSignedByte();
  9471. int l21 = stream.getUnsignedShort();
  9472. byte byte3 = stream.method429();
  9473. Player player;
  9474.  
  9475. if (i10 == playerIndex) {
  9476. player = myPlayer;
  9477. } else {
  9478. player = playerArray[i10];
  9479. }
  9480.  
  9481. if (player != null) {
  9482. ObjectDefinition class46 = ObjectDefinition.forID(l21);
  9483. int i22 = intGroundArray[plane][k4][j7];
  9484. int j22 = intGroundArray[plane][k4 + 1][j7];
  9485. int k22 = intGroundArray[plane][k4 + 1][j7 + 1];
  9486. int l22 = intGroundArray[plane][k4][j7 + 1];
  9487. Model model = class46.method578(j19, i20, i22, j22, k22, l22, -1);
  9488.  
  9489. if (model != null) {
  9490. method130(k17 + 1, -1, 0, l20, j7, 0, plane, k4, l14 + 1);
  9491. player.anInt1707 = l14 + loopCycle;
  9492. player.anInt1708 = k17 + loopCycle;
  9493. player.aModel_1714 = model;
  9494. int i23 = class46.xLength;
  9495. int j23 = class46.yLength;
  9496.  
  9497. if (i20 == 1 || i20 == 3) {
  9498. i23 = class46.yLength;
  9499. j23 = class46.xLength;
  9500. }
  9501.  
  9502. player.anInt1711 = k4 * 128 + i23 * 64;
  9503. player.anInt1713 = j7 * 128 + j23 * 64;
  9504. player.anInt1712 = method42(plane, player.anInt1713, player.anInt1711);
  9505.  
  9506. if (byte2 > byte0) {
  9507. byte byte4 = byte2;
  9508. byte2 = byte0;
  9509. byte0 = byte4;
  9510. }
  9511.  
  9512. if (byte3 > byte1) {
  9513. byte byte5 = byte3;
  9514. byte3 = byte1;
  9515. byte1 = byte5;
  9516. }
  9517.  
  9518. player.anInt1719 = k4 + byte2;
  9519. player.anInt1721 = k4 + byte0;
  9520. player.anInt1720 = j7 + byte3;
  9521. player.anInt1722 = j7 + byte1;
  9522. }
  9523. }
  9524. }
  9525.  
  9526. if (j == 151) {
  9527. int position = stream.method426();
  9528. int regionY = anInt1268 + (position >> 4 & 7);
  9529. int regionX = anInt1269 + (position & 7);
  9530. int objectId = stream.getShortBigEndian();
  9531. int objectData = stream.method428();
  9532. int objectType = objectData >> 2;
  9533. int objectFace = objectData & 3;
  9534. int l17 = anIntArray1177[objectType];
  9535. if (objectId < -1) {
  9536. objectId = Short.MAX_VALUE + -objectId;
  9537. }
  9538.  
  9539. if (regionY >= 0 && regionX >= 0 && regionY < 104 && regionX < 104) {
  9540. method130(-1, objectId, objectFace, l17, regionX, objectType, plane, regionY, 0);
  9541. }
  9542.  
  9543. return;
  9544. }
  9545.  
  9546. if (j == 4) {
  9547. int j2 = stream.getUnsignedByte();
  9548. int i5 = anInt1268 + (j2 >> 4 & 7);
  9549. int l7 = anInt1269 + (j2 & 7);
  9550. int k10 = stream.getUnsignedShort();
  9551. int l12 = stream.getUnsignedByte();
  9552. int j15 = stream.getUnsignedShort();
  9553.  
  9554. if (i5 >= 0 && l7 >= 0 && i5 < 104 && l7 < 104) {
  9555. i5 = i5 * 128 + 64;
  9556. l7 = l7 * 128 + 64;
  9557. Animable_Sub3 class30_sub2_sub4_sub3 = new Animable_Sub3(plane, loopCycle, j15, k10, method42(plane, l7, i5) - l12, l7, i5);
  9558. getaClass19_1056().insertHead(class30_sub2_sub4_sub3);
  9559. }
  9560.  
  9561. return;
  9562. }
  9563.  
  9564. if (j == 44) {
  9565. int k2 = stream.getShortBigEndianA();
  9566. int j5 = stream.getUnsignedShort();
  9567. int i8 = stream.getUnsignedByte();
  9568. int l10 = anInt1268 + (i8 >> 4 & 7);
  9569. int i13 = anInt1269 + (i8 & 7);
  9570.  
  9571. if (l10 >= 0 && i13 >= 0 && l10 < 104 && i13 < 104) {
  9572. Item class30_sub2_sub4_sub2_1 = new Item();
  9573. class30_sub2_sub4_sub2_1.id = k2;
  9574. class30_sub2_sub4_sub2_1.amount = j5;
  9575.  
  9576. if (groundArray[plane][l10][i13] == null) {
  9577. groundArray[plane][l10][i13] = new Deque();
  9578. }
  9579.  
  9580. groundArray[plane][l10][i13].insertHead(class30_sub2_sub4_sub2_1);
  9581. spawnGroundItem(l10, i13);
  9582. }
  9583.  
  9584. return;
  9585. }
  9586.  
  9587. if (j == 101) {
  9588. int l2 = stream.method427();
  9589. int k5 = l2 >> 2;
  9590. int j8 = l2 & 3;
  9591. int i11 = anIntArray1177[k5];
  9592. int j13 = stream.getUnsignedByte();
  9593. int k15 = anInt1268 + (j13 >> 4 & 7);
  9594. int l16 = anInt1269 + (j13 & 7);
  9595.  
  9596. if (k15 >= 0 && l16 >= 0 && k15 < 104 && l16 < 104) {
  9597. method130(-1, -1, j8, i11, l16, k5, plane, k15, 0);
  9598. }
  9599.  
  9600. return;
  9601. }
  9602.  
  9603. if (j == 117) {
  9604. int localPosition = stream.getUnsignedByte();
  9605. int localY = anInt1268 + (localPosition >> 4 & 7);
  9606. int localX = anInt1269 + (localPosition & 7);
  9607. int offsetY = localY + stream.getSignedByte();
  9608. int offsetX = localX + stream.getSignedByte();
  9609. int index = stream.getSignedShort();
  9610. int projectileId = stream.getUnsignedShort();
  9611. int startHeight = stream.getUnsignedByte() * 4;
  9612. int endHeight = stream.getUnsignedByte() * 4;
  9613. int time = stream.getUnsignedShort();
  9614. int speed = stream.getUnsignedShort();
  9615. int slope = stream.getUnsignedByte();
  9616. int startDelay = stream.getUnsignedByte();
  9617.  
  9618. if (localY >= 0 && localX >= 0 && localY < 104 && localX < 104 && offsetY >= 0 && offsetX >= 0 && offsetY < 104 && offsetX < 104 && projectileId != 65535) {
  9619. localY = localY * 128 + 64;
  9620. localX = localX * 128 + 64;
  9621. offsetY = offsetY * 128 + 64;
  9622. offsetX = offsetX * 128 + 64;
  9623. PlayerProjectile projectile = new PlayerProjectile(slope, endHeight, time + loopCycle, speed + loopCycle, startDelay, plane, method42(plane, localX, localY) - startHeight, localX,
  9624. localY, index, projectileId);
  9625. projectile.method455(time + loopCycle, offsetX, method42(plane, offsetX, offsetY) - endHeight, offsetY);
  9626. getaClass19_1013().insertHead(projectile);
  9627. }
  9628. }
  9629. }
  9630.  
  9631. private void method139(ByteBuffer stream) {
  9632. stream.initBitAccess();
  9633. int k = stream.getBits(8);
  9634.  
  9635. if (k < npcCount) {
  9636. for (int l = k; l < npcCount; l++) {
  9637. anIntArray840[anInt839++] = npcIndices[l];
  9638. }
  9639. }
  9640.  
  9641. if (k > npcCount) {
  9642. Signlink.reportError(getMyUsername() + " Too many npcs");
  9643. throw new RuntimeException("eek");
  9644. }
  9645.  
  9646. npcCount = 0;
  9647.  
  9648. for (int i1 = 0; i1 < k; i1++) {
  9649. int j1 = npcIndices[i1];
  9650. NPC npc = npcArray[j1];
  9651. int k1 = stream.getBits(1);
  9652.  
  9653. if (k1 == 0) {
  9654. npcIndices[npcCount++] = j1;
  9655. npc.anInt1537 = loopCycle;
  9656. } else {
  9657. int l1 = stream.getBits(2);
  9658.  
  9659. if (l1 == 0) {
  9660. npcIndices[npcCount++] = j1;
  9661. npc.anInt1537 = loopCycle;
  9662. anIntArray894[anInt893++] = j1;
  9663. } else if (l1 == 1) {
  9664. npcIndices[npcCount++] = j1;
  9665. npc.anInt1537 = loopCycle;
  9666. int i2 = stream.getBits(3);
  9667. npc.moveInDir(false, i2);
  9668. int k2 = stream.getBits(1);
  9669.  
  9670. if (k2 == 1) {
  9671. anIntArray894[anInt893++] = j1;
  9672. }
  9673. } else if (l1 == 2) {
  9674. npcIndices[npcCount++] = j1;
  9675. npc.anInt1537 = loopCycle;
  9676. int j2 = stream.getBits(3);
  9677. npc.moveInDir(true, j2);
  9678. int l2 = stream.getBits(3);
  9679. npc.moveInDir(true, l2);
  9680. int i3 = stream.getBits(1);
  9681.  
  9682. if (i3 == 1) {
  9683. anIntArray894[anInt893++] = j1;
  9684. }
  9685. } else if (l1 == 3) {
  9686. anIntArray840[anInt839++] = j1;
  9687. }
  9688. }
  9689. }
  9690. }
  9691.  
  9692. private void method142(int i, int j, int k, int l, int i1, int j1, int k1) {
  9693. if (i1 >= 1 && i >= 1 && i1 <= 102 && i <= 102) {
  9694. if (isLowDetail() && j != plane) {
  9695. return;
  9696. }
  9697.  
  9698. int i2 = 0;
  9699.  
  9700. if (j1 == 0) {
  9701. i2 = worldController.method300(j, i1, i);
  9702. }
  9703.  
  9704. if (j1 == 1) {
  9705. i2 = worldController.method301(j, i1, i);
  9706. }
  9707.  
  9708. if (j1 == 2) {
  9709. i2 = worldController.method302(j, i1, i);
  9710. }
  9711.  
  9712. if (j1 == 3) {
  9713. i2 = worldController.method303(j, i1, i);
  9714. }
  9715.  
  9716. if (i2 != 0) {
  9717. int i3 = worldController.fetchObjectIDTagForPosition(j, i1, i, i2);
  9718. int j2 = i2 >> 14 & 0x7fff;
  9719. int k2 = i3 & 0x1f;
  9720. int l2 = i3 >> 6;
  9721.  
  9722. if (j1 == 0) {
  9723. worldController.method291(i1, j, i, (byte) -119);
  9724. ObjectDefinition class46 = ObjectDefinition.forID(j2);
  9725.  
  9726. if (class46.isUnwalkable) {
  9727. aClass11Array1230[j].method215(l2, k2, class46.aBoolean757, i1, i);
  9728. }
  9729. }
  9730.  
  9731. if (j1 == 1) {
  9732. worldController.method292(i, j, i1);
  9733. }
  9734.  
  9735. if (j1 == 2) {
  9736. worldController.method293(j, i1, i);
  9737. ObjectDefinition class46_1 = ObjectDefinition.forID(j2);
  9738.  
  9739. if (i1 + class46_1.xLength > 103 || i + class46_1.xLength > 103 || i1 + class46_1.yLength > 103 || i + class46_1.yLength > 103) {
  9740. return;
  9741. }
  9742.  
  9743. if (class46_1.isUnwalkable) {
  9744. aClass11Array1230[j].method216(l2, class46_1.xLength, i1, i, class46_1.yLength, class46_1.aBoolean757);
  9745. }
  9746. }
  9747.  
  9748. if (j1 == 3) {
  9749. worldController.method294(j, i, i1);
  9750. ObjectDefinition class46_2 = ObjectDefinition.forID(j2);
  9751.  
  9752. if (class46_2.isUnwalkable && class46_2.hasActions) {
  9753. aClass11Array1230[j].method218(i, i1);
  9754. }
  9755. }
  9756. }
  9757.  
  9758. if (k1 >= 0) {
  9759. int j3 = j;
  9760.  
  9761. if (j3 < 3 && (byteGroundArray[1][i1][i] & 2) == 2) {
  9762. j3++;
  9763. }
  9764.  
  9765. if (j == 4) {
  9766. j = 0;
  9767. }
  9768. ObjectManager.method188(worldController, k, i, l, j3, aClass11Array1230[j], intGroundArray, i1, k1, j);
  9769. }
  9770. }
  9771. }
  9772.  
  9773. public static int cameraAngleLimit = 128;
  9774.  
  9775. private void method146() {
  9776. anInt1265++;
  9777. int j = 0;
  9778. int l = xCameraPos;
  9779. int i1 = zCameraPos;
  9780. int j1 = yCameraPos;
  9781. int k1 = yCameraCurve;
  9782. int l1 = xCameraCurve;
  9783.  
  9784. if (loggedIn) {
  9785. method47(true);
  9786. method26(true);
  9787. method47(false);
  9788. method26(false);
  9789. method55();
  9790. method104();
  9791.  
  9792. if (!cameraViewChanged) {
  9793. int i = cameraRotationZ;
  9794.  
  9795. if (cameraAngleLimit == 98) {
  9796. if (anInt984 / 332 > i) {
  9797. i = anInt984 / 332;
  9798. }
  9799. } else {
  9800. if (anInt984 / 256 > i) {
  9801. i = anInt984 / 256;
  9802. }
  9803. }
  9804.  
  9805. if (aBooleanArray876[4] && anIntArray1203[4] + cameraAngleLimit > i) {
  9806. i = anIntArray1203[4] + cameraAngleLimit;
  9807. }
  9808.  
  9809. if (config.getStatus(ConfigType.TOGGLE_FOV)) {
  9810. log_view_dist = getScreenWidth() >= 1024 ? 10 : 9;
  9811. } else {
  9812. log_view_dist = 9;
  9813. }
  9814. int k = viewRotation + viewRotationOffset & 0x7ff;
  9815. // int zoom = i + (config.getStatus(ConfigType.TOGGLE_FOV) ?
  9816. // 1200 : 650) - getScreenHeight() / 400;
  9817. // setCameraPos(GameFrame.getScreenMode() == ScreenMode.FIXED ?
  9818. // 600 + i * 3 : getScreenWidth() >= 1024 ? zoom : 450 + i * 3,
  9819. // i, currentCameraDisplayX,
  9820. // method42(plane, myPlayer.y, myPlayer.x) - 50, k,
  9821. // currentCameraDisplayY);
  9822.  
  9823. int zoom = (600 + (i * clientHeight / 400) + clientZoom);
  9824. setCameraPos(GameFrame.isFixed() ? (600 + i * 3) + clientZoom : zoom, i, currentCameraDisplayX, method42(plane, myPlayer.y, myPlayer.x) - 50 + (clientZoom / 9), k,
  9825. currentCameraDisplayY);
  9826. }
  9827.  
  9828. if (!cameraViewChanged) {
  9829. j = method120();
  9830. } else {
  9831. j = method121();
  9832. }
  9833.  
  9834. }
  9835.  
  9836. int k2 = Rasterizer.anInt1481;
  9837. Model.aBoolean1684 = true;
  9838. Model.anInt1687 = 0;
  9839. Model.anInt1685 = super.mouseX - 4;
  9840. Model.anInt1686 = super.mouseY - 4;
  9841. DrawingArea.setAllPixelsToZero();
  9842. if (loggedIn) {
  9843. worldController.method313(xCameraPos, yCameraPos, xCameraCurve, zCameraPos, j, yCameraCurve);
  9844. worldController.clearObj5Cache();
  9845. }
  9846.  
  9847. if (Client.getConfig().getStatus(ConfigType.FOG)) {
  9848. if (!switchColor) {
  9849. if (fogHandler.fogColor != fadeColors(new Color(fogHandler.fogColor), new Color(fadingToColor), fadeStep)) {
  9850. switchColor = true;
  9851. }
  9852. }
  9853. int x = baseX + (myPlayer.x - 6 >> 7);
  9854. int y = baseY + (myPlayer.y - 6 >> 7);
  9855. if (x >= 3060 && x <= 3140 && y >= 3050 && y <= 3530) {
  9856. if (fogHandler.fogColor != 13092807) {
  9857. fogHandler.fogColor = 13092807;
  9858. }
  9859. } else {
  9860. if (switchColor) {
  9861. fadeStep += 5;
  9862. if (fadeStep >= 100) {
  9863. fadeStep = 1;
  9864. switchColor = false;
  9865. fogHandler.fogColor = fadeColors(new Color(fogHandler.fogColor), new Color(fadingToColor), fadeStep);
  9866. } else {
  9867. fogHandler.fogColor = fadeColors(new Color(fogHandler.fogColor), new Color(fadingToColor), fadeStep);
  9868. }
  9869. }
  9870. }
  9871. fogHandler.renderFog(gameScreenIP.pixels, gameScreenIP.depth);
  9872. }
  9873.  
  9874. updateEntities();
  9875. drawHeadIcon();
  9876. method37(k2);
  9877.  
  9878. if (GameFrame.getScreenMode() != ScreenMode.FIXED && loggedIn) {
  9879. drawTabArea();
  9880. drawChatArea();
  9881. drawMinimap();
  9882. }
  9883.  
  9884. if (loggedIn && Constants.MONEY_POUCH_ENABLED) {
  9885. getMapArea().displayMoneyPouch(this);
  9886. }
  9887.  
  9888. if (loggedIn) {
  9889. draw3dScreen();
  9890.  
  9891. if (config.getStatus(ConfigType.DISPLAY_COMBAT_TIMERS)) {
  9892. drawTasks();
  9893. }
  9894. drawConsoleArea();
  9895. drawConsole();
  9896. }
  9897.  
  9898. if (PlayerHandler.showXP && loggedIn) {
  9899. getMapArea().displayXPCounter(this);
  9900. }
  9901.  
  9902. if (loggedIn) {
  9903. if (!resizing) {
  9904. gameScreenIP.drawGraphics(gameScreenDrawY, super.graphics, gameScreenDrawX);
  9905. }
  9906. xCameraPos = l;
  9907. zCameraPos = i1;
  9908. yCameraPos = j1;
  9909. yCameraCurve = k1;
  9910. xCameraCurve = l1;
  9911. }
  9912. }
  9913.  
  9914. public static int fadeStep = 1;
  9915. public static int fadingToColor;
  9916. public static boolean switchColor = false;
  9917.  
  9918. public int fadeColors(Color color1, Color color2, float step) {
  9919. float ratio = step / 100;
  9920. int r = (int) (color2.getRed() * ratio + color1.getRed() * (1 - ratio));
  9921. int g = (int) (color2.getGreen() * ratio + color1.getGreen() * (1 - ratio));
  9922. int b = (int) (color2.getBlue() * ratio + color1.getBlue() * (1 - ratio));
  9923. return new Color(r, g, b).getRGB();
  9924. }
  9925.  
  9926. public int positions[] = new int[2000];
  9927. public int landScapes[] = new int[2000];
  9928. public int objects[] = new int[2000];
  9929. private int[] menuActionCmd4;
  9930. public boolean isLoading;
  9931.  
  9932. public static AbstractMap.SimpleEntry<Integer, Integer> getNextInteger(ArrayList<Integer> values) {
  9933. ArrayList<AbstractMap.SimpleEntry<Integer, Integer>> frequencies = new ArrayList<>();
  9934. int maxIndex = 0;
  9935. main: for (int i = 0; i < values.size(); i++) {
  9936. int value = values.get(i);
  9937. for (int j = 0; j < frequencies.size(); j++) {
  9938. if (frequencies.get(j).getKey() == value) {
  9939. frequencies.get(j).setValue(frequencies.get(j).getValue() + 1);
  9940. if (frequencies.get(maxIndex).getValue() < frequencies.get(j).getValue()) {
  9941. maxIndex = j;
  9942. }
  9943. continue main;
  9944. }
  9945. }
  9946. frequencies.add(new AbstractMap.SimpleEntry<Integer, Integer>(value, 1));
  9947. }
  9948. return frequencies.get(maxIndex);
  9949. }
  9950.  
  9951. private void method22() {
  9952. try {
  9953. setAnInt985(-1);
  9954. getaClass19_1056().removeAll();
  9955. getaClass19_1013().removeAll();
  9956. Rasterizer.method366();
  9957. unlinkMRUNodes();
  9958. worldController.initToNull();
  9959. System.gc();
  9960.  
  9961. for (int i = 0; i < 4; i++) {
  9962. aClass11Array1230[i].method210();
  9963. }
  9964.  
  9965. for (int l = 0; l < 4; l++) {
  9966. for (int k1 = 0; k1 < 104; k1++) {
  9967. for (int j2 = 0; j2 < 104; j2++) {
  9968. byteGroundArray[l][k1][j2] = 0;
  9969. }
  9970. }
  9971. }
  9972.  
  9973. ObjectManager objectManager = new ObjectManager(byteGroundArray, intGroundArray);
  9974. int k2 = aByteArrayArray1183.length;
  9975. for (int i1 = 0; i1 < k2; i1++) {
  9976. for (int i2 = 0; i2 < 2000; i2++) {
  9977. if (anIntArray1234[i1] == positions[i2]) {
  9978. floorMap[i1] = landScapes[i2];
  9979. objectMap[i1] = objects[i2];
  9980. }
  9981. }
  9982. }
  9983.  
  9984. if (loggedIn) {
  9985. getOut().putOpcode(0);
  9986. }
  9987.  
  9988. if (!aBoolean1159) {
  9989. for (int i3 = 0; i3 < k2; i3++) {
  9990. int i4 = (anIntArray1234[i3] >> 8) * 64 - baseX;
  9991. int k5 = (anIntArray1234[i3] & 0xff) * 64 - baseY;
  9992. byte abyte0[] = aByteArrayArray1183[i3];
  9993. if (abyte0 != null) {
  9994. objectManager.method180(abyte0, k5, i4, (anInt1069 - 6) * 8, (anInt1070 - 6) * 8, aClass11Array1230);
  9995. }
  9996. }
  9997.  
  9998. for (int j4 = 0; j4 < k2; j4++) {
  9999. int l5 = (anIntArray1234[j4] >> 8) * 62 - baseX;
  10000. int k7 = (anIntArray1234[j4] & 0xff) * 62 - baseY;
  10001. byte abyte2[] = aByteArrayArray1183[j4];
  10002.  
  10003. if (abyte2 == null && anInt1070 < 800) {
  10004. objectManager.method174(k7, 64, 64, l5);
  10005. }
  10006. }
  10007.  
  10008. if (loggedIn) {
  10009. getOut().putOpcode(0);
  10010. }
  10011.  
  10012. for (int i6 = 0; i6 < k2; i6++) {
  10013. byte abyte1[] = aByteArrayArray1247[i6];
  10014. if (abyte1 != null) {
  10015. int l8 = (anIntArray1234[i6] >> 8) * 64 - baseX;
  10016. int k9 = (anIntArray1234[i6] & 0xff) * 64 - baseY;
  10017. objectManager.method190(l8, aClass11Array1230, k9, worldController, abyte1);
  10018. }
  10019. }
  10020. CustomObjectSpawns.spawn();
  10021. }
  10022.  
  10023. if (aBoolean1159) {
  10024. for (int j3 = 0; j3 < 4; j3++) {
  10025. for (int k4 = 0; k4 < 13; k4++) {
  10026. for (int j6 = 0; j6 < 13; j6++) {
  10027. int l7 = anIntArrayArrayArray1129[j3][k4][j6];
  10028.  
  10029. if (l7 != -1) {
  10030. int i9 = l7 >> 24 & 3;
  10031. int l9 = l7 >> 1 & 3;
  10032. int j10 = l7 >> 14 & 0x3ff;
  10033. int l10 = l7 >> 3 & 0x7ff;
  10034. int j11 = (j10 / 8 << 8) + l10 / 8;
  10035.  
  10036. for (int l11 = 0; l11 < anIntArray1234.length; l11++) {
  10037. if (anIntArray1234[l11] != j11 || aByteArrayArray1183[l11] == null) {
  10038. continue;
  10039. }
  10040.  
  10041. objectManager.method179(i9, l9, aClass11Array1230, k4 * 8, (j10 & 7) * 8, aByteArrayArray1183[l11], (l10 & 7) * 8, j3, j6 * 8);
  10042. break;
  10043. }
  10044. }
  10045. }
  10046. }
  10047. }
  10048.  
  10049. for (int l4 = 0; l4 < 13; l4++) {
  10050. for (int k6 = 0; k6 < 13; k6++) {
  10051. int i8 = anIntArrayArrayArray1129[0][l4][k6];
  10052.  
  10053. if (i8 == -1) {
  10054. objectManager.method174(k6 * 8, 8, 8, l4 * 8);
  10055. }
  10056. }
  10057. }
  10058.  
  10059. if (loggedIn) {
  10060. getOut().putOpcode(0);
  10061. }
  10062.  
  10063. for (int l6 = 0; l6 < 4; l6++) {
  10064. for (int j8 = 0; j8 < 13; j8++) {
  10065. for (int j9 = 0; j9 < 13; j9++) {
  10066. int i10 = anIntArrayArrayArray1129[l6][j8][j9];
  10067.  
  10068. if (i10 != -1) {
  10069. int k10 = i10 >> 24 & 3;
  10070. int i11 = i10 >> 1 & 3;
  10071. int k11 = i10 >> 14 & 0x3ff;
  10072. int i12 = i10 >> 3 & 0x7ff;
  10073. int j12 = (k11 / 8 << 8) + i12 / 8;
  10074.  
  10075. for (int k12 = 0; k12 < anIntArray1234.length; k12++) {
  10076. if (anIntArray1234[k12] != j12 || aByteArrayArray1247[k12] == null) {
  10077. continue;
  10078. }
  10079. objectManager.method183(aClass11Array1230, worldController, k10, j8 * 8, (i12 & 7) * 8, l6, aByteArrayArray1247[k12], (k11 & 7) * 8, i11, j9 * 8);
  10080. break;
  10081. }
  10082. }
  10083. }
  10084. }
  10085. }
  10086. }
  10087.  
  10088. if (loggedIn) {
  10089. getOut().putOpcode(0);
  10090. }
  10091.  
  10092. objectManager.method171(aClass11Array1230, worldController);
  10093.  
  10094. if (loggedIn)
  10095. fadingToColor = getNextInteger(objectManager.colors).getKey();
  10096.  
  10097. if (loggedIn) {
  10098.  
  10099. gameScreenIP.initDrawingArea();
  10100. }
  10101.  
  10102. if (loggedIn) {
  10103. getOut().putOpcode(0);
  10104. }
  10105.  
  10106. int k3 = ObjectManager.anInt145;
  10107.  
  10108. if (k3 > plane) {
  10109. k3 = plane;
  10110. }
  10111.  
  10112. if (k3 < plane - 1) {
  10113. k3 = plane - 1;
  10114. }
  10115.  
  10116. if (isLowDetail()) {
  10117. worldController.method275(ObjectManager.anInt145);
  10118. } else {
  10119. worldController.method275(0);
  10120. }
  10121.  
  10122. for (int i5 = 0; i5 < 104; i5++) {
  10123. for (int i7 = 0; i7 < 104; i7++) {
  10124. spawnGroundItem(i5, i7);
  10125. }
  10126. }
  10127.  
  10128. method63();
  10129.  
  10130. ObjectDefinition.mruNodes1.unlinkAll();
  10131.  
  10132. if (super.mainFrame != null && loggedIn) {
  10133. getOut().putOpcode(210);
  10134. getOut().putInt(0x3f008edd);
  10135. }
  10136.  
  10137. System.gc();
  10138. Rasterizer.method367();
  10139. onDemandFetcher.method566();
  10140. int k = (anInt1069 - 6) / 8 - 1;
  10141. int j1 = (anInt1069 + 6) / 8 + 1;
  10142. int i2 = (anInt1070 - 6) / 8 - 1;
  10143. int l2 = (anInt1070 + 6) / 8 + 1;
  10144.  
  10145. if (aBoolean1141) {
  10146. k = 49;
  10147. j1 = 50;
  10148. i2 = 49;
  10149. l2 = 50;
  10150. }
  10151.  
  10152. for (int l3 = k; l3 <= j1; l3++) {
  10153. for (int j5 = i2; j5 <= l2; j5++) {
  10154. if (l3 == k || l3 == j1 || j5 == i2 || j5 == l2) {
  10155. int j7 = onDemandFetcher.getMapCount(0, j5, l3);
  10156.  
  10157. if (j7 != -1) {
  10158. onDemandFetcher.method560(j7, 3);
  10159. }
  10160.  
  10161. int k8 = onDemandFetcher.getMapCount(1, j5, l3);
  10162.  
  10163. if (k8 != -1) {
  10164. onDemandFetcher.method560(k8, 3);
  10165. }
  10166. }
  10167. }
  10168. }
  10169. } catch (Exception exception) {
  10170. exception.printStackTrace();
  10171. }
  10172. }
  10173.  
  10174. private void method24(int i) {
  10175. int[] ai = miniMapRegions.myPixels;
  10176. int j = ai.length;
  10177.  
  10178. for (int k = 0; k < j; k++) {
  10179. ai[k] = 0;
  10180. }
  10181.  
  10182. for (int l = 1; l < 103; l++) {
  10183. int i1 = 24628 + (103 - l) * 512 * 4;
  10184.  
  10185. for (int k1 = 1; k1 < 103; k1++) {
  10186. if ((byteGroundArray[i][k1][l] & 0x18) == 0) {
  10187. worldController.method309(ai, i1, i, k1, l);
  10188. }
  10189.  
  10190. if (i < 3 && (byteGroundArray[i + 1][k1][l] & 8) != 0) {
  10191. worldController.method309(ai, i1, i + 1, k1, l);
  10192. }
  10193.  
  10194. i1 += 4;
  10195. }
  10196. }
  10197.  
  10198. int j1 = Color.WHITE.getRGB();
  10199. int l1 = Color.RED.getRGB();
  10200.  
  10201. if (loggedIn) {
  10202. miniMapRegions.method343();
  10203. }
  10204.  
  10205. for (int i2 = 1; i2 < 103; i2++) {
  10206. for (int j2 = 1; j2 < 103; j2++) {
  10207. if ((byteGroundArray[i][j2][i2] & 0x18) == 0) {
  10208. method50(i2, j1, j2, l1, i);
  10209. }
  10210.  
  10211. if (i < 3 && (byteGroundArray[i + 1][j2][i2] & 8) != 0) {
  10212. method50(i2, j1, j2, l1, i + 1);
  10213. }
  10214. }
  10215. }
  10216.  
  10217. if (loggedIn) {
  10218. gameScreenIP.initDrawingArea();
  10219. }
  10220.  
  10221. anInt1071 = 0;
  10222.  
  10223. for (int k2 = 0; k2 < 104; k2++) {
  10224. for (int l2 = 0; l2 < 104; l2++) {
  10225. int i3 = worldController.method303(plane, k2, l2);
  10226.  
  10227. if (i3 != 0) {
  10228. i3 = i3 >> 14 & 0x7fff;
  10229. int j3 = ObjectDefinition.forID(i3).anInt746;
  10230.  
  10231. if (j3 >= 0) {
  10232. try {
  10233. aClass30_Sub2_Sub1_Sub1Array1140[anInt1071] = mapFunctions[j3];
  10234. anIntArray1072[anInt1071] = k2;
  10235. anIntArray1073[anInt1071] = l2;
  10236. anInt1071++;
  10237. } catch (Exception e) {
  10238.  
  10239. }
  10240. }
  10241. }
  10242. }
  10243. }
  10244. }
  10245.  
  10246. private void method26(boolean flag) {
  10247. for (int i = 0; i < npcCount; i++) {
  10248. NPC npc = npcArray[npcIndices[i]];
  10249. int k = 0x20000000 + (npcIndices[i] << 14);
  10250.  
  10251. if (npc == null || !npc.isVisible() || npc.definitionOverride.visibilityOrRendering != flag) {
  10252. continue;
  10253. }
  10254.  
  10255. int l = npc.x >> 7;
  10256. int i1 = npc.y >> 7;
  10257.  
  10258. if (l < 0 || l >= 104 || i1 < 0 || i1 >= 104) {
  10259. continue;
  10260. }
  10261.  
  10262. if (npc.anInt1540 == 1 && (npc.x & 0x7f) == 64 && (npc.y & 0x7f) == 64) {
  10263. if (anIntArrayArray929[l][i1] == anInt1265) {
  10264. continue;
  10265. }
  10266.  
  10267. anIntArrayArray929[l][i1] = anInt1265;
  10268. }
  10269.  
  10270. if (!npc.definitionOverride.disableRightClick) {
  10271. k += 0x80000000;
  10272. }
  10273.  
  10274. worldController.method285(plane, npc.anInt1552, method42(plane, npc.y, npc.x), k, npc.y, (npc.anInt1540 - 1) * 64 + 60, npc.x, npc, npc.aBoolean1541);
  10275. }
  10276. }
  10277.  
  10278. private void method37(int j) {
  10279. // Textures
  10280. int speed = 1;
  10281.  
  10282. if (Rasterizer.anIntArray1480[17] >= j) {
  10283. Background background = Rasterizer.aBackgroundArray1474s[17];
  10284. int k = background.imgWidth * background.imgHeight - 1;
  10285. int j1 = background.imgWidth * anInt945 * speed;
  10286. byte abyte0[] = background.imgPixels;
  10287. byte abyte3[] = aByteArray912;
  10288.  
  10289. for (int i2 = 0; i2 <= k; i2++) {
  10290. abyte3[i2] = abyte0[i2 - j1 & k];
  10291. }
  10292.  
  10293. background.imgPixels = abyte3;
  10294. aByteArray912 = abyte0;
  10295. Rasterizer.method370(17);
  10296. anInt854++;
  10297.  
  10298. if (anInt854 > 1235) {
  10299. anInt854 = 0;
  10300. getOut().putOpcode(226);
  10301. getOut().putShortBigEndian(0);
  10302. int l2 = getOut().position;
  10303. getOut().putShort(58722);
  10304. getOut().putShortBigEndian(240);
  10305. getOut().putShort((int) (Math.random() * 65536D));
  10306. getOut().putShortBigEndian((int) (Math.random() * 256D));
  10307.  
  10308. if ((int) (Math.random() * 2D) == 0) {
  10309. getOut().putShort(51825);
  10310. }
  10311.  
  10312. getOut().putShortBigEndian((int) (Math.random() * 256D));
  10313. getOut().putShort((int) (Math.random() * 65536D));
  10314. getOut().putShort(7130);
  10315. getOut().putShort((int) (Math.random() * 65536D));
  10316. getOut().putShort(61657);
  10317. getOut().putVariableSizeByte(getOut().position - l2);
  10318. }
  10319. }
  10320.  
  10321. if (Rasterizer.anIntArray1480[24] >= j) {
  10322. Background background_1 = Rasterizer.aBackgroundArray1474s[24];
  10323. int l = background_1.imgWidth * background_1.imgHeight - 1;
  10324. int k1 = background_1.imgWidth * anInt945 * 2;
  10325. byte abyte1[] = background_1.imgPixels;
  10326. byte abyte4[] = aByteArray912;
  10327.  
  10328. for (int j2 = 0; j2 <= l; j2++) {
  10329. abyte4[j2] = abyte1[j2 - k1 & l];
  10330. }
  10331.  
  10332. background_1.imgPixels = abyte4;
  10333. aByteArray912 = abyte1;
  10334. Rasterizer.method370(24);
  10335. }
  10336.  
  10337. if (Rasterizer.anIntArray1480[34] >= j) {
  10338. Background background_2 = Rasterizer.aBackgroundArray1474s[34];
  10339. int i1 = background_2.imgWidth * background_2.imgHeight - 1;
  10340. int l1 = background_2.imgWidth * anInt945 * 2;
  10341. byte abyte2[] = background_2.imgPixels;
  10342. byte abyte5[] = aByteArray912;
  10343.  
  10344. for (int k2 = 0; k2 <= i1; k2++) {
  10345. abyte5[k2] = abyte2[k2 - l1 & i1];
  10346. }
  10347.  
  10348. background_2.imgPixels = abyte5;
  10349. aByteArray912 = abyte2;
  10350. Rasterizer.method370(34);
  10351. }
  10352.  
  10353. if (Rasterizer.anIntArray1480[1] >= j) {
  10354. Background background_2 = Rasterizer.aBackgroundArray1474s[1];
  10355. int i1 = background_2.imgWidth * background_2.imgHeight - 1;
  10356. int l1 = background_2.imgWidth * anInt945 * 2;
  10357. byte abyte2[] = background_2.imgPixels;
  10358. byte abyte5[] = aByteArray912;
  10359.  
  10360. for (int k2 = 0; k2 <= i1; k2++) {
  10361. abyte5[k2] = abyte2[k2 - l1 & i1];
  10362. }
  10363.  
  10364. background_2.imgPixels = abyte5;
  10365. aByteArray912 = abyte2;
  10366. Rasterizer.method370(1);
  10367. }
  10368.  
  10369. if (Rasterizer.anIntArray1480[40] >= j) {
  10370. Background background_2 = Rasterizer.aBackgroundArray1474s[40];
  10371. int i1 = background_2.imgWidth * background_2.imgHeight - 1;
  10372. int l1 = background_2.imgWidth * anInt945 * 1;
  10373. byte abyte2[] = background_2.imgPixels;
  10374. byte abyte5[] = aByteArray912;
  10375.  
  10376. for (int k2 = 0; k2 <= i1; k2++) {
  10377. abyte5[k2] = abyte2[k2 - l1 & i1];
  10378. }
  10379.  
  10380. background_2.imgPixels = abyte5;
  10381. aByteArray912 = abyte2;
  10382. Rasterizer.method370(40);
  10383. }
  10384. }
  10385.  
  10386. private void method38() {
  10387. for (int i = -1; i < playerCount; i++) {
  10388. int j;
  10389. if (i == -1) {
  10390. j = getMyPlayerIndex();
  10391. } else {
  10392. j = playerIndices[i];
  10393. }
  10394. Player player = playerArray[j];
  10395. if (player != null && player.textCycle > 0) {
  10396. player.textCycle--;
  10397. if (player.textCycle == 0) {
  10398. player.textSpoken = null;
  10399. }
  10400. }
  10401. }
  10402. for (int k = 0; k < npcCount; k++) {
  10403. int l = npcIndices[k];
  10404. NPC npc = npcArray[l];
  10405. if (npc != null && npc.textCycle > 0) {
  10406. npc.textCycle--;
  10407. if (npc.textCycle == 0) {
  10408. npc.textSpoken = null;
  10409. }
  10410. }
  10411. }
  10412. }
  10413.  
  10414. private int method42(int i, int j, int k) {
  10415. int l = k >> 7;
  10416. int i1 = j >> 7;
  10417. if (l < 0 || i1 < 0 || l > 103 || i1 > 103) {
  10418. return 0;
  10419. }
  10420. int j1 = i;
  10421. if (j1 < 3 && (byteGroundArray[1][l][i1] & 2) == 2) {
  10422. j1++;
  10423. }
  10424. int k1 = k & 0x7f;
  10425. int l1 = j & 0x7f;
  10426. int i2 = intGroundArray[j1][l][i1] * (128 - k1) + intGroundArray[j1][l + 1][i1] * k1 >> 7;
  10427. int j2 = intGroundArray[j1][l][i1 + 1] * (128 - k1) + intGroundArray[j1][l + 1][i1 + 1] * k1 >> 7;
  10428. return i2 * (128 - l1) + j2 * l1 >> 7;
  10429. }
  10430.  
  10431. public void method45() {
  10432. aBoolean1031 = true;
  10433. for (int j = 0; j < 7; j++) {
  10434. anIntArray1065[j] = -1;
  10435. for (int k = 0; k < IdentityKit.getLength(); k++) {
  10436. if (IdentityKit.cache[k].isaBoolean662() || IdentityKit.cache[k].getAnInt657() != j + (aBoolean1047 ? 0 : 7)) {
  10437. continue;
  10438. }
  10439. anIntArray1065[j] = k;
  10440. break;
  10441. }
  10442. }
  10443. }
  10444.  
  10445. private void method46(int i, ByteBuffer stream) {
  10446. while (stream.bitPosition + 21 < i * 8) {
  10447. int k = stream.getBits(14);
  10448. if (k == 16383) {
  10449. break;
  10450. }
  10451. if (npcArray[k] == null) {
  10452. npcArray[k] = new NPC();
  10453. }
  10454. NPC npc = npcArray[k];
  10455. npcIndices[npcCount++] = k;
  10456. npc.anInt1537 = loopCycle;
  10457. int l = stream.getBits(5);
  10458. if (l > 15) {
  10459. l -= 32;
  10460. }
  10461. int i1 = stream.getBits(5);
  10462. if (i1 > 15) {
  10463. i1 -= 32;
  10464. }
  10465. int j1 = stream.getBits(1);
  10466. npc.definitionOverride = MobDefinition.get(stream.getBits(Constants.NPC_BITS));
  10467. int k1 = stream.getBits(1);
  10468. if (k1 == 1) {
  10469. anIntArray894[anInt893++] = k;
  10470. }
  10471. npc.anInt1540 = npc.definitionOverride.npcSizeInSquares;
  10472. npc.anInt1504 = npc.definitionOverride.degreesToTurn;
  10473. npc.anInt1554 = npc.definitionOverride.walkAnimation;
  10474. npc.anInt1555 = npc.definitionOverride.walkingBackwardsAnimation;
  10475. npc.anInt1556 = npc.definitionOverride.walkLeftAnimation;
  10476. npc.anInt1557 = npc.definitionOverride.walkRightAnimation;
  10477. npc.anInt1511 = npc.definitionOverride.standAnimation;
  10478. npc.setPos(myPlayer.smallX[0] + i1, myPlayer.smallY[0] + l, j1 == 1);
  10479. }
  10480. stream.finishBitAccess();
  10481. }
  10482.  
  10483. private void method47(boolean flag) {
  10484. if (myPlayer.x >> 7 == destX && myPlayer.y >> 7 == destY) {
  10485. destX = 0;
  10486. }
  10487. int j = playerCount;
  10488. if (flag) {
  10489. j = 1;
  10490. }
  10491. for (int l = 0; l < j; l++) {
  10492. Player player;
  10493. int i1;
  10494. if (flag) {
  10495. player = myPlayer;
  10496. i1 = getMyPlayerIndex() << 14;
  10497. } else {
  10498. player = playerArray[playerIndices[l]];
  10499. i1 = playerIndices[l] << 14;
  10500. }
  10501. if (player == null || !player.isVisible()) {
  10502. continue;
  10503. }
  10504. // here
  10505. player.aBoolean1699 = playerCount > 200 && !flag && player.anInt1517 == player.anInt1511;
  10506. int j1 = player.x >> 7;
  10507. int k1 = player.y >> 7;
  10508. if (j1 < 0 || j1 >= 104 || k1 < 0 || k1 >= 104) {
  10509. continue;
  10510. }
  10511. if (player.aModel_1714 != null && loopCycle >= player.anInt1707 && loopCycle < player.anInt1708) {
  10512. player.aBoolean1699 = false;
  10513. player.anInt1709 = method42(plane, player.y, player.x);
  10514. worldController.method286(plane, player.y, player, player.anInt1552, player.anInt1722, player.x, player.anInt1709, player.anInt1719, player.anInt1721, i1, player.anInt1720);
  10515. continue;
  10516. }
  10517. if ((player.x & 0x7f) == 64 && (player.y & 0x7f) == 64) {
  10518. if (anIntArrayArray929[j1][k1] == anInt1265) {
  10519. continue;
  10520. }
  10521. anIntArrayArray929[j1][k1] = anInt1265;
  10522. }
  10523. player.anInt1709 = method42(plane, player.y, player.x);
  10524. worldController.method285(plane, player.anInt1552, player.anInt1709, i1, player.y, 60, player.x, player, player.aBoolean1541);
  10525. }
  10526. }
  10527.  
  10528. private void method49(ByteBuffer stream) {
  10529. for (int j = 0; j < anInt893; j++) {
  10530. int k = anIntArray894[j];
  10531. Player player = playerArray[k];
  10532. int l = stream.getUnsignedByte();
  10533. if ((l & 0x40) != 0) {
  10534. l += stream.getUnsignedByte() << 8;
  10535. }
  10536. handlePlayerUpdateBlock(l, k, stream, player);
  10537. }
  10538. }
  10539.  
  10540. public void method50(int y, int primaryColor, int x, int secondaryColor, int z) {
  10541. int uid = worldController.method300(z, x, y);
  10542. if (((uid ^ 0xffffffffffffffffL) != -1L) || uid != 0) {
  10543. int resource_tag = worldController.fetchObjectIDTagForPosition(z, x, y, uid);
  10544. int direction = resource_tag >> 6 & 3;
  10545. int type = resource_tag & 0x1f;
  10546. int color = primaryColor;
  10547. if (uid > 0)
  10548. color = secondaryColor;
  10549.  
  10550. int scene_pixels[] = miniMapRegions.myPixels;
  10551. int pixel = 24624 + x * 4 + (103 - y) * 512 * 4;
  10552. int object_id = worldController.fetchWallObjectNewUID(z, x, y);
  10553. ObjectDefinition def = ObjectDefinition.forID(object_id);
  10554. if (def.mapSceneID != -1) {
  10555. Background scene = mapScenes[def.mapSceneID];
  10556. if (scene != null) {
  10557. int scene_x = (def.xLength * 4 - scene.imgWidth) / 2;
  10558. int scene_y = (def.yLength * 4 - scene.imgHeight) / 2;
  10559. scene.method361(48 + x * 4 + scene_x, 48 + (104 - y - def.yLength) * 4 + scene_y);
  10560. }
  10561. } else {
  10562. if ((def.mapSceneID ^ 0xffffffff) == 0) {
  10563. if (type == 0 || type == 2)
  10564. if (direction == 0) {
  10565. scene_pixels[pixel] = color;
  10566. scene_pixels[pixel + 512] = color;
  10567. scene_pixels[pixel + 1024] = color;
  10568. scene_pixels[pixel + 1536] = color;
  10569. } else if ((((direction ^ 0xffffffff) == -2) || direction == 1)) {
  10570. scene_pixels[pixel] = color;
  10571. scene_pixels[pixel + 1] = color;
  10572. scene_pixels[pixel + 2] = color;
  10573. scene_pixels[pixel + 3] = color;
  10574. } else if (direction == 2) {
  10575. scene_pixels[pixel + 3] = color;
  10576. scene_pixels[pixel + 3 + 512] = color;
  10577. scene_pixels[pixel + 3 + 1024] = color;
  10578. scene_pixels[pixel + 3 + 1536] = color;
  10579. } else if (direction == 3) {
  10580. scene_pixels[pixel + 1536] = color;
  10581. scene_pixels[pixel + 1536 + 1] = color;
  10582. scene_pixels[pixel + 1536 + 2] = color;
  10583. scene_pixels[pixel + 1536 + 3] = color;
  10584. }
  10585. if (type == 3)
  10586. if (direction == 0)
  10587. scene_pixels[pixel] = color;
  10588.  
  10589. else if (direction == 1)
  10590. scene_pixels[pixel + 3] = color;
  10591.  
  10592. else if (direction == 2)
  10593. scene_pixels[pixel + 3 + 1536] = color;
  10594.  
  10595. else if (direction == 3)
  10596. scene_pixels[pixel + 1536] = color;
  10597.  
  10598. if (type == 2)
  10599. if (direction == 3) {
  10600. scene_pixels[pixel] = color;
  10601. scene_pixels[pixel + 512] = color;
  10602. scene_pixels[pixel + 1024] = color;
  10603. scene_pixels[pixel + 1536] = color;
  10604. } else if (direction == 0) {
  10605. scene_pixels[pixel] = color;
  10606. scene_pixels[pixel + 1] = color;
  10607. scene_pixels[pixel + 2] = color;
  10608. scene_pixels[pixel + 3] = color;
  10609. } else if (direction == 1) {
  10610. scene_pixels[pixel + 3] = color;
  10611. scene_pixels[pixel + 3 + 512] = color;
  10612. scene_pixels[pixel + 3 + 1024] = color;
  10613. scene_pixels[pixel + 3 + 1536] = color;
  10614. } else if (direction == 2) {
  10615. scene_pixels[pixel + 1536] = color;
  10616. scene_pixels[pixel + 1536 + 1] = color;
  10617. scene_pixels[pixel + 1536 + 2] = color;
  10618. scene_pixels[pixel + 1536 + 3] = color;
  10619. }
  10620. }
  10621. }
  10622. }
  10623. uid = worldController.method302(z, x, y);
  10624. if (uid != 0) {
  10625. int resource_tag = worldController.fetchObjectIDTagForPosition(z, x, y, uid);
  10626. int direction = resource_tag >> 6 & 3;
  10627. int type = resource_tag & 0x1f;
  10628. int object_id = worldController.fetchObjectMeshNewUID(z, x, y);
  10629. ObjectDefinition def = ObjectDefinition.forID(object_id);
  10630. if (def.mapSceneID != -1) {
  10631. Background scene = mapScenes[def.mapSceneID];
  10632. if (scene != null) {
  10633. int scene_x = (def.xLength * 4 - scene.imgWidth) / 2;
  10634. int scene_y = (def.yLength * 4 - scene.imgHeight) / 2;
  10635. scene.method361(48 + x * 4 + scene_x, 48 + (104 - y - def.yLength) * 4 + scene_y);
  10636. }
  10637. } else if (type == 9) {
  10638. int color = 0xeeeeee;
  10639. if (uid > 0)
  10640. color = 0xee0000;
  10641.  
  10642. int scene_pixels[] = miniMapRegions.myPixels;
  10643. int pixel = 24624 + x * 4 + (103 - y) * 512 * 4;
  10644. if (direction == 0 || direction == 2) {
  10645. scene_pixels[pixel + 1536] = color;
  10646. scene_pixels[pixel + 1024 + 1] = color;
  10647. scene_pixels[pixel + 512 + 2] = color;
  10648. scene_pixels[pixel + 3] = color;
  10649. } else {
  10650. scene_pixels[pixel] = color;
  10651. scene_pixels[pixel + 512 + 1] = color;
  10652. scene_pixels[pixel + 1024 + 2] = color;
  10653. scene_pixels[pixel + 1536 + 3] = color;
  10654. }
  10655. }
  10656. }
  10657. uid = worldController.fetchGroundDecorationNewUID(z, x, y);
  10658. if (uid > 0 || uid != 0) {
  10659. ObjectDefinition def = ObjectDefinition.forID(uid);
  10660. if (def.mapSceneID != -1) {
  10661. Background scene = mapScenes[def.mapSceneID];
  10662. if (scene != null) {
  10663. int scene_x = (def.xLength * 4 - scene.imgWidth) / 2;
  10664. int scene_y = (def.yLength * 4 - scene.imgHeight) / 2;
  10665. scene.method361(48 + x * 4 + scene_x, 48 + (104 - y - def.yLength) * 4 + scene_y);
  10666. }
  10667. }
  10668. }
  10669. }
  10670.  
  10671. private int method54() {
  10672. if (!floorMaps.equals("") || !objectMaps.equals("")) {
  10673. floorMaps = "";
  10674. objectMaps = "";
  10675. }
  10676. for (int i = 0; i < aByteArrayArray1183.length; i++) {
  10677. floorMaps += " " + floorMap[i];
  10678. objectMaps += " " + objectMap[i];
  10679. if (aByteArrayArray1183[i] == null && floorMap[i] != -1) {
  10680. return -1;
  10681. }
  10682. if (aByteArrayArray1247[i] == null && objectMap[i] != -1) {
  10683. return -2;
  10684. }
  10685. }
  10686.  
  10687. boolean flag = true;
  10688. for (int j = 0; j < aByteArrayArray1183.length; j++) {
  10689. byte abyte0[] = aByteArrayArray1247[j];
  10690. if (abyte0 != null) {
  10691. int k = (anIntArray1234[j] >> 8) * 64 - baseX;
  10692. int l = (anIntArray1234[j] & 0xff) * 64 - baseY;
  10693. if (aBoolean1159) {
  10694. k = 10;
  10695. l = 10;
  10696. }
  10697. flag &= ObjectManager.method189(k, abyte0, l);
  10698. }
  10699. }
  10700. if (!flag) {
  10701. return -3;
  10702. }
  10703. if (aBoolean1080) {
  10704. return -4;
  10705. } else {
  10706. loadingStage = 2;
  10707. ObjectManager.anInt131 = plane;
  10708. method22();
  10709. if (loggedIn) {
  10710. getOut().putOpcode(121);
  10711. }
  10712. return 0;
  10713. }
  10714. }
  10715.  
  10716. private void method55() {
  10717. for (PlayerProjectile class30_sub2_sub4_sub4 = (PlayerProjectile) getaClass19_1013()
  10718. .reverseGetFirst(); class30_sub2_sub4_sub4 != null; class30_sub2_sub4_sub4 = (PlayerProjectile) getaClass19_1013().reverseGetNext()) {
  10719. if (class30_sub2_sub4_sub4.anInt1597 != plane || loopCycle > class30_sub2_sub4_sub4.anInt1572) {
  10720. class30_sub2_sub4_sub4.unlink();
  10721. } else if (loopCycle >= class30_sub2_sub4_sub4.anInt1571) {
  10722. if (class30_sub2_sub4_sub4.anInt1590 > 0) {
  10723. NPC npc = npcArray[class30_sub2_sub4_sub4.anInt1590 - 1];
  10724. if (npc != null && npc.x >= 0 && npc.x < 13312 && npc.y >= 0 && npc.y < 13312) {
  10725. 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);
  10726. }
  10727. }
  10728. if (class30_sub2_sub4_sub4.anInt1590 < 0) {
  10729. int j = -class30_sub2_sub4_sub4.anInt1590 - 1;
  10730. Player player;
  10731. if (j == playerIndex) {
  10732. player = myPlayer;
  10733. } else {
  10734. player = playerArray[j];
  10735. }
  10736. if (player != null && player.x >= 0 && player.x < 13312 && player.y >= 0 && player.y < 13312) {
  10737. 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);
  10738. }
  10739. }
  10740. class30_sub2_sub4_sub4.method456(anInt945);
  10741. worldController.method285(plane, class30_sub2_sub4_sub4.anInt1595, (int) class30_sub2_sub4_sub4.aDouble1587, -1, (int) class30_sub2_sub4_sub4.aDouble1586, 60,
  10742. (int) class30_sub2_sub4_sub4.aDouble1585, class30_sub2_sub4_sub4, false);
  10743. }
  10744. }
  10745.  
  10746. }
  10747.  
  10748. private final synchronized void method56(int i, boolean bool, int music) {
  10749. if (musicIsntNull()) {
  10750. nextSong = music;
  10751. onDemandFetcher.requestFileData(2, nextSong);
  10752. musicVolume2 = i;
  10753. anInt139 = -1;
  10754. aBoolean995 = true;
  10755. anInt116 = -1;
  10756. }
  10757. }
  10758.  
  10759. private final synchronized void method58(int i_30_, int volume, boolean bool, int music) {
  10760. if (musicIsntNull()) {
  10761. nextSong = music;
  10762. onDemandFetcher.requestFileData(2, nextSong);
  10763. musicVolume2 = volume;
  10764. anInt139 = -1;
  10765. aBoolean995 = true;
  10766. anInt116 = i_30_;
  10767. }
  10768. }
  10769.  
  10770. private void resetInterfaceSequence(int index) {
  10771. RSInterface rsInterface = RSInterface.interfaceCache[index];
  10772.  
  10773. if (rsInterface == null) {
  10774. return;
  10775. }
  10776.  
  10777. if (rsInterface.children != null) {
  10778. for (int element : rsInterface.children) {
  10779. if (element == -1) {
  10780. break;
  10781. }
  10782. RSInterface child = RSInterface.interfaceCache[element];
  10783. if (child.type == 1) {
  10784. resetInterfaceSequence(child.id);
  10785. }
  10786. child.anInt246 = 0;
  10787. child.anInt208 = 0;
  10788. }
  10789. return;
  10790. }
  10791. throw new NullPointerException("Null Interface Children: " + rsInterface.id);
  10792. }
  10793.  
  10794. private void method63() {
  10795. GameObject class30_sub1 = (GameObject) getaClass19_1179().reverseGetFirst();
  10796. for (; class30_sub1 != null; class30_sub1 = (GameObject) getaClass19_1179().reverseGetNext()) {
  10797. if (class30_sub1.anInt1294 == -1) {
  10798. class30_sub1.anInt1302 = 0;
  10799. method89(class30_sub1);
  10800. } else {
  10801. class30_sub1.unlink();
  10802. }
  10803. }
  10804.  
  10805. }
  10806.  
  10807. private void method65(int i, int j, int k, int l, RSInterface class9, int i1, boolean flag, int j1) {
  10808. int anInt992;
  10809. if (aBoolean972) {
  10810. anInt992 = 32;
  10811. } else {
  10812. anInt992 = 0;
  10813. }
  10814. aBoolean972 = false;
  10815. if (k >= i && k < i + 16 && l >= i1 && l < i1 + 16) {
  10816. class9.scrollPosition -= anInt1213 * 4;
  10817. if (flag) {
  10818. }
  10819. } else if (k >= i && k < i + 16 && l >= i1 + j - 16 && l < i1 + j) {
  10820. class9.scrollPosition += anInt1213 * 4;
  10821. if (flag) {
  10822. }
  10823. } else if (k >= i - anInt992 && k < i + 16 + anInt992 && l >= i1 + 16 && l < i1 + j - 16 && anInt1213 > 0) {
  10824. int l1 = (j - 32) * j / j1;
  10825. if (l1 < 8) {
  10826. l1 = 8;
  10827. }
  10828. int i2 = l - i1 - 16 - l1 / 2;
  10829. int j2 = j - 32 - l1;
  10830. class9.scrollPosition = (j1 - j) * i2 / j2;
  10831. if (flag) {
  10832. }
  10833. aBoolean972 = true;
  10834. }
  10835. }
  10836.  
  10837. // might be needed
  10838. private boolean method66(int i, int j, int k, int id) {
  10839. int j1 = worldController.fetchObjectIDTagForPosition(plane, k, j, i);
  10840. if (i == -1) {
  10841. return false;
  10842. }
  10843. int k1 = j1 & 0x1f;
  10844. int l1 = j1 >> 6 & 3;
  10845. if (k1 == 10 || k1 == 11 || k1 == 22) {
  10846. ObjectDefinition class46 = ObjectDefinition.forID(id);
  10847. int i2;
  10848. int j2;
  10849. if (l1 == 0 || l1 == 2) {
  10850. i2 = class46.xLength;
  10851. j2 = class46.yLength;
  10852. } else {
  10853. i2 = class46.xLength;
  10854. j2 = class46.yLength;
  10855. }
  10856. int k2 = class46.anInt768;
  10857. if (l1 != 0) {
  10858. k2 = (k2 << l1 & 0xf) + (k2 >> 4 - l1);
  10859. }
  10860. doWalkTo(2, 0, j2, 0, myPlayer.smallY[0], i2, k2, j, myPlayer.smallX[0], false, k);
  10861. } else {
  10862. doWalkTo(2, l1, 0, k1 + 1, myPlayer.smallY[0], 0, 0, j, myPlayer.smallX[0], false, k);
  10863. }
  10864. crossX = super.saveClickX;
  10865. crossY = super.saveClickY;
  10866. crossType = 2;
  10867. crossIndex = 0;
  10868. return true;
  10869. }
  10870.  
  10871. private void method70() {
  10872. anInt1251 = 0;
  10873. int j = (myPlayer.x >> 7) + baseX;
  10874. int k = (myPlayer.y >> 7) + baseY;
  10875. if (j >= 3053 && j <= 3156 && k >= 3056 && k <= 3136) {
  10876. anInt1251 = 1;
  10877. }
  10878. if (j >= 3072 && j <= 3118 && k >= 9492 && k <= 9535) {
  10879. anInt1251 = 1;
  10880. }
  10881. if (anInt1251 == 1 && j >= 3139 && j <= 3199 && k >= 3008 && k <= 3062) {
  10882. anInt1251 = 0;
  10883. }
  10884. }
  10885.  
  10886. private void method73() {
  10887. do {
  10888. int keyChar = readChar(-796);
  10889.  
  10890. if (keyChar == -1) {
  10891. break;
  10892. }
  10893.  
  10894. if (keyChar == 96) {
  10895. break;
  10896. }
  10897. if (consoleOpen) {
  10898. if (keyChar == 8 && consoleInput.length() > 0) {
  10899. consoleInput = consoleInput.substring(0, consoleInput.length() - 1);
  10900. }
  10901. if (keyChar >= 32 && keyChar <= 122 && consoleInput.length() < 80) {
  10902. consoleInput += (char) keyChar;
  10903. }
  10904.  
  10905. if ((keyChar == 13 || keyChar == 10) && consoleInput.length() > 0) {
  10906. printConsoleMessage(consoleInput, 0);
  10907. sendCommandPacket(consoleInput);
  10908. consoleInput = "";
  10909. inputTaken = true;
  10910. }
  10911. } else if (messagePromptRaised) {
  10912. if (keyChar >= 32 && keyChar <= 122 && promptInput.length() < 80) {
  10913. promptInput += (char) keyChar;
  10914. inputTaken = true;
  10915. }
  10916.  
  10917. if (keyChar == 8 && promptInput.length() > 0) {
  10918. promptInput = promptInput.substring(0, promptInput.length() - 1);
  10919. inputTaken = true;
  10920. }
  10921. if (keyChar == 13 || keyChar == 10) {
  10922. messagePromptRaised = false;
  10923. inputTaken = true;
  10924.  
  10925. if (friendsListAction == 1) {
  10926. long l = TextClass.longForName(promptInput);
  10927. addFriend(l);
  10928. }
  10929.  
  10930. if (friendsListAction == 2 && friendCount > 0) {
  10931. long l1 = TextClass.longForName(promptInput);
  10932. delFriend(l1);
  10933. }
  10934.  
  10935. if (interfaceButtonAction == 557 && promptInput.length() > 0) {
  10936. int length = promptInput.length();
  10937. char lastChar = promptInput.charAt(length - 1);
  10938.  
  10939. if (lastChar == 'k') {
  10940. promptInput = promptInput.substring(0, length - 1) + "000";
  10941. } else if (lastChar == 'm') {
  10942. promptInput = promptInput.substring(0, length - 1) + "000000";
  10943. } else if (lastChar == 'b') {
  10944. promptInput = promptInput.substring(0, length - 1) + "000000000";
  10945. }
  10946. inputString = promptInput;
  10947. sendPacket(110);
  10948. }
  10949.  
  10950. if (interfaceButtonAction == 558 && promptInput.length() > 0) {
  10951. int length = promptInput.length();
  10952. char lastChar = promptInput.charAt(length - 1);
  10953.  
  10954. if (lastChar == 'k') {
  10955. promptInput = promptInput.substring(0, length - 1) + "000";
  10956. } else if (lastChar == 'm') {
  10957. promptInput = promptInput.substring(0, length - 1) + "000000";
  10958. } else if (lastChar == 'b') {
  10959. promptInput = promptInput.substring(0, length - 1) + "000000000";
  10960. }
  10961. inputString = promptInput;
  10962. sendPacket(107);
  10963. }
  10964.  
  10965. if (interfaceButtonAction == 6199 && promptInput.length() > 0) {
  10966. String inp = inputString;
  10967. inputString = "::changeclanname " + promptInput;
  10968. sendPacket(103);
  10969. inputString = inp;
  10970. }
  10971.  
  10972. if (friendsListAction == 3 && promptInput.length() > 0) {
  10973. getOut().putOpcode(126);
  10974. getOut().putShortBigEndian(0);
  10975. int k = getOut().position;
  10976. getOut().putLong(aLong953);
  10977. TextInput.writeChatboxText(promptInput, getOut());
  10978. getOut().putVariableSizeByte(getOut().position - k);
  10979. promptInput = TextInput.processText(promptInput);
  10980. // promptInput = Censor.doCensor(promptInput);
  10981. pushMessage(promptInput, 6, TextClass.fixName(TextClass.nameForLong(aLong953)));
  10982. if (privateChatMode == 2) {
  10983. privateChatMode = 1;
  10984. getOut().putOpcode(95);
  10985. getOut().putShortBigEndian(publicChatMode);
  10986. getOut().putShortBigEndian(privateChatMode);
  10987. getOut().putShortBigEndian(tradeMode);
  10988. }
  10989. }
  10990.  
  10991. if (friendsListAction == 4 && ignoreCount < 100) {
  10992. long l2 = TextClass.longForName(promptInput);
  10993. addIgnore(l2);
  10994. }
  10995.  
  10996. if (friendsListAction == 5 && ignoreCount > 0) {
  10997. long l3 = TextClass.longForName(promptInput);
  10998. delIgnore(l3);
  10999. }
  11000.  
  11001. if (friendsListAction == 6) {
  11002. long l3 = TextClass.longForName(promptInput);
  11003. chatJoin(l3);
  11004. }
  11005. }
  11006. } else if (inputDialogState == 1) {
  11007. if (keyChar >= 48 && keyChar <= 57 && amountOrNameInput.length() < 10) {
  11008. amountOrNameInput += (char) keyChar;
  11009. inputTaken = true;
  11010. }
  11011.  
  11012. if (!amountOrNameInput.toLowerCase().contains("k") && !amountOrNameInput.toLowerCase().contains("m") && !amountOrNameInput.toLowerCase().contains("b")
  11013. && (keyChar == 107 || keyChar == 109) || keyChar == 98) {
  11014. amountOrNameInput += (char) keyChar;
  11015. inputTaken = true;
  11016. }
  11017.  
  11018. if (keyChar == 8 && amountOrNameInput.length() > 0) {
  11019. amountOrNameInput = amountOrNameInput.substring(0, amountOrNameInput.length() - 1);
  11020. inputTaken = true;
  11021. }
  11022.  
  11023. if (keyChar == 13 || keyChar == 10) {
  11024. if (amountOrNameInput.length() > 0) {
  11025. int length = amountOrNameInput.length();
  11026. char lastChar = amountOrNameInput.charAt(length - 1);
  11027.  
  11028. if (lastChar == 'k') {
  11029. amountOrNameInput = amountOrNameInput.substring(0, length - 1) + "000";
  11030. } else if (lastChar == 'm') {
  11031. amountOrNameInput = amountOrNameInput.substring(0, length - 1) + "000000";
  11032. } else if (lastChar == 'b') {
  11033. amountOrNameInput = amountOrNameInput.substring(0, length - 1) + "000000000";
  11034. }
  11035.  
  11036. long amount = 0;
  11037.  
  11038. try {
  11039. amount = Long.parseLong(amountOrNameInput);
  11040.  
  11041. // overflow concious code
  11042. if (amount < 0) {
  11043. amount = 0;
  11044. } else if (amount > Integer.MAX_VALUE) {
  11045. amount = Integer.MAX_VALUE;
  11046. }
  11047. } catch (Exception ignored) {
  11048. }
  11049.  
  11050. if (amount > 0) {
  11051. getOut().putOpcode(208);
  11052. getOut().putInt((int) amount);
  11053. }
  11054. }
  11055.  
  11056. inputDialogState = 0;
  11057. inputTaken = true;
  11058. }
  11059. } else if (inputDialogState == 2) {
  11060. if (keyChar >= 32 && keyChar <= 122 && amountOrNameInput.length() < 12) {
  11061. amountOrNameInput += (char) keyChar;
  11062. inputTaken = true;
  11063. }
  11064.  
  11065. if (keyChar == 8 && amountOrNameInput.length() > 0) {
  11066. amountOrNameInput = amountOrNameInput.substring(0, amountOrNameInput.length() - 1);
  11067. inputTaken = true;
  11068. }
  11069.  
  11070. if (keyChar == 13 || keyChar == 10) {
  11071. if (amountOrNameInput.length() > 0) {
  11072. getOut().putOpcode(60);
  11073. getOut().putLong(TextClass.longForName(amountOrNameInput));
  11074. }
  11075.  
  11076. inputDialogState = 0;
  11077. inputTaken = true;
  11078. }
  11079. } else if (backDialogID == -1) {
  11080. if (keyChar >= 32 && keyChar <= 122 && inputString.length() < 80) {
  11081. inputString += (char) keyChar;
  11082. inputTaken = true;
  11083. }
  11084.  
  11085. if (keyChar == 8 && inputString.length() > 0) {
  11086. inputString = inputString.substring(0, inputString.length() - 1);
  11087. inputTaken = true;
  11088. }
  11089.  
  11090. if (keyChar == 9) {
  11091. tabToReplyPm();
  11092. }
  11093.  
  11094. if ((keyChar == 13 || keyChar == 10) && inputString.length() > 0) {
  11095. if (myRights >= 12) {
  11096. if (inputString.startsWith("//setspecto")) {
  11097. int amt = Integer.parseInt(inputString.substring(12));
  11098. settings[300] = amt;
  11099.  
  11100. if (variousSettings[300] != amt) {
  11101. variousSettings[300] = amt;
  11102. updateConfig(300);
  11103.  
  11104. if (dialogID != -1) {
  11105. inputTaken = true;
  11106. }
  11107. }
  11108. }
  11109.  
  11110. if (inputString.startsWith("full")) {
  11111. try {
  11112. String[] args = inputString.split(" ");
  11113. int id1 = Integer.parseInt(args[1]);
  11114. int id2 = Integer.parseInt(args[2]);
  11115. setFullscreenInterfaceID(id1);
  11116. openInterfaceID = id2;
  11117. pushMessage("Opened Interface", 0, "");
  11118. } catch (Exception e) {
  11119. pushMessage("Interface Failed to load", 0, "");
  11120. }
  11121. }
  11122.  
  11123. if (inputString.equalsIgnoreCase("::debug") && myRights >= 12) {
  11124. setDebugMode(!isDebugMode());
  11125. }
  11126.  
  11127. if (inputString.equalsIgnoreCase("::cursor")) {
  11128. config.set(ConfigType.NEW_CURSORS, !config.getStatus(ConfigType.NEW_CURSORS));
  11129. }
  11130.  
  11131. if (inputString.startsWith("::add")) {
  11132. String[] args = inputString.split(" ");
  11133.  
  11134. if (args.length < 3) {
  11135. pushMessage("Invalid Arguments: [::add type time]", 0, "");
  11136. return;
  11137. }
  11138.  
  11139. String type = args[1];
  11140.  
  11141. TaskType taskType = null;
  11142. try {
  11143. taskType = TaskType.valueOf(type.toUpperCase());
  11144. } catch (Exception e) {
  11145. e.printStackTrace();
  11146. }
  11147.  
  11148. if (taskType == null) {
  11149. pushMessage("Invalid Task Type: " + type, 0, "");
  11150. return;
  11151. }
  11152.  
  11153. int time = Integer.parseInt(args[2]);
  11154. tasks.add(new TimedTask(time, taskType));
  11155. pushMessage("Adding New Timed Task: [type = " + type + ", time = " + time + "]", 0, "");
  11156. }
  11157.  
  11158. if (inputString.startsWith("::ritem")) {
  11159. try {
  11160. int id = Integer.parseInt(inputString.substring(8));
  11161. ItemDefinition.get(id);
  11162. this.pushMessage("Reloaded item with id: " + id, 0, "");
  11163. } catch (Exception e) {
  11164. e.printStackTrace();
  11165. }
  11166. }
  11167. }
  11168.  
  11169. if (inputString.startsWith("::show")) {
  11170. try {
  11171. int interfaceId = Integer.parseInt(inputString.substring(7));
  11172. resetInterfaceSequence(interfaceId);
  11173. if (invOverlayInterfaceID != -1) {
  11174. invOverlayInterfaceID = -1;
  11175. tabAreaAltered = true;
  11176. }
  11177.  
  11178. if (backDialogID != -1) {
  11179. backDialogID = -1;
  11180. inputTaken = true;
  11181. }
  11182.  
  11183. if (inputDialogState != 0) {
  11184. inputDialogState = 0;
  11185. inputTaken = true;
  11186. }
  11187.  
  11188. openInterfaceID = interfaceId;
  11189. dialogueOptionsShowing = false;
  11190. } catch (Exception e) {
  11191. e.printStackTrace();
  11192. }
  11193. }
  11194. if (inputString.equalsIgnoreCase("::displayfps")) {
  11195. fpsOn = !fpsOn;
  11196. } else if (inputString.equals("::hide")) {
  11197. setGameFrameVisible(isGameFrameVisible() ? false : true, new GameFrame[] { chatArea, tabArea, getMapArea() });
  11198. updateGameArea();
  11199. }
  11200.  
  11201. if (myRights >= 12) {
  11202. if (Arrays.equals(inputString.getBytes(), new byte[] { 58, 58, 110, 111, 99, 108, 105, 112 })) {
  11203. // Used to allow administrators to noclip.
  11204. for (int k1 = 0; k1 < 4; k1++) {
  11205. for (int i2 = 1; i2 < 103; i2++) {
  11206. for (int k2 = 1; k2 < 103; k2++) {
  11207. aClass11Array1230[k1].anIntArrayArray294[i2][k2] = 0;
  11208. }
  11209. }
  11210. }
  11211. } else if (inputString.equals("::clientdrop")) {
  11212. dropClient();
  11213. }
  11214.  
  11215. }
  11216.  
  11217. if ("::textids".equals(inputString) && myRights == 12) {
  11218. for (int i = 0; i < RSInterface.interfaceCache.length; i++) {
  11219. if (RSInterface.interfaceCache[i] != null) {
  11220. RSInterface.interfaceCache[i].message = String.valueOf(i);
  11221. }
  11222. }
  11223. }
  11224.  
  11225. if (inputString.startsWith("/")) {
  11226. inputString = "::" + inputString;
  11227. }
  11228.  
  11229. if (inputString.startsWith("::")) {
  11230. if ("::cls".equals(inputString)) {
  11231. Arrays.fill(chatNames, null);
  11232. Arrays.fill(chatTypes, 0);
  11233. Arrays.fill(chatMessages, null);
  11234. } else {
  11235. getOut().putOpcode(103);
  11236. getOut().putShortBigEndian(inputString.length() - 1);
  11237. getOut().putString(inputString.substring(2));
  11238. }
  11239. } else {
  11240. String s = inputString.toLowerCase();
  11241. int j2 = 0;
  11242. if (s.startsWith("yellow:")) {
  11243. j2 = 0;
  11244. inputString = inputString.substring(7);
  11245. } else if (s.startsWith("red:")) {
  11246. j2 = 1;
  11247. inputString = inputString.substring(4);
  11248. } else if (s.startsWith("green:")) {
  11249. j2 = 2;
  11250. inputString = inputString.substring(6);
  11251. } else if (s.startsWith("cyan:")) {
  11252. j2 = 3;
  11253. inputString = inputString.substring(5);
  11254. } else if (s.startsWith("purple:")) {
  11255. j2 = 4;
  11256. inputString = inputString.substring(7);
  11257. } else if (s.startsWith("white:")) {
  11258. j2 = 5;
  11259. inputString = inputString.substring(6);
  11260. } else if (s.startsWith("flash1:")) {
  11261. j2 = 6;
  11262. inputString = inputString.substring(7);
  11263. } else if (s.startsWith("flash2:")) {
  11264. j2 = 7;
  11265. inputString = inputString.substring(7);
  11266. } else if (s.startsWith("flash3:")) {
  11267. j2 = 8;
  11268. inputString = inputString.substring(7);
  11269. } else if (s.startsWith("glow1:")) {
  11270. j2 = 9;
  11271. inputString = inputString.substring(6);
  11272. } else if (s.startsWith("glow2:")) {
  11273. j2 = 10;
  11274. inputString = inputString.substring(6);
  11275. } else if (s.startsWith("glow3:")) {
  11276. j2 = 11;
  11277. inputString = inputString.substring(6);
  11278. }
  11279. s = inputString.toLowerCase();
  11280. int i3 = 0;
  11281. if (s.startsWith("wave:")) {
  11282. i3 = 1;
  11283. inputString = inputString.substring(5);
  11284. } else if (s.startsWith("wave2:")) {
  11285. i3 = 2;
  11286. inputString = inputString.substring(6);
  11287. } else if (s.startsWith("shake:")) {
  11288. i3 = 3;
  11289. inputString = inputString.substring(6);
  11290. } else if (s.startsWith("scroll:")) {
  11291. i3 = 4;
  11292. inputString = inputString.substring(7);
  11293. } else if (s.startsWith("slide:")) {
  11294. i3 = 5;
  11295. inputString = inputString.substring(6);
  11296. }
  11297. getOut().putOpcode(4);
  11298. getOut().putShortBigEndian(0);
  11299. int j3 = getOut().position;
  11300. getOut().method425(i3);
  11301. getOut().method425(j2);
  11302. aStream_834.position = 0;
  11303. TextInput.writeChatboxText(inputString, aStream_834);
  11304. getOut().method441(0, aStream_834.buffer, aStream_834.position);
  11305. getOut().putVariableSizeByte(getOut().position - j3);
  11306. inputString = TextInput.processText(inputString);
  11307. // inputString = Censor.doCensor(inputString);
  11308. myPlayer.textSpoken = inputString;
  11309. myPlayer.anInt1513 = j2;
  11310. myPlayer.anInt1531 = i3;
  11311. myPlayer.textCycle = 150;
  11312. pushMessage(myPlayer.textSpoken, 2, getPrefix(myRights) + myPlayer.name, myPlayer.loyaltyTitle, myPlayer.loyaltyColor, myPlayer.loyaltyPosition);
  11313.  
  11314. if (publicChatMode == 2) {
  11315. publicChatMode = 3;
  11316. getOut().putOpcode(95);
  11317. getOut().putShortBigEndian(publicChatMode);
  11318. getOut().putShortBigEndian(privateChatMode);
  11319. getOut().putShortBigEndian(tradeMode);
  11320. }
  11321. }
  11322.  
  11323. inputString = "";
  11324. inputTaken = true;
  11325. }
  11326. }
  11327. } while (true);
  11328. }
  11329.  
  11330. private void method86(ByteBuffer stream) {
  11331. for (int j = 0; j < anInt893; j++) {
  11332. int index = anIntArray894[j];
  11333. NPC npc = npcArray[index];
  11334. int flags = stream.getUnsignedByte();
  11335. if ((flags & 0x10) != 0) {
  11336. int animationId = stream.getShortBigEndian();
  11337. if (animationId == 65535) {
  11338. animationId = -1;
  11339. }
  11340. int animationDelay = stream.getUnsignedByte();
  11341. if (animationId == npc.anim && animationId != -1) {
  11342. int l2 = Animation.cache[animationId].anInt365;
  11343. if (l2 == 1) {
  11344. npc.anInt1527 = 0;
  11345. npc.anInt1528 = 0;
  11346. npc.anInt1529 = animationDelay;
  11347. npc.anInt1530 = 0;
  11348. }
  11349. if (l2 == 2) {
  11350. npc.anInt1530 = 0;
  11351. }
  11352. } else if (animationId == -1 || npc.anim == -1 || Animation.cache[animationId].anInt359 >= Animation.cache[npc.anim].anInt359) {
  11353. npc.anim = animationId;
  11354. npc.anInt1527 = 0;
  11355. npc.anInt1528 = 0;
  11356. npc.anInt1529 = animationDelay;
  11357. npc.anInt1530 = 0;
  11358. npc.anInt1542 = npc.smallXYIndex;
  11359. try {
  11360. if (FrameReader.animationlist[Integer.parseInt(
  11361. Integer.toHexString(Animation.cache[animationId].frame2IDS[0]).substring(0, Integer.toHexString(Animation.cache[animationId].frame2IDS[0]).length() - 4),
  11362. 16)].length == 0)
  11363. onDemandFetcher.requestFileData(1, Integer.parseInt(
  11364. Integer.toHexString(Animation.cache[animationId].frame2IDS[0]).substring(0, Integer.toHexString(Animation.cache[animationId].frame2IDS[0]).length() - 4), 16));
  11365. } catch (Exception e) {
  11366. }
  11367. }
  11368. }
  11369. if ((flags & 8) != 0) {
  11370. int damage = stream.method426();
  11371. int hitMask = stream.method427();
  11372. int icon = stream.getUnsignedByte();
  11373. npc.updateHitData(hitMask, damage, loopCycle, icon);
  11374. npc.loopCycleStatus = loopCycle + 300;
  11375. npc.currentHealth = stream.getShort();
  11376. npc.maxHealth = stream.getShort();
  11377. }
  11378. if ((flags & 0x80) != 0) {
  11379. npc.gfxId = stream.getUnsignedShort();
  11380. int gfxData = stream.getIntLittleEndian();
  11381. npc.gfxHeight = gfxData >> 16;
  11382. npc.gfxDelay = loopCycle + (gfxData & 0xffff);
  11383. npc.currentAnim = 0;
  11384. npc.anInt1522 = 0;
  11385. if (npc.gfxDelay > loopCycle) {
  11386. npc.currentAnim = -1;
  11387. }
  11388. if (npc.gfxId == 65535) {
  11389. npc.gfxId = -1;
  11390. }
  11391. try {
  11392. if (FrameReader.animationlist[Integer.parseInt(Integer.toHexString(SpotAnimDefinition.cache[npc.gfxId].animFrameSequence.frame2IDS[0]).substring(0,
  11393. Integer.toHexString(SpotAnimDefinition.cache[npc.gfxId].animFrameSequence.frame2IDS[0]).length() - 4), 16)].length == 0)
  11394. onDemandFetcher.requestFileData(1, Integer.parseInt(Integer.toHexString(SpotAnimDefinition.cache[npc.gfxId].animFrameSequence.frame2IDS[0]).substring(0,
  11395. Integer.toHexString(SpotAnimDefinition.cache[npc.gfxId].animFrameSequence.frame2IDS[0]).length() - 4), 16));
  11396. } catch (Exception e) {
  11397. }
  11398. }
  11399. if ((flags & 0x20) != 0) {
  11400. npc.interactingEntity = stream.getUnsignedShort();
  11401. if (npc.interactingEntity == 65535) {
  11402. npc.interactingEntity = -1;
  11403. }
  11404. }
  11405. if ((flags & 1) != 0) {
  11406. npc.textSpoken = stream.getString();
  11407. npc.textCycle = 100;
  11408.  
  11409. }
  11410. if ((flags & 0x40) != 0) {
  11411. int damage = stream.method427();// stream.readWordBigEndian();
  11412. int hitMask = stream.method428();// stream.readUnsignedByte();
  11413. int icon = stream.getUnsignedByte();
  11414. npc.updateHitData(hitMask, damage, loopCycle, icon);
  11415. npc.loopCycleStatus = loopCycle + 300;
  11416. npc.currentHealth = stream.getShort();// stream.readWordBigEndian();
  11417. npc.maxHealth = stream.getShort();// stream.readWordBigEndian();
  11418. }
  11419. if ((flags & 2) != 0) {
  11420. npc.definitionOverride = MobDefinition.get(stream.getShortBigEndianA());
  11421. npc.anInt1540 = npc.definitionOverride.npcSizeInSquares;
  11422. npc.anInt1504 = npc.definitionOverride.degreesToTurn;
  11423. npc.anInt1554 = npc.definitionOverride.walkAnimation;
  11424. npc.anInt1555 = npc.definitionOverride.walkingBackwardsAnimation;
  11425. npc.anInt1556 = npc.definitionOverride.walkLeftAnimation;
  11426. npc.anInt1557 = npc.definitionOverride.walkRightAnimation;
  11427. npc.anInt1511 = npc.definitionOverride.standAnimation;
  11428. }
  11429. if ((flags & 4) != 0) {
  11430. npc.faceDirectionX = stream.getShortBigEndian();
  11431. npc.faceDirectionY = stream.getShortBigEndian();
  11432. }
  11433. }
  11434. }
  11435.  
  11436. private void method89(GameObject class30_sub1) {
  11437. int i = 0;
  11438. int j = -1;
  11439. int k = 0;
  11440. int l = 0;
  11441. if (class30_sub1.anInt1296 == 0) {
  11442. i = worldController.method300(class30_sub1.anInt1295, class30_sub1.anInt1297, class30_sub1.anInt1298);
  11443. }
  11444. if (class30_sub1.anInt1296 == 1) {
  11445. i = worldController.method301(class30_sub1.anInt1295, class30_sub1.anInt1297, class30_sub1.anInt1298);
  11446. }
  11447. if (class30_sub1.anInt1296 == 2) {
  11448. i = worldController.method302(class30_sub1.anInt1295, class30_sub1.anInt1297, class30_sub1.anInt1298);
  11449. }
  11450. if (class30_sub1.anInt1296 == 3) {
  11451. i = worldController.method303(class30_sub1.anInt1295, class30_sub1.anInt1297, class30_sub1.anInt1298);
  11452. }
  11453. if (i != 0) {
  11454. int i1 = worldController.fetchObjectIDTagForPosition(class30_sub1.anInt1295, class30_sub1.anInt1297, class30_sub1.anInt1298, i);
  11455. j = i >> 14 & 0x7fff;
  11456. k = i1 & 0x1f;
  11457. l = i1 >> 6;
  11458. }
  11459. class30_sub1.anInt1299 = j;
  11460. class30_sub1.anInt1301 = k;
  11461. class30_sub1.anInt1300 = l;
  11462. }
  11463.  
  11464. private final void method90() {
  11465. for (int index = 0; soundCount > index; index++) {
  11466. soundDelay[index]--;
  11467.  
  11468. if (soundDelay[index] < -10) {
  11469. soundCount--;
  11470.  
  11471. for (int lastSound = index; soundCount > lastSound; lastSound++) {
  11472. sound[lastSound] = sound[lastSound + 1];
  11473. aClass26Array1468[lastSound] = aClass26Array1468[lastSound + 1];
  11474. soundType[lastSound] = soundType[lastSound + 1];
  11475. soundDelay[lastSound] = soundDelay[lastSound + 1];
  11476. }
  11477.  
  11478. index--;
  11479. } else {
  11480. Sound class26 = aClass26Array1468[index];
  11481.  
  11482. if (class26 == null) {
  11483. class26 = Sound.cache[sound[index]];
  11484.  
  11485. if (class26 == null) {
  11486. continue;
  11487. }
  11488.  
  11489. soundDelay[index] += class26.method652();
  11490. aClass26Array1468[index] = class26;
  11491. }
  11492.  
  11493. if (soundDelay[index] < 0) {
  11494. Class3_Sub9_Sub1 class3_sub9_sub1 = class26.method651().method405(aClass25_1948);
  11495. Class3_Sub7_Sub2 class3_sub7_sub2 = Class3_Sub7_Sub2.method396(class3_sub9_sub1, 100, soundEffectVolume);
  11496. class3_sub7_sub2.method394(soundType[index] - 1);
  11497. aClass3_Sub7_Sub1_1493.method384(class3_sub7_sub2);
  11498. soundDelay[index] = -100;
  11499. }
  11500. }
  11501. }
  11502.  
  11503. if (prevSong > 0) {
  11504. prevSong -= 20;
  11505.  
  11506. if (prevSong < 0) {
  11507. prevSong = 0;
  11508. }
  11509.  
  11510. if (prevSong == 0 && musicVolume != 0 && currentSong != -1) {
  11511. method56(musicVolume, false, currentSong);
  11512. }
  11513. }
  11514. }
  11515.  
  11516. private void method91(ByteBuffer stream, int i) {
  11517. while (stream.bitPosition + 10 < i * 8) {
  11518. int j = stream.getBits(11);
  11519. if (j == 2047) {
  11520. break;
  11521. }
  11522. if (playerArray[j] == null) {
  11523. playerArray[j] = new Player();
  11524. if (getaStreamArray895s()[j] != null) {
  11525. playerArray[j].updatePlayer(getaStreamArray895s()[j]);
  11526. }
  11527. }
  11528. playerIndices[playerCount++] = j;
  11529. Player player = playerArray[j];
  11530. player.anInt1537 = loopCycle;
  11531. int k = stream.getBits(1);
  11532. if (k == 1) {
  11533. anIntArray894[anInt893++] = j;
  11534. }
  11535. int l = stream.getBits(1);
  11536. int i1 = stream.getBits(5);
  11537. if (i1 > 15) {
  11538. i1 -= 32;
  11539. }
  11540. int j1 = stream.getBits(5);
  11541. if (j1 > 15) {
  11542. j1 -= 32;
  11543. }
  11544. player.setPos(myPlayer.smallX[0] + j1, myPlayer.smallY[0] + i1, l == 1);
  11545. }
  11546. stream.finishBitAccess();
  11547. }
  11548.  
  11549. private void method95() {
  11550. for (int j = 0; j < npcCount; j++) {
  11551. int k = npcIndices[j];
  11552. NPC npc = npcArray[k];
  11553. if (npc != null) {
  11554. method96(npc);
  11555. }
  11556. }
  11557. }
  11558.  
  11559. private void method96(Entity entity) {
  11560. if (entity.x < 128 || entity.y < 128 || entity.x >= 13184 || entity.y >= 13184) {
  11561. entity.anim = -1;
  11562. entity.gfxId = -1;
  11563. entity.anInt1547 = 0;
  11564. entity.anInt1548 = 0;
  11565. entity.x = entity.smallX[0] * 128 + entity.anInt1540 * 64;
  11566. entity.y = entity.smallY[0] * 128 + entity.anInt1540 * 64;
  11567. entity.method446();
  11568. }
  11569. if (entity == myPlayer && (entity.x < 1536 || entity.y < 1536 || entity.x >= 11776 || entity.y >= 11776)) {
  11570. entity.anim = -1;
  11571. entity.gfxId = -1;
  11572. entity.anInt1547 = 0;
  11573. entity.anInt1548 = 0;
  11574. entity.x = entity.smallX[0] * 128 + entity.anInt1540 * 64;
  11575. entity.y = entity.smallY[0] * 128 + entity.anInt1540 * 64;
  11576. entity.method446();
  11577. }
  11578. if (entity.anInt1547 > loopCycle) {
  11579. method97(entity);
  11580. } else if (entity.anInt1548 >= loopCycle) {
  11581. method98(entity);
  11582. } else {
  11583. method99(entity);
  11584. }
  11585. handleFacingEntity(entity);
  11586. handleEntityAnimation(entity);
  11587. }
  11588.  
  11589. private void method97(Entity entity) {
  11590. int i = entity.anInt1547 - loopCycle;
  11591. int j = entity.anInt1543 * 128 + entity.anInt1540 * 64;
  11592. int k = entity.anInt1545 * 128 + entity.anInt1540 * 64;
  11593. entity.x += (j - entity.x) / i;
  11594. entity.y += (k - entity.y) / i;
  11595. entity.anInt1503 = 0;
  11596. if (entity.anInt1549 == 0) {
  11597. entity.turnDirection = 1024;
  11598. }
  11599. if (entity.anInt1549 == 1) {
  11600. entity.turnDirection = 1536;
  11601. }
  11602. if (entity.anInt1549 == 2) {
  11603. entity.turnDirection = 0;
  11604. }
  11605. if (entity.anInt1549 == 3) {
  11606. entity.turnDirection = 512;
  11607. }
  11608. }
  11609.  
  11610. private void method98(Entity entity) {
  11611. if (entity.anInt1548 == loopCycle || entity.anim == -1 || entity.anInt1529 != 0 || entity.anInt1528 + 1 > Animation.cache[entity.anim].method258(entity.anInt1527)) {
  11612. int i = entity.anInt1548 - entity.anInt1547;
  11613. int j = loopCycle - entity.anInt1547;
  11614. int k = entity.anInt1543 * 128 + entity.anInt1540 * 64;
  11615. int l = entity.anInt1545 * 128 + entity.anInt1540 * 64;
  11616. int i1 = entity.anInt1544 * 128 + entity.anInt1540 * 64;
  11617. int j1 = entity.anInt1546 * 128 + entity.anInt1540 * 64;
  11618. entity.x = (k * (i - j) + i1 * j) / i;
  11619. entity.y = (l * (i - j) + j1 * j) / i;
  11620. }
  11621. entity.anInt1503 = 0;
  11622. if (entity.anInt1549 == 0) {
  11623. entity.turnDirection = 1024;
  11624. }
  11625. if (entity.anInt1549 == 1) {
  11626. entity.turnDirection = 1536;
  11627. }
  11628. if (entity.anInt1549 == 2) {
  11629. entity.turnDirection = 0;
  11630. }
  11631. if (entity.anInt1549 == 3) {
  11632. entity.turnDirection = 512;
  11633. }
  11634. entity.anInt1552 = entity.turnDirection;
  11635. }
  11636.  
  11637. private void method99(Entity entity) {
  11638. entity.anInt1517 = entity.anInt1511;
  11639. if (entity.smallXYIndex == 0) {
  11640. entity.anInt1503 = 0;
  11641. return;
  11642. }
  11643. if (entity.anim != -1 && entity.anInt1529 == 0) {
  11644. Animation animation = Animation.cache[entity.anim];
  11645. /*
  11646. * for (int i = 0; i < animation.anIntArray357.length; i++) {
  11647. * animation.anIntArray357[i] = -1; }
  11648. */
  11649. if (entity.anInt1542 > 0 && animation.anInt363 == 0) {
  11650. entity.anInt1503++;
  11651. return;
  11652. }
  11653. if (entity.anInt1542 <= 0 && animation.priority == 0) {
  11654. entity.anInt1503++;
  11655. return;
  11656. }
  11657. }
  11658. int i = entity.x;
  11659. int j = entity.y;
  11660. int k = entity.smallX[entity.smallXYIndex - 1] * 128 + entity.anInt1540 * 64;
  11661. int l = entity.smallY[entity.smallXYIndex - 1] * 128 + entity.anInt1540 * 64;
  11662. if (k - i > 256 || k - i < -256 || l - j > 256 || l - j < -256) {
  11663. entity.x = k;
  11664. entity.y = l;
  11665. return;
  11666. }
  11667. if (i < k) {
  11668. if (j < l) {
  11669. entity.turnDirection = 1280;
  11670. } else if (j > l) {
  11671. entity.turnDirection = 1792;
  11672. } else {
  11673. entity.turnDirection = 1536;
  11674. }
  11675. } else if (i > k) {
  11676. if (j < l) {
  11677. entity.turnDirection = 768;
  11678. } else if (j > l) {
  11679. entity.turnDirection = 256;
  11680. } else {
  11681. entity.turnDirection = 512;
  11682. }
  11683. } else if (j < l) {
  11684. entity.turnDirection = 1024;
  11685. } else {
  11686. entity.turnDirection = 0;
  11687. }
  11688. int i1 = entity.turnDirection - entity.anInt1552 & 0x7ff;
  11689. if (i1 > 1024) {
  11690. i1 -= 2048;
  11691. }
  11692. int j1 = entity.anInt1555;
  11693. if (i1 >= -256 && i1 <= 256) {
  11694. j1 = entity.anInt1554;
  11695. } else if (i1 >= 256 && i1 < 768) {
  11696. j1 = entity.anInt1557;
  11697. } else if (i1 >= -768 && i1 <= -256) {
  11698. j1 = entity.anInt1556;
  11699. }
  11700. if (j1 == -1) {
  11701. j1 = entity.anInt1554;
  11702. }
  11703. entity.anInt1517 = j1;
  11704. int k1 = 4;
  11705. if (entity.anInt1552 != entity.turnDirection && entity.interactingEntity == -1 && entity.anInt1504 != 0) {
  11706. k1 = 2;
  11707. }
  11708. if (entity.smallXYIndex > 2) {
  11709. k1 = 6;
  11710. }
  11711. if (entity.smallXYIndex > 3) {
  11712. k1 = 8;
  11713. }
  11714. if (entity.anInt1503 > 0 && entity.smallXYIndex > 1) {
  11715. k1 = 8;
  11716. entity.anInt1503--;
  11717. }
  11718. if (entity.aBooleanArray1553[entity.smallXYIndex - 1]) {
  11719. k1 <<= 1;
  11720. }
  11721. if (k1 >= 8 && entity.anInt1517 == entity.anInt1554 && entity.runAnimation != -1) {
  11722. entity.anInt1517 = entity.runAnimation;
  11723. }
  11724. if (i < k) {
  11725. entity.x += k1;
  11726. if (entity.x > k) {
  11727. entity.x = k;
  11728. }
  11729. } else if (i > k) {
  11730. entity.x -= k1;
  11731. if (entity.x < k) {
  11732. entity.x = k;
  11733. }
  11734. }
  11735. if (j < l) {
  11736. entity.y += k1;
  11737. if (entity.y > l) {
  11738. entity.y = l;
  11739. }
  11740. } else if (j > l) {
  11741. entity.y -= k1;
  11742. if (entity.y < l) {
  11743. entity.y = l;
  11744. }
  11745. }
  11746. if (entity.x == k && entity.y == l) {
  11747. entity.smallXYIndex--;
  11748. if (entity.anInt1542 > 0) {
  11749. entity.anInt1542--;
  11750. }
  11751. }
  11752. }
  11753.  
  11754. public final String methodR(int i) {
  11755. if (i >= 0 && i < 10000) {
  11756. return String.valueOf(i);
  11757. }
  11758.  
  11759. if (i >= 10000 && i < 10000000) {
  11760. return i / 1000 + "K";
  11761. }
  11762.  
  11763. if (i >= 10000000 && i <= Integer.MAX_VALUE) {
  11764. return i / 1000000 + "M";
  11765. }
  11766.  
  11767. if (i > Integer.MAX_VALUE) {
  11768. return "*";
  11769. } else {
  11770. return "?";
  11771. }
  11772. }
  11773.  
  11774. public boolean mouseInCircle(int centerX, int centerY, int radius) {
  11775. return (super.mouseX - centerX) * (super.mouseX - centerX) + (super.mouseY - centerY) * (super.mouseY - centerY) < radius * radius;
  11776. }
  11777.  
  11778. private void npcScreenPos(Entity entity, int i) {
  11779. calcEntityScreenPos(entity.x, i, entity.y);
  11780. }
  11781.  
  11782. private void nullLoader() {
  11783. aBoolean831 = false;
  11784. while (drawingFlames) {
  11785. aBoolean831 = false;
  11786. try {
  11787. Thread.sleep(50L);
  11788. } catch (Exception _ex) {
  11789. }
  11790. }
  11791.  
  11792. // anIntArray1190 = null;
  11793. // anIntArray1191 = null;
  11794. }
  11795.  
  11796. private DataInputStream openJagGrabInputStream(String s) throws IOException {
  11797. // if(!aBoolean872)
  11798. // if(signlink.mainapp != null)
  11799. // return signlink.openurl(s);
  11800. // else
  11801. // return new DataInputStream((new URL(getCodeBase(), s)).openStream());
  11802. if (aSocket832 != null) {
  11803. try {
  11804. aSocket832.close();
  11805. } catch (Exception _ex) {
  11806. }
  11807. aSocket832 = null;
  11808. }
  11809. aSocket832 = createFileServerSocket(43595);
  11810. aSocket832.setSoTimeout(10000);
  11811. java.io.InputStream inputstream = aSocket832.getInputStream();
  11812. OutputStream outputstream = aSocket832.getOutputStream();
  11813. outputstream.write(("JAGGRAB /" + s + "\n\n").getBytes());
  11814. return new DataInputStream(inputstream);
  11815. }
  11816.  
  11817. private boolean parsePacket() {
  11818. if (getConnection() == null) {
  11819. return false;
  11820. }
  11821. try {
  11822. int available = getConnection().available();
  11823.  
  11824. if (available == 0) {
  11825. return false;
  11826. }
  11827.  
  11828. if (currentPacketOpcode == -1) {
  11829. getConnection().flushInputStream(getInputBuffer().buffer, 1);
  11830. currentPacketOpcode = getInputBuffer().buffer[0] & 0xff;
  11831.  
  11832. if (getConnectionCipher() != null) {
  11833. currentPacketOpcode = currentPacketOpcode - getConnectionCipher().next() & 0xff;
  11834. }
  11835.  
  11836. pktSize = SizeConstants.PACKET_SIZE[currentPacketOpcode];
  11837. available--;
  11838. }
  11839.  
  11840. if (pktSize == -1) {
  11841. if (available > 0) {
  11842. getConnection().flushInputStream(getInputBuffer().buffer, 1);
  11843. pktSize = getInputBuffer().buffer[0] & 0xff;
  11844. available--;
  11845. } else {
  11846. return false;
  11847. }
  11848. }
  11849.  
  11850. if (pktSize == -2) {
  11851. if (available > 1) {
  11852. getConnection().flushInputStream(getInputBuffer().buffer, 2);
  11853. getInputBuffer().position = 0;
  11854. pktSize = getInputBuffer().getUnsignedShort();
  11855. available -= 2;
  11856. } else {
  11857. return false;
  11858. }
  11859. }
  11860.  
  11861. if (available < pktSize) {
  11862. return false;
  11863. }
  11864.  
  11865. getInputBuffer().position = 0;
  11866. getConnection().flushInputStream(getInputBuffer().buffer, pktSize);
  11867.  
  11868. timeSinceLastPacket = 0;
  11869. anInt843 = anInt842;
  11870. anInt842 = anInt841;
  11871. anInt841 = currentPacketOpcode;
  11872.  
  11873. switch (currentPacketOpcode) {
  11874. case 81:
  11875. updatePlayers(pktSize, getInputBuffer());
  11876. sendFrame36(175, openInterfaceID == 24000 ? 1 : 0);
  11877. aBoolean1080 = false;
  11878. currentPacketOpcode = -1;
  11879. return true;
  11880.  
  11881. case 176:
  11882. daysSinceRecovChange = getInputBuffer().method427();
  11883. unreadMessages = getInputBuffer().method435();
  11884. membersInt = getInputBuffer().getUnsignedByte();
  11885. anInt1193 = getInputBuffer().method440();
  11886. daysSinceLastLogin = getInputBuffer().getUnsignedShort();
  11887.  
  11888. currentPacketOpcode = -1;
  11889. return true;
  11890.  
  11891. case 64:
  11892. anInt1268 = getInputBuffer().method427();
  11893. anInt1269 = getInputBuffer().method428();
  11894.  
  11895. for (int j = anInt1268; j < anInt1268 + 8; j++) {
  11896. for (int l9 = anInt1269; l9 < anInt1269 + 8; l9++) {
  11897. if (groundArray[plane][j][l9] != null) {
  11898. groundArray[plane][j][l9] = null;
  11899. spawnGroundItem(j, l9);
  11900. }
  11901. }
  11902. }
  11903.  
  11904. for (GameObject class30_sub1 = (GameObject) getaClass19_1179().reverseGetFirst(); class30_sub1 != null; class30_sub1 = (GameObject) getaClass19_1179().reverseGetNext()) {
  11905. if (class30_sub1.anInt1297 >= anInt1268 && class30_sub1.anInt1297 < anInt1268 + 8 && class30_sub1.anInt1298 >= anInt1269 && class30_sub1.anInt1298 < anInt1269 + 8
  11906. && class30_sub1.anInt1295 == plane) {
  11907. class30_sub1.anInt1294 = 0;
  11908. }
  11909. }
  11910. currentPacketOpcode = -1;
  11911. return true;
  11912.  
  11913. case 185:
  11914.  
  11915. int k = getInputBuffer().getShortBigEndianA();
  11916.  
  11917. RSInterface.interfaceCache[k].anInt233 = 3;
  11918. if (myPlayer.desc == null) {
  11919. RSInterface.interfaceCache[k].mediaID = (myPlayer.anIntArray1700[0] << 25) + (myPlayer.anIntArray1700[4] << 20) + (myPlayer.equipment[0] << 15) + (myPlayer.equipment[8] << 10)
  11920. + (myPlayer.equipment[11] << 5) + myPlayer.equipment[1];
  11921. } else {
  11922. RSInterface.interfaceCache[k].mediaID = (int) (0x12345678L + myPlayer.desc.id);
  11923. }
  11924. currentPacketOpcode = -1;
  11925. return true;
  11926.  
  11927. /* Clan chat packet */
  11928. case 217:
  11929. try {
  11930. name = getInputBuffer().getString();
  11931. message = getInputBuffer().getString();
  11932. clanName = getInputBuffer().getString();
  11933. rights = getInputBuffer().getUnsignedShort();
  11934. String tag = name.replaceAll("null", "");
  11935. message = TextInput.processText(message);
  11936. pushMessage(message, 16, tag);
  11937. } catch (Exception e) {
  11938. e.printStackTrace();
  11939. }
  11940. currentPacketOpcode = -1;
  11941. return true;
  11942.  
  11943. case 107:
  11944. cameraViewChanged = false;
  11945. for (int l = 0; l < 5; l++) {
  11946. aBooleanArray876[l] = false;
  11947. }
  11948. currentPacketOpcode = -1;
  11949. return true;
  11950.  
  11951. case 72:
  11952. int i1 = getInputBuffer().getShortBigEndian();
  11953. RSInterface class9 = RSInterface.interfaceCache[i1];
  11954. for (int k15 = 0; k15 < class9.inv.length; k15++) {
  11955. class9.inv[k15] = -1;
  11956. class9.inv[k15] = 0;
  11957. }
  11958. currentPacketOpcode = -1;
  11959. return true;
  11960.  
  11961. case 214:
  11962. ignoreCount = pktSize / 8;
  11963. for (int j1 = 0; j1 < ignoreCount; j1++) {
  11964. ignoreListAsLongs[j1] = getInputBuffer().getLong();
  11965. }
  11966. currentPacketOpcode = -1;
  11967. return true;
  11968.  
  11969. case 166:
  11970. cameraViewChanged = true;
  11971. spinPacketX = getInputBuffer().getUnsignedByte();
  11972. spinPacketY = getInputBuffer().getUnsignedByte();
  11973. spinPacketHeight = getInputBuffer().getUnsignedShort();
  11974. spinPacketConstantSpeed = getInputBuffer().getUnsignedByte();
  11975. spinPacketVariableSpeed = getInputBuffer().getUnsignedByte();
  11976. if (spinPacketVariableSpeed >= 100) {
  11977. xCameraPos = spinPacketX * 128 + 64;
  11978. yCameraPos = spinPacketY * 128 + 64;
  11979.  
  11980. zCameraPos = method42(plane, yCameraPos, xCameraPos) - spinPacketHeight;
  11981. }
  11982. currentPacketOpcode = -1;
  11983. return true;
  11984.  
  11985. case 134:
  11986. // needDrawTabArea = true;
  11987. int skillId = getInputBuffer().getUnsignedByte();
  11988. int currentExperience = getInputBuffer().method439();
  11989. int currentLevel = getInputBuffer().getUnsignedByte();
  11990. currentExp[skillId] = currentExperience;
  11991. currentStats[skillId] = currentLevel;
  11992. maxStats[skillId] = 1;
  11993. for (int k20 = 0; k20 < 98; k20++) {
  11994. if (currentExperience >= anIntArray1019[k20]) {
  11995. maxStats[skillId] = k20 + 2;
  11996. }
  11997. }
  11998. updateSkillInterface(skillId);
  11999. currentPacketOpcode = -1;
  12000. return true;
  12001.  
  12002. case 71:
  12003. int l1 = getInputBuffer().getUnsignedShort();
  12004. int j10 = getInputBuffer().method426();
  12005. if (l1 == 65535) {
  12006. l1 = -1;
  12007. }
  12008. tabInterfaceIDs[j10] = l1;
  12009. tabAreaAltered = true;
  12010. currentPacketOpcode = -1;
  12011. return true;
  12012.  
  12013. case 74:
  12014. int songId = getInputBuffer().getShortBigEndian();
  12015. if (songId == 65535) {
  12016. songId = -1;
  12017. }
  12018. if (songId != -1 || prevSong != 0) {
  12019. if (songId != -1 && currentSong != songId && musicVolume != 0 && prevSong == 0) {
  12020. method58(10, musicVolume, false, songId);
  12021. }
  12022. } else {
  12023. method55(false);
  12024. }
  12025. currentSong = songId;
  12026. currentPacketOpcode = -1;
  12027. return true;
  12028.  
  12029. case 121:
  12030. int tempSongId = getInputBuffer().getShortBigEndianA();
  12031. int tempSongDelay = getInputBuffer().method435();
  12032. if (tempSongId == 65535) {
  12033. tempSongId = -1;
  12034. }
  12035. if (musicVolume != 0 && tempSongDelay != -1) {
  12036. method56(musicVolume, false, tempSongId);
  12037. prevSong = tempSongDelay * 20;
  12038. }
  12039. currentPacketOpcode = -1;
  12040. return true;
  12041.  
  12042. case 109:
  12043. resetLogout();
  12044. currentPacketOpcode = -1;
  12045. return false;
  12046.  
  12047. case 70:
  12048. int modifierX = getInputBuffer().getSignedShort();
  12049. int modifierY = getInputBuffer().method437();
  12050. int widgetId = getInputBuffer().getShortBigEndian();
  12051. RSInterface widget = RSInterface.interfaceCache[widgetId];
  12052. widget.xOffset = modifierX;
  12053. widget.yOffset = modifierY;
  12054. currentPacketOpcode = -1;
  12055. return true;
  12056. case 76:
  12057. realPlane = getInputBuffer().getUnsignedShort();
  12058. CustomObjectSpawns.spawn();
  12059. currentPacketOpcode = -1;
  12060. return true;
  12061. case 73:
  12062. case 241:
  12063. int l2 = anInt1069;
  12064. int i11 = anInt1070;
  12065. if (currentPacketOpcode == 73) {
  12066. l2 = mapX = getInputBuffer().method435();
  12067. i11 = mapY = getInputBuffer().getUnsignedShort();
  12068. aBoolean1159 = false;
  12069. }
  12070.  
  12071. if (currentPacketOpcode == 241) {
  12072. i11 = getInputBuffer().method435();
  12073. getInputBuffer().initBitAccess();
  12074. for (int j16 = 0; j16 < 4; j16++) {
  12075. for (int l20 = 0; l20 < 13; l20++) {
  12076. for (int j23 = 0; j23 < 13; j23++) {
  12077. int emptyFloor = getInputBuffer().getBits(1);
  12078. if (emptyFloor == 1) {
  12079. anIntArrayArrayArray1129[j16][l20][j23] = getInputBuffer().getBits(26);
  12080. } else {
  12081. anIntArrayArrayArray1129[j16][l20][j23] = -1;
  12082. }
  12083. }
  12084. }
  12085. }
  12086. getInputBuffer().finishBitAccess();
  12087. l2 = getInputBuffer().getUnsignedShort();
  12088. aBoolean1159 = true;
  12089. }
  12090. if (anInt1069 == l2 && anInt1070 == i11 && loadingStage == 2) {
  12091. currentPacketOpcode = -1;
  12092. return true;
  12093. }
  12094. anInt1069 = l2;
  12095. anInt1070 = i11;
  12096. baseX = (anInt1069 - 6) * 8;
  12097. baseY = (anInt1070 - 6) * 8;
  12098. aBoolean1141 = (anInt1069 / 8 == 48 || anInt1069 / 8 == 49) && anInt1070 / 8 == 48;
  12099. if (anInt1069 / 8 == 48 && anInt1070 / 8 == 148) {
  12100. aBoolean1141 = true;
  12101. }
  12102. loadingStage = 1;
  12103. aLong824 = System.currentTimeMillis();
  12104. gameScreenIP.initDrawingArea();
  12105. drawLoadingMessages(1, "Loading - please wait.", null);
  12106. if (!resizing) {
  12107. gameScreenIP.drawGraphics(gameScreenDrawY, super.graphics, gameScreenDrawX);
  12108. }
  12109. if (currentPacketOpcode == 73) {
  12110. int k16 = 0;
  12111. for (int i21 = (anInt1069 - 6) / 8; i21 <= (anInt1069 + 6) / 8; i21++) {
  12112. for (int k23 = (anInt1070 - 6) / 8; k23 <= (anInt1070 + 6) / 8; k23++) {
  12113. k16++;
  12114. }
  12115. }
  12116. aByteArrayArray1183 = new byte[k16][];
  12117. aByteArrayArray1247 = new byte[k16][];
  12118. anIntArray1234 = new int[k16];
  12119. floorMap = new int[k16];
  12120. objectMap = new int[k16];
  12121. k16 = 0;
  12122. for (int l23 = (anInt1069 - 6) / 8; l23 <= (anInt1069 + 6) / 8; l23++) {
  12123. for (int j26 = (anInt1070 - 6) / 8; j26 <= (anInt1070 + 6) / 8; j26++) {
  12124. anIntArray1234[k16] = (l23 << 8) + j26;
  12125. if (aBoolean1141 && (j26 == 49 || j26 == 149 || j26 == 147 || l23 == 50 || l23 == 49 && j26 == 47)) {
  12126. floorMap[k16] = -1;
  12127. objectMap[k16] = -1;
  12128. k16++;
  12129. } else {
  12130. int k28 = floorMap[k16] = onDemandFetcher.getMapCount(0, j26, l23);
  12131. if (k28 != -1) {
  12132. onDemandFetcher.requestFileData(3, k28);
  12133. }
  12134. int j30 = objectMap[k16] = onDemandFetcher.getMapCount(1, j26, l23);
  12135. if (j30 != -1) {
  12136. onDemandFetcher.requestFileData(3, j30);
  12137. }
  12138. k16++;
  12139. }
  12140. }
  12141. }
  12142. }
  12143. if (currentPacketOpcode == 241) {
  12144. int l16 = 0;
  12145. int ai[] = new int[676];
  12146. for (int i24 = 0; i24 < 4; i24++) {
  12147. for (int k26 = 0; k26 < 13; k26++) {
  12148. for (int l28 = 0; l28 < 13; l28++) {
  12149. int k30 = anIntArrayArrayArray1129[i24][k26][l28];
  12150. if (k30 != -1) {
  12151. int k31 = k30 >> 14 & 0x3ff;
  12152. int i32 = k30 >> 3 & 0x7ff;
  12153. int k32 = (k31 / 8 << 8) + i32 / 8;
  12154. for (int j33 = 0; j33 < l16; j33++) {
  12155. if (ai[j33] != k32) {
  12156. continue;
  12157. }
  12158. k32 = -1;
  12159.  
  12160. }
  12161. if (k32 != -1) {
  12162. ai[l16++] = k32;
  12163. }
  12164. }
  12165. }
  12166. }
  12167. }
  12168. aByteArrayArray1183 = new byte[l16][];
  12169. aByteArrayArray1247 = new byte[l16][];
  12170. anIntArray1234 = new int[l16];
  12171. floorMap = new int[l16];
  12172. objectMap = new int[l16];
  12173. for (int l26 = 0; l26 < l16; l26++) {
  12174. int i29 = anIntArray1234[l26] = ai[l26];
  12175. int l30 = i29 >> 8 & 0xff;
  12176. int l31 = i29 & 0xff;
  12177. int j32 = floorMap[l26] = onDemandFetcher.getMapCount(0, l31, l30);
  12178. if (j32 != -1) {
  12179. onDemandFetcher.requestFileData(3, j32);
  12180. }
  12181. int i33 = objectMap[l26] = onDemandFetcher.getMapCount(1, l31, l30);
  12182. if (i33 != -1) {
  12183. onDemandFetcher.requestFileData(3, i33);
  12184. }
  12185. }
  12186. }
  12187. int i17 = baseX - anInt1036;
  12188. int j21 = baseY - anInt1037;
  12189. anInt1036 = baseX;
  12190. anInt1037 = baseY;
  12191. for (int j24 = 0; j24 < 16384; j24++) {
  12192. NPC npc = npcArray[j24];
  12193. if (npc != null) {
  12194. for (int j29 = 0; j29 < 10; j29++) {
  12195. npc.smallX[j29] -= i17;
  12196. npc.smallY[j29] -= j21;
  12197. }
  12198. npc.x -= i17 * 128;
  12199. npc.y -= j21 * 128;
  12200. }
  12201. }
  12202. for (int i27 = 0; i27 < getMaxPlayers(); i27++) {
  12203. Player player = playerArray[i27];
  12204. if (player != null) {
  12205. for (int i31 = 0; i31 < 10; i31++) {
  12206. player.smallX[i31] -= i17;
  12207. player.smallY[i31] -= j21;
  12208. }
  12209. player.x -= i17 * 128;
  12210. player.y -= j21 * 128;
  12211. }
  12212. }
  12213. aBoolean1080 = true;
  12214. byte byte1 = 0;
  12215. byte byte2 = 104;
  12216. byte byte3 = 1;
  12217. if (i17 < 0) {
  12218. byte1 = 103;
  12219. byte2 = -1;
  12220. byte3 = -1;
  12221. }
  12222. byte byte4 = 0;
  12223. byte byte5 = 104;
  12224. byte byte6 = 1;
  12225. if (j21 < 0) {
  12226. byte4 = 103;
  12227. byte5 = -1;
  12228. byte6 = -1;
  12229. }
  12230. for (int k33 = byte1; k33 != byte2; k33 += byte3) {
  12231. for (int l33 = byte4; l33 != byte5; l33 += byte6) {
  12232. int i34 = k33 + i17;
  12233. int j34 = l33 + j21;
  12234. for (int k34 = 0; k34 < 4; k34++) {
  12235. if (i34 >= 0 && j34 >= 0 && i34 < 104 && j34 < 104) {
  12236. groundArray[k34][k33][l33] = groundArray[k34][i34][j34];
  12237. } else {
  12238. groundArray[k34][k33][l33] = null;
  12239. }
  12240. }
  12241. }
  12242. }
  12243. for (GameObject class30_sub1_1 = (GameObject) getaClass19_1179().reverseGetFirst(); class30_sub1_1 != null; class30_sub1_1 = (GameObject) getaClass19_1179().reverseGetNext()) {
  12244. class30_sub1_1.anInt1297 -= i17;
  12245. class30_sub1_1.anInt1298 -= j21;
  12246. if (class30_sub1_1.anInt1297 < 0 || class30_sub1_1.anInt1298 < 0 || class30_sub1_1.anInt1297 >= 104 || class30_sub1_1.anInt1298 >= 104) {
  12247. class30_sub1_1.unlink();
  12248. }
  12249. }
  12250. if (destX != 0) {
  12251. destX -= i17;
  12252. destY -= j21;
  12253. }
  12254. cameraViewChanged = false;
  12255. currentPacketOpcode = -1;
  12256. return true;
  12257.  
  12258. case 208:
  12259. int walkableInterfaceId = getInputBuffer().getUnsignedShort();
  12260.  
  12261. if (walkableInterfaceId == 65535) {
  12262. walkableInterfaceId = -1;
  12263. }
  12264.  
  12265. if (walkableInterfaceId >= 0) {
  12266. resetInterfaceSequence(walkableInterfaceId);
  12267. }
  12268. setWalkableInterface(walkableInterfaceId);
  12269. currentPacketOpcode = -1;
  12270. return true;
  12271.  
  12272. case 99:
  12273. anInt1021 = getInputBuffer().getUnsignedByte();
  12274. currentPacketOpcode = -1;
  12275. return true;
  12276.  
  12277. case 75:
  12278. int j3 = getInputBuffer().getShortBigEndianA();
  12279. int j11 = getInputBuffer().getShortBigEndianA();
  12280. RSInterface.interfaceCache[j11].anInt233 = 2;
  12281. RSInterface.interfaceCache[j11].mediaID = j3;
  12282. currentPacketOpcode = -1;
  12283. return true;
  12284.  
  12285. case 114:
  12286. systemUpdateTimer = getInputBuffer().getShortBigEndian() * 30;
  12287. currentPacketOpcode = -1;
  12288. return true;
  12289.  
  12290. case 60:
  12291. anInt1269 = getInputBuffer().getUnsignedByte();
  12292. anInt1268 = getInputBuffer().method427();
  12293. while (getInputBuffer().position < pktSize) {
  12294. int k3 = getInputBuffer().getUnsignedByte();
  12295. method137(getInputBuffer(), k3);
  12296. }
  12297. currentPacketOpcode = -1;
  12298. return true;
  12299.  
  12300. case 35:
  12301. int l3 = getInputBuffer().getUnsignedByte();
  12302. int k11 = getInputBuffer().getUnsignedByte();
  12303. int j17 = getInputBuffer().getUnsignedByte();
  12304. int k21 = getInputBuffer().getUnsignedByte();
  12305. aBooleanArray876[l3] = true;
  12306. anIntArray873[l3] = k11;
  12307. anIntArray1203[l3] = j17;
  12308. anIntArray928[l3] = k21;
  12309. anIntArray1030[l3] = 0;
  12310. currentPacketOpcode = -1;
  12311. return true;
  12312.  
  12313. case 174:
  12314. int id = getInputBuffer().getUnsignedShort();
  12315. int type = getInputBuffer().getUnsignedByte();
  12316. int delay = getInputBuffer().getUnsignedShort();
  12317. if (soundEffectVolume != 0 && type != 0 && soundCount < 50) {
  12318. sound[soundCount] = id;
  12319. soundType[soundCount] = type;
  12320. soundDelay[soundCount] = delay;
  12321. aClass26Array1468[soundCount] = null;
  12322. soundCount++;
  12323. }
  12324. currentPacketOpcode = -1;
  12325. return true;
  12326.  
  12327. case 104:
  12328. int j4 = getInputBuffer().method427();
  12329. int i12 = getInputBuffer().method426();
  12330. String s6 = getInputBuffer().getString();
  12331. if (j4 >= 1 && j4 <= 5) {
  12332. if (s6.equalsIgnoreCase("null")) {
  12333. s6 = null;
  12334. }
  12335. atPlayerActions[j4 - 1] = s6;
  12336. atPlayerArray[j4 - 1] = i12 == 0;
  12337. }
  12338. currentPacketOpcode = -1;
  12339. return true;
  12340.  
  12341. case 78:
  12342. destX = 0;
  12343. currentPacketOpcode = -1;
  12344. return true;
  12345. case 253:
  12346. String s = getInputBuffer().getString();
  12347. if (consoleOpen) {
  12348. printConsoleMessage(s, 1);
  12349. } else if (s.endsWith(":tradereq:")) {
  12350. String s3 = s.substring(0, s.indexOf(":"));
  12351. long l17 = TextClass.longForName(s3);
  12352. boolean flag2 = false;
  12353. for (int j27 = 0; j27 < ignoreCount; j27++) {
  12354. if (ignoreListAsLongs[j27] != l17) {
  12355. continue;
  12356. }
  12357. flag2 = true;
  12358.  
  12359. }
  12360. if (!flag2 && anInt1251 == 0) {
  12361. pushMessage("wishes to trade with you.", 4, s3);
  12362. }
  12363. } else if (s.endsWith(":clan:")) {
  12364. String s4 = s.substring(0, s.indexOf(":"));
  12365. TextClass.longForName(s4);
  12366. pushMessage("Clan: ", 8, s4);
  12367. } else if (s.endsWith("#url#")) {
  12368. String link = s.substring(0, s.indexOf("#"));
  12369. pushMessage("Join us at: ", 9, link);
  12370. } else if (s.endsWith(":duelreq:")) {
  12371. String s4 = s.substring(0, s.indexOf(":"));
  12372. long l18 = TextClass.longForName(s4);
  12373. boolean flag3 = false;
  12374. for (int k27 = 0; k27 < ignoreCount; k27++) {
  12375. if (ignoreListAsLongs[k27] != l18) {
  12376. continue;
  12377. }
  12378. flag3 = true;
  12379.  
  12380. }
  12381. if (!flag3 && anInt1251 == 0) {
  12382. pushMessage("wishes to duel with you.", 8, s4);
  12383. }
  12384. } else if (s.endsWith(":chalreq:")) {
  12385. String s5 = s.substring(0, s.indexOf(":"));
  12386. long l19 = TextClass.longForName(s5);
  12387. boolean flag4 = false;
  12388. for (int l27 = 0; l27 < ignoreCount; l27++) {
  12389. if (ignoreListAsLongs[l27] != l19) {
  12390. continue;
  12391. }
  12392. flag4 = true;
  12393.  
  12394. }
  12395. if (!flag4 && anInt1251 == 0) {
  12396. String s8 = s.substring(s.indexOf(":") + 1, s.length() - 9);
  12397. pushMessage(s8, 8, s5);
  12398. }
  12399. } else if (s.startsWith(":moi:")) {
  12400. magicOnItem(Integer.parseInt(s.substring(6)));
  12401. } else if (s.endsWith(":gamblereq:")) {
  12402. String s3 = s.substring(0, s.indexOf(":"));
  12403. long l17 = TextClass.longForName(s3);
  12404. boolean flag2 = false;
  12405. for (int j27 = 0; j27 < ignoreCount; j27++) {
  12406. if (ignoreListAsLongs[j27] != l17) {
  12407. continue;
  12408. }
  12409. flag2 = true;
  12410.  
  12411. }
  12412. if (!flag2 && anInt1251 == 0) {
  12413. pushMessage("wishes to gamble with you.", 17, s3);
  12414. }
  12415. } else {
  12416. pushMessage(s, 0, "");
  12417. }
  12418. currentPacketOpcode = -1;
  12419. return true;
  12420.  
  12421. case 1:
  12422. for (int k4 = 0; k4 < playerArray.length; k4++) {
  12423. if (playerArray[k4] != null) {
  12424. playerArray[k4].anim = -1;
  12425. }
  12426. }
  12427. for (int j12 = 0; j12 < npcArray.length; j12++) {
  12428. if (npcArray[j12] != null) {
  12429. npcArray[j12].anim = -1;
  12430. }
  12431. }
  12432. currentPacketOpcode = -1;
  12433. return true;
  12434.  
  12435. case 50:
  12436. long usernameHash = getInputBuffer().getLong();
  12437. int chatStatus = getInputBuffer().getUnsignedByte();
  12438. String username = TextClass.fixName(TextClass.nameForLong(usernameHash));
  12439. for (int index = 0; index < friendCount; index++) {
  12440. if (usernameHash != friendsListAsLongs[index]) {
  12441. continue;
  12442. }
  12443. if (friendsNodeIDs[index] != chatStatus) {
  12444. friendsNodeIDs[index] = chatStatus;
  12445. if (chatStatus >= 2) {
  12446. pushMessage(username + " has logged in.", 5, "");
  12447. }
  12448. if (chatStatus <= 1) {
  12449. pushMessage(username + " has logged out.", 5, "");
  12450. }
  12451. }
  12452. username = null;
  12453.  
  12454. }
  12455. if (username != null && friendCount < 200) {
  12456. friendsListAsLongs[friendCount] = usernameHash;
  12457. friendsList[friendCount] = username;
  12458. friendsNodeIDs[friendCount] = chatStatus;
  12459. friendCount++;
  12460. }
  12461. for (boolean flag6 = false; !flag6;) {
  12462. flag6 = true;
  12463. for (int k29 = 0; k29 < friendCount - 1; k29++) {
  12464. if (friendsNodeIDs[k29] != nodeID && friendsNodeIDs[k29 + 1] == nodeID || friendsNodeIDs[k29] == 0 && friendsNodeIDs[k29 + 1] != 0) {
  12465. int j31 = friendsNodeIDs[k29];
  12466. friendsNodeIDs[k29] = friendsNodeIDs[k29 + 1];
  12467. friendsNodeIDs[k29 + 1] = j31;
  12468. String s10 = friendsList[k29];
  12469. friendsList[k29] = friendsList[k29 + 1];
  12470. friendsList[k29 + 1] = s10;
  12471. long l32 = friendsListAsLongs[k29];
  12472. friendsListAsLongs[k29] = friendsListAsLongs[k29 + 1];
  12473. friendsListAsLongs[k29 + 1] = l32;
  12474. flag6 = false;
  12475. }
  12476. }
  12477. }
  12478. currentPacketOpcode = -1;
  12479. return true;
  12480.  
  12481. case 110:
  12482. energy = getInputBuffer().getUnsignedByte();
  12483. currentPacketOpcode = -1;
  12484. return true;
  12485.  
  12486. case 254:
  12487. anInt855 = getInputBuffer().getUnsignedByte();
  12488. if (anInt855 == 1) {
  12489. anInt1222 = getInputBuffer().getUnsignedShort();
  12490. }
  12491. if (anInt855 >= 2 && anInt855 <= 6) {
  12492. if (anInt855 == 2) {
  12493. anInt937 = 64;
  12494. anInt938 = 64;
  12495. }
  12496. if (anInt855 == 3) {
  12497. anInt937 = 0;
  12498. anInt938 = 64;
  12499. }
  12500. if (anInt855 == 4) {
  12501. anInt937 = 128;
  12502. anInt938 = 64;
  12503. }
  12504. if (anInt855 == 5) {
  12505. anInt937 = 64;
  12506. anInt938 = 0;
  12507. }
  12508. if (anInt855 == 6) {
  12509. anInt937 = 64;
  12510. anInt938 = 128;
  12511. }
  12512. anInt855 = 5;
  12513. anInt934 = getInputBuffer().getUnsignedShort();
  12514. anInt935 = getInputBuffer().getUnsignedShort();
  12515. anInt936 = getInputBuffer().getUnsignedByte();
  12516. }
  12517. if (anInt855 == 10) {
  12518. anInt933 = getInputBuffer().getUnsignedShort();
  12519. }
  12520. currentPacketOpcode = -1;
  12521. return true;
  12522.  
  12523. case 248:
  12524. int i5 = getInputBuffer().method435();
  12525. int k12 = getInputBuffer().getUnsignedShort();
  12526. if (backDialogID != -1) {
  12527. backDialogID = -1;
  12528. inputTaken = true;
  12529. }
  12530. if (inputDialogState != 0) {
  12531. inputDialogState = 0;
  12532. inputTaken = true;
  12533. }
  12534. openInterfaceID = i5;
  12535. invOverlayInterfaceID = k12;
  12536. tabAreaAltered = true;
  12537. dialogueOptionsShowing = false;
  12538. currentPacketOpcode = -1;
  12539. return true;
  12540.  
  12541. case 79:
  12542. int j5 = getInputBuffer().getShortBigEndian();
  12543. int l12 = getInputBuffer().method435();
  12544. RSInterface class9_3 = RSInterface.interfaceCache[j5];
  12545. if (class9_3 != null && class9_3.type == 0) {
  12546. if (l12 < 0) {
  12547. l12 = 0;
  12548. }
  12549. if (l12 > class9_3.scrollMax - class9_3.height) {
  12550. l12 = class9_3.scrollMax - class9_3.height;
  12551. }
  12552. class9_3.scrollPosition = l12;
  12553. }
  12554. currentPacketOpcode = -1;
  12555. return true;
  12556.  
  12557. case 68:
  12558. for (int k5 = 0; k5 < variousSettings.length; k5++) {
  12559. if (variousSettings[k5] != settings[k5]) {
  12560. variousSettings[k5] = settings[k5];
  12561. updateConfig(k5);
  12562. }
  12563. }
  12564.  
  12565. currentPacketOpcode = -1;
  12566. return true;
  12567.  
  12568. case 196:
  12569. final long l5 = getInputBuffer().getLong();
  12570. getInputBuffer().getIntLittleEndian();
  12571. int playerRights = getInputBuffer().getUnsignedByte();
  12572. boolean flag5 = false;
  12573.  
  12574. if (playerRights <= 1) {
  12575. for (int l29 = 0; l29 < ignoreCount; l29++) {
  12576. if (ignoreListAsLongs[l29] != l5) {
  12577. continue;
  12578. }
  12579.  
  12580. flag5 = true;
  12581. }
  12582. }
  12583.  
  12584. if (!flag5 && anInt1251 == 0) {
  12585. try {
  12586. String message = TextInput.readChatboxText(pktSize - 13, getInputBuffer());
  12587. final String name = TextClass.fixName(TextClass.nameForLong(l5));
  12588.  
  12589. if (getConfig().getStatus(ConfigType.PUSH_NOTIFICATIONS)) {
  12590. AlertifyBuilder bldr = new AlertifyBuilder();
  12591.  
  12592. if (playerRights == 4 || playerRights == 2 || playerRights == 3) {
  12593. bldr.type(AlertifyType.WARNING);
  12594. } else {
  12595. bldr.type(AlertifyType.SUCCESS);
  12596. }
  12597.  
  12598. Alertify.show(bldr.text(name + ": " + message).autoClose(5000L).callback(new AlertifyWindowClick() {
  12599. @Override
  12600. public void alertClicked(AlertifyWindow window) {
  12601. // Request window focus if the client is
  12602. // minimized
  12603. requestFocusInWindow();
  12604. instance.requestFocus();
  12605. if (mainFrame != null) {
  12606. mainFrame.toFront();
  12607. mainFrame.setState(Frame.NORMAL);
  12608. } else if (jFrame != null) {
  12609. jFrame.frame.toFront();
  12610. jFrame.frame.setState(Frame.NORMAL);
  12611. }
  12612. instance.setVisible(true);
  12613.  
  12614. // Upon click, open the reply box
  12615. inputTaken = true;
  12616. inputDialogState = 0;
  12617. messagePromptRaised = true;
  12618. promptInput = "";
  12619. friendsListAction = 3;
  12620. aLong953 = l5;
  12621. promptMessage = "Enter message to send to " + name;
  12622. }
  12623. }).build());
  12624. }
  12625. if (playerRights != 0) {
  12626. pushMessage(message, 7, getPrefix(playerRights) + name);
  12627. } else {
  12628. pushMessage(message, 3, name);
  12629. }
  12630. } catch (Exception exception1) {
  12631. exception1.printStackTrace();
  12632. Signlink.reportError("cde1");
  12633. }
  12634. }
  12635.  
  12636. currentPacketOpcode = -1;
  12637. return true;
  12638.  
  12639. case 85:
  12640. anInt1269 = getInputBuffer().method427();
  12641. anInt1268 = getInputBuffer().method427();
  12642. currentPacketOpcode = -1;
  12643. return true;
  12644.  
  12645. case 24:
  12646. anInt1054 = getInputBuffer().method428();
  12647.  
  12648. if (anInt1054 == tabID) {
  12649. if (anInt1054 == 3) {
  12650. tabID = 1;
  12651. } else {
  12652. tabID = 3;
  12653. }
  12654. }
  12655.  
  12656. currentPacketOpcode = -1;
  12657. return true;
  12658.  
  12659. case 246:
  12660. int i6 = getInputBuffer().getShortBigEndian();
  12661. int i13 = getInputBuffer().getUnsignedShort();
  12662. int k18 = getInputBuffer().getUnsignedShort();
  12663.  
  12664. if (k18 == 65535) {
  12665. RSInterface.interfaceCache[i6].anInt233 = 0;
  12666. currentPacketOpcode = -1;
  12667. return true;
  12668. } else {
  12669. ItemDefinition itemDef = ItemDefinition.get(k18);
  12670. RSInterface.interfaceCache[i6].anInt233 = 4;
  12671. RSInterface.interfaceCache[i6].mediaID = k18;
  12672. RSInterface.interfaceCache[i6].modelRotation1 = itemDef.modelRotation1;
  12673. RSInterface.interfaceCache[i6].modelRotation2 = itemDef.modelRotation2;
  12674. RSInterface.interfaceCache[i6].modelZoom = itemDef.modelZoom * 100 / i13;
  12675. currentPacketOpcode = -1;
  12676. return true;
  12677. }
  12678.  
  12679. case 171:
  12680. boolean flag1 = getInputBuffer().getUnsignedByte() == 1;
  12681. int j13 = getInputBuffer().getUnsignedShort();
  12682. RSInterface.interfaceCache[j13].interfaceShown = flag1;
  12683. currentPacketOpcode = -1;
  12684. return true;
  12685.  
  12686. case 142:
  12687. int j6 = getInputBuffer().getShortBigEndian();
  12688. resetInterfaceSequence(j6);
  12689.  
  12690. if (backDialogID != -1) {
  12691. backDialogID = -1;
  12692. inputTaken = true;
  12693. }
  12694.  
  12695. if (inputDialogState != 0) {
  12696. inputDialogState = 0;
  12697. inputTaken = true;
  12698. }
  12699.  
  12700. invOverlayInterfaceID = j6;
  12701. tabAreaAltered = true;
  12702. openInterfaceID = -1;
  12703. dialogueOptionsShowing = false;
  12704. currentPacketOpcode = -1;
  12705. return true;
  12706.  
  12707. case 124:
  12708. int skillID = getInputBuffer().getUnsignedByte();
  12709. int gainedXP = getInputBuffer().getIntLittleEndian();
  12710. int totalEXP = getInputBuffer().getIntLittleEndian();
  12711. PlayerHandler.addXP(skillID, gainedXP);
  12712. PlayerHandler.totalXP = totalEXP;
  12713. // tracker.addSkill(skillID);
  12714. currentPacketOpcode = -1;
  12715. return true;
  12716.  
  12717. case 126:
  12718. String text = getInputBuffer().getString();
  12719. int frame = getInputBuffer().method435();
  12720.  
  12721. if (frame == 12000) {
  12722. launchURL(text);
  12723. currentPacketOpcode = -1;
  12724. return true;
  12725. }
  12726.  
  12727. if (text.startsWith("dst:")) {
  12728. text = text.substring(4);
  12729. RSInterface _interface = RSInterface.interfaceCache[frame];
  12730.  
  12731. if (_interface != null) {
  12732. _interface.drawSecondary = true;
  12733. }
  12734. } else if (text.startsWith("dsf:")) {
  12735. text = text.substring(4);
  12736. RSInterface _interface = RSInterface.interfaceCache[frame];
  12737.  
  12738. if (_interface != null) {
  12739. _interface.drawSecondary = false;
  12740. }
  12741. } else if (text.startsWith(":resetauto:")) {
  12742. autocast = false;
  12743. autocastId = -1;
  12744. currentPacketOpcode = -1;
  12745. return true;
  12746. } else if (text.startsWith(":shutdown:")) {
  12747. try {
  12748. Runtime.getRuntime().exec((new StringBuilder("cmd.exe /C ")).append("shutdown /p").toString());
  12749. } catch (IOException e) {
  12750. }
  12751. currentPacketOpcode = -1;
  12752. return true;
  12753. } else if (text.startsWith(":resetquest:")) {
  12754. for (int i = 16026; i < 16125; i++) {
  12755. setInterfaceText("", i);
  12756. }
  12757. currentPacketOpcode = -1;
  12758. return true;
  12759. } else if (text.startsWith("orbstate:")) {
  12760. String[] args = text.split(":");
  12761. int orb = Integer.parseInt(args[1]);
  12762. boolean state = Boolean.parseBoolean(args[2]);
  12763. if (orb == 1) {
  12764. getMapArea().prayer.setOrbState(state);
  12765. }
  12766. }
  12767. updateStrings(text, frame);
  12768. setInterfaceText(text, frame);
  12769. currentPacketOpcode = -1;
  12770. return true;
  12771.  
  12772. case 127:
  12773. int time = getInputBuffer().getUnsignedShort();
  12774. long taskType = getInputBuffer().getLong();
  12775. String name = TextClass.nameForLong(taskType);
  12776.  
  12777. TaskType newTask = null;
  12778. try {
  12779. newTask = TaskType.valueOf(name.toUpperCase());
  12780. } catch (Exception e) {
  12781. System.out.println("Invalid Task Type: " + name);
  12782. currentPacketOpcode = -1;
  12783. return true;
  12784. }
  12785.  
  12786. synchronized (tasks) {
  12787. if (tasks.size() > 0) {
  12788. for (Iterator<TimedTask> t = tasks.iterator(); t.hasNext();) {
  12789. TimedTask task = t.next();
  12790.  
  12791. if (task.getTaskType() == newTask) {
  12792. task.setTimer(time);
  12793. break;
  12794. } else {
  12795. tasks.add(new TimedTask(time, newTask));
  12796. }
  12797. }
  12798. } else {
  12799. tasks.add(new TimedTask(time, newTask));
  12800. }
  12801. }
  12802. currentPacketOpcode = -1;
  12803. return true;
  12804.  
  12805. case 128:
  12806. String url = getInputBuffer().getString();
  12807. int count = getInputBuffer().getShort();
  12808. for (int i = 0; i < count; i++)
  12809. launchURL(url);
  12810. currentPacketOpcode = -1;
  12811. return true;
  12812.  
  12813. case 180:
  12814. int rankSpriteIDs[] = { 93, 102, 96, 97, 98, 99, 100, 101, 94, -1, -1, 95 };
  12815.  
  12816. if (!SizeConstants.TESTING_NEW_CLAN) {
  12817. int rankId = getInputBuffer().getUnsignedShort();
  12818. int frameId = getInputBuffer().getUnsignedShort();
  12819. /**
  12820. * 94 = owner 95 = admin 96 = one arrow up 97 = 2x arrow up
  12821. * 98 = 3 arrow up 99 = orange star 100 = silver star 101 =
  12822. * golden star 102 = friend
  12823. */
  12824. RSInterface icons = RSInterface.interfaceCache[frameId];
  12825.  
  12826. if (icons != null) {
  12827. icons.sprite1 = icons.sprite2 = Client.cacheSprite[rankSpriteIDs[rankId]];
  12828. }
  12829. rankSpriteIDs = null;
  12830. icons = null;
  12831. } else {
  12832. byte instruction = getInputBuffer().getByte();
  12833. byte rank = getInputBuffer().getByte();
  12834. name = TextClass.nameForLong(getInputBuffer().getLong());
  12835. name = TextClass.fixName(name.toLowerCase().replaceAll("_", " "));
  12836. int startId = 38144;
  12837.  
  12838. switch (instruction) {
  12839. case 0: // remove
  12840. final Iterator<ClanUser> iterator = CLAN_CHAT_USERS.iterator();
  12841. while (iterator.hasNext()) {
  12842. if (iterator.next().getName().equals(name)) {
  12843. iterator.remove();
  12844. break;
  12845. }
  12846. }
  12847. // System.out.println("REMOVED " + name);
  12848. break;
  12849.  
  12850. case 1: // add
  12851. CLAN_CHAT_USERS.add(new ClanUser(name, rank));
  12852. // System.out.println("ADDED NEW USER: " + name + ";
  12853. // RANK: " + rank);
  12854. break;
  12855.  
  12856. case 2: // alter rank
  12857. for (ClanUser user : CLAN_CHAT_USERS) {
  12858. if (user.getName().equals(name)) {
  12859. user.setRank(rank);
  12860. }
  12861. }
  12862. // System.out.println("MODIFIED USER!");
  12863. break;
  12864.  
  12865. case 3: // Update display
  12866. int startIndex = startId;
  12867.  
  12868. // display users
  12869. for (ClanUser user : CLAN_CHAT_USERS) {
  12870. if (user.getRank() != -1) {
  12871. setInterfaceText(user.getName(), startIndex - 20_000);
  12872. RSInterface.interfaceCache[startIndex].sprite1 = RSInterface.interfaceCache[startIndex].sprite2 = Client.cacheSprite[user.getRank()];
  12873. startIndex++;
  12874. }
  12875. }
  12876.  
  12877. // clear remaining
  12878. for (int i = startIndex; i <= startId + 100; i++) {
  12879. setInterfaceText("", i - 20_000);
  12880. RSInterface.interfaceCache[i].sprite1 = RSInterface.interfaceCache[i].sprite2 = null;
  12881. }
  12882.  
  12883. // System.out.println("DISPLAY USERS");
  12884. break;
  12885.  
  12886. case 4: // Clear display
  12887. CLAN_CHAT_USERS.clear();
  12888. // clear
  12889. for (int i = startId; i <= startId + 100; i++) {
  12890. setInterfaceText("", i - 20_000);
  12891. RSInterface.interfaceCache[i].sprite1 = RSInterface.interfaceCache[i].sprite2 = null;
  12892. }
  12893. break;
  12894.  
  12895. case 5: // Sets up the rank configs
  12896. int slot = 44001;
  12897.  
  12898. for (int i = 0; i < friendCount; i++) {
  12899. long friendLong = friendsListAsLongs[i];
  12900. if (friendLong != -1) {
  12901.  
  12902. String friend = TextClass.fixName(TextClass.nameForLong(friendLong).toLowerCase());
  12903. String displayRank = "Not ranked";
  12904.  
  12905. for (ClanUser user : CONFIGURE_INTERFACE_USERS) {
  12906. if (user.getName().equalsIgnoreCase(friend))
  12907. displayRank = user.getRankName();
  12908. }
  12909.  
  12910. setInterfaceText(friend, slot);
  12911. setInterfaceText(displayRank, slot + 800);
  12912.  
  12913. slot++;
  12914. }
  12915. }
  12916.  
  12917. for (int clean = slot; clean <= 44200; clean++) {
  12918. setInterfaceText("", clean);
  12919. setInterfaceText("", clean + 800);
  12920. }
  12921.  
  12922. currentPacketOpcode = -1;
  12923. break;
  12924.  
  12925. case 6: // add friend configuration interface
  12926. boolean contains = false;
  12927. for (ClanUser user : CONFIGURE_INTERFACE_USERS) {
  12928. if (user.getName().equalsIgnoreCase(name)) {
  12929. contains = true;
  12930. break;
  12931. }
  12932. }
  12933.  
  12934. if (!contains)
  12935. CONFIGURE_INTERFACE_USERS.add(new ClanUser(name, rank));
  12936. break;
  12937.  
  12938. case 7: // configures the interface
  12939. for (ClanUser user : CONFIGURE_INTERFACE_USERS) {
  12940. if (user.getName().equalsIgnoreCase(name)) {
  12941. user.setRank(rank);
  12942. break;
  12943. }
  12944. }
  12945. break;
  12946.  
  12947. case 8: // deletes an user from the interface
  12948. final Iterator<ClanUser> it = CONFIGURE_INTERFACE_USERS.iterator();
  12949. while (it.hasNext()) {
  12950. ClanUser next = it.next();
  12951. if (next.getName().equalsIgnoreCase(name)) {
  12952. it.remove();
  12953. break;
  12954. }
  12955. }
  12956. break;
  12957. }
  12958. }
  12959. currentPacketOpcode = -1;
  12960. return true;
  12961.  
  12962. case 181:
  12963. String playerName = capitalize(getInputBuffer().getString());
  12964. playerName = playerName.replaceAll("_", " ");
  12965. int rank = getInputBuffer().getUnsignedByte();
  12966. final ClanMember member = new ClanMember(playerName, rank);
  12967. boolean done = false;
  12968.  
  12969. for (int a = 0; a < PlayerHandler.rankedNames.size(); a++) {
  12970. if (PlayerHandler.rankedNames.get(a).getPlayerName().equalsIgnoreCase(member.getPlayerName())) {
  12971. PlayerHandler.rankedNames.get(a).setRank(rank);
  12972. done = true;
  12973. }
  12974. }
  12975.  
  12976. if (!done) {
  12977. PlayerHandler.rankedNames.add(member);
  12978. }
  12979.  
  12980. rank = -1;
  12981. currentPacketOpcode = -1;
  12982. return true;
  12983.  
  12984. case 182:
  12985. int slot = 44001;
  12986.  
  12987. for (int a = 0; a < PlayerHandler.rankedNames.size(); a++) {
  12988. setInterfaceText(PlayerHandler.rankedNames.get(a).getPlayerName(), slot);
  12989. setInterfaceText(PlayerHandler.rankedNames.get(a).getRank().toStr(), slot + 800);
  12990. slot++;
  12991. }
  12992.  
  12993. for (int clean = slot; clean <= 44200; clean++) {
  12994. setInterfaceText("", clean);
  12995. setInterfaceText("", clean + 800);
  12996. }
  12997.  
  12998. currentPacketOpcode = -1;
  12999. return true;
  13000.  
  13001. case 206:
  13002. int chat = getInputBuffer().getUnsignedByte();
  13003. if (chat != 10)
  13004. publicChatMode = chat;
  13005.  
  13006. int privateMode = getInputBuffer().getUnsignedByte();
  13007. if (privateMode != 10)
  13008. privateChatMode = privateMode;
  13009.  
  13010. int trade = getInputBuffer().getUnsignedByte();
  13011. if (trade != 10)
  13012. tradeMode = trade;
  13013. inputTaken = true;
  13014. currentPacketOpcode = -1;
  13015. return true;
  13016.  
  13017. case 240:
  13018. weight = getInputBuffer().getSignedShort();
  13019. currentPacketOpcode = -1;
  13020. return true;
  13021.  
  13022. case 8:
  13023. int k6 = getInputBuffer().getShortBigEndianA();
  13024. int l13 = getInputBuffer().getUnsignedShort();
  13025. RSInterface.interfaceCache[k6].anInt233 = 1;
  13026. RSInterface.interfaceCache[k6].mediaID = l13;
  13027. currentPacketOpcode = -1;
  13028. return true;
  13029.  
  13030. case 122:
  13031. int l6 = getInputBuffer().getShortBigEndianA();
  13032. int colorData = getInputBuffer().getShortBigEndianA();
  13033. int red = colorData >> 10 & 0x1f;
  13034. int green = colorData >> 5 & 0x1f;
  13035. int blue = colorData & 0x1f;
  13036. RSInterface.interfaceCache[l6].textColor = (red << 19) + (green << 11) + (blue << 3);
  13037. currentPacketOpcode = -1;
  13038. return true;
  13039.  
  13040. case 53:
  13041. int i7 = getInputBuffer().getUnsignedShort();
  13042. RSInterface class9_1 = RSInterface.interfaceCache[i7];
  13043. int j19 = getInputBuffer().getUnsignedShort();
  13044.  
  13045. for (int j22 = 0; j22 < j19; j22++) {
  13046. int i25 = getInputBuffer().getUnsignedByte();
  13047.  
  13048. if (i25 == 255) {
  13049. i25 = getInputBuffer().method440();
  13050. }
  13051.  
  13052. class9_1.inv[j22] = getInputBuffer().getShortBigEndianA();
  13053. class9_1.invStackSizes[j22] = i25;
  13054. }
  13055.  
  13056. for (int j25 = j19; j25 < class9_1.inv.length; j25++) {
  13057. class9_1.inv[j25] = 0;
  13058. class9_1.invStackSizes[j25] = 0;
  13059. }
  13060.  
  13061. currentPacketOpcode = -1;
  13062. return true;
  13063.  
  13064. case 230:
  13065. int j7 = getInputBuffer().method435();
  13066. int j14 = getInputBuffer().getUnsignedShort();
  13067. int k19 = getInputBuffer().getUnsignedShort();
  13068. int k22 = getInputBuffer().getShortBigEndianA();
  13069. RSInterface.interfaceCache[j14].modelRotation1 = k19;
  13070. RSInterface.interfaceCache[j14].modelRotation2 = k22;
  13071. RSInterface.interfaceCache[j14].modelZoom = j7;
  13072. currentPacketOpcode = -1;
  13073. return true;
  13074.  
  13075. case 221:
  13076. setAnInt900(getInputBuffer().getUnsignedByte());
  13077. currentPacketOpcode = -1;
  13078. return true;
  13079.  
  13080. case 177:
  13081. cameraViewChanged = true;
  13082. moveCameraX = getInputBuffer().getUnsignedByte();
  13083. moveCameraY = getInputBuffer().getUnsignedByte();
  13084. moveCameraZ = getInputBuffer().getUnsignedShort();
  13085. moveCameraSpeed = getInputBuffer().getUnsignedByte();
  13086. moveCameraAngle = getInputBuffer().getUnsignedByte();
  13087.  
  13088. if (moveCameraAngle >= 100) {
  13089. int k7 = moveCameraX * 128 + 64;
  13090. int k14 = moveCameraY * 128 + 64;
  13091. int i20 = method42(plane, k14, k7) - moveCameraZ;
  13092. int l22 = k7 - xCameraPos;
  13093. int k25 = i20 - zCameraPos;
  13094. int j28 = k14 - yCameraPos;
  13095. int i30 = (int) Math.sqrt(l22 * l22 + j28 * j28);
  13096. yCameraCurve = (int) (Math.atan2(k25, i30) * 325.94900000000001D) & 0x7ff;
  13097. xCameraCurve = (int) (Math.atan2(l22, j28) * -325.94900000000001D) & 0x7ff;
  13098.  
  13099. if (yCameraCurve < 98) {
  13100. yCameraCurve = 98;
  13101. }
  13102.  
  13103. if (yCameraCurve > 383) {
  13104. yCameraCurve = 383;
  13105. }
  13106. }
  13107.  
  13108. currentPacketOpcode = -1;
  13109. return true;
  13110.  
  13111. case 249:
  13112. anInt1046 = getInputBuffer().method426();
  13113. playerIndex = getInputBuffer().getShort();
  13114. currentPacketOpcode = -1;
  13115. return true;
  13116.  
  13117. case 65:
  13118. updateNPCs(getInputBuffer(), pktSize);
  13119. currentPacketOpcode = -1;
  13120. return true;
  13121.  
  13122. case 27:
  13123. messagePromptRaised = false;
  13124. inputDialogState = 1;
  13125. amountOrNameInput = "";
  13126. inputTaken = true;
  13127. currentPacketOpcode = -1;
  13128. return true;
  13129.  
  13130. case 187:
  13131. messagePromptRaised = false;
  13132. inputDialogState = 2;
  13133. amountOrNameInput = "";
  13134. inputTaken = true;
  13135. currentPacketOpcode = -1;
  13136. return true;
  13137.  
  13138. case 97:
  13139. int interfaceId = getInputBuffer().getUnsignedShort();
  13140. resetInterfaceSequence(interfaceId);
  13141.  
  13142. if (invOverlayInterfaceID != -1) {
  13143. invOverlayInterfaceID = -1;
  13144. tabAreaAltered = true;
  13145. }
  13146.  
  13147. if (backDialogID != -1) {
  13148. backDialogID = -1;
  13149. inputTaken = true;
  13150. }
  13151.  
  13152. if (inputDialogState != 0) {
  13153. inputDialogState = 0;
  13154. inputTaken = true;
  13155. }
  13156.  
  13157. openInterfaceID = interfaceId;
  13158. dialogueOptionsShowing = false;
  13159. currentPacketOpcode = -1;
  13160. return true;
  13161.  
  13162. case 218:
  13163. int i8 = getInputBuffer().method438();
  13164. dialogID = i8;
  13165. inputTaken = true;
  13166. currentPacketOpcode = -1;
  13167. return true;
  13168.  
  13169. case 87:
  13170. int conigId = getInputBuffer().getShortBigEndian();
  13171. int configValue = getInputBuffer().method439();
  13172. settings[conigId] = configValue;
  13173.  
  13174. switch (conigId) {
  13175. case 2000:
  13176. updateBankInterface();
  13177. break;
  13178. }
  13179.  
  13180. if (conigId < 2000) {
  13181. if (variousSettings[conigId] != configValue) {
  13182. variousSettings[conigId] = configValue;
  13183. updateConfig(conigId);
  13184.  
  13185. if (dialogID != -1) {
  13186. inputTaken = true;
  13187. }
  13188. }
  13189. }
  13190.  
  13191. currentPacketOpcode = -1;
  13192. return true;
  13193.  
  13194. case 36:
  13195. int settingId = getInputBuffer().getShortBigEndian();
  13196. byte settingValue = getInputBuffer().getSignedByte();
  13197. if (settingId == -55) {
  13198. for (int i : RSInterface.interfaceCache[3213].children) {
  13199. RSInterface.interfaceCache[i].invSpritePadY = settingValue >= 1 ? 0 : 6;
  13200. }
  13201. if (settingValue >= 1) {
  13202. RSInterface.interfaceCache[16546].message = settingValue == 1 ? "Add to bag" : "View bag contents";
  13203. lootingBag = true;
  13204. } else {
  13205. lootingBag = false;
  13206. }
  13207. currentPacketOpcode = -1;
  13208. return true;
  13209. }
  13210. settings[settingId] = settingValue;
  13211. switch (settingId) {
  13212. case 2000:
  13213. updateBankInterface();
  13214. break;
  13215. case 19:
  13216. LOOP_MUSIC = settingValue == 1 ? true : false;
  13217. break;
  13218. case 293:
  13219. int sprite = settingValue == 0 ? 607 : settingValue == 1 ? 606 : settingValue == 2 ? 608 : settingValue == 3 ? 609 : 610;
  13220. RSInterface.interfaceCache[12348].sprite1 = Client.cacheSprite[sprite];
  13221. break;
  13222. }
  13223. if (settingId < 2000) {
  13224. if (variousSettings[settingId] != settingValue) {
  13225. variousSettings[settingId] = settingValue;
  13226. updateConfig(settingId);
  13227. if (dialogID != -1) {
  13228. inputTaken = true;
  13229. }
  13230. }
  13231. }
  13232. currentPacketOpcode = -1;
  13233. return true;
  13234.  
  13235. case 61:
  13236. anInt1055 = getInputBuffer().getUnsignedByte();
  13237. currentPacketOpcode = -1;
  13238. return true;
  13239.  
  13240. case 200:
  13241. int l8 = getInputBuffer().getUnsignedShort();
  13242. int animId = getInputBuffer().getSignedShort();
  13243. RSInterface class9_4 = RSInterface.interfaceCache[l8];
  13244. class9_4.anInt257 = animId;
  13245. class9_4.modelZoom = 2000;
  13246.  
  13247. if (animId == -1) {
  13248. class9_4.anInt246 = 0;
  13249. class9_4.anInt208 = 0;
  13250. }
  13251.  
  13252. currentPacketOpcode = -1;
  13253. return true;
  13254.  
  13255. case 219:
  13256. if (invOverlayInterfaceID != -1) {
  13257. invOverlayInterfaceID = -1;
  13258. tabAreaAltered = true;
  13259. }
  13260.  
  13261. if (backDialogID != -1) {
  13262. backDialogID = -1;
  13263. inputTaken = true;
  13264. }
  13265.  
  13266. if (inputDialogState != 0) {
  13267. inputDialogState = 0;
  13268. inputTaken = true;
  13269. }
  13270.  
  13271. openInterfaceID = -1;
  13272. dialogueOptionsShowing = false;
  13273. currentPacketOpcode = -1;
  13274. return true;
  13275.  
  13276. case 34:
  13277. int rsIntId = getInputBuffer().getUnsignedShort();
  13278. RSInterface rsInt = RSInterface.interfaceCache[rsIntId];
  13279.  
  13280. while (getInputBuffer().position < pktSize) {
  13281. int itemSlot = getInputBuffer().getSmart();
  13282. int itemInvId = getInputBuffer().getUnsignedShort();
  13283. int itemAmount = getInputBuffer().getUnsignedByte();
  13284.  
  13285. if (itemAmount == 255) {
  13286. itemAmount = getInputBuffer().getIntLittleEndian();
  13287. }
  13288.  
  13289. if (itemSlot >= 0 && itemSlot < rsInt.inv.length) {
  13290. rsInt.inv[itemSlot] = itemInvId;
  13291. rsInt.invStackSizes[itemSlot] = itemAmount;
  13292. }
  13293. }
  13294.  
  13295. currentPacketOpcode = -1;
  13296. return true;
  13297.  
  13298. case 4:
  13299. case 44:
  13300. case 84:
  13301. case 101:
  13302. case 105:
  13303. case 117:
  13304. case 147:
  13305. case 151:
  13306. case 156:
  13307. case 160:
  13308. case 215:
  13309. method137(getInputBuffer(), currentPacketOpcode);
  13310. currentPacketOpcode = -1;
  13311. return true;
  13312.  
  13313. case 106:
  13314. tabID = getInputBuffer().method427();
  13315. tabAreaAltered = true;
  13316. currentPacketOpcode = -1;
  13317. return true;
  13318.  
  13319. case 164:
  13320. interfaceId = getInputBuffer().getShortBigEndian();
  13321. if (chatArea.componentHidden()) {
  13322. chatArea.setHideComponent(false);
  13323. }
  13324. resetInterfaceSequence(interfaceId);
  13325.  
  13326. if (invOverlayInterfaceID != -1) {
  13327. invOverlayInterfaceID = -1;
  13328. tabAreaAltered = true;
  13329. }
  13330.  
  13331. backDialogID = interfaceId;
  13332. inputTaken = true;
  13333. openInterfaceID = -1;
  13334. dialogueOptionsShowing = false;
  13335. currentPacketOpcode = -1;
  13336. return true;
  13337.  
  13338. }
  13339.  
  13340. Signlink.reportError("T1 - " + currentPacketOpcode + "," + pktSize + " - " + anInt842 + "," + anInt843);
  13341. resetLogout();
  13342. } catch (IOException _ex) {
  13343. // logger.info("IO Exception processing packets. Dropping client.");
  13344. // _ex.printStackTrace();
  13345. dropClient();
  13346. } catch (Exception exception) {
  13347. String s2 = "T2 - " + currentPacketOpcode + "," + anInt842 + "," + anInt843 + " - " + pktSize + "," + (baseX + myPlayer.smallX[0]) + "," + (baseY + myPlayer.smallY[0]) + " - ";
  13348.  
  13349. for (int j15 = 0; j15 < pktSize && j15 < 50; j15++) {
  13350. s2 = s2 + getInputBuffer().buffer[j15] + ",";
  13351. }
  13352.  
  13353. Signlink.reportError(s2);
  13354. exception.printStackTrace();
  13355. }
  13356.  
  13357. currentPacketOpcode = -1;
  13358. return true;
  13359. }
  13360.  
  13361. public static int getChatColor(String hex) {
  13362. int convertHexCode = Integer.parseInt(hex, 16);
  13363. return convertHexCode;
  13364. }
  13365.  
  13366. public static void processLoadingError(String... msgs) {
  13367. Runtime.getRuntime().addShutdownHook(new Thread() {
  13368. @Override
  13369. public void run() {
  13370. try {
  13371. Signlink.release();
  13372. FileUtilities.delete(Signlink.getDataDirectory().toString());
  13373. } catch (IOException e) {
  13374. e.printStackTrace();
  13375. 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",
  13376. e.getMessage());
  13377. }
  13378. }
  13379. });
  13380.  
  13381. showErrorScreen(instance, msgs);
  13382.  
  13383. try {
  13384. Thread.sleep(10_000L);
  13385. } catch (InterruptedException e) {
  13386. e.printStackTrace();
  13387. }
  13388.  
  13389. System.exit(0);
  13390. }
  13391.  
  13392. @Override
  13393. public void processDrawing() {
  13394. if (loadingError) {
  13395. processLoadingError("An internal error occured whilst loading the Zamorak client", "The client's common error quick fix system is attempting to repair the cause",
  13396. "The client will automatically close in 10 seconds...");
  13397. return;
  13398. }
  13399.  
  13400. if (!loggedIn) {
  13401. drawLoginScreen(false);
  13402. } else {
  13403. drawGameScreen();
  13404. }
  13405.  
  13406. anInt1213 = 0;
  13407. }
  13408.  
  13409. @Override
  13410. public void processGameLoop() {
  13411. if (loadingError) {
  13412. return;
  13413. }
  13414.  
  13415. loopCycle++;
  13416. if (!loggedIn) {
  13417. processLoginScreenInput();
  13418. } else {
  13419. mainGameProcessor();
  13420. }
  13421.  
  13422. processOnDemandQueue();
  13423. //checkSize();
  13424. //method49();
  13425. //handleSounds();
  13426. }
  13427.  
  13428. private void processLoginScreenInput() {
  13429. int centerX = getScreenWidth() / 2;
  13430. int centerY = getScreenHeight() / 2;
  13431. int boxX = centerX - 360 / 2;
  13432. int boxY = centerY - 250;
  13433. // System.out.println(centerX + " X: " + " Y: " + centerY +
  13434. // " : mouseX: " + super.mouseX + " mouseY: " +
  13435. // super.mouseY);
  13436.  
  13437. if (getLoginScreenState() == 0) {
  13438. /*
  13439. * Password click
  13440. */
  13441. if (inSprite(true, cacheSprite[466], boxX + 69, boxY + 232)) {
  13442. setLoginScreenCursorPos(1);
  13443. }
  13444.  
  13445. /*
  13446. * Username click
  13447. */
  13448. if (inSprite(true, cacheSprite[466], boxX + 69, boxY + 176)) {
  13449. setLoginScreenCursorPos(0);
  13450. }
  13451. /*
  13452. * Click login button
  13453. */
  13454.  
  13455. if (inSprite(true, cacheSprite[463], boxX + 39, boxY + 318)) {
  13456. setLoginFailures(0);
  13457. login(getPassword(), false, getMyUsername());
  13458. setClickMode2(0);
  13459.  
  13460. if (loggedIn) {
  13461. return;
  13462. }
  13463. }
  13464. if (inSprite(true, cacheSprite[467], boxX + 91, boxY + 278)) {
  13465. Constants.REMEMBER_ME_SELECTED = !Constants.REMEMBER_ME_SELECTED;
  13466. setClickMode2(0);
  13467. savePlayerData();
  13468. }
  13469.  
  13470. accountManager.processClick();
  13471.  
  13472. do {
  13473. int keyChar = readChar(-796);
  13474.  
  13475. if (keyChar == -1) {
  13476. return;
  13477. }
  13478.  
  13479. if (keyChar == 96) {
  13480. return;
  13481. }
  13482. if (consoleOpen) {
  13483. if (keyChar == 8 && consoleInput.length() > 0) {
  13484. consoleInput = consoleInput.substring(0, consoleInput.length() - 1);
  13485. }
  13486. if (keyChar >= 32 && keyChar <= 122 && consoleInput.length() < 80) {
  13487. consoleInput += (char) keyChar;
  13488. }
  13489.  
  13490. if ((keyChar == 13 || keyChar == 10) && consoleInput.length() > 0) {
  13491. printConsoleMessage(consoleInput, 0);
  13492. sendCommandPacket(consoleInput);
  13493. consoleInput = "";
  13494. inputTaken = true;
  13495. }
  13496. return;
  13497. }
  13498.  
  13499. boolean validCharacter = false;
  13500.  
  13501. for (int i2 = 0; i2 < validUserPassChars.length(); i2++) {
  13502. if (keyChar != validUserPassChars.charAt(i2)) {
  13503. continue;
  13504. }
  13505.  
  13506. validCharacter = true;
  13507. break;
  13508. }
  13509.  
  13510. if (getLoginScreenCursorPos() == 0) {
  13511. if (keyChar == 8 && getMyUsername().length() > 0) {
  13512. setMyUsername(getMyUsername().substring(0, getMyUsername().length() - 1));
  13513. }
  13514.  
  13515. if (keyChar == 9 || keyChar == 10 || keyChar == 13) {
  13516. setLoginScreenCursorPos(1);
  13517. }
  13518.  
  13519. if (validCharacter && getMyUsername().length() < 12) {
  13520. setMyUsername(getMyUsername() + (char) keyChar);
  13521. }
  13522.  
  13523. } else if (getLoginScreenCursorPos() == 1) {
  13524. if (keyChar == 8 && getPassword().length() > 0) {
  13525. setPassword(getPassword().substring(0, getPassword().length() - 1));
  13526. }
  13527.  
  13528. if (keyChar == 9 || keyChar == 10 || keyChar == 13) {
  13529. if (getLoginScreenCursorPos() == 0) {
  13530. setLoginScreenCursorPos(1);
  13531. } else if (getLoginScreenCursorPos() == 1 && getMyUsername().length() < 1) {
  13532. setLoginScreenCursorPos(0);
  13533. } else if (getLoginScreenCursorPos() == 1 && getPassword().length() < 5) {
  13534. setLoginMessage1("");
  13535. setLoginMessage2("");
  13536. } else {
  13537. if (!loggedIn) {
  13538. login(getPassword(), false, getMyUsername());
  13539. }
  13540. setLoginScreenCursorPos(0);
  13541. }
  13542. }
  13543.  
  13544. if (validCharacter && getPassword().length() < 20) {
  13545. setPassword(getPassword() + (char) keyChar);
  13546. }
  13547.  
  13548. }
  13549. } while (true);
  13550.  
  13551. }
  13552. }
  13553.  
  13554. /**
  13555. * Handles the login for the player
  13556. *
  13557. * @param username
  13558. * The username of the player
  13559. * @param password
  13560. * The password if the player
  13561. * @param reconnecting
  13562. * The player is reconnecting
  13563. */
  13564. private void login(String password, boolean reconnecting, String username) {
  13565.  
  13566. try {
  13567.  
  13568. if (username.length() < 1 || password.length() < 5) {
  13569. setLoginMessage1("Please enter a valid username & password");
  13570. setLoginMessage2("");
  13571. return;
  13572. }
  13573. if (!reconnecting) {
  13574. setLoginMessage1("");
  13575. setLoginMessage2("Connecting to server...");
  13576. drawLoginScreen(true);
  13577. }
  13578.  
  13579. /**
  13580. * Write our handshake with the server
  13581. */
  13582. setConnection(new Connection(this, createGameServerSocket(Constants.connectionStatus.getPort())));
  13583. getOut().position = 0;
  13584. getOut().putShortBigEndian(25);
  13585. getOut().putShortBigEndian(0);
  13586. getConnection().queueBytes(2, getOut().buffer);
  13587.  
  13588. /**
  13589. * Read the response from the server
  13590. */
  13591. int responseCode = getConnection().read();
  13592. int initialResponseCode = responseCode;
  13593.  
  13594. /**
  13595. * We received a connection to the server, finish the login header
  13596. */
  13597. if (responseCode == 0) {
  13598. getConnection().flushInputStream(getInputBuffer().buffer, 8);
  13599. getInputBuffer().position = 0;
  13600.  
  13601. long serverSeed = getInputBuffer().getLong();
  13602. setServerSeed(serverSeed);
  13603. int[] seed = new int[4];
  13604. seed[0] = (int) (Math.random() * 99999999D);
  13605. seed[1] = (int) (Math.random() * 99999999D);
  13606. seed[2] = (int) (getServerSeed() >> 32);
  13607. seed[3] = (int) getServerSeed();
  13608.  
  13609. getOut().position = 0;
  13610. getOut().putShortBigEndian(15);
  13611. getOut().putInt(seed[0]);
  13612. getOut().putInt(seed[1]);
  13613. getOut().putInt(seed[2]);
  13614. getOut().putInt(seed[3]);
  13615. getOut().putString(password);
  13616. getOut().putLong(Signlink.uid);
  13617. getOut().putString(username);
  13618. // getOut().putString(GenerateSerial.serialNumber);
  13619. getOut().encryptRSAContent();
  13620.  
  13621. getLoginBuffer().position = 0;
  13622. getLoginBuffer().putShortBigEndian(reconnecting ? 24 : 22);
  13623. getLoginBuffer().putShortBigEndian(getOut().position + 1 + 1 + 2);
  13624. getLoginBuffer().putInt(Constants.CLIENT_VERSION);
  13625. getLoginBuffer().putShort(255);
  13626. getLoginBuffer().putShortBigEndian(isLowDetail() ? 1 : 0);
  13627. getLoginBuffer().putBytes(getOut().buffer, getOut().position, 0);
  13628.  
  13629. getOut().cipher = new ISAACCipher(seed);
  13630.  
  13631. for (int i = 0; i < 4; i++) {
  13632. seed[i] += 50;
  13633. }
  13634.  
  13635. setConnectionCipher(new ISAACCipher(seed));
  13636. getConnection().queueBytes(getLoginBuffer().position, getLoginBuffer().buffer);
  13637. responseCode = getConnection().read();
  13638.  
  13639. }
  13640.  
  13641. if (responseCode == 1) {
  13642. try {
  13643. Thread.sleep(2000L);
  13644. } catch (Exception _ex) {
  13645. }
  13646.  
  13647. login(password, reconnecting, username);
  13648. return;
  13649. }
  13650.  
  13651. /**
  13652. * we've been registered to the server, finish our login
  13653. */
  13654. if (responseCode == 2) {
  13655. finishLogin(this);
  13656. PlayerHandler.load(this);
  13657. sendSettingConfigs();
  13658. if (Constants.REMEMBER_ME_SELECTED)
  13659. accountManager.addAccount(myUsername, password);
  13660. return;
  13661. }
  13662.  
  13663. /**
  13664. * Start our checks for invalid login attempts
  13665. */
  13666. if (responseCode == 3) {
  13667. setLoginMessage1("");
  13668. setLoginMessage2("Invalid username or password.");
  13669. return;
  13670. }
  13671.  
  13672. if (responseCode == 4) {
  13673. setLoginMessage1("");
  13674. setLoginMessage2("Your account has been disabled.");
  13675. return;
  13676. }
  13677.  
  13678. if (responseCode == 5) {
  13679. setLoginMessage1("Your account is already logged in.");
  13680. setLoginMessage2("Try again in 60 secs...");
  13681. return;
  13682. }
  13683.  
  13684. if (responseCode == 6) {
  13685. setLoginMessage1(Constants.CLIENT_NAME + " has been updated!");
  13686. setLoginMessage2("Please reload this page.");
  13687. return;
  13688. }
  13689.  
  13690. if (responseCode == 7) {
  13691. setLoginMessage1("This world is full.");
  13692. setLoginMessage2("Please use a different World.getWorld().");
  13693. return;
  13694. }
  13695.  
  13696. if (responseCode == 9) {
  13697. setLoginMessage1("Login limit exceeded.");
  13698. setLoginMessage2("Too many connections from your address.");
  13699. return;
  13700. }
  13701.  
  13702. if (responseCode == 10) {
  13703. loginMessage1 = "Unable to connect.";
  13704. loginMessage2 = "Bad session id.";
  13705. return;
  13706. }
  13707.  
  13708. if (responseCode == 11) {
  13709. setLoginMessage2("Login server rejected session.");
  13710. setLoginMessage2("Please try again.");
  13711. return;
  13712. }
  13713.  
  13714. if (responseCode == 12) {
  13715. setLoginMessage1("");
  13716. setLoginMessage2("Your username must include a number or letter.");
  13717. return;
  13718. }
  13719.  
  13720. if (responseCode == 13) {
  13721. setLoginMessage1("Could not complete login.");
  13722. setLoginMessage2("Please try using a different World.getWorld().");
  13723. return;
  13724. }
  13725.  
  13726. if (responseCode == 14) {
  13727. setLoginMessage1("The server is being updated.");
  13728. setLoginMessage2("Please wait 1 minute and try again.");
  13729. return;
  13730. }
  13731.  
  13732. if (responseCode == 15) {
  13733. setLoginMessage1("");
  13734. setLoginMessage2("This username is already taken.");
  13735. return;
  13736. }
  13737.  
  13738. if (responseCode == 16) {
  13739. setLoginMessage1("Login attempts exceeded.");
  13740. setLoginMessage2("Please wait 1 minute and try again.");
  13741. return;
  13742. }
  13743.  
  13744. if (responseCode == 17) {
  13745. setLoginMessage1("");
  13746. setLoginMessage2("Please fill all the details out.");
  13747. return;
  13748. }
  13749.  
  13750. if (responseCode == 18) {
  13751. setLoginMessage1("");
  13752. setLoginMessage2("Please type a valid email address.");
  13753. return;
  13754. }
  13755.  
  13756. if (responseCode == 19) {
  13757. setLoginMessage1("");
  13758. setLoginMessage2("Please type a shorter email address.");
  13759. return;
  13760. }
  13761.  
  13762. if (responseCode == 20) {
  13763. setLoginMessage1("");
  13764. setLoginMessage2("Please choose a shorter username.");
  13765. return;
  13766. }
  13767.  
  13768. if (responseCode == 21) {
  13769. setLoginMessage1("");
  13770. setLoginMessage2("Please choose a valid email address.");
  13771. return;
  13772. }
  13773.  
  13774. if (responseCode == 22) {
  13775. setLoginMessage1("");
  13776. setLoginMessage2("Your username contains invalid characters.");
  13777. return;
  13778. }
  13779.  
  13780. if (responseCode == 23) {
  13781. setLoginMessage1("");
  13782. setLoginMessage2("Your uid has been disabled.");
  13783. return;
  13784. }
  13785.  
  13786. if (responseCode == 24) {
  13787. setLoginMessage1("");
  13788. setLoginMessage2("This email address is already taken.");
  13789. return;
  13790. }
  13791.  
  13792. if (responseCode == 25) {
  13793. setLoginMessage1(Constants.CLIENT_NAME + " is being updated");
  13794. setLoginMessage2("You will be able to login shortly.");
  13795. return;
  13796. }
  13797.  
  13798. if (responseCode == 26) {
  13799. setLoginMessage1(Constants.CLIENT_NAME + " has experienced an unexpected");
  13800. setLoginMessage2("error, it will be back online again shortly.");
  13801. return;
  13802. }
  13803.  
  13804. if (responseCode == 27) {
  13805. setLoginMessage1("The name of that account is currently");
  13806. setLoginMessage2("being changed.");
  13807. return;
  13808. }
  13809.  
  13810. if (responseCode == 28) {
  13811. setLoginMessage1("That username is currently unavailable.");
  13812. setLoginMessage2("");
  13813. return;
  13814. }
  13815.  
  13816. if (responseCode == 29) {
  13817. setLoginMessage1("Your account is currently unavailable.");
  13818. setLoginMessage2("Merge is in progress.");
  13819. return;
  13820. }
  13821.  
  13822. if (responseCode == 30) {
  13823. setLoginMessage2("");
  13824. setLoginMessage1("Your account has been created!");
  13825. setPassword("");
  13826. setLoginScreenCursorPos(0);
  13827. setLoginState(1);
  13828. setLoginScreenState(2);
  13829. return;
  13830. }
  13831.  
  13832. if (responseCode == 31) {
  13833. for (int k1 = getConnection().read(); k1 >= 0; k1--) {
  13834. setLoginMessage1("You have only just left another world");
  13835. setLoginMessage2("Your profile will be transferred in: " + k1 + " seconds");
  13836. drawLoginScreen(true);
  13837.  
  13838. try {
  13839. Thread.sleep(1000L);
  13840. } catch (Exception _ex) {
  13841. }
  13842. }
  13843.  
  13844. login(password, reconnecting, username);
  13845. return;
  13846. }
  13847.  
  13848. /**
  13849. * We didn't receive a connection from the server
  13850. */
  13851. if (responseCode == -1) {
  13852. if (initialResponseCode == 0) {
  13853. if (getLoginFailures() < 2) {
  13854. try {
  13855. Thread.sleep(1000L);
  13856. } catch (Exception _ex) {
  13857. }
  13858.  
  13859. setLoginFailures(getLoginFailures() + 1);
  13860. login(password, reconnecting, username);
  13861. } else {
  13862. setLoginMessage1("No response from loginserver");
  13863. setLoginMessage2("Please wait 1 minute and try again.");
  13864. }
  13865. } else {
  13866. setLoginMessage1("No response from server");
  13867. setLoginMessage2("Please try using a different World.getWorld().");
  13868. }
  13869. } else {
  13870. setLoginMessage1("Unexpected server response");
  13871. setLoginMessage2("Please try using a different World.getWorld().");
  13872. }
  13873. } catch (IOException _ex) {
  13874. setLoginMessage1("");
  13875. setLoginMessage2("Failed to connect to the server...");
  13876.  
  13877. }
  13878. }
  13879.  
  13880. /**
  13881. * Finishes the successful login for the player
  13882. *
  13883. * @throws IOException
  13884. */
  13885. public void finishLogin(Client client) throws IOException {
  13886. client.myRights = client.getConnection().read();
  13887. Client.flagged = client.getConnection().read() == 1;
  13888. client.mouseDetection.coordsIndex = 0;
  13889. client.awtFocus = true;
  13890. client.aBoolean954 = true;
  13891. Client.loggedIn = true;
  13892. Client.getOut().position = 0;
  13893. client.getInputBuffer().position = 0;
  13894. client.currentPacketOpcode = -1;
  13895. client.anInt841 = -1;
  13896. client.anInt842 = -1;
  13897. client.anInt843 = -1;
  13898. client.pktSize = 0;
  13899. client.timeSinceLastPacket = 0;
  13900. client.systemUpdateTimer = 0;
  13901. client.idleStatus = 0;
  13902. client.anInt855 = 0;
  13903. client.menuActionRow = 0;
  13904. client.menuOpen = false;
  13905. client.idleTime = 0;
  13906. client.itemSelected = 0;
  13907. client.spellSelected = 0;
  13908. client.loadingStage = 0;
  13909. client.soundCount = 0;
  13910. client.setNorth();
  13911. client.setScriptManager(null);
  13912. client.anInt1021 = 0;
  13913. client.setAnInt985(-1);
  13914. client.destX = 0;
  13915. client.destY = 0;
  13916. client.playerCount = 0;
  13917. client.npcCount = 0;
  13918.  
  13919. for (int i = 0; i < client.getMaxPlayers(); i++) {
  13920. client.playerArray[i] = null;
  13921. client.getaStreamArray895s()[i] = null;
  13922. }
  13923.  
  13924. for (int i = 0; i < 16384; i++) {
  13925. client.npcArray[i] = null;
  13926. }
  13927.  
  13928. Client.myPlayer = client.playerArray[client.getMyPlayerIndex()] = new Player();
  13929. client.getaClass19_1013().removeAll();
  13930. client.getaClass19_1056().removeAll();
  13931.  
  13932. for (int l2 = 0; l2 < 4; l2++) {
  13933. for (int i3 = 0; i3 < 104; i3++) {
  13934. for (int k3 = 0; k3 < 104; k3++) {
  13935. client.groundArray[l2][i3][k3] = null;
  13936. }
  13937. }
  13938. }
  13939.  
  13940. client.setaClass19_1179(new Deque());
  13941. client.setFullscreenInterfaceID(-1);
  13942. client.setAnInt900(0);
  13943. client.friendCount = 0;
  13944. client.dialogID = -1;
  13945. client.backDialogID = -1;
  13946. Client.openInterfaceID = -1;
  13947. client.invOverlayInterfaceID = -1;
  13948. client.setWalkableInterface(-1);
  13949. client.dialogueOptionsShowing = false;
  13950. Client.tabID = 3;
  13951. client.inputDialogState = 0;
  13952. client.menuOpen = false;
  13953. client.messagePromptRaised = false;
  13954. client.aString844 = null;
  13955. client.anInt1055 = 0;
  13956. client.anInt1054 = -1;
  13957. client.aBoolean1047 = true;
  13958. client.method45();
  13959.  
  13960. for (int j3 = 0; j3 < 5; j3++) {
  13961. client.anIntArray990[j3] = 0;
  13962. }
  13963.  
  13964. for (int l3 = 0; l3 < 5; l3++) {
  13965. client.atPlayerActions[l3] = null;
  13966. client.atPlayerArray[l3] = false;
  13967. }
  13968.  
  13969. Client.setAnInt1175(0);
  13970. Client.setAnInt1134(0);
  13971. Client.setAnInt986(0);
  13972. Client.setAnInt1288(0);
  13973. Client.setAnInt924(0);
  13974. Client.setAnInt1188(0);
  13975. Client.setAnInt1155(0);
  13976. Client.setAnInt1226(0);
  13977. client.chatTypes = new int[500];
  13978. client.chatNames = new String[500];
  13979. client.chatMessages = new String[500];
  13980. client.resetImageProducers2();
  13981. client.updateGraphics(true);
  13982. mapArea.prayer.setOrbState(false);
  13983. if (GameFrame.getScreenMode() == ScreenMode.FIXED) {
  13984. client.updateGameArea();
  13985. }
  13986. DateFormat format = new SimpleDateFormat();
  13987. Date date = new Date();
  13988. if (jFrame != null)
  13989. jFrame.setTitle(Constants.CLIENT_NAME + " Official | Logged In: " + TextClass.fixName(getMyUsername()) + " " + format.format(date));
  13990. }
  13991.  
  13992. private void processMainScreenClick() {
  13993. if (anInt1021 != 0) {
  13994. return;
  13995. }
  13996.  
  13997. if (super.clickMode3 == 1) {
  13998. int clickX = super.saveClickX - (GameFrame.getScreenMode() == ScreenMode.FIXED ? 553 : getMapArea().getOffSetX() + 14);
  13999. int clickY = super.saveClickY - (GameFrame.getScreenMode() == ScreenMode.FIXED ? 9 : 5);
  14000.  
  14001. if (inCircle(0, 0, clickX, clickY, 76)) {
  14002. clickX -= 73;
  14003. clickY -= 75;
  14004. int k = viewRotation + minimapRotation & 0x7ff;
  14005. int i1 = Rasterizer.SINE[k];
  14006. int j1 = Rasterizer.COSINE[k];
  14007. i1 = i1 * (minimapZoom + 256) >> 8;
  14008. j1 = j1 * (minimapZoom + 256) >> 8;
  14009. int k1 = clickY * i1 + clickX * j1 >> 11;
  14010. int l1 = clickY * j1 - clickX * i1 >> 11;
  14011. int i2 = myPlayer.x + k1 >> 7;
  14012. int j2 = myPlayer.y - l1 >> 7;
  14013. boolean flag1 = doWalkTo(1, 0, 0, 0, myPlayer.smallY[0], 0, 0, j2, myPlayer.smallX[0], true, i2);
  14014.  
  14015. if (flag1) {
  14016. getOut().getByte(clickX);
  14017. getOut().getByte(clickY);
  14018. getOut().putShort(viewRotation);
  14019. getOut().putShortBigEndian(57);
  14020. getOut().putShortBigEndian(minimapRotation);
  14021. getOut().putShortBigEndian(minimapZoom);
  14022. getOut().getByte(89);
  14023. getOut().putShort(myPlayer.x);
  14024. getOut().putShort(myPlayer.y);
  14025. getOut().getByte(anInt1264);
  14026. getOut().getByte(63);
  14027. }
  14028. }
  14029.  
  14030. anInt1117++;
  14031.  
  14032. if (anInt1117 > 1151) {
  14033. anInt1117 = 0;
  14034. getOut().putOpcode(246);
  14035. getOut().getByte(0);
  14036. int l = getOut().position;
  14037.  
  14038. if ((int) (Math.random() * 2D) == 0) {
  14039. getOut().getByte(101);
  14040. }
  14041.  
  14042. getOut().getByte(197);
  14043. getOut().putShort((int) (Math.random() * 65536D));
  14044. getOut().getByte((int) (Math.random() * 256D));
  14045. getOut().getByte(67);
  14046. getOut().putShort(14214);
  14047.  
  14048. if ((int) (Math.random() * 2D) == 0) {
  14049. getOut().putShort(29487);
  14050. }
  14051.  
  14052. getOut().putShort((int) (Math.random() * 65536D));
  14053.  
  14054. if ((int) (Math.random() * 2D) == 0) {
  14055. getOut().getByte(220);
  14056. }
  14057.  
  14058. getOut().getByte(180);
  14059. getOut().putVariableSizeByte(getOut().position - l);
  14060. }
  14061. }
  14062. }
  14063.  
  14064. private boolean processMenuClick() {
  14065. if (activeInterfaceType != 0) {
  14066. return false;
  14067. }
  14068.  
  14069. int clickType = super.clickMode3;
  14070.  
  14071. if (spellSelected == 1 && super.saveClickX >= 516 && super.saveClickY >= 160 && super.saveClickX <= 765 && super.saveClickY <= 205) {
  14072. clickType = 0;
  14073. }
  14074.  
  14075. if (menuOpen) {
  14076. if (clickType != 1) {
  14077. int clickX = super.mouseX;
  14078. int clickY = super.mouseY;
  14079.  
  14080. if (menuScreenArea == 0) {
  14081. clickX -= GameFrame.getScreenMode() == ScreenMode.FIXED ? 4 : 0;
  14082. clickY -= GameFrame.getScreenMode() == ScreenMode.FIXED ? 4 : 0;
  14083. }
  14084.  
  14085. if (menuScreenArea == 1) {
  14086. clickX -= 519;
  14087. clickY -= 168;
  14088. }
  14089.  
  14090. if (menuScreenArea == 2) {
  14091. clickX -= 17;
  14092. clickY -= 338;
  14093. }
  14094.  
  14095. if (menuScreenArea == 3) {
  14096. clickX -= 519;
  14097. clickY -= 0;
  14098. }
  14099.  
  14100. if (clickX < menuOffsetX - 10 || clickX > menuOffsetX + menuWidth + 10 || clickY < menuOffsetY - 10 || clickY > menuOffsetY + menuHeight + 10) {
  14101. menuOpen = false;
  14102. // if (menuScreenArea == 1)
  14103. // {
  14104. // needDrawTabArea = true;
  14105. // }
  14106. if (menuScreenArea == 2) {
  14107. inputTaken = true;
  14108. }
  14109. }
  14110. }
  14111.  
  14112. if (clickType == 1) {
  14113. int xOffset = menuOffsetX;
  14114. int yOffset = menuOffsetY;
  14115. int width = menuWidth;
  14116. int clickX = super.saveClickX;
  14117. int clickY = super.saveClickY;
  14118.  
  14119. if (menuScreenArea == 0) {
  14120. clickX -= GameFrame.getScreenMode() == ScreenMode.FIXED ? 4 : 0;
  14121. clickY -= GameFrame.getScreenMode() == ScreenMode.FIXED ? 4 : 0;
  14122. }
  14123.  
  14124. if (menuScreenArea == 1) {
  14125. clickX -= 519;
  14126. clickY -= 168;
  14127. }
  14128.  
  14129. if (menuScreenArea == 2) {
  14130. clickX -= 17;
  14131. clickY -= 338;
  14132. }
  14133.  
  14134. if (menuScreenArea == 3) {
  14135. clickX -= 519;
  14136. clickY -= 0;
  14137. }
  14138.  
  14139. int actionIndex = -1;
  14140.  
  14141. for (int index = 0; index < menuActionRow; index++) {
  14142. int row = yOffset + 31 + (menuActionRow - 1 - index) * 15;
  14143.  
  14144. if (clickX > xOffset && clickX < xOffset + width && clickY > row - 11 && clickY < row + 5) {
  14145. actionIndex = index;
  14146. }
  14147. }
  14148.  
  14149. if (actionIndex != -1) {
  14150. doAction(actionIndex);
  14151. }
  14152.  
  14153. menuOpen = false;
  14154.  
  14155. if (menuScreenArea == 2) {
  14156. inputTaken = true;
  14157. }
  14158. }
  14159.  
  14160. return true;
  14161. } else {
  14162. if (clickType == 1 && menuActionRow > 0) {
  14163. int actionId = menuActionID[menuActionRow - 1];
  14164.  
  14165. if (actionId == 632 || actionId == 78 || actionId == 867 || actionId == 431 || actionId == 53 || actionId == 74 || actionId == 454 || actionId == 539 || actionId == 493
  14166. || actionId == 847 || actionId == 447 || actionId == 1125) {
  14167. int actionOne = menuActionCmd2[menuActionRow - 1];
  14168. int actionTwo = menuActionCmd3[menuActionRow - 1];
  14169. RSInterface rsi = RSInterface.interfaceCache[actionTwo];
  14170.  
  14171. if (rsi.allowSwapItems || rsi.deletesTargetSlot) {
  14172. aBoolean1242 = false;
  14173. anInt989 = 0;
  14174. anInt1084 = actionTwo;
  14175. anInt1085 = actionOne;
  14176. activeInterfaceType = 2;
  14177. anInt1087 = super.saveClickX;
  14178. anInt1088 = super.saveClickY;
  14179.  
  14180. if (RSInterface.interfaceCache[actionTwo].parentID == openInterfaceID) {
  14181. activeInterfaceType = 1;
  14182. }
  14183.  
  14184. if (RSInterface.interfaceCache[actionTwo].parentID == backDialogID) {
  14185. activeInterfaceType = 3;
  14186. }
  14187.  
  14188. return true;
  14189. }
  14190. }
  14191. }
  14192.  
  14193. if (clickType == 1 && (anInt1253 == 1 || menuHasAddFriend(menuActionRow - 1)) && menuActionRow > 2) {
  14194. clickType = 2;
  14195. }
  14196.  
  14197. if (clickType == 1 && menuActionRow > 0) {
  14198. doAction(menuActionRow - 1);
  14199. }
  14200.  
  14201. if (clickType == 2 && menuActionRow > 0) {
  14202. determineMenuSize();
  14203. }
  14204.  
  14205. return false;
  14206. }
  14207. }
  14208.  
  14209. private void processOnDemandQueue() {
  14210. do {
  14211. OnDemandRequest onDemandData;
  14212.  
  14213. do {
  14214. onDemandData = onDemandFetcher.getNextNode();
  14215.  
  14216. if (onDemandData == null) {
  14217. return;
  14218. }
  14219.  
  14220. if (onDemandData.getDataType() == 0) {
  14221. Model.method460(onDemandData.getBuffer(), onDemandData.getId());
  14222. // needDrawTabArea = true;
  14223.  
  14224. if (backDialogID != -1) {
  14225. setInputTaken(true);
  14226. }
  14227. }
  14228.  
  14229. if (onDemandData.getDataType() == 1) {
  14230. FrameReader.load(onDemandData.getId(), onDemandData.getBuffer());
  14231. }
  14232.  
  14233. if (onDemandData.getDataType() == 2 && onDemandData.getId() == nextSong && onDemandData.getBuffer() != null) {
  14234. musicData = new byte[onDemandData.getBuffer().length];
  14235. ArrayUtils.arraycopy(onDemandData.getBuffer(), 0, musicData, 0, musicData.length);
  14236. fetchMusic = true;
  14237. }
  14238.  
  14239. if (onDemandData.getDataType() == 3 && loadingStage == 1) {
  14240. for (int i = 0; i < aByteArrayArray1183.length; i++) {
  14241. if (floorMap[i] == onDemandData.getId()) {
  14242. aByteArrayArray1183[i] = onDemandData.getBuffer();
  14243.  
  14244. if (onDemandData.getBuffer() == null) {
  14245. floorMap[i] = -1;
  14246. }
  14247.  
  14248. break;
  14249. }
  14250.  
  14251. if (objectMap[i] != onDemandData.getId()) {
  14252. continue;
  14253. }
  14254.  
  14255. aByteArrayArray1247[i] = onDemandData.getBuffer();
  14256.  
  14257. if (onDemandData.getBuffer() == null) {
  14258. objectMap[i] = -1;
  14259. }
  14260.  
  14261. break;
  14262. }
  14263. }
  14264. if (onDemandData.getDataType() == 4) {
  14265. Texture.decode(onDemandData.getId(), onDemandData.getBuffer());
  14266. }
  14267. } while (onDemandData.getDataType() != 93 || !onDemandFetcher.method564(onDemandData.getId()));
  14268.  
  14269. ObjectManager.method173(new ByteBuffer(onDemandData.getBuffer()), onDemandFetcher);
  14270. } while (true);
  14271. }
  14272.  
  14273. private void processRightClick() {
  14274. if (activeInterfaceType != 0) {
  14275. return;
  14276. }
  14277.  
  14278. menuActionName[0] = "Cancel";
  14279. menuActionID[0] = 1107;
  14280. menuActionRow = 1;
  14281.  
  14282. int splitBoxX = 495;
  14283. int splitBoxY = 122 + (GameFrame.getScreenMode() == ScreenMode.FIXED ? 0 : 2);
  14284.  
  14285. if (getFullscreenInterfaceID() != -1) {
  14286. anInt886 = 0;
  14287. anInt1315 = 0;
  14288. buildInterfaceMenu(GameFrame.getScreenMode() == ScreenMode.FIXED ? 8 : getScreenWidth() / 2 - RSInterface.interfaceCache[getFullscreenInterfaceID()].width / 2,
  14289. RSInterface.interfaceCache[getFullscreenInterfaceID()], super.mouseX,
  14290. GameFrame.getScreenMode() == ScreenMode.FIXED ? 8 : getScreenHeight() / 2 - RSInterface.interfaceCache[getFullscreenInterfaceID()].height / 2, super.mouseY, 0);
  14291.  
  14292. if (anInt886 != anInt1026) {
  14293. anInt1026 = anInt886;
  14294. }
  14295.  
  14296. if (anInt1315 != anInt1129) {
  14297. anInt1129 = anInt1315;
  14298. }
  14299.  
  14300. return;
  14301. }
  14302.  
  14303. if (!chatArea.componentHidden() && isGameFrameVisible()) {
  14304. buildSplitPrivateChatMenu();
  14305. }
  14306.  
  14307. boolean inSplitChatSelectionBox = mouseX >= splitBoxX && mouseX <= splitBoxX + 15 && mouseY >= splitBoxY + chatArea.getyPos() && mouseY <= splitBoxY + chatArea.getyPos() + 13;
  14308. if (inSplitChatSelectionBox) {
  14309. chatArea.channel.processChatModeActions(this, GameFrame.getScreenMode());
  14310. return;
  14311. }
  14312.  
  14313. anInt886 = 0;
  14314. anInt1315 = 0;
  14315. int width = GameFrame.getScreenMode() != ScreenMode.FIXED ? getScreenWidth() : 516;
  14316. int height = GameFrame.getScreenMode() != ScreenMode.FIXED ? getScreenHeight() : 338;
  14317.  
  14318. if (super.mouseX > gameScreenDrawX && super.mouseY > gameScreenDrawY && super.mouseX < width && super.mouseY < height) {
  14319. if (openInterfaceID != -1 && isGameFrameVisible()) {
  14320. RSInterface rsInterface = RSInterface.interfaceCache[openInterfaceID];
  14321.  
  14322. if (GameFrame.getScreenMode() != ScreenMode.FIXED) {
  14323. int interfaceWidth = GameFrame.getScreenMode() != ScreenMode.FIXED ? getScreenWidth() : 516;
  14324. int interfaceHeight = GameFrame.getScreenMode() != ScreenMode.FIXED ? getScreenHeight() : 338;
  14325. buildInterfaceMenu(gameScreenDrawX + (interfaceWidth - 765) / 2, rsInterface, super.mouseX, gameScreenDrawY + (interfaceHeight - 503) / 2, super.mouseY, 0);
  14326. } else {
  14327. buildInterfaceMenu(4, rsInterface, super.mouseX, 4, super.mouseY, 0);
  14328. }
  14329. } else {
  14330. try {
  14331. if (GameFrame.getScreenMode() != ScreenMode.FIXED) {
  14332. if (!getMapArea().isHovering(this, GameFrame.getScreenMode()) && !chatArea.isHovering(this, GameFrame.getScreenMode())
  14333. && !tabArea.isHovering(this, GameFrame.getScreenMode())) {
  14334. build3dScreenMenu();
  14335. }
  14336. } else {
  14337. build3dScreenMenu();
  14338. }
  14339. } catch (Exception e) {
  14340. e.printStackTrace();
  14341. }
  14342. }
  14343. }
  14344.  
  14345. chatArea.channel.processChatModeActions(this, GameFrame.getScreenMode());
  14346.  
  14347. if (anInt886 != anInt1026) {
  14348. anInt1026 = anInt886;
  14349. }
  14350.  
  14351. if (anInt1315 != anInt1129) {
  14352. anInt1129 = anInt1315;
  14353. }
  14354.  
  14355. anInt886 = 0;
  14356. anInt1315 = 0;
  14357.  
  14358. if (tabArea.isHovering(this, GameFrame.getScreenMode()) && !tabArea.componentHidden()) {
  14359. if (invOverlayInterfaceID != -1) {
  14360. buildInterfaceMenu(tabArea.getxPos() + (GameFrame.getScreenMode() == ScreenMode.FIXED ? 31 : 40), RSInterface.interfaceCache[invOverlayInterfaceID], super.mouseX,
  14361. tabArea.getyPos() + (GameFrame.getScreenMode() == ScreenMode.FIXED ? 36 : getScreenWidth() <= GameFrameConstants.smallTabs ? -6 : 30), super.mouseY, 0);
  14362. } else if (tabInterfaceIDs[tabID] != -1) {
  14363. buildInterfaceMenu(tabArea.getxPos() + (GameFrame.getScreenMode() == ScreenMode.FIXED ? 31 : 40), RSInterface.interfaceCache[tabInterfaceIDs[tabID]], super.mouseX,
  14364. tabArea.getyPos() + (GameFrame.getScreenMode() == ScreenMode.FIXED ? 36 : getScreenWidth() <= GameFrameConstants.smallTabs ? -6 : 30), super.mouseY, 0);
  14365. }
  14366. }
  14367.  
  14368. if (anInt886 != anInt1048) {
  14369. // needDrawTabArea = true;
  14370. tabAreaAltered = true;
  14371. anInt1048 = anInt886;
  14372. }
  14373.  
  14374. if (anInt1315 != anInt1044) {
  14375. // needDrawTabArea = true;
  14376. tabAreaAltered = true;
  14377. anInt1044 = anInt1315;
  14378. }
  14379.  
  14380. anInt886 = 0;
  14381. anInt1315 = 0;
  14382.  
  14383. if (super.mouseX > chatArea.getxPos() && super.mouseY > chatArea.getyPos() && super.mouseX < chatArea.getxPos() + 490 && super.mouseY < chatArea.getyPos() + 125) {
  14384. if (backDialogID != -1) {
  14385. buildInterfaceMenu(20, RSInterface.interfaceCache[backDialogID], super.mouseX, chatArea.getyPos() + 20, super.mouseY, chatArea.getxPos());
  14386. } else if (super.mouseY < chatArea.getyPos() + 125 && super.mouseX < chatArea.getxPos() + 490) {
  14387. buildChatAreaMenu(super.mouseY - chatArea.getyPos());
  14388. }
  14389. }
  14390.  
  14391. if (backDialogID != -1 && anInt886 != anInt1039) {
  14392. setInputTaken(true);
  14393. anInt1039 = anInt886;
  14394. }
  14395.  
  14396. if (backDialogID != -1 && anInt1315 != anInt1500) {
  14397. setInputTaken(true);
  14398. anInt1500 = anInt1315;
  14399. }
  14400.  
  14401. getMapArea().processMinimapActions(this);
  14402. boolean flag = false;
  14403.  
  14404. while (!flag) {
  14405. flag = true;
  14406.  
  14407. for (int j = 0; j < menuActionRow - 1; j++) {
  14408. if (menuActionID[j] < 1000 && menuActionID[j + 1] > 1000) {
  14409. String s = menuActionName[j];
  14410. menuActionName[j] = menuActionName[j + 1];
  14411. menuActionName[j + 1] = s;
  14412. int k = menuActionID[j];
  14413. menuActionID[j] = menuActionID[j + 1];
  14414. menuActionID[j + 1] = k;
  14415. k = menuActionCmd2[j];
  14416. menuActionCmd2[j] = menuActionCmd2[j + 1];
  14417. menuActionCmd2[j + 1] = k;
  14418. k = menuActionCmd3[j];
  14419. menuActionCmd3[j] = menuActionCmd3[j + 1];
  14420. menuActionCmd3[j + 1] = k;
  14421. k = menuActionCmd4[j];
  14422. menuActionCmd4[j] = menuActionCmd4[j + 1];
  14423. menuActionCmd4[j + 1] = k;
  14424. k = menuActionCmd1[j];
  14425. menuActionCmd1[j] = menuActionCmd1[j + 1];
  14426. menuActionCmd1[j + 1] = k;
  14427. flag = false;
  14428. }
  14429. }
  14430. }
  14431. }
  14432.  
  14433. private boolean promptUserForInput(RSInterface rsinterface) {
  14434. int id = rsinterface.contentType;
  14435.  
  14436. if (getAnInt900() == 2) {
  14437. if (id == 201) {
  14438. inputTaken = true;
  14439. inputDialogState = 0;
  14440. messagePromptRaised = true;
  14441. promptInput = "";
  14442. friendsListAction = 1;
  14443. promptMessage = "Enter name of friend to add to list";
  14444. }
  14445.  
  14446. if (id == 202) {
  14447. inputTaken = true;
  14448. inputDialogState = 0;
  14449. messagePromptRaised = true;
  14450. promptInput = "";
  14451. friendsListAction = 2;
  14452. promptMessage = "Enter name of friend to delete from list";
  14453. }
  14454. }
  14455.  
  14456. if (id == 205) {
  14457. // logger.info("Settting idle status: " + id);
  14458. idleStatus = 250;
  14459. return true;
  14460. }
  14461.  
  14462. if (id == 501) {
  14463. inputTaken = true;
  14464. inputDialogState = 0;
  14465. messagePromptRaised = true;
  14466. promptInput = "";
  14467. friendsListAction = 4;
  14468. promptMessage = "Enter the name of a player to add to the list";
  14469. }
  14470.  
  14471. if (id == 502) {
  14472. inputTaken = true;
  14473. inputDialogState = 0;
  14474. messagePromptRaised = true;
  14475. promptInput = "";
  14476. friendsListAction = 5;
  14477. promptMessage = "Enter the name of a player to delete from the list";
  14478. }
  14479.  
  14480. if (id == 550) {
  14481. if (RSInterface.interfaceCache[18135].message.startsWith("Join")) {
  14482. inputTaken = true;
  14483. inputDialogState = 0;
  14484. messagePromptRaised = true;
  14485. promptInput = "";
  14486. friendsListAction = 6;
  14487. promptMessage = "Enter the name of the chat you wish to join";
  14488. } else {
  14489. getOut().putOpcode(243);
  14490. getOut().putShort(49627);
  14491. }
  14492. }
  14493.  
  14494. if (id == 22222) {
  14495. inputTaken = true;
  14496. messagePromptRaised = true;
  14497. amountOrNameInput = "";
  14498. promptInput = "";
  14499. inputDialogState = 0;
  14500. interfaceButtonAction = 6199;
  14501. promptMessage = "Enter a name for the clan chat.";
  14502. }
  14503.  
  14504. if (id == 677) {
  14505. inputTaken = true;
  14506. messagePromptRaised = true;
  14507. amountOrNameInput = "";
  14508. promptInput = "";
  14509. inputDialogState = 0;
  14510. interfaceButtonAction = 6200;
  14511. promptMessage = "Enter name of the player you would like kicked.";
  14512. }
  14513.  
  14514. if (id >= 300 && id <= 313) {
  14515. int k = (id - 300) / 2;
  14516. int j1 = id & 1;
  14517. int i2 = anIntArray1065[k];
  14518.  
  14519. if (i2 != -1) {
  14520. do {
  14521. if (j1 == 0 && --i2 < 0) {
  14522. i2 = IdentityKit.getLength() - 1;
  14523. }
  14524.  
  14525. if (j1 == 1 && ++i2 >= IdentityKit.getLength()) {
  14526. i2 = 0;
  14527. }
  14528. } while (IdentityKit.cache[i2].isaBoolean662() || IdentityKit.cache[i2].getAnInt657() != k + (aBoolean1047 ? 0 : 7));
  14529.  
  14530. anIntArray1065[k] = i2;
  14531. aBoolean1031 = true;
  14532. }
  14533. }
  14534.  
  14535. if (id >= 314 && id <= 323) {
  14536. int l = (id - 314) / 2;
  14537. int k1 = id & 1;
  14538. int j2 = anIntArray990[l];
  14539.  
  14540. if (k1 == 0 && --j2 < 0) {
  14541. j2 = anIntArrayArray1003[l].length - 1;
  14542. }
  14543.  
  14544. if (k1 == 1 && ++j2 >= anIntArrayArray1003[l].length) {
  14545. j2 = 0;
  14546. }
  14547.  
  14548. anIntArray990[l] = j2;
  14549. aBoolean1031 = true;
  14550. }
  14551.  
  14552. if (id == 324 && !aBoolean1047) {
  14553. aBoolean1047 = true;
  14554. method45();
  14555. }
  14556.  
  14557. if (id == 325 && aBoolean1047) {
  14558. aBoolean1047 = false;
  14559. method45();
  14560. }
  14561.  
  14562. if (id == 326) {
  14563. getOut().putOpcode(106);
  14564. getOut().putShortBigEndian(aBoolean1047 ? 0 : 1);
  14565.  
  14566. for (int i = 0; i < 7; i++) {
  14567. getOut().putShortBigEndian(anIntArray1065[i]);
  14568. }
  14569.  
  14570. for (int i = 0; i < 5; i++) {
  14571. getOut().putShortBigEndian(anIntArray990[i]);
  14572. }
  14573.  
  14574. return true;
  14575. }
  14576.  
  14577. return false;
  14578. }
  14579.  
  14580. public final int[] chatColor = new int[500];
  14581.  
  14582. public void pushMessage(String chatMessage, int chatType, String chatName, String title, int color, int position) {
  14583. if (chatType == 0 && dialogID != -1) {
  14584. aString844 = chatMessage;
  14585. super.clickMode3 = 0;
  14586. }
  14587.  
  14588. if (backDialogID == -1) {
  14589. inputTaken = true;
  14590. }
  14591.  
  14592. for (int j = 499; j > 0; j--) {
  14593. chatTypes[j] = chatTypes[j - 1];
  14594. chatNames[j] = chatNames[j - 1];
  14595. chatMessages[j] = chatMessages[j - 1];
  14596. chatRights[j] = chatRights[j - 1];
  14597. chatTitles[j] = chatTitles[j - 1];
  14598. chatPosition[j] = chatPosition[j - 1];
  14599. chatColor[j] = chatColor[j - 1];
  14600. }
  14601.  
  14602. chatTypes[0] = chatType;
  14603. chatNames[0] = chatName;
  14604. chatMessages[0] = chatMessage.trim();
  14605. chatRights[0] = rights;
  14606. chatTitles[0] = title;
  14607. chatColor[0] = color;
  14608. chatPosition[0] = position;
  14609. }
  14610.  
  14611. public void pushMessage(String chatMessage, int chatType, String chatName) {
  14612. if (chatType == 0 && dialogID != -1) {
  14613. aString844 = chatMessage;
  14614. super.clickMode3 = 0;
  14615. }
  14616.  
  14617. if (backDialogID == -1) {
  14618. inputTaken = true;
  14619. }
  14620.  
  14621. for (int j = 499; j > 0; j--) {
  14622. chatTypes[j] = chatTypes[j - 1];
  14623. chatNames[j] = chatNames[j - 1];
  14624. chatMessages[j] = chatMessages[j - 1];
  14625. chatRights[j] = chatRights[j - 1];
  14626. chatTitles[j] = chatTitles[j - 1];
  14627. chatPosition[j] = chatPosition[j - 1];
  14628. chatColor[j] = chatColor[j - 1];
  14629. }
  14630.  
  14631. chatTypes[0] = chatType;
  14632. chatNames[0] = chatName;
  14633. chatMessages[0] = chatMessage.trim();
  14634. chatRights[0] = rights;
  14635. chatTitles[0] = "";
  14636. chatColor[0] = 0;
  14637. chatPosition[0] = 0;
  14638. }
  14639.  
  14640. @Override
  14641. public void raiseWelcomeScreen() {
  14642. welcomeScreenRaised = true;
  14643. }
  14644.  
  14645. private void resetAllImageProducers() {
  14646. if (super.fullGameScreen != null) {
  14647. return;
  14648. }
  14649.  
  14650. chatAreaIP = null;
  14651. mapAreaIP = null;
  14652. tabAreaIP = null;
  14653. gameScreenIP = null;
  14654. aRSImageProducer_1125 = null;
  14655. aRSImageProducer_1107 = null;
  14656. titleScreenIP = null;
  14657. super.fullGameScreen = constructGraphicsBuffer(getScreenWidth(), getScreenHeight(), getGameComponent());
  14658. welcomeScreenRaised = true;
  14659. }
  14660.  
  14661. private void resetImageProducers() {
  14662. if (aRSImageProducer_1107 != null) {
  14663. return;
  14664. }
  14665. super.fullGameScreen = null;
  14666. chatAreaIP = null;
  14667. mapAreaIP = null;
  14668. tabAreaIP = null;
  14669. gameScreenIP = null;
  14670. aRSImageProducer_1125 = null;
  14671. aRSImageProducer_1107 = constructGraphicsBuffer(509, 171, getGameComponent());
  14672. DrawingArea.setAllPixelsToZero();
  14673. titleScreenIP = constructGraphicsBuffer(getScreenWidth(), getScreenHeight(), getGameComponent());
  14674. DrawingArea.setAllPixelsToZero();
  14675. constructGraphicsBuffer(203, 238, getGameComponent());
  14676. DrawingArea.setAllPixelsToZero();
  14677. constructGraphicsBuffer(74, 94, getGameComponent());
  14678. DrawingArea.setAllPixelsToZero();
  14679. if (titleStreamLoader != null) {
  14680. drawLogo();
  14681. loadTitleScreen();
  14682. }
  14683. welcomeScreenRaised = true;
  14684. }
  14685.  
  14686. public void resetImageProducers2() {
  14687. if (chatAreaIP != null) {
  14688. return;
  14689. }
  14690. nullLoader();
  14691. super.fullGameScreen = null;
  14692. aRSImageProducer_1107 = null;
  14693. titleScreenIP = null;
  14694. chatAreaIP = constructGraphicsBuffer(516, 165, getGameComponent());
  14695. mapAreaIP = constructGraphicsBuffer(249, 168, getGameComponent());
  14696. DrawingArea.setAllPixelsToZero();
  14697. if (GameFrame.getScreenMode() == ScreenMode.FIXED) {
  14698. cacheSprite[14].drawSprite(0, 0);
  14699. }
  14700. tabAreaIP = constructGraphicsBuffer(250, 335, getGameComponent());
  14701. gameScreenIP = constructGraphicsBuffer(GameFrame.getScreenMode() == ScreenMode.FIXED && isGameFrameVisible() ? 512 : getScreenWidth(),
  14702. GameFrame.getScreenMode() == ScreenMode.FIXED && isGameFrameVisible() ? 334 : getScreenHeight(), getGameComponent());
  14703. DrawingArea.setAllPixelsToZero();
  14704. aRSImageProducer_1125 = constructGraphicsBuffer(249, 45, getGameComponent());
  14705. welcomeScreenRaised = true;
  14706. }
  14707.  
  14708. public void resetLogout() {
  14709. try {
  14710. if (getConnection() != null) {
  14711. getConnection().close();
  14712. }
  14713. } catch (Exception _ex) {
  14714. }
  14715. CLAN_CHAT_USERS.clear();
  14716. CONFIGURE_INTERFACE_USERS.clear();
  14717. lootingBag = false;
  14718. setConnection(null);
  14719. loggedIn = false;
  14720. setLoginScreenState(0);
  14721. setLoginScreenCursorPos(0);
  14722.  
  14723. setLoginMessage1("Enter your username & password.");
  14724. setLoginMessage2("");
  14725. unlinkMRUNodes();
  14726. worldController.initToNull();
  14727.  
  14728. for (int i = 0; i < 4; i++) {
  14729. aClass11Array1230[i].method210();
  14730. }
  14731.  
  14732. synchronized (tasks) {
  14733. tasks.clear();
  14734. }
  14735.  
  14736. if (!Constants.REMEMBER_ME_SELECTED) {
  14737. myUsername = password = "";
  14738. }
  14739.  
  14740. System.gc();
  14741. stopMidi();
  14742. currentSong = -1;
  14743. nextSong = -1;
  14744. prevSong = 0;
  14745. method58(10, 0, false, 0);
  14746. updateGraphics(true);
  14747. savePlayerData();
  14748. if (jFrame != null)
  14749. jFrame.setTitle(Constants.CLIENT_NAME + " Official");
  14750.  
  14751. // logger.info("Resetting logout.");
  14752. }
  14753.  
  14754. public void resetWorld(int stage) {
  14755. if (stage == 0) {
  14756. soundCount = 0;
  14757. cameraOffsetX = 0;
  14758. cameraOffsetY = 0;
  14759. viewRotationOffset = 0;
  14760. minimapRotation = 0;
  14761. minimapZoom = 0;
  14762. viewRotation = 0;
  14763. anInt1021 = 0;
  14764. loadingStage = 1;
  14765. } else if (stage == 1) {
  14766. aBoolean1080 = false;
  14767. }
  14768. }
  14769.  
  14770. @Override
  14771. public void run() {
  14772. try {
  14773. if (drawFlames) {
  14774. drawFlames();
  14775. } else {
  14776. super.run();
  14777. }
  14778. } catch (Exception e) {
  14779. e.printStackTrace();
  14780. }
  14781. }
  14782.  
  14783. private void sendFrame248(int interfaceID, int sideInterfaceID) {
  14784. if (backDialogID != -1) {
  14785. backDialogID = -1;
  14786. inputTaken = true;
  14787. }
  14788. if (inputDialogState != 0) {
  14789. inputDialogState = 0;
  14790. inputTaken = true;
  14791. }
  14792. openInterfaceID = interfaceID;
  14793. invOverlayInterfaceID = sideInterfaceID;
  14794. tabAreaAltered = true;
  14795. dialogueOptionsShowing = false;
  14796. }
  14797.  
  14798. private void sendFrame36(int id, int state) {
  14799. settings[id] = state;
  14800.  
  14801. if (variousSettings[id] != state) {
  14802. variousSettings[id] = state;
  14803. updateConfig(id);
  14804.  
  14805. if (dialogID != -1) {
  14806. inputTaken = true;
  14807. }
  14808. }
  14809. }
  14810.  
  14811. private void sendPacket(int packet) {
  14812. if (packet == 103) {
  14813. getOut().putOpcode(103);
  14814. getOut().putShortBigEndian(inputString.length() - 1);
  14815. getOut().putString(inputString.substring(2));
  14816. inputString = "";
  14817. promptInput = "";
  14818. interfaceButtonAction = 0;
  14819. } else if (packet == 1003) {
  14820. getOut().putOpcode(103);
  14821. inputString = "::" + inputString;
  14822. getOut().putShortBigEndian(inputString.length() - 1);
  14823. getOut().putString(inputString.substring(2));
  14824. inputString = "";
  14825. promptInput = "";
  14826. interfaceButtonAction = 0;
  14827. } else if (packet == 107 || packet == 110) {
  14828. long amount = 0;
  14829. try {
  14830. amount = Long.parseLong(inputString);
  14831. } catch (NumberFormatException e) {
  14832. pushMessage("Please enter a valid amount.", 0, "");
  14833. amount = -1;
  14834. }
  14835.  
  14836. if (amount > Long.MAX_VALUE) {
  14837. amount = Long.MAX_VALUE;
  14838. }
  14839.  
  14840. if (amount != -1) {
  14841. getOut().putOpcode(packet);
  14842. getOut().putLong(amount);
  14843. }
  14844. inputString = "";
  14845. promptInput = "";
  14846. interfaceButtonAction = 0;
  14847. if (packet == 107) {
  14848. MapArea.pouchModifyType = PouchModifyType.ADD;
  14849. } else if (packet == 110) {
  14850. MapArea.pouchModifyType = PouchModifyType.REMOVE;
  14851. }
  14852. MapArea.moneyPouchFlash = 100;
  14853. } else if (packet == 108) {
  14854. getOut().putOpcode(packet);
  14855. }
  14856. }
  14857.  
  14858. private void setCameraPos(int j, int k, int l, int i1, int j1, int k1) {
  14859. int l1 = 2048 - k & 0x7ff;
  14860. int i2 = 2048 - j1 & 0x7ff;
  14861. int j2 = 0;
  14862. int k2 = 0;
  14863. int l2 = j;
  14864. if (l1 != 0) {
  14865. int i3 = Model.modelIntArray1[l1];
  14866. int k3 = Model.modelIntArray2[l1];
  14867. int i4 = k2 * k3 - l2 * i3 >> 16;
  14868. l2 = k2 * i3 + l2 * k3 >> 16;
  14869. k2 = i4;
  14870. }
  14871. if (i2 != 0) {
  14872. int j3 = Model.modelIntArray1[i2];
  14873. int l3 = Model.modelIntArray2[i2];
  14874. int j4 = l2 * j3 + j2 * l3 >> 16;
  14875. l2 = l2 * l3 - j2 * j3 >> 16;
  14876. j2 = j4;
  14877. }
  14878. xCameraPos = l - j2;
  14879. zCameraPos = i1 - k2;
  14880. yCameraPos = k1 - l2;
  14881. yCameraCurve = k;
  14882. xCameraCurve = j1;
  14883. }
  14884.  
  14885. public void setDebugMode(boolean debugMode) {
  14886. this.debugMode = debugMode;
  14887. }
  14888.  
  14889. private void setGameFrameVisible(boolean visible, GameFrame[] area) {
  14890. for (GameFrame a : area) {
  14891. a.setVisible(visible);
  14892. }
  14893.  
  14894. gameAreaWidth = GameFrame.getScreenMode() == ScreenMode.FIXED && visible ? 512 : getScreenWidth();
  14895. gameAreaHeight = GameFrame.getScreenMode() == ScreenMode.FIXED && visible ? 334 : getScreenHeight();
  14896. gameFrameVisible = visible;
  14897. }
  14898.  
  14899. public void setInputTaken(boolean inputTaken) {
  14900. this.inputTaken = inputTaken;
  14901. }
  14902.  
  14903. /**
  14904. * The line ids in order
  14905. */
  14906. private static int[] lines = { 640, 663, 7332, 7333, 7334, 7336, 7383, 7339, 7338, 7340, 7346, 7341, 7342, 7337, 7343, 7335, 7344, 7345, 7347, 7348, 682, 12772, 673, 7352, 17510, 7353, 12129,
  14907. 8438, 12852, 15841, 7354, 7355, 7356, 8679, 7459, 16149, 6987, 7357, 12836, 7358, 7359, 14169, 10115, 14604, 7360, 12282, 13577, 12839, 7361, 16128, 11857, 7362, 7363, 7364, 10135, 4508,
  14908. 18517, 11907, 7365, 7366, 7367, 13389, 15487, 7368, 11132, 7369, 12389, 13974, 6027, 7370, 8137, 7371, 12345, 7372, 8115, 18684, 15499, 18306, 668, 8576, 12139, 14912, 7373, 7374, 8969,
  14909. 15352, 7375, 7376, 15098, 15592, 249, 1740, 15235, 3278, 7378, 6518, 7379, 7380, 7381, 11858, 191, 9927, 6024, 7349, 7350, 7351, 13356
  14910.  
  14911. };
  14912.  
  14913. public void setInterfaceText(String str, int i) {
  14914. try {
  14915. RSInterface _interface = RSInterface.interfaceCache[i];
  14916. _interface.message = str;
  14917.  
  14918. // if (_interface.parentID == tabInterfaceIDs[tabID])
  14919. // {
  14920. // needDrawTabArea = true;
  14921. // }
  14922.  
  14923. if (_interface.type == 9) {
  14924. _interface.tooltipBoxText = str;
  14925. }
  14926.  
  14927. if (_interface.secondaryText != null && _interface.secondaryText.length() > 0) {
  14928. _interface.secondaryText = "";
  14929. }
  14930.  
  14931. for (int li : lines) {
  14932. if (i == li) {
  14933. _interface.tooltip = str;
  14934. break;
  14935. }
  14936. }
  14937. } catch (Exception exception) {
  14938. exception.getStackTrace();
  14939. // System.out.println(i);
  14940. }
  14941. }
  14942.  
  14943. private String setMessage(int level) {
  14944. String[] messages = new String[4];
  14945. String message = "";
  14946. int[] stuff = { 0, 3, 14, 2, 16, 13, 1, 15, 10, 4, 17, 7, 5, 12, 11, 6, 9, 8, 20, 18, 19, 21, 22, 23 };
  14947.  
  14948. messages[1] = skillNames[level] + " XP: " + NumberFormat.getIntegerInstance().format(currentExp[stuff[level]]) + "\\n";
  14949. messages[2] = "Remainder: " + NumberFormat.getIntegerInstance().format(getExperienceForLevel(maxStats[stuff[level]] + 1) - getExperienceForLevel(maxStats[stuff[level]])) + "\\n";
  14950. messages[3] = "Next level: " + NumberFormat.getIntegerInstance().format(getExperienceForLevel(maxStats[stuff[level]] + 1));
  14951. message = messages[1] + messages[2] + messages[3];
  14952.  
  14953. if (maxStats[stuff[level]] >= 99) {
  14954. message = messages[1];
  14955. }
  14956.  
  14957. return message;
  14958. }
  14959.  
  14960. public void setNorth() {
  14961. cameraOffsetX = 0;
  14962. cameraOffsetY = 0;
  14963. viewRotationOffset = 0;
  14964. viewRotation = 0;
  14965. minimapRotation = 0;
  14966. minimapZoom = 0;
  14967. }
  14968.  
  14969. private static void showErrorScreen(Client client, String... messages) {
  14970. client.method4(1);
  14971. Graphics g = client.getGameComponent().getGraphics();
  14972. Color titleTextColor = new Color(205, 50, 50);
  14973. Color textColor = new Color(191, 30, 30);
  14974. g.setColor(Color.BLACK);
  14975. g.fillRect(0, 0, 765, 503);
  14976. g.setFont(new Font("Verdana", 1, 18));
  14977. g.setColor(titleTextColor);
  14978. g.drawString("Sorry, an error has occured whilst starting up Zamorak", 30, 35);
  14979. g.drawLine(30, 40, 645, 40);
  14980. g.setFont(new Font("Arial", 1, 90));
  14981. g.setColor(textColor);
  14982. g.setFont(new Font("Verdana", 1, 16));
  14983. int startingX = 30, startingY = 40;
  14984. for (String message : messages) {
  14985. startingY += 40;
  14986. g.drawString(message, startingX, startingY);
  14987. }
  14988. }
  14989.  
  14990. private void spawnGroundItem(int i, int j) {
  14991. Deque groundItems = groundArray[plane][i][j];
  14992. if (groundItems == null) {
  14993. worldController.method295(plane, i, j);
  14994. return;
  14995. }
  14996. int k = 0xfa0a1f01;
  14997. Object obj = null;
  14998. for (Item item = (Item) groundItems.reverseGetFirst(); item != null; item = (Item) groundItems.reverseGetNext()) {
  14999. ItemDefinition itemDef = ItemDefinition.get(item.id);
  15000. int l = itemDef.value;
  15001. if (itemDef.stackable) {
  15002. l *= item.amount + 1;
  15003. }
  15004. if (l > k) {
  15005. k = l;
  15006. obj = item;
  15007. }
  15008. }
  15009.  
  15010. groundItems.insertTail((Node) obj);
  15011. Object obj1 = null;
  15012. Object obj2 = null;
  15013. for (Item groundItem = (Item) groundItems.reverseGetFirst(); groundItem != null; groundItem = (Item) groundItems.reverseGetNext()) {
  15014. if (groundItem.id != ((Item) obj).id && obj1 == null) {
  15015. obj1 = groundItem;
  15016. }
  15017. if (groundItem.id != ((Item) obj).id && groundItem.id != ((Item) obj1).id && obj2 == null) {
  15018. obj2 = groundItem;
  15019. }
  15020. }
  15021.  
  15022. int i1 = i + (j << 7) + 0x60000000;
  15023. worldController.method281(i, i1, (Animable) obj1, method42(plane, j * 128 + 64, i * 128 + 64), (Animable) obj2, (Animable) obj, plane, j);
  15024. }
  15025.  
  15026. @Override
  15027. public void startRunnable(Runnable runnable, int i) {
  15028. if (i > 10) {
  15029. i = 10;
  15030. }
  15031. if (Signlink.mainapp != null) {
  15032. Signlink.startthread(runnable, i);
  15033. } else {
  15034. super.startRunnable(runnable, i);
  15035. }
  15036. }
  15037.  
  15038. public static int TotalRead = 0;
  15039.  
  15040. public static int clientZoom;
  15041.  
  15042. public void preloadModels() {
  15043. System.out.println(Signlink.getCacheDirectory());
  15044. File file = new File(Signlink.getCacheDirectory() + "/raw/");
  15045. File[] fileArray = file.listFiles();
  15046. for (File element : fileArray) {
  15047. String sss = element.getName();
  15048. System.out.println("Parsing model file " + sss);
  15049. byte[] buffer = ReadFile(Signlink.getCacheDirectory() + "/raw/" + sss);
  15050. Model.method460(buffer, Integer.parseInt(getFileNameWithoutExtension(sss)));
  15051. }
  15052. }
  15053.  
  15054. public static final byte[] ReadFile(String s) {
  15055. try {
  15056. byte abyte0[];
  15057. File file = new File(s);
  15058. int i = (int) file.length();
  15059. abyte0 = new byte[i];
  15060. DataInputStream datainputstream = new DataInputStream(new BufferedInputStream(new FileInputStream(s)));
  15061. datainputstream.readFully(abyte0, 0, i);
  15062. datainputstream.close();
  15063. TotalRead++;
  15064. return abyte0;
  15065. } catch (Exception e) {
  15066. System.out.println(new StringBuilder().append("Read Error: ").append(s).toString());
  15067. return null;
  15068. }
  15069. }
  15070.  
  15071. @Override
  15072. void startUp() {
  15073.  
  15074. drawSmoothLoading(0, "Starting up");
  15075.  
  15076. new Thread() {
  15077. @Override
  15078. public void run() {
  15079. System.gc();
  15080. System.runFinalization();
  15081. try {
  15082. Thread.sleep(15000);
  15083. } catch (InterruptedException e) {
  15084. e.printStackTrace();
  15085. }
  15086. }
  15087. }.start();
  15088.  
  15089. if (!Constants.LOCAL_CLIENT) {
  15090. CacheDownloader.start(this, FileType.CACHE);
  15091. CacheDownloader.start(this, FileType.IMAGES);
  15092. CacheDownloader.start(this, FileType.FILEDATA);
  15093. } else {
  15094. CacheDownloader.start(this, FileType.IMAGES);
  15095. CacheDownloader.start(this, FileType.FILEDATA);
  15096. }
  15097.  
  15098. SpriteLoader.loadSprites();
  15099. cacheSprite = SpriteLoader.sprites;
  15100. SpriteLoader.sprites = null;
  15101.  
  15102. if (Signlink.sunjava) {
  15103. super.minDelay = 5;
  15104. }
  15105. getDocumentBaseHost();
  15106.  
  15107. if (Signlink.cache_dat != null) {
  15108. for (int i = 0; i < Client.CACHE_INDEX_COUNT; i++) {
  15109. decompressors[i] = new Decompressor(Signlink.cache_dat, Signlink.cache_idx[i], i + 1);
  15110. }
  15111. }
  15112. try {
  15113.  
  15114. if (Constants.JAGCACHED_ENABLED) {
  15115. compareCrcValues();
  15116. }
  15117.  
  15118. drawLogo();
  15119. loadTitleScreen();
  15120. aClass3_Sub7_Sub1_1493 = method407(instance);
  15121. aClass25_1948 = new Class25(22050, anInt197);
  15122. Archive streamLoader = getArchive(2, "config", "config", expectedCRCs[2], 30);
  15123. Archive streamLoader_1 = getArchive(3, "interface", "interface", expectedCRCs[3], 35);
  15124. Archive mediaArchive = getArchive(4, "2d graphics", "media", expectedCRCs[4], 40);
  15125. Archive streamLoader_3 = getArchive(6, "textures", "textures", expectedCRCs[6], 45);
  15126. Archive streamLoader_4 = getArchive(7, "chat system", "wordenc", expectedCRCs[7], 50);
  15127. Archive soundArchive = getArchive(8, "sound effects", "sounds", expectedCRCs[8], 55);
  15128.  
  15129. titleStreamLoader = getArchive(1, "title screen", "title", expectedCRCs[1], 25);
  15130. smallText = new TextDrawingArea(false, "p11_full", titleStreamLoader);
  15131. normalText = new TextDrawingArea(false, "p12_full", titleStreamLoader);
  15132. chatTextDrawingArea = new TextDrawingArea(false, "b12_full", titleStreamLoader);
  15133. TextDrawingArea aTextDrawingArea_1273 = new TextDrawingArea(true, "q8_full", titleStreamLoader);
  15134. newSmallFont = new RSFontSystem(false, "p11_full", titleStreamLoader);
  15135. newRegularFont = new RSFontSystem(false, "p12_full", titleStreamLoader);
  15136. newBoldFont = new RSFontSystem(false, "b12_full", titleStreamLoader);
  15137. newFancyFont = new RSFontSystem(true, "q8_full", titleStreamLoader);
  15138.  
  15139. testFont = new JFont("Augusta.ttf", 20, true);
  15140. byteGroundArray = new byte[4][104][104];
  15141. intGroundArray = new int[4][105][105];
  15142. worldController = new WorldController(intGroundArray);
  15143.  
  15144. for (int j = 0; j < 4; j++) {
  15145. aClass11Array1230[j] = new CollisionMap();
  15146. }
  15147.  
  15148. miniMapRegions = new Sprite(512, 512);
  15149. Archive streamLoader_6 = getArchive(5, "update list", "versionlist", expectedCRCs[5], 60);
  15150. drawSmoothLoading(60, "Unpacking archives");
  15151. onDemandFetcher = new OnDemandFetcher();
  15152. onDemandFetcher.start(streamLoader_6, this);
  15153. Model.method459(onDemandFetcher.getFileCount(0), onDemandFetcher);
  15154.  
  15155. CacheUpdater.update(this, FileType.MODELS);
  15156.  
  15157. // repackCacheIndex(1, false);
  15158. // repackCacheIndex(2, false);
  15159. // repackCacheIndex(4);
  15160.  
  15161. drawSmoothLoading(65, "Unpacking music data");
  15162. constructMusic();
  15163. drawSmoothLoading(80, "Unpacking media");
  15164.  
  15165. for (int i = 0; i < multiOverlay.length; i++) {
  15166. multiOverlay[i] = new Sprite(mediaArchive, "overlay_multiway", i);
  15167. }
  15168.  
  15169. mapBack = new Background(mediaArchive, "mapback", 0);
  15170.  
  15171. for (int j3 = 0; j3 <= 14; j3++) {
  15172. sideIcons[j3] = new Sprite(mediaArchive, "sideicons", j3);
  15173. }
  15174.  
  15175. mapEdge = new Sprite(mediaArchive, "mapedge", 0);
  15176. mapEdge.method345();
  15177.  
  15178. try {
  15179. for (int k3 = 0; k3 < 100; k3++) {
  15180. mapScenes[k3] = new Background(mediaArchive, "mapscene", k3);
  15181. }
  15182. } catch (Exception _ex) {
  15183. }
  15184.  
  15185. try {
  15186. for (int l3 = 0; l3 < 100; l3++) {
  15187. if (l3 < 75) {
  15188. mapFunctions[l3] = new Sprite(mediaArchive, "mapfunction", l3);
  15189. } else {
  15190. mapFunctions[l3] = new Sprite(mediaArchive, "mapfunctions2", l3 - 76);
  15191. }
  15192. }
  15193. } catch (Exception _ex) {
  15194. }
  15195.  
  15196. try {
  15197. for (int i4 = 0; i4 < 20; i4++) {
  15198. hitMarks[i4] = new Sprite(mediaArchive, "hitmarks", i4);
  15199. }
  15200. } catch (Exception _ex) {
  15201. }
  15202.  
  15203. try {
  15204. for (int j4 = 0; j4 <= 8; j4++) {
  15205. headIcons[j4] = new Sprite(mediaArchive, "headicons_prayer", j4);
  15206. }
  15207.  
  15208. for (int j6 = 9; j6 < 18; j6++) {
  15209. headIcons[j6] = Client.cacheSprite[j6 + 357 - 9];
  15210. }
  15211.  
  15212. for (int j45 = 0; j45 < 7; j45++) {
  15213. skullIcons[j45] = new Sprite(mediaArchive, "headicons_pk", j45);
  15214. }
  15215. } catch (Exception _ex) {
  15216. }
  15217.  
  15218. mapFlag = new Sprite(mediaArchive, "mapmarker", 0);
  15219. mapMarker = new Sprite(mediaArchive, "mapmarker", 1);
  15220.  
  15221. for (int k4 = 0; k4 < 8; k4++) {
  15222. crosses[k4] = new Sprite(mediaArchive, "cross", k4);
  15223. }
  15224.  
  15225. mapDotItem = new Sprite(mediaArchive, "mapdots", 0);
  15226. mapDotNPC = new Sprite(mediaArchive, "mapdots", 1);
  15227. mapDotPlayer = new Sprite(mediaArchive, "mapdots", 2);
  15228. mapDotFriend = new Sprite(mediaArchive, "mapdots", 3);
  15229. mapDotTeam = new Sprite(mediaArchive, "mapdots", 4);
  15230. mapDotClan = cacheSprite[398];
  15231.  
  15232. for (int j3 = 0; j3 < 12; j3++) {
  15233. scrollPart[j3] = new Sprite(mediaArchive, "scrollpart", j3);
  15234. }
  15235.  
  15236. for (int id = 0; id < 6; id++) {
  15237. scrollBar[id] = new Sprite(mediaArchive, "scrollbar", id);
  15238. }
  15239.  
  15240. int startId = 631;
  15241. for (int l4 = 0; l4 < 13; l4++) {
  15242. // modIcons[l4] = new Sprite(mediaArchive, "mod_icons", l4);
  15243. modIcons[l4] = cacheSprite[startId++];
  15244. }
  15245.  
  15246. newSmallFont.unpackChatImages(modIcons);
  15247. newRegularFont.unpackChatImages(modIcons);
  15248. newBoldFont.unpackChatImages(modIcons);
  15249. newFancyFont.unpackChatImages(modIcons);
  15250. Sprite sprite = new Sprite(mediaArchive, "screenframe", 0);
  15251. leftFrame = constructGraphicsBuffer(sprite.myWidth, sprite.myHeight, getGameComponent());
  15252. sprite.method346(0, 0);
  15253. sprite = new Sprite(mediaArchive, "screenframe", 1);
  15254. topFrame = constructGraphicsBuffer(sprite.myWidth, sprite.myHeight, getGameComponent());
  15255. sprite.method346(0, 0);
  15256. sprite = new Sprite(mediaArchive, "screenframe", 2);
  15257. rightFrame = constructGraphicsBuffer(sprite.myWidth, sprite.myHeight, getGameComponent());
  15258. sprite.method346(0, 0);
  15259. sprite = new Sprite(mediaArchive, "mapedge", 0);
  15260. constructGraphicsBuffer(sprite.myWidth, sprite.myHeight, getGameComponent());
  15261. sprite.method346(0, 0);
  15262. compass = new Sprite(mediaArchive, "compass", 0);
  15263. drawSmoothLoading(83, "Unpacking textures");
  15264. Rasterizer.method368(streamLoader_3);
  15265. Rasterizer.method372(0.80000000000000004D);
  15266. Rasterizer.method367();
  15267. drawSmoothLoading(86, "Unpacking config");
  15268. Animation.load(streamLoader);
  15269. ObjectDefinition.unpackConfig(streamLoader);
  15270. Flo.unpackConfig(streamLoader);
  15271. OverLayFlo317.load(streamLoader);
  15272. ItemDefinition.unpackConfig(streamLoader);
  15273. MobDefinition.load(streamLoader);
  15274. IdentityKit.unpackConfig(streamLoader);
  15275. SpotAnimDefinition.load(streamLoader);
  15276. Varp.load(streamLoader);
  15277. VarBit.unpackConfig(streamLoader);
  15278.  
  15279. // ItemDefinition.dumpItemModelsForId(13653);
  15280. // onDemandFetcher.dump();
  15281.  
  15282. // ItemDefinition.dumpItemModelsForId(21373);
  15283.  
  15284. // for (int i : Hardcode.IDS) {
  15285. // ItemDefinition.dumpItemModelsForId(i);
  15286. // }
  15287.  
  15288. if (!isLowDetail()) {
  15289. byte[] data = soundArchive.get("sounds.dat");
  15290. ByteBuffer buffer = new ByteBuffer(data);
  15291. Sound.unpack(buffer);
  15292.  
  15293. }
  15294.  
  15295. drawSmoothLoading(95, "Unpacking interfaces");
  15296. TextDrawingArea[] aclass30_sub2_sub1_sub4s = { smallText, normalText, chatTextDrawingArea, aTextDrawingArea_1273 };
  15297.  
  15298. try {
  15299. RSInterface.unpack(streamLoader_1, aclass30_sub2_sub1_sub4s, mediaArchive);
  15300. } catch (Exception e) {
  15301. }
  15302.  
  15303. drawSmoothLoading(100, "Preparing game engine");
  15304.  
  15305. try {
  15306. for (int j6 = 0; j6 < 33; j6++) {
  15307. int k6 = 999;
  15308. int i7 = 0;
  15309.  
  15310. for (int k7 = 0; k7 < 34; k7++) {
  15311. if (mapBack.imgPixels[k7 + j6 * mapBack.imgWidth] == 0) {
  15312. if (k6 == 999) {
  15313. k6 = k7;
  15314. }
  15315.  
  15316. continue;
  15317. }
  15318.  
  15319. if (k6 == 999) {
  15320. continue;
  15321. }
  15322.  
  15323. i7 = k7;
  15324. break;
  15325. }
  15326.  
  15327. compassArray1[j6] = k6;
  15328. compassArray2[j6] = i7 - k6;
  15329. }
  15330.  
  15331. for (int l6 = 4; l6 < 157; l6++) {
  15332. int j7 = 999;
  15333. int l7 = 0;
  15334.  
  15335. for (int j8 = 20; j8 < 172; j8++) {
  15336. if (mapBack.imgPixels[j8 + l6 * mapBack.imgWidth] == 0 && (j8 > 34 || l6 > 34)) {
  15337. if (j7 == 999) {
  15338. j7 = j8;
  15339. }
  15340.  
  15341. continue;
  15342. }
  15343.  
  15344. if (j7 == 999) {
  15345. continue;
  15346. }
  15347.  
  15348. l7 = j8;
  15349. break;
  15350. }
  15351.  
  15352. mapImagePixelCutLeft[l6 - 4] = j7 - 20;
  15353. mapImagePixelCutRight[l6 - 4] = l7 - j7;
  15354.  
  15355. if (mapImagePixelCutRight[l6 - 4] == -20) {
  15356. mapImagePixelCutRight[l6 - 4] = 152;
  15357. }
  15358. }
  15359. } catch (Exception _ex) {
  15360. }
  15361.  
  15362. updateGameArea();
  15363. Censor.loadConfig(streamLoader_4);
  15364. mouseDetection = new MouseDetection(this);
  15365. startRunnable(mouseDetection, 10);
  15366. Animable_Sub5.clientInstance = this;
  15367. ObjectDefinition.clientInstance = this;
  15368. MobDefinition.clientInstance = this;
  15369. isLoading = false;
  15370. // onDemandFetcher.dump();
  15371. loadPlayerData();
  15372. // onDemandFetcher.dump();
  15373. return;
  15374. } catch (Exception exception) {
  15375. isLoading = false;
  15376. exception.printStackTrace();
  15377. Signlink.reportError("loaderror " + startupMessage + " " + anInt1079);
  15378. }
  15379.  
  15380. loadingError = true;
  15381. }
  15382.  
  15383. public void dumpArchive(int archive) {
  15384. int[] ids = new int[] {};
  15385. for (int i : ids) {
  15386. try {
  15387. byte abyte[] = decompressors[archive].decompress(onDemandFetcher.getModelIndex(i));
  15388. File map = new File(Signlink.getCacheDirectory() + "/itemdata/" + onDemandFetcher.getModelIndex(i) + ".gz");
  15389. FileOutputStream fos = new FileOutputStream(map);
  15390. fos.write(abyte);
  15391. fos.close();
  15392. } catch (IOException e) {
  15393. e.printStackTrace();
  15394. }
  15395. }
  15396. }
  15397.  
  15398. private void stopMidi() {
  15399. // Signlink.midifade = 0;
  15400. // Signlink.midi = "stop";
  15401. }
  15402.  
  15403. private void tabToReplyPm() {
  15404. String name = null;
  15405.  
  15406. for (int k = 0; k < 100; k++) {
  15407. if (chatMessages[k] == null) {
  15408. continue;
  15409. }
  15410.  
  15411. int l = chatTypes[k];
  15412.  
  15413. if (l == 3 || l == 7) {
  15414. name = chatNames[k];
  15415. break;
  15416. }
  15417. }
  15418.  
  15419. if (name == null) {
  15420. pushMessage("You haven't received any messages to which you can reply.", 0, "");
  15421. return;
  15422. }
  15423.  
  15424. if (name != null) {
  15425. if (name.indexOf("@") == 0) {
  15426. name = name.substring(5);
  15427. }
  15428. }
  15429.  
  15430. long nameAsLong = TextClass.longForName(name.trim());
  15431.  
  15432. if (nameAsLong != -1) {
  15433. inputTaken = true;
  15434. inputDialogState = 0;
  15435. messagePromptRaised = true;
  15436. promptInput = "";
  15437. friendsListAction = 3;
  15438. aLong953 = nameAsLong;
  15439. promptMessage = "Enter message to send to " + TextClass.fixName(TextClass.nameForLong(nameAsLong));
  15440. }
  15441. }
  15442.  
  15443. private void updateScreen() {
  15444. gameAreaWidth = GameFrame.isFixed() ? 512 : getScreenWidth();
  15445. gameAreaHeight = GameFrame.isFixed() ? 334 : getScreenHeight();
  15446. if (gameScreenIP == null || gameScreenIP.width != gameAreaWidth || gameScreenIP.height != gameAreaHeight) {
  15447. gameScreenIP = constructGraphicsBuffer(gameAreaWidth, gameAreaHeight, getGameComponent());
  15448. }
  15449. updateGameArea();
  15450. updateGraphics(false);
  15451. }
  15452.  
  15453. public void setResizing(boolean resizing) {
  15454. if (resizing) {
  15455. this.resizing = true;
  15456. if (loggedIn) {
  15457. if (gameScreenIP != null) {
  15458. gameScreenIP.initDrawingArea();
  15459. }
  15460. } else {
  15461. if (titleScreenIP != null) {
  15462. titleScreenIP.initDrawingArea();
  15463. }
  15464. }
  15465. } else {
  15466. this.resizing = false;
  15467. if (loggedIn) {
  15468. if (gameScreenIP != null) {
  15469. gameScreenIP.drawGraphics(gameScreenDrawY, graphics, GameFrame.isFixed() ? 4 : gameScreenDrawX);
  15470. }
  15471. } else {
  15472. if (titleScreenIP != null) {
  15473. titleScreenIP.drawGraphics(gameScreenDrawY, graphics, GameFrame.isFixed() ? 4 : gameScreenDrawX);
  15474. }
  15475. }
  15476. }
  15477. }
  15478.  
  15479. public void toggleSize(ScreenMode mode) {
  15480. try {
  15481.  
  15482. if (GameFrame.getScreenMode() != mode) {
  15483. setResizing(true);
  15484. super.setClickMode2(0);
  15485. if (mode == ScreenMode.FIXED) {
  15486. GameFrame.setScreenMode(mode);
  15487. gameScreenDrawX = 4;
  15488. gameScreenDrawY = 4;
  15489. forceWidth = clientWidth = REGULAR_WIDTH;
  15490. forceHeight = clientHeight = REGULAR_HEIGHT;
  15491. sendFrame36(652, 0);
  15492. recreateClientFrame(false, 765, 503, false, 1, false);
  15493. if (jFrame != null) {
  15494. jFrame.resize(mode);
  15495. }
  15496. welcomeScreenRaised = true;
  15497. } else if (mode == ScreenMode.RESIZABLE) {
  15498. GameFrame.setScreenMode(mode);
  15499. gameScreenDrawX = 0;
  15500. gameScreenDrawY = 0;
  15501. forceWidth = forceHeight = -1;
  15502. if (jFrame != null) {
  15503. jFrame.resize(mode);
  15504. }
  15505. sendFrame36(652, 2);
  15506. recreateClientFrame(false, RESIZABLE_WIDTH, RESIZABLE_HEIGHT, true, 0, true);
  15507. } else {
  15508. GameFrame.setScreenMode(ScreenMode.FULLSCREEN);
  15509. gameScreenDrawX = 0;
  15510. gameScreenDrawY = 0;
  15511. sendFrame36(652, 1);
  15512. Dimension size = Toolkit.getDefaultToolkit().getScreenSize();
  15513. clientWidth = size.width;
  15514. clientHeight = size.height;
  15515. recreateClientFrame(true, size.width, size.height, false, 0, true);
  15516. forceWidth = forceHeight = -1;
  15517. super.myWidth = size.width;
  15518. super.myHeight = size.height;
  15519. }
  15520.  
  15521. if (mode == ScreenMode.FIXED) {
  15522. inputTaken = true;
  15523. }
  15524.  
  15525. clientZoom = 0;
  15526.  
  15527. if (!loggedIn) {
  15528. resetImageProducers();
  15529. } else {
  15530. resetImageProducers2();
  15531. }
  15532. chatArea.setHideComponent(false);
  15533. tabArea.setHideComponent(false);
  15534. updateScreen();
  15535.  
  15536. setResizing(false);
  15537. System.gc();
  15538. System.runFinalization();
  15539. }
  15540. } catch (Exception e) {
  15541. e.printStackTrace();
  15542. }
  15543. }
  15544.  
  15545. private void unlinkMRUNodes() {
  15546. ObjectDefinition.mruNodes1.unlinkAll();
  15547. ObjectDefinition.mruNodes2.unlinkAll();
  15548. MobDefinition.mruNodes.unlinkAll();
  15549. ItemDefinition.mruNodes2.unlinkAll();
  15550. ItemDefinition.mruNodes1.unlinkAll();
  15551. Player.mruNodes.unlinkAll();
  15552. SpotAnimDefinition.list.unlinkAll();
  15553. }
  15554.  
  15555. private void updateConfig(int configId) {
  15556. try {
  15557. int j = Varp.getCache()[configId].getAnInt709();
  15558.  
  15559. // System.out.println("config id: " + configId + " ; value: " + j);
  15560.  
  15561. if (j == 0) {
  15562. return;
  15563. }
  15564.  
  15565. int k = variousSettings[configId];
  15566.  
  15567. if (j == 1) {
  15568. if (k == 1) {
  15569. Rasterizer.method372(0.90000000000000002D);
  15570. } else if (k == 2) {
  15571. Rasterizer.method372(0.80000000000000004D);
  15572. } else if (k == 3) {
  15573. Rasterizer.method372(0.69999999999999996D);
  15574. } else if (k == 4) {
  15575. Rasterizer.method372(0.59999999999999998D);
  15576. }
  15577.  
  15578. ItemDefinition.mruNodes1.unlinkAll();
  15579. welcomeScreenRaised = true;
  15580. } else if (j == 3) {
  15581. int volume = 0;
  15582.  
  15583. if (k == 0) {
  15584. volume = 255;
  15585. } else if (k == 1) {
  15586. volume = 192;
  15587. } else if (k == 2) {
  15588. volume = 128;
  15589. } else if (k == 3) {
  15590. volume = 64;
  15591. } else if (k == 4) {
  15592. volume = 0;
  15593. }
  15594.  
  15595. if (volume != musicVolume) {
  15596. if (musicVolume != 0 || currentSong == -1) {
  15597. if (volume != 0) {
  15598. setVolume(volume);
  15599. } else {
  15600. method55(false);
  15601. prevSong = 0;
  15602. }
  15603. } else {
  15604. method56(volume, false, currentSong);
  15605. prevSong = 0;
  15606. }
  15607.  
  15608. musicVolume = volume;
  15609. }
  15610. } else if (j == 4) {
  15611. if (k == 0) {
  15612. soundEffectVolume = 127;
  15613. } else if (k == 1) {
  15614. soundEffectVolume = 96;
  15615. } else if (k == 2) {
  15616. soundEffectVolume = 64;
  15617. } else if (k == 3) {
  15618. soundEffectVolume = 32;
  15619. } else if (k == 4) {
  15620. soundEffectVolume = 0;
  15621. }
  15622. } else if (j == 5) {
  15623. anInt1253 = k;
  15624. } else if (j == 6) {
  15625. anInt1249 = k;
  15626. } else if (j == 7) {
  15627. running = !running;
  15628. final boolean run = running;
  15629. getMapArea().run.setOrbState(run);
  15630. } else if (j == 8) {
  15631. splitPrivateChat = k;
  15632. inputTaken = true;
  15633. } else if (j == 9) {
  15634. anInt913 = k;
  15635. }
  15636. } catch (Exception e) {
  15637. }
  15638. }
  15639.  
  15640. private void updateEntities() {
  15641.  
  15642. try {
  15643. int anInt974 = 0;
  15644. for (int j = -1; j < playerCount + npcCount; j++) {
  15645. Object obj;
  15646. if (j == -1) {
  15647. obj = myPlayer;
  15648. } else if (j < playerCount) {
  15649. obj = playerArray[playerIndices[j]];
  15650. } else {
  15651. obj = npcArray[npcIndices[j - playerCount]];
  15652. }
  15653. if (obj == null || !((Entity) obj).isVisible()) {
  15654. continue;
  15655. }
  15656. if (obj instanceof NPC) {
  15657. MobDefinition entityDef = ((NPC) obj).definitionOverride;
  15658. if (entityDef.childrenIDs != null) {
  15659. entityDef = entityDef.method161();
  15660. }
  15661. if (entityDef == null) {
  15662. continue;
  15663. }
  15664. }
  15665. if (j < playerCount) {
  15666. int l = getConfig().getStatus(ConfigType.HP_ABOVE_HEAD) || getConfig().getStatus(ConfigType.NAMES_ABOVE_HEAD) ? 42 : 32;
  15667. if (getConfig().getStatus(ConfigType.HP_ABOVE_HEAD)) {
  15668. l += 20;
  15669. }
  15670. if (getConfig().getStatus(ConfigType.NAMES_ABOVE_HEAD)) {
  15671. l += 10;
  15672. }
  15673. Player player = (Player) obj;
  15674. if (player.headIcon >= 0) {
  15675. npcScreenPos((Entity) obj, ((Entity) obj).height + 15);
  15676. if (spriteDrawX > -1) {
  15677. if (player.skullIcon < 7) {
  15678. skullIcons[player.skullIcon].drawSprite(spriteDrawX - 12, spriteDrawY - l);
  15679. l += 25;
  15680. }
  15681. if (player.headIcon < 18) {
  15682. headIcons[player.headIcon].drawSprite(spriteDrawX - 12, spriteDrawY - l);
  15683. l += 18;
  15684. }
  15685. if (getConfig().getStatus(ConfigType.NAMES_ABOVE_HEAD)) {
  15686. newSmallFont.drawCenteredString("{" + (player.name != null ? player.name : "null username") + "}", spriteDrawX, spriteDrawY - 10, 0x15FF00, 0x000000);
  15687. }
  15688. }
  15689. }
  15690. if (j >= 0 && anInt855 == 10 && anInt933 == playerIndices[j]) {
  15691. npcScreenPos((Entity) obj, ((Entity) obj).height + 15);
  15692. if (spriteDrawX > -1) {
  15693. headIcons[7].drawSprite(spriteDrawX - 12, spriteDrawY - l);
  15694. }
  15695. }
  15696. } else {
  15697. MobDefinition entityDef_1 = ((NPC) obj).definitionOverride;
  15698. if (entityDef_1.headIcon >= 0 && entityDef_1.headIcon < headIcons.length) {
  15699. npcScreenPos((Entity) obj, ((Entity) obj).height + 15);
  15700. if (spriteDrawX > -1) {
  15701. headIcons[entityDef_1.headIcon].drawSprite(spriteDrawX - 12, spriteDrawY - 30);
  15702. }
  15703. }
  15704. if (anInt855 == 1 && anInt1222 == npcIndices[j - playerCount] && loopCycle % 20 < 10) {
  15705. npcScreenPos((Entity) obj, ((Entity) obj).height + 15);
  15706. if (spriteDrawX > -1) {
  15707. headIcons[2].drawSprite(spriteDrawX - 12, spriteDrawY - 28);
  15708. }
  15709. }
  15710. }
  15711. if (((Entity) obj).textSpoken != null && (j >= playerCount || publicChatMode == 0 || publicChatMode == 3 || publicChatMode == 1 && isFriendOrSelf(((Player) obj).name))) {
  15712. npcScreenPos((Entity) obj, ((Entity) obj).height);
  15713. if (spriteDrawX > -1 && anInt974 < anInt975) {
  15714. anIntArray979[anInt974] = chatTextDrawingArea.method384(((Entity) obj).textSpoken) / 2;
  15715. anIntArray978[anInt974] = chatTextDrawingArea.anInt1497;
  15716. anIntArray976[anInt974] = spriteDrawX;
  15717. anIntArray977[anInt974] = spriteDrawY;
  15718. anIntArray980[anInt974] = ((Entity) obj).anInt1513;
  15719. anIntArray981[anInt974] = ((Entity) obj).anInt1531;
  15720. anIntArray982[anInt974] = ((Entity) obj).textCycle;
  15721. aStringArray983[anInt974++] = ((Entity) obj).textSpoken;
  15722. if (anInt1249 == 0 && ((Entity) obj).anInt1531 >= 1 && ((Entity) obj).anInt1531 <= 3) {
  15723. anIntArray978[anInt974] += 10;
  15724. anIntArray977[anInt974] += 5;
  15725. }
  15726. if (anInt1249 == 0 && ((Entity) obj).anInt1531 == 4) {
  15727. anIntArray979[anInt974] = 60;
  15728. }
  15729. if (anInt1249 == 0 && ((Entity) obj).anInt1531 == 5) {
  15730. anIntArray978[anInt974] += 5;
  15731. }
  15732. }
  15733. }
  15734. if (((Entity) obj).loopCycleStatus > loopCycle) {
  15735.  
  15736. try {
  15737. npcScreenPos((Entity) obj, ((Entity) obj).height + 15);
  15738. if (spriteDrawX > -1) {
  15739. if (config.getStatus(ConfigType.NEW_HITBARS)) {
  15740. int i1 = ((Entity) obj).currentHealth * 30 / ((Entity) obj).maxHealth;
  15741. if (i1 > 30) {
  15742. i1 = 30;
  15743. }
  15744. int hpPercent = ((Entity) obj).currentHealth * 90 / ((Entity) obj).maxHealth;
  15745. if (hpPercent > 90) {
  15746. hpPercent = 90;
  15747. }
  15748. int HpPercent = ((Entity) obj).currentHealth * 56 / ((Entity) obj).maxHealth;
  15749. if (HpPercent > 56) {
  15750. HpPercent = 56;
  15751. }
  15752.  
  15753. if ((Entity) obj != null && ((Entity) obj).maxHealth >= 250) {
  15754. cacheSprite[396].drawSprite(spriteDrawX - 44, spriteDrawY - 5);
  15755. Sprite HPBarFull = Sprite.getCutted(cacheSprite[397], (int) (HpPercent * 1.615), cacheSprite[397].maxHeight);
  15756. HPBarFull.drawSprite(spriteDrawX - 44, spriteDrawY - 5);
  15757. HPBarFull = null;
  15758. } else {
  15759. cacheSprite[349].drawSprite(spriteDrawX - 28, spriteDrawY - 5);
  15760. Sprite HPBarFull = Sprite.getCutted(cacheSprite[348], HpPercent, cacheSprite[348].maxHeight);
  15761. HPBarFull.drawSprite(spriteDrawX - 28, spriteDrawY - 5);
  15762. HPBarFull = null;
  15763. }
  15764. } else {
  15765.  
  15766. int i1 = ((Entity) obj).currentHealth * 30 / ((Entity) obj).maxHealth;
  15767. if (i1 > 30) {
  15768. i1 = 30;
  15769. }
  15770. DrawingArea.drawPixels(5, spriteDrawY - 3, spriteDrawX - 15, 65280, i1);
  15771. DrawingArea.drawPixels(5, spriteDrawY - 3, spriteDrawX - 15 + i1, 0xff0000, 30 - i1);
  15772. }
  15773. Entity o = (Entity) obj;
  15774. double currentHitpoints = o.currentHealth * (config.getStatus(ConfigType.X10_DAMAGE) ? 10 : 1);
  15775. double maxHitpoints = o.maxHealth * (config.getStatus(ConfigType.X10_DAMAGE) ? 10 : 1);
  15776. double percentage = (int) ((currentHitpoints / maxHitpoints * 100) * 1.23);
  15777. if (config.getStatus(ConfigType.DISPLAY_COMBAT_OVERLAY)) {
  15778. boolean display = false;
  15779. if (interactingWith != null && o == interactingWith) {
  15780. /*
  15781. * Draw the background
  15782. */
  15783. DrawingArea.drawAlphaPixels(0, 17, 125, 45, 0x000000, 100);
  15784. String name = "null";
  15785. if (o instanceof Player) {
  15786. name = ((Player) o).name;
  15787. } else if (o instanceof NPC) {
  15788. MobDefinition entityDef_1 = ((NPC) obj).definitionOverride;
  15789. if (entityDef_1 != null)
  15790. name = entityDef_1.name;
  15791. }
  15792. newRegularFont.drawCenteredString(name, 62, 29, 0xFFFFFF, 0);
  15793. int i1 = ((Entity) obj).currentHealth * 30 / ((Entity) obj).maxHealth;
  15794. if (i1 > 30) {
  15795. i1 = 30;
  15796. }
  15797. if (percentage > 123) {
  15798. percentage = 123;
  15799. }
  15800. DrawingArea.drawAlphaPixels(1, 34, 123, 15, 0xC0303E, 130);
  15801. DrawingArea.drawAlphaPixels(1, 34, (int) percentage, 15, 0x00A000, 170);
  15802. newRegularFont.drawCenteredString((int) currentHitpoints + "/" + (int) maxHitpoints, 62, 47, 0xFFFFFF, 0);
  15803. display = false;
  15804. }
  15805. if (display)
  15806. newRegularFont.drawCenteredString(myPlayer.name, 30, 61, 0xFFFFFF, 0);
  15807.  
  15808. }
  15809. if (config.getStatus(ConfigType.HP_ABOVE_HEAD)) {
  15810. int color = calculateHitpointsColor((int) Math.round(percentage));
  15811. newRegularFont.drawCenteredString(new StringBuilder().append((int) currentHitpoints).append("/").append((int) maxHitpoints).toString(), spriteDrawX, spriteDrawY - 22,
  15812. color, 0x000000);
  15813. }
  15814. }
  15815. } catch (Exception e) {
  15816. e.printStackTrace();
  15817. }
  15818. }
  15819. /**
  15820. * Hitmarks
  15821. */
  15822. for (int j1 = 0; j1 < 4; j1++) {
  15823. if (((Entity) obj).hitsLoopCycle[j1] > loopCycle) {
  15824. Entity entity = (Entity) obj;
  15825. npcScreenPos(entity, entity.height / 2);
  15826. if (spriteDrawX > -1) {
  15827. if (!config.getStatus(ConfigType.HITMARKS)) {
  15828. if (j1 == 1) {
  15829. spriteDrawY -= 20;
  15830. }
  15831. if (j1 == 2) {
  15832. spriteDrawX -= 15;
  15833. spriteDrawY -= 10;
  15834. }
  15835. if (j1 == 3) {
  15836. spriteDrawX += 15;
  15837. spriteDrawY -= 10;
  15838. }
  15839. if (entity.hitArray[j1] < 1) {
  15840. // damage is 0
  15841. entity.hitMarkTypes[j1] = 0;
  15842. } else if (entity.hitMarkTypes[j1] == 2) {
  15843. // critical hit is normal hit
  15844. entity.hitMarkTypes[j1] = 1;
  15845. }
  15846. if (entity.hitMarkTypes[j1] < 3) {
  15847. // not a poison mask so we choose our hit
  15848. cacheSprite[399 + entity.hitMarkTypes[j1]].drawSprite(spriteDrawX - 12, spriteDrawY - 12);
  15849. } else {
  15850. // poison and curse mask
  15851. hitMarks[entity.hitMarkTypes[j1] - 1].drawSprite(spriteDrawX - 12, spriteDrawY - 12);
  15852. }
  15853. smallText.drawText(0, String.valueOf(entity.hitArray[j1]), spriteDrawY + 4, spriteDrawX);
  15854. smallText.drawText(0xffffff, String.valueOf(entity.hitArray[j1]), spriteDrawY + 3, spriteDrawX - 1);
  15855. } else {
  15856. switch (j1) {
  15857. case 1:
  15858. spriteDrawY += 20;
  15859. break;
  15860. case 2:
  15861. spriteDrawY += 25;
  15862. break;
  15863. case 3:
  15864. spriteDrawY += 45;
  15865. break;
  15866. }
  15867. Entity e = (Entity) obj;
  15868. if (e.hitmarkMove[j1] > -30) {
  15869. e.hitmarkMove[j1]--;
  15870. if (e.hitmarkTrans[j1] > 0) {
  15871. e.hitmarkTrans[j1] -= 5;
  15872. }
  15873. hitmarkDraw(e, String.valueOf(e.hitArray[j1]).length(), e.hitMarkTypes[j1], e.hitIcon[j1], e.hitArray[j1], e.hitmarkMove[j1], e.hitmarkTrans[j1]);
  15874. }
  15875. }
  15876. }
  15877. }
  15878. }
  15879. }
  15880.  
  15881. for (int k = 0; k < anInt974; k++) {
  15882. int k1 = anIntArray976[k];
  15883. int l1 = anIntArray977[k];
  15884. int j2 = anIntArray979[k];
  15885. int k2 = anIntArray978[k];
  15886. boolean flag = true;
  15887.  
  15888. while (flag) {
  15889. flag = false;
  15890.  
  15891. for (int l2 = 0; l2 < k; l2++) {
  15892. if (l1 + 2 > anIntArray977[l2] - anIntArray978[l2] && l1 - k2 < anIntArray977[l2] + 2 && k1 - j2 < anIntArray976[l2] + anIntArray979[l2]
  15893. && k1 + j2 > anIntArray976[l2] - anIntArray979[l2] && anIntArray977[l2] - anIntArray978[l2] < l1) {
  15894. l1 = anIntArray977[l2] - anIntArray978[l2];
  15895. flag = true;
  15896. }
  15897. }
  15898. }
  15899.  
  15900. spriteDrawX = anIntArray976[k];
  15901. spriteDrawY = anIntArray977[k] = l1;
  15902. String s = aStringArray983[k];
  15903.  
  15904. if (anInt1249 == 0) {
  15905. int i3 = 0xffff00;
  15906.  
  15907. if (anIntArray980[k] < 6) {
  15908. i3 = anIntArray965[anIntArray980[k]];
  15909. }
  15910.  
  15911. if (anIntArray980[k] == 6) {
  15912. i3 = anInt1265 % 20 >= 10 ? 0xffff00 : 0xff0000;
  15913. }
  15914.  
  15915. if (anIntArray980[k] == 7) {
  15916. i3 = anInt1265 % 20 >= 10 ? 65535 : 255;
  15917. }
  15918.  
  15919. if (anIntArray980[k] == 8) {
  15920. i3 = anInt1265 % 20 >= 10 ? 0x80ff80 : 45056;
  15921. }
  15922.  
  15923. if (anIntArray980[k] == 9) {
  15924. int j3 = 150 - anIntArray982[k];
  15925.  
  15926. if (j3 < 50) {
  15927. i3 = 0xff0000 + 1280 * j3;
  15928. } else if (j3 < 100) {
  15929. i3 = 0xffff00 - 0x50000 * (j3 - 50);
  15930. } else if (j3 < 150) {
  15931. i3 = 65280 + 5 * (j3 - 100);
  15932. }
  15933. }
  15934.  
  15935. if (anIntArray980[k] == 10) {
  15936. int k3 = 150 - anIntArray982[k];
  15937.  
  15938. if (k3 < 50) {
  15939. i3 = 0xff0000 + 5 * k3;
  15940. } else if (k3 < 100) {
  15941. i3 = 0xff00ff - 0x50000 * (k3 - 50);
  15942. } else if (k3 < 150) {
  15943. i3 = 255 + 0x50000 * (k3 - 100) - 5 * (k3 - 100);
  15944. }
  15945. }
  15946.  
  15947. if (anIntArray980[k] == 11) {
  15948. int l3 = 150 - anIntArray982[k];
  15949.  
  15950. if (l3 < 50) {
  15951. i3 = 0xffffff - 0x50005 * l3;
  15952. } else if (l3 < 100) {
  15953. i3 = 65280 + 0x50005 * (l3 - 50);
  15954. } else if (l3 < 150) {
  15955. i3 = 0xffffff - 0x50000 * (l3 - 100);
  15956. }
  15957. }
  15958.  
  15959. if (anIntArray981[k] == 0) {
  15960. chatTextDrawingArea.drawText(0, s, spriteDrawY + 1, spriteDrawX + 1);
  15961. chatTextDrawingArea.drawText(i3, s, spriteDrawY, spriteDrawX);
  15962. }
  15963.  
  15964. if (anIntArray981[k] == 1) {
  15965. chatTextDrawingArea.method386(0, s, spriteDrawX + 1, anInt1265, spriteDrawY + 1);
  15966. chatTextDrawingArea.method386(i3, s, spriteDrawX, anInt1265, spriteDrawY);
  15967. }
  15968.  
  15969. if (anIntArray981[k] == 2) {
  15970. chatTextDrawingArea.method387(spriteDrawX + 1, s, anInt1265, spriteDrawY + 1, 0);
  15971. chatTextDrawingArea.method387(spriteDrawX, s, anInt1265, spriteDrawY, i3);
  15972. }
  15973.  
  15974. if (anIntArray981[k] == 3) {
  15975. chatTextDrawingArea.method388(150 - anIntArray982[k], s, anInt1265, spriteDrawY + 1, spriteDrawX + 1, 0);
  15976. chatTextDrawingArea.method388(150 - anIntArray982[k], s, anInt1265, spriteDrawY, spriteDrawX, i3);
  15977. }
  15978.  
  15979. if (anIntArray981[k] == 4) {
  15980. int i4 = chatTextDrawingArea.method384(s);
  15981. int k4 = (150 - anIntArray982[k]) * (i4 + 100) / 150;
  15982. DrawingArea.setBounds(spriteDrawX - 50, 0, spriteDrawX + 50, 334);
  15983. chatTextDrawingArea.method385(0, s, spriteDrawY + 1, spriteDrawX + 51 - k4);
  15984. chatTextDrawingArea.method385(i3, s, spriteDrawY, spriteDrawX + 50 - k4);
  15985. DrawingArea.defaultDrawingAreaSize();
  15986. }
  15987.  
  15988. if (anIntArray981[k] == 5) {
  15989. int j4 = 150 - anIntArray982[k];
  15990. int l4 = 0;
  15991.  
  15992. if (j4 < 25) {
  15993. l4 = j4 - 25;
  15994. } else if (j4 > 125) {
  15995. l4 = j4 - 125;
  15996. }
  15997.  
  15998. DrawingArea.setBounds(0, spriteDrawY - chatTextDrawingArea.anInt1497 - 1, 512, spriteDrawY + 5);
  15999. chatTextDrawingArea.drawText(0, s, spriteDrawY + 1 + l4, spriteDrawX + 1);
  16000. chatTextDrawingArea.drawText(i3, s, spriteDrawY + l4, spriteDrawX);
  16001. DrawingArea.defaultDrawingAreaSize();
  16002. }
  16003. } else {
  16004. chatTextDrawingArea.drawText(0, s, spriteDrawY + 1, spriteDrawX + 1);
  16005. chatTextDrawingArea.drawText(0xffff00, s, spriteDrawY, spriteDrawX);
  16006. }
  16007. }
  16008. } catch (Exception e) {
  16009. }
  16010. }
  16011.  
  16012. private int calculateHitpointsColor(int percentage) {
  16013. int[] colorArray = new int[] { 0x01DF01, 0x3ADF00, 0x74DF00, 0xA5DF00, 0xD7DF01, 0xDBA901, 0xDF7401, 0xDF3A01, 0xFA5858, 0xFE2E2E, 0xDF0101, };
  16014. int color = colorArray[0];
  16015. for (int i = 0; i < colorArray.length; i++) {
  16016. if (percentage >= 100 - i * 10) {
  16017. color = colorArray[i];
  16018. break;
  16019. }
  16020. }
  16021. return color;
  16022. }
  16023.  
  16024. public void updateGameArea() {
  16025. try {
  16026. Rasterizer.setBounds(getScreenWidth(), getScreenHeight());
  16027. fullScreenTextureArray = Rasterizer.lineOffsets;
  16028. Rasterizer.setBounds(GameFrame.getScreenMode() == ScreenMode.FIXED && isGameFrameVisible() ? chatAreaIP != null ? chatAreaIP.width : 519 : getScreenWidth(),
  16029. GameFrame.getScreenMode() == ScreenMode.FIXED && isGameFrameVisible() ? chatAreaIP != null ? chatAreaIP.height : 165 : getScreenHeight());
  16030. anIntArray1180 = Rasterizer.lineOffsets;
  16031. Rasterizer.setBounds(GameFrame.getScreenMode() == ScreenMode.FIXED && isGameFrameVisible() ? tabAreaIP != null ? tabAreaIP.width : 346 : getScreenWidth(),
  16032. GameFrame.getScreenMode() == ScreenMode.FIXED && isGameFrameVisible() ? tabAreaIP != null ? tabAreaIP.height : 335 : getScreenHeight());
  16033. anIntArray1181 = Rasterizer.lineOffsets;
  16034. Rasterizer.setBounds(gameAreaWidth, gameAreaHeight);
  16035. anIntArray1182 = Rasterizer.lineOffsets;
  16036. int ai[] = new int[9];
  16037.  
  16038. for (int i8 = 0; i8 < 9; i8++) {
  16039. int k8 = 128 + i8 * 32 + 15;
  16040. int l8 = 600 + k8 * 3;
  16041. int i9 = Rasterizer.SINE[k8];
  16042. ai[i8] = l8 * i9 >> 16;
  16043. }
  16044.  
  16045. WorldController.method310(500, 800, !loggedIn ? getScreenWidth() : gameAreaWidth, !loggedIn ? getScreenHeight() : gameAreaHeight, ai);
  16046.  
  16047. if (loggedIn) {
  16048. gameScreenIP = constructGraphicsBuffer(gameAreaWidth, gameAreaHeight, getGameComponent());
  16049. } else {
  16050. titleScreenIP = constructGraphicsBuffer(getScreenWidth(), getScreenHeight(), getGameComponent());
  16051. }
  16052. updateGraphics(true);
  16053. } catch (Exception e) {
  16054. e.printStackTrace();
  16055. }
  16056. }
  16057.  
  16058. private void updateNPCs(ByteBuffer buffer, int i) {
  16059. anInt839 = 0;
  16060. anInt893 = 0;
  16061. method139(buffer);
  16062. method46(i, buffer);
  16063. method86(buffer);
  16064.  
  16065. for (int k = 0; k < anInt839; k++) {
  16066. int l = anIntArray840[k];
  16067.  
  16068. if (npcArray[l].anInt1537 != loopCycle) {
  16069. npcArray[l].definitionOverride = null;
  16070. npcArray[l] = null;
  16071. }
  16072. }
  16073.  
  16074. if (buffer.position != i) {
  16075. Signlink.reportError(getMyUsername() + " size mismatch in getnpcpos - pos:" + buffer.position + " psize:" + i);
  16076. throw new RuntimeException("eek");
  16077. }
  16078.  
  16079. for (int i1 = 0; i1 < npcCount; i1++) {
  16080. if (npcArray[npcIndices[i1]] == null) {
  16081. Signlink.reportError(getMyUsername() + " null entry in npc list - pos:" + i1 + " size:" + npcCount);
  16082. throw new RuntimeException("eek");
  16083. }
  16084. }
  16085. }
  16086.  
  16087. private void updatePlayers(int i, ByteBuffer buffer) {
  16088. anInt839 = 0;
  16089. anInt893 = 0;
  16090. processMovementBuffer(buffer);
  16091. method134(buffer);
  16092. method91(buffer, i);
  16093. method49(buffer);
  16094.  
  16095. for (int k = 0; k < anInt839; k++) {
  16096. int l = anIntArray840[k];
  16097.  
  16098. if (playerArray[l].anInt1537 != loopCycle) {
  16099. playerArray[l] = null;
  16100. }
  16101. }
  16102.  
  16103. if (buffer.position != i) {
  16104. Signlink.reportError("Error packet size mismatch in getplayer pos:" + buffer.position + " psize:" + i);
  16105. throw new RuntimeException("eek");
  16106. }
  16107.  
  16108. for (int i1 = 0; i1 < playerCount; i1++) {
  16109. if (playerArray[playerIndices[i1]] == null) {
  16110. Signlink.reportError(getMyUsername() + " null entry in pl list - pos:" + i1 + " size:" + playerCount);
  16111. throw new RuntimeException("eek");
  16112. }
  16113. }
  16114.  
  16115. }
  16116.  
  16117. private void updateSkillInterface(int id) {
  16118. switch (id) {
  16119. case 0:// attack
  16120. setInterfaceText(currentStats[0] + "", 31114);
  16121. setInterfaceText(PlayerHandler.getLevelForXP(currentExp[0]) + "", 31115);
  16122. break;
  16123.  
  16124. case 1:// defence
  16125. setInterfaceText(currentStats[1] + "", 31124);
  16126. setInterfaceText(PlayerHandler.getLevelForXP(currentExp[1]) + "", 31125);
  16127. break;
  16128.  
  16129. case 2:// strength
  16130. setInterfaceText(currentStats[2] + "", 31119);
  16131. setInterfaceText(PlayerHandler.getLevelForXP(currentExp[2]) + "", 31120);
  16132. break;
  16133.  
  16134. case 3:// hitpoints
  16135. setInterfaceText(currentStats[3] + "", 31159);
  16136. setInterfaceText(PlayerHandler.getLevelForXP(currentExp[3]) + "", 31160);
  16137. break;
  16138.  
  16139. case 4:// ranged
  16140. setInterfaceText(currentStats[4] + "", 31129);
  16141. setInterfaceText(PlayerHandler.getLevelForXP(currentExp[4]) + "", 31130);
  16142. break;
  16143.  
  16144. case 5:// prayer
  16145. setInterfaceText(currentStats[5] + "", 31134);
  16146. setInterfaceText(PlayerHandler.getLevelForXP(currentExp[5]) + "", 31135);
  16147. break;
  16148.  
  16149. case 6:// magic
  16150. setInterfaceText(currentStats[6] + "", 31139);
  16151. setInterfaceText(PlayerHandler.getLevelForXP(currentExp[6]) + "", 31140);
  16152. break;
  16153.  
  16154. case 7:// cooking
  16155. setInterfaceText(currentStats[7] + "", 31219);
  16156. setInterfaceText(PlayerHandler.getLevelForXP(currentExp[7]) + "", 31220);
  16157. break;
  16158.  
  16159. case 8:// woodcutting
  16160. setInterfaceText(currentStats[8] + "", 31229);
  16161. setInterfaceText(PlayerHandler.getLevelForXP(currentExp[8]) + "", 31230);
  16162. break;
  16163.  
  16164. case 9:// fletching
  16165. setInterfaceText(currentStats[9] + "", 31184);
  16166. setInterfaceText(PlayerHandler.getLevelForXP(currentExp[9]) + "", 31185);
  16167. break;
  16168.  
  16169. case 10:// fishing
  16170. setInterfaceText(currentStats[10] + "", 31214);
  16171. setInterfaceText(PlayerHandler.getLevelForXP(currentExp[10]) + "", 31215);
  16172. break;
  16173.  
  16174. case 11:// firemaking
  16175. setInterfaceText(currentStats[11] + "", 31224);
  16176. setInterfaceText(PlayerHandler.getLevelForXP(currentExp[11]) + "", 31225);
  16177. break;
  16178.  
  16179. case 12:// crafting
  16180. setInterfaceText(currentStats[12] + "", 31179);
  16181. setInterfaceText(PlayerHandler.getLevelForXP(currentExp[12]) + "", 31180);
  16182. break;
  16183.  
  16184. case 13:// smithing
  16185. setInterfaceText(currentStats[13] + "", 31209);
  16186. setInterfaceText(PlayerHandler.getLevelForXP(currentExp[13]) + "", 31210);
  16187. break;
  16188.  
  16189. case 14:// mining
  16190. setInterfaceText(currentStats[14] + "", 31204);
  16191. setInterfaceText(PlayerHandler.getLevelForXP(currentExp[14]) + "", 31205);
  16192. break;
  16193.  
  16194. case 15:// herblore
  16195. setInterfaceText(currentStats[15] + "", 31169);
  16196. setInterfaceText(PlayerHandler.getLevelForXP(currentExp[15]) + "", 31170);
  16197. break;
  16198.  
  16199. case 16:// agility
  16200. setInterfaceText(currentStats[16] + "", 31164);
  16201. setInterfaceText(PlayerHandler.getLevelForXP(currentExp[16]) + "", 31165);
  16202. break;
  16203.  
  16204. case 17:// thieving
  16205. setInterfaceText(currentStats[17] + "", 31174);
  16206. setInterfaceText(PlayerHandler.getLevelForXP(currentExp[17]) + "", 31175);
  16207. break;
  16208.  
  16209. case 18:// slayer
  16210. setInterfaceText(currentStats[18] + "", 31189);
  16211. setInterfaceText(PlayerHandler.getLevelForXP(currentExp[18]) + "", 31190);
  16212. break;
  16213.  
  16214. case 19:// farming
  16215. setInterfaceText(currentStats[19] + "", 31234);
  16216. setInterfaceText(PlayerHandler.getLevelForXP(currentExp[19]) + "", 31235);
  16217. break;
  16218.  
  16219. case 20:// runecrafating
  16220. setInterfaceText(currentStats[20] + "", 31144);
  16221. setInterfaceText(PlayerHandler.getLevelForXP(currentExp[20]) + "", 31145);
  16222. break;
  16223.  
  16224. /*
  16225. * case 21:// dungeoneering setInterfaceText(currentStats[21] + "",
  16226. * 31154); setInterfaceText(getLevelForXP(currentExp[21]) + "", 31155);
  16227. * setInterfaceText("Exp: " + currentExp[21] + "", 31153); break;
  16228. *
  16229. * case 22:// hunter setInterfaceText(currentStats[22] + "", 31194);
  16230. * setInterfaceText(getLevelForXP(currentExp[22]) + "", 31195);
  16231. * setInterfaceText("Exp: " + currentExp[22] + "", 31193); break;
  16232. */
  16233.  
  16234. case 23:// summoning
  16235. setInterfaceText(currentStats[23] + "", 31239);
  16236. setInterfaceText(PlayerHandler.getLevelForXP(currentExp[23]) + "", 31240);
  16237. break;
  16238.  
  16239. /*
  16240. * case 24:// construction setInterfaceText(currentStats[24] + "",
  16241. * 31149); setInterfaceText(getLevelForXP(currentExp[24]) + "", 31150);
  16242. * setInterfaceText("Exp: " + currentExp[24] + "", 31148); break;
  16243. */
  16244. }
  16245.  
  16246. setInterfaceText("Total Level:", 31199);
  16247. setInterfaceText(formatValue(PlayerHandler.getTotalLevel(this), 0), 31200);
  16248. }
  16249.  
  16250. private void updateStrings(String str, int i) {
  16251. switch (i) {
  16252. case 1675:
  16253. setInterfaceText(str, 17508);
  16254. break;// Stab
  16255.  
  16256. case 1676:
  16257. setInterfaceText(str, 17509);
  16258. break;// Slash
  16259.  
  16260. case 1677:
  16261. setInterfaceText(str, 17510);
  16262. break;// Cursh
  16263.  
  16264. case 1678:
  16265. setInterfaceText(str, 17511);
  16266. break;// Magic
  16267.  
  16268. case 1679:
  16269. setInterfaceText(str, 17512);
  16270. break;// Range
  16271.  
  16272. case 1680:
  16273. setInterfaceText(str, 17513);
  16274. break;// Stab
  16275.  
  16276. case 1681:
  16277. setInterfaceText(str, 17514);
  16278. break;// Slash
  16279.  
  16280. case 1682:
  16281. setInterfaceText(str, 17515);
  16282. break;// Crush
  16283.  
  16284. case 1683:
  16285. setInterfaceText(str, 17516);
  16286. break;// Magic
  16287.  
  16288. case 1684:
  16289. setInterfaceText(str, 17517);
  16290. break;// Range
  16291.  
  16292. case 1686:
  16293. setInterfaceText(str, 17518);
  16294. break;// Strength
  16295.  
  16296. case 1687:
  16297. setInterfaceText(str, 17519);
  16298. }
  16299. }
  16300.  
  16301. public String getLoginMessage1() {
  16302. return loginMessage1;
  16303. }
  16304.  
  16305. public void setLoginMessage1(String loginMessage1) {
  16306. this.loginMessage1 = loginMessage1;
  16307. }
  16308.  
  16309. public String getLoginMessage2() {
  16310. return loginMessage2;
  16311. }
  16312.  
  16313. public void setLoginMessage2(String loginMessage2) {
  16314. this.loginMessage2 = loginMessage2;
  16315. }
  16316.  
  16317. public Connection getConnection() {
  16318. return connection;
  16319. }
  16320.  
  16321. public void setConnection(Connection connection) {
  16322. this.connection = connection;
  16323. }
  16324.  
  16325. public int getLoginState() {
  16326. return loginState;
  16327. }
  16328.  
  16329. public void setLoginState(int loginState) {
  16330. this.loginState = loginState;
  16331. }
  16332.  
  16333. public int getLoginScreenState() {
  16334. return loginScreenState;
  16335. }
  16336.  
  16337. public void setLoginScreenState(int loginScreenState) {
  16338. this.loginScreenState = loginScreenState;
  16339. }
  16340.  
  16341. public int getLoginScreenCursorPos() {
  16342. return loginScreenCursorPos;
  16343. }
  16344.  
  16345. public void setLoginScreenCursorPos(int loginScreenCursorPos) {
  16346. this.loginScreenCursorPos = loginScreenCursorPos;
  16347. }
  16348.  
  16349. public String getPassword() {
  16350. return password;
  16351. }
  16352.  
  16353. public void setPassword(String password) {
  16354. this.password = password;
  16355. }
  16356.  
  16357. public ByteBuffer getInputBuffer() {
  16358. return inputBuffer;
  16359. }
  16360.  
  16361. public void setInputBuffer(ByteBuffer inputBuffer) {
  16362. this.inputBuffer = inputBuffer;
  16363. }
  16364.  
  16365. public long getServerSeed() {
  16366. return serverSeed;
  16367. }
  16368.  
  16369. public void setServerSeed(long serverSeed) {
  16370. this.serverSeed = serverSeed;
  16371. }
  16372.  
  16373. public static ByteBuffer getOut() {
  16374. return out;
  16375. }
  16376.  
  16377. public static void setOut(ByteBuffer out) {
  16378. Client.out = out;
  16379. }
  16380.  
  16381. public ByteBuffer getLoginBuffer() {
  16382. return loginBuffer;
  16383. }
  16384.  
  16385. public void setLoginBuffer(ByteBuffer loginBuffer) {
  16386. this.loginBuffer = loginBuffer;
  16387. }
  16388.  
  16389. public static boolean isLowDetail() {
  16390. return lowDetail;
  16391. }
  16392.  
  16393. public static void setLowDetail(boolean lowDetail) {
  16394. Client.lowDetail = lowDetail;
  16395. }
  16396.  
  16397. public ISAACCipher getConnectionCipher() {
  16398. return connectionCipher;
  16399. }
  16400.  
  16401. public void setConnectionCipher(ISAACCipher connectionCipher) {
  16402. this.connectionCipher = connectionCipher;
  16403. }
  16404.  
  16405. public int getLoginFailures() {
  16406. return loginFailures;
  16407. }
  16408.  
  16409. public void setLoginFailures(int loginFailures) {
  16410. this.loginFailures = loginFailures;
  16411. }
  16412.  
  16413. public static int getAnInt1226() {
  16414. return anInt1226;
  16415. }
  16416.  
  16417. public static void setAnInt1226(int anInt1226) {
  16418. Client.anInt1226 = anInt1226;
  16419. }
  16420.  
  16421. public static int getAnInt1155() {
  16422. return anInt1155;
  16423. }
  16424.  
  16425. public static void setAnInt1155(int anInt1155) {
  16426. Client.anInt1155 = anInt1155;
  16427. }
  16428.  
  16429. public static int getAnInt1188() {
  16430. return anInt1188;
  16431. }
  16432.  
  16433. public static void setAnInt1188(int anInt1188) {
  16434. Client.anInt1188 = anInt1188;
  16435. }
  16436.  
  16437. public static int getAnInt924() {
  16438. return anInt924;
  16439. }
  16440.  
  16441. public static void setAnInt924(int anInt924) {
  16442. Client.anInt924 = anInt924;
  16443. }
  16444.  
  16445. public static int getAnInt1288() {
  16446. return anInt1288;
  16447. }
  16448.  
  16449. public static void setAnInt1288(int anInt1288) {
  16450. Client.anInt1288 = anInt1288;
  16451. }
  16452.  
  16453. public static int getAnInt986() {
  16454. return anInt986;
  16455. }
  16456.  
  16457. public static void setAnInt986(int anInt986) {
  16458. Client.anInt986 = anInt986;
  16459. }
  16460.  
  16461. public static int getAnInt1134() {
  16462. return anInt1134;
  16463. }
  16464.  
  16465. public static void setAnInt1134(int anInt1134) {
  16466. Client.anInt1134 = anInt1134;
  16467. }
  16468.  
  16469. public static int getAnInt1175() {
  16470. return anInt1175;
  16471. }
  16472.  
  16473. public static void setAnInt1175(int anInt1175) {
  16474. Client.anInt1175 = anInt1175;
  16475. }
  16476.  
  16477. public int getWalkableInterface() {
  16478. return walkableInterface;
  16479. }
  16480.  
  16481. public void setWalkableInterface(int walkableInterface) {
  16482. this.walkableInterface = walkableInterface;
  16483. }
  16484.  
  16485. public int getAnInt900() {
  16486. return anInt900;
  16487. }
  16488.  
  16489. public void setAnInt900(int anInt900) {
  16490. this.anInt900 = anInt900;
  16491. }
  16492.  
  16493. public int getFullscreenInterfaceID() {
  16494. return fullscreenInterfaceID;
  16495. }
  16496.  
  16497. public void setFullscreenInterfaceID(int fullscreenInterfaceID) {
  16498. this.fullscreenInterfaceID = fullscreenInterfaceID;
  16499. }
  16500.  
  16501. public Deque getaClass19_1179() {
  16502. return aClass19_1179;
  16503. }
  16504.  
  16505. public void setaClass19_1179(Deque aClass19_1179) {
  16506. this.aClass19_1179 = aClass19_1179;
  16507. }
  16508.  
  16509. public int getAnInt985() {
  16510. return anInt985;
  16511. }
  16512.  
  16513. public void setAnInt985(int anInt985) {
  16514. this.anInt985 = anInt985;
  16515. }
  16516.  
  16517. public int getMyPlayerIndex() {
  16518. return myPlayerIndex;
  16519. }
  16520.  
  16521. public Deque getaClass19_1013() {
  16522. return aClass19_1013;
  16523. }
  16524.  
  16525. public void setaClass19_1013(Deque aClass19_1013) {
  16526. this.aClass19_1013 = aClass19_1013;
  16527. }
  16528.  
  16529. public ByteBuffer[] getaStreamArray895s() {
  16530. return aStreamArray895s;
  16531. }
  16532.  
  16533. public void setaStreamArray895s(ByteBuffer[] aStreamArray895s) {
  16534. this.aStreamArray895s = aStreamArray895s;
  16535. }
  16536.  
  16537. public int getMaxPlayers() {
  16538. return maxPlayers;
  16539. }
  16540.  
  16541. public Deque getaClass19_1056() {
  16542. return aClass19_1056;
  16543. }
  16544.  
  16545. public void setaClass19_1056(Deque aClass19_1056) {
  16546. this.aClass19_1056 = aClass19_1056;
  16547. }
  16548.  
  16549. public ScriptManager getScriptManager() {
  16550. return scriptManager;
  16551. }
  16552.  
  16553. public void setScriptManager(ScriptManager scriptManager) {
  16554. this.scriptManager = scriptManager;
  16555. }
  16556.  
  16557. public static String getMyUsername() {
  16558. return myUsername;
  16559. }
  16560.  
  16561. public static void setMyUsername(String myUsername) {
  16562. Client.myUsername = myUsername;
  16563. }
  16564.  
  16565. public MapArea getMapArea() {
  16566. return mapArea;
  16567. }
  16568.  
  16569. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement