Guest User

Untitled

a guest
Jul 20th, 2017
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 498.60 KB | None | 0 0
  1. package org.nr.client;
  2.  
  3. import java.applet.AppletContext;
  4. import java.awt.Color;
  5. import java.awt.Component;
  6. import java.awt.Font;
  7. import java.awt.Graphics;
  8. import java.awt.Point;
  9. import java.awt.Toolkit;
  10. import java.awt.datatransfer.Clipboard;
  11. import java.awt.datatransfer.DataFlavor;
  12. import java.awt.datatransfer.StringSelection;
  13. import java.awt.datatransfer.Transferable;
  14. import java.awt.datatransfer.UnsupportedFlavorException;
  15. import java.awt.event.KeyEvent;
  16. import java.io.BufferedInputStream;
  17. import java.io.DataInputStream;
  18. import java.io.File;
  19. import java.io.FileInputStream;
  20. import java.io.FileOutputStream;
  21. import java.io.IOException;
  22. import java.io.OutputStream;
  23. import java.io.PrintStream;
  24. import java.net.InetAddress;
  25. import java.net.Socket;
  26. import java.net.URL;
  27. import java.nio.file.Files;
  28. import java.nio.file.Path;
  29. import java.nio.file.Paths;
  30. import java.util.AbstractMap;
  31. import java.util.ArrayList;
  32. import java.util.HashMap;
  33. import java.util.Iterator;
  34. import java.util.Map;
  35. import java.util.Map.Entry;
  36.  
  37. import org.nr.client.cache.Decompressor;
  38. import org.nr.client.cache.FileOperations;
  39. import org.nr.client.cache.FileUtility;
  40. import org.nr.client.cache.Node;
  41. import org.nr.client.cache.NodeList;
  42. import org.nr.client.cache.OnDemandData;
  43. import org.nr.client.cache.OnDemandFetcher;
  44. import org.nr.client.cache.Signlink;
  45. import org.nr.client.cache.StreamLoader;
  46. import org.nr.client.cache.TeeOutputStream;
  47. import org.nr.client.cache.VarBit;
  48. import org.nr.client.cache.download.Downloader;
  49. import org.nr.client.definition.ItemDefinition;
  50. import org.nr.client.definition.NpcDefinition;
  51. import org.nr.client.definition.ObjectDefinition;
  52. import org.nr.client.media.Media;
  53. import org.nr.client.media.Sprite;
  54. import org.nr.client.media.SpriteLoader;
  55. import org.nr.client.media.widget.RSInterface;
  56. import org.nr.client.media.widget.Widgets;
  57. import org.nr.client.media.widget.gameframe.Gameframe;
  58. import org.nr.client.media.widget.gameframe.Gameframe317;
  59. import org.nr.client.media.widget.gameframe.Gameframe459;
  60. import org.nr.client.media.widget.gameframe.Gameframe474;
  61. import org.nr.client.media.widget.gameframe.Gameframe525;
  62. import org.nr.client.media.widget.gameframe.Gameframe602;
  63. import org.nr.client.media.widget.mikey.InterfaceDropTables;
  64. import org.nr.client.media.widget.mikey.InterfaceSettings;
  65. import org.nr.client.media.widget.mikey.MikeysInterfaces;
  66. import org.nr.client.model.Animable;
  67. import org.nr.client.model.Animable_Sub3;
  68. import org.nr.client.model.Animable_Sub4;
  69. import org.nr.client.model.Animable_Sub5;
  70. import org.nr.client.model.Animation;
  71. import org.nr.client.model.Background;
  72. import org.nr.client.model.Censor;
  73. import org.nr.client.model.Class11;
  74. import org.nr.client.model.Class30_Sub1;
  75. import org.nr.client.model.Class36;
  76. import org.nr.client.model.CombatOverlays;
  77. import org.nr.client.model.DrawingArea;
  78. import org.nr.client.model.Entity;
  79. import org.nr.client.model.ExperienceCounter;
  80. import org.nr.client.model.Floor;
  81. import org.nr.client.model.Fog;
  82. import org.nr.client.model.FontStyle;
  83. import org.nr.client.model.GameObjectSpawns;
  84. import org.nr.client.model.GameObjectSpawns.GameObject;
  85. import org.nr.client.model.IdentityKit;
  86. import org.nr.client.model.ImageProducer;
  87. import org.nr.client.model.Item;
  88. import org.nr.client.model.MapRender;
  89. import org.nr.client.model.MidiPlayer;
  90. import org.nr.client.model.Model;
  91. import org.nr.client.model.Npc;
  92. import org.nr.client.model.Object1;
  93. import org.nr.client.model.Object2;
  94. import org.nr.client.model.Object3;
  95. import org.nr.client.model.Object5;
  96. import org.nr.client.model.ObjectManager;
  97. import org.nr.client.model.OverlayFlo;
  98. import org.nr.client.model.Player;
  99. import org.nr.client.model.RSFont;
  100. import org.nr.client.model.Sounds;
  101. import org.nr.client.model.SpotAnim;
  102. import org.nr.client.model.TextClass;
  103. import org.nr.client.model.TextInput;
  104. import org.nr.client.model.Texture;
  105. import org.nr.client.model.Varp;
  106. import org.nr.client.model.WorldController;
  107. import org.nr.client.net.IsaacRandomGenerator;
  108. import org.nr.client.net.RSBuffer;
  109. import org.nr.client.net.RSSocket;
  110. import org.nr.client.net.SizeConstants;
  111. import org.nr.client.util.ClientSettings;
  112. import org.nr.client.util.Configuration;
  113. import org.nr.client.util.Configuration.World;
  114. import org.nr.client.util.MouseDetection;
  115. import org.nr.client.util.Skills;
  116. import org.nr.client.util.Skills.SkillData;
  117.  
  118. public class Client extends RSApplet {
  119.  
  120. /**
  121. * Credits: Lost Valentino Poes700 Maxi Eliminate Zion
  122. */
  123.  
  124. /**
  125. * Enable/disable for hp/prayer/run/xp counter/world map orbs
  126. */
  127. public boolean loadOrbs = false;
  128.  
  129. /**
  130. * Enable/disable for roofs
  131. */
  132. public boolean roofsOff = false;
  133.  
  134. /**
  135. * RSA keys
  136. */
  137. private static final long serialVersionUID = 5707517957054703648L;
  138.  
  139. /**
  140. * newDamage enables or disables fake constitution.
  141. */
  142. public static boolean newDamage = true;
  143.  
  144. /**
  145. * npcBits can be changed to what your server's bits are set to. This needs
  146. * to be the same as serverside
  147. */
  148. public static int npcBits = 18;
  149.  
  150. private int screenOpacity = 250;
  151. private final static int SHADOW_SPEED = 1;
  152. private int shadowDestination = 250;
  153. private int mySummonIndex;
  154.  
  155. public enum ScreenMode {
  156. FIXED, RESIZABLE, FULLSCREEN;
  157. }
  158.  
  159. public ScreenMode frameMode = ScreenMode.FIXED;
  160. public int frameWidth = 765;
  161. public int frameHeight = 503;
  162. public int screenAreaWidth = 512;
  163. public int screenAreaHeight = 334;
  164. private int cameraZoom = 600;
  165. public boolean showChatComponents = true;
  166. public boolean showTabComponents = true;
  167. public boolean changeTabArea = frameMode == ScreenMode.FIXED ? false : true;
  168. public boolean changeChatArea = frameMode == ScreenMode.FIXED ? false : true;
  169. public boolean transparentTabArea = false;
  170. public MidiPlayer midiPlayer;
  171. public int midiVolume = 64;
  172.  
  173. public static int playery() {
  174. return instance.baseY + (Client.myPlayer.y - 6 >> 7);
  175. }
  176.  
  177. public static int playerx() {
  178. return instance.baseX + (Client.myPlayer.x - 6 >> 7);
  179. }
  180.  
  181. public void stopMidi() {
  182. if (midiPlayer != null) {
  183. midiPlayer.stop();
  184. } else {
  185. System.out.println("Midi player is null!");
  186. }
  187. }
  188.  
  189. public static void setClipboardContents(String aString) {
  190. StringSelection stringSelection = new StringSelection(aString);
  191. Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
  192. clipboard.setContents(stringSelection, null);
  193. }
  194.  
  195. public static String getClipboardContents() {
  196. String result = "";
  197. Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
  198. // odd: the Object param of getContents is not currently used
  199. Transferable contents = clipboard.getContents(null);
  200. boolean hasTransferableText = (contents != null)
  201. && contents.isDataFlavorSupported(DataFlavor.stringFlavor);
  202. if (hasTransferableText) {
  203. try {
  204. result = (String) contents
  205. .getTransferData(DataFlavor.stringFlavor);
  206. } catch (UnsupportedFlavorException ex) {
  207. // highly unlikely since we are using a standard DataFlavor
  208. System.out.println(ex);
  209. ex.printStackTrace();
  210. } catch (IOException ex) {
  211. System.out.println(ex);
  212. ex.printStackTrace();
  213. }
  214. }
  215. return result;
  216. }
  217.  
  218. public void setMidiVolume(int vol) {
  219. midiVolume = vol;
  220. if (midiPlayer == null) {
  221. return;
  222. }
  223. if (midiPlayer.playing()) {
  224. midiPlayer.setVolume(0, midiVolume);
  225. }
  226. }
  227.  
  228. public void playMidi(byte abyte0[]) {
  229. boolean quickSong = (prevSong > 0 ? true : false);
  230.  
  231. if (midiPlayer == null) {
  232. System.out.println("Midi player is null");
  233. return;
  234. }
  235.  
  236. if (midiPlayer.playing() && !quickSong) {
  237. midiPlayer.play(abyte0, false, midiVolume);// add fading to this one
  238. } else {
  239. midiPlayer.play(abyte0, false, midiVolume);
  240. }
  241. }
  242.  
  243. public static boolean isOldschool() {
  244. // return ClientSettings.getBoolean("old_characters");
  245. return true;
  246. }
  247.  
  248. public void switchCharacters() {
  249. Player.mruNodes.unlinkAll();
  250. }
  251.  
  252. public void onKeyPress(int keyCode) {
  253. switch (keyCode) {
  254. case KeyEvent.VK_C:
  255. if (!isPressed(KeyEvent.VK_CONTROL)) {
  256. return;
  257. }
  258.  
  259. int x = baseX + (myPlayer.x - 6 >> 7);
  260. int y = baseY + (myPlayer.y - 6 >> 7);
  261. StringSelection selection = new StringSelection(x + ", " + y);
  262. Toolkit.getDefaultToolkit().getSystemClipboard().setContents(selection, selection);
  263. break;
  264. case KeyEvent.VK_V:
  265. if (!isPressed(KeyEvent.VK_CONTROL)) {
  266. return;
  267. }
  268.  
  269. String contents = "";
  270. try {
  271. contents = (String) Toolkit.getDefaultToolkit().getSystemClipboard().getData(DataFlavor.stringFlavor);
  272. } catch (Exception e) {
  273.  
  274. }
  275.  
  276. if (friendsListAction > 0 && messagePromptRaised) {
  277. promptInput += contents;
  278. } else {
  279. inputString += contents;
  280. }
  281. break;
  282. case KeyEvent.VK_ESCAPE:
  283. if (openInterfaceID == 5292 || openInterfaceID == 3824) {
  284. clearTopInterfaces();
  285. }
  286. break;
  287. case KeyEvent.VK_TAB:
  288. tabToReplyPm();
  289. break;
  290. }
  291. fkey(keyCode);
  292. }
  293.  
  294. public static boolean fkey(int key) {
  295. int[][] keys = { { 1, KeyEvent.VK_F1 }, { 2, KeyEvent.VK_F2 }, { 3, KeyEvent.VK_F3 }, { 4, KeyEvent.VK_F4 },
  296. { 5, KeyEvent.VK_F5 }, { 6, KeyEvent.VK_F6 }, { 7, KeyEvent.VK_F7 }, { 8, KeyEvent.VK_F8 } };
  297.  
  298. for (int i = 0; i < keys.length; i++) {
  299. if (key == keys[i][1]) {
  300. for (int k = 0; k < instance.keybinds.length; k++) {
  301. if (instance.keybinds[k] == keys[i][0]) {
  302. instance.openTab(k);
  303. return true;
  304. }
  305. }
  306.  
  307. instance.pushMessage("This f-key is not bound, navigate to your settings tab to set it.", 0, "");
  308. return true;
  309. }
  310. }
  311.  
  312. return false;
  313. }
  314.  
  315. public void preloadModels(String directory, int index) {
  316. try {
  317. recursiveLoadModels(new File(Signlink.getCacheDirectory() + directory), index);
  318. } catch (Exception e) {
  319. e.printStackTrace();
  320. }
  321. }
  322.  
  323. private void recursiveLoadModels(File directory, int index) {
  324. if (!directory.exists())
  325. return;
  326. File[] fileArray = directory.listFiles();
  327. for (int i = 0; i < fileArray.length; i++) {
  328. if (fileArray[i].isDirectory()) {
  329. recursiveLoadModels(fileArray[i], index);
  330. } else {
  331. File model = fileArray[i];
  332. System.out.println("Loading model file to index: " + index + ", " + model.getName());
  333. byte[] buffer = ReadFile(model.getPath());
  334. Model.method460(buffer, Integer.parseInt(getFileNameWithoutExtension(model.getName())), index);
  335. }
  336. }
  337. }
  338.  
  339. public void preloadMaps() {
  340. try {
  341. recursiveLoadMaps(new File(Signlink.getCacheDirectory() + "/raw/maps/"));
  342. } catch (Exception e) {
  343. e.printStackTrace();
  344. }
  345. }
  346.  
  347. private void recursiveLoadMaps(File directory) {
  348. if (!directory.exists())
  349. return;
  350. File[] fileArray = directory.listFiles();
  351. for (int i = 0; i < fileArray.length; i++) {
  352. if (fileArray[i].isDirectory()) {
  353. recursiveLoadAnims(fileArray[i]);
  354. } else {
  355. File model = fileArray[i];
  356. System.out.println("Loading map file " + model.getName());
  357. byte[] buffer = ReadFile(model.getPath());
  358. decompressors[4].method234(buffer.length, buffer,
  359. Integer.parseInt(getFileNameWithoutExtension(model.toString())));
  360. }
  361. }
  362. }
  363.  
  364. public void preloadAnims() {
  365. try {
  366. recursiveLoadAnims(new File(Signlink.getCacheDirectory() + "/raw/anims/"));
  367. } catch (Exception e) {
  368. e.printStackTrace();
  369. }
  370. }
  371.  
  372. private void recursiveLoadAnims(File directory) {
  373. if (!directory.exists())
  374. return;
  375. File[] fileArray = directory.listFiles();
  376. for (int i = 0; i < fileArray.length; i++) {
  377. if (fileArray[i].isDirectory()) {
  378. recursiveLoadAnims(fileArray[i]);
  379. } else {
  380. File model = fileArray[i];
  381. System.out.println("Loading animation file " + model.getName());
  382. byte[] buffer = ReadFile(model.getPath());
  383. Class36.load(Integer.parseInt(getFileNameWithoutExtension(model.getName())), buffer, 0);
  384. // Model.method460(buffer,
  385. // Integer.parseInt(getFileNameWithoutExtension(model.getName())),
  386. // false);
  387. }
  388. }
  389. }
  390.  
  391. public void openPromptForInput(String message) {
  392. promptInput = "";
  393. aString1121 = message;
  394. messagePromptRaised = true;
  395. inputTaken = true;
  396. friendsListAction = -1;
  397. }
  398.  
  399. private void processShadow() {
  400. if (screenOpacity < shadowDestination) {
  401. screenOpacity += SHADOW_SPEED;
  402. } else if (screenOpacity > shadowDestination) {
  403. screenOpacity -= SHADOW_SPEED;
  404. }
  405. }
  406.  
  407. private void setAutoCastOff() {
  408. autoCast = false;
  409. autocastId = 0;
  410. sendPacket185(6667);
  411. }
  412.  
  413. public void openLink(int buttonId) {
  414. switch (buttonId) {
  415. case 14009:
  416. launchURL("http://near-reality.org/bloodlust/");
  417. return;
  418. case 14005:
  419. launchURL("http://near-reality.org/bloodlust/invites");
  420. return;
  421. case 14013:
  422. launchURL("http://near-reality.org/bloodlust/invites");
  423. return;
  424. }
  425. }
  426.  
  427. public void sendPacket185(int buttonID) {
  428. openLink(buttonID);
  429. MikeysInterfaces.buttonClicked(buttonID);
  430. stream.createFrame(185);
  431. stream.writeWord(buttonID);
  432. RSInterface rsi = RSInterface.interfaceCache[buttonID];
  433. if (rsi == null)
  434. return;
  435. if (rsi.valueIndexArray != null && rsi.valueIndexArray[0][0] == 5) {
  436. int configID = rsi.valueIndexArray[0][1];
  437. variousSettings[configID] = 1 - variousSettings[configID];
  438. method33(configID);
  439. // needDrawTabArea = true;
  440. }
  441. }
  442.  
  443. public boolean packModel(int modelId, int index) {
  444. byte[] abyte0 = getModel(modelId);
  445. if (abyte0 != null && abyte0.length > 0) {
  446. decompressors[index].method234(abyte0.length, abyte0, modelId);
  447. // System.out.println("Packed model: " + modelId);
  448. return true;
  449. } else {
  450. System.err.println("Could not pack model: " + modelId);
  451. }
  452.  
  453. return false;
  454. }
  455.  
  456. public byte[] getModel(int index) {
  457. try {
  458. File model = new File(Signlink.getCacheDirectory() + "models/" + index + ".gz");
  459. byte[] aByte = new byte[(int) model.length()];
  460. FileInputStream Fis = new FileInputStream(model);
  461. Fis.read(aByte);
  462. Fis.close();
  463. return aByte;
  464. } catch (Exception e) {
  465. return null;
  466. }
  467. }
  468.  
  469. public void setCameraZoom(int cameraZoom) {
  470. if (!fixed() && cameraZoom > 600)
  471. cameraZoom = 600;
  472. this.cameraZoom = cameraZoom;
  473. ClientSettings.set("zoom", cameraZoom);
  474. }
  475.  
  476. public int getCameraZoom() {
  477. return cameraZoom;
  478. }
  479.  
  480. public boolean fixed() {
  481. return frameMode == ScreenMode.FIXED;
  482. }
  483.  
  484. public void resizable(int width, int height) {
  485. if (this.frameMode != ScreenMode.RESIZABLE) {
  486. this.frameMode = ScreenMode.RESIZABLE;
  487. frameWidth = width;
  488. frameHeight = height;
  489. rebuildFrameSize(frameMode, frameWidth, frameHeight);
  490. setBounds();
  491. }
  492. }
  493.  
  494. public void frameMode(ScreenMode screenMode) {
  495. // if (frameMode != screenMode) {
  496. frameMode = screenMode;
  497. if (screenMode == ScreenMode.FIXED) {
  498. frameWidth = 765;
  499. frameHeight = 503;
  500. setCameraZoom(600);
  501. WorldController.viewDistance = 9;
  502. changeChatArea = false;
  503. changeTabArea = false;
  504. } else if (screenMode == ScreenMode.RESIZABLE) {
  505. frameWidth = 800;
  506. frameHeight = 600;
  507. setCameraZoom(850);
  508. // WorldController.viewDistance = 10;
  509. } else if (screenMode == ScreenMode.FULLSCREEN) {
  510. setCameraZoom(600);
  511. // WorldController.viewDistance = 10;
  512. frameWidth = (int) Toolkit.getDefaultToolkit().getScreenSize().getWidth();
  513. frameHeight = (int) Toolkit.getDefaultToolkit().getScreenSize().getHeight();
  514. }
  515. rebuildFrameSize(screenMode, frameWidth, frameHeight);
  516. setBounds();
  517. // }
  518. showChatComponents = screenMode == ScreenMode.FIXED ? true : showChatComponents;
  519. showTabComponents = screenMode == ScreenMode.FIXED ? true : showTabComponents;
  520. }
  521.  
  522. public void rebuildFrameSize(ScreenMode screenMode, int screenWidth, int screenHeight) {
  523. try {
  524. screenAreaWidth = (screenMode == ScreenMode.FIXED) ? 512 : screenWidth;
  525. screenAreaHeight = (screenMode == ScreenMode.FIXED) ? 334 : screenHeight;
  526. frameWidth = screenWidth;
  527. frameHeight = screenHeight;
  528. // instance.refreshFrameSize(screenMode == ScreenMode.FULLSCREEN, screenWidth, screenHeight,
  529. // screenMode == ScreenMode.RESIZABLE, screenMode != ScreenMode.FIXED);
  530. // ClientUI.getInstance().resize(screenWidth, screenHeight);
  531. ClientUI.getInstance().handleResize(screenMode, screenWidth, screenHeight);
  532. Widgets.load();
  533. setBounds();
  534. } catch (Exception e) {
  535. e.printStackTrace();
  536. }
  537. }
  538.  
  539. public void refreshFrameSize() {
  540. if (frameMode == ScreenMode.RESIZABLE) {
  541. if (cameraZoom > 600)
  542. setCameraZoom(600);
  543. if (WorldController.viewDistance != 10) {
  544. WorldController.viewDistance = 10;
  545. setBounds();
  546. }
  547.  
  548. if (frameWidth != (ClientUI.getInstance().getWidth()/*
  549. * appletClient() ?
  550. * getGameComponent().getWidth() :
  551. *//*gameFrame.getFrameWidth()*/)) {
  552. frameWidth = (ClientUI.getInstance().getWidth()/*
  553. * appletClient() ?
  554. * getGameComponent().getWidth() :
  555. gameFrame.getFrameWidth()*/);
  556. screenAreaWidth = frameWidth;
  557. ClientSettings.set("screen_width", frameWidth);
  558. setBounds();
  559. }
  560. if (frameHeight != (/*
  561. * appletClient() ?
  562. * getGameComponent().getHeight() :
  563. gameFrame.getFrameHeight()*/ClientUI.getInstance().getHeight())) {
  564. frameHeight = (/*
  565. * appletClient() ?
  566. * getGameComponent().getHeight() :
  567. gameFrame.getFrameHeight()*/ClientUI.getInstance().getHeight());
  568. screenAreaHeight = frameHeight;
  569. ClientSettings.set("screen_height", frameHeight);
  570. setBounds();
  571. }
  572.  
  573. /*
  574. * if (frameMode == ScreenMode.RESIZABLE && (frameWidth >= 766) &&
  575. * (frameWidth <= 1025) && (frameHeight >= 504) && (frameHeight <=
  576. * 850)) { if (WorldController.viewDistance != 9) {
  577. * WorldController.viewDistance = 9; setBounds(); } cameraZoom =
  578. * 575; } else if (frameMode == ScreenMode.FIXED) { cameraZoom =
  579. * 600; } else if (frameMode == ScreenMode.RESIZABLE || frameMode ==
  580. * ScreenMode.FULLSCREEN) { if (WorldController.viewDistance != 10)
  581. * { WorldController.viewDistance = 10; setBounds(); } cameraZoom =
  582. * 600; }
  583. */
  584. }
  585. }
  586.  
  587. private void setBounds() {
  588. Texture.method365(frameWidth, frameHeight);
  589. fullScreenTextureArray = Texture.anIntArray1472;
  590. Texture.method365(
  591. frameMode == ScreenMode.FIXED
  592. ? (aRSImageProducer_1166 != null ? aRSImageProducer_1166.canvasWidth : 519) : frameWidth,
  593. frameMode == ScreenMode.FIXED
  594. ? (aRSImageProducer_1166 != null ? aRSImageProducer_1166.canvasHeight : 165) : frameHeight);
  595. anIntArray1180 = Texture.anIntArray1472;
  596. Texture.method365(
  597. frameMode == ScreenMode.FIXED
  598. ? (aRSImageProducer_1163 != null ? aRSImageProducer_1163.canvasWidth : 249) : frameWidth,
  599. frameMode == ScreenMode.FIXED
  600. ? (aRSImageProducer_1163 != null ? aRSImageProducer_1163.canvasHeight : 335) : frameHeight);
  601. anIntArray1181 = Texture.anIntArray1472;
  602. Texture.method365(screenAreaWidth, screenAreaHeight);
  603. anIntArray1182 = Texture.anIntArray1472;
  604. int ai[] = new int[9];
  605. for (int i8 = 0; i8 < 9; i8++) {
  606. int k8 = 128 + i8 * 32 + 15;
  607. int l8 = 600 + k8 * 3;
  608. int i9 = Texture.anIntArray1470[k8];
  609. ai[i8] = l8 * i9 >> 16;
  610. }
  611. WorldController.method310(500, 800, screenAreaWidth, screenAreaHeight, ai);
  612. if (loggedIn) {
  613. aRSImageProducer_1165 = new ImageProducer(screenAreaWidth, screenAreaHeight);
  614. }
  615. }
  616.  
  617. public static boolean isSummon(final Npc npc) {
  618. String action = "";
  619. for (int i = 0; i <= 4; i++) {
  620. if (npc.desc == null)
  621. return false;
  622.  
  623. if (npc.desc.actions == null)
  624. return false;
  625.  
  626. action = npc.desc.actions[i];
  627. if (action == null)
  628. continue;
  629.  
  630. if (action.toLowerCase().contains("pick-up")) {
  631. return true;
  632. }
  633. }
  634. return false;
  635. }
  636.  
  637. public void setTabInterfaceId(int index, int interfaceId) {
  638. this.tabInterfaceIDs[index] = interfaceId;
  639. if (this.tabID == index) {
  640. // this.needDrawTabArea = true;
  641. tabAreaAltered = true;
  642. this.inputTaken = true;
  643. }
  644. }
  645.  
  646. public void openTab(int tab) {
  647. tabID = tab;
  648. tabAreaAltered = true;
  649. inputTaken = true;
  650. }
  651.  
  652. public boolean getMousePositions() {
  653. if (mouseInRegion(frameWidth - (frameWidth <= 1000 ? 240 : 420), frameHeight - (frameWidth <= 1000 ? 90 : 37),
  654. frameWidth, frameHeight)) {
  655. return false;
  656. }
  657. if (showChatComponents) {
  658. if (changeChatArea) {
  659. if (super.mouseX > 0 && super.mouseX < 494 && super.mouseY > frameHeight - 175
  660. && super.mouseY < frameHeight) {
  661. return true;
  662. } else {
  663. if (super.mouseX > 494 && super.mouseX < 515 && super.mouseY > frameHeight - 175
  664. && super.mouseY < frameHeight) {
  665. return false;
  666. }
  667. }
  668. } else if (!changeChatArea) {
  669. if (super.mouseX > 0 && super.mouseX < 519 && super.mouseY > frameHeight - 175
  670. && super.mouseY < frameHeight) {
  671. return false;
  672. }
  673. }
  674. }
  675. if (mouseInRegion(frameWidth - 216, 0, frameWidth, 172)) {
  676. return false;
  677. }
  678. if (!changeTabArea) {
  679. if (super.mouseX > 0 && super.mouseY > 0 && super.mouseY < frameWidth && super.mouseY < frameHeight) {
  680. if (super.mouseX >= frameWidth - 242 && super.mouseY >= frameHeight - 335) {
  681. return false;
  682. }
  683. return true;
  684. }
  685. return false;
  686. }
  687. if (showTabComponents) {
  688. if (frameWidth > 1000) {
  689. if (super.mouseX >= frameWidth - 420 && super.mouseX <= frameWidth && super.mouseY >= frameHeight - 37
  690. && super.mouseY <= frameHeight
  691. || super.mouseX > frameWidth - 225 && super.mouseX < frameWidth
  692. && super.mouseY > frameHeight - 37 - 274 && super.mouseY < frameHeight) {
  693. return false;
  694. }
  695. } else {
  696. if (super.mouseX >= frameWidth - 210 && super.mouseX <= frameWidth && super.mouseY >= frameHeight - 74
  697. && super.mouseY <= frameHeight
  698. || super.mouseX > frameWidth - 225 && super.mouseX < frameWidth
  699. && super.mouseY > frameHeight - 74 - 274 && super.mouseY < frameHeight) {
  700. return false;
  701. }
  702. }
  703. }
  704. return true;
  705. }
  706.  
  707. public boolean mouseInRegion(int x1, int y1, int x2, int y2) {
  708. if (super.mouseX >= x1 && super.mouseX <= x2 && super.mouseY >= y1 && super.mouseY <= y2) {
  709. return true;
  710. }
  711. return false;
  712. }
  713.  
  714. public boolean mouseMapPosition() {
  715. if (super.mouseX >= frameWidth - 21 && super.mouseX <= frameWidth && super.mouseY >= 0 && super.mouseY <= 21) {
  716. return false;
  717. }
  718. return true;
  719. }
  720.  
  721. private void drawLoadingMessages(int used, String s, String s1) {
  722. int width = regularText.getTextWidth(used == 1 ? s : s1);
  723. int height = s1 == null ? 25 : 38;
  724. DrawingArea.drawPixels(1, 1, width + 6, height, 0);
  725. DrawingArea.drawPixels(1, 1, width + 6, 1, 0xffffff);
  726. DrawingArea.drawPixels(1, 1, 1, height, 0xffffff);
  727. DrawingArea.drawPixels(1, height, width + 6, 1, 0xffffff);
  728. DrawingArea.drawPixels(width + 6, 1, 1, height, 0xffffff);
  729. regularText.drawText(0xffffff, s, 18, width / 2 + 5);
  730. if (s1 != null) {
  731. regularText.drawText(0xffffff, s1, 31, width / 2 + 5);
  732. }
  733. }
  734.  
  735. private static String intToKOrMilLongName(int i) {
  736. String s = String.valueOf(i);
  737. for (int k = s.length() - 3; k > 0; k -= 3)
  738. s = s.substring(0, k) + "," + s.substring(k);
  739. if (s.length() > 8)
  740. s = "@gre@" + s.substring(0, s.length() - 8) + " million @whi@(" + s + ")";
  741. else if (s.length() > 4)
  742. s = "@cya@" + s.substring(0, s.length() - 4) + "K @whi@(" + s + ")";
  743. return " " + s;
  744. }
  745.  
  746. public final String methodR(long j) {
  747. if (j >= 0 && j < 10000)
  748. return String.valueOf(j);
  749. if (j >= 10000 && j < 10000000)
  750. return j / 1000 + "K";
  751. if (j >= 10000000 && j < 999999999)
  752. return j / 1000000 + "M";
  753. if (j >= 999999999)
  754. return "*";
  755. else
  756. return "?";
  757. }
  758.  
  759. public void faceNorth() {
  760. minimapInt1 = 0;
  761. anInt1184 = 120;
  762. }
  763.  
  764. public void faceSouth() {
  765. minimapInt1 = 1010;
  766. anInt1184 = 120;
  767. }
  768.  
  769. public static final byte[] ReadFile(String s) {
  770. try {
  771. byte abyte0[];
  772. File file = new File(s);
  773. int i = (int) file.length();
  774. abyte0 = new byte[i];
  775. DataInputStream datainputstream = new DataInputStream(new BufferedInputStream(new FileInputStream(s)));
  776. datainputstream.readFully(abyte0, 0, i);
  777. datainputstream.close();
  778. return abyte0;
  779. } catch (Exception e) {
  780. System.out.println((new StringBuilder()).append("Read Error: ").append(s).toString());
  781. return null;
  782. }
  783. }
  784.  
  785. private boolean menuHasAddFriend(int j) {
  786. if (j < 0)
  787. return false;
  788. int k = menuActionID[j];
  789. if (k >= 2000)
  790. k -= 2000;
  791. return k == 337;
  792. }
  793.  
  794. public String itemResultNames[] = new String[100];
  795. public int itemResultIDs[] = new int[100];
  796. public static int itemResultScrollPos;
  797. public static boolean displayScrollbar;
  798.  
  799. public void displayItemSearch() {
  800. int yPosOffset = (frameMode != ScreenMode.FIXED) ? screenAreaHeight - 165 : 0;
  801. int xPosOffset = 0;
  802. try {
  803. // quickChat = false;
  804.  
  805. if (buttonclicked && inputDialogState == 3) {
  806. if (amountOrNameInput != "") {
  807. itemSearch(amountOrNameInput);
  808. }
  809. cacheSprites[64].drawSprite(0 + xPosOffset, 0 + yPosOffset);
  810. DrawingArea.setDrawingArea(121 + yPosOffset, 8, 512, 7);
  811. cacheSprites2[678].drawSprite(18, 18 + yPosOffset);
  812. for (int j = 0; j < totalItemResults; j++) {
  813. int x = super.mouseX;
  814. int y = super.mouseY;
  815. final int yPos = 21 + j * 14 - itemResultScrollPos;
  816. if (yPos > 0 && yPos < 210) {
  817. String n = itemResultNames[j];
  818. for (int i = 0; i <= 20; i++)
  819. if (n.contains("<img=" + i + ">"))
  820. n = n.replaceAll("<img=" + i + ">", "");
  821. boldText.method591(capitalizeFirstChar(n), 78, 0xA05A00,
  822. yPos + yPosOffset + (totalItemResults < 8 ? 6 : 0));
  823. if (x > 74 && x < 495
  824. && y > ((frameMode == ScreenMode.FIXED) ? 338 : screenAreaHeight - 165) + yPos - 13
  825. + (totalItemResults < 8 ? 6 : 0)
  826. && y < ((frameMode == ScreenMode.FIXED) ? 338 : screenAreaHeight - 165) + yPos + 2
  827. + (totalItemResults < 8 ? 6 : 0)) {
  828. DrawingArea.fillRectangle(0x807660, yPos - 12 + yPosOffset + (totalItemResults < 8 ? 6 : 0),
  829. 424, 15, 60, 75);
  830. Sprite itemImg = ItemDefinition.getSprite(itemResultIDs[j], 1, 0);
  831. if (itemImg != null)
  832. itemImg.drawSprite(22, 20 + yPosOffset);
  833. GEItemId = itemResultIDs[j];
  834. }
  835. }
  836. }
  837. DrawingArea.drawPixels(74, 8 + yPosOffset, 2, 113, 0x807660);
  838. DrawingArea.defaultDrawingAreaSize();
  839. if (totalItemResults > 8) {
  840. displayScrollbar = true;
  841. drawScrollbar(114, itemResultScrollPos, 8 + yPosOffset, 496 + xPosOffset, totalItemResults * 14,
  842. false);
  843. // drawScrollbar(112, itemResultScrollPos, 8, 496,
  844. // totalItemResults * 14 + 12, 0);
  845. } else {
  846. displayScrollbar = false;
  847. }
  848. boolean showMatches = true;
  849. showMatches = true;
  850. if (amountOrNameInput.length() == 0) {
  851. boldText.drawCenteredText(0xA05A00, 259, "Grand Exchange Item Search", 30 + yPosOffset, false);
  852. smallText.drawCenteredText(0xA05A00, 259,
  853. "To search for an item, start by typing part of it's name.", 80 + yPosOffset, false);
  854. smallText.drawCenteredText(0xA05A00, 259,
  855. "Then, simply select the item you want from the results on the display.",
  856. 80 + 15 + yPosOffset, false);
  857. // chatTextDrawingArea.drawText(0xffffff, amountOrNameInput
  858. // +
  859. // "*", 32, 133);
  860. showMatches = false;
  861. }
  862. if (totalItemResults == 0 && showMatches) {
  863. smallText.drawCenteredText(0xA05A00, 259, "No matching items found", 80 + yPosOffset, false);
  864. }
  865. DrawingArea.fillRectangle(0x807660, 121 + yPosOffset, 506, 15, 120, 7);// box
  866. // chatTextDrawingArea.drawText(0, "<img=8>", 133, 12);
  867. boldText.method591(amountOrNameInput + "*", 28 + xPosOffset, 0xffffff, 133 + yPosOffset);
  868. // chatTextDrawingArea.drawText(0xffffff, amountOrNameInput +
  869. // "*",
  870. // 133, 122);
  871. DrawingArea.drawLine(121 + yPosOffset, 0x807660, 506, 7);// line
  872. // drawClose(496, 122, 496, 345 + 112, 496 + 19, 361 + 112);
  873. // drawClose(496, 122, 496, 345 + 112, 496 + 19, 361 + 112);
  874. // drawClose(496, 122, 496, 345 + 112, 496 + 19, 361 + 112);
  875. }
  876. cacheSprites2[679].drawSprite(11, 122 + yPosOffset);
  877. } catch (Exception e) {
  878. e.printStackTrace();
  879. }
  880. }
  881.  
  882. public static String capitalizeFirstChar(String s) {
  883. try {
  884. if (s != "")
  885. return (s.substring(0, 1).toUpperCase() + s.substring(1).toLowerCase()).trim();
  886. } catch (Exception e) {
  887. }
  888. return s;
  889. }
  890.  
  891. public void itemSearch(String n) {
  892. if (n == null || n.length() == 0) {
  893. totalItemResults = 0;
  894. return;
  895. }
  896. String searchName = n;
  897. String searchParts[] = new String[100];
  898. int totalResults = 0;
  899.  
  900. do {
  901. int k = searchName.indexOf(" ");
  902. if (k == -1)
  903. break;
  904. String part = searchName.substring(0, k).trim();
  905. if (part.length() > 0)
  906. searchParts[totalResults++] = part.toLowerCase();
  907. searchName = searchName.substring(k + 1);
  908. } while (true);
  909. searchName = searchName.trim();
  910. if (searchName.length() > 0)
  911. searchParts[totalResults++] = searchName.toLowerCase();
  912. totalItemResults = 0;
  913. label0: for (int id = 0; id < ItemDefinition.totalItems; id++) {
  914. ItemDefinition item = ItemDefinition.forID(id);
  915. if (item.certTemplateID != -1 || item.lentItemID != -1 || item.name == null || item.name == "Picture"
  916. || item.certID == 18786 || item.name == "Null" || item.name.toLowerCase().contains("coins")
  917. || item.value <= 0 || item.untradeable)
  918. continue;
  919. String result = item.name.toLowerCase();
  920. for (int idx = 0; idx < totalResults; idx++)
  921. if (result.indexOf(searchParts[idx]) == -1)
  922. continue label0;
  923.  
  924. itemResultNames[totalItemResults] = result;
  925. itemResultIDs[totalItemResults] = id;
  926. totalItemResults++;
  927.  
  928. if (totalItemResults >= itemResultNames.length)
  929. return;
  930. }
  931. }
  932.  
  933. public static String optimizeText(String s) {
  934. for (int i = 0; i < s.length(); i++) {
  935. if (i == 0) {
  936. s = String.format("%s%s", Character.toUpperCase(s.charAt(0)), s.substring(1));
  937. }
  938. if (!Character.isLetterOrDigit(s.charAt(i))) {
  939. if (i + 1 < s.length()) {
  940. s = String.format("%s%s%s", s.subSequence(0, i + 1), Character.toUpperCase(s.charAt(i + 1)),
  941. s.substring(i + 2));
  942. }
  943. }
  944. }
  945. return s.replace("_", " ");
  946. }
  947.  
  948. private void buildItemSearch(int mouseY) {
  949. int y = 0;
  950. for (int idx = 0; idx < 100; idx++) {
  951. if (amountOrNameInput.length() == 0)
  952. return;
  953. else if (totalItemResults == 0)
  954. return;
  955. if (amountOrNameInput == "")
  956. return;
  957. if (itemResultNames[idx] == null)
  958. continue;
  959. String name = capitalizeFirstChar(itemResultNames[idx]);
  960. for (int i = 0; i <= 20; i++)
  961. if (name.contains(" <img=" + i + ">"))
  962. name = name.replaceAll(" <img=" + i + ">", "");
  963. int textY = (21 + y * 14) - itemResultScrollPos;
  964. if (mouseY > textY - 14 && mouseY <= textY && super.mouseX > 74 && super.mouseX < 495) {
  965. menuActionName[menuActionRow] = "" + name;
  966. menuActionID[menuActionRow] = 1251;
  967. menuActionRow++;
  968. }
  969. y++;
  970. }
  971. }
  972.  
  973. public void drawGrandExchange() {
  974. if (openInterfaceID != 24500 && openInterfaceID != 54700 && openInterfaceID != 53700) {
  975. return;
  976. }
  977. if (openInterfaceID == 24500) {
  978. for (int i = 1; i < Slots.length; i++) {
  979. if (Slots[i] == 0) {
  980. drawUpdate(i, "Regular");
  981. }
  982. if (Slots[i] == 1 && slots[i] == "Sell") {
  983. drawUpdate(i, "Submit Sell");
  984. }
  985. if (Slots[i] == 1 && slots[i] == "Buy") {
  986. drawUpdate(i, "Submit Buy");
  987. }
  988. if (Slots[i] == 2 && slots[i] == "Sell") {
  989. drawUpdate(i, "Sell");
  990. }
  991. if (Slots[i] == 2 && slots[i] == "Buy") {
  992. drawUpdate(i, "Buy");
  993. }
  994. if (Slots[i] == 3 && slots[i] == "Sell") {
  995. drawUpdate(i, "Finished Selling");
  996. }
  997. if (Slots[i] == 3 && slots[i] == "Buy") {
  998. drawUpdate(i, "Finished Buying");
  999. }
  1000. }
  1001. }
  1002. int x = 0;
  1003. int y = 0;
  1004. x = (frameMode == ScreenMode.FIXED) ? 71 : (71 + (screenAreaWidth / 2 - 256));
  1005. y = (frameMode == ScreenMode.FIXED) ? 303 : (screenAreaHeight / 2 + 136);
  1006. if (openInterfaceID == 54700) {
  1007. per4 = cacheSprites2[647];
  1008. per5 = cacheSprites2[648];
  1009. per6 = cacheSprites2[649];
  1010. abort2 = cacheSprites2[651];
  1011. if (slotColorPercent[slotSelected] == 100 || slotAborted[slotSelected]) {
  1012. RSInterface.interfaceCache[54800].tooltip = "[GE]";
  1013. } else {
  1014. RSInterface.interfaceCache[54800].tooltip = "Abort offer";
  1015. }
  1016. if (slotSelected <= 6) {
  1017. if (!slotAborted[slotSelected]) {
  1018. for (int k9 = 1; k9 < slotColorPercent[slotSelected]; k9++) {
  1019. if (slotColorPercent[slotSelected] > 0) {
  1020. if (k9 == 1) {
  1021. if (per4 != null)
  1022. per4.drawSprite(x, y);
  1023. x += 3;
  1024. } else if (k9 == 99) {
  1025. if (per6 != null)
  1026. per6.drawSprite(x, y);
  1027. x += 4;
  1028. } else {
  1029. if (per5 != null)
  1030. per5.drawSprite(x, y);
  1031. x += 3;
  1032. }
  1033. }
  1034. }
  1035. } else {
  1036. if (abort2 != null)
  1037. abort2.drawSprite(x, y);
  1038. }
  1039. }
  1040. }
  1041. x = (frameMode == ScreenMode.FIXED) ? 71 : (71 + (screenAreaWidth / 2 - 256));
  1042. y = (frameMode == ScreenMode.FIXED) ? 303 : (screenAreaHeight / 2 + 136);
  1043. if (openInterfaceID == 53700) {
  1044. per4 = cacheSprites2[647];
  1045. per5 = cacheSprites2[648];
  1046. per6 = cacheSprites2[649];
  1047. abort2 = cacheSprites2[651];
  1048. if (slotColorPercent[slotSelected] == 100 || slotAborted[slotSelected]) {
  1049. RSInterface.interfaceCache[53800].tooltip = "[GE]";
  1050. } else {
  1051. RSInterface.interfaceCache[53800].tooltip = "Abort offer";
  1052. }
  1053. if (slotSelected <= 6) {
  1054. if (!slotAborted[slotSelected]) {
  1055. for (int k9 = 1; k9 < slotColorPercent[slotSelected]; k9++) {
  1056. if (slotColorPercent[slotSelected] > 0) {
  1057. if (k9 == 1) {
  1058. if (per4 != null)
  1059. per4.drawSprite(x, y);
  1060. x += 3;
  1061. } else if (k9 == 99) {
  1062. if (per6 != null)
  1063. per6.drawSprite(x, y);
  1064. x += 4;
  1065. } else {
  1066. if (per5 != null)
  1067. per5.drawSprite(x, y);
  1068. x += 3;
  1069. }
  1070. }
  1071. }
  1072. } else {
  1073. if (abort2 != null)
  1074. abort2.drawSprite(x, y);
  1075. }
  1076. }
  1077. }
  1078. }
  1079.  
  1080. public void drawUpdate(int id, String type) {
  1081. int x = 0;
  1082. int y = 0;
  1083. int x2 = 0;
  1084. int y2 = 0;
  1085. int x3 = 0;
  1086. int y3 = 0;
  1087. boolean fixed = (frameMode == ScreenMode.FIXED);
  1088. switch (id) {
  1089. case 1:
  1090. x = fixed ? 30 : (screenAreaWidth / 2 - 226);
  1091. x2 = fixed ? 80 : (screenAreaWidth / 2 - 226 + 50);
  1092. x3 = fixed ? 40 : (screenAreaWidth / 2 - 226 + 10);
  1093. y = fixed ? 74 : (screenAreaHeight / 2 - 93);
  1094. y2 = fixed ? 136 : (screenAreaHeight / 2 - 93 + 62);
  1095. y3 = fixed ? 115 : (screenAreaHeight / 2 - 93 + 41);
  1096. break;
  1097. case 2:
  1098. x = fixed ? 186 : (screenAreaWidth / 2 - 70);
  1099. x2 = fixed ? 80 + 156 : (screenAreaWidth / 2 - 70 + 50);
  1100. x3 = fixed ? 40 + 156 : (screenAreaWidth / 2 - 70 + 10);
  1101. y = fixed ? 74 : (screenAreaHeight / 2 - 93);
  1102. y2 = fixed ? 136 : (screenAreaHeight / 2 - 93 + 62);
  1103. y3 = fixed ? 115 : (screenAreaHeight / 2 - 93 + 41);
  1104. break;
  1105. case 3:
  1106. x = fixed ? 342 : (screenAreaWidth / 2 + 86);
  1107. x2 = fixed ? 80 + 156 + 156 : (screenAreaWidth / 2 + 86 + 50);
  1108. x3 = fixed ? 40 + 156 + 156 : (screenAreaWidth / 2 + 86 + 10);
  1109. y = fixed ? 74 : (screenAreaHeight / 2 - 93);
  1110. y2 = fixed ? 136 : (screenAreaHeight / 2 - 93 + 62);
  1111. y3 = fixed ? 115 : (screenAreaHeight / 2 - 93 + 41);
  1112. break;
  1113. case 4:
  1114. x = fixed ? 30 : (screenAreaWidth / 2 - 226);
  1115. x2 = fixed ? 80 : (screenAreaWidth / 2 - 226 + 50);
  1116. x3 = fixed ? 40 : (screenAreaWidth / 2 - 226 + 10);
  1117. y = fixed ? 194 : (screenAreaHeight / 2 + 27);
  1118. y2 = fixed ? 256 : (screenAreaHeight / 2 + 27 + 62);
  1119. y3 = fixed ? 235 : (screenAreaHeight / 2 + 27 + 41);
  1120. break;
  1121. case 5:
  1122. x = fixed ? 186 : (screenAreaWidth / 2 - 70);
  1123. x2 = fixed ? 80 + 156 : (screenAreaWidth / 2 - 70 + 50);
  1124. x3 = fixed ? 40 + 156 : (screenAreaWidth / 2 - 70 + 10);
  1125. y = fixed ? 194 : (screenAreaHeight / 2 + 27);
  1126. y2 = fixed ? 256 : (screenAreaHeight / 2 + 27 + 62);
  1127. y3 = fixed ? 235 : (screenAreaHeight / 2 + 27 + 41);
  1128. break;
  1129. case 6:
  1130. x = fixed ? 342 : (screenAreaWidth / 2 + 86);
  1131. x2 = fixed ? 80 + 156 + 156 : (screenAreaWidth / 2 + 86 + 50);
  1132. x3 = fixed ? 40 + 156 + 156 : (screenAreaWidth / 2 + 86 + 10);
  1133. y = fixed ? 194 : (screenAreaHeight / 2 + 27);
  1134. y2 = fixed ? 256 : (screenAreaHeight / 2 + 27 + 62);
  1135. y3 = fixed ? 235 : (screenAreaHeight / 2 + 27 + 41);
  1136. break;
  1137. }
  1138. x -= 2;
  1139. x2 -= 2;
  1140. x3 -= 2;
  1141. int minus = 20;
  1142. if (type == "Sell") {
  1143. if (super.mouseX >= x && super.mouseX <= x + 140 && super.mouseY >= y && super.mouseY <= y + 110
  1144. && !menuOpen) {
  1145. SellHover = cacheSprites2[655];
  1146. if (SellHover != null)
  1147. SellHover.drawSprite(x, y);
  1148. } else {
  1149. cacheSprites2[30].drawSprite(x, y);
  1150. }
  1151. cacheSprites2[678].drawSprite(x + 6, y + 30);
  1152. if (slotItems[id] > 0 && ItemDefinition.getSprite(slotItems[id], 1, 0) != null)
  1153. ItemDefinition.getSprite(slotItems[id], 1, 0).drawSprite(x + 9, y + 32);
  1154. drawInterface(0, x + 110, RSInterface.interfaceCache[54000], y + 38);
  1155. setGrandExchange(id, false);
  1156. if (slotAborted[id] || slotColorPercent[id] == 100) {
  1157. changeSet(id, true, false);
  1158. } else {
  1159. changeSet(id, true, true);
  1160. }
  1161. drawPercentage(id);
  1162. smallText.method592(0xCC9900, x2, RSInterface.interfaceCache[32000 + id].message, y2 - minus, true);
  1163. smallText.method592(0xBDBB5B, x2, RSInterface.interfaceCache[33000 + id].message, y2, true);
  1164. smallText.method592(0xFFFF00, x3, RSInterface.interfaceCache[33100 + id].message, y3, true);
  1165. setHovers(id, false);
  1166. if (cacheSprites2[640] != null) {
  1167. cacheSprites2[640].drawSprite(x + 110, y + 39);
  1168. if (mouseInRegion(x + 112, y + 38, x + 132, y + 60)) {
  1169. cacheSprites2[641].drawSprite(x + 110, y + 39);
  1170. changeSet(id, false, true);
  1171. }
  1172. }
  1173. String name[] = optimizeText(ItemDefinition.forID(slotItems[id]).name).split(" ");
  1174. int index = 0;
  1175. for (String n : name) {
  1176. int xDraw = x + 77;
  1177. int yDraw = y + (name.length > 2 ? 41 : 48) + (index * 15);
  1178. smallText.drawCenteredText(0xA05A00, xDraw, n, yDraw, false);
  1179. index++;
  1180. }
  1181. } else if (type == "Buy") {
  1182. if (super.mouseX >= x && super.mouseX <= x + 140 && super.mouseY >= y && super.mouseY <= y + 110
  1183. && !menuOpen) {
  1184. BuyHover = cacheSprites2[654];
  1185. if (BuyHover != null)
  1186. BuyHover.drawSprite(x, y);
  1187. } else {
  1188. cacheSprites2[29].drawSprite(x, y);
  1189. }
  1190. cacheSprites2[678].drawSprite(x + 6, y + 30);
  1191. if (slotItems[id] > 0 && ItemDefinition.getSprite(slotItems[id], 1, 0) != null)
  1192. ItemDefinition.getSprite(slotItems[id], 1, 0).drawSprite(x + 9, y + 32);
  1193. setGrandExchange(id, false);
  1194. if (slotAborted[id] || slotColorPercent[id] == 100) {
  1195. changeSet(id, true, false);
  1196. } else {
  1197. changeSet(id, true, true);
  1198. }
  1199. drawPercentage(id);
  1200. smallText.method592(0xCC9900, x2, RSInterface.interfaceCache[32000 + id].message, y2 - minus, true);
  1201. smallText.method592(0xBDBB5B, x2, RSInterface.interfaceCache[33000 + id].message, y2, true);
  1202. smallText.method592(0xFFFF00, x3, RSInterface.interfaceCache[33100 + id].message, y3, true);
  1203. setHovers(id, false);
  1204. if (cacheSprites2[640] != null) {
  1205. cacheSprites2[640].drawSprite(x + 110, y + 39);
  1206. if (mouseInRegion(x + 112, y + 38, x + 132, y + 60)) {
  1207. cacheSprites2[641].drawSprite(x + 110, y + 39);
  1208. changeSet(id, false, true);
  1209. }
  1210. }
  1211. String name[] = optimizeText(ItemDefinition.forID(slotItems[id]).name).split(" ");
  1212. int index = 0;
  1213. for (String n : name) {
  1214. int xDraw = x + 77;
  1215. int yDraw = y + (name.length > 2 ? 41 : 48) + (index * 15);
  1216. smallText.drawCenteredText(0xA05A00, xDraw, n, yDraw, false);
  1217. index++;
  1218. }
  1219. } else if (type == "Submit Buy") {
  1220. if (super.mouseX >= x && super.mouseX <= x + 140 && super.mouseY >= y && super.mouseY <= y + 110
  1221. && !menuOpen) {
  1222. buySubmitHover = cacheSprites2[656];
  1223. if (buySubmitHover != null)
  1224. buySubmitHover.drawSprite(x, y);
  1225. } else {
  1226. cacheSprites2[27].drawSprite(x, y);
  1227. }
  1228. setGrandExchange(id, false);
  1229. changeSet(id, false, false);
  1230. smallText.method592(0xCC9900, x2, RSInterface.interfaceCache[32000 + id].message, y2 - minus, true);
  1231. smallText.method592(0xBDBB5B, x2, RSInterface.interfaceCache[33000 + id].message, y2, true);
  1232. smallText.method592(0xFFFF00, x3, RSInterface.interfaceCache[33100 + id].message, y3, true);
  1233. setHovers(id, false);
  1234. } else if (type == "Submit Sell") {
  1235. if (super.mouseX >= x && super.mouseX <= x + 140 && super.mouseY >= y && super.mouseY <= y + 110
  1236. && !menuOpen) {
  1237. sellSubmitHover = cacheSprites2[657];
  1238. if (sellSubmitHover != null)
  1239. sellSubmitHover.drawSprite(x, y);
  1240. } else {
  1241. cacheSprites2[28].drawSprite(x, y);
  1242. }
  1243. setGrandExchange(id, false);
  1244. changeSet(id, false, false);
  1245. smallText.method592(0xCC9900, x2, RSInterface.interfaceCache[32000 + id].message, y2 - minus, true);
  1246. smallText.method592(0xBDBB5B, x2, RSInterface.interfaceCache[33000 + id].message, y2, true);
  1247. smallText.method592(0xFFFF00, x3, RSInterface.interfaceCache[33100 + id].message, y3, true);
  1248. setHovers(id, false);
  1249. } else if (type == "Regular") {
  1250. setGrandExchange(id, true);
  1251. setHovers(id, true);
  1252.  
  1253. } else if (type == "Finished Selling") {
  1254. if (super.mouseX >= x && super.mouseX <= x + 140 && super.mouseY >= y && super.mouseY <= y + 110
  1255. && !menuOpen) {
  1256. SellHover = cacheSprites2[655];
  1257. if (SellHover != null)
  1258. SellHover.drawSprite(x, y);
  1259. } else {
  1260. cacheSprites2[30].drawSprite(x, y);
  1261. }
  1262. cacheSprites2[678].drawSprite(x + 6, y + 30);
  1263. if (slotItems[id] > 0 && ItemDefinition.getSprite(slotItems[id], 1, 0) != null)
  1264. ItemDefinition.getSprite(slotItems[id], 1, 0).drawSprite(x + 9, y + 32);
  1265. drawInterface(0, x + 110, RSInterface.interfaceCache[54000], y + 38);
  1266. setGrandExchange(id, false);
  1267. changeSet(id, true, false);
  1268. drawPercentage(id);
  1269. smallText.method592(0xCC9900, x2, RSInterface.interfaceCache[32000 + id].message, y2 - minus, true);
  1270. smallText.method592(0xBDBB5B, x2, RSInterface.interfaceCache[33000 + id].message, y2, true);
  1271. smallText.method592(0xFFFF00, x3, RSInterface.interfaceCache[33100 + id].message, y3, true);
  1272. setHovers(id, false);
  1273. if (cacheSprites2[640] != null) {
  1274. cacheSprites2[640].drawSprite(x + 110, y + 39);
  1275. if (mouseInRegion(x + 112, y + 38, x + 132, y + 60)) {
  1276. cacheSprites2[641].drawSprite(x + 110, y + 39);
  1277. changeSet(id, false, true);
  1278. }
  1279. }
  1280. String name[] = optimizeText(ItemDefinition.forID(slotItems[id]).name).split(" ");
  1281. int index = 0;
  1282. for (String n : name) {
  1283. int xDraw = x + 77;
  1284. int yDraw = y + (name.length > 2 ? 41 : 48) + (index * 15);
  1285. smallText.drawCenteredText(0xA05A00, xDraw, n, yDraw, false);
  1286. index++;
  1287. }
  1288. } else if (type == "Finished Buying") {
  1289. if (super.mouseX >= x && super.mouseX <= x + 140 && super.mouseY >= y && super.mouseY <= y + 110
  1290. && !menuOpen) {
  1291. BuyHover = cacheSprites2[656];
  1292. if (BuyHover != null)
  1293. BuyHover.drawSprite(x, y);
  1294. } else {
  1295. cacheSprites2[29].drawSprite(x, y);
  1296. }
  1297. cacheSprites2[678].drawSprite(x + 6, y + 30);
  1298. ItemDefinition.getSprite(slotItems[id], 1, 0).drawSprite(x + 9, y + 32);
  1299. drawInterface(0, x + 110, RSInterface.interfaceCache[54000], y + 38);
  1300. setGrandExchange(id, false);
  1301. changeSet(id, true, false);
  1302. drawPercentage(id);
  1303. smallText.method592(0xCC9900, x2, RSInterface.interfaceCache[32000 + id].message, y2 - minus, true);
  1304. smallText.method592(0xBDBB5B, x2, RSInterface.interfaceCache[33000 + id].message, y2, true);
  1305. smallText.method592(0xFFFF00, x3, RSInterface.interfaceCache[33100 + id].message, y3, true);
  1306. setHovers(id, false);
  1307. if (cacheSprites2[640] != null) {
  1308. cacheSprites2[640].drawSprite(x + 110, y + 39);
  1309. if (mouseInRegion(x + 112, y + 38, x + 132, y + 60)) {
  1310. cacheSprites2[641].drawSprite(x + 110, y + 39);
  1311. changeSet(id, false, true);
  1312. }
  1313. }
  1314. String name[] = optimizeText(ItemDefinition.forID(slotItems[id]).name).split(" ");
  1315. int index = 0;
  1316. for (String n : name) {
  1317. int xDraw = x + 77;
  1318. int yDraw = y + (name.length > 2 ? 41 : 48) + (index * 15);
  1319. smallText.drawCenteredText(0xA05A00, xDraw, n, yDraw, false);
  1320. index++;
  1321. }
  1322. }
  1323. }
  1324.  
  1325. public void drawPercentage(int id) {
  1326. per0 = cacheSprites2[643];
  1327. per1 = cacheSprites2[644];
  1328. per2 = cacheSprites2[645];
  1329. per3 = cacheSprites2[646];
  1330. abort1 = cacheSprites2[650];
  1331. int x = 0;
  1332. int y = 0;
  1333. boolean fixed = (frameMode == ScreenMode.FIXED);
  1334. switch (id) {
  1335. case 1:
  1336. x = fixed ? 30 + 8 : (screenAreaWidth / 2 - 226 + 8);
  1337. y = fixed ? 74 + 81 : (screenAreaHeight / 2 - 93 + 81);
  1338. break;
  1339. case 2:
  1340. x = fixed ? 186 + 8 : (screenAreaWidth / 2 - 70 + 8);
  1341. y = fixed ? 74 + 81 : (screenAreaHeight / 2 - 93 + 81);
  1342. break;
  1343. case 3:
  1344. x = fixed ? 342 + 8 : (screenAreaWidth / 2 + 86 + 8);
  1345. y = fixed ? 74 + 81 : (screenAreaHeight / 2 - 93 + 81);
  1346. break;
  1347. case 4:
  1348. x = fixed ? 30 + 8 : (screenAreaWidth / 2 - 226 + 8);
  1349. y = fixed ? 194 + 81 : (screenAreaHeight / 2 + 27 + 81);
  1350. break;
  1351. case 5:
  1352. x = fixed ? 186 + 8 : (screenAreaWidth / 2 - 70 + 8);
  1353. y = fixed ? 194 + 81 : (screenAreaHeight / 2 + 27 + 81);
  1354. break;
  1355. case 6:
  1356. x = fixed ? 342 + 8 : (screenAreaWidth / 2 + 86 + 8);
  1357. y = fixed ? 194 + 81 : (screenAreaHeight / 2 + 27 + 81);
  1358. break;
  1359. }
  1360. x -= 2;
  1361. if (slotColorPercent[id] > 100) {
  1362. slotColorPercent[id] = 100;
  1363. }
  1364. int s = 0;
  1365. if (!slotAborted[id]) {
  1366. for (int k9 = 1; k9 < slotColorPercent[id]; k9++) {
  1367. if (slotColorPercent[id] > 0) {
  1368. if (k9 == 1) {
  1369. if (per0 != null)
  1370. per0.drawSprite(x, y);
  1371. x += 2;
  1372. } else if (k9 == 2) {
  1373. if (per1 != null)
  1374. per1.drawSprite(x, y);
  1375. x += 2;
  1376. } else if (k9 >= 6 && k9 <= 14) {
  1377. if (per3 != null)
  1378. per3.drawSprite(x, y);
  1379. x += 1;
  1380. } else if (k9 >= 56 && k9 <= 65) {
  1381. if (per3 != null)
  1382. per3.drawSprite(x, y);
  1383. x += 1;
  1384. } else if (k9 >= 76 && k9 <= 82) {
  1385. if (per3 != null)
  1386. per3.drawSprite(x, y);
  1387. x += 1;
  1388. } else {
  1389. if (s == 0) {
  1390. if (per2 != null)
  1391. per2.drawSprite(x, y);
  1392. x += 2;
  1393. s += 1;
  1394. } else if (s == 1) {
  1395. if (per3 != null)
  1396. per3.drawSprite(x, y);
  1397. x += 1;
  1398. s += 1;
  1399. } else if (s == 2) {
  1400. if (per3 != null)
  1401. per3.drawSprite(x, y);
  1402. x += 1;
  1403. s = 0;
  1404. } else if (s == 4) {
  1405. if (per3 != null)
  1406. per3.drawSprite(x, y);
  1407. x += 1;
  1408. s = 0;
  1409. }
  1410. }
  1411. }
  1412. }
  1413. } else {
  1414. if (abort1 != null)
  1415. abort1.drawSprite(x, y);
  1416. }
  1417. }
  1418.  
  1419. public void setHovers(int id, boolean on) {
  1420. switch (id) {
  1421. case 1:
  1422. if (!on) {
  1423. } else {
  1424. }
  1425. break;
  1426. case 2:
  1427. if (!on) {
  1428. } else {
  1429. }
  1430. break;
  1431. case 3:
  1432. if (!on) {
  1433. } else {
  1434. }
  1435. break;
  1436. case 4:
  1437. if (!on) {
  1438. } else {
  1439. }
  1440. break;
  1441. case 5:
  1442. if (!on) {
  1443. } else {
  1444. }
  1445. break;
  1446. case 6:
  1447. if (!on) {
  1448. } else {
  1449. }
  1450. break;
  1451. }
  1452. }
  1453.  
  1454. public void setGrandExchange(int id, boolean on) {
  1455. switch (id) {
  1456. case 1:
  1457. if (on) {
  1458. RSInterface.interfaceCache[24505].tooltip = "Buy";
  1459. RSInterface.interfaceCache[24511].tooltip = "Sell";
  1460. changeSet(id, false, false);
  1461. } else {
  1462. RSInterface.interfaceCache[24505].tooltip = "[GE]";
  1463. RSInterface.interfaceCache[24511].tooltip = "[GE]";
  1464. }
  1465. break;
  1466. case 2:
  1467. if (on) {
  1468. RSInterface.interfaceCache[24523].tooltip = "Buy";
  1469. RSInterface.interfaceCache[24526].tooltip = "Sell";
  1470. changeSet(id, false, false);
  1471. } else {
  1472. RSInterface.interfaceCache[24523].tooltip = "[GE]";
  1473. RSInterface.interfaceCache[24526].tooltip = "[GE]";
  1474. }
  1475. break;
  1476. case 3:
  1477. if (on) {
  1478. RSInterface.interfaceCache[24514].tooltip = "Buy";
  1479. RSInterface.interfaceCache[24529].tooltip = "Sell";
  1480. changeSet(id, false, false);
  1481. } else {
  1482. RSInterface.interfaceCache[24514].tooltip = "[GE]";
  1483. RSInterface.interfaceCache[24529].tooltip = "[GE]";
  1484. }
  1485. break;
  1486. case 4:
  1487. if (on) {
  1488. RSInterface.interfaceCache[24508].tooltip = "Buy";
  1489. RSInterface.interfaceCache[24532].tooltip = "Sell";
  1490. changeSet(id, false, false);
  1491. } else {
  1492. RSInterface.interfaceCache[24508].tooltip = "[GE]";
  1493. RSInterface.interfaceCache[24532].tooltip = "[GE]";
  1494. }
  1495. break;
  1496. case 5:
  1497. if (on) {
  1498. RSInterface.interfaceCache[24517].tooltip = "Buy";
  1499. RSInterface.interfaceCache[24535].tooltip = "Sell";
  1500. changeSet(id, false, false);
  1501. } else {
  1502. RSInterface.interfaceCache[24517].tooltip = "[GE]";
  1503. RSInterface.interfaceCache[24535].tooltip = "[GE]";
  1504. }
  1505. break;
  1506. case 6:
  1507. if (on) {
  1508. RSInterface.interfaceCache[24520].tooltip = "Buy";
  1509. RSInterface.interfaceCache[24538].tooltip = "Sell";
  1510. changeSet(id, false, false);
  1511. } else {
  1512. RSInterface.interfaceCache[24520].tooltip = "[GE]";
  1513. RSInterface.interfaceCache[24538].tooltip = "[GE]";
  1514. }
  1515. break;
  1516. }
  1517. }
  1518.  
  1519. public void changeSet(int id, boolean view, boolean abort) {
  1520. switch (id) {
  1521. case 1:
  1522. if (view) {
  1523. RSInterface.interfaceCache[24543].tooltip = "View offer";
  1524. } else {
  1525. RSInterface.interfaceCache[24543].tooltip = "[GE]";
  1526. }
  1527. if (abort) {
  1528. RSInterface.interfaceCache[24541].tooltip = "Abort offer";
  1529. } else {
  1530. RSInterface.interfaceCache[24541].tooltip = "[GE]";
  1531. }
  1532. break;
  1533. case 2:
  1534. if (view) {
  1535. RSInterface.interfaceCache[24547].tooltip = "View offer";
  1536. } else {
  1537. RSInterface.interfaceCache[24547].tooltip = "[GE]";
  1538. }
  1539. if (abort) {
  1540. RSInterface.interfaceCache[24545].tooltip = "Abort offer";
  1541. } else {
  1542. RSInterface.interfaceCache[24545].tooltip = "[GE]";
  1543. }
  1544. break;
  1545. case 3:
  1546. if (view) {
  1547. RSInterface.interfaceCache[24551].tooltip = "View offer";
  1548. } else {
  1549. RSInterface.interfaceCache[24551].tooltip = "[GE]";
  1550. }
  1551. if (abort) {
  1552. RSInterface.interfaceCache[24549].tooltip = "Abort offer";
  1553. } else {
  1554. RSInterface.interfaceCache[24549].tooltip = "[GE]";
  1555. }
  1556. break;
  1557. case 4:
  1558. if (view) {
  1559. RSInterface.interfaceCache[24555].tooltip = "View offer";
  1560. } else {
  1561. RSInterface.interfaceCache[24555].tooltip = "[GE]";
  1562. }
  1563. if (abort) {
  1564. RSInterface.interfaceCache[24553].tooltip = "Abort offer";
  1565. } else {
  1566. RSInterface.interfaceCache[24553].tooltip = "[GE]";
  1567. }
  1568. break;
  1569. case 5:
  1570. if (view) {
  1571. RSInterface.interfaceCache[24559].tooltip = "View offer";
  1572. } else {
  1573. RSInterface.interfaceCache[24559].tooltip = "[GE]";
  1574. }
  1575. if (abort) {
  1576. RSInterface.interfaceCache[24557].tooltip = "Abort offer";
  1577. } else {
  1578. RSInterface.interfaceCache[24557].tooltip = "[GE]";
  1579. }
  1580. break;
  1581. case 6:
  1582. if (view) {
  1583. RSInterface.interfaceCache[24563].tooltip = "View offer";
  1584. } else {
  1585. RSInterface.interfaceCache[24563].tooltip = "[GE]";
  1586. }
  1587. if (abort) {
  1588. RSInterface.interfaceCache[24561].tooltip = "Abort offer";
  1589. } else {
  1590. RSInterface.interfaceCache[24561].tooltip = "[GE]";
  1591. }
  1592. break;
  1593. }
  1594. }
  1595.  
  1596. public boolean isRecruit(String name) {
  1597. name = name.toLowerCase();
  1598. if (Recruits.contains(" " + name + ",")) {
  1599. return true;
  1600. }
  1601. if (Recruits.contains(", " + name + "]")) {
  1602. return true;
  1603. }
  1604. if (Recruits.contains("[" + name + ",")) {
  1605. return true;
  1606. }
  1607. if (Recruits.contains("[" + name + "]")) {
  1608. return true;
  1609. }
  1610. return false;
  1611. }
  1612.  
  1613. public boolean isCorporal(String name) {
  1614. name = name.toLowerCase();
  1615. if (Corporals.contains(" " + name + ",")) {
  1616. return true;
  1617. }
  1618. if (Corporals.contains(", " + name + "]")) {
  1619. return true;
  1620. }
  1621. if (Corporals.contains("[" + name + ",")) {
  1622. return true;
  1623. }
  1624. if (Corporals.contains("[" + name + "]")) {
  1625. return true;
  1626. }
  1627. return false;
  1628. }
  1629.  
  1630. public boolean isSergeant(String name) {
  1631. name = name.toLowerCase();
  1632. if (Sergeants.contains(" " + name + ",")) {
  1633. return true;
  1634. }
  1635. if (Sergeants.contains(", " + name + "]")) {
  1636. return true;
  1637. }
  1638. if (Sergeants.contains("[" + name + ",")) {
  1639. return true;
  1640. }
  1641. if (Sergeants.contains("[" + name + "]")) {
  1642. return true;
  1643. }
  1644. return false;
  1645. }
  1646.  
  1647. public boolean isLieutenant(String name) {
  1648. name = name.toLowerCase();
  1649. if (Lieutenants.contains(" " + name + ",")) {
  1650. return true;
  1651. }
  1652. if (Lieutenants.contains(", " + name + "]")) {
  1653. return true;
  1654. }
  1655. if (Lieutenants.contains("[" + name + ",")) {
  1656. return true;
  1657. }
  1658. if (Lieutenants.contains("[" + name + "]")) {
  1659. return true;
  1660. }
  1661. return false;
  1662. }
  1663.  
  1664. public boolean isCaptain(String name) {
  1665. name = name.toLowerCase();
  1666. if (Captains.contains(" " + name + ",")) {
  1667. return true;
  1668. }
  1669. if (Captains.contains(", " + name + "]")) {
  1670. return true;
  1671. }
  1672. if (Captains.contains("[" + name + ",")) {
  1673. return true;
  1674. }
  1675. if (Captains.contains("[" + name + "]")) {
  1676. return true;
  1677. }
  1678. return false;
  1679. }
  1680.  
  1681. public boolean isGeneral(String name) {
  1682. name = name.toLowerCase();
  1683. if (Generals.contains(" " + name + ",")) {
  1684. return true;
  1685. }
  1686. if (Generals.contains(", " + name + "]")) {
  1687. return true;
  1688. }
  1689. if (Generals.contains("[" + name + ",")) {
  1690. return true;
  1691. }
  1692. if (Generals.contains("[" + name + "]")) {
  1693. return true;
  1694. }
  1695. return false;
  1696. }
  1697.  
  1698. void sendPacket(int packet) {
  1699. if (packet == 103) {
  1700. stream.createFrame(103);
  1701. stream.writeByte(inputString.length() - 1);
  1702. stream.writeString(inputString.substring(2));
  1703. inputString = "";
  1704. promptInput = "";
  1705. interfaceButtonAction = 0;
  1706. }
  1707. if (packet == 1003) {
  1708. stream.createFrame(103);
  1709. inputString = "::" + inputString;
  1710. stream.writeByte(inputString.length() - 1);
  1711. stream.writeString(inputString.substring(2));
  1712. inputString = "";
  1713. promptInput = "";
  1714. interfaceButtonAction = 0;
  1715. }
  1716. }
  1717.  
  1718. private int showClanOptions;
  1719.  
  1720. private void updateClanChatTab() {
  1721. RSInterface.rebuildClanChatList(showClanOptions);
  1722. }
  1723.  
  1724. public void init() {
  1725. try {
  1726. nodeID = 10;
  1727. portOff = 0;
  1728. setHighMemAndReadUUID();
  1729. isMembers = true;
  1730. Signlink.storeid = 32;
  1731. Signlink.startpriv(InetAddress.getLocalHost());
  1732. initClientFrame(frameWidth, frameHeight);
  1733. instance = this;
  1734. } catch (Exception exception) {
  1735. return;
  1736. }
  1737. }
  1738.  
  1739. public void startRunnable(Runnable runnable, int i) {
  1740. if (i > 10)
  1741. i = 10;
  1742. if (Signlink.mainapp != null) {
  1743. Signlink.startthread(runnable, i);
  1744. } else {
  1745. super.startRunnable(runnable, i);
  1746. }
  1747. }
  1748.  
  1749. public Socket openSocket(int port) throws IOException {
  1750. World world = getCurrentWorld();
  1751. return new Socket(InetAddress.getByName(world.getAddress()), world.getPort());
  1752. }
  1753.  
  1754. private void processMenuClick() {
  1755. if (activeInterfaceType != 0)
  1756. return;
  1757. int j = super.clickMode3;
  1758. if (spellSelected == 1 && super.saveClickX >= 516 && super.saveClickY >= 160 && super.saveClickX <= 765
  1759. && super.saveClickY <= 205)
  1760. j = 0;
  1761. if (menuOpen) {
  1762. if (j != 1) {
  1763. int k = super.mouseX;
  1764. int j1 = super.mouseY;
  1765. if (menuScreenArea == 0) {
  1766. k -= 4;
  1767. j1 -= 4;
  1768. }
  1769. if (menuScreenArea == 1) {
  1770. k -= 519;
  1771. j1 -= 168;
  1772. }
  1773. if (menuScreenArea == 2) {
  1774. k -= 17;
  1775. j1 -= 338;
  1776. }
  1777. if (menuScreenArea == 3) {
  1778. k -= 519;
  1779. j1 -= 0;
  1780. }
  1781. if (k < menuOffsetX - 10 || k > menuOffsetX + menuWidth + 10 || j1 < menuOffsetY - 10
  1782. || j1 > menuOffsetY + menuHeight + 10) {
  1783. menuOpen = false;
  1784. if (menuScreenArea == 1) {
  1785. }
  1786. if (menuScreenArea == 2)
  1787. inputTaken = true;
  1788. }
  1789. }
  1790. if (j == 1) {
  1791. int l = menuOffsetX;
  1792. int k1 = menuOffsetY;
  1793. int i2 = menuWidth;
  1794. int k2 = super.saveClickX;
  1795. int l2 = super.saveClickY;
  1796. switch (menuScreenArea) {
  1797. case 0:
  1798. k2 -= 4;
  1799. l2 -= 4;
  1800. break;
  1801. case 1:
  1802. k2 -= 519;
  1803. l2 -= 168;
  1804. break;
  1805. case 2:
  1806. k2 -= 5;
  1807. l2 -= 338;
  1808. break;
  1809. case 3:
  1810. k2 -= 519;
  1811. l2 -= 0;
  1812. break;
  1813. }
  1814. int i3 = -1;
  1815. for (int j3 = 0; j3 < menuActionRow; j3++) {
  1816. int k3 = k1 + 31 + (menuActionRow - 1 - j3) * 15;
  1817. if (k2 > l && k2 < l + i2 && l2 > k3 - 13 && l2 < k3 + 3)
  1818. i3 = j3;
  1819. }
  1820. if (i3 != -1)
  1821. doAction(i3);
  1822. menuOpen = false;
  1823. if (menuScreenArea == 1) {
  1824. }
  1825. if (menuScreenArea == 2) {
  1826. inputTaken = true;
  1827. }
  1828. }
  1829. } else {
  1830. if (j == 1 && menuActionRow > 0) {
  1831. int i1 = menuActionID[menuActionRow - 1];
  1832. if (i1 == 632 || i1 == 78 || i1 == 867 || i1 == 431 || i1 == 53 || i1 == 74 || i1 == 454 || i1 == 539
  1833. || i1 == 493 || i1 == 847 || i1 == 447 || i1 == 1125) {
  1834. int l1 = menuActionCmd2[menuActionRow - 1];
  1835. int j2 = menuActionCmd3[menuActionRow - 1];
  1836. RSInterface class9 = RSInterface.interfaceCache[j2];
  1837. if (class9.aBoolean259 || class9.aBoolean235) {
  1838. aBoolean1242 = false;
  1839. anInt989 = 0;
  1840. anInt1084 = j2;
  1841. anInt1085 = l1;
  1842. activeInterfaceType = 2;
  1843. anInt1087 = super.saveClickX;
  1844. anInt1088 = super.saveClickY;
  1845. if (RSInterface.interfaceCache[j2].parentID == openInterfaceID)
  1846. activeInterfaceType = 1;
  1847. if (RSInterface.interfaceCache[j2].parentID == backDialogID)
  1848. activeInterfaceType = 3;
  1849. return;
  1850. }
  1851. }
  1852. }
  1853. if (j == 1 && (anInt1253 == 1 || menuHasAddFriend(menuActionRow - 1)) && menuActionRow > 2)
  1854. j = 2;
  1855. if (j == 1 && menuActionRow > 0)
  1856. doAction(menuActionRow - 1);
  1857. if (j == 2 && menuActionRow > 0)
  1858. determineMenuSize();
  1859. processMainScreenClick();
  1860. gameframe.processTabAreaClick();
  1861. }
  1862. }
  1863.  
  1864. public static String getFileNameWithoutExtension(String fileName) {
  1865. File tmpFile = new File(fileName);
  1866. tmpFile.getName();
  1867. int whereDot = tmpFile.getName().lastIndexOf('.');
  1868. if (0 < whereDot && whereDot <= tmpFile.getName().length() - 2) {
  1869. return tmpFile.getName().substring(0, whereDot);
  1870. }
  1871. return "";
  1872. }
  1873.  
  1874. private void saveMidi(boolean flag, byte abyte0[]) {
  1875. Signlink.midifade = flag ? 1 : 0;
  1876. Signlink.midisave(abyte0, abyte0.length);
  1877. }
  1878.  
  1879. public void loadObjectsForRegion() {
  1880. GameObjectSpawns.load();
  1881. for (GameObject o : GameObjectSpawns.getObjects()) {
  1882. addObject(o.getX(), o.getY(), o.getId(), o.getRotation(), o.getType(), o.getZ());
  1883. }
  1884. }
  1885.  
  1886. public void addObject(int x, int y, int objectId, int face, int type, int height) {
  1887. int mX = mapX - 6;
  1888. int mY = mapY - 6;
  1889. int x2 = x - (mX * 8);
  1890. int y2 = y - (mY * 8);
  1891. int i15 = 40 >> 2;
  1892. int l17 = anIntArray1177[i15];
  1893. if (y2 > 0 && y2 < 103 && x2 > 0 && x2 < 103) {
  1894. requestObject(-1, objectId, face, l17, y2, type, height, x2, 0);
  1895. }
  1896. }
  1897.  
  1898. private void method22() {
  1899. try {
  1900. anInt985 = -1;
  1901. aClass19_1056.removeAll();
  1902. aClass19_1013.removeAll();
  1903. Texture.method366();
  1904. unlinkMRUNodes();
  1905. worldController.initToNull();
  1906. System.gc();
  1907. for (int i = 0; i < 4; i++)
  1908. aClass11Array1230[i].method210();
  1909. for (int l = 0; l < 4; l++) {
  1910. for (int k1 = 0; k1 < 104; k1++) {
  1911. for (int j2 = 0; j2 < 104; j2++)
  1912. byteGroundArray[l][k1][j2] = 0;
  1913. }
  1914. }
  1915.  
  1916. ObjectManager objectManager = new ObjectManager(byteGroundArray, intGroundArray);
  1917. loadObjectsForRegion();
  1918. int k2 = aByteArrayArray1183.length;
  1919. stream.createFrame(0);
  1920. if (!aBoolean1159) {
  1921. for (int i3 = 0; i3 < k2; i3++) {
  1922. int i4 = (anIntArray1234[i3] >> 8) * 64 - baseX;
  1923. int k5 = (anIntArray1234[i3] & 0xff) * 64 - baseY;
  1924. byte abyte0[] = aByteArrayArray1183[i3];
  1925. if (abyte0 != null)
  1926. objectManager.method180(abyte0, k5, i4, (anInt1069 - 6) * 8, (anInt1070 - 6) * 8,
  1927. aClass11Array1230);
  1928. }
  1929. for (int j4 = 0; j4 < k2; j4++) {
  1930. int l5 = (anIntArray1234[j4] >> 8) * 64 - baseX;
  1931. int k7 = (anIntArray1234[j4] & 0xff) * 64 - baseY;
  1932. byte abyte2[] = aByteArrayArray1183[j4];
  1933. if (abyte2 == null && anInt1070 < 800)
  1934. objectManager.method174(k7, 64, 64, l5);
  1935. }
  1936. anInt1097++;
  1937. if (anInt1097 > 160) {
  1938. anInt1097 = 0;
  1939. stream.createFrame(238);
  1940. stream.writeByte(96);
  1941. }
  1942. stream.createFrame(0);
  1943. for (int i6 = 0; i6 < k2; i6++) {
  1944. byte abyte1[] = aByteArrayArray1247[i6];
  1945. if (abyte1 != null) {
  1946. int l8 = (anIntArray1234[i6] >> 8) * 64 - baseX;
  1947. int k9 = (anIntArray1234[i6] & 0xff) * 64 - baseY;
  1948. objectManager.method190(l8, aClass11Array1230, k9, worldController, abyte1);
  1949. }
  1950. }
  1951.  
  1952. /*
  1953. * for (GameObject object : GameObjects.getAll()) {
  1954. * addObject(object.getX(), object.getY(), object.getId(),
  1955. * object.getOrientation(), object.getType(), object.getZ()); }
  1956. */
  1957. }
  1958. if (aBoolean1159) {
  1959. for (int j3 = 0; j3 < 4; j3++) {
  1960. for (int k4 = 0; k4 < 13; k4++) {
  1961. for (int j6 = 0; j6 < 13; j6++) {
  1962. int l7 = anIntArrayArrayArray1129[j3][k4][j6];
  1963. if (l7 != -1) {
  1964. int i9 = l7 >> 24 & 3;
  1965. int l9 = l7 >> 1 & 3;
  1966. int j10 = l7 >> 14 & 0x3ff;
  1967. int l10 = l7 >> 3 & 0x7ff;
  1968. int j11 = (j10 / 8 << 8) + l10 / 8;
  1969. for (int l11 = 0; l11 < anIntArray1234.length; l11++) {
  1970. if (anIntArray1234[l11] != j11 || aByteArrayArray1183[l11] == null)
  1971. continue;
  1972. objectManager.method179(i9, l9, aClass11Array1230, k4 * 8, (j10 & 7) * 8,
  1973. aByteArrayArray1183[l11], (l10 & 7) * 8, j3, j6 * 8);
  1974. break;
  1975. }
  1976.  
  1977. }
  1978. }
  1979. }
  1980. }
  1981. for (int l4 = 0; l4 < 13; l4++) {
  1982. for (int k6 = 0; k6 < 13; k6++) {
  1983. int i8 = anIntArrayArrayArray1129[0][l4][k6];
  1984. if (i8 == -1)
  1985. objectManager.method174(k6 * 8, 8, 8, l4 * 8);
  1986. }
  1987. }
  1988.  
  1989. stream.createFrame(0);
  1990. for (int l6 = 0; l6 < 4; l6++) {
  1991. for (int j8 = 0; j8 < 13; j8++) {
  1992. for (int j9 = 0; j9 < 13; j9++) {
  1993. int i10 = anIntArrayArrayArray1129[l6][j8][j9];
  1994. if (i10 != -1) {
  1995. int k10 = i10 >> 24 & 3;
  1996. int i11 = i10 >> 1 & 3;
  1997. int k11 = i10 >> 14 & 0x3ff;
  1998. int i12 = i10 >> 3 & 0x7ff;
  1999. int j12 = (k11 / 8 << 8) + i12 / 8;
  2000. for (int k12 = 0; k12 < anIntArray1234.length; k12++) {
  2001. if (anIntArray1234[k12] != j12 || aByteArrayArray1247[k12] == null)
  2002. continue;
  2003. objectManager.method183(aClass11Array1230, worldController, k10, j8 * 8,
  2004. (i12 & 7) * 8, l6, aByteArrayArray1247[k12], (k11 & 7) * 8, i11, j9 * 8);
  2005. break;
  2006. }
  2007.  
  2008. }
  2009. }
  2010.  
  2011. }
  2012.  
  2013. }
  2014.  
  2015. }
  2016. stream.createFrame(0);
  2017. objectManager.method171(aClass11Array1230, worldController);
  2018. aRSImageProducer_1165.initDrawingArea();
  2019. stream.createFrame(0);
  2020. int k3 = ObjectManager.anInt145;
  2021. if (k3 > plane)
  2022. k3 = plane;
  2023. if (k3 < plane - 1)
  2024. k3 = plane - 1;
  2025. if (lowMem)
  2026. worldController.method275(ObjectManager.anInt145);
  2027. else
  2028. worldController.method275(0);
  2029. for (int i5 = 0; i5 < 104; i5++) {
  2030. for (int i7 = 0; i7 < 104; i7++)
  2031. spawnGroundItem(i5, i7);
  2032.  
  2033. }
  2034.  
  2035. anInt1051++;
  2036. if (anInt1051 > 98) {
  2037. anInt1051 = 0;
  2038. stream.createFrame(150);
  2039. }
  2040. method63();
  2041. } catch (Exception exception) {
  2042. exception.printStackTrace();
  2043. }
  2044. ObjectDefinition.mruNodes1.unlinkAll();
  2045.  
  2046. if (ClientUI.getInstance() != null) {
  2047. stream.createFrame(210);
  2048. stream.writeDWord(0x3f008edd);
  2049. }
  2050.  
  2051. if (lowMem && Signlink.cache_dat != null) {
  2052. int j = onDemandFetcher.getVersionCount(0);
  2053. for (int i1 = 0; i1 < j; i1++) {
  2054. int l1 = onDemandFetcher.getModelIndex(i1);
  2055. if ((l1 & 0x79) == 0)
  2056. Model.method461(i1);
  2057. }
  2058.  
  2059. }
  2060. System.gc();
  2061. Texture.method367(20);
  2062. onDemandFetcher.method566();
  2063. int k = (anInt1069 - 6) / 8 - 1;
  2064. int j1 = (anInt1069 + 6) / 8 + 1;
  2065. int i2 = (anInt1070 - 6) / 8 - 1;
  2066. int l2 = (anInt1070 + 6) / 8 + 1;
  2067. if (aBoolean1141) {
  2068. k = 49;
  2069. j1 = 50;
  2070. i2 = 49;
  2071. l2 = 50;
  2072. }
  2073. for (int l3 = k; l3 <= j1; l3++) {
  2074. for (int j5 = i2; j5 <= l2; j5++)
  2075. if (l3 == k || l3 == j1 || j5 == i2 || j5 == l2) {
  2076. int j7 = onDemandFetcher.method562(0, j5, l3);
  2077. if (j7 != -1)
  2078. onDemandFetcher.method560(j7, 3);
  2079. int k8 = onDemandFetcher.method562(1, j5, l3);
  2080. if (k8 != -1)
  2081. onDemandFetcher.method560(k8, 3);
  2082. }
  2083.  
  2084. }
  2085.  
  2086. }
  2087.  
  2088. public static AbstractMap.SimpleEntry<Integer, Integer> getNextInteger(ArrayList<Integer> values) {
  2089. ArrayList<AbstractMap.SimpleEntry<Integer, Integer>> frequencies = new ArrayList<>();
  2090. int maxIndex = 0;
  2091. main: for (int i = 0; i < values.size(); ++i) {
  2092. int value = values.get(i);
  2093. for (int j = 0; j < frequencies.size(); ++j) {
  2094. if (frequencies.get(j).getKey() == value) {
  2095. frequencies.get(j).setValue(frequencies.get(j).getValue() + 1);
  2096. if (frequencies.get(maxIndex).getValue() < frequencies.get(j).getValue()) {
  2097. maxIndex = j;
  2098. }
  2099. continue main;
  2100. }
  2101. }
  2102. frequencies.add(new AbstractMap.SimpleEntry<Integer, Integer>(value, 1));
  2103. }
  2104. return frequencies.get(maxIndex);
  2105. }
  2106.  
  2107. private void unlinkMRUNodes() {
  2108. ObjectDefinition.mruNodes1.unlinkAll();
  2109. ObjectDefinition.mruNodes2.unlinkAll();
  2110. NpcDefinition.mruNodes.unlinkAll();
  2111. ItemDefinition.mruNodes2.unlinkAll();
  2112. ItemDefinition.mruNodes1.unlinkAll();
  2113. Player.mruNodes.unlinkAll();
  2114. SpotAnim.aMRUNodes_415.unlinkAll();
  2115. }
  2116.  
  2117. private void method24(int i) {
  2118. int ai[] = minimapImage.myPixels;
  2119. int j = ai.length;
  2120. for (int k = 0; k < j; k++)
  2121. ai[k] = 0;
  2122.  
  2123. for (int l = 1; l < 103; l++) {
  2124. int i1 = 24628 + (103 - l) * 512 * 4;
  2125. for (int k1 = 1; k1 < 103; k1++) {
  2126. if ((byteGroundArray[i][k1][l] & 0x18) == 0)
  2127. worldController.method309(ai, i1, i, k1, l);
  2128. if (i < 3 && (byteGroundArray[i + 1][k1][l] & 8) != 0)
  2129. worldController.method309(ai, i1, i + 1, k1, l);
  2130. i1 += 4;
  2131. }
  2132.  
  2133. }
  2134.  
  2135. int j1 = 0xFFFFFF;
  2136. int l1 = 0xEE0000;
  2137. minimapImage.method343();
  2138. for (int i2 = 1; i2 < 103; i2++) {
  2139. for (int j2 = 1; j2 < 103; j2++) {
  2140. if ((byteGroundArray[i][j2][i2] & 0x18) == 0)
  2141. method50(i2, j1, j2, l1, i);
  2142. if (i < 3 && (byteGroundArray[i + 1][j2][i2] & 8) != 0)
  2143. method50(i2, j1, j2, l1, i + 1);
  2144. }
  2145.  
  2146. }
  2147.  
  2148. aRSImageProducer_1165.initDrawingArea();
  2149. anInt1071 = 0;
  2150. for (int k2 = 0; k2 < 104; k2++) {
  2151. for (int l2 = 0; l2 < 104; l2++) {
  2152. int i3 = worldController.method303(plane, k2, l2);
  2153. if (i3 != 0) {
  2154. i3 = worldController.fetchGroundDecorationNewUID(plane, k2, l2);
  2155. int j3 = ObjectDefinition.forID(i3).anInt746;
  2156. if (j3 >= 0) {
  2157. int k3 = k2;
  2158. int l3 = l2;
  2159. aClass30_Sub2_Sub1_Sub1Array1140[anInt1071] = mapFunctions[j3];
  2160. anIntArray1072[anInt1071] = k3;
  2161. anIntArray1073[anInt1071] = l3;
  2162. anInt1071++;
  2163. }
  2164. }
  2165. }
  2166.  
  2167. }
  2168.  
  2169. }
  2170.  
  2171. private void spawnGroundItem(int i, int j) {
  2172. NodeList class19 = groundArray[plane][i][j];
  2173. if (class19 == null) {
  2174. worldController.method295(plane, i, j);
  2175. return;
  2176. }
  2177. int k = 0xfa0a1f01;
  2178. Object obj = null;
  2179. for (Item item = (Item) class19.reverseGetFirst(); item != null; item = (Item) class19.reverseGetNext()) {
  2180. ItemDefinition itemDef = ItemDefinition.forID(item.ID);
  2181. int l = itemDef.value;
  2182. if (itemDef.stackable)
  2183. l *= item.itemAmount + 1;
  2184. // notifyItemSpawn(item, i + baseX, j + baseY);
  2185.  
  2186. if (l > k) {
  2187. k = l;
  2188. obj = item;
  2189. }
  2190. }
  2191.  
  2192. class19.insertTail(((Node) (obj)));
  2193. Object obj1 = null;
  2194. Object obj2 = null;
  2195. for (Item class30_sub2_sub4_sub2_1 = (Item) class19
  2196. .reverseGetFirst(); class30_sub2_sub4_sub2_1 != null; class30_sub2_sub4_sub2_1 = (Item) class19
  2197. .reverseGetNext()) {
  2198. if (class30_sub2_sub4_sub2_1.ID != ((Item) (obj)).ID && obj1 == null)
  2199. obj1 = class30_sub2_sub4_sub2_1;
  2200. if (class30_sub2_sub4_sub2_1.ID != ((Item) (obj)).ID && class30_sub2_sub4_sub2_1.ID != ((Item) (obj1)).ID
  2201. && obj2 == null)
  2202. obj2 = class30_sub2_sub4_sub2_1;
  2203. }
  2204.  
  2205. int i1 = i + (j << 7) + 0x60000000;
  2206. worldController.method281(i, i1, ((Animable) (obj1)), method42(plane, j * 128 + 64, i * 128 + 64),
  2207. ((Animable) (obj2)), ((Animable) (obj)), plane, j);
  2208. }
  2209.  
  2210. private void method26(boolean flag) {
  2211. for (int j = 0; j < npcCount; j++) {
  2212. Npc npc = npcArray[npcIndices[j]];
  2213. int k = 0x20000000 + (npcIndices[j] << 14);
  2214. if (npc == null || !npc.isVisible() || npc.desc.aBoolean93 != flag)
  2215. continue;
  2216. int l = npc.x >> 7;
  2217. int i1 = npc.y >> 7;
  2218. if (l < 0 || l >= 104 || i1 < 0 || i1 >= 104)
  2219. continue;
  2220. if (npc.anInt1540 == 1 && (npc.x & 0x7f) == 64 && (npc.y & 0x7f) == 64) {
  2221. if (anIntArrayArray929[l][i1] == anInt1265)
  2222. continue;
  2223. anIntArrayArray929[l][i1] = anInt1265;
  2224. }
  2225. if (!npc.desc.aBoolean84)
  2226. k += 0x80000000;
  2227. worldController.method285(plane, npc.anInt1552, method42(plane, npc.y, npc.x), k, npc.y,
  2228. (npc.anInt1540 - 1) * 64 + 60, npc.x, npc, npc.aBoolean1541);
  2229. }
  2230. }
  2231.  
  2232. public void drawHoverBox(int xPos, int yPos, String text) {
  2233. String[] results = text.split("\n");
  2234. int height = (results.length * 16) + 6;
  2235. int width;
  2236. width = smallText.getTextWidth(results[0]) + 6;
  2237. for (int i = 1; i < results.length; i++)
  2238. if (width <= smallText.getTextWidth(results[i]) + 6)
  2239. width = smallText.getTextWidth(results[i]) + 6;
  2240. DrawingArea.drawPixels(xPos, yPos, width, height, 0xFFFFA0);
  2241. DrawingArea.fillPixels(xPos, width, height, 0, yPos);
  2242. yPos += 14;
  2243. for (int i = 0; i < results.length; i++) {
  2244. smallText.method389(false, xPos + 3, 0, results[i], yPos);
  2245. yPos += 16;
  2246. }
  2247. }
  2248.  
  2249. private void buildInterfaceMenu(int i, RSInterface class9, int k, int l, int i1, int j1) {
  2250. if (class9 == null)
  2251. class9 = RSInterface.interfaceCache[0];
  2252. if (class9.type != 0 || class9.children == null || class9.mouseOverTriggered)
  2253. return;
  2254. if (k < i || i1 < l || k > i + class9.width || i1 > l + class9.height)
  2255. return;
  2256. int k1 = class9.children.length;
  2257. for (int l1 = 0; l1 < k1; l1++) {
  2258. int i2 = class9.childX[l1] + i;
  2259. int j2 = (class9.childY[l1] + l) - j1;
  2260. RSInterface class9_1 = RSInterface.interfaceCache[class9.children[l1]];
  2261. if (class9_1 == null)
  2262. continue;
  2263. i2 += class9_1.anInt263;
  2264. j2 += class9_1.anInt265;
  2265.  
  2266. if (class9_1.type == 8 && k >= i2 && i1 >= j2 && k <= i2 + class9_1.width && i1 <= j2 + class9_1.height) {
  2267. tooltipHoverChildId = class9_1.id;
  2268. tooltipHoverX = i2;
  2269. tooltipHoverY = j2;
  2270. }
  2271.  
  2272. if ((class9_1.hoverType >= 0 || class9_1.anInt216 != 0) && k >= i2 && i1 >= j2 && k < i2 + class9_1.width
  2273. && i1 < j2 + class9_1.height)
  2274. if (class9_1.hoverType >= 0)
  2275. anInt886 = class9_1.hoverType;
  2276. else
  2277. anInt886 = class9_1.id;
  2278. if (class9_1.type == 8 && k >= i2 && i1 >= j2 && k < i2 + class9_1.width && i1 < j2 + class9_1.height) {
  2279. anInt1315 = class9_1.id;
  2280. }
  2281. if (class9_1.type == 0) {
  2282. buildInterfaceMenu(i2, class9_1, k, j2, i1, class9_1.scrollPosition);
  2283. if (class9_1.scrollMax > class9_1.height)
  2284. method65(i2 + class9_1.width, class9_1.height, k, i1, class9_1, j2, true, class9_1.scrollMax);
  2285. } else {
  2286. if (class9_1.atActionType == 1 && mouseX >= i2 && mouseY >= j2 && mouseX < i2 + class9_1.width
  2287. && mouseY < j2 + class9_1.height) {
  2288. boolean flag = false;
  2289. boolean flag1 = false;
  2290. if (class9_1.contentType != 0)
  2291. flag = buildFriendsListMenu(class9_1);
  2292. if (!flag && !flag1) {
  2293. if (class9_1.actions != null) {
  2294. for (int jj = class9_1.actions.length - 1; jj >= 0; jj--) {
  2295. String s = class9_1.actions[jj];
  2296. if (s != null) {
  2297. menuActionName[menuActionRow] = s;
  2298. menuActionID[menuActionRow] = 222;
  2299. menuActionCmd3[menuActionRow] = class9_1.id;
  2300. currentActionMenu = menuActionRow;
  2301. menuActionRow++;
  2302. }
  2303. }
  2304. }
  2305. String tooltip = class9_1.tooltip;
  2306. if (tooltip != null) {
  2307. menuActionName[menuActionRow] = tooltip;
  2308. menuActionID[menuActionRow] = 315;
  2309. menuActionCmd3[menuActionRow] = class9_1.id;
  2310. menuActionRow++;
  2311. }
  2312. }
  2313. }
  2314. if (class9_1.atActionType == 2 && spellSelected == 0 && k >= i2 && i1 >= j2 && k < i2 + class9_1.width
  2315. && i1 < j2 + class9_1.height) {
  2316. String s = class9_1.selectedActionName;
  2317. if (s.indexOf(" ") != -1)
  2318. s = s.substring(0, s.indexOf(" "));
  2319. if (class9_1.spellName.endsWith("Rush") || class9_1.spellName.endsWith("Burst")
  2320. || class9_1.spellName.endsWith("Blitz") || class9_1.spellName.endsWith("Barrage")
  2321. || class9_1.spellName.endsWith("strike") || class9_1.spellName.endsWith("bolt")
  2322. || class9_1.spellName.equals("Crumble undead") || class9_1.spellName.endsWith("blast")
  2323. || class9_1.spellName.endsWith("wave") || class9_1.spellName.equals("Claws of Guthix")
  2324. || class9_1.spellName.equals("Flames of Zamorak")
  2325. || class9_1.spellName.equals("Magic Dart")) {
  2326. /*
  2327. * menuActionName[menuActionRow] = "Autocast @gre@" +
  2328. * class9_1.spellName; menuActionID[menuActionRow] =
  2329. * 104; menuActionCmd3[menuActionRow] = class9_1.id;
  2330. * menuActionRow++;
  2331. */
  2332. }
  2333. menuActionName[menuActionRow] = s + " @gre@" + class9_1.spellName;
  2334. menuActionID[menuActionRow] = 626;
  2335. menuActionCmd3[menuActionRow] = class9_1.id;
  2336. menuActionRow++;
  2337. }
  2338. if (class9_1.atActionType == 3 && k >= i2 && i1 >= j2 && k < i2 + class9_1.width
  2339. && i1 < j2 + class9_1.height) {
  2340. menuActionName[menuActionRow] = "Close";
  2341. menuActionID[menuActionRow] = 200;
  2342. menuActionCmd3[menuActionRow] = class9_1.id;
  2343. menuActionRow++;
  2344. }
  2345. if (class9_1.atActionType == 4 && k >= i2 && i1 >= j2 && k < i2 + class9_1.width
  2346. && i1 < j2 + class9_1.height) {
  2347. // System.out.println("2"+class9_1.tooltip + ", " +
  2348. // class9_1.interfaceID);
  2349. // menuActionName[menuActionRow] = class9_1.tooltip + ", " +
  2350. // class9_1.id;
  2351. menuActionName[menuActionRow] = class9_1.tooltip;
  2352. menuActionID[menuActionRow] = 169;
  2353. menuActionCmd3[menuActionRow] = class9_1.id;
  2354. menuActionRow++;
  2355. if (class9_1.hoverText != null) {
  2356. // drawHoverBox(k, l, class9_1.hoverText);
  2357. // System.out.println("DRAWING INTERFACE: " +
  2358. // class9_1.hoverText);
  2359. }
  2360. }
  2361. if (class9_1.atActionType == 5 && k >= i2 && i1 >= j2 && k < i2 + class9_1.width
  2362. && i1 < j2 + class9_1.height) {
  2363. // System.out.println("3"+class9_1.tooltip + ", " +
  2364. // class9_1.interfaceID);
  2365. // menuActionName[menuActionRow] = class9_1.tooltip + ", " +
  2366. // class9_1.id;
  2367. menuActionName[menuActionRow] = class9_1.tooltip;
  2368. menuActionID[menuActionRow] = 646;
  2369. menuActionCmd3[menuActionRow] = class9_1.id;
  2370. menuActionRow++;
  2371. }
  2372. if (class9_1.atActionType == 6 && !aBoolean1149 && k >= i2 && i1 >= j2 && k < i2 + class9_1.width
  2373. && i1 < j2 + class9_1.height) {
  2374. // System.out.println("4"+class9_1.tooltip + ", " +
  2375. // class9_1.interfaceID);
  2376. // menuActionName[menuActionRow] = class9_1.tooltip + ", " +
  2377. // class9_1.id;
  2378. menuActionName[menuActionRow] = class9_1.tooltip;
  2379. menuActionID[menuActionRow] = 679;
  2380. menuActionCmd3[menuActionRow] = class9_1.id;
  2381. menuActionRow++;
  2382. }
  2383. if (class9_1.type == 2) {
  2384. boolean search = class9_1.itemSearch && friendsListAction == -1 && promptInput != null
  2385. && promptInput.length() > 0;
  2386. if (!messagePromptRaised && search)
  2387. search = false;
  2388. boolean clearWhiteSpace = !search && class9_1.invClearWhiteSpace;
  2389. int results = -1;
  2390. int k2 = search ? 0 : class9.invStartIndex;
  2391. int yoffset = 0;
  2392.  
  2393. for (int l2 = 0; l2 < class9_1.height; l2++) {
  2394.  
  2395. if (clearWhiteSpace && class9_1.invClearWhiteSpaceSeperator != null) {
  2396. if (l2 != 0 && l2 != class9_1.height - 1
  2397. && l2 * class9_1.width % class9_1.invWhiteSpaceSeperatorCutoff == 0) {
  2398. for (int i7 = l2 * class9_1.width; i7 < (l2 * class9_1.width) + 100; i7++) {
  2399. if (class9_1.inv[i7] > 0) {
  2400. yoffset += 20;
  2401. break;
  2402. }
  2403. }
  2404. }
  2405. }
  2406.  
  2407. if (clearWhiteSpace) {
  2408. int items = 0;
  2409.  
  2410. for (int l4 = 0; l4 < class9_1.width; l4++) {
  2411. if (k2 >= class9_1.inv.length)
  2412. continue;
  2413. if (class9_1.inv[k2 + l4] > 0) {
  2414. items++;
  2415. }
  2416. }
  2417.  
  2418. if (items == 0) {
  2419. k2 += class9_1.width;
  2420. continue;
  2421. }
  2422. }
  2423.  
  2424. for (int i3 = 0; i3 < class9_1.width; i3++) {
  2425. if (k2 >= class9_1.inv.length)
  2426. continue;
  2427.  
  2428. if (search && class9_1.inv[k2] > 0) {
  2429. ItemDefinition itemdef = ItemDefinition.forID(class9_1.inv[k2] - 1);
  2430. if (itemdef == null || itemdef.name == null) {
  2431. k2++;
  2432. continue;
  2433. }
  2434. if (!itemdef.name.toLowerCase().contains(promptInput.toLowerCase())) {
  2435. k2++;
  2436. continue;
  2437. }
  2438.  
  2439. results++;
  2440. }
  2441.  
  2442. if (clearWhiteSpace) {
  2443. results++;
  2444. }
  2445.  
  2446. int j3 = i2 + (search || clearWhiteSpace ? (results % class9_1.width) : i3)
  2447. * (32 + class9_1.invSpritePadX);
  2448. int k3 = (j2 + (search || clearWhiteSpace ? (results / class9_1.width) : l2)
  2449. * (32 + class9_1.invSpritePadY)) + yoffset;
  2450. if (k2 < 20) {
  2451. j3 += class9_1.spritesX[k2];
  2452. k3 += class9_1.spritesY[k2];
  2453. }
  2454. if (k >= j3 && i1 >= k3 && k < j3 + 32 && i1 < k3 + 32) {
  2455. mouseInvInterfaceIndex = k2;
  2456. lastActiveInvInterface = class9_1.id;
  2457. if (class9_1.inv[k2] > 0) {
  2458. ItemDefinition itemDef = ItemDefinition.forID(class9_1.inv[k2] - 1);
  2459. if (itemSelected == 1 && class9_1.isInventoryInterface) {
  2460. if (class9_1.id != anInt1284 || k2 != anInt1283) {
  2461. menuActionName[menuActionRow] = "Use " + selectedItemName + " with @lre@"
  2462. + itemDef.name;
  2463. menuActionID[menuActionRow] = 870;
  2464. menuActionCmd1[menuActionRow] = itemDef.id;
  2465. menuActionCmd2[menuActionRow] = k2;
  2466. menuActionCmd3[menuActionRow] = class9_1.id;
  2467. menuActionRow++;
  2468. }
  2469. } else if (spellSelected == 1 && class9_1.isInventoryInterface) {
  2470. if ((spellUsableOn & 0x10) == 16) {
  2471. menuActionName[menuActionRow] = spellTooltip + " @lre@" + itemDef.name;
  2472. menuActionID[menuActionRow] = 543;
  2473. menuActionCmd1[menuActionRow] = itemDef.id;
  2474. menuActionCmd2[menuActionRow] = k2;
  2475. menuActionCmd3[menuActionRow] = class9_1.id;
  2476. menuActionRow++;
  2477. }
  2478. } else {
  2479. if (class9_1.isInventoryInterface) {
  2480. for (int l3 = 4; l3 >= 3; l3--)
  2481. if (itemDef.itemActions != null && itemDef.itemActions[l3] != null) {
  2482. menuActionName[menuActionRow] = itemDef.itemActions[l3] + " @lre@"
  2483. + itemDef.name;
  2484. if (l3 == 3)
  2485. menuActionID[menuActionRow] = 493;
  2486. if (l3 == 4)
  2487. menuActionID[menuActionRow] = 847;
  2488. menuActionCmd1[menuActionRow] = itemDef.id;
  2489. menuActionCmd2[menuActionRow] = k2;
  2490. menuActionCmd3[menuActionRow] = class9_1.id;
  2491. menuActionRow++;
  2492. } else if (l3 == 4) {
  2493. menuActionName[menuActionRow] = "Drop @lre@" + itemDef.name;
  2494. menuActionID[menuActionRow] = 847;
  2495. menuActionCmd1[menuActionRow] = itemDef.id;
  2496. menuActionCmd2[menuActionRow] = k2;
  2497. menuActionCmd3[menuActionRow] = class9_1.id;
  2498. menuActionRow++;
  2499. }
  2500. }
  2501. if (class9_1.usableItemInterface) {
  2502. menuActionName[menuActionRow] = "Use @lre@" + itemDef.name;
  2503. menuActionID[menuActionRow] = 447;
  2504. menuActionCmd1[menuActionRow] = itemDef.id;
  2505. menuActionCmd2[menuActionRow] = k2;
  2506. menuActionCmd3[menuActionRow] = class9_1.id;
  2507. menuActionRow++;
  2508. }
  2509. if (class9_1.isInventoryInterface && itemDef.itemActions != null) {
  2510. for (int i4 = 2; i4 >= 0; i4--)
  2511. if (itemDef.itemActions[i4] != null) {
  2512. menuActionName[menuActionRow] = itemDef.itemActions[i4] + " @lre@"
  2513. + itemDef.name;
  2514. if (i4 == 0)
  2515. menuActionID[menuActionRow] = 74;
  2516. if (i4 == 1)
  2517. menuActionID[menuActionRow] = 454;
  2518. if (i4 == 2)
  2519. menuActionID[menuActionRow] = 539;
  2520. menuActionCmd1[menuActionRow] = itemDef.id;
  2521. menuActionCmd2[menuActionRow] = k2;
  2522. menuActionCmd3[menuActionRow] = class9_1.id;
  2523. menuActionRow++;
  2524. }
  2525.  
  2526. }
  2527. if (class9_1.actions != null) {
  2528. for (int j4 = class9_1.actions.length == 6 ? 5 : 4; j4 >= 0; j4--)
  2529. if (class9_1.actions[j4] != null) {
  2530. menuActionName[menuActionRow] = class9_1.actions[j4] + " @lre@"
  2531. + itemDef.name;
  2532. if (j4 == 0)
  2533. menuActionID[menuActionRow] = 632;
  2534. if (j4 == 1)
  2535. menuActionID[menuActionRow] = 78;
  2536. if (j4 == 2)
  2537. menuActionID[menuActionRow] = 867;
  2538. if (j4 == 3)
  2539. menuActionID[menuActionRow] = 431;
  2540. if (j4 == 4)
  2541. menuActionID[menuActionRow] = 53;
  2542. if (j4 == 5)
  2543. menuActionID[menuActionRow] = 54;
  2544. menuActionCmd1[menuActionRow] = itemDef.id;
  2545. menuActionCmd2[menuActionRow] = k2;
  2546. menuActionCmd3[menuActionRow] = class9_1.id;
  2547. menuActionRow++;
  2548. }
  2549.  
  2550. }
  2551. // menuActionName[menuActionRow] =
  2552. // "Examine @lre@" + itemDef.name +
  2553. // " @gre@(@whi@" + (class9_1.inv[k2] -
  2554. // 1) + "@gre@)";
  2555. menuActionName[menuActionRow] = "Examine @lre@" + itemDef.name
  2556. + (clientData ? (", ID: " + itemDef.id) : "");
  2557. menuActionID[menuActionRow] = 1125;
  2558. menuActionCmd1[menuActionRow] = itemDef.id;
  2559. menuActionCmd2[menuActionRow] = k2;
  2560. menuActionCmd3[menuActionRow] = class9_1.id;
  2561. menuActionRow++;
  2562. }
  2563. }
  2564. }
  2565. k2++;
  2566. }
  2567. }
  2568. }
  2569. }
  2570. }
  2571. }
  2572.  
  2573. public void drawScrollbar(int barHeight, int scrollPos, int yPos, int xPos, int contentHeight,
  2574. boolean isTransparent) {
  2575. // if (!isOldScrollbar) {
  2576. /*
  2577. * scrollBar3.method361(i1, l); scrollBar4.method361(i1, (l + j) - 16);
  2578. */
  2579.  
  2580. int backingAmount = (barHeight - 32) / (isTransparent ? 2 : 5);
  2581. int scrollPartHeight = ((barHeight - 32) * barHeight) / contentHeight;
  2582.  
  2583. if (scrollPartHeight < 10)
  2584. scrollPartHeight = 10;
  2585. int scrollPartAmount = (scrollPartHeight / (isTransparent ? 1 : 5)) - 2;
  2586. int scrollPartPos = ((barHeight - 32 - scrollPartHeight) * scrollPos) / (contentHeight - barHeight) + 16 + yPos;
  2587. for (int i = 0, yyPos = yPos + 16; i <= (isTransparent ? backingAmount / 2 + 6
  2588. : backingAmount); i++, yyPos += (isTransparent ? 3 : 5)) {
  2589. if (isTransparent) {
  2590. cacheSprites3[126 + 7].drawAdvancedSprite(xPos, yyPos);
  2591. } else {
  2592. cacheSprites3[133 + 7].drawSprite(xPos, yyPos);
  2593. }
  2594. }
  2595. if (isTransparent) {
  2596. cacheSprites3[127 + 7].drawAdvancedSprite(xPos, scrollPartPos);
  2597. } else
  2598. cacheSprites3[134 + 7].drawSprite(xPos, scrollPartPos); // above
  2599. // part, not
  2600. // it
  2601. scrollPartPos += 5;
  2602. for (int i = 0; i <= (isTransparent ? scrollPartAmount - 9 : scrollPartAmount); i++) {
  2603. if (isTransparent) {
  2604. cacheSprites3[128 + 7].drawAdvancedSprite(xPos, scrollPartPos);
  2605. } else
  2606. cacheSprites3[135 + 7].drawSprite(xPos, scrollPartPos);
  2607. scrollPartPos += isTransparent ? 1 : 5;
  2608. }
  2609. scrollPartPos = ((barHeight - 32 - scrollPartHeight) * scrollPos) / (contentHeight - barHeight) + 16 + yPos
  2610. + (scrollPartHeight - 5);
  2611. if (isTransparent) {
  2612. cacheSprites3[129 + 7].drawAdvancedSprite(xPos, scrollPartPos);
  2613. } else
  2614. cacheSprites3[132 + 7].drawSprite(xPos, scrollPartPos);
  2615. /*
  2616. * if (newScroller) { cacheSprites3[146 + 7].drawSprite(xPos, yPos);
  2617. * cacheSprites3[147 + 7].drawSprite(xPos, (yPos + barHeight) - 16); }
  2618. * else
  2619. */if (isTransparent) {
  2620. cacheSprites3[124 + 7].drawAdvancedSprite(xPos, yPos);
  2621. cacheSprites3[125 + 7].drawAdvancedSprite(xPos, (yPos + barHeight) - 16);
  2622. } else {
  2623. cacheSprites3[144 + 7].drawSprite(xPos, yPos);
  2624. cacheSprites3[145 + 7].drawSprite(xPos, (yPos + barHeight) - 16);
  2625. }
  2626. /*
  2627. * } else { scrollBar1.method361(xPos, yPos); scrollBar2.method361(xPos,
  2628. * (yPos + barHeight) - 16);
  2629. *
  2630. * DrawingArea.drawPixels(xPos, yPos + 16, 16, barHeight - 32,
  2631. * anInt1002); int k1 = ((barHeight - 32) * barHeight) / contentHeight;
  2632. * if(k1 < 8) k1 = 8; int l1 = ((barHeight - 32 - k1) * scrollPos) /
  2633. * (contentHeight - barHeight); DrawingArea.drawPixels(xPos, yPos + 16 +
  2634. * l1, 16, k1, anInt1063); DrawingArea.method341(yPos + 16 + l1,
  2635. * anInt902, k1, xPos); DrawingArea.method341(yPos + 16 + l1, anInt902,
  2636. * k1, xPos + 1); DrawingArea.drawLine(yPos + 16 + l1, anInt902, 16,
  2637. * xPos); DrawingArea.drawLine(yPos + 17 + l1, anInt902, 16, xPos);
  2638. * DrawingArea.method341(yPos + 16 + l1, anInt927, k1, xPos + 15);
  2639. * DrawingArea.method341(yPos + 17 + l1, anInt927, k1 - 1, xPos + 14);
  2640. * DrawingArea.drawLine(yPos + 15 + l1 + k1, anInt927, 16, xPos);
  2641. * DrawingArea.drawLine(yPos + 14 + l1 + k1, anInt927, 15, xPos + 1); }
  2642. */
  2643. }
  2644.  
  2645. private void updateNPCs(RSBuffer stream, int i) {
  2646. anInt839 = 0;
  2647. anInt893 = 0;
  2648. method139(stream);
  2649. method46(i, stream);
  2650. method86(stream);
  2651. for (int k = 0; k < anInt839; k++) {
  2652. int l = anIntArray840[k];
  2653. if (npcArray[l].anInt1537 != loopCycle) {
  2654. npcArray[l].desc = null;
  2655. npcArray[l] = null;
  2656. }
  2657. }
  2658.  
  2659. if (stream.currentOffset != i) {
  2660. Signlink.reporterror(
  2661. myUsername + " size mismatch in getnpcpos - pos:" + stream.currentOffset + " psize:" + i);
  2662. throw new RuntimeException("eek");
  2663. }
  2664. for (int i1 = 0; i1 < npcCount; i1++)
  2665. if (npcArray[npcIndices[i1]] == null) {
  2666. Signlink.reporterror(myUsername + " null entry in npc list - pos:" + i1 + " size:" + npcCount);
  2667. throw new RuntimeException("eek");
  2668. }
  2669.  
  2670. }
  2671.  
  2672. private void method33(int i) {
  2673. try {
  2674. if (i >= Varp.cache.length)
  2675. return;
  2676. int j = Varp.cache[i].anInt709;
  2677. if (j == 0)
  2678. return;
  2679. int k = variousSettings[i];
  2680. if (j == 1) {
  2681. if (k == 1)
  2682. Texture.method372(0.90000000000000002D);
  2683. if (k == 2)
  2684. Texture.method372(0.80000000000000004D);
  2685. if (k == 3)
  2686. Texture.method372(0.69999999999999996D);
  2687. if (k == 4)
  2688. Texture.method372(0.59999999999999998D);
  2689. ItemDefinition.mruNodes1.unlinkAll();
  2690. welcomeScreenRaised = true;
  2691. }
  2692. if (j == 3) {
  2693. boolean flag1 = musicEnabled;
  2694. if (k == 0) {
  2695. setMidiVolume(192);
  2696. musicEnabled = true;
  2697. }
  2698. if (k == 1) {
  2699. setMidiVolume(128);
  2700. musicEnabled = true;
  2701. }
  2702. if (k == 2) {
  2703. setMidiVolume(64);
  2704. musicEnabled = true;
  2705. }
  2706. if (k == 3) {
  2707. setMidiVolume(32);
  2708. musicEnabled = true;
  2709. }
  2710. if (k == 4)
  2711. musicEnabled = false;
  2712. if (musicEnabled != flag1 && !lowMem) {
  2713. if (musicEnabled) {
  2714. nextSong = currentSong;
  2715. // songChanging = true;
  2716. onDemandFetcher.method558(2, nextSong);
  2717. } else {
  2718. stopMidi();
  2719. }
  2720. prevSong = 0;
  2721. }
  2722. }
  2723. if (j == 4) {
  2724. if (k == 0) {
  2725. aBoolean848 = true;
  2726. setWaveVolume(0);
  2727. }
  2728. if (k == 1) {
  2729. aBoolean848 = true;
  2730. setWaveVolume(-400);
  2731. }
  2732. if (k == 2) {
  2733. aBoolean848 = true;
  2734. setWaveVolume(-800);
  2735. }
  2736. if (k == 3) {
  2737. aBoolean848 = true;
  2738. setWaveVolume(-1200);
  2739. }
  2740. if (k == 4)
  2741. aBoolean848 = false;
  2742. }
  2743. if (j == 5)
  2744. anInt1253 = k;
  2745. if (j == 6)
  2746. anInt1249 = k;
  2747. if (j == 8) {
  2748. splitPrivateChat = k;
  2749. inputTaken = true;
  2750. }
  2751. if (j == 9)
  2752. anInt913 = k;
  2753. } catch (Exception e) {
  2754. e.printStackTrace();
  2755. }
  2756. }
  2757.  
  2758. public StreamLoader mediaStreamLoader;
  2759.  
  2760. public void updateEntities() {
  2761. try {
  2762. int anInt974 = 0;
  2763. for (int j = -1; j < playerCount + npcCount; j++) {
  2764. Object obj;
  2765. if (j == -1)
  2766. obj = myPlayer;
  2767. else if (j < playerCount)
  2768. obj = playerArray[playerIndices[j]];
  2769. else
  2770. obj = npcArray[npcIndices[j - playerCount]];
  2771. if (obj == null || !((Entity) (obj)).isVisible())
  2772. continue;
  2773. if (obj instanceof Npc) {
  2774. NpcDefinition entityDef = ((Npc) obj).desc;
  2775. if (entityDef.childrenIDs != null)
  2776. entityDef = entityDef.method161();
  2777. if (entityDef == null)
  2778. continue;
  2779. }
  2780. if (j < playerCount) {
  2781. int l = 30;
  2782. Player player = (Player) obj;
  2783. if (player.headIcon >= 0) {
  2784. npcScreenPos(((Entity) (obj)), ((Entity) (obj)).height + 15);
  2785. if (spriteDrawX > -1) {
  2786. if (player.skulled) {
  2787. // l += 2;
  2788. skullIcons[0].drawSprite(spriteDrawX - 12, spriteDrawY - l);
  2789. l += 26;
  2790. }
  2791. if (player.bountyHunterIcon >= 0 && player.bountyHunterIcon <= 4) {
  2792. cacheSprites[674 + player.bountyHunterIcon]
  2793. .drawSprite(spriteDrawX - (player.skulled ? 8 : 10), spriteDrawY - l);
  2794. l += 28;
  2795. }
  2796. if (player.headIcon < 18) {
  2797. headIcons[player.headIcon].drawSprite(spriteDrawX - 12, spriteDrawY - l);
  2798. l += 18;
  2799. }
  2800. }
  2801. }
  2802. if (j >= 0 && anInt855 == 10 && anInt933 == playerIndices[j]) {
  2803. npcScreenPos(((Entity) (obj)), ((Entity) (obj)).height + 15);
  2804. if (spriteDrawX > -1)
  2805. headIconsHint[player.hintIcon].drawSprite(spriteDrawX - 12, spriteDrawY - l);
  2806. }
  2807. if (ClientSettings.getBoolean("names_above_head")) {
  2808. npcScreenPos(((Entity) (obj)), ((Entity) (obj)).height + 15);
  2809.  
  2810. int color = Integer.MAX_VALUE;
  2811. if (myPlayer.bloodlustName.equalsIgnoreCase(player.bloodlustName)) {
  2812. color = 0x00ff00;
  2813. } else {
  2814. color = 0x2080ff;
  2815. }
  2816.  
  2817. if (player.bloodlustName.isEmpty()) {
  2818. color = Integer.MAX_VALUE;
  2819. }
  2820. if (player.playerRights == 14) {
  2821. color = 0xCC0000;
  2822. }
  2823.  
  2824. String bloodlustRender = player.bloodlustName == null ? "" : player.bloodlustName;
  2825.  
  2826. newBoldFont.drawCenteredString(player.name, spriteDrawX, spriteDrawY - l + 8, color, 0);
  2827. newBoldFont.drawCenteredString("\\<" + bloodlustRender + "\\>", spriteDrawX, spriteDrawY - l + 21, color, 0);
  2828.  
  2829. l += 3;
  2830. }
  2831. } else {
  2832. NpcDefinition entityDef_1 = ((Npc) obj).desc;
  2833. if (entityDef_1.anInt75 >= 0 && entityDef_1.anInt75 < headIcons.length) {
  2834. npcScreenPos(((Entity) (obj)), ((Entity) (obj)).height + 15);
  2835. if (spriteDrawX > -1) {
  2836. if (entityDef_1.anInt75 == 19) // Soul-Split hard
  2837. // code
  2838. entityDef_1.anInt75 = 17;
  2839.  
  2840. if (headIcons[entityDef_1.anInt75] == null) {
  2841. System.err.println("Null headicon: " + entityDef_1.anInt75);
  2842. } else {
  2843. headIcons[entityDef_1.anInt75].drawSprite(spriteDrawX - 12, spriteDrawY - 30);
  2844. }
  2845. }
  2846. }
  2847. if (anInt855 == 1 && anInt1222 == npcIndices[j - playerCount] && loopCycle % 20 < 10) {
  2848. npcScreenPos(((Entity) (obj)), ((Entity) (obj)).height + 15);
  2849. if (spriteDrawX > -1)
  2850. headIconsHint[0].drawSprite(spriteDrawX - 12, spriteDrawY - 28);
  2851. }
  2852. }
  2853. if (((Entity) (obj)).textSpoken != null && (j >= playerCount || publicChatMode == 0
  2854. || publicChatMode == 3 || publicChatMode == 1 && isFriendOrSelf(((Player) obj).name))) {
  2855. npcScreenPos(((Entity) (obj)), ((Entity) (obj)).height);
  2856. if (spriteDrawX > -1 && anInt974 < anInt975) {
  2857. anIntArray979[anInt974] = boldText.method384(((Entity) (obj)).textSpoken) / 2;
  2858. anIntArray978[anInt974] = boldText.anInt1497;
  2859. anIntArray976[anInt974] = spriteDrawX;
  2860. anIntArray977[anInt974] = spriteDrawY;
  2861. anIntArray980[anInt974] = ((Entity) (obj)).anInt1513;
  2862. anIntArray981[anInt974] = ((Entity) (obj)).anInt1531;
  2863. anIntArray982[anInt974] = ((Entity) (obj)).textCycle;
  2864. aStringArray983[anInt974++] = ((Entity) (obj)).textSpoken;
  2865. if (anInt1249 == 0 && ((Entity) (obj)).anInt1531 >= 1 && ((Entity) (obj)).anInt1531 <= 3) {
  2866. anIntArray978[anInt974] += 10;
  2867. anIntArray977[anInt974] += 5;
  2868. }
  2869. if (anInt1249 == 0 && ((Entity) (obj)).anInt1531 == 4)
  2870. anIntArray979[anInt974] = 60;
  2871. if (anInt1249 == 0 && ((Entity) (obj)).anInt1531 == 5)
  2872. anIntArray978[anInt974] += 5;
  2873. }
  2874. }
  2875. if (((Entity) (obj)).loopCycleStatus > loopCycle) {
  2876. try {
  2877. npcScreenPos(((Entity) (obj)), ((Entity) (obj)).height + 15);
  2878. if (spriteDrawX > -1) {
  2879. Entity entity = (Entity) obj;
  2880. int hitpoints = entity.maxHealth;
  2881. boolean bigBar = entity instanceof Npc && hitpoints > 990;
  2882. int length = 30;
  2883. if (bigBar) {
  2884. length += hitpoints / 60;
  2885. }
  2886. if (length > 120)
  2887. length = 120;
  2888. int i1 = (((Entity) (obj)).currentHealth * length) / ((Entity) (obj)).maxHealth;
  2889. int hpPercent = (((Entity) (obj)).currentHealth * 56) / ((Entity) (obj)).maxHealth;
  2890. if (hpPercent > 56) {
  2891. hpPercent = 56;
  2892. }
  2893. if (i1 > length) {
  2894. i1 = length;
  2895. }
  2896. if (i1 < 0) {
  2897. i1 = 0;
  2898. }
  2899. if (ClientSettings.getBoolean("hp_above_head")) {
  2900. newBoldFont.drawCenteredString(
  2901. (entity.currentHealth / 10) + "/" + (entity.maxHealth / 10), spriteDrawX,
  2902. spriteDrawY - 35, 0xff0000, 0);
  2903. }
  2904. if (!ClientSettings.getBoolean("new_hitbar")) {
  2905.  
  2906. // DrawingArea.drawPixels(spriteDrawX - 15, spriteDrawY - 3, i1, 5, 65280);
  2907. // DrawingArea.drawPixels((spriteDrawX - 15) + i1, spriteDrawY - 3, 30 - i1, 5, 0xff0000);
  2908.  
  2909. DrawingArea.drawPixels((spriteDrawX) - (length / 2), spriteDrawY - 3, i1, 5, 65280);
  2910. DrawingArea.drawPixels((spriteDrawX - length / 2) + i1, spriteDrawY - 3, length - i1, 5, 0xff0000);
  2911. } else {
  2912. /*
  2913. * i1 = (((Entity) (obj)).currentHealth * 30) /
  2914. * ((Entity) (obj)).maxHealth;
  2915. *
  2916. * //if (i1 > 30) //i1 = 30;
  2917. *
  2918. * int barWidth = 56; int percent = (((Entity)
  2919. * (obj)).currentHealth * barWidth) / ((Entity)
  2920. * (obj)).maxHealth; if(percent > barWidth)
  2921. * percent = barWidth; //if (percent < 0)
  2922. * //percent = 0;
  2923. *
  2924. *
  2925. * cacheSprites3[173].drawSprite(spriteDrawX -
  2926. * 28, spriteDrawY - 5);
  2927. * cacheSprites3[172].copy().getSubImage(
  2928. * cacheSprites3[172], 0, 0, percent,
  2929. * 7).drawSprite(spriteDrawX - 28, spriteDrawY -
  2930. * 5);
  2931. */
  2932.  
  2933. i1 = (((Entity) (obj)).currentHealth * 30) / ((Entity) (obj)).maxHealth;
  2934.  
  2935. if (i1 > 30)
  2936. i1 = 30;
  2937.  
  2938. int barWidth = 56;
  2939. int percent = (((Entity) (obj)).currentHealth * barWidth) / ((Entity) (obj)).maxHealth;
  2940. if (percent > barWidth)
  2941. percent = barWidth;
  2942.  
  2943. cacheSprites3[173].drawSprite(spriteDrawX - 28, spriteDrawY - 5);
  2944. cacheSprites3[172].getSubImage(cacheSprites3[172].copy(), 0, 0, percent, 7)
  2945. .drawSprite(spriteDrawX - 28, spriteDrawY - 5);
  2946. }
  2947. }
  2948. } catch (Exception e) {
  2949. e.printStackTrace();
  2950. }
  2951. }
  2952.  
  2953. for (int j1 = 0; j1 < 4; j1++) {
  2954. if (((Entity) (obj)).hitsLoopCycle[j1] > loopCycle) {
  2955. npcScreenPos(((Entity) (obj)), ((Entity) (obj)).height / 2);
  2956. if (spriteDrawX > -1) {
  2957. if (ClientSettings.getInt("hitmarks") == 602) {
  2958. if (j1 == 1)
  2959. spriteDrawY += 20;
  2960. if (j1 == 2) {
  2961. spriteDrawY += 40;
  2962. }
  2963. if (j1 == 3) {
  2964. spriteDrawY += 60;
  2965. }
  2966. } else {
  2967. if (j1 == 1)
  2968. spriteDrawY -= 20;
  2969. if (j1 == 2) {
  2970. spriteDrawX -= 15;
  2971. spriteDrawY -= 10;
  2972. }
  2973. if (j1 == 3) {
  2974. spriteDrawX += 15;
  2975. spriteDrawY -= 10;
  2976. }
  2977. }
  2978.  
  2979. /**
  2980. * Draw hitmark
  2981. */
  2982. int hitMarkType = ((Entity) (obj)).hitMarkTypes[j1];
  2983.  
  2984. int hit = ((Entity) (obj)).hitArray[j1];
  2985.  
  2986. if (!ClientSettings.getBoolean("constitution")) {
  2987. hit = (int) Math.ceil(((double) hit) / 10d);
  2988. }
  2989.  
  2990. Sprite hitmark = hitMarks[hitMarkType];
  2991.  
  2992. if (hitMarkType == 0 || hitMarkType == 1
  2993. || hitMarkType == 2 && ClientSettings.getInt("hitmarks") == 602) {
  2994. /**
  2995. * Hit/block
  2996. */
  2997. if (ClientSettings.getInt("hitmarks") == 562) {
  2998. /**
  2999. * 562
  3000. */
  3001. if (hitMarkType == 0) {
  3002. cacheSprites3[165].drawAdvancedSprite(spriteDrawX - 9, spriteDrawY - 12);
  3003. } else {
  3004. if (hit >= 100) {
  3005. cacheSprites3[167].drawAdvancedSprite(spriteDrawX - 18, spriteDrawY - 13);
  3006. } else {
  3007. cacheSprites3[166].drawAdvancedSprite(spriteDrawX - 12, spriteDrawY - 12);
  3008. }
  3009. }
  3010. } else if (ClientSettings.getInt("hitmarks") == 602) {
  3011.  
  3012. int opacity = 256 - ((Entity) (obj)).hitsOpacityCycle[j1];
  3013. int icon = ((Entity) (obj)).hitsIcon[j1];
  3014. int offset = ((Entity) (obj)).hitsOpacityCycle[j1] / 3;
  3015. if (offset > 28)
  3016. offset = 28;
  3017. if (hitMarkType == 0) {
  3018. spriteDrawY -= 10;
  3019. cacheSprites3[168].drawTransparentSprite(spriteDrawX - 12,
  3020. spriteDrawY - 12 - offset, opacity);
  3021. } else if (hitMarkType == 2) {
  3022. int hitSprite = hit <= 9 ? 470 : hit <= 99 ? 471 : 472;
  3023. cacheSprites3[hitSprite].drawTransparentSprite(
  3024. spriteDrawX - (cacheSprites3[hitSprite].myWidth / 2),
  3025. spriteDrawY - 16 - offset, opacity);
  3026. } else {
  3027. int hitSprite = hit <= 9 ? 169 : hit <= 99 ? 170 : 171;
  3028. cacheSprites3[hitSprite].drawTransparentSprite(
  3029. spriteDrawX - (cacheSprites3[hitSprite].myWidth / 2),
  3030. spriteDrawY - 16 - offset, opacity);
  3031.  
  3032. int sprite = icon == 0 ? 69 : icon == 1 ? 70 : icon == 2 ? 71 : -1;
  3033. if (sprite != -1) {
  3034. cacheSprites[sprite].drawTransparentSprite(
  3035. spriteDrawX - (cacheSprites3[hitSprite].myWidth / 2)
  3036. - cacheSprites[sprite].myWidth - 2,
  3037. spriteDrawY - 16 - offset - 2, opacity);
  3038. }
  3039. }
  3040.  
  3041. ((Entity) (obj)).hitsOpacityCycle[j1] += 2;
  3042.  
  3043. if (((Entity) (obj)).hitsOpacityCycle[j1] > 256) {
  3044. ((Entity) (obj)).hitsOpacityCycle[j1] = 256;
  3045. }
  3046. } else {
  3047. /**
  3048. * 317
  3049. */
  3050. hitMarks[hitMarkType].drawSprite(spriteDrawX - 12, spriteDrawY - 12);
  3051. }
  3052. } else {
  3053. /**
  3054. * Other hitmarks
  3055. */
  3056. hitMarks[hitMarkType].drawSprite(spriteDrawX - 12, spriteDrawY - 12);
  3057. }
  3058.  
  3059. if (!(ClientSettings.getInt("hitmarks") == 602 && hitMarkType == 0)) {
  3060. if (!(ClientSettings.getInt("hitmarks") == 562
  3061. || ClientSettings.getInt("hitmarks") == 602)
  3062. || (ClientSettings.getInt("hitmarks") == 562
  3063. || ClientSettings.getInt("hitmarks") == 602)) {
  3064.  
  3065. if (ClientSettings.getInt("hitmarks") == 602) {
  3066. int opacity = 256 - ((Entity) (obj)).hitsOpacityCycle[j1];
  3067. int offset = ((Entity) (obj)).hitsOpacityCycle[j1] / 3;
  3068.  
  3069. if (offset > 28)
  3070. offset = 28;
  3071.  
  3072. if (opacity < 0) {
  3073. opacity = 0;
  3074. }
  3075.  
  3076. int xOffset = -8;
  3077.  
  3078. if (hit > 99) {
  3079. xOffset = -8;
  3080. } else if (hit > 9) {
  3081. xOffset = -8;
  3082. }
  3083.  
  3084. newSmallFont.drawCenteredString("<trans=" + opacity + ">" + String.valueOf(hit),
  3085. spriteDrawX + xOffset + 8, spriteDrawY + 4 + -6 - offset, 0xffffff, 0);
  3086.  
  3087. /*
  3088. * newSmallFont .drawText( 0, "<trans="
  3089. * + opacity + ">" +
  3090. * String.valueOf(((Entity)
  3091. * (obj)).hitArray[j1]), spriteDrawY + 4
  3092. * + (Configuration.hitMarkType ==
  3093. * HitMarkType.TYPE_602 ? -6 : 0),
  3094. * spriteDrawX +
  3095. * (Configuration.hitMarkType ==
  3096. * HitMarkType.TYPE_602 ? 9 : 0));
  3097. *
  3098. * smallFont .drawText( 0xffffff,
  3099. * "<trans=" + opacity + ">" +
  3100. * String.valueOf(((Entity)
  3101. * (obj)).hitArray[j1]), spriteDrawY + 3
  3102. * + (Configuration.hitMarkType ==
  3103. * HitMarkType.TYPE_602 ? -6 : 0),
  3104. * spriteDrawX - 1 +
  3105. * (Configuration.hitMarkType ==
  3106. * HitMarkType.TYPE_602 ? 9 : 0));
  3107. */
  3108.  
  3109. } else if (ClientSettings.getInt("hitmarks") == 562) {
  3110. newSmallFont.drawCenteredString(String.valueOf(hit), spriteDrawX - 1,
  3111. spriteDrawY + 4, 0xffffff, 0);
  3112. // aTextDrawingArea_1270.drawText(0,
  3113. // String.valueOf(((Entity)
  3114. // (obj)).hitArray[j1]), spriteDrawY +
  3115. // 4, spriteDrawX);
  3116. // aTextDrawingArea_1270.drawText(0xffffff,
  3117. // String.valueOf(((Entity)
  3118. // (obj)).hitArray[j1]), spriteDrawY +
  3119. // 3, spriteDrawX - 1);
  3120.  
  3121. } else {
  3122. newSmallFont.drawCenteredString(String.valueOf(hit), spriteDrawX - 1,
  3123. spriteDrawY + 4, 0xffffff, 0);
  3124. // aTextDrawingArea_1270.drawText(0,
  3125. // String.valueOf(((Entity)
  3126. // (obj)).hitArray[j1]), spriteDrawY +
  3127. // 4, spriteDrawX);
  3128. // aTextDrawingArea_1270.drawText(0xffffff,
  3129. // String.valueOf(((Entity)
  3130. // (obj)).hitArray[j1]), spriteDrawY +
  3131. // 3, spriteDrawX - 1);
  3132.  
  3133. }
  3134. } else {
  3135. newSmallFont.drawCenteredString(String.valueOf(hit), spriteDrawX - 1,
  3136. spriteDrawY + 4, 0xffffff, 0);
  3137. // aTextDrawingArea_1270.drawText(0,
  3138. // String.valueOf(((Entity)
  3139. // (obj)).hitArray[j1]), spriteDrawY + 4,
  3140. // spriteDrawX);
  3141. // aTextDrawingArea_1270.drawText(0xffffff,
  3142. // String.valueOf(((Entity)
  3143. // (obj)).hitArray[j1]), spriteDrawY + 3,
  3144. // spriteDrawX - 1);
  3145.  
  3146. }
  3147. }
  3148.  
  3149. /*
  3150. * hitMarks[((Entity)
  3151. * (obj)).hitMarkTypes[j1]].drawSprite(spriteDrawX -
  3152. * 12, spriteDrawY - 12);
  3153. * aTextDrawingArea_1270.drawText(0,
  3154. * String.valueOf(((Entity) (obj)).hitArray[j1]),
  3155. * spriteDrawY + 4, spriteDrawX);
  3156. * aTextDrawingArea_1270.drawText(0xffffff,
  3157. * String.valueOf(((Entity) (obj)).hitArray[j1]),
  3158. * spriteDrawY + 3, spriteDrawX - 1);
  3159. */
  3160. }
  3161.  
  3162. /*
  3163. * hitMarks[((Entity)
  3164. * (obj)).hitMarkTypes[j1]].drawSprite(spriteDrawX - 12,
  3165. * spriteDrawY - 12); smallText.drawText(0,
  3166. * String.valueOf(((Entity) (obj)).hitArray[j1]),
  3167. * spriteDrawY + 4, spriteDrawX);
  3168. * smallText.drawText(0xffffff, String.valueOf(((Entity)
  3169. * (obj)).hitArray[j1]), spriteDrawY + 3, spriteDrawX -
  3170. * 1);
  3171. */
  3172. }
  3173. }
  3174. }
  3175.  
  3176. for (int k = 0; k < anInt974; k++) {
  3177. int k1 = anIntArray976[k];
  3178. int l1 = anIntArray977[k];
  3179. int j2 = anIntArray979[k];
  3180. int k2 = anIntArray978[k];
  3181. boolean flag = true;
  3182. while (flag) {
  3183. flag = false;
  3184. for (int l2 = 0; l2 < k; l2++)
  3185. if (l1 + 2 > anIntArray977[l2] - anIntArray978[l2] && l1 - k2 < anIntArray977[l2] + 2
  3186. && k1 - j2 < anIntArray976[l2] + anIntArray979[l2]
  3187. && k1 + j2 > anIntArray976[l2] - anIntArray979[l2]
  3188. && anIntArray977[l2] - anIntArray978[l2] < l1) {
  3189. l1 = anIntArray977[l2] - anIntArray978[l2];
  3190. flag = true;
  3191. }
  3192.  
  3193. }
  3194. spriteDrawX = anIntArray976[k];
  3195. spriteDrawY = anIntArray977[k] = l1;
  3196. String s = aStringArray983[k];
  3197. if (anInt1249 == 0) {
  3198. int i3 = 0xffff00;
  3199. if (anIntArray980[k] < 6)
  3200. i3 = anIntArray965[anIntArray980[k]];
  3201. if (anIntArray980[k] == 6)
  3202. i3 = anInt1265 % 20 >= 10 ? 0xffff00 : 0xff0000;
  3203. if (anIntArray980[k] == 7)
  3204. i3 = anInt1265 % 20 >= 10 ? 65535 : 255;
  3205. if (anIntArray980[k] == 8)
  3206. i3 = anInt1265 % 20 >= 10 ? 0x80ff80 : 45056;
  3207. if (anIntArray980[k] == 9) {
  3208. int j3 = 150 - anIntArray982[k];
  3209. if (j3 < 50)
  3210. i3 = 0xff0000 + 1280 * j3;
  3211. else if (j3 < 100)
  3212. i3 = 0xffff00 - 0x50000 * (j3 - 50);
  3213. else if (j3 < 150)
  3214. i3 = 65280 + 5 * (j3 - 100);
  3215. }
  3216. if (anIntArray980[k] == 10) {
  3217. int k3 = 150 - anIntArray982[k];
  3218. if (k3 < 50)
  3219. i3 = 0xff0000 + 5 * k3;
  3220. else if (k3 < 100)
  3221. i3 = 0xff00ff - 0x50000 * (k3 - 50);
  3222. else if (k3 < 150)
  3223. i3 = (255 + 0x50000 * (k3 - 100)) - 5 * (k3 - 100);
  3224. }
  3225. if (anIntArray980[k] == 11) {
  3226. int l3 = 150 - anIntArray982[k];
  3227. if (l3 < 50)
  3228. i3 = 0xffffff - 0x50005 * l3;
  3229. else if (l3 < 100)
  3230. i3 = 65280 + 0x50005 * (l3 - 50);
  3231. else if (l3 < 150)
  3232. i3 = 0xffffff - 0x50000 * (l3 - 100);
  3233. }
  3234. if (anIntArray981[k] == 0) {
  3235. boldText.drawText(0, s, spriteDrawY + 1, spriteDrawX);
  3236. boldText.drawText(i3, s, spriteDrawY, spriteDrawX);
  3237. }
  3238. if (anIntArray981[k] == 1) {
  3239. boldText.method386(0, s, spriteDrawX, anInt1265, spriteDrawY + 1);
  3240. boldText.method386(i3, s, spriteDrawX, anInt1265, spriteDrawY);
  3241. }
  3242. if (anIntArray981[k] == 2) {
  3243. boldText.method387(spriteDrawX, s, anInt1265, spriteDrawY + 1, 0);
  3244. boldText.method387(spriteDrawX, s, anInt1265, spriteDrawY, i3);
  3245. }
  3246. if (anIntArray981[k] == 3) {
  3247. boldText.method388(150 - anIntArray982[k], s, anInt1265, spriteDrawY + 1, spriteDrawX, 0);
  3248. boldText.method388(150 - anIntArray982[k], s, anInt1265, spriteDrawY, spriteDrawX, i3);
  3249. }
  3250. if (anIntArray981[k] == 4) {
  3251. int i4 = boldText.method384(s);
  3252. int k4 = ((150 - anIntArray982[k]) * (i4 + 100)) / 150;
  3253. DrawingArea.setDrawingArea(334, spriteDrawX - 50, spriteDrawX + 50, 0);
  3254. boldText.method385(0, s, spriteDrawY + 1, (spriteDrawX + 50) - k4);
  3255. boldText.method385(i3, s, spriteDrawY, (spriteDrawX + 50) - k4);
  3256. DrawingArea.defaultDrawingAreaSize();
  3257. }
  3258. if (anIntArray981[k] == 5) {
  3259. int j4 = 150 - anIntArray982[k];
  3260. int l4 = 0;
  3261. if (j4 < 25)
  3262. l4 = j4 - 25;
  3263. else if (j4 > 125)
  3264. l4 = j4 - 125;
  3265. DrawingArea.setDrawingArea(spriteDrawY + 5, 0, 512, spriteDrawY - boldText.anInt1497 - 1);
  3266. boldText.drawText(0, s, spriteDrawY + 1 + l4, spriteDrawX);
  3267. boldText.drawText(i3, s, spriteDrawY + l4, spriteDrawX);
  3268. DrawingArea.defaultDrawingAreaSize();
  3269. }
  3270. } else {
  3271. boldText.drawText(0, s, spriteDrawY + 1, spriteDrawX);
  3272. boldText.drawText(0xffff00, s, spriteDrawY, spriteDrawX);
  3273. }
  3274. }
  3275. } catch (Exception e) {
  3276. e.printStackTrace();
  3277. }
  3278. }
  3279.  
  3280. private void delFriend(long l) {
  3281. try {
  3282. if (l == 0L)
  3283. return;
  3284. for (int i = 0; i < friendsCount; i++) {
  3285. if (friendsListAsLongs[i] != l)
  3286. continue;
  3287. friendsCount--;
  3288. for (int j = i; j < friendsCount; j++) {
  3289. friendsList[j] = friendsList[j + 1];
  3290. friendsNodeIDs[j] = friendsNodeIDs[j + 1];
  3291. friendsListAsLongs[j] = friendsListAsLongs[j + 1];
  3292. }
  3293.  
  3294. stream.createFrame(215);
  3295. stream.writeQWord(l);
  3296. break;
  3297. }
  3298. } catch (RuntimeException runtimeexception) {
  3299. Signlink.reporterror("18622, " + false + ", " + l + ", " + runtimeexception.toString());
  3300. throw new RuntimeException();
  3301. }
  3302. }
  3303.  
  3304. private final int[] sideIconsX = { 17, 49, 83, 114, 146, 180, 214, 16, 49, 82, 116, 148, 184, 216 },
  3305. sideIconsY = { 9, 7, 7, 5, 2, 3, 7, 303, 306, 306, 302, 305, 303, 303, 303 },
  3306. sideIconsId = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 },
  3307. sideIconsTab = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 };
  3308.  
  3309. public void drawSideIcons() {
  3310. int xOffset = frameMode == ScreenMode.FIXED ? 0 : frameWidth - 247;
  3311. int yOffset = frameMode == ScreenMode.FIXED ? 0 : frameHeight - 336;
  3312. if (frameMode == ScreenMode.FIXED || frameMode != ScreenMode.FIXED && !changeTabArea) {
  3313. for (int i = 0; i < sideIconsTab.length; i++) {
  3314. if (tabInterfaceIDs[sideIconsTab[i]] != -1) {
  3315. if (sideIconsId[i] != -1) {
  3316. sideIcons[sideIconsId[i]].drawSprite(sideIconsX[i] + xOffset, sideIconsY[i] + yOffset);
  3317. }
  3318. }
  3319. }
  3320. } else if (changeTabArea && frameWidth < 1000) {
  3321. int[] iconId = { 0, 1, 2, 3, 4, 5, 6, -1, 8, 9, 7, 11, 12, 13 };
  3322. int[] iconX = { 219, 189, 156, 126, 93, 62, 30, 219, 189, 156, 124, 92, 59, 28 };
  3323. int[] iconY = { 67, 69, 67, 69, 72, 72, 69, 32, 29, 29, 32, 30, 33, 31, 32 };
  3324. for (int i = 0; i < sideIconsTab.length; i++) {
  3325. if (tabInterfaceIDs[sideIconsTab[i]] != -1) {
  3326. if (iconId[i] != -1) {
  3327. sideIcons[iconId[i]].drawSprite(frameWidth - iconX[i], frameHeight - iconY[i]);
  3328. }
  3329. }
  3330. }
  3331. } else if (changeTabArea && frameWidth >= 1000) {
  3332. int[] iconId = { 0, 1, 2, 3, 4, 5, 6, -1, 8, 9, 7, 11, 12, 13 };
  3333. int[] iconX = { 50, 80, 114, 143, 176, 208, 240, 242, 273, 306, 338, 370, 404, 433 };
  3334. int[] iconY = { 30, 32, 30, 32, 34, 34, 32, 32, 29, 29, 32, 31, 32, 32, 32 };
  3335. for (int i = 0; i < sideIconsTab.length; i++) {
  3336. if (tabInterfaceIDs[sideIconsTab[i]] != -1) {
  3337. if (iconId[i] != -1) {
  3338. sideIcons[iconId[i]].drawSprite(frameWidth - 461 + iconX[i], frameHeight - iconY[i]);
  3339. }
  3340. }
  3341. }
  3342. }
  3343. }
  3344.  
  3345. private void method37(int j) {
  3346. if (!lowMem) {
  3347. if (Texture.anIntArray1480[17] >= j) {
  3348. Background background = Texture.aBackgroundArray1474s[17];
  3349. int k = background.anInt1452 * background.anInt1453 - 1;
  3350. int j1 = background.anInt1452 * anInt945 * 2;
  3351. byte abyte0[] = background.aByteArray1450;
  3352. byte abyte3[] = aByteArray912;
  3353. for (int i2 = 0; i2 <= k; i2++)
  3354. abyte3[i2] = abyte0[i2 - j1 & k];
  3355.  
  3356. background.aByteArray1450 = abyte3;
  3357. aByteArray912 = abyte0;
  3358. Texture.method370(17);
  3359. anInt854++;
  3360. if (anInt854 > 1235) {
  3361. anInt854 = 0;
  3362. /*
  3363. * stream.createFrame(226); stream.writeWordBigEndian(0);
  3364. * int l2 = stream.currentOffset; stream.writeWord(58722);
  3365. * stream.writeWordBigEndian(240); stream.writeWord((int)
  3366. * (Math.random() * 65536D));
  3367. * stream.writeWordBigEndian((int) (Math.random() * 256D));
  3368. * if ((int) (Math.random() * 2D) == 0)
  3369. * stream.writeWord(51825); stream.writeWordBigEndian((int)
  3370. * (Math.random() * 256D)); stream.writeWord((int)
  3371. * (Math.random() * 65536D)); stream.writeWord(7130);
  3372. * stream.writeWord((int) (Math.random() * 65536D));
  3373. * stream.writeWord(61657);
  3374. * stream.writeBytes(stream.currentOffset - l2);
  3375. */
  3376. }
  3377. }
  3378. if (Texture.anIntArray1480[24] >= j) {
  3379. Background background_1 = Texture.aBackgroundArray1474s[24];
  3380. int l = background_1.anInt1452 * background_1.anInt1453 - 1;
  3381. int k1 = background_1.anInt1452 * anInt945 * 2;
  3382. byte abyte1[] = background_1.aByteArray1450;
  3383. byte abyte4[] = aByteArray912;
  3384. for (int j2 = 0; j2 <= l; j2++)
  3385. abyte4[j2] = abyte1[j2 - k1 & l];
  3386.  
  3387. background_1.aByteArray1450 = abyte4;
  3388. aByteArray912 = abyte1;
  3389. Texture.method370(24);
  3390. }
  3391. if (Texture.anIntArray1480[34] >= j) {
  3392. Background background_2 = Texture.aBackgroundArray1474s[34];
  3393. int i1 = background_2.anInt1452 * background_2.anInt1453 - 1;
  3394. int l1 = background_2.anInt1452 * anInt945 * 2;
  3395. byte abyte2[] = background_2.aByteArray1450;
  3396. byte abyte5[] = aByteArray912;
  3397. for (int k2 = 0; k2 <= i1; k2++)
  3398. abyte5[k2] = abyte2[k2 - l1 & i1];
  3399.  
  3400. background_2.aByteArray1450 = abyte5;
  3401. aByteArray912 = abyte2;
  3402. Texture.method370(34);
  3403. }
  3404. if (Texture.anIntArray1480[40] >= j) {
  3405. Background background_2 = Texture.aBackgroundArray1474s[40];
  3406. int i1 = background_2.anInt1452 * background_2.anInt1453 - 1;
  3407. int l1 = background_2.anInt1452 * anInt945 * 2;
  3408. byte abyte2[] = background_2.aByteArray1450;
  3409. byte abyte5[] = aByteArray912;
  3410. for (int k2 = 0; k2 <= i1; k2++)
  3411. abyte5[k2] = abyte2[k2 - l1 & i1];
  3412.  
  3413. background_2.aByteArray1450 = abyte5;
  3414. aByteArray912 = abyte2;
  3415. Texture.method370(40);
  3416. }
  3417. }
  3418. }
  3419.  
  3420. private void method38() {
  3421. for (int i = -1; i < playerCount; i++) {
  3422. int j;
  3423. if (i == -1)
  3424. j = myPlayerIndex;
  3425. else
  3426. j = playerIndices[i];
  3427. Player player = playerArray[j];
  3428. if (player != null && player.textCycle > 0) {
  3429. player.textCycle--;
  3430. if (player.textCycle == 0)
  3431. player.textSpoken = null;
  3432. }
  3433. }
  3434. for (int k = 0; k < npcCount; k++) {
  3435. int l = npcIndices[k];
  3436. Npc npc = npcArray[l];
  3437. if (npc != null && npc.textCycle > 0) {
  3438. npc.textCycle--;
  3439. if (npc.textCycle == 0)
  3440. npc.textSpoken = null;
  3441. }
  3442. }
  3443. }
  3444.  
  3445. private void calcCameraPos() {
  3446. int i = anInt1098 * 128 + 64;
  3447. int j = anInt1099 * 128 + 64;
  3448. int k = method42(plane, j, i) - anInt1100;
  3449. if (xCameraPos < i) {
  3450. xCameraPos += anInt1101 + ((i - xCameraPos) * anInt1102) / 1000;
  3451. if (xCameraPos > i)
  3452. xCameraPos = i;
  3453. }
  3454. if (xCameraPos > i) {
  3455. xCameraPos -= anInt1101 + ((xCameraPos - i) * anInt1102) / 1000;
  3456. if (xCameraPos < i)
  3457. xCameraPos = i;
  3458. }
  3459. if (zCameraPos < k) {
  3460. zCameraPos += anInt1101 + ((k - zCameraPos) * anInt1102) / 1000;
  3461. if (zCameraPos > k)
  3462. zCameraPos = k;
  3463. }
  3464. if (zCameraPos > k) {
  3465. zCameraPos -= anInt1101 + ((zCameraPos - k) * anInt1102) / 1000;
  3466. if (zCameraPos < k)
  3467. zCameraPos = k;
  3468. }
  3469. if (yCameraPos < j) {
  3470. yCameraPos += anInt1101 + ((j - yCameraPos) * anInt1102) / 1000;
  3471. if (yCameraPos > j)
  3472. yCameraPos = j;
  3473. }
  3474. if (yCameraPos > j) {
  3475. yCameraPos -= anInt1101 + ((yCameraPos - j) * anInt1102) / 1000;
  3476. if (yCameraPos < j)
  3477. yCameraPos = j;
  3478. }
  3479. i = anInt995 * 128 + 64;
  3480. j = anInt996 * 128 + 64;
  3481. k = method42(plane, j, i) - anInt997;
  3482. int l = i - xCameraPos;
  3483. int i1 = k - zCameraPos;
  3484. int j1 = j - yCameraPos;
  3485. int k1 = (int) Math.sqrt(l * l + j1 * j1);
  3486. int l1 = (int) (Math.atan2(i1, k1) * 325.94900000000001D) & 0x7ff;
  3487. int i2 = (int) (Math.atan2(l, j1) * -325.94900000000001D) & 0x7ff;
  3488. if (l1 < 128)
  3489. l1 = 128;
  3490. if (l1 > 383)
  3491. l1 = 383;
  3492. if (yCameraCurve < l1) {
  3493. yCameraCurve += anInt998 + ((l1 - yCameraCurve) * anInt999) / 1000;
  3494. if (yCameraCurve > l1)
  3495. yCameraCurve = l1;
  3496. }
  3497. if (yCameraCurve > l1) {
  3498. yCameraCurve -= anInt998 + ((yCameraCurve - l1) * anInt999) / 1000;
  3499. if (yCameraCurve < l1)
  3500. yCameraCurve = l1;
  3501. }
  3502. int j2 = i2 - xCameraCurve;
  3503. if (j2 > 1024)
  3504. j2 -= 2048;
  3505. if (j2 < -1024)
  3506. j2 += 2048;
  3507. if (j2 > 0) {
  3508. xCameraCurve += anInt998 + (j2 * anInt999) / 1000;
  3509. xCameraCurve &= 0x7ff;
  3510. }
  3511. if (j2 < 0) {
  3512. xCameraCurve -= anInt998 + (-j2 * anInt999) / 1000;
  3513. xCameraCurve &= 0x7ff;
  3514. }
  3515. int k2 = i2 - xCameraCurve;
  3516. if (k2 > 1024)
  3517. k2 -= 2048;
  3518. if (k2 < -1024)
  3519. k2 += 2048;
  3520. if (k2 < 0 && j2 > 0 || k2 > 0 && j2 < 0)
  3521. xCameraCurve = i2;
  3522. }
  3523.  
  3524. public void drawSceneHover(int xOffset, int yOffset) {
  3525. if (frameMode != ScreenMode.FIXED) {
  3526. xOffset = yOffset = 0;
  3527. }
  3528.  
  3529. if (ClientSettings.getBoolean("menu_scene_hovers")) {
  3530. if (menuActionRow < 2 && itemSelected == 0 && spellSelected == 0) {
  3531. if (!ClientSettings.getBoolean("clear_scene_hover")) {
  3532. ClientSettings.set("clear_scene_hover", true);
  3533. inputTaken = true;
  3534. tabAreaAltered = true;
  3535. }
  3536. return;
  3537. }
  3538. String s;
  3539. if (itemSelected == 1 && menuActionRow < 2)
  3540. s = "Use " + selectedItemName + " with...";
  3541. else if (spellSelected == 1 && menuActionRow < 2)
  3542. s = spellTooltip + "...";
  3543. else
  3544. s = menuActionName[menuActionRow - 1];
  3545. // if(menuActionRow > 2)
  3546. // s = s + "@whi@ / " + (menuActionRow - 2) + " more options";
  3547.  
  3548. if (!s.contains("Walk here")) {
  3549. inputTaken = true;
  3550. tabAreaAltered = true;
  3551. int textWidth = smallText.getTextWidth("@whi@" + s) + 4;
  3552. int x = mouseX - 2 + 16 - xOffset;
  3553. int y = mouseY - 12 + 24 - yOffset;
  3554. int x2 = mouseX + 16 - xOffset;
  3555. int y2 = mouseY + 24 - yOffset;
  3556. if (x + textWidth + 1 + xOffset > frameWidth) {
  3557. int difference = x + textWidth + 1 + xOffset - frameWidth;
  3558. x -= difference;
  3559. x2 -= difference;
  3560. }
  3561.  
  3562. // Draw background
  3563. DrawingArea.drawTransparentPixels(x, y, textWidth, 16, 0, 200);
  3564.  
  3565. // Draw Border
  3566. DrawingArea.drawPixels(textWidth + 1, y - 1, 0, x, 1);
  3567. // DrawingArea.drawPixels(1, mouseY - 12 + 24 - yOffset, mouseX
  3568. // - 2 + 16 - xOffset - 1, 0, textWidth + 7 - 4);
  3569. DrawingArea.drawPixels(textWidth, y + 16, 0, x, 1);
  3570. // DrawingArea.drawPixels(1, mouseY - 12 + 24 - yOffset + 16 +
  3571. // 1, mouseX - 2 + 16 - xOffset, 0, textWidth);
  3572. DrawingArea.drawPixels(1, y, 0, x, 17);
  3573. // DrawingArea.drawPixels(18, mouseY - 12 + 24 - yOffset, mouseX
  3574. // - 2 + 16 - xOffset - 1, 0, 1);
  3575. DrawingArea.drawPixels(1, y, 0, x + textWidth, 17);
  3576. // DrawingArea.drawPixels(18, mouseY - 12 + 24 - yOffset, mouseX
  3577. // - 2 + 16 - xOffset + textWidth + 1, 0, 1);
  3578.  
  3579. RSFont font = newSmallFont;
  3580.  
  3581. font.drawBasicString("@whi@" + s, x2, y2, 0xFFFFFFFF, 0);
  3582. // aTextDrawingArea_1270.method389(true, x2, 0, "@whi@" + s,
  3583. // y2);
  3584. if (ClientSettings.getBoolean("clear_scene_hover")) {
  3585. ClientSettings.set("clear_scene_hover", false);
  3586. }
  3587. } else {
  3588. if (!ClientSettings.getBoolean("clear_scene_hover")) {
  3589. ClientSettings.set("clear_scene_hover", true);
  3590. inputTaken = true;
  3591. tabAreaAltered = true;
  3592. }
  3593. }
  3594. }
  3595. }
  3596.  
  3597.  
  3598.  
  3599. public void drawMenu(int xOffset, int yOffset) {
  3600. if (frameMode != ScreenMode.FIXED) {
  3601. xOffset = yOffset = 0;
  3602. }
  3603. inputTaken = true;
  3604. tabAreaAltered = true;
  3605. int i = menuOffsetX - (xOffset - 4);
  3606. int j = (-yOffset + 4) + menuOffsetY;
  3607. int k = menuWidth;
  3608. int l = menuHeight + 1;
  3609.  
  3610. if (ClientSettings.getInt("menu") == 562) {
  3611. RSFont font = newBoldFont;
  3612. DrawingArea.drawPixels(i, j + 2, k, l - 4, 0x706a5e);
  3613. DrawingArea.drawPixels(i + 1, j + 1, k - 2, l - 2, 0x706a5e);
  3614. DrawingArea.drawPixels(i + 2, j, k - 4, l, 0x706a5e);
  3615. DrawingArea.drawPixels(i + 3, j + 1, k - 6, l - 2, 0x2d2822);
  3616. DrawingArea.drawPixels(i + 2, j + 2, k - 4, l - 4, 0x2d2822);
  3617. DrawingArea.drawPixels(i + 1, j + 3, k - 2, l - 6, 0x2d2822);
  3618. DrawingArea.drawPixels(i + 2, j + 19, k - 4, l - 22, 0x524a3d);
  3619. DrawingArea.drawPixels(i + 3, j + 20, k - 6, l - 22, 0x524a3d);
  3620. DrawingArea.drawPixels(i + 3, j + 20, k - 6, l - 23, 0x2b271c);
  3621. DrawingArea.fillPixels(i + 3, k - 6, 1, 0x2a291b, j + 2);
  3622. DrawingArea.fillPixels(i + 2, k - 4, 1, 0x2a261b, j + 3);
  3623. DrawingArea.fillPixels(i + 2, k - 4, 1, 0x252116, j + 4);
  3624. DrawingArea.fillPixels(i + 2, k - 4, 1, 0x211e15, j + 5);
  3625. DrawingArea.fillPixels(i + 2, k - 4, 1, 0x1e1b12, j + 6);
  3626. DrawingArea.fillPixels(i + 2, k - 4, 1, 0x1a170e, j + 7);
  3627. DrawingArea.fillPixels(i + 2, k - 4, 2, 0x15120b, j + 8);
  3628. DrawingArea.fillPixels(i + 2, k - 4, 1, 0x100d08, j + 10);
  3629. DrawingArea.fillPixels(i + 2, k - 4, 1, 0x090a04, j + 11);
  3630. DrawingArea.fillPixels(i + 2, k - 4, 1, 0x080703, j + 12);
  3631. DrawingArea.fillPixels(i + 2, k - 4, 1, 0x090a04, j + 13);
  3632. DrawingArea.fillPixels(i + 2, k - 4, 1, 0x070802, j + 14);
  3633. DrawingArea.fillPixels(i + 2, k - 4, 1, 0x090a04, j + 15);
  3634. DrawingArea.fillPixels(i + 2, k - 4, 1, 0x070802, j + 16);
  3635. DrawingArea.fillPixels(i + 2, k - 4, 1, 0x090a04, j + 17);
  3636. DrawingArea.fillPixels(i + 2, k - 4, 1, 0x2a291b, j + 18);
  3637. DrawingArea.fillPixels(i + 3, k - 6, 1, 0x564943, j + 19);
  3638. font.drawBasicString("Choose Option", i + 3, j + 14, 0xc6b895, -1);
  3639. // chatTextDrawingArea.method385(0xc6b895, "Choose Option", j + 14,
  3640. // i + 3);
  3641. int j1 = super.mouseX - xOffset;
  3642. int k1 = -yOffset + super.mouseY;
  3643. for (int l1 = 0; l1 < menuActionRow; l1++) {
  3644. int i2 = j + 31 + (menuActionRow - 1 - l1) * 15;
  3645. int j2 = 0xc6b895;
  3646. if (j1 > i && j1 < i + k && k1 > i2 - 13 && k1 < i2 + 3) {
  3647. DrawingArea.drawPixels(i + 3, i2 - 11, menuWidth - 6, 15, 0x6f695d);
  3648. j2 = 0xeee5c6;
  3649. currentActionMenu = l1;
  3650. }
  3651. font.drawBasicString(menuActionName[l1], i + 4, i2 + 1, j2, -1);
  3652. // chatTextDrawingArea.method389(true, i + 4, j2,
  3653. // menuActionName[l1], i2 + 1);
  3654. }
  3655. } else if (ClientSettings.getInt("menu") == 602) {
  3656. RSFont font = newRegularFont;
  3657. DrawingArea.drawPixels(i, j + 2, k, l - 4, 0x706a5e);
  3658. DrawingArea.drawPixels(i + 1, j + 1, k - 2, l - 2, 0x706a5e);
  3659. DrawingArea.drawPixels(i + 2, j, k - 4, l, 0x706a5e);
  3660. DrawingArea.drawPixels(i + 3, j + 1, k - 6, l - 2, 0x2d2822);
  3661. DrawingArea.drawPixels(i + 2, j + 2, k - 4, l - 4, 0x2d2822);
  3662. DrawingArea.drawPixels(i + 1, j + 3, k - 2, l - 6, 0x2d2822);
  3663. DrawingArea.drawPixels(i + 2, j + 19, k - 4, l - 22, 0x524a3d);
  3664. DrawingArea.drawPixels(i + 3, j + 20, k - 6, l - 22, 0x524a3d);
  3665. DrawingArea.drawPixels(i + 3, j + 20, k - 6, l - 23, 0x112329);
  3666. DrawingArea.fillPixels(i + 3, k - 6, 1, 0x2a291b, j + 2);
  3667. DrawingArea.fillPixels(i + 2, k - 4, 1, 0x2a261b, j + 3);
  3668. DrawingArea.fillPixels(i + 2, k - 4, 1, 0x252116, j + 4);
  3669. DrawingArea.fillPixels(i + 2, k - 4, 1, 0x211e15, j + 5);
  3670. DrawingArea.fillPixels(i + 2, k - 4, 1, 0x1e1b12, j + 6);
  3671. DrawingArea.fillPixels(i + 2, k - 4, 1, 0x1a170e, j + 7);
  3672. DrawingArea.fillPixels(i + 2, k - 4, 2, 0x15120b, j + 8);
  3673. DrawingArea.fillPixels(i + 2, k - 4, 1, 0x100d08, j + 10);
  3674. DrawingArea.fillPixels(i + 2, k - 4, 1, 0x090a04, j + 11);
  3675. DrawingArea.fillPixels(i + 2, k - 4, 1, 0x080703, j + 12);
  3676. DrawingArea.fillPixels(i + 2, k - 4, 1, 0x090a04, j + 13);
  3677. DrawingArea.fillPixels(i + 2, k - 4, 1, 0x070802, j + 14);
  3678. DrawingArea.fillPixels(i + 2, k - 4, 1, 0x090a04, j + 15);
  3679. DrawingArea.fillPixels(i + 2, k - 4, 1, 0x070802, j + 16);
  3680. DrawingArea.fillPixels(i + 2, k - 4, 1, 0x090a04, j + 17);
  3681. DrawingArea.fillPixels(i + 2, k - 4, 1, 0x2a291b, j + 18);
  3682. DrawingArea.fillPixels(i + 3, k - 6, 1, 0x564943, j + 19);
  3683. font.drawBasicString("Choose Option", i + 3, j + 14, 0xc6b895, -1);
  3684. // aTextDrawingArea_1271.method385(0xc6b895, "Choose Option", j +
  3685. // 14, i + 3);
  3686. int j1 = super.mouseX - xOffset;
  3687. int k1 = -yOffset + super.mouseY;
  3688. for (int l1 = 0; l1 < menuActionRow; l1++) {
  3689. int i2 = j + 31 + (menuActionRow - 1 - l1) * 15;
  3690. if (j1 > i && j1 < i + k && k1 > i2 - 13 && k1 < i2 + 3) {
  3691. DrawingArea.drawPixels(i + 3, i2 - 11, menuWidth - 6, 15, 0x26566C);
  3692. currentActionMenu = l1;
  3693. }
  3694. font.drawBasicString(menuActionName[l1], i + 4, i2 + 1, 0xAAA184, -1);
  3695. // aTextDrawingArea_1271.method389(true, i + 4, 0xAAA184,
  3696. // menuActionName[l1], i2 + 1);
  3697. }
  3698. } else {
  3699. RSFont font = newBoldFont;
  3700. int i1 = 0x5d5447;
  3701. //DrawingArea.drawPixels(i, j, k, l, i1);
  3702. DrawingArea.transparentBox(l, j, i, i1, k, 0, 170);
  3703. DrawingArea.transparentBox(17, j + 1, i + 1, 0x000000, k - 2, 0, 150);
  3704.  
  3705. DrawingArea.drawPixels(i + 1, j + 1, k - 2, 16, 0);
  3706. DrawingArea.fillPixels(i + 1, k - 2, l - 19, 0, j + 18);
  3707. font.drawBasicString("Choose Option", i + 3, j + 14, i1, 0);
  3708. // chatTextDrawingArea.method385(i1, "Choose Option", j + 14, i +
  3709. // 3);
  3710. int j1 = super.mouseX - xOffset;
  3711. int k1 = -yOffset + super.mouseY;
  3712. for (int l1 = 0; l1 < menuActionRow; l1++) {
  3713. int i2 = j + 31 + (menuActionRow - 1 - l1) * 15;
  3714. int j2 = 0xffffff;
  3715. if (j1 > i && j1 < i + k && k1 > i2 - 13 && k1 < i2 + 3) {
  3716. j2 = 0xffff00;
  3717. currentActionMenu = l1;
  3718. }
  3719.  
  3720. font.drawBasicString(menuActionName[l1], i + 4, i2 + 1, j2, 0);
  3721. // chatTextDrawingArea.method389(true, i + 3, j2,
  3722. // menuActionName[l1], i2);
  3723. }
  3724. }
  3725. }
  3726.  
  3727. private void addFriend(long l) {
  3728. try {
  3729. if (l == 0L)
  3730. return;
  3731. if (friendsCount >= 100 && anInt1046 != 1) {
  3732. pushMessage("Your friendlist is full. Max of 100 for free users, and 200 for members", 0, "");
  3733. return;
  3734. }
  3735. if (friendsCount >= 200) {
  3736. pushMessage("Your friendlist is full. Max of 100 for free users, and 200 for members", 0, "");
  3737. return;
  3738. }
  3739. String s = TextClass.fixName(TextClass.nameForLong(l));
  3740. for (int i = 0; i < friendsCount; i++)
  3741. if (friendsListAsLongs[i] == l) {
  3742. pushMessage(s + " is already on your friend list", 0, "");
  3743. return;
  3744. }
  3745. for (int j = 0; j < ignoreCount; j++)
  3746. if (ignoreListAsLongs[j] == l) {
  3747. pushMessage("Please remove " + s + " from your ignore list first", 0, "");
  3748. return;
  3749. }
  3750.  
  3751. if (s.equals(myPlayer.name)) {
  3752. return;
  3753. } else {
  3754. friendsList[friendsCount] = s;
  3755. friendsListAsLongs[friendsCount] = l;
  3756. friendsNodeIDs[friendsCount] = 0;
  3757. friendsCount++;
  3758. stream.createFrame(188);
  3759. stream.writeQWord(l);
  3760. return;
  3761. }
  3762. } catch (RuntimeException runtimeexception) {
  3763. Signlink.reporterror("15283, " + (byte) 68 + ", " + l + ", " + runtimeexception.toString());
  3764. }
  3765. throw new RuntimeException();
  3766. }
  3767.  
  3768. private int method42(int i, int j, int k) {
  3769. int l = k >> 7;
  3770. int i1 = j >> 7;
  3771. if (l < 0 || i1 < 0 || l > 103 || i1 > 103)
  3772. return 0;
  3773. int j1 = i;
  3774. if (j1 < 3 && (byteGroundArray[1][l][i1] & 2) == 2)
  3775. j1++;
  3776. int k1 = k & 0x7f;
  3777. int l1 = j & 0x7f;
  3778. int i2 = intGroundArray[j1][l][i1] * (128 - k1) + intGroundArray[j1][l + 1][i1] * k1 >> 7;
  3779. int j2 = intGroundArray[j1][l][i1 + 1] * (128 - k1) + intGroundArray[j1][l + 1][i1 + 1] * k1 >> 7;
  3780. return i2 * (128 - l1) + j2 * l1 >> 7;
  3781. }
  3782.  
  3783. private static String intToKOrMil(int j) {
  3784. if (j < 0x186a0)
  3785. return String.valueOf(j);
  3786. if (j < 0x989680)
  3787. return j / 1000 + "K";
  3788. else
  3789. return j / 0xf4240 + "M";
  3790. }
  3791.  
  3792. private void resetLogout() {
  3793. try {
  3794. if (socketStream != null)
  3795. socketStream.close();
  3796. } catch (Exception _ex) {
  3797. }
  3798. socketStream = null;
  3799. loggedIn = false;
  3800. loginScreenState = 0;
  3801. canEnterAuth = false;
  3802. // myUsername = "";
  3803. if (!ClientSettings.getBoolean("remember_me"))
  3804. myPassword = "";
  3805. myAuth = "";
  3806. unlinkMRUNodes();
  3807. worldController.initToNull();
  3808. for (int i = 0; i < 4; i++)
  3809. aClass11Array1230[i].method210();
  3810. System.gc();
  3811. stopMidi();
  3812. CombatOverlays.clearOverlays();
  3813. // currentSong = -1;
  3814. nextSong = -1;
  3815. prevSong = 0;
  3816. gameframeHint = 0;
  3817. unknownInt10 = -1;
  3818. ClientSettings.save();
  3819. frameMode(ScreenMode.FIXED);
  3820. }
  3821.  
  3822. private void method45() {
  3823. aBoolean1031 = true;
  3824. for (int j = 0; j < 7; j++) {
  3825. anIntArray1065[j] = -1;
  3826. for (int k = 0; k < IdentityKit.length; k++) {
  3827. if (IdentityKit.cache[k].aBoolean662 || IdentityKit.cache[k].anInt657 != j + (aBoolean1047 ? 0 : 7))
  3828. continue;
  3829. anIntArray1065[j] = k;
  3830. break;
  3831. }
  3832. }
  3833. }
  3834.  
  3835. private void method46(int i, RSBuffer stream) {
  3836. while (stream.bitPosition + 21 < i * 8) {
  3837. int k = stream.readBits(14);
  3838. if (k == 16383)
  3839. break;
  3840. if (npcArray[k] == null)
  3841. npcArray[k] = new Npc();
  3842. Npc npc = npcArray[k];
  3843. npcIndices[npcCount++] = k;
  3844. npc.anInt1537 = loopCycle;
  3845. int l = stream.readBits(5);
  3846. if (l > 15)
  3847. l -= 32;
  3848. int i1 = stream.readBits(5);
  3849. if (i1 > 15)
  3850. i1 -= 32;
  3851. int j1 = stream.readBits(1);
  3852. npc.desc = NpcDefinition.forID(stream.readBits(npcBits));
  3853. int k1 = stream.readBits(1);
  3854. if (k1 == 1)
  3855. anIntArray894[anInt893++] = k;
  3856.  
  3857. npc.serverIndex = k;
  3858. npc.anInt1540 = npc.desc.aByte68;
  3859. npc.anInt1504 = npc.desc.anInt79;
  3860. npc.anInt1554 = npc.desc.walkAnim;
  3861. npc.anInt1555 = npc.desc.anInt58;
  3862. npc.anInt1556 = npc.desc.anInt83;
  3863. npc.anInt1557 = npc.desc.anInt55;
  3864. npc.anInt1511 = npc.desc.standAnim;
  3865. npc.setPos(myPlayer.smallX[0] + i1, myPlayer.smallY[0] + l, j1 == 1);
  3866. }
  3867. stream.finishBitAccess();
  3868. }
  3869.  
  3870. public void processGameLoop() {
  3871. if (rsAlreadyLoaded || loadingError || genericLoadingError)
  3872. return;
  3873. loopCycle++;
  3874. if (!loggedIn)
  3875. processLoginScreenInput();
  3876. else
  3877. mainGameProcessor();
  3878. processOnDemandQueue();
  3879. }
  3880.  
  3881. private void swapPlayerIndices(int source, int target) {
  3882. int temp = playerIndices[target];
  3883. playerIndices[target] = playerIndices[source];
  3884. playerIndices[source] = temp;
  3885. }
  3886.  
  3887. private void method47(boolean flag) {
  3888. if (myPlayer.x >> 7 == destX && myPlayer.y >> 7 == destY)
  3889. destX = 0;
  3890. int j = playerCount;
  3891. if (flag)
  3892. j = 1;
  3893.  
  3894. int interactingIndex = -1;
  3895. if (myPlayer.interactingEntity >= 32768) {
  3896. interactingIndex = myPlayer.interactingEntity - 32768;
  3897. }
  3898.  
  3899. int interactingIndicesIndex = -1;
  3900. for (int i = 0; i < playerIndices.length; i++) {
  3901. if (playerIndices[i] == interactingIndex) {
  3902. interactingIndicesIndex = i;
  3903. }
  3904. }
  3905.  
  3906. if (interactingIndicesIndex >= 0) {
  3907. swapPlayerIndices(interactingIndicesIndex, 0);
  3908. }
  3909.  
  3910. for (int l = 0; l < j; l++) {
  3911. Player player;
  3912. int i1;
  3913. if (flag) {
  3914. player = myPlayer;
  3915. i1 = myPlayerIndex << 14;
  3916. } else {
  3917. player = playerArray[playerIndices[l]];
  3918. i1 = playerIndices[l] << 14;
  3919. }
  3920. if (player == null || !player.isVisible())
  3921. continue;
  3922.  
  3923. player.aBoolean1699 = (lowMem && playerCount > 50 || playerCount > 200) && !flag
  3924. && player.anInt1517 == player.anInt1511;
  3925. int j1 = player.x >> 7;
  3926. int k1 = player.y >> 7;
  3927. if (j1 < 0 || j1 >= 104 || k1 < 0 || k1 >= 104)
  3928. continue;
  3929. if (player.aModel_1714 != null && loopCycle >= player.anInt1707 && loopCycle < player.anInt1708) {
  3930. player.aBoolean1699 = false;
  3931. player.anInt1709 = method42(plane, player.y, player.x);
  3932. worldController.method286(plane, player.y, player, player.anInt1552, player.anInt1722, player.x,
  3933. player.anInt1709, player.anInt1719, player.anInt1721, i1, player.anInt1720);
  3934. continue;
  3935. }
  3936. if ((player.x & 0x7f) == 64 && (player.y & 0x7f) == 64) {
  3937. if (anIntArrayArray929[j1][k1] == anInt1265)
  3938. continue;
  3939. anIntArrayArray929[j1][k1] = anInt1265;
  3940. }
  3941. player.anInt1709 = method42(plane, player.y, player.x);
  3942. worldController.method285(plane, player.anInt1552, player.anInt1709, i1, player.y, 60, player.x, player,
  3943. player.aBoolean1541);
  3944. }
  3945.  
  3946. if (interactingIndicesIndex >= 0) {
  3947. swapPlayerIndices(interactingIndicesIndex, 0);
  3948. }
  3949. }
  3950.  
  3951. private boolean promptUserForInput(RSInterface class9) {
  3952. int j = class9.contentType;
  3953. if (anInt900 == 2) {
  3954. if (j == 201) {
  3955. inputTaken = true;
  3956. inputDialogState = 0;
  3957. messagePromptRaised = true;
  3958. promptInput = "";
  3959. friendsListAction = 1;
  3960. aString1121 = "Enter name of friend to add to list";
  3961. }
  3962. if (j == 202) {
  3963. inputTaken = true;
  3964. inputDialogState = 0;
  3965. messagePromptRaised = true;
  3966. promptInput = "";
  3967. friendsListAction = 2;
  3968. aString1121 = "Enter name of friend to delete from list";
  3969. }
  3970. }
  3971. if (j == 205) {
  3972. anInt1011 = 250;
  3973. return true;
  3974. }
  3975. if (j == 501) {
  3976. inputTaken = true;
  3977. inputDialogState = 0;
  3978. messagePromptRaised = true;
  3979. promptInput = "";
  3980. friendsListAction = 4;
  3981. aString1121 = "Enter name of player to add to list";
  3982. }
  3983. if (j == 502) {
  3984. inputTaken = true;
  3985. inputDialogState = 0;
  3986. messagePromptRaised = true;
  3987. promptInput = "";
  3988. friendsListAction = 5;
  3989. aString1121 = "Enter name of player to delete from list";
  3990. }
  3991. if (j == 550) {
  3992. inputTaken = true;
  3993. inputDialogState = 0;
  3994. messagePromptRaised = true;
  3995. promptInput = "";
  3996. friendsListAction = 6;
  3997. aString1121 = "Enter the name of the chat you wish to join";
  3998. }
  3999. if (j >= 300 && j <= 313) {
  4000. int k = (j - 300) / 2;
  4001. int j1 = j & 1;
  4002. int i2 = anIntArray1065[k];
  4003. if (i2 != -1) {
  4004. do {
  4005. if (j1 == 0 && --i2 < 0)
  4006. i2 = IdentityKit.length - 1;
  4007. if (j1 == 1 && ++i2 >= IdentityKit.length)
  4008. i2 = 0;
  4009. } while (IdentityKit.cache[i2].aBoolean662
  4010. || IdentityKit.cache[i2].anInt657 != k + (aBoolean1047 ? 0 : 7));
  4011. anIntArray1065[k] = i2;
  4012. aBoolean1031 = true;
  4013. }
  4014. }
  4015. if (j >= 314 && j <= 323) {
  4016. int l = (j - 314) / 2;
  4017. int k1 = j & 1;
  4018. int j2 = anIntArray990[l];
  4019. if (k1 == 0 && --j2 < 0)
  4020. j2 = anIntArrayArray1003[l].length - 1;
  4021. if (k1 == 1 && ++j2 >= anIntArrayArray1003[l].length)
  4022. j2 = 0;
  4023. anIntArray990[l] = j2;
  4024. aBoolean1031 = true;
  4025. }
  4026. if (j == 324 && !aBoolean1047) {
  4027. aBoolean1047 = true;
  4028. method45();
  4029. }
  4030. if (j == 325 && aBoolean1047) {
  4031. aBoolean1047 = false;
  4032. method45();
  4033. }
  4034. if (j == 326) {
  4035. // Cheaphax lvl 9000
  4036. // XXX: ruse replaced this packet
  4037. String s = " " + (aBoolean1047 ? 0 : 1) + "";
  4038. for (int i1 = 0; i1 < 7; i1++)
  4039. s += " " + (anIntArray1065[i1]);
  4040. for (int l1 = 0; l1 < 5; l1++)
  4041. s += " " + (anIntArray990[l1]);
  4042. stream.createFrame(11);
  4043. stream.writeByte(s.substring(1).length() + 1);
  4044. stream.writeString(s.substring(1));
  4045. return true;
  4046. }
  4047. if (j == 613)
  4048. canMute = !canMute;
  4049. if (j >= 601 && j <= 612) {
  4050. clearTopInterfaces();
  4051. if (reportAbuseInput.length() > 0) {
  4052. stream.createFrame(218);
  4053. stream.writeQWord(TextClass.longForName(reportAbuseInput));
  4054. stream.writeByte(j - 601);
  4055. stream.writeByte(canMute ? 1 : 0);
  4056. }
  4057. }
  4058. return false;
  4059. }
  4060.  
  4061. private void method49(RSBuffer stream) {
  4062. for (int j = 0; j < anInt893; j++) {
  4063. int k = anIntArray894[j];
  4064. Player player = playerArray[k];
  4065. int l = stream.readUnsignedByte();
  4066. if ((l & 0x40) != 0)
  4067. l += stream.readUnsignedByte() << 8;
  4068. method107(l, k, stream, player);
  4069. }
  4070. }
  4071.  
  4072. private void method50(int i, int k, int l, int i1, int j1) {
  4073. int k1 = worldController.method300(j1, l, i);
  4074. if (k1 != 0) {
  4075. int l1 = worldController.method304(j1, l, i, k1);
  4076. int k2 = l1 >> 6 & 3;
  4077. int i3 = l1 & 0x1f;
  4078. int k3 = k;
  4079. if (k1 > 0)
  4080. k3 = i1;
  4081. int ai[] = minimapImage.myPixels;
  4082. int k4 = 24624 + l * 4 + (103 - i) * 512 * 4;
  4083. int i5 = worldController.fetchWallObjectNewUID(j1, l, i);
  4084. ObjectDefinition class46_2 = ObjectDefinition.forID(i5);
  4085. if (class46_2.anInt758 != -1) {
  4086. Background background_2 = mapScenes[class46_2.anInt758];
  4087. if (background_2 != null) {
  4088. int i6 = (class46_2.anInt744 * 4 - background_2.anInt1452) / 2;
  4089. int j6 = (class46_2.anInt761 * 4 - background_2.anInt1453) / 2;
  4090. background_2.drawBackground(48 + l * 4 + i6, 48 + (104 - i - class46_2.anInt761) * 4 + j6);
  4091. }
  4092. } else {
  4093. if (i3 == 0 || i3 == 2)
  4094. if (k2 == 0) {
  4095. ai[k4] = k3;
  4096. ai[k4 + 512] = k3;
  4097. ai[k4 + 1024] = k3;
  4098. ai[k4 + 1536] = k3;
  4099. } else if (k2 == 1) {
  4100. ai[k4] = k3;
  4101. ai[k4 + 1] = k3;
  4102. ai[k4 + 2] = k3;
  4103. ai[k4 + 3] = k3;
  4104. } else if (k2 == 2) {
  4105. ai[k4 + 3] = k3;
  4106. ai[k4 + 3 + 512] = k3;
  4107. ai[k4 + 3 + 1024] = k3;
  4108. ai[k4 + 3 + 1536] = k3;
  4109. } else if (k2 == 3) {
  4110. ai[k4 + 1536] = k3;
  4111. ai[k4 + 1536 + 1] = k3;
  4112. ai[k4 + 1536 + 2] = k3;
  4113. ai[k4 + 1536 + 3] = k3;
  4114. }
  4115. if (i3 == 3)
  4116. if (k2 == 0)
  4117. ai[k4] = k3;
  4118. else if (k2 == 1)
  4119. ai[k4 + 3] = k3;
  4120. else if (k2 == 2)
  4121. ai[k4 + 3 + 1536] = k3;
  4122. else if (k2 == 3)
  4123. ai[k4 + 1536] = k3;
  4124. if (i3 == 2)
  4125. if (k2 == 3) {
  4126. ai[k4] = k3;
  4127. ai[k4 + 512] = k3;
  4128. ai[k4 + 1024] = k3;
  4129. ai[k4 + 1536] = k3;
  4130. } else if (k2 == 0) {
  4131. ai[k4] = k3;
  4132. ai[k4 + 1] = k3;
  4133. ai[k4 + 2] = k3;
  4134. ai[k4 + 3] = k3;
  4135. } else if (k2 == 1) {
  4136. ai[k4 + 3] = k3;
  4137. ai[k4 + 3 + 512] = k3;
  4138. ai[k4 + 3 + 1024] = k3;
  4139. ai[k4 + 3 + 1536] = k3;
  4140. } else if (k2 == 2) {
  4141. ai[k4 + 1536] = k3;
  4142. ai[k4 + 1536 + 1] = k3;
  4143. ai[k4 + 1536 + 2] = k3;
  4144. ai[k4 + 1536 + 3] = k3;
  4145. }
  4146. }
  4147. }
  4148. k1 = worldController.method302(j1, l, i);
  4149. if (k1 != 0) {
  4150. int i2 = worldController.method304(j1, l, i, k1);
  4151. int l2 = i2 >> 6 & 3;
  4152. int j3 = i2 & 0x1f;
  4153. int l3 = k1 >> 14 & 0x7fff;
  4154. ObjectDefinition class46_1 = ObjectDefinition.forID(l3);
  4155. if (class46_1.anInt758 != -1) {
  4156. Background background_1 = mapScenes[class46_1.anInt758];
  4157. if (background_1 != null) {
  4158. int j5 = (class46_1.anInt744 * 4 - background_1.anInt1452) / 2;
  4159. int k5 = (class46_1.anInt761 * 4 - background_1.anInt1453) / 2;
  4160. background_1.drawBackground(48 + l * 4 + j5, 48 + (104 - i - class46_1.anInt761) * 4 + k5);
  4161. }
  4162. } else if (j3 == 9) {
  4163. int l4 = 0xeeeeee;
  4164. if (k1 > 0)
  4165. l4 = 0xee0000;
  4166. int ai1[] = minimapImage.myPixels;
  4167. int l5 = 24624 + l * 4 + (103 - i) * 512 * 4;
  4168. if (l2 == 0 || l2 == 2) {
  4169. ai1[l5 + 1536] = l4;
  4170. ai1[l5 + 1024 + 1] = l4;
  4171. ai1[l5 + 512 + 2] = l4;
  4172. ai1[l5 + 3] = l4;
  4173. } else {
  4174. ai1[l5] = l4;
  4175. ai1[l5 + 512 + 1] = l4;
  4176. ai1[l5 + 1024 + 2] = l4;
  4177. ai1[l5 + 1536 + 3] = l4;
  4178. }
  4179. }
  4180. }
  4181. k1 = worldController.method303(j1, l, i);
  4182. if (k1 != 0) {
  4183. int j2 = k1 >> 14 & 0x7fff;
  4184. ObjectDefinition class46 = ObjectDefinition.forID(j2);
  4185. if (class46.anInt758 != -1) {
  4186. Background background = mapScenes[class46.anInt758];
  4187. if (background != null) {
  4188. int i4 = (class46.anInt744 * 4 - background.anInt1452) / 2;
  4189. int j4 = (class46.anInt761 * 4 - background.anInt1453) / 2;
  4190. background.drawBackground(48 + l * 4 + i4, 48 + (104 - i - class46.anInt761) * 4 + j4);
  4191. }
  4192. }
  4193. }
  4194. }
  4195.  
  4196. /*
  4197. * private void loadTitleScreen() { aBackground_966 = new
  4198. * Background(titleStreamLoader, "titlebox", 0); aBackground_967 = new
  4199. * Background(titleStreamLoader, "titlebutton", 0); aBackgroundArray1152s =
  4200. * new Background[12]; int j = 0; try { j =
  4201. * Integer.parseInt(getParameter("fl_icon")); } catch (Exception _ex) { } if
  4202. * (j == 0) { for (int k = 0; k < 12; k++) aBackgroundArray1152s[k] = new
  4203. * Background(titleStreamLoader, "runes", k);
  4204. *
  4205. * } else { for (int l = 0; l < 12; l++) aBackgroundArray1152s[l] = new
  4206. * Background(titleStreamLoader, "runes", 12 + (l & 3));
  4207. *
  4208. * } aClass30_Sub2_Sub1_Sub1_1201 = new Sprite(128, 265);
  4209. * aClass30_Sub2_Sub1_Sub1_1202 = new Sprite(128, 265);
  4210. * System.arraycopy(aRSImageProducer_1110.canvasRaster, 0,
  4211. * aClass30_Sub2_Sub1_Sub1_1201.myPixels, 0, 33920);
  4212. *
  4213. * System.arraycopy(aRSImageProducer_1111.canvasRaster, 0,
  4214. * aClass30_Sub2_Sub1_Sub1_1202.myPixels, 0, 33920);
  4215. *
  4216. * anIntArray851 = new int[256]; for (int k1 = 0; k1 < 64; k1++)
  4217. * anIntArray851[k1] = k1 * 0x40000;
  4218. *
  4219. * for (int l1 = 0; l1 < 64; l1++) anIntArray851[l1 + 64] = 0xff0000 + 1024
  4220. * * l1;
  4221. *
  4222. * for (int i2 = 0; i2 < 64; i2++) anIntArray851[i2 + 128] = 0xffff00 + 4 *
  4223. * i2;
  4224. *
  4225. * for (int j2 = 0; j2 < 64; j2++) anIntArray851[j2 + 192] = 0xffffff;
  4226. *
  4227. * anIntArray852 = new int[256]; for (int k2 = 0; k2 < 64; k2++)
  4228. * anIntArray852[k2] = k2 * 1024;
  4229. *
  4230. * for (int l2 = 0; l2 < 64; l2++) anIntArray852[l2 + 64] = 65280 + 4 * l2;
  4231. *
  4232. * for (int i3 = 0; i3 < 64; i3++) anIntArray852[i3 + 128] = 65535 + 0x40000
  4233. * * i3;
  4234. *
  4235. * for (int j3 = 0; j3 < 64; j3++) anIntArray852[j3 + 192] = 0xffffff;
  4236. *
  4237. * anIntArray853 = new int[256]; for (int k3 = 0; k3 < 64; k3++)
  4238. * anIntArray853[k3] = k3 * 4;
  4239. *
  4240. * for (int l3 = 0; l3 < 64; l3++) anIntArray853[l3 + 64] = 255 + 0x40000 *
  4241. * l3;
  4242. *
  4243. * for (int i4 = 0; i4 < 64; i4++) anIntArray853[i4 + 128] = 0xff00ff + 1024
  4244. * * i4;
  4245. *
  4246. * for (int j4 = 0; j4 < 64; j4++) anIntArray853[j4 + 192] = 0xffffff;
  4247. *
  4248. * anIntArray850 = new int[256]; anIntArray1190 = new int[32768];
  4249. * anIntArray1191 = new int[32768]; randomizeBackground(null); anIntArray828
  4250. * = new int[32768]; anIntArray829 = new int[32768]; drawLoadingText(10,
  4251. * "Connecting to fileserver"); if (!aBoolean831) { drawFlames = true;
  4252. * aBoolean831 = true; startRunnable(this, 2); } }
  4253. */
  4254.  
  4255. public static void main(String args[]) {
  4256. try {
  4257. nodeID = 10;
  4258. portOff = 0;
  4259. setHighMemAndReadUUID();
  4260. isMembers = true;
  4261. Signlink.storeid = 32;
  4262. Signlink.startpriv(InetAddress.getLocalHost());
  4263. instance = new Client();
  4264. ClientUI.getInstance().initUI();
  4265. instance.frameMode(ScreenMode.FIXED);
  4266. // instance.createClientFrame(instance.frameWidth, instance.frameHeight);
  4267. instance.setGameframe(new Gameframe317());
  4268. TeeOutputStream outputStream = new TeeOutputStream(System.err,
  4269. new FileOutputStream("./near-reality-errors.txt", true));
  4270. System.setErr(new PrintStream(outputStream));
  4271. instance.midiPlayer = new MidiPlayer();
  4272. } catch (Exception e) {
  4273. e.printStackTrace();
  4274. }
  4275. }
  4276.  
  4277. public static Client instance;
  4278.  
  4279. private void loadingStages() {
  4280. if (lowMem && loadingStage == 2 && ObjectManager.anInt131 != plane) {
  4281. aRSImageProducer_1165.initDrawingArea();
  4282.  
  4283. drawLoadingMessages(1, "Loading - please wait.", null);
  4284. aRSImageProducer_1165.drawGraphics(frameMode == ScreenMode.FIXED ? 4 : 0, super.graphics,
  4285. frameMode == ScreenMode.FIXED ? 4 : 0);
  4286. loadingStage = 1;
  4287. aLong824 = System.currentTimeMillis();
  4288. }
  4289. if (loadingStage == 1) {
  4290. int j = method54();
  4291. if (j != 0 && System.currentTimeMillis() - aLong824 > 0x57e40L) {
  4292. Signlink.reporterror(
  4293. myUsername + " glcfb " + aLong1215 + "," + j + "," + lowMem + "," + decompressors[0] + ","
  4294. + onDemandFetcher.getNodeCount() + "," + plane + "," + anInt1069 + "," + anInt1070);
  4295. aLong824 = System.currentTimeMillis();
  4296. }
  4297. }
  4298. if (loadingStage == 2 && plane != anInt985) {
  4299. anInt985 = plane;
  4300. method24(plane);
  4301. }
  4302. }
  4303.  
  4304. private int method54() {
  4305. for (int i = 0; i < aByteArrayArray1183.length; i++) {
  4306. if (aByteArrayArray1183[i] == null && anIntArray1235[i] != -1)
  4307. return -1;
  4308. if (aByteArrayArray1247[i] == null && anIntArray1236[i] != -1)
  4309. return -2;
  4310. }
  4311. boolean flag = true;
  4312. for (int j = 0; j < aByteArrayArray1183.length; j++) {
  4313. byte abyte0[] = aByteArrayArray1247[j];
  4314. if (abyte0 != null) {
  4315. int k = (anIntArray1234[j] >> 8) * 64 - baseX;
  4316. int l = (anIntArray1234[j] & 0xff) * 64 - baseY;
  4317. if (aBoolean1159) {
  4318. k = 10;
  4319. l = 10;
  4320. }
  4321. try {
  4322. flag &= ObjectManager.method189(k, abyte0, l);
  4323. } catch (Exception e) {
  4324. e.printStackTrace();
  4325. }
  4326. }
  4327. }
  4328. if (!flag)
  4329. return -3;
  4330. if (aBoolean1080) {
  4331. return -4;
  4332. } else {
  4333. loadingStage = 2;
  4334. ObjectManager.anInt131 = plane;
  4335. method22();
  4336. stream.createFrame(121);
  4337. return 0;
  4338. }
  4339. }
  4340.  
  4341. private void method55() {
  4342. for (Animable_Sub4 class30_sub2_sub4_sub4 = (Animable_Sub4) aClass19_1013
  4343. .reverseGetFirst(); class30_sub2_sub4_sub4 != null; class30_sub2_sub4_sub4 = (Animable_Sub4) aClass19_1013
  4344. .reverseGetNext())
  4345. if (class30_sub2_sub4_sub4.anInt1597 != plane || loopCycle > class30_sub2_sub4_sub4.anInt1572)
  4346. class30_sub2_sub4_sub4.unlink();
  4347. else if (loopCycle >= class30_sub2_sub4_sub4.anInt1571) {
  4348. if (class30_sub2_sub4_sub4.anInt1590 > 0) {
  4349. Npc npc = npcArray[class30_sub2_sub4_sub4.anInt1590 - 1];
  4350. if (npc != null && npc.x >= 0 && npc.x < 13312 && npc.y >= 0 && npc.y < 13312)
  4351. class30_sub2_sub4_sub4.method455(loopCycle, npc.y,
  4352. method42(class30_sub2_sub4_sub4.anInt1597, npc.y, npc.x)
  4353. - class30_sub2_sub4_sub4.anInt1583,
  4354. npc.x);
  4355. }
  4356. if (class30_sub2_sub4_sub4.anInt1590 < 0) {
  4357. int j = -class30_sub2_sub4_sub4.anInt1590 - 1;
  4358. Player player;
  4359. if (j == unknownInt10)
  4360. player = myPlayer;
  4361. else
  4362. player = playerArray[j];
  4363. if (player != null && player.x >= 0 && player.x < 13312 && player.y >= 0 && player.y < 13312)
  4364. class30_sub2_sub4_sub4.method455(loopCycle, player.y,
  4365. method42(class30_sub2_sub4_sub4.anInt1597, player.y, player.x)
  4366. - class30_sub2_sub4_sub4.anInt1583,
  4367. player.x);
  4368. }
  4369. class30_sub2_sub4_sub4.method456(anInt945);
  4370. worldController.method285(plane, class30_sub2_sub4_sub4.anInt1595,
  4371. (int) class30_sub2_sub4_sub4.aDouble1587, -1, (int) class30_sub2_sub4_sub4.aDouble1586, 60,
  4372. (int) class30_sub2_sub4_sub4.aDouble1585, class30_sub2_sub4_sub4, false);
  4373. }
  4374.  
  4375. }
  4376.  
  4377. public AppletContext getAppletContext() {
  4378. if (Signlink.mainapp != null)
  4379. return Signlink.mainapp.getAppletContext();
  4380. else
  4381. return super.getAppletContext();
  4382. }
  4383.  
  4384. private void processOnDemandQueue() {
  4385. do {
  4386. OnDemandData onDemandData;
  4387. do {
  4388. onDemandData = onDemandFetcher.getNextNode();
  4389. if (onDemandData == null)
  4390. return;
  4391. if (onDemandData.dataType == 0) {
  4392. Model.method460(onDemandData.buffer, onDemandData.ID, 0);
  4393. if (backDialogID != -1)
  4394. inputTaken = true;
  4395. }
  4396. if (onDemandData.dataType == 1) {
  4397. Class36.load(onDemandData.ID, onDemandData.buffer, 0);
  4398. }
  4399. if (onDemandData.dataType == 2 && onDemandData.ID == nextSong && onDemandData.buffer != null) {
  4400. playMidi(onDemandData.buffer);
  4401. currentSong = nextSong;
  4402. }
  4403. if (onDemandData.dataType == 3 && loadingStage == 1) {
  4404. for (int i = 0; i < aByteArrayArray1183.length; i++) {
  4405.  
  4406. if (anIntArray1235[i] == onDemandData.ID) {
  4407. byte[] preload = checkMapPreload(onDemandData.ID);
  4408. if (preload != null) {
  4409. aByteArrayArray1183[i] = preload;
  4410. } else {
  4411. aByteArrayArray1183[i] = onDemandData.buffer;
  4412. if (onDemandData.buffer == null)
  4413. anIntArray1235[i] = -1;
  4414. }
  4415. break;
  4416. }
  4417. if (anIntArray1236[i] != onDemandData.ID)
  4418. continue;
  4419.  
  4420. if (onDemandData.buffer == null) {
  4421. anIntArray1236[i] = -1;
  4422. break;
  4423. }
  4424.  
  4425. byte[] preload = checkMapPreload(onDemandData.ID);
  4426. if (preload != null) {
  4427. aByteArrayArray1247[i] = new byte[preload.length + 1];
  4428. aByteArrayArray1247[i][aByteArrayArray1247[i].length - 1] = 0;
  4429. for (int k = 0; k < preload.length; k++) {
  4430. aByteArrayArray1247[i][k] = preload[k];
  4431. }
  4432. } else {
  4433. aByteArrayArray1247[i] = new byte[onDemandData.buffer.length + 1];
  4434. aByteArrayArray1247[i][aByteArrayArray1247[i].length - 1] = 0;
  4435. for (int k = 0; k < onDemandData.buffer.length; k++) {
  4436. aByteArrayArray1247[i][k] = onDemandData.buffer[k];
  4437. }
  4438. }
  4439.  
  4440. break;
  4441. }
  4442. }
  4443. if (onDemandData.dataType == 4) {
  4444. Model.method460(onDemandData.buffer, onDemandData.ID, 1);
  4445. if (backDialogID != -1)
  4446. inputTaken = true;
  4447. }
  4448. if (onDemandData.dataType == 5) {
  4449. Class36.load(onDemandData.ID, onDemandData.buffer, 1);
  4450. }
  4451. if (onDemandData.dataType == 6) {
  4452. Class36.load(onDemandData.ID, onDemandData.buffer, 2);
  4453. }
  4454. if (onDemandData.dataType == 7) {
  4455. Model.method460(onDemandData.buffer, onDemandData.ID, 2);
  4456. if (backDialogID != -1)
  4457. inputTaken = true;
  4458. }
  4459. if (onDemandData.dataType == 8 && loadingStage == 1) {
  4460. for (int i = 0; i < aByteArrayArray1183.length; i++) {
  4461. if (anIntArray1235[i] == onDemandData.ID) {
  4462. aByteArrayArray1183[i] = onDemandData.buffer;
  4463. if (onDemandData.buffer == null)
  4464. anIntArray1235[i] = -1;
  4465. break;
  4466. }
  4467. if (anIntArray1236[i] != onDemandData.ID)
  4468. continue;
  4469. if (onDemandData.buffer == null) {
  4470. anIntArray1236[i] = -1;
  4471. break;
  4472. }
  4473.  
  4474. aByteArrayArray1247[i] = new byte[onDemandData.buffer.length + 1];
  4475. aByteArrayArray1247[i][aByteArrayArray1247[i].length - 1] = 1;
  4476. for (int k = 0; k < onDemandData.buffer.length; k++) {
  4477. aByteArrayArray1247[i][k] = onDemandData.buffer[k];
  4478. }
  4479. break;
  4480. }
  4481. }
  4482. } while (onDemandData.dataType != 93 || !onDemandFetcher.method564(onDemandData.ID));
  4483. ObjectManager.method173(new RSBuffer(onDemandData.buffer), onDemandFetcher);
  4484. } while (true);
  4485. }
  4486.  
  4487. public byte[] checkMapPreload(int file) {
  4488. String preload = Signlink.getCacheDirectory() + "raw/maps/" + file + ".dat";
  4489. if (new File(preload).exists()) {
  4490. return FileOperations.ReadFile(preload);
  4491. } else {
  4492. return null;
  4493. }
  4494. }
  4495.  
  4496. private void openInterface(int id) {
  4497. RSInterface widget = RSInterface.interfaceCache[id];
  4498. if (widget == null || widget.children == null)
  4499. return;
  4500. for (int j = 0; j < widget.children.length; j++) {
  4501. if (widget.children[j] == -1)
  4502. break;
  4503. RSInterface class9_1 = RSInterface.interfaceCache[widget.children[j]];
  4504. if (class9_1 == null)
  4505. continue;
  4506. if (class9_1.type == 1)
  4507. openInterface(class9_1.id);
  4508. class9_1.anInt246 = 0;
  4509. class9_1.anInt208 = 0;
  4510. }
  4511.  
  4512. switch (id) {
  4513. case 62870:
  4514.  
  4515. for (int i = 0; i < 100; i++) {
  4516. RSInterface bossNameWidget = RSInterface.interfaceCache[62_879 + i * 2];
  4517. if (bossNameWidget.message.isEmpty()) {
  4518. RSInterface scrollableWidget = RSInterface.interfaceCache[62_877];
  4519. scrollableWidget.scrollMax = i * 20 + 25;
  4520. if (scrollableWidget.scrollMax <= scrollableWidget.height) {
  4521. scrollableWidget.scrollMax = scrollableWidget.height + 1;
  4522. }
  4523. break;
  4524. }
  4525. }
  4526.  
  4527. break;
  4528. }
  4529.  
  4530. }
  4531.  
  4532. private void drawHeadIcon() {
  4533. if (anInt855 != 2)
  4534. return;
  4535. calcEntityScreenPos((anInt934 - baseX << 7) + anInt937, anInt936 * 2, (anInt935 - baseY << 7) + anInt938);
  4536. if (spriteDrawX > -1 && loopCycle % 20 < 10)
  4537. headIconsHint[0].drawSprite(spriteDrawX - 12, spriteDrawY - 28);
  4538. }
  4539.  
  4540. public void doGEAction(int l) {
  4541. if (l == 721) {
  4542. inputTaken = true;
  4543. amountOrNameInput = "";
  4544. inputDialogState = 1;
  4545. interfaceButtonAction = 1557;
  4546. }
  4547. if (l == 722) {
  4548. inputTaken = true;
  4549. amountOrNameInput = "";
  4550. inputDialogState = 1;
  4551. interfaceButtonAction = 1557;
  4552. }
  4553. if (l == 723) {
  4554. inputTaken = true;
  4555. amountOrNameInput = "";
  4556. inputDialogState = 1;
  4557. interfaceButtonAction = 1558;
  4558. }
  4559. if (l == 724) {
  4560. inputTaken = true;
  4561. amountOrNameInput = "";
  4562. inputDialogState = 1;
  4563. interfaceButtonAction = 1558;
  4564. }
  4565. }
  4566.  
  4567. public boolean shiftDrop() {
  4568. return ClientSettings.getBoolean("shift_dropping") && isPressed(KeyEvent.VK_SHIFT);
  4569. }
  4570.  
  4571. private void mainGameProcessor() {
  4572. // XXX: hardcoded ruse shit
  4573. if (openInterfaceID == 24600 && buttonclicked && interfaceButtonAction != 1558 && interfaceButtonAction != 1557
  4574. && inputDialogState != 3) {
  4575. if (inputDialogState == 1) {
  4576.  
  4577. } else {
  4578. inputDialogState = 3;
  4579. }
  4580. }
  4581.  
  4582. if (openInterfaceID == 24600 && !buttonclicked && interfaceButtonAction != 1558 && interfaceButtonAction != 1557
  4583. && inputDialogState != 1) {
  4584. inputDialogState = 0;
  4585. }
  4586. //
  4587.  
  4588. if (gameframe.isMouseInsideTabArea() && shiftDrop()) {
  4589. menuActionRow = 3;
  4590. }
  4591.  
  4592. refreshFrameSize();
  4593. if (anInt1104 > 1)
  4594. anInt1104--;
  4595. if (anInt1011 > 0)
  4596. anInt1011--;
  4597. for (int j = 0; j < 10; j++) {
  4598. if (!parsePacket()) {
  4599. break;
  4600. } else {
  4601. int opcode = anInt841;
  4602. if (opcodeReceived.containsKey(opcode)) {
  4603. opcodeReceived.put(opcode, opcodeReceived.get(opcode) + 1);
  4604. } else {
  4605. opcodeReceived.put(opcode, 1l);
  4606. }
  4607. }
  4608. }
  4609.  
  4610. if (System.currentTimeMillis() - lastReceivedUpdate >= 1_000) {
  4611. bytesReceived = inStream.received;
  4612. inStream.received = 0;
  4613. lastReceivedUpdate = System.currentTimeMillis();
  4614. }
  4615.  
  4616. if (!loggedIn)
  4617. return;
  4618. synchronized (mouseDetection.syncObject) {
  4619. if (flagged) {
  4620. if (super.clickMode3 != 0 || mouseDetection.coordsIndex >= 40) {
  4621. stream.createFrame(45);
  4622. stream.writeByte(0);
  4623. int j2 = stream.currentOffset;
  4624. int j3 = 0;
  4625. for (int j4 = 0; j4 < mouseDetection.coordsIndex; j4++) {
  4626. if (j2 - stream.currentOffset >= 240)
  4627. break;
  4628. j3++;
  4629. int l4 = mouseDetection.coordsY[j4];
  4630. if (l4 < 0)
  4631. l4 = 0;
  4632. else if (l4 > 502)
  4633. l4 = 502;
  4634. int k5 = mouseDetection.coordsX[j4];
  4635. if (k5 < 0)
  4636. k5 = 0;
  4637. else if (k5 > 764)
  4638. k5 = 764;
  4639. int i6 = l4 * 765 + k5;
  4640. if (mouseDetection.coordsY[j4] == -1 && mouseDetection.coordsX[j4] == -1) {
  4641. k5 = -1;
  4642. l4 = -1;
  4643. i6 = 0x7ffff;
  4644. }
  4645. if (k5 == anInt1237 && l4 == anInt1238) {
  4646. if (anInt1022 < 2047)
  4647. anInt1022++;
  4648. } else {
  4649. int j6 = k5 - anInt1237;
  4650. anInt1237 = k5;
  4651. int k6 = l4 - anInt1238;
  4652. anInt1238 = l4;
  4653. if (anInt1022 < 8 && j6 >= -32 && j6 <= 31 && k6 >= -32 && k6 <= 31) {
  4654. j6 += 32;
  4655. k6 += 32;
  4656. stream.writeWord((anInt1022 << 12) + (j6 << 6) + k6);
  4657. anInt1022 = 0;
  4658. } else if (anInt1022 < 8) {
  4659. stream.writeDWordBigEndian(0x800000 + (anInt1022 << 19) + i6);
  4660. anInt1022 = 0;
  4661. } else {
  4662. stream.writeDWord(0xc0000000 + (anInt1022 << 19) + i6);
  4663. anInt1022 = 0;
  4664. }
  4665. }
  4666. }
  4667.  
  4668. stream.writeBytes(stream.currentOffset - j2);
  4669. if (j3 >= mouseDetection.coordsIndex) {
  4670. mouseDetection.coordsIndex = 0;
  4671. } else {
  4672. mouseDetection.coordsIndex -= j3;
  4673. for (int i5 = 0; i5 < mouseDetection.coordsIndex; i5++) {
  4674. mouseDetection.coordsX[i5] = mouseDetection.coordsX[i5 + j3];
  4675. mouseDetection.coordsY[i5] = mouseDetection.coordsY[i5 + j3];
  4676. }
  4677.  
  4678. }
  4679. }
  4680. } else {
  4681. mouseDetection.coordsIndex = 0;
  4682. }
  4683. }
  4684. if (super.clickMode3 != 0) {
  4685. long l = (super.aLong29 - aLong1220) / 50L;
  4686. if (l > 4095L)
  4687. l = 4095L;
  4688. aLong1220 = super.aLong29;
  4689. int k2 = super.saveClickY;
  4690. if (k2 < 0)
  4691. k2 = 0;
  4692. else if (k2 > 502)
  4693. k2 = 502;
  4694. int k3 = super.saveClickX;
  4695. if (k3 < 0)
  4696. k3 = 0;
  4697. else if (k3 > 764)
  4698. k3 = 764;
  4699. int k4 = k2 * 765 + k3;
  4700. int j5 = 0;
  4701. if (super.clickMode3 == 2)
  4702. j5 = 1;
  4703. int l5 = (int) l;
  4704. stream.createFrame(241);
  4705. stream.writeDWord((l5 << 20) + (j5 << 19) + k4);
  4706. }
  4707. processShadow();
  4708. if (anInt1016 > 0)
  4709. anInt1016--;
  4710. if (super.keyArray[1] == 1 || super.keyArray[2] == 1 || super.keyArray[3] == 1 || super.keyArray[4] == 1)
  4711. aBoolean1017 = true;
  4712. if (aBoolean1017 && anInt1016 <= 0) {
  4713. anInt1016 = 20;
  4714. aBoolean1017 = false;
  4715. stream.createFrame(86);
  4716. stream.writeWord(anInt1184);
  4717. stream.method432(minimapInt1);
  4718. }
  4719. if (super.awtFocus && !aBoolean954) {
  4720. aBoolean954 = true;
  4721. stream.createFrame(3);
  4722. stream.writeByte(1);
  4723. }
  4724. if (!super.awtFocus && aBoolean954) {
  4725. aBoolean954 = false;
  4726. stream.createFrame(3);
  4727. stream.writeByte(0);
  4728. }
  4729. loadingStages();
  4730. method115();
  4731. anInt1009++;
  4732. if (anInt1009 > 750)
  4733. dropClient();
  4734. method114();
  4735. processNpcInterfaceDisplayAnimation();
  4736. method95();
  4737. method38();
  4738. anInt945++;
  4739. if (crossType != 0) {
  4740. crossIndex += 20;
  4741. if (crossIndex >= 400)
  4742. crossType = 0;
  4743. }
  4744. if (atInventoryInterfaceType != 0) {
  4745. atInventoryLoopCycle++;
  4746. if (atInventoryLoopCycle >= 15) {
  4747. if (atInventoryInterfaceType == 2) {
  4748. }
  4749. if (atInventoryInterfaceType == 3)
  4750. inputTaken = true;
  4751. atInventoryInterfaceType = 0;
  4752. }
  4753. }
  4754. if (activeInterfaceType != 0) {
  4755. anInt989++;
  4756. if (super.mouseX > anInt1087 + 5 || super.mouseX < anInt1087 - 5 || super.mouseY > anInt1088 + 5
  4757. || super.mouseY < anInt1088 - 5)
  4758. aBoolean1242 = true;
  4759. if (super.clickMode2 == 0) {
  4760. if (activeInterfaceType == 2) {
  4761. }
  4762. if (activeInterfaceType == 3)
  4763. inputTaken = true;
  4764. activeInterfaceType = 0;
  4765. if (aBoolean1242 && anInt989 >= ClientSettings.getInt("dragging_threshold")) {
  4766. lastActiveInvInterface = -1;
  4767. processRightClick();
  4768.  
  4769. if (lastActiveInvInterface != anInt1084) {
  4770. stream.createFrame(240);
  4771. stream.method433(lastActiveInvInterface);
  4772. stream.method433(anInt1084);
  4773. stream.method433(mouseInvInterfaceIndex);
  4774. stream.method433(anInt1085);
  4775. } else if (lastActiveInvInterface == anInt1084 && mouseInvInterfaceIndex != anInt1085) {
  4776. RSInterface class9 = RSInterface.interfaceCache[anInt1084];
  4777. int j1 = 0;
  4778. if (anInt913 == 1 && class9.contentType == 206)
  4779. j1 = 1;
  4780. if (class9.inv[mouseInvInterfaceIndex] <= 0)
  4781. j1 = 0;
  4782. if (class9.aBoolean235) {
  4783. int l2 = anInt1085;
  4784. int l3 = mouseInvInterfaceIndex;
  4785. class9.inv[l3] = class9.inv[l2];
  4786. class9.invStackSizes[l3] = class9.invStackSizes[l2];
  4787. class9.inv[l2] = -1;
  4788. class9.invStackSizes[l2] = 0;
  4789. } else if (j1 == 1) {
  4790. boolean bankMainTab = class9.id == 5382 && variousSettings[456] == 1;
  4791. int l2 = anInt1085;
  4792. int l3 = mouseInvInterfaceIndex;
  4793.  
  4794. if (bankMainTab && (l2 / 100) != (l3 / 100)) {
  4795. int tab1 = (l2 / 100);
  4796. int tab2 = (l3 / 100);
  4797. int slot1 = l2;
  4798. int slot2 = l3;
  4799. int startSlot = class9.freeSlot(tab2 * 100, 100) - 1;
  4800.  
  4801. if (startSlot != -2) {
  4802. for (int i = startSlot; i >= slot2; i--) {
  4803. class9.inv[i + 1] = class9.inv[i];
  4804. class9.invStackSizes[i + 1] = class9.invStackSizes[i];
  4805.  
  4806. class9.inv[i] = -1;
  4807. class9.invStackSizes[i] = 0;
  4808. }
  4809.  
  4810. class9.inv[slot2] = class9.inv[slot1];
  4811. class9.invStackSizes[slot2] = class9.invStackSizes[slot1];
  4812.  
  4813. class9.inv[slot1] = -1;
  4814. class9.invStackSizes[slot1] = -1;
  4815.  
  4816. class9.shift(tab1 * 100, 100);
  4817. }
  4818. } else {
  4819. int i3 = anInt1085;
  4820. for (int i4 = mouseInvInterfaceIndex; i3 != i4;) {
  4821. if (i3 > i4) {
  4822. class9.swapInventoryItems(i3, i3 - 1);
  4823. i3--;
  4824. } else if (i3 < i4) {
  4825. class9.swapInventoryItems(i3, i3 + 1);
  4826. i3++;
  4827. }
  4828. }
  4829. }
  4830.  
  4831. } else {
  4832. class9.swapInventoryItems(anInt1085, mouseInvInterfaceIndex);
  4833.  
  4834. if (class9.shiftInvLeft) {
  4835. main: for (int i = 0; i < class9.inv.length; i++) {
  4836. if (class9.inv[i] <= 0) {
  4837. for (int k = i + 1; k < class9.inv.length; k++) {
  4838. if (class9.inv[k] > 0) {
  4839. class9.swapInventoryItems(k, i);
  4840. continue main;
  4841. }
  4842. }
  4843. }
  4844. }
  4845. }
  4846. }
  4847. stream.createFrame(214);
  4848. stream.method433(anInt1084);
  4849. stream.method424(j1);
  4850. stream.method433(anInt1085);
  4851. stream.method431(mouseInvInterfaceIndex);
  4852. }
  4853. } else if ((anInt1253 == 1 || menuHasAddFriend(menuActionRow - 1)) && menuActionRow > 2)
  4854. determineMenuSize();
  4855. else if (menuActionRow > 0)
  4856. doAction(menuActionRow - 1);
  4857. atInventoryLoopCycle = 10;
  4858. super.clickMode3 = 0;
  4859. }
  4860. }
  4861. if (WorldController.anInt470 != -1) {
  4862. int k = WorldController.anInt470;
  4863. int k1 = WorldController.anInt471;
  4864. boolean flag = doWalkTo(0, 0, 0, 0, myPlayer.smallY[0], 0, 0, k1, myPlayer.smallX[0], true, k);
  4865. WorldController.anInt470 = -1;
  4866. if (flag) {
  4867. crossX = super.saveClickX;
  4868. crossY = super.saveClickY;
  4869. crossType = 1;
  4870. crossIndex = 0;
  4871. }
  4872. }
  4873. if (super.clickMode3 == 1 && aString844 != null) {
  4874. aString844 = null;
  4875. inputTaken = true;
  4876. super.clickMode3 = 0;
  4877. }
  4878. processMenuClick();
  4879. if (super.clickMode2 == 1 || super.clickMode3 == 1)
  4880. anInt1213++;
  4881.  
  4882. if (tooltipHoverChildId != 0) {
  4883. RSInterface hoverInter = RSInterface.get(tooltipHoverChildId);
  4884. if (hoverInter != null) {
  4885. if (super.mouseX < tooltipHoverX || super.mouseY < tooltipHoverY
  4886. || super.mouseX > tooltipHoverX + hoverInter.width
  4887. || super.mouseY > tooltipHoverY + hoverInter.height) {
  4888. tooltipHoverChildId = 0;
  4889. inputTaken = true;
  4890. // needDrawTabArea = true;
  4891. }
  4892. } else {
  4893. tooltipHoverChildId = 0;
  4894. inputTaken = true;
  4895. // needDrawTabArea = true;
  4896. }
  4897. if (tooltipHoverLoopCycle < 25 && !menuOpen) {
  4898. tooltipHoverLoopCycle++;
  4899. if (tooltipHoverLoopCycle == 25) {
  4900. inputTaken = true;
  4901. // needDrawTabArea = true;
  4902. }
  4903. }
  4904. } else if (tooltipHoverLoopCycle > 0) {
  4905. tooltipHoverLoopCycle--;
  4906. }
  4907.  
  4908. if (anInt1500 != 0 || anInt1044 != 0 || anInt1129 != 0) {
  4909. if (anInt1501 < 0 && !menuOpen) {
  4910. anInt1501++;
  4911. if (anInt1501 == 0) {
  4912. if (anInt1500 != 0) {
  4913. inputTaken = true;
  4914. }
  4915. if (anInt1044 != 0) {
  4916. }
  4917. }
  4918. }
  4919. } else if (anInt1501 > 0) {
  4920. anInt1501--;
  4921. }
  4922. if (loadingStage == 2)
  4923. method108();
  4924. if (loadingStage == 2 && aBoolean1160)
  4925. calcCameraPos();
  4926. for (int i1 = 0; i1 < 5; i1++)
  4927. anIntArray1030[i1]++;
  4928.  
  4929. method73();
  4930. super.idleTime++;
  4931. if (super.idleTime > 4500) {
  4932. anInt1011 = 250;
  4933. super.idleTime -= 500;
  4934. stream.createFrame(202);
  4935. }
  4936. anInt1010++;
  4937. if (anInt1010 > 50)
  4938. stream.createFrame(0);
  4939. try {
  4940. if (socketStream != null && stream.currentOffset > 0) {
  4941. socketStream.queueBytes(stream.currentOffset, stream.buffer);
  4942. stream.currentOffset = 0;
  4943. anInt1010 = 0;
  4944. }
  4945. } catch (IOException _ex) {
  4946. dropClient();
  4947. } catch (Exception exception) {
  4948. resetLogout();
  4949. }
  4950. }
  4951.  
  4952. private void method63() {
  4953. Class30_Sub1 class30_sub1 = (Class30_Sub1) aClass19_1179.reverseGetFirst();
  4954. for (; class30_sub1 != null; class30_sub1 = (Class30_Sub1) aClass19_1179.reverseGetNext())
  4955. if (class30_sub1.delay == -1) {
  4956. class30_sub1.anInt1302 = 0;
  4957. method89(class30_sub1);
  4958. } else {
  4959. class30_sub1.unlink();
  4960. }
  4961.  
  4962. }
  4963.  
  4964. private void resetImageProducers() {
  4965. if (aRSImageProducer_1107 != null)
  4966. return;
  4967. super.fullGameScreen = null;
  4968. aRSImageProducer_1166 = null;
  4969. aRSImageProducer_1164 = null;
  4970. aRSImageProducer_1163 = null;
  4971. aRSImageProducer_1165 = null;
  4972. aRSImageProducer_1125 = null;
  4973. aRSImageProducer_1110 = new ImageProducer(128, 265);
  4974. DrawingArea.setAllPixelsToZero();
  4975. aRSImageProducer_1111 = new ImageProducer(128, 265);
  4976. DrawingArea.setAllPixelsToZero();
  4977. aRSImageProducer_1107 = new ImageProducer(509, 171);
  4978. DrawingArea.setAllPixelsToZero();
  4979. aRSImageProducer_1108 = new ImageProducer(360, 132);
  4980. DrawingArea.setAllPixelsToZero();
  4981. aRSImageProducer_1109 = new ImageProducer(765, 503);
  4982. DrawingArea.setAllPixelsToZero();
  4983. aRSImageProducer_1112 = new ImageProducer(202, 238);
  4984. DrawingArea.setAllPixelsToZero();
  4985. aRSImageProducer_1113 = new ImageProducer(203, 238);
  4986. DrawingArea.setAllPixelsToZero();
  4987. aRSImageProducer_1114 = new ImageProducer(74, 94);
  4988. DrawingArea.setAllPixelsToZero();
  4989. aRSImageProducer_1115 = new ImageProducer(75, 94);
  4990. DrawingArea.setAllPixelsToZero();
  4991.  
  4992. if (titleStreamLoader != null) {
  4993. drawLogo();
  4994. // loadTitleScreen();
  4995. }
  4996. welcomeScreenRaised = true;
  4997. }
  4998.  
  4999. float LP = 0.0f;
  5000.  
  5001. void drawSmoothLoadingText(int i, String s) {
  5002. for (float f = LP; f < (float) i; f = (float) ((double) f + 0.29999999999999999D)) {
  5003. drawLoadingText((int) f + 1, s);
  5004. LP = i;
  5005. }
  5006. }
  5007.  
  5008. @Override
  5009. public void drawLoadingText(int i, String s) {
  5010. resetImageProducers();
  5011. if (newBoldFont == null) {
  5012. super.drawLoadingText(i == -1 ? 100 : i, s + (i != -1 ? (" - " + i + "%") : ""));
  5013. return;
  5014. }
  5015. final int percentage = i == -1 ? 100 : i;
  5016. final int centerX = 765 / 2, centerY = (503 / 2) - 15;
  5017. aRSImageProducer_1109.initDrawingArea();
  5018. DrawingArea.setAllPixelsToZero();
  5019. DrawingArea.fillPixels(centerX - 152, 304, 34, 0x00B718, centerY);
  5020. DrawingArea.fillPixels(centerX - 151, 302, 32, 0, centerY + 1);
  5021. DrawingArea.drawPixels(centerX - 150, centerY + 2, percentage * 3, 30, 0x00B718);
  5022. DrawingArea.drawPixels((centerX - 150) + percentage * 3, centerY + 2, 300 - percentage * 3, 30, 0);
  5023. newBoldFont.drawCenteredString(s + (i != -1 ? " - " + i + "%" : ""), centerX, (centerY + 22), 0xffffff, -1);
  5024. aRSImageProducer_1109.drawGraphics(0, super.graphics, 0);
  5025. if (welcomeScreenRaised) {
  5026. welcomeScreenRaised = false;
  5027. }
  5028. }
  5029.  
  5030. private void method65(int i, int j, int k, int l, RSInterface class9, int i1, boolean flag, int j1) {
  5031. int anInt992;
  5032. if (aBoolean972)
  5033. anInt992 = 32;
  5034. else
  5035. anInt992 = 0;
  5036. aBoolean972 = false;
  5037. if (k >= i && k < i + 16 && l >= i1 && l < i1 + 16) {
  5038. class9.scrollPosition -= anInt1213 * 4;
  5039. if (flag) {
  5040. }
  5041. } else if (k >= i && k < i + 16 && l >= (i1 + j) - 16 && l < i1 + j) {
  5042. class9.scrollPosition += anInt1213 * 4;
  5043. if (flag) {
  5044. }
  5045. } else if (k >= i - anInt992 && k < i + 16 + anInt992 && l >= i1 + 16 && l < (i1 + j) - 16 && anInt1213 > 0) {
  5046. int l1 = ((j - 32) * j) / j1;
  5047. if (l1 < 8)
  5048. l1 = 8;
  5049. int i2 = l - i1 - 16 - l1 / 2;
  5050. int j2 = j - 32 - l1;
  5051. class9.scrollPosition = ((j1 - j) * i2) / j2;
  5052. if (flag) {
  5053. }
  5054. aBoolean972 = true;
  5055. }
  5056. }
  5057.  
  5058. private boolean method66(int i, int j, int k, int id) {
  5059. int j1 = worldController.method304(plane, k, j, i);
  5060. if (i == -1)
  5061. return false;
  5062. int type = j1 & 0x1f;
  5063. int face = j1 >> 6 & 3;
  5064.  
  5065. if (type == 10 || type == 11 || type == 22) {
  5066. ObjectDefinition class46 = ObjectDefinition.forID(id);
  5067. int sizeX;
  5068. int sizeY;
  5069. if (face == 0 || face == 2) {
  5070. sizeX = class46.anInt744;
  5071. sizeY = class46.anInt761;
  5072. } else {
  5073. sizeX = class46.anInt761;
  5074. sizeY = class46.anInt744;
  5075. }
  5076. int k2 = class46.anInt768;
  5077. if (face != 0)
  5078. k2 = (k2 << face & 0xf) + (k2 >> 4 - face);
  5079. doWalkTo(2, face, 0, type + 1, myPlayer.smallY[0], 0, 0, j, myPlayer.smallX[0], false, k);
  5080. } else {
  5081. doWalkTo(2, face, 0, type + 1, myPlayer.smallY[0], 0, 0, j, myPlayer.smallX[0], false, k);
  5082. }
  5083.  
  5084. crossX = super.saveClickX;
  5085. crossY = super.saveClickY;
  5086. crossType = 2;
  5087. crossIndex = 0;
  5088. return true;
  5089. }
  5090.  
  5091. private StreamLoader streamLoaderForName(int i, String s, String s1, int j, int k) {
  5092. byte abyte0[] = null;
  5093. int l = 5;
  5094. try {
  5095. if (decompressors[0] != null)
  5096. abyte0 = decompressors[0].decompress(i);
  5097. } catch (Exception _ex) {
  5098. }
  5099. if (abyte0 != null) {
  5100. // aCRC32_930.reset();
  5101. // aCRC32_930.update(abyte0);
  5102. // int i1 = (int)aCRC32_930.getValue();
  5103. // if(i1 != j)
  5104. }
  5105. if (abyte0 != null) {
  5106. StreamLoader streamLoader = new StreamLoader(abyte0);
  5107. return streamLoader;
  5108. }
  5109. int j1 = 0;
  5110. while (abyte0 == null) {
  5111. String s2 = "Unknown error";
  5112. String request = "Requesting " + s;
  5113. drawSmoothLoadingText(k, request);
  5114. try {
  5115. int k1 = 0;
  5116. DataInputStream datainputstream = openJagGrabInputStream(s1 + j);
  5117. byte abyte1[] = new byte[6];
  5118. datainputstream.readFully(abyte1, 0, 6);
  5119. RSBuffer stream = new RSBuffer(abyte1);
  5120. stream.currentOffset = 3;
  5121. int i2 = stream.read3Bytes() + 6;
  5122. int j2 = 6;
  5123. abyte0 = new byte[i2];
  5124. System.arraycopy(abyte1, 0, abyte0, 0, 6);
  5125.  
  5126. while (j2 < i2) {
  5127. int l2 = i2 - j2;
  5128. if (l2 > 1000)
  5129. l2 = 1000;
  5130. int j3 = datainputstream.read(abyte0, j2, l2);
  5131. if (j3 < 0) {
  5132. s2 = "Length error: " + j2 + "/" + i2;
  5133. throw new IOException("EOF");
  5134. }
  5135. j2 += j3;
  5136. int k3 = (j2 * 100) / i2;
  5137. if (k3 != k1)
  5138. drawSmoothLoadingText(k, "Loading " + s + " - " + k3 + "%");
  5139. k1 = k3;
  5140. }
  5141. datainputstream.close();
  5142. try {
  5143. if (decompressors[0] != null)
  5144. decompressors[0].method234(abyte0.length, abyte0, i);
  5145. } catch (Exception _ex) {
  5146. decompressors[0] = null;
  5147. }
  5148. /*
  5149. * if(abyte0 != null) { aCRC32_930.reset();
  5150. * aCRC32_930.update(abyte0); int i3 =
  5151. * (int)aCRC32_930.getValue(); if(i3 != j) { abyte0 = null;
  5152. * j1++; s2 = "Checksum error: " + i3; } }
  5153. */
  5154. } catch (IOException ioexception) {
  5155. if (s2.equals("Unknown error"))
  5156. s2 = "Connection error";
  5157. abyte0 = null;
  5158. } catch (NullPointerException _ex) {
  5159. s2 = "Null error";
  5160. abyte0 = null;
  5161. if (!Signlink.reporterror)
  5162. return null;
  5163. } catch (ArrayIndexOutOfBoundsException _ex) {
  5164. s2 = "Bounds error";
  5165. abyte0 = null;
  5166. if (!Signlink.reporterror)
  5167. return null;
  5168. } catch (Exception _ex) {
  5169. s2 = "Unexpected error";
  5170. abyte0 = null;
  5171. if (!Signlink.reporterror)
  5172. return null;
  5173. }
  5174. if (abyte0 == null) {
  5175. for (int l1 = l; l1 > 0; l1--) {
  5176. if (j1 >= 3) {
  5177. drawSmoothLoadingText(k, "Game updated - please reload page");
  5178. l1 = 10;
  5179. } else {
  5180. drawSmoothLoadingText(k, s2 + " - Retrying in " + l1);
  5181. }
  5182. try {
  5183. Thread.sleep(1000L);
  5184. } catch (Exception _ex) {
  5185. }
  5186. }
  5187.  
  5188. l *= 2;
  5189. if (l > 60)
  5190. l = 60;
  5191. aBoolean872 = !aBoolean872;
  5192. }
  5193.  
  5194. }
  5195.  
  5196. StreamLoader streamLoader_1 = new StreamLoader(abyte0);
  5197. return streamLoader_1;
  5198. }
  5199.  
  5200. private StreamLoader streamLoaderFromFile(String file, String s, String s1, int j, int k) {
  5201. byte abyte0[] = null;
  5202. int l = 5;
  5203. try {
  5204. abyte0 = FileUtility.readFile(file);
  5205. } catch (Exception _ex) {
  5206. _ex.printStackTrace();
  5207. }
  5208. if (abyte0 != null) {
  5209. // aCRC32_930.reset();
  5210. // aCRC32_930.update(abyte0);
  5211. // int i1 = (int)aCRC32_930.getValue();
  5212. // if(i1 != j)
  5213. }
  5214. if (abyte0 != null) {
  5215. StreamLoader streamLoader = new StreamLoader(abyte0);
  5216. return streamLoader;
  5217. }
  5218. int j1 = 0;
  5219. while (abyte0 == null) {
  5220. String s2 = "Unknown error";
  5221. String request = "Requesting " + s;
  5222. drawSmoothLoadingText(k, request);
  5223. try {
  5224. int k1 = 0;
  5225. DataInputStream datainputstream = openJagGrabInputStream(s1 + j);
  5226. byte abyte1[] = new byte[6];
  5227. datainputstream.readFully(abyte1, 0, 6);
  5228. RSBuffer stream = new RSBuffer(abyte1);
  5229. stream.currentOffset = 3;
  5230. int i2 = stream.read3Bytes() + 6;
  5231. int j2 = 6;
  5232. abyte0 = new byte[i2];
  5233. System.arraycopy(abyte1, 0, abyte0, 0, 6);
  5234.  
  5235. while (j2 < i2) {
  5236. int l2 = i2 - j2;
  5237. if (l2 > 1000)
  5238. l2 = 1000;
  5239. int j3 = datainputstream.read(abyte0, j2, l2);
  5240. if (j3 < 0) {
  5241. s2 = "Length error: " + j2 + "/" + i2;
  5242. throw new IOException("EOF");
  5243. }
  5244. j2 += j3;
  5245. int k3 = (j2 * 100) / i2;
  5246. if (k3 != k1)
  5247. drawSmoothLoadingText(k, "Loading " + s + " - " + k3 + "%");
  5248. k1 = k3;
  5249. }
  5250. datainputstream.close();
  5251. try {
  5252. // if (decompressors[0] != null)
  5253. // decompressors[0].method234(abyte0.length, abyte0, i);
  5254. } catch (Exception _ex) {
  5255. decompressors[0] = null;
  5256. }
  5257. /*
  5258. * if(abyte0 != null) { aCRC32_930.reset();
  5259. * aCRC32_930.update(abyte0); int i3 =
  5260. * (int)aCRC32_930.getValue(); if(i3 != j) { abyte0 = null;
  5261. * j1++; s2 = "Checksum error: " + i3; } }
  5262. */
  5263. } catch (IOException ioexception) {
  5264. if (s2.equals("Unknown error"))
  5265. s2 = "Connection error";
  5266. abyte0 = null;
  5267. } catch (NullPointerException _ex) {
  5268. s2 = "Null error";
  5269. abyte0 = null;
  5270. if (!Signlink.reporterror)
  5271. return null;
  5272. } catch (ArrayIndexOutOfBoundsException _ex) {
  5273. s2 = "Bounds error";
  5274. abyte0 = null;
  5275. if (!Signlink.reporterror)
  5276. return null;
  5277. } catch (Exception _ex) {
  5278. s2 = "Unexpected error";
  5279. abyte0 = null;
  5280. if (!Signlink.reporterror)
  5281. return null;
  5282. }
  5283. if (abyte0 == null) {
  5284. for (int l1 = l; l1 > 0; l1--) {
  5285. if (j1 >= 3) {
  5286. drawSmoothLoadingText(k, "Game updated - please reload page");
  5287. l1 = 10;
  5288. } else {
  5289. drawSmoothLoadingText(k, s2 + " - Retrying in " + l1);
  5290. }
  5291. try {
  5292. Thread.sleep(1000L);
  5293. } catch (Exception _ex) {
  5294. }
  5295. }
  5296.  
  5297. l *= 2;
  5298. if (l > 60)
  5299. l = 60;
  5300. aBoolean872 = !aBoolean872;
  5301. }
  5302.  
  5303. }
  5304.  
  5305. StreamLoader streamLoader_1 = new StreamLoader(abyte0);
  5306. return streamLoader_1;
  5307. }
  5308.  
  5309. private void dropClient() {
  5310. if (anInt1011 > 0) {
  5311. resetLogout();
  5312. return;
  5313. }
  5314. DrawingArea.fillPixels(2, 229, 39, 0xffffff, 2); // white box around
  5315. DrawingArea.drawPixels(3, 3, 227, 37, 0); // black fill
  5316. regularText.drawText(0, "Connection lost.", 19, 120);
  5317. regularText.drawText(0xffffff, "Connection lost.", 18, 119);
  5318. regularText.drawText(0, "Please wait - attempting to reestablish.", 34, 117);
  5319. regularText.drawText(0xffffff, "Please wait - attempting to reestablish.", 34, 116);
  5320. aRSImageProducer_1165.drawGraphics(frameMode == ScreenMode.FIXED ? 4 : 0, super.graphics,
  5321. frameMode == ScreenMode.FIXED ? 4 : 0);
  5322. anInt1021 = 0;
  5323. destX = 0;
  5324. RSSocket rsSocket = socketStream;
  5325. loggedIn = false;
  5326. loginFailures = 0;
  5327. login(myUsername, myPassword, myAuth, rememberPin, true);
  5328. if (!loggedIn)
  5329. resetLogout();
  5330. try {
  5331. rsSocket.close();
  5332. } catch (Exception _ex) {
  5333. }
  5334. }
  5335.  
  5336. public void setNorth() {
  5337. anInt1278 = 0;
  5338. anInt1131 = 0;
  5339. anInt896 = 0;
  5340. minimapInt1 = 0;
  5341. minimapInt2 = 0;
  5342. minimapInt3 = 0;
  5343. }
  5344.  
  5345. private void doAction(int i) {
  5346. if (i < 0)
  5347. return;
  5348. /*
  5349. * if (inputDialogState != 0) { inputDialogState = 0; inputTaken = true;
  5350. * }
  5351. */
  5352. int j = menuActionCmd2[i];
  5353. int k = menuActionCmd3[i];
  5354. int cmd4 = menuActionCmd4[i];
  5355. int l = menuActionID[i];
  5356. int i1 = menuActionCmd1[i];
  5357. int id = (i1 > 0x7fff ? cmd4 : i1 >> 14 & 0x7fff);
  5358. if (l >= 2000)
  5359. l -= 2000;
  5360.  
  5361. gameframe.handleGameframeAction(l);
  5362. MapRender.handleMapAction(l, cmd4);
  5363. CombatOverlays.menuClick(l, j);
  5364.  
  5365. if (k == 24630 || k == 24632) {
  5366. if (inputDialogState == 3) {
  5367. buttonclicked = false;
  5368. totalItemResults = 0;
  5369. amountOrNameInput = "";
  5370. }
  5371. }
  5372.  
  5373. if (j == 22222) {
  5374. inputTaken = true;
  5375. messagePromptRaised = true;
  5376. amountOrNameInput = "";
  5377. promptInput = "";
  5378. inputDialogState = 0;
  5379. interfaceButtonAction = 6199;
  5380. aString1121 = "Enter a name for the clan chat:";
  5381. }
  5382. if (j == 677) {
  5383. inputTaken = true;
  5384. messagePromptRaised = true;
  5385. amountOrNameInput = "";
  5386. promptInput = "";
  5387. inputDialogState = 0;
  5388. interfaceButtonAction = 6200;
  5389. aString1121 = "Enter name of the player you would like kicked.";
  5390. }
  5391.  
  5392. if (l == 1315) {
  5393. inputString = "[NOT]" + clanName;
  5394. sendPacket(1003);
  5395. }
  5396. if (l == 1316) {
  5397. inputString = "[REC]" + clanName;
  5398. sendPacket(1003);
  5399. }
  5400. if (l == 1317) {
  5401. inputString = "[COR]" + clanName;
  5402. sendPacket(1003);
  5403. }
  5404. if (l == 1318) {
  5405. inputString = "[SER]" + clanName;
  5406. sendPacket(1003);
  5407. }
  5408. if (l == 1319) {
  5409. inputString = "[LIE]" + clanName;
  5410. sendPacket(1003);
  5411. }
  5412. if (l == 1320) {
  5413. inputString = "[CAP]" + clanName;
  5414. sendPacket(1003);
  5415. }
  5416. if (l == 1321) {
  5417. inputString = "[GEN]" + clanName;
  5418. sendPacket(1003);
  5419. }
  5420.  
  5421. if (l == 1251) {
  5422. buttonclicked = false;
  5423. stream.createFrame(204);
  5424. stream.writeWord(GEItemId);
  5425. }
  5426.  
  5427. if (l == 851) {
  5428. stream.createFrame(185);
  5429. stream.writeWord(155);
  5430. }
  5431. if (l == 700) {
  5432. if (tabInterfaceIDs[10] != -1) {
  5433. if (tabID == 10) {
  5434. showTabComponents = !showTabComponents;
  5435. } else {
  5436. showTabComponents = true;
  5437. }
  5438. tabID = 10;
  5439. tabAreaAltered = true;
  5440. }
  5441. }
  5442. if (l == 696) {
  5443. setNorth();
  5444. }
  5445. if (l == 1506) { // Select quick prayers
  5446. stream.createFrame(185);
  5447. stream.writeWord(5001);
  5448. }
  5449. if (l == 104) {
  5450. /*
  5451. * spellID = k; if (!autoCast || (autocastId != spellID)) { autoCast
  5452. * = true; autocastId = spellID; sendPacket185(autocastId, -1, 135);
  5453. * // pushMessage("Autocast spell selected.", 0, ""); } else if
  5454. * (autocastId == spellID) { setAutoCastOff(); }
  5455. */
  5456. setAutoCastOff();
  5457. }
  5458. if (l == 582) {
  5459. Npc npc = npcArray[i1];
  5460. if (npc != null) {
  5461. doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, npc.smallY[0], myPlayer.smallX[0], false, npc.smallX[0]);
  5462. crossX = super.saveClickX;
  5463. crossY = super.saveClickY;
  5464. crossType = 2;
  5465. crossIndex = 0;
  5466. stream.createFrame(57);
  5467. stream.method432(anInt1285);
  5468. stream.method432(i1);
  5469. stream.method431(anInt1283);
  5470. stream.method432(anInt1284);
  5471. }
  5472. }
  5473. if (l == 234) {
  5474. boolean flag1 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k, myPlayer.smallX[0], false, j);
  5475. if (!flag1)
  5476. flag1 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k, myPlayer.smallX[0], false, j);
  5477. crossX = super.saveClickX;
  5478. crossY = super.saveClickY;
  5479. crossType = 2;
  5480. crossIndex = 0;
  5481. stream.createFrame(236);
  5482. stream.method431(k + baseY);
  5483. stream.method432(i1);
  5484. stream.method431(j + baseX);
  5485. }
  5486. if (l == 62 && method66(i1, k, j, id)) {
  5487. stream.createFrame(192);
  5488. stream.writeWord(anInt1284);
  5489. stream.writeWord(id);
  5490. stream.method433(k + baseY);
  5491. stream.method431(anInt1283);
  5492. stream.method433(j + baseX);
  5493. stream.writeWord(anInt1285);
  5494. }
  5495. if (l == 511) {
  5496. boolean flag2 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k, myPlayer.smallX[0], false, j);
  5497. if (!flag2)
  5498. flag2 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k, myPlayer.smallX[0], false, j);
  5499. crossX = super.saveClickX;
  5500. crossY = super.saveClickY;
  5501. crossType = 2;
  5502. crossIndex = 0;
  5503. stream.createFrame(25);
  5504. stream.method431(anInt1284);
  5505. stream.method432(anInt1285);
  5506. stream.writeWord(i1);
  5507. stream.method432(k + baseY);
  5508. stream.method433(anInt1283);
  5509. stream.writeWord(j + baseX);
  5510. }
  5511. if (l == 74) {
  5512. stream.createFrame(122);
  5513. stream.writeWord(k);
  5514. stream.writeWord(j);/// XXX: ruse changed this packet
  5515. stream.method432(i1);
  5516. atInventoryLoopCycle = 0;
  5517. atInventoryInterface = k;
  5518. atInventoryIndex = j;
  5519. atInventoryInterfaceType = 2;
  5520. if (RSInterface.interfaceCache[k].parentID == openInterfaceID)
  5521. atInventoryInterfaceType = 1;
  5522. if (RSInterface.interfaceCache[k].parentID == backDialogID)
  5523. atInventoryInterfaceType = 3;
  5524. }
  5525. if (l == 222) {
  5526. stream.createFrame(222);
  5527. stream.writeWord(k);
  5528. stream.writeByte(currentActionMenu);
  5529. }
  5530. if (l == 315) {
  5531. RSInterface class9 = RSInterface.interfaceCache[k];
  5532. boolean flag8 = true;
  5533. if (class9.contentType > 0)
  5534. flag8 = promptUserForInput(class9);
  5535. if (flag8) {
  5536. switch (k) {
  5537. case 24654:
  5538. amountOrNameInput = "";
  5539. totalItemResults = 0;
  5540. buttonclicked = inputDialogState == 3 ? false : true;
  5541. inputDialogState = inputDialogState == 3 ? 0 : 3;
  5542. break;
  5543. case 19144:
  5544. sendFrame248(15106, 3213);
  5545. openInterface(15106);
  5546. inputTaken = true;
  5547. break;
  5548. default:
  5549. openLink(k);
  5550. MikeysInterfaces.buttonClicked(k);
  5551. stream.createFrame(185);
  5552. stream.writeWord(k);
  5553. break;
  5554.  
  5555. }
  5556. }
  5557. }
  5558. if (l == 561) {
  5559. Player player = playerArray[i1];
  5560. if (player != null) {
  5561. doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, player.smallY[0], myPlayer.smallX[0], false,
  5562. player.smallX[0]);
  5563. crossX = super.saveClickX;
  5564. crossY = super.saveClickY;
  5565. crossType = 2;
  5566. crossIndex = 0;
  5567. anInt1188 += i1;
  5568. if (anInt1188 >= 90) {
  5569. stream.createFrame(136);
  5570. anInt1188 = 0;
  5571. }
  5572. stream.createFrame(128);
  5573. stream.writeWord(i1);
  5574. }
  5575. }
  5576. if (l == 20) {
  5577. Npc class30_sub2_sub4_sub1_sub1_1 = npcArray[i1];
  5578. if (class30_sub2_sub4_sub1_sub1_1 != null) {
  5579. doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, class30_sub2_sub4_sub1_sub1_1.smallY[0],
  5580. myPlayer.smallX[0], false, class30_sub2_sub4_sub1_sub1_1.smallX[0]);
  5581. crossX = super.saveClickX;
  5582. crossY = super.saveClickY;
  5583. crossType = 2;
  5584. crossIndex = 0;
  5585. stream.createFrame(155);
  5586. stream.method431(i1);
  5587. }
  5588. }
  5589. if (l == 779) {
  5590. Player class30_sub2_sub4_sub1_sub2_1 = playerArray[i1];
  5591. if (class30_sub2_sub4_sub1_sub2_1 != null) {
  5592. doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, class30_sub2_sub4_sub1_sub2_1.smallY[0],
  5593. myPlayer.smallX[0], false, class30_sub2_sub4_sub1_sub2_1.smallX[0]);
  5594. crossX = super.saveClickX;
  5595. crossY = super.saveClickY;
  5596. crossType = 2;
  5597. crossIndex = 0;
  5598. stream.createFrame(153);
  5599. stream.method431(i1);
  5600. }
  5601. }
  5602. if (l == 519)
  5603. if (!menuOpen)
  5604. worldController.method312(super.saveClickY - 4, super.saveClickX - 4);
  5605. else
  5606. worldController.method312(k - 4, j - 4);
  5607. if (l == 1062) {
  5608. anInt924 += baseX;
  5609. if (anInt924 >= 113) {
  5610. stream.createFrame(183);
  5611. stream.writeDWordBigEndian(0xe63271);
  5612. anInt924 = 0;
  5613. }
  5614. method66(i1, k, j, id);
  5615. stream.createFrame(228);
  5616. stream.method432(id);
  5617. stream.method432(k + baseY);
  5618. stream.writeWord(j + baseX);
  5619. }
  5620. if (l == 679 && !aBoolean1149) {
  5621. stream.createFrame(40);
  5622. stream.writeWord(k);
  5623. aBoolean1149 = true;
  5624. }
  5625. if (l == 431) {
  5626. stream.createFrame(129);
  5627. stream.method432(j);
  5628. stream.writeWord(k);
  5629. stream.method432(i1);
  5630. atInventoryLoopCycle = 0;
  5631. atInventoryInterface = k;
  5632. atInventoryIndex = j;
  5633. atInventoryInterfaceType = 2;
  5634. if (RSInterface.interfaceCache[k].parentID == openInterfaceID)
  5635. atInventoryInterfaceType = 1;
  5636. if (RSInterface.interfaceCache[k].parentID == backDialogID)
  5637. atInventoryInterfaceType = 3;
  5638. }
  5639. if (l == 337 || l == 42 || l == 792 || l == 322) {
  5640. String s = menuActionName[i];
  5641. int k1 = s.indexOf("@whi@");
  5642. if (k1 != -1) {
  5643. long l3 = TextClass.longForName(s.substring(k1 + 5).trim());
  5644. if (l == 337)
  5645. addFriend(l3);
  5646. if (l == 42)
  5647. addIgnore(l3);
  5648. if (l == 792)
  5649. delFriend(l3);
  5650. if (l == 322)
  5651. delIgnore(l3);
  5652. }
  5653. }
  5654. if (l == 53) {
  5655. stream.createFrame(135);
  5656. stream.method431(j);
  5657. stream.method432(k);
  5658. stream.method432(i1);
  5659. atInventoryLoopCycle = 0;
  5660. atInventoryInterface = k;
  5661. atInventoryIndex = j;
  5662. atInventoryInterfaceType = 2;
  5663. if (RSInterface.interfaceCache[k].parentID == openInterfaceID)
  5664. atInventoryInterfaceType = 1;
  5665. if (RSInterface.interfaceCache[k].parentID == backDialogID)
  5666. atInventoryInterfaceType = 3;
  5667. }
  5668. if (l == 54) {
  5669. stream.createFrame(135);
  5670. stream.method431(j);
  5671. stream.method432(11);
  5672. stream.method431(i1);
  5673. atInventoryLoopCycle = 0;
  5674. atInventoryInterface = k;
  5675. atInventoryIndex = j;
  5676. atInventoryInterfaceType = 2;
  5677. if (RSInterface.interfaceCache[k].parentID == openInterfaceID)
  5678. atInventoryInterfaceType = 1;
  5679. if (RSInterface.interfaceCache[k].parentID == backDialogID)
  5680. atInventoryInterfaceType = 3;
  5681. }
  5682. if (l == 539) {
  5683. stream.createFrame(16);
  5684. stream.method432(i1);
  5685. stream.method433(j);
  5686. stream.method433(k);
  5687. atInventoryLoopCycle = 0;
  5688. atInventoryInterface = k;
  5689. atInventoryIndex = j;
  5690. atInventoryInterfaceType = 2;
  5691. if (RSInterface.interfaceCache[k].parentID == openInterfaceID)
  5692. atInventoryInterfaceType = 1;
  5693. if (RSInterface.interfaceCache[k].parentID == backDialogID)
  5694. atInventoryInterfaceType = 3;
  5695. }
  5696. if (l == 484 || l == 6) {
  5697. String s1 = menuActionName[i];
  5698. int l1 = s1.indexOf("@whi@");
  5699. if (l1 != -1) {
  5700. s1 = s1.substring(l1 + 5).trim();
  5701. String s7 = TextClass.fixName(TextClass.nameForLong(TextClass.longForName(s1)));
  5702. boolean flag9 = false;
  5703. for (int j3 = 0; j3 < playerCount; j3++) {
  5704. Player class30_sub2_sub4_sub1_sub2_7 = playerArray[playerIndices[j3]];
  5705. if (class30_sub2_sub4_sub1_sub2_7 == null || class30_sub2_sub4_sub1_sub2_7.name == null
  5706. || !class30_sub2_sub4_sub1_sub2_7.name.equalsIgnoreCase(s7))
  5707. continue;
  5708. doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, class30_sub2_sub4_sub1_sub2_7.smallY[0],
  5709. myPlayer.smallX[0], false, class30_sub2_sub4_sub1_sub2_7.smallX[0]);
  5710. if (l == 484) {
  5711. stream.createFrame(139);
  5712. stream.method431(playerIndices[j3]);
  5713. }
  5714. if (l == 6) {
  5715. anInt1188 += i1;
  5716. if (anInt1188 >= 90) {
  5717. stream.createFrame(136);
  5718. anInt1188 = 0;
  5719. }
  5720. stream.createFrame(128);
  5721. stream.writeWord(playerIndices[j3]);
  5722. }
  5723. flag9 = true;
  5724. break;
  5725. }
  5726.  
  5727. if (!flag9)
  5728. pushMessage("Unable to find " + s7, 0, "");
  5729. }
  5730. }
  5731. if (l == 870) {
  5732. stream.createFrame(53);
  5733. stream.writeWord(j);
  5734. stream.method432(anInt1283);
  5735. stream.method433(i1);
  5736. stream.writeWord(anInt1284);
  5737. stream.method431(anInt1285);
  5738. stream.writeWord(k);
  5739. atInventoryLoopCycle = 0;
  5740. atInventoryInterface = k;
  5741. atInventoryIndex = j;
  5742. atInventoryInterfaceType = 2;
  5743. if (RSInterface.interfaceCache[k].parentID == openInterfaceID)
  5744. atInventoryInterfaceType = 1;
  5745. if (RSInterface.interfaceCache[k].parentID == backDialogID)
  5746. atInventoryInterfaceType = 3;
  5747. }
  5748. if (l == 847) {
  5749. stream.createFrame(87);
  5750. stream.method432(i1);
  5751. stream.writeWord(k);
  5752. stream.method432(j);
  5753. atInventoryLoopCycle = 0;
  5754. atInventoryInterface = k;
  5755. atInventoryIndex = j;
  5756. atInventoryInterfaceType = 2;
  5757. if (RSInterface.interfaceCache[k].parentID == openInterfaceID)
  5758. atInventoryInterfaceType = 1;
  5759. if (RSInterface.interfaceCache[k].parentID == backDialogID)
  5760. atInventoryInterfaceType = 3;
  5761. }
  5762. if (l == 626) {
  5763. RSInterface class9_1 = RSInterface.interfaceCache[k];
  5764. spellSelected = 1;
  5765. spellID = class9_1.id;
  5766. anInt1137 = k;
  5767. spellUsableOn = class9_1.spellUsableOn;
  5768. itemSelected = 0;
  5769. String s4 = class9_1.selectedActionName;
  5770. if (s4.indexOf(" ") != -1)
  5771. s4 = s4.substring(0, s4.indexOf(" "));
  5772. String s8 = class9_1.selectedActionName;
  5773. if (s8.indexOf(" ") != -1)
  5774. s8 = s8.substring(s8.indexOf(" ") + 1);
  5775. spellTooltip = s4 + " " + class9_1.spellName + " " + s8;
  5776. // class9_1.sprite1.drawSprite(class9_1.anInt263, class9_1.anInt265,
  5777. // 0xffffff);
  5778. // class9_1.sprite1.drawSprite(200,200);
  5779. // System.out.println("Sprite: " + class9_1.sprite1.toString());
  5780. if (spellUsableOn == 16) {
  5781. tabID = 3;
  5782. tabAreaAltered = true;
  5783. }
  5784. return;
  5785. }
  5786. if (l == 78) {
  5787. stream.createFrame(117);
  5788. stream.method433(k);
  5789. stream.method432(i1);
  5790. stream.method431(j);
  5791. atInventoryLoopCycle = 0;
  5792. atInventoryInterface = k;
  5793. atInventoryIndex = j;
  5794. atInventoryInterfaceType = 2;
  5795. if (RSInterface.interfaceCache[k].parentID == openInterfaceID)
  5796. atInventoryInterfaceType = 1;
  5797. if (RSInterface.interfaceCache[k].parentID == backDialogID)
  5798. atInventoryInterfaceType = 3;
  5799. }
  5800. if (l == 27) {
  5801. Player class30_sub2_sub4_sub1_sub2_2 = playerArray[i1];
  5802. if (class30_sub2_sub4_sub1_sub2_2 != null) {
  5803. doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, class30_sub2_sub4_sub1_sub2_2.smallY[0],
  5804. myPlayer.smallX[0], false, class30_sub2_sub4_sub1_sub2_2.smallX[0]);
  5805. crossX = super.saveClickX;
  5806. crossY = super.saveClickY;
  5807. crossType = 2;
  5808. crossIndex = 0;
  5809. anInt986 += i1;
  5810. if (anInt986 >= 54) {
  5811. stream.createFrame(189);
  5812. stream.writeByte(234);
  5813. anInt986 = 0;
  5814. }
  5815. stream.createFrame(73);
  5816. stream.method431(i1);
  5817. }
  5818. }
  5819. if (l == 213) {
  5820. boolean flag3 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k, myPlayer.smallX[0], false, j);
  5821. if (!flag3)
  5822. flag3 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k, myPlayer.smallX[0], false, j);
  5823. crossX = super.saveClickX;
  5824. crossY = super.saveClickY;
  5825. crossType = 2;
  5826. crossIndex = 0;
  5827. stream.createFrame(79);
  5828. stream.method431(k + baseY);
  5829. stream.writeWord(i1);
  5830. stream.method432(j + baseX);
  5831. }
  5832. if (l == 632) {
  5833. stream.createFrame(145);
  5834. stream.method432(k);
  5835. stream.method432(j);
  5836. stream.method432(i1);
  5837. atInventoryLoopCycle = 0;
  5838. atInventoryInterface = k;
  5839. atInventoryIndex = j;
  5840. atInventoryInterfaceType = 2;
  5841. if (RSInterface.interfaceCache[k].parentID == openInterfaceID)
  5842. atInventoryInterfaceType = 1;
  5843. if (RSInterface.interfaceCache[k].parentID == backDialogID)
  5844. atInventoryInterfaceType = 3;
  5845. }
  5846. if (l == 1004) {
  5847. if (tabInterfaceIDs[10] != -1) {
  5848. tabID = 10;
  5849. tabAreaAltered = true;
  5850. }
  5851. }
  5852. if (l == 1003) {
  5853. clanChatMode = 2;
  5854. inputTaken = true;
  5855. }
  5856. if (l == 1002) {
  5857. clanChatMode = 1;
  5858. inputTaken = true;
  5859. }
  5860. if (l == 1001) {
  5861. clanChatMode = 0;
  5862. inputTaken = true;
  5863. }
  5864. if (l == 997) {
  5865. publicChatMode = 3;
  5866. inputTaken = true;
  5867. }
  5868. if (l == 996) {
  5869. publicChatMode = 2;
  5870. inputTaken = true;
  5871. }
  5872. if (l == 995) {
  5873. publicChatMode = 1;
  5874. inputTaken = true;
  5875. }
  5876. if (l == 994) {
  5877. publicChatMode = 0;
  5878. inputTaken = true;
  5879. }
  5880. if (l == 992) {
  5881. privateChatMode = 2;
  5882. inputTaken = true;
  5883. }
  5884. if (l == 991) {
  5885. privateChatMode = 1;
  5886. inputTaken = true;
  5887. }
  5888. if (l == 990) {
  5889. privateChatMode = 0;
  5890. inputTaken = true;
  5891. }
  5892. if (l == 987) {
  5893. tradeMode = 2;
  5894. inputTaken = true;
  5895. }
  5896. if (l == 986) {
  5897. tradeMode = 1;
  5898. inputTaken = true;
  5899. }
  5900. if (l == 985) {
  5901. tradeMode = 0;
  5902. inputTaken = true;
  5903. }
  5904. if (l == 493) {
  5905. stream.createFrame(75);
  5906. stream.method433(k);
  5907. stream.method431(j);
  5908. stream.method432(i1);
  5909. atInventoryLoopCycle = 0;
  5910. atInventoryInterface = k;
  5911. atInventoryIndex = j;
  5912. atInventoryInterfaceType = 2;
  5913. if (RSInterface.interfaceCache[k].parentID == openInterfaceID)
  5914. atInventoryInterfaceType = 1;
  5915. if (RSInterface.interfaceCache[k].parentID == backDialogID)
  5916. atInventoryInterfaceType = 3;
  5917. }
  5918. if (l == 652) {
  5919. boolean flag4 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k, myPlayer.smallX[0], false, j);
  5920. if (!flag4)
  5921. flag4 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k, myPlayer.smallX[0], false, j);
  5922. crossX = super.saveClickX;
  5923. crossY = super.saveClickY;
  5924. crossType = 2;
  5925. crossIndex = 0;
  5926. stream.createFrame(156);
  5927. stream.method432(j + baseX);
  5928. stream.method431(k + baseY);
  5929. stream.method433(i1);
  5930. }
  5931. if (l == 94) {
  5932. boolean flag5 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k, myPlayer.smallX[0], false, j);
  5933. if (!flag5)
  5934. flag5 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k, myPlayer.smallX[0], false, j);
  5935. crossX = super.saveClickX;
  5936. crossY = super.saveClickY;
  5937. crossType = 2;
  5938. crossIndex = 0;
  5939. stream.createFrame(181);
  5940. stream.method431(k + baseY);
  5941. stream.writeWord(i1);
  5942. stream.method431(j + baseX);
  5943. stream.method432(anInt1137);
  5944. }
  5945. if (l == 646) {
  5946. openLink(k);
  5947. MikeysInterfaces.buttonClicked(k);
  5948. stream.createFrame(185);
  5949. stream.writeWord(k);
  5950. RSInterface class9_2 = RSInterface.interfaceCache[k];
  5951. if (class9_2.clickingChangesConfig) {
  5952. if (class9_2.valueIndexArray != null && class9_2.valueIndexArray[0][0] == 5) {
  5953. int i2 = class9_2.valueIndexArray[0][1];
  5954. if (variousSettings[i2] != class9_2.anIntArray212[0]) {
  5955. variousSettings[i2] = class9_2.anIntArray212[0];
  5956. method33(i2);
  5957. }
  5958. }
  5959. }
  5960. }
  5961. if (l == 225) {
  5962. Npc class30_sub2_sub4_sub1_sub1_2 = npcArray[i1];
  5963. if (class30_sub2_sub4_sub1_sub1_2 != null) {
  5964. doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, class30_sub2_sub4_sub1_sub1_2.smallY[0],
  5965. myPlayer.smallX[0], false, class30_sub2_sub4_sub1_sub1_2.smallX[0]);
  5966. crossX = super.saveClickX;
  5967. crossY = super.saveClickY;
  5968. crossType = 2;
  5969. crossIndex = 0;
  5970. anInt1226 += i1;
  5971. if (anInt1226 >= 85) {
  5972. stream.createFrame(230);
  5973. stream.writeByte(239);
  5974. anInt1226 = 0;
  5975. }
  5976. stream.createFrame(17);
  5977. stream.method433(i1);
  5978. }
  5979. }
  5980. if (l == 965) {
  5981. Npc class30_sub2_sub4_sub1_sub1_3 = npcArray[i1];
  5982. if (class30_sub2_sub4_sub1_sub1_3 != null) {
  5983. doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, class30_sub2_sub4_sub1_sub1_3.smallY[0],
  5984. myPlayer.smallX[0], false, class30_sub2_sub4_sub1_sub1_3.smallX[0]);
  5985. crossX = super.saveClickX;
  5986. crossY = super.saveClickY;
  5987. crossType = 2;
  5988. crossIndex = 0;
  5989. anInt1134++;
  5990. if (anInt1134 >= 96) {
  5991. stream.createFrame(152);
  5992. stream.writeByte(88);
  5993. anInt1134 = 0;
  5994. }
  5995. stream.createFrame(21);
  5996. stream.writeWord(i1);
  5997. }
  5998. }
  5999. if (l == 413) {
  6000. Npc class30_sub2_sub4_sub1_sub1_4 = npcArray[i1];
  6001. if (class30_sub2_sub4_sub1_sub1_4 != null) {
  6002. doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, class30_sub2_sub4_sub1_sub1_4.smallY[0],
  6003. myPlayer.smallX[0], false, class30_sub2_sub4_sub1_sub1_4.smallX[0]);
  6004. crossX = super.saveClickX;
  6005. crossY = super.saveClickY;
  6006. crossType = 2;
  6007. crossIndex = 0;
  6008. stream.createFrame(131);
  6009. stream.method433(i1);
  6010. stream.method432(anInt1137);
  6011. }
  6012. }
  6013. if (l == 200)
  6014. clearTopInterfaces();
  6015. if (l == 1025) {
  6016. Npc class30_sub2_sub4_sub1_sub1_5 = npcArray[i1];
  6017. if (class30_sub2_sub4_sub1_sub1_5 != null) {
  6018. NpcDefinition entityDef = class30_sub2_sub4_sub1_sub1_5.desc;
  6019. if (entityDef.childrenIDs != null)
  6020. entityDef = entityDef.method161();
  6021. if (entityDef != null) {
  6022. stream.createFrame(6);
  6023. stream.method431(entityDef.id);
  6024. }
  6025. }
  6026. }
  6027. if (l == 900) {
  6028. method66(i1, k, j, id);
  6029. stream.createFrame(252);
  6030. stream.method433(id);
  6031. stream.method431(k + baseY);
  6032. stream.method432(j + baseX);
  6033. }
  6034. if (l == 412) {
  6035. Npc class30_sub2_sub4_sub1_sub1_6 = npcArray[i1];
  6036. if (class30_sub2_sub4_sub1_sub1_6 != null) {
  6037. doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, class30_sub2_sub4_sub1_sub1_6.smallY[0],
  6038. myPlayer.smallX[0], false, class30_sub2_sub4_sub1_sub1_6.smallX[0]);
  6039. crossX = super.saveClickX;
  6040. crossY = super.saveClickY;
  6041. crossType = 2;
  6042. crossIndex = 0;
  6043. stream.createFrame(72);
  6044. stream.method432(i1);
  6045. }
  6046. }
  6047. if (l == 365) {
  6048. Player class30_sub2_sub4_sub1_sub2_3 = playerArray[i1];
  6049. if (class30_sub2_sub4_sub1_sub2_3 != null) {
  6050. doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, class30_sub2_sub4_sub1_sub2_3.smallY[0],
  6051. myPlayer.smallX[0], false, class30_sub2_sub4_sub1_sub2_3.smallX[0]);
  6052. crossX = super.saveClickX;
  6053. crossY = super.saveClickY;
  6054. crossType = 2;
  6055. crossIndex = 0;
  6056. stream.createFrame(249);
  6057. stream.method432(i1);
  6058. stream.method431(anInt1137);
  6059. }
  6060. }
  6061. if (l == 729) {
  6062. Player class30_sub2_sub4_sub1_sub2_4 = playerArray[i1];
  6063. if (class30_sub2_sub4_sub1_sub2_4 != null) {
  6064. doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, class30_sub2_sub4_sub1_sub2_4.smallY[0],
  6065. myPlayer.smallX[0], false, class30_sub2_sub4_sub1_sub2_4.smallX[0]);
  6066. crossX = super.saveClickX;
  6067. crossY = super.saveClickY;
  6068. crossType = 2;
  6069. crossIndex = 0;
  6070. stream.createFrame(39);
  6071. stream.method431(i1);
  6072. }
  6073. }
  6074. if (l == 577) {
  6075. Player class30_sub2_sub4_sub1_sub2_5 = playerArray[i1];
  6076. if (class30_sub2_sub4_sub1_sub2_5 != null) {
  6077. doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, class30_sub2_sub4_sub1_sub2_5.smallY[0],
  6078. myPlayer.smallX[0], false, class30_sub2_sub4_sub1_sub2_5.smallX[0]);
  6079. crossX = super.saveClickX;
  6080. crossY = super.saveClickY;
  6081. crossType = 2;
  6082. crossIndex = 0;
  6083. stream.createFrame(139);
  6084. stream.method431(i1);
  6085. }
  6086. }
  6087. if (l == 956 && method66(i1, k, j, id)) {
  6088. stream.createFrame(35);
  6089. stream.method431(j + baseX);
  6090. stream.method432(anInt1137);
  6091. stream.method432(k + baseY);
  6092. stream.method431(id);
  6093. }
  6094. if (l == 567) {
  6095. boolean flag6 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k, myPlayer.smallX[0], false, j);
  6096. if (!flag6)
  6097. flag6 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k, myPlayer.smallX[0], false, j);
  6098. crossX = super.saveClickX;
  6099. crossY = super.saveClickY;
  6100. crossType = 2;
  6101. crossIndex = 0;
  6102. stream.createFrame(23);
  6103. stream.method431(k + baseY);
  6104. stream.method431(i1);
  6105. stream.method431(j + baseX);
  6106. }
  6107. if (l == 867) {
  6108. if ((i1 & 3) == 0)
  6109. anInt1175++;
  6110. if (anInt1175 >= 59) {
  6111. stream.createFrame(200);
  6112. stream.writeWord(25501);
  6113. anInt1175 = 0;
  6114. }
  6115. stream.createFrame(43);
  6116. stream.method431(k);
  6117. stream.method432(i1);
  6118. stream.method432(j);
  6119. atInventoryLoopCycle = 0;
  6120. atInventoryInterface = k;
  6121. atInventoryIndex = j;
  6122. atInventoryInterfaceType = 2;
  6123. if (RSInterface.interfaceCache[k].parentID == openInterfaceID)
  6124. atInventoryInterfaceType = 1;
  6125. if (RSInterface.interfaceCache[k].parentID == backDialogID)
  6126. atInventoryInterfaceType = 3;
  6127. }
  6128. if (l == 543) {
  6129. stream.createFrame(237);
  6130. stream.writeWord(j);
  6131. stream.method432(i1);
  6132. stream.writeWord(k);
  6133. stream.method432(anInt1137);
  6134. atInventoryLoopCycle = 0;
  6135. atInventoryInterface = k;
  6136. atInventoryIndex = j;
  6137. atInventoryInterfaceType = 2;
  6138. if (RSInterface.interfaceCache[k].parentID == openInterfaceID)
  6139. atInventoryInterfaceType = 1;
  6140. if (RSInterface.interfaceCache[k].parentID == backDialogID)
  6141. atInventoryInterfaceType = 3;
  6142. }
  6143. if (l == 606) {
  6144. String s2 = menuActionName[i];
  6145. int j2 = s2.indexOf("@whi@");
  6146. if (j2 != -1)
  6147. if (openInterfaceID == -1) {
  6148. clearTopInterfaces();
  6149. reportAbuseInput = s2.substring(j2 + 5).trim();
  6150. canMute = false;
  6151. for (int i3 = 0; i3 < RSInterface.interfaceCache.length; i3++) {
  6152. if (RSInterface.interfaceCache[i3] == null || RSInterface.interfaceCache[i3].contentType != 600)
  6153. continue;
  6154. reportAbuseInterfaceID = openInterfaceID = RSInterface.interfaceCache[i3].parentID;
  6155. break;
  6156. }
  6157.  
  6158. } else {
  6159. pushMessage("Please close the interface you have open before using 'report abuse'", 0, "");
  6160. }
  6161. }
  6162. if (l == 491) {
  6163. Player class30_sub2_sub4_sub1_sub2_6 = playerArray[i1];
  6164. if (class30_sub2_sub4_sub1_sub2_6 != null) {
  6165. doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, class30_sub2_sub4_sub1_sub2_6.smallY[0],
  6166. myPlayer.smallX[0], false, class30_sub2_sub4_sub1_sub2_6.smallX[0]);
  6167. crossX = super.saveClickX;
  6168. crossY = super.saveClickY;
  6169. crossType = 2;
  6170. crossIndex = 0;
  6171. stream.createFrame(14);
  6172. stream.method432(anInt1284);
  6173. stream.writeWord(i1);
  6174. stream.writeWord(anInt1285);
  6175. stream.method431(anInt1283);
  6176. }
  6177. }
  6178. if (l == 639) {
  6179. String s3 = menuActionName[i];
  6180. int k2 = s3.indexOf("@whi@");
  6181. if (k2 != -1) {
  6182. long l4 = TextClass.longForName(s3.substring(k2 + 5).trim());
  6183. int k3 = -1;
  6184. for (int i4 = 0; i4 < friendsCount; i4++) {
  6185. if (friendsListAsLongs[i4] != l4)
  6186. continue;
  6187. k3 = i4;
  6188. break;
  6189. }
  6190.  
  6191. if (k3 != -1 && friendsNodeIDs[k3] > 0) {
  6192. inputTaken = true;
  6193. inputDialogState = 0;
  6194. messagePromptRaised = true;
  6195. promptInput = "";
  6196. friendsListAction = 3;
  6197. aLong953 = friendsListAsLongs[k3];
  6198. aString1121 = "Enter message to send to " + friendsList[k3];
  6199. }
  6200. }
  6201. }
  6202. if (l == 454) {
  6203. stream.createFrame(41);
  6204. stream.method432(i1);
  6205. stream.method432(j);
  6206. stream.method432(k);
  6207. atInventoryLoopCycle = 0;
  6208. atInventoryInterface = k;
  6209. atInventoryIndex = j;
  6210. atInventoryInterfaceType = 2;
  6211. if (RSInterface.interfaceCache[k].parentID == openInterfaceID)
  6212. atInventoryInterfaceType = 1;
  6213. if (RSInterface.interfaceCache[k].parentID == backDialogID)
  6214. atInventoryInterfaceType = 3;
  6215. }
  6216. if (l == 478) {
  6217. Npc class30_sub2_sub4_sub1_sub1_7 = npcArray[i1];
  6218. if (class30_sub2_sub4_sub1_sub1_7 != null) {
  6219. doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, class30_sub2_sub4_sub1_sub1_7.smallY[0],
  6220. myPlayer.smallX[0], false, class30_sub2_sub4_sub1_sub1_7.smallX[0]);
  6221. crossX = super.saveClickX;
  6222. crossY = super.saveClickY;
  6223. crossType = 2;
  6224. crossIndex = 0;
  6225. if ((i1 & 3) == 0)
  6226. anInt1155++;
  6227. if (anInt1155 >= 53) {
  6228. stream.createFrame(85);
  6229. stream.writeByte(66);
  6230. anInt1155 = 0;
  6231. }
  6232. stream.createFrame(18);
  6233. stream.method431(i1);
  6234. }
  6235. }
  6236. if (l == 113) {
  6237. method66(i1, k, j, id);
  6238. stream.createFrame(70);
  6239. stream.method431(j + baseX);
  6240. stream.writeWord(k + baseY);
  6241. stream.method433(id);
  6242. }
  6243. if (l == 872) {
  6244. method66(i1, k, j, id);
  6245. stream.createFrame(234);
  6246. stream.method433(j + baseX);
  6247. stream.method432(id);
  6248. stream.method433(k + baseY);
  6249. }
  6250. if (l == 502) {
  6251. method66(i1, k, j, id);
  6252. stream.createFrame(132);
  6253. stream.method433(j + baseX);
  6254. stream.writeDWord(id);
  6255. stream.method432(k + baseY);
  6256. }
  6257. if (l == 1125) {
  6258. ItemDefinition itemDef = ItemDefinition.forID(i1);
  6259. /*
  6260. * RSInterface class9_4 = RSInterface.interfaceCache[k]; String s5;
  6261. * if (class9_4 != null && class9_4.invStackSizes[j] >= 0x186a0) s5
  6262. * = class9_4.invStackSizes[j] + " x " + itemDef.name; else if
  6263. * (itemDef.description != null) s5 = new
  6264. * String(itemDef.description); else s5 = "It's a " + itemDef.name +
  6265. * "."; pushMessage(s5, 0, "");
  6266. */
  6267. RSInterface class9_4 = RSInterface.interfaceCache[k];
  6268. stream.createFrame(2); // examine item
  6269. stream.method432(itemDef.id);
  6270. stream.writeDWord(class9_4.invStackSizes[j]);
  6271. }
  6272. if (l == 169) {
  6273. openLink(k);
  6274. MikeysInterfaces.buttonClicked(k);
  6275. stream.createFrame(185);
  6276. stream.writeWord(k);
  6277. RSInterface class9_3 = RSInterface.interfaceCache[k];
  6278. if (class9_3.clickingChangesConfig) {
  6279. if (class9_3.valueIndexArray != null && class9_3.valueIndexArray[0][0] == 5) {
  6280. int l2 = class9_3.valueIndexArray[0][1];
  6281. variousSettings[l2] = 1 - variousSettings[l2];
  6282. method33(l2);
  6283. MikeysInterfaces.configButton(l2, variousSettings[l2]);
  6284. }
  6285. }
  6286. }
  6287. if (l == 447) {
  6288. itemSelected = 1;
  6289. anInt1283 = j;
  6290. anInt1284 = k;
  6291. anInt1285 = i1;
  6292. selectedItemName = ItemDefinition.forID(i1).name;
  6293. spellSelected = 0;
  6294. return;
  6295. }
  6296. if (l == 1226) {
  6297. int j1 = id;
  6298. ObjectDefinition class46 = ObjectDefinition.forID(j1);
  6299. String s10;
  6300. if (class46.description != null)
  6301. s10 = new String(class46.description);
  6302. else
  6303. s10 = "It's a " + class46.name + ".";
  6304. pushMessage(s10, 0, "");
  6305. }
  6306. if (l == 244) {
  6307. boolean flag7 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k, myPlayer.smallX[0], false, j);
  6308. if (!flag7)
  6309. flag7 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k, myPlayer.smallX[0], false, j);
  6310. crossX = super.saveClickX;
  6311. crossY = super.saveClickY;
  6312. crossType = 2;
  6313. crossIndex = 0;
  6314. stream.createFrame(253);
  6315. stream.method431(j + baseX);
  6316. stream.method433(k + baseY);
  6317. stream.method432(i1);
  6318. }
  6319. if (l == 1448) {
  6320. ItemDefinition itemDef_1 = ItemDefinition.forID(i1);
  6321. String s6;
  6322. stream.createFrame(2); // examine item
  6323. stream.method432(itemDef_1.id);
  6324. stream.writeDWord(cmd4);
  6325. /*
  6326. * if (itemDef_1.description != null) s6 = new
  6327. * String(itemDef_1.description); else s6 = "It's a " +
  6328. * itemDef_1.name + "."; pushMessage(s6, 0, "");
  6329. */
  6330. }
  6331. itemSelected = 0;
  6332. spellSelected = 0;
  6333.  
  6334. }
  6335.  
  6336. @SuppressWarnings("unused")
  6337. private void method70() {
  6338. anInt1251 = 0;
  6339. int j = (myPlayer.x >> 7) + baseX;
  6340. int k = (myPlayer.y >> 7) + baseY;
  6341. if (j >= 3053 && j <= 3156 && k >= 3056 && k <= 3136)
  6342. anInt1251 = 1;
  6343. if (j >= 3072 && j <= 3118 && k >= 9492 && k <= 9535)
  6344. anInt1251 = 1;
  6345. if (anInt1251 == 1 && j >= 3139 && j <= 3199 && k >= 3008 && k <= 3062)
  6346. anInt1251 = 0;
  6347. }
  6348.  
  6349. public void run() {
  6350. /*
  6351. * if (drawFlames) { drawFlames(); } else {
  6352. */
  6353. super.run();
  6354. // }
  6355. }
  6356.  
  6357. private void build3dScreenMenu() {
  6358. if (itemSelected == 0 && spellSelected == 0) {
  6359. menuActionName[menuActionRow] = "Walk here";
  6360. menuActionID[menuActionRow] = 519;
  6361. menuActionCmd2[menuActionRow] = super.mouseX;
  6362. menuActionCmd3[menuActionRow] = super.mouseY;
  6363. menuActionRow++;
  6364. }
  6365. int j = -1;
  6366. for (int k = 0; k < Model.anInt1687; k++) {
  6367. int l = Model.anIntArray1688[k];// data
  6368. int i1 = l & 0x7f;// x
  6369. int j1 = l >> 7 & 0x7f;// y
  6370. int k1 = l >> 29 & 3;// face
  6371. int l1 = -1;// objId
  6372. if (k1 != 2)
  6373. l1 = l >> 14 & 0x7fff;
  6374. if (l == j)
  6375. continue;
  6376. j = l;
  6377. if (k1 == 2 && worldController.method304(plane, i1, j1, l) >= 0) {
  6378. l1 = Model.anIntArray1689[k];
  6379.  
  6380. ObjectDefinition class46 = ObjectDefinition.forID(l1);
  6381. if (class46.childrenIDs != null)
  6382. class46 = class46.method580();
  6383. if (class46 == null)
  6384. continue;
  6385. if (itemSelected == 1) {
  6386. menuActionName[menuActionRow] = "Use " + selectedItemName + " with @cya@" + class46.name;
  6387. menuActionID[menuActionRow] = 62;
  6388. menuActionCmd1[menuActionRow] = l;
  6389. menuActionCmd2[menuActionRow] = i1;
  6390. menuActionCmd3[menuActionRow] = j1;
  6391. menuActionCmd4[menuActionRow] = l1;
  6392. menuActionRow++;
  6393. } else if (spellSelected == 1) {
  6394. if ((spellUsableOn & 4) == 4) {
  6395. menuActionName[menuActionRow] = spellTooltip + " @cya@" + class46.name;
  6396. menuActionID[menuActionRow] = 956;
  6397. menuActionCmd1[menuActionRow] = l;
  6398. menuActionCmd2[menuActionRow] = i1;
  6399. menuActionCmd3[menuActionRow] = j1;
  6400. menuActionCmd4[menuActionRow] = l1;
  6401. menuActionRow++;
  6402. }
  6403. } else {
  6404. if (class46.actions != null) {
  6405. for (int i2 = 4; i2 >= 0; i2--)
  6406. if (class46.actions[i2] != null) {
  6407. menuActionName[menuActionRow] = class46.actions[i2] + " @cya@" + class46.name;
  6408. if (i2 == 0)
  6409. menuActionID[menuActionRow] = 502;
  6410. if (i2 == 1)
  6411. menuActionID[menuActionRow] = 900;
  6412. if (i2 == 2)
  6413. menuActionID[menuActionRow] = 113;
  6414. if (i2 == 3)
  6415. menuActionID[menuActionRow] = 872;
  6416. if (i2 == 4)
  6417. menuActionID[menuActionRow] = 1062;
  6418. menuActionCmd1[menuActionRow] = l;
  6419. menuActionCmd2[menuActionRow] = i1;
  6420. menuActionCmd3[menuActionRow] = j1;
  6421. menuActionCmd4[menuActionRow] = l1;
  6422. menuActionRow++;
  6423. }
  6424.  
  6425. }
  6426. // menuActionName[menuActionRow] = "Examine @cya@" +
  6427. // class46.name + " @gre@(@whi@" + l1 + "@gre@) (@whi@" +
  6428. // (i1 + baseX) + "," + (j1 + baseY) + "@gre@)";
  6429. menuActionName[menuActionRow] = "Examine @cya@" + class46.name
  6430. + (clientData ? ", ID: " + class46.type : "");
  6431. menuActionID[menuActionRow] = 1226;
  6432. menuActionCmd1[menuActionRow] = class46.type << 14;
  6433. menuActionCmd2[menuActionRow] = i1;
  6434. menuActionCmd3[menuActionRow] = j1;
  6435. menuActionCmd4[menuActionRow] = l1;
  6436. menuActionRow++;
  6437. }
  6438. }
  6439. if (k1 == 1) {
  6440. Npc npc = npcArray[l1];
  6441. try {
  6442. if (npc.desc.aByte68 == 1 && (npc.x & 0x7f) == 64 && (npc.y & 0x7f) == 64) {
  6443. for (int j2 = 0; j2 < npcCount; j2++) {
  6444. Npc npc2 = npcArray[npcIndices[j2]];
  6445. if (npc2 != null && npc2 != npc && npc2.desc.aByte68 == 1 && npc2.x == npc.x
  6446. && npc2.y == npc.y)
  6447. buildAtNPCMenu(npc2.desc, npcIndices[j2], j1, i1);
  6448. }
  6449. for (int l2 = 0; l2 < playerCount; l2++) {
  6450. Player player = playerArray[playerIndices[l2]];
  6451. if (player != null && player.x == npc.x && player.y == npc.y)
  6452. buildAtPlayerMenu(i1, playerIndices[l2], player, j1);
  6453. }
  6454. }
  6455. boolean disableActionsRendering = isSummon(npc);
  6456. if (disableActionsRendering) {
  6457. if (mySummonIndex == npc.serverIndex) {
  6458. disableActionsRendering = false;
  6459. }
  6460. }
  6461.  
  6462. if (!disableActionsRendering) {
  6463. buildAtNPCMenu(npc.desc, l1, j1, i1);
  6464. }
  6465.  
  6466. } catch (Exception e) {
  6467. e.printStackTrace();
  6468. }
  6469. }
  6470. if (k1 == 0) {
  6471. Player player = playerArray[l1];
  6472. if ((player.x & 0x7f) == 64 && (player.y & 0x7f) == 64) {
  6473. for (int k2 = 0; k2 < npcCount; k2++) {
  6474. Npc class30_sub2_sub4_sub1_sub1_2 = npcArray[npcIndices[k2]];
  6475. if (class30_sub2_sub4_sub1_sub1_2 != null && class30_sub2_sub4_sub1_sub1_2.desc.aByte68 == 1
  6476. && class30_sub2_sub4_sub1_sub1_2.x == player.x
  6477. && class30_sub2_sub4_sub1_sub1_2.y == player.y) {
  6478.  
  6479. boolean disableActionsRendering = isSummon(class30_sub2_sub4_sub1_sub1_2);
  6480. if (disableActionsRendering) {
  6481. if (mySummonIndex == class30_sub2_sub4_sub1_sub1_2.serverIndex) {
  6482. disableActionsRendering = false;
  6483. }
  6484. }
  6485. if (!disableActionsRendering) {
  6486. buildAtNPCMenu(class30_sub2_sub4_sub1_sub1_2.desc, npcIndices[k2], j1, i1);
  6487. }
  6488. }
  6489. }
  6490.  
  6491. for (int i3 = 0; i3 < playerCount; i3++) {
  6492. Player class30_sub2_sub4_sub1_sub2_2 = playerArray[playerIndices[i3]];
  6493. if (class30_sub2_sub4_sub1_sub2_2 != null && class30_sub2_sub4_sub1_sub2_2 != player
  6494. && class30_sub2_sub4_sub1_sub2_2.x == player.x
  6495. && class30_sub2_sub4_sub1_sub2_2.y == player.y)
  6496. buildAtPlayerMenu(i1, playerIndices[i3], class30_sub2_sub4_sub1_sub2_2, j1);
  6497. }
  6498.  
  6499. }
  6500. buildAtPlayerMenu(i1, l1, player, j1);
  6501. }
  6502. if (k1 == 3) {
  6503. NodeList class19 = groundArray[plane][i1][j1];
  6504. if (class19 != null) {
  6505. for (Item item = (Item) class19.getFirst(); item != null; item = (Item) class19.getNext()) {
  6506. ItemDefinition itemDef = ItemDefinition.forID(item.ID);
  6507. if (itemSelected == 1) {
  6508. menuActionName[menuActionRow] = "Use " + selectedItemName + " with @lre@" + itemDef.name;
  6509. menuActionID[menuActionRow] = 511;
  6510. menuActionCmd1[menuActionRow] = item.ID;
  6511. menuActionCmd2[menuActionRow] = i1;
  6512. menuActionCmd3[menuActionRow] = j1;
  6513. menuActionRow++;
  6514. } else if (spellSelected == 1) {
  6515. if ((spellUsableOn & 1) == 1) {
  6516. menuActionName[menuActionRow] = spellTooltip + " @lre@" + itemDef.name;
  6517. menuActionID[menuActionRow] = 94;
  6518. menuActionCmd1[menuActionRow] = item.ID;
  6519. menuActionCmd2[menuActionRow] = i1;
  6520. menuActionCmd3[menuActionRow] = j1;
  6521. menuActionRow++;
  6522. }
  6523. } else {
  6524. for (int j3 = 4; j3 >= 0; j3--)
  6525. if (itemDef.groundActions != null && itemDef.groundActions[j3] != null) {
  6526. menuActionName[menuActionRow] = itemDef.groundActions[j3] + " @lre@" + itemDef.name;
  6527. if (j3 == 0)
  6528. menuActionID[menuActionRow] = 652;
  6529. if (j3 == 1)
  6530. menuActionID[menuActionRow] = 567;
  6531. if (j3 == 2)
  6532. menuActionID[menuActionRow] = 234;
  6533. if (j3 == 3)
  6534. menuActionID[menuActionRow] = 244;
  6535. if (j3 == 4)
  6536. menuActionID[menuActionRow] = 213;
  6537. menuActionCmd1[menuActionRow] = item.ID;
  6538. menuActionCmd2[menuActionRow] = i1;
  6539. menuActionCmd3[menuActionRow] = j1;
  6540. menuActionRow++;
  6541. } else if (j3 == 2) {
  6542. menuActionName[menuActionRow] = "Take @lre@" + itemDef.name;
  6543. menuActionID[menuActionRow] = 234;
  6544. menuActionCmd1[menuActionRow] = item.ID;
  6545. menuActionCmd2[menuActionRow] = i1;
  6546. menuActionCmd3[menuActionRow] = j1;
  6547. menuActionRow++;
  6548. }
  6549. menuActionName[menuActionRow] = "Examine @lre@" + itemDef.name;
  6550. menuActionID[menuActionRow] = 1448;
  6551. menuActionCmd1[menuActionRow] = item.ID;
  6552. menuActionCmd2[menuActionRow] = i1;
  6553. menuActionCmd3[menuActionRow] = j1;
  6554. menuActionCmd4[menuActionRow] = item.itemAmount;
  6555. menuActionRow++;
  6556. }
  6557. }
  6558.  
  6559. }
  6560. }
  6561. }
  6562. }
  6563.  
  6564. public void cleanUpForQuit() {
  6565. Signlink.reporterror = false;
  6566. try {
  6567. if (socketStream != null) {
  6568. socketStream.close();
  6569. }
  6570. } catch (Exception _ex) {
  6571. }
  6572. socketStream = null;
  6573. stopMidi();
  6574. if (mouseDetection != null)
  6575. mouseDetection.running = false;
  6576. mouseDetection = null;
  6577. onDemandFetcher.disable();
  6578. onDemandFetcher = null;
  6579. aStream_834 = null;
  6580. stream = null;
  6581. aStream_847 = null;
  6582. inStream = null;
  6583. anIntArray1234 = null;
  6584. aByteArrayArray1183 = null;
  6585. aByteArrayArray1247 = null;
  6586. anIntArray1235 = null;
  6587. anIntArray1236 = null;
  6588. intGroundArray = null;
  6589. byteGroundArray = null;
  6590. worldController = null;
  6591. aClass11Array1230 = null;
  6592. anIntArrayArray901 = null;
  6593. anIntArrayArray825 = null;
  6594. bigX = null;
  6595. bigY = null;
  6596. aByteArray912 = null;
  6597. aRSImageProducer_1163 = null;
  6598. leftFrame = null;
  6599. topFrame = null;
  6600. aRSImageProducer_1164 = null;
  6601. aRSImageProducer_1165 = null;
  6602. aRSImageProducer_1166 = null;
  6603. aRSImageProducer_1125 = null;
  6604. /* Null pointers for custom sprites */
  6605. loginSprites = null;
  6606. mapBack = null;
  6607. mapBack2 = null;
  6608. sideIcons = null;
  6609. compass = null;
  6610. hitMarks = null;
  6611. headIcons = null;
  6612. skullIcons = null;
  6613. headIconsHint = null;
  6614. crosses = null;
  6615. mapDotItem = null;
  6616. mapDotNPC = null;
  6617. mapDotPlayer = null;
  6618. mapDotFriend = null;
  6619. mapDotTeam = null;
  6620. mapScenes = null;
  6621. mapFunctions = null;
  6622. anIntArrayArray929 = null;
  6623. playerArray = null;
  6624. playerIndices = null;
  6625. anIntArray894 = null;
  6626. aStreamArray895s = null;
  6627. anIntArray840 = null;
  6628. npcArray = null;
  6629. npcIndices = null;
  6630. groundArray = null;
  6631. aClass19_1179 = null;
  6632. aClass19_1013 = null;
  6633. aClass19_1056 = null;
  6634. menuActionCmd2 = null;
  6635. menuActionCmd3 = null;
  6636. menuActionCmd4 = null;
  6637. menuActionID = null;
  6638. menuActionCmd1 = null;
  6639. menuActionName = null;
  6640. variousSettings = null;
  6641. anIntArray1072 = null;
  6642. anIntArray1073 = null;
  6643. aClass30_Sub2_Sub1_Sub1Array1140 = null;
  6644. minimapImage = null;
  6645. friendsList = null;
  6646. friendsListAsLongs = null;
  6647. friendsNodeIDs = null;
  6648. aRSImageProducer_1110 = null;
  6649. aRSImageProducer_1111 = null;
  6650. aRSImageProducer_1107 = null;
  6651. aRSImageProducer_1108 = null;
  6652. aRSImageProducer_1109 = null;
  6653. aRSImageProducer_1112 = null;
  6654. aRSImageProducer_1113 = null;
  6655. aRSImageProducer_1114 = null;
  6656. aRSImageProducer_1115 = null;
  6657. multiOverlay = null;
  6658. nullLoader();
  6659. ObjectDefinition.nullLoader();
  6660. NpcDefinition.nullLoader();
  6661. ItemDefinition.nullLoader();
  6662. Floor.cache = null;
  6663. IdentityKit.cache = null;
  6664. RSInterface.interfaceCache = null;
  6665. Animation.nullLoader();
  6666. SpotAnim.nullLoader();
  6667. SpotAnim.aMRUNodes_415 = null;
  6668. Varp.cache = null;
  6669. super.fullGameScreen = null;
  6670. Player.mruNodes = null;
  6671. Texture.nullLoader();
  6672. WorldController.nullLoader();
  6673. Model.nullLoader();
  6674. Class36.nullLoader();
  6675. System.gc();
  6676. }
  6677.  
  6678. Component getGameComponent() {
  6679. if (Signlink.mainapp != null)
  6680. return Signlink.mainapp;
  6681. if (super.gameFrame != null)
  6682. return super.gameFrame;
  6683. else
  6684. return this;
  6685. }
  6686.  
  6687. private String tabName = null;
  6688.  
  6689. private ArrayList<String> getPrivateMessageNames() {
  6690. ArrayList<String> names = new ArrayList<>();
  6691.  
  6692. for (int i = 0; i < chatMessages.length; i++) {
  6693. if (chatMessages[i] == null) {
  6694. continue;
  6695. }
  6696.  
  6697. int type = chatTypes[i];
  6698. String name = chatNames[i];
  6699.  
  6700. if (name == null || (type != 3 && type != 7)) {
  6701. continue;
  6702. }
  6703.  
  6704. for (int k = 0; k < 20; k++) {
  6705. String crown = "@cr" + k + "@";
  6706. if (name.startsWith(crown)) {
  6707. name = name.substring(crown.length());
  6708. }
  6709. }
  6710.  
  6711. String cleanName = name.toLowerCase().trim();
  6712. if (cleanName.isEmpty() || names.contains(cleanName)) {
  6713. continue;
  6714. }
  6715.  
  6716. names.add(cleanName);
  6717. }
  6718.  
  6719. return names;
  6720. }
  6721.  
  6722. public void tabToReplyPm() {
  6723. ArrayList<String> names = getPrivateMessageNames();
  6724.  
  6725. if (!messagePromptRaised) {
  6726. tabName = null;
  6727. }
  6728.  
  6729. if (tabName != null) {
  6730. boolean found = false;
  6731. for (int i = 0; i < names.size(); i++) {
  6732. String name = names.get(i);
  6733.  
  6734. if (found) {
  6735. tabName = name;
  6736. break;
  6737. }
  6738.  
  6739. if (!name.equalsIgnoreCase(tabName)) {
  6740. continue;
  6741. }
  6742.  
  6743. found = true;
  6744. tabName = null;
  6745. }
  6746. } else {
  6747. tabName = names.isEmpty() ? null : names.get(0);
  6748. }
  6749.  
  6750. inputTaken = false;
  6751. friendsListAction = 0;
  6752. messagePromptRaised = false;
  6753.  
  6754. try {
  6755. if (tabName == null) {
  6756. pushMessage("You have not recieved any messages.", 0, "");
  6757. } else {
  6758. long namel = TextClass.longForName(tabName.trim());
  6759.  
  6760. int node = -1;
  6761. for (int count = 0; count < friendsListAsLongs.length; count++) {
  6762. if (friendsListAsLongs[count] != namel)
  6763. continue;
  6764. node = count;
  6765. break;
  6766. }
  6767.  
  6768. if (privateChatMode != 0 && node == -1) {
  6769. pushMessage("Turn your private chat to on or add this player to message them.", 0, "");
  6770. return;
  6771. }
  6772.  
  6773. inputTaken = true;
  6774. inputDialogState = 0;
  6775. messagePromptRaised = true;
  6776. promptInput = "";
  6777. friendsListAction = 3;
  6778. aLong953 = namel;
  6779. aString1121 = "Enter message to send to " + TextClass.fixName(TextClass.nameForLong(namel));
  6780. }
  6781. } catch (Exception e) {
  6782. e.printStackTrace();
  6783. }
  6784. }
  6785.  
  6786. private void method73() {
  6787. do {
  6788. int j = readChar(-796);
  6789. if (j == -1)
  6790. break;
  6791. if (backDialogID != -1 && j == 32 && !aBoolean1149) {
  6792. int[] dialogues = { 4885, 4890, 4896, 4903, 971, 976, 982, 989, 356 + 3 };
  6793. int[] continueComponents = { 4907, 4899, 4892, 4886 };
  6794.  
  6795. for (int component : continueComponents) {
  6796. if (RSInterface.get(component).anInt263 != 0 || RSInterface.get(component).anInt265 != 0) {
  6797. return;
  6798. }
  6799. }
  6800.  
  6801. for (int dialogue : dialogues) {
  6802. if (backDialogID == dialogue - 3) {
  6803. stream.createFrame(40);
  6804. stream.writeWord(0);
  6805. aBoolean1149 = true;
  6806. return;
  6807. }
  6808. }
  6809. }
  6810.  
  6811. if (openInterfaceID != -1) {
  6812. if (openInterfaceID == reportAbuseInterfaceID) {
  6813. if (j == 8 && reportAbuseInput.length() > 0)
  6814. reportAbuseInput = reportAbuseInput.substring(0, reportAbuseInput.length() - 1);
  6815. if ((j >= 97 && j <= 122 || j >= 65 && j <= 90 || j >= 48 && j <= 57 || j == 32)
  6816. && reportAbuseInput.length() < 12)
  6817. reportAbuseInput += (char) j;
  6818. return;
  6819. }
  6820.  
  6821. try {
  6822. RSInterface open = RSInterface.get(openInterfaceID);
  6823. if (open.children != null) {
  6824. for (int i = 0; i < open.children.length; i++) {
  6825. RSInterface child = RSInterface.get(open.children[i]);
  6826. if (child == null)
  6827. continue;
  6828. if (child.inputField) {
  6829. if (j == 8) {
  6830. if (child.inputFieldString.length() > 0) {
  6831. if (child.inputFieldString.equalsIgnoreCase("enter a name to search"))
  6832. return;
  6833. child.inputFieldString = child.inputFieldString.substring(0,
  6834. child.inputFieldString.length() - 1);
  6835. if (child.inputFieldString.length() == 0) {
  6836. child.inputFieldString = "Enter a name to search";
  6837. }
  6838. MikeysInterfaces.inputFieldEdited(open.children[i]);
  6839. }
  6840. } else {
  6841. if (j >= 32 && j <= 122) {
  6842. if (child.inputFieldString.equalsIgnoreCase("enter a name to search"))
  6843. child.inputFieldString = "";
  6844. if (child.inputFieldString.length() < 21) {
  6845. child.inputFieldString += (char) j;
  6846. MikeysInterfaces.inputFieldEdited(open.children[i]);
  6847. }
  6848. }
  6849. }
  6850. return;
  6851. }
  6852. }
  6853. }
  6854. } catch (Exception e) {
  6855. e.printStackTrace();
  6856. }
  6857. }
  6858.  
  6859. if (messagePromptRaised) {
  6860. if (j >= 32 && j <= 122 && promptInput.length() < 80) {
  6861. promptInput += (char) j;
  6862. inputTaken = true;
  6863. }
  6864. if (j == 8 && promptInput.length() > 0) {
  6865. promptInput = promptInput.substring(0, promptInput.length() - 1);
  6866. inputTaken = true;
  6867. }
  6868. if (j == 13 || j == 10) {
  6869. messagePromptRaised = false;
  6870. inputTaken = true;
  6871. if (friendsListAction == 1) {
  6872. long l = TextClass.longForName(promptInput);
  6873. addFriend(l);
  6874. }
  6875. if (friendsListAction == 2 && friendsCount > 0) {
  6876. long l1 = TextClass.longForName(promptInput);
  6877. delFriend(l1);
  6878. }
  6879. if (friendsListAction == 3 && promptInput.length() > 0) {
  6880. tabName = null;
  6881. stream.createFrame(126);
  6882. stream.writeByte(0);
  6883. int k = stream.currentOffset;
  6884. stream.writeQWord(aLong953);
  6885. TextInput.method526(promptInput, stream);
  6886. stream.writeBytes(stream.currentOffset - k);
  6887. promptInput = TextInput.processText(promptInput);
  6888. // promptInput = Censor.doCensor(promptInput);
  6889. pushMessage(promptInput, 6, TextClass.fixName(TextClass.nameForLong(aLong953)));
  6890. if (privateChatMode == 2) {
  6891. privateChatMode = 1;
  6892. stream.createFrame(95);
  6893. stream.writeByte(publicChatMode);
  6894. stream.writeByte(privateChatMode);
  6895. stream.writeByte(tradeMode);
  6896. }
  6897. }
  6898. if (friendsListAction == 4 && ignoreCount < 100) {
  6899. long l2 = TextClass.longForName(promptInput);
  6900. addIgnore(l2);
  6901. }
  6902. if (friendsListAction == 5 && ignoreCount > 0) {
  6903. long l3 = TextClass.longForName(promptInput);
  6904. delIgnore(l3);
  6905. }
  6906. if (friendsListAction == 6) {
  6907. long l3 = TextClass.longForName(promptInput);
  6908. chatJoin(l3);
  6909. }
  6910. }
  6911. } else if (inputDialogState == 1) {
  6912. if (j >= 48 && j <= 57 && amountOrNameInput.length() < 10) {
  6913. amountOrNameInput += (char) j;
  6914. inputTaken = true;
  6915. }
  6916. if ((!amountOrNameInput.toLowerCase().contains("k") && !amountOrNameInput.toLowerCase().contains("m")
  6917. && !amountOrNameInput.toLowerCase().contains("b")) && (j == 107 || j == 109 || j == 98)) {
  6918. amountOrNameInput += (char) j;
  6919. inputTaken = true;
  6920. }
  6921. if (j == 8 && amountOrNameInput.length() > 0) {
  6922. amountOrNameInput = amountOrNameInput.substring(0, amountOrNameInput.length() - 1);
  6923. inputTaken = true;
  6924. }
  6925. if (j == 13 || j == 10) {
  6926. if (amountOrNameInput.length() > 0) {
  6927. if (amountOrNameInput.toLowerCase().contains("k")) {
  6928. amountOrNameInput = amountOrNameInput.replaceAll("k", "000");
  6929. } else if (amountOrNameInput.toLowerCase().contains("m")) {
  6930. amountOrNameInput = amountOrNameInput.replaceAll("m", "000000");
  6931. } else if (amountOrNameInput.toLowerCase().contains("b")) {
  6932. amountOrNameInput = amountOrNameInput.replaceAll("b", "000000000");
  6933. }
  6934. long amount = 0;
  6935. try {
  6936. amount = Long.parseLong(amountOrNameInput);
  6937. if (amount > Integer.MAX_VALUE)
  6938. amount = Integer.MAX_VALUE;
  6939. stream.createFrame(208);
  6940. stream.writeDWord((int) amount);
  6941. } catch (NumberFormatException e) {
  6942. }
  6943. }
  6944. inputDialogState = 0;
  6945. inputTaken = true;
  6946. }
  6947. } else if (inputDialogState == 3) {
  6948. if (j == 10) {
  6949. totalItemResults = 0;
  6950. amountOrNameInput = "";
  6951. inputDialogState = 0;
  6952. inputTaken = true;
  6953. }
  6954. if (j == 13 || j == 10) {
  6955. if (amountOrNameInput.length() == 0) {
  6956. buttonclicked = false;
  6957. interfaceButtonAction = 0;
  6958. }
  6959. }
  6960. if (j >= 32 && j <= 122 && amountOrNameInput.length() < 40) {
  6961. amountOrNameInput += (char) j;
  6962. inputTaken = true;
  6963. }
  6964. if (j == 8 && amountOrNameInput.length() > 0) {
  6965. amountOrNameInput = amountOrNameInput.substring(0, amountOrNameInput.length() - 1);
  6966. inputTaken = true;
  6967. }
  6968. } else if (inputDialogState == 2) {
  6969. if (j >= 32 && j <= 122 && amountOrNameInput.length() < 60) {
  6970. amountOrNameInput += (char) j;
  6971. inputTaken = true;
  6972. }
  6973. if (j == 8 && amountOrNameInput.length() > 0) {
  6974. amountOrNameInput = amountOrNameInput.substring(0, amountOrNameInput.length() - 1);
  6975. inputTaken = true;
  6976. }
  6977. if (j == 13 || j == 10) {
  6978.  
  6979. stream.createFrame(60);
  6980. // stream.writeQWord(TextClass.longForName(amountOrNameInput));
  6981. stream.writeByte(amountOrNameInput.length() + 1);/// XXX:
  6982. /// changed
  6983. /// in
  6984. /// ruse
  6985. stream.writeString(amountOrNameInput);
  6986.  
  6987. inputDialogState = 0;
  6988. inputTaken = true;
  6989. }
  6990. } else if (backDialogID == -1) {
  6991. if ((char) j == '<' || (char) j == '>') {
  6992. return;
  6993. }
  6994. if (j >= 32 && j <= 122 && inputString.length() < 80) {
  6995. inputString += (char) j;
  6996. inputTaken = true;
  6997. }
  6998. if (j == 8 && inputString.length() > 0) {
  6999. inputString = inputString.substring(0, inputString.length() - 1);
  7000. inputTaken = true;
  7001. }
  7002.  
  7003. if ((j == 13 || j == 10) && inputString.length() > 0) {
  7004. if (inputString.startsWith("::drag")) {
  7005. try {
  7006. int dragThreshold = Integer
  7007. .parseInt(inputString.substring("::drag ".length(), inputString.length()));
  7008. if (dragThreshold < 5 || dragThreshold > 50) {
  7009. pushMessage("Your threshold must be between 5 and 50.", 0, "");
  7010. } else {
  7011. ClientSettings.set("dragging_threshold", dragThreshold);
  7012. pushMessage("Dragging threshold set to " + dragThreshold + ".", 0, "");
  7013. }
  7014. } catch (Exception e) {
  7015. e.printStackTrace();
  7016. pushMessage("Error reading your threshold setting, try again.", 0, "");
  7017. }
  7018. }
  7019.  
  7020. if (inputString.equals("::fps"))
  7021. fpsOn = !fpsOn;
  7022. if (inputString.equals("::testoverlay")) {
  7023. CombatOverlays.add(3, 100);
  7024. }
  7025. if (inputString.equals("::strings"))
  7026. interfaceStrings = !interfaceStrings;
  7027. if (inputString.equals("::ids"))
  7028. interfaceIds = !interfaceIds;
  7029.  
  7030. if (myPrivilege >= 10
  7031. && myPrivilege <= 14) {
  7032. if (inputString.startsWith("//setspecto")) {
  7033. int amt = Integer.parseInt(inputString.substring(12));
  7034. anIntArray1045[300] = amt;
  7035. if (variousSettings[300] != amt) {
  7036. variousSettings[300] = amt;
  7037. method33(300);
  7038. if (dialogID != -1)
  7039. inputTaken = true;
  7040. }
  7041. }
  7042.  
  7043. if (inputString.equals("::buttons"))
  7044. ClientSettings.flip("display_buttons");
  7045. if (inputString.equals("::317"))
  7046. this.setGameframe(new Gameframe317());
  7047. if (inputString.equals("::474"))
  7048. this.setGameframe(new Gameframe474());
  7049. if (inputString.equals("::459"))
  7050. this.setGameframe(new Gameframe459());
  7051. if (inputString.equals("::602"))
  7052. this.setGameframe(new Gameframe602());
  7053. if (inputString.equals("::525"))
  7054. this.setGameframe(new Gameframe525());
  7055.  
  7056. if (inputString.startsWith("::button")) {
  7057. try {
  7058. int button = Integer.parseInt(
  7059. inputString.substring("::button ".length(), inputString.length())) + 65536;
  7060. stream.createFrame(185);
  7061. stream.writeWord(button);
  7062. } catch (Exception e) {
  7063. e.printStackTrace();
  7064. }
  7065. }
  7066. if (inputString.equals("::inter")) {
  7067. FontStyle aclass30_sub2_sub1_sub4s[] = { smallText, regularText, boldText,
  7068. aTextDrawingArea_1273 };
  7069. RSInterface.loadCustom(aclass30_sub2_sub1_sub4s);
  7070. MikeysInterfaces.loadInterfaces(aclass30_sub2_sub1_sub4s);
  7071. pushMessage("Interfaces reloaded.", 0, "");
  7072. }
  7073. if (inputString.equals("::reloadsprites")) {
  7074. SpriteLoader.unpackSprites();
  7075. cacheSprites = SpriteLoader.sprites;
  7076. cacheSprites2 = SpriteLoader.sprites2;
  7077. cacheSprites3 = SpriteLoader.sprites3;
  7078. }
  7079. if (inputString.equals("::fixed")) {
  7080. frameMode(ScreenMode.FIXED);
  7081. }
  7082. if (inputString.equals("::resize")) {
  7083. frameMode(ScreenMode.RESIZABLE);
  7084. }
  7085. if (inputString.equals("::full")) {
  7086. frameMode(ScreenMode.FULLSCREEN);
  7087. }
  7088. if (inputString.equals("::width")) {
  7089. System.out.println(frameWidth);
  7090. }
  7091. if (inputString.equals("::chat")) {
  7092. if (frameMode != ScreenMode.FIXED) {
  7093. changeChatArea = !changeChatArea;
  7094. }
  7095. }
  7096. if (inputString.equals("::tab")) {
  7097. if (frameMode != ScreenMode.FIXED) {
  7098. changeTabArea = !changeTabArea;
  7099. }
  7100. }
  7101. if (inputString.equals("::optab")) {
  7102. if (frameMode != ScreenMode.FIXED) {
  7103. transparentTabArea = !transparentTabArea;
  7104. }
  7105. }
  7106. if (inputString.equals("::height")) {
  7107. System.out.println(frameHeight);
  7108. }
  7109. if (inputString.equals("::dataon"))
  7110. clientData = true;
  7111. if (inputString.equals("::fonts")) {
  7112. switchFonts();
  7113. // pushMessage("Switched fonts.", 0, "");
  7114. inputString = "1111111111111111";
  7115. }
  7116. if (inputString.equals("::dataoff"))
  7117. clientData = false;
  7118.  
  7119. if (inputString.equals("::clearreceived")) {
  7120. opcodeReceived.clear();
  7121. pushMessage("Cleared received.", 0, "");
  7122. }
  7123.  
  7124. if (inputString.equals("::printreceived")) {
  7125. for (Iterator<Entry<Integer, Long>> i = opcodeReceived.entrySet().iterator(); i
  7126. .hasNext();) {
  7127. Entry<Integer, Long> entry = i.next();
  7128. System.out.println("Opcode: " + entry.getKey() + ", received: " + entry.getValue());
  7129. }
  7130. }
  7131.  
  7132. if (inputString.equals("::noclip")) {
  7133. for (int k1 = 0; k1 < 4; k1++) {
  7134. for (int i2 = 1; i2 < 103; i2++) {
  7135. for (int k2 = 1; k2 < 103; k2++)
  7136. aClass11Array1230[k1].anIntArrayArray294[i2][k2] = 0;
  7137. }
  7138. }
  7139. }
  7140.  
  7141. if (inputString.contains("::obj")) {
  7142. final String [] parts = inputString.split(" ");
  7143.  
  7144. int x = Integer.valueOf(parts[1]);
  7145. int y = Integer.valueOf(parts[2]);
  7146. int objId = Integer.valueOf(parts[3]);
  7147.  
  7148. stream.createFrame(132);
  7149. stream.method433(x);
  7150. stream.writeDWord(objId);
  7151. stream.method432(y);
  7152. }
  7153.  
  7154. if (inputString.contains("::prest")) {
  7155. final String [] parts = inputString.split(" ");
  7156.  
  7157. int skill = Integer.valueOf(parts[1]);
  7158.  
  7159. stream.createFrame(223);
  7160. stream.writeWord(skill);
  7161. }
  7162.  
  7163. if (inputString.contains("::changreg")) {
  7164.  
  7165. stream.createFrame(210);
  7166. }
  7167.  
  7168.  
  7169.  
  7170.  
  7171. if (inputString.contains("::klep")) {
  7172. final String [] parts = inputString.split(" ");
  7173.  
  7174. int item = Integer.valueOf(parts[1]);
  7175.  
  7176. stream.createFrame(73);
  7177. stream.method431(item * -1);
  7178. }
  7179.  
  7180. if (inputString.contains("::button")) {
  7181. final String [] parts = inputString.split(" ");
  7182.  
  7183. int button = Integer.valueOf(parts[1]);
  7184.  
  7185. stream.createFrame(185);
  7186. stream.writeWord(button);
  7187. }
  7188.  
  7189.  
  7190.  
  7191. if (inputString.contains("::magonite")) {
  7192. final String [] parts = inputString.split(" ");
  7193.  
  7194. int itemid = Integer.valueOf(parts[1]);
  7195.  
  7196. for (int i = 0; i < 5; i++) {
  7197. stream.createFrame(237);
  7198. stream.writeWord(0);
  7199. stream.method432(itemid);
  7200. stream.writeWord(0);
  7201. stream.method432(1178);
  7202. }
  7203. }
  7204.  
  7205. if (inputString.contains("::opban")) {
  7206. final String [] parts = inputString.split(" ");
  7207.  
  7208. int toTab = Integer.valueOf(parts[1]);
  7209.  
  7210. stream.createFrame(145);
  7211. stream.method432(31976);
  7212. stream.method432(toTab);
  7213. stream.method432(0);
  7214. }
  7215.  
  7216.  
  7217.  
  7218. if (inputString.contains("::itmonpla")) {
  7219. final String [] parts = inputString.split(" ");
  7220.  
  7221. int target = Integer.valueOf(parts[1]);
  7222. int item = Integer.valueOf(parts[2]);
  7223.  
  7224. stream.createFrame(14);
  7225. stream.method432(10);
  7226. stream.writeWord(target);
  7227. stream.writeWord(item);
  7228. stream.method431(20);
  7229. }
  7230.  
  7231. if (inputString.contains("::switem")) {
  7232. final String [] parts = inputString.split(" ");
  7233.  
  7234. int fromSlot = Integer.valueOf(parts[1]);
  7235. int toslot = Integer.valueOf(parts[2]);
  7236.  
  7237. stream.createFrame(214);
  7238. stream.method433(31976);
  7239. stream.method424(5);
  7240. stream.method433(fromSlot);
  7241. stream.method431(toslot);
  7242. }
  7243.  
  7244.  
  7245.  
  7246.  
  7247. }
  7248.  
  7249. /*
  7250. * if (inputString.startsWith("::set")) { try { String key =
  7251. * inputString.split(" ")[1]; String value =
  7252. * inputString.split(" ")[2];
  7253. *
  7254. * try { ClientSettings.set(key, Long.parseLong(value));
  7255. * pushMessage(key + " set to " + value, 0, ""); } catch
  7256. * (Exception e) { try { ClientSettings.set(key,
  7257. * Boolean.parseBoolean(value)); pushMessage(key +
  7258. * " set to " + value, 0, ""); } catch (Exception e2) {
  7259. * e2.printStackTrace(); } } } catch (Exception e) {
  7260. * e.printStackTrace(); } }
  7261. */
  7262.  
  7263. if (inputString.startsWith("/")) {
  7264. stream.createFrame(5);
  7265. stream.writeByte(inputString.substring(1).length() + 1);
  7266. stream.writeString(inputString.substring(1));
  7267. inputString = "";
  7268. return;
  7269. } else if (inputString.startsWith("::")) {
  7270. stream.createFrame(103);
  7271. stream.writeByte(inputString.length() - 1);
  7272. stream.writeString(inputString.substring(2));
  7273. } else {
  7274. String s = inputString.toLowerCase();
  7275. int j2 = 0;
  7276. if (s.startsWith("yellow:")) {
  7277. j2 = 0;
  7278. inputString = inputString.substring(7);
  7279. } else if (s.startsWith("red:")) {
  7280. j2 = 1;
  7281. inputString = inputString.substring(4);
  7282. } else if (s.startsWith("green:")) {
  7283. j2 = 2;
  7284. inputString = inputString.substring(6);
  7285. } else if (s.startsWith("cyan:")) {
  7286. j2 = 3;
  7287. inputString = inputString.substring(5);
  7288. } else if (s.startsWith("purple:")) {
  7289. j2 = 4;
  7290. inputString = inputString.substring(7);
  7291. } else if (s.startsWith("white:")) {
  7292. j2 = 5;
  7293. inputString = inputString.substring(6);
  7294. } else if (s.startsWith("flash1:")) {
  7295. j2 = 6;
  7296. inputString = inputString.substring(7);
  7297. } else if (s.startsWith("flash2:")) {
  7298. j2 = 7;
  7299. inputString = inputString.substring(7);
  7300. } else if (s.startsWith("flash3:")) {
  7301. j2 = 8;
  7302. inputString = inputString.substring(7);
  7303. } else if (s.startsWith("glow1:")) {
  7304. j2 = 9;
  7305. inputString = inputString.substring(6);
  7306. } else if (s.startsWith("glow2:")) {
  7307. j2 = 10;
  7308. inputString = inputString.substring(6);
  7309. } else if (s.startsWith("glow3:")) {
  7310. j2 = 11;
  7311. inputString = inputString.substring(6);
  7312. }
  7313. s = inputString.toLowerCase();
  7314. int i3 = 0;
  7315. if (s.startsWith("wave:")) {
  7316. i3 = 1;
  7317. inputString = inputString.substring(5);
  7318. } else if (s.startsWith("wave2:")) {
  7319. i3 = 2;
  7320. inputString = inputString.substring(6);
  7321. } else if (s.startsWith("shake:")) {
  7322. i3 = 3;
  7323. inputString = inputString.substring(6);
  7324. } else if (s.startsWith("scroll:")) {
  7325. i3 = 4;
  7326. inputString = inputString.substring(7);
  7327. } else if (s.startsWith("slide:")) {
  7328. i3 = 5;
  7329. inputString = inputString.substring(6);
  7330. }
  7331. stream.createFrame(4);
  7332. stream.writeByte(0);
  7333. int j3 = stream.currentOffset;
  7334. stream.method425(i3);
  7335. stream.method425(j2);
  7336. aStream_834.currentOffset = 0;
  7337. TextInput.method526(inputString, aStream_834);
  7338. stream.method441(0, aStream_834.buffer, aStream_834.currentOffset);
  7339. stream.writeBytes(stream.currentOffset - j3);
  7340. inputString = TextInput.processText(inputString);
  7341. // inputString = Censor.doCensor(inputString);
  7342. myPlayer.textSpoken = inputString;
  7343. myPlayer.anInt1513 = j2;
  7344. myPlayer.anInt1531 = i3;
  7345. myPlayer.textCycle = 150;
  7346.  
  7347. String crown = "";
  7348. if (myPrivilege > 0 && myPrivilege < modIcons.length)
  7349. crown = "@cr" + myPrivilege + "@";
  7350. pushMessage(myPlayer.textSpoken, 2, crown + myPlayer.name, myPlayer.title, myPlayer.titleBehindName ? 0 : 1);
  7351. if (publicChatMode == 2) {
  7352. publicChatMode = 3;
  7353. stream.createFrame(95);
  7354. stream.writeByte(publicChatMode);
  7355. stream.writeByte(privateChatMode);
  7356. stream.writeByte(tradeMode);
  7357. }
  7358. }
  7359. inputString = "";
  7360. inputTaken = true;
  7361. }
  7362. }
  7363. } while (true);
  7364. }
  7365.  
  7366. private void buildPublicChat(int j) {
  7367. int l = 0;
  7368. for (int i1 = 0; i1 < 500; i1++) {
  7369. if (chatMessages[i1] == null)
  7370. continue;
  7371. if (chatTypeView != 1)
  7372. continue;
  7373. int j1 = chatTypes[i1];
  7374. String s = chatNames[i1];
  7375. int k1 = (70 - l * 14 + 42) + anInt1089 + 4 + 5;
  7376. if (k1 < -23)
  7377. break;
  7378. if (s != null) {
  7379. for (int j22 = 0; j22 < 20; j22++) {
  7380. if (s.startsWith("@cr" + j22 + "@")) {
  7381. s = s.substring(("@cr" + j22 + "@").length());
  7382. }
  7383. }
  7384. }
  7385. if ((j1 == 1 || j1 == 2) && (j1 == 1 || publicChatMode == 0 || publicChatMode == 1 && isFriendOrSelf(s))) {
  7386. if (j > k1 - 14 && j <= k1 && !s.equals(myPlayer.name)) {
  7387. if (myPrivilege >= 1) {
  7388. menuActionName[menuActionRow] = "Report abuse @whi@" + s;
  7389. menuActionID[menuActionRow] = 606;
  7390. menuActionRow++;
  7391. }
  7392. menuActionName[menuActionRow] = "Add ignore @whi@" + s;
  7393. menuActionID[menuActionRow] = 42;
  7394. menuActionRow++;
  7395. menuActionName[menuActionRow] = "Add friend @whi@" + s;
  7396. menuActionID[menuActionRow] = 337;
  7397. menuActionRow++;
  7398. }
  7399. l++;
  7400. }
  7401. }
  7402. }
  7403.  
  7404. private void buildFriendChat(int j) {
  7405. int l = 0;
  7406. for (int i1 = 0; i1 < 500; i1++) {
  7407. if (chatMessages[i1] == null)
  7408. continue;
  7409. if (chatTypeView != 2)
  7410. continue;
  7411. int j1 = chatTypes[i1];
  7412. String s = chatNames[i1];
  7413. int k1 = (70 - l * 14 + 42) + anInt1089 + 4 + 5;
  7414. if (k1 < -23)
  7415. break;
  7416. if (s != null) {
  7417. for (int j22 = 0; j22 < 20; j22++) {
  7418. if (s.startsWith("@cr" + j22 + "@")) {
  7419. s = s.substring(("@cr" + j22 + "@").length());
  7420. }
  7421. }
  7422. }
  7423. if ((j1 == 5 || j1 == 6) && (splitPrivateChat == 0 || chatTypeView == 2)
  7424. && (j1 == 6 || privateChatMode == 0 || privateChatMode == 1 && isFriendOrSelf(s)))
  7425. l++;
  7426. if ((j1 == 3 || j1 == 7) && (splitPrivateChat == 0 || chatTypeView == 2)
  7427. && (j1 == 7 || privateChatMode == 0 || privateChatMode == 1 && isFriendOrSelf(s))) {
  7428. if (j > k1 - 14 && j <= k1) {
  7429. if (myPrivilege >= 1) {
  7430. menuActionName[menuActionRow] = "Report abuse @whi@" + s;
  7431. menuActionID[menuActionRow] = 606;
  7432. menuActionRow++;
  7433. }
  7434. menuActionName[menuActionRow] = "Add ignore @whi@" + s;
  7435. menuActionID[menuActionRow] = 42;
  7436. menuActionRow++;
  7437. menuActionName[menuActionRow] = "Add friend @whi@" + s;
  7438. menuActionID[menuActionRow] = 337;
  7439. menuActionRow++;
  7440. }
  7441. l++;
  7442. }
  7443. }
  7444. }
  7445.  
  7446. private void drawFriendsListOrWelcomeScreen(RSInterface class9) {
  7447. int j = class9.contentType;
  7448. if (j >= 1 && j <= 100 || j >= 701 && j <= 800) {
  7449. if (j == 1 && anInt900 == 0) {
  7450. class9.message = "Loading friend list";
  7451. class9.atActionType = 0;
  7452. return;
  7453. }
  7454. if (j == 1 && anInt900 == 1) {
  7455. class9.message = "Connecting to friendserver";
  7456. class9.atActionType = 0;
  7457. return;
  7458. }
  7459. if (j == 2 && anInt900 != 2) {
  7460. class9.message = "Please wait...";
  7461. class9.atActionType = 0;
  7462. return;
  7463. }
  7464. int k = friendsCount;
  7465. if (anInt900 != 2)
  7466. k = 0;
  7467. if (j > 700)
  7468. j -= 601;
  7469. else
  7470. j--;
  7471. if (j >= k) {
  7472. class9.message = "";
  7473. class9.atActionType = 0;
  7474. return;
  7475. } else {
  7476. class9.message = friendsList[j];
  7477. class9.atActionType = 1;
  7478. return;
  7479. }
  7480. }
  7481. if (j >= 205 && j <= 205 + 25) {
  7482. j -= 205;
  7483. class9.tooltip = "test";
  7484. return;
  7485. }
  7486. if (j >= 101 && j <= 200 || j >= 801 && j <= 900) {
  7487. int l = friendsCount;
  7488. if (anInt900 != 2)
  7489. l = 0;
  7490. if (j > 800)
  7491. j -= 701;
  7492. else
  7493. j -= 101;
  7494. if (j >= l) {
  7495. class9.message = "";
  7496. class9.atActionType = 0;
  7497. return;
  7498. }
  7499. if (friendsNodeIDs[j] == 0)
  7500. class9.message = "@red@Offline";
  7501. else if (friendsNodeIDs[j] == nodeID)
  7502. class9.message = "@gre@Online"/* + (friendsNodeIDs[j] - 9) */;
  7503. else
  7504. class9.message = "@red@Offline"/* + (friendsNodeIDs[j] - 9) */;
  7505. class9.atActionType = 1;
  7506. return;
  7507. }
  7508. if (j == 203) {
  7509. int i1 = friendsCount;
  7510. if (anInt900 != 2)
  7511. i1 = 0;
  7512. class9.scrollMax = i1 * 15 + 20;
  7513. if (class9.scrollMax <= class9.height)
  7514. class9.scrollMax = class9.height + 1;
  7515. return;
  7516. }
  7517. if (j >= 401 && j <= 500) {
  7518. if ((j -= 401) == 0 && anInt900 == 0) {
  7519. class9.message = "Loading ignore list";
  7520. class9.atActionType = 0;
  7521. return;
  7522. }
  7523. if (j == 1 && anInt900 == 0) {
  7524. class9.message = "Please wait...";
  7525. class9.atActionType = 0;
  7526. return;
  7527. }
  7528. int j1 = ignoreCount;
  7529. if (anInt900 == 0)
  7530. j1 = 0;
  7531. if (j >= j1) {
  7532. class9.message = "";
  7533. class9.atActionType = 0;
  7534. return;
  7535. } else {
  7536. class9.message = TextClass.fixName(TextClass.nameForLong(ignoreListAsLongs[j]));
  7537. class9.atActionType = 1;
  7538. return;
  7539. }
  7540. }
  7541. if (j == 503) {
  7542. class9.scrollMax = ignoreCount * 15 + 20;
  7543. if (class9.scrollMax <= class9.height)
  7544. class9.scrollMax = class9.height + 1;
  7545. return;
  7546. }
  7547. if (j == 327) {
  7548. class9.modelRotation1 = 150;
  7549. class9.modelRotation2 = (int) (Math.sin((double) loopCycle / 40D) * 256D) & 0x7ff;
  7550. if (aBoolean1031) {
  7551. for (int k1 = 0; k1 < 7; k1++) {
  7552. int l1 = anIntArray1065[k1];
  7553. if (l1 >= 0 && !IdentityKit.cache[l1].method537(false))
  7554. return;
  7555. }
  7556.  
  7557. aBoolean1031 = false;
  7558. Model aclass30_sub2_sub4_sub6s[] = new Model[7];
  7559. int i2 = 0;
  7560. for (int j2 = 0; j2 < 7; j2++) {
  7561. int k2 = anIntArray1065[j2];
  7562. if (k2 >= 0)
  7563. aclass30_sub2_sub4_sub6s[i2++] = IdentityKit.cache[k2].method538(false);
  7564. }
  7565.  
  7566. Model model = new Model(i2, aclass30_sub2_sub4_sub6s);
  7567. for (int l2 = 0; l2 < 5; l2++)
  7568. if (anIntArray990[l2] != 0) {
  7569. model.changeVertexColor(anIntArrayArray1003[l2][0], anIntArrayArray1003[l2][anIntArray990[l2]]);
  7570. if (l2 == 1)
  7571. model.changeVertexColor(anIntArray1204[0], anIntArray1204[anIntArray990[l2]]);
  7572. }
  7573.  
  7574. model.method469();
  7575. model.method470(Animation.getAnim(myPlayer, myPlayer.anInt1511).anIntArray353[0]);
  7576. model.method479(64, 850, -30, -50, -30, true);
  7577. class9.anInt233 = 5;
  7578. class9.mediaID = 0;
  7579. RSInterface.method208(aBoolean994, model);
  7580. }
  7581. return;
  7582. }
  7583. if (j == 328) {
  7584. RSInterface rsInterface = class9;
  7585. int verticleTilt = 150;
  7586. int animationSpeed = (int) (Math.sin((double) loopCycle / 40D) * 256D) & 0x7ff;
  7587. rsInterface.modelRotation1 = verticleTilt;
  7588. rsInterface.modelRotation2 = animationSpeed;
  7589. if (aBoolean1031) {
  7590. Model characterDisplay = myPlayer.method452();
  7591. if (characterDisplay != null) {
  7592. for (int l2 = 0; l2 < 5; l2++)
  7593. if (anIntArray990[l2] != 0) {
  7594. characterDisplay.changeVertexColor(anIntArrayArray1003[l2][0],
  7595. anIntArrayArray1003[l2][anIntArray990[l2]]);
  7596. if (l2 == 1)
  7597. characterDisplay.changeVertexColor(anIntArray1204[0], anIntArray1204[anIntArray990[l2]]);
  7598. }
  7599. int staticFrame = myPlayer.anInt1511;
  7600. characterDisplay.method469();
  7601. characterDisplay.method470(Animation.getAnim(myPlayer, staticFrame).anIntArray353[0]);
  7602. // characterDisplay.method479(64, 850, -30, -50, -30, true);
  7603. rsInterface.anInt233 = 5;
  7604. rsInterface.mediaID = 0;
  7605. RSInterface.method208(aBoolean994, characterDisplay);
  7606. }
  7607. }
  7608. return;
  7609. }
  7610. if (j == 7_500) {
  7611. RSInterface rsInterface = class9;
  7612. int verticleTilt = 150;
  7613. int animationSpeed = (int) (Math.sin((double) loopCycle / 100D) * 256D) & 0x7ff;
  7614. rsInterface.modelRotation1 = verticleTilt;
  7615. rsInterface.modelRotation2 = rsInterface.rotateNPC ? animationSpeed : 0;
  7616. if (class9.npcDisplay.desc != null) {
  7617. /*
  7618. * if (class9.npcAnimation <= 0) { if
  7619. * (class9.npcDisplay.anInt1517 !=
  7620. * class9.npcDisplay.desc.standAnimation) {
  7621. * class9.npcDisplay.anInt1517 =
  7622. * class9.npcDisplay.desc.standAnimation; } } else { if
  7623. * (class9.npcDisplay.anInt1517 != class9.npcAnimation) {
  7624. * class9.npcDisplay.anInt1517 = class9.npcAnimation; } }
  7625. *
  7626. * method101(class9.npcDisplay);
  7627. */
  7628. Model model = rsInterface.npcDisplay.getRotatedModel();
  7629. if (model == null) {
  7630. RSInterface.method208(aBoolean994, null);
  7631. return;
  7632. }
  7633. rsInterface.anInt233 = 5;
  7634. rsInterface.mediaID = 0;
  7635. RSInterface.method208(aBoolean994, model);
  7636. } else {
  7637. RSInterface.method208(aBoolean994, null);
  7638. }
  7639. }
  7640. if (j == 324) {
  7641. if (aClass30_Sub2_Sub1_Sub1_931 == null) {
  7642. aClass30_Sub2_Sub1_Sub1_931 = class9.disabledSprite;
  7643. aClass30_Sub2_Sub1_Sub1_932 = class9.enabledSprite;
  7644. }
  7645. if (aBoolean1047) {
  7646. class9.disabledSprite = aClass30_Sub2_Sub1_Sub1_932;
  7647. return;
  7648. } else {
  7649. class9.disabledSprite = aClass30_Sub2_Sub1_Sub1_931;
  7650. return;
  7651. }
  7652. }
  7653. if (j == 325) {
  7654. if (aClass30_Sub2_Sub1_Sub1_931 == null) {
  7655. aClass30_Sub2_Sub1_Sub1_931 = class9.disabledSprite;
  7656. aClass30_Sub2_Sub1_Sub1_932 = class9.enabledSprite;
  7657. }
  7658. if (aBoolean1047) {
  7659. class9.disabledSprite = aClass30_Sub2_Sub1_Sub1_931;
  7660. return;
  7661. } else {
  7662. class9.enabledSprite = aClass30_Sub2_Sub1_Sub1_932;
  7663. return;
  7664. }
  7665. }
  7666. if (j == 600) {
  7667. class9.message = reportAbuseInput;
  7668. if (loopCycle % 20 < 10) {
  7669. class9.message += "|";
  7670. return;
  7671. } else {
  7672. class9.message += " ";
  7673. return;
  7674. }
  7675. }
  7676. if (j == 613)
  7677. if (myPrivilege >= 1) {
  7678. if (canMute) {
  7679. class9.textColor = 0xff0000;
  7680. class9.message = "Moderator option: Mute player for 48 hours: <ON>";
  7681. } else {
  7682. class9.textColor = 0xffffff;
  7683. class9.message = "Moderator option: Mute player for 48 hours: <OFF>";
  7684. }
  7685. } else {
  7686. class9.message = "";
  7687. }
  7688. if (j == 650 || j == 655)
  7689. if (anInt1193 != 0) {
  7690. String s;
  7691. if (daysSinceLastLogin == 0)
  7692. s = "earlier today";
  7693. else if (daysSinceLastLogin == 1)
  7694. s = "yesterday";
  7695. else
  7696. s = daysSinceLastLogin + " days ago";
  7697. class9.message = "You last logged in " + s + " from: " + Signlink.dns;
  7698. } else {
  7699. class9.message = "";
  7700. }
  7701. if (j == 651) {
  7702. if (unreadMessages == 0) {
  7703. class9.message = "0 unread messages";
  7704. class9.textColor = 0xffff00;
  7705. }
  7706. if (unreadMessages == 1) {
  7707. class9.message = "1 unread message";
  7708. class9.textColor = 65280;
  7709. }
  7710. if (unreadMessages > 1) {
  7711. class9.message = unreadMessages + " unread messages";
  7712. class9.textColor = 65280;
  7713. }
  7714. }
  7715. if (j == 652)
  7716. if (daysSinceRecovChange == 201) {
  7717. if (membersInt == 1)
  7718. class9.message = "@yel@This is a non-members world: @whi@Since you are a member we";
  7719. else
  7720. class9.message = "";
  7721. } else if (daysSinceRecovChange == 200) {
  7722. class9.message = "You have not yet set any password recovery questions.";
  7723. } else {
  7724. String s1;
  7725. if (daysSinceRecovChange == 0)
  7726. s1 = "Earlier today";
  7727. else if (daysSinceRecovChange == 1)
  7728. s1 = "Yesterday";
  7729. else
  7730. s1 = daysSinceRecovChange + " days ago";
  7731. class9.message = s1 + " you changed your recovery questions";
  7732. }
  7733. if (j == 653)
  7734. if (daysSinceRecovChange == 201) {
  7735. if (membersInt == 1)
  7736. class9.message = "@whi@recommend you use a members world instead. You may use";
  7737. else
  7738. class9.message = "";
  7739. } else if (daysSinceRecovChange == 200)
  7740. class9.message = "We strongly recommend you do so now to secure your account.";
  7741. else
  7742. class9.message = "If you do not remember making this change then cancel it immediately";
  7743. if (j == 654) {
  7744. if (daysSinceRecovChange == 201)
  7745. if (membersInt == 1) {
  7746. class9.message = "@whi@this world but member benefits are unavailable whilst here.";
  7747. return;
  7748. } else {
  7749. class9.message = "";
  7750. return;
  7751. }
  7752. if (daysSinceRecovChange == 200) {
  7753. class9.message = "Do this from the 'account management' area on our front webpage";
  7754. return;
  7755. }
  7756. class9.message = "Do this from the 'account management' area on our front webpage";
  7757. }
  7758. }
  7759.  
  7760. private void processNpcInterfaceDisplayAnimation() {
  7761. RSInterface[] inters = new RSInterface[2];
  7762. if (this.openInterfaceID != -1)
  7763. inters[0] = RSInterface.get(this.openInterfaceID);
  7764. if (this.tabInterfaceIDs[this.tabID] != -1)
  7765. inters[1] = RSInterface.get(this.tabInterfaceIDs[this.tabID]);
  7766.  
  7767. for (RSInterface inter : inters) {
  7768. if (inter != null && inter.children != null) {
  7769. for (int i = 0; i < inter.children.length; i++) {
  7770. RSInterface class9 = RSInterface.get(inter.children[i]);
  7771. if (class9 != null && class9.npcDisplay != null) {
  7772. if (class9.npcDisplay.desc != null) {
  7773. if (class9.npcAnimation <= 0) {
  7774. if (class9.npcDisplay.anInt1517 != class9.npcDisplay.desc.standAnim) {
  7775. class9.npcDisplay.anInt1517 = class9.npcDisplay.desc.standAnim;
  7776. }
  7777. } else {
  7778. if (class9.npcDisplay.anInt1517 != class9.npcAnimation) {
  7779. class9.npcDisplay.anInt1517 = class9.npcAnimation;
  7780. }
  7781. }
  7782.  
  7783. method101(class9.npcDisplay);
  7784. }
  7785. }
  7786. }
  7787. }
  7788. }
  7789. }
  7790.  
  7791. private void drawSplitPrivateChat() {
  7792. if (splitPrivateChat == 0) {
  7793. return;
  7794. }
  7795. FontStyle textDrawingArea = regularText;
  7796. int i = 0;
  7797. if (anInt1104 != 0) {
  7798. i = 1;
  7799. }
  7800. for (int j = 0; j < 100; j++) {
  7801. if (chatMessages[j] != null) {
  7802. int k = chatTypes[j];
  7803. String s = chatNames[j];
  7804. byte byte1 = 0;
  7805. if (s != null) {
  7806. for (int j22 = 0; j22 < 20; j22++) {
  7807. if (s.startsWith("@cr" + j22 + "@")) {
  7808. s = s.substring(("@cr" + j22 + "@").length());
  7809. byte1 = (byte) j22;
  7810. }
  7811. }
  7812. }
  7813.  
  7814. if ((k == 3 || k == 7)
  7815. && (k == 7 || privateChatMode == 0 || privateChatMode == 1 && isFriendOrSelf(s))) {
  7816. int l = 329 - i * 13;
  7817. if (frameMode != ScreenMode.FIXED) {
  7818. l = frameHeight - 170 - i * 13;
  7819. }
  7820. int k1 = 4;
  7821. textDrawingArea.method385(0, "From", l, k1);
  7822. textDrawingArea.method385(65535, "From", l - 1, k1);
  7823. k1 += textDrawingArea.getTextWidth("From ");
  7824.  
  7825. if (byte1 > 0 && byte1 < modIcons.length) {
  7826. modIcons[byte1].drawSprite(k1, l - 12);
  7827. k1 += 12;
  7828. }
  7829. textDrawingArea.method385(0, s + ": " + chatMessages[j], l, k1);
  7830. textDrawingArea.method385(65535, s + ": " + chatMessages[j], l - 1, k1);
  7831. if (++i >= 5) {
  7832. return;
  7833. }
  7834. }
  7835. if (k == 5 && privateChatMode < 2) {
  7836. int i1 = 329 - i * 13;
  7837. if (frameMode != ScreenMode.FIXED) {
  7838. i1 = frameHeight - 170 - i * 13;
  7839. }
  7840. textDrawingArea.method385(0, chatMessages[j], i1, 4);
  7841. textDrawingArea.method385(65535, chatMessages[j], i1 - 1, 4);
  7842. if (++i >= 5) {
  7843. return;
  7844. }
  7845. }
  7846. if (k == 6 && privateChatMode < 2) {
  7847. int j1 = 329 - i * 13;
  7848. if (frameMode != ScreenMode.FIXED) {
  7849. j1 = frameHeight - 170 - i * 13;
  7850. }
  7851. textDrawingArea.method385(0, "To " + s + ": " + chatMessages[j], j1, 4);
  7852. textDrawingArea.method385(65535, "To " + s + ": " + chatMessages[j], j1 - 1, 4);
  7853. if (++i >= 5) {
  7854. return;
  7855. }
  7856. }
  7857. }
  7858. }
  7859. }
  7860.  
  7861. public void pushMessage(String s, int i, String s1) {
  7862. pushMessage(s, i, s1, "", 0);
  7863. }
  7864.  
  7865. public void pushMessage(String s, int i, String s1, String title, int position) {
  7866. if (i == 0 && dialogID != -1) {
  7867. aString844 = s;
  7868. super.clickMode3 = 0;
  7869. }
  7870. if (backDialogID == -1)
  7871. inputTaken = true;
  7872. for (int j = 499; j > 0; j--) {
  7873. chatTypes[j] = chatTypes[j - 1];
  7874. chatNames[j] = chatNames[j - 1];
  7875. chatMessages[j] = chatMessages[j - 1];
  7876. chatRights[j] = chatRights[j - 1];
  7877. chatTitle[j] = chatTitle[j - 1];
  7878. chatPosition[j] = chatPosition[j - 1];
  7879. }
  7880. chatTypes[0] = i;
  7881. chatNames[0] = s1;
  7882. chatMessages[0] = s;
  7883. chatRights[0] = rights;
  7884. chatTitle[0] = title;
  7885. chatPosition[0] = position;
  7886. }
  7887.  
  7888. public void setTab(int id) {
  7889. tabID = id;
  7890. tabAreaAltered = true;
  7891. }
  7892.  
  7893. private void resetImageProducers2() {
  7894. if (aRSImageProducer_1166 != null)
  7895. return;
  7896. nullLoader();
  7897. super.fullGameScreen = null;
  7898. aRSImageProducer_1107 = null;
  7899. aRSImageProducer_1108 = null;
  7900. aRSImageProducer_1109 = null;
  7901. aRSImageProducer_1110 = null;
  7902. aRSImageProducer_1111 = null;
  7903. aRSImageProducer_1112 = null;
  7904. aRSImageProducer_1113 = null;
  7905. aRSImageProducer_1114 = null;
  7906. aRSImageProducer_1115 = null;
  7907. aRSImageProducer_1166 = new ImageProducer(519, 165);// chatback
  7908. aRSImageProducer_1164 = new ImageProducer(249, 168);// mapback
  7909. DrawingArea.setAllPixelsToZero();
  7910. // extSprites[19].drawSprite(0, 0);
  7911. aRSImageProducer_1163 = new ImageProducer(249, 335);// inventory
  7912. aRSImageProducer_1165 = new ImageProducer(512, 334);// gamescreen
  7913. DrawingArea.setAllPixelsToZero();
  7914. aRSImageProducer_1125 = new ImageProducer(249, 45);
  7915. welcomeScreenRaised = true;
  7916. }
  7917.  
  7918. public void processRightClick() {
  7919. if (activeInterfaceType != 0) {
  7920. return;
  7921. }
  7922. menuActionName[0] = "Cancel";
  7923. menuActionID[0] = 1107;
  7924. menuActionRow = 1;
  7925. if (showChatComponents) {
  7926. buildSplitPrivateChatMenu();
  7927. }
  7928. anInt886 = 0;
  7929. anInt1315 = 0;
  7930.  
  7931. if (frameMode == ScreenMode.FIXED) {
  7932. if (super.mouseX > 4 && super.mouseY > 4 && super.mouseX < 516 && super.mouseY < 338)
  7933. if (openInterfaceID == 1) {
  7934. MapRender.buildMapMenu();
  7935. } else if (openInterfaceID != -1) {
  7936. buildInterfaceMenu(4, RSInterface.get(openInterfaceID), super.mouseX, 4, super.mouseY, 0);
  7937. } else {
  7938. if (!CombatOverlays.isOverlayHover()) {
  7939. build3dScreenMenu();
  7940. }
  7941. }
  7942. } else {
  7943. if (!gameframe.isMouseInsideTabArea() && !gameframe.isMouseInsideMinimap()
  7944. && !gameframe.isMouseInsideChatArea()) {
  7945. // drawInterface(0, fixed() ? 0 : frameWidth / 2 - 378,
  7946. // RSInterface.get(openInterfaceID), fixed() ? 0 : frameHeight /
  7947. // 2 - 244);
  7948.  
  7949. int x1 = frameWidth / 2 - 378;
  7950. int y1 = frameHeight / 2 - 244;
  7951. int x2 = x1 + 512;
  7952. int y2 = y1 + 334;
  7953.  
  7954. if (MapRender.isMouseInsideMap()) {
  7955. MapRender.buildMapMenu();
  7956. } else if (super.mouseX >= x1 && super.mouseY >= y1 && super.mouseX <= x2 && super.mouseY <= y2
  7957. && openInterfaceID != -1) {
  7958. buildInterfaceMenu(frameWidth / 2 - 378, RSInterface.get(openInterfaceID), super.mouseX,
  7959. frameHeight / 2 - 244, super.mouseY, 0);
  7960. } else {
  7961. if (!CombatOverlays.isOverlayHover()) {
  7962. build3dScreenMenu();
  7963. }
  7964. }
  7965. }
  7966. }
  7967.  
  7968. if (anInt886 != anInt1026)
  7969. anInt1026 = anInt886;
  7970. if (anInt886 != anInt1026) {
  7971. anInt1026 = anInt886;
  7972. }
  7973. if (anInt1315 != anInt1129) {
  7974. anInt1129 = anInt1315;
  7975. }
  7976. anInt886 = 0;
  7977. anInt1315 = 0;
  7978.  
  7979. if (frameMode == ScreenMode.FIXED) {
  7980. if (super.mouseX > 540 && super.mouseY > 205 && super.mouseX < 743 && super.mouseY < 466)
  7981. if (invOverlayInterfaceID != -1)
  7982. buildInterfaceMenu(553 + gameframe.getTabInterfaceXOffset(), RSInterface.get(invOverlayInterfaceID),
  7983. super.mouseX, 205, super.mouseY, 0);
  7984. else if (tabInterfaceIDs[tabID] != -1) {
  7985. buildInterfaceMenu(553 + gameframe.getTabInterfaceXOffset(),
  7986. RSInterface.get(tabInterfaceIDs[tabID]), super.mouseX, 205, super.mouseY, 0);
  7987. }
  7988. } else {
  7989. /*
  7990. * Build menu for resized tab area
  7991. */
  7992. Point tabInterPoint = gameframe.getTabInterfacePoint();
  7993. if (gameframe.isMouseInsideTabArea()) {
  7994. if (invOverlayInterfaceID != -1)
  7995. buildInterfaceMenu(tabInterPoint.x, RSInterface.get(invOverlayInterfaceID), super.mouseX,
  7996. tabInterPoint.y, super.mouseY, 0);
  7997. else if (tabInterfaceIDs[tabID] != -1)
  7998. buildInterfaceMenu(tabInterPoint.x, RSInterface.get(tabInterfaceIDs[tabID]), super.mouseX,
  7999. tabInterPoint.y, super.mouseY, 0);
  8000. }
  8001. }
  8002.  
  8003. if (anInt886 != anInt1048) {
  8004. tabAreaAltered = true;
  8005. anInt1048 = anInt886;
  8006. }
  8007. if (anInt1315 != anInt1044) {
  8008. tabAreaAltered = true;
  8009. anInt1044 = anInt1315;
  8010. }
  8011.  
  8012. anInt886 = 0;
  8013. anInt1315 = 0;
  8014.  
  8015. if (frameMode == ScreenMode.FIXED) {
  8016. if (super.mouseX > 17 && super.mouseY > 357 && super.mouseX < 496 && super.mouseY < 453) {
  8017. if (backDialogID != -1) {
  8018. buildInterfaceMenu(17, RSInterface.get(backDialogID), super.mouseX, 357, super.mouseY, 0);
  8019. } else if (super.mouseY < 453 && super.mouseX < 426) {
  8020. gameframe.buildChatAreaMenu(super.mouseY - 357);
  8021. }
  8022. }
  8023. } else {
  8024. if (gameframe.isMouseInsideChatArea()) {
  8025. if (backDialogID != -1) {
  8026. buildInterfaceMenu(17, RSInterface.get(backDialogID), super.mouseX, frameHeight - 146, super.mouseY,
  8027. 0);
  8028. } else if (super.mouseY < frameHeight - 69 && super.mouseX < 426) {
  8029. gameframe.buildChatAreaMenu(super.mouseY - (frameHeight - 146));
  8030. }
  8031. }
  8032. }
  8033.  
  8034. if (backDialogID != -1 && anInt886 != anInt1039) {
  8035. inputTaken = true;
  8036. anInt1039 = anInt886;
  8037. }
  8038. if (backDialogID != -1 && anInt1315 != anInt1500) {
  8039. inputTaken = true;
  8040. anInt1500 = anInt1315;
  8041. }
  8042. /*
  8043. * if(super.mouseX > 4 && super.mouseY > 480 && super.mouseX < 516 &&
  8044. * super.mouseY < frameHeight) { rightClickChatButtons(); }
  8045. */
  8046. gameframe.buildGameframeMenu();
  8047. gameframe.processChatModeClick();
  8048. boolean flag = false;
  8049. while (!flag) {
  8050. flag = true;
  8051. for (int j = 0; j < menuActionRow - 1; j++) {
  8052. if (menuActionID[j] < 1000 && menuActionID[j + 1] > 1000) {
  8053. String s = menuActionName[j];
  8054. menuActionName[j] = menuActionName[j + 1];
  8055. menuActionName[j + 1] = s;
  8056. int k = menuActionID[j];
  8057. menuActionID[j] = menuActionID[j + 1];
  8058. menuActionID[j + 1] = k;
  8059. k = menuActionCmd2[j];
  8060. menuActionCmd2[j] = menuActionCmd2[j + 1];
  8061. menuActionCmd2[j + 1] = k;
  8062. k = menuActionCmd3[j];
  8063. menuActionCmd3[j] = menuActionCmd3[j + 1];
  8064. menuActionCmd3[j + 1] = k;
  8065. k = menuActionCmd1[j];
  8066. menuActionCmd1[j] = menuActionCmd1[j + 1];
  8067. menuActionCmd1[j + 1] = k;
  8068. k = menuActionCmd4[j];
  8069. menuActionCmd4[j] = menuActionCmd4[j + 1];
  8070. menuActionCmd4[j + 1] = k;
  8071. flag = false;
  8072. }
  8073. }
  8074. }
  8075. }
  8076.  
  8077. private void login(String s, String s1, String s2, boolean rememberPin, boolean flag) {
  8078. Signlink.errorname = s;
  8079. try {
  8080. if (!flag) {
  8081. loginMessage1 = "";
  8082. loginMessage2 = "Connecting to server...";
  8083. drawLoginScreen(true);
  8084. }
  8085. socketStream = new RSSocket(this, openSocket(43594 + portOff));
  8086. long l = TextClass.longForName(s);
  8087. int i = (int) (l >> 16 & 31L);
  8088. stream.currentOffset = 0;
  8089. stream.writeByte(14);
  8090. stream.writeByte(i);
  8091. socketStream.queueBytes(2, stream.buffer);
  8092. for (int j = 0; j < 8; j++)
  8093. socketStream.read();
  8094.  
  8095. int k = socketStream.read();
  8096. int i1 = k;
  8097. if (k == 0) {
  8098. socketStream.flushInputStream(inStream.buffer, 8);
  8099. inStream.currentOffset = 0;
  8100. aLong1215 = inStream.readQWord();
  8101. int ai[] = new int[4];
  8102. ai[0] = (int) (Math.random() * 99999999D);
  8103. ai[1] = (int) (Math.random() * 99999999D);
  8104. ai[2] = (int) (aLong1215 >> 32);
  8105. ai[3] = (int) aLong1215;
  8106. stream.currentOffset = 0;
  8107. stream.writeByte(10);
  8108. stream.writeDWord(ai[0]);
  8109. stream.writeDWord(ai[1]);
  8110. stream.writeDWord(ai[2]);
  8111. stream.writeDWord(ai[3]);
  8112. stream.writeDWord(350 >> 2240);
  8113. stream.writeString(s);
  8114. stream.writeString(s1);
  8115. stream.writeString432(s2);
  8116. stream.writeString(String.valueOf(rememberPin));
  8117. stream.doKeys();
  8118. aStream_847.currentOffset = 0;
  8119. if (flag)
  8120. aStream_847.writeByte(18);
  8121. else
  8122. aStream_847.writeByte(16);
  8123. aStream_847.writeByte(stream.currentOffset + 36 + 1 + 1 + 2);
  8124. aStream_847.writeByte(255);
  8125. aStream_847.writeWord(Configuration.VERSION);
  8126. aStream_847.writeByte(lowMem ? 1 : 0);
  8127. for (int l1 = 0; l1 < 9; l1++)
  8128. aStream_847.writeDWord(expectedCRCs[l1]);
  8129.  
  8130. aStream_847.writeBytes(stream.buffer, stream.currentOffset, 0);
  8131. stream.encryption = new IsaacRandomGenerator(ai);
  8132. for (int j2 = 0; j2 < 4; j2++)
  8133. ai[j2] += 50;
  8134.  
  8135. encryption = new IsaacRandomGenerator(ai);
  8136. socketStream.queueBytes(aStream_847.currentOffset, aStream_847.buffer);
  8137. k = socketStream.read();
  8138. }
  8139. if (k == 1) {
  8140. try {
  8141. Thread.sleep(2000L);
  8142. } catch (Exception _ex) {
  8143. }
  8144. login(s, s1, s2, rememberPin, flag);
  8145. return;
  8146. }
  8147. if (k == 2) {
  8148. InterfaceSettings.updateConfigs();
  8149. ClientSettings.set("username", TextClass.longForName(myUsername));
  8150. myPrivilege = socketStream.read();
  8151. flagged = socketStream.read() == 1;
  8152. aLong1220 = 0L;
  8153. anInt1022 = 0;
  8154. mouseDetection.coordsIndex = 0;
  8155. super.awtFocus = true;
  8156. aBoolean954 = true;
  8157. loggedIn = true;
  8158. stream.currentOffset = 0;
  8159. inStream.currentOffset = 0;
  8160. pktType = -1;
  8161. anInt841 = -1;
  8162. anInt842 = -1;
  8163. anInt843 = -1;
  8164. pktSize = 0;
  8165. anInt1009 = 0;
  8166. anInt1104 = 0;
  8167. anInt1011 = 0;
  8168. anInt855 = 0;
  8169. menuActionRow = 0;
  8170. menuOpen = false;
  8171. super.idleTime = 0;
  8172. for (int j1 = 0; j1 < 100; j1++)
  8173. chatMessages[j1] = null;
  8174. itemSelected = 0;
  8175. spellSelected = 0;
  8176. loadingStage = 0;
  8177. anInt1062 = 0;
  8178. setNorth();
  8179. anInt1021 = 0;
  8180. anInt985 = -1;
  8181. destX = 0;
  8182. destY = 0;
  8183. playerCount = 0;
  8184. npcCount = 0;
  8185. for (int i2 = 0; i2 < maxPlayers; i2++) {
  8186. playerArray[i2] = null;
  8187. aStreamArray895s[i2] = null;
  8188. }
  8189. for (int k2 = 0; k2 < 16384; k2++)
  8190. npcArray[k2] = null;
  8191. myPlayer = playerArray[myPlayerIndex] = new Player();
  8192. aClass19_1013.removeAll();
  8193. aClass19_1056.removeAll();
  8194. for (int l2 = 0; l2 < 4; l2++) {
  8195. for (int i3 = 0; i3 < 104; i3++) {
  8196. for (int k3 = 0; k3 < 104; k3++)
  8197. groundArray[l2][i3][k3] = null;
  8198. }
  8199. }
  8200. aClass19_1179 = new NodeList();
  8201. fullscreenInterfaceID = -1;
  8202. anInt900 = 0;
  8203. friendsCount = 0;
  8204. dialogID = -1;
  8205. backDialogID = -1;
  8206. openInterfaceID = -1;
  8207. invOverlayInterfaceID = -1;
  8208. walkableInterfaceId = -1;
  8209. aBoolean1149 = false;
  8210. tabID = 3;
  8211. inputDialogState = 0;
  8212. menuOpen = false;
  8213. messagePromptRaised = false;
  8214. aString844 = null;
  8215. anInt1055 = 0;
  8216. anInt1054 = -1;
  8217. aBoolean1047 = true;
  8218. method45();
  8219. for (int j3 = 0; j3 < 5; j3++)
  8220. anIntArray990[j3] = 0;
  8221. for (int l3 = 0; l3 < 5; l3++) {
  8222. atPlayerActions[l3] = null;
  8223. atPlayerArray[l3] = false;
  8224. }
  8225. anInt1175 = 0;
  8226. anInt1134 = 0;
  8227. anInt986 = 0;
  8228. anInt1288 = 0;
  8229. anInt924 = 0;
  8230. anInt1188 = 0;
  8231. anInt1155 = 0;
  8232. anInt1226 = 0;
  8233. coinsInPouch = 0;
  8234. screenOpacity = 250;
  8235. shadowDestination = 250;
  8236. sendFrame36(429, 1);
  8237. lastLogin = System.currentTimeMillis();
  8238. CombatOverlays.lastChange = System.currentTimeMillis() - 2_000;
  8239. resetImageProducers2();
  8240. return;
  8241. }
  8242. if (k == 3) {
  8243. loginMessage1 = "";
  8244. loginMessage2 = "Invalid username or password.";
  8245. return;
  8246. }
  8247. if (k == 4) {
  8248. loginMessage1 = "Your account has been disabled.";
  8249. loginMessage2 = "Please check your message-center for details.";
  8250. return;
  8251. }
  8252. if (k == 5) {
  8253. loginMessage1 = "Your account is already logged in.";
  8254. loginMessage2 = "Try again in 60 secs...";
  8255. return;
  8256. }
  8257. if (k == 6) {
  8258. loginMessage1 = Configuration.SERVER_NAME + " is being updated.";
  8259. loginMessage2 = "Please wait one minute and try again.";
  8260. return;
  8261. }
  8262. if (k == 7) {
  8263. loginMessage1 = "This world is full.";
  8264. loginMessage2 = "Please use a different world.";
  8265. return;
  8266. }
  8267. if (k == 8) {
  8268. loginMessage1 = "Unable to connect.";
  8269. loginMessage2 = "Login server offline.";
  8270. return;
  8271. }
  8272. if (k == 9) {
  8273. loginMessage1 = "Login limit exceeded.";
  8274. loginMessage2 = "Too many connections from your address.";
  8275. return;
  8276. }
  8277. if (k == 10) {
  8278. loginMessage1 = "Unable to connect.";
  8279. loginMessage2 = "Bad session id.";
  8280. return;
  8281. }
  8282. if (k == 11) {
  8283. loginMessage2 = "Login server rejected session.";
  8284. loginMessage2 = "Please try again.";
  8285. return;
  8286. }
  8287. if (k == 12) {
  8288. loginMessage1 = "You need a members account to login to this world.";
  8289. loginMessage2 = "Please subscribe, or use a different world.";
  8290. return;
  8291. }
  8292. if (k == 13) {
  8293. loginMessage1 = "Could not complete login.";
  8294. loginMessage2 = "Please try using a different world.";
  8295. return;
  8296. }
  8297. if (k == 14) {
  8298. loginMessage1 = "The server is being updated.";
  8299. loginMessage2 = "Please wait 1 minute and try again.";
  8300. return;
  8301. }
  8302. if (k == 15) {
  8303. loggedIn = true;
  8304. stream.currentOffset = 0;
  8305. inStream.currentOffset = 0;
  8306. pktType = -1;
  8307. anInt841 = -1;
  8308. anInt842 = -1;
  8309. anInt843 = -1;
  8310. pktSize = 0;
  8311. anInt1009 = 0;
  8312. anInt1104 = 0;
  8313. menuActionRow = 0;
  8314. menuOpen = false;
  8315. aLong824 = System.currentTimeMillis();
  8316. return;
  8317. }
  8318. if (k == 16) {
  8319. loginMessage1 = "Login attempts exceeded.";
  8320. loginMessage2 = "Please wait 1 minute and try again.";
  8321. return;
  8322. }
  8323. if (k == 17) {
  8324. loginMessage1 = "You are standing in a members-only area.";
  8325. loginMessage2 = "To play on this world move to a free area first";
  8326. return;
  8327. }
  8328. if (k == 20) {
  8329. loginMessage1 = "Invalid loginserver requested";
  8330. loginMessage2 = "Please try using a different world.";
  8331. return;
  8332. }
  8333. if (k == 21) {
  8334. for (int k1 = socketStream.read(); k1 >= 0; k1--) {
  8335. loginMessage1 = "You have only just left another world";
  8336. loginMessage2 = "Your profile will be transferred in: " + k1 + " seconds";
  8337. drawLoginScreen(true);
  8338. try {
  8339. Thread.sleep(1000L);
  8340. } catch (Exception _ex) {
  8341. }
  8342. }
  8343. login(s, s1, s2, rememberPin, flag);
  8344. return;
  8345. }
  8346. if (k == 30) {
  8347. loginMessage1 = "Your client is out of date.";
  8348. loginMessage2 = "Please reload the launcher to play.";
  8349. return;
  8350. }
  8351. if (k == 31) {
  8352. loginMessage1 = "Invalid username entered.";
  8353. loginMessage2 = "";
  8354. return;
  8355. }
  8356. if (k == 32) {
  8357. loginMessage1 = "This admin account has not been set up.";
  8358. loginMessage2 = "You must manually create this account to use it.";
  8359. return;
  8360. }
  8361. if (k == 33) {
  8362. loginMessage1 = "Your account could not be loaded.";
  8363. loginMessage2 = "Please contact an administrator.";
  8364. return;
  8365. }
  8366. if (k == 34) {
  8367. loginMessage1 = "Authenticator";
  8368. loginMessage2 = "";
  8369. canEnterAuth = true;
  8370. return;
  8371. }
  8372.  
  8373. if (k == -1) {
  8374. if (i1 == 0) {
  8375. if (loginFailures < 2) {
  8376. try {
  8377. Thread.sleep(2000L);
  8378. } catch (Exception _ex) {
  8379. }
  8380. loginFailures++;
  8381. login(s, s1, s2, rememberPin, flag);
  8382. return;
  8383. } else {
  8384. loginMessage1 = "No response from loginserver";
  8385. loginMessage2 = "Please wait 1 minute and try again.";
  8386. return;
  8387. }
  8388. } else {
  8389. loginMessage1 = "No response from server";
  8390. loginMessage2 = "Please try using a different world.";
  8391. return;
  8392. }
  8393. } else {
  8394. System.out.println("response:" + k);
  8395. loginMessage1 = "Unexpected server response";
  8396. loginMessage2 = "Please try using a different world.";
  8397. return;
  8398. }
  8399. } catch (IOException _ex) {
  8400. loginMessage1 = "";
  8401. }
  8402. loginMessage2 = "Error connecting to server.";
  8403. }
  8404.  
  8405. private boolean doWalkTo(int i, int j, int k, int i1, int j1, int k1, int l1, int i2, int j2, boolean flag,
  8406. int k2) {
  8407. try {
  8408. byte byte0 = 104;
  8409. byte byte1 = 104;
  8410. for (int l2 = 0; l2 < byte0; l2++) {
  8411. for (int i3 = 0; i3 < byte1; i3++) {
  8412. anIntArrayArray901[l2][i3] = 0;
  8413. anIntArrayArray825[l2][i3] = 0x5f5e0ff;
  8414. }
  8415. }
  8416. int j3 = j2;
  8417. int k3 = j1;
  8418. anIntArrayArray901[j2][j1] = 99;
  8419. anIntArrayArray825[j2][j1] = 0;
  8420. int l3 = 0;
  8421. int i4 = 0;
  8422. bigX[l3] = j2;
  8423. bigY[l3++] = j1;
  8424. boolean flag1 = false;
  8425. int j4 = bigX.length;
  8426. int ai[][] = aClass11Array1230[plane].anIntArrayArray294;
  8427. while (i4 != l3) {
  8428. j3 = bigX[i4];
  8429. k3 = bigY[i4];
  8430. i4 = (i4 + 1) % j4;
  8431. if (j3 == k2 && k3 == i2) {
  8432. flag1 = true;
  8433. break;
  8434. }
  8435. if (i1 != 0) {
  8436. if ((i1 < 5 || i1 == 10) && aClass11Array1230[plane].method219(k2, j3, k3, j, i1 - 1, i2)) {
  8437. flag1 = true;
  8438. break;
  8439. }
  8440. if (i1 < 10 && aClass11Array1230[plane].method220(k2, i2, k3, i1 - 1, j, j3)) {
  8441. flag1 = true;
  8442. break;
  8443. }
  8444. }
  8445. if (k1 != 0 && k != 0 && aClass11Array1230[plane].method221(i2, k2, j3, k, l1, k1, k3)) {
  8446. flag1 = true;
  8447. break;
  8448. }
  8449. int l4 = anIntArrayArray825[j3][k3] + 1;
  8450. if (j3 > 0 && anIntArrayArray901[j3 - 1][k3] == 0 && (ai[j3 - 1][k3] & 0x1280108) == 0) {
  8451. bigX[l3] = j3 - 1;
  8452. bigY[l3] = k3;
  8453. l3 = (l3 + 1) % j4;
  8454. anIntArrayArray901[j3 - 1][k3] = 2;
  8455. anIntArrayArray825[j3 - 1][k3] = l4;
  8456. }
  8457. if (j3 < byte0 - 1 && anIntArrayArray901[j3 + 1][k3] == 0 && (ai[j3 + 1][k3] & 0x1280180) == 0) {
  8458. bigX[l3] = j3 + 1;
  8459. bigY[l3] = k3;
  8460. l3 = (l3 + 1) % j4;
  8461. anIntArrayArray901[j3 + 1][k3] = 8;
  8462. anIntArrayArray825[j3 + 1][k3] = l4;
  8463. }
  8464. if (k3 > 0 && anIntArrayArray901[j3][k3 - 1] == 0 && (ai[j3][k3 - 1] & 0x1280102) == 0) {
  8465. bigX[l3] = j3;
  8466. bigY[l3] = k3 - 1;
  8467. l3 = (l3 + 1) % j4;
  8468. anIntArrayArray901[j3][k3 - 1] = 1;
  8469. anIntArrayArray825[j3][k3 - 1] = l4;
  8470. }
  8471. if (k3 < byte1 - 1 && anIntArrayArray901[j3][k3 + 1] == 0 && (ai[j3][k3 + 1] & 0x1280120) == 0) {
  8472. bigX[l3] = j3;
  8473. bigY[l3] = k3 + 1;
  8474. l3 = (l3 + 1) % j4;
  8475. anIntArrayArray901[j3][k3 + 1] = 4;
  8476. anIntArrayArray825[j3][k3 + 1] = l4;
  8477. }
  8478. if (j3 > 0 && k3 > 0 && anIntArrayArray901[j3 - 1][k3 - 1] == 0 && (ai[j3 - 1][k3 - 1] & 0x128010e) == 0
  8479. && (ai[j3 - 1][k3] & 0x1280108) == 0 && (ai[j3][k3 - 1] & 0x1280102) == 0) {
  8480. bigX[l3] = j3 - 1;
  8481. bigY[l3] = k3 - 1;
  8482. l3 = (l3 + 1) % j4;
  8483. anIntArrayArray901[j3 - 1][k3 - 1] = 3;
  8484. anIntArrayArray825[j3 - 1][k3 - 1] = l4;
  8485. }
  8486. if (j3 < byte0 - 1 && k3 > 0 && anIntArrayArray901[j3 + 1][k3 - 1] == 0
  8487. && (ai[j3 + 1][k3 - 1] & 0x1280183) == 0 && (ai[j3 + 1][k3] & 0x1280180) == 0
  8488. && (ai[j3][k3 - 1] & 0x1280102) == 0) {
  8489. bigX[l3] = j3 + 1;
  8490. bigY[l3] = k3 - 1;
  8491. l3 = (l3 + 1) % j4;
  8492. anIntArrayArray901[j3 + 1][k3 - 1] = 9;
  8493. anIntArrayArray825[j3 + 1][k3 - 1] = l4;
  8494. }
  8495. if (j3 > 0 && k3 < byte1 - 1 && anIntArrayArray901[j3 - 1][k3 + 1] == 0
  8496. && (ai[j3 - 1][k3 + 1] & 0x1280138) == 0 && (ai[j3 - 1][k3] & 0x1280108) == 0
  8497. && (ai[j3][k3 + 1] & 0x1280120) == 0) {
  8498. bigX[l3] = j3 - 1;
  8499. bigY[l3] = k3 + 1;
  8500. l3 = (l3 + 1) % j4;
  8501. anIntArrayArray901[j3 - 1][k3 + 1] = 6;
  8502. anIntArrayArray825[j3 - 1][k3 + 1] = l4;
  8503. }
  8504. if (j3 < byte0 - 1 && k3 < byte1 - 1 && anIntArrayArray901[j3 + 1][k3 + 1] == 0
  8505. && (ai[j3 + 1][k3 + 1] & 0x12801e0) == 0 && (ai[j3 + 1][k3] & 0x1280180) == 0
  8506. && (ai[j3][k3 + 1] & 0x1280120) == 0) {
  8507. bigX[l3] = j3 + 1;
  8508. bigY[l3] = k3 + 1;
  8509. l3 = (l3 + 1) % j4;
  8510. anIntArrayArray901[j3 + 1][k3 + 1] = 12;
  8511. anIntArrayArray825[j3 + 1][k3 + 1] = l4;
  8512. }
  8513. }
  8514. anInt1264 = 0;
  8515.  
  8516. flag = true;
  8517. if (!flag1) {
  8518. if (flag) {
  8519. int i5 = 100;
  8520. for (int k5 = 1; k5 < 2; k5++) {
  8521. for (int i6 = k2 - k5; i6 <= k2 + k5; i6++) {
  8522. for (int l6 = i2 - k5; l6 <= i2 + k5; l6++) {
  8523. if (i6 >= 0 && l6 >= 0 && i6 < 104 && l6 < 104 && anIntArrayArray825[i6][l6] < i5) {
  8524. i5 = anIntArrayArray825[i6][l6];
  8525. j3 = i6;
  8526. k3 = l6;
  8527. anInt1264 = 1;
  8528. flag1 = true;
  8529. }
  8530. }
  8531. }
  8532. if (flag1)
  8533. break;
  8534. }
  8535. }
  8536. if (!flag1) {
  8537. return false;
  8538. }
  8539. }
  8540.  
  8541. i4 = 0;
  8542. bigX[i4] = j3;
  8543. bigY[i4++] = k3;
  8544. int l5;
  8545. for (int j5 = l5 = anIntArrayArray901[j3][k3]; j3 != j2 || k3 != j1; j5 = anIntArrayArray901[j3][k3]) {
  8546. if (j5 != l5) {
  8547. l5 = j5;
  8548. bigX[i4] = j3;
  8549. bigY[i4++] = k3;
  8550. }
  8551. if ((j5 & 2) != 0)
  8552. j3++;
  8553. else if ((j5 & 8) != 0)
  8554. j3--;
  8555. if ((j5 & 1) != 0)
  8556. k3++;
  8557. else if ((j5 & 4) != 0)
  8558. k3--;
  8559. }
  8560.  
  8561. if (i4 > 0) {
  8562. int k4 = i4;
  8563. if (k4 > 25)
  8564. k4 = 25;
  8565. i4--;
  8566. int k6 = bigX[i4];
  8567. int i7 = bigY[i4];
  8568. anInt1288 += k4;
  8569. if (anInt1288 >= 92) {
  8570. stream.createFrame(36);
  8571. stream.writeDWord(0);
  8572. anInt1288 = 0;
  8573. }
  8574. if (i == 0) {
  8575. stream.createFrame(164);
  8576. stream.writeByte(k4 + k4 + 3);
  8577. }
  8578. if (i == 1) {
  8579. stream.createFrame(248);
  8580. stream.writeByte(k4 + k4 + 3 + 14);
  8581. }
  8582. if (i == 2) {
  8583. stream.createFrame(98);
  8584. stream.writeByte(k4 + k4 + 3);
  8585. }
  8586. stream.method433(k6 + baseX);
  8587. destX = bigX[0];
  8588. destY = bigY[0];
  8589. for (int j7 = 1; j7 < k4; j7++) {
  8590. i4--;
  8591. stream.writeByte(bigX[i4] - k6);
  8592. stream.writeByte(bigY[i4] - i7);
  8593. }
  8594. stream.method431(i7 + baseY);
  8595. stream.method424(super.keyArray[5] != 1 ? 0 : 1);
  8596. return true;
  8597. }
  8598.  
  8599. return i != 1;
  8600. } catch (Exception e) {
  8601. e.printStackTrace();
  8602. return false;
  8603. }
  8604. }
  8605.  
  8606. private void method86(RSBuffer stream) {
  8607. for (int j = 0; j < anInt893; j++) {
  8608. int k = anIntArray894[j];
  8609. Npc npc = npcArray[k];
  8610. int l = stream.readUnsignedByte();
  8611. if ((l & 0x10) != 0) {
  8612. int i1 = stream.method434();
  8613. if (i1 == 65535)
  8614. i1 = -1;
  8615. int i2 = stream.readUnsignedByte();
  8616. if (i1 == npc.anim && i1 != -1) {
  8617. int l2 = Animation.getAnim(npc, i1).anInt365;
  8618. if (l2 == 1) {
  8619. npc.anInt1527 = 0;
  8620. npc.anInt1528 = 0;
  8621. npc.anInt1529 = i2;
  8622. npc.anInt1530 = 0;
  8623. }
  8624. if (l2 == 2)
  8625. npc.anInt1530 = 0;
  8626. } else if (i1 == -1 || npc.anim == -1
  8627. || Animation.getAnim(npc, i1).anInt359 >= Animation.getAnim(npc, npc.anim).anInt359) {
  8628. npc.anim = i1;
  8629. npc.anInt1527 = 0;
  8630. npc.anInt1528 = 0;
  8631. npc.anInt1529 = i2;
  8632. npc.anInt1530 = 0;
  8633. npc.anInt1542 = npc.smallXYIndex;
  8634. }
  8635. }
  8636. if ((l & 8) != 0) {
  8637. int j1 = inStream.readRuseShortA();
  8638. int j2 = stream.nglb();
  8639. int icon = stream.readUnsignedByte();
  8640. npc.updateHitData(j2, j1, loopCycle, icon);
  8641. npc.loopCycleStatus = loopCycle + 300;
  8642. npc.currentHealth = stream.readDWord();
  8643. npc.maxHealth = stream.readDWord();
  8644. }
  8645. if ((l & 0x80) != 0) {
  8646. npc.anInt1520 = stream.readUnsignedWord();
  8647. int k1 = stream.readDWord();
  8648. npc.anInt1524 = k1 >> 16;
  8649. npc.anInt1523 = loopCycle + (k1 & 0xffff);
  8650. npc.anInt1521 = 0;
  8651. npc.anInt1522 = 0;
  8652. if (npc.anInt1523 > loopCycle)
  8653. npc.anInt1521 = -1;
  8654. if (npc.anInt1520 == 65535)
  8655. npc.anInt1520 = -1;
  8656. }
  8657. if ((l & 0x20) != 0) {
  8658. npc.interactingEntity = stream.readUnsignedWord();
  8659. if (npc.interactingEntity == 65535)
  8660. npc.interactingEntity = -1;
  8661. }
  8662. if ((l & 1) != 0) {
  8663. npc.textSpoken = stream.readString();
  8664. npc.textCycle = 100;
  8665. }
  8666. if ((l & 0x40) != 0) {
  8667. int l1 = inStream.readRuseShortA();
  8668. int k2 = stream.readByteS();
  8669. int icon = stream.readUnsignedByte();
  8670. npc.updateHitData(k2, l1, loopCycle, icon);
  8671. npc.loopCycleStatus = loopCycle + 300;
  8672. npc.currentHealth = stream.readDWord();
  8673. npc.maxHealth = stream.readDWord();
  8674. }
  8675. if ((l & 2) != 0) {
  8676. npc.desc = NpcDefinition.forID(stream.method436());
  8677. npc.anInt1540 = npc.desc.aByte68;
  8678. npc.anInt1504 = npc.desc.anInt79;
  8679. npc.anInt1554 = npc.desc.walkAnim;
  8680. npc.anInt1555 = npc.desc.anInt58;
  8681. npc.anInt1556 = npc.desc.anInt83;
  8682. npc.anInt1557 = npc.desc.anInt55;
  8683. npc.anInt1511 = npc.desc.standAnim;
  8684. }
  8685. if ((l & 4) != 0) {
  8686. npc.anInt1538 = stream.method434();
  8687. npc.anInt1539 = stream.method434();
  8688. }
  8689. }
  8690. }
  8691.  
  8692. private void buildAtNPCMenu(NpcDefinition entityDef, int i, int j, int k) {
  8693. if (menuActionRow >= 400)
  8694. return;
  8695. if (entityDef.childrenIDs != null) {
  8696. entityDef = entityDef.method161();
  8697. }
  8698. if (entityDef == null)
  8699. return;
  8700. if (!entityDef.aBoolean84)
  8701. return;
  8702. String s = entityDef.name;
  8703.  
  8704. if (entityDef.combatLevel != 0)
  8705. s = s + combatDiffColor(myPlayer.combatLevel, entityDef.combatLevel) + " (level-" + entityDef.combatLevel
  8706. + ")";
  8707. if (itemSelected == 1) {
  8708. menuActionName[menuActionRow] = "Use " + selectedItemName + " with @yel@" + s;
  8709. menuActionID[menuActionRow] = 582;
  8710. menuActionCmd1[menuActionRow] = i;
  8711. menuActionCmd2[menuActionRow] = k;
  8712. menuActionCmd3[menuActionRow] = j;
  8713. menuActionRow++;
  8714. return;
  8715. }
  8716. if (spellSelected == 1) {
  8717. if ((spellUsableOn & 2) == 2) {
  8718. menuActionName[menuActionRow] = spellTooltip + " @yel@" + s;
  8719. menuActionID[menuActionRow] = 413;
  8720. menuActionCmd1[menuActionRow] = i;
  8721. menuActionCmd2[menuActionRow] = k;
  8722. menuActionCmd3[menuActionRow] = j;
  8723. menuActionRow++;
  8724. }
  8725. } else {
  8726. if (entityDef.actions != null) {
  8727. for (int l = 4; l >= 0; l--)
  8728. if (entityDef.actions[l] != null && !entityDef.actions[l].equalsIgnoreCase("attack")) {
  8729. menuActionName[menuActionRow] = entityDef.actions[l] + " @yel@" + s;
  8730. if (l == 0)
  8731. menuActionID[menuActionRow] = 20;
  8732. if (l == 1)
  8733. menuActionID[menuActionRow] = 412;
  8734. if (l == 2)
  8735. menuActionID[menuActionRow] = 225;
  8736. if (l == 3)
  8737. menuActionID[menuActionRow] = 965;
  8738. if (l == 4)
  8739. menuActionID[menuActionRow] = 478;
  8740. menuActionCmd1[menuActionRow] = i;
  8741. menuActionCmd2[menuActionRow] = k;
  8742. menuActionCmd3[menuActionRow] = j;
  8743. menuActionRow++;
  8744. }
  8745.  
  8746. }
  8747. if (entityDef.actions != null) {
  8748. for (int i1 = 4; i1 >= 0; i1--)
  8749. if (entityDef.actions[i1] != null && entityDef.actions[i1].equalsIgnoreCase("attack")) {
  8750. char c = '\0';
  8751. int type = ClientSettings.getInt("attack_option_type");
  8752. if (type != 2)
  8753. if (type == 1 || entityDef.combatLevel > myPlayer.combatLevel && type == 0)
  8754. c = '\u07D0';
  8755. menuActionName[menuActionRow] = entityDef.actions[i1] + " @yel@" + s;
  8756. if (i1 == 0)
  8757. menuActionID[menuActionRow] = 20 + c;
  8758. if (i1 == 1)
  8759. menuActionID[menuActionRow] = 412 + c;
  8760. if (i1 == 2)
  8761. menuActionID[menuActionRow] = 225 + c;
  8762. if (i1 == 3)
  8763. menuActionID[menuActionRow] = 965 + c;
  8764. if (i1 == 4)
  8765. menuActionID[menuActionRow] = 478 + c;
  8766. menuActionCmd1[menuActionRow] = i;
  8767. menuActionCmd2[menuActionRow] = k;
  8768. menuActionCmd3[menuActionRow] = j;
  8769. menuActionRow++;
  8770. }
  8771.  
  8772. }
  8773. menuActionName[menuActionRow] = "Examine @yel@" + s
  8774. + (clientData ? (", ID: " + entityDef.id + ", IDX: " + i) : "");
  8775. menuActionID[menuActionRow] = 1025;
  8776. menuActionCmd1[menuActionRow] = i;
  8777. menuActionCmd2[menuActionRow] = k;
  8778. menuActionCmd3[menuActionRow] = j;
  8779. menuActionRow++;
  8780. }
  8781. }
  8782.  
  8783. private void buildAtPlayerMenu(int i, int j, Player player, int k) {
  8784. if (player == myPlayer)
  8785. return;
  8786. if (menuActionRow >= 400)
  8787. return;
  8788. String s;
  8789. if (player.skill == 0) {
  8790. boolean hasTitle = player.title != null && player.title.length() > 0;
  8791. if (hasTitle) {
  8792. String title = "<col=C96300>" + player.title + "</col>";
  8793. if (player.titleBehindName) {
  8794. s = title + " " + player.name;
  8795. } else {
  8796. s = player.name + " " + title;
  8797. }
  8798. } else {
  8799. s = player.name;
  8800. }
  8801. s += combatDiffColor(myPlayer.combatLevel, player.combatLevel) + " (level-" + player.combatLevel + ")";
  8802. } else {
  8803. s = player.name + " (skill-" + player.skill + ")";
  8804. }
  8805. if (itemSelected == 1) {
  8806. menuActionName[menuActionRow] = "Use " + selectedItemName + " with @whi@" + s;
  8807. menuActionID[menuActionRow] = 491;
  8808. menuActionCmd1[menuActionRow] = j;
  8809. menuActionCmd2[menuActionRow] = i;
  8810. menuActionCmd3[menuActionRow] = k;
  8811. menuActionRow++;
  8812. } else if (spellSelected == 1) {
  8813. if ((spellUsableOn & 8) == 8) {
  8814. menuActionName[menuActionRow] = spellTooltip + " @whi@" + s;
  8815. menuActionID[menuActionRow] = 365;
  8816. menuActionCmd1[menuActionRow] = j;
  8817. menuActionCmd2[menuActionRow] = i;
  8818. menuActionCmd3[menuActionRow] = k;
  8819. menuActionRow++;
  8820. }
  8821. } else {
  8822. for (int l = 4; l >= 0; l--)
  8823. if (atPlayerActions[l] != null) {
  8824. menuActionName[menuActionRow] = atPlayerActions[l] + " @whi@" + s;
  8825. char c = '\0';
  8826. if (atPlayerActions[l].equalsIgnoreCase("attack")) {
  8827. int type = ClientSettings.getInt("attack_option_type");
  8828. if (type != 2)
  8829. if (type == 1 || player.combatLevel > myPlayer.combatLevel && type == 0)
  8830. c = '\u07D0';
  8831. if (myPlayer.team != 0 && player.team != 0)
  8832. if (myPlayer.team == player.team)
  8833. c = '\u07D0';
  8834. else
  8835. c = '\0';
  8836. } else if (atPlayerArray[l])
  8837. c = '\u07D0';
  8838. if (l == 0)
  8839. menuActionID[menuActionRow] = 561 + c;
  8840. if (l == 1)
  8841. menuActionID[menuActionRow] = 779 + c;
  8842. if (l == 2)
  8843. menuActionID[menuActionRow] = 27 + c;
  8844. if (l == 3)
  8845. menuActionID[menuActionRow] = 577 + c;
  8846. if (l == 4)
  8847. menuActionID[menuActionRow] = 729 + c;
  8848. menuActionCmd1[menuActionRow] = j;
  8849. menuActionCmd2[menuActionRow] = i;
  8850. menuActionCmd3[menuActionRow] = k;
  8851. menuActionRow++;
  8852. }
  8853.  
  8854. }
  8855. for (int i1 = 0; i1 < menuActionRow; i1++) {
  8856. if (menuActionID[i1] == 519) {
  8857. menuActionName[i1] = "Walk here @whi@" + s;
  8858. return;
  8859. }
  8860. }
  8861. }
  8862.  
  8863. private void method89(Class30_Sub1 class30_sub1) {
  8864. int i = 0;
  8865. int j = -1;
  8866. int k = 0;
  8867. int l = 0;
  8868. if (class30_sub1.face == 0)
  8869. i = worldController.method300(class30_sub1.heightLevel, class30_sub1.x, class30_sub1.y);
  8870. if (class30_sub1.face == 1)
  8871. i = worldController.method301(class30_sub1.heightLevel, class30_sub1.x, class30_sub1.y);
  8872. if (class30_sub1.face == 2)
  8873. i = worldController.method302(class30_sub1.heightLevel, class30_sub1.x, class30_sub1.y);
  8874. if (class30_sub1.face == 3)
  8875. i = worldController.method303(class30_sub1.heightLevel, class30_sub1.x, class30_sub1.y);
  8876. if (i != 0) {
  8877. int i1 = worldController.method304(class30_sub1.heightLevel, class30_sub1.x, class30_sub1.y, i);
  8878. j = i >> 14 & 0x7fff;
  8879. k = i1 & 0x1f;
  8880. l = i1 >> 6;
  8881. }
  8882. class30_sub1.anInt1299 = j;
  8883. class30_sub1.anInt1301 = k;
  8884. class30_sub1.anInt1300 = l;
  8885. }
  8886.  
  8887. public void switchFonts() {
  8888. FontStyle c1 = smallText;
  8889. FontStyle c2 = regularText;
  8890. FontStyle c3 = boldText;
  8891. FontStyle c4 = aTextDrawingArea_1273;
  8892.  
  8893. smallText = smallText_2;
  8894. // regularText = regularText_2;
  8895. // boldText = boldText_2;
  8896. // aTextDrawingArea_1273 = aTextDrawingArea_1273_2;
  8897.  
  8898. if (RSInterface.interfaceCache != null) {
  8899. for (RSInterface inter : RSInterface.interfaceCache) {
  8900. if (inter == null)
  8901. continue;
  8902. if (inter.textDrawingAreas == c1)
  8903. inter.textDrawingAreas = smallText_2;
  8904. if (inter.textDrawingAreas == c2)
  8905. inter.textDrawingAreas = regularText_2;
  8906. if (inter.textDrawingAreas == c3)
  8907. inter.textDrawingAreas = boldText_2;
  8908. if (inter.textDrawingAreas == c4)
  8909. inter.textDrawingAreas = aTextDrawingArea_1273_2;
  8910. }
  8911. }
  8912.  
  8913. smallText_2 = c1;
  8914. regularText_2 = c2;
  8915. boldText_2 = c3;
  8916. aTextDrawingArea_1273_2 = c4;
  8917.  
  8918. /*
  8919. * RSFont c5 = newSmallFont; RSFont c6 = newRegularFont; RSFont c7 =
  8920. * newBoldFont; RSFont c8 = newFancyFont;
  8921. *
  8922. * newSmallFont = newSmallFont_2; newRegularFont = newRegularFont_2;
  8923. * newBoldFont = newBoldFont_2; newFancyFont = newFancyFont_2;
  8924. *
  8925. * newSmallFont_2 = c5; newRegularFont_2 = c6; newBoldFont_2 = c7;
  8926. * newFancyFont_2 = c8;
  8927. */
  8928. }
  8929.  
  8930. public static void restart() {
  8931. try {
  8932. final String javaBin = System.getProperty("java.home") + File.separator + "bin" + File.separator + "java";
  8933. File currentJar = new File(Client.class.getProtectionDomain().getCodeSource().getLocation().toURI());
  8934.  
  8935. if (!currentJar.getName().endsWith(".jar"))
  8936. return;
  8937.  
  8938. final ArrayList<String> command = new ArrayList<String>();
  8939. command.add(javaBin);
  8940. command.add("-jar");
  8941. command.add(currentJar.getPath());
  8942.  
  8943. final ProcessBuilder builder = new ProcessBuilder(command);
  8944. builder.start();
  8945. } catch (Exception e) {
  8946. e.printStackTrace();
  8947. }
  8948.  
  8949. System.exit(0);
  8950. }
  8951.  
  8952. void startUp() {
  8953. Downloader cacheDownloader = new Downloader.CacheDownloader();
  8954. Downloader mediaDownloader = new Downloader.MediaDownloader();
  8955. Downloader rawDownloader = new Downloader.RawDownloader();
  8956.  
  8957. try {
  8958. drawSmoothLoadingText(20, "Starting up");
  8959. if (Signlink.cache_dat != null) {
  8960. for (int i = 0; i < 10; i++)
  8961. decompressors[i] = new Decompressor(Signlink.cache_dat, Signlink.cache_idx[i], i + 1);
  8962. } else {
  8963. throw new IllegalStateException("No signlink cache dat!");
  8964. }
  8965.  
  8966. if (!Signlink.getCacheDirectory().equals(Signlink.getLocalCacheDirectory())) {
  8967. cacheDownloader.download();
  8968. mediaDownloader.download();
  8969. rawDownloader.download();
  8970. }
  8971.  
  8972. Media.load();
  8973.  
  8974. ClientSettings.setUnsaved("minimap_config");
  8975. ClientSettings.load();
  8976.  
  8977. titleStreamLoader = new StreamLoader(Media.getBytes("title_screen.dat"));
  8978.  
  8979. aBackground_966 = new Background(titleStreamLoader, "titlebox", 0);
  8980. aBackground_967 = new Background(titleStreamLoader, "titlebutton", 0);
  8981.  
  8982. smallText = new FontStyle(false, "p11_full", titleStreamLoader);
  8983. regularText = new FontStyle(false, "p12_full", titleStreamLoader);
  8984. boldText = new FontStyle(false, "b12_full", titleStreamLoader);
  8985. aTextDrawingArea_1273 = new FontStyle(true, "q8_full", titleStreamLoader);
  8986.  
  8987. smallText_2 = new FontStyle(false, "font9", titleStreamLoader);
  8988. regularText_2 = new FontStyle(false, "font7", titleStreamLoader);
  8989. boldText_2 = new FontStyle(false, "font8", titleStreamLoader);
  8990. aTextDrawingArea_1273_2 = new FontStyle(true, "font4", titleStreamLoader);
  8991.  
  8992. newSmallFont = new RSFont(false, "p11_full", titleStreamLoader);
  8993. newRegularFont = new RSFont(false, "p12_full", titleStreamLoader);
  8994. newBoldFont = new RSFont(false, "b12_full", titleStreamLoader);
  8995. newFancyFont = new RSFont(true, "q8_full", titleStreamLoader);
  8996.  
  8997. newSmallFont_2 = new RSFont(false, "font9", titleStreamLoader);
  8998. newRegularFont_2 = new RSFont(false, "font7", titleStreamLoader);
  8999. newBoldFont_2 = new RSFont(false, "font8", titleStreamLoader);
  9000. newFancyFont_2 = new RSFont(true, "font4", titleStreamLoader);
  9001.  
  9002. Object[][] newFontOffsets = { { smallText_2, newSmallFont_2, 0, -2 },
  9003. { aTextDrawingArea_1273_2, newFancyFont_2, 0, 1 }, { boldText_2, newBoldFont_2, 0, -4 },
  9004. { regularText_2, newRegularFont_2, 0, -4 }, };
  9005.  
  9006. for (Object[] newFontOffset : newFontOffsets) {
  9007. FontStyle font1 = (FontStyle) newFontOffset[0];
  9008. for (int i = 0; i < font1.anIntArray1495.length; i++) {
  9009. font1.anIntArray1495[i] += (int) newFontOffset[3];
  9010. }
  9011.  
  9012. RSFont font2 = (RSFont) newFontOffset[1];
  9013. for (int i = 0; i < font2.characterDrawYOffsets.length; i++) {
  9014. font2.characterDrawYOffsets[i] += (int) newFontOffset[3];
  9015. }
  9016. }
  9017.  
  9018. // i == 9 ? -2 : i == 4 ? 1 : 0
  9019.  
  9020. /*
  9021. * for (Object[] newFont : newFonts) { if (newFont[0] instanceof
  9022. * TextDrawingArea) { //((TextDrawingArea)
  9023. * newFont[0]).anIntArray1494 = ((TextDrawingArea)
  9024. * newFont[1]).anIntArray1494; ((TextDrawingArea)
  9025. * newFont[0]).anIntArray1495 = ((TextDrawingArea)
  9026. * newFont[1]).anIntArray1495; } else { ((RSFont)
  9027. * newFont[0]).characterScreenWidths = ((RSFont)
  9028. * newFont[1]).characterScreenWidths; } }
  9029. */
  9030.  
  9031. // switchFonts();
  9032.  
  9033. /*
  9034. * RSFont olds[] = {newSmallFont, newRegularFont, newBoldFont,
  9035. * newFancyFont}; RSFont news[] = {newFonts[8], newFonts[6],
  9036. * newFonts[7], newFonts[3]};
  9037. */
  9038.  
  9039. // GameObjectSpawns.init();
  9040.  
  9041. StreamLoader streamLoader = streamLoaderForName(2, "config", "config", expectedCRCs[2], 30);
  9042. StreamLoader streamLoader_1 = streamLoaderForName(3, "interface", "interface", expectedCRCs[3], 35);
  9043. StreamLoader streamLoader_2 = streamLoaderForName(4, "2d graphics", "media", expectedCRCs[4], 40);
  9044. this.mediaStreamLoader = streamLoader_2;
  9045. StreamLoader streamLoader_3 = streamLoaderForName(6, "textures", "textures", expectedCRCs[6], 45);
  9046. StreamLoader streamLoader_4 = streamLoaderForName(7, "chat system", "wordenc", expectedCRCs[7], 50);
  9047. streamLoaderForName(8, "sound effects", "sounds", expectedCRCs[8], 55);
  9048. byteGroundArray = new byte[4][104][104];
  9049. intGroundArray = new int[4][105][105];
  9050. worldController = new WorldController(intGroundArray);
  9051. for (int j = 0; j < 4; j++)
  9052. aClass11Array1230[j] = new Class11();
  9053.  
  9054. minimapImage = new Sprite(512, 512);
  9055. StreamLoader streamLoader_6 = streamLoaderForName(5, "update list", "versionlist", expectedCRCs[5], 60);
  9056. drawSmoothLoadingText(60, "Connecting to update server");
  9057. onDemandFetcher = new OnDemandFetcher();
  9058. onDemandFetcher.start(streamLoader_6, this);
  9059. Model.method459(onDemandFetcher.getModelCount(), onDemandFetcher);
  9060. drawSmoothLoadingText(80, "Unpacking media");
  9061.  
  9062. // onDemandFetcher.dumpMapsOSRS();
  9063.  
  9064. /*
  9065. * if(!lowMem) { nextSong = 56; try { nextSong =
  9066. * Integer.parseInt(getParameter("music")); } catch(Exception _ex) {
  9067. * } //songChanging = true; onDemandFetcher.method558(2, nextSong);
  9068. * while(onDemandFetcher.getNodeCount() > 0) {
  9069. * processOnDemandQueue(); try { Thread.sleep(100L); }
  9070. * catch(Exception _ex) { } if(onDemandFetcher.anInt1349 > 3) {
  9071. * //loadError(); throw new IllegalStateException(); } } }
  9072. */
  9073.  
  9074. SpriteLoader.unpackSprites();
  9075. cacheSprites = SpriteLoader.sprites;
  9076. cacheSprites2 = SpriteLoader.sprites2;
  9077. cacheSprites3 = SpriteLoader.sprites3;
  9078.  
  9079. loginSprites = new Sprite[11];
  9080. for (int i = 0; i < loginSprites.length; i++) {
  9081. loginSprites[i] = new Sprite("login/" + i);
  9082. }
  9083.  
  9084. multiOverlay = new Sprite(streamLoader_2, "overlay_multiway", 0);
  9085. mapBack = new Background(streamLoader_2, "mapback", 0);
  9086. mapBack2 = new Background(streamLoader_2, "mapback", 1);
  9087. for (int j3 = 0; j3 <= 14; j3++)
  9088. sideIcons[j3] = new Sprite(streamLoader_2, "sideicons", j3);
  9089. compass = new Sprite(streamLoader_2, "compass", 0);
  9090. try {
  9091. for (int k3 = 0; k3 < 100; k3++)
  9092. mapScenes[k3] = new Background(streamLoader_2, "mapscene", k3);
  9093. } catch (Exception _ex) {
  9094. }
  9095. try {
  9096. for (int l3 = 0; l3 < 100; l3++)
  9097. mapFunctions[l3] = new Sprite(streamLoader_2, "mapfunction", l3);
  9098. } catch (Exception _ex) {
  9099. }
  9100. try {
  9101. for (int i4 = 0; i4 < hitMarks.length; i4++) {
  9102. hitMarks[i4] = new Sprite(streamLoader_2, "hitmarks", i4);
  9103.  
  9104. }
  9105.  
  9106. hitMarks[4] = new Sprite("hitmarks/venom");
  9107. } catch (Exception _ex) {
  9108. _ex.printStackTrace();
  9109. }
  9110. try {
  9111. for (int h1 = 0; h1 < 6; h1++)
  9112. headIconsHint[h1] = new Sprite(streamLoader_2, "headicons_hint", h1);
  9113. } catch (Exception _ex) {
  9114. }
  9115. try {
  9116. for (int j4 = 0; j4 < 18; j4++)
  9117. headIcons[j4] = new Sprite(streamLoader_2, "headicons_prayer", j4);
  9118. for (int j45 = 0; j45 < 3; j45++)
  9119. skullIcons[j45] = new Sprite(streamLoader_2, "headicons_pk", j45);
  9120. } catch (Exception _ex) {
  9121. }
  9122. mapFlag = new Sprite(streamLoader_2, "mapmarker", 0);
  9123. mapMarker = new Sprite(streamLoader_2, "mapmarker", 1);
  9124. for (int k4 = 0; k4 < 8; k4++)
  9125. crosses[k4] = new Sprite(streamLoader_2, "cross", k4);
  9126. mapDotItem = new Sprite(streamLoader_2, "mapdots", 0);
  9127. mapDotNPC = new Sprite(streamLoader_2, "mapdots", 1);
  9128. mapDotPlayer = new Sprite(streamLoader_2, "mapdots", 2);
  9129. mapDotFriend = new Sprite(streamLoader_2, "mapdots", 3);
  9130. mapDotTeam = new Sprite(streamLoader_2, "mapdots", 4);
  9131. mapDotClan = new Sprite(streamLoader_2, "mapdots", 5);
  9132. scrollBar1 = new Sprite(streamLoader_2, "scrollbar", 0);
  9133. scrollBar2 = new Sprite(streamLoader_2, "scrollbar", 1);
  9134. for (int l4 = 0; l4 < modIcons.length; l4++)
  9135. modIcons[l4] = new Sprite("crowns/" + l4);
  9136.  
  9137. Sprite sprite = new Sprite(streamLoader_2, "screenframe", 0);
  9138. leftFrame = new ImageProducer(sprite.myWidth, sprite.myHeight);
  9139. sprite.method346(0, 0);
  9140. sprite = new Sprite(streamLoader_2, "screenframe", 1);
  9141. topFrame = new ImageProducer(sprite.myWidth, sprite.myHeight);
  9142. sprite.method346(0, 0);
  9143. int i5 = (int) (Math.random() * 21D) - 10;
  9144. int j5 = (int) (Math.random() * 21D) - 10;
  9145. int k5 = (int) (Math.random() * 21D) - 10;
  9146. int l5 = (int) (Math.random() * 41D) - 20;
  9147. for (int i6 = 0; i6 < 100; i6++) {
  9148. if (mapFunctions[i6] != null)
  9149. mapFunctions[i6].method344(i5 + l5, j5 + l5, k5 + l5);
  9150. if (mapScenes[i6] != null)
  9151. mapScenes[i6].method360(i5 + l5, j5 + l5, k5 + l5);
  9152. }
  9153. drawSmoothLoadingText(83, "Unpacking textures");
  9154. Texture.method368(streamLoader_3);
  9155. Texture.method372(0.80000000000000004D);
  9156. Texture.method367(20);
  9157. drawSmoothLoadingText(86, "Unpacking config");
  9158.  
  9159. // repackCacheIndex(1);
  9160. // repackCacheIndex(2);
  9161. // repackCacheIndex(4);
  9162. // repackCacheIndex(5);
  9163. // repackCacheIndex(6);
  9164. // repackCacheIndex(7);
  9165. // repackCacheIndex(8);
  9166. // repackCacheIndex(9);
  9167.  
  9168. preloadModels("/raw/models/", 0);
  9169. // preloadModels("/raw/models-osrs/", 2);
  9170. preloadAnims();
  9171. // preloadMaps();
  9172. Animation.unpackConfig(streamLoader);
  9173. ObjectDefinition.unpackConfig(streamLoader);
  9174. Floor.unpackConfig(streamLoader);
  9175. OverlayFlo.unpackConfig(streamLoader);
  9176. ItemDefinition.unpackConfig(streamLoader);
  9177. NpcDefinition.unpackConfig(streamLoader);
  9178. IdentityKit.unpackConfig(streamLoader);
  9179. SpotAnim.unpackConfig(streamLoader);
  9180. Varp.unpackConfig(streamLoader);
  9181. VarBit.unpackConfig(streamLoader);
  9182. InterfaceDropTables.load();
  9183. ItemDefinition.isMembers = isMembers;
  9184. drawSmoothLoadingText(95, "Unpacking interfaces");
  9185. FontStyle aclass30_sub2_sub1_sub4s[] = { smallText, regularText, boldText, aTextDrawingArea_1273 };
  9186. RSInterface.unpack(streamLoader_1, aclass30_sub2_sub1_sub4s, streamLoader_2);
  9187. MikeysInterfaces.loadInterfaces(aclass30_sub2_sub1_sub4s);
  9188. Widgets.load();
  9189. // RSInterface.printInterfaceIndexGaps();
  9190.  
  9191. drawSmoothLoadingText(100, "Preparing game engine");
  9192. configureMinimap(1);
  9193. setBounds();
  9194. Censor.loadConfig(streamLoader_4);
  9195. mouseDetection = new MouseDetection(this);
  9196. startRunnable(mouseDetection, 10);
  9197. Animable_Sub5.clientInstance = this;
  9198. ObjectDefinition.clientInstance = this;
  9199. NpcDefinition.clientInstance = this;
  9200. RSFont.unpackChatImages();
  9201. if (Configuration.DUMP_OTHER_INDEXES) {
  9202. onDemandFetcher.dumpMaps();
  9203. onDemandFetcher.dumpAnims();
  9204. }
  9205.  
  9206. // unpackCacheIndex(4, 100_000);
  9207. // unpackCacheIndex(9, 100_000);
  9208. // onDemandFetcher.dumpTheModels();
  9209. System.gc();
  9210. return;
  9211. } catch (Exception exception) {
  9212. exception.printStackTrace();
  9213.  
  9214. try {
  9215. cacheDownloader.updateVersion(-1);
  9216. mediaDownloader.updateVersion(-1);
  9217. rawDownloader.updateVersion(-1);
  9218. System.out.println("here");
  9219. } catch (Exception e) {
  9220. e.printStackTrace();
  9221. }
  9222. }
  9223. loadingError = true;
  9224. }
  9225.  
  9226. private void method91(RSBuffer stream, int i) {
  9227. while (stream.bitPosition + 10 < i * 8) {
  9228. int j = stream.readBits(11);
  9229. if (j == 2047)
  9230. break;
  9231. if (playerArray[j] == null) {
  9232. playerArray[j] = new Player();
  9233. if (aStreamArray895s[j] != null)
  9234. playerArray[j].updatePlayer(aStreamArray895s[j]);
  9235. }
  9236. playerIndices[playerCount++] = j;
  9237. Player player = playerArray[j];
  9238. player.anInt1537 = loopCycle;
  9239. int k = stream.readBits(1);
  9240. if (k == 1)
  9241. anIntArray894[anInt893++] = j;
  9242. int l = stream.readBits(1);
  9243. int i1 = stream.readBits(5);
  9244. if (i1 > 15)
  9245. i1 -= 32;
  9246. int j1 = stream.readBits(5);
  9247. if (j1 > 15)
  9248. j1 -= 32;
  9249. player.setPos(myPlayer.smallX[0] + j1, myPlayer.smallY[0] + i1, l == 1);
  9250. }
  9251. stream.finishBitAccess();
  9252. }
  9253.  
  9254. public String indexLocation(int cacheIndex, int index) {
  9255. return Signlink.getCacheDirectory() + "index" + cacheIndex + "/" + (index != -1 ? index + ".gz" : "");
  9256. }
  9257.  
  9258. public void repackCacheIndex(int cacheIndex) {
  9259. System.out.println("Started repacking index " + cacheIndex + ".");
  9260. int indexLength = new File(indexLocation(cacheIndex, -1)).listFiles().length;
  9261. File[] file = new File(indexLocation(cacheIndex, -1)).listFiles();
  9262. try {
  9263. for (int index = 0; index < indexLength; index++) {
  9264. int fileIndex = Integer.parseInt(getFileNameWithoutExtension(file[index].toString()));
  9265. byte[] data = fileToByteArray(cacheIndex, fileIndex);
  9266. if (data != null && data.length > 0) {
  9267. decompressors[cacheIndex].method234(data.length, data, fileIndex);
  9268. System.out.println("Repacked " + fileIndex + ".");
  9269. } else {
  9270. System.out.println("Unable to locate index " + fileIndex + ".");
  9271. }
  9272. }
  9273. } catch (Exception e) {
  9274. e.printStackTrace();
  9275. System.out.println("Error packing cache index " + cacheIndex + ".");
  9276. }
  9277. System.out.println("Finished repacking " + cacheIndex + ".");
  9278. }
  9279.  
  9280. public void unpackCacheIndex(int cacheIndex, int limit) {
  9281. Path directory = Paths.get(Signlink.getCacheDirectory(), "dump" + cacheIndex);
  9282. System.out.println("Started unpacking index " + cacheIndex + ".");
  9283. try {
  9284. Files.createDirectories(directory);
  9285. for (int index = 0; index < limit; index++) {
  9286. try {
  9287. byte[] data = decompressors[cacheIndex].decompress(index);
  9288. if (data != null && data.length > 0) {
  9289. FileOutputStream out = new FileOutputStream(directory.resolve(index + ".gz").toFile());
  9290. out.write(data);
  9291. out.close();
  9292. System.out.println("Unpacking " + cacheIndex + " file: " + index + ".");
  9293. } else {
  9294. }
  9295. } catch (IOException io) {
  9296. }
  9297. }
  9298. } catch (Exception e) {
  9299. e.printStackTrace();
  9300. }
  9301. System.out.println("Finished unpacking " + cacheIndex + ".");
  9302. }
  9303.  
  9304. public byte[] fileToByteArray(int cacheIndex, int index) {
  9305. try {
  9306. if (indexLocation(cacheIndex, index).length() <= 0 || indexLocation(cacheIndex, index) == null) {
  9307. return null;
  9308. }
  9309. File file = new File(indexLocation(cacheIndex, index));
  9310. byte[] fileData = new byte[(int) file.length()];
  9311. FileInputStream fis = new FileInputStream(file);
  9312. fis.read(fileData);
  9313. fis.close();
  9314. return fileData;
  9315. } catch (Exception e) {
  9316. return null;
  9317. }
  9318. }
  9319.  
  9320. public boolean inCircle(int circleX, int circleY, int clickX, int clickY, int radius) {
  9321. return java.lang.Math.pow((circleX + radius - clickX), 2)
  9322. + java.lang.Math.pow((circleY + radius - clickY), 2) < java.lang.Math.pow(radius, 2);
  9323. }
  9324.  
  9325. private void processMainScreenClick() {
  9326. if (anInt1021 != 0)
  9327. return;
  9328. if (!this.menuOpen && menuActionRow == 1 && super.clickMode3 == 1) {
  9329. Point minimapPoint = gameframe.getMinimapPoint();
  9330. int i = super.saveClickX - 25 - 550;
  9331. int j = super.saveClickY - 5 - 4;
  9332. if (frameMode != ScreenMode.FIXED) {
  9333. i = super.saveClickX - 59 - (frameWidth - gameframe.getFixedMapArea().myWidth + 26) - minimapPoint.x;
  9334. j -= minimapPoint.y;
  9335. } else {
  9336. i -= minimapPoint.x;
  9337. j -= minimapPoint.y;
  9338. }
  9339.  
  9340. if (i >= 0 && j >= 0 && i < 146 && j < 151) {
  9341. i -= 73;
  9342. j -= 75;
  9343. int k = minimapInt1 + minimapInt2 & 0x7ff;
  9344. int i1 = Texture.anIntArray1470[k];
  9345. int j1 = Texture.anIntArray1471[k];
  9346. i1 = i1 * (minimapInt3 + 256) >> 8;
  9347. j1 = j1 * (minimapInt3 + 256) >> 8;
  9348. int k1 = j * i1 + i * j1 >> 11;
  9349. int l1 = j * j1 - i * i1 >> 11;
  9350. int i2 = myPlayer.x + k1 >> 7;
  9351. int j2 = myPlayer.y - l1 >> 7;
  9352. boolean flag1 = doWalkTo(1, 0, 0, 0, myPlayer.smallY[0], 0, 0, j2, myPlayer.smallX[0], true, i2);
  9353. if (flag1) {
  9354. stream.writeByte(i);
  9355. stream.writeByte(j);
  9356. stream.writeWord(minimapInt1);
  9357. stream.writeByte(57);
  9358. stream.writeByte(minimapInt2);
  9359. stream.writeByte(minimapInt3);
  9360. stream.writeByte(89);
  9361. stream.writeWord(myPlayer.x);
  9362. stream.writeWord(myPlayer.y);
  9363. stream.writeByte(anInt1264);
  9364. stream.writeByte(63);
  9365. }
  9366. }
  9367. /*
  9368. * anInt1117++; if (anInt1117 > 1151) { anInt1117 = 0;
  9369. * stream.createFrame(246); stream.writeWordBigEndian(0); int l =
  9370. * stream.currentOffset; if ((int) (Math.random() * 2D) == 0)
  9371. * stream.writeWordBigEndian(101); stream.writeWordBigEndian(197);
  9372. * stream.writeWord((int) (Math.random() * 65536D));
  9373. * stream.writeWordBigEndian((int) (Math.random() * 256D));
  9374. * stream.writeWordBigEndian(67); stream.writeWord(14214); if ((int)
  9375. * (Math.random() * 2D) == 0) stream.writeWord(29487);
  9376. * stream.writeWord((int) (Math.random() * 65536D)); if ((int)
  9377. * (Math.random() * 2D) == 0) stream.writeWordBigEndian(220);
  9378. * stream.writeWordBigEndian(180);
  9379. * stream.writeBytes(stream.currentOffset - l); }
  9380. */
  9381. }
  9382. }
  9383.  
  9384. private String interfaceIntToString(long j) {
  9385. if (j < Long.MAX_VALUE) {
  9386. return TextClass.putCommasInNumber(j);/// XXX: changed from
  9387. /// String.valueOf(j) to
  9388. /// make numbers in
  9389. /// interfaces look better
  9390. } else {
  9391. return "*";
  9392. }
  9393. }
  9394.  
  9395. private void showErrorScreen() {
  9396. Graphics g = getGameComponent().getGraphics();
  9397. g.setColor(Color.black);
  9398. g.fillRect(0, 0, 765, 503);
  9399. method4(1);
  9400. if (loadingError) {
  9401. long time = System.currentTimeMillis();
  9402.  
  9403. while (true) {
  9404. long seconds = 10 - ((System.currentTimeMillis() - time) / 1_000);
  9405.  
  9406. aBoolean831 = false;
  9407.  
  9408. g.setColor(Color.black);
  9409. g.fillRect(0, 0, 765, 503);
  9410.  
  9411. g.setFont(new Font("Helvetica", 1, 16));
  9412. g.setColor(Color.yellow);
  9413. int k = 35;
  9414.  
  9415. g.drawString("A fatal error has occured.", 30, k);
  9416. k += 50;
  9417. g.setColor(Color.white);
  9418.  
  9419. g.drawString("The client will automatically try to resolve it.", 30, k);
  9420. k += 50;
  9421. g.drawString("Please do not close the client window.", 30, k);
  9422. k += 50;
  9423. g.drawString("Restarting in " + seconds + "...", 30, k);
  9424. k += 50;
  9425. // g.drawString("Restarting in " + seconds + "...", 30, k);
  9426. k += 50;
  9427.  
  9428. if (seconds == 0) {
  9429. restart();
  9430. }
  9431.  
  9432. try {
  9433. Thread.sleep(50);
  9434. } catch (Exception e) {
  9435. }
  9436. }
  9437.  
  9438. }
  9439. if (genericLoadingError) {
  9440. aBoolean831 = false;
  9441. g.setFont(new Font("Helvetica", 1, 20));
  9442. g.setColor(Color.white);
  9443. g.drawString("Error - unable to load game!", 50, 50);
  9444. g.drawString("To play " + Configuration.SERVER_NAME + " make sure you play from", 50, 100);
  9445. g.drawString("http://www.UrlHere.com", 50, 150);
  9446. }
  9447. if (rsAlreadyLoaded) {
  9448. aBoolean831 = false;
  9449. g.setColor(Color.yellow);
  9450. int l = 35;
  9451. g.drawString("Error a copy of " + Configuration.SERVER_NAME + " already appears to be loaded", 30, l);
  9452. l += 50;
  9453. g.setColor(Color.white);
  9454. g.drawString("To fix this try the following (in order):", 30, l);
  9455. l += 50;
  9456. g.setColor(Color.white);
  9457. g.setFont(new Font("Helvetica", 1, 12));
  9458. g.drawString("1: Try closing ALL open web-browser windows, and reloading", 30, l);
  9459. l += 30;
  9460. g.drawString("2: Try rebooting your computer, and reloading", 30, l);
  9461. l += 30;
  9462. }
  9463. }
  9464.  
  9465. public URL getCodeBase() {
  9466. try {
  9467. return new URL(getCurrentWorld().getAddress() + ":" + (80 + portOff));
  9468. } catch (Exception _ex) {
  9469. }
  9470. return null;
  9471. }
  9472.  
  9473. private void method95() {
  9474. for (int j = 0; j < npcCount; j++) {
  9475. int k = npcIndices[j];
  9476. Npc npc = npcArray[k];
  9477. if (npc != null)
  9478. method96(npc);
  9479. }
  9480. }
  9481.  
  9482. private void method96(Entity entity) {
  9483. if (entity.x < 128 || entity.y < 128 || entity.x >= 13184 || entity.y >= 13184) {
  9484. entity.anim = -1;
  9485. entity.anInt1520 = -1;
  9486. entity.anInt1547 = 0;
  9487. entity.anInt1548 = 0;
  9488. entity.x = entity.smallX[0] * 128 + entity.anInt1540 * 64;
  9489. entity.y = entity.smallY[0] * 128 + entity.anInt1540 * 64;
  9490. entity.method446();
  9491. }
  9492. if (entity == myPlayer && (entity.x < 1536 || entity.y < 1536 || entity.x >= 11776 || entity.y >= 11776)) {
  9493. entity.anim = -1;
  9494. entity.anInt1520 = -1;
  9495. entity.anInt1547 = 0;
  9496. entity.anInt1548 = 0;
  9497. entity.x = entity.smallX[0] * 128 + entity.anInt1540 * 64;
  9498. entity.y = entity.smallY[0] * 128 + entity.anInt1540 * 64;
  9499. entity.method446();
  9500. }
  9501. if (entity.anInt1547 > loopCycle)
  9502. method97(entity);
  9503. else if (entity.anInt1548 >= loopCycle)
  9504. method98(entity);
  9505. else
  9506. method99(entity);
  9507. method100(entity);
  9508. method101(entity);
  9509. }
  9510.  
  9511. private void method97(Entity entity) {
  9512. int i = entity.anInt1547 - loopCycle;
  9513. int j = entity.anInt1543 * 128 + entity.anInt1540 * 64;
  9514. int k = entity.anInt1545 * 128 + entity.anInt1540 * 64;
  9515. entity.x += (j - entity.x) / i;
  9516. entity.y += (k - entity.y) / i;
  9517. entity.anInt1503 = 0;
  9518. if (entity.anInt1549 == 0)
  9519. entity.turnDirection = 1024;
  9520. if (entity.anInt1549 == 1)
  9521. entity.turnDirection = 1536;
  9522. if (entity.anInt1549 == 2)
  9523. entity.turnDirection = 0;
  9524. if (entity.anInt1549 == 3)
  9525. entity.turnDirection = 512;
  9526. }
  9527.  
  9528. private void method98(Entity entity) {
  9529. if (entity.anInt1548 == loopCycle || entity.anim == -1 || entity.anInt1529 != 0
  9530. || entity.anInt1528 + 1 > Animation.getAnim(entity, entity.anim).method258(entity.anInt1527)) {
  9531. int i = entity.anInt1548 - entity.anInt1547;
  9532. int j = loopCycle - entity.anInt1547;
  9533. int k = entity.anInt1543 * 128 + entity.anInt1540 * 64;
  9534. int l = entity.anInt1545 * 128 + entity.anInt1540 * 64;
  9535. int i1 = entity.anInt1544 * 128 + entity.anInt1540 * 64;
  9536. int j1 = entity.anInt1546 * 128 + entity.anInt1540 * 64;
  9537. entity.x = (k * (i - j) + i1 * j) / i;
  9538. entity.y = (l * (i - j) + j1 * j) / i;
  9539. }
  9540. entity.anInt1503 = 0;
  9541. if (entity.anInt1549 == 0)
  9542. entity.turnDirection = 1024;
  9543. if (entity.anInt1549 == 1)
  9544. entity.turnDirection = 1536;
  9545. if (entity.anInt1549 == 2)
  9546. entity.turnDirection = 0;
  9547. if (entity.anInt1549 == 3)
  9548. entity.turnDirection = 512;
  9549. entity.anInt1552 = entity.turnDirection;
  9550. }
  9551.  
  9552. private void method99(Entity entity) {
  9553. entity.anInt1517 = entity.anInt1511;
  9554. if (entity.smallXYIndex == 0) {
  9555. entity.anInt1503 = 0;
  9556. return;
  9557. }
  9558. if (entity.anim != -1 && entity.anInt1529 == 0) {
  9559. Animation animation = Animation.getAnim(entity, entity.anim);
  9560. if (entity.anInt1542 > 0 && animation.anInt363 == 0) {
  9561. entity.anInt1503++;
  9562. return;
  9563. }
  9564. if (entity.anInt1542 <= 0 && animation.anInt364 == 0) {
  9565. entity.anInt1503++;
  9566. return;
  9567. }
  9568. }
  9569. int i = entity.x;
  9570. int j = entity.y;
  9571. int k = entity.smallX[entity.smallXYIndex - 1] * 128 + entity.anInt1540 * 64;
  9572. int l = entity.smallY[entity.smallXYIndex - 1] * 128 + entity.anInt1540 * 64;
  9573. if (k - i > 256 || k - i < -256 || l - j > 256 || l - j < -256) {
  9574. entity.x = k;
  9575. entity.y = l;
  9576. return;
  9577. }
  9578. if (i < k) {
  9579. if (j < l)
  9580. entity.turnDirection = 1280;
  9581. else if (j > l)
  9582. entity.turnDirection = 1792;
  9583. else
  9584. entity.turnDirection = 1536;
  9585. } else if (i > k) {
  9586. if (j < l)
  9587. entity.turnDirection = 768;
  9588. else if (j > l)
  9589. entity.turnDirection = 256;
  9590. else
  9591. entity.turnDirection = 512;
  9592. } else if (j < l)
  9593. entity.turnDirection = 1024;
  9594. else
  9595. entity.turnDirection = 0;
  9596. int i1 = entity.turnDirection - entity.anInt1552 & 0x7ff;
  9597. if (i1 > 1024)
  9598. i1 -= 2048;
  9599. int j1 = entity.anInt1555;
  9600. if (i1 >= -256 && i1 <= 256)
  9601. j1 = entity.anInt1554;
  9602. else if (i1 >= 256 && i1 < 768)
  9603. j1 = entity.anInt1557;
  9604. else if (i1 >= -768 && i1 <= -256)
  9605. j1 = entity.anInt1556;
  9606. if (j1 == -1)
  9607. j1 = entity.anInt1554;
  9608. entity.anInt1517 = j1;
  9609. int k1 = 4;
  9610. if (entity.anInt1552 != entity.turnDirection && entity.interactingEntity == -1 && entity.anInt1504 != 0)
  9611. k1 = 2;
  9612. if (entity.smallXYIndex > 2)
  9613. k1 = 6;
  9614. if (entity.smallXYIndex > 3)
  9615. k1 = 8;
  9616. if (entity.anInt1503 > 0 && entity.smallXYIndex > 1) {
  9617. k1 = 8;
  9618. entity.anInt1503--;
  9619. }
  9620. if (entity.aBooleanArray1553[entity.smallXYIndex - 1])
  9621. k1 <<= 1;
  9622. if (k1 >= 8 && entity.anInt1517 == entity.anInt1554 && entity.anInt1505 != -1)
  9623. entity.anInt1517 = entity.anInt1505;
  9624. if (i < k) {
  9625. entity.x += k1;
  9626. if (entity.x > k)
  9627. entity.x = k;
  9628. } else if (i > k) {
  9629. entity.x -= k1;
  9630. if (entity.x < k)
  9631. entity.x = k;
  9632. }
  9633. if (j < l) {
  9634. entity.y += k1;
  9635. if (entity.y > l)
  9636. entity.y = l;
  9637. } else if (j > l) {
  9638. entity.y -= k1;
  9639. if (entity.y < l)
  9640. entity.y = l;
  9641. }
  9642. if (entity.x == k && entity.y == l) {
  9643. entity.smallXYIndex--;
  9644. if (entity.anInt1542 > 0)
  9645. entity.anInt1542--;
  9646. }
  9647. }
  9648.  
  9649. private void method100(Entity entity) {
  9650. if (entity.anInt1504 == 0)
  9651. return;
  9652. if (entity.interactingEntity != -1 && entity.interactingEntity < 32768) {
  9653. Npc npc = npcArray[entity.interactingEntity];
  9654. if (npc != null) {
  9655. int i1 = entity.x - npc.x;
  9656. int k1 = entity.y - npc.y;
  9657. if (i1 != 0 || k1 != 0)
  9658. entity.turnDirection = (int) (Math.atan2(i1, k1) * 325.94900000000001D) & 0x7ff;
  9659. }
  9660. }
  9661. if (entity.interactingEntity >= 32768) {
  9662. int j = entity.interactingEntity - 32768;
  9663. if (j == unknownInt10)
  9664. j = myPlayerIndex;
  9665. Player player = playerArray[j];
  9666. if (player != null) {
  9667. int l1 = entity.x - player.x;
  9668. int i2 = entity.y - player.y;
  9669. if (l1 != 0 || i2 != 0)
  9670. entity.turnDirection = (int) (Math.atan2(l1, i2) * 325.94900000000001D) & 0x7ff;
  9671. }
  9672. }
  9673. if ((entity.anInt1538 != 0 || entity.anInt1539 != 0) && (entity.smallXYIndex == 0 || entity.anInt1503 > 0)) {
  9674. int k = entity.x - (entity.anInt1538 - baseX - baseX) * 64;
  9675. int j1 = entity.y - (entity.anInt1539 - baseY - baseY) * 64;
  9676. if (k != 0 || j1 != 0)
  9677. entity.turnDirection = (int) (Math.atan2(k, j1) * 325.94900000000001D) & 0x7ff;
  9678. entity.anInt1538 = 0;
  9679. entity.anInt1539 = 0;
  9680. }
  9681. int l = entity.turnDirection - entity.anInt1552 & 0x7ff;
  9682. if (l != 0) {
  9683. if (l < entity.anInt1504 || l > 2048 - entity.anInt1504)
  9684. entity.anInt1552 = entity.turnDirection;
  9685. else if (l > 1024)
  9686. entity.anInt1552 -= entity.anInt1504;
  9687. else
  9688. entity.anInt1552 += entity.anInt1504;
  9689. entity.anInt1552 &= 0x7ff;
  9690. if (entity.anInt1517 == entity.anInt1511 && entity.anInt1552 != entity.turnDirection) {
  9691. if (entity.anInt1512 != -1) {
  9692. entity.anInt1517 = entity.anInt1512;
  9693. return;
  9694. }
  9695. entity.anInt1517 = entity.anInt1554;
  9696. }
  9697. }
  9698. }
  9699.  
  9700. public void method101(Entity entity) {
  9701. entity.aBoolean1541 = false;
  9702. if (entity.anInt1517 > Animation.anims().length)
  9703. entity.anInt1517 = -1;
  9704. if (entity.anInt1517 != -1) {
  9705. Animation animation = Animation.getAnim(entity, entity.anInt1517);
  9706. entity.anInt1519++;
  9707. if (entity.anInt1518 < animation.anInt352 && entity.anInt1519 > animation.method258(entity.anInt1518)) {
  9708. entity.anInt1519 = 1;
  9709. entity.anInt1518++;
  9710. entity.nextIdleAnimationFrame++;// Tweening code added
  9711. }
  9712. // XXX: Tweening code
  9713. entity.nextIdleAnimationFrame = entity.anInt1518 + 1;
  9714. if (entity.nextIdleAnimationFrame >= animation.anInt352) {
  9715. if (entity.nextIdleAnimationFrame >= animation.anInt352)
  9716. entity.nextIdleAnimationFrame = 0;
  9717. }
  9718. // End tweening code
  9719. if (entity.anInt1518 >= animation.anInt352) {
  9720. entity.anInt1519 = 1;
  9721. entity.anInt1518 = 0;
  9722. }
  9723. }
  9724. if (entity.anInt1520 != -1 && loopCycle >= entity.anInt1523) {
  9725. if (entity.anInt1521 < 0)
  9726. entity.anInt1521 = 0;
  9727. SpotAnim gfx = SpotAnim.getGfx(entity, entity.anInt1520);
  9728. Animation animation_1 = gfx.aAnimation_407;
  9729. if (animation_1 != null) {
  9730. for (entity.anInt1522++; entity.anInt1521 < animation_1.anInt352
  9731. && entity.anInt1522 > animation_1.method258(entity.anInt1521); entity.anInt1521++)
  9732. entity.anInt1522 -= animation_1.method258(entity.anInt1521);
  9733.  
  9734. if (entity.anInt1521 >= animation_1.anInt352
  9735. && (entity.anInt1521 < 0 || entity.anInt1521 >= animation_1.anInt352))
  9736. entity.anInt1520 = -1;
  9737. }
  9738. }
  9739. if (entity.anim != -1 && entity.anInt1529 <= 1) {
  9740. Animation animation_2 = Animation.getAnim(entity, entity.anim);
  9741. if (animation_2.anInt363 == 1 && entity.anInt1542 > 0 && entity.anInt1547 <= loopCycle
  9742. && entity.anInt1548 < loopCycle) {
  9743. entity.anInt1529 = 1;
  9744. return;
  9745. }
  9746. }
  9747. if (entity.anim != -1 && entity.anInt1529 == 0) {
  9748. Animation animation_3 = Animation.getAnim(entity, entity.anim);
  9749. for (entity.anInt1528++; entity.anInt1527 < animation_3.anInt352
  9750. && entity.anInt1528 > animation_3.method258(entity.anInt1527); entity.anInt1527++)
  9751. entity.anInt1528 -= animation_3.method258(entity.anInt1527);
  9752.  
  9753. if (entity.anInt1527 >= animation_3.anInt352) {
  9754. entity.anInt1527 -= animation_3.anInt356;
  9755. entity.anInt1530++;
  9756. if (entity.anInt1530 >= animation_3.anInt362)
  9757. entity.anim = -1;
  9758. if (entity.anInt1527 < 0 || entity.anInt1527 >= animation_3.anInt352)
  9759. entity.anim = -1;
  9760. }
  9761.  
  9762. // XXX: Tweening code
  9763. entity.nextAnimationFrame = entity.anInt1527 + 1;
  9764. if (entity.nextAnimationFrame >= animation_3.anInt352) {
  9765. if (entity.anInt1530 >= animation_3.anInt362)
  9766. entity.nextAnimationFrame = entity.anInt1527 + 1;
  9767. if (entity.nextAnimationFrame < 0 || entity.nextAnimationFrame >= animation_3.anInt352)
  9768. entity.nextAnimationFrame = entity.anInt1527;
  9769. }
  9770. // End tweening code
  9771.  
  9772. entity.aBoolean1541 = animation_3.aBoolean358;
  9773. }
  9774. if (entity.anInt1529 > 0)
  9775. entity.anInt1529--;
  9776. }
  9777.  
  9778. private void drawGameScreen() {
  9779. if (fullscreenInterfaceID != -1 && (loadingStage == 2 || super.fullGameScreen != null)) {
  9780. if (loadingStage == 2) {
  9781. method119(anInt945, fullscreenInterfaceID);
  9782. if (openInterfaceID != -1) {
  9783. method119(anInt945, openInterfaceID);
  9784. }
  9785. anInt945 = 0;
  9786. resetAllImageProducers();
  9787. super.fullGameScreen.initDrawingArea();
  9788. Texture.anIntArray1472 = fullScreenTextureArray;
  9789. DrawingArea.setAllPixelsToZero();
  9790. welcomeScreenRaised = true;
  9791. if (openInterfaceID != -1) {
  9792. RSInterface rsInterface_1 = RSInterface.interfaceCache[openInterfaceID];
  9793. if (rsInterface_1.width == 512 && rsInterface_1.height == 334 && rsInterface_1.type == 0) {
  9794. rsInterface_1.width = 765;
  9795. rsInterface_1.height = 503;
  9796. }
  9797. drawInterface(0, 0, rsInterface_1, 8);
  9798. }
  9799. RSInterface rsInterface = RSInterface.interfaceCache[fullscreenInterfaceID];
  9800. if (rsInterface.width == 512 && rsInterface.height == 334 && rsInterface.type == 0) {
  9801. rsInterface.width = 765;
  9802. rsInterface.height = 503;
  9803. }
  9804. drawInterface(0, 0, rsInterface, 8);
  9805. if (!menuOpen) {
  9806. processRightClick();
  9807. drawTooltip();
  9808. } else {
  9809. drawMenu(frameMode == ScreenMode.FIXED ? 4 : 0, frameMode == ScreenMode.FIXED ? 4 : 0);
  9810. }
  9811. }
  9812. drawCount++;
  9813. super.fullGameScreen.drawGraphics(0, super.graphics, 0);
  9814. return;
  9815. } else {
  9816. if (drawCount != 0) {
  9817. resetImageProducers2();
  9818. }
  9819. }
  9820. if (welcomeScreenRaised) {
  9821. welcomeScreenRaised = false;
  9822. if (frameMode == ScreenMode.FIXED) {
  9823. topFrame.drawGraphics(0, super.graphics, 0);
  9824. leftFrame.drawGraphics(4, super.graphics, 0);
  9825.  
  9826. /*
  9827. * backLeftIP2.drawGraphics(357, super.graphics, 0);
  9828. * backRightIP1.drawGraphics(4, super.graphics, 722);
  9829. * backRightIP2.drawGraphics(205, super.graphics, 743);
  9830. * backTopIP1.drawGraphics(0, super.graphics, 0);
  9831. * backVmidIP1.drawGraphics(4, super.graphics, 516);
  9832. * backVmidIP2.drawGraphics(205, super.graphics, 516);
  9833. * backVmidIP3.drawGraphics(357, super.graphics, 496);
  9834. * backVmidIP2_2.drawGraphics(338, super.graphics, 0);
  9835. */
  9836.  
  9837. aRSImageProducer_1164.initDrawingArea();
  9838. gameframe.getFixedMapArea().drawSprite(0, 0);
  9839. if (ClientSettings.getBoolean("orbs_enabled")) {
  9840. gameframe.drawOrbs(0);
  9841. }
  9842. // gameframe.drawTeleportOrb(0);
  9843. gameframe.onMinimapDraw();
  9844.  
  9845. Point compassPoint = gameframe.getCompassPoint();
  9846. int offsetX = frameMode == ScreenMode.FIXED ? 0
  9847. : (frameWidth - gameframe.getFixedMapArea().myWidth + 26);
  9848. compass.method352(33, minimapInt1, anIntArray1057, 256, anIntArray968, 25, 4 + compassPoint.y,
  9849. 34 + offsetX + compassPoint.x, 33, 25);
  9850.  
  9851. aRSImageProducer_1163.initDrawingArea();
  9852. gameframe.drawTabArea();
  9853. }
  9854.  
  9855. aRSImageProducer_1165.initDrawingArea();
  9856. int offset = frameMode == ScreenMode.FIXED ? 4 : 0;
  9857. aRSImageProducer_1165.drawGraphics(offset, super.graphics, offset);
  9858.  
  9859. if (frameMode == ScreenMode.FIXED) {
  9860. aRSImageProducer_1164.drawGraphics(0, super.graphics, 516);
  9861. aRSImageProducer_1163.drawGraphics(168, super.graphics, 516);
  9862. }
  9863.  
  9864. // needDrawTabArea = true;
  9865. inputTaken = true;
  9866. tabAreaAltered = true;
  9867. // aBoolean1233 = true;
  9868. if (loadingStage != 2) {
  9869. // aRSImageProducer_1165.drawGraphics(4, super.graphics, 4);
  9870. // aRSImageProducer_1164.drawGraphics(4, super.graphics, 550);
  9871. }
  9872. }
  9873. if (invOverlayInterfaceID != -1) {
  9874. method119(anInt945, invOverlayInterfaceID);
  9875. }
  9876. gameframe.drawTabArea();
  9877.  
  9878. if (backDialogID == -1 && inputDialogState == 3) {
  9879. int position = totalItemResults * 14 + 7;
  9880. aClass9_1059.scrollPosition = itemResultScrollPos;
  9881. if (super.mouseX > 478 && super.mouseX < 580 && super.mouseY > (screenAreaHeight - 161)) {
  9882. method65(494, 110, super.mouseX - 0, super.mouseY - (screenAreaHeight - 155), aClass9_1059, 0, false,
  9883. totalItemResults);
  9884. }
  9885. int scrollPosition = aClass9_1059.scrollPosition;
  9886. if (scrollPosition < 0) {
  9887. scrollPosition = 0;
  9888. }
  9889. if (scrollPosition > position - 110) {
  9890. scrollPosition = position - 110;
  9891. }
  9892. if (itemResultScrollPos != scrollPosition) {
  9893. itemResultScrollPos = scrollPosition;
  9894. inputTaken = true;
  9895. }
  9896. } else if (backDialogID == -1) {
  9897. boolean fixed = frameMode == ScreenMode.FIXED;
  9898. // int scrollbarYOffset = gameframe.getScrollbarYOffset() -
  9899. // gameframe.getScrollbarYOffset();
  9900. int mouseYOffset = fixed ? 332 + 24 : frameHeight - 148;
  9901. aClass9_1059.scrollPosition = anInt1211 - anInt1089 - (77 + gameframe.getScrollbarLengthOffset());
  9902. /*
  9903. * if(super.mouseX > 448 + gameframe.getScrollbarXOffset() &&
  9904. * super.mouseX < 560 + gameframe.getScrollbarXOffset() &&
  9905. * super.mouseY > mouseYOffset) {
  9906. */
  9907. method65(463 + gameframe.getScrollbarXOffset(), (77 + gameframe.getScrollbarLengthOffset()),
  9908. super.mouseX - 17, super.mouseY - mouseYOffset, aClass9_1059, 0 + gameframe.getScrollbarYOffset(),
  9909. false, anInt1211);
  9910. // }
  9911. int i = anInt1211 - (77 + gameframe.getScrollbarLengthOffset()) - aClass9_1059.scrollPosition;
  9912. if (i < 0)
  9913. i = 0;
  9914. if (i > anInt1211 - (77 + gameframe.getScrollbarLengthOffset()))
  9915. i = anInt1211 - (77 + gameframe.getScrollbarLengthOffset());
  9916. if (anInt1089 != i) {
  9917. anInt1089 = i;
  9918. inputTaken = true;
  9919. }
  9920. }
  9921. if (backDialogID != -1) {
  9922. boolean flag2 = method119(anInt945, backDialogID);
  9923. if (flag2)
  9924. inputTaken = true;
  9925. }
  9926. if (atInventoryInterfaceType == 3)
  9927. inputTaken = true;
  9928. if (activeInterfaceType == 3)
  9929. inputTaken = true;
  9930. if (aString844 != null)
  9931. inputTaken = true;
  9932. if (menuOpen && menuScreenArea == 2)
  9933. inputTaken = true;
  9934.  
  9935. gameframe.drawChatArea();
  9936. if (inputTaken) {
  9937. inputTaken = false;
  9938. }
  9939. // } else {
  9940. // gameframe.drawChannelModes();
  9941. // }
  9942. if (loadingStage == 2)
  9943. method146();
  9944. if (loadingStage == 2) {
  9945. if (frameMode == ScreenMode.FIXED) {
  9946. gameframe.drawMinimap();
  9947. aRSImageProducer_1164.drawGraphics(0, super.graphics, 516);
  9948. }
  9949. }
  9950. if (anInt1054 != -1)
  9951. tabAreaAltered = true;
  9952. if (tabAreaAltered) {
  9953. if (anInt1054 != -1 && anInt1054 == tabID) {
  9954. anInt1054 = -1;
  9955. stream.createFrame(120);
  9956. stream.writeByte(tabID);
  9957. }
  9958. tabAreaAltered = false;
  9959. aRSImageProducer_1125.initDrawingArea();
  9960. aRSImageProducer_1165.initDrawingArea();
  9961. }
  9962. anInt945 = 0;
  9963. }
  9964.  
  9965. private boolean buildFriendsListMenu(RSInterface class9) {
  9966. int i = class9.contentType;
  9967. if (i >= 1 && i <= 200 || i >= 701 && i <= 900) {
  9968. if (i >= 801)
  9969. i -= 701;
  9970. else if (i >= 701)
  9971. i -= 601;
  9972. else if (i >= 101)
  9973. i -= 101;
  9974. else
  9975. i--;
  9976. menuActionName[menuActionRow] = "Remove @whi@" + friendsList[i];
  9977. menuActionID[menuActionRow] = 792;
  9978. menuActionRow++;
  9979. menuActionName[menuActionRow] = "Message @whi@" + friendsList[i];
  9980. menuActionID[menuActionRow] = 639;
  9981. menuActionRow++;
  9982. return true;
  9983. }
  9984. if (i >= 401 && i <= 500) {
  9985. menuActionName[menuActionRow] = "Remove @whi@" + class9.message;
  9986. menuActionID[menuActionRow] = 322;
  9987. menuActionRow++;
  9988. return true;
  9989. } else {
  9990. return false;
  9991. }
  9992. }
  9993.  
  9994. private void method104() {
  9995. Animable_Sub3 class30_sub2_sub4_sub3 = (Animable_Sub3) aClass19_1056.reverseGetFirst();
  9996. for (; class30_sub2_sub4_sub3 != null; class30_sub2_sub4_sub3 = (Animable_Sub3) aClass19_1056.reverseGetNext())
  9997. if (class30_sub2_sub4_sub3.anInt1560 != plane || class30_sub2_sub4_sub3.aBoolean1567)
  9998. class30_sub2_sub4_sub3.unlink();
  9999. else if (loopCycle >= class30_sub2_sub4_sub3.anInt1564) {
  10000. class30_sub2_sub4_sub3.method454(anInt945);
  10001. if (class30_sub2_sub4_sub3.aBoolean1567)
  10002. class30_sub2_sub4_sub3.unlink();
  10003. else
  10004. worldController.method285(class30_sub2_sub4_sub3.anInt1560, 0, class30_sub2_sub4_sub3.anInt1563, -1,
  10005. class30_sub2_sub4_sub3.anInt1562, 60, class30_sub2_sub4_sub3.anInt1561,
  10006. class30_sub2_sub4_sub3, false);
  10007. }
  10008.  
  10009. }
  10010.  
  10011. public void drawBlackBox(int xPos, int yPos) {
  10012. DrawingArea.drawPixels(xPos - 2, yPos - 1, 1, 71, 0x726451);
  10013. DrawingArea.drawPixels(xPos + 174, yPos, 1, 69, 0x726451);
  10014. DrawingArea.drawPixels(xPos - 2, yPos - 2, 178, 1, 0x726451);
  10015. DrawingArea.drawPixels(xPos, yPos + 68, 174, 1, 0x726451);
  10016. DrawingArea.drawPixels(xPos - 1, yPos - 1, 1, 71, 0x2E2B23);
  10017. DrawingArea.drawPixels(xPos + 175, yPos - 1, 1, 71, 0x2E2B23);
  10018. DrawingArea.drawPixels(xPos, yPos - 1, 175, 1, 0x2E2B23);
  10019. DrawingArea.drawPixels(xPos, yPos + 69, 175, 1, 0x2E2B23);
  10020. DrawingArea.method335(0, yPos, 174, 68, 220, xPos);
  10021. }
  10022.  
  10023. public void drawInterface(int j, int k, RSInterface class9, int l) {
  10024. if (class9 == null)
  10025. class9 = RSInterface.interfaceCache[0];
  10026. if (class9.type != 0 || class9.children == null)
  10027. return;
  10028. if (class9.mouseOverTriggered && anInt1026 != class9.id && anInt1048 != class9.id && anInt1039 != class9.id) {
  10029. return;
  10030. }
  10031.  
  10032. int i1 = DrawingArea.topX;
  10033. int j1 = DrawingArea.topY;
  10034. int k1 = DrawingArea.bottomX;
  10035. int l1 = DrawingArea.bottomY;
  10036. DrawingArea.setDrawingArea(l + class9.height, k, k + class9.width, l);
  10037. int i2 = class9.children.length;
  10038. boolean drawnNoitemSprite = false;
  10039.  
  10040. for (int j2 = 0; j2 < i2; j2++) {
  10041. int k2 = class9.childX[j2] + k;
  10042. int l2 = (class9.childY[j2] + l) - j;
  10043. RSInterface child = RSInterface.interfaceCache[class9.children[j2]];
  10044. if (child == null || child.hidden) {
  10045. continue;
  10046. }
  10047.  
  10048. if (interfaceIds) {
  10049. newSmallFont.drawBasicString("" + child.id, k2, l2, Integer.MAX_VALUE, 0);
  10050. }
  10051.  
  10052. k2 += child.anInt263;
  10053. l2 += child.anInt265;
  10054. if (child.contentType > 0)
  10055. drawFriendsListOrWelcomeScreen(child);
  10056.  
  10057. //
  10058. for (int m5 = 0; m5 < IDs.length; m5++) {
  10059. if (child.id == IDs[m5] + 1) {
  10060. if (m5 > 61)
  10061. drawBlackBox(k2 + 1, l2);
  10062. else
  10063. drawBlackBox(k2, l2 + 1);
  10064. }
  10065. } /// XXX: ruse hardcode shit between //'s
  10066. for (int r = 0; r < runeChildren.length; r++)
  10067. if (child.id == runeChildren[r])
  10068. child.modelZoom = 775;
  10069. // if(child.id == 1194 || child.id == 12856) //Removes black boxes
  10070. // when not hovering in spellbook
  10071. // continue;
  10072. //
  10073.  
  10074. if (child.type == 0) {
  10075. if (child.scrollPosition > child.scrollMax - child.height)
  10076. child.scrollPosition = child.scrollMax - child.height;
  10077. if (child.scrollPosition < 0)
  10078. child.scrollPosition = 0;
  10079. drawInterface(child.scrollPosition, k2, child, l2);
  10080. if (child.scrollMax > child.height)
  10081. drawScrollbar(child.height, child.scrollPosition, l2, k2 + child.width, child.scrollMax, false);
  10082. } else if (child.type != 1)
  10083. if (child.type == 2) {
  10084. boolean search = child.itemSearch && friendsListAction == -1 && promptInput != null
  10085. && promptInput.length() > 0;
  10086. if (!messagePromptRaised && search)
  10087. search = false;
  10088. boolean clearWhiteSpace = !search && child.invClearWhiteSpace;
  10089. int i3 = search ? 0 : class9.invStartIndex;
  10090. int results = -1;
  10091. int yoffset = 0;
  10092.  
  10093. if (child.invDynamicScrollbar) {
  10094. int invScrollMax = child.invDefaultScrollMax;
  10095. int items = 0;
  10096. for (int l6 = 0; l6 < child.height; l6++) {
  10097. if (clearWhiteSpace && child.invClearWhiteSpaceSeperator != null) {
  10098. if (l6 != 0 && l6 != child.height - 1
  10099. && l6 * child.width % child.invWhiteSpaceSeperatorCutoff == 0) {
  10100. for (int i7 = l6 * child.width; i7 < (l6 * child.width) + 100; i7++) {
  10101. if (child.inv[i7] > 0) {
  10102. invScrollMax += 20;
  10103. break;
  10104. }
  10105. }
  10106. }
  10107. }
  10108.  
  10109. int spritePadY = child.invSpritePadY;
  10110.  
  10111. for (int l8 = 0; l8 < child.width; l8++) {
  10112. if (child.inv[(l6 * child.width) + l8] > 0) {
  10113. items++;
  10114. if (items * (32 + spritePadY) >= RSInterface.get(child.parentID).height) {
  10115. invScrollMax += (32 + spritePadY);
  10116. }
  10117. break;
  10118. }
  10119. }
  10120. }
  10121.  
  10122. class9.scrollMax = invScrollMax;
  10123. }
  10124.  
  10125. for (int l3 = 0; l3 < child.height; l3++) {
  10126. if (clearWhiteSpace && child.invClearWhiteSpaceSeperator != null) {
  10127. if (l3 != 0 && l3 != child.height - 1
  10128. && l3 * child.width % child.invWhiteSpaceSeperatorCutoff == 0) {
  10129. int j6 = l2 + (results / child.width) * (32 + child.invSpritePadY);
  10130. if (results == -1)
  10131. j6 -= 38;
  10132.  
  10133. for (int i7 = l3 * child.width; i7 < (l3 * child.width) + 100; i7++) {
  10134. if (child.inv[i7] > 0) {
  10135. yoffset += 20;
  10136. child.invClearWhiteSpaceSeperator.drawSprite(k2 - 8, j6 - 4 + 38 + yoffset - 8);
  10137. break;
  10138. }
  10139. }
  10140. }
  10141. }
  10142.  
  10143. if (clearWhiteSpace) {
  10144. int items = 0;
  10145.  
  10146. for (int l4 = 0; l4 < child.width; l4++) {
  10147. if (i3 >= child.inv.length)
  10148. continue;
  10149. if (child.inv[i3 + l4] > 0) {
  10150. items++;
  10151. }
  10152. }
  10153.  
  10154. if (items == 0) {
  10155. i3 += child.width;
  10156. continue;
  10157. }
  10158. }
  10159.  
  10160. for (int l4 = 0; l4 < child.width; l4++) {
  10161. if (i3 >= child.inv.length)
  10162. continue;
  10163. if (search && child.inv[i3] > 0) {
  10164. ItemDefinition itemdef = ItemDefinition.forID(child.inv[i3] - 1);
  10165.  
  10166. if (itemdef == null || itemdef.name == null
  10167. || !itemdef.name.toLowerCase().contains(promptInput.toLowerCase())) {
  10168. i3++;
  10169. continue;
  10170. }
  10171.  
  10172. results++;
  10173. }
  10174.  
  10175. if (clearWhiteSpace) {
  10176. results++;
  10177. }
  10178.  
  10179. int k5 = k2 + (search || clearWhiteSpace ? (results % child.width) : l4)
  10180. * (32 + child.invSpritePadX);
  10181. int j6 = (l2 + ((search || clearWhiteSpace ? (results / child.width) : l3))
  10182. * (32 + child.invSpritePadY)) + yoffset;
  10183.  
  10184. if (i3 < 20) {
  10185. k5 += child.spritesX[i3];
  10186. j6 += child.spritesY[i3];
  10187. }
  10188. if (child.inv[i3] > 0) {
  10189. if (child.invItemSprite != null)
  10190. child.invItemSprite.drawSprite(k5, j6);
  10191. int k6 = 0;
  10192. int j7 = 0;
  10193. int j9 = child.inv[i3] - 1;
  10194. if (k5 > DrawingArea.topX - 32 && k5 < DrawingArea.bottomX && j6 > DrawingArea.topY - 32
  10195. && j6 < DrawingArea.bottomY || activeInterfaceType != 0 && anInt1085 == i3) {
  10196. int l9 = 0;
  10197. if (itemSelected == 1 && anInt1283 == i3 && anInt1284 == child.id)
  10198. l9 = 0xffffff;
  10199. Sprite class30_sub2_sub1_sub1_2 = ItemDefinition.getSprite(j9,
  10200. child.invStackSizes[i3], l9);
  10201. if (class30_sub2_sub1_sub1_2 != null) {
  10202. if (activeInterfaceType != 0 && anInt1085 == i3 && anInt1084 == child.id) {
  10203. k6 = super.mouseX - anInt1087;
  10204. j7 = super.mouseY - anInt1088;
  10205. if (k6 < 5 && k6 > -5)
  10206. k6 = 0;
  10207. if (j7 < 5 && j7 > -5)
  10208. j7 = 0;
  10209. if (anInt989 < ClientSettings.getInt("dragging_threshold")) {
  10210. k6 = 0;
  10211. j7 = 0;
  10212. }
  10213.  
  10214. class30_sub2_sub1_sub1_2.drawSprite1(k5 + k6, j6 + j7);
  10215. currentDragSprite = class30_sub2_sub1_sub1_2;
  10216. currentDragX = k5 + k6;
  10217. currentDragY = j6 + j7;
  10218. currentDragAmount = child.hideInvStackSizes ? -1 : child.invStackSizes[i3];
  10219. currentDragAmountX = j6 + 9 + j7;
  10220. currentDragAmountY = k5 + k6;
  10221.  
  10222. if (j6 + j7 < DrawingArea.topY && class9.scrollPosition > 0) {
  10223. int i10 = (anInt945 * (DrawingArea.topY - j6 - j7)) / 3;
  10224. if (i10 > anInt945 * 10)
  10225. i10 = anInt945 * 10;
  10226. if (i10 > class9.scrollPosition)
  10227. i10 = class9.scrollPosition;
  10228. class9.scrollPosition -= i10;
  10229. anInt1088 += i10;
  10230. }
  10231. if (j6 + j7 + 32 > DrawingArea.bottomY
  10232. && class9.scrollPosition < class9.scrollMax - class9.height) {
  10233. int j10 = (anInt945 * ((j6 + j7 + 32) - DrawingArea.bottomY)) / 3;
  10234. if (j10 > anInt945 * 10)
  10235. j10 = anInt945 * 10;
  10236. if (j10 > class9.scrollMax - class9.height - class9.scrollPosition)
  10237. j10 = class9.scrollMax - class9.height - class9.scrollPosition;
  10238. class9.scrollPosition += j10;
  10239. anInt1088 -= j10;
  10240. }
  10241. } else if (atInventoryInterfaceType != 0 && atInventoryIndex == i3
  10242. && atInventoryInterface == child.id)
  10243. class30_sub2_sub1_sub1_2.drawSprite1(k5, j6);
  10244. else
  10245. class30_sub2_sub1_sub1_2.drawSprite(k5, j6);
  10246. if (class30_sub2_sub1_sub1_2.anInt1444 == 33 || child.invStackSizes[i3] != 1) {
  10247. int k10 = child.invStackSizes[i3];
  10248.  
  10249. if (!child.hideInvStackSizes) {
  10250. if (k10 >= 1500000000 && child.drawInfinity) {
  10251. SpriteLoader.sprites[653].drawSprite(k5, j6);
  10252. } else {
  10253. smallText.method385(0, intToKOrMil(k10), j6 + 10 + j7, k5 + 1 + k6);
  10254. if (k10 >= 1)
  10255. smallText.method385(0xFFFF00, intToKOrMil(k10), j6 + 9 + j7,
  10256. k5 + k6);
  10257. if (k10 >= 100000)
  10258. smallText.method385(0xFFFFFF, intToKOrMil(k10), j6 + 9 + j7,
  10259. k5 + k6);
  10260. if (k10 >= 10000000)
  10261. smallText.method385(0x00FF80, intToKOrMil(k10), j6 + 9 + j7,
  10262. k5 + k6);
  10263. }
  10264. }
  10265. }
  10266. }
  10267. }
  10268. } else if (child.sprites != null && i3 < 20) {
  10269. Sprite class30_sub2_sub1_sub1_1 = child.sprites[i3];
  10270. if (class30_sub2_sub1_sub1_1 != null)
  10271. class30_sub2_sub1_sub1_1.drawSprite(k5, j6);
  10272. } else {
  10273. if (!drawnNoitemSprite) {
  10274. if (child.invNoItemSprite != null) {
  10275. child.invNoItemSprite.drawSprite(k5, j6);
  10276. drawnNoitemSprite = true;
  10277. }
  10278. }
  10279. }
  10280. i3++;
  10281. }
  10282. }
  10283. } else if (child.type == 3) {
  10284. boolean flag = false;
  10285. if (anInt1039 == child.id || anInt1048 == child.id || anInt1026 == child.id)
  10286. flag = true;
  10287. int j3;
  10288. if (interfaceIsSelected(child)) {
  10289. j3 = child.anInt219;
  10290. if (flag && child.anInt239 != 0)
  10291. j3 = child.anInt239;
  10292. } else {
  10293. j3 = child.textColor;
  10294. if (flag && child.anInt216 != 0)
  10295. j3 = child.anInt216;
  10296. }
  10297. if (child.opacity == 0) {
  10298. if (child.aBoolean227)
  10299. DrawingArea.drawPixels(k2, l2, child.width, child.height, j3);
  10300. else
  10301. DrawingArea.fillPixels(k2, child.width, child.height, j3, l2);
  10302. } else if (child.aBoolean227)
  10303. DrawingArea.method335(j3, l2, child.width, child.height, 256 - (child.opacity & 0xff), k2);
  10304. else
  10305. DrawingArea.method338(l2, child.height, 256 - (child.opacity & 0xff), j3, child.width, k2);
  10306. } else if (child.type == 4) {
  10307. FontStyle textDrawingArea = child.textDrawingAreas;
  10308. String s = interfaceStrings ? "" + child.id : child.message;
  10309. boolean flag1 = false;
  10310.  
  10311. int xOffset = 0;
  10312. int imageDraw = 0;
  10313. if (s.contains("<img=")) {
  10314. int prefix = s.indexOf("<img=");
  10315. int suffix = s.indexOf(">");
  10316. String imageId = s.substring(prefix + 5, suffix);
  10317. s = s.replace("<img=" + imageId + ">", "");
  10318. s = s.replace("</img>", "");
  10319. if (imageId.matches("[-+]?\\d*\\.?\\d+")) {
  10320. imageDraw = Integer.parseInt(imageId);
  10321. if (imageDraw < 1 || imageDraw >= modIcons.length) {
  10322. imageDraw = 0;
  10323. }
  10324. }
  10325. if (imageDraw > 0) {
  10326. xOffset += 14;
  10327. }
  10328. }
  10329.  
  10330. if (child.id == 2458)
  10331. s = "Click here to logout";
  10332.  
  10333. if (anInt1039 == child.id || anInt1048 == child.id || anInt1026 == child.id)
  10334. flag1 = true;
  10335.  
  10336. int i4;
  10337. if (child.id != 199) {//// XXX: idfk...
  10338. if (interfaceIsSelected(child)) {
  10339. i4 = child.anInt219;
  10340. if (flag1 && child.anInt239 != 0)
  10341. i4 = child.anInt239;
  10342. if (child.aString228.length() > 0)
  10343. s = child.aString228;
  10344. } else {
  10345. i4 = child.textColor;
  10346. if (flag1 && child.anInt216 != 0)
  10347. i4 = child.anInt216;
  10348. }
  10349. } else {
  10350. i4 = child.textColor;
  10351. }
  10352.  
  10353. if (child.atActionType == 6 && aBoolean1149) {
  10354. s = "Please wait...";
  10355. i4 = child.textColor;
  10356. }
  10357. if (DrawingArea.width == 516) {
  10358. if (i4 == 0xffff00)
  10359. i4 = 255;
  10360. if (i4 == 49152)
  10361. i4 = 0xffffff;
  10362. }
  10363. if ((backDialogID != -1 || dialogID != -1 || child.message.contains("Click here to continue"))
  10364. && (class9.id == backDialogID || class9.id == dialogID)) {
  10365. if (i4 == 0xffff00) {
  10366. i4 = 255;
  10367. }
  10368. if (i4 == 49152) {
  10369. i4 = 0xffffff;
  10370. }
  10371. }
  10372. if ((child.parentID == 1151) || (child.parentID == 12855)) {
  10373. switch (i4) {
  10374. case 16773120:
  10375. i4 = 0xFE981F;
  10376. break;
  10377. case 7040819:
  10378. i4 = 0xAF6A1A;
  10379. break;
  10380. }
  10381. }
  10382. for (int l6 = l2 + textDrawingArea.anInt1497; s.length() > 0; l6 += textDrawingArea.anInt1497) {
  10383. if (s.indexOf("%") != -1) {
  10384. do {
  10385. int k7 = s.indexOf("%1");
  10386. if (k7 == -1)
  10387. break;
  10388.  
  10389. if (child.id < 4000 || child.id > 5000 && child.id != 13921 && child.id != 13922
  10390. && child.id != 12171 && child.id != 12172)
  10391. s = s.substring(0, k7) + methodR(extractInterfaceValues(child, 0))
  10392. + s.substring(k7 + 2);
  10393. else
  10394. s = s.substring(0, k7) + interfaceIntToString(extractInterfaceValues(child, 0))
  10395. + s.substring(k7 + 2);
  10396. } while (true);
  10397. do {
  10398. int l7 = s.indexOf("%2");
  10399. if (l7 == -1)
  10400. break;
  10401. s = s.substring(0, l7) + interfaceIntToString(extractInterfaceValues(child, 1))
  10402. + s.substring(l7 + 2);
  10403. } while (true);
  10404. do {
  10405. int i8 = s.indexOf("%3");
  10406. if (i8 == -1)
  10407. break;
  10408. s = s.substring(0, i8) + interfaceIntToString(extractInterfaceValues(child, 2))
  10409. + s.substring(i8 + 2);
  10410. } while (true);
  10411. do {
  10412. int j8 = s.indexOf("%4");
  10413. if (j8 == -1)
  10414. break;
  10415. s = s.substring(0, j8) + interfaceIntToString(extractInterfaceValues(child, 3))
  10416. + s.substring(j8 + 2);
  10417. } while (true);
  10418. do {
  10419. int k8 = s.indexOf("%5");
  10420. if (k8 == -1)
  10421. break;
  10422. s = s.substring(0, k8) + interfaceIntToString(extractInterfaceValues(child, 4))
  10423. + s.substring(k8 + 2);
  10424. } while (true);
  10425. }
  10426. int l8 = s.indexOf("\\n");
  10427. String s1;
  10428. if (l8 != -1) {
  10429. s1 = s.substring(0, l8);
  10430. s = s.substring(l8 + 2);
  10431. } else {
  10432. s1 = s;
  10433. s = "";
  10434. }
  10435. if (child.centerText) {
  10436. textDrawingArea.method382(i4, k2 + child.width / 2, s1, l6, child.textShadow);
  10437. } else {
  10438. textDrawingArea.method389(child.textShadow, k2 + xOffset, i4, s1, l6);
  10439.  
  10440. }
  10441. }
  10442. } else if (child.type == 5) {
  10443. Sprite sprite;
  10444. if (interfaceIsSelected(child)) {
  10445. if (child.enabledSpriteId != -1) {
  10446. sprite = cacheSprites2[child.enabledSpriteId];
  10447. } else {
  10448. sprite = child.enabledSprite;
  10449. }
  10450. } else if (child.disabledSpriteId != -1) {
  10451. sprite = cacheSprites2[child.disabledSpriteId];
  10452. } else {
  10453. sprite = child.disabledSprite;
  10454. }
  10455.  
  10456. //
  10457. /// XXX: hardcoded ruse shit between //'s
  10458. if (child.id == 1164 || child.id == 1167 || child.id == 1170 || child.id == 1174 || child.id == 1540
  10459. || child.id == 1541 || child.id == 7455 || child.id == 18470 || child.id == 13035
  10460. || child.id == 13045 || child.id == 13053 || child.id == 13061 || child.id == 13069
  10461. || child.id == 13079 || child.id == 30064 || child.id == 30075 || child.id == 30083
  10462. || child.id == 30106 || child.id == 30114 || child.id == 30106 || child.id == 30170
  10463. || child.id == 13087 || child.id == 30162 || child.id == 13095) {
  10464. if (child.enabledSpriteId != -1) {
  10465. sprite = cacheSprites2[child.enabledSpriteId];
  10466. } else {
  10467. sprite = child.enabledSprite;
  10468. }
  10469. }
  10470. //
  10471.  
  10472. if (spellSelected == 1 && child.id == spellID && spellID != 0 && sprite != null) {
  10473. sprite.drawSprite(k2, l2, 0xffffff);
  10474. } else {
  10475. if (sprite != null) {
  10476. if (child.type == 5) {
  10477. if (child.advancedSprite) {
  10478. sprite.drawAdvancedSprite(k2, l2);
  10479. } else {
  10480. /*
  10481. * if(currentGEItem > 0) {
  10482. * if(child.enabledSpriteId == 634) { sprite
  10483. * = geSearchBox; } else
  10484. * if(child.enabledSpriteId == 635) { sprite
  10485. * = geSearchBoxHover; } }
  10486. */
  10487. sprite.drawSprite(k2, l2);
  10488. }
  10489. } else {
  10490. sprite.drawSprite1(k2, l2, child.opacity);
  10491. }
  10492. }
  10493. }
  10494.  
  10495. // if(autocast && child.id == autoCastId)
  10496. // extSprites[43].drawSprite(k2-3, l2-3);
  10497. /*
  10498. * if (sprite != null) if (child.drawsTransparent) {
  10499. * sprite.drawSprite1(k2, l2); } else {
  10500. * sprite.drawSprite(k2, l2); } // /// XXX: hardcoded ruse
  10501. * shit between //'s if (autoCast && child.id == autocastId)
  10502. * cacheSprites2[47].drawSprite(k2 - 3, l2 - 2);
  10503. */
  10504.  
  10505. if (child.summonReq > 0) {
  10506. if (child.summonReq > maxStats[23])
  10507. child.greyScale = true;
  10508. else if (maxStats[23] > child.summonReq)
  10509. child.greyScale = false;
  10510. if (child.greyScale && child.disabledSprite != null)
  10511. child.disabledSprite.greyScale();
  10512. }
  10513. //
  10514.  
  10515. if (child.inputField) {
  10516. newSmallFont.drawCenteredString(child.inputFieldString, k2 + child.inputFieldStringX,
  10517. l2 + child.inputFieldStringY, 0xFE972F, 0);
  10518. }
  10519.  
  10520. // newRegularFont.drawBasicString("" + child.id, k2, l2,
  10521. // Integer.MAX_VALUE, 0);
  10522. } else if (child.type == 6) {
  10523. int k3 = Texture.textureInt1;
  10524. int j4 = Texture.textureInt2;
  10525. Texture.textureInt1 = k2 + child.width / 2;
  10526. Texture.textureInt2 = l2 + child.height / 2;
  10527. int i5 = Texture.anIntArray1470[child.modelRotation1] * child.modelZoom >> 16;
  10528. int l5 = Texture.anIntArray1471[child.modelRotation1] * child.modelZoom >> 16;
  10529. boolean flag2 = interfaceIsSelected(child);
  10530. int i7;
  10531. if (flag2)
  10532. i7 = child.anInt258;
  10533. else
  10534. i7 = child.anInt257;
  10535. Model model = null;
  10536. if (i7 == -1) {
  10537. model = child.method209(-1, -1, flag2);
  10538. } else {
  10539. Animation animation = Animation.getAnim(null, i7);
  10540. if (animation != null) {
  10541. model = child.method209(animation.anIntArray354[child.anInt246],
  10542. animation.anIntArray353[child.anInt246], flag2);
  10543. }
  10544. }
  10545. if (model != null)
  10546. model.method482(child.modelRotation2, 0, child.modelRotation1, 0, i5, l5);
  10547. Texture.textureInt1 = k3;
  10548. Texture.textureInt2 = j4;
  10549. } else if (child.type == 7) {
  10550. FontStyle textDrawingArea_1 = child.textDrawingAreas;
  10551. int k4 = 0;
  10552. for (int j5 = 0; j5 < child.height; j5++) {
  10553. for (int i6 = 0; i6 < child.width; i6++) {
  10554. if (child.inv[k4] > 0) {
  10555. ItemDefinition itemDef = ItemDefinition.forID(child.inv[k4] - 1);
  10556. String s2 = itemDef.name;
  10557. if (itemDef.stackable || child.invStackSizes[k4] != 1)
  10558. s2 = s2 + " x" + intToKOrMilLongName(child.invStackSizes[k4]);
  10559. int i9 = k2 + i6 * (115 + child.invSpritePadX);
  10560. int k9 = l2 + j5 * (12 + child.invSpritePadY);
  10561. if (child.centerText)
  10562. textDrawingArea_1.method382(child.textColor, i9 + child.width / 2, s2, k9,
  10563. child.textShadow);
  10564. else
  10565. textDrawingArea_1.method389(child.textShadow, i9, child.textColor, s2, k9);
  10566. }
  10567. k4++;
  10568. }
  10569. }
  10570. } else if (child.type == 8 && tooltipHoverChildId == child.id && tooltipHoverLoopCycle == 25
  10571. && !menuOpen) {
  10572. int boxWidth = 0;
  10573. int boxHeight = 0;
  10574. FontStyle textDrawingArea_2 = regularText;
  10575.  
  10576. String string = interfaceStrings ? "" + child.id : child.message;
  10577. for (String s1 = string; s1.length() > 0;) {
  10578. if (s1.indexOf("%") != -1) {
  10579. do {
  10580. int k7 = s1.indexOf("%1");
  10581. if (k7 == -1)
  10582. break;
  10583. s1 = s1.substring(0, k7) + interfaceIntToString(extractInterfaceValues(child, 0))
  10584. + s1.substring(k7 + 2);
  10585. } while (true);
  10586. do {
  10587. int l7 = s1.indexOf("%2");
  10588. if (l7 == -1)
  10589. break;
  10590. s1 = s1.substring(0, l7) + interfaceIntToString(extractInterfaceValues(child, 1))
  10591. + s1.substring(l7 + 2);
  10592. } while (true);
  10593. do {
  10594. int i8 = s1.indexOf("%3");
  10595. if (i8 == -1)
  10596. break;
  10597. s1 = s1.substring(0, i8) + interfaceIntToString(extractInterfaceValues(child, 2))
  10598. + s1.substring(i8 + 2);
  10599. } while (true);
  10600. do {
  10601. int j8 = s1.indexOf("%4");
  10602. if (j8 == -1)
  10603. break;
  10604. s1 = s1.substring(0, j8) + interfaceIntToString(extractInterfaceValues(child, 3))
  10605. + s1.substring(j8 + 2);
  10606. } while (true);
  10607. do {
  10608. int k8 = s1.indexOf("%5");
  10609. if (k8 == -1)
  10610. break;
  10611. s1 = s1.substring(0, k8) + interfaceIntToString(extractInterfaceValues(child, 4))
  10612. + s1.substring(k8 + 2);
  10613. } while (true);
  10614. }
  10615. int l7 = s1.indexOf("\\n");
  10616. String s4;
  10617. if (l7 != -1) {
  10618. s4 = s1.substring(0, l7);
  10619. s1 = s1.substring(l7 + 2);
  10620. } else {
  10621. s4 = s1;
  10622. s1 = "";
  10623. }
  10624. int j10 = textDrawingArea_2.getTextWidth(s4);
  10625. if (j10 > boxWidth) {
  10626. boxWidth = j10;
  10627. }
  10628. boxHeight += textDrawingArea_2.anInt1497 + 1;
  10629. }
  10630. boxWidth += 6;
  10631. boxHeight += 7;
  10632. int xPos = (k2 + child.width) - 5 - boxWidth;
  10633. int yPos = l2 + child.height + 5;
  10634. if (xPos < k2 + 5)
  10635. xPos = k2 + 5;
  10636. if (xPos + boxWidth > k + class9.width)
  10637. xPos = (k + class9.width) - boxWidth;
  10638. if (yPos + boxHeight > l + class9.height)
  10639. yPos = (l2 - boxHeight);
  10640.  
  10641. int xOffset = fixed() ? 516 : 0;
  10642. if (xPos + boxWidth + xOffset > frameWidth) {
  10643. xPos -= xPos + boxWidth + xOffset - frameWidth + 7;
  10644. }
  10645.  
  10646. DrawingArea.drawPixels(xPos, yPos, boxWidth, boxHeight, 0xFFFFA0);
  10647. DrawingArea.fillPixels(xPos, boxWidth, boxHeight, 0, yPos);
  10648. String s2 = interfaceStrings ? "" + child.id : child.message;
  10649. for (int j11 = yPos + textDrawingArea_2.anInt1497 + 2; s2
  10650. .length() > 0; j11 += textDrawingArea_2.anInt1497 + 1) {// anInt1497
  10651. if (s2.indexOf("%") != -1) {
  10652. do {
  10653. int k7 = s2.indexOf("%1");
  10654. if (k7 == -1)
  10655. break;
  10656. s2 = s2.substring(0, k7) + interfaceIntToString(extractInterfaceValues(child, 0))
  10657. + s2.substring(k7 + 2);
  10658. } while (true);
  10659. do {
  10660. int l7 = s2.indexOf("%2");
  10661. if (l7 == -1)
  10662. break;
  10663. s2 = s2.substring(0, l7) + interfaceIntToString(extractInterfaceValues(child, 1))
  10664. + s2.substring(l7 + 2);
  10665. } while (true);
  10666. do {
  10667. int i8 = s2.indexOf("%3");
  10668. if (i8 == -1)
  10669. break;
  10670. s2 = s2.substring(0, i8) + interfaceIntToString(extractInterfaceValues(child, 2))
  10671. + s2.substring(i8 + 2);
  10672. } while (true);
  10673. do {
  10674. int j8 = s2.indexOf("%4");
  10675. if (j8 == -1)
  10676. break;
  10677. s2 = s2.substring(0, j8) + interfaceIntToString(extractInterfaceValues(child, 3))
  10678. + s2.substring(j8 + 2);
  10679. } while (true);
  10680. do {
  10681. int k8 = s2.indexOf("%5");
  10682. if (k8 == -1)
  10683. break;
  10684. s2 = s2.substring(0, k8) + interfaceIntToString(extractInterfaceValues(child, 4))
  10685. + s2.substring(k8 + 2);
  10686. } while (true);
  10687. }
  10688. int l11 = s2.indexOf("\\n");
  10689. String s5;
  10690. if (l11 != -1) {
  10691. s5 = s2.substring(0, l11);
  10692. s2 = s2.substring(l11 + 2);
  10693. } else {
  10694. s5 = s2;
  10695. s2 = "";
  10696. }
  10697.  
  10698. if (child.centerText) {
  10699. newRegularFont.drawCenteredString(s5, xPos, j11, 0, -1);
  10700. // textDrawingArea_2.method382(yPos, xPos +
  10701. // class9_1.width / 2, s5, j11, false);
  10702. } else {
  10703. if (s5.contains("\\r")) {
  10704. String text = s5.substring(0, s5.indexOf("\\r"));
  10705. String text2 = s5.substring(s5.indexOf("\\r") + 2);
  10706. newRegularFont.drawBasicString(text, xPos + 3, j11, 0, -1);
  10707. // textDrawingArea_2.method389(false, xPos + 3,
  10708. // 0, text, j11);
  10709. int rightX = boxWidth + xPos - textDrawingArea_2.getTextWidth(text2) - 2;
  10710. // textDrawingArea_2.method389(false, rightX, 0,
  10711. // text2, j11);
  10712. newRegularFont.drawBasicString(text2, rightX, j11, 0, -1);
  10713. } else {
  10714. newRegularFont.drawBasicString(s5, xPos + 3, j11, 0, -1);
  10715. // textDrawingArea_2.method389(false, xPos + 3,
  10716. // 0, s5, j11);
  10717. }
  10718. }
  10719. }
  10720. } else if (child.type == 9) {
  10721. Sprite sprite;/// XXX: type 9 was different in ruse, not
  10722. /// sure why
  10723. if (interfaceIsSelected(child)) {
  10724. sprite = child.enabledSprite;
  10725. } else {
  10726. sprite = child.disabledSprite;
  10727. }
  10728. if (sprite != null) {
  10729. if (child.drawsTransparent)
  10730. sprite.drawTransparentSprite(k2, l2, child.customOpacity);
  10731. else
  10732. sprite.drawSprite(k2, l2);
  10733. }
  10734. }
  10735. }
  10736.  
  10737. DrawingArea.setDrawingArea(l1, i1, k1, j1);
  10738. }
  10739.  
  10740. private void randomizeBackground(Background background) {
  10741. int j = 256;
  10742. for (int k = 0; k < anIntArray1190.length; k++)
  10743. anIntArray1190[k] = 0;
  10744.  
  10745. for (int l = 0; l < 5000; l++) {
  10746. int i1 = (int) (Math.random() * 128D * (double) j);
  10747. anIntArray1190[i1] = (int) (Math.random() * 256D);
  10748. }
  10749. for (int j1 = 0; j1 < 20; j1++) {
  10750. for (int k1 = 1; k1 < j - 1; k1++) {
  10751. for (int i2 = 1; i2 < 127; i2++) {
  10752. int k2 = i2 + (k1 << 7);
  10753. anIntArray1191[k2] = (anIntArray1190[k2 - 1] + anIntArray1190[k2 + 1] + anIntArray1190[k2 - 128]
  10754. + anIntArray1190[k2 + 128]) / 4;
  10755. }
  10756.  
  10757. }
  10758. int ai[] = anIntArray1190;
  10759. anIntArray1190 = anIntArray1191;
  10760. anIntArray1191 = ai;
  10761. }
  10762. if (background != null) {
  10763. int l1 = 0;
  10764. for (int j2 = 0; j2 < background.anInt1453; j2++) {
  10765. for (int l2 = 0; l2 < background.anInt1452; l2++)
  10766. if (background.aByteArray1450[l1++] != 0) {
  10767. int i3 = l2 + 16 + background.anInt1454;
  10768. int j3 = j2 + 16 + background.anInt1455;
  10769. int k3 = i3 + (j3 << 7);
  10770. anIntArray1190[k3] = 0;
  10771. }
  10772. }
  10773. }
  10774. }
  10775.  
  10776. private void method107(int i, int j, RSBuffer stream, Player player) {
  10777. if ((i & 0x400) != 0) {
  10778. player.anInt1543 = stream.method428();
  10779. player.anInt1545 = stream.method428();
  10780. player.anInt1544 = stream.method428();
  10781. player.anInt1546 = stream.method428();
  10782. player.anInt1547 = stream.method436() + loopCycle;
  10783. player.anInt1548 = stream.method435() + loopCycle;
  10784. player.anInt1549 = stream.method428();
  10785. player.method446();
  10786. }
  10787. if ((i & 0x100) != 0) {
  10788. player.anInt1520 = stream.method434();
  10789. int k = stream.readDWord();
  10790. player.anInt1524 = k >> 16;
  10791. player.anInt1523 = loopCycle + (k & 0xffff);
  10792. player.anInt1521 = 0;
  10793. player.anInt1522 = 0;
  10794. if (player.anInt1523 > loopCycle)
  10795. player.anInt1521 = -1;
  10796. if (player.anInt1520 == 65535)
  10797. player.anInt1520 = -1;
  10798. }
  10799. if ((i & 8) != 0) {
  10800. int l = stream.method434();
  10801. if (l == 65535)
  10802. l = -1;
  10803. int i2 = stream.method427();
  10804. if (l == player.anim && l != -1) {
  10805. int i3 = Animation.getAnim(player, l).anInt365;
  10806. if (i3 == 1) {
  10807. player.anInt1527 = 0;
  10808. player.anInt1528 = 0;
  10809. player.anInt1529 = i2;
  10810. player.anInt1530 = 0;
  10811. }
  10812. if (i3 == 2)
  10813. player.anInt1530 = 0;
  10814. } else if (l == -1 || player.anim == -1
  10815. || Animation.getAnim(player, l).anInt359 >= Animation.getAnim(player, player.anim).anInt359) {
  10816. player.anim = l;
  10817. player.anInt1527 = 0;
  10818. player.anInt1528 = 0;
  10819. player.anInt1529 = i2;
  10820. player.anInt1530 = 0;
  10821. player.anInt1542 = player.smallXYIndex;
  10822. }
  10823. }
  10824. if ((i & 4) != 0) {
  10825. player.textSpoken = stream.readString();
  10826. if (player.textSpoken.charAt(0) == '~') {
  10827. player.textSpoken = player.textSpoken.substring(1);
  10828. pushMessage(player.textSpoken, 2, player.name, player.title, player.titleBehindName ? 0 : 1);
  10829. } else if (player == myPlayer)
  10830. pushMessage(player.textSpoken, 2, player.name, player.title, player.titleBehindName ? 0 : 1);
  10831. player.anInt1513 = 0;
  10832. player.anInt1531 = 0;
  10833. player.textCycle = 150;
  10834. }
  10835. if ((i & 0x80) != 0) {
  10836. // right fucking here
  10837. /*
  10838. * int effects = stream.ig2(); int rights =
  10839. * stream.readUnsignedByte(); int gloColor = 0;//0; int ironman2 =
  10840. * stream.readUnsignedByte(); int chatTextSize = stream.nglb(); int
  10841. * currentOffset = stream.currentOffset;
  10842. */
  10843. int i1 = stream.ig2();
  10844. int j2 = stream.readUnsignedByte();
  10845. int ironman2 = stream.readUnsignedByte();
  10846. int j3 = stream.nglb();
  10847. int k3 = stream.currentOffset;
  10848. if (player.name != null && player.visible) {
  10849. long l3 = TextClass.longForName(player.name);
  10850. boolean flag = false;
  10851. if (j2 <= 1) {
  10852. for (int i4 = 0; i4 < ignoreCount; i4++) {
  10853. if (ignoreListAsLongs[i4] != l3)
  10854. continue;
  10855. flag = true;
  10856. break;
  10857. }
  10858.  
  10859. }
  10860. if (!flag && anInt1251 == 0)
  10861. try {
  10862. aStream_834.currentOffset = 0;
  10863. stream.method442(j3, 0, aStream_834.buffer);
  10864. aStream_834.currentOffset = 0;
  10865. String s = TextInput.method525(j3, aStream_834);
  10866. // s = Censor.doCensor(s);
  10867. player.textSpoken = s;
  10868. player.anInt1513 = i1 >> 8;
  10869. player.privelage = j2;
  10870. player.anInt1531 = i1 & 0xff;
  10871. player.textCycle = 150;
  10872.  
  10873. String crown = "";
  10874. if (j2 > 0 && j2 < modIcons.length) {
  10875. crown = "@cr" + j2 + "@";
  10876. }
  10877. if (crown.equals(""))
  10878. pushMessage(s, 2, player.name);
  10879. else
  10880. pushMessage(s, 1, crown + player.name);
  10881. } catch (Exception exception) {
  10882. Signlink.reporterror("cde2");
  10883. }
  10884. }
  10885. stream.currentOffset = k3 + j3;
  10886. }
  10887. if ((i & 1) != 0) {
  10888. player.interactingEntity = stream.method434();
  10889. if (player.interactingEntity == 65535)
  10890. player.interactingEntity = -1;
  10891. }
  10892. if ((i & 0x10) != 0) {
  10893. int j1 = stream.method427();
  10894. byte abyte0[] = new byte[j1];
  10895. RSBuffer stream_1 = new RSBuffer(abyte0);
  10896. stream.readBytes(j1, 0, abyte0);
  10897. aStreamArray895s[j] = stream_1;
  10898. player.updatePlayer(stream_1);
  10899. }
  10900. if ((i & 2) != 0) {
  10901. player.anInt1538 = stream.method436();
  10902. player.anInt1539 = stream.method434();
  10903. }
  10904. if ((i & 0x20) != 0) {
  10905. int k1 = inStream.readRuseShortA();
  10906. int k2 = stream.readUnsignedByte();
  10907. int icon = stream.readUnsignedByte();
  10908. int soakDamage = inStream.readRuseShortA();
  10909. player.updateHitData(k2, k1, loopCycle, icon);
  10910. player.loopCycleStatus = loopCycle + 300;
  10911. player.currentHealth = stream.readRuseShortA();
  10912. player.maxHealth = stream.readRuseShortA();
  10913. }
  10914. if ((i & 0x200) != 0) {
  10915. int l1 = inStream.readRuseShortA();
  10916. int l2 = stream.readUnsignedByte();
  10917. int icon = stream.readUnsignedByte();
  10918. int soakDamage = inStream.readRuseShortA();
  10919. player.updateHitData(l2, l1, loopCycle, icon);
  10920. player.loopCycleStatus = loopCycle + 300;
  10921. player.currentHealth = stream.readRuseShortA();
  10922. player.maxHealth = stream.readRuseShortA();
  10923. }
  10924. }
  10925.  
  10926. private void method108() {
  10927. try {
  10928. int j = myPlayer.x + anInt1278;
  10929. int k = myPlayer.y + anInt1131;
  10930. if (anInt1014 - j < -500 || anInt1014 - j > 500 || anInt1015 - k < -500 || anInt1015 - k > 500) {
  10931. anInt1014 = j;
  10932. anInt1015 = k;
  10933. }
  10934. if (anInt1014 != j)
  10935. anInt1014 += (j - anInt1014) / 16;
  10936. if (anInt1015 != k)
  10937. anInt1015 += (k - anInt1015) / 16;
  10938. if (super.keyArray[1] == 1)
  10939. anInt1186 += (-24 - anInt1186) / 2;
  10940. else if (super.keyArray[2] == 1)
  10941. anInt1186 += (24 - anInt1186) / 2;
  10942. else
  10943. anInt1186 /= 2;
  10944. if (super.keyArray[3] == 1)
  10945. anInt1187 += (12 - anInt1187) / 2;
  10946. else if (super.keyArray[4] == 1)
  10947. anInt1187 += (-12 - anInt1187) / 2;
  10948. else
  10949. anInt1187 /= 2;
  10950. minimapInt1 = minimapInt1 + anInt1186 / 2 & 0x7ff;
  10951. anInt1184 += anInt1187 / 2;
  10952. if (anInt1184 < 128)
  10953. anInt1184 = 128;
  10954. if (anInt1184 > 383)
  10955. anInt1184 = 383;
  10956. int l = anInt1014 >> 7;
  10957. int i1 = anInt1015 >> 7;
  10958. int j1 = method42(plane, anInt1015, anInt1014);
  10959. int k1 = 0;
  10960. if (l > 3 && i1 > 3 && l < 100 && i1 < 100) {
  10961. for (int l1 = l - 4; l1 <= l + 4; l1++) {
  10962. for (int k2 = i1 - 4; k2 <= i1 + 4; k2++) {
  10963. int l2 = plane;
  10964. if (l2 < 3 && (byteGroundArray[1][l1][k2] & 2) == 2)
  10965. l2++;
  10966. int i3 = j1 - intGroundArray[l2][l1][k2];
  10967. if (i3 > k1)
  10968. k1 = i3;
  10969. }
  10970.  
  10971. }
  10972.  
  10973. }
  10974. anInt1005++;
  10975. if (anInt1005 > 1512) {
  10976. anInt1005 = 0;
  10977. /*
  10978. * stream.createFrame(77); stream.writeWordBigEndian(0); int i2
  10979. * = stream.currentOffset; stream.writeWordBigEndian((int)
  10980. * (Math.random() * 256D)); stream.writeWordBigEndian(101);
  10981. * stream.writeWordBigEndian(233); stream.writeWord(45092); if
  10982. * ((int) (Math.random() * 2D) == 0) stream.writeWord(35784);
  10983. * stream.writeWordBigEndian((int) (Math.random() * 256D));
  10984. * stream.writeWordBigEndian(64); stream.writeWordBigEndian(38);
  10985. * stream.writeWord((int) (Math.random() * 65536D));
  10986. * stream.writeWord((int) (Math.random() * 65536D));
  10987. * stream.writeBytes(stream.currentOffset - i2);
  10988. */
  10989. }
  10990. int j2 = k1 * 192;
  10991. if (j2 > 0x17f00)
  10992. j2 = 0x17f00;
  10993. if (j2 < 32768)
  10994. j2 = 32768;
  10995. if (j2 > anInt984) {
  10996. anInt984 += (j2 - anInt984) / 24;
  10997. return;
  10998. }
  10999. if (j2 < anInt984) {
  11000. anInt984 += (j2 - anInt984) / 80;
  11001. }
  11002. } catch (Exception _ex) {
  11003. Signlink.reporterror("glfc_ex " + myPlayer.x + "," + myPlayer.y + "," + anInt1014 + "," + anInt1015 + ","
  11004. + anInt1069 + "," + anInt1070 + "," + baseX + "," + baseY);
  11005. throw new RuntimeException("eek");
  11006. }
  11007. }
  11008.  
  11009. public void processDrawing() {
  11010. if (rsAlreadyLoaded || loadingError || genericLoadingError) {
  11011. showErrorScreen();
  11012. return;
  11013. }
  11014. if (!loggedIn)
  11015. drawLoginScreen(false);
  11016. else
  11017. drawGameScreen();
  11018. anInt1213 = 0;
  11019. }
  11020.  
  11021. public boolean isFriendOrSelf(String s) {
  11022. if (s == null)
  11023. return false;
  11024. for (int i = 0; i < friendsCount; i++)
  11025. if (s.equalsIgnoreCase(friendsList[i]))
  11026. return true;
  11027. return s.equalsIgnoreCase(myPlayer.name);
  11028. }
  11029.  
  11030. private static String combatDiffColor(int i, int j) {
  11031. int k = i - j;
  11032. if (k < -9)
  11033. return "@red@";
  11034. if (k < -6)
  11035. return "@or3@";
  11036. if (k < -3)
  11037. return "@or2@";
  11038. if (k < 0)
  11039. return "@or1@";
  11040. if (k > 9)
  11041. return "@gre@";
  11042. if (k > 6)
  11043. return "@gr3@";
  11044. if (k > 3)
  11045. return "@gr2@";
  11046. if (k > 0)
  11047. return "@gr1@";
  11048. else
  11049. return "@yel@";
  11050. }
  11051.  
  11052. private void setWaveVolume(int i) {
  11053. Signlink.wavevol = i;
  11054. }
  11055.  
  11056. private void draw3dScreen() {
  11057. if (screenOpacity != 0 && screenOpacity < 250) {
  11058. RSInterface.interfaceCache[35556].width = screenAreaWidth;
  11059. RSInterface.interfaceCache[35556].height = screenAreaHeight;
  11060. RSInterface.interfaceCache[35556].opacity = (byte) screenOpacity;
  11061. drawInterface(0, 0, RSInterface.interfaceCache[35555], 0);
  11062. drawInterface(0, 512, RSInterface.interfaceCache[35555], 0);
  11063. drawInterface(0, 512 * 2, RSInterface.interfaceCache[35555], 0);
  11064. drawInterface(0, 512 * 3, RSInterface.interfaceCache[35555], 0);
  11065. drawInterface(0, 0, RSInterface.interfaceCache[35555], 700);
  11066. drawInterface(0, 512, RSInterface.interfaceCache[35555], 700);
  11067. drawInterface(0, 512 * 2, RSInterface.interfaceCache[35555], 700);
  11068. drawInterface(0, 512 * 3, RSInterface.interfaceCache[35555], 700);
  11069. }
  11070. if (showChatComponents) {
  11071. drawSplitPrivateChat();
  11072. }
  11073. if (crossType == 1) {
  11074. int offSet = frameMode == ScreenMode.FIXED ? 4 : 0;
  11075. crosses[crossIndex / 100].drawSprite(crossX - 8 - offSet, crossY - 8 - offSet);
  11076. anInt1142++;
  11077. if (anInt1142 > 67) {
  11078. anInt1142 = 0;
  11079. stream.createFrame(78);
  11080. }
  11081. }
  11082. if (crossType == 2) {
  11083. int offSet = frameMode == ScreenMode.FIXED ? 4 : 0;
  11084. crosses[4 + crossIndex / 100].drawSprite(crossX - 8 - offSet, crossY - 8 - offSet);
  11085. }
  11086.  
  11087. /// XXX: some things are added here
  11088. try {
  11089. ExperienceCounter.draw();
  11090. CombatOverlays.drawBoostedStats();
  11091. CombatOverlays.drawCombatant();
  11092. CombatOverlays.drawOverlays();
  11093. if (loopCycle - lastCameraZoomChange <= 100) {
  11094. int opacity = 255 - (int) (255d * ((loopCycle - lastCameraZoomChange) / 100d));
  11095. int percentage = (int) ((((double) cameraZoom) / 600d) * 100d);
  11096. newSmallFont.drawCenteredString("<trans=" + opacity + ">" + "Zoom: " + percentage + "%", 478,
  11097. fixed() ? 330 : frameHeight - 170, Integer.MAX_VALUE, 0);
  11098. }
  11099. } catch (Exception e) {
  11100. e.printStackTrace();
  11101. }
  11102.  
  11103. if (fpsOn) {
  11104. int textColour = 0xffff00;
  11105. if (super.fps < 15) {
  11106. textColour = 0xff0000;
  11107. }
  11108. // DecimalFormat decimalFormat = new DecimalFormat("#.##");
  11109. boldText.method385(textColour, "Fps: " + super.fps, 45,
  11110. frameMode == ScreenMode.FIXED ? 430 : frameWidth - 300);
  11111. // boldText.method385(0xffff00, "Kb/s: " +
  11112. // decimalFormat.format(((double) bytesReceived / 1024d)), 60,
  11113. // frameMode == ScreenMode.FIXED ? 430 : frameWidth - 300);
  11114. }
  11115.  
  11116. if (anInt1055 == 1) {
  11117. multiOverlay.drawSprite(frameMode == ScreenMode.FIXED ? 470 : frameWidth - 85,
  11118. frameMode == ScreenMode.FIXED ? 296 : 188);
  11119. }
  11120.  
  11121. if (walkableInterfaceId != -1) {
  11122. method119(anInt945, walkableInterfaceId);
  11123. /*
  11124. * if (walkableInterfaceId == 197 && frameMode != ScreenMode.FIXED)
  11125. * { skullIcons[0].drawSprite(frameWidth - 157, 168); String text =
  11126. * RSInterface.interfaceCache[199].message.replace("@yel@", "");
  11127. * regularText.drawChatInput(0xE1981D, frameWidth - 165, text, 207,
  11128. * true); } else
  11129. */if (walkableInterfaceId == 201 && frameMode != ScreenMode.FIXED) {
  11130. drawInterface(0, frameWidth - 560, RSInterface.interfaceCache[walkableInterfaceId], -109);
  11131. } else {
  11132. int x = 0;
  11133. int y = 0;
  11134. if (!fixed()) {
  11135. switch (walkableInterfaceId) {
  11136. case 197:
  11137. x = frameWidth - 615;
  11138. y = -86;
  11139. break;
  11140. }
  11141. }
  11142.  
  11143. drawInterface(0, x, RSInterface.interfaceCache[walkableInterfaceId], y);
  11144. }
  11145. }
  11146.  
  11147. int x = baseX + (myPlayer.x - 6 >> 7);
  11148. int y = baseY + (myPlayer.y - 6 >> 7);
  11149. final String screenMode = frameMode == ScreenMode.FIXED ? "Fixed" : "Resizable";
  11150. if (clientData) {
  11151. int textColour = 0xffff00;
  11152. int fpsColour = 0xffff00;
  11153. if (super.fps < 15) {
  11154. fpsColour = 0xff0000;
  11155. }
  11156.  
  11157. int regionX = x >> 3;
  11158. int regionY = y >> 3;
  11159. int regionId = ((regionX / 8) << 8) + (regionY / 8);
  11160.  
  11161. regularText.method385(textColour, "Mapdata: " + anIntArray1235[0] + ".dat", frameHeight - 285, 5);
  11162. regularText.method385(textColour,
  11163. "Frame width: " + (mouseX - frameWidth) + ", Frame height: " + (mouseY - frameHeight),
  11164. frameHeight - 271, 5);
  11165. regularText.method385(textColour, "Client Zoom: " + cameraZoom, frameHeight - 257, 5);
  11166. regularText.method385(fpsColour, "Fps: " + super.fps, frameHeight - 243, 5);
  11167. Runtime runtime = Runtime.getRuntime();
  11168. int clientMemory = (int) ((runtime.totalMemory() - runtime.freeMemory()) / 1024L);
  11169. regularText.method385(textColour, "Memory Usage: " + clientMemory + "k", frameHeight - 229, 5);
  11170. regularText.method385(textColour, "Mouse X: " + mouseX + ", Mouse Y: " + mouseY, frameHeight - 215, 5);
  11171. regularText.method385(textColour, "Coords: " + x + ", " + y, frameHeight - 201, 5);
  11172. regularText.method385(textColour, "Client Mode: " + screenMode + "", frameHeight - 187, 5);
  11173. regularText.method385(textColour, "Client Resolution: " + frameWidth + "x" + frameHeight, frameHeight - 173,
  11174. 5);
  11175. }
  11176.  
  11177. if (openInterfaceID != -1) {
  11178. if (openInterfaceID == 1) {
  11179. MapRender.render();
  11180. } else {
  11181. currentDragSprite = null;
  11182. currentDragX = 0;
  11183. currentDragY = 0;
  11184. method119(anInt945, openInterfaceID);
  11185. drawInterface(0, fixed() ? 0 : frameWidth / 2 - 378, RSInterface.get(openInterfaceID),
  11186. fixed() ? 0 : frameHeight / 2 - 244);
  11187. if (currentDragSprite != null) {
  11188. currentDragSprite.drawSprite(currentDragX, currentDragY);
  11189. if ((currentDragSprite.anInt1444 == 33 || currentDragAmount != 1) && currentDragAmount != -1) {
  11190. smallText.method385(0, intToKOrMil(currentDragAmount), currentDragAmountX + 1,
  11191. currentDragAmountY + 1);
  11192. if (currentDragAmount >= 1)
  11193. smallText.method385(0xFFFF00, intToKOrMil(currentDragAmount), currentDragAmountX,
  11194. currentDragAmountY);
  11195. if (currentDragAmount >= 100000)
  11196. smallText.method385(0xFFFFFF, intToKOrMil(currentDragAmount), currentDragAmountX,
  11197. currentDragAmountY);
  11198. if (currentDragAmount >= 10000000)
  11199. smallText.method385(0x00FF80, intToKOrMil(currentDragAmount), currentDragAmountX,
  11200. currentDragAmountY);
  11201. }
  11202. }
  11203. }
  11204. }
  11205. if (frameMode == ScreenMode.FIXED) {
  11206. // gameframe.drawCoinsInPouch();
  11207. }
  11208. drawGrandExchange();
  11209. if (!menuOpen) {
  11210. processRightClick();
  11211. drawTooltip();
  11212. drawSceneHover(4, 4);
  11213. } else if (menuScreenArea == 0) {
  11214. drawMenu(frameMode == ScreenMode.FIXED ? 4 : 0, frameMode == ScreenMode.FIXED ? 4 : 0);
  11215. }
  11216.  
  11217. if (anInt1104 != 0) {
  11218. int j = anInt1104 / 50;
  11219. int l = j / 60;
  11220. int yOffset = frameMode == ScreenMode.FIXED ? 0 : frameHeight - 498;
  11221. j %= 60;
  11222. if (j < 10)
  11223. regularText.method385(0xffff00, "System update in: " + l + ":0" + j, 329 + yOffset, 4);
  11224. else
  11225. regularText.method385(0xffff00, "System update in: " + l + ":" + j, 329 + yOffset, 4);
  11226. anInt849++;
  11227. if (anInt849 > 75) {
  11228. anInt849 = 0;
  11229. stream.createFrame(148);
  11230. }
  11231. }
  11232. }
  11233.  
  11234. private void addIgnore(long l) {
  11235. try {
  11236. if (l == 0L)
  11237. return;
  11238. if (ignoreCount >= 100) {
  11239. pushMessage("Your ignore list is full. Max of 100 hit", 0, "");
  11240. return;
  11241. }
  11242. String s = TextClass.fixName(TextClass.nameForLong(l));
  11243. for (int j = 0; j < ignoreCount; j++)
  11244. if (ignoreListAsLongs[j] == l) {
  11245. pushMessage(s + " is already on your ignore list", 0, "");
  11246. return;
  11247. }
  11248. for (int k = 0; k < friendsCount; k++)
  11249. if (friendsListAsLongs[k] == l) {
  11250. pushMessage("Please remove " + s + " from your friend list first", 0, "");
  11251. return;
  11252. }
  11253.  
  11254. ignoreListAsLongs[ignoreCount++] = l;
  11255. stream.createFrame(133);
  11256. stream.writeQWord(l);
  11257. return;
  11258. } catch (RuntimeException runtimeexception) {
  11259. Signlink.reporterror("45688, " + l + ", " + 4 + ", " + runtimeexception.toString());
  11260. }
  11261. throw new RuntimeException();
  11262. }
  11263.  
  11264. private void method114() {
  11265. for (int i = -1; i < playerCount; i++) {
  11266. int j;
  11267. if (i == -1)
  11268. j = myPlayerIndex;
  11269. else
  11270. j = playerIndices[i];
  11271. Player player = playerArray[j];
  11272. if (player != null)
  11273. method96(player);
  11274. }
  11275.  
  11276. }
  11277.  
  11278. private void method115() {
  11279. if (loadingStage == 2) {
  11280. for (Class30_Sub1 class30_sub1 = (Class30_Sub1) aClass19_1179
  11281. .reverseGetFirst(); class30_sub1 != null; class30_sub1 = (Class30_Sub1) aClass19_1179
  11282. .reverseGetNext()) {
  11283. if (class30_sub1.delay > 0)
  11284. class30_sub1.delay--;
  11285. if (class30_sub1.delay == 0) {
  11286. if (class30_sub1.anInt1299 < 0
  11287. || ObjectManager.method178(class30_sub1.anInt1299, class30_sub1.anInt1301)) {
  11288. method142(class30_sub1.y, class30_sub1.heightLevel, class30_sub1.anInt1300,
  11289. class30_sub1.anInt1301, class30_sub1.x, class30_sub1.face, class30_sub1.anInt1299);
  11290. class30_sub1.unlink();
  11291. }
  11292. } else {
  11293. if (class30_sub1.anInt1302 > 0)
  11294. class30_sub1.anInt1302--;
  11295. if (class30_sub1.anInt1302 == 0 && class30_sub1.x >= 1 && class30_sub1.y >= 1
  11296. && class30_sub1.x <= 102 && class30_sub1.y <= 102 && (class30_sub1.objectId < 0
  11297. || ObjectManager.method178(class30_sub1.objectId, class30_sub1.type))) {
  11298. method142(class30_sub1.y, class30_sub1.heightLevel, class30_sub1.faceIndex, class30_sub1.type,
  11299. class30_sub1.x, class30_sub1.face, class30_sub1.objectId);
  11300. class30_sub1.anInt1302 = -1;
  11301. if (class30_sub1.objectId == class30_sub1.anInt1299 && class30_sub1.anInt1299 == -1)
  11302. class30_sub1.unlink();
  11303. else if (class30_sub1.objectId == class30_sub1.anInt1299
  11304. && class30_sub1.faceIndex == class30_sub1.anInt1300
  11305. && class30_sub1.type == class30_sub1.anInt1301)
  11306. class30_sub1.unlink();
  11307. }
  11308. }
  11309. }
  11310.  
  11311. }
  11312. }
  11313.  
  11314. private void determineMenuSize() {
  11315. int boxLength = boldText.getTextWidth("Choose option");
  11316. for (int row = 0; row < menuActionRow; row++) {
  11317. String text = menuActionName[row];
  11318. text = text.replaceAll("</col>", "");
  11319. int i = 0;
  11320. while (text.contains("<col=") && i++ < 10) {
  11321. int colorIndex = text.indexOf("<col=");
  11322. int colorEndIndex = text.indexOf(">");
  11323. String color = text.substring(colorIndex, colorEndIndex + 1);
  11324. text = text.replace(color, "");
  11325. }
  11326. int actionLength = boldText.getTextWidth(text);
  11327. if (actionLength > boxLength)
  11328. boxLength = actionLength;
  11329. }
  11330. boxLength += 8;
  11331. int offset = 15 * menuActionRow + 21;
  11332. if (super.saveClickX > 0 && super.saveClickY > 0 && super.saveClickX < frameWidth
  11333. && super.saveClickY < frameHeight) {
  11334. int xClick = super.saveClickX - boxLength / 2;
  11335. if (xClick + boxLength > frameWidth - 4) {
  11336. xClick = frameWidth - 4 - boxLength;
  11337. }
  11338. if (xClick < 0) {
  11339. xClick = 0;
  11340. }
  11341. int yClick = super.saveClickY - 0;
  11342. if (yClick + offset > frameHeight - 6) {
  11343. yClick = frameHeight - 6 - offset;
  11344. }
  11345. if (yClick < 0) {
  11346. yClick = 0;
  11347. }
  11348. menuOpen = true;
  11349. menuOffsetX = xClick;
  11350. menuOffsetY = yClick;
  11351. menuWidth = boxLength;
  11352. menuHeight = 15 * menuActionRow + 22;
  11353. }
  11354. }
  11355.  
  11356. private void method117(RSBuffer stream) {
  11357. stream.initBitAccess();
  11358. int j = stream.readBits(1);
  11359. if (j == 0)
  11360. return;
  11361. int k = stream.readBits(2);
  11362. if (k == 0) {
  11363. anIntArray894[anInt893++] = myPlayerIndex;
  11364. return;
  11365. }
  11366. if (k == 1) {
  11367. int l = stream.readBits(3);
  11368. myPlayer.moveInDir(false, l);
  11369. int k1 = stream.readBits(1);
  11370. if (k1 == 1)
  11371. anIntArray894[anInt893++] = myPlayerIndex;
  11372. return;
  11373. }
  11374. if (k == 2) {
  11375. int i1 = stream.readBits(3);
  11376. myPlayer.moveInDir(true, i1);
  11377. int l1 = stream.readBits(3);
  11378. myPlayer.moveInDir(true, l1);
  11379. int j2 = stream.readBits(1);
  11380. if (j2 == 1)
  11381. anIntArray894[anInt893++] = myPlayerIndex;
  11382. return;
  11383. }
  11384. if (k == 3) {
  11385. plane = stream.readBits(2);
  11386. int j1 = stream.readBits(1);
  11387. int i2 = stream.readBits(1);
  11388. if (i2 == 1)
  11389. anIntArray894[anInt893++] = myPlayerIndex;
  11390. int k2 = stream.readBits(7);
  11391. int l2 = stream.readBits(7);
  11392. myPlayer.setPos(l2, k2, j1 == 1);
  11393. }
  11394. }
  11395.  
  11396. private void nullLoader() {
  11397. aBoolean831 = false;
  11398. while (drawingFlames) {
  11399. aBoolean831 = false;
  11400. try {
  11401. Thread.sleep(50L);
  11402. } catch (Exception _ex) {
  11403. }
  11404. }
  11405. aBackground_966 = null;
  11406. aBackground_967 = null;
  11407. aBackgroundArray1152s = null;
  11408. anIntArray850 = null;
  11409. anIntArray851 = null;
  11410. anIntArray852 = null;
  11411. anIntArray853 = null;
  11412. anIntArray1190 = null;
  11413. anIntArray1191 = null;
  11414. anIntArray828 = null;
  11415. anIntArray829 = null;
  11416. aClass30_Sub2_Sub1_Sub1_1201 = null;
  11417. aClass30_Sub2_Sub1_Sub1_1202 = null;
  11418. }
  11419.  
  11420. private boolean method119(int i, int j) {
  11421. boolean flag1 = false;
  11422. RSInterface class9 = RSInterface.interfaceCache[j];
  11423. if (class9.children == null)
  11424. return flag1;
  11425. for (int k = 0; k < class9.children.length; k++) {
  11426. if (class9.children[k] == -1)
  11427. break;
  11428. RSInterface class9_1 = RSInterface.interfaceCache[class9.children[k]];
  11429. if (class9_1 == null)
  11430. continue;
  11431. if (class9_1.type == 1)
  11432. flag1 |= method119(i, class9_1.id);
  11433. if (class9_1.type == 6 && (class9_1.anInt257 != -1 || class9_1.anInt258 != -1)) {
  11434. boolean flag2 = interfaceIsSelected(class9_1);
  11435. int l;
  11436. if (flag2)
  11437. l = class9_1.anInt258;
  11438. else
  11439. l = class9_1.anInt257;
  11440. if (l != -1) {
  11441. Animation animation = Animation.getAnim(null, l);
  11442. if (animation != null) {
  11443. for (class9_1.anInt208 += i; class9_1.anInt208 > animation.method258(class9_1.anInt246);) {
  11444. class9_1.anInt208 -= animation.method258(class9_1.anInt246) + 1;
  11445. class9_1.anInt246++;
  11446. if (class9_1.anInt246 >= animation.anInt352) {
  11447. class9_1.anInt246 -= animation.anInt356;
  11448. if (class9_1.anInt246 < 0 || class9_1.anInt246 >= animation.anInt352)
  11449. class9_1.anInt246 = 0;
  11450. }
  11451. flag1 = true;
  11452. }
  11453. }
  11454.  
  11455. }
  11456. }
  11457. }
  11458.  
  11459. return flag1;
  11460. }
  11461.  
  11462. private int method120() {
  11463. if (ClientSettings.getBoolean("roofs_disabled")) {
  11464. return plane;
  11465. }
  11466. int j = 3;
  11467. if (yCameraCurve < 310) {
  11468. int k = xCameraPos >> 7;
  11469. int l = yCameraPos >> 7;
  11470. int i1 = myPlayer.x >> 7;
  11471. int j1 = myPlayer.y >> 7;
  11472. if ((byteGroundArray[plane][k][l] & 4) != 0)
  11473. j = plane;
  11474. int k1;
  11475. if (i1 > k)
  11476. k1 = i1 - k;
  11477. else
  11478. k1 = k - i1;
  11479. int l1;
  11480. if (j1 > l)
  11481. l1 = j1 - l;
  11482. else
  11483. l1 = l - j1;
  11484. if (k1 > l1) {
  11485. int i2 = (l1 * 0x10000) / k1;
  11486. int k2 = 32768;
  11487. while (k != i1) {
  11488. if (k < i1)
  11489. k++;
  11490. else if (k > i1)
  11491. k--;
  11492. if ((byteGroundArray[plane][k][l] & 4) != 0)
  11493. j = plane;
  11494. k2 += i2;
  11495. if (k2 >= 0x10000) {
  11496. k2 -= 0x10000;
  11497. if (l < j1)
  11498. l++;
  11499. else if (l > j1)
  11500. l--;
  11501. if ((byteGroundArray[plane][k][l] & 4) != 0)
  11502. j = plane;
  11503. }
  11504. }
  11505. } else {
  11506. int j2 = (k1 * 0x10000) / l1;
  11507. int l2 = 32768;
  11508. while (l != j1) {
  11509. if (l < j1)
  11510. l++;
  11511. else if (l > j1)
  11512. l--;
  11513. if ((byteGroundArray[plane][k][l] & 4) != 0)
  11514. j = plane;
  11515. l2 += j2;
  11516. if (l2 >= 0x10000) {
  11517. l2 -= 0x10000;
  11518. if (k < i1)
  11519. k++;
  11520. else if (k > i1)
  11521. k--;
  11522. if ((byteGroundArray[plane][k][l] & 4) != 0)
  11523. j = plane;
  11524. }
  11525. }
  11526. }
  11527. }
  11528. if ((byteGroundArray[plane][myPlayer.x >> 7][myPlayer.y >> 7] & 4) != 0)
  11529. j = plane;
  11530. return j;
  11531. }
  11532.  
  11533. private int method121() {
  11534. if (roofsOff) {
  11535. return plane;
  11536. }
  11537. int j = method42(plane, yCameraPos, xCameraPos);
  11538. if (j - zCameraPos < 800 && (byteGroundArray[plane][xCameraPos >> 7][yCameraPos >> 7] & 4) != 0)
  11539. return plane;
  11540. else
  11541. return 3;
  11542. }
  11543.  
  11544. private void delIgnore(long l) {
  11545. try {
  11546. if (l == 0L)
  11547. return;
  11548. for (int j = 0; j < ignoreCount; j++)
  11549. if (ignoreListAsLongs[j] == l) {
  11550. ignoreCount--;
  11551. System.arraycopy(ignoreListAsLongs, j + 1, ignoreListAsLongs, j, ignoreCount - j);
  11552.  
  11553. stream.createFrame(74);
  11554. stream.writeQWord(l);
  11555. return;
  11556. }
  11557.  
  11558. return;
  11559. } catch (RuntimeException runtimeexception) {
  11560. Signlink.reporterror("47229, " + 3 + ", " + l + ", " + runtimeexception.toString());
  11561. }
  11562. throw new RuntimeException();
  11563. }
  11564.  
  11565. private void chatJoin(long l) {
  11566. try {
  11567. if (l == 0L)
  11568. return;
  11569. stream.createFrame(60);
  11570. stream.writeQWord(l);
  11571. return;
  11572. } catch (RuntimeException runtimeexception) {
  11573. Signlink.reporterror("47229, " + 3 + ", " + l + ", " + runtimeexception.toString());
  11574. }
  11575. throw new RuntimeException();
  11576.  
  11577. }
  11578.  
  11579. public String getParameter(String s) {
  11580. if (Signlink.mainapp != null)
  11581. return Signlink.mainapp.getParameter(s);
  11582. else
  11583. return super.getParameter(s);
  11584. }
  11585.  
  11586. private static final int [] RUNES = new int [] {
  11587. 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 4694, 4695, 4696, 4697, 4698, 4699, 9076, 9075
  11588. };
  11589.  
  11590. private static boolean isRune(final int itemId) {
  11591. for (int i : RUNES) {
  11592. if (itemId == i) {
  11593. return true;
  11594. }
  11595. }
  11596. return false;
  11597. }
  11598.  
  11599. private static boolean interfaceContainsItem(final int itemId, final RSInterface _interface) {
  11600. for (int index = 0; index < _interface.inv.length; index ++) {
  11601. if (_interface.inv[index] == itemId) {
  11602. return true;
  11603. }
  11604. }
  11605. return false;
  11606. }
  11607.  
  11608. private static int getIndexByInterface(final int itemId, final RSInterface _interface) {
  11609. for (int index = 0; index < _interface.inv.length; index ++) {
  11610. if (_interface.inv[index] == itemId) {
  11611. return index;
  11612. }
  11613. }
  11614. return -1;
  11615. }
  11616.  
  11617. private long extractInterfaceValues(RSInterface class9, int j) {
  11618. if (class9.valueIndexArray == null || j >= class9.valueIndexArray.length)
  11619. return -2;
  11620. try {
  11621. int ai[] = class9.valueIndexArray[j];
  11622. long k = 0;
  11623. int l = 0;
  11624. int i1 = 0;
  11625. do {
  11626. int j1 = ai[l++];
  11627. long k1 = 0;
  11628. byte byte0 = 0;
  11629. if (j1 == 0) {
  11630. return k;
  11631. }
  11632.  
  11633. if (j1 == 1) {
  11634. int index = ai[l++];
  11635. k1 = currentStats[index];
  11636.  
  11637. if (index == 3 || index == 5) {
  11638. k1 = (int) Math.ceil(((double) k1) / 10d);
  11639. }
  11640. }
  11641. if (j1 == 2) {
  11642. int index = ai[l++];
  11643. k1 = maxStats[index];
  11644. }
  11645. if (j1 == 3)
  11646. k1 = currentExp[ai[l++]];
  11647. if (j1 == 4) {
  11648. RSInterface class9_1 = RSInterface.interfaceCache[ai[l++]];
  11649. int itemId = ai[l++];
  11650.  
  11651. if (itemId >= 0 && itemId < ItemDefinition.totalItems
  11652. && (!ItemDefinition.forID(itemId).membersObject || isMembers)) {
  11653. boolean isRune = isRune(itemId + 1);
  11654. boolean hasPouch = interfaceContainsItem(42791 + 1, class9_1);
  11655. int pouchIndex = getIndexByInterface(itemId + 1, RSInterface.get(41710));
  11656. if (isRune && hasPouch && pouchIndex != -1) {
  11657. k1 += RSInterface.get(41710).invStackSizes[pouchIndex];
  11658. }
  11659.  
  11660. for (int inventoryIndex = 0; inventoryIndex < class9_1.inv.length; inventoryIndex++) {
  11661. if (class9_1.inv[inventoryIndex] == itemId + 1) {
  11662. k1 += class9_1.invStackSizes[inventoryIndex];
  11663. }
  11664. }
  11665. }
  11666. }
  11667. if (j1 == 5)
  11668. k1 = variousSettings[ai[l++]];
  11669. if (j1 == 6)
  11670. k1 = experienceForLevels[maxStats[ai[l++]] - 1];
  11671. if (j1 == 7)
  11672. k1 = (variousSettings[ai[l++]] * 100) / 46875;
  11673. if (j1 == 8)
  11674. k1 = myPlayer.combatLevel;
  11675. if (j1 == 9) {
  11676. for (int l1 = 0; l1 < Skills.skillsCount; l1++)
  11677. if (Skills.skillEnabled[l1])
  11678. k1 += maxStats[l1];
  11679.  
  11680. }
  11681. if (j1 == 10) {
  11682. RSInterface class9_2 = RSInterface.interfaceCache[ai[l++]];
  11683. int l2 = ai[l++] + 1;
  11684. if (l2 >= 0 && l2 < ItemDefinition.totalItems && isMembers) {
  11685. for (int k3 = 0; k3 < class9_2.inv.length; k3++) {
  11686. if (class9_2.inv[k3] != l2)
  11687. continue;
  11688. k1 = 0x3b9ac9ff;
  11689. break;
  11690. }
  11691.  
  11692. }
  11693. }
  11694. if (j1 == 11)
  11695. k1 = energy;
  11696. if (j1 == 12)
  11697. k1 = weight;
  11698. if (j1 == 13) {
  11699. int i2 = variousSettings[ai[l++]];
  11700. int i3 = ai[l++];
  11701. k1 = (i2 & 1 << i3) == 0 ? 0 : 1;
  11702. }
  11703. if (j1 == 14) {
  11704. int j2 = ai[l++];
  11705. VarBit varBit = VarBit.cache[j2];
  11706. int l3 = varBit.anInt648;
  11707. int i4 = varBit.anInt649;
  11708. int j4 = varBit.anInt650;
  11709. int k4 = anIntArray1232[j4 - i4];
  11710. k1 = variousSettings[l3] >> i4 & k4;
  11711. }
  11712. if (j1 == 15)
  11713. byte0 = 1;
  11714. if (j1 == 16)
  11715. byte0 = 2;
  11716. if (j1 == 17)
  11717. byte0 = 3;
  11718. if (j1 == 18)
  11719. k1 = (myPlayer.x >> 7) + baseX;
  11720. if (j1 == 19)
  11721. k1 = (myPlayer.y >> 7) + baseY;
  11722. if (j1 == 20) {
  11723. k1 = ai[l++];
  11724. }
  11725. if (j1 == 21) {
  11726. int skill = ai[l++];
  11727. int experience = currentExp[skill];
  11728. int expIndex = 0;
  11729. for (int it = 0; it < experienceForLevels.length; it++) {
  11730. if (experience < experienceForLevels[it]) {
  11731. expIndex = it;
  11732. break;
  11733. }
  11734. }
  11735.  
  11736. int expUntil = maxStats[skill] == 99 ? 0 : experienceForLevels[expIndex] - experience;
  11737. k1 = expUntil;
  11738. }
  11739. if (j1 == 22) {
  11740. l++;
  11741. long total = 0;
  11742. for (int exp : currentExp) {
  11743. total += exp;
  11744. }
  11745. k1 = total;
  11746. }
  11747. if (j1 == 23) {
  11748. RSInterface class9_2 = RSInterface.get(ai[l++]);
  11749. int items = 0;
  11750. for (int k3 = 0; k3 < class9_2.inv.length; k3++) {
  11751. if (class9_2.inv[k3] > 0)
  11752. items++;
  11753. }
  11754. k1 = items;
  11755. }
  11756. if (j1 == 24) {
  11757. l++;
  11758.  
  11759. int attack = maxStats[SkillData.ATTACK.ordinal()];
  11760. int defence = maxStats[SkillData.DEFENCE.ordinal()];
  11761. int strength = maxStats[SkillData.STRENGTH.ordinal()];
  11762. int hp = (int) (maxStats[SkillData.CONSTITUTION.ordinal()]);
  11763. int prayer = (int) (maxStats[SkillData.PRAYER.ordinal()]);
  11764. int ranged = maxStats[SkillData.RANGED.ordinal()];
  11765. int magic = maxStats[SkillData.MAGIC.ordinal()];
  11766. int combatLevel = 3;
  11767. combatLevel = (int) ((defence + hp + Math.floor(prayer / 2)) * 0.2535) + 1;
  11768. double melee = (attack + strength) * 0.325;
  11769. double ranger = Math.floor(ranged * 1.5) * 0.325;
  11770. double mage = Math.floor(magic * 1.5) * 0.325;
  11771. if (melee >= ranger && melee >= mage) {
  11772. combatLevel += melee;
  11773. } else if (ranger >= melee && ranger >= mage) {
  11774. combatLevel += ranger;
  11775. } else if (mage >= melee && mage >= ranger) {
  11776. combatLevel += mage;
  11777. }
  11778. if (combatLevel > 126) {
  11779. combatLevel = 126;
  11780. } else if (combatLevel < 3) {
  11781. combatLevel = 3;
  11782. }
  11783. k1 = combatLevel;
  11784. }
  11785. if (j1 == 25) {
  11786. l++;
  11787. int total = 0;
  11788. for (int i = 0; i < maxStats.length; i++) {
  11789. total += maxStats[i];
  11790. }
  11791. k1 = total;
  11792. }
  11793. if (byte0 == 0) {
  11794. if (i1 == 0)
  11795. k += k1;
  11796. if (i1 == 1)
  11797. k -= k1;
  11798. if (i1 == 2 && k1 != 0)
  11799. k /= k1;
  11800. if (i1 == 3)
  11801. k *= k1;
  11802. i1 = 0;
  11803. } else {
  11804. i1 = byte0;
  11805. }
  11806. } while (true);
  11807. } catch (Exception _ex) {
  11808. return -1;
  11809. }
  11810. }
  11811.  
  11812. private void drawTooltip() {
  11813. if (menuActionRow < 2 && itemSelected == 0 && spellSelected == 0)
  11814. return;
  11815. String s;
  11816. if (itemSelected == 1 && menuActionRow < 2)
  11817. s = "Use " + selectedItemName + " with...";
  11818. else if (spellSelected == 1 && menuActionRow < 2)
  11819. s = spellTooltip + "...";
  11820. else
  11821. s = menuActionName[menuActionRow - 1];
  11822.  
  11823. if (gameframe.isMouseInsideTabArea() && shiftDrop()) {
  11824. s = menuActionName[2];
  11825. }
  11826. if (menuActionRow > 2)
  11827. s = s + "@whi@ / " + (menuActionRow - 2) + " more options";
  11828. if (!ClientSettings.getBoolean("menu_scene_hovers")) {
  11829. newBoldFont.drawBasicString(s, 4, 15, 0xffffff, 0);
  11830. }
  11831. }
  11832.  
  11833. private void markMinimap(Sprite sprite, int x, int y) {
  11834. if (sprite == null) {
  11835. return;
  11836. }
  11837. int k = minimapInt1 + minimapInt2 & 0x7ff;
  11838. int l = x * x + y * y;
  11839. if (l > 6400) {
  11840. return;
  11841. }
  11842. int i1 = Model.modelIntArray1[k];
  11843. int j1 = Model.modelIntArray2[k];
  11844. i1 = (i1 * 256) / (minimapInt3 + 256);
  11845. j1 = (j1 * 256) / (minimapInt3 + 256);
  11846. int k1 = y * i1 + x * j1 >> 16;
  11847. int l1 = y * j1 - x * i1 >> 16;
  11848. if (frameMode == ScreenMode.FIXED) {
  11849. sprite.drawSprite(((94 + k1) - sprite.anInt1444 / 2) + 4 + 30, 83 - l1 - sprite.anInt1445 / 2 - 4 + 5);
  11850. } else {
  11851. sprite.drawSprite(((77 + k1) - sprite.anInt1444 / 2) + 4 + (frameWidth - 167),
  11852. 85 - l1 - sprite.anInt1445 / 2 - 4);
  11853. }
  11854. }
  11855.  
  11856. public void configureMinimap(int mapbackSpriteIndex) {
  11857. if (ClientSettings.getInt("minimap_config") == mapbackSpriteIndex)
  11858. return;
  11859. ClientSettings.set("minimap_config", mapbackSpriteIndex);
  11860.  
  11861. for (int j6 = 0; j6 < 33; j6++) {
  11862. int k6 = 999;
  11863. int i7 = 0;
  11864. for (int k7 = 0; k7 < 34; k7++) {
  11865. if (mapBack2.aByteArray1450[k7 + j6 * mapBack2.anInt1452] == 0) {
  11866. if (k6 == 999)
  11867. k6 = k7;
  11868. continue;
  11869. }
  11870. if (k6 == 999)
  11871. continue;
  11872. i7 = k7;
  11873. break;
  11874. }
  11875. anIntArray968[j6] = k6;
  11876. anIntArray1057[j6] = i7 - k6;
  11877. }
  11878.  
  11879. if (mapbackSpriteIndex == 0) {
  11880. for (int l6 = 1; l6 < 154; l6++) {
  11881. int j7 = 999;
  11882. int l7 = 0;
  11883. for (int j8 = 1; j8 < 177; j8++) {
  11884. if (mapBack.aByteArray1450[j8
  11885. + l6 * mapBack.anInt1452] == 0/*
  11886. * && (j8 > 34 || l6
  11887. * > 34)
  11888. */) {
  11889. if (j7 == 999) {
  11890. j7 = j8;
  11891. }
  11892. continue;
  11893. }
  11894. if (j7 == 999) {
  11895. continue;
  11896. }
  11897. l7 = j8;
  11898. break;
  11899. }
  11900. anIntArray1052[l6 - 1] = j7 - 24;
  11901. anIntArray1229[l6 - 1] = l7 - j7;
  11902. }
  11903. } else if (mapbackSpriteIndex == 1) {
  11904. for (int l6 = 5; l6 < 156; l6++) {
  11905. int j7 = 999;
  11906. int l7 = 0;
  11907. for (int j8 = 25; j8 < 172; j8++) {
  11908. if (mapBack2.aByteArray1450[j8 + l6 * mapBack2.anInt1452] == 0 && (j8 > 34 || l6 > 34)) {
  11909. if (j7 == 999)
  11910. j7 = j8;
  11911. continue;
  11912. }
  11913. if (j7 == 999)
  11914. continue;
  11915. l7 = j8;
  11916. break;
  11917. }
  11918.  
  11919. anIntArray1052[l6 - 5] = j7 - 25;
  11920. anIntArray1229[l6 - 5] = l7 - j7;
  11921. }
  11922. }
  11923. }
  11924.  
  11925. private void npcScreenPos(Entity entity, int i) {
  11926. calcEntityScreenPos(entity.x, i, entity.y);
  11927. }
  11928.  
  11929. private void calcEntityScreenPos(int i, int j, int l) {
  11930. if (i < 128 || l < 128 || i > 13056 || l > 13056) {
  11931. spriteDrawX = -1;
  11932. spriteDrawY = -1;
  11933. return;
  11934. }
  11935. int i1 = method42(plane, l, i) - j;
  11936. i -= xCameraPos;
  11937. i1 -= zCameraPos;
  11938. l -= yCameraPos;
  11939. int j1 = Model.modelIntArray1[yCameraCurve];
  11940. int k1 = Model.modelIntArray2[yCameraCurve];
  11941. int l1 = Model.modelIntArray1[xCameraCurve];
  11942. int i2 = Model.modelIntArray2[xCameraCurve];
  11943. int j2 = l * l1 + i * i2 >> 16;
  11944. l = l * i2 - i * l1 >> 16;
  11945. i = j2;
  11946. j2 = i1 * k1 - l * j1 >> 16;
  11947. l = i1 * j1 + l * k1 >> 16;
  11948. i1 = j2;
  11949. if (l >= 50) {
  11950. spriteDrawX = Texture.textureInt1 + (i << WorldController.viewDistance) / l;
  11951. spriteDrawY = Texture.textureInt2 + (i1 << WorldController.viewDistance) / l;
  11952. } else {
  11953. spriteDrawX = -1;
  11954. spriteDrawY = -1;
  11955. }
  11956. }
  11957.  
  11958. private void buildSplitPrivateChatMenu() {
  11959. if (splitPrivateChat == 0)
  11960. return;
  11961. int i = 0;
  11962. if (anInt1104 != 0)
  11963. i = 1;
  11964. for (int j = 0; j < 100; j++)
  11965. if (chatMessages[j] != null) {
  11966. int k = chatTypes[j];
  11967. String s = chatNames[j];
  11968. if (s != null) {
  11969. for (int j22 = 0; j22 < 20; j22++) {
  11970. if (s.startsWith("@cr" + j22 + "@")) {
  11971. s = s.substring(("@cr" + j22 + "@").length());
  11972. }
  11973. }
  11974. }
  11975.  
  11976. if ((k == 3 || k == 7)
  11977. && (k == 7 || privateChatMode == 0 || privateChatMode == 1 && isFriendOrSelf(s))) {
  11978. int offSet = frameMode == ScreenMode.FIXED ? 4 : 0;
  11979. int l = 329 - i * 13;
  11980. if (frameMode != ScreenMode.FIXED) {
  11981. l = frameHeight - 170 - i * 13;
  11982. }
  11983. if (super.mouseX > 4 && super.mouseY - offSet > l - 10 && super.mouseY - offSet <= l + 3) {
  11984. int i1 = regularText.getTextWidth("From: " + s + chatMessages[j]) + 25;
  11985. if (i1 > 450)
  11986. i1 = 450;
  11987. if (super.mouseX < 4 + i1) {
  11988. if (myPrivilege >= 1) {
  11989. menuActionName[menuActionRow] = "Report abuse @whi@" + s;
  11990. menuActionID[menuActionRow] = 2606;
  11991. menuActionRow++;
  11992. }
  11993. menuActionName[menuActionRow] = "Add ignore @whi@" + s;
  11994. menuActionID[menuActionRow] = 2042;
  11995. menuActionRow++;
  11996. menuActionName[menuActionRow] = "Add friend @whi@" + s;
  11997. menuActionID[menuActionRow] = 2337;
  11998. menuActionRow++;
  11999. }
  12000. }
  12001. if (++i >= 5)
  12002. return;
  12003. }
  12004. if ((k == 5 || k == 6) && privateChatMode < 2 && ++i >= 5)
  12005. return;
  12006. }
  12007.  
  12008. }
  12009.  
  12010. private void requestObject(int delay, int objectId, int faceIndex, int face, int y, int type, int heightLevel,
  12011. int x, int unknow2) {
  12012. Class30_Sub1 class30_sub1 = null;
  12013. for (Class30_Sub1 class30_sub1_1 = (Class30_Sub1) aClass19_1179
  12014. .reverseGetFirst(); class30_sub1_1 != null; class30_sub1_1 = (Class30_Sub1) aClass19_1179
  12015. .reverseGetNext()) {
  12016. if (class30_sub1_1.heightLevel != heightLevel || class30_sub1_1.x != x || class30_sub1_1.y != y
  12017. || class30_sub1_1.face != face)
  12018. continue;
  12019. class30_sub1 = class30_sub1_1;
  12020. break;
  12021. }
  12022.  
  12023. if (class30_sub1 == null) {
  12024. class30_sub1 = new Class30_Sub1();
  12025. class30_sub1.heightLevel = heightLevel;
  12026. class30_sub1.face = face;
  12027. class30_sub1.x = x;
  12028. class30_sub1.y = y;
  12029. method89(class30_sub1);
  12030. aClass19_1179.insertHead(class30_sub1);
  12031. }
  12032.  
  12033. class30_sub1.objectId = objectId;
  12034. class30_sub1.type = type;
  12035. class30_sub1.faceIndex = faceIndex;
  12036. class30_sub1.anInt1302 = unknow2;
  12037. class30_sub1.delay = delay;
  12038. }
  12039.  
  12040. private boolean interfaceIsSelected(RSInterface class9) {
  12041. if (class9.anIntArray245 == null)
  12042. return false;
  12043. for (int i = 0; i < class9.anIntArray245.length; i++) {
  12044. long j = extractInterfaceValues(class9, i);
  12045. int k = class9.anIntArray212[i];
  12046. if (class9.anIntArray245[i] == 2) {
  12047. if (j >= k)
  12048. return false;
  12049. } else if (class9.anIntArray245[i] == 3) {
  12050. if (j <= k)
  12051. return false;
  12052. } else if (class9.anIntArray245[i] == 4) {
  12053. if (j == k)
  12054. return false;
  12055. } else if (j != k)
  12056. return false;
  12057. }
  12058.  
  12059. return true;
  12060. }
  12061.  
  12062. private DataInputStream openJagGrabInputStream(String s) throws IOException {
  12063. // if(!aBoolean872)
  12064. // if(signlink.mainapp != null)
  12065. // return signlink.openurl(s);
  12066. // else
  12067. // return new DataInputStream((new URL(getCodeBase(), s)).openStream());
  12068. if (aSocket832 != null) {
  12069. try {
  12070. aSocket832.close();
  12071. } catch (Exception _ex) {
  12072. }
  12073. aSocket832 = null;
  12074. }
  12075. aSocket832 = openSocket(43595);
  12076. aSocket832.setSoTimeout(10000);
  12077. java.io.InputStream inputstream = aSocket832.getInputStream();
  12078. OutputStream outputstream = aSocket832.getOutputStream();
  12079. outputstream.write(("JAGGRAB /" + s + "\n\n").getBytes());
  12080. return new DataInputStream(inputstream);
  12081. }
  12082.  
  12083. /*
  12084. * private void doFlamesDrawing() { char c = '\u0100'; if (anInt1040 > 0) {
  12085. * for (int i = 0; i < 256; i++) if (anInt1040 > 768) anIntArray850[i] =
  12086. * method83(anIntArray851[i], anIntArray852[i], 1024 - anInt1040); else if
  12087. * (anInt1040 > 256) anIntArray850[i] = anIntArray852[i]; else
  12088. * anIntArray850[i] = method83(anIntArray852[i], anIntArray851[i], 256 -
  12089. * anInt1040);
  12090. *
  12091. * } else if (anInt1041 > 0) { for (int j = 0; j < 256; j++) if (anInt1041 >
  12092. * 768) anIntArray850[j] = method83(anIntArray851[j], anIntArray853[j], 1024
  12093. * - anInt1041); else if (anInt1041 > 256) anIntArray850[j] =
  12094. * anIntArray853[j]; else anIntArray850[j] = method83(anIntArray853[j],
  12095. * anIntArray851[j], 256 - anInt1041);
  12096. *
  12097. * } else { System.arraycopy(anIntArray851, 0, anIntArray850, 0, 256);
  12098. *
  12099. * } System.arraycopy(aClass30_Sub2_Sub1_Sub1_1201.myPixels, 0,
  12100. * aRSImageProducer_1110.canvasRaster, 0, 33920);
  12101. *
  12102. * int i1 = 0; int j1 = 1152; for (int k1 = 1; k1 < c - 1; k1++) { int l1 =
  12103. * (anIntArray969[k1] * (c - k1)) / c; int j2 = 22 + l1; if (j2 < 0) j2 = 0;
  12104. * i1 += j2; for (int l2 = j2; l2 < 128; l2++) { int j3 =
  12105. * anIntArray828[i1++]; if (j3 != 0) { int l3 = j3; int j4 = 256 - j3; j3 =
  12106. * anIntArray850[j3]; int l4 = aRSImageProducer_1110.canvasRaster[j1];
  12107. * aRSImageProducer_1110.canvasRaster[j1++] = ((j3 & 0xff00ff) * l3 + (l4 &
  12108. * 0xff00ff) * j4 & 0xff00ff00) + ((j3 & 0xff00) * l3 + (l4 & 0xff00) * j4 &
  12109. * 0xff0000) >> 8; } else { j1++; } }
  12110. *
  12111. * j1 += j2; }
  12112. *
  12113. * aRSImageProducer_1110.drawGraphics(0, super.graphics, 0);
  12114. * System.arraycopy(aClass30_Sub2_Sub1_Sub1_1202.myPixels, 0,
  12115. * aRSImageProducer_1111.canvasRaster, 0, 33920);
  12116. *
  12117. * i1 = 0; j1 = 1176; for (int k2 = 1; k2 < c - 1; k2++) { int i3 =
  12118. * (anIntArray969[k2] * (c - k2)) / c; int k3 = 103 - i3; j1 += i3; for (int
  12119. * i4 = 0; i4 < k3; i4++) { int k4 = anIntArray828[i1++]; if (k4 != 0) { int
  12120. * i5 = k4; int j5 = 256 - k4; k4 = anIntArray850[k4]; int k5 =
  12121. * aRSImageProducer_1111.canvasRaster[j1];
  12122. * aRSImageProducer_1111.canvasRaster[j1++] = ((k4 & 0xff00ff) * i5 + (k5 &
  12123. * 0xff00ff) * j5 & 0xff00ff00) + ((k4 & 0xff00) * i5 + (k5 & 0xff00) * j5 &
  12124. * 0xff0000) >> 8; } else { j1++; } }
  12125. *
  12126. * i1 += 128 - k3; j1 += 128 - k3 - i3; }
  12127. *
  12128. * aRSImageProducer_1111.drawGraphics(0, super.graphics, 637); }
  12129. */
  12130.  
  12131. private void method134(RSBuffer stream) {
  12132. int j = stream.readBits(8);
  12133. if (j < playerCount) {
  12134. for (int k = j; k < playerCount; k++)
  12135. anIntArray840[anInt839++] = playerIndices[k];
  12136.  
  12137. }
  12138. if (j > playerCount) {
  12139. Signlink.reporterror(myUsername + " Too many players");
  12140. throw new RuntimeException("eek");
  12141. }
  12142. playerCount = 0;
  12143. for (int l = 0; l < j; l++) {
  12144. int i1 = playerIndices[l];
  12145. Player player = playerArray[i1];
  12146. int j1 = stream.readBits(1);
  12147. if (j1 == 0) {
  12148. playerIndices[playerCount++] = i1;
  12149. player.anInt1537 = loopCycle;
  12150. } else {
  12151. int k1 = stream.readBits(2);
  12152. if (k1 == 0) {
  12153. playerIndices[playerCount++] = i1;
  12154. player.anInt1537 = loopCycle;
  12155. anIntArray894[anInt893++] = i1;
  12156. } else if (k1 == 1) {
  12157. playerIndices[playerCount++] = i1;
  12158. player.anInt1537 = loopCycle;
  12159. int l1 = stream.readBits(3);
  12160. player.moveInDir(false, l1);
  12161. int j2 = stream.readBits(1);
  12162. if (j2 == 1)
  12163. anIntArray894[anInt893++] = i1;
  12164. } else if (k1 == 2) {
  12165. playerIndices[playerCount++] = i1;
  12166. player.anInt1537 = loopCycle;
  12167. int i2 = stream.readBits(3);
  12168. player.moveInDir(true, i2);
  12169. int k2 = stream.readBits(3);
  12170. player.moveInDir(true, k2);
  12171. int l2 = stream.readBits(1);
  12172. if (l2 == 1)
  12173. anIntArray894[anInt893++] = i1;
  12174. } else if (k1 == 3)
  12175. anIntArray840[anInt839++] = i1;
  12176. }
  12177. }
  12178. }
  12179.  
  12180. public boolean inSprite(boolean Click, Sprite sprite, int xCoord, int yCoord) {
  12181. if (Click && super.clickMode3 != 1) {
  12182. return false;
  12183. }
  12184.  
  12185. return (Click ? saveClickX : mouseX) >= xCoord && (Click ? saveClickX : mouseX) <= xCoord + sprite.myWidth
  12186. && (Click ? saveClickY : mouseY) >= yCoord && (Click ? saveClickY : mouseY) <= yCoord + sprite.myHeight;
  12187. }
  12188.  
  12189. int titleAlpha;
  12190. int loginFade;
  12191. boolean shiftLogin;
  12192.  
  12193. private boolean rememberMe;
  12194.  
  12195. private void drawLogo() {
  12196. // logout
  12197. if (aRSImageProducer_1107 == null)
  12198. resetImageProducers();
  12199. Sprite sprite = new Sprite("login/0", this);
  12200. aRSImageProducer_1107.initDrawingArea();
  12201. sprite.drawAdvancedSprite(-100, 0);
  12202. aRSImageProducer_1108.initDrawingArea();
  12203. sprite.drawAdvancedSprite(-202, 0);
  12204. aRSImageProducer_1109.initDrawingArea();
  12205. sprite.drawAdvancedSprite(-202, -171);
  12206. aRSImageProducer_1110.initDrawingArea();
  12207. sprite.drawAdvancedSprite(0, 0);
  12208. aRSImageProducer_1111.initDrawingArea();
  12209. sprite.drawAdvancedSprite(-562, 0);
  12210. aRSImageProducer_1112.initDrawingArea();
  12211. sprite.drawAdvancedSprite(0, -265);
  12212. aRSImageProducer_1113.initDrawingArea();
  12213. sprite.drawAdvancedSprite(-562, 0);
  12214. aRSImageProducer_1114.initDrawingArea();
  12215. sprite.drawAdvancedSprite(-128, -171);
  12216. aRSImageProducer_1115.initDrawingArea();
  12217. sprite.drawAdvancedSprite(-562, -171);
  12218. }
  12219.  
  12220. private void drawLoginScreen(boolean flag) {
  12221. drawLogo();
  12222. resetImageProducers();
  12223. aRSImageProducer_1109.initDrawingArea();
  12224.  
  12225. if (aBackground_966 == null) {
  12226. aBackground_966 = new Background(titleStreamLoader, "titlebox", 0);
  12227. aBackground_967 = new Background(titleStreamLoader, "titlebutton", 0);
  12228. }
  12229. aBackground_966.method361(0, 0);
  12230.  
  12231. char c = '\u0168';
  12232. char c1 = '\310';
  12233. if (loginScreenState == 0) {
  12234. int i = c1 / 2 + 80;
  12235. smallText.method382(0x75a9a9, c / 2, onDemandFetcher.statusString, i, true);
  12236. i = c1 / 2 - 20;
  12237. boldText.method382(0xffff00, c / 2, "Welcome to Near-Reality", i, true);
  12238. i += 30;
  12239. int l = c / 2 - 80;
  12240. int k1 = c1 / 2 + 20;
  12241. aBackground_967.method361(l - 73, k1 - 20);
  12242. boldText.method382(0xffffff, l, "Info", k1 + 5, true);
  12243. l = c / 2 + 80;
  12244. aBackground_967.method361(l - 73, k1 - 20);
  12245. boldText.method382(0xffffff, l, "Logon", k1 + 5, true);
  12246. }
  12247. if (loginScreenState == 2) {
  12248. int i = c1 / 2 + 80;
  12249. smallText.method382(0x75a9a9, c / 2, onDemandFetcher.statusString, i, true);
  12250. int j = c1 / 2 - 40;
  12251. if (loginMessage1.length() > 0) {
  12252. boldText.method382(0xffff00, c / 2, loginMessage1, j - 15, true);
  12253. boldText.method382(0xffff00, c / 2, loginMessage2, j, true);
  12254. j += 30;
  12255. } else {
  12256. boldText.method382(0xffff00, c / 2, loginMessage2, j - 7, true);
  12257. j += 30;
  12258. }
  12259. w = (c / 2) - 38;
  12260. h = j - 15;
  12261.  
  12262. if (canEnterAuth) {
  12263. loginScreenCursorPos = 2;
  12264. loginMessage1 = "Authenticator";
  12265. loginMessage2 = "";
  12266. int height = h - 5;
  12267. boldText.method382(0xffffFF, w + 40, "Enter the 6-digit code generated by your", height, true);
  12268. boldText.method382(0xffffFF, w + 40, "authenticator app.", height + 15, true);
  12269. canEnterAuth = true;
  12270. // boldText.method389(true, c / 2 - 90, 0xffffff, "Username: " +
  12271. // TextClass.fixName(myUsername)
  12272. // + ((loginScreenCursorPos == 0) & (loopCycle % 40 < 20) ?
  12273. // "@yel@|" : ""), j);
  12274. j += 15;
  12275. boldText.method389(true, c / 2 - 109, 0xffffff, "PIN: " + TextClass.fixName(myAuth)
  12276. + ((loginScreenCursorPos == 2) & (loopCycle % 40 < 20) ? "@yel@|" : ""), j + 7);
  12277. boldText.method382(0xffffFF, w + 90, "@yel@Trust this computer", j, true);
  12278. boldText.method382(0xffffFF, w + 67, "@yel@for 30 days:", j + 15, true);
  12279.  
  12280. Sprite remember = null;
  12281.  
  12282. if (!rememberPin)
  12283. remember = new Sprite("login/remember_off");
  12284. else
  12285. remember = new Sprite("login/remember_on");
  12286. remember.drawSprite(w + 130, j + 5);
  12287.  
  12288. j += 15;
  12289. if (!flag) {
  12290. int i1 = c / 2 - 80;
  12291. int l1 = c1 / 2 + 50;
  12292. aBackground_967.method361(i1 - 73, l1 - 20);
  12293. boldText.method382(0xffffff, i1, "Continue", l1 + 5, true);
  12294. i1 = c / 2 + 80;
  12295. aBackground_967.method361(i1 - 73, l1 - 20);
  12296. boldText.method382(0xffffff, i1, "Cancel", l1 + 5, true);
  12297. }
  12298. } else {
  12299. w = (c / 2) + 5;
  12300. h = j - 15;
  12301. boldText.method382(0xffffFF, w, "World: @red@(" + currentWorld + ") " + getCurrentWorld().getName(), h,
  12302. true);
  12303.  
  12304. boldText.method389(true, c / 2 - 90, 0xffffff, "Username: " + TextClass.fixName(myUsername)
  12305. + ((loginScreenCursorPos == 0) & (loopCycle % 40 < 20) ? "@yel@|" : ""), j);
  12306. j += 15;
  12307. boldText.method389(true, c / 2 - 88, 0xffffff, "Password: " + TextClass.passwordAsterisks(myPassword)
  12308. + ((loginScreenCursorPos == 1) & (loopCycle % 40 < 20) ? "@yel@|" : ""), j);
  12309. j += 15;
  12310. if (!flag) {
  12311. int i1 = c / 2 - 80;
  12312. int l1 = c1 / 2 + 50;
  12313. aBackground_967.method361(i1 - 73, l1 - 20);
  12314. boldText.method382(0xffffff, i1, "Login", l1 + 5, true);
  12315. i1 = c / 2 + 80;
  12316. aBackground_967.method361(i1 - 73, l1 - 20);
  12317. boldText.method382(0xffffff, i1, "Select Next World?", l1 + 5, true);
  12318. }
  12319.  
  12320. regularText.drawRegularText(true, w - 70, 0xFFFFFF, "Remember Password?", h + 47);
  12321. if (ClientSettings.getBoolean("remember_me")) {
  12322. DrawingArea.drawDiagonalLine(w - 80, h + 49, w - 94, h + 35, 0xFFFF00);
  12323. DrawingArea.drawDiagonalLine(w - 80, h + 35, w - 94, h + 49, 0xFFFF00);
  12324. }
  12325. DrawingArea.drawRectangle(w - 94, h + 35, 15, 15, 0xFFFFFF, 255);
  12326. }
  12327. }
  12328.  
  12329. if (loginScreenState == 3) {
  12330. boldText.method382(0xffff00, c / 2, "Create a free account", c1 / 2 - 60, true);
  12331. int k = c1 / 2 - 35;
  12332. boldText.method382(0xffffff, c / 2, "To create a new account you need to", k, true);
  12333. k += 15;
  12334. boldText.method382(0xffffff, c / 2, "enter a username and password that", k, true);
  12335. k += 15;
  12336. boldText.method382(0xffffff, c / 2, "you wish to use.", k, true);
  12337. k += 15;
  12338. boldText.method382(0xffffff, c / 2, "Forums: http://near-reality.org", k, true);
  12339. k += 15;
  12340. int j1 = c / 2;
  12341. int i2 = c1 / 2 + 50;
  12342. aBackground_967.method361(j1 - 73, i2 - 20);
  12343. boldText.method382(0xffffff, j1, "Cancel", i2 + 5, true);
  12344. }
  12345. aRSImageProducer_1107.drawGraphics(0, super.graphics, 100);
  12346. aRSImageProducer_1108.drawGraphics(0, super.graphics, 202);
  12347. aRSImageProducer_1109.drawGraphics(171, super.graphics, 202);
  12348. aRSImageProducer_1110.drawGraphics(0, super.graphics, 0);
  12349. aRSImageProducer_1111.drawGraphics(0, super.graphics, 562);
  12350. aRSImageProducer_1112.drawGraphics(265, super.graphics, 0);
  12351. aRSImageProducer_1113.drawGraphics(0, super.graphics, 562);
  12352. aRSImageProducer_1114.drawGraphics(171, super.graphics, 128);
  12353. aRSImageProducer_1115.drawGraphics(171, super.graphics, 562);
  12354. if (welcomeScreenRaised) {
  12355. welcomeScreenRaised = false;
  12356. }
  12357.  
  12358. }
  12359.  
  12360. int w = 0;
  12361. int h = 0;
  12362. private int currentWorld;
  12363.  
  12364. private void drawLoginScreenOld(boolean flag) {
  12365. resetImageProducers();
  12366. aRSImageProducer_1109.initDrawingArea();
  12367. DrawingArea.drawFilledPixels(0, 0, 765, 503, 0x000000);
  12368.  
  12369. int centerX = 765 / 2;
  12370. int centerY = 503 / 2;
  12371. // titleAlpha = 0;
  12372. titleAlpha += titleAlpha < 250 ? 8 : 0;
  12373. /*
  12374. * if (Constants.DISPLAY_GAMEWORLD_ON_LOGIN) {
  12375. * drawAnimatedWorldBackground(true); } else {
  12376. */
  12377. if (titleAlpha < 250) {
  12378. loginSprites[0].drawTransparentSprite(centerX - loginSprites[0].myWidth / 2,
  12379. centerY - loginSprites[0].myHeight / 2, titleAlpha);
  12380. } else {
  12381. loginSprites[0].drawAdvancedSprite(centerX - loginSprites[0].myWidth / 2,
  12382. centerY - loginSprites[0].myHeight / 2);
  12383. }
  12384. // }
  12385. if (titleAlpha >= 240) {
  12386. aBackground_966 = new Background(titleStreamLoader, "titlebox", 0);
  12387. aBackground_967 = new Background(titleStreamLoader, "titlebutton", 0);
  12388. aBackground_966.method361(0, 0);
  12389.  
  12390. char c = '\u0168';
  12391. char c1 = '\310';
  12392. if (loginScreenState == 0) {
  12393. int i = c1 / 2 + 80;
  12394. smallText.method382(0x75a9a9, c / 2, onDemandFetcher.statusString, i, true);
  12395. i = c1 / 2 - 20;
  12396. boldText.method382(0xffff00, c / 2, "Welcome to Near-Reality", i, true);
  12397. i += 30;
  12398. int l = c / 2 - 80;
  12399. int k1 = c1 / 2 + 20;
  12400. aBackground_967.method361(l - 73, k1 - 20);
  12401. boldText.method382(0xffffff, l, "Info", k1 + 5, true);
  12402. l = c / 2 + 80;
  12403. aBackground_967.method361(l - 73, k1 - 20);
  12404. boldText.method382(0xffffff, l, "Logon", k1 + 5, true);
  12405. }
  12406. if (loginScreenState == 2) {
  12407. int i = c1 / 2 + 80;
  12408. smallText.method382(0x75a9a9, c / 2, onDemandFetcher.statusString, i, true);
  12409. int j = c1 / 2 - 40;
  12410. if (loginMessage1.length() > 0) {
  12411. boldText.method382(0xffff00, c / 2, loginMessage1, j - 15, true);
  12412. boldText.method382(0xffff00, c / 2, loginMessage2, j, true);
  12413. j += 30;
  12414. } else {
  12415. boldText.method382(0xffff00, c / 2, loginMessage2, j - 7, true);
  12416. j += 30;
  12417. }
  12418. w = (c / 2) - 38;
  12419. h = j - 15;
  12420. switch (currentWorld) {
  12421. case 1:
  12422. w = (c / 2) + 5;
  12423. h = j - 15;
  12424. boldText.method382(0xffffFF, w, "World: @red@(1) World 1", h, true);
  12425. break;
  12426. case 2:
  12427. w = (c / 2) + 5;
  12428. h = j - 15;
  12429. boldText.method382(0xffffFF, w, "World: @red@(2) World 2", h, true);
  12430. break;
  12431.  
  12432. }
  12433. boldText.method389(true, c / 2 - 90, 0xffffff, "Username: " + TextClass.fixName(myUsername)
  12434. + ((loginScreenCursorPos == 0) & (loopCycle % 40 < 20) ? "@yel@|" : ""), j);
  12435. j += 15;
  12436. boldText.method389(true, c / 2 - 88, 0xffffff, "Password: " + TextClass.passwordAsterisks(myPassword)
  12437. + ((loginScreenCursorPos == 1) & (loopCycle % 40 < 20) ? "@yel@|" : ""), j);
  12438. j += 15;
  12439. if (!flag) {
  12440. int i1 = c / 2 - 80;
  12441. int l1 = c1 / 2 + 50;
  12442. aBackground_967.method361(i1 - 73, l1 - 20);
  12443. boldText.method382(0xffffff, i1, "Login", l1 + 5, true);
  12444. i1 = c / 2 + 80;
  12445. aBackground_967.method361(i1 - 73, l1 - 20);
  12446. boldText.method382(0xffffff, i1, "Select Next World?", l1 + 5, true);
  12447. }
  12448. }
  12449. if (loginScreenState == 3) {
  12450. boldText.method382(0xffff00, c / 2, "Create a free account", c1 / 2 - 60, true);
  12451. int k = c1 / 2 - 35;
  12452. boldText.method382(0xffffff, c / 2, "To create a new account you need to", k, true);
  12453. k += 15;
  12454. boldText.method382(0xffffff, c / 2, "enter a username and password that", k, true);
  12455. k += 15;
  12456. boldText.method382(0xffffff, c / 2, "you wish to use.", k, true);
  12457. k += 15;
  12458. boldText.method382(0xffffff, c / 2, "Forums: http://near-reality.org", k, true);
  12459. k += 15;
  12460. int j1 = c / 2;
  12461. int i2 = c1 / 2 + 50;
  12462. aBackground_967.method361(j1 - 73, i2 - 20);
  12463. boldText.method382(0xffffff, j1, "Cancel", i2 + 5, true);
  12464. }
  12465. aRSImageProducer_1109.drawGraphics(171, super.graphics, 202);
  12466. if (welcomeScreenRaised) {
  12467. welcomeScreenRaised = false;
  12468. }
  12469. }
  12470. }
  12471.  
  12472. /*
  12473. * private void drawFlames() { drawingFlames = true; try { long l =
  12474. * System.currentTimeMillis(); int i = 0; int j = 20; while (aBoolean831) {
  12475. * calcFlamesPosition(); calcFlamesPosition(); doFlamesDrawing(); if (++i >
  12476. * 10) { long l1 = System.currentTimeMillis(); int k = (int) (l1 - l) / 10 -
  12477. * j; j = 40 - k; if (j < 5) j = 5; i = 0; l = l1; } try { Thread.sleep(j);
  12478. * } catch (Exception _ex) { } } } catch (Exception _ex) { } drawingFlames =
  12479. * false; }
  12480. */
  12481.  
  12482. public void raiseWelcomeScreen() {
  12483. welcomeScreenRaised = true;
  12484. }
  12485.  
  12486. private void method137(RSBuffer stream, int j) {
  12487. if (j == 84) {
  12488. int k = stream.readUnsignedByte();
  12489. int j3 = anInt1268 + (k >> 4 & 7);
  12490. int i6 = anInt1269 + (k & 7);
  12491. int l8 = stream.readUnsignedWord();
  12492. int k11 = stream.readUnsignedWord();
  12493. int l13 = stream.readUnsignedWord();
  12494. if (j3 >= 0 && i6 >= 0 && j3 < 104 && i6 < 104) {
  12495. NodeList class19_1 = groundArray[plane][j3][i6];
  12496. if (class19_1 != null) {
  12497. for (Item class30_sub2_sub4_sub2_3 = (Item) class19_1
  12498. .reverseGetFirst(); class30_sub2_sub4_sub2_3 != null; class30_sub2_sub4_sub2_3 = (Item) class19_1
  12499. .reverseGetNext()) {
  12500. if (class30_sub2_sub4_sub2_3.ID != (l8 & 0x7fff) || class30_sub2_sub4_sub2_3.itemAmount != k11)
  12501. continue;
  12502. class30_sub2_sub4_sub2_3.itemAmount = l13;
  12503. break;
  12504. }
  12505.  
  12506. spawnGroundItem(j3, i6);
  12507. }
  12508. }
  12509. return;
  12510. }
  12511. if (j == 105) {
  12512. int l = stream.readUnsignedByte();
  12513. int k3 = anInt1268 + (l >> 4 & 7);
  12514. int j6 = anInt1269 + (l & 7);
  12515. int i9 = stream.readUnsignedWord();
  12516. int l11 = stream.readUnsignedByte();
  12517. int i14 = l11 >> 4 & 0xf;
  12518. int i16 = l11 & 7;
  12519. if (myPlayer.smallX[0] >= k3 - i14 && myPlayer.smallX[0] <= k3 + i14 && myPlayer.smallY[0] >= j6 - i14
  12520. && myPlayer.smallY[0] <= j6 + i14 && aBoolean848 && !lowMem && anInt1062 < 50) {
  12521. anIntArray1207[anInt1062] = i9;
  12522. anIntArray1241[anInt1062] = i16;
  12523. anIntArray1250[anInt1062] = Sounds.anIntArray326[i9];
  12524. anInt1062++;
  12525. }
  12526. }
  12527. if (j == 215) {
  12528. int i1 = stream.method435();
  12529. int l3 = stream.method428();
  12530. int k6 = anInt1268 + (l3 >> 4 & 7);
  12531. int j9 = anInt1269 + (l3 & 7);
  12532. int i12 = stream.method435();
  12533. int j14 = stream.readUnsignedWord();
  12534. if (k6 >= 0 && j9 >= 0 && k6 < 104 && j9 < 104 && i12 != unknownInt10) {
  12535. Item class30_sub2_sub4_sub2_2 = new Item();
  12536. class30_sub2_sub4_sub2_2.ID = i1;
  12537. class30_sub2_sub4_sub2_2.itemAmount = j14;
  12538. if (groundArray[plane][k6][j9] == null)
  12539. groundArray[plane][k6][j9] = new NodeList();
  12540. groundArray[plane][k6][j9].insertHead(class30_sub2_sub4_sub2_2);
  12541. spawnGroundItem(k6, j9);
  12542. }
  12543. return;
  12544. }
  12545. if (j == 156) {
  12546. int j1 = stream.method426();
  12547. int i4 = anInt1268 + (j1 >> 4 & 7);
  12548. int l6 = anInt1269 + (j1 & 7);
  12549. int k9 = stream.readDWord();
  12550. if (i4 >= 0 && l6 >= 0 && i4 < 104 && l6 < 104) {
  12551. NodeList class19 = groundArray[plane][i4][l6];
  12552. if (class19 != null) {
  12553. for (Item item = (Item) class19.reverseGetFirst(); item != null; item = (Item) class19
  12554. .reverseGetNext()) {
  12555. if (item.ID != k9/* (k9 & 0x7fff) */)/// XXX: changed to
  12556. /// fix osrs
  12557. /// items not
  12558. /// dissapearing
  12559. continue;
  12560.  
  12561. item.unlink();
  12562. break;
  12563. }
  12564.  
  12565. if (class19.reverseGetFirst() == null)
  12566. groundArray[plane][i4][l6] = null;
  12567.  
  12568. spawnGroundItem(i4, l6);
  12569. }
  12570. }
  12571. return;
  12572. }
  12573. if (j == 160) {
  12574. int k1 = stream.method428();
  12575. int j4 = anInt1268 + (k1 >> 4 & 7);
  12576. int i7 = anInt1269 + (k1 & 7);
  12577. int l9 = stream.method428();
  12578. int j12 = l9 >> 2;
  12579. int k14 = l9 & 3;
  12580. int j16 = anIntArray1177[j12];
  12581. int j17 = stream.method435();
  12582. if (j4 >= 0 && i7 >= 0 && j4 < 103 && i7 < 103) {
  12583. int j18 = intGroundArray[plane][j4][i7];
  12584. int i19 = intGroundArray[plane][j4 + 1][i7];
  12585. int l19 = intGroundArray[plane][j4 + 1][i7 + 1];
  12586. int k20 = intGroundArray[plane][j4][i7 + 1];
  12587. if (j16 == 0) {
  12588. Object1 class10 = worldController.method296(plane, j4, i7);
  12589. if (class10 != null) {
  12590. int k21 = class10.uid >> 14 & 0x7fff;
  12591. if (j12 == 2) {
  12592. class10.aClass30_Sub2_Sub4_278 = new Animable_Sub5(k21, 4 + k14, 2, i19, l19, j18, k20, j17,
  12593. false);
  12594. class10.aClass30_Sub2_Sub4_279 = new Animable_Sub5(k21, k14 + 1 & 3, 2, i19, l19, j18, k20,
  12595. j17, false);
  12596. } else {
  12597. class10.aClass30_Sub2_Sub4_278 = new Animable_Sub5(k21, k14, j12, i19, l19, j18, k20, j17,
  12598. false);
  12599. }
  12600. }
  12601. }
  12602. if (j16 == 1) {
  12603. Object2 class26 = worldController.method297(j4, i7, plane);
  12604. if (class26 != null)
  12605. class26.aClass30_Sub2_Sub4_504 = new Animable_Sub5(class26.uid >> 14 & 0x7fff, 0, 4, i19, l19,
  12606. j18, k20, j17, false);
  12607. }
  12608. if (j16 == 2) {
  12609. Object5 class28 = worldController.method298(j4, i7, plane);
  12610. if (j12 == 11)
  12611. j12 = 10;
  12612. if (class28 != null)
  12613. class28.aClass30_Sub2_Sub4_521 = new Animable_Sub5(class28.uid >> 14 & 0x7fff, k14, j12, i19,
  12614. l19, j18, k20, j17, false);
  12615. }
  12616. if (j16 == 3) {
  12617. Object3 class49 = worldController.method299(i7, j4, plane);
  12618. if (class49 != null)
  12619. class49.aClass30_Sub2_Sub4_814 = new Animable_Sub5(class49.uid >> 14 & 0x7fff, k14, 22, i19,
  12620. l19, j18, k20, j17, false);
  12621. }
  12622. }
  12623. return;
  12624. }
  12625. if (j == 147) {
  12626. int l1 = stream.method428();
  12627. int k4 = anInt1268 + (l1 >> 4 & 7);
  12628. int j7 = anInt1269 + (l1 & 7);
  12629. int i10 = stream.readUnsignedWord();
  12630. byte byte0 = stream.method430();
  12631. int l14 = stream.method434();
  12632. byte byte1 = stream.method429();
  12633. int k17 = stream.readUnsignedWord();
  12634. int k18 = stream.method428();
  12635. int j19 = k18 >> 2;
  12636. int i20 = k18 & 3;
  12637. int l20 = anIntArray1177[j19];
  12638. byte byte2 = stream.readSignedByte();
  12639. int l21 = stream.readUnsignedWord();
  12640. byte byte3 = stream.method429();
  12641. Player player;
  12642. if (i10 == unknownInt10)
  12643. player = myPlayer;
  12644. else
  12645. player = playerArray[i10];
  12646. if (player != null) {
  12647. ObjectDefinition class46 = ObjectDefinition.forID(l21);
  12648. int i22 = intGroundArray[plane][k4][j7];
  12649. int j22 = intGroundArray[plane][k4 + 1][j7];
  12650. int k22 = intGroundArray[plane][k4 + 1][j7 + 1];
  12651. int l22 = intGroundArray[plane][k4][j7 + 1];
  12652. Model model = class46.method578(j19, i20, i22, j22, k22, l22, -1);
  12653. if (model != null) {
  12654. requestObject(k17 + 1, -1, 0, l20, j7, 0, plane, k4, l14 + 1);
  12655. player.anInt1707 = l14 + loopCycle;
  12656. player.anInt1708 = k17 + loopCycle;
  12657. player.aModel_1714 = model;
  12658. int i23 = class46.anInt744;
  12659. int j23 = class46.anInt761;
  12660. if (i20 == 1 || i20 == 3) {
  12661. i23 = class46.anInt761;
  12662. j23 = class46.anInt744;
  12663. }
  12664. player.anInt1711 = k4 * 128 + i23 * 64;
  12665. player.anInt1713 = j7 * 128 + j23 * 64;
  12666. player.anInt1712 = method42(plane, player.anInt1713, player.anInt1711);
  12667. if (byte2 > byte0) {
  12668. byte byte4 = byte2;
  12669. byte2 = byte0;
  12670. byte0 = byte4;
  12671. }
  12672. if (byte3 > byte1) {
  12673. byte byte5 = byte3;
  12674. byte3 = byte1;
  12675. byte1 = byte5;
  12676. }
  12677. player.anInt1719 = k4 + byte2;
  12678. player.anInt1721 = k4 + byte0;
  12679. player.anInt1720 = j7 + byte3;
  12680. player.anInt1722 = j7 + byte1;
  12681. }
  12682. }
  12683. }
  12684. if (j == 151) {
  12685. int heightLevel = stream.method426();
  12686. int x = anInt1268;
  12687. int y = anInt1269;
  12688. int id = stream.readDWord();
  12689. int faceTypeMask = stream.method428();
  12690. int type = faceTypeMask >> 2;
  12691. int faceIndex = faceTypeMask & 3;
  12692. int face = anIntArray1177[type];
  12693. if (x >= 0 && y >= 0 && x < 104 && y < 104)
  12694. requestObject(-1, id, faceIndex, face, y, type, heightLevel, x, 0);
  12695. return;
  12696. }
  12697. if (j == 4) {
  12698. int j2 = stream.readUnsignedByte();
  12699. int i5 = anInt1268 + (j2 >> 4 & 7);
  12700. int l7 = anInt1269 + (j2 & 7);
  12701. int k10 = stream.readUnsignedWord();
  12702. int l12 = stream.readUnsignedByte();
  12703. int j15 = stream.readUnsignedWord();
  12704. if (i5 >= 0 && l7 >= 0 && i5 < 104 && l7 < 104) {
  12705. i5 = i5 * 128 + 64;
  12706. l7 = l7 * 128 + 64;
  12707. Animable_Sub3 class30_sub2_sub4_sub3 = new Animable_Sub3(plane, loopCycle, j15, k10,
  12708. method42(plane, l7, i5) - l12, l7, i5);
  12709. aClass19_1056.insertHead(class30_sub2_sub4_sub3);
  12710. }
  12711. return;
  12712. }
  12713. if (j == 44) {
  12714. int k2 = stream.method436();
  12715. int j5 = stream.readUnsignedWord();
  12716. int i8 = stream.readUnsignedByte();
  12717. int l10 = anInt1268 + (i8 >> 4 & 7);
  12718. int i13 = anInt1269 + (i8 & 7);
  12719. if (l10 >= 0 && i13 >= 0 && l10 < 104 && i13 < 104) {
  12720. Item class30_sub2_sub4_sub2_1 = new Item();
  12721. class30_sub2_sub4_sub2_1.ID = k2;
  12722. class30_sub2_sub4_sub2_1.itemAmount = j5;
  12723. if (groundArray[plane][l10][i13] == null)
  12724. groundArray[plane][l10][i13] = new NodeList();
  12725. groundArray[plane][l10][i13].insertHead(class30_sub2_sub4_sub2_1);
  12726. spawnGroundItem(l10, i13);
  12727. }
  12728. return;
  12729. }
  12730. if (j == 101) {
  12731. int l2 = stream.method427();
  12732. int k5 = l2 >> 2;
  12733. int j8 = l2 & 3;
  12734. int i11 = anIntArray1177[k5];
  12735. int j13 = stream.readUnsignedByte();
  12736. int k15 = anInt1268 + (j13 >> 4 & 7);
  12737. int l16 = anInt1269 + (j13 & 7);
  12738. if (k15 >= 0 && l16 >= 0 && k15 < 104 && l16 < 104)
  12739. requestObject(-1, -1, j8, i11, l16, k5, plane, k15, 0);
  12740. return;
  12741. }
  12742. if (j == 117) {
  12743. int i3 = stream.readUnsignedByte();
  12744. int l5 = anInt1268 + (i3 >> 4 & 7);
  12745. int k8 = anInt1269 + (i3 & 7);
  12746. int j11 = l5 + stream.readSignedByte();
  12747. int k13 = k8 + stream.readSignedByte();
  12748. int l15 = stream.readSignedWord();
  12749. int i17 = stream.readUnsignedWord();
  12750. int i18 = stream.readUnsignedByte() * 4;
  12751. int l18 = stream.readUnsignedByte() * 4;
  12752. int k19 = stream.readUnsignedWord();
  12753. int j20 = stream.readUnsignedWord();
  12754. int i21 = stream.readUnsignedByte();
  12755. int j21 = stream.readUnsignedByte();
  12756. if (l5 >= 0 && k8 >= 0 && l5 < 104 && k8 < 104 && j11 >= 0 && k13 >= 0 && j11 < 104 && k13 < 104
  12757. && i17 != 65535) {
  12758. l5 = l5 * 128 + 64;
  12759. k8 = k8 * 128 + 64;
  12760. j11 = j11 * 128 + 64;
  12761. k13 = k13 * 128 + 64;
  12762. Animable_Sub4 class30_sub2_sub4_sub4 = new Animable_Sub4(i21, l18, k19 + loopCycle, j20 + loopCycle,
  12763. j21, plane, method42(plane, k8, l5) - i18, k8, l5, l15, i17);
  12764. class30_sub2_sub4_sub4.method455(k19 + loopCycle, k13, method42(plane, k13, j11) - l18, j11);
  12765. aClass19_1013.insertHead(class30_sub2_sub4_sub4);
  12766. }
  12767. }
  12768. }
  12769.  
  12770. private void method139(RSBuffer stream) {
  12771. stream.initBitAccess();
  12772. int k = stream.readBits(8);
  12773. if (k < npcCount) {
  12774. for (int l = k; l < npcCount; l++)
  12775. anIntArray840[anInt839++] = npcIndices[l];
  12776.  
  12777. }
  12778. if (k > npcCount) {
  12779. Signlink.reporterror(myUsername + " Too many npcs");
  12780. throw new RuntimeException("eek");
  12781. }
  12782. npcCount = 0;
  12783. for (int i1 = 0; i1 < k; i1++) {
  12784. int j1 = npcIndices[i1];
  12785. Npc npc = npcArray[j1];
  12786. int k1 = stream.readBits(1);
  12787. if (k1 == 0) {
  12788. npcIndices[npcCount++] = j1;
  12789. npc.anInt1537 = loopCycle;
  12790. } else {
  12791. int l1 = stream.readBits(2);
  12792. if (l1 == 0) {
  12793. npcIndices[npcCount++] = j1;
  12794. npc.anInt1537 = loopCycle;
  12795. anIntArray894[anInt893++] = j1;
  12796. } else if (l1 == 1) {
  12797. npcIndices[npcCount++] = j1;
  12798. npc.anInt1537 = loopCycle;
  12799. int i2 = stream.readBits(3);
  12800. npc.moveInDir(false, i2);
  12801. int k2 = stream.readBits(1);
  12802. if (k2 == 1)
  12803. anIntArray894[anInt893++] = j1;
  12804. } else if (l1 == 2) {
  12805. npcIndices[npcCount++] = j1;
  12806. npc.anInt1537 = loopCycle;
  12807. int j2 = stream.readBits(3);
  12808. npc.moveInDir(true, j2);
  12809. int l2 = stream.readBits(3);
  12810. npc.moveInDir(true, l2);
  12811. int i3 = stream.readBits(1);
  12812. if (i3 == 1)
  12813. anIntArray894[anInt893++] = j1;
  12814. } else if (l1 == 3)
  12815. anIntArray840[anInt839++] = j1;
  12816. }
  12817. }
  12818.  
  12819. }
  12820.  
  12821. private void processLoginScreenInput() {
  12822. if (loginScreenState == 0) {
  12823. int i = super.myWidth / 2 - 80;
  12824. int l = super.myHeight / 2 + 20;
  12825. l += 20;
  12826. if (super.clickMode3 == 1 && super.saveClickX >= i - 75 && super.saveClickX <= i + 75
  12827. && super.saveClickY >= l - 20 && super.saveClickY <= l + 20) {
  12828. loginScreenState = 3;
  12829. loginScreenCursorPos = 0;
  12830. }
  12831. i = super.myWidth / 2 + 80;
  12832. if (super.clickMode3 == 1 && super.saveClickX >= i - 75 && super.saveClickX <= i + 75
  12833. && super.saveClickY >= l - 20 && super.saveClickY <= l + 20) {
  12834. loginMessage1 = "";
  12835. loginMessage2 = "Enter your username & password.";
  12836. loginScreenState = 2;
  12837. loginScreenCursorPos = 0;
  12838. }
  12839. } else {
  12840. if (loginScreenState == 2) {
  12841. int j = super.myHeight / 2 - 40;
  12842. j += 30;
  12843. j += 25;
  12844. if (super.clickMode3 == 1 && super.saveClickY >= j - 15 && super.saveClickY < j)
  12845. loginScreenCursorPos = 0;
  12846. j += 15;
  12847. if (super.clickMode3 == 1 && super.saveClickY >= j - 15 && super.saveClickY < j)
  12848. loginScreenCursorPos = 1;
  12849. j += 15;
  12850. int i1 = super.myWidth / 2 - 80;
  12851. int k1 = super.myHeight / 2 + 50;
  12852. k1 += 20;
  12853. char c = '\u0168';
  12854. w = (c / 2) + 5;
  12855. h = j - 15;
  12856. if (super.clickMode3 == 1 && super.saveClickX <= 307 && super.saveClickX >= 292 && super.saveClickY >= 283 && super.saveClickY <= 298) {
  12857. ClientSettings.set("remember_me", !ClientSettings.getBoolean("remember_me"));
  12858. ClientSettings.save();
  12859. super.clickMode3 = 0;
  12860. }
  12861. if (super.clickMode3 == 1 && super.saveClickX >= i1 - 75 && super.saveClickX <= i1 + 75
  12862. && super.saveClickY >= k1 - 20 && super.saveClickY <= k1 + 20) {
  12863. if (myUsername.length() == 0) {
  12864. loginMessage1 = "Enter a username";
  12865. if (myPassword.length() == 0)
  12866. loginMessage1 = loginMessage1 + " & password";
  12867. loginMessage1 = loginMessage1 + "!";
  12868. loginMessage2 = "";
  12869. return;
  12870. }
  12871. if (myPassword.length() == 0) {
  12872. loginMessage1 = "Enter a password!";
  12873. loginMessage2 = "";
  12874. return;
  12875. }
  12876. if (myPassword.length() < 5) {
  12877. loginMessage1 = "Your password is too weak.";
  12878. loginMessage2 = "";
  12879. return;
  12880. }
  12881. loginFailures = 0;
  12882. login(myUsername, myPassword, myAuth, rememberPin, false);
  12883. if (loggedIn)
  12884. return;
  12885. }
  12886. if (canEnterAuth) {
  12887. // 272 1055
  12888. if (super.clickMode3 == 1 && super.saveClickX >= 475 && super.saveClickX <= 487
  12889. && super.saveClickY >= 281 && super.saveClickY <= 292) {
  12890. rememberPin = !rememberPin;
  12891.  
  12892. }
  12893. }
  12894.  
  12895. i1 = super.myWidth / 2 + 80;
  12896. if (super.clickMode3 == 1 && super.saveClickX >= i1 - 75 && super.saveClickX <= i1 + 75
  12897. && super.saveClickY >= k1 - 20 && super.saveClickY <= k1 + 20) {
  12898.  
  12899. if (canEnterAuth) {
  12900. canEnterAuth = false;
  12901. loginMessage1 = "";
  12902. loginMessage2 = "Enter your username & password.";
  12903. loginScreenState = 2;
  12904. loginScreenCursorPos = 0;
  12905. } else {
  12906. currentWorld++;
  12907. if (currentWorld > Configuration.WORLDS.size()) {
  12908. currentWorld = 1;
  12909. }
  12910. }
  12911. drawLoginScreen(true);
  12912. }
  12913. do {
  12914. int l1 = readChar(-796);
  12915. if (l1 == -1)
  12916. break;
  12917. boolean flag1 = false;
  12918. for (int i2 = 0; i2 < validUserPassChars.length(); i2++) {
  12919. if (l1 != validUserPassChars.charAt(i2))
  12920. continue;
  12921. flag1 = true;
  12922. break;
  12923. }
  12924.  
  12925. if (loginScreenCursorPos == 0) {
  12926. if (l1 == 8 && myUsername.length() > 0)
  12927. myUsername = myUsername.substring(0, myUsername.length() - 1);
  12928. if (l1 == 9 || l1 == 10 || l1 == 13)
  12929. loginScreenCursorPos = 1;
  12930. if (flag1)
  12931. myUsername += (char) l1;
  12932. if (myUsername.length() > 12)
  12933. myUsername = myUsername.substring(0, 12);
  12934. } else if (loginScreenCursorPos == 1) {
  12935. if (l1 == 8 && myPassword.length() > 0)
  12936. myPassword = myPassword.substring(0, myPassword.length() - 1);
  12937. if (l1 == 9 || l1 == 10 || l1 == 13)
  12938. loginScreenCursorPos = 0;
  12939. if (flag1)
  12940. myPassword += (char) l1;
  12941. if (myPassword.length() > 20)
  12942. myPassword = myPassword.substring(0, 20);
  12943. } else if (loginScreenCursorPos == 2) {
  12944.  
  12945. if (l1 == 8 && myAuth.length() > 0)
  12946. myAuth = myAuth.substring(0, myAuth.length() - 1);
  12947. if (l1 == 9 || l1 == 13)
  12948. loginScreenCursorPos = 0;
  12949. if (l1 == 10) {
  12950. loginFailures = 0;
  12951. login(myUsername, myPassword, myAuth, rememberPin, false);
  12952. if (loggedIn)
  12953. return;
  12954. }
  12955. if (flag1) {
  12956. char input = (char) l1;
  12957. if (!Character.isDigit(input))
  12958. return;
  12959. if (myAuth.length() > 5)
  12960. return;
  12961. myAuth += input;
  12962.  
  12963. }
  12964. if (myAuth.length() > 20)
  12965. myAuth = myAuth.substring(0, 20);
  12966. }
  12967.  
  12968. } while (true);
  12969. return;
  12970. }
  12971. if (loginScreenState == 3) {
  12972. int k = super.myWidth / 2;
  12973. int j1 = super.myHeight / 2 + 50;
  12974. j1 += 20;
  12975. if (super.clickMode3 == 1 && super.saveClickX >= k - 75 && super.saveClickX <= k + 75
  12976. && super.saveClickY >= j1 - 20 && super.saveClickY <= j1 + 20)
  12977. loginScreenState = 0;
  12978. }
  12979. }
  12980. }
  12981.  
  12982. private void processLoginScreenInputOld() {
  12983. /*
  12984. * if (loginScreenState == 0) { int i = super.myWidth / 2 - 80; int l =
  12985. * super.myHeight / 2 + 20; l += 20; if (super.clickMode3 == 1 &&
  12986. * super.saveClickX >= i - 75 && super.saveClickX <= i + 75 &&
  12987. * super.saveClickY >= l - 20 && super.saveClickY <= l + 20) {
  12988. * loginScreenState = 3; loginScreenCursorPos = 0; } i = super.myWidth /
  12989. * 2 + 80; if (super.clickMode3 == 1 && super.saveClickX >= i - 75 &&
  12990. * super.saveClickX <= i + 75 && super.saveClickY >= l - 20 &&
  12991. * super.saveClickY <= l + 20) { loginMessage1 = ""; loginMessage2 =
  12992. * "Enter your username & password."; loginScreenState = 2;
  12993. * loginScreenCursorPos = 0; } } else {
  12994. */
  12995.  
  12996. int centerX = 765 / 2;
  12997. int centerY = 503 / 2;
  12998. int boxX = centerX - loginSprites[2].myWidth / 2;
  12999. int boxY = centerY - loginSprites[2].myHeight / 2 + 50;
  13000.  
  13001. // if (loginScreenState == 2) {
  13002. if (loginSprites[3].clicked(boxX + 57, boxY + 43, 0, 0)) {
  13003. loginScreenCursorPos = 0;
  13004. }
  13005.  
  13006. if (loginSprites[3].clicked(boxX + 57, boxY + 114, 0, 0)) {
  13007. loginScreenCursorPos = 1;
  13008. }
  13009.  
  13010. if (canEnterAuth) {
  13011. if (loginSprites[3].clicked(boxX + 57, boxY + 274, 0, 0)) {
  13012. loginScreenCursorPos = 2;
  13013. }
  13014. }
  13015.  
  13016. if (loginSprites[6].clicked(boxX + 78, boxY + 207, 0, 0)) {
  13017. if (myPassword.length() < 5) {
  13018. loginMessage1 = "Your password is too weak.";
  13019. } else {
  13020. loginFailures = 0;
  13021. login(myUsername, myPassword, myAuth, rememberPin, false);
  13022. if (loggedIn)
  13023. return;
  13024. }
  13025. }
  13026.  
  13027. do {
  13028. int l1 = readChar(-796);
  13029. if (l1 == -1)
  13030. break;
  13031. boolean flag1 = false;
  13032. for (int i2 = 0; i2 < validUserPassChars.length(); i2++) {
  13033. if (l1 != validUserPassChars.charAt(i2))
  13034. continue;
  13035. flag1 = true;
  13036. break;
  13037. }
  13038.  
  13039. if (loginScreenCursorPos == 0) {
  13040. if (l1 == 8 && myUsername.length() > 0)
  13041. myUsername = myUsername.substring(0, myUsername.length() - 1);
  13042. if (l1 == 9 || l1 == 10 || l1 == 13)
  13043. loginScreenCursorPos = 1;
  13044. if (flag1)
  13045. myUsername += (char) l1;
  13046. if (myUsername.length() > 12)
  13047. myUsername = myUsername.substring(0, 12);
  13048. } else if (loginScreenCursorPos == 1) {
  13049. if (l1 == 8 && myPassword.length() > 0)
  13050. myPassword = myPassword.substring(0, myPassword.length() - 1);
  13051. if (l1 == 9 || l1 == 13)
  13052. loginScreenCursorPos = 0;
  13053. if (l1 == 10) {
  13054. if (myPassword.length() < 5) {
  13055. loginMessage1 = "Your password is too weak.";
  13056. } else {
  13057. loginFailures = 0;
  13058. login(myUsername, myPassword, myAuth, rememberPin, false);
  13059. if (loggedIn)
  13060. return;
  13061. }
  13062. }
  13063. if (flag1)
  13064. myPassword += (char) l1;
  13065. if (myPassword.length() > 20)
  13066. myPassword = myPassword.substring(0, 20);
  13067. } else if (loginScreenCursorPos == 2) {
  13068. if (l1 == 8 && myAuth.length() > 0)
  13069. myAuth = myAuth.substring(0, myAuth.length() - 1);
  13070. if (l1 == 9 || l1 == 13)
  13071. loginScreenCursorPos = 0;
  13072. if (l1 == 10) {
  13073. loginFailures = 0;
  13074. login(myUsername, myPassword, myAuth, rememberPin, false);
  13075. if (loggedIn)
  13076. return;
  13077. }
  13078. if (flag1)
  13079. myAuth += (char) l1;
  13080. if (myAuth.length() > 20)
  13081. myAuth = myAuth.substring(0, 20);
  13082. }
  13083. } while (true);
  13084. return;
  13085. // }
  13086. /*
  13087. * if (loginScreenState == 3) { int k = super.myWidth / 2; int j1 =
  13088. * super.myHeight / 2 + 50; j1 += 20; if (super.clickMode3 == 1 &&
  13089. * super.saveClickX >= k - 75 && super.saveClickX <= k + 75 &&
  13090. * super.saveClickY >= j1 - 20 && super.saveClickY <= j1 + 20)
  13091. * loginScreenState = 0; }
  13092. */
  13093. // }
  13094. }
  13095.  
  13096. private void method142(int i, int j, int k, int l, int i1, int j1, int k1) {
  13097. if (i1 >= 1 && i >= 1 && i1 <= 102 && i <= 102) {
  13098. if (lowMem && j != plane)
  13099. return;
  13100. int i2 = 0;
  13101. if (j1 == 0)
  13102. i2 = worldController.method300(j, i1, i);
  13103. if (j1 == 1)
  13104. i2 = worldController.method301(j, i1, i);
  13105. if (j1 == 2)
  13106. i2 = worldController.method302(j, i1, i);
  13107. if (j1 == 3)
  13108. i2 = worldController.method303(j, i1, i);
  13109. if (i2 != 0) {
  13110. int i3 = worldController.method304(j, i1, i, i2);
  13111. int j2 = i2 >> 14 & 0x7fff;
  13112. int k2 = i3 & 0x1f;
  13113. int l2 = i3 >> 6;
  13114. if (j1 == 0) {
  13115. worldController.method291(i1, j, i, (byte) -119);
  13116. ObjectDefinition class46 = ObjectDefinition.forID(j2);
  13117. if (class46.aBoolean767)
  13118. aClass11Array1230[j].method215(l2, k2, class46.aBoolean757, i1, i);
  13119. }
  13120. if (j1 == 1)
  13121. worldController.method292(i, j, i1);
  13122. if (j1 == 2) {
  13123. worldController.method293(j, i1, i);
  13124. ObjectDefinition class46_1 = ObjectDefinition.forID(j2);
  13125. if (i1 + class46_1.anInt744 > 103 || i + class46_1.anInt744 > 103 || i1 + class46_1.anInt761 > 103
  13126. || i + class46_1.anInt761 > 103)
  13127. return;
  13128. if (class46_1.aBoolean767)
  13129. aClass11Array1230[j].method216(l2, class46_1.anInt744, i1, i, class46_1.anInt761,
  13130. class46_1.aBoolean757);
  13131. }
  13132. if (j1 == 3) {
  13133. worldController.method294(j, i, i1);
  13134. ObjectDefinition class46_2 = ObjectDefinition.forID(j2);
  13135. if (class46_2.aBoolean767 && class46_2.hasActions)
  13136. aClass11Array1230[j].method218(i, i1);
  13137. }
  13138. }
  13139. if (k1 >= 0) {
  13140. int j3 = j;
  13141. if (j3 < 3 && (byteGroundArray[1][i1][i] & 2) == 2)
  13142. j3++;
  13143. ObjectManager.method188(worldController, k, i, l, j3, aClass11Array1230[j], intGroundArray, i1, k1, j);
  13144. }
  13145. }
  13146. }
  13147.  
  13148. private void updatePlayers(int i, RSBuffer stream) {
  13149. anInt839 = 0;
  13150. anInt893 = 0;
  13151. method117(stream);
  13152. method134(stream);
  13153. method91(stream, i);
  13154. method49(stream);
  13155. for (int k = 0; k < anInt839; k++) {
  13156. int l = anIntArray840[k];
  13157. if (playerArray[l].anInt1537 != loopCycle)
  13158. playerArray[l] = null;
  13159. }
  13160.  
  13161. if (stream.currentOffset != i) {
  13162. Signlink.reporterror("Error packet size mismatch in getplayer pos:" + stream.currentOffset + " psize:" + i);
  13163. throw new RuntimeException("eek");
  13164. }
  13165. for (int i1 = 0; i1 < playerCount; i1++)
  13166. if (playerArray[playerIndices[i1]] == null) {
  13167. Signlink.reporterror(myUsername + " null entry in pl list - pos:" + i1 + " size:" + playerCount);
  13168. throw new RuntimeException("eek");
  13169. }
  13170.  
  13171. }
  13172.  
  13173. private void setCameraPos(int j, int k, int l, int i1, int j1, int k1) {
  13174. int l1 = 2048 - k & 0x7ff;
  13175. int i2 = 2048 - j1 & 0x7ff;
  13176. int j2 = 0;
  13177. int k2 = 0;
  13178. int l2 = j;
  13179. if (l1 != 0) {
  13180. int i3 = Model.modelIntArray1[l1];
  13181. int k3 = Model.modelIntArray2[l1];
  13182. int i4 = k2 * k3 - l2 * i3 >> 16;
  13183. l2 = k2 * i3 + l2 * k3 >> 16;
  13184. k2 = i4;
  13185. }
  13186. if (i2 != 0) {
  13187. int j3 = Model.modelIntArray1[i2];
  13188. int l3 = Model.modelIntArray2[i2];
  13189. int j4 = l2 * j3 + j2 * l3 >> 16;
  13190. l2 = l2 * l3 - j2 * j3 >> 16;
  13191. j2 = j4;
  13192. }
  13193. xCameraPos = l - j2;
  13194. zCameraPos = i1 - k2;
  13195. yCameraPos = k1 - l2;
  13196. yCameraCurve = k;
  13197. xCameraCurve = j1;
  13198. }
  13199.  
  13200. public void updateStrings(String str, int i) {
  13201. switch (i) {
  13202. case 1675:
  13203. sendFrame126(str, 17508);
  13204. break;// Stab
  13205. case 1676:
  13206. sendFrame126(str, 17509);
  13207. break;// Slash
  13208. case 1677:
  13209. sendFrame126(str, 17510);
  13210. break;// Cursh
  13211. case 1678:
  13212. sendFrame126(str, 17511);
  13213. break;// Magic
  13214. case 1679:
  13215. sendFrame126(str, 17512);
  13216. break;// Range
  13217. case 1680:
  13218. sendFrame126(str, 17513);
  13219. break;// Stab
  13220. case 1681:
  13221. sendFrame126(str, 17514);
  13222. break;// Slash
  13223. case 1682:
  13224. sendFrame126(str, 17515);
  13225. break;// Crush
  13226. case 1683:
  13227. sendFrame126(str, 17516);
  13228. break;// Magic
  13229. case 1684:
  13230. sendFrame126(str, 17517);
  13231. break;// Range
  13232. case 1686:
  13233. sendFrame126(str, 17518);
  13234. break;// Strength
  13235. case 1687:
  13236. sendFrame126(str, 17519);
  13237. break;// Prayer
  13238. }
  13239. }
  13240.  
  13241. private static void setHighMemAndReadUUID() {
  13242. WorldController.lowMem = false;
  13243. Texture.lowMem = false;
  13244. lowMem = false;
  13245. ObjectManager.lowMem = false;
  13246. ObjectDefinition.lowMem = false;
  13247. }
  13248.  
  13249. public void sendFrame126(String str, int i) {
  13250. RSInterface inter = RSInterface.interfaceCache[i];
  13251. if (inter == null) {
  13252. System.err.println("Null interface message update: " + i);
  13253. return;
  13254. }
  13255. inter.message = str;
  13256. if (RSInterface.interfaceCache[i].parentID == tabInterfaceIDs[tabID]) {
  13257. }
  13258. }
  13259.  
  13260. public void sendPacket185(int button, int toggle, int type) {
  13261. switch (type) {
  13262. case 135:
  13263. RSInterface class9 = RSInterface.interfaceCache[button];
  13264. boolean flag8 = true;
  13265. if (class9.contentType > 0)
  13266. flag8 = promptUserForInput(class9);
  13267. if (flag8) {
  13268. MikeysInterfaces.buttonClicked(button);
  13269. stream.createFrame(185);
  13270. stream.writeWord(button);
  13271. }
  13272. break;
  13273. case 646:
  13274. MikeysInterfaces.buttonClicked(button);
  13275. stream.createFrame(185);
  13276. stream.writeWord(button);
  13277. RSInterface class9_2 = RSInterface.interfaceCache[button];
  13278. if (class9_2.valueIndexArray != null && class9_2.valueIndexArray[0][0] == 5) {
  13279. if (variousSettings[toggle] != class9_2.anIntArray212[0]) {
  13280. variousSettings[toggle] = class9_2.anIntArray212[0];
  13281. method33(toggle);
  13282. }
  13283. }
  13284. break;
  13285. case 169:
  13286. MikeysInterfaces.buttonClicked(button);
  13287. stream.createFrame(185);
  13288. stream.writeWord(button);
  13289. RSInterface class9_3 = RSInterface.interfaceCache[button];
  13290. if (class9_3.valueIndexArray != null && class9_3.valueIndexArray[0][0] == 5) {
  13291. variousSettings[toggle] = 1 - variousSettings[toggle];
  13292. method33(toggle);
  13293. }
  13294. switch (button) {
  13295. case 74214:
  13296. if (toggle == 0)
  13297. sendFrame36(173, toggle);
  13298. if (toggle == 1)
  13299. sendPacket185(153, 173, 646);
  13300. break;
  13301. }
  13302. break;
  13303. }
  13304. }
  13305.  
  13306. public void sendFrame36(int id, int state) {
  13307. anIntArray1045[id] = state;
  13308. if (variousSettings[id] != state) {
  13309. variousSettings[id] = state;
  13310. method33(id);
  13311. if (dialogID != -1)
  13312. inputTaken = true;
  13313. }
  13314. }
  13315.  
  13316. public void sendFrame219() {
  13317. if (invOverlayInterfaceID != -1) {
  13318. invOverlayInterfaceID = -1;
  13319. tabAreaAltered = true;
  13320. }
  13321. if (backDialogID != -1) {
  13322. backDialogID = -1;
  13323. inputTaken = true;
  13324. }
  13325. if (inputDialogState != 0) {
  13326. inputDialogState = 0;
  13327. inputTaken = true;
  13328. }
  13329. openInterfaceID = -1;
  13330. aBoolean1149 = false;
  13331. }
  13332.  
  13333. public void sendFrame248(int interfaceID, int sideInterfaceID) {
  13334. if (backDialogID != -1) {
  13335. backDialogID = -1;
  13336. inputTaken = true;
  13337. }
  13338. if (inputDialogState != 0) {
  13339. inputDialogState = 0;
  13340. inputTaken = true;
  13341. }
  13342. openInterfaceID = interfaceID;
  13343. invOverlayInterfaceID = sideInterfaceID;
  13344. tabAreaAltered = true;
  13345. aBoolean1149 = false;
  13346. }
  13347.  
  13348. private boolean parsePacket() {
  13349. if (socketStream == null)
  13350. return false;
  13351. try {
  13352. int i = socketStream.available();
  13353. if (i == 0)
  13354. return false;
  13355. if (pktType == -1) {
  13356. socketStream.flushInputStream(inStream.buffer, 1);
  13357. pktType = inStream.buffer[0] & 0xff;
  13358. if (encryption != null)
  13359. pktType = pktType - encryption.getNextKey() & 0xff;
  13360. pktSize = SizeConstants.packetSizes[pktType];
  13361. i--;
  13362. }
  13363. if (pktSize == -1)
  13364. if (i > 0) {
  13365. socketStream.flushInputStream(inStream.buffer, 1);
  13366. pktSize = inStream.buffer[0] & 0xff;
  13367. i--;
  13368. } else {
  13369. return false;
  13370. }
  13371. if (pktSize == -2)
  13372. if (i > 1) {
  13373. socketStream.flushInputStream(inStream.buffer, 2);
  13374. inStream.currentOffset = 0;
  13375. pktSize = inStream.readUnsignedWord();
  13376. i -= 2;
  13377. } else {
  13378. return false;
  13379. }
  13380. if (i < pktSize)
  13381. return false;
  13382. inStream.currentOffset = 0;
  13383. socketStream.flushInputStream(inStream.buffer, pktSize);
  13384. anInt1009 = 0;
  13385. anInt843 = anInt842;
  13386. anInt842 = anInt841;
  13387. anInt841 = pktType;
  13388.  
  13389. // if (pktType != 81 && pktType != 65 && pktType != 126)
  13390. // System.out.println(pktType);
  13391. switch (pktType) {
  13392. case 116:
  13393. mySummonIndex = inStream.readDWord();
  13394. pktType = -1;
  13395. return true;
  13396.  
  13397. case 3:
  13398. gameframeHint = inStream.readUnsignedByte();
  13399. System.out.println("gameframe hint: " + gameframeHint);
  13400. pktType = -1;
  13401. return true;
  13402.  
  13403. case 5:
  13404. int opcode = inStream.readUnsignedByte();
  13405. int time = inStream.readUnsignedWord();
  13406. CombatOverlays.add(opcode, time);
  13407. pktType = -1;
  13408. return true;
  13409.  
  13410. case 150:
  13411. int rsinterfaceId = inStream.readDWord();
  13412. int npcId = inStream.readDWord();
  13413. int modelZoom = inStream.readDWord();
  13414. int animation = inStream.readDWord();
  13415. if (npcId != -1) {
  13416. RSInterface.get(rsinterfaceId).npcDisplay.desc = NpcDefinition.forID(npcId);
  13417. } else {
  13418. RSInterface.get(rsinterfaceId).npcDisplay.desc = null;
  13419. }
  13420. RSInterface.get(rsinterfaceId).modelZoom = modelZoom;
  13421. RSInterface.get(rsinterfaceId).npcAnimation = animation;
  13422.  
  13423. pktType = -1;
  13424. return true;
  13425.  
  13426. case 152:
  13427. int rsinterfaceId2 = inStream.readDWord();
  13428. int translateX = inStream.readSignedByte();
  13429. int translateY = inStream.readSignedByte();
  13430. RSInterface parent = RSInterface.get(RSInterface.get(rsinterfaceId2).parentID);
  13431. parent.resetChildCoordinates(rsinterfaceId2);
  13432. parent.translateChild(rsinterfaceId2, translateX, translateY);
  13433. pktType = -1;
  13434. return true;
  13435.  
  13436. case 81:
  13437. updatePlayers(pktSize, inStream);
  13438. aBoolean1080 = false;
  13439. pktType = -1;
  13440. return true;
  13441.  
  13442. case 176:
  13443. daysSinceRecovChange = inStream.method427();
  13444. unreadMessages = inStream.method435();
  13445. membersInt = inStream.readUnsignedByte();
  13446. anInt1193 = inStream.method440();
  13447. daysSinceLastLogin = inStream.readUnsignedWord();
  13448. if (anInt1193 != 0 && openInterfaceID == -1) {
  13449. Signlink.dnslookup(TextClass.method586(anInt1193));
  13450. clearTopInterfaces();
  13451. char c = '\u028A';
  13452. if (daysSinceRecovChange != 201 || membersInt == 1)
  13453. c = '\u028F';
  13454. reportAbuseInput = "";
  13455. canMute = false;
  13456. for (int k9 = 0; k9 < RSInterface.interfaceCache.length; k9++) {
  13457. if (RSInterface.interfaceCache[k9] == null || RSInterface.interfaceCache[k9].contentType != c)
  13458. continue;
  13459. openInterfaceID = RSInterface.interfaceCache[k9].parentID;
  13460.  
  13461. }
  13462. }
  13463. pktType = -1;
  13464. return true;
  13465.  
  13466. case 64:
  13467. anInt1268 = inStream.method427();
  13468. anInt1269 = inStream.method428();
  13469. for (int j = anInt1268; j < anInt1268 + 8; j++) {
  13470. for (int l9 = anInt1269; l9 < anInt1269 + 8; l9++)
  13471. if (groundArray[plane][j][l9] != null) {
  13472. groundArray[plane][j][l9] = null;
  13473. spawnGroundItem(j, l9);
  13474. }
  13475. }
  13476. for (Class30_Sub1 class30_sub1 = (Class30_Sub1) aClass19_1179
  13477. .reverseGetFirst(); class30_sub1 != null; class30_sub1 = (Class30_Sub1) aClass19_1179
  13478. .reverseGetNext())
  13479. if (class30_sub1.x >= anInt1268 && class30_sub1.x < anInt1268 + 8 && class30_sub1.y >= anInt1269
  13480. && class30_sub1.y < anInt1269 + 8 && class30_sub1.heightLevel == plane)
  13481. class30_sub1.delay = 0;
  13482. pktType = -1;
  13483. return true;
  13484.  
  13485. case 185:
  13486. int k = inStream.method436();
  13487. RSInterface.interfaceCache[k].anInt233 = 3;
  13488. if (myPlayer.desc == null)
  13489. RSInterface.interfaceCache[k].mediaID = (myPlayer.anIntArray1700[0] << 25)
  13490. + (myPlayer.anIntArray1700[4] << 20) + (myPlayer.equipment[0] << 15)
  13491. + (myPlayer.equipment[8] << 10) + (myPlayer.equipment[11] << 5) + myPlayer.equipment[1];
  13492. else
  13493. RSInterface.interfaceCache[k].mediaID = (int) (0x12345678L + myPlayer.desc.id);
  13494. pktType = -1;
  13495. return true;
  13496.  
  13497. /* Clan chat packet */
  13498. case 217:
  13499. try {
  13500. name = inStream.readString();
  13501. message = inStream.readString();
  13502. clanname = inStream.readString();
  13503. rights = inStream.readUnsignedWord();
  13504. String crown = "";
  13505. if (rights > 0 && rights < modIcons.length) {
  13506. crown = "@cr" + rights + "@";
  13507. }
  13508. pushMessage(message, 16, crown + name);
  13509. } catch (Exception e) {
  13510. e.printStackTrace();
  13511. }
  13512. pktType = -1;
  13513. return true;
  13514.  
  13515. case 107:
  13516. aBoolean1160 = false;
  13517. for (int l = 0; l < 5; l++)
  13518. aBooleanArray876[l] = false;
  13519. pktType = -1;
  13520. return true;
  13521.  
  13522. case 72:
  13523. int i1 = inStream.method434();
  13524. RSInterface class9 = RSInterface.interfaceCache[i1];
  13525. for (int k15 = 0; k15 < class9.inv.length; k15++) {
  13526. class9.inv[k15] = -1;
  13527. class9.inv[k15] = 0;
  13528. }
  13529. MikeysInterfaces.containerUpdated(i1);
  13530. pktType = -1;
  13531. return true;
  13532.  
  13533. case 214:
  13534. ignoreListAsLongs = new long[100];
  13535. ignoreCount = 0;
  13536. int amount = Integer.parseInt(inStream.readString());
  13537. for (int i2 = 0; i2 < amount; i2++) {
  13538. ignoreListAsLongs[i2] = Long.parseLong(inStream.readString());
  13539. ignoreCount++;
  13540. }
  13541. pktType = -1;
  13542. return true;
  13543.  
  13544. case 166:/// XXX: ruse replaced this packet, for some reason..
  13545. inStream.readUnsignedByte();
  13546. int type = inStream.readUnsignedByte();
  13547. int slot = inStream.readUnsignedByte();
  13548. if (type == 1) {
  13549. slotColor[slot] = inStream.readUnsignedByte();
  13550. } else if (type == 2) {
  13551. slotColorPercent[slot] = inStream.readUnsignedByte();
  13552. } else if (type == 3) {
  13553. int lololol = inStream.readUnsignedByte();
  13554. if (lololol == 1) {
  13555. slotAborted[slot] = true;
  13556. } else {
  13557. slotAborted[slot] = false;
  13558. }
  13559. } else if (type == 4) {
  13560. int thing = inStream.readUnsignedByte();
  13561. if (thing == 1) {
  13562. buttonclicked = false;
  13563. interfaceButtonAction = 0;
  13564. } else if (thing == 2) {
  13565. slotSelected = slot;
  13566. } else if (thing == 3) {
  13567. slots[slot] = "";
  13568. Slots[slot] = 0;
  13569. }
  13570. } else if (type == 5) {
  13571. int thing1 = inStream.readUnsignedByte();
  13572. if (thing1 == 1) {
  13573. slotUsing = slot;
  13574. slots[slot] = "Sell";
  13575. Slots[slot] = 1;
  13576. } else if (thing1 == 2) {
  13577. slotUsing = slot;
  13578. slots[slot] = "Buy";
  13579. Slots[slot] = 1;
  13580. } else if (thing1 == 3) {
  13581. Slots[slot] = 2;
  13582. slots[slot] = "Sell";
  13583. } else if (thing1 == 4) {
  13584. Slots[slot] = 2;
  13585. slots[slot] = "Buy";
  13586. } else if (thing1 == 5) {
  13587. Slots[slot] = 3;
  13588. slots[slot] = "Sell";
  13589. } else if (thing1 == 6) {
  13590. Slots[slot] = 3;
  13591. slots[slot] = "Buy";
  13592. }
  13593. } else if (type == 6) {
  13594. inStream.readUnsignedByte();
  13595. buttonclicked = true;
  13596. amountOrNameInput = "";
  13597. totalItemResults = 0;
  13598. } else if (type == 7) {
  13599. int anInt1308 = inStream.readUnsignedByte();
  13600. // resetAnAnim(anInt1308);//XXX: disabed for now..
  13601. } else {
  13602. inStream.readUnsignedByte();
  13603. }
  13604. inStream.readUnsignedByte();
  13605. inStream.readUnsignedByte();
  13606.  
  13607. pktType = -1;
  13608. return true;
  13609.  
  13610. case 134:
  13611. int k1 = inStream.readUnsignedByte();
  13612. int i10 = inStream.method439();
  13613. int l15 = inStream.readUnsignedWord();
  13614. inStream.readUnsignedWord();
  13615. currentExp[k1] = i10;
  13616. currentStats[k1] = l15;
  13617. maxStats[k1] = 1;
  13618. for (int k20 = 0; k20 < 98; k20++)
  13619. if (i10 >= experienceForLevels[k20])
  13620. maxStats[k1] = k20 + 2;
  13621. pktType = -1;
  13622. return true;
  13623.  
  13624. case 71:
  13625. int l1 = inStream.readUnsignedWord();
  13626. int j10 = inStream.method426();
  13627. if (l1 == 65535)
  13628. l1 = -1;
  13629. tabInterfaceIDs[j10] = l1;
  13630. tabAreaAltered = true;
  13631. pktType = -1;
  13632. return true;
  13633.  
  13634. case 74:
  13635. int i2 = inStream.method434();
  13636. if (i2 == 65535)
  13637. i2 = -1;
  13638. if (i2 != currentSong && musicEnabled && !lowMem && prevSong == 0) {
  13639. nextSong = i2;
  13640. songChanging = true;
  13641. onDemandFetcher.method558(2, nextSong);
  13642. }
  13643. currentSong = i2;
  13644. pktType = -1;
  13645. return true;
  13646.  
  13647. case 121:
  13648. int j2 = inStream.method436();
  13649. int k10 = inStream.method435();
  13650. if (musicEnabled && !lowMem) {
  13651. nextSong = j2;
  13652. songChanging = false;
  13653. onDemandFetcher.method558(2, nextSong);
  13654. prevSong = k10;
  13655. }
  13656. pktType = -1;
  13657. return true;
  13658.  
  13659. case 109:
  13660. resetLogout();
  13661. pktType = -1;
  13662. return false;
  13663.  
  13664. case 70:
  13665. int k2 = inStream.readSignedWord();
  13666. int l10 = inStream.method437();
  13667. int i16 = inStream.method434();
  13668. RSInterface class9_5 = RSInterface.interfaceCache[i16];
  13669. class9_5.anInt263 = k2;
  13670. class9_5.anInt265 = l10;
  13671. pktType = -1;
  13672. return true;
  13673.  
  13674. case 190:// XXX custom special bar packet
  13675. int specialAmount = inStream.readUnsignedByte();
  13676. int barId = inStream.readUnsignedWord();
  13677. int specialBarString = inStream.readUnsignedWord();
  13678. boolean activated = inStream.readUnsignedByte() == 1;
  13679.  
  13680. RSInterface.interfaceCache[specialBarString].message = (activated ? "@whi@" : "@bla@")
  13681. + "SPECIAL ATTACK (" + specialAmount + "%)";
  13682.  
  13683. int specialCheck = 10;
  13684. int specialCheckAmount = specialAmount / 10;
  13685. for (int i23 = 0; i23 < 10; i23++) {
  13686. RSInterface class9_78 = RSInterface.interfaceCache[--barId];
  13687. class9_78.anInt263 = specialCheckAmount >= specialCheck ? 500 : 0;
  13688. class9_78.anInt265 = 0;
  13689. specialCheck--;
  13690. }
  13691.  
  13692. pktType = -1;
  13693. return true;
  13694.  
  13695. case 191:
  13696. int[] bonuses = new int[18];
  13697. for (int i23 = 0; i23 < bonuses.length; i23++) {
  13698. bonuses[i23] = inStream.readUnsignedByte();
  13699. }
  13700.  
  13701. String[][] bonusStrings = { { "1675", "Stab" }, { "1676", "Slash" }, { "1677", "Crush" },
  13702. { "1678", "Magic" }, { "1679", "Range" }, { "1680", "Stab" }, { "1681", "Slash" },
  13703. { "1682", "Crush" }, { "1683", "Magic" }, { "1684", "Range" }, { "16522", "Summoning" },
  13704. { "16523", "Absorb Melee" }, { "16524", "Absorb Magic" }, { "16525", "Absorb Ranged" },
  13705. { "1686", "Strength" }, { "16526", "Ranged Strength" }, { "1687", "Prayer" },
  13706. { "16527", "Magic Damage" } };
  13707.  
  13708. for (int i23 = 0; i23 < bonuses.length; i23++) {
  13709. RSInterface.interfaceCache[Integer.parseInt(bonusStrings[i23][0])].message = bonusStrings[i23][1]
  13710. + ": " + (bonuses[i23] > 0 ? "+" : "") + bonuses[i23];
  13711. }
  13712. pktType = -1;
  13713. return true;
  13714.  
  13715. case 73:
  13716. case 241:
  13717. int l2 = anInt1069;
  13718. int i11 = anInt1070;
  13719. if (pktType == 73) {
  13720. l2 = mapX = inStream.method435();
  13721. i11 = mapY = inStream.readUnsignedWord();
  13722. aBoolean1159 = false;
  13723. }
  13724. if (pktType == 241) {
  13725. i11 = inStream.method435();
  13726. inStream.initBitAccess();
  13727. for (int j16 = 0; j16 < 4; j16++) {
  13728. for (int l20 = 0; l20 < 13; l20++) {
  13729. for (int j23 = 0; j23 < 13; j23++) {
  13730. int i26 = inStream.readBits(1);
  13731. if (i26 == 1)
  13732. anIntArrayArrayArray1129[j16][l20][j23] = inStream.readBits(26);
  13733. else
  13734. anIntArrayArrayArray1129[j16][l20][j23] = -1;
  13735. }
  13736. }
  13737. }
  13738. inStream.finishBitAccess();
  13739. l2 = inStream.readUnsignedWord();
  13740. aBoolean1159 = true;
  13741. }
  13742. if (anInt1069 == l2 && anInt1070 == i11 && loadingStage == 2) {
  13743. pktType = -1;
  13744. return true;
  13745. }
  13746. anInt1069 = l2;
  13747. anInt1070 = i11;
  13748. baseX = (anInt1069 - 6) * 8;
  13749. baseY = (anInt1070 - 6) * 8;
  13750. aBoolean1141 = (anInt1069 / 8 == 48 || anInt1069 / 8 == 49) && anInt1070 / 8 == 48;
  13751. if (anInt1069 / 8 == 48 && anInt1070 / 8 == 148)
  13752. aBoolean1141 = true;
  13753. loadingStage = 1;
  13754. aLong824 = System.currentTimeMillis();
  13755. aRSImageProducer_1165.initDrawingArea();
  13756. drawLoadingMessages(1, "Loading - please wait.", null);
  13757. aRSImageProducer_1165.drawGraphics(frameMode == ScreenMode.FIXED ? 4 : 0, super.graphics,
  13758. frameMode == ScreenMode.FIXED ? 4 : 0);
  13759. if (pktType == 73) {
  13760. int k16 = 0;
  13761. for (int i21 = (anInt1069 - 6) / 8; i21 <= (anInt1069 + 6) / 8; i21++) {
  13762. for (int k23 = (anInt1070 - 6) / 8; k23 <= (anInt1070 + 6) / 8; k23++)
  13763. k16++;
  13764. }
  13765. aByteArrayArray1183 = new byte[k16][];
  13766. aByteArrayArray1247 = new byte[k16][];
  13767. anIntArray1234 = new int[k16];
  13768. anIntArray1235 = new int[k16];
  13769. anIntArray1236 = new int[k16];
  13770. k16 = 0;
  13771. for (int l23 = (anInt1069 - 6) / 8; l23 <= (anInt1069 + 6) / 8; l23++) {
  13772. for (int j26 = (anInt1070 - 6) / 8; j26 <= (anInt1070 + 6) / 8; j26++) {
  13773. anIntArray1234[k16] = (l23 << 8) + j26;
  13774. if (aBoolean1141
  13775. && (j26 == 49 || j26 == 149 || j26 == 147 || l23 == 50 || l23 == 49 && j26 == 47)) {
  13776. anIntArray1235[k16] = -1;
  13777. anIntArray1236[k16] = -1;
  13778. k16++;
  13779. } else {
  13780. int k28 = anIntArray1235[k16] = onDemandFetcher.method562(0, j26, l23);
  13781. if (k28 != -1) {
  13782. onDemandFetcher.method558(onDemandFetcher.isOsrsMap(j26, l23) ? 8 : 3, k28);
  13783. }
  13784.  
  13785. int j30 = anIntArray1236[k16] = onDemandFetcher.method562(1, j26, l23);
  13786. if (j30 != -1) {
  13787. onDemandFetcher.method558(onDemandFetcher.isOsrsMap(j26, l23) ? 8 : 3, j30);
  13788. }
  13789. k16++;
  13790. }
  13791. }
  13792. }
  13793. }
  13794. if (pktType == 241) {
  13795. int l16 = 0;
  13796. int ai[] = new int[676];
  13797. for (int i24 = 0; i24 < 4; i24++) {
  13798. for (int k26 = 0; k26 < 13; k26++) {
  13799. for (int l28 = 0; l28 < 13; l28++) {
  13800. int k30 = anIntArrayArrayArray1129[i24][k26][l28];
  13801. if (k30 != -1) {
  13802. int k31 = k30 >> 14 & 0x3ff;
  13803. int i32 = k30 >> 3 & 0x7ff;
  13804. int k32 = (k31 / 8 << 8) + i32 / 8;
  13805. for (int j33 = 0; j33 < l16; j33++) {
  13806. if (ai[j33] != k32)
  13807. continue;
  13808. k32 = -1;
  13809.  
  13810. }
  13811. if (k32 != -1)
  13812. ai[l16++] = k32;
  13813. }
  13814. }
  13815. }
  13816. }
  13817. aByteArrayArray1183 = new byte[l16][];
  13818. aByteArrayArray1247 = new byte[l16][];
  13819. anIntArray1234 = new int[l16];
  13820. anIntArray1235 = new int[l16];
  13821. anIntArray1236 = new int[l16];
  13822. for (int l26 = 0; l26 < l16; l26++) {
  13823. int i29 = anIntArray1234[l26] = ai[l26];
  13824. int l30 = i29 >> 8 & 0xff;
  13825. int l31 = i29 & 0xff;
  13826. int j32 = anIntArray1235[l26] = onDemandFetcher.method562(0, l31, l30);
  13827. if (j32 != -1)
  13828. onDemandFetcher.method558(3, j32);
  13829. int i33 = anIntArray1236[l26] = onDemandFetcher.method562(1, l31, l30);
  13830. if (i33 != -1)
  13831. onDemandFetcher.method558(3, i33);
  13832. }
  13833. }
  13834. int i17 = baseX - anInt1036;
  13835. int j21 = baseY - anInt1037;
  13836. anInt1036 = baseX;
  13837. anInt1037 = baseY;
  13838. for (int j24 = 0; j24 < 16384; j24++) {
  13839. Npc npc = npcArray[j24];
  13840. if (npc != null) {
  13841. for (int j29 = 0; j29 < 10; j29++) {
  13842. npc.smallX[j29] -= i17;
  13843. npc.smallY[j29] -= j21;
  13844. }
  13845. npc.x -= i17 * 128;
  13846. npc.y -= j21 * 128;
  13847. }
  13848. }
  13849. for (int i27 = 0; i27 < maxPlayers; i27++) {
  13850. Player player = playerArray[i27];
  13851. if (player != null) {
  13852. for (int i31 = 0; i31 < 10; i31++) {
  13853. player.smallX[i31] -= i17;
  13854. player.smallY[i31] -= j21;
  13855. }
  13856. player.x -= i17 * 128;
  13857. player.y -= j21 * 128;
  13858. }
  13859. }
  13860. aBoolean1080 = true;
  13861. byte byte1 = 0;
  13862. byte byte2 = 104;
  13863. byte byte3 = 1;
  13864. if (i17 < 0) {
  13865. byte1 = 103;
  13866. byte2 = -1;
  13867. byte3 = -1;
  13868. }
  13869. byte byte4 = 0;
  13870. byte byte5 = 104;
  13871. byte byte6 = 1;
  13872. if (j21 < 0) {
  13873. byte4 = 103;
  13874. byte5 = -1;
  13875. byte6 = -1;
  13876. }
  13877. for (int k33 = byte1; k33 != byte2; k33 += byte3) {
  13878. for (int l33 = byte4; l33 != byte5; l33 += byte6) {
  13879. int i34 = k33 + i17;
  13880. int j34 = l33 + j21;
  13881. for (int k34 = 0; k34 < 4; k34++)
  13882. if (i34 >= 0 && j34 >= 0 && i34 < 104 && j34 < 104)
  13883. groundArray[k34][k33][l33] = groundArray[k34][i34][j34];
  13884. else
  13885. groundArray[k34][k33][l33] = null;
  13886. }
  13887. }
  13888. for (Class30_Sub1 class30_sub1_1 = (Class30_Sub1) aClass19_1179
  13889. .reverseGetFirst(); class30_sub1_1 != null; class30_sub1_1 = (Class30_Sub1) aClass19_1179
  13890. .reverseGetNext()) {
  13891. class30_sub1_1.x -= i17;
  13892. class30_sub1_1.y -= j21;
  13893. if (class30_sub1_1.x < 0 || class30_sub1_1.y < 0 || class30_sub1_1.x >= 104
  13894. || class30_sub1_1.y >= 104)
  13895. class30_sub1_1.unlink();
  13896. }
  13897. if (destX != 0) {
  13898. destX -= i17;
  13899. destY -= j21;
  13900. }
  13901. aBoolean1160 = false;
  13902. pktType = -1;
  13903. return true;
  13904.  
  13905. case 208:
  13906. int i3 = inStream.readUnsignedWord();
  13907. if (i3 == 65535)
  13908. i3 = -1;
  13909. if (i3 == -1) {
  13910. walkableInterfaceId = -1;
  13911. pktType = -1;
  13912. return true;
  13913. }
  13914.  
  13915. RSInterface inter = RSInterface.interfaceCache[i3];
  13916. if (inter == null || inter.children == null) {
  13917. System.err.println("method60 (packet 208) null interface: " + i3);
  13918. } else {
  13919. if (i3 >= 0) {
  13920. openInterface(i3);
  13921. }
  13922. walkableInterfaceId = i3;
  13923. }
  13924.  
  13925. pktType = -1;
  13926. return true;
  13927.  
  13928. case 99:
  13929. anInt1021 = inStream.readUnsignedByte();
  13930. pktType = -1;
  13931. return true;
  13932.  
  13933. case 51:/// XXX: custom packet for coin pouch - Michael
  13934. coinsInPouch = inStream.readQWord();
  13935. lastCoinsInPouchChange = System.currentTimeMillis();
  13936. pktType = -1;
  13937. return true;
  13938.  
  13939. case 175:
  13940. /// XXX: ruse packet
  13941. /* int soundId = */inStream.readWordBigEndian();
  13942. /* int volume = */inStream.readSignedByte();
  13943. /* int delay = */inStream.readShort();
  13944. pktType = -1;
  13945. return true;
  13946.  
  13947. case 127:/// XXX: ruse packet
  13948. myPrivilege = inStream.readUnsignedByte();
  13949. pktType = -1;
  13950. return true;
  13951.  
  13952. case 29:/// XXX: ruse packet
  13953. shadowDestination = inStream.readUnsignedByte();
  13954. pktType = -1;
  13955. return true;
  13956.  
  13957. case 27:/// XXX: ruse packet
  13958. /*
  13959. * inputTitle = new String(inStream.readString()); showInput =
  13960. * false; inputDialogState = 1; if(!getOption("save_input")) {
  13961. * amountOrNameInput = ""; }
  13962. */
  13963.  
  13964. /*
  13965. *
  13966. *
  13967. * amountOrNameInput = "";
  13968. *
  13969. * pktType = -1;
  13970. */
  13971. inputTitle = new String(inStream.readString());
  13972. messagePromptRaised = false;
  13973. inputDialogState = 1;
  13974. amountOrNameInput = "";
  13975. inputTaken = true;
  13976. pktType = -1;
  13977. return true;
  13978.  
  13979. case 88:/// XXX: ruse packet
  13980. int xface = inStream.readSignedWord();
  13981. int yface = inStream.readSignedWord();
  13982. int npcindex = inStream.ig2();
  13983. if (npcindex < npcArray.length) {
  13984. Npc npc = npcArray[npcindex];
  13985. if (npc != null) {
  13986. npc.anInt1538 = xface;
  13987. npc.anInt1539 = yface;
  13988. }
  13989. }
  13990. pktType = -1;
  13991. return true;
  13992.  
  13993. case 123:
  13994. /// XXX: ruse packet
  13995. /* sendConsoleMessage( */inStream.readString()/* , false) */;
  13996. pktType = -1;
  13997. return true;
  13998.  
  13999. case 75:
  14000. int j3 = inStream.method436();
  14001. int j11 = inStream.method436();
  14002. RSInterface inter2 = RSInterface.interfaceCache[j11];
  14003. if (inter2 != null) {
  14004. inter2.anInt233 = 2;
  14005. inter2.mediaID = j3;
  14006. } else {
  14007. System.err.println("Null media container (packet 75): " + j11);
  14008. }
  14009. pktType = -1;
  14010. return true;
  14011.  
  14012. case 114:
  14013. anInt1104 = inStream.method434() * 30;
  14014. pktType = -1;
  14015. return true;
  14016.  
  14017. case 60:
  14018. anInt1269 = inStream.readUnsignedByte();
  14019. anInt1268 = inStream.method427();
  14020. while (inStream.currentOffset < pktSize) {
  14021. int k3 = inStream.readUnsignedByte();
  14022. method137(inStream, k3);
  14023. }
  14024. pktType = -1;
  14025. return true;
  14026.  
  14027. case 35:
  14028. int l3 = inStream.readUnsignedByte();
  14029. int k11 = inStream.readUnsignedByte();
  14030. int j17 = inStream.readUnsignedByte();
  14031. int k21 = inStream.readUnsignedByte();
  14032. aBooleanArray876[l3] = true;
  14033. anIntArray873[l3] = k11;
  14034. anIntArray1203[l3] = j17;
  14035. anIntArray928[l3] = k21;
  14036. anIntArray1030[l3] = 0;
  14037. pktType = -1;
  14038. return true;
  14039.  
  14040. case 174:
  14041. int i4 = inStream.readUnsignedWord();
  14042. int l11 = inStream.readUnsignedByte();
  14043. int k17 = inStream.readUnsignedWord();
  14044. if (aBoolean848 && !lowMem && anInt1062 < 50) {
  14045. anIntArray1207[anInt1062] = i4;
  14046. anIntArray1241[anInt1062] = l11;
  14047. anIntArray1250[anInt1062] = k17 + Sounds.anIntArray326[i4];
  14048. anInt1062++;
  14049. }
  14050. pktType = -1;
  14051. return true;
  14052.  
  14053. case 104:
  14054. int j4 = inStream.method427();
  14055. int i12 = inStream.method426();
  14056. String s6 = inStream.readString();
  14057. if (j4 >= 1 && j4 <= 5) {
  14058. if (s6.equalsIgnoreCase("null"))
  14059. s6 = null;
  14060. atPlayerActions[j4 - 1] = s6;
  14061. atPlayerArray[j4 - 1] = i12 == 0;
  14062. }
  14063. pktType = -1;
  14064. return true;
  14065.  
  14066. case 78:
  14067. destX = 0;
  14068. pktType = -1;
  14069. return true;
  14070.  
  14071. case 253:
  14072. String s = inStream.readString();
  14073. if (s.endsWith(":tradereq:")) {
  14074. String s3 = s.substring(0, s.indexOf(":"));
  14075. long l17 = TextClass.longForName(s3);
  14076. boolean flag2 = false;
  14077. for (int j27 = 0; j27 < ignoreCount; j27++) {
  14078. if (ignoreListAsLongs[j27] != l17)
  14079. continue;
  14080. flag2 = true;
  14081.  
  14082. }
  14083. if (!flag2 && anInt1251 == 0)
  14084. pushMessage("wishes to trade with you.", 4, s3);
  14085. } else if (s.endsWith(":clan:")) {
  14086. String s4 = s.substring(0, s.indexOf(":"));
  14087. TextClass.longForName(s4);
  14088. pushMessage("Clan: ", 8, s4);
  14089. } else if (s.endsWith("#url#")) {
  14090. String link = s.substring(0, s.indexOf("#"));
  14091. pushMessage("Join us at: ", 9, link);
  14092. } else if (s.endsWith(":duelreq:")) {
  14093. String s4 = s.substring(0, s.indexOf(":"));
  14094. long l18 = TextClass.longForName(s4);
  14095. boolean flag3 = false;
  14096. for (int k27 = 0; k27 < ignoreCount; k27++) {
  14097. if (ignoreListAsLongs[k27] != l18)
  14098. continue;
  14099. flag3 = true;
  14100.  
  14101. }
  14102. if (!flag3 && anInt1251 == 0)
  14103. pushMessage("wishes to duel with you.", 8, s4);
  14104. } else if (s.endsWith(":chalreq:")) {
  14105. String s5 = s.substring(0, s.indexOf(":"));
  14106. long l19 = TextClass.longForName(s5);
  14107. boolean flag4 = false;
  14108. for (int l27 = 0; l27 < ignoreCount; l27++) {
  14109. if (ignoreListAsLongs[l27] != l19)
  14110. continue;
  14111. flag4 = true;
  14112.  
  14113. }
  14114. if (!flag4 && anInt1251 == 0) {
  14115. String s8 = s.substring(s.indexOf(":") + 1, s.length() - 9);
  14116. pushMessage(s8, 8, s5);
  14117. }
  14118. } else if (s.equalsIgnoreCase("@autocastoff")) {
  14119. setAutoCastOff();
  14120. } else {
  14121. boolean clan = s.startsWith("@clan:A@");
  14122. if (clan) {
  14123. s = s.substring(8, s.length());
  14124. String rankstr = s.substring(s.indexOf("<img=") + 5);
  14125. rankstr = rankstr.substring(0, rankstr.indexOf(">"));
  14126. rankstr = rankstr.replace("=0", "0");
  14127. Integer rank = Integer.valueOf(rankstr);
  14128. s = s.replace("<img=" + (rank) + ">", " ");
  14129. pushMessage(s, clan ? 16 : 0, "@cr" + rank + "@");
  14130. pktType = -1;
  14131. return true;
  14132. }
  14133. pushMessage(s, clan ? 16 : 0, "");
  14134. }
  14135. pktType = -1;
  14136. return true;
  14137.  
  14138. case 1:
  14139. for (int k4 = 0; k4 < playerArray.length; k4++)
  14140. if (playerArray[k4] != null)
  14141. playerArray[k4].anim = -1;
  14142. for (int j12 = 0; j12 < npcArray.length; j12++)
  14143. if (npcArray[j12] != null)
  14144. npcArray[j12].anim = -1;
  14145. pktType = -1;
  14146. return true;
  14147.  
  14148. case 50:
  14149. long l4 = inStream.readQWord();
  14150. int i18 = inStream.readUnsignedByte();
  14151. String s7 = TextClass.fixName(TextClass.nameForLong(l4));
  14152. for (int k24 = 0; k24 < friendsCount; k24++) {
  14153. if (l4 != friendsListAsLongs[k24])
  14154. continue;
  14155. if (friendsNodeIDs[k24] != i18) {
  14156. friendsNodeIDs[k24] = i18;
  14157. if (unknownInt10 != -1) {
  14158. if (i18 >= 2) {
  14159. pushMessage(s7 + " has logged in.", 5, "");
  14160. }
  14161. if (i18 <= 1) {
  14162. pushMessage(s7 + " has logged out.", 5, "");
  14163. }
  14164. }
  14165. }
  14166. s7 = null;
  14167.  
  14168. }
  14169. if (s7 != null && friendsCount < 200) {
  14170. friendsListAsLongs[friendsCount] = l4;
  14171. friendsList[friendsCount] = s7;
  14172. friendsNodeIDs[friendsCount] = i18;
  14173. friendsCount++;
  14174. }
  14175. for (boolean flag6 = false; !flag6;) {
  14176. flag6 = true;
  14177. for (int k29 = 0; k29 < friendsCount - 1; k29++)
  14178. if (friendsNodeIDs[k29] != nodeID && friendsNodeIDs[k29 + 1] == nodeID
  14179. || friendsNodeIDs[k29] == 0 && friendsNodeIDs[k29 + 1] != 0) {
  14180. int j31 = friendsNodeIDs[k29];
  14181. friendsNodeIDs[k29] = friendsNodeIDs[k29 + 1];
  14182. friendsNodeIDs[k29 + 1] = j31;
  14183. String s10 = friendsList[k29];
  14184. friendsList[k29] = friendsList[k29 + 1];
  14185. friendsList[k29 + 1] = s10;
  14186. long l32 = friendsListAsLongs[k29];
  14187. friendsListAsLongs[k29] = friendsListAsLongs[k29 + 1];
  14188. friendsListAsLongs[k29 + 1] = l32;
  14189. flag6 = false;
  14190. }
  14191. }
  14192. pktType = -1;
  14193. return true;
  14194.  
  14195. case 110:
  14196. if (tabID == 12) {
  14197. }
  14198. energy = inStream.readUnsignedByte();
  14199. pktType = -1;
  14200. return true;
  14201.  
  14202. case 254:
  14203. anInt855 = inStream.readUnsignedByte();
  14204. if (anInt855 == 1)
  14205. anInt1222 = inStream.readUnsignedWord();
  14206. if (anInt855 >= 2 && anInt855 <= 6) {
  14207. if (anInt855 == 2) {
  14208. anInt937 = 64;
  14209. anInt938 = 64;
  14210. }
  14211. if (anInt855 == 3) {
  14212. anInt937 = 0;
  14213. anInt938 = 64;
  14214. }
  14215. if (anInt855 == 4) {
  14216. anInt937 = 128;
  14217. anInt938 = 64;
  14218. }
  14219. if (anInt855 == 5) {
  14220. anInt937 = 64;
  14221. anInt938 = 0;
  14222. }
  14223. if (anInt855 == 6) {
  14224. anInt937 = 64;
  14225. anInt938 = 128;
  14226. }
  14227. anInt855 = 2;
  14228. anInt934 = inStream.readUnsignedWord();
  14229. anInt935 = inStream.readUnsignedWord();
  14230. anInt936 = inStream.readUnsignedByte();
  14231. }
  14232. if (anInt855 == 10)
  14233. anInt933 = inStream.readUnsignedWord();
  14234. pktType = -1;
  14235. return true;
  14236.  
  14237. case 248:
  14238. int i5 = inStream.method435();
  14239. int k12 = inStream.readUnsignedWord();
  14240. if (backDialogID != -1) {
  14241. backDialogID = -1;
  14242. inputTaken = true;
  14243. }
  14244. if (inputDialogState != 0) {
  14245. inputDialogState = 0;
  14246. inputTaken = true;
  14247. }
  14248. openInterfaceID = i5;
  14249. invOverlayInterfaceID = k12;
  14250. tabAreaAltered = true;
  14251. aBoolean1149 = false;
  14252. pktType = -1;
  14253. return true;
  14254.  
  14255. case 79:
  14256. int j5 = inStream.method434();
  14257. int l12 = inStream.method435();
  14258. RSInterface class9_3 = RSInterface.interfaceCache[j5];
  14259. if (class9_3 != null && class9_3.type == 0) {
  14260. if (l12 < 0)
  14261. l12 = 0;
  14262. if (l12 > class9_3.scrollMax - class9_3.height)
  14263. l12 = class9_3.scrollMax - class9_3.height;
  14264. class9_3.scrollPosition = l12;
  14265. }
  14266. pktType = -1;
  14267. return true;
  14268.  
  14269. case 68:
  14270. for (int k5 = 0; k5 < variousSettings.length; k5++)
  14271. if (variousSettings[k5] != anIntArray1045[k5]) {
  14272. variousSettings[k5] = anIntArray1045[k5];
  14273. method33(k5);
  14274. }
  14275. pktType = -1;
  14276. return true;
  14277.  
  14278. /*
  14279. * private message
  14280. */
  14281. case 196:
  14282. long l5 = inStream.readQWord();
  14283. /* int j18 = */inStream.readDWord();
  14284. int l21 = inStream.readUnsignedByte();
  14285. int gamemode = inStream.readUnsignedByte();
  14286. boolean flag5 = false;
  14287. if (l21 <= 1) {
  14288. for (int l29 = 0; l29 < ignoreCount; l29++) {
  14289. if (ignoreListAsLongs[l29] != l5)
  14290. continue;
  14291. flag5 = true;
  14292.  
  14293. }
  14294. }
  14295. if (!flag5 && anInt1251 == 0)
  14296. try {
  14297. anInt1169 = (anInt1169 + 1) % 100;
  14298. String s9 = TextInput.method525(pktSize - 14, inStream);
  14299. System.out.println(s9);
  14300. // if(l21 != 3)
  14301. // s9 = Censor.doCensor(s9);
  14302. int rights = l21;
  14303. if (rights >= 1)
  14304. System.out.println("Private message with rights: " + rights);
  14305.  
  14306. String crown = "";
  14307. if (l21 > 0 && l21 < modIcons.length) {
  14308. crown = "@cr" + l21 + "@";
  14309. }
  14310. if (crown.equals(""))
  14311. pushMessage(s9, 3, TextClass.fixName(TextClass.nameForLong(l5)));
  14312. else
  14313. pushMessage(s9, 7, crown + TextClass.fixName(TextClass.nameForLong(l5)));
  14314. } catch (Exception exception1) {
  14315. Signlink.reporterror("cde1");
  14316. }
  14317. pktType = -1;
  14318. return true;
  14319.  
  14320. case 85:
  14321. anInt1269 = inStream.method427();
  14322. anInt1268 = inStream.method427();
  14323. pktType = -1;
  14324. return true;
  14325.  
  14326. case 24:
  14327. anInt1054 = inStream.method428();
  14328. if (anInt1054 == tabID) {
  14329. if (anInt1054 == 3)
  14330. tabID = 1;
  14331. else
  14332. tabID = 3;
  14333. }
  14334. pktType = -1;
  14335. return true;
  14336.  
  14337. case 246:
  14338. int i6 = inStream.method434();
  14339. int i13 = inStream.readUnsignedWord();
  14340. int k18 = inStream.readUnsignedWord();
  14341. if (k18 == 65535) {
  14342. RSInterface.interfaceCache[i6].anInt233 = 0;
  14343. pktType = -1;
  14344. return true;
  14345. } else {
  14346. ItemDefinition itemDef = ItemDefinition.forID(k18);
  14347. RSInterface.interfaceCache[i6].anInt233 = 4;
  14348. RSInterface.interfaceCache[i6].mediaID = k18;
  14349. RSInterface.interfaceCache[i6].modelRotation1 = itemDef.modelRotationY;
  14350. RSInterface.interfaceCache[i6].modelRotation2 = itemDef.modelRotationX;
  14351. RSInterface.interfaceCache[i6].modelZoom = (itemDef.modelZoom * 100) / i13;
  14352. pktType = -1;
  14353. return true;
  14354. }
  14355.  
  14356. case 171:
  14357. int abyte01 = inStream.readUnsignedByte();
  14358. boolean flag1 = abyte01 == 1;
  14359. int j13 = inStream.readUnsignedWord();
  14360. RSInterface.interfaceCache[j13].hidden = flag1;
  14361. RSInterface.interfaceCache[j13].mouseOverTriggered = flag1;
  14362. pktType = -1;
  14363. return true;
  14364.  
  14365. case 142:
  14366. int j6 = inStream.method434();
  14367. openInterface(j6);
  14368. if (backDialogID != -1) {
  14369. backDialogID = -1;
  14370. inputTaken = true;
  14371. }
  14372. if (inputDialogState != 0) {
  14373. inputDialogState = 0;
  14374. inputTaken = true;
  14375. }
  14376. invOverlayInterfaceID = j6;
  14377. tabAreaAltered = true;
  14378. openInterfaceID = -1;
  14379. aBoolean1149 = false;
  14380. pktType = -1;
  14381. return true;
  14382.  
  14383. case 126:
  14384. String text = inStream.readString();
  14385. int frame = inStream.readShort();
  14386.  
  14387. if (frame == 5385 && text.equals("scrollreset")) {
  14388. RSInterface.interfaceCache[5385].scrollPosition = 0;
  14389. pktType = -1;
  14390. return true;
  14391. }
  14392. if (frame == 29450) {
  14393. if (text.contains("Owner:")) {
  14394. try {
  14395. clanchatOwner = text.substring(7);
  14396. if (clanchatOwner == "N/A") {
  14397. clanchatOwner = null;
  14398. }
  14399. } catch (Exception e) {
  14400. clanchatOwner = null;
  14401. }
  14402. }
  14403. }
  14404. if (text.startsWith("<font=")) {
  14405. int font = Integer.parseInt(text.substring(6, 7));
  14406. FontStyle fonts[] = { smallText, regularText, boldText, aTextDrawingArea_1273 };
  14407. RSInterface.interfaceCache[frame].textDrawingAreas = fonts[font];
  14408. text = text.substring(8);
  14409. } else if (text.startsWith("[SUMMO")) {
  14410. // hasFamiliar = Boolean.parseBoolean(text.substring(6));
  14411. pktType = -1;
  14412. return true;
  14413. } else if (text.startsWith("[UPDATEEREPORT")) {
  14414. // reportBox2Selected =
  14415. // text.equalsIgnoreCase("[UPDATEEREPORT 2]");
  14416. pktType = -1;
  14417. return true;
  14418. } else if (text.equals("[BUGREPORT]")) {
  14419. clearTopInterfaces();
  14420. reportAbuseInput = "";
  14421. // reasonForReport = "";
  14422. // playerReporting = "Bug";
  14423. canMute = false;
  14424. sendPacket185(9999);
  14425. // reportBox2Selected = true;
  14426. pktType = -1;
  14427. return true;
  14428. } else if (text.equals("[CLOSEMENU]") && frame == 0) {
  14429. menuOpen = false;
  14430. pktType = -1;
  14431. return true;
  14432. }
  14433. // if (frame == 0 && text.equals("resting"))
  14434. // resting = false;
  14435. if (text.startsWith("http://") || text.startsWith("www.")) {
  14436. launchURL(text);
  14437. pktType = -1;
  14438. return true;
  14439. }
  14440. if (text.startsWith("[REG]")) {
  14441. text = text.substring(4);
  14442. RSInterface.interfaceCache[frame
  14443. + 20000].disabledSprite = RSInterface.interfaceCache[frame + 20000].savedSprite[0];
  14444. updateStrings(text, frame);
  14445. sendFrame126(text, frame);
  14446. pktType = -1;
  14447. return true;
  14448. }
  14449. if (text.startsWith("[OWN]")) {
  14450. text = text.substring(4);
  14451. RSInterface.interfaceCache[frame
  14452. + 20000].disabledSprite = RSInterface.interfaceCache[frame + 20000].savedSprite[1];
  14453. updateStrings(text, frame);
  14454. sendFrame126(text, frame);
  14455. pktType = -1;
  14456. return true;
  14457. }
  14458. if (text.startsWith("[MOD]")) {
  14459. text = text.substring(4);
  14460. RSInterface.interfaceCache[frame
  14461. + 20000].disabledSprite = RSInterface.interfaceCache[frame + 20000].savedSprite[2];
  14462. updateStrings(text, frame);
  14463. sendFrame126(text, frame);
  14464. pktType = -1;
  14465. return true;
  14466. }
  14467. if (text.startsWith("[REC]")) {
  14468. text = text.substring(4);
  14469. RSInterface.interfaceCache[frame
  14470. + 20000].disabledSprite = RSInterface.interfaceCache[frame + 20000].savedSprite[3];
  14471. updateStrings(text, frame);
  14472. sendFrame126(text, frame);
  14473. pktType = -1;
  14474. return true;
  14475. }
  14476. if (text.startsWith("[COR]")) {
  14477. text = text.substring(4);
  14478. RSInterface.interfaceCache[frame
  14479. + 20000].disabledSprite = RSInterface.interfaceCache[frame + 20000].savedSprite[4];
  14480. updateStrings(text, frame);
  14481. sendFrame126(text, frame);
  14482. pktType = -1;
  14483. return true;
  14484. }
  14485. if (text.startsWith("[SER]")) {
  14486. text = text.substring(4);
  14487. RSInterface.interfaceCache[frame
  14488. + 20000].disabledSprite = RSInterface.interfaceCache[frame + 20000].savedSprite[5];
  14489. updateStrings(text, frame);
  14490. sendFrame126(text, frame);
  14491. pktType = -1;
  14492. return true;
  14493. }
  14494. if (text.startsWith("[LIE]")) {
  14495. text = text.substring(4);
  14496. RSInterface.interfaceCache[frame
  14497. + 20000].disabledSprite = RSInterface.interfaceCache[frame + 20000].savedSprite[6];
  14498. updateStrings(text, frame);
  14499. sendFrame126(text, frame);
  14500. pktType = -1;
  14501. return true;
  14502. }
  14503. if (text.startsWith("[BER]")) {
  14504. text = text.substring(4);
  14505. RSInterface.interfaceCache[frame
  14506. + 20000].disabledSprite = RSInterface.interfaceCache[frame + 20000].savedSprite[7];
  14507. updateStrings(text, frame);
  14508. sendFrame126(text, frame);
  14509. pktType = -1;
  14510. return true;
  14511. }
  14512. if (text.startsWith("[VR]")) {
  14513. text = text.substring(3);
  14514. RSInterface.interfaceCache[frame
  14515. + 20000].disabledSprite = RSInterface.interfaceCache[frame + 20000].savedSprite[8];
  14516. updateStrings(text, frame);
  14517. sendFrame126(text, frame);
  14518. pktType = -1;
  14519. return true;
  14520. }
  14521. if (text.startsWith("[FRI]")) {
  14522. text = text.substring(4);
  14523. RSInterface.interfaceCache[frame
  14524. + 20000].disabledSprite = RSInterface.interfaceCache[frame + 20000].savedSprite[9];
  14525. updateStrings(text, frame);
  14526. sendFrame126(text, frame);
  14527. pktType = -1;
  14528. return true;
  14529. }
  14530. if (frame == 47997) {
  14531. Recruits = "";
  14532. Recruits = text;
  14533. pktType = -1;
  14534. return true;
  14535. }
  14536. if (frame == 47996) {
  14537. Corporals = "";
  14538. Corporals = text;
  14539. pktType = -1;
  14540. return true;
  14541. }
  14542. if (frame == 47995) {
  14543. Sergeants = "";
  14544. Sergeants = text;
  14545. pktType = -1;
  14546. return true;
  14547. }
  14548. if (frame == 47994) {
  14549. Lieutenants = "";
  14550. Lieutenants = text;
  14551. pktType = -1;
  14552. return true;
  14553. }
  14554. if (frame == 47993) {
  14555. Captains = "";
  14556. Captains = text;
  14557. pktType = -1;
  14558. return true;
  14559. }
  14560. if (frame == 47992) {
  14561. Generals = "";
  14562. Generals = text;
  14563. pktType = -1;
  14564. return true;
  14565. }
  14566. if (text.startsWith("[UPDATE]")) {
  14567. slot = 44001;
  14568. for (int a = 0; a < friendsCount; a++) {
  14569. if (isRecruit("" + friendsList[a] + ""))
  14570. sendFrame126("Recruit", slot + 800);
  14571. else if (isCorporal("" + friendsList[a] + ""))
  14572. sendFrame126("Corporal", slot + 800);
  14573. else if (isSergeant("" + friendsList[a] + ""))
  14574. sendFrame126("Sergeant", slot + 800);
  14575. else if (isLieutenant("" + friendsList[a] + ""))
  14576. sendFrame126("Lieutenant", slot + 800);
  14577. else if (isCaptain("" + friendsList[a] + ""))
  14578. sendFrame126("Captain", slot + 800);
  14579. else if (isGeneral("" + friendsList[a] + ""))
  14580. sendFrame126("General", slot + 800);
  14581. else
  14582. sendFrame126("Not ranked", slot + 800);
  14583. sendFrame126(friendsList[a], slot);
  14584. slot++;
  14585. }
  14586. pktType = -1;
  14587. return true;
  14588. }
  14589. if (text.startsWith("[FI]")) {
  14590. // text = text.substring(4);
  14591. // otherPlayerId = Integer.parseInt(text);
  14592. pktType = -1;
  14593. return true;
  14594. }
  14595. if (frame == 57025) {
  14596. inputTaken = true;
  14597. inputDialogState = 0;
  14598. messagePromptRaised = true;
  14599. promptInput = text;
  14600. friendsListAction = 1;
  14601. aString1121 = "Enter name of player to add to friends list";
  14602. pktType = -1;
  14603. return true;
  14604. } else if (frame == 57028) {
  14605. inputTaken = true;
  14606. inputDialogState = 0;
  14607. messagePromptRaised = true;
  14608. promptInput = text;
  14609. friendsListAction = 4;
  14610. aString1121 = "Enter name of player to add to ignore list";
  14611. }
  14612. updateStrings(text, frame);
  14613. sendFrame126(text, frame);
  14614. if (frame >= 18144 && frame <= 18244) {
  14615. clanList[frame - 18144] = text;
  14616. }
  14617. pktType = -1;
  14618. return true;
  14619.  
  14620. case 206:
  14621. publicChatMode = inStream.readUnsignedByte();
  14622. privateChatMode = inStream.readUnsignedByte();
  14623. tradeMode = inStream.readUnsignedByte();
  14624. inputTaken = true;
  14625. pktType = -1;
  14626. return true;
  14627.  
  14628. case 240:
  14629. if (tabID == 12) {
  14630. }
  14631. weight = inStream.readSignedWord();
  14632. pktType = -1;
  14633. return true;
  14634.  
  14635. case 8:
  14636. int k6 = inStream.method436();
  14637. int l13 = inStream.readUnsignedWord();
  14638. RSInterface.interfaceCache[k6].anInt233 = 1;
  14639. RSInterface.interfaceCache[k6].mediaID = l13;
  14640. pktType = -1;
  14641. return true;
  14642.  
  14643. case 122:
  14644. int l6 = inStream.method436();
  14645. int i14 = inStream.method436();
  14646. int i19 = i14 >> 10 & 0x1f;
  14647. int i22 = i14 >> 5 & 0x1f;
  14648. int l24 = i14 & 0x1f;
  14649. RSInterface.interfaceCache[l6].textColor = (i19 << 19) + (i22 << 11) + (l24 << 3);
  14650. pktType = -1;
  14651. return true;
  14652.  
  14653. case 53:
  14654. int i7 = inStream.readUnsignedWord();
  14655. RSInterface class9_1 = RSInterface.interfaceCache[i7];
  14656. int j19 = inStream.readUnsignedWord();
  14657.  
  14658. if (class9_1 == null || class9_1.inv == null) {
  14659. Signlink.reporterror(
  14660. "Null item container - id - " + i7 + " last two packets - " + anInt842 + "," + anInt843);
  14661.  
  14662. for (int j22 = 0; j22 < j19; j22++) {
  14663. int i25 = inStream.readUnsignedByte();
  14664. if (i25 == 255)
  14665. i25 = inStream.method440();
  14666. inStream.method436();
  14667. }
  14668.  
  14669. pktType = -1;
  14670. return true;
  14671. }
  14672.  
  14673. if (class9_1.inv.length < j19 || class9_1.invStackSizes.length < j19) {
  14674. System.err.println("Item container out of bounds: " + i7 + " max length:"
  14675. + class9_1.invStackSizes.length + ", sent length: " + j19);
  14676.  
  14677. for (int j22 = 0; j22 < j19; j22++) {
  14678. int i25 = inStream.readUnsignedByte();
  14679. if (i25 == 255)
  14680. i25 = inStream.method440();
  14681. inStream.method436();
  14682. }
  14683.  
  14684. pktType = -1;
  14685. return true;
  14686. }
  14687.  
  14688. if (class9_1.inv.length != class9_1.invStackSizes.length) {
  14689. System.err.println("Mismatched inventory and stack size for interface: " + i7);
  14690.  
  14691. for (int j22 = 0; j22 < j19; j22++) {
  14692. int i25 = inStream.readUnsignedByte();
  14693. if (i25 == 255)
  14694. i25 = inStream.method440();
  14695. inStream.method436();
  14696. }
  14697.  
  14698. pktType = -1;
  14699. return true;
  14700. }
  14701.  
  14702. int item = -1;
  14703. for (int j22 = 0; j22 < j19; j22++) {
  14704. int i25 = inStream.readUnsignedByte();
  14705. if (i25 == 255)
  14706. i25 = inStream.method440();
  14707. item = inStream.method436();
  14708. class9_1.inv[j22] = item;
  14709. class9_1.invStackSizes[j22] = i25;
  14710. }
  14711.  
  14712. for (int j25 = j19; j25 < class9_1.inv.length && j25 < class9_1.invStackSizes.length; j25++) {
  14713. class9_1.inv[j25] = 0;
  14714. class9_1.invStackSizes[j25] = 0;
  14715. }
  14716.  
  14717. if (i7 == 24680) {
  14718. currentGEItem = item;
  14719. }
  14720.  
  14721. MikeysInterfaces.containerUpdated(i7);
  14722. pktType = -1;
  14723. return true;
  14724.  
  14725. case 230:
  14726. int j7 = inStream.method435();
  14727. int j14 = inStream.readUnsignedWord();
  14728. int k19 = inStream.readUnsignedWord();
  14729. int k22 = inStream.method436();
  14730. RSInterface.interfaceCache[j14].modelRotation1 = k19;
  14731. RSInterface.interfaceCache[j14].modelRotation2 = k22;
  14732. RSInterface.interfaceCache[j14].modelZoom = j7;
  14733. pktType = -1;
  14734. return true;
  14735.  
  14736. case 221:
  14737. anInt900 = inStream.readUnsignedByte();
  14738. pktType = -1;
  14739. return true;
  14740.  
  14741. case 177:
  14742. aBoolean1160 = true;
  14743. anInt995 = inStream.readUnsignedByte();
  14744. anInt996 = inStream.readUnsignedByte();
  14745. anInt997 = inStream.readUnsignedWord();
  14746. anInt998 = inStream.readUnsignedByte();
  14747. anInt999 = inStream.readUnsignedByte();
  14748. if (anInt999 >= 100) {
  14749. int k7 = anInt995 * 128 + 64;
  14750. int k14 = anInt996 * 128 + 64;
  14751. int i20 = method42(plane, k14, k7) - anInt997;
  14752. int l22 = k7 - xCameraPos;
  14753. int k25 = i20 - zCameraPos;
  14754. int j28 = k14 - yCameraPos;
  14755. int i30 = (int) Math.sqrt(l22 * l22 + j28 * j28);
  14756. yCameraCurve = (int) (Math.atan2(k25, i30) * 325.94900000000001D) & 0x7ff;
  14757. xCameraCurve = (int) (Math.atan2(l22, j28) * -325.94900000000001D) & 0x7ff;
  14758. if (yCameraCurve < 128)
  14759. yCameraCurve = 128;
  14760. if (yCameraCurve > 383)
  14761. yCameraCurve = 383;
  14762. }
  14763. pktType = -1;
  14764. return true;
  14765.  
  14766. case 249:
  14767. anInt1046 = inStream.method426();
  14768. unknownInt10 = inStream.method436();
  14769. pktType = -1;
  14770. return true;
  14771.  
  14772. case 65:
  14773. updateNPCs(inStream, pktSize);
  14774. pktType = -1;
  14775. return true;
  14776.  
  14777. case 187:
  14778. inputTitle = new String(inStream.readString());
  14779. messagePromptRaised = false;
  14780. inputDialogState = 2;
  14781. amountOrNameInput = "";
  14782. inputTaken = true;
  14783. pktType = -1;
  14784. return true;
  14785.  
  14786. case 97:
  14787. int l7 = inStream.readUnsignedWord();
  14788. openInterface(l7);
  14789. if (invOverlayInterfaceID != -1) {
  14790. invOverlayInterfaceID = -1;
  14791. tabAreaAltered = true;
  14792. }
  14793. if (backDialogID != -1) {
  14794. backDialogID = -1;
  14795. inputTaken = true;
  14796. }
  14797. if (inputDialogState != 0) {
  14798. inputDialogState = 0;
  14799. inputTaken = true;
  14800. }
  14801. openInterfaceID = l7;
  14802. aBoolean1149 = false;
  14803. pktType = -1;
  14804. return true;
  14805.  
  14806. case 218:
  14807. int i8 = inStream.method438();
  14808. dialogID = i8;
  14809. inputTaken = true;
  14810. pktType = -1;
  14811. return true;
  14812.  
  14813. case 87:
  14814. int j8 = inStream.method434();
  14815. int l14 = inStream.method439();
  14816. anIntArray1045[j8] = l14;
  14817. if (variousSettings[j8] != l14) {
  14818. variousSettings[j8] = l14;
  14819. method33(j8);
  14820. if (dialogID != -1)
  14821. inputTaken = true;
  14822. }
  14823. MikeysInterfaces.configPacket(j8, l14);
  14824. pktType = -1;
  14825. return true;
  14826.  
  14827. case 36:
  14828. int k8 = inStream.ig2();
  14829. byte byte0 = inStream.readSignedByte();
  14830.  
  14831. anIntArray1045[k8] = byte0;
  14832. if (variousSettings[k8] != byte0) {
  14833. variousSettings[k8] = byte0;
  14834. method33(k8);
  14835. if (dialogID != -1)
  14836. inputTaken = true;
  14837. }
  14838.  
  14839. MikeysInterfaces.configPacket(k8, byte0);
  14840. pktType = -1;
  14841. return true;
  14842.  
  14843. case 37:/// XXX: new packet for key binds
  14844. for (int j12 = 0; j12 < 14; j12++) {
  14845. int bind = inStream.readUnsignedByte();
  14846. keybinds[j12] = bind;
  14847. int index = 64_437 + (j12 * 3);
  14848. RSInterface.interfaceCache[index].message = bind == 0 ? "Click to set"
  14849. : bind == 64 ? "Escape" : "F" + bind;
  14850. }
  14851. pktType = -1;
  14852. return true;
  14853.  
  14854. case 38:/// XXX: ruse packet
  14855. /*
  14856. * int auto = inStream.readUnsignedWord(); if (auto == -1) {
  14857. * autoCast = false; autocastId = 0; } else { autoCast = true;
  14858. * autocastId = auto; }
  14859. */
  14860. pktType = -1;
  14861. return true;
  14862.  
  14863. case 108:
  14864. /// XXX: ruse packet
  14865. /* specActivated = */inStream.readUnsignedByte()/* == 1 */;
  14866. pktType = -1;
  14867. return true;
  14868.  
  14869. case 103:
  14870. /// XXX: ruse packet
  14871. /* doingDung = */inStream.readUnsignedByte()/* == 1 */;
  14872. pktType = -1;
  14873. return true;
  14874.  
  14875. case 111:
  14876. /// XXX: ruse packet
  14877. /* currentSpec = */inStream.readUnsignedByte();
  14878. pktType = -1;
  14879. return true;
  14880.  
  14881. case 112:
  14882. /// XXX: ruse packet
  14883. /* ironman = */inStream.readUnsignedByte();
  14884. pktType = -1;
  14885. return true;
  14886.  
  14887. case 115:/// XXX: ruse packet
  14888. showClanOptions = inStream.readUnsignedByte();
  14889. updateClanChatTab();
  14890. pktType = -1;
  14891. return true;
  14892.  
  14893. case 45:
  14894. /// XXX: ruse packet
  14895. /* long totalxp = */inStream.readQWord();
  14896. // int totalXP = totalxp;
  14897. // blockXPGain = false;
  14898. pktType = -1;
  14899. return true;
  14900.  
  14901. case 124:/// XXX: ruse packet
  14902. int skillID = inStream.readUnsignedByte();
  14903. int gainedXP = inStream.readDWord();
  14904. ExperienceCounter.skillUpdated(skillID, gainedXP);
  14905. pktType = -1;
  14906. return true;
  14907.  
  14908. case 113:
  14909. /// XXX: ruse packet
  14910. /* running = */inStream.readUnsignedByte()/* > 0 */;
  14911. // variousSettings[173] = running ? 1 : 0;
  14912. pktType = -1;
  14913. return true;
  14914.  
  14915. case 244:/// XXX: ruse packet
  14916. String data = inStream.readString();
  14917. int geSlot = Integer.parseInt(data.substring(data.indexOf("<") + 1, data.indexOf(">")));
  14918. int geData = -1;
  14919. if (data.contains("slotaborted")) {
  14920. slotAborted[geSlot] = true;
  14921. }
  14922. if (data.contains("slotselected")) {
  14923. slotSelected = geSlot;
  14924. }
  14925. if (data.contains("resetslot")) {
  14926. slots[geSlot] = "";
  14927. Slots[geSlot] = 0;
  14928. slotColorPercent[geSlot] = 0;
  14929. slotAborted[geSlot] = false;
  14930. }
  14931. if (data.contains("slotsell")) {
  14932. geData = Integer.parseInt(data.substring(data.indexOf("[") + 1, data.indexOf("]")));
  14933. slots[geSlot] = "Sell";
  14934. Slots[geSlot] = geData;
  14935. slotAborted[geSlot] = false;
  14936. slotColorPercent[geSlot] = 0;
  14937. }
  14938. if (data.contains("item")) {
  14939. int itemId = Integer.parseInt(data.substring(data.indexOf("#") + 1, data.lastIndexOf("#")));
  14940. slotItems[geSlot] = itemId;
  14941. }
  14942. if (data.contains("slotbuy")) {
  14943. geData = Integer.parseInt(data.substring(data.indexOf("[") + 1, data.indexOf("]")));
  14944. slots[geSlot] = "Buy";
  14945. Slots[geSlot] = geData;
  14946. slotAborted[geSlot] = false;
  14947. slotColorPercent[geSlot] = 0;
  14948. }
  14949. if (data.contains("slotpercent")) {
  14950. geData = Integer.parseInt(data.substring(data.indexOf("{") + 1, data.indexOf("}")));
  14951. slotColorPercent[geSlot] = geData;
  14952. }
  14953. pktType = -1;
  14954. return true;
  14955.  
  14956. case 61:
  14957. anInt1055 = inStream.readUnsignedByte();
  14958. pktType = -1;
  14959. return true;
  14960.  
  14961. case 200:
  14962. int l8 = inStream.readUnsignedWord();
  14963. int i15 = inStream.readSignedWord();
  14964. RSInterface class9_4 = RSInterface.interfaceCache[l8];
  14965. class9_4.anInt257 = i15;
  14966. class9_4.modelZoom = 2000;/// XXX: hardcoded ruse fix for big
  14967. /// dialogue heads
  14968. pktType = -1;
  14969. return true;
  14970.  
  14971. case 219:
  14972. if (invOverlayInterfaceID != -1) {
  14973. invOverlayInterfaceID = -1;
  14974. tabAreaAltered = true;
  14975. }
  14976. if (backDialogID != -1) {
  14977. backDialogID = -1;
  14978. inputTaken = true;
  14979. }
  14980. if (inputDialogState != 0) {
  14981. inputDialogState = 0;
  14982. inputTaken = true;
  14983. }
  14984. openInterfaceID = -1;
  14985. aBoolean1149 = false;
  14986. pktType = -1;
  14987. return true;
  14988.  
  14989. case 34:
  14990. int i9 = inStream.readUnsignedWord();
  14991. RSInterface class9_2 = RSInterface.interfaceCache[i9];
  14992. while (inStream.currentOffset < pktSize) {
  14993. int j20 = inStream.method422();
  14994. int i23 = inStream.readUnsignedWord();
  14995. int l25 = inStream.readUnsignedByte();
  14996. if (l25 == 255)
  14997. l25 = inStream.readDWord();
  14998. if (j20 >= 0 && j20 < class9_2.inv.length) {
  14999. class9_2.inv[j20] = i23;
  15000. class9_2.invStackSizes[j20] = l25;
  15001. }
  15002. }
  15003. MikeysInterfaces.containerUpdated(i9);
  15004. pktType = -1;
  15005. return true;
  15006.  
  15007. case 4:
  15008. case 44:
  15009. case 84:
  15010. case 101:
  15011. case 105:
  15012. case 117:
  15013. case 147:
  15014. case 151:
  15015. case 156:
  15016. case 160:
  15017. case 215:
  15018. method137(inStream, pktType);
  15019. pktType = -1;
  15020. return true;
  15021.  
  15022. case 106:
  15023. tabID = inStream.method427();
  15024. tabAreaAltered = true;
  15025. pktType = -1;
  15026. return true;
  15027.  
  15028. case 164:
  15029. int j9 = inStream.method434();
  15030. openInterface(j9);
  15031. if (invOverlayInterfaceID != -1) {
  15032. invOverlayInterfaceID = -1;
  15033. tabAreaAltered = true;
  15034. }
  15035. backDialogID = j9;
  15036. inputTaken = true;
  15037. openInterfaceID = -1;
  15038. aBoolean1149 = false;
  15039. pktType = -1;
  15040. return true;
  15041.  
  15042. }
  15043. Signlink.reporterror("T1 - " + pktType + "," + pktSize + " - " + anInt842 + "," + anInt843);
  15044. // resetLogout();
  15045. } catch (IOException _ex) {
  15046. dropClient();
  15047. } catch (Exception exception) {
  15048. String s2 = "T2 - " + pktType + "," + anInt842 + "," + anInt843 + " - " + pktSize + ","
  15049. + (baseX + myPlayer.smallX[0]) + "," + (baseY + myPlayer.smallY[0]) + " - ";
  15050. for (int j15 = 0; j15 < pktSize && j15 < 50; j15++)
  15051. s2 = s2 + inStream.buffer[j15] + ",";
  15052. Signlink.reporterror(s2);
  15053. exception.printStackTrace();
  15054. resetLogout();
  15055. }
  15056. pktType = -1;
  15057. return true;
  15058. }
  15059.  
  15060. private void method146() {
  15061. anInt1265++;
  15062. method47(true);
  15063. method26(true);
  15064. method47(false);
  15065. method26(false);
  15066. method55();
  15067. method104();
  15068. if (!aBoolean1160) {
  15069. int i = anInt1184;
  15070. if (anInt984 / 256 > i)
  15071. i = anInt984 / 256;
  15072. if (aBooleanArray876[4] && anIntArray1203[4] + 128 > i)
  15073. i = anIntArray1203[4] + 128;
  15074. int k = minimapInt1 + anInt896 & 0x7ff;
  15075. setCameraPos(
  15076. cameraZoom + i * ((WorldController.viewDistance == 9) && (frameMode == ScreenMode.RESIZABLE) ? 2
  15077. : WorldController.viewDistance == 10 ? 5 : 3),
  15078. i, anInt1014, method42(plane, myPlayer.y, myPlayer.x) - 50, k, anInt1015);
  15079. }
  15080. int j;
  15081. if (!aBoolean1160)
  15082. j = method120();
  15083. else
  15084. j = method121();
  15085. int l = xCameraPos;
  15086. int i1 = zCameraPos;
  15087. int j1 = yCameraPos;
  15088. int k1 = yCameraCurve;
  15089. int l1 = xCameraCurve;
  15090. for (int i2 = 0; i2 < 5; i2++)
  15091. if (aBooleanArray876[i2]) {
  15092. int j2 = (int) ((Math.random() * (double) (anIntArray873[i2] * 2 + 1) - (double) anIntArray873[i2])
  15093. + Math.sin((double) anIntArray1030[i2] * ((double) anIntArray928[i2] / 100D))
  15094. * (double) anIntArray1203[i2]);
  15095. if (i2 == 0)
  15096. xCameraPos += j2;
  15097. if (i2 == 1)
  15098. zCameraPos += j2;
  15099. if (i2 == 2)
  15100. yCameraPos += j2;
  15101. if (i2 == 3)
  15102. xCameraCurve = xCameraCurve + j2 & 0x7ff;
  15103. if (i2 == 4) {
  15104. yCameraCurve += j2;
  15105. if (yCameraCurve < 128)
  15106. yCameraCurve = 128;
  15107. if (yCameraCurve > 383)
  15108. yCameraCurve = 383;
  15109. }
  15110. }
  15111. int k2 = Texture.anInt1481;
  15112. Model.aBoolean1684 = true;
  15113. Model.anInt1687 = 0;
  15114. Model.anInt1685 = super.mouseX - (frameMode == ScreenMode.FIXED ? 4 : 0);
  15115. Model.anInt1686 = super.mouseY - (frameMode == ScreenMode.FIXED ? 4 : 0);
  15116. DrawingArea.setAllPixelsToZero();
  15117. worldController.method313(xCameraPos, yCameraPos, xCameraCurve, zCameraPos, j, yCameraCurve);
  15118. worldController.clearObj5Cache();
  15119.  
  15120. if (ClientSettings.getBoolean("fog")) {
  15121. double fogDistance = Math.sqrt(Math.pow(zCameraPos, 2));
  15122. int distance = 1325;
  15123. if (!fixed())
  15124. distance = 800;
  15125. if (WorldController.viewDistance == 10)
  15126. distance = 1000;
  15127. int fogStartDistance = distance;
  15128. int fogEndDistance = distance + 750;
  15129. fog.setFogDistance((float) fogDistance);
  15130. fog.renderFog(fogStartDistance, fogEndDistance, 3);
  15131. }
  15132.  
  15133. updateEntities();
  15134. drawHeadIcon();
  15135. method37(k2);
  15136. draw3dScreen();
  15137. if (frameMode != ScreenMode.FIXED) {
  15138. gameframe.drawChatArea();
  15139. gameframe.drawMinimap();
  15140. gameframe.drawTabArea();
  15141. // gameframe.drawCoinsInPouch();
  15142. }
  15143. aRSImageProducer_1165.drawGraphics(frameMode == ScreenMode.FIXED ? 4 : 0, super.graphics,
  15144. frameMode == ScreenMode.FIXED ? 4 : 0);
  15145. xCameraPos = l;
  15146. zCameraPos = i1;
  15147. yCameraPos = j1;
  15148. yCameraCurve = k1;
  15149. xCameraCurve = l1;
  15150. }
  15151.  
  15152. public void clearTopInterfaces() {
  15153. stream.createFrame(130);
  15154. if (invOverlayInterfaceID != -1) {
  15155. invOverlayInterfaceID = -1;
  15156. aBoolean1149 = false;
  15157. tabAreaAltered = true;
  15158. }
  15159. if (backDialogID != -1) {
  15160. backDialogID = -1;
  15161. inputTaken = true;
  15162. aBoolean1149 = false;
  15163. }
  15164. openInterfaceID = -1;
  15165. fullscreenInterfaceID = -1;
  15166. }
  15167.  
  15168. public Client() {
  15169. fullscreenInterfaceID = -1;
  15170. chatRights = new int[500];
  15171. chatTitle = new String[500];
  15172. chatPosition = new int[500];
  15173. chatTypeView = 0;
  15174. clanChatMode = 0;
  15175. anIntArrayArray825 = new int[104][104];
  15176. friendsNodeIDs = new int[200];
  15177. groundArray = new NodeList[4][104][104];
  15178. aBoolean831 = false;
  15179. aStream_834 = new RSBuffer(new byte[5000]);
  15180. npcArray = new Npc[16384];
  15181. npcIndices = new int[16384];
  15182. anIntArray840 = new int[1000];
  15183. aStream_847 = RSBuffer.create();
  15184. aBoolean848 = true;
  15185. openInterfaceID = -1;
  15186. currentExp = new int[Skills.skillsCount];
  15187. aBoolean872 = false;
  15188. anIntArray873 = new int[5];
  15189. aBooleanArray876 = new boolean[5];
  15190. drawFlames = false;
  15191. reportAbuseInput = "";
  15192. unknownInt10 = -1;
  15193. menuOpen = false;
  15194. inputString = "";
  15195. uuid = "";
  15196. maxPlayers = 2048;
  15197. myPlayerIndex = 2047;
  15198. playerArray = new Player[maxPlayers];
  15199. playerIndices = new int[maxPlayers];
  15200. anIntArray894 = new int[maxPlayers];
  15201. aStreamArray895s = new RSBuffer[maxPlayers];
  15202. anInt897 = 1;
  15203. anIntArrayArray901 = new int[104][104];
  15204. aByteArray912 = new byte[16384];
  15205. currentStats = new int[Skills.skillsCount];
  15206. ignoreListAsLongs = new long[100];
  15207. loadingError = false;
  15208. anIntArray928 = new int[5];
  15209. anIntArrayArray929 = new int[104][104];
  15210. chatTypes = new int[500];
  15211. chatNames = new String[500];
  15212. chatMessages = new String[500];
  15213. sideIcons = new Sprite[15];
  15214. aBoolean954 = true;
  15215. friendsListAsLongs = new long[200];
  15216. currentSong = -1;
  15217. drawingFlames = false;
  15218. spriteDrawX = -1;
  15219. spriteDrawY = -1;
  15220. anIntArray968 = new int[33];
  15221. anIntArray969 = new int[256];
  15222. decompressors = new Decompressor[10];
  15223. variousSettings = new int[3000];
  15224. aBoolean972 = false;
  15225. anInt975 = 50;
  15226. anIntArray976 = new int[anInt975];
  15227. anIntArray977 = new int[anInt975];
  15228. anIntArray978 = new int[anInt975];
  15229. anIntArray979 = new int[anInt975];
  15230. anIntArray980 = new int[anInt975];
  15231. anIntArray981 = new int[anInt975];
  15232. anIntArray982 = new int[anInt975];
  15233. aStringArray983 = new String[anInt975];
  15234. anInt985 = -1;
  15235. hitMarks = new Sprite[5];
  15236. anIntArray990 = new int[5];
  15237. aBoolean994 = false;
  15238. amountOrNameInput = "";
  15239. aClass19_1013 = new NodeList();
  15240. aBoolean1017 = false;
  15241. walkableInterfaceId = -1;
  15242. anIntArray1030 = new int[5];
  15243. aBoolean1031 = false;
  15244. mapFunctions = new Sprite[100];
  15245. dialogID = -1;
  15246. maxStats = new int[Skills.skillsCount];
  15247. anIntArray1045 = new int[3000];
  15248. aBoolean1047 = true;
  15249. anIntArray1052 = new int[256];
  15250. anIntArray1229 = new int[256];
  15251. anInt1054 = -1;
  15252. aClass19_1056 = new NodeList();
  15253. anIntArray1057 = new int[33];
  15254. aClass9_1059 = new RSInterface();
  15255. mapScenes = new Background[100];
  15256. barFillColor = 0x4d4233;
  15257. anIntArray1065 = new int[7];
  15258. anIntArray1072 = new int[1000];
  15259. anIntArray1073 = new int[1000];
  15260. aBoolean1080 = false;
  15261. friendsList = new String[200];
  15262. inStream = RSBuffer.create();
  15263. expectedCRCs = new int[9];
  15264. menuActionCmd2 = new int[500];
  15265. menuActionCmd3 = new int[500];
  15266. menuActionCmd4 = new int[500];
  15267. menuActionID = new int[500];
  15268. menuActionCmd1 = new int[500];
  15269. headIcons = new Sprite[20];
  15270. skullIcons = new Sprite[20];
  15271. headIconsHint = new Sprite[20];
  15272. tabAreaAltered = false;
  15273. aString1121 = "";
  15274. atPlayerActions = new String[5];
  15275. atPlayerArray = new boolean[5];
  15276. anIntArrayArrayArray1129 = new int[4][13][13];
  15277. anInt1132 = 2;
  15278. aClass30_Sub2_Sub1_Sub1Array1140 = new Sprite[1000];
  15279. aBoolean1141 = false;
  15280. aBoolean1149 = false;
  15281. crosses = new Sprite[8];
  15282. musicEnabled = true;
  15283. loggedIn = false;
  15284. canMute = false;
  15285. aBoolean1159 = false;
  15286. aBoolean1160 = false;
  15287. anInt1171 = 1;
  15288. // myUsername = "";
  15289. myPassword = "";
  15290. myAuth = "";
  15291. genericLoadingError = false;
  15292. reportAbuseInterfaceID = -1;
  15293. aClass19_1179 = new NodeList();
  15294. anInt1184 = 128;
  15295. invOverlayInterfaceID = -1;
  15296. stream = RSBuffer.create();
  15297. menuActionName = new String[500];
  15298. anIntArray1203 = new int[5];
  15299. anIntArray1207 = new int[50];
  15300. anInt1210 = 2;
  15301. anInt1211 = 78;
  15302. promptInput = "";
  15303. modIcons = new Sprite[19];
  15304. tabID = 3;
  15305. inputTaken = false;
  15306. songChanging = true;
  15307. aClass11Array1230 = new Class11[4];
  15308. anIntArray1241 = new int[50];
  15309. aBoolean1242 = false;
  15310. anIntArray1250 = new int[50];
  15311. rsAlreadyLoaded = false;
  15312. welcomeScreenRaised = false;
  15313. messagePromptRaised = false;
  15314. loginMessage1 = "";
  15315. loginMessage2 = "";
  15316. backDialogID = -1;
  15317. anInt1279 = 2;
  15318. bigX = new int[4000];
  15319. bigY = new int[4000];
  15320.  
  15321. /*
  15322. * Add local world if not running from a jar.
  15323. */
  15324. currentWorld = 1;
  15325. if (!getClass().getResource("/" + getClass().getName().replace('.', '/') + ".class").toString()
  15326. .startsWith("jar:")) {
  15327. Configuration.WORLDS.add(new World("Local Server", "127.0.0.1"));
  15328. //currentWorld = Configuration.WORLDS.size();
  15329. }
  15330. }
  15331.  
  15332. public World getCurrentWorld() {
  15333. return Configuration.WORLDS.get(currentWorld - 1);
  15334. }
  15335.  
  15336. public int rights;
  15337. public String name;
  15338. public String message;
  15339. public String clanname;
  15340. private final int[] chatRights;
  15341. public final String[] chatTitle;
  15342. public final int[] chatPosition;
  15343. public int chatTypeView;
  15344. public int clanChatMode;
  15345. // public static Sprite[] extSprites;
  15346. public static Sprite[] loginSprites;
  15347. public static Sprite[] cacheSprites;
  15348. public static Sprite[] cacheSprites2;
  15349. public static Sprite[] cacheSprites3;
  15350. private ImageProducer leftFrame;
  15351. private ImageProducer topFrame;
  15352. private int ignoreCount;
  15353. private long aLong824;
  15354. private int[][] anIntArrayArray825;
  15355. public int[] friendsNodeIDs;
  15356. public NodeList[][][] groundArray;
  15357. private int[] anIntArray828;
  15358. private int[] anIntArray829;
  15359. private volatile boolean aBoolean831;
  15360. private Socket aSocket832;
  15361. private int loginScreenState;
  15362. private RSBuffer aStream_834;
  15363. public Npc[] npcArray;
  15364. public int npcCount;
  15365. public int[] npcIndices;
  15366. private int anInt839;
  15367. private int[] anIntArray840;
  15368. private int anInt841;
  15369. private int anInt842;
  15370. private int anInt843;
  15371. public String aString844;
  15372. public String prayerBook;
  15373. public int privateChatMode;
  15374. public int gameChatMode;
  15375. private RSBuffer aStream_847;
  15376. private boolean aBoolean848;
  15377. private static int anInt849;
  15378. private int[] anIntArray850;
  15379. private int[] anIntArray851;
  15380. private int[] anIntArray852;
  15381. private int[] anIntArray853;
  15382. private static int anInt854;
  15383. public int anInt855;
  15384. public int openInterfaceID;
  15385. private int xCameraPos;
  15386. private int zCameraPos;
  15387. private int yCameraPos;
  15388. private int yCameraCurve;
  15389. private int xCameraCurve;
  15390. public int myPrivilege;
  15391. public final int[] currentExp;
  15392. public Sprite mapFlag;
  15393. public Sprite mapMarker;
  15394. private boolean aBoolean872;
  15395. private final int[] anIntArray873;
  15396. private final boolean[] aBooleanArray876;
  15397. private int weight;
  15398. private MouseDetection mouseDetection;
  15399. private volatile boolean drawFlames;
  15400. String reportAbuseInput;
  15401. private int unknownInt10;
  15402. public boolean menuOpen;
  15403. private int anInt886;
  15404. public static String inputString;
  15405. private final int maxPlayers;
  15406. public final int myPlayerIndex;
  15407. public Player[] playerArray;
  15408. public int playerCount;
  15409. public int[] playerIndices;
  15410. private int anInt893;
  15411. private int[] anIntArray894;
  15412. private RSBuffer[] aStreamArray895s;
  15413. private int anInt896;
  15414. public int anInt897;
  15415. public int friendsCount;
  15416. private int anInt900;
  15417. private int[][] anIntArrayArray901;
  15418. private byte[] aByteArray912;
  15419. private int anInt913;
  15420. private int crossX;
  15421. private int crossY;
  15422. private int crossIndex;
  15423. private int crossType;
  15424. public int plane;
  15425. public final int[] currentStats;
  15426. private static int anInt924;
  15427. private long[] ignoreListAsLongs;
  15428. private boolean loadingError;
  15429. private final int[] anIntArray928;
  15430. private int[][] anIntArrayArray929;
  15431. private Sprite aClass30_Sub2_Sub1_Sub1_931;
  15432. private Sprite aClass30_Sub2_Sub1_Sub1_932;
  15433. public int anInt933;
  15434. public int anInt934;
  15435. public int anInt935;
  15436. private int anInt936;
  15437. private int anInt937;
  15438. private int anInt938;
  15439. public final int[] chatTypes;
  15440. public final String[] chatNames;
  15441. public final String[] chatMessages;
  15442. private int anInt945;
  15443. private WorldController worldController;
  15444. private Sprite[] sideIcons;
  15445. private int menuScreenArea;
  15446. private int menuOffsetX;
  15447. private int menuOffsetY;
  15448. private int menuWidth;
  15449. private int menuHeight;
  15450. private long aLong953;
  15451. private boolean aBoolean954;
  15452. public long[] friendsListAsLongs;
  15453. public static String uuid;
  15454. private String[] clanList = new String[100];
  15455. private int currentSong;
  15456. private static int nodeID = 10;
  15457. public static int portOff;
  15458. static boolean clientData;
  15459. private static boolean isMembers = true;
  15460. private static boolean lowMem;
  15461. private volatile boolean drawingFlames;
  15462. private int spriteDrawX;
  15463. private int spriteDrawY;
  15464. private final int[] anIntArray965 = { 0xffff00, 0xff0000, 65280, 65535, 0xff00ff, 0xffffff };
  15465. private Background aBackground_966;
  15466. private Background aBackground_967;
  15467. public final int[] anIntArray968;
  15468. private final int[] anIntArray969;
  15469. public final Decompressor[] decompressors;
  15470. public int variousSettings[];
  15471. private boolean aBoolean972;
  15472. private final int anInt975;
  15473. private final int[] anIntArray976;
  15474. private final int[] anIntArray977;
  15475. private final int[] anIntArray978;
  15476. private final int[] anIntArray979;
  15477. private final int[] anIntArray980;
  15478. private final int[] anIntArray981;
  15479. private final int[] anIntArray982;
  15480. private final String[] aStringArray983;
  15481. private int anInt984;
  15482. private int anInt985;
  15483. private static int anInt986;
  15484. private Sprite[] hitMarks;
  15485. public int anInt988;
  15486. private int anInt989;
  15487. private final int[] anIntArray990;
  15488. private final boolean aBoolean994;
  15489. private int anInt995;
  15490. private int anInt996;
  15491. private int anInt997;
  15492. private int anInt998;
  15493. private int anInt999;
  15494. private IsaacRandomGenerator encryption;
  15495. private Sprite multiOverlay;
  15496. public static final int[][] anIntArrayArray1003 = {
  15497. { 6798, 107, 10283, 16, 4797, 7744, 5799, 4634, 33697, 22433, 2983, 54193 },
  15498. { 8741, 12, 64030, 43162, 7735, 8404, 1701, 38430, 24094, 10153, 56621, 4783, 1341, 16578, 35003, 25239 },
  15499. { 25238, 8742, 12, 64030, 43162, 7735, 8404, 1701, 38430, 24094, 10153, 56621, 4783, 1341, 16578, 35003 },
  15500. { 4626, 11146, 6439, 12, 4758, 10270 }, { 4550, 4537, 5681, 5673, 5790, 6806, 8076, 4574 } };
  15501. public String amountOrNameInput;
  15502. private static int anInt1005;
  15503. private int daysSinceLastLogin;
  15504. private int pktSize;
  15505. private int pktType;
  15506. private int anInt1009;
  15507. private int anInt1010;
  15508. private int anInt1011;
  15509. private NodeList aClass19_1013;
  15510. private int anInt1014;
  15511. private int anInt1015;
  15512. private int anInt1016;
  15513. private boolean aBoolean1017;
  15514. public int walkableInterfaceId;
  15515. public static final int[] experienceForLevels;
  15516. public int anInt1021;
  15517. private int anInt1022;
  15518. public int loadingStage;
  15519. private Sprite scrollBar1;
  15520. private Sprite scrollBar2;
  15521. private int anInt1026;
  15522. private final int[] anIntArray1030;
  15523. private boolean aBoolean1031;
  15524. private Sprite[] mapFunctions;
  15525. public int baseX;
  15526. public int baseY;
  15527. private int anInt1036;
  15528. private int anInt1037;
  15529. private int loginFailures;
  15530. private int anInt1039;
  15531. private int anInt1040;
  15532. private int anInt1041;
  15533. public int dialogID;
  15534. public final int[] maxStats;
  15535. private final int[] anIntArray1045;
  15536. private int anInt1046;
  15537. private boolean aBoolean1047;
  15538. private int anInt1048;
  15539. // private String aString1049;
  15540. private static int anInt1051;
  15541. public final int[] anIntArray1052;
  15542. private StreamLoader titleStreamLoader;
  15543. public int anInt1054;
  15544. private int anInt1055;
  15545. private NodeList aClass19_1056;
  15546. public final int[] anIntArray1057;
  15547. public final RSInterface aClass9_1059;
  15548. private Background[] mapScenes;
  15549. private int anInt1062;
  15550. private final int barFillColor;
  15551. private int friendsListAction;
  15552. private final int[] anIntArray1065;
  15553. private int mouseInvInterfaceIndex;
  15554. private int lastActiveInvInterface;
  15555. public OnDemandFetcher onDemandFetcher;
  15556. private int anInt1069;
  15557. private int anInt1070;
  15558. public int anInt1071;
  15559. public int[] anIntArray1072;
  15560. public int[] anIntArray1073;
  15561. public Sprite mapDotItem;
  15562. public Sprite mapDotNPC;
  15563. public Sprite mapDotPlayer;
  15564. public Sprite mapDotFriend;
  15565. public Sprite mapDotTeam;
  15566. Sprite mapDotClan;
  15567. // private int anInt1079;
  15568. private boolean aBoolean1080;
  15569. private String[] friendsList;
  15570. RSBuffer inStream;
  15571. private int anInt1084;
  15572. private int anInt1085;
  15573. private int activeInterfaceType;
  15574. private int anInt1087;
  15575. private int anInt1088;
  15576. public int anInt1089;
  15577. public static int spellID = 0;
  15578. public static int totalRead = 0;
  15579. private final int[] expectedCRCs;
  15580. public int[] menuActionCmd2;
  15581. public int[] menuActionCmd3;
  15582. public int[] menuActionCmd4;
  15583. public int[] menuActionID;
  15584. int[] menuActionCmd1;
  15585. private Sprite[] headIcons;
  15586. private Sprite[] skullIcons;
  15587. private Sprite[] headIconsHint;
  15588. private static int anInt1097;
  15589. private int anInt1098;
  15590. private int anInt1099;
  15591. private int anInt1100;
  15592. private int anInt1101;
  15593. private int anInt1102;
  15594. static boolean tabAreaAltered;
  15595. private int anInt1104;
  15596. private ImageProducer aRSImageProducer_1107;
  15597. private ImageProducer aRSImageProducer_1108;
  15598. private ImageProducer aRSImageProducer_1109;
  15599. private ImageProducer aRSImageProducer_1110;
  15600. private ImageProducer aRSImageProducer_1111;
  15601. private ImageProducer aRSImageProducer_1112;
  15602. private ImageProducer aRSImageProducer_1113;
  15603. private ImageProducer aRSImageProducer_1114;
  15604. private ImageProducer aRSImageProducer_1115;
  15605. private static int anInt1117;
  15606. private int membersInt;
  15607. public String aString1121;
  15608. public String inputTitle;
  15609. public Sprite compass;
  15610. private ImageProducer aRSImageProducer_1125;
  15611. public static Player myPlayer;
  15612. private final String[] atPlayerActions;
  15613. private final boolean[] atPlayerArray;
  15614. private final int[][][] anIntArrayArrayArray1129;
  15615. public final int[] tabInterfaceIDs = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 };
  15616. private int anInt1131;
  15617. public int anInt1132;
  15618. public int menuActionRow;
  15619. private static int anInt1134;
  15620. private int spellSelected;
  15621. private int anInt1137;
  15622. private int spellUsableOn;
  15623. private String spellTooltip;
  15624. public Sprite[] aClass30_Sub2_Sub1_Sub1Array1140;
  15625. private boolean aBoolean1141;
  15626. private static int anInt1142;
  15627. public int energy;
  15628. private boolean aBoolean1149;
  15629. private Sprite[] crosses;
  15630. private boolean musicEnabled;
  15631. private Background[] aBackgroundArray1152s;
  15632. private int unreadMessages;
  15633. private static int anInt1155;
  15634. private static boolean fpsOn;
  15635. public static boolean loggedIn;
  15636. boolean canMute;
  15637. private boolean aBoolean1159;
  15638. private boolean aBoolean1160;
  15639. public static int loopCycle;
  15640. private static final String validUserPassChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!\"\243$%^&*()-_=+[{]};:'@#~,<.>/?\\| ";
  15641. public ImageProducer aRSImageProducer_1163;
  15642. public ImageProducer aRSImageProducer_1164;
  15643. public ImageProducer aRSImageProducer_1165;
  15644. public ImageProducer aRSImageProducer_1166;
  15645. private int daysSinceRecovChange;
  15646. private RSSocket socketStream;
  15647. private int anInt1169;
  15648. public int minimapInt3;
  15649. public int anInt1171;
  15650. public String myUsername = "";
  15651. private String myPassword;
  15652. private String myAuth;
  15653. private boolean rememberPin = false;
  15654. private static int anInt1175;
  15655. private boolean genericLoadingError;
  15656. 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 };
  15657. int reportAbuseInterfaceID;
  15658. private NodeList aClass19_1179;
  15659. public int[] anIntArray1180;
  15660. public int[] anIntArray1181;
  15661. public int[] anIntArray1182;
  15662. private byte[][] aByteArrayArray1183;
  15663. private int anInt1184;
  15664. public int minimapInt1;
  15665. private int anInt1186;
  15666. private int anInt1187;
  15667. private static int anInt1188;
  15668. public int invOverlayInterfaceID;
  15669. private int[] anIntArray1190;
  15670. private int[] anIntArray1191;
  15671. public RSBuffer stream;
  15672. private int anInt1193;
  15673. public int splitPrivateChat;
  15674. public Background mapBack;
  15675. private Background mapBack2;
  15676. public String[] menuActionName;
  15677. private Sprite aClass30_Sub2_Sub1_Sub1_1201;
  15678. private Sprite aClass30_Sub2_Sub1_Sub1_1202;
  15679. private final int[] anIntArray1203;
  15680. public static final int[] anIntArray1204 = { 9104, 10275, 7595, 3610, 7975, 8526, 918, 38802, 24466, 10145, 58654,
  15681. 5027, 1457, 16565, 34991, 25486 };
  15682. private static boolean flagged;
  15683. private final int[] anIntArray1207;
  15684. public int minimapInt2;
  15685. public int anInt1210;
  15686. public int anInt1211;
  15687. public String promptInput;
  15688. private int anInt1213;
  15689. private int[][][] intGroundArray;
  15690. private long aLong1215;
  15691. private int loginScreenCursorPos;
  15692. private boolean canEnterAuth;
  15693. public final Sprite[] modIcons;
  15694. private long aLong1220;
  15695. public int tabID;
  15696. public int anInt1222;
  15697. public static boolean inputTaken;
  15698. public int inputDialogState;
  15699. private static int anInt1226;
  15700. private int nextSong;
  15701. private boolean songChanging;
  15702. public final int[] anIntArray1229;
  15703. private Class11[] aClass11Array1230;
  15704. public static int anIntArray1232[];
  15705. private int[] anIntArray1234;
  15706. private int[] anIntArray1235;
  15707. private int[] anIntArray1236;
  15708. private int anInt1237;
  15709. private int anInt1238;
  15710. public final int anInt1239 = 100;
  15711. private final int[] anIntArray1241;
  15712. private boolean aBoolean1242;
  15713. private int atInventoryLoopCycle;
  15714. private int atInventoryInterface;
  15715. private int atInventoryIndex;
  15716. private int atInventoryInterfaceType;
  15717. private byte[][] aByteArrayArray1247;
  15718. public int tradeMode;
  15719. private int anInt1249;
  15720. private final int[] anIntArray1250;
  15721. private int anInt1251;
  15722. private final boolean rsAlreadyLoaded;
  15723. private int anInt1253;
  15724. public int anInt1254;
  15725. private boolean welcomeScreenRaised;
  15726. public boolean messagePromptRaised;
  15727. private byte[][][] byteGroundArray;
  15728. private int prevSong;
  15729. public int destX;
  15730. public int destY;
  15731. public Sprite minimapImage;
  15732. private int anInt1264;
  15733. private int anInt1265;
  15734. private String loginMessage1;
  15735. private String loginMessage2;
  15736. private int anInt1268;
  15737. private int anInt1269;
  15738.  
  15739. public static FontStyle aTextDrawingArea_1273;
  15740. public static FontStyle smallText;
  15741. public static FontStyle regularText;
  15742. public static FontStyle boldText;
  15743.  
  15744. public static FontStyle aTextDrawingArea_1273_2;
  15745. public static FontStyle smallText_2;
  15746. public static FontStyle regularText_2;
  15747. public static FontStyle boldText_2;
  15748.  
  15749. public static RSFont newSmallFont, newRegularFont, newBoldFont, newFancyFont;
  15750. public static RSFont newSmallFont_2, newRegularFont_2, newBoldFont_2, newFancyFont_2;
  15751. private int anInt1275;
  15752. public int backDialogID;
  15753. private int anInt1278;
  15754. public int anInt1279;
  15755. private int[] bigX;
  15756. private int[] bigY;
  15757. private int itemSelected;
  15758. private int anInt1283;
  15759. private int anInt1284;
  15760. private int anInt1285;
  15761. private String selectedItemName;
  15762. public int publicChatMode;
  15763. private static int anInt1288;
  15764. public static int anInt1290;
  15765. public int drawCount;
  15766. public int fullscreenInterfaceID;
  15767. public int anInt1044;// 377
  15768. public int anInt1129;// 377
  15769. public int anInt1315;// 377
  15770. public int anInt1500;// 377
  15771. public int anInt1501;// 377
  15772. public static int[] fullScreenTextureArray;
  15773. public int mapX;
  15774. public int mapY;
  15775. public Gameframe gameframe;
  15776. boolean autoCast;
  15777. int autocastId;
  15778. int currentGEItem = -1;
  15779. public int GEItemId = -1;
  15780. public Sprite geSearchBox, geSearchBoxHover;
  15781. public boolean buttonclicked;
  15782. public int totalItemResults;
  15783. public int interfaceButtonAction;
  15784. public int Slots[] = new int[7];
  15785. public String slots[] = new String[7];
  15786. public int slotItemId[] = new int[7];
  15787. public int slotColor[] = new int[7];
  15788. public int slotColorPercent[] = new int[7];
  15789. public int slotItems[] = new int[7];
  15790. public boolean slotAborted[] = new boolean[7];
  15791. public int slotUsing = 0;
  15792. public int slotSelected;
  15793. public Sprite per0;
  15794. public Sprite per1;
  15795. public Sprite per2;
  15796. public Sprite per3;
  15797. public Sprite per4;
  15798. public Sprite per5;
  15799. public Sprite per6;
  15800. public Sprite abort1;
  15801. public Sprite abort2;
  15802. public Sprite SellHover;
  15803. public Sprite BuyHover;
  15804. public Sprite sellSubmitHover;
  15805. public Sprite buySubmitHover;
  15806. public String Recruits = "";
  15807. public String Corporals = "";
  15808. public String Sergeants = "";
  15809. public String Lieutenants = "";
  15810. public String Captains = "";
  15811. public String Generals = "";
  15812. private String clanchatOwner = "";
  15813. public String clanName = "";
  15814. public static long lastLogin = System.currentTimeMillis();
  15815. public static long lastCameraZoomChange = 0;
  15816. public long coinsInPouch = 0;
  15817. public long lastCoinsInPouchChange = System.currentTimeMillis();
  15818. public int tooltipHoverChildId;
  15819. public int tooltipHoverX;
  15820. public int tooltipHoverY;
  15821. public int tooltipHoverLoopCycle;
  15822. public int[] keybinds = new int[16];
  15823. public Sprite currentDragSprite;
  15824. public int currentDragAmount;
  15825. public int currentDragX;
  15826. public int currentDragY;
  15827. public int currentDragAmountX;
  15828. public int currentDragAmountY;
  15829. public long lastReceivedUpdate = System.currentTimeMillis();
  15830. public long bytesReceived = 0;
  15831. public Map<Integer, Long> opcodeReceived = new HashMap<Integer, Long>();
  15832. public boolean interfaceStrings;
  15833. public boolean interfaceIds;
  15834. public int currentActionMenu;
  15835. public int gameframeHint;
  15836. Fog fog = new Fog();
  15837.  
  15838. public void setGameframe(Gameframe gameframe) {
  15839. this.gameframe = gameframe;
  15840. Gameframe.c = this;
  15841. this.inputTaken = true;
  15842. if (gameframe.getVersion() <= 459) {
  15843. this.chatTypeView = 0;
  15844. }
  15845. }
  15846.  
  15847. public void resetAllImageProducers() {
  15848. if (super.fullGameScreen != null) {
  15849. return;
  15850. }
  15851. aRSImageProducer_1166 = null;
  15852. aRSImageProducer_1164 = null;
  15853. aRSImageProducer_1163 = null;
  15854. aRSImageProducer_1165 = null;
  15855. aRSImageProducer_1125 = null;
  15856. aRSImageProducer_1107 = null;
  15857. aRSImageProducer_1108 = null;
  15858. aRSImageProducer_1109 = null;
  15859. aRSImageProducer_1110 = null;
  15860. aRSImageProducer_1111 = null;
  15861. aRSImageProducer_1112 = null;
  15862. aRSImageProducer_1113 = null;
  15863. aRSImageProducer_1114 = null;
  15864. aRSImageProducer_1115 = null;
  15865. super.fullGameScreen = new ImageProducer(765, 503);
  15866. welcomeScreenRaised = true;
  15867. }
  15868.  
  15869. public void mouseWheelDragged(int i, int j) {
  15870. if (!mouseWheelDown) {
  15871. return;
  15872. }
  15873. this.anInt1186 += i * 3;
  15874. this.anInt1187 += (j << 1);
  15875. }
  15876.  
  15877. public void launchURL(String url) {
  15878. String osName = System.getProperty("os.name").toLowerCase();
  15879. try {
  15880. if (osName.startsWith("mac")) {
  15881. pushMessage("It's hard to open web pages in mac..", 0, "");
  15882. pushMessage("Visit: " + url, 0, "");
  15883.  
  15884. Runtime runtime = Runtime.getRuntime();
  15885. String[] args = { "osascript", "-e", "open location \"" + url + "\"" };
  15886. try {
  15887. runtime.exec(args);
  15888. } catch (IOException e) {
  15889. pushMessage("Web page could not be opened..", 0, "");
  15890. pushMessage("Visit: " + url, 0, "");
  15891. }
  15892. } else if (osName.startsWith("windows")) {
  15893. Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + url);
  15894. } else { // assume Unix or Linux
  15895. String[] browsers = { "firefox", "opera", "konqueror", "epiphany", "mozilla", "netscape", "safari" };
  15896. String browser = null;
  15897. for (int count = 0; count < browsers.length && browser == null; count++) {
  15898. if (Runtime.getRuntime().exec(new String[] { "which", browsers[count] }).waitFor() == 0) {
  15899. browser = browsers[count];
  15900. }
  15901. }
  15902. if (browser == null) {
  15903. throw new Exception("Could not find web browser");
  15904. } else {
  15905. Runtime.getRuntime().exec(new String[] { browser, url });
  15906. }
  15907. }
  15908. } catch (Exception e) {
  15909. pushMessage("Failed to open URL.", 0, "");
  15910. }
  15911. }
  15912.  
  15913. int[] IDs = { 1196, 1199, 1206, 1215, 1224, 1231, 1240, 1249, 1258, 1267, 1274, 1283, 1573, 1290, 1299, 1308, 1315,
  15914. 1324, 1333, 1340, 1349, 1358, 1367, 1374, 1381, 1388, 1397, 1404, 1583, 12038, 1414, 1421, 1430, 1437, 1446,
  15915. 1453, 1460, 1469, 15878, 1602, 1613, 1624, 7456, 1478, 1485, 1494, 1503, 1512, 1521, 1530, 1544, 1553, 1563,
  15916. 1593, 1635, 12426, 12436, 12446, 12456, 6004, 18471,
  15917. /* Ancients */
  15918. 12940, 12988, 13036, 12902, 12862, 13046, 12964, 13012, 13054, 12920, 12882, 13062, 12952, 13000, 13070,
  15919. 12912, 12872, 13080, 12976, 13024, 13088, 12930, 12892, 13096, };
  15920. int[] runeChildren = { 1202, 1203, 1209, 1210, 1211, 1218, 1219, 1220, 1227, 1228, 1234, 1235, 1236, 1243, 1244,
  15921. 1245, 1252, 1253, 1254, 1261, 1262, 1263, 1270, 1271, 1277, 1278, 1279, 1286, 1287, 1293, 1294, 1295, 1302,
  15922. 1303, 1304, 1311, 1312, 1318, 1319, 1320, 1327, 1328, 1329, 1336, 1337, 1343, 1344, 1345, 1352, 1353, 1354,
  15923. 1361, 1362, 1363, 1370, 1371, 1377, 1378, 1384, 1385, 1391, 1392, 1393, 1400, 1401, 1407, 1408, 1410, 1417,
  15924. 1418, 1424, 1425, 1426, 1433, 1434, 1440, 1441, 1442, 1449, 1450, 1456, 1457, 1463, 1464, 1465, 1472, 1473,
  15925. 1474, 1481, 1482, 1488, 1489, 1490, 1497, 1498, 1499, 1506, 1507, 1508, 1515, 1516, 1517, 1524, 1525, 1526,
  15926. 1533, 1534, 1535, 1547, 1548, 1549, 1556, 1557, 1558, 1566, 1567, 1568, 1576, 1577, 1578, 1586, 1587, 1588,
  15927. 1596, 1597, 1598, 1605, 1606, 1607, 1616, 1617, 1618, 1627, 1628, 1629, 1638, 1639, 1640, 6007, 6008, 6011,
  15928. 8673, 8674, 12041, 12042, 12429, 12430, 12431, 12439, 12440, 12441, 12449, 12450, 12451, 12459, 12460,
  15929. 15881, 15882, 15885, 18474, 18475, 18478 };
  15930.  
  15931. static {
  15932. experienceForLevels = new int[99];
  15933. int i = 0;
  15934. for (int j = 0; j < 99; j++) {
  15935. int l = j + 1;
  15936. int i1 = (int) ((double) l + 300D * Math.pow(2D, (double) l / 7D));
  15937. i += i1;
  15938. experienceForLevels[j] = i / 4;
  15939. }
  15940. anIntArray1232 = new int[32];
  15941. i = 2;
  15942. for (int k = 0; k < 32; k++) {
  15943. anIntArray1232[k] = i - 1;
  15944. i += i;
  15945. }
  15946. }
  15947. }
Add Comment
Please, Sign In to add comment