mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-03-16 14:05:28 +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)
|
||||
|
||||
Reference in New Issue
Block a user