parent
f52e63f320
commit
f4dd7c8e7f
16 changed files with 459 additions and 197 deletions
|
|
@ -1151,9 +1151,9 @@ namespace Server
|
|||
{
|
||||
if (state.HighSeas)
|
||||
{
|
||||
if (hsWorldItem[0] == 0)
|
||||
var length = OutgoingItemPackets.CreateWorldItemNew(hsWorldItem, this, true);
|
||||
if (length != hsWorldItem.Length)
|
||||
{
|
||||
var length = OutgoingItemPackets.CreateWorldItemNew(hsWorldItem, this, true);
|
||||
hsWorldItem = hsWorldItem.Slice(0, length);
|
||||
}
|
||||
|
||||
|
|
@ -1161,9 +1161,9 @@ namespace Server
|
|||
}
|
||||
else if (state.StygianAbyss)
|
||||
{
|
||||
if (saWorldItem[0] == 0)
|
||||
var length = OutgoingItemPackets.CreateWorldItemNew(saWorldItem, this, false);
|
||||
if (length != saWorldItem.Length)
|
||||
{
|
||||
var length = OutgoingItemPackets.CreateWorldItemNew(saWorldItem, this, false);
|
||||
saWorldItem = saWorldItem.Slice(0, length);
|
||||
}
|
||||
|
||||
|
|
@ -1171,9 +1171,9 @@ namespace Server
|
|||
}
|
||||
else
|
||||
{
|
||||
if (oldWorldItem[0] == 0)
|
||||
var length = OutgoingItemPackets.CreateWorldItem(oldWorldItem, this);
|
||||
if (length != oldWorldItem.Length)
|
||||
{
|
||||
var length = OutgoingItemPackets.CreateWorldItem(oldWorldItem, this);
|
||||
oldWorldItem = oldWorldItem.Slice(0, length);
|
||||
}
|
||||
|
||||
|
|
@ -3091,11 +3091,7 @@ namespace Server
|
|||
return;
|
||||
}
|
||||
|
||||
if (opl[0] == 0)
|
||||
{
|
||||
OutgoingEntityPackets.CreateOPLInfo(opl, this);
|
||||
}
|
||||
|
||||
OutgoingEntityPackets.CreateOPLInfo(opl, this);
|
||||
ns.Send(opl);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,11 @@ namespace Server
|
|||
|
||||
public static void CreateHairEquipUpdatePacket(Span<byte> buffer, Mobile m, Serial hairSerial, Layer layer)
|
||||
{
|
||||
if (buffer[0] != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var hue = m.SolidHueOverride >= 0 ? m.SolidHueOverride : m.HairHue;
|
||||
|
||||
var writer = new SpanWriter(buffer);
|
||||
|
|
@ -51,6 +56,11 @@ namespace Server
|
|||
|
||||
public static void CreateRemoveHairPacket(Span<byte> buffer, Serial hairSerial)
|
||||
{
|
||||
if (buffer[0] != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var writer = new SpanWriter(buffer);
|
||||
writer.Write((byte)0x1D); // Packet ID
|
||||
writer.Write(hairSerial);
|
||||
|
|
|
|||
|
|
@ -3191,11 +3191,7 @@ namespace Server
|
|||
|
||||
if (IsDeadBondedPet)
|
||||
{
|
||||
if (deadBuffer[0] == 0)
|
||||
{
|
||||
OutgoingMobilePackets.CreateBondedStatus(deadBuffer, Serial, true);
|
||||
}
|
||||
|
||||
OutgoingMobilePackets.CreateBondedStatus(deadBuffer, Serial, true);
|
||||
state.Send(deadBuffer);
|
||||
}
|
||||
}
|
||||
|
|
@ -3209,21 +3205,13 @@ namespace Server
|
|||
{
|
||||
if (sendHealthbarPoison)
|
||||
{
|
||||
if (hbpBuffer[0] == 0)
|
||||
{
|
||||
OutgoingMobilePackets.CreateMobileHealthbar(hbpBuffer, this, Healthbar.Poison);
|
||||
}
|
||||
|
||||
OutgoingMobilePackets.CreateMobileHealthbar(hbpBuffer, this, Healthbar.Poison);
|
||||
state.Send(hbpBuffer);
|
||||
}
|
||||
|
||||
if (sendHealthbarYellow)
|
||||
{
|
||||
if (hbyBuffer[0] == 0)
|
||||
{
|
||||
OutgoingMobilePackets.CreateMobileHealthbar(hbyBuffer, this, Healthbar.Yellow);
|
||||
}
|
||||
|
||||
OutgoingMobilePackets.CreateMobileHealthbar(hbyBuffer, this, Healthbar.Yellow);
|
||||
state.Send(hbyBuffer);
|
||||
}
|
||||
}
|
||||
|
|
@ -3232,51 +3220,36 @@ namespace Server
|
|||
{
|
||||
if (CanBeRenamedBy(beholder))
|
||||
{
|
||||
if (statBufferTrue[0] == 0)
|
||||
{
|
||||
OutgoingMobilePackets.CreateMobileStatusCompact(statBufferTrue, this, true);
|
||||
}
|
||||
|
||||
OutgoingMobilePackets.CreateMobileStatusCompact(statBufferTrue, this, true);
|
||||
state.Send(statBufferTrue);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (statBufferFalse[0] == 0)
|
||||
{
|
||||
OutgoingMobilePackets.CreateMobileStatusCompact(statBufferFalse, this, false);
|
||||
}
|
||||
|
||||
OutgoingMobilePackets.CreateMobileStatusCompact(statBufferFalse, this, false);
|
||||
state.Send(statBufferFalse);
|
||||
}
|
||||
}
|
||||
else if (sendHits)
|
||||
{
|
||||
if (hitsPacket[0] == 0)
|
||||
{
|
||||
OutgoingMobilePackets.CreateMobileHits(hitsPacket, this, true);
|
||||
}
|
||||
|
||||
OutgoingMobilePackets.CreateMobileHits(hitsPacket, this, true);
|
||||
state.Send(hitsPacket);
|
||||
}
|
||||
|
||||
if (sendHair)
|
||||
{
|
||||
if (hairPacket[0] == 0)
|
||||
var hairSerial = HairInfo.FakeSerial(Serial);
|
||||
if (removeHair)
|
||||
{
|
||||
var hairSerial = HairInfo.FakeSerial(Serial);
|
||||
if (removeHair)
|
||||
{
|
||||
OutgoingVirtualHairPackets.CreateRemoveHairPacket(hairPacket, hairSerial);
|
||||
}
|
||||
else
|
||||
{
|
||||
OutgoingVirtualHairPackets.CreateHairEquipUpdatePacket(
|
||||
hairPacket,
|
||||
this,
|
||||
hairSerial,
|
||||
Layer.Hair
|
||||
);
|
||||
}
|
||||
OutgoingVirtualHairPackets.CreateRemoveHairPacket(hairPacket, hairSerial);
|
||||
}
|
||||
else
|
||||
{
|
||||
OutgoingVirtualHairPackets.CreateHairEquipUpdatePacket(
|
||||
hairPacket,
|
||||
this,
|
||||
hairSerial,
|
||||
Layer.Hair
|
||||
);
|
||||
}
|
||||
|
||||
state.Send(hairPacket);
|
||||
|
|
@ -3284,24 +3257,20 @@ namespace Server
|
|||
|
||||
if (sendFacialHair)
|
||||
{
|
||||
if (facialhairPacket[0] == 0)
|
||||
var hairSerial = HairInfo.FakeSerial(Serial);
|
||||
if (removeFacialHair)
|
||||
{
|
||||
var hairSerial = HairInfo.FakeSerial(Serial);
|
||||
if (removeFacialHair)
|
||||
{
|
||||
OutgoingVirtualHairPackets.CreateRemoveHairPacket(facialhairPacket, hairSerial);
|
||||
}
|
||||
else
|
||||
{
|
||||
OutgoingVirtualHairPackets.CreateHairEquipUpdatePacket(
|
||||
facialhairPacket,
|
||||
this,
|
||||
hairSerial,
|
||||
Layer.FacialHair
|
||||
);
|
||||
}
|
||||
OutgoingVirtualHairPackets.CreateRemoveHairPacket(facialhairPacket, hairSerial);
|
||||
}
|
||||
else
|
||||
{
|
||||
OutgoingVirtualHairPackets.CreateHairEquipUpdatePacket(
|
||||
facialhairPacket,
|
||||
this,
|
||||
hairSerial,
|
||||
Layer.FacialHair
|
||||
);
|
||||
}
|
||||
|
||||
state.Send(facialhairPacket);
|
||||
}
|
||||
|
||||
|
|
@ -5024,11 +4993,7 @@ namespace Server
|
|||
{
|
||||
if (state != m_NetState)
|
||||
{
|
||||
if (deathAnimation[0] == 0)
|
||||
{
|
||||
OutgoingMobilePackets.CreateDeathAnimation(deathAnimation, Serial, corpseSerial);
|
||||
}
|
||||
|
||||
OutgoingMobilePackets.CreateDeathAnimation(deathAnimation, Serial, corpseSerial);
|
||||
state.Send(deathAnimation);
|
||||
|
||||
if (!state.Mobile.CanSee(this))
|
||||
|
|
|
|||
|
|
@ -28,6 +28,11 @@ namespace Server.Network
|
|||
|
||||
public static void CreateOPLInfo(Span<byte> buffer, Serial serial, int hash)
|
||||
{
|
||||
if (buffer[0] != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var writer = new SpanWriter(buffer);
|
||||
writer.Write((byte)0xDC); // Packet ID
|
||||
writer.Write(serial);
|
||||
|
|
|
|||
|
|
@ -25,6 +25,11 @@ namespace Server.Network
|
|||
|
||||
public static int CreateWorldItem(Span<byte> buffer, Item item)
|
||||
{
|
||||
if (buffer[0] != 0)
|
||||
{
|
||||
return buffer.Length;
|
||||
}
|
||||
|
||||
var itemID = item is BaseMulti ? item.ItemID | 0x4000 : item.ItemID & 0x3FFF;
|
||||
var hasAmount = item.Amount != 0;
|
||||
var amount = item.Amount;
|
||||
|
|
@ -95,6 +100,11 @@ namespace Server.Network
|
|||
|
||||
public static int CreateWorldItemNew(Span<byte> buffer, Item item, bool isHS)
|
||||
{
|
||||
if (buffer[0] != 0)
|
||||
{
|
||||
return buffer.Length;
|
||||
}
|
||||
|
||||
var writer = new SpanWriter(buffer);
|
||||
writer.Write((byte)0xF3); // Packet ID
|
||||
writer.Write((short)0x1); // command
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ namespace Server.Network
|
|||
ns.Send(buffer.Slice(0, length));
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static int GetMaxMessageLocalizedLength(string args) => 50 + (args?.Length ?? 0) * 2;
|
||||
|
||||
public static int CreateMessageLocalized(
|
||||
|
|
@ -104,6 +105,7 @@ namespace Server.Network
|
|||
ns.Send(buffer.Slice(0, length));
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static int GetMaxMessageLocalizedAffixLength(string affix, string args) =>
|
||||
52 + (affix?.Length ?? 0) + (args?.Length ?? 0) * 2;
|
||||
|
||||
|
|
@ -145,7 +147,6 @@ namespace Server.Network
|
|||
return writer.Position;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void SendMessage(
|
||||
this NetState ns,
|
||||
Serial serial, int graphic, MessageType type, int hue, int font, bool ascii, string lang, string name, string text
|
||||
|
|
|
|||
|
|
@ -39,6 +39,11 @@ namespace Server.Network
|
|||
|
||||
public static void CreateBondedStatus(Span<byte> buffer, Serial serial, bool bonded)
|
||||
{
|
||||
if (buffer[0] != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var writer = new SpanWriter(buffer);
|
||||
writer.Write((byte)0xBF); // Packet ID
|
||||
writer.Write((ushort)11); // Length
|
||||
|
|
@ -68,6 +73,11 @@ namespace Server.Network
|
|||
|
||||
public static void CreateDeathAnimation(Span<byte> buffer, Serial killed, Serial corpse)
|
||||
{
|
||||
if (buffer[0] != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var writer = new SpanWriter(buffer);
|
||||
writer.Write((byte)0xAF); // Packet ID
|
||||
writer.Write(killed);
|
||||
|
|
@ -194,6 +204,11 @@ namespace Server.Network
|
|||
|
||||
public static void CreateMobileHits(Span<byte> buffer, Mobile m, bool normalize = false)
|
||||
{
|
||||
if (buffer[0] != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var writer = new SpanWriter(buffer);
|
||||
writer.Write((byte)0xA1); // Packet ID
|
||||
writer.Write(m.Serial);
|
||||
|
|
@ -214,6 +229,11 @@ namespace Server.Network
|
|||
|
||||
public static void CreateMobileMana(Span<byte> buffer, Mobile m, bool normalize = false)
|
||||
{
|
||||
if (buffer[0] != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var writer = new SpanWriter(buffer);
|
||||
writer.Write((byte)0xA2); // Packet ID
|
||||
writer.Write(m.Serial);
|
||||
|
|
@ -234,6 +254,11 @@ namespace Server.Network
|
|||
|
||||
public static void CreateMobileStam(Span<byte> buffer, Mobile m, bool normalize = false)
|
||||
{
|
||||
if (buffer[0] != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var writer = new SpanWriter(buffer);
|
||||
writer.Write((byte)0xA3); // Packet ID
|
||||
writer.Write(m.Serial);
|
||||
|
|
@ -254,6 +279,11 @@ namespace Server.Network
|
|||
|
||||
public static void CreateMobileAttributes(Span<byte> buffer, Mobile m, bool normalize = false)
|
||||
{
|
||||
if (buffer[0] != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var writer = new SpanWriter(buffer);
|
||||
writer.Write((byte)0x2D); // Packet ID
|
||||
writer.Write(m.Serial);
|
||||
|
|
@ -355,6 +385,11 @@ namespace Server.Network
|
|||
|
||||
public static void CreateMobileHealthbar(Span<byte> buffer, Mobile m, Healthbar healthbar)
|
||||
{
|
||||
if (buffer[0] != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
switch (healthbar)
|
||||
{
|
||||
case Healthbar.Poison:
|
||||
|
|
@ -442,20 +477,20 @@ namespace Server.Network
|
|||
Span<byte> buffer, Mobile beholder, Mobile beheld, int version, bool canBeRenamed
|
||||
)
|
||||
{
|
||||
if (buffer[0] != 0)
|
||||
{
|
||||
return buffer.Length;
|
||||
}
|
||||
|
||||
var name = beheld.Name ?? "";
|
||||
|
||||
var writer = new SpanWriter(buffer);
|
||||
writer.Write((byte)0x11); // Packet ID
|
||||
writer.Seek(2, SeekOrigin.Current);
|
||||
|
||||
writer.Write(beheld.Serial);
|
||||
|
||||
writer.WriteAscii(name, 30);
|
||||
|
||||
writer.WriteAttribute(beheld.HitsMax, beheld.Hits, version == 0, true);
|
||||
|
||||
writer.Write(canBeRenamed);
|
||||
|
||||
writer.Write((byte)version);
|
||||
|
||||
if (version <= 0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue