Advertisement
Guest User

Untitled

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