Advertisement
Guest User

Untitled

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