Core/PacketIO: Updated and enabled SMSG_RAID_INSTANCE_MESSAGE

This commit is contained in:
Shauren
2016-03-06 23:48:28 +01:00
parent ec62a02f57
commit 7b5d92926e
5 changed files with 55 additions and 12 deletions
+25 -11
View File
@@ -18144,6 +18144,20 @@ InstancePlayerBind* Player::GetBoundInstance(uint32 mapid, Difficulty difficulty
return nullptr;
}
InstancePlayerBind const* Player::GetBoundInstance(uint32 mapid, Difficulty difficulty) const
{
// some instances only have one difficulty
MapDifficultyEntry const* mapDiff = GetDownscaledMapDifficultyData(mapid, difficulty);
if (!mapDiff)
return nullptr;
auto itr = m_boundInstances[difficulty].find(mapid);
if (itr != m_boundInstances[difficulty].end())
return &itr->second;
return nullptr;
}
InstanceSave* Player::GetInstanceSave(uint32 mapid)
{
MapEntry const* mapEntry = sMapStore.LookupEntry(mapid);
@@ -22374,17 +22388,17 @@ void Player::SendInstanceResetWarning(uint32 mapid, Difficulty difficulty, uint3
else
type = RAID_INSTANCE_WARNING_MIN_SOON;
WorldPacket data(SMSG_RAID_INSTANCE_MESSAGE, 4+4+4+4);
data << uint32(type);
data << uint32(mapid);
data << uint32(difficulty); // difficulty
data << uint32(time);
if (type == RAID_INSTANCE_WELCOME)
{
data << uint8(0); // is locked
data << uint8(0); // is extended, ignored if prev field is 0
}
GetSession()->SendPacket(&data);
WorldPackets::Instance::RaidInstanceMessage raidInstanceMessage;
raidInstanceMessage.Type = type;
raidInstanceMessage.MapID = mapid;
raidInstanceMessage.DifficultyID = difficulty;
raidInstanceMessage.TimeLeft = int32(time);
if (InstancePlayerBind const* bind = GetBoundInstance(mapid, difficulty))
raidInstanceMessage.Locked = bind->perm;
else
raidInstanceMessage.Locked = false;
raidInstanceMessage.Extended = false;
GetSession()->SendPacket(raidInstanceMessage.Write());
}
void Player::ApplyEquipCooldown(Item* pItem)
+1
View File
@@ -2343,6 +2343,7 @@ class Player : public Unit, public GridObject<Player>
// permanent binds and solo binds by difficulty
BoundInstancesMap m_boundInstances[MAX_DIFFICULTY];
InstancePlayerBind* GetBoundInstance(uint32 mapid, Difficulty difficulty);
InstancePlayerBind const* GetBoundInstance(uint32 mapid, Difficulty difficulty) const;
BoundInstancesMap& GetBoundInstances(Difficulty difficulty) { return m_boundInstances[difficulty]; }
InstanceSave* GetInstanceSave(uint32 mapid);
void UnbindInstance(uint32 mapid, Difficulty difficulty, bool unload = false);
@@ -104,3 +104,16 @@ WorldPacket const* WorldPackets::Instance::PendingRaidLock::Write()
return &_worldPacket;
}
WorldPacket const* WorldPackets::Instance::RaidInstanceMessage::Write()
{
_worldPacket << uint8(Type);
_worldPacket << uint32(MapID);
_worldPacket << uint32(DifficultyID);
_worldPacket << int32(TimeLeft);
_worldPacket.WriteBit(Locked);
_worldPacket.WriteBit(Extended);
_worldPacket.FlushBits();
return &_worldPacket;
}
@@ -149,6 +149,21 @@ namespace WorldPackets
bool Extending = false;
bool WarningOnly = false;
};
class RaidInstanceMessage final : public ServerPacket
{
public:
RaidInstanceMessage() : ServerPacket(SMSG_RAID_INSTANCE_MESSAGE, 1 + 4 + 4 + 4 + 1) { }
WorldPacket const* Write() override;
uint8 Type = 0;
uint32 MapID = 0;
uint32 DifficultyID = 0;
int32 TimeLeft = 0;
bool Locked = false;
bool Extended = false;
};
}
}
+1 -1
View File
@@ -1499,7 +1499,7 @@ void OpcodeTable::Initialize()
DEFINE_SERVER_OPCODE_HANDLER(SMSG_RAF_EMAIL_ENABLED_RESPONSE, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_RAID_DIFFICULTY_SET, STATUS_NEVER, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_RAID_GROUP_ONLY, STATUS_NEVER, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_RAID_INSTANCE_MESSAGE, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_RAID_INSTANCE_MESSAGE, STATUS_NEVER, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_RAID_MARKERS_CHANGED, STATUS_NEVER, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_RANDOM_ROLL, STATUS_NEVER, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_RATED_BATTLEFIELD_INFO, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);