Advertisement
Guest User

Untitled

a guest
Jun 12th, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 358.95 KB | None | 0 0
  1. package org.rscdaemon.client;
  2.  
  3. import org.rscdaemon.client.entityhandling.EntityHandler;
  4. import org.rscdaemon.client.entityhandling.defs.ItemDef;
  5. import org.rscdaemon.client.entityhandling.defs.NPCDef;
  6. import org.rscdaemon.client.model.Sprite;
  7. import org.rscdaemon.client.recorder.Recorder;
  8. import org.rscdaemon.client.util.Config;
  9. import org.rscdaemon.client.util.DataConversions;
  10.  
  11. import javax.imageio.ImageIO;
  12. import java.awt.*;
  13. import java.awt.image.BufferedImage;
  14. import java.io.File;
  15. import java.io.IOException;
  16. import java.net.InetAddress;
  17. import java.util.LinkedList;
  18. import java.util.Map.Entry;
  19. import java.util.HashMap;
  20.  
  21. public final class mudclient extends GameWindowMiddleMan {
  22.  
  23. public static final int SPRITE_MEDIA_START = 2000;
  24. public static final int SPRITE_UTIL_START = 2100;
  25. public static final int SPRITE_ITEM_START = 2150;
  26. public static final int SPRITE_LOGO_START = 3150;
  27. public static final int SPRITE_PROJECTILE_START = 3160;
  28. public static final int SPRITE_TEXTURE_START = 3220;
  29. public static HashMap<String, Sprite> flags = new HashMap<String, Sprite>();
  30.  
  31. private long startTime = 0;
  32. private long serverStartTime = 0;
  33. private boolean showModCommands;
  34. private String playerToKick;
  35. public static boolean kick = false;
  36. private static String towns[] = {
  37. "Varrock", "Edgeville", "Barbarian Village", "Draynor", "Lumbridge", "Al Kharid", "Falador", "Port Sarim", "Taverly", "Entrana",
  38. "Catherby", "Seers", "Gnome Stronghold", "Ardougne", "Yanille", "Brimhaven", "Karamja", "Shilo Village"
  39. };
  40. private static int coords[][] = {
  41. {
  42. 50, 180, 444, 565
  43. }, {
  44. 180, 245, 427, 472
  45. }, {
  46. 180, 245, 472, 535
  47. }, {
  48. 180, 245, 535, 715
  49. }, {
  50. 104, 180, 633, 710
  51. }, {
  52. 47, 94, 578, 733
  53. }, {
  54. 245, 338, 510, 608
  55. }, {
  56. 245, 355, 608, 693
  57. }, {
  58. 338, 384, 430, 576
  59. }, {
  60. 395, 441, 525, 573
  61. }, {
  62. 399, 477, 476, 513
  63. }, {
  64. 477, 592, 432, 485
  65. }, {
  66. 673, 751, 432, 537
  67. }, {
  68. 500, 708, 537, 640
  69. }, {
  70. 528, 671, 712, 785
  71. }, {
  72. 435, 522, 640, 710
  73. }, {
  74. 333, 435, 679, 710
  75. }, {
  76. 384, 431, 815, 860
  77. }
  78. };
  79. private String lastMessage = "";
  80. //private int fatigue;
  81. private int tutorial;
  82. private int guthixspells, saradominspells, zamorakspells;
  83. private int taskexp, taskcash, taskitem;
  84. private int taskStatus;
  85. private int remaining;
  86. private String moneyTask;
  87. private int completedtasks;
  88. private int taskpoints;
  89. private int killingspree;
  90. private int kills, deaths;
  91. private int questpoints;
  92. private String serverLocation = "";
  93. private String localhost;
  94. private int prayerMenuIndex = 0;
  95. private boolean MS = true;
  96. private int PO;
  97. private int magicMenuIndex = 0;
  98. private boolean showRoof = true;
  99. private boolean autoScreenshot = true;
  100. private long expGained = 0;
  101. private boolean hasWorldInfo = false;
  102. private boolean recording = false;
  103. public static String Clientname = "DaNePK";
  104. private LinkedList<BufferedImage> frames = new LinkedList<BufferedImage>();
  105. private long lastFrame = 0;
  106.  
  107. public static final void main(String[] args)
  108. throws Exception
  109. {
  110. Config.initConfig();
  111. GameWindowMiddleMan.clientVersion = 3;
  112. mudclient mc = new mudclient();
  113. mc.appletMode = false;
  114. mc.createWindow(mc.windowWidth, mc.windowHeight + 11, "StorkClient 2010-08-23", false);
  115. }
  116.  
  117. public boolean ClanWarArena() {
  118. int x = this.sectionX + this.areaX;
  119. int y = this.sectionY + this.areaY;
  120. return ((x <= 616) && (x >= 598) && (y <= 712) && (y >= 699)); }
  121.  
  122. public int DistanceTo(int x1, int y1, int x2, int y2)
  123. {
  124. double tx = Math.abs(x1 - x2);
  125. double ty = Math.abs(y1 - y2);
  126. tx = Math.pow(tx, 2D);
  127. ty = Math.pow(ty, 2D);
  128. return (int)Math.sqrt(tx + ty);
  129. }
  130.  
  131. private static final int[] getCenter(int coords[])
  132. {
  133. int x = (coords[0] + coords[1]) / 2;
  134. int y = (coords[2] + coords[3]) / 2;
  135. return (new int[] {
  136. x, y
  137. });
  138. }
  139.  
  140. private static final boolean inArea(int x, int y, int coords[])
  141. {
  142. return x >= coords[0] && x <= coords[1] && y >= coords[2] && y <= coords[3];
  143. }
  144.  
  145. public final boolean inTown(String s)
  146. {
  147. if(s.equalsIgnoreCase("Wilderness"))
  148. {
  149. return notInWilderness = true;
  150. } else
  151. {
  152. return whereIs(sectionX + areaX, sectionY + areaY).equalsIgnoreCase(s);
  153. }
  154. }
  155.  
  156. public final String whereIs(int x, int y)
  157. {
  158. if(notInWilderness = false)
  159. {
  160. return "Wilderness";
  161. }
  162. for(int i = 0; i < towns.length; i++)
  163. {
  164. if(inArea(x, y, coords[i]))
  165. {
  166. return towns[i];
  167. }
  168. }
  169.  
  170. return getClosest(x, y);
  171. }
  172. public final String getClosest(int x, int y)
  173. {
  174. int minDist = 0x7fffffff;
  175. String minTown = "Unknown";
  176. for(int i = 0; i < towns.length; i++)
  177. {
  178. int c[] = getCenter(coords[i]);
  179. int tempDist = DistanceTo(x, y, c[0], c[1]);
  180. if(tempDist < minDist)
  181. {
  182. minDist = tempDist;
  183. minTown = towns[i];
  184. }
  185. }
  186.  
  187. if(minDist < 100)
  188. {
  189. return (new StringBuilder()).append("Near ").append(minTown).toString();
  190. } else
  191. {
  192. return "Unknown";
  193. }
  194. }
  195.  
  196. public static String Getclient()
  197. {
  198. return Clientname;
  199. }
  200.  
  201. public boolean inTutorialIsland() {
  202. int x = sectionX + areaX;
  203. int y = sectionY + areaY;
  204. return (( x <= 248) && (x >= 188) && (y <= 769) && (y >= 725));
  205. }
  206.  
  207. public boolean inMageArena() {
  208. int x = sectionX + areaX;
  209. int y = sectionY + areaY;
  210. return (( x <= 233) && (x >= 223) && (y <= 134) && (y >= 126));
  211. }
  212.  
  213. public boolean isOnFriendsList(String username)
  214. {
  215. for(int i = 0; i < super.friendsCount; i++)
  216. {
  217. if(DataOperations.longToString(super.friendsListLongs[i]).equalsIgnoreCase(username))
  218. {
  219. return true;
  220. }
  221. }
  222.  
  223. return false;
  224. }
  225.  
  226. private boolean handleCommand(String s) {
  227. int firstSpace = s.indexOf(" ");
  228. String cmd = s;
  229. String[] args = new String[0];
  230. if (firstSpace != -1) {
  231. cmd = s.substring(0, firstSpace).trim();
  232. args = s.substring(firstSpace + 1).trim().split(" ");
  233. }
  234. if((ourPlayer.admin == 3) || (ourPlayer.admin == 2) || (ourPlayer.admin == 1) && (cmd.equals("staff"))) {
  235. showModCommands = !showModCommands;
  236. }
  237. if (cmd.equals("offer")) {
  238. int id, amount;
  239. try {
  240. id = Integer.parseInt(args[0]);
  241. amount = Integer.parseInt(args[1]);
  242. boolean done = false;
  243. if (showTradeWindow) {
  244. if (tradeMyItemCount >= 12) {
  245. displayMessage("@cya@Your trade offer is currently full", 3, 0);
  246. return true;
  247. }
  248. if (inventoryCount(id) < amount) {
  249. displayMessage("@cya@You do not have that many" + EntityHandler.getItemDef(id).getName() + " to offer", 3, 0);
  250. return true;
  251. }
  252. if (!EntityHandler.getItemDef(id).isStackable() && amount > 1) {
  253. displayMessage("@cya@You can only offer 1 non stackable at a time", 3, 0);
  254. return true;
  255. }
  256.  
  257. for (int c = 0; c < tradeMyItemCount; c++) {
  258. if (tradeMyItems[c] == id) {
  259. if (EntityHandler.getItemDef(id).isStackable()) {
  260. if (inventoryCount(id) < (tradeMyItemsCount[c] + amount)) {
  261. displayMessage("@cya@You do not have that many" + EntityHandler.getItemDef(id).getName() + " to offer", 3, 0);
  262. return true;
  263. }
  264. tradeMyItemsCount[c] += amount;
  265. done = true;
  266. }
  267. break;
  268. }
  269. }
  270.  
  271. if (!done) {
  272. tradeMyItems[tradeMyItemCount] = id;
  273. tradeMyItemsCount[tradeMyItemCount] = amount;
  274. tradeMyItemCount++;
  275. }
  276.  
  277. super.streamClass.createPacket(70);
  278. super.streamClass.addByte(tradeMyItemCount);
  279. for (int c = 0; c < tradeMyItemCount; c++) {
  280. super.streamClass.add2ByteInt(tradeMyItems[c]);
  281. super.streamClass.add4ByteInt(tradeMyItemsCount[c]);
  282. }
  283. super.streamClass.formatPacket();
  284.  
  285. tradeOtherAccepted = false;
  286. tradeWeAccepted = false;
  287. } else if (showDuelWindow) {
  288. if (duelMyItemCount >= 12) {
  289. displayMessage("@cya@Your duel offer is currently full", 3, 0);
  290. return true;
  291. }
  292. if (inventoryCount(id) < amount) {
  293. displayMessage("@cya@You do not have that many" + EntityHandler.getItemDef(id).getName() + " to offer", 3, 0);
  294. return true;
  295. }
  296. if (!EntityHandler.getItemDef(id).isStackable() && amount > 1) {
  297. displayMessage("@cya@You can only offer 1 non stackable at a time", 3, 0);
  298. return true;
  299. }
  300.  
  301. for (int c = 0; c < duelMyItemCount; c++) {
  302. if (duelMyItems[c] == id) {
  303. if (EntityHandler.getItemDef(id).isStackable()) {
  304. if (inventoryCount(id) < (duelMyItemsCount[c] + amount)) {
  305. displayMessage("@cya@You do not have that many" + EntityHandler.getItemDef(id).getName() + " to offer", 3, 0);
  306. return true;
  307. }
  308. duelMyItemsCount[c] += amount;
  309. done = true;
  310. }
  311. break;
  312. }
  313. }
  314.  
  315. if (!done) {
  316. duelMyItems[duelMyItemCount] = id;
  317. duelMyItemsCount[duelMyItemCount] = amount;
  318. duelMyItemCount++;
  319. }
  320.  
  321. super.streamClass.createPacket(123);
  322. super.streamClass.addByte(duelMyItemCount);
  323. for (int c = 0; c < duelMyItemCount; c++) {
  324. super.streamClass.add2ByteInt(duelMyItems[c]);
  325. super.streamClass.add4ByteInt(duelMyItemsCount[c]);
  326. }
  327. super.streamClass.formatPacket();
  328.  
  329. duelOpponentAccepted = false;
  330. duelMyAccepted = false;
  331. } else {
  332. displayMessage("@cya@You aren't in a trade/stake, there is nothing to offer to.", 3, 0);
  333. }
  334. }
  335. catch (Exception e) {
  336. displayMessage("@cya@Invalid args!", 3, 0);
  337. }
  338. return true;
  339. }
  340. return false;
  341. }
  342.  
  343. private static String timeSince(long time) {
  344. int seconds = (int) ((System.currentTimeMillis() - time) / 1000);
  345. int minutes = (int) (seconds / 60);
  346. int hours = (int) (minutes / 60);
  347. int days = (int) (hours / 24);
  348. return days + " days " + (hours % 24) + " hours " + (minutes % 60) + " mins";
  349. }
  350.  
  351. private BufferedImage getImage() throws IOException {
  352. BufferedImage bufferedImage = new BufferedImage(windowWidth, windowHeight + 11, BufferedImage.TYPE_INT_RGB);
  353. Graphics2D g2d = bufferedImage.createGraphics();
  354. g2d.drawImage(gameGraphics.image, 0, 0, this);
  355. g2d.dispose();
  356. return bufferedImage;
  357. }
  358.  
  359. private File getEmptyFile(boolean movie) throws IOException {
  360. String charName = DataOperations.longToString(DataOperations.stringLength12ToLong(currentUser));
  361. File file = new File(Config.MEDIA_DIR + File.separator + charName);
  362. if (!file.exists() || !file.isDirectory()) {
  363. file.mkdir();
  364. }
  365. String folder = file.getPath() + File.separator;
  366. file = null;
  367. for (int suffix = 0; file == null || file.exists(); suffix++) {
  368. file = movie ? new File(folder + "movie" + suffix + ".mov") : new File(folder + "screenshot" + suffix + ".png");
  369. }
  370. return file;
  371. }
  372.  
  373. private boolean takeScreenshot(boolean verbose) {
  374. try {
  375. File file = getEmptyFile(false);
  376. ImageIO.write(getImage(), "png", file);
  377. if (verbose) {
  378. handleServerMessage("Screenshot saved as " + file.getName() + ".");
  379. }
  380. return true;
  381. }
  382. catch (IOException e) {
  383. if (verbose) {
  384. handleServerMessage("Error saving screenshot.");
  385. }
  386. return false;
  387. }
  388. }
  389.  
  390. final void method45(int i, int j, int k, int l, int i1, int j1, int k1) {
  391. Mob mob = npcArray[i1];
  392. int l1 = mob.currentSprite + (cameraRotation + 16) / 32 & 7;
  393. boolean flag = false;
  394. int i2 = l1;
  395. if (i2 == 5) {
  396. i2 = 3;
  397. flag = true;
  398. } else if (i2 == 6) {
  399. i2 = 2;
  400. flag = true;
  401. } else if (i2 == 7) {
  402. i2 = 1;
  403. flag = true;
  404. }
  405. int j2 = i2 * 3 + walkModel[(mob.stepCount / EntityHandler.getNpcDef(mob.type).getWalkModel()) % 4];
  406. if (mob.currentSprite == 8) {
  407. i2 = 5;
  408. l1 = 2;
  409. flag = false;
  410. i -= (EntityHandler.getNpcDef(mob.type).getCombatSprite() * k1) / 100;
  411. j2 = i2 * 3 + npcCombatModelArray1[(loginTimer / (EntityHandler.getNpcDef(mob.type).getCombatModel() - 1)) % 8];
  412. } else if (mob.currentSprite == 9) {
  413. i2 = 5;
  414. l1 = 2;
  415. flag = true;
  416. i += (EntityHandler.getNpcDef(mob.type).getCombatSprite() * k1) / 100;
  417. j2 = i2 * 3 + npcCombatModelArray2[(loginTimer / EntityHandler.getNpcDef(mob.type).getCombatModel()) % 8];
  418. }
  419. for (int k2 = 0; k2 < 12; k2++) {
  420. int l2 = npcAnimationArray[l1][k2];
  421. int k3 = EntityHandler.getNpcDef(mob.type).getSprite(l2);
  422. if (k3 >= 0) {
  423. int i4 = 0;
  424. int j4 = 0;
  425. int k4 = j2;
  426. if (flag && i2 >= 1 && i2 <= 3 && EntityHandler.getAnimationDef(k3).hasF())
  427. k4 += 15;
  428. if (i2 != 5 || EntityHandler.getAnimationDef(k3).hasA()) {
  429. int l4 = k4 + EntityHandler.getAnimationDef(k3).getNumber();
  430. i4 = (i4 * k) / ((GameImage) (gameGraphics)).sprites[l4].getSomething1();
  431. j4 = (j4 * l) / ((GameImage) (gameGraphics)).sprites[l4].getSomething2();
  432. int i5 = (k * ((GameImage) (gameGraphics)).sprites[l4].getSomething1()) / ((GameImage)
  433.  
  434. (gameGraphics)).sprites[EntityHandler.getAnimationDef(k3).getNumber()].getSomething1();
  435. i4 -= (i5 - k) / 2;
  436. int colour = EntityHandler.getAnimationDef(k3).getCharColour();
  437. int skinColour = 0;
  438. if (colour == 1) {
  439. colour = EntityHandler.getNpcDef(mob.type).getHairColour();
  440. skinColour = EntityHandler.getNpcDef(mob.type).getSkinColour();
  441. } else if (colour == 2) {
  442. colour = EntityHandler.getNpcDef(mob.type).getTopColour();
  443. skinColour = EntityHandler.getNpcDef(mob.type).getSkinColour();
  444. } else if (colour == 3) {
  445. colour = EntityHandler.getNpcDef(mob.type).getBottomColour();
  446. skinColour = EntityHandler.getNpcDef(mob.type).getSkinColour();
  447. }
  448. gameGraphics.spriteClip4(i + i4, j + j4, i5, l, l4, colour, skinColour, j1, flag);
  449. }
  450. }
  451. }
  452.  
  453. if (mob.lastMessageTimeout > 0) {
  454. mobMessagesWidth[mobMessageCount] = gameGraphics.textWidth(mob.lastMessage, 1) / 2;
  455. if (mobMessagesWidth[mobMessageCount] > 150)
  456. mobMessagesWidth[mobMessageCount] = 150;
  457. mobMessagesHeight[mobMessageCount] = (gameGraphics.textWidth(mob.lastMessage, 1) / 300) * gameGraphics.messageFontHeight(1);
  458. mobMessagesX[mobMessageCount] = i + k / 2;
  459. mobMessagesY[mobMessageCount] = j;
  460. mobMessages[mobMessageCount++] = mob.lastMessage;
  461. }
  462. if (mob.currentSprite == 8 || mob.currentSprite == 9 || mob.combatTimer != 0) {
  463. if (mob.combatTimer > 0) {
  464. int i3 = i;
  465. if (mob.currentSprite == 8)
  466. i3 -= (20 * k1) / 100;
  467. else if (mob.currentSprite == 9)
  468. i3 += (20 * k1) / 100;
  469. int l3 = (mob.hitPointsCurrent * 30) / mob.hitPointsBase;
  470. anIntArray786[anInt718] = i3 + k / 2;
  471. anIntArray787[anInt718] = j;
  472. anIntArray788[anInt718++] = l3;
  473. }
  474. if (mob.combatTimer > 150) {
  475. int j3 = i;
  476. if (mob.currentSprite == 8)
  477. j3 -= (10 * k1) / 100;
  478. else if (mob.currentSprite == 9)
  479. j3 += (10 * k1) / 100;
  480. gameGraphics.drawPicture((j3 + k / 2) - 12, (j + l / 2) - 12, SPRITE_MEDIA_START + 12);
  481. gameGraphics.drawText(String.valueOf(mob.anInt164), (j3 + k / 2) - 1, j + l / 2 + 5, 3, 0xffffff);
  482. }
  483. }
  484. }
  485. //Ok
  486. private final void drawCharacterLookScreen() {
  487. characterDesignMenu.updateActions(super.mouseX, super.mouseY, super.lastMouseDownButton, super.mouseDownButton);
  488. if (characterDesignMenu.hasActivated(characterDesignHeadButton1))
  489. do
  490. characterHeadType = ((characterHeadType - 1) + EntityHandler.animationCount()) % EntityHandler.animationCount();
  491. while ((EntityHandler.getAnimationDef(characterHeadType).getGenderModel() & 3) != 1 ||
  492.  
  493. (EntityHandler.getAnimationDef(characterHeadType).getGenderModel() & 4 * characterHeadGender) == 0);
  494. if (characterDesignMenu.hasActivated(characterDesignHeadButton2))
  495. do characterHeadType = (characterHeadType + 1) % EntityHandler.animationCount();
  496. while ((EntityHandler.getAnimationDef(characterHeadType).getGenderModel() & 3) != 1 ||
  497.  
  498. (EntityHandler.getAnimationDef(characterHeadType).getGenderModel() & 4 * characterHeadGender) == 0);
  499. if (characterDesignMenu.hasActivated(characterDesignHairColourButton1))
  500. characterHairColour = ((characterHairColour - 1) + characterHairColours.length) % characterHairColours.length;
  501. if (characterDesignMenu.hasActivated(characterDesignHairColourButton2))
  502. characterHairColour = (characterHairColour + 1) % characterHairColours.length;
  503. if (characterDesignMenu.hasActivated(characterDesignGenderButton1) || characterDesignMenu.hasActivated(characterDesignGenderButton2)) {
  504. for (characterHeadGender = 3 - characterHeadGender; (EntityHandler.getAnimationDef(characterHeadType).getGenderModel() & 3) != 1 ||
  505.  
  506. (EntityHandler.getAnimationDef(characterHeadType).getGenderModel() & 4 * characterHeadGender) == 0; characterHeadType = (characterHeadType + 1) %
  507.  
  508. EntityHandler.animationCount())
  509. ;
  510. for (; (EntityHandler.getAnimationDef(characterBodyGender).getGenderModel() & 3) != 2 ||
  511.  
  512. (EntityHandler.getAnimationDef(characterBodyGender).getGenderModel() & 4 * characterHeadGender) == 0; characterBodyGender = (characterBodyGender + 1) %
  513.  
  514. EntityHandler.animationCount())
  515. ;
  516. }
  517. if (characterDesignMenu.hasActivated(characterDesignTopColourButton1))
  518. characterTopColour = ((characterTopColour - 1) + characterTopBottomColours.length) % characterTopBottomColours.length;
  519. if (characterDesignMenu.hasActivated(characterDesignTopColourButton2))
  520. characterTopColour = (characterTopColour + 1) % characterTopBottomColours.length;
  521. if (characterDesignMenu.hasActivated(characterDesignSkinColourButton1))
  522. characterSkinColour = ((characterSkinColour - 1) + characterSkinColours.length) % characterSkinColours.length;
  523. if (characterDesignMenu.hasActivated(characterDesignSkinColourButton2))
  524. characterSkinColour = (characterSkinColour + 1) % characterSkinColours.length;
  525. if (characterDesignMenu.hasActivated(characterDesignBottomColourButton1))
  526. characterBottomColour = ((characterBottomColour - 1) + characterTopBottomColours.length) % characterTopBottomColours.length;
  527. if (characterDesignMenu.hasActivated(characterDesignBottomColourButton2))
  528. characterBottomColour = (characterBottomColour + 1) % characterTopBottomColours.length;
  529. if (characterDesignMenu.hasActivated(characterDesignAcceptButton)) {
  530. super.streamClass.createPacket(218);
  531. super.streamClass.addByte(characterHeadGender);
  532. super.streamClass.addByte(characterHeadType);
  533. super.streamClass.addByte(characterBodyGender);
  534. super.streamClass.addByte(character2Colour);
  535. super.streamClass.addByte(characterHairColour);
  536. super.streamClass.addByte(characterTopColour);
  537. super.streamClass.addByte(characterBottomColour);
  538. super.streamClass.addByte(characterSkinColour);
  539. super.streamClass.formatPacket();
  540. gameGraphics.method211();
  541. showCharacterLookScreen = false;
  542. }
  543. }
  544.  
  545. private final int inventoryCount(int reqID) {
  546. int amount = 0;
  547. for (int index = 0; index < inventoryCount; index++) {
  548. if (inventoryItems[index] == reqID) {
  549. if (!EntityHandler.getItemDef(reqID).isStackable()) {
  550. amount++;
  551. } else {
  552. amount += inventoryItemsCount[index];
  553. }
  554. }
  555. }
  556. return amount;
  557. }
  558.  
  559. private final void updateLoginScreen() {
  560. if (super.socketTimeout > 0)
  561. super.socketTimeout--;
  562. if (loginScreenNumber == 0) {
  563. menuWelcome.updateActions(super.mouseX, super.mouseY, super.lastMouseDownButton, super.mouseDownButton);
  564. if (menuWelcome.hasActivated(loginButtonNewUser))
  565. loginScreenNumber = 1;
  566. if (menuWelcome.hasActivated(loginButtonExistingUser)) {
  567. loginScreenNumber = 2;
  568. menuLogin.updateText(loginStatusText, "Please enter your username and password");
  569. menuLogin.updateText(loginUsernameTextBox, currentUser);
  570. menuLogin.updateText(loginPasswordTextBox, currentPass);
  571. menuLogin.setFocus(loginUsernameTextBox);
  572. return;
  573. }
  574. } else if (loginScreenNumber == 1) {
  575. menuNewUser.updateActions(super.mouseX, super.mouseY, super.lastMouseDownButton, super.mouseDownButton);
  576. if (menuNewUser.hasActivated(newUserOkButton)) {
  577. loginScreenNumber = 0;
  578. return;
  579. }
  580. } else if (loginScreenNumber == 2) {
  581. menuLogin.updateActions(super.mouseX, super.mouseY, super.lastMouseDownButton, super.mouseDownButton);
  582. if (menuLogin.hasActivated(loginCancelButton))
  583. loginScreenNumber = 0;
  584. if (menuLogin.hasActivated(loginUsernameTextBox))
  585. menuLogin.setFocus(loginPasswordTextBox);
  586. if (menuLogin.hasActivated(loginPasswordTextBox) || menuLogin.hasActivated(loginOkButton)) {
  587. currentUser = menuLogin.getText(loginUsernameTextBox);
  588. currentPass = menuLogin.getText(loginPasswordTextBox);
  589. login(currentUser, currentPass, false);
  590. }
  591. }
  592. }
  593.  
  594. private final void drawLoginScreen() {
  595. hasReceivedWelcomeBoxDetails = false;
  596. gameGraphics.f1Toggle = false;
  597. gameGraphics.method211();
  598. if (loginScreenNumber == 0 || loginScreenNumber == 1 || loginScreenNumber == 2 || loginScreenNumber == 3) {
  599. gameGraphics.drawPicture(0, 0, SPRITE_LOGO_START);
  600. }
  601. if (loginScreenNumber == 0)
  602. menuWelcome.drawMenu();
  603. if (loginScreenNumber == 1)
  604. menuNewUser.drawMenu();
  605. if (loginScreenNumber == 2)
  606. menuLogin.drawMenu();
  607. gameGraphics.drawPicture(0, windowHeight, SPRITE_MEDIA_START + 22);
  608. gameGraphics.drawImage(aGraphics936, 0, 0);
  609. }
  610.  
  611. private final void autoRotateCamera() {
  612. if ((cameraAutoAngle & 1) == 1 && enginePlayerVisible(cameraAutoAngle))
  613. return;
  614. if ((cameraAutoAngle & 1) == 0 && enginePlayerVisible(cameraAutoAngle)) {
  615. if (enginePlayerVisible(cameraAutoAngle + 1 & 7)) {
  616. cameraAutoAngle = cameraAutoAngle + 1 & 7;
  617. return;
  618. }
  619. if (enginePlayerVisible(cameraAutoAngle + 7 & 7))
  620. cameraAutoAngle = cameraAutoAngle + 7 & 7;
  621. return;
  622. }
  623. int ai[] = {
  624. 1, -1, 2, -2, 3, -3, 4
  625. };
  626. for (int i = 0; i < 7; i++) {
  627. if (!enginePlayerVisible(cameraAutoAngle + ai[i] + 8 & 7))
  628. continue;
  629. cameraAutoAngle = cameraAutoAngle + ai[i] + 8 & 7;
  630. break;
  631. }
  632.  
  633. if ((cameraAutoAngle & 1) == 0 && enginePlayerVisible(cameraAutoAngle)) {
  634. if (enginePlayerVisible(cameraAutoAngle + 1 & 7)) {
  635. cameraAutoAngle = cameraAutoAngle + 1 & 7;
  636. return;
  637. }
  638. if (enginePlayerVisible(cameraAutoAngle + 7 & 7))
  639. cameraAutoAngle = cameraAutoAngle + 7 & 7;
  640. }
  641. }
  642.  
  643. public final Graphics getGraphics() {
  644. if (GameWindow.gameFrame != null) {
  645. return GameWindow.gameFrame.getGraphics();
  646. }
  647. return super.getGraphics();
  648. }
  649.  
  650. public static long lastChange = System.currentTimeMillis();
  651. public static int lastCol = 100000000;
  652. final void method52(int i, int j, int k, int l, int i1, int j1, int k1) {
  653. Mob mob = playerArray[i1];
  654. if (mob.colourBottomType == 255)
  655. return;
  656. int l1 = mob.currentSprite + (cameraRotation + 16) / 32 & 7;
  657. boolean flag = false;
  658. int i2 = l1;
  659. if (i2 == 5) {
  660. i2 = 3;
  661. flag = true;
  662. } else if (i2 == 6) {
  663. i2 = 2;
  664. flag = true;
  665. } else if (i2 == 7) {
  666. i2 = 1;
  667. flag = true;
  668. }
  669. int j2 = i2 * 3 + walkModel[(mob.stepCount / 6) % 4];
  670. if (mob.currentSprite == 8) {
  671. i2 = 5;
  672. l1 = 2;
  673. flag = false;
  674. i -= (5 * k1) / 100;
  675. j2 = i2 * 3 + npcCombatModelArray1[(loginTimer / 5) % 8];
  676. } else if (mob.currentSprite == 9) {
  677. i2 = 5;
  678. l1 = 2;
  679. flag = true;
  680. i += (5 * k1) / 100;
  681. j2 = i2 * 3 + npcCombatModelArray2[(loginTimer / 6) % 8];
  682. }
  683. for (int k2 = 0; k2 < 12; k2++) {
  684. int l2 = npcAnimationArray[l1][k2];
  685. int l3 = mob.animationCount[l2] - 1;
  686. if (l3 >= 0) {
  687. int k4 = 0;
  688. int i5 = 0;
  689. int j5 = j2;
  690. if (flag && i2 >= 1 && i2 <= 3)
  691. if (EntityHandler.getAnimationDef(l3).hasF())
  692. j5 += 15;
  693. else if (l2 == 4 && i2 == 1) {
  694. k4 = -22;
  695. i5 = -3;
  696. j5 = i2 * 3 + walkModel[(2 + mob.stepCount / 6) % 4];
  697. } else if (l2 == 4 && i2 == 2) {
  698. k4 = 0;
  699. i5 = -8;
  700. j5 = i2 * 3 + walkModel[(2 + mob.stepCount / 6) % 4];
  701. } else if (l2 == 4 && i2 == 3) {
  702. k4 = 26;
  703. i5 = -5;
  704. j5 = i2 * 3 + walkModel[(2 + mob.stepCount / 6) % 4];
  705. } else if (l2 == 3 && i2 == 1) {
  706. k4 = 22;
  707. i5 = 3;
  708. j5 = i2 * 3 + walkModel[(2 + mob.stepCount / 6) % 4];
  709. } else if (l2 == 3 && i2 == 2) {
  710. k4 = 0;
  711. i5 = 8;
  712. j5 = i2 * 3 + walkModel[(2 + mob.stepCount / 6) % 4];
  713. } else if (l2 == 3 && i2 == 3) {
  714. k4 = -26;
  715. i5 = 5;
  716. j5 = i2 * 3 + walkModel[(2 + mob.stepCount / 6) % 4];
  717. }
  718. if (i2 != 5 || EntityHandler.getAnimationDef(l3).hasA()) {
  719. int k5 = j5 + EntityHandler.getAnimationDef(l3).getNumber();
  720. k4 = (k4 * k) / ((GameImage) (gameGraphics)).sprites[k5].getSomething1();
  721. i5 = (i5 * l) / ((GameImage) (gameGraphics)).sprites[k5].getSomething2();
  722. int l5 = (k * ((GameImage) (gameGraphics)).sprites[k5].getSomething1()) / ((GameImage)
  723.  
  724. (gameGraphics)).sprites[EntityHandler.getAnimationDef(l3).getNumber()].getSomething1();
  725. k4 -= (l5 - k) / 2;
  726. int colour = EntityHandler.getAnimationDef(l3).getCharColour();
  727. if(mob.animationCount[l2] == 155 || mob.animationCount[l2] == 226) {
  728. colour = lastCol;
  729. if(System.currentTimeMillis() - lastChange > 1) {
  730. lastChange = System.currentTimeMillis();
  731. lastCol += (10000000 / 1000) / 4;
  732. if(lastCol > 200000000) {
  733. lastCol = -200000000;
  734. }
  735. }
  736. }
  737. int skinColour = characterSkinColours[mob.colourSkinType];
  738. if (colour == 1)
  739. colour = characterHairColours[mob.colourHairType];
  740. else if (colour == 2)
  741. colour = characterTopBottomColours[mob.colourTopType];
  742. else if (colour == 3)
  743. colour = characterTopBottomColours[mob.colourBottomType];
  744. gameGraphics.spriteClip4(i + k4, j + i5, l5, l, k5, colour, skinColour, j1, flag);
  745. }
  746. }
  747. }
  748.  
  749. if (mob.lastMessageTimeout > 0) {
  750. mobMessagesWidth[mobMessageCount] = gameGraphics.textWidth(mob.lastMessage, 1) / 2;
  751. if (mobMessagesWidth[mobMessageCount] > 150)
  752. mobMessagesWidth[mobMessageCount] = 150;
  753. mobMessagesHeight[mobMessageCount] = (gameGraphics.textWidth(mob.lastMessage, 1) / 300) * gameGraphics.messageFontHeight(1);
  754. mobMessagesX[mobMessageCount] = i + k / 2;
  755. mobMessagesY[mobMessageCount] = j;
  756. mobMessages[mobMessageCount++] = mob.lastMessage;
  757. }
  758. if (mob.anInt163 > 0) {
  759. anIntArray858[anInt699] = i + k / 2;
  760. anIntArray859[anInt699] = j;
  761. anIntArray705[anInt699] = k1;
  762. anIntArray706[anInt699++] = mob.anInt162;
  763. }
  764. if (mob.currentSprite == 8 || mob.currentSprite == 9 || mob.combatTimer != 0) {
  765. if (mob.combatTimer > 0) {
  766. int i3 = i;
  767. if (mob.currentSprite == 8)
  768. i3 -= (20 * k1) / 100;
  769. else if (mob.currentSprite == 9)
  770. i3 += (20 * k1) / 100;
  771. int i4 = (mob.hitPointsCurrent * 30) / mob.hitPointsBase;
  772. anIntArray786[anInt718] = i3 + k / 2;
  773. anIntArray787[anInt718] = j;
  774. anIntArray788[anInt718++] = i4;
  775. }
  776. if (mob.combatTimer > 150) {
  777. int j3 = i;
  778. if (mob.currentSprite == 8)
  779. j3 -= (10 * k1) / 100;
  780. else if (mob.currentSprite == 9)
  781. j3 += (10 * k1) / 100;
  782. gameGraphics.drawPicture((j3 + k / 2) - 12, (j + l / 2) - 12, SPRITE_MEDIA_START + 11);
  783. gameGraphics.drawText(String.valueOf(mob.anInt164), (j3 + k / 2) - 1, j + l / 2 + 5, 3, 0xffffff);
  784. }
  785. }
  786. if (mob.anInt179 == 1 && mob.anInt163 == 0) {
  787. int k3 = j1 + i + k / 2;
  788. if (mob.currentSprite == 8)
  789. k3 -= (20 * k1) / 100;
  790. else if (mob.currentSprite == 9)
  791. k3 += (20 * k1) / 100;
  792. int j4 = (16 * k1) / 100;
  793. int l4 = (16 * k1) / 100;
  794. gameGraphics.spriteClip1(k3 - j4 / 2, j - l4 / 2 - (10 * k1) / 100, j4, l4, SPRITE_MEDIA_START + 13);
  795. }
  796. }
  797.  
  798. private final void loadConfigFilter() {
  799. drawLoadingBarText(15, "Unpacking Configuration");
  800. EntityHandler.load();
  801. }
  802.  
  803. private final void loadModels() {
  804. drawLoadingBarText(75, "Loading 3d models");
  805.  
  806. String[] modelNames = {
  807. "torcha2", "torcha3", "torcha4",
  808. "skulltorcha2", "skulltorcha3", "skulltorcha4",
  809. "firea2", "firea3",
  810. "fireplacea2", "fireplacea3",
  811. "firespell2", "firespell3",
  812. "lightning2", "lightning3",
  813. "clawspell2", "clawspell3", "clawspell4", "clawspell5",
  814. "spellcharge2", "spellcharge3"
  815. };
  816. for (String name : modelNames) {
  817. EntityHandler.storeModel(name);
  818. }
  819.  
  820. byte[] models = load("models36.jag");
  821. if (models == null) {
  822. lastLoadedNull = true;
  823. return;
  824. }
  825. for (int j = 0; j < EntityHandler.getModelCount(); j++) {
  826. int k = DataOperations.method358(EntityHandler.getModelName(j) + ".ob3", models);
  827. if (k == 0) {
  828. gameDataModels[j] = new Model(1, 1);
  829. } else {
  830. gameDataModels[j] = new Model(models, k, true);
  831. }
  832. gameDataModels[j].isGiantCrystal = EntityHandler.getModelName(j).equals("giantcrystal");
  833. }
  834. }
  835.  
  836. protected final void handleMouseDown(int button, int x, int y) {
  837. mouseClickXArray[mouseClickArrayOffset] = x;
  838. mouseClickYArray[mouseClickArrayOffset] = y;
  839. mouseClickArrayOffset = mouseClickArrayOffset + 1 & 0x1fff;
  840. for (int l = 10; l < 4000; l++) {
  841. int i1 = mouseClickArrayOffset - l & 0x1fff;
  842. if (mouseClickXArray[i1] == x && mouseClickYArray[i1] == y) {
  843. boolean flag = false;
  844. for (int j1 = 1; j1 < l; j1++) {
  845. int k1 = mouseClickArrayOffset - j1 & 0x1fff;
  846. int l1 = i1 - j1 & 0x1fff;
  847. if (mouseClickXArray[l1] != x || mouseClickYArray[l1] != y)
  848. flag = true;
  849. if (mouseClickXArray[k1] != mouseClickXArray[l1] || mouseClickYArray[k1] != mouseClickYArray[l1])
  850. break;
  851. if (j1 == l - 1 && flag && lastWalkTimeout == 0 && logoutTimeout == 0) {
  852. logout();
  853. return;
  854. }
  855. }
  856.  
  857. }
  858. }
  859.  
  860. }
  861.  
  862. protected final void method4() {
  863. if (lastLoadedNull) {
  864. Graphics g = getGraphics();
  865. g.setColor(Color.black);
  866. g.fillRect(0, 0, 512, 356);
  867. g.setFont(new Font("Helvetica", 1, 16));
  868. g.setColor(Color.yellow);
  869. int i = 35;
  870. g.drawString("Sorry, an error has occured whilst loading DaNePK", 30, i);
  871. i += 50;
  872. g.setColor(Color.white);
  873. g.drawString("To fix this try the following (in order):", 30, i);
  874. i += 50;
  875. g.setColor(Color.white);
  876. g.setFont(new Font("Helvetica", 1, 12));
  877. g.drawString("1: Try closing ALL open web-browser windows, and reloading", 30, i);
  878. i += 30;
  879. g.drawString("2: Try clearing your web-browsers cache from tools->internet options", 30, i);
  880. i += 30;
  881. g.drawString("3: Try using a different game-world", 30, i);
  882. i += 30;
  883. g.drawString("4: Try rebooting your computer", 30, i);
  884. i += 30;
  885. g.drawString("5: Try selecting a different version of Java from the play-game menu", 30, i);
  886. changeThreadSleepModifier(1);
  887. return;
  888. }
  889. if (memoryError) {
  890. Graphics g2 = getGraphics();
  891. g2.setColor(Color.black);
  892. g2.fillRect(0, 0, 512, 356);
  893. g2.setFont(new Font("Helvetica", 1, 20));
  894. g2.setColor(Color.white);
  895. g2.drawString("Error - out of memory!", 50, 50);
  896. g2.drawString("Close ALL unnecessary programs", 50, 100);
  897. g2.drawString("and windows before loading the game", 50, 150);
  898. g2.drawString("DaNePK needs about 100mb of spare RAM", 50, 200);
  899. changeThreadSleepModifier(1);
  900. return;
  901. }
  902. try {
  903. if (loggedIn == 1) {
  904. gameGraphics.drawStringShadows = true;
  905. drawGame();
  906. } else {
  907. gameGraphics.drawStringShadows = false;
  908. drawLoginScreen();
  909. }
  910. }
  911. catch (OutOfMemoryError e) {
  912. garbageCollect();
  913. memoryError = true;
  914. }
  915. }
  916.  
  917. private final void walkToObject(int x, int y, int id, int type) {
  918. int i1;
  919. int j1;
  920. if (id == 0 || id == 4) {
  921. i1 = EntityHandler.getObjectDef(type).getWidth();
  922. j1 = EntityHandler.getObjectDef(type).getHeight();
  923. } else {
  924. j1 = EntityHandler.getObjectDef(type).getWidth();
  925. i1 = EntityHandler.getObjectDef(type).getHeight();
  926. }
  927. if (EntityHandler.getObjectDef(type).getType() == 2 || EntityHandler.getObjectDef(type).getType() == 3) {
  928. if (id == 0) {
  929. x--;
  930. i1++;
  931. }
  932. if (id == 2)
  933. j1++;
  934. if (id == 4)
  935. i1++;
  936. if (id == 6) {
  937. y--;
  938. j1++;
  939. }
  940. sendWalkCommand(sectionX, sectionY, x, y, (x + i1) - 1, (y + j1) - 1, false, true);
  941. return;
  942. } else {
  943. sendWalkCommand(sectionX, sectionY, x, y, (x + i1) - 1, (y + j1) - 1, true, true);
  944. return;
  945. }
  946. }
  947.  
  948. private final void drawBankBox() {
  949. char c = '\u0198';
  950. char c1 = '\u014E';
  951. if (mouseOverBankPageText > 0 && bankItemCount <= 48)
  952. mouseOverBankPageText = 0;
  953. if (mouseOverBankPageText > 1 && bankItemCount <= 96)
  954. mouseOverBankPageText = 1;
  955. if (mouseOverBankPageText > 2 && bankItemCount <= 144)
  956. mouseOverBankPageText = 2;
  957. if (selectedBankItem >= bankItemCount || selectedBankItem < 0)
  958. selectedBankItem = -1;
  959. if (selectedBankItem != -1 && bankItems[selectedBankItem] != selectedBankItemType) {
  960. selectedBankItem = -1;
  961. selectedBankItemType = -2;
  962. }
  963. if (mouseButtonClick != 0) {
  964. mouseButtonClick = 0;
  965. int i = super.mouseX - (256 - c / 2);
  966. int k = super.mouseY - (170 - c1 / 2);
  967. if (i >= 0 && k >= 12 && i < 408 && k < 280) {
  968. int i1 = mouseOverBankPageText * 48;
  969. for (int l1 = 0; l1 < 6; l1++) {
  970. for (int j2 = 0; j2 < 8; j2++) {
  971. int l6 = 7 + j2 * 49;
  972. int j7 = 28 + l1 * 34;
  973. if (i > l6 && i < l6 + 49 && k > j7 && k < j7 + 34 && i1 < bankItemCount && bankItems[i1] != -1) {
  974. selectedBankItemType = bankItems[i1];
  975. selectedBankItem = i1;
  976. }
  977. i1++;
  978. }
  979.  
  980. }
  981.  
  982. i = 256 - c / 2;
  983. k = 170 - c1 / 2;
  984. int k2;
  985. if (selectedBankItem < 0)
  986. k2 = -1;
  987. else
  988. k2 = bankItems[selectedBankItem];
  989. if (k2 != -1) {
  990. int j1 = bankItemsCount[selectedBankItem];
  991. // if (!EntityHandler.getItemDef(k2).isStackable() && j1 > 1)
  992. // j1 = 1;
  993. if (j1 >= 1 && super.mouseX >= i + 220 && super.mouseY >= k + 238 && super.mouseX < i + 250 && super.mouseY <= k + 249) {
  994. super.streamClass.createPacket(183);
  995. super.streamClass.add2ByteInt(k2);
  996. super.streamClass.add4ByteInt(1);
  997. super.streamClass.formatPacket();
  998. }
  999. if (j1 >= 10 && super.mouseX >= i + 250 && super.mouseY >= k + 238 && super.mouseX < i + 280 && super.mouseY <= k + 249) {
  1000. super.streamClass.createPacket(183);
  1001. super.streamClass.add2ByteInt(k2);
  1002. super.streamClass.add4ByteInt(10);
  1003. super.streamClass.formatPacket();
  1004. }
  1005. if (j1 >= 100 && super.mouseX >= i + 280 && super.mouseY >= k + 238 && super.mouseX < i + 305 && super.mouseY <= k + 249) {
  1006. super.streamClass.createPacket(183);
  1007. super.streamClass.add2ByteInt(k2);
  1008. super.streamClass.add4ByteInt(100);
  1009. super.streamClass.formatPacket();
  1010. }
  1011. if (j1 >= 1000 && super.mouseX >= i + 305 && super.mouseY >= k + 238 && super.mouseX < i + 335 && super.mouseY <= k + 249) {
  1012. super.streamClass.createPacket(183);
  1013. super.streamClass.add2ByteInt(k2);
  1014. super.streamClass.add4ByteInt(1000);
  1015. super.streamClass.formatPacket();
  1016. }
  1017. if (j1 >= 10000 && super.mouseX >= i + 335 && super.mouseY >= k + 238 && super.mouseX < i + 368 && super.mouseY <= k + 249) {
  1018. super.streamClass.createPacket(183);
  1019. super.streamClass.add2ByteInt(k2);
  1020. super.streamClass.add4ByteInt(10000);
  1021. super.streamClass.formatPacket();
  1022. }
  1023. if (super.mouseX >= i + 370 && super.mouseY >= k + 238 && super.mouseX < i + 400 && super.mouseY <= k + 249) {
  1024. super.streamClass.createPacket(183);
  1025. super.streamClass.add2ByteInt(k2);
  1026. super.streamClass.add4ByteInt(j1);
  1027. super.streamClass.formatPacket();
  1028. }
  1029.  
  1030. if (inventoryCount(k2) >= 1 && super.mouseX >= i + 220 && super.mouseY >= k + 263 && super.mouseX < i + 250 && super.mouseY <= k + 274) {
  1031. super.streamClass.createPacket(198);
  1032. super.streamClass.add2ByteInt(k2);
  1033. super.streamClass.add4ByteInt(1);
  1034. super.streamClass.formatPacket();
  1035. }
  1036. if (inventoryCount(k2) >= 10 && super.mouseX >= i + 250 && super.mouseY >= k + 263 && super.mouseX < i + 280 && super.mouseY <= k + 274)
  1037.  
  1038. {
  1039. super.streamClass.createPacket(198);
  1040. super.streamClass.add2ByteInt(k2);
  1041. super.streamClass.add4ByteInt(10);
  1042. super.streamClass.formatPacket();
  1043. }
  1044. if (inventoryCount(k2) >= 100 && super.mouseX >= i + 280 && super.mouseY >= k + 263 && super.mouseX < i + 305 && super.mouseY <= k + 274)
  1045.  
  1046. {
  1047. super.streamClass.createPacket(198);
  1048. super.streamClass.add2ByteInt(k2);
  1049. super.streamClass.add4ByteInt(100);
  1050. super.streamClass.formatPacket();
  1051. }
  1052. if (inventoryCount(k2) >= 1000 && super.mouseX >= i + 305 && super.mouseY >= k + 263 && super.mouseX < i + 335 && super.mouseY <= k +
  1053.  
  1054. 274) {
  1055. super.streamClass.createPacket(198);
  1056. super.streamClass.add2ByteInt(k2);
  1057. super.streamClass.add4ByteInt(1000);
  1058. super.streamClass.formatPacket();
  1059. }
  1060. if (inventoryCount(k2) >= 10000 && super.mouseX >= i + 335 && super.mouseY >= k + 263 && super.mouseX < i + 368 && super.mouseY <= k +
  1061.  
  1062. 274) {
  1063. super.streamClass.createPacket(198);
  1064. super.streamClass.add2ByteInt(k2);
  1065. super.streamClass.add4ByteInt(10000);
  1066. super.streamClass.formatPacket();
  1067. }
  1068. if (super.mouseX >= i + 370 && super.mouseY >= k + 263 && super.mouseX < i + 400 && super.mouseY <= k + 274) {
  1069. super.streamClass.createPacket(198);
  1070. super.streamClass.add2ByteInt(k2);
  1071. super.streamClass.add4ByteInt(inventoryCount(k2));
  1072. super.streamClass.formatPacket();
  1073. }
  1074. }
  1075. } else if (bankItemCount > 48 && i >= 50 && i <= 115 && k <= 12)
  1076. mouseOverBankPageText = 0;
  1077. else if (bankItemCount > 48 && i >= 115 && i <= 180 && k <= 12)
  1078. mouseOverBankPageText = 1;
  1079. else if (bankItemCount > 96 && i >= 180 && i <= 245 && k <= 12)
  1080. mouseOverBankPageText = 2;
  1081. else if (bankItemCount > 144 && i >= 245 && i <= 310 && k <= 12) {
  1082. mouseOverBankPageText = 3;
  1083. } else {
  1084. super.streamClass.createPacket(48);
  1085. super.streamClass.formatPacket();
  1086. showBank = false;
  1087. return;
  1088. }
  1089. }
  1090. int j = 256 - c / 2;
  1091. int l = 170 - c1 / 2;
  1092. gameGraphics.drawBox(j, l, 408, 12, 192);
  1093. int k1 = 0x989898;
  1094. gameGraphics.drawBoxAlpha(j, l + 12, 408, 17, k1, 160);
  1095. gameGraphics.drawBoxAlpha(j, l + 29, 8, 204, k1, 160);
  1096. gameGraphics.drawBoxAlpha(j + 399, l + 29, 9, 204, k1, 160);
  1097. gameGraphics.drawBoxAlpha(j, l + 233, 408, 47, k1, 160);
  1098. gameGraphics.drawString("Bank", j + 1, l + 10, 1, 0xffffff);
  1099. int i2 = 50;
  1100. if (bankItemCount > 48) {
  1101. int l2 = 0xffffff;
  1102. if (mouseOverBankPageText == 0)
  1103. l2 = 0xff0000;
  1104. else if (super.mouseX > j + i2 && super.mouseY >= l && super.mouseX < j + i2 + 65 && super.mouseY < l + 12)
  1105. l2 = 0xffff00;
  1106. gameGraphics.drawString("<page 1>", j + i2, l + 10, 1, l2);
  1107. i2 += 65;
  1108. l2 = 0xffffff;
  1109. if (mouseOverBankPageText == 1)
  1110. l2 = 0xff0000;
  1111. else if (super.mouseX > j + i2 && super.mouseY >= l && super.mouseX < j + i2 + 65 && super.mouseY < l + 12)
  1112. l2 = 0xffff00;
  1113. gameGraphics.drawString("<page 2>", j + i2, l + 10, 1, l2);
  1114. i2 += 65;
  1115. }
  1116. if (bankItemCount > 96) {
  1117. int i3 = 0xffffff;
  1118. if (mouseOverBankPageText == 2)
  1119. i3 = 0xff0000;
  1120. else if (super.mouseX > j + i2 && super.mouseY >= l && super.mouseX < j + i2 + 65 && super.mouseY < l + 12)
  1121. i3 = 0xffff00;
  1122. gameGraphics.drawString("<page 3>", j + i2, l + 10, 1, i3);
  1123. i2 += 65;
  1124. }
  1125. if (bankItemCount > 144) {
  1126. int j3 = 0xffffff;
  1127. if (mouseOverBankPageText == 3)
  1128. j3 = 0xff0000;
  1129. else if (super.mouseX > j + i2 && super.mouseY >= l && super.mouseX < j + i2 + 65 && super.mouseY < l + 12)
  1130. j3 = 0xffff00;
  1131. gameGraphics.drawString("<page 4>", j + i2, l + 10, 1, j3);
  1132. i2 += 65;
  1133. }
  1134. int k3 = 0xffffff;
  1135. if (super.mouseX > j + 320 && super.mouseY >= l && super.mouseX < j + 408 && super.mouseY < l + 12)
  1136. k3 = 0xff0000;
  1137. gameGraphics.drawBoxTextRight("Close window", j + 406, l + 10, 1, k3);
  1138. gameGraphics.drawString("Number in bank in green", j + 7, l + 24, 1, 65280);
  1139. gameGraphics.drawString("Number held in blue", j + 289, l + 24, 1, 65535);
  1140. int i7 = 0xd0d0d0;
  1141. int k7 = mouseOverBankPageText * 48;
  1142. for (int i8 = 0; i8 < 6; i8++) {
  1143. for (int j8 = 0; j8 < 8; j8++) {
  1144. int l8 = j + 7 + j8 * 49;
  1145. int i9 = l + 28 + i8 * 34;
  1146. if (selectedBankItem == k7)
  1147. gameGraphics.drawBoxAlpha(l8, i9, 49, 34, 0xff0000, 160);
  1148. else
  1149. gameGraphics.drawBoxAlpha(l8, i9, 49, 34, i7, 160);
  1150. gameGraphics.drawBoxEdge(l8, i9, 50, 35, 0);
  1151. if (k7 < bankItemCount && bankItems[k7] != -1) {
  1152. gameGraphics.spriteClip4(l8, i9, 48, 32, SPRITE_ITEM_START + EntityHandler.getItemDef(bankItems[k7]).getSprite(),
  1153.  
  1154. EntityHandler.getItemDef(bankItems[k7]).getPictureMask(), 0, 0, false);
  1155. gameGraphics.drawString(String.valueOf(bankItemsCount[k7]), l8 + 1, i9 + 10, 1, 65280);
  1156. gameGraphics.drawBoxTextRight(String.valueOf(inventoryCount(bankItems[k7])), l8 + 47, i9 + 29, 1, 65535);
  1157. }
  1158. k7++;
  1159. }
  1160.  
  1161. }
  1162.  
  1163. gameGraphics.drawLineX(j + 5, l + 256, 398, 0);
  1164. if (selectedBankItem == -1) {
  1165. gameGraphics.drawText("Select an object to withdraw or deposit", j + 204, l + 248, 3, 0xffff00);
  1166. return;
  1167. }
  1168. int k8;
  1169. if (selectedBankItem < 0)
  1170. k8 = -1;
  1171. else
  1172. k8 = bankItems[selectedBankItem];
  1173. if (k8 != -1) {
  1174. int l7 = bankItemsCount[selectedBankItem];
  1175. // if (!EntityHandler.getItemDef(k8).isStackable() && l7 > 1)
  1176. // l7 = 1;
  1177. if (l7 > 0) {
  1178. gameGraphics.drawString("Withdraw " + EntityHandler.getItemDef(k8).getName(), j + 2, l + 248, 1, 0xffffff);
  1179. int l3 = 0xffffff;
  1180. if (super.mouseX >= j + 220 && super.mouseY >= l + 238 && super.mouseX < j + 250 && super.mouseY <= l + 249)
  1181. l3 = 0xff0000;
  1182. gameGraphics.drawString("One", j + 222, l + 248, 1, l3);
  1183. if (l7 >= 10) {
  1184. int i4 = 0xffffff;
  1185. if (super.mouseX >= j + 250 && super.mouseY >= l + 238 && super.mouseX < j + 280 && super.mouseY <= l + 249)
  1186. i4 = 0xff0000;
  1187. gameGraphics.drawString("10", j + 252, l + 248, 1, i4);
  1188. }
  1189. if (l7 >= 100) {
  1190. int j4 = 0xffffff;
  1191. if (super.mouseX >= j + 280 && super.mouseY >= l + 238 && super.mouseX < j + 305 && super.mouseY <= l + 249)
  1192. j4 = 0xff0000;
  1193. gameGraphics.drawString("100", j + 282, l + 248, 1, j4);
  1194. }
  1195. if (l7 >= 1000) {
  1196. int k4 = 0xffffff;
  1197. if (super.mouseX >= j + 305 && super.mouseY >= l + 238 && super.mouseX < j + 335 && super.mouseY <= l + 249)
  1198. k4 = 0xff0000;
  1199. gameGraphics.drawString("1k", j + 307, l + 248, 1, k4);
  1200. }
  1201. if (l7 >= 10000) {
  1202. int l4 = 0xffffff;
  1203. if (super.mouseX >= j + 335 && super.mouseY >= l + 238 && super.mouseX < j + 368 && super.mouseY <= l + 249)
  1204. l4 = 0xff0000;
  1205. gameGraphics.drawString("10k", j + 337, l + 248, 1, l4);
  1206. }
  1207. int i5 = 0xffffff;
  1208. if (super.mouseX >= j + 370 && super.mouseY >= l + 238 && super.mouseX < j + 400 && super.mouseY <= l + 249)
  1209. i5 = 0xff0000;
  1210. gameGraphics.drawString("All", j + 370, l + 248, 1, i5);
  1211. }
  1212. if (inventoryCount(k8) > 0) {
  1213. gameGraphics.drawString("Deposit " + EntityHandler.getItemDef(k8).getName(), j + 2, l + 273, 1, 0xffffff);
  1214. int j5 = 0xffffff;
  1215. if (super.mouseX >= j + 220 && super.mouseY >= l + 263 && super.mouseX < j + 250 && super.mouseY <= l + 274)
  1216. j5 = 0xff0000;
  1217. gameGraphics.drawString("One", j + 222, l + 273, 1, j5);
  1218. if (inventoryCount(k8) >= 10) {
  1219. int k5 = 0xffffff;
  1220. if (super.mouseX >= j + 250 && super.mouseY >= l + 263 && super.mouseX < j + 280 && super.mouseY <= l + 274)
  1221. k5 = 0xff0000;
  1222. gameGraphics.drawString("10", j + 252, l + 273, 1, k5);
  1223. }
  1224. if (inventoryCount(k8) >= 100) {
  1225. int l5 = 0xffffff;
  1226. if (super.mouseX >= j + 280 && super.mouseY >= l + 263 && super.mouseX < j + 305 && super.mouseY <= l + 274)
  1227. l5 = 0xff0000;
  1228. gameGraphics.drawString("100", j + 282, l + 273, 1, l5);
  1229. }
  1230. if (inventoryCount(k8) >= 1000) {
  1231. int i6 = 0xffffff;
  1232. if (super.mouseX >= j + 305 && super.mouseY >= l + 263 && super.mouseX < j + 335 && super.mouseY <= l + 274)
  1233. i6 = 0xff0000;
  1234. gameGraphics.drawString("1k", j + 307, l + 273, 1, i6);
  1235. }
  1236. if (inventoryCount(k8) >= 10000) {
  1237. int j6 = 0xffffff;
  1238. if (super.mouseX >= j + 335 && super.mouseY >= l + 263 && super.mouseX < j + 368 && super.mouseY <= l + 274)
  1239. j6 = 0xff0000;
  1240. gameGraphics.drawString("10k", j + 337, l + 273, 1, j6);
  1241. }
  1242. int k6 = 0xffffff;
  1243. if (super.mouseX >= j + 370 && super.mouseY >= l + 263 && super.mouseX < j + 400 && super.mouseY <= l + 274)
  1244. k6 = 0xff0000;
  1245. gameGraphics.drawString("All", j + 370, l + 273, 1, k6);
  1246. }
  1247. }
  1248. }
  1249.  
  1250. private final void drawLoggingOutBox() {
  1251. gameGraphics.drawBox(126, 137, 260, 60, 0);
  1252. gameGraphics.drawBoxEdge(126, 137, 260, 60, 0xffffff);
  1253. gameGraphics.drawText("Logging out...", 256, 173, 5, 0xffffff);
  1254. }
  1255.  
  1256. private final void drawInventoryMenu(boolean flag) {
  1257. int i = ((GameImage) (gameGraphics)).menuDefaultWidth - 248;
  1258. gameGraphics.drawPicture(i, 3, SPRITE_MEDIA_START + 1);
  1259. for (int j = 0; j < anInt882; j++) {
  1260. int k = i + (j % 5) * 49;
  1261. int i1 = 36 + (j / 5) * 34;
  1262. if (j < inventoryCount && wearing[j] == 1)
  1263. gameGraphics.drawBoxAlpha(k, i1, 49, 34, 0xff0000, 128);
  1264. else
  1265. gameGraphics.drawBoxAlpha(k, i1, 49, 34, GameImage.convertRGBToLong(181, 181, 181), 128);
  1266. if (j < inventoryCount) {
  1267. gameGraphics.spriteClip4(k, i1, 48, 32, SPRITE_ITEM_START + EntityHandler.getItemDef(inventoryItems[j]).getSprite(),
  1268.  
  1269. (int)(inventoryItems[j] == 1288 ? (Math.random() * 16777215D) : EntityHandler.getItemDef(inventoryItems[j]).getPictureMask()), 0, 0, false);
  1270. //gameGraphics.spriteClip4(k, i1, 48, 32, SPRITE_ITEM_START + EntityHandler.getItemDef(inventoryItems[j]).getSprite(),
  1271.  
  1272. EntityHandler.getItemDef(inventoryItems[j]).getPictureMask(), 0, 0, false);
  1273. if (EntityHandler.getItemDef(inventoryItems[j]).isStackable())
  1274. gameGraphics.drawString(String.valueOf(inventoryItemsCount[j]), k + 1, i1 + 10, 1, 0xffff00);
  1275. }
  1276. }
  1277.  
  1278. for (int l = 1; l <= 4; l++)
  1279. gameGraphics.drawLineY(i + l * 49, 36, (anInt882 / 5) * 34, 0);
  1280.  
  1281. for (int j1 = 1; j1 <= anInt882 / 5 - 1; j1++)
  1282. gameGraphics.drawLineX(i, 36 + j1 * 34, 245, 0);
  1283.  
  1284. if (!flag)
  1285. return;
  1286. i = super.mouseX - (((GameImage) (gameGraphics)).menuDefaultWidth - 248);
  1287. int k1 = super.mouseY - 36;
  1288. if (i >= 0 && k1 >= 0 && i < 248 && k1 < (anInt882 / 5) * 34) {
  1289. int currentInventorySlot = i / 49 + (k1 / 34) * 5;
  1290. if (currentInventorySlot < inventoryCount) {
  1291. int i2 = inventoryItems[currentInventorySlot];
  1292. ItemDef itemDef = EntityHandler.getItemDef(i2);
  1293. if (selectedSpell >= 0) {
  1294. if (EntityHandler.getSpellDef(selectedSpell).getSpellType() == 3) {
  1295. menuText1[menuLength] = "Cast " + EntityHandler.getSpellDef(selectedSpell).getName() + " on";
  1296. menuText2[menuLength] = "@lre@" + itemDef.getName();
  1297. menuID[menuLength] = 600;
  1298. menuActionType[menuLength] = currentInventorySlot;
  1299. menuActionVariable[menuLength] = selectedSpell;
  1300. menuLength++;
  1301. return;
  1302. }
  1303. } else {
  1304. if (selectedItem >= 0) {
  1305. menuText1[menuLength] = "Use " + selectedItemName + " with";
  1306. menuText2[menuLength] = "@lre@" + itemDef.getName();
  1307. menuID[menuLength] = 610;
  1308. menuActionType[menuLength] = currentInventorySlot;
  1309. menuActionVariable[menuLength] = selectedItem;
  1310. menuLength++;
  1311. return;
  1312. }
  1313. if (wearing[currentInventorySlot] == 1) {
  1314. menuText1[menuLength] = "Remove";
  1315. menuText2[menuLength] = "@lre@" + itemDef.getName();
  1316. menuID[menuLength] = 620;
  1317. menuActionType[menuLength] = currentInventorySlot;
  1318. menuLength++;
  1319. } else if (EntityHandler.getItemDef(i2).isWieldable()) {
  1320. menuText1[menuLength] = "Wear";
  1321. menuText2[menuLength] = "@lre@" + itemDef.getName();
  1322. menuID[menuLength] = 630;
  1323. menuActionType[menuLength] = currentInventorySlot;
  1324. menuLength++;
  1325. }
  1326. if (!itemDef.getCommand().equals("")) {
  1327. menuText1[menuLength] = itemDef.getCommand();
  1328. menuText2[menuLength] = "@lre@" + itemDef.getName();
  1329. menuID[menuLength] = 640;
  1330. menuActionType[menuLength] = currentInventorySlot;
  1331. menuLength++;
  1332. }
  1333. menuText1[menuLength] = "Use";
  1334. menuText2[menuLength] = "@lre@" + itemDef.getName();
  1335. menuID[menuLength] = 650;
  1336. menuActionType[menuLength] = currentInventorySlot;
  1337. menuLength++;
  1338. menuText1[menuLength] = "Drop";
  1339. menuText2[menuLength] = "@lre@" + itemDef.getName();
  1340. menuID[menuLength] = 660;
  1341. menuActionType[menuLength] = currentInventorySlot;
  1342. menuLength++;
  1343. menuText1[menuLength] = "Hammer";
  1344. menuText2[menuLength] = "@lre@" + itemDef.getName();
  1345. menuID[menuLength] = 670;
  1346. menuActionType[menuLength] = currentInventorySlot;
  1347. menuLength++;
  1348. menuText1[menuLength] = "Examine";
  1349. menuText2[menuLength] = "@lre@" + itemDef.getName() + (ourPlayer.admin >= 2 ? " @or1@(" + i2 + ")" : "");
  1350. menuID[menuLength] = 3600;
  1351. menuActionType[menuLength] = i2;
  1352. menuLength++;
  1353. }
  1354. }
  1355. }
  1356. }
  1357.  
  1358. private final void drawChatMessageTabs() {
  1359. gameGraphics.drawPicture(0, windowHeight - 4, SPRITE_MEDIA_START + 23);
  1360. int i = GameImage.convertRGBToLong(200, 200, 255);
  1361. if (messagesTab == 0)
  1362. i = GameImage.convertRGBToLong(255, 200, 50);
  1363. if (anInt952 % 30 > 15)
  1364. i = GameImage.convertRGBToLong(255, 50, 50);
  1365. gameGraphics.drawText("All Messages", 54, windowHeight + 7, 0, i);
  1366. i = GameImage.convertRGBToLong(200, 200, 255);
  1367. if (messagesTab == 1)
  1368. i = GameImage.convertRGBToLong(255, 200, 50);
  1369. if (anInt953 % 30 > 15)
  1370. i = GameImage.convertRGBToLong(255, 50, 50);
  1371. gameGraphics.drawText("Chat History", 155, windowHeight + 7, 0, i);
  1372. i = GameImage.convertRGBToLong(200, 200, 255);
  1373. if (messagesTab == 2)
  1374. i = GameImage.convertRGBToLong(255, 200, 50);
  1375. if (anInt954 % 30 > 15)
  1376. i = GameImage.convertRGBToLong(255, 50, 50);
  1377. gameGraphics.drawText("Clan History", 457, windowHeight + 7, 0, i);
  1378. i = GameImage.convertRGBToLong(255, 200, 50);
  1379. gameGraphics.drawText("Private History", 355, windowHeight + 7, 0, i);
  1380. i = GameImage.convertRGBToLong(200, 200, 255);
  1381. if (messagesTab == 4)
  1382. i = GameImage.convertRGBToLong(255, 200, 50);
  1383. if (anInt956 % 30 > 15)
  1384. i = GameImage.convertRGBToLong(255, 50, 50);
  1385. gameGraphics.drawText("Global History", 255, windowHeight + 7, 0, i);
  1386. i = GameImage.convertRGBToLong(200, 200, 255);
  1387. if (messagesTab == 3)
  1388. i = GameImage.convertRGBToLong(200, 200, 255);
  1389. if (anInt955 % 30 > 15)
  1390. i = GameImage.convertRGBToLong(200, 200, 255);
  1391. }
  1392.  
  1393. private final void method62() {
  1394. gameGraphics.f1Toggle = false;
  1395. gameGraphics.method211();
  1396. characterDesignMenu.drawMenu();
  1397. int i = 140;
  1398. int j = 50;
  1399. i += 116;
  1400. j -= 25;
  1401. gameGraphics.spriteClip3(i - 32 - 55, j, 64, 102, EntityHandler.getAnimationDef(character2Colour).getNumber(),
  1402.  
  1403. characterTopBottomColours[characterBottomColour]);
  1404. gameGraphics.spriteClip4(i - 32 - 55, j, 64, 102, EntityHandler.getAnimationDef(characterBodyGender).getNumber(),
  1405.  
  1406. characterTopBottomColours[characterTopColour], characterSkinColours[characterSkinColour], 0, false);
  1407. gameGraphics.spriteClip4(i - 32 - 55, j, 64, 102, EntityHandler.getAnimationDef(characterHeadType).getNumber(),
  1408.  
  1409. characterHairColours[characterHairColour], characterSkinColours[characterSkinColour], 0, false);
  1410. gameGraphics.spriteClip3(i - 32, j, 64, 102, EntityHandler.getAnimationDef(character2Colour).getNumber() + 6,
  1411.  
  1412. characterTopBottomColours[characterBottomColour]);
  1413. gameGraphics.spriteClip4(i - 32, j, 64, 102, EntityHandler.getAnimationDef(characterBodyGender).getNumber() + 6,
  1414.  
  1415. characterTopBottomColours[characterTopColour], characterSkinColours[characterSkinColour], 0, false);
  1416. gameGraphics.spriteClip4(i - 32, j, 64, 102, EntityHandler.getAnimationDef(characterHeadType).getNumber() + 6,
  1417.  
  1418. characterHairColours[characterHairColour], characterSkinColours[characterSkinColour], 0, false);
  1419. gameGraphics.spriteClip3((i - 32) + 55, j, 64, 102, EntityHandler.getAnimationDef(character2Colour).getNumber() + 12,
  1420.  
  1421. characterTopBottomColours[characterBottomColour]);
  1422. gameGraphics.spriteClip4((i - 32) + 55, j, 64, 102, EntityHandler.getAnimationDef(characterBodyGender).getNumber() + 12,
  1423.  
  1424. characterTopBottomColours[characterTopColour], characterSkinColours[characterSkinColour], 0, false);
  1425. gameGraphics.spriteClip4((i - 32) + 55, j, 64, 102, EntityHandler.getAnimationDef(characterHeadType).getNumber() + 12,
  1426.  
  1427. characterHairColours[characterHairColour], characterSkinColours[characterSkinColour], 0, false);
  1428. gameGraphics.drawPicture(0, windowHeight, SPRITE_MEDIA_START + 22);
  1429. gameGraphics.drawImage(aGraphics936, 0, 0);
  1430. }
  1431.  
  1432. private final Mob makePlayer(int mobArrayIndex, int x, int y, int sprite) {
  1433. if (mobArray[mobArrayIndex] == null) {
  1434. mobArray[mobArrayIndex] = new Mob();
  1435. mobArray[mobArrayIndex].serverIndex = mobArrayIndex;
  1436. mobArray[mobArrayIndex].mobIntUnknown = 0;
  1437. }
  1438. Mob mob = mobArray[mobArrayIndex];
  1439. boolean flag = false;
  1440. for (int i1 = 0; i1 < lastPlayerCount; i1++) {
  1441. if (lastPlayerArray[i1].serverIndex != mobArrayIndex)
  1442. continue;
  1443. flag = true;
  1444. break;
  1445. }
  1446.  
  1447. if (flag) {
  1448. mob.nextSprite = sprite;
  1449. int j1 = mob.waypointCurrent;
  1450. if (x != mob.waypointsX[j1] || y != mob.waypointsY[j1]) {
  1451. mob.waypointCurrent = j1 = (j1 + 1) % 10;
  1452. mob.waypointsX[j1] = x;
  1453. mob.waypointsY[j1] = y;
  1454. }
  1455. } else {
  1456. mob.serverIndex = mobArrayIndex;
  1457. mob.waypointEndSprite = 0;
  1458. mob.waypointCurrent = 0;
  1459. mob.waypointsX[0] = mob.currentX = x;
  1460. mob.waypointsY[0] = mob.currentY = y;
  1461. mob.nextSprite = mob.currentSprite = sprite;
  1462. mob.stepCount = 0;
  1463. }
  1464. playerArray[playerCount++] = mob;
  1465. return mob;
  1466. }
  1467.  
  1468. private final void drawWelcomeBox() {
  1469. int i = 65;
  1470. if (!lastLoggedInAddress.equals("0.0.0.0"))
  1471. i += 30;
  1472. if (subscriptionLeftDays > 0)
  1473. i += 15;
  1474. int j = 167 - i / 2;
  1475. gameGraphics.drawBox(56, 167 - i / 2, 400, i, 0);
  1476. gameGraphics.drawBoxEdge(56, 167 - i / 2, 400, i, 0xffffff);
  1477. j += 20;
  1478. gameGraphics.drawText("Welcome to DaNePK " + currentUser, 256, j, 4, 0xffff00);
  1479. j += 30;
  1480. String s;
  1481. if (lastLoggedInDays == 0)
  1482. s = "earlier today";
  1483. else if (lastLoggedInDays == 1)
  1484. s = "yesterday";
  1485. else
  1486. s = lastLoggedInDays + " days ago";
  1487. if (!lastLoggedInAddress.equals("0.0.0.0")) {
  1488. gameGraphics.drawText("You last logged in " + s, 256, j, 1, 0xffffff);
  1489. j += 15;
  1490. gameGraphics.drawText("from: " + lastLoggedInAddress, 256, j, 1, 0xffffff);
  1491. j += 15;
  1492. }
  1493. if (subscriptionLeftDays > 0) {
  1494. gameGraphics.drawText("Subscription Left: " + subscriptionLeftDays + " days", 256, j, 1, 0xffffff);
  1495. j += 15;
  1496. }
  1497. int l = 0xffffff;
  1498. if (super.mouseY > j - 12 && super.mouseY <= j && super.mouseX > 106 && super.mouseX < 406)
  1499. l = 0xff0000;
  1500. gameGraphics.drawText("Click here to close window", 256, j, 1, l);
  1501. if (mouseButtonClick == 1) {
  1502. if (l == 0xff0000)
  1503. showWelcomeBox = false;
  1504. if ((super.mouseX < 86 || super.mouseX > 426) && (super.mouseY < 167 - i / 2 || super.mouseY > 167 + i / 2))
  1505. showWelcomeBox = false;
  1506. }
  1507. mouseButtonClick = 0;
  1508. }
  1509.  
  1510. private final void logout() {
  1511. if (loggedIn == 0) {
  1512. return;
  1513. }
  1514. if (lastWalkTimeout > 450) {
  1515. displayMessage("@cya@You can't logout during combat!", 3, 0);
  1516. return;
  1517. }
  1518. if (lastWalkTimeout > 0) {
  1519. displayMessage("@cya@You can't logout for 10 seconds after combat", 3, 0);
  1520. return;
  1521. }
  1522. super.streamClass.createPacket(129);
  1523. super.streamClass.formatPacket();
  1524. logoutTimeout = 1000;
  1525. }
  1526.  
  1527.  
  1528. private final void drawPlayerInfoMenu(boolean flag) {
  1529. int i = ((GameImage) (gameGraphics)).menuDefaultWidth - 199;
  1530. int j = 36;
  1531. gameGraphics.drawPicture(i - 49, 3, SPRITE_MEDIA_START + 3);
  1532. char c = '\304';
  1533. char c1 = '\350';
  1534. int l;
  1535. int kl;
  1536. int k = l = kl = GameImage.convertRGBToLong(160, 160, 160);
  1537. if (anInt826 == 0) {
  1538. k = GameImage.convertRGBToLong(220, 220, 220);
  1539. }
  1540. else if (anInt826 == 1) {
  1541. }
  1542. else if (anInt826 == 2) {
  1543. kl = GameImage.convertRGBToLong(220, 220, 220);
  1544. }
  1545.  
  1546. l = GameImage.convertRGBToLong(220, 220, 220);
  1547. gameGraphics.drawBoxAlpha(i, j, c / 2, 24, k, 128);
  1548. gameGraphics.drawBoxAlpha(i + c / 2, j, c / 2, 24, l, 128);
  1549. gameGraphics.drawBoxAlpha(i, j + 24, c, c1 - 24, GameImage.convertRGBToLong(220, 220, 220), 128);
  1550. gameGraphics.drawLineX(i, j + 24, c, 0);
  1551. gameGraphics.drawLineY(i + c / 2, j, 24, 0);
  1552. gameGraphics.drawText("Stats", i + c / 4, j + 16, 4, 0);
  1553. gameGraphics.drawText("Info", i + c / 4 + c / 2, j + 16, 4, 0);
  1554. if (anInt826 == 0) {
  1555. int i1 = 72;
  1556. int k1 = -1;
  1557. int i9 = 72;
  1558. gameGraphics.drawString("Skills", i + 5, i1, 3, 0xFFCC00);
  1559. i1 += 13;
  1560. for(int l1 = 0; l1 < 4; l1++)
  1561. {
  1562. int i2 = 0xffffff;
  1563. if(super.mouseX > i + 3 && super.mouseY >= i1 - 11 && super.mouseY < i1 + 2 && super.mouseX < i + 90)
  1564. {
  1565. i2 = 0xff0000;
  1566. k1 = l1;
  1567. }
  1568. gameGraphics.drawString((new
  1569.  
  1570. StringBuilder()).append(skillArray[l1]).append(":@yel@").append(playerStatCurrent[l1]).append("/").append(playerStatBase[l1]).toString(), i + 5, i1, 1, i2);
  1571. i1 += 13;
  1572. }
  1573.  
  1574. i9 += 13;
  1575. for(int l1 = 0; l1 < 3; l1++)
  1576. {
  1577. int i2 = 0xffffff;
  1578. i2 = 0xffffff;
  1579. if(super.mouseX >= i + 90 && super.mouseY >= i9 - 11 && super.mouseY < i9 + 2 && super.mouseX < i + 196)
  1580. {
  1581. i2 = 0xff0000;
  1582. k1 = l1 + 4;
  1583. }
  1584. gameGraphics.drawString((new StringBuilder()).append(skillArray[l1 + 4]).append(":@yel@").append(playerStatCurrent[l1 +
  1585.  
  1586. 4]).append("/").append(playerStatBase[l1 + 4]).toString(), (i + c / 2) - 5, i9, 1, i2);
  1587. i9 += 13;
  1588. }
  1589. i1 += 8;
  1590. gameGraphics.drawString("Equipment Status", i + 5, i1, 3, 0xFFCC00);
  1591. i1 += 12;
  1592. for (int j2 = 0; j2 < 3; j2++) {
  1593. gameGraphics.drawString(equipmentStatusName[j2] + ":@yel@" + equipmentStatus[j2], i + 5, i1, 1, 0xffffff);
  1594. gameGraphics.drawString(equipmentStatusName[j2 + 3] + ":@yel@" + equipmentStatus[j2 + 3], i + c / 2 + 25, i1, 1, 0xffffff);
  1595. i1 += 13;
  1596. }
  1597.  
  1598. i1 += 6;
  1599. gameGraphics.drawLineX(i, i1 - 15, c, 0);
  1600. if (k1 != -1) {
  1601. gameGraphics.drawString(skillArrayLong[k1] + " skill", i + 5, i1, 1, 0xffff00);
  1602. i1 += 12;
  1603. int k2 = experienceArray[0];
  1604. for (int i3 = 0; i3 < 98; i3++)
  1605. if (playerStatExperience[k1] >= experienceArray[i3])
  1606. k2 = experienceArray[i3 + 1];
  1607.  
  1608. gameGraphics.drawString("Total xp: " + playerStatExperience[k1], i + 5, i1, 1, 0xffffff);
  1609. i1 += 12;
  1610. gameGraphics.drawString("Next level at: " + k2, i + 5, i1, 1, 0xffffff);
  1611. i1 += 12;
  1612. gameGraphics.drawString("Required xp: " + (k2 - playerStatExperience[k1]), i + 5, i1, 1, 0xffffff);
  1613. } else {
  1614. gameGraphics.drawString("Overall levels", i + 5, i1, 1, 0xFFCC00);
  1615. i1 += 12;
  1616. int skillTotal = 0;
  1617. long expTotal = 0;
  1618. for (int j3 = 0; j3 < 18; j3++) {
  1619. skillTotal += playerStatBase[j3];
  1620. expTotal += playerStatExperience[j3];
  1621. }
  1622. gameGraphics.drawString("Skill total: " + skillTotal, i + 5, i1, 1, 0xffffff);
  1623. double prayerBonus = 1.0D;
  1624. if(prayerOn[1])
  1625. {
  1626. prayerBonus = 1.05D;
  1627. } else
  1628. if(prayerOn[4])
  1629. {
  1630. prayerBonus = 1.1000000000000001D;
  1631. } else
  1632. if(prayerOn[10])
  1633. {
  1634. prayerBonus = 1.1499999999999999D;
  1635. }
  1636. int modeBonus = 0;
  1637. if(combatStyle == 0)
  1638. {
  1639. modeBonus = 1;
  1640. } else
  1641. if(combatStyle == 1)
  1642. {
  1643. modeBonus = 3;
  1644. }
  1645. double str = (double)playerStatCurrent[2] * prayerBonus + (double)modeBonus;
  1646. int maxHit = (int)(str * ((double)equipmentStatus[2] * 0.00175D + 0.10000000000000001D) + 2.0499999999999998D);
  1647. gameGraphics.drawString("@red@Max Hit", i + 135, i1, 1, 0x00FFCC);
  1648. i1 += 12;
  1649. gameGraphics.drawString("Total xp: " + expTotal, i + 5, i1, 1, 0x00FF33);
  1650. gameGraphics.drawString("@red@" + maxHit, i + 150, i1, 1, 0xffffff);
  1651. i1 += 12;
  1652. gameGraphics.drawString("Combat level: " + ourPlayer.level, i + 5, i1, 1, 0xFF9900);
  1653. }
  1654. }
  1655.  
  1656. if (anInt826 == 1) {
  1657. int i1 = 72; // Info
  1658. if(ourPlayer.admin == 3) {
  1659. gameGraphics.drawString("@whi@Rank: #adm# @or1@Administrator", 318, i1, 1, 0xffffff);
  1660. }
  1661. if(ourPlayer.admin == 2) {
  1662. gameGraphics.drawString("@whi@Rank: #mod# @or1@Moderator", 318, i1, 1, 0xffffff);
  1663. }
  1664. if(ourPlayer.admin == 1) {
  1665. gameGraphics.drawString("@whi@Rank: #pmd# @or1@Player Moderator", 318, i1, 1, 0xffffff);
  1666. }
  1667. if(ourPlayer.admin == 4) {
  1668. gameGraphics.drawString("@whi@Rank: #evt# @or1@Event Team", 318, i1, 1, 0xffffff);
  1669. }
  1670. if(ourPlayer.admin == 5) {
  1671. gameGraphics.drawString("@whi@Rank: #dev# @or1@Developer", 318, i1, 1, 0xffffff);
  1672. }
  1673. if(ourPlayer.admin == 0) {
  1674. gameGraphics.drawString("@whi@Rank: @or1@Member", 318, i1, 1, 0xffffff);
  1675. }
  1676. i1 += 13;
  1677. gameGraphics.drawString("@whi@Username: @or1@" + ourPlayer.name, 318, i1, 1, 0xffff00);
  1678. i1 += 13;
  1679. gameGraphics.drawString((ourPlayer.flag == null) || (ourPlayer.flag == "") ? "@whi@Country: @or1@Not Set" : "Country: " + "#f" +
  1680.  
  1681. ourPlayer.flag + "#", 318, i1, 1, 0xffffff);
  1682. i1 += 13;
  1683. if(!ourPlayer.clan.equalsIgnoreCase("null")) {
  1684. gameGraphics.drawString("@whi@Clan: @or1@" + ourPlayer.clan, 318, i1, 1, 0xffffff);
  1685. } else {
  1686. gameGraphics.drawString("@whi@Clan: @or1@ Not Set", 318, i1, 1, 0xffffff);
  1687. }
  1688. i1 += 22;
  1689. gameGraphics.drawString("@whi@Kills: @or1@" + kills + "", 318, i1, 1, 0xffff00);
  1690. i1 += 13;
  1691. gameGraphics.drawString("@whi@Deaths: @or1@" + deaths + "", 318, i1, 1, 0xffff00);
  1692. i1 += 13;
  1693. double kdRatio = 0.0D;
  1694. if(deaths != 0)
  1695. kdRatio = kills / deaths;
  1696. else
  1697. kdRatio = kills;
  1698. gameGraphics.drawString("@whi@K/D Ratio: @or1@" + kdRatio, 318, i1, 1, 16777215);
  1699. i1 += 13;
  1700. gameGraphics.drawString("@whi@Killing Spree: @or1@" + killingspree + "", 318, i1, 1, 0xffff00);
  1701. i1 += 13;
  1702. if(killingspree == 0) {
  1703. gameGraphics.drawString("@whi@Killing Spree Rank: @or1@" + killingSpreeRank[0], 318, i1, 1, 0xffff00);
  1704. }
  1705. if(killingspree >= 1 && killingspree < 5) {
  1706. gameGraphics.drawString("@whi@Killing Spree Rank: @or1@" + killingSpreeRank[1], 318, i1, 1, 0xffff00);
  1707. }
  1708. if(killingspree >= 5 && killingspree < 10) {
  1709. gameGraphics.drawString("@whi@Killing Spree Rank: @or1@" + killingSpreeRank[2], 318, i1, 1, 0xffff00);
  1710. }
  1711. if(killingspree >= 10 && killingspree < 15) {
  1712. gameGraphics.drawString("@whi@Killing Spree Rank: @or1@" + killingSpreeRank[3], 318, i1, 1, 0xffff00);
  1713. }
  1714. if(killingspree >= 15 && killingspree < 20) {
  1715. gameGraphics.drawString("@whi@Killing Spree Rank: @or1@" + killingSpreeRank[4], 318, i1, 1, 0xffff00);
  1716. }
  1717. if(killingspree >= 20 && killingspree < 25) {
  1718. gameGraphics.drawString("@whi@Killing Spree Rank: @or1@" + killingSpreeRank[5], 318, i1, 1, 0xffff00);
  1719. }
  1720. i1 += 22;
  1721. if(taskStatus == 0) {
  1722. gameGraphics.drawString("@whi@Current Task: @red@No Task Set", 318, i1, 1, 0xffff00);
  1723. } else {
  1724. gameGraphics.drawString("@whi@Current Task: @or1@" + moneyTask, 318, i1, 1, 0xffff00);
  1725. }
  1726. i1 += 13;
  1727. if(taskStatus == 1 && remaining == 0) {
  1728. gameGraphics.drawString("@whi@Remaining: @gre@Collect Reward", 318, i1, 1, 0xffff00);
  1729. } else
  1730. if(taskStatus == 0 && remaining == 0) {
  1731. gameGraphics.drawString("@whi@Remaining: @red@No Task Set", 318, i1, 1, 0xffff00);
  1732. } else {
  1733. gameGraphics.drawString("@whi@Remaining: @or1@" + remaining, 318, i1, 1, 0xffff00);
  1734. }
  1735. i1 += 13;
  1736. gameGraphics.drawString("@whi@Completed Tasks: @or1@" + completedtasks, 318, i1, 1, 0xffff00);
  1737. i1 += 13;
  1738. gameGraphics.drawString("@whi@Task Points: @or1@" + taskpoints, 318, i1, 1, 0xffff00);
  1739. i1 += 22;
  1740. gameGraphics.drawString("@yel@TASK REWARD INFORMATION", 318, i1, 1, 0xffff00);
  1741. i1 += 13;
  1742. if(taskStatus == 0) {
  1743. gameGraphics.drawString("@whi@Exp: @red@" + "No Task Set", 318, i1, 1, 0xffff00);
  1744. i1 += 13;
  1745. gameGraphics.drawString("@whi@Cash: @red@" + "No Task Set", 318, i1, 1, 0xffff00);
  1746. i1 += 13;
  1747. gameGraphics.drawString("@whi@Item: @red@" + "No Task Set", 318, i1, 1, 0xffff00);
  1748. } else {
  1749. gameGraphics.drawString("@whi@Experience: @or1@" + taskexp + " Token(s)", 318, i1, 1, 0xffff00);
  1750. i1 += 13;
  1751. gameGraphics.drawString("@whi@Random Cash: @or1@" + taskcash, 318, i1, 1, 0xffff00);
  1752. i1 += 13;
  1753. gameGraphics.drawString("@whi@Random Item: @or1@" + "#i" + taskitem + "#", 318, i1, 1, 0xffff00);
  1754. }
  1755.  
  1756. }
  1757. if (!flag)
  1758. return;
  1759. i = super.mouseX - (((GameImage) (gameGraphics)).menuDefaultWidth - 199);
  1760. j = super.mouseY - 36;
  1761. if (i >= 0 && j >= 0 && i < c && j < c1) {
  1762. if (anInt826 == 1)
  1763. //questMenu.updateActions(i + (((GameImage) (gameGraphics)).menuDefaultWidth - 199), j + 36, super.lastMouseDownButton,
  1764.  
  1765. super.mouseDownButton);
  1766. if (j <= 24 && mouseButtonClick == 1) {
  1767. if (i < 64) {
  1768. anInt826 = 0;
  1769. return;
  1770. }
  1771. if (i > 64 && i < 128) {
  1772. anInt826 = 1;
  1773. return;
  1774. }
  1775. if (i > 128) {
  1776. anInt826 = 2;
  1777. }
  1778. }
  1779. }
  1780. }
  1781.  
  1782. private final void drawWildernessWarningBox() {
  1783. int i = 97;
  1784. gameGraphics.drawBox(86, 77, 340, 180, 0);
  1785. gameGraphics.drawBoxEdge(86, 77, 340, 180, 0xffffff);
  1786. gameGraphics.drawText("Warning! Proceed with caution", 256, i, 4, 0xff0000);
  1787. i += 26;
  1788. gameGraphics.drawText("If you go much further north you will enter the", 256, i, 1, 0xffffff);
  1789. i += 13;
  1790. gameGraphics.drawText("wilderness. This a very dangerous area where", 256, i, 1, 0xffffff);
  1791. i += 13;
  1792. gameGraphics.drawText("other players can attack you!", 256, i, 1, 0xffffff);
  1793. i += 22;
  1794. gameGraphics.drawText("The further north you go the more dangerous it", 256, i, 1, 0xffffff);
  1795. i += 13;
  1796. gameGraphics.drawText("becomes, but the more treasure you will find.", 256, i, 1, 0xffffff);
  1797. i += 22;
  1798. gameGraphics.drawText("In the wilderness an indicator at the bottom-right", 256, i, 1, 0xffffff);
  1799. i += 13;
  1800. gameGraphics.drawText("of the screen will show the current level of danger", 256, i, 1, 0xffffff);
  1801. i += 22;
  1802. int j = 0xffffff;
  1803. if (super.mouseY > i - 12 && super.mouseY <= i && super.mouseX > 181 && super.mouseX < 331)
  1804. j = 0xff0000;
  1805. gameGraphics.drawText("Click here to close window", 256, i, 1, j);
  1806. if (mouseButtonClick != 0) {
  1807. if (super.mouseY > i - 12 && super.mouseY <= i && super.mouseX > 181 && super.mouseX < 331)
  1808. wildernessType = 2;
  1809. if (super.mouseX < 86 || super.mouseX > 426 || super.mouseY < 77 || super.mouseY > 257)
  1810. wildernessType = 2;
  1811. mouseButtonClick = 0;
  1812. }
  1813. }
  1814.  
  1815. final void method68(int i, int j, int k, int l, int i1, int j1, int k1) {
  1816. int l1 = EntityHandler.getItemDef(i1).getSprite() + SPRITE_ITEM_START;
  1817. int i2 = EntityHandler.getItemDef(i1).getPictureMask();
  1818. gameGraphics.spriteClip4(i, j, k, l, l1, i2, 0, 0, false);
  1819. }
  1820.  
  1821. protected final void handleServerMessage(String s) {
  1822. if (s.startsWith("@bor@")) {
  1823. displayMessage(s, 4, 0);
  1824. return;
  1825. }
  1826. if (s.startsWith("@say@")) {
  1827. displayMessage("@whi@" + s, 5, 0);
  1828. return;
  1829. }
  1830. if (s.startsWith("@pri@")) {
  1831. displayMessage(s, 6, 0);
  1832. return;
  1833. }
  1834. //if (s.startsWith("@que@")) {
  1835. // displayMessage(s, 7, 0);
  1836. // return;
  1837. // }
  1838. displayMessage(s, 3, 0);
  1839. }
  1840.  
  1841. private final void checkMouseOverMenus() {
  1842. if (mouseOverMenu == 0 && super.mouseX >= ((GameImage) (gameGraphics)).menuDefaultWidth - 35 && super.mouseY >= 3 && super.mouseX < ((GameImage)
  1843.  
  1844. (gameGraphics)).menuDefaultWidth - 3 && super.mouseY < 35)
  1845. mouseOverMenu = 1;
  1846. if (mouseOverMenu == 0 && super.mouseX >= ((GameImage) (gameGraphics)).menuDefaultWidth - 35 - 33 && super.mouseY >= 3 && super.mouseX < ((GameImage)
  1847.  
  1848. (gameGraphics)).menuDefaultWidth - 3 - 33 && super.mouseY < 35) {
  1849. mouseOverMenu = 2;
  1850. anInt985 = (int) (Math.random() * 13D) - 6;
  1851. anInt986 = (int) (Math.random() * 23D) - 11;
  1852. }
  1853. if (mouseOverMenu == 0 && super.mouseX >= ((GameImage) (gameGraphics)).menuDefaultWidth - 35 - 66 && super.mouseY >= 3 && super.mouseX < ((GameImage)
  1854.  
  1855. (gameGraphics)).menuDefaultWidth - 3 - 66 && super.mouseY < 35)
  1856. mouseOverMenu = 3;
  1857. if (mouseOverMenu == 0 && super.mouseX >= ((GameImage) (gameGraphics)).menuDefaultWidth - 35 - 99 && super.mouseY >= 3 && super.mouseX < ((GameImage)
  1858.  
  1859. (gameGraphics)).menuDefaultWidth - 3 - 99 && super.mouseY < 35)
  1860. mouseOverMenu = 4;
  1861. if (mouseOverMenu == 0 && super.mouseX >= ((GameImage) (gameGraphics)).menuDefaultWidth - 35 - 132 && super.mouseY >= 3 && super.mouseX <
  1862.  
  1863. ((GameImage) (gameGraphics)).menuDefaultWidth - 3 - 132 && super.mouseY < 35)
  1864. mouseOverMenu = 5;
  1865. if (mouseOverMenu == 0 && super.mouseX >= ((GameImage) (gameGraphics)).menuDefaultWidth - 35 - 165 && super.mouseY >= 3 && super.mouseX <
  1866.  
  1867. ((GameImage) (gameGraphics)).menuDefaultWidth - 3 - 165 && super.mouseY < 35)
  1868. mouseOverMenu = 6;
  1869. if (mouseOverMenu != 0 && super.mouseX >= ((GameImage) (gameGraphics)).menuDefaultWidth - 35 && super.mouseY >= 3 && super.mouseX < ((GameImage)
  1870.  
  1871. (gameGraphics)).menuDefaultWidth - 3 && super.mouseY < 26)
  1872. mouseOverMenu = 1;
  1873. if (mouseOverMenu != 0 && mouseOverMenu != 2 && super.mouseX >= ((GameImage) (gameGraphics)).menuDefaultWidth - 35 - 33 && super.mouseY >= 3 &&
  1874.  
  1875. super.mouseX < ((GameImage) (gameGraphics)).menuDefaultWidth - 3 - 33 && super.mouseY < 26) {
  1876. mouseOverMenu = 2;
  1877. anInt985 = (int) (Math.random() * 13D) - 6;
  1878. anInt986 = (int) (Math.random() * 23D) - 11;
  1879. }
  1880. if (mouseOverMenu != 0 && super.mouseX >= ((GameImage) (gameGraphics)).menuDefaultWidth - 35 - 66 && super.mouseY >= 3 && super.mouseX < ((GameImage)
  1881.  
  1882. (gameGraphics)).menuDefaultWidth - 3 - 66 && super.mouseY < 26)
  1883. mouseOverMenu = 3;
  1884. if (mouseOverMenu != 0 && super.mouseX >= ((GameImage) (gameGraphics)).menuDefaultWidth - 35 - 99 && super.mouseY >= 3 && super.mouseX < ((GameImage)
  1885.  
  1886. (gameGraphics)).menuDefaultWidth - 3 - 99 && super.mouseY < 26)
  1887. mouseOverMenu = 4;
  1888. if (mouseOverMenu != 0 && super.mouseX >= ((GameImage) (gameGraphics)).menuDefaultWidth - 35 - 132 && super.mouseY >= 3 && super.mouseX <
  1889.  
  1890. ((GameImage) (gameGraphics)).menuDefaultWidth - 3 - 132 && super.mouseY < 26)
  1891. mouseOverMenu = 5;
  1892. if (mouseOverMenu != 0 && super.mouseX >= ((GameImage) (gameGraphics)).menuDefaultWidth - 35 - 165 && super.mouseY >= 3 && super.mouseX <
  1893.  
  1894. ((GameImage) (gameGraphics)).menuDefaultWidth - 3 - 165 && super.mouseY < 26)
  1895. mouseOverMenu = 6;
  1896. if (mouseOverMenu == 1 && (super.mouseX < ((GameImage) (gameGraphics)).menuDefaultWidth - 248 || super.mouseY > 36 + (anInt882 / 5) * 34))
  1897. mouseOverMenu = 0;
  1898. if (mouseOverMenu == 3 && (super.mouseX < ((GameImage) (gameGraphics)).menuDefaultWidth - 199 || super.mouseY > 316))
  1899. mouseOverMenu = 0;
  1900. if ((mouseOverMenu == 2 || mouseOverMenu == 4 || mouseOverMenu == 5) && (super.mouseX < ((GameImage) (gameGraphics)).menuDefaultWidth - 199 ||
  1901.  
  1902. super.mouseY > 240))
  1903. mouseOverMenu = 0;
  1904. if (mouseOverMenu == 6 && (super.mouseX < ((GameImage) (gameGraphics)).menuDefaultWidth - 199 || super.mouseY > 311))
  1905. mouseOverMenu = 0;
  1906. }
  1907.  
  1908. private final void menuClick(int index) {
  1909. int actionX = menuActionX[index];
  1910. int actionY = menuActionY[index];
  1911. int actionType = menuActionType[index];
  1912. int actionVariable = menuActionVariable[index];
  1913. int actionVariable2 = menuActionVariable2[index];
  1914. int currentMenuID = menuID[index];
  1915. if (currentMenuID == 200) {
  1916. walkToGroundItem(sectionX, sectionY, actionX, actionY, true);
  1917. super.streamClass.createPacket(104);
  1918. super.streamClass.add2ByteInt(actionVariable);
  1919. super.streamClass.add2ByteInt(actionX + areaX);
  1920. super.streamClass.add2ByteInt(actionY + areaY);
  1921. super.streamClass.add2ByteInt(actionType);
  1922. super.streamClass.formatPacket();
  1923. selectedSpell = -1;
  1924. }
  1925. if (currentMenuID == 210) {
  1926. walkToGroundItem(sectionX, sectionY, actionX, actionY, true);
  1927. super.streamClass.createPacket(34);
  1928. super.streamClass.add2ByteInt(actionX + areaX);
  1929. super.streamClass.add2ByteInt(actionY + areaY);
  1930. super.streamClass.add2ByteInt(actionType);
  1931. super.streamClass.add2ByteInt(actionVariable);
  1932. super.streamClass.formatPacket();
  1933. selectedItem = -1;
  1934. }
  1935. if (currentMenuID == 220) {
  1936. walkToGroundItem(sectionX, sectionY, actionX, actionY, true);
  1937. super.streamClass.createPacket(245);
  1938. super.streamClass.add2ByteInt(actionX + areaX);
  1939. super.streamClass.add2ByteInt(actionY + areaY);
  1940. super.streamClass.add2ByteInt(actionType);
  1941. super.streamClass.add2ByteInt(actionVariable);
  1942. super.streamClass.formatPacket();
  1943. }
  1944. if (currentMenuID == 3200)
  1945. displayMessage(EntityHandler.getItemDef(actionType).getDescription(), 3, 0);
  1946. if (currentMenuID == 300) {
  1947. walkToAction(actionX, actionY, actionType);
  1948. super.streamClass.createPacket(67);
  1949. super.streamClass.add2ByteInt(actionVariable);
  1950. super.streamClass.add2ByteInt(actionX + areaX);
  1951. super.streamClass.add2ByteInt(actionY + areaY);
  1952. super.streamClass.addByte(actionType);
  1953. super.streamClass.formatPacket();
  1954. selectedSpell = -1;
  1955. }
  1956. if (currentMenuID == 310) {
  1957. walkToAction(actionX, actionY, actionType);
  1958. super.streamClass.createPacket(36);
  1959. super.streamClass.add2ByteInt(actionX + areaX);
  1960. super.streamClass.add2ByteInt(actionY + areaY);
  1961. super.streamClass.addByte(actionType);
  1962. super.streamClass.add2ByteInt(actionVariable);
  1963. super.streamClass.formatPacket();
  1964. selectedItem = -1;
  1965. }
  1966. if (currentMenuID == 320) {
  1967. walkToAction(actionX, actionY, actionType);
  1968. super.streamClass.createPacket(126);
  1969. super.streamClass.add2ByteInt(actionX + areaX);
  1970. super.streamClass.add2ByteInt(actionY + areaY);
  1971. super.streamClass.addByte(actionType);
  1972. super.streamClass.formatPacket();
  1973. }
  1974. if (currentMenuID == 2300) {
  1975. walkToAction(actionX, actionY, actionType);
  1976. super.streamClass.createPacket(235);
  1977. super.streamClass.add2ByteInt(actionX + areaX);
  1978. super.streamClass.add2ByteInt(actionY + areaY);
  1979. super.streamClass.addByte(actionType);
  1980. super.streamClass.formatPacket();
  1981. }
  1982. if (currentMenuID == 3300)
  1983. displayMessage(EntityHandler.getDoorDef(actionType).getDescription(), 3, 0);
  1984. if (currentMenuID == 400) {
  1985. walkToObject(actionX, actionY, actionType, actionVariable);
  1986. super.streamClass.createPacket(17);
  1987. super.streamClass.add2ByteInt(actionVariable2);
  1988. super.streamClass.add2ByteInt(actionX + areaX);
  1989. super.streamClass.add2ByteInt(actionY + areaY);
  1990. super.streamClass.formatPacket();
  1991. selectedSpell = -1;
  1992. }
  1993. if (currentMenuID == 410) {
  1994. walkToObject(actionX, actionY, actionType, actionVariable);
  1995. super.streamClass.createPacket(94);
  1996. super.streamClass.add2ByteInt(actionX + areaX);
  1997. super.streamClass.add2ByteInt(actionY + areaY);
  1998. super.streamClass.add2ByteInt(actionVariable2);
  1999. super.streamClass.formatPacket();
  2000. selectedItem = -1;
  2001. }
  2002. if (currentMenuID == 420) {
  2003. walkToObject(actionX, actionY, actionType, actionVariable);
  2004. super.streamClass.createPacket(51);
  2005. super.streamClass.add2ByteInt(actionX + areaX);
  2006. super.streamClass.add2ByteInt(actionY + areaY);
  2007. super.streamClass.formatPacket();
  2008. }
  2009. if (currentMenuID == 2400) {
  2010. walkToObject(actionX, actionY, actionType, actionVariable);
  2011. super.streamClass.createPacket(40);
  2012. super.streamClass.add2ByteInt(actionX + areaX);
  2013. super.streamClass.add2ByteInt(actionY + areaY);
  2014. super.streamClass.formatPacket();
  2015. }
  2016. if (currentMenuID == 3400)
  2017. displayMessage(EntityHandler.getObjectDef(actionType).getDescription(), 3, 0);
  2018. if (currentMenuID == 600) {
  2019. super.streamClass.createPacket(49);
  2020. super.streamClass.add2ByteInt(actionVariable);
  2021. super.streamClass.add2ByteInt(actionType);
  2022. super.streamClass.formatPacket();
  2023. selectedSpell = -1;
  2024. }
  2025. if (currentMenuID == 610) {
  2026. super.streamClass.createPacket(27);
  2027. super.streamClass.add2ByteInt(actionType);
  2028. super.streamClass.add2ByteInt(actionVariable);
  2029. super.streamClass.formatPacket();
  2030. selectedItem = -1;
  2031. }
  2032. if (currentMenuID == 620) {
  2033. super.streamClass.createPacket(92);
  2034. super.streamClass.add2ByteInt(actionType);
  2035. super.streamClass.formatPacket();
  2036. }
  2037. if (currentMenuID == 630) {
  2038. super.streamClass.createPacket(181);
  2039. super.streamClass.add2ByteInt(actionType);
  2040. super.streamClass.formatPacket();
  2041. }
  2042. if (currentMenuID == 640) {
  2043. super.streamClass.createPacket(89);
  2044. super.streamClass.add2ByteInt(actionType);
  2045. super.streamClass.formatPacket();
  2046. }
  2047. if (currentMenuID == 650) {
  2048. selectedItem = actionType;
  2049. mouseOverMenu = 0;
  2050. selectedItemName = EntityHandler.getItemDef(inventoryItems[selectedItem]).getName();
  2051. }
  2052. if (currentMenuID == 660) {
  2053. super.streamClass.createPacket(147);
  2054. super.streamClass.add2ByteInt(actionType);
  2055. super.streamClass.formatPacket();
  2056. selectedItem = -1;
  2057. mouseOverMenu = 0;
  2058. displayMessage("Dropping " + EntityHandler.getItemDef(inventoryItems[actionType]).getName(), 4, 0);
  2059. }
  2060. if (currentMenuID == 3600)
  2061. displayMessage(EntityHandler.getItemDef(actionType).getDescription(), 3, 0);
  2062. if (currentMenuID == 700) {
  2063. int l1 = (actionX - 64) / magicLoc;
  2064. int l3 = (actionY - 64) / magicLoc;
  2065. method112(sectionX, sectionY, l1, l3, true);
  2066. super.streamClass.createPacket(71);
  2067. super.streamClass.add2ByteInt(actionVariable);
  2068. super.streamClass.add2ByteInt(actionType);
  2069. super.streamClass.formatPacket();
  2070. selectedSpell = -1;
  2071. }
  2072. if (currentMenuID == 710) {
  2073. int i2 = (actionX - 64) / magicLoc;
  2074. int i4 = (actionY - 64) / magicLoc;
  2075. method112(sectionX, sectionY, i2, i4, true);
  2076. super.streamClass.createPacket(142);
  2077. super.streamClass.add2ByteInt(actionType);
  2078. super.streamClass.add2ByteInt(actionVariable);
  2079. super.streamClass.formatPacket();
  2080. selectedItem = -1;
  2081. }
  2082. if (currentMenuID == 720) {
  2083. int j2 = (actionX - 64) / magicLoc;
  2084. int j4 = (actionY - 64) / magicLoc;
  2085. method112(sectionX, sectionY, j2, j4, true);
  2086. super.streamClass.createPacket(177);
  2087. super.streamClass.add2ByteInt(actionType);
  2088. super.streamClass.formatPacket();
  2089. }
  2090. if (currentMenuID == 725) {
  2091. int k2 = (actionX - 64) / magicLoc;
  2092. int k4 = (actionY - 64) / magicLoc;
  2093. method112(sectionX, sectionY, k2, k4, true);
  2094. super.streamClass.createPacket(74);
  2095. super.streamClass.add2ByteInt(actionType);
  2096. super.streamClass.formatPacket();
  2097. }
  2098. if (currentMenuID == 715 || currentMenuID == 2715) {
  2099. int l2 = (actionX - 64) / magicLoc;
  2100. int l4 = (actionY - 64) / magicLoc;
  2101. method112(sectionX, sectionY, l2, l4, true);
  2102. super.streamClass.createPacket(73);
  2103. super.streamClass.add2ByteInt(actionType);
  2104. super.streamClass.formatPacket();
  2105. }
  2106. if (currentMenuID == 3700)
  2107. displayMessage(EntityHandler.getNpcDef(actionType).getDescription(), 3, 0);
  2108. if (currentMenuID == 800) {
  2109. int i3 = (actionX - 64) / magicLoc;
  2110. int i5 = (actionY - 64) / magicLoc;
  2111. method112(sectionX, sectionY, i3, i5, true);
  2112. super.streamClass.createPacket(55);
  2113. super.streamClass.add2ByteInt(actionVariable);
  2114. super.streamClass.add2ByteInt(actionType);
  2115. super.streamClass.formatPacket();
  2116. selectedSpell = -1;
  2117. }
  2118. if (currentMenuID == 810) {
  2119. int j3 = (actionX - 64) / magicLoc;
  2120. int j5 = (actionY - 64) / magicLoc;
  2121. method112(sectionX, sectionY, j3, j5, true);
  2122. super.streamClass.createPacket(16);
  2123. super.streamClass.add2ByteInt(actionType);
  2124. super.streamClass.add2ByteInt(actionVariable);
  2125. super.streamClass.formatPacket();
  2126. selectedItem = -1;
  2127. }
  2128. if (currentMenuID == 805 || currentMenuID == 2805) {
  2129. int k3 = (actionX - 64) / magicLoc;
  2130. int k5 = (actionY - 64) / magicLoc;
  2131. method112(sectionX, sectionY, k3, k5, true);
  2132. super.streamClass.createPacket(57);
  2133. super.streamClass.add2ByteInt(actionType);
  2134. super.streamClass.formatPacket();
  2135. }
  2136. if (currentMenuID == 2806) {
  2137. super.streamClass.createPacket(222);
  2138. super.streamClass.add2ByteInt(actionType);
  2139. super.streamClass.formatPacket();
  2140. }
  2141. if (currentMenuID == 2810) {
  2142. super.streamClass.createPacket(166);
  2143. super.streamClass.add2ByteInt(actionType);
  2144. super.streamClass.formatPacket();
  2145. }
  2146. if (currentMenuID == 2820) {
  2147. super.streamClass.createPacket(68);
  2148. super.streamClass.add2ByteInt(actionType);
  2149. super.streamClass.formatPacket();
  2150. }
  2151. if(currentMenuID == 2830)
  2152. {
  2153. String s = playerArray[actionType].name;
  2154. if(s.length() > 0 && DataOperations.stringLength12ToLong(s) != ourPlayer.nameLong)
  2155. {
  2156. addToFriendsList(s);
  2157. }
  2158. }
  2159. if (currentMenuID == 900) {
  2160. method112(sectionX, sectionY, actionX, actionY, true);
  2161. super.streamClass.createPacket(232);
  2162. super.streamClass.add2ByteInt(actionType);
  2163. super.streamClass.add2ByteInt(actionX + areaX);
  2164. super.streamClass.add2ByteInt(actionY + areaY);
  2165. super.streamClass.formatPacket();
  2166. selectedSpell = -1;
  2167. }
  2168. if (currentMenuID == 920) {
  2169. method112(sectionX, sectionY, actionX, actionY, false);
  2170. if (actionPictureType == -24)
  2171. actionPictureType = 24;
  2172. }
  2173. if (currentMenuID == 1000) {
  2174. super.streamClass.createPacket(206);
  2175. super.streamClass.add2ByteInt(actionType);
  2176. super.streamClass.formatPacket();
  2177. selectedSpell = -1;
  2178. }
  2179. if (currentMenuID == 4000) {
  2180. selectedItem = -1;
  2181. selectedSpell = -1;
  2182. }
  2183. if(currentMenuID == 9901) {
  2184.  
  2185. String name = playerArray[actionType].name;
  2186. sendChatString((new StringBuilder()).append("summon ").append(name.replaceAll(" ", "_")).toString());
  2187. }
  2188. if(currentMenuID == 9902) {
  2189.  
  2190. sendChatString((new StringBuilder()).append("teleport ").append(actionX + areaX).append(" ").append(actionY + areaY).toString());
  2191. }
  2192. if(currentMenuID == 9903) {
  2193.  
  2194. String name = playerArray[actionType].name;
  2195. sendChatString((new StringBuilder()).append("kick ").append(name.replaceAll(" ", "_")).toString());
  2196. }
  2197. if(currentMenuID == 9915) {
  2198.  
  2199. for(int i = 0; i < super.friendsCount; i++)
  2200. {
  2201. if(i == actionType)
  2202. {
  2203. sendChatString((new StringBuilder()).append("summon ").append(DataOperations.longToString(super.friendsListLongs[i]).replaceAll(" ",
  2204.  
  2205. "_")).toString());
  2206. }
  2207. }
  2208.  
  2209. }
  2210. if(currentMenuID == 9916) {
  2211.  
  2212. for(int i = 0; i < super.friendsCount; i++)
  2213. {
  2214. if(i == actionType)
  2215. {
  2216. playerToKick = DataOperations.longToString(super.friendsListLongs[i]).replaceAll(" ", "_");
  2217. }
  2218. }
  2219.  
  2220. }
  2221. }
  2222.  
  2223. final void method71(int i, int j, int k, int l, int i1, int j1, int k1) {
  2224. int l1 = anIntArray782[i1];
  2225. int i2 = anIntArray923[i1];
  2226. if (l1 == 0) {
  2227. int j2 = 255 + i2 * 5 * 256;
  2228. gameGraphics.method212(i + k / 2, j + l / 2, 20 + i2 * 2, j2, 255 - i2 * 5);
  2229. }
  2230. if (l1 == 1) {
  2231. int k2 = 0xff0000 + i2 * 5 * 256;
  2232. gameGraphics.method212(i + k / 2, j + l / 2, 10 + i2, k2, 255 - i2 * 5);
  2233. }
  2234. }
  2235.  
  2236. protected final void method2() {
  2237. if (memoryError)
  2238. return;
  2239. if (lastLoadedNull)
  2240. return;
  2241. try {
  2242. loginTimer++;
  2243. if (loggedIn == 0) {
  2244. super.lastActionTimeout = 0;
  2245. updateLoginScreen();
  2246. }
  2247. if (loggedIn == 1) {
  2248. super.lastActionTimeout++;
  2249. processGame();
  2250. }
  2251. super.lastMouseDownButton = 0;
  2252. super.keyDown2 = 0;
  2253. screenRotationTimer++;
  2254. if (screenRotationTimer > 500) {
  2255. screenRotationTimer = 0;
  2256. int i = (int) (Math.random() * 4D);
  2257. if ((i & 1) == 1)
  2258. screenRotationX += anInt727;
  2259. if ((i & 2) == 2)
  2260. screenRotationY += anInt911;
  2261. }
  2262. if (screenRotationX < -50)
  2263. anInt727 = 2;
  2264. if (screenRotationX > 50)
  2265. anInt727 = -2;
  2266. if (screenRotationY < -50)
  2267. anInt911 = 2;
  2268. if (screenRotationY > 50)
  2269. anInt911 = -2;
  2270. if (anInt952 > 0)
  2271. anInt952--;
  2272. if (anInt953 > 0)
  2273. anInt953--;
  2274. if (anInt954 > 0)
  2275. anInt954--;
  2276. if (anInt955 > 0)
  2277. anInt955--;
  2278. if (anInt956 > 0) {
  2279. anInt956--;
  2280. return;
  2281. }
  2282. }
  2283. catch (OutOfMemoryError _ex) {
  2284. garbageCollect();
  2285. memoryError = true;
  2286. }
  2287. }
  2288.  
  2289. private final Model makeModel(int x, int y, int k, int l, int i1) {
  2290. int modelX = x;
  2291. int modelY = y;
  2292. int modelX1 = x;
  2293. int modelX2 = y;
  2294. int j2 = EntityHandler.getDoorDef(l).getModelVar2();
  2295. int k2 = EntityHandler.getDoorDef(l).getModelVar3();
  2296. int l2 = EntityHandler.getDoorDef(l).getModelVar1();
  2297. Model model = new Model(4, 1);
  2298. if (k == 0)
  2299. modelX1 = x + 1;
  2300. if (k == 1)
  2301. modelX2 = y + 1;
  2302. if (k == 2) {
  2303. modelX = x + 1;
  2304. modelX2 = y + 1;
  2305. }
  2306. if (k == 3) {
  2307. modelX1 = x + 1;
  2308. modelX2 = y + 1;
  2309. }
  2310. modelX *= magicLoc;
  2311. modelY *= magicLoc;
  2312. modelX1 *= magicLoc;
  2313. modelX2 *= magicLoc;
  2314. int i3 = model.method179(modelX, -engineHandle.getAveragedElevation(modelX, modelY), modelY);
  2315. int j3 = model.method179(modelX, -engineHandle.getAveragedElevation(modelX, modelY) - l2, modelY);
  2316. int k3 = model.method179(modelX1, -engineHandle.getAveragedElevation(modelX1, modelX2) - l2, modelX2);
  2317. int l3 = model.method179(modelX1, -engineHandle.getAveragedElevation(modelX1, modelX2), modelX2);
  2318. int ai[] = {
  2319. i3, j3, k3, l3
  2320. };
  2321. model.method181(4, ai, j2, k2);
  2322. model.method184(false, 60, 24, -50, -10, -50);
  2323. if (x >= 0 && y >= 0 && x < 96 && y < 96)
  2324. gameCamera.addModel(model);
  2325. model.anInt257 = i1 + 10000;
  2326. return model;
  2327. }
  2328.  
  2329. private final void resetLoginVars() {
  2330. loggedIn = 0;
  2331. loginScreenNumber = 0;
  2332. currentUser = "";
  2333. currentPass = "";
  2334. playerCount = 0;
  2335. npcCount = 0;
  2336. }
  2337.  
  2338. private static final String method74(int i) {
  2339. String s = String.valueOf(i);
  2340. for (int j = s.length() - 3; j > 0; j -= 3)
  2341. s = s.substring(0, j) + "," + s.substring(j);
  2342.  
  2343. if (s.length() > 8)
  2344. s = "@gre@" + s.substring(0, s.length() - 8) + " million @whi@(" + s + ")";
  2345. else if (s.length() > 4)
  2346. s = "@cya@" + s.substring(0, s.length() - 4) + "K @whi@(" + s + ")";
  2347. return s;
  2348. }
  2349.  
  2350. public static KillQueue killQueue = new KillQueue();
  2351.  
  2352. private final void drawGame() {
  2353. long now = System.currentTimeMillis();
  2354. if (now - lastFrame > (1000 / Config.MOVIE_FPS) && recording) {
  2355. try {
  2356. lastFrame = now;
  2357. frames.add(getImage());
  2358. }
  2359. catch (Exception e) {
  2360. }
  2361. }
  2362. if (playerAliveTimeout != 0) {
  2363. gameGraphics.fadePixels();
  2364. gameGraphics.drawText("Oh dear! You are dead...", windowWidth / 2, windowHeight / 2, 7, 0xff0000);
  2365. drawChatMessageTabs();
  2366. gameGraphics.drawImage(aGraphics936, 0, 0);
  2367. return;
  2368. }
  2369. if (showCharacterLookScreen) {
  2370. method62();
  2371. return;
  2372. }
  2373. if (!engineHandle.playerIsAlive) {
  2374. return;
  2375. }
  2376. for (int i = 0; i < 64; i++) {
  2377. gameCamera.removeModel(engineHandle.aModelArrayArray598[lastWildYSubtract][i]);
  2378. if (lastWildYSubtract == 0) {
  2379. gameCamera.removeModel(engineHandle.aModelArrayArray580[1][i]);
  2380. gameCamera.removeModel(engineHandle.aModelArrayArray598[1][i]);
  2381. gameCamera.removeModel(engineHandle.aModelArrayArray580[2][i]);
  2382. gameCamera.removeModel(engineHandle.aModelArrayArray598[2][i]);
  2383. }
  2384. zoomCamera = true;
  2385. if (lastWildYSubtract == 0 && (engineHandle.walkableValue[ourPlayer.currentX / 128][ourPlayer.currentY / 128] & 0x80) == 0) {
  2386. if (showRoof) {
  2387. gameCamera.addModel(engineHandle.aModelArrayArray598[lastWildYSubtract][i]);
  2388. if (lastWildYSubtract == 0) {
  2389. gameCamera.addModel(engineHandle.aModelArrayArray580[1][i]);
  2390. gameCamera.addModel(engineHandle.aModelArrayArray598[1][i]);
  2391. gameCamera.addModel(engineHandle.aModelArrayArray580[2][i]);
  2392. gameCamera.addModel(engineHandle.aModelArrayArray598[2][i]);
  2393. }
  2394. }
  2395. zoomCamera = false;
  2396. }
  2397. }
  2398.  
  2399. if (modelFireLightningSpellNumber != anInt742) {
  2400. anInt742 = modelFireLightningSpellNumber;
  2401. for (int j = 0; j < objectCount; j++) {
  2402. if (objectType[j] == 97)
  2403. method98(j, "firea" + (modelFireLightningSpellNumber + 1));
  2404. if (objectType[j] == 274)
  2405. method98(j, "fireplacea" + (modelFireLightningSpellNumber + 1));
  2406. if (objectType[j] == 1031)
  2407. method98(j, "lightning" + (modelFireLightningSpellNumber + 1));
  2408. if (objectType[j] == 1036)
  2409. method98(j, "firespell" + (modelFireLightningSpellNumber + 1));
  2410. if (objectType[j] == 1147)
  2411. method98(j, "spellcharge" + (modelFireLightningSpellNumber + 1));
  2412. }
  2413.  
  2414. }
  2415. if (modelTorchNumber != anInt743) {
  2416. anInt743 = modelTorchNumber;
  2417. for (int k = 0; k < objectCount; k++) {
  2418. if (objectType[k] == 51)
  2419. method98(k, "torcha" + (modelTorchNumber + 1));
  2420. if (objectType[k] == 143)
  2421. method98(k, "skulltorcha" + (modelTorchNumber + 1));
  2422. }
  2423.  
  2424. }
  2425. if (modelClawSpellNumber != anInt744) {
  2426. anInt744 = modelClawSpellNumber;
  2427. for (int l = 0; l < objectCount; l++)
  2428. if (objectType[l] == 1142)
  2429. method98(l, "clawspell" + (modelClawSpellNumber + 1));
  2430.  
  2431. }
  2432. gameCamera.updateFightCount(fightCount);
  2433. fightCount = 0;
  2434. for (int i1 = 0; i1 < playerCount; i1++) {
  2435. Mob mob = playerArray[i1];
  2436. if (mob.colourBottomType != 255) {
  2437. int k1 = mob.currentX;
  2438. int i2 = mob.currentY;
  2439. int k2 = -engineHandle.getAveragedElevation(k1, i2);
  2440. int l3 = gameCamera.method268(5000 + i1, k1, k2, i2, 145, 220, i1 + 10000);
  2441. fightCount++;
  2442. if (mob == ourPlayer)
  2443. gameCamera.setOurPlayer(l3);
  2444. if (mob.currentSprite == 8)
  2445. gameCamera.setCombat(l3, -30);
  2446. if (mob.currentSprite == 9)
  2447. gameCamera.setCombat(l3, 30);
  2448. }
  2449. }
  2450.  
  2451. for (int j1 = 0; j1 < playerCount; j1++) {
  2452. Mob player = playerArray[j1];
  2453. if (player.anInt176 > 0) {
  2454. Mob npc = null;
  2455. if (player.attackingNpcIndex != -1)
  2456. npc = npcRecordArray[player.attackingNpcIndex];
  2457. else if (player.attackingMobIndex != -1)
  2458. npc = mobArray[player.attackingMobIndex];
  2459. if (npc != null) {
  2460. int px = player.currentX;
  2461. int py = player.currentY;
  2462. int pi = -engineHandle.getAveragedElevation(px, py) - 110;
  2463. int nx = npc.currentX;
  2464. int ny = npc.currentY;
  2465. int ni = -engineHandle.getAveragedElevation(nx, ny) - EntityHandler.getNpcDef(npc.type).getCamera2() / 2;
  2466. int i10 = (px * player.anInt176 + nx * (attackingInt40 - player.anInt176)) / attackingInt40;
  2467. int j10 = (pi * player.anInt176 + ni * (attackingInt40 - player.anInt176)) / attackingInt40;
  2468. int k10 = (py * player.anInt176 + ny * (attackingInt40 - player.anInt176)) / attackingInt40;
  2469. gameCamera.method268(SPRITE_PROJECTILE_START + player.attackingCameraInt, i10, j10, k10, 32, 32, 0);
  2470. fightCount++;
  2471. }
  2472. }
  2473. }
  2474.  
  2475. for (int l1 = 0; l1 < npcCount; l1++) {
  2476. Mob npc = npcArray[l1];
  2477. int mobx = npc.currentX;
  2478. int moby = npc.currentY;
  2479. int i7 = -engineHandle.getAveragedElevation(mobx, moby);
  2480. int i9 = gameCamera.method268(20000 + l1, mobx, i7, moby, EntityHandler.getNpcDef(npc.type).getCamera1(),
  2481.  
  2482. EntityHandler.getNpcDef(npc.type).getCamera2(), l1 + 30000);
  2483. fightCount++;
  2484. if (npc.currentSprite == 8)
  2485. gameCamera.setCombat(i9, -30);
  2486. if (npc.currentSprite == 9)
  2487. gameCamera.setCombat(i9, 30);
  2488. }
  2489.  
  2490. if(showGroundItems) {
  2491. for (int j2 = 0; j2 < groundItemCount; j2++) {
  2492. int j3 = groundItemX[j2] * magicLoc + 64;
  2493. int k4 = groundItemY[j2] * magicLoc + 64;
  2494. gameCamera.method268(40000 + groundItemType[j2], j3, -engineHandle.getAveragedElevation(j3, k4) - groundItemObjectVar[j2], k4, 96, 64, j2 +
  2495.  
  2496. 20000);
  2497. fightCount += 1;
  2498. }
  2499. }
  2500.  
  2501. for (int k3 = 0; k3 < anInt892; k3++) {
  2502. int l4 = anIntArray944[k3] * magicLoc + 64;
  2503. int j7 = anIntArray757[k3] * magicLoc + 64;
  2504. int j9 = anIntArray782[k3];
  2505. if (j9 == 0) {
  2506. gameCamera.method268(50000 + k3, l4, -engineHandle.getAveragedElevation(l4, j7), j7, 128, 256, k3 + 50000);
  2507. fightCount++;
  2508. }
  2509. if (j9 == 1) {
  2510. gameCamera.method268(50000 + k3, l4, -engineHandle.getAveragedElevation(l4, j7), j7, 128, 64, k3 + 50000);
  2511. fightCount++;
  2512. }
  2513. }
  2514.  
  2515. gameGraphics.f1Toggle = false;
  2516. gameGraphics.method211();
  2517. gameGraphics.f1Toggle = super.keyF1Toggle;
  2518. if (lastWildYSubtract == 3) {
  2519. int i5 = 40 + (int) (Math.random() * 3D);
  2520. int k7 = 40 + (int) (Math.random() * 7D);
  2521. gameCamera.method304(i5, k7, -50, -10, -50);
  2522. }
  2523. anInt699 = 0;
  2524. mobMessageCount = 0;
  2525. anInt718 = 0;
  2526. if (cameraAutoAngleDebug) {
  2527. if (configAutoCameraAngle && !zoomCamera) {
  2528. int lastCameraAutoAngle = cameraAutoAngle;
  2529. autoRotateCamera();
  2530. if (cameraAutoAngle != lastCameraAutoAngle) {
  2531. lastAutoCameraRotatePlayerX = ourPlayer.currentX;
  2532. lastAutoCameraRotatePlayerY = ourPlayer.currentY;
  2533. }
  2534. }
  2535. gameCamera.zoom1 = 3000;
  2536. gameCamera.zoom2 = 3000;
  2537. gameCamera.zoom3 = 1;
  2538. gameCamera.zoom4 = 2800;
  2539. cameraRotation = cameraAutoAngle * 32;
  2540. int k5 = lastAutoCameraRotatePlayerX + screenRotationX;
  2541. int l7 = lastAutoCameraRotatePlayerY + screenRotationY;
  2542. gameCamera.setCamera(k5, -engineHandle.getAveragedElevation(k5, l7), l7, 912, cameraRotation * 4, 0, 2000);
  2543. } else {
  2544. if (configAutoCameraAngle && !zoomCamera)
  2545. autoRotateCamera();
  2546. if (!super.keyF1Toggle) {
  2547. if(fogOfWar) {
  2548. gameCamera.zoom1 = 41000;
  2549. gameCamera.zoom2 = 41000;
  2550. gameCamera.zoom3 = 1;
  2551. gameCamera.zoom4 = 41000;
  2552. } else {
  2553. gameCamera.zoom1 = 41000;
  2554. gameCamera.zoom2 = 41000;
  2555. gameCamera.zoom3 = 1;
  2556. gameCamera.zoom4 = 41000;
  2557. }
  2558. } else {
  2559. gameCamera.zoom1 = 41000;
  2560. gameCamera.zoom2 = 41000;
  2561. gameCamera.zoom3 = 1;
  2562. gameCamera.zoom4 = 41000;
  2563. }
  2564. int l5 = lastAutoCameraRotatePlayerX + screenRotationX;
  2565. int i8 = lastAutoCameraRotatePlayerY + screenRotationY;
  2566. gameCamera.setCamera(l5, -engineHandle.getAveragedElevation(l5, i8), i8, 912, cameraRotation * 4, 0, cameraHeight * 2);
  2567. }
  2568. gameCamera.finishCamera();
  2569. method119();
  2570. if (actionPictureType > 0)
  2571. gameGraphics.drawPicture(actionPictureX - 8, actionPictureY - 8, SPRITE_MEDIA_START + 14 + (24 - actionPictureType) / 6);
  2572. if (actionPictureType < 0)
  2573. gameGraphics.drawPicture(actionPictureX - 8, actionPictureY - 8, SPRITE_MEDIA_START + 18 + (24 + actionPictureType) / 6);
  2574. if (systemUpdate != 0) {
  2575. int i6 = systemUpdate / 50;
  2576. int j8 = i6 / 60;
  2577. i6 %= 60;
  2578. if (i6 < 10)
  2579. gameGraphics.drawText("System update in: " + j8 + ":0" + i6, 256, windowHeight - 7, 1, 0xffff00);
  2580. else
  2581. gameGraphics.drawText("System update in: " + j8 + ":" + i6, 256, windowHeight - 7, 1, 0xffff00);
  2582. }
  2583. if (wildernessTime != 0) {
  2584. int i6 = wildernessTime / 50;
  2585. int j8 = i6 / 60;
  2586. i6 %= 60;
  2587. if (i6 < 10)
  2588. gameGraphics.drawText("Wilderness type will change in: " + j8 + ":0" + i6, 256, windowHeight - 7, 1, 0xffff00);
  2589. else
  2590. gameGraphics.drawText("Wilderness type will change in: " + j8 + ":" + i6, 256, windowHeight - 7, 1, 0xffff00);
  2591. }
  2592. if (pvpTime != 0) {
  2593. int i6 = pvpTime / 50;
  2594. int j8 = i6 / 60;
  2595. i6 %= 60;
  2596. if (i6 < 10)
  2597. gameGraphics.drawText("PvP tournament starting in: " + j8 + ":0" + i6, 256, windowHeight - 7, 1, 0xffff00);
  2598. else
  2599. gameGraphics.drawText("PvP tournament starting in: " + j8 + ":" + i6, 256, windowHeight - 7, 1, 0xffff00);
  2600. }
  2601. if (dropPartyTime > 0) {
  2602. int i6 = dropPartyTime / 50;
  2603. int j8 = i6 / 60;
  2604. i6 %= 60;
  2605. if (i6 < 10)
  2606. gameGraphics.drawText("Drop party will begin in: " + j8 + ":0" + i6, 256, windowHeight - 7, 1, 0xffff00);
  2607. else
  2608. gameGraphics.drawText("Drop party will begin in: " + j8 + ":" + i6, 256, windowHeight - 7, 1, 0xffff00);
  2609. }
  2610.  
  2611. killQueue.clean();
  2612.  
  2613. int xOffset = 0;
  2614. for(KillThing thing : killQueue.killthing) {
  2615. gameGraphics.drawString(thing.killStr, 10, 51 + xOffset, 1, 0xffff00);
  2616. xOffset += 17;
  2617. }
  2618. if (ClanWarArena()) {
  2619. this.gameGraphics.drawPicture(453, this.windowHeight - 56, 2013);
  2620. this.gameGraphics.drawText("@red@ Clan War Arena", 465, this.windowHeight - 20, 1, 16776960);
  2621. }
  2622. if (inTutorialIsland()) {
  2623. int i9 = 110;
  2624. gameGraphics.drawString("@or1@TUTORIAL ISLAND", 15, i9, 3, 16776960);
  2625. i9 += 13;
  2626. gameGraphics.drawString("@whi@Completion Percentage", 10, i9, 1, 16776960);
  2627. i9 += 13;
  2628. gameGraphics.drawString("@gre@" + tutorial + "%", 65, i9, 3, 16776960);
  2629. }
  2630. if (inMageArena()) {
  2631. int i9 = 140;
  2632. gameGraphics.drawString("@gre@Guthix@whi@: @or1@" + guthixspells, 10, i9, 1, 16776960);
  2633. i9 += 13;
  2634. gameGraphics.drawString("@blu@Saradomin@whi@: @or1@" + saradominspells, 10, i9, 1, 16776960);
  2635. i9 += 13;
  2636. gameGraphics.drawString("@red@Zamorak@whi@: @or1@" + zamorakspells, 10, i9, 1, 16776960);
  2637. }
  2638. if (!notInWilderness) {
  2639. int j6 = 2203 - (sectionY + wildY + areaY);
  2640. if (sectionX + wildX + areaX >= 2640)
  2641. j6 = -50;
  2642. if (j6 > 0) {
  2643. int k8 = 1 + j6 / 6;
  2644. gameGraphics.drawPicture(453, windowHeight - 56, SPRITE_MEDIA_START + 13);
  2645. gameGraphics.drawText("Wilderness", 465, windowHeight - 20, 1, 0xffff00);
  2646. gameGraphics.drawText("Level: " + k8, 465, windowHeight - 7, 1, 0xffff00);
  2647. if (wildernessType == 0)
  2648. wildernessType = 2;
  2649. }
  2650. if (wildernessType == 0 && j6 > -10 && j6 <= 0)
  2651. wildernessType = 1;
  2652. }
  2653. if (this.MS) {
  2654. int i3 = 140;
  2655. this.gameGraphics.drawString("@whi@" + this.ourPlayer.name, 12, i3, 1, 16776960);
  2656. i3 += 13;
  2657. this.gameGraphics.drawString("@whi@HP:@yel@ " + this.playerStatCurrent[3] + "@whi@/@or1@" + this.playerStatBase[3], 12, i3, 1, 16776960);
  2658. i3 += 13;
  2659. int percent = this.playerStatCurrent[3] * 100 / this.playerStatBase[3];
  2660. if ((percent <= 100) && (percent > 75))
  2661. this.gameGraphics.drawString("@whi@Percent:@gre@ " + percent + "%", 12, i3, 1, 16776960);
  2662. if ((percent <= 75) && (percent > 50))
  2663. this.gameGraphics.drawString("@whi@Percent:@gr2@ " + percent + "%", 12, i3, 1, 16776960);
  2664. if ((percent <= 50) && (percent > 35))
  2665. this.gameGraphics.drawString("@whi@Percent:@gr1@ " + percent + "%", 12, i3, 1, 16776960);
  2666. if ((percent <= 35) && (percent > 20))
  2667. this.gameGraphics.drawString("@whi@Percent:@or2@ " + percent + "%", 12, i3, 1, 16776960);
  2668. if ((percent <= 20) && (percent > 15))
  2669. this.gameGraphics.drawString("@whi@Percent:@lre@ " + percent + "%", 12, i3, 1, 16776960);
  2670. if ((percent <= 15) && (percent > 0))
  2671. this.gameGraphics.drawString("@whi@Percent:@red@ " + percent + "%", 12, i3, 1, 16776960);
  2672. i3 += 26;
  2673. this.gameGraphics.drawString("@whi@Prayer:@yel@ " + this.playerStatCurrent[5] + "@whi@/@or1@" + this.playerStatBase[5], 12, i3, 1, 16776960);
  2674. i3 += 13;
  2675. this.gameGraphics.drawString("@whi@Online:@or1@ " + getPlayerCount(), 12, i3, 1, 16776960);
  2676. i3 += 13;
  2677. if (this.combatStyle == 0)
  2678. this.gameGraphics.drawString("@whi@Mode:@lre@ Controlled", 12, i3, 1, 16776960);
  2679. if (this.combatStyle == 1)
  2680. this.gameGraphics.drawString("@whi@Mode:@lre@ Strength", 12, i3, 1, 16776960);
  2681. if (this.combatStyle == 2)
  2682. this.gameGraphics.drawString("@whi@Mode:@lre@ Attackuracy", 12, i3, 1, 16776960);
  2683. if (this.combatStyle == 3)
  2684. this.gameGraphics.drawString("@whi@Mode:@lre@ Defensive", 12, i3, 1, 16776960);
  2685. i3 += 26;
  2686. this.gameGraphics.drawString("@whi@There are @yel@" + ((getPlayerCount() == 1) ? "@yel@0" : Integer.valueOf(getPlayerCount())) + " @whi@players around
  2687.  
  2688. you!", 12, i3, 1, 16776960);
  2689.  
  2690. i3 -= 13;
  2691. this.gameGraphics.drawString(formatSkill("ATT", 0), 390, i3, 1, 16776960);
  2692. i3 += 13;
  2693. this.gameGraphics.drawString(formatSkill("DEF", 1), 390, i3, 1, 16776960);
  2694. i3 += 13;
  2695. this.gameGraphics.drawString(formatSkill("STR", 2), 390, i3, 1, 16776960);
  2696. }
  2697. if (messagesTab == 0) {
  2698. for (int k6 = 0; k6 < 5; k6++)
  2699. if (messagesTimeout[k6] > 0) {
  2700. String s = messagesArray[k6];
  2701. gameGraphics.drawString(s, 7, windowHeight - 18 - k6 * 12, 1, 0xffff00);
  2702. }
  2703.  
  2704. }
  2705. gameMenu.method171(messagesHandleType2);
  2706. gameMenu.method171(messagesHandleType5);
  2707. gameMenu.method171(messagesHandleType6);
  2708. gameMenu.method171(messagesHandleType7);
  2709. if (messagesTab == 1)
  2710. gameMenu.method170(messagesHandleType2);
  2711. else if (messagesTab == 2)
  2712. gameMenu.method170(messagesHandleType5);
  2713. else if (messagesTab == 3)
  2714. gameMenu.method170(messagesHandleType6);
  2715. else if (messagesTab == 4)
  2716. gameMenu.method170(messagesHandleType7);
  2717. Menu.anInt225 = 2;
  2718. gameMenu.drawMenu();
  2719. Menu.anInt225 = 0;
  2720. gameGraphics.method232(((GameImage) (gameGraphics)).menuDefaultWidth - 3 - 197, 3, SPRITE_MEDIA_START, 128);
  2721. drawGameWindowsMenus();
  2722. gameGraphics.drawStringShadows = false;
  2723. drawChatMessageTabs();
  2724. gameGraphics.drawImage(aGraphics936, 0, 0);
  2725. }
  2726.  
  2727. private String formatSkill(String skillName, int statNumber) {
  2728. StringBuilder builder = new StringBuilder();
  2729. builder.append("@whi@");
  2730. builder.append(skillName);
  2731. builder.append(": ");
  2732. builder.append((this.playerStatCurrent[statNumber] > this.playerStatBase[statNumber]) ? "@gre@Potted (@whi@" : "@red@Unpotted @gre@(@whi@");
  2733.  
  2734. builder.append(this.playerStatCurrent[statNumber]);
  2735. builder.append("@gre@)");
  2736.  
  2737. return builder.toString(); }
  2738.  
  2739. private final void drawRightClickMenu() {
  2740. if (mouseButtonClick != 0) {
  2741. for (int i = 0; i < menuLength; i++) {
  2742. int k = menuX + 2;
  2743. int i1 = menuY + 27 + i * 15;
  2744. if (super.mouseX <= k - 2 || super.mouseY <= i1 - 12 || super.mouseY >= i1 + 4 || super.mouseX >= (k - 3) + menuWidth)
  2745. continue;
  2746. menuClick(menuIndexes[i]);
  2747. break;
  2748. }
  2749.  
  2750. mouseButtonClick = 0;
  2751. showRightClickMenu = false;
  2752. return;
  2753. }
  2754. if (super.mouseX < menuX - 10 || super.mouseY < menuY - 10 || super.mouseX > menuX + menuWidth + 10 || super.mouseY > menuY + menuHeight + 10) {
  2755. showRightClickMenu = false;
  2756. return;
  2757. }
  2758. gameGraphics.drawBoxAlpha(menuX, menuY, menuWidth, menuHeight, 0xd0d0d0, 160);
  2759. gameGraphics.drawString("Choose option", menuX + 2, menuY + 12, 1, 65535);
  2760. for (int j = 0; j < menuLength; j++) {
  2761. int l = menuX + 2;
  2762. int j1 = menuY + 27 + j * 15;
  2763. int k1 = 0xffffff;
  2764. if (super.mouseX > l - 2 && super.mouseY > j1 - 12 && super.mouseY < j1 + 4 && super.mouseX < (l - 3) + menuWidth)
  2765. k1 = 0xffff00;
  2766. gameGraphics.drawString(menuText1[menuIndexes[j]] + " " + menuText2[menuIndexes[j]], l, j1, 1, k1);
  2767. }
  2768.  
  2769. }
  2770.  
  2771. protected final void resetIntVars() {
  2772. systemUpdate = 0;
  2773. pvpTime = 0;
  2774. wildernessTime = 0;
  2775. dropPartyTime = 0;
  2776. loginScreenNumber = 0;
  2777. loggedIn = 0;
  2778. logoutTimeout = 0;
  2779. }
  2780.  
  2781. private final void drawQuestionMenu() {
  2782. if (mouseButtonClick != 0) {
  2783. for (int i = 0; i < questionMenuCount; i++) {
  2784. if (super.mouseX >= gameGraphics.textWidth(questionMenuAnswer[i], 1) || super.mouseY <= i * 12 || super.mouseY >= 12 + i * 12)
  2785. continue;
  2786. super.streamClass.createPacket(154);
  2787. super.streamClass.addByte(i);
  2788. super.streamClass.formatPacket();
  2789. break;
  2790. }
  2791.  
  2792. mouseButtonClick = 0;
  2793. showQuestionMenu = false;
  2794. return;
  2795. }
  2796. for (int j = 0; j < questionMenuCount; j++) {
  2797. int k = 65535;
  2798. if (super.mouseX < gameGraphics.textWidth(questionMenuAnswer[j], 1) && super.mouseY > j * 12 && super.mouseY < 12 + j * 12)
  2799. k = 0xff0000;
  2800. gameGraphics.drawString(questionMenuAnswer[j], 6, 12 + j * 12, 1, k);
  2801. }
  2802.  
  2803. }
  2804.  
  2805. private final void walkToAction(int actionX, int actionY, int actionType) {
  2806. if (actionType == 0) {
  2807. sendWalkCommand(sectionX, sectionY, actionX, actionY - 1, actionX, actionY, false, true);
  2808. return;
  2809. }
  2810. if (actionType == 1) {
  2811. sendWalkCommand(sectionX, sectionY, actionX - 1, actionY, actionX, actionY, false, true);
  2812. return;
  2813. } else {
  2814. sendWalkCommand(sectionX, sectionY, actionX, actionY, actionX, actionY, true, true);
  2815. return;
  2816. }
  2817. }
  2818.  
  2819. private final void garbageCollect() {
  2820. try {
  2821. if (gameGraphics != null) {
  2822. gameGraphics.cleanupSprites();
  2823. gameGraphics.imagePixelArray = null;
  2824. gameGraphics = null;
  2825. }
  2826. if (gameCamera != null) {
  2827. gameCamera.cleanupModels();
  2828. gameCamera = null;
  2829. }
  2830. gameDataModels = null;
  2831. objectModelArray = null;
  2832. doorModel = null;
  2833. mobArray = null;
  2834. playerArray = null;
  2835. npcRecordArray = null;
  2836. npcArray = null;
  2837. ourPlayer = null;
  2838. if (engineHandle != null) {
  2839. engineHandle.aModelArray596 = null;
  2840. engineHandle.aModelArrayArray580 = null;
  2841. engineHandle.aModelArrayArray598 = null;
  2842. engineHandle.aModel = null;
  2843. engineHandle = null;
  2844. }
  2845. System.gc();
  2846. return;
  2847. }
  2848. catch (Exception _ex) {
  2849. return;
  2850. }
  2851. }
  2852.  
  2853. protected final void loginScreenPrint(String s, String s1) {
  2854. if (loginScreenNumber == 1)
  2855. menuNewUser.updateText(anInt900, s + " " + s1);
  2856. if (loginScreenNumber == 2)
  2857. menuLogin.updateText(loginStatusText, s + " " + s1);
  2858. drawLoginScreen();
  2859. resetCurrentTimeArray();
  2860. }
  2861.  
  2862. private final void drawInventoryRightClickMenu() {
  2863. int i = 2203 - (sectionY + wildY + areaY);
  2864. if (sectionX + wildX + areaX >= 2640)
  2865. i = -50;
  2866. int j = -1;
  2867. for (int k = 0; k < objectCount; k++)
  2868. aBooleanArray827[k] = false;
  2869.  
  2870. for (int l = 0; l < doorCount; l++)
  2871. aBooleanArray970[l] = false;
  2872.  
  2873. int i1 = gameCamera.method272();
  2874. Model models[] = gameCamera.getVisibleModels();
  2875. int ai[] = gameCamera.method273();
  2876. for (int j1 = 0; j1 < i1; j1++) {
  2877. if (menuLength > 200)
  2878. break;
  2879. int k1 = ai[j1];
  2880. Model model = models[j1];
  2881. if (model.anIntArray258[k1] <= 65535 || model.anIntArray258[k1] >= 0x30d40 && model.anIntArray258[k1] <= 0x493e0)
  2882. if (model == gameCamera.aModel_423) {
  2883. int i2 = model.anIntArray258[k1] % 10000;
  2884. int l2 = model.anIntArray258[k1] / 10000;
  2885. if (l2 == 1) {
  2886. String s = "";
  2887. int k3 = 0;
  2888. if (ourPlayer.level > 0 && playerArray[i2].level > 0)
  2889. k3 = ourPlayer.level - playerArray[i2].level;
  2890. if (k3 < 0)
  2891. s = "@or1@";
  2892. if (k3 < -3)
  2893. s = "@or2@";
  2894. if (k3 < -6)
  2895. s = "@or3@";
  2896. if (k3 < -9)
  2897. s = "@red@";
  2898. if (k3 > 0)
  2899. s = "@gr1@";
  2900. if (k3 > 3)
  2901. s = "@gr2@";
  2902. if (k3 > 6)
  2903. s = "@gr3@";
  2904. if (k3 > 9)
  2905. s = "@gre@";
  2906. s = " " + s + "(level-" + playerArray[i2].level + ")";
  2907. if(showModCommands) {
  2908. menuText1[menuLength] = "Summon";
  2909. menuText2[menuLength] = (new StringBuilder()).append("@whi@").append(playerArray[i2].name).toString();
  2910. menuID[menuLength] = 9901;
  2911. menuActionType[menuLength] = i2;
  2912. menuLength++;
  2913. menuText1[menuLength] = "Kick";
  2914. menuText2[menuLength] = (new StringBuilder()).append("@whi@").append(playerArray[i2].name).toString();
  2915. menuID[menuLength] = 9903;
  2916. menuActionType[menuLength] = i2;
  2917. menuLength++;
  2918. }
  2919. if (!showModCommands && selectedSpell >= 0) {
  2920. if (EntityHandler.getSpellDef(selectedSpell).getSpellType() == 1 || EntityHandler.getSpellDef(selectedSpell).getSpellType() == 2)
  2921.  
  2922. {
  2923. menuText1[menuLength] = "Cast " + EntityHandler.getSpellDef(selectedSpell).getName() + " on";
  2924. menuText2[menuLength] = "@whi@" + playerArray[i2].name + s;
  2925. menuID[menuLength] = 800;
  2926. menuActionX[menuLength] = playerArray[i2].currentX;
  2927. menuActionY[menuLength] = playerArray[i2].currentY;
  2928. menuActionType[menuLength] = playerArray[i2].serverIndex;
  2929. menuActionVariable[menuLength] = selectedSpell;
  2930. menuLength++;
  2931. }
  2932. } else if (!showModCommands && selectedItem >= 0) {
  2933. menuText1[menuLength] = "Use " + selectedItemName + " with";
  2934. menuText2[menuLength] = "@whi@" + playerArray[i2].name + s;
  2935. menuID[menuLength] = 810;
  2936. menuActionX[menuLength] = playerArray[i2].currentX;
  2937. menuActionY[menuLength] = playerArray[i2].currentY;
  2938. menuActionType[menuLength] = playerArray[i2].serverIndex;
  2939. menuActionVariable[menuLength] = selectedItem;
  2940. menuLength++;
  2941. } else {
  2942. if (i > 0 && (playerArray[i2].currentY - 64) / magicLoc + wildY + areaY < 2203) {
  2943. menuText1[menuLength] = "Attack";
  2944. menuText2[menuLength] = ((playerArray[i2].flag == null) || (playerArray[i2].flag == "") ? "" : "#f" + playerArray[i2].flag +
  2945.  
  2946. "#") + "@whi@" + playerArray[i2].name + s;
  2947. if (k3 >= 0 && k3 < 5)
  2948. menuID[menuLength] = 805;
  2949. else
  2950. menuID[menuLength] = 2805;
  2951. menuActionX[menuLength] = playerArray[i2].currentX;
  2952. menuActionY[menuLength] = playerArray[i2].currentY;
  2953. menuActionType[menuLength] = playerArray[i2].serverIndex;
  2954. menuLength++;
  2955. } else {
  2956. menuText1[menuLength] = "Duel with";
  2957. menuText2[menuLength] = ((playerArray[i2].flag == null) || (playerArray[i2].flag == "") ? "" : "#f" + playerArray[i2].flag +
  2958.  
  2959. "#") + "@whi@" + playerArray[i2].name + s;
  2960. menuActionX[menuLength] = playerArray[i2].currentX;
  2961. menuActionY[menuLength] = playerArray[i2].currentY;
  2962. menuID[menuLength] = 2806;
  2963. menuActionType[menuLength] = playerArray[i2].serverIndex;
  2964. menuLength++;
  2965. }
  2966. menuText1[menuLength] = "Trade with";
  2967. menuText2[menuLength] = ((playerArray[i2].flag == null) || (playerArray[i2].flag == "") ? "" : "#f" + playerArray[i2].flag + "#")
  2968.  
  2969. + "@whi@" + playerArray[i2].name + s;
  2970. menuID[menuLength] = 2810;
  2971. menuActionType[menuLength] = playerArray[i2].serverIndex;
  2972. menuLength++;
  2973. menuText1[menuLength] = "Follow";
  2974. menuText2[menuLength] = ((playerArray[i2].flag == null) || (playerArray[i2].flag == "") ? "" : "#f" + playerArray[i2].flag + "#")
  2975.  
  2976. + "@whi@" + playerArray[i2].name + s;
  2977. menuID[menuLength] = 2820;
  2978. menuActionType[menuLength] = playerArray[i2].serverIndex;
  2979. menuLength++;
  2980. if(!isOnFriendsList(playerArray[i2].name))
  2981. {
  2982. menuText1[menuLength] = "Add";
  2983. menuText2[menuLength] = (new StringBuilder()).append("@whi@ ").append(playerArray[i2].name).append(s).toString();
  2984. menuID[menuLength] = 2830;
  2985. menuActionType[menuLength] = i2;
  2986. menuLength++;
  2987. }
  2988. continue;
  2989. }
  2990. } else if (l2 == 2) {
  2991. ItemDef itemDef = EntityHandler.getItemDef(groundItemType[i2]);
  2992. if (selectedSpell >= 0) {
  2993. if (EntityHandler.getSpellDef(selectedSpell).getSpellType() == 3) {
  2994. menuText1[menuLength] = "Cast " + EntityHandler.getSpellDef(selectedSpell).getName() + " on";
  2995. menuText2[menuLength] = "@lre@" + itemDef.getName();
  2996. menuID[menuLength] = 200;
  2997. menuActionX[menuLength] = groundItemX[i2];
  2998. menuActionY[menuLength] = groundItemY[i2];
  2999. menuActionType[menuLength] = groundItemType[i2];
  3000. menuActionVariable[menuLength] = selectedSpell;
  3001. menuLength++;
  3002. }
  3003. } else if (selectedItem >= 0) {
  3004. menuText1[menuLength] = "Use " + selectedItemName + " with";
  3005. menuText2[menuLength] = "@lre@" + itemDef.getName();
  3006. menuID[menuLength] = 210;
  3007. menuActionX[menuLength] = groundItemX[i2];
  3008. menuActionY[menuLength] = groundItemY[i2];
  3009. menuActionType[menuLength] = groundItemType[i2];
  3010. menuActionVariable[menuLength] = selectedItem;
  3011. menuLength++;
  3012. } else {
  3013. menuText1[menuLength] = "Take";
  3014. menuText2[menuLength] = "@lre@" + itemDef.getName();
  3015. menuID[menuLength] = 220;
  3016. menuActionX[menuLength] = groundItemX[i2];
  3017. menuActionY[menuLength] = groundItemY[i2];
  3018. menuActionType[menuLength] = groundItemType[i2];
  3019. menuLength++;
  3020. menuText1[menuLength] = "Examine";
  3021. menuText2[menuLength] = "@lre@" + itemDef.getName() + (ourPlayer.admin >= 2 ? " @or1@(" + groundItemType[i2] + ":" +
  3022.  
  3023. (groundItemX[i2] + areaX) + "," + (groundItemY[i2] + areaY) + ")" : "");
  3024. menuID[menuLength] = 3200;
  3025. menuActionType[menuLength] = groundItemType[i2];
  3026. menuLength++;
  3027. }
  3028. } else if (l2 == 3) {
  3029. String s1 = "";
  3030. int l3 = -1;
  3031. NPCDef npcDef = EntityHandler.getNpcDef(npcArray[i2].type);
  3032. if (npcDef.isAttackable()) {
  3033. int j4 = (npcDef.getAtt() + npcDef.getDef() + npcDef.getStr() + npcDef.getHits()) / 4;
  3034. int k4 = (playerStatBase[0] + playerStatBase[1] + playerStatBase[2] + playerStatBase[3] + 27) / 4;
  3035. l3 = k4 - j4;
  3036. s1 = "@yel@";
  3037. if (l3 < 0)
  3038. s1 = "@or1@";
  3039. if (l3 < -3)
  3040. s1 = "@or2@";
  3041. if (l3 < -6)
  3042. s1 = "@or3@";
  3043. if (l3 < -9)
  3044. s1 = "@red@";
  3045. if (l3 > 0)
  3046. s1 = "@gr1@";
  3047. if (l3 > 3)
  3048. s1 = "@gr2@";
  3049. if (l3 > 6)
  3050. s1 = "@gr3@";
  3051. if (l3 > 9)
  3052. s1 = "@gre@";
  3053. s1 = " " + s1 + "(level-" + j4 + ")";
  3054. }
  3055. if (selectedSpell >= 0) {
  3056. if (EntityHandler.getSpellDef(selectedSpell).getSpellType() == 2) {
  3057. menuText1[menuLength] = "Cast " + EntityHandler.getSpellDef(selectedSpell).getName() + " on";
  3058. menuText2[menuLength] = "@yel@" + npcDef.getName();
  3059. menuID[menuLength] = 700;
  3060. menuActionX[menuLength] = npcArray[i2].currentX;
  3061. menuActionY[menuLength] = npcArray[i2].currentY;
  3062. menuActionType[menuLength] = npcArray[i2].serverIndex;
  3063. menuActionVariable[menuLength] = selectedSpell;
  3064. menuLength++;
  3065. }
  3066. } else if (selectedItem >= 0) {
  3067. menuText1[menuLength] = "Use " + selectedItemName + " with";
  3068. menuText2[menuLength] = "@yel@" + npcDef.getName();
  3069. menuID[menuLength] = 710;
  3070. menuActionX[menuLength] = npcArray[i2].currentX;
  3071. menuActionY[menuLength] = npcArray[i2].currentY;
  3072. menuActionType[menuLength] = npcArray[i2].serverIndex;
  3073. menuActionVariable[menuLength] = selectedItem;
  3074. menuLength++;
  3075. } else {
  3076. if (npcDef.isAttackable()) {
  3077. menuText1[menuLength] = "Attack";
  3078. menuText2[menuLength] = "@yel@" + npcDef.getName() + s1;
  3079. if (l3 >= 0)
  3080. menuID[menuLength] = 715;
  3081. else
  3082. menuID[menuLength] = 2715;
  3083. menuActionX[menuLength] = npcArray[i2].currentX;
  3084. menuActionY[menuLength] = npcArray[i2].currentY;
  3085. menuActionType[menuLength] = npcArray[i2].serverIndex;
  3086. menuLength++;
  3087. }
  3088. menuText1[menuLength] = "Talk-to";
  3089. menuText2[menuLength] = "@yel@" + npcDef.getName();
  3090. menuID[menuLength] = 720;
  3091. menuActionX[menuLength] = npcArray[i2].currentX;
  3092. menuActionY[menuLength] = npcArray[i2].currentY;
  3093. menuActionType[menuLength] = npcArray[i2].serverIndex;
  3094. menuLength++;
  3095. if (!npcDef.getCommand().equals("")) {
  3096. menuText1[menuLength] = npcDef.getCommand();
  3097. menuText2[menuLength] = "@yel@" + npcDef.getName();
  3098. menuID[menuLength] = 725;
  3099. menuActionX[menuLength] = npcArray[i2].currentX;
  3100. menuActionY[menuLength] = npcArray[i2].currentY;
  3101. menuActionType[menuLength] = npcArray[i2].serverIndex;
  3102. menuLength++;
  3103. }
  3104. menuText1[menuLength] = "Examine";
  3105. menuText2[menuLength] = "@yel@" + npcDef.getName() + (ourPlayer.admin >= 2 ? " @or1@(" + npcArray[i2].type + ")" : "");
  3106. menuID[menuLength] = 3700;
  3107. menuActionType[menuLength] = npcArray[i2].type;
  3108. menuLength++;
  3109. }
  3110. }
  3111. } else if (model != null && model.anInt257 >= 10000) {
  3112. int j2 = model.anInt257 - 10000;
  3113. int i3 = doorType[j2];
  3114. if (!aBooleanArray970[j2]) {
  3115. if (selectedSpell >= 0) {
  3116. if (EntityHandler.getSpellDef(selectedSpell).getSpellType() == 4) {
  3117. menuText1[menuLength] = "Cast " + EntityHandler.getSpellDef(selectedSpell).getName() + " on";
  3118. menuText2[menuLength] = "@cya@" + EntityHandler.getDoorDef(i3).getName();
  3119. menuID[menuLength] = 300;
  3120. menuActionX[menuLength] = doorX[j2];
  3121. menuActionY[menuLength] = doorY[j2];
  3122. menuActionType[menuLength] = doorDirection[j2];
  3123. menuActionVariable[menuLength] = selectedSpell;
  3124. menuLength++;
  3125. }
  3126. } else if (selectedItem >= 0) {
  3127. menuText1[menuLength] = "Use " + selectedItemName + " with";
  3128. menuText2[menuLength] = "@cya@" + EntityHandler.getDoorDef(i3).getName();
  3129. menuID[menuLength] = 310;
  3130. menuActionX[menuLength] = doorX[j2];
  3131. menuActionY[menuLength] = doorY[j2];
  3132. menuActionType[menuLength] = doorDirection[j2];
  3133. menuActionVariable[menuLength] = selectedItem;
  3134. menuLength++;
  3135. } else {
  3136. if (!EntityHandler.getDoorDef(i3).getCommand1().equalsIgnoreCase("WalkTo")) {
  3137. menuText1[menuLength] = EntityHandler.getDoorDef(i3).getCommand1();
  3138. menuText2[menuLength] = "@cya@" + EntityHandler.getDoorDef(i3).getName();
  3139. menuID[menuLength] = 320;
  3140. menuActionX[menuLength] = doorX[j2];
  3141. menuActionY[menuLength] = doorY[j2];
  3142. menuActionType[menuLength] = doorDirection[j2];
  3143. menuLength++;
  3144. }
  3145. if (!EntityHandler.getDoorDef(i3).getCommand2().equalsIgnoreCase("Examine")) {
  3146. menuText1[menuLength] = EntityHandler.getDoorDef(i3).getCommand2();
  3147. menuText2[menuLength] = "@cya@" + EntityHandler.getDoorDef(i3).getName();
  3148. menuID[menuLength] = 2300;
  3149. menuActionX[menuLength] = doorX[j2];
  3150. menuActionY[menuLength] = doorY[j2];
  3151. menuActionType[menuLength] = doorDirection[j2];
  3152. menuLength++;
  3153. }
  3154. menuText1[menuLength] = "Examine";
  3155. menuText2[menuLength] = "@cya@" + EntityHandler.getDoorDef(i3).getName() + (ourPlayer.admin >= 2 ? " @or1@(" + i3 + ":" +
  3156.  
  3157. (doorX[j2] + areaX) + "," + (doorY[j2] + areaY) + ")" : "");
  3158. menuID[menuLength] = 3300;
  3159. menuActionType[menuLength] = i3;
  3160. menuLength++;
  3161. }
  3162. aBooleanArray970[j2] = true;
  3163. }
  3164. } else if (model != null && model.anInt257 >= 0) {
  3165. int k2 = model.anInt257;
  3166. int j3 = objectType[k2];
  3167. if (!aBooleanArray827[k2]) {
  3168. if (selectedSpell >= 0) {
  3169. if (EntityHandler.getSpellDef(selectedSpell).getSpellType() == 5) {
  3170. menuText1[menuLength] = "Cast " + EntityHandler.getSpellDef(selectedSpell).getName() + " on";
  3171. menuText2[menuLength] = "@cya@" + EntityHandler.getObjectDef(j3).getName();
  3172. menuID[menuLength] = 400;
  3173. menuActionX[menuLength] = objectX[k2];
  3174. menuActionY[menuLength] = objectY[k2];
  3175. menuActionType[menuLength] = objectID[k2];
  3176. menuActionVariable[menuLength] = objectType[k2];
  3177. menuActionVariable2[menuLength] = selectedSpell;
  3178. menuLength++;
  3179. }
  3180. } else if (selectedItem >= 0) {
  3181. menuText1[menuLength] = "Use " + selectedItemName + " with";
  3182. menuText2[menuLength] = "@cya@" + EntityHandler.getObjectDef(j3).getName();
  3183. menuID[menuLength] = 410;
  3184. menuActionX[menuLength] = objectX[k2];
  3185. menuActionY[menuLength] = objectY[k2];
  3186. menuActionType[menuLength] = objectID[k2];
  3187. menuActionVariable[menuLength] = objectType[k2];
  3188. menuActionVariable2[menuLength] = selectedItem;
  3189. menuLength++;
  3190. } else {
  3191. if (!EntityHandler.getObjectDef(j3).getCommand1().equalsIgnoreCase("WalkTo")) {
  3192. menuText1[menuLength] = EntityHandler.getObjectDef(j3).getCommand1();
  3193. menuText2[menuLength] = "@cya@" + EntityHandler.getObjectDef(j3).getName();
  3194. menuID[menuLength] = 420;
  3195. menuActionX[menuLength] = objectX[k2];
  3196. menuActionY[menuLength] = objectY[k2];
  3197. menuActionType[menuLength] = objectID[k2];
  3198. menuActionVariable[menuLength] = objectType[k2];
  3199. menuLength++;
  3200. }
  3201. if (!EntityHandler.getObjectDef(j3).getCommand2().equalsIgnoreCase("Examine")) {
  3202. menuText1[menuLength] = EntityHandler.getObjectDef(j3).getCommand2();
  3203. menuText2[menuLength] = "@cya@" + EntityHandler.getObjectDef(j3).getName();
  3204. menuID[menuLength] = 2400;
  3205. menuActionX[menuLength] = objectX[k2];
  3206. menuActionY[menuLength] = objectY[k2];
  3207. menuActionType[menuLength] = objectID[k2];
  3208. menuActionVariable[menuLength] = objectType[k2];
  3209. menuLength++;
  3210. }
  3211. menuText1[menuLength] = "Examine";
  3212. menuText2[menuLength] = "@cya@" + EntityHandler.getObjectDef(j3).getName() + (ourPlayer.admin >= 2 ? " @or1@(" + j3 + ":" +
  3213.  
  3214. (objectX[k2] + areaX) + "," + (objectY[k2] + areaY) + ")" : "");
  3215. menuID[menuLength] = 3400;
  3216. menuActionType[menuLength] = j3;
  3217. menuLength++;
  3218. }
  3219. aBooleanArray827[k2] = true;
  3220. }
  3221. } else {
  3222. if (k1 >= 0)
  3223. k1 = model.anIntArray258[k1] - 0x30d40;
  3224. if (k1 >= 0)
  3225. j = k1;
  3226. }
  3227. }
  3228.  
  3229. if (selectedSpell >= 0 && EntityHandler.getSpellDef(selectedSpell).getSpellType() <= 1) {
  3230. menuText1[menuLength] = "Cast " + EntityHandler.getSpellDef(selectedSpell).getName() + " on self";
  3231. menuText2[menuLength] = "";
  3232. menuID[menuLength] = 1000;
  3233. menuActionType[menuLength] = selectedSpell;
  3234. menuLength++;
  3235. }
  3236. if (j != -1) {
  3237. int l1 = j;
  3238. if (selectedSpell >= 0) {
  3239. if (EntityHandler.getSpellDef(selectedSpell).getSpellType() == 6) {
  3240. menuText1[menuLength] = "Cast " + EntityHandler.getSpellDef(selectedSpell).getName() + " on ground";
  3241. menuText2[menuLength] = "";
  3242. menuID[menuLength] = 900;
  3243. menuActionX[menuLength] = engineHandle.selectedX[l1];
  3244. menuActionY[menuLength] = engineHandle.selectedY[l1];
  3245. menuActionType[menuLength] = selectedSpell;
  3246. menuLength++;
  3247. return;
  3248. }
  3249. } else if (selectedItem < 0) {
  3250. menuText1[menuLength] = "Walk here";
  3251. menuText2[menuLength] = "";
  3252. menuID[menuLength] = 920;
  3253. menuActionX[menuLength] = engineHandle.selectedX[l1];
  3254. menuActionY[menuLength] = engineHandle.selectedY[l1];
  3255. menuLength++;
  3256. }
  3257. if(showModCommands && showModCommands) {
  3258.  
  3259. menuText1[menuLength] = "Teleport here";
  3260. menuText2[menuLength] = "";
  3261. menuID[menuLength] = 9902;
  3262. menuActionX[menuLength] = engineHandle.selectedX[l1];
  3263. menuActionY[menuLength] = engineHandle.selectedY[l1];
  3264. menuLength++;
  3265. }
  3266. }
  3267. }
  3268.  
  3269. protected final void startGame() {
  3270. int i = 0;
  3271. for (int j = 0; j < 99; j++) {
  3272. int k = j + 1;
  3273. int i1 = (int) ((double) k + 300D * Math.pow(2D, (double) k / 7D));
  3274. i += i1;
  3275. experienceArray[j] = (i & 0xffffffc) / 4;
  3276. }
  3277. super.yOffset = 0;
  3278. GameWindowMiddleMan.maxPacketReadCount = 1000;
  3279. loadConfigFilter(); // 15%
  3280. System.out.println("Loading Config Settings");
  3281. System.out.println("Loading Game settings 15%");
  3282. if (lastLoadedNull) {
  3283. return;
  3284. }
  3285. aGraphics936 = getGraphics();
  3286. changeThreadSleepModifier(50);
  3287. gameGraphics = new GameImageMiddleMan(windowWidth, windowHeight + 12, 4000, this);
  3288. gameGraphics._mudclient = this;
  3289. gameGraphics.setDimensions(0, 0, windowWidth, windowHeight + 12);
  3290. Menu.aBoolean220 = false;
  3291. spellMenu = new Menu(gameGraphics, 5);
  3292. int l = ((GameImage) (gameGraphics)).menuDefaultWidth - 199;
  3293. byte byte0 = 36;
  3294. spellMenuHandle = spellMenu.method162(l, byte0 + 24, 196, 90, 1, 500, true);
  3295. friendsMenu = new Menu(gameGraphics, 5);
  3296. friendsMenuHandle = friendsMenu.method162(l, byte0 + 40, 196, 126, 1, 500, true);
  3297. //questMenu = new Menu(gameGraphics, 5);
  3298. //questMenuHandle = questMenu.method162(l, byte0 + 24, 196, 251, 1, 500, true);
  3299. loadMedia(); // 30%
  3300. System.out.println("Loading Game settings 30%");
  3301. if (lastLoadedNull)
  3302. return;
  3303. loadEntity(); // 45%
  3304. System.out.println("Loading Game settings 45%");
  3305. if (lastLoadedNull)
  3306. return;
  3307. gameCamera = new Camera(gameGraphics, 15000, 15000, 1000);
  3308. gameCamera.setCameraSize(windowWidth / 2, windowHeight / 2, windowWidth / 2, windowHeight / 2, windowWidth, cameraSizeInt);
  3309. gameCamera.zoom1 = 2400;
  3310. gameCamera.zoom2 = 2400;
  3311. gameCamera.zoom3 = 1;
  3312. gameCamera.zoom4 = 2300;
  3313. gameCamera.method303(-50, -10, -50);
  3314. engineHandle = new EngineHandle(gameCamera, gameGraphics);
  3315. loadTextures(); // 60%
  3316. System.out.println("Loading Textures");
  3317. System.out.println("Loading Game settings 60%");
  3318. if (lastLoadedNull)
  3319. return;
  3320. loadModels(); // 75%
  3321. System.out.println("Loading Models");
  3322. System.out.println("Loading Game settings 75%");
  3323. if (lastLoadedNull)
  3324. return;
  3325. loadSounds(); // 90%
  3326. System.out.println("Loading Sounds");
  3327. System.out.println("Loading Game settings 90%");
  3328. if (lastLoadedNull) {
  3329. return;
  3330. }
  3331. drawLoadingBarText(100, "Starting game...");
  3332. System.out.println("Loading LoginMenus");
  3333. System.out.println("Finishing Starting ProjectPK");
  3334. drawGameMenu();
  3335. makeLoginMenus();
  3336. makeCharacterDesignMenu();
  3337. resetLoginVars();
  3338. }
  3339.  
  3340. private final void loadSprite(int id, String packageName, int amount) {
  3341. for (int i = id; i < id + amount; i++) {
  3342. if (!gameGraphics.loadSprite(i, packageName)) {
  3343. lastLoadedNull = true;
  3344. return;
  3345. }
  3346. }
  3347. }
  3348.  
  3349. private final void loadMedia() {
  3350. drawLoadingBarText(30, "Unpacking media");
  3351. System.out.println("Loading Media");
  3352. loadSprite(SPRITE_MEDIA_START, "media", 1);
  3353. loadSprite(SPRITE_MEDIA_START + 1, "media", 6);
  3354. loadSprite(SPRITE_MEDIA_START + 9, "media", 1);
  3355. loadSprite(SPRITE_MEDIA_START + 10, "media", 1);
  3356. loadSprite(SPRITE_MEDIA_START + 11, "media", 3);
  3357. loadSprite(SPRITE_MEDIA_START + 14, "media", 8);
  3358. loadSprite(SPRITE_MEDIA_START + 22, "media", 1);
  3359. loadSprite(SPRITE_MEDIA_START + 23, "media", 1);
  3360. loadSprite(SPRITE_MEDIA_START + 24, "media", 1);
  3361. loadSprite(SPRITE_MEDIA_START + 25, "media", 2);
  3362. loadSprite(SPRITE_UTIL_START, "media", 2);
  3363. loadSprite(SPRITE_UTIL_START + 2, "media", 4);
  3364. loadSprite(SPRITE_UTIL_START + 6, "media", 2);
  3365. loadSprite(SPRITE_PROJECTILE_START, "media", 7);
  3366. loadSprite(SPRITE_LOGO_START, "media", 1);
  3367.  
  3368. int i = EntityHandler.invPictureCount();
  3369. for (int j = 1; i > 0; j++) {
  3370. int k = i;
  3371. i -= 30;
  3372. if (k > 30) {
  3373. k = 30;
  3374. }
  3375. loadSprite(SPRITE_ITEM_START + (j - 1) * 30, "media.object", k);
  3376. }
  3377. }
  3378.  
  3379. private final void loadEntity() {
  3380. drawLoadingBarText(45, "Unpacking entities");
  3381. System.out.println("Loading Entities");
  3382. int animationNumber = 0;
  3383. label0:
  3384. for (int animationIndex = 0; animationIndex < EntityHandler.animationCount(); animationIndex++) {
  3385. String s = EntityHandler.getAnimationDef(animationIndex).getName();
  3386. for (int nextAnimationIndex = 0; nextAnimationIndex < animationIndex; nextAnimationIndex++) {
  3387. if (!EntityHandler.getAnimationDef(nextAnimationIndex).getName().equalsIgnoreCase(s)) {
  3388. continue;
  3389. }
  3390. EntityHandler.getAnimationDef(animationIndex).number = EntityHandler.getAnimationDef(nextAnimationIndex).getNumber();
  3391. continue label0;
  3392. }
  3393.  
  3394. loadSprite(animationNumber, "entity", 15);
  3395. if (EntityHandler.getAnimationDef(animationIndex).hasA()) {
  3396. loadSprite(animationNumber + 15, "entity", 3);
  3397. }
  3398.  
  3399. if (EntityHandler.getAnimationDef(animationIndex).hasF()) {
  3400. loadSprite(animationNumber + 18, "entity", 9);
  3401. }
  3402. EntityHandler.getAnimationDef(animationIndex).number = animationNumber;
  3403. animationNumber += 27;
  3404. }
  3405. }
  3406.  
  3407. private final void loadTextures() {
  3408. drawLoadingBarText(60, "Unpacking textures");
  3409. gameCamera.method297(EntityHandler.textureCount(), 7, 11);
  3410. for (int i = 0; i < EntityHandler.textureCount(); i++) {
  3411. loadSprite(SPRITE_TEXTURE_START + i, "texture", 1);
  3412. Sprite sprite = ((GameImage) (gameGraphics)).sprites[SPRITE_TEXTURE_START + i];
  3413.  
  3414. int length = sprite.getWidth() * sprite.getHeight();
  3415. int[] pixels = sprite.getPixels();
  3416. int ai1[] = new int[32768];
  3417. for (int k = 0; k < length; k++) {
  3418. ai1[((pixels[k] & 0xf80000) >> 9) + ((pixels[k] & 0xf800) >> 6) + ((pixels[k] & 0xf8) >> 3)]++;
  3419. }
  3420. int[] dictionary = new int[256];
  3421. dictionary[0] = 0xff00ff;
  3422. int[] temp = new int[256];
  3423. for (int i1 = 0; i1 < ai1.length; i1++) {
  3424. int j1 = ai1[i1];
  3425. if (j1 > temp[255]) {
  3426. for (int k1 = 1; k1 < 256; k1++) {
  3427. if (j1 <= temp[k1]) {
  3428. continue;
  3429. }
  3430. for (int i2 = 255; i2 > k1; i2--) {
  3431. dictionary[i2] = dictionary[i2 - 1];
  3432. temp[i2] = temp[i2 - 1];
  3433. }
  3434. dictionary[k1] = ((i1 & 0x7c00) << 9) + ((i1 & 0x3e0) << 6) + ((i1 & 0x1f) << 3) + 0x40404;
  3435. temp[k1] = j1;
  3436. break;
  3437. }
  3438. }
  3439. ai1[i1] = -1;
  3440. }
  3441. byte[] indices = new byte[length];
  3442. for (int l1 = 0; l1 < length; l1++) {
  3443. int j2 = pixels[l1];
  3444. int k2 = ((j2 & 0xf80000) >> 9) + ((j2 & 0xf800) >> 6) + ((j2 & 0xf8) >> 3);
  3445. int l2 = ai1[k2];
  3446. if (l2 == -1) {
  3447. int i3 = 0x3b9ac9ff;
  3448. int j3 = j2 >> 16 & 0xff;
  3449. int k3 = j2 >> 8 & 0xff;
  3450. int l3 = j2 & 0xff;
  3451. for (int i4 = 0; i4 < 256; i4++) {
  3452. int j4 = dictionary[i4];
  3453. int k4 = j4 >> 16 & 0xff;
  3454. int l4 = j4 >> 8 & 0xff;
  3455. int i5 = j4 & 0xff;
  3456. int j5 = (j3 - k4) * (j3 - k4) + (k3 - l4) * (k3 - l4) + (l3 - i5) * (l3 - i5);
  3457. if (j5 < i3) {
  3458. i3 = j5;
  3459. l2 = i4;
  3460. }
  3461. }
  3462.  
  3463. ai1[k2] = l2;
  3464. }
  3465. indices[l1] = (byte) l2;
  3466. }
  3467. gameCamera.method298(i, indices, dictionary, sprite.getSomething1() / 64 - 1);
  3468. }
  3469. }
  3470.  
  3471. private final void checkMouseStatus() {
  3472. if (selectedSpell >= 0 || selectedItem >= 0) {
  3473. menuText1[menuLength] = "Cancel";
  3474. menuText2[menuLength] = "";
  3475. menuID[menuLength] = 4000;
  3476. menuLength++;
  3477. }
  3478. for (int i = 0; i < menuLength; i++)
  3479. menuIndexes[i] = i;
  3480.  
  3481. for (boolean flag = false; !flag;) {
  3482. flag = true;
  3483. for (int j = 0; j < menuLength - 1; j++) {
  3484. int l = menuIndexes[j];
  3485. int j1 = menuIndexes[j + 1];
  3486. if (menuID[l] > menuID[j1]) {
  3487. menuIndexes[j] = j1;
  3488. menuIndexes[j + 1] = l;
  3489. flag = false;
  3490. }
  3491. }
  3492.  
  3493. }
  3494.  
  3495. if (menuLength > 20)
  3496. menuLength = 20;
  3497. if (menuLength > 0) {
  3498. int k = -1;
  3499. for (int i1 = 0; i1 < menuLength; i1++) {
  3500. if (menuText2[menuIndexes[i1]] == null || menuText2[menuIndexes[i1]].length() <= 0)
  3501. continue;
  3502. k = i1;
  3503. break;
  3504. }
  3505.  
  3506. String s = null;
  3507. if ((selectedItem >= 0 || selectedSpell >= 0) && menuLength == 1)
  3508. s = "Choose a target";
  3509. else if ((selectedItem >= 0 || selectedSpell >= 0) && menuLength > 1)
  3510. s = "@whi@" + menuText1[menuIndexes[0]] + " " + menuText2[menuIndexes[0]];
  3511. else if (k != -1)
  3512. s = menuText2[menuIndexes[k]] + ": @whi@" + menuText1[menuIndexes[0]];
  3513. if (menuLength == 2 && s != null)
  3514. s = s + "@whi@ / 1 more option";
  3515. if (menuLength > 2 && s != null)
  3516. s = s + "@whi@ / " + (menuLength - 1) + " more options";
  3517. if (s != null) {
  3518. if(s.startsWith("#f#")) {
  3519. s = s.replace("#f#", "@whi");
  3520. }
  3521. }
  3522. if (s != null)
  3523. gameGraphics.drawString(s, 6, 14, 1, 0xffff00);
  3524. if (!configMouseButtons && mouseButtonClick == 1 || configMouseButtons && mouseButtonClick == 1 && menuLength == 1) {
  3525. menuClick(menuIndexes[0]);
  3526. mouseButtonClick = 0;
  3527. return;
  3528. }
  3529. if (!configMouseButtons && mouseButtonClick == 2 || configMouseButtons && mouseButtonClick == 1) {
  3530. menuHeight = (menuLength + 1) * 15;
  3531. menuWidth = gameGraphics.textWidth("Choose option", 1) + 5;
  3532. for (int k1 = 0; k1 < menuLength; k1++) {
  3533. int l1 = gameGraphics.textWidth(menuText1[k1] + " " + menuText2[k1], 1) + 5;
  3534. if (l1 > menuWidth)
  3535. menuWidth = l1;
  3536. }
  3537.  
  3538. menuX = super.mouseX - menuWidth / 2;
  3539. menuY = super.mouseY - 7;
  3540. showRightClickMenu = true;
  3541. if (menuX < 0)
  3542. menuX = 0;
  3543. if (menuY < 0)
  3544. menuY = 0;
  3545. if (menuX + menuWidth > 510)
  3546. menuX = 510 - menuWidth;
  3547. if (menuY + menuHeight > 315)
  3548. menuY = 315 - menuHeight;
  3549. mouseButtonClick = 0;
  3550. }
  3551. }
  3552. }
  3553.  
  3554. protected final void cantLogout() {
  3555. logoutTimeout = 0;
  3556. displayMessage("@cya@Sorry, you can't logout at the moment", 3, 0);
  3557. }
  3558.  
  3559. private final void drawFriendsWindow(boolean flag) {
  3560. int i = ((GameImage) (gameGraphics)).menuDefaultWidth - 199;
  3561. int j = 36;
  3562. gameGraphics.drawPicture(i - 49, 3, SPRITE_MEDIA_START + 5);
  3563. char c = '\304';
  3564. char c1 = '\266';
  3565. int l;
  3566. int k = l = GameImage.convertRGBToLong(160, 160, 160);
  3567. if (anInt981 == 0)
  3568. k = GameImage.convertRGBToLong(220, 220, 220);
  3569. else
  3570. l = GameImage.convertRGBToLong(220, 220, 220);
  3571. gameGraphics.drawBoxAlpha(i, j, c / 2, 24, k, 128);
  3572. gameGraphics.drawBoxAlpha(i + c / 2, j, c / 2, 24, l, 128);
  3573. gameGraphics.drawBoxAlpha(i, j + 24, c, c1 - 24, GameImage.convertRGBToLong(220, 220, 220), 128);
  3574. gameGraphics.drawLineX(i, j + 24, c, 0);
  3575. gameGraphics.drawLineY(i + c / 2, j, 24, 0);
  3576. gameGraphics.drawLineX(i, (j + c1) - 16, c, 0);
  3577. gameGraphics.drawText("Friends", i + c / 4, j + 16, 4, 0);
  3578. gameGraphics.drawText("Ignore", i + c / 4 + c / 2, j + 16, 4, 0);
  3579. friendsMenu.resetListTextCount(friendsMenuHandle);
  3580. if (anInt981 == 0) {
  3581. for (int i1 = 0; i1 < super.friendsCount; i1++) {
  3582. String s;
  3583. if (super.friendsListOnlineStatus[i1] == 99)
  3584. s = "@gre@";
  3585. else if (super.friendsListOnlineStatus[i1] > 0)
  3586. s = "@yel@";
  3587. else
  3588. s = "@red@";
  3589. friendsMenu.drawMenuListText(friendsMenuHandle, i1, s + DataOperations.longToString(super.friendsListLongs[i1]) + "~439~@whi@Remove
  3590.  
  3591. WWWWWWWWWW");
  3592. }
  3593.  
  3594. }
  3595. if (anInt981 == 1) {
  3596. for (int j1 = 0; j1 < super.ignoreListCount; j1++)
  3597. friendsMenu.drawMenuListText(friendsMenuHandle, j1, "@yel@" + DataOperations.longToString(super.ignoreListLongs[j1]) + "~439~@whi@Remove
  3598.  
  3599. WWWWWWWWWW");
  3600.  
  3601. }
  3602. friendsMenu.drawMenu();
  3603. if (anInt981 == 0) {
  3604. int k1 = friendsMenu.selectedListIndex(friendsMenuHandle);
  3605. if (k1 >= 0 && super.mouseX < 489) {
  3606. if (super.mouseX > 429)
  3607. gameGraphics.drawText("Click to remove " + DataOperations.longToString(super.friendsListLongs[k1]), i + c / 2, j + 35, 1, 0xffffff);
  3608. else if (super.friendsListOnlineStatus[k1] == 99)
  3609. gameGraphics.drawText("Click to message " + DataOperations.longToString(super.friendsListLongs[k1]), i + c / 2, j + 35, 1, 0xffffff);
  3610. else if (super.friendsListOnlineStatus[k1] > 0)
  3611. gameGraphics.drawText(DataOperations.longToString(super.friendsListLongs[k1]) + " is on world " + super.friendsListOnlineStatus[k1], i +
  3612.  
  3613. c / 2, j + 35, 1, 0xffffff);
  3614. else
  3615. gameGraphics.drawText(DataOperations.longToString(super.friendsListLongs[k1]) + " is offline", i + c / 2, j + 35, 1, 0xffffff);
  3616. } else {
  3617. gameGraphics.drawText("Click a name to send a message", i + c / 2, j + 35, 1, 0xffffff);
  3618. }
  3619. int k2;
  3620. if (super.mouseX > i && super.mouseX < i + c && super.mouseY > (j + c1) - 16 && super.mouseY < j + c1)
  3621. k2 = 0xffff00;
  3622. else
  3623. k2 = 0xffffff;
  3624. gameGraphics.drawText("Click here to add a friend", i + c / 2, (j + c1) - 3, 1, k2);
  3625. }
  3626. if (anInt981 == 1) {
  3627. int l1 = friendsMenu.selectedListIndex(friendsMenuHandle);
  3628. if (l1 >= 0 && super.mouseX < 489 && super.mouseX > 429) {
  3629. if (super.mouseX > 429)
  3630. gameGraphics.drawText("Click to remove " + DataOperations.longToString(super.ignoreListLongs[l1]), i + c / 2, j + 35, 1, 0xffffff);
  3631. } else {
  3632. gameGraphics.drawText("Blocking messages from:", i + c / 2, j + 35, 1, 0xffffff);
  3633. }
  3634. int l2;
  3635. if (super.mouseX > i && super.mouseX < i + c && super.mouseY > (j + c1) - 16 && super.mouseY < j + c1)
  3636. l2 = 0xffff00;
  3637. else
  3638. l2 = 0xffffff;
  3639. gameGraphics.drawText("Click here to add a name", i + c / 2, (j + c1) - 3, 1, l2);
  3640. }
  3641. if (!flag)
  3642. return;
  3643. i = super.mouseX - (((GameImage) (gameGraphics)).menuDefaultWidth - 199);
  3644. j = super.mouseY - 36;
  3645. if (i >= 0 && j >= 0 && i < 196 && j < 182) {
  3646. friendsMenu.updateActions(i + (((GameImage) (gameGraphics)).menuDefaultWidth - 199), j + 36, super.lastMouseDownButton, super.mouseDownButton);
  3647. if(mouseButtonClick == 2 && showModCommands)
  3648. {
  3649. int i2 = friendsMenu.selectedListIndex(friendsMenuHandle);
  3650. if(i2 >= 0 && super.mouseX <= 429 && super.friendsListOnlineStatus[i2] != 0)
  3651. {
  3652. String targetUsername = DataOperations.longToString(super.friendsListLongs[i2]);
  3653. for(int i11 = 0; i11 <= menuLength; i11++)
  3654. {
  3655. menuText1[i11] = "";
  3656. menuText2[i11] = "";
  3657. menuID[i11] = 0;
  3658. menuActionType[i11] = 0;
  3659. }
  3660.  
  3661. menuText1[menuLength] = "Summon";
  3662. menuText2[menuLength] = (new StringBuilder()).append("@whi@").append(targetUsername).toString();
  3663. menuID[menuLength] = 9915;
  3664. menuActionType[menuLength] = i2;
  3665. menuLength++;
  3666. menuText1[menuLength] = "Kick";
  3667. menuText2[menuLength] = (new StringBuilder()).append("@whi@").append(targetUsername).toString();
  3668. menuID[menuLength] = 9916;
  3669. menuActionType[menuLength] = i2;
  3670. menuLength++;
  3671. menuHeight = (menuLength + 1) * 15;
  3672. menuWidth = gameGraphics.textWidth("Choose option", 1) + 5;
  3673. for(int k1 = 0; k1 < menuLength; k1++)
  3674. {
  3675. int l1 = gameGraphics.textWidth((new StringBuilder()).append(menuText1[k1]).append(" ").append(menuText2[k1]).toString(), 1) + 5;
  3676. if(l1 > menuWidth)
  3677. {
  3678. menuWidth = l1;
  3679. }
  3680. }
  3681.  
  3682. menuX = super.mouseX - menuWidth / 2;
  3683. menuY = super.mouseY - 7;
  3684. showRightClickMenu = true;
  3685. if(menuX < 0)
  3686. {
  3687. menuX = 0;
  3688. }
  3689. if(menuY < 0)
  3690. {
  3691. menuY = 0;
  3692. }
  3693. if(menuX + menuWidth > 510)
  3694. {
  3695. menuX = 510 - menuWidth;
  3696. }
  3697. if(menuY + menuHeight > 315)
  3698. {
  3699. menuY = 315 - menuHeight;
  3700. }
  3701. mouseButtonClick = 0;
  3702. }
  3703. }
  3704. if (j <= 24 && mouseButtonClick == 1)
  3705. if (i < 98 && anInt981 == 1) {
  3706. anInt981 = 0;
  3707. friendsMenu.method165(friendsMenuHandle, 0);
  3708. } else if (i > 98 && anInt981 == 0) {
  3709. anInt981 = 1;
  3710. friendsMenu.method165(friendsMenuHandle, 0);
  3711. }
  3712. if (mouseButtonClick == 1 && anInt981 == 0) {
  3713. int i2 = friendsMenu.selectedListIndex(friendsMenuHandle);
  3714. if (i2 >= 0 && super.mouseX < 489)
  3715. if (super.mouseX > 429)
  3716. removeFromFriends(super.friendsListLongs[i2]);
  3717. else if (super.friendsListOnlineStatus[i2] != 0) {
  3718. inputBoxType = 2;
  3719. privateMessageTarget = super.friendsListLongs[i2];
  3720. super.inputMessage = "";
  3721. super.enteredMessage = "";
  3722. }
  3723. }
  3724. if (mouseButtonClick == 1 && anInt981 == 1) {
  3725. int j2 = friendsMenu.selectedListIndex(friendsMenuHandle);
  3726. if (j2 >= 0 && super.mouseX < 489 && super.mouseX > 429)
  3727. removeFromIgnoreList(super.ignoreListLongs[j2]);
  3728. }
  3729. if (j > 166 && mouseButtonClick == 1 && anInt981 == 0) {
  3730. inputBoxType = 1;
  3731. super.inputText = "";
  3732. super.enteredText = "";
  3733. }
  3734. if (j > 166 && mouseButtonClick == 1 && anInt981 == 1) {
  3735. inputBoxType = 3;
  3736. super.inputText = "";
  3737. super.enteredText = "";
  3738. }
  3739. mouseButtonClick = 0;
  3740. }
  3741. }
  3742.  
  3743. private final boolean loadSection(int i, int j) {
  3744. if (playerAliveTimeout != 0) {
  3745. engineHandle.playerIsAlive = false;
  3746. return false;
  3747. }
  3748. notInWilderness = false;
  3749. i += wildX;
  3750. j += wildY;
  3751. if (lastWildYSubtract == wildYSubtract && i > anInt789 && i < anInt791 && j > anInt790 && j < anInt792) {
  3752. engineHandle.playerIsAlive = true;
  3753. return false;
  3754. }
  3755. gameGraphics.drawText("Loading... Please wait", 256, 192, 1, 0xffffff);
  3756. drawChatMessageTabs();
  3757. gameGraphics.drawImage(aGraphics936, 0, 0);
  3758. int k = areaX;
  3759. int l = areaY;
  3760. int i1 = (i + 24) / 48;
  3761. int j1 = (j + 24) / 48;
  3762. lastWildYSubtract = wildYSubtract;
  3763. areaX = i1 * 48 - 48;
  3764. areaY = j1 * 48 - 48;
  3765. anInt789 = i1 * 48 - 32;
  3766. anInt790 = j1 * 48 - 32;
  3767. anInt791 = i1 * 48 + 32;
  3768. anInt792 = j1 * 48 + 32;
  3769. engineHandle.method401(i, j, lastWildYSubtract);
  3770. areaX -= wildX;
  3771. areaY -= wildY;
  3772. int k1 = areaX - k;
  3773. int l1 = areaY - l;
  3774. for (int i2 = 0; i2 < objectCount; i2++) {
  3775. objectX[i2] -= k1;
  3776. objectY[i2] -= l1;
  3777. int j2 = objectX[i2];
  3778. int l2 = objectY[i2];
  3779. int k3 = objectType[i2];
  3780. int m4 = objectID[i2];
  3781. Model model = objectModelArray[i2];
  3782. try {
  3783. int l4 = objectID[i2];
  3784. int k5;
  3785. int i6;
  3786. if (l4 == 0 || l4 == 4) {
  3787. k5 = EntityHandler.getObjectDef(k3).getWidth();
  3788. i6 = EntityHandler.getObjectDef(k3).getHeight();
  3789. } else {
  3790. i6 = EntityHandler.getObjectDef(k3).getWidth();
  3791. k5 = EntityHandler.getObjectDef(k3).getHeight();
  3792. }
  3793. int j6 = ((j2 + j2 + k5) * magicLoc) / 2;
  3794. int k6 = ((l2 + l2 + i6) * magicLoc) / 2;
  3795. if (j2 >= 0 && l2 >= 0 && j2 < 96 && l2 < 96) {
  3796. gameCamera.addModel(model);
  3797. model.method191(j6, -engineHandle.getAveragedElevation(j6, k6), k6);
  3798. engineHandle.method412(j2, l2, k3, m4);
  3799. if (k3 == 74)
  3800. model.method190(0, -480, 0);
  3801. }
  3802. }
  3803. catch (RuntimeException runtimeexception) {
  3804. System.out.println("Loc Error: " + runtimeexception.getMessage());
  3805. System.out.println("i:" + i2 + " obj:" + model);
  3806. runtimeexception.printStackTrace();
  3807. }
  3808. }
  3809.  
  3810. for (int k2 = 0; k2 < doorCount; k2++) {
  3811. doorX[k2] -= k1;
  3812. doorY[k2] -= l1;
  3813. int i3 = doorX[k2];
  3814. int l3 = doorY[k2];
  3815. int j4 = doorType[k2];
  3816. int i5 = doorDirection[k2];
  3817. try {
  3818. engineHandle.method408(i3, l3, i5, j4);
  3819. Model model_1 = makeModel(i3, l3, i5, j4, k2);
  3820. doorModel[k2] = model_1;
  3821. }
  3822. catch (RuntimeException runtimeexception1) {
  3823. System.out.println("Bound Error: " + runtimeexception1.getMessage());
  3824. runtimeexception1.printStackTrace();
  3825. }
  3826. }
  3827.  
  3828. for (int j3 = 0; j3 < groundItemCount; j3++) {
  3829. groundItemX[j3] -= k1;
  3830. groundItemY[j3] -= l1;
  3831. }
  3832.  
  3833. for (int i4 = 0; i4 < playerCount; i4++) {
  3834. Mob mob = playerArray[i4];
  3835. mob.currentX -= k1 * magicLoc;
  3836. mob.currentY -= l1 * magicLoc;
  3837. for (int j5 = 0; j5 <= mob.waypointCurrent; j5++) {
  3838. mob.waypointsX[j5] -= k1 * magicLoc;
  3839. mob.waypointsY[j5] -= l1 * magicLoc;
  3840. }
  3841.  
  3842. }
  3843.  
  3844. for (int k4 = 0; k4 < npcCount; k4++) {
  3845. Mob mob_1 = npcArray[k4];
  3846. mob_1.currentX -= k1 * magicLoc;
  3847. mob_1.currentY -= l1 * magicLoc;
  3848. for (int l5 = 0; l5 <= mob_1.waypointCurrent; l5++) {
  3849. mob_1.waypointsX[l5] -= k1 * magicLoc;
  3850. mob_1.waypointsY[l5] -= l1 * magicLoc;
  3851. }
  3852.  
  3853. }
  3854.  
  3855. engineHandle.playerIsAlive = true;
  3856. return true;
  3857. }
  3858.  
  3859. private final void drawMagicWindow(boolean flag) {
  3860. int i = ((GameImage) (gameGraphics)).menuDefaultWidth - 199;
  3861. int j = 36;
  3862. gameGraphics.drawPicture(i - 49, 3, SPRITE_MEDIA_START + 4);
  3863. char c = '\304';
  3864. char c1 = '\266';
  3865. int l;
  3866. int k = l = GameImage.convertRGBToLong(160, 160, 160);
  3867. if (menuMagicPrayersSelected == 0)
  3868. k = GameImage.convertRGBToLong(220, 220, 220);
  3869. else
  3870. l = GameImage.convertRGBToLong(220, 220, 220);
  3871. gameGraphics.drawBoxAlpha(i, j, c / 2, 24, k, 128);
  3872. gameGraphics.drawBoxAlpha(i + c / 2, j, c / 2, 24, l, 128);
  3873. gameGraphics.drawBoxAlpha(i, j + 24, c, 90, GameImage.convertRGBToLong(220, 220, 220), 128);
  3874. gameGraphics.drawBoxAlpha(i, j + 24 + 90, c, c1 - 90 - 24, GameImage.convertRGBToLong(160, 160, 160), 128);
  3875. gameGraphics.drawLineX(i, j + 24, c, 0);
  3876. gameGraphics.drawLineY(i + c / 2, j, 24, 0);
  3877. gameGraphics.drawLineX(i, j + 113, c, 0);
  3878. gameGraphics.drawText("Magic", i + c / 4, j + 16, 4, 0);
  3879. gameGraphics.drawText("Prayers", i + c / 4 + c / 2, j + 16, 4, 0);
  3880. if (menuMagicPrayersSelected == 0) {
  3881. spellMenu.resetListTextCount(spellMenuHandle);
  3882. int i1 = 0;
  3883. for (int spellIndex = 0; spellIndex < EntityHandler.spellCount(); spellIndex++) {
  3884. String s = "@yel@";
  3885. for (Entry e : EntityHandler.getSpellDef(spellIndex).getRunesRequired()) {
  3886. if (hasRequiredRunes((Integer) e.getKey(), (Integer) e.getValue())) {
  3887. continue;
  3888. }
  3889. s = "@whi@";
  3890. break;
  3891. }
  3892. int spellLevel = playerStatCurrent[6];
  3893. if (EntityHandler.getSpellDef(spellIndex).getReqLevel() > spellLevel) {
  3894. s = "@bla@";
  3895. }
  3896. spellMenu.drawMenuListText(spellMenuHandle, i1++, s + "Level " + EntityHandler.getSpellDef(spellIndex).getReqLevel() + ": " +
  3897.  
  3898. EntityHandler.getSpellDef(spellIndex).getName());
  3899. }
  3900.  
  3901. spellMenu.drawMenu();
  3902. int selectedSpellIndex = spellMenu.selectedListIndex(spellMenuHandle);
  3903. if (selectedSpellIndex != -1) {
  3904. gameGraphics.drawString("Level " + EntityHandler.getSpellDef(selectedSpellIndex).getReqLevel() + ": " +
  3905.  
  3906. EntityHandler.getSpellDef(selectedSpellIndex).getName(), i + 2, j + 124, 1, 0xffff00);
  3907. gameGraphics.drawString(EntityHandler.getSpellDef(selectedSpellIndex).getDescription(), i + 2, j + 136, 0, 0xffffff);
  3908. int i4 = 0;
  3909. for (Entry<Integer, Integer> e : EntityHandler.getSpellDef(selectedSpellIndex).getRunesRequired()) {
  3910. int runeID = e.getKey();
  3911. gameGraphics.drawPicture(i + 2 + i4 * 44, j + 150, SPRITE_ITEM_START + EntityHandler.getItemDef(runeID).getSprite());
  3912. int runeInvCount = inventoryCount(runeID);
  3913. int runeCount = e.getValue();
  3914. String s2 = "@red@";
  3915. if (hasRequiredRunes(runeID, runeCount)) {
  3916. s2 = "@gre@";
  3917. }
  3918. gameGraphics.drawString(s2 + runeInvCount + "/" + runeCount, i + 2 + i4 * 44, j + 150, 1, 0xffffff);
  3919. i4++;
  3920. }
  3921. } else {
  3922. gameGraphics.drawString("Point at a spell for a description", i + 2, j + 124, 1, 0);
  3923. }
  3924. }
  3925. if (menuMagicPrayersSelected == 1) {
  3926. spellMenu.resetListTextCount(spellMenuHandle);
  3927. int j1 = 0;
  3928. for (int j2 = 0; j2 < EntityHandler.prayerCount(); j2++) {
  3929. String s1 = "@whi@";
  3930. if (EntityHandler.getPrayerDef(j2).getReqLevel() > playerStatBase[5])
  3931. s1 = "@bla@";
  3932. if (prayerOn[j2])
  3933. s1 = "@gre@";
  3934. spellMenu.drawMenuListText(spellMenuHandle, j1++, s1 + "Level " + EntityHandler.getPrayerDef(j2).getReqLevel() + ": " +
  3935.  
  3936. EntityHandler.getPrayerDef(j2).getName());
  3937. }
  3938. spellMenu.drawMenu();
  3939. int j3 = spellMenu.selectedListIndex(spellMenuHandle);
  3940. if (j3 != -1) {
  3941. gameGraphics.drawText("Level " + EntityHandler.getPrayerDef(j3).getReqLevel() + ": " + EntityHandler.getPrayerDef(j3).getName(), i + c / 2, j
  3942.  
  3943. + 130, 1, 0xffff00);
  3944. gameGraphics.drawText(EntityHandler.getPrayerDef(j3).getDescription(), i + c / 2, j + 145, 0, 0xffffff);
  3945. gameGraphics.drawText("Drain rate: " + EntityHandler.getPrayerDef(j3).getDrainRate(), i + c / 2, j + 160, 1, 0);
  3946. } else {
  3947. gameGraphics.drawString("Point at a prayer for a description", i + 2, j + 124, 1, 0);
  3948. }
  3949. }
  3950. if (!flag)
  3951. return;
  3952. i = super.mouseX - (((GameImage) (gameGraphics)).menuDefaultWidth - 199);
  3953. j = super.mouseY - 36;
  3954. if (i >= 0 && j >= 0 && i < 196 && j < 182) {
  3955. spellMenu.updateActions(i + (((GameImage) (gameGraphics)).menuDefaultWidth - 199), j + 36, super.lastMouseDownButton, super.mouseDownButton);
  3956. if (j <= 24 && mouseButtonClick == 1)
  3957. if (i < 98 && menuMagicPrayersSelected == 1) {
  3958. menuMagicPrayersSelected = 0;
  3959. prayerMenuIndex = spellMenu.getMenuIndex(spellMenuHandle);
  3960. spellMenu.method165(spellMenuHandle, magicMenuIndex);
  3961. } else if (i > 98 && menuMagicPrayersSelected == 0) {
  3962. menuMagicPrayersSelected = 1;
  3963. magicMenuIndex = spellMenu.getMenuIndex(spellMenuHandle);
  3964. spellMenu.method165(spellMenuHandle, prayerMenuIndex);
  3965. }
  3966. if (mouseButtonClick == 1 && menuMagicPrayersSelected == 0) {
  3967. int k1 = spellMenu.selectedListIndex(spellMenuHandle);
  3968. if (k1 != -1) {
  3969. int k2 = playerStatCurrent[6];
  3970. if (EntityHandler.getSpellDef(k1).getReqLevel() > k2) {
  3971. displayMessage("Your magic ability is not high enough for this spell", 3, 0);
  3972. } else {
  3973. int k3 = 0;
  3974. for (Entry<Integer, Integer> e : EntityHandler.getSpellDef(k1).getRunesRequired()) {
  3975. if (!hasRequiredRunes(e.getKey(), e.getValue())) {
  3976. displayMessage("You don't have all the reagents you need for this spell", 3, 0);
  3977. k3 = -1;
  3978. break;
  3979. }
  3980. k3++;
  3981. }
  3982. if (k3 == EntityHandler.getSpellDef(k1).getRuneCount()) {
  3983. selectedSpell = k1;
  3984. selectedItem = -1;
  3985. }
  3986. }
  3987. }
  3988. }
  3989. if (mouseButtonClick == 1 && menuMagicPrayersSelected == 1) {
  3990. int l1 = spellMenu.selectedListIndex(spellMenuHandle);
  3991. if (l1 != -1) {
  3992. int l2 = playerStatBase[5];
  3993. if (EntityHandler.getPrayerDef(l1).getReqLevel() > l2)
  3994. displayMessage("Your prayer ability is not high enough for this prayer", 3, 0);
  3995. else if (playerStatCurrent[5] == 0)
  3996. displayMessage("You have run out of prayer points. Return to a church to recharge", 3, 0);
  3997. else if (prayerOn[l1]) {
  3998. super.streamClass.createPacket(248);
  3999. super.streamClass.addByte(l1);
  4000. super.streamClass.formatPacket();
  4001. prayerOn[l1] = false;
  4002. playSound("prayeroff");
  4003. } else {
  4004. super.streamClass.createPacket(56);
  4005. super.streamClass.addByte(l1);
  4006. super.streamClass.formatPacket();
  4007. prayerOn[l1] = true;
  4008. playSound("prayeron");
  4009. }
  4010. }
  4011. }
  4012. mouseButtonClick = 0;
  4013. }
  4014. }
  4015.  
  4016. protected final void handleMenuKeyDown(int key) {
  4017. switch (key) {
  4018. case 1004: // Page Up Up Arrow
  4019. if(cameraHeight < 300){
  4020. cameraHeight += 25;
  4021. }else{
  4022. cameraHeight -= 25;
  4023. //displayMessage("@gr2@Zoom: @whi@" + cameraHeight + ".", 3, 0);
  4024. }
  4025. break;
  4026. case 1005: // Page Down Down Arrow
  4027. if(cameraHeight > 1500){
  4028. cameraHeight -= 25;
  4029. }else{
  4030. cameraHeight += 25;
  4031. //displayMessage("@gr2@Zoom: @whi@" + cameraHeight + ".", 3, 0);
  4032. }
  4033. break;
  4034. case 1002: // Up Arrow
  4035. gameMenu.updateText(chatHandle, lastMessage);
  4036. break;
  4037. case 1003: // Down Arrow
  4038. gameMenu.updateText(chatHandle, "");
  4039. break;
  4040. case 1009:
  4041. this.MS = (!(this.MS));
  4042. if(this.MS) {
  4043. handleServerMessage("@whi@[@cya@ProjectPK@whi@] Client info: @gre@ On");
  4044. } else {
  4045. handleServerMessage("@whi@[@cya@ProjectPK@whi@] Client info: @red@ Off");
  4046. }
  4047. break;
  4048. case 1013: // F6
  4049. case 1014: // F7
  4050. fogOfWar = !fogOfWar;
  4051. if(fogOfWar) {
  4052. //handleServerMessage("@whi@[@cya@DaNePK@whi@] Fog of War: @gre@ On");
  4053. } else {
  4054. //handleServerMessage("@whi@[@cya@DaNePK@whi@] Fog of War: @red@ Off");
  4055. }
  4056. break;
  4057. case 1018: // F11
  4058. recording = !recording;
  4059. if (recording) {
  4060. try {
  4061. frames.clear();
  4062. File file = getEmptyFile(true);
  4063. Recorder recorder = new Recorder(windowWidth, windowHeight + 11, Config.MOVIE_FPS, frames, file.getAbsolutePath(),
  4064.  
  4065. "video.quicktime");
  4066. displayMessage("Recording movie to " + file.getName(), 3, 0);
  4067. new Thread(recorder).start();
  4068. }
  4069. catch (Exception e) {
  4070. }
  4071. } else {
  4072. frames.add(null);
  4073. displayMessage("Movie saved.", 3, 0);
  4074. }
  4075. break;
  4076. case 1019: // F12
  4077. takeScreenshot(true);
  4078. break;
  4079. }
  4080. if (loggedIn == 0) {
  4081. if (loginScreenNumber == 0)
  4082. menuWelcome.keyDown(key);
  4083. if (loginScreenNumber == 1)
  4084. menuNewUser.keyDown(key);
  4085. if (loginScreenNumber == 2)
  4086. menuLogin.keyDown(key);
  4087. }
  4088. if (loggedIn == 1) {
  4089. if (showCharacterLookScreen) {
  4090. characterDesignMenu.keyDown(key);
  4091. return;
  4092. }
  4093. if (inputBoxType == 0 && showAbuseWindow == 0)
  4094. gameMenu.keyDown(key);
  4095. }
  4096. }
  4097.  
  4098. private final void drawShopBox() {
  4099. if (mouseButtonClick != 0) {
  4100. mouseButtonClick = 0;
  4101. int i = super.mouseX - 52;
  4102. int j = super.mouseY - 44;
  4103. if (i >= 0 && j >= 12 && i < 408 && j < 246) {
  4104. int k = 0;
  4105. for (int i1 = 0; i1 < 5; i1++) {
  4106. for (int i2 = 0; i2 < 8; i2++) {
  4107. int l2 = 7 + i2 * 49;
  4108. int l3 = 28 + i1 * 34;
  4109. if (i > l2 && i < l2 + 49 && j > l3 && j < l3 + 34 && shopItems[k] != -1) {
  4110. selectedShopItemIndex = k;
  4111. selectedShopItemType = shopItems[k];
  4112. }
  4113. k++;
  4114. }
  4115.  
  4116. }
  4117.  
  4118. if (selectedShopItemIndex >= 0) {
  4119. int j2 = shopItems[selectedShopItemIndex];
  4120. if (j2 != -1) {
  4121. if (shopItemCount[selectedShopItemIndex] > 0 && i > 298 && j >= 204 && i < 408 && j <= 215) {
  4122. int i4 = (shopItemBuyPriceModifier * EntityHandler.getItemDef(j2).getBasePrice()) / 100;
  4123. super.streamClass.createPacket(128);
  4124. super.streamClass.add2ByteInt(shopItems[selectedShopItemIndex]);
  4125. super.streamClass.add4ByteInt(i4);
  4126. super.streamClass.formatPacket();
  4127. }
  4128. if (inventoryCount(j2) > 0 && i > 2 && j >= 229 && i < 112 && j <= 240) {
  4129. int j4 = (shopItemSellPriceModifier * EntityHandler.getItemDef(j2).getBasePrice()) / 100;
  4130. super.streamClass.createPacket(255);
  4131. super.streamClass.add2ByteInt(shopItems[selectedShopItemIndex]);
  4132. super.streamClass.add4ByteInt(j4);
  4133. super.streamClass.formatPacket();
  4134. }
  4135. }
  4136. }
  4137. } else {
  4138. super.streamClass.createPacket(253);
  4139. super.streamClass.formatPacket();
  4140. showShop = false;
  4141. return;
  4142. }
  4143. }
  4144. byte byte0 = 52;
  4145. byte byte1 = 44;
  4146. gameGraphics.drawBox(byte0, byte1, 408, 12, 192);
  4147. int l = 0x989898;
  4148. gameGraphics.drawBoxAlpha(byte0, byte1 + 12, 408, 17, l, 160);
  4149. gameGraphics.drawBoxAlpha(byte0, byte1 + 29, 8, 170, l, 160);
  4150. gameGraphics.drawBoxAlpha(byte0 + 399, byte1 + 29, 9, 170, l, 160);
  4151. gameGraphics.drawBoxAlpha(byte0, byte1 + 199, 408, 47, l, 160);
  4152. gameGraphics.drawString("Buying and selling items", byte0 + 1, byte1 + 10, 1, 0xffffff);
  4153. int j1 = 0xffffff;
  4154. if (super.mouseX > byte0 + 320 && super.mouseY >= byte1 && super.mouseX < byte0 + 408 && super.mouseY < byte1 + 12)
  4155. j1 = 0xff0000;
  4156. gameGraphics.drawBoxTextRight("Close window", byte0 + 406, byte1 + 10, 1, j1);
  4157. gameGraphics.drawString("Shops stock in green", byte0 + 2, byte1 + 24, 1, 65280);
  4158. gameGraphics.drawString("Number you own in blue", byte0 + 135, byte1 + 24, 1, 65535);
  4159. gameGraphics.drawString("Your money: " + inventoryCount(10) + "gp", byte0 + 280, byte1 + 24, 1, 0xffff00);
  4160. int k2 = 0xd0d0d0;
  4161. int k3 = 0;
  4162. for (int k4 = 0; k4 < 5; k4++) {
  4163. for (int l4 = 0; l4 < 8; l4++) {
  4164. int j5 = byte0 + 7 + l4 * 49;
  4165. int i6 = byte1 + 28 + k4 * 34;
  4166. if (selectedShopItemIndex == k3)
  4167. gameGraphics.drawBoxAlpha(j5, i6, 49, 34, 0xff0000, 160);
  4168. else
  4169. gameGraphics.drawBoxAlpha(j5, i6, 49, 34, k2, 160);
  4170. gameGraphics.drawBoxEdge(j5, i6, 50, 35, 0);
  4171. if (shopItems[k3] != -1) {
  4172. gameGraphics.spriteClip4(j5, i6, 48, 32, SPRITE_ITEM_START + EntityHandler.getItemDef(shopItems[k3]).getSprite(),
  4173.  
  4174. EntityHandler.getItemDef(shopItems[k3]).getPictureMask(), 0, 0, false);
  4175. gameGraphics.drawString(String.valueOf(shopItemCount[k3]), j5 + 1, i6 + 10, 1, 65280);
  4176. gameGraphics.drawBoxTextRight(String.valueOf(inventoryCount(shopItems[k3])), j5 + 47, i6 + 10, 1, 65535);
  4177. }
  4178. k3++;
  4179. }
  4180.  
  4181. }
  4182.  
  4183. gameGraphics.drawLineX(byte0 + 5, byte1 + 222, 398, 0);
  4184. if (selectedShopItemIndex == -1) {
  4185. gameGraphics.drawText("Select an object to buy or sell", byte0 + 204, byte1 + 214, 3, 0xffff00);
  4186. return;
  4187. }
  4188. int i5 = shopItems[selectedShopItemIndex];
  4189. if (i5 != -1) {
  4190. if (shopItemCount[selectedShopItemIndex] > 0) {
  4191. int j6 = (shopItemBuyPriceModifier * EntityHandler.getItemDef(i5).getBasePrice()) / 100;
  4192. gameGraphics.drawString("Buy a new " + EntityHandler.getItemDef(i5).getName() + " for " + j6 + "gp", byte0 + 2, byte1 + 214, 1, 0xffff00);
  4193. int k1 = 0xffffff;
  4194. if (super.mouseX > byte0 + 298 && super.mouseY >= byte1 + 204 && super.mouseX < byte0 + 408 && super.mouseY <= byte1 + 215)
  4195. k1 = 0xff0000;
  4196. gameGraphics.drawBoxTextRight("Click here to buy", byte0 + 405, byte1 + 214, 3, k1);
  4197. } else {
  4198. gameGraphics.drawText("This item is not currently available to buy", byte0 + 204, byte1 + 214, 3, 0xffff00);
  4199. }
  4200. if (inventoryCount(i5) > 0) {
  4201. int k6 = (shopItemSellPriceModifier * EntityHandler.getItemDef(i5).getBasePrice()) / 100;
  4202. gameGraphics.drawBoxTextRight("Sell your " + EntityHandler.getItemDef(i5).getName() + " for " + k6 + "gp", byte0 + 405, byte1 + 239, 1,
  4203.  
  4204. 0xffff00);
  4205. int l1 = 0xffffff;
  4206. if (super.mouseX > byte0 + 2 && super.mouseY >= byte1 + 229 && super.mouseX < byte0 + 112 && super.mouseY <= byte1 + 240)
  4207. l1 = 0xff0000;
  4208. gameGraphics.drawString("Click here to sell", byte0 + 2, byte1 + 239, 3, l1);
  4209. return;
  4210. }
  4211. gameGraphics.drawText("You do not have any of this item to sell", byte0 + 204, byte1 + 239, 3, 0xffff00);
  4212. }
  4213. }
  4214.  
  4215. private final void drawGameMenu() {
  4216. gameMenu = new Menu(gameGraphics, 10);
  4217. messagesHandleType2 = gameMenu.method159(5, 269, 502, 56, 1, 20, true);
  4218. chatHandle = gameMenu.method160(7, 324, 498, 14, 1, 80, false, true);
  4219. messagesHandleType5 = gameMenu.method159(5, 269, 502, 56, 1, 20, true);
  4220. messagesHandleType6 = gameMenu.method159(5, 269, 502, 56, 1, 20, true);
  4221. messagesHandleType7 = gameMenu.method159(5, 269, 502, 56, 1, 20, true);
  4222. gameMenu.setFocus(chatHandle);
  4223. }
  4224.  
  4225. protected final byte[] load(String filename) {
  4226. return super.load(Config.CONF_DIR + File.separator + "data" + File.separator + filename);
  4227. }
  4228.  
  4229. private final void drawOptionsMenu(boolean flag) {
  4230. int i = ((GameImage) (gameGraphics)).menuDefaultWidth - 199;
  4231. int j = 36;
  4232. gameGraphics.drawPicture(i - 49, 3, SPRITE_MEDIA_START + 6);
  4233. char c = '\304';
  4234. gameGraphics.drawBoxAlpha(i, 36, c, 65, GameImage.convertRGBToLong(181, 181, 181), 160);
  4235. gameGraphics.drawBoxAlpha(i, 101, c, 65, GameImage.convertRGBToLong(201, 201, 201), 160);
  4236. gameGraphics.drawBoxAlpha(i, 166, c, 95, GameImage.convertRGBToLong(181, 181, 181), 160);
  4237. gameGraphics.drawBoxAlpha(i, 261, c, 40, GameImage.convertRGBToLong(201, 201, 201), 160);
  4238. int k = i + 3;
  4239. int i1 = j + 15;
  4240. gameGraphics.drawString("Game Options - Click to Toggle", k, i1, 1, 0);
  4241. i1 += 15;
  4242. if (configAutoCameraAngle)
  4243. gameGraphics.drawString("Camera Angle Mode - @gre@Auto", k, i1, 1, 0xffffff);
  4244. else
  4245. gameGraphics.drawString("Camera Angle Mode - @red@Manual", k, i1, 1, 0xffffff);
  4246. i1 += 15;
  4247. if (configMouseButtons)
  4248. gameGraphics.drawString("Mouse Buttons - @red@One", k, i1, 1, 0xffffff);
  4249. else
  4250. gameGraphics.drawString("Mouse Buttons - @gre@Two", k, i1, 1, 0xffffff);
  4251. i1 += 15;
  4252. if (configSoundEffects)
  4253. gameGraphics.drawString("Sound Effects - @red@Off", k, i1, 1, 0xffffff);
  4254. else
  4255. gameGraphics.drawString("Sound Effects - @gre@On", k, i1, 1, 0xffffff);
  4256. i1 += 15;
  4257. gameGraphics.drawString("Client Assists - Click to Toggle", k, i1, 1, 0);
  4258. i1 += 15;
  4259. if (showGroundItems)
  4260. gameGraphics.drawString("Hide Loot - @red@Off", k, i1, 1, 16777215);
  4261. else
  4262. gameGraphics.drawString("Hide Loot - @gre@On", k, i1, 1, 16777215);
  4263. i1 += 15;
  4264. if (showRoof)
  4265. gameGraphics.drawString("Hide Roofs - @red@Off", k, i1, 1, 0xffffff);
  4266. else
  4267. gameGraphics.drawString("Hide Roofs - @gre@On", k, i1, 1, 0xffffff);
  4268. i1 += 15;
  4269. if (autoScreenshot)
  4270. gameGraphics.drawString("Auto Screenshots - @gre@On", k, i1, 1, 0xffffff);
  4271. else
  4272. gameGraphics.drawString("Auto Screenshots - @red@Off", k, i1, 1, 0xffffff);
  4273. i1 += 15;
  4274. if (combatWindow)
  4275. gameGraphics.drawString("Fightmode Selector - @gre@On", k, i1, 1, 0xffffff);
  4276. else
  4277. gameGraphics.drawString("Fightmode Selector - @red@Off", k, i1, 1, 0xffffff);
  4278. i1 += 15;
  4279. i1 += 3;
  4280. gameGraphics.drawString("Privacy Settings. Will be applied to", i + 3, i1, 1, 0);
  4281. i1 += 15;
  4282. gameGraphics.drawString("all people not on your friends list", i + 3, i1, 1, 0);
  4283. i1 += 15;
  4284. if (super.blockChatMessages == 0)
  4285. gameGraphics.drawString("Block Chat Messages: @red@<off>", i + 3, i1, 1, 0xffffff);
  4286. else
  4287. gameGraphics.drawString("Block Chat Messages: @gre@<on>", i + 3, i1, 1, 0xffffff);
  4288. i1 += 15;
  4289. if (super.blockPrivateMessages == 0)
  4290. gameGraphics.drawString("Block Private Messages: @red@<off>", i + 3, i1, 1, 0xffffff);
  4291. else
  4292. gameGraphics.drawString("Block Private Messages: @gre@<on>", i + 3, i1, 1, 0xffffff);
  4293. i1 += 15;
  4294. if (super.blockTradeRequests == 0)
  4295. gameGraphics.drawString("Block Trade Requests: @red@<off>", i + 3, i1, 1, 0xffffff);
  4296. else
  4297. gameGraphics.drawString("Block Trade Requests: @gre@<on>", i + 3, i1, 1, 0xffffff);
  4298. i1 += 15;
  4299. if (super.blockDuelRequests == 0)
  4300. gameGraphics.drawString("Block Duel Requests: @red@<off>", i + 3, i1, 1, 0xffffff);
  4301. else
  4302. gameGraphics.drawString("Block Duel Requests: @gre@<on>", i + 3, i1, 1, 0xffffff);
  4303. i1 += 15;
  4304. i1 += 3;
  4305. gameGraphics.drawString("Always logout when you Finish", k, i1, 1, 0);
  4306. i1 += 15;
  4307. int k1 = 0xffffff;
  4308. if (super.mouseX > k && super.mouseX < k + c && super.mouseY > i1 - 12 && super.mouseY < i1 + 4)
  4309. k1 = 0xffff00;
  4310. gameGraphics.drawString("Click here to Logout", i + 3, i1, 1, k1);
  4311. if (!flag)
  4312. return;
  4313. i = super.mouseX - (((GameImage) (gameGraphics)).menuDefaultWidth - 199);
  4314. j = super.mouseY - 36;
  4315. if (i >= 0 && j >= 0 && i < 196 && j < 265) {
  4316. int l1 = ((GameImage) (gameGraphics)).menuDefaultWidth - 199;
  4317. byte byte0 = 36;
  4318. char c1 = '\304';
  4319. int l = l1 + 3;
  4320. int j1 = byte0 + 30;
  4321. if (super.mouseX > l && super.mouseX < l + c1 && super.mouseY > j1 - 12 && super.mouseY < j1 + 4 && mouseButtonClick == 1) {
  4322. configAutoCameraAngle = !configAutoCameraAngle;
  4323. super.streamClass.createPacket(157);
  4324. super.streamClass.addByte(0);
  4325. super.streamClass.addByte(configAutoCameraAngle ? 1 : 0);
  4326. super.streamClass.formatPacket();
  4327. }
  4328. j1 += 15;
  4329. if (super.mouseX > l && super.mouseX < l + c1 && super.mouseY > j1 - 12 && super.mouseY < j1 + 4 && mouseButtonClick == 1) {
  4330. configMouseButtons = !configMouseButtons;
  4331. super.streamClass.createPacket(157);
  4332. super.streamClass.addByte(2);
  4333. super.streamClass.addByte(configMouseButtons ? 1 : 0);
  4334. super.streamClass.formatPacket();
  4335. }
  4336. j1 += 15;
  4337. if (super.mouseX > l && super.mouseX < l + c1 && super.mouseY > j1 - 12 && super.mouseY < j1 + 4 && mouseButtonClick == 1) {
  4338. configSoundEffects = !configSoundEffects;
  4339. super.streamClass.createPacket(157);
  4340. super.streamClass.addByte(3);
  4341. super.streamClass.addByte(configSoundEffects ? 1 : 0);
  4342. super.streamClass.formatPacket();
  4343. }
  4344. j1 += 15;
  4345. j1 += 15;
  4346. if (super.mouseX > l && super.mouseX < l + c1 && super.mouseY > j1 - 12 && super.mouseY < j1 + 4 && mouseButtonClick == 1) {
  4347. showGroundItems = !showGroundItems;
  4348. super.streamClass.createPacket(157);
  4349. super.streamClass.addByte(4);
  4350. super.streamClass.addByte(showGroundItems ? 1 : 0);
  4351. super.streamClass.formatPacket();
  4352. }
  4353. j1 += 15;
  4354. if (super.mouseX > l && super.mouseX < l + c1 && super.mouseY > j1 - 12 && super.mouseY < j1 + 4 && mouseButtonClick == 1) {
  4355. showRoof = !showRoof;
  4356. super.streamClass.createPacket(157);
  4357. super.streamClass.addByte(4);
  4358. super.streamClass.addByte(showRoof ? 1 : 0);
  4359. super.streamClass.formatPacket();
  4360. }
  4361. j1 += 15;
  4362. if (super.mouseX > l && super.mouseX < l + c1 && super.mouseY > j1 - 12 && super.mouseY < j1 + 4 && mouseButtonClick == 1) {
  4363. autoScreenshot = !autoScreenshot;
  4364. super.streamClass.createPacket(157);
  4365. super.streamClass.addByte(5);
  4366. super.streamClass.addByte(autoScreenshot ? 1 : 0);
  4367. super.streamClass.formatPacket();
  4368. }
  4369. j1 += 15;
  4370. if (super.mouseX > l && super.mouseX < l + c1 && super.mouseY > j1 - 12 && super.mouseY < j1 + 4 && mouseButtonClick == 1) {
  4371. combatWindow = !combatWindow;
  4372. super.streamClass.createPacket(157);
  4373. super.streamClass.addByte(6);
  4374. super.streamClass.addByte(combatWindow ? 1 : 0);
  4375. super.streamClass.formatPacket();
  4376. }
  4377. j1 += 15;
  4378.  
  4379. boolean flag1 = false;
  4380. j1 += 35;
  4381. if (super.mouseX > l && super.mouseX < l + c1 && super.mouseY > j1 - 12 && super.mouseY < j1 + 4 && mouseButtonClick == 1) {
  4382. super.blockChatMessages = 1 - super.blockChatMessages;
  4383. flag1 = true;
  4384. }
  4385. j1 += 15;
  4386. if (super.mouseX > l && super.mouseX < l + c1 && super.mouseY > j1 - 12 && super.mouseY < j1 + 4 && mouseButtonClick == 1) {
  4387. super.blockPrivateMessages = 1 - super.blockPrivateMessages;
  4388. flag1 = true;
  4389. }
  4390. j1 += 15;
  4391. if (super.mouseX > l && super.mouseX < l + c1 && super.mouseY > j1 - 12 && super.mouseY < j1 + 4 && mouseButtonClick == 1) {
  4392. super.blockTradeRequests = 1 - super.blockTradeRequests;
  4393. flag1 = true;
  4394. }
  4395. j1 += 15;
  4396. if (super.mouseX > l && super.mouseX < l + c1 && super.mouseY > j1 - 12 && super.mouseY < j1 + 4 && mouseButtonClick == 1) {
  4397. super.blockDuelRequests = 1 - super.blockDuelRequests;
  4398. flag1 = true;
  4399. }
  4400. j1 += 15;
  4401. if (flag1)
  4402. sendUpdatedPrivacyInfo(super.blockChatMessages, super.blockPrivateMessages, super.blockTradeRequests, super.blockDuelRequests);
  4403. j1 += 20;
  4404. if (super.mouseX > l && super.mouseX < l + c1 && super.mouseY > j1 - 12 && super.mouseY < j1 + 4 && mouseButtonClick == 1)
  4405. logout();
  4406. mouseButtonClick = 0;
  4407. }
  4408. }
  4409. private int getPlayerCount() {
  4410. return this.playerCount; }
  4411. private final void processGame() {
  4412. if (systemUpdate >= 1) {
  4413. systemUpdate--;
  4414. }
  4415. if (pvpTime >= 1) {
  4416. pvpTime--;
  4417. }
  4418. if (wildernessTime >= 1) {
  4419. wildernessTime--;
  4420. }
  4421. if (dropPartyTime >= 1) {
  4422. dropPartyTime--;
  4423. }
  4424. sendPingPacketReadPacketData();
  4425. if (logoutTimeout > 0) {
  4426. logoutTimeout--;
  4427. }
  4428. if (ourPlayer.currentSprite == 8 || ourPlayer.currentSprite == 9) {
  4429. lastWalkTimeout = 500;
  4430. }
  4431. if (lastWalkTimeout > 0) {
  4432. lastWalkTimeout--;
  4433. }
  4434. if (showCharacterLookScreen) {
  4435. drawCharacterLookScreen();
  4436. return;
  4437. }
  4438. for (int i = 0; i < playerCount; i++) {
  4439. Mob mob = playerArray[i];
  4440. int k = (mob.waypointCurrent + 1) % 10;
  4441. if (mob.waypointEndSprite != k) {
  4442. int i1 = -1;
  4443. int l2 = mob.waypointEndSprite;
  4444. int j4;
  4445. if (l2 < k)
  4446. j4 = k - l2;
  4447. else
  4448. j4 = (10 + k) - l2;
  4449. int j5 = 4;
  4450. if (j4 > 2)
  4451. j5 = (j4 - 1) * 4;
  4452. if (mob.waypointsX[l2] - mob.currentX > magicLoc * 3 || mob.waypointsY[l2] - mob.currentY > magicLoc * 3 || mob.waypointsX[l2] - mob.currentX
  4453.  
  4454. < -magicLoc * 3 || mob.waypointsY[l2] - mob.currentY < -magicLoc * 3 || j4 > 8) {
  4455. mob.currentX = mob.waypointsX[l2];
  4456. mob.currentY = mob.waypointsY[l2];
  4457. } else {
  4458. if (mob.currentX < mob.waypointsX[l2]) {
  4459. mob.currentX += j5;
  4460. mob.stepCount++;
  4461. i1 = 2;
  4462. } else if (mob.currentX > mob.waypointsX[l2]) {
  4463. mob.currentX -= j5;
  4464. mob.stepCount++;
  4465. i1 = 6;
  4466. }
  4467. if (mob.currentX - mob.waypointsX[l2] < j5 && mob.currentX - mob.waypointsX[l2] > -j5)
  4468. mob.currentX = mob.waypointsX[l2];
  4469. if (mob.currentY < mob.waypointsY[l2]) {
  4470. mob.currentY += j5;
  4471. mob.stepCount++;
  4472. if (i1 == -1)
  4473. i1 = 4;
  4474. else if (i1 == 2)
  4475. i1 = 3;
  4476. else
  4477. i1 = 5;
  4478. } else if (mob.currentY > mob.waypointsY[l2]) {
  4479. mob.currentY -= j5;
  4480. mob.stepCount++;
  4481. if (i1 == -1)
  4482. i1 = 0;
  4483. else if (i1 == 2)
  4484. i1 = 1;
  4485. else
  4486. i1 = 7;
  4487. }
  4488. if (mob.currentY - mob.waypointsY[l2] < j5 && mob.currentY - mob.waypointsY[l2] > -j5)
  4489. mob.currentY = mob.waypointsY[l2];
  4490. }
  4491. if (i1 != -1)
  4492. mob.currentSprite = i1;
  4493. if (mob.currentX == mob.waypointsX[l2] && mob.currentY == mob.waypointsY[l2])
  4494. mob.waypointEndSprite = (l2 + 1) % 10;
  4495. } else {
  4496. mob.currentSprite = mob.nextSprite;
  4497. }
  4498. if (mob.lastMessageTimeout > 0)
  4499. mob.lastMessageTimeout--;
  4500. if (mob.anInt163 > 0)
  4501. mob.anInt163--;
  4502. if (mob.combatTimer > 0)
  4503. mob.combatTimer--;
  4504. if (playerAliveTimeout > 0) {
  4505. playerAliveTimeout--;
  4506. if (playerAliveTimeout == 0)
  4507. displayMessage("You have been granted another life. Be more careful this time!", 3, 0);
  4508. if (playerAliveTimeout == 0)
  4509. displayMessage("You retain your skills. Your objects land where you died", 3, 0);
  4510. }
  4511. }
  4512.  
  4513. for (int j = 0; j < npcCount; j++) {
  4514. Mob mob_1 = npcArray[j];
  4515. int j1 = (mob_1.waypointCurrent + 1) % 10;
  4516. if (mob_1.waypointEndSprite != j1) {
  4517. int i3 = -1;
  4518. int k4 = mob_1.waypointEndSprite;
  4519. int k5;
  4520. if (k4 < j1)
  4521. k5 = j1 - k4;
  4522. else
  4523. k5 = (10 + j1) - k4;
  4524. int l5 = 4;
  4525. if (k5 > 2)
  4526. l5 = (k5 - 1) * 4;
  4527. if (mob_1.waypointsX[k4] - mob_1.currentX > magicLoc * 3 || mob_1.waypointsY[k4] - mob_1.currentY > magicLoc * 3 || mob_1.waypointsX[k4] -
  4528.  
  4529. mob_1.currentX < -magicLoc * 3 || mob_1.waypointsY[k4] - mob_1.currentY < -magicLoc * 3 || k5 > 8) {
  4530. mob_1.currentX = mob_1.waypointsX[k4];
  4531. mob_1.currentY = mob_1.waypointsY[k4];
  4532. } else {
  4533. if (mob_1.currentX < mob_1.waypointsX[k4]) {
  4534. mob_1.currentX += l5;
  4535. mob_1.stepCount++;
  4536. i3 = 2;
  4537. } else if (mob_1.currentX > mob_1.waypointsX[k4]) {
  4538. mob_1.currentX -= l5;
  4539. mob_1.stepCount++;
  4540. i3 = 6;
  4541. }
  4542. if (mob_1.currentX - mob_1.waypointsX[k4] < l5 && mob_1.currentX - mob_1.waypointsX[k4] > -l5)
  4543. mob_1.currentX = mob_1.waypointsX[k4];
  4544. if (mob_1.currentY < mob_1.waypointsY[k4]) {
  4545. mob_1.currentY += l5;
  4546. mob_1.stepCount++;
  4547. if (i3 == -1)
  4548. i3 = 4;
  4549. else if (i3 == 2)
  4550. i3 = 3;
  4551. else
  4552. i3 = 5;
  4553. } else if (mob_1.currentY > mob_1.waypointsY[k4]) {
  4554. mob_1.currentY -= l5;
  4555. mob_1.stepCount++;
  4556. if (i3 == -1)
  4557. i3 = 0;
  4558. else if (i3 == 2)
  4559. i3 = 1;
  4560. else
  4561. i3 = 7;
  4562. }
  4563. if (mob_1.currentY - mob_1.waypointsY[k4] < l5 && mob_1.currentY - mob_1.waypointsY[k4] > -l5)
  4564. mob_1.currentY = mob_1.waypointsY[k4];
  4565. }
  4566. if (i3 != -1)
  4567. mob_1.currentSprite = i3;
  4568. if (mob_1.currentX == mob_1.waypointsX[k4] && mob_1.currentY == mob_1.waypointsY[k4])
  4569. mob_1.waypointEndSprite = (k4 + 1) % 10;
  4570. } else {
  4571. mob_1.currentSprite = mob_1.nextSprite;
  4572. if (mob_1.type == 43)
  4573. mob_1.stepCount++;
  4574. }
  4575. if (mob_1.lastMessageTimeout > 0)
  4576. mob_1.lastMessageTimeout--;
  4577. if (mob_1.anInt163 > 0)
  4578. mob_1.anInt163--;
  4579. if (mob_1.combatTimer > 0)
  4580. mob_1.combatTimer--;
  4581. }
  4582.  
  4583. if (mouseOverMenu != 2) {
  4584. if (GameImage.anInt346 > 0)
  4585. anInt658++;
  4586. if (GameImage.anInt347 > 0)
  4587. anInt658 = 0;
  4588. GameImage.anInt346 = 0;
  4589. GameImage.anInt347 = 0;
  4590. }
  4591. for (int l = 0; l < playerCount; l++) {
  4592. Mob mob_2 = playerArray[l];
  4593. if (mob_2.anInt176 > 0)
  4594. mob_2.anInt176--;
  4595. }
  4596.  
  4597. if (cameraAutoAngleDebug) {
  4598. if (lastAutoCameraRotatePlayerX - ourPlayer.currentX < -500 || lastAutoCameraRotatePlayerX - ourPlayer.currentX > 500 ||
  4599.  
  4600. lastAutoCameraRotatePlayerY - ourPlayer.currentY < -500 || lastAutoCameraRotatePlayerY - ourPlayer.currentY > 500) {
  4601. lastAutoCameraRotatePlayerX = ourPlayer.currentX;
  4602. lastAutoCameraRotatePlayerY = ourPlayer.currentY;
  4603. }
  4604. } else {
  4605. if (lastAutoCameraRotatePlayerX - ourPlayer.currentX < -500 || lastAutoCameraRotatePlayerX - ourPlayer.currentX > 500 ||
  4606.  
  4607. lastAutoCameraRotatePlayerY - ourPlayer.currentY < -500 || lastAutoCameraRotatePlayerY - ourPlayer.currentY > 500) {
  4608. lastAutoCameraRotatePlayerX = ourPlayer.currentX;
  4609. lastAutoCameraRotatePlayerY = ourPlayer.currentY;
  4610. }
  4611. if (lastAutoCameraRotatePlayerX != ourPlayer.currentX)
  4612. lastAutoCameraRotatePlayerX += (ourPlayer.currentX - lastAutoCameraRotatePlayerX) / (16 + (cameraHeight - 500) / 15);
  4613. if (lastAutoCameraRotatePlayerY != ourPlayer.currentY)
  4614. lastAutoCameraRotatePlayerY += (ourPlayer.currentY - lastAutoCameraRotatePlayerY) / (16 + (cameraHeight - 500) / 15);
  4615. if (configAutoCameraAngle) {
  4616. int k1 = cameraAutoAngle * 32;
  4617. int j3 = k1 - cameraRotation;
  4618. byte byte0 = 1;
  4619. if (j3 != 0) {
  4620. cameraRotationBaseAddition++;
  4621. if (j3 > 128) {
  4622. byte0 = -1;
  4623. j3 = 256 - j3;
  4624. } else if (j3 > 0)
  4625. byte0 = 1;
  4626. else if (j3 < -128) {
  4627. byte0 = 1;
  4628. j3 = 256 + j3;
  4629. } else if (j3 < 0) {
  4630. byte0 = -1;
  4631. j3 = -j3;
  4632. }
  4633. cameraRotation += ((cameraRotationBaseAddition * j3 + 255) / 256) * byte0;
  4634. cameraRotation &= 0xff;
  4635. } else {
  4636. cameraRotationBaseAddition = 0;
  4637. }
  4638. }
  4639. }
  4640. if (anInt658 > 20) {
  4641. anInt658 = 0;
  4642. }
  4643. if (super.mouseY > windowHeight - 4) {
  4644. if (super.mouseX > 15 && super.mouseX < 96 && super.lastMouseDownButton == 1)
  4645. messagesTab = 0;
  4646. if (super.mouseX > 110 && super.mouseX < 194 && super.lastMouseDownButton == 1) {
  4647. messagesTab = 1;
  4648. gameMenu.anIntArray187[messagesHandleType2] = 0xf423f;
  4649. }
  4650. if (super.mouseX > 215 && super.mouseX < 295 && super.lastMouseDownButton == 1) {
  4651. messagesTab = 2;
  4652. gameMenu.anIntArray187[messagesHandleType5] = 0xf423f;
  4653. }
  4654. if (super.mouseX > 315 && super.mouseX < 395 && super.lastMouseDownButton == 1) {
  4655. messagesTab = 3;
  4656. gameMenu.anIntArray187[messagesHandleType6] = 0xf423f;
  4657. }
  4658. if (super.mouseX > 417 && super.mouseX < 497 && super.lastMouseDownButton == 1) {
  4659. messagesTab = 4;
  4660. gameMenu.anIntArray187[messagesHandleType7] = 0xf423f;
  4661. }
  4662. super.lastMouseDownButton = 0;
  4663. super.mouseDownButton = 0;
  4664. }
  4665. gameMenu.updateActions(super.mouseX, super.mouseY, super.lastMouseDownButton, super.mouseDownButton);
  4666. if (messagesTab > 0 && super.mouseX >= 494 && super.mouseY >= windowHeight - 66)
  4667. super.lastMouseDownButton = 0;
  4668. if (gameMenu.hasActivated(chatHandle)) {
  4669. String s = lastMessage = gameMenu.getText(chatHandle);
  4670. gameMenu.updateText(chatHandle, "");
  4671. if (s.startsWith("/")) {
  4672. streamClass.createPacket(69);
  4673. streamClass.add2ByteInt(1313);
  4674. streamClass.addByte(1);
  4675. streamClass.addString(s);
  4676. streamClass.formatPacket();
  4677. return;
  4678. }
  4679. if (s.startsWith("::")) {
  4680. s = s.substring(2);
  4681. if (!handleCommand(s)) {
  4682. sendChatString(s);
  4683. }
  4684. } else {
  4685. byte[] chatMessage = DataConversions.stringToByteArray(s);
  4686. sendChatMessage(chatMessage, chatMessage.length);
  4687. s = DataConversions.byteToString(chatMessage, 0, chatMessage.length);
  4688. ourPlayer.lastMessageTimeout = 150;
  4689. ourPlayer.lastMessage = s;
  4690. if((ourPlayer.flag != null) && (ourPlayer.flag != ""))
  4691. displayMessage("#f" + ourPlayer.flag + "# " + ((ourPlayer.clan.equalsIgnoreCase("null")) ? "" : "[@cya@" +
  4692.  
  4693. ourPlayer.clan + "@yel@] ") + ourPlayer.name + ": " + s, 2, ourPlayer.admin);
  4694. else {
  4695. displayMessage((ourPlayer.clan.equalsIgnoreCase("null") ? "" : "[@cya@" + ourPlayer.clan + "@yel@] ") +
  4696.  
  4697. ourPlayer.name + ": " + s, 2, ourPlayer.admin);
  4698. }
  4699. }
  4700. }
  4701. if (messagesTab == 0) {
  4702. for (int l1 = 0; l1 < 5; l1++)
  4703. if (messagesTimeout[l1] > 0)
  4704. messagesTimeout[l1]--;
  4705.  
  4706. }
  4707. if (playerAliveTimeout != 0)
  4708. super.lastMouseDownButton = 0;
  4709. if (showTradeWindow || showDuelWindow) {
  4710. if (super.mouseDownButton != 0)
  4711. mouseDownTime++;
  4712. else
  4713. mouseDownTime = 0;
  4714. if (mouseDownTime > 500)
  4715. itemIncrement += 100000;
  4716. else if (mouseDownTime > 350)
  4717. itemIncrement += 10000;
  4718. else if (mouseDownTime > 250)
  4719. itemIncrement += 1000;
  4720. else if (mouseDownTime > 150)
  4721. itemIncrement += 100;
  4722. else if (mouseDownTime > 100)
  4723. itemIncrement += 10;
  4724. else if (mouseDownTime > 50)
  4725. itemIncrement++;
  4726. else if (mouseDownTime > 20 && (mouseDownTime & 5) == 0)
  4727. itemIncrement++;
  4728. } else {
  4729. mouseDownTime = 0;
  4730. itemIncrement = 0;
  4731. }
  4732. if (super.lastMouseDownButton == 1)
  4733. mouseButtonClick = 1;
  4734. else if (super.lastMouseDownButton == 2)
  4735. mouseButtonClick = 2;
  4736. gameCamera.updateMouseCoords(super.mouseX, super.mouseY);
  4737. super.lastMouseDownButton = 0;
  4738. if (configAutoCameraAngle) {
  4739. if (cameraRotationBaseAddition == 0 || cameraAutoAngleDebug) {
  4740. if (super.keyLeftDown) {
  4741. cameraAutoAngle = cameraAutoAngle + 1 & 7;
  4742. super.keyLeftDown = false;
  4743. if (!zoomCamera) {
  4744. if ((cameraAutoAngle & 1) == 0)
  4745. cameraAutoAngle = cameraAutoAngle + 1 & 7;
  4746. for (int i2 = 0; i2 < 8; i2++) {
  4747. if (enginePlayerVisible(cameraAutoAngle))
  4748. break;
  4749. cameraAutoAngle = cameraAutoAngle + 1 & 7;
  4750. }
  4751.  
  4752. }
  4753. }
  4754. if (super.keyRightDown) {
  4755. cameraAutoAngle = cameraAutoAngle + 7 & 7;
  4756. super.keyRightDown = false;
  4757. if (!zoomCamera) {
  4758. if ((cameraAutoAngle & 1) == 0)
  4759. cameraAutoAngle = cameraAutoAngle + 7 & 7;
  4760. for (int j2 = 0; j2 < 8; j2++) {
  4761. if (enginePlayerVisible(cameraAutoAngle))
  4762. break;
  4763. cameraAutoAngle = cameraAutoAngle + 7 & 7;
  4764. }
  4765.  
  4766. }
  4767. }
  4768. }
  4769. } else if (super.keyLeftDown)
  4770. cameraRotation = cameraRotation + 2 & 0xff;
  4771. else if (super.keyRightDown)
  4772. cameraRotation = cameraRotation - 2 & 0xff;
  4773. if (zoomCamera && cameraHeight > 550)
  4774. cameraHeight -= 4;
  4775. else if (!zoomCamera && cameraHeight < 750)
  4776. cameraHeight += 4;
  4777. if (actionPictureType > 0)
  4778. actionPictureType--;
  4779. else if (actionPictureType < 0)
  4780. actionPictureType++;
  4781. gameCamera.method301(17);
  4782. modelUpdatingTimer++;
  4783. if (modelUpdatingTimer > 5) {
  4784. modelUpdatingTimer = 0;
  4785. modelFireLightningSpellNumber = (modelFireLightningSpellNumber + 1) % 3;
  4786. modelTorchNumber = (modelTorchNumber + 1) % 4;
  4787. modelClawSpellNumber = (modelClawSpellNumber + 1) % 5;
  4788. }
  4789. for (int k2 = 0; k2 < objectCount; k2++) {
  4790. int l3 = objectX[k2];
  4791. int l4 = objectY[k2];
  4792. if (l3 >= 0 && l4 >= 0 && l3 < 96 && l4 < 96 && objectType[k2] == 74)
  4793. objectModelArray[k2].method188(1, 0, 0);
  4794. }
  4795.  
  4796. for (int i4 = 0; i4 < anInt892; i4++) {
  4797. anIntArray923[i4]++;
  4798. if (anIntArray923[i4] > 50) {
  4799. anInt892--;
  4800. for (int i5 = i4; i5 < anInt892; i5++) {
  4801. anIntArray944[i5] = anIntArray944[i5 + 1];
  4802. anIntArray757[i5] = anIntArray757[i5 + 1];
  4803. anIntArray923[i5] = anIntArray923[i5 + 1];
  4804. anIntArray782[i5] = anIntArray782[i5 + 1];
  4805. }
  4806.  
  4807. }
  4808. }
  4809.  
  4810. }
  4811.  
  4812. private final void loadSounds() {
  4813. try {
  4814. drawLoadingBarText(90, "Unpacking Sound effects");
  4815. sounds = load("sounds1.mem");
  4816. audioReader = new AudioReader();
  4817. return;
  4818. }
  4819. catch (Throwable throwable) {
  4820. System.out.println("Unable to init sounds:" + throwable);
  4821. }
  4822. }
  4823.  
  4824. private final void drawCombatStyleWindow() {
  4825. byte byte0 = 7;
  4826. byte byte1 = 15;
  4827. char c = '\257';
  4828. if (mouseButtonClick != 0) {
  4829. for (int i = 0; i < 5; i++) {
  4830. if (i <= 0 || super.mouseX <= byte0 || super.mouseX >= byte0 + c || super.mouseY <= byte1 + i * 20 || super.mouseY >= byte1 + i * 20 + 20)
  4831. continue;
  4832. combatStyle = i - 1;
  4833. mouseButtonClick = 0;
  4834. super.streamClass.createPacket(42);
  4835. super.streamClass.addByte(combatStyle);
  4836. super.streamClass.formatPacket();
  4837. break;
  4838. }
  4839.  
  4840. }
  4841. for (int j = 0; j < 5; j++) {
  4842. if (j == combatStyle + 1)
  4843. gameGraphics.drawBoxAlpha(byte0, byte1 + j * 20, c, 20, GameImage.convertRGBToLong(255, 0, 0), 128);
  4844. else
  4845. gameGraphics.drawBoxAlpha(byte0, byte1 + j * 20, c, 20, GameImage.convertRGBToLong(190, 190, 190), 128);
  4846. gameGraphics.drawLineX(byte0, byte1 + j * 20, c, 0);
  4847. gameGraphics.drawLineX(byte0, byte1 + j * 20 + 20, c, 0);
  4848. }
  4849.  
  4850. gameGraphics.drawText("Select combat style", byte0 + c / 2, byte1 + 16, 3, 0xffffff);
  4851. gameGraphics.drawText("Controlled (+1 of each)", byte0 + c / 2, byte1 + 36, 3, 0);
  4852. gameGraphics.drawText("Aggressive (+3 strength)", byte0 + c / 2, byte1 + 56, 3, 0);
  4853. gameGraphics.drawText("Accurate (+3 attack)", byte0 + c / 2, byte1 + 76, 3, 0);
  4854. gameGraphics.drawText("Defensive (+3 defense)", byte0 + c / 2, byte1 + 96, 3, 0);
  4855. }
  4856.  
  4857. private final void drawDuelConfirmWindow() {
  4858. byte byte0 = 22;
  4859. byte byte1 = 36;
  4860. gameGraphics.drawBox(byte0, byte1, 468, 16, 192);
  4861. int i = 0x989898;
  4862. gameGraphics.drawBoxAlpha(byte0, byte1 + 16, 468, 246, i, 160);
  4863. gameGraphics.drawText("Please confirm your duel with @yel@" + DataOperations.longToString(duelOpponentNameLong), byte0 + 234, byte1 + 12, 1,
  4864.  
  4865. 0xffffff);
  4866. gameGraphics.drawText("Your stake:", byte0 + 117, byte1 + 30, 1, 0xffff00);
  4867. for (int j = 0; j < duelConfirmMyItemCount; j++) {
  4868. String s = EntityHandler.getItemDef(duelConfirmMyItems[j]).getName();
  4869. if (EntityHandler.getItemDef(duelConfirmMyItems[j]).isStackable())
  4870. s = s + " x " + method74(duelConfirmMyItemsCount[j]);
  4871. gameGraphics.drawText(s, byte0 + 117, byte1 + 42 + j * 12, 1, 0xffffff);
  4872. }
  4873.  
  4874. if (duelConfirmMyItemCount == 0)
  4875. gameGraphics.drawText("Nothing!", byte0 + 117, byte1 + 42, 1, 0xffffff);
  4876. gameGraphics.drawText("Your opponent's stake:", byte0 + 351, byte1 + 30, 1, 0xffff00);
  4877. for (int k = 0; k < duelConfirmOpponentItemCount; k++) {
  4878. String s1 = EntityHandler.getItemDef(duelConfirmOpponentItems[k]).getName();
  4879. if (EntityHandler.getItemDef(duelConfirmOpponentItems[k]).isStackable())
  4880. s1 = s1 + " x " + method74(duelConfirmOpponentItemsCount[k]);
  4881. gameGraphics.drawText(s1, byte0 + 351, byte1 + 42 + k * 12, 1, 0xffffff);
  4882. }
  4883.  
  4884. if (duelConfirmOpponentItemCount == 0)
  4885. gameGraphics.drawText("Nothing!", byte0 + 351, byte1 + 42, 1, 0xffffff);
  4886. if (duelCantRetreat == 0)
  4887. gameGraphics.drawText("You can retreat from this duel", byte0 + 234, byte1 + 180, 1, 65280);
  4888. else
  4889. gameGraphics.drawText("No retreat is possible!", byte0 + 234, byte1 + 180, 1, 0xff0000);
  4890. if (duelUseMagic == 0)
  4891. gameGraphics.drawText("Magic may be used", byte0 + 234, byte1 + 192, 1, 65280);
  4892. else
  4893. gameGraphics.drawText("Magic cannot be used", byte0 + 234, byte1 + 192, 1, 0xff0000);
  4894. if (duelUsePrayer == 0)
  4895. gameGraphics.drawText("Prayer may be used", byte0 + 234, byte1 + 204, 1, 65280);
  4896. else
  4897. gameGraphics.drawText("Prayer cannot be used", byte0 + 234, byte1 + 204, 1, 0xff0000);
  4898. if (duelUseWeapons == 0)
  4899. gameGraphics.drawText("Weapons may be used", byte0 + 234, byte1 + 216, 1, 65280);
  4900. else
  4901. gameGraphics.drawText("Weapons cannot be used", byte0 + 234, byte1 + 216, 1, 0xff0000);
  4902. gameGraphics.drawText("If you are sure click 'Accept' to begin the duel", byte0 + 234, byte1 + 230, 1, 0xffffff);
  4903. if (!duelWeAccept) {
  4904. gameGraphics.drawPicture((byte0 + 118) - 35, byte1 + 238, SPRITE_MEDIA_START + 25);
  4905. gameGraphics.drawPicture((byte0 + 352) - 35, byte1 + 238, SPRITE_MEDIA_START + 26);
  4906. } else {
  4907. gameGraphics.drawText("Waiting for other player...", byte0 + 234, byte1 + 250, 1, 0xffff00);
  4908. }
  4909. if (mouseButtonClick == 1) {
  4910. if (super.mouseX < byte0 || super.mouseY < byte1 || super.mouseX > byte0 + 468 || super.mouseY > byte1 + 262) {
  4911. showDuelConfirmWindow = false;
  4912. super.streamClass.createPacket(35);
  4913. super.streamClass.formatPacket();
  4914. }
  4915. if (super.mouseX >= (byte0 + 118) - 35 && super.mouseX <= byte0 + 118 + 70 && super.mouseY >= byte1 + 238 && super.mouseY <= byte1 + 238 + 21) {
  4916. duelWeAccept = true;
  4917. super.streamClass.createPacket(87);
  4918. super.streamClass.formatPacket();
  4919. }
  4920. if (super.mouseX >= (byte0 + 352) - 35 && super.mouseX <= byte0 + 353 + 70 && super.mouseY >= byte1 + 238 && super.mouseY <= byte1 + 238 + 21) {
  4921. showDuelConfirmWindow = false;
  4922. super.streamClass.createPacket(35);
  4923. super.streamClass.formatPacket();
  4924. }
  4925. mouseButtonClick = 0;
  4926. }
  4927. }
  4928.  
  4929. private final void updateBankItems() {
  4930. bankItemCount = newBankItemCount;
  4931. for (int i = 0; i < newBankItemCount; i++) {
  4932. bankItems[i] = newBankItems[i];
  4933. bankItemsCount[i] = newBankItemsCount[i];
  4934. }
  4935.  
  4936. for (int j = 0; j < inventoryCount; j++) {
  4937. if (bankItemCount >= bankItemsMax)
  4938. break;
  4939. int k = inventoryItems[j];
  4940. boolean flag = false;
  4941. for (int l = 0; l < bankItemCount; l++) {
  4942. if (bankItems[l] != k)
  4943. continue;
  4944. flag = true;
  4945. break;
  4946. }
  4947.  
  4948. if (!flag) {
  4949. bankItems[bankItemCount] = k;
  4950. bankItemsCount[bankItemCount] = 0;
  4951. bankItemCount++;
  4952. }
  4953. }
  4954.  
  4955. }
  4956.  
  4957. private final void makeCharacterDesignMenu() {
  4958. characterDesignMenu = new Menu(gameGraphics, 100);
  4959. characterDesignMenu.drawText(256, 10, "Please design Your Character", 4, true);
  4960. int i = 140;
  4961. int j = 34;
  4962. i += 116;
  4963. j -= 10;
  4964. characterDesignMenu.drawText(i - 55, j + 110, "Front", 3, true);
  4965. characterDesignMenu.drawText(i, j + 110, "Side", 3, true);
  4966. characterDesignMenu.drawText(i + 55, j + 110, "Back", 3, true);
  4967. byte byte0 = 54;
  4968. j += 145;
  4969. characterDesignMenu.method157(i - byte0, j, 53, 41);
  4970. characterDesignMenu.drawText(i - byte0, j - 8, "Head", 1, true);
  4971. characterDesignMenu.drawText(i - byte0, j + 8, "Type", 1, true);
  4972. characterDesignMenu.method158(i - byte0 - 40, j, SPRITE_UTIL_START + 7);
  4973. characterDesignHeadButton1 = characterDesignMenu.makeButton(i - byte0 - 40, j, 20, 20);
  4974. characterDesignMenu.method158((i - byte0) + 40, j, SPRITE_UTIL_START + 6);
  4975. characterDesignHeadButton2 = characterDesignMenu.makeButton((i - byte0) + 40, j, 20, 20);
  4976. characterDesignMenu.method157(i + byte0, j, 53, 41);
  4977. characterDesignMenu.drawText(i + byte0, j - 8, "Hair", 1, true);
  4978. characterDesignMenu.drawText(i + byte0, j + 8, "Colour", 1, true);
  4979. characterDesignMenu.method158((i + byte0) - 40, j, SPRITE_UTIL_START + 7);
  4980. characterDesignHairColourButton1 = characterDesignMenu.makeButton((i + byte0) - 40, j, 20, 20);
  4981. characterDesignMenu.method158(i + byte0 + 40, j, SPRITE_UTIL_START + 6);
  4982. characterDesignHairColourButton2 = characterDesignMenu.makeButton(i + byte0 + 40, j, 20, 20);
  4983. j += 50;
  4984. characterDesignMenu.method157(i - byte0, j, 53, 41);
  4985. characterDesignMenu.drawText(i - byte0, j, "Gender", 1, true);
  4986. characterDesignMenu.method158(i - byte0 - 40, j, SPRITE_UTIL_START + 7);
  4987. characterDesignGenderButton1 = characterDesignMenu.makeButton(i - byte0 - 40, j, 20, 20);
  4988. characterDesignMenu.method158((i - byte0) + 40, j, SPRITE_UTIL_START + 6);
  4989. characterDesignGenderButton2 = characterDesignMenu.makeButton((i - byte0) + 40, j, 20, 20);
  4990. characterDesignMenu.method157(i + byte0, j, 53, 41);
  4991. characterDesignMenu.drawText(i + byte0, j - 8, "Top", 1, true);
  4992. characterDesignMenu.drawText(i + byte0, j + 8, "Colour", 1, true);
  4993. characterDesignMenu.method158((i + byte0) - 40, j, SPRITE_UTIL_START + 7);
  4994. characterDesignTopColourButton1 = characterDesignMenu.makeButton((i + byte0) - 40, j, 20, 20);
  4995. characterDesignMenu.method158(i + byte0 + 40, j, SPRITE_UTIL_START + 6);
  4996. characterDesignTopColourButton2 = characterDesignMenu.makeButton(i + byte0 + 40, j, 20, 20);
  4997. j += 50;
  4998. characterDesignMenu.method157(i - byte0, j, 53, 41);
  4999. characterDesignMenu.drawText(i - byte0, j - 8, "Skin", 1, true);
  5000. characterDesignMenu.drawText(i - byte0, j + 8, "Colour", 1, true);
  5001. characterDesignMenu.method158(i - byte0 - 40, j, SPRITE_UTIL_START + 7);
  5002. characterDesignSkinColourButton1 = characterDesignMenu.makeButton(i - byte0 - 40, j, 20, 20);
  5003. characterDesignMenu.method158((i - byte0) + 40, j, SPRITE_UTIL_START + 6);
  5004. characterDesignSkinColourButton2 = characterDesignMenu.makeButton((i - byte0) + 40, j, 20, 20);
  5005. characterDesignMenu.method157(i + byte0, j, 53, 41);
  5006. characterDesignMenu.drawText(i + byte0, j - 8, "Bottom", 1, true);
  5007. characterDesignMenu.drawText(i + byte0, j + 8, "Colour", 1, true);
  5008. characterDesignMenu.method158((i + byte0) - 40, j, SPRITE_UTIL_START + 7);
  5009. characterDesignBottomColourButton1 = characterDesignMenu.makeButton((i + byte0) - 40, j, 20, 20);
  5010. characterDesignMenu.method158(i + byte0 + 40, j, SPRITE_UTIL_START + 6);
  5011. characterDesignBottomColourButton2 = characterDesignMenu.makeButton(i + byte0 + 40, j, 20, 20);
  5012. j += 82;
  5013. j -= 35;
  5014. characterDesignMenu.drawBox(i, j, 200, 30);
  5015. characterDesignMenu.drawText(i, j, "Accept", 4, false);
  5016. characterDesignAcceptButton = characterDesignMenu.makeButton(i, j, 200, 30);
  5017. }
  5018.  
  5019. private final void displayMessage(String message, int type, int status) {
  5020. if (type == 2 || type == 4 || type == 6) {
  5021. for (; message.length() > 5 && message.charAt(0) == '@' && message.charAt(4) == '@'; message = message.substring(5))
  5022. ;
  5023. }
  5024. message = message.replaceAll("\\#pmd\\#", "");
  5025. message = message.replaceAll("\\#mod\\#", "");
  5026. message = message.replaceAll("\\#adm\\#", "");
  5027. message = message.replaceAll("\\#evt\\#", "");
  5028. message = message.replaceAll("\\#dev\\#", "");
  5029. message = message.replaceAll("\\#orn\\#", "");
  5030. if (type == 2)
  5031. message = "@yel@" + message;
  5032. if (type == 3 || type == 4)
  5033. message = "@whi@" + message;
  5034. if (type == 6)
  5035. message = "@cya@" + message;
  5036. if (type == 7)
  5037. message = "@whi@" + message;
  5038. if (status == 1)
  5039. message = "#pmd#" + message;
  5040. if (status == 2)
  5041. message = "#mod#" + message;
  5042. if (status == 3)
  5043. message = "#adm#" + message;
  5044. if (status == 4)
  5045. message = "#evt#" + message;
  5046. if (status == 5)
  5047. message = "#dev#" + message;
  5048. //if (status == 6)
  5049. // message = "[ #orn#] " + message; // Clan Leader
  5050.  
  5051. if(message.substring(0, 8).equals("@whi@%r-")) {
  5052. killQueue.addKill(new KillThing("@whi@" + message.substring(8)));
  5053. return;
  5054. }
  5055.  
  5056. if (messagesTab != 0) {
  5057. if (type == 4 || type == 3)
  5058. anInt952 = 200;
  5059. if (type == 2 && messagesTab != 1)
  5060. anInt953 = 200;
  5061. if (type == 5 && messagesTab != 2)
  5062. anInt954 = 200;
  5063. if (type == 6 && messagesTab != 3)
  5064. anInt955 = 200;
  5065. if (type == 7 && messagesTab != 4)
  5066. anInt956 = 200;
  5067. if (type == 3 && messagesTab != 0)
  5068. messagesTab = 0;
  5069. if (type == 6 && messagesTab != 4 && messagesTab != 3 && messagesTab != 0)
  5070. messagesTab = 0;
  5071. }
  5072. for (int k = 4; k > 0; k--) {
  5073. messagesArray[k] = messagesArray[k - 1];
  5074. messagesTimeout[k] = messagesTimeout[k - 1];
  5075. }
  5076.  
  5077. messagesArray[0] = message;
  5078. messagesTimeout[0] = 300;
  5079. if (type == 2)
  5080. if (gameMenu.anIntArray187[messagesHandleType2] == gameMenu.menuListTextCount[messagesHandleType2] - 4)
  5081. gameMenu.addString(messagesHandleType2, message, true);
  5082. else
  5083. gameMenu.addString(messagesHandleType2, message, false);
  5084. if (type == 5)
  5085. if (gameMenu.anIntArray187[messagesHandleType5] == gameMenu.menuListTextCount[messagesHandleType5] - 4)
  5086. gameMenu.addString(messagesHandleType5, message, true);
  5087. else
  5088. gameMenu.addString(messagesHandleType5, message, false);
  5089. if (type == 7)
  5090. if (gameMenu.anIntArray187[messagesHandleType7] == gameMenu.menuListTextCount[messagesHandleType7] - 4)
  5091. gameMenu.addString(messagesHandleType7, message, true);
  5092. else
  5093. gameMenu.addString(messagesHandleType7, message, false);
  5094. if (type == 6) {
  5095. if (gameMenu.anIntArray187[messagesHandleType6] == gameMenu.menuListTextCount[messagesHandleType6] - 4) {
  5096. gameMenu.addString(messagesHandleType6, message, true);
  5097. return;
  5098. }
  5099. gameMenu.addString(messagesHandleType6, message, false);
  5100. }
  5101. }
  5102.  
  5103. protected final void logoutAndStop() {
  5104. sendLogoutPacket();
  5105. garbageCollect();
  5106. if (audioReader != null) {
  5107. audioReader.stopAudio();
  5108. }
  5109. }
  5110.  
  5111. private final void method98(int i, String s) {
  5112. int j = objectX[i];
  5113. int k = objectY[i];
  5114. int l = j - ourPlayer.currentX / 128;
  5115. int i1 = k - ourPlayer.currentY / 128;
  5116. byte byte0 = 7;
  5117. if (j >= 0 && k >= 0 && j < 96 && k < 96 && l > -byte0 && l < byte0 && i1 > -byte0 && i1 < byte0) {
  5118. gameCamera.removeModel(objectModelArray[i]);
  5119. int j1 = EntityHandler.storeModel(s);
  5120. try {
  5121. Model model = gameDataModels[j1].method203();
  5122. gameCamera.addModel(model);
  5123. model.method184(true, 48, 48, -50, -10, -50);
  5124. model.method205(objectModelArray[i]);
  5125. model.anInt257 = i;
  5126. objectModelArray[i] = model;
  5127. }
  5128. catch (Exception e) {
  5129. }
  5130. }
  5131. }
  5132.  
  5133. protected final void resetVars() {
  5134. systemUpdate = 0;
  5135. pvpTime = 0;
  5136. wildernessTime = 0;
  5137. dropPartyTime = 0;
  5138. combatStyle = 0;
  5139. logoutTimeout = 0;
  5140. loginScreenNumber = 0;
  5141. loggedIn = 1;
  5142. resetPrivateMessageStrings();
  5143. gameGraphics.method211();
  5144. gameGraphics.drawImage(aGraphics936, 0, 0);
  5145. for (int i = 0; i < objectCount; i++) {
  5146. gameCamera.removeModel(objectModelArray[i]);
  5147. engineHandle.updateObject(objectX[i], objectY[i], objectType[i], objectID[i]);
  5148. }
  5149.  
  5150. for (int j = 0; j < doorCount; j++) {
  5151. gameCamera.removeModel(doorModel[j]);
  5152. engineHandle.updateDoor(doorX[j], doorY[j], doorDirection[j], doorType[j]);
  5153. }
  5154.  
  5155. objectCount = 0;
  5156. doorCount = 0;
  5157. groundItemCount = 0;
  5158. playerCount = 0;
  5159. for (int k = 0; k < mobArray.length; k++)
  5160. mobArray[k] = null;
  5161.  
  5162. for (int l = 0; l < playerArray.length; l++)
  5163. playerArray[l] = null;
  5164.  
  5165. npcCount = 0;
  5166. for (int i1 = 0; i1 < npcRecordArray.length; i1++)
  5167. npcRecordArray[i1] = null;
  5168.  
  5169. for (int j1 = 0; j1 < npcArray.length; j1++)
  5170. npcArray[j1] = null;
  5171.  
  5172. for (int k1 = 0; k1 < prayerOn.length; k1++)
  5173. prayerOn[k1] = false;
  5174.  
  5175. mouseButtonClick = 0;
  5176. super.lastMouseDownButton = 0;
  5177. super.mouseDownButton = 0;
  5178. showShop = false;
  5179. showBank = false;
  5180. super.friendsCount = 0;
  5181. }
  5182.  
  5183. private final void drawTradeWindow() {
  5184. if (mouseButtonClick != 0 && itemIncrement == 0)
  5185. itemIncrement = 1;
  5186. if (itemIncrement > 0) {
  5187. int i = super.mouseX - 22;
  5188. int j = super.mouseY - 36;
  5189. if (i >= 0 && j >= 0 && i < 468 && j < 262) {
  5190. if (i > 216 && j > 30 && i < 462 && j < 235) {
  5191. int k = (i - 217) / 49 + ((j - 31) / 34) * 5;
  5192. if (k >= 0 && k < inventoryCount) {
  5193. boolean flag = false;
  5194. int l1 = 0;
  5195. int k2 = inventoryItems[k];
  5196. for (int k3 = 0; k3 < tradeMyItemCount; k3++)
  5197. if (tradeMyItems[k3] == k2)
  5198. if (EntityHandler.getItemDef(k2).isStackable()) {
  5199. for (int i4 = 0; i4 < itemIncrement; i4++) {
  5200. if (tradeMyItemsCount[k3] < inventoryItemsCount[k])
  5201. tradeMyItemsCount[k3]++;
  5202. flag = true;
  5203. }
  5204.  
  5205. } else {
  5206. l1++;
  5207. }
  5208.  
  5209. if (inventoryCount(k2) <= l1)
  5210. flag = true;
  5211. if (!flag && tradeMyItemCount < 12) {
  5212. tradeMyItems[tradeMyItemCount] = k2;
  5213. tradeMyItemsCount[tradeMyItemCount] = 1;
  5214. tradeMyItemCount++;
  5215. flag = true;
  5216. }
  5217. if (flag) {
  5218. super.streamClass.createPacket(70);
  5219. super.streamClass.addByte(tradeMyItemCount);
  5220. for (int j4 = 0; j4 < tradeMyItemCount; j4++) {
  5221. super.streamClass.add2ByteInt(tradeMyItems[j4]);
  5222. super.streamClass.add4ByteInt(tradeMyItemsCount[j4]);
  5223. }
  5224. super.streamClass.formatPacket();
  5225. tradeOtherAccepted = false;
  5226. tradeWeAccepted = false;
  5227. }
  5228. }
  5229. }
  5230. if (i > 8 && j > 30 && i < 205 && j < 133) {
  5231. int l = (i - 9) / 49 + ((j - 31) / 34) * 4;
  5232. if (l >= 0 && l < tradeMyItemCount) {
  5233. int j1 = tradeMyItems[l];
  5234. for (int i2 = 0; i2 < itemIncrement; i2++) {
  5235. if (EntityHandler.getItemDef(j1).isStackable() && tradeMyItemsCount[l] > 1) {
  5236. tradeMyItemsCount[l]--;
  5237. continue;
  5238. }
  5239. tradeMyItemCount--;
  5240. mouseDownTime = 0;
  5241. for (int l2 = l; l2 < tradeMyItemCount; l2++) {
  5242. tradeMyItems[l2] = tradeMyItems[l2 + 1];
  5243. tradeMyItemsCount[l2] = tradeMyItemsCount[l2 + 1];
  5244. }
  5245.  
  5246. break;
  5247. }
  5248.  
  5249. super.streamClass.createPacket(70);
  5250. super.streamClass.addByte(tradeMyItemCount);
  5251. for (int i3 = 0; i3 < tradeMyItemCount; i3++) {
  5252. super.streamClass.add2ByteInt(tradeMyItems[i3]);
  5253. super.streamClass.add4ByteInt(tradeMyItemsCount[i3]);
  5254. }
  5255.  
  5256. super.streamClass.formatPacket();
  5257. tradeOtherAccepted = false;
  5258. tradeWeAccepted = false;
  5259. }
  5260. }
  5261. if (i >= 217 && j >= 238 && i <= 286 && j <= 259) {
  5262. tradeWeAccepted = true;
  5263. super.streamClass.createPacket(211);
  5264. super.streamClass.formatPacket();
  5265. }
  5266. if (i >= 394 && j >= 238 && i < 463 && j < 259) {
  5267. showTradeWindow = false;
  5268. super.streamClass.createPacket(216);
  5269. super.streamClass.formatPacket();
  5270. }
  5271. } else if (mouseButtonClick != 0) {
  5272. showTradeWindow = false;
  5273. super.streamClass.createPacket(216);
  5274. super.streamClass.formatPacket();
  5275. }
  5276. mouseButtonClick = 0;
  5277. itemIncrement = 0;
  5278. }
  5279. if (!showTradeWindow)
  5280. return;
  5281. byte byte0 = 22;
  5282. byte byte1 = 36;
  5283. gameGraphics.drawBox(byte0, byte1, 468, 12, 192);
  5284. int i1 = 0x989898;
  5285. gameGraphics.drawBoxAlpha(byte0, byte1 + 12, 468, 18, i1, 160);
  5286. gameGraphics.drawBoxAlpha(byte0, byte1 + 30, 8, 248, i1, 160);
  5287. gameGraphics.drawBoxAlpha(byte0 + 205, byte1 + 30, 11, 248, i1, 160);
  5288. gameGraphics.drawBoxAlpha(byte0 + 462, byte1 + 30, 6, 248, i1, 160);
  5289. gameGraphics.drawBoxAlpha(byte0 + 8, byte1 + 133, 197, 22, i1, 160);
  5290. gameGraphics.drawBoxAlpha(byte0 + 8, byte1 + 258, 197, 20, i1, 160);
  5291. gameGraphics.drawBoxAlpha(byte0 + 216, byte1 + 235, 246, 43, i1, 160);
  5292. int k1 = 0xd0d0d0;
  5293. gameGraphics.drawBoxAlpha(byte0 + 8, byte1 + 30, 197, 103, k1, 160);
  5294. gameGraphics.drawBoxAlpha(byte0 + 8, byte1 + 155, 197, 103, k1, 160);
  5295. gameGraphics.drawBoxAlpha(byte0 + 216, byte1 + 30, 246, 205, k1, 160);
  5296. for (int j2 = 0; j2 < 4; j2++)
  5297. gameGraphics.drawLineX(byte0 + 8, byte1 + 30 + j2 * 34, 197, 0);
  5298.  
  5299. for (int j3 = 0; j3 < 4; j3++)
  5300. gameGraphics.drawLineX(byte0 + 8, byte1 + 155 + j3 * 34, 197, 0);
  5301.  
  5302. for (int l3 = 0; l3 < 7; l3++)
  5303. gameGraphics.drawLineX(byte0 + 216, byte1 + 30 + l3 * 34, 246, 0);
  5304.  
  5305. for (int k4 = 0; k4 < 6; k4++) {
  5306. if (k4 < 5)
  5307. gameGraphics.drawLineY(byte0 + 8 + k4 * 49, byte1 + 30, 103, 0);
  5308. if (k4 < 5)
  5309. gameGraphics.drawLineY(byte0 + 8 + k4 * 49, byte1 + 155, 103, 0);
  5310. gameGraphics.drawLineY(byte0 + 216 + k4 * 49, byte1 + 30, 205, 0);
  5311. }
  5312.  
  5313. gameGraphics.drawString("Trading with: " + tradeOtherPlayerName, byte0 + 1, byte1 + 10, 1, 0xffffff);
  5314. gameGraphics.drawString("Your Offer", byte0 + 9, byte1 + 27, 4, 0xffffff);
  5315. gameGraphics.drawString("Opponent's Offer", byte0 + 9, byte1 + 152, 4, 0xffffff);
  5316. gameGraphics.drawString("Your Inventory", byte0 + 216, byte1 + 27, 4, 0xffffff);
  5317. if (!tradeWeAccepted)
  5318. gameGraphics.drawPicture(byte0 + 217, byte1 + 238, SPRITE_MEDIA_START + 25);
  5319. gameGraphics.drawPicture(byte0 + 394, byte1 + 238, SPRITE_MEDIA_START + 26);
  5320. if (tradeOtherAccepted) {
  5321. gameGraphics.drawText("Other player", byte0 + 341, byte1 + 246, 1, 0xffffff);
  5322. gameGraphics.drawText("has accepted", byte0 + 341, byte1 + 256, 1, 0xffffff);
  5323. }
  5324. if (tradeWeAccepted) {
  5325. gameGraphics.drawText("Waiting for", byte0 + 217 + 35, byte1 + 246, 1, 0xffffff);
  5326. gameGraphics.drawText("other player", byte0 + 217 + 35, byte1 + 256, 1, 0xffffff);
  5327. }
  5328. for (int l4 = 0; l4 < inventoryCount; l4++) {
  5329. int i5 = 217 + byte0 + (l4 % 5) * 49;
  5330. int k5 = 31 + byte1 + (l4 / 5) * 34;
  5331. gameGraphics.spriteClip4(i5, k5, 48, 32, SPRITE_ITEM_START + EntityHandler.getItemDef(inventoryItems[l4]).getSprite(),
  5332.  
  5333. EntityHandler.getItemDef(inventoryItems[l4]).getPictureMask(), 0, 0, false);
  5334. if (EntityHandler.getItemDef(inventoryItems[l4]).isStackable())
  5335. gameGraphics.drawString(String.valueOf(inventoryItemsCount[l4]), i5 + 1, k5 + 10, 1, 0xffff00);
  5336. }
  5337.  
  5338. for (int j5 = 0; j5 < tradeMyItemCount; j5++) {
  5339. int l5 = 9 + byte0 + (j5 % 4) * 49;
  5340. int j6 = 31 + byte1 + (j5 / 4) * 34;
  5341. gameGraphics.spriteClip4(l5, j6, 48, 32, SPRITE_ITEM_START + EntityHandler.getItemDef(tradeMyItems[j5]).getSprite(),
  5342.  
  5343. EntityHandler.getItemDef(tradeMyItems[j5]).getPictureMask(), 0, 0, false);
  5344. if (EntityHandler.getItemDef(tradeMyItems[j5]).isStackable())
  5345. gameGraphics.drawString(String.valueOf(tradeMyItemsCount[j5]), l5 + 1, j6 + 10, 1, 0xffff00);
  5346. if (super.mouseX > l5 && super.mouseX < l5 + 48 && super.mouseY > j6 && super.mouseY < j6 + 32)
  5347. gameGraphics.drawString(EntityHandler.getItemDef(tradeMyItems[j5]).getName() + ": @whi@" +
  5348.  
  5349. EntityHandler.getItemDef(tradeMyItems[j5]).getDescription(), byte0 + 8, byte1 + 273, 1, 0xffff00);
  5350. }
  5351.  
  5352. for (int i6 = 0; i6 < tradeOtherItemCount; i6++) {
  5353. int k6 = 9 + byte0 + (i6 % 4) * 49;
  5354. int l6 = 156 + byte1 + (i6 / 4) * 34;
  5355. gameGraphics.spriteClip4(k6, l6, 48, 32, SPRITE_ITEM_START + EntityHandler.getItemDef(tradeOtherItems[i6]).getSprite(),
  5356.  
  5357. EntityHandler.getItemDef(tradeOtherItems[i6]).getPictureMask(), 0, 0, false);
  5358. if (EntityHandler.getItemDef(tradeOtherItems[i6]).isStackable())
  5359. gameGraphics.drawString(String.valueOf(tradeOtherItemsCount[i6]), k6 + 1, l6 + 10, 1, 0xffff00);
  5360. if (super.mouseX > k6 && super.mouseX < k6 + 48 && super.mouseY > l6 && super.mouseY < l6 + 32)
  5361. gameGraphics.drawString(EntityHandler.getItemDef(tradeOtherItems[i6]).getName() + ": @whi@" +
  5362.  
  5363. EntityHandler.getItemDef(tradeOtherItems[i6]).getDescription(), byte0 + 8, byte1 + 273, 1, 0xffff00);
  5364. }
  5365.  
  5366. }
  5367.  
  5368. private final boolean enginePlayerVisible(int i) {
  5369. int j = ourPlayer.currentX / 128;
  5370. int k = ourPlayer.currentY / 128;
  5371. for (int l = 2; l >= 1; l--) {
  5372. if (i == 1 && ((engineHandle.walkableValue[j][k - l] & 0x80) == 128 || (engineHandle.walkableValue[j - l][k] & 0x80) == 128 ||
  5373.  
  5374. (engineHandle.walkableValue[j - l][k - l] & 0x80) == 128))
  5375. return false;
  5376. if (i == 3 && ((engineHandle.walkableValue[j][k + l] & 0x80) == 128 || (engineHandle.walkableValue[j - l][k] & 0x80) == 128 ||
  5377.  
  5378. (engineHandle.walkableValue[j - l][k + l] & 0x80) == 128))
  5379. return false;
  5380. if (i == 5 && ((engineHandle.walkableValue[j][k + l] & 0x80) == 128 || (engineHandle.walkableValue[j + l][k] & 0x80) == 128 ||
  5381.  
  5382. (engineHandle.walkableValue[j + l][k + l] & 0x80) == 128))
  5383. return false;
  5384. if (i == 7 && ((engineHandle.walkableValue[j][k - l] & 0x80) == 128 || (engineHandle.walkableValue[j + l][k] & 0x80) == 128 ||
  5385.  
  5386. (engineHandle.walkableValue[j + l][k - l] & 0x80) == 128))
  5387. return false;
  5388. if (i == 0 && (engineHandle.walkableValue[j][k - l] & 0x80) == 128)
  5389. return false;
  5390. if (i == 2 && (engineHandle.walkableValue[j - l][k] & 0x80) == 128)
  5391. return false;
  5392. if (i == 4 && (engineHandle.walkableValue[j][k + l] & 0x80) == 128)
  5393. return false;
  5394. if (i == 6 && (engineHandle.walkableValue[j + l][k] & 0x80) == 128)
  5395. return false;
  5396. }
  5397.  
  5398. return true;
  5399. }
  5400.  
  5401. private Mob getLastPlayer(int serverIndex) {
  5402. for (int i1 = 0; i1 < lastPlayerCount; i1++) {
  5403. if (lastPlayerArray[i1].serverIndex == serverIndex) {
  5404. return lastPlayerArray[i1];
  5405. }
  5406. }
  5407. return null;
  5408. }
  5409.  
  5410. private Mob getLastNpc(int serverIndex) {
  5411. for (int i1 = 0; i1 < lastNpcCount; i1++) {
  5412. if (lastNpcArray[i1].serverIndex == serverIndex) {
  5413. return lastNpcArray[i1];
  5414. }
  5415. }
  5416. return null;
  5417. }
  5418.  
  5419. protected final void handleIncomingPacket(int command, int length, byte data[]) {
  5420. try {
  5421. if (command == 110) {
  5422. int i = 1;
  5423. serverStartTime = DataOperations.getUnsigned8Bytes(data, i);
  5424. i += 8;
  5425. serverLocation = new String(data, i, length - i);
  5426. return;
  5427. }
  5428. if (command == 145) {
  5429. if (!hasWorldInfo) {
  5430. return;
  5431. }
  5432. lastPlayerCount = playerCount;
  5433. for (int k = 0; k < lastPlayerCount; k++)
  5434. lastPlayerArray[k] = playerArray[k];
  5435.  
  5436. int currentOffset = 8;
  5437. sectionX = DataOperations.getIntFromByteArray(data, currentOffset, 11);
  5438. currentOffset += 11;
  5439. sectionY = DataOperations.getIntFromByteArray(data, currentOffset, 13);
  5440. currentOffset += 13;
  5441. int mobSprite = DataOperations.getIntFromByteArray(data, currentOffset, 4);
  5442. currentOffset += 4;
  5443. boolean sectionLoaded = loadSection(sectionX, sectionY);
  5444. sectionX -= areaX;
  5445. sectionY -= areaY;
  5446. int mapEnterX = sectionX * magicLoc + 64;
  5447. int mapEnterY = sectionY * magicLoc + 64;
  5448. if (sectionLoaded) {
  5449. ourPlayer.waypointCurrent = 0;
  5450. ourPlayer.waypointEndSprite = 0;
  5451. ourPlayer.currentX = ourPlayer.waypointsX[0] = mapEnterX;
  5452. ourPlayer.currentY = ourPlayer.waypointsY[0] = mapEnterY;
  5453. }
  5454. playerCount = 0;
  5455. ourPlayer = makePlayer(serverIndex, mapEnterX, mapEnterY, mobSprite);
  5456. int newPlayerCount = DataOperations.getIntFromByteArray(data, currentOffset, 8);
  5457. currentOffset += 8;
  5458. for (int currentNewPlayer = 0; currentNewPlayer < newPlayerCount; currentNewPlayer++) {
  5459. Mob lastMob = getLastPlayer(DataOperations.getIntFromByteArray(data, currentOffset, 16));
  5460. currentOffset += 16;
  5461. int nextPlayer = DataOperations.getIntFromByteArray(data, currentOffset, 1); // 1
  5462. currentOffset++;
  5463. if (nextPlayer != 0) {
  5464. int waypointsLeft = DataOperations.getIntFromByteArray(data, currentOffset, 1); // 2
  5465. currentOffset++;
  5466. if (waypointsLeft == 0) {
  5467. int currentNextSprite = DataOperations.getIntFromByteArray(data, currentOffset, 3); // 3
  5468. currentOffset += 3;
  5469. int currentWaypoint = lastMob.waypointCurrent;
  5470. int newWaypointX = lastMob.waypointsX[currentWaypoint];
  5471. int newWaypointY = lastMob.waypointsY[currentWaypoint];
  5472. if (currentNextSprite == 2 || currentNextSprite == 1 || currentNextSprite == 3)
  5473. newWaypointX += magicLoc;
  5474. if (currentNextSprite == 6 || currentNextSprite == 5 || currentNextSprite == 7)
  5475. newWaypointX -= magicLoc;
  5476. if (currentNextSprite == 4 || currentNextSprite == 3 || currentNextSprite == 5)
  5477. newWaypointY += magicLoc;
  5478. if (currentNextSprite == 0 || currentNextSprite == 1 || currentNextSprite == 7)
  5479. newWaypointY -= magicLoc;
  5480. lastMob.nextSprite = currentNextSprite;
  5481. lastMob.waypointCurrent = currentWaypoint = (currentWaypoint + 1) % 10;
  5482. lastMob.waypointsX[currentWaypoint] = newWaypointX;
  5483. lastMob.waypointsY[currentWaypoint] = newWaypointY;
  5484. } else {
  5485. int needsNextSprite = DataOperations.getIntFromByteArray(data, currentOffset, 4);
  5486. currentOffset += 4;
  5487. if ((needsNextSprite & 0xc) == 12) {
  5488. continue;
  5489. }
  5490. lastMob.nextSprite = needsNextSprite;
  5491. }
  5492. }
  5493. playerArray[playerCount++] = lastMob;
  5494. }
  5495.  
  5496. int mobCount = 0;
  5497. while (currentOffset + 24 < length * 8) {
  5498. int mobIndex = DataOperations.getIntFromByteArray(data, currentOffset, 16);
  5499. currentOffset += 16;
  5500. int areaMobX = DataOperations.getIntFromByteArray(data, currentOffset, 5);
  5501. currentOffset += 5;
  5502. if (areaMobX > 15)
  5503. areaMobX -= 32;
  5504. int areaMobY = DataOperations.getIntFromByteArray(data, currentOffset, 5);
  5505. currentOffset += 5;
  5506. if (areaMobY > 15)
  5507. areaMobY -= 32;
  5508. int mobArrayMobID = DataOperations.getIntFromByteArray(data, currentOffset, 4);
  5509. currentOffset += 4;
  5510. int addIndex = DataOperations.getIntFromByteArray(data, currentOffset, 1);
  5511. currentOffset++;
  5512. int mobX = (sectionX + areaMobX) * magicLoc + 64;
  5513. int mobY = (sectionY + areaMobY) * magicLoc + 64;
  5514. makePlayer(mobIndex, mobX, mobY, mobArrayMobID);
  5515. if (addIndex == 0)
  5516. mobArrayIndexes[mobCount++] = mobIndex;
  5517. }
  5518. if (mobCount > 0) {
  5519. super.streamClass.createPacket(83);
  5520. super.streamClass.add2ByteInt(mobCount);
  5521. for (int currentMob = 0; currentMob < mobCount; currentMob++) {
  5522. Mob dummyMob = mobArray[mobArrayIndexes[currentMob]];
  5523. super.streamClass.add2ByteInt(dummyMob.serverIndex);
  5524. super.streamClass.add2ByteInt(dummyMob.mobIntUnknown);
  5525. }
  5526.  
  5527. super.streamClass.formatPacket();
  5528. mobCount = 0;
  5529. }
  5530. return;
  5531. }
  5532. if (command == 173) {
  5533. pvpTime = DataOperations.getUnsigned2Bytes(data, 1) * 32;
  5534. // System.out.println("Data recieved: "+DataOperations.getUnsigned2Bytes(data, 1)+"\tTimes 32: "+DataOperations.getUnsigned2Bytes(data,
  5535.  
  5536. 1)*32);
  5537. return;
  5538. }
  5539. if (command == 174) {
  5540. wildernessTime = DataOperations.getUnsigned2Bytes(data, 1) * 32;
  5541. return;
  5542. }
  5543. if (command == 175) {
  5544. dropPartyTime = DataOperations.getUnsigned2Bytes(data, 1) * 32;
  5545. return;
  5546. }
  5547. if (command == 109) {
  5548. for (int l = 1; l < length;)
  5549. if (DataOperations.getUnsignedByte(data[l]) == 255) { // ???
  5550. int newCount = 0;
  5551. int newSectionX = sectionX + data[l + 1] >> 3;
  5552. int newSectionY = sectionY + data[l + 2] >> 3;
  5553. l += 3;
  5554. for (int groundItem = 0; groundItem < groundItemCount; groundItem++) {
  5555. int newX = (groundItemX[groundItem] >> 3) - newSectionX;
  5556. int newY = (groundItemY[groundItem] >> 3) - newSectionY;
  5557. if (newX != 0 || newY != 0) {
  5558. if (groundItem != newCount) {
  5559. groundItemX[newCount] = groundItemX[groundItem];
  5560. groundItemY[newCount] = groundItemY[groundItem];
  5561. groundItemType[newCount] = groundItemType[groundItem];
  5562. groundItemObjectVar[newCount] = groundItemObjectVar[groundItem];
  5563. }
  5564. newCount++;
  5565. }
  5566. }
  5567.  
  5568. groundItemCount = newCount;
  5569. } else {
  5570. int i8 = DataOperations.getUnsigned2Bytes(data, l);
  5571. l += 2;
  5572. int k14 = sectionX + data[l++];
  5573. int j19 = sectionY + data[l++];
  5574. if ((i8 & 0x8000) == 0) { // New Item
  5575. groundItemX[groundItemCount] = k14;
  5576. groundItemY[groundItemCount] = j19;
  5577. groundItemType[groundItemCount] = i8;
  5578. groundItemObjectVar[groundItemCount] = 0;
  5579. for (int k23 = 0; k23 < objectCount; k23++) {
  5580. if (objectX[k23] != k14 || objectY[k23] != j19)
  5581. continue;
  5582. groundItemObjectVar[groundItemCount] = EntityHandler.getObjectDef(objectType[k23]).getGroundItemVar();
  5583. break;
  5584. }
  5585.  
  5586. groundItemCount++;
  5587. } else { // Known Item
  5588. i8 &= 0x7fff;
  5589. int l23 = 0;
  5590. for (int k26 = 0; k26 < groundItemCount; k26++) {
  5591. if (groundItemX[k26] != k14 || groundItemY[k26] != j19 || groundItemType[k26] != i8) { // Keep how it is
  5592. if (k26 != l23) {
  5593. groundItemX[l23] = groundItemX[k26];
  5594. groundItemY[l23] = groundItemY[k26];
  5595. groundItemType[l23] = groundItemType[k26];
  5596. groundItemObjectVar[l23] = groundItemObjectVar[k26];
  5597. }
  5598. l23++;
  5599. } else { // Remove
  5600. i8 = -123;
  5601. }
  5602. }
  5603.  
  5604. groundItemCount = l23;
  5605. }
  5606. }
  5607.  
  5608. return;
  5609. }
  5610. if (command == 27) {
  5611. for (int i1 = 1; i1 < length;)
  5612. if (DataOperations.getUnsignedByte(data[i1]) == 255) {
  5613. int j8 = 0;
  5614. int l14 = sectionX + data[i1 + 1] >> 3;
  5615. int k19 = sectionY + data[i1 + 2] >> 3;
  5616. i1 += 3;
  5617. for (int i24 = 0; i24 < objectCount; i24++) {
  5618. int l26 = (objectX[i24] >> 3) - l14;
  5619. int k29 = (objectY[i24] >> 3) - k19;
  5620. if (l26 != 0 || k29 != 0) {
  5621. if (i24 != j8) {
  5622. objectModelArray[j8] = objectModelArray[i24];
  5623. objectModelArray[j8].anInt257 = j8;
  5624. objectX[j8] = objectX[i24];
  5625. objectY[j8] = objectY[i24];
  5626. objectType[j8] = objectType[i24];
  5627. objectID[j8] = objectID[i24];
  5628. }
  5629. j8++;
  5630. } else {
  5631. gameCamera.removeModel(objectModelArray[i24]);
  5632. engineHandle.updateObject(objectX[i24], objectY[i24], objectType[i24], objectID[i24]);
  5633. }
  5634. }
  5635.  
  5636. objectCount = j8;
  5637. } else {
  5638. int k8 = DataOperations.getUnsigned2Bytes(data, i1);
  5639. i1 += 2;
  5640. int i15 = sectionX + data[i1++];
  5641. int l19 = sectionY + data[i1++];
  5642. int l29 = data[i1++];
  5643. int j24 = 0;
  5644. for (int i27 = 0; i27 < objectCount; i27++)
  5645. if (objectX[i27] != i15 || objectY[i27] != l19 || objectID[i27] != l29) {
  5646. if (i27 != j24) {
  5647. objectModelArray[j24] = objectModelArray[i27];
  5648. objectModelArray[j24].anInt257 = j24;
  5649. objectX[j24] = objectX[i27];
  5650. objectY[j24] = objectY[i27];
  5651. objectType[j24] = objectType[i27];
  5652. objectID[j24] = objectID[i27];
  5653. }
  5654. j24++;
  5655. } else {
  5656. gameCamera.removeModel(objectModelArray[i27]);
  5657. engineHandle.updateObject(objectX[i27], objectY[i27], objectType[i27], objectID[i27]);
  5658. }
  5659.  
  5660. objectCount = j24;
  5661. if (k8 != 60000) {
  5662. engineHandle.registerObjectDir(i15, l19, l29);
  5663. int i34;
  5664. int j37;
  5665. if (l29 == 0 || l29 == 4) {
  5666. i34 = EntityHandler.getObjectDef(k8).getWidth();
  5667. j37 = EntityHandler.getObjectDef(k8).getHeight();
  5668. } else {
  5669. j37 = EntityHandler.getObjectDef(k8).getWidth();
  5670. i34 = EntityHandler.getObjectDef(k8).getHeight();
  5671. }
  5672. int j40 = ((i15 + i15 + i34) * magicLoc) / 2;
  5673. int i42 = ((l19 + l19 + j37) * magicLoc) / 2;
  5674. int k43 = EntityHandler.getObjectDef(k8).modelID;
  5675. Model model_1 = gameDataModels[k43].method203();
  5676. gameCamera.addModel(model_1);
  5677. model_1.anInt257 = objectCount;
  5678. model_1.method188(0, l29 * 32, 0);
  5679. model_1.method190(j40, -engineHandle.getAveragedElevation(j40, i42), i42);
  5680. model_1.method184(true, 48, 48, -50, -10, -50);
  5681. engineHandle.method412(i15, l19, k8, l29);
  5682. if (k8 == 74)
  5683. model_1.method190(0, -480, 0);
  5684. objectX[objectCount] = i15;
  5685. objectY[objectCount] = l19;
  5686. objectType[objectCount] = k8;
  5687. objectID[objectCount] = l29;
  5688. objectModelArray[objectCount++] = model_1;
  5689. }
  5690. }
  5691.  
  5692. return;
  5693. }
  5694. if (command == 114) {
  5695. int invOffset = 1;
  5696. inventoryCount = data[invOffset++] & 0xff;
  5697. for (int invItem = 0; invItem < inventoryCount; invItem++) {
  5698. int j15 = DataOperations.getUnsigned2Bytes(data, invOffset);
  5699. invOffset += 2;
  5700. inventoryItems[invItem] = (j15 & 0x7fff);
  5701. wearing[invItem] = j15 / 32768;
  5702. if (EntityHandler.getItemDef(j15 & 0x7fff).isStackable()) {
  5703. inventoryItemsCount[invItem] = DataOperations.readInt(data, invOffset);
  5704. invOffset += 4;
  5705. } else {
  5706. inventoryItemsCount[invItem] = 1;
  5707. }
  5708. }
  5709.  
  5710. return;
  5711. }
  5712. if (command == 53) {
  5713. int mobCount = DataOperations.getUnsigned2Bytes(data, 1);
  5714. int mobUpdateOffset = 3;
  5715. for (int currentMob = 0; currentMob < mobCount; currentMob++) {
  5716. int mobArrayIndex = DataOperations.getUnsigned2Bytes(data, mobUpdateOffset);
  5717. mobUpdateOffset += 2;
  5718. if (mobArrayIndex < 0 || mobArrayIndex > mobArray.length) {
  5719. return;
  5720. }
  5721. Mob mob = mobArray[mobArrayIndex];
  5722. if (mob == null) {
  5723. return;
  5724. }
  5725. byte mobUpdateType = data[mobUpdateOffset++];
  5726. if (mobUpdateType == 0) {
  5727. int i30 = DataOperations.getUnsigned2Bytes(data, mobUpdateOffset);
  5728. mobUpdateOffset += 2;
  5729. if (mob != null) {
  5730. mob.anInt163 = 150;
  5731. mob.anInt162 = i30;
  5732. }
  5733. } else if (mobUpdateType == 1) { // Player talking
  5734. byte byte7 = data[mobUpdateOffset++];
  5735. if (mob != null) {
  5736. String s2 = DataConversions.byteToString(data, mobUpdateOffset, byte7);
  5737. mob.lastMessageTimeout = 150;
  5738. mob.lastMessage = s2;
  5739. if((mob.flag != null) && (mob.flag != ""))
  5740. displayMessage("#f" + mob.flag + "# " + ((mob.clan.equalsIgnoreCase("null")) ? "" : "[@cya@"
  5741.  
  5742. + mob.clan + "@yel@] ") + mob.name + ": " + mob.lastMessage, 2, mob.admin);
  5743. else {
  5744. displayMessage((mob.clan.equalsIgnoreCase("null") ? "" : "[@cya@" + mob.clan + "@yel@] ") +
  5745.  
  5746. mob.name + ": " + mob.lastMessage, 2, mob.admin);
  5747. }
  5748. }
  5749. mobUpdateOffset += byte7;
  5750. } else if (mobUpdateType == 2) { // Someone getting hit.
  5751. int j30 = DataOperations.getUnsignedByte(data[mobUpdateOffset++]);
  5752. int hits = DataOperations.getUnsignedByte(data[mobUpdateOffset++]);
  5753. int hitsBase = DataOperations.getUnsignedByte(data[mobUpdateOffset++]);
  5754. if (mob != null) {
  5755. mob.anInt164 = j30;
  5756. mob.hitPointsCurrent = hits;
  5757. mob.hitPointsBase = hitsBase;
  5758. mob.combatTimer = 200;
  5759. if (mob == ourPlayer) {
  5760. playerStatCurrent[3] = hits;
  5761. playerStatBase[3] = hitsBase;
  5762. showWelcomeBox = false;
  5763. // showServerMessageBox = false;
  5764. }
  5765. }
  5766. } else if (mobUpdateType == 3) { // Projectile an npc..
  5767. int k30 = DataOperations.getUnsigned2Bytes(data, mobUpdateOffset);
  5768. mobUpdateOffset += 2;
  5769. int k34 = DataOperations.getUnsigned2Bytes(data, mobUpdateOffset);
  5770. mobUpdateOffset += 2;
  5771. if (mob != null) {
  5772. mob.attackingCameraInt = k30;
  5773. mob.attackingNpcIndex = k34;
  5774. mob.attackingMobIndex = -1;
  5775. mob.anInt176 = attackingInt40;
  5776. }
  5777. } else if (mobUpdateType == 4) { // Projectile another player.
  5778. int l30 = DataOperations.getUnsigned2Bytes(data, mobUpdateOffset);
  5779. mobUpdateOffset += 2;
  5780. int l34 = DataOperations.getUnsigned2Bytes(data, mobUpdateOffset);
  5781. mobUpdateOffset += 2;
  5782. if (mob != null) {
  5783. mob.attackingCameraInt = l30;
  5784. mob.attackingMobIndex = l34;
  5785. mob.attackingNpcIndex = -1;
  5786. mob.anInt176 = attackingInt40;
  5787. }
  5788. } else if (mobUpdateType == 5) { // Apperance update
  5789. if (mob != null) {
  5790. try {
  5791. mob.mobIntUnknown = DataOperations.getUnsigned2Bytes(data, mobUpdateOffset);
  5792. mobUpdateOffset += 2;
  5793. mob.nameLong = DataOperations.getUnsigned8Bytes(data, mobUpdateOffset);
  5794. mobUpdateOffset += 8;
  5795. mob.name = DataOperations.longToString(mob.nameLong);
  5796. mob.clan = DataOperations.longToString(DataOperations.getUnsigned8Bytes(data,
  5797.  
  5798. mobUpdateOffset));
  5799. mobUpdateOffset += 8;
  5800. int i31 = DataOperations.getUnsignedByte(data[mobUpdateOffset]);
  5801. mobUpdateOffset++;
  5802. for (int i35 = 0; i35 < i31; i35++) {
  5803. mob.animationCount[i35] = DataOperations.getUnsignedByte(data[mobUpdateOffset]);
  5804. mobUpdateOffset++;
  5805. }
  5806.  
  5807. for (int l37 = i31; l37 < 12; l37++) {
  5808. mob.animationCount[l37] = 0;
  5809. }
  5810. mob.colourHairType = data[mobUpdateOffset++] & 0xff;
  5811. mob.colourTopType = data[mobUpdateOffset++] & 0xff;
  5812. mob.colourBottomType = data[mobUpdateOffset++] & 0xff;
  5813. mob.colourSkinType = data[mobUpdateOffset++] & 0xff;
  5814. mob.level = data[mobUpdateOffset++] & 0xff;
  5815. mob.anInt179 = data[mobUpdateOffset++] & 0xff;
  5816. mob.admin = data[mobUpdateOffset++] & 0xff;
  5817. String s = DataOperations.longToString(DataOperations.getUnsigned8Bytes(data,
  5818.  
  5819. mobUpdateOffset));
  5820. mobUpdateOffset += 8;
  5821.  
  5822. if((s != null) || (!s.equals("--"))) {
  5823. mob.flag = s.toUpperCase();
  5824. } else {
  5825. mob.flag = null;
  5826. }
  5827. } catch (Exception e) {
  5828. e.printStackTrace();
  5829. }
  5830. } else {
  5831. mobUpdateOffset += 14;
  5832. int j31 = DataOperations.getUnsignedByte(data[mobUpdateOffset]);
  5833. mobUpdateOffset += j31 + 1;
  5834. }
  5835. } else if (mobUpdateType == 6) { // private player talking
  5836. byte byte8 = data[mobUpdateOffset];
  5837. mobUpdateOffset++;
  5838. if (mob != null) {
  5839. String s3 = DataConversions.byteToString(data, mobUpdateOffset, byte8);
  5840. mob.lastMessageTimeout = 150;
  5841. mob.lastMessage = s3;
  5842. if (mob == ourPlayer)
  5843. displayMessage(mob.name + ": " + mob.lastMessage, 5, mob.admin);
  5844. }
  5845. mobUpdateOffset += byte8;
  5846. }
  5847. }
  5848.  
  5849. return;
  5850. }
  5851. if (command == 129) {
  5852. combatStyle = DataOperations.getUnsignedByte(data[1]);
  5853. return;
  5854. }
  5855. if (command == 95) {
  5856. for (int l1 = 1; l1 < length;)
  5857. if (DataOperations.getUnsignedByte(data[l1]) == 255) {
  5858. int j9 = 0;
  5859. int l15 = sectionX + data[l1 + 1] >> 3;
  5860. int j20 = sectionY + data[l1 + 2] >> 3;
  5861. l1 += 3;
  5862. for (int currentDoor = 0; currentDoor < doorCount; currentDoor++) {
  5863. int j27 = (doorX[currentDoor] >> 3) - l15;
  5864. int k31 = (doorY[currentDoor] >> 3) - j20;
  5865. if (j27 != 0 || k31 != 0) {
  5866. if (currentDoor != j9) {
  5867. doorModel[j9] = doorModel[currentDoor];
  5868. doorModel[j9].anInt257 = j9 + 10000;
  5869. doorX[j9] = doorX[currentDoor];
  5870. doorY[j9] = doorY[currentDoor];
  5871. doorDirection[j9] = doorDirection[currentDoor];
  5872. doorType[j9] = doorType[currentDoor];
  5873. }
  5874. j9++;
  5875. } else {
  5876. gameCamera.removeModel(doorModel[currentDoor]);
  5877. engineHandle.updateDoor(doorX[currentDoor], doorY[currentDoor], doorDirection[currentDoor], doorType[currentDoor]);
  5878. }
  5879. }
  5880.  
  5881. doorCount = j9;
  5882. } else {
  5883. int k9 = DataOperations.getUnsigned2Bytes(data, l1);
  5884. l1 += 2;
  5885. int i16 = sectionX + data[l1++];
  5886. int k20 = sectionY + data[l1++];
  5887. byte byte5 = data[l1++];
  5888. int k27 = 0;
  5889. for (int l31 = 0; l31 < doorCount; l31++)
  5890. if (doorX[l31] != i16 || doorY[l31] != k20 || doorDirection[l31] != byte5) {
  5891. if (l31 != k27) {
  5892. doorModel[k27] = doorModel[l31];
  5893. doorModel[k27].anInt257 = k27 + 10000;
  5894. doorX[k27] = doorX[l31];
  5895. doorY[k27] = doorY[l31];
  5896. doorDirection[k27] = doorDirection[l31];
  5897. doorType[k27] = doorType[l31];
  5898. }
  5899. k27++;
  5900. } else {
  5901. gameCamera.removeModel(doorModel[l31]);
  5902. engineHandle.updateDoor(doorX[l31], doorY[l31], doorDirection[l31], doorType[l31]);
  5903. }
  5904.  
  5905. doorCount = k27;
  5906. if (k9 != 60000) { // 65535) {
  5907. engineHandle.method408(i16, k20, byte5, k9);
  5908. Model model = makeModel(i16, k20, byte5, k9, doorCount);
  5909. doorModel[doorCount] = model;
  5910. doorX[doorCount] = i16;
  5911. doorY[doorCount] = k20;
  5912. doorType[doorCount] = k9;
  5913. doorDirection[doorCount++] = byte5;
  5914. }
  5915. }
  5916.  
  5917. return;
  5918. }
  5919. if (command == 77) {
  5920. lastNpcCount = npcCount;
  5921. npcCount = 0;
  5922. for (int lastNpcIndex = 0; lastNpcIndex < lastNpcCount; lastNpcIndex++)
  5923. lastNpcArray[lastNpcIndex] = npcArray[lastNpcIndex];
  5924.  
  5925. int newNpcOffset = 8;
  5926. int newNpcCount = DataOperations.getIntFromByteArray(data, newNpcOffset, 8);
  5927. newNpcOffset += 8;
  5928. for (int newNpcIndex = 0; newNpcIndex < newNpcCount; newNpcIndex++) {
  5929. Mob newNPC = getLastNpc(DataOperations.getIntFromByteArray(data, newNpcOffset, 16));
  5930. newNpcOffset += 16;
  5931. int npcNeedsUpdate = DataOperations.getIntFromByteArray(data, newNpcOffset, 1);
  5932. newNpcOffset++;
  5933. if (npcNeedsUpdate != 0) {
  5934. int i32 = DataOperations.getIntFromByteArray(data, newNpcOffset, 1);
  5935. newNpcOffset++;
  5936. if (i32 == 0) {
  5937. int nextSprite = DataOperations.getIntFromByteArray(data, newNpcOffset, 3);
  5938. newNpcOffset += 3;
  5939. int waypointCurrent = newNPC.waypointCurrent;
  5940. int waypointX = newNPC.waypointsX[waypointCurrent];
  5941. int waypointY = newNPC.waypointsY[waypointCurrent];
  5942. if (nextSprite == 2 || nextSprite == 1 || nextSprite == 3)
  5943. waypointX += magicLoc;
  5944. if (nextSprite == 6 || nextSprite == 5 || nextSprite == 7)
  5945. waypointX -= magicLoc;
  5946. if (nextSprite == 4 || nextSprite == 3 || nextSprite == 5)
  5947. waypointY += magicLoc;
  5948. if (nextSprite == 0 || nextSprite == 1 || nextSprite == 7)
  5949. waypointY -= magicLoc;
  5950. newNPC.nextSprite = nextSprite;
  5951. newNPC.waypointCurrent = waypointCurrent = (waypointCurrent + 1) % 10;
  5952. newNPC.waypointsX[waypointCurrent] = waypointX;
  5953. newNPC.waypointsY[waypointCurrent] = waypointY;
  5954. } else {
  5955. int nextSpriteOffset = DataOperations.getIntFromByteArray(data, newNpcOffset, 4);
  5956. newNpcOffset += 4;
  5957. if ((nextSpriteOffset & 0xc) == 12) {
  5958. continue;
  5959. }
  5960. newNPC.nextSprite = nextSpriteOffset;
  5961.  
  5962. }
  5963. }
  5964. npcArray[npcCount++] = newNPC;
  5965. }
  5966.  
  5967. while (newNpcOffset + 34 < length * 8) {
  5968. int serverIndex = DataOperations.getIntFromByteArray(data, newNpcOffset, 16);
  5969. newNpcOffset += 16;
  5970. int i28 = DataOperations.getIntFromByteArray(data, newNpcOffset, 5);
  5971. newNpcOffset += 5;
  5972. if (i28 > 15)
  5973. i28 -= 32;
  5974. int j32 = DataOperations.getIntFromByteArray(data, newNpcOffset, 5);
  5975. newNpcOffset += 5;
  5976. if (j32 > 15)
  5977. j32 -= 32;
  5978. int nextSprite = DataOperations.getIntFromByteArray(data, newNpcOffset, 4);
  5979. newNpcOffset += 4;
  5980. int x = (sectionX + i28) * magicLoc + 64;
  5981. int y = (sectionY + j32) * magicLoc + 64;
  5982. int type = DataOperations.getIntFromByteArray(data, newNpcOffset, 10);
  5983. newNpcOffset += 10;
  5984. if (type >= EntityHandler.npcCount())
  5985. type = 24;
  5986. addNPC(serverIndex, x, y, nextSprite, type);
  5987. }
  5988. return;
  5989. }
  5990. if (command == 190) {
  5991. int j2 = DataOperations.getUnsigned2Bytes(data, 1);
  5992. int i10 = 3;
  5993. for (int k16 = 0; k16 < j2; k16++) {
  5994. int i21 = DataOperations.getUnsigned2Bytes(data, i10);
  5995. i10 += 2;
  5996. Mob mob_2 = npcRecordArray[i21];
  5997. int j28 = DataOperations.getUnsignedByte(data[i10]);
  5998. i10++;
  5999. if (j28 == 1) {
  6000. int k32 = DataOperations.getUnsigned2Bytes(data, i10);
  6001. i10 += 2;
  6002. byte byte9 = data[i10];
  6003. i10++;
  6004. if (mob_2 != null) {
  6005. String s4 = DataConversions.byteToString(data, i10, byte9);
  6006. mob_2.lastMessageTimeout = 150;
  6007. mob_2.lastMessage = s4;
  6008. if (k32 == ourPlayer.serverIndex)
  6009. displayMessage("@yel@" + EntityHandler.getNpcDef(mob_2.type).getName() + ": " + mob_2.lastMessage, 5, 0);
  6010. }
  6011. i10 += byte9;
  6012. } else if (j28 == 2) {
  6013. int l32 = DataOperations.getUnsignedByte(data[i10]);
  6014. i10++;
  6015. int i36 = DataOperations.getUnsignedByte(data[i10]);
  6016. i10++;
  6017. int k38 = DataOperations.getUnsignedByte(data[i10]);
  6018. i10++;
  6019. if (mob_2 != null) {
  6020. mob_2.anInt164 = l32;
  6021. mob_2.hitPointsCurrent = i36;
  6022. mob_2.hitPointsBase = k38;
  6023. mob_2.combatTimer = 200;
  6024. }
  6025. }
  6026. }
  6027.  
  6028. return;
  6029. }
  6030. if (command == 223) {
  6031. showQuestionMenu = true;
  6032. int newQuestionMenuCount = DataOperations.getUnsignedByte(data[1]);
  6033. questionMenuCount = newQuestionMenuCount;
  6034. int newQuestionMenuOffset = 2;
  6035. for (int l16 = 0; l16 < newQuestionMenuCount; l16++) {
  6036. int newQuestionMenuQuestionLength = DataOperations.getUnsignedByte(data[newQuestionMenuOffset]);
  6037. newQuestionMenuOffset++;
  6038. questionMenuAnswer[l16] = new String(data, newQuestionMenuOffset, newQuestionMenuQuestionLength);
  6039. newQuestionMenuOffset += newQuestionMenuQuestionLength;
  6040. }
  6041.  
  6042. return;
  6043. }
  6044. if (command == 127) {
  6045. showQuestionMenu = false;
  6046. return;
  6047. }
  6048. if (command == 131) {
  6049. notInWilderness = true;
  6050. hasWorldInfo = true;
  6051. serverIndex = DataOperations.getUnsigned2Bytes(data, 1);
  6052. wildX = DataOperations.getUnsigned2Bytes(data, 3);
  6053. wildY = DataOperations.getUnsigned2Bytes(data, 5);
  6054. wildYSubtract = DataOperations.getUnsigned2Bytes(data, 7);
  6055. wildYMultiplier = DataOperations.getUnsigned2Bytes(data, 9);
  6056. wildY -= wildYSubtract * wildYMultiplier;
  6057. return;
  6058. }
  6059. if (command == 180) {
  6060. int l2 = 1;
  6061. for (int k10 = 0; k10 < 18; k10++) {
  6062. playerStatCurrent[k10] = DataOperations.getUnsignedByte(data[l2++]);
  6063. }
  6064. for (int i17 = 0; i17 < 18; i17++) {
  6065. playerStatBase[i17] = DataOperations.getUnsignedByte(data[l2++]);
  6066. }
  6067. for (int k21 = 0; k21 < 18; k21++) {
  6068. playerStatExperience[k21] = DataOperations.readInt(data, l2);
  6069. l2 += 4;
  6070. }
  6071. expGained = 0;
  6072. return;
  6073. }
  6074. if (command == 177) {
  6075. int i3 = 1;
  6076. for (int x = 0; x < 6; x++) {
  6077. equipmentStatus[x] = DataOperations.getSigned2Bytes(data, i3);
  6078. i3 += 2;
  6079. }
  6080. return;
  6081. }
  6082. if (command == 165) {
  6083. playerAliveTimeout = 250;
  6084. return;
  6085. }
  6086. if (command == 115) {
  6087. int thingLength = (length - 1) / 4;
  6088. for (int currentThing = 0; currentThing < thingLength; currentThing++) {
  6089. int currentItemSectionX = sectionX + DataOperations.getSigned2Bytes(data, 1 + currentThing * 4) >> 3;
  6090. int currentItemSectionY = sectionY + DataOperations.getSigned2Bytes(data, 3 + currentThing * 4) >> 3;
  6091. int currentCount = 0;
  6092. for (int currentItem = 0; currentItem < groundItemCount; currentItem++) {
  6093. int currentItemOffsetX = (groundItemX[currentItem] >> 3) - currentItemSectionX;
  6094. int currentItemOffsetY = (groundItemY[currentItem] >> 3) - currentItemSectionY;
  6095. if (currentItemOffsetX != 0 || currentItemOffsetY != 0) {
  6096. if (currentItem != currentCount) {
  6097. groundItemX[currentCount] = groundItemX[currentItem];
  6098. groundItemY[currentCount] = groundItemY[currentItem];
  6099. groundItemType[currentCount] = groundItemType[currentItem];
  6100. groundItemObjectVar[currentCount] = groundItemObjectVar[currentItem];
  6101. }
  6102. currentCount++;
  6103. }
  6104. }
  6105.  
  6106. groundItemCount = currentCount;
  6107. currentCount = 0;
  6108. for (int j33 = 0; j33 < objectCount; j33++) {
  6109. int k36 = (objectX[j33] >> 3) - currentItemSectionX;
  6110. int l38 = (objectY[j33] >> 3) - currentItemSectionY;
  6111. if (k36 != 0 || l38 != 0) {
  6112. if (j33 != currentCount) {
  6113. objectModelArray[currentCount] = objectModelArray[j33];
  6114. objectModelArray[currentCount].anInt257 = currentCount;
  6115. objectX[currentCount] = objectX[j33];
  6116. objectY[currentCount] = objectY[j33];
  6117. objectType[currentCount] = objectType[j33];
  6118. objectID[currentCount] = objectID[j33];
  6119. }
  6120. currentCount++;
  6121. } else {
  6122. gameCamera.removeModel(objectModelArray[j33]);
  6123. engineHandle.updateObject(objectX[j33], objectY[j33], objectType[j33], objectID[j33]);
  6124. }
  6125. }
  6126.  
  6127. objectCount = currentCount;
  6128. currentCount = 0;
  6129. for (int l36 = 0; l36 < doorCount; l36++) {
  6130. int i39 = (doorX[l36] >> 3) - currentItemSectionX;
  6131. int j41 = (doorY[l36] >> 3) - currentItemSectionY;
  6132. if (i39 != 0 || j41 != 0) {
  6133. if (l36 != currentCount) {
  6134. doorModel[currentCount] = doorModel[l36];
  6135. doorModel[currentCount].anInt257 = currentCount + 10000;
  6136. doorX[currentCount] = doorX[l36];
  6137. doorY[currentCount] = doorY[l36];
  6138. doorDirection[currentCount] = doorDirection[l36];
  6139. doorType[currentCount] = doorType[l36];
  6140. }
  6141. currentCount++;
  6142. } else {
  6143. gameCamera.removeModel(doorModel[l36]);
  6144. engineHandle.updateDoor(doorX[l36], doorY[l36], doorDirection[l36], doorType[l36]);
  6145. }
  6146. }
  6147.  
  6148. doorCount = currentCount;
  6149. }
  6150.  
  6151. return;
  6152. }
  6153. if (command == 207) {
  6154. showCharacterLookScreen = true;
  6155. return;
  6156. }
  6157. if (command == 4) {
  6158. int currentMob = DataOperations.getUnsigned2Bytes(data, 1);
  6159. if (mobArray[currentMob] != null) // todo: check what that mobArray is
  6160. tradeOtherPlayerName = mobArray[currentMob].name;
  6161. showTradeWindow = true;
  6162. tradeOtherAccepted = false;
  6163. tradeWeAccepted = false;
  6164. tradeMyItemCount = 0;
  6165. tradeOtherItemCount = 0;
  6166. return;
  6167. }
  6168. if (command == 187) {
  6169. showTradeWindow = false;
  6170. showTradeConfirmWindow = false;
  6171. return;
  6172. }
  6173. if (command == 250) {
  6174. tradeOtherItemCount = data[1] & 0xff;
  6175. int l3 = 2;
  6176. for (int i11 = 0; i11 < tradeOtherItemCount; i11++) {
  6177. tradeOtherItems[i11] = DataOperations.getUnsigned2Bytes(data, l3);
  6178. l3 += 2;
  6179. tradeOtherItemsCount[i11] = DataOperations.readInt(data, l3);
  6180. l3 += 4;
  6181. }
  6182.  
  6183. tradeOtherAccepted = false;
  6184. tradeWeAccepted = false;
  6185. return;
  6186. }
  6187. if (command == 92) {
  6188. tradeOtherAccepted = data[1] == 1;
  6189. }
  6190. if (command == 253) {
  6191. showShop = true;
  6192. int i4 = 1;
  6193. int j11 = data[i4++] & 0xff;
  6194. byte byte4 = data[i4++];
  6195. shopItemSellPriceModifier = data[i4++] & 0xff;
  6196. shopItemBuyPriceModifier = data[i4++] & 0xff;
  6197. for (int i22 = 0; i22 < 40; i22++)
  6198. shopItems[i22] = -1;
  6199.  
  6200. for (int j25 = 0; j25 < j11; j25++) {
  6201. shopItems[j25] = DataOperations.getUnsigned2Bytes(data, i4);
  6202. i4 += 2;
  6203. shopItemCount[j25] = DataOperations.getUnsigned2Bytes(data, i4);
  6204. i4 += 2;
  6205. }
  6206.  
  6207. if (byte4 == 1) {
  6208. int l28 = 39;
  6209. for (int k33 = 0; k33 < inventoryCount; k33++) {
  6210. if (l28 < j11)
  6211. break;
  6212. boolean flag2 = false;
  6213. for (int j39 = 0; j39 < 40; j39++) {
  6214. if (shopItems[j39] != inventoryItems[k33])
  6215. continue;
  6216. flag2 = true;
  6217. break;
  6218. }
  6219.  
  6220. if (inventoryItems[k33] == 10)
  6221. flag2 = true;
  6222. if (!flag2) {
  6223. shopItems[l28] = inventoryItems[k33] & 0x7fff;
  6224. shopItemCount[l28] = 0;
  6225. l28--;
  6226. }
  6227. }
  6228.  
  6229. }
  6230. if (selectedShopItemIndex >= 0 && selectedShopItemIndex < 40 && shopItems[selectedShopItemIndex] != selectedShopItemType) {
  6231. selectedShopItemIndex = -1;
  6232. selectedShopItemType = -2;
  6233. }
  6234. return;
  6235. }
  6236. if (command == 220) {
  6237. showShop = false;
  6238. return;
  6239. }
  6240. if (command == 18) {
  6241. tradeWeAccepted = data[1] == 1;
  6242. }
  6243. if (command == 152) {
  6244. configAutoCameraAngle = DataOperations.getUnsignedByte(data[1]) == 1;
  6245. configMouseButtons = DataOperations.getUnsignedByte(data[2]) == 1;
  6246. configSoundEffects = DataOperations.getUnsignedByte(data[3]) == 1;
  6247. showRoof = DataOperations.getUnsignedByte(data[4]) == 1;
  6248. autoScreenshot = DataOperations.getUnsignedByte(data[5]) == 1;
  6249. combatWindow = DataOperations.getUnsignedByte(data[6]) == 1;
  6250. return;
  6251. }
  6252. if (command == 209) {
  6253. for (int currentPrayer = 0; currentPrayer < length - 1; currentPrayer++) {
  6254. boolean prayerOff = data[currentPrayer + 1] == 1;
  6255. if (!prayerOn[currentPrayer] && prayerOff)
  6256. playSound("prayeron");
  6257. if (prayerOn[currentPrayer] && !prayerOff)
  6258. playSound("prayeroff");
  6259. prayerOn[currentPrayer] = prayerOff;
  6260. }
  6261.  
  6262. return;
  6263. }
  6264. if (command == 93) {
  6265. showBank = true;
  6266. int l4 = 1;
  6267. newBankItemCount = data[l4++] & 0xff;
  6268. bankItemsMax = data[l4++] & 0xff;
  6269. for (int k11 = 0; k11 < newBankItemCount; k11++) {
  6270. newBankItems[k11] = DataOperations.getUnsigned2Bytes(data, l4);
  6271. l4 += 2;
  6272. newBankItemsCount[k11] = DataOperations.getUnsigned4Bytes(data, l4);
  6273. l4 += 4;
  6274. }
  6275.  
  6276. updateBankItems();
  6277. return;
  6278. }
  6279. if (command == 171) {
  6280. showBank = false;
  6281. return;
  6282. }
  6283. if (command == 211) {
  6284. int idx = data[1] & 0xFF;
  6285. int oldExp = playerStatExperience[idx];
  6286. playerStatExperience[idx] = DataOperations.readInt(data, 2);
  6287. if (playerStatExperience[idx] > oldExp) {
  6288. expGained += (playerStatExperience[idx] - oldExp);
  6289. }
  6290. return;
  6291. }
  6292. if (command == 229) {
  6293. int j5 = DataOperations.getUnsigned2Bytes(data, 1);
  6294. if (mobArray[j5] != null) {
  6295. duelOpponentName = mobArray[j5].name;
  6296. }
  6297. showDuelWindow = true;
  6298. duelMyItemCount = 0;
  6299. duelOpponentItemCount = 0;
  6300. duelOpponentAccepted = false;
  6301. duelMyAccepted = false;
  6302. duelNoRetreating = false;
  6303. duelNoMagic = false;
  6304. duelNoPrayer = false;
  6305. duelNoWeapons = false;
  6306. return;
  6307. }
  6308. if (command == 160) {
  6309. showDuelWindow = false;
  6310. showDuelConfirmWindow = false;
  6311. return;
  6312. }
  6313. if (command == 251) {
  6314. showTradeConfirmWindow = true;
  6315. tradeConfirmAccepted = false;
  6316. showTradeWindow = false;
  6317. int k5 = 1;
  6318. tradeConfirmOtherNameLong = DataOperations.getUnsigned8Bytes(data, k5);
  6319. k5 += 8;
  6320. tradeConfirmOtherItemCount = data[k5++] & 0xff;
  6321. for (int l11 = 0; l11 < tradeConfirmOtherItemCount; l11++) {
  6322. tradeConfirmOtherItems[l11] = DataOperations.getUnsigned2Bytes(data, k5);
  6323. k5 += 2;
  6324. tradeConfirmOtherItemsCount[l11] = DataOperations.readInt(data, k5);
  6325. k5 += 4;
  6326. }
  6327.  
  6328. tradeConfirmItemCount = data[k5++] & 0xff;
  6329. for (int k17 = 0; k17 < tradeConfirmItemCount; k17++) {
  6330. tradeConfirmItems[k17] = DataOperations.getUnsigned2Bytes(data, k5);
  6331. k5 += 2;
  6332. tradeConfirmItemsCount[k17] = DataOperations.readInt(data, k5);
  6333. k5 += 4;
  6334. }
  6335.  
  6336. return;
  6337. }
  6338. if (command == 63) {
  6339. duelOpponentItemCount = data[1] & 0xff;
  6340. int l5 = 2;
  6341. for (int i12 = 0; i12 < duelOpponentItemCount; i12++) {
  6342. duelOpponentItems[i12] = DataOperations.getUnsigned2Bytes(data, l5);
  6343. l5 += 2;
  6344. duelOpponentItemsCount[i12] = DataOperations.readInt(data, l5);
  6345. l5 += 4;
  6346. }
  6347.  
  6348. duelOpponentAccepted = false;
  6349. duelMyAccepted = false;
  6350. return;
  6351. }
  6352. if (command == 198) {
  6353. duelNoRetreating = data[1] == 1;
  6354. duelNoMagic = data[2] == 1;
  6355. duelNoPrayer = data[3] == 1;
  6356. duelNoWeapons = data[4] == 1;
  6357. duelOpponentAccepted = false;
  6358. duelMyAccepted = false;
  6359. return;
  6360. }
  6361. if (command == 139) {
  6362. int bankDataOffset = 1;
  6363. int bankSlot = data[bankDataOffset++] & 0xff;
  6364. int bankItemId = DataOperations.getUnsigned2Bytes(data, bankDataOffset);
  6365. bankDataOffset += 2;
  6366. int bankItemCount = DataOperations.getUnsigned4Bytes(data, bankDataOffset);
  6367. bankDataOffset += 4;
  6368. if (bankItemCount == 0) {
  6369. newBankItemCount--;
  6370. for (int currentBankSlot = bankSlot; currentBankSlot < newBankItemCount; currentBankSlot++) {
  6371. newBankItems[currentBankSlot] = newBankItems[currentBankSlot + 1];
  6372. newBankItemsCount[currentBankSlot] = newBankItemsCount[currentBankSlot + 1];
  6373. }
  6374.  
  6375. } else {
  6376. newBankItems[bankSlot] = bankItemId;
  6377. newBankItemsCount[bankSlot] = bankItemCount;
  6378. if (bankSlot >= newBankItemCount)
  6379. newBankItemCount = bankSlot + 1;
  6380. }
  6381. updateBankItems();
  6382. return;
  6383. }
  6384. if (command == 228) {
  6385. int j6 = 1;
  6386. int k12 = 1;
  6387. int i18 = data[j6++] & 0xff;
  6388. int k22 = DataOperations.getUnsigned2Bytes(data, j6);
  6389. j6 += 2;
  6390. if (EntityHandler.getItemDef(k22 & 0x7fff).isStackable()) {
  6391. k12 = DataOperations.readInt(data, j6);
  6392. j6 += 4;
  6393. }
  6394. inventoryItems[i18] = k22 & 0x7fff;
  6395. wearing[i18] = k22 / 32768;
  6396. inventoryItemsCount[i18] = k12;
  6397. if (i18 >= inventoryCount)
  6398. inventoryCount = i18 + 1;
  6399. return;
  6400. }
  6401. if (command == 191) {
  6402. int k6 = data[1] & 0xff;
  6403. inventoryCount--;
  6404. for (int l12 = k6; l12 < inventoryCount; l12++) {
  6405. inventoryItems[l12] = inventoryItems[l12 + 1];
  6406. inventoryItemsCount[l12] = inventoryItemsCount[l12 + 1];
  6407. wearing[l12] = wearing[l12 + 1];
  6408. }
  6409. return;
  6410. }
  6411. if (command == 208) {
  6412. int pointer = 1;
  6413. int idx = data[pointer++] & 0xff;
  6414. int oldExp = playerStatExperience[idx];
  6415. playerStatCurrent[idx] = DataOperations.getUnsignedByte(data[pointer++]);
  6416. playerStatBase[idx] = DataOperations.getUnsignedByte(data[pointer++]);
  6417. playerStatExperience[idx] = DataOperations.readInt(data, pointer);
  6418. pointer += 4;
  6419.  
  6420. if (playerStatExperience[idx] > oldExp) {
  6421. expGained += (playerStatExperience[idx] - oldExp);
  6422. }
  6423. return;
  6424. }
  6425. if (command == 65) {
  6426. duelOpponentAccepted = data[1] == 1;
  6427. }
  6428. if (command == 197) {
  6429. duelMyAccepted = data[1] == 1;
  6430. }
  6431. if (command == 147) {
  6432. showDuelConfirmWindow = true;
  6433. duelWeAccept = false;
  6434. showDuelWindow = false;
  6435. int i7 = 1;
  6436. duelOpponentNameLong = DataOperations.getUnsigned8Bytes(data, i7);
  6437. i7 += 8;
  6438. duelConfirmOpponentItemCount = data[i7++] & 0xff;
  6439. for (int j13 = 0; j13 < duelConfirmOpponentItemCount; j13++) {
  6440. duelConfirmOpponentItems[j13] = DataOperations.getUnsigned2Bytes(data, i7);
  6441. i7 += 2;
  6442. duelConfirmOpponentItemsCount[j13] = DataOperations.readInt(data, i7);
  6443. i7 += 4;
  6444. }
  6445.  
  6446. duelConfirmMyItemCount = data[i7++] & 0xff;
  6447. for (int j18 = 0; j18 < duelConfirmMyItemCount; j18++) {
  6448. duelConfirmMyItems[j18] = DataOperations.getUnsigned2Bytes(data, i7);
  6449. i7 += 2;
  6450. duelConfirmMyItemsCount[j18] = DataOperations.readInt(data, i7);
  6451. i7 += 4;
  6452. }
  6453.  
  6454. duelCantRetreat = data[i7++] & 0xff;
  6455. duelUseMagic = data[i7++] & 0xff;
  6456. duelUsePrayer = data[i7++] & 0xff;
  6457. duelUseWeapons = data[i7++] & 0xff;
  6458. return;
  6459. }
  6460. if (command == 11) {
  6461. String s = new String(data, 1, length - 1);
  6462. playSound(s);
  6463. return;
  6464. }
  6465. if (command == 23) {
  6466. if (anInt892 < 50) {
  6467. int j7 = data[1] & 0xff;
  6468. int k13 = data[2] + sectionX;
  6469. int k18 = data[3] + sectionY;
  6470. anIntArray782[anInt892] = j7;
  6471. anIntArray923[anInt892] = 0;
  6472. anIntArray944[anInt892] = k13;
  6473. anIntArray757[anInt892] = k18;
  6474. anInt892++;
  6475. }
  6476. return;
  6477. }
  6478. if (command == 248) {
  6479. if (!hasReceivedWelcomeBoxDetails) {
  6480. lastLoggedInDays = DataOperations.getUnsigned2Bytes(data, 1);
  6481. subscriptionLeftDays = DataOperations.getUnsigned2Bytes(data, 3);
  6482. lastLoggedInAddress = new String(data, 5, length - 5);
  6483. showWelcomeBox = true;
  6484. hasReceivedWelcomeBoxDetails = true;
  6485. }
  6486. return;
  6487. }
  6488. if (command == 148) {
  6489. serverMessage = new String(data, 1, length - 1);
  6490. showServerMessageBox = true;
  6491. serverMessageBoxTop = false;
  6492. return;
  6493. }
  6494. if (command == 64) {
  6495. serverMessage = new String(data, 1, length - 1);
  6496. showServerMessageBox = true;
  6497. serverMessageBoxTop = true;
  6498. return;
  6499. }
  6500. //if (command == 126) {
  6501. // fatigue = DataOperations.getUnsigned2Bytes(data, 1);
  6502. // return;
  6503. // }
  6504. if (command == 133) {
  6505. tutorial = DataOperations.getUnsigned2Bytes(data, 1);
  6506. return;
  6507. }
  6508. if (command == 128) {
  6509. questpoints = DataOperations.getUnsigned2Bytes(data, 1);
  6510. return;
  6511. }
  6512. if (command == 206) {
  6513. killingspree = DataOperations.getUnsigned2Bytes(data, 1);
  6514. return;
  6515. }
  6516. if (command == 210) {
  6517. guthixspells = DataOperations.getUnsigned2Bytes(data, 1);
  6518. return;
  6519. }
  6520. if (command == 212) {
  6521. zamorakspells = DataOperations.getUnsigned2Bytes(data, 1);
  6522. return;
  6523. }
  6524. if (command == 213) {
  6525. saradominspells = DataOperations.getUnsigned2Bytes(data, 1);
  6526. return;
  6527. }
  6528. if (command == 130) {
  6529. maxHit = DataOperations.getUnsigned2Bytes(data, 1);
  6530. return;
  6531. }
  6532. if (command == 132) {
  6533. kills = DataOperations.getUnsigned2Bytes(data, 1);
  6534. return;
  6535. }
  6536. if (command == 134) {
  6537. deaths = DataOperations.getUnsigned2Bytes(data, 1);
  6538. return;
  6539. }
  6540. if (command == 202) {
  6541. taskpoints = DataOperations.getUnsigned2Bytes(data, 1);
  6542. return;
  6543. }
  6544. if (command == 203) {
  6545. completedtasks = DataOperations.getUnsigned2Bytes(data, 1);
  6546. return;
  6547. }
  6548. if (command == 204) {
  6549. remaining = DataOperations.getUnsigned2Bytes(data, 1);
  6550. return;
  6551. }
  6552. if (command == 205) {
  6553. moneyTask = new String(data, 1, length - 1);
  6554. return;
  6555. }
  6556. if (command == 222) {
  6557. this.PO = DataOperations.getUnsigned2Bytes(data, 1);
  6558. return;
  6559. }
  6560. if (command == 214) {
  6561. taskStatus = DataOperations.getUnsigned2Bytes(data, 1);
  6562. return;
  6563. }
  6564. if (command == 215) {
  6565. taskexp = DataOperations.getUnsigned2Bytes(data, 1);
  6566. return;
  6567. }
  6568. if (command == 216) {
  6569. taskcash = DataOperations.getUnsigned2Bytes(data, 1);
  6570. return;
  6571. }
  6572. if (command == 217) {
  6573. taskitem = DataOperations.getUnsigned2Bytes(data, 1);
  6574. return;
  6575. }
  6576. if (command == 181) {
  6577. if (autoScreenshot) {
  6578. takeScreenshot(false);
  6579. }
  6580. return;
  6581. }
  6582. if (command == 172) {
  6583. systemUpdate = DataOperations.getUnsigned2Bytes(data, 1) * 32;
  6584. return;
  6585. }
  6586. }
  6587. catch (RuntimeException runtimeexception) {
  6588. runtimeexception.printStackTrace();
  6589. if (handlePacketErrorCount < 3) {
  6590. super.streamClass.createPacket(156);
  6591. super.streamClass.addString(runtimeexception.toString());
  6592. super.streamClass.formatPacket();
  6593. handlePacketErrorCount++;
  6594. }
  6595. }
  6596. }
  6597.  
  6598. protected final void lostConnection() {
  6599. systemUpdate = 0;
  6600. pvpTime = 0;
  6601. wildernessTime = 0;
  6602. dropPartyTime = 0;
  6603. if (logoutTimeout != 0) {
  6604. resetIntVars();
  6605. return;
  6606. }
  6607. super.lostConnection();
  6608. }
  6609.  
  6610. private final void playSound(String s) {
  6611. if (audioReader == null) {
  6612. return;
  6613. }
  6614. if (configSoundEffects) {
  6615. return;
  6616. }
  6617. audioReader.loadData(sounds, DataOperations.method358(s + ".pcm", sounds), DataOperations.method359(s + ".pcm", sounds));
  6618. }
  6619.  
  6620. private final boolean sendWalkCommand(int walkSectionX, int walkSectionY, int x1, int y1, int x2, int y2, boolean stepBoolean, boolean coordsEqual) {
  6621. // todo: needs checking
  6622. int stepCount = engineHandle.getStepCount(walkSectionX, walkSectionY, x1, y1, x2, y2, sectionXArray, sectionYArray, stepBoolean);
  6623. if (stepCount == -1)
  6624. if (coordsEqual) {
  6625. stepCount = 1;
  6626. sectionXArray[0] = x1;
  6627. sectionYArray[0] = y1;
  6628. } else {
  6629. return false;
  6630. }
  6631. stepCount--;
  6632. walkSectionX = sectionXArray[stepCount];
  6633. walkSectionY = sectionYArray[stepCount];
  6634. stepCount--;
  6635. if (coordsEqual)
  6636. super.streamClass.createPacket(246);
  6637. else
  6638. super.streamClass.createPacket(132);
  6639. super.streamClass.add2ByteInt(walkSectionX + areaX);
  6640. super.streamClass.add2ByteInt(walkSectionY + areaY);
  6641. if (coordsEqual && stepCount == -1 && (walkSectionX + areaX) % 5 == 0)
  6642. stepCount = 0;
  6643. for (int currentStep = stepCount; currentStep >= 0 && currentStep > stepCount - 25; currentStep--) {
  6644. super.streamClass.addByte(sectionXArray[currentStep] - walkSectionX);
  6645. super.streamClass.addByte(sectionYArray[currentStep] - walkSectionY);
  6646. }
  6647.  
  6648. super.streamClass.formatPacket();
  6649. actionPictureType = -24;
  6650. actionPictureX = super.mouseX; // guessing the little red/yellow x that appears when you click
  6651. actionPictureY = super.mouseY;
  6652. return true;
  6653. }
  6654.  
  6655. private final boolean sendWalkCommandIgnoreCoordsEqual(int walkSectionX, int walkSectionY, int x1, int y1, int x2, int y2, boolean stepBoolean, boolean
  6656.  
  6657. coordsEqual) {
  6658. int stepCount = engineHandle.getStepCount(walkSectionX, walkSectionY, x1, y1, x2, y2, sectionXArray, sectionYArray, stepBoolean);
  6659. if (stepCount == -1)
  6660. return false;
  6661. stepCount--;
  6662. walkSectionX = sectionXArray[stepCount];
  6663. walkSectionY = sectionYArray[stepCount];
  6664. stepCount--;
  6665. if (coordsEqual)
  6666. super.streamClass.createPacket(246);
  6667. else
  6668. super.streamClass.createPacket(132);
  6669. super.streamClass.add2ByteInt(walkSectionX + areaX);
  6670. super.streamClass.add2ByteInt(walkSectionY + areaY);
  6671. if (coordsEqual && stepCount == -1 && (walkSectionX + areaX) % 5 == 0)
  6672. stepCount = 0;
  6673. for (int currentStep = stepCount; currentStep >= 0 && currentStep > stepCount - 25; currentStep--) {
  6674. super.streamClass.addByte(sectionXArray[currentStep] - walkSectionX);
  6675. super.streamClass.addByte(sectionYArray[currentStep] - walkSectionY);
  6676. }
  6677.  
  6678. super.streamClass.formatPacket();
  6679. actionPictureType = -24;
  6680. actionPictureX = super.mouseX;
  6681. actionPictureY = super.mouseY;
  6682. return true;
  6683. }
  6684.  
  6685. public final Image createImage(int i, int j) {
  6686. if (GameWindow.gameFrame != null) {
  6687. return GameWindow.gameFrame.createImage(i, j);
  6688. }
  6689. return super.createImage(i, j);
  6690. }
  6691.  
  6692. private final void drawTradeConfirmWindow() {
  6693. byte byte0 = 22;
  6694. byte byte1 = 36;
  6695. gameGraphics.drawBox(byte0, byte1, 468, 16, 192);
  6696. int i = 0x989898;
  6697. gameGraphics.drawBoxAlpha(byte0, byte1 + 16, 468, 246, i, 160);
  6698. gameGraphics.drawText("Please confirm your trade with @yel@" + DataOperations.longToString(tradeConfirmOtherNameLong), byte0 + 234, byte1 + 12, 1,
  6699.  
  6700. 0xffffff);
  6701. gameGraphics.drawText("You are about to give:", byte0 + 117, byte1 + 30, 1, 0xffff00);
  6702. for (int j = 0; j < tradeConfirmItemCount; j++) {
  6703. String s = EntityHandler.getItemDef(tradeConfirmItems[j]).getName();
  6704. if (EntityHandler.getItemDef(tradeConfirmItems[j]).isStackable())
  6705. s = s + " x " + method74(tradeConfirmItemsCount[j]);
  6706. gameGraphics.drawText(s, byte0 + 117, byte1 + 42 + j * 12, 1, 0xffffff);
  6707. }
  6708.  
  6709. if (tradeConfirmItemCount == 0)
  6710. gameGraphics.drawText("Nothing!", byte0 + 117, byte1 + 42, 1, 0xffffff);
  6711. gameGraphics.drawText("In return you will receive:", byte0 + 351, byte1 + 30, 1, 0xffff00);
  6712. for (int k = 0; k < tradeConfirmOtherItemCount; k++) {
  6713. String s1 = EntityHandler.getItemDef(tradeConfirmOtherItems[k]).getName();
  6714. if (EntityHandler.getItemDef(tradeConfirmOtherItems[k]).isStackable())
  6715. s1 = s1 + " x " + method74(tradeConfirmOtherItemsCount[k]);
  6716. gameGraphics.drawText(s1, byte0 + 351, byte1 + 42 + k * 12, 1, 0xffffff);
  6717. }
  6718.  
  6719. if (tradeConfirmOtherItemCount == 0)
  6720. gameGraphics.drawText("Nothing!", byte0 + 351, byte1 + 42, 1, 0xffffff);
  6721. gameGraphics.drawText("Are you sure you want to do this?", byte0 + 234, byte1 + 200, 4, 65535);
  6722. gameGraphics.drawText("There is NO WAY to reverse a trade if you change your mind.", byte0 + 234, byte1 + 215, 1, 0xffffff);
  6723. gameGraphics.drawText("Remember that not all players are trustworthy", byte0 + 234, byte1 + 230, 1, 0xffffff);
  6724. if (!tradeConfirmAccepted) {
  6725. gameGraphics.drawPicture((byte0 + 118) - 35, byte1 + 238, SPRITE_MEDIA_START + 25);
  6726. gameGraphics.drawPicture((byte0 + 352) - 35, byte1 + 238, SPRITE_MEDIA_START + 26);
  6727. } else {
  6728. gameGraphics.drawText("Waiting for other player...", byte0 + 234, byte1 + 250, 1, 0xffff00);
  6729. }
  6730. if (mouseButtonClick == 1) {
  6731. if (super.mouseX < byte0 || super.mouseY < byte1 || super.mouseX > byte0 + 468 || super.mouseY > byte1 + 262) {
  6732. showTradeConfirmWindow = false;
  6733. super.streamClass.createPacket(216);
  6734. super.streamClass.formatPacket();
  6735. }
  6736. if (super.mouseX >= (byte0 + 118) - 35 && super.mouseX <= byte0 + 118 + 70 && super.mouseY >= byte1 + 238 && super.mouseY <= byte1 + 238 + 21) {
  6737. tradeConfirmAccepted = true;
  6738. super.streamClass.createPacket(53);
  6739. super.streamClass.formatPacket();
  6740. }
  6741. if (super.mouseX >= (byte0 + 352) - 35 && super.mouseX <= byte0 + 353 + 70 && super.mouseY >= byte1 + 238 && super.mouseY <= byte1 + 238 + 21) {
  6742. showTradeConfirmWindow = false;
  6743. super.streamClass.createPacket(216);
  6744. super.streamClass.formatPacket();
  6745. }
  6746. mouseButtonClick = 0;
  6747. }
  6748. }
  6749.  
  6750. private final void walkToGroundItem(int walkSectionX, int walkSectionY, int x, int y, boolean coordsEqual) {
  6751. if (sendWalkCommandIgnoreCoordsEqual(walkSectionX, walkSectionY, x, y, x, y, false, coordsEqual)) {
  6752. return;
  6753. } else {
  6754. sendWalkCommand(walkSectionX, walkSectionY, x, y, x, y, true, coordsEqual);
  6755. return;
  6756. }
  6757. }
  6758.  
  6759. private final Mob addNPC(int serverIndex, int x, int y, int nextSprite, int type) {
  6760. if (npcRecordArray[serverIndex] == null) {
  6761. npcRecordArray[serverIndex] = new Mob();
  6762. npcRecordArray[serverIndex].serverIndex = serverIndex;
  6763. }
  6764. Mob mob = npcRecordArray[serverIndex];
  6765. boolean npcAlreadyExists = false;
  6766. for (int lastNpcIndex = 0; lastNpcIndex < lastNpcCount; lastNpcIndex++) {
  6767. if (lastNpcArray[lastNpcIndex].serverIndex != serverIndex)
  6768. continue;
  6769. npcAlreadyExists = true;
  6770. break;
  6771. }
  6772.  
  6773. if (npcAlreadyExists) {
  6774. mob.type = type;
  6775. mob.nextSprite = nextSprite;
  6776. int waypointCurrent = mob.waypointCurrent;
  6777. if (x != mob.waypointsX[waypointCurrent] || y != mob.waypointsY[waypointCurrent]) {
  6778. mob.waypointCurrent = waypointCurrent = (waypointCurrent + 1) % 10;
  6779. mob.waypointsX[waypointCurrent] = x;
  6780. mob.waypointsY[waypointCurrent] = y;
  6781. }
  6782. } else {
  6783. mob.serverIndex = serverIndex;
  6784. mob.waypointEndSprite = 0;
  6785. mob.waypointCurrent = 0;
  6786. mob.waypointsX[0] = mob.currentX = x;
  6787. mob.waypointsY[0] = mob.currentY = y;
  6788. mob.type = type;
  6789. mob.nextSprite = mob.currentSprite = nextSprite;
  6790. mob.stepCount = 0;
  6791. }
  6792. npcArray[npcCount++] = mob;
  6793. return mob;
  6794. }
  6795.  
  6796. private final void drawDuelWindow() {
  6797. if (mouseButtonClick != 0 && itemIncrement == 0)
  6798. itemIncrement = 1;
  6799. if (itemIncrement > 0) {
  6800. int i = super.mouseX - 22;
  6801. int j = super.mouseY - 36;
  6802. if (i >= 0 && j >= 0 && i < 468 && j < 262) {
  6803. if (i > 216 && j > 30 && i < 462 && j < 235) {
  6804. int k = (i - 217) / 49 + ((j - 31) / 34) * 5;
  6805. if (k >= 0 && k < inventoryCount) {
  6806. boolean flag1 = false;
  6807. int l1 = 0;
  6808. int k2 = inventoryItems[k];
  6809. for (int k3 = 0; k3 < duelMyItemCount; k3++)
  6810. if (duelMyItems[k3] == k2)
  6811. if (EntityHandler.getItemDef(k2).isStackable()) {
  6812. for (int i4 = 0; i4 < itemIncrement; i4++) {
  6813. if (duelMyItemsCount[k3] < inventoryItemsCount[k])
  6814. duelMyItemsCount[k3]++;
  6815. flag1 = true;
  6816. }
  6817.  
  6818. } else {
  6819. l1++;
  6820. }
  6821.  
  6822. if (inventoryCount(k2) <= l1)
  6823. flag1 = true;
  6824. if (!flag1 && duelMyItemCount < 8) {
  6825. duelMyItems[duelMyItemCount] = k2;
  6826. duelMyItemsCount[duelMyItemCount] = 1;
  6827. duelMyItemCount++;
  6828. flag1 = true;
  6829. }
  6830. if (flag1) {
  6831. super.streamClass.createPacket(123);
  6832. super.streamClass.addByte(duelMyItemCount);
  6833. for (int duelItem = 0; duelItem < duelMyItemCount; duelItem++) {
  6834. super.streamClass.add2ByteInt(duelMyItems[duelItem]);
  6835. super.streamClass.add4ByteInt(duelMyItemsCount[duelItem]);
  6836. }
  6837.  
  6838. super.streamClass.formatPacket();
  6839. duelOpponentAccepted = false;
  6840. duelMyAccepted = false;
  6841. }
  6842. }
  6843. }
  6844. if (i > 8 && j > 30 && i < 205 && j < 129) {
  6845. int l = (i - 9) / 49 + ((j - 31) / 34) * 4;
  6846. if (l >= 0 && l < duelMyItemCount) {
  6847. int j1 = duelMyItems[l];
  6848. for (int i2 = 0; i2 < itemIncrement; i2++) {
  6849. if (EntityHandler.getItemDef(j1).isStackable() && duelMyItemsCount[l] > 1) {
  6850. duelMyItemsCount[l]--;
  6851. continue;
  6852. }
  6853. duelMyItemCount--;
  6854. mouseDownTime = 0;
  6855. for (int l2 = l; l2 < duelMyItemCount; l2++) {
  6856. duelMyItems[l2] = duelMyItems[l2 + 1];
  6857. duelMyItemsCount[l2] = duelMyItemsCount[l2 + 1];
  6858. }
  6859.  
  6860. break;
  6861. }
  6862.  
  6863. super.streamClass.createPacket(123);
  6864. super.streamClass.addByte(duelMyItemCount);
  6865. for (int i3 = 0; i3 < duelMyItemCount; i3++) {
  6866. super.streamClass.add2ByteInt(duelMyItems[i3]);
  6867. super.streamClass.add4ByteInt(duelMyItemsCount[i3]);
  6868. }
  6869.  
  6870. super.streamClass.formatPacket();
  6871. duelOpponentAccepted = false;
  6872. duelMyAccepted = false;
  6873. }
  6874. }
  6875. boolean flag = false;
  6876. if (i >= 93 && j >= 221 && i <= 104 && j <= 232) {
  6877. duelNoRetreating = !duelNoRetreating;
  6878. flag = true;
  6879. }
  6880. if (i >= 93 && j >= 240 && i <= 104 && j <= 251) {
  6881. duelNoMagic = !duelNoMagic;
  6882. flag = true;
  6883. }
  6884. if (i >= 191 && j >= 221 && i <= 202 && j <= 232) {
  6885. duelNoPrayer = !duelNoPrayer;
  6886. flag = true;
  6887. }
  6888. if (i >= 191 && j >= 240 && i <= 202 && j <= 251) {
  6889. duelNoWeapons = !duelNoWeapons;
  6890. flag = true;
  6891. }
  6892. if (flag) {
  6893. super.streamClass.createPacket(225);
  6894. super.streamClass.addByte(duelNoRetreating ? 1 : 0);
  6895. super.streamClass.addByte(duelNoMagic ? 1 : 0);
  6896. super.streamClass.addByte(duelNoPrayer ? 1 : 0);
  6897. super.streamClass.addByte(duelNoWeapons ? 1 : 0);
  6898. super.streamClass.formatPacket();
  6899. duelOpponentAccepted = false;
  6900. duelMyAccepted = false;
  6901. }
  6902. if (i >= 217 && j >= 238 && i <= 286 && j <= 259) {
  6903. duelMyAccepted = true;
  6904. super.streamClass.createPacket(252);
  6905. super.streamClass.formatPacket();
  6906. }
  6907. if (i >= 394 && j >= 238 && i < 463 && j < 259) {
  6908. showDuelWindow = false;
  6909. super.streamClass.createPacket(35);
  6910. super.streamClass.formatPacket();
  6911. }
  6912. } else if (mouseButtonClick != 0) {
  6913. showDuelWindow = false;
  6914. super.streamClass.createPacket(35);
  6915. super.streamClass.formatPacket();
  6916. }
  6917. mouseButtonClick = 0;
  6918. itemIncrement = 0;
  6919. }
  6920. if (!showDuelWindow)
  6921. return;
  6922. byte byte0 = 22;
  6923. byte byte1 = 36;
  6924. gameGraphics.drawBox(byte0, byte1, 468, 12, 0xc90b1d);
  6925. int i1 = 0x989898;
  6926. gameGraphics.drawBoxAlpha(byte0, byte1 + 12, 468, 18, i1, 160);
  6927. gameGraphics.drawBoxAlpha(byte0, byte1 + 30, 8, 248, i1, 160);
  6928. gameGraphics.drawBoxAlpha(byte0 + 205, byte1 + 30, 11, 248, i1, 160);
  6929. gameGraphics.drawBoxAlpha(byte0 + 462, byte1 + 30, 6, 248, i1, 160);
  6930. gameGraphics.drawBoxAlpha(byte0 + 8, byte1 + 99, 197, 24, i1, 160);
  6931. gameGraphics.drawBoxAlpha(byte0 + 8, byte1 + 192, 197, 23, i1, 160);
  6932. gameGraphics.drawBoxAlpha(byte0 + 8, byte1 + 258, 197, 20, i1, 160);
  6933. gameGraphics.drawBoxAlpha(byte0 + 216, byte1 + 235, 246, 43, i1, 160);
  6934. int k1 = 0xd0d0d0;
  6935. gameGraphics.drawBoxAlpha(byte0 + 8, byte1 + 30, 197, 69, k1, 160);
  6936. gameGraphics.drawBoxAlpha(byte0 + 8, byte1 + 123, 197, 69, k1, 160);
  6937. gameGraphics.drawBoxAlpha(byte0 + 8, byte1 + 215, 197, 43, k1, 160);
  6938. gameGraphics.drawBoxAlpha(byte0 + 216, byte1 + 30, 246, 205, k1, 160);
  6939. for (int j2 = 0; j2 < 3; j2++)
  6940. gameGraphics.drawLineX(byte0 + 8, byte1 + 30 + j2 * 34, 197, 0);
  6941.  
  6942. for (int j3 = 0; j3 < 3; j3++)
  6943. gameGraphics.drawLineX(byte0 + 8, byte1 + 123 + j3 * 34, 197, 0);
  6944.  
  6945. for (int l3 = 0; l3 < 7; l3++)
  6946. gameGraphics.drawLineX(byte0 + 216, byte1 + 30 + l3 * 34, 246, 0);
  6947.  
  6948. for (int k4 = 0; k4 < 6; k4++) {
  6949. if (k4 < 5)
  6950. gameGraphics.drawLineY(byte0 + 8 + k4 * 49, byte1 + 30, 69, 0);
  6951. if (k4 < 5)
  6952. gameGraphics.drawLineY(byte0 + 8 + k4 * 49, byte1 + 123, 69, 0);
  6953. gameGraphics.drawLineY(byte0 + 216 + k4 * 49, byte1 + 30, 205, 0);
  6954. }
  6955.  
  6956. gameGraphics.drawLineX(byte0 + 8, byte1 + 215, 197, 0);
  6957. gameGraphics.drawLineX(byte0 + 8, byte1 + 257, 197, 0);
  6958. gameGraphics.drawLineY(byte0 + 8, byte1 + 215, 43, 0);
  6959. gameGraphics.drawLineY(byte0 + 204, byte1 + 215, 43, 0);
  6960. gameGraphics.drawString("Preparing to duel with: " + duelOpponentName, byte0 + 1, byte1 + 10, 1, 0xffffff);
  6961. gameGraphics.drawString("Your Stake", byte0 + 9, byte1 + 27, 4, 0xffffff);
  6962. gameGraphics.drawString("Opponent's Stake", byte0 + 9, byte1 + 120, 4, 0xffffff);
  6963. gameGraphics.drawString("Duel Options", byte0 + 9, byte1 + 212, 4, 0xffffff);
  6964. gameGraphics.drawString("Your Inventory", byte0 + 216, byte1 + 27, 4, 0xffffff);
  6965. gameGraphics.drawString("No retreating", byte0 + 8 + 1, byte1 + 215 + 16, 3, 0xffff00);
  6966. gameGraphics.drawString("No magic", byte0 + 8 + 1, byte1 + 215 + 35, 3, 0xffff00);
  6967. gameGraphics.drawString("No prayer", byte0 + 8 + 102, byte1 + 215 + 16, 3, 0xffff00);
  6968. gameGraphics.drawString("No weapons", byte0 + 8 + 102, byte1 + 215 + 35, 3, 0xffff00);
  6969. gameGraphics.drawBoxEdge(byte0 + 93, byte1 + 215 + 6, 11, 11, 0xffff00);
  6970. if (duelNoRetreating)
  6971. gameGraphics.drawBox(byte0 + 95, byte1 + 215 + 8, 7, 7, 0xffff00);
  6972. gameGraphics.drawBoxEdge(byte0 + 93, byte1 + 215 + 25, 11, 11, 0xffff00);
  6973. if (duelNoMagic)
  6974. gameGraphics.drawBox(byte0 + 95, byte1 + 215 + 27, 7, 7, 0xffff00);
  6975. gameGraphics.drawBoxEdge(byte0 + 191, byte1 + 215 + 6, 11, 11, 0xffff00);
  6976. if (duelNoPrayer)
  6977. gameGraphics.drawBox(byte0 + 193, byte1 + 215 + 8, 7, 7, 0xffff00);
  6978. gameGraphics.drawBoxEdge(byte0 + 191, byte1 + 215 + 25, 11, 11, 0xffff00);
  6979. if (duelNoWeapons)
  6980. gameGraphics.drawBox(byte0 + 193, byte1 + 215 + 27, 7, 7, 0xffff00);
  6981. if (!duelMyAccepted)
  6982. gameGraphics.drawPicture(byte0 + 217, byte1 + 238, SPRITE_MEDIA_START + 25);
  6983. gameGraphics.drawPicture(byte0 + 394, byte1 + 238, SPRITE_MEDIA_START + 26);
  6984. if (duelOpponentAccepted) {
  6985. gameGraphics.drawText("Other player", byte0 + 341, byte1 + 246, 1, 0xffffff);
  6986. gameGraphics.drawText("has accepted", byte0 + 341, byte1 + 256, 1, 0xffffff);
  6987. }
  6988. if (duelMyAccepted) {
  6989. gameGraphics.drawText("Waiting for", byte0 + 217 + 35, byte1 + 246, 1, 0xffffff);
  6990. gameGraphics.drawText("other player", byte0 + 217 + 35, byte1 + 256, 1, 0xffffff);
  6991. }
  6992. for (int l4 = 0; l4 < inventoryCount; l4++) {
  6993. int i5 = 217 + byte0 + (l4 % 5) * 49;
  6994. int k5 = 31 + byte1 + (l4 / 5) * 34;
  6995. gameGraphics.spriteClip4(i5, k5, 48, 32, SPRITE_ITEM_START + EntityHandler.getItemDef(inventoryItems[l4]).getSprite(),
  6996.  
  6997. EntityHandler.getItemDef(inventoryItems[l4]).getPictureMask(), 0, 0, false);
  6998. if (EntityHandler.getItemDef(inventoryItems[l4]).isStackable())
  6999. gameGraphics.drawString(String.valueOf(inventoryItemsCount[l4]), i5 + 1, k5 + 10, 1, 0xffff00);
  7000. }
  7001.  
  7002. for (int j5 = 0; j5 < duelMyItemCount; j5++) {
  7003. int l5 = 9 + byte0 + (j5 % 4) * 49;
  7004. int j6 = 31 + byte1 + (j5 / 4) * 34;
  7005. gameGraphics.spriteClip4(l5, j6, 48, 32, SPRITE_ITEM_START + EntityHandler.getItemDef(duelMyItems[j5]).getSprite(),
  7006.  
  7007. EntityHandler.getItemDef(duelMyItems[j5]).getPictureMask(), 0, 0, false);
  7008. if (EntityHandler.getItemDef(duelMyItems[j5]).isStackable())
  7009. gameGraphics.drawString(String.valueOf(duelMyItemsCount[j5]), l5 + 1, j6 + 10, 1, 0xffff00);
  7010. if (super.mouseX > l5 && super.mouseX < l5 + 48 && super.mouseY > j6 && super.mouseY < j6 + 32)
  7011. gameGraphics.drawString(EntityHandler.getItemDef(duelMyItems[j5]).getName() + ": @whi@" +
  7012.  
  7013. EntityHandler.getItemDef(duelMyItems[j5]).getDescription(), byte0 + 8, byte1 + 273, 1, 0xffff00);
  7014. }
  7015.  
  7016. for (int i6 = 0; i6 < duelOpponentItemCount; i6++) {
  7017. int k6 = 9 + byte0 + (i6 % 4) * 49;
  7018. int l6 = 124 + byte1 + (i6 / 4) * 34;
  7019. gameGraphics.spriteClip4(k6, l6, 48, 32, SPRITE_ITEM_START + EntityHandler.getItemDef(duelOpponentItems[i6]).getSprite(),
  7020.  
  7021. EntityHandler.getItemDef(duelOpponentItems[i6]).getPictureMask(), 0, 0, false);
  7022. if (EntityHandler.getItemDef(duelOpponentItems[i6]).isStackable())
  7023. gameGraphics.drawString(String.valueOf(duelOpponentItemsCount[i6]), k6 + 1, l6 + 10, 1, 0xffff00);
  7024. if (super.mouseX > k6 && super.mouseX < k6 + 48 && super.mouseY > l6 && super.mouseY < l6 + 32)
  7025. gameGraphics.drawString(EntityHandler.getItemDef(duelOpponentItems[i6]).getName() + ": @whi@" +
  7026.  
  7027. EntityHandler.getItemDef(duelOpponentItems[i6]).getDescription(), byte0 + 8, byte1 + 273, 1, 0xffff00);
  7028. }
  7029.  
  7030. }
  7031.  
  7032. private final void drawServerMessageBox() {
  7033. char c = '\u0190';
  7034. char c1 = 'd';
  7035. if (serverMessageBoxTop) {
  7036. c1 = '\u01C2';
  7037. c1 = '\u012C';
  7038. }
  7039. gameGraphics.drawBox(256 - c / 2, 167 - c1 / 2, c, c1, 0);
  7040. gameGraphics.drawBoxEdge(256 - c / 2, 167 - c1 / 2, c, c1, 0xffffff);
  7041. gameGraphics.drawBoxTextColour(serverMessage, 256, (167 - c1 / 2) + 20, 1, 0xffffff, c - 40);
  7042. int i = 157 + c1 / 2;
  7043. int j = 0xffffff;
  7044. if (super.mouseY > i - 12 && super.mouseY <= i && super.mouseX > 106 && super.mouseX < 406)
  7045. j = 0xff0000;
  7046. gameGraphics.drawText("Click here to close window", 256, i, 1, j);
  7047. if (mouseButtonClick == 1) {
  7048. if (j == 0xff0000)
  7049. showServerMessageBox = false;
  7050. if ((super.mouseX < 256 - c / 2 || super.mouseX > 256 + c / 2) && (super.mouseY < 167 - c1 / 2 || super.mouseY > 167 + c1 / 2))
  7051. showServerMessageBox = false;
  7052. }
  7053. mouseButtonClick = 0;
  7054. }
  7055.  
  7056. private final void makeLoginMenus() {
  7057. menuWelcome = new Menu(gameGraphics, 50);
  7058. int i = 40;
  7059. menuWelcome.drawText(256, 200 + i, "Welcome to DaNePK", 4, true);
  7060. menuWelcome.drawBox(256, 250 + i, 200, 35);
  7061. menuWelcome.drawText(256, 250 + i, "Click here to Login", 5, false);
  7062. loginButtonExistingUser = menuWelcome.makeButton(256, 250 + i, 200, 35);
  7063. menuNewUser = new Menu(gameGraphics, 50);
  7064. i = 230;
  7065. menuNewUser.drawBox(256, i + 17, 150, 34);
  7066. menuNewUser.drawText(256, i + 17, "Ok", 5, false);
  7067. newUserOkButton = menuNewUser.makeButton(256, i + 17, 150, 34);
  7068. menuLogin = new Menu(gameGraphics, 50);
  7069. i = 230;
  7070. loginStatusText = menuLogin.drawText(256, i - 10, "Please enter your username and password", 4, true);
  7071. i += 28;
  7072. menuLogin.drawBox(140, i, 200, 40);
  7073. menuLogin.drawText(140, i - 10, "User:", 4, false);
  7074. loginUsernameTextBox = menuLogin.makeTextBox(140, i + 10, 200, 40, 4, 12, false, false);
  7075. i += 47;
  7076. menuLogin.drawBox(190, i, 200, 40);
  7077. menuLogin.drawText(190, i - 10, "Pass:", 4, false);
  7078. loginPasswordTextBox = menuLogin.makeTextBox(190, i + 10, 200, 40, 4, 20, true, false);
  7079. i -= 55;
  7080. menuLogin.drawBox(410, i, 120, 25);
  7081. menuLogin.drawText(410, i, "PK!", 4, false);
  7082. loginOkButton = menuLogin.makeButton(410, i, 120, 25);
  7083. i += 30;
  7084. menuLogin.drawBox(410, i, 120, 25);
  7085. menuLogin.drawText(410, i, "Cancel", 4, false);
  7086. loginCancelButton = menuLogin.makeButton(410, i, 120, 25);
  7087. i += 30;
  7088. menuLogin.setFocus(loginUsernameTextBox);
  7089. }
  7090.  
  7091. private final void drawGameWindowsMenus() {
  7092. if (logoutTimeout != 0)
  7093. drawLoggingOutBox();
  7094. else if (showWelcomeBox)
  7095. drawWelcomeBox();
  7096. else if (showServerMessageBox)
  7097. drawServerMessageBox();
  7098. else if (wildernessType == 1) // 0 = not wild, 1 = close to wild, 2 = wild
  7099. drawWildernessWarningBox();
  7100. else if (showBank && lastWalkTimeout == 0)
  7101. drawBankBox();
  7102. else if (showShop && lastWalkTimeout == 0)
  7103. drawShopBox();
  7104. else if (showTradeConfirmWindow)
  7105. drawTradeConfirmWindow();
  7106. else if (showTradeWindow)
  7107. drawTradeWindow();
  7108. else if (showDuelConfirmWindow)
  7109. drawDuelConfirmWindow();
  7110. else if (showDuelWindow)
  7111. drawDuelWindow();
  7112. else if (inputBoxType != 0) {
  7113. drawInputBox();
  7114. } else {
  7115. if (showQuestionMenu)
  7116. drawQuestionMenu();
  7117. if ((ourPlayer.currentSprite == 8 || ourPlayer.currentSprite == 9) || combatWindow)
  7118. drawCombatStyleWindow();
  7119. checkMouseOverMenus();
  7120. boolean noMenusShown = !showQuestionMenu && !showRightClickMenu;
  7121. if (noMenusShown)
  7122. menuLength = 0;
  7123. if (mouseOverMenu == 0 && noMenusShown)
  7124. drawInventoryRightClickMenu();
  7125. if (mouseOverMenu == 1)
  7126. drawInventoryMenu(noMenusShown);
  7127. if (mouseOverMenu == 2)
  7128. drawMapMenu(noMenusShown);
  7129. if (mouseOverMenu == 3)
  7130. drawPlayerInfoMenu(noMenusShown);
  7131. if (mouseOverMenu == 4)
  7132. drawMagicWindow(noMenusShown);
  7133. if (mouseOverMenu == 5)
  7134. drawFriendsWindow(noMenusShown);
  7135. if (mouseOverMenu == 6)
  7136. drawOptionsMenu(noMenusShown);
  7137. if (!showRightClickMenu && !showQuestionMenu)
  7138. checkMouseStatus();
  7139. if (showRightClickMenu && !showQuestionMenu)
  7140. drawRightClickMenu();
  7141. }
  7142. mouseButtonClick = 0;
  7143. }
  7144.  
  7145. private final void method112(int i, int j, int k, int l, boolean flag) {
  7146. sendWalkCommand(i, j, k, l, k, l, false, flag);
  7147. }
  7148.  
  7149. private final void drawInputBox() {
  7150. if (mouseButtonClick != 0) {
  7151. mouseButtonClick = 0;
  7152. if (inputBoxType == 1 && (super.mouseX < 106 || super.mouseY < 145 || super.mouseX > 406 || super.mouseY > 215)) {
  7153. inputBoxType = 0;
  7154. return;
  7155. }
  7156. if (inputBoxType == 2 && (super.mouseX < 6 || super.mouseY < 145 || super.mouseX > 506 || super.mouseY > 215)) {
  7157. inputBoxType = 0;
  7158. return;
  7159. }
  7160. if (inputBoxType == 3 && (super.mouseX < 106 || super.mouseY < 145 || super.mouseX > 406 || super.mouseY > 215)) {
  7161. inputBoxType = 0;
  7162. return;
  7163. }
  7164. if (super.mouseX > 236 && super.mouseX < 276 && super.mouseY > 193 && super.mouseY < 213) {
  7165. inputBoxType = 0;
  7166. return;
  7167. }
  7168. }
  7169. int i = 145;
  7170. if (inputBoxType == 1) {
  7171. gameGraphics.drawBox(106, i, 300, 70, 0);
  7172. gameGraphics.drawBoxEdge(106, i, 300, 70, 0xffffff);
  7173. i += 20;
  7174. gameGraphics.drawText("Enter name to add to friends list", 256, i, 4, 0xffffff);
  7175. i += 20;
  7176. gameGraphics.drawText(super.inputText + "*", 256, i, 4, 0xffffff);
  7177. if (super.enteredText.length() > 0) {
  7178. String s = super.enteredText.trim();
  7179. super.inputText = "";
  7180. super.enteredText = "";
  7181. inputBoxType = 0;
  7182. if (s.length() > 0 && DataOperations.stringLength12ToLong(s) != ourPlayer.nameLong)
  7183. addToFriendsList(s);
  7184. }
  7185. }
  7186. if (inputBoxType == 2) {
  7187. gameGraphics.drawBox(6, i, 500, 70, 0);
  7188. gameGraphics.drawBoxEdge(6, i, 500, 70, 0xffffff);
  7189. i += 20;
  7190. gameGraphics.drawText("Enter message to send to " + DataOperations.longToString(privateMessageTarget), 256, i, 4, 0xffffff);
  7191. i += 20;
  7192. gameGraphics.drawText(super.inputMessage + "*", 256, i, 4, 0xffffff);
  7193. if (super.enteredMessage.length() > 0) {
  7194. String s1 = super.enteredMessage;
  7195. super.inputMessage = "";
  7196. super.enteredMessage = "";
  7197. inputBoxType = 0;
  7198. byte[] message = DataConversions.stringToByteArray(s1);
  7199. sendPrivateMessage(privateMessageTarget, message, message.length);
  7200. s1 = DataConversions.byteToString(message, 0, message.length);
  7201. handleServerMessage("@pri@You tell " + DataOperations.longToString(privateMessageTarget) + ": " + s1);
  7202. }
  7203. }
  7204. if (inputBoxType == 3) {
  7205. gameGraphics.drawBox(106, i, 300, 70, 0);
  7206. gameGraphics.drawBoxEdge(106, i, 300, 70, 0xffffff);
  7207. i += 20;
  7208. gameGraphics.drawText("Enter name to add to ignore list", 256, i, 4, 0xffffff);
  7209. i += 20;
  7210. gameGraphics.drawText(super.inputText + "*", 256, i, 4, 0xffffff);
  7211. if (super.enteredText.length() > 0) {
  7212. String s2 = super.enteredText.trim();
  7213. super.inputText = "";
  7214. super.enteredText = "";
  7215. inputBoxType = 0;
  7216. if (s2.length() > 0 && DataOperations.stringLength12ToLong(s2) != ourPlayer.nameLong)
  7217. addToIgnoreList(s2);
  7218. }
  7219. }
  7220. int j = 0xffffff;
  7221. if (super.mouseX > 236 && super.mouseX < 276 && super.mouseY > 193 && super.mouseY < 213)
  7222. j = 0xffff00;
  7223. gameGraphics.drawText("Cancel", 256, 208, 1, j);
  7224. }
  7225.  
  7226. private final boolean hasRequiredRunes(int i, int j) {
  7227. if (i == 31 && (method117(197) || method117(615) || method117(682))) {
  7228. return true;
  7229. }
  7230. if (i == 32 && (method117(102) || method117(616) || method117(683))) {
  7231. return true;
  7232. }
  7233. if (i == 33 && (method117(101) || method117(617) || method117(684))) {
  7234. return true;
  7235. }
  7236. if (i == 34 && (method117(103) || method117(618) || method117(685))) {
  7237. return true;
  7238. }
  7239. return inventoryCount(i) >= j;
  7240. }
  7241.  
  7242. private final void resetPrivateMessageStrings() {
  7243. super.inputMessage = "";
  7244. super.enteredMessage = "";
  7245. }
  7246.  
  7247. private final boolean method117(int i) {
  7248. for (int j = 0; j < inventoryCount; j++)
  7249. if (inventoryItems[j] == i && wearing[j] == 1)
  7250. return true;
  7251.  
  7252. return false;
  7253. }
  7254.  
  7255. private final void setPixelsAndAroundColour(int x, int y, int colour) {
  7256. gameGraphics.setPixelColour(x, y, colour);
  7257. gameGraphics.setPixelColour(x - 1, y, colour);
  7258. gameGraphics.setPixelColour(x + 1, y, colour);
  7259. gameGraphics.setPixelColour(x, y - 1, colour);
  7260. gameGraphics.setPixelColour(x, y + 1, colour);
  7261. }
  7262.  
  7263. private final void method119() {
  7264. for (int i = 0; i < mobMessageCount; i++) {
  7265. int j = gameGraphics.messageFontHeight(1);
  7266. int l = mobMessagesX[i];
  7267. int k1 = mobMessagesY[i];
  7268. int j2 = mobMessagesWidth[i];
  7269. int i3 = mobMessagesHeight[i];
  7270. boolean flag = true;
  7271. while (flag) {
  7272. flag = false;
  7273. for (int i4 = 0; i4 < i; i4++)
  7274. if (k1 + i3 > mobMessagesY[i4] - j && k1 - j < mobMessagesY[i4] + mobMessagesHeight[i4] && l - j2 < mobMessagesX[i4] +
  7275.  
  7276. mobMessagesWidth[i4] && l + j2 > mobMessagesX[i4] - mobMessagesWidth[i4] && mobMessagesY[i4] - j - i3 < k1) {
  7277. k1 = mobMessagesY[i4] - j - i3;
  7278. flag = true;
  7279. }
  7280.  
  7281. }
  7282. mobMessagesY[i] = k1;
  7283. gameGraphics.drawBoxTextColour(mobMessages[i], l, k1, 1, 0xffff00, 300);
  7284. }
  7285.  
  7286. for (int k = 0; k < anInt699; k++) {
  7287. int i1 = anIntArray858[k];
  7288. int l1 = anIntArray859[k];
  7289. int k2 = anIntArray705[k];
  7290. int j3 = anIntArray706[k];
  7291. int l3 = (39 * k2) / 100;
  7292. int j4 = (27 * k2) / 100;
  7293. int k4 = l1 - j4;
  7294. gameGraphics.spriteClip2(i1 - l3 / 2, k4, l3, j4, SPRITE_MEDIA_START + 9, 85);
  7295. int l4 = (36 * k2) / 100;
  7296. int i5 = (24 * k2) / 100;
  7297. gameGraphics.spriteClip4(i1 - l4 / 2, (k4 + j4 / 2) - i5 / 2, l4, i5, EntityHandler.getItemDef(j3).getSprite() + SPRITE_ITEM_START,
  7298.  
  7299. EntityHandler.getItemDef(j3).getPictureMask(), 0, 0, false);
  7300. }
  7301.  
  7302. for (int j1 = 0; j1 < anInt718; j1++) {
  7303. int i2 = anIntArray786[j1];
  7304. int l2 = anIntArray787[j1];
  7305. int k3 = anIntArray788[j1];
  7306. gameGraphics.drawBoxAlpha(i2 - 15, l2 - 3, k3, 5, 65280, 192);
  7307. gameGraphics.drawBoxAlpha((i2 - 15) + k3, l2 - 3, 30 - k3, 5, 0xff0000, 192);
  7308. }
  7309.  
  7310. }
  7311.  
  7312. private final void drawMapMenu(boolean flag) {
  7313. int i = ((GameImage) (gameGraphics)).menuDefaultWidth - 199;
  7314. char c = '\234';
  7315. char c2 = '\230';
  7316. gameGraphics.drawPicture(i - 49, 3, SPRITE_MEDIA_START + 2);
  7317. i += 40;
  7318. gameGraphics.drawBox(i, 36, c, c2, 0);
  7319. gameGraphics.setDimensions(i, 36, i + c, 36 + c2);
  7320. int k = 192 + anInt986;
  7321. int i1 = cameraRotation + anInt985 & 0xff;
  7322. int k1 = ((ourPlayer.currentX - 6040) * 3 * k) / 2048;
  7323. int i3 = ((ourPlayer.currentY - 6040) * 3 * k) / 2048;
  7324. int k4 = Camera.anIntArray384[1024 - i1 * 4 & 0x3ff];
  7325. int i5 = Camera.anIntArray384[(1024 - i1 * 4 & 0x3ff) + 1024];
  7326. int k5 = i3 * k4 + k1 * i5 >> 18;
  7327. i3 = i3 * i5 - k1 * k4 >> 18;
  7328. k1 = k5;
  7329. gameGraphics.method242((i + c / 2) - k1, 36 + c2 / 2 + i3, SPRITE_MEDIA_START - 1, i1 + 64 & 0xff, k);
  7330. for (int i7 = 0; i7 < objectCount; i7++) {
  7331. int l1 = (((objectX[i7] * magicLoc + 64) - ourPlayer.currentX) * 3 * k) / 2048;
  7332. int j3 = (((objectY[i7] * magicLoc + 64) - ourPlayer.currentY) * 3 * k) / 2048;
  7333. int l5 = j3 * k4 + l1 * i5 >> 18;
  7334. j3 = j3 * i5 - l1 * k4 >> 18;
  7335. l1 = l5;
  7336. setPixelsAndAroundColour(i + c / 2 + l1, (36 + c2 / 2) - j3, 65535);
  7337. }
  7338.  
  7339. for (int j7 = 0; j7 < groundItemCount; j7++) {
  7340. int i2 = (((groundItemX[j7] * magicLoc + 64) - ourPlayer.currentX) * 3 * k) / 2048;
  7341. int k3 = (((groundItemY[j7] * magicLoc + 64) - ourPlayer.currentY) * 3 * k) / 2048;
  7342. int i6 = k3 * k4 + i2 * i5 >> 18;
  7343. k3 = k3 * i5 - i2 * k4 >> 18;
  7344. i2 = i6;
  7345. setPixelsAndAroundColour(i + c / 2 + i2, (36 + c2 / 2) - k3, 0xff0000);
  7346. }
  7347.  
  7348. for (int k7 = 0; k7 < npcCount; k7++) {
  7349. Mob mob = npcArray[k7];
  7350. int j2 = ((mob.currentX - ourPlayer.currentX) * 3 * k) / 2048;
  7351. int l3 = ((mob.currentY - ourPlayer.currentY) * 3 * k) / 2048;
  7352. int j6 = l3 * k4 + j2 * i5 >> 18;
  7353. l3 = l3 * i5 - j2 * k4 >> 18;
  7354. j2 = j6;
  7355. setPixelsAndAroundColour(i + c / 2 + j2, (36 + c2 / 2) - l3, 0xffff00);
  7356. }
  7357.  
  7358. for (int l7 = 0; l7 < playerCount; l7++) {
  7359. Mob mob_1 = playerArray[l7];
  7360. int k2 = ((mob_1.currentX - ourPlayer.currentX) * 3 * k) / 2048;
  7361. int i4 = ((mob_1.currentY - ourPlayer.currentY) * 3 * k) / 2048;
  7362. int k6 = i4 * k4 + k2 * i5 >> 18;
  7363. i4 = i4 * i5 - k2 * k4 >> 18;
  7364. k2 = k6;
  7365. int j8 = 0xffffff;
  7366. for (int k8 = 0; k8 < super.friendsCount; k8++) {
  7367. if (mob_1.nameLong != super.friendsListLongs[k8] || super.friendsListOnlineStatus[k8] != 99)
  7368. continue;
  7369. j8 = 65280;
  7370. break;
  7371. }
  7372.  
  7373. setPixelsAndAroundColour(i + c / 2 + k2, (36 + c2 / 2) - i4, j8);
  7374. }
  7375.  
  7376. gameGraphics.method212(i + c / 2, 36 + c2 / 2, 2, 0xffffff, 255);
  7377. gameGraphics.method242(i + 19, 55, SPRITE_MEDIA_START + 24, cameraRotation + 128 & 0xff, 128);
  7378. gameGraphics.setDimensions(0, 0, windowWidth, windowHeight + 12);
  7379. if (!flag)
  7380. return;
  7381. i = super.mouseX - (((GameImage) (gameGraphics)).menuDefaultWidth - 199);
  7382. int i8 = super.mouseY - 36;
  7383. if (i >= 40 && i8 >= 0 && i < 196 && i8 < 152) {
  7384. char c1 = '\234';
  7385. char c3 = '\230';
  7386. int l = 192 + anInt986;
  7387. int j1 = cameraRotation + anInt985 & 0xff;
  7388. int j = ((GameImage) (gameGraphics)).menuDefaultWidth - 199;
  7389. j += 40;
  7390. int l2 = ((super.mouseX - (j + c1 / 2)) * 16384) / (3 * l);
  7391. int j4 = ((super.mouseY - (36 + c3 / 2)) * 16384) / (3 * l);
  7392. int l4 = Camera.anIntArray384[1024 - j1 * 4 & 0x3ff];
  7393. int j5 = Camera.anIntArray384[(1024 - j1 * 4 & 0x3ff) + 1024];
  7394. int l6 = j4 * l4 + l2 * j5 >> 15;
  7395. j4 = j4 * j5 - l2 * l4 >> 15;
  7396. l2 = l6;
  7397. l2 += ourPlayer.currentX;
  7398. j4 = ourPlayer.currentY - j4;
  7399. if(mouseButtonClick == 1)
  7400. {
  7401. method112(sectionX, sectionY, l2 / 128, j4 / 128, false);
  7402. } else
  7403. if(mouseButtonClick == 2 && showModCommands) {
  7404.  
  7405. sendChatString((new StringBuilder()).append("teleport ").append(areaX + l2 / 128).append(" ").append(areaY + j4 / 128).toString());
  7406. }
  7407. }
  7408. }
  7409.  
  7410. private mudclient() {
  7411. int count = 0;
  7412. for(File f : new File(Config.CONF_DIR + "/flags/").listFiles()) {
  7413. if(f.getName().endsWith(".gif")) {
  7414. try {
  7415. Sprite spr = Sprite.fromImage(ImageIO.read(f));
  7416. flags.put(f.getName().replace(".gif", "").toUpperCase(), spr);
  7417. } catch (IOException e) {
  7418. System.out.println("Error while loading the flag sprites");
  7419. e.printStackTrace();
  7420. } finally {
  7421. count++;
  7422. }
  7423. }
  7424. }
  7425. combatWindow = false;
  7426. showModCommands = false;
  7427. playerToKick = "";
  7428. threadSleepTime = 10;
  7429. try {
  7430. localhost = InetAddress.getLocalHost().getHostAddress();
  7431. } catch (Exception e) {
  7432. localhost = "unknown";
  7433. }
  7434. startTime = System.currentTimeMillis();
  7435. duelMyItems = new int[8];
  7436. duelMyItemsCount = new int[8];
  7437. configAutoCameraAngle = true;
  7438. questionMenuAnswer = new String[10];
  7439. lastNpcArray = new Mob[500];
  7440. currentUser = "";
  7441. currentPass = "";
  7442. menuText1 = new String[250];
  7443. duelOpponentAccepted = false;
  7444. duelMyAccepted = false;
  7445. tradeConfirmItems = new int[14];
  7446. tradeConfirmItemsCount = new int[14];
  7447. tradeConfirmOtherItems = new int[14];
  7448. tradeConfirmOtherItemsCount = new int[14];
  7449. serverMessage = "";
  7450. duelOpponentName = "";
  7451. inventoryItems = new int[35];
  7452. inventoryItemsCount = new int[35];
  7453. wearing = new int[35];
  7454. mobMessages = new String[50];
  7455. showBank = false;
  7456. doorModel = new Model[500];
  7457. mobMessagesX = new int[50];
  7458. mobMessagesY = new int[50];
  7459. mobMessagesWidth = new int[50];
  7460. mobMessagesHeight = new int[50];
  7461. npcArray = new Mob[500];
  7462. equipmentStatus = new int[6];
  7463. prayerOn = new boolean[50];
  7464. tradeOtherAccepted = false;
  7465. tradeWeAccepted = false;
  7466. mobArray = new Mob[8000];
  7467. anIntArray705 = new int[50];
  7468. anIntArray706 = new int[50];
  7469. lastWildYSubtract = -1;
  7470. memoryError = false;
  7471. bankItemsMax = 48;
  7472. showQuestionMenu = false;
  7473. magicLoc = 128;
  7474. cameraAutoAngle = 1;
  7475. anInt727 = 2;
  7476. showServerMessageBox = false;
  7477. hasReceivedWelcomeBoxDetails = false;
  7478. playerStatCurrent = new int[18];
  7479. wildYSubtract = -1;
  7480. anInt742 = -1;
  7481. anInt743 = -1;
  7482. anInt744 = -1;
  7483. sectionXArray = new int[8000];
  7484. sectionYArray = new int[8000];
  7485. selectedItem = -1;
  7486. selectedItemName = "";
  7487. duelOpponentItems = new int[8];
  7488. duelOpponentItemsCount = new int[8];
  7489. anIntArray757 = new int[50];
  7490. menuID = new int[250];
  7491. showCharacterLookScreen = false;
  7492. lastPlayerArray = new Mob[500];
  7493. appletMode = true;
  7494. gameDataModels = new Model[1000];
  7495. configMouseButtons = false;
  7496. duelNoRetreating = false;
  7497. duelNoMagic = false;
  7498. duelNoPrayer = false;
  7499. duelNoWeapons = false;
  7500. anIntArray782 = new int[50];
  7501. duelConfirmOpponentItems = new int[8];
  7502. duelConfirmOpponentItemsCount = new int[8];
  7503. anIntArray786 = new int[50];
  7504. anIntArray787 = new int[50];
  7505. anIntArray788 = new int[50];
  7506. objectModelArray = new Model[1500];
  7507. cameraRotation = 128;
  7508. showWelcomeBox = false;
  7509. characterBodyGender = 1;
  7510. character2Colour = 2;
  7511. characterHairColour = 2;
  7512. characterTopColour = 8;
  7513. characterBottomColour = 14;
  7514. characterHeadGender = 1;
  7515. selectedBankItem = -1;
  7516. selectedBankItemType = -2;
  7517. menuText2 = new String[250];
  7518. aBooleanArray827 = new boolean[1500];
  7519. playerStatBase = new int[18];
  7520. menuActionType = new int[250];
  7521. menuActionVariable = new int[250];
  7522. menuActionVariable2 = new int[250];
  7523. shopItems = new int[256];
  7524. shopItemCount = new int[256];
  7525. anIntArray858 = new int[50];
  7526. anIntArray859 = new int[50];
  7527. newBankItems = new int[256];
  7528. newBankItemsCount = new int[256];
  7529. duelConfirmMyItems = new int[8];
  7530. duelConfirmMyItemsCount = new int[8];
  7531. mobArrayIndexes = new int[500];
  7532. messagesTimeout = new int[5];
  7533. objectX = new int[1500];
  7534. objectY = new int[1500];
  7535. objectType = new int[1500];
  7536. objectID = new int[1500];
  7537. menuActionX = new int[250];
  7538. menuActionY = new int[250];
  7539. ourPlayer = new Mob();
  7540. serverIndex = -1;
  7541. anInt882 = 30;
  7542. showTradeConfirmWindow = false;
  7543. tradeConfirmAccepted = false;
  7544. playerArray = new Mob[500];
  7545. serverMessageBoxTop = false;
  7546. cameraHeight = 550;
  7547. bankItems = new int[256];
  7548. bankItemsCount = new int[256];
  7549. notInWilderness = false;
  7550. selectedSpell = -1;
  7551. anInt911 = 2;
  7552. tradeOtherItems = new int[14];
  7553. tradeOtherItemsCount = new int[14];
  7554. menuIndexes = new int[250];
  7555. zoomCamera = false;
  7556. playerStatExperience = new int[18];
  7557. cameraAutoAngleDebug = false;
  7558. npcRecordArray = new Mob[8000];
  7559. showDuelWindow = false;
  7560. anIntArray923 = new int[50];
  7561. lastLoadedNull = false;
  7562. experienceArray = new int[99];
  7563. showShop = false;
  7564. mouseClickXArray = new int[8192];
  7565. mouseClickYArray = new int[8192];
  7566. showDuelConfirmWindow = false;
  7567. duelWeAccept = false;
  7568. doorX = new int[500];
  7569. doorY = new int[500];
  7570. configSoundEffects = false;
  7571. showRightClickMenu = false;
  7572. attackingInt40 = 40;
  7573. anIntArray944 = new int[50];
  7574. doorDirection = new int[500];
  7575. doorType = new int[500];
  7576. groundItemX = new int[8000];
  7577. groundItemY = new int[8000];
  7578. groundItemType = new int[8000];
  7579. groundItemObjectVar = new int[8000];
  7580. selectedShopItemIndex = -1;
  7581. selectedShopItemType = -2;
  7582. messagesArray = new String[5];
  7583. showTradeWindow = false;
  7584. aBooleanArray970 = new boolean[500];
  7585. tradeMyItems = new int[14];
  7586. tradeMyItemsCount = new int[14];
  7587. windowWidth = 512;
  7588. windowHeight = 334;
  7589. cameraSizeInt = 9;
  7590. tradeOtherPlayerName = "";
  7591. }
  7592.  
  7593. private boolean combatWindow;
  7594. private int lastLoggedInDays;
  7595. private int subscriptionLeftDays;
  7596. public static boolean fogOfWar = false;
  7597. private int duelMyItemCount;
  7598. private int duelMyItems[];
  7599. private int duelMyItemsCount[];
  7600. private boolean configAutoCameraAngle;
  7601. private String questionMenuAnswer[];
  7602. private int anInt658;
  7603. private int handlePacketErrorCount;
  7604. private Mob lastNpcArray[];
  7605. private int loginButtonNewUser;
  7606. private int loginButtonExistingUser;
  7607. private String currentUser;
  7608. private String currentPass;
  7609. public boolean showGroundItems = true;
  7610. private int lastWalkTimeout;
  7611. private String menuText1[];
  7612. private boolean duelOpponentAccepted;
  7613. private boolean duelMyAccepted;
  7614. private int tradeConfirmItemCount;
  7615. private int tradeConfirmItems[];
  7616. private int tradeConfirmItemsCount[];
  7617. private int tradeConfirmOtherItemCount;
  7618. private int tradeConfirmOtherItems[];
  7619. private int tradeConfirmOtherItemsCount[];
  7620. private String serverMessage;
  7621. private String duelOpponentName;
  7622. private int mouseOverBankPageText;
  7623. private int playerCount;
  7624. private int lastPlayerCount;
  7625. private int fightCount;
  7626. private int inventoryCount;
  7627. private int inventoryItems[];
  7628. private int inventoryItemsCount[];
  7629. private int wearing[];
  7630. private int mobMessageCount;
  7631. String mobMessages[];
  7632. private boolean showBank;
  7633. private Model doorModel[];
  7634. private int mobMessagesX[];
  7635. private int mobMessagesY[];
  7636. private int mobMessagesWidth[];
  7637. private int mobMessagesHeight[];
  7638. private Mob npcArray[];
  7639. private int equipmentStatus[];
  7640. private final int characterTopBottomColours[] = {0xff0000, 0xff8000, 0xffe000, 0xa0e000, 57344, 32768, 41088, 45311, 33023, 12528, 0xe000e0, 0x303030,
  7641.  
  7642. 0x604000, 0x805000, 0xffffff};
  7643. private int loginScreenNumber;
  7644. private int anInt699;
  7645. private boolean prayerOn[];
  7646. private boolean tradeOtherAccepted;
  7647. private boolean tradeWeAccepted;
  7648. private Mob mobArray[];
  7649. private int npcCombatModelArray1[] = {0, 1, 2, 1, 0, 0, 0, 0};
  7650. private int anIntArray705[];
  7651. private int anIntArray706[];
  7652. private int npcCount;
  7653. private int lastNpcCount;
  7654. private int wildX;
  7655. private int wildY;
  7656. private int wildYMultiplier;
  7657. private int lastWildYSubtract;
  7658. private boolean memoryError;
  7659. private int bankItemsMax;
  7660. private int mouseOverMenu;
  7661. private int walkModel[] = {0, 1, 2, 1};
  7662. private boolean showQuestionMenu;
  7663. private int anInt718;
  7664. private int magicLoc;
  7665. private int loggedIn;
  7666. private int cameraAutoAngle;
  7667. private int cameraRotationBaseAddition;
  7668. private Menu spellMenu;
  7669. int spellMenuHandle;
  7670. int menuMagicPrayersSelected;
  7671. private int screenRotationX;
  7672. private int anInt727;
  7673. private int showAbuseWindow;
  7674. private int duelCantRetreat;
  7675. private int duelUseMagic;
  7676. private int duelUsePrayer;
  7677. private int duelUseWeapons;
  7678. private boolean showServerMessageBox;
  7679. private boolean hasReceivedWelcomeBoxDetails;
  7680. private String lastLoggedInAddress;
  7681. private int loginTimer;
  7682. private int playerStatCurrent[];
  7683. private int areaX;
  7684. private int areaY;
  7685. private int wildYSubtract;
  7686. private int anInt742;
  7687. private int anInt743;
  7688. private int anInt744;
  7689. private int sectionXArray[];
  7690. private int sectionYArray[];
  7691. private int selectedItem;
  7692. String selectedItemName;
  7693. private int menuX;
  7694. private int menuY;
  7695. private int menuWidth;
  7696. private int menuHeight;
  7697. private int menuLength;
  7698. private int duelOpponentItemCount;
  7699. private int duelOpponentItems[];
  7700. private int duelOpponentItemsCount[];
  7701. private int anIntArray757[];
  7702. private int menuID[];
  7703. private boolean showCharacterLookScreen;
  7704. private int newBankItemCount;
  7705. private int npcCombatModelArray2[] = {0, 0, 0, 0, 0, 1, 2, 1};
  7706. private Mob lastPlayerArray[];
  7707. private int inputBoxType;
  7708. private boolean appletMode;
  7709. private int combatStyle;
  7710. private Model gameDataModels[];
  7711. private boolean configMouseButtons;
  7712. private boolean duelNoRetreating;
  7713. private boolean duelNoMagic;
  7714. private boolean duelNoPrayer;
  7715. private boolean duelNoWeapons;
  7716. private int anIntArray782[];
  7717. private int duelConfirmOpponentItemCount;
  7718. private int duelConfirmOpponentItems[];
  7719. private int duelConfirmOpponentItemsCount[];
  7720. private int anIntArray786[];
  7721. private int anIntArray787[];
  7722. private int anIntArray788[];
  7723. private int anInt789;
  7724. private int anInt790;
  7725. private int anInt791;
  7726. private int anInt792;
  7727. private Menu menuLogin;
  7728. private final int characterHairColours[] = {0xffc030, 0xffa040, 0x805030, 0x604020, 0x303030, 0xff6020, 0xff4000, 0xffffff, 65280, 65535};
  7729. private Model objectModelArray[];
  7730. private Menu menuWelcome;
  7731. private int systemUpdate;
  7732. private int pvpTime;
  7733. private int wildernessTime;
  7734. private int dropPartyTime;
  7735. private int cameraRotation;
  7736. private int logoutTimeout;
  7737. private Menu gameMenu;
  7738. int messagesHandleType2;
  7739. int chatHandle;
  7740. int messagesHandleType5;
  7741. int messagesHandleType6;
  7742. int messagesHandleType7;
  7743. int messagesTab;
  7744. private boolean showWelcomeBox;
  7745. private int characterHeadType;
  7746. private int characterBodyGender;
  7747. private int character2Colour;
  7748. private int characterHairColour;
  7749. private int characterTopColour;
  7750. private int characterBottomColour;
  7751. private int characterSkinColour;
  7752. private int characterHeadGender;
  7753. private int loginStatusText;
  7754. private int loginUsernameTextBox;
  7755. private int loginPasswordTextBox;
  7756. private int loginOkButton;
  7757. private int loginCancelButton;
  7758. private int selectedBankItem;
  7759. private int selectedBankItemType;
  7760. private String menuText2[];
  7761. //private Menu questMenu;
  7762. //int questMenuHandle;
  7763. int anInt826;
  7764. private boolean aBooleanArray827[];
  7765. private int playerStatBase[];
  7766. private int abuseSelectedType;
  7767. private int actionPictureType;
  7768. int actionPictureX;
  7769. int actionPictureY;
  7770. private int menuActionType[];
  7771. private int menuActionVariable[];
  7772. private int menuActionVariable2[];
  7773. private int shopItems[];
  7774. private int shopItemCount[];
  7775. private int npcAnimationArray[][] = {
  7776. {11, 2, 9, 7, 1, 6, 10, 0, 5, 8, 3, 4},
  7777. {11, 2, 9, 7, 1, 6, 10, 0, 5, 8, 3, 4},
  7778. {11, 3, 2, 9, 7, 1, 6, 10, 0, 5, 8, 4},
  7779. {3, 4, 2, 9, 7, 1, 6, 10, 8, 11, 0, 5},
  7780. {3, 4, 2, 9, 7, 1, 6, 10, 8, 11, 0, 5},
  7781. {4, 3, 2, 9, 7, 1, 6, 10, 8, 11, 0, 5},
  7782. {11, 4, 2, 9, 7, 1, 6, 10, 0, 5, 8, 3},
  7783. {11, 2, 9, 7, 1, 6, 10, 0, 5, 8, 4, 3}
  7784. };
  7785. private int bankItemCount;
  7786. private int characterDesignHeadButton1;
  7787. private int characterDesignHeadButton2;
  7788. private int characterDesignHairColourButton1;
  7789. private int characterDesignHairColourButton2;
  7790. private int characterDesignGenderButton1;
  7791. private int characterDesignGenderButton2;
  7792. private int characterDesignTopColourButton1;
  7793. private int characterDesignTopColourButton2;
  7794. private int characterDesignSkinColourButton1;
  7795. private int characterDesignSkinColourButton2;
  7796. private int characterDesignBottomColourButton1;
  7797. private int characterDesignBottomColourButton2;
  7798. private int characterDesignAcceptButton;
  7799. private int anIntArray858[];
  7800. private int anIntArray859[];
  7801. private int newBankItems[];
  7802. private int newBankItemsCount[];
  7803. private int duelConfirmMyItemCount;
  7804. private int duelConfirmMyItems[];
  7805. private int duelConfirmMyItemsCount[];
  7806. private int mobArrayIndexes[];
  7807. private Menu menuNewUser;
  7808. private int messagesTimeout[];
  7809. private int lastAutoCameraRotatePlayerX;
  7810. private int lastAutoCameraRotatePlayerY;
  7811. private int questionMenuCount;
  7812. private int objectX[];
  7813. private int objectY[];
  7814. private int objectType[];
  7815. private int objectID[];
  7816. private int menuActionX[];
  7817. private int menuActionY[];
  7818. private Mob ourPlayer;
  7819. int sectionX;
  7820. int sectionY;
  7821. int serverIndex;
  7822. private int anInt882;
  7823. private int mouseDownTime;
  7824. private int itemIncrement;
  7825. private int groundItemCount;
  7826. private int modelFireLightningSpellNumber;
  7827. private int modelTorchNumber;
  7828. private int modelClawSpellNumber;
  7829. private boolean showTradeConfirmWindow;
  7830. private boolean tradeConfirmAccepted;
  7831. private int anInt892;
  7832. private EngineHandle engineHandle;
  7833. private Mob playerArray[];
  7834. private boolean serverMessageBoxTop;
  7835. private final String equipmentStatusName[] = {"Armour", "WeaponAim", "WeaponPower", "Magic", "Prayer", "Range"};
  7836. private final String killingSpreeRank[] = {"No Rank", "Noob", "Pker", "Hitman", "Assassin", "Legend"};
  7837. private int referId;
  7838. private int anInt900;
  7839. private int newUserOkButton;
  7840. private int mouseButtonClick;
  7841. private int cameraHeight;
  7842. private int bankItems[];
  7843. private int bankItemsCount[];
  7844. private boolean notInWilderness;
  7845. private int selectedSpell;
  7846. private int screenRotationY;
  7847. private int anInt911;
  7848. private int tradeOtherItemCount;
  7849. private int tradeOtherItems[];
  7850. private int tradeOtherItemsCount[];
  7851. private int menuIndexes[];
  7852. private boolean zoomCamera;
  7853. private AudioReader audioReader;
  7854. private int playerStatExperience[];
  7855. private boolean cameraAutoAngleDebug;
  7856. private Mob npcRecordArray[];
  7857. private final String skillArray[] = {"Att", "Def", "Str", "HP", "Range", "Pray", "Mage", "Cooking", "Woodcut", "Fletching", "Fishing", "Firemaking",
  7858.  
  7859. "Crafting", "Smithing", "Mining", "Herblaw", "Agility", "Thieving"};
  7860. private boolean showDuelWindow;
  7861. private int anIntArray923[];
  7862. private GameImageMiddleMan gameGraphics;
  7863. private final String skillArrayLong[] = {"Att", "Def", "Str", "HP", "Range", "Prayer", "Magic", "Cooking", "Woodcutting", "Fletching", "Fishing",
  7864.  
  7865. "Firemaking", "Crafting", "Smithing", "Mining", "Herblaw", "Agility", "Thieving"};
  7866. private boolean lastLoadedNull;
  7867. private int experienceArray[];
  7868. private Camera gameCamera;
  7869. private boolean showShop;
  7870. private int mouseClickArrayOffset;
  7871. int mouseClickXArray[];
  7872. int mouseClickYArray[];
  7873. private boolean showDuelConfirmWindow;
  7874. private boolean duelWeAccept;
  7875. private Graphics aGraphics936;
  7876. private int doorX[];
  7877. private int doorY[];
  7878. private int wildernessType;
  7879. private boolean configSoundEffects;
  7880. private boolean showRightClickMenu;
  7881. private int screenRotationTimer;
  7882. private int attackingInt40;
  7883. private int anIntArray944[];
  7884. private Menu characterDesignMenu;
  7885. private int shopItemSellPriceModifier;
  7886. private int shopItemBuyPriceModifier;
  7887. private int modelUpdatingTimer;
  7888. private int doorCount;
  7889. private int doorDirection[];
  7890. private int doorType[];
  7891. private int anInt952;
  7892. private int anInt953;
  7893. private int anInt954;
  7894. private int anInt955;
  7895. private int anInt956;
  7896. private int groundItemX[];
  7897. private int groundItemY[];
  7898. private int groundItemType[];
  7899. private int groundItemObjectVar[];
  7900. private int selectedShopItemIndex;
  7901. private int selectedShopItemType;
  7902. private String messagesArray[];
  7903. private long tradeConfirmOtherNameLong;
  7904. private boolean showTradeWindow;
  7905. private int playerAliveTimeout;
  7906. private final int characterSkinColours[] = {0xecded0, 0xccb366, 0xb38c40, 0x997326, 0x906020};
  7907. private byte sounds[];
  7908. private boolean aBooleanArray970[];
  7909. private int objectCount;
  7910. private int tradeMyItemCount;
  7911. private int tradeMyItems[];
  7912. private int tradeMyItemsCount[];
  7913. private int windowWidth;
  7914. private int windowHeight;
  7915. private int cameraSizeInt;
  7916. private Menu friendsMenu;
  7917. int friendsMenuHandle;
  7918. int anInt981;
  7919. long privateMessageTarget;
  7920. private long duelOpponentNameLong;
  7921. private String tradeOtherPlayerName;
  7922. private int anInt985;
  7923. private int anInt986;
  7924. private int maxHit;
  7925. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement