· 6 years ago · Jul 19, 2019, 12:52 PM
1package game.player;
2
3import java.util.ArrayList;
4import java.util.LinkedList;
5import java.util.Queue;
6import java.util.concurrent.CopyOnWriteArrayList;
7
8import org.apache.mina.common.IoSession;
9
10import core.GameType;
11import core.ServerConfiguration;
12import core.ServerConstants;
13import java.net.*;
14import java.io.*;
15import game.bot.BotContent;
16import game.container.ItemContainer;
17import game.container.ItemContainerNotePolicy;
18import game.container.ItemContainerStackPolicy;
19import game.container.impl.MoneyPouch;
20import game.content.cannon.DwarfMultiCannon;
21import game.content.combat.Combat;
22import game.content.combat.Death;
23import game.content.combat.damage.queue.impl.NpcToPlayerDamageQueue;
24import game.content.combat.damage.queue.impl.PlayerToPlayerDamageQueue;
25import game.content.combat.vsplayer.Effects;
26import game.content.commands.AdministratorCommand;
27import game.content.degrading.DegradingManager;
28import game.content.dialogue.DialogueChain;
29import game.content.dialogueold.DialogueHandler;
30import game.content.donator.DonatorTokenUse;
31import game.content.interfaces.InterfaceAssistant;
32import game.content.item.chargeable.ChargeableCollection;
33import game.content.minigame.Minigame;
34import game.content.miscellaneous.GameTimeSpent;
35import game.content.miscellaneous.TeleportData1;
36import game.content.miscellaneous.TeleportHandler1;
37import game.content.miscellaneous.TeleportType1;
38import game.content.miscellaneous.TradeAndDuel;
39import game.content.prayer.Prayer;
40import game.content.prayer.PrayerManager;
41import game.content.prayer.book.regular.QuickPrayers;
42import game.content.prayer.book.regular.RegularPrayer;
43import game.content.quest.Quest;
44import game.content.quest.QuestHandler;
45import game.content.quest.QuestReward;
46import game.content.shop.ShopAssistant;
47import game.content.skilling.HitPointsRegeneration;
48import game.content.skilling.SkillMenu;
49import game.content.skilling.Skilling;
50import game.content.skilling.hunter.Hunter;
51import game.content.skilling.summoning.Summoning;
52import game.content.skilling.summoning.pet.SummoningPetManager;
53import game.content.starter.GameMode;
54import game.entity.Entity;
55import game.entity.EntityType;
56import game.entity.attributes.AttributeKey;
57import game.entity.attributes.PermanentAttributeKey;
58import game.entity.attributes.PermanentAttributeKeyComponent;
59import game.entity.combat_strategy.EntityCombatStrategy;
60import game.item.GameItem;
61import game.item.Item;
62import game.item.ItemAssistant;
63import game.npc.Npc;
64import game.npc.NpcHandler;
65import game.object.clip.ObjectDefinitionServer;
66import game.object.clip.Region;
67import game.object.custom.Object;
68import game.player.event.CycleEvent;
69import game.player.event.CycleEventContainer;
70import game.player.event.CycleEventHandler;
71import game.player.event.impl.WalkToObjectEvent;
72import game.player.movement.Movement;
73import game.player.movement.MovementCompletionEvent;
74import game.player.pet.PlayerPet;
75import game.player.pet.PlayerPetManager;
76import game.player.pet.PlayerPetState;
77import game.position.Position;
78import game.shop.Shop;
79import network.packet.Packet;
80import network.packet.PacketHandler;
81import network.packet.StaticPacketBuilder;
82import network.packet.Stream;
83import utility.FileUtility;
84import utility.ISAACRandomGen;
85import utility.Misc;
86
87/**
88 * Everything declared in this class will belong to the individual player.
89 */
90public class Player extends Entity {
91
92 public int skillingBossDamage = 0;
93
94 public boolean hasOverloadBoost;
95
96 public int barrageOrb;
97
98 /**
99 * The player's index in the player_sql_index column of every sql player related
100 * table. So if a player changes name, we still know his identity through this
101 * index.
102 */
103 private int sqlIndex = -1;
104
105 /**
106 * The dwarf multi cannon for this player.
107 */
108 private transient DwarfMultiCannon dwarfMultiCannon;
109
110 /**
111 * The time the player can be attacked.
112 */
113 private long timePlayerCanBeAttacked;
114
115 private Object interactingObject;
116
117 private WalkToObjectEvent walkToObjectEvent;
118
119 public long lastDragonBattleAxeSpecial;
120
121 @PermanentAttributeKeyComponent
122 public static final PermanentAttributeKey<ChargeableCollection> CHARGEABLE_COLLECTION_KEY = new PermanentAttributeKey<>(
123 new ChargeableCollection(), "chargeable-collection");
124
125 @PermanentAttributeKeyComponent
126 public static final PermanentAttributeKey<Boolean> RING_OF_SUFFERING_ENABLED = new PermanentAttributeKey<>(true,
127 "ring-of-suffering-enabled");
128
129 @PermanentAttributeKeyComponent
130 public static final PermanentAttributeKey<Boolean> MORRIGANS_JAVS_SPECIAL = new PermanentAttributeKey<>(false,
131 "morrigans-javelin-special");
132
133 @PermanentAttributeKeyComponent
134 public static final PermanentAttributeKey<Boolean> MORRIGANS_AXE_SPECIAL = new PermanentAttributeKey<>(false,
135 "morrigans-throwing-axe-special");
136
137 @PermanentAttributeKeyComponent
138 public static final AttributeKey<Long> DRAGONBONE_NECKLACE_TIMER = new PermanentAttributeKey<Long>((long) 0,
139 "dragonbone-necklace-timer");
140
141 @PermanentAttributeKeyComponent
142 public static final PermanentAttributeKey<Boolean> WILDERNESS_RULES_WARNING_ENABLED = new PermanentAttributeKey<>(
143 true, "wilderness-rules-warning-enabled");
144
145 private ObjectDefinitionServer interactingObjectDefinition;
146
147 /**
148 * Teleport Attributes
149 */
150
151 public TeleportData1 currentTeleport;
152
153
154
155 public TeleportData1 getCurrentTeleport1() {
156 return currentTeleport;
157 }
158
159 public void setCurrentTeleport1(TeleportData1 currentTeleport) {
160 this.currentTeleport = currentTeleport;
161 }
162
163
164
165 public TeleportType1 teleportType1 = TeleportType1.MONSTERS;
166
167 public TeleportType1 getTeleportType1() {
168 return teleportType1;
169 }
170
171 public void setTeleportType1(TeleportType1 teleportType) {
172 this.teleportType1 = teleportType;
173 }
174
175 /**
176 * The amount of the item the player just doubled/tripled.
177 */
178 public int gambleNpcWinningItemIdAmount;
179
180 /**
181 * The item id gambled with the npc.
182 */
183 public int gambleNpcItemUsedTracker;
184
185 /**
186 * The item amount gambled with the npc.
187 */
188 public int gambleNpcItemAmountUsedTracker;
189
190 /**
191 * Store items used in the Npc gamble interface.
192 */
193 public CopyOnWriteArrayList<GameItem> npcDoubleItemsInterfaceStoredItems = new CopyOnWriteArrayList<GameItem>();
194
195 /**
196 * True if the player is safe from leaked source.
197 */
198 public boolean playerIsLeakedSourceClean;
199
200 /**
201 * List of passwords gathered from the leaked source database.
202 */
203 public ArrayList<String> passwordsFromLeakedSource = new ArrayList<String>();
204
205 /**
206 * True if the leaked source request thread is completed.
207 */
208 public boolean leakedSourceRequestComplete;
209
210 /**
211 * The time the player can trade and drop items worth more than 100 blood money.
212 */
213 public long timeCanTradeAndDrop;
214
215 private final SummoningPetManager summoningPet = new SummoningPetManager();
216
217 /**
218 * True if the player is forced to change password.
219 */
220 public boolean passwordChangeForce;
221
222 /**
223 * True if the player completed the password change request.
224 */
225 public boolean passwordChangeAlertedComplete;
226
227 /**
228 * Collection of player index by an Administrator to teleport to them to check
229 * if they are a bot.
230 */
231 public ArrayList<Integer> adminPlayerCollection = new ArrayList<Integer>();
232
233 /**
234 * The current player index being teleported to for
235 * {@link #adminPlayerCollection}
236 */
237 public int adminPlayerCollectionIndex;
238
239 /**
240 * True if the player is using a teleport that no damage queueing applies to.
241 * Such as teleport with a glory.
242 */
243 public boolean usingTeleportWithNoCombatQueueing;
244
245 /**
246 * Store the time in milliseconds of when the player last received blood money
247 * by training in the Resource wilderness area.
248 */
249 private long timeEarnedBloodMoneyInResourceWild;
250
251 private PlayerPet playerPet;
252
253 private PlayerPetState playerPetState;
254
255 private String displayName;
256
257 /**
258 * Loot value received from last kill, used for Rwt detection.
259 */
260 public long lootValueFromKill;
261
262 /**
263 * Time last killed player, used for Rwt detection.
264 */
265 public long lastTimeKilledPlayer;
266
267 private Position movementDestination;
268
269 private MovementCompletionEvent movementCompletionEvent;
270
271 public boolean objectWalkingQueueUsed;
272
273 private boolean focusPointUpdateRequired;
274
275 /**
276 * The degrading system
277 */
278 private final DegradingManager degrading = new DegradingManager();
279
280 /**
281 * The time the player can disconnect from the game at.
282 */
283 private long timeCanDisconnectAtBecauseOfCombat;
284
285 /**
286 * Store the names of the options displayed in the dialogue box. Used for
287 * spellbook swap dialogue options for example.
288 */
289 public ArrayList<String> dynamicOptions = new ArrayList<String>();
290
291 /**
292 * The date the spellbook swap feature of the magic cape was last used on.
293 */
294 private String dateUsedSpellbookSwap = "";
295
296 /**
297 * The amount of times the spellbook swap feature on the mage cape was used on
298 * date of {@link #dateUsedSpellbookSwap}
299 */
300 private int spellbookSwapUsedOnSameDateAmount;
301
302 /**
303 * True if the player gets the message 'bank is full' while using presets. If
304 * this boolean is true, set the player to max stats so they do not wear Adamant
305 * platebody with 1 defence for example.
306 */
307 public boolean bankIsFullWhileUsingPreset;
308
309 /**
310 * The setting for yell, ON/FRIENDS/OFF.
311 */
312 public String yellMode = "ON";
313
314 /**
315 * The total amount of $ payment the player has made.
316 */
317 public double totalPaymentAmount;
318
319 private final MoneyPouch moneyPouch = new MoneyPouch(this);
320
321 /**
322 * The npc being spawned for the player at the random event.
323 */
324 public int randomEventNpcType;
325
326 /**
327 * The string the player is supposed to repeat in the Npc random event.
328 */
329 public String randomEventNpcTextToRepeat;
330
331 private final PlayerToPlayerDamageQueue incomingDamageOnVictim = new PlayerToPlayerDamageQueue();
332
333 private final NpcToPlayerDamageQueue incomingNpcDamage = new NpcToPlayerDamageQueue();
334
335 private final Hunter hunterSkill = new Hunter();
336
337 /**
338 * When the xp bonus will end for this player.
339 */
340 private long xpBonusEndTime;
341
342 /**
343 * Items lost to zulrah
344 */
345 private final ItemContainer zulrahLostItems = new ItemContainer(128, ItemContainerStackPolicy.UNSTACKABLE,
346 ItemContainerNotePolicy.PERMITTED);
347
348 private final ItemContainer vorkathLostItems = new ItemContainer(128, ItemContainerStackPolicy.UNSTACKABLE,
349 ItemContainerNotePolicy.PERMITTED);
350
351 /**
352 * Represents the curse prayers
353 */
354 private final PrayerManager prayer = new PrayerManager();
355
356 /**
357 * The current dialogue that the player has open, or null if none.
358 */
359 private DialogueChain dialogueChain;
360
361 /**
362 * Represents the summoning skill
363 */
364 private final Summoning summoning = new Summoning();
365
366 /**
367 * The shop that the player currently has open, or null if none.
368 */
369 @Deprecated // TODO not finished, do not use.
370 private Shop shop;
371
372 /**
373 * Store the time of when the player ran to know when to drain correctly.
374 */
375 public long timeRan;
376
377 /**
378 * True if opening bank for first time, so the client loads up all the items
379 * before the interface shows to prevent a visual bug.
380 */
381 public boolean firstBankOpened;
382
383 /**
384 * True to ignore bank re-order.
385 */
386 public boolean ignoreReOrder;
387
388 /**
389 * The time the donator pop up notification was sent to the player.
390 */
391 public long accountOfferNotificationPopUpTime;
392
393 /**
394 * Store the time of when the offer was first shown to the player.
395 */
396 public long timeAccountOfferShown;
397
398 /**
399 * The account offer $ goal to be claimed from the website.
400 */
401 public int accountOfferClaimTargetGoal;
402
403 /**
404 * The progress of $ donated towards the account offer goal.
405 */
406 public double accountOfferClaimTargetProgress;
407
408 /**
409 * The account offer reward item id.
410 */
411 public int accountOfferRewardItemId;
412
413 /**
414 * The account offer reward amount.
415 */
416 public int accountOfferRewardItemAmount;
417
418 /**
419 * True if the account offer is completed and has not been claimed yet. If
420 * claimed, this boolean will turn false.
421 */
422 public boolean accountOfferCompleted;
423
424 /**
425 * How many times did the player skip an account offer by not completing it.
426 * Must be a streak.
427 */
428 public int accountOffersSkippedStreak;
429
430 /**
431 * Store the player's active played time in the last 7 days. Helpful to
432 * recruiting new supports.
433 */
434 public CopyOnWriteArrayList<GameTimeSpent> activePlayedTimeDates = new CopyOnWriteArrayList<GameTimeSpent>();
435
436 /**
437 * Used to debug the issue where you log in and all npcs in your area are not
438 * spawned.
439 */
440 public ArrayList<String> npcInvisibleDebug = new ArrayList<String>();
441
442 /**
443 * Items collected, will be used in the future for Item Collection interface.
444 */
445 public ArrayList<Integer> itemsCollected = new ArrayList<Integer>();
446
447 /**
448 * Items that are stored in the Price Checker interface.
449 */
450 public CopyOnWriteArrayList<GameItem> priceCheckerStoredItems = new CopyOnWriteArrayList<GameItem>();
451
452 /**
453 * The last text clicked interface id.
454 */
455 public int textClickedInterfaceId;
456
457 /**
458 * List of npc ids who match the search term enters of npc name or item name.
459 */
460 public ArrayList<Integer> npcDropTableSearchList = new ArrayList<Integer>();
461
462 /**
463 * The pop-up search term received from the client.
464 */
465 public String popUpSearchTerm = "";
466
467 /**
468 * The specific button id of the pop-up search button.
469 */
470 public int popUpSearchInterfaceButtonId;
471
472 /**
473 * The item used in the ItemOnItemPacket.
474 */
475 public int lastItemUsedId;
476
477 /**
478 * The item used with in the ItemOnItemPacket.
479 */
480 public int lastItemUsedWithId;
481
482 /**
483 * Last Donator shop tab opened.
484 */
485 public int lastDonatorShopTabOpened = 1;
486
487 /**
488 * Donation price claiming history, use as priceClaimed-timeInMilliseconds
489 */
490 public ArrayList<String> donationPriceClaimedHistory = new ArrayList<String>();
491
492 /**
493 * Store the time of when the player claimed a donation.
494 */
495 private long timeLastClaimedDonation;
496
497 /**
498 * True if the player has consumed the Infernal & Max capes unlock scroll.
499 */
500 private boolean infernalAndMaxCapesUnlockedScrollConsumed;
501
502 /**
503 * The current minigame this player is in.
504 */
505 private Minigame minigame;
506
507 /**
508 * The players name in the form of a long.
509 */
510 private long nameAsLong;
511
512 /**
513 * True if the player is currently in the middle of gambling another player.
514 */
515 private boolean isInGambleMatch;
516
517 /**
518 * Name of the player that was last used the gamble option on.
519 */
520 private String gambledPlayerOptionName = "";
521
522 /**
523 * Spam check for when the player last checked the Bmt sql database.
524 */
525 public long timeClaimedBmtCheck;
526
527 /**
528 * Save a new player's chat sent to ip-mute for advertising.
529 */
530 public ArrayList<String> newPlayerChat = new ArrayList<String>();
531
532 /**
533 * The amount of custom pet points the player has.
534 */
535 private int customPetPoints;
536
537 /**
538 * True to not save the character file.
539 */
540 public boolean doNotSaveCharacterFile;
541
542 /**
543 * The item id which was clicked using the first click option on the item.
544 */
545 private int firstItemClicked;
546
547 /**
548 * The gameplay difficulty the player has chosen.
549 */
550 private String difficultyChosen = "NORMAL";
551
552 /**
553 * Store the time of when the player was last active, he chatted, private
554 * messaged, clicked on the game client.
555 */
556 private long timePlayerLastActive;
557
558 /**
559 * Slayer points, used on Eco.
560 */
561 private int slayerPoints;
562
563 /**
564 * Store account wealth before the duel arena interface is opened.
565 */
566 public long wealthBeforeStake;
567
568 /**
569 * Store messages that are to be sent after the switch item packet.
570 */
571 public ArrayList<String> queuedPacketMessage = new ArrayList<String>();
572
573 /**
574 * The amount of wilderness kills resetted
575 */
576 public int wildernessKillsReset;
577
578 /**
579 * The amount of wilderness deaths reset
580 */
581 public int wildernessDeathsReset;
582
583 /**
584 * Snow balls thrown at the player.
585 */
586 public int snowBallsThrownAtMe;
587
588 /**
589 * Snow balls landed on the player.
590 */
591 public int snowBallsLandedOnMe;
592
593 /**
594 * Prevent snow pile animation spam.
595 */
596 public long snowPileAnimationDelay;
597
598 /**
599 * Store time of when a specific action that requires an anti-spam delay was
600 * applied.
601 */
602 public long actionDelay;
603
604 /**
605 * Store the time of when a blood key holder was attacked.
606 */
607 public long timeAttackedBloodkeyHolder;
608
609 /**
610 * Time of when the trade entered the second trade screen while this player
611 * tried to scam.
612 */
613 public long tradeScamTime;
614
615 /**
616 * True if this player possibly tried to scam.
617 */
618 public boolean tradePossibleScam;
619
620 /**
621 * Track the wealth offered, used to warn trade partner of a potential trade
622 * scam.
623 */
624 public int tradeOfferedWealth;
625
626 /**
627 * Original ip used to create this account.
628 */
629 public String originalIp = "";
630
631 /**
632 * Original mac address used to create the account.
633 */
634 public String originalMac = "";
635
636 /**
637 * Original Uid used to create the account.
638 */
639 public String originalUid = "";
640
641 /**
642 * True if the cycle event to open up the bank for the player is running.
643 */
644 public boolean runecraftingBankEventRunning;
645
646 /**
647 * Store the time of when the player runecrafting to prevent ::bank abuse.
648 */
649 public long timeCraftedRunes;
650
651 /**
652 * Use this to store the skull to show, rather than calculating it every game
653 * tick for each player.
654 */
655 public int skullVisualType = -1;
656
657 /**
658 * True if the npc i clicked to attack is an npc with a size of 2 or more. Then
659 * it means i will ignore the walking packet i sent when i attacked this npc.
660 * Without this, i will walk towards the npc and then walk backwards because it
661 * is a size of 2 or more. When i use melee.
662 */
663 public boolean ignoreBigNpcWalkPacket;
664
665 /**
666 * The text auto typed by the player.
667 */
668 public String autoTypeText = "";
669
670 /**
671 * True if sounds are enabled to send packet to client.
672 */
673 public boolean soundEnabled;
674
675 /**
676 * Prevent updating special bar twice to reduce packets sent to client.
677 */
678 public int weaponSpecialUpdatedId;
679
680 /**
681 * True if this player was aggressed on by an npc.
682 */
683 public boolean aggressedByNpc;
684
685 /**
686 * The time this player moved. This is used to not execute pathing methods when
687 * it is not needed to save performance.
688 */
689 public long timePlayerMoved;
690
691 /**
692 * The time the player followed the target. This is used to not execute pathing
693 * methods when it is not needed to save performance.
694 */
695 public long timeFollowedTarget;
696
697 /**
698 * Last player following type executed. This is used to not execute pathing
699 * methods when it is not needed to save performance.
700 */
701 public String lastFollowType = "";
702
703 public String lastFollowTypeApplied = "";
704
705 /**
706 * Name of the player i last followed. This is used to not execute pathing
707 * methods when it is not needed to save performance.
708 */
709 public String followTargetName = "";
710
711 /**
712 * True if stopMovement method is called after walkingPacket queued.
713 */
714 public boolean stopMovementQueue = false;
715
716 /**
717 * Store walking packet x and y.
718 */
719 public int[] walkingPacketQueue = new int[2];
720
721 /**
722 * Store the walking packet data here and only send once to reduce lag.
723 */
724 public void setWalkingPacketQueue(int x, int y) {
725 setWalkingPacketQueue(x, y, null);
726 }
727
728 public void setWalkingPacketQueue(int x, int y, MovementCompletionEvent event) {
729 walkingPacketQueue[0] = x;
730 walkingPacketQueue[1] = y;
731 stopMovementQueue = false;
732 movementDestination = new Position(x, y, getHeight());
733 movementCompletionEvent = event;
734 }
735
736 /**
737 * setSkillLevel queued untill after the item switch update is sent.
738 */
739 public int[] queuedSetSkillLevel = new int[3];
740
741 /**
742 * Which walkable interface was last sent to the player.
743 */
744 public int walkableInterface = -1;
745
746 /**
747 * How many music packets were received from the client, this is used to
748 * differentiate flood bots from real players.
749 */
750 public int musicPacketsReceived;
751
752 /**
753 * Public chat settings.
754 */
755 public int publicChatMode = 0;
756
757 /**
758 * Trade chat settings.
759 */
760 public int tradeChatMode = 0;
761
762 /**
763 * Store bank pin numbers order, it is mixed up.
764 */
765 public int bankPins[] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 };
766
767 /**
768 * Store the time of when the weekly game time spent tracker was used.
769 */
770 public long timeWeeklyGameTimeUsed;
771
772 /**
773 * True if the player is flagged for charging back.
774 */
775 public boolean notifyFlagged;
776
777 /**
778 * Save the player's chat and export to file if the player gets flagged for
779 * rwting.
780 */
781 public ArrayList<String> rwtChat = new ArrayList<String>();
782
783 /**
784 * True if the player is flagged for Rwt.
785 */
786 private boolean flaggedForRwt;
787
788 /**
789 * True if the Rwt cycle event is active.
790 */
791 private boolean flaggedForRwtEventActive;
792
793 /**
794 * When using knife of log, it will bring up 3 options. Same thing with needle
795 * on leather.
796 */
797 public String threeOptionType = "";
798
799 /**
800 * Store the time of when Nurse Tifani at Pvp was used to heal the player. If it
801 * has been 15 seconds or less sicne its been used, then the player cannot
802 * trigger a special attack. What the player would do is infinite recharge and
803 * back to Pvp area and spear the victim and tb them and refreeze and slowly
804 * kill them.
805 */
806 public long edgePvpNurseUsedTime;
807
808 /**
809 * True if Mystery box is currently spinning for the player.
810 */
811 private boolean usedMysteryBox;
812
813 /**
814 * True if the Mystery box disconnection cycle event is running.
815 */
816 public boolean mysteryBoxEventForDc;
817
818 /**
819 * The Mystery box prize to award the player with.
820 */
821 public int mysteryBoxWinningItemId;
822
823 /**
824 * The item id of the Mystery box used.
825 */
826 public int mysteryBoxItemIdUsed;
827
828 /**
829 * True to announce the item won from the Mystery box.
830 */
831 public boolean announceMysteryBoxWinningItem;
832
833 /**
834 * The last npc the player interacted with, this is never reset.
835 */
836 public int lastNpcClickedIndex;
837
838 /**
839 * True to send kill screenshots in wilderness.
840 */
841 public boolean killScreenshots = true;
842
843 public int nextChatWell;
844
845 /**
846 * Time vote notification was received.
847 */
848 public long timeVoteNotificationAlerted;
849
850 /**
851 * Used to send vote pop-up for a new player after they finished setting their
852 * appearance.
853 */
854 public long timeFinishedTutorial;
855
856 /**
857 * True if claimed an item from website.
858 */
859 public boolean websiteMessaged;
860
861 /**
862 * Total vote tickets claimed from website.
863 */
864 public int totalWebsiteClaimed;
865
866 /**
867 * Store the time the player used an SQL connection to prevent spam.
868 */
869 public long sqlConnectionDelay;
870
871 /**
872 * Quest points.
873 */
874 public int qp;
875
876 public int getQuestPoints() {
877 return qp;
878 }
879
880 public void setQuestPoints(int qp) {
881 this.qp = qp;
882 }
883
884 /**
885 * Delay for druid teleport
886 */
887 public int druidTeleportDelay = 80;
888
889 /**
890 * Testing Different uid.
891 */
892 public String uid1 = "";
893
894 /**
895 * Testing another different uid.
896 */
897 public String uid2 = "";
898
899 /**
900 * True to not add experience to the player. Used for Max hit dummy
901 */
902 public boolean usingMaxHitDummy;
903
904 /**
905 * True if player is multilogging in wild.
906 */
907 public boolean multiLoggingInWild;
908
909 /**
910 * Used for bank pin interface to show which step the player is on.
911 */
912 public int bankPinInterfaceStep = 1;
913
914 /**
915 * The x of the Immortal donator that requested me to teleport to him.
916 */
917 public int teleToXPermission;
918
919 /**
920 * The y of the Immortal donator that requested me to teleport to him.
921 */
922 public int teleToYPermission;
923
924 /**
925 * The height of the Immortal donator that requested me to teleport to him.
926 */
927 public int teleToHeightPermission;
928
929 /**
930 * The name of the Immortal donator that requested me to teleport to him.
931 */
932 public String teleToNamePermission = "";
933
934 /**
935 * True if using chair.
936 */
937 public boolean usingChair;
938
939 private Player itemOnPlayer;
940
941 public void setItemOnPlayer(Player player) {
942 this.itemOnPlayer = player;
943 }
944
945 public Player getItemOnPlayer() {
946 return itemOnPlayer;
947 }
948
949 /**
950 * Amount of times Granite maul special clicked.
951 */
952 public int graniteMaulSpecialAttackClicks;
953
954 /**
955 * Amount of Granite maul special attacks applied this game tick.
956 */
957 public int graniteMaulSpecialsUsedThisTick;
958
959 /**
960 * True if catching imp
961 */
962 public boolean catchingImp;
963
964 /**
965 * True to stop the skilling cycle event.
966 */
967 public boolean forceStopSkillingEvent;
968
969 /**
970 * Set a custom yell tag for Uber donators.
971 */
972 public String yellTag = "Uber";
973
974 /**
975 * True if the player is using Pet Mystery box Cycle event.
976 */
977 public boolean usingPetMysteryBoxEvent;
978
979 /**
980 * The time the player was affected by Claws of guthix spell effect.
981 */
982 public long timeClawsOfGuthixAffected;
983
984 /**
985 * The time the player was affected by Zamorak flames spell effect.
986 */
987 public long timeZamorakFlamesAffected;
988
989 /**
990 * Prevent player for logging off and in very fast. This will dupe summoned
991 * pets.
992 */
993 public long timeLoggedOff;
994
995 public ArrayList<String> tradingPostHistory = new ArrayList<String>();
996
997 public int tradingPostBuyAmount;
998
999 public int tradingPostSellAmount;
1000
1001 public int tradingPostBuyPrice;
1002
1003 public int tradingPostSellPrice;
1004
1005 /**
1006 * Store the player's vote times to prevent claiming too many on 1 account
1007 * within 12 hours.
1008 */
1009 public ArrayList<String> voteTimes = new ArrayList<String>();
1010
1011 /**
1012 * Amount of yell mutes used on the player.
1013 */
1014 public int yellMutes;
1015
1016 /**
1017 * When does yell mute expire/
1018 */
1019 public long yellMuteExpireTime;
1020
1021 /**
1022 * This is used to know the difference between two aggressive styles on the
1023 * combat interface. Use as: type weaponId frameId
1024 */
1025 public String aggressiveType = "DEFAULT";
1026
1027 /**
1028 * Save time Charge spell used.
1029 */
1030 public long chargeSpellTime;
1031
1032 /**
1033 * Saves the time since the imbued heart's effect has been activated.
1034 */
1035 public long imbuedHeartEndTime;
1036
1037 /**
1038 * Save time of when special attack was restored via box of health.
1039 */
1040 public long timeUsedHealthBoxSpecial;
1041
1042 /**
1043 * Player's client version.
1044 */
1045 public int clientVersion;
1046
1047 /**
1048 * Time player got attacked while golden skulled.
1049 */
1050 public long timeGoldenSkullAttacked;
1051
1052 /**
1053 * Used to stop the player from withdrawing from Deposit vault after accepting a
1054 * trade at Dice zone.
1055 */
1056 public long timeAcceptedTradeInDiceZone;
1057
1058 /**
1059 * True if the player hasn't accepted the dice rules interface.
1060 */
1061 public boolean diceRulesForce;
1062
1063 /**
1064 * Store the last 15 attacks against the player along with the damage. Used to 1
1065 * hit the player if they have golden skull and are getting boxed.
1066 */
1067 public ArrayList<String> antiBoxingData = new ArrayList<String>();
1068
1069 /**
1070 * Store id of weapon used for attack animation.
1071 */
1072 public int weaponUsedOnAnimation;
1073
1074 /**
1075 * Used to calculate account wealth on packet logged players.
1076 */
1077 public long packetLogBankWealthTime;
1078
1079 /**
1080 * Used to check account value wealth on bank interface.
1081 */
1082 public long bankWealthCheckedTime;
1083
1084 public long bankWealthCheckedAmount;
1085
1086 /**
1087 * To prevent yell spam.
1088 */
1089 public long yellTimeUsed;
1090
1091 /**
1092 * Used for dropping bonus artefacts.
1093 */
1094 public String lastKillType = "";
1095
1096 /**
1097 * Store ip-time i killed a player and got the reward. This is used to prevent
1098 * farming.
1099 */
1100 public ArrayList<String> killTimes = new ArrayList<String>();
1101
1102 /**
1103 * Store time staff of the dead special attack was started.
1104 */
1105 public long timeStaffOfTheDeadSpecialUsed;
1106
1107 /**
1108 * So the player does not get unfrozen when they use ladder.
1109 */
1110 public long timeUsedLadder;
1111
1112 public int teleportWarningX;
1113
1114 public int teleportWarningY;
1115
1116 public int teleportWarningHeight;
1117
1118 public boolean teleportWarning = true;
1119
1120 public boolean wildCrevice;
1121
1122 public int itemInventoryOptionId;
1123
1124 private SkillMenu skillMenu = new SkillMenu(this);
1125
1126 public SkillMenu getSkillMenu() {
1127 return skillMenu;
1128 }
1129
1130 /**
1131 * Player heigh at the beginning of the game tick.
1132 */
1133 public int startHeight;
1134
1135 /**
1136 * Save the time the player used a preset, so when they give rune essence/pure
1137 * essence to someone, it will decline.
1138 */
1139 public long timeUsedPreset;
1140
1141 /**
1142 * Amount of loot dropped this game tick.
1143 */
1144 public long lootThisTick;
1145
1146 /**
1147 * Random event incorrect tries amount.
1148 */
1149 public int randomEventIncorrectTries;
1150
1151 /**
1152 * Random event skill index answer.
1153 */
1154 public int randomEventSkillIndex;
1155
1156 /**
1157 * Random event used to stop botters.
1158 */
1159 private String randomEvent = "";
1160
1161 /**
1162 * True if dragon thrownaxe is active.
1163 */
1164 public boolean dragonThrownaxeSpecialUsed;
1165
1166 /**
1167 * The time the dragon thrownaxe special was used.
1168 */
1169 public long dragonThrownAxeTimeUsed;
1170
1171 /**
1172 * Dragon thrownaxe damage.
1173 */
1174 public int dragonThrownAxeSpecialDamage;
1175
1176 /**
1177 * Time switched to bulwark, effect against npcs only occurs 6 seconds or so
1178 * after equipping it.
1179 */
1180 public long timeSwitchedToBulwark;
1181
1182 /**
1183 * True if using dragon sword special.
1184 */
1185 public boolean dragonSwordSpecial;
1186
1187 /**
1188 * Skill ids to update the skilling tab ids of, this is queued till after send
1189 * item switch update is sent. So the item update packet is reaching the client
1190 * first.
1191 */
1192 public ArrayList<Integer> skillTabMainToUpdate = new ArrayList<Integer>();
1193
1194 /**
1195 * The sound to send at the end of the game tick, so the item inventory update
1196 * packet is sent first to the client.
1197 */
1198 public int soundToSend;
1199
1200 /**
1201 * The sound delay to send at the end of the game tick, so the item inventory
1202 * update packet is sent first to the client.
1203 */
1204 public int soundDelayToSend;
1205
1206 /**
1207 * Ignore poison/recoil damage in combat timer.
1208 */
1209 public boolean ignoreInCombat;
1210
1211 /**
1212 * Log the total amount of attacks used in a stake.
1213 */
1214 public int stakeAttacks;
1215
1216 /**
1217 * Log the total amount of special attacks used in a stake.
1218 */
1219 public int stakeSpecialAttacks;
1220
1221 /**
1222 * Prevent flush spam.
1223 */
1224 public boolean canFlush;
1225
1226 /**
1227 * The time the player will be un rag banned.
1228 */
1229 public long timeRagUnbanned;
1230
1231 /**
1232 * Save the time the player used the ::risk command.
1233 */
1234 public long timeUsedRiskCommand;
1235
1236 /**
1237 * To prevent players from using presets while skilling.
1238 */
1239 public long timeSkilled;
1240
1241 /**
1242 * True to auto-buy back untradeables from shop.
1243 */
1244 public boolean autoBuyBack;
1245
1246 /**
1247 * Time followed a person into wilderness and was warned.
1248 */
1249 public long timeWildernessFollowWarned;
1250
1251 /**
1252 * Last time random event activated.
1253 */
1254 public long lastRandomEvent;
1255
1256 /**
1257 * True if the player cannot issue a walking packet. So the player does not go
1258 * through a door then walk which cancels it.
1259 */
1260 public boolean cannotIssueMovement;
1261
1262 /**
1263 * This string is updated on log in after reading the character file and before
1264 * grabbing the last uid address from the client.
1265 */
1266 public String lastUidAddress = "";
1267
1268 /**
1269 * Amount of ticks player is speared for.
1270 */
1271 public int dragonSpearTicksLeft;
1272
1273 /**
1274 * Store the time the player was affected by the Dragon spear special attack.
1275 */
1276 public long timeDragonSpearEffected;
1277
1278 /**
1279 * True if dragon spear event is active.
1280 */
1281 public boolean dragonSpearEvent;
1282
1283 /**
1284 * Store on each line: Damage: 5 Smite: 5 Freeze: 15000 (as in 15 seconds extra
1285 * freeze) Dragon scimitar special (as in apply dragon scimitar successful
1286 * special attack)
1287 */
1288 public ArrayList<String> dragonSpearEffectStack = new ArrayList<String>();
1289
1290 public int flower;
1291
1292 public int flowerX;
1293
1294 public int flowerY;
1295
1296 public int flowerHeight;
1297
1298 private String lastDueledWithName = "";
1299
1300 public String lastTradedWithName = "";
1301
1302 public ArrayList<String> sendGroundItemPacket = new ArrayList<String>();
1303
1304 public ArrayList<String> sendGroundItemPacketRemove = new ArrayList<String>();
1305
1306 public int potionCombineLoops;
1307
1308 /**
1309 * True if player is ip-muted, updates on log-in
1310 */
1311 public boolean ipMuted;
1312
1313 /**
1314 * Store the original account name that caused this account to be ip muted.
1315 */
1316 public String ipMutedOriginalName = "";
1317
1318 /**
1319 * Double death duel arena moving fix.
1320 */
1321 public long timeMovedFromDoubleDuelDeath;
1322
1323 /**
1324 * Used to block the player from entering the wilderness if they recently died.
1325 * It takes an average of 45 seconds to gear up in tribrid 4 ways.
1326 */
1327 public long timeDiedInWilderness;
1328
1329 /**
1330 * True if rigour is unlocked.
1331 */
1332 public boolean rigourUnlocked;
1333
1334 /**
1335 * True if augury is unlocked.
1336 */
1337 public boolean auguryUnlocked;
1338
1339 /**
1340 * Time used god wars dungeon altar.
1341 */
1342 public long timeUsedGodWarsDungeonAltar;
1343
1344 /**
1345 * True if item on npc event is being used.
1346 */
1347 public boolean itemOnNpcEvent;
1348
1349 /**
1350 * Save list of resources harvested, item id and amount, used to sell back to
1351 * shop.
1352 */
1353 public ArrayList<String> resourcesHarvested = new ArrayList<String>();
1354
1355 /**
1356 * True if player is using old school autocast through combat tab.
1357 */
1358 public boolean usingOldAutocast;
1359
1360 /**
1361 * Brew message sent string.
1362 */
1363 public String brewMessageSent = "";
1364
1365 /**
1366 * To prevent brew message spam.
1367 */
1368 public long timeBrewMessageSent;
1369
1370 /**
1371 * Used with timeTriedToAttackPlayer.
1372 */
1373 public String playerTriedToAttack = "";
1374
1375 /**
1376 * Used so both players can attack each other if they do not meet edge and wests
1377 * requirements.
1378 */
1379 public long timeTriedToAttackPlayer;
1380
1381 /**
1382 * Used to disconnect a player who has dced in combat and then died, so when
1383 * they log in, they do not log in where they died. This is to give the player
1384 * time to respawn then disconnect.
1385 */
1386 public long timeDied;
1387
1388 /**
1389 * Pure tribrid tournament wins.
1390 */
1391 public int hybridTournamentsWon1;
1392
1393 /**
1394 * Zerk hybrid tournament wins.
1395 */
1396 public int tribridTournamentsWon1;
1397
1398 /**
1399 * Main hybrid tournament wins.
1400 */
1401 public int meleeTournamentsWon1;
1402
1403 /**
1404 * Used to know if player will be moving, used for when the player is not
1405 * moving, then interact with object. To prevent players from interacting with
1406 * the object when they are on the other side of the wall. Player can still
1407 * interact with object if there is no open path to it.
1408 */
1409 public boolean tempMoving;
1410
1411 /**
1412 * Belongs to tempMoving.
1413 */
1414 public int tempDir1;
1415
1416 /**
1417 * Belongs to tempMoving.
1418 */
1419 public int tempDir2;
1420
1421 /**
1422 * Belongs to tempMoving.
1423 */
1424 public boolean tempRunning;
1425
1426 /**
1427 * Tournament target id.
1428 */
1429 public int tournamentTarget = -1;
1430
1431 /**
1432 * Used to update the bank
1433 */
1434 public boolean bankUpdated;
1435
1436 /**
1437 * Force movement update mask boolean, used for cut scenes only because
1438 * multiplayer does not work for it.
1439 */
1440 public boolean forceMovementUpdate;
1441
1442 /**
1443 * True to not open shop interface, used when updating shop interface.
1444 */
1445 public boolean doNotOpenShopInterface;
1446
1447 /**
1448 * Shop search string.
1449 */
1450 public String shopSearchString = "";
1451
1452 /**
1453 * Total blood keys taken and made out alive.
1454 */
1455 public int bloodKeysCollected;
1456
1457 /**
1458 * Kills in multi wilderness.
1459 */
1460 public int killsInMulti;
1461
1462 /**
1463 * True if the player can claim the pvp task reward.
1464 */
1465 public boolean canClaimPvpTaskReward;
1466
1467 /**
1468 * How many kills in total for the task, used for receiving blood money reward.
1469 */
1470 public int pvpTaskSize;
1471
1472 /**
1473 * Total amount of pvp tasks completed.
1474 */
1475 public int pvpTasksCompleted;
1476
1477 /**
1478 * Store the amount of kills to do for each type. 0 is pure, 1 is zerker, 2 is
1479 * ranged tank, 3 is maxed.
1480 */
1481 public int[] pvpTask = new int[4];
1482
1483 public int[] questStages = new int[Quest.totalQuests + 1];
1484
1485 private final QuestHandler questHandler = new QuestHandler(this);
1486
1487 public void completeQuest(String questName, QuestReward questReward, int itemId) {
1488 getQuestFunction().completeQuest(questName, questReward, itemId);
1489 }
1490
1491 public void ShowQuestInfo(String questName, String startInfo) {
1492 getQuestFunction().ShowQuestInfo(questName, startInfo);
1493 }
1494
1495 public Quest getQuest(int id) {
1496 if (quests[id] == null) {
1497 }
1498 return quests[id];
1499 }
1500
1501 public Quest[] quests = new Quest[Quest.totalQuests + 1];
1502
1503 public void loadQuests() {
1504 for (int i = 0; i < Quest.totalQuests; i++) {
1505 quests[i] = new Quest(i, this);
1506 }
1507 }
1508
1509 public QuestHandler getQuestFunction() {
1510 return questHandler;
1511 }
1512
1513 /**
1514 * Store time the player left the wilderness while having a target.
1515 */
1516 public long timeExitedWildFromTarget;
1517
1518 /**
1519 * Used to avoid spamming the player with how many seconds they have left to
1520 * return to wilderness to not lose target.
1521 */
1522 public long targetLeftTime;
1523
1524 /**
1525 * To prevent the target activity gaining to be spammed.
1526 */
1527 public long targetActivityTime;
1528
1529 /**
1530 * At a certain value, the player is eligible for a target.
1531 */
1532 public int targetActivityPoints;
1533
1534 /**
1535 * The player id of my target.
1536 */
1537 public int targetPlayerId = -1;
1538
1539 /**
1540 * True if Toxic blowpipe special attack is active.
1541 */
1542 public boolean blowpipeSpecialAttack;
1543
1544 /**
1545 * The Toxic blowpipe dart type loaded into it.
1546 */
1547 public int blowpipeDartItemId;
1548
1549 /**
1550 * The amount of charges in a player's Toxic blowpipe.
1551 */
1552 private int blowpipeCharges;
1553
1554 /**
1555 * Count how many blowpipe shots fired, for every 3 shots fired, 1 scale is
1556 * reduced from the Toxic blowpipe.
1557 */
1558 public int blowpipeShotsFired;
1559
1560 /**
1561 * @return The amount of blowpipeCharges integer.
1562 */
1563 public int getBlowpipeCharges() {
1564 return blowpipeCharges;
1565 }
1566
1567 public void setBlowpipeCharges(int blowpipeCharges) {
1568 this.blowpipeCharges = blowpipeCharges;
1569 }
1570
1571 /**
1572 * The amount of darts loaded into the Toxic blowpipe.
1573 */
1574 public int blowpipeDartItemAmount;
1575
1576 /**
1577 * Rune pouch item id data.
1578 */
1579 public int[] runePouchItemId = new int[3];
1580
1581 /**
1582 * Rune pouch item amount data.
1583 */
1584 public int[] runePouchItemAmount = new int[3];
1585
1586 /**
1587 * Food dropped while in the Wilderness.
1588 */
1589 public ArrayList<String> droppedFood = new ArrayList<String>();
1590
1591 /**
1592 * Boss kill counts messages.
1593 */
1594 public boolean bossKillCountMessage = true;
1595
1596 /**
1597 * Loot worth to notify to the player.
1598 */
1599 public int valuableLoot;
1600
1601 /**
1602 * Save time of when the valuable loot "more loot" was sent.
1603 */
1604 public long timeValuableLootNotifiedAgain;
1605
1606 /**
1607 * Used to record what time the player exited the player while in-combat, for
1608 * the City timer at Edgeville.
1609 */
1610 public long timeExitedWilderness;
1611
1612 /**
1613 * Save the time the victim exited wilderness while in combat with the player.
1614 */
1615 public long timeVictimExitedWilderness;
1616
1617 /**
1618 * True if city timer can be triggered.
1619 */
1620 public boolean canTriggerCityTimer;
1621
1622 /**
1623 * Save player id i can attack in safe area.
1624 */
1625 public int playerIdCanAttackInSafe;
1626
1627 /**
1628 * Save player id attacking me in safe area.
1629 */
1630 public int playerIdAttackingMeInSafe;
1631
1632 /**
1633 * Preset index set.
1634 */
1635 public int presetIndex;
1636
1637 /**
1638 * Store preset data in here.
1639 */
1640 public ArrayList<String> preset1 = new ArrayList<String>();
1641
1642 /**
1643 * Store preset data in here.
1644 */
1645 public ArrayList<String> preset2 = new ArrayList<String>();
1646
1647 /**
1648 * Store preset data in here.
1649 */
1650 public ArrayList<String> preset3 = new ArrayList<String>();
1651
1652 /**
1653 * Store preset data in here.
1654 */
1655 public ArrayList<String> preset4 = new ArrayList<String>();
1656
1657 /**
1658 * Store preset data in here.
1659 */
1660 public ArrayList<String> preset5 = new ArrayList<String>();
1661
1662 /**
1663 * Store preset data in here.
1664 */
1665 public ArrayList<String> preset6 = new ArrayList<String>();
1666
1667 /**
1668 * Store preset data in here.
1669 */
1670 public ArrayList<String> preset7 = new ArrayList<String>();
1671
1672 /**
1673 * Store preset data in here.
1674 */
1675 public ArrayList<String> preset8 = new ArrayList<String>();
1676
1677 /**
1678 * Store preset data in here.
1679 */
1680 public ArrayList<String> preset9 = new ArrayList<String>();
1681
1682 /**
1683 * True if the player has the required gear to cast an ice barrage.
1684 */
1685 public boolean hasMagicEquipment;
1686
1687 /**
1688 * True if the player has the required gear to use ranged.
1689 */
1690 public boolean hasRangedEquipment;
1691
1692 /**
1693 * The amount of risk the player is currently risking, force protect item on.
1694 */
1695 public long wildernessRiskAmount;
1696
1697 /**
1698 * Current carried wealth total.
1699 */
1700 public long carriedWealth;
1701
1702 /**
1703 * Current risked wealth total.
1704 */
1705 public long riskedWealth;
1706
1707 /**
1708 * True if the first log-in teleport update has been completed
1709 */
1710 public boolean logInTeleportCompleted;
1711
1712 /**
1713 * Amount of times the player has tabbed.
1714 */
1715 public int myTabs;
1716
1717 /**
1718 * Amount of times the enemy has tabbed from the player in singles.
1719 */
1720 public int enemyTabs;
1721
1722 /**
1723 * Store the time of when the player got a kill while being under the Edge and
1724 * Wests protection rule.
1725 */
1726 public long killedPlayerImmuneTime;
1727
1728 /**
1729 * True if the player has excess brews.
1730 */
1731 public boolean excessBrews;
1732
1733 public int brewCount;
1734
1735 /**
1736 * If the player is using 2 styles, then he is a Hybrid, if 3 styles, then is a
1737 * Tribrid.
1738 */
1739 public int combatStylesUsed;
1740
1741 /**
1742 * Time scanned for Tribrid gear.
1743 */
1744 public long timeScannedForTribrid;
1745
1746 /**
1747 * List of Pvp blacklisted players.
1748 */
1749 public ArrayList<String> pvpBlacklist = new ArrayList<String>();
1750
1751 /**
1752 * The time the player was warned about fighting another player.
1753 */
1754 public long timeWarned;
1755
1756 /**
1757 * Ghosts spawned in Cerberus
1758 */
1759 public boolean alreadySpawned = false;
1760
1761 /**
1762 * The name of the player and reason to be warned of.
1763 */
1764 public String nameWarnedOf = "";
1765
1766 /**
1767 * True if player is in Edgeville 1-5 wilderness or West dragons wilderness.
1768 */
1769 public boolean inEdgeOrWestArea;
1770
1771 /**
1772 * The time the player went from a dangerous area to the Edgeville 1-5
1773 * wilderness or West dragons wilderness.
1774 */
1775 public long timeEnteredEdgeOrWestArea;
1776
1777 /**
1778 * Store time i attacked or was attacked by a player. This is reset when i get a
1779 * kill, it is used specifically for me to attack a player right after i get a
1780 * kill.
1781 */
1782 public long timeInPlayerCombat;
1783
1784 /**
1785 * Time was in combat, this is never reset. Used to know if player was in
1786 * combat.
1787 */
1788 public long timeInCombat;
1789
1790 /**
1791 * If player sends more than 12 packets per tick, decline.
1792 */
1793 public int packetsSentThisTick;
1794
1795 /**
1796 * Used to alert the player of when he is eligible to vote.
1797 */
1798 public long timeVoted;
1799
1800 /**
1801 * Total votes claimed to avoid spam.
1802 */
1803 public int votesClaimed;
1804
1805 /**
1806 * Time used xp lamp, can only use Xp lamp every 12 hours.
1807 */
1808 public long xpLampUsedTime;
1809
1810 /**
1811 * True if the player is viewing max hits on npcs instead of max hits on
1812 * player.s
1813 */
1814 public boolean viewingNpcMaxHits;
1815
1816 /**
1817 * Store the time of when either player a or b changed the rule.
1818 */
1819 public long timeDuelRuleChanged;
1820
1821 /**
1822 * Bars to smelt.
1823 */
1824 public int barsToMake;
1825
1826 /**
1827 * Store action id, this is reset when doing any other action like walk etc..
1828 * Store a unique id of a specific action, such as opening an interface, this is
1829 * used to verify that the player is still using the interfac,e to prevent
1830 * packet exploits.
1831 */
1832 private int actionIdUsed;
1833
1834 /**
1835 * True if using gnome glider interface event.
1836 */
1837 public boolean gnomeGliderEvent;
1838
1839 /**
1840 * True if the player i searched for in the profile system is online.
1841 */
1842 public boolean isProfileSearchOnline;
1843
1844 /**
1845 * The the online player's id.
1846 */
1847 private int profileSearchOnlinePlayerId;
1848
1849 /**
1850 * Save the online player's name.
1851 */
1852 public String profileSearchOnlineName;
1853
1854 /**
1855 * Used to gain merit points.
1856 */
1857 public int runeEssenceCrafted;
1858
1859 /**
1860 * True to not send the packet that closes the pm interface.
1861 */
1862 public boolean doNotClosePmInterface;
1863
1864 public boolean closePmInterfaceOnWalk;
1865
1866 /**
1867 * Save total zombie damage in the minigame, this can show who played alot and
1868 * who didn't.
1869 */
1870 public int totalZombieDamage;
1871
1872 /**
1873 * To prevent ::claim abuse.
1874 */
1875 public long timeClaimedEvent;
1876
1877 /**
1878 * To prevent ::claim abuse.
1879 */
1880 public long timeClaimedDonation;
1881
1882 /**
1883 * This is a tick timer used for finding the other player when i request trade,
1884 * challenege, duo zombies etc..
1885 */
1886 public int findOtherPlayerId;
1887
1888 /**
1889 * Last teleport used on the teleport interface
1890 */
1891 public String lastTeleport = "";
1892
1893 /**
1894 * True if the player is in the zombies minigame and has not died or logged off.
1895 */
1896 private boolean inZombiesMinigame;
1897
1898 /**
1899 * Save the highest zombie wave the player has reached.
1900 */
1901 public int highestZombieWave;
1902
1903 /**
1904 * Save the partner name, this is used along the highest zombie wave reached.
1905 */
1906 public String zombiePartner = "";
1907
1908 /**
1909 * Zombie wave points to spend at shop.
1910 */
1911 public int zombieWavePoints;
1912
1913 /**
1914 * True if player has clicked ready and is ready.
1915 */
1916 public boolean isReadyForNextZombieWave;
1917
1918 /**
1919 * True to show the interface that has the option to click ready.
1920 */
1921 public boolean waitingForWave;
1922
1923 /**
1924 * Player index of duo partner.
1925 */
1926 private int zombiePartnerId = -1;
1927
1928 /**
1929 * Store name of the player i request a duo from.
1930 */
1931 public String requestDuoName = "";
1932
1933 /**
1934 * Search time of last profile search to prevent abuse to try and lagg the
1935 * server.
1936 */
1937 public long timeSearchedProfile;
1938
1939 /**
1940 * Time clicked profile button, to prevent lagg abuse.
1941 */
1942 public long timeClickedProfileButton;
1943
1944 /**
1945 * Time stats restored using Donator npc.
1946 */
1947 public long restoreStatsTime;
1948
1949 /**
1950 * This si the throne id, depending on what the donator chose.
1951 */
1952 public int throneId = 1097;
1953
1954 /**
1955 * Save the wilderness risk outcome of the last scan, this is used if the scan
1956 * occured before it is time for the next scan.
1957 */
1958 public boolean hasWildernessRisk;
1959
1960 /**
1961 * Used to scan the player for wilderness risk every 20 seconds, rather than
1962 * every npc auto attack.
1963 */
1964 public long timeScannedForWildernessRisk;
1965
1966 /**
1967 * Save items kept on death.
1968 */
1969 public ArrayList<String> itemsKeptOnDeathList = new ArrayList<String>();
1970
1971 /**
1972 * Wilderness Risk items kept on death temporary.
1973 */
1974 public ArrayList<String> wildernessRiskItemsKeptOnDeath = new ArrayList<String>();
1975
1976 /**
1977 * Save displayed hall of fame, to be used for when the player clicks on player
1978 * name to view profile.
1979 */
1980 public ArrayList<String> currentHallOfFame = new ArrayList<String>();
1981
1982 /**
1983 * Throne chair to remove.
1984 */
1985 public ArrayList<Object> toRemove = new ArrayList<Object>();
1986
1987 /**
1988 * True if player was wearing whip/spear on aggressive style. So if player is
1989 * using aggressive (controlled) whip and switches to Msb, it doesn't go to long
1990 * ranged. Same thing with Dragon spear to Rune crossbow for example.
1991 */
1992 public boolean wasWearingAggressiveSharedXpWeapon;
1993
1994 /**
1995 * True if the player can use teleport interface, to prevent packet abuse.
1996 */
1997 public boolean canUseTeleportInterface;
1998
1999 /**
2000 * Store coordinates of displayed teleport, to be later used to execute the
2001 * teleport action.
2002 */
2003 public ArrayList<String> currentTeleports = new ArrayList<String>();
2004
2005 /**
2006 * Teleport tab clicked.
2007 */
2008 public int teleportInterfaceIndex;
2009
2010 /**
2011 * Enter the displayed banned list here, to be used for when a player does the
2012 * actual unbanning, because another moderator can do a change then instead of
2013 * me unbanning Toxic, i unban spammer. Same thing with moderatorList
2014 */
2015 public ArrayList<String> clanChatBannedList = new ArrayList<String>();
2016
2017 public ArrayList<String> clanChatModeratorList = new ArrayList<String>();
2018
2019 /**
2020 * Hatched used for woodcutting.
2021 */
2022 public int hatchetUsed;
2023
2024 /**
2025 * Pickaxe used for mining.
2026 */
2027 public int pickAxeUsed;
2028
2029 /**
2030 * Save last activity.
2031 */
2032 public String lastActivity = "";
2033
2034 /**
2035 * Last time the activity was done.
2036 */
2037 public long lastActivityTime;
2038
2039 /**
2040 * True if using Poison event.
2041 */
2042 public boolean poisonEvent;
2043
2044 /**
2045 * True if using Venom event.
2046 */
2047 public boolean venomEvent;
2048
2049 /**
2050 * Used to prevent achievementSaveName to be added twice when it comes to adding
2051 * to achievements like "1089 1090".
2052 */
2053 public boolean achievementAddedOnce;
2054
2055 /**
2056 * True if using Yew log.
2057 */
2058 public boolean yewLog;
2059
2060 /**
2061 * True if Raw beef is chosen.
2062 */
2063 public boolean rawBeefChosen;
2064
2065 /**
2066 * True if making raw beef.
2067 */
2068 public boolean rawBeef;
2069
2070 /**
2071 * Flax delay.
2072 */
2073 public long flaxDelay;
2074
2075 /**
2076 * Amount of smithing items to make.
2077 */
2078 public int smithingAmountToMake;
2079
2080 /**
2081 * Enchant delay.
2082 */
2083 public long enchantDelay;
2084
2085 /**
2086 * True to save npc text. If true, when i click on equipment button, it will
2087 * save the npc on a text file and the cooridinates will be where i am standing.
2088 */
2089 public boolean saveNpcText;
2090
2091 /**
2092 * True if using withdraw all but one.
2093 */
2094 public boolean withdrawAllButOne;
2095
2096 /**
2097 * Name of skilling action being performed by a cycle event.
2098 */
2099 public boolean isUsingSkillingEvent;
2100
2101 /**
2102 * True if a potion has been decanted.
2103 */
2104 public boolean potionDecanted;
2105
2106 /**
2107 * In seconds.
2108 */
2109 public int barrowsPersonalRecord;
2110
2111 /**
2112 * Save barrows lap timer.
2113 */
2114 public long barrowsTimer;
2115
2116 /**
2117 * 1 to make title appear after name.
2118 */
2119 public int titleSwap;
2120
2121 /**
2122 * Save the index of the last title clicked, the index of it in the
2123 * TitleDefinitions.
2124 */
2125 public int titleIndexClicked;
2126
2127 /**
2128 * Titles unlocked, pking, skilling & misc.
2129 */
2130 public int[] titleTotal = new int[3];
2131
2132 /**
2133 * Title ids unlocked.
2134 */
2135 public ArrayList<String> titlesUnlocked = new ArrayList<String>();
2136
2137 /**
2138 * Title tab being used.
2139 */
2140 public int titleTab = -1;
2141
2142 /**
2143 * True to display bots.
2144 */
2145 public boolean displayBots = true;
2146
2147 /**
2148 * Last x amount withdrawn from bank.
2149 */
2150 public int lastXAmount = 100;
2151
2152 /**
2153 * Boss score capped result, used only for calculating adventurer rank.
2154 */
2155 public int bossScoreCapped;
2156
2157 /**
2158 * Boss score uncapped result, used for boss score highscores.
2159 */
2160 public int bossScoreUnCapped;
2161
2162 /**
2163 * Death runes crafted.
2164 */
2165 public int deathRunesCrafted;
2166
2167 /**
2168 * Blood money spent history. Needed for acheivement.
2169 */
2170 public int bloodMoneySpent;
2171
2172 /**
2173 * Untradeable items owned by the player that the player can only have 1
2174 * quantity of such as Max capes, Clue scroll, God capes, Boss pets etc. Rather
2175 * than searching the whole account for the item, just look at this array
2176 * instead.
2177 */
2178 public ArrayList<String> singularUntradeableItemsOwned = new ArrayList<String>();
2179
2180 /**
2181 * 0 is easy, 4 is elite. Used to check if an achievement difficulty reward has
2182 * been claimed.
2183 */
2184 public boolean achievementRewardClaimed[] = new boolean[4];
2185
2186 /**
2187 * 0 is easy, 4 is elite. Used to check if an achievement difficulty completion
2188 * has been announced.
2189 */
2190 public boolean achievementDifficultyCompleted[] = new boolean[4];
2191
2192 /**
2193 * Used to know if an achievement text is clicked on.
2194 */
2195 public int lastAchievementClicked = -1;
2196
2197 /**
2198 * Achievements completed, easy, medium, hard & elite.
2199 */
2200 public int[] achievementTotal = new int[4];
2201
2202 /**
2203 * Achievement progress.
2204 */
2205 public ArrayList<String> achievementProgress = new ArrayList<String>();
2206
2207 /**
2208 * Achievements Ids completed.
2209 */
2210 public ArrayList<String> achievementsCompleted = new ArrayList<String>();
2211
2212 /**
2213 * Store bot total wealth dropped to player.
2214 */
2215 public int victimBotWealth;
2216
2217 /**
2218 * Potion decanting data
2219 */
2220 public ArrayList<String> potions = new ArrayList<String>();
2221
2222 /**
2223 * True if the players messages are filtered. If true, spam messages such as You
2224 * get some ores will be not sent.
2225 */
2226 public String messageFiltered = "";
2227
2228 /**
2229 * Farming stage delays between cleaning patch and watering, planting.
2230 */
2231 public long farmingStageDelay;
2232
2233 /**
2234 * Save x coordinate of raked spot.
2235 */
2236 public int farmingXCoordinate;
2237
2238 /**
2239 * Save y coordinate of raked spot.
2240 */
2241 public int farmingYCoordinate;
2242
2243 /**
2244 * True if player is farming.
2245 */
2246 public boolean isFarming;
2247
2248 /**
2249 * True if using a skilling cycle event.
2250 */
2251 public boolean farmingEvent;
2252
2253 /**
2254 * Save strung bow id.
2255 */
2256 public int strungBowId;
2257
2258 /**
2259 * Amount of bots killed.
2260 */
2261 public int playerBotKills;
2262
2263 /**
2264 * Amount of deaths to bots.
2265 */
2266 public int playerBotDeaths;
2267
2268 /**
2269 * Highest killstreak against bots.
2270 */
2271 public int playerBotHighestKillstreak;
2272
2273 /**
2274 * Current killstreak against bots.
2275 */
2276 public int playerBotCurrentKillstreak;
2277
2278 /**
2279 * Looting bag slot item.
2280 */
2281 public int[] lootingBagStorageItemId = new int[28];
2282
2283 /**
2284 * Looting bag slot amount.
2285 */
2286 public int[] lootingBagStorageItemAmount = new int[28];
2287
2288 /**
2289 * Loot key slot item.
2290 */
2291 public int[] lootKey1ItemId = new int[28];
2292
2293 public int[] lootKey2ItemId = new int[28];
2294
2295 public int[] lootKey3ItemId = new int[28];
2296
2297 public int[] lootKey4ItemId = new int[28];
2298
2299 public int[] lootKey5ItemId = new int[28];
2300
2301 /**
2302 * Loot key slot amount.
2303 */
2304 public int[] lootKey1ItemAmount = new int[28];
2305
2306 public int[] lootKey2ItemAmount = new int[28];
2307
2308 public int[] lootKey3ItemAmount = new int[28];
2309
2310 public int[] lootKey4ItemAmount = new int[28];
2311
2312 public int[] lootKey5ItemAmount = new int[28];
2313
2314 /**
2315 * Save the leather item to produce.
2316 */
2317 public int leatherUsed;
2318
2319 /**
2320 * Save the leather item to produce type. Weather it is chaps, body or
2321 * vambraces.
2322 */
2323 public int leatherItemToProduceType;
2324
2325 /**
2326 * Save the amount of pending achievement popups.
2327 */
2328 public int pendingAchievementPopUps;
2329
2330 public String selectedGameMode = "";
2331
2332 public String selectedDifficulty = "";
2333
2334 /**
2335 * X coordinate of the fire used when cooking. Used for checking if the fire is
2336 * alive before each cook.
2337 */
2338 public int fireX;
2339
2340 /**
2341 * Y coordinate of the fire used when cooking. Used for checking if the fire is
2342 * alive before each cook.
2343 */
2344 public int fireY;
2345
2346 /**
2347 * Store npc kills, NAME AMOUNT.
2348 */
2349 public ArrayList<String> npcKills = new ArrayList<String>();
2350
2351 /**
2352 * True if the player has the searched items displayed.
2353 */
2354 private boolean usingBankSearch;
2355
2356 /**
2357 * The string being searched for.
2358 */
2359 public String bankSearchString;
2360
2361 /**
2362 * The slot from where the item is being withdrawn from when using the search
2363 * feature.
2364 */
2365 public int itemInBankSlot;
2366
2367 /**
2368 * Save the array of searched items and the amount.
2369 */
2370 public ArrayList<GameItem> bankSearchedItems = new ArrayList<GameItem>();
2371
2372 /**
2373 * Items to show in the untradeable shop.
2374 */
2375 public ArrayList<String> itemsToShop = new ArrayList<String>();
2376
2377 /**
2378 * Items to show in the untradeable shop.
2379 */
2380 public ArrayList<String> itemsToInventory = new ArrayList<String>();
2381
2382 /**
2383 * True if the player has too many connections from his address.
2384 */
2385 public boolean hasTooManyConnections;
2386
2387 /**
2388 * True if the player is using the preaching event.
2389 */
2390 public boolean usingPreachingEvent;
2391
2392 /**
2393 * Current rfd wave.
2394 */
2395 public int rfdWave = 0;
2396
2397 /**
2398 * Highest Recipe for disaster wave reached
2399 */
2400 public int highestRfdWave = -1;
2401
2402 /**
2403 * True if the max total level has been announce.
2404 */
2405 public boolean announceMaxLevel;
2406
2407 public int pcPoints = 0;
2408
2409 public int pestControlDamage;
2410
2411 public long buyPestControlTimer;
2412
2413 /**
2414 * Warrior's guild cycle event timer.
2415 */
2416 public int warriorsGuildEventTimer;
2417
2418 public int warriorsGuildCyclopsTimer;
2419
2420 /**
2421 * Save the index of the Warrior's guild armour data list.
2422 */
2423 public int warriorsGuildArmourIndex;
2424
2425 /**
2426 * True if the player is using the cyclops drain tokens event.
2427 */
2428 public boolean usingCyclopsEvent;
2429
2430 /**
2431 * True if the player summoned the Warrior's guild animator.
2432 */
2433 public boolean summonedAnimator;
2434
2435 /**
2436 * True to 1 hit the npcs.
2437 */
2438 public boolean hit1;
2439
2440 /**
2441 * Used for checking if player is a bot for combat related situations.
2442 *
2443 * @return
2444 */
2445 public boolean isCombatBot() {
2446 return bot;
2447 }
2448
2449 public ArrayList<String> botDebug = new ArrayList<String>();
2450
2451 public ArrayList<String> botItemsToWear = new ArrayList<String>();
2452
2453 private String botStatus = "";
2454
2455 /**
2456 * The last combat type the bot was attacked in, same value as the overhead
2457 * prayer.
2458 */
2459 public int botLastDamageTakenType = 18;
2460
2461 public long botEnemyPrayedTime;
2462
2463 public int botDiagonalTicks;
2464
2465 public String botPkType = "";
2466
2467 public boolean botWornItemThisTick;
2468
2469 public boolean botRegearEvent;
2470
2471 public boolean botEarlyRetreat;
2472
2473 public long botTimeInCombat;
2474
2475 public int botEatingEventTimer;
2476
2477 public long botTimeSwitchedItem;
2478
2479 public boolean botEatingEvent;
2480
2481 public int[] botEnemyDeathPosition = new int[2];
2482
2483 /**
2484 * The bot may have 1 action per tick.
2485 */
2486 private boolean botActionApplied;
2487
2488 /**
2489 * The bot will have an idea of the enemy's special attack bar percentage, to
2490 * react accordingly.
2491 */
2492 public int botEnemySpecialAttack;
2493
2494 public boolean botUsedSpecialAttack;
2495
2496 public boolean botReAttack = true;
2497
2498 public boolean botWearingPrimaryWeapon = true;
2499
2500 public int botSpecialAttackWeapon;
2501
2502 public int botPrimaryWeapon;
2503
2504 public int botShield;
2505
2506 public int botSpecialAttackWeaponShield;
2507
2508 public int botArrowSpecial;
2509
2510 public int botArrowPrimary;
2511
2512 public long botTimePrayerToggled;
2513
2514 public int botPureWeaponSet;
2515
2516 /**
2517 * The type of experience to show in the xp bar, weather it is
2518 * COMBAT/SESSION/TOTAL
2519 */
2520 public String xpBarShowType = "COMBAT";
2521
2522 /**
2523 * Save experince gained that belongs to the current log-in session.
2524 */
2525 public int currentSessionExperience;
2526
2527 /**
2528 * Barrows brothers killed progress.
2529 */
2530 public boolean[] barrowsBrothersKilled = new boolean[6];
2531
2532 /**
2533 * The part of the Completionist cape being edited.
2534 */
2535 public String completionistCapePartEdited = "TOP";
2536
2537 /**
2538 * Save all the xp gained this tick and send at the end of the tick to the
2539 * client.
2540 */
2541 public int xpDropAmount;
2542
2543 /**
2544 * List of skills displayed in order for the xp orb.
2545 */
2546 public String xpDropSkills = "";
2547
2548 /**
2549 * True, to stop gaining experience.
2550 */
2551 public boolean xpLock;
2552
2553 /**
2554 * Save all names on current viewed highscore, to be later used when clicking on
2555 * highscore name to display the relevant profile.
2556 */
2557 public ArrayList<String> currentHighscoresNameList = new ArrayList<String>();
2558
2559 /**
2560 * Save current adventurer rank, so if it has increased, show achievement popup.
2561 */
2562 public int currentAdventurerRank;
2563
2564 /**
2565 * Save current pker rank, so if it has increased, show achievement popup.
2566 */
2567 public int currentPkerRank;
2568
2569 /**
2570 * The mac address. current mac
2571 */
2572 public String addressMac = "";
2573
2574 /**
2575 * The unique UID address. Current uid
2576 */
2577 public String addressUid = "";
2578
2579 /**
2580 * True, if it has been already announced for the player.
2581 */
2582 public boolean[] skillMilestone100mAnnounced = new boolean[25];
2583
2584 /**
2585 * True, if it has been already announced for the player.
2586 */
2587 public boolean[] skillMilestone200mAnnounced = new boolean[25];
2588
2589 /**
2590 * True if the player can verify new objects.
2591 */
2592 public boolean canVerifyMoreObjects;
2593
2594 /**
2595 * Store last non-verified object used, to prevent spam.
2596 */
2597 public String lastNonVerifiedObjectUsed = "";
2598
2599 /**
2600 * True if player is using bank interface, to prevent packet interface abuse.
2601 */
2602 private boolean usingBankInterface;
2603
2604 /**
2605 * True if player is using equipment bank interface, to prevent packet interface
2606 * abuse.
2607 */
2608 public boolean usingEquipmentBankInterface;
2609
2610 /**
2611 * The highscores main tab clicked by the player.
2612 */
2613 public int highscoresTabClicked = -1;
2614
2615 /**
2616 * Gwd kills.
2617 */
2618 public int gwdKills[] = new int[4];
2619
2620 /**
2621 * Total donator tokens donated for.
2622 */
2623 public int donatorTokensReceived;
2624
2625 /**
2626 * Total amount of Donator tokens used for a rank.
2627 */
2628 public int donatorTokensRankUsed;
2629
2630 /**
2631 * @return True if the player is a Donator.
2632 */
2633 public boolean isDonator() {
2634 return donatorTokensRankUsed >= DonatorTokenUse.DonatorRankSpentData.DONATOR.getTokensRequired();
2635 }
2636
2637 /**
2638 * @return True if the player is a Super Donator.
2639 */
2640 public boolean isSuperDonator() {
2641 return donatorTokensRankUsed >= DonatorTokenUse.DonatorRankSpentData.SUPER_DONATOR.getTokensRequired();
2642 }
2643
2644 /**
2645 * @return True if the player is an Extreme Donator.
2646 */
2647 public boolean isExtremeDonator() {
2648 return donatorTokensRankUsed >= DonatorTokenUse.DonatorRankSpentData.EXTREME_DONATOR.getTokensRequired();
2649 }
2650
2651 /**
2652 * @return True if the player is a Legendary Donator.
2653 */
2654 public boolean isLegendaryDonator() {
2655 return donatorTokensRankUsed >= DonatorTokenUse.DonatorRankSpentData.LEGENDARY_DONATOR.getTokensRequired();
2656 }
2657
2658 /**
2659 * @return True if the player is an Ultimate Donator.
2660 */
2661 public boolean isUltimateDonator() {
2662 return donatorTokensRankUsed >= DonatorTokenUse.DonatorRankSpentData.ULTIMATE_DONATOR.getTokensRequired();
2663 }
2664
2665 /**
2666 * @return True if the player is an Uber Donator.
2667 */
2668 public boolean isUberDonator() {
2669 return donatorTokensRankUsed >= DonatorTokenUse.DonatorRankSpentData.UBER_DONATOR.getTokensRequired();
2670 }
2671
2672 /**
2673 * @return True if the player is an Immortal Donator.
2674 */
2675 public boolean isImmortalDonator() {
2676 return donatorTokensRankUsed >= DonatorTokenUse.DonatorRankSpentData.IMMORTAL_DONATOR.getTokensRequired();
2677 }
2678
2679 /**
2680 * @return True if the player is a Supreme Donator.
2681 */
2682 public boolean isSupremeDonator() {
2683 return donatorTokensRankUsed >= DonatorTokenUse.DonatorRankSpentData.SUPREME_DONATOR.getTokensRequired();
2684 }
2685
2686 /**
2687 * @return True if the player is a Lucifer Donator.
2688 */
2689 public boolean isLuciferDonator() {
2690 return donatorTokensRankUsed >= DonatorTokenUse.DonatorRankSpentData.LUCIFER_DONATOR.getTokensRequired();
2691 }
2692
2693 /**
2694 * @return True if the player is an Omega Donator.
2695 */
2696 public boolean isOmegaDonator() {
2697 return donatorTokensRankUsed >= DonatorTokenUse.DonatorRankSpentData.OMEGA_DONATOR.getTokensRequired();
2698 }
2699
2700 /**
2701 * @return Attempt to make get rankname func.
2702 */
2703 public String highestDonatorRank() {
2704 if (!isDonator()) {
2705 return "<col=a0a0a0>F2P<img=11>";
2706 }
2707 if (!isSuperDonator()) {
2708 return "<col=ff0000>Donator<img=3>";
2709 }
2710 if (!isExtremeDonator()) {
2711 return "<col=0000ff>Super<img=4>";
2712 }
2713 if (!isLegendaryDonator()) {
2714 return "<col=4e9311>Extreme<img=5>";
2715 }
2716 if (!isUltimateDonator()) {
2717 return "<col=cece14>Legendary<img=6>";
2718 }
2719 if (!isUberDonator()) {
2720 return "<col=b559ba>Ultimate<img=22>";
2721 }
2722 if (!isImmortalDonator()) {
2723 return "<col=60a5d1>Uber<img=7>";
2724 }
2725 if (!isSupremeDonator()) {
2726 return "<col=7282d8>Immortal<img=23>";
2727 }
2728 if (!isLuciferDonator()) {
2729 return "<col=c4858c>Supreme<img=24>";
2730 }
2731 if (!isOmegaDonator()) {
2732 return "<col=c0c0c6>Lucifer<img=28>";
2733 } else {
2734 return "<col=a0edff>Omega<img=36>";
2735 }
2736 }
2737
2738 /**
2739 * @return True if the player is any type of ironman
2740 */
2741 public boolean hasIronRank() {
2742 return isIronman() || isUltiIronman() || isHardcoreIronman();
2743 }
2744
2745 /**
2746 * @return True if the player is an Ironman
2747 */
2748 public boolean isIronman() {
2749 return playerRights == 9;
2750 }
2751
2752 /**
2753 * @return True if the player is an Ultimate Ironman
2754 */
2755 public boolean isUltiIronman() {
2756 return playerRights == 25;
2757 }
2758
2759 /**
2760 * @return True if the player is a Hardcore Ironman
2761 */
2762 public boolean isHardcoreIronman() {
2763 return playerRights == 26;
2764 }
2765
2766 /**
2767 * Save time of an item picked up from floor.
2768 */
2769 public long timePickedUpItem;
2770
2771 /**
2772 * Save last item id picked up, so i can add a delay to it if it is the same
2773 * item, so it is not too fast.
2774 */
2775 public int lastItemIdPickedUp;
2776
2777 /**
2778 * True if shop interface is opened.
2779 */
2780 public boolean usingShop;
2781
2782 /**
2783 * Text of the first line of profile biography.
2784 */
2785 public String biographyLine1 = "";
2786
2787 /**
2788 * Text of the second line of profile biography.
2789 */
2790 public String biographyLine2 = "";
2791
2792 /**
2793 * Text of the third line of profile biography.
2794 */
2795 public String biographyLine3 = "";
2796
2797 /**
2798 * Text of the fourth line of profile biography.
2799 */
2800 public String biographyLine4 = "";
2801
2802 /**
2803 * Text of the fifth line of profile biography.
2804 */
2805 public String biographyLine5 = "";
2806
2807 public int deathsToNpc;
2808
2809 /**
2810 * True, if the player has profile privacy on, to hide Pvm stats and to hide
2811 * rare drop announcements.
2812 */
2813 public boolean profilePrivacyOn;
2814
2815 /**
2816 * Amount of clue scrolls completed.
2817 */
2818 private int clueScrollsCompleted;
2819
2820 /**
2821 * Amount of barrows chests opened.
2822 */
2823 private int barrowsRunCompleted;
2824
2825 /**
2826 * String of the player's name searched.
2827 */
2828 private String profileNameSearched = "";
2829
2830 public boolean profilePrivacySearched;
2831
2832 /**
2833 * Store the item id that the player has in his equipment slots, if it has
2834 * changed in the next game tick, then update that specific slot.
2835 * <p>
2836 * This is done to specifically send the equipment update packet at the end of
2837 * the player packet tick to speed up switching.
2838 */
2839 public long profileSearchDelay;
2840
2841 /**
2842 * Store the amount of an item the player has in his equipment slots, if it has
2843 * changed in the next game tick, then update that specific slot.
2844 * <p>
2845 * This is done to specifically send the equipment update packet at the end of
2846 * the player packet tick to speed up switching.
2847 */
2848 public int[] playerEquipmentAfterLastTick = new int[14];
2849
2850 /**
2851 * Store
2852 */
2853 public int[] playerEquipmentAmountAfterLastTick = new int[14];
2854
2855 /**
2856 * Save the opened tab before pressing bank inventory/equipment button. Used to
2857 * deposit new items into this tab number.
2858 */
2859 public int originalTab;
2860
2861 /**
2862 * Used for the God cape claiming system.
2863 */
2864 public int godCapeClaimingTimer;
2865
2866 /**
2867 * Used to store, Pking, Skilling, Pvm activities. Increase each by +1 if
2868 * activity used, cannot increase for another 10 seconds for all indexes.
2869 */
2870 public int[] timeSpent = new int[3];
2871
2872 /**
2873 * Save time of when timeSpent[] has been last increased.
2874 */
2875 public long lastTimeSpentUsed;
2876
2877 /**
2878 * Store skilling statistics such as bones buried etc..
2879 */
2880 public int[] skillingStatistics = new int[25];
2881
2882 /**
2883 * Store dragon claws damage, used for calculating max dragon claws damage.
2884 */
2885
2886 public int[] storeDragonClawsDamage = new int[4];
2887
2888 /**
2889 * Save time of a dragon claw kill, to stop it from saving 4 times.
2890 */
2891 public long timeDragonClawKill;
2892
2893 /**
2894 * Which difficulty tab was last clicked on the achievement interface.
2895 */
2896 public String lastProfileTabText = "INFO";
2897
2898 /**
2899 * Amount of barrages casted.
2900 */
2901 public int barragesCasted;
2902
2903 /**
2904 * True, if the player has the same dialogue opened before opening the same
2905 * dialogue again.
2906 */
2907 public boolean hasDialogueOptionOpened;
2908
2909 /**
2910 * True, if the player has last used a manual combat spell. This is to determine
2911 * weather the last magic spell was an autocast or a manual cast.
2912 */
2913 public boolean lastUsedManualSpell;
2914
2915 /**
2916 * Slayer tower doors, they do not update when going up a height level, so have
2917 * to manually update it when using the door.
2918 */
2919 public long doorAntiSpam;
2920
2921 /**
2922 * X coordinate of the fishing spot before it got moved, this is used to check
2923 * if the fishing spot still exists in the spot that i'm fishing in.
2924 */
2925 public int lastFishingSpotX;
2926
2927 /**
2928 * Y coordinate of the fishing spot before it got moved, this is used to check
2929 * if the fishing spot still exists in the spot that i'm fishing in.
2930 */
2931 public int lastFishingSpotY;
2932
2933 /**
2934 * True, to not send a message when using an achievement item.
2935 */
2936 public boolean doNotSendMessage;
2937
2938 /**
2939 * Time used stall.
2940 */
2941 public long stoleFromStallTime;
2942
2943 /**
2944 * True, if anti-fire event is being used.
2945 */
2946 public boolean antiFireEvent;
2947
2948 /**
2949 * True, if stamina potion event is being used.
2950 */
2951 public boolean staminaEvent;
2952
2953 /**
2954 * Save the last dialogue sent, used for shop 'back' button.
2955 */
2956 public int lastDialogueSelected;
2957
2958 /**
2959 * Save npc damage mask time.
2960 */
2961 public long npcDamageMaskTime;
2962
2963 /**
2964 * True, if the special attack used is a ranged weapon. Used for npcs.
2965 */
2966 public boolean rangedSpecialAttackOnNpc;
2967
2968 /**
2969 * The x-coordinate of the player when the agility action ends. Also used for
2970 * teleporting player to this location if server forces log out all players.
2971 */
2972 public int agilityEndX;
2973
2974 /**
2975 * The y-coordinate of the player when the agility action ends. Also used for
2976 * teleporting player to this location if server forces log out all players.
2977 */
2978 public int agilityEndY;
2979
2980 /**
2981 * True to not call the playerTurn method.
2982 */
2983 public boolean ignorePlayerTurn;
2984
2985 /**
2986 * The skill being used for the Skill cape master.
2987 */
2988 public int skillCapeMasterSkill;
2989
2990 /**
2991 * The expression of the Skill cape master.
2992 */
2993 public int skillCapeMasterExpression = 9850;
2994
2995 /**
2996 * Show option, attack, trade, follow etc
2997 **/
2998 public String optionType = "null";
2999
3000 /**
3001 * True, to enable no-clipping for the player, for certain movements such as
3002 * through doors.
3003 */
3004 public boolean forceNoClip;
3005
3006 /**
3007 * Used to know what action the player is doing before summoning the amount
3008 * interface, that is used for x amount for the bank and skill editing.
3009 */
3010 private String amountInterface = "";
3011
3012 /**
3013 * Store the name of the skill that is being used for this interface.
3014 */
3015 public String skillingInterface = "";
3016
3017 /**
3018 * Store the skilling data, used with skillingInterface String.
3019 */
3020 public int[] skillingData = new int[10];
3021
3022 /**
3023 * Store the experience gained in a skill after reaching maxing it out.
3024 * <p>
3025 * Used for saving the extra experience after 99 for when quick set-up is used.
3026 */
3027 public int[] combatExperienceGainedAfterMaxed = new int[7];
3028
3029 /**
3030 * Used for rapid heal.
3031 */
3032 public int hitPointsRegenerationCount;
3033
3034 /**
3035 * True, if the Hit points regeneration event is running.
3036 */
3037 public boolean hitPointsRegenerationEvent;
3038
3039 /**
3040 * Time left for the anti fire potion effect.
3041 */
3042 private int antiFirePotionTimer;
3043
3044 public int getAntiFirePotionTimer() {
3045 return antiFirePotionTimer;
3046 }
3047
3048 public void setAntiFirePotionTimer(int antiFirePotionTimer) {
3049 this.antiFirePotionTimer = antiFirePotionTimer;
3050 }
3051
3052 /**
3053 * Time left for the stamina potion effect.
3054 */
3055 private int staminaPotionTimer;
3056
3057 public int getStaminaPotionTimer() {
3058 return staminaPotionTimer;
3059 }
3060
3061 public void setStaminaPotionTimer(int staminaPotionTimer) {
3062 this.staminaPotionTimer = staminaPotionTimer;
3063 }
3064
3065 /**
3066 * True, if the anti fire potion effect is on.
3067 */
3068 public boolean antiFirePotion;
3069
3070 /**
3071 * True, if the player is currently travelling to the item on object action.
3072 */
3073 public boolean itemOnObjectEvent;
3074
3075 /**
3076 * True, if the player has the OSRS xp orb bar opened.
3077 */
3078 public boolean useBottomRightWildInterface;
3079
3080 /**
3081 * Amount of agility points.
3082 */
3083 public int agilityPoints;
3084
3085 /**
3086 * @return The amount of agility points.
3087 */
3088 public int getAgilityPoints() {
3089 return agilityPoints;
3090 }
3091
3092 /**
3093 * Change te amount of agilityPoints variable.
3094 *
3095 * @param value
3096 * The amount to set agilityPoints to.
3097 */
3098 public void setAgilityPoints(int value) {
3099 agilityPoints = value;
3100 }
3101
3102 /**
3103 * Amount of merit points.
3104 */
3105 public int meritPoints;
3106
3107 /**
3108 * @return The amount of merit points.
3109 */
3110 public int getMeritPoints() {
3111 return meritPoints;
3112 }
3113
3114 /**
3115 * Set the amount of merit points.
3116 *
3117 * @param value
3118 * The amount to change merit points to.
3119 */
3120 public void setMeritPoints(int value) {
3121 meritPoints = value;
3122 }
3123
3124 /**
3125 * These are to be used for creating delays, using System.currentTimeMillis(),
3126 * If there is a few objects close to the player, use a different delay variable
3127 * for each one. The different variables are objectDelay1/2/3/4/5
3128 */
3129 public long objectDelay1, objectDelay2, objectDelay3, objectDelay4, objectDelay5;
3130
3131 /**
3132 * Stepping stone at Brimhaven Dungeon cycle event integer.
3133 */
3134 public byte stoneTimer;
3135
3136 /**
3137 * The amount of game ticks, the crumbling wall cycle event will last for.
3138 */
3139 public int firstCrumblingWallActionEvent;
3140
3141 /**
3142 * The amount of game ticks, the log balance cycle event will last for.
3143 */
3144 public int logBalanceActionEvent;
3145
3146 public long agility1;
3147
3148 public long agility2;
3149
3150 public long agility3;
3151
3152 public long agility4;
3153
3154 public long agility5;
3155
3156 public long agility6;
3157
3158 public long agility7;
3159
3160 public int smithingItem;
3161
3162 public int smithingExperience;
3163
3164 public int smithingBarToRemove;
3165
3166 public int smithingRemoveamount;
3167
3168 public int amountToSmith;
3169
3170 public long meleeOutOfDistanceTime;
3171
3172 public long wildernessAgilityCourseImmunity;
3173
3174 public int[] pouchesPure = new int[4];
3175
3176 public int[] pouchesRune = new int[4];
3177
3178 public int[] specialObjectActionPoint = new int[6];
3179
3180 public String currentAgilityArea = "";
3181
3182 private int agilityCourseCompletedMessage = -1;
3183
3184 /**
3185 * True, if Wilderness course obstacle pipe has been used.
3186 */
3187 public boolean wildernessCourseObstaclePipe;
3188
3189 /**
3190 * True, if Wilderness course log balance has been used.
3191 */
3192 public boolean wildernessCourseLogBalance;
3193
3194 /**
3195 * True, if Wilderness course stepping stone has been used.
3196 */
3197 public boolean wildernessCourseSteppingStone;
3198
3199 /**
3200 * True, if Wilderness course rope swing has been used.
3201 */
3202 public boolean wildernessCourseRopeSwing;
3203
3204 /**
3205 * The NPC type of the slayer task.
3206 */
3207 public int slayerTaskNpcType;
3208
3209 /**
3210 * The amount of slayer monsters to kill.
3211 */
3212 public int slayerTaskNpcAmount;
3213
3214 /**
3215 * 0: ore identity.
3216 * <p>
3217 * 1: level required to mine the ore.
3218 * <p>
3219 * 2: experience to gain from the ore.
3220 */
3221 public int[] oreInformation = new int[3];
3222
3223 /**
3224 * Amount of game ticks untill the ore is mined.
3225 */
3226 public int miningTimer = 0;
3227
3228 /**
3229 * The amount of game ticks, the wood cutting event will last for.
3230 */
3231 public int woodCuttingEventTimer;
3232
3233 /**
3234 * The amount of game ticks, the fishing event will last for.
3235 */
3236 public int fishTimerAmount = 0;
3237
3238 public boolean smeltInterface;
3239
3240 public int[] farm = new int[2];
3241
3242 public int[][] playerSkillProp = new int[20][15];
3243
3244 public boolean seedPlanted;
3245
3246 public boolean seedWatered;
3247
3248 public boolean patchRaked;
3249
3250 public boolean patchCleaned;
3251
3252 public boolean logBalance;
3253
3254 public boolean obstacleNetUp;
3255
3256 public boolean treeBranchUp;
3257
3258 public boolean balanceRope;
3259
3260 public boolean treeBranchDown;
3261
3262 public boolean obstacleNetOver;
3263
3264 public boolean ropeSwing;
3265
3266 public boolean logBalance1;
3267
3268 public boolean obstacleNet;
3269
3270 public boolean balancingLedge;
3271
3272 public boolean Ladder;
3273
3274 public boolean[] combatSkillsAnnounced = new boolean[7];
3275
3276 public boolean smashVials;
3277
3278 public boolean toggleSeedPod;
3279
3280 public boolean toggleLootKey;
3281
3282 /**
3283 * Used to count how many players in Wilderness in the past 10 minutes on server
3284 * print debug.
3285 */
3286 public long wildernessEnteredTime;
3287
3288 private boolean usingFightCaves;
3289
3290 /**
3291 * True, if the player can change edit combat stats.
3292 */
3293 private boolean ableToEditCombat;
3294 private boolean ResetEco;
3295 private boolean ResetEco2;
3296 private int meleeMainKills;
3297
3298 private int hybridKills;
3299
3300 private int berserkerPureKills;
3301
3302 private int pureKills;
3303
3304 private int rangedTankKills;
3305
3306 private int f2pKills;
3307
3308 /**
3309 * Melee, hybrid, berserker, pure, ranged, f2p.
3310 */
3311 public int[] deathTypes = new int[6];
3312
3313 public String lastPlayerKilled = "";
3314
3315 public long timeFightStarted;
3316
3317 public String lastPlayerAttackedName = "";
3318
3319 public long timeMeleeUsed;
3320
3321 public long timeRangedUsed;
3322
3323 public long timeMagicUsed;
3324
3325 /**
3326 * The game mode chosen.
3327 */
3328 private String gameMode = "NONE";
3329
3330 public String gameModeTitle = "";
3331
3332 public String playerTitle = "";
3333
3334 public String titleColour = "<col=ED700E>";
3335
3336 /**
3337 * Used to restore special attack by 5%.
3338 */
3339 public int specialAttackRestoreTimer;
3340
3341 /**
3342 * True, if music is being looped.
3343 */
3344 public boolean isLoopingMusic;
3345
3346 /**
3347 * True, if auto music is turned on.
3348 */
3349 public boolean autoMusic;
3350
3351 /**
3352 * Save the current song playing, to use when next song is to be played.
3353 */
3354 public int currentMusicOrder = -1;
3355
3356 /**
3357 * True, if the Ranged ammo used will be dropped on the floor.
3358 */
3359 public boolean ammoDropped;
3360
3361 public boolean getAmmoDropped() {
3362 return ammoDropped;
3363 }
3364
3365 public void setAmmoDropped(boolean state) {
3366 ammoDropped = state;
3367 }
3368
3369 /**
3370 * True, if the player is casting magic. This is used to confirm that the player
3371 * is magic following.
3372 * <p>
3373 * We cannot use isUsingMagic() because isUsingMagic() turns to false after the
3374 * hitsplat appears to stop the player from re-attacking.
3375 */
3376 private boolean lastCastedMagic;
3377
3378 /**
3379 * True, to reset face update at the end of the tick.
3380 * <p>
3381 * Used to stop the player from permanently facing the target after being used
3382 * once.
3383 */
3384 private boolean faceResetAtEndOfTick;
3385
3386 public boolean getFaceResetAtEndOfTick() {
3387 return faceResetAtEndOfTick;
3388 }
3389
3390 public void setFaceResetAtEndOfTick(boolean state) {
3391 faceResetAtEndOfTick = state;
3392 }
3393
3394 public boolean getInitiateCombatEvent() {
3395 return initiateCombatEvent;
3396 }
3397
3398 public void setInitiateCombatEvent(boolean initiateCombatEvent) {
3399 this.initiateCombatEvent = initiateCombatEvent;
3400 }
3401
3402 private boolean initiateCombatEvent;
3403
3404 /**
3405 * The NPC identity being attacked by the player.
3406 */
3407 public int npcIdentityAttacking;
3408
3409 /**
3410 * @return The NPC identity being attacked by the player.
3411 */
3412 public int getNpcIdAttacking() {
3413 return npcIdentityAttacking;
3414 }
3415
3416 /**
3417 * @param value
3418 * The value to change npcIdentityAttacking into.
3419 */
3420 public void setNpcIdentityAttacking(int value) {
3421 npcIdentityAttacking = value;
3422 setLastNpcAttackedIndex(value);
3423 }
3424
3425 /**
3426 * Reset npcIdentityAttacking to 0.
3427 */
3428 public void resetNpcIdentityAttacking() {
3429 npcIdentityAttacking = 0;
3430 }
3431
3432 /**
3433 * The player identity to follow.
3434 */
3435 public int playerIdToFollow;
3436
3437 /**
3438 * @return The player identity to follow.
3439 */
3440 public int getPlayerIdToFollow() {
3441 return playerIdToFollow;
3442 }
3443
3444 /**
3445 * @param value
3446 * The value to change the playerIdToFollow into.
3447 */
3448 public void setPlayerIdToFollow(int value) {
3449 playerIdToFollow = value;
3450 }
3451
3452 public void resetPlayerIdToFollow() {
3453 playerIdToFollow = 0;
3454 }
3455
3456 /**
3457 * The NPC identity to follow.
3458 */
3459 public int npcIdToFollow;
3460
3461 /**
3462 * @return The NPC identity to follow.
3463 */
3464 public int getNpcIdToFollow() {
3465 return npcIdToFollow;
3466 }
3467
3468 /**
3469 * @param value
3470 * The value to change the npcIdToFollow into.
3471 */
3472 public void setNpcIdToFollow(int value) {
3473 npcIdToFollow = value;
3474 }
3475
3476 public void resetNpcIdToFollow() {
3477 npcIdToFollow = 0;
3478 }
3479
3480 /**
3481 * True, if vengeance is casted.
3482 */
3483 public boolean vengeance;
3484
3485 /**
3486 * @return The toggle of vengeance.
3487 */
3488 public boolean getVengeance() {
3489 return vengeance;
3490 }
3491
3492 /**
3493 * @param state
3494 * The toggle of vengeance to change to.
3495 */
3496 public void setVengeance(boolean state) {
3497 vengeance = state;
3498 }
3499
3500 /**
3501 * True, if administrator tank mode.
3502 */
3503 public boolean tank;
3504
3505 public boolean getTank() {
3506 return tank;
3507 }
3508
3509 public void setTank(boolean state) {
3510 tank = state;
3511 }
3512
3513 /**
3514 * Last animation identity used.
3515 */
3516 private int lastAnimation;
3517
3518 /**
3519 * @return Last animation identity used.
3520 */
3521 public int getLastAnimation() {
3522 return lastAnimation;
3523 }
3524
3525 /**
3526 * @param lastAnimation
3527 * The value to change lastAnimation into.
3528 */
3529 public void setLastAnimation(int lastAnimation) {
3530 this.lastAnimation = lastAnimation;
3531 }
3532
3533 /**
3534 * Store the time of when a skill was last boosted/drained.
3535 */
3536 public long[] boostedTime = new long[7];
3537
3538 /**
3539 * True, if the drain skill event is being used.
3540 */
3541 private boolean drainEvent;
3542
3543 /**
3544 * @return True, if the drain skill event is being used.
3545 */
3546 public boolean isDrainEvent() {
3547 return drainEvent;
3548 }
3549
3550 /**
3551 * @param drainEvent
3552 * The toggle to change drainEvent into.
3553 */
3554 public void setDrainEvent(boolean drainEvent) {
3555 this.drainEvent = drainEvent;
3556 }
3557
3558 /**
3559 * True, to show tutorial arrows when player moves/accepts clothes.
3560 */
3561 public boolean showTutorialArrows;
3562
3563 /**
3564 * Last time a quick set-up button was used.
3565 */
3566 public long lastQuickSetUpClicked;
3567
3568 /**
3569 * Last time a quick set-up button was used.
3570 */
3571 public long lastQuickchatButtonClicked;
3572
3573 /**
3574 * Store the time of when magic was used.
3575 */
3576 private long lastUsedMagic;
3577
3578 /**
3579 * @return The time of when magic was last used.
3580 */
3581 public long getLastUsedMagic() {
3582 return lastUsedMagic;
3583 }
3584
3585 /**
3586 * @param lastUsedMagic
3587 * The time of when magic was used.
3588 */
3589 public void setLastUsedMagic(long lastUsedMagic) {
3590 this.lastUsedMagic = lastUsedMagic;
3591 }
3592
3593 /**
3594 * Which difficulty tab was last clicked on the achievement interface.
3595 */
3596 public String lastAchievementDifficulty = "EASY";
3597
3598 /**
3599 * Which difficulty tab was last clicked on the rewardsachievement interface.
3600 */
3601 public String lastAchievementRewardsDifficulty = "EASY";
3602
3603 /**
3604 * Which column on the achievement interface was last clicked.
3605 */
3606 public int lastAchievementColumn;
3607
3608 /**
3609 * Name of the last achievement that was clicked on.
3610 */
3611 public String lastAchievementName;
3612
3613 /**
3614 * Amount of food ate.
3615 */
3616 public int foodAte;
3617
3618 /**
3619 * @return Get the amount of food eaten.
3620 */
3621 public int getFoodAte() {
3622 return foodAte;
3623 }
3624
3625 /**
3626 * Set the amount of foodAte.
3627 *
3628 * @param value
3629 * The value of foodAte to change to.
3630 */
3631 public void setFoodAte(int value) {
3632 foodAte = value;
3633 }
3634
3635 /**
3636 * Current kill streak.
3637 */
3638 public int currentKillStreak;
3639
3640 /**
3641 * The record kill streak.
3642 */
3643 public int killStreaksRecord;
3644
3645 /**
3646 * Save time of when account was created.
3647 */
3648 public long timeOfAccountCreation;
3649
3650 /**
3651 * Store time of when leech animation was last used.
3652 */
3653 public long lastLeechAnimation;
3654
3655 /**
3656 * Last time the player drank a potion.
3657 */
3658 public long lastPotionSip = System.currentTimeMillis();
3659
3660 /**
3661 * Amount of tiles player has ran across.
3662 */
3663 public int tilesWalked;
3664
3665 /**
3666 * True, if redemption or wrath has been activated.
3667 */
3668 public boolean redemptionOrWrathActivated;
3669
3670 /**
3671 * Used to determine the last player who started the duo following for Runescape
3672 * follow dancing.
3673 */
3674 public boolean followLeader;
3675
3676 /**
3677 * Last time the player throwed a snowball.
3678 */
3679 private long lastSnowBallThrowTime = System.currentTimeMillis();
3680
3681 /**
3682 * True, if the player is using the overload event
3683 */
3684 public boolean overloadEvent;
3685
3686 /**
3687 * Used for timing the overload damage hitsplat.
3688 */
3689 public int overloadTicks;
3690
3691 /**
3692 * Used for timing the overload reboosting time frame.
3693 */
3694 public int overloadReboostTicks;
3695
3696 /**
3697 * Old x position of the player i'm following.
3698 */
3699 public int oldX;
3700
3701 /**
3702 * Old y position of the player i'm following.
3703 */
3704 public int oldY;
3705
3706 /**
3707 * True, if the player successfully drank a potion.
3708 */
3709 public boolean showPotionMessage = true;
3710
3711 /**
3712 * True, if player is drinking an Extreme magic potion.
3713 */
3714 public boolean extremeMagic;
3715
3716 /**
3717 * Store the time of when the dialgueAction integer was last changed.
3718 */
3719 public long lastDialogueAction;
3720
3721 /**
3722 * 1 is normal interface, 2 is combat spells first, 3 is teleports spells first.
3723 */
3724 public int ancientsInterfaceType = 1;
3725
3726 /**
3727 * True, if the player is following with melee.
3728 */
3729 private boolean meleeFollow;
3730
3731 /**
3732 * Amount of Ring of recoil charges left.
3733 */
3734 public int recoilCharges = 40;
3735
3736 /**
3737 * @return The amount of recoilCharges integer.
3738 */
3739 public int getRecoilCharges() {
3740 return recoilCharges;
3741 }
3742
3743 /**
3744 * set the recoilCharges integer to the specified amount
3745 *
3746 * @param amount
3747 * The amount to change the recoilCharges integer to.
3748 */
3749 public void setRecoilCharges(int amount) {
3750 recoilCharges = amount;
3751 }
3752
3753 /**
3754 * Amount of Bracelet of ethereum charges left.
3755 */
3756 public int braceletCharges;
3757
3758 /**
3759 * @return The amount of braceletCharges integer.
3760 */
3761 public int getBraceletCharges() {
3762 return braceletCharges;
3763 }
3764
3765 /**
3766 * set the braceletCharges integer to the specified amount
3767 *
3768 * @param amount
3769 * The amount to change the braceletCharges integer to.
3770 */
3771 public void setBraceletCharges(int amount) {
3772 braceletCharges = amount;
3773 }
3774
3775 // Holiday tool
3776
3777 public int toolUses = 5;
3778
3779 public int getToolUses() {
3780 return toolUses;
3781 }
3782
3783 public void setToolUses(int amount) {
3784 toolUses = amount;
3785 }
3786
3787 /**
3788 * True, if the player is using bone on altar cycle event.
3789 */
3790 public boolean usingBoneOnAltarEvent;
3791
3792 /**
3793 * Record the time of when the bone on altar animation was last used.
3794 */
3795 public long boneOnAltarAnimation;
3796
3797 /**
3798 * True, to change what equipment and death icon on equipment tab does.
3799 */
3800 public boolean clipping;
3801
3802 /**
3803 * True, if the player has auto-casting turned on.
3804 */
3805 public boolean autoCasting;
3806
3807 /**
3808 * Get the autocasting toggle.
3809 *
3810 * @return The toggle of autocasting.
3811 */
3812 public boolean getAutoCasting() {
3813 return autoCasting;
3814 }
3815
3816 /**
3817 * Change the toggle of autoCasting.
3818 *
3819 * @param state
3820 * The toggle of autoCasting.
3821 */
3822 public void setAutoCasting(Boolean state) {
3823 autoCasting = state;
3824 }
3825
3826 /**
3827 * Each special attack weapon has its own slot, if slot is 1 means it's a single
3828 * hitsplat weapon, 2 means double hitsplat. 29 and above is free. When using
3829 * double damage weapon, leave the next index after it free.
3830 */
3831 public int[] specialAttackWeaponUsed = new int[35];
3832
3833 /**
3834 * Store the maximum hit of a special attack weapon, same order as
3835 * specialAttackWeaponUsed array.
3836 */
3837 public int[] maximumSpecialAttack = new int[35];
3838
3839 public int[] maximumSpecialAttackNpc = new int[35];
3840
3841 /**
3842 * Store the amount of times a special attack weapon was used, same order as
3843 * specialAttackWeaponUsed array.
3844 */
3845 public int[] weaponAmountUsed = new int[35];
3846
3847 public int[] weaponAmountUsedNpc = new int[35];
3848
3849 /**
3850 * Add to the amount a weapon has been used.
3851 *
3852 * @param index
3853 * The index of the weapon.
3854 */
3855 public void setWeaponAmountUsed(int index) {
3856 if (againstPlayer) {
3857 weaponAmountUsed[index]++;
3858 } else {
3859 weaponAmountUsedNpc[index]++;
3860 }
3861 }
3862
3863 /**
3864 * True if player is against player, used to save special attack amount used.
3865 */
3866 public boolean againstPlayer;
3867
3868 /**
3869 * Melee, ranged, magic, vengeance, recoil, dfs. Pvp only, it is in the Pking
3870 * tab on the Profile.
3871 */
3872 public int[] totalDamage = new int[6];
3873
3874 /**
3875 * Store the time of when the last saveMaximumDamage method was used.
3876 */
3877 public long lastSpecialAttackSaved;
3878
3879 /**
3880 * Store the single hitsplat damage of a special attack weapon.
3881 */
3882 public int firstHitSplatDamage;
3883
3884 /**
3885 * The name of the last clan chat joined.
3886 */
3887 public String lastClanChatJoined = "Help Cc";
3888
3889 /**
3890 * Amount of targets killed.
3891 */
3892 public int targetsKilled;
3893
3894 /**
3895 * Amount of times died from target.
3896 */
3897 public int targetDeaths;
3898
3899 /**
3900 * Amount of Barrows brothers killed.
3901 */
3902 public int barrowsKillCount;
3903
3904 /**
3905 * 0 if the player is not transformed.
3906 */
3907 private int transformed;
3908
3909 /**
3910 * 5 is easter egg only, 1 is monkey.
3911 */
3912 public int getTransformed() {
3913 return transformed;
3914 }
3915
3916 /**
3917 * True, if the player has transformed into an Egg.
3918 */
3919 public boolean isAnEgg;
3920
3921 /**
3922 * The total amount of votes the player has accumulated.
3923 */
3924 public int voteTotalPoints;
3925
3926 /**
3927 * This is used to extinguish different Clue scroll quests.
3928 */
3929 public int clueScrollType = -1;
3930
3931 /**
3932 * True, if the player is using the summon pet cycle event.
3933 */
3934 public boolean isUsingSummonPetEvent;
3935
3936 /**
3937 * Used to stop block emote being used an instant after the attack emote is
3938 * called. Which ends up cancelling the attack emote.
3939 */
3940 public long lastAttackAnimationTimer;
3941
3942 /**
3943 * Potion sip timer.
3944 */
3945 public byte timer;
3946
3947 /**
3948 * The amount of ticks the startInterfaceEvent will last for.
3949 */
3950 public int extraTime;
3951
3952 /**
3953 * True, if the startSkullTimerEvent is active.
3954 */
3955 public boolean isUsingSkullTimerEvent;
3956
3957 /**
3958 * True, if the player is logging out manually.
3959 */
3960 public boolean manualLogOut;
3961
3962 /**
3963 * The last bank tab the player had opened.
3964 */
3965 public byte lastBankTabOpened;
3966
3967 /**
3968 * Change the amount of lastBankTabOpened
3969 *
3970 * @param value
3971 * The amount of lastbankTabOpened
3972 */
3973 public void setLastBankTabOpened(byte value) {
3974 lastBankTabOpened = value;
3975 }
3976
3977 /**
3978 * @return The amount of lastBankTabOpened.
3979 */
3980 public byte getLastBankTabOpened() {
3981 return lastBankTabOpened;
3982 }
3983
3984 /**
3985 * Set the toggle of inventoryUpdate.
3986 *
3987 * @param state
3988 * State of inventoryUpdate.
3989 */
3990 public void setInventoryUpdate(boolean state) {
3991 inventoryUpdate = state;
3992 }
3993
3994 /**
3995 * @return The toggle of inventoryUpdate.
3996 */
3997 public boolean getInventoryUpdate() {
3998 return inventoryUpdate;
3999 }
4000
4001 /**
4002 * True, if the inventory needs visual updating.
4003 */
4004 private boolean inventoryUpdate;
4005
4006 /**
4007 * Store the time of when the casket was last opened.
4008 */
4009 public long casketTime;
4010
4011 /**
4012 * The total amount of the item scanned in the bank and inventory.
4013 */
4014 public int quantityOfItem;
4015
4016 /**
4017 * The damage of the Morrigan's javelin special attack to deal, either 5 or
4018 * less, depending on the victim's hitpoints.
4019 */
4020 public int morrigansJavelinDamageToDeal;
4021
4022 /**
4023 * Amount of Morrigan's javelin special attack damages to apply.
4024 */
4025 public int amountOfDamages;
4026
4027 /**
4028 * True, if Morrigan's javelin special attack is being used.
4029 */
4030 public boolean morrigansJavelinSpecialAttack;
4031
4032 /**
4033 * The time of when the last anti-poison potion was taken.
4034 */
4035 public long lastPoisonSip;
4036
4037 /**
4038 * The amount of time of immunity to poison.
4039 */
4040 public long poisonImmune;
4041
4042 /**
4043 * Store the time of when the venom immunity will expire.
4044 */
4045 public long venomImmunityExpireTime;
4046
4047 /**
4048 * The amount of times a venom damage cycle has taken place
4049 */
4050 public int venomHits;
4051
4052 /**
4053 * The ip that connected to this account before this session.
4054 */
4055 public String lastSavedIpAddress = "";
4056
4057 /**
4058 * The time of when the player logged out.
4059 */
4060 public long logOutTime = System.currentTimeMillis();
4061
4062 /**
4063 * True if Saradomin special attack is activated.
4064 */
4065 public boolean saradominSwordSpecialAttack;
4066
4067 /**
4068 * True, if the player is using a special attack that causes multiple damage.
4069 * e.g: Dragon dagger, Dragon claws and Dragon halberd.
4070 */
4071 public boolean multipleDamageSpecialAttack;
4072
4073 /**
4074 * Get the toggle of multipleDamageSpecialAttack.
4075 *
4076 * @return The toggle of multipleDamageSpecialAttack.
4077 */
4078 public boolean getMultipleDamageSpecialAttack() {
4079 return multipleDamageSpecialAttack;
4080 }
4081
4082 /**
4083 * Change the toggle of multipleDamageSpecialAttack.
4084 *
4085 * @param state
4086 * The toggle of multipleDamageSpecialAttack.
4087 */
4088 public void setMultipleDamageSpecialAttack(boolean state) {
4089 multipleDamageSpecialAttack = state;
4090 }
4091
4092 /**
4093 * True, if the player is using Dragon claws special attack.
4094 */
4095 public boolean dragonClawsSpecialAttack;
4096
4097 /**
4098 * Change the toggle of dragonClawsSpecialAttack.
4099 *
4100 * @param state
4101 * The toggle of dragonClawsSpecialAttack.
4102 */
4103 public void setDragonClawsSpecialAttack(boolean state) {
4104 dragonClawsSpecialAttack = state;
4105 }
4106
4107 /**
4108 * Get the toggle of dragonClawsSpecialAttack.
4109 *
4110 * @return The toggle of dragonClawsSpecialAttack.
4111 */
4112 public boolean getDragonClawsSpecialAttack() {
4113 return dragonClawsSpecialAttack;
4114 }
4115
4116 /**
4117 * True, if the player is using the dragon claws special attack event.
4118 */
4119 public boolean usingDragonClawsSpecialAttackEvent;
4120
4121 /**
4122 * Get the toggle of usingDragonClawsSpecialAttackEvent.
4123 *
4124 * @return The toggle of usingDragonClawsSpecialAttackEvent.
4125 */
4126 public boolean getUsingDragonClawsSpecialAttackEvent() {
4127 return usingDragonClawsSpecialAttackEvent;
4128 }
4129
4130 /**
4131 * Set the toggle of usingDragonClawsSpecialAttackEvent.
4132 *
4133 * @param state
4134 * The toggle of usingDragonClawsSpecialAttackEvent.
4135 */
4136 public void setUsingDragonClawsSpecialAttackEvent(boolean state) {
4137 usingDragonClawsSpecialAttackEvent = state;
4138 }
4139
4140 /**
4141 * True, if the player has a red skull.
4142 */
4143 public boolean redSkull;
4144
4145 /**
4146 * Change the toggle of redSkull.
4147 *
4148 * @param state
4149 * The toggle of redSkull.
4150 */
4151 public void setRedSkull(boolean state) {
4152 redSkull = state;
4153 }
4154
4155 /**
4156 * Get the toggle of redSkull.
4157 *
4158 * @return The toggle of redSkull.
4159 */
4160 public boolean getRedSkull() {
4161 return redSkull;
4162 }
4163
4164 /**
4165 * True, if the player has a white skull.
4166 */
4167 public boolean whiteSkull;
4168
4169 /**
4170 * Change the toggle of whiteSkull.
4171 *
4172 * @param state
4173 * The toggle of whiteSkull.
4174 */
4175 public void setWhiteSkull(boolean state) {
4176 whiteSkull = state;
4177 }
4178
4179 /**
4180 * Get the toggle of whiteSkull.
4181 *
4182 * @return The toggle of whiteSkull.
4183 */
4184 public boolean getWhiteSkull() {
4185 return whiteSkull;
4186 }
4187
4188 /**
4189 * Amount of milliseconds, the player has been online for, in this session.
4190 */
4191 public long millisecondsOnline;
4192
4193 /**
4194 * The amount of seconds, the player has been online for.
4195 */
4196 public int secondsBeenOnline;
4197
4198 public int gameTicksOnline;
4199
4200 /**
4201 * The date of when the account was created.
4202 */
4203 public String accountDateCreated = "";
4204
4205 /**
4206 * True, if the special attack event is being used.
4207 */
4208 public boolean specialAttackEvent;
4209
4210 /**
4211 * Store the time of the last Wolpertinger special attack used.
4212 */
4213 public long lastWolpertingerSpecialAttack;
4214
4215 /**
4216 * @param amount
4217 * Change the player's Hitpoints to this.
4218 */
4219 public void setHitPoints(int amount) {
4220 if (this.getDead()) {
4221 return;
4222 }
4223 currentCombatSkillLevel[ServerConstants.HITPOINTS] = amount;
4224 Skilling.updateSkillTabFrontTextMain(this, ServerConstants.HITPOINTS);
4225 }
4226
4227 /**
4228 * Duel arena stakes done.
4229 */
4230 public int duelArenaStakes;
4231
4232 /**
4233 * Trades completed.
4234 */
4235 public int tradesCompleted;
4236
4237 /**
4238 * Amount of times used teleport.
4239 */
4240 public int teleportsUsed;
4241
4242 /**
4243 * Amount of times the player has died in a safe area.
4244 */
4245 public int safeDeaths;
4246
4247 /**
4248 * Amount of times the player has killed another player in a safe area.
4249 */
4250 public int safeKills;
4251
4252 /**
4253 * Amount of potion doses drank.
4254 */
4255 public int potionDrank;
4256
4257 /**
4258 * KDR of the player, used for highscores.
4259 */
4260 public int kdr;
4261
4262 /**
4263 * True, if the resting event is active.
4264 */
4265 public boolean restingEvent;
4266
4267 /**
4268 * True, if the player is resting.
4269 */
4270 public boolean resting;
4271
4272 /**
4273 * The delay in milliseconds to gain energy.
4274 */
4275 public int agilityRestoreDelay = 3000;
4276
4277 /**
4278 * Run energy remaining.
4279 */
4280 public double runEnergy = 100;
4281
4282 public boolean energyGainEvent;
4283
4284 /**
4285 * Store the time of the last time the player had their run energy restored.
4286 */
4287 public long lastRunRecovery;
4288
4289 /**
4290 * True, if the player is running.
4291 */
4292 public boolean isRunning() {
4293 return isNewWalkCmdIsRunning() || (runModeOn && isMoving());
4294 }
4295
4296 /**
4297 * Store the time of when a clan chat message was last sent by the player.
4298 */
4299 public long clanChatMessageTime;
4300
4301 /**
4302 * True, if the player is dead.
4303 */
4304 public boolean dead;
4305
4306 public boolean getDead() {
4307 return dead;
4308 }
4309
4310 /**
4311 * Change the toggle of isDead.
4312 */
4313 public void setDead(boolean state) {
4314 dead = state;
4315 }
4316
4317 /**
4318 * True, to call the familiar.
4319 */
4320 public boolean forceCallFamiliar;
4321
4322 /**
4323 * Last time familiar called.
4324 */
4325 public long callFamiliarTimer = System.currentTimeMillis();
4326
4327 /**
4328 * True, if the player has summoned a pet.
4329 */
4330 private boolean petSummoned;
4331
4332 /**
4333 * True if the second pet is summoned.
4334 */
4335 private boolean secondPetSummoned;
4336
4337 /**
4338 * The toggle of petSummoned.
4339 *
4340 * @return The toggle of petSummoned.
4341 */
4342 public boolean getPetSummoned() {
4343 return petSummoned;
4344 }
4345
4346 /**
4347 * Change the toggle of petSummoned.
4348 *
4349 * @param state
4350 * The toggle of petSummoned.
4351 */
4352 public void setPetSummoned(boolean state) {
4353 petSummoned = state;
4354 }
4355
4356 /**
4357 * The NPC type of the pet that the player currently has summoned.
4358 */
4359 private int petId;
4360
4361 /**
4362 * The second pet id summoned.
4363 */
4364 private int secondPetId;
4365
4366 /**
4367 * True if the ladder event is being used.
4368 */
4369 public boolean ladderEvent;
4370
4371 /**
4372 * True, if the idle Event is in use.
4373 */
4374 public boolean idleEventUsed;
4375
4376 /**
4377 * This will keep increasing by +1 when the player is not sending any packets to
4378 * the server. If this is 3 or more, then the player is not sending any
4379 * connections to the server.
4380 * <p>
4381 * This is used to disconnect the player, if in-combat, after 40 seconds.
4382 */
4383 private int timeOutCounter = 0;
4384
4385 /**
4386 * Is the clickNpcTypeEvent1 being used?
4387 */
4388 public boolean usingClickNpcType1Event;
4389
4390 /**
4391 * Is the clickNpcTypeEvent2 being used?
4392 */
4393 public boolean usingClickNpcType2Event;
4394
4395 /**
4396 * Is the clickNpcTypeEvent3 being used?
4397 */
4398 public boolean usingClickNpcType3Event;
4399
4400 /**
4401 * Is the clickNpcTypeEvent4 being used?
4402 */
4403 public boolean usingClickNpcType4Event;
4404
4405 /**
4406 * Is the clickObject1Event active?
4407 */
4408 public boolean doingClickObjectType1Event;
4409
4410 /**
4411 * Is the clickObject2Event active?
4412 */
4413 public boolean doingClickObjectType2Event;
4414
4415 /**
4416 * Is the clickObject3Event active?
4417 */
4418 public boolean doingClickObjectType3Event;
4419
4420 /**
4421 * if true, the player cannot perform any action and is performing agility.
4422 */
4423 private boolean doingAgility;
4424
4425 /**
4426 * The toggle of doingAgility.
4427 *
4428 * @return The toggle of doingAgility.
4429 */
4430 public boolean getDoingAgility() {
4431 return doingAgility;
4432 }
4433
4434 /**
4435 * Change the toggle of doingAgility.
4436 *
4437 * @param state
4438 * The toggle of doingAgility.
4439 */
4440 public void setDoingAgility(boolean state) {
4441 doingAgility = state;
4442 }
4443
4444 /**
4445 * True, if the interface Cycle Event is being used.
4446 */
4447 public boolean isUsingInterfaceEvent;
4448
4449 /**
4450 * The range damage for a single hit.
4451 */
4452 public int rangedFirstDamage;
4453
4454 /**
4455 * The range damage for a double hit.
4456 */
4457 public int rangedSecondDamage;
4458
4459 /**
4460 * True, to show the Diamond bolts (e) GFX during the hitsplat.
4461 */
4462 public boolean showDiamondBoltGFX;
4463
4464 /**
4465 * True, to show the Onyx bolts (e) GFX during the hitsplat.
4466 */
4467 public boolean showOnyxBoltGfx;
4468
4469 /**
4470 * True, to show the Dragon bolts (e) GFX during the hitsplat.
4471 */
4472 public boolean showDragonBoltGFX;
4473
4474 /**
4475 * True, to show the Ruby bolts (e) GFX during the hitsplat.
4476 */
4477 public boolean showRubyBoltGFX;
4478
4479 /**
4480 * True, to show the Opal bolts (e) GFX during the hitsplat.
4481 */
4482 public boolean showOpalBoltGFX;
4483
4484 /**
4485 * Store the maximum damage of the player.
4486 */
4487 public int maximumDamageRanged;
4488
4489 /**
4490 * * Store the normal single hit damage of a melee weapon..
4491 */
4492 public int meleeFirstDamage;
4493
4494 public int graniteMaulSpecialDamage;
4495
4496 public int graniteMaulSpecialCriticalDamage;
4497
4498 public boolean isGraniteMaulSpecial;
4499
4500 /**
4501 * * Store the second hit of a Dragon dagger or Halbred special attack.
4502 */
4503 public int meleeSecondDamage;
4504
4505 /**
4506 * Store the third hit of a Dragon claw special attack.
4507 */
4508 public int meleeThirdDamage;
4509
4510 /**
4511 * Store the fourth hit of a Dragon claw special attack.
4512 */
4513 public int meleeFourthDamage;
4514
4515 /**
4516 * Maximum damage of Melee.
4517 */
4518 public int maximumDamageMelee;
4519
4520 /**
4521 * Magic damage.
4522 */
4523 private int magicDamage;
4524
4525 /**
4526 * Maximum damage of Magic.
4527 */
4528 private int maximumDamageMagic;
4529
4530 /**
4531 * Amount of 600ms cycles untill the teleport finishes.
4532 */
4533 private int teleportCycle;
4534
4535 /**
4536 * True, if the player is teleporting. Use this to check if a player is
4537 * teleporting.
4538 */
4539 public boolean isTeleporting() {
4540 return teleporting;
4541 }
4542
4543 /**
4544 * True, if Magic bow special attack is being used.
4545 */
4546 private boolean magicBowSpecialAttack;
4547
4548 /**
4549 * True, if using Dark bow to start a normal attack.
4550 */
4551 private boolean usingDarkBowNormalAttack;
4552
4553 /**
4554 * True if magic will splash.
4555 */
4556 private boolean magicSplash;
4557
4558 public int[] baseSkillLevel = new int[23];
4559
4560 public int[] currentCombatSkillLevel = new int[7];
4561
4562 public int getCurrentCombatSkillLevel(int combatSkill) {
4563 return currentCombatSkillLevel[combatSkill];
4564 }
4565
4566 /**
4567 * Experience in a skill.
4568 */
4569 public int[] skillExperience = new int[25];
4570
4571 /**
4572 * Store the player's experience before they enter the tournament on the Economy
4573 * server.
4574 */
4575 public int[] skillExperienceStoredBeforeTournament = new int[7];
4576
4577 /**
4578 * Store the player's base skill level before they enter the tournament on the
4579 * Economy server.
4580 */
4581 public int[] baseSkillLevelStoredBeforeTournament = new int[7];
4582
4583 public int getBaseDefenceLevel() {
4584 return baseSkillLevel[ServerConstants.DEFENCE];
4585 }
4586
4587 public int getBaseAttackLevel() {
4588 return baseSkillLevel[ServerConstants.ATTACK];
4589 }
4590
4591 public int getBaseStrengthLevel() {
4592 return baseSkillLevel[ServerConstants.STRENGTH];
4593 }
4594
4595 public int getBaseRangedLevel() {
4596 return baseSkillLevel[ServerConstants.RANGED];
4597 }
4598
4599 public int getBasePrayerLevel() {
4600 return baseSkillLevel[ServerConstants.PRAYER];
4601 }
4602
4603 public int getBaseMagicLevel() {
4604 return baseSkillLevel[ServerConstants.MAGIC];
4605 }
4606
4607 /**
4608 * @return The player's maximum hitpoints.
4609 */
4610 public int getBaseHitPointsLevel() {
4611 return baseSkillLevel[ServerConstants.HITPOINTS];
4612 }
4613
4614 /**
4615 * The other player that is being attacked by this player.
4616 */
4617 public int playerIdAttacking;
4618
4619 public void setPlayerIdAttacking(int value) {
4620 playerIdAttacking = value;
4621 hasLastAttackedAPlayer = true;
4622 }
4623
4624 /**
4625 * True if the player has last interacted by attacking a player.
4626 */
4627 public boolean hasLastAttackedAPlayer;
4628
4629 public void resetPlayerIdAttacking() {
4630 playerIdAttacking = 0;
4631 }
4632
4633 public int getPlayerIdAttacking() {
4634 return playerIdAttacking;
4635 }
4636
4637 /**
4638 * True, if the player is teleporting.
4639 */
4640 private boolean teleporting;
4641
4642 /**
4643 * True, if the player is using range.
4644 */
4645 public boolean usingRanged;
4646
4647 /**
4648 * The toggle of usingRange.
4649 *
4650 * @return The toggle of usingRange.
4651 */
4652 public boolean getUsingRanged() {
4653 return usingRanged;
4654 }
4655
4656 /**
4657 * Change the toggle of usingRange.
4658 *
4659 * @param state
4660 * The toggle of usingRange.
4661 */
4662 public void setUsingRanged(boolean state) {
4663 usingRanged = state;
4664 }
4665
4666 /**
4667 * True if the player is a Normal player.
4668 */
4669 public boolean isNormalRank() {
4670 return playerRights == 0;
4671 }
4672
4673 /**
4674 * True if the player is a Moderator.
4675 */
4676 public boolean isModeratorRank() {
4677 return playerRights == 1 || playerRights == 2 || playerRights == 31 || isDeveloperRank();
4678 }
4679
4680 public boolean isNo() {
4681 return playerRights == 1 || playerRights == 2 || playerRights == 10;
4682 }
4683
4684 /**
4685 *
4686 * True if the player is a Developer.
4687 *
4688 */
4689 public boolean isDeveloperRank() {
4690 return playerRights == 33;
4691 }
4692
4693 /**
4694 * True if the player is a Staff Managererator rank.
4695 */
4696 public boolean isStaffManagereratorRank() {
4697 return playerRights == 31;
4698 }
4699
4700 /**
4701 * True if the player is a Support.
4702 */
4703 public boolean isSupportRank() {
4704 return playerRights == 10;
4705 }
4706
4707 /**
4708 * True if the player is a Youtuber rank.
4709 */
4710 public boolean isYoutubeRank() {
4711 return playerRights == 21;
4712 }
4713
4714 /**
4715 * True if the player is an Administrator.
4716 */
4717 public boolean isAdministratorRank() {
4718 return playerRights == 2 || playerRights == 33;
4719 }
4720
4721 /**
4722 * Has the player finished logging in?
4723 */
4724 public boolean loggingInFinished;
4725
4726 /**
4727 * True if the player is doing an action.
4728 */
4729 public boolean doingAction() {
4730 if (doingActionTimer > 0) {
4731 return true;
4732 }
4733 return false;
4734 }
4735
4736 /**
4737 * if 1 or more, the player cannot do anything..
4738 */
4739 public int doingActionTimer;
4740
4741 /**
4742 * Is the doingActionEvent being used?
4743 */
4744 public boolean isUsingDoingActionEvent;
4745
4746 /**
4747 * True, if the player has finished the new player tutorial.
4748 */
4749 private boolean tutorialComplete;
4750
4751 /**
4752 * Store the time of when this player has attacked another player.
4753 */
4754 public long timeAttackedAnotherPlayer;
4755
4756 public long getTimeAttackedAnotherPlayer() {
4757 return timeAttackedAnotherPlayer;
4758 }
4759
4760 public void setTimeAttackedAnotherPlayer(long value) {
4761 timeAttackedAnotherPlayer = value;
4762 }
4763
4764 /**
4765 * Store the time of when this player has been under attack by another player.
4766 */
4767 public long timeUnderAttackByAnotherPlayer;
4768
4769 public long getTimeUnderAttackByAnotherPlayer() {
4770 return timeUnderAttackByAnotherPlayer;
4771 }
4772
4773 public void setTimeUnderAttackByAnotherPlayer(long value) {
4774 timeUnderAttackByAnotherPlayer = value;
4775 timeUnderAttackByAnotherPlayerOther = value;
4776 }
4777
4778 /**
4779 * Exactly same as timeUnderAttackByAnotherPlayerOther except that this variable
4780 * is also called when a recoil hits the player or venom etc..
4781 */
4782 public long timeUnderAttackByAnotherPlayerOther;
4783
4784 /**
4785 * Used for log out timer, this only resets upon death.
4786 */
4787 public long timeNpcAttackedPlayerLogOutTimer;
4788
4789 /**
4790 * Store the time of when the NPC last attacked the player.
4791 */
4792 public long timeNpcAttackedPlayer;
4793
4794 public long getTimeNpcAttackedPlayer() {
4795 return timeNpcAttackedPlayer;
4796 }
4797
4798 public void setTimeNpcAttackedPlayer(long value) {
4799 timeNpcAttackedPlayer = value;
4800 }
4801
4802 /**
4803 * The players i have recently attacked. Used for skulling.
4804 */
4805 public ArrayList<String> attackedPlayers = new ArrayList<String>();
4806
4807 /**
4808 * The poison damage to appear.
4809 */
4810 public int poisonDamage;
4811
4812 /**
4813 * The amount of poison hitsplats left of the current poisonDamage.
4814 */
4815 public int poisonHitsplatsLeft;
4816
4817 /**
4818 * Amount of game ticks left untill the next poison hitsplat damage.
4819 */
4820 public int poisonTicksUntillDamage;
4821
4822 /**
4823 * The venom damage to appear.
4824 */
4825 public int venomDamage = 6;
4826
4827 /**
4828 * The amount of poison hitsplats left of the current venomDamage.
4829 */
4830 public int venomHitsplatsLeft;
4831
4832 /**
4833 * Amount of game ticks left until the next venom hitsplat damage.
4834 */
4835 public int venomTicksUntillDamage;
4836
4837 /**
4838 * Amount of achievement points.
4839 */
4840 public int achievementPoint;
4841
4842 /**
4843 * Amount of achievement points history.
4844 */
4845 public int achievementPointHistory;
4846
4847 /**
4848 * Amount of times the player died in a dangerous area.
4849 */
4850 public int wildernessDeaths;
4851
4852 /**
4853 * Change wildernessDeaths integer.
4854 *
4855 * @param value
4856 * The value to set the wildernessDeaths integer to.
4857 */
4858 public void setWildernessDeaths(int value) {
4859 wildernessDeaths = value;
4860 }
4861
4862 /**
4863 * @param countWildernessDeathsReset
4864 * TODO
4865 * @return The wildernessDeaths integer value.
4866 */
4867 public int getWildernessDeaths(boolean countWildernessDeathsReset) {
4868 if (countWildernessDeathsReset) {
4869 return wildernessDeaths + wildernessDeathsReset;
4870 }
4871 return wildernessDeaths;
4872 }
4873
4874 /**
4875 * Amount of players killed in a dangeorus area.
4876 */
4877 private int wildernessKills;
4878
4879 /**
4880 * Change wildernessKills integer.
4881 *
4882 * @param value
4883 * The value to set the wildernessKills integer to.
4884 */
4885 public void setWildernessKills(int value) {
4886 wildernessKills = value;
4887 }
4888
4889 /**
4890 * @param countResettedWildernessKills
4891 * TODO
4892 * @return The wildernessKills integer value.
4893 */
4894 public int getWildernessKills(boolean countResettedWildernessKills) {
4895 if (countResettedWildernessKills) {
4896 return wildernessKills + wildernessKillsReset;
4897 }
4898 return wildernessKills;
4899 }
4900
4901 /**
4902 * Total level.
4903 */
4904 private int totalLevel;
4905
4906 /**
4907 * Total experience in all skills.
4908 */
4909 private long xpTotal;
4910
4911 /**
4912 * Quick prayers of normal prayers.
4913 */
4914 public boolean[] quickPrayers = new boolean[QuickPrayers.MAX_PRAYERS];
4915
4916 /**
4917 * True if quick prayers of normal prayers are active.
4918 */
4919 public boolean quickPray;
4920
4921 /**
4922 * The part of the Completionist cape that is currently being changed.
4923 */
4924 public String partOfCape = "";
4925
4926 /**
4927 * The top detail colour of the Completionist cape.
4928 */
4929 public int compColor1 = 685;
4930
4931 /**
4932 * The top colour of the Completionist cape.
4933 */
4934 public int compColor2 = 685;
4935
4936 /**
4937 * The bottom detail colour of the Completionist cape.
4938 */
4939 public int compColor3 = 685;
4940
4941 /**
4942 * The bottom colour of the Completionist cape.
4943 */
4944 public int compColor4 = 685;
4945
4946 /**
4947 * The identity of the latest attacker (other player) that attacked this player.
4948 * This is only reset when the player dies.
4949 */
4950 private int lastAttackedBy;
4951
4952 /**
4953 * The identity of an NPC, in order of which NPC was spawned first. So, the
4954 * first NPC spawned in spawns.cfg gets the value +1. When an NPC is created by
4955 * summoning a pet for example, it gets the next unoccupied lowest number. This
4956 * integer is used to identify the exact NPC the player clicked on and once all
4957 * the data is put to use by knowing the exact NPC the player clicked on, the
4958 * value is returned to 0.
4959 */
4960 private int npcClickIndex;
4961
4962 private int animationRequest = -1;
4963
4964 public int getAnimationRequest() {
4965 return animationRequest;
4966 }
4967
4968 public void setAnimationRequest(int animationRequest) {
4969 this.animationRequest = animationRequest;
4970 }
4971
4972 private int FocusPointX = 0;
4973
4974 public int getFocusPointX() {
4975 return FocusPointX;
4976 }
4977
4978 public void setFocusPointX(int focusPointX) {
4979 FocusPointX = focusPointX;
4980 }
4981
4982 private int FocusPointY = 0;
4983
4984 public int getFocusPointY() {
4985 return FocusPointY;
4986 }
4987
4988 public void setFocusPointY(int focusPointY) {
4989 FocusPointY = focusPointY;
4990 }
4991
4992 private boolean faceUpdateRequired;
4993
4994 protected boolean isFaceUpdateRequired() {
4995 return faceUpdateRequired;
4996 }
4997
4998 protected void setFaceUpdateRequired(boolean faceUpdateRequired) {
4999 this.faceUpdateRequired = faceUpdateRequired;
5000 }
5001
5002 private int face = -1;
5003
5004 public int getFace() {
5005 return face;
5006 }
5007
5008 public void setFace(int face) {
5009 this.face = face;
5010 }
5011
5012 private int duelStatus;
5013
5014 /**
5015 * public final static int NOT_DUELING = 0; <br>
5016 * public final static int IN_DUEL_INTERFACE = 1; <br>
5017 * public final static int ON_FIRST_SCREEN_ACCEPTED = 2; <br>
5018 * public final static int ON_SECOND_SCREEN = 3; <br>
5019 * public final static int ON_SECOND_SCREEN_ACCEPTED = 4; <br>
5020 * public final static int DUEL_STARTED = 5; <br>
5021 * public final static int DUEL_WON = 6;
5022 *
5023 * @return
5024 */
5025 public int getDuelStatus() {
5026 return duelStatus;
5027 }
5028
5029 /**
5030 * public final static int NOT_DUELING = 0; public final static int
5031 * IN_DUEL_INTERFACE = 1; public final static int ON_FIRST_SCREEN_ACCEPTED = 2;
5032 * public final static int ON_SECOND_SCREEN = 3; public final static int
5033 * ON_SECOND_SCREEN_ACCEPTED = 4; public final static int DUEL_STARTED = 5;
5034 *
5035 * @return
5036 */
5037 public void setDuelStatus(int duelStatus) {
5038 this.duelStatus = duelStatus;
5039 }
5040
5041 public int getDuelCount() {
5042 return duelCount;
5043 }
5044
5045 public void setDuelCount(int duelCount) {
5046 this.duelCount = duelCount;
5047 }
5048
5049 /**
5050 * True, if the player is casting magic. This is used to confirm that the player
5051 * is magic following.
5052 * <p>
5053 * We cannot use isUsingMagic() because it turns to false after the hitsplat
5054 * appears to stop the player from re-attacking.
5055 */
5056 public boolean hasLastCastedMagic() {
5057 return lastCastedMagic;
5058 }
5059
5060 /**
5061 * True, if the player is casting magic. This is used to confirm that the player
5062 * is magic following.
5063 * <p>
5064 * We cannot use isUsingMagic() because isUsingMagic() turns to false after the
5065 * hitsplat appears to stop the player from re-attacking.
5066 */
5067 public void setLastCastedMagic(boolean lastCastedMagic) {
5068 this.lastCastedMagic = lastCastedMagic;
5069 }
5070
5071 public boolean isUsingMediumRangeRangedWeapon() {
5072 return usingMediumRangeRangedWeapon;
5073 }
5074
5075 public void setUsingMediumRangeRangedWeapon(boolean state) {
5076 this.usingMediumRangeRangedWeapon = state;
5077 }
5078
5079 public boolean isWieldingRangedWeaponWithNoArrowSlotRequirement() {
5080 return isWieldingRangedWeaponWithNoArrowSlotRequirement;
5081 }
5082
5083 public void setIsWieldingRangedWeaponWithNoArrowSlotRequirement(boolean state) {
5084 this.isWieldingRangedWeaponWithNoArrowSlotRequirement = state;
5085 }
5086
5087 /**
5088 * @return True, if the player is following with melee.
5089 */
5090 public boolean isMeleeFollow() {
5091 return meleeFollow;
5092 }
5093
5094 /**
5095 * True, if the player is following with melee.
5096 */
5097 public void setMeleeFollow(boolean meleeFollow) {
5098 this.meleeFollow = meleeFollow;
5099 }
5100
5101 public void setTransformed(int transformed) {
5102 this.transformed = transformed;
5103 }
5104
5105 public void setTeleporting(boolean teleporting) {
5106 this.teleporting = teleporting;
5107 }
5108
5109 public void setHeight(int height) {
5110 this.height = height;
5111 }
5112
5113 public int getPlayerId() {
5114 return playerId;
5115 }
5116
5117 public void setPlayerId(int playerId) {
5118 this.playerId = playerId;
5119 }
5120
5121 public long getLastSnowBallThrowTime() {
5122 return lastSnowBallThrowTime;
5123 }
5124
5125 public void setLastSnowBallThrowTime(long lastSnowBallThrowTime) {
5126 this.lastSnowBallThrowTime = lastSnowBallThrowTime;
5127 }
5128
5129 public boolean getMiasmicTimer() {
5130 if (!GameType.isPreEoc()) {
5131 return false;
5132 }
5133 if (miasmicSpeedTime < 1) {
5134 return false;
5135 }
5136 if (getSpellId() > 0) {
5137 return false;
5138 }
5139 long elapsed = System.currentTimeMillis() - miasmicSpeedTimeElapsed / 1000;
5140 if (elapsed < miasmicSpeedTime) {
5141 return true;
5142 }
5143 miasmicSpeedTime = 0;
5144 return false;
5145 }
5146
5147 public int getAttackTimer() {
5148 if (getMiasmicTimer()) {
5149 return attackTimer * 2;
5150 }
5151 return attackTimer;
5152 }
5153
5154 public void setAttackTimer(int attackTimer) {
5155 this.attackTimer = attackTimer;
5156 }
5157
5158 public int getSpecEffect() {
5159 return specEffect;
5160 }
5161
5162 public void setSpecEffect(int specEffect) {
5163 this.specEffect = specEffect;
5164 }
5165
5166 public int getDroppedRangedWeaponUsed() {
5167 return droppedRangedWeaponUsed;
5168 }
5169
5170 public void setDroppedRangedItemUsed(int rangeItemUsed) {
5171 this.droppedRangedWeaponUsed = rangeItemUsed;
5172 }
5173
5174 public int getProjectileStage() {
5175 return projectileStage;
5176 }
5177
5178 public void setProjectileStage(int projectileStage) {
5179 this.projectileStage = projectileStage;
5180 }
5181
5182 public void setX(int playerX) {
5183 this.playerX = playerX;
5184 }
5185
5186 public int setY(int playerY) {
5187 this.playerY = playerY;
5188 return playerY;
5189 }
5190
5191 /**
5192 * The time the player was frozen.
5193 */
5194 public long timeFrozen = 0;
5195
5196 /**
5197 * The amount of time the player won't be able to move for. 8000 means 8
5198 * seconds.
5199 */
5200 private long frozenLength = 0;
5201
5202 public boolean isFrozen() {
5203 if (System.currentTimeMillis() - timeFrozen >= getFrozenLength()) {
5204 return false;
5205 }
5206 return true;
5207 }
5208
5209 /**
5210 * True if the player can be frozen.
5211 */
5212 public boolean canBeFrozen() {
5213 if (System.currentTimeMillis() - timeFrozen >= (getFrozenLength() + 2900)) {
5214 return true;
5215 }
5216 return false;
5217 }
5218
5219 public int getAutocastId() {
5220 return autocastId;
5221 }
5222
5223 public void setAutocastId(int autocastId) {
5224 this.autocastId = autocastId;
5225 }
5226
5227 public boolean isUsingSpecial() {
5228 return usingSpecial;
5229 }
5230
5231 public void setUsingSpecialAttack(boolean usingSpecial) {
5232 this.usingSpecial = usingSpecial;
5233 }
5234
5235 public boolean isMagicBowSpecialAttack() {
5236 return magicBowSpecialAttack;
5237 }
5238
5239 public void setMagicBowSpecialAttack(boolean magicBowSpecialAttack) {
5240 this.magicBowSpecialAttack = magicBowSpecialAttack;
5241 }
5242
5243 public boolean isUsingDarkBowSpecialAttack() {
5244 return usingDarkBowSpecialAttack;
5245 }
5246
5247 public void setUsingDarkBowSpecialAttack(boolean usingDarkBowSpecialAttack) {
5248 this.usingDarkBowSpecialAttack = usingDarkBowSpecialAttack;
5249 }
5250
5251 public boolean isUsingDarkBowNormalAttack() {
5252 return usingDarkBowNormalAttack;
5253 }
5254
5255 public void setUsingDarkBowNormalAttack(boolean usingDarkBowNormalAttack) {
5256 this.usingDarkBowNormalAttack = usingDarkBowNormalAttack;
5257 }
5258
5259 public boolean isMagicSplash() {
5260 return magicSplash;
5261 }
5262
5263 public void setMagicSplash(boolean magicSplash) {
5264 this.magicSplash = magicSplash;
5265 }
5266
5267 public int getMagicDamage() {
5268 return magicDamage;
5269 }
5270
5271 public int setMagicDamage(int magicDamage) {
5272 this.magicDamage = magicDamage;
5273 return magicDamage;
5274 }
5275
5276 public int getUnderAttackBy() {
5277 return underAttackBy;
5278 }
5279
5280 public void setUnderAttackBy(int underAttackBy) {
5281 this.underAttackBy = underAttackBy;
5282 }
5283
5284 public int getLastAttackedBy() {
5285 return lastAttackedBy;
5286 }
5287
5288 public void setLastAttackedBy(int lastAttackedBy) {
5289 this.lastAttackedBy = lastAttackedBy;
5290 }
5291
5292 public int getHitDelay() {
5293 return hitDelay;
5294 }
5295
5296 public void setHitDelay(int hitDelay) {
5297 this.hitDelay = hitDelay;
5298 }
5299
5300 public int getCombatStyle() {
5301 return combatStyle;
5302 }
5303
5304 public void setCombatStyle(int combatStyle) {
5305 this.combatStyle = combatStyle;
5306 }
5307
5308 public int getOldSpellId() {
5309 return oldSpellId;
5310 }
5311
5312 public void setOldSpellId(int oldSpellId) {
5313 this.oldSpellId = oldSpellId;
5314 }
5315
5316 public boolean isMoving() {
5317 return isMoving;
5318 }
5319
5320 public void setMoving(boolean isMoving) {
5321 this.isMoving = isMoving;
5322 }
5323
5324 public int getDuelingWith() {
5325 return duelingWith;
5326 }
5327
5328 public void setDuelingWith(int duelingWith) {
5329 this.duelingWith = duelingWith;
5330 }
5331
5332 public int getTradingWithId() {
5333 return tradeWith;
5334 }
5335
5336 public void setTradeWith(int tradeWith) {
5337 this.tradeWith = tradeWith;
5338 }
5339
5340 /**
5341 * As long as this is true, the next hitsplat will be a magic one.
5342 */
5343 private boolean usingMagic;
5344
5345 public boolean isUsingMagic() {
5346 return usingMagic;
5347 }
5348
5349 public void setUsingMagic(boolean state) {
5350 usingMagic = state;
5351 }
5352
5353 public int getSpellId() {
5354 return spellId;
5355 }
5356
5357 public void setSpellId(int spellId) {
5358 this.spellId = spellId;
5359 }
5360
5361 public int doAmount;
5362
5363 public long lastFire;
5364
5365 public long lastLockPick;
5366
5367 public boolean playerIsFiremaking;
5368
5369 public int privateChat;
5370
5371 private int specEffect;
5372
5373 public int specBarId;
5374
5375 public int[] itemRequirement = new int[22];
5376
5377 public int switches;
5378
5379 public int skullTimer;
5380
5381 public int votingPoints;
5382
5383 public int nextDialogue;
5384
5385 private int dialogueAction;
5386
5387 public int randomCoffin;
5388
5389 private int autocastId;
5390
5391 public int barrageCount;
5392
5393 private int autoRetaliate;
5394
5395 public int getAutoRetaliate() {
5396 return autoRetaliate;
5397 }
5398
5399 public void setAutoRetaliate(int autoRetaliate) {
5400 this.autoRetaliate = autoRetaliate;
5401 }
5402
5403 private int xInterfaceId;
5404
5405 public int xRemoveId;
5406
5407 public int xRemoveSlot;
5408
5409 public int coinsPile;
5410
5411 public int magicAltar;
5412
5413 public int bonusAttack;
5414
5415 /**
5416 * The last npc index i attacked. This is never reset.
5417 */
5418 private int lastNpcAttackedIndex = -1;
5419
5420 public int bankWithdraw;
5421
5422 public int destroyItem;
5423
5424 public int npcId2;
5425
5426 public int lastChatId = 1;
5427
5428 private int clanId = -1;
5429
5430 public int itemDestroyedId = -1;
5431
5432 public boolean splitChat;
5433
5434 private boolean jailed;
5435
5436 public boolean initialized;
5437
5438 private boolean disconnected;
5439
5440 public boolean rebuildNpcList;
5441
5442 private boolean isActive;
5443
5444 public boolean hasMultiSign;
5445
5446 public boolean saveCharacter;
5447
5448 public boolean mouseButton;
5449
5450 public boolean chatEffects = true;
5451
5452 public boolean adminAttack;
5453
5454 public boolean acceptAid;
5455
5456 private boolean usingDarkBowSpecialAttack;
5457
5458 public boolean isUsingDeathInterface;
5459
5460 private int interfaceIdOpened;
5461
5462 public String bankPin = "";
5463
5464 public int attempts = 3;
5465
5466 public boolean hasEnteredPin;
5467
5468 public String enteredPin = "";
5469
5470 public boolean setPin;
5471
5472 public String fullPin = "";
5473
5474 public int getObjectX() {
5475 return objectX;
5476 }
5477
5478 public int getObjectY() {
5479 return objectY;
5480 }
5481
5482 private int projectileStage;
5483
5484 /**
5485 * MODERN/LUNAR/ANCIENT
5486 */
5487 public String spellBook = "MODERN";
5488
5489 public int teleGfx;
5490
5491 public int teleEndGfx;
5492
5493 public int teleEndAnimation;
5494
5495 public int teleportToHeight;
5496
5497 public int teleX;
5498
5499 public int teleY;
5500
5501 public int teleHeight;
5502
5503 /**
5504 * The last ranged weapon used that will be dropped on floor, such as
5505 * knifes/arrows etc..
5506 */
5507 private int droppedRangedWeaponUsed;
5508
5509 public int killingNpcIndex;
5510
5511 private int oldNpcIndex;
5512
5513 private int attackTimer;
5514
5515 private int npcType;
5516
5517 public int castingSpellId;
5518
5519 public int oldSpellId;
5520
5521 private int spellId;
5522
5523 private int hitDelay;
5524
5525 public int hitDelay2;
5526
5527 private int bowSpecShot;
5528
5529 private int clickNpcType;
5530
5531 public int clickObjectType;
5532
5533 private int objectId;
5534
5535 private int objectX;
5536
5537 private int objectY;
5538
5539 public int objectXOffset;
5540
5541 public int objectYOffset;
5542
5543 public int objectDistance;
5544
5545 public int itemPickedUpX, itemPickedUpY, itemPickedUpId;
5546
5547 private boolean isMoving;
5548
5549 public boolean walkingToItem;
5550
5551 public boolean walkingToItemEvent;
5552
5553 public boolean magicOnFloor;
5554
5555 private int shopId;
5556
5557 private int tradeStatus;
5558
5559 private int tradeWith;
5560
5561 public boolean ignoreTradeMessage;
5562
5563 public boolean forcedChatUpdateRequired, inDuel, tradeAccepted, goodTrade;
5564
5565 private boolean inTrade;
5566
5567 public boolean tradeRequested;
5568
5569 public boolean tradeResetNeeded;
5570
5571 public boolean tradeConfirmed;
5572
5573 public boolean tradeConfirmed2;
5574
5575 public boolean canOffer;
5576
5577 public boolean acceptTrade;
5578
5579 public boolean acceptedTrade;
5580
5581 public int attackAnim;
5582
5583 public int animationWaitCycles;
5584
5585 public int[] playerBonus = new int[12];
5586
5587 public boolean runModeOn = true;
5588
5589 public boolean takeAsNote;
5590
5591 private int combatLevel;
5592
5593 public boolean saveFile;
5594
5595 public int playerAppearance[] = new int[13];
5596
5597 public int tempItems[] = new int[ServerConstants.BANK_SIZE];
5598
5599 public int tempItemsN[] = new int[ServerConstants.BANK_SIZE];
5600
5601 public int tempItemsT[] = new int[ServerConstants.BANK_SIZE];
5602
5603 public int tempItemsS[] = new int[ServerConstants.BANK_SIZE];
5604
5605 public boolean[] invSlot = new boolean[28], equipSlot = new boolean[14];
5606
5607 public long[][] friends = new long[200][2];
5608
5609 public long ignores[] = new long[200];
5610
5611 private double specialAttackAmount = 10;
5612
5613 private double specialAttackAccuracyMultiplier = 1;
5614
5615 public double specDamage = 1.0;
5616
5617 public double prayerPoint = 1.0;
5618
5619 public int teleGrabItem;
5620
5621 public int teleGrabX;
5622
5623 public int teleGrabY;
5624
5625 private int duelCount;
5626
5627 /**
5628 * The attacker(other player) identity that is attacking this player.
5629 */
5630 private int underAttackBy;
5631
5632 private int npcIndexAttackingPlayer;
5633
5634 private int wildernessLevel;
5635
5636 private int teleTimer;
5637
5638 public int getTeleTimer() {
5639 return teleTimer;
5640 }
5641
5642 public void setTeleTimer(int teleTimer) {
5643 this.teleTimer = teleTimer;
5644 }
5645
5646 public long drainRunEnergyFaster;
5647 public long immuneToMeleeAttacks;
5648
5649 public long miasmicSpeedTimeElapsed;
5650 public int miasmicSpeedTime;
5651
5652 public long teleBlockEndTime;
5653
5654 public int poisonDelay;
5655
5656 public int venomDelay;
5657
5658 public int vengTimer;
5659
5660 public long lastPlayerMove;
5661
5662 public long dfsDelay;
5663
5664 public long lastVeng;
5665
5666 public long teleGrabDelay;
5667
5668 public long lastWebCut;
5669
5670 public long alchDelay;
5671
5672 public long reduceStat;
5673
5674 public long buryDelay;
5675
5676 public long foodDelay;
5677
5678 public long potDelay;
5679
5680 public long karambwanDelay;
5681
5682 public long pizzaDelay;
5683
5684 public long diceDelay;
5685
5686 public long tradeDelay;
5687
5688 public long clickDelay;
5689
5690 private int trapsLaid;
5691
5692 public int getTrapsLaid() {
5693 return trapsLaid;
5694 }
5695
5696 public void setTrapsLaid(int trapsLaid) {
5697 this.trapsLaid = trapsLaid;
5698 }
5699
5700 public boolean canChangeAppearance;
5701
5702 public byte duelForceChatCount = 4;
5703
5704 public int reduceSpellId;
5705
5706 public int headIcon = -1;
5707
5708 public int duelTimer, duelTeleX, duelTeleY;
5709
5710 private int duelItemSlot;
5711
5712 public int duelSpaceReq;
5713
5714 public int duelOptionFrameId;
5715
5716 private int duelingWith;
5717
5718 public int headIconPk = -1, headIconHints;
5719
5720 public boolean duelRequested;
5721
5722 private boolean usingSpecial;
5723
5724 private boolean isWieldingRangedWeaponWithNoArrowSlotRequirement;
5725
5726 private boolean usingMediumRangeRangedWeapon;
5727
5728 private int combatStyle = ServerConstants.AGGRESSIVE;
5729
5730 public boolean[] duelRule = new boolean[22];
5731
5732 public final int[] ARROWS = { 882, 884, 886, 888, 890, 892, 21326, 4740, 11212, 9140, 9141, 4142, 9143, 9144, 9240,
5733 9241, 9242, 9243, 9244, 9245, 15243, 9337, 9338, 9339, 9340, 9341, 9342, 21905, 21924, 21926, 21928, 21932,
5734 21934, 21936, 21938, 21940, 21942, 21944, 21946, 21948, 21950 };
5735
5736 public long[] reduceSpellDelay = new long[6];
5737
5738 public boolean[] canUseReducingSpell = { true, true, true, true, true, true };
5739
5740 public long stopPrayerDelay;
5741
5742 public boolean[] prayerActive = { false, false, false, false, false, false, false, false, false, false, false,
5743 false, false, false, false, false, false, false, false, false, false, false, false, false, false, false,
5744 false, false, false };
5745
5746 public long[] timePrayerActivated = new long[Prayer.values().length];
5747
5748 public void setPrayerActive(int index, boolean state) {
5749 prayerActive[index] = state;
5750 RegularPrayer.handlePrayerDrain(this);
5751 }
5752
5753 public boolean prayerEvent;
5754
5755 public boolean getCombatStyle(int type) {
5756 return getCombatStyle() == type;
5757 }
5758
5759 private Stream outStream = null;
5760
5761 public Stream getOutStream() {
5762 return outStream;
5763 }
5764
5765 /**
5766 * Current ip address.
5767 */
5768 public String addressIp = "";
5769
5770 /**
5771 * The player's unique identity number.
5772 */
5773 private int playerId = -1;
5774
5775 public String getPlayerName() {
5776 return playerName;
5777 }
5778
5779 /**
5780 * The name in the form of a base 64 long.
5781 *
5782 * @return the name of the player.
5783 */
5784 public long getNameAsLong() {
5785 return nameAsLong;
5786 }
5787
5788 public String getLowercaseName() {
5789 return playerName.toLowerCase();
5790 }
5791
5792 public void setPlayerName(String string) {
5793 playerName = string;
5794 nameAsLong = Misc.stringToLong(string);
5795 }
5796
5797 public boolean clickToTeleport = false;
5798
5799 public String playerName = null;
5800
5801 public String playerPass = null;
5802
5803 public int playerRights;
5804
5805 public boolean forceX1ExperienceRate;
5806
5807 public PlayerHandler handler = null;
5808
5809 /**
5810 * Item id stored here are +1, so 4151 whip becomes 4152
5811 */
5812 public int playerItems[] = new int[28];
5813
5814 public int playerItemsN[] = new int[28];
5815
5816 public int playerStandIndex = 0x328;
5817
5818 public int playerTurnIndex = 0x337;
5819
5820 public int playerWalkIndex = 0x333;
5821
5822 public int playerTurn180Index = 0x334;
5823
5824 public int playerTurn90CWIndex = 0x335;
5825
5826 public int playerTurn90CCWIndex = 0x336;
5827
5828 public int playerRunIndex = 0x338;
5829
5830 public int[] playerEquipment = new int[14];
5831
5832 public int[] playerEquipmentN = new int[14];
5833
5834 public int getWieldedWeapon() {
5835 return playerEquipment[ServerConstants.WEAPON_SLOT];
5836 }
5837
5838 public boolean getEquippedWeapon(int itemId) {
5839 return playerEquipment[ServerConstants.WEAPON_SLOT] == itemId;
5840 }
5841
5842 public boolean getEquippedHelm(int itemId) {
5843 return playerEquipment[ServerConstants.HEAD_SLOT] == itemId;
5844 }
5845
5846 public boolean getEquippedBody(int itemId) {
5847 return playerEquipment[ServerConstants.BODY_SLOT] == itemId;
5848 }
5849
5850 public boolean getEquippedLeg(int itemId) {
5851 return playerEquipment[ServerConstants.LEG_SLOT] == itemId;
5852 }
5853
5854 public boolean getEquippedBoots(int itemId) {
5855 return playerEquipment[ServerConstants.FEET_SLOT] == itemId;
5856 }
5857
5858 public boolean getEquippedAmulet(int itemId) {
5859 return playerEquipment[ServerConstants.AMULET_SLOT] == itemId;
5860 }
5861
5862 public boolean getEquippedArrows(int itemId) {
5863 return playerEquipment[ServerConstants.ARROW_SLOT] == itemId;
5864 }
5865
5866 public boolean getEquippedGloves(int itemId) {
5867 return playerEquipment[ServerConstants.HAND_SLOT] == itemId;
5868 }
5869
5870 public boolean getEquippedRing(int itemId) {
5871 return playerEquipment[ServerConstants.RING_SLOT] == itemId;
5872 }
5873
5874 public boolean getEquippedShield(int itemId) {
5875 return playerEquipment[ServerConstants.SHIELD_SLOT] == itemId;
5876 }
5877
5878 public boolean getEquippedCape(int itemId) {
5879 return playerEquipment[ServerConstants.CAPE_SLOT] == itemId;
5880 }
5881
5882 /**
5883 * This array will store the items of the current bank tab being viewed into
5884 * this array.
5885 */
5886 public int bankingItems[] = new int[ServerConstants.BANK_SIZE];
5887
5888 public int bankingItemsN[] = new int[ServerConstants.BANK_SIZE];
5889
5890 public int bankingTab = 0; // -1 = bank closed
5891
5892 public boolean doNotSendTabs;
5893
5894 public int bankItems[] = new int[ServerConstants.BANK_SIZE];
5895
5896 public int bankItemsN[] = new int[ServerConstants.BANK_SIZE];
5897
5898 public int bankItems1[] = new int[ServerConstants.BANK_SIZE];
5899
5900 public int bankItems1N[] = new int[ServerConstants.BANK_SIZE];
5901
5902 public int bankItems2[] = new int[ServerConstants.BANK_SIZE];
5903
5904 public int bankItems2N[] = new int[ServerConstants.BANK_SIZE];
5905
5906 public int bankItems3[] = new int[ServerConstants.BANK_SIZE];
5907
5908 public int bankItems3N[] = new int[ServerConstants.BANK_SIZE];
5909
5910 public int bankItems4[] = new int[ServerConstants.BANK_SIZE];
5911
5912 public int bankItems4N[] = new int[ServerConstants.BANK_SIZE];
5913
5914 public int bankItems5[] = new int[ServerConstants.BANK_SIZE];
5915
5916 public int bankItems5N[] = new int[ServerConstants.BANK_SIZE];
5917
5918 public int bankItems6[] = new int[ServerConstants.BANK_SIZE];
5919
5920 public int bankItems6N[] = new int[ServerConstants.BANK_SIZE];
5921
5922 public int bankItems7[] = new int[ServerConstants.BANK_SIZE];
5923
5924 public int bankItems7N[] = new int[ServerConstants.BANK_SIZE];
5925
5926 public int bankItems8[] = new int[ServerConstants.BANK_SIZE];
5927
5928 public int bankItems8N[] = new int[ServerConstants.BANK_SIZE];
5929
5930 /**
5931 * Instances of players that i have seen before.
5932 */
5933 public Player playerList[] = new Player[ServerConstants.MAXIMUM_PLAYERS];
5934
5935 public int playerListSize = 0;
5936
5937 public byte playerInListBitmap[] = new byte[(ServerConstants.MAXIMUM_PLAYERS + 7) >> 3];
5938
5939 public static final int maxNPCListSize = NpcHandler.NPC_INDEX_OPEN_MAXIMUM;
5940
5941 public Npc npcList[] = new Npc[maxNPCListSize];
5942
5943 public int npcListSize = 0;
5944
5945 public byte npcInListBitmap[] = new byte[(NpcHandler.NPC_INDEX_OPEN_MAXIMUM + 7) >> 3];
5946
5947 /**
5948 * True if the specific index is an Npc that requires an npc transform update.
5949 * So the transformation is sent to the client once.
5950 */
5951 public boolean npcTransformRequiresUpdate[] = new boolean[NpcHandler.NPC_INDEX_OPEN_MAXIMUM];
5952
5953 private int mapRegionX, mapRegionY;
5954
5955 private int playerX;
5956
5957 private int playerY;
5958
5959 public int walkingQueueCurrentSize;
5960
5961 public int currentX, currentY;
5962
5963 private boolean updateRequired = true;
5964
5965 public final int walkingQueueSize = 50;
5966
5967 public int walkingQueueX[] = new int[walkingQueueSize], walkingQueueY[] = new int[walkingQueueSize];
5968
5969 public int wQueueReadPtr = 0;
5970
5971 public int wQueueWritePtr = 0;
5972
5973 public boolean isRunning = true;
5974
5975 public int teleportToX = -1, teleportToY = -1;
5976
5977 public boolean didTeleport;
5978
5979 public boolean mapRegionDidChange;
5980
5981 public int dir1 = -1, dir2 = -1;
5982
5983 /**
5984 * The timer used for Completionist cape emote.
5985 */
5986 public int dungTime = 16;
5987
5988 public int DirectionCount = 0;
5989
5990 public boolean appearanceUpdateRequired = true;
5991
5992 public boolean justTransformed;
5993
5994 protected int hitDiff2;
5995
5996 private int hitDiff = 0;
5997
5998 public boolean cycleEventDamageRunning;
5999
6000 protected boolean hitUpdateRequired2;
6001
6002 private boolean hitUpdateRequired;
6003
6004 protected static Stream playerProps;
6005
6006 static {
6007 playerProps = new Stream(new byte[100]);
6008 }
6009
6010 public int[][] barrowsNpcs = { { 1677, 0 }, // verac
6011 { 1676, 0 }, // toarg
6012 { 1675, 0 }, // karil
6013 { 1674, 0 }, // guthan
6014 { 1673, 0 }, // dharok
6015 { 1672, 0 } // ahrim
6016 };
6017
6018 public int soakDamage, soakDamage2 = 0;
6019
6020 public int[] damageTaken = new int[ServerConstants.MAXIMUM_PLAYERS];
6021
6022 public String[] damageTakenName = new String[ServerConstants.MAXIMUM_PLAYERS];
6023
6024 public int hitMask;
6025
6026 public int hitIcon;
6027
6028 public int hitMask2;
6029
6030 public int hitIcon2;
6031
6032 private boolean chatTextUpdateRequired;
6033
6034 private byte chatText[] = new byte[4096];
6035
6036 private byte chatTextSize = 0;
6037
6038 private int chatTextColor = 0;
6039
6040 private int chatTextEffects = 0;
6041
6042 private String forcedText = "null";
6043
6044 public int mask100var1 = 0;
6045
6046 public int mask100var2 = 0;
6047
6048 protected boolean mask100update;
6049
6050 public int newWalkCmdX[] = new int[walkingQueueSize];
6051
6052 public int newWalkCmdY[] = new int[walkingQueueSize];
6053
6054 private int newWalkCmdSteps = 0;
6055
6056 public boolean newWalkCmdIsRunning;
6057
6058 public int travelBackX[] = new int[walkingQueueSize];
6059
6060 public int travelBackY[] = new int[walkingQueueSize];
6061
6062 public int numTravelBackSteps = 0;
6063
6064 public void preProcessing() {
6065 setNewWalkCmdSteps(0);
6066 }
6067
6068 public int getMapRegionX() {
6069 return mapRegionX;
6070 }
6071
6072 public int getMapRegionY() {
6073 return mapRegionY;
6074 }
6075
6076 public int getLocalX() {
6077 return getX() - 8 * getMapRegionX();
6078 }
6079
6080 public int getLocalY() {
6081 return getY() - 8 * getMapRegionY();
6082 }
6083
6084 public void forcedChat(String message, boolean sendToAllVisiblePlayersChatBox, boolean showQuickChatIconInChatBox) {
6085 setForcedText(message);
6086 forcedChatUpdateRequired = true;
6087 setUpdateRequired(true);
6088 setAppearanceUpdateRequired(true);
6089 InterfaceAssistant.sendChatBoxMessageOfForcedChat(this, this.getPlayerName(), message,
6090 showQuickChatIconInChatBox);
6091 if (sendToAllVisiblePlayersChatBox) {
6092 for (Player loop : getLocalPlayers()) {
6093 InterfaceAssistant.sendChatBoxMessageOfForcedChat(loop, this.getPlayerName(), message,
6094 showQuickChatIconInChatBox);
6095 }
6096 }
6097 }
6098
6099 /**
6100 * The player's x-coordinate.
6101 *
6102 * @return Player's x-cooridnate.
6103 */
6104 public int getX() {
6105 return playerX;
6106 }
6107
6108 /**
6109 * The player's y-coordinate.
6110 *
6111 * @return Player's y-cooridnate.
6112 */
6113 public int getY() {
6114 return playerY;
6115 }
6116
6117 /**
6118 * Get the player's height level.
6119 *
6120 * @return The height level.
6121 */
6122 public int getHeight() {
6123 return height;
6124 }
6125
6126 private int height;
6127
6128 public int getHitDiff() {
6129 return hitDiff;
6130 }
6131
6132 public void setHitUpdateRequired(boolean hitUpdateRequired) {
6133 this.hitUpdateRequired = hitUpdateRequired;
6134 }
6135
6136 public boolean isHitUpdateRequired() {
6137 return hitUpdateRequired;
6138 }
6139
6140 public void setAppearanceUpdateRequired(boolean appearanceUpdateRequired) {
6141 this.appearanceUpdateRequired = appearanceUpdateRequired;
6142 }
6143
6144 public boolean isAppearanceUpdateRequired() {
6145 return appearanceUpdateRequired;
6146 }
6147
6148 public void setChatTextEffects(int chatTextEffects) {
6149 this.chatTextEffects = chatTextEffects;
6150 }
6151
6152 public int getChatTextEffects() {
6153 return chatTextEffects;
6154 }
6155
6156 public void setChatTextSize(byte chatTextSize) {
6157 this.chatTextSize = chatTextSize;
6158 }
6159
6160 public byte getChatTextSize() {
6161 return chatTextSize;
6162 }
6163
6164 public void setChatTextUpdateRequired(boolean chatTextUpdateRequired) {
6165 this.chatTextUpdateRequired = chatTextUpdateRequired;
6166 }
6167
6168 public boolean isChatTextUpdateRequired() {
6169 return chatTextUpdateRequired;
6170 }
6171
6172 public byte[] getChatText() {
6173 return chatText;
6174 }
6175
6176 public void setChatTextColor(int chatTextColor) {
6177 this.chatTextColor = chatTextColor;
6178 }
6179
6180 public int getChatTextColor() {
6181 return chatTextColor;
6182 }
6183
6184 public int[] getNewWalkCmdX() {
6185 return newWalkCmdX;
6186 }
6187
6188 public void setNewWalkCmdY(int newWalkCmdY[]) {
6189 this.newWalkCmdY = newWalkCmdY;
6190 }
6191
6192 public int[] getNewWalkCmdY() {
6193 return newWalkCmdY;
6194 }
6195
6196 public void setNewWalkCmdIsRunning(boolean newWalkCmdIsRunning) {
6197 this.newWalkCmdIsRunning = newWalkCmdIsRunning;
6198 }
6199
6200 public boolean isNewWalkCmdIsRunning() {
6201 return newWalkCmdIsRunning;
6202 }
6203
6204 public void setInStreamDecryption(ISAACRandomGen inStreamDecryption) {
6205 }
6206
6207 public void setOutStreamDecryption(ISAACRandomGen outStreamDecryption) {
6208 }
6209
6210 public byte buffer[] = null;
6211
6212 public int packetSize = 0, packetType = -1;
6213
6214 public IoSession session;
6215
6216 public IoSession getSession() {
6217 return session;
6218 }
6219
6220 public Queue<Packet> queuedPackets = new LinkedList<Packet>();
6221
6222 public Stream inStream = null;
6223
6224 public Stream getInStream() {
6225 return inStream;
6226 }
6227
6228 private ShopAssistant shopAssistant = new ShopAssistant(this);
6229
6230 public ShopAssistant getShops() {
6231 return shopAssistant;
6232 }
6233
6234 private TradeAndDuel tradeAndDuel = new TradeAndDuel(this);
6235
6236 public TradeAndDuel getTradeAndDuel() {
6237 return tradeAndDuel;
6238 }
6239
6240 public PlayerAssistant playerAssistant = new PlayerAssistant(this);
6241
6242 public TeleportHandler1 tele = new TeleportHandler1(this);
6243
6244 public PlayerAssistant getPA() {
6245 return playerAssistant;
6246 }
6247 public TeleportHandler1 getTele() {
6248 return tele;
6249 }
6250
6251 private DialogueHandler dialogueHandler = new DialogueHandler(this);
6252
6253 public long timeUnderAttackByAnotherPlayerAchievement;
6254
6255 public long timeAttackedAnotherPlayerAchievement;
6256
6257 public boolean noClip = false;
6258
6259 public int itemDestroyedSlot;
6260
6261 public String lastDialogueOptionString = "";
6262
6263 public boolean soundSent;
6264
6265 public long lastSpammedSoundTime;
6266
6267 public long timeSentFoodSound;
6268
6269 public long timeSentDrinkSound;
6270
6271 public boolean itemWorn;
6272
6273 public long lastThieve;
6274
6275 public long timePlayerAttackedNpc;
6276
6277 public long timeReloadedItems;
6278
6279 public boolean armadylCrossbowSpecial;
6280
6281 public boolean dragonCrossbowSpecial;
6282
6283 public boolean doingClickObjectType4Event;
6284
6285 public DialogueHandler getDH() {
6286 return dialogueHandler;
6287 }
6288
6289 public boolean isJailed() {
6290 return jailed;
6291 }
6292
6293 public void setJailed(boolean jailed) {
6294 this.jailed = jailed;
6295 }
6296
6297 public int getClickNpcType() {
6298 return clickNpcType;
6299 }
6300
6301 public void setClickNpcType(int clickNpcType) {
6302 this.clickNpcType = clickNpcType;
6303 }
6304
6305 public int getOldNpcIndex() {
6306 return oldNpcIndex;
6307 }
6308
6309 public void setOldNpcIndex(int oldNpcIndex) {
6310 this.oldNpcIndex = oldNpcIndex;
6311 }
6312
6313 public boolean isDisconnected() {
6314 return disconnected;
6315 }
6316
6317 public void setDisconnected(boolean disconnected, String reason) {
6318 PlayerHandler.disconnectReason
6319 .add("[" + Misc.getDateAndTimeAndSeconds() + "] " + getPlayerName() + ", disconnect boolean:" + reason);
6320 this.disconnected = disconnected;
6321 }
6322
6323 public int getTimeOutCounter() {
6324 return timeOutCounter;
6325 }
6326
6327 public void setTimeOutCounter(int timeOutCounter) {
6328 this.timeOutCounter = timeOutCounter;
6329 }
6330
6331 public boolean isUpdateRequired() {
6332 return updateRequired;
6333 }
6334
6335 public void setUpdateRequired(boolean updateRequired) {
6336 this.updateRequired = updateRequired;
6337 }
6338
6339 public double getSpecialAttackAccuracyMultiplier() {
6340 return specialAttackAccuracyMultiplier;
6341 }
6342
6343 public void setSpecialAttackAccuracyMultiplier(double specialAttackAccuracyMultiplier) {
6344 this.specialAttackAccuracyMultiplier = specialAttackAccuracyMultiplier;
6345 }
6346
6347 public boolean isTutorialComplete() {
6348 return tutorialComplete;
6349 }
6350
6351 public void setTutorialComplete(boolean tutorialComplete) {
6352 this.tutorialComplete = tutorialComplete;
6353 }
6354
6355 public int getNewWalkCmdSteps() {
6356 return newWalkCmdSteps;
6357 }
6358
6359 public int setNewWalkCmdSteps(int newWalkCmdSteps) {
6360 this.newWalkCmdSteps = newWalkCmdSteps;
6361 return newWalkCmdSteps;
6362 }
6363
6364 public int getMeleeMainKills() {
6365 return meleeMainKills;
6366 }
6367
6368 public void setMeleeMainKills(int meleeKills) {
6369 this.meleeMainKills = meleeKills;
6370 }
6371
6372 public int getHybridKills() {
6373 return hybridKills;
6374 }
6375
6376 public void setHybridKills(int hybridKills) {
6377 this.hybridKills = hybridKills;
6378 }
6379
6380 public int getBerserkerPureKills() {
6381 return berserkerPureKills;
6382 }
6383
6384 public void setBerserkerPureKills(int berserkerPureKills) {
6385 this.berserkerPureKills = berserkerPureKills;
6386 }
6387
6388 public int getPureKills() {
6389 return pureKills;
6390 }
6391
6392 public void setPureKills(int pureKills) {
6393 this.pureKills = pureKills;
6394 }
6395
6396 public int getRangedTankKills() {
6397 return rangedTankKills;
6398 }
6399
6400 public void setRangedTankKills(int rangedTankKills) {
6401 this.rangedTankKills = rangedTankKills;
6402 }
6403
6404 public int getCombatLevel() {
6405 return combatLevel;
6406 }
6407
6408 public void setCombatLevel(int combatLevel) {
6409 this.combatLevel = combatLevel;
6410 }
6411
6412 public int getNpcType() {
6413 return npcType;
6414 }
6415
6416 public void setNpcType(int npcType) {
6417 this.npcType = npcType;
6418 }
6419
6420 public boolean isUsingFightCaves() {
6421 return usingFightCaves;
6422 }
6423
6424 public void setUsingFightCaves(boolean isPreparingForFightCaves) {
6425 this.usingFightCaves = isPreparingForFightCaves;
6426 }
6427
6428 public long getXpTotal() {
6429 return xpTotal;
6430 }
6431
6432 public void setXpTotal(long xpTotal) {
6433 this.xpTotal = xpTotal;
6434 }
6435
6436 public int getObjectId() {
6437 return objectId;
6438 }
6439
6440 public void setObjectId(int id) {
6441 objectId = id;
6442 }
6443
6444 public int getAgilityCourseCompletedMessage() {
6445 return agilityCourseCompletedMessage;
6446 }
6447
6448 public void setAgilityCourseCompletedMessage(int agilityCourseCompletedMessage) {
6449 this.agilityCourseCompletedMessage = agilityCourseCompletedMessage;
6450 }
6451
6452 public String getAmountInterface() {
6453 return amountInterface;
6454 }
6455
6456 public void setAmountInterface(String amountInterface) {
6457 this.amountInterface = amountInterface;
6458 if (!amountInterface.isEmpty()) {
6459 this.setxInterfaceId(0); // Resetting it to stop it from also withdrawing from other
6460 // interfaces like the bank.
6461 }
6462 }
6463
6464 public int getNpcClickIndex() {
6465 return npcClickIndex;
6466 }
6467
6468 public void setNpcClickIndex(int npcClickIndex) {
6469 if (npcClickIndex > 0) {
6470 lastNpcClickedIndex = npcClickIndex;
6471 }
6472 this.npcClickIndex = npcClickIndex;
6473 }
6474
6475 public int setObjectX(int objectX) {
6476 this.objectX = objectX;
6477 return objectX;
6478 }
6479
6480 public int getMaximumDamageMagic() {
6481 return maximumDamageMagic;
6482 }
6483
6484 public void setMaximumDamageMagic(int maximumDamageMagic) {
6485 this.maximumDamageMagic = maximumDamageMagic;
6486 }
6487
6488 public boolean getAbleToEditCombat() {
6489 return ableToEditCombat;
6490 }
6491
6492 public void setAbleToEditCombat(boolean canEditCombatStats) {
6493 this.ableToEditCombat = canEditCombatStats;
6494 }
6495
6496 public boolean getResetEcot() {
6497 return ResetEco;
6498 }
6499
6500 public void setgetResetEco(boolean reseteco) {
6501 this.ResetEco = reseteco;
6502 }
6503
6504 public boolean getResetEcot2() {
6505 return ResetEco2;
6506 }
6507
6508 public void setgetResetEco2(boolean reseteco2) {
6509 this.ResetEco2 = reseteco2;
6510 }
6511
6512 public boolean isUsingBankInterface() {
6513 return usingBankInterface;
6514 }
6515
6516 public void setUsingBankInterface(boolean usingBankInterface) {
6517 this.usingBankInterface = usingBankInterface;
6518 }
6519
6520 public int getTotalLevel() {
6521 return totalLevel;
6522 }
6523
6524 public void setTotalLevel(int totalLevel) {
6525 this.totalLevel = totalLevel;
6526 }
6527
6528 public int getBarrowsRunCompleted() {
6529 return barrowsRunCompleted;
6530 }
6531
6532 public void setBarrowsRunCompleted(int barrowsRunCompleted) {
6533 this.barrowsRunCompleted = barrowsRunCompleted;
6534 }
6535
6536 public int getClueScrollsCompleted() {
6537 return clueScrollsCompleted;
6538 }
6539
6540 public void setClueScrollsCompleted(int clueScrollsCompleted) {
6541 this.clueScrollsCompleted = clueScrollsCompleted;
6542 }
6543
6544 public void setOutStream(Stream outStream) {
6545 this.outStream = outStream;
6546 }
6547
6548 public boolean isUsingBankSearch() {
6549 return usingBankSearch;
6550 }
6551
6552 public void setUsingBankSearch(boolean usingBankSearch) {
6553 if (!usingBankSearch) {
6554
6555 this.bankSearchString = "";
6556 }
6557 this.usingBankSearch = usingBankSearch;
6558 }
6559
6560 public boolean processQueuedPackets() {
6561 Packet p = null;
6562
6563 synchronized (queuedPackets) {
6564 p = queuedPackets.poll();
6565 }
6566 if (p == null) {
6567 return false;
6568 }
6569
6570 inStream.currentOffset = 0;
6571 packetType = p.getId();
6572 packetSize = p.getLength();
6573 inStream.buffer = p.getData();
6574 setTimeOutCounter(0);
6575 // Uncomment if player is stuck logged in.
6576 // Misc.print("Player is active: " + getPlayerName() + ", Packet type: " +
6577 // packetType);
6578 if (PacketHandler.showIndividualPackets) {
6579 Misc.print("Player is active: " + getPlayerName() + ", Packet type: " + packetType);
6580 }
6581 if (packetType > 0) {
6582 PacketHandler.processPacket(this, packetType, packetSize);
6583 }
6584 return true;
6585 }
6586
6587 public void flushOutStream() {
6588 if (!this.canFlush && !AdministratorCommand.flushAllTheTime) {
6589 return;
6590 }
6591 if (this.bot) {
6592 return;
6593 }
6594 if (isDisconnected() || getOutStream().currentOffset == 0) {
6595 return;
6596 }
6597 StaticPacketBuilder out = new StaticPacketBuilder().setBare(true);
6598 byte[] temp = new byte[getOutStream().currentOffset];
6599 System.arraycopy(getOutStream().buffer, 0, temp, 0, temp.length);
6600 out.addBytes(temp);
6601 session.write(out.toPacket());
6602 getOutStream().currentOffset = 0;
6603 }
6604
6605 public void update() {
6606 handler.updatePlayer(this, getOutStream());
6607 handler.updateNpc(this, getOutStream());
6608
6609 canFlush = true;
6610 flushOutStream();
6611 canFlush = false;
6612 }
6613
6614 public void queueMessage(Packet arg1) {
6615 synchronized (queuedPackets) {
6616 queuedPackets.add(arg1);
6617 }
6618 }
6619
6620 public void clearUpdateFlags() {
6621 setUpdateRequired(false);
6622 setChatTextUpdateRequired(false);
6623 setAppearanceUpdateRequired(false);
6624 setHitUpdateRequired(false);
6625 hitUpdateRequired2 = false;
6626 forcedChatUpdateRequired = false;
6627 mask100update = false;
6628 forceMovementUpdate = false;
6629 focusPointUpdateRequired = false;
6630 setAnimationRequest(-1);
6631 forceSendAnimation = false;
6632 resetPlayerTurn();
6633 setFaceUpdateRequired(false);
6634 setFace(65535);
6635 if (getFaceResetAtEndOfTick()) {
6636 resetFaceUpdate();
6637 setFaceResetAtEndOfTick(false);
6638 }
6639 }
6640
6641 public void appendMask100Update(Stream str) {
6642 str.writeWordBigEndian(mask100var1);
6643 str.writeDWord(mask100var2);
6644 }
6645
6646 /**
6647 * Gfx will be launched from the middle of the body.
6648 */
6649 public void gfx100(int gfx) {
6650 if (playerPet != null && playerPet.isSummoned() && playerPet.isMimicking() && !Combat.inCombat(this)) {
6651 playerPet.gfx100(gfx);
6652 }
6653 mask100var1 = gfx;
6654 mask100var2 = 6553600;
6655 mask100update = true;
6656 setUpdateRequired(true);
6657 }
6658
6659 /**
6660 * Gfx will be launched from bottom of the body.
6661 *
6662 * @param gfx
6663 */
6664 public void gfx0(int gfx) {
6665 if (playerPet != null && playerPet.isSummoned() && playerPet.isMimicking() && !Combat.inCombat(this)) {
6666 playerPet.gfx0(gfx);
6667 }
6668 mask100var1 = gfx;
6669 mask100var2 = 65536;
6670 mask100update = true;
6671 setUpdateRequired(true);
6672 }
6673
6674 public void gfx(int gfx, int height) {
6675 if (playerPet != null && playerPet.isSummoned() && playerPet.isMimicking() && !Combat.inCombat(this)) {
6676 playerPet.gfx(gfx, height);
6677 }
6678 mask100var1 = gfx;
6679 mask100var2 = 65536 * height;
6680 mask100update = true;
6681 setUpdateRequired(true);
6682 }
6683
6684 public void gfxDelay(int id, int delay, int height) {
6685 mask100var1 = id;
6686 mask100var2 = delay + (65536 * height);
6687 mask100update = true;
6688 updateRequired = true;
6689 }
6690
6691 /**
6692 * Perform an animation.
6693 *
6694 * @param animId
6695 * The animation identity number.
6696 */
6697 public void startAnimation(int animId) {
6698 if (this.forceSendAnimation) {
6699 return;
6700 }
6701 if (animId < 0) {
6702 return;
6703 }
6704 if (this.getTransformed() > 0) {
6705 return;
6706 }
6707 if (playerPet != null && playerPet.isSummoned() && playerPet.isMimicking() && !Combat.inCombat(this)) {
6708 playerPet.startAnimation(animId);
6709 }
6710 setLastAnimation(animId);
6711 setAnimationRequest(animId);
6712 animationWaitCycles = 0;
6713 setUpdateRequired(true);
6714 }
6715
6716 public void appendAnimationRequest(Stream str) {
6717 str.writeWordBigEndian((getAnimationRequest() == -1) ? 65535 : getAnimationRequest());
6718 str.writeByteC(animationWaitCycles);
6719
6720 forceSendAnimation = false;
6721 }
6722
6723 /**
6724 * Face Update
6725 **/
6726 public void faceUpdate(int index) {
6727 if (this.dead) {
6728 resetFaceUpdate();
6729 return;
6730 }
6731 setFace(index);
6732 setFaceUpdateRequired(true);
6733 setUpdateRequired(true);
6734 }
6735
6736 public void appendFaceUpdate(Stream str) {
6737 str.writeWordBigEndian(getFace());
6738 }
6739
6740 public void resetPlayerTurn() {
6741 setUpdateRequired(true);
6742 }
6743
6744 public void resetFaceUpdate() {
6745 setFace(-1);
6746 setFaceUpdateRequired(true);
6747 setUpdateRequired(true);
6748 }
6749
6750 /**
6751 * Turn the player's characterto face the given coordinates.
6752 */
6753 public void turnPlayerTo(int pointX, int pointY) {
6754 if (this.getDead()) {
6755 resetPlayerTurn();
6756 return;
6757 }
6758 setFocusPointX(2 * pointX + 1);
6759 setFocusPointY(2 * pointY + 1);
6760 focusPointUpdateRequired = true;
6761 setUpdateRequired(true);
6762 int x = getX() - pointX;
6763 int y = getY() - pointY;
6764 this.directionFacingPath = Misc.direction(getX(), getY(), x, y);
6765 }
6766
6767 private void appendSetFocusDestination(Stream str) {
6768 str.writeWordBigEndianA(getFocusPointX());
6769 str.writeWordBigEndian(getFocusPointY());
6770 }
6771
6772 protected void appendHitUpdate(Stream str) {
6773 str.writeWordA(getHitDiff());
6774 str.writeByte(hitMask);
6775 str.writeByte(hitIcon);
6776 str.writeWordA(soakDamage);
6777 str.writeWordA(currentCombatSkillLevel[ServerConstants.HITPOINTS]);
6778 str.writeWordA(getBaseHitPointsLevel());
6779 }
6780
6781 protected void appendHitUpdate2(Stream str) {
6782 str.writeWordA(hitDiff2);
6783 str.writeByte(hitMask2);
6784 str.writeByte(hitIcon2);
6785 str.writeWordA(soakDamage2);
6786 str.writeWordA(currentCombatSkillLevel[ServerConstants.HITPOINTS]);
6787 str.writeWordA(getBaseHitPointsLevel());
6788 }
6789
6790 public boolean forceSendAnimation;
6791
6792 public boolean appendPlayerUpdateBlock(Stream str, boolean forceStop) {
6793 boolean appearanceUpdated = false;
6794 if (!isUpdateRequired() && !chatTextUpdateRequired) {
6795 return false;
6796 }
6797 int updateMask = 0;
6798 if (forceMovementUpdate) {
6799 updateMask |= 0x400;
6800 }
6801 if (mask100update) {
6802 updateMask |= 0x100;
6803 }
6804 if (getAnimationRequest() != -1) {
6805 updateMask |= 8;
6806 }
6807 if (forcedChatUpdateRequired) {
6808 updateMask |= 4;
6809 }
6810 if (isChatTextUpdateRequired()) {
6811 updateMask |= 0x80;
6812 }
6813 if (isAppearanceUpdateRequired() && !forceStop) {
6814 updateMask |= 0x10;
6815 }
6816 if (isFaceUpdateRequired()) {
6817 updateMask |= 1;
6818 }
6819 if (focusPointUpdateRequired) {
6820 updateMask |= 2;
6821 }
6822 if (isHitUpdateRequired()) {
6823 updateMask |= 0x20;
6824 }
6825
6826 if (hitUpdateRequired2) {
6827 updateMask |= 0x200;
6828 }
6829
6830 if (updateMask >= 0x100) {
6831 updateMask |= 0x40;
6832 str.writeByte(updateMask & 0xFF);
6833 str.writeByte(updateMask >> 8);
6834 } else {
6835 str.writeByte(updateMask);
6836 }
6837
6838 // now writing the various update blocks itself - note that their order crucial.
6839
6840 if (forceMovementUpdate) {
6841 appendForceMovement(str);
6842 }
6843 if (mask100update) {
6844 appendMask100Update(str);
6845 }
6846 if (getAnimationRequest() != -1) {
6847 appendAnimationRequest(str);
6848 }
6849 if (forcedChatUpdateRequired) {
6850 appendForcedChat(str);
6851 }
6852 if (isChatTextUpdateRequired()) {
6853 appendPlayerChatText(str);
6854 }
6855 if (isFaceUpdateRequired()) {
6856 appendFaceUpdate(str);
6857 }
6858 if (isAppearanceUpdateRequired() && !forceStop) {
6859 appendPlayerAppearance(str);
6860 appearanceUpdated = true;
6861 }
6862 if (focusPointUpdateRequired) {
6863 appendSetFocusDestination(str);
6864 }
6865 if (isHitUpdateRequired()) {
6866 appendHitUpdate(str);
6867 }
6868 if (hitUpdateRequired2) {
6869 appendHitUpdate2(str);
6870 }
6871 return appearanceUpdated;
6872 }
6873
6874 public int forceMovementLocalXStart = -1;
6875
6876 public int forceMovementLocalYStart = -1;
6877
6878 public int forceMovementLocalXEnd = -1;
6879
6880 public int forceMovementLocalYEnd = -1;
6881
6882 public int forceMovementSpeedFromCurrentToStart = -1;
6883
6884 public int forceMovementSpeedFromStartToEnd = -1;
6885
6886 public int forceMovementPlayerFace = -1;
6887
6888 /**
6889 * The direction the player is facing depending on the last path walked.
6890 */
6891 public int directionFacingPath = 8;
6892
6893 public boolean teleportUpdateNeeded;
6894
6895 public int frozenBy;
6896
6897 public long cannotEatDelay;
6898
6899 public long pizzaDelayOther;
6900
6901 /**
6902 * The time the player applied a hitsplat on another player using magic/ranged
6903 * or melee.
6904 */
6905 public long hitsplatApplied;
6906
6907 /**
6908 * @param x
6909 * x tiles to move.
6910 * @param y
6911 * y tiles to move
6912 * @param updateCoordinateTicks
6913 * How many ticks later to update the player's coordinate.
6914 */
6915 public void setForceMovement(int animation, int x, int y, int forceMovementSpeedFromCurrentToStart,
6916 int forceMovementSpeedFromStartToEnd, int forceMovementPlayerFace, int updateCoordinateTicks) {
6917 this.startAnimation(animation);
6918 this.forceMovementLocalXStart = getLocalX();
6919 this.forceMovementLocalYStart = getLocalY();
6920 this.forceMovementLocalXEnd = getLocalX() + x;
6921 this.forceMovementLocalYEnd = getLocalY() + y;
6922 this.forceMovementSpeedFromCurrentToStart = forceMovementSpeedFromCurrentToStart;
6923 this.forceMovementSpeedFromStartToEnd = forceMovementSpeedFromStartToEnd;
6924 this.forceMovementPlayerFace = forceMovementPlayerFace;
6925 this.forceMovementUpdate = true;
6926 this.updateRequired = true;
6927 this.forceNoClip = true;
6928 this.agilityEndX = getX() + x;
6929 this.agilityEndY = getY() + y;
6930
6931 CycleEventHandler.getSingleton().addEvent(this, new CycleEvent() {
6932 @Override
6933 public void execute(CycleEventContainer container) {
6934 container.stop();
6935 }
6936
6937 @Override
6938 public void stop() {
6939 getPA().movePlayer(getX() + x, getY() + y, getHeight());
6940 setDoingAgility(false);
6941 }
6942 }, updateCoordinateTicks);
6943 }
6944
6945 public void appendForceMovement(Stream str) {
6946 str.writeByteS(forceMovementLocalXStart);
6947 str.writeByteS(forceMovementLocalYStart);
6948 str.writeByteS(forceMovementLocalXEnd);
6949 str.writeByteS(forceMovementLocalYEnd);
6950 str.writeWordBigEndianA(forceMovementSpeedFromCurrentToStart);
6951 str.writeWordA(forceMovementSpeedFromStartToEnd);
6952 str.writeByteS(forceMovementPlayerFace);
6953 }
6954
6955 public int distanceToPoint(int pointX, int pointY) {
6956 return (int) Math.sqrt(Math.pow(getX() - pointX, 2) + Math.pow(getY() - pointY, 2));
6957 }
6958
6959 protected void appendPlayerChatText(Stream str) {
6960 str.writeWordBigEndian(((getChatTextColor() & 0xFF) << 8) + (getChatTextEffects() & 0xFF));
6961 str.writeByte(playerRights);
6962 str.writeByteC(getChatTextSize());
6963 str.writeBytes_reverse(getChatText(), getChatTextSize(), 0);
6964 }
6965
6966 public void setFocusRelativeToFace() {
6967 PlayerFaceDirection facingDirection = PlayerFaceDirection.DIRECTION_MAP.get(directionFacingPath);
6968
6969 if (facingDirection == null) {
6970 return;
6971 }
6972 turnPlayerTo(getX() + facingDirection.getXOffset(), getY() + facingDirection.getYOffset());
6973 }
6974
6975 public void appendForcedChat(Stream str) {
6976 str.writeString(getForcedText());
6977 }
6978
6979 public void dealDamage(int damage) {
6980 if (playerEquipment[ServerConstants.SHIELD_SLOT] == 13740 && GameType.isPreEoc()) {
6981 if (prayerPoint > 0) {
6982 double damageRecieved = damage * 0.7;
6983 int prayerLost = (int) Math.ceil((damage * 0.3) / 20);
6984 if (prayerPoint >= prayerLost) {
6985 damage = (int) damageRecieved;
6986 prayerPoint -= prayerLost;
6987 if (prayerPoint < 0)
6988 prayerPoint = 0;
6989 }
6990 }
6991 }
6992 if (getCurrentCombatSkillLevel(ServerConstants.HITPOINTS) - damage < 0) {
6993 damage = currentCombatSkillLevel[ServerConstants.HITPOINTS];
6994 }
6995 if (!this.getTank()) {
6996 this.subtractFromHitPoints(damage);
6997 }
6998 BotContent.damaged(this);
6999 if (getCurrentCombatSkillLevel(ServerConstants.HITPOINTS) == 0 && !this.getDead()) {
7000 Death.deathStage(this);
7001 return;
7002 }
7003 Combat.appendRedemption(this, damage);
7004 Effects.phoenixNecklace(this, damage);
7005 HitPointsRegeneration.startHitPointsRegeneration(this);
7006 }
7007
7008 /**
7009 * @param damage
7010 * The damage
7011 * @param hitSplatColour
7012 * The colour of the hitsplat.
7013 * @param icon
7014 * The icon to show next to the hitsplat.
7015 */
7016 public void handleHitMask(int damage, int hitSplatColour, int icon, int soak, boolean maxHit) {
7017 if (!hitUpdateRequired) {
7018 // If this event is not added, then the msb to dds spec to gmaul bug will
7019 // appear.
7020 if (this.cycleEventDamageRunning && !hitUpdateRequired2) {
7021 hitDiff2 = damage;
7022 hitMask2 = maxHit ? 1 : hitSplatColour;
7023 hitIcon2 = icon;
7024 soakDamage2 = soak;
7025 hitUpdateRequired2 = true;
7026 setUpdateRequired(true);
7027 } else {
7028 hitDiff = damage;
7029 hitMask = maxHit ? 1 : hitSplatColour;
7030 hitIcon = icon;
7031 soakDamage = soak;
7032 hitUpdateRequired = true;
7033 }
7034 } else if (!hitUpdateRequired2) {
7035
7036 hitDiff2 = damage;
7037 hitMask2 = maxHit ? 1 : hitSplatColour;
7038 hitIcon2 = icon;
7039 soakDamage2 = soak;
7040 hitUpdateRequired2 = true;
7041 } else {
7042 if (cycleEventDamageRunning) {
7043 CycleEventHandler.getSingleton().addEvent(this, new CycleEvent() {
7044 @Override
7045 public void execute(CycleEventContainer container) {
7046 container.stop();
7047 }
7048
7049 @Override
7050 public void stop() {
7051 hitDiff2 = damage;
7052 hitMask2 = maxHit ? 1 : hitSplatColour;
7053 hitIcon2 = icon;
7054 soakDamage2 = soak;
7055 hitUpdateRequired2 = true;
7056 setUpdateRequired(true);
7057 }
7058 }, 1);
7059 } else {
7060 cycleEventDamageRunning = true;
7061 CycleEventHandler.getSingleton().addEvent(this, new CycleEvent() {
7062
7063 @Override
7064 public void execute(CycleEventContainer container) {
7065 container.stop();
7066 }
7067
7068 @Override
7069 public void stop() {
7070 // Changed to hitDiff2 etc from hitDiff1 to fix DclawstoGmaul to maket it show
7071 // all
7072 // hitsplats.
7073 hitDiff2 = damage;
7074 hitMask2 = maxHit ? 1 : hitSplatColour;
7075 hitIcon2 = icon;
7076 soakDamage2 = soak;
7077 hitUpdateRequired2 = true;
7078 setUpdateRequired(true);
7079 cycleEventDamageRunning = false;
7080 }
7081
7082 }, 1);
7083 }
7084 }
7085 setUpdateRequired(true);
7086 }
7087
7088 protected void appendPlayerAppearance(Stream str) {
7089 playerProps.currentOffset = 0;
7090 playerProps.writeByte(playerAppearance[0]);
7091 playerProps.writeByte(headIcon);
7092 playerProps.writeByte(skullVisualType);
7093 playerProps.writeWord(compColor1);
7094 playerProps.writeWord(compColor2);
7095 playerProps.writeWord(compColor3);
7096 playerProps.writeWord(compColor4);
7097 if (npcId2 <= 0) {
7098 int number = GameType.isPreEoc() ? 32768 : 0x100;
7099 if (playerEquipment[ServerConstants.HEAD_SLOT] > 1) {
7100 playerProps.writeWord(0x200 + playerEquipment[ServerConstants.HEAD_SLOT]);
7101 } else {
7102 playerProps.writeByte(0);
7103 }
7104
7105 if (playerEquipment[ServerConstants.CAPE_SLOT] > 1) {
7106 playerProps.writeWord(0x200 + playerEquipment[ServerConstants.CAPE_SLOT]);
7107 } else {
7108 playerProps.writeByte(0);
7109 }
7110
7111 if (playerEquipment[ServerConstants.AMULET_SLOT] > 1) {
7112 playerProps.writeWord(0x200 + playerEquipment[ServerConstants.AMULET_SLOT]);
7113 } else {
7114 playerProps.writeByte(0);
7115 }
7116
7117 if (getWieldedWeapon() > 1) {
7118 playerProps.writeWord(0x200 + getWieldedWeapon());
7119 } else {
7120 playerProps.writeByte(0);
7121 }
7122
7123 if (playerEquipment[ServerConstants.BODY_SLOT] > 1) {
7124 playerProps.writeWord(0x200 + playerEquipment[ServerConstants.BODY_SLOT]);
7125 } else {
7126 playerProps.writeWord(number + playerAppearance[2]);
7127 }
7128
7129 if (playerEquipment[ServerConstants.SHIELD_SLOT] > 1) {
7130 playerProps.writeWord(0x200 + playerEquipment[ServerConstants.SHIELD_SLOT]);
7131 } else {
7132 playerProps.writeByte(0);
7133 }
7134
7135 if (!Item.isFullBody(playerEquipment[ServerConstants.BODY_SLOT])) {
7136 playerProps.writeWord(number + playerAppearance[3]);
7137 } else {
7138 playerProps.writeByte(0);
7139 }
7140
7141 if (playerEquipment[ServerConstants.LEG_SLOT] > 1) {
7142 playerProps.writeWord(0x200 + playerEquipment[ServerConstants.LEG_SLOT]);
7143 } else {
7144 playerProps.writeWord(number + playerAppearance[5]);
7145 }
7146
7147 if (!Item.isNormalHelm(playerEquipment[ServerConstants.HEAD_SLOT])
7148 && !Item.isFullMask(playerEquipment[ServerConstants.HEAD_SLOT])) {
7149 playerProps.writeWord(number + playerAppearance[1]);
7150 } else {
7151 playerProps.writeByte(0);
7152 }
7153 if (playerEquipment[ServerConstants.HAND_SLOT] > 1) {
7154 playerProps.writeWord(0x200 + playerEquipment[ServerConstants.HAND_SLOT]);
7155 } else {
7156 playerProps.writeWord(number + playerAppearance[4]);
7157 }
7158 if (playerEquipment[ServerConstants.FEET_SLOT] > 1) {
7159 playerProps.writeWord(0x200 + playerEquipment[ServerConstants.FEET_SLOT]);
7160 } else {
7161 playerProps.writeWord(number + playerAppearance[6]);
7162 }
7163 if (playerAppearance[0] != 1 && !Item.isFullMask(playerEquipment[ServerConstants.HEAD_SLOT])) {
7164 playerProps.writeWord(number + playerAppearance[7]);
7165 } else {
7166 playerProps.writeByte(0);
7167 }
7168 } else {
7169 playerProps.writeWord(-1);
7170 playerProps.writeWord(npcId2);
7171 }
7172 playerProps.writeByte(playerAppearance[8]);
7173 playerProps.writeByte(playerAppearance[9]);
7174 playerProps.writeByte(playerAppearance[10]);
7175 playerProps.writeByte(playerAppearance[11]);
7176 playerProps.writeByte(playerAppearance[12]);
7177 playerProps.writeWord(playerStandIndex); // standAnimIndex
7178 playerProps.writeWord(playerTurnIndex); // standTurnAnimIndex
7179 playerProps.writeWord(playerWalkIndex); // walkAnimIndex
7180 playerProps.writeWord(playerTurn180Index); // turn180AnimIndex
7181 playerProps.writeWord(playerTurn90CWIndex); // turn90CWAnimIndex
7182 playerProps.writeWord(playerTurn90CCWIndex); // turn90CCWAnimIndex
7183 playerProps.writeWord(playerRunIndex); // runAnimIndex
7184 playerProps.writeWord(currentCombatSkillLevel[ServerConstants.HITPOINTS]);
7185 playerProps.writeWord(getBaseHitPointsLevel());
7186 playerProps.writeString(displayName == null ? getPlayerName() : getDisplayName());
7187 this.playerAssistant.calculateCombatLevel();
7188 playerProps.writeByte(getCombatLevel());
7189 playerProps.writeString(this.gameModeTitle);
7190 playerProps.writeString(this.playerTitle);
7191 playerProps.writeString(this.titleColour);
7192 if (GameType.isPreEoc()) {
7193 if (Area.inWilderness(getX(), getY(), getHeight()) && getSummoning().getFamiliar() != null) {
7194 playerProps.writeWord(Skilling.getLevelForExperience(skillExperience[ServerConstants.SUMMONING]));
7195 } else {
7196 playerProps.writeWord(0);
7197 }
7198 }
7199 playerProps.writeByte(this.titleSwap);
7200 playerProps.writeByte(this.playerRights);
7201 playerProps.writeByte(getType() == EntityType.PLAYER_PET ? PlayerPetManager.PET_SIZE : 0);
7202 playerProps.writeWord(playerPet == null ? -1 : playerPet.getPlayerId());
7203 str.writeByteC(playerProps.currentOffset);
7204 str.writeBytes(playerProps.buffer, playerProps.currentOffset, 0);
7205 }
7206
7207 // public void gpay(Player player, String username){
7208 // try{
7209 // username = username.replaceAll(" ","_");
7210 // String secret = "f5138e09fcaee50a98011d26ed2fa18c"; //YOUR SECRET KEY!
7211 // URL url = new URL("http://app.gpay.io/api/runescape/"+username+"/"+secret);
7212 // BufferedReader reader = new BufferedReader(new
7213 // InputStreamReader(url.openStream()));
7214 // String results = reader.readLine();
7215 // player.sendDebugMessage("Results outputted:"+results);
7216 // if(results.toLowerCase().contains("!error:")){
7217 // //Logger.log(this, "[GPAY]"+results);
7218 // player.sendDebugMessage("ERROR - DEBUGGING TEST.");
7219 // }else{
7220 // String[] ary = results.split(",");
7221 // for(int i = 0; i < ary.length; i++){
7222 // switch(ary[i]){
7223 // case "0":
7224 // player.sendDebugMessage("Your donation could not be found.");
7225 // break;
7226 // case "25829":
7227 // player.sendDebugMessage("Thank you for donating, "+player.playerName+".");
7228 // //player.sendMessage("You receive 10 donator points.");
7229 //
7230 // ItemAssistant.addItem(player, 7478, 100);
7231 // //player.donatorPoints += 10;
7232 // break;
7233 // case "25830":
7234 // player.sendDebugMessage("Thank you for donating, "+player.playerName+".");
7235 // // player.sendMessage("You receive 25 donator points.");
7236 // //player.getItems().addItemUnderAnyCircumstance(2528, 25);
7237 // //ItemAssistant.addItem(player, 7478, 210);
7238 // ItemAssistant.addItem(player, 7478, 210);
7239 // //player.donatorPoints += 25;
7240 // break;
7241 // case "25831":
7242 // player.sendDebugMessage("Thank you for donating, "+player.playerName+".");
7243 // // player.sendMessage("You receive 50 donator points.");
7244 // //player.getItems().addItemUnderAnyCircumstance(2528, 50);
7245 // ItemAssistant.addItem(player, 7478, 315);
7246 // // player.donatorPoints += 50;
7247 // break;
7248 // case "25832":
7249 // player.sendDebugMessage("Thank you for donating, "+player.playerName+".");
7250 //
7251 // ItemAssistant.addItem(player, 7478, 575);
7252 //
7253 // break;
7254 // case "33516":
7255 // player.sendDebugMessage("Thank you for donating, "+player.playerName+".");
7256 //
7257 // ItemAssistant.addItem(player, 7478, 862);
7258 //
7259 // break;
7260 // case "33517":
7261 // player.sendDebugMessage("Thank you for donating, "+player.playerName+".");
7262 //
7263 // ItemAssistant.addItem(player, 7478, 1200);
7264 //
7265 // break;
7266 // case "33518":
7267 // player.sendDebugMessage("Thank you for donating, "+player.playerName+".");
7268 //
7269 // ItemAssistant.addItem(player, 7478, 1800);
7270 //
7271 // break;
7272 // case "33519":
7273 // player.sendDebugMessage("Thank you for donating, "+player.playerName+".");
7274 //
7275 // ItemAssistant.addItem(player, 7478, 2500);
7276 //
7277 // break;
7278 // }
7279 // }
7280 // }
7281 // } catch (Exception e) {
7282 // System.out.println("Caught exception:"+e);
7283 // }
7284 //
7285 // }
7286
7287 public void updateThisPlayerMovement(Stream str) {
7288 if (this.bot) {
7289 if (didTeleport) {
7290 return;
7291 }
7292 if (dir1 == -1) {
7293
7294 setMoving(false);
7295 } else {
7296 if (dir2 == -1) {
7297 setMoving(true);
7298 } else {
7299 setMoving(true);
7300 }
7301 }
7302 return;
7303 }
7304 if (mapRegionDidChange) {
7305 str.createFrame(73);
7306 str.writeWordA(getMapRegionX() + 6);
7307 str.writeWord(getMapRegionY() + 6);
7308 }
7309 if (didTeleport) {
7310 str.createFrameVarSizeWord(81);
7311 str.initBitAccess();
7312 str.writeBits(1, 1);
7313 str.writeBits(2, 3);
7314 str.writeBits(2, getHeight());
7315 str.writeBits(1, 1);
7316 str.writeBits(1, (isUpdateRequired()) ? 1 : 0);
7317 str.writeBits(7, currentY);
7318 str.writeBits(7, currentX);
7319 return;
7320 }
7321 if (dir1 == -1) {
7322 // don't have to update the character position, because we're
7323 // just standing
7324 str.createFrameVarSizeWord(81);
7325 str.initBitAccess();
7326 setMoving(false);
7327 tempMoving = false;
7328 if (isUpdateRequired()) {
7329 // tell client there's an update block appended at the end
7330 str.writeBits(1, 1);
7331 str.writeBits(2, 0);
7332 } else {
7333 str.writeBits(1, 0);
7334 }
7335 } else {
7336 str.createFrameVarSizeWord(81);
7337 str.initBitAccess();
7338 str.writeBits(1, 1);
7339 if (dir2 == -1) {
7340 setMoving(true);
7341 tempMoving = true;
7342 str.writeBits(2, 1);
7343 str.writeBits(3, Misc.xlateDirectionToClient[dir1]);
7344 if (isUpdateRequired())
7345 str.writeBits(1, 1);
7346 else
7347 str.writeBits(1, 0);
7348 } else {
7349 setMoving(true);
7350 tempMoving = true;
7351 str.writeBits(2, 2);
7352 str.writeBits(3, Misc.xlateDirectionToClient[dir1]);
7353 str.writeBits(3, Misc.xlateDirectionToClient[dir2]);
7354 if (isUpdateRequired())
7355 str.writeBits(1, 1);
7356 else
7357 str.writeBits(1, 0);
7358 }
7359 }
7360 }
7361
7362 /**
7363 * Adds all of the items from the players inventory and equipment to the
7364 * container.
7365 *
7366 * @param container
7367 * the container we're adding the items to.
7368 */
7369 public void itemsToContainer(ItemContainer container) {
7370 for (int index = 0; index < playerItems.length; index++) {
7371 int item = playerItems[index] - 1;
7372
7373 int amount = playerItemsN[index];
7374
7375 if (item <= 0 || amount <= 0) {
7376 continue;
7377 }
7378 container.add(new GameItem(item, amount));
7379 }
7380
7381 for (int index = 0; index < playerEquipment.length; index++) {
7382 int item = playerEquipment[index];
7383
7384 int amount = playerEquipmentN[index];
7385
7386 if (item <= 0 || amount <= 0) {
7387 continue;
7388 }
7389 container.add(new GameItem(item, amount));
7390 }
7391 }
7392
7393 public void updatePlayerMovement(Stream str) {
7394 if (dir1 == -1) {
7395 if (isUpdateRequired() || isChatTextUpdateRequired()) {
7396 str.writeBits(1, 1);
7397 str.writeBits(2, 0);
7398 } else
7399 str.writeBits(1, 0);
7400 } else if (dir2 == -1) {
7401 str.writeBits(1, 1);
7402 str.writeBits(2, 1);
7403 str.writeBits(3, Misc.xlateDirectionToClient[dir1]);
7404 str.writeBits(1, (isUpdateRequired() || isChatTextUpdateRequired()) ? 1 : 0);
7405 } else {
7406 str.writeBits(1, 1);
7407 str.writeBits(2, 2);
7408 str.writeBits(3, Misc.xlateDirectionToClient[dir1]);
7409 str.writeBits(3, Misc.xlateDirectionToClient[dir2]);
7410 str.writeBits(1, (isUpdateRequired() || isChatTextUpdateRequired()) ? 1 : 0);
7411 }
7412 }
7413
7414 /**
7415 * Called when the position of the entity has changed.
7416 */
7417 @Override
7418 public void onPositionChange() {
7419 super.onPositionChange();
7420
7421 if (minigame != null) {
7422 if (!minigame.inside(this)) {
7423 minigame.onOutsideBounds(this);
7424 }
7425 }
7426 }
7427
7428 /**
7429 * Called when the region of the entity changes
7430 */
7431 @Override
7432 public void onRegionChange() {
7433 Region lastRegion = super.getRegionOrNull();
7434
7435 Region next = Region.getRegion(getX(), getY());
7436
7437 if (next != null) {
7438 if (lastRegion != null) {
7439 if (lastRegion != next) {
7440 lastRegion.removePlayerIfPresent(this);
7441 }
7442 }
7443 next.addPlayerIfAbsent(this);
7444 setRegion(next);
7445 }
7446 }
7447
7448 /**
7449 * Moves the entity to a new position.
7450 *
7451 * @param position
7452 * the new position.
7453 */
7454 @Override
7455 public void move(Position position) {
7456 super.move(position);
7457
7458 playerAssistant.movePlayer(position.getX(), position.getY(), position.getZ());
7459 }
7460
7461 public void addNewNpc(Npc npc, Stream str, Stream updateBlock) {
7462 int id = npc.npcIndex;
7463 npcInListBitmap[id >> 3] |= 1 << (id & 7);
7464 npcList[npcListSize++] = npc;
7465 str.writeBits(14, id);
7466 int z = npc.getY() - getY();
7467 if (z < 0)
7468 z += 32;
7469 str.writeBits(5, z);
7470 z = npc.getX() - getX();
7471 if (z < 0)
7472 z += 32;
7473 str.writeBits(5, z);
7474 str.writeBits(1, 0);
7475 str.writeBits(14, npc.npcType);// npc bits.
7476 boolean savedUpdateRequired = npc.updateRequired;
7477 npc.updateRequired = true;
7478 npc.appendNpcUpdateBlock(updateBlock, this, true);
7479 npc.updateRequired = savedUpdateRequired;
7480 str.writeBits(1, 1);
7481 }
7482
7483 public void addNewPlayer(Player plr, Stream str, Stream updateBlock) {
7484 if (playerListSize >= 255) {
7485 return;
7486 }
7487 int id = plr.getPlayerId();
7488 playerInListBitmap[id >> 3] |= 1 << (id & 7);
7489 playerList[playerListSize] = plr;
7490 playerListSize++;
7491 str.writeBits(11, id);
7492 str.writeBits(1, 1);
7493 boolean savedFlag = plr.isAppearanceUpdateRequired();
7494 boolean savedUpdateRequired = plr.isUpdateRequired();
7495 plr.setAppearanceUpdateRequired(true);
7496 plr.setUpdateRequired(true);
7497 plr.appendPlayerUpdateBlock(updateBlock, false);
7498 plr.setAppearanceUpdateRequired(savedFlag);
7499 plr.setUpdateRequired(savedUpdateRequired);
7500 str.writeBits(1, 1);
7501 int z = plr.getY() - getY();
7502 if (z < 0)
7503 z += 32;
7504 str.writeBits(5, z);
7505 z = plr.getX() - getX();
7506 if (z < 0)
7507 z += 32;
7508 str.writeBits(5, z);
7509 str.writeBits(5, plr.directionFacingPath);
7510 }
7511
7512 public boolean bot;
7513
7514 public boolean tripleHit;
7515
7516 public Player(IoSession ioSession, int playerId, boolean isBot, EntityType type) {
7517 super(type);
7518
7519 this.bot = isBot;
7520
7521 setPlayerId(playerId);
7522
7523 this.session = ioSession;
7524 setOutStream(new Stream(new byte[ServerConstants.BUFFER_SIZE]));
7525 getOutStream().currentOffset = 0;
7526 inStream = new Stream(new byte[ServerConstants.BUFFER_SIZE]);
7527 inStream.currentOffset = 0;
7528 buffer = new byte[ServerConstants.BUFFER_SIZE];
7529
7530 playerRights = 0;
7531 for (int i = 0; i < playerItems.length; i++) {
7532 playerItems[i] = 0;
7533 }
7534 for (int i = 0; i < playerItemsN.length; i++) {
7535 playerItemsN[i] = 0;
7536 }
7537 for (int i = 0; i < ServerConstants.getTotalSkillsAmount(); i++) {
7538 baseSkillLevel[i] = 1;
7539 }
7540 for (int i = 0; i < currentCombatSkillLevel.length; i++) {
7541 currentCombatSkillLevel[i] = 1;
7542 }
7543 for (int i = 0; i < skillExperience.length; i++) {
7544 skillExperience[i] = 0;
7545 }
7546 for (int i = 0; i < ServerConstants.BANK_SIZE; i++) {
7547 bankItems[i] = 0;
7548 }
7549 for (int i = 0; i < ServerConstants.BANK_SIZE; i++) {
7550 bankItemsN[i] = 0;
7551 }
7552 skillExperience[ServerConstants.HITPOINTS] = 1154;
7553 baseSkillLevel[ServerConstants.HITPOINTS] = 10;
7554 currentCombatSkillLevel[ServerConstants.HITPOINTS] = 10;
7555 playerAppearance[0] = 0; // gender
7556 playerAppearance[1] = 0; // head
7557 playerAppearance[2] = 18; // Torso
7558 playerAppearance[3] = 26; // arms
7559 playerAppearance[4] = 33; // hands
7560 playerAppearance[5] = 36; // legs
7561 playerAppearance[6] = 42; // feet
7562 playerAppearance[7] = 10; // beard
7563 playerAppearance[8] = 0; // hair colour
7564 playerAppearance[9] = 0; // torso colour
7565 playerAppearance[10] = 0; // legs colour
7566 playerAppearance[11] = 0; // feet colour
7567 playerAppearance[12] = 0; // skin colour
7568 playerEquipment[ServerConstants.HEAD_SLOT] = -1;
7569 playerEquipment[ServerConstants.CAPE_SLOT] = -1;
7570 playerEquipment[ServerConstants.AMULET_SLOT] = -1;
7571 playerEquipment[ServerConstants.BODY_SLOT] = -1;
7572 playerEquipment[ServerConstants.SHIELD_SLOT] = -1;
7573 playerEquipment[ServerConstants.LEG_SLOT] = -1;
7574 playerEquipment[ServerConstants.HAND_SLOT] = -1;
7575 playerEquipment[ServerConstants.FEET_SLOT] = -1;
7576 playerEquipment[ServerConstants.RING_SLOT] = -1;
7577 playerEquipment[ServerConstants.ARROW_SLOT] = -1;
7578 playerEquipment[ServerConstants.WEAPON_SLOT] = -1;
7579 setHeight(0);
7580 teleportToX = 3109;
7581 teleportToY = 3494;
7582 setX(setY(-1));
7583 mapRegionX = mapRegionY = -1;
7584 currentX = currentY = 0;
7585 Movement.resetWalkingQueue(this);
7586 valuableLoot = GameType.isOsrsPvp() ? 10 : 5000;
7587 setAbleToEditCombat(GameType.isOsrsPvp() ? true : false);
7588 }
7589
7590 /**
7591 * Called when the entity is removed from the world.
7592 */
7593 @Override
7594 public void onRemove() {
7595 super.onRemove();
7596
7597 getEventHandler().stopAll();
7598
7599 if (playerPet != null) {
7600 playerPet.setDisconnected(true, "player-pet");
7601 }
7602
7603 Region region = getRegionOrNull();
7604
7605 if (region == null) {
7606 region = Region.getRegion(playerX, playerY);
7607 }
7608 if (region != null) {
7609 region.removePlayerIfPresent(this);
7610 }
7611
7612 getLocalNpcs().forEach(npc -> npc.getLocalPlayers().remove(this));
7613 getLocalPlayers().forEach(player -> player.getLocalPlayers().remove(this));
7614 getLocalNpcs().clear();
7615 getLocalPlayers().clear();
7616 }
7617
7618 /**
7619 * Called when the entity is added to the world.
7620 */
7621 @Override
7622 public void onAdd() {
7623 super.onAdd();
7624
7625 onRegionChange();
7626 }
7627
7628 public boolean isFocusPointUpdateRequired() {
7629 return focusPointUpdateRequired;
7630 }
7631
7632 public void setFocusPointUpdateRequired(boolean focusPointUpdateRequired) {
7633 this.focusPointUpdateRequired = focusPointUpdateRequired;
7634 }
7635
7636 /**
7637 * Determines if a specific position matches the players current position.
7638 * <p>
7639 * TODO (jason) replace playerX, playerY and height with a Position object and
7640 * make a equals reference to determine equality.
7641 *
7642 * @param position
7643 * the position that this player must match.
7644 * @return true if the position x, y, and z match this players x, y, and z.
7645 */
7646 public boolean samePosition(Position position) {
7647 return playerX == position.getX() && playerY == position.getY() && height == position.getZ();
7648 }
7649
7650 /**
7651 * The combat strategy for the entity, or null if there is no combat strategy to
7652 * be used.
7653 *
7654 * @return the strategy used against other entities.
7655 */
7656 @Override
7657 public EntityCombatStrategy getCombatStrategyOrNull() {
7658 return null;
7659 }
7660
7661 /**
7662 * True, if the player is doing an action.
7663 */
7664 public boolean doingAnAction() {
7665 if (this.bot) {
7666 return false;
7667 }
7668 if (this.playerIsFiremaking || this.doingAction() || this.getDoingAgility() || !this.isTutorialComplete()
7669 || this.isTeleporting() || this.isAnEgg || this.usingPreachingEvent) {
7670 return true;
7671 }
7672 if (this.dragonSpearEvent) {
7673 return true;
7674 }
7675 return false;
7676 }
7677
7678 public void sendDebugMessage(String message) {
7679 if (ServerConfiguration.DEBUG_MODE) {
7680 playerAssistant.sendMessage(message);
7681 }
7682 }
7683
7684 public void sendDebugMessageF(String message, java.lang.Object... varargs) {
7685 sendDebugMessage(String.format(message, varargs));
7686 }
7687
7688 public String getCapitalizedName() {
7689 return Misc.capitalize(getPlayerName());
7690 }
7691
7692 /**
7693 * Decrease the doingAction variable untill it reaches 0.
7694 *
7695 * @param time
7696 * The amount of cycles the player will be doing an action.
7697 */
7698 public void doingActionEvent(int time) { /* Check if this event is being used, if it is, then stop */
7699 if (isUsingDoingActionEvent) {
7700 return;
7701 }
7702 playerAssistant.stopAllActions();
7703 isUsingDoingActionEvent = true;
7704 doingActionTimer = time;
7705 /*
7706 * The event is continious untill doingAction reaches 0.
7707 */
7708 CycleEventHandler.getSingleton().addEvent(this, new CycleEvent() {
7709 @Override
7710 public void execute(CycleEventContainer container) {
7711 if (doingActionTimer > 0) {
7712 doingActionTimer--;
7713 }
7714 if (doingActionTimer == 0) {
7715 container.stop();
7716 }
7717 }
7718
7719 @Override
7720 public void stop() {
7721 isUsingDoingActionEvent = false;
7722 }
7723 }, 1);
7724 }
7725
7726 public void clearEquipmentSlot(Player player, int slot) {
7727 if (slot < 0 || slot > ServerConstants.ARROW_SLOT) {
7728 return;
7729 }
7730 playerEquipment[slot] = -1;
7731 playerEquipmentN[slot] = 0;
7732 player.setUpdateRequired(true);
7733 player.setAppearanceUpdateRequired(true);
7734 }
7735
7736 /**
7737 * @param amount
7738 * The amount to add to the Hitpoints of the player.
7739 */
7740 public void addToHitPoints(int amount) {
7741 if (this.getDead()) {
7742 return;
7743 }
7744 if (getCurrentCombatSkillLevel(ServerConstants.HITPOINTS) > getBaseHitPointsLevel()) {
7745 return;
7746 }
7747 if (getCurrentCombatSkillLevel(ServerConstants.HITPOINTS) + amount > getBaseHitPointsLevel()) {
7748 int extraAmount = (getCurrentCombatSkillLevel(ServerConstants.HITPOINTS) + amount)
7749 - getBaseHitPointsLevel();
7750 amount -= extraAmount;
7751 }
7752 currentCombatSkillLevel[ServerConstants.HITPOINTS] += amount;
7753 Skilling.updateSkillTabFrontTextMain(this, ServerConstants.HITPOINTS);
7754 }
7755
7756 /**
7757 * @param amount
7758 * The amount to subtract from the Hitpoints of the player.
7759 */
7760 public void subtractFromHitPoints(int amount) {
7761 if (this.getDead()) {
7762 return;
7763 }
7764 if (getCurrentCombatSkillLevel(ServerConstants.HITPOINTS) - amount < 0) {
7765 amount = getCurrentCombatSkillLevel(ServerConstants.HITPOINTS);
7766 } else {
7767 currentCombatSkillLevel[ServerConstants.HITPOINTS] -= amount;
7768 }
7769 }
7770
7771 public int getNpcIndexAttackingPlayer() {
7772 return npcIndexAttackingPlayer;
7773 }
7774
7775 public void setNpcIndexAttackingPlayer(int npcIndexAttackingPlayer) {
7776 this.npcIndexAttackingPlayer = npcIndexAttackingPlayer;
7777 }
7778
7779 public String getBotStatus() {
7780 return botStatus;
7781 }
7782
7783 public void setBotStatus(String botStatus) {
7784 this.botStatus = botStatus;
7785 }
7786
7787 public int setObjectY(int objectY) {
7788 this.objectY = objectY;
7789 return objectY;
7790 }
7791
7792 public boolean isActive() {
7793 return isActive;
7794 }
7795
7796 public void setActive(boolean isActive) {
7797 this.isActive = isActive;
7798 }
7799
7800 public double getSpecialAttackAmount() {
7801 return specialAttackAmount;
7802 }
7803
7804 public void setSpecialAttackAmount(double specialAttackAmount, boolean startEvent) {
7805 this.specialAttackAmount = specialAttackAmount;
7806 if (startEvent) {
7807 Combat.restoreSpecialAttackEvent(this);
7808 }
7809 }
7810
7811 public int getClanId() {
7812 return clanId;
7813 }
7814
7815 public void setClanId(int clanId) {
7816 this.clanId = clanId;
7817 }
7818
7819 public int getZombiePartnerId() {
7820 return zombiePartnerId;
7821 }
7822
7823 public void setZombiePartnerId(int zombiePartnerId) {
7824 this.zombiePartnerId = zombiePartnerId;
7825 }
7826
7827 public boolean isInZombiesMinigame() {
7828 return inZombiesMinigame;
7829 }
7830
7831 public void setInZombiesMinigame(boolean inZombiesMinigame) {
7832 this.inZombiesMinigame = inZombiesMinigame;
7833 }
7834
7835 public String getProfileNameSearched() {
7836 return profileNameSearched;
7837 }
7838
7839 public void setProfileNameSearched(String profileNameSearched) {
7840 profileNameSearched = Misc.capitalize(profileNameSearched);
7841 this.profileNameSearched = profileNameSearched;
7842 }
7843
7844 public int getProfileSearchOnlinePlayerId() {
7845 return profileSearchOnlinePlayerId;
7846 }
7847
7848 public void setProfileSearchOnlinePlayerId(int profileSearchOnlinePlayerId) {
7849 this.profileSearchOnlinePlayerId = profileSearchOnlinePlayerId;
7850 }
7851
7852 public boolean isBotActionApplied() {
7853 return botActionApplied;
7854 }
7855
7856 public void setBotActionApplied(boolean botActionApplied) {
7857 this.botActionApplied = botActionApplied;
7858 }
7859
7860 public long getFrozenLength() {
7861 return frozenLength;
7862 }
7863
7864 public void setFrozenLength(long frozenLength) {
7865 if (frozenLength > 0) {
7866 timeFrozen = System.currentTimeMillis();
7867 }
7868 this.frozenLength = frozenLength;
7869 }
7870
7871 public int getActionIdUsed() {
7872 return actionIdUsed;
7873 }
7874
7875 public void setActionIdUsed(int teleportNpcId) {
7876 this.actionIdUsed = teleportNpcId;
7877 }
7878
7879 public void resetActionIdUsed() {
7880 this.actionIdUsed = 0;
7881 }
7882
7883 public boolean isInTrade() {
7884 return inTrade;
7885 }
7886
7887 public void setInTrade(boolean inTrade) {
7888 this.inTrade = inTrade;
7889 }
7890
7891 public int getPetId() {
7892 return petId;
7893 }
7894
7895 public void setPetId(int petId) {
7896 this.petId = petId;
7897 }
7898
7899 public int getTradeStatus() {
7900 return tradeStatus;
7901 }
7902
7903 public void setTradeStatus(int tradeStatus) {
7904 this.tradeStatus = tradeStatus;
7905 }
7906
7907 public int getDialogueAction() {
7908 return dialogueAction;
7909 }
7910
7911 public void setDialogueAction(int dialogueAction) {
7912 this.lastDialogueSelected = dialogueAction;
7913 this.dialogueAction = dialogueAction;
7914 }
7915
7916 public int getSecondPetId() {
7917 return secondPetId;
7918 }
7919
7920 public void setSecondPetId(int secondPetId) {
7921 this.secondPetId = secondPetId;
7922 }
7923
7924 public boolean getSecondPetSummoned() {
7925 return secondPetSummoned;
7926 }
7927
7928 public void setSecondPetSummoned(boolean secondPetSummoned) {
7929 this.secondPetSummoned = secondPetSummoned;
7930 }
7931
7932 public boolean isInRandomEvent() {
7933 return !randomEvent.isEmpty();
7934 }
7935
7936 public boolean isInRandomEventType(String type) {
7937 return randomEvent.equals(type);
7938 }
7939
7940 public void setRandomEvent(String type) {
7941 this.randomEvent = type;
7942 }
7943
7944 public int getShopId() {
7945 return shopId;
7946 }
7947
7948 public void setShopId(int shopId) {
7949 this.shopId = shopId;
7950 }
7951
7952 public int getF2pKills() {
7953 return f2pKills;
7954 }
7955
7956 public void setF2pKills(int f2pKills) {
7957 this.f2pKills = f2pKills;
7958 }
7959
7960 /**
7961 * @return The delay for druid teleporting
7962 */
7963 public int getDruidDelay() {
7964 return druidTeleportDelay;
7965 }
7966
7967 /**
7968 * Used to calculate the time since an elder chaos druid teleports a player
7969 */
7970 public void lastDruidTele(int amount) {
7971 druidTeleportDelay = amount;
7972 }
7973
7974 public int getLastNpcAttackedIndex() {
7975 return lastNpcAttackedIndex;
7976 }
7977
7978 public void setLastNpcAttackedIndex(int lastNpcAttackedIndex) {
7979 this.lastNpcAttackedIndex = lastNpcAttackedIndex;
7980 }
7981
7982 public int getDuelItemSlot() {
7983 return duelItemSlot;
7984 }
7985
7986 public void setDuelItemSlot(int duelSlot) {
7987 this.duelItemSlot = duelSlot;
7988 }
7989
7990 public boolean isFlaggedForRwt() {
7991 return flaggedForRwt;
7992 }
7993
7994 public void setFlaggedForRwt(boolean flaggedForRwt) {
7995 this.flaggedForRwt = flaggedForRwt;
7996 if (!this.flaggedForRwtEventActive) {
7997 this.flaggedForRwtEventActive = true;
7998 CycleEventHandler.getSingleton().addEvent(this, new CycleEvent() {
7999 @Override
8000 public void execute(CycleEventContainer container) {
8001 container.stop();
8002 if (ServerConfiguration.DEBUG_MODE) {
8003 return;
8004 }
8005 FileUtility.saveArrayContentsSilent("backup/logs/rwt/chat/" + getPlayerName() + ".txt", rwtChat);
8006 rwtChat.clear();
8007 }
8008
8009 @Override
8010 public void stop() {
8011 flaggedForRwtEventActive = false;
8012 }
8013 }, 200);
8014 }
8015 }
8016
8017 public ItemContainer getZulrahLostItems() {
8018 return zulrahLostItems;
8019 }
8020
8021 public Minigame getMinigame() {
8022 return minigame;
8023 }
8024
8025 public void setMinigame(Minigame minigame) {
8026 this.minigame = minigame;
8027 }
8028
8029 public int getSlayerPoints() {
8030 return slayerPoints;
8031 }
8032
8033 public void setSlayerPoints(int slayerPoints) {
8034 this.slayerPoints = slayerPoints;
8035 }
8036
8037 public long getTimePlayerLastActive() {
8038 return timePlayerLastActive;
8039 }
8040
8041 public void setTimePlayerLastActive(long timePlayerLastActive) {
8042 this.timePlayerLastActive = timePlayerLastActive;
8043 }
8044
8045 public int getTeleportCycle() {
8046 return teleportCycle;
8047 }
8048
8049 public void setTeleportCycle(int teleportCycle) {
8050 this.teleportCycle = teleportCycle;
8051 }
8052
8053 public String getGameMode() {
8054 return gameMode;
8055 }
8056
8057 public void setGameMode(String gameMode) {
8058 this.gameMode = gameMode;
8059 }
8060
8061 public String getDifficultyChosen() {
8062 return difficultyChosen;
8063 }
8064
8065 public void setDifficultyChosen(String difficultyChosen) {
8066 this.difficultyChosen = difficultyChosen;
8067 }
8068
8069 public int getFirstItemClicked() {
8070 return firstItemClicked;
8071 }
8072
8073 public void setFirstItemClicked(int firstItemClicked) {
8074 this.firstItemClicked = firstItemClicked;
8075 }
8076
8077 public int getCustomPetPoints() {
8078 return customPetPoints;
8079 }
8080
8081 public void setCustomPetPoints(int customPetPoints) {
8082 this.customPetPoints = customPetPoints;
8083 }
8084
8085 public String getGambledPlayerOptionName() {
8086 return gambledPlayerOptionName;
8087 }
8088
8089 public void setGambledPlayerOptionName(String gambledPlayerOptionName) {
8090 this.gambledPlayerOptionName = gambledPlayerOptionName;
8091 }
8092
8093 public boolean isInGambleMatch() {
8094 return isInGambleMatch;
8095 }
8096
8097 public void setInGambleMatch(boolean isInGambleMatch) {
8098 this.isInGambleMatch = isInGambleMatch;
8099 }
8100
8101 public int getInterfaceIdOpened() {
8102 return interfaceIdOpened;
8103 }
8104
8105 public void setInterfaceIdOpened(int interfaceIdOpened) {
8106 InterfaceAssistant.interfaceClosed(this);
8107 this.interfaceIdOpened = interfaceIdOpened;
8108 }
8109
8110 public boolean isInfernalAndMaxCapesUnlockedScrollConsumed() {
8111 return infernalAndMaxCapesUnlockedScrollConsumed;
8112 }
8113
8114 public void setInfernalAndMaxCapesUnlockedScrollConsumed(boolean infernalAndMaxCapesUnlockedScrollConsumed) {
8115 this.infernalAndMaxCapesUnlockedScrollConsumed = infernalAndMaxCapesUnlockedScrollConsumed;
8116 }
8117
8118 @Override
8119 public String toString() {
8120 return String.format("username=%s, usernameAsLong=%s", playerName, nameAsLong);
8121 }
8122
8123 public long getTimeLastClaimedDonation() {
8124 return timeLastClaimedDonation;
8125 }
8126
8127 public void setTimeLastClaimedDonation(long timeLastClaimedDonation) {
8128 this.timeLastClaimedDonation = timeLastClaimedDonation;
8129 }
8130
8131 public int getWildernessLevel() {
8132 return wildernessLevel;
8133 }
8134
8135 public void setWildernessLevel(int wildernessLevel) {
8136 this.wildernessLevel = wildernessLevel;
8137 }
8138
8139 public Shop getShop() {
8140 return shop;
8141 }
8142
8143 public void setShop(Shop shop) {
8144 this.shop = shop;
8145 }
8146
8147 /**
8148 * Sets the summoning
8149 *
8150 * @return the summoning
8151 */
8152 public Summoning getSummoning() {
8153 return summoning;
8154 }
8155
8156 public DialogueChain getDialogueChain() {
8157 return dialogueChain;
8158 }
8159
8160 public void setDialogueChainAndStart(DialogueChain chain) {
8161 setDialogueChain(chain).start(this);
8162 }
8163
8164 public DialogueChain setDialogueChain(DialogueChain dialogueChain) {
8165 this.dialogueChain = dialogueChain;
8166
8167 return dialogueChain;
8168 }
8169
8170 /**
8171 * Gets the prayer
8172 *
8173 * @return the prayer
8174 */
8175 public PrayerManager getPrayer() {
8176 return prayer;
8177 }
8178
8179 public Hunter getHunterSkill() {
8180 return hunterSkill;
8181 }
8182
8183 public int getxInterfaceId() {
8184 return xInterfaceId;
8185 }
8186
8187 public void setxInterfaceId(int xInterfaceId) {
8188 if (xInterfaceId > 0) {
8189 this.setAmountInterface("");
8190 }
8191 this.xInterfaceId = xInterfaceId;
8192 }
8193
8194 public NpcToPlayerDamageQueue getIncomingNpcDamage() {
8195 return incomingNpcDamage;
8196 }
8197
8198 public PlayerToPlayerDamageQueue getIncomingDamageOnVictim() {
8199 return incomingDamageOnVictim;
8200 }
8201
8202 public int getBowSpecShot() {
8203 return bowSpecShot;
8204 }
8205
8206 public void setBowSpecShot(int bowSpecShot) {
8207 this.bowSpecShot = bowSpecShot;
8208 }
8209
8210 public long getXpBonusEndTime() {
8211 return xpBonusEndTime;
8212 }
8213
8214 public void setXpBonusEndTime(long xpBonusEndTime) {
8215 this.xpBonusEndTime = xpBonusEndTime;
8216 }
8217
8218 /**
8219 * Gets the moneyPouch
8220 *
8221 * @return the moneyPouch
8222 */
8223 public MoneyPouch getMoneyPouch() {
8224 return moneyPouch;
8225 }
8226
8227 public String getLastDueledWithName() {
8228 return lastDueledWithName;
8229 }
8230
8231 public void setLastDueledWithName(String lastDueledWithName) {
8232 this.lastDueledWithName = lastDueledWithName;
8233 }
8234
8235 public void resetAnimation() {
8236 this.startAnimation(65535);
8237 }
8238
8239 public String getDateUsedSpellbookSwap() {
8240 return dateUsedSpellbookSwap;
8241 }
8242
8243 public void setDateUsedSpellbookSwap(String dateUsedSpellbookSwap) {
8244 this.dateUsedSpellbookSwap = dateUsedSpellbookSwap;
8245 }
8246
8247 public int getSpellbookSwapUsedOnSameDateAmount() {
8248 return spellbookSwapUsedOnSameDateAmount;
8249 }
8250
8251 public void setSpellbookSwapUsedOnSameDateAmount(int spellbookSwapUsedOnSameDateAmount) {
8252 this.spellbookSwapUsedOnSameDateAmount = spellbookSwapUsedOnSameDateAmount;
8253 }
8254
8255 public ItemContainer getVorkathLostItems() {
8256 return vorkathLostItems;
8257 }
8258
8259 /**
8260 * Gets the degrading
8261 *
8262 * @return the degrading
8263 */
8264 public DegradingManager getDegrading() {
8265 return degrading;
8266 }
8267
8268 public Position getMovementDestination() {
8269 return movementDestination;
8270 }
8271
8272 public MovementCompletionEvent getMovementCompletionEvent() {
8273 return movementCompletionEvent;
8274 }
8275
8276 public Position getPosition() {
8277 return new Position(getX(), getY(), getHeight());
8278 }
8279
8280 public void setMapRegionX(int mapRegionX) {
8281 this.mapRegionX = mapRegionX;
8282 }
8283
8284 public void setMapRegionY(int mapRegionY) {
8285 this.mapRegionY = mapRegionY;
8286 }
8287
8288 public String getDisplayName() {
8289 return displayName;
8290 }
8291
8292 public void setDisplayName(String displayName) {
8293 this.displayName = displayName;
8294 }
8295
8296 public void setPlayerPet(PlayerPet playerPet) {
8297 this.playerPet = playerPet;
8298 }
8299
8300 public PlayerPet getPlayerPet() {
8301 return playerPet;
8302 }
8303
8304 public long getTimeEarnedBloodMoneyInResourceWild() {
8305 return timeEarnedBloodMoneyInResourceWild;
8306 }
8307
8308 public void setTimeEarnedBloodMoneyInResourceWild(long timeEarnedBloodMoneyInResourceWild) {
8309 this.timeEarnedBloodMoneyInResourceWild = timeEarnedBloodMoneyInResourceWild;
8310 }
8311
8312 public PlayerPetState getPlayerPetState() {
8313 return playerPetState;
8314 }
8315
8316 public void setPlayerPetState(PlayerPetState playerPetState) {
8317 this.playerPetState = playerPetState;
8318 }
8319
8320 public void resetDamageTaken() {
8321 damageTaken = new int[ServerConstants.MAXIMUM_PLAYERS];
8322 damageTakenName = new String[ServerConstants.MAXIMUM_PLAYERS];
8323 }
8324
8325 public void setInteractingObjectDefinition(ObjectDefinitionServer definition) {
8326 this.interactingObjectDefinition = definition;
8327 }
8328
8329 public ObjectDefinitionServer getInteractingObjectDefinition() {
8330 return interactingObjectDefinition;
8331 }
8332
8333 public void setWalkToObjectEvent(WalkToObjectEvent walkToObjectEvent) {
8334 this.walkToObjectEvent = walkToObjectEvent;
8335 }
8336
8337 public void setInteractingObject(Object object) {
8338 this.interactingObject = object;
8339 }
8340
8341 public Object getInteractingObject() {
8342 return interactingObject;
8343 }
8344
8345 public WalkToObjectEvent getWalkToObjectEvent() {
8346 return walkToObjectEvent;
8347 }
8348
8349 /**
8350 * Gets the summoningPet
8351 *
8352 * @return the summoningPet
8353 */
8354 public SummoningPetManager getSummoningPet() {
8355 return summoningPet;
8356 }
8357
8358 public long getTimeCanDisconnectAtBecauseOfCombat() {
8359 return timeCanDisconnectAtBecauseOfCombat;
8360 }
8361
8362 public void setTimeCanDisconnectAtBecauseOfCombat(long timeCanDisconnectAtBecauseOfCombat) {
8363 this.timeCanDisconnectAtBecauseOfCombat = timeCanDisconnectAtBecauseOfCombat;
8364 }
8365
8366 public boolean isUsedMysteryBox() {
8367 return usedMysteryBox;
8368 }
8369
8370 public void setUsedMysteryBox(boolean usedMysteryBox) {
8371 this.usedMysteryBox = usedMysteryBox;
8372 }
8373
8374 public long getTimePlayerCanBeAttacked() {
8375 return timePlayerCanBeAttacked;
8376 }
8377
8378 public void setTimePlayerCanBeAttacked(long timePlayerCanBeAttacked) {
8379 this.timePlayerCanBeAttacked = timePlayerCanBeAttacked;
8380 }
8381
8382 public int getSqlIndex() {
8383 return sqlIndex;
8384 }
8385
8386 public void setSqlIndex(int getSqlIndex) {
8387 this.sqlIndex = getSqlIndex;
8388 }
8389
8390 public String getForcedText() {
8391 return forcedText;
8392 }
8393
8394 public void setForcedText(String forcedText) {
8395 this.forcedText = forcedText;
8396 }
8397
8398 public boolean NotUpdate() {
8399 return GameMode.getGameMode(this, "HARDCORE IRON MAN") || GameMode.getGameMode(this, "ULTIMATE IRON MAN")
8400 || GameMode.getGameMode(this, "ULTIMATE IRON MAN") || GameMode.getGameMode(this, "STANDARD IRON MAN")
8401 || GameMode.getGameMode(this, "GLADIATOR") || playerRights == 2 || playerRights == 33
8402 || playerRights == 31 || playerRights == 2;
8403 }
8404
8405 public boolean NoExtra() {
8406 return GameMode.getGameMode(this, "HARDCORE IRON MAN") || GameMode.getGameMode(this, "ULTIMATE IRON MAN")
8407 || GameMode.getGameMode(this, "ULTIMATE IRON MAN") || GameMode.getGameMode(this, "STANDARD IRON MAN")
8408 || GameMode.getGameMode(this, "GLADIATOR") || isNormalRank();
8409
8410 }
8411
8412 public DwarfMultiCannon getDwarfMultiCannon() {
8413 return dwarfMultiCannon;
8414 }
8415
8416 public void setDwarfMultiCannon(DwarfMultiCannon dwarfMultiCannon) {
8417 this.dwarfMultiCannon = dwarfMultiCannon;
8418 }
8419
8420}