aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Entities/Player/Player.cpp36
-rw-r--r--src/server/game/Entities/Player/Player.h1
-rw-r--r--src/server/game/Server/Packets/InstancePackets.cpp13
-rw-r--r--src/server/game/Server/Packets/InstancePackets.h15
-rw-r--r--src/server/game/Server/Protocol/Opcodes.cpp2
5 files changed, 55 insertions, 12 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 59a4fcec8bb..60ae8d6b075 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -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)
diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h
index b5221a8cbc5..07d7c80a5e2 100644
--- a/src/server/game/Entities/Player/Player.h
+++ b/src/server/game/Entities/Player/Player.h
@@ -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);
diff --git a/src/server/game/Server/Packets/InstancePackets.cpp b/src/server/game/Server/Packets/InstancePackets.cpp
index 0b78c47faf0..2f5b8579a00 100644
--- a/src/server/game/Server/Packets/InstancePackets.cpp
+++ b/src/server/game/Server/Packets/InstancePackets.cpp
@@ -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;
+}
diff --git a/src/server/game/Server/Packets/InstancePackets.h b/src/server/game/Server/Packets/InstancePackets.h
index 72d168fc22b..0600c425058 100644
--- a/src/server/game/Server/Packets/InstancePackets.h
+++ b/src/server/game/Server/Packets/InstancePackets.h
@@ -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;
+ };
}
}
diff --git a/src/server/game/Server/Protocol/Opcodes.cpp b/src/server/game/Server/Protocol/Opcodes.cpp
index ff207de6a88..b61bfb91d4a 100644
--- a/src/server/game/Server/Protocol/Opcodes.cpp
+++ b/src/server/game/Server/Protocol/Opcodes.cpp
@@ -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);