Advertisement
Guest User

Untitled

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