TrinityCore
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 CharacterPackets_h__
19#define CharacterPackets_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:
53
54 void Read() override { }
55 };
56
58 {
65 bool IsTrialBoost = false;
66 bool UseNPE = false;
67 std::string Name;
68
71 };
72
74 {
75 std::string NewName;
77 };
78
80 {
83 std::string CharName;
85 };
86
88 {
93 bool FactionChange = false;
94 std::string Name;
96 };
97
99 {
103
105 std::string Name;
106 };
107
109 {
115 };
116
118 {
119 public:
121 {
129 CharacterInfo(Field* fields);
130
133 std::string Name;
138 std::vector<ChrCustomizationChoice> Customizations;
148 bool FirstLogin = false;
155
159
160 bool BoostInProgress = false;
162
164 {
167 int32 SecondaryItemModifiedAppearanceID = 0; // also -1 is some special value
170 };
171
172 std::array<VisualItemInfo, 35> VisualItems = { };
173 std::vector<std::string> MailSenders;
174 std::vector<uint32> MailSenderTypes;
175 bool RpeResetAvailable = false;
178 };
179
181 {
183 bool HasExpansion = false;
184 bool HasAchievement = false;
185 bool HasHeritageArmor = false;
186 bool IsLocked = false;
187 };
188
190 {
193 };
194
196 {
197 enum
198 {
200 Level
201 };
202
205 };
206
208
209 WorldPacket const* Write() override;
210
211 bool Success = false;
212 bool IsDeletedCharacters = false;
215 bool IsNewPlayer = false;
217
220
221 std::vector<CharacterInfo> Characters;
222 std::vector<RaceUnlock> RaceUnlockData;
223 std::vector<UnlockedConditionalAppearance> UnlockedConditionalAppearances;
224 std::vector<RaceLimitDisableInfo> RaceLimitDisables;
225 };
226
228 {
229 public:
231
232 void Read() override;
233
235 std::string Name;
236 };
237
239 {
240 public:
242 SequenceIndex(sequenceIndex), Result(result)
243 {
244 }
245
246 WorldPacket const* Write() override;
247
250 };
251
252 class CreateCharacter final : public ClientPacket
253 {
254 public:
256
257 void Read() override;
258
272 std::shared_ptr<CharacterCreateInfo> CreateInfo;
273 };
274
275 class CreateChar final : public ServerPacket
276 {
277 public:
279
280 WorldPacket const* Write() override;
281
284 };
285
286 class CharDelete final : public ClientPacket
287 {
288 public:
290
291 void Read() override;
292
294 };
295
296 class DeleteChar final : public ServerPacket
297 {
298 public:
300
301 WorldPacket const* Write() override;
302
304 };
305
307 {
308 public:
310
311 void Read() override;
312
317 std::shared_ptr<CharacterRenameInfo> RenameInfo;
318 };
319
321 {
322 public:
324
325 WorldPacket const* Write() override;
326
327 std::string Name;
330 };
331
332 class CharCustomize final : public ClientPacket
333 {
334 public:
336
337 void Read() override;
338
349 std::shared_ptr<CharCustomizeInfo> CustomizeInfo;
350 };
351
353
355 {
356 public:
358
359 void Read() override;
360
373 std::shared_ptr<CharRaceOrFactionChangeInfo> RaceOrFactionChangeInfo;
374 };
375
377 {
378 std::string Name;
382 };
383
385 {
386 public:
388
389 WorldPacket const* Write() override;
390
394 };
395
397 {
398 public:
400
401 void Read() override;
402
405 };
406
408 {
409 public:
411
412 WorldPacket const* Write() override;
413
414 std::string Name;
415 bool Success = false;
416 };
417
418 class ReorderCharacters final : public ClientPacket
419 {
420 public:
422 {
425 };
426
428
429 void Read() override;
430
432 };
433
434 class UndeleteCharacter final : public ClientPacket
435 {
436 public:
438
439 void Read() override;
440
445 std::shared_ptr<CharacterUndeleteInfo> UndeleteInfo;
446 };
447
449 {
450 public:
452
453 WorldPacket const* Write() override;
454
461 };
462
464 {
465 public:
467
468 void Read() override { }
469 };
470
472 {
473 public:
475
476 WorldPacket const* Write() override;
477
478 bool OnCooldown = false;
481 };
482
483 class PlayerLogin final : public ClientPacket
484 {
485 public:
487
488 void Read() override;
489
491 float FarClip = 0.0f;
492 };
493
494 class LoginVerifyWorld final : public ServerPacket
495 {
496 public:
498
499 WorldPacket const* Write() override;
500
504 };
505
507 {
508 Failed = 0,
509 NoWorld = 1,
511 NoInstances = 3,
512 Disabled = 4,
513 NoCharacter = 5,
515 LockedByBilling = 7,
517 TemporaryGMLock = 9,
523 };
524
526 {
527 public:
529
530 WorldPacket const* Write() override;
531
533 };
534
535 class LogoutRequest final : public ClientPacket
536 {
537 public:
539
540 void Read() override;
541
542 bool IdleLogout = false;
543 };
544
545 class LogoutResponse final : public ServerPacket
546 {
547 public:
549
550 WorldPacket const* Write() override;
551
553 bool Instant = false;
554 };
555
556 class LogoutComplete final : public ServerPacket
557 {
558 public:
560
561 WorldPacket const* Write() override { return &_worldPacket; }
562 };
563
564 class LogoutCancel final : public ClientPacket
565 {
566 public:
568
569 void Read() override { }
570 };
571
572 class LogoutCancelAck final : public ServerPacket
573 {
574 public:
576
577 WorldPacket const* Write() override { return &_worldPacket; }
578 };
579
581 {
582 public:
584
585 void Read() override;
586
588 bool Showing = false;
589 };
590
591 class InitialSetup final : public ServerPacket
592 {
593 public:
595
596 WorldPacket const* Write() override;
597
600 };
601
603 {
604 public:
606
607 void Read() override;
608
610 };
611
612 class RequestPlayedTime final : public ClientPacket
613 {
614 public:
616
617 void Read() override;
618
619 bool TriggerScriptEvent = false;
620 };
621
622 class PlayedTime final : public ServerPacket
623 {
624 public:
626
627 WorldPacket const* Write() override;
628
631 bool TriggerEvent = false;
632 };
633
634 class SetTitle final : public ClientPacket
635 {
636 public:
637 SetTitle(WorldPacket&& packet) : ClientPacket(CMSG_SET_TITLE, std::move(packet)) { }
638
639 void Read() override;
640
642 };
643
644 class AlterApperance final : public ClientPacket
645 {
646 public:
648
649 void Read() override;
650
655 };
656
657 class BarberShopResult final : public ServerPacket
658 {
659 public:
660 enum class ResultEnum : uint8
661 {
662 Success = 0,
663 NoMoney = 1,
664 NotOnChair = 2,
665 NoMoney2 = 3
666 };
667
669
670 WorldPacket const* Write() override;
671
673 };
674
675 class LogXPGain final : public ServerPacket
676 {
677 public:
678 LogXPGain() : ServerPacket(SMSG_LOG_XP_GAIN, 16 + 4 + 1 + 4 + 4) { }
679
680 WorldPacket const* Write() override;
681
686 float GroupBonus = 0.0f;
687 };
688
689 class TitleEarned final : public ServerPacket
690 {
691 public:
692 TitleEarned(OpcodeServer opcode) : ServerPacket(opcode, 4) { }
693
694 WorldPacket const* Write() override;
695
697 };
698
699 class SetFactionAtWar final : public ClientPacket
700 {
701 public:
703
704 void Read() override;
705
707 };
708
709 class SetFactionNotAtWar final : public ClientPacket
710 {
711 public:
713
714 void Read() override;
715
717 };
718
719 class SetFactionInactive final : public ClientPacket
720 {
721 public:
723
724 void Read() override;
725
727 bool State = false;
728 };
729
730 class SetWatchedFaction final : public ClientPacket
731 {
732 public:
734
735 void Read() override;
736
738 };
739
741 {
742 public:
744
745 WorldPacket const* Write() override;
746
748 };
749
751 {
752 public:
753 CharCustomizeSuccess(CharCustomizeInfo const* customizeInfo);
754
755 WorldPacket const* Write() override;
756
758 std::string CharName;
761 };
762
764 {
765 public:
767
768 WorldPacket const* Write() override;
769
772 };
773
775 {
776 public:
778
779 void Read() override;
780
783 };
784
786 {
787 public:
789
790 WorldPacket const* Write() override;
791
794 };
795
796 class SavePersonalEmblem final : public ClientPacket
797 {
798 public:
800
801 void Read() override;
802
805 };
806
808 {
809 public:
811
812 WorldPacket const* Write() override;
813
815 };
816 }
817}
818
819#endif // CharacterPackets_h__
uint8_t uint8
Definition: Define.h:144
int32_t int32
Definition: Define.h:138
uint64_t uint64
Definition: Define.h:141
uint16_t uint16
Definition: Define.h:143
uint32_t uint32
Definition: Define.h:142
std::optional< T > Optional
Optional helper class to wrap optional values within.
Definition: Optional.h:25
@ RACE_NONE
Definition: RaceMask.h:27
@ CLASS_NONE
@ GENDER_NONE
Class used to access individual fields of database query result.
Definition: Field.h:90
Array< ChrCustomizationChoice, 250 > Customizations
WorldPacket const * Write() override
Array< ChrCustomizationChoice, 250 > const & Customizations
CharCustomizeSuccess(CharCustomizeInfo const *customizeInfo)
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
bool IsNewPlayerRestrictionSkipped
allows client to skip new player restrictions
std::vector< CharacterInfo > Characters
all characters on the list
bool IsNewPlayer
forbids hero classes and allied races
bool IsDeletedCharacters
used for character undelete list
bool IsNewPlayerRestricted
forbids using level boost and class trials
std::vector< RaceLimitDisableInfo > RaceLimitDisables
std::vector< UnlockedConditionalAppearance > UnlockedConditionalAppearances
WorldPacket const * Write() override
WorldPacket const * Write() override
TaggedPosition< Position::XYZO > Pos
WorldPacket const * Write() override
WorldPacket const * Write() override
WorldPacket const * Write() override
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
OpcodeServer
Definition: Opcodes.h:901
@ CMSG_GET_UNDELETE_CHARACTER_COOLDOWN_STATUS
Definition: Opcodes.h:383
@ CMSG_LOGOUT_REQUEST
Definition: Opcodes.h:473
@ CMSG_SET_WATCHED_FACTION
Definition: Opcodes.h:806
@ CMSG_SET_FACTION_AT_WAR
Definition: Opcodes.h:779
@ CMSG_LOADING_SCREEN_NOTIFY
Definition: Opcodes.h:469
@ CMSG_SET_FACTION_INACTIVE
Definition: Opcodes.h:780
@ CMSG_GENERATE_RANDOM_CHARACTER_NAME
Definition: Opcodes.h:372
@ CMSG_SET_ACTION_BAR_TOGGLES
Definition: Opcodes.h:764
@ CMSG_SET_TITLE
Definition: Opcodes.h:800
@ CMSG_SET_FACTION_NOT_AT_WAR
Definition: Opcodes.h:781
@ CMSG_UNDELETE_CHARACTER
Definition: Opcodes.h:865
@ CMSG_CHECK_CHARACTER_NAME_AVAILABILITY
Definition: Opcodes.h:234
@ CMSG_CHAR_DELETE
Definition: Opcodes.h:195
@ CMSG_CHAR_RACE_OR_FACTION_CHANGE
Definition: Opcodes.h:196
@ CMSG_SET_PLAYER_DECLINED_NAMES
Definition: Opcodes.h:789
@ CMSG_CHAR_CUSTOMIZE
Definition: Opcodes.h:194
@ CMSG_SAVE_PERSONAL_EMBLEM
Definition: Opcodes.h:749
@ CMSG_CHARACTER_RENAME_REQUEST
Definition: Opcodes.h:191
@ CMSG_REQUEST_PLAYED_TIME
Definition: Opcodes.h:725
@ CMSG_ALTER_APPEARANCE
Definition: Opcodes.h:65
@ CMSG_LOGOUT_CANCEL
Definition: Opcodes.h:471
@ CMSG_PLAYER_LOGIN
Definition: Opcodes.h:634
@ CMSG_CREATE_CHARACTER
Definition: Opcodes.h:306
@ SMSG_SET_FACTION_VISIBLE
Definition: Opcodes.h:1912
@ SMSG_PLAYER_SAVE_PERSONAL_EMBLEM
Definition: Opcodes.h:1738
@ SMSG_SET_PLAYER_DECLINED_NAMES_RESULT
Definition: Opcodes.h:1922
@ SMSG_UNDELETE_COOLDOWN_STATUS_RESPONSE
Definition: Opcodes.h:2019
@ SMSG_LOGOUT_RESPONSE
Definition: Opcodes.h:1515
@ SMSG_SET_FACTION_NOT_VISIBLE
Definition: Opcodes.h:1910
@ SMSG_INITIAL_SETUP
Definition: Opcodes.h:1427
@ SMSG_CHAR_FACTION_CHANGE_RESULT
Definition: Opcodes.h:1105
@ SMSG_CHAR_CUSTOMIZE_FAILURE
Definition: Opcodes.h:1103
@ SMSG_CREATE_CHAR
Definition: Opcodes.h:1184
@ SMSG_LOGOUT_COMPLETE
Definition: Opcodes.h:1514
@ SMSG_GENERATE_RANDOM_CHARACTER_NAME_RESULT
Definition: Opcodes.h:1338
@ SMSG_CHARACTER_LOGIN_FAILED
Definition: Opcodes.h:1096
@ SMSG_LOGIN_VERIFY_WORLD
Definition: Opcodes.h:1512
@ SMSG_UNDELETE_CHARACTER_RESPONSE
Definition: Opcodes.h:2018
@ SMSG_BARBER_SHOP_RESULT
Definition: Opcodes.h:984
@ SMSG_CHECK_CHARACTER_NAME_AVAILABILITY_RESULT
Definition: Opcodes.h:1121
@ SMSG_LOG_XP_GAIN
Definition: Opcodes.h:1516
@ SMSG_ENUM_CHARACTERS_RESULT
Definition: Opcodes.h:1231
@ SMSG_CHARACTER_RENAME_RESULT
Definition: Opcodes.h:1098
@ SMSG_LOGOUT_CANCEL_ACK
Definition: Opcodes.h:1513
@ SMSG_DELETE_CHAR
Definition: Opcodes.h:1197
@ SMSG_PLAYED_TIME
Definition: Opcodes.h:1725
Definition: Object.h:109
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.
CharacterInfo(Field *fields)
Initialize the struct with values from QueryResult.
uint64 GuildClubMemberID
same as bgs.protocol.club.v1.MemberId.unique_id, guessed basing on SMSG_QUERY_PLAYER_NAME_RESPONSE (t...