mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-20 01:15:35 +01:00
Core/Spells: restored accidentally dropped spell cast target limit to fix client crashes when hitting more than 255 targets with a single spell
This commit is contained in:
@@ -121,7 +121,21 @@ ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Spells::SpellCastData con
|
||||
data << uint32(spellCastData.CastTime);
|
||||
|
||||
if (spellCastData.HitInfo)
|
||||
{
|
||||
// Hit and miss target counts are both uint8, that limits us to 255 targets for each
|
||||
// sending more than 255 targets crashes the client (since count sent would be wrong)
|
||||
// Spells like 40647 (with a huge radius) can easily reach this limit (spell might need
|
||||
// target conditions but we still need to limit the number of targets sent and keeping
|
||||
// correct count for both hit and miss).
|
||||
static std::size_t const PACKET_TARGET_LIMIT = std::numeric_limits<uint8>::max();
|
||||
if (spellCastData.HitInfo->HitTargets.size() > PACKET_TARGET_LIMIT)
|
||||
spellCastData.HitInfo->HitTargets.resize(PACKET_TARGET_LIMIT);
|
||||
|
||||
if (spellCastData.HitInfo->MissStatus.size() > PACKET_TARGET_LIMIT)
|
||||
spellCastData.HitInfo->MissStatus.resize(PACKET_TARGET_LIMIT);
|
||||
|
||||
data << *spellCastData.HitInfo;
|
||||
}
|
||||
|
||||
data << spellCastData.Target;
|
||||
|
||||
|
||||
@@ -109,7 +109,7 @@ namespace WorldPackets
|
||||
uint32 CastFlagsEx = 0;
|
||||
uint32 CastTime = 0;
|
||||
SpellTargetData Target;
|
||||
Optional<SpellHitInfo> HitInfo;
|
||||
mutable Optional<SpellHitInfo> HitInfo;
|
||||
Optional<uint8> DestLocSpellCastIndex;
|
||||
Optional<SpellHealPrediction> Predict;
|
||||
Optional<CreatureImmunities> Immunities;
|
||||
|
||||
Reference in New Issue
Block a user