Core/Packets: converted SMSG_REQUEST_CEMETERY_LIST_RESPONSE and SMSG_RAID_GROUP_ONLY to packet class

This commit is contained in:
Ovahlord
2021-01-10 17:09:16 +01:00
parent f9f69bb0fe
commit 18cfca291b
8 changed files with 74 additions and 23 deletions

View File

@@ -22495,13 +22495,8 @@ void Player::UpdateHomebindTime(uint32 time)
if (m_InstanceValid || IsGameMaster())
{
if (m_HomebindTimer) // instance valid, but timer not reset
{
// hide reminder
WorldPacket data(SMSG_RAID_GROUP_ONLY, 4+4);
data << uint32(0);
data << uint32(0);
SendDirectMessage(&data);
}
SendRaidGroupOnlyMessage(RAID_GROUP_ERR_NONE, 0);
// instance is valid, reset homebind timer
m_HomebindTimer = 0;
}
@@ -22520,10 +22515,7 @@ void Player::UpdateHomebindTime(uint32 time)
// instance is invalid, start homebind timer
m_HomebindTimer = 60000;
// send message to player
WorldPacket data(SMSG_RAID_GROUP_ONLY, 4+4);
data << uint32(m_HomebindTimer);
data << uint32(1);
SendDirectMessage(&data);
SendRaidGroupOnlyMessage(RAID_GROUP_ERR_REQUIREMENTS_UNMATCH, m_HomebindTimer);
TC_LOG_DEBUG("maps", "Player::UpdateHomebindTime: Player '%s' (%s) will be teleported to homebind in 60 seconds",
GetName().c_str(), GetGUID().ToString().c_str());
}
@@ -28231,6 +28223,15 @@ void Player::SendSpellCategoryCooldowns() const
SendDirectMessage(cooldowns.Write());
}
void Player::SendRaidGroupOnlyMessage(RaidGroupReason reason, int32 delay) const
{
WorldPackets::Instance::RaidGroupOnly raidGroupOnly;
raidGroupOnly.Delay = delay;
raidGroupOnly.Reason = reason;
SendDirectMessage(raidGroupOnly.Write());
}
void Player::SetRestFlag(RestFlag restFlag, uint32 triggerId /*= 0*/)
{
uint32 oldRestMask = _restFlagMask;

View File

@@ -1614,6 +1614,7 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
uint32 GetReputation(uint32 factionentry) const;
std::string GetGuildName() const;
void SendSpellCategoryCooldowns() const;
void SendRaidGroupOnlyMessage(RaidGroupReason reason, int32 delay) const;
// Talents
uint32 GetFreeTalentPoints() const { return _talentMgr->FreeTalentPoints; }

View File

@@ -474,14 +474,14 @@ void WorldSession::HandleRequestCemeteryList(WorldPacket& /*recvPacket*/)
return;
}
WorldPacket data(SMSG_REQUEST_CEMETERY_LIST_RESPONSE, 4 + 4 * graveyardIds.size());
data.WriteBit(0); // Is MicroDungeon (WorldMapFrame.lua)
WorldPackets::Misc::RequestCemeteryListResponse packet;
packet.IsGossipTriggered = false;
packet.CemeteryID.reserve(graveyardIds.size());
data.WriteBits(graveyardIds.size(), 24);
for (uint32 id : graveyardIds)
data << id;
packet.CemeteryID.push_back(id);
SendPacket(&data);
SendPacket(packet.Write());
}
void WorldSession::HandleSetSelectionOpcode(WorldPacket& recvData)
@@ -718,11 +718,8 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recvData)
break;
case Map::CANNOT_ENTER_NOT_IN_RAID:
{
WorldPacket data(SMSG_RAID_GROUP_ONLY, 4 + 4);
data << uint32(0);
data << uint32(2); // You must be in a raid group to enter this instance.
player->SendDirectMessage(&data);
TC_LOG_DEBUG("maps", "MAP: Player '%s' must be in a raid group to enter instance map %d", player->GetName().c_str(), at->target_mapId);
player->SendRaidGroupOnlyMessage(RAID_GROUP_ERR_ONLY, 0);
reviveAtTrigger = true;
break;
}
@@ -988,13 +985,13 @@ void WorldSession::HandleSetActionBarToggles(WorldPacket& recvData)
void WorldSession::HandlePlayedTime(WorldPacket& recvData)
{
uint8 unk1;
recvData >> unk1; // 0 or 1 expected
uint8 TriggerScriptEvent;
recvData >> TriggerScriptEvent; // 0 or 1 expected
WorldPackets::Character::PlayedTime packet;
packet.TotalTime = _player->GetTotalPlayedTime();
packet.LevelTime = _player->GetLevelPlayedTime();
packet.TriggerEvent = bool(unk1); // 0 - will not show in chat frame
packet.TriggerEvent = bool(TriggerScriptEvent); // 0 - will not show in chat frame
SendPacket(packet.Write());
}

View File

@@ -4337,6 +4337,16 @@ enum class PursuingType : uint8
Max = 3
};
enum RaidGroupReason
{
RAID_GROUP_ERR_NONE = 0,
RAID_GROUP_ERR_LOWLEVEL = 1, // "You are too low level to enter this instance."
RAID_GROUP_ERR_ONLY = 2, // "You must be in a raid group to enter this instance."
RAID_GROUP_ERR_FULL = 3, // "The instance is full."
RAID_GROUP_ERR_REQUIREMENTS_UNMATCH = 4 // "You do not meet the requirements to enter this instance."
};
#define MAX_CREATURE_SPELL_DATA_SLOT 4
#endif

View File

@@ -88,3 +88,11 @@ WorldPacket const* WorldPackets::Instance::InstanceSaveCreated::Write()
return &_worldPacket;
}
WorldPacket const* WorldPackets::Instance::RaidGroupOnly::Write()
{
_worldPacket << int32(Delay);
_worldPacket << uint32(Reason);
return &_worldPacket;
}

View File

@@ -105,6 +105,17 @@ namespace WorldPackets
bool Gm = false;
};
class RaidGroupOnly final : public ServerPacket
{
public:
RaidGroupOnly() : ServerPacket(SMSG_RAID_GROUP_ONLY, 4 + 4) { }
WorldPacket const* Write() override;
uint32 Reason = 0;
int32 Delay = 0;
};
}
}

View File

@@ -465,3 +465,15 @@ WorldPacket const* WorldPackets::Misc::BinderConfirm::Write()
return &_worldPacket;
}
WorldPacket const* WorldPackets::Misc::RequestCemeteryListResponse::Write()
{
_worldPacket.WriteBit(IsGossipTriggered);
_worldPacket.WriteBits(CemeteryID.size(), 24);
_worldPacket.FlushBits();
for (uint32 cemetery : CemeteryID)
_worldPacket << cemetery;
return &_worldPacket;
}

View File

@@ -497,6 +497,17 @@ namespace WorldPackets
ObjectGuid Unit;
};
class RequestCemeteryListResponse final : public ServerPacket
{
public:
RequestCemeteryListResponse() : ServerPacket(SMSG_REQUEST_CEMETERY_LIST_RESPONSE, 1) { }
WorldPacket const* Write() override;
bool IsGossipTriggered = false;
std::vector<uint32> CemeteryID;
};
}
}