Fixed a crash
This commit is contained in:
@@ -1491,7 +1491,7 @@ namespace Game.Networking.Packets
|
||||
public AuraDataInfo AuraData;
|
||||
}
|
||||
|
||||
public struct TargetLocation
|
||||
public class TargetLocation
|
||||
{
|
||||
public ObjectGuid Transport;
|
||||
public Position Location;
|
||||
@@ -1533,11 +1533,11 @@ namespace Game.Networking.Packets
|
||||
Unit = data.ReadPackedGuid();
|
||||
Item = data.ReadPackedGuid();
|
||||
|
||||
if (SrcLocation.HasValue)
|
||||
SrcLocation.Value.Read(data);
|
||||
if (SrcLocation != null)
|
||||
SrcLocation.Read(data);
|
||||
|
||||
if (DstLocation.HasValue)
|
||||
DstLocation.Value.Read(data);
|
||||
if (DstLocation != null)
|
||||
DstLocation.Read(data);
|
||||
|
||||
if (hasOrientation)
|
||||
Orientation = data.ReadFloat();
|
||||
@@ -1551,8 +1551,8 @@ namespace Game.Networking.Packets
|
||||
public void Write(WorldPacket data)
|
||||
{
|
||||
data.WriteBits((uint)Flags, 26);
|
||||
data.WriteBit(SrcLocation.HasValue);
|
||||
data.WriteBit(DstLocation.HasValue);
|
||||
data.WriteBit(SrcLocation != null);
|
||||
data.WriteBit(DstLocation != null);
|
||||
data.WriteBit(Orientation.HasValue);
|
||||
data.WriteBit(MapID.HasValue);
|
||||
data.WriteBits(Name.GetByteCount(), 7);
|
||||
@@ -1561,11 +1561,11 @@ namespace Game.Networking.Packets
|
||||
data.WritePackedGuid(Unit);
|
||||
data.WritePackedGuid(Item);
|
||||
|
||||
if (SrcLocation.HasValue)
|
||||
SrcLocation.Value.Write(data);
|
||||
if (SrcLocation != null)
|
||||
SrcLocation.Write(data);
|
||||
|
||||
if (DstLocation.HasValue)
|
||||
DstLocation.Value.Write(data);
|
||||
if (DstLocation != null)
|
||||
DstLocation.Write(data);
|
||||
|
||||
if (Orientation.HasValue)
|
||||
data.WriteFloat(Orientation.Value);
|
||||
@@ -1579,8 +1579,8 @@ namespace Game.Networking.Packets
|
||||
public SpellCastTargetFlags Flags;
|
||||
public ObjectGuid Unit;
|
||||
public ObjectGuid Item;
|
||||
public TargetLocation? SrcLocation;
|
||||
public TargetLocation? DstLocation;
|
||||
public TargetLocation SrcLocation;
|
||||
public TargetLocation DstLocation;
|
||||
public float? Orientation;
|
||||
public int? MapID;
|
||||
public string Name = "";
|
||||
|
||||
@@ -42,30 +42,30 @@ namespace Game.Spells
|
||||
m_src = new SpellDestination();
|
||||
m_dst = new SpellDestination();
|
||||
|
||||
if (spellCastRequest.Target.SrcLocation.HasValue)
|
||||
if (spellCastRequest.Target.SrcLocation != null)
|
||||
{
|
||||
m_src.TransportGUID = spellCastRequest.Target.SrcLocation.Value.Transport;
|
||||
m_src.TransportGUID = spellCastRequest.Target.SrcLocation.Transport;
|
||||
Position pos;
|
||||
if (!m_src.TransportGUID.IsEmpty())
|
||||
pos = m_src.TransportOffset;
|
||||
else
|
||||
pos = m_src.Position;
|
||||
|
||||
pos.Relocate(spellCastRequest.Target.SrcLocation.Value.Location);
|
||||
pos.Relocate(spellCastRequest.Target.SrcLocation.Location);
|
||||
if (spellCastRequest.Target.Orientation.HasValue)
|
||||
pos.SetOrientation(spellCastRequest.Target.Orientation.Value);
|
||||
}
|
||||
|
||||
if (spellCastRequest.Target.DstLocation.HasValue)
|
||||
if (spellCastRequest.Target.DstLocation != null)
|
||||
{
|
||||
m_dst.TransportGUID = spellCastRequest.Target.DstLocation.Value.Transport;
|
||||
m_dst.TransportGUID = spellCastRequest.Target.DstLocation.Transport;
|
||||
Position pos;
|
||||
if (!m_dst.TransportGUID.IsEmpty())
|
||||
pos = m_dst.TransportOffset;
|
||||
else
|
||||
pos = m_dst.Position;
|
||||
|
||||
pos.Relocate(spellCastRequest.Target.DstLocation.Value.Location);
|
||||
pos.Relocate(spellCastRequest.Target.DstLocation.Location);
|
||||
if (spellCastRequest.Target.Orientation.HasValue)
|
||||
pos.SetOrientation(spellCastRequest.Target.Orientation.Value);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user