TrinityCore
Loading...
Searching...
No Matches
CharacterPackets.h
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef TRINITYCORE_CHARACTER_PACKETS_H
19#define TRINITYCORE_CHARACTER_PACKETS_H
20
21#include "Packet.h"
22#include "ObjectGuid.h"
23#include "Optional.h"
24#include "PacketUtilities.h"
25#include "Position.h"
26#include "RaceMask.h"
27#include "SharedDefines.h"
28#include "UnitDefines.h"
29#include "UpdateFields.h"
30#include <array>
31#include <memory>
32
33class Field;
34
35namespace UF
36{
38
39 ByteBuffer& operator<<(ByteBuffer& data, ChrCustomizationChoice const& customizationChoice);
40 ByteBuffer& operator>>(ByteBuffer& data, ChrCustomizationChoice& customizationChoice);
41}
42
43namespace WorldPackets
44{
45 namespace Character
46 {
48
49 class EnumCharacters final : public ClientPacket
50 {
51 public:
52 explicit EnumCharacters(WorldPacket&& packet);
53
54 void Read() override { }
55 };
56
74
76 {
77 std::string NewName;
79 };
80
88
99
109
118
126
128 {
134 std::vector<WarbandGroupMember> Members;
135 std::string_view Name;
136 };
137
139 {
140 public:
142 {
150 CharacterInfoBasic(Field const* fields);
151
155 std::string Name;
160 std::vector<ChrCustomizationChoice> Customizations;
170 bool FirstLogin = false;
179
183
185
197
198 std::array<VisualItemInfo, 19> VisualItems = { };
201 bool RealmInfoFound = false;
202 bool IsRealmOffline = false;
203 };
204
206 {
207 bool BoostInProgress = false;
209 std::vector<std::string> MailSenders;
210 std::vector<uint32> MailSenderTypes;
211 bool RpeAvailable = false;
212 uint32 NoRpeReason = 4; // recently active
213 };
214
222
235
237 {
239 bool HasExpansion = false;
241 bool HasEntitlement = false;
243 };
244
246 {
248 bool HasUnlockedLicense = false;
251 bool HasEntitlement = false;
252 bool HideRaceOnClient = false;
255 std::vector<ClassUnlock> ClassUnlocks;
256 };
257
263
265 {
266 enum
267 {
269 Level
270 };
271
274 };
275
277
278 WorldPacket const* Write() override;
279
280 bool Success = false;
281 bool Realmless = false;
282 bool IsDeletedCharacters = false;
286 bool IsRestrictedTrial = false;
289
292
293 std::vector<CharacterInfo> Characters;
294 std::vector<RegionwideCharacterListEntry> RegionwideCharacters;
295 std::vector<RaceUnlock> RaceUnlockData;
296 std::vector<UnlockedConditionalAppearance> UnlockedConditionalAppearances;
297 std::vector<RaceLimitDisableInfo> RaceLimitDisables;
298 std::vector<WarbandGroup> WarbandGroups;
299 };
300
302 {
303 public:
305
306 void Read() override;
307
309 std::string Name;
310 };
311
313 {
314 public:
316 SequenceIndex(sequenceIndex), Result(result)
317 {
318 }
319
320 WorldPacket const* Write() override;
321
324 };
325
326 class CreateCharacter final : public ClientPacket
327 {
328 public:
329 explicit CreateCharacter(WorldPacket&& packet) : ClientPacket(CMSG_CREATE_CHARACTER, std::move(packet)) { }
330
331 void Read() override;
332
346 std::shared_ptr<CharacterCreateInfo> CreateInfo;
347 };
348
349 class CreateChar final : public ServerPacket
350 {
351 public:
353
354 WorldPacket const* Write() override;
355
358 };
359
360 class CharDelete final : public ClientPacket
361 {
362 public:
363 explicit CharDelete(WorldPacket&& packet): ClientPacket(CMSG_CHAR_DELETE, std::move(packet)) { }
364
365 void Read() override;
366
368 };
369
370 class DeleteChar final : public ServerPacket
371 {
372 public:
374
375 WorldPacket const* Write() override;
376
378 };
379
381 {
382 public:
384
385 void Read() override;
386
391 std::shared_ptr<CharacterRenameInfo> RenameInfo;
392 };
393
395 {
396 public:
398
399 WorldPacket const* Write() override;
400
401 std::string Name;
404 };
405
406 class CharCustomize final : public ClientPacket
407 {
408 public:
409 explicit CharCustomize(WorldPacket&& packet) : ClientPacket(CMSG_CHAR_CUSTOMIZE, std::move(packet)) { }
410
411 void Read() override;
412
423 std::shared_ptr<CharCustomizeInfo> CustomizeInfo;
424 };
425
427 {
428 public:
429 explicit CharCustomizeSuccess(CharCustomizeInfo const* customizeInfo);
430
431 WorldPacket const* Write() override;
432
434 std::string CharName;
437 };
438
440 {
441 public:
443
444 WorldPacket const* Write() override;
445
448 };
449
451 {
452 public:
454
455 void Read() override;
456
469 std::shared_ptr<CharRaceOrFactionChangeInfo> RaceOrFactionChangeInfo;
470 };
471
479
491
493 {
494 public:
496
497 void Read() override;
498
501 };
502
504 {
505 public:
507
508 WorldPacket const* Write() override;
509
510 std::string Name;
511 bool Success = false;
512 };
513
514 class ReorderCharacters final : public ClientPacket
515 {
516 public:
522
523 explicit ReorderCharacters(WorldPacket&& packet);
524
525 void Read() override;
526
528 };
529
530 class UndeleteCharacter final : public ClientPacket
531 {
532 public:
534
535 void Read() override;
536
541 std::shared_ptr<CharacterUndeleteInfo> UndeleteInfo;
542 };
543
545 {
546 public:
548
549 WorldPacket const* Write() override;
550
557 };
558
560 {
561 public:
563
564 void Read() override { }
565 };
566
578
579 class PlayerLogin final : public ClientPacket
580 {
581 public:
582 explicit PlayerLogin(WorldPacket&& packet) : ClientPacket(CMSG_PLAYER_LOGIN, std::move(packet)) { }
583
584 void Read() override;
585
587 float FarClip = 0.0f;
588 bool RPE = false;
589 };
590
591 class LoginVerifyWorld final : public ServerPacket
592 {
593 public:
595
596 WorldPacket const* Write() override;
597
601 };
602
621
631
632 class LogoutRequest final : public ClientPacket
633 {
634 public:
635 explicit LogoutRequest(WorldPacket&& packet) : ClientPacket(CMSG_LOGOUT_REQUEST, std::move(packet)) { }
636
637 void Read() override;
638
639 bool IdleLogout = false;
640 };
641
642 class LogoutResponse final : public ServerPacket
643 {
644 public:
646
647 WorldPacket const* Write() override;
648
650 bool Instant = false;
651 };
652
665
672
673 class LogoutComplete final : public ServerPacket
674 {
675 public:
677
678 WorldPacket const* Write() override;
679
680 std::unique_ptr<SwitchGameModeData> SwitchGameMode;
681 };
682
683 class LogoutCancel final : public ClientPacket
684 {
685 public:
686 explicit LogoutCancel(WorldPacket&& packet) : ClientPacket(CMSG_LOGOUT_CANCEL, std::move(packet)) { }
687
688 void Read() override { }
689 };
690
691 class LogoutCancelAck final : public ServerPacket
692 {
693 public:
695
696 WorldPacket const* Write() override { return &_worldPacket; }
697 };
698
700 {
701 public:
703
704 void Read() override;
705
707 bool Showing = false;
708 };
709
710 class InitialSetup final : public ServerPacket
711 {
712 public:
714
715 WorldPacket const* Write() override;
716
719 };
720
722 {
723 public:
725
726 void Read() override;
727
729 };
730
731 class RequestPlayedTime final : public ClientPacket
732 {
733 public:
735
736 void Read() override;
737
738 bool TriggerScriptEvent = false;
739 };
740
741 class PlayedTime final : public ServerPacket
742 {
743 public:
745
746 WorldPacket const* Write() override;
747
750 bool TriggerEvent = false;
751 };
752
753 class SetTitle final : public ClientPacket
754 {
755 public:
756 explicit SetTitle(WorldPacket&& packet) : ClientPacket(CMSG_SET_TITLE, std::move(packet)) { }
757
758 void Read() override;
759
761 };
762
776
777 class BarberShopResult final : public ServerPacket
778 {
779 public:
780 enum class ResultEnum : uint8
781 {
782 Success = 0,
783 NoMoney = 1,
784 NotOnChair = 2,
785 NoMoney2 = 3
786 };
787
789
790 WorldPacket const* Write() override;
791
793 };
794
795 class LogXPGain final : public ServerPacket
796 {
797 public:
798 explicit LogXPGain() : ServerPacket(SMSG_LOG_XP_GAIN, 16 + 4 + 1 + 4 + 4) { }
799
800 WorldPacket const* Write() override;
801
806 float GroupBonus = 0.0f;
807 };
808
809 class TitleEarned final : public ServerPacket
810 {
811 public:
812 explicit TitleEarned(OpcodeServer opcode) : ServerPacket(opcode, 4) { }
813
814 WorldPacket const* Write() override;
815
817 };
818
819 class SetFactionAtWar final : public ClientPacket
820 {
821 public:
822 explicit SetFactionAtWar(WorldPacket&& packet) : ClientPacket(CMSG_SET_FACTION_AT_WAR, std::move(packet)) { }
823
824 void Read() override;
825
827 };
828
829 class SetFactionNotAtWar final : public ClientPacket
830 {
831 public:
833
834 void Read() override;
835
837 };
838
839 class SetFactionInactive final : public ClientPacket
840 {
841 public:
843
844 void Read() override;
845
847 bool State = false;
848 };
849
850 class SetWatchedFaction final : public ClientPacket
851 {
852 public:
854
855 void Read() override;
856
858 };
859
861 {
862 public:
864
865 WorldPacket const* Write() override;
866
868 };
869
871 {
872 public:
874
875 void Read() override;
876
879 };
880
882 {
883 public:
885
886 WorldPacket const* Write() override;
887
890 };
891
892 class SavePersonalEmblem final : public ClientPacket
893 {
894 public:
896
897 void Read() override;
898
901 };
902
904 {
905 public:
907
908 WorldPacket const* Write() override;
909
911 };
912 }
913}
914
915#endif // TRINITYCORE_CHARACTER_PACKETS_H
uint8_t uint8
Definition Define.h:156
int16_t int16
Definition Define.h:151
int8_t int8
Definition Define.h:152
int32_t int32
Definition Define.h:150
uint64_t uint64
Definition Define.h:153
uint16_t uint16
Definition Define.h:155
uint32_t uint32
Definition Define.h:154
OpcodeServer
Definition Opcodes.h:1105
@ SMSG_SET_FACTION_VISIBLE
Definition Opcodes.h:2316
@ SMSG_PLAYER_SAVE_PERSONAL_EMBLEM
Definition Opcodes.h:2130
@ SMSG_SET_PLAYER_DECLINED_NAMES_RESULT
Definition Opcodes.h:2328
@ SMSG_UNDELETE_COOLDOWN_STATUS_RESPONSE
Definition Opcodes.h:2440
@ SMSG_LOGOUT_RESPONSE
Definition Opcodes.h:1857
@ SMSG_SET_FACTION_NOT_VISIBLE
Definition Opcodes.h:2314
@ SMSG_INITIAL_SETUP
Definition Opcodes.h:1745
@ SMSG_CHAR_FACTION_CHANGE_RESULT
Definition Opcodes.h:1333
@ SMSG_CHAR_CUSTOMIZE_FAILURE
Definition Opcodes.h:1331
@ SMSG_CREATE_CHAR
Definition Opcodes.h:1416
@ SMSG_LOGOUT_COMPLETE
Definition Opcodes.h:1856
@ SMSG_GENERATE_RANDOM_CHARACTER_NAME_RESULT
Definition Opcodes.h:1573
@ SMSG_CHARACTER_LOGIN_FAILED
Definition Opcodes.h:1324
@ SMSG_LOGIN_VERIFY_WORLD
Definition Opcodes.h:1854
@ SMSG_UNDELETE_CHARACTER_RESPONSE
Definition Opcodes.h:2439
@ SMSG_BARBER_SHOP_RESULT
Definition Opcodes.h:1198
@ SMSG_CHECK_CHARACTER_NAME_AVAILABILITY_RESULT
Definition Opcodes.h:1351
@ SMSG_LOG_XP_GAIN
Definition Opcodes.h:1858
@ SMSG_ENUM_CHARACTERS_RESULT
Definition Opcodes.h:1464
@ SMSG_CHARACTER_RENAME_RESULT
Definition Opcodes.h:1326
@ SMSG_LOGOUT_CANCEL_ACK
Definition Opcodes.h:1855
@ SMSG_DELETE_CHAR
Definition Opcodes.h:1431
@ SMSG_PLAYED_TIME
Definition Opcodes.h:2115
@ CMSG_GET_UNDELETE_CHARACTER_COOLDOWN_STATUS
Definition Opcodes.h:405
@ CMSG_LOGOUT_REQUEST
Definition Opcodes.h:575
@ CMSG_SET_WATCHED_FACTION
Definition Opcodes.h:962
@ CMSG_SET_FACTION_AT_WAR
Definition Opcodes.h:932
@ CMSG_LOADING_SCREEN_NOTIFY
Definition Opcodes.h:559
@ CMSG_SET_FACTION_INACTIVE
Definition Opcodes.h:933
@ CMSG_GENERATE_RANDOM_CHARACTER_NAME
Definition Opcodes.h:385
@ CMSG_SET_ACTION_BAR_TOGGLES
Definition Opcodes.h:916
@ CMSG_SET_TITLE
Definition Opcodes.h:956
@ CMSG_SET_FACTION_NOT_AT_WAR
Definition Opcodes.h:934
@ CMSG_UNDELETE_CHARACTER
Definition Opcodes.h:1030
@ CMSG_CHECK_CHARACTER_NAME_AVAILABILITY
Definition Opcodes.h:236
@ CMSG_CHAR_DELETE
Definition Opcodes.h:191
@ CMSG_CHAR_RACE_OR_FACTION_CHANGE
Definition Opcodes.h:192
@ CMSG_SET_PLAYER_DECLINED_NAMES
Definition Opcodes.h:944
@ CMSG_CHAR_CUSTOMIZE
Definition Opcodes.h:190
@ CMSG_SAVE_PERSONAL_EMBLEM
Definition Opcodes.h:896
@ CMSG_CHARACTER_RENAME_REQUEST
Definition Opcodes.h:187
@ CMSG_REQUEST_PLAYED_TIME
Definition Opcodes.h:869
@ CMSG_ALTER_APPEARANCE
Definition Opcodes.h:59
@ CMSG_LOGOUT_CANCEL
Definition Opcodes.h:572
@ CMSG_PLAYER_LOGIN
Definition Opcodes.h:772
@ CMSG_CREATE_CHARACTER
Definition Opcodes.h:312
std::optional< T > Optional
Optional helper class to wrap optional values within.
Definition Optional.h:25
@ RACE_NONE
Definition RaceMask.h:29
@ CLASS_NONE
@ GENDER_NONE
Class used to access individual fields of database query result.
Definition Field.h:94
Array< ChrCustomizationChoice, 250 > Customizations
Array< ChrCustomizationChoice, 250 > const & Customizations
std::shared_ptr< CharCustomizeInfo > CustomizeInfo
ObjectGuid Guid
Guid of the character to delete.
Optional< CharFactionChangeDisplayInfo > Display
std::shared_ptr< CharRaceOrFactionChangeInfo > RaceOrFactionChangeInfo
std::shared_ptr< CharacterRenameInfo > RenameInfo
CheckCharacterNameAvailabilityResult(uint32 sequenceIndex, uint32 result)
WorldPacket const * Write() override
std::shared_ptr< CharacterCreateInfo > CreateInfo
WorldPacket const * Write() override
std::vector< CharacterInfo > Characters
all characters on the list
bool IgnoreNewPlayerRestrictions
allows client to skip new player restrictions
std::vector< RegionwideCharacterListEntry > RegionwideCharacters
bool IsDeletedCharacters
used for character undelete list
std::vector< RaceLimitDisableInfo > RaceLimitDisables
bool IsNewcomerChatCompleted
forbids hero classes and allied races
std::vector< UnlockedConditionalAppearance > UnlockedConditionalAppearances
bool IsRestrictedNewPlayer
forbids using level boost and class trials
WorldPacket const * Write() override
WorldPacket const * Write() override
TaggedPosition< Position::XYZO > Pos
WorldPacket const * Write() override
WorldPacket const * Write() override
std::unique_ptr< SwitchGameModeData > SwitchGameMode
WorldPacket const * Write() override
WorldPacket const * Write() override
float FarClip
Visibility distance (for terrain)
ObjectGuid Guid
Guid of the player that is logging in.
WorldPacket const * Write() override
std::shared_ptr< CharacterUndeleteInfo > UndeleteInfo
uint32 CurrentCooldown
Current cooldown until next free character restoration. (in sec)
uint32 MaxCooldown
Max. cooldown until next free character restoration. Displayed in undelete confirm message....
WorldPacket _worldPacket
Definition Packet.h:43
ByteBuffer & operator>>(ByteBuffer &data, ChrCustomizationChoice &customizationChoice)
ByteBuffer & operator<<(ByteBuffer &data, ChrCustomizationChoice const &customizationChoice)
UF::ChrCustomizationChoice ChrCustomizationChoice
STL namespace.
Array< ChrCustomizationChoice, 250 > Customizations
Array< ChrCustomizationChoice, 250 > const * Customizations
Array< ChrCustomizationChoice, 250 > Customizations
Array< ChrCustomizationChoice, 250 > Customizations
ObjectGuid CharacterGuid
User specified variables.
uint64 GuildClubMemberID
same as bgs.protocol.club.v1.MemberId.unique_id, guessed basing on SMSG_QUERY_PLAYER_NAME_RESPONSE (t...
Array< ChrCustomizationChoice, 250 > Customizations
Array< ChrCustomizationChoice, 250 > Unknown_1107_4
std::vector< WarbandGroupMember > Members
uint32 Flags
enum WarbandGroupFlags { Collapsed = 1 }