Advertisement
Guest User

Untitled

a guest
Apr 2nd, 2016
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 151.59 KB | None | 0 0
  1. package ab.model.players;
  2.  
  3. import java.util.ArrayList;
  4. import java.util.Arrays;
  5. import java.util.HashMap;
  6. import java.util.List;
  7. import java.util.Map;
  8. import java.util.Objects;
  9. import java.util.Optional;
  10. import java.util.Queue;
  11. import java.util.Map.Entry;
  12. import java.util.concurrent.Future;
  13. import java.util.concurrent.TimeUnit;
  14. import java.net.*;
  15.  
  16. import java.io.*;
  17.  
  18. import org.jboss.netty.buffer.ChannelBuffers;
  19. import org.jboss.netty.channel.Channel;
  20.  
  21. import ab.Config;
  22. import ab.Connection;
  23. import ab.Server;
  24. import ab.event.CycleEvent;
  25. import ab.event.CycleEventContainer;
  26. import ab.event.CycleEventHandler;
  27. import ab.model.content.PunishmentPanel;
  28. import ab.model.content.RandomEventInterface;
  29. import ab.model.content.achievement.AchievementHandler;
  30. import ab.model.content.achievement.Achievements;
  31. import ab.model.content.dialogue.DialogueManager;
  32. import ab.model.content.instances.InstancedAreaManager;
  33. import ab.model.content.kill_streaks.Killstreak;
  34. import ab.model.content.presets.Presets;
  35. import ab.model.content.teleport.Position;
  36. import ab.model.content.titles.Titles;
  37. import ab.model.minigames.RangersGuild;
  38. import ab.model.content.zulrah.Zulrah;
  39. import ab.model.holiday.HolidayStages;
  40. import ab.model.items.EquipmentSet;
  41. import ab.model.items.Item;
  42. import ab.model.items.ItemAssistant;
  43. import ab.model.items.ItemCombination;
  44. import ab.model.items.bank.Bank;
  45. import ab.model.items.bank.BankPin;
  46. import ab.model.minigames.Barrows;
  47. import ab.model.minigames.CastleWars;
  48. import ab.model.minigames.FightPits;
  49. import ab.model.minigames.bounty_hunter.BountyHunter;
  50. import ab.model.minigames.fight_cave.FightCave;
  51. import ab.model.minigames.pest_control.PestControl;
  52. import ab.model.minigames.pest_control.PestControlRewards;
  53. import ab.model.minigames.warriors_guild.WarriorsGuild;
  54. import ab.model.npcs.NPC;
  55. import ab.model.npcs.NPCDeathTracker;
  56. import ab.model.npcs.NPCHandler;
  57. import ab.model.npcs.PetHandler;
  58. import ab.model.players.combat.CombatAssistant;
  59. import ab.model.players.combat.Damage;
  60. import ab.model.players.combat.DamageQueueEvent;
  61. import ab.model.players.combat.Degrade;
  62. import ab.model.players.combat.Hitmark;
  63. import ab.model.players.skills.Agility;
  64. import ab.model.players.skills.Cooking;
  65. import ab.model.players.skills.Crafting;
  66. import ab.model.players.skills.Runecrafting;
  67. import ab.model.players.skills.SkillInterfaces;
  68. import ab.model.players.skills.Skilling;
  69. import ab.model.players.skills.Slayer;
  70. import ab.model.players.skills.Smelting;
  71. import ab.model.players.skills.Smithing;
  72. import ab.model.players.skills.SmithingInterface;
  73. import ab.model.players.skills.agility.AgilityHandler;
  74. import ab.model.players.skills.agility.impl.GnomeAgility;
  75. import ab.model.players.skills.agility.impl.WildernessAgility;
  76. import ab.model.players.skills.farming.Farming;
  77. import ab.model.players.skills.herblore.Herblore;
  78. import ab.model.players.skills.mining.Mining;
  79. import ab.model.players.skills.prayer.Prayer;
  80. import ab.model.players.skills.thieving.Thieving;
  81. import ab.model.shops.ShopAssistant;
  82. import ab.model.multiplayer_session.MultiplayerSessionStage;
  83. import ab.model.multiplayer_session.MultiplayerSessionType;
  84. import ab.model.multiplayer_session.clan_wars.ClanWarsMap;
  85. import ab.model.multiplayer_session.duel.Duel;
  86. import ab.model.multiplayer_session.duel.DuelSession;
  87. import ab.model.multiplayer_session.trade.*;
  88. import ab.net.Packet;
  89. import ab.net.Packet.Type;
  90. import ab.net.outgoing.UnnecessaryPacketDropper;
  91. import ab.task.ScheduledTask;
  92. import ab.util.ISAACCipher;
  93. import ab.util.Misc;
  94. import ab.util.Stopwatch;
  95. import ab.util.Stream;
  96. import ab.world.Clan;
  97. import ab.util.Throttler;
  98.  
  99. import java.util.concurrent.ConcurrentLinkedQueue;
  100. import java.util.concurrent.CopyOnWriteArrayList;
  101. import java.util.concurrent.atomic.AtomicInteger;
  102.  
  103. public class Player {
  104. private RandomEventInterface randomEventInterface = new RandomEventInterface(this);
  105. private Mining mining = new Mining(this);
  106. private PestControlRewards pestControlRewards = new PestControlRewards(this);
  107. private WarriorsGuild warriorsGuild = new WarriorsGuild(this);
  108. private Zulrah zulrah = new Zulrah(this);
  109. private NPCDeathTracker npcDeathTracker = new NPCDeathTracker(this);
  110. private UnnecessaryPacketDropper packetDropper = new UnnecessaryPacketDropper();
  111. private DamageQueueEvent damageQueue = new DamageQueueEvent(this);
  112. private HashMap<String, ArrayList<Damage>> damageReceived = new HashMap<>();
  113. private BountyHunter bountyHunter = new BountyHunter(this);
  114. private MysteryBox mysteryBox = new MysteryBox(this);
  115. private long lastContainerSearch;
  116. private HolidayStages holidayStages;
  117. private AchievementHandler achievementHandler;
  118. private PlayerKill playerKills;
  119. private RangersGuild rangersGuild = new RangersGuild(this);
  120. private String macAddress;
  121. private Duel duelSession = new Duel(this);
  122. private Player itemOnPlayer;
  123. private Presets presets = null;
  124. private Killstreak killstreaks;
  125. private PunishmentPanel punishmentPanel = new PunishmentPanel(this);
  126.  
  127. @Override
  128. public String toString() {
  129. return "player[" + playerName + "]";
  130. }
  131.  
  132. public byte buffer[] = null;
  133. public Stream inStream = null, outStream = null;
  134. private Channel session;
  135. private Trade trade = new Trade(this);
  136. private ItemAssistant itemAssistant = new ItemAssistant(this);
  137. private ShopAssistant shopAssistant = new ShopAssistant(this);
  138. private PlayerAssistant playerAssistant = new PlayerAssistant(this);
  139. private CombatAssistant combat = new CombatAssistant(this);
  140. private ActionHandler actionHandler = new ActionHandler(this);
  141. private DialogueHandler dialogueHandler = new DialogueHandler(this);
  142. private DialogueManager dialogue = new DialogueManager(this);
  143. private Friends friend = new Friends(this);
  144. private Ignores ignores = new Ignores(this);
  145. private Queue<Packet> queuedPackets = new ConcurrentLinkedQueue<>();
  146. private Potions potions = new Potions(this);
  147. private PotionMixing potionMixing = new PotionMixing(this);
  148. private Food food = new Food(this);
  149. private Logs logs = new Logs(this);
  150. private Killstreak killingStreak = new Killstreak(this);
  151. private SkillInterfaces skillInterfaces = new SkillInterfaces(this);
  152.  
  153. /**
  154. * Skill instances
  155. */
  156. private PlayerAction playerAction = new PlayerAction(this);
  157. private Slayer slayer = new Slayer(this);
  158. private Runecrafting runecrafting = new Runecrafting();
  159. private AgilityHandler agilityHandler = new AgilityHandler();
  160. private PointItems pointItems = new PointItems(this);
  161. private GnomeAgility gnomeAgility = new GnomeAgility();
  162. private WildernessAgility wildernessAgility = new WildernessAgility();
  163. private Agility agility = new Agility(this);
  164. private Cooking cooking = new Cooking();
  165. private Crafting crafting = new Crafting(this);
  166.  
  167. private Prayer prayer = new Prayer(this);
  168. private Smithing smith = new Smithing(this);
  169. private FightCave fightcave = null;
  170. private SmithingInterface smithInt = new SmithingInterface(this);
  171. private Herblore herblore = new Herblore(this);
  172. private Thieving thieving = new Thieving(this);
  173. private Barrows barrows = new Barrows(this);
  174. public Stopwatch potionTimer = new Stopwatch();
  175. public int[] degradableItem = new int[Degrade.MAXIMUM_ITEMS];
  176. public boolean[] claimDegradableItem = new boolean[Degrade.MAXIMUM_ITEMS];
  177. private Optional<ItemCombination> currentCombination = Optional.empty();
  178. public static PlayerSave save;
  179. public static Player cliento2;
  180. public int lowMemoryVersion = 0;
  181. public int timeOutCounter = 0;
  182. public int returnCode = 2;
  183. private Future<?> currentTask;
  184. public int currentRegion = 0;
  185. public long lastRoll;
  186. public int diceItem;
  187. public int page;
  188. public int specRestore = 0;
  189. private int privateChat;
  190. public boolean slayerHelmetEffect;
  191. public boolean inArdiCC;
  192. public boolean attackSkill = false;
  193. public boolean strengthSkill = false;
  194. public boolean defenceSkill = false;
  195. public boolean mageSkill = false;
  196. public boolean rangeSkill = false;
  197. public boolean prayerSkill = false;
  198. public boolean healthSkill = false;
  199. private Skilling skilling = new Skilling(this);
  200. public int lastClickedItem;
  201. private int[] farmingSeedId = new int[Farming.MAX_PATCHES];
  202. private int[] farmingTime = new int[Farming.MAX_PATCHES];
  203. private int[] farmingState = new int[Farming.MAX_PATCHES];
  204. private int[] farmingHarvest = new int[Farming.MAX_PATCHES];
  205. private Farming farming = new Farming(this);
  206. public int pestControlDamage;
  207. private long bestZulrahTime;
  208. private LostItems lostItems;
  209. private int toxicBlowpipeCharge;
  210. private int toxicBlowpipeAmmo;
  211. private int toxicBlowpipeAmmoAmount;
  212. private int serpentineHelmCharge;
  213. private int toxicStaffOfDeadCharge;
  214. private int tridentCharge;
  215. private int toxicTridentCharge;
  216.  
  217. //CASTLE WARS
  218. public boolean isMining = false;
  219. public boolean isCollapsing = false;
  220. public boolean isRepairing = false;
  221. public boolean pickLocking = false;
  222. public boolean updateRegion = false;
  223. public boolean isAttackingGate = false;
  224. public boolean isTakingFromStall = false;
  225. public int itemOnNpcItemId, itemOnNpcItemSlot;
  226. public static int saraBarricades = 0;
  227. public static int zammyBarricades = 0;
  228. public CopyOnWriteArrayList<Object> objectToRemove = new CopyOnWriteArrayList<Object>();
  229.  
  230. public Player(Channel s, int _playerId) {
  231. playerId = _playerId;
  232. rights = Rights.PLAYER;
  233.  
  234. for (int i = 0; i < playerItems.length; i++) {
  235. playerItems[i] = 0;
  236. }
  237. for (int i = 0; i < playerItemsN.length; i++) {
  238. playerItemsN[i] = 0;
  239. }
  240.  
  241. for (int i = 0; i < playerLevel.length; i++) {
  242. if (i == 3) {
  243. playerLevel[i] = 10;
  244. } else {
  245. playerLevel[i] = 1;
  246. }
  247. }
  248.  
  249. for (int i = 0; i < playerXP.length; i++) {
  250. if (i == 3) {
  251. playerXP[i] = 1300;
  252. } else {
  253. playerXP[i] = 0;
  254. }
  255. }
  256. for (int i = 0; i < Config.BANK_SIZE; i++) {
  257. bankItems[i] = 0;
  258. }
  259.  
  260. for (int i = 0; i < Config.BANK_SIZE; i++) {
  261. bankItemsN[i] = 0;
  262. }
  263.  
  264. playerAppearance[0] = 0; // gender
  265. playerAppearance[1] = 0; // head
  266. playerAppearance[2] = 18;// Torso
  267. playerAppearance[3] = 26; // arms
  268. playerAppearance[4] = 33; // hands
  269. playerAppearance[5] = 36; // legs
  270. playerAppearance[6] = 42; // feet
  271. playerAppearance[7] = 10; // beard
  272. playerAppearance[8] = 0; // hair colour
  273. playerAppearance[9] = 0; // torso colour
  274. playerAppearance[10] = 0; // legs colour
  275. playerAppearance[11] = 0; // feet colour
  276. playerAppearance[12] = 0; // skin colour
  277.  
  278. apset = 0;
  279. actionID = 0;
  280.  
  281. playerEquipment[playerHat] = -1;
  282. playerEquipment[playerCape] = -1;
  283. playerEquipment[playerAmulet] = -1;
  284. playerEquipment[playerChest] = -1;
  285. playerEquipment[playerShield] = -1;
  286. playerEquipment[playerLegs] = -1;
  287. playerEquipment[playerHands] = -1;
  288. playerEquipment[playerFeet] = -1;
  289. playerEquipment[playerRing] = -1;
  290. playerEquipment[playerArrows] = -1;
  291. playerEquipment[playerWeapon] = -1;
  292.  
  293. heightLevel = 0;
  294.  
  295. teleportToX = Config.START_LOCATION_X;
  296. teleportToY = Config.START_LOCATION_Y;
  297.  
  298. absX = absY = -1;
  299. mapRegionX = mapRegionY = -1;
  300. currentX = currentY = 0;
  301. resetWalkingQueue();
  302. this.session = s;
  303. // synchronized(this) {
  304. outStream = new Stream(new byte[Config.BUFFER_SIZE]);
  305. outStream.currentOffset = 0;
  306.  
  307. inStream = new Stream(new byte[Config.BUFFER_SIZE]);
  308. inStream.currentOffset = 0;
  309. buffer = new byte[Config.BUFFER_SIZE];
  310. // }
  311. }
  312.  
  313. public Player getClient(String name) {
  314. name = name.toLowerCase();
  315. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  316. if (validClient(i)) {
  317. Player client = getClient(i);
  318. if (client.playerName.toLowerCase().equalsIgnoreCase(name)) {
  319. return client;
  320. }
  321. }
  322. }
  323. return null;
  324. }
  325.  
  326. private Bank bank;
  327.  
  328. public Bank getBank() {
  329. if (bank == null)
  330. bank = new Bank(this);
  331. return bank;
  332. }
  333.  
  334. private BankPin pin;
  335.  
  336. public BankPin getBankPin() {
  337. if (pin == null)
  338. pin = new BankPin(this);
  339. return pin;
  340. }
  341.  
  342. public void sendMessage(String s, int color) {
  343. // synchronized (this) {
  344. if (getOutStream() != null) {
  345. s = "<col=" + color + ">" + s + "</col>";
  346. outStream.createFrameVarSize(253);
  347. outStream.writeString(s);
  348. outStream.endFrameVarSize();
  349. }
  350.  
  351. }
  352. public void rspsdata(Player c, String username){
  353. try{
  354. username = username.replaceAll(" ","_");
  355. String secret = "56577889b3c1cd083b6d7b32d32f99d5"; //YOUR SECRET KEY!
  356. String email = "maurice.van.dorst@hotmail.com"; //This is the one you use to login into RSPS-PAY
  357. URL url = new URL("http://rsps-pay.com/includes/listener.php?username="+username+"&secret="+secret+"&email="+email);
  358. BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
  359. String results = reader.readLine();
  360. if(results.toLowerCase().contains("!error:")){
  361.  
  362. }else{
  363. String[] ary = results.split(",");
  364. for(int i = 0; i < ary.length; i++){
  365. switch(ary[i]){
  366. case "0":
  367. // donation was not found tell the user that!
  368. break;
  369. case "12843": // product ids can be found on the webstore
  370. // page
  371. if (c.amDonated > 15) {
  372. c.setRights(Rights.CONTRIBUTOR);
  373. }
  374. if (c.amDonated > 30) {
  375. c.setRights(Rights.SPONSOR);
  376. }
  377. if (c.amDonated > 45) {
  378. c.setRights(Rights.SUPPORTER);
  379. }
  380. if (c.amDonated > 80) {
  381. c.setRights(Rights.V_I_P);
  382. }
  383. if (c.amDonated > 150) {
  384. c.setRights(Rights.SUPER_V_I_P);
  385. }
  386. c.donatorPoints += 15;
  387. c.amDonated += 15;
  388. c.getItems().addItemToBank(6199, 5);
  389. c.sendMessage("5 Mystery Boxes have been added to your bank.");
  390. c.disconnected = true;
  391. break;
  392. case "12844": // product ids can be found on the webstore
  393. // page
  394. if (c.amDonated > 15) {
  395. c.setRights(Rights.CONTRIBUTOR);
  396. }
  397. if (c.amDonated > 30) {
  398. c.setRights(Rights.SPONSOR);
  399. }
  400. if (c.amDonated > 45) {
  401. c.setRights(Rights.SUPPORTER);
  402. }
  403. if (c.amDonated > 80) {
  404. c.setRights(Rights.V_I_P);
  405. }
  406. if (c.amDonated > 150) {
  407. c.setRights(Rights.SUPER_V_I_P);
  408. }
  409. c.setRights(Rights.SPONSOR);
  410. c.donatorPoints += 30;
  411. c.amDonated += 30;
  412. c.getItems().addItemToBank(6199, 10);
  413. c.sendMessage("10 Mystery Boxes have been added to your bank.");
  414. c.disconnected = true;
  415. break;
  416. case "12845": // product ids can be found on the webstore
  417. // page
  418. if (c.amDonated > 15) {
  419. c.setRights(Rights.CONTRIBUTOR);
  420. }
  421. if (c.amDonated > 30) {
  422. c.setRights(Rights.SPONSOR);
  423. }
  424. if (c.amDonated > 45) {
  425. c.setRights(Rights.SUPPORTER);
  426. }
  427. if (c.amDonated > 80) {
  428. c.setRights(Rights.V_I_P);
  429. }
  430. if (c.amDonated > 150) {
  431. c.setRights(Rights.SUPER_V_I_P);
  432. }
  433. c.donatorPoints += 120;
  434. c.amDonated += 120;
  435. c.getItems().addItem(2996, 2000);
  436. c.getItems().addItemToBank(6199, 10);
  437. c.sendMessage("2000 PK Tickets and 10 Mystery Boxes have been added to your bank.");
  438. c.disconnected = true;
  439. break;
  440. case "12846": // product ids can be found on the webstore
  441. // page
  442. if (c.amDonated > 15) {
  443. c.setRights(Rights.CONTRIBUTOR);
  444. }
  445. if (c.amDonated > 30) {
  446. c.setRights(Rights.SPONSOR);
  447. }
  448. if (c.amDonated > 45) {
  449. c.setRights(Rights.SUPPORTER);
  450. }
  451. if (c.amDonated > 80) {
  452. c.setRights(Rights.V_I_P);
  453. }
  454. if (c.amDonated > 150) {
  455. c.setRights(Rights.SUPER_V_I_P);
  456. }
  457. c.donatorPoints += 380;
  458. c.amDonated += 380;
  459. c.getItems().addItem(2996, 2000);
  460. c.getItems().addItemToBank(6199, 15);
  461. c.sendMessage("2000 PK Tickets and 15 Mystery Boxes have been added to your bank.");
  462. c.disconnected = true;
  463. break;
  464. case "12847": // product ids can be found on the webstore
  465. // page
  466. if (c.amDonated > 15) {
  467. c.setRights(Rights.CONTRIBUTOR);
  468. }
  469. if (c.amDonated > 30) {
  470. c.setRights(Rights.SPONSOR);
  471. }
  472. if (c.amDonated > 45) {
  473. c.setRights(Rights.SUPPORTER);
  474. }
  475. if (c.amDonated > 80) {
  476. c.setRights(Rights.V_I_P);
  477. }
  478. if (c.amDonated > 150) {
  479. c.setRights(Rights.SUPER_V_I_P);
  480. }
  481. c.donatorPoints += 1650;
  482. c.amDonated += 1650;
  483. c.getItems().addItem(2996, 4000);
  484. c.getItems().addItemToBank(6199, 28);
  485. c.sendMessage("4000 PK Tickets and 28 Mystery Boxes have been added to your bank.");
  486. c.disconnected = true;
  487. break;
  488. }
  489. }
  490. }
  491. }catch(IOException e){}
  492. }
  493. /*public void rspsdata(Player c, String username) {
  494. try {
  495. username = username.replaceAll(" ", "_");
  496. String secret = "c09f9caf5e08836d4673ccdd69bb041e"; // YOUR SECRET
  497. // KEY!
  498. String email = "MasterPvP@gmail.com"; // This is the one you use to
  499. // login into RSPS-PAY
  500. URL url = new URL("http://rsps-pay.com/includes/listener.php?username=" + username + "&secret=" + secret + "&email=" + email);
  501. BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
  502. String results = reader.readLine();
  503. if (results.toLowerCase().contains("!error:")) {
  504.  
  505. } else {
  506. String[] ary = results.split(",");
  507. for (int i = 0; i < ary.length; i++) {
  508. switch (ary[i]) {
  509. case "0":
  510. // donation was not found tell the user that!
  511. break;
  512. case "12189": // product ids can be found on the webstore
  513. // page
  514. c.donatorPoints += 30;
  515. c.setRights(Rights.CONTRIBUTOR);
  516. c.getItems().addItem(6199, 5);
  517. c.disconnected = true;
  518. break;
  519. case "12191": // product ids can be found on the webstore
  520. // page
  521. c.setRights(Rights.SPONSOR);
  522. c.donatorPoints += 75;
  523. c.getItems().addItem(6199, 10);
  524. c.disconnected = true;
  525. break;
  526. case "12192": // product ids can be found on the webstore
  527. // page
  528. c.setRights(Rights.SUPPORTER);
  529. c.donatorPoints += 125;
  530. c.getItems().addItem(2996, 2000);
  531. c.getItems().addItem(6199, 10);
  532. c.disconnected = true;
  533. break;
  534. case "12193": // product ids can be found on the webstore
  535. // page
  536. c.setRights(Rights.V_I_P);
  537. c.donatorPoints += 200;
  538. c.getItems().addItem(2996, 2000);
  539. c.getItems().addItem(6199, 15);
  540. c.disconnected = true;
  541. break;
  542. case "12194": // product ids can be found on the webstore
  543. // page
  544. c.setRights(Rights.SUPER_V_I_P);
  545. c.donatorPoints += 500;
  546. c.getItems().addItem(2996, 4000);
  547. c.getItems().addItem(6199, 28);
  548. c.disconnected = true;
  549. break;
  550. }
  551. }
  552. }
  553. } catch (IOException e) {
  554. }
  555. }*/
  556.  
  557. public void sendDebugMessage(String s) {
  558. if (getRights().isOwner() && isDebug()) {
  559. if (getOutStream() != null) {
  560. outStream.createFrameVarSize(253);
  561. outStream.writeString(s);
  562. outStream.endFrameVarSize();
  563. }
  564. }
  565. }
  566.  
  567. public Player getClient(int id) {
  568. return PlayerHandler.players[id];
  569. }
  570.  
  571. public boolean validClient(int id) {
  572. if (id < 0 || id > Config.MAX_PLAYERS) {
  573. return false;
  574. }
  575. return validClient(getClient(id));
  576. }
  577.  
  578. public boolean validClient(String name) {
  579. return validClient(getClient(name));
  580. }
  581.  
  582. public boolean validClient(Player client) {
  583. return (client != null && !client.disconnected);
  584. }
  585.  
  586. public void flushOutStream() {
  587. if (!session.isConnected() || disconnected || outStream.currentOffset == 0)
  588. return;
  589.  
  590. byte[] temp = new byte[outStream.currentOffset];
  591. System.arraycopy(outStream.buffer, 0, temp, 0, temp.length);
  592. Packet packet = new Packet(-1, Type.FIXED, ChannelBuffers.wrappedBuffer(temp));
  593. session.write(packet);
  594. outStream.currentOffset = 0;
  595.  
  596. }
  597.  
  598. private Map<Integer, TinterfaceText> interfaceText = new HashMap<>();
  599.  
  600. public class TinterfaceText {
  601. public int id;
  602. public String currentState;
  603.  
  604. public TinterfaceText(String s, int id) {
  605. this.currentState = s;
  606. this.id = id;
  607. }
  608.  
  609. }
  610.  
  611. public boolean checkPacket126Update(String text, int id) {
  612. if (interfaceText.containsKey(id)) {
  613. TinterfaceText t = interfaceText.get(id);
  614. if (text.equals(t.currentState)) {
  615. return false;
  616. }
  617. }
  618. interfaceText.put(id, new TinterfaceText(text, id));
  619. return true;
  620. }
  621.  
  622. public void sendClan(String name, String message, String clan, int rights) {
  623. name = name.substring(0, 1).toUpperCase() + name.substring(1);
  624. message = message.substring(0, 1).toUpperCase() + message.substring(1);
  625. clan = clan.substring(0, 1).toUpperCase() + clan.substring(1);
  626. outStream.createFrameVarSizeWord(217);
  627. outStream.writeString(name);
  628. outStream.writeString(message);
  629. outStream.writeString(clan);
  630. outStream.writeWord(rights);
  631. outStream.endFrameVarSize();
  632. }
  633.  
  634. public static final int PACKET_SIZES[] = { 0, 0, 0, 1, -1, 0, 0, 0, 4, 0, // 0
  635. 0, 0, 0, 0, 8, 0, 6, 2, 2, 0, // 10
  636. 0, 2, 0, 6, 0, 12, 0, 0, 0, 0, // 20
  637. 0, 0, 0, 0, 0, 8, 4, 0, 0, 2, // 30
  638. 2, 6, 0, 6, 0, -1, 0, 0, 0, 0, // 40
  639. 0, 0, 0, 12, 0, 0, 0, 8, 8, 12, // 50
  640. 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, // 60
  641. 6, 0, 2, 2, 8, 6, 0, -1, 0, 6, // 70
  642. 0, 0, 0, 0, 0, 1, 4, 6, 0, 0, // 80
  643. 0, 0, 0, 0, 0, 3, 0, 0, -1, 0, // 90
  644. 0, 13, 0, -1, 0, 0, 0, 0, 0, 0, // 100
  645. 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, // 110
  646. 1, 0, 6, 0, 16, 0, -1, -1, 2, 6, // 120
  647. 0, 4, 6, 8, 0, 6, 0, 0, 0, 2, // 130
  648. 6, 10, -1, 0, 0, 6, 0, 0, 0, 0, // 140
  649. 0, 0, 1, 2, 0, 2, 6, 0, 0, 0, // 150
  650. 0, 0, 0, 0, -1, -1, 0, 0, 0, 0, // 160
  651. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 170
  652. 0, 8, 0, 3, 0, 2, 0, 0, 8, 1, // 180
  653. 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, // 190
  654. 2, 0, 0, 0, 0, 0, 0, 0, 4, 0, // 200
  655. 4, 0, 0, /* 0 */4, 7, 8, 0, 0, 10, 0, // 210
  656. 0, 0, 0, 0, 0, 0, -1, 0, 6, 0, // 220
  657. 1, 0, 0, 0, 6, 0, 6, 8, 1, 0, // 230
  658. 0, 4, 0, 0, 0, 0, -1, 0, -1, 4, // 240
  659. 0, 0, 6, 6, 0, 0, 0 // 250
  660. };
  661.  
  662. public void resetRanks() {
  663. for (int i = 0; i < 10; i++) {
  664. ranks[i] = 0;
  665. rankPpl[i] = "";
  666. }
  667. }
  668.  
  669. public void highscores() {
  670. getPA().sendFrame126("Top PKers Online", 6399); // Title
  671. for (int i = 0; i < 10; i++) {
  672. if (ranks[i] > 0) {
  673. getPA().sendFrame126("Rank " + (i + 1) + ": " + rankPpl[i] + " - Kills: " + ranks[i] + "", 6402 + i);
  674. }
  675. }
  676. getPA().showInterface(6308);
  677. flushOutStream();
  678. resetRanks();
  679. }
  680.  
  681. public int playerRank = 0;
  682. public static int[] ranks = new int[11];
  683. public static String[] rankPpl = new String[11];
  684.  
  685. public void homeTeleport(int x, int y, int h) {
  686. if (homeTele == 9) {
  687. startAnimation(4850);
  688. } else if (homeTele == 7) {
  689. startAnimation(4853);
  690. gfx0(802);
  691. } else if (homeTele == 5) {
  692. startAnimation(4855);
  693. gfx0(803);
  694. } else if (homeTele == 3) {
  695. startAnimation(4857);
  696. gfx0(804);
  697. } else if (homeTele == 1) {
  698. homeTeleDelay = 0;
  699. homeTele = 0;
  700. teleportToX = x;
  701. teleportToY = y;
  702. heightLevel = h;
  703. }
  704. }
  705.  
  706. public void destruct() {
  707. if (session == null)
  708. return;
  709. if (zulrah.getInstancedZulrah() != null) {
  710. InstancedAreaManager.getSingleton().disposeOf(zulrah.getInstancedZulrah());
  711. }
  712. if (getPA().viewingOtherBank) {
  713. getPA().resetOtherBank();
  714. }
  715. if (Boundary.isIn(this, PestControl.GAME_BOUNDARY)) {
  716. PestControl.removeGameMember(this);
  717. }
  718. if (Boundary.isIn(this, PestControl.LOBBY_BOUNDARY)) {
  719. PestControl.removeFromLobby(this);
  720. }
  721. if (CastleWars.isInCwWait(this)) {
  722. CastleWars.leaveWaitingRoom(this);
  723. }
  724. if (CastleWars.isInCw(this)) {
  725. CastleWars.removePlayerFromCw(this);
  726. }
  727. if (underAttackBy > 0 || underAttackBy2 > 0)
  728. return;
  729. /*if (!rights.isAdministrator() && !rights.isOwner()) {
  730. new HighscoresHandler(this).start();
  731. }*/
  732. if (disconnected == true) {
  733. saveCharacter = true;
  734. }
  735. Server.getMultiplayerSessionListener().removeOldRequests(this);
  736. if (clan != null) {
  737. clan.removeMember(this);
  738. }
  739. getFriends().notifyFriendsOfUpdate();
  740. Misc.println("[Logged out]: " + playerName + "");
  741. CycleEventHandler.getSingleton().stopEvents(this);
  742. disconnected = true;
  743. session.close();
  744. session = null;
  745. inStream = null;
  746. outStream = null;
  747. isActive = false;
  748. buffer = null;
  749. playerListSize = 0;
  750. for (int i = 0; i < maxPlayerListSize; i++)
  751. playerList[i] = null;
  752. absX = absY = -1;
  753. mapRegionX = mapRegionY = -1;
  754. currentX = currentY = 0;
  755. resetWalkingQueue();
  756. }
  757.  
  758. public void sendMessage(String s) {
  759. // synchronized (this) {
  760. if (getOutStream() != null) {
  761. outStream.createFrameVarSize(253);
  762. outStream.writeString(s);
  763. outStream.endFrameVarSize();
  764. }
  765.  
  766. }
  767.  
  768. public void setSidebarInterface(int menuId, int form) {
  769. // synchronized (this) {
  770. if (getOutStream() != null) {
  771. outStream.createFrame(71);
  772. outStream.writeWord(form);
  773. outStream.writeByteA(menuId);
  774. }
  775.  
  776. }
  777.  
  778. public void joinHelpClan() {
  779. if (clan == null) {
  780. Clan localClan = Server.clanManager.getClan("help");
  781. if (localClan != null)
  782. localClan.addMember(this);
  783. else if ("help".equalsIgnoreCase(this.playerName))
  784. Server.clanManager.create(this);
  785. else {
  786. sendMessage(Misc.formatPlayerName("OSPvP") + " has temporarily disabled the help chat.");
  787. }
  788. getPA().refreshSkill(21);
  789. getPA().refreshSkill(22);
  790. getPA().refreshSkill(23);
  791. // inArdiCC = true;
  792. }
  793. }
  794.  
  795. public void loadHighscore() {
  796. getPA().sendFrame126("Top PKers Online", 6399);
  797. getPA().sendFrame126("Close Window", 6401);
  798. getPA().sendFrame126(" ", 6402);
  799. getPA().sendFrame126(" ", 6403);
  800. getPA().sendFrame126(" ", 6404);
  801. getPA().sendFrame126(" ", 6405);
  802. getPA().sendFrame126("MasterPvP", 640);
  803. getPA().sendFrame126(" ", 6406);
  804. getPA().sendFrame126(" ", 6407);
  805. getPA().sendFrame126(" ", 6408);
  806. getPA().sendFrame126(" ", 6409);
  807. getPA().sendFrame126(" ", 6410);
  808. getPA().sendFrame126(" ", 6411);
  809. getPA().sendFrame126(" ", 8578);
  810. getPA().sendFrame126(" ", 8579);
  811. getPA().sendFrame126(" ", 8580);
  812. getPA().sendFrame126(" ", 8581);
  813. getPA().sendFrame126(" ", 8582);
  814. getPA().sendFrame126(" ", 8583);
  815. getPA().sendFrame126(" ", 8584);
  816. getPA().sendFrame126(" ", 8585);
  817. getPA().sendFrame126(" ", 8586);
  818. getPA().sendFrame126(" ", 8587);
  819. getPA().sendFrame126(" ", 8588);
  820. getPA().sendFrame126(" ", 8589);
  821. getPA().sendFrame126(" ", 8590);
  822. getPA().sendFrame126(" ", 8591);
  823. getPA().sendFrame126(" ", 8592);
  824. getPA().sendFrame126(" ", 8593);
  825. getPA().sendFrame126(" ", 8594);
  826. getPA().sendFrame126(" ", 8595);
  827. getPA().sendFrame126(" ", 8596);
  828. getPA().sendFrame126(" ", 8597);
  829. getPA().sendFrame126(" ", 8598);
  830. getPA().sendFrame126(" ", 8599);
  831. getPA().sendFrame126(" ", 8600);
  832. getPA().sendFrame126(" ", 8601);
  833. getPA().sendFrame126(" ", 8602);
  834. getPA().sendFrame126(" ", 8603);
  835. getPA().sendFrame126(" ", 8604);
  836. getPA().sendFrame126(" ", 8605);
  837. getPA().sendFrame126(" ", 8606);
  838. getPA().sendFrame126(" ", 8607);
  839. getPA().sendFrame126(" ", 8608);
  840. getPA().sendFrame126(" ", 8609);
  841. getPA().sendFrame126(" ", 8610);
  842. getPA().sendFrame126(" ", 8611);
  843. getPA().sendFrame126(" ", 8612);
  844. getPA().sendFrame126(" ", 8613);
  845. getPA().sendFrame126(" ", 8614);
  846. getPA().sendFrame126(" ", 8615);
  847. getPA().sendFrame126(" ", 8616);
  848. getPA().sendFrame126(" ", 8617);
  849. }
  850.  
  851. public void updateHighscores() {
  852. CycleEventHandler.getSingleton().addEvent(this, new CycleEvent() {
  853.  
  854. @Override
  855. public void execute(CycleEventContainer container) {
  856. int totalz = KC;
  857. for (int d = 0; d <= 10; d++) {
  858. if (totalz >= ranks[d]) {
  859. if (d == 0) {
  860. playerRank = d + 1;
  861. ranks[d] = totalz;
  862. rankPpl[d] = playerName;
  863. } else if (d < 10) {
  864. if (totalz < ranks[d - 1]) {
  865. playerRank = d + 1;
  866. ranks[d] = totalz;
  867. rankPpl[d] = playerName;
  868. }
  869. } else {
  870. if (totalz < ranks[d - 1]) {
  871. playerRank = 0;
  872. }
  873. }
  874. }
  875. }
  876. // System.out.println("Highscores updated succesfully!");
  877. }
  878.  
  879. @Override
  880. public void stop() {
  881.  
  882. }
  883. }, 50);
  884. }
  885.  
  886. public String randomMessage() {
  887. int randomMessage = Misc.random(4);
  888. switch (randomMessage) {
  889. case 0:
  890. return "<img=10><col=255> Did you know? You can help the server grow by voting every 12 hours! ::vote <img=10>";
  891. case 1:
  892. return "<img=10><col=255> Did you know? You can type ::help to submit a ticket to all staff members! <img=10>";
  893. case 2:
  894. return "<img=10><col=255> Did you know? You can upgrade your account and get great benefits! ::store <img=10>";
  895. case 3:
  896. return "<img=10><col=255> Did you know? We reply to every suggestion posted on forum! <img=10>";
  897. }
  898. return "<img=10><col=255> Did you know? We have a great set of community forums! Join now! ::forums <img=10>";
  899. }
  900.  
  901. public void serverMessages() {
  902. CycleEventHandler.getSingleton().addEvent(this, new CycleEvent() {
  903. @Override
  904. public void execute(CycleEventContainer container) {
  905. sendMessage(randomMessage());
  906. }
  907.  
  908. @Override
  909. public void stop() {
  910. }
  911. }, 1500);
  912. }
  913.  
  914. public void initialize() {
  915. try {
  916. recordedLogin = System.currentTimeMillis();
  917. Achievements.checkIfFinished(this);
  918. getPA().loadQuests();
  919. Connection.appendStarters();
  920. Connection.appendStarters2();
  921. setStopPlayer(false);
  922. getPlayerAction().setAction(false);
  923. getPlayerAction().canWalk(true);
  924. getPA().sendFrame126(runEnergy + "%", 149);
  925. isFullHelm = Item.isFullHelm(playerEquipment[playerHat]);
  926. isFullMask = Item.isFullMask(playerEquipment[playerHat]);
  927. isFullBody = Item.isFullBody(playerEquipment[playerChest]);
  928. getPA().sendFrame36(173, isRunning2 ? 1 : 0);
  929. getPA().sendFrame36(166, 4);
  930. serverMessages();
  931. sendMessage("<img=10>Welcome to <col=255>MasterPvP@bla@!");
  932. sendMessage("<img=10>Use @blu@::commands@bla@ to see your available commands!");
  933. sendMessage("<img=10>Remember to @blu@::vote @bla@and @red@::store @bla@to support the server!");
  934. sendMessage("<img=10>There is currently a 20% discount on all purchases at @blu@::store@bla@!");
  935. //sendMessage("<img=10>Please take a moment to register at @blu@::forums@bla@!");
  936. if (Config.BONUS_WEEKEND)
  937. sendMessage("<img=10>Bonus Play is @red@LIVE@bla@! Bonus voting, PKP and XP!");
  938. if (Config.CYBER_MONDAY)
  939. sendMessage("@cr8@Christmas sale is @red@LIVE@bla@! 20% extra points on all purchases! @red@::store");
  940. combatLevel = calculateCombatLevel();
  941. /*
  942. * if (playerRights != 3 || playerRights != 2) {
  943. * Highscores.process(); }
  944. */
  945. outStream.createFrame(249);
  946. outStream.writeByteA(1); // 1 for members, zero for free
  947. outStream.writeWordBigEndianA(playerId);
  948. for (int j = 0; j < PlayerHandler.players.length; j++) {
  949. if (j == playerId)
  950. continue;
  951. if (PlayerHandler.players[j] != null) {
  952. if (PlayerHandler.players[j].playerName.equalsIgnoreCase(playerName))
  953. disconnected = true;
  954. }
  955. }
  956. for (int p = 0; p < PRAYER.length; p++) { // reset prayer glows
  957. prayerActive[p] = false;
  958. getPA().sendFrame36(PRAYER_GLOW[p], 0);
  959. }
  960. getPA().handleWeaponStyle();
  961. getPA().handleLoginText();
  962. accountFlagged = getPA().checkForFlags();
  963. getPA().sendFrame36(108, 0);// resets autocast button
  964. getPA().sendFrame36(172, 1);
  965. getPA().sendFrame107(); // reset screen
  966. setSidebarInterface(1, 3917);
  967. setSidebarInterface(2, 638);
  968. setSidebarInterface(3, 3213);
  969. setSidebarInterface(4, 1644);
  970. // getPA().sendFrame171(0, 27670);
  971. setSidebarInterface(5, 5608);
  972. if (playerMagicBook == 0) {
  973. setSidebarInterface(6, 28060); // modern
  974. }
  975. if (playerMagicBook == 1) {
  976. setSidebarInterface(6, 28062); // ancient
  977. }
  978. if (playerMagicBook == 2) {
  979. setSidebarInterface(6, 28064); // ancient
  980. }
  981. if (hasNpc) {
  982. if (summonId > 0) {
  983. PetHandler.spawnPet(this, summonId, -1, true);
  984. }
  985. }
  986. if (splitChat) {
  987. getPA().sendFrame36(502, 1);
  988. getPA().sendFrame36(287, 1);
  989. }
  990. setSidebarInterface(7, 18128);
  991. setSidebarInterface(8, 5065);
  992. setSidebarInterface(9, 5715);
  993. setSidebarInterface(10, 2449);
  994. setSidebarInterface(11, 904); // wrench tab
  995. setSidebarInterface(12, 147); // run tab
  996. setSidebarInterface(13, -1);
  997. setSidebarInterface(0, 2423);
  998. getPA().showOption(4, 0, "Follow", 3);
  999. getPA().showOption(5, 0, "Trade with", 4);
  1000. getPA().showOption(6, 0, "Moderate", 5);
  1001. getItems().resetItems(3214);
  1002. getItems().sendWeapon(playerEquipment[playerWeapon], getItems().getItemName(playerEquipment[playerWeapon]));
  1003. getItems().resetBonus();
  1004. getItems().getBonus();
  1005. getItems().writeBonus();
  1006. getItems().setEquipment(playerEquipment[playerHat], 1, playerHat);
  1007. getItems().setEquipment(playerEquipment[playerCape], 1, playerCape);
  1008. getItems().setEquipment(playerEquipment[playerAmulet], 1, playerAmulet);
  1009. getItems().setEquipment(playerEquipment[playerArrows], playerEquipmentN[playerArrows], playerArrows);
  1010. getItems().setEquipment(playerEquipment[playerChest], 1, playerChest);
  1011. getItems().setEquipment(playerEquipment[playerShield], 1, playerShield);
  1012. getItems().setEquipment(playerEquipment[playerLegs], 1, playerLegs);
  1013. getItems().setEquipment(playerEquipment[playerHands], 1, playerHands);
  1014. getItems().setEquipment(playerEquipment[playerFeet], 1, playerFeet);
  1015. getItems().setEquipment(playerEquipment[playerRing], 1, playerRing);
  1016. getItems().setEquipment(playerEquipment[playerWeapon], playerEquipmentN[playerWeapon], playerWeapon);
  1017. getCombat().getPlayerAnimIndex(ItemAssistant.getItemName(playerEquipment[playerWeapon]).toLowerCase());
  1018. if (getPrivateChat() > 2) {
  1019. setPrivateChat(0);
  1020. }
  1021. if (Boundary.isIn(this, PestControl.GAME_BOUNDARY)) {
  1022. getPA().movePlayer(2662, 2652, 0);
  1023. }
  1024. /* Login Friend List */
  1025. outStream.createFrame(221);
  1026. outStream.writeByte(2);
  1027.  
  1028. outStream.createFrame(206);
  1029. outStream.writeByte(0);
  1030. outStream.writeByte(getPrivateChat());
  1031. outStream.writeByte(0);
  1032. getFriends().sendList();
  1033. getIgnores().sendList();
  1034.  
  1035. getItems().addSpecialBar(playerEquipment[playerWeapon]);
  1036. saveTimer = Config.SAVE_TIMER;
  1037. saveCharacter = true;
  1038. // HighscoresConfig.updateHighscores(this);
  1039. Misc.println("[Logged in]: " + playerName + "");
  1040. handler.updatePlayer(this, outStream);
  1041. handler.updateNPC(this, outStream);
  1042. flushOutStream();
  1043. totalLevel = getPA().totalLevel();
  1044. xpTotal = getPA().xpTotal();
  1045. getPA().sendFrame126("Combat Level: " + combatLevel + "", 3983);
  1046. getPA().sendFrame126("Level: " + totalLevel + "", 3984);
  1047. getPA().resetFollow();
  1048. getPA().clearClanChat();
  1049. getPA().resetFollow();
  1050. getPA().setClanData();
  1051. if (startPack == false) {
  1052. getPA().addStarter();
  1053. startPack = true;
  1054. Server.clanManager.getHelpClan().addMember(this);
  1055. }
  1056. if (autoRet == 1)
  1057. getPA().sendFrame36(172, 1);
  1058. else
  1059. getPA().sendFrame36(172, 0);
  1060. addEvents();
  1061. if (Config.BOUNTY_HUNTER_ACTIVE) {
  1062. bountyHunter.updateTargetUI();
  1063. }
  1064. for (int i = 0; i < playerLevel.length; i++) {
  1065. /**
  1066. * WARNING; Do not tamper with the uncommented code.
  1067. */
  1068. // if (i == 3 || i == 5) {
  1069. // continue;
  1070. // }
  1071. // playerLevel[i] = getPA().getLevelForXP(playerXP[i]);
  1072. getPA().refreshSkill(i);
  1073. }
  1074. correctCoordinates();
  1075. } catch (Exception e) {
  1076. e.printStackTrace();
  1077. }
  1078. }
  1079.  
  1080. public void addEvents() {
  1081. if (Config.BOUNTY_HUNTER_ACTIVE) {
  1082. CycleEventHandler.getSingleton().addEvent(this, bountyHunter, 1);
  1083. }
  1084. CycleEventHandler.getSingleton().addEvent(CycleEventHandler.Event.PLAYER_COMBAT_DAMAGE, this, damageQueue, 1, true);
  1085. }
  1086.  
  1087. public void update() {
  1088. handler.updatePlayer(this, outStream);
  1089. handler.updateNPC(this, outStream);
  1090. flushOutStream();
  1091.  
  1092. }
  1093.  
  1094. public void wildyWarning() {
  1095. getPA().showInterface(1908);
  1096. }
  1097.  
  1098. public boolean inProcess = false;
  1099.  
  1100. public void logout() {
  1101. if (this.clan != null) {
  1102. this.clan.removeMember(this);
  1103. }
  1104. if (getPA().viewingOtherBank) {
  1105. getPA().resetOtherBank();
  1106. }
  1107. if(bankpin != 0) {
  1108. sendMessage("<col=255>You have to set your pin for this session!</col>");
  1109. sendMessage("<col=255>Type ::enterpin <yourpin> </col>");
  1110. } else {
  1111. sendMessage("<col=255>You have no bankpin yet! Type ::newpin <yourpin> to set!</col>");
  1112. }
  1113. pinset = 0;
  1114. if (CastleWars.isInCwWait(this)) {
  1115. CastleWars.leaveWaitingRoom(this);
  1116. }
  1117. if (CastleWars.isInCw(this)) {
  1118. CastleWars.removePlayerFromCw(this);
  1119. }
  1120. /*
  1121. * if (playerRights != 3 || playerRights != 2) { Highscores.save(this);
  1122. * }
  1123. */
  1124. DuelSession duelSession = (DuelSession) Server.getMultiplayerSessionListener().getMultiplayerSession(this, MultiplayerSessionType.DUEL);
  1125. if (Objects.nonNull(duelSession) && duelSession.getStage().getStage() > MultiplayerSessionStage.REQUEST) {
  1126. if (duelSession.getStage().getStage() >= MultiplayerSessionStage.FURTHER_INTERACTION) {
  1127. sendMessage("You are not permitted to logout during a duel. If you forcefully logout you will");
  1128. sendMessage("lose all of your staked items, if any, to your opponent.");
  1129. }
  1130. }
  1131. if (underAttackBy > 0 || underAttackBy2 > 0)
  1132. return;
  1133. // synchronized (this) {
  1134. if (logoutDelay.elapsed(10000)) {
  1135. outStream.createFrame(109);
  1136. CycleEventHandler.getSingleton().stopEvents(this);
  1137. properLogout = true;
  1138. ConnectedFrom.addConnectedFrom(this, connectedFrom);
  1139. playTimeTotal += (System.currentTimeMillis() - recordedLogin);
  1140. } else {
  1141. sendMessage("You must wait a few seconds from being out of combat to logout.");
  1142. }
  1143.  
  1144. }
  1145.  
  1146. public int packetSize = 0, packetType = -1;
  1147. private long lastOverloadBoost;
  1148.  
  1149. public long lastDamageCalculation;
  1150. public long lastUpdate = System.currentTimeMillis();
  1151.  
  1152. public void process() {
  1153. farming.farmingProcess();
  1154. if (updateItems) {
  1155. itemAssistant.updateItems();
  1156. }
  1157. if (isDead && respawnTimer == -6) {
  1158. getPA().applyDead();
  1159. }
  1160. if (bonusXpTime > 0) {
  1161. bonusXpTime--;
  1162. }
  1163. getPA().sendFrame126((int) (specAmount * 10) + "", 155);
  1164. if (bonusXpTime == 1) {
  1165. sendMessage("@blu@Your time is up. Your XP is no longer boosted by the voting reward.");
  1166. }
  1167. if (respawnTimer == 7) {
  1168. respawnTimer = -6;
  1169. getPA().giveLife();
  1170. } else if (respawnTimer == 12) {
  1171. respawnTimer--;
  1172. startAnimation(0x900);
  1173. }
  1174. if (Boundary.isIn(this, Zulrah.BOUNDARY) && getZulrahEvent().isInToxicLocation()) {
  1175. appendDamage(1 + Misc.random(3), Hitmark.VENOM);
  1176. }
  1177. if (getPoisonDamage() > 0 && System.currentTimeMillis() - getLastPoisonHit() > TimeUnit.MINUTES.toMillis(1)) {
  1178. appendPoisonDamage();
  1179. setLastPoisonHit(System.currentTimeMillis());
  1180. sendMessage("You have been poisoned!");
  1181. }
  1182. if (getVenomDamage() > 0 && System.currentTimeMillis() - getLastVenomHit() > 15_0000) {
  1183. appendVenomDamage();
  1184. setLastVenomHit(System.currentTimeMillis());
  1185. sendMessage("You have been hit by the venom infection.");
  1186. }
  1187. // if (lastUpdate > 100000) {
  1188. // Test.run();
  1189. // }
  1190.  
  1191. if (respawnTimer > -6) {
  1192. respawnTimer--;
  1193. }
  1194. if (hitDelay > 0) {
  1195. hitDelay--;
  1196. }
  1197.  
  1198. getAgilityHandler().agilityProcess(this);
  1199. if (specRestore > 0) {
  1200. specRestore--;
  1201. }
  1202.  
  1203. if (rangeDelay > 0) {
  1204. rangeDelay--;
  1205. }
  1206.  
  1207. getPA().sendFrame126("Players Online: @gre@" + PlayerHandler.getPlayerCount() + "", 29155);//
  1208. // getPA().sendFrame126("@gre@ My Statistics:", 29161);
  1209. if (rights.isPlayer())
  1210. getPA().sendFrame126("@or1@Rank: Player", 29162);
  1211. if (rights.isModerator())
  1212. getPA().sendFrame126("@or1@Rank: <col=148200>Moderator @cr1@", 29162);
  1213. if (rights.isAdministrator() || rights.isOwner())
  1214. getPA().sendFrame126("@or1@Rank: <col=A67711>Owner @cr2@", 29162);
  1215. if (rights.isContributor())
  1216. getPA().sendFrame126("@or1@Rank: @red@Donator@cr4@", 29162);
  1217. if (rights.isSponsor())
  1218. getPA().sendFrame126("@or1@Rank: @blu@Sponsor@cr5@", 29162);
  1219. if (rights.isSupporter())
  1220. getPA().sendFrame126("@or1@Rank: @gre@Supporter @cr6@", 29162);
  1221. if (rights.isVIP())
  1222. getPA().sendFrame126("@or1@Rank: <col=FF00CD>V.I.P @cr7@", 29162);
  1223. if (rights.isSuperVIP())
  1224. getPA().sendFrame126("@or1@Rank: @yel@Super V.I.P@cr8@", 29162);
  1225. if (rights.isRespectedMember())
  1226. getPA().sendFrame126("@or1@Rank: <col=FF00CD>Respected @cr9@", 29162);
  1227. if (rights.isHelper())
  1228. getPA().sendFrame126("@or1@Rank: @blu@Helper @cr10@", 29162);
  1229. getPA().sendFrame126("@or1@PK Points: @gre@" + pkp, 29163);
  1230. getPA().sendFrame126("@or1@Kills/Deaths: @gre@" + KC + "@or1@/@gre@" + DC, 29164);
  1231. getPA().sendFrame126("@or1@Hunter KS: @gre@" + getKillstreak().getAmount(Killstreak.Type.HUNTER) + "@or1@, " + "Rogue KS: @gre@"
  1232. + getKillstreak().getAmount(Killstreak.Type.ROGUE), 29165);
  1233. if (specDelay.elapsed(Config.INCREASE_SPECIAL_AMOUNT)) {
  1234. specDelay.reset();
  1235. if (specAmount < 10) {
  1236. specAmount += 1;
  1237. if (specAmount > 10)
  1238. specAmount = 10;
  1239. getItems().addSpecialBar(playerEquipment[playerWeapon]);
  1240. }
  1241. }
  1242.  
  1243. getCombat().handlePrayerDrain();
  1244. if (singleCombatDelay.elapsed(6000)) {
  1245. underAttackBy = 0;
  1246. }
  1247. if (singleCombatDelay2.elapsed(6000)) {
  1248. underAttackBy2 = 0;
  1249. }
  1250. if (hasOverloadBoost) {
  1251. if (System.currentTimeMillis() - lastOverloadBoost > 15000) {
  1252. getPotions().doOverloadBoost();
  1253. lastOverloadBoost = System.currentTimeMillis();
  1254. }
  1255. }
  1256. if (System.currentTimeMillis() - restoreStatsDelay > 60000) {
  1257. restoreStatsDelay = System.currentTimeMillis();
  1258. for (int level = 0; level < playerLevel.length; level++) {
  1259. if (playerLevel[level] < getLevelForXP(playerXP[level])) {
  1260. if (level < 7 && level != 5 && level != 3) {
  1261. if (hasOverloadBoost)
  1262. continue;
  1263. }
  1264. if (level != 5) { // prayer doesn't restore
  1265. playerLevel[level] += 1;
  1266. getPA().setSkillLevel(level, playerLevel[level], playerXP[level]);
  1267. getPA().refreshSkill(level);
  1268. }
  1269. } else if (playerLevel[level] > getLevelForXP(playerXP[level])) {
  1270. playerLevel[level] -= 1;
  1271. getPA().setSkillLevel(level, playerLevel[level], playerXP[level]);
  1272. getPA().refreshSkill(level);
  1273. }
  1274. }
  1275. }
  1276.  
  1277. if (inWild()) {
  1278. int modY = absY > 6400 ? absY - 6400 : absY;
  1279. wildLevel = (((modY - 3520) / 8) + 1);
  1280. if (Config.SINGLE_AND_MULTI_ZONES) {
  1281. getPA().sendFrame126("@yel@Level: " + wildLevel, 199);
  1282. } else {
  1283. getPA().multiWay(-1);
  1284. getPA().sendFrame126("@yel@Level: " + wildLevel, 199);
  1285. }
  1286. getPA().showOption(3, 0, "Attack", 1);
  1287. if (Config.BOUNTY_HUNTER_ACTIVE) {
  1288. getPA().walkableInterface(28000);
  1289. getPA().sendFrame171(1, 28070);
  1290. getPA().sendFrame171(0, 196);
  1291. } else {
  1292. getPA().walkableInterface(197);
  1293. }
  1294. } else if (inClanWars()) {
  1295. getPA().showOption(3, 0, "Attack", 1);
  1296. if (Boundary.isIn(this, ClanWarsMap.FREE_FOR_ALL.getBoundary())) {
  1297. getPA().walkableInterface(197);
  1298. }
  1299. } else if (inEdgeville()) {
  1300. if (Config.BOUNTY_HUNTER_ACTIVE) {
  1301. if (bountyHunter.hasTarget()) {
  1302. getPA().walkableInterface(28000);
  1303. getPA().sendFrame171(0, 28070);
  1304. getPA().sendFrame171(1, 196);
  1305. bountyHunter.updateOutsideTimerUI();
  1306. } else {
  1307. getPA().walkableInterface(-1);
  1308. }
  1309. } else {
  1310. getPA().sendFrame99(0);
  1311. getPA().walkableInterface(-1);
  1312. getPA().showOption(3, 0, "Null", 1);
  1313. }
  1314. getPA().showOption(3, 0, "null", 1);
  1315. /*
  1316. * } else if (Dicing.inDiceArea(this)) { if
  1317. * (!this.getItems().playerHasItem(Dicing.DICE)) {
  1318. * getPA().showOption(3, 1, "Dice With", 1); } else if
  1319. * (this.getItems().playerHasItem(Dicing.DICE)) {
  1320. * getPA().showOption(3, 1, "null", 1); }
  1321. */
  1322. } else if (Boundary.isIn(this, PestControl.LOBBY_BOUNDARY)) {
  1323. getPA().walkableInterface(21119);
  1324. PestControl.drawInterface(this, "lobby");
  1325. } else if (Boundary.isIn(this, PestControl.GAME_BOUNDARY)) {
  1326. getPA().walkableInterface(21100);
  1327. PestControl.drawInterface(this, "game");
  1328. }
  1329. else if (CastleWars.isInCw(this)) {
  1330. getPA().showOption(3, 0, "Attack", 1);
  1331. } else if (!CastleWars.isInCwWait(this)) {
  1332. getPA().sendFrame99(0);
  1333. getPA().walkableInterface(-1);
  1334. getPA().showOption(3, 0, "Null", 1);
  1335.  
  1336.  
  1337. } else if ((inDuelArena() || Boundary.isIn(this, Boundary.DUEL_ARENAS)) && !inDice()) {
  1338. getPA().walkableInterface(201);
  1339. if (Boundary.isIn(this, Boundary.DUEL_ARENAS)) {
  1340. getPA().showOption(3, 0, "Attack", 1);
  1341. } else {
  1342. getPA().showOption(3, 0, "Challenge", 1);
  1343. }
  1344. wildLevel = 126;
  1345. } else if (isInBarrows() || isInBarrows2()) {
  1346. // getPA().sendFrame99(0);
  1347. getPA().sendFrame126("Kill Count: " + barrowsKillCount, 4536);
  1348. getPA().walkableInterface(4535);
  1349. } else if (inPits) {
  1350. getPA().showOption(3, 0, "Attack", 1);
  1351. } else if (getPA().inPitsWait()) {
  1352. getPA().showOption(3, 0, "Null", 1);
  1353. }
  1354. if (!inWild()) {
  1355. wildLevel = 0;
  1356. }
  1357. if (!hasMultiSign && inMulti()) {
  1358. hasMultiSign = true;
  1359. getPA().multiWay(1);
  1360. }
  1361.  
  1362. if (hasMultiSign && !inMulti()) {
  1363. hasMultiSign = false;
  1364. getPA().multiWay(-1);
  1365. }
  1366. if (!inMulti() && inWild())
  1367. getPA().sendFrame70(30, 0, 196);
  1368. else if (inMulti() && inWild())
  1369. getPA().sendFrame70(0, 0, 196);
  1370. if (this.skullTimer > 0) {
  1371. --skullTimer;
  1372. if (skullTimer == 1) {
  1373. isSkulled = false;
  1374. attackedPlayers.clear();
  1375. headIconPk = -1;
  1376. skullTimer = -1;
  1377. getPA().requestUpdates();
  1378. }
  1379. }
  1380.  
  1381.  
  1382. if (freezeTimer > -6) {
  1383. freezeTimer--;
  1384. if (frozenBy > 0) {
  1385. if (PlayerHandler.players[frozenBy] == null) {
  1386. freezeTimer = -1;
  1387. frozenBy = -1;
  1388. } else if (!goodDistance(absX, absY, PlayerHandler.players[frozenBy].absX, PlayerHandler.players[frozenBy].absY, 20)) {
  1389. freezeTimer = -1;
  1390. frozenBy = -1;
  1391. }
  1392. }
  1393. }
  1394.  
  1395. if (attackTimer > 0) {
  1396. attackTimer--;
  1397. }
  1398.  
  1399. if (followId > 0) {
  1400. getPA().followPlayer();
  1401. } else if (followId2 > 0) {
  1402. getPA().followNpc();
  1403. }
  1404.  
  1405. if (hitDelay == 1) {
  1406. if (oldNpcIndex > 0) {
  1407. getCombat().delayedHit(this, oldNpcIndex);
  1408. }
  1409. }
  1410. if (attackTimer <= 1) {
  1411. if (npcIndex > 0 && clickNpcType == 0) {
  1412. getCombat().attackNpc(npcIndex);
  1413. }
  1414. if (playerIndex > 0) {
  1415. getCombat().attackPlayer(playerIndex);
  1416. }
  1417. }
  1418.  
  1419. }
  1420.  
  1421. public void setCurrentTask(Future<?> task) {
  1422. currentTask = task;
  1423. }
  1424.  
  1425. public Future<?> getCurrentTask() {
  1426. return currentTask;
  1427. }
  1428.  
  1429. public Stream getInStream() {
  1430. return inStream;
  1431. }
  1432.  
  1433. public int getPacketType() {
  1434. return packetType;
  1435. }
  1436.  
  1437. public int getPacketSize() {
  1438. return packetSize;
  1439. }
  1440.  
  1441. public Stream getOutStream() {
  1442. return outStream;
  1443. }
  1444.  
  1445. public ItemAssistant getItems() {
  1446. return itemAssistant;
  1447. }
  1448.  
  1449. public PlayerAssistant getPA() {
  1450. return playerAssistant;
  1451. }
  1452.  
  1453. public DialogueHandler getDH() {
  1454. return dialogueHandler;
  1455. }
  1456.  
  1457. public DialogueManager dialogue() {
  1458. return dialogue;
  1459. }
  1460.  
  1461. public ShopAssistant getShops() {
  1462. return shopAssistant;
  1463. }
  1464.  
  1465. public CombatAssistant getCombat() {
  1466. return combat;
  1467. }
  1468.  
  1469. public ActionHandler getActions() {
  1470. return actionHandler;
  1471. }
  1472.  
  1473. public Killstreak getStreak() {
  1474. return killingStreak;
  1475. }
  1476.  
  1477. public Channel getSession() {
  1478. return session;
  1479. }
  1480.  
  1481. public Potions getPotions() {
  1482. return potions;
  1483. }
  1484.  
  1485. public PotionMixing getPotMixing() {
  1486. return potionMixing;
  1487. }
  1488.  
  1489. public Food getFood() {
  1490. return food;
  1491. }
  1492.  
  1493. public boolean ardiRizal() {
  1494. if ((playerEquipment[playerHat] == -1) && (playerEquipment[playerCape] == -1) && (playerEquipment[playerAmulet] == -1)
  1495. && (playerEquipment[playerChest] == -1) && (playerEquipment[playerShield] == -1) && (playerEquipment[playerLegs] == -1)
  1496. && (playerEquipment[playerHands] == -1) && (playerEquipment[playerFeet] == -1) && (playerEquipment[playerWeapon] == -1)) {
  1497. return true;
  1498. } else {
  1499. return false;
  1500. }
  1501. }
  1502.  
  1503. private boolean isBusy = false;
  1504. private boolean isBusyHP = false;
  1505. public boolean isBusyFollow = false;
  1506.  
  1507. public boolean checkBusy() {
  1508. /*
  1509. * if (getCombat().isFighting()) { return true; }
  1510. */
  1511. if (isBusy) {
  1512. // actionAssistant.sendMessage("You are too busy to do that.");
  1513. }
  1514. return isBusy;
  1515. }
  1516.  
  1517. public boolean checkBusyHP() {
  1518. return isBusyHP;
  1519. }
  1520.  
  1521. public boolean checkBusyFollow() {
  1522. return isBusyFollow;
  1523. }
  1524.  
  1525. public void setBusy(boolean isBusy) {
  1526. this.isBusy = isBusy;
  1527. }
  1528.  
  1529. public boolean isBusy() {
  1530. return isBusy;
  1531. }
  1532.  
  1533. public void setBusyFollow(boolean isBusyFollow) {
  1534. this.isBusyFollow = isBusyFollow;
  1535. }
  1536.  
  1537. public void setBusyHP(boolean isBusyHP) {
  1538. this.isBusyHP = isBusyHP;
  1539. }
  1540.  
  1541. public boolean isBusyHP() {
  1542. return isBusyHP;
  1543. }
  1544.  
  1545. public boolean isBusyFollow() {
  1546. return isBusyFollow;
  1547. }
  1548.  
  1549. public int makeTimes;
  1550. public int event;
  1551. public long lastBankDeposit;
  1552. public boolean hasOverloadBoost;
  1553.  
  1554. public boolean canWalk() {
  1555. return canWalk;
  1556. }
  1557.  
  1558. public void setCanWalk(boolean canWalk) {
  1559. this.canWalk = canWalk;
  1560. }
  1561.  
  1562. public PlayerAssistant getPlayerAssistant() {
  1563. return playerAssistant;
  1564. }
  1565.  
  1566. public RangersGuild getRG() {
  1567. return rangersGuild;
  1568. }
  1569.  
  1570. public SkillInterfaces getSI() {
  1571. return skillInterfaces;
  1572. }
  1573.  
  1574. /**
  1575. * Skill Constructors
  1576. */
  1577. public Slayer getSlayer() {
  1578. return slayer;
  1579. }
  1580.  
  1581. public Runecrafting getRunecrafting() {
  1582. return runecrafting;
  1583. }
  1584.  
  1585. public Cooking getCooking() {
  1586. return cooking;
  1587. }
  1588.  
  1589. public Agility getAgility() {
  1590. return agility;
  1591. }
  1592.  
  1593. public Crafting getCrafting() {
  1594. return crafting;
  1595. }
  1596.  
  1597. public Barrows getBarrows() {
  1598. return barrows;
  1599. }
  1600.  
  1601. public Thieving getThieving() {
  1602. return thieving;
  1603. }
  1604.  
  1605. public Herblore getHerblore() {
  1606. return herblore;
  1607. }
  1608.  
  1609. public GnomeAgility getGnomeAgility() {
  1610. return gnomeAgility;
  1611. }
  1612.  
  1613. public PointItems getPoints() {
  1614. return pointItems;
  1615. }
  1616.  
  1617. public PlayerAction getPlayerAction() {
  1618. return playerAction;
  1619. }
  1620.  
  1621. public WildernessAgility getWildernessAgility() {
  1622. return wildernessAgility;
  1623. }
  1624.  
  1625. public AgilityHandler getAgilityHandler() {
  1626. return agilityHandler;
  1627. }
  1628.  
  1629. public Smithing getSmithing() {
  1630. return smith;
  1631. }
  1632.  
  1633. public Logs getLogs() {
  1634. return logs;
  1635. }
  1636.  
  1637. public FightCave getFightCave() {
  1638. if (fightcave == null)
  1639. fightcave = new FightCave(this);
  1640. return fightcave;
  1641. }
  1642.  
  1643. public SmithingInterface getSmithingInt() {
  1644. return smithInt;
  1645. }
  1646.  
  1647. /*
  1648. * public Fletching getFletching() { return fletching; }
  1649. */
  1650.  
  1651. public Prayer getPrayer() {
  1652. return prayer;
  1653. }
  1654.  
  1655. /**
  1656. * End of Skill Constructors
  1657. */
  1658.  
  1659. public void queueMessage(Packet arg1) {
  1660. packetsReceived.incrementAndGet();
  1661. queuedPackets.add(arg1);
  1662. }
  1663.  
  1664. public boolean processQueuedPackets() {
  1665. Packet p = null;
  1666. int processed = 0;
  1667. packetsReceived.set(0);
  1668. while ((p = queuedPackets.poll()) != null) {
  1669. if (processed > Config.MAX_INCOMONG_PACKETS_PER_CYCLE) {
  1670. break;
  1671. }
  1672. inStream.currentOffset = 0;
  1673. packetType = p.getOpcode();
  1674. packetSize = p.getLength();
  1675. inStream.buffer = p.getPayload().array();
  1676. if (packetType > 0) {
  1677. PacketHandler.processPacket(this, packetType, packetSize);
  1678. processed++;
  1679. }
  1680. }
  1681. return true;
  1682. }
  1683.  
  1684. public void correctCoordinates() {
  1685. final Boundary pc = PestControl.GAME_BOUNDARY;
  1686. final Boundary fc = Boundary.FIGHT_CAVE;
  1687. int x = teleportToX;
  1688. int y = teleportToY;
  1689. if (x > pc.getMinimumX() && x < pc.getMaximumX() && y > pc.getMinimumY() && y < pc.getMaximumY()) {
  1690. getPA().movePlayer(2657, 2639, 0);
  1691. } else if (x > fc.getMinimumX() && x < fc.getMaximumX() && y > fc.getMinimumY() && y < fc.getMaximumY()) {
  1692. getPA().movePlayer(absX, absY, playerId * 4);
  1693. sendMessage("Wave " + (this.waveId + 1) + " will start in approximately 5-10 seconds. ");
  1694. getFightCave().spawn();
  1695. }
  1696. }
  1697.  
  1698. public int getPrivateChat() {
  1699. return privateChat;
  1700. }
  1701.  
  1702. public Friends getFriends() {
  1703. return friend;
  1704. }
  1705.  
  1706. public Ignores getIgnores() {
  1707. return ignores;
  1708. }
  1709.  
  1710. public void setPrivateChat(int option) {
  1711. this.privateChat = option;
  1712. }
  1713.  
  1714. public Trade getTrade() {
  1715. return trade;
  1716. }
  1717.  
  1718. public Position getPosition() {
  1719. return new Position(absX, absY, heightLevel);
  1720. }
  1721.  
  1722. public int localX() {
  1723. return this.getX() - this.getMapRegionX() * 8;
  1724. }
  1725.  
  1726. public int localY() {
  1727. return this.getY() - this.getMapRegionY() * 8;
  1728. }
  1729.  
  1730. public AchievementHandler getAchievements() {
  1731. if (achievementHandler == null)
  1732. achievementHandler = new AchievementHandler(this);
  1733. return achievementHandler;
  1734. }
  1735.  
  1736. public HolidayStages getHolidayStages() {
  1737. if (holidayStages == null) {
  1738. holidayStages = new HolidayStages();
  1739. }
  1740. return holidayStages;
  1741. }
  1742.  
  1743. public long getLastContainerSearch() {
  1744. return lastContainerSearch;
  1745. }
  1746.  
  1747. public void setLastContainerSearch(long lastContainerSearch) {
  1748. this.lastContainerSearch = lastContainerSearch;
  1749. }
  1750.  
  1751. public MysteryBox getMysteryBox() {
  1752. return mysteryBox;
  1753. }
  1754.  
  1755. public DamageQueueEvent getDamageQueue() {
  1756. return damageQueue;
  1757. }
  1758.  
  1759. public void addDamageReceived(String player, int damage) {
  1760. if (damage <= 0) {
  1761. return;
  1762. }
  1763. Damage combatDamage = new Damage(damage);
  1764. if (damageReceived.containsKey(player)) {
  1765. damageReceived.get(player).add(new Damage(damage));
  1766. } else {
  1767. damageReceived.put(player, new ArrayList<>(Arrays.asList(combatDamage)));
  1768. }
  1769. }
  1770.  
  1771. public void resetDamageReceived() {
  1772. damageReceived.clear();
  1773. }
  1774.  
  1775. private String killer;
  1776. public boolean craftDialogue;
  1777.  
  1778. public String getPlayerKiller() {
  1779. String killer = null;
  1780. int totalDamage = 0;
  1781. for (Entry<String, ArrayList<Damage>> entry : damageReceived.entrySet()) {
  1782. String player = entry.getKey();
  1783. ArrayList<Damage> damageList = entry.getValue();
  1784. int damage = 0;
  1785. for (Damage d : damageList) {
  1786. if (System.currentTimeMillis() - d.getTimestamp() < 90000) {
  1787. damage += d.getAmount();
  1788. }
  1789. }
  1790. if (totalDamage == 0 || damage > totalDamage || killer == null) {
  1791. totalDamage = damage;
  1792. killer = player;
  1793. }
  1794. }
  1795. return killer;
  1796. }
  1797.  
  1798. public String getKiller() {
  1799. return killer;
  1800. }
  1801.  
  1802. public void setKiller(String killer) {
  1803. this.killer = killer;
  1804. }
  1805.  
  1806. private boolean killedByZombie = false;
  1807. public boolean isAnimatedArmourSpawned;
  1808. private Hitmark hitmark = null;
  1809. private Hitmark secondHitmark = null;
  1810. protected Rights rights = Rights.PLAYER;
  1811. private Titles titles = new Titles(this);
  1812. private boolean invisible;
  1813. private boolean godmode;
  1814. private boolean safemode;
  1815. private double dropModifier = 1;
  1816. private int debug = 0;
  1817. private boolean trading;
  1818. public boolean playerIsCrafting;
  1819. public boolean hasNpc = false;
  1820. public boolean updateItems = false;
  1821. public int ratsCaught;
  1822. public int summonId;
  1823. public int bossKills;
  1824. public int droppedItem = -1;
  1825. public int kbdCount;
  1826. public int dagannothCount;
  1827. public int krakenCount;
  1828. public int chaosCount;
  1829. public int armaCount;
  1830. public int bandosCount;
  1831. public int saraCount;
  1832. public int zammyCount;
  1833. public int barrelCount;
  1834. public int moleCount;
  1835. public int callistoCount;
  1836. public int venenatisCount;
  1837. public int vetionCount;
  1838. public int rememberNpcIndex;
  1839. public boolean slayerRecipe;
  1840. public boolean claimedReward;
  1841. public long lastMove;
  1842. public long bonusXpTime;
  1843. public long craftingDelay;
  1844. public boolean settingMin;
  1845. public boolean settingMax;
  1846. public boolean settingBet;
  1847. public int diceMin;
  1848. public int diceMax;
  1849. public int otherDiceId;
  1850. public int betAmount;
  1851. public int totalProfit;
  1852. public int betsWon;
  1853. public int betsLost;
  1854. public Player diceHost;
  1855. public int removedTasks[] = { -1, -1, -1, -1 };
  1856. public long buySlayerTimer;
  1857. public long lastFire;
  1858. public boolean needsNewTask = false;
  1859. public boolean keepTitle = false;
  1860. public boolean killTitle = false;
  1861. public int slayerPoints = 0;
  1862. public int killStreak;
  1863. public boolean hide = false;
  1864. public ArrayList<String> killedPlayers = new ArrayList<String>();
  1865. public ArrayList<Integer> attackedPlayers = new ArrayList<Integer>();
  1866. public ArrayList<String> lastConnectedFrom = new ArrayList<String>();
  1867. private boolean stopPlayer;
  1868. /**
  1869. * Clan Chat Variables
  1870. */
  1871. public Clan clan;
  1872. public String clanName;
  1873. public String properName;
  1874. public String lastClanChat = "";
  1875. public long lastMysteryBox;
  1876. public int waveType;
  1877. public int[] waveInfo = new int[3];
  1878. public String date;
  1879. public String currentTime;
  1880. public int day;
  1881. public int month;
  1882. public int YEAR;
  1883. public int totalLevel;
  1884. public int xpTotal;
  1885. public int smeltAmount = 0;
  1886. public int smeltEventId = 5567;
  1887. public String barType = "";
  1888. public Smelting.Bars bar = null;
  1889. public boolean isSmelting = false;
  1890. public long lastSmelt = 0;
  1891. /**
  1892. * Title Variables
  1893. */
  1894. public String playerTitle = "";
  1895. /**
  1896. * Event Variables
  1897. */
  1898. public boolean hasEvent;
  1899. /**
  1900. * Achievement Variables
  1901. */
  1902. public int achievementsCompleted;
  1903. public int achievementPoints;
  1904. public int fireslit;
  1905. public int crabsKilled;
  1906. public int treesCut;
  1907. public boolean expLock = false;
  1908. public boolean buyingX;
  1909. public boolean leverClicked = false;
  1910. public double crossbowDamage;
  1911. public int pkp;
  1912. public int cwKills;
  1913. public int cwDeaths;
  1914. public int cwGames;
  1915. public int KC;
  1916. public int DC;
  1917. public int votePoints;
  1918. public int amDonated;
  1919. public boolean[] clanWarRule = new boolean[10];
  1920. public int follow2 = 0;
  1921. public int antiqueSelect = 0;
  1922. public boolean usingLamp = false;
  1923. public boolean normalLamp = false;
  1924. public boolean antiqueLamp = false;
  1925. public int[][] playerSkillProp = new int[20][15];
  1926. public boolean[] playerSkilling = new boolean[20];
  1927. public boolean setPin = false;
  1928. public String bankPin = "";
  1929. public boolean teleporting;
  1930. public long jailEnd;
  1931. public long muteEnd;
  1932. public long marketMuteEnd;
  1933. public long banEnd;
  1934. public long lastReport = 0;
  1935. public int level1 = 0;
  1936. public int level2 = 0;
  1937. public int level3 = 0;
  1938. public String lastReported = "";
  1939. public long lastButton;
  1940. public int leatherType = -1;
  1941. public boolean isWc;
  1942. public int homeTele = 0;
  1943. public int homeTeleDelay = 0;
  1944. public boolean wcing;
  1945. public int treeX;
  1946. public int treeY;
  1947. public long miscTimer;
  1948. public boolean canWalk = true;
  1949. public long lastFlower;
  1950. public long waitTime;
  1951. public boolean usingROD = false;
  1952. public int DELAY = 1250;
  1953. public long saveButton = 0;
  1954. public int attempts = 3;
  1955. public boolean isOperate;
  1956. public int itemUsing;
  1957. public boolean isFullBody = false;
  1958. public boolean isFullHelm = false;
  1959. public boolean isFullMask = false;
  1960. public long lastCast;
  1961. public boolean hasBankPin;
  1962. public boolean enterdBankpin;
  1963. public boolean firstPinEnter;
  1964. public boolean requestPinDelete;
  1965. public boolean secondPinEnter;
  1966. public boolean thirdPinEnter;
  1967. public boolean fourthPinEnter;
  1968. public boolean hasBankpin;
  1969. public int lastLoginDate;
  1970. public int pinset = 0;
  1971. public int bankpin = 0;
  1972. public int playerBankPin;
  1973. public int recoveryDelay = 3;
  1974. public int attemptsRemaining = 3;
  1975. public int lastPinSettings = -1;
  1976. public int setPinDate = -1;
  1977. public int changePinDate = -1;
  1978. public int deletePinDate = -1;
  1979. public int firstPin;
  1980. public int secondPin;
  1981. public int thirdPin;
  1982. public int fourthPin;
  1983. public int bankPin1;
  1984. public int bankPin2;
  1985. public int bankPin3;
  1986. public int bankPin4;
  1987. public int pinDeleteDateRequested;
  1988. public boolean isBanking = true;
  1989. public boolean isCooking = false;
  1990. public boolean initialized = false;
  1991. public boolean disconnected = false;
  1992. public boolean ruleAgreeButton = false;
  1993. public boolean rebuildNPCList = false;
  1994. public boolean isActive = false;
  1995. public boolean isKicked = false;
  1996. public boolean isSkulled = false;
  1997. public boolean friendUpdate = false;
  1998. public boolean newPlayer = false;
  1999. public boolean hasMultiSign = false;
  2000. public boolean saveCharacter = false;
  2001. public boolean mouseButton = false;
  2002. public boolean splitChat = false;
  2003. public boolean chatEffects = true;
  2004. public boolean acceptAid = false;
  2005. public boolean nextDialogue = false;
  2006. public boolean autocasting = false;
  2007. public boolean usedSpecial = false;
  2008. public boolean mageFollow = false;
  2009. public boolean dbowSpec = false;
  2010. public boolean craftingLeather = false;
  2011. public boolean properLogout = false;
  2012. public boolean secDbow = false;
  2013. public boolean maxNextHit = false;
  2014. public boolean ssSpec = false;
  2015. public boolean vengOn = false;
  2016. public boolean addStarter = false;
  2017. public boolean startPack = false;
  2018. public boolean accountFlagged = false;
  2019. public boolean msbSpec = false;
  2020. public boolean dtOption = false;
  2021. public boolean dtOption2 = false;
  2022. public boolean doricOption = false;
  2023. public boolean doricOption2 = false;
  2024. public boolean caOption2 = false;
  2025. public boolean caOption2a = false;
  2026. public boolean caOption4a = false;
  2027. public boolean caOption4b = false;
  2028. public boolean caOption4c = false;
  2029. public boolean caPlayerTalk1 = false;
  2030. public boolean horrorOption = false;
  2031. public boolean rfdOption = false;
  2032. public boolean inDt = false;
  2033. public boolean inHfd = false;
  2034. public boolean disableAttEvt = false;
  2035. public boolean AttackEventRunning = false;
  2036. public boolean npcindex;
  2037. public boolean spawned = false;
  2038. public int saveDelay;
  2039. public int height = 0;
  2040. public int playerKilled;
  2041. public int totalPlayerDamageDealt;
  2042. public int killedBy;
  2043. public int lastChatId = 1;
  2044. public int friendSlot = 0;
  2045. public int dialogueId;
  2046. public int randomCoffin;
  2047. public int newLocation;
  2048. public int specEffect;
  2049. public int specBarId;
  2050. public int attackLevelReq;
  2051. public int defenceLevelReq;
  2052. public int strengthLevelReq;
  2053. public int rangeLevelReq;
  2054. public int magicLevelReq;
  2055. public int followId;
  2056. public int skullTimer;
  2057. public int votingPoints;
  2058. public int nextChat = 0;
  2059. public int talkingNpc = -1;
  2060. public int dialogueAction = 0;
  2061. public int autocastId;
  2062. public int followDistance;
  2063. public int followId2;
  2064. public int barrageCount = 0;
  2065. public int delayedDamage = 0;
  2066. public int delayedDamage2 = 0;
  2067. public int pcPoints = 0;
  2068. public int donatorPoints = 0;
  2069. public int magePoints = 0;
  2070. public int lastArrowUsed = -1;
  2071. public int clanId = -1;
  2072. public int autoRet = 0;
  2073. public int pcDamage = 0;
  2074. public int xInterfaceId = 0;
  2075. public int xRemoveId = 0;
  2076. public int xRemoveSlot = 0;
  2077. public int tzhaarToKill = 0;
  2078. public int tzhaarKilled = 0;
  2079. public int waveId;
  2080. public int frozenBy = 0;
  2081. public int teleAction = 0;
  2082. public int newPlayerAct = 0;
  2083. public int bonusAttack = 0;
  2084. public int lastNpcAttacked = 0;
  2085. public int killCount = 0;
  2086. public int actionTimer;
  2087. public int rfdRound = 0;
  2088. public int roundNpc = 0;
  2089. public int desertTreasure = 0;
  2090. public int horrorFromDeep = 0;
  2091. public int QuestPoints = 0;
  2092. public int doricQuest = 0;
  2093. public int[] voidStatus = new int[5];
  2094. public int[] itemKeptId = new int[4];
  2095. public int[] pouches = new int[4];
  2096. public final int[] POUCH_SIZE = { 3, 6, 9, 12 };
  2097. public boolean[] invSlot = new boolean[28];
  2098. public boolean[] equipSlot = new boolean[14];
  2099. public long friends[] = new long[200];
  2100. public double specAmount = 0;
  2101. public double specAccuracy = 1;
  2102. public double specDamage = 1;
  2103. public double prayerPoint = 1.0;
  2104. public boolean storing = false;
  2105. public int teleGrabItem;
  2106. public int teleGrabX;
  2107. public int teleGrabY;
  2108. public int duelCount;
  2109. public int underAttackBy;
  2110. public int underAttackBy2;
  2111. public int wildLevel;
  2112. public int teleTimer;
  2113. public int respawnTimer;
  2114. public int saveTimer = 0;
  2115. public int teleBlockLength;
  2116. public long lastPlayerMove = System.currentTimeMillis();
  2117. public Stopwatch lastSpear = new Stopwatch();
  2118. public Stopwatch lastProtItem = new Stopwatch();
  2119. public long dfsDelay = System.currentTimeMillis();
  2120. public Stopwatch lastVeng = new Stopwatch();
  2121. public Stopwatch lastYell = new Stopwatch();
  2122. public long teleGrabDelay = System.currentTimeMillis();
  2123. public long protMageDelay = System.currentTimeMillis();
  2124. public long protMeleeDelay = System.currentTimeMillis();
  2125. public long protRangeDelay = System.currentTimeMillis();
  2126. public long lastAction = System.currentTimeMillis();
  2127. public long lastThieve = System.currentTimeMillis();
  2128. public long lastLockPick = System.currentTimeMillis();
  2129. public long alchDelay = System.currentTimeMillis();
  2130. public long specCom = System.currentTimeMillis();
  2131. public Stopwatch specDelay = new Stopwatch();
  2132. public long duelDelay = System.currentTimeMillis();
  2133. public long teleBlockDelay = System.currentTimeMillis();
  2134. public long godSpellDelay = System.currentTimeMillis();
  2135. public Stopwatch singleCombatDelay = new Stopwatch();
  2136. public Stopwatch singleCombatDelay2 = new Stopwatch();
  2137. public long reduceStat = System.currentTimeMillis();
  2138. public long restoreStatsDelay = System.currentTimeMillis();
  2139. public Stopwatch logoutDelay = new Stopwatch();
  2140. public long buryDelay = System.currentTimeMillis();
  2141. public long cleanDelay = System.currentTimeMillis();
  2142. public Stopwatch lastRare = new Stopwatch();
  2143. public long diceDelay;
  2144. public Stopwatch foodDelay = new Stopwatch();
  2145. public Stopwatch ditchDelay = new Stopwatch();
  2146. public Stopwatch switchDelay = new Stopwatch();
  2147. public Stopwatch potDelay = new Stopwatch();
  2148. public boolean canChangeAppearance = false;
  2149. public boolean mageAllowed;
  2150. public int focusPointX = -1;
  2151. public int focusPointY = -1;
  2152. public int questPoints = 0;
  2153. public int cooksA;
  2154. public int lastDtKill = 0;
  2155. public int dtHp = 0;
  2156. public int dtMax = 0;
  2157. public int dtAtk = 0;
  2158. public int dtDef = 0;
  2159. public int desertT;
  2160. public long lastChat;
  2161. public long lastRandom;
  2162. public long lastCaught = 0;
  2163. public long lastAttacked;
  2164. public long homeTeleTime;
  2165. public long lastDagChange = -1;
  2166. public long reportDelay;
  2167. public long lastPlant;
  2168. public long objectTimer;
  2169. public long npcTimer;
  2170. public long lastEss;
  2171. public long lastClanMessage;
  2172. public int DirectionCount = 0;
  2173. public boolean appearanceUpdateRequired = true;
  2174. public int hitDiff2;
  2175. public int hitDiff = 0;
  2176. public boolean hitUpdateRequired2;
  2177. public boolean hitUpdateRequired = false;
  2178. public boolean isDead = false;
  2179. public boolean randomEvent = false;
  2180. public boolean FirstClickRunning = false;
  2181. public boolean WildernessWarning = false;
  2182. protected boolean faceNPCupdate = false;
  2183. public int faceNPC = -1;
  2184. public int[] keepItems = new int[4];
  2185. public int[] keepItemsN = new int[4];
  2186. public int WillKeepAmt1;
  2187. public int WillKeepAmt2;
  2188. public int WillKeepAmt3;
  2189. public int WillKeepAmt4;
  2190. public int WillKeepItem1;
  2191. public int WillKeepItem2;
  2192. public int WillKeepItem3;
  2193. public int WillKeepItem4;
  2194. public int WillKeepItem1Slot;
  2195. public int WillKeepItem2Slot;
  2196. public int WillKeepItem3Slot;
  2197. public int WillKeepItem4Slot;
  2198. public int EquipStatus;
  2199. public final int[] BOWS = { 12788, 9185, 11785, 839, 845, 847, 851, 855, 859, 841, 843, 849, 853, 857, 12424, 861, 4212, 4214, 4215, 12765, 12766,
  2200. 12767, 12768, 11235, 4216, 4217, 4218, 4219, 4220, 4221, 4222, 4223, 6724, 4734, 4934, 4935, 4936, 4937 };
  2201. public final int[] ARROWS = { 882, 884, 886, 888, 890, 892, 4740, 11212, 9140, 9141, 4142, 9143, 9144, 9240, 9241, 9242, 9243, 9244, 9245 };
  2202. public final int[] NO_ARROW_DROP = { 4212, 4214, 4215, 4216, 4217, 4218, 4219, 4220, 4221, 4222, 4223, 4734, 4934, 4935, 4936, 4937 };
  2203. public final int[] OTHER_RANGE_WEAPONS = { 863, 864, 865, 866, 867, 868, 869, 806, 807, 808, 809, 810, 811, 825, 826, 827, 828, 829, 830, 800,
  2204. 801, 802, 803, 804, 805, 6522 };
  2205. public final int[][] MAGIC_SPELLS = {
  2206. // example {magicId, level req, animation, startGFX, projectile Id,
  2207. // endGFX, maxhit, exp gained, rune 1, rune 1 amount, rune 2, rune 2
  2208. // amount, rune 3, rune 3 amount, rune 4, rune 4 amount}
  2209.  
  2210. // Modern Spells
  2211. { 1152, 1, 711, 90, 91, 92, 2, 5, 556, 1, 558, 1, 0, 0, 0, 0 }, // wind
  2212. // strike
  2213. { 1154, 5, 711, 93, 94, 95, 4, 7, 555, 1, 556, 1, 558, 1, 0, 0 }, // water
  2214. // strike
  2215. { 1156, 9, 711, 96, 97, 98, 6, 9, 557, 2, 556, 1, 558, 1, 0, 0 }, // earth
  2216. // strike
  2217. { 1158, 13, 711, 99, 100, 101, 8, 11, 554, 3, 556, 2, 558, 1, 0, 0 }, // fire
  2218. // strike
  2219. { 1160, 17, 711, 117, 118, 119, 9, 13, 556, 2, 562, 1, 0, 0, 0, 0 }, // wind
  2220. // bolt
  2221. { 1163, 23, 711, 120, 121, 122, 10, 16, 556, 2, 555, 2, 562, 1, 0, 0 }, // water
  2222. // bolt
  2223. { 1166, 29, 711, 123, 124, 125, 11, 20, 556, 2, 557, 3, 562, 1, 0, 0 }, // earth
  2224. // bolt
  2225. { 1169, 35, 711, 126, 127, 128, 12, 22, 556, 3, 554, 4, 562, 1, 0, 0 }, // fire
  2226. // bolt
  2227. { 1172, 41, 711, 132, 133, 134, 13, 25, 556, 3, 560, 1, 0, 0, 0, 0 }, // wind
  2228. // blast
  2229. { 1175, 47, 711, 135, 136, 137, 14, 28, 556, 3, 555, 3, 560, 1, 0, 0 }, // water
  2230. // blast
  2231. { 1177, 53, 711, 138, 139, 140, 15, 31, 556, 3, 557, 4, 560, 1, 0, 0 }, // earth
  2232. // blast
  2233. { 1181, 59, 711, 129, 130, 131, 16, 35, 556, 4, 554, 5, 560, 1, 0, 0 }, // fire
  2234. // blast
  2235. { 1183, 62, 711, 158, 159, 160, 17, 36, 556, 5, 565, 1, 0, 0, 0, 0 }, // wind
  2236. // wave
  2237. { 1185, 65, 711, 161, 162, 163, 18, 37, 556, 5, 555, 7, 565, 1, 0, 0 }, // water
  2238. // wave
  2239. { 1188, 70, 711, 164, 165, 166, 19, 40, 556, 5, 557, 7, 565, 1, 0, 0 }, // earth
  2240. // wave
  2241. { 1189, 75, 711, 155, 156, 157, 20, 42, 556, 5, 554, 7, 565, 1, 0, 0 }, // fire
  2242. // wave
  2243. { 1153, 3, 716, 102, 103, 104, 0, 13, 555, 3, 557, 2, 559, 1, 0, 0 }, // confuse
  2244. { 1157, 11, 716, 105, 106, 107, 0, 20, 555, 3, 557, 2, 559, 1, 0, 0 }, // weaken
  2245. { 1161, 19, 716, 108, 109, 110, 0, 29, 555, 2, 557, 3, 559, 1, 0, 0 }, // curse
  2246. { 1542, 66, 729, 167, 168, 169, 0, 76, 557, 5, 555, 5, 566, 1, 0, 0 }, // vulnerability
  2247. { 1543, 73, 729, 170, 171, 172, 0, 83, 557, 8, 555, 8, 566, 1, 0, 0 }, // enfeeble
  2248. { 1562, 80, 729, 173, 174, 107, 0, 90, 557, 12, 555, 12, 556, 1, 0, 0 }, // stun
  2249. { 1572, 20, 711, 177, 178, 181, 0, 30, 557, 3, 555, 3, 561, 2, 0, 0 }, // bind
  2250. { 1582, 50, 711, 177, 178, 180, 2, 60, 557, 4, 555, 4, 561, 3, 0, 0 }, // snare
  2251. { 1592, 79, 711, 177, 178, 179, 4, 90, 557, 5, 555, 5, 561, 4, 0, 0 }, // entangle
  2252. { 1171, 39, 724, 145, 146, 147, 15, 25, 556, 2, 557, 2, 562, 1, 0, 0 }, // crumble
  2253. // undead
  2254. { 1539, 50, 708, 87, 88, 89, 25, 42, 554, 5, 560, 1, 0, 0, 0, 0 }, // iban
  2255. // blast
  2256. { 12037, 50, 1576, 327, 328, 329, 19, 30, 560, 1, 558, 4, 0, 0, 0, 0 }, // magic
  2257. // dart
  2258. { 1190, 60, 811, 0, 0, 76, 20, 60, 554, 2, 565, 2, 556, 4, 0, 0 }, // sara
  2259. // strike
  2260. { 1191, 60, 811, 0, 0, 77, 20, 60, 554, 1, 565, 2, 556, 4, 0, 0 }, // cause
  2261. // of
  2262. // guthix
  2263. { 1192, 60, 811, 0, 0, 78, 20, 60, 554, 4, 565, 2, 556, 1, 0, 0 }, // flames
  2264. // of
  2265. // zammy
  2266. { 12445, 85, 1819, 0, 344, 345, 0, 65, 563, 1, 562, 1, 560, 1, 0, 0 }, // teleblock
  2267.  
  2268. // Ancient Spells
  2269. { 12939, 50, 1978, 0, 384, 385, 13, 30, 560, 2, 562, 2, 554, 1, 556, 1 }, // smoke
  2270. // rush
  2271. { 12987, 52, 1978, 0, 378, 379, 14, 31, 560, 2, 562, 2, 566, 1, 556, 1 }, // shadow
  2272. // rush
  2273. { 12901, 56, 1978, 0, 0, 373, 15, 33, 560, 2, 562, 2, 565, 1, 0, 0 }, // blood
  2274. // rush
  2275. { 12861, 58, 1978, 0, 360, 361, 16, 34, 560, 2, 562, 2, 555, 2, 0, 0 }, // ice
  2276. // rush
  2277. { 12963, 62, 1979, 0, 0, 389, 19, 36, 560, 2, 562, 4, 556, 2, 554, 2 }, // smoke
  2278. // burst
  2279. { 13011, 64, 1979, 0, 0, 382, 20, 37, 560, 2, 562, 4, 556, 2, 566, 2 }, // shadow
  2280. // burst
  2281. { 12919, 68, 1979, 0, 0, 376, 21, 39, 560, 2, 562, 4, 565, 2, 0, 0 }, // blood
  2282. // burst
  2283. { 12881, 70, 1979, 0, 0, 363, 22, 40, 560, 2, 562, 4, 555, 4, 0, 0 }, // ice
  2284. // burst
  2285. { 12951, 74, 1978, 0, 386, 387, 23, 42, 560, 2, 554, 2, 565, 2, 556, 2 }, // smoke
  2286. // blitz
  2287. { 12999, 76, 1978, 0, 380, 381, 24, 43, 560, 2, 565, 2, 556, 2, 566, 2 }, // shadow
  2288. // blitz
  2289. { 12911, 80, 1978, 0, 374, 375, 25, 45, 560, 2, 565, 4, 0, 0, 0, 0 }, // blood
  2290. // blitz
  2291. { 12871, 82, 1978, 366, 0, 367, 26, 46, 560, 2, 565, 2, 555, 3, 0, 0 }, // ice
  2292. // blitz
  2293. { 12975, 86, 1979, 0, 0, 391, 27, 48, 560, 4, 565, 2, 556, 4, 554, 4 }, // smoke
  2294. // barrage
  2295. { 13023, 88, 1979, 0, 0, 383, 28, 49, 560, 4, 565, 2, 556, 4, 566, 3 }, // shadow
  2296. // barrage
  2297. { 12929, 92, 1979, 0, 0, 377, 29, 51, 560, 4, 565, 4, 566, 1, 0, 0 }, // blood
  2298. // barrage
  2299. { 12891, 94, 1979, 0, 0, 369, 30, 52, 560, 4, 565, 2, 555, 6, 0, 0 }, // ice
  2300. // barrage
  2301.  
  2302. { -1, 80, 811, 301, 0, 0, 0, 0, 554, 3, 565, 3, 556, 3, 0, 0 }, // charge
  2303. { -1, 21, 712, 112, 0, 0, 0, 10, 554, 3, 561, 1, 0, 0, 0, 0 }, // low
  2304. // alch
  2305. { -1, 55, 713, 113, 0, 0, 0, 20, 554, 5, 561, 1, 0, 0, 0, 0 }, // high
  2306. // alch
  2307. { -1, 33, 728, 142, 143, 144, 0, 35, 556, 1, 563, 1, 0, 0, 0, 0 }, // telegrab
  2308.  
  2309. { -1, 75, 719, 1251, 1252, 1253, 29, 35, 0, 0, 0, 0, 0, 0, 0, 0 }, // trident
  2310. // of
  2311. // the
  2312. // seas
  2313.  
  2314. { -1, 75, 719, 665, 1040, 1042, 32, 35, 0, 0, 0, 0, 0, 0, 0, 0 } // trident
  2315. // of
  2316. // the
  2317. // swamp
  2318.  
  2319. };
  2320. public boolean multiAttacking;
  2321. public boolean rangeEndGFXHeight;
  2322. public boolean playerFletch;
  2323. public boolean playerIsFletching;
  2324. public boolean playerIsMining;
  2325. public boolean playerIsFiremaking;
  2326. public boolean playerIsFishing;
  2327. public boolean playerIsCooking;
  2328. public boolean below459 = true;
  2329. public boolean defaultWealthTransfer;
  2330. public boolean updateInventory;
  2331. public boolean oldSpec;
  2332. public boolean stopPlayerSkill;
  2333. public boolean playerStun;
  2334. public boolean stopPlayerPacket;
  2335. public boolean usingClaws;
  2336. public boolean playerBFishing;
  2337. public boolean finishedBarbarianTraining;
  2338. public boolean ignoreDefence;
  2339. public boolean secondFormAutocast;
  2340. public boolean usingArrows;
  2341. public boolean usingOtherRangeWeapons;
  2342. public boolean usingCross;
  2343. public boolean magicDef;
  2344. public boolean spellSwap;
  2345. public boolean recoverysSet;
  2346. public int rangeEndGFX;
  2347. public int boltDamage;
  2348. public int teleotherType;
  2349. public int playerTradeWealth;
  2350. public int doAmount;
  2351. public int woodcuttingTree;
  2352. public int stageT;
  2353. public int dfsCount;
  2354. public int recoilHits;
  2355. public int playerDialogue;
  2356. public int clawDelay;
  2357. public int previousDamage;
  2358. public boolean protectItem = false;
  2359. public int[] autocastIds = { 51133, 32, 51185, 33, 51091, 34, 24018, 35, 51159, 36, 51211, 37, 51111, 38, 51069, 39, 51146, 40, 51198, 41, 51102,
  2360. 42, 51058, 43, 51172, 44, 51224, 45, 51122, 46, 51080, 47, 7038, 0, 7039, 1, 7040, 2, 7041, 3, 7042, 4, 7043, 5, 7044, 6, 7045, 7, 7046,
  2361. 8, 7047, 9, 7048, 10, 7049, 11, 7050, 12, 7051, 13, 7052, 14, 7053, 15, 47019, 27, 47020, 25, 47021, 12, 47022, 13, 47023, 14, 47024,
  2362. 15 };
  2363. public int[][] barrowsNpcs = { { 1677, 0 }, // verac
  2364. { 1676, 0 }, // toarg
  2365. { 1675, 0 }, // karil
  2366. { 1674, 0 }, // guthan
  2367. { 1673, 0 }, // dharok
  2368. { 1672, 0 } // ahrim
  2369. };
  2370. public int barrowsKillCount;
  2371. public int reduceSpellId;
  2372. public final int[] REDUCE_SPELL_TIME = { 250000, 250000, 250000, 500000, 500000, 500000 };
  2373. public long[] reduceSpellDelay = new long[6];
  2374. public final int[] REDUCE_SPELLS = { 1153, 1157, 1161, 1542, 1543, 1562 };
  2375. public boolean[] canUseReducingSpell = { true, true, true, true, true, true };
  2376. public int slayerTask;
  2377. public int taskAmount;
  2378. public int prayerId = -1;
  2379. public int headIcon = -1;
  2380. public int bountyIcon = 0;
  2381. public long stopPrayerDelay;
  2382. public long prayerDelay;
  2383. public boolean usingPrayer;
  2384. public final int[] PRAYER_DRAIN_RATE = { 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500,
  2385. 500, 500, 500, 500, 500 };
  2386. public final int[] PRAYER_LEVEL_REQUIRED = { 1, 4, 7, 8, 9, 10, 13, 16, 19, 22, 25, 26, 27, 28, 31, 34, 37, 40, 43, 44, 45, 46, 49, 52, 60, 70 };
  2387. public final int[] PRAYER = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 };
  2388. public final String[] PRAYER_NAME = { "Thick Skin", "Burst of Strength", "Clarity of Thought", "Sharp Eye", "Mystic Will", "Rock Skin",
  2389. "Superhuman Strength", "Improved Reflexes", "Rapid Restore", "Rapid Heal", "Protect Item", "Hawk Eye", "Mystic Lore", "Steel Skin",
  2390. "Ultimate Strength", "Incredible Reflexes", "Protect from Magic", "Protect from Missiles", "Protect from Melee", "Eagle Eye",
  2391. "Mystic Might", "Retribution", "Redemption", "Smite", "Chivalry", "Piety" };
  2392. public final int[] PRAYER_GLOW = { 83, 84, 85, 601, 602, 86, 87, 88, 89, 90, 91, 603, 604, 92, 93, 94, 95, 96, 97, 605, 606, 98, 99, 100, 607,
  2393. 608 };
  2394. public final int[] PRAYER_HEAD_ICONS = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2, 1, 0, -1, -1, 3, 5, 4, -1, -1 };
  2395. public boolean[] prayerActive = { false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false,
  2396. false, false, false, false, false, false, false, false, false, false };
  2397. public int headIconPk = -1;
  2398. public int headIconHints;
  2399. public boolean[] duelRule = new boolean[22];
  2400. public boolean doubleHit;
  2401. public boolean usingSpecial;
  2402. public boolean npcDroppingItems;
  2403. public boolean usingRangeWeapon;
  2404. public boolean usingBow;
  2405. public boolean usingMagic;
  2406. public boolean castingMagic;
  2407. public boolean usingMelee;
  2408. public int specMaxHitIncrease;
  2409. public int freezeDelay;
  2410. public int freezeTimer = -6;
  2411. public int killerId;
  2412. public int playerIndex;
  2413. public int oldPlayerIndex;
  2414. public int lastWeaponUsed;
  2415. public int projectileStage;
  2416. public int crystalBowArrowCount;
  2417. public int playerMagicBook;
  2418. public int teleGfx;
  2419. public int teleEndAnimation;
  2420. public int teleHeight;
  2421. public int teleX;
  2422. public int teleY;
  2423. public int rangeItemUsed;
  2424. public int killingNpcIndex;
  2425. public int totalDamageDealt;
  2426. public int oldNpcIndex;
  2427. public int fightMode;
  2428. public int attackTimer;
  2429. public int npcIndex;
  2430. public int npcClickIndex;
  2431. public int npcType;
  2432. public int castingSpellId;
  2433. public int oldSpellId;
  2434. public int spellId;
  2435. public int hitDelay;
  2436. public boolean magicFailed;
  2437. public boolean oldMagicFailed;
  2438. public int bowSpecShot;
  2439. public int clickNpcType;
  2440. public int clickObjectType;
  2441. public int objectId;
  2442. public int objectX;
  2443. public int objectY;
  2444. public int objectXOffset;
  2445. public int objectYOffset;
  2446. public int objectDistance;
  2447. public int pItemX;
  2448. public int pItemY;
  2449. public int pItemId;
  2450. public boolean isMoving;
  2451. public boolean walkingToItem;
  2452. public boolean isShopping;
  2453. public boolean updateShop;
  2454. public int myShopId;
  2455. public int tradeStatus;
  2456. public int tradeWith;
  2457. public int amountGifted;
  2458. public boolean forcedChatUpdateRequired;
  2459. public boolean inDuel;
  2460. public boolean tradeAccepted;
  2461. public boolean goodTrade;
  2462. public boolean inTrade;
  2463. public boolean tradeRequested;
  2464. public boolean tradeResetNeeded;
  2465. public boolean tradeConfirmed;
  2466. public boolean tradeConfirmed2;
  2467. public boolean canOffer;
  2468. public boolean acceptTrade;
  2469. public boolean acceptedTrade;
  2470. public int attackAnim;
  2471. public int animationRequest = -1;
  2472. public int animationWaitCycles;
  2473. public int[] playerBonus = new int[12];
  2474. public boolean isRunning2 = true;
  2475. public boolean takeAsNote;
  2476. public int combatLevel;
  2477. public boolean saveFile = false;
  2478. public int playerAppearance[] = new int[13];
  2479. public int apset;
  2480. public int actionID;
  2481. public int wearItemTimer;
  2482. public int wearId;
  2483. public int wearSlot;
  2484. public int interfaceId;
  2485. public int XremoveSlot;
  2486. public int XinterfaceID;
  2487. public int XremoveID;
  2488. public int Xamount;
  2489. public int tutorial = 15;
  2490. public boolean usingGlory = false;
  2491. public int[] woodcut = new int[7];
  2492. public int wcTimer = 0;
  2493. public int miningTimer = 0;
  2494. public boolean fishing = false;
  2495. public int fishTimer = 0;
  2496. public int smeltType;
  2497. public int smeltTimer = 0;
  2498. public boolean smeltInterface;
  2499. public boolean patchCleared;
  2500. public int[] farm = new int[2];
  2501. public long lastAntifirePotion;
  2502. public long antifireDelay;
  2503. /**
  2504. * Castle Wars
  2505. */
  2506. public int castleWarsTeam;
  2507. public boolean inCwGame;
  2508. public boolean inCwWait;
  2509. public int npcId2 = 0;
  2510. public boolean isNpc;
  2511. /**
  2512. * Fight Pits
  2513. */
  2514. public boolean inPits = false;
  2515. public int pitsStatus = 0;
  2516. public String connectedFrom = "";
  2517. public String globalMessage = "";
  2518. public int playerId = -1;
  2519. public int safeTimer = 0;
  2520. public String playerName = null;
  2521. public String playerName2 = null;
  2522. public String playerPass = null;
  2523. private long nameAsLong;
  2524. public PlayerHandler handler = null;
  2525. public int playerItems[] = new int[28];
  2526. public int playerItemsN[] = new int[28];
  2527. public int bankItems[] = new int[Config.BANK_SIZE];
  2528. public int bankItemsN[] = new int[Config.BANK_SIZE];
  2529. public boolean bankNotes = false;
  2530. private int dragonfireShieldCharge;
  2531. private long lastDragonfireShieldAttack;
  2532. private boolean dragonfireShieldActive;
  2533. public int playerStandIndex = 0x328;
  2534. public int playerTurnIndex = 0x337;
  2535. public int playerWalkIndex = 0x333;
  2536. public int playerTurn180Index = 0x334;
  2537. public int playerTurn90CWIndex = 0x335;
  2538. public int playerTurn90CCWIndex = 0x336;
  2539. public int playerRunIndex = 0x338;
  2540. public static int playerHat = 0;
  2541. public static int playerCape = 1;
  2542. public int playerAmulet = 2;
  2543. public static int playerWeapon = 3;
  2544. public int playerChest = 4;
  2545. public int playerShield = 5;
  2546. public int playerLegs = 7;
  2547. public int playerHands = 9;
  2548. public int playerFeet = 10;
  2549. public int playerRing = 12;
  2550. public int playerArrows = 13;
  2551. public int playerAttack = 0;
  2552. public int playerDefence = 1;
  2553. public int playerStrength = 2;
  2554. public int playerHitpoints = 3;
  2555. public int playerRanged = 4;
  2556. public int playerPrayer = 5;
  2557. public int playerMagic = 6;
  2558. public int playerCooking = 7;
  2559. public int playerWoodcutting = 8;
  2560. public int playerFletching = 9;
  2561. public int playerFishing = 10;
  2562. public int playerFiremaking = 11;
  2563. public static int playerCrafting = 12;
  2564. public static int playerSmithing = 13;
  2565. public int playerMining = 14;
  2566. public int playerHerblore = 15;
  2567. public int playerAgility = 16;
  2568. public int playerThieving = 17;
  2569. public int playerSlayer = 18;
  2570. public int playerFarming = 19;
  2571. public int playerRunecrafting = 20;
  2572. public int fletchingType;
  2573. public int[] playerEquipment = new int[14];
  2574. public int[] playerEquipmentN = new int[14];
  2575. public int[] playerLevel = new int[25];
  2576. public int[] playerXP = new int[25];
  2577. public boolean seedPlanted = false;
  2578. public boolean seedWatered = false;
  2579. public boolean patchCleaned = false;
  2580. public boolean patchRaked = false;
  2581. public int[][] barrowCrypt = { { 4921, 0 }, { 2035, 0 } };
  2582. public Player playerList[] = new Player[maxPlayerListSize];
  2583. public int playerListSize = 0;
  2584. public byte playerInListBitmap[] = new byte[(Config.MAX_PLAYERS + 7) >> 3];
  2585. public NPC npcList[] = new NPC[maxNPCListSize];
  2586. public int npcListSize = 0;
  2587. public byte npcInListBitmap[] = new byte[(NPCHandler.maxNPCs + 7) >> 3];
  2588. public int getHeightLevel;
  2589. public int mapRegionX;
  2590. public int mapRegionY;
  2591. public int absX;
  2592. public int absY;
  2593. public int currentX;
  2594. public int currentY;
  2595. public int heightLevel;
  2596. public int playerSE = 0x328;
  2597. public int playerSEW = 0x333;
  2598. public int playerSER = 0x334;
  2599. public boolean updateRequired = true;
  2600. public final int walkingQueueSize = 50;
  2601. public int walkingQueueX[] = new int[walkingQueueSize];
  2602. public int walkingQueueY[] = new int[walkingQueueSize];
  2603. public int wQueueReadPtr = 0;
  2604. public int wQueueWritePtr = 0;
  2605. public boolean isRunning = true;
  2606. public int teleportToX = -1;
  2607. public int teleportToY = -1;
  2608. public int runEnergy = 100;
  2609. public long lastRunRecovery;
  2610. public long rangeDelay;
  2611. public boolean inSpecMode = false;
  2612. public boolean didTeleport = false;
  2613. public boolean mapRegionDidChange = false;
  2614. public int dir1 = -1;
  2615. public int dir2 = -1;
  2616. public boolean createItems = false;
  2617. public int poimiX = 0;
  2618. public int poimiY = 0;
  2619. public byte cachedPropertiesBitmap[] = new byte[(Config.MAX_PLAYERS + 7) >> 3];
  2620. private boolean chatTextUpdateRequired = false;
  2621. private byte chatText[] = new byte[4096];
  2622. private byte chatTextSize = 0;
  2623. private int chatTextColor = 0;
  2624. private int chatTextEffects = 0;
  2625. public String forcedText = "null";
  2626. /**
  2627. * Graphics
  2628. **/
  2629. public int mask100var1 = 0;
  2630. public int mask100var2 = 0;
  2631. protected boolean mask100update = false;
  2632.  
  2633. /**
  2634. * Represents whether the force-movement update mask is required.
  2635. */
  2636. private boolean forceMovementUpdateRequired;
  2637.  
  2638. public void setForceMovementRequired(boolean required) {
  2639. forceMovementUpdateRequired = required;
  2640. }
  2641.  
  2642. /**
  2643. * Face Update
  2644. **/
  2645. protected boolean faceUpdateRequired = false;
  2646. public int face = -1;
  2647. public int FocusPointX = -1;
  2648. public int FocusPointY = -1;
  2649. private int newWalkCmdX[] = new int[walkingQueueSize];
  2650. private int newWalkCmdY[] = new int[walkingQueueSize];
  2651. public int newWalkCmdSteps = 0;
  2652. private boolean newWalkCmdIsRunning = false;
  2653. protected int travelBackX[] = new int[walkingQueueSize];
  2654. protected int travelBackY[] = new int[walkingQueueSize];
  2655. protected int numTravelBackSteps = 0;
  2656. protected AtomicInteger packetsReceived = new AtomicInteger();
  2657. private ISAACCipher inStreamDecryption = null;
  2658. private ISAACCipher outStreamDecryption = null;
  2659. public int[] damageTaken = new int[Config.MAX_PLAYERS];
  2660. private long lastVenomHit;
  2661. private long lastVenomCure;
  2662. private long venomImmunity;
  2663. private byte venomDamage;
  2664. private long lastPoisonHit;
  2665. private long lastPoisonCure;
  2666. private long poisonImmunity;
  2667. private byte poisonDamage;
  2668. private List<Byte> poisonDamageHistory = new ArrayList<>(4);
  2669. private Player c;
  2670.  
  2671. public boolean isKilledByZombie() {
  2672. return killedByZombie;
  2673. }
  2674.  
  2675. public void setKilledByZombie(boolean state) {
  2676. killedByZombie = state;
  2677. }
  2678.  
  2679. public int getFarmingSeedId(int index) {
  2680. return farmingSeedId[index];
  2681. }
  2682.  
  2683. public void setFarmingSeedId(int index, int farmingSeedId) {
  2684. this.farmingSeedId[index] = farmingSeedId;
  2685. }
  2686.  
  2687. public int getFarmingTime(int index) {
  2688. return this.farmingTime[index];
  2689. }
  2690.  
  2691. public void setFarmingTime(int index, int farmingTime) {
  2692. this.farmingTime[index] = farmingTime;
  2693. }
  2694.  
  2695. public int getFarmingState(int index) {
  2696. return farmingState[index];
  2697. }
  2698.  
  2699. public void setFarmingState(int index, int farmingState) {
  2700. this.farmingState[index] = farmingState;
  2701. }
  2702.  
  2703. public int getFarmingHarvest(int index) {
  2704. return farmingHarvest[index];
  2705. }
  2706.  
  2707. public void setFarmingHarvest(int index, int farmingHarvest) {
  2708. this.farmingHarvest[index] = farmingHarvest;
  2709. }
  2710.  
  2711. public Farming getFarming() {
  2712. if (farming == null) {
  2713. farming = new Farming(this);
  2714. }
  2715. return farming;
  2716. }
  2717.  
  2718. /**
  2719. * Retrieves the bounty hunter instance for this client object. We use lazy
  2720. * initialization because we store values from the player save file in the
  2721. * bountyHunter object upon login. Without lazy initialization the value
  2722. * would be overwritten.
  2723. *
  2724. * @return the bounty hunter object
  2725. */
  2726. public BountyHunter getBH() {
  2727. if (Objects.isNull(bountyHunter)) {
  2728. bountyHunter = new BountyHunter(this);
  2729. }
  2730. return bountyHunter;
  2731. }
  2732.  
  2733. public UnnecessaryPacketDropper getPacketDropper() {
  2734. return packetDropper;
  2735. }
  2736.  
  2737. public Optional<ItemCombination> getCurrentCombination() {
  2738. return currentCombination;
  2739. }
  2740.  
  2741. public void setCurrentCombination(Optional<ItemCombination> combination) {
  2742. this.currentCombination = combination;
  2743. }
  2744.  
  2745. public PlayerKill getPlayerKills() {
  2746. if (Objects.isNull(playerKills)) {
  2747. playerKills = new PlayerKill();
  2748. }
  2749. return playerKills;
  2750. }
  2751.  
  2752. public String getMacAddress() {
  2753. return macAddress;
  2754. }
  2755.  
  2756. public void setMacAddress(String macAddress) {
  2757. this.macAddress = macAddress;
  2758. }
  2759.  
  2760. public int getMaximumHealth() {
  2761. int base = getLevelForXP(playerXP[3]);
  2762. if (EquipmentSet.GUTHAN.isWearingBarrows(this) && getItems().isWearingItem(12853)) {
  2763. base += 10;
  2764. }
  2765. return base;
  2766. }
  2767.  
  2768. public Duel getDuel() {
  2769. return duelSession;
  2770. }
  2771.  
  2772. public void setItemOnPlayer(Player player) {
  2773. this.itemOnPlayer = player;
  2774. }
  2775.  
  2776. public Player getItemOnPlayer() {
  2777. return itemOnPlayer;
  2778. }
  2779.  
  2780. public Skilling getSkilling() {
  2781. return skilling;
  2782. }
  2783.  
  2784. public Presets getPresets() {
  2785. if (presets == null) {
  2786. presets = new Presets(this);
  2787. }
  2788. return presets;
  2789. }
  2790.  
  2791. public Killstreak getKillstreak() {
  2792. if (killstreaks == null) {
  2793. killstreaks = new Killstreak(this);
  2794. }
  2795. return killstreaks;
  2796. }
  2797.  
  2798. /**
  2799. * Returns the single instance of the {@link NPCDeathTracker} class for this
  2800. * player.
  2801. *
  2802. * @return the tracker clas
  2803. */
  2804. public NPCDeathTracker getNpcDeathTracker() {
  2805. return npcDeathTracker;
  2806. }
  2807.  
  2808. /**
  2809. * The zulrah event
  2810. *
  2811. * @return event
  2812. */
  2813. public Zulrah getZulrahEvent() {
  2814. return zulrah;
  2815. }
  2816.  
  2817. /**
  2818. * The single {@link WarriorsGuild} instance for this player
  2819. *
  2820. * @return warriors guild
  2821. */
  2822. public WarriorsGuild getWarriorsGuild() {
  2823. return warriorsGuild;
  2824. }
  2825.  
  2826. /**
  2827. * The single instance of the {@link PestControlRewards} class for this
  2828. * player
  2829. *
  2830. * @return the reward class
  2831. */
  2832. public PestControlRewards getPestControlRewards() {
  2833. return pestControlRewards;
  2834. }
  2835.  
  2836. public Mining getMining() {
  2837. return mining;
  2838. }
  2839.  
  2840. public PunishmentPanel getPunishmentPanel() {
  2841. return punishmentPanel;
  2842. }
  2843.  
  2844. public void faceNPC(int index) {
  2845. faceNPC = index;
  2846. faceNPCupdate = true;
  2847. updateRequired = true;
  2848. }
  2849.  
  2850. public void appendFaceNPCUpdate(Stream str) {
  2851. str.writeWordBigEndian(faceNPC);
  2852. }
  2853.  
  2854. public void ResetKeepItems() {
  2855. WillKeepAmt1 = -1;
  2856. WillKeepItem1 = -1;
  2857. WillKeepAmt2 = -1;
  2858. WillKeepItem2 = -1;
  2859. WillKeepAmt3 = -1;
  2860. WillKeepItem3 = -1;
  2861. WillKeepAmt4 = -1;
  2862. WillKeepItem4 = -1;
  2863. }
  2864.  
  2865. public void StartBestItemScan(Player c) {
  2866. if (c.isSkulled && !c.prayerActive[10]) {
  2867. ItemKeptInfo(c, 0);
  2868. return;
  2869. }
  2870. FindItemKeptInfo(c);
  2871. ResetKeepItems();
  2872. BestItem1(c);
  2873. }
  2874.  
  2875. public void FindItemKeptInfo(Player c) {
  2876. if (isSkulled && c.prayerActive[10])
  2877. ItemKeptInfo(c, 1);
  2878. else if (!isSkulled && !c.prayerActive[10])
  2879. ItemKeptInfo(c, 3);
  2880. else if (!isSkulled && c.prayerActive[10])
  2881. ItemKeptInfo(c, 4);
  2882. }
  2883.  
  2884. public void ItemKeptInfo(Player c, int Lose) {
  2885. for (int i = 17109; i < 17131; i++) {
  2886. c.getPA().sendFrame126("", i);
  2887. }
  2888. c.getPA().sendFrame126("Items you will keep on death:", 17104);
  2889. c.getPA().sendFrame126("Items you will lose on death:", 17105);
  2890. c.getPA().sendFrame126("Player Information", 17106);
  2891. c.getPA().sendFrame126("Max items kept on death:", 17107);
  2892. c.getPA().sendFrame126("~ " + Lose + " ~", 17108);
  2893. c.getPA().sendFrame126("The normal amount of", 17111);
  2894. c.getPA().sendFrame126("items kept is three.", 17112);
  2895. switch (Lose) {
  2896. case 0:
  2897. default:
  2898. c.getPA().sendFrame126("Items you will keep on death:", 17104);
  2899. c.getPA().sendFrame126("Items you will lose on death:", 17105);
  2900. c.getPA().sendFrame126("You're marked with a", 17111);
  2901. c.getPA().sendFrame126("@red@skull. @lre@This reduces the", 17112);
  2902. c.getPA().sendFrame126("items you keep from", 17113);
  2903. c.getPA().sendFrame126("three to zero!", 17114);
  2904. break;
  2905. case 1:
  2906. c.getPA().sendFrame126("Items you will keep on death:", 17104);
  2907. c.getPA().sendFrame126("Items you will lose on death:", 17105);
  2908. c.getPA().sendFrame126("You're marked with a", 17111);
  2909. c.getPA().sendFrame126("@red@skull. @lre@This reduces the", 17112);
  2910. c.getPA().sendFrame126("items you keep from", 17113);
  2911. c.getPA().sendFrame126("three to zero!", 17114);
  2912. c.getPA().sendFrame126("However, you also have", 17115);
  2913. c.getPA().sendFrame126("the @red@Protect @lre@Items prayer", 17116);
  2914. c.getPA().sendFrame126("active, which saves you", 17117);
  2915. c.getPA().sendFrame126("one extra item!", 17118);
  2916. break;
  2917. case 3:
  2918. c.getPA().sendFrame126("Items you will keep on death(if not skulled):", 17104);
  2919. c.getPA().sendFrame126("Items you will lose on death(if not skulled):", 17105);
  2920. c.getPA().sendFrame126("You have no factors", 17111);
  2921. c.getPA().sendFrame126("affecting the items you", 17112);
  2922. c.getPA().sendFrame126("keep.", 17113);
  2923. break;
  2924. case 4:
  2925. c.getPA().sendFrame126("Items you will keep on death(if not skulled):", 17104);
  2926. c.getPA().sendFrame126("Items you will lose on death(if not skulled):", 17105);
  2927. c.getPA().sendFrame126("You have the @red@Protect", 17111);
  2928. c.getPA().sendFrame126("@red@Item @lre@prayer active,", 17112);
  2929. c.getPA().sendFrame126("which saves you one", 17113);
  2930. c.getPA().sendFrame126("extra item!", 17114);
  2931. break;
  2932. }
  2933. }
  2934.  
  2935. public void BestItem1(Player c) {
  2936. int BestValue = 0;
  2937. int NextValue = 0;
  2938. int ItemsContained = 0;
  2939. WillKeepItem1 = 0;
  2940. WillKeepItem1Slot = 0;
  2941. for (int ITEM = 0; ITEM < 28; ITEM++) {
  2942. if (playerItems[ITEM] > 0) {
  2943. ItemsContained += 1;
  2944. NextValue = (int) Math.floor(c.getShops().getItemShopValue(playerItems[ITEM] - 1));
  2945. if (NextValue > BestValue) {
  2946. BestValue = NextValue;
  2947. WillKeepItem1 = playerItems[ITEM] - 1;
  2948. WillKeepItem1Slot = ITEM;
  2949. if (playerItemsN[ITEM] > 2 && !c.prayerActive[10]) {
  2950. WillKeepAmt1 = 3;
  2951. } else if (playerItemsN[ITEM] > 3 && c.prayerActive[10]) {
  2952. WillKeepAmt1 = 4;
  2953. } else {
  2954. WillKeepAmt1 = playerItemsN[ITEM];
  2955. }
  2956. }
  2957. }
  2958. }
  2959. for (int EQUIP = 0; EQUIP < 14; EQUIP++) {
  2960. if (playerEquipment[EQUIP] > 0) {
  2961. ItemsContained += 1;
  2962. NextValue = (int) Math.floor(c.getShops().getItemShopValue(playerEquipment[EQUIP]));
  2963. if (NextValue > BestValue) {
  2964. BestValue = NextValue;
  2965. WillKeepItem1 = playerEquipment[EQUIP];
  2966. WillKeepItem1Slot = EQUIP + 28;
  2967. if (playerEquipmentN[EQUIP] > 2 && !c.prayerActive[10]) {
  2968. WillKeepAmt1 = 3;
  2969. } else if (playerEquipmentN[EQUIP] > 3 && c.prayerActive[10]) {
  2970. WillKeepAmt1 = 4;
  2971. } else {
  2972. WillKeepAmt1 = playerEquipmentN[EQUIP];
  2973. }
  2974. }
  2975. }
  2976. }
  2977. if (!isSkulled && ItemsContained > 1 && (WillKeepAmt1 < 3 || (c.prayerActive[10] && WillKeepAmt1 < 4))) {
  2978. BestItem2(c, ItemsContained);
  2979. }
  2980. }
  2981.  
  2982. public void BestItem2(Player c, int ItemsContained) {
  2983. int BestValue = 0;
  2984. int NextValue = 0;
  2985. WillKeepItem2 = 0;
  2986. WillKeepItem2Slot = 0;
  2987. for (int ITEM = 0; ITEM < 28; ITEM++) {
  2988. if (playerItems[ITEM] > 0) {
  2989. NextValue = (int) Math.floor(c.getShops().getItemShopValue(playerItems[ITEM] - 1));
  2990. if (NextValue > BestValue && !(ITEM == WillKeepItem1Slot && playerItems[ITEM] - 1 == WillKeepItem1)) {
  2991. BestValue = NextValue;
  2992. WillKeepItem2 = playerItems[ITEM] - 1;
  2993. WillKeepItem2Slot = ITEM;
  2994. if (playerItemsN[ITEM] > 2 - WillKeepAmt1 && !c.prayerActive[10]) {
  2995. WillKeepAmt2 = 3 - WillKeepAmt1;
  2996. } else if (playerItemsN[ITEM] > 3 - WillKeepAmt1 && c.prayerActive[10]) {
  2997. WillKeepAmt2 = 4 - WillKeepAmt1;
  2998. } else {
  2999. WillKeepAmt2 = playerItemsN[ITEM];
  3000. }
  3001. }
  3002. }
  3003. }
  3004. for (int EQUIP = 0; EQUIP < 14; EQUIP++) {
  3005. if (playerEquipment[EQUIP] > 0) {
  3006. NextValue = (int) Math.floor(c.getShops().getItemShopValue(playerEquipment[EQUIP]));
  3007. if (NextValue > BestValue && !(EQUIP + 28 == WillKeepItem1Slot && playerEquipment[EQUIP] == WillKeepItem1)) {
  3008. BestValue = NextValue;
  3009. WillKeepItem2 = playerEquipment[EQUIP];
  3010. WillKeepItem2Slot = EQUIP + 28;
  3011. if (playerEquipmentN[EQUIP] > 2 - WillKeepAmt1 && !c.prayerActive[10]) {
  3012. WillKeepAmt2 = 3 - WillKeepAmt1;
  3013. } else if (playerEquipmentN[EQUIP] > 3 - WillKeepAmt1 && c.prayerActive[10]) {
  3014. WillKeepAmt2 = 4 - WillKeepAmt1;
  3015. } else {
  3016. WillKeepAmt2 = playerEquipmentN[EQUIP];
  3017. }
  3018. }
  3019. }
  3020. }
  3021. if (!isSkulled && ItemsContained > 2 && (WillKeepAmt1 + WillKeepAmt2 < 3 || (c.prayerActive[10] && WillKeepAmt1 + WillKeepAmt2 < 4))) {
  3022. BestItem3(c, ItemsContained);
  3023. }
  3024. }
  3025.  
  3026. public void BestItem3(Player c, int ItemsContained) {
  3027. int BestValue = 0;
  3028. int NextValue = 0;
  3029. WillKeepItem3 = 0;
  3030. WillKeepItem3Slot = 0;
  3031. for (int ITEM = 0; ITEM < 28; ITEM++) {
  3032. if (playerItems[ITEM] > 0) {
  3033. NextValue = (int) Math.floor(c.getShops().getItemShopValue(playerItems[ITEM] - 1));
  3034. if (NextValue > BestValue && !(ITEM == WillKeepItem1Slot && playerItems[ITEM] - 1 == WillKeepItem1)
  3035. && !(ITEM == WillKeepItem2Slot && playerItems[ITEM] - 1 == WillKeepItem2)) {
  3036. BestValue = NextValue;
  3037. WillKeepItem3 = playerItems[ITEM] - 1;
  3038. WillKeepItem3Slot = ITEM;
  3039. if (playerItemsN[ITEM] > 2 - (WillKeepAmt1 + WillKeepAmt2) && !c.prayerActive[10]) {
  3040. WillKeepAmt3 = 3 - (WillKeepAmt1 + WillKeepAmt2);
  3041. } else if (playerItemsN[ITEM] > 3 - (WillKeepAmt1 + WillKeepAmt2) && c.prayerActive[10]) {
  3042. WillKeepAmt3 = 4 - (WillKeepAmt1 + WillKeepAmt2);
  3043. } else {
  3044. WillKeepAmt3 = playerItemsN[ITEM];
  3045. }
  3046. }
  3047. }
  3048. }
  3049. for (int EQUIP = 0; EQUIP < 14; EQUIP++) {
  3050. if (playerEquipment[EQUIP] > 0) {
  3051. NextValue = (int) Math.floor(c.getShops().getItemShopValue(playerEquipment[EQUIP]));
  3052. if (NextValue > BestValue && !(EQUIP + 28 == WillKeepItem1Slot && playerEquipment[EQUIP] == WillKeepItem1)
  3053. && !(EQUIP + 28 == WillKeepItem2Slot && playerEquipment[EQUIP] == WillKeepItem2)) {
  3054. BestValue = NextValue;
  3055. WillKeepItem3 = playerEquipment[EQUIP];
  3056. WillKeepItem3Slot = EQUIP + 28;
  3057. if (playerEquipmentN[EQUIP] > 2 - (WillKeepAmt1 + WillKeepAmt2) && !c.prayerActive[10]) {
  3058. WillKeepAmt3 = 3 - (WillKeepAmt1 + WillKeepAmt2);
  3059. } else if (playerEquipmentN[EQUIP] > 3 - WillKeepAmt1 && c.prayerActive[10]) {
  3060. WillKeepAmt3 = 4 - (WillKeepAmt1 + WillKeepAmt2);
  3061. } else {
  3062. WillKeepAmt3 = playerEquipmentN[EQUIP];
  3063. }
  3064. }
  3065. }
  3066. }
  3067. if (!isSkulled && ItemsContained > 3 && c.prayerActive[10] && ((WillKeepAmt1 + WillKeepAmt2 + WillKeepAmt3) < 4)) {
  3068. BestItem4(c);
  3069. }
  3070. }
  3071.  
  3072. public void BestItem4(Player c) {
  3073. int BestValue = 0;
  3074. int NextValue = 0;
  3075. WillKeepItem4 = 0;
  3076. WillKeepItem4Slot = 0;
  3077. for (int ITEM = 0; ITEM < 28; ITEM++) {
  3078. if (playerItems[ITEM] > 0) {
  3079. NextValue = (int) Math.floor(c.getShops().getItemShopValue(playerItems[ITEM] - 1));
  3080. if (NextValue > BestValue && !(ITEM == WillKeepItem1Slot && playerItems[ITEM] - 1 == WillKeepItem1)
  3081. && !(ITEM == WillKeepItem2Slot && playerItems[ITEM] - 1 == WillKeepItem2)
  3082. && !(ITEM == WillKeepItem3Slot && playerItems[ITEM] - 1 == WillKeepItem3)) {
  3083. BestValue = NextValue;
  3084. WillKeepItem4 = playerItems[ITEM] - 1;
  3085. WillKeepItem4Slot = ITEM;
  3086. }
  3087. }
  3088. }
  3089. for (int EQUIP = 0; EQUIP < 14; EQUIP++) {
  3090. if (playerEquipment[EQUIP] > 0) {
  3091. NextValue = (int) Math.floor(c.getShops().getItemShopValue(playerEquipment[EQUIP]));
  3092. if (NextValue > BestValue && !(EQUIP + 28 == WillKeepItem1Slot && playerEquipment[EQUIP] == WillKeepItem1)
  3093. && !(EQUIP + 28 == WillKeepItem2Slot && playerEquipment[EQUIP] == WillKeepItem2)
  3094. && !(EQUIP + 28 == WillKeepItem3Slot && playerEquipment[EQUIP] == WillKeepItem3)) {
  3095. BestValue = NextValue;
  3096. WillKeepItem4 = playerEquipment[EQUIP];
  3097. WillKeepItem4Slot = EQUIP + 28;
  3098. }
  3099. }
  3100. }
  3101. }
  3102.  
  3103. public boolean isAutoButton(int button) {
  3104. for (int j = 0; j < autocastIds.length; j += 2) {
  3105. if (autocastIds[j] == button)
  3106. return true;
  3107. }
  3108. return false;
  3109. }
  3110.  
  3111. public void assignAutocast(int button) {
  3112. for (int j = 0; j < autocastIds.length; j++) {
  3113. if (autocastIds[j] == button) {
  3114. Player c = PlayerHandler.players[this.playerId];
  3115. autocasting = true;
  3116. autocastId = autocastIds[j + 1];
  3117. c.getPA().sendFrame36(108, 1);
  3118. c.setSidebarInterface(0, 328);
  3119. // spellName = getSpellName(autocastId);
  3120. // spellName = spellName;
  3121. // c.getPA().sendFrame126(spellName, 354);
  3122. c = null;
  3123. break;
  3124. }
  3125. }
  3126. }
  3127.  
  3128. public int getLocalX() {
  3129. return getX() - 8 * getMapRegionX();
  3130. }
  3131.  
  3132. public int getLocalY() {
  3133. return getY() - 8 * getMapRegionY();
  3134. }
  3135.  
  3136. public String getSpellName(int id) {
  3137. switch (id) {
  3138. case 0:
  3139. return "Air Strike";
  3140. case 1:
  3141. return "Water Strike";
  3142. case 2:
  3143. return "Earth Strike";
  3144. case 3:
  3145. return "Fire Strike";
  3146. case 4:
  3147. return "Air Bolt";
  3148. case 5:
  3149. return "Water Bolt";
  3150. case 6:
  3151. return "Earth Bolt";
  3152. case 7:
  3153. return "Fire Bolt";
  3154. case 8:
  3155. return "Air Blast";
  3156. case 9:
  3157. return "Water Blast";
  3158. case 10:
  3159. return "Earth Blast";
  3160. case 11:
  3161. return "Fire Blast";
  3162. case 12:
  3163. return "Air Wave";
  3164. case 13:
  3165. return "Water Wave";
  3166. case 14:
  3167. return "Earth Wave";
  3168. case 15:
  3169. return "Fire Wave";
  3170. case 32:
  3171. return "Shadow Rush";
  3172. case 33:
  3173. return "Smoke Rush";
  3174. case 34:
  3175. return "Blood Rush";
  3176. case 35:
  3177. return "Ice Rush";
  3178. case 36:
  3179. return "Shadow Burst";
  3180. case 37:
  3181. return "Smoke Burst";
  3182. case 38:
  3183. return "Blood Burst";
  3184. case 39:
  3185. return "Ice Burst";
  3186. case 40:
  3187. return "Shadow Blitz";
  3188. case 41:
  3189. return "Smoke Blitz";
  3190. case 42:
  3191. return "Blood Blitz";
  3192. case 43:
  3193. return "Ice Blitz";
  3194. case 44:
  3195. return "Shadow Barrage";
  3196. case 45:
  3197. return "Smoke Barrage";
  3198. case 46:
  3199. return "Blood Barrage";
  3200. case 47:
  3201. return "Ice Barrage";
  3202. default:
  3203. return "Select Spell";
  3204. }
  3205. }
  3206.  
  3207. public boolean fullVoidRange() {
  3208. return playerEquipment[playerHat] == 11664 && playerEquipment[playerLegs] == 8840 && playerEquipment[playerChest] == 8839
  3209. && playerEquipment[playerHands] == 8842;
  3210. }
  3211.  
  3212. public boolean fullVoidMage() {
  3213. return playerEquipment[playerHat] == 11663 && playerEquipment[playerLegs] == 8840 && playerEquipment[playerChest] == 8839
  3214. && playerEquipment[playerHands] == 8842;
  3215. }
  3216.  
  3217. public boolean fullVoidMelee() {
  3218. return playerEquipment[playerHat] == 11665 && playerEquipment[playerLegs] == 8840 && playerEquipment[playerChest] == 8839
  3219. && playerEquipment[playerHands] == 8842;
  3220. }
  3221.  
  3222. /**
  3223. * SouthWest, NorthEast, SouthWest, NorthEast
  3224. */
  3225. public boolean isInTut() {
  3226. if (absX >= 2625 && absX <= 2687 && absY >= 4670 && absY <= 4735) {
  3227. return true;
  3228. }
  3229. return false;
  3230. }
  3231.  
  3232. public boolean isInBarrows() {
  3233. if (absX > 3543 && absX < 3584 && absY > 3265 && absY < 3311) {
  3234. return true;
  3235. }
  3236. return false;
  3237. }
  3238.  
  3239. public boolean isInBarrows2() {
  3240. if (absX > 3529 && absX < 3581 && absY > 9673 && absY < 9722) {
  3241. return true;
  3242. }
  3243. return false;
  3244. }
  3245.  
  3246. public boolean inBarrows() {
  3247. if (absX > 3520 && absX < 3598 && absY > 9653 && absY < 9750) {
  3248. return true;
  3249. }
  3250. return false;
  3251. }
  3252.  
  3253. public boolean inArea(int x, int y, int x1, int y1) {
  3254. if (absX > x && absX < x1 && absY < y && absY > y1) {
  3255. return true;
  3256. }
  3257. return false;
  3258. }
  3259.  
  3260. public boolean Area(final int x1, final int x2, final int y1, final int y2) {
  3261. return (absX >= x1 && absX <= x2 && absY >= y1 && absY <= y2);
  3262. }
  3263.  
  3264. public boolean inBank() {
  3265. return Area(3090, 3099, 3487, 3500) || Area(3089, 3090, 3492, 3498) || Area(3248, 3258, 3413, 3428) || Area(3179, 3191, 3432, 3448)
  3266. || Area(2944, 2948, 3365, 3374) || Area(2942, 2948, 3367, 3374) || Area(2944, 2950, 3365, 3370) || Area(3008, 3019, 3352, 3359)
  3267. || Area(3017, 3022, 3352, 3357) || Area(3203, 3213, 3200, 3237) || Area(3212, 3215, 3200, 3235) || Area(3215, 3220, 3202, 3235)
  3268. || Area(3220, 3227, 3202, 3229) || Area(3227, 3230, 3208, 3226) || Area(3226, 3228, 3230, 3211) || Area(3227, 3229, 3208, 3226);
  3269. }
  3270.  
  3271. public boolean isInJail() {
  3272. if (absX >= 2065 && absX <= 2111 && absY >= 4415 && absY <= 4455) {
  3273. return true;
  3274. }
  3275. return false;
  3276. }
  3277.  
  3278.  
  3279.  
  3280. public boolean inCamWild() {
  3281. if (absX > 3231 && absX < 3300 && absY > 3180 && absY < 3300 || absX > 3120 && absX < 3300 && absY > 3236 && absY < 3300
  3282. || absX > 3227 && absX < 3300 && absY > 3225 && absY < 3300) {
  3283. return true;
  3284. }
  3285. return false;
  3286. }
  3287.  
  3288. public boolean inMining() {
  3289. if (absY > 9700 && absY < 10366) {
  3290. return true;
  3291. }
  3292. return false;
  3293. }
  3294.  
  3295. public boolean inWc() {
  3296. if (absY > 3346 && absY < 3530 && absX > 2600 && absX < 2730) {
  3297. return true;
  3298. }
  3299. return false;
  3300. }
  3301.  
  3302. public boolean inFarm() {
  3303. if (absY > 3446 && absY < 3480 && absX > 2802 && absX < 2820) {
  3304. return true;
  3305. }
  3306. return false;
  3307. }
  3308.  
  3309. public boolean inDz() {
  3310. if (absY > 9620 && absY < 9657 && absX > 3344 && absX < 3381) {
  3311. return true;
  3312. }
  3313. return false;
  3314. }
  3315.  
  3316. public boolean inFm() {
  3317. if (absX > 2333 && absX < 2355 && absY > 3663 && absY < 3702) {
  3318. return true;
  3319. }
  3320. return false;
  3321. }
  3322.  
  3323. public boolean inCw() {
  3324. return CastleWars.isInCwWait(this) || CastleWars.isInCw(this);
  3325. }
  3326.  
  3327.  
  3328. public boolean inWild() {
  3329. if(CastleWars.isInCw(c))
  3330. return true;
  3331. if (absX > 2941 && absX < 3392 && absY > 3524 && absY < 3968 || absX > 2941 && absX < 3392 && absY > 9918 && absY < 10366 || absX > 2426 && absX < 2365 && absY > 3128 && absY < 3079) {
  3332. return true;
  3333. }
  3334. return false;
  3335. }
  3336.  
  3337. public boolean inClanWars() {
  3338. if (Boundary.isIn(this, ClanWarsMap.getBoundaries())) {
  3339. return true;
  3340. }
  3341. return false;
  3342. }
  3343.  
  3344.  
  3345.  
  3346. public boolean isInCw() {
  3347. if (absX >= 2426 && absX <= 2365 && absY >= 3128 && absY <= 3079) {
  3348. return true;
  3349. }
  3350. return false;
  3351. }
  3352.  
  3353. public boolean inPits () {
  3354. if(absX >= 2370 && absX <= 2425 && absY >= 5133 && absY <= 5165) {
  3355. return true;
  3356. }
  3357. return false;
  3358. }
  3359.  
  3360. public boolean inEdgeville() {
  3361. return (absX > 3040 && absX < 3200 && absY > 3460 && absY < 3519);
  3362. }
  3363.  
  3364. public boolean inDice() {
  3365. if (absX > 3089 && absX < 3098 && absY > 3473 && absY < 3484) {
  3366. return true;
  3367. }
  3368. return false;
  3369. }
  3370.  
  3371. public boolean arenas() {
  3372. if (absX > 3331 && absX < 3391 && absY > 3242 && absY < 3260) {
  3373. return true;
  3374. }
  3375. return false;
  3376. }
  3377.  
  3378. public boolean inDuelArena() {
  3379. if ((absX > 3322 && absX < 3394 && absY > 3195 && absY < 3291) || (absX > 3311 && absX < 3323 && absY > 3223 && absY < 3248)) {
  3380. return true;
  3381. }
  3382. return false;
  3383. }
  3384.  
  3385. public boolean inMulti() {
  3386. if (Boundary.isIn(this, Zulrah.BOUNDARY)) {
  3387. return true;
  3388. }
  3389. if ((absX >= 3136 && absX <= 3327 && absY >= 3519 && absY <= 3607) || (absX >= 3190 && absX <= 3327 && absY >= 3648 && absY <= 3839)
  3390. || (absX >= 3200 && absX <= 3390 && absY >= 3840 && absY <= 3967) || (absX >= 2992 && absX <= 3007 && absY >= 3912 && absY <= 3967)
  3391. || (absX >= 2946 && absX <= 2959 && absY >= 3816 && absY <= 3831) || (absX >= 3008 && absX <= 3199 && absY >= 3856 && absY <= 3903)
  3392. || (absX >= 2824 && absX <= 2944 && absY >= 5258 && absY <= 5369) || (absX >= 3008 && absX <= 3071 && absY >= 3600 && absY <= 3711)
  3393. || (absX >= 3072 && absX <= 3327 && absY >= 3608 && absY <= 3647) || (absX >= 2624 && absX <= 2690 && absY >= 2550 && absY <= 2619)
  3394. || (absX >= 2371 && absX <= 2422 && absY >= 5062 && absY <= 5117) || (absX >= 2896 && absX <= 2927 && absY >= 3595 && absY <= 3630)
  3395. || (absX >= 2892 && absX <= 2932 && absY >= 4435 && absY <= 4464) || (absX >= 2256 && absX <= 2287 && absY >= 4680 && absY <= 4711)
  3396. || (absX >= 2962 && absX <= 3006 && absY >= 3621 && absY <= 3659) || (absX >= 3155 && absX <= 3214 && absY >= 3755 && absY <= 3803)
  3397. || (absX >= 2426 && absX <= 2365 && absY >= 3128 && absY <= 3079)) {
  3398. return true;
  3399. }
  3400. return false;
  3401. }
  3402.  
  3403. public boolean inFightCaves() {
  3404. return absX >= 2360 && absX <= 2445 && absY >= 5045 && absY <= 5125;
  3405. }
  3406.  
  3407. public boolean inPirateHouse() {
  3408. return absX >= 3038 && absX <= 3044 && absY >= 3949 && absY <= 3959;
  3409. }
  3410.  
  3411. public boolean checkFullGear(Player c) {
  3412. if (c.playerEquipment[0] >= 0 && c.playerEquipment[1] >= 0 && c.playerEquipment[2] >= 0 && c.playerEquipment[3] >= 0
  3413. && c.playerEquipment[4] >= 0 && c.playerEquipment[5] >= 0 && c.playerEquipment[7] >= 0 && c.playerEquipment[9] >= 0
  3414. && c.playerEquipment[10] >= 0 && c.playerEquipment[12] >= 0) {
  3415. return true;
  3416. }
  3417. return false;
  3418. }
  3419.  
  3420. public void updateshop(int i) {
  3421. Player p = PlayerHandler.players[playerId];
  3422. p.getShops().resetShop(i);
  3423. }
  3424.  
  3425. public void println_debug(String str) {
  3426. System.out.println("[player-" + playerId + "]: " + str);
  3427. }
  3428.  
  3429. public void println(String str) {
  3430. System.out.println("[player-" + playerId + "]: " + str);
  3431. }
  3432.  
  3433. public boolean WithinDistance(int objectX, int objectY, int playerX, int playerY, int distance) {
  3434. for (int i = 0; i <= distance; i++) {
  3435. for (int j = 0; j <= distance; j++) {
  3436. if ((objectX + i) == playerX && ((objectY + j) == playerY || (objectY - j) == playerY || objectY == playerY)) {
  3437. return true;
  3438. } else if ((objectX - i) == playerX && ((objectY + j) == playerY || (objectY - j) == playerY || objectY == playerY)) {
  3439. return true;
  3440. } else if (objectX == playerX && ((objectY + j) == playerY || (objectY - j) == playerY || objectY == playerY)) {
  3441. return true;
  3442. }
  3443. }
  3444. }
  3445. return false;
  3446. }
  3447.  
  3448. public boolean withinDistance(Player otherPlr) {
  3449. if (heightLevel != otherPlr.heightLevel)
  3450. return false;
  3451. int deltaX = otherPlr.absX - absX, deltaY = otherPlr.absY - absY;
  3452. return deltaX <= 15 && deltaX >= -16 && deltaY <= 15 && deltaY >= -16;
  3453. }
  3454.  
  3455. public boolean withinDistance(NPC npc) {
  3456. if (heightLevel != npc.heightLevel)
  3457. return false;
  3458. if (npc.needRespawn == true)
  3459. return false;
  3460. int deltaX = npc.absX - absX, deltaY = npc.absY - absY;
  3461. return deltaX <= 15 && deltaX >= -16 && deltaY <= 15 && deltaY >= -16;
  3462. }
  3463.  
  3464. public boolean withinDistance(int absX, int getY, int getHeightLevel) {
  3465. if (this.getHeightLevel() != getHeightLevel)
  3466. return false;
  3467. int deltaX = this.getX() - absX, deltaY = this.getY() - getY;
  3468. return deltaX <= 15 && deltaX >= -16 && deltaY <= 15 && deltaY >= -16;
  3469. }
  3470.  
  3471. public int getHeightLevel() {
  3472. return getHeightLevel;
  3473. }
  3474.  
  3475. public int distanceToPoint(int pointX, int pointY) {
  3476. return (int) Math.sqrt(Math.pow(absX - pointX, 2) + Math.pow(absY - pointY, 2));
  3477. }
  3478.  
  3479. public void resetWalkingQueue() {
  3480. wQueueReadPtr = wQueueWritePtr = 0;
  3481.  
  3482. for (int i = 0; i < walkingQueueSize; i++) {
  3483. walkingQueueX[i] = currentX;
  3484. walkingQueueY[i] = currentY;
  3485. }
  3486. }
  3487.  
  3488. public void addToWalkingQueue(int x, int y) {
  3489. // if (VirtualWorld.I(heightLevel, absX, absY, x, y, 0)) {
  3490. int next = (wQueueWritePtr + 1) % walkingQueueSize;
  3491. if (next == wQueueWritePtr)
  3492. return;
  3493. walkingQueueX[wQueueWritePtr] = x;
  3494. walkingQueueY[wQueueWritePtr] = y;
  3495. wQueueWritePtr = next;
  3496. // }
  3497. }
  3498.  
  3499. public boolean goodDistance(int objectX, int objectY, int playerX, int playerY, int distance) {
  3500. for (int i = 0; i <= distance; i++) {
  3501. for (int j = 0; j <= distance; j++) {
  3502. if ((objectX + i) == playerX && ((objectY + j) == playerY || (objectY - j) == playerY || objectY == playerY)) {
  3503. return true;
  3504. } else if ((objectX - i) == playerX && ((objectY + j) == playerY || (objectY - j) == playerY || objectY == playerY)) {
  3505. return true;
  3506. } else if (objectX == playerX && ((objectY + j) == playerY || (objectY - j) == playerY || objectY == playerY)) {
  3507. return true;
  3508. }
  3509. }
  3510. }
  3511. return false;
  3512. }
  3513.  
  3514. /**
  3515. * Checks the combat distance to see if the player is in an appropriate
  3516. * location based on the attack style.
  3517. *
  3518. * @param attacker
  3519. * @param target
  3520. * @return
  3521. */
  3522. public boolean checkCombatDistance(Player attacker, Player target) {
  3523. int distance = Misc.distanceBetween(attacker, target);
  3524. int required_distance = this.getDistanceRequired();
  3525. return (this.usingMagic || this.usingRangeWeapon || this.usingBow || this.autocasting) && distance <= required_distance ? true
  3526. : (this.usingMelee && this.isMoving && distance <= required_distance ? true
  3527. : distance == 1 && (this.freezeTimer <= 0 || this.getX() == target.getX() || this.getY() == target.getY()));
  3528. }
  3529.  
  3530. public int getDistanceRequired() {
  3531. return !this.usingMagic && !this.usingRangeWeapon && !usingBow && !this.autocasting ? (this.isMoving ? 3 : 1) : 9;
  3532. }
  3533.  
  3534. public boolean checkBarricade(int X, int Y, int Z){
  3535. for (int i = 0; i < CastleWars.BARRICADE_INDEX.length; i++){
  3536. if (CastleWars.BARRICADE_INDEX[i] != 0){
  3537. if (NPCHandler.npcs[CastleWars.BARRICADE_INDEX[i]].npcType == 5722){
  3538. if (NPCHandler.npcs[CastleWars.BARRICADE_INDEX[i]].absX == X && NPCHandler.npcs[CastleWars.BARRICADE_INDEX[i]].absY == Y && NPCHandler.npcs[CastleWars.BARRICADE_INDEX[i]].heightLevel == Z){
  3539. return true;
  3540. }
  3541. }
  3542. }
  3543. }
  3544. return false;
  3545. }
  3546.  
  3547.  
  3548. public int getNextWalkingDirection() {
  3549. if (wQueueReadPtr == wQueueWritePtr)
  3550. return -1;
  3551. int dir;
  3552. do {
  3553. dir = Misc.direction(currentX, currentY, walkingQueueX[wQueueReadPtr], walkingQueueY[wQueueReadPtr]);
  3554. if (dir == -1) {
  3555. wQueueReadPtr = (wQueueReadPtr + 1) % walkingQueueSize;
  3556. } else if ((dir & 1) != 0) {
  3557. println_debug("Invalid waypoint in walking queue!");
  3558. resetWalkingQueue();
  3559. return -1;
  3560. }
  3561. } while ((dir == -1) && (wQueueReadPtr != wQueueWritePtr));
  3562. if (dir == -1)
  3563. return -1;
  3564. dir >>= 1;
  3565. Player p = (Player) PlayerHandler.players[this.playerId];
  3566. if(CastleWars.isInCw(p)) {
  3567. int tempabsX = absX+Misc.directionDeltaX[dir];
  3568. int tempabsY = absY+Misc.directionDeltaY[dir];
  3569. if(checkBarricade(tempabsX,tempabsY,heightLevel)){
  3570. return -1;
  3571. }
  3572. }
  3573. currentX += Misc.directionDeltaX[dir];
  3574. currentY += Misc.directionDeltaY[dir];
  3575. absX += Misc.directionDeltaX[dir];
  3576. absY += Misc.directionDeltaY[dir];
  3577. return dir;
  3578. }
  3579. public boolean isRunning() {
  3580. return isNewWalkCmdIsRunning() || (isRunning2 && isMoving);
  3581. }
  3582.  
  3583. public void getNextPlayerMovement() {
  3584. mapRegionDidChange = false;
  3585. didTeleport = false;
  3586. dir1 = dir2 = -1;
  3587. if (teleportToX != -1 && teleportToY != -1) {
  3588. mapRegionDidChange = true;
  3589. if (mapRegionX != -1 && mapRegionY != -1) {
  3590. int relX = teleportToX - mapRegionX * 8, relY = teleportToY - mapRegionY * 8;
  3591. if (relX >= 2 * 8 && relX < 11 * 8 && relY >= 2 * 8 && relY < 11 * 8)
  3592. mapRegionDidChange = false;
  3593. }
  3594. if (mapRegionDidChange) {
  3595. mapRegionX = (teleportToX >> 3) - 6;
  3596. mapRegionY = (teleportToY >> 3) - 6;
  3597. }
  3598. currentX = teleportToX - 8 * mapRegionX;
  3599. currentY = teleportToY - 8 * mapRegionY;
  3600. absX = teleportToX;
  3601. absY = teleportToY;
  3602. resetWalkingQueue();
  3603.  
  3604. teleportToX = teleportToY = -1;
  3605. didTeleport = true;
  3606. } else {
  3607. dir1 = getNextWalkingDirection();
  3608. if (dir1 == -1)
  3609. return;
  3610. if (isRunning) {
  3611. dir2 = getNextWalkingDirection();
  3612. }
  3613. int deltaX = 0, deltaY = 0;
  3614. if (currentX < 2 * 8) {
  3615. deltaX = 4 * 8;
  3616. mapRegionX -= 4;
  3617. mapRegionDidChange = true;
  3618. } else if (currentX >= 11 * 8) {
  3619. deltaX = -4 * 8;
  3620. mapRegionX += 4;
  3621. mapRegionDidChange = true;
  3622. }
  3623. if (currentY < 2 * 8) {
  3624. deltaY = 4 * 8;
  3625. mapRegionY -= 4;
  3626. mapRegionDidChange = true;
  3627. } else if (currentY >= 11 * 8) {
  3628. deltaY = -4 * 8;
  3629. mapRegionY += 4;
  3630. mapRegionDidChange = true;
  3631. }
  3632.  
  3633. if (mapRegionDidChange) {
  3634. currentX += deltaX;
  3635. currentY += deltaY;
  3636. for (int i = 0; i < walkingQueueSize; i++) {
  3637. walkingQueueX[i] += deltaX;
  3638. walkingQueueY[i] += deltaY;
  3639. }
  3640. }
  3641.  
  3642. }
  3643. }
  3644.  
  3645. public void updateThisPlayerMovement(Stream str) {
  3646. // synchronized(this) {
  3647. if (mapRegionDidChange) {
  3648. str.createFrame(73);
  3649. str.writeWordA(mapRegionX + 6);
  3650. str.writeWord(mapRegionY + 6);
  3651. }
  3652.  
  3653. if (didTeleport) {
  3654. str.createFrameVarSizeWord(81);
  3655. str.initBitAccess();
  3656. str.writeBits(1, 1);
  3657. str.writeBits(2, 3);
  3658. str.writeBits(2, heightLevel);
  3659. str.writeBits(1, 1);
  3660. str.writeBits(1, (updateRequired) ? 1 : 0);
  3661. str.writeBits(7, currentY);
  3662. str.writeBits(7, currentX);
  3663. return;
  3664. }
  3665.  
  3666. if (dir1 == -1) {
  3667. // don't have to update the character position, because we're just
  3668. // standing
  3669. str.createFrameVarSizeWord(81);
  3670. str.initBitAccess();
  3671. isMoving = false;
  3672. if (updateRequired) {
  3673. // tell client there's an update block appended at the end
  3674. str.writeBits(1, 1);
  3675. str.writeBits(2, 0);
  3676. } else {
  3677. str.writeBits(1, 0);
  3678. }
  3679. if (DirectionCount < 50) {
  3680. DirectionCount++;
  3681. }
  3682. } else {
  3683. DirectionCount = 0;
  3684. str.createFrameVarSizeWord(81);
  3685. str.initBitAccess();
  3686. str.writeBits(1, 1);
  3687.  
  3688. if (dir2 == -1) {
  3689. isMoving = true;
  3690. str.writeBits(2, 1);
  3691. str.writeBits(3, Misc.xlateDirectionToClient[dir1]);
  3692. if (updateRequired)
  3693. str.writeBits(1, 1);
  3694. else
  3695. str.writeBits(1, 0);
  3696. } else {
  3697. isMoving = true;
  3698. str.writeBits(2, 2);
  3699. str.writeBits(3, Misc.xlateDirectionToClient[dir1]);
  3700. str.writeBits(3, Misc.xlateDirectionToClient[dir2]);
  3701. if (updateRequired)
  3702. str.writeBits(1, 1);
  3703. else
  3704. str.writeBits(1, 0);
  3705. }
  3706. }
  3707.  
  3708. }
  3709.  
  3710. public void updatePlayerMovement(Stream str) {
  3711. // synchronized(this) {
  3712. if (dir1 == -1) {
  3713. if (updateRequired || isChatTextUpdateRequired()) {
  3714.  
  3715. str.writeBits(1, 1);
  3716. str.writeBits(2, 0);
  3717. } else
  3718. str.writeBits(1, 0);
  3719. } else if (dir2 == -1) {
  3720.  
  3721. str.writeBits(1, 1);
  3722. str.writeBits(2, 1);
  3723. str.writeBits(3, Misc.xlateDirectionToClient[dir1]);
  3724. str.writeBits(1, (updateRequired || isChatTextUpdateRequired()) ? 1 : 0);
  3725. } else {
  3726.  
  3727. str.writeBits(1, 1);
  3728. str.writeBits(2, 2);
  3729. str.writeBits(3, Misc.xlateDirectionToClient[dir1]);
  3730. str.writeBits(3, Misc.xlateDirectionToClient[dir2]);
  3731. str.writeBits(1, (updateRequired || isChatTextUpdateRequired()) ? 1 : 0);
  3732. }
  3733.  
  3734. }
  3735.  
  3736. public void addNewNPC(NPC npc, Stream str, Stream updateBlock) {
  3737. // synchronized(this) {
  3738. int id = npc.npcId;
  3739. npcInListBitmap[id >> 3] |= 1 << (id & 7);
  3740. npcList[npcListSize++] = npc;
  3741.  
  3742. str.writeBits(14, id);
  3743.  
  3744. int z = npc.absY - absY;
  3745. if (z < 0)
  3746. z += 32;
  3747. str.writeBits(5, z);
  3748. z = npc.absX - absX;
  3749. if (z < 0)
  3750. z += 32;
  3751. str.writeBits(5, z);
  3752.  
  3753. str.writeBits(1, 0);
  3754. str.writeBits(14, npc.npcType);
  3755.  
  3756. boolean savedUpdateRequired = npc.updateRequired;
  3757. npc.updateRequired = true;
  3758. npc.appendNPCUpdateBlock(updateBlock);
  3759. npc.updateRequired = savedUpdateRequired;
  3760. str.writeBits(1, 1);
  3761. }
  3762.  
  3763. public void addNewPlayer(Player plr, Stream str, Stream updateBlock) {
  3764. // synchronized(this) {
  3765. if (playerListSize >= 255) {
  3766. return;
  3767. }
  3768. int id = plr.playerId;
  3769. playerInListBitmap[id >> 3] |= 1 << (id & 7);
  3770. playerList[playerListSize++] = plr;
  3771. str.writeBits(11, id);
  3772. str.writeBits(1, 1);
  3773. boolean savedFlag = plr.isAppearanceUpdateRequired();
  3774. boolean savedUpdateRequired = plr.updateRequired;
  3775. plr.setAppearanceUpdateRequired(true);
  3776. plr.updateRequired = true;
  3777. plr.appendPlayerUpdateBlock(updateBlock);
  3778. plr.setAppearanceUpdateRequired(savedFlag);
  3779. plr.updateRequired = savedUpdateRequired;
  3780. str.writeBits(1, 1);
  3781. int z = plr.absY - absY;
  3782. if (z < 0)
  3783. z += 32;
  3784. str.writeBits(5, z);
  3785. z = plr.absX - absX;
  3786. if (z < 0)
  3787. z += 32;
  3788. str.writeBits(5, z);
  3789. }
  3790.  
  3791. protected void appendPlayerAppearance(Stream str) {
  3792. playerProps.currentOffset = 0;
  3793. playerProps.writeByte(playerAppearance[0]);
  3794. StringBuilder sb = new StringBuilder(titles.getCurrentTitle());
  3795. if (titles.getCurrentTitle().equalsIgnoreCase("None")) {
  3796. sb.delete(0, sb.length());
  3797. }
  3798. playerProps.writeString(sb.toString());
  3799. sb = new StringBuilder(titles.getCurrentTitleColor());
  3800. if (titles.getCurrentTitle().equalsIgnoreCase("None")) {
  3801. sb.delete(0, sb.length());
  3802. }
  3803. playerProps.writeString(sb.toString());
  3804. if (venomDamage > 0) {
  3805. playerProps.writeByte(2);
  3806. } else if (poisonDamage > 0) {
  3807. playerProps.writeByte(1);
  3808. } else {
  3809. playerProps.writeByte(0);
  3810. }
  3811. playerProps.writeByte(headIcon);
  3812. playerProps.writeByte(headIconPk);
  3813. if (isNpc == false) {
  3814. if (playerEquipment[playerHat] > 1) {
  3815. playerProps.writeWord(0x200 + playerEquipment[playerHat]);
  3816. } else {
  3817. playerProps.writeByte(0);
  3818. }
  3819.  
  3820. if (playerEquipment[playerCape] > 1) {
  3821. playerProps.writeWord(0x200 + playerEquipment[playerCape]);
  3822. } else {
  3823. playerProps.writeByte(0);
  3824. }
  3825.  
  3826. if (playerEquipment[playerAmulet] > 1) {
  3827. playerProps.writeWord(0x200 + playerEquipment[playerAmulet]);
  3828. } else {
  3829. playerProps.writeByte(0);
  3830. }
  3831.  
  3832. if (playerEquipment[playerWeapon] > 1) {
  3833. playerProps.writeWord(0x200 + playerEquipment[playerWeapon]);
  3834. } else {
  3835. playerProps.writeByte(0);
  3836. }
  3837.  
  3838. if (playerEquipment[playerChest] > 1) {
  3839. playerProps.writeWord(0x200 + playerEquipment[playerChest]);
  3840. } else {
  3841. playerProps.writeWord(0x100 + playerAppearance[2]);
  3842. }
  3843.  
  3844. if (playerEquipment[playerShield] > 1) {
  3845. playerProps.writeWord(0x200 + playerEquipment[playerShield]);
  3846. } else {
  3847. playerProps.writeByte(0);
  3848. }
  3849.  
  3850. if (!Item.isFullBody(playerEquipment[playerChest])) {
  3851. playerProps.writeWord(0x100 + playerAppearance[3]);
  3852. } else {
  3853. playerProps.writeByte(0);
  3854. }
  3855.  
  3856. if (playerEquipment[playerLegs] > 1) {
  3857. playerProps.writeWord(0x200 + playerEquipment[playerLegs]);
  3858. } else {
  3859. playerProps.writeWord(0x100 + playerAppearance[5]);
  3860. }
  3861.  
  3862. if (!Item.isFullHelm(playerEquipment[playerHat]) && !Item.isFullMask(playerEquipment[playerHat])) {
  3863. playerProps.writeWord(0x100 + playerAppearance[1]);
  3864. } else {
  3865. playerProps.writeByte(0);
  3866. }
  3867.  
  3868. if (playerEquipment[playerHands] > 1) {
  3869. playerProps.writeWord(0x200 + playerEquipment[playerHands]);
  3870. } else {
  3871. playerProps.writeWord(0x100 + playerAppearance[4]);
  3872. }
  3873.  
  3874. if (playerEquipment[playerFeet] > 1) {
  3875. playerProps.writeWord(0x200 + playerEquipment[playerFeet]);
  3876. } else {
  3877. playerProps.writeWord(0x100 + playerAppearance[6]);
  3878. }
  3879.  
  3880. if (playerAppearance[0] != 1 && !Item.isFullMask(playerEquipment[playerHat])) {
  3881. playerProps.writeWord(0x100 + playerAppearance[7]);
  3882. } else {
  3883. playerProps.writeByte(0);
  3884. }
  3885. } else {
  3886. playerProps.writeWord(-1);
  3887. playerProps.writeWord(npcId2);
  3888. }
  3889. playerProps.writeByte(playerAppearance[8]);
  3890. playerProps.writeByte(playerAppearance[9]);
  3891. playerProps.writeByte(playerAppearance[10]);
  3892. playerProps.writeByte(playerAppearance[11]);
  3893. playerProps.writeByte(playerAppearance[12]);
  3894. playerProps.writeWord(playerStandIndex); // standAnimIndex
  3895. playerProps.writeWord(playerTurnIndex); // standTurnAnimIndex
  3896. playerProps.writeWord(playerWalkIndex); // walkAnimIndex
  3897. playerProps.writeWord(playerTurn180Index); // turn180AnimIndex
  3898. playerProps.writeWord(playerTurn90CWIndex); // turn90CWAnimIndex
  3899. playerProps.writeWord(playerTurn90CCWIndex); // turn90CCWAnimIndex
  3900. playerProps.writeWord(playerRunIndex); // runAnimIndex
  3901. playerProps.writeQWord(Misc.playerNameToInt64(playerName));
  3902. playerProps.writeByte(invisible ? 1 : 0);
  3903. combatLevel = calculateCombatLevel();
  3904. playerProps.writeByte(combatLevel); // combat level
  3905. playerProps.writeByte(rights.getValue());
  3906. playerProps.writeWord(0);
  3907. str.writeByteC(playerProps.currentOffset);
  3908. str.writeBytes(playerProps.buffer, playerProps.currentOffset, 0);
  3909. }
  3910.  
  3911. public int calculateCombatLevel() {
  3912. int j = getLevelForXP(playerXP[playerAttack]);
  3913. int k = getLevelForXP(playerXP[playerDefence]);
  3914. int l = getLevelForXP(playerXP[playerStrength]);
  3915. int i1 = getLevelForXP(playerXP[playerHitpoints]);
  3916. int j1 = getLevelForXP(playerXP[playerPrayer]);
  3917. int k1 = getLevelForXP(playerXP[playerRanged]);
  3918. int l1 = getLevelForXP(playerXP[playerMagic]);
  3919. int combatLevel = (int) (((k + i1) + Math.floor(j1 / 2)) * 0.25D) + 1;
  3920. double d = (j + l) * 0.32500000000000001D;
  3921. double d1 = Math.floor(k1 * 1.5D) * 0.32500000000000001D;
  3922. double d2 = Math.floor(l1 * 1.5D) * 0.32500000000000001D;
  3923. if (d >= d1 && d >= d2) {
  3924. combatLevel += d;
  3925. } else if (d1 >= d && d1 >= d2) {
  3926. combatLevel += d1;
  3927. } else if (d2 >= d && d2 >= d1) {
  3928. combatLevel += d2;
  3929. }
  3930. return combatLevel;
  3931. }
  3932.  
  3933. public int getLevelForXP(int exp) {
  3934. int points = 0;
  3935. int output = 0;
  3936.  
  3937. for (int lvl = 1; lvl <= 99; lvl++) {
  3938. points += Math.floor(lvl + 300.0 * Math.pow(2.0, lvl / 7.0));
  3939. output = (int) Math.floor(points / 4);
  3940. if (output >= exp)
  3941. return lvl;
  3942. }
  3943. return 99;
  3944. }
  3945.  
  3946. protected void appendPlayerChatText(Stream str) {
  3947. // synchronized(this) {
  3948. str.writeWordBigEndian(((getChatTextColor() & 0xFF) << 8) + (getChatTextEffects() & 0xFF));
  3949. str.writeByte(rights.getValue());
  3950. str.writeByteC(getChatTextSize());
  3951. str.writeBytes_reverse(getChatText(), getChatTextSize(), 0);
  3952.  
  3953. }
  3954.  
  3955. public void forcedChat(String text) {
  3956. forcedText = text;
  3957. forcedChatUpdateRequired = true;
  3958. updateRequired = true;
  3959. setAppearanceUpdateRequired(true);
  3960. }
  3961.  
  3962. public void appendForcedChat(Stream str) {
  3963. // synchronized(this) {
  3964. str.writeString(forcedText);
  3965. }
  3966.  
  3967. public void appendMask100Update(Stream str) {
  3968. // synchronized(this) {
  3969. str.writeWordBigEndian(mask100var1);
  3970. str.writeDWord(mask100var2);
  3971.  
  3972. }
  3973.  
  3974. public void gfx100(int gfx) {
  3975. mask100var1 = gfx;
  3976. mask100var2 = 6553600;
  3977. mask100update = true;
  3978. updateRequired = true;
  3979. }
  3980.  
  3981. public void gfx0(int gfx) {
  3982. mask100var1 = gfx;
  3983. mask100var2 = 65536;
  3984. mask100update = true;
  3985. updateRequired = true;
  3986. }
  3987.  
  3988. public boolean wearing2h() {
  3989. Player c = this;
  3990. String s = c.getItems().getItemName(c.playerEquipment[c.playerWeapon]);
  3991. if (s.contains("2h"))
  3992. return true;
  3993. else if (s.contains("godsword"))
  3994. return true;
  3995. return false;
  3996. }
  3997.  
  3998. /**
  3999. * Animations
  4000. **/
  4001. public void startAnimation(int animId) {
  4002. if (wearing2h() && animId == 829)
  4003. return;
  4004. animationRequest = animId;
  4005. animationWaitCycles = 0;
  4006. updateRequired = true;
  4007. }
  4008.  
  4009. public void startAnimation(int animId, int time) {
  4010. animationRequest = animId;
  4011. animationWaitCycles = time;
  4012. updateRequired = true;
  4013. }
  4014.  
  4015. public void stopAnimation() {
  4016. animationRequest = 65535;
  4017. animationWaitCycles = 0;
  4018. updateRequired = true;
  4019. }
  4020.  
  4021. public void appendAnimationRequest(Stream str) {
  4022. // synchronized(this) {
  4023. str.writeWordBigEndian((animationRequest == -1) ? 65535 : animationRequest);
  4024. str.writeByteC(animationWaitCycles);
  4025.  
  4026. }
  4027.  
  4028. public void faceUpdate(int index) {
  4029. face = index;
  4030. faceUpdateRequired = true;
  4031. updateRequired = true;
  4032. }
  4033.  
  4034. public void appendFaceUpdate(Stream str) {
  4035. // synchronized(this) {
  4036. str.writeWordBigEndian(face);
  4037.  
  4038. }
  4039.  
  4040. public void turnPlayerTo(int pointX, int pointY) {
  4041. FocusPointX = 2 * pointX + 1;
  4042. FocusPointY = 2 * pointY + 1;
  4043. updateRequired = true;
  4044. }
  4045.  
  4046. private void appendSetFocusDestination(Stream str) {
  4047. // synchronized(this) {
  4048. str.writeWordBigEndianA(FocusPointX);
  4049. str.writeWordBigEndian(FocusPointY);
  4050.  
  4051. }
  4052.  
  4053. /**
  4054. * Hit Update
  4055. **/
  4056. protected void appendHitUpdate(Stream str) {
  4057. str.writeByte(hitDiff);
  4058. if (hitmark == null) {
  4059. str.writeByteA(0);
  4060. } else {
  4061. str.writeByteA(hitmark.getId());
  4062. }
  4063. if (playerLevel[3] <= 0) {
  4064. playerLevel[3] = 0;
  4065. isDead = true;
  4066. }
  4067. str.writeByteC(playerLevel[3]);
  4068. str.writeByte(getLevelForXP(playerXP[3]));
  4069. }
  4070.  
  4071. protected void appendHitUpdate2(Stream str) {
  4072. str.writeByte(hitDiff2);
  4073. if (secondHitmark == null) {
  4074. str.writeByteS(0);
  4075. } else {
  4076. str.writeByteS(secondHitmark.getId());
  4077. }
  4078. if (playerLevel[3] <= 0) {
  4079. playerLevel[3] = 0;
  4080. isDead = true;
  4081. }
  4082. str.writeByte(playerLevel[3]);
  4083. str.writeByteC(getLevelForXP(playerXP[3]));
  4084.  
  4085. }
  4086.  
  4087. public void appendPlayerUpdateBlock(Stream str) {
  4088. // synchronized(this) {
  4089. if (!updateRequired && !isChatTextUpdateRequired())
  4090. return; // nothing required
  4091. int updateMask = 0;
  4092. if (forceMovementUpdateRequired) {
  4093. updateMask |= 0x400;
  4094. }
  4095. if (mask100update) {
  4096. updateMask |= 0x100;
  4097. }
  4098. if (animationRequest != -1) {
  4099. updateMask |= 8;
  4100. }
  4101. if (forcedChatUpdateRequired) {
  4102. updateMask |= 4;
  4103. }
  4104. if (isChatTextUpdateRequired()) {
  4105. updateMask |= 0x80;
  4106. }
  4107. if (isAppearanceUpdateRequired()) {
  4108. updateMask |= 0x10;
  4109. }
  4110. if (faceUpdateRequired) {
  4111. updateMask |= 1;
  4112. }
  4113. if (FocusPointX != -1) {
  4114. updateMask |= 2;
  4115. }
  4116. if (hitUpdateRequired) {
  4117. updateMask |= 0x20;
  4118. }
  4119.  
  4120. if (hitUpdateRequired2) {
  4121. updateMask |= 0x200;
  4122. }
  4123.  
  4124. if (updateMask >= 0x100) {
  4125. updateMask |= 0x40;
  4126. str.writeByte(updateMask & 0xFF);
  4127. str.writeByte(updateMask >> 8);
  4128. } else {
  4129. str.writeByte(updateMask);
  4130. }
  4131. if (forceMovementUpdateRequired) {
  4132. appendMask400Update(str);
  4133. }
  4134. if (mask100update) {
  4135. appendMask100Update(str);
  4136. }
  4137. if (animationRequest != -1) {
  4138. appendAnimationRequest(str);
  4139. }
  4140. if (forcedChatUpdateRequired) {
  4141. appendForcedChat(str);
  4142. }
  4143. if (isChatTextUpdateRequired()) {
  4144. appendPlayerChatText(str);
  4145. }
  4146. if (faceUpdateRequired) {
  4147. appendFaceUpdate(str);
  4148. }
  4149. if (isAppearanceUpdateRequired()) {
  4150. appendPlayerAppearance(str);
  4151. }
  4152. if (FocusPointX != -1) {
  4153. appendSetFocusDestination(str);
  4154. }
  4155. if (hitUpdateRequired) {
  4156. appendHitUpdate(str);
  4157. }
  4158. if (hitUpdateRequired2) {
  4159. appendHitUpdate2(str);
  4160. }
  4161.  
  4162. }
  4163.  
  4164. private int x1 = -1;
  4165. private int y1 = -1;
  4166. private int x2 = -1;
  4167. private int y2 = -1;
  4168. private int speed1 = -1;
  4169. private int speed2 = -1;
  4170. private int direction = -1;
  4171.  
  4172. /**
  4173. * Creates a force-movement update block. (0x400)
  4174. *
  4175. * @param x2
  4176. * @param y2
  4177. * @param x1
  4178. * @param y1
  4179. * @param speed1
  4180. * @param speed2
  4181. * @param direction
  4182. * @param ticks
  4183. */
  4184. public void setForceMovement(final int x2, final int y2, boolean x1, boolean y1, final int speed1, final int speed2, final int direction,
  4185. final int ticks) {
  4186. setCanWalk(false);
  4187. this.x1 = getPosition().getLocalX();
  4188. this.y1 = getPosition().getLocalY();
  4189. this.x2 = x1 ? getPosition().getLocalX() + x2 : getPosition().getLocalX() - x2;
  4190. this.y2 = y1 ? getPosition().getLocalY() + y2 : getPosition().getLocalY() - y2;
  4191. this.speed1 = speed1;
  4192. this.speed2 = speed2;
  4193. this.direction = direction;
  4194. updateRequired = true;
  4195. forceMovementUpdateRequired = true;
  4196. Server.getTaskScheduler().schedule(new ScheduledTask(ticks) {
  4197. @Override
  4198. public void execute() {
  4199. absX = absX + x2;
  4200. absY = absY + y2;
  4201. stop();
  4202. }
  4203. });
  4204. Server.getTaskScheduler().schedule(new ScheduledTask(ticks + 1) {
  4205. @Override
  4206. public void execute() {
  4207. getPA().movePlayer(getPosition().getX(), getPosition().getY(), getPosition().getZ());
  4208. setForceMovementRequired(false);
  4209. setCanWalk(true);
  4210. }
  4211. });
  4212. }
  4213.  
  4214. public void appendMask400Update(Stream str) {
  4215. str.writeByteS(x1);
  4216. str.writeByteS(y1);
  4217. str.writeByteS(x2);
  4218. str.writeByteS(y2);
  4219. str.writeWordBigEndianA(speed1);
  4220. str.writeWordA(speed2);
  4221. str.writeByteS(direction);
  4222. }
  4223.  
  4224. public void clearUpdateFlags() {
  4225. updateRequired = false;
  4226. setChatTextUpdateRequired(false);
  4227. setAppearanceUpdateRequired(false);
  4228. hitUpdateRequired = false;
  4229. hitUpdateRequired2 = false;
  4230. forcedChatUpdateRequired = false;
  4231. forceMovementUpdateRequired = false;
  4232. mask100update = false;
  4233. animationRequest = -1;
  4234. FocusPointX = -1;
  4235. FocusPointY = -1;
  4236. faceUpdateRequired = false;
  4237. face = 65535;
  4238. }
  4239.  
  4240. public void stopMovement() {
  4241. if (teleportToX <= 0 && teleportToY <= 0) {
  4242. teleportToX = absX;
  4243. teleportToY = absY;
  4244. }
  4245. newWalkCmdSteps = 0;
  4246. getNewWalkCmdX()[0] = getNewWalkCmdY()[0] = travelBackX[0] = travelBackY[0] = 0;
  4247. getNextPlayerMovement();
  4248. }
  4249.  
  4250. public void preProcessing() {
  4251. newWalkCmdSteps = 0;
  4252. }
  4253.  
  4254. public int setPacketsReceived(int packetsReceived) {
  4255. return packetsReceived;
  4256. }
  4257.  
  4258. public AtomicInteger getPacketsReceived() {
  4259. return packetsReceived;
  4260. }
  4261.  
  4262. public void postProcessing() {
  4263. if (newWalkCmdSteps > 0) {
  4264. int firstX = getNewWalkCmdX()[0], firstY = getNewWalkCmdY()[0];
  4265.  
  4266. int lastDir = 0;
  4267. boolean found = false;
  4268. numTravelBackSteps = 0;
  4269. int ptr = wQueueReadPtr;
  4270. int dir = Misc.direction(currentX, currentY, firstX, firstY);
  4271. if (dir != -1 && (dir & 1) != 0) {
  4272. do {
  4273. lastDir = dir;
  4274. if (--ptr < 0)
  4275. ptr = walkingQueueSize - 1;
  4276.  
  4277. travelBackX[numTravelBackSteps] = walkingQueueX[ptr];
  4278. travelBackY[numTravelBackSteps++] = walkingQueueY[ptr];
  4279. dir = Misc.direction(walkingQueueX[ptr], walkingQueueY[ptr], firstX, firstY);
  4280. if (lastDir != dir) {
  4281. found = true;
  4282. break;
  4283. }
  4284.  
  4285. } while (ptr != wQueueWritePtr);
  4286. } else
  4287. found = true;
  4288.  
  4289. if (!found)
  4290. println_debug("Fatal: couldn't find connection vertex! Dropping packet.");
  4291. else {
  4292. wQueueWritePtr = wQueueReadPtr;
  4293.  
  4294. addToWalkingQueue(currentX, currentY);
  4295.  
  4296. if (dir != -1 && (dir & 1) != 0) {
  4297.  
  4298. for (int i = 0; i < numTravelBackSteps - 1; i++) {
  4299. addToWalkingQueue(travelBackX[i], travelBackY[i]);
  4300. }
  4301. int wayPointX2 = travelBackX[numTravelBackSteps - 1], wayPointY2 = travelBackY[numTravelBackSteps - 1];
  4302. int wayPointX1, wayPointY1;
  4303. if (numTravelBackSteps == 1) {
  4304. wayPointX1 = currentX;
  4305. wayPointY1 = currentY;
  4306. } else {
  4307. wayPointX1 = travelBackX[numTravelBackSteps - 2];
  4308. wayPointY1 = travelBackY[numTravelBackSteps - 2];
  4309. }
  4310.  
  4311. dir = Misc.direction(wayPointX1, wayPointY1, wayPointX2, wayPointY2);
  4312. if (dir == -1 || (dir & 1) != 0) {
  4313. println_debug("Fatal: The walking queue is corrupt! wp1=(" + wayPointX1 + ", " + wayPointY1 + "), " + "wp2=(" + wayPointX2
  4314. + ", " + wayPointY2 + ")");
  4315. } else {
  4316. dir >>= 1;
  4317. found = false;
  4318. int x = wayPointX1, y = wayPointY1;
  4319. while (x != wayPointX2 || y != wayPointY2) {
  4320. x += Misc.directionDeltaX[dir];
  4321. y += Misc.directionDeltaY[dir];
  4322. if ((Misc.direction(x, y, firstX, firstY) & 1) == 0) {
  4323. found = true;
  4324. break;
  4325. }
  4326. }
  4327. if (!found) {
  4328. println_debug("Fatal: Internal error: unable to determine connection vertex!" + " wp1=(" + wayPointX1 + ", " + wayPointY1
  4329. + "), wp2=(" + wayPointX2 + ", " + wayPointY2 + "), " + "first=(" + firstX + ", " + firstY + ")");
  4330. } else
  4331. addToWalkingQueue(wayPointX1, wayPointY1);
  4332. }
  4333. } else {
  4334. for (int i = 0; i < numTravelBackSteps; i++) {
  4335. addToWalkingQueue(travelBackX[i], travelBackY[i]);
  4336. }
  4337. }
  4338.  
  4339. for (int i = 0; i < newWalkCmdSteps; i++) {
  4340. addToWalkingQueue(getNewWalkCmdX()[i], getNewWalkCmdY()[i]);
  4341. }
  4342.  
  4343. }
  4344.  
  4345. isRunning = isNewWalkCmdIsRunning() || isRunning2;
  4346. }
  4347. }
  4348.  
  4349. public int getMapRegionX() {
  4350. return mapRegionX;
  4351. }
  4352.  
  4353. public int getMapRegionY() {
  4354. return mapRegionY;
  4355. }
  4356.  
  4357. public int getX() {
  4358. return absX;
  4359. }
  4360.  
  4361. public int getY() {
  4362. return absY;
  4363. }
  4364.  
  4365. public int getId() {
  4366. return playerId;
  4367. }
  4368.  
  4369. public int getIndex() {
  4370. return index;
  4371. }
  4372. private int index = -1;
  4373. public boolean inCook() {
  4374. return absX >= 3029 && absX <= 3032 && absY >= 3382 && absY <= 3384;
  4375. }
  4376.  
  4377. public boolean inPcBoat() {
  4378. return absX >= 2660 && absX <= 2663 && absY >= 2638 && absY <= 2643;
  4379. }
  4380.  
  4381. public boolean inPcGame() {
  4382. return absX >= 2624 && absX <= 2690 && absY >= 2550 && absY <= 2619;
  4383. }
  4384.  
  4385. public void setHitDiff(int hitDiff) {
  4386. this.hitDiff = hitDiff;
  4387. }
  4388.  
  4389. public void setHitDiff2(int hitDiff2) {
  4390. this.hitDiff2 = hitDiff2;
  4391. }
  4392.  
  4393. public int getHitDiff() {
  4394. return hitDiff;
  4395. }
  4396.  
  4397. public void setAppearanceUpdateRequired(boolean appearanceUpdateRequired) {
  4398. this.appearanceUpdateRequired = appearanceUpdateRequired;
  4399. }
  4400.  
  4401. public boolean isAppearanceUpdateRequired() {
  4402. return appearanceUpdateRequired;
  4403. }
  4404.  
  4405. public void setChatTextEffects(int chatTextEffects) {
  4406. this.chatTextEffects = chatTextEffects;
  4407. }
  4408.  
  4409. public int getChatTextEffects() {
  4410. return chatTextEffects;
  4411. }
  4412.  
  4413. public void setChatTextSize(byte chatTextSize) {
  4414. this.chatTextSize = chatTextSize;
  4415. }
  4416.  
  4417. public byte getChatTextSize() {
  4418. return chatTextSize;
  4419. }
  4420.  
  4421. public void setChatTextUpdateRequired(boolean chatTextUpdateRequired) {
  4422. this.chatTextUpdateRequired = chatTextUpdateRequired;
  4423. }
  4424.  
  4425. public boolean isChatTextUpdateRequired() {
  4426. return chatTextUpdateRequired;
  4427. }
  4428.  
  4429. public void setChatText(byte chatText[]) {
  4430. this.chatText = chatText;
  4431. }
  4432.  
  4433. public byte[] getChatText() {
  4434. return chatText;
  4435. }
  4436.  
  4437. public void setChatTextColor(int chatTextColor) {
  4438. this.chatTextColor = chatTextColor;
  4439. }
  4440.  
  4441. public int getChatTextColor() {
  4442. return chatTextColor;
  4443. }
  4444.  
  4445. public void setNewWalkCmdX(int newWalkCmdX[]) {
  4446. this.newWalkCmdX = newWalkCmdX;
  4447. }
  4448.  
  4449. public int[] getNewWalkCmdX() {
  4450. return newWalkCmdX;
  4451. }
  4452.  
  4453. public void setNewWalkCmdY(int newWalkCmdY[]) {
  4454. this.newWalkCmdY = newWalkCmdY;
  4455. }
  4456.  
  4457. public int[] getNewWalkCmdY() {
  4458. return newWalkCmdY;
  4459. }
  4460.  
  4461. public void setNewWalkCmdIsRunning(boolean newWalkCmdIsRunning) {
  4462. this.newWalkCmdIsRunning = newWalkCmdIsRunning;
  4463. }
  4464.  
  4465. public boolean isNewWalkCmdIsRunning() {
  4466. return newWalkCmdIsRunning;
  4467. }
  4468.  
  4469. public void setInStreamDecryption(ISAACCipher inStreamDecryption) {
  4470. this.inStreamDecryption = inStreamDecryption;
  4471. }
  4472.  
  4473. public void setOutStreamDecryption(ISAACCipher outStreamDecryption) {
  4474. this.outStreamDecryption = outStreamDecryption;
  4475. }
  4476.  
  4477. public boolean samePlayer() {
  4478. for (int j = 0; j < PlayerHandler.players.length; j++) {
  4479. if (j == playerId)
  4480. continue;
  4481. if (PlayerHandler.players[j] != null) {
  4482. if (PlayerHandler.players[j].playerName.equalsIgnoreCase(playerName)) {
  4483. disconnected = true;
  4484. return true;
  4485. }
  4486. }
  4487. }
  4488. return false;
  4489. }
  4490.  
  4491. public void putInCombat(int attacker) {
  4492. underAttackBy = attacker;
  4493. logoutDelay.reset();
  4494. singleCombatDelay.reset();
  4495. }
  4496.  
  4497. public int appendDamage(int damage, Hitmark h) {
  4498. if (damage < 0) {
  4499. damage = 0;
  4500. h = Hitmark.MISS;
  4501. }
  4502. if (playerLevel[playerHitpoints] - damage < 0) {
  4503. damage = playerLevel[playerHitpoints];
  4504. }
  4505. if (teleTimer <= 0) {
  4506. playerLevel[playerHitpoints] -= damage;
  4507. if (!hitUpdateRequired) {
  4508. hitUpdateRequired = true;
  4509. hitDiff = damage;
  4510. hitmark = h;
  4511. } else if (!hitUpdateRequired2) {
  4512. hitUpdateRequired2 = true;
  4513. hitDiff2 = damage;
  4514. secondHitmark = h;
  4515. }
  4516. this.getPA().refreshSkill(3);
  4517. } else {
  4518. if (hitUpdateRequired) {
  4519. hitUpdateRequired = false;
  4520. }
  4521. if (hitUpdateRequired2) {
  4522. hitUpdateRequired2 = false;
  4523. }
  4524. }
  4525. updateRequired = true;
  4526. return damage;
  4527. }
  4528.  
  4529. public void handleHitMask(int damage) {
  4530. if (!hitUpdateRequired) {
  4531. hitUpdateRequired = true;
  4532. hitDiff = damage;
  4533. } else if (!hitUpdateRequired2) {
  4534. hitUpdateRequired2 = true;
  4535. hitDiff2 = damage;
  4536. }
  4537. updateRequired = true;
  4538. }
  4539.  
  4540. public String getLastClanChat() {
  4541. return lastClanChat;
  4542. }
  4543.  
  4544. public long getNameAsLong() {
  4545. return nameAsLong;
  4546. }
  4547.  
  4548. public void setNameAsLong(long hash) {
  4549. this.nameAsLong = hash;
  4550. }
  4551.  
  4552. public boolean isStopPlayer() {
  4553. return stopPlayer;
  4554. }
  4555.  
  4556. public void setStopPlayer(boolean stopPlayer) {
  4557. this.stopPlayer = stopPlayer;
  4558. }
  4559.  
  4560. public int getPlayerIdentifier() {
  4561. return this.playerId;
  4562. }
  4563.  
  4564. public int getFace() {
  4565. return this.playerId + '\u8000';
  4566. }
  4567.  
  4568. public int getLockIndex() {
  4569. return -this.playerId - 1;
  4570. }
  4571.  
  4572. public int getHeight() {
  4573. return this.heightLevel;
  4574. }
  4575.  
  4576. public boolean isDead() {
  4577. return this.playerLevel[3] <= 0 || this.isDead;
  4578. }
  4579.  
  4580. public void healPlayer(int heal) {
  4581. this.playerLevel[3] += heal;
  4582. if (this.playerLevel[3] > this.getLevelForXP(this.playerXP[3])) {
  4583. this.playerLevel[3] = this.getLevelForXP(this.playerXP[3]);
  4584. }
  4585.  
  4586. }
  4587.  
  4588. int maxLevel() {
  4589. return 99;
  4590. }
  4591.  
  4592. public void sendGraphic(int id, int height) {
  4593. if (height == 0) {
  4594. this.gfx0(id);
  4595. }
  4596.  
  4597. if (height == 100) {
  4598. this.gfx100(id);
  4599. }
  4600.  
  4601. }
  4602.  
  4603. public boolean protectingRange() {
  4604. return this.prayerActive[17];
  4605. }
  4606.  
  4607. public boolean protectingMagic() {
  4608. return this.prayerActive[16];
  4609. }
  4610.  
  4611. public boolean protectingMelee() {
  4612. return this.prayerActive[18];
  4613. }
  4614.  
  4615. public void setTrading(boolean trading) {
  4616. this.trading = trading;
  4617. }
  4618.  
  4619. public boolean isTrading() {
  4620. return this.trading;
  4621. }
  4622.  
  4623. public boolean isInvisible() {
  4624. return invisible;
  4625. }
  4626.  
  4627. public void setInvisible(boolean invisible) {
  4628. this.invisible = invisible;
  4629. }
  4630.  
  4631. public boolean inGodmode() {
  4632. return godmode;
  4633. }
  4634.  
  4635. public void setGodmode(boolean godmode) {
  4636. this.godmode = godmode;
  4637. }
  4638.  
  4639. public double getDropModifier() {
  4640. return dropModifier;
  4641. }
  4642.  
  4643. public void setDropModifier(double modifier) {
  4644. this.dropModifier = modifier;
  4645. }
  4646.  
  4647. public boolean isDebug() {
  4648. return debug == 1;
  4649. }
  4650.  
  4651. public void setDebug(int debug) {
  4652. this.debug = debug;
  4653. }
  4654.  
  4655. public boolean inSafemode() {
  4656. return safemode;
  4657. }
  4658.  
  4659. public void setSafemode(boolean safemode) {
  4660. this.safemode = safemode;
  4661. }
  4662.  
  4663. public void setDragonfireShieldCharge(int charge) {
  4664. this.dragonfireShieldCharge = charge;
  4665. }
  4666.  
  4667. public int getDragonfireShieldCharge() {
  4668. return dragonfireShieldCharge;
  4669. }
  4670.  
  4671. public void setLastDragonfireShieldAttack(long lastAttack) {
  4672. this.lastDragonfireShieldAttack = lastAttack;
  4673. }
  4674.  
  4675. public long getLastDragonfireShieldAttack() {
  4676. return lastDragonfireShieldAttack;
  4677. }
  4678.  
  4679. public boolean isDragonfireShieldActive() {
  4680. return dragonfireShieldActive;
  4681. }
  4682.  
  4683. public void setDragonfireShieldActive(boolean dragonfireShieldActive) {
  4684. this.dragonfireShieldActive = dragonfireShieldActive;
  4685. }
  4686.  
  4687. /**
  4688. * Retrieves the rights for this player.
  4689. *
  4690. * @return the rights
  4691. */
  4692. public Rights getRights() {
  4693. return rights;
  4694. }
  4695.  
  4696. /**
  4697. * Updates the rights for this player by comparing the players current
  4698. * rights to that of the available rights and assigning the first rank
  4699. * found.
  4700. */
  4701. public void setRights(Rights rights) {
  4702. this.rights = rights;
  4703. }
  4704.  
  4705. /**
  4706. * Returns a single instance of the Titles class for this player
  4707. *
  4708. * @return the titles class
  4709. */
  4710. public Titles getTitles() {
  4711. if (titles == null) {
  4712. titles = new Titles(this);
  4713. }
  4714. return titles;
  4715. }
  4716.  
  4717. /**
  4718. * Mutates the current hitmark to be that of the new hitmark. This is
  4719. * commonly done in battle.
  4720. *
  4721. * @param hitmark
  4722. * the hitmark
  4723. */
  4724. public void setHitmark(Hitmark hitmark) {
  4725. this.hitmark = hitmark;
  4726. }
  4727.  
  4728. /**
  4729. * Mutates the first and second hitmark. This is commonly done in battle.
  4730. *
  4731. * @param hitmark
  4732. * the first hitmark
  4733. * @param secondHitmark
  4734. * the second hitmark
  4735. */
  4736. public void setHitmarks(Hitmark hitmark, Hitmark secondHitmark) {
  4737. this.hitmark = hitmark;
  4738. this.secondHitmark = secondHitmark;
  4739. }
  4740.  
  4741. public void appendPoisonDamage() {
  4742. if (poisonDamage <= 0) {
  4743. return;
  4744. }
  4745. Player client = this;
  4746. if (poisonDamageHistory.size() >= 4) {
  4747. poisonDamageHistory.clear();
  4748. poisonDamage--;
  4749. }
  4750. if (poisonDamage <= 0) {
  4751. client.sendMessage("The poison has subsided.");
  4752. client.getPA().requestUpdates();
  4753. return;
  4754. }
  4755. poisonDamageHistory.add(poisonDamage);
  4756. appendDamage(poisonDamage, Hitmark.POISON);
  4757. client.getPA().requestUpdates();
  4758. }
  4759.  
  4760. public void appendVenomDamage() {
  4761. if (venomDamage <= 0) {
  4762. return;
  4763. }
  4764. venomDamage += 2;
  4765. if (venomDamage >= 20) {
  4766. venomDamage = 20;
  4767. }
  4768. appendDamage(venomDamage, Hitmark.VENOM);
  4769. getPA().requestUpdates();
  4770. }
  4771.  
  4772. /**
  4773. * Determines if the player is susceptible to poison but comparing the
  4774. * duration of their immunity to the time of the last cure.
  4775. *
  4776. * @return true of they can be poisoned.
  4777. */
  4778. public boolean isSusceptibleToPoison() {
  4779. return System.currentTimeMillis() - this.lastPoisonCure > this.poisonImmunity;
  4780. }
  4781.  
  4782. /**
  4783. * The duration of time in milliseconds the player is immune to poison for
  4784. *
  4785. * @return the duration of time the player is immune to poison for
  4786. */
  4787. public long getPoisonImmunity() {
  4788. return poisonImmunity;
  4789. }
  4790.  
  4791. /**
  4792. * Modifies the current duration of poison immunity
  4793. *
  4794. * @param duration
  4795. * the new duration
  4796. */
  4797. public void setPoisonImmunity(long duration) {
  4798. this.poisonImmunity = duration;
  4799. }
  4800.  
  4801. /**
  4802. * The amount of damage received when hit by toxic
  4803. *
  4804. * @return the toxic damage
  4805. */
  4806. public byte getPoisonDamage() {
  4807. return poisonDamage;
  4808. }
  4809.  
  4810. /**
  4811. * Sets the current amount of damage received when hit by toxic
  4812. *
  4813. * @param toxicDamage
  4814. * the new amount of damage received
  4815. */
  4816. public void setPoisonDamage(byte toxicDamage) {
  4817. this.poisonDamage = toxicDamage;
  4818. }
  4819.  
  4820. /**
  4821. * The time in milliseconds of the last toxic damage the player received
  4822. *
  4823. * @return the time in milliseconds of the last toxic damage hit
  4824. */
  4825. public long getLastPoisonHit() {
  4826. return lastPoisonHit;
  4827. }
  4828.  
  4829. /**
  4830. * Sets the last time, in milliseconds, the toxic damaged the player
  4831. *
  4832. * @param toxic
  4833. * the time in milliseconds
  4834. */
  4835. public void setLastPoisonHit(long toxic) {
  4836. lastPoisonHit = toxic;
  4837. }
  4838.  
  4839. /**
  4840. * Sets the current amount of damage received when hit by venom
  4841. *
  4842. * @param venomDamage
  4843. * the new amount of damage received
  4844. */
  4845. public void setVenomDamage(byte venomDamage) {
  4846. this.venomDamage = venomDamage;
  4847. }
  4848.  
  4849. /**
  4850. * The time in milliseconds of the last venom damage the player received
  4851. *
  4852. * @return the time in milliseconds of the last venom damage hit
  4853. */
  4854. public long getLastVenomHit() {
  4855. return lastVenomHit;
  4856. }
  4857.  
  4858. /**
  4859. * Sets the last time, in milliseconds, the venom damaged the player
  4860. *
  4861. * @param venom
  4862. * the time in milliseconds
  4863. */
  4864. public void setLastVenomHit(long toxic) {
  4865. lastVenomHit = toxic;
  4866. }
  4867.  
  4868. /**
  4869. * Determines if the player is susceptible to venom by comparing the
  4870. * duration of their immunity to the time of the last cure.
  4871. *
  4872. * @return true of they can be infected by venom.
  4873. */
  4874. public boolean isSusceptibleToVenom() {
  4875. return System.currentTimeMillis() - lastVenomCure > venomImmunity && !getItems().isWearingItem(12931);
  4876. }
  4877.  
  4878. /**
  4879. * The duration of time in milliseconds the player is immune to venom for
  4880. *
  4881. * @return the duration of time the player is immune to poison for
  4882. */
  4883. public long getVenomImmunity() {
  4884. return venomImmunity;
  4885. }
  4886.  
  4887. /**
  4888. * Modifies the current duration of venom immunity
  4889. *
  4890. * @param duration
  4891. * the new duration
  4892. */
  4893. public void setVenomImmunity(long duration) {
  4894. this.venomImmunity = duration;
  4895. }
  4896.  
  4897. /**
  4898. * The amount of damage received when hit by venom
  4899. *
  4900. * @return the venom damage
  4901. */
  4902. public byte getVenomDamage() {
  4903. return venomDamage;
  4904. }
  4905.  
  4906. /**
  4907. * The time in milliseconds that the player healed themselves of venom
  4908. *
  4909. * @return the last time the player cured themself of poison
  4910. */
  4911. public long getLastVenomCure() {
  4912. return lastVenomCure;
  4913. }
  4914.  
  4915. /**
  4916. * Sets the time in milliseconds that the player cured themself of poison
  4917. *
  4918. * @param lastPoisonCure
  4919. * the last time the player cured themselves
  4920. */
  4921. public void setLastVenomCure(long lastVenomCure) {
  4922. this.lastVenomCure = lastVenomCure;
  4923. }
  4924.  
  4925. /**
  4926. * Mutates the current hitmark to be that of the new hitmark. This is
  4927. * commonly done in battle.
  4928. *
  4929. * @param hitmark
  4930. * the hitmark
  4931. */
  4932. public void setSecondHitmark(Hitmark secondHitmark) {
  4933. this.secondHitmark = secondHitmark;
  4934. }
  4935.  
  4936. /**
  4937. * The time in milliseconds that the player healed themselves of poison
  4938. *
  4939. * @return the last time the player cured themself of poison
  4940. */
  4941. public long getLastPoisonCure() {
  4942. return lastPoisonCure;
  4943. }
  4944.  
  4945. /**
  4946. * Sets the time in milliseconds that the player cured themself of poison
  4947. *
  4948. * @param lastPoisonCure
  4949. * the last time the player cured themselves
  4950. */
  4951. public void setLastPoisonCure(long lastPoisonCure) {
  4952. this.lastPoisonCure = lastPoisonCure;
  4953. }
  4954.  
  4955. /**
  4956. * Retrieves the current hitmark
  4957. *
  4958. * @return the hitmark
  4959. */
  4960. public Hitmark getHitmark() {
  4961. return hitmark;
  4962. }
  4963.  
  4964. /**
  4965. * Retrieves the second hitmark
  4966. *
  4967. * @return the second hitmark
  4968. */
  4969. public Hitmark getSecondHitmark() {
  4970. return secondHitmark;
  4971. }
  4972.  
  4973. public RandomEventInterface getInterfaceEvent() {
  4974. return randomEventInterface;
  4975. }
  4976.  
  4977. /**
  4978. * The interface that is currently open
  4979. */
  4980. private int interfaceOpen;
  4981. public int playerRights;
  4982. public boolean itemID;
  4983. public int cwpoints;
  4984. public long playTimeTotal = 0;//total play time
  4985. public long recordedLogin = 0;//the current time in ms set when you login. used to calculate time logged in when you logout
  4986. public int hitpoints = 10;
  4987.  
  4988.  
  4989.  
  4990. /**
  4991. * Modifies the current interface open
  4992. *
  4993. * @param interfaceOpen
  4994. * the interface id
  4995. */
  4996. public void setInterfaceOpen(int interfaceOpen) {
  4997. this.interfaceOpen = interfaceOpen;
  4998. }
  4999.  
  5000. /**
  5001. * The interface that is opened
  5002. *
  5003. * @return the interface id
  5004. */
  5005. public int getInterfaceOpen() {
  5006. return interfaceOpen;
  5007. }
  5008.  
  5009. public long setBestZulrahTime(long bestZulrahTime) {
  5010. return this.bestZulrahTime = bestZulrahTime;
  5011. }
  5012.  
  5013. public long getBestZulrahTime() {
  5014. return bestZulrahTime;
  5015. }
  5016.  
  5017. public LostItems getLostItems() {
  5018. if (lostItems == null) {
  5019. lostItems = new LostItems(this);
  5020. }
  5021. return lostItems;
  5022. }
  5023.  
  5024. public int getToxicBlowpipeCharge() {
  5025. return toxicBlowpipeCharge;
  5026. }
  5027.  
  5028. public void setToxicBlowpipeCharge(int charge) {
  5029. this.toxicBlowpipeCharge = charge;
  5030. }
  5031.  
  5032. public int getToxicBlowpipeAmmo() {
  5033. return toxicBlowpipeAmmo;
  5034. }
  5035.  
  5036. public int getToxicBlowpipeAmmoAmount() {
  5037. return toxicBlowpipeAmmoAmount;
  5038. }
  5039.  
  5040. public void setToxicBlowpipeAmmoAmount(int amount) {
  5041. this.toxicBlowpipeAmmoAmount = amount;
  5042. }
  5043.  
  5044. public void setToxicBlowpipeAmmo(int ammo) {
  5045. this.toxicBlowpipeAmmo = ammo;
  5046. }
  5047.  
  5048. public int getSerpentineHelmCharge() {
  5049. return this.serpentineHelmCharge;
  5050. }
  5051.  
  5052. public int getToxicStaffOfDeadCharge() {
  5053. return this.toxicStaffOfDeadCharge;
  5054. }
  5055.  
  5056. public void setSerpentineHelmCharge(int charge) {
  5057. this.serpentineHelmCharge = charge;
  5058. }
  5059.  
  5060. public void setToxicStaffOfDeadCharge(int charge) {
  5061. this.toxicStaffOfDeadCharge = charge;
  5062. }
  5063.  
  5064. public int getTridentCharge() {
  5065. return tridentCharge;
  5066. }
  5067.  
  5068. public void setTridentCharge(int tridentCharge) {
  5069. this.tridentCharge = tridentCharge;
  5070. }
  5071.  
  5072. public int getToxicTridentCharge() {
  5073. return toxicTridentCharge;
  5074. }
  5075.  
  5076. public void setToxicTridentCharge(int toxicTridentCharge) {
  5077. this.toxicTridentCharge = toxicTridentCharge;
  5078. }
  5079.  
  5080. public static final int maxPlayerListSize = Config.MAX_PLAYERS;
  5081. public static final int maxNPCListSize = NPCHandler.maxNPCs;
  5082. protected static Stream playerProps;
  5083.  
  5084. static {
  5085. playerProps = new Stream(new byte[100]);
  5086. }
  5087.  
  5088. public void updateRank() {
  5089. if (amDonated >= 10 && amDonated < 30 && getRights().getValue() == 0) {
  5090. setRights(Rights.CONTRIBUTOR);
  5091. }
  5092. if (amDonated >= 30 && amDonated < 75 && getRights().getValue() <= 5 && !getRights().isStaff()) {
  5093. setRights(Rights.SPONSOR);
  5094. }
  5095. if (amDonated >= 75 && amDonated < 150 && getRights().getValue() <= 6 && !getRights().isStaff()) {
  5096. setRights(Rights.SUPPORTER);
  5097. }
  5098. if (amDonated >= 150 && amDonated < 300 && getRights().getValue() <= 7 && !getRights().isStaff()) {
  5099. setRights(Rights.V_I_P);
  5100. }
  5101. if (amDonated >= 300 && !getRights().isStaff()) {
  5102. setRights(Rights.SUPER_V_I_P);
  5103. }
  5104. }
  5105.  
  5106. public String getUsername() {
  5107. // TODO Auto-generated method stub
  5108. return null;
  5109. }
  5110.  
  5111. public void dealDamage(int i) {
  5112. // TODO Auto-generated method stub
  5113.  
  5114. }
  5115.  
  5116. public boolean inCwGame() {
  5117. // TODO Auto-generated method stub
  5118. return false;
  5119. }
  5120.  
  5121. public boolean inZammyWait() {
  5122. // TODO Auto-generated method stub
  5123. return false;
  5124. }
  5125.  
  5126. public boolean inSaraWait() {
  5127. // TODO Auto-generated method stub
  5128. return false;
  5129. }
  5130.  
  5131. public boolean zammyTeam() {
  5132. // TODO Auto-generated method stub
  5133. return false;
  5134. }
  5135.  
  5136. public boolean saraTeam() {
  5137. // TODO Auto-generated method stub
  5138. return false;
  5139. }
  5140.  
  5141. public Object getInventory() {
  5142. // TODO Auto-generated method stub
  5143. return null;
  5144. }
  5145.  
  5146. public int getLevelForXP(Object object) {
  5147. // TODO Auto-generated method stub
  5148. return 0;
  5149. }
  5150. public int[] realLevel = new int[25];
  5151. public int calculateMaxLifePoints() {
  5152.  
  5153. int lifePoints = realLevel[3];// the normal hp
  5154.  
  5155. int torvaLegs = 13360; int virtusLegs = 13346; int pernixChaps = 13352;
  5156. int torvaBody = 13358; int virtusBody = 13348; int pernixBody = 13354;
  5157. int torvaHelm = 13362; int virtusHelm = 13350; int pernixCowl = 13355;
  5158.  
  5159. if (playerEquipment[playerLegs] == torvaLegs || playerEquipment[playerLegs] == virtusLegs || playerEquipment[playerLegs] == pernixChaps)
  5160. lifePoints += 13;
  5161. if (playerEquipment[playerChest] == torvaBody || playerEquipment[playerChest] == virtusBody || playerEquipment[playerChest] == pernixBody)
  5162. lifePoints += 20;
  5163. if (playerEquipment[playerHat] == torvaHelm || playerEquipment[playerHat] == virtusHelm || playerEquipment[playerHat] == pernixCowl)
  5164. lifePoints += 7;
  5165. return (lifePoints*10);
  5166. }
  5167.  
  5168. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement