fix: Codegens more misc items (#1214)
This commit is contained in:
parent
505865e3ed
commit
212ce8bc24
81 changed files with 2641 additions and 3498 deletions
|
|
@ -1,67 +1,50 @@
|
|||
using System;
|
||||
using System.Buffers.Binary;
|
||||
using ModernUO.Serialization;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items
|
||||
namespace Server.Items;
|
||||
|
||||
[SerializationGenerator(0, false)]
|
||||
public partial class Blocker : Item
|
||||
{
|
||||
public class Blocker : Item
|
||||
private const ushort GMItemId = 0x1183;
|
||||
|
||||
[Constructible]
|
||||
public Blocker() : base(0x21A4) => Movable = false;
|
||||
|
||||
public override int LabelNumber => 503057; // Impassable!
|
||||
|
||||
public override void SendWorldPacketTo(NetState ns, ReadOnlySpan<byte> world = default)
|
||||
{
|
||||
private const ushort GMItemId = 0x1183;
|
||||
|
||||
[Constructible]
|
||||
public Blocker() : base(0x21A4) => Movable = false;
|
||||
|
||||
public Blocker(Serial serial) : base(serial)
|
||||
var mob = ns.Mobile;
|
||||
if (AccessLevel.GameMaster >= mob?.AccessLevel)
|
||||
{
|
||||
base.SendWorldPacketTo(ns, world);
|
||||
return;
|
||||
}
|
||||
|
||||
public override int LabelNumber => 503057; // Impassable!
|
||||
SendGMItem(ns);
|
||||
}
|
||||
|
||||
public override void SendWorldPacketTo(NetState ns, ReadOnlySpan<byte> world = default)
|
||||
private void SendGMItem(NetState ns)
|
||||
{
|
||||
// GM Packet
|
||||
Span<byte> buffer = stackalloc byte[OutgoingEntityPackets.MaxWorldEntityPacketLength].InitializePacket();
|
||||
|
||||
int length;
|
||||
|
||||
if (ns.StygianAbyss)
|
||||
{
|
||||
var mob = ns.Mobile;
|
||||
if (AccessLevel.GameMaster >= mob?.AccessLevel)
|
||||
{
|
||||
base.SendWorldPacketTo(ns, world);
|
||||
return;
|
||||
}
|
||||
|
||||
SendGMItem(ns);
|
||||
length = OutgoingEntityPackets.CreateWorldEntity(buffer, this, ns.HighSeas);
|
||||
BinaryPrimitives.WriteUInt16BigEndian(buffer[8..10], GMItemId);
|
||||
}
|
||||
else
|
||||
{
|
||||
length = OutgoingItemPackets.CreateWorldItem(buffer, this);
|
||||
BinaryPrimitives.WriteUInt16BigEndian(buffer[7..9], GMItemId);
|
||||
}
|
||||
|
||||
private void SendGMItem(NetState ns)
|
||||
{
|
||||
// GM Packet
|
||||
Span<byte> buffer = stackalloc byte[OutgoingEntityPackets.MaxWorldEntityPacketLength].InitializePacket();
|
||||
|
||||
int length;
|
||||
|
||||
if (ns.StygianAbyss)
|
||||
{
|
||||
length = OutgoingEntityPackets.CreateWorldEntity(buffer, this, ns.HighSeas);
|
||||
BinaryPrimitives.WriteUInt16BigEndian(buffer[8..10], GMItemId);
|
||||
}
|
||||
else
|
||||
{
|
||||
length = OutgoingItemPackets.CreateWorldItem(buffer, this);
|
||||
BinaryPrimitives.WriteUInt16BigEndian(buffer[7..9], GMItemId);
|
||||
}
|
||||
|
||||
ns.Send(buffer[..length]);
|
||||
}
|
||||
|
||||
public override void Serialize(IGenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0);
|
||||
}
|
||||
|
||||
public override void Deserialize(IGenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
var version = reader.ReadInt();
|
||||
}
|
||||
ns.Send(buffer[..length]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue