Advertisement
Guest User

Untitled

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