fix: Simplifies OPL (#1051)

This commit is contained in:
Kamron Batman 2022-06-12 21:27:16 -07:00 • committed by GitHub
parent b74b47159f
commit db20722711
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 14 additions and 31 deletions

View file

@ -1123,7 +1123,6 @@ namespace Server
Span<byte> oldWorldItem = stackalloc byte[OutgoingEntityPackets.MaxWorldEntityPacketLength].InitializePacket();
Span<byte> saWorldItem = stackalloc byte[OutgoingEntityPackets.MaxWorldEntityPacketLength].InitializePacket();
Span<byte> hsWorldItem = stackalloc byte[OutgoingEntityPackets.MaxWorldEntityPacketLength].InitializePacket();
Span<byte> opl = ObjectPropertyList.Enabled ? stackalloc byte[OutgoingEntityPackets.OPLPacketLength].InitializePacket() : null;
var eable = m_Map.GetClientsInRange(m_Location, GetMaxUpdateRange());
@ -1141,7 +1140,7 @@ namespace Server
hsWorldItem = hsWorldItem[..length];
}
SendInfoTo(state, hsWorldItem, opl);
SendInfoTo(state, hsWorldItem);
}
else if (state.StygianAbyss)
{
@ -1151,7 +1150,7 @@ namespace Server
saWorldItem = saWorldItem[..length];
}
SendInfoTo(state, saWorldItem, opl);
SendInfoTo(state, saWorldItem);
}
else
{
@ -1161,7 +1160,7 @@ namespace Server
oldWorldItem = oldWorldItem[..length];
}
SendInfoTo(state, oldWorldItem, opl);
SendInfoTo(state, oldWorldItem);
}
}
}
@ -3073,27 +3072,18 @@ namespace Server
public virtual int GetUpdateRange(Mobile m) => 18;
public virtual void SendInfoTo(NetState ns, ReadOnlySpan<byte> world = default, Span<byte> opl = default)
public virtual void SendInfoTo(NetState ns, ReadOnlySpan<byte> world = default)
{
SendWorldPacketTo(ns, world);
SendOPLPacketTo(ns, opl);
SendOPLPacketTo(ns);
}
public virtual void SendOPLPacketTo(NetState ns, Span<byte> opl = default)
public virtual void SendOPLPacketTo(NetState ns)
{
if (!ObjectPropertyList.Enabled)
{
return;
}
if (opl == null)
if (ObjectPropertyList.Enabled)
{
ns.SendOPLInfo(this);
return;
}
OutgoingEntityPackets.CreateOPLInfo(opl, this);
ns.Send(opl);
}
public virtual void SendWorldPacketTo(NetState ns, ReadOnlySpan<byte> world = default)

View file

@ -6892,21 +6892,14 @@ namespace Server
eable.Free();
}
public void SendOPLPacketTo(NetState state) => SendOPLPacketTo(state, ObjectPropertyList.Enabled);
protected virtual void SendOPLPacketTo(NetState ns, bool sendOplPacket)
public virtual void SendOPLPacketTo(NetState ns)
{
if (sendOplPacket)
if (ObjectPropertyList.Enabled)
{
ns.SendOPLInfo(this);
}
}
public virtual void SendOPLPacketTo(NetState ns, ReadOnlySpan<byte> opl)
{
ns?.Send(opl);
}
public virtual void OnAccessLevelChanged(AccessLevel oldLevel)
{
}

View file

@ -258,7 +258,7 @@ namespace Server.Engines.Plants
}
// Overridden to support new and old client localization
public override void SendOPLPacketTo(NetState ns, Span<byte> opl = default)
public override void SendOPLPacketTo(NetState ns)
{
if (!ObjectPropertyList.Enabled)
{

View file

@ -799,9 +799,9 @@ namespace Server.Items
return m_Devourer.Devour(this); // Devour the corpse if it hasn't
}
public override void SendInfoTo(NetState ns, ReadOnlySpan<byte> world = default, Span<byte> opl = default)
public override void SendInfoTo(NetState ns, ReadOnlySpan<byte> world = default)
{
base.SendInfoTo(ns, world, opl);
base.SendInfoTo(ns, world);
if (((Body)Amount).IsHuman && ItemID == 0x2006)
{

View file

@ -878,9 +878,9 @@ namespace Server.Multis
DesignState.SendDetailedInfoTo(ns);
}
public override void SendInfoTo(NetState ns, ReadOnlySpan<byte> world = default, Span<byte> opl = default)
public override void SendInfoTo(NetState ns, ReadOnlySpan<byte> world = default)
{
base.SendInfoTo(ns, world, opl);
base.SendInfoTo(ns, world);
var stateToSend = DesignContext.Find(ns?.Mobile)?.Foundation == this ? DesignState : CurrentState;
stateToSend.SendGeneralInfoTo(ns);