Advertisement
Guest User

player.java

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