Advertisement
Guest User

Untitled

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