fix(core): Converts MobileUpdate packet (#369)
- [X] Converts mobile update packet
This commit is contained in:
parent
3d98e6e193
commit
9d4161b3e4
7 changed files with 72 additions and 106 deletions
|
|
@ -2827,27 +2827,24 @@ namespace Server
|
|||
|
||||
ns.Send(SeasonChange.Instantiate(GetSeason(), true));
|
||||
|
||||
ns.Send(new MobileUpdate(this, ns.StygianAbyss));
|
||||
ns.SendMobileUpdate(this);
|
||||
Send(new ServerChange(m_Location, m_Map));
|
||||
}
|
||||
|
||||
ns.Send(new MobileIncoming(ns, this, this));
|
||||
|
||||
ns.Send(new MobileUpdate(this, ns.StygianAbyss));
|
||||
ns.SendMobileUpdate(this);
|
||||
CheckLightLevels(true);
|
||||
ns.Send(new MobileUpdate(this, ns.StygianAbyss));
|
||||
ns.SendMobileUpdate(this);
|
||||
}
|
||||
|
||||
SendEverything();
|
||||
SendIncomingPacket();
|
||||
|
||||
if (ns != null)
|
||||
{
|
||||
ns.Send(new MobileIncoming(ns, this, this));
|
||||
ns.SendSupportedFeature();
|
||||
ns.Send(new MobileUpdate(this, ns.StygianAbyss));
|
||||
ns.SendMobileAttributes(this);
|
||||
}
|
||||
ns?.Send(new MobileIncoming(ns, this, this));
|
||||
ns.SendSupportedFeature();
|
||||
ns.SendMobileUpdate(this);
|
||||
ns.SendMobileAttributes(this);
|
||||
|
||||
OnMapChange(oldMap);
|
||||
}
|
||||
|
|
@ -3042,7 +3039,7 @@ namespace Server
|
|||
if (sendUpdate)
|
||||
{
|
||||
ourState.Sequence = 0;
|
||||
ourState.Send(new MobileUpdate(this, ourState.StygianAbyss));
|
||||
ourState.SendMobileUpdate(this);
|
||||
}
|
||||
|
||||
if (sendIncoming)
|
||||
|
|
@ -7513,7 +7510,7 @@ namespace Server
|
|||
if (isTeleport && m_NetState != null && (!m_NetState.HighSeas || !NoMoveHS))
|
||||
{
|
||||
m_NetState.Sequence = 0;
|
||||
m_NetState.Send(new MobileUpdate(this, m_NetState.StygianAbyss));
|
||||
m_NetState.SendMobileUpdate(this);
|
||||
}
|
||||
|
||||
var map = m_Map;
|
||||
|
|
|
|||
|
|
@ -316,12 +316,12 @@ namespace Server.Network
|
|||
|
||||
state.Sequence = 0;
|
||||
|
||||
state.Send(new MobileUpdate(m, state.StygianAbyss));
|
||||
state.Send(new MobileUpdate(m, state.StygianAbyss));
|
||||
state.SendMobileUpdate(m);
|
||||
state.SendMobileUpdate(m);
|
||||
|
||||
m.CheckLightLevels(true);
|
||||
|
||||
state.Send(new MobileUpdate(m, state.StygianAbyss));
|
||||
state.SendMobileUpdate(m);
|
||||
|
||||
state.Send(new MobileIncoming(state, m, m));
|
||||
|
||||
|
|
@ -331,7 +331,7 @@ namespace Server.Network
|
|||
m.SendEverything();
|
||||
|
||||
state.SendSupportedFeature();
|
||||
state.Send(new MobileUpdate(m, state.StygianAbyss));
|
||||
state.SendMobileUpdate(m);
|
||||
|
||||
state.SendMobileStatus(m);
|
||||
state.SendSetWarMode(m.Warmode);
|
||||
|
|
|
|||
|
|
@ -473,8 +473,7 @@ namespace Server.Network
|
|||
return;
|
||||
}
|
||||
|
||||
state.Send(new MobileUpdate(from, state.StygianAbyss));
|
||||
|
||||
state.SendMobileUpdate(from);
|
||||
state.Send(new MobileIncoming(state, from, from));
|
||||
|
||||
from.SendEverything();
|
||||
|
|
|
|||
|
|
@ -17,30 +17,6 @@ using System.Threading;
|
|||
|
||||
namespace Server.Network
|
||||
{
|
||||
public sealed class MobileUpdate : Packet
|
||||
{
|
||||
public MobileUpdate(Mobile m, bool stygianAbyss) : base(0x20, 19)
|
||||
{
|
||||
var hue = m.Hue;
|
||||
|
||||
if (m.SolidHueOverride >= 0)
|
||||
{
|
||||
hue = m.SolidHueOverride;
|
||||
}
|
||||
|
||||
Stream.Write(m.Serial);
|
||||
Stream.Write((short)m.Body);
|
||||
Stream.Write((byte)0);
|
||||
Stream.Write((short)hue);
|
||||
Stream.Write((byte)m.GetPacketFlags(stygianAbyss));
|
||||
Stream.Write((short)m.X);
|
||||
Stream.Write((short)m.Y);
|
||||
Stream.Write((short)0);
|
||||
Stream.Write((byte)m.Direction);
|
||||
Stream.Write((sbyte)m.Z);
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class MobileIncoming : Packet
|
||||
{
|
||||
private static readonly ThreadLocal<int[]> m_DupedLayersTL = new(() => new int[256]);
|
||||
|
|
|
|||
|
|
@ -513,5 +513,28 @@ namespace Server.Network
|
|||
|
||||
return writer.Position;
|
||||
}
|
||||
|
||||
public static void SendMobileUpdate(this NetState ns, Mobile m)
|
||||
{
|
||||
if (ns == null || !ns.GetSendBuffer(out var buffer))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var writer = new CircularBufferWriter(buffer);
|
||||
writer.Write((byte)0x20); // Packet ID
|
||||
writer.Write(m.Serial);
|
||||
writer.Write((short)m.Body);
|
||||
writer.Write((byte)0);
|
||||
writer.Write((short)(m.SolidHueOverride >= 0 ? m.SolidHueOverride : m.Hue));
|
||||
writer.Write((byte)m.GetPacketFlags(ns.StygianAbyss));
|
||||
writer.Write((short)m.X);
|
||||
writer.Write((short)m.Y);
|
||||
writer.Write((short)0);
|
||||
writer.Write((byte)m.Direction);
|
||||
writer.Write((sbyte)m.Z);
|
||||
|
||||
ns.Send(ref buffer, writer.Position);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue