refactor(Core/Packets): Rewrite various calendar and complaint packets to modern class. (#22884)

This commit is contained in:
Benjamin Jackson
2025-10-10 01:02:00 -04:00
committed by GitHub
parent cc6a256307
commit f670387ad4
8 changed files with 197 additions and 60 deletions

View File

@@ -19,6 +19,7 @@
#define AllPackets_h__
#include "BankPackets.h"
#include "CalendarPackets.h"
#include "CharacterPackets.h"
#include "ChatPackets.h"
#include "CombatLogPackets.h"

View File

@@ -0,0 +1,41 @@
/*
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by the
* Free Software Foundation; either version 3 of the License, or (at your
* option) any later version.
*
* This program 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 Affero General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "CalendarPackets.h"
void WorldPackets::Calendar::GetEvent::Read()
{
_worldPacket >> EventId;
}
void WorldPackets::Calendar::GuildFilter::Read()
{
_worldPacket >> MinimumLevel;
_worldPacket >> MaximumLevel;
_worldPacket >> MinimumRank;
}
void WorldPackets::Calendar::ArenaTeam::Read()
{
_worldPacket >> ArenaTeamId;
}
void WorldPackets::Calendar::CalendarComplain::Read()
{
_worldPacket >> EventId;
_worldPacket >> ComplainGuid;
}

View File

@@ -0,0 +1,73 @@
/*
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by the
* Free Software Foundation; either version 3 of the License, or (at your
* option) any later version.
*
* This program 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 Affero General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef CalendarPackets_h__
#define CalendarPackets_h__
#include "Guild.h"
#include "Packet.h"
namespace WorldPackets
{
namespace Calendar
{
class GetEvent final : public ClientPacket
{
public:
GetEvent(WorldPacket&& packet) : ClientPacket(CMSG_CALENDAR_GET_EVENT, std::move(packet)) {}
void Read() override;
uint64 EventId = 0;
};
class GuildFilter final : public ClientPacket
{
public:
GuildFilter(WorldPacket&& packet) : ClientPacket(CMSG_CALENDAR_GUILD_FILTER, std::move(packet)) {}
void Read() override;
uint32 MinimumLevel = 1;
uint32 MaximumLevel = 1;
uint32 MinimumRank = GR_GUILDMASTER;
};
class ArenaTeam final : public ClientPacket
{
public:
ArenaTeam(WorldPacket&& packet) : ClientPacket(CMSG_CALENDAR_ARENA_TEAM, std::move(packet)) {}
void Read() override;
uint32 ArenaTeamId = 0;
};
class CalendarComplain final : public ClientPacket
{
public:
CalendarComplain(WorldPacket&& packet) : ClientPacket(CMSG_CALENDAR_COMPLAIN, std::move(packet)) {}
void Read() override;
uint64 EventId = 0;
ObjectGuid ComplainGuid;
};
}
}
#endif // CalendarPackets_h__

View File

@@ -140,3 +140,31 @@ WorldPacket const* WorldPackets::Misc::UITime::Write()
return &_worldPacket;
}
void WorldPackets::Misc::Complain::Read()
{
_worldPacket >> SpamType; // 0 - mail, 1 - chat
_worldPacket >> SpammerGuid;
switch (SpamType)
{
case 0:
_worldPacket >> Unk1; // const 0
_worldPacket >> Unk2; // probably mail id
_worldPacket >> Unk3; // const 0
break;
case 1:
_worldPacket >> Unk1; // probably language
_worldPacket >> Unk2; // message type?
_worldPacket >> Unk3; // probably channel id
_worldPacket >> Unk4; // unk random value
_worldPacket >> Description; // spam description string (messagetype, channel name, player name, message)
break;
}
}
WorldPacket const* WorldPackets::Misc::ComplainResult::Write()
{
_worldPacket << Unk;
return &_worldPacket;
}

View File

@@ -210,6 +210,32 @@ namespace WorldPackets
uint32 Time = 0;
};
class Complain final : public ClientPacket
{
public:
Complain(WorldPacket&& packet) : ClientPacket(CMSG_COMPLAIN, std::move(packet)) {}
void Read() override;
uint8 SpamType = 0; // 0 - mail, 1 - chat
ObjectGuid SpammerGuid;
uint32 Unk1 = 0;
uint32 Unk2 = 0;
uint32 Unk3 = 0;
uint32 Unk4 = 0;
std::string Description = "";
};
class ComplainResult final : public ServerPacket
{
public:
ComplainResult() : ServerPacket(SMSG_COMPLAIN_RESULT, 1) {}
WorldPacket const* Write() override;
uint8 Unk = 0;
};
}
}