Advertisement
Guest User

Untitled

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