Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 178.26 KB | None | 0 0
  1. /*
  2. * Class Player
  3. *
  4. * Version 1.0
  5. *
  6. * Thursday, August 14, 2008
  7. *
  8. * Created by Palidino76 Codeusa
  9. */
  10.  
  11. package net.com.codeusa.model;
  12.  
  13. import java.io.FileWriter;
  14. import java.io.BufferedReader;
  15. import java.io.BufferedWriter;
  16. import java.io.FileReader;
  17. import java.io.IOException;
  18. import java.net.Socket;
  19. import net.com.codeusa.test.TestWorldLoader;
  20. import net.com.codeusa.model.misc.*;
  21. import net.com.codeusa.model.games.*;
  22. import net.com.codeusa.model.combat.*;
  23. import net.com.codeusa.*;
  24. import net.com.codeusa.io.*;
  25. import net.com.codeusa.net.PlayerSocket;
  26. import net.com.codeusa.util.ByteVector;
  27. import net.com.codeusa.util.Misc;
  28. import net.com.codeusa.npcs.NPC;
  29. import net.com.codeusa.model.items.*;
  30. import net.com.codeusa.model.items.PlayerWeapon;
  31. import net.com.codeusa.model.ptrade.PTrade;
  32. import net.com.codeusa.model.games.BountyHunter;
  33. import net.com.codeusa.util.UserInput;
  34. import net.com.codeusa.Server;
  35. import net.com.codeusa.model.PlayerFollow;
  36. import net.com.codeusa.model.eventmanager.*;
  37. import java.util.*;
  38. import java.lang.*;
  39.  
  40. public class Player implements Entity {
  41.  
  42.  
  43.  
  44. /**
  45. * Summoning variables
  46. */
  47.  
  48. public int inputId = -1;
  49. public int summoningon = 0;
  50. public boolean alreadyFade = false;
  51. /**
  52. * Set leveled up
  53. */
  54. public boolean[] leveledUp = new boolean[24];
  55. public int leveledUpSkill = 0;
  56. public int skillMenu = 0;
  57. public int shadowspell = 20;
  58. public int Fading;
  59. public int nextInterface = 0;
  60. public boolean nextDelayInterface = false;
  61. public void setNextDelay(int i) {
  62. this.nextInterface = i;
  63. }
  64. public int justSwitched = 0;
  65. public String clanRoom = "";
  66.  
  67.  
  68. /**
  69. * Bounty hunter variables
  70. */
  71. public boolean inLowBounty = false;
  72. public boolean inMedBounty = false;
  73. public boolean inHighBounty = false;
  74. public int bountyMaxPlayers = 100;
  75. public boolean bountyInterface = false;
  76. public int BhTimer;
  77. public int leftBhTimer = 0;
  78. public boolean swapAsNote = false;
  79. public boolean DFSSpecial;
  80. public long lastDFS;
  81. public int DFSDelay = -1;
  82. public int InBounty = 0;
  83. public int bhPickup;
  84. public int bhLeave;
  85. public int bhTarget = 0;
  86. public int switchSpells = 0;
  87. public int bhLeave1;
  88. public boolean inBounty = false;
  89. public int serverMsg;
  90. public int pickedUp;
  91. public int bhRogue = 0;
  92. public int bhHunter = 0;
  93. public String OriginalAttacker;
  94. public int randomSkill;
  95. public int chosenSkill;
  96. public int actionTimer = 0;
  97. public int enterbhenter = 0;
  98.  
  99. public int clawReset = 0;
  100. /*
  101. * Items kept on death
  102. */
  103. public int[] ikod = new int[3];
  104.  
  105. public void calculateIKOD() {
  106. int amountOfKeptItems = isSkulled ? (usingPrayer(10) ? 1 : 0) : (usingPrayer(10) ? 4 : 3);
  107. int[] allItems = new int[items.length + equipment.length];
  108. int[] allItemsN = new int[itemsN.length + equipmentN.length];
  109. int[] keptItems = new int[amountOfKeptItems];
  110. int[] toAdd = new int[keptItems.length];
  111. System.arraycopy(items, 0, allItems, 0, items.length);
  112. System.arraycopy(equipment, 0, allItems, items.length, equipment.length);
  113. System.arraycopy(itemsN, 0, allItemsN, 0, itemsN.length);
  114. System.arraycopy(equipmentN, 0, allItemsN, itemsN.length, equipmentN.length);
  115. for (int i = 0; i < keptItems.length; i++) {
  116. int index = 0;
  117. int standing = 0;
  118. for (int j = 0; j < allItems.length; j++) {
  119. if (allItems[j] < 1) {
  120. continue;
  121. }
  122. int price = (int)Math.round(1.10 * (1 * getItemValue(allItems[j])));
  123. if (price > standing) {
  124. index = j;
  125. standing = price;
  126. }
  127. }
  128. keptItems[i] = allItems[index];
  129. toAdd[i] = allItems[index];
  130. allItemsN[index]--;
  131. if (allItemsN[index] == 0) {
  132. allItems[index] = 0;
  133. }
  134. }
  135. for (int i = 0; i < keptItems.length; i++) {
  136. ikod[i] = keptItems[i];
  137. if (ikod[i] == 0) ikod[i] = 6564;
  138. }
  139. }
  140.  
  141. public void randomEvent() {
  142. getActionSender().showInterface(this, 134);
  143. getActionSender().showChatboxInterface(this, 210);
  144. randomtime(this);
  145. actionTimer = 10000;
  146. randomSkill = Misc.random(23);
  147. getActionSender().setString(this, "Please click on " + Misc.getSkillName(randomSkill) +":", 210, 1);
  148. }
  149.  
  150. public void randomEvent2() {
  151. if (chosenSkill == randomSkill) {
  152. getActionSender().sendMessage(this, "Correct! You may continue.");
  153. getActionSender().sendMessage(this, "You have been rewarded 5000gp for completeing the random event.");
  154. Engine.playerItems.addItem(this, 995, 5000);
  155. actionTimer = 1;
  156. }else {
  157. disconnected[0] = true;
  158. }
  159. }
  160.  
  161. public void Thieving(Player p, int itemid, int lvlreq, int tvXP, int Amnt) {
  162. if (p.skillLvl[17] < lvlreq){
  163. p.getActionSender().sendMessage(p, "You need to be level " +lvlreq+ " Thieving for this.");//send message if player doesent have correct lvl
  164. return;
  165. }
  166. p.getActionSender().sendMessage(p, "You Thieve " +Amnt+ "GP.");//give player message that he theived
  167. Engine.playerItems.addItem(p, itemid, Amnt);//adds item theived
  168. p.addSkillXP(tvXP, 17);//add exp to theive level
  169. p.requestAnim(881, 0);//animation u want player to do
  170. p.isthieveing = true;
  171. }
  172.  
  173.  
  174. public static String bountyRogue[] = {
  175. "Nobody yet", "Nobody yet", "Nobody yet", "Nobody yet", "Nobody yet",
  176. "Nobody yet", "Nobody yet", "Nobody yet", "Nobody yet", "Nobody yet"
  177. };
  178. public static String bountyHunter[] = {
  179. "Nobody yet", "Nobody yet", "Nobody yet", "Nobody yet", "Nobody yet",
  180. "Nobody yet", "Nobody yet", "Nobody yet", "Nobody yet", "Nobody yet"
  181. };
  182. public static int bountyRogueScore[] = {
  183. 0, 0, 0, 0, 0,
  184. 0, 0, 0, 0, 0
  185. };
  186. public static int bountyHunterScore[] = {
  187. 0, 0, 0, 0, 0,
  188. 0, 0, 0, 0, 0
  189. };
  190.  
  191. public int mageDefence() {
  192. int defence = skillLvl[1]/2 + skillLvl[6]/2;
  193. if (usingPrayer(0))
  194. defence += skillLvl[1] * 0.05;
  195. if (usingPrayer(5))
  196. defence += skillLvl[1] * 0.10;
  197. if (usingPrayer(13))
  198. defence += skillLvl[1] * 0.15;
  199. if (usingPrayer(25))
  200. defence += skillLvl[1] * 0.20;
  201. if (usingPrayer(26))
  202. defence += skillLvl[1] * 0.25;
  203. return (int) (defence + equipmentBonus[8] + (equipmentBonus[8] / 3));
  204. }
  205.  
  206. public void openHunterScores() {
  207. setHunterPlace(10);
  208. getActionSender().showInterface(this, 654);
  209. this.getActionSender().setString(this, bountyHunter[0] , 654, 15); //1st Place
  210. this.getActionSender().setString(this, bountyHunter[1] , 654, 16); //2nd Place
  211. this.getActionSender().setString(this, bountyHunter[2] , 654, 17); //3rd Place
  212. this.getActionSender().setString(this, bountyHunter[3] , 654, 18); //4th Place
  213. this.getActionSender().setString(this, bountyHunter[4] , 654, 19); //5th Place
  214. this.getActionSender().setString(this, bountyHunter[5] , 654, 20); //6th Place
  215. this.getActionSender().setString(this, bountyHunter[6] , 654, 21); //7th Place
  216. this.getActionSender().setString(this, bountyHunter[7] , 654, 22); //8th Place
  217. this.getActionSender().setString(this, bountyHunter[8] , 654, 23); //9th Place
  218. this.getActionSender().setString(this, bountyHunter[9] , 654, 24); //10th Place
  219. this.getActionSender().setString(this, ""+bountyHunterScore[0] , 654, 25); //1st Place score
  220. this.getActionSender().setString(this, ""+bountyHunterScore[1] , 654, 26); //2nd Place score
  221. this.getActionSender().setString(this, ""+bountyHunterScore[2] , 654, 27); //3rd Place score
  222. this.getActionSender().setString(this, ""+bountyHunterScore[3] , 654, 28); //4th Place score
  223. this.getActionSender().setString(this, ""+bountyHunterScore[4] , 654, 29); //5th Place score
  224. this.getActionSender().setString(this, ""+bountyHunterScore[5] , 654, 30); //6th Place score
  225. this.getActionSender().setString(this, ""+bountyHunterScore[6] , 654, 31); //7th Place score
  226. this.getActionSender().setString(this, ""+bountyHunterScore[7] , 654, 32); //8th Place score
  227. this.getActionSender().setString(this, ""+bountyHunterScore[8] , 654, 33); //9th Place score
  228. this.getActionSender().setString(this, ""+bountyHunterScore[9] , 654, 34); //10th Place score
  229. return;
  230. }
  231. public void openRogueScores() {
  232. setRoguePlace(10);
  233. getActionSender().showInterface(this, 655);
  234. this.getActionSender().setString(this, bountyRogue[0] , 655, 18); //1st Place
  235. this.getActionSender().setString(this, bountyRogue[1] , 655, 19); //2nd Place
  236. this.getActionSender().setString(this, bountyRogue[2] , 655, 20); //3rd Place
  237. this.getActionSender().setString(this, bountyRogue[3] , 655, 21); //4th Place
  238. this.getActionSender().setString(this, bountyRogue[4] , 655, 22); //5th Place
  239. this.getActionSender().setString(this, bountyRogue[5] , 655, 23); //6th Place
  240. this.getActionSender().setString(this, bountyRogue[6] , 655, 24); //7th Place
  241. this.getActionSender().setString(this, bountyRogue[7] , 655, 25); //8th Place
  242. this.getActionSender().setString(this, bountyRogue[8] , 655, 26); //9th Place
  243. this.getActionSender().setString(this, bountyRogue[9] , 655, 27); //10th Place
  244. this.getActionSender().setString(this, ""+bountyRogueScore[0] , 655, 28); //1st Place score
  245. this.getActionSender().setString(this, ""+bountyRogueScore[1] , 655, 29); //2nd Place score
  246. this.getActionSender().setString(this, ""+bountyRogueScore[2] , 655, 30); //3rd Place score
  247. this.getActionSender().setString(this, ""+bountyRogueScore[3] , 655, 31); //4th Place score
  248. this.getActionSender().setString(this, ""+bountyRogueScore[4] , 655, 32); //5th Place score
  249. this.getActionSender().setString(this, ""+bountyRogueScore[5] , 655, 33); //6th Place score
  250. this.getActionSender().setString(this, ""+bountyRogueScore[6] , 655, 34); //7th Place score
  251. this.getActionSender().setString(this, ""+bountyRogueScore[7] , 655, 35); //8th Place score
  252. this.getActionSender().setString(this, ""+bountyRogueScore[8] , 655, 36); //9th Place score
  253. this.getActionSender().setString(this, ""+bountyRogueScore[9] , 655, 37); //10th Place score
  254. return;
  255. }
  256.  
  257. public void updateScoreBoards() {
  258. if (Engine.getPlayerCount() < 10) {
  259. message("Score boards only activate when there are more than 10 people online.");
  260. return;
  261. }
  262. setRoguePlace(10);
  263. setHunterPlace(10);
  264. return;
  265. }
  266.  
  267. public void setHunterPlace(int line) {
  268. //test:
  269. for (Player pl : Server.engine.players) {
  270. if (pl != null) {
  271. switch (line) {
  272. case 10:
  273. if (bhHunter < pl.bhHunter && bhHunter != 0) {
  274. pl.bountyHunter[9] = username;
  275. pl.bountyHunterScore[9] = bhHunter;
  276. setHunterPlace(9);
  277. }
  278. break;
  279. case 9:
  280. if (bhHunter > bountyHunterScore[9]) {
  281. pl.bountyHunter[8] = username;
  282. pl.bountyHunterScore[8] = bhHunter;
  283. setHunterPlace(8);
  284. }
  285. break;
  286. case 8:
  287. if (bhHunter > bountyHunterScore[8]) {
  288. pl.bountyHunter[7] = username;
  289. pl.bountyHunterScore[7] = bhHunter;
  290. setHunterPlace(7);
  291. }
  292. break;
  293. case 7:
  294. if (bhHunter > bountyHunterScore[7]) {
  295. pl.bountyHunter[6] = username;
  296. pl.bountyHunterScore[6] = bhHunter;
  297. setHunterPlace(6);
  298. }
  299. break;
  300. case 6:
  301. if (bhHunter > bountyHunterScore[6]) {
  302. pl.bountyHunter[5] = username;
  303. pl.bountyHunterScore[5] = bhHunter;
  304. setHunterPlace(5);
  305. }
  306. break;
  307. case 5:
  308. if (bhHunter > bountyHunterScore[5]) {
  309. pl.bountyHunter[4] = username;
  310. pl.bountyHunterScore[4] = bhHunter;
  311. setHunterPlace(4);
  312. }
  313. break;
  314. case 4:
  315. if (bhHunter > bountyHunterScore[4]) {
  316. pl.bountyHunter[3] = username;
  317. pl.bountyHunterScore[3] = bhHunter;
  318. setHunterPlace(3);
  319. }
  320. break;
  321. case 3:
  322. if (bhHunter > bountyHunterScore[3]) {
  323. pl.bountyHunter[2] = username;
  324. pl.bountyHunterScore[2] = bhHunter;
  325. setHunterPlace(2);
  326. }
  327. break;
  328. case 2:
  329. if (bhHunter > bountyHunterScore[2]) {
  330. pl.bountyHunter[1] = username;
  331. pl.bountyHunterScore[1] = bhHunter;
  332. setHunterPlace(1);
  333. }
  334. break;
  335. case 1:
  336. if (bhHunter > bountyHunterScore[1]) {
  337. pl.bountyHunter[0] = username;
  338. pl.bountyHunterScore[0] = bhHunter;
  339. }
  340. break;
  341. }
  342. }
  343. }
  344. }
  345. public void setRoguePlace(int line) {
  346. for (Player pl : Server.engine.players) {
  347. if (pl != null) {
  348. switch (line) {
  349. case 10:
  350. if (bhRogue < pl.bhRogue && bhRogue != 0) {
  351. pl.bountyRogue[9] = username;
  352. pl.bountyRogueScore[9] = bhRogue;
  353. pl.setRoguePlace(9);
  354. }
  355. break;
  356. case 9:
  357. if (bhRogue > bountyRogueScore[9]) {
  358. pl.bountyRogue[8] = username;
  359. pl.bountyRogueScore[8] = bhRogue;
  360. pl.setRoguePlace(8);
  361. }
  362. break;
  363. case 8:
  364. if (bhRogue > bountyRogueScore[8]) {
  365. pl.bountyRogue[7] = username;
  366. pl.bountyRogueScore[7] = bhRogue;
  367. pl.setRoguePlace(7);
  368. }
  369. break;
  370. case 7:
  371. if (bhRogue > bountyRogueScore[7]) {
  372. pl.bountyRogue[6] = username;
  373. pl.bountyRogueScore[6] = bhRogue;
  374. pl.setRoguePlace(6);
  375. }
  376. break;
  377. case 6:
  378. if (bhRogue > bountyRogueScore[6]) {
  379. pl.bountyRogue[5] = username;
  380. pl.bountyRogueScore[5] = bhRogue;
  381. pl.setRoguePlace(5);
  382. }
  383. break;
  384. case 5:
  385. if (bhRogue > bountyRogueScore[5]) {
  386. pl.bountyRogue[4] = username;
  387. pl.bountyRogueScore[4] = bhRogue;
  388. pl.setRoguePlace(4);
  389. }
  390. break;
  391. case 4:
  392. if (bhRogue > bountyRogueScore[4]) {
  393. pl.bountyRogue[3] = username;
  394. pl.bountyRogueScore[3] = bhRogue;
  395. pl.setRoguePlace(3);
  396. }
  397. break;
  398. case 3:
  399. if (bhRogue > bountyRogueScore[3]) {
  400. pl.bountyRogue[2] = username;
  401. pl.bountyRogueScore[2] = bhRogue;
  402. pl.setRoguePlace(2);
  403. }
  404. break;
  405. case 2:
  406. if (bhRogue > bountyRogueScore[2]) {
  407. pl.bountyRogue[1] = username;
  408. pl.bountyRogueScore[1] = bhRogue;
  409. pl.setRoguePlace(1);
  410. }
  411. break;
  412. case 1:
  413. if (bhRogue > bountyRogueScore[1]) {
  414. pl.bountyRogue[0] = username;
  415. pl.bountyRogueScore[0] = bhRogue;
  416. }
  417. break;
  418. }
  419. }
  420. }
  421. }
  422.  
  423.  
  424.  
  425. public static boolean systemUpdating = false;
  426.  
  427.  
  428. /**
  429. * Add experiance to a specific skill.
  430. * @param amount The amoubt of XP you want to add.
  431. * @param skill The skill id you want to add it to.
  432. */
  433. public void addSkillXP(double amount, int skill) {
  434. if(skill > skillXP.length || skill < 0) {
  435. return;
  436. }
  437. int oldLevel = getLevelForXP(skill);
  438. skillXP[skill] += amount;
  439. int newLevel = getLevelForXP(skill);
  440. if(oldLevel < newLevel) {
  441. if(skill == 3) {
  442. updateHP(newLevel - oldLevel, true);
  443. } else {
  444. skillLvl[skill] += (newLevel - oldLevel);
  445. }
  446. getActionSender().setSkillLvl(this, skill);
  447. appearanceUpdateReq = true;
  448. updateReq = true;
  449. }
  450. getActionSender().setSkillLvl(this, skill);
  451. }
  452.  
  453.  
  454. public int itemSet;
  455. public UserInput input = new UserInput(this);
  456. public boolean clickOnce;
  457. public int random = 0;
  458. public boolean isInGame = false;
  459. public boolean isthieveing = false;
  460. public boolean appendSale;
  461. public boolean appendSell;
  462. public int hasOrb = 0;
  463. public int geItem = 0;
  464. public boolean updatez = false;
  465. public int proupdate = 0;
  466. public boolean cancelledGE = false;
  467.  
  468. public int[] mageDefArmour = {
  469. 2503, 2497
  470. };
  471.  
  472. public int loginTimer = 0;
  473.  
  474. public int Overlay = 0;
  475. public int followPlayer;
  476. public int currentSlot = 0;
  477. public int poisonTicks;
  478. public int lampTimer = 0;
  479. public int lampSkill = 0;
  480. public boolean followingPlayer;
  481.  
  482. public int playFollow;
  483. public boolean isInBounty;
  484. public boolean sendInterfaceConfig;
  485. public int pkIcon;
  486. public int bountyOpponent = 0;
  487. public boolean hasBountyAttacker;
  488. public boolean hasOpponent;
  489. public boolean skullOn;
  490. public int miasmicSpell;
  491. public int starter = 0;
  492. public int viewings = 0;
  493. public int donator = 0;
  494. public int Dialogue = 0;
  495. public int Choice = 0;
  496. public boolean wildWarned = false;
  497. public List<Long> friends = new ArrayList<Long>(200);
  498. public List<Long> ignores = new ArrayList<Long>(100);
  499. public boolean splitChat = false;
  500. public int digTimer = -1;
  501. public boolean pvpoption2 = false;
  502. public boolean pvpoption1 = false;
  503. public boolean pvpoption = true;
  504. public boolean initialAttack;
  505. public boolean boltSpecial;
  506. public String nameSet;
  507. public int setDrop;
  508. public int secHit2;
  509. public int thirdHit2;
  510. public int fourHit2;
  511. public int pinNumOne; public int pinNumTwo; public int pinNumThree; public int pinNumFour; public int hasBankPin; public boolean alreadyBanked = false;
  512. public String lastMsg;
  513. public int KC;
  514. public int DC;
  515. public String firstAttacker;
  516. public int checkAttacker = 0;
  517.  
  518. public boolean insideWarriorsGuild = false;
  519. public int spawnArmourTimer = -1;
  520. public boolean droppedArmour = false;
  521. public String droppedArmourType = "";
  522.  
  523. public void handleWarriorsGuild(Player p) {
  524. if (spawnArmourTimer > 0) {
  525. spawnArmourTimer--;
  526. }
  527. if (droppedArmour) {
  528. if (p.absX == 2857 && p.absY == 3541 || p.absX == 2851 && p.absY == 3541) {
  529. droppedArmour = false;
  530. if (droppedArmourType == "Rune") {
  531. Server.engine.newNPC(4284, p.absX, p.absY-5, heightLevel, 0, 0, 0, 0, false, p.playerId);
  532. } else if (droppedArmourType == "Addy") {
  533. Server.engine.newNPC(4283, p.absX, p.absY-5, heightLevel, 0, 0, 0, 0, false, p.playerId);
  534. } else if (droppedArmourType == "Mith") {
  535. Server.engine.newNPC(4282, p.absX, p.absY-5, heightLevel, 0, 0, 0, 0, false, p.playerId);
  536. } else if (droppedArmourType == "Black") {
  537. Server.engine.newNPC(4281, p.absX, p.absY-5, heightLevel, 0, 0, 0, 0, false, p.playerId);
  538. } else if (droppedArmourType == "Steel") {
  539. Server.engine.newNPC(4280, p.absX, p.absY-5, heightLevel, 0, 0, 0, 0, false, p.playerId);
  540. } else if (droppedArmourType == "Iron") {
  541. Server.engine.newNPC(4279, p.absX, p.absY-5, heightLevel, 0, 0, 0, 0, false, p.playerId);
  542. }
  543. }
  544. }
  545. if (spawnArmourTimer == 0) {
  546. spawnArmourTimer = -1;
  547. p.WalkingTo(p.absX, p.absY+4);
  548. }
  549. if (insideWarriorsGuild) {
  550. if (warriorGuildTimer < 60) {
  551. warriorGuildTimer++;
  552. }
  553. }
  554. if (p.insideWarriorsGuild) {
  555. if (warriorGuildTimer == 60) {
  556. warriorGuildTimer = 0;
  557. Engine.playerItems.deleteItem(p, 8851, Engine.playerItems.getItemSlot(p, 8851), 10);
  558. p.message("10 of your tokens crumble to dust...");
  559. return;
  560. }
  561. if (p.insideWarriorsGuild && (!Engine.playerItems.haveItem(p, 8851, 10))) {
  562. p.setCoords(2841, 3540, 2);
  563. p.insideWarriorsGuild = false;
  564. p.warriorGuildTimer = 0;
  565. p.message("You have ran out of tokens.");
  566. return;
  567. }
  568. }
  569. }
  570. public int warriorGuildTimer = 0;
  571. public int defenderStage = 1;
  572.  
  573. public void getNextDefender(Player p) {
  574. if (Engine.playerItems.haveItem(p, 8850, 1) || p.equipment[5] == 8850) {
  575. p.defenderStage = 7;
  576. } else if (!Engine.playerItems.haveItem(p, 8850, 1) && p.equipment[5] != 8850 && (Engine.playerItems.haveItem(p, 8849, 1) || p.equipment[5] == 8849)) {
  577. p.defenderStage = 6;
  578. } else if (!Engine.playerItems.haveItem(p, 8849, 1) && p.equipment[5] != 8849 && (Engine.playerItems.haveItem(p, 8848, 1) || p.equipment[5] == 8848)) {
  579. p.defenderStage = 5;
  580. } else if (!Engine.playerItems.haveItem(p, 8848, 1) && p.equipment[5] != 8848 && (Engine.playerItems.haveItem(p, 8847, 1) || p.equipment[5] == 8847)) {
  581. p.defenderStage = 4;
  582. } else if (!Engine.playerItems.haveItem(p, 8847, 1) && p.equipment[5] != 8847 && (Engine.playerItems.haveItem(p, 8846, 1) || p.equipment[5] == 8846)) {
  583. p.defenderStage = 3;
  584. } else if (!Engine.playerItems.haveItem(p, 8846, 1) && p.equipment[5] != 8846 && (Engine.playerItems.haveItem(p, 8845, 1) || p.equipment[5] == 8845)) {
  585. p.defenderStage = 2;
  586. } else if (!Engine.playerItems.haveItem(p, 8845, 1) && p.equipment[5] != 8845 && (Engine.playerItems.haveItem(p, 8844, 1) || p.equipment[5] == 8844)) {
  587. p.defenderStage = 1;
  588. } else if (!Engine.playerItems.haveItem(p, 8844, 1) && p.equipment[5] != 8844) {
  589. p.defenderStage = 0;
  590. }
  591. }
  592.  
  593. public int alchDelay = 0;
  594. public int thievedelay;
  595.  
  596. /**
  597. * Woodcutting
  598. */
  599. public int myTreeX = 0;
  600. public int myTreeY = 0;
  601. public int objId = 0;
  602. public int objIdX = 0;
  603. public int objIdY = 0;
  604. public boolean maple = false;
  605. public boolean magic = false;
  606. public boolean yew = false;
  607. public boolean willow = false;
  608. public boolean oak = false;
  609. public boolean reg = false;
  610.  
  611.  
  612. public int elena = 0;
  613. public void StartAFK() {
  614. AFK = 5;
  615. }
  616.  
  617. public void dClaw3(Player p) {
  618. NPC n = Server.engine.npcs[p.attackNpc];
  619. n.appendHit((thirdHit2), 0);
  620. n.appendHit((fourHit2), 0);
  621. }
  622. public int clawTimer2;
  623. public boolean UseClaws2;
  624.  
  625. public void StopAFK() {
  626. AFK -= 40;
  627. }
  628.  
  629. public String leeching = "";
  630.  
  631. public void openBank() {
  632. getActionSender().setConfig2(this, 563, 4194304); //???
  633. getActionSender().setConfig(this, 115, withdrawNote ? 1 : 0);
  634. getActionSender().setConfig(this, 305, insertMode ? 1 : 0);
  635. Engine.playerBank.sendTabConfig(this);
  636. getActionSender().showInterface(this, 762);
  637. getActionSender().setInventory(this, 763);
  638. getActionSender().setBankOptions(this);
  639. getActionSender().setItems(this, -1, 64207, 95, bankItems, bankItemsN);
  640. getActionSender().setItems(this, -1, 64209, 93, items, itemsN);
  641. //getActionSender().hideTabs(this); code to hide inventory & tabs
  642. getActionSender().setInterfaceConfig(this, 762, 18, true); //Hide some buttons
  643. getActionSender().setInterfaceConfig(this, 762, 19, true); //Remove it
  644. getActionSender().setInterfaceConfig(this, 762, 23, true); //If ya want
  645. viewingBankTab = 10;
  646. getActionSender().setString(this, "Bank of Incessant", 762, 24);
  647. getActionSender().setString(this, ""+Engine.playerBank.getFreeBankSlot(this), 762, 97);
  648. getActionSender().setString(this, ""+Engine.playerBank.SIZE, 762, 98);
  649. }
  650.  
  651. public int getPickPocketRandom(Player p) {
  652. if (p.skillLvl[17] > 0 && p.skillLvl[17] < 10) {
  653. return 1;
  654. } else if (p.skillLvl[17] > 9 && p.skillLvl[17] < 20) {
  655. return 2;
  656. } else if (p.skillLvl[17] > 19 && p.skillLvl[17] < 30) {
  657. return 3;
  658. } else if (p.skillLvl[17] > 29 && p.skillLvl[17] < 40) {
  659. return 4;
  660. } else if (p.skillLvl[17] > 39 && p.skillLvl[17] < 50) {
  661. return 5;
  662. } else if (p.skillLvl[17] > 49 && p.skillLvl[17] < 60) {
  663. return 6;
  664. } else if (p.skillLvl[17] > 59 && p.skillLvl[17] < 70) {
  665. return 7;
  666. } else if (p.skillLvl[17] > 69 && p.skillLvl[17] < 80) {
  667. return 8;
  668. } else if (p.skillLvl[17] > 79 && p.skillLvl[17] < 90) {
  669. return 9;
  670. } else if (p.skillLvl[17] > 89 && p.skillLvl[17] < 100) {
  671. return 10;
  672. }
  673. return 0;
  674. }
  675.  
  676. public int getAmountToPickpocket(int ID) {
  677. if (ID == 1) { //Man
  678. return 50;
  679. }
  680. if (ID == 1715) { // Female H.A.M Member
  681. return 100;
  682. }
  683. if (ID == 1714) { // Male H.A.M Member
  684. return 150;
  685. }
  686. if (ID == 2234) { // Master Farmer
  687. return 5000;
  688. }
  689. return 0;
  690. }
  691.  
  692. public int getTheivXP(int ID) {
  693. if (ID == 1) { //Man
  694. return 100;
  695. }
  696. if (ID == 1715) { // Female H.A.M Member
  697. return 150;
  698. }
  699. if (ID == 1714) { // Male H.A.M Member
  700. return 200;
  701. }
  702. if (ID == 2234) { // Master Farmer
  703. return 500;
  704. }
  705. return 0;
  706. }
  707.  
  708. public int stunned = 0;
  709. public int pickPocketTimer = 0;
  710.  
  711. public boolean canPickPocket(int ID) {
  712. int thievingLevel = skillLvl[17];
  713. switch (ID) {
  714. case 1:
  715. if (thievingLevel >= 1) {
  716. return true;
  717. }
  718. break;
  719. case 1715:
  720. if (thievingLevel >= 15) {
  721. return true;
  722. }
  723. break;
  724. case 1714:
  725. if (thievingLevel >= 20) {
  726. return true;
  727. }
  728. break;
  729. case 2234:
  730. if (thievingLevel >= 38) {
  731. return true;
  732. }
  733. break;
  734. }
  735. return false;
  736. }
  737.  
  738. public void attemptToPickpocket(int ID) {
  739. boolean fail;
  740. int amountToAdd = getAmountToPickpocket(ID);
  741. int temp = getPickPocketRandom(this);
  742. int temp2 = getTheivXP(ID);
  743. NPC n = Server.engine.npcs[clickId];
  744. if (canPickPocket(ID)) {
  745. if (pickPocketTimer > 0) {
  746. return;
  747. }
  748. if (n.currentHP > 0)
  749. if (Misc.random(temp) == ID) {
  750. fail = true;
  751. stunned = 10;
  752. requestGFX(426, 100);
  753. message("You failed to pickpocket the " + Server.engine.getNPCName(n.npcType));
  754. requestAnim(881, 0);
  755. n.requestText("Hey, what do you think your doing!");
  756. pickPocketTimer = 3;
  757. return;
  758. } else {
  759. fail = false;
  760. message("You successfully pickpocket the " + Server.engine.getNPCName(n.npcType));
  761. pickPocketTimer = 2;
  762. requestAnim(881, 0);
  763. addSkillXP(temp2, 17);
  764. if (netWorth < 10000000) {
  765. Engine.playerItems.addItem(this, 995, Misc.random(amountToAdd));
  766. } else {
  767. message(" ");
  768. message("You already have enough money, you can continue thieving for XP");
  769. message("but you will not recieve any more money for it.");
  770. }
  771. }
  772. }
  773. }
  774. public int netWorth = 0;
  775.  
  776. public void networth(Player p) {
  777. int networth = 0;
  778. for (int i = 0; i < p.equipment.length; i++) {
  779. networth += p.getItemValue(p.equipment[i]) * p.equipmentN[i];
  780. }
  781. for (int i = 0; i < p.items.length; i++) {
  782. networth += p.getItemValue(p.items[i]) * p.itemsN[i];
  783. }
  784. for (int i = 0; i < p.bankItems.length; i++) {
  785. networth += p.getItemValue(p.bankItems[i]) * p.bankItemsN[i];
  786. }
  787. netWorth = networth;
  788. }
  789.  
  790. /**
  791. * Arrays holding the items + their amounts of your bank
  792. */
  793. public int[] bankItems = new int[Engine.playerBank.SIZE];
  794. public int[] bankItemsN = new int[Engine.playerBank.SIZE];
  795. /**
  796. * The slot at which each bank tab starts at
  797. */
  798. public int[] tabStartSlot = new int[11];
  799. /**
  800. * The amount of items that you have last withrawn/deposited with the X function
  801. */
  802. public int bankX = 50;
  803. /**
  804. * The tab you are viewing, used to store items in it when depositing
  805. */
  806. public int viewingBankTab = 10;
  807. /**
  808. * If you are withrawing items as a note
  809. */
  810. public boolean withdrawNote;
  811. /**
  812. * If you are using insert mode
  813. */
  814. public boolean insertMode;
  815.  
  816. public int AFK = 0;
  817.  
  818. public int isBones [] = {526, 2859, 528, 3179, 532, 3125, 4812, 3123, 534, 6812, 536,
  819. 4830, 4832, 4834, 6729};
  820.  
  821. public void buryBones(int bonesId, int acqXP) {
  822. if (buryDelay <= 0) {
  823. buryDelay = 4;
  824. for (int bId : isBones) {
  825. if (bonesId == bId) {
  826. requestAnim(827, 0);
  827. Engine.playerItems.deleteItem(this, bonesId, Engine.playerItems.getItemSlot(this, bonesId), 1);
  828. addSkillXP(acqXP, 5);
  829. getActionSender().sendMessage(this, "You bury the " +Engine.items.getItemName(bonesId)+ ".");
  830. }
  831. }
  832. }
  833. }
  834.  
  835. public int hitsOnNPC = 0;
  836.  
  837.  
  838. public String chatName;
  839. public final String ACTIVE_CHAT_DEFAULT = "Incessant";
  840. public String activeChat = ACTIVE_CHAT_DEFAULT;
  841. public final String ACTIVE_CHAT_OWNER_DEFAULT = "Public Channel";
  842. public String activeChatOwner = ACTIVE_CHAT_OWNER_DEFAULT;
  843.  
  844. public int wgs = 0;
  845. public int wgsStage = 0;
  846.  
  847. public int ldp = 0;
  848. public int ldpStage = 0;
  849.  
  850. public int dt = 0;
  851. public int dtStage = 0;
  852.  
  853. public int xpRate = 300;
  854.  
  855.  
  856. public void runQuestMain(Player p) {
  857. String colour;
  858. String colour1;
  859. String colour2;
  860. if (p.wgs == 0) { //Not started
  861. colour = "<col=FF0000>";
  862. } else if (p.wgs == 1) { //Started
  863. colour = "<col=FFFF00>";
  864. } else {
  865. colour = "<col=04B404>"; //Finished
  866. }
  867. if (p.ldp == 0) { //Not started
  868. colour1 = "<col=FF0000>";
  869. } else if (p.ldp == 1) { //Started
  870. colour1 = "<col=FFFF00>";
  871. } else {
  872. colour1 = "<col=04B404>"; //Finished
  873. }
  874. if (p.ldp == 0) { //Not started
  875. colour2 = "<col=FF0000>";
  876. } else if (p.ldp == 1) { //Started
  877. colour2 = "<col=FFFF00>";
  878. } else {
  879. colour2 = "<col=04B404>"; //Finished
  880. }
  881. for (int i = 0; i < 166; i++)
  882. p.getActionSender().setString(p, "", 274, i);
  883. }
  884.  
  885. public void showQuestCompletion(Player p, int quest) {
  886. p.getActionSender().showInterface(p, 275);
  887. for (int i = 0; i < 311; i++) {
  888. p.getActionSender().setString(p, "", 275, i);
  889. }
  890. switch (quest) {
  891. case 1:
  892. break;
  893. }
  894. }
  895.  
  896.  
  897.  
  898. public void openQuestInfo(Player p, int quest) {
  899. p.getActionSender().showInterface(p, 275);
  900. for (int i = 0; i < 311; i++) {
  901. p.getActionSender().setString(p, "", 275, i);
  902. }
  903. switch (quest) {
  904. case 1:
  905. break;
  906. case 2:
  907. break;
  908. case 3:
  909. break;
  910. }
  911. }
  912.  
  913. public boolean travelling = false;
  914.  
  915. public int travelPage = 1;
  916.  
  917. public void openTravel(Player p, int page) {
  918. p.travelling = true;
  919. travelPage = page;
  920. if (page == 1) {
  921. p.getActionSender().setInterfaceConfig(p, 238, 8, true);
  922. p.getActionSender().setInterfaceConfig(p, 238, 9, false);
  923. p.getActionSender().showChatboxInterface(p, 235);
  924. p.getActionSender().setString(p, "Where would you like to travel to?", 235, 1);
  925. p.getActionSender().setString(p, "Edgeville", 235, 2);
  926. p.getActionSender().setString(p, "Tzhaar", 235, 3);
  927. p.getActionSender().setString(p, "Barrows", 235, 4);
  928. p.getActionSender().setString(p, "Taverley Dungeon", 235, 5);
  929. p.getActionSender().setString(p, "Next page", 235, 6);
  930. return;
  931. }
  932. if (page == 2) {
  933. p.getActionSender().setInterfaceConfig(p, 238, 8, true);
  934. p.getActionSender().setInterfaceConfig(p, 238, 9, false);
  935. p.getActionSender().showChatboxInterface(p, 235);
  936. p.getActionSender().setString(p, "Where would you like to travel to?", 235, 1);
  937. p.getActionSender().setString(p, "Rellekka", 235, 2);
  938. p.getActionSender().setString(p, "Godwars", 235, 3);
  939. p.getActionSender().setString(p, "Waterbirth isle", 235, 4);
  940. p.getActionSender().setString(p, "Previous page", 235, 5);
  941. p.getActionSender().setString(p, "Next page", 235, 6);
  942. return;
  943. }
  944. if (page == 3) {
  945. p.getActionSender().setInterfaceConfig(p, 238, 8, true);
  946. p.getActionSender().setInterfaceConfig(p, 238, 9, false);
  947. p.getActionSender().showChatboxInterface(p, 235);
  948. p.getActionSender().setString(p, "Where would you like to travel to?", 235, 1);
  949. p.getActionSender().setString(p, "Warrior's guild", 235, 2);
  950. p.getActionSender().setString(p, "", 235, 3);
  951. p.getActionSender().setString(p, "", 235, 4);
  952. p.getActionSender().setString(p, "Previous page", 235, 5);
  953. p.getActionSender().setString(p, "Next page", 235, 6);
  954. return;
  955. }
  956. }
  957.  
  958. public void operateItem(Player p, int item) {
  959. operatingItem = item;
  960. operateStage = 0;
  961. if (item == 3853 || item == 3855 || item == 3857 || item == 3859 || item == 3861 || item == 3863 || item == 3865 || item == 3867) { //Games necklaces
  962. p.getActionSender().showChatboxInterface(p, 238);
  963. p.getActionSender().setInterfaceConfig(p, 238, 8, true);
  964. p.getActionSender().setInterfaceConfig(p, 238, 9, false);
  965. p.getActionSender().setString(p, "Where would you like to teleport to?", 238, 0);
  966. p.getActionSender().setString(p, "Burthorpe Games Rooms", 238, 1);
  967. p.getActionSender().setString(p, "Barbarian Outpost", 238, 2);
  968. p.getActionSender().setString(p, "Clan Wars", 238, 3);
  969. p.getActionSender().setString(p, "Wilderness Volcano", 238, 4);
  970. p.getActionSender().setString(p, "Nowhere", 238, 5);
  971. return;
  972. }
  973. if (item == 1712 || item == 1710 || item == 1708 || item == 1706) {
  974. p.getActionSender().showChatboxInterface(p, 238);
  975. p.getActionSender().setInterfaceConfig(p, 238, 8, true);
  976. p.getActionSender().setInterfaceConfig(p, 238, 9, false);
  977. p.getActionSender().setString(p, "Where would you like to teleport to?", 238, 0);
  978. p.getActionSender().setString(p, "Edgeville", 238, 1);
  979. p.getActionSender().setString(p, "Karamja", 238, 2);
  980. p.getActionSender().setString(p, "Draynor Village", 238, 3);
  981. p.getActionSender().setString(p, "Al Kharid", 238, 4);
  982. p.getActionSender().setString(p, "Nowhere", 238, 5);
  983. return;
  984. }
  985. }
  986. public int operatingItem = -1;
  987. public int operateStage = -1;
  988.  
  989. public void activateSlayerGem(Player p) {
  990. p.operatingItem = 4155;
  991. p.getActionSender().setInterfaceConfig(p, 238, 8, true);
  992. p.getActionSender().setInterfaceConfig(p, 238, 9, false);
  993. p.getActionSender().showChatboxInterface(p, 235);
  994. p.getActionSender().setString(p, "Select an option", 235, 1);
  995. p.getActionSender().setString(p, "How am I doing so far?", 235, 2);
  996. p.getActionSender().setString(p, "Who are you?", 235, 3);
  997. p.getActionSender().setString(p, "Where are you?", 235, 4);
  998. p.getActionSender().setString(p, "Got any tips for me?", 235, 5);
  999. p.getActionSender().setString(p, "Nothing really.", 235, 6);
  1000. }
  1001.  
  1002. String[][] itemPrices = {{"Warrior helm", "536"}, {"Ring of life", "73"}, {"Chaotic maul", "5000000"}, {"Corrupt stat warhammer", "5000000"}, {"Chaotic rapier", "1000000"}, {"Chaotic longsword", "2000000"}, {"Amulet of ranging", "15000000"}, {"Chaotic staff", "1000000"},{"Purple sweets", "12"}, {"Ring of recoil", "12"}, {"Snakeskin boots", "190"}, {"Ranging potion(3)", "23"}, {"Ranging potion(4)", "23"}, {"Ranging potion(1)", "23"}, {"Ranging potion(2)", "23"}, {"Armadyl godsword", "750000"}, {"Dragon med helm", "605"}, {"Black dragonhide", "33"}, {"Dragon med helm", "605"}, {"Vesta's longsword", "650000"}, {"Vesta's longsword (deg)", "650000"}, {"Dragon bones", "30"}, {"Enchanted robe", "495"}, {"Dragonfire shield", "212000"}, {"Mystic robe top", "720"}, {"Enchanted top", "741"}, {"Enchanted hat", "89"}, {"Adamant knife", "2"}, {"Adamant knife(p)", "4"}, {"Draconic visage", "217000"}, {"Mystic hat", "92"},{"Mystic robe bottom", "480"}, {"Mystic boots", "59"}, {"Mystic gloves", "59"}, {"Adamant knife(p+)", "5"}, {"Adamant knife(p++)", "13"}, {"Adamant dart", "1"}, {"Adamant dart(p)", "3"}, {"Adamant dart(p+)", "4"}, {"Adamant dart(p++)", "12"}, {"Tzhaar-ket-em", "891"}, {"Barrelchest anchor", "2300"}, {"Crystal bow full", "9000"}, {"Crystal shield full", "9000"}, {"Rune chainbody", "315"}, {"Zamorakian spear", "14395"}, {"Saradomin staff", "800"}, {"Ancient staff", "800"},{"Guthix staff", "800"}, {"Zamorak staff", "800"}, {"Bolt rack", "2"}, {"Santa hat", "131601"}, {"Tuna potato", "14"}, {"Wizard boots", "3319"}, {"Regen bracelet", "2570"}, {"Combat bracelet", "137"}, {"Combat bracelet(1)", "137"}, {"Combat bracelet(2)", "137"}, {"Combat bracelet(3)", "137"}, {"Combat bracelet(4)", "137"}, {"Splitbark body", "271"}, {"Splitbark boots", "28"}, {"Splitbark gauntlets", "28"}, {"Splitback helm", "59"}, {"Staff of light", "160000"}, {"Splitback legs", "240"}, {"Dwarven helmet", "358"}, {"Abyssal whip", "38570"}, {"Fire cape", "10000"}, {"Armadyl godsword", "675018"}, {"Bandos godsword", "288580"}, {"Saradomin godsword", "496437"}, {"Zamorak godsword", "267983"}, {"Dragon med helm", "885"}, {"Dragon sq shield", "5630"}, {"Dragon dagger", "292"}, {"Dragon dagger(p)", "305"}, {"Dragon dagger(p+)", "312"}, {"Dragon dagger(p++)", "350"}, {"Dragon spear", "451"}, {"Dragon spear(p)", "460"}, {"Dragon spear(p+)", "465"}, {"Dragon spear(p++)", "506"}, {"Dragon longsword", "956"}, {"Dragon battleaxe", "1200"}, {"Dragon mace", "298"}, {"Dragon claws", "277832"}, {"Dragon chainbody", "50565"}, {"Dragon halberd", "1948"}, {"Dragon platelegs", "6323"}, {"Dragon plateskirt", "1979"}, {"Dragon scimitar", "998"}, {"Dragon platebody", "99230"}, {"Dragon axe", "16880"}, {"Dragon 2h sword", "8921"}, {"Dragon bolts (e)", "200"}, {"Diamond bolts (e)", "8"}, {"Dragon arrow", "29"}, {"Dragon arrow(p)", "31"}, {"Dragon arrow(p+)", "32"}, {"Dragon arrow(p++)", "40"}, {"Dragon fire arrows", "26"}, {"Dragonfire shield", "277038"}, {"Dragon full helm", "125349"}, {"Dragon boots", "2407"}, {"Dragon dart", "6"}, {"Dragon dart(p)", "8"}, {"Dragon dart(p+)", "9"}, {"Dragon dart(p++)", "17"}, {"Dragon bones", "24"}, {"Big bones", "3"}, {"Astral rune", "1"}, {"Water rune", "3"}, {"Blood rune", "3"}, {"Death rune", "3"}, {"Law rune", "3"}, {"Nature rune", "2"}, {"Soul rune", "3"}, {"Rune arrow", "2"}, {"Rune arrow(p)", "4"}, {"Rune arrow(p+)", "5"}, {"Rune arrow(p++)", "13"}, {"Rune fire arrows", "2"}, {"Rune c'bow", "95"}, {"Rune dart", "2"}, {"Rune dart(p)", "4"}, {"Rune dart(p+)", "5"}, {"Rune dart(p++)", "13"}, {"Rune fire arrows", "2"}, {"Rune full helm (t)", "3160"}, {"Rune full helm(g)", "4792"}, {"Rune kiteshield (g)", "4307"}, {"Rune kiteshield (t)", "2838"}, {"Rune platebody (g)", "6296"}, {"Rune platebody (t)", "3995"}, {"Rune platelegs (g)", "6296"}, {"Rune platelegs (t)", "2076"}, {"Rune plateskirt (g)", "639"}, {"Rune plateskirt (t)", "569"}, {"Rune full helm", "211"}, {"Rune boots", "460"}, {"Rune kiteshield", "499"}, {"Rune med helm", "114"}, {"Rune platebody", "578"}, {"Rune platelegs", "507"}, {"Rune plateskirt", "443"}, {"Rune sq shield", "230"}, {"Rune thrownaxe", "3"}, {"Gilded full helm", "3957"}, {"Gilded kiteshield", "4460"}, {"Gilded platebody", "15019"}, {"Gilded platelegs", "5902"}, {"Gilded plateskirt", "1618"}, {"Guthix full helm", "38888"}, {"Guthix kiteshield", "3763"}, {"Guthix platebody", "6185"}, {"Guthix platelegs", "2935"}, {"Guthix plateskirt", "577"}, {"Saradomin full", "8430"}, {"Saradomin kite", "8776"}, {"Saradomin plate", "16213"}, {"Saradomin legs", "3694"}, {"Saradomin skirt", "1003"}, {"Zamorak full helm", "5814"}, {"Zamorak kiteshield", "6221"}, {"Zamorak platebody", "11047"}, {"Zamorak platelegs", "3534"}, {"Zamorak plateskirt", "991"}, {"Adam full helm(g)", "1121"}, {"Adam full helm(t)", "601"}, {"Adam kiteshield (g)", "1159"}, {"Adam kiteshield (t)", "414"}, {"Adam platebody (g)", "2009"}, {"Adam platebody (t)", "908"}, {"Adam platelegs (g)", "792"}, {"Adam plateskirt (t)", "152"}, {"Adamant arrow", "1"}, {"Adamant arrow(p)", "3"}, {"Adamant arrow(p+)", "4"}, {"Adamant arrow(p++)", "12"}, {"Adamant fire arrows", "9"}, {"Adamant javelin", "1"}, {"Adamant javelin(p)", "3"}, {"Adamant javelin(p+)", "4"}, {"Adamant javelin(p++)", "12"}, {"Adamant chainbody", "27"}, {"Adamant boots", "20"}, {"Adamant full helm", "23"}, {"Adamant kiteshield", "31"}, {"Adamant platebody", "98"}, {"Adamant platelegs", "37"}, {"Adamant plateskirt", "37"}, {"Adamant med helm", "12"}, {"Adamant thrownaxe", "1"}, {"Adamant spear", "10"}, {"Adamant spear(p)", "20"}, {"Adamant spear(p+)", "25"}, {"Adamant spear(p++)", "66"}, {"Spined boots", "36"}, {"Spined gloves", "17"}, {"Spined body", "45"}, {"Spined chaps", "21"}, {"Spined helm", "358"}, {"Rock-shell boots", "11"}, {"Rock-shell gloves", "28"}, {"Rock-shell helm", "209"}, {"Rock-shell legs", "486"}, {"Rock-shell plate", "397"}, {"Skeletal boots", "194"}, {"Skeletal bottoms", "238"}, {"Skeletal gloves", "432"}, {"Skeletal helm", "58"}, {"Skeletal top", "267"}, {"Archers ring", "5783"}, {"Berserker ring", "18367"}, {"Seer's ring", "1"}, {"Warrior ring", "1163"}, {"Toktz-xil-ul", "3"}, {"Toktz-ket-xil", "2108"}, {"Toktz-mej-tal", "1092"}, {"Toktz-xil-ak", "1231"}, {"Toktz-xil-ek", "739"}, {"Toktz-ket-em", "935"}, {"Tzhaar-ket-om", "1579"}, {"Obsidian cape", "1864"}, {"Berserker necklace", "1787"}, {"Granite maul", "1458"}, {"Granite body", "490"}, {"Granite helm", "274"}, {"Granite legs", "1999"}, {"Granite shield", "348"}, {"Amulet of defence", "7"}, {"Amulet of fury", "95823"}, {"Amulet of glory", "386"}, {"Amulet of glory(1)", "386"}, {"Amulet of glory(2)", "386"}, {"Amulet of glory(3)", "386"}, {"Amulet of glory(4)", "386"}, {"Amulet of glory(t)", "2090"}, {"Amulet of glory(t1)", "2090"}, {"Amulet of glory(t2)", "2090"}, {"Amulet of glory(t3)", "2090"}, {"Amulet of glory(t4)", "2090"}, {"Amulet glory(t2)", "2090"}, {"Amulet glory(t3)", "2090"}, {"Amulet glory(t4)", "2090"}, {"Amulet of magic", "5"}, {"Amulet of magic(t)", "1042"}, {"Amulet of power", "31"}, {"Amulet of strength", "15"}, {"3rd age amulet", "561623"}, {"Strength amulet(t)", "5439"}, {"Antipoison(1)", "1"}, {"Antipoison(2)", "3"}, {"Antipoison(3)", "4"}, {"Antipoison(4)", "5"}, {"Antipoison+(1)", "23"}, {"Antipoison+(2)", "45"}, {"Antipoison+(3)", "68"}, {"Antipoison+(4)", "90"}, {"Antipoison++(1)", "37"}, {"Antipoison++(2)", "74"}, {"Antipoison++(3)", "110"}, {"Antipoison++(4)", "147"}, {"Super attack(1)", "2"}, {"Super attack(2)", "4"}, {"Super attack(3)", "5"}, {"Super attack(4)", "7"}, {"Super strength(1)", "10"}, {"Super strength(2)", "20"}, {"Super strength(3)", "30"}, {"Super strength(4)", "40"}, {"Super defence(1)", "2"}, {"Super defence(2)", "4"}, {"Super defence(3)", "5"}, {"Super defence(4)", "8"}, {"Saradomin brew(1)", "7"}, {"Saradomin brew(2)", "15"}, {"Saradomin brew(3)", "22"}, {"Saradomin brew(4)", "29"}, {"Zamorak brew(1)", "12"}, {"Zamorak brew(2)", "24"}, {"Zamorak brew(3)", "36"}, {"Zamorak brew(4)", "48"}, {"Super restore(1)", "36"}, {"Super restore(2)", "72"}, {"Super restore(3)", "108"}, {"Super restore(4)", "144"}, {"Super antipoison(1)", "3"}, {"Super antipoison(2)", "6"}, {"Super antipoison(3)", "9"}, {"Super antipoison(4)", "11"}, {"Prayer potion(1)", "21"}, {"Prayer potion(2)", "42"}, {"Prayer potion(3)", "64"}, {"Prayer potion(4)", "85"}, {"3rd age mage hat", "406772"}, {"3rd age robe", "422061"}, {"3rd age robe top", "644626"}, {"3rd age full helmet", "559838"}, {"3rd age kiteshield", "848461"}, {"3rd age platebody", "849293"}, {"3rd age platelegs", "757609"}, {"3rd age range coif", "282814"}, {"3rd age range legs", "427202"}, {"3rd age range top", "501644"}, {"3rd age vambraces", "210575"}, {"Ahrim's hood", "849"}, {"Ahrim's robeskirt", "16147"}, {"Ahrim's robetop", "13582"}, {"Ahrim's staff", "691"}, {"Torag's hammers", "960"}, {"Torag's helm", "10919"}, {"Torag's platebody", "5196"}, {"Torag's platelegs", "13563"}, {"Karil's coif", "428"}, {"Karil's crossbow", "1265"}, {"Karil's leatherskirt", "2165"}, {"Karil's leathertop", "11627"}, {"Dharok's greataxe", "6881"}, {"Dharok's helm", "69601"}, {"Dharok's platebody", "5247"}, {"Dharok's platelegs", "16242"}, {"Verac's brassard", "4681"}, {"Verac's flail", "1792"}, {"Verac's helm", "39233"}, {"Verac's plateskirt", "20590"}, {"Guthan's chainskirt", "2090"}, {"Guthan's helm", "21675"}, {"Guthan's platebody", "2160"}, {"Guthan's warspear", "13720"}, {"Saradomin sword", "71022"}, {"Ava's accumulator", "113"}, {"Archer helm", "553"}, {"Berserker helm", "773"}, {"Farseer helm", "536"}, {"Helm of neitiznot", "521"}, {"Infinity boots", "8277"}, {"Infinity bottoms", "3089"}, {"Infinity gloves", "1957"}, {"Infinity hat", "6382"}, {"Infinity top", "4317"}, {"Master wand", "4265"}, {"Teacher wand", "432"}, {"Mage's book", "39198"}, {"Initiate cuisse", "47"}, {"Initiate hauberk", "59"}, {"Initiate sallet", "34"}, {"Proselyte cuisse", "61"}, {"Proselyte hauberk", "75"}, {"Proselyte sallet", "46"}, {"Proselyte", "61"}, {"Bandos boots", "8567"}, {"Bandos chestplate", "637022"}, {"Bandos tassets", "619478"}, {"Armadyl chestplate", "110821"}, {"Armadyl helmet", "48086"}, {"Armadyl plateskirt", "119685"}, {"Black d'hide body", "80"}, {"Black d'hide chaps", "62"}, {"Black d'hide vamb", "25"}, {"Zamorak d'hide", "12302"}, {"Zamorak chaps", "1175"}, {"Zamorak bracers", "5754"}, {"Zamorak coif", "2072"}, {"Saradomin d'hide", "9908"}, {"Saradomin chaps", "1005"}, {"Saradomin bracers", "4112"}, {"Saradomin coif", "1172"}, {"Guthix chaps", "279"}, {"Guthix coif", "1044"}, {"Guthix dragonhide", "949"}, {"Guthix bracers", "138"}, {"Guthix cloak", "6229"}, {"Guthix crozier", "29"}, {"Guthix mitre", "972"}, {"Guthix mjolnir", "60"}, {"Guthix robe legs", "993"}, {"Guthix robe top", "1095"}, {"Guthix stole", "144"}, {"Zamorak cloak", "10332"}, {"Zamorak crozier", "54"}, {"Zamorak mitre", "1382"}, {"Zamorak mjolnir", "91"}, {"Zamorak robe legs", "1626"}, {"Zamorak robe top", "1967"}, {"Zamorak stole", "864"}, {"Saradomin cloak", "9206"}, {"Saradomin crozier", "51"}, {"Saradomin mitre", "1634"}, {"Saradomin mjolnir", "113"}, {"Saradomin robe legs", "1071"}, {"Saradomin robe top", "1242"}, {"Saradomin stole", "650"}, {"Dark bow", "11000"}, {"Blue partyhat", "3166068"}, {"Green partyhat", "971385"}, {"Purple partyhat", "833622"}, {"Red partyhat", "1173043"}, {"White partyhat", "1638634"}, {"Yellow partyhat", "928302"}, {"Blue h'ween mask", "123047"}, {"Green h'ween mask", "102486"}, {"Red h'ween mask", "166275"}, {"Scythe", "273844"}, {"Bunny ears", "170376"}, {"Easter egg", "46282"}, {"Pumpkin", "53056"}, {"Manta ray", "16"}, {"Shark", "8"}, {"Cooked karambwan", "6"}, {"Rune knife", "5"}, {"Rune knife(p)", "7"}, {"Rune knife(p+)", "8"}, {"Rune knife(p++)", "16"}, {"Attack cape(t)", "990"}, {"Attack cape(t)", "990"}, {"Attack hood", "10"}, {"Strength cape", "990"}, {"Strength cape(t)", "990"}, {"Strength hood", "10"}, {"Defence cape", "990"}, {"Defence cape(t)", "990"}, {"Defence hood", "10"}, {"Ranging cape", "990"}, {"Ranging cape(t)", "990"}, {"Ranging hood", "10"}, {"Prayer cape", "990"}, {"Prayer cape(t)", "990"}, {"Prayer hood", "10"}, {"Magic cape", "990"}, {"Magic cape(t)", "990"}, {"Magic hood", "10"}, {"Runecraft cape", "990"}, {"Runecraft cape(t)", "990"}, {"Runecrafting hood", "10"}, {"Hitpoints cape", "990"}, {"Hitpoints cape(t)", "990"}, {"Hitpoints hood", "10"}, {"Agility cape", "990"}, {"Agility cape(t)", "990"}, {"Agility hood", "10"}, {"Herblore cape", "990"}, {"Herblore cape(t)", "990"}, {"Herblore hood", "10"}, {"Thieving cape", "990"}, {"Thieving cape(t)", "990"}, {"Thieving hood", "10"}, {"Crafting cape", "990"}, {"Crafting cape(t)", "990"}, {"Crafting hood", "10"}, {"Fletching cape", "990"}, {"Fletching cape(t)", "990"}, {"Fletching hood", "10"}, {"Slayer cape", "990"}, {"Slayer cape(t)", "990"}, {"Slayer hood", "10"}, {"Construct. cape", "990"}, {"Construct. cape(t)", "990"}, {"Construct. hood", "10"}, {"Mining cape", "990"}, {"Mining cape(t)", "990"}, {"Mining hood", "10"}, {"Smithing cape", "990"}, {"Smithing cape(t)", "990"}, {"Smithing hood", "10"}, {"Fishing cape", "990"}, {"Fishing cape(t)", "990"}, {"Fishing hood", "10"}, {"Cooking cape", "990"}, {"Cooking cape(t)", "990"}, {"Cooking hood", "10"}, {"Firemaking cape", "990"}, {"Firemaking cape(t)", "990"}, {"Firemaking hood", "10"}, {"Woodcutting cape", "990"}, {"Woodcut. cape(t)", "990"}, {"Woodcutting hood", "10"}, {"Farming cape", "990"}, {"Farming cape(t)", "990"}, {"Farming hood", "10"}, {"Quest point cape", "990"}, {"Quest point hood", "10"}, {"Summoning cape", "990"}, {"Summoning cape(t)", "990"}, {"Summoning hood", "10"}, {"Robin hood hat", "20395"}, {"Ranger boots", "66372"}, {"Arcane spirit shield", "1533295"}, {"Blessed spirit shield", "41387"}, {"Divine spirit shield", "2113049"}, {"Elysian spirit shield", "2515283"}, {"Statius's warhammer", "110000"}, {"Spectral spirit shield", "1552932"}, {"Spirit shield", "626"}, {"Verac's top 0", "4681"}, {"Verac's flail 0", "1792"}, {"Verac's helm 0", "39233"}, {"Verac's skirt 0", "20590"}, {"Torag's hammers 0", "960"}, {"Torag's helm 0", "10919"}, {"Torag's body 0", "5196"}, {"Torag's legs 0", "13563"},{"Karil's coif 0", "428"}, {"Karil's x-bow 0", "1265"}, {"Karil's skirt 0", "2165"}, {"Karil's top 0", "11627"}};
  1003.  
  1004. String[][] killPrices = {{"Ranger boots", "5"}, {"Saradomin sword","2"}, {"Void knight top", "5"}, {"Void knight robe", "15"}, {"Void knight mace", "1"}, {"Void knight gloves", "5"}, {"Void mage helm", "5"}, {"Void ranger helm", "5"}, {"Void melee helm", "5"}, {"Runner hat", "5"}, {"Healer hat", "5"}, {"Ranger hat", "5"}, {"Runner boots", "5"}, {"Penance gloves", "5"}, {"Penance skirt", "5"}, {"Fighter torso", "5"}, {"Fire cape", "10"}, {"Zuriel's staff", "20"}, {"Zuriel's hood", "20"}, {"Zuriel's robe bottom", "20"}, {"Zuriel's robe top", "20"}, {"Statius's platelegs", "20"}, {"Statius's platelegs", "20"}, {"Statius's platebody", "20"}, {"Statius's full helm", "11"}, {"Statius's warhammer", "20"}, {"Statius's platelegs", "8"}, {"Bandos godsword", "3"}, {"Bandos tassets", "50"}, {"Bandos chestplate", "50"}, {"Vesta's chainbody", "10"}, {"Vesta's plateskirt", "15"}, {"Vesta's longsword", "60"}, {"Vesta's longsword (deg)", "60"}, {"Armadyl chestplate", "1"}, {"Armadyl plateskirt", "1"}, {"Armadyl helmet", "1"}, {"Morrigan's leather body", "10"}, {"Corrupt Zuriel's hood", "5"}, {"Corrupt Zuriel's robetop", "5"}, {"Corrupt Zuriel's robebottom", "5"}, {"Corrupt Zuriel's staff", "20"}, {"Corrupt Vesta's chainbody", "20"}, {"Corrupt Vesta's plateskirt", "20"}, {"Corrupt Statius's hammer", "20"}, {"Corrupt Statius's full helm", "20"}, {"Corrupt Statius's platebody", "20"}, {"Corrupt Statius's platelegs", "20"}, {"Morrigan's leather chaps", "20"}, {"Morrigan's coif", "20"}, {"Infinity boots", "3"}, {"Master wand", "5"}, {"Mage's book", "5"}, {"Amulet of fury", "1"}, {"Rune defender", "0"}, {"Adamant defender", "0"}, {"Mithril defender", "0"}};
  1005.  
  1006. int[][] otherPrices = {{6572, 20000}, {4089, 203},{4090, 203}, {4091, 513}, {12007, 900}, {12008, 900}, {389, 10}, {383, 8}, {377, 3}, {371, 3}, {363, 2}, {335, 2}, {317, 2}, {331, 3}, {4092, 513},{4093, 313}, {4094, 313},{4095, 902},{4096, 902},{4097, 402},{4098, 402}, {12480, 100000}, {11286, 150000}, {1632, 2500}, {1624, 120}, {1622, 250}, {1620, 400}, {1618, 550}, {6571, 20000}, {12094, 50000}, {12093, 50000}, {12047, 500}, {12048, 500}, {1631, 2500}, {1623, 120}, {1621, 250}, {1619, 400}, {1617, 550}, {13742, 3816000}, {13743, 3816000}, {13736, 35000}, {13737, 35000}, {13740, 3816000}, {13741, 3816000}, {13738, 1168008}, {13739, 1168008}, {13734, 1000}, {13735, 1000}, {7456, 3}, {7457, 5}, {7458, 10}, {7459, 15}, {7460, 20}, {7461, 1000}, {7462, 1000}, {10551, 10000}};
  1007.  
  1008. int[][] killRequirments = {{8844, 0}, {8845, 0}, {8846, 0}, {8847, 0}, {8848, 0}, {8849, 0}, {8850, 1}, {10887, 0}, {4214, 0}, {4225, 0}, {2412, 0}, {2413, 0}, {2414, 0}, {2415, 0}, {2416, 0}, {2417, 0}, {7453, 0}, {7454, 0}, {7455, 0}, {7456, 0}, {7457, 0}, {7458, 0}, {7459, 0}, {7460, 0}, {7461, 0}, {7462, 0}};
  1009.  
  1010.  
  1011.  
  1012. public int getItemValue(int item) {
  1013. if (item == 995) {
  1014. return 1;
  1015. }
  1016. int value = 500;
  1017. for (String[] s : itemPrices) {
  1018. String name = Engine.items.getItemName(item);
  1019. if (name.equals(s[0])) {
  1020. value = 100 * Integer.parseInt(s[1]);
  1021. }
  1022. }
  1023. for (int[] i : otherPrices) {
  1024. if (item == i[0]) {
  1025. value = 100 * i[1];
  1026. }
  1027. }
  1028. if (Engine.items.stackable(item) && value == 0) {
  1029. value = 1;
  1030. }
  1031. return value;
  1032. }
  1033.  
  1034. public int getKillRequirment(int item) {
  1035. int requirment = 0;
  1036. for (int[] i : killRequirments) {
  1037. if (item == i[0]) {
  1038. requirment = i[1];
  1039. }
  1040. }
  1041. return requirment;
  1042. }
  1043.  
  1044. public int getKillCost(int item) {
  1045. int cost = 0;
  1046. for (String[] s : killPrices) {
  1047. String name = Engine.items.getItemName(item);
  1048. if (name.equals(s[0])) {
  1049. cost = Integer.parseInt(s[1]);
  1050. }
  1051. }
  1052. return cost;
  1053. }
  1054.  
  1055. public double PVPPotential;
  1056.  
  1057. public int totalKills;
  1058. public int kills;
  1059. public boolean assistance = true;
  1060.  
  1061. public void setPlayerOptions(Player p) {
  1062. if (InBounty == 0 && safeArea(absX, absY)) {
  1063. p.getActionSender().setPlayerOption(p, "null", 1, 1); // Attack
  1064. }
  1065. if (InBounty == 1) {
  1066. p.getActionSender().setPlayerOption(p, "Attack", 1, 1); // Attack
  1067. }
  1068. if (!wildernessZone(absX, absY) && InBounty == 0) {
  1069. p.getActionSender().setPlayerOption(p, "null", 1, 1); // Attack
  1070. } else if (wildernessZone(absX, absY)) {
  1071. p.getActionSender().setPlayerOption(p, "Attack", 1, 1); // Attack
  1072. }
  1073. if (!assistance) {
  1074. p.getActionSender().setPlayerOption(p, "null", 6, 0);
  1075. } else if (assistance) {
  1076. p.getActionSender().setPlayerOption(p, "Req Assist", 6, 0);
  1077. }
  1078. if (InBounty == 0 && safeArea(absX, absY)) {
  1079. p.getActionSender().setPlayerOption(p, "null", 1, 1); // Attack
  1080. }
  1081. p.getActionSender().setPlayerOption(p, "Follow", 4, 0);
  1082. p.getActionSender().setPlayerOption(p, "null", 3, 0); //Challenge
  1083. p.getActionSender().setPlayerOption(p, "Trade", 2, 0);
  1084. p.getActionSender().setPlayerOption(p, "null", 5, 0); // Whack
  1085. p.getActionSender().setPlayerOption(p, "null", 7, 0); // Pelt
  1086. }
  1087.  
  1088.  
  1089. public void bankpin() {
  1090. getActionSender().setString(this, "1", 13, 11);
  1091. getActionSender().setString(this, "2", 13, 12);
  1092. getActionSender().setString(this, "3", 13, 13);
  1093. getActionSender().setString(this, "4", 13, 14);
  1094. getActionSender().setString(this, "5", 13, 15);
  1095. getActionSender().setString(this, "6", 13, 16);
  1096. getActionSender().setString(this, "7", 13, 17);
  1097. getActionSender().setString(this, "8", 13, 18);
  1098. getActionSender().setString(this, "9", 13, 19);
  1099. getActionSender().setString(this, "0", 13, 20);
  1100. }
  1101.  
  1102. public int flaxTimer = 0;
  1103.  
  1104. public void pickFlax() {
  1105. if (flaxTimer > 0) {
  1106. return;
  1107. } else if (Engine.playerItems.freeSlotCount(this) < 1) {
  1108. return;
  1109. } else {
  1110. requestAnim(7270, 100);
  1111. Engine.playerItems.addItem(this, 1779, 1);
  1112. flaxTimer = 3;
  1113. return;
  1114. }
  1115. }
  1116.  
  1117. public int xLogCheck = 0;
  1118.  
  1119.  
  1120. public void friendsLoggedIn() {
  1121. for(Long friend : friends) {
  1122. getActionSender().sendFriend(this, friend, getWorld(friend));
  1123. }
  1124. long[] array = new long[ignores.size()];
  1125. int i = 0;
  1126. for(Long ignore : ignores) {
  1127. if(ignore != null)
  1128. array[i++] = ignore;
  1129. }
  1130. getActionSender().sendIgnores(this, array);
  1131. long me = Misc.stringToLong(username);
  1132. for(Player client : Engine.players) {
  1133. if(client == null) continue;
  1134. if(client.friends.contains(me)) {
  1135. client.getActionSender().sendFriend(client, me, 66);
  1136. }
  1137. }
  1138. }
  1139.  
  1140. public int getWorld(long friend) {
  1141. for(Player client : Engine.players) {
  1142. if(client != null && client.online) {
  1143. if(Misc.stringToLong(client.username) == friend) {
  1144. return 66;
  1145. }
  1146. }
  1147. }
  1148. return 0;
  1149. }
  1150. public void message(String message) {
  1151. getActionSender().sendMessage(this, message);
  1152. }
  1153. public int teleblocked;
  1154. public int teleblockTimer;
  1155.  
  1156. public boolean teletab;
  1157. public int leverTeleportX;
  1158. public int leverTeleportY;
  1159. public int leverTeleportH;
  1160. public int leverTeleportDelay = -1;
  1161.  
  1162. public boolean hitOne;
  1163. public boolean hitTwo;
  1164. public boolean hitThree;
  1165. public boolean hitFour;
  1166. public double hit1;
  1167. public double hit2;
  1168. public double hit3;
  1169. public double hit4;
  1170.  
  1171. public int specials;
  1172.  
  1173. public int spendingExperience = 10000000;
  1174.  
  1175. public int degrade = 6000;
  1176. public boolean degrades = degrade < 6000;
  1177.  
  1178. public void getSkillString() {
  1179. switch (leveledUpSkill) {
  1180.  
  1181. case 0:
  1182. skillString = "Attack";
  1183. break;
  1184. case 1:
  1185. skillString = "Defence";
  1186. break;
  1187. case 2:
  1188. skillString = "Strength";
  1189. break;
  1190. case 3:
  1191. skillString = "Hitpoints";
  1192. break;
  1193. case 4:
  1194. skillString = "Ranged";
  1195. break;
  1196. case 5:
  1197. skillString = "Prayer";
  1198. break;
  1199. case 6:
  1200. skillString = "Magic";
  1201. break;
  1202. case 10:
  1203. skillString = "Fishing";
  1204. break;
  1205. case 23:
  1206. skillString = "Summoning";
  1207. break;
  1208. case 16:
  1209. skillString = "Agility";
  1210. break;
  1211.  
  1212. }
  1213.  
  1214. }
  1215.  
  1216. /**
  1217. * String for leveling up
  1218. */
  1219. public String skillString = "";
  1220.  
  1221.  
  1222.  
  1223.  
  1224. public String[][] collects = new String[11][3]; // 0 = item, 1 = amt 2 = string
  1225. public String[][] collectsf = new String[11][3]; // 0 = item, 1 = amt (f means final)
  1226. public int geoffers = 0;
  1227. public int hasCollect = 0;
  1228. public String[][] pgeSO = new String[11][5];//all sell the offers: 0 = item, 1 = amt, 2 = price, 3 = username
  1229. public String[][] pgeBO = new String[11][5];//all buy the offers: 0 = item, 1 = amt, 2 = price, 3 = username
  1230.  
  1231. public int[] offerItem = new int[6];
  1232. public int[] offerAmount = new int[6];
  1233. public int[] currentAmount = new int[6];
  1234. public int[] offerType = new int[6];
  1235. public int[] offerPrice = new int[6];
  1236.  
  1237.  
  1238.  
  1239. //Combat variables
  1240.  
  1241. public double rangedMax;
  1242.  
  1243. public int attackedByCount;
  1244. public String attacking;
  1245. public String attackedBy;
  1246.  
  1247. public int spell;
  1248. public int spell2;
  1249. public int cuedSpell;
  1250. public int cuedSpells;
  1251. public int magicOppIndex;
  1252. public int graphicMSDelay;
  1253. public int magicGraphicDelay = -1;
  1254. public int magicDamageDelay = -1;
  1255. public int magicAffectDelay = -1;
  1256. public boolean successfulCast;
  1257. public boolean usingMage;
  1258. public boolean orb;
  1259. public int magicnIndex;
  1260. public int graphicMSDelay2 = -1;
  1261. public int magicGraphicDelay2 = -1;
  1262. public int magicDamageDelay2 = -1;
  1263. public int magicAffectDelay2 = -1;
  1264. public int cuedSpell2 = -1;
  1265. public int cuedSpells2 = -1;
  1266.  
  1267. public int tradedItem;
  1268.  
  1269. public int weapon;
  1270. public int strengthBonus;
  1271. public int oppIndex;
  1272. public int hitIndex;
  1273.  
  1274. public boolean getExperience = true;
  1275.  
  1276. public PTrade pTrade;
  1277.  
  1278. public void statSpy(Player other) {
  1279. int[] strings = {1, 25, 13, 5, 37, 49, 61, 45, 69, 65, 33, 57, 53, 21, 9, 29, 17, 41, 77, 81, 73, 85, 89, 93};
  1280. getActionSender().setString(this, other.username.substring(0, 1).toUpperCase() + other.username.substring(1), 523, 99);
  1281. for (int i = 0; i < strings.length; i++) {
  1282. getActionSender().setString(this, ""+other.skillLvl[i], 523, strings[i]);
  1283. getActionSender().setString(this, ""+other.getLevelForXP(i), 523, strings[i] + 1);
  1284. }
  1285. getActionSender().setTab(this, 79, 523);
  1286. }
  1287.  
  1288. public void clearItem(int item) {
  1289. for (int i = 0; i < bankItems.length; i++) {
  1290. if (item == bankItems[i]) {
  1291. bankItems[i] = -1;
  1292. bankItemsN[i] = 0;
  1293. }
  1294. }
  1295. for (int i = 0; i < equipment.length; i++) {
  1296. if (item == equipment[i]) {
  1297. equipment[i] = -1;
  1298. equipmentN[i] = 0;
  1299. }
  1300. }
  1301. for (int i = 0; i < items.length; i++) {
  1302. if (item == items[i]) {
  1303. items[i] = -1;
  1304. itemsN[i] = 0;
  1305. }
  1306. }
  1307. }
  1308.  
  1309. public void clearItem(String item) {
  1310. String name = item;
  1311. for (int i = 0; i < bankItems.length; i++) {
  1312. if (name.equals(Engine.items.getItemName(bankItems[i]))) {
  1313. bankItems[i] = -1;
  1314. bankItemsN[i] = 0;
  1315. }
  1316. }
  1317. for (int i = 0; i < equipment.length; i++) {
  1318. if (name.equals(Engine.items.getItemName(equipment[i]))) {
  1319. equipment[i] = -1;
  1320. equipmentN[i] = 0;
  1321. }
  1322. }
  1323. for (int i = 0; i < items.length; i++) {
  1324. if (name.equals(Engine.items.getItemName(items[i]))) {
  1325. items[i] = -1;
  1326. itemsN[i] = 0;
  1327. }
  1328. }
  1329. }
  1330.  
  1331. public boolean lever;
  1332. public void leverTeleport(String location) {
  1333. if (teleblocked == 1) {
  1334. getActionSender().sendMessage(this, "You are teleport blocked!");
  1335. return;
  1336. }
  1337. int x = absX;
  1338. int y = absY;
  1339. int h = 0;
  1340. if (location != null) {
  1341. if (location.equals("Deep Wilderness")) {
  1342. x = 3153;
  1343. y = 3923;
  1344. }
  1345. if (location.equals("Edgeville")) {
  1346. x = 3078;
  1347. y = 3488;
  1348. }
  1349. if (location.equals("Ardougne Lever")) {
  1350. x = 2561;
  1351. y = 3311;
  1352. }
  1353. if (location.equals("Mage Bank (Inside)")) {
  1354. x = 2539;
  1355. y = 4712;
  1356. }
  1357. if (location.equals("Mage Bank (Outside)")) {
  1358. x = 3090;
  1359. y = 3956;
  1360. }
  1361. }
  1362. getActionSender().removeShownInterface(this);
  1363. requestAnim(2140, 0);
  1364. leverTeleportX = x;
  1365. leverTeleportY = y;
  1366. leverTeleportH = h;
  1367. leverTeleportDelay = 2;
  1368. lever = true;
  1369. }
  1370.  
  1371. public void teletab(String city) {
  1372. int x = absX;
  1373. int y = absY;
  1374. int h = 0;
  1375. int r = 0;
  1376. teletab = true;
  1377. if (city != null) {
  1378. if (city.equals("Varrock")) {
  1379. return;
  1380. }
  1381. if (city.equals("Home")) {
  1382. return;
  1383. }
  1384. if (city.equals("Lumbridge")) {
  1385. return;
  1386. }
  1387. if (city.equals("Falador")) {
  1388. return;
  1389. }
  1390. if (city.equals("Camelot")) {
  1391. return;
  1392. }
  1393. if (city.equals("Ardougne")) {
  1394. return;
  1395. }
  1396. }
  1397. getActionSender().removeShownInterface(this);
  1398. x += getRandom(r);
  1399. y += getRandom(r);
  1400. teleportTo(x, y, h, 3, 0, 9597, 4071, 1680, 0, 678, 0);
  1401. }
  1402.  
  1403.  
  1404. public void cityTeleport(String city) {
  1405. int x = absX;
  1406. int y = absY;
  1407. int h = heightLevel;
  1408. int r = 0;
  1409. if (city != null) {
  1410. if (city.equals("Varrock")) {
  1411. return;
  1412. }
  1413. if (city.equals("Lumbridge")) {
  1414. return;
  1415. }
  1416. if (city.equals("Falador")) {
  1417. return;
  1418. }
  1419. if (city.equals("Camelot")) {
  1420. return;
  1421. }
  1422. if (city.equals("Ardougne")) {
  1423. return;
  1424. }
  1425. }
  1426. getActionSender().removeShownInterface(this);
  1427. x += getRandom(r);
  1428. y += getRandom(r);
  1429. teleportTo(x, y, h, 4, 0, 8939, 8941, 1576, 0, 1577, 0);
  1430. }
  1431.  
  1432. public boolean isPVP() {
  1433. return heightLevel == 4;
  1434. }
  1435. public boolean hotZone(int x, int y) {
  1436. if ((x >= 3205 && x <= 3222 && y >= 3420 && y <= 3438) || //Varrock
  1437. (x >= 3231 && x <= 3238 && y >= 3212 && y <= 3225) || //Lumbridge
  1438. (x >= 2949 && x <= 2978 && y >= 3367 && y <= 3391) || //Falador
  1439. (x >= 2741 && x <= 2774 && y >= 3464 && y <= 3481) || //Camelot
  1440. (x >= 2652 && x <= 2672 && y >= 3294 && y <= 3318)) { //Ardougne
  1441. return true;
  1442. }
  1443. return false;
  1444. }
  1445.  
  1446. public String getKillMessage(String player) {
  1447. String[][] selection = {{"It's official: you are far more awesome than ", " is."},
  1448. {"Let all warriors learn from the fate of ", " and fear you."},
  1449. {"Well done, you've pwned ", "."},
  1450. {"You rock, ", " clearly does not."},
  1451. {"", " was clearly no match for you."},
  1452. {"You have wiped the floor with ", "."},
  1453. {"Ooh, ", " just dropped dead, and it's all thanks to you!"},
  1454. {"", " has fallen before your mighty mightiness."},
  1455. {"You have proven your superiority over ", "."}};
  1456. int index = (int)Math.floor(Math.random() * 9);
  1457. return selection[index][0] + player + selection[index][1];
  1458. }
  1459.  
  1460. public boolean usingROL = false;
  1461.  
  1462. public void checkForROL() {
  1463. if (equipment[12] == 2570) {
  1464. if (getWildernessLevel() >= 30) {
  1465. return;
  1466. }
  1467. if (InBounty == 0) {
  1468. if (skillLvl[3] < 5 && skillLvl[3] != 0) {
  1469. if (Misc.random(2) == 2) {
  1470. usingROL = true;
  1471. setCoords(2846, 5655, 0);
  1472. message("Your ring of life has shattered.");
  1473. equipment[12] = -1;
  1474. equipmentN[12] = 0;
  1475. getActionSender().setItems(this, 387, 28, 94, equipment, equipmentN);
  1476. }
  1477. }
  1478. }
  1479. }
  1480. }
  1481.  
  1482. public boolean multiwayCombatZone(int x, int y) {
  1483. if ((x > 3072 && x < 3107 && y > 3401 && y < 3448) ||
  1484. (x > 2946 && x < 3004 && y > 3333 && y < 3424) ||
  1485. (x > 3193 && x < 3332 && y > 3665 && y < 3752) ||
  1486. (x > 3203 && x < 3331 && y > 3519 && y < 3666) ||
  1487. (x > 3134 && x < 3328 && y > 3519 && y < 3658) ||
  1488. (x > 2945 && x < 2961 && y > 3812 && y < 3828) ||
  1489. (x > 2982 && x < 3010 && y > 3913 && y < 3929) ||
  1490. (x > 3203 && x < 3392 && y > 3904 && y < 4031) ||
  1491. (x > 3149 && x < 3331 && y > 3799 && y < 3850) ||
  1492. (x > 3064 && x < 3391 && y > 3864 && y < 3903) ||
  1493. (x > 3819 && x < 2946 && y > 3864 && y < 3903) ||
  1494. (x > 2823 && x < 2843 && y > 5295 && y < 5310) ||
  1495. (x > 2823 && x < 2843 && y > 5295 && y < 5310) ||
  1496. (x > 2864 && x < 2878 && y > 5349 && y < 5371) ||
  1497. (x > 2917 && x < 2938 && y > 5315 && y < 5333) ||
  1498. (x > 2887 && x < 2909 && y > 5256 && y < 5279) ||
  1499. (x > 2894 && x < 2943 && y > 3718 && y < 5375) ||
  1500. (x > 2816 && x < 2929 && y > 5248 && y < 3754) ||
  1501. (x > 2816 && x < 2944 && y > 5248 && y < 5375) ||
  1502. (x > 2540 && x < 2635 && y > 5695 && y < 5762) ||
  1503. (x > 2946 && x < 2959 && y > 3814 && y < 3829) ||
  1504. (x > 3010 && x < 3046 && y > 3856 && y < 3892) ||
  1505. (x > 3046 && x < 3072 && y > 3893 && y < 3903) ||
  1506. (x > 3007 && x < 3071 && y > 3062 && y < 3711) ||
  1507. (x > 2919 && x < 5693 && y > 4358 && y < 4408)) {
  1508. return true;
  1509. }
  1510. return false;
  1511. }
  1512.  
  1513.  
  1514. public int setCoordTimer = -1;
  1515.  
  1516. public void climbUpLadder(int absX, int absY, int height) {
  1517. requestAnim(828, 0);
  1518. setHeight = height;
  1519. setAbsX = absX;
  1520. setAbsY = absY;
  1521. setCoordTimer = 3;
  1522. return;
  1523. }
  1524.  
  1525. public void climbDownLadder(int absX, int absY, int height) {
  1526. requestAnim(828, 0);
  1527. setHeight = height;
  1528. setAbsX = absX;
  1529. setAbsY = absY;
  1530. setCoordTimer = 3;
  1531. return;
  1532. }
  1533.  
  1534. public boolean timerStarted;
  1535. public long PVPTimer;
  1536.  
  1537. public void handleSideIcons(Player p) {
  1538. if (p.multiwayCombatZone(p.absX, p.absY)) {
  1539. getActionSender().setInterfaceConfig(this, 745, 0, false); //Allows the interface to be seen
  1540. getActionSender().setInterfaceConfig(this, 745, 1, false); //Sets the multi config
  1541. } else {
  1542. getActionSender().setInterfaceConfig(this, 745, 0, true);
  1543. }
  1544. }
  1545.  
  1546. public boolean wildernessZone(int x, int y) {
  1547. if (!isPVP()) {
  1548. return (x >= 3042 && x <= 3395 && y >= 3523 && y <= 4000);
  1549. }
  1550. if (isPVP()) {
  1551. if ((x >= 3091 && x <= 3098 && y >= 3488 && y <= 3499) ||
  1552. (x >= 3179 && x <= 3194 && y >= 3432 && y <= 3446) ||
  1553. (x >= 3036 && x <= 3055 && y >= 3371 && y <= 3385) ||
  1554. (x >= 3149 && x <= 3180 && y >= 3475 && y <= 3504) ||
  1555. (x >= 3250 && x <= 3257 && y >= 3416 && y <= 3423) ||
  1556. (x >= 2943 && x <= 2947 && y >= 2946 && y <= 3373) ||
  1557. (x >= 2943 && x <= 2949 && y >= 3368 && y <= 3368) ||
  1558. (x >= 3009 && x <= 3018 && y >= 3353 && y <= 3358) ||
  1559. (x >= 3009 && x <= 3022 && y >= 3353 && y <= 3356) ||
  1560. (x >= 2721 && x <= 2730 && y >= 3490 && y <= 3493) ||
  1561. (x >= 2724 && x <= 2727 && y >= 3487 && y <= 3489) ||
  1562. (x >= 2649 && x <= 2658 && y >= 3280 && y <= 3287) ||
  1563. (x >= 2612 && x <= 2621 && y >= 3330 && y <= 3335) ||
  1564. (x >= 3201 && x <= 3229 && y >= 3217 && y <= 3220) ||
  1565. (x >= 3201 && x <= 3226 && y >= 3209 && y <= 3228) ||
  1566. (x >= 3201 && x <= 3225 && y >= 3208 && y <= 3229) ||
  1567. (x >= 3201 && x <= 3224 && y >= 3207 && y <= 3230) ||
  1568. (x >= 3201 && x <= 3223 && y >= 3206 && y <= 3231) ||
  1569. (x >= 3201 && x <= 3222 && y >= 3205 && y <= 3232) ||
  1570. (x >= 3201 && x <= 3221 && y >= 3204 && y <= 3233) ||
  1571. (x >= 3201 && x <= 3220 && y >= 3203 && y <= 3234) ||
  1572. (x >= 3201 && x <= 3213 && y >= 3202 && y <= 3235) ||
  1573. (x >= 3201 && x <= 3212 && y >= 3201 && y <= 3236) ||
  1574. (x >= 3201 && x <= 3203 && y >= 3202 && y <= 3235) ||
  1575. (x >= 3201 && x <= 3202 && y >= 3203 && y <= 3234) ||
  1576. (x >= 3201 && x <= 3201 && y >= 3204 && y <= 3233)) {
  1577. //if ((attacking == null && attackedBy == null) || (timerStarted && System.currentTimeMillis() - PVPTimer >= 10000)) {
  1578. // if (timerStarted) {
  1579. // removeWilderness();
  1580. // timerStarted = false;
  1581. // }
  1582. return false;
  1583. //} else if (!timerStarted && (attacking == null || attackedBy != null)) {
  1584. // PVPTimer = System.currentTimeMillis();
  1585. // timerStarted = true;
  1586. //}
  1587. }
  1588. return true;
  1589. }
  1590. return false;
  1591. }
  1592.  
  1593. public int getWildernessLevel() {
  1594. int level = 0;
  1595. if (absY >= 3525 && absY <= 3527) {
  1596. level = 1;
  1597. } else if (absY >= 3526 && absY <= 3535) {
  1598. level = 2;
  1599. } else {
  1600. level = 3 + (int)Math.ceil((absY - 3536) / 8);
  1601. }
  1602. if (level < 0 || absY < 3525) {
  1603. level = 0;
  1604. }
  1605. if (level < 0 || (!(absX >= 2945 && absX <= 3395 && absY >= 3523 && absY <= 4000)) || absX >= 3279 && absX <= 3264 && absY >= 3672 && absY <= 3695) {
  1606. level = 0;
  1607. }
  1608. if (!isPVP()) {
  1609. return level;
  1610. }
  1611. if (isPVP()) {
  1612. double base = 5 + (combatLevel * 0.10);
  1613. int total = (int)Math.round(base) + level;
  1614. if (wildernessZone(absX, absY)) {
  1615. return total;
  1616. } else {
  1617. return 0;
  1618. }
  1619. }
  1620. return level;
  1621. }
  1622.  
  1623. public boolean properWildernessLevel(int thisCombat, int opponentCombat) {
  1624. int difference = thisCombat >= opponentCombat ? thisCombat - opponentCombat : opponentCombat - thisCombat;
  1625. return getWildernessLevel() >= difference;
  1626. }
  1627.  
  1628. public void restoreTabs(Player p) {
  1629. for (int b = 16; b <= 21; b++) {
  1630. p.getActionSender().setInterfaceConfig(p, 548, b, false);
  1631. }
  1632.  
  1633. for (int a = 32; a <= 38; a++) {
  1634. p.getActionSender().setInterfaceConfig(p, 548, a, false);
  1635. }
  1636. p.calculateEquipmentBonus();
  1637.  
  1638. p.getActionSender().setInterfaceConfig(p, 548, 14, false);
  1639. p.getActionSender().setInterfaceConfig(p, 548, 31, false);
  1640. p.getActionSender().setInterfaceConfig(p, 548, 63, false);
  1641.  
  1642. p.getActionSender().setInterfaceConfig(p, 548, 72, false);
  1643. }
  1644. public void hideTabs(Player p) {
  1645. for (int b = 16; b <= 21; b++) {
  1646. p.getActionSender().setInterfaceConfig(p, 548, b, true);
  1647. }
  1648.  
  1649. for (int a = 32; a <= 38; a++) {
  1650. p.getActionSender().setInterfaceConfig(p, 548, a, true);
  1651. }
  1652. p.calculateEquipmentBonus();
  1653.  
  1654. p.getActionSender().setInterfaceConfig(p, 548, 14, true);
  1655. p.getActionSender().setInterfaceConfig(p, 548, 31, true);
  1656. p.getActionSender().setInterfaceConfig(p, 548, 63, true);
  1657.  
  1658. p.getActionSender().setInterfaceConfig(p, 548, 72, true);
  1659. }
  1660.  
  1661. /**
  1662. * Player count in clan.
  1663. */
  1664. public static int blackCount, whiteCount;
  1665.  
  1666. public String clanName = "";
  1667. /**
  1668. * Clan wars teams
  1669. */
  1670. public static boolean blackTeam, whiteTeam;
  1671. /**
  1672. * Wilderness level
  1673. */
  1674. public int wildLevel;
  1675. /**
  1676. * If player updated the Wilderness level.
  1677. */
  1678. public boolean updatedLevel;
  1679. public int savedLevel;
  1680. /**
  1681. * Thieving.
  1682. */
  1683. public int[] thievingArray = new int[4];
  1684. public int maxArrays = 10;
  1685. public boolean[] optionArray = new boolean[maxArrays];
  1686. public TestWorldLoader worldLoader = new TestWorldLoader(this);
  1687. /**
  1688. * Has entered defence room Warrior guild.
  1689. */
  1690. public boolean enteredDefenceRoom;
  1691. /**
  1692. * Prevents XLogging.
  1693. */
  1694. public int combatType;
  1695. /**
  1696. * The delay for making a fire.
  1697. */
  1698. public int[] firemaking = new int[4];
  1699. /**
  1700. * Next graphic creating delay for MSB Special attack
  1701. */
  1702. public int nextDamageDelay = -1;
  1703. public int nextGraphicDelay = -1;
  1704.  
  1705.  
  1706. /**
  1707. * Item ids of which are not spawnable.
  1708. */
  1709. public int[] economyItems = {
  1710. 11696, 11698, 11700, 11694, 11730, 3140, 11718, 11720, 11722, 11724, 11726, 11728,
  1711. 11690, 11702, 11704, 11706, 11708, 10581, 10566, 10637, 385, 391, 2440, 2434, 6685,
  1712. 11235, 4151, 12670, 12671, 4153, 4447
  1713. };
  1714. /**
  1715. * Option variable
  1716. */
  1717. public int optionId;
  1718.  
  1719. /**
  1720. * Defender dropping types variable
  1721. */
  1722. public int defenderId;
  1723.  
  1724. /**
  1725. * Wilderness Levels
  1726. */
  1727. public int wildernessLevel;
  1728.  
  1729. /**
  1730. * Summoning variables
  1731. */
  1732. public int summonTeleDelay = -1;
  1733. public int summonDrainDelay = -1;
  1734. public boolean callFamiliar;
  1735. public boolean familiarDissMiss;
  1736. public boolean summonedFamiliar;
  1737.  
  1738. /**
  1739. * Warrior Guild variables
  1740. */
  1741. public int[] randomItemIds = {
  1742. 8843, 8844, 8845, 8846, 8847, 8848, 8849, 8850
  1743. };
  1744. public String warriorArmour;
  1745.  
  1746. /**
  1747. * autoCast Variables
  1748. */
  1749. public int[] regularStaffs = {
  1750. 1381
  1751. };
  1752. public int[] otherStaffs = {
  1753. 4675,6914,13867,1382
  1754. };
  1755. public int autoCastDmgDelay = -1;
  1756. public int autoCastDelay;
  1757. public int[] autoCast = new int[3];
  1758. public boolean castAuto;
  1759. public boolean usingAutoCast;
  1760. public int autocastSpell = 0;
  1761. public boolean autocast = false;
  1762. public int autocastSpellbook = 0;
  1763. /**
  1764. * If player is disturbing commander zilyana.
  1765. */
  1766. public boolean disturbSara;
  1767. /**
  1768. * Death Delays
  1769. */
  1770. public int deathEmoteDelay = -1;
  1771. /**
  1772. * Yell delay
  1773. */
  1774. public int massYellDelay = 0;
  1775.  
  1776. /**
  1777. * Crystal bow shots.
  1778. */
  1779. public int crystalShots;
  1780. public boolean isBanking;
  1781. public int explodeType;
  1782. public int explodeDelay = -1;
  1783.  
  1784. public int[] godWarsKills = new int[5];
  1785.  
  1786. public int watchId = -1;
  1787.  
  1788. public int spellType;
  1789.  
  1790. public int playerStart;
  1791.  
  1792. public boolean muteExpect, muteExpect2;
  1793. public int muteType;
  1794. public int[] hugeNpcs = {
  1795. 50, 1155, 1157, 1158, 1160, 2745, 6222, 6203
  1796. };
  1797.  
  1798. /**
  1799. * Pet variables
  1800. */
  1801. public int petKeeper;
  1802. public boolean summonedPet;
  1803.  
  1804. /**
  1805. * Mage Arena variables
  1806. */
  1807. public int kolodionDelay;
  1808. public boolean arenaActive;
  1809.  
  1810. /**
  1811. * Slayer variables
  1812. */
  1813. public int slayerAmount1;
  1814. public int slayerType1;
  1815. public int[] slayerType = {
  1816. 1615, 5363, 55, 54
  1817. };
  1818. public int slayerAmount;
  1819.  
  1820. /**
  1821. * Pvn variables
  1822. */
  1823. public int damageSpecDelay = -1;
  1824. public boolean enableSpecDamage;
  1825. public int damageDelay1 = -1;
  1826. public boolean enableDamage;
  1827. public int atkDelay;
  1828. public boolean attackingNpc;
  1829. public int attackNpc;
  1830.  
  1831. /**
  1832. * Clan wars variables.
  1833. */
  1834. public boolean blackClan;
  1835. public boolean whiteClan;
  1836.  
  1837. /**
  1838. * Thieving variables.
  1839. */
  1840. public int pickPocketDelay;
  1841.  
  1842. /**
  1843. * This variable is added to add facing if player is gonna pickpocket.
  1844. */
  1845. public int npcClick2;
  1846.  
  1847. /**
  1848. * Mining variables.
  1849. */
  1850. public int rockId;
  1851. public boolean isMining;
  1852. public int receiveOreDelay;
  1853. public int miningDelay;
  1854.  
  1855. /**
  1856. * Wilderness variables.
  1857. */
  1858. public int wildyLevel;
  1859.  
  1860. public int statDelay = 100; //Stat update delay
  1861. public int hpDelay = 100; //HP update delay
  1862.  
  1863. /**
  1864. * Emote clicking delay.
  1865. */
  1866. public int animClickDelay;
  1867. public boolean usingPrayer;
  1868. public int buryDelay;
  1869. public int drainDelay;
  1870. public boolean rangedPrayer;
  1871. public boolean meleePrayer;
  1872. public boolean magicPrayer;
  1873. public boolean retriPrayer;
  1874. public boolean redempPrayer;
  1875.  
  1876. public int tutStage = 0;
  1877.  
  1878. //Prayer
  1879.  
  1880. public void openRules(Player p) {
  1881. p.getActionSender().showInterface(p,685);
  1882. p.getActionSender().setString(p, "<col=3399FF>Incessant Rules", 685, 14);
  1883. p.getActionSender().setString(p, "<col=3399FF>1. No Discrimination of any kind, whether based on another player's race, nationality, gender, sexual orientation or religious beliefs.", 685, 15);
  1884. p.getActionSender().setString(p, "", 685, 16);
  1885. p.getActionSender().setString(p, "<col=3399FF>2. You must not use other software to gain an unfair advantage in the game. This includes automation tools, macros, bots, or auto-typers.", 685, 17);
  1886. p.getActionSender().setString(p, "", 685, 18);
  1887. p.getActionSender().setString(p, "<col=3399FF>3. You are not allowed to actively advertise in the game or forums. This includes advertising any website, Ip's or products, and no web addresses are allowed.", 685, 19);
  1888. p.getActionSender().setString(p, "<col=3399FF>4. You must not abuse the PvP system, no KDR tricking, No Bh potential gaining through friends.", 685, 20);
  1889. p.getActionSender().setString(p, "<col=3399FF>5. You must not use or attempt to use any cheats or errors which you find in our software. Any exploits which you find must be immediately reported to an admin.", 685, 21);
  1890. p.getActionSender().setString(p, "<col=3399FF>6. Each account should only be used by ONE person. Account sharing is NOT allowed. You may not sell, transfer or lend your account to anyone else, or permit anyone else to use your account, and you may not accept an account that anybody else offers you.", 685, 22);
  1891. return;
  1892. }
  1893.  
  1894. public double[][] prayers = {{1, 0, 5}, {4, 0, 5}, {7, 0, 5}, {8, 0, 5}, {9, 0, 5}, {10, 0, 10}, {13, 0, 10}, {16, 0, 10}, {19, 0, 1.67}, {22, 0, 3.33}, {25, 0, 3.33}, {26, 0, 10}, {27, 0, 10}, {28, 0, 20}, {31, 0, 20}, {34, 0, 20}, {36, 0, 20}, {37, 0, 20}, {40, 0, 20}, {43, 0, 20}, {44, 0, 20}, {45, 0, 20}, {46, 0, 5}, {49, 0, 10}, {52, 0, 30}, {60, 0, 38.33}, {70, 0, 38.33}};
  1895. public int headIconPrayer = -1;
  1896. public double drainCount = 0;
  1897.  
  1898. public boolean canPray(int prayer) {
  1899. if (skillLvl[5] > 0 && getLevelForXP(5) >= prayers[prayer][0]) {
  1900. return true;
  1901. }
  1902. return false;
  1903. }
  1904.  
  1905. public boolean usingPrayer(int prayer) {
  1906. return prayers[prayer][1] == 1;
  1907. }
  1908.  
  1909. public boolean usingPrayer() {
  1910. int i = 0;
  1911. while (i <= 26) {
  1912. if (prayers[i][1] == 1) return true;
  1913. i++;
  1914. }
  1915. return false;
  1916. }
  1917.  
  1918. public void togglePrayer(int prayer, int toggle) {
  1919. int[] configuration = {83, 84, 85, 862, 863, 86, 87, 88, 89, 90, 91, 864, 865, 92, 93, 94, 1168, 95, 96, 97, 866, 867, 98, 99, 100, 1052, 1053};
  1920. prayers[prayer][1] = toggle;
  1921. getActionSender().setConfig(this, configuration[prayer], toggle);
  1922. }
  1923.  
  1924. public double prayerDrain() {
  1925. int i = 0;
  1926. double drainPerMinute = 0;
  1927. while (i <= 26) {
  1928. if (usingPrayer(i)) drainPerMinute += prayers[i][2];
  1929. i++;
  1930. }
  1931. drainPerMinute *= 1 + (equipmentBonus[11] / 30);
  1932. return drainPerMinute / 100;
  1933. }
  1934.  
  1935. public void switchPrayers(int[] prayers, int prayer) {
  1936. if (!canPray(prayer)) {
  1937. return;
  1938. }
  1939. for (int i : prayers) {
  1940. if (usingPrayer(i)) {
  1941. togglePrayer(i, 0);
  1942. }
  1943. }
  1944. }
  1945.  
  1946.  
  1947. public void WalkingTo(int x, int y) {
  1948. int firstX = x - (mapRegionX - 6) * 8;
  1949. int firstY = y - (mapRegionY - 6) * 8;
  1950. Engine.playerMovement.resetWalkingQueue(this);
  1951. Engine.playerMovement.addToWalkingQueue(this, firstX, firstY);
  1952. appearanceUpdateReq = true;
  1953. updateReq = true;
  1954. }
  1955.  
  1956. public void reqWalkQueue(int x, int y) {
  1957. int firstX = x - (mapRegionX - 6) * 8;
  1958. int firstY = y - (mapRegionY - 6) * 8;
  1959. Engine.playerMovement.resetWalkingQueue(this);
  1960. Engine.playerMovement.addStepToWalkingQueue(firstX, firstY, this);
  1961. Engine.playerMovement.addStepToWalkingQueue(firstX, firstY+1, this);
  1962. Engine.playerMovement.addStepToWalkingQueue(firstX, firstY+2, this);
  1963. }
  1964.  
  1965. public void reqWalkQueueBack(int x, int y) {
  1966. int firstX = x - (mapRegionX - 6) * 8;
  1967. int firstY = y - (mapRegionY - 6) * 8;
  1968. Engine.playerMovement.resetWalkingQueue(this);
  1969. Engine.playerMovement.addStepToWalkingQueue(firstX, firstY, this);
  1970. Engine.playerMovement.addStepToWalkingQueue(firstX, firstY-1, this);
  1971. Engine.playerMovement.addStepToWalkingQueue(firstX, firstY-2, this);
  1972. }
  1973.  
  1974.  
  1975.  
  1976.  
  1977. public void prayerSounds(int prayer) {
  1978. int sound = 0;
  1979. switch (prayer) {
  1980. case 0: sound = 2690; break;
  1981. case 1: sound = 2688; break;
  1982. case 2: sound = 2664; break;
  1983. case 3: sound = 2685; break;
  1984. case 4: sound = 2668; break;
  1985. case 5: sound = 2684; break;
  1986. case 6: sound = 2689; break;
  1987. case 7: sound = 2662; break;
  1988. case 8: sound = 2679; break;
  1989. case 9: sound = 2678; break;
  1990. case 10: sound = 0; break;
  1991. case 11: sound = 2666; break;
  1992. case 12: sound = 2670; break;
  1993. case 13: sound = 2687; break;
  1994. case 14: sound = 2691; break;
  1995. case 15: sound = 2667; break;
  1996. case 16: sound = 0; break;
  1997. case 17: sound = 2675; break;
  1998. case 18: sound = 2677; break;
  1999. case 19: sound = 2676; break;
  2000. case 20: sound = 2665; break;
  2001. case 21: sound = 2669; break;
  2002. case 22: sound = 2682; break;
  2003. case 23: sound = 2680; break;
  2004. case 24: sound = 2686; break;
  2005. case 25: sound = 3826; break;
  2006. case 26: sound = 3825; break;
  2007. }
  2008. if (sound != 0) {
  2009. getActionSender().addSoundEffect(this, sound, 1, 0, 0);
  2010. }
  2011. }
  2012.  
  2013. public void resetPrayer() {
  2014. int i = 0;
  2015. while (i <= 26) {
  2016. togglePrayer(i, 0);
  2017. i++;
  2018. }
  2019. drainCount = 0;
  2020. headIconPrayer = -1;
  2021. updateReq = true;
  2022. appearanceUpdateReq = true;
  2023. }
  2024. public void resetHp() {
  2025. for (int i = 0; i < skillLvl.length; i++) {
  2026. skillLvl[i] = getLevelForXP(i);
  2027. getActionSender().setSkillLvl(this, i);
  2028. }
  2029. }
  2030. public void resetSpecial() {
  2031. specAmount = 1000;
  2032. getActionSender().setConfig2(this, 300, 1000);
  2033. }
  2034.  
  2035.  
  2036.  
  2037. /**
  2038. * Magic combat variables
  2039. */
  2040. public int freezeDelay;
  2041. public int vengeanceDelay;
  2042. public boolean vengeance;
  2043. public int spellbookSwapTimer;
  2044. public boolean spellbookSwap;
  2045. public boolean switchingMagics = false;
  2046. public boolean usedSpellbookSwap;
  2047. public int mageDelay;
  2048.  
  2049. /**
  2050. * Agility Variables
  2051. */
  2052. public int[] agilityX = {
  2053. 2476, 2475, 2474, 2473, 2472, 2471
  2054. };
  2055. public int[] agilityY = {
  2056. 3426
  2057. };
  2058. public boolean agilityPerforming;
  2059. public int agilityDelay;
  2060. public int agilityType;
  2061.  
  2062. /**
  2063. * Combat variables
  2064. */
  2065. public boolean fadeAway;
  2066. public int enemyFadeAwayDelay = -1;
  2067. public int fightStyle = 1;
  2068. public int[] strangeItems = {
  2069. 6570
  2070. };
  2071. public int battleCDelay;
  2072. public int battleCount;
  2073. public int poisonDelay;
  2074. public int poisonHitCount;
  2075. public boolean isPoisoned;
  2076. public int headIconSkull = -1;
  2077. public boolean isSkulled;
  2078. public int skullVanishDelay;
  2079. public int bountyLeavedelay;
  2080. public int rangeDmgDelay = -1;
  2081. public int rangeDmgDelay2 = -1;
  2082.  
  2083. public int[] rangeBows = {
  2084. 841, 843, 845, 847, 849, 851, 853,
  2085. 855, 857, 859, 861, 9174, 9176, 9177,
  2086. 9179, 9181, 9183, 9185
  2087. };
  2088. public int[] rangeArrows = {
  2089. 882, 884, 886, 888, 890, 892
  2090. };
  2091. public int[] godSwords = {
  2092. 11694, 11696, 11698, 11700
  2093. };
  2094. public int myBonus;
  2095. public int meleeDef;
  2096. public int waitDeathDelay = -1;
  2097. public boolean randomVariable;
  2098. public int deathDelay = -1;
  2099. public boolean isDead;
  2100. public int specDelay = -1;
  2101. public int secondSpecDelay = -1;
  2102. public int delayedDamageDelay = -1;
  2103. public int delayedDamageHit = -1;
  2104. public boolean expectSpec;
  2105. public boolean autoRetaliate = false;
  2106. public int specFillDelay = 50;
  2107. public boolean usingSpecial;
  2108. public int specAmount;
  2109. public int damageDelay;
  2110. public boolean damagePending;
  2111. public int combatDelay;
  2112. public int enemyIndex;
  2113. public boolean attackingPlayer;
  2114.  
  2115. public boolean settingsToggled = false;
  2116.  
  2117.  
  2118. public int[] shop2 = {10828, 11694, 6585 ,6570, 6737, 11235};
  2119. public int[] shop2n = {100000, 100000, 100000, 100000,100000,100000};
  2120. public int[] shop2p = {100000, 88000000, 2000000, 162000,12000,1500000};
  2121. public int shopid = 0;
  2122.  
  2123.  
  2124.  
  2125. /**
  2126. * Player's index.
  2127. */
  2128. public int playerId = 0;
  2129. /**
  2130. * Class for storing and converting bytes.
  2131. */
  2132. public ByteVector stream = new ByteVector(500, 5000);
  2133. /**
  2134. * Player's socket for handling most io operations.
  2135. */
  2136. public PlayerSocket socket;
  2137. /**
  2138. * Set to true if the player has finished the login stage.
  2139. */
  2140. public boolean online = false;
  2141. /**
  2142. * Player's username.
  2143. */
  2144. public String username = "null";
  2145. /**
  2146. * Player's password.
  2147. */
  2148. public String password = "";
  2149. /**
  2150. * Player's rights.
  2151. */
  2152. public int rights = 0;
  2153. /**
  2154. * 1 set to true means socket disconnected but logged in, both for removing the player.
  2155. */
  2156. public boolean[] disconnected = new boolean[2];
  2157. /**
  2158. * The region this player is in.
  2159. */
  2160. public int mapRegionX = 0;
  2161. public int mapRegionY = 0;
  2162. /**
  2163. * The position this player is at in the map region.
  2164. */
  2165. public int currentX = 0;
  2166. public int currentY = 0;
  2167. /**
  2168. * Absolute coordinates this player is at.
  2169. */
  2170. public int absX = 0;
  2171. public int absY = 0;
  2172. /**
  2173. * The height level this player is at.
  2174. */
  2175. public int heightLevel = 0;
  2176. public int lastHeight;
  2177. /**
  2178. * Storing players spellbook
  2179. */
  2180. public int spellbook = 192;
  2181. /**
  2182. * If either are above -1 then the player is in motion.
  2183. */
  2184. public int walkDir = -1;
  2185. public int runDir = -1;
  2186. /**
  2187. * True if the player is running, false if it isn't.
  2188. */
  2189. public boolean isRunning = false;
  2190. /**
  2191. * Set to true if the player has entered a new map region.
  2192. */
  2193. public boolean mapRegionDidChange = false;
  2194. /**
  2195. * Set to true if teleported.
  2196. */
  2197. public boolean didTeleport = false;
  2198. /**
  2199. * Set Absolute coordinates to these.
  2200. */
  2201. public int teleportToX = -1;
  2202. public int teleportToY = -1;
  2203. public int teleportToH = -1;
  2204.  
  2205. /**
  2206. * True if the player is Reqing an update.
  2207. */
  2208. public boolean updateReq = false;
  2209. /**
  2210. * Max number of steps this player can have pending.
  2211. */
  2212. public int walkingQueueSize = 50;
  2213. public int wQueueReadPtr = 0;
  2214. public int wQueueWritePtr = 0;
  2215. /**
  2216. * Positions the player is Reqing to walk to.
  2217. */
  2218. public int[] walkingQueueX = new int[walkingQueueSize];
  2219. public int[] walkingQueueY = new int[walkingQueueSize];
  2220. public int[] walkingQueue = new int[walkingQueueSize];
  2221. /**
  2222. * All the players within distance.
  2223. */
  2224. public Player[] playerList = new Player[Engine.players.length];
  2225. /**
  2226. * All the players stored in distance.
  2227. */
  2228. public byte[] playersInList = new byte[Engine.players.length];
  2229. public int playerListSize = 0;
  2230. /**
  2231. * True if chatting is Reqing to be sent.
  2232. */
  2233. public boolean chatTextUpdateReq = false;
  2234. public String chatText = "";
  2235. public int chatTextEffects = 0;
  2236. /**
  2237. * True if an appearance update is needed.
  2238. */
  2239. public boolean appearanceUpdateReq = false;
  2240. /**
  2241. * Animation data.
  2242. */
  2243. public boolean animUpdateReq = false;
  2244. public int animReq = -1;
  2245. public int animDelay = 0;
  2246. /**
  2247. * GFX data.
  2248. */
  2249. public boolean gfxUpdateReq = false;
  2250. public int gfxReq = -1;
  2251. public int gfxDelay = 0;
  2252. /**
  2253. * Player and NPC facing data.
  2254. */
  2255. public boolean faceToUpdateReq = false;
  2256. public int faceToReq = -1;
  2257. /**
  2258. * Damage data.
  2259. */
  2260. public boolean hit1UpdateReq = false;
  2261. public boolean hit2UpdateReq = false;
  2262. public int hitDiff1 = 0;
  2263. public int hitDiff2 = 0;
  2264. public int poisonHit1 = 0;
  2265. public int poisonHit2 = 0;
  2266. /**
  2267. * Skill level data.
  2268. */
  2269. public int[] skillLvl = new int[25];
  2270. public int[] skillXP = new int[25];
  2271. public int combatLevel = 0;
  2272. /**
  2273. * Equipment data.
  2274. */
  2275. public int[] equipment = new int[14];
  2276. public int[] equipmentN = new int[14];
  2277. public int[] equipmentBonus = new int[12];
  2278. /**
  2279. * Player appearance.
  2280. */
  2281. public int[] color = new int[5];
  2282. public int[] look = new int[7];
  2283. public int npcType = -1;
  2284. public int gender = 0;
  2285.  
  2286. /**
  2287. * Facing request.
  2288. */
  2289. public boolean faceCoordsUpdateReq = false;
  2290. public int faceCoordsX = -1;
  2291. public int faceCoordsY = -1;
  2292.  
  2293. /**
  2294. * Request this Player faces two coordinates.
  2295. * @param x The x coordinate to face.
  2296. * @param y The y coordinate to face.
  2297. */
  2298. public void requestFaceCoords(int x, int y) {
  2299. faceCoordsX = 2 * x + 1;
  2300. faceCoordsY = 2 * y + 1;
  2301. faceCoordsUpdateReq = true;
  2302. updateReq = true;
  2303. }
  2304.  
  2305. /**
  2306. * Player emotes.
  2307. */
  2308. public int runEmote = 0x338;
  2309. public int walkEmote = 0x333;
  2310. public int standEmote = 0x328;
  2311. /**
  2312. * All the NPCs within distance.
  2313. */
  2314. public NPC[] npcList = new NPC[Engine.npcs.length];
  2315. /**
  2316. * All the npcs stored in distance.
  2317. */
  2318. public byte[] npcsInList = new byte[Engine.npcs.length];
  2319. public int npcListSize = 0;
  2320. /**
  2321. * Rebuild the entire NPC list.
  2322. */
  2323. public boolean rebuildNPCList = false;
  2324. /**
  2325. * An array storing all the players items.
  2326. */
  2327. public int[] items = new int[28];
  2328. public int[] itemsN = new int[28];
  2329. /**
  2330. * Open interfaces, use these to confirm an interface is open when trying to use one.
  2331. */
  2332. public int interfaceId = -1;
  2333. public int chatboxInterfaceId = -1;
  2334. public int overlayId = -1;
  2335. /**
  2336. * The current position in the login stage.
  2337. */
  2338. public int loginStage = 0;
  2339. /**
  2340. * Click x position.
  2341. */
  2342. public int clickX = 0;
  2343. /**
  2344. * Click y position.
  2345. */
  2346. public int clickY = 0;
  2347. /**
  2348. * Click id.
  2349. */
  2350. public int clickId = 0;
  2351. /**
  2352. * Eat delay.
  2353. */
  2354. public int eatDelay;
  2355. public int drinkDelay;
  2356. /**
  2357. * True if the player is trying to pickup an item.
  2358. */
  2359. public boolean itemPickup = false;
  2360. /**
  2361. * Set run energy.
  2362. */
  2363. public boolean runEnergyUpdateReq = false;
  2364. /**
  2365. * Amount of current run energy.
  2366. */
  2367. public int runEnergy = 100;
  2368. /**
  2369. * Delay before run energy can increase.
  2370. */
  2371. public int runEnergyDelay = 0;
  2372. /**
  2373. * Clicked the first option on a player.
  2374. */
  2375. public boolean playerOption1 = false;
  2376. /**
  2377. * Clicked the second option on a player.
  2378. */
  2379. public boolean playerOption2 = false;
  2380. /**
  2381. * Clicked the third option on a player.
  2382. */
  2383. public boolean playerOption3 = false;
  2384. /**
  2385. * Clicked the Fourth option on a player.
  2386. */
  2387. public boolean playerOption4 = false;
  2388. /**
  2389. * Clicked the first option on a NPC.
  2390. */
  2391. public boolean npcOption1 = false;
  2392. /**
  2393. * Clicked the first option on an object.
  2394. */
  2395. public boolean objectOption1 = false;
  2396. /**
  2397. * Setting the prayer system effects.
  2398. */
  2399. public PrayerSystem prayerSystem = new PrayerSystem(this);
  2400. /**
  2401. * Setting the players weapon.
  2402. */
  2403. public PlayerWeapon playerWeapon = new PlayerWeapon(this);
  2404. /**
  2405. * Clicked the second option on an object.
  2406. */
  2407. public boolean objectOption2 = false;
  2408. /**
  2409. * Clicked the second option on a NPC.
  2410. */
  2411. public boolean npcOption2 = false;
  2412.  
  2413. /**
  2414. * Clicked the third option on a NPC.
  2415. */
  2416. public boolean npcOption3 = false;
  2417.  
  2418. /**
  2419. * Forced chat.
  2420. */
  2421. public String forceChat = "";
  2422. public boolean forceChatUpdateReq = false;
  2423. /**
  2424. * Teleporting variables.
  2425. */
  2426. public int teleX = -1;
  2427. public int teleY = -1;
  2428. public int teleH = -1;
  2429. public int teleDelay = -1;
  2430. public int teleFinishGFX = 0;
  2431. public int teleFinishGFXHeight = 0;
  2432. public int teleFinishAnim = 0;
  2433. /**
  2434. * Delay before recieving packets.
  2435. */
  2436. public int clickDelay = -1;
  2437. public long loginTimeout = System.currentTimeMillis();
  2438.  
  2439. /**
  2440. * Constructs a new Player.
  2441. * @param socket The socket this Player belongs to.
  2442. * @param id The index this player is at.
  2443. */
  2444. public Player(Socket socket, int id) {
  2445. this.socket = new PlayerSocket(this, socket);
  2446. playerId = id;
  2447. look[0] = 3;
  2448. look[1] = 10;
  2449. look[2] = 18;
  2450. look[3] = 26;
  2451. look[4] = 33;
  2452. look[5] = 36;
  2453. look[6] = 42;
  2454.  
  2455. for (int i = 0; i < skillLvl.length; i++) {
  2456. skillLvl[i] = 99;
  2457. skillXP[i] = 14000000;
  2458. skillLvl[23] = 1;
  2459. skillXP[23] = 0;
  2460. }
  2461. for (int i = 0; i < items.length; i++) {
  2462. items[i] = -1;
  2463. itemsN[i] = 0;
  2464. }
  2465. for (int i = 0; i < equipment.length; i++) {
  2466. equipment[i] = -1;
  2467. }
  2468. for (int i = 0; i < bankItems.length; i++) {
  2469. bankItems[i] = -1;
  2470. }
  2471. pTrade = new PTrade(this);
  2472. }
  2473.  
  2474. public int bhValue() {
  2475. int bhValue = 0;
  2476. try {
  2477. int[] allItems = new int[items.length + equipment.length];
  2478. System.arraycopy(items, 0, allItems, 0, items.length);
  2479. System.arraycopy(equipment, 0, allItems, items.length, equipment.length);
  2480.  
  2481. for (int i : allItems) {
  2482. bhValue += getItemValue(i);
  2483. }
  2484. } catch (Exception e) {
  2485. e.printStackTrace();
  2486. return 0;
  2487. }
  2488. return bhValue;
  2489. }
  2490.  
  2491. public boolean skillCapeEquiped() {
  2492. for (int i = 10639; i < 10663; i++) {
  2493. for (int j = 9747; j < 9812; j++) {
  2494. if (equipment[1] == i || equipment[1] == j || equipment[1] == 12169 || equipment[1] == 12170) {
  2495. return true;
  2496. }
  2497. }
  2498. }
  2499. return false;
  2500. }
  2501. public int PickupTimer;
  2502. public int logoutTimer;
  2503. public int restoreSpecialTimer;
  2504. public int prayingForCape = 0;
  2505. public int capeId = -1;
  2506. public int hasGodCape = -1;
  2507. public String prayingToGod = "";
  2508. public int getCapeToSpawn() {
  2509. if (capeId == 3) {
  2510. return 2412;
  2511. } else if (capeId == 5) {
  2512. return 2413;
  2513. } else if (capeId == 4) {
  2514. return 2414;
  2515. } else {
  2516. return -1;
  2517. }
  2518. }
  2519.  
  2520. public void prayForCape(int capeId) {
  2521. prayingForCape = 2;
  2522. WalkingTo(absX, absY-1);
  2523. }
  2524. public void prayForCape1() {
  2525. requestFaceTo(capeId);
  2526. requestAnim(645, 0);
  2527. message("You begin to chant to " + prayingToGod + "...");
  2528. if (hasGodCape == -1) {
  2529. message("...you get a response.");
  2530. Engine.items.createGroundItem(getCapeToSpawn(), 1, absX, absY+1, 0, username);
  2531. hasGodCape = getCapeToSpawn();
  2532. return;
  2533. } else {
  2534. message("...you get no response.");
  2535. return;
  2536. }
  2537. }
  2538.  
  2539. public int dude = 1;
  2540.  
  2541. public int hasClan = 0;
  2542.  
  2543. public int getSpecAmount(Player p) {
  2544. if (p.weapon == 5698 || p.weapon == 1305 || p.weapon == 1434) {
  2545. return 250;
  2546. }
  2547. if (p.weapon == 11694 || p.weapon == 11698 || p.weapon == 14484 || p.weapon == 10887 || p.weapon == 4151 || p.weapon == 3101 || p.weapon == 13883 || p.weapon == 13879) {
  2548. return 500;
  2549. }
  2550. if (p.weapon == 11235 || p.weapon == 861) {
  2551. return 550;
  2552. }
  2553. if (p.weapon == 11700) {
  2554. return 600;
  2555. }
  2556. if (p.weapon == 11696 || p.weapon == 11730) {
  2557. return 1000;
  2558. }
  2559. return 0;
  2560. }
  2561.  
  2562. public int curseTimer = -1;
  2563.  
  2564. public boolean setPlayerOps = true;
  2565.  
  2566. public boolean inClanChat = false;
  2567.  
  2568. public void theivestop(final Player p) {
  2569. EventManager.getSingleton().addEvent(
  2570. new Event() {
  2571. public void execute(EventContainer c) {
  2572. if (thievedelay > 0) {
  2573. thievedelay--;
  2574. }
  2575. if (p == null || p.disconnected[0] || thievedelay <= 0) {
  2576. p.isthieveing = false;
  2577. c.stop();
  2578. }
  2579. }
  2580. }, 600);
  2581. };
  2582.  
  2583. public void randomtime(final Player p) {
  2584. EventManager.getSingleton().addEvent(
  2585. new Event() {
  2586. public void execute(EventContainer c) {
  2587. if (actionTimer > 0) {
  2588. actionTimer--;
  2589. }
  2590. if (actionTimer <= 0) {
  2591. actionTimer = -1;
  2592. c.stop();
  2593. }
  2594. }
  2595. }, 1000);
  2596. };
  2597.  
  2598. public void processTimers() { //Processes evenly at 1000 milliseconds
  2599.  
  2600. // if (VLSTimer > 0 && equipment[3] == 13901 && attackedBy != null) {
  2601. // VLSTimer--;
  2602. // }
  2603. if (leftBhTimer > 0) {
  2604. leftBhTimer--;
  2605. }
  2606.  
  2607. if (bhLeave1 > 0) {
  2608. bhLeave1--;
  2609. }
  2610. if (InBounty == 1) {
  2611. handleBountyHunter();
  2612. }
  2613. if (immuneTimer > 0) {
  2614. immuneTimer--;
  2615. }
  2616. if (setPlayerOps) {
  2617. setPlayerOps = false;
  2618. setPlayerOptions(this);
  2619. }
  2620. if (specAmount == 0 && usingSpecial) {
  2621. usingSpecial = false;
  2622. }
  2623. if (specAmount < 0) {
  2624. specAmount = 0;
  2625. }
  2626. if (loginTimer > 0) {
  2627. loginTimer--;
  2628. }
  2629. if (xLogCheck > 0) {
  2630. xLogCheck--;
  2631. }
  2632. //handleSideIcons(this);
  2633. if (followingPlayer)
  2634. Engine.playerFollow.followPlayer(this);
  2635. if (miasmicSpell > 0) {
  2636. miasmicSpell--;
  2637. }
  2638. if (freezeDelay > 0) {
  2639. freezeDelay--;
  2640. }
  2641. if (vengeanceDelay > 0) {
  2642. vengeanceDelay--;
  2643. }
  2644. // if (stunned > 0) {
  2645. // stunned--;
  2646. // }
  2647. if (cantPray > 0)
  2648. cantPray--;
  2649.  
  2650. if (spellbookSwapTimer > 0) {
  2651. spellbookSwapTimer--;
  2652. } else if (spellbookSwap) {
  2653. getActionSender().setTab(this, 79, spellbook);
  2654. spellbookSwap = false;
  2655. usedSpellbookSwap = false;
  2656. }
  2657.  
  2658. if (attackedBy != null) {
  2659. count++;
  2660. if (count == 6) {
  2661. attackedBy = null;
  2662. OriginalAttacker = null;
  2663. attackedByCount--;
  2664. count = 0;
  2665. }
  2666. }
  2667.  
  2668. if (logoutTimer > 0)
  2669. logoutTimer--;
  2670.  
  2671. if (restoreSpecialTimer > 0)
  2672. restoreSpecialTimer--;
  2673.  
  2674.  
  2675. }
  2676.  
  2677.  
  2678. /**
  2679. * This method is called every 600 milliseconds.
  2680. * <p>While this is good for for changing integers, this
  2681. * should not be abused. Things that can be handled else where should
  2682. * be done in that way, such as clicking the accept button in trade
  2683. * should update in the ActionsButton class rather than Reqing
  2684. * an update for the process to handle.
  2685. */
  2686. public int cantPray;
  2687.  
  2688. public void attackPlayer() {
  2689. PlayerCombat pc = new PlayerCombat(this);
  2690. pc.attackPlayer();
  2691. }
  2692.  
  2693. /**
  2694. * Wilderness ditch jump data.
  2695. */
  2696. public int jumpDelay = 0;
  2697. public boolean jumpUpdateReq = false;
  2698.  
  2699. public int setHeight;
  2700. public int setAbsX;
  2701. public int setAbsY;
  2702. public int count;
  2703. public boolean usedLogout;
  2704. public boolean equipUpdate = false;
  2705. public int lastSlotUsed;
  2706.  
  2707. public int clickTime = 0;
  2708.  
  2709.  
  2710.  
  2711. public void process() {
  2712. /* if (waveDelay > 0) {
  2713. waveDelay--;
  2714. }
  2715. if (waveDelay == 0) {
  2716. fCave.fightSystem();
  2717. }
  2718. if (countDelay > 0) {
  2719. countDelay--;
  2720. }
  2721. if (countDelay == 0) {
  2722. if (countType >= 0) {
  2723. if (countType == 3) {
  2724. requestForceChat("3");
  2725. } else if (countType == 2) {
  2726. requestForceChat("2");
  2727. } else if (countType == 1) {
  2728. requestForceChat("1");
  2729. } else if (countType == 0) {
  2730. requestForceChat("FIGHT!");
  2731. }
  2732. countType--;
  2733. countDelay = 3;
  2734. } else {
  2735. countType = -1;
  2736. countDelay = -1;
  2737. }
  2738. }*/
  2739. //getDuelClass().process();
  2740. /**
  2741. * Warrior Guild
  2742. */
  2743. /*//if (!enteredDefenceRoom) {
  2744. // if (absX == 2842 && absY == 3545 && heightLevel == 1)
  2745. // getWarriorClass().addWarriorDefenceEvent();
  2746. // enteredDefenceRoom = false;
  2747. // }
  2748. if (thievingArray[0] > 0)
  2749. thievingArray[0]--;
  2750. if (thievingArray[0] == 0) {
  2751. PlayerThieving thievClass = new PlayerThieving(this);
  2752. thievClass.addStallThievingEvent();
  2753. }
  2754. if (thievingArray[3] > 0)
  2755. thievingArray[3]--;*/
  2756. /* if (pickPocketTimer > 0) {
  2757. pickPocketTimer--;
  2758. }*/
  2759. /*if (teleblocked == 1 && teleblockTimer > 0) {
  2760. // if (teleblockTimer == 500) {
  2761. // getActionSender().sendMessage(this, "You have been teleport blocked!");
  2762. // if (usingPrayer(17)) {
  2763. // teleblockTimer = 250;
  2764. // }
  2765. // }
  2766. // teleblockTimer--;
  2767. // }
  2768. // if (teleblockTimer == 1) {
  2769. // teleblocked = 0;
  2770. // teleblockTimer = 500;
  2771. // getActionSender().sendMessage(this, "The teleport block has worn off.");
  2772. }*/
  2773. //handleWarriorsGuild(this);
  2774. //shopHandler.process(this);
  2775. //getOverlays();
  2776. //mi.process();
  2777. /*if (skullVanishDelay > 0) {
  2778. skullVanishDelay--;
  2779. }
  2780. if (skullVanishDelay == 0 && isSkulled && (InBounty == 0)) {
  2781. headIconSkull = -1;
  2782. isSkulled = false;
  2783. skullVanishDelay = 0;
  2784. appearanceUpdateReq = true;
  2785. updateReq = true;
  2786. }*/
  2787.  
  2788.  
  2789. // Above till process = unused
  2790. // Above till process = unused
  2791.  
  2792. if(clawTimer2 > 0)
  2793. clawTimer2--;
  2794. if(clawTimer2 == 0 && UseClaws2) {
  2795. dClaw3(this);
  2796. UseClaws2 = false;
  2797. }
  2798. if (DFSDelay > 0) {
  2799. DFSDelay--;
  2800. } else if (DFSDelay == 0) {
  2801. append1Hit((int)Math.round(Math.random() * 25), 0);
  2802. DFSDelay = -1;
  2803. }
  2804. if (leverTeleportDelay > 0) {
  2805. leverTeleportDelay--;
  2806. } else if (leverTeleportDelay == 0) {
  2807. teleportTo(leverTeleportX, leverTeleportY, leverTeleportH, 4, 0, 8939, 8941, 1576, 0, 1577, 0);
  2808. lever = false;
  2809. leverTeleportDelay--;
  2810. }
  2811.  
  2812.  
  2813. if (degrades && equipment[3] == 13899) {
  2814. degrade--;
  2815. if (degrade == 0) {
  2816. boolean deleted = false;
  2817. PlayerItems playerItems = new PlayerItems();
  2818. for (int i = 0; i < equipment.length; i++) {
  2819. if (equipment[i] == 13290) {
  2820. equipment[i] = -1;
  2821. equipmentN[i] = 0;
  2822. getActionSender().setItems(this, 387, 28, 93, equipment, equipmentN);
  2823. getActionSender().sendMessage(this, "Your Vesta's longsword has degraded into nothing.");
  2824. deleted = true;
  2825. break;
  2826. }
  2827. }
  2828. if (!deleted) {
  2829. for (int i = 0; i < items.length; i++) {
  2830. if (items[i] == 13899) {
  2831. playerItems.deleteItem(this, 13899, playerItems.getItemSlot(this, 13899), 1);
  2832. getActionSender().sendMessage(this, "Your Vesta's longsword has degraded into nothing.");
  2833. deleted = true;
  2834. break;
  2835. }
  2836. }
  2837. }
  2838. if (!deleted) {
  2839. for (int i = 0; i < bankItems.length; i++) {
  2840. if (bankItems[i] == 13899) {
  2841. bankItemsN[i]--;
  2842. if (bankItemsN[i] <= 0) {
  2843. bankItems[i] = -1;
  2844. }
  2845. getActionSender().setItems(this, -1, 64207, 95, bankItems, bankItemsN);
  2846. getActionSender().setItems(this, -1, 64209, 93, items, itemsN);
  2847. getActionSender().setItems(this, 149, 0, 93, items, itemsN);
  2848. getActionSender().sendMessage(this, "Your Vesta's longsword has degraded into nothing.");
  2849. break;
  2850. }
  2851. }
  2852. }
  2853. degrade = 6000;
  2854. degrades = false;
  2855. }
  2856. }
  2857. if (magicGraphicDelay > 0) {
  2858. magicGraphicDelay--;
  2859. } else if (magicGraphicDelay == 0) {
  2860. PlayerMagic playerMagic = new PlayerMagic(this);
  2861. playerMagic.appendGraphic(spellbook, spell);
  2862. magicGraphicDelay--;
  2863. }
  2864. if (magicDamageDelay > 0) {
  2865. magicDamageDelay--;
  2866. } else if (magicDamageDelay == 0) {
  2867. PlayerMagic playerMagic = new PlayerMagic(this);
  2868. playerMagic.appendDamage(spellbook, spell);
  2869. magicDamageDelay--;
  2870. }
  2871. if (magicAffectDelay > 0) {
  2872. magicAffectDelay--;
  2873. } else if (magicAffectDelay == 0) {
  2874. PlayerMagic playerMagic = new PlayerMagic(this);
  2875. playerMagic.appendAffect(spellbook, spell);
  2876. magicAffectDelay--;
  2877. }
  2878. if (cuedSpells > 0 && combatDelay == 0) {
  2879. try {
  2880. Player opp = Server.engine.players[magicOppIndex];
  2881. PlayerMagic playerMagic = new PlayerMagic(this);
  2882. playerMagic.combatMagic(opp, spellbook, cuedSpell);
  2883. cuedSpells = 0;
  2884. } catch (Exception e) {
  2885. }
  2886. }
  2887. if (usingPrayer()) {
  2888. drainCount += prayerDrain();
  2889. if (!isDead) {
  2890. if (drainCount >= 1) {
  2891. skillLvl[5]--;
  2892. getActionSender().setSkillLvl(this, 5);
  2893. drainCount--;
  2894. }
  2895. }
  2896. if (skillLvl[5] <= 0) {
  2897. skillLvl[5] = 0;
  2898. getActionSender().addSoundEffect(this, 2672, 1, 0, 0);
  2899. getActionSender().setSkillLvl(this, 5);
  2900. getActionSender().sendMessage(this, "You have run out of Prayer points; you must recharge at an altar.");
  2901. resetPrayer();
  2902. }
  2903. }
  2904.  
  2905. if (disconnected[0] && (usedLogout || attackedBy == null)) {
  2906. try {
  2907. if (heightLevel != 0) heightLevel = 0;
  2908. Engine.fileManager.saveCharacter(this);
  2909. } catch (Exception e) {
  2910. }
  2911. if (pTrade.getPartner() != null) {
  2912. pTrade.declineTrade();
  2913. }
  2914. disconnected[1] = true;
  2915. }
  2916. if (nextGraphicDelay > 0)
  2917. nextGraphicDelay--;
  2918. if (nextGraphicDelay == 0) {
  2919. PlayerCombat playerAttacking = new PlayerCombat(this);
  2920. playerAttacking.addNextAttack();
  2921. }
  2922. if (nextDamageDelay > 0)
  2923. nextDamageDelay--;
  2924. if (nextDamageDelay == 0) {
  2925. PlayerCombat playerAttacking = new PlayerCombat(this);
  2926. playerAttacking.addNextDamage();
  2927. }
  2928. if (deathEmoteDelay > 0) {
  2929. deathEmoteDelay--;
  2930. }
  2931. if (deathEmoteDelay == 0) {
  2932. requestAnim(9055, 0); //836, 2261
  2933. if (usingPrayer(22)) {
  2934. requestGFX(437, 0);
  2935. if (multiwayCombatZone(absX, absY)) {
  2936. try {
  2937. for (Player player : Server.engine.players) {
  2938. if (Misc.getDistance(absX, absY, player.absX, player.absY) <= 1) {
  2939. player.append1Hit(getRandom((int)Math.floor(getLevelForXP(5) * 0.25)), 0);
  2940. }
  2941. }
  2942. } catch (Exception e) {
  2943. }
  2944. } else {
  2945. try {
  2946. Server.engine.players[hitIndex].append1Hit(getRandom((int)Math.floor(getLevelForXP(5) * 0.25)), 0);
  2947. } catch (Exception e) {
  2948. }
  2949. }
  2950. }
  2951.  
  2952. isDead = true;
  2953. deathDelay = 4;
  2954. deathEmoteDelay = -1;
  2955. }
  2956. if (clickDelay > 0) {
  2957. clickDelay--;
  2958. }
  2959. if (teleDelay > 0) {
  2960. teleDelay--;
  2961. }
  2962.  
  2963. if (rangeDmgDelay > 0) {
  2964. rangeDmgDelay--;
  2965. }
  2966. if (rangeDmgDelay == 0) {
  2967. PlayerCombat PC2 = new PlayerCombat(this);
  2968. PC2.appendRangeDamage();
  2969. }
  2970. if (rangeDmgDelay2 > 0) {
  2971. rangeDmgDelay2--;
  2972. }
  2973. if (rangeDmgDelay2 == 0) {
  2974. PlayerCombat PC2 = new PlayerCombat(this);
  2975. PC2.appendRangeDamage();
  2976. }
  2977. if (damageSpecDelay > 0) {
  2978. damageSpecDelay--;
  2979. }
  2980. if (damageSpecDelay == 0 && enableSpecDamage) {
  2981. PlayerCombat playCb2 = new PlayerCombat(this);
  2982. playCb2.appendNpcDamageMeleeSpec();
  2983. }
  2984. if (damageDelay1 > 0) {
  2985. damageDelay1--;
  2986. }
  2987. if (damageDelay1 == 0 && enableDamage) {
  2988. PlayerCombat playerCb = new PlayerCombat(this);
  2989. playerCb.appendNpcDamageMelee();
  2990. }
  2991. if (atkDelay > 0) {
  2992. atkDelay--;
  2993. }
  2994. if (atkDelay == 0 && attackingNpc) {
  2995. PlayerCombat playCb = new PlayerCombat(this);
  2996. playCb.attackNpc();
  2997. }
  2998. if (eatDelay > 0) {
  2999. eatDelay--;
  3000. }
  3001. if (drinkDelay > 0) {
  3002. drinkDelay--;
  3003. }
  3004.  
  3005. if (statDelay > 0) {
  3006. statDelay -= usingPrayer(8) ? 2 : 1;
  3007. } else {
  3008. updateStats();
  3009. }
  3010. if (hpDelay > 0) {
  3011. hpDelay -= usingPrayer(9) ? 2 : 1;
  3012. } else {
  3013. restoreHP();
  3014. }
  3015.  
  3016. if (poisonDelay > 0) {
  3017. poisonDelay--;
  3018. }
  3019.  
  3020. if (specFillDelay > 0) {
  3021. if (specAmount < 1000) {
  3022. specFillDelay--;
  3023. } else {
  3024. specFillDelay = 50;
  3025. }
  3026. } else {
  3027. if (specAmount < 1000) {
  3028. if (specAmount - 100 > 900) {
  3029. specAmount = 1000;
  3030. } else {
  3031. specAmount += 100;
  3032. }
  3033. getActionSender().setConfig2(this, 300, specAmount);
  3034. }
  3035. specFillDelay = 50;
  3036. }
  3037.  
  3038. if (animClickDelay > 0) {
  3039. animClickDelay--;
  3040. }
  3041.  
  3042. if (deathDelay > 0) {
  3043. deathDelay--;
  3044. }
  3045. if (deathDelay == 0 && isDead) {
  3046. appendDeath();
  3047. }
  3048. if (combatDelay > 0) {
  3049. combatDelay--;
  3050. }
  3051. if (attackingPlayer) {
  3052. attackPlayer();
  3053. }
  3054. if (damageDelay > 0) {
  3055. damageDelay--;
  3056. }
  3057. if (damageDelay == 0) {
  3058. PlayerCombat PC = new PlayerCombat(this);
  3059. PC.appendDamages();
  3060. }
  3061. if (mageDelay > 0) {
  3062. mageDelay--;
  3063. }
  3064. if (specDelay > 0) {
  3065. specDelay--;
  3066. }
  3067. if (specDelay == 0) {
  3068. PlayerCombat PC1 = new PlayerCombat(this);
  3069. PC1.appendSpecDamage();
  3070. }
  3071. if (secondSpecDelay > 0) {
  3072. secondSpecDelay--;
  3073. }
  3074. if (secondSpecDelay == 0) {
  3075. PlayerCombat PC1 = new PlayerCombat(this);
  3076. PC1.appendSecondSpecDamage();
  3077. }
  3078. if (delayedDamageDelay > 0) {
  3079. delayedDamageDelay--;
  3080. }
  3081. if (delayedDamageDelay == 0) {
  3082. PlayerCombat PC1 = new PlayerCombat(this);
  3083. PC1.appendDelayedDamage(delayedDamageHit);
  3084. }
  3085. if (runEnergyDelay > 0) {
  3086. runEnergyDelay--;
  3087. } else {
  3088. if (runEnergy < 100) {
  3089. runEnergy++;
  3090. runEnergyUpdateReq = true;
  3091. }
  3092. runEnergyDelay = 4;
  3093. }
  3094. if (itemPickup) {
  3095. Engine.packets.pickupItem.handlePacket(this, 0, 0);
  3096. }
  3097. if (playerOption1) {
  3098. Engine.packets.playerOption1.handlePacket(this, 0, 0);
  3099. }
  3100. if (playerOption2) {
  3101. Engine.packets.playerOption2.handlePacket(this, 0, 0);
  3102. }
  3103. if (playerOption3) {
  3104. Engine.packets.playerOption3.handlePacket(this, 0, 0);
  3105. }
  3106. if (playerOption4) {
  3107. Engine.packets.playerOption3.handlePacket(this, 0, 0);
  3108. }
  3109. if (npcOption1) {
  3110. Engine.packets.npcOption1.handlePacket(this, 0, 0);
  3111. }
  3112. if (npcOption2) {
  3113. Engine.packets.npcOption2.handlePacket(this, 0, 0);
  3114. }
  3115. if (npcOption3) {
  3116. Engine.packets.npcOption3.handlePacket(this, 0, 0);
  3117. }
  3118. if (npcOption3) {
  3119. Engine.packets.npcOption3.handlePacket(this, 0, 0);
  3120. }
  3121.  
  3122. if (objectOption1) {
  3123. Engine.packets.objectOption1.handlePacket(this, 0, 0);
  3124. }
  3125. if (objectOption2) {
  3126. Engine.packets.objectOption2.handlePacket(this, 0, 0);
  3127. }
  3128. if (runEnergyUpdateReq) {
  3129. getActionSender().setEnergy(this);
  3130. runEnergyUpdateReq = false;
  3131. }
  3132. appendWilderness();
  3133. if (teleDelay == 0) {
  3134. teleDelay = -1;
  3135. if (teletab) {
  3136. requestAnim(teleFinishAnim, 0);
  3137. requestGFX(teleFinishGFX, teleFinishGFXHeight);
  3138. teleDelay = 2;
  3139. teleFinishAnim = playerWeapon.getStandEmote(equipment[3]);
  3140. teleFinishGFX = -1;
  3141. } else {
  3142. setCoords(teleX, teleY, teleH);
  3143. if (teleFinishAnim != -1) {
  3144. requestAnim(teleFinishAnim, 0);
  3145. }
  3146. if (teleFinishGFX != -1) {
  3147. requestGFX(teleFinishGFX, teleFinishGFXHeight);
  3148. }
  3149. }
  3150. if (!teletab) {
  3151. teleX = teleY = -1;
  3152. }
  3153. teletab = false;
  3154. }
  3155. if (clickDelay == 0) {
  3156. Engine.items.saveItems(this);
  3157. clickDelay = -1;
  3158. }
  3159. }
  3160.  
  3161. public void potion(int potionID) {
  3162. int root = 0;
  3163. int toAdd = 0;
  3164. int i = 0;
  3165. switch (potionID) {
  3166. case 2436:
  3167. case 145:
  3168. case 147:
  3169. case 149:
  3170. root = getLevelForXP(0);
  3171. toAdd = 5 + (int)Math.round(root * 0.1414141414);
  3172. if ((skillLvl[0] + toAdd) > (root + toAdd)) {
  3173. skillLvl[0] = root + toAdd;
  3174. } else {
  3175. skillLvl[0] += toAdd;
  3176. }
  3177. getActionSender().setSkillLvl(this, 0);
  3178. break;
  3179.  
  3180. case 2440:
  3181. case 157:
  3182. case 159:
  3183. case 161:
  3184. root = getLevelForXP(2);
  3185. toAdd = 5 + (int)Math.round(root * 0.1414141414);
  3186. if ((skillLvl[2] + toAdd) > (root + toAdd)) {
  3187. skillLvl[2] = root + toAdd;
  3188. } else {
  3189. skillLvl[2] += toAdd;
  3190. }
  3191. getActionSender().setSkillLvl(this, 2);
  3192. break;
  3193.  
  3194. case 2442:
  3195. case 163:
  3196. case 165:
  3197. case 167:
  3198. root = getLevelForXP(1);
  3199. toAdd = 5 + (int)Math.round(root * 0.1414141414);
  3200. if ((skillLvl[1] + toAdd) > (root + toAdd)) {
  3201. skillLvl[1] = root + toAdd;
  3202. } else {
  3203. skillLvl[1] += toAdd;
  3204. }
  3205. getActionSender().setSkillLvl(this, 1);
  3206. break;
  3207.  
  3208. case 2444:
  3209. case 169:
  3210. case 171:
  3211. case 173:
  3212. root = getLevelForXP(4);
  3213. toAdd = 4 + (int)Math.round(root * 0.0909090909);
  3214. if ((skillLvl[4] + toAdd) > (root + toAdd)) {
  3215. skillLvl[4] = root + toAdd;
  3216. } else {
  3217. skillLvl[4] += toAdd;
  3218. }
  3219. getActionSender().setSkillLvl(this, 4);
  3220. break;
  3221.  
  3222.  
  3223.  
  3224.  
  3225.  
  3226.  
  3227. case 3040:
  3228. case 3042:
  3229. case 3044:
  3230. case 3046:
  3231. if (skillLvl[6] + 4 > getLevelForXP(6) + 4) {
  3232. skillLvl[6] = getLevelForXP(6) + 4;
  3233. } else {
  3234. skillLvl[6] += 4;
  3235. }
  3236. getActionSender().setSkillLvl(this, 6);
  3237. break;
  3238.  
  3239. case 2428:
  3240. case 121:
  3241. case 123:
  3242. case 125:
  3243. root = getLevelForXP(0);
  3244. toAdd = 3 + (int)Math.round(root * 0.0909090909);
  3245. if ((skillLvl[0] + toAdd) > (root + toAdd)) {
  3246. skillLvl[0] = root + toAdd;
  3247. } else {
  3248. skillLvl[0] += toAdd;
  3249. }
  3250. getActionSender().setSkillLvl(this, 0);
  3251. break;
  3252.  
  3253. case 113:
  3254. case 115:
  3255. case 117:
  3256. case 119:
  3257. root = getLevelForXP(2);
  3258. toAdd = 3 + (int)Math.round(root * 0.0909090909);
  3259. if ((skillLvl[2] + toAdd) > (root + toAdd)) {
  3260. skillLvl[2] = root + toAdd;
  3261. } else {
  3262. skillLvl[2] += toAdd;
  3263. }
  3264. getActionSender().setSkillLvl(this, 2);
  3265. break;
  3266.  
  3267. case 2432:
  3268. case 133:
  3269. case 135:
  3270. case 137:
  3271. root = getLevelForXP(1);
  3272. toAdd = 3 + (int)Math.round(root * 0.0909090909);
  3273. if ((skillLvl[1] + toAdd) > (root + toAdd)) {
  3274. skillLvl[1] = root + toAdd;
  3275. } else {
  3276. skillLvl[1] += toAdd;
  3277. }
  3278. getActionSender().setSkillLvl(this, 1);
  3279. break;
  3280.  
  3281. case 2434:
  3282. case 139:
  3283. case 141:
  3284. case 143:
  3285. root = getLevelForXP(5);
  3286. toAdd = 7 + (int)Math.round(root * 0.2424242424);
  3287. if ((skillLvl[5] + toAdd) > root) {
  3288. if (skillLvl[5] < root) {
  3289. skillLvl[5] = root;
  3290. }
  3291. } else {
  3292. skillLvl[5] += toAdd;
  3293. }
  3294. getActionSender().setSkillLvl(this, 5);
  3295. break;
  3296.  
  3297. case 2430:
  3298. case 127:
  3299. case 129:
  3300. case 131:
  3301. while (i <= 6) {
  3302. if (i == 3 || i == 5) {
  3303. i++;
  3304. }
  3305. root = getLevelForXP(i);
  3306. toAdd = 10 + (int)Math.round(root * 0.2929292929);
  3307. if ((skillLvl[i] + toAdd) > root) {
  3308. if (skillLvl[i] < root) {
  3309. skillLvl[i] = root;
  3310. }
  3311. } else {
  3312. skillLvl[i] += toAdd;
  3313. }
  3314. getActionSender().setSkillLvl(this, i);
  3315. i++;
  3316. }
  3317. break;
  3318.  
  3319. case 3024:
  3320. case 3026:
  3321. case 3028:
  3322. case 3030:
  3323. while (i <= 23) {
  3324. if (i == 3) {
  3325. i++;
  3326. }
  3327. root = getLevelForXP(i);
  3328. toAdd = 8 + (int)Math.round(root * 0.2424242424);
  3329. if ((skillLvl[i] + toAdd) > root) {
  3330. if (skillLvl[i] < root) {
  3331. skillLvl[i] = root;
  3332. }
  3333. } else {
  3334. skillLvl[i] += toAdd;
  3335. }
  3336. getActionSender().setSkillLvl(this, i);
  3337. i++;
  3338. }
  3339. break;
  3340.  
  3341. case 6685:
  3342. case 6687:
  3343. case 6689:
  3344. case 6691:
  3345. while (i <= 6) {
  3346. if (i == 5) {
  3347. i++;
  3348. }
  3349. root = getLevelForXP(i);
  3350. if (i == 0 || i == 2 || i == 4 || i == 6) {
  3351. toAdd = -1 * (2 + (int)Math.round(root * 0.0707070707));
  3352. if ((skillLvl[i] + toAdd) < 0) {
  3353. skillLvl[i] = 0;
  3354. } else {
  3355. skillLvl[i] += toAdd;
  3356. }
  3357. } else {
  3358. toAdd = 2 + (int)Math.round(root * (i == 1 ? 0.1919191919 : 0.1414141414));
  3359. if (skillLvl[i] + toAdd > root + toAdd) {
  3360. skillLvl[i] = root + toAdd;
  3361. } else {
  3362. skillLvl[i] += toAdd;
  3363. }
  3364. }
  3365. getActionSender().setSkillLvl(this, i);
  3366. i++;
  3367. }
  3368. break;
  3369.  
  3370. case 2450:
  3371. case 189:
  3372. case 191:
  3373. case 193:
  3374. if (skillLvl[3] > 11) {
  3375. while (i <= 5) {
  3376. if (i == 4) {
  3377. i++;
  3378. }
  3379. root = getLevelForXP(i);
  3380. if (i == 5) {
  3381. toAdd = 9;
  3382. if (skillLvl[i] + toAdd > root) {
  3383. if (skillLvl[i] < root) {
  3384. skillLvl[i] = root;
  3385. }
  3386. } else {
  3387. skillLvl[i] += toAdd;
  3388. }
  3389. break;
  3390. }
  3391. if (i == 1 || i == 3) {
  3392. toAdd = -1 * (2 + (int)Math.round(root * 0.0909090909));
  3393. if (i == 3) {
  3394. append1Hit(-1 * toAdd, 0);
  3395. } else {
  3396. if ((skillLvl[i] + toAdd) < 0) {
  3397. skillLvl[i] = 0;
  3398. } else {
  3399. skillLvl[i] += toAdd;
  3400. }
  3401. }
  3402. } else {
  3403. toAdd = 2 + (int)Math.round(root * (i == 0 ? 0.1919191919 : 0.1111111111));
  3404. if (skillLvl[i] + toAdd > root + toAdd) {
  3405. skillLvl[i] = root + toAdd;
  3406. } else {
  3407. skillLvl[i] += toAdd;
  3408. }
  3409. }
  3410. getActionSender().setSkillLvl(this, i);
  3411. i++;
  3412. }
  3413. }
  3414. break;
  3415. }
  3416. requestAnim(829, 0);
  3417. getActionSender().addSoundEffect(this, 2401, 1, 0, 0);
  3418. eatDelay = 3;
  3419. drinkDelay = 2;
  3420. }
  3421.  
  3422. public void food(int foodID) {
  3423. int healAmount = 0;
  3424. int toDelayCombat = 6;
  3425. int toDelayEat = 3;
  3426. switch (foodID) {
  3427. case 373: healAmount = 14; break;
  3428. case 379: healAmount = 12; break;
  3429. case 385: healAmount = 20; break;
  3430. case 391: healAmount = 22; break;
  3431. case 361: healAmount = 10; break;
  3432. case 3144:
  3433. healAmount = 18;
  3434. toDelayCombat = combatDelay;
  3435. drinkDelay = 3;
  3436. break;
  3437. case 7060: healAmount = 22; break;
  3438. case 7946: healAmount = 16; break;
  3439. case 10476:
  3440. healAmount = 1 + Misc.random(3);
  3441. runEnergy += runEnergy * .10;
  3442. runEnergyUpdateReq = true;
  3443. if (runEnergy + 20 > 100) {
  3444. runEnergy = 100;
  3445. }
  3446. break;
  3447. }
  3448. requestAnim(829, 0);
  3449. getActionSender().addSoundEffect(this, 2393, 1, 0, 0);
  3450. updateHP(healAmount, true);
  3451. getActionSender().sendMessage(this, "You eat the "+Engine.items.getItemName(foodID)+".");
  3452. combatDelay = toDelayCombat;
  3453. eatDelay = toDelayEat;
  3454. }
  3455.  
  3456. public int getSlayerTaskHigh(int slayerLevel, int amount) {
  3457. if (slayerLevel < 10) {
  3458. slayerTaskAmount = amount;
  3459. return 4677;
  3460. } else if (slayerLevel < 20 && slayerLevel > 9) {
  3461. slayerTaskAmount = amount;
  3462. return 82;
  3463. } else if (slayerLevel < 30 && slayerLevel > 19) {
  3464. slayerTaskAmount = amount;
  3465. return 83;
  3466. } else if (slayerLevel < 40 && slayerLevel > 29) {
  3467. slayerTaskAmount = amount;
  3468. return 55;
  3469. } else if (slayerLevel < 50 && slayerLevel > 39) {
  3470. slayerTaskAmount = amount;
  3471. return 54;
  3472. } else if (slayerLevel < 60 && slayerLevel > 49) {
  3473. slayerTaskAmount = amount;
  3474. return 1604;
  3475. } else if (slayerLevel < 70 && slayerLevel > 59) {
  3476. slayerTaskAmount = amount;
  3477. return 1610;
  3478. } else if (slayerLevel < 80 && slayerLevel > 69) {
  3479. slayerTaskAmount = amount;
  3480. return 2783;
  3481. } else if (slayerLevel < 90 && slayerLevel > 79) {
  3482. slayerTaskAmount = amount;
  3483. return 1615;
  3484. } else if (slayerLevel < 99 && slayerLevel > 89) {
  3485. slayerTaskAmount = amount;
  3486. return 9000;
  3487. }
  3488. return -1;
  3489. }
  3490. public int getSlayerTaskMed(int slayerLevel, int amount) {
  3491. if (slayerLevel < 10) {
  3492. return 4689;
  3493. } else if (slayerLevel < 20) {
  3494. slayerTaskAmount = amount;
  3495. return 4677;
  3496. } else if (slayerLevel < 30) {
  3497. slayerTaskAmount = amount;
  3498. return 5293;
  3499. } else if (slayerLevel < 40) {
  3500. slayerTaskAmount = amount;
  3501. return 4381;
  3502. } else if (slayerLevel < 50) {
  3503. slayerTaskAmount = amount;
  3504. return 4527;
  3505. } else if (slayerLevel < 60) {
  3506. slayerTaskAmount = amount;
  3507. return 5342;
  3508. } else if (slayerLevel < 70) {
  3509. slayerTaskAmount = amount;
  3510. return 6006;
  3511. } else if (slayerLevel < 80) {
  3512. slayerTaskAmount = amount;
  3513. return 6078;
  3514. } else if (slayerLevel < 90) {
  3515. slayerTaskAmount = amount;
  3516. return 1618;
  3517. } else if (slayerLevel < 100) {
  3518. slayerTaskAmount = amount;
  3519. return 1455;
  3520. }
  3521. return -1;
  3522. }
  3523. public int getSlayerTaskLow(int slayerLevel, int amount) {
  3524. if (slayerLevel < 10) {
  3525. return 117;
  3526. } else if (slayerLevel < 20) {
  3527. slayerTaskAmount = amount;
  3528. return 124;
  3529. } else if (slayerLevel < 30) {
  3530. slayerTaskAmount = amount;
  3531. return 174;
  3532. } else if (slayerLevel < 40) {
  3533. slayerTaskAmount = amount;
  3534. return 181;
  3535. } else if (slayerLevel < 50) {
  3536. slayerTaskAmount = amount;
  3537. return 2610;
  3538. } else if (slayerLevel < 60) {
  3539. slayerTaskAmount = amount;
  3540. return 987;
  3541. } else if (slayerLevel < 70) {
  3542. slayerTaskAmount = amount;
  3543. return 1106;
  3544. } else if (slayerLevel < 80) {
  3545. slayerTaskAmount = amount;
  3546. return 1153;
  3547. } else if (slayerLevel < 90) {
  3548. slayerTaskAmount = amount;
  3549. return 1338;
  3550. } else if (slayerLevel < 100) {
  3551. slayerTaskAmount = amount;
  3552. return 1558;
  3553. }
  3554. return -1;
  3555. }
  3556.  
  3557. public int getSlayerTask(int combatLevel) {
  3558. int temp = Misc.random(100);
  3559. int temp2 = Misc.random(50);
  3560. if (combatLevel > 100) {
  3561. return getSlayerTaskHigh(skillLvl[18], temp2);
  3562. } else if (combatLevel > 50 && combatLevel < 100) {
  3563. return getSlayerTaskMed(skillLvl[18], temp);
  3564. } else if (combatLevel > 2 && combatLevel < 50) {
  3565. return getSlayerTaskLow(skillLvl[18], temp);
  3566. }
  3567. return -1;
  3568. }
  3569.  
  3570.  
  3571. public int slayerTask = -1;
  3572. public int slayerTaskAmount = 0;
  3573.  
  3574. public int speakingToNpc = -1;
  3575. public int npcStage = -1;
  3576.  
  3577. public String lastKilled = "";
  3578. public boolean receivesPVPDrop(Player p, Player opp) {
  3579. if (Server.socketListener.getAddress(p.socket.socket).equals(Server.socketListener.getAddress(opp.socket.socket))) {
  3580. return true;
  3581. }
  3582. return true;
  3583. }
  3584.  
  3585. public void appendDeath() {
  3586. if (deathDelay == 0 && isDead) {
  3587. Player opp = killer();
  3588. clearKillerHits();
  3589. try {
  3590. if (opp != null) {
  3591. if(opp.bhTarget == playerId) {
  3592. opp.bountyKills++;
  3593. } else {
  3594. opp.rougeKills++;
  3595. }
  3596. dropStuff(opp.username);
  3597. } else {
  3598. dropStuff(username);
  3599. }
  3600. if (receivesPVPDrop(this, opp)) {
  3601. opp.kills++;
  3602. opp.totalKills++;
  3603. DC++;
  3604. opp.KC++;
  3605. }
  3606. if (Server.socketListener.getAddress(socket.socket).equals(opp.lastKilled)) {
  3607. Engine.fileManager.appendData("characters/logs/flagged.txt", opp.username);
  3608. }
  3609. opp.lastKilled = Server.socketListener.getAddress(socket.socket);
  3610. Engine.fileManager.appendData("characters/logs/kills/"+opp.username+".txt", username);
  3611. } catch (Exception e) {
  3612. }
  3613.  
  3614. for (int i = 0; i < skillLvl.length; i++) {
  3615. skillLvl[i] = getLevelForXP(i);
  3616. getActionSender().setSkillLvl(this, i);
  3617. }
  3618. for (int i = 0; i < 1000; i++) {
  3619. requestAnim(playerWeapon.getStandEmote(equipment[3]), 0);
  3620. }
  3621.  
  3622. if (opp != null) {
  3623. opp.attacking = null;
  3624. opp.attackedBy = null;
  3625. opp.oppIndex = 0;
  3626. opp.hitIndex = 0;
  3627. opp.resetAttack();
  3628. opp.requestFaceTo(65535);
  3629. }
  3630. attacking = null;
  3631. attackedBy = null;
  3632. oppIndex = 0;
  3633. hitIndex = 0;
  3634. resetAttack();
  3635.  
  3636. if(InBounty == 1) {
  3637. int i = heightLevel;
  3638. if(opp != null) {
  3639. if (opp.playerId == bhTarget || playerId == opp.bhTarget) {
  3640. opp.getActionSender().setInterfaceConfig(opp, 653, 9, false);
  3641. getActionSender().sendMessage(opp, "You killed "+username+". They were your target, so your Hunter PvP rating increases!");
  3642. leftBhTimer = 120;
  3643. opp.bhHunter += 1;
  3644. this.InBounty = 0;
  3645. this.InBounty = 0;
  3646. this.bhLeave = 0;
  3647. this.bhPickup = 0;
  3648. Engine.BountyHunter.removeHigh(this);
  3649. Engine.BountyHunter.exit(this, 3);
  3650. Engine.BountyHunter.exit(this, 2);
  3651. Engine.BountyHunter.exit(this, 1);
  3652. }
  3653. if(InBounty == 1) {
  3654. if(opp != null) {
  3655. if (opp.playerId != bhTarget && playerId != opp.bhTarget) {
  3656. if (opp.InBounty == 1) {
  3657. opp.bhLeave = 180;
  3658. getActionSender().setInterfaceConfig(this, 653, 12, true);
  3659. getActionSender().setInterfaceConfig(this, 653, 9, false);
  3660. opp.bhRogue += 1;
  3661. getActionSender().sendMessage(opp, "You killed "+username+". They were not your target, so your Rougue PvP rating increases!");
  3662. getActionSender().sendMessage(opp, "This means that you got the pickup penalty, pick up anything and you cant leave!");
  3663. }
  3664. if (opp.InBounty == 0) {
  3665. opp.bhLeave = 0;
  3666. getActionSender().sendMessage(opp, "You killed "+username+".");
  3667. }
  3668. opp.getActionSender().setInterfaceConfig(opp, 653, 9, false);
  3669. leftBhTimer = 120;
  3670. this.InBounty = 0;
  3671. this.bhLeave = 0;
  3672. this.bhPickup = 0;
  3673. Engine.BountyHunter.removeHigh(this);
  3674. Engine.BountyHunter.exit(this, 3);
  3675. Engine.BountyHunter.exit(this, 2);
  3676. Engine.BountyHunter.exit(this, 1);
  3677. }
  3678. } else {
  3679.  
  3680. }
  3681. Player p3 = Engine.players[opp.bhTarget];
  3682. if(p3 != null) {
  3683. opp.getActionSender().setString(opp, "" + p3.username , 653, 8);
  3684. } else {
  3685. opp.getActionSender().setString(opp, "None" , 653, 8);
  3686. }
  3687. }
  3688. getActionSender().removeOverlay(this);
  3689. headIconSkull = -1;
  3690. appearanceUpdateReq = updateReq = true;
  3691. if(i == 0) {
  3692. return;
  3693. } else if(i == 0) {
  3694. return;
  3695. } else {
  3696. Engine.BountyHunter.removeHigh(this);
  3697. }
  3698. setCoords(3172, 3675, 0);
  3699. } else {
  3700. Engine.BountyHunter.removeHigh(this);
  3701. Engine.BountyHunter.exit(this, 3);
  3702. Engine.BountyHunter.exit(this, 2);
  3703. Engine.BountyHunter.exit(this, 1);
  3704. setCoords(3661, 3497, 0);
  3705. }
  3706. }
  3707.  
  3708. getActionSender().removeOverlay(this);
  3709.  
  3710. if (isPVP()) setCoords(2846, 5654, 0); else setCoords(2846, 5654, 0);
  3711. getActionSender().sendMessage(this, "Ankit takes this opportunity to loll and your defeat!");
  3712. deathDelay = -1;
  3713. isDead = false;
  3714. magicGraphicDelay = -1;
  3715. magicDamageDelay = -1;
  3716. initialAttack = false;
  3717. isSkulled = false;
  3718. headIconSkull = -1;
  3719. skullVanishDelay = 0;
  3720. PickupTimer = 0;
  3721. isPoisoned = false;
  3722. poisonHitCount = 0;
  3723. poisonDelay = 0;
  3724. specAmount = 1000;
  3725. getActionSender().setConfig2(this, 300, 1000);
  3726. resetPrayer();
  3727. getActionSender().removeOverlay(this);
  3728. appearanceUpdateReq = true;
  3729. updateReq = true;
  3730. updateScoreBoards();
  3731. }
  3732. }
  3733.  
  3734.  
  3735. public void resetAttack() {
  3736. attackingPlayer = false;
  3737. attackNpc = 0;
  3738. enemyIndex = 0;
  3739. oppIndex = 0;
  3740. hitOne = false;
  3741. hitTwo = false;
  3742. hitThree = false;
  3743. hitFour = false;
  3744. hit1 = 0;
  3745. hit2 = 0;
  3746. hit3 = 0;
  3747. hit4 = 0;
  3748. specDelay = -1;
  3749. secondSpecDelay = -1;
  3750. }
  3751.  
  3752. /**
  3753. * Get xp based on your level.
  3754. * @param skillId The skill level to get the level based off XP for.
  3755. * @return Returns the level based on the amount of XP the specified skill has.
  3756. */
  3757. public int getLevelForXP(int skillId) {
  3758. int exp = skillXP[skillId];
  3759. int points = 0;
  3760. int output = 0;
  3761. for (int lvl = 1; lvl < 100; lvl++) {
  3762. points += Math.floor((double)lvl + 300.0 * Math.pow(2.0, (double)lvl / 7.0));
  3763. output = (int)Math.floor(points / 4);
  3764. if ((output - 1) >= exp) {
  3765. return lvl;
  3766. }
  3767. }
  3768. return 99;
  3769. }
  3770.  
  3771. /**
  3772. * Calculates equipment bonus.
  3773. */
  3774. public void calculateEquipmentBonus() {
  3775. for (int i = 0; i < equipmentBonus.length; i++) {
  3776. equipmentBonus[i] = 0;
  3777. }
  3778. for (int i = 0; i < equipment.length; i++) {
  3779. if (equipment[i] > -1) {
  3780. for (int j = 0; j < Engine.items.maxListedItems; j++) {
  3781. if (Engine.items.itemLists[j] != null) {
  3782. if (Engine.items.itemLists[j].itemId == equipment[i]) {
  3783. for (int k = 0; k < equipmentBonus.length; k++) {
  3784. equipmentBonus[k] += Engine.items.itemLists[j].bonuses[k];
  3785. }
  3786. break;
  3787. }
  3788. }
  3789. }
  3790. }
  3791. }
  3792. }
  3793.  
  3794. /**
  3795. * Writes the equipment bonus.
  3796. */
  3797. public void setEquipmentBonus() {
  3798. String[] bonusNames = Misc.bonusNames;
  3799. int id = 35;
  3800. //for (int i = 0; i < equipmentBonus.length; i++) {
  3801. //getActionSender().setString(this, bonusNames[i] + ": " + (equipmentBonus[i] >= 0 ? "+" : "") + equipmentBonus[i], 667, id++);
  3802. //}
  3803. //Attack bonuses
  3804. getActionSender().setString(this, "Attack bonus", 667, 34);
  3805. getActionSender().setString(this, "Stab: " + (equipmentBonus[0] >= 0 ? "+" : "") +equipmentBonus[0], 667, 36);
  3806. getActionSender().setString(this, "Slash: " + (equipmentBonus[1] >= 0 ? "+" : "") +equipmentBonus[1], 667, 37);
  3807. getActionSender().setString(this, "Crush: " + (equipmentBonus[2] >= 0 ? "+" : "") +equipmentBonus[2], 667, 38);
  3808. getActionSender().setString(this, "Magic: " + (equipmentBonus[3] >= 0 ? "+" : "") +equipmentBonus[3], 667, 39);
  3809. getActionSender().setString(this, "Ranged: " + (equipmentBonus[4] >= 0 ? "+" : "") +equipmentBonus[4], 667, 40);
  3810. //Defence bonuses
  3811. getActionSender().setString(this, "Defence bonus", 667, 35);
  3812. getActionSender().setString(this, "Stab: " + (equipmentBonus[5] >= 0 ? "+" : "") +equipmentBonus[5], 667, 41);
  3813. getActionSender().setString(this, "Slash: " + (equipmentBonus[6] >= 0 ? "+" : "") +equipmentBonus[6], 667, 42);
  3814. getActionSender().setString(this, "Crush: " + (equipmentBonus[7] >= 0 ? "+" : "") +equipmentBonus[7], 667, 43);
  3815. getActionSender().setString(this, "Magic: " + (equipmentBonus[8] >= 0 ? "+" : "") +equipmentBonus[8], 667, 44);
  3816. getActionSender().setString(this, "Ranged: " + (equipmentBonus[9] >= 0 ? "+" : "") +equipmentBonus[9], 667, 45);
  3817. getActionSender().setString(this, "", 667, 46);
  3818. //Other bonuses
  3819. getActionSender().setString(this, "Other bonuses", 667, 47);
  3820. getActionSender().setString(this, "Strength: " + (equipmentBonus[10] >= 0 ? "+" : "") +equipmentBonus[10], 667, 48);
  3821. getActionSender().setString(this, "Prayer: " + (equipmentBonus[11] >= 0 ? "+" : "") +equipmentBonus[11], 667, 49);
  3822. getActionSender().setString(this, "N/A", 667, 32);
  3823. }
  3824.  
  3825. public void updateHP(int difference, boolean heal) {
  3826. if (skillLvl[3] == 0) {
  3827. return;
  3828. }
  3829. checkForROL();
  3830. if (heal) {
  3831. skillLvl[3] += difference;
  3832. if (skillLvl[3] > getLevelForXP(3)) {
  3833. skillLvl[3] = getLevelForXP(3);
  3834. }
  3835. } else if (!heal) {
  3836. skillLvl[3] -= difference;
  3837. if (skillLvl[3] <= 0) {
  3838. xLogCheck = 30;
  3839. skillLvl[3] = 0;
  3840. deathEmoteDelay = 3;
  3841. isDead = true;
  3842. attacking = null;
  3843. attackedBy = null;
  3844. Engine.playerMovement.resetWalkingQueue(this);
  3845. requestFaceTo(65535);
  3846. }
  3847. }
  3848. getActionSender().setSkillLvl(this, 3);
  3849. if ((skillLvl[3] <= Math.round(getLevelForXP(3) * 0.10) && skillLvl[3] > 0) && usingPrayer(23)) {
  3850. requestGFX(436, 0);
  3851. getActionSender().addSoundEffect(this, 2681, 1, 0, 0);
  3852. skillLvl[3] += Math.round(getLevelForXP(5) * 0.25);
  3853. skillLvl[5] = 0;
  3854. getActionSender().setSkillLvl(this, 5);
  3855. }
  3856. }
  3857.  
  3858. public boolean bountyLocating = false;
  3859.  
  3860. /**
  3861. * Teleports a player.
  3862. * @param x The x coordinate to teleport to.
  3863. * @param y The y coordinate to teleport to.
  3864. * @param height The height level to teleport to.
  3865. * @param delay The delay before the teleport is done.
  3866. * @param distance The offset you can teleport to, such as 1 for a max offset of x +/- 1 and y +/- 1.
  3867. * @param emoteStart The emote to do right away.
  3868. * @param emoteEnd The emote to do after teleporting.
  3869. * @param gfxStart The graphic to do right away.
  3870. * @param gfxStartH The height level to create the start graphic at.
  3871. * @param gfxEnd The graphic to do after the teleport is done.
  3872. * @param gfxEndH The finish graphic height.
  3873. */
  3874. public void teleportTo(int x, int y, int height, int delay, int distance, int emoteStart, int emoteEnd, int gfxStart,
  3875. int gfxStartH, int gfxEnd, int gfxEndH) {
  3876. if (InBounty == 1 && !bountyLocating) {
  3877. message("You cannot teleport out of this minigame.");
  3878. return;
  3879. }
  3880. if (teleblocked == 1) {
  3881. getActionSender().sendMessage(this, "You are teleport blocked!");
  3882. return;
  3883. }
  3884. if (getWildernessLevel() >= 20 && !lever && !safeArea(absX, absY)) {
  3885. getActionSender().sendMessage(this, "A magical force stops you from teleporting.");
  3886. return;
  3887. }
  3888. itemPickup = false;
  3889. playerOption1 = false;
  3890. playerOption2 = false;
  3891. playerOption3 = false;
  3892. playerOption4 = false;
  3893. playerOption4 = false;
  3894. npcOption1 = false;
  3895. npcOption2 = false;
  3896. npcOption3 = false;
  3897. objectOption1 = false;
  3898. objectOption2 = false;
  3899. bountyLocating = false;
  3900. attackingPlayer = false;
  3901. clickDelay = delay + 2;
  3902. teleDelay = delay;
  3903. if (distance > 0) {
  3904. int xType = Misc.random(1);
  3905. int yType = Misc.random(1);
  3906. int xOffset = Misc.random(distance);
  3907. int yOffset = Misc.random(distance);
  3908. if (xType == 1)
  3909. x += -xOffset;
  3910. else
  3911. x += xOffset;
  3912. if(yType == 1)
  3913. y += -yOffset;
  3914. else
  3915. y += yOffset;
  3916. }
  3917. teleX = x;
  3918. teleY = y;
  3919. teleH = height;
  3920. Engine.playerMovement.resetWalkingQueue(this);
  3921. requestAnim(emoteStart, 0);
  3922. requestGFX(gfxStart, gfxStartH);
  3923. teleFinishGFX = gfxEnd;
  3924. teleFinishGFXHeight = gfxEndH;
  3925. teleFinishAnim = emoteEnd;
  3926. }
  3927.  
  3928. /**
  3929. * Set the player's coordinates.
  3930. * @param x The x coordinate to teleport to.
  3931. * @param y The y coordinate to teleport to.
  3932. */
  3933. public void setCoords(int x, int y, int height) {
  3934. teleportToX = x;
  3935. teleportToY = y;
  3936. teleportToH = height;
  3937. heightLevel = height;
  3938. didTeleport = true;
  3939. }
  3940.  
  3941. /**
  3942. * Req an animation for this player.
  3943. * @param animId The amination to perform.
  3944. * @param animD The delay before doing the animation.
  3945. */
  3946. public void requestAnim(int animId, int animD) {
  3947. animReq = animId;
  3948. animDelay = animD;
  3949. animUpdateReq = true;
  3950. updateReq = true;
  3951. }
  3952.  
  3953. /**
  3954. * Req an graphic for this player.
  3955. * @param gfxId The graphic to perform.
  3956. * @param gfxD The delay or height or the gfx depending on the value.
  3957. */
  3958. public void requestGFX(int gfxId, int gfxD) {
  3959. if (gfxD >= 100) {
  3960. gfxD += 6553500;
  3961. }
  3962. gfxReq = gfxId;
  3963. gfxDelay = gfxD;
  3964. gfxUpdateReq = true;
  3965. updateReq = true;
  3966. }
  3967.  
  3968. public int VLSTimer = -1;
  3969.  
  3970. /**
  3971. * Req this player faces NPC or player.
  3972. * @param faceId The target to face.
  3973. */
  3974. public void requestFaceTo(int faceId) {
  3975. faceToReq = faceId;
  3976. faceToUpdateReq = true;
  3977. updateReq = true;
  3978. }
  3979.  
  3980. int poisonDamage;
  3981. int poisonIntrevals = 0;
  3982. public int getStartingPoisonDamage(Player p2) {
  3983. String name = "";
  3984. int damage = 0;
  3985. boolean usingRange = false;
  3986. if ((p2.equipment[3] >= 839 && p2.equipment[3] <= 861) || (p2.equipment[3] >= 9174 && p2.equipment[3] <= 9185) || p2.equipment[3] == 11235) { //Ranged
  3987. name = Engine.items.getItemName(equipment[13]);
  3988. usingRange = true;
  3989. } else { //Melee
  3990. name = Engine.items.getItemName(p2.equipment[3]);
  3991. }
  3992. if (name.contains("(p++)")) {
  3993. damage = usingRange ? 4 : 6;
  3994. }
  3995. if (name.contains("(p+)")) {
  3996. damage = usingRange ? 3 : 5;
  3997. }
  3998. if (name.contains("(p)")) {
  3999. damage = usingRange ? 2 : 4;
  4000. }
  4001. return damage;
  4002. }
  4003.  
  4004. public int totalDamageRecoiled;
  4005.  
  4006. public void appendNPCHit(int damage, int poison) {
  4007. if (damage > skillLvl[3]) {
  4008. damage = skillLvl[3];
  4009. }
  4010. updateHP(damage, false);
  4011. if (!hit1UpdateReq) {
  4012. hitDiff1 = damage;
  4013. poisonHit1 = poison;
  4014. hit1UpdateReq = true;
  4015. } else {
  4016. hitDiff2 = damage;
  4017. poisonHit2 = poison;
  4018. hit2UpdateReq = true;
  4019. }
  4020. updateReq = true;
  4021. }
  4022.  
  4023. public int getSlope(Player p) {
  4024. Player opp = Server.engine.players[p.oppIndex];
  4025. int slope = 0;
  4026. if (p == null || opp == null) {
  4027. return -1;
  4028. }
  4029. int distance = Misc.getDistance(p.absX, p.absY, opp.absX, opp.absY);
  4030. if (p.equipment[13] == 9244 || p.equipment[3] == 4740) {
  4031. return 2;
  4032. }
  4033. switch (distance) {
  4034. case 1: slope = 2; break;
  4035. case 2: slope = 4; break;
  4036. case 3: slope = 6; break;
  4037. case 4: slope = 8; break;
  4038. case 5: slope = 10; break;
  4039. case 6: slope = 12; break;
  4040. case 7: slope = 14; break;
  4041. }
  4042. return slope;
  4043. }
  4044.  
  4045. public void soulSplit(int damage) {
  4046. Player opp = Server.engine.players[hitIndex];
  4047. if (opp.usingPrayer(24)) {
  4048. if (damage > 70) {
  4049. opp.skillLvl[8] += 14;
  4050. } else if (damage > 65) {
  4051. opp.skillLvl[8] += 13;
  4052. } else if (damage > 60) {
  4053. opp.skillLvl[8] += 12;
  4054. } else if (damage > 55) {
  4055. opp.skillLvl[8] += 11;
  4056. } else if (damage > 50) {
  4057. opp.skillLvl[8] += 10;
  4058. } else if (damage > 45) {
  4059. opp.skillLvl[8] += 9;
  4060. } else if (damage > 40) {
  4061. opp.skillLvl[8] += 8;
  4062. } else if (damage > 35) {
  4063. opp.skillLvl[8] += 7;
  4064. } else if (damage > 30) {
  4065. opp.skillLvl[8] += 6;
  4066. } else if (damage > 25) {
  4067. opp.skillLvl[8] += 5;
  4068. } else if (damage > 20) {
  4069. opp.skillLvl[8] += 4;
  4070. } else if (damage > 15) {
  4071. opp.skillLvl[8] += 3;
  4072. } else if (damage > 10) {
  4073. opp.skillLvl[8] += 2;
  4074. } else {
  4075. opp.skillLvl[3] += 1;
  4076. }
  4077. }
  4078. }
  4079.  
  4080. public void appendHit(int damage, int poison) {
  4081. Player opp = Server.engine.players[hitIndex];
  4082. checkForROL();
  4083. if (opp != null) {
  4084. if (opp.isDead) {
  4085. return;
  4086. }
  4087. if (damage > skillLvl[3]) {
  4088. damage = skillLvl[3];
  4089. }
  4090. updateHP(damage, false);
  4091. if (autoRetaliate) {
  4092. enemyIndex = hitIndex;
  4093. attackingPlayer = true;
  4094. }
  4095. int[] skill = {-1, -1, -1};
  4096. if (!usingMage) {
  4097. switch (opp.attackStyle()) {
  4098. case 1:
  4099. skill[0] = 0;
  4100. skill[1] = 0;
  4101. skill[2] = 0;
  4102. break;
  4103. case 2:
  4104. skill[0] = 2;
  4105. skill[1] = 2;
  4106. skill[2] = 2;
  4107. break;
  4108. case 3:
  4109. skill[0] = 1;
  4110. skill[1] = 1;
  4111. skill[2] = 1;
  4112. break;
  4113. case 4:
  4114. skill[0] = 0;
  4115. skill[1] = 1;
  4116. skill[2] = 2;
  4117. break;
  4118. case 5:
  4119. case 6:
  4120. skill[0] = 4;
  4121. skill[1] = 4;
  4122. skill[2] = 4;
  4123. break;
  4124. case 7:
  4125. opp.appendExperience((damage * 200), 4);
  4126. opp.appendExperience((damage * 200), 1);
  4127. opp.appendExperience((damage * 133), 3);
  4128. break;
  4129. }
  4130. for (int i : skill) {
  4131. if (i != -1) {
  4132. opp.appendExperience((damage * 133), i);
  4133. }
  4134. }
  4135. opp.appendExperience((damage * 133), 3);
  4136. }
  4137. if (opp.usingPrayer(24) && poison == 0) { //Smite
  4138. if (skillLvl[5] - (int)Math.round(damage * 0.25) > 0) {
  4139. skillLvl[5] -= (int)Math.round(damage / 4);
  4140. getActionSender().setSkillLvl(this, 5);
  4141. } else {
  4142. skillLvl[5] = 0;
  4143. getActionSender().setSkillLvl(this, 5);
  4144. }
  4145. }
  4146. if (vengeance && poison == 0) { //Vengeance
  4147. if (damage > 0) {
  4148. if (skillLvl[3] > 0) {
  4149. opp.append1Hit(((int)Math.floor(damage * 0.75)), 0);
  4150. } else {
  4151. opp.append1Hit(0, 0);
  4152. }
  4153. requestForceChat("Taste vengeance!");
  4154. vengeance = false;
  4155. }
  4156. }
  4157. if (equipment[12] == 2550 && poison == 0) { //Ring of recoil
  4158. if (damage > 0) {
  4159. if (skillLvl[3] > 0) {
  4160. int recoil = 1 + ((int)Math.floor(damage * 0.10));
  4161. opp.append1Hit(recoil, 0);
  4162. totalDamageRecoiled += recoil;
  4163. if (totalDamageRecoiled >= 40) {
  4164. equipment[12] = -1;
  4165. equipmentN[12] = 0;
  4166. getActionSender().setItems(this, 387, 28, 93, equipment, equipmentN);
  4167. getActionSender().sendMessage(this, "Your ring of recoil has shattered.");
  4168. totalDamageRecoiled = 0;
  4169. }
  4170. } else {
  4171. opp.append1Hit(0, 0);
  4172. }
  4173. }
  4174. }
  4175. if (equipment[3] == 13899 && damage > 0) { //VLS (Deg)
  4176. VLSTimer = 800;
  4177. equipment[3] = 13901;
  4178. getActionSender().setItems(this, 387, 28, 93, equipment, equipmentN);
  4179. getActionSender().sendMessage(this, "Your Vesta's longsword has degraded slightly.");
  4180. }
  4181. if (equipment[3] == 13901 && VLSTimer == 0) {
  4182. VLSTimer = -1;
  4183. equipment[3] = -1;
  4184. equipmentN[3] = 0;
  4185. getActionSender().setItems(this, 387, 28, 93, equipment, equipmentN);
  4186. getActionSender().sendMessage(this, "Your Vesta's longsword has degraded into nothing.");
  4187. }
  4188. if (opp.barrowsSet(3) && poison == 0) { //Guthans affect
  4189. if (Math.random() <= 0.25) {
  4190. opp.updateHP(damage, true);
  4191. requestGFX(398, 0);
  4192. }
  4193. }
  4194. if (!hit1UpdateReq) {
  4195. hitDiff1 = damage;
  4196. poisonHit1 = poison;
  4197. hit1UpdateReq = true;
  4198. } else {
  4199. hitDiff2 = damage;
  4200. poisonHit2 = poison;
  4201. hit2UpdateReq = true;
  4202. }
  4203. updateReq = true;
  4204. }
  4205. }
  4206.  
  4207. /**
  4208. * Append damage.
  4209. */
  4210. public void append1Hit(int damage, int poison) {
  4211. if (damage > skillLvl[3]) {
  4212. damage = skillLvl[3];
  4213. }
  4214. updateHP(damage, false);
  4215. if (!hit1UpdateReq) {
  4216. hitDiff1 = damage;
  4217. poisonHit1 = poison;
  4218. hit1UpdateReq = true;
  4219. } else {
  4220. hitDiff2 = damage;
  4221. poisonHit2 = poison;
  4222. hit2UpdateReq = true;
  4223. }
  4224. updateReq = true;
  4225. }
  4226.  
  4227. /**
  4228. * Block anims.
  4229. */
  4230. public int getBlockAnim() {
  4231. if (equipment[3] == 4031) {
  4232. return 221;
  4233. }
  4234. if (equipment[5] == 8850) {
  4235. return 4177;
  4236. }
  4237. return 1156;
  4238. }
  4239.  
  4240. /**
  4241. * Block anims.
  4242. */
  4243. public int getBlockAnim1() {
  4244. if (equipment[3] == 4031) {
  4245. return 221;
  4246. }
  4247. if (equipment[3] == 4151) {
  4248. return 1659;
  4249. }
  4250. if (equipment[3] == 4718 ||
  4251. equipment[3] == -1) {
  4252. return 424;
  4253. }
  4254. if (equipment[3] == 4755) {
  4255. return 2063;
  4256. }
  4257. if (equipment[3] == 10887) {
  4258. return 5866;
  4259. }
  4260. if (equipment[3] == 4153) {
  4261. return 1666;
  4262. }
  4263. if (equipment[3] == 11694 ||
  4264. equipment[3] == 11696 ||
  4265. equipment[3] == 11698 ||
  4266. equipment[3] == 11700 ||
  4267. equipment[3] == 1307 ||
  4268. equipment[3] == 1309 ||
  4269. equipment[3] == 1311 ||
  4270. equipment[3] == 1313 ||
  4271. equipment[3] == 1315 ||
  4272. equipment[3] == 1317 ||
  4273. equipment[3] == 1319 ||
  4274. equipment[3] == 7158 ||
  4275. equipment[3] == 11730) {
  4276. return 7050;
  4277. }
  4278. if (equipment[3] == 3204) {
  4279. return 420;
  4280. }
  4281. return 404;
  4282. }
  4283.  
  4284. /**
  4285. * Force chat text.
  4286. */
  4287. public void requestForceChat(String s) {
  4288. forceChat = s;
  4289. forceChatUpdateReq = true;
  4290. updateReq = true;
  4291. }
  4292. public boolean quickChat;
  4293. public void requestForceChat2(String s) {
  4294. quickChat = true;
  4295. chatTextUpdateReq = true;
  4296. chatText = s;
  4297. updateReq = true;
  4298. }
  4299.  
  4300. public int getArmourDef() {
  4301. switch (equipment[4]) {
  4302.  
  4303. case 1127: return 80;
  4304. case 4712: return 120;
  4305. case 4757: return 140;
  4306. case 4720: return 140;
  4307. case 3140: return 100;
  4308. case 10551: return 70;
  4309. case 11720: return 215;
  4310. case 11724: return 220;
  4311. }
  4312. return 10;
  4313. }
  4314.  
  4315. public int getRangeArmourDef() {
  4316. switch (equipment[4]) {
  4317.  
  4318. case 1135: return 115;
  4319. case 2499: return 140;
  4320. case 2501: return 165;
  4321. case 2503: return 190;
  4322. case 11720: return 200;
  4323. }
  4324. return 40;
  4325. }
  4326.  
  4327. public int getRangeBonus() {
  4328. switch (equipment[3]) {
  4329.  
  4330. case 841: return 65;
  4331. case 843: return 80;
  4332. case 845: return 85;
  4333. case 847: return 90;
  4334. case 849: return 95;
  4335. case 851: return 100;
  4336. case 853: return 120;
  4337. case 855: return 130;
  4338. case 857: return 150;
  4339. case 859: return 165;
  4340. case 861: return 180;
  4341. case 9185: return 280;
  4342. case 11235: return 160;
  4343. }
  4344. return 60;
  4345. }
  4346.  
  4347. public boolean defile;
  4348.  
  4349. public void checkVeracs() {
  4350. if (barrowsSet(6)) {
  4351. if (Misc.random(3) < 1) {
  4352. defile = true;
  4353. }
  4354. } else {
  4355. defile = false;
  4356. }
  4357. }
  4358.  
  4359. public double accuracy = 1;
  4360.  
  4361. public double meleeAccuracy(Player opp) {
  4362. if (opp == null || this.isDead || opp.isDead || this.disconnected[0] || opp.disconnected[0]) {
  4363. return 1;
  4364. }
  4365. double attack = skillLvl[0];
  4366. double defence = opp.skillLvl[1];
  4367. int activeAttackBonus = weaponStyle(equipment[3]) - 1;
  4368. int activeDefenceBonus = activeAttackBonus + 5;
  4369. double attackBonus = equipmentBonus[activeAttackBonus];
  4370. double defenceBonus = opp.equipmentBonus[activeDefenceBonus];
  4371. if (usingPrayer(2)) {
  4372. attack *= 1.05;
  4373. }
  4374. if (usingPrayer(7)) {
  4375. attack *= 1.10;
  4376. }
  4377. if (usingPrayer(15)) {
  4378. attack *= 1.15;
  4379. }
  4380. if (usingPrayer(25)) {
  4381. attack *= 1.15;
  4382. }
  4383. if (usingPrayer(26)) {
  4384. attack *= 1.13;
  4385. }
  4386. if (attackStyle() == 4) {
  4387. attack -= 1;
  4388. }
  4389. if (attackStyle() == 1) {
  4390. attack -= 1;
  4391. }
  4392. if (opp.usingPrayer(0)) {
  4393. defence *= 1.05;
  4394. }
  4395. if (opp.usingPrayer(5)) {
  4396. defence *= 1.10;
  4397. }
  4398. if (opp.usingPrayer(13)) {
  4399. defence *= 1.3315;
  4400. }
  4401. if (opp.usingPrayer(25)) {
  4402. defence *= 1.20;
  4403. }
  4404. if (opp.usingPrayer(26)) {
  4405. defence *= 1.32159;
  4406. }
  4407. if (opp.attackStyle() == 4) {
  4408. defence += 2;
  4409. }
  4410. if (opp.attackStyle() == 3) {
  4411. defence += 4;
  4412. }
  4413. if (attackBonus < 0) {
  4414. attackBonus = 0;
  4415. }
  4416. if (defenceBonus < 0) {
  4417. defenceBonus = 0;
  4418. }
  4419. if (defile) {
  4420. //defenceBonus = 0;
  4421. }
  4422. double offensiveAttribute = (attack * 1.5) + attackBonus;
  4423. double defensiveAttribute = (defence * 1.5) + defenceBonus;
  4424. double difference = Math.abs(offensiveAttribute - defensiveAttribute);
  4425. boolean positive = offensiveAttribute > defensiveAttribute;
  4426. double interval = difference * 0.0015;
  4427. double percentage = 0.55;
  4428. if (!positive) {
  4429. percentage -= interval;
  4430. }
  4431. if (positive) {
  4432. percentage += interval;
  4433. }
  4434. if (accuracy != 1) {
  4435. percentage *= accuracy;
  4436. accuracy = 1;
  4437. }
  4438. return percentage;
  4439. }
  4440.  
  4441. public boolean hitPlayer(Player opp) {
  4442. return Math.random() <= meleeAccuracy(opp);
  4443. }
  4444.  
  4445. public double rangeAccuracy(Player opp) {
  4446. if (opp == null || this.isDead || opp.isDead || this.disconnected[0] || opp.disconnected[0]) {
  4447. return 1;
  4448. }
  4449. double range = skillLvl[4];
  4450. double defence = opp.skillLvl[1];
  4451. double rangeBonus = equipmentBonus[4];
  4452. double defenceBonus = opp.equipmentBonus[9];
  4453. if (usingPrayer(3)) {
  4454. range *= 1.05;
  4455. }
  4456. if (usingPrayer(11)) {
  4457. range *= 1.10;
  4458. }
  4459. if (usingPrayer(20)) {
  4460. range *= 1.15;
  4461. }
  4462. if (attackStyle() == 5) {
  4463. range += 1;
  4464. }
  4465. if (opp.usingPrayer(0)) {
  4466. defence *= 1.05;
  4467. }
  4468. if (opp.usingPrayer(5)) {
  4469. defence *= 1.10;
  4470. }
  4471. if (opp.usingPrayer(13)) {
  4472. defence *= 1.27;
  4473. }
  4474. if (opp.usingPrayer(25)) {
  4475. defence *= 1.20;
  4476. }
  4477. if (opp.usingPrayer(26)) {
  4478. defence *= 1.28;
  4479. }
  4480. if (opp.attackStyle() == 4) {
  4481. defence += 1;
  4482. }
  4483. if (opp.attackStyle() == 3) {
  4484. defence += 3;
  4485. }
  4486. if (rangeBonus < 0) {
  4487. rangeBonus = 0;
  4488. }
  4489. if (defenceBonus < 0) {
  4490. defenceBonus = 0;
  4491. }
  4492. double offensiveAttribute = range + rangeBonus;
  4493. double defensiveAttribute = defence + defenceBonus;
  4494. double difference = Math.abs(offensiveAttribute - defensiveAttribute);
  4495. boolean positive = offensiveAttribute > defensiveAttribute;
  4496. double interval = difference * 0.00175;
  4497. double percentage = 0.50;
  4498. if (!positive) {
  4499. percentage -= interval;
  4500. }
  4501. if (positive) {
  4502. percentage += interval;
  4503. }
  4504. if (accuracy != 1) {
  4505. percentage *= accuracy;
  4506. accuracy = 1;
  4507. }
  4508. return percentage;
  4509. }
  4510.  
  4511. public boolean hitPlayerRange(Player opp) {
  4512. return Math.random() <= rangeAccuracy(opp);
  4513. }
  4514.  
  4515. public boolean barrowsSet(int setID) {
  4516. String helmet = Engine.items.getItemName(equipment[0]);
  4517. String platebody = Engine.items.getItemName(equipment[4]);
  4518. String weapon = Engine.items.getItemName(equipment[3]);
  4519. String platelegs = Engine.items.getItemName(equipment[7]);
  4520. String set = "";
  4521. switch (setID) {
  4522. case 1: //Ahrim's
  4523. set = "Ahrim";
  4524. break;
  4525. case 2: //Dharok's
  4526. set = "Dharok";
  4527. break;
  4528. case 3: //Guthan's
  4529. set = "Guthan";
  4530. break;
  4531. case 4: //Karil's
  4532. set = "Karil";
  4533. break;
  4534. case 5: //Torag's
  4535. set = "Torag";
  4536. break;
  4537. case 6: //Verac's
  4538. set = "Verac";
  4539. break;
  4540. }
  4541. boolean hasHelmet = helmet.contains(set);
  4542. boolean hasPlatebody = platebody.contains(set);
  4543. boolean hasWeapon = weapon.contains(set);
  4544. boolean hasPlatelegs = platelegs.contains(set);
  4545. if (hasHelmet && hasPlatebody && hasWeapon && hasPlatelegs) {
  4546. return true;
  4547. }
  4548. return false;
  4549. }
  4550. public boolean voidSet(int setID) {
  4551. String helmet = Engine.items.getItemName(equipment[0]);
  4552. String set = "";
  4553. switch (setID) {
  4554. case 1: //Melee
  4555. set = "Void melee";
  4556. break;
  4557. case 2: //Range
  4558. set = "Void ranger";
  4559. break;
  4560. case 3: //Mage
  4561. set = "Void mage";
  4562. break;
  4563. }
  4564. boolean hasHelmet = helmet.contains(set);
  4565. boolean hasTop = equipment[4] == 8839;
  4566. boolean hasGloves = equipment[9] == 8842;
  4567. boolean hasBottom = equipment[7] == 8840;
  4568. if (hasHelmet && hasTop && hasGloves && hasBottom) {
  4569. return true;
  4570. }
  4571. return false;
  4572. }
  4573.  
  4574. public boolean hasProperArrows(int bow, int arrows) {
  4575. if (usingSpecial) {
  4576. if (weapon == 861 || weapon == 11235) {
  4577. if (equipmentN[13] <= 1) {
  4578. getActionSender().sendMessage(this, "You don't have enough ammo!");
  4579. return false;
  4580. }
  4581. }
  4582. }
  4583. if (bow >= 839 && bow <= 861) {
  4584. switch (arrows) {
  4585. case 882:
  4586. case 884:
  4587. case 886:
  4588. case 888:
  4589. case 890:
  4590. case 892: return true;
  4591. }
  4592. }
  4593. if (bow == 11235) {
  4594. switch (arrows) {
  4595. case 882:
  4596. case 884:
  4597. case 886:
  4598. case 888:
  4599. case 890:
  4600. case 892:
  4601. case 11212:
  4602. if (equipmentN[13] > 1) {
  4603. return true;
  4604. } else {
  4605. getActionSender().sendMessage(this, "You don't have enough ammo!");
  4606. return false;
  4607. }
  4608. }
  4609. }
  4610. if (bow == 4214 || bow == 868 || bow == 11230 || bow == 13833) {
  4611. return true;
  4612. }
  4613. if (bow == 9185) {
  4614. switch (arrows) {
  4615. case 9243:
  4616. case 9244: return true;
  4617. }
  4618. }
  4619. if (bow == 4734) {
  4620. if (arrows == 4740) return true;
  4621. }
  4622. return false;
  4623. }
  4624.  
  4625. public boolean hitNpcRange() {
  4626. PlayerCombat playCb = new PlayerCombat(this);
  4627. if (getRandom(equipmentBonus[8] + getRangeBonus()) > getRandom(playCb.getNpcDefenceRange())) {
  4628. return true;
  4629. }
  4630. return false;
  4631. }
  4632.  
  4633. private int getRandom(int range) {
  4634. return (int)(Math.random() * (range + 1));
  4635. }
  4636.  
  4637. /**
  4638. * Gives experience to a player.
  4639. * @param amount The amount which will gives to the player
  4640. * @param skillId the skill Id of the player which the exp will go to.
  4641. */
  4642. public void appendExperience(int amount, int skillId) {
  4643. if (!getExperience) {
  4644. return;
  4645. }
  4646. int oldLvl = getLevelForXP(skillId);
  4647. if (skillXP[skillId] > 200000000) {
  4648. return;
  4649. }
  4650. skillXP[skillId] += amount;
  4651. int newLvl = getLevelForXP(skillId);
  4652. if (oldLvl < newLvl) {
  4653. skillLvl[skillId] += (newLvl - oldLvl);
  4654. switch (skillId) {
  4655. case 0:
  4656. getActionSender().sendMessage(this, "Congratulations, You have just advanced a new Attack level!");
  4657. break;
  4658.  
  4659. case 1:
  4660. getActionSender().sendMessage(this, "Congratulations, You have just advanced a new Defence level!");
  4661. break;
  4662.  
  4663. case 2:
  4664. getActionSender().sendMessage(this, "Congratulations, You have just advanced a new Strength level!");
  4665. break;
  4666.  
  4667. case 3:
  4668. getActionSender().sendMessage(this, "Congratulations, You have just advanced a new hitpoints level!");
  4669. break;
  4670.  
  4671. case 4:
  4672. getActionSender().sendMessage(this, "Congratulations, You have just advanced a new Ranged level!");
  4673. break;
  4674.  
  4675. case 5:
  4676. getActionSender().sendMessage(this, "Congratulations, You have just advanced a new Prayer level!");
  4677. break;
  4678.  
  4679. case 6:
  4680. getActionSender().sendMessage(this, "Congratulations, You have just advanced a new Magic level!");
  4681. break;
  4682.  
  4683. case 7:
  4684. getActionSender().sendMessage(this, "Congratulations, You have just advanced a new Cooking level!");
  4685. break;
  4686.  
  4687. case 8:
  4688. getActionSender().sendMessage(this, "Congratulations, You have just advanced a new Woodcutting level!");
  4689. break;
  4690.  
  4691. case 16:
  4692. getActionSender().sendMessage(this, "Congratulations, You have just advanced a new Agility level!");
  4693. break;
  4694.  
  4695. case 17:
  4696. getActionSender().sendMessage(this, "Congratulations, You have just advanced a new Thieving level!");
  4697. break;
  4698.  
  4699. case 18:
  4700. getActionSender().sendMessage(this, "Congratulations, You have just advanced a new Slayer level!");
  4701. break;
  4702.  
  4703. case 19:
  4704. getActionSender().sendMessage(this, "Congratulations, You have just advanced a new Farming level!");
  4705. break;
  4706.  
  4707. case 20:
  4708. getActionSender().sendMessage(this, "Congratulations, You have just advanced a new Runecrafting level!");
  4709. break;
  4710.  
  4711. default:
  4712. getActionSender().sendMessage(this, "This level is unknown, Please report this to an administrator.");
  4713. break;
  4714. }
  4715. requestGFX(1635, 0);
  4716. appearanceUpdateReq = true;
  4717. updateReq = true;
  4718. }
  4719. getActionSender().setSkillLvl(this, skillId);
  4720. }
  4721.  
  4722. /**
  4723. * Checks special amount and gets config.
  4724. */
  4725. public void checkAmount() {
  4726. int amount = specAmount;
  4727. getActionSender().setConfig2(this, 300, amount);
  4728. }
  4729.  
  4730. /**
  4731. * Walking request.
  4732. */
  4733. public void playerWalk(int x, int y, int emote, int delay) {
  4734. int firstX = x - (mapRegionX - 6) * 8;
  4735. int firstY = y - (mapRegionY - 6) * 8;
  4736. Engine.playerMovement.resetWalkingQueue(this);
  4737. Engine.playerMovement.addToWalkingQueue(this, firstX, firstY);
  4738. appearanceUpdateReq = true;
  4739. updateReq = true;
  4740. }
  4741.  
  4742. public boolean inWilderness() {
  4743. return absX >= 3136 && absX <= 3350 && absY >= 3523 && absY <= 3597;
  4744. }
  4745.  
  4746. /**
  4747. * Cross wilderness ditch
  4748. */
  4749. public void crossDitch() {
  4750. int y = 3520;
  4751. if (!wildernessZone(absX, absY)) {
  4752. y = 3523;
  4753. }
  4754. playerWalk(absX, y, 6132, 0);
  4755. appearanceUpdateReq = true;
  4756. updateReq = true;
  4757. }
  4758.  
  4759.  
  4760. /**
  4761. * Boolean which returns coords ids to get safezone of bounty hunter place.
  4762. */
  4763.  
  4764. public boolean pkArenaPart1() {
  4765. return absX >= 3067 && absX <= 3134 && absY >= 3650 && absY <= 3698;
  4766. }
  4767.  
  4768. public boolean godwarsIceArea() {
  4769. return absX >= 2895 && absX <= 2936 && absY >= 3713 && absY <= 3771;
  4770. }
  4771.  
  4772. public boolean pkArenaPart2() {
  4773. return absX >= 3135 && absX <= 3144 && absY >= 3672 && absY <= 3714;
  4774. }
  4775.  
  4776. public boolean inPkArena() {
  4777. return pkArenaPart1() && pkArenaPart2();
  4778. }
  4779.  
  4780. public boolean safeArea(int x, int y) {
  4781. if ((x > 3264 && x < 3279 && y > 3672 && y < 3695) || //Clan wars
  4782. (x > 3140 && x < 3193 && y > 3653 && y < 3707)) { //Bounty Hunter
  4783. return true;
  4784. }
  4785. return false;
  4786. }
  4787.  
  4788.  
  4789. public boolean bountyArea1() {
  4790. return absX >=3084 && absX <=3140 && absY >=3661 && absY <=3763;
  4791. }
  4792. public boolean bountyArea2() {
  4793. return absX >=3140 && absX <=3184 && absY >=3702 && absY <=3763;
  4794. }
  4795. public boolean bountyArea3() {
  4796. return absX >=3140 && absX <=3174 && absY >=3692 && absY <=3702;
  4797. }
  4798. public boolean bountyArea4() {
  4799. return absX >=3140 && absX <=3157 && absY >=3678 && absY <=3692;
  4800. }
  4801. public boolean bountyArea5() {
  4802. return absX >=3140 && absX <=3145 && absY >=3663 && absY <=3678;
  4803. }
  4804. public boolean bountyArea6() {
  4805. return absX >=3140 && absX <=3131 && absY >=3661 && absY <=3663;
  4806. }
  4807. public boolean bountyArea() {
  4808. return bountyArea1() || bountyArea2() || bountyArea3() || bountyArea4() || bountyArea5() || bountyArea6();
  4809. }
  4810. public boolean fullBounty() {
  4811. return absX >=3085 && absX <=3185 && absY >=3662 && absY <=3765;
  4812. }
  4813. public boolean bountySafe1() {
  4814. return absX >=3173 && absX <=3193 && absY >=3669 && absY <=3701;
  4815. }
  4816. public boolean bountySafe2() {
  4817. return absX >=3154 && absX <=3173 && absY >=3669 && absY <=3690;
  4818. }
  4819. public boolean bountySafe3() {
  4820. return absX >=3145 && absX <=3167 && absY >=3662 && absY <=3668;
  4821. }
  4822. public boolean bountySafe4() {
  4823. return absX >=3143 && absX <=3154 && absY >=3669 && absY <=3675;
  4824. }
  4825. public boolean bountySafe5() {
  4826. return absX >=3136 && absX <=3145 && absY >=3652 && absY <=3662;
  4827. }
  4828. public boolean insideWGuild() {
  4829. return absX >= 2835 && absX <= 2879 && absY >= 3531 && absY <= 3559;
  4830. }
  4831.  
  4832. public boolean bountySafe() {
  4833. return bountySafe1() || bountySafe2() || bountySafe3() || bountySafe4() || bountySafe5();
  4834. }
  4835.  
  4836. void updateStats() {
  4837. if (isDead) {
  4838. return;
  4839. }
  4840. int skill = 0;
  4841. while (skill <= 22) {
  4842. if (skill == 3 || skill == 5) {
  4843. skill++;
  4844. }
  4845. if (skillLvl[skill] > getLevelForXP(skill)) {
  4846. skillLvl[skill]--;
  4847. }
  4848. if (skillLvl[skill] < getLevelForXP(skill)) {
  4849. skillLvl[skill]++;
  4850. }
  4851. statDelay = 100;
  4852. getActionSender().setSkillLvl(this, skill);
  4853. skill++;
  4854. }
  4855. }
  4856. void restoreHP() {
  4857. if (isDead) {
  4858. return;
  4859. }
  4860. if (skillLvl[3] > getLevelForXP(3)) {
  4861. skillLvl[3]--;
  4862. }
  4863. if (skillLvl[3] < getLevelForXP(3)) {
  4864. skillLvl[3] += equipment[9] == 11133 ? 2 : 1;
  4865. }
  4866. hpDelay = 100;
  4867. getActionSender().setSkillLvl(this, 3);
  4868. }
  4869.  
  4870. /**
  4871. * Unequip and delete all items player has.
  4872. */
  4873. public void dropAllStuff() {
  4874. if (this == null)
  4875. return;
  4876. PlayerItems pi = new PlayerItems();
  4877. for(int i = 0; i < items.length; i++)
  4878. {
  4879. if(items[i] == 6570)
  4880. break;
  4881. if(items[i] >= 0)
  4882. {
  4883. if(Engine.items.isUntradable((items[i])))
  4884. {
  4885. Engine.playerItems.deleteItem(this, items[i], pi.getItemSlot(this, items[i]), itemsN[i]);
  4886. }
  4887. else
  4888. {
  4889. Engine.playerItems.deleteItem(this, items[i], pi.getItemSlot(this, items[i]), itemsN[i]);
  4890. }
  4891. }
  4892. }
  4893. for(int i = 0; i < equipment.length; i++)
  4894. {
  4895. if(equipment[i] == 6570)
  4896. break;
  4897. if(equipment[i] >= 0)
  4898. {
  4899. getActionSender().removeEquipment(this, equipment[i], i);
  4900. if(Engine.items.isUntradable((items[0])))
  4901. {
  4902. Engine.playerItems.deleteItem(this, items[0], pi.getItemSlot(this, items[0]), itemsN[0]);
  4903.  
  4904. }
  4905. else
  4906. {
  4907. Engine.playerItems.deleteItem(this, items[0], pi.getItemSlot(this, items[0]), itemsN[0]);
  4908. }
  4909. }
  4910. }
  4911. combatType = 0;
  4912. }
  4913.  
  4914. public boolean arrayContains(int[] array, int value) {
  4915. for (int i : array) {
  4916. if (value == i) {
  4917. return true;
  4918. }
  4919. }
  4920. return false;
  4921. }
  4922.  
  4923. public int[] removeValueFromArray(int[] array, int value) {
  4924. int index = -1;
  4925. for (int i = 0; i < array.length; i++) {
  4926. if (value == array[i]) {
  4927. index = i;
  4928. }
  4929. }
  4930. if (index != -1) {
  4931. array[index] = 0;
  4932. }
  4933. return array;
  4934. }
  4935.  
  4936. public int[][] removeValueFromArray(int[][] array, int value) {
  4937. int indexI = -1;
  4938. int indexJ = -1;
  4939. for (int i = 0; i < array.length; i++) {
  4940. for (int j = 0; j < array[i].length; j++) {
  4941. if (value == array[i][j]) {
  4942. indexI = i;
  4943. indexJ = j;
  4944. }
  4945. }
  4946. }
  4947. if (indexI != -1 && indexJ != -1) {
  4948. array[indexI][indexJ] = -1;
  4949. }
  4950. return array;
  4951. }
  4952.  
  4953. public int keptItem1 = -1;
  4954. public int keptItem2 = -1;
  4955. public int keptItem3 = -1;
  4956. public int keptItem4 = -1;
  4957.  
  4958. void dropStuff(String opp) {
  4959. try {
  4960.  
  4961. int[] newest = {4716, 4722, 4718, 4720, 4708, 4710, 4712, 4714, 4745, 4747, 4749, 4751, 4736, 4738, 4732, 4734, 4753, 4755, 4757, 4759, 4724, 4726, 4728, 4730};
  4962. int[] broken = {4884, 4902, 4890, 4896, 4860, 4866, 4872, 4878, 4956, 4962, 4968, 4974, 4944, 4950, 4932, 4938, 4980, 4986, 4992, 4998, 4908, 4914, 4920, 4926};
  4963.  
  4964. int amountOfKeptItems = isSkulled ? (usingPrayer(10) ? 1 : 0) : (usingPrayer(10) ? 4 : 3);
  4965. int[] allItems = new int[items.length + equipment.length];
  4966. int[] allItemsN = new int[itemsN.length + equipmentN.length];
  4967. int[] keptItems = new int[amountOfKeptItems];
  4968. int[] toAdd = new int[keptItems.length];
  4969. System.arraycopy(items, 0, allItems, 0, items.length);
  4970. System.arraycopy(equipment, 0, allItems, items.length, equipment.length);
  4971. System.arraycopy(itemsN, 0, allItemsN, 0, itemsN.length);
  4972. System.arraycopy(equipmentN, 0, allItemsN, itemsN.length, equipmentN.length);
  4973. for (int i = 0; i < keptItems.length; i++) {
  4974. int index = 0;
  4975. int standing = 0;
  4976. for (int j = 0; j < allItems.length; j++) {
  4977. if (allItems[j] < 1) {
  4978. continue;
  4979. }
  4980. int price = getItemValue(allItems[j]);
  4981. if (price > standing) {
  4982. index = j;
  4983. standing = price;
  4984. }
  4985. }
  4986. keptItems[i] = allItems[index];
  4987. toAdd[i] = allItems[index];
  4988. allItemsN[index]--;
  4989. if (allItemsN[index] == 0) {
  4990. allItems[index] = 0;
  4991. }
  4992. }
  4993. for(int i = 0; i < items.length; i++) {
  4994. for (int x = 0; x < newest.length; x++) {
  4995. if (items[i] == newest[x])
  4996. items[i] = broken[x];
  4997. }
  4998. if(items[i] > 0) {
  4999. if (!arrayContains(keptItems, items[i])) {
  5000. if (Engine.items.isUntradable((items[i]))) {
  5001. if (items[i] != 13899) {
  5002. Engine.items.createGroundItem(items[i], itemsN[i], absX, absY, heightLevel, username);
  5003. } else {
  5004. getActionSender().sendMessage(this, "Your Vesta's longsword shatters as it hits the ground.");
  5005. degrade = 6000;
  5006. degrades = false;
  5007. }
  5008. Engine.playerItems.deleteItem(this, items[i], Engine.playerItems.getItemSlot(this, items[i]), itemsN[i]);
  5009. } else {
  5010. if (!isPVP()) {
  5011. Engine.items.createGroundItem(items[i], itemsN[i], absX, absY, heightLevel, opp);
  5012. }
  5013. }
  5014. } else {
  5015. keptItems = removeValueFromArray(keptItems, items[i]);
  5016. }
  5017. Engine.playerItems.deleteItem(this, items[i], Engine.playerItems.getItemSlot(this, items[i]), itemsN[i]);
  5018. }
  5019. }
  5020. for(int i = 0; i < equipment.length; i++) {
  5021. for (int x = 0; x < newest.length; x++) {
  5022. if (equipment[i] == newest[x])
  5023. equipment[i] = broken[x];
  5024. }
  5025. if (equipment[i] > 0) {
  5026. getActionSender().removeEquipment(this, equipment[i], i);
  5027. if (!arrayContains(keptItems, items[0])) {
  5028. if(Engine.items.isUntradable((items[0]))) {
  5029. if (items[0] != 13899) {
  5030. Engine.items.createGroundItem(items[0], itemsN[0], absX, absY, heightLevel, username);
  5031. } else {
  5032. getActionSender().sendMessage(this, "Your Vesta's longsword shatters as it hits the ground.");
  5033. degrade = 6000;
  5034. degrades = false;
  5035. }
  5036. Engine.playerItems.deleteItem(this, items[0], Engine.playerItems.getItemSlot(this, items[0]), itemsN[0]);
  5037. } else {
  5038. if (!isPVP()) {
  5039. Engine.items.createGroundItem(items[0], itemsN[0], absX, absY, heightLevel, opp);
  5040. }
  5041. }
  5042. } else {
  5043. keptItems = removeValueFromArray(keptItems, items[0]);
  5044. }
  5045. Engine.playerItems.deleteItem(this, items[0], Engine.playerItems.getItemSlot(this, items[0]), itemsN[0]);
  5046. }
  5047. }
  5048. for (int i = 0; i < items.length; i++) {
  5049. items[i] = -1;
  5050. itemsN[i] = 0;
  5051. getActionSender().setItems(this, -1, 64209, 93, items, itemsN);
  5052. }
  5053. for (int i : toAdd) {
  5054. if (i > 0) {
  5055. Engine.playerItems.addItem(this, i, 1);
  5056. }
  5057. }
  5058. Engine.items.createGroundItem(526, 1, absX, absY, heightLevel, opp);
  5059. Engine.items.createGroundItem(RANDOM_ITEMS[(int) Math.random() * RANDOM_ITEMS.length], 1, absX, absY, heightLevel, opp);
  5060. int[] lostItems = allItems;
  5061. if (isPVP() && receivesPVPDrop(this, Server.engine.players[Server.engine.getIdFromName(opp)])) {
  5062. PVPDrop(opp, lostItems);
  5063. }
  5064. } catch (Exception e) {
  5065. e.printStackTrace();
  5066. //System.out.println("Null drop: "+opp);
  5067. return;
  5068. }
  5069. }
  5070.  
  5071. public int totalValue(int[] items) {
  5072. int totalValue = 0;
  5073. try {
  5074. int[] allItems = new int[items.length + equipment.length];
  5075. System.arraycopy(items, 0, allItems, 0, items.length);
  5076. System.arraycopy(equipment, 0, allItems, items.length, equipment.length);
  5077.  
  5078. for (int i : allItems) {
  5079. totalValue += getItemValue(i);
  5080. }
  5081. } catch (Exception e) {
  5082. e.printStackTrace();
  5083. return 0;
  5084. }
  5085. return totalValue;
  5086. }
  5087. void PVPDrop(String player, int[] lostItems) {
  5088. Player dropFor = Server.engine.players[Server.engine.getIdFromName(player)];
  5089. try {
  5090. if (dropFor.setDrop != 0) {
  5091. Engine.items.createGroundItem(dropFor.setDrop, 1, absX, absY, heightLevel, player);
  5092. dropFor.setDrop = 0;
  5093. }
  5094. if (Double.isInfinite(dropFor.PVPPotential) || Double.isNaN(dropFor.PVPPotential)) {
  5095. dropFor.PVPPotential = 0.0;
  5096. }
  5097. double chance = 0.00;
  5098. int randomDrops = 0;
  5099. for (int i : lostItems) {
  5100. if (Math.random() <= 0.75) {
  5101. lostItems = removeValueFromArray(lostItems, i);
  5102. } else {
  5103. if (getItemValue(i) >= 3000) {
  5104. randomDrops++;
  5105. } else if (Math.random() <= 0.25) {
  5106. randomDrops++;
  5107. }
  5108. }
  5109.  
  5110. }
  5111. for (int i : lostItems) {
  5112. if (i == 0 || Engine.items.isUntradable(i)) {
  5113. continue;
  5114. }
  5115. Engine.items.createGroundItem(i, 1, absX, absY, heightLevel, player);
  5116. }
  5117. int[] potentialDrops = {1145,1147,2605,2613,2619,2627,2657,2673,3385,3486,3749,3751,3753,3755,4716,4724,4745,4753,5574,6128,6131,6137,10350,10589,10606,10828,11200,11335,1073,1079,1091,1093,1123,1127,2599,2601,2607,2609,2615,2617,2623,2625,2653,2655,2661,2669,2671,3474,3476,3480,3481,3483,3485,3670,3476,3674,3676,4087,4585,4720,4722,4728,4749,4751,4759,5575,5576,6129,6617,10346,10348,11720,11722,11724,1199,1201,2603,2611,2621,2629,2659,2667,2675,3488,10352,11726,11728,11730,11720,11718,11694,11696,11698,11700,11283,1187,1215,1231,1249,1263,1305,1377,1434,3101,3140,3204,4087,3587,5680,5698,6739,7158,9244,11212,11217,11227,11228,11229,11230,11231,11233,11234,11732,4091,4093,4095,4097,4099,4101,4103,4105,4107,4109,4111,4113,4115,4117,6916,6918,6920,6922,6924,4708,4710,4712,4714,4755,4757,4726,4730,4747,4732,4734,4735,4738,4740,4718,2491,2497,2503,10370,10386,6764,10368,10372,10374,10444,10450,10456,10460,10468,10474,10786,2663,3479,4151,6762,10384,10386,10388,10390,10440,10446,10452,10458,10464,10470,10784,6760,10376,10378,10380,10382,10442,10448,1454,10462,10466,10472,9672,9674,9676,9678,3122,4153,6809,10564,10330,10332,10334,10336,10338,10340,10342,10344,6731,6733,6735,6737,9185,1704,1706,1708,1710,1712,1725,1727,1729,1731,6585,10354,10356,10358,10360,10362,10364,10366,10719,10736,10738,6889,4129,4131,2579,6914,6912,139,141,143,169,171,173,175,177,179,2430,2442,2444,3040,3042,3044,3046,145,147,149,157,159,161,163,165,167,181,183,185,2436,2440,2448,3024,3026,3028,3030,6568,6524,6526,6523,6525,6522,6527,6528,11126,11124,11122,11120,11118,11133,13290, 14484}; //PVP Drops
  5118. for (int i = 0; i < randomDrops; i++) {
  5119. int item = potentialDrops[(int)Math.floor(Math.random() * potentialDrops.length)];
  5120. chance = getPVPDropPercentage(item, totalValue(lostItems), dropFor.PVPPotential);
  5121. if (Math.random() <= chance) {
  5122. Engine.items.createGroundItem(item, 1, absX, absY, heightLevel, player);
  5123. dropFor.PVPPotential -= ((1.00 - chance) / 10);
  5124. } else {
  5125. dropFor.PVPPotential += ((1.00 - chance) / 10);
  5126. }
  5127. }
  5128. } catch (Exception e) {
  5129. }
  5130. }
  5131.  
  5132. double getPVPDropPercentage(int item, int risk, double potential) {
  5133. double base = 0.10 + potential * (hotZone(absX, absY) ? 3.00 : 1.50);
  5134. double ratio = getItemValue(item) / 1457000;
  5135. double value = base / ratio;
  5136. if (value > 0.95) {
  5137. value = 0.95;
  5138. }
  5139. return value;
  5140. }
  5141.  
  5142. void drainPrayer() {
  5143. if (usingPrayer) {
  5144. if (drainDelay == 0) {
  5145. if (skillLvl[5] <= 1) {
  5146. resetPrayer();
  5147. skillLvl[5]--;
  5148. getActionSender().setSkillLvl(this, 5);
  5149. appearanceUpdateReq = true;
  5150. updateReq = true;
  5151. getActionSender().sendMessage(this, "You are out of prayer points. Please restore them at an prayer altar.");
  5152. return;
  5153. }
  5154. skillLvl[5]--;
  5155. getActionSender().setSkillLvl(this, 5);
  5156. }
  5157. drainDelay = 8;
  5158. appearanceUpdateReq = true;
  5159. updateReq = true;
  5160. }
  5161. }
  5162.  
  5163. public void appendWilderness() {
  5164. if (InBounty == 0 && safeArea(absX, absY)) {
  5165. return;
  5166. }
  5167. wildyLevel = getWildernessLevel();
  5168. if (savedLevel != wildyLevel) {
  5169. savedLevel = wildyLevel;
  5170. if (InBounty == 1) {
  5171. addWilderness();
  5172. }
  5173. if (wildyLevel > 0) {
  5174. addWilderness();
  5175. } else {
  5176. removeWilderness();
  5177. }
  5178. }
  5179. }
  5180. public void removeWilderness() {
  5181. setPlayerOptions(this);
  5182. getActionSender().removeOverlay(this);
  5183. getActionSender().setInterfaceConfig(this, 745, 6, false);
  5184. getActionSender().setInterfaceConfig(this, 745, 3, true);
  5185. }
  5186. public void addWilderness() {
  5187. setPlayerOptions(this);
  5188. if (InBounty == 0) {
  5189. if (!isPVP()) {
  5190. getActionSender().setOverlay(this, 381);
  5191. } else {
  5192. getActionSender().setInterfaceConfig(this, 745, 6, false);
  5193. getActionSender().setInterfaceConfig(this, 745, 3, true);
  5194. int max = combatLevel + wildyLevel;
  5195. if (max > 126) {
  5196. max = 126;
  5197. }
  5198. int min = (combatLevel - wildyLevel) + (((combatLevel % 10 >= 5) && ((combatLevel - wildyLevel) % 10 < 5) || (combatLevel >= 114)) ? 2 : 1);
  5199. if (min < 3) {
  5200. min = 3;
  5201. }
  5202. String range = min+" - "+max;
  5203. getActionSender().setString(this, range, 745, 1);
  5204. }
  5205. }
  5206. }
  5207.  
  5208. public boolean headIconUpdate = false;
  5209. public boolean getBhTarget = false;
  5210.  
  5211. public int immuneTimer = 0;
  5212.  
  5213. public void handleBountyHunter() {
  5214. Player p9 = Engine.players[this.bhTarget];
  5215. if (headIconUpdate) {
  5216. Engine.BountyHunter.getTargetHigh(this);
  5217. }
  5218. if(bhPickup < 1) {
  5219. bhPickup--;
  5220. this.getActionSender().setString(this, "", 653, 11);
  5221. this.getActionSender().setString(this, "", 653, 10);
  5222. }
  5223. if (bhPickup > 0) { //cant leave
  5224. this.getActionSender().setString(this, + bhPickup +" Sec", 653, 11);
  5225. getActionSender().setInterfaceConfig(this, 653, 12, true);
  5226. getActionSender().setInterfaceConfig(this, 653, 9, false);
  5227. getActionSender().setInterfaceConfig(this, 653, 10, true);
  5228. }
  5229. if (bhLeave > 0) { //Cant pickup
  5230. this.getActionSender().setString(this, + bhLeave +" Sec", 653, 11);
  5231. getActionSender().setInterfaceConfig(this, 653, 10, false);
  5232. getActionSender().setInterfaceConfig(this, 653, 9, false);
  5233. getActionSender().setInterfaceConfig(this, 653, 12, true);
  5234. }
  5235. if(bhPickup > 0) {
  5236. bhPickup--;
  5237. togglePrayer(10, 0);
  5238. this.getActionSender().setString(this, "Can't leave for:", 653, 10);
  5239. getActionSender().setInterfaceConfig(this, 653, 10, false);
  5240. }
  5241. if(bhLeave > 0) {
  5242. bhLeave--;
  5243. togglePrayer(10, 0);
  5244. this.getActionSender().setString(this, "Pickup penalty:", 653, 10);
  5245. getActionSender().setInterfaceConfig(this, 653, 10, false);
  5246. }
  5247. if (Engine.BountyHunter.highCrator.size() > 1 && getBhTarget) {
  5248. message("A target has been found.");
  5249. this.bhTarget = Engine.BountyHunter.getTargetHigh(this);
  5250. getBhTarget = false;
  5251. }
  5252. if(InBounty == 1 && !getBhTarget){
  5253. getActionSender().setHintIcon(this, 10, this.bhTarget, 1, -1);
  5254. if(p9 != null) {
  5255. this.getActionSender().setString(this, "" + p9.username , 653, 8);
  5256. } else {
  5257. this.getActionSender().setString(this, "None" , 653, 8);
  5258. getBhTarget = true;
  5259. }
  5260. }
  5261. }
  5262.  
  5263.  
  5264.  
  5265.  
  5266. public int wildernessLevels(int coordY) {
  5267. wildyLevel = (coordY - 3254 / 7);
  5268. if (wildyLevel < 1)
  5269. wildyLevel = 1;
  5270. return wildyLevel;
  5271. }
  5272.  
  5273. public boolean inEdge() {
  5274. return absX >= 3040 && absX <= 3125 && absY >= 3523 && absY <= 3551;
  5275. }
  5276.  
  5277.  
  5278. /**
  5279. * Dharok's equipment check.
  5280. */
  5281. public boolean fullDharok() {
  5282. return equipment[3] == 4718 && equipment[4] == 4720 && equipment[7] == 4722 && equipment[0] == 4716;
  5283. }
  5284.  
  5285. /**
  5286. * Verac's equipment check.
  5287. */
  5288. public boolean fullVerac() {
  5289. return equipment[3] == 4755 && equipment[4] == 4757 && equipment[7] == 4759 && equipment[0] == 4753;
  5290. }
  5291.  
  5292. /**
  5293. * Guthan equipment chck
  5294. */
  5295. public boolean hasGuthanEquipment() {
  5296. return equipment[3] == 4726 && equipment[4] == 4728 && equipment[7] == 4730 && equipment[0] == 4724;
  5297. }
  5298.  
  5299. /**
  5300. * Safezone.
  5301. */
  5302. public boolean inClan() {
  5303. return absX >= 3264 && absY >= 3672 && absX <= 3279 && absY <= 3695;
  5304. }
  5305.  
  5306.  
  5307.  
  5308. public int distanceToPoint(int pointX, int pointY) {
  5309. return (int) Math.sqrt(Math.pow(absX - pointX, 2) + Math.pow(absY - pointY, 2));
  5310. }
  5311.  
  5312. public boolean fullVoidKnightRange() {
  5313. return equipment[0] == 11675 && equipment[4] == 8839 && equipment[7] == 8840;
  5314. }
  5315.  
  5316. public boolean fullArmadyl() {
  5317. return equipment[0] == 11718 && equipment[4] == 11720 && equipment[7] == 11722;
  5318. }
  5319.  
  5320. public boolean saraChamber() {
  5321. return absX >= 2889 && absX <= 2907 && absY >= 5258 && absY <= 5276;
  5322. }
  5323.  
  5324. public boolean zammyChamber() {
  5325. return absX >= 2919 && absX <= 2935 && absY >= 5319 && absY <= 5330;
  5326. }
  5327.  
  5328. public boolean graardorChamber() {
  5329. return absX >= 2864 && absX <= 2876 && absY >= 5351 && absY <= 5369;
  5330. }
  5331.  
  5332. public boolean armadylChamber() {
  5333. return absX >= 2823 && absX <= 2843 && absY >= 5295 && absY <= 5310;
  5334. }
  5335.  
  5336. public boolean armadylChamber1() {
  5337. return absX >= 2825 && absX <= 2841 && absY >= 5297 && absY <= 5307;
  5338. }
  5339.  
  5340. public boolean inMageArena() {
  5341. return absX >= 3079 && absX <= 3126 && absY >= 3906 && absY <= 3951;
  5342. }
  5343.  
  5344. public boolean inDuelArena() {
  5345. return absX >= 3349 && absX <= 3388 && absY >= 3262 && absY <= 3280;
  5346. }
  5347.  
  5348. public boolean godWarsDung() {
  5349. return absX >= 2819 && absX <= 2946 && absY >= 5254 && absY <= 5362;
  5350. }
  5351.  
  5352. public boolean inJadCave() {
  5353. return absX >= 2375 && absX <= 2425 && absY >= 5128 && absY <= 5169;
  5354. }
  5355.  
  5356. public ActionSender getActionSender() {
  5357. return Engine.actionSender;
  5358. }
  5359.  
  5360.  
  5361. public TestWorldLoader getWorldLoader() {
  5362. return worldLoader;
  5363. }
  5364.  
  5365. public ByteVector getByteVector() {
  5366. return stream;
  5367. }
  5368.  
  5369. public boolean duelFight() {
  5370. return absX >= 3361 && absX <= 3392 && absY >= 3223 && absY <= 3241;
  5371. }
  5372.  
  5373. public boolean slayerTower() {
  5374. return absX >= 3402 && absX <= 3458 && absY >= 3529 && absY <= 3581;
  5375. }
  5376.  
  5377. public void appendPotion() {
  5378. if (explodeDelay == 0) {
  5379. if (explodeType == 1) {
  5380. appendHit(25, 0);
  5381. requestForceChat("Ow!");
  5382. getActionSender().sendMessage(this, "The unidentified liquid potion exploded!");
  5383. }
  5384. explodeType = 0;
  5385. explodeDelay = -1;
  5386. }
  5387. }
  5388.  
  5389. public boolean castleLobby() {
  5390. return absX >= 2435 && absX <= 2449 && absY >= 3079 && absY <= 3099;
  5391. }
  5392.  
  5393. public boolean castleArea() {
  5394. return absX >= 2358 && absX <= 2438 && absY >= 3066 && absY <= 3142;
  5395. }
  5396.  
  5397. public boolean correctDistance(int j, int k, int l, int i1, int j1)
  5398. {
  5399. for(int k1 = 0; k1 <= j1; k1++)
  5400. {
  5401. for(int l1 = 0; l1 <= j1; l1++)
  5402. {
  5403. if(j + k1 == l && (k + l1 == i1 || k - l1 == i1 || k == i1))
  5404. return true;
  5405. if(j - k1 == l && (k + l1 == i1 || k - l1 == i1 || k == i1))
  5406. return true;
  5407. if(j == l && (k + l1 == i1 || k - l1 == i1 || k == i1))
  5408. return true;
  5409. }
  5410.  
  5411. }
  5412.  
  5413. return false;
  5414. }
  5415.  
  5416. public int getLoginSpecial() {
  5417. if (specAmount <= 0) {
  5418. return 0;
  5419. } else {
  5420. return specAmount;
  5421. }
  5422. }
  5423.  
  5424. public int getLoginSpellbook() {
  5425. if (spellbook <= 0) {
  5426. return 192;
  5427. } else {
  5428. return spellbook;
  5429. }
  5430. }
  5431.  
  5432. /**
  5433. * Edgeville 1 V 1
  5434. */
  5435. public boolean inEdgePk() {
  5436. return absX >= 3040 && absX <= 3118 && absY >= 3522 && absY <= 3553;
  5437. }
  5438.  
  5439. /**
  5440. * Checking if combat level difference is correct for attacking in wild.
  5441. */
  5442. public boolean combatDifference(int cbLvl) {
  5443. return wildLevel >= combatLevel && combatLevel + cbLvl >= wildLevel || cbLvl < combatLevel && combatLevel - wildLevel <= cbLvl || cbLvl == combatLevel;
  5444. }
  5445.  
  5446. public String getMessageString(int economyId) {
  5447. switch (economyId) {
  5448.  
  5449. case 4153:
  5450. return "Granite mauls are now disabled, Please kill Gargoyles in the Slayer tower.";
  5451.  
  5452. case 4151:
  5453. case 11235:
  5454. return "Abyssal whips and Dark bows are disabled, Please go to Slayer tower.";
  5455.  
  5456. case 2440:
  5457. case 2434:
  5458. case 6685:
  5459. return "You cannot spawn the super strength potion, Prayer potion and Brews anymore, Please steal potions from the stalls at home.";
  5460.  
  5461. case 385:
  5462. case 391:
  5463. return "You cannot spawn food anymore, Please steal food from the stalls at home.";
  5464.  
  5465. case 10581:
  5466. return "Please go to the Slayer Tower for a Keris dagger.";
  5467.  
  5468. case 11690:
  5469. case 11702:
  5470. case 11704:
  5471. case 11706:
  5472. case 11708:
  5473. return "You can only get a God hilt or Godsword blade by Defeating the Generals of the Gods in the God wars Dungeon.";
  5474.  
  5475. case 11718:
  5476. case 11720:
  5477. case 11722:
  5478. case 12670:
  5479. case 12671:
  5480. return "You can only get a piece of Armadyl armour by Visitting Armadyl's Eyrie in the Godwars dungeon.";
  5481.  
  5482. case 11724:
  5483. case 11726:
  5484. case 11728:
  5485. return "You can only get a piece of Bandos armour by Visitting Bandos's Stronghold in the Godwars dungeon.";
  5486.  
  5487. case 3140:
  5488. return "You can only get a Dragon chainbody by Killing the Kalphite Queen in her Kalphite Lair.";
  5489.  
  5490. case 6570:
  5491. case 10566:
  5492. case 10637:
  5493. return "Please visit The fight cave for a Fire cape.";
  5494.  
  5495. case 11694:
  5496. case 11696:
  5497. case 11698:
  5498. case 11700:
  5499. return "Please visit the Godwars dungeon to get this item.";
  5500.  
  5501. default:
  5502. return "";
  5503. }
  5504. }
  5505.  
  5506.  
  5507. /**
  5508. * Zammys part of god wars area check boolean
  5509. */
  5510. public boolean addZamorakCheckEventGodWars() {
  5511. return absX >= 2879 && absX <= 2945 && absY >= 5342 && absY <= 5364;
  5512. }
  5513.  
  5514. /**
  5515. * Update the player.
  5516. */
  5517. public void updatePlayer(boolean updateIsNeccesary) {
  5518. appearanceUpdateReq = updateReq = updateIsNeccesary;
  5519. }
  5520.  
  5521. public int getX() {
  5522. return absX;
  5523. }
  5524.  
  5525. public int getY() {
  5526. return absY;
  5527. }
  5528.  
  5529. public int getHeight() {
  5530. return heightLevel;
  5531. }
  5532.  
  5533. public int getPlayerId() {
  5534. return playerId;
  5535. }
  5536.  
  5537. public void convertPlayerToNpc(int npcType) {
  5538. this.npcType = npcType;
  5539. }
  5540.  
  5541. public void updatePlayerAppearance(int walkAnim, int standAnim, int runAnim) {
  5542. standEmote = standAnim;
  5543. walkEmote = walkAnim;
  5544. runEmote = runAnim;
  5545. }
  5546.  
  5547. public void appendToIPBanned(Player player) {
  5548. BufferedWriter bw = null;
  5549. try {
  5550. bw = new BufferedWriter(new FileWriter("./data/banned/bannedhosts.dat", true));
  5551. bw.write(Server.socketListener.getAddress(player.socket.socket));
  5552. bw.newLine();
  5553. bw.flush();
  5554. Server.socketListener.loadBannedHosts();
  5555. player.disconnected[0] = true;
  5556. player.disconnected[1] = true;
  5557. } catch (IOException ioe) {
  5558. } finally {
  5559. if (bw != null) {
  5560. try {
  5561. bw.close();
  5562. } catch (IOException ioe2) {
  5563. }
  5564. }
  5565. }
  5566. }
  5567. public void appendToBanned(String player) {
  5568. BufferedWriter bw = null;
  5569. try {
  5570. bw = new BufferedWriter(new FileWriter("./data/banned/bannedusers.dat", true));
  5571. bw.write(player);
  5572. bw.newLine();
  5573. bw.flush();
  5574. Server.loadBannedUsers();
  5575. } catch (IOException ioe) {
  5576. } finally {
  5577. if (bw != null) {
  5578. try {
  5579. bw.close();
  5580. } catch (IOException ioe2) {
  5581. }
  5582. }
  5583. }
  5584. }
  5585.  
  5586. public void UnBanPlayer(String Player) {
  5587. String Directory = "./data/banned/bannedusers.dat";
  5588. String MaxBan[] = new String[1000];
  5589. String UserThatBan = new String();
  5590. int Ban = 0;
  5591. try {
  5592. BufferedReader dataStream = new BufferedReader(new FileReader("./data/banned/bannedusers.dat"));
  5593. while ((UserThatBan = dataStream.readLine()) != null) {
  5594. if(UserThatBan.equalsIgnoreCase(Player)) {
  5595. } else
  5596. if(!UserThatBan.equalsIgnoreCase(Player)) {
  5597. MaxBan[Ban] = UserThatBan;
  5598. Ban++;
  5599. }
  5600. }
  5601. } catch(Exception e) {
  5602. e.printStackTrace();
  5603. }
  5604. BufferedWriter bw = null;
  5605. try {
  5606. bw = new BufferedWriter(new FileWriter(Directory, false));
  5607. bw.write("");
  5608. bw.flush();
  5609. bw.close();
  5610. } catch(Exception e) {
  5611. e.printStackTrace();
  5612. }
  5613. try {
  5614. bw = new BufferedWriter(new FileWriter("./data/banned/bannedusers.dat", true));
  5615. for(int a = 0; a < MaxBan.length; a++) {
  5616. if(MaxBan[a] != null) {
  5617. bw.write(MaxBan[a]);
  5618. bw.newLine();
  5619. bw.flush();
  5620. }
  5621. }
  5622. bw.close();
  5623. } catch(Exception e) {
  5624. e.printStackTrace();
  5625. }
  5626. Server.loadBannedUsers();
  5627. }
  5628.  
  5629. public boolean nonMultiPlace() {
  5630. return absX >= 3400 && absX <= 3457 && absY >= 3527 && absY <= 3579 && heightLevel == 2;
  5631. }
  5632.  
  5633. public int neededSpecialAmount() {
  5634. switch (equipment[3]) {
  5635. case 1215:
  5636. case 1231:
  5637. case 5680:
  5638. case 5698:
  5639. case 1305:
  5640. case 1434:
  5641. return 250;
  5642. case 10887:
  5643. case 11694:
  5644. case 11698:
  5645. case 4151:
  5646. return 500;
  5647. case 11235:
  5648. return 550;
  5649. case 11700:
  5650. return 600;
  5651. case 11696:
  5652. case 11730:
  5653. return 1000;
  5654. default:
  5655. return 0;
  5656. }
  5657. }
  5658.  
  5659. public int weaponType;
  5660.  
  5661. public int attackStyle() {
  5662.  
  5663. /*
  5664. * Melee weapon styles
  5665. * 1 : accurate
  5666. * 2 : agressive
  5667. * 3 : defensive
  5668. * 4 : controlled
  5669. *
  5670. * Ranged weapon styles
  5671. * 5 : accurate
  5672. * 6 : rapid
  5673. * 7 : longrange
  5674. */
  5675.  
  5676. switch (weaponType) {
  5677. case 0: return fightStyle;
  5678. case 1: return fightStyle;
  5679. case 2:
  5680. if (fightStyle == 1) {
  5681. return 1;
  5682. }
  5683. if (fightStyle == 3) {
  5684. return 2;
  5685. }
  5686. if (fightStyle == 2) {
  5687. return 3;
  5688. }
  5689. case 3:
  5690. if (fightStyle == 1) {
  5691. return 1;
  5692. }
  5693. if (fightStyle == 2) {
  5694. return 2;
  5695. }
  5696. if (fightStyle == 3) {
  5697. return 4;
  5698. }
  5699. if (fightStyle == 4) {
  5700. return 3;
  5701. }
  5702. case 4:
  5703. if (fightStyle == 1) {
  5704. return 5;
  5705. }
  5706. if (fightStyle == 3) {
  5707. return 6;
  5708. }
  5709. if (fightStyle == 2) {
  5710. return 7;
  5711. }
  5712. case 5: break;
  5713. case 6: return fightStyle;
  5714. case 7:
  5715. if (fightStyle == 1) {
  5716. return 1;
  5717. }
  5718. if (fightStyle == 2 || fightStyle == 3) {
  5719. return 2;
  5720. }
  5721. if (fightStyle == 4) {
  5722. return 3;
  5723. }
  5724. case 8:
  5725. if (fightStyle == 1) {
  5726. return 1;
  5727. }
  5728. if (fightStyle == 4 || fightStyle == 3) {
  5729. return 2;
  5730. }
  5731. if (fightStyle == 2) {
  5732. return 3;
  5733. }
  5734. case 9:
  5735. if (fightStyle == 1) {
  5736. return 4;
  5737. }
  5738. if (fightStyle == 2) {
  5739. return 2;
  5740. }
  5741. if (fightStyle == 3) {
  5742. return 3;
  5743. }
  5744. case 10:
  5745. if (fightStyle == 1) {
  5746. return 1;
  5747. }
  5748. if (fightStyle == 2) {
  5749. return 2;
  5750. }
  5751. if (fightStyle == 3) {
  5752. return 4;
  5753. }
  5754. if (fightStyle == 4) {
  5755. return 3;
  5756. }
  5757. case 11:
  5758. if (fightStyle == 1) {
  5759. return 1;
  5760. }
  5761. if (fightStyle == 4) {
  5762. return 2;
  5763. }
  5764. if (fightStyle == 3) {
  5765. return 4;
  5766. }
  5767. if (fightStyle == 2) {
  5768. return 3;
  5769. }
  5770. case 12:
  5771. if (fightStyle == 1 || fightStyle == 2) {
  5772. return fightStyle;
  5773. }
  5774. if (fightStyle == 3) {
  5775. return 4;
  5776. }
  5777. if (fightStyle == 4) {
  5778. return 3;
  5779. }
  5780. }
  5781. return 8;
  5782. }
  5783.  
  5784. public int weaponStyle(int weaponID) {
  5785. switch (weaponID) {
  5786. case 4151: return 2;
  5787. case 4153: return 3;
  5788. case 1277:
  5789. case 1279:
  5790. case 1281:
  5791. case 1283:
  5792. case 1285:
  5793. case 1287:
  5794. case 1289:
  5795. case 1291:
  5796. case 1293:
  5797. case 1295:
  5798. case 1297:
  5799. case 1299:
  5800. case 1301:
  5801. case 1303:
  5802. case 1305:
  5803. case 1329:
  5804. case 1331:
  5805. case 1337:
  5806. case 4587:
  5807. if (fightStyle != 3) {
  5808. return 2;
  5809. } else {
  5810. return 1;
  5811. }
  5812. case 1434:
  5813. case 4755:
  5814. case 10887:
  5815. if (fightStyle != 3) {
  5816. return 3;
  5817. } else {
  5818. return 1;
  5819. }
  5820. case 1215:
  5821. case 1231:
  5822. case 5680:
  5823. case 5698:
  5824. if (fightStyle != 3) {
  5825. return 1;
  5826. } else {
  5827. return 2;
  5828. }
  5829. case 1307:
  5830. case 1309:
  5831. case 1311:
  5832. case 1313:
  5833. case 1315:
  5834. case 1317:
  5835. case 1319:
  5836. case 1349:
  5837. case 1351:
  5838. case 1353:
  5839. case 1355:
  5840. case 1357:
  5841. case 1359:
  5842. case 1361:
  5843. case 1363:
  5844. case 1365:
  5845. case 1367:
  5846. case 1369:
  5847. case 1371:
  5848. case 1373:
  5849. case 1375:
  5850. case 1377:
  5851. case 4718:
  5852. case 6739:
  5853. case 7158:
  5854. case 11694:
  5855. case 11696:
  5856. case 11698:
  5857. case 11700:
  5858. case 11730:
  5859. if (fightStyle != 3) {
  5860. return 2;
  5861. } else {
  5862. return 3;
  5863. }
  5864. }
  5865. return 1;
  5866. }
  5867.  
  5868. public int getAttackSound() {
  5869. String weapon = Engine.items.getItemName(equipment[3]);
  5870. if (weapon.equals("Abyssal whip")) {
  5871. return 2720;
  5872. }
  5873. if (weapon.contains("godsword") || weapon.equals("Saradomin sword")) {
  5874. switch (fightStyle) {
  5875. case 1:
  5876. case 2:
  5877. case 4: return 3846;
  5878. case 3: return 3882;
  5879. }
  5880. }
  5881. if (weapon.equals("Granite maul")) {
  5882. return 2714;
  5883. }
  5884. return -1;
  5885. }
  5886.  
  5887. public int getSpecialAttackSound() {
  5888. return -1;
  5889. }
  5890.  
  5891. public boolean clanWarsFightArea() {
  5892. return absX >= 3263 && absX <= 3327 && absY >= 3713 && absY <= 3840;
  5893. }
  5894.  
  5895. /**
  5896. * Prepare player for removal.
  5897. */
  5898. public void destruct() {
  5899. stream = null;
  5900. try {
  5901. if (InBounty == 1) {
  5902. Engine.BountyHunter.removeHigh(this);
  5903. Engine.BountyHunter.exit(this, 3);
  5904. Engine.BountyHunter.exit(this, 2);
  5905. Engine.BountyHunter.exit(this, 1);
  5906. }
  5907. Server.socketListener.connectionsList.remove(Server.socketListener.getAddress(this.socket.socket));
  5908. socket.input.close();
  5909. socket.output.close();
  5910. socket.socket.close();
  5911. } catch (Exception e) {
  5912. }
  5913. long me = Misc.stringToLong(username);
  5914. for(Player p : Engine.players) {
  5915. if(p == null) continue;
  5916. if(p.friends.contains(me)) {
  5917. p.getActionSender().sendFriend(p, me, 0);
  5918. }
  5919. }
  5920. socket.input = null;
  5921. socket.output = null;
  5922. socket.socket = null;
  5923. socket = null;
  5924. absX = absY = mapRegionX = mapRegionY = -1;
  5925. }
  5926. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement