-
Notifications
You must be signed in to change notification settings - Fork 181
/
Player.java
3282 lines (2799 loc) · 84.2 KB
/
Player.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/**
* This file is part of Aion-Lightning <aion-lightning.org>.
*
* Aion-Lightning is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Aion-Lightning is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License
* along with Aion-Lightning.
* If not, see <http://www.gnu.org/licenses/>.
*/
package com.aionemu.gameserver.model.gameobjects.player;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ScheduledFuture;
import com.aionemu.commons.database.dao.DAOManager;
import com.aionemu.gameserver.configs.administration.AdminConfig;
import com.aionemu.gameserver.configs.main.MembershipConfig;
import com.aionemu.gameserver.configs.main.SecurityConfig;
import com.aionemu.gameserver.controllers.FlyController;
import com.aionemu.gameserver.controllers.PlayerController;
import com.aionemu.gameserver.controllers.attack.AggroList;
import com.aionemu.gameserver.controllers.attack.AttackStatus;
import com.aionemu.gameserver.controllers.attack.PlayerAggroList;
import com.aionemu.gameserver.controllers.effect.PlayerEffectController;
import com.aionemu.gameserver.controllers.movement.PlayerMoveController;
import com.aionemu.gameserver.controllers.observer.ActionObserver;
import com.aionemu.gameserver.dao.PlayerDAO;
import com.aionemu.gameserver.dao.PlayerVarsDAO;
import com.aionemu.gameserver.dao.PlayerWorldBanDAO;
import com.aionemu.gameserver.dataholders.DataManager;
import com.aionemu.gameserver.model.Gender;
import com.aionemu.gameserver.model.PlayerClass;
import com.aionemu.gameserver.model.Race;
import com.aionemu.gameserver.model.TribeClass;
import com.aionemu.gameserver.model.account.Account;
import com.aionemu.gameserver.model.account.AccountTransfo;
import com.aionemu.gameserver.model.account.AccountTransformList;
import com.aionemu.gameserver.model.account.TransformCollection;
import com.aionemu.gameserver.model.actions.PlayerActions;
import com.aionemu.gameserver.model.actions.PlayerMode;
import com.aionemu.gameserver.model.cubics.PlayerMCList;
import com.aionemu.gameserver.model.dorinerk_wardrobe.PlayerWardrobeList;
import com.aionemu.gameserver.model.event_window.PlayerEventWindowList;
import com.aionemu.gameserver.model.gameobjects.Creature;
import com.aionemu.gameserver.model.gameobjects.CreatureType;
import com.aionemu.gameserver.model.gameobjects.Item;
import com.aionemu.gameserver.model.gameobjects.Kisk;
import com.aionemu.gameserver.model.gameobjects.Minion;
import com.aionemu.gameserver.model.gameobjects.Npc;
import com.aionemu.gameserver.model.gameobjects.PersistentState;
import com.aionemu.gameserver.model.gameobjects.Pet;
import com.aionemu.gameserver.model.gameobjects.Summon;
import com.aionemu.gameserver.model.gameobjects.SummonedObject;
import com.aionemu.gameserver.model.gameobjects.Trap;
import com.aionemu.gameserver.model.gameobjects.player.AbyssRank.AbyssRankUpdateType;
import com.aionemu.gameserver.model.gameobjects.player.FriendList.Status;
import com.aionemu.gameserver.model.gameobjects.player.achievement.PlayerAchievement;
import com.aionemu.gameserver.model.gameobjects.player.collection.PlayerCollection;
import com.aionemu.gameserver.model.gameobjects.player.emotion.EmotionList;
import com.aionemu.gameserver.model.gameobjects.player.equipmentsetting.EquipmentSettingList;
import com.aionemu.gameserver.model.gameobjects.player.f2p.F2p;
import com.aionemu.gameserver.model.gameobjects.player.fame.PlayerFame;
import com.aionemu.gameserver.model.gameobjects.player.motion.MotionList;
import com.aionemu.gameserver.model.gameobjects.player.npcFaction.NpcFactions;
import com.aionemu.gameserver.model.gameobjects.player.ranking.ArenaOfCooperationRank;
import com.aionemu.gameserver.model.gameobjects.player.ranking.ArenaOfDisciplineRank;
import com.aionemu.gameserver.model.gameobjects.player.title.TitleList;
import com.aionemu.gameserver.model.gameobjects.state.CreatureState;
import com.aionemu.gameserver.model.gameobjects.state.CreatureVisualState;
import com.aionemu.gameserver.model.house.House;
import com.aionemu.gameserver.model.house.HouseRegistry;
import com.aionemu.gameserver.model.house.HouseStatus;
import com.aionemu.gameserver.model.items.ItemCooldown;
import com.aionemu.gameserver.model.items.storage.IStorage;
import com.aionemu.gameserver.model.items.storage.LegionStorageProxy;
import com.aionemu.gameserver.model.items.storage.Storage;
import com.aionemu.gameserver.model.items.storage.StorageType;
import com.aionemu.gameserver.model.skill.PlayerSkillList;
import com.aionemu.gameserver.model.skinskill.SkillSkinList;
import com.aionemu.gameserver.model.stats.container.PlayerGameStats;
import com.aionemu.gameserver.model.stats.container.PlayerLifeStats;
import com.aionemu.gameserver.model.team.legion.Legion;
import com.aionemu.gameserver.model.team.legion.LegionJoinRequestState;
import com.aionemu.gameserver.model.team.legion.LegionMember;
import com.aionemu.gameserver.model.team2.TeamMember;
import com.aionemu.gameserver.model.team2.TemporaryPlayerTeam;
import com.aionemu.gameserver.model.team2.alliance.PlayerAlliance;
import com.aionemu.gameserver.model.team2.alliance.PlayerAllianceGroup;
import com.aionemu.gameserver.model.team2.common.legacy.LootGroupRules;
import com.aionemu.gameserver.model.team2.group.PlayerGroup;
import com.aionemu.gameserver.model.templates.BoundRadius;
import com.aionemu.gameserver.model.templates.event.MaxCountOfDay;
import com.aionemu.gameserver.model.templates.flypath.FlyPathEntry;
import com.aionemu.gameserver.model.templates.item.ItemAttackType;
import com.aionemu.gameserver.model.templates.item.ItemTemplate;
import com.aionemu.gameserver.model.templates.item.ItemUseLimits;
import com.aionemu.gameserver.model.templates.ride.RideInfo;
import com.aionemu.gameserver.model.templates.stats.PlayerStatsTemplate;
import com.aionemu.gameserver.model.templates.windstreams.WindstreamPath;
import com.aionemu.gameserver.model.templates.zone.ZoneType;
import com.aionemu.gameserver.network.aion.AionConnection;
import com.aionemu.gameserver.network.aion.serverpackets.SM_STATS_INFO;
import com.aionemu.gameserver.network.loginserver.LoginServer;
import com.aionemu.gameserver.network.loginserver.serverpackets.SM_ACCOUNT_TOLL_INFO;
import com.aionemu.gameserver.questEngine.model.QuestState;
import com.aionemu.gameserver.questEngine.model.QuestStatus;
import com.aionemu.gameserver.services.HousingService;
import com.aionemu.gameserver.skillengine.condition.ChainCondition;
import com.aionemu.gameserver.skillengine.effect.AbnormalState;
import com.aionemu.gameserver.skillengine.effect.EffectTemplate;
import com.aionemu.gameserver.skillengine.effect.RebirthEffect;
import com.aionemu.gameserver.skillengine.effect.ResurrectBaseEffect;
import com.aionemu.gameserver.skillengine.model.ChainSkills;
import com.aionemu.gameserver.skillengine.model.Effect;
import com.aionemu.gameserver.skillengine.model.SkillTemplate;
import com.aionemu.gameserver.skillengine.task.CraftingTask;
import com.aionemu.gameserver.utils.HumanTime;
import com.aionemu.gameserver.utils.PacketSendUtility;
import com.aionemu.gameserver.utils.ThreadPoolManager;
import com.aionemu.gameserver.utils.rates.Rates;
import com.aionemu.gameserver.utils.rates.RegularRates;
import com.aionemu.gameserver.world.World;
import com.aionemu.gameserver.world.WorldPosition;
import com.aionemu.gameserver.world.zone.ZoneInstance;
import javolution.util.FastList;
import javolution.util.FastMap;
/**
* This class is representing Player object, it contains all needed data.
*
* @author -Nemesiss-
* @author SoulKeeper
* @author alexa026
* @author cura
* @author GiGatR00n v4.7.5.x
*/
public class Player extends Creature {
public RideInfo ride;
public InRoll inRoll;
public WindstreamPath windstreamPath;
private PlayerAppearance playerAppearance;
private PlayerAppearance savedPlayerAppearance;
private PlayerCommonData playerCommonData;
private Account playerAccount;
private LegionMember legionMember;
private MacroList macroList;
private PlayerSkillList skillList;
private FriendList friendList;
private BlockList blockList;
private PetList toyPetList;
private MinionList minionList;
private Mailbox mailbox;
private PrivateStore store;
private TitleList titleList;
private QuestStateList questStateList;
private RecipeList recipeList;
private List<House> houses;
private ResponseRequester requester;
private boolean lookingForGroup = false;
private boolean lookingForEvent = false;
private Storage inventory;
private Storage[] petBag = new Storage[StorageType.PET_BAG_MAX - StorageType.PET_BAG_MIN + 1];
private Storage[] cabinets = new Storage[StorageType.HOUSE_WH_MAX - StorageType.HOUSE_WH_MIN + 1];
private Storage regularWarehouse;
private Storage accountWarehouse;
private Equipment equipment;
private HouseRegistry houseRegistry;
private PlayerStatsTemplate playerStatsTemplate;
private PlayerSettings playerSettings;
private com.aionemu.gameserver.model.team2.group.PlayerGroup playerGroup2;
private PlayerAllianceGroup playerAllianceGroup;
private final AbsoluteStatOwner absStatsHolder;
private AbyssRank abyssRank;
private NpcFactions npcFactions;
private Rates rates;
private int flyState = 0;
private boolean isTrading;
private long prisonTimer = 0;
private long startPrison;
private boolean invul;
private FlyController flyController;
private CraftingTask craftingTask;
private int flightTeleportId;
private int flightDistance;
private Summon summon;
private SummonedObject<?> summonedObj;
private Pet toyPet;
private Minion minion;
private Kisk kisk;
private boolean isResByPlayer = false;
private int resurrectionSkill = 0;
private boolean isFlyingBeforeDeath = false;
private boolean isGagged = false;
private boolean edit_mode = false;
private Npc postman = null;
private boolean isInResurrectPosState = false;
private float resPosX = 0;
private float resPosY = 0;
private float resPosZ = 0;
private boolean underNoFPConsum = false;
private boolean isAdminTeleportation = false;
private boolean cooldownZero = false;
private boolean isUnderInvulnerableWing = false;
private boolean isFlying = false;
private boolean isWispable = true;
private boolean isCommandUsed = false;
private int abyssRankListUpdateMask = 0;
private BindPointPosition bindPoint;
private Map<Integer, ItemCooldown> itemCoolDowns;
private PortalCooldownList portalCooldownList;
private CraftCooldownList craftCooldownList;
private HouseObjectCooldownList houseObjectCooldownList;
private long nextSkillUse;
private long nextSummonSkillUse;
private ChainSkills chainSkills;
private Map<AttackStatus, Long> lastCounterSkill = new HashMap<AttackStatus, Long>();
private int dualEffectValue = 0;
private int wordBanTime = 0;
private boolean bannedFromWorld = false;
private String bannedFromWorldBy = "";
private long bannedFromWorldDuring = 0;
private Date bannedFromWorldDate = null;
private String bannedFromWorldReason = "";
private ScheduledFuture<?> taskToUnbanFromWorld = null;
private Map<Integer, MaxCountOfDay> maxCountEvent;
private int LunaDiceGame;
private int LunaDiceGameTry = 0;
/**
* Static information for players
*/
private static final int CUBE_SPACE = 9;
private static final int WAREHOUSE_SPACE = 8;
private boolean isAttackMode = false;
private long gatherableTimer = 0;
private long stopGatherable;
private String captchaWord;
private byte[] captchaImage;
private float instanceStartPosX, instanceStartPosY, instanceStartPosZ;
private int rebirthResurrectPercent = 1;
private int rebirthSkill = 0;
/**
* Connection of this Player.
*/
private AionConnection clientConnection;
private FlyPathEntry flyLocationId;
private long flyStartTime;
private EmotionList emotions;
private MotionList motions;
private int partnerId;
private long flyReuseTime;
private boolean isMentor;
private long lastMsgTime = 0;
private int floodMsgCount = 0;
private long onlineTime = 0;
private long onlineBonusTime = 0;
private int lootingNpcOid;
private boolean rebirthRevive;
// Needed to remove supplements queue
private int subtractedSupplementsCount;
private int subtractedSupplementId;
private int portAnimation;
private boolean isInSprintMode;
private List<ActionObserver> rideObservers;
byte housingStatus = HousingFlags.BUY_STUDIO_ALLOWED.getId();
private int battleReturnMap;
private float[] battleReturnCoords;
// This variables are for the FFA system
// This variables are for the custom RP and GM system
private boolean isGmMode = false;
// This variables are for the battleground system
private int timer = 0;
private boolean addedStatus;
private boolean afkmode;
// This variables are for the custom PvE and PK system
byte buildingOwnerStates = PlayerHouseOwnerFlags.BUY_STUDIO_ALLOWED.getId();
public static final int CHAT_NOT_FIXED = 0;
public static final int CHAT_FIXED_ON_WORLD = 1;
public static final int CHAT_FIXED_ON_ELYOS = 2;
public static final int CHAT_FIXED_ON_ASMOS = 4;
public static final int CHAT_FIXED_ON_BOTH = CHAT_FIXED_ON_ELYOS | CHAT_FIXED_ON_ASMOS;
public int CHAT_FIX_WORLD_CHANNEL = CHAT_NOT_FIXED;
private int useAutoGroup = 0;
private boolean robot = false;
private int robotId = 0;
public int FAST_TRACK_TYPE = 0;// 0 = nothing,1 = moved exact current,2 = already moved
private boolean isOnFastTrack = false;
private boolean isInLiveParty = false;
// private int linkedSkill;
private PlayerConquererProtectorData conquerorProtectorData;
private Map<Integer, PlayerFame> playerFame = (Map<Integer, PlayerFame>)new FastMap<Integer, PlayerFame>();
private int worldPlayTime;
private PlayerBonusTime bonusTime;
private boolean newPlayer = false;
private long creationDay;
private int playersBonusId = 0;
@SuppressWarnings("unused")
private boolean hasBonus;
private int bonusId = 0;
private F2p f2p;
private boolean hasAbyssBonus;
private int abyssId = 0;
private List<ActionObserver> hotTeleObservers;
private int transformModelId;
private int transformItemId;
private int transformPanelId;
private int transformSkillId;
private boolean invisibleTransform = false;
private AccountTransformList transformList;
private int lastUsedTransformation;
private Map<Integer, TransformCollection> transformCollections = (Map<Integer, TransformCollection>)new FastMap<Integer, TransformCollection>();
private List<AccountTransfo> transformCreated = (List<AccountTransfo>)new FastList<AccountTransfo>();
private PlayerWardrobeList wardrobe;
private PlayerLunaShop lunaShop;
private PlayerSweep shugoSweep;
private LunaBuffBonus lunaBuffBonus;
private FastMap<Integer, Integer> minions_ = (FastMap<Integer, Integer>)new FastMap<Integer, Integer>();
private boolean setMinionSpawned = false;
private int minionEnergy;
private EquipmentSettingList equipmentSettingList;
private PlayerMCList mc;
private PlayerCollection playerCollection;
private Map<Integer, PlayerAchievement> playerAchievements = (Map<Integer, PlayerAchievement>)new FastMap<Integer, PlayerAchievement>();
private Map<Integer, PlayerAchievement> playerEventAchievements = (Map<Integer, PlayerAchievement>)new FastMap<Integer, PlayerAchievement>();
private Map<Integer, LumielTransform> playerLumiel = (Map<Integer, LumielTransform>)new FastMap<Integer, LumielTransform>();
/**
* Player Skill Skin List
*/
private SkillSkinList skillSkinList;
/**
* Player Event Window List
*/
private PlayerEventWindowList eventWindowList;
/**
* Player Event Window List
*/
public PlayerEventWindowList getEventWindow() {
return eventWindowList;
}
public void setEventWindow(PlayerEventWindowList eventWindowList) {
this.eventWindowList = eventWindowList;
}
/**
* Used for JUnit tests
*/
private Player(PlayerCommonData plCommonData) {
super(plCommonData.getPlayerObjId(), new PlayerController(), null, plCommonData, null);
this.playerCommonData = plCommonData;
this.playerAccount = new Account(0);
this.absStatsHolder = new AbsoluteStatOwner(this, 0);
}
public Player(PlayerController controller, PlayerCommonData plCommonData, PlayerAppearance appereance, Account account) {
super(plCommonData.getPlayerObjId(), controller, null, plCommonData, plCommonData.getPosition());
this.daoVars = DAOManager.getDAO(PlayerVarsDAO.class);
this.playerCommonData = plCommonData;
this.playerAppearance = appereance;
this.playerAccount = account;
this.requester = new ResponseRequester(this);
this.questStateList = new QuestStateList();
this.titleList = new TitleList();
this.invisibleTransform = false;
this.playerAchievements = (Map<Integer, PlayerAchievement>)new FastMap<Integer, PlayerAchievement>();
this.playerEventAchievements = (Map<Integer, PlayerAchievement>)new FastMap<Integer, PlayerAchievement>();
this.transformCollections = (Map<Integer, TransformCollection>)new FastMap<Integer, TransformCollection>();
this.transformCreated = (List<AccountTransfo>)new FastList<AccountTransfo>();
this.portalCooldownList = new PortalCooldownList(this);
this.craftCooldownList = new CraftCooldownList(this);
this.houseObjectCooldownList = new HouseObjectCooldownList(this);
this.toyPetList = new PetList(this);
this.minionList = new MinionList(this);
controller.setOwner(this);
moveController = new PlayerMoveController(this);
this.playerFame = (Map<Integer, PlayerFame>)new FastMap<Integer, PlayerFame>();
this.playerLumiel = (Map<Integer, LumielTransform>)new FastMap<Integer, LumielTransform>();
plCommonData.setBoundingRadius(new BoundRadius(0.5f, 0.5f, getPlayerAppearance().getHeight()));
setPlayerStatsTemplate(DataManager.PLAYER_STATS_DATA.getTemplate(this));
setGameStats(new PlayerGameStats(this));
setLifeStats(new PlayerLifeStats(this));
absStatsHolder = new AbsoluteStatOwner(this, 0);
this.transformList = new AccountTransformList(this);
}
public boolean isInPlayerMode(PlayerMode mode) {
return PlayerActions.isInPlayerMode(this, mode);
}
public void setPlayerMode(PlayerMode mode, Object obj) {
PlayerActions.setPlayerMode(this, mode, obj);
}
public void unsetPlayerMode(PlayerMode mode) {
PlayerActions.unsetPlayerMode(this, mode);
}
@Override
public PlayerMoveController getMoveController() {
return (PlayerMoveController) super.getMoveController();
}
@Override
protected final AggroList createAggroList() {
return new PlayerAggroList(this);
}
public PlayerCommonData getCommonData() {
return playerCommonData;
}
@Override
public String getName() {
return playerCommonData.getName();
}
public PlayerAppearance getPlayerAppearance() {
return playerAppearance;
}
public void setPlayerAppearance(PlayerAppearance playerAppearance) {
this.playerAppearance = playerAppearance;
}
/**
* Only use for the Size admin command
*
* @return PlayerAppearance : The saved player's appearance, to rollback his appearance
*/
public PlayerAppearance getSavedPlayerAppearance() {
return savedPlayerAppearance;
}
/**
* Only use for the Size admin command
*
* @param playerAppearance
* PlayerAppearance : The saved player's appearance, to rollback his appearance
*/
public void setSavedPlayerAppearance(PlayerAppearance savedPlayerAppearance) {
this.savedPlayerAppearance = savedPlayerAppearance;
}
/**
* Set connection of this player.
*
* @param clientConnection
*/
public void setClientConnection(AionConnection clientConnection) {
this.clientConnection = clientConnection;
}
/**
* Get connection of this player.
*
* @return AionConnection of this player.
*/
public AionConnection getClientConnection() {
return this.clientConnection;
}
public MacroList getMacroList() {
return macroList;
}
public void setMacroList(MacroList macroList) {
this.macroList = macroList;
}
public PlayerSkillList getSkillList() {
return skillList;
}
public void setSkillList(PlayerSkillList skillList) {
this.skillList = skillList;
}
/**
* @return the toyPet
*/
public Pet getPet() {
return toyPet;
}
/**
* @param toyPet
* the toyPet to set
*/
public void setToyPet(Pet toyPet) {
this.toyPet = toyPet;
}
/**
* @return the minions
*/
public Minion getMinion() {
return minion;
}
public void setMinion(Minion minion) {
this.minion = minion;
}
public void setMinionSpawned(boolean setMinionSpawned) {
this.setMinionSpawned = setMinionSpawned;
}
public boolean isMinionSpawned() {
return setMinionSpawned;
}
public void setMinionTempList(int objId, int id) {
this.minions_.put(objId, id);
}
public int getMinionTempList(int objId) {
if (objId == 0) {}
return minions_.get(objId);
}
public int getMinionEnergy() {
return minionEnergy;
}
public void setMinionEnergy(int energy) {
this.minionEnergy = energy;
}
public boolean isMagicalTypeClass() {
return playerCommonData.getPlayerClass() == PlayerClass.ARTIST || playerCommonData.getPlayerClass() == PlayerClass.BARD || playerCommonData.getPlayerClass() == PlayerClass.CLERIC || playerCommonData.getPlayerClass() == PlayerClass.SORCERER || playerCommonData.getPlayerClass() == PlayerClass.SPIRIT_MASTER || playerCommonData.getPlayerClass() == PlayerClass.RIDER;
}
/**
* Gets this players Friend List
*
* @return FriendList
*/
public FriendList getFriendList() {
return friendList;
}
/**
* Is this player looking for a group
*
* @return true or false
*/
public boolean isLookingForGroup() {
return lookingForGroup;
}
/**
* Sets whether or not this player is looking for a group
*
* @param lookingForGroup
*/
public void setLookingForGroup(boolean lookingForGroup) {
this.lookingForGroup = lookingForGroup;
}
/**
* Is this player looking for an event
*
* @return true or false
*/
public boolean isLookingForEvent() {
return lookingForEvent;
}
/**
* Sets whether or not this player is looking for an event
*
* @param lookingForEvent
*/
public void setLookingForEvent(boolean lookingForEvent) {
this.lookingForEvent = lookingForEvent;
}
public boolean isAttackMode() {
return isAttackMode;
}
public void setAttackMode(boolean isAttackMode) {
this.isAttackMode = isAttackMode;
}
public boolean isNotGatherable() {
return gatherableTimer != 0;
}
public void setGatherableTimer(long gatherableTimer) {
if (gatherableTimer < 0) {
gatherableTimer = 0;
}
this.gatherableTimer = gatherableTimer;
}
public long getGatherableTimer() {
return gatherableTimer;
}
public long getStopGatherable() {
return stopGatherable;
}
public void setStopGatherable(long stopGatherable) {
this.stopGatherable = stopGatherable;
}
public String getCaptchaWord() {
return captchaWord;
}
public void setCaptchaWord(String captchaWord) {
this.captchaWord = captchaWord;
}
public byte[] getCaptchaImage() {
return captchaImage;
}
public void setCaptchaImage(byte[] captchaImage) {
this.captchaImage = captchaImage;
}
/**
* Sets this players friend list. <br />
* Remember to send the player the <tt>SM_FRIEND_LIST</tt> packet.
*
* @param list
*/
public void setFriendList(FriendList list) {
this.friendList = list;
}
public BlockList getBlockList() {
return blockList;
}
public void setBlockList(BlockList list) {
this.blockList = list;
}
public final PetList getPetList() {
return toyPetList;
}
public final MinionList getMinionList() {
return minionList;
}
@Override
public PlayerLifeStats getLifeStats() {
return (PlayerLifeStats) super.getLifeStats();
}
@Override
public PlayerGameStats getGameStats() {
return (PlayerGameStats) super.getGameStats();
}
/**
* Gets the ResponseRequester for this player
*
* @return ResponseRequester
*/
public ResponseRequester getResponseRequester() {
return requester;
}
public boolean isOnline() {
return getClientConnection() != null;
}
public void setCubeExpands(int cubeExpands) {
this.playerCommonData.setCubeExpands(cubeExpands);
getInventory().setLimit(getInventory().getLimit() + (cubeExpands) * CUBE_SPACE);
}
public int getCubeExpands() {
return this.playerCommonData.getCubeExpands();
}
public PlayerClass getPlayerClass() {
return playerCommonData.getPlayerClass();
}
public Gender getGender() {
return playerCommonData.getGender();
}
/**
* Return PlayerController of this Player Object.
*
* @return PlayerController.
*/
@Override
public PlayerController getController() {
return (PlayerController) super.getController();
}
@Override
public byte getLevel() {
return (byte) playerCommonData.getLevel();
}
/**
* @return the inventory
*/
public Equipment getEquipment() {
return equipment;
}
public void setEquipment(Equipment equipment) {
this.equipment = equipment;
}
/**
* @return the player private store
*/
public PrivateStore getStore() {
return store;
}
/**
* @param store
* the store that needs to be set
*/
public void setStore(PrivateStore store) {
this.store = store;
}
/**
* @return the questStatesList
*/
public QuestStateList getQuestStateList() {
return questStateList;
}
/**
* @param questStateList
* the QuestStateList to set
*/
public void setQuestStateList(QuestStateList questStateList) {
this.questStateList = questStateList;
}
/**
* @return the playerStatsTemplate
*/
public PlayerStatsTemplate getPlayerStatsTemplate() {
return playerStatsTemplate;
}
/**
* @param playerStatsTemplate
* the playerStatsTemplate to set
*/
public void setPlayerStatsTemplate(PlayerStatsTemplate playerStatsTemplate) {
this.playerStatsTemplate = playerStatsTemplate;
}
public RecipeList getRecipeList() {
return recipeList;
}
public void setRecipeList(RecipeList recipeList) {
this.recipeList = recipeList;
}
/**
* @param inventory
* the inventory to set Inventory should be set right after player object is created
*/
public void setStorage(Storage storage, StorageType storageType) {
if (storageType == StorageType.CUBE) {
this.inventory = storage;
}
if (storageType.getId() >= StorageType.PET_BAG_MIN && storageType.getId() <= StorageType.PET_BAG_MAX) {
this.petBag[storageType.getId() - StorageType.PET_BAG_MIN] = storage;
}
if (storageType.getId() >= StorageType.HOUSE_WH_MIN && storageType.getId() <= StorageType.HOUSE_WH_MAX) {
this.cabinets[storageType.getId() - StorageType.HOUSE_WH_MIN] = storage;
}
if (storageType == StorageType.REGULAR_WAREHOUSE) {
this.regularWarehouse = storage;
}
if (storageType == StorageType.ACCOUNT_WAREHOUSE) {
this.accountWarehouse = storage;
}
storage.setOwner(this);
}
/**
* @param storageType
* @return
*/
public IStorage getStorage(int storageType) {
if (storageType == StorageType.REGULAR_WAREHOUSE.getId()) {
return regularWarehouse;
}
if (storageType == StorageType.ACCOUNT_WAREHOUSE.getId()) {
return accountWarehouse;
}
if (storageType == StorageType.LEGION_WAREHOUSE.getId() && getLegion() != null) {
return new LegionStorageProxy(getLegion().getLegionWarehouse(), this);
}
if (storageType >= StorageType.PET_BAG_MIN && storageType <= StorageType.PET_BAG_MAX) {
return petBag[storageType - StorageType.PET_BAG_MIN];
}
if (storageType >= StorageType.HOUSE_WH_MIN && storageType <= StorageType.HOUSE_WH_MAX) {
return cabinets[storageType - StorageType.HOUSE_WH_MIN];
}
if (storageType == StorageType.CUBE.getId()) {
return inventory;
}
return null;
}
/**
* Items from UPDATE_REQUIRED storages and equipment
*
* @return
*/
public List<Item> getDirtyItemsToUpdate() {
List<Item> dirtyItems = new ArrayList<Item>();
IStorage cubeStorage = getStorage(StorageType.CUBE.getId());
if (cubeStorage.getPersistentState() == PersistentState.UPDATE_REQUIRED) {
dirtyItems.addAll(cubeStorage.getItemsWithKinah());
dirtyItems.addAll(cubeStorage.getDeletedItems());
cubeStorage.setPersistentState(PersistentState.UPDATED);
}
IStorage regularWhStorage = getStorage(StorageType.REGULAR_WAREHOUSE.getId());
if (regularWhStorage.getPersistentState() == PersistentState.UPDATE_REQUIRED) {
dirtyItems.addAll(regularWhStorage.getItemsWithKinah());
dirtyItems.addAll(regularWhStorage.getDeletedItems());
regularWhStorage.setPersistentState(PersistentState.UPDATED);
}
IStorage accountWhStorage = getStorage(StorageType.ACCOUNT_WAREHOUSE.getId());
if (accountWhStorage.getPersistentState() == PersistentState.UPDATE_REQUIRED) {
dirtyItems.addAll(accountWhStorage.getItemsWithKinah());
dirtyItems.addAll(accountWhStorage.getDeletedItems());
accountWhStorage.setPersistentState(PersistentState.UPDATED);
}
IStorage legionWhStorage = getStorage(StorageType.LEGION_WAREHOUSE.getId());
if (legionWhStorage != null) {
if (legionWhStorage.getPersistentState() == PersistentState.UPDATE_REQUIRED) {
dirtyItems.addAll(legionWhStorage.getItemsWithKinah());
dirtyItems.addAll(legionWhStorage.getDeletedItems());
legionWhStorage.setPersistentState(PersistentState.UPDATED);
}
}
for (int petBagId = StorageType.PET_BAG_MIN; petBagId <= StorageType.PET_BAG_MAX; petBagId++) {
IStorage petBag = getStorage(petBagId);
if (petBag != null && petBag.getPersistentState() == PersistentState.UPDATE_REQUIRED) {
dirtyItems.addAll(petBag.getItemsWithKinah());
dirtyItems.addAll(petBag.getDeletedItems());
petBag.setPersistentState(PersistentState.UPDATED);
}
}
for (int houseWhId = StorageType.HOUSE_WH_MIN; houseWhId <= StorageType.HOUSE_WH_MAX; houseWhId++) {
IStorage cabinet = getStorage(houseWhId);
if (cabinet != null && cabinet.getPersistentState() == PersistentState.UPDATE_REQUIRED) {
dirtyItems.addAll(cabinet.getItemsWithKinah());
dirtyItems.addAll(cabinet.getDeletedItems());
cabinet.setPersistentState(PersistentState.UPDATED);
}
}
Equipment equipment = getEquipment();
if (equipment.getPersistentState() == PersistentState.UPDATE_REQUIRED) {
dirtyItems.addAll(equipment.getEquippedItems());
equipment.setPersistentState(PersistentState.UPDATED);
}
return dirtyItems;
}
/**
* //TODO probably need to optimize here
*
* @return
*/
public FastList<Item> getAllItems() {
FastList<Item> items = FastList.newInstance();
items.addAll(this.inventory.getItemsWithKinah());
if (this.regularWarehouse != null) {
items.addAll(this.regularWarehouse.getItemsWithKinah());
}
if (this.accountWarehouse != null) {
items.addAll(this.accountWarehouse.getItemsWithKinah());
}
for (int petBagId = StorageType.PET_BAG_MIN; petBagId <= StorageType.PET_BAG_MAX; petBagId++) {
IStorage petBag = getStorage(petBagId);
if (petBag != null) {
items.addAll(petBag.getItemsWithKinah());
}
}
for (int houseWhId = StorageType.HOUSE_WH_MIN; houseWhId <= StorageType.HOUSE_WH_MAX; houseWhId++) {
IStorage cabinet = getStorage(houseWhId);
if (cabinet != null) {
items.addAll(cabinet.getItemsWithKinah());
}
}
items.addAll(getEquipment().getEquippedItems());
return items;
}
public Storage getInventory() {
return inventory;
}
/**
* @return the playerSettings
*/
public PlayerSettings getPlayerSettings() {
return playerSettings;
}
/**
* @param playerSettings
* the playerSettings to set
*/
public void setPlayerSettings(PlayerSettings playerSettings) {
this.playerSettings = playerSettings;
}
public TitleList getTitleList() {
return titleList;
}
public void setTitleList(TitleList titleList) {
if (havePermission(MembershipConfig.TITLES_ADDITIONAL_ENABLE)) {
titleList.addEntry(102, 0);
titleList.addEntry(103, 0);
titleList.addEntry(104, 0);
titleList.addEntry(105, 0);
titleList.addEntry(106, 0);
titleList.addEntry(146, 0);
titleList.addEntry(151, 0);
titleList.addEntry(152, 0);
titleList.addEntry(160, 0);
titleList.addEntry(161, 0);
}
this.titleList = titleList;
titleList.setOwner(this);
}
public com.aionemu.gameserver.model.team2.group.PlayerGroup getPlayerGroup2() {
return playerGroup2;
}
public void setPlayerGroup2(com.aionemu.gameserver.model.team2.group.PlayerGroup playerGroup) {
this.playerGroup2 = playerGroup;
}
/**
* @return the abyssRank
*/
public AbyssRank getAbyssRank() {
return abyssRank;
}
/**