fix(core): Cleans up OPL code (#396)
- [X] Cleans up OPL code to simplify the calls
This commit is contained in:
parent
5882b1ab3f
commit
0b9fb9c071
6 changed files with 28 additions and 70 deletions
|
|
@ -703,7 +703,7 @@ namespace Server.Items
|
|||
{
|
||||
for (var i = 0; i < Items.Count; ++i)
|
||||
{
|
||||
Items[i].SendOPLPacketTo(to.NetState, true);
|
||||
ns.SendOPLInfo(Items[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3094,44 +3094,44 @@ namespace Server
|
|||
|
||||
public virtual int GetUpdateRange(Mobile m) => 18;
|
||||
|
||||
public virtual void SendInfoTo(NetState ns, ReadOnlySpan<byte> world, Span<byte> opl)
|
||||
public virtual void SendInfoTo(NetState ns, ReadOnlySpan<byte> world = default, Span<byte> opl = default)
|
||||
{
|
||||
if (opl != null && opl[0] == 0)
|
||||
{
|
||||
OutgoingEntityPackets.CreateOPLInfo(opl, this);
|
||||
}
|
||||
|
||||
SendWorldPacketTo(ns, world);
|
||||
SendOPLPacketTo(ns, opl);
|
||||
}
|
||||
|
||||
public void SendInfoTo(NetState ns) => SendInfoTo(ns, ObjectPropertyList.Enabled);
|
||||
|
||||
public virtual void SendInfoTo(NetState ns, bool sendOplPacket)
|
||||
public void SendOPLPacketTo(NetState ns, Span<byte> opl = default)
|
||||
{
|
||||
SendWorldPacketTo(ns);
|
||||
SendOPLPacketTo(ns, sendOplPacket);
|
||||
}
|
||||
if (!ObjectPropertyList.Enabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
public void SendOPLPacketTo(NetState ns) => SendOPLPacketTo(ns, ObjectPropertyList.Enabled);
|
||||
|
||||
public virtual void SendOPLPacketTo(NetState ns, bool sendOplPacket)
|
||||
{
|
||||
if (sendOplPacket)
|
||||
if (opl == null)
|
||||
{
|
||||
ns.SendOPLInfo(this);
|
||||
return;
|
||||
}
|
||||
|
||||
if (opl[0] == 0)
|
||||
{
|
||||
OutgoingEntityPackets.CreateOPLInfo(opl, this);
|
||||
}
|
||||
|
||||
ns.Send(opl);
|
||||
}
|
||||
|
||||
public virtual void SendOPLPacketTo(NetState ns, ReadOnlySpan<byte> opl)
|
||||
public virtual void SendWorldPacketTo(NetState ns, ReadOnlySpan<byte> world = default)
|
||||
{
|
||||
ns?.Send(opl);
|
||||
if (world != null)
|
||||
{
|
||||
ns?.Send(world);
|
||||
return;
|
||||
}
|
||||
|
||||
ns.SendWorldItem(this);
|
||||
}
|
||||
|
||||
protected virtual void SendWorldPacketTo(NetState ns) => ns.SendWorldItem(this);
|
||||
|
||||
public virtual void SendWorldPacketTo(NetState ns, ReadOnlySpan<byte> world) => ns?.Send(world);
|
||||
|
||||
public virtual int GetTotal(TotalType type) => 0;
|
||||
|
||||
public virtual void UpdateTotal(Item sender, TotalType type, int delta)
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ namespace Server.Items
|
|||
|
||||
public override int LabelNumber => 503057; // Impassable!
|
||||
|
||||
public override void SendWorldPacketTo(NetState ns, ReadOnlySpan<byte> world)
|
||||
public override void SendWorldPacketTo(NetState ns, ReadOnlySpan<byte> world = default)
|
||||
{
|
||||
var mob = ns.Mobile;
|
||||
if (AccessLevel.GameMaster >= mob?.AccessLevel)
|
||||
|
|
@ -29,18 +29,6 @@ namespace Server.Items
|
|||
SendGMItem(ns);
|
||||
}
|
||||
|
||||
protected override void SendWorldPacketTo(NetState ns)
|
||||
{
|
||||
var mob = ns.Mobile;
|
||||
if (AccessLevel.GameMaster >= mob?.AccessLevel)
|
||||
{
|
||||
base.SendWorldPacketTo(ns);
|
||||
return;
|
||||
}
|
||||
|
||||
SendGMItem(ns);
|
||||
}
|
||||
|
||||
private void SendGMItem(NetState ns)
|
||||
{
|
||||
// GM Packet
|
||||
|
|
|
|||
|
|
@ -815,16 +815,6 @@ namespace Server.Items
|
|||
ns.Send(new CorpseEquip(ns.Mobile, this));
|
||||
}
|
||||
|
||||
public override void SendInfoTo(NetState ns, bool sendOplPacket)
|
||||
{
|
||||
base.SendInfoTo(ns, sendOplPacket);
|
||||
|
||||
if (((Body)Amount).IsHuman && ItemID == 0x2006)
|
||||
{
|
||||
SendCorpseContent(ns);
|
||||
}
|
||||
}
|
||||
|
||||
public override void SendInfoTo(NetState ns, ReadOnlySpan<byte> world, Span<byte> opl)
|
||||
{
|
||||
base.SendInfoTo(ns, world, opl);
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ namespace Server.Items
|
|||
TileData.ItemTable[0x21A2].Height = 20;
|
||||
}
|
||||
|
||||
public override void SendWorldPacketTo(NetState ns, ReadOnlySpan<byte> world)
|
||||
public override void SendWorldPacketTo(NetState ns, ReadOnlySpan<byte> world = default)
|
||||
{
|
||||
var mob = ns.Mobile;
|
||||
if (AccessLevel.GameMaster >= mob?.AccessLevel)
|
||||
|
|
@ -35,18 +35,6 @@ namespace Server.Items
|
|||
SendGMItem(ns);
|
||||
}
|
||||
|
||||
protected override void SendWorldPacketTo(NetState ns)
|
||||
{
|
||||
var mob = ns.Mobile;
|
||||
if (AccessLevel.GameMaster >= mob?.AccessLevel)
|
||||
{
|
||||
base.SendWorldPacketTo(ns);
|
||||
return;
|
||||
}
|
||||
|
||||
SendGMItem(ns);
|
||||
}
|
||||
|
||||
private void SendGMItem(NetState ns)
|
||||
{
|
||||
// GM Packet
|
||||
|
|
|
|||
|
|
@ -880,19 +880,11 @@ namespace Server.Multis
|
|||
DesignState.SendDetailedInfoTo(ns);
|
||||
}
|
||||
|
||||
public override void SendInfoTo(NetState ns, bool sendOplPacket)
|
||||
{
|
||||
base.SendInfoTo(ns, sendOplPacket);
|
||||
|
||||
var stateToSend = DesignContext.Find(ns.Mobile)?.Foundation == this ? DesignState : CurrentState;
|
||||
stateToSend.SendGeneralInfoTo(ns);
|
||||
}
|
||||
|
||||
public override void SendInfoTo(NetState ns, ReadOnlySpan<byte> world, Span<byte> opl)
|
||||
public override void SendInfoTo(NetState ns, ReadOnlySpan<byte> world = default, Span<byte> opl = default)
|
||||
{
|
||||
base.SendInfoTo(ns, world, opl);
|
||||
|
||||
var stateToSend = DesignContext.Find(ns.Mobile)?.Foundation == this ? DesignState : CurrentState;
|
||||
var stateToSend = DesignContext.Find(ns?.Mobile)?.Foundation == this ? DesignState : CurrentState;
|
||||
stateToSend.SendGeneralInfoTo(ns);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue