Advertisement
Guest User

player

a guest
Sep 22nd, 2016
407
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 189.29 KB | None | 0 0
  1. package org.perception.model.players;
  2.  
  3. import java.util.ArrayList;
  4.  
  5. import java.util.Arrays;
  6. import java.util.HashMap;
  7. import java.util.List;
  8. import java.util.Map;
  9. import java.util.Map.Entry;
  10. import java.util.Objects;
  11. import java.util.Optional;
  12. import java.util.Queue;
  13. import java.util.concurrent.ConcurrentLinkedQueue;
  14. import java.util.concurrent.Future;
  15. import java.util.concurrent.TimeUnit;
  16. import java.util.concurrent.atomic.AtomicInteger;
  17. import java.net.*;
  18. import java.text.DecimalFormat;
  19. import java.io.*;
  20.  
  21. import org.jboss.netty.buffer.ChannelBuffers;
  22. import org.jboss.netty.channel.Channel;
  23. import org.perception.Config;
  24. import org.perception.Connection;
  25. import org.perception.Server;
  26. import org.perception.event.CycleEvent;
  27. import org.perception.event.CycleEventContainer;
  28. import org.perception.event.CycleEventHandler;
  29. import org.perception.model.Entity;
  30. import org.perception.model.Location;
  31. import org.perception.model.content.*;
  32. import org.perception.model.content.Kraken.Kraken;
  33. import org.perception.model.content.achievement.AchievementHandler;
  34. import org.perception.model.content.achievement.Achievements;
  35. import org.perception.model.content.clan.Clan;
  36. import org.perception.model.content.dialogue.*;
  37. import org.perception.model.content.instances.InstancedAreaManager;
  38. import org.perception.model.content.kill_streaks.Killstreak;
  39. import org.perception.model.content.presets.Presets;
  40. import org.perception.model.content.teleport.Position;
  41. import org.perception.model.content.titles.Titles;
  42. import org.perception.model.content.zulrah.Zulrah;
  43. import org.perception.model.interaction.MultiplayerSessionStage;
  44. import org.perception.model.interaction.MultiplayerSessionType;
  45. import org.perception.model.interaction.clan_wars.ClanWarsMap;
  46. import org.perception.model.interaction.duel.Duel;
  47. import org.perception.model.interaction.duel.DuelSession;
  48. import org.perception.model.interaction.trade.Trade;
  49. import org.perception.model.items.EquipmentSet;
  50. import org.perception.model.items.Item;
  51. import org.perception.model.items.ItemAssistant;
  52. import org.perception.model.items.ItemCombination;
  53. import org.perception.model.items.ItemDefinition;
  54. import org.perception.model.items.bank.Bank;
  55. import org.perception.model.items.bank.BankPin;
  56. import org.perception.model.minigames.Barrows;
  57. import org.perception.model.minigames.bounty_hunter.BountyHunter;
  58. import org.perception.model.minigames.bounty_hunter.TargetState;
  59. import org.perception.model.minigames.fight_cave.FightCave;
  60. import org.perception.model.minigames.pest_control.PestControl;
  61. import org.perception.model.minigames.pest_control.PestControlRewards;
  62. import org.perception.model.minigames.warriors_guild.WarriorsGuild;
  63. import org.perception.model.npcs.NPC;
  64. import org.perception.model.npcs.NPCDeathTracker;
  65. import org.perception.model.npcs.NPCHandler;
  66. import org.perception.model.npcs.PetHandler;
  67. import org.perception.model.npcs.Bosses.Cerberus;
  68. import org.perception.model.players.Player;
  69. import org.perception.model.players.PvPHandler;
  70. import org.perception.model.players.PlayerHandler;
  71. import org.perception.model.players.combat.CombatAssistant;
  72. import org.perception.model.players.combat.Damage;
  73. import org.perception.model.players.combat.DamageQueueEvent;
  74. import org.perception.model.players.combat.Degrade;
  75. import org.perception.model.players.combat.Hitmark;
  76. import org.perception.model.players.consumable.Food;
  77. import org.perception.model.players.consumable.Potions;
  78. import org.perception.model.players.skills.*;
  79. import org.perception.model.players.skills.agility.Agility;
  80. import org.perception.model.players.skills.agility.AgilityHandler;
  81. import org.perception.model.players.skills.agility.impl.GnomeAgility;
  82. import org.perception.model.players.skills.agility.impl.WildernessAgility;
  83. import org.perception.model.players.skills.cooking.Cooking;
  84. import org.perception.model.players.skills.crafting.Crafting;
  85. import org.perception.model.players.skills.farming.Farming;
  86. import org.perception.model.players.skills.herblore.*;
  87. import org.perception.model.players.skills.hunter.Chinchompa;
  88. import org.perception.model.players.skills.mining.Mining;
  89. import org.perception.model.players.skills.prayer.Prayer;
  90. import org.perception.model.players.skills.runecrafting.*;
  91. import org.perception.model.players.skills.slayer.BossSlayer;
  92. import org.perception.model.players.skills.slayer.Slayer;
  93. import org.perception.model.players.skills.thieving.Thieving;
  94. import org.perception.model.shops.ShopAssistant;
  95. import org.perception.net.Packet;
  96. import org.perception.net.Packet.Type;
  97. import org.perception.net.outgoing.UnnecessaryPacketDropper;
  98. import org.perception.util.Misc;
  99. import org.perception.util.Stopwatch;
  100. import org.perception.util.Stream;
  101.  
  102. public class Player extends Entity {
  103. private PvPHandler pvpHandler = new PvPHandler(this);
  104. private RandomEventInterface randomEventInterface = new RandomEventInterface(this);
  105. private Mining mining = new Mining(this);
  106. private PestControlRewards pestControlRewards = new PestControlRewards(this);
  107. private WarriorsGuild warriorsGuild = new WarriorsGuild(this);
  108. public Zulrah zulrah = new Zulrah(this);
  109. private Kraken kraken = new Kraken(this);
  110. private NPCDeathTracker npcDeathTracker = new NPCDeathTracker(this);
  111. private UnnecessaryPacketDropper packetDropper = new UnnecessaryPacketDropper();
  112. private DamageQueueEvent damageQueue = new DamageQueueEvent(this);
  113. private DialogueManager dialogue = new DialogueManager(this);
  114. private Streak streak = new Streak(this);
  115. private HashMap<String, ArrayList<Damage>> damageReceived = new HashMap<>();
  116. private BountyHunter bountyHunter = new BountyHunter(this);
  117. private MysteryBox mysteryBox = new MysteryBox(this);
  118. private long lastContainerSearch;
  119. private AchievementHandler achievementHandler;
  120. private PlayerKill playerKills;
  121. public String macAddress;
  122. private Duel duelSession = new Duel(this);
  123. private Player itemOnPlayer;
  124. private Presets presets = null;
  125. private Killstreak killstreaks;
  126. private PunishmentPanel punishmentPanel = new PunishmentPanel(this);
  127. private final QuickPrayer quick = new QuickPrayer();
  128. public long newVar;
  129. public int hits;
  130. public int specs;
  131.  
  132. public long SPAWN_LIZARDS;
  133. public long JUMP_ABILITY;
  134. public int CAST_ROCKS = 0;
  135. public boolean check = false;
  136.  
  137. public int CAST_GHOSTS = 0;
  138. public boolean alreadySpawned = false;
  139. public int ticks = 0;
  140. public int MAGIC_ATTACK = 0;
  141. public int RANGE_ATTACK = 0;
  142. public boolean Jumped = false;
  143. public int MELEE_ATTACK = 0;
  144. public int RANDOM = 0;
  145. public int RANDOM_MELEE = 0;
  146. public boolean TICKING_DAMAGE = false;
  147. public int ZULRAH_CLICKS = 0;
  148. public int KRAKEN_CLICKS = 0;
  149. public int lastX = absX;
  150. public int lastY = absY;
  151. public int[] pouch = { 0, 0, 0, 0 };
  152. public String yellTag = "";
  153. public Boolean hasDied = false;
  154. /**
  155. * Agility
  156. */
  157.  
  158. public boolean doingAgility = false;
  159. public boolean isSkilling;
  160.  
  161. /**
  162. * Obstacle Variables
  163. */
  164.  
  165. public boolean finishedLog = false, finishedNet1 = false, finishedBranch1 = false, finishedRope = false,
  166. finishedBranch2 = false, finishedNet2 = false, finishedPipe = false, finishedBarbRope = false,
  167. finishedBarbLog = false, finishedBarbNet = false, finishedBarbLedge = false, finishedBarbStairs = false,
  168. finishedBarbWall1 = false, finishedBarbWall2 = false, finishedBarbWall3 = false, finishedWildPipe = false,
  169. finishedWildRope = false, finishedWildStone = false, finishedWildLog = false, finishedWildRocks = false;
  170.  
  171. public static final Boundary BOUNDARY_CORP = new Boundary(/* (X) */2970, /* (Y) */4370, /* (X) */2995,
  172. /* (Y) */4400);
  173.  
  174. public int[] getExperience() {
  175. return this.playerXP;
  176. }
  177.  
  178. public int FocusPointX = -1;
  179. public int FocusPointY = -1;
  180.  
  181. public void turnPlayerTo(int pointX, int pointY) {
  182. FocusPointX = 2 * pointX + 1;
  183. FocusPointY = 2 * pointY + 1;
  184. updateRequired = true;
  185. }
  186.  
  187. @Override
  188. public String toString() {
  189. return "player[" + playerName + "]";
  190. }
  191.  
  192. public long playTimeTotal = 0;
  193. public long recordedLogin = 0;
  194. public long abbyTime = 0;
  195. public boolean teleport;
  196. public byte buffer[] = null;
  197. public Stream inStream = null, outStream = null;
  198. private Channel session;
  199. private Trade trade = new Trade(this);
  200. private ItemAssistant itemAssistant = new ItemAssistant(this);
  201. private ShopAssistant shopAssistant = new ShopAssistant(this);
  202. private PlayerAssistant playerAssistant = new PlayerAssistant(this);
  203. private CombatAssistant combat = new CombatAssistant(this);
  204. private ActionHandler actionHandler = new ActionHandler(this);
  205. private DialogueHandler dialogueHandler = new DialogueHandler(this);
  206. private Friends friend = new Friends(this);
  207. private Ignores ignores = new Ignores(this);
  208. private Queue<Packet> queuedPackets = new ConcurrentLinkedQueue<>();
  209. private Potions potions = new Potions(this);
  210. // //private org.perception.model.players.skills.herblore.PotionMixing
  211. // potionMixing = new
  212. // org.perception.model.players.skills.herblore.PotionMixing(
  213. // this);
  214. private Food food = new Food(this);
  215. private Logs logs = new Logs(this);
  216. private SkillInterfaces skillInterfaces = new SkillInterfaces(this);
  217.  
  218. /**
  219. * Skill instances
  220. */
  221. private PlayerAction playerAction = new PlayerAction(this);
  222. private Slayer slayer = new Slayer(this);
  223. private BossSlayer bossSlayer = new BossSlayer(this);
  224. private Runecrafting runecrafting = new Runecrafting();
  225. private AgilityHandler agilityHandler = new AgilityHandler();
  226. private PointItems pointItems = new PointItems(this);
  227. private GnomeAgility gnomeAgility = new GnomeAgility();
  228. private WildernessAgility wildernessAgility = new WildernessAgility();
  229. private Agility agility = new Agility(this);
  230. private Cooking cooking = new Cooking();
  231. private Crafting crafting = new Crafting(this);
  232. private Prayer prayer = new Prayer(this);
  233. private Smithing smith = new Smithing(this);
  234. private FightCave fightcave = null;
  235. private SmithingInterface smithInt = new SmithingInterface(this);
  236. // private Herblore herblore = new Herblore(this);
  237. private Thieving thieving = new Thieving(this);
  238. private Barrows barrows = new Barrows(this);
  239. public Stopwatch potionTimer = new Stopwatch();
  240. public int[] degradableItem = new int[Degrade.MAXIMUM_ITEMS];
  241. public boolean[] claimDegradableItem = new boolean[Degrade.MAXIMUM_ITEMS];
  242. private Optional<ItemCombination> currentCombination = Optional.empty();
  243. public static PlayerSave save;
  244. public static Player cliento2;
  245. public int lowMemoryVersion = 0;
  246. public int timeOutCounter = 0;
  247. public int returnCode = 2;
  248. private Future<?> currentTask;
  249. public int currentRegion = 0;
  250. public long lastRoll;
  251. public int diceItem;
  252. public int page;
  253. public int specRestore = 0;
  254. private int privateChat;
  255. public boolean slayerHelmetEffect;
  256. public boolean inArdiCC;
  257. public boolean attackSkill = false;
  258. public boolean strengthSkill = false;
  259. public boolean defenceSkill = false;
  260. public boolean mageSkill = false;
  261. public boolean rangeSkill = false;
  262. public boolean abbySpec = false;
  263. public int setDamage = 0;
  264. public boolean prayerSkill = false;
  265. public boolean healthSkill = false;
  266. private Skilling skilling = new Skilling(this);
  267. public int lastClickedItem;
  268. private int[] farmingSeedId = new int[Farming.MAX_PATCHES];
  269. private int[] farmingTime = new int[Farming.MAX_PATCHES];
  270. private int[] farmingState = new int[Farming.MAX_PATCHES];
  271. private int[] farmingHarvest = new int[Farming.MAX_PATCHES];
  272. private Farming farming = new Farming(this);
  273. public int pestControlDamage;
  274. public int bossDamage;
  275. private long bestZulrahTime;
  276. private LostItems lostItems;
  277. private int toxicBlowpipeCharge;
  278. private int toxicBlowpipeAmmo;
  279. private int toxicBlowpipeAmmoAmount;
  280. private int serpentineHelmCharge;
  281. private int toxicStaffOfDeadCharge;
  282. private int tridentCharge;
  283. private int toxicTridentCharge;
  284. public Clan clan;
  285. public String lastClanChat = "";
  286. public String onLoginClan = "OS-WORLD";
  287.  
  288. public Player(Channel s, int _playerId) {
  289. index = _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. apset = 0;
  336. actionID = 0;
  337. playerEquipment[playerHat] = -1;
  338. playerEquipment[playerCape] = -1;
  339. playerEquipment[playerAmulet] = -1;
  340. playerEquipment[playerChest] = -1;
  341. playerEquipment[playerShield] = -1;
  342. playerEquipment[playerLegs] = -1;
  343. playerEquipment[playerHands] = -1;
  344. playerEquipment[playerFeet] = -1;
  345. playerEquipment[playerRing] = -1;
  346. playerEquipment[playerArrows] = -1;
  347. playerEquipment[playerWeapon] = -1;
  348. heightLevel = 0;
  349. teleportToX = Config.START_LOCATION_X;
  350. teleportToY = Config.START_LOCATION_Y;
  351. absX = absY = -1;
  352. mapRegionX = mapRegionY = -1;
  353. currentX = currentY = 0;
  354. resetWalkingQueue();
  355. this.session = s;
  356. outStream = new Stream(new byte[Config.BUFFER_SIZE]);
  357. outStream.currentOffset = 0;
  358. inStream = new Stream(new byte[Config.BUFFER_SIZE]);
  359. inStream.currentOffset = 0;
  360. buffer = new byte[Config.BUFFER_SIZE];
  361. }
  362.  
  363. public Player getClient(String name) {
  364. name = name.toLowerCase();
  365. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  366. if (validClient(i)) {
  367. Player client = getClient(i);
  368. if (client.playerName.toLowerCase().equalsIgnoreCase(name)) {
  369. return client;
  370. }
  371. }
  372. }
  373. return null;
  374. }
  375.  
  376. public void setForceMovement(int xx1, int yy1, int xx2, int yy2, int speedd1, int speedd2, int directionn) {
  377. this.x1 = xx1;
  378. this.y1 = yy1;
  379. this.x2 = xx2;
  380. this.y2 = yy2;
  381. this.speed1 = speedd1;
  382. this.speed2 = speedd2;
  383. this.direction = directionn;
  384. this.forceMovementUpdateRequired = true;
  385. this.updateRequired = true;
  386. }
  387.  
  388. private Bank bank;
  389.  
  390. public Bank getBank() {
  391. if (bank == null)
  392. bank = new Bank(this);
  393. return bank;
  394. }
  395.  
  396. private BankPin pin;
  397.  
  398. public BankPin getBankPin() {
  399. if (pin == null)
  400. pin = new BankPin(this);
  401. return pin;
  402. }
  403.  
  404. public void sendMessage(String s, int color) {
  405. if (getOutStream() != null) {
  406. s = "<col=" + color + ">" + s + "</col>";
  407. outStream.createFrameVarSize(253);
  408. outStream.writeString(s);
  409. outStream.endFrameVarSize();
  410. }
  411.  
  412. }
  413.  
  414. public void sendDebugMessage(String s) {
  415. if (getRights().isOwner() && isDebug()) {
  416. if (getOutStream() != null) {
  417. outStream.createFrameVarSize(253);
  418. outStream.writeString(s);
  419. outStream.endFrameVarSize();
  420. }
  421. }
  422. }
  423.  
  424. public Player getClient(int id) {
  425. return PlayerHandler.players[id];
  426. }
  427.  
  428. public boolean validClient(int id) {
  429. if (id < 0 || id > Config.MAX_PLAYERS) {
  430. return false;
  431. }
  432. return validClient(getClient(id));
  433. }
  434.  
  435. public boolean validClient(String name) {
  436. return validClient(getClient(name));
  437. }
  438.  
  439. public boolean validClient(Player client) {
  440. return (client != null && !client.disconnected);
  441. }
  442.  
  443. public void flushOutStream() {
  444. if (!session.isConnected() || disconnected || outStream.currentOffset == 0)
  445. return;
  446.  
  447. byte[] temp = new byte[outStream.currentOffset];
  448. System.arraycopy(outStream.buffer, 0, temp, 0, temp.length);
  449. Packet packet = new Packet(-1, Type.FIXED, ChannelBuffers.wrappedBuffer(temp));
  450. session.write(packet);
  451. outStream.currentOffset = 0;
  452.  
  453. }
  454.  
  455. private Map<Integer, TinterfaceText> interfaceText = new HashMap<>();
  456.  
  457. public class TinterfaceText {
  458. public int id;
  459. public String currentState;
  460.  
  461. public TinterfaceText(String s, int id) {
  462. this.currentState = s;
  463. this.id = id;
  464. }
  465.  
  466. }
  467.  
  468. public boolean checkPacket126Update(String text, int id) {
  469. if (interfaceText.containsKey(id)) {
  470. TinterfaceText t = interfaceText.get(id);
  471. if (text.equals(t.currentState)) {
  472. return false;
  473. }
  474. }
  475. interfaceText.put(id, new TinterfaceText(text, id));
  476. return true;
  477. }
  478.  
  479. public void sendClan(String name, String message, String clan, int rights) {
  480. name = name.substring(0, 1).toUpperCase() + name.substring(1);
  481. message = message.substring(0, 1).toUpperCase() + message.substring(1);
  482. clan = clan.substring(0, 1).toUpperCase() + clan.substring(1);
  483. outStream.createFrameVarSizeWord(217);
  484. outStream.writeString(name);
  485. outStream.writeString(message);
  486. outStream.writeString(clan);
  487. outStream.writeWord(rights);
  488. outStream.endFrameVarSize();
  489. }
  490.  
  491. public static final int PACKET_SIZES[] = { 0, 0, 0, 1, -1, 0, 0, 0, 4, 0, // 0
  492. 0, 0, 0, 0, 8, 0, 6, 2, 2, 0, // 10
  493. 0, 2, 0, 6, 0, 12, 0, 0, 0, 0, // 20
  494. 0, 0, 0, 0, 0, 8, 4, 0, 0, 2, // 30
  495. 2, 6, 0, 6, 0, -1, 0, 0, 0, 0, // 40
  496. 0, 0, 0, 12, 0, 0, 0, 8, 8, 12, // 50
  497. 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, // 60
  498. 6, 0, 2, 2, 8, 6, 0, -1, 0, 6, // 70
  499. 0, 0, 0, 0, 0, 1, 4, 6, 0, 0, // 80
  500. 0, 0, 0, 0, 0, 3, 0, 0, -1, 0, // 90
  501. 0, 13, 0, -1, 0, 0, 0, 0, 0, 0, // 100
  502. 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, // 110
  503. 1, 0, 6, 0, 16, 0, -1, -1, 2, 6, // 120
  504. 0, 4, 6, 8, 0, 6, 0, 0, 0, 2, // 130
  505. 6, 10, -1, 0, 0, 6, 0, 0, 0, 0, // 140
  506. 0, 0, 1, 2, 0, 2, 6, 0, 0, 0, // 150
  507. 0, 0, 0, 0, -1, -1, 0, 0, 0, 0, // 160
  508. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 170
  509. 0, 8, 0, 3, 0, 2, 0, 0, 8, 1, // 180
  510. 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, // 190
  511. 2, 0, 0, 0, 0, 0, 0, 0, 4, 0, // 200
  512. 4, 0, 0, /* 0 */4, 7, 8, 0, 0, 10, 0, // 210
  513. 0, 0, 0, 0, 0, 0, -1, 0, 6, 0, // 220
  514. 1, 0, 0, 0, 6, 0, 6, 8, 1, 0, // 230
  515. 0, 4, 0, 0, 0, 0, -1, 0, -1, 4, // 240
  516. 0, 0, 6, 6, 0, 0, 0 // 250
  517. };
  518.  
  519. public void resetRanks() {
  520. for (int i = 0; i < 10; i++) {
  521. ranks[i] = 0;
  522. rankPpl[i] = "";
  523. }
  524. }
  525.  
  526. public void highscores() {
  527. getPA().sendFrame126("OS-WORLD Spawn - Top PKers Online", 6399); // Title
  528. for (int i = 0; i < 10; i++) {
  529. if (ranks[i] > 0) {
  530. getPA().sendFrame126("Rank " + (i + 1) + ": " + rankPpl[i] + " - Kills: " + ranks[i] + "", 6402 + i);
  531. }
  532. }
  533. getPA().showInterface(6308);
  534. flushOutStream();
  535. resetRanks();
  536. }
  537.  
  538. public int playerRank = 0;
  539. public static int[] ranks = new int[11];
  540. public static String[] rankPpl = new String[11];
  541.  
  542. public void homeTeleport(int x, int y, int h) {
  543. if (homeTele == 9) {
  544. animation(4850);
  545. } else if (homeTele == 7) {
  546. animation(4853);
  547. gfx0(802);
  548. } else if (homeTele == 5) {
  549. animation(4855);
  550. gfx0(803);
  551. } else if (homeTele == 3) {
  552. animation(4857);
  553. gfx0(804);
  554. } else if (homeTele == 1) {
  555. homeTeleDelay = 0;
  556. homeTele = 0;
  557. teleportToX = x;
  558. teleportToY = y;
  559. heightLevel = h;
  560. }
  561. }
  562.  
  563. public int amountDon;
  564.  
  565. public void rspsdata(Player c, String username) {
  566. try {
  567. username = username.replaceAll(" ", "_");
  568. String secret = "d74cb35426f3d808325876f45b69dbf1"; // YOUR SECRET
  569. // KEY!
  570. String email = "CYCLONEWARNING@HOTMAIL.COM"; // This is the one you
  571. // use to login into
  572. // RSPS-PAY
  573. URL url = new URL("http://rsps-pay.com/includes/listener.php?username=" + username + "&secret=" + secret
  574. + "&email=" + email);
  575. BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
  576. String results = reader.readLine();
  577. if (results.toLowerCase().contains("!error:")) {
  578.  
  579. } else {
  580. String[] ary = results.split(",");
  581. for (int i = 0; i < ary.length; i++) {
  582. switch (ary[i]) {
  583. case "0":
  584. c.sendMessage("Sorry your order cannot be found, speak to a member of the staff.");
  585. break;
  586. case "11852": // product ids can be found on the webstore
  587. // page
  588. // partyhat set
  589. c.getItems().addItem(13173, 1);
  590. c.sendMessage("Thank you for donating!");
  591. c.getPA().loadQuests();
  592. break;
  593. case "11853": // partyhat&specs
  594. c.getItems().addItem(12399, 1);
  595. c.sendMessage("Thank you for donating!");
  596. c.getPA().loadQuests();
  597. break;
  598. case "11854": // 3a melee
  599. c.getItems().addItem(10346, 1);
  600. c.getItems().addItem(10348, 1);
  601. c.getItems().addItem(10350, 1);
  602. c.getItems().addItem(10352, 1);
  603. c.sendMessage("Thank you for donating!");
  604. c.getPA().loadQuests();
  605. break;
  606. case "11855": // 3a mage
  607. c.getItems().addItem(10338, 1);
  608. c.getItems().addItem(10340, 1);
  609. c.getItems().addItem(10342, 1);
  610. c.getItems().addItem(10344, 1);
  611. c.sendMessage("Thank you for donating!");
  612. c.getPA().loadQuests();
  613. break;
  614. case "11856": // 3a range
  615. c.getItems().addItem(10330, 1);
  616. c.getItems().addItem(10332, 1);
  617. c.getItems().addItem(10334, 1);
  618. c.getItems().addItem(10336, 1);
  619. c.sendMessage("Thank you for donating!");
  620. c.getPA().loadQuests();
  621. break;
  622. case "11857": // 3a wand
  623. c.getItems().addItem(12422, 1);
  624. c.sendMessage("Thank you for donating!");
  625. c.getPA().loadQuests();
  626. break;
  627. case "11858": // 3a bow
  628. c.getItems().addItem(12424, 1);
  629. c.sendMessage("Thank you for donating!");
  630. c.getPA().loadQuests();
  631. break;
  632. case "11859": // 3a longsword
  633. c.getItems().addItem(12426, 1);
  634. c.sendMessage("Thank you for donating!");
  635. c.getPA().loadQuests();
  636. break;
  637. case "11860": // 3a cloak
  638. c.getItems().addItem(12437, 1);
  639. c.sendMessage("Thank you for donating!");
  640. c.getPA().loadQuests();
  641. break;
  642. case "11861": // Mystery Box
  643. c.getItems().addItem(6199, 1);
  644. c.sendMessage("Thank you for donating!");
  645. c.getPA().loadQuests();
  646. break;
  647. case "11862": // 10$ Scroll
  648. c.getItems().addItem(2690, 1);
  649. c.sendMessage("Thank you for donating!");
  650. c.getPA().loadQuests();
  651. break;
  652. case "11863": // 20$ Scroll
  653. c.getItems().addItem(2691, 1);
  654. c.sendMessage("Thank you for donating!");
  655. c.getPA().loadQuests();
  656. break;
  657. case "11864": // 30$ Scroll
  658. c.getItems().addItem(2692, 1);
  659. c.sendMessage("Thank you for donating!");
  660. c.getPA().loadQuests();
  661. break;
  662. case "11865": // Contributor Scroll
  663. c.getItems().addItem(2697, 1);
  664. c.sendMessage("Thank you for donating!");
  665. c.getPA().loadQuests();
  666. break;
  667. case "11866": // Super Contributor Scroll
  668. c.getItems().addItem(2698, 1);
  669. c.sendMessage("Thank you for donating!");
  670. c.getPA().loadQuests();
  671. break;
  672. case "11867": // Extreme Contributor Scroll
  673. c.getItems().addItem(2699, 1);
  674. c.sendMessage("Thank you for donating!");
  675. c.getPA().loadQuests();
  676. break;
  677. case "11868": // Void Knight
  678. c.getItems().addItem(8839, 1);
  679. c.getItems().addItem(8840, 1);
  680. c.getItems().addItem(8842, 1);
  681. c.getItems().addItem(11663, 1);
  682. c.getItems().addItem(11664, 1);
  683. c.getItems().addItem(11665, 1);
  684. c.sendMessage("Thank you for donating!");
  685. c.getPA().loadQuests();
  686. break;
  687. case "11869": // Rainbow partyhat
  688. c.getItems().addItem(11863, 1);
  689. c.sendMessage("Thank you for donating!");
  690. c.getPA().loadQuests();
  691. break;
  692. case "11870": // Black partyhat
  693. c.getItems().addItem(11862, 1);
  694. c.sendMessage("Thank you for donating!");
  695. c.getPA().loadQuests();
  696. break;
  697. case "11871": // Full Bandos
  698. c.getItems().addItem(11832, 1);
  699. c.getItems().addItem(11834, 1);
  700. c.getItems().addItem(11836, 1);
  701. c.sendMessage("Thank you for donating!");
  702. c.getPA().loadQuests();
  703. break;
  704. case "11872": // Black H'ween
  705. c.getItems().addItem(11847, 1);
  706. c.sendMessage("Thank you for donating!");
  707. c.getPA().loadQuests();
  708. break;
  709. case "11873": // Hween Mask Set
  710. c.getItems().addItem(13175, 1);
  711. c.sendMessage("Thank you for donating!");
  712. c.getPA().loadQuests();
  713. break;
  714. case "11880": // Armadyl Armour set
  715. c.getItems().addItem(11826, 1);
  716. c.getItems().addItem(11828, 1);
  717. c.getItems().addItem(11830, 1);
  718. c.sendMessage("Thank you for donating!");
  719. c.getPA().loadQuests();
  720. break;
  721. case "11881": // Abyssal Dagger P++
  722. c.getItems().addItem(13208, 1);
  723. c.sendMessage("Thank you for donating!");
  724. c.getPA().loadQuests();
  725. break;
  726. case "11883": // Zamorakian Spear
  727. c.getItems().addItem(11824, 1);
  728. c.sendMessage("Thank you for donating!");
  729. c.getPA().loadQuests();
  730. break;
  731. case "11884": // Armadyl Crossbow
  732. c.getItems().addItem(11785, 1);
  733. c.sendMessage("Thank you for donating!");
  734. c.getPA().loadQuests();
  735. break;
  736. case "11885": // Armadyl Godsword
  737. c.getItems().addItem(11802, 1);
  738. c.sendMessage("Thank you for donating!");
  739. c.getPA().loadQuests();
  740. break;
  741. case "11886": // Bandos Godsword
  742. c.getItems().addItem(11804, 1);
  743. c.sendMessage("Thank you for donating!");
  744. c.getPA().loadQuests();
  745. break;
  746. case "11887": // Saradomin Godsword
  747. c.getItems().addItem(11806, 1);
  748. c.sendMessage("Thank you for donating!");
  749. c.getPA().loadQuests();
  750. break;
  751. case "11888": // Zamorak Godsword
  752. c.getItems().addItem(11808, 1);
  753. c.sendMessage("Thank you for donating!");
  754. c.getPA().loadQuests();
  755. break;
  756. case "11889": // Toxic Blowpipe (Empty)
  757. c.getItems().addItem(12924, 1);
  758. c.getItems().addItem(12934, 1000);
  759. c.sendMessage("Thank you for donating!");
  760. c.getPA().loadQuests();
  761. break;
  762. case "11890": // Staff of the Dead
  763. c.getItems().addItem(11791, 1);
  764. c.sendMessage("Thank you for donating!");
  765. c.getPA().loadQuests();
  766. break;
  767. case "11893": // Trident of the Seas
  768. c.getItems().addItem(11907, 1);
  769. c.sendMessage("Thank you for donating!");
  770. c.getPA().loadQuests();
  771. break;
  772. case "11894": // Abyssal Tentacle
  773. c.getItems().addItem(12006, 1);
  774. c.sendMessage("Thank you for donating!");
  775. c.getPA().loadQuests();
  776. break;
  777. case "11895": // Pegasian Boots
  778. c.getItems().addItem(13211, 1);
  779. c.sendMessage("Thank you for donating!");
  780. c.getPA().loadQuests();
  781. break;
  782. case "11896": // Primordial Boots
  783. c.getItems().addItem(13213, 1);
  784. c.sendMessage("Thank you for donating!");
  785. c.getPA().loadQuests();
  786. break;
  787. case "11897": // Eternal Boots
  788. c.getItems().addItem(13215, 1);
  789. c.sendMessage("Thank you for donating!");
  790. c.getPA().loadQuests();
  791. break;
  792. case "11898": // Odium Ward
  793. c.getItems().addItem(11926, 1);
  794. c.sendMessage("Thank you for donating!");
  795. c.getPA().loadQuests();
  796. break;
  797. case "11899": // Malediction Ward
  798. c.getItems().addItem(11924, 1);
  799. c.sendMessage("Thank you for donating!");
  800. c.getPA().loadQuests();
  801. break;
  802. case "11902": // Donator Ticket
  803. c.getItems().addItem(4067, 1000);
  804. c.sendMessage("Thank you for donating!");
  805. c.getPA().loadQuests();
  806. break;
  807. case "12116": // Christmas Cracker
  808. c.getItems().addItem(962, 1);
  809. c.sendMessage("Thank you for donating!");
  810. c.getPA().loadQuests();
  811. break;
  812. case "12117": // Elysian Spirit Shield
  813. c.getItems().addItem(12817, 1);
  814. c.sendMessage("Thank you for donating!");
  815. c.getPA().loadQuests();
  816. break;
  817. case "12118": // Arcane Spirit Shield
  818. c.getItems().addItem(12825, 1);
  819. c.sendMessage("Thank you for donating!");
  820. c.getPA().loadQuests();
  821. break;
  822. case "12119": // Spectral Spirit Shield
  823. c.getItems().addItem(12821, 1);
  824. c.sendMessage("Thank you for donating!");
  825. c.getPA().loadQuests();
  826. break;
  827. case "12120": // Serpentine Helm
  828. c.getItems().addItem(12929, 1);
  829. c.sendMessage("Thank you for donating!");
  830. c.getPA().loadQuests();
  831. break;
  832. case "12121": // Toxic Staff of The Dead
  833. c.getItems().addItem(12902, 1);
  834. c.sendMessage("Thank you for donating!");
  835. c.getPA().loadQuests();
  836. break;
  837. case "12122": // Bunny Ears
  838. c.getItems().addItem(1037, 1);
  839. c.sendMessage("Thank you for donating!");
  840. c.getPA().loadQuests();
  841. break;
  842. case "12123": // Scythe
  843. c.getItems().addItem(1419, 1);
  844. c.sendMessage("Thank you for donating!");
  845. c.getPA().loadQuests();
  846. break;
  847. case "12124": // Sled
  848. c.getItems().addItem(4084, 1);
  849. c.sendMessage("Thank you for donating!");
  850. c.getPA().loadQuests();
  851. break;
  852. case "12125": // Zamorakian Hasta
  853. c.getItems().addItem(11889, 1);
  854. c.sendMessage("Thank you for donating!");
  855. c.getPA().loadQuests();
  856. break;
  857. case "12126": // Dragonfire Shield
  858. c.getItems().addItem(11283, 1);
  859. c.sendMessage("Thank you for donating!");
  860. c.getPA().loadQuests();
  861. break;
  862.  
  863. }
  864. }
  865. }
  866. } catch (IOException e) {
  867. }
  868. }
  869.  
  870. public void drawSkulls() {
  871. if (killStreak >= 0) {
  872. headIconPk = (0);
  873. }
  874. if (killStreak >= 5) {
  875. headIconPk = (1);
  876. }
  877. if (killStreak >= 10) {
  878. headIconPk = (2);
  879. }
  880. if (killStreak >= 20) {
  881. headIconPk = (3);
  882. }
  883. if (killStreak >= 30) {
  884. headIconPk = (4);
  885. }
  886. if (killStreak >= 50) {
  887. headIconPk = (5);
  888. }
  889. }
  890.  
  891. public void destruct() {
  892. if (session == null)
  893. return;
  894.  
  895. if (zulrah.getInstancedZulrah() != null) {
  896. InstancedAreaManager.getSingleton().disposeOf(zulrah.getInstancedZulrah());
  897. }
  898. if (kraken.getInstancedKraken() != null) {
  899. InstancedAreaManager.getSingleton().disposeOf(kraken.getInstancedKraken());
  900. }
  901. if (getPA().viewingOtherBank) {
  902. getPA().resetOtherBank();
  903. }
  904. if (Boundary.isIn(this, PestControl.GAME_BOUNDARY)) {
  905. PestControl.removeGameMember(this);
  906. }
  907. if (Boundary.isIn(this, PestControl.LOBBY_BOUNDARY)) {
  908. PestControl.removeFromLobby(this);
  909. }
  910. if (underAttackBy > 0 || underAttackBy2 > 0)
  911. return;
  912. if (!rights.isAdministrator() && !rights.isOwner()) {
  913. }
  914. if (disconnected == true) {
  915. saveCharacter = true;
  916. }
  917. Server.getMultiplayerSessionListener().removeOldRequests(this);
  918. if (clan != null) {
  919. clan.removeMember(this);
  920. }
  921. getFriends().notifyFriendsOfUpdate();
  922. Misc.println("[Logged out]: " + playerName + "");
  923. CycleEventHandler.getSingleton().stopEvents(this);
  924. disconnected = true;
  925. session.close();
  926. session = null;
  927. inStream = null;
  928. outStream = null;
  929. isActive = false;
  930. buffer = null;
  931. playerListSize = 0;
  932. for (int i = 0; i < maxPlayerListSize; i++)
  933. playerList[i] = null;
  934. absX = absY = -1;
  935. mapRegionX = mapRegionY = -1;
  936. currentX = currentY = 0;
  937. resetWalkingQueue();
  938. }
  939.  
  940. public void sendMessage(String s) {
  941. if (getOutStream() != null) {
  942. outStream.createFrameVarSize(253);
  943. outStream.writeString(s);
  944. outStream.endFrameVarSize();
  945. }
  946. }
  947.  
  948. public void setSidebarInterface(int menuId, int form) {
  949. if (getOutStream() != null) {
  950. outStream.createFrame(71);
  951. outStream.writeWord(form);
  952. outStream.writeByteA(menuId);
  953. }
  954. }
  955.  
  956. public void loadHighscore() {
  957. getPA().sendFrame126("OS-WORLD - Top PKers Online", 6399);
  958. getPA().sendFrame126("Close Window", 6401);
  959. getPA().sendFrame126(" ", 6402);
  960. getPA().sendFrame126(" ", 6403);
  961. getPA().sendFrame126(" ", 6404);
  962. getPA().sendFrame126(" ", 6405);
  963. getPA().sendFrame126("OS-WORLD", 640);
  964. getPA().sendFrame126(" ", 6406);
  965. getPA().sendFrame126(" ", 6407);
  966. getPA().sendFrame126(" ", 6408);
  967. getPA().sendFrame126(" ", 6409);
  968. getPA().sendFrame126(" ", 6410);
  969. getPA().sendFrame126(" ", 6411);
  970. getPA().sendFrame126(" ", 8578);
  971. getPA().sendFrame126(" ", 8579);
  972. getPA().sendFrame126(" ", 8580);
  973. getPA().sendFrame126(" ", 8581);
  974. getPA().sendFrame126(" ", 8582);
  975. getPA().sendFrame126(" ", 8583);
  976. getPA().sendFrame126(" ", 8584);
  977. getPA().sendFrame126(" ", 8585);
  978. getPA().sendFrame126(" ", 8586);
  979. getPA().sendFrame126(" ", 8587);
  980. getPA().sendFrame126(" ", 8588);
  981. getPA().sendFrame126(" ", 8589);
  982. getPA().sendFrame126(" ", 8590);
  983. getPA().sendFrame126(" ", 8591);
  984. getPA().sendFrame126(" ", 8592);
  985. getPA().sendFrame126(" ", 8593);
  986. getPA().sendFrame126(" ", 8594);
  987. getPA().sendFrame126(" ", 8595);
  988. getPA().sendFrame126(" ", 8596);
  989. getPA().sendFrame126(" ", 8597);
  990. getPA().sendFrame126(" ", 8598);
  991. getPA().sendFrame126(" ", 8599);
  992. getPA().sendFrame126(" ", 8600);
  993. getPA().sendFrame126(" ", 8601);
  994. getPA().sendFrame126(" ", 8602);
  995. getPA().sendFrame126(" ", 8603);
  996. getPA().sendFrame126(" ", 8604);
  997. getPA().sendFrame126(" ", 8605);
  998. getPA().sendFrame126(" ", 8606);
  999. getPA().sendFrame126(" ", 8607);
  1000. getPA().sendFrame126(" ", 8608);
  1001. getPA().sendFrame126(" ", 8609);
  1002. getPA().sendFrame126(" ", 8610);
  1003. getPA().sendFrame126(" ", 8611);
  1004. getPA().sendFrame126(" ", 8612);
  1005. getPA().sendFrame126(" ", 8613);
  1006. getPA().sendFrame126(" ", 8614);
  1007. getPA().sendFrame126(" ", 8615);
  1008. getPA().sendFrame126(" ", 8616);
  1009. getPA().sendFrame126(" ", 8617);
  1010. }
  1011.  
  1012. public String randomMessage() {
  1013. int randomMessage = Misc.random(7);
  1014. switch (randomMessage) {
  1015. case 0:
  1016. return "<img=10></img><col=255> Did you know? You can help the server grow by voting every 12 hours! ::vote";
  1017. case 1:
  1018. return "<img=10></img><col=255> Did you know? You can type ::help to submit a ticket to all staff members";
  1019. case 2:
  1020. return "<img=10></img><col=255> Did you know? You can upgrade your account and get great benefits! ::store";
  1021. case 3:
  1022. return "<img=10></img><col=255> Looking for somewhere to different to PK? Try ::easts / ::wests / ::gdz / ::mb";
  1023. case 4:
  1024. return "<img=10></img><col=255> Have a suggestion? Let us know on our forums! ::forums";
  1025. case 5:
  1026. return "<img=10></img><col=255> Enjoying OS-WORLD? Make sure to spread the word and help the community grow!";
  1027. }
  1028. return "<img=10></img><col=255> Did you know? We have a great set of community forums! Join now! ::forums <img=10>";
  1029. }
  1030.  
  1031. public void serverMessages() {
  1032. CycleEventHandler.getSingleton().addEvent(this, new CycleEvent() {
  1033. @Override
  1034. public void execute(CycleEventContainer container) {
  1035. sendMessage(randomMessage());
  1036. }
  1037.  
  1038. @Override
  1039. public void stop() {
  1040. }
  1041. }, 1500);
  1042. }
  1043.  
  1044. public void sendMessageToAll(String message) {
  1045. for (Player player : PlayerHandler.players) {
  1046. if (player == null)
  1047. continue;
  1048. final Player c = (Player) player;
  1049. c.sendMessage(message);
  1050. }
  1051. }
  1052.  
  1053. public void initialize() {
  1054. try {
  1055. Trivia.triviaBot(this);
  1056. hasDied = true;
  1057. Server.clanManager.getHelpClan().addMember(this);
  1058. Achievements.checkIfFinished(this);
  1059. getPA().loadQuests();
  1060. // Highscores.highscores(this, null);
  1061. recordedLogin = System.currentTimeMillis();
  1062. Connection.appendStarters();
  1063. Connection.appendStarters2();
  1064. setStopPlayer(false);
  1065. getPlayerAction().setAction(false);
  1066. getPlayerAction().canWalk(true);
  1067. getPA().sendFrame126(runEnergy + "%", 149);
  1068. isFullHelm = Item.isFullHelm(playerEquipment[playerHat]);
  1069. isFullMask = Item.isFullMask(playerEquipment[playerHat]);
  1070. isFullBody = Item.isFullBody(playerEquipment[playerChest]);
  1071. getPA().sendFrame36(173, isRunning2 ? 1 : 0);
  1072. getPA().sendFrame36(166, 4);
  1073. serverMessages();
  1074. getPA().sendFrame126("PvP Teleports", 45005);
  1075. sendMessage("Welcome to <col=255>OS-WORLD!");
  1076. // sendMessage("Use the bottom right tab for @blu@Presets@bla@ and
  1077. // ::setstat to @blu@Setlevels@bla@.");
  1078. // sendMessage("@bla@Use @blu@::item@bla@ to spawn basic items. ");
  1079. // sendMessage("@bla@Use @blu@::getid@bla@ to get the ID of a item.
  1080. // ");
  1081. sendMessage("@bla@Use @blu@::commands@bla@ to see all your commands.");
  1082. combatLevel = calculateCombatLevel();
  1083. getPA().sendFrame36(505, 0);
  1084. getPA().sendFrame36(506, 0);
  1085. getPA().sendFrame36(507, 1);
  1086. getPA().sendFrame36(508, 0);
  1087. getPA().sendFrame36(166, 2);
  1088. outStream.createFrame(249);
  1089. outStream.writeByteA(1);
  1090. outStream.writeWordBigEndianA(index);
  1091. for (int j = 0; j < PlayerHandler.players.length; j++) {
  1092. if (j == index)
  1093. continue;
  1094. if (PlayerHandler.players[j] != null) {
  1095. if (PlayerHandler.players[j].playerName.equalsIgnoreCase(playerName))
  1096. disconnected = true;
  1097. }
  1098. }
  1099. for (int i = 0; i < 25; i++) {
  1100. getPA().setSkillLevel(i, playerLevel[i], playerXP[i]);
  1101. getPA().refreshSkill(i);
  1102. }
  1103. for (int p = 0; p < PRAYER.length; p++) { // reset prayer glows
  1104. prayerActive[p] = false;
  1105. getPA().sendFrame36(PRAYER_GLOW[p], 0);
  1106. }
  1107. getPA().handleWeaponStyle();
  1108. getPA().handleLoginText();
  1109. accountFlagged = getPA().checkForFlags();
  1110. getPA().sendFrame36(108, 0);// resets autocast button
  1111. getPA().sendFrame36(172, 1);
  1112. getPA().sendFrame107(); // reset screen
  1113. setSidebarInterface(1, 3917);
  1114. setSidebarInterface(2, 52500);
  1115. setSidebarInterface(3, 3213);
  1116. setSidebarInterface(4, 1644);
  1117. setSidebarInterface(5, 5608);
  1118. if (this.playerMagicBook == 0)
  1119. setSidebarInterface(6, 1151);
  1120. else if (this.playerMagicBook == 1)
  1121. setSidebarInterface(6, 12855);
  1122. else if (this.playerMagicBook == 2)
  1123. setSidebarInterface(6, 29999);
  1124. setSidebarInterface(7, 18128);
  1125. setSidebarInterface(8, 5065);
  1126. setSidebarInterface(9, 5715);
  1127. setSidebarInterface(10, 2449);
  1128. setSidebarInterface(11, 904); // wrench tab
  1129. setSidebarInterface(12, 147); // run tab
  1130. //setSidebarInterface(13, 28100);
  1131. setSidebarInterface(0, 2423);
  1132. getPA().showOption(4, 0, "Follow", 3);
  1133. getPA().showOption(5, 0, "Trade with", 4);
  1134. if (hasNpc) {
  1135. if (summonId > 0) {
  1136. PetHandler.spawnPet(this, summonId, -1, true);
  1137. }
  1138. }
  1139. if (splitChat) {
  1140. getPA().sendFrame36(502, 1);
  1141. getPA().sendFrame36(287, 1);
  1142. }
  1143. getItems().resetItems(3214);
  1144. getItems();
  1145. getItems().sendWeapon(playerEquipment[playerWeapon],
  1146. this.getItems().getItemName(playerEquipment[playerWeapon]));
  1147. getItems().resetBonus();
  1148. getItems().getBonus();
  1149. getItems().writeBonus();
  1150. getItems().setEquipment(playerEquipment[playerHat], 1, playerHat);
  1151. getItems().setEquipment(playerEquipment[playerCape], 1, playerCape);
  1152. getItems().setEquipment(playerEquipment[playerAmulet], 1, playerAmulet);
  1153. getItems().setEquipment(playerEquipment[playerArrows], playerEquipmentN[playerArrows], playerArrows);
  1154. getItems().setEquipment(playerEquipment[playerChest], 1, playerChest);
  1155. getItems().setEquipment(playerEquipment[playerShield], 1, playerShield);
  1156. getItems().setEquipment(playerEquipment[playerLegs], 1, playerLegs);
  1157. getItems().setEquipment(playerEquipment[playerHands], 1, playerHands);
  1158. getItems().setEquipment(playerEquipment[playerFeet], 1, playerFeet);
  1159. getItems().setEquipment(playerEquipment[playerRing], 1, playerRing);
  1160. getItems().setEquipment(playerEquipment[playerWeapon], playerEquipmentN[playerWeapon], playerWeapon);
  1161. getCombat().getPlayerAnimIndex(this.getItems().getItemName(playerEquipment[playerWeapon]).toLowerCase());
  1162. if (getPrivateChat() > 2) {
  1163. setPrivateChat(0);
  1164. }
  1165. if (Boundary.isIn(this, PestControl.GAME_BOUNDARY)) {
  1166. getPA().movePlayer(2662, 2652, 0);
  1167. }
  1168. if (Boundary.isIn(this, Boundary.FIGHT_CAVE)) {
  1169. getPA().movePlayer(2438, 5168, 0);
  1170. }
  1171. /* Login Friend List */
  1172. outStream.createFrame(221);
  1173. outStream.writeByte(2);
  1174. outStream.createFrame(206);
  1175. outStream.writeByte(0);
  1176. outStream.writeByte(getPrivateChat());
  1177. outStream.writeByte(0);
  1178. getFriends().sendList();
  1179. getIgnores().sendList();
  1180. getItems().addSpecialBar(playerEquipment[playerWeapon]);
  1181. saveTimer = Config.SAVE_TIMER;
  1182. saveCharacter = true;
  1183. Misc.println("[Logged in]: " + playerName + "");
  1184. handler.updatePlayer(this, outStream);
  1185. handler.updateNPC(this, outStream);
  1186. flushOutStream();
  1187. totalLevel = getPA().totalLevel();
  1188. xpTotal = getPA().xpTotal();
  1189. getPA().sendFrame126("Combat Level: " + combatLevel + "", 3983);
  1190. getPA().sendFrame126("Level: " + totalLevel + "", 3984);
  1191. getPA().resetFollow();
  1192. getPA().clearClanChat();
  1193. getPA().resetFollow();
  1194. getPA().setClanData();
  1195. if (startPack == false) {
  1196. getPA().addStarter();
  1197. canChangeGamemode = true;
  1198. getPA().showInterface(27150);
  1199. startPack = true;
  1200. // Server.clanManager.getHelpClan().addMember(this);
  1201. }
  1202. if (autoRet == 1)
  1203. getPA().sendFrame36(172, 1);
  1204. else
  1205. getPA().sendFrame36(172, 0);
  1206. addEvents();
  1207. if (Config.BOUNTY_HUNTER_ACTIVE) {
  1208. bountyHunter.updateTargetUI();
  1209. bountyHunter.updateStatisticsUI();
  1210. }
  1211. for (int i = 0; i < playerLevel.length; i++) {
  1212. getPA().refreshSkill(i);
  1213. }
  1214. correctCoordinates();
  1215. } catch (Exception e) {
  1216. e.printStackTrace();
  1217. }
  1218. }
  1219.  
  1220. //both used for ironman interface - fuck encapsulation in shitty pi.
  1221. public transient boolean canChangeGamemode;
  1222. public transient Rights selectedGameMode = Rights.PLAYER;
  1223.  
  1224. public void addEvents() {
  1225. if (Config.BOUNTY_HUNTER_ACTIVE) {
  1226. CycleEventHandler.getSingleton().addEvent(this, bountyHunter, 1);
  1227. }
  1228. CycleEventHandler.getSingleton().addEvent(CycleEventHandler.Event.PLAYER_COMBAT_DAMAGE, this, damageQueue, 1,
  1229. true);
  1230. }
  1231.  
  1232. public void update() {
  1233. handler.updatePlayer(this, outStream);
  1234. handler.updateNPC(this, outStream);
  1235. flushOutStream();
  1236.  
  1237. }
  1238.  
  1239. public void wildyWarning() {
  1240. getPA().showInterface(1908);
  1241. }
  1242.  
  1243. public boolean inProcess = false;
  1244.  
  1245. String name;
  1246.  
  1247. @SuppressWarnings("unused")
  1248. public void logout() {
  1249.  
  1250. if (this.clan != null) {
  1251. this.clan.removeMember(this);
  1252. }
  1253. if (getPA().viewingOtherBank) {
  1254. getPA().resetOtherBank();
  1255. }
  1256. int x, y, z;
  1257. x = absX;
  1258. y = absY;
  1259. z = heightLevel;
  1260.  
  1261. playTimeTotal += (System.currentTimeMillis() - recordedLogin);
  1262. DuelSession duelSession = (DuelSession) Server.getMultiplayerSessionListener().getMultiplayerSession(this,
  1263. MultiplayerSessionType.DUEL);
  1264. if (Objects.nonNull(duelSession) && duelSession.getStage().getStage() > MultiplayerSessionStage.REQUEST) {
  1265. if (duelSession.getStage().getStage() >= MultiplayerSessionStage.FURTHER_INTERACTION) {
  1266. sendMessage("You are not permitted to logout during a duel. If you forcefully logout you will");
  1267. sendMessage("lose all of your staked items, if any, to your opponent.");
  1268. }
  1269. }
  1270. if (underAttackBy > 0 || underAttackBy2 > 0)
  1271. return;
  1272. if (logoutDelay.elapsed(10000)) {
  1273. outStream.createFrame(109);
  1274. CycleEventHandler.getSingleton().stopEvents(this);
  1275. properLogout = true;
  1276. // Highscores.highscores(this, null);
  1277. ConnectedFrom.addConnectedFrom(this, connectedFrom);
  1278. } else {
  1279. sendMessage("You must wait a few seconds from being out of combat to logout.");
  1280. }
  1281.  
  1282. }
  1283.  
  1284. public int packetSize = 0, packetType = -1;
  1285. private long lastOverloadBoost;
  1286. public long lastDamageCalculation;
  1287. public long lastUpdate = System.currentTimeMillis();
  1288.  
  1289. /**
  1290. * Handles the targets death and rewards the victims target with a emblem &
  1291. * emblem upgrade checks if the killer is the victims target if not removes
  1292. * the victims target and resets the victims targets target state
  1293. *
  1294. * @param c
  1295. */
  1296.  
  1297. public void targetDied(Player c) {
  1298. if (getBH().target != null) {
  1299. Player target = PlayerHandler.getPlayer(getBH().target.getName());
  1300. if (getBH().hasTarget() && getBH().getTarget().getName().equalsIgnoreCase(target.playerName)
  1301. && target.getBH().hasTarget()
  1302. && target.getBH().getTarget().getName().equalsIgnoreCase(playerName)) {
  1303. c.setKiller(c.getPlayerKiller());
  1304. Player o = PlayerHandler.getPlayer(c.getKiller());
  1305. if (o != target) {
  1306. getBH().removeTarget();
  1307. getBH().updateTargetUI();
  1308. target.getBH().removeTarget();
  1309. target.getBH().updateTargetUI();
  1310. target.getBH().setTargetState(TargetState.RECENT_TARGET_KILL);
  1311. getBH().setTargetState(TargetState.RECENT_TARGET_KILL);
  1312. } else if (o == target) {
  1313. getBH().dropPlayerEmblem(target);
  1314. target.getBH().upgradePlayerEmblem();
  1315. target.getKillstreak().increase(Killstreak.Type.HUNTER);
  1316. target.getBH().setCurrentHunterKills(target.getBH().getCurrentHunterKills() + 1);
  1317. target.getBH().setTotalHunterKills(target.getBH().getTotalHunterKills() + 1);
  1318. if (target.getBH().getCurrentHunterKills() > target.getBH().getRecordHunterKills()) {
  1319. target.getBH().setRecordHunterKills(target.getBH().getCurrentHunterKills());
  1320. }
  1321. target.getBH().setTargetState(TargetState.RECENT_TARGET_KILL);
  1322. getBH().setTargetState(TargetState.RECENT_TARGET_KILL);
  1323. target.sendMessage("<col=255>You have killed your target: " + playerName + ".");
  1324. getBH().removeTarget();
  1325. getBH().updateTargetUI();
  1326. target.getBH().removeTarget();
  1327. target.getBH().updateTargetUI();
  1328. }
  1329. }
  1330. }
  1331. }
  1332.  
  1333. // public int pTime;
  1334. public boolean insure;
  1335. public static int spawnId;
  1336. public long lastHeal;
  1337.  
  1338. public void process() {
  1339. // drawSkulls();
  1340. if (pTime < Integer.MAX_VALUE) {
  1341. pTime++;
  1342. }
  1343. // System.out.println("Current timer status: "+safeTimer);
  1344. if (TICKING_DAMAGE && System.currentTimeMillis() - lastHeal > 1_500) {
  1345. lastHeal = System.currentTimeMillis();
  1346. for (int[] point : Cerberus.ROCKS) {
  1347. int x1 = point[0] + 1;
  1348. int y1 = point[1] + 2;
  1349. if (absX == x1 && absY == y1 || absX == lastX && absY == lastY) {
  1350. appendDamage(Misc.random(1, 7), Hitmark.HIT);
  1351. }
  1352. }
  1353. }
  1354.  
  1355. if (RANGE_ATTACK == 1) {
  1356. MAGIC_ATTACK = 0;
  1357. MELEE_ATTACK = 0;
  1358. RANGE_ATTACK = 0;
  1359. RANDOM = 0;
  1360. RANDOM_MELEE = 0;
  1361. }
  1362. getPA().sendFrame126("Players Online: @grn@" + PlayerHandler.getPlayerCount() + "", 52504);
  1363.  
  1364. DecimalFormat df = new DecimalFormat("#.##");
  1365. double ratio = ((double) KC) / ((double) DC);
  1366. getPA().sendFrame126("Players Online: " + PlayerHandler.getPlayerCount() + "", 29155);
  1367. if (getRights().getValue() == 0)
  1368. getPA().sendFrame126("Rank: Player", 52532);
  1369. if (getRights().getValue() == 1)
  1370. getPA().sendFrame126("Rank: <col=148200>Moderator ", 52532);
  1371. if (getRights().getValue() == 2 || getRights().getValue() == 3)
  1372. getPA().sendFrame126("Rank: <img=3> <col=A67711>Owner ", 52532);
  1373. if (getRights().getValue() == 5)
  1374. getPA().sendFrame126("Rank: @red@Donator", 52532);
  1375. if (getRights().getValue() == 6)
  1376. getPA().sendFrame126("Rank: <col=255>Sponsor", 52532);
  1377. if (getRights().getValue() == 7)
  1378. getPA().sendFrame126("Rank: <col=FF00CD>V.I.P ", 52532);
  1379. if (getRights().getValue() == 11)
  1380. getPA().sendFrame126("Rank: <col=FF00CD>Helper ", 52532);
  1381. if (getRights().getValue() == 15)
  1382. getPA().sendFrame126("Rank: Ironman ", 52532);
  1383. if (getRights().getValue() == 16)
  1384. getPA().sendFrame126("Rank: Ultimate Ironman ", 52532);
  1385. getPA().sendFrame126("PK Points:@grn@ " + pkp, 52539);
  1386.  
  1387. getPA().sendFrame126("Players Kills:@grn@ " + KC, 52534);
  1388. getPA().sendFrame126("Players Deaths:@grn@ " + DC, 52535);
  1389.  
  1390. getPA().sendFrame126("Vote Points: @grn@ " + votePoints, 52541);
  1391.  
  1392. getPA().sendFrame126("Current Killstreak: @grn@" + killStreak, 52537);
  1393.  
  1394. getPA().sendFrame126("KDR: @grn@" + df.format(ratio) + " : @grn@" + KC + " : @grn@" + DC + "", 52536);
  1395.  
  1396. getPA().sendFrame126("Donator Points:@grn@ " + donatorPoints + "", 52540);
  1397.  
  1398. getPA().sendFrame126("Username:@grn@ " + playerName + "", 52531);
  1399. getPA().sendFrame126("Time Played:@grn@ " + getPlaytime() + "", 52533);
  1400.  
  1401. getPA().sendFrame126("Total Donated:@grn@ " + amDonated + "", 52538);
  1402.  
  1403. getPA().sendFrame126("Achievement Points:@grn@ " + getAchievements().getPoints() + "", 52542);
  1404.  
  1405. getPA().sendFrame126("Pest Control Points:@grn@ " + pcPoints + "", 52542);
  1406.  
  1407. getPA().sendFrame126("Total Donated:@grn@ " + amDonated + "", 52538);
  1408.  
  1409. getPA().sendFrame126((int) (specAmount * 10) + "", 155);
  1410. getPA().sendFrame126("Players Online: @gre@" + PlayerHandler.getPlayerCount() + "", 29155);
  1411. //Player profile
  1412. getPA().sendFrame126("Username:@grn@ " + playerName + "", 51807);
  1413. if (getRights().getValue() == 0)
  1414. getPA().sendFrame126("Rank: Player", 51808);
  1415. if (getRights().getValue() == 1)
  1416. getPA().sendFrame126("Rank: <col=148200>Moderator ", 51808);
  1417. if (getRights().getValue() == 2 || getRights().getValue() == 3)
  1418. getPA().sendFrame126("Rank: <img=3> <col=A67711>Owner ", 51808);
  1419. if (getRights().getValue() == 5)
  1420. getPA().sendFrame126("Rank: @red@Donator", 51808);
  1421. if (getRights().getValue() == 6)
  1422. getPA().sendFrame126("Rank: <col=255>Sponsor", 51808);
  1423. if (getRights().getValue() == 7)
  1424. getPA().sendFrame126("Rank: <col=FF00CD>V.I.P ", 51808);
  1425. if (getRights().getValue() == 11)
  1426. getPA().sendFrame126("Rank: <col=FF00CD>Helper ", 51808);
  1427. getPA().sendFrame126("Combat level:@grn@ " + playerName + "", 51809);
  1428. getPA().sendFrame126("Time Played:@grn@ " + getPlaytime() + "", 51822);
  1429. getPA().sendFrame126("Total Donated:@grn@ " + amDonated + "", 51823);
  1430. getPA().sendFrame126("Achievement Points:@grn@ " + getAchievements().getPoints() + "", 51824);
  1431. getPA().sendFrame126("Pest Control Points:@grn@ " + pcPoints + "", 51825);
  1432. getPA().sendFrame126("Total Donated:@grn@ " + amDonated + "", 51826);
  1433.  
  1434. //Main teleport interface//<shad=-1><col=802A2A>
  1435. getPA().sendFrame126("<shad=-1><col=802A2A>- Dungeon Teleports -", 33337);
  1436. getPA().sendFrame126("<shad=-1>Edgeville Dungeon", 33338);
  1437. getPA().sendFrame126("<shad=-1> Brimhaven Dungeon", 33339);
  1438. getPA().sendFrame126("<shad=-1> Relekka Dungeon", 33340);
  1439. getPA().sendFrame126("<shad=-1> Taverly Dungeon", 33341);
  1440. getPA().sendFrame126("<shad=-1><col=802A2A>- Training Teleports -", 33342);
  1441. getPA().sendFrame126("<shad=-1>Rock Crabs", 33343);
  1442. getPA().sendFrame126("<shad=-1>Slayer Tower", 33344);
  1443. getPA().sendFrame126("<shad=-1>Neitiznot", 33345);
  1444. getPA().sendFrame126("<shad=-1>Elven Camp", 33346);
  1445. getPA().sendFrame126("<shad=-1>Mithril Dragons", 33347);
  1446. getPA().sendFrame126("<shad=-1><col=802A2A>- Boss Teleports -", 33348);
  1447. getPA().sendFrame126("<shad=-1>General Graardor (Bandos)", 33349);
  1448. getPA().sendFrame126("<shad=-1>Commander Zilyana (Sara)", 33350);
  1449. getPA().sendFrame126("<shad=-1>K'ril Tsutsaroth (Zamorak)", 33351);
  1450. getPA().sendFrame126("<shad=-1>Kree'arra (Armadyl)", 33352);
  1451. getPA().sendFrame126("<shad=-1>Dagannoth Kings", 33353);
  1452. getPA().sendFrame126("<shad=-1>Barrelchest", 33354);
  1453. getPA().sendFrame126("<shad=-1>King Black Dragon <col=B81324>(WILD)", 33355);
  1454. getPA().sendFrame126("<shad=-1>Kraken", 33356);
  1455. getPA().sendFrame126("<shad=-1>Corporeal Beast", 33357);
  1456. getPA().sendFrame126("<shad=-1>Lizardman Shaman", 33358);
  1457. getPA().sendFrame126("<shad=-1>Cerberus", 33359);
  1458. getPA().sendFrame126("<shad=-1>Giant Mole", 33360);
  1459. getPA().sendFrame126("<shad=-1>Demonic Gorillas", 33361);
  1460. getPA().sendFrame126("<shad=-1><col=B81324>- Wildy Boss Teleports -", 33362);
  1461. getPA().sendFrame126("<shad=-1>Callisto", 33363);
  1462. getPA().sendFrame126("<shad=-1>Venenatis (MULTI)", 33364);
  1463. getPA().sendFrame126("<shad=-1>Vet'ion (MULTI)", 33365);
  1464. getPA().sendFrame126("<shad=-1>Crazy Archaeologist", 33366);
  1465. getPA().sendFrame126("<shad=-1>Chaos Fanatic", 33367);
  1466. getPA().sendFrame126("<shad=-1>Chaos Elemental", 33368);
  1467. getPA().sendFrame126("<shad=-1><col=B81324>- Wilderness Teleports -", 33369);
  1468. getPA().sendFrame126("<shad=-1>Mage Bank (SAFE)", 33370);
  1469. getPA().sendFrame126("<shad=-1>Obelisks [44]", 33371);
  1470. getPA().sendFrame126("<shad=-1>Resource Area [54]", 33372);
  1471. getPA().sendFrame126("<shad=-1>East Dragons [20]", 33373);
  1472. getPA().sendFrame126("<shad=-1>Hill Giants (MULTI) [14]", 33374);
  1473. getPA().sendFrame126("<shad=-1>West Dragons [10]", 33375);
  1474. getPA().sendFrame126("<shad=-1>Lava Dragons (MULTI) [43]", 33376);
  1475. getPA().sendFrame126("<shad=-1><col=802A2A>- Skilling Teleports -", 33377);
  1476. getPA().sendFrame126("<shad=-1>Click here to open interface", 33378);
  1477. getPA().sendFrame126("<shad=-1><col=802A2A>- Minigame Teleports -", 33379);
  1478. getPA().sendFrame126("<shad=-1>Barrows", 33380);
  1479. getPA().sendFrame126("<shad=-1>Duel Arena", 33381);
  1480. getPA().sendFrame126("<shad=-1>Fight Caves", 33382);
  1481. getPA().sendFrame126("<shad=-1>Fishing Tournament", 33383);
  1482. getPA().sendFrame126("<shad=-1>Warrior's Guild", 33384);
  1483. getPA().sendFrame126("<shad=-1>Pest Control", 33385);
  1484.  
  1485. //Skill interface teleports
  1486. getPA().sendFrame126("<col=C67171>- Rooftop courses -", 20671);
  1487. getPA().sendFrame126("Draynor course", 20672);
  1488. getPA().sendFrame126("Al kharid course", 20673);
  1489. getPA().sendFrame126("Varrock course", 20674);
  1490. getPA().sendFrame126("Canafis course", 20675);
  1491. getPA().sendFrame126("Seers village course", 20676);
  1492.  
  1493. getPA().sendFrame126("<col=C67171>- Zeah skilling area -", 30671);
  1494. getPA().sendFrame126("Zeah fishing zone", 30672);
  1495. getPA().sendFrame126("<col=C67171>- Other areas -", 30673);
  1496. getPA().sendFrame126("Catherby", 30674);
  1497. getPA().sendFrame126("Fishing guild", 30675);
  1498.  
  1499. getPA().sendFrame126("<col=C67171>- Zeah skilling area -", 40671);
  1500. getPA().sendFrame126("Zeah woodcutting zone", 40672);
  1501. getPA().sendFrame126("<col=C67171>- Other areas -", 40673);
  1502. getPA().sendFrame126("Seers village", 40674);
  1503. getPA().sendFrame126("Woodcutting guild", 40675);
  1504.  
  1505. getPA().sendFrame126("<col=C67171>- Zeah skilling area -", 50671);
  1506. getPA().sendFrame126("Zeah mining zone", 50672);
  1507. getPA().sendFrame126("<col=C67171>- Other areas -", 50673);
  1508. getPA().sendFrame126("Blast mining", 50674);
  1509. getPA().sendFrame126("Al kharid", 50675);
  1510. getPA().sendFrame126("Varrock east mine", 50676);
  1511. getPA().sendFrame126("Varrock west mine", 50677);
  1512.  
  1513. getPA().sendFrame126("<col=C67171>- Herb patches -", 60671);
  1514. getPA().sendFrame126("Falador", 60672);
  1515. getPA().sendFrame126("<col=C67171>- More coming soon... -", 60673);
  1516.  
  1517. getPA().sendFrame126("<col=C67171>- Hunting areas -", 11111);
  1518. getPA().sendFrame126("Puro puro", 11112);
  1519. getPA().sendFrame126("<col=C67171>- More coming soon... -", 11113);
  1520.  
  1521. getPA().sendFrame126("<col=C67171>- Stalls -", 52279);
  1522. getPA().sendFrame126("Zeah thieving zone", 52280);
  1523. getPA().sendFrame126("<col=C67171>- Pick-pocketing -", 52281);
  1524. getPA().sendFrame126("Lumbridge", 52282);
  1525. getPA().sendFrame126("Varrock", 52283);
  1526. getPA().sendFrame126("Arganoog", 52284);
  1527.  
  1528. getPA().sendFrame126("<col=C67171>- Furnaces -", 40016);
  1529. getPA().sendFrame126("Zeah skilling area", 40017);
  1530. getPA().sendFrame126("Edgeville", 40018);
  1531. getPA().sendFrame126("<col=C67171>- Anvils -", 40019);
  1532. getPA().sendFrame126("Zeah skilling area", 40020);
  1533. getPA().sendFrame126("Varrock", 40021);
  1534.  
  1535. getPA().sendFrame126("<col=C67171>- Rift Runecrafting -", 50016);
  1536. getPA().sendFrame126("Rift", 50017);
  1537. getPA().sendFrame126("<col=C67171>- Other -", 50018);
  1538. getPA().sendFrame126("Blood altar", 50019);
  1539. getPA().sendFrame126("Soul altar", 50020);
  1540.  
  1541. farming.farmingProcess();
  1542. if (isDead && respawnTimer == -6 && spawnId >= 1 && summonId >= 1) {
  1543. PetHandler.ownerDeath(this, npcType);
  1544. }
  1545. if (isDead && respawnTimer == -6) {
  1546. targetDied(this);
  1547. getPA().applyDead();
  1548. }
  1549. /*
  1550. * if (bonusXpTime > 0) { bonusXpTime --; } if (bonusXpTime == 1) {
  1551. * sendMessage(
  1552. * "<col=255>Your time is up. Your XP is no longer boosted by the voting reward."
  1553. * ); }
  1554. */
  1555. if (respawnTimer == 7) {
  1556. respawnTimer = -6;
  1557. getPA().giveLife();
  1558. } else if (respawnTimer == 12) {
  1559. respawnTimer--;
  1560. animation(0x900);
  1561. }
  1562.  
  1563. /*
  1564. * public int totalPlaytime() { return (pTime); }
  1565. *
  1566. *
  1567. *
  1568. *
  1569. * public String getPlaytime() { int DAY = (totalPlaytime() / 144000);
  1570. * int HR = (totalPlaytime() / 6000) - (DAY * 24); int MIN =
  1571. * (totalPlaytime() / 100) - (DAY * 1440) - (HR * 60); return (DAY +
  1572. * " D " + HR + " H " + MIN + " M"); }
  1573. */
  1574.  
  1575. if (Boundary.isIn(this, Zulrah.BOUNDARY) && getZulrahEvent().isInToxicLocation()) {
  1576. appendDamage(1 + Misc.random(3), Hitmark.VENOM);
  1577. }
  1578. if (getPoisonDamage() > 0 && System.currentTimeMillis() - getLastPoisonHit() > TimeUnit.MINUTES.toMillis(1)) {
  1579. appendPoisonDamage();
  1580. setLastPoisonHit(System.currentTimeMillis());
  1581. sendMessage("You have been poisoned!");
  1582. }
  1583. if (getVenomDamage() > 0 && System.currentTimeMillis() - getLastVenomHit() > 15_0000) {
  1584. appendVenomDamage();
  1585. setLastVenomHit(System.currentTimeMillis());
  1586. sendMessage("You have been hit by the venom infection.");
  1587. }
  1588.  
  1589. if (respawnTimer > -6) {
  1590. respawnTimer--;
  1591. }
  1592. if (hitDelay > 0) {
  1593. hitDelay--;
  1594. }
  1595.  
  1596. getAgilityHandler().agilityProcess(this);
  1597. if (specRestore > 0) {
  1598. specRestore--;
  1599. }
  1600. // boolean checkingDonation;
  1601. if (specDelay.elapsed(Config.INCREASE_SPECIAL_AMOUNT)) {
  1602. specDelay.reset();
  1603. if (specAmount < 10) {
  1604. specAmount += 1;
  1605. if (specAmount > 10)
  1606. specAmount = 10;
  1607. getItems().addSpecialBar(playerEquipment[playerWeapon]);
  1608. }
  1609. }
  1610.  
  1611. getCombat().handlePrayerDrain();
  1612. if (singleCombatDelay.elapsed(6000)) {
  1613. underAttackBy = 0;
  1614. }
  1615. if (singleCombatDelay2.elapsed(6000)) {
  1616. underAttackBy2 = 0;
  1617. }
  1618. if (hasOverloadBoost) {
  1619. if (System.currentTimeMillis() - lastOverloadBoost > 15000) {
  1620. getPotions().doOverloadBoost();
  1621. lastOverloadBoost = System.currentTimeMillis();
  1622. }
  1623. }
  1624. if (System.currentTimeMillis() - restoreStatsDelay > 60000) {
  1625. restoreStatsDelay = System.currentTimeMillis();
  1626. for (int level = 0; level < playerLevel.length; level++) {
  1627. if (playerLevel[level] < getLevelForXP(playerXP[level])) {
  1628. if (level < 7 && level != 5 && level != 3) {
  1629. if (hasOverloadBoost)
  1630. continue;
  1631. }
  1632. if (level != 5) { // prayer doesn't restore
  1633. playerLevel[level] += 1;
  1634. getPA().setSkillLevel(level, playerLevel[level], playerXP[level]);
  1635. getPA().refreshSkill(level);
  1636. }
  1637. } else if (playerLevel[level] > getLevelForXP(playerXP[level])) {
  1638. playerLevel[level] -= 1;
  1639. getPA().setSkillLevel(level, playerLevel[level], playerXP[level]);
  1640. getPA().refreshSkill(level);
  1641. }
  1642. }
  1643. }
  1644.  
  1645. /*
  1646. * if(inPvP() && !hasDied) { safeTimer = 11; System.out.println(
  1647. * "setting safeTimer to 11."); } if(hasDied && safeTimer >= 0) {
  1648. * safeTimer = 0; System.out.println("setting safeTimer to 0."); }
  1649. * if(safeTimer > 0 && !inPvP() && !hasDied) { safeTimer--; }
  1650. *
  1651. */
  1652.  
  1653. //if (inPvP() && !inSafeZone() && !hasDied) {
  1654. // safeTimer = 11;
  1655. // System.out.println("setting safeTimer to 11.");
  1656. // }
  1657. //if (hasDied && safeTimer >= 0) {
  1658. // safeTimer = 0;
  1659. // // System.out.println("setting safeTimer to 0.");
  1660. // }
  1661. // if (safeTimer > 0 && !inPvP() && !hasDied) {
  1662. // safeTimer--;
  1663. // }
  1664.  
  1665. if (inWild()) {
  1666. int modY = absY > 6400 ? absY - 6400 : absY;
  1667. wildLevel = (((modY - 3520) / 8) + 1);
  1668.  
  1669. if (Config.SINGLE_AND_MULTI_ZONES) {
  1670. getPA().sendFrame126("@yel@Level: " + wildLevel, 199);
  1671. } else {
  1672. getPA().multiWay(-1);
  1673. getPA().sendFrame126("@yel@Level: " + wildLevel, 199);
  1674. }
  1675. getPA().showOption(3, 0, "Attack", 1);
  1676. if (Config.BOUNTY_HUNTER_ACTIVE) {
  1677. getPA().walkableInterface(28000);
  1678. getPA().sendFrame171(1, 28070);
  1679. getPA().sendFrame171(0, 196);
  1680. } else {
  1681. getPA().walkableInterface(197);
  1682. }
  1683. } else if (inClanWars()) {
  1684. getPA().showOption(3, 0, "Attack", 1);
  1685. if (Boundary.isIn(this, ClanWarsMap.FREE_FOR_ALL.getBoundary())) {
  1686. getPA().walkableInterface(197);
  1687. }
  1688. /// } else if (!inPvP() && safeTimer > 0) {
  1689. /// wildLevel = 12;
  1690. // getPA().walkableInterface(21400);
  1691. /// getPA().sendFrame126("" + safeTimer, 21403);
  1692. // pvpHandler.pvpLevels();
  1693. //} else if (inPvP()) {
  1694.  
  1695. /// wildLevel = 12;
  1696. // getPA().walkableInterface(21300);
  1697. // pvpHandler.pvpLevels();
  1698. // getPA().showOption(3, 0, "Attack", 1);
  1699. //} else if (inSafeZone()) {
  1700. // getPA().walkableInterface(21200);
  1701. // pvpHandler.pvpLevels();
  1702. } else if (inEdgeville()) {
  1703. if (Config.BOUNTY_HUNTER_ACTIVE) {
  1704. if (bountyHunter.hasTarget()) {
  1705. getPA().walkableInterface(28000);
  1706. getPA().sendFrame171(0, 28070);
  1707. getPA().sendFrame171(1, 196);
  1708. bountyHunter.updateOutsideTimerUI();
  1709. } else {
  1710. getPA().walkableInterface(-1);
  1711. }
  1712. } else {
  1713. getPA().sendFrame99(0);
  1714. getPA().walkableInterface(-1);
  1715. getPA().showOption(3, 0, "Null", 1);
  1716. }
  1717. getPA().showOption(3, 0, "null", 1);
  1718. } else if (Boundary.isIn(this, PestControl.LOBBY_BOUNDARY)) {
  1719. getPA().walkableInterface(21119);
  1720. PestControl.drawInterface(this, "lobby");
  1721. } else if (Boundary.isIn(this, PestControl.GAME_BOUNDARY)) {
  1722. getPA().walkableInterface(21100);
  1723. PestControl.drawInterface(this, "game");
  1724. } else if ((inDuelArena() || Boundary.isIn(this, Boundary.DUEL_ARENAS)) && !inDice()) {
  1725. getPA().walkableInterface(201);
  1726. if (Boundary.isIn(this, Boundary.DUEL_ARENAS)) {
  1727. getPA().showOption(3, 0, "Attack", 1);
  1728. } else {
  1729. getPA().showOption(3, 0, "Challenge", 1);
  1730. }
  1731. wildLevel = 126;
  1732. } else if (isInBarrows() || isInBarrows2()) {
  1733. getPA().walkableInterface(16128);
  1734. getPA().sendFrame126("" + barrowsKillCount, 16137);
  1735. if (barrowsNpcs[2][1] == 2) {
  1736. getPA().sendFrame126("@red@Karils", 16135);
  1737. }
  1738. if (barrowsNpcs[3][1] == 2) {
  1739. getPA().sendFrame126("@red@Guthans", 16134);
  1740. }
  1741. if (barrowsNpcs[1][1] == 2) {
  1742. getPA().sendFrame126("@red@Torags", 16133);
  1743. }
  1744. if (barrowsNpcs[5][1] == 2) {
  1745. getPA().sendFrame126("@red@Ahrims", 16132);
  1746. }
  1747. if (barrowsNpcs[0][1] == 2) {
  1748. getPA().sendFrame126("@red@Veracs", 16131);
  1749. }
  1750. if (barrowsNpcs[4][1] == 2) {
  1751. getPA().sendFrame126("@red@Dharoks", 16130);
  1752. }
  1753. } else if (inCwGame || inPits) {
  1754. getPA().showOption(3, 0, "Attack", 1);
  1755. } else if (getPA().inPitsWait()) {
  1756. getPA().showOption(3, 0, "Null", 1);
  1757. } else if (!inCwWait) {
  1758. getPA().sendFrame99(0);
  1759. getPA().walkableInterface(-1);
  1760. getPA().showOption(3, 0, "Null", 1);
  1761. }
  1762.  
  1763. if (!inWild()) {
  1764. wildLevel = 0;
  1765. }
  1766. if (!hasMultiSign && inMulti()) {
  1767. hasMultiSign = true;
  1768. getPA().multiWay(1);
  1769. }
  1770.  
  1771. if (hasMultiSign && !inMulti()) {
  1772. hasMultiSign = false;
  1773. getPA().multiWay(-1);
  1774. }
  1775. if (!inMulti() && inWild())
  1776. getPA().sendFrame70(30, 0, 196);
  1777. else if (inMulti() && inWild())
  1778. getPA().sendFrame70(0, 0, 196);
  1779. if (this.skullTimer > 0) {
  1780. --skullTimer;
  1781. if (skullTimer == 1) {
  1782. isSkulled = false;
  1783. attackedPlayers.clear();
  1784. headIconPk = -1;
  1785. skullTimer = -1;
  1786. getPA().requestUpdates();
  1787. }
  1788. }
  1789.  
  1790. if (respawnTimer > -6) {
  1791. respawnTimer--;
  1792. }
  1793. if (freezeTimer > -6) {
  1794. freezeTimer--;
  1795. if (freezeTimer == 0) {
  1796. getPA().sendFrame126("freezetimer:-2", 1810);
  1797. }
  1798. if (frozenBy > 0) {
  1799. if (PlayerHandler.players[frozenBy] == null) {
  1800. freezeTimer = -1;
  1801. frozenBy = -1;
  1802. getPA().sendFrame126("freezetimer:-2", 1810);
  1803. } else if (!Misc.goodDistance(absX, absY, PlayerHandler.players[frozenBy].absX,
  1804. PlayerHandler.players[frozenBy].absY, 12)) {
  1805. freezeTimer = -1;
  1806. frozenBy = -1;
  1807. getPA().sendFrame126("freezetimer:-2", 1810);
  1808. }
  1809. }
  1810. }
  1811.  
  1812. if (attackTimer > 0) {
  1813. attackTimer--;
  1814. }
  1815.  
  1816. if (followId > 0) {
  1817. getPA().followPlayer();
  1818. } else if (followId2 > 0) {
  1819. getPA().followNpc();
  1820. }
  1821.  
  1822. if (hitDelay == 1) {
  1823. if (oldNpcIndex > 0) {
  1824. getCombat().delayedHit(this, oldNpcIndex);
  1825. }
  1826. }
  1827.  
  1828. if (attackTimer <= 1) {
  1829. if (npcIndex > 0 && clickNpcType == 0) {
  1830. getCombat().attackNpc(npcIndex);
  1831. }
  1832.  
  1833. if (playerIndex > 0) {
  1834. getCombat().attackPlayer(playerIndex);
  1835. }
  1836. }
  1837. }
  1838.  
  1839. public int[] getLevel() {
  1840. return this.playerLevel;
  1841. }
  1842.  
  1843. public void setCurrentTask(Future<?> task) {
  1844. currentTask = task;
  1845. }
  1846.  
  1847. public Future<?> getCurrentTask() {
  1848. return currentTask;
  1849. }
  1850.  
  1851. public Stream getInStream() {
  1852. return inStream;
  1853. }
  1854.  
  1855. public int getPacketType() {
  1856. return packetType;
  1857. }
  1858.  
  1859. public int getPacketSize() {
  1860. return packetSize;
  1861. }
  1862.  
  1863. public Stream getOutStream() {
  1864. return outStream;
  1865. }
  1866.  
  1867. public ItemAssistant getItems() {
  1868. return itemAssistant;
  1869. }
  1870.  
  1871. public PlayerAssistant getPA() {
  1872. return playerAssistant;
  1873. }
  1874.  
  1875. public DialogueHandler getDH() {
  1876. return dialogueHandler;
  1877. }
  1878.  
  1879. public DialogueManager dialogue() {
  1880. return dialogue;
  1881. }
  1882.  
  1883. public ShopAssistant getShops() {
  1884. return shopAssistant;
  1885. }
  1886.  
  1887. public CombatAssistant getCombat() {
  1888. return combat;
  1889. }
  1890.  
  1891. public ActionHandler getActions() {
  1892. return actionHandler;
  1893. }
  1894.  
  1895. public Channel getSession() {
  1896. return session;
  1897. }
  1898.  
  1899. public Potions getPotions() {
  1900. return potions;
  1901. }
  1902.  
  1903. // public org.perception.model.players.skills.herblore.PotionMixing
  1904. // getPotMixing() {
  1905. // return potionMixing;
  1906. // }
  1907.  
  1908. public Food getFood() {
  1909. return food;
  1910. }
  1911.  
  1912. public boolean ardiRizal() {
  1913. if ((playerEquipment[playerHat] == -1) && (playerEquipment[playerCape] == -1)
  1914. && (playerEquipment[playerAmulet] == -1) && (playerEquipment[playerChest] == -1)
  1915. && (playerEquipment[playerShield] == -1) && (playerEquipment[playerLegs] == -1)
  1916. && (playerEquipment[playerHands] == -1) && (playerEquipment[playerFeet] == -1)
  1917. && (playerEquipment[playerWeapon] == -1)) {
  1918. return true;
  1919. }
  1920. return false;
  1921. }
  1922.  
  1923. public void joinHelpClan() {
  1924. if (clan == null) {
  1925. Clan localClan = Server.clanManager.getClan("OS-WORLD");
  1926. if (localClan != null)
  1927. localClan.addMember(this);
  1928. else if ("help".equalsIgnoreCase(this.playerName))
  1929. Server.clanManager.create(this);
  1930. else {
  1931. sendMessage(Misc.formatPlayerName("OS-WORLD") + " has temporarily disabled the help chat.");
  1932. }
  1933. getPA().refreshSkill(21);
  1934. getPA().refreshSkill(22);
  1935. getPA().refreshSkill(23);
  1936. // inArdiCC = true;
  1937. }
  1938. }
  1939.  
  1940. private boolean isBusy = false;
  1941. private boolean isBusyHP = false;
  1942. public boolean isBusyFollow = false;
  1943.  
  1944. public boolean checkBusy() {
  1945. if (isBusy) {
  1946. }
  1947. return isBusy;
  1948. }
  1949.  
  1950. public boolean checkBusyHP() {
  1951. return isBusyHP;
  1952. }
  1953.  
  1954. public boolean checkBusyFollow() {
  1955. return isBusyFollow;
  1956. }
  1957.  
  1958. public void setBusy(boolean isBusy) {
  1959. this.isBusy = isBusy;
  1960. }
  1961.  
  1962. public boolean isBusy() {
  1963. return isBusy;
  1964. }
  1965.  
  1966. public void setBusyFollow(boolean isBusyFollow) {
  1967. this.isBusyFollow = isBusyFollow;
  1968. }
  1969.  
  1970. public void setBusyHP(boolean isBusyHP) {
  1971. this.isBusyHP = isBusyHP;
  1972. }
  1973.  
  1974. public boolean isBusyHP() {
  1975. return isBusyHP;
  1976. }
  1977.  
  1978. public boolean isBusyFollow() {
  1979. return isBusyFollow;
  1980. }
  1981.  
  1982. public int makeTimes;
  1983. public int event;
  1984. public long lastBankDeposit;
  1985. public long spawnSets;
  1986. public boolean hasOverloadBoost;
  1987.  
  1988. public boolean canWalk() {
  1989. return canWalk;
  1990. }
  1991.  
  1992. public void setCanWalk(boolean canWalk) {
  1993. this.canWalk = canWalk;
  1994. }
  1995.  
  1996. public PlayerAssistant getPlayerAssistant() {
  1997. return playerAssistant;
  1998. }
  1999.  
  2000. public SkillInterfaces getSI() {
  2001. return skillInterfaces;
  2002. }
  2003.  
  2004. /**
  2005. * Skill Constructors
  2006. */
  2007. public Slayer getSlayer() {
  2008. return slayer;
  2009. }
  2010.  
  2011. public BossSlayer getBossSlayer() {
  2012. return bossSlayer;
  2013. }
  2014.  
  2015. public Runecrafting getRunecrafting() {
  2016. return runecrafting;
  2017. }
  2018.  
  2019. public Cooking getCooking() {
  2020. return cooking;
  2021. }
  2022.  
  2023. public Agility getAgility() {
  2024. return agility;
  2025. }
  2026.  
  2027. public Crafting getCrafting() {
  2028. return crafting;
  2029. }
  2030.  
  2031. public Barrows getBarrows() {
  2032. return barrows;
  2033. }
  2034.  
  2035. public Thieving getThieving() {
  2036. return thieving;
  2037. }
  2038.  
  2039. // public Herblore getHerblore() {
  2040. // return herblore;
  2041. // }
  2042.  
  2043. public GnomeAgility getGnomeAgility() {
  2044. return gnomeAgility;
  2045. }
  2046.  
  2047. public PointItems getPoints() {
  2048. return pointItems;
  2049. }
  2050.  
  2051. public PlayerAction getPlayerAction() {
  2052. return playerAction;
  2053. }
  2054.  
  2055. public WildernessAgility getWildernessAgility() {
  2056. return wildernessAgility;
  2057. }
  2058.  
  2059. public AgilityHandler getAgilityHandler() {
  2060. return agilityHandler;
  2061. }
  2062.  
  2063. public Smithing getSmithing() {
  2064. return smith;
  2065. }
  2066.  
  2067. public Logs getLogs() {
  2068. return logs;
  2069. }
  2070.  
  2071. public FightCave getFightCave() {
  2072. if (fightcave == null)
  2073. fightcave = new FightCave(this);
  2074. return fightcave;
  2075. }
  2076.  
  2077. public SmithingInterface getSmithingInt() {
  2078. return smithInt;
  2079. }
  2080.  
  2081. public Prayer getPrayer() {
  2082. return prayer;
  2083. }
  2084.  
  2085. /**
  2086. * End of Skill Constructors
  2087. */
  2088.  
  2089. public void queueMessage(Packet arg1) {
  2090. packetsReceived.incrementAndGet();//retarded
  2091. queuedPackets.add(arg1);
  2092. }
  2093.  
  2094. public boolean processQueuedPackets() {
  2095. Packet p = null;
  2096. int processed = 0;
  2097. packetsReceived.set(0);
  2098. while ((p = queuedPackets.poll()) != null) {
  2099. if (processed > Config.MAX_INCOMONG_PACKETS_PER_CYCLE) {
  2100. break;
  2101. }
  2102. inStream.currentOffset = 0;
  2103. packetType = p.getOpcode();
  2104. packetSize = p.getLength();
  2105. inStream.buffer = p.getPayload().array();
  2106. if (packetType > 0) {
  2107. PacketHandler.processPacket(this, packetType, packetSize);
  2108. processed++;
  2109. }
  2110. }
  2111. return true;
  2112. }
  2113.  
  2114. public void correctCoordinates() {
  2115. final Boundary pc = PestControl.GAME_BOUNDARY;
  2116. final Boundary fc = Boundary.FIGHT_CAVE;
  2117. int x = teleportToX;
  2118. int y = teleportToY;
  2119. if (x > pc.getMinimumX() && x < pc.getMaximumX() && y > pc.getMinimumY() && y < pc.getMaximumY()) {
  2120. getPA().movePlayer(2657, 2639, 0);
  2121. } else if (x > fc.getMinimumX() && x < fc.getMaximumX() && y > fc.getMinimumY() && y < fc.getMaximumY()) {
  2122.  
  2123. getPA().movePlayer(absX, absY, heightLevel * 4);
  2124. sendMessage("Wave " + (this.waveId + 1) + " will start in approximately 5-10 seconds. ");
  2125. getFightCave().spawn();
  2126. }
  2127. }
  2128.  
  2129. public int getPrivateChat() {
  2130. return privateChat;
  2131. }
  2132.  
  2133. public Friends getFriends() {
  2134. return friend;
  2135. }
  2136.  
  2137. public Ignores getIgnores() {
  2138. return ignores;
  2139. }
  2140.  
  2141. public void setPrivateChat(int option) {
  2142. this.privateChat = option;
  2143. }
  2144.  
  2145. public Trade getTrade() {
  2146. return trade;
  2147. }
  2148.  
  2149. public Position getPosition() {
  2150. return new Position(absX, absY, heightLevel);
  2151. }
  2152.  
  2153. public int localX() {
  2154. return this.getX() - this.getMapRegionX() * 8;
  2155. }
  2156.  
  2157. public int localY() {
  2158. return this.getY() - this.getMapRegionY() * 8;
  2159. }
  2160.  
  2161. public AchievementHandler getAchievements() {
  2162. if (achievementHandler == null)
  2163. achievementHandler = new AchievementHandler(this);
  2164. return achievementHandler;
  2165. }
  2166.  
  2167. public long getLastContainerSearch() {
  2168. return lastContainerSearch;
  2169. }
  2170.  
  2171. public void setLastContainerSearch(long lastContainerSearch) {
  2172. this.lastContainerSearch = lastContainerSearch;
  2173. }
  2174.  
  2175. public MysteryBox getMysteryBox() {
  2176. return mysteryBox;
  2177. }
  2178.  
  2179. public DamageQueueEvent getDamageQueue() {
  2180. return damageQueue;
  2181. }
  2182.  
  2183. public void addDamageReceived(String player, int damage) {
  2184. if (damage <= 0) {
  2185. return;
  2186. }
  2187. Damage combatDamage = new Damage(damage);
  2188. if (damageReceived.containsKey(player)) {
  2189. damageReceived.get(player).add(new Damage(damage));
  2190. } else {
  2191. damageReceived.put(player, new ArrayList<>(Arrays.asList(combatDamage)));
  2192. }
  2193. }
  2194.  
  2195. public void resetDamageReceived() {
  2196. damageReceived.clear();
  2197. }
  2198.  
  2199. private String killer;
  2200. public boolean craftDialogue;
  2201.  
  2202. public String getPlayerKiller() {
  2203. String killer = null;
  2204. int totalDamage = 0;
  2205. for (Entry<String, ArrayList<Damage>> entry : damageReceived.entrySet()) {
  2206. String player = entry.getKey();
  2207. ArrayList<Damage> damageList = entry.getValue();
  2208. int damage = 0;
  2209. for (Damage d : damageList) {
  2210. if (System.currentTimeMillis() - d.getTimestamp() < 90000) {
  2211. damage += d.getAmount();
  2212. }
  2213. }
  2214. if (totalDamage == 0 || damage > totalDamage || killer == null) {
  2215. totalDamage = damage;
  2216. killer = player;
  2217. }
  2218. }
  2219. return killer;
  2220. }
  2221.  
  2222. public String getKiller() {
  2223. return killer;
  2224. }
  2225.  
  2226. public void setKiller(String killer) {
  2227. this.killer = killer;
  2228. }
  2229.  
  2230. private boolean killedByZombie = false;
  2231. public boolean isAnimatedArmourSpawned;
  2232. private Hitmark hitmark = null;
  2233. private Hitmark secondHitmark = null;
  2234. protected Rights rights = Rights.PLAYER;
  2235. private Titles titles = new Titles(this);
  2236. private boolean invisible;
  2237. private boolean godmode;
  2238. private boolean safemode;
  2239. private double dropModifier = 1;
  2240. private int debug = 0;
  2241. private boolean trading;
  2242. public boolean playerIsCrafting;
  2243. public boolean hasNpc = false;
  2244. public boolean updateItems = false;
  2245. public int ratsCaught;
  2246. public int summonId;
  2247. public int bossKills;
  2248. public int droppedItem = -1;
  2249. public int kbdCount;
  2250. public int dagannothCount;
  2251. public int krakenCount;
  2252. public int chaosCount;
  2253. public int armaCount;
  2254. public int bandosCount;
  2255. public int saraCount;
  2256. public int zammyCount;
  2257. public int barrelCount;
  2258. public int moleCount;
  2259. public int callistoCount;
  2260. public int venenatisCount;
  2261. public int vetionCount;
  2262. public int rememberNpcIndex;
  2263. public boolean slayerRecipe;
  2264. public boolean claimedReward;
  2265. public long lastMove;
  2266. public long bonusXpTime;
  2267. public long craftingDelay;
  2268. public boolean settingMin;
  2269. public boolean settingMax;
  2270. public boolean settingBet;
  2271. public int diceMin;
  2272. public int diceMax;
  2273. public int otherDiceId;
  2274. public int betAmount;
  2275. public int totalProfit;
  2276. public int betsWon;
  2277. public int betsLost;
  2278. public Player diceHost;
  2279. public int removedTasks[] = { -1, -1, -1, -1 };
  2280. public long buySlayerTimer;
  2281. public long lastFire;
  2282. public boolean needsNewTask = false;
  2283. public boolean keepTitle = false;
  2284. public boolean killTitle = false;
  2285. public int slayerPoints = 0;
  2286. public int pTime;
  2287. public int killStreak;
  2288. public boolean hide = false;
  2289. public ArrayList<String> killedPlayers = new ArrayList<>();
  2290. public ArrayList<Integer> attackedPlayers = new ArrayList<>();
  2291. public ArrayList<String> lastConnectedFrom = new ArrayList<>();
  2292. private boolean stopPlayer;
  2293. /**
  2294. * Clan Chat Variables
  2295. */
  2296. public String clanName;
  2297. public String properName;
  2298. public long lastMysteryBox;
  2299. public int waveType;
  2300. public int[] waveInfo = new int[3];
  2301. public String date;
  2302. public String currentTime;
  2303. public int day;
  2304. public int month;
  2305. public int YEAR;
  2306. public int totalLevel;
  2307. public int xpTotal;
  2308. public int smeltAmount = 0;
  2309. public int smeltEventId = 5567;
  2310. public String barType = "";
  2311. public Smelting.Bars bar = null;
  2312. public boolean isSmelting = false;
  2313. public long lastSmelt = 0;
  2314. /**
  2315. * Title Variables
  2316. */
  2317. public String playerTitle = "";
  2318. /**
  2319. * Event Variables
  2320. */
  2321. public boolean hasEvent;
  2322. /**
  2323. * Achievement Variables
  2324. */
  2325. public int achievementsCompleted;
  2326. public int achievementPoints;
  2327. public int fireslit;
  2328. public int crabsKilled;
  2329. public int treesCut;
  2330. public boolean expLock = false;
  2331. public boolean buyingX;
  2332. public boolean leverClicked = false;
  2333. public double crossbowDamage;
  2334. public int pkp;
  2335. public int KC;
  2336. public int DC;
  2337. public int votePoints;
  2338. public int amDonated;
  2339. public boolean[] clanWarRule = new boolean[10];
  2340. public int follow2 = 0;
  2341. public int antiqueSelect = 0;
  2342. public boolean usingLamp = false;
  2343. public boolean normalLamp = false;
  2344. public boolean antiqueLamp = false;
  2345. public int[][] playerSkillProp = new int[20][15];
  2346. public boolean[] playerSkilling = new boolean[22];
  2347. public boolean catchingImp = false;
  2348. public boolean setPin = false;
  2349. public String bankPin = "";
  2350. public boolean teleporting;
  2351. public long jailEnd;
  2352. public long muteEnd;
  2353. public long marketMuteEnd;
  2354. public long banEnd;
  2355. public long lastReport = 0;
  2356. public int level1 = 0;
  2357. public int level2 = 0;
  2358. public int level3 = 0;
  2359. public String lastReported = "";
  2360. public long lastButton;
  2361. public int leatherType = -1;
  2362. public boolean isWc;
  2363. public int homeTele = 0;
  2364. public int homeTeleDelay = 0;
  2365. public boolean wcing;
  2366. public int treeX;
  2367. public int treeY;
  2368. public long miscTimer;
  2369. public boolean canWalk = true;
  2370. public long lastFlower;
  2371. public long waitTime;
  2372. public boolean usingROD = false;
  2373. public int DELAY = 1250;
  2374. public long saveButton = 0;
  2375. public int attempts = 3;
  2376. public boolean isOperate;
  2377. public int itemUsing;
  2378. public boolean isFullBody = false;
  2379. public boolean isFullHelm = false;
  2380. public boolean isFullMask = false;
  2381. public long lastCast;
  2382. public long lastVeng;
  2383. public boolean hasBankPin;
  2384. public boolean enterdBankpin;
  2385. public boolean firstPinEnter;
  2386. public boolean requestPinDelete;
  2387. public boolean secondPinEnter;
  2388. public boolean thirdPinEnter;
  2389. public boolean fourthPinEnter;
  2390. public boolean hasBankpin;
  2391. public int lastLoginDate;
  2392. public int playerBankPin;
  2393. public int recoveryDelay = 3;
  2394. public int attemptsRemaining = 3;
  2395. public int lastPinSettings = -1;
  2396. public int setPinDate = -1;
  2397. public int changePinDate = -1;
  2398. public int deletePinDate = -1;
  2399. public int firstPin;
  2400. public int secondPin;
  2401. public int thirdPin;
  2402. public int fourthPin;
  2403. public int bankPin1;
  2404. public int bankPin2;
  2405. public int bankPin3;
  2406. public int bankPin4;
  2407. public int pinDeleteDateRequested;
  2408. public boolean isBanking = true;
  2409. public boolean isCooking = false;
  2410. public boolean isBurning = false;
  2411. public boolean initialized = false;
  2412. public boolean disconnected = false;
  2413. public boolean ruleAgreeButton = false;
  2414. public boolean rebuildNPCList = false;
  2415. public boolean isActive = false;
  2416. public boolean isKicked = false;
  2417. public boolean isSkulled = false;
  2418. public boolean friendUpdate = false;
  2419. public boolean newPlayer = false;
  2420. public boolean hasMultiSign = false;
  2421. public boolean saveCharacter = false;
  2422. public boolean mouseButton = false;
  2423. public boolean splitChat = false;
  2424. public boolean chatEffects = true;
  2425. public boolean nextDialogue = false;
  2426. public boolean autocasting = false;
  2427. public boolean usedSpecial = false;
  2428. public boolean mageFollow = false;
  2429. public boolean dbowSpec = false;
  2430. public boolean craftingLeather = false;
  2431. public boolean properLogout = false;
  2432. public boolean secDbow = false;
  2433. public boolean maxNextHit = false;
  2434. public boolean ssSpec = false;
  2435. public boolean vengOn = false;
  2436. public boolean addStarter = false;
  2437. public boolean startPack = false;
  2438. public boolean accountFlagged = false;
  2439. public boolean msbSpec = false;
  2440. public boolean dtOption = false;
  2441. public boolean dtOption2 = false;
  2442. public boolean doricOption = false;
  2443. public boolean doricOption2 = false;
  2444. public boolean caOption2 = false;
  2445. public boolean caOption2a = false;
  2446. public boolean caOption4a = false;
  2447. public boolean caOption4b = false;
  2448. public boolean caOption4c = false;
  2449. public boolean caPlayerTalk1 = false;
  2450. public boolean horrorOption = false;
  2451. public boolean rfdOption = false;
  2452. public boolean inDt = false;
  2453. public boolean inHfd = false;
  2454. public boolean disableAttEvt = false;
  2455. public boolean AttackEventRunning = false;
  2456. public boolean npcindex;
  2457. public boolean spawned = false;
  2458. public int saveDelay;
  2459. public int height = 0;
  2460. public int playerKilled;
  2461. public int totalPlayerDamageDealt;
  2462. public int killedBy;
  2463. public int lastChatId = 1;
  2464. public int friendSlot = 0;
  2465. public int dialogueId;
  2466. public int randomCoffin;
  2467. public int newLocation;
  2468. public int specEffect;
  2469. public int specBarId;
  2470. public int attackLevelReq;
  2471. public int defenceLevelReq;
  2472. public int strengthLevelReq;
  2473. public int rangeLevelReq;
  2474. public int magicLevelReq;
  2475. public int followId;
  2476. public int skullTimer;
  2477. public int votingPoints;
  2478. public int nextChat = 0;
  2479. public int talkingNpc = -1;
  2480. public int dialogueAction = 0;
  2481. public int autocastId;
  2482. public int followDistance;
  2483. public int followId2;
  2484. public int barrageCount = 0;
  2485. public int delayedDamage = 0;
  2486. public int delayedDamage2 = 0;
  2487. public int pcPoints = 0;
  2488. public int donatorPoints = 0;
  2489. public int magePoints = 0;
  2490. public int lastArrowUsed = -1;
  2491. public int clanId = -1;
  2492. public int autoRet = 0;
  2493. public int pcDamage = 0;
  2494. public int xInterfaceId = 0;
  2495. public int xRemoveId = 0;
  2496. public int xRemoveSlot = 0;
  2497. public int tzhaarToKill = 0;
  2498. public int tzhaarKilled = 0;
  2499. public int waveId;
  2500. public int frozenBy = 0;
  2501. public int teleAction = 0;
  2502. public int newPlayerAct = 0;
  2503. public int bonusAttack = 0;
  2504. public int lastNpcAttacked = 0;
  2505. public int killCount = 0;
  2506. public int actionTimer;
  2507. public int rfdRound = 0;
  2508. public int roundNpc = 0;
  2509. public int desertTreasure = 0;
  2510. public int horrorFromDeep = 0;
  2511. public int QuestPoints = 0;
  2512. public int doricQuest = 0;
  2513. public int[] voidStatus = new int[5];
  2514. public int[] itemKeptId = new int[4];
  2515. public int[] pouches = new int[4];
  2516. public final int[] POUCH_SIZE = { 3, 6, 9, 12 };
  2517. public boolean[] invSlot = new boolean[28];
  2518. public boolean[] equipSlot = new boolean[14];
  2519. public long friends[] = new long[200];
  2520. public double specAmount = 0;
  2521. public double specAccuracy = 1;
  2522. public double specDamage = 1;
  2523. public double prayerPoint = 1.0;
  2524. public boolean storing = false;
  2525. public int teleGrabItem;
  2526. public int teleGrabX;
  2527. public int teleGrabY;
  2528. public int duelCount;
  2529. public int underAttackBy;
  2530. public int underAttackBy2;
  2531. public int wildLevel;
  2532. public int teleTimer;
  2533. public int respawnTimer;
  2534. public int saveTimer = 0;
  2535. public int teleBlockLength;
  2536. public long lastPlayerMove = System.currentTimeMillis();
  2537. public Stopwatch lastSpear = new Stopwatch();
  2538. public Stopwatch lastProtItem = new Stopwatch();
  2539. public long dfsDelay = System.currentTimeMillis();
  2540. public Stopwatch lastYell = new Stopwatch();
  2541. public long teleGrabDelay = System.currentTimeMillis();
  2542. public long protMageDelay = System.currentTimeMillis();
  2543. public long protMeleeDelay = System.currentTimeMillis();
  2544. public long protRangeDelay = System.currentTimeMillis();
  2545. public long lastAction = System.currentTimeMillis();
  2546. public long lastThieve = System.currentTimeMillis();
  2547. public long lastLockPick = System.currentTimeMillis();
  2548. public long alchDelay = System.currentTimeMillis();
  2549. public long specCom = System.currentTimeMillis();
  2550. public Stopwatch specDelay = new Stopwatch();
  2551. public long duelDelay = System.currentTimeMillis();
  2552. public long teleBlockDelay = System.currentTimeMillis();
  2553. public long godSpellDelay = System.currentTimeMillis();
  2554. public Stopwatch singleCombatDelay = new Stopwatch();
  2555. public Stopwatch singleCombatDelay2 = new Stopwatch();
  2556. public long reduceStat = System.currentTimeMillis();
  2557. public long restoreStatsDelay = System.currentTimeMillis();
  2558. public Stopwatch logoutDelay = new Stopwatch();
  2559. public long buryDelay = System.currentTimeMillis();
  2560. public long cleanDelay = System.currentTimeMillis();
  2561. public Stopwatch lastRare = new Stopwatch();
  2562. public long diceDelay;
  2563. public Stopwatch foodDelay = new Stopwatch();
  2564. public Stopwatch ditchDelay = new Stopwatch();
  2565. public Stopwatch switchDelay = new Stopwatch();
  2566. public Stopwatch potDelay = new Stopwatch();
  2567. public boolean canChangeAppearance = false;
  2568. public boolean mageAllowed;
  2569. public int focusPointX = -1;
  2570. public int focusPointY = -1;
  2571. public int questPoints = 0;
  2572. public int cooksA;
  2573. public int lastDtKill = 0;
  2574. public int dtHp = 0;
  2575. public int dtMax = 0;
  2576. public int dtAtk = 0;
  2577. public int dtDef = 0;
  2578. public int desertT;
  2579. public long lastChat;
  2580. public long lastRandom;
  2581. public long lastCaught = 0;
  2582. public long lastAttacked;
  2583. public long homeTeleTime;
  2584. public long lastDagChange = -1;
  2585. public long reportDelay;
  2586. public long lastPlant;
  2587. public long objectTimer;
  2588. public long npcTimer;
  2589. public long lastEss;
  2590. public long lastClanMessage;
  2591. public int DirectionCount = 0;
  2592. public boolean appearanceUpdateRequired = true;
  2593. public boolean isDead = false;
  2594. public boolean randomEvent = false;
  2595. public boolean FirstClickRunning = false;
  2596. public boolean WildernessWarning = false;
  2597. protected boolean faceNPCupdate = false;
  2598. public int faceNPC = -1;
  2599. public int[] keepItems = new int[4];
  2600. public int[] keepItemsN = new int[4];
  2601. public int WillKeepAmt1;
  2602. public int WillKeepAmt2;
  2603. public int WillKeepAmt3;
  2604. public int WillKeepAmt4;
  2605. public int WillKeepItem1;
  2606. public int WillKeepItem2;
  2607. public int WillKeepItem3;
  2608. public int WillKeepItem4;
  2609. public int WillKeepItem1Slot;
  2610. public int WillKeepItem2Slot;
  2611. public int WillKeepItem3Slot;
  2612. public int WillKeepItem4Slot;
  2613. public int EquipStatus;
  2614. public final int[] BOWS = { 19481, 19478, 12788, 9185, 11785, 839, 845, 847, 851, 855, 859, 841, 843, 849, 853, 857, 12424,
  2615. 861, 4212, 4214, 4215, 12765, 12766, 12767, 12768, 11235, 4216, 4217, 4218, 4219, 4220, 4221, 4222, 4223,
  2616. 6724, 4734, 4934, 4935, 4936, 4937 };
  2617. public final int[] JAVELIN = { 19484 };
  2618. public final int[] BALLISTA = { 19481, 19478 };
  2619. public final int[] ARROWS = { 882, 884, 886, 888, 890, 892, 4740, 11212, 9140, 9141, 4142, 9143, 9144, 9240, 9241,
  2620. 9242, 9243, 9244, 9245, 19484 };
  2621. public final int[] NO_ARROW_DROP = { 4212, 4214, 4215, 4216, 4217, 4218, 4219, 4220, 4221, 4222, 4223, 4734, 4934,
  2622. 4935, 4936, 4937 };
  2623. public final int[] OTHER_RANGE_WEAPONS = { 863, 864, 865, 866, 867, 868, 869, 806, 807, 808, 809, 810, 811, 825,
  2624. 826, 827, 828, 829, 830, 800, 801, 802, 803, 804, 805, 6522 };
  2625. public final int[][] MAGIC_SPELLS = {
  2626. // example {magicId, level req, animation, startGFX, projectile Id,
  2627. // endGFX, maxhit, exp gained, rune 1, rune 1 amount, rune 2, rune 2
  2628. // amount, rune 3, rune 3 amount, rune 4, rune 4 amount}
  2629.  
  2630. // Modern Spells
  2631. { 1152, 1, 711, 90, 91, 92, 2, 5, 556, 1, 558, 1, 0, 0, 0, 0 }, // wind
  2632. // strike
  2633. { 1154, 5, 711, 93, 94, 95, 4, 7, 555, 1, 556, 1, 558, 1, 0, 0 }, // water
  2634. // strike
  2635. { 1156, 9, 711, 96, 97, 98, 6, 9, 557, 2, 556, 1, 558, 1, 0, 0 }, // earth
  2636. // strike
  2637. { 1158, 13, 711, 99, 100, 101, 8, 11, 554, 3, 556, 2, 558, 1, 0, 0 }, // fire
  2638. // strike
  2639. { 1160, 17, 711, 117, 118, 119, 9, 13, 556, 2, 562, 1, 0, 0, 0, 0 }, // wind
  2640. // bolt
  2641. { 1163, 23, 711, 120, 121, 122, 10, 16, 556, 2, 555, 2, 562, 1, 0, 0 }, // water
  2642. // bolt
  2643. { 1166, 29, 711, 123, 124, 125, 11, 20, 556, 2, 557, 3, 562, 1, 0, 0 }, // earth
  2644. // bolt
  2645. { 1169, 35, 711, 126, 127, 128, 12, 22, 556, 3, 554, 4, 562, 1, 0, 0 }, // fire
  2646. // bolt
  2647. { 1172, 41, 711, 132, 133, 134, 13, 25, 556, 3, 560, 1, 0, 0, 0, 0 }, // wind
  2648. // blast
  2649. { 1175, 47, 711, 135, 136, 137, 14, 28, 556, 3, 555, 3, 560, 1, 0, 0 }, // water
  2650. // blast
  2651. { 1177, 53, 711, 138, 139, 140, 15, 31, 556, 3, 557, 4, 560, 1, 0, 0 }, // earth
  2652. // blast
  2653. { 1181, 59, 711, 129, 130, 131, 16, 35, 556, 4, 554, 5, 560, 1, 0, 0 }, // fire
  2654. // blast
  2655. { 1183, 62, 711, 158, 159, 160, 17, 36, 556, 5, 565, 1, 0, 0, 0, 0 }, // wind
  2656. // wave
  2657. { 1185, 65, 711, 161, 162, 163, 18, 37, 556, 5, 555, 7, 565, 1, 0, 0 }, // water
  2658. // wave
  2659. { 1188, 70, 711, 164, 165, 166, 19, 40, 556, 5, 557, 7, 565, 1, 0, 0 }, // earth
  2660. // wave
  2661. { 1189, 75, 711, 155, 156, 157, 20, 42, 556, 5, 554, 7, 565, 1, 0, 0 }, // fire
  2662. // wave
  2663. { 1153, 3, 716, 102, 103, 104, 0, 13, 555, 3, 557, 2, 559, 1, 0, 0 }, // confuse
  2664. { 1157, 11, 716, 105, 106, 107, 0, 20, 555, 3, 557, 2, 559, 1, 0, 0 }, // weaken
  2665. { 1161, 19, 716, 108, 109, 110, 0, 29, 555, 2, 557, 3, 559, 1, 0, 0 }, // curse
  2666. { 1542, 66, 729, 167, 168, 169, 0, 76, 557, 5, 555, 5, 566, 1, 0, 0 }, // vulnerability
  2667. { 1543, 73, 729, 170, 171, 172, 0, 83, 557, 8, 555, 8, 566, 1, 0, 0 }, // enfeeble
  2668. { 1562, 80, 729, 173, 174, 107, 0, 90, 557, 12, 555, 12, 556, 1, 0, 0 }, // stun
  2669. { 1572, 20, 711, 177, 178, 181, 0, 30, 557, 3, 555, 3, 561, 2, 0, 0 }, // bind
  2670. { 1582, 50, 711, 177, 178, 180, 2, 60, 557, 4, 555, 4, 561, 3, 0, 0 }, // snare
  2671. { 1592, 79, 711, 177, 178, 179, 4, 90, 557, 5, 555, 5, 561, 4, 0, 0 }, // entangle
  2672. { 1171, 39, 724, 145, 146, 147, 15, 25, 556, 2, 557, 2, 562, 1, 0, 0 }, // crumble
  2673. // undead
  2674. { 1539, 50, 708, 87, 88, 89, 25, 42, 554, 5, 560, 1, 0, 0, 0, 0 }, // iban
  2675. // blast
  2676. { 12037, 50, 1576, 327, 328, 329, 19, 30, 560, 1, 558, 4, 0, 0, 0, 0 }, // magic
  2677. // dart
  2678. { 1190, 60, 811, 0, 0, 76, 20, 60, 554, 2, 565, 2, 556, 4, 0, 0 }, // sara
  2679. // strike
  2680. { 1191, 60, 811, 0, 0, 77, 20, 60, 554, 1, 565, 2, 556, 4, 0, 0 }, // cause
  2681. // of
  2682. // guthix
  2683. { 1192, 60, 811, 0, 0, 78, 20, 60, 554, 4, 565, 2, 556, 1, 0, 0 }, // flames
  2684. // of
  2685. // zammy
  2686. { 12445, 85, 1819, 0, 344, 345, 0, 65, 563, 1, 562, 1, 560, 1, 0, 0 }, // teleblock
  2687.  
  2688. // Ancient Spells
  2689. { 12939, 50, 1978, 0, 384, 385, 13, 30, 560, 2, 562, 2, 554, 1, 556, 1 }, // smoke
  2690. // rush
  2691. { 12987, 52, 1978, 0, 378, 379, 14, 31, 560, 2, 562, 2, 566, 1, 556, 1 }, // shadow
  2692. // rush
  2693. { 12901, 56, 1978, 0, 0, 373, 15, 33, 560, 2, 562, 2, 565, 1, 0, 0 }, // blood
  2694. // rush
  2695. { 12861, 58, 1978, 0, 360, 361, 16, 34, 560, 2, 562, 2, 555, 2, 0, 0 }, // ice
  2696. // rush
  2697. { 12963, 62, 1979, 0, 0, 389, 19, 36, 560, 2, 562, 4, 556, 2, 554, 2 }, // smoke
  2698. // burst
  2699. { 13011, 64, 1979, 0, 0, 382, 20, 37, 560, 2, 562, 4, 556, 2, 566, 2 }, // shadow
  2700. // burst
  2701. { 12919, 68, 1979, 0, 0, 376, 21, 39, 560, 2, 562, 4, 565, 2, 0, 0 }, // blood
  2702. // burst
  2703. { 12881, 70, 1979, 0, 0, 363, 22, 40, 560, 2, 562, 4, 555, 4, 0, 0 }, // ice
  2704. // burst
  2705. { 12951, 74, 1978, 0, 386, 387, 23, 42, 560, 2, 554, 2, 565, 2, 556, 2 }, // smoke
  2706. // blitz
  2707. { 12999, 76, 1978, 0, 380, 381, 24, 43, 560, 2, 565, 2, 556, 2, 566, 2 }, // shadow
  2708. // blitz
  2709. { 12911, 80, 1978, 0, 374, 375, 25, 45, 560, 2, 565, 4, 0, 0, 0, 0 }, // blood
  2710. // blitz
  2711. { 12871, 82, 1978, 366, 0, 367, 26, 46, 560, 2, 565, 2, 555, 3, 0, 0 }, // ice
  2712. // blitz
  2713. { 12975, 86, 1979, 0, 0, 391, 27, 48, 560, 4, 565, 2, 556, 4, 554, 4 }, // smoke
  2714. // barrage
  2715. { 13023, 88, 1979, 0, 0, 383, 28, 49, 560, 4, 565, 2, 556, 4, 566, 3 }, // shadow
  2716. // barrage
  2717. { 12929, 92, 1979, 0, 0, 377, 29, 51, 560, 4, 565, 4, 566, 1, 0, 0 }, // blood
  2718. // barrage
  2719. { 12891, 94, 1979, 0, 0, 369, 30, 52, 560, 4, 565, 2, 555, 6, 0, 0 }, // ice
  2720. // barrage
  2721.  
  2722. { -1, 80, 811, 301, 0, 0, 0, 0, 554, 3, 565, 3, 556, 3, 0, 0 }, // charge
  2723. { -1, 21, 712, 112, 0, 0, 0, 10, 554, 3, 561, 1, 0, 0, 0, 0 }, // low
  2724. // alch
  2725. { -1, 55, 713, 113, 0, 0, 0, 20, 554, 5, 561, 1, 0, 0, 0, 0 }, // high
  2726. // alch
  2727. { -1, 33, 728, 142, 143, 144, 0, 35, 556, 1, 563, 1, 0, 0, 0, 0 }, // telegrab
  2728.  
  2729. { -1, 75, 1167, 1251, 1252, 1253, 29, 35, 0, 0, 0, 0, 0, 0, 0, 0 }, // trident
  2730. // of
  2731. // the
  2732. // seas
  2733.  
  2734. { -1, 75, 1167, 665, 1040, 1042, 32, 35, 0, 0, 0, 0, 0, 0, 0, 0 } // trident
  2735. // of
  2736. // the
  2737. // swamp
  2738.  
  2739. };
  2740. public boolean multiAttacking;
  2741. public boolean rangeEndGFXHeight;
  2742. public boolean playerFletch;
  2743. public boolean playerIsFletching;
  2744. public boolean playerIsMining;
  2745. public boolean playerIsFiremaking;
  2746. public boolean playerIsFishing;
  2747. public boolean playerIsCooking;
  2748. public boolean below459 = true;
  2749. public boolean defaultWealthTransfer;
  2750. public boolean updateInventory;
  2751. public boolean oldSpec;
  2752. public boolean stopPlayerSkill;
  2753. public boolean playerStun;
  2754. public boolean stopPlayerPacket;
  2755. public boolean usingClaws;
  2756. public boolean usingAbby;
  2757. public boolean playerBFishing;
  2758. public boolean finishedBarbarianTraining;
  2759. public boolean ignoreDefence;
  2760. public boolean secondFormAutocast;
  2761. public boolean usingArrows;
  2762. public boolean usingJavelin;
  2763. public boolean usingOtherRangeWeapons;
  2764. public boolean usingCross;
  2765. public boolean usingBallista;
  2766. public boolean magicDef;
  2767. public boolean spellSwap;
  2768. public boolean recoverysSet;
  2769. public int rangeEndGFX;
  2770. public int boltDamage;
  2771. public int teleotherType;
  2772. public int playerTradeWealth;
  2773. public int doAmount;
  2774. public int woodcuttingTree;
  2775. public int stageT;
  2776. public int dfsCount;
  2777. public int recoilHits;
  2778. public int playerDialogue;
  2779. public int clawDelay;
  2780. public int previousDamage;
  2781. public int previousDamage2;
  2782. public boolean protectItem = false;
  2783. public int[] autocastIds = { 51133, 32, 51185, 33, 51091, 34, 24018, 35, 51159, 36, 51211, 37, 51111, 38, 51069, 39,
  2784. 51146, 40, 51198, 41, 51102, 42, 51058, 43, 51172, 44, 51224, 45, 51122, 46, 51080, 47, 7038, 0, 7039, 1,
  2785. 7040, 2, 7041, 3, 7042, 4, 7043, 5, 7044, 6, 7045, 7, 7046, 8, 7047, 9, 7048, 10, 7049, 11, 7050, 12, 7051,
  2786. 13, 7052, 14, 7053, 15, 47019, 27, 47020, 25, 47021, 12, 47022, 13, 47023, 14, 47024, 15 };
  2787. public int[][] barrowsNpcs = { { 1677, 0 }, // verac
  2788. { 1676, 0 }, // toarg
  2789. { 1675, 0 }, // karil
  2790. { 1674, 0 }, // guthan
  2791. { 1673, 0 }, // dharok
  2792. { 1672, 0 } // ahrim
  2793. };
  2794. public int barrowsKillCount;
  2795. public int reduceSpellId;
  2796. public final int[] REDUCE_SPELL_TIME = { 250000, 250000, 250000, 500000, 500000, 500000 };
  2797. public long[] reduceSpellDelay = new long[6];
  2798. public final int[] REDUCE_SPELLS = { 1153, 1157, 1161, 1542, 1543, 1562 };
  2799. public boolean[] canUseReducingSpell = { true, true, true, true, true, true };
  2800. public int slayerTask;
  2801. public int bossSlayerTask;
  2802. public int taskAmount;
  2803. public int bossTaskAmount;
  2804. public boolean needsNewBossTask;
  2805. public int prayerId = -1;
  2806. public int headIcon = -1;
  2807. public int bountyIcon = 0;
  2808. public long stopPrayerDelay;
  2809. public long prayerDelay;
  2810. public boolean usingPrayer;
  2811. public final int[] PRAYER_DRAIN_RATE = { 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500,
  2812. 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500 };
  2813. 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,
  2814. 44, 45, 46, 49, 52, 60, 70 };
  2815. 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,
  2816. 24, 25 };
  2817. public final String[] PRAYER_NAME = { "Thick Skin", "Burst of Strength", "Clarity of Thought", "Sharp Eye",
  2818. "Mystic Will", "Rock Skin", "Superhuman Strength", "Improved Reflexes", "Rapid Restore", "Rapid Heal",
  2819. "Protect Item", "Hawk Eye", "Mystic Lore", "Steel Skin", "Ultimate Strength", "Incredible Reflexes",
  2820. "Protect from Magic", "Protect from Missiles", "Protect from Melee", "Eagle Eye", "Mystic Might",
  2821. "Retribution", "Redemption", "Smite", "Chivalry", "Piety" };
  2822. public final int[] PRAYER_GLOW = { 83, 84, 85, 601, 602, 86, 87, 88, 89, 90, 91, 603, 604, 92, 93, 94, 95, 96, 97,
  2823. 605, 606, 98, 99, 100, 607, 608 };
  2824. 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,
  2825. -1, -1, 3, 5, 4, -1, -1 };
  2826. public boolean[] prayerActive = { false, false, false, false, false, false, false, false, false, false, false,
  2827. false, false, false, false, false, false, false, false, false, false, false, false, false, false, false };
  2828. public int headIconPk = -1;
  2829. public int headIconHints;
  2830. public boolean[] duelRule = new boolean[22];
  2831. public boolean doubleHit;
  2832. public boolean usingSpecial;
  2833. public boolean npcDroppingItems;
  2834. public boolean usingRangeWeapon;
  2835. public boolean usingBow;
  2836. public boolean usingMagic;
  2837. public boolean castingMagic;
  2838. public boolean usingMelee;
  2839. public int specMaxHitIncrease;
  2840. public int freezeDelay;
  2841. public int freezeTimer = -6;
  2842. public int killerId;
  2843. public int playerIndex;
  2844. public int oldPlayerIndex;
  2845. public int lastWeaponUsed;
  2846. public int projectileStage;
  2847. public int crystalBowArrowCount;
  2848. public int playerMagicBook;
  2849. public int teleGfx;
  2850. public int teleEndAnimation;
  2851. public int teleHeight;
  2852. public int teleX;
  2853. public int teleY;
  2854. public int rangeItemUsed;
  2855. public int killingNpcIndex;
  2856. public int totalDamageDealt;
  2857. public int oldNpcIndex;
  2858. public int fightMode;
  2859. public int attackTimer;
  2860. public int npcIndex;
  2861. public int krakenTent;
  2862. public int checkNPC = 0;
  2863. public int checkNPC1 = 0;
  2864. public int checkNPC2 = 0;
  2865. public int checkNPC3 = 0;
  2866. public int checkNPC4 = 0;
  2867. public int npcClickIndex;
  2868. public int npcType;
  2869. public int castingSpellId;
  2870. public int oldSpellId;
  2871. public int spellId;
  2872. public int hitDelay;
  2873. public boolean magicFailed;
  2874. public boolean oldMagicFailed;
  2875. public int bowSpecShot;
  2876. public int clickNpcType;
  2877. public int clickObjectType;
  2878. public int objectId;
  2879. public int objectX;
  2880. public int objectY;
  2881. public int objectXOffset;
  2882. public int objectYOffset;
  2883. public int objectDistance;
  2884. public int pItemX;
  2885. public int pItemY;
  2886. public int pItemId;
  2887. public boolean isMoving;
  2888. public boolean walkingToItem;
  2889. public boolean isShopping;
  2890. public boolean updateShop;
  2891. public int myShopId;
  2892. public int tradeStatus;
  2893. public int tradeWith;
  2894. public int amountGifted;
  2895. public boolean inDuel;
  2896. public boolean tradeAccepted;
  2897. public boolean goodTrade;
  2898. public boolean inTrade;
  2899. public boolean tradeRequested;
  2900. public boolean tradeResetNeeded;
  2901. public boolean tradeConfirmed;
  2902. public boolean tradeConfirmed2;
  2903. public boolean canOffer;
  2904. public boolean acceptTrade;
  2905. public boolean acceptedTrade;
  2906. public int attackAnim;
  2907. public int[] playerBonus = new int[12];
  2908. public boolean isRunning2 = true;
  2909. public boolean takeAsNote;
  2910. public int combatLevel;
  2911. public boolean saveFile = false;
  2912. public int playerAppearance[] = new int[13];
  2913. public int apset;
  2914. public int actionID;
  2915. public int wearItemTimer;
  2916. public int wearId;
  2917. public int wearSlot;
  2918. public int interfaceId;
  2919. public int XremoveSlot;
  2920. public int XinterfaceID;
  2921. public int XremoveID;
  2922. public int Xamount;
  2923. public int tutorial = 15;
  2924. public boolean usingGlory = false;
  2925. public boolean usingObelisk = false;
  2926. public int[] woodcut = new int[7];
  2927. public int wcTimer = 0;
  2928. public int miningTimer = 0;
  2929. public boolean fishing = false;
  2930. public int fishTimer = 0;
  2931. public int smeltType;
  2932. public int smeltTimer = 0;
  2933. public boolean smeltInterface;
  2934. public boolean patchCleared;
  2935. public int[] farm = new int[2];
  2936. public long lastAntifirePotion;
  2937. public long antifireDelay;
  2938. /**
  2939. * Castle Wars
  2940. */
  2941. public int castleWarsTeam;
  2942. public boolean inCwGame;
  2943. public boolean inCwWait;
  2944. public int npcId2 = 0;
  2945. public boolean isNpc;
  2946.  
  2947. /**
  2948. * Fight Pits
  2949. */
  2950.  
  2951. public String getUsername() {
  2952. return Misc.formatPlayerName(username);
  2953. }
  2954.  
  2955. private String username = null;
  2956. public String firstIP = "0", lastIP = "0";
  2957. public boolean inPits = false;
  2958. public int pitsStatus = 0;
  2959. public String connectedFrom = "";
  2960. public String globalMessage = "";
  2961. public int safeTimer = 0;
  2962. public String playerName = null;
  2963. public String playerName2 = null;
  2964. public String playerPass = null;
  2965. private long nameAsLong;
  2966. public PlayerHandler handler = null;
  2967. public int playerItems[] = new int[28];
  2968. public int playerItemsN[] = new int[28];
  2969. public int bankItems[] = new int[Config.BANK_SIZE];
  2970. public int bankItemsN[] = new int[Config.BANK_SIZE];
  2971. public boolean bankNotes = false;
  2972. private int dragonfireShieldCharge;
  2973. private long lastDragonfireShieldAttack;
  2974. private boolean dragonfireShieldActive;
  2975. public int playerStandIndex = 0x328;
  2976. public int playerTurnIndex = 0x337;
  2977. public int playerWalkIndex = 0x333;
  2978. public int playerTurn180Index = 0x334;
  2979. public int playerTurn90CWIndex = 0x335;
  2980. public int playerTurn90CCWIndex = 0x336;
  2981. public int playerRunIndex = 0x338;
  2982. public int playerHat = 0;
  2983. public int playerCape = 1;
  2984. public int playerAmulet = 2;
  2985. public int playerWeapon = 3;
  2986. public int playerChest = 4;
  2987. public int playerShield = 5;
  2988. public int playerLegs = 7;
  2989. public int playerHands = 9;
  2990. public int playerFeet = 10;
  2991. public int playerRing = 12;
  2992. public int playerArrows = 13;
  2993. public int playerAttack = 0;
  2994. public int playerDefence = 1;
  2995. public int playerStrength = 2;
  2996. public int playerHitpoints = 3;
  2997. public int playerRanged = 4;
  2998. public int playerPrayer = 5;
  2999. public int playerMagic = 6;
  3000. public int playerCooking = 7;
  3001. public int playerWoodcutting = 8;
  3002. public int playerFletching = 9;
  3003. public int playerFishing = 10;
  3004. public int playerFiremaking = 11;
  3005. public static int playerCrafting = 12;
  3006. public static int playerSmithing = 13;
  3007. public int playerMining = 14;
  3008. public int playerHerblore = 15;
  3009. public int playerAgility = 16;
  3010. public int playerThieving = 17;
  3011. public int playerSlayer = 18;
  3012. public int playerFarming = 19;
  3013. public int playerRunecrafting = 20;
  3014. public int fletchingType;
  3015. public int[] playerEquipment = new int[14];
  3016. public int[] playerEquipmentN = new int[14];
  3017. public int[] playerLevel = new int[25];
  3018. public int[] playerXP = new int[25];
  3019. public boolean seedPlanted = false;
  3020. public boolean seedWatered = false;
  3021. public boolean patchCleaned = false;
  3022. public boolean patchRaked = false;
  3023. public int[][] barrowCrypt = { { 4921, 0 }, { 2035, 0 } };
  3024. public Player playerList[] = new Player[maxPlayerListSize];
  3025. public int playerListSize = 0;
  3026. public byte playerInListBitmap[] = new byte[(Config.MAX_PLAYERS + 7) >> 3];
  3027. public NPC npcList[] = new NPC[maxNPCListSize];
  3028. public int npcListSize = 0;
  3029. public byte npcInListBitmap[] = new byte[(NPCHandler.maxNPCs + 7) >> 3];
  3030. public int getHeightLevel;
  3031. public int mapRegionX;
  3032. public int mapRegionY;
  3033. public int currentX;
  3034. public int currentY;
  3035. public int currentH;
  3036. public int playerSE = 0x328;
  3037. public int playerSEW = 0x333;
  3038. public int playerSER = 0x334;
  3039. public final int walkingQueueSize = 50;
  3040. public int walkingQueueX[] = new int[walkingQueueSize];
  3041. public int walkingQueueY[] = new int[walkingQueueSize];
  3042. public int wQueueReadPtr = 0;
  3043. public int wQueueWritePtr = 0;
  3044. public boolean isRunning = true;
  3045. public int teleportToX = -1;
  3046. public int teleportToY = -1;
  3047. public int runEnergy = 100;
  3048. public long lastRunRecovery;
  3049. public long rangeDelay;
  3050. public boolean inSpecMode = false;
  3051. public boolean didTeleport = false;
  3052. public boolean mapRegionDidChange = false;
  3053. public int dir1 = -1;
  3054. public int dir2 = -1;
  3055.  
  3056. public boolean createItems = false;
  3057. public int poimiX = 0;
  3058. public int poimiY = 0;
  3059. public byte cachedPropertiesBitmap[] = new byte[(Config.MAX_PLAYERS + 7) >> 3];
  3060. private boolean chatTextUpdateRequired = false;
  3061. private byte chatText[] = new byte[4096];
  3062. private byte chatTextSize = 0;
  3063. private int chatTextColor = 0;
  3064. private int chatTextEffects = 0;
  3065. /**
  3066. * Graphics
  3067. **/
  3068.  
  3069. /**
  3070. * Represents whether the force-movement update mask is required.
  3071. */
  3072. private boolean forceMovementUpdateRequired;
  3073.  
  3074. public void setForceMovementRequired(boolean required) {
  3075. forceMovementUpdateRequired = required;
  3076. }
  3077.  
  3078. public void appendForceMovement(Stream str) {
  3079. str.writeByteS(absX);
  3080. str.writeByteS(absY);
  3081. str.writeByteS(absX);
  3082. str.writeByteS(absY + 5);
  3083. str.writeWordBigEndianA(4);
  3084. str.writeWordA(100);
  3085. str.writeByteS(2);
  3086. }
  3087.  
  3088. /**
  3089. * Face Update
  3090. **/
  3091. private int newWalkCmdX[] = new int[walkingQueueSize];
  3092. private int newWalkCmdY[] = new int[walkingQueueSize];
  3093. public int newWalkCmdSteps = 0;
  3094. private boolean newWalkCmdIsRunning = false;
  3095. protected int travelBackX[] = new int[walkingQueueSize];
  3096. protected int travelBackY[] = new int[walkingQueueSize];
  3097. protected int numTravelBackSteps = 0;
  3098. protected AtomicInteger packetsReceived = new AtomicInteger();
  3099. public int[] damageTaken = new int[Config.MAX_PLAYERS];
  3100. private long lastVenomHit;
  3101. private long lastVenomCure;
  3102. private long venomImmunity;
  3103. private byte venomDamage;
  3104. private long lastPoisonHit;
  3105. private long lastPoisonCure;
  3106. private long poisonImmunity;
  3107. private byte poisonDamage;
  3108. private List<Byte> poisonDamageHistory = new ArrayList<>(4);
  3109.  
  3110. public boolean isKilledByZombie() {
  3111. return killedByZombie;
  3112. }
  3113.  
  3114. public void setKilledByZombie(boolean state) {
  3115. killedByZombie = state;
  3116. }
  3117.  
  3118. public int getFarmingSeedId(int index) {
  3119. return farmingSeedId[index];
  3120. }
  3121.  
  3122. public void setFarmingSeedId(int index, int farmingSeedId) {
  3123. this.farmingSeedId[index] = farmingSeedId;
  3124. }
  3125.  
  3126. public int getFarmingTime(int index) {
  3127. return this.farmingTime[index];
  3128. }
  3129.  
  3130. public void setFarmingTime(int index, int farmingTime) {
  3131. this.farmingTime[index] = farmingTime;
  3132. }
  3133.  
  3134. public int getFarmingState(int index) {
  3135. return farmingState[index];
  3136. }
  3137.  
  3138. public void setFarmingState(int index, int farmingState) {
  3139. this.farmingState[index] = farmingState;
  3140. }
  3141.  
  3142. public int getFarmingHarvest(int index) {
  3143. return farmingHarvest[index];
  3144. }
  3145.  
  3146. public void setFarmingHarvest(int index, int farmingHarvest) {
  3147. this.farmingHarvest[index] = farmingHarvest;
  3148. }
  3149.  
  3150. public Farming getFarming() {
  3151. if (farming == null) {
  3152. farming = new Farming(this);
  3153. }
  3154. return farming;
  3155. }
  3156.  
  3157. /**
  3158. * Retrieves the bounty hunter instance for this client object. We use lazy
  3159. * initialization because we store values from the player save file in the
  3160. * bountyHunter object upon login. Without lazy initialization the value
  3161. * would be overwritten.
  3162. *
  3163. * @return the bounty hunter object
  3164. */
  3165. public BountyHunter getBH() {
  3166. if (Objects.isNull(bountyHunter)) {
  3167. bountyHunter = new BountyHunter(this);
  3168. }
  3169. return bountyHunter;
  3170. }
  3171.  
  3172. public UnnecessaryPacketDropper getPacketDropper() {
  3173. return packetDropper;
  3174. }
  3175.  
  3176. public Optional<ItemCombination> getCurrentCombination() {
  3177. return currentCombination;
  3178. }
  3179.  
  3180. public void setCurrentCombination(Optional<ItemCombination> combination) {
  3181. this.currentCombination = combination;
  3182. }
  3183.  
  3184. public PlayerKill getPlayerKills() {
  3185. if (Objects.isNull(playerKills)) {
  3186. playerKills = new PlayerKill();
  3187. }
  3188. return playerKills;
  3189. }
  3190.  
  3191. public String getMacAddress() {
  3192. return macAddress;
  3193. }
  3194.  
  3195. public void setMacAddress(String macAddress) {
  3196. this.macAddress = macAddress;
  3197. }
  3198.  
  3199. public int getMaximumHealth() {
  3200. int base = getLevelForXP(playerXP[3]);
  3201. if (EquipmentSet.GUTHAN.isWearingBarrows(this) && getItems().isWearingItem(12853)) {
  3202. base += 10;
  3203. }
  3204. return base;
  3205. }
  3206.  
  3207. public Duel getDuel() {
  3208. return duelSession;
  3209. }
  3210.  
  3211. public void setItemOnPlayer(Player player) {
  3212. this.itemOnPlayer = player;
  3213. }
  3214.  
  3215. public Player getItemOnPlayer() {
  3216. return itemOnPlayer;
  3217. }
  3218.  
  3219. public Skilling getSkilling() {
  3220. return skilling;
  3221. }
  3222.  
  3223. public Presets getPresets() {
  3224. if (presets == null) {
  3225. presets = new Presets(this);
  3226. }
  3227. return presets;
  3228. }
  3229.  
  3230. public Killstreak getKillstreak() {
  3231. if (getKillstreaks() == null) {
  3232. setKillstreaks(new Killstreak(this));
  3233. }
  3234. return getKillstreaks();
  3235. }
  3236.  
  3237. public Streak getStreak() {
  3238. return streak;
  3239. }
  3240.  
  3241. /**
  3242. * Returns the single instance of the {@link NPCDeathTracker} class for this
  3243. * player.
  3244. *
  3245. * @return the tracker clas
  3246. */
  3247. public NPCDeathTracker getNpcDeathTracker() {
  3248. return npcDeathTracker;
  3249. }
  3250.  
  3251. /**
  3252. * The zulrah event
  3253. *
  3254. * @return event
  3255. */
  3256. public Zulrah getZulrahEvent() {
  3257. return zulrah;
  3258. }
  3259.  
  3260. public Kraken getKraken() {
  3261. return kraken;
  3262. }
  3263.  
  3264. /**
  3265. * The single {@link WarriorsGuild} instance for this player
  3266. *
  3267. * @return warriors guild
  3268. */
  3269. public WarriorsGuild getWarriorsGuild() {
  3270. return warriorsGuild;
  3271. }
  3272.  
  3273. /**
  3274. * The single instance of the {@link PestControlRewards} class for this
  3275. * player
  3276. *
  3277. * @return the reward class
  3278. */
  3279. public PestControlRewards getPestControlRewards() {
  3280. return pestControlRewards;
  3281. }
  3282.  
  3283. public Mining getMining() {
  3284. return mining;
  3285. }
  3286.  
  3287. public PunishmentPanel getPunishmentPanel() {
  3288. return punishmentPanel;
  3289. }
  3290.  
  3291. public void appendFaceNPCUpdate(Stream str) {
  3292. str.writeWordBigEndian(faceNPC);
  3293. }
  3294.  
  3295. public void ResetKeepItems() {
  3296. WillKeepAmt1 = -1;
  3297. WillKeepItem1 = -1;
  3298. WillKeepAmt2 = -1;
  3299. WillKeepItem2 = -1;
  3300. WillKeepAmt3 = -1;
  3301. WillKeepItem3 = -1;
  3302. WillKeepAmt4 = -1;
  3303. WillKeepItem4 = -1;
  3304. }
  3305.  
  3306. public void StartBestItemScan(Player c) {
  3307. if (c.isSkulled && !c.prayerActive[10]) {
  3308. ItemKeptInfo(c, 0);
  3309. return;
  3310. }
  3311. FindItemKeptInfo(c);
  3312. ResetKeepItems();
  3313. BestItem1(c);
  3314. }
  3315.  
  3316. public void FindItemKeptInfo(Player c) {
  3317. if (isSkulled && c.prayerActive[10])
  3318. ItemKeptInfo(c, 1);
  3319. else if (!isSkulled && !c.prayerActive[10])
  3320. ItemKeptInfo(c, 3);
  3321. else if (!isSkulled && c.prayerActive[10])
  3322. ItemKeptInfo(c, 4);
  3323. }
  3324.  
  3325. public void ItemKeptInfo(Player c, int Lose) {
  3326. for (int i = 17109; i < 17131; i++) {
  3327. c.getPA().sendFrame126("", i);
  3328. }
  3329. c.getPA().sendFrame126("Items you will keep on death:", 17104);
  3330. c.getPA().sendFrame126("Items you will lose on death:", 17105);
  3331. c.getPA().sendFrame126("Player Information", 17106);
  3332. c.getPA().sendFrame126("Max items kept on death:", 17107);
  3333. c.getPA().sendFrame126("~ " + Lose + " ~", 17108);
  3334. c.getPA().sendFrame126("The normal amount of", 17111);
  3335. c.getPA().sendFrame126("items kept is three.", 17112);
  3336. switch (Lose) {
  3337. case 0:
  3338. default:
  3339. c.getPA().sendFrame126("Items you will keep on death:", 17104);
  3340. c.getPA().sendFrame126("Items you will lose on death:", 17105);
  3341. c.getPA().sendFrame126("You're marked with a", 17111);
  3342. c.getPA().sendFrame126("@red@skull. @lre@This reduces the", 17112);
  3343. c.getPA().sendFrame126("items you keep from", 17113);
  3344. c.getPA().sendFrame126("three to zero!", 17114);
  3345. break;
  3346. case 1:
  3347. c.getPA().sendFrame126("Items you will keep on death:", 17104);
  3348. c.getPA().sendFrame126("Items you will lose on death:", 17105);
  3349. c.getPA().sendFrame126("You're marked with a", 17111);
  3350. c.getPA().sendFrame126("@red@skull. @lre@This reduces the", 17112);
  3351. c.getPA().sendFrame126("items you keep from", 17113);
  3352. c.getPA().sendFrame126("three to zero!", 17114);
  3353. c.getPA().sendFrame126("However, you also have", 17115);
  3354. c.getPA().sendFrame126("the @red@Protect @lre@Items prayer", 17116);
  3355. c.getPA().sendFrame126("active, which saves you", 17117);
  3356. c.getPA().sendFrame126("one extra item!", 17118);
  3357. break;
  3358. case 3:
  3359. c.getPA().sendFrame126("Items you will keep on death(if not skulled):", 17104);
  3360. c.getPA().sendFrame126("Items you will lose on death(if not skulled):", 17105);
  3361. c.getPA().sendFrame126("You have no factors", 17111);
  3362. c.getPA().sendFrame126("affecting the items you", 17112);
  3363. c.getPA().sendFrame126("keep.", 17113);
  3364. break;
  3365. case 4:
  3366. c.getPA().sendFrame126("Items you will keep on death(if not skulled):", 17104);
  3367. c.getPA().sendFrame126("Items you will lose on death(if not skulled):", 17105);
  3368. c.getPA().sendFrame126("You have the @red@Protect", 17111);
  3369. c.getPA().sendFrame126("@red@Item @lre@prayer active,", 17112);
  3370. c.getPA().sendFrame126("which saves you one", 17113);
  3371. c.getPA().sendFrame126("extra item!", 17114);
  3372. break;
  3373. }
  3374. }
  3375.  
  3376. public void BestItem1(Player c) {
  3377. int BestValue = 0;
  3378. int NextValue = 0;
  3379. int ItemsContained = 0;
  3380. WillKeepItem1 = 0;
  3381. WillKeepItem1Slot = 0;
  3382. for (int ITEM = 0; ITEM < 28; ITEM++) {
  3383. if (playerItems[ITEM] > 0) {
  3384. ItemsContained += 1;
  3385. c.getShops();
  3386. NextValue = (int) Math.floor(ShopAssistant.getItemShopValue(playerItems[ITEM] - 1));
  3387. if (NextValue > BestValue) {
  3388. BestValue = NextValue;
  3389. WillKeepItem1 = playerItems[ITEM] - 1;
  3390. WillKeepItem1Slot = ITEM;
  3391. if (playerItemsN[ITEM] > 2 && !c.prayerActive[10]) {
  3392. WillKeepAmt1 = 3;
  3393. } else if (playerItemsN[ITEM] > 3 && c.prayerActive[10]) {
  3394. WillKeepAmt1 = 4;
  3395. } else {
  3396. WillKeepAmt1 = playerItemsN[ITEM];
  3397. }
  3398. }
  3399. }
  3400. }
  3401. for (int EQUIP = 0; EQUIP < 14; EQUIP++) {
  3402. if (playerEquipment[EQUIP] > 0) {
  3403. ItemsContained += 1;
  3404. c.getShops();
  3405. NextValue = (int) Math.floor(ShopAssistant.getItemShopValue(playerEquipment[EQUIP]));
  3406. if (NextValue > BestValue) {
  3407. BestValue = NextValue;
  3408. WillKeepItem1 = playerEquipment[EQUIP];
  3409. WillKeepItem1Slot = EQUIP + 28;
  3410. if (playerEquipmentN[EQUIP] > 2 && !c.prayerActive[10]) {
  3411. WillKeepAmt1 = 3;
  3412. } else if (playerEquipmentN[EQUIP] > 3 && c.prayerActive[10]) {
  3413. WillKeepAmt1 = 4;
  3414. } else {
  3415. WillKeepAmt1 = playerEquipmentN[EQUIP];
  3416. }
  3417. }
  3418. }
  3419. }
  3420. if (!isSkulled && ItemsContained > 1 && (WillKeepAmt1 < 3 || (c.prayerActive[10] && WillKeepAmt1 < 4))) {
  3421. BestItem2(c, ItemsContained);
  3422. }
  3423. }
  3424.  
  3425. public void BestItem2(Player c, int ItemsContained) {
  3426. int BestValue = 0;
  3427. int NextValue = 0;
  3428. WillKeepItem2 = 0;
  3429. WillKeepItem2Slot = 0;
  3430. for (int ITEM = 0; ITEM < 28; ITEM++) {
  3431. if (playerItems[ITEM] > 0) {
  3432. c.getShops();
  3433. NextValue = (int) Math.floor(ShopAssistant.getItemShopValue(playerItems[ITEM] - 1));
  3434. if (NextValue > BestValue && !(ITEM == WillKeepItem1Slot && playerItems[ITEM] - 1 == WillKeepItem1)) {
  3435. BestValue = NextValue;
  3436. WillKeepItem2 = playerItems[ITEM] - 1;
  3437. WillKeepItem2Slot = ITEM;
  3438. if (playerItemsN[ITEM] > 2 - WillKeepAmt1 && !c.prayerActive[10]) {
  3439. WillKeepAmt2 = 3 - WillKeepAmt1;
  3440. } else if (playerItemsN[ITEM] > 3 - WillKeepAmt1 && c.prayerActive[10]) {
  3441. WillKeepAmt2 = 4 - WillKeepAmt1;
  3442. } else {
  3443. WillKeepAmt2 = playerItemsN[ITEM];
  3444. }
  3445. }
  3446. }
  3447. }
  3448. for (int EQUIP = 0; EQUIP < 14; EQUIP++) {
  3449. if (playerEquipment[EQUIP] > 0) {
  3450. c.getShops();
  3451. NextValue = (int) Math.floor(ShopAssistant.getItemShopValue(playerEquipment[EQUIP]));
  3452. if (NextValue > BestValue
  3453. && !(EQUIP + 28 == WillKeepItem1Slot && playerEquipment[EQUIP] == WillKeepItem1)) {
  3454. BestValue = NextValue;
  3455. WillKeepItem2 = playerEquipment[EQUIP];
  3456. WillKeepItem2Slot = EQUIP + 28;
  3457. if (playerEquipmentN[EQUIP] > 2 - WillKeepAmt1 && !c.prayerActive[10]) {
  3458. WillKeepAmt2 = 3 - WillKeepAmt1;
  3459. } else if (playerEquipmentN[EQUIP] > 3 - WillKeepAmt1 && c.prayerActive[10]) {
  3460. WillKeepAmt2 = 4 - WillKeepAmt1;
  3461. } else {
  3462. WillKeepAmt2 = playerEquipmentN[EQUIP];
  3463. }
  3464. }
  3465. }
  3466. }
  3467. if (!isSkulled && ItemsContained > 2
  3468. && (WillKeepAmt1 + WillKeepAmt2 < 3 || (c.prayerActive[10] && WillKeepAmt1 + WillKeepAmt2 < 4))) {
  3469. BestItem3(c, ItemsContained);
  3470. }
  3471. }
  3472.  
  3473. public void BestItem3(Player c, int ItemsContained) {
  3474. int BestValue = 0;
  3475. int NextValue = 0;
  3476. WillKeepItem3 = 0;
  3477. WillKeepItem3Slot = 0;
  3478. for (int ITEM = 0; ITEM < 28; ITEM++) {
  3479. if (playerItems[ITEM] > 0) {
  3480. c.getShops();
  3481. NextValue = (int) Math.floor(ShopAssistant.getItemShopValue(playerItems[ITEM] - 1));
  3482. if (NextValue > BestValue && !(ITEM == WillKeepItem1Slot && playerItems[ITEM] - 1 == WillKeepItem1)
  3483. && !(ITEM == WillKeepItem2Slot && playerItems[ITEM] - 1 == WillKeepItem2)) {
  3484. BestValue = NextValue;
  3485. WillKeepItem3 = playerItems[ITEM] - 1;
  3486. WillKeepItem3Slot = ITEM;
  3487. if (playerItemsN[ITEM] > 2 - (WillKeepAmt1 + WillKeepAmt2) && !c.prayerActive[10]) {
  3488. WillKeepAmt3 = 3 - (WillKeepAmt1 + WillKeepAmt2);
  3489. } else if (playerItemsN[ITEM] > 3 - (WillKeepAmt1 + WillKeepAmt2) && c.prayerActive[10]) {
  3490. WillKeepAmt3 = 4 - (WillKeepAmt1 + WillKeepAmt2);
  3491. } else {
  3492. WillKeepAmt3 = playerItemsN[ITEM];
  3493. }
  3494. }
  3495. }
  3496. }
  3497. for (int EQUIP = 0; EQUIP < 14; EQUIP++) {
  3498. if (playerEquipment[EQUIP] > 0) {
  3499. c.getShops();
  3500. NextValue = (int) Math.floor(ShopAssistant.getItemShopValue(playerEquipment[EQUIP]));
  3501. if (NextValue > BestValue
  3502. && !(EQUIP + 28 == WillKeepItem1Slot && playerEquipment[EQUIP] == WillKeepItem1)
  3503. && !(EQUIP + 28 == WillKeepItem2Slot && playerEquipment[EQUIP] == WillKeepItem2)) {
  3504. BestValue = NextValue;
  3505. WillKeepItem3 = playerEquipment[EQUIP];
  3506. WillKeepItem3Slot = EQUIP + 28;
  3507. if (playerEquipmentN[EQUIP] > 2 - (WillKeepAmt1 + WillKeepAmt2) && !c.prayerActive[10]) {
  3508. WillKeepAmt3 = 3 - (WillKeepAmt1 + WillKeepAmt2);
  3509. } else if (playerEquipmentN[EQUIP] > 3 - WillKeepAmt1 && c.prayerActive[10]) {
  3510. WillKeepAmt3 = 4 - (WillKeepAmt1 + WillKeepAmt2);
  3511. } else {
  3512. WillKeepAmt3 = playerEquipmentN[EQUIP];
  3513. }
  3514. }
  3515. }
  3516. }
  3517. if (!isSkulled && ItemsContained > 3 && c.prayerActive[10]
  3518. && ((WillKeepAmt1 + WillKeepAmt2 + WillKeepAmt3) < 4)) {
  3519. BestItem4(c);
  3520. }
  3521. }
  3522.  
  3523. public void BestItem4(Player c) {
  3524. int BestValue = 0;
  3525. int NextValue = 0;
  3526. WillKeepItem4 = 0;
  3527. WillKeepItem4Slot = 0;
  3528. for (int ITEM = 0; ITEM < 28; ITEM++) {
  3529. if (playerItems[ITEM] > 0) {
  3530. c.getShops();
  3531. NextValue = (int) Math.floor(ShopAssistant.getItemShopValue(playerItems[ITEM] - 1));
  3532. if (NextValue > BestValue && !(ITEM == WillKeepItem1Slot && playerItems[ITEM] - 1 == WillKeepItem1)
  3533. && !(ITEM == WillKeepItem2Slot && playerItems[ITEM] - 1 == WillKeepItem2)
  3534. && !(ITEM == WillKeepItem3Slot && playerItems[ITEM] - 1 == WillKeepItem3)) {
  3535. BestValue = NextValue;
  3536. WillKeepItem4 = playerItems[ITEM] - 1;
  3537. WillKeepItem4Slot = ITEM;
  3538. }
  3539. }
  3540. }
  3541. for (int EQUIP = 0; EQUIP < 14; EQUIP++) {
  3542. if (playerEquipment[EQUIP] > 0) {
  3543. c.getShops();
  3544. NextValue = (int) Math.floor(ShopAssistant.getItemShopValue(playerEquipment[EQUIP]));
  3545. if (NextValue > BestValue
  3546. && !(EQUIP + 28 == WillKeepItem1Slot && playerEquipment[EQUIP] == WillKeepItem1)
  3547. && !(EQUIP + 28 == WillKeepItem2Slot && playerEquipment[EQUIP] == WillKeepItem2)
  3548. && !(EQUIP + 28 == WillKeepItem3Slot && playerEquipment[EQUIP] == WillKeepItem3)) {
  3549. BestValue = NextValue;
  3550. WillKeepItem4 = playerEquipment[EQUIP];
  3551. WillKeepItem4Slot = EQUIP + 28;
  3552. }
  3553. }
  3554. }
  3555. }
  3556.  
  3557. public boolean isAutoButton(int button) {
  3558. for (int j = 0; j < autocastIds.length; j += 2) {
  3559. if (autocastIds[j] == button)
  3560. return true;
  3561. }
  3562. return false;
  3563. }
  3564.  
  3565. public void assignAutocast(int button) {
  3566. for (int j = 0; j < autocastIds.length; j++) {
  3567. if (autocastIds[j] == button) {
  3568. Player c = PlayerHandler.players[this.index];
  3569. autocasting = true;
  3570. autocastId = autocastIds[j + 1];
  3571. c.getPA().sendFrame36(108, 1);
  3572. // c.setSidebarInterface(0, 328);
  3573. // spellName = getSpellName(autocastId);
  3574. // spellName = spellName;
  3575. // c.getPA().sendFrame126(spellName, 354);
  3576. c = null;
  3577. break;
  3578. }
  3579. }
  3580. }
  3581.  
  3582. public int getLocalX() {
  3583. return getX() - 8 * getMapRegionX();
  3584. }
  3585.  
  3586. public int getLocalY() {
  3587. return getY() - 8 * getMapRegionY();
  3588. }
  3589.  
  3590. public String getSpellName(int id) {
  3591. switch (id) {
  3592. case 0:
  3593. return "Air Strike";
  3594. case 1:
  3595. return "Water Strike";
  3596. case 2:
  3597. return "Earth Strike";
  3598. case 3:
  3599. return "Fire Strike";
  3600. case 4:
  3601. return "Air Bolt";
  3602. case 5:
  3603. return "Water Bolt";
  3604. case 6:
  3605. return "Earth Bolt";
  3606. case 7:
  3607. return "Fire Bolt";
  3608. case 8:
  3609. return "Air Blast";
  3610. case 9:
  3611. return "Water Blast";
  3612. case 10:
  3613. return "Earth Blast";
  3614. case 11:
  3615. return "Fire Blast";
  3616. case 12:
  3617. return "Air Wave";
  3618. case 13:
  3619. return "Water Wave";
  3620. case 14:
  3621. return "Earth Wave";
  3622. case 15:
  3623. return "Fire Wave";
  3624. case 32:
  3625. return "Shadow Rush";
  3626. case 33:
  3627. return "Smoke Rush";
  3628. case 34:
  3629. return "Blood Rush";
  3630. case 35:
  3631. return "Ice Rush";
  3632. case 36:
  3633. return "Shadow Burst";
  3634. case 37:
  3635. return "Smoke Burst";
  3636. case 38:
  3637. return "Blood Burst";
  3638. case 39:
  3639. return "Ice Burst";
  3640. case 40:
  3641. return "Shadow Blitz";
  3642. case 41:
  3643. return "Smoke Blitz";
  3644. case 42:
  3645. return "Blood Blitz";
  3646. case 43:
  3647. return "Ice Blitz";
  3648. case 44:
  3649. return "Shadow Barrage";
  3650. case 45:
  3651. return "Smoke Barrage";
  3652. case 46:
  3653. return "Blood Barrage";
  3654. case 47:
  3655. return "Ice Barrage";
  3656. default:
  3657. return "Select Spell";
  3658. }
  3659. }
  3660.  
  3661. public boolean fullVoidRange() {
  3662. return playerEquipment[playerHat] == 11664 && playerEquipment[playerLegs] == 8840
  3663. && playerEquipment[playerChest] == 8839 && playerEquipment[playerHands] == 8842;
  3664. }
  3665.  
  3666. public boolean fullVoidElite() {
  3667. return playerEquipment[playerHat] == 13072 && playerEquipment[playerLegs] == 13073;
  3668. }
  3669.  
  3670. public boolean Ballista() {
  3671. return playerEquipment[playerWeapon] == 19481;
  3672. }
  3673. // public boolean isIronMan() {
  3674. // return equals(Rights.IRONMAN);
  3675. //}
  3676. public boolean fullVoidMage() {
  3677. return playerEquipment[playerHat] == 11663 && playerEquipment[playerLegs] == 8840
  3678. && playerEquipment[playerChest] == 8839 && playerEquipment[playerHands] == 8842;
  3679. }
  3680.  
  3681. public boolean fullVoidMelee() {
  3682. return playerEquipment[playerHat] == 11665 && playerEquipment[playerLegs] == 8840
  3683. && playerEquipment[playerChest] == 8839 && playerEquipment[playerHands] == 8842;
  3684. }
  3685.  
  3686. /**
  3687. * SouthWest, NorthEast, SouthWest, NorthEast
  3688. */
  3689. public boolean isInTut() {
  3690. if (absX >= 2625 && absX <= 2687 && absY >= 4670 && absY <= 4735) {
  3691. return true;
  3692. }
  3693. return false;
  3694. }
  3695.  
  3696. public boolean isInBarrows() {
  3697. if (absX > 3543 && absX < 3584 && absY > 3265 && absY < 3311) {
  3698. return true;
  3699. }
  3700. return false;
  3701. }
  3702.  
  3703. public boolean isInBarrows2() {
  3704. if (absX > 3529 && absX < 3581 && absY > 9673 && absY < 9722) {
  3705. return true;
  3706. }
  3707. return false;
  3708. }
  3709.  
  3710. public boolean inBarrows() {
  3711. if (absX > 3520 && absX < 3598 && absY > 9653 && absY < 9750) {
  3712. return true;
  3713. }
  3714. return false;
  3715. }
  3716.  
  3717. public boolean inArea(int x, int y, int x1, int y1) {
  3718. if (absX > x && absX < x1 && absY < y && absY > y1) {
  3719. return true;
  3720. }
  3721. return false;
  3722. }
  3723.  
  3724. public boolean Area(final int x1, final int x2, final int y1, final int y2) {
  3725. return (absX >= x1 && absX <= x2 && absY >= y1 && absY <= y2);
  3726. }
  3727.  
  3728. public boolean inBank() {
  3729. return Area(3090, 3099, 3487, 3500) || Area(3089, 3090, 3492, 3498) || Area(3248, 3258, 3413, 3428)
  3730. || Area(3179, 3191, 3432, 3448) || Area(2944, 2948, 3365, 3374) || Area(2942, 2948, 3367, 3374)
  3731. || Area(2944, 2950, 3365, 3370) || Area(3008, 3019, 3352, 3359) || Area(3017, 3022, 3352, 3357)
  3732. || Area(3203, 3213, 3200, 3237) || Area(3212, 3215, 3200, 3235) || Area(3215, 3220, 3202, 3235)
  3733. || Area(3220, 3227, 3202, 3229) || Area(3227, 3230, 3208, 3226) || Area(3226, 3228, 3230, 3211)
  3734. || Area(3227, 3229, 3208, 3226);
  3735. }
  3736.  
  3737. public boolean isInJail() {
  3738. if (absX >= 2065 && absX <= 2111 && absY >= 4415 && absY <= 4455) {
  3739. return true;
  3740. }
  3741. return false;
  3742. }
  3743.  
  3744. public boolean inCamWild() {
  3745. if (absX > 3231 && absX < 3300 && absY > 3180 && absY < 3300
  3746. || absX > 3120 && absX < 3300 && absY > 3236 && absY < 3300
  3747. || absX > 3227 && absX < 3300 && absY > 3225 && absY < 3300) {
  3748. return true;
  3749. }
  3750. return false;
  3751. }
  3752.  
  3753. public boolean inMining() {
  3754. if (absY > 9700 && absY < 10366) {
  3755. return true;
  3756. }
  3757. return false;
  3758. }
  3759.  
  3760. public boolean inWc() {
  3761. if (absY > 3346 && absY < 3530 && absX > 2600 && absX < 2730) {
  3762. return true;
  3763. }
  3764. return false;
  3765. }
  3766.  
  3767. public boolean inFarm() {
  3768. if (absY > 3446 && absY < 3480 && absX > 2802 && absX < 2820) {
  3769. return true;
  3770. }
  3771. return false;
  3772. }
  3773.  
  3774. public boolean inDz() {
  3775. if (absY > 9620 && absY < 9657 && absX > 3344 && absX < 3381) {
  3776. return true;
  3777. }
  3778. return false;
  3779. }
  3780.  
  3781. public boolean inFm() {
  3782. if (absX > 2333 && absX < 2355 && absY > 3663 && absY < 3702) {
  3783. return true;
  3784. }
  3785. return false;
  3786. }
  3787.  
  3788. /*
  3789. * public boolean inWild() { // MY VERSION//3518 if (absX > 2941 && absX <
  3790. * 3392 && absY > 3524 && absY < 3966 || absX > 2941 && absX < 3392 && absY
  3791. * > 9918 && absY < 10366) { return true; } return false; }
  3792. */
  3793.  
  3794. // public boolean inPvP() { // MY VERSION//3518
  3795. // return !inSafeZone();
  3796. // }
  3797.  
  3798. public boolean inWild() { // MY VERSION//3518
  3799. if (absX > 2941 && absX < 3392 && absY > 3524 && absY < 3966
  3800. || absX > 2941 && absX < 3392 && absY > 9918 && absY < 10366) {
  3801. return true;
  3802. }
  3803. return false;
  3804. }
  3805.  
  3806. public boolean inPvP() {
  3807. return inGEPvP2() || inGEPvP3() || inGEPvP4() || inGEPvP5() || inGEPvP6() || inGEPvP7() || inGEPvP9()
  3808. || inGEPvP10() || inGEPvP11() || inGEPvP12() || inGEPvP13() || inGEPvP14() || inGEPvP15() || inGEPvP16()
  3809. || inGEPvP17() || inGEPvP18() || inGEPvP19() || inGEPvP20() || inGEPvP21() || inGEPvP22() || inGEPvP23()
  3810. || inGEPvP24() || inGEPvP25() || inGEPvP26() || inGEPvP27() || inGEPvP28() || inGEPvP29() || inGEPvP30()
  3811. || inGEPvP31() || inGEPvP32() || inGEPvP33() || inGEPvP34() || inGEPvP35() || inGEPvP36() || inGEPvP37()
  3812. || inGEPvP38() || inGEPvP39() || inGEPvP40() || inGEPvP41() || inGEPvP42() || inGEPvP43() || inGEPvP44()
  3813. || inGEPvP45() || inGEPvP46() || inGEPvP47() || inGEPvP48() || inGEPvP49() || inGEPvP50() || inGEPvP51()
  3814. || inGEPvP52() || inGEPvP53() || inGEPvP54() || inGEPvP55() || inGEPvP56() || inGEPvP57() || inGEPvP58()
  3815. || inGEPvP59() || inGEPvP60() || inGEPvP61() || inGEPvP62() || inGEPvP63() || inGEPvP64() || inGEPvP65()
  3816. || inGEPvP66() || inGEPvP67() || inGEPvP68() || inGEPvP69() || inGEPvP70() || inGEPvP71() || inGEPvP72()
  3817. || inGEPvP73() || inGEPvP74() || inGEPvP75() || inGEPvP76() || inGEPvP77() || inGEPvP78() || inGEPvP79()
  3818. || inGEPvP80() || inGEPvP81() || inGEPvP82() || inGEPvP83() || inGEPvP84() || inGEPvP85() || inGEPvP86()
  3819. || inGEPvP87() || inGEPvP88() || inGEPvP89() || inGEPvP90() || inGEPvP91();
  3820. }
  3821.  
  3822. public boolean inSafeZone() {
  3823. return inGE001() || inGE002() || inGE003() || inGE004() || inGE005() || inGE006() || inGE007() || inGEcentral()
  3824. || inGE2() || inGE008() || inGE009() || inGE010() || inGE011() || inGE012() || inGE013() || inGE014()
  3825. || inGE015() || inGE016() || inGE017() || inGE018() || inGE019() || inGE020() || inGE021() || inGE022()
  3826. || inGE023() || inGE024() || inGE025() || inGE026() || inGE027() || inGE028() || inGE029() || inGE030()
  3827. || inGE031();
  3828. }
  3829.  
  3830. public boolean inGEPvP1() {
  3831. return absX >= 3144 && absX <= 3186 && absY >= 3468 && absY <= 3513;
  3832. }
  3833.  
  3834. public boolean inGEPvP2() {
  3835. return absX >= 3186 && absX <= 3189 && absY >= 3476 && absY <= 3516;
  3836. }
  3837.  
  3838. public boolean inGEPvP3() {
  3839. return absX >= 3139 && absX <= 3142 && absY >= 3473 && absY <= 3482;
  3840. }
  3841.  
  3842. public boolean inGEPvP4() {
  3843. return absX >= 3139 && absX <= 3142 && absY >= 3495 && absY <= 3512;
  3844. }
  3845.  
  3846. public boolean inGEPvP5() {
  3847. return absX >= 3143 && absX <= 3157 && absY >= 3514 && absY <= 3516;
  3848. }
  3849.  
  3850. public boolean inGEPvP6() {
  3851. return absX >= 3171 && absX <= 3188 && absY >= 3514 && absY <= 3516;
  3852. }
  3853.  
  3854. public boolean inGEPvP7() {
  3855. return absX >= 3186 && absX <= 3189 && absY >= 3479 && absY <= 3515;
  3856. }
  3857.  
  3858. public boolean inGEPvP9() {
  3859. return absX >= 3144 && absX <= 3147 && absY >= 3468 && absY <= 3516;
  3860. }
  3861.  
  3862. public boolean inGEPvP10() {
  3863. return absX >= 3139 && absX <= 3187 && absY >= 3507 && absY <= 3513;
  3864. }
  3865.  
  3866. public boolean inGEPvP11() {
  3867. return absX >= 3182 && absX <= 3187 && absY >= 3468 && absY <= 3514;
  3868. }
  3869.  
  3870. public boolean inGEPvP12() {
  3871. return absX >= 3182 && absX <= 3186 && absY >= 3468 && absY <= 3472;
  3872. }
  3873.  
  3874. public boolean inGEPvP13() {
  3875. return absX >= 3146 && absX <= 3185 && absY >= 3468 && absY <= 3472;
  3876. }
  3877.  
  3878. public boolean inGEPvP14() {
  3879. return absX >= 3170 && absX <= 3184 && absY >= 3473 && absY <= 3473;
  3880. }
  3881.  
  3882. public boolean inGEPvP15() {
  3883. return absX >= 3172 && absX <= 3184 && absY >= 3474 && absY <= 3474;
  3884. }
  3885.  
  3886. public boolean inGEPvP16() {
  3887. return absX >= 3174 && absX <= 3184 && absY >= 3475 && absY <= 3475;
  3888. }
  3889.  
  3890. public boolean inGEPvP17() {
  3891. return absX >= 3176 && absX <= 3184 && absY >= 3476 && absY <= 3476;
  3892. }
  3893.  
  3894. public boolean inGEPvP18() {
  3895. return absX >= 3177 && absX <= 3184 && absY >= 3477 && absY <= 3477;
  3896. }
  3897.  
  3898. public boolean inGEPvP19() {
  3899. return absX >= 3178 && absX <= 3184 && absY >= 3478 && absY <= 3478;
  3900. }
  3901.  
  3902. public boolean inGEPvP20() {
  3903. return absX >= 3179 && absX <= 3184 && absY >= 3479 && absY <= 3479;
  3904. }
  3905.  
  3906. public boolean inGEPvP21() {
  3907. return absX >= 3179 && absX <= 3184 && absY >= 3480 && absY <= 3480;
  3908. }
  3909.  
  3910. public boolean inGEPvP22() {
  3911. return absX >= 3180 && absX <= 3184 && absY >= 3481 && absY <= 3481;
  3912. }
  3913.  
  3914. public boolean inGEPvP23() {
  3915. return absX >= 3180 && absX <= 3184 && absY >= 3482 && absY <= 3482;
  3916. }
  3917.  
  3918. public boolean inGEPvP24() {
  3919. return absX >= 3180 && absX <= 3184 && absY >= 3482 && absY <= 3482;
  3920. }
  3921.  
  3922. public boolean inGEPvP25() {
  3923. return absX >= 3181 && absX <= 3184 && absY >= 3483 && absY <= 3483;
  3924. }
  3925.  
  3926. public boolean inGEPvP26() {
  3927. return absX >= 3181 && absX <= 3184 && absY >= 3484 && absY <= 3484;
  3928. }
  3929.  
  3930. public boolean inGEPvP27() {
  3931. return absX >= 3181 && absX <= 3184 && absY >= 3495 && absY <= 3495;
  3932. }
  3933.  
  3934. public boolean inGEPvP28() {
  3935. return absX >= 3181 && absX <= 3184 && absY >= 3496 && absY <= 3496;
  3936. }
  3937.  
  3938. public boolean inGEPvP29() {
  3939. return absX >= 3180 && absX <= 3184 && absY >= 3497 && absY <= 3497;
  3940. }
  3941.  
  3942. public boolean inGEPvP30() {
  3943. return absX >= 3180 && absX <= 3184 && absY >= 3498 && absY <= 3498;
  3944. }
  3945.  
  3946. public boolean inGEPvP31() {
  3947. return absX >= 3179 && absX <= 3184 && absY >= 3499 && absY <= 3499;
  3948. }
  3949.  
  3950. public boolean inGEPvP32() {
  3951. return absX >= 3179 && absX <= 3184 && absY >= 3500 && absY <= 3500;
  3952. }
  3953.  
  3954. public boolean inGEPvP33() {
  3955. return absX >= 3178 && absX <= 3184 && absY >= 3501 && absY <= 3501;
  3956. }
  3957.  
  3958. public boolean inGEPvP34() {
  3959. return absX >= 3177 && absX <= 3184 && absY >= 3502 && absY <= 3502;
  3960. }
  3961.  
  3962. public boolean inGEPvP35() {
  3963. return absX >= 3176 && absX <= 3184 && absY >= 3503 && absY <= 3503;
  3964. }
  3965.  
  3966. public boolean inGEPvP36() {
  3967. return absX >= 3174 && absX <= 3184 && absY >= 3504 && absY <= 3504;
  3968. }
  3969.  
  3970. public boolean inGEPvP37() {
  3971. return absX >= 3173 && absX <= 3184 && absY >= 3505 && absY <= 3505;
  3972. }
  3973.  
  3974. public boolean inGEPvP38() {
  3975. return absX >= 3172 && absX <= 3184 && absY >= 3505 && absY <= 3505;
  3976. }
  3977.  
  3978. public boolean inGEPvP39() {
  3979. return absX >= 3170 && absX <= 3184 && absY >= 3506 && absY <= 3506;
  3980. }
  3981.  
  3982. public boolean inGEPvP40() {
  3983. return absX >= 3147 && absX <= 3159 && absY >= 3506 && absY <= 3506;
  3984. }
  3985.  
  3986. public boolean inGEPvP41() {
  3987. return absX >= 3147 && absX <= 3157 && absY >= 3505 && absY <= 3505;
  3988. }
  3989.  
  3990. public boolean inGEPvP42() {
  3991. return absX >= 3147 && absX <= 3155 && absY >= 3504 && absY <= 3504;
  3992. }
  3993.  
  3994. public boolean inGEPvP43() {
  3995. return absX >= 3147 && absX <= 3153 && absY >= 3503 && absY <= 3503;
  3996. }
  3997.  
  3998. public boolean inGEPvP44() {
  3999. return absX >= 3147 && absX <= 3152 && absY >= 3502 && absY <= 3502;
  4000. }
  4001.  
  4002. public boolean inGEPvP45() {
  4003. return absX >= 3147 && absX <= 3151 && absY >= 3501 && absY <= 3501;
  4004. }
  4005.  
  4006. public boolean inGEPvP46() {
  4007. return absX >= 3147 && absX <= 3150 && absY >= 3500 && absY <= 3500;
  4008. }
  4009.  
  4010. public boolean inGEPvP47() {
  4011. return absX >= 3147 && absX <= 3150 && absY >= 3499 && absY <= 3499;
  4012. }
  4013.  
  4014. public boolean inGEPvP48() {
  4015. return absX >= 3147 && absX <= 3149 && absY >= 3498 && absY <= 3498;
  4016. }
  4017.  
  4018. public boolean inGEPvP49() {
  4019. return absX >= 3147 && absX <= 3149 && absY >= 3497 && absY <= 3497;
  4020. }
  4021.  
  4022. public boolean inGEPvP50() {
  4023. return absX >= 3147 && absX <= 3148 && absY >= 3496 && absY <= 3496;
  4024. }
  4025.  
  4026. public boolean inGEPvP51() {
  4027. return absX >= 3147 && absX <= 3148 && absY >= 3495 && absY <= 3495;
  4028. }
  4029.  
  4030. public boolean inGEPvP52() {
  4031. return absX >= 3147 && absX <= 3148 && absY >= 3484 && absY <= 3484;
  4032. }
  4033.  
  4034. public boolean inGEPvP53() {
  4035. return absX >= 3147 && absX <= 3148 && absY >= 3483 && absY <= 3483;
  4036. }
  4037.  
  4038. public boolean inGEPvP54() {
  4039. return absX >= 3147 && absX <= 3149 && absY >= 3482 && absY <= 3482;
  4040. }
  4041.  
  4042. public boolean inGEPvP55() {
  4043. return absX >= 3147 && absX <= 3149 && absY >= 3481 && absY <= 3481;
  4044. }
  4045.  
  4046. public boolean inGEPvP56() {
  4047. return absX >= 3147 && absX <= 3150 && absY >= 3480 && absY <= 3480;
  4048. }
  4049.  
  4050. public boolean inGEPvP57() {
  4051. return absX >= 3147 && absX <= 3150 && absY >= 3479 && absY <= 3479;
  4052. }
  4053.  
  4054. public boolean inGEPvP58() {
  4055. return absX >= 3147 && absX <= 3151 && absY >= 3478 && absY <= 3478;
  4056. }
  4057.  
  4058. public boolean inGEPvP59() {
  4059. return absX >= 3147 && absX <= 3152 && absY >= 3477 && absY <= 3477;
  4060. }
  4061.  
  4062. public boolean inGEPvP60() {
  4063. return absX >= 3147 && absX <= 3153 && absY >= 3476 && absY <= 3476;
  4064. }
  4065.  
  4066. public boolean inGEPvP61() {
  4067. return absX >= 3147 && absX <= 3155 && absY >= 3475 && absY <= 3475;
  4068. }
  4069.  
  4070. public boolean inGEPvP62() {
  4071. return absX >= 3147 && absX <= 3157 && absY >= 3474 && absY <= 3474;
  4072. }
  4073.  
  4074. public boolean inGEPvP63() {
  4075. return absX >= 3147 && absX <= 3159 && absY >= 3473 && absY <= 3473;
  4076. }
  4077.  
  4078. public boolean inGEPvP64() {
  4079. return absX >= 3140 && absX <= 3144 && absY >= 3472 && absY <= 3472;
  4080. }
  4081.  
  4082. public boolean inGEPvP65() {
  4083. return absX >= 3141 && absX <= 3144 && absY >= 3471 && absY <= 3471;
  4084. }
  4085.  
  4086. public boolean inGEPvP66() {
  4087. return absX >= 3142 && absX <= 3144 && absY >= 3470 && absY <= 3470;
  4088. }
  4089.  
  4090. public boolean inGEPvP67() {
  4091. return absX >= 3143 && absX <= 3144 && absY >= 3469 && absY <= 3469;
  4092. }
  4093.  
  4094. public boolean inGEPvP68() {
  4095. return absX >= 3143 && absX <= 3143 && absY >= 3469 && absY <= 3516;
  4096. }
  4097.  
  4098. public boolean inGEPvP69() {
  4099. return absX >= 3141 && absX <= 3143 && absY >= 3514 && absY <= 3514;
  4100. }
  4101.  
  4102. public boolean inGEPvP70() {
  4103. return absX >= 3142 && absX <= 3143 && absY >= 3515 && absY <= 3515;
  4104. }
  4105.  
  4106. public boolean inGEPvP71() {
  4107. return absX >= 3158 && absX <= 3157 && absY >= 3515 && absY <= 3515;
  4108. }
  4109.  
  4110. public boolean inGEPvP72() {
  4111. return absX >= 3159 && absX <= 3157 && absY >= 3514 && absY <= 3514;
  4112. }
  4113.  
  4114. public boolean inGEPvP73() {
  4115. return absX >= 3169 && absX <= 3171 && absY >= 3514 && absY <= 3514;
  4116. }
  4117.  
  4118. public boolean inGEPvP74() {
  4119. return absX >= 3170 && absX <= 3171 && absY >= 3515 && absY <= 3515;
  4120. }
  4121.  
  4122. public boolean inGEPvP75() {
  4123. return absX >= 3188 && absX <= 3190 && absY >= 3514 && absY <= 3514;
  4124. }
  4125.  
  4126. public boolean inGEPvP76() {
  4127. return absX >= 3188 && absX <= 3191 && absY >= 3513 && absY <= 3513;
  4128. }
  4129.  
  4130. public boolean inGEPvP77() {
  4131. return absX >= 3188 && absX <= 3192 && absY >= 3512 && absY <= 3512;
  4132. }
  4133.  
  4134. public boolean inGEPvP78() {
  4135. return absX >= 3188 && absX <= 3193 && absY >= 3511 && absY <= 3511;
  4136. }
  4137.  
  4138. public boolean inGEPvP79() {
  4139. return absX >= 3188 && absX <= 3194 && absY >= 3510 && absY <= 3510;
  4140. }
  4141.  
  4142. public boolean inGEPvP80() {
  4143. return absX >= 3188 && absX <= 3195 && absY >= 3509 && absY <= 3509;
  4144. }
  4145.  
  4146. public boolean inGEPvP81() {
  4147. return absX >= 3188 && absX <= 3196 && absY >= 3508 && absY <= 3508;
  4148. }
  4149.  
  4150. public boolean inGEPvP82() {
  4151. return absX >= 3188 && absX <= 3196 && absY >= 3507 && absY <= 3507;
  4152. }
  4153.  
  4154. public boolean inGEPvP83() {
  4155. return absX >= 3188 && absX <= 3197 && absY >= 3506 && absY <= 3506;
  4156. }
  4157.  
  4158. public boolean inGEPvP84() {
  4159. return absX >= 3188 && absX <= 3196 && absY >= 3505 && absY <= 3505;
  4160. }
  4161.  
  4162. public boolean inGEPvP85() {
  4163. return absX >= 3188 && absX <= 3195 && absY >= 3504 && absY <= 3504;
  4164. }
  4165.  
  4166. public boolean inGEPvP86() {
  4167. return absX >= 3188 && absX <= 3194 && absY >= 3503 && absY <= 3503;
  4168. }
  4169.  
  4170. public boolean inGEPvP87() {
  4171. return absX >= 3188 && absX <= 3194 && absY >= 3502 && absY <= 3502;
  4172. }
  4173.  
  4174. public boolean inGEPvP88() {
  4175. return absX >= 3188 && absX <= 3193 && absY >= 3501 && absY <= 3501;
  4176. }
  4177.  
  4178. public boolean inGEPvP89() {
  4179. return absX >= 3188 && absX <= 3192 && absY >= 3500 && absY <= 3500;
  4180. }
  4181.  
  4182. public boolean inGEPvP90() {
  4183. return absX >= 3188 && absX <= 3191 && absY >= 3499 && absY <= 3499;
  4184. }
  4185.  
  4186. public boolean inGEPvP91() {
  4187. return absX >= 3188 && absX <= 3190 && absY >= 3498 && absY <= 3498;
  4188. }
  4189.  
  4190. public boolean inGE001() {
  4191. return absX >= 3160 && absX <= 3169 && absY >= 3506 && absY <= 3506;
  4192. }
  4193.  
  4194. public boolean inGE002() {
  4195. return absX >= 3159 && absX <= 3170 && absY >= 3505 && absY <= 3505;
  4196. }
  4197.  
  4198. public boolean inGE003() {
  4199. return absX >= 3158 && absX <= 3171 && absY >= 3505 && absY <= 3505;
  4200. }
  4201.  
  4202. public boolean inGE004() {
  4203. return absX >= 3156 && absX <= 3173 && absY >= 3504 && absY <= 3504;
  4204. }
  4205.  
  4206. public boolean inGE005() {
  4207. return absX >= 3155 && absX <= 3174 && absY >= 3503 && absY <= 3503;
  4208. }
  4209.  
  4210. public boolean inGE006() {
  4211. return absX >= 3154 && absX <= 3175 && absY >= 3503 && absY <= 3503;
  4212. }
  4213.  
  4214. public boolean inGE007() {
  4215. return absX >= 3153 && absX <= 3176 && absY >= 3502 && absY <= 3502;
  4216. }
  4217.  
  4218. public boolean inGE008() {
  4219. return absX >= 3152 && absX <= 3177 && absY >= 3501 && absY <= 3501;
  4220. }
  4221.  
  4222. public boolean inGE009() {
  4223. return absX >= 3151 && absX <= 3178 && absY >= 3500 && absY <= 3500;
  4224. }
  4225.  
  4226. public boolean inGE010() {
  4227. return absX >= 3151 && absX <= 3178 && absY >= 3499 && absY <= 3499;
  4228. }
  4229.  
  4230. public boolean inGE011() {
  4231. return absX >= 3150 && absX <= 3179 && absY >= 3498 && absY <= 3498;
  4232. }
  4233.  
  4234. public boolean inGE012() {
  4235. return absX >= 3150 && absX <= 3179 && absY >= 3497 && absY <= 3497;
  4236. }
  4237.  
  4238. public boolean inGE013() {
  4239. return absX >= 3149 && absX <= 3180 && absY >= 3496 && absY <= 3496;
  4240. }
  4241.  
  4242. public boolean inGE014() {
  4243. return absX >= 3149 && absX <= 3180 && absY >= 3495 && absY <= 3495;
  4244. }
  4245.  
  4246. public boolean inGE015() {
  4247. return absX >= 3148 && absX <= 3181 && absY >= 3494 && absY <= 3494;
  4248. }
  4249.  
  4250. public boolean inGE016() {
  4251. return absX >= 3148 && absX <= 3181 && absY >= 3485 && absY <= 3485;
  4252. }
  4253.  
  4254. public boolean inGE017() {
  4255. return absX >= 3149 && absX <= 3180 && absY >= 3484 && absY <= 3484;
  4256. }
  4257.  
  4258. public boolean inGE018() {
  4259. return absX >= 3149 && absX <= 3180 && absY >= 3483 && absY <= 3483;
  4260. }
  4261.  
  4262. public boolean inGE019() {
  4263. return absX >= 3150 && absX <= 3179 && absY >= 3482 && absY <= 3482;
  4264. }
  4265.  
  4266. public boolean inGE020() {
  4267. return absX >= 3150 && absX <= 3179 && absY >= 3481 && absY <= 3481;
  4268. }
  4269.  
  4270. public boolean inGE021() {
  4271. return absX >= 3151 && absX <= 3178 && absY >= 3480 && absY <= 3480;
  4272. }
  4273.  
  4274. public boolean inGE022() {
  4275. return absX >= 3151 && absX <= 3178 && absY >= 3479 && absY <= 3479;
  4276. }
  4277.  
  4278. public boolean inGE023() {
  4279. return absX >= 3152 && absX <= 3177 && absY >= 3478 && absY <= 3478;
  4280. }
  4281.  
  4282. public boolean inGE024() {
  4283. return absX >= 3153 && absX <= 3176 && absY >= 3477 && absY <= 3477;
  4284. }
  4285.  
  4286. public boolean inGE025() {
  4287. return absX >= 3154 && absX <= 3175 && absY >= 3476 && absY <= 3476;
  4288. }
  4289.  
  4290. public boolean inGE026() {
  4291. return absX >= 3155 && absX <= 3174 && absY >= 3476 && absY <= 3476;
  4292. }
  4293.  
  4294. public boolean inGE027() {
  4295. return absX >= 3156 && absX <= 3173 && absY >= 3475 && absY <= 3475;
  4296. }
  4297.  
  4298. public boolean inGE028() {
  4299. return absX >= 3157 && absX <= 3172 && absY >= 3475 && absY <= 3475;
  4300. }
  4301.  
  4302. public boolean inGE029() {
  4303. return absX >= 3158 && absX <= 3171 && absY >= 3474 && absY <= 3474;
  4304. }
  4305.  
  4306. public boolean inGE030() {
  4307. return absX >= 3159 && absX <= 3170 && absY >= 3474 && absY <= 3474;
  4308. }
  4309.  
  4310. public boolean inGE031() {
  4311. return absX >= 3160 && absX <= 3169 && absY >= 3473 && absY <= 3473;
  4312. }
  4313.  
  4314. /*
  4315. * public boolean inSafeZone() { return inEdgeBank() || inEdgeGS() ||
  4316. * inEdgeFurnace() || inEdgeBuilding1() || inEdgeBuilding2() ||
  4317. * inEdgeBuilding3() || inEdgeBuilding4() || inGEcentral() || inGE2() ||
  4318. * inVarrockWest() || inVarrockEast() || inLumSafezone() || inDraynorBank()
  4319. * || inSeersBank1() || inSeersBank2() || inYanilleBank() ||
  4320. * inSkillingZone1() || inSkillingZone2() || inSkillingZoneBuilding1() ||
  4321. * inSkillingZoneBuilding2() || inSkillingZoneBuilding3() || inFallyEast1()
  4322. * || inFallyEast2() || inFallyWest() || inFallyWest2() || inShayzienBank()
  4323. * || inPiscBank() || inHosBank() || inCharBurnersBank() || inArma() ||
  4324. * inZammy() || inSara() || inBandos() || inDagKings(); }
  4325. */
  4326.  
  4327. // public boolean inSafeZone() {
  4328. // return inEdgeBank() || inEdgeGS();
  4329. // }
  4330.  
  4331. public boolean inEdgeBank() {
  4332. return absX >= 3091 && absX <= 3098 && absY >= 3488 && absY <= 3499;
  4333. }
  4334.  
  4335. public boolean inClanWars() {
  4336. if (Boundary.isIn(this, ClanWarsMap.getBoundaries())) {
  4337. return true;
  4338. }
  4339. return false;
  4340. }
  4341.  
  4342. public boolean inEdgeville() {
  4343. return (absX > 3040 && absX < 3200 && absY > 3460 && absY < 3519);
  4344. }
  4345.  
  4346. public boolean inEdgeGS() {
  4347. return absX >= 3076 && absX <= 3084 && absY >= 3507 && absY <= 3513;
  4348. }
  4349.  
  4350. public boolean inEdgeFurnace() {
  4351. return absX >= 3105 && absX <= 3110 && absY >= 3496 && absY <= 3501;
  4352. }
  4353.  
  4354. public boolean inEdgeBuilding1() {
  4355. return absX >= 3091 && absX <= 3100 && absY >= 3507 && absY <= 3513;
  4356. }
  4357.  
  4358. public boolean inEdgeBuilding2() {
  4359. return absX >= 3077 && absX <= 3081 && absY >= 3489 && absY <= 3496;
  4360. }
  4361.  
  4362. public boolean inEdgeBuilding3() {
  4363. return absX >= 3067 && absX <= 3071 && absY >= 3515 && absY <= 3519;
  4364. }
  4365.  
  4366. public boolean inEdgeBuilding4() {
  4367. return absX >= 3107 && absX <= 3111 && absY >= 3511 && absY <= 3517;
  4368. }
  4369.  
  4370. public boolean inGEcentral() {
  4371. return absX >= 3148 && absX <= 3181 && absY >= 3486 && absY <= 3493;
  4372. }
  4373.  
  4374. public boolean inGE2() {
  4375. return absX >= 3161 && absX <= 3168 && absY >= 3473 && absY <= 3506;
  4376. }
  4377.  
  4378. public boolean inVarrockWest() {
  4379. return absX >= 3180 && absX <= 3190 && absY >= 3433 && absY <= 3447;
  4380. }
  4381.  
  4382. public boolean inVarrockEast() {
  4383. return absX >= 3250 && absX <= 3257 && absY >= 3416 && absY <= 3423;
  4384. }
  4385.  
  4386. public boolean inLumSafezone() {
  4387. return absX >= 3201 && absX <= 3226 && absY >= 3204 && absY <= 3228;
  4388. }
  4389.  
  4390. public boolean inDraynorBank() {
  4391. return absX >= 3088 && absX <= 3097 && absY >= 3240 && absY <= 3246;
  4392. }
  4393.  
  4394. public boolean inSeersBank1() {
  4395. return absX >= 2724 && absX <= 2727 && absY >= 3487 && absY <= 3489;
  4396. }
  4397.  
  4398. public boolean inSeersBank2() {
  4399. return absX >= 2721 && absX <= 2730 && absY >= 3490 && absY <= 3493;
  4400. }
  4401.  
  4402. public boolean inYanilleBank() {
  4403. return absX >= 2609 && absX <= 2613 && absY >= 3088 && absY <= 3097;
  4404. }
  4405.  
  4406. public boolean inSkillingZone1() {
  4407. return absX >= 2983 && absX <= 3001 && absY >= 3380 && absY <= 3391;
  4408. }
  4409.  
  4410. public boolean inSkillingZone2() {
  4411. return absX >= 3002 && absX <= 3010 && absY >= 3369 && absY <= 3390;
  4412. }
  4413.  
  4414. public boolean inSkillingZoneBuilding1() {
  4415. return absX >= 3026 && absX <= 3031 && absY >= 3375 && absY <= 3377;
  4416. }
  4417.  
  4418. public boolean inSkillingZoneBuilding2() {
  4419. return absX >= 3027 && absX <= 3029 && absY >= 3378 && absY <= 3380;
  4420. }
  4421.  
  4422. public boolean inSkillingZoneBuilding3() {
  4423. return absX >= 3026 && absX <= 3031 && absY >= 3381 && absY <= 3383;
  4424. }
  4425.  
  4426. public boolean inFallyEast1() {
  4427. return absX >= 2943 && absX <= 2949 && absY >= 3368 && absY <= 3369;
  4428. }
  4429.  
  4430. public boolean inFallyEast2() {
  4431. return absX >= 2943 && absX <= 2947 && absY >= 3370 && absY <= 3373;
  4432. }
  4433.  
  4434. public boolean inFallyWest() {
  4435. return absX >= 3009 && absX <= 3021 && absY >= 3353 && absY <= 3356;
  4436. }
  4437.  
  4438. public boolean inFallyWest2() {
  4439. return absX >= 3009 && absX <= 3018 && absY >= 3357 && absY <= 3358;
  4440. }
  4441.  
  4442. public boolean inShayzienBank() {
  4443. return absX >= 1496 && absX <= 1513 && absY >= 3613 && absY <= 3621;
  4444. }
  4445.  
  4446. public boolean inPiscBank() {
  4447. return absX >= 1794 && absX <= 1811 && absY >= 3784 && absY <= 3793;
  4448. }
  4449.  
  4450. public boolean inHosBank() {
  4451. return absX >= 1672 && absX <= 1680 && absY >= 3559 && absY <= 3575;
  4452. }
  4453.  
  4454. public boolean inCharBurnersBank() {
  4455. return absX >= 1712 && absX <= 1722 && absY >= 3458 && absY <= 3472;
  4456. }
  4457.  
  4458. public boolean inArma() {
  4459. return absX >= 2824 && absX <= 2842 && absY >= 5296 && absY <= 5308;
  4460. }
  4461.  
  4462. public boolean inBandos() {
  4463. return absX >= 2864 && absX <= 2876 && absY >= 5351 && absY <= 5369;
  4464. }
  4465.  
  4466. public boolean inZammy() {
  4467. return absX >= 2918 && absX <= 2936 && absY >= 5318 && absY <= 5331;
  4468. }
  4469.  
  4470. public boolean inSara() {
  4471. return absX >= 2889 && absX <= 2907 && absY >= 5258 && absY <= 5275;
  4472. }
  4473.  
  4474. public boolean inDagKings() {
  4475. return absX >= 2890 && absX <= 2934 && absY >= 4425 && absY <= 4470;
  4476. }
  4477.  
  4478. public boolean inDice() {
  4479. if (absX > 3089 && absX < 3098 && absY > 3473 && absY < 3484) {
  4480. return true;
  4481. }
  4482. return false;
  4483. }
  4484.  
  4485. public boolean arenas() {
  4486. if (absX > 3331 && absX < 3391 && absY > 3242 && absY < 3260) {
  4487. return true;
  4488. }
  4489. return false;
  4490. }
  4491.  
  4492. public boolean inDuelArena() {
  4493. if ((absX > 3322 && absX < 3394 && absY > 3195 && absY < 3291)
  4494. || (absX > 3311 && absX < 3323 && absY > 3223 && absY < 3248)) {
  4495. return true;
  4496. }
  4497. return false;
  4498. }
  4499.  
  4500. public boolean inMulti() {
  4501. if (Boundary.isIn(this, Cerberus.WEST)) {
  4502. return true;
  4503. }
  4504. if (Boundary.isIn(this, Cerberus.NORTH)) {
  4505. return true;
  4506. }
  4507. if (Boundary.isIn(this, Cerberus.EAST)) {
  4508. return true;
  4509. }
  4510. if (Boundary.isIn(this, Zulrah.BOUNDARY)) {
  4511. return true;
  4512. }
  4513. if (Boundary.isIn(this, Kraken.BOUNDARY)) {
  4514. return true;
  4515. }
  4516. if (Boundary.isIn(this, BOUNDARY_CORP)) {
  4517. return true;
  4518. }
  4519. if ((absX >= 3136 && absX <= 3327 && absY >= 3519 && absY <= 3607)
  4520. || (absX >= 3190 && absX <= 3327 && absY >= 3648 && absY <= 3839)
  4521. || (absX >= 3200 && absX <= 3390 && absY >= 3840 && absY <= 3967)
  4522. || (absX >= 2992 && absX <= 3007 && absY >= 3912 && absY <= 3967)
  4523. || (absX >= 2946 && absX <= 2959 && absY >= 3816 && absY <= 3831)
  4524. || (absX >= 3008 && absX <= 3199 && absY >= 3856 && absY <= 3903)
  4525. || (absX >= 2824 && absX <= 2944 && absY >= 5258 && absY <= 5369)
  4526. || (absX >= 3008 && absX <= 3071 && absY >= 3600 && absY <= 3711)
  4527. || (absX >= 3072 && absX <= 3327 && absY >= 3608 && absY <= 3647)
  4528. || (absX >= 2624 && absX <= 2690 && absY >= 2550 && absY <= 2619)
  4529. || (absX >= 2371 && absX <= 2422 && absY >= 5062 && absY <= 5117)
  4530. || (absX >= 2896 && absX <= 2927 && absY >= 3595 && absY <= 3630)
  4531. || (absX >= 2892 && absX <= 2932 && absY >= 4435 && absY <= 4464)
  4532. || (absX >= 2256 && absX <= 2287 && absY >= 4680 && absY <= 4711)
  4533. || (absX >= 2962 && absX <= 3006 && absY >= 3621 && absY <= 3659)
  4534. || (absX >= 3155 && absX <= 3214 && absY >= 3755 && absY <= 3803)) {
  4535. return true;
  4536. }
  4537. return false;
  4538. }
  4539.  
  4540. public boolean inFightCaves() {
  4541. return absX >= 2360 && absX <= 2445 && absY >= 5045 && absY <= 5125;
  4542. }
  4543.  
  4544. public boolean inPirateHouse() {
  4545. return absX >= 3038 && absX <= 3044 && absY >= 3949 && absY <= 3959;
  4546. }
  4547.  
  4548. public boolean checkFullGear(Player c) {
  4549. if (c.playerEquipment[0] >= 0 && c.playerEquipment[1] >= 0 && c.playerEquipment[2] >= 0
  4550. && c.playerEquipment[3] >= 0 && c.playerEquipment[4] >= 0 && c.playerEquipment[5] >= 0
  4551. && c.playerEquipment[7] >= 0 && c.playerEquipment[9] >= 0 && c.playerEquipment[10] >= 0
  4552. && c.playerEquipment[12] >= 0) {
  4553. return true;
  4554. }
  4555. return false;
  4556. }
  4557.  
  4558. public void updateshop(int i) {
  4559. Player p = PlayerHandler.players[index];
  4560. p.getShops().resetShop(i);
  4561. }
  4562.  
  4563. public void println_debug(String str) {
  4564. System.out.println("[player-" + index + "]: " + str);
  4565. }
  4566.  
  4567. public void println(String str) {
  4568. System.out.println("[player-" + index + "]: " + str);
  4569. }
  4570.  
  4571. public boolean WithinDistance(int objectX, int objectY, int playerX, int playerY, int distance) {
  4572. for (int i = 0; i <= distance; i++) {
  4573. for (int j = 0; j <= distance; j++) {
  4574. if ((objectX + i) == playerX
  4575. && ((objectY + j) == playerY || (objectY - j) == playerY || objectY == playerY)) {
  4576. return true;
  4577. } else if ((objectX - i) == playerX
  4578. && ((objectY + j) == playerY || (objectY - j) == playerY || objectY == playerY)) {
  4579. return true;
  4580. } else if (objectX == playerX
  4581. && ((objectY + j) == playerY || (objectY - j) == playerY || objectY == playerY)) {
  4582. return true;
  4583. }
  4584. }
  4585. }
  4586. return false;
  4587. }
  4588.  
  4589. public boolean withinDistance(Player otherPlr) {
  4590. if (heightLevel != otherPlr.heightLevel)
  4591. return false;
  4592. int deltaX = otherPlr.absX - absX, deltaY = otherPlr.absY - absY;
  4593. return deltaX <= 15 && deltaX >= -16 && deltaY <= 15 && deltaY >= -16;
  4594. }
  4595.  
  4596. public boolean withinDistance(NPC npc) {
  4597. if (heightLevel != npc.heightLevel)
  4598. return false;
  4599. if (npc.needRespawn == true)
  4600. return false;
  4601. int deltaX = npc.absX - absX, deltaY = npc.absY - absY;
  4602. return deltaX <= 15 && deltaX >= -16 && deltaY <= 15 && deltaY >= -16;
  4603. }
  4604.  
  4605. public boolean withinDistance(int absX, int getY, int getHeightLevel) {
  4606. if (this.getHeightLevel() != getHeightLevel)
  4607. return false;
  4608. int deltaX = this.getX() - absX, deltaY = this.getY() - getY;
  4609. return deltaX <= 15 && deltaX >= -16 && deltaY <= 15 && deltaY >= -16;
  4610. }
  4611.  
  4612. public int getHeightLevel() {
  4613. return getHeightLevel;
  4614. }
  4615.  
  4616. public int distanceToPoint(int pointX, int pointY) {
  4617. return (int) Math.sqrt(Math.pow(absX - pointX, 2) + Math.pow(absY - pointY, 2));
  4618. }
  4619.  
  4620. public void resetWalkingQueue() {
  4621. wQueueReadPtr = wQueueWritePtr = 0;
  4622.  
  4623. for (int i = 0; i < walkingQueueSize; i++) {
  4624. walkingQueueX[i] = currentX;
  4625. walkingQueueY[i] = currentY;
  4626. }
  4627. }
  4628.  
  4629. public void addToWalkingQueue(int x, int y) {
  4630. int next = (wQueueWritePtr + 1) % walkingQueueSize;
  4631. if (next == wQueueWritePtr)
  4632. return;
  4633. walkingQueueX[wQueueWritePtr] = x;
  4634. walkingQueueY[wQueueWritePtr] = y;
  4635. wQueueWritePtr = next;
  4636. }
  4637.  
  4638. public boolean goodDistance(int objectX, int objectY, int playerX, int playerY, int distance) {
  4639. for (int i = 0; i <= distance; i++) {
  4640. for (int j = 0; j <= distance; j++) {
  4641. if ((objectX + i) == playerX
  4642. && ((objectY + j) == playerY || (objectY - j) == playerY || objectY == playerY)) {
  4643. return true;
  4644. } else if ((objectX - i) == playerX
  4645. && ((objectY + j) == playerY || (objectY - j) == playerY || objectY == playerY)) {
  4646. return true;
  4647. } else if (objectX == playerX
  4648. && ((objectY + j) == playerY || (objectY - j) == playerY || objectY == playerY)) {
  4649. return true;
  4650. }
  4651. }
  4652. }
  4653. return false;
  4654. }
  4655.  
  4656. /**
  4657. * Checks the combat distance to see if the player is in an appropriate
  4658. * location based on the attack style.
  4659. *
  4660. * @param attacker
  4661. * @param target
  4662. * @return
  4663. */
  4664. public boolean checkCombatDistance(Player attacker, Player target) {
  4665. int distance = Misc.distanceBetween(attacker, target);
  4666. int required_distance = this.getDistanceRequired();
  4667. return (this.usingMagic || this.usingRangeWeapon || this.usingBow || this.autocasting)
  4668. && distance <= required_distance
  4669. ? true
  4670. : (this.usingMelee && this.isMoving && distance <= required_distance ? true
  4671. : distance == 1 && (this.freezeTimer <= 0 || this.getX() == target.getX()
  4672. || this.getY() == target.getY()));
  4673. }
  4674.  
  4675. public int getDistanceRequired() {
  4676. return !this.usingMagic && !this.usingRangeWeapon && !usingBow && !this.autocasting ? (this.isMoving ? 3 : 1)
  4677. : 9;
  4678. }
  4679.  
  4680. public int getNextWalkingDirection() {
  4681.  
  4682. if (wQueueReadPtr == wQueueWritePtr)
  4683. return -1;
  4684. int dir;
  4685.  
  4686. do {
  4687. dir = Misc.direction(currentX, currentY, walkingQueueX[wQueueReadPtr], walkingQueueY[wQueueReadPtr]);
  4688.  
  4689. if (dir == -1) {
  4690. wQueueReadPtr = (wQueueReadPtr + 1) % walkingQueueSize;
  4691. } else if ((dir & 1) != 0) {
  4692. println_debug("Invalid waypoint in walking queue!");
  4693. resetWalkingQueue();
  4694. return -1;
  4695. }
  4696. } while ((dir == -1) && (wQueueReadPtr != wQueueWritePtr));
  4697. if (dir == -1)
  4698. return -1;
  4699. dir >>= 1;
  4700. currentX += Misc.directionDeltaX[dir];
  4701. currentY += Misc.directionDeltaY[dir];
  4702. absX += Misc.directionDeltaX[dir];
  4703. absY += Misc.directionDeltaY[dir];
  4704. setLocation(Location.create(absX, absY, heightLevel));
  4705. return dir;
  4706. }
  4707.  
  4708. public int oldX = absX;
  4709. public int oldY = absY;
  4710.  
  4711. public int oldHeight = heightLevel;
  4712.  
  4713. private Location location;
  4714. private Location lastLocation;
  4715.  
  4716. public Location getLastLocation() {
  4717. if (lastLocation == null)
  4718. lastLocation = getLocation().transform(Misc.random(-1, 1), Misc.random(-1, 1), 0);
  4719. return lastLocation;
  4720. }
  4721.  
  4722. public void setLastLocation() {
  4723. this.lastLocation = getLocation();
  4724. }
  4725.  
  4726. public void setLocation(Location location) {
  4727. setLastLocation();
  4728. this.location = location;
  4729. }
  4730.  
  4731. public Location getLocation() {
  4732. return location;
  4733. }
  4734.  
  4735. public boolean isRunning() {
  4736. return isNewWalkCmdIsRunning() || (isRunning2 && isMoving);
  4737. }
  4738.  
  4739. public void getNextPlayerMovement() {
  4740. mapRegionDidChange = false;
  4741. didTeleport = false;
  4742. dir1 = dir2 = -1;
  4743. if (teleportToX != -1 && teleportToY != -1) {
  4744. mapRegionDidChange = true;
  4745. if (mapRegionX != -1 && mapRegionY != -1) {
  4746. int relX = teleportToX - mapRegionX * 8, relY = teleportToY - mapRegionY * 8;
  4747. if (relX >= 2 * 8 && relX < 11 * 8 && relY >= 2 * 8 && relY < 11 * 8)
  4748. mapRegionDidChange = false;
  4749. }
  4750. if (mapRegionDidChange) {
  4751. mapRegionX = (teleportToX >> 3) - 6;
  4752. mapRegionY = (teleportToY >> 3) - 6;
  4753. }
  4754. currentX = teleportToX - 8 * mapRegionX;
  4755. currentY = teleportToY - 8 * mapRegionY;
  4756. lastTeleport[0] = currentX;
  4757. lastTeleport[1] = currentY;
  4758. absX = teleportToX;
  4759. absY = teleportToY;
  4760. resetWalkingQueue();
  4761.  
  4762. teleportToX = teleportToY = -1;
  4763. didTeleport = true;
  4764. } else {
  4765. dir1 = getNextWalkingDirection();
  4766. if (dir1 == -1)
  4767. return;
  4768. if (isRunning) {
  4769. dir2 = getNextWalkingDirection();
  4770. }
  4771. int deltaX = 0, deltaY = 0;
  4772. if (currentX < 2 * 8) {
  4773. deltaX = 4 * 8;
  4774. mapRegionX -= 4;
  4775. mapRegionDidChange = true;
  4776. } else if (currentX >= 11 * 8) {
  4777. deltaX = -4 * 8;
  4778. mapRegionX += 4;
  4779. mapRegionDidChange = true;
  4780. }
  4781. if (currentY < 2 * 8) {
  4782. deltaY = 4 * 8;
  4783. mapRegionY -= 4;
  4784. mapRegionDidChange = true;
  4785. } else if (currentY >= 11 * 8) {
  4786. deltaY = -4 * 8;
  4787. mapRegionY += 4;
  4788. mapRegionDidChange = true;
  4789. }
  4790.  
  4791. if (mapRegionDidChange) {
  4792. currentX += deltaX;
  4793. currentY += deltaY;
  4794. for (int i = 0; i < walkingQueueSize; i++) {
  4795. walkingQueueX[i] += deltaX;
  4796. walkingQueueY[i] += deltaY;
  4797. }
  4798. }
  4799. }
  4800. }
  4801.  
  4802. public void updateThisPlayerMovement(Stream str) {
  4803. if (mapRegionDidChange) {
  4804. str.createFrame(73);
  4805. str.writeWordA(mapRegionX + 6);
  4806. str.writeWord(mapRegionY + 6);
  4807. /*
  4808. * if(teleport == true) { teleport = false; }
  4809. */
  4810. }
  4811.  
  4812. if (didTeleport) {
  4813. str.createFrameVarSizeWord(81);
  4814. str.initBitAccess();
  4815. str.writeBits(1, 1);
  4816. str.writeBits(2, 3);
  4817. str.writeBits(2, heightLevel);
  4818. str.writeBits(1, 1);
  4819. str.writeBits(1, (updateRequired) ? 1 : 0);
  4820. str.writeBits(7, currentY);
  4821. str.writeBits(7, currentX);
  4822. return;
  4823. }
  4824.  
  4825. if (dir1 == -1) {
  4826. // don't have to update the character position, because we're just
  4827. // standing
  4828. str.createFrameVarSizeWord(81);
  4829. str.initBitAccess();
  4830. isMoving = false;
  4831. if (updateRequired) {
  4832. // tell client there's an update block appended at the end
  4833. str.writeBits(1, 1);
  4834. str.writeBits(2, 0);
  4835. } else {
  4836. str.writeBits(1, 0);
  4837. }
  4838. if (DirectionCount < 50) {
  4839. DirectionCount++;
  4840. }
  4841. } else {
  4842. DirectionCount = 0;
  4843. str.createFrameVarSizeWord(81);
  4844. str.initBitAccess();
  4845. str.writeBits(1, 1);
  4846.  
  4847. if (dir2 == -1) {
  4848. isMoving = true;
  4849. str.writeBits(2, 1);
  4850. str.writeBits(3, Misc.xlateDirectionToClient[dir1]);
  4851. if (updateRequired)
  4852. str.writeBits(1, 1);
  4853. else
  4854. str.writeBits(1, 0);
  4855. } else {
  4856. isMoving = true;
  4857. str.writeBits(2, 2);
  4858. str.writeBits(3, Misc.xlateDirectionToClient[dir1]);
  4859. str.writeBits(3, Misc.xlateDirectionToClient[dir2]);
  4860. if (updateRequired)
  4861. str.writeBits(1, 1);
  4862. else
  4863. str.writeBits(1, 0);
  4864. }
  4865. }
  4866. }
  4867.  
  4868. public void updatePlayerMovement(Stream str) {
  4869. if (dir1 == -1) {
  4870. if (updateRequired || isChatTextUpdateRequired()) {
  4871.  
  4872. str.writeBits(1, 1);
  4873. str.writeBits(2, 0);
  4874. } else
  4875. str.writeBits(1, 0);
  4876. } else if (dir2 == -1) {
  4877.  
  4878. str.writeBits(1, 1);
  4879. str.writeBits(2, 1);
  4880. str.writeBits(3, Misc.xlateDirectionToClient[dir1]);
  4881. str.writeBits(1, (updateRequired || isChatTextUpdateRequired()) ? 1 : 0);
  4882. } else {
  4883.  
  4884. str.writeBits(1, 1);
  4885. str.writeBits(2, 2);
  4886. str.writeBits(3, Misc.xlateDirectionToClient[dir1]);
  4887. str.writeBits(3, Misc.xlateDirectionToClient[dir2]);
  4888. str.writeBits(1, (updateRequired || isChatTextUpdateRequired()) ? 1 : 0);
  4889. }
  4890.  
  4891. }
  4892.  
  4893. public void addNewNPC(NPC npc, Stream str, Stream updateBlock) {
  4894. int id = npc.index;
  4895. npcInListBitmap[id >> 3] |= 1 << (id & 7);
  4896. npcList[npcListSize++] = npc;
  4897.  
  4898. str.writeBits(14, id);
  4899.  
  4900. int z = npc.absY - absY;
  4901. if (z < 0)
  4902. z += 32;
  4903. str.writeBits(5, z);
  4904. z = npc.absX - absX;
  4905. if (z < 0)
  4906. z += 32;
  4907. str.writeBits(5, z);
  4908.  
  4909. str.writeBits(1, 0);
  4910. str.writeBits(14, npc.npcType);
  4911.  
  4912. boolean savedUpdateRequired = npc.updateRequired;
  4913. npc.updateRequired = true;
  4914. npc.appendNPCUpdateBlock(updateBlock);
  4915. npc.updateRequired = savedUpdateRequired;
  4916. str.writeBits(1, 1);
  4917. }
  4918.  
  4919. public int totalPlaytime() {
  4920. return (pTime);
  4921. }
  4922.  
  4923. public String getPlaytime() {
  4924. int DAY = (totalPlaytime() / 144000);
  4925. int HR = (totalPlaytime() / 6000) - (DAY * 24);
  4926. int MIN = (totalPlaytime() / 100) - (DAY * 1440) - (HR * 60);
  4927. return (DAY + " D " + HR + " H " + MIN + " M");
  4928. }
  4929.  
  4930. public void addNewPlayer(Player plr, Stream str, Stream updateBlock) {
  4931. if (playerListSize >= 255) {
  4932. return;
  4933. }
  4934. int id = plr.index;
  4935. playerInListBitmap[id >> 3] |= 1 << (id & 7);
  4936. playerList[playerListSize++] = plr;
  4937. str.writeBits(11, id);
  4938. str.writeBits(1, 1);
  4939. boolean savedFlag = plr.isAppearanceUpdateRequired();
  4940. boolean savedUpdateRequired = plr.updateRequired;
  4941. plr.setAppearanceUpdateRequired(true);
  4942. plr.updateRequired = true;
  4943. plr.appendPlayerUpdateBlock(updateBlock);
  4944. plr.setAppearanceUpdateRequired(savedFlag);
  4945. plr.updateRequired = savedUpdateRequired;
  4946. str.writeBits(1, 1);
  4947. int z = plr.absY - absY;
  4948. if (z < 0)
  4949. z += 32;
  4950. str.writeBits(5, z);
  4951. z = plr.absX - absX;
  4952. if (z < 0)
  4953. z += 32;
  4954. str.writeBits(5, z);
  4955. }
  4956.  
  4957. protected void appendPlayerAppearance(Stream str) {
  4958. playerProps.currentOffset = 0;
  4959. playerProps.writeByte(playerAppearance[0]);
  4960. StringBuilder sb = new StringBuilder(titles.getCurrentTitle());
  4961. if (titles.getCurrentTitle().equalsIgnoreCase("None")) {
  4962. sb.delete(0, sb.length());
  4963. }
  4964. playerProps.writeString(sb.toString());
  4965. sb = new StringBuilder(titles.getCurrentTitleColor());
  4966. if (titles.getCurrentTitle().equalsIgnoreCase("None")) {
  4967. sb.delete(0, sb.length());
  4968. }
  4969. playerProps.writeString(sb.toString());
  4970. if (venomDamage > 0) {
  4971. playerProps.writeByte(2);
  4972. } else if (poisonDamage > 0) {
  4973. playerProps.writeByte(1);
  4974. } else {
  4975. playerProps.writeByte(0);
  4976. }
  4977. playerProps.writeByte(headIcon);
  4978. playerProps.writeByte(headIconPk);
  4979. if (isNpc == false) {
  4980. if (playerEquipment[playerHat] > 1) {
  4981. playerProps.writeWord(0x200 + playerEquipment[playerHat]);
  4982. } else {
  4983. playerProps.writeByte(0);
  4984. }
  4985.  
  4986. if (playerEquipment[playerCape] > 1) {
  4987. playerProps.writeWord(0x200 + playerEquipment[playerCape]);
  4988. } else {
  4989. playerProps.writeByte(0);
  4990. }
  4991.  
  4992. if (playerEquipment[playerAmulet] > 1) {
  4993. playerProps.writeWord(0x200 + playerEquipment[playerAmulet]);
  4994. } else {
  4995. playerProps.writeByte(0);
  4996. }
  4997.  
  4998. if (playerEquipment[playerWeapon] > 1) {
  4999. playerProps.writeWord(0x200 + playerEquipment[playerWeapon]);
  5000. } else {
  5001. playerProps.writeByte(0);
  5002. }
  5003.  
  5004. if (playerEquipment[playerChest] > 1) {
  5005. playerProps.writeWord(0x200 + playerEquipment[playerChest]);
  5006. } else {
  5007. playerProps.writeWord(0x100 + playerAppearance[2]);
  5008. }
  5009.  
  5010. if (playerEquipment[playerShield] > 1) {
  5011. playerProps.writeWord(0x200 + playerEquipment[playerShield]);
  5012. } else {
  5013. playerProps.writeByte(0);
  5014. }
  5015.  
  5016. if (!Item.isFullBody(playerEquipment[playerChest])) {
  5017. playerProps.writeWord(0x100 + playerAppearance[3]);
  5018. } else {
  5019. playerProps.writeByte(0);
  5020. }
  5021.  
  5022. if (playerEquipment[playerLegs] > 1) {
  5023. playerProps.writeWord(0x200 + playerEquipment[playerLegs]);
  5024. } else {
  5025. playerProps.writeWord(0x100 + playerAppearance[5]);
  5026. }
  5027.  
  5028. if (!Item.isFullHelm(playerEquipment[playerHat]) && !Item.isFullMask(playerEquipment[playerHat])) {
  5029. playerProps.writeWord(0x100 + playerAppearance[1]);
  5030. } else {
  5031. playerProps.writeByte(0);
  5032. }
  5033.  
  5034. if (playerEquipment[playerHands] > 1) {
  5035. playerProps.writeWord(0x200 + playerEquipment[playerHands]);
  5036. } else {
  5037. playerProps.writeWord(0x100 + playerAppearance[4]);
  5038. }
  5039.  
  5040. if (playerEquipment[playerFeet] > 1) {
  5041. playerProps.writeWord(0x200 + playerEquipment[playerFeet]);
  5042. } else {
  5043. playerProps.writeWord(0x100 + playerAppearance[6]);
  5044. }
  5045.  
  5046. if (playerAppearance[0] != 1 && !Item.isFullMask(playerEquipment[playerHat])) {
  5047. playerProps.writeWord(0x100 + playerAppearance[7]);
  5048. } else {
  5049. playerProps.writeByte(0);
  5050. }
  5051. } else {
  5052. playerProps.writeWord(-1);
  5053. playerProps.writeWord(npcId2);
  5054. }
  5055. playerProps.writeByte(playerAppearance[8]);
  5056. playerProps.writeByte(playerAppearance[9]);
  5057. playerProps.writeByte(playerAppearance[10]);
  5058. playerProps.writeByte(playerAppearance[11]);
  5059. playerProps.writeByte(playerAppearance[12]);
  5060. playerProps.writeWord(playerStandIndex); // standAnimIndex
  5061. playerProps.writeWord(playerTurnIndex); // standTurnAnimIndex
  5062. playerProps.writeWord(playerWalkIndex); // walkAnimIndex
  5063. playerProps.writeWord(playerTurn180Index); // turn180AnimIndex
  5064. playerProps.writeWord(playerTurn90CWIndex); // turn90CWAnimIndex
  5065. playerProps.writeWord(playerTurn90CCWIndex); // turn90CCWAnimIndex
  5066. playerProps.writeWord(playerRunIndex); // runAnimIndex
  5067. playerProps.writeQWord(Misc.playerNameToInt64(playerName));
  5068. playerProps.writeByte(invisible ? 1 : 0);
  5069. combatLevel = calculateCombatLevel();
  5070. playerProps.writeByte(combatLevel); // combat level
  5071. playerProps.writeByte(rights.getValue());
  5072. playerProps.writeWord(0);
  5073. str.writeByteC(playerProps.currentOffset);
  5074. str.writeBytes(playerProps.buffer, playerProps.currentOffset, 0);
  5075. }
  5076.  
  5077. public int calculateCombatLevel() {
  5078. int j = getLevelForXP(playerXP[playerAttack]);
  5079. int k = getLevelForXP(playerXP[playerDefence]);
  5080. int l = getLevelForXP(playerXP[playerStrength]);
  5081. int i1 = getLevelForXP(playerXP[playerHitpoints]);
  5082. int j1 = getLevelForXP(playerXP[playerPrayer]);
  5083. int k1 = getLevelForXP(playerXP[playerRanged]);
  5084. int l1 = getLevelForXP(playerXP[playerMagic]);
  5085. int combatLevel = (int) (((k + i1) + Math.floor(j1 / 2)) * 0.25D) + 1;
  5086. double d = (j + l) * 0.32500000000000001D;
  5087. double d1 = Math.floor(k1 * 1.5D) * 0.32500000000000001D;
  5088. double d2 = Math.floor(l1 * 1.5D) * 0.32500000000000001D;
  5089. if (d >= d1 && d >= d2) {
  5090. combatLevel += d;
  5091. } else if (d1 >= d && d1 >= d2) {
  5092. combatLevel += d1;
  5093. } else if (d2 >= d && d2 >= d1) {
  5094. combatLevel += d2;
  5095. }
  5096. return combatLevel;
  5097. }
  5098.  
  5099. public static int getLevelForXP(int exp) {
  5100. int points = 0;
  5101. int output = 0;
  5102.  
  5103. for (int lvl = 1; lvl <= 99; lvl++) {
  5104. points += Math.floor(lvl + 300.0 * Math.pow(2.0, lvl / 7.0));
  5105. output = (int) Math.floor(points / 4);
  5106. if (output >= exp)
  5107. return lvl;
  5108. }
  5109. return 99;
  5110. }
  5111.  
  5112. protected void appendPlayerChatText(Stream str) {
  5113. str.writeWordBigEndian(((getChatTextColor() & 0xFF) << 8) + (getChatTextEffects() & 0xFF));
  5114. str.writeByte(rights.getValue());
  5115. str.writeByteC(getChatTextSize());
  5116. str.writeBytes_reverse(getChatText(), getChatTextSize(), 0);
  5117.  
  5118. }
  5119.  
  5120. public void appendForcedChat(Stream str) {
  5121. str.writeString(forcedText);
  5122. }
  5123.  
  5124. public void appendMask100Update(Stream str) {
  5125. str.writeWordBigEndian(gfxVar1);
  5126. str.writeDWord(gfxVar2);
  5127.  
  5128. }
  5129.  
  5130. public boolean wearing2h() {
  5131. Player c = this;
  5132. c.getItems();
  5133. String s = c.getItems().getItemName(c.playerEquipment[c.playerWeapon]);
  5134. if (s.contains("2h"))
  5135. return true;
  5136. else if (s.contains("godsword"))
  5137. return true;
  5138. return false;
  5139. }
  5140.  
  5141. public void appendAnimationRequest(Stream str) {
  5142. str.writeWordBigEndian((animId == -1) ? 65535 : animId);
  5143. str.writeByteC(animDelay);
  5144.  
  5145. }
  5146.  
  5147. public void appendFaceUpdate(Stream str) {
  5148. str.writeWordBigEndian(face);
  5149.  
  5150. }
  5151.  
  5152. public void ObjectClick(Player c, int objectID, int objectX, int objectY, int itemId) {
  5153. switch (objectID) {
  5154. case 9501:
  5155. getPA().interface_components2(itemId);
  5156. break;
  5157. }
  5158. }
  5159.  
  5160. public boolean Interface(int id) {
  5161. for (int i = 0; ItemDefinition.forId(id).isNoted(); i++) {
  5162. if (id == i) {
  5163. return true;
  5164. }
  5165. }
  5166. return false;
  5167. }
  5168.  
  5169. private void appendSetFocusDestination(Stream str) {
  5170. str.writeWordBigEndianA(faceX);
  5171. str.writeWordBigEndian(faceY);
  5172.  
  5173. }
  5174.  
  5175. /**
  5176. * Hit Update
  5177. **/
  5178. protected void appendHitUpdate(Stream str) {
  5179. str.writeByte(hitDiff);
  5180. if (hitmark == null) {
  5181. str.writeByteA(0);
  5182. } else {
  5183. str.writeByteA(hitmark.getId());
  5184. }
  5185. if (playerLevel[3] <= 0) {
  5186. playerLevel[3] = 0;
  5187. isDead = true;
  5188. }
  5189. str.writeByteC(playerLevel[3]);
  5190. str.writeByte(getLevelForXP(playerXP[3]));
  5191. }
  5192.  
  5193. protected void appendHitUpdate2(Stream str) {
  5194. str.writeByte(hitDiff2);
  5195. if (secondHitmark == null) {
  5196. str.writeByteS(0);
  5197. } else {
  5198. str.writeByteS(secondHitmark.getId());
  5199. }
  5200. if (playerLevel[3] <= 0) {
  5201. playerLevel[3] = 0;
  5202. isDead = true;
  5203. }
  5204. str.writeByte(playerLevel[3]);
  5205. str.writeByteC(getLevelForXP(playerXP[3]));
  5206.  
  5207. }
  5208.  
  5209. public void appendPlayerUpdateBlock(Stream str) {
  5210. if (!updateRequired && !isChatTextUpdateRequired())
  5211. return; // nothing required
  5212. int updateMask = 0;
  5213. if (forceMovementUpdateRequired) {
  5214. updateMask |= 0x400;
  5215. }
  5216. if (gfxUpdateRequired) {
  5217. updateMask |= 0x100;
  5218. }
  5219. if (animUpdateRequired) {
  5220. updateMask |= 8;
  5221. }
  5222. if (forcedChatUpdateRequired) {
  5223. updateMask |= 4;
  5224. }
  5225. if (isChatTextUpdateRequired()) {
  5226. updateMask |= 0x80;
  5227. }
  5228. if (isAppearanceUpdateRequired()) {
  5229. updateMask |= 0x10;
  5230. }
  5231. if (faceUpdateRequired) {
  5232. updateMask |= 1;
  5233. }
  5234. if (facePositionUpdateRequired) {
  5235. updateMask |= 2;
  5236. }
  5237. if (hitUpdateRequired) {
  5238. updateMask |= 0x20;
  5239. }
  5240.  
  5241. if (hitUpdateRequired2) {
  5242. updateMask |= 0x200;
  5243. }
  5244.  
  5245. if (updateMask >= 0x100) {
  5246. updateMask |= 0x40;
  5247. str.writeByte(updateMask & 0xFF);
  5248. str.writeByte(updateMask >> 8);
  5249. } else {
  5250. str.writeByte(updateMask);
  5251. }
  5252. if (forceMovementUpdateRequired) {
  5253. appendMask400Update(str);
  5254. }
  5255. if (gfxUpdateRequired) {
  5256. appendMask100Update(str);
  5257. }
  5258. if (animUpdateRequired) {
  5259. appendAnimationRequest(str);
  5260. }
  5261. if (forcedChatUpdateRequired) {
  5262. appendForcedChat(str);
  5263. }
  5264. if (isChatTextUpdateRequired()) {
  5265. appendPlayerChatText(str);
  5266. }
  5267. if (faceUpdateRequired) {
  5268. appendFaceUpdate(str);
  5269. }
  5270. if (isAppearanceUpdateRequired()) {
  5271. appendPlayerAppearance(str);
  5272. }
  5273. if (facePositionUpdateRequired) {
  5274. appendSetFocusDestination(str);
  5275. }
  5276. if (hitUpdateRequired) {
  5277. appendHitUpdate(str);
  5278. }
  5279. if (hitUpdateRequired2) {
  5280. appendHitUpdate2(str);
  5281. }
  5282.  
  5283. }
  5284.  
  5285. private int x1 = -1;
  5286. private int y1 = -1;
  5287. private int x2 = -1;
  5288. private int y2 = -1;
  5289. private int speed1 = -1;
  5290. private int speed2 = -1;
  5291. private int direction = -1;
  5292.  
  5293. /**
  5294. * Creates a force-movement update block. (0x400)
  5295. *
  5296. * @param x2
  5297. * @param y2
  5298. * @param x1
  5299. * @param y1
  5300. * @param speed1
  5301. * @param speed2
  5302. * @param direction
  5303. * @param ticks
  5304. */
  5305. public void setForceMovement(final int x2, final int y2, boolean x1, boolean y1, final int speed1, final int speed2,
  5306. final int direction, final int ticks) {
  5307. setCanWalk(false);
  5308. this.x1 = getPosition().getLocalX();
  5309. this.y1 = getPosition().getLocalY();
  5310. this.x2 = x1 ? getPosition().getLocalX() + x2 : getPosition().getLocalX() - x2;
  5311. this.y2 = y1 ? getPosition().getLocalY() + y2 : getPosition().getLocalY() - y2;
  5312. this.speed1 = speed1;
  5313. this.speed2 = speed2;
  5314. this.direction = direction;
  5315. updateRequired = true;
  5316. forceMovementUpdateRequired = true;
  5317. CycleEventHandler.getSingleton().addEvent(this, new CycleEvent() {
  5318. @Override
  5319. public void execute(CycleEventContainer container) {
  5320. absX = absX + x2;
  5321. absY = absY + y2;
  5322. container.stop();
  5323. }
  5324. }, ticks);
  5325. CycleEventHandler.getSingleton().addEvent(this, new CycleEvent() {
  5326. @Override
  5327. public void execute(CycleEventContainer container) {
  5328. getPA().movePlayer(getPosition().getX(), getPosition().getY(), getPosition().getZ());
  5329. setForceMovementRequired(false);
  5330. setCanWalk(true);
  5331. container.stop();
  5332. }
  5333. }, ticks + 1);
  5334. }
  5335.  
  5336. public void appendMask400Update(Stream str) {
  5337. str.writeByteS(x1);
  5338. str.writeByteS(y1);
  5339. str.writeByteS(x2);
  5340. str.writeByteS(y2);
  5341. str.writeWordBigEndianA(speed1);
  5342. str.writeWordA(speed2);
  5343. str.writeByteS(direction);
  5344. }
  5345.  
  5346. @Override
  5347. public void reset() {
  5348. setChatTextUpdateRequired(false);
  5349. setAppearanceUpdateRequired(false);
  5350. forceMovementUpdateRequired = false;
  5351. }
  5352.  
  5353. public int[] lastTeleport = new int[2];
  5354.  
  5355. public void stopMovement() {
  5356. if (lastTeleport[0] == currentX && lastTeleport[1] == currentY) {
  5357. newWalkCmdSteps = 0;
  5358. getNewWalkCmdX()[0] = getNewWalkCmdY()[0] = travelBackX[0] = travelBackY[0] = 0;
  5359. return;
  5360. }
  5361. if (teleportToX <= 0 && teleportToY <= 0) {
  5362. teleportToX = absX;
  5363. teleportToY = absY;
  5364. }
  5365. newWalkCmdSteps = 0;
  5366. getNewWalkCmdX()[0] = getNewWalkCmdY()[0] = travelBackX[0] = travelBackY[0] = 0;
  5367. getNextPlayerMovement();
  5368. }
  5369.  
  5370. public void preProcessing() {
  5371. newWalkCmdSteps = 0;
  5372. }
  5373.  
  5374. public int setPacketsReceived(int packetsReceived) {
  5375. return packetsReceived;
  5376. }
  5377.  
  5378. public AtomicInteger getPacketsReceived() {
  5379. return packetsReceived;
  5380. }
  5381.  
  5382. public void postProcessing() {
  5383. if (newWalkCmdSteps > 0) {
  5384. int firstX = getNewWalkCmdX()[0], firstY = getNewWalkCmdY()[0];
  5385.  
  5386. int lastDir = 0;
  5387. boolean found = false;
  5388. numTravelBackSteps = 0;
  5389. int ptr = wQueueReadPtr;
  5390. int dir = Misc.direction(currentX, currentY, firstX, firstY);
  5391. if (dir != -1 && (dir & 1) != 0) {
  5392. do {
  5393. lastDir = dir;
  5394. if (--ptr < 0)
  5395. ptr = walkingQueueSize - 1;
  5396.  
  5397. travelBackX[numTravelBackSteps] = walkingQueueX[ptr];
  5398. travelBackY[numTravelBackSteps++] = walkingQueueY[ptr];
  5399. dir = Misc.direction(walkingQueueX[ptr], walkingQueueY[ptr], firstX, firstY);
  5400. if (lastDir != dir) {
  5401. found = true;
  5402. break;
  5403. }
  5404.  
  5405. } while (ptr != wQueueWritePtr);
  5406. } else
  5407. found = true;
  5408.  
  5409. if (!found)
  5410. println_debug("Fatal: couldn't find connection vertex! Dropping packet.");
  5411. else {
  5412. wQueueWritePtr = wQueueReadPtr;
  5413.  
  5414. addToWalkingQueue(currentX, currentY);
  5415.  
  5416. if (dir != -1 && (dir & 1) != 0) {
  5417.  
  5418. for (int i = 0; i < numTravelBackSteps - 1; i++) {
  5419. addToWalkingQueue(travelBackX[i], travelBackY[i]);
  5420. }
  5421. int wayPointX2 = travelBackX[numTravelBackSteps - 1],
  5422. wayPointY2 = travelBackY[numTravelBackSteps - 1];
  5423. int wayPointX1, wayPointY1;
  5424. if (numTravelBackSteps == 1) {
  5425. wayPointX1 = currentX;
  5426. wayPointY1 = currentY;
  5427. } else {
  5428. wayPointX1 = travelBackX[numTravelBackSteps - 2];
  5429. wayPointY1 = travelBackY[numTravelBackSteps - 2];
  5430. }
  5431.  
  5432. dir = Misc.direction(wayPointX1, wayPointY1, wayPointX2, wayPointY2);
  5433. if (dir == -1 || (dir & 1) != 0) {
  5434. println_debug("Fatal: The walking queue is corrupt! wp1=(" + wayPointX1 + ", " + wayPointY1
  5435. + "), " + "wp2=(" + wayPointX2 + ", " + wayPointY2 + ")");
  5436. } else {
  5437. dir >>= 1;
  5438. found = false;
  5439. int x = wayPointX1, y = wayPointY1;
  5440. while (x != wayPointX2 || y != wayPointY2) {
  5441. x += Misc.directionDeltaX[dir];
  5442. y += Misc.directionDeltaY[dir];
  5443. if ((Misc.direction(x, y, firstX, firstY) & 1) == 0) {
  5444. found = true;
  5445. break;
  5446. }
  5447. }
  5448. if (!found) {
  5449. println_debug("Fatal: Internal error: unable to determine connection vertex!" + " wp1=("
  5450. + wayPointX1 + ", " + wayPointY1 + "), wp2=(" + wayPointX2 + ", " + wayPointY2
  5451. + "), " + "first=(" + firstX + ", " + firstY + ")");
  5452. } else
  5453. addToWalkingQueue(wayPointX1, wayPointY1);
  5454. }
  5455. } else {
  5456. for (int i = 0; i < numTravelBackSteps; i++) {
  5457. addToWalkingQueue(travelBackX[i], travelBackY[i]);
  5458. }
  5459. }
  5460.  
  5461. for (int i = 0; i < newWalkCmdSteps; i++) {
  5462. addToWalkingQueue(getNewWalkCmdX()[i], getNewWalkCmdY()[i]);
  5463. }
  5464.  
  5465. }
  5466.  
  5467. isRunning = isNewWalkCmdIsRunning() || isRunning2;
  5468. }
  5469. }
  5470.  
  5471. public int getMapRegionX() {
  5472. return mapRegionX;
  5473. }
  5474.  
  5475. public int getMapRegionY() {
  5476. return mapRegionY;
  5477. }
  5478.  
  5479. public int getX() {
  5480. return absX;
  5481. }
  5482.  
  5483. public int getY() {
  5484. return absY;
  5485. }
  5486.  
  5487. public int getId() {
  5488. return index;
  5489. }
  5490.  
  5491. public boolean inCook() {
  5492. return absX >= 3029 && absX <= 3032 && absY >= 3382 && absY <= 3384;
  5493. }
  5494.  
  5495. public boolean inBurnArea() {
  5496. return absX >= 1714 && absX <= 1720 && absY >= 3467 && absY <= 3469;
  5497. }
  5498.  
  5499. public boolean inPcBoat() {
  5500. return absX >= 2660 && absX <= 2663 && absY >= 2638 && absY <= 2643;
  5501. }
  5502.  
  5503. public boolean inPcGame() {
  5504. return absX >= 2624 && absX <= 2690 && absY >= 2550 && absY <= 2619;
  5505. }
  5506.  
  5507. public void setHitDiff(int hitDiff) {
  5508. this.hitDiff = hitDiff;
  5509. }
  5510.  
  5511. public void setHitDiff2(int hitDiff2) {
  5512. this.hitDiff2 = hitDiff2;
  5513. }
  5514.  
  5515. public int getHitDiff() {
  5516. return hitDiff;
  5517. }
  5518.  
  5519. public void setAppearanceUpdateRequired(boolean appearanceUpdateRequired) {
  5520. this.appearanceUpdateRequired = appearanceUpdateRequired;
  5521. }
  5522.  
  5523. public boolean isAppearanceUpdateRequired() {
  5524. return appearanceUpdateRequired;
  5525. }
  5526.  
  5527. public void setChatTextEffects(int chatTextEffects) {
  5528. this.chatTextEffects = chatTextEffects;
  5529. }
  5530.  
  5531. public int getChatTextEffects() {
  5532. return chatTextEffects;
  5533. }
  5534.  
  5535. public void setChatTextSize(byte chatTextSize) {
  5536. this.chatTextSize = chatTextSize;
  5537. }
  5538.  
  5539. public byte getChatTextSize() {
  5540. return chatTextSize;
  5541. }
  5542.  
  5543. public void setChatTextUpdateRequired(boolean chatTextUpdateRequired) {
  5544. this.chatTextUpdateRequired = chatTextUpdateRequired;
  5545. }
  5546.  
  5547. public boolean isChatTextUpdateRequired() {
  5548. return chatTextUpdateRequired;
  5549. }
  5550.  
  5551. public void setChatText(byte chatText[]) {
  5552. this.chatText = chatText;
  5553. }
  5554.  
  5555. public byte[] getChatText() {
  5556. return chatText;
  5557. }
  5558.  
  5559. public void setChatTextColor(int chatTextColor) {
  5560. this.chatTextColor = chatTextColor;
  5561. }
  5562.  
  5563. public int getChatTextColor() {
  5564. return chatTextColor;
  5565. }
  5566.  
  5567. public void setNewWalkCmdX(int newWalkCmdX[]) {
  5568. this.newWalkCmdX = newWalkCmdX;
  5569. }
  5570.  
  5571. public int[] getNewWalkCmdX() {
  5572. return newWalkCmdX;
  5573. }
  5574.  
  5575. public void setNewWalkCmdY(int newWalkCmdY[]) {
  5576. this.newWalkCmdY = newWalkCmdY;
  5577. }
  5578.  
  5579. public int[] getNewWalkCmdY() {
  5580. return newWalkCmdY;
  5581. }
  5582.  
  5583. public void setNewWalkCmdIsRunning(boolean newWalkCmdIsRunning) {
  5584. this.newWalkCmdIsRunning = newWalkCmdIsRunning;
  5585. }
  5586.  
  5587. public boolean isNewWalkCmdIsRunning() {
  5588. return newWalkCmdIsRunning;
  5589. }
  5590.  
  5591. public void setInStreamDecryption() {
  5592. }
  5593.  
  5594. public void setOutStreamDecryption() {
  5595. }
  5596.  
  5597. public boolean samePlayer() {
  5598. for (int j = 0; j < PlayerHandler.players.length; j++) {
  5599. if (j == index)
  5600. continue;
  5601. if (PlayerHandler.players[j] != null) {
  5602. if (PlayerHandler.players[j].playerName.equalsIgnoreCase(playerName)) {
  5603. disconnected = true;
  5604. return true;
  5605. }
  5606. }
  5607. }
  5608. return false;
  5609. }
  5610.  
  5611. public void putInCombat(int attacker) {
  5612. underAttackBy = attacker;
  5613. logoutDelay.reset();
  5614. singleCombatDelay.reset();
  5615. }
  5616.  
  5617. public int appendDamage(int damage, Hitmark h) {
  5618. if (damage < 0) {
  5619. damage = 0;
  5620. h = Hitmark.MISS;
  5621. }
  5622. if (playerLevel[playerHitpoints] - damage < 0) {
  5623. damage = playerLevel[playerHitpoints];
  5624. }
  5625. if (teleTimer <= 0) {
  5626. playerLevel[3] -= damage;
  5627. if (!hitUpdateRequired) {
  5628. hitUpdateRequired = true;
  5629. hitDiff = damage;
  5630. hitmark = h;
  5631. } else if (!hitUpdateRequired2) {
  5632. hitUpdateRequired2 = true;
  5633. hitDiff2 = damage;
  5634. secondHitmark = h;
  5635. }
  5636. this.getPA().refreshSkill(3);
  5637. } else {
  5638. if (hitUpdateRequired) {
  5639. hitUpdateRequired = false;
  5640. }
  5641. if (hitUpdateRequired2) {
  5642. hitUpdateRequired2 = false;
  5643. }
  5644. }
  5645. updateRequired = true;
  5646. return damage;
  5647. }
  5648.  
  5649. public void handleHitMask(int damage) {
  5650. if (!hitUpdateRequired) {
  5651. hitUpdateRequired = true;
  5652. hitDiff = damage;
  5653. } else if (!hitUpdateRequired2) {
  5654. hitUpdateRequired2 = true;
  5655. hitDiff2 = damage;
  5656. }
  5657. updateRequired = true;
  5658. }
  5659.  
  5660. public String getLastClanChat() {
  5661. return lastClanChat;
  5662. }
  5663.  
  5664. public long getNameAsLong() {
  5665. return nameAsLong;
  5666. }
  5667.  
  5668. public void setNameAsLong(long hash) {
  5669. this.nameAsLong = hash;
  5670. }
  5671.  
  5672. public boolean isStopPlayer() {
  5673. return stopPlayer;
  5674. }
  5675.  
  5676. public void setStopPlayer(boolean stopPlayer) {
  5677. this.stopPlayer = stopPlayer;
  5678. }
  5679.  
  5680. public int getPlayerIdentifier() {
  5681. return this.index;
  5682. }
  5683.  
  5684. public int getFace() {
  5685. return this.index + '\u8000';
  5686. }
  5687.  
  5688. public int getLockIndex() {
  5689. return -this.index - 1;
  5690. }
  5691.  
  5692. public int getHeight() {
  5693. return this.heightLevel;
  5694. }
  5695.  
  5696. public boolean isDead() {
  5697. return this.playerLevel[3] <= 0 || this.isDead;
  5698. }
  5699.  
  5700. public void healPlayer(int heal) {
  5701. this.playerLevel[3] += heal;
  5702. if (this.playerLevel[3] > Player.getLevelForXP(this.playerXP[3])) {
  5703. this.playerLevel[3] = Player.getLevelForXP(this.playerXP[3]);
  5704. }
  5705.  
  5706. }
  5707.  
  5708. int maxLevel() {
  5709. return 99;
  5710. }
  5711.  
  5712. public void sendGraphic(int id, int height) {
  5713. if (height == 0) {
  5714. this.gfx0(id);
  5715. }
  5716.  
  5717. if (height == 100) {
  5718. this.gfx100(id);
  5719. }
  5720.  
  5721. }
  5722.  
  5723. public boolean protectingRange() {
  5724. return this.prayerActive[17];
  5725. }
  5726.  
  5727. public boolean protectingMagic() {
  5728. return this.prayerActive[16];
  5729. }
  5730.  
  5731. public boolean protectingMelee() {
  5732. return this.prayerActive[18];
  5733. }
  5734.  
  5735. public void setTrading(boolean trading) {
  5736. this.trading = trading;
  5737. }
  5738.  
  5739. public boolean isTrading() {
  5740. return this.trading;
  5741. }
  5742.  
  5743. public boolean isInvisible() {
  5744. return invisible;
  5745. }
  5746.  
  5747. public void setInvisible(boolean invisible) {
  5748. this.invisible = invisible;
  5749. }
  5750.  
  5751. public boolean inGodmode() {
  5752. return godmode;
  5753. }
  5754.  
  5755. public void setGodmode(boolean godmode) {
  5756. this.godmode = godmode;
  5757. }
  5758.  
  5759. public double getDropModifier() {
  5760. return dropModifier;
  5761. }
  5762.  
  5763. public void setDropModifier(double modifier) {
  5764. this.dropModifier = modifier;
  5765. }
  5766.  
  5767. public boolean isDebug() {
  5768. return debug == 1;
  5769. }
  5770.  
  5771. public void setDebug(int debug) {
  5772. this.debug = debug;
  5773. }
  5774.  
  5775. public boolean inSafemode() {
  5776. return safemode;
  5777. }
  5778.  
  5779. public void setSafemode(boolean safemode) {
  5780. this.safemode = safemode;
  5781. }
  5782.  
  5783. public void setDragonfireShieldCharge(int charge) {
  5784. this.dragonfireShieldCharge = charge;
  5785. }
  5786.  
  5787. public int getDragonfireShieldCharge() {
  5788. return dragonfireShieldCharge;
  5789. }
  5790.  
  5791. public void setLastDragonfireShieldAttack(long lastAttack) {
  5792. this.lastDragonfireShieldAttack = lastAttack;
  5793. }
  5794.  
  5795. public long getLastDragonfireShieldAttack() {
  5796. return lastDragonfireShieldAttack;
  5797. }
  5798.  
  5799. public boolean isDragonfireShieldActive() {
  5800. return dragonfireShieldActive;
  5801. }
  5802.  
  5803. public void setDragonfireShieldActive(boolean dragonfireShieldActive) {
  5804. this.dragonfireShieldActive = dragonfireShieldActive;
  5805. }
  5806.  
  5807. /**
  5808. * Retrieves the rights for this player.
  5809. *
  5810. * @return the rights
  5811. */
  5812. public Rights getRights() {
  5813. return rights;
  5814. }
  5815.  
  5816. /**
  5817. * Updates the rights for this player by comparing the players current
  5818. * rights to that of the available rights and assigning the first rank
  5819. * found.
  5820. */
  5821. public void setRights(Rights rights) {
  5822. this.rights = rights;
  5823. }
  5824.  
  5825. /**
  5826. * Returns a single instance of the Titles class for this player
  5827. *
  5828. * @return the titles class
  5829. */
  5830. public Titles getTitles() {
  5831. if (titles == null) {
  5832. titles = new Titles(this);
  5833. }
  5834. return titles;
  5835. }
  5836.  
  5837. /**
  5838. * Mutates the current hitmark to be that of the new hitmark. This is
  5839. * commonly done in battle.
  5840. *
  5841. * @param hitmark
  5842. * the hitmark
  5843. */
  5844. public void setHitmark(Hitmark hitmark) {
  5845. this.hitmark = hitmark;
  5846. }
  5847.  
  5848. /**
  5849. * Mutates the first and second hitmark. This is commonly done in battle.
  5850. *
  5851. * @param hitmark
  5852. * the first hitmark
  5853. * @param secondHitmark
  5854. * the second hitmark
  5855. */
  5856. public void setHitmarks(Hitmark hitmark, Hitmark secondHitmark) {
  5857. this.hitmark = hitmark;
  5858. this.secondHitmark = secondHitmark;
  5859. }
  5860.  
  5861. public void appendPoisonDamage() {
  5862. if (poisonDamage <= 0) {
  5863. return;
  5864. }
  5865. Player client = this;
  5866. if (poisonDamageHistory.size() >= 4) {
  5867. poisonDamageHistory.clear();
  5868. poisonDamage--;
  5869. }
  5870. if (poisonDamage <= 0) {
  5871. client.sendMessage("The poison has subsided.");
  5872. client.getPA().requestUpdates();
  5873. return;
  5874. }
  5875. poisonDamageHistory.add(poisonDamage);
  5876. appendDamage(poisonDamage, Hitmark.POISON);
  5877. client.getPA().requestUpdates();
  5878. }
  5879.  
  5880. public void appendVenomDamage() {
  5881. if (venomDamage <= 0) {
  5882. return;
  5883. }
  5884. venomDamage += 2;
  5885. if (venomDamage >= 20) {
  5886. venomDamage = 20;
  5887. }
  5888. appendDamage(venomDamage, Hitmark.VENOM);
  5889. getPA().requestUpdates();
  5890. }
  5891.  
  5892. /**
  5893. * Determines if the player is susceptible to poison but comparing the
  5894. * duration of their immunity to the time of the last cure.
  5895. *
  5896. * @return true of they can be poisoned.
  5897. */
  5898. public boolean isSusceptibleToPoison() {
  5899. return System.currentTimeMillis() - this.lastPoisonCure > this.poisonImmunity;
  5900. }
  5901.  
  5902. /**
  5903. * The duration of time in milliseconds the player is immune to poison for
  5904. *
  5905. * @return the duration of time the player is immune to poison for
  5906. */
  5907. public long getPoisonImmunity() {
  5908. return poisonImmunity;
  5909. }
  5910.  
  5911. /**
  5912. * Modifies the current duration of poison immunity
  5913. *
  5914. * @param duration
  5915. * the new duration
  5916. */
  5917. public void setPoisonImmunity(long duration) {
  5918. this.poisonImmunity = duration;
  5919. }
  5920.  
  5921. /**
  5922. * The amount of damage received when hit by toxic
  5923. *
  5924. * @return the toxic damage
  5925. */
  5926. public byte getPoisonDamage() {
  5927. return poisonDamage;
  5928. }
  5929.  
  5930. /**
  5931. * Sets the current amount of damage received when hit by toxic
  5932. *
  5933. * @param toxicDamage
  5934. * the new amount of damage received
  5935. */
  5936. public void setPoisonDamage(byte toxicDamage) {
  5937. this.poisonDamage = toxicDamage;
  5938. }
  5939.  
  5940. /**
  5941. * The time in milliseconds of the last toxic damage the player received
  5942. *
  5943. * @return the time in milliseconds of the last toxic damage hit
  5944. */
  5945. public long getLastPoisonHit() {
  5946. return lastPoisonHit;
  5947. }
  5948.  
  5949. /**
  5950. * Sets the last time, in milliseconds, the toxic damaged the player
  5951. *
  5952. * @param toxic
  5953. * the time in milliseconds
  5954. */
  5955. public void setLastPoisonHit(long toxic) {
  5956. lastPoisonHit = toxic;
  5957. }
  5958.  
  5959. /**
  5960. * Sets the current amount of damage received when hit by venom
  5961. *
  5962. * @param venomDamage
  5963. * the new amount of damage received
  5964. */
  5965. public void setVenomDamage(byte venomDamage) {
  5966. this.venomDamage = venomDamage;
  5967. }
  5968.  
  5969. /**
  5970. * The time in milliseconds of the last venom damage the player received
  5971. *
  5972. * @return the time in milliseconds of the last venom damage hit
  5973. */
  5974. public long getLastVenomHit() {
  5975. return lastVenomHit;
  5976. }
  5977.  
  5978. /**
  5979. * Sets the last time, in milliseconds, the venom damaged the player
  5980. *
  5981. * @param venom
  5982. * the time in milliseconds
  5983. */
  5984. public void setLastVenomHit(long toxic) {
  5985. lastVenomHit = toxic;
  5986. }
  5987.  
  5988. /**
  5989. * Determines if the player is susceptible to venom by comparing the
  5990. * duration of their immunity to the time of the last cure.
  5991. *
  5992. * @return true of they can be infected by venom.
  5993. */
  5994. public boolean isSusceptibleToVenom() {
  5995. return System.currentTimeMillis() - lastVenomCure > venomImmunity && !getItems().isWearingItem(12931);
  5996. }
  5997.  
  5998. /**
  5999. * The duration of time in milliseconds the player is immune to venom for
  6000. *
  6001. * @return the duration of time the player is immune to poison for
  6002. */
  6003. public long getVenomImmunity() {
  6004. return venomImmunity;
  6005. }
  6006.  
  6007. /**
  6008. * Modifies the current duration of venom immunity
  6009. *
  6010. * @param duration
  6011. * the new duration
  6012. */
  6013. public void setVenomImmunity(long duration) {
  6014. this.venomImmunity = duration;
  6015. }
  6016.  
  6017. /**
  6018. * The amount of damage received when hit by venom
  6019. *
  6020. * @return the venom damage
  6021. */
  6022. public byte getVenomDamage() {
  6023. return venomDamage;
  6024. }
  6025.  
  6026. /**
  6027. * The time in milliseconds that the player healed themselves of venom
  6028. *
  6029. * @return the last time the player cured themself of poison
  6030. */
  6031. public long getLastVenomCure() {
  6032. return lastVenomCure;
  6033. }
  6034.  
  6035. /**
  6036. * Sets the time in milliseconds that the player cured themself of poison
  6037. *
  6038. * @param lastPoisonCure
  6039. * the last time the player cured themselves
  6040. */
  6041. public void setLastVenomCure(long lastVenomCure) {
  6042. this.lastVenomCure = lastVenomCure;
  6043. }
  6044.  
  6045. /**
  6046. * Mutates the current hitmark to be that of the new hitmark. This is
  6047. * commonly done in battle.
  6048. *
  6049. * @param hitmark
  6050. * the hitmark
  6051. */
  6052. public void setSecondHitmark(Hitmark secondHitmark) {
  6053. this.secondHitmark = secondHitmark;
  6054. }
  6055.  
  6056. /**
  6057. * The time in milliseconds that the player healed themselves of poison
  6058. *
  6059. * @return the last time the player cured themself of poison
  6060. */
  6061. public long getLastPoisonCure() {
  6062. return lastPoisonCure;
  6063. }
  6064.  
  6065. /**
  6066. * Sets the time in milliseconds that the player cured themself of poison
  6067. *
  6068. * @param lastPoisonCure
  6069. * the last time the player cured themselves
  6070. */
  6071. public void setLastPoisonCure(long lastPoisonCure) {
  6072. this.lastPoisonCure = lastPoisonCure;
  6073. }
  6074.  
  6075. /**
  6076. * Retrieves the current hitmark
  6077. *
  6078. * @return the hitmark
  6079. */
  6080. public Hitmark getHitmark() {
  6081. return hitmark;
  6082. }
  6083.  
  6084. /**
  6085. * Retrieves the second hitmark
  6086. *
  6087. * @return the second hitmark
  6088. */
  6089. public Hitmark getSecondHitmark() {
  6090. return secondHitmark;
  6091. }
  6092.  
  6093. public RandomEventInterface getInterfaceEvent() {
  6094. return randomEventInterface;
  6095. }
  6096.  
  6097. /**
  6098. * The interface that is currently open
  6099. */
  6100. private int interfaceOpen;
  6101.  
  6102. /**
  6103. * Modifies the current interface open
  6104. *
  6105. * @param interfaceOpen
  6106. * the interface id
  6107. */
  6108. public void setInterfaceOpen(int interfaceOpen) {
  6109. this.interfaceOpen = interfaceOpen;
  6110. }
  6111.  
  6112. /**
  6113. * The interface that is opened
  6114. *
  6115. * @return the interface id
  6116. */
  6117. public int getInterfaceOpen() {
  6118. return interfaceOpen;
  6119. }
  6120.  
  6121. public long setBestZulrahTime(long bestZulrahTime) {
  6122. return this.bestZulrahTime = bestZulrahTime;
  6123. }
  6124.  
  6125. public long getBestZulrahTime() {
  6126. return bestZulrahTime;
  6127. }
  6128.  
  6129. public LostItems getLostItems() {
  6130. if (lostItems == null) {
  6131. lostItems = new LostItems(this);
  6132. }
  6133. return lostItems;
  6134. }
  6135.  
  6136. public int getToxicBlowpipeCharge() {
  6137. return toxicBlowpipeCharge;
  6138. }
  6139.  
  6140. public void setToxicBlowpipeCharge(int charge) {
  6141. this.toxicBlowpipeCharge = charge;
  6142. }
  6143.  
  6144. public int getToxicBlowpipeAmmo() {
  6145. return toxicBlowpipeAmmo;
  6146. }
  6147.  
  6148. public int getToxicBlowpipeAmmoAmount() {
  6149. return toxicBlowpipeAmmoAmount;
  6150. }
  6151.  
  6152. public void setToxicBlowpipeAmmoAmount(int amount) {
  6153. this.toxicBlowpipeAmmoAmount = amount;
  6154. }
  6155.  
  6156. public void setToxicBlowpipeAmmo(int ammo) {
  6157. this.toxicBlowpipeAmmo = ammo;
  6158. }
  6159.  
  6160. public int getSerpentineHelmCharge() {
  6161. return this.serpentineHelmCharge;
  6162. }
  6163.  
  6164. public int getToxicStaffOfDeadCharge() {
  6165. return this.toxicStaffOfDeadCharge;
  6166. }
  6167.  
  6168. public void setSerpentineHelmCharge(int charge) {
  6169. this.serpentineHelmCharge = charge;
  6170. }
  6171.  
  6172. public void setToxicStaffOfDeadCharge(int charge) {
  6173. this.toxicStaffOfDeadCharge = charge;
  6174. }
  6175.  
  6176. public int getTridentCharge() {
  6177. return tridentCharge;
  6178. }
  6179.  
  6180. public void setTridentCharge(int tridentCharge) {
  6181. this.tridentCharge = tridentCharge;
  6182. }
  6183.  
  6184. public int getToxicTridentCharge() {
  6185. return toxicTridentCharge;
  6186. }
  6187.  
  6188. public void setToxicTridentCharge(int toxicTridentCharge) {
  6189. this.toxicTridentCharge = toxicTridentCharge;
  6190. }
  6191.  
  6192. public static final int maxPlayerListSize = Config.MAX_PLAYERS;
  6193. public static final int maxNPCListSize = NPCHandler.maxNPCs;
  6194. protected static Stream playerProps;
  6195. public static boolean acbSpec = false;
  6196. public static boolean ballistaSpec = false;
  6197. public static boolean bpSpec = false;
  6198. public static boolean grabProjectile = false;
  6199.  
  6200. static {
  6201. playerProps = new Stream(new byte[100]);
  6202. }
  6203.  
  6204. public void updateRank() {
  6205. if (amDonated >= 10 && amDonated < 30 && getRights().getValue() == 0) {
  6206. setRights(Rights.CONTRIBUTOR);
  6207. }
  6208. if (amDonated >= 30 && amDonated < 75 && getRights().getValue() <= 5 && !getRights().isStaff()) {
  6209. setRights(Rights.SPONSOR);
  6210. }
  6211. if (amDonated >= 75 && amDonated < 150 && getRights().getValue() <= 6 && !getRights().isStaff()) {
  6212. setRights(Rights.SUPPORTER);
  6213. }
  6214. if (amDonated >= 150 && amDonated < 300 && getRights().getValue() <= 7 && !getRights().isStaff()) {
  6215. setRights(Rights.V_I_P);
  6216. }
  6217. if (amDonated >= 300 && !getRights().isStaff()) {
  6218. setRights(Rights.SUPER_V_I_P);
  6219. }
  6220. }
  6221.  
  6222. public QuickPrayer getQuick() {
  6223. return quick;
  6224. }
  6225.  
  6226. public Killstreak getKillstreaks() {
  6227. return killstreaks;
  6228. }
  6229.  
  6230. public void setKillstreaks(Killstreak killstreaks) {
  6231. this.killstreaks = killstreaks;
  6232. }
  6233.  
  6234. public int screenBrightness = 2, musicLevel = 1, soundLevel = 1, areaLevel = 1, mouseButtons = 1, clickState = 1;
  6235. public boolean splitPrivateChat, acceptAid = true, showOrbs, hideRoofs, mouseCameraScroll;
  6236. public boolean acceptAidOn;
  6237.  
  6238. /**
  6239. * The option value used for npc dialogues.
  6240. */
  6241.  
  6242. public void setSplitPrivateChat(boolean splitPrivateChat) {
  6243. this.splitPrivateChat = splitPrivateChat;
  6244. getPA().setConfig(287, splitPrivateChat ? 1 : 0);
  6245. }
  6246.  
  6247. public int getMouseButtons() {
  6248. return mouseButtons;
  6249. }
  6250.  
  6251. public void setMouseButtons(int mouseButtons) {
  6252. this.mouseButtons = mouseButtons;
  6253. getPA().setConfig(170, mouseButtons == 2 ? 0 : 1);
  6254. getPA().setConfig(313, mouseButtons == 2 ? 1 : 0);
  6255. }
  6256.  
  6257. public void setAcceptAid(boolean acceptAid) {
  6258. this.acceptAid = acceptAid;
  6259. getPA().setConfig(304, acceptAid ? 1 : 0);
  6260. getPA().setConfig(427, acceptAid ? 1 : 0);
  6261. }
  6262.  
  6263. public void setRoofs(boolean hideRoofs) {
  6264. this.hideRoofs = hideRoofs;
  6265. getPA().setConfig(307, hideRoofs ? 1 : 0);
  6266. getPA().sendString(":roofs:" + hideRoofs, -1);
  6267. }
  6268.  
  6269. public void setClickState(int clickState) {
  6270. this.clickState = clickState;
  6271. getPA().sendString(":clickstate:" + clickState, -1);
  6272. switch (clickState) {
  6273. case 1:
  6274. getPA().setConfig(315, 1);
  6275. getPA().setConfig(316, 0);
  6276. getPA().setConfig(317, 0);
  6277. break;
  6278. case 2:
  6279. getPA().setConfig(315, 0);
  6280. getPA().setConfig(316, 1);
  6281. getPA().setConfig(317, 0);
  6282. break;
  6283. case 3:
  6284. getPA().setConfig(315, 0);
  6285. getPA().setConfig(316, 0);
  6286. getPA().setConfig(317, 1);
  6287. break;
  6288. }
  6289. }
  6290.  
  6291. public void setMouseCameraScroll(boolean mouseCameraScroll) {
  6292. this.mouseCameraScroll = mouseCameraScroll;
  6293. getPA().sendString(":mousecamerascroll:" + mouseCameraScroll, -1);
  6294. getPA().setConfig(314, mouseCameraScroll ? 1 : 0);
  6295. }
  6296.  
  6297. public void setOrbs(boolean showOrbs) {
  6298. this.showOrbs = showOrbs;
  6299. getPA().setConfig(306, showOrbs ? 1 : 0);
  6300. getPA().sendString(":orbs:" + showOrbs, -1);
  6301. }
  6302.  
  6303. public void setScreenBrightness(int screenBrightness) {
  6304. this.screenBrightness = screenBrightness;
  6305.  
  6306. getPA().setConfig(166, screenBrightness);
  6307. switch (screenBrightness) {
  6308. case 1:
  6309. getPA().setConfig(505, 1);
  6310. getPA().setConfig(506, 0);
  6311. getPA().setConfig(507, 0);
  6312. getPA().setConfig(508, 0);
  6313. break;
  6314. case 2:
  6315. getPA().setConfig(505, 0);
  6316. getPA().setConfig(506, 1);
  6317. getPA().setConfig(507, 0);
  6318. getPA().setConfig(508, 0);
  6319. break;
  6320. case 3:
  6321. getPA().setConfig(505, 0);
  6322. getPA().setConfig(506, 0);
  6323. getPA().setConfig(507, 1);
  6324. getPA().setConfig(508, 0);
  6325. break;
  6326. case 4:
  6327. getPA().setConfig(505, 0);
  6328. getPA().setConfig(506, 0);
  6329. getPA().setConfig(507, 0);
  6330. getPA().setConfig(508, 1);
  6331. break;
  6332. }
  6333. }
  6334.  
  6335. private Attributes attributes = new Attributes();
  6336. public int pouch1;
  6337. public int pouch1N;
  6338. public int pouch2;
  6339. public int pouch2N;
  6340. public int pouch3;
  6341. public int pouch3N;
  6342. public int damagedealt;
  6343. public boolean hasRejuvinated = false;
  6344. public int addToCount;
  6345. public boolean showLocation = false;
  6346. public long CORP_TIME;
  6347. public boolean spawnbrid = false;
  6348. public long spawnSet;
  6349. public boolean preset;
  6350. public int dropChance;
  6351. public boolean checkingDonation;
  6352. public String inSafeZone;
  6353. public String inEdgeville;
  6354.  
  6355. @SuppressWarnings("unchecked")
  6356. public <T> T attr(int key) {
  6357. return (T) attributes.getAttribute(key);
  6358. }
  6359.  
  6360. public void attr(int key, Object value) {
  6361. attributes.setAttribute(key, value);
  6362. }
  6363.  
  6364. public void faceUpdate(int index) {
  6365. face = index;
  6366. faceUpdateRequired = true;
  6367. updateRequired = true;
  6368. }
  6369. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement