[10709] Prevent wrongly use transport guid as unittarget in spell targets

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
zergtmn 2010-11-09 06:11:21 +03:00 committed by VladimirMangos
parent 050eb8cf5f
commit 6c1dd50511
4 changed files with 19 additions and 23 deletions

View file

@ -403,8 +403,8 @@ enum SpellCastTargetFlags
TARGET_FLAG_UNUSED2 = 0x00000004, // not used in any spells as of 3.0.3 (can be set dynamically)
TARGET_FLAG_UNUSED3 = 0x00000008, // not used in any spells as of 3.0.3 (can be set dynamically)
TARGET_FLAG_ITEM = 0x00000010, // pguid
TARGET_FLAG_SOURCE_LOCATION = 0x00000020, // 3 float
TARGET_FLAG_DEST_LOCATION = 0x00000040, // 3 float
TARGET_FLAG_SOURCE_LOCATION = 0x00000020, // pguid + 3 float
TARGET_FLAG_DEST_LOCATION = 0x00000040, // pguid + 3 float
TARGET_FLAG_OBJECT_UNK = 0x00000080, // used in 7 spells only
TARGET_FLAG_UNIT_UNK = 0x00000100, // looks like self target (480 spells)
TARGET_FLAG_PVP_CORPSE = 0x00000200, // pguid

View file

@ -113,10 +113,6 @@ SpellCastTargets::SpellCastTargets()
m_itemTarget = NULL;
m_GOTarget = NULL;
m_unitTargetGUID = 0;
m_GOTargetGUID = 0;
m_CorpseTargetGUID = 0;
m_itemTargetGUID = 0;
m_itemTargetEntry = 0;
m_srcX = m_srcY = m_srcZ = m_destX = m_destY = m_destZ = 0.0f;
@ -244,7 +240,7 @@ void SpellCastTargets::read( ByteBuffer& data, Unit *caster )
if (m_targetMask & TARGET_FLAG_SOURCE_LOCATION)
{
data >> m_unitTargetGUID.ReadAsPacked();
data >> m_srcTransportGUID.ReadAsPacked();
data >> m_srcX >> m_srcY >> m_srcZ;
if(!MaNGOS::IsValidMapCoord(m_srcX, m_srcY, m_srcZ))
throw ByteBufferException(false, data.rpos(), 0, data.size());
@ -252,7 +248,7 @@ void SpellCastTargets::read( ByteBuffer& data, Unit *caster )
if (m_targetMask & TARGET_FLAG_DEST_LOCATION)
{
data >> m_unitTargetGUID.ReadAsPacked();
data >> m_destTransportGUID.ReadAsPacked();
data >> m_destX >> m_destY >> m_destZ;
if(!MaNGOS::IsValidMapCoord(m_destX, m_destY, m_destZ))
throw ByteBufferException(false, data.rpos(), 0, data.size());
@ -301,17 +297,13 @@ void SpellCastTargets::write( ByteBuffer& data ) const
if (m_targetMask & TARGET_FLAG_SOURCE_LOCATION)
{
if(m_unitTarget)
data << m_unitTarget->GetPackGUID();
else
data << uint8(0);
data << m_srcTransportGUID.WriteAsPacked();
data << m_srcX << m_srcY << m_srcZ;
}
if (m_targetMask & TARGET_FLAG_DEST_LOCATION)
{
data << uint8(0); // no known cases with target pguid
data << m_destTransportGUID.WriteAsPacked();
data << m_destX << m_destY << m_destZ;
}

View file

@ -115,6 +115,8 @@ class SpellCastTargets
m_GOTargetGUID = target.m_GOTargetGUID;
m_CorpseTargetGUID = target.m_CorpseTargetGUID;
m_itemTargetGUID = target.m_itemTargetGUID;
m_srcTransportGUID = target.m_srcTransportGUID;
m_destTransportGUID = target.m_destTransportGUID;
m_itemTargetEntry = target.m_itemTargetEntry;
@ -179,6 +181,8 @@ class SpellCastTargets
ObjectGuid m_GOTargetGUID;
ObjectGuid m_CorpseTargetGUID;
ObjectGuid m_itemTargetGUID;
ObjectGuid m_srcTransportGUID;
ObjectGuid m_destTransportGUID;
uint32 m_itemTargetEntry;
};

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "10708"
#define REVISION_NR "10709"
#endif // __REVISION_NR_H__