mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-13 01:08:35 +00:00
refactor(Core/Packets): Rewrite various calendar and complaint packets to modern class. (#22884)
This commit is contained in:
@@ -35,6 +35,7 @@ Copied events should probably have a new owner
|
||||
|
||||
#include "ArenaTeamMgr.h"
|
||||
#include "CalendarMgr.h"
|
||||
#include "CalendarPackets.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "DisableMgr.h"
|
||||
#include "GameEventMgr.h"
|
||||
@@ -184,43 +185,31 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recvData*/)
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
void WorldSession::HandleCalendarGetEvent(WorldPacket& recvData)
|
||||
void WorldSession::HandleCalendarGetEvent(WorldPackets::Calendar::GetEvent& packet)
|
||||
{
|
||||
uint64 eventId;
|
||||
recvData >> eventId;
|
||||
LOG_DEBUG("network", "CMSG_CALENDAR_GET_EVENT. Player [{}] Event [{}]", _player->GetGUID().ToString(), packet.EventId);
|
||||
|
||||
LOG_DEBUG("network", "CMSG_CALENDAR_GET_EVENT. Player [{}] Event [{}]", _player->GetGUID().ToString(), eventId);
|
||||
|
||||
if (CalendarEvent* calendarEvent = sCalendarMgr->GetEvent(eventId))
|
||||
if (CalendarEvent* calendarEvent = sCalendarMgr->GetEvent(packet.EventId))
|
||||
sCalendarMgr->SendCalendarEvent(_player->GetGUID(), *calendarEvent, CALENDAR_SENDTYPE_GET);
|
||||
else
|
||||
sCalendarMgr->SendCalendarCommandResult(_player->GetGUID(), CALENDAR_ERROR_EVENT_INVALID);
|
||||
}
|
||||
|
||||
void WorldSession::HandleCalendarGuildFilter(WorldPacket& recvData)
|
||||
void WorldSession::HandleCalendarGuildFilter(WorldPackets::Calendar::GuildFilter& packet)
|
||||
{
|
||||
LOG_DEBUG("network", "CMSG_CALENDAR_GUILD_FILTER [{}]", _player->GetGUID().ToString());
|
||||
|
||||
uint32 minLevel;
|
||||
uint32 maxLevel;
|
||||
uint32 minRank;
|
||||
|
||||
recvData >> minLevel >> maxLevel >> minRank;
|
||||
|
||||
if (Guild* guild = sGuildMgr->GetGuildById(_player->GetGuildId()))
|
||||
guild->MassInviteToEvent(this, minLevel, maxLevel, minRank);
|
||||
guild->MassInviteToEvent(this, packet.MinimumLevel, packet.MaximumLevel, packet.MinimumRank);
|
||||
|
||||
LOG_DEBUG("network", "CMSG_CALENDAR_GUILD_FILTER: Min level [{}], Max level [{}], Min rank [{}]", minLevel, maxLevel, minRank);
|
||||
LOG_DEBUG("network", "CMSG_CALENDAR_GUILD_FILTER: Min level [{}], Max level [{}], Min rank [{}]", packet.MinimumLevel, packet.MaximumLevel, packet.MinimumRank);
|
||||
}
|
||||
|
||||
void WorldSession::HandleCalendarArenaTeam(WorldPacket& recvData)
|
||||
void WorldSession::HandleCalendarArenaTeam(WorldPackets::Calendar::ArenaTeam& packet)
|
||||
{
|
||||
LOG_DEBUG("network", "CMSG_CALENDAR_ARENA_TEAM [{}]", _player->GetGUID().ToString());
|
||||
|
||||
uint32 arenaTeamId;
|
||||
recvData >> arenaTeamId;
|
||||
|
||||
if (ArenaTeam* team = sArenaTeamMgr->GetArenaTeamById(arenaTeamId))
|
||||
if (ArenaTeam* team = sArenaTeamMgr->GetArenaTeamById(packet.ArenaTeamId))
|
||||
team->MassInviteToEvent(this);
|
||||
}
|
||||
|
||||
@@ -763,14 +752,11 @@ void WorldSession::HandleCalendarEventModeratorStatus(WorldPacket& recvData)
|
||||
sCalendarMgr->SendCalendarCommandResult(guid, CALENDAR_ERROR_EVENT_INVALID);
|
||||
}
|
||||
|
||||
void WorldSession::HandleCalendarComplain(WorldPacket& recvData)
|
||||
void WorldSession::HandleCalendarComplain(WorldPackets::Calendar::CalendarComplain& packet)
|
||||
{
|
||||
ObjectGuid guid = _player->GetGUID();
|
||||
uint64 eventId;
|
||||
ObjectGuid complainGUID;
|
||||
|
||||
recvData >> eventId >> complainGUID;
|
||||
LOG_DEBUG("network", "CMSG_CALENDAR_COMPLAIN [{}] EventId [{}] guid [{}]", guid.ToString(), eventId, complainGUID.ToString());
|
||||
LOG_DEBUG("network", "CMSG_CALENDAR_COMPLAIN [{}] EventId [{}] guid [{}]", guid.ToString(), packet.EventId, packet.ComplainGuid.ToString());
|
||||
|
||||
// what to do with complains?
|
||||
}
|
||||
|
||||
@@ -1138,45 +1138,18 @@ void WorldSession::HandleWhoisOpcode(WorldPacket& recv_data)
|
||||
LOG_DEBUG("network", "Received whois command from player {} for character {}", GetPlayer()->GetName(), charname);
|
||||
}
|
||||
|
||||
void WorldSession::HandleComplainOpcode(WorldPacket& recv_data)
|
||||
void WorldSession::HandleComplainOpcode(WorldPackets::Misc::Complain& packet)
|
||||
{
|
||||
LOG_DEBUG("network", "WORLD: CMSG_COMPLAIN");
|
||||
|
||||
uint8 spam_type; // 0 - mail, 1 - chat
|
||||
ObjectGuid spammer_guid;
|
||||
uint32 unk1 = 0;
|
||||
uint32 unk2 = 0;
|
||||
uint32 unk3 = 0;
|
||||
uint32 unk4 = 0;
|
||||
std::string description = "";
|
||||
recv_data >> spam_type; // unk 0x01 const, may be spam type (mail/chat)
|
||||
recv_data >> spammer_guid; // player guid
|
||||
switch (spam_type)
|
||||
{
|
||||
case 0:
|
||||
recv_data >> unk1; // const 0
|
||||
recv_data >> unk2; // probably mail id
|
||||
recv_data >> unk3; // const 0
|
||||
break;
|
||||
case 1:
|
||||
recv_data >> unk1; // probably language
|
||||
recv_data >> unk2; // message type?
|
||||
recv_data >> unk3; // probably channel id
|
||||
recv_data >> unk4; // unk random value
|
||||
recv_data >> description; // spam description string (messagetype, channel name, player name, message)
|
||||
break;
|
||||
}
|
||||
|
||||
// NOTE: all chat messages from this spammer automatically ignored by spam reporter until logout in case chat spam.
|
||||
// if it's mail spam - ALL mails from this spammer automatically removed by client
|
||||
|
||||
// Complaint Received message
|
||||
WorldPacket data(SMSG_COMPLAIN_RESULT, 1);
|
||||
data << uint8(0);
|
||||
SendPacket(&data);
|
||||
SendPacket(WorldPackets::Misc::ComplainResult().Write());
|
||||
|
||||
LOG_DEBUG("network", "REPORT SPAM: type {}, {}, unk1 {}, unk2 {}, unk3 {}, unk4 {}, message {}",
|
||||
spam_type, spammer_guid.ToString(), unk1, unk2, unk3, unk4, description);
|
||||
packet.SpamType, packet.SpammerGuid.ToString(), packet.Unk1, packet.Unk2, packet.Unk3, packet.Unk4, packet.Description);
|
||||
}
|
||||
|
||||
void WorldSession::HandleRealmSplitOpcode(WorldPacket& recv_data)
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#define AllPackets_h__
|
||||
|
||||
#include "BankPackets.h"
|
||||
#include "CalendarPackets.h"
|
||||
#include "CharacterPackets.h"
|
||||
#include "ChatPackets.h"
|
||||
#include "CombatLogPackets.h"
|
||||
|
||||
41
src/server/game/Server/Packets/CalendarPackets.cpp
Normal file
41
src/server/game/Server/Packets/CalendarPackets.cpp
Normal 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;
|
||||
}
|
||||
73
src/server/game/Server/Packets/CalendarPackets.h
Normal file
73
src/server/game/Server/Packets/CalendarPackets.h
Normal 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__
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -150,6 +150,7 @@ namespace WorldPackets
|
||||
{
|
||||
class MinimapPingClient;
|
||||
class RandomRollClient;
|
||||
class Complain;
|
||||
}
|
||||
|
||||
namespace Pet
|
||||
@@ -189,6 +190,14 @@ namespace WorldPackets
|
||||
class ItemRefundInfo;
|
||||
class ItemRefund;
|
||||
}
|
||||
|
||||
namespace Calendar
|
||||
{
|
||||
class GetEvent;
|
||||
class GuildFilter;
|
||||
class ArenaTeam;
|
||||
class CalendarComplain;
|
||||
}
|
||||
}
|
||||
|
||||
enum AccountDataType
|
||||
@@ -1036,7 +1045,7 @@ public: // opcodes handlers
|
||||
void HandleAreaSpiritHealerQueueOpcode(WorldPacket& recvData);
|
||||
void HandleCancelMountAuraOpcode(WorldPacket& recvData);
|
||||
void HandleSelfResOpcode(WorldPacket& recvData);
|
||||
void HandleComplainOpcode(WorldPacket& recvData);
|
||||
void HandleComplainOpcode(WorldPackets::Misc::Complain& packet);
|
||||
void HandleRequestPetInfo(WorldPackets::Pet::RequestPetInfo& packet);
|
||||
|
||||
// Socket gem
|
||||
@@ -1073,9 +1082,9 @@ public: // opcodes handlers
|
||||
|
||||
// Calendar
|
||||
void HandleCalendarGetCalendar(WorldPacket& recvData);
|
||||
void HandleCalendarGetEvent(WorldPacket& recvData);
|
||||
void HandleCalendarGuildFilter(WorldPacket& recvData);
|
||||
void HandleCalendarArenaTeam(WorldPacket& recvData);
|
||||
void HandleCalendarGetEvent(WorldPackets::Calendar::GetEvent& packet);
|
||||
void HandleCalendarGuildFilter(WorldPackets::Calendar::GuildFilter& packet);
|
||||
void HandleCalendarArenaTeam(WorldPackets::Calendar::ArenaTeam& packet);
|
||||
void HandleCalendarAddEvent(WorldPacket& recvData);
|
||||
void HandleCalendarUpdateEvent(WorldPacket& recvData);
|
||||
void HandleCalendarRemoveEvent(WorldPacket& recvData);
|
||||
@@ -1085,7 +1094,7 @@ public: // opcodes handlers
|
||||
void HandleCalendarEventRemoveInvite(WorldPacket& recvData);
|
||||
void HandleCalendarEventStatus(WorldPacket& recvData);
|
||||
void HandleCalendarEventModeratorStatus(WorldPacket& recvData);
|
||||
void HandleCalendarComplain(WorldPacket& recvData);
|
||||
void HandleCalendarComplain(WorldPackets::Calendar::CalendarComplain& packet);
|
||||
void HandleCalendarGetNumPending(WorldPacket& recvData);
|
||||
void HandleCalendarEventSignup(WorldPacket& recvData);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user