Updates Packets & Randomizer (#43)
* Fixes a bug with the main loop. Removes unnecessary optimizations for RDRand. * WIP - Rewriting packets. * Cleanup and updates README * Converts more packets * Fixes header * Converts Effects packets. * Forgot the send command * Adds the start of containers packets. * Adds message packets with caching * Extends the send methods * Starts to add Acquire methods * Converted the packets * Cleanup * Cleanup * Adds more packets * Adds more packets * Fixes clearing arrays from pool. Adds Mobile Incoming * Converts more packets. * Moves more packets * Moves more packets * Test compression * Merges * Migrating to an idiomatic syntax that also supports compression, and proxying. * Optimize the stack alloc. Changes attributes * Converted container packets * Visual Studio doesn't auto save files. I am still getting used to subpar IDEs. * Adds static packet caching. Will profile later. Converts more packets * Fixes packets and changes how compression is configured * WIP - Adds basics for Gumps. Not finished though. * Fix file * Fixes formatting * Changed SpanWriter to be more idiomatic. * Fixes Span vs RawSpan and missing stackallocs * Converts over some more gumps * WIP - Deletes 32bit support. * Drops RDRand32 support. * Fixes gump compilation * Converting gump components * Removes old huffman compression function * Revert signature for backwards compatibility * WIP - Converting more gump components * Creates ArraySet for the strings. Updates AppendTo to reference that. * Converts the maining gump components * Cleans up gump components * Cleans up directives * Cleans up ArraySet and moves it. Adds null-coalescing-assignment * Cleanup, Target Packets, and C# 8 changes. * Removed OPL Packet * World packets * Fixing packet uses * Cleans up code. Fixes packet uses in various places. * More cleanup for packets * Code cleanup * Converts more packet uses and cleans up more code * More code cleanup * Finishes fixing the packets in Item * Updates secure trade packets * Updates core and gets it to compile. * Moved packets to scripts. Fixed account handler use of packets * Code cleanup * Updates chat packets * Code cleanuo * Adds party packets, but need to implement them. * Party packets WIP * Finishes party packets * Rearrange movement namespaces and classes * Finishes plant packets * Code Formatting * Fixes moving effects * Code cleanup, eliminates equipinfo * Adds more packets. Fixes bugs with various packets. * Finishes mahjon packets * Fixes mahjong packet * Code cleanup * Finishes mahjong packets * Adds Map packets * Add multifacet maps and charts * Cleans up some packets with UTF8 * Optimizes packets * Cleans up more packets. Moves the MessageHelper * Removes assistant support. Removes extended protocol. Incorporates MapUO packets as normal packets. * Updates protocol extensions packet receiver * Fixes a few bugs. Fixes a few more packets. * Code cleanup and fixing more packets * Fixes packet effects * Cleaned up more code * Buff Icon cleanup * Removed unused constructors * Code Cleanup. Adds BoatHS Packets * Moves house files. Updates house foundation packets. * Deployment cleanup * Fixes: * Code cleanup * More code cleanup * More code cleanup * Cleaned up BaseHouse * Enforces styling * Converts foreach to linq where possible. * Dont need that * Goals/Readme updates * Removes 32bit support at the highest level. Turns on HRT by default. * Code cleanup. Fixes extended features packet. * Fixes various bugs * Code cleanup * Code cleanup * Code cleanup. Fixes gump X/Y assignment. * Code cleanup using |= operator * More code cleanup * Cleanup * Fixes spacing issues. Thanks Visual Studio. You suck. * Compiler error * Fixes NPE from RunUO 2.7 * Renames ScriptCompiler to AssemblyHandler. Fixes packets. Updates README * Fixes more packets. Stupid trailing nulls. * Fixes various bugs. * Fixes for gumps * Fixes more gump stuff. Going to split it out later since it is getting insane * Recoded the gump writing * WIP * *Added output path of scripts project to dev branch *Activated debugging in code
This commit is contained in:
parent
7aa8fd3df1
commit
179cb50557
588 changed files with 10843 additions and 16177 deletions
|
|
@ -100,7 +100,7 @@ namespace Server.Items
|
|||
public Corpse(Mobile owner, HairInfo hair, FacialHairInfo facialhair, List<Item> equipItems)
|
||||
: base(0x2006)
|
||||
{
|
||||
// To supress console warnings, stackable must be true
|
||||
// To suppress console warnings, stackable must be true
|
||||
Stackable = true;
|
||||
Amount = owner.Body; // protocol defines that for itemid 0x2006, amount=body
|
||||
Stackable = false;
|
||||
|
|
@ -193,16 +193,7 @@ namespace Server.Items
|
|||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public virtual bool InstancedCorpse
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!Core.SE)
|
||||
return false;
|
||||
|
||||
return DateTime.UtcNow < TimeOfDeath + InstancedCorpseTime;
|
||||
}
|
||||
}
|
||||
public virtual bool InstancedCorpse => Core.SE && DateTime.UtcNow < TimeOfDeath + InstancedCorpseTime;
|
||||
|
||||
public override bool IsDecoContainer => false;
|
||||
|
||||
|
|
@ -302,9 +293,7 @@ namespace Server.Items
|
|||
Mobile dead = Owner;
|
||||
|
||||
if (GetFlag(CorpseFlag.Carved) || dead == null)
|
||||
{
|
||||
from.SendLocalizedMessage(500485); // You see nothing useful to carve from the corpse.
|
||||
}
|
||||
else if (((Body)Amount).IsHuman && ItemID == 0x2006)
|
||||
{
|
||||
new Blood(0x122D).MoveToWorld(Location, Map);
|
||||
|
|
@ -328,13 +317,9 @@ namespace Server.Items
|
|||
from.CriminalAction(true);
|
||||
}
|
||||
else if (dead is BaseCreature creature)
|
||||
{
|
||||
creature.OnCarve(from, this, item);
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(500485); // You see nothing useful to carve from the corpse.
|
||||
}
|
||||
}
|
||||
|
||||
public override bool IsChildVisibleTo(Mobile m, Item child) =>
|
||||
|
|
@ -347,8 +332,7 @@ namespace Server.Items
|
|||
if (Aggressors.Count == 0 || Items.Count == 0)
|
||||
return;
|
||||
|
||||
if (m_InstancedItems == null)
|
||||
m_InstancedItems = new Dictionary<Item, InstancedItemInfo>();
|
||||
m_InstancedItems ??= new Dictionary<Item, InstancedItemInfo>();
|
||||
|
||||
List<Item> m_Stackables = new List<Item>();
|
||||
List<Item> m_Unstackables = new List<Item>();
|
||||
|
|
@ -401,7 +385,7 @@ namespace Server.Items
|
|||
}
|
||||
|
||||
if (remainder == 0)
|
||||
m_InstancedItems.Add(item, new InstancedItemInfo(item, attackers[attackers.Count - 1]));
|
||||
m_InstancedItems.Add(item, new InstancedItemInfo(item, attackers[^1]));
|
||||
else
|
||||
m_Unstackables.Add(item);
|
||||
}
|
||||
|
|
@ -427,9 +411,7 @@ namespace Server.Items
|
|||
|
||||
if (InstancedCorpse)
|
||||
{
|
||||
if (m_InstancedItems == null)
|
||||
m_InstancedItems = new Dictionary<Item, InstancedItemInfo>();
|
||||
|
||||
m_InstancedItems ??= new Dictionary<Item, InstancedItemInfo>();
|
||||
m_InstancedItems.Add(carved, new InstancedItemInfo(carved, carver));
|
||||
}
|
||||
}
|
||||
|
|
@ -464,7 +446,6 @@ namespace Server.Items
|
|||
public override void OnAfterDelete()
|
||||
{
|
||||
m_DecayTimer?.Stop();
|
||||
|
||||
m_DecayTimer = null;
|
||||
}
|
||||
|
||||
|
|
@ -543,29 +524,23 @@ namespace Server.Items
|
|||
|
||||
writer.WriteDeltaTime(TimeOfDeath);
|
||||
|
||||
List<KeyValuePair<Item, Point3D>> list = m_RestoreTable == null
|
||||
? null
|
||||
: new List<KeyValuePair<Item, Point3D>>(m_RestoreTable);
|
||||
int count = list?.Count ?? 0;
|
||||
|
||||
writer.Write(count);
|
||||
|
||||
for (int i = 0; i < count; ++i)
|
||||
if (m_RestoreTable == null)
|
||||
writer.Write(0);
|
||||
else
|
||||
{
|
||||
KeyValuePair<Item, Point3D> kvp = list[i];
|
||||
Item item = kvp.Key;
|
||||
Point3D loc = kvp.Value;
|
||||
writer.Write(m_RestoreTable.Count);
|
||||
|
||||
writer.Write(item);
|
||||
foreach (var (item, loc) in m_RestoreTable)
|
||||
{
|
||||
writer.Write(item);
|
||||
|
||||
if (item.Location == loc)
|
||||
{
|
||||
writer.Write(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.Write(true);
|
||||
writer.Write(loc);
|
||||
if (item.Location == loc)
|
||||
writer.Write(false);
|
||||
else
|
||||
{
|
||||
writer.Write(true);
|
||||
writer.Write(loc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -757,12 +732,8 @@ namespace Server.Items
|
|||
if (!(((Body)Amount).IsHuman && ItemID == 0x2006))
|
||||
return;
|
||||
|
||||
if (state.ContainerGridLines)
|
||||
state.Send(new CorpseContent6017(state.Mobile, this));
|
||||
else
|
||||
state.Send(new CorpseContent(state.Mobile, this));
|
||||
|
||||
state.Send(new CorpseEquip(state.Mobile, this));
|
||||
CorpsePackets.SendCorpseContent(state, state.Mobile, this);
|
||||
CorpsePackets.SendCorpseEquip(state, state.Mobile, this);
|
||||
}
|
||||
|
||||
public bool IsCriminalAction(Mobile from)
|
||||
|
|
@ -836,8 +807,7 @@ namespace Server.Items
|
|||
if (item == null)
|
||||
return;
|
||||
|
||||
if (m_RestoreTable == null)
|
||||
m_RestoreTable = new Dictionary<Item, Point3D>();
|
||||
m_RestoreTable ??= new Dictionary<Item, Point3D>();
|
||||
|
||||
m_RestoreTable[item] = loc;
|
||||
}
|
||||
|
|
@ -1065,7 +1035,7 @@ namespace Server.Items
|
|||
ObjectPropertyList opl = PropertyList;
|
||||
|
||||
if (opl.Header > 0)
|
||||
from.Send(new MessageLocalized(Serial, ItemID, MessageType.Label, hue, 3, opl.Header, Name, opl.HeaderArgs));
|
||||
Packets.SendMessageLocalized(from.NetState, Serial, ItemID, MessageType.Label, hue, 3, opl.Header, Name, opl.HeaderArgs);
|
||||
}
|
||||
|
||||
public override void OnSingleClick(Mobile from)
|
||||
|
|
@ -1075,14 +1045,12 @@ namespace Server.Items
|
|||
if (ItemID == 0x2006) // Corpse form
|
||||
{
|
||||
if (m_CorpseName != null)
|
||||
from.Send(new AsciiMessage(Serial, ItemID, MessageType.Label, hue, 3, "", m_CorpseName));
|
||||
Packets.SendAsciiMessage(from.NetState, Serial, ItemID, MessageType.Label, hue, 3, "", m_CorpseName);
|
||||
else
|
||||
from.Send(new MessageLocalized(Serial, ItemID, MessageType.Label, hue, 3, 1046414, "", Name));
|
||||
Packets.SendMessageLocalized(from.NetState, Serial, ItemID, MessageType.Label, hue, 3, 1046414, "", Name);
|
||||
}
|
||||
else // Bone form
|
||||
{
|
||||
from.Send(new MessageLocalized(Serial, ItemID, MessageType.Label, hue, 3, 1046414, "", Name));
|
||||
}
|
||||
Packets.SendMessageLocalized(from.NetState, Serial, ItemID, MessageType.Label, hue, 3, 1046414, "", Name);
|
||||
}
|
||||
|
||||
private class InstancedItemInfo
|
||||
|
|
|
|||
|
|
@ -1,24 +1,29 @@
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Server.Buffers;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Network
|
||||
{
|
||||
public sealed class CorpseEquip : Packet
|
||||
public static class CorpsePackets
|
||||
{
|
||||
public CorpseEquip(Mobile beholder, Corpse beheld) : base(0x89)
|
||||
public static void SendCorpseEquip(NetState ns, Mobile beholder, Corpse beheld)
|
||||
{
|
||||
if (ns == null)
|
||||
return;
|
||||
|
||||
List<Item> list = beheld.EquipItems;
|
||||
|
||||
int count = list.Count;
|
||||
if (beheld.Hair != null && beheld.Hair.ItemID > 0)
|
||||
count++;
|
||||
if (beheld.FacialHair != null && beheld.FacialHair.ItemID > 0)
|
||||
count++;
|
||||
int length = 8 + list.Count * 5;
|
||||
if (beheld.Hair?.ItemID > 0)
|
||||
length += 5;
|
||||
if (beheld.FacialHair?.ItemID > 0)
|
||||
length += 5;
|
||||
|
||||
EnsureCapacity(8 + count * 5);
|
||||
SpanWriter writer = new SpanWriter(stackalloc byte[length]);
|
||||
writer.Write((byte)0x89); // Packet ID
|
||||
writer.Write((ushort)length); // Dynamic Length
|
||||
|
||||
m_Stream.Write(beheld.Serial);
|
||||
writer.Write(beheld.Serial);
|
||||
|
||||
for (int i = 0; i < list.Count; ++i)
|
||||
{
|
||||
|
|
@ -26,173 +31,180 @@ namespace Server.Network
|
|||
|
||||
if (!item.Deleted && beholder.CanSee(item) && item.Parent == beheld)
|
||||
{
|
||||
m_Stream.Write((byte)(item.Layer + 1));
|
||||
m_Stream.Write(item.Serial);
|
||||
writer.Write((byte)(item.Layer + 1));
|
||||
writer.Write(item.Serial);
|
||||
}
|
||||
}
|
||||
|
||||
if (beheld.Hair != null && beheld.Hair.ItemID > 0)
|
||||
if (beheld.Hair?.ItemID > 0)
|
||||
{
|
||||
m_Stream.Write((byte)(Layer.Hair + 1));
|
||||
m_Stream.Write(HairInfo.FakeSerial(beheld.Owner) - 2);
|
||||
writer.Write((byte)(Layer.Hair + 1));
|
||||
writer.Write(HairInfo.FakeSerial(beheld.Owner.Serial) - 2);
|
||||
}
|
||||
|
||||
if (beheld.FacialHair != null && beheld.FacialHair.ItemID > 0)
|
||||
if (beheld.FacialHair?.ItemID > 0)
|
||||
{
|
||||
m_Stream.Write((byte)(Layer.FacialHair + 1));
|
||||
m_Stream.Write(FacialHairInfo.FakeSerial(beheld.Owner) - 2);
|
||||
writer.Write((byte)(Layer.FacialHair + 1));
|
||||
writer.Write(FacialHairInfo.FakeSerial(beheld.Owner.Serial) - 2);
|
||||
}
|
||||
|
||||
m_Stream.Write((byte)Layer.Invalid);
|
||||
writer.Position++; // writer.Write((byte)Layer.Invalid);
|
||||
|
||||
ns.Send(writer.Span);
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class CorpseContent : Packet
|
||||
{
|
||||
public CorpseContent(Mobile beholder, Corpse beheld)
|
||||
: base(0x3C)
|
||||
public static void SendCorpseContent(NetState ns, Mobile beholder, Corpse corpse)
|
||||
{
|
||||
List<Item> items = beheld.EquipItems;
|
||||
int count = items.Count;
|
||||
if (ns == null)
|
||||
return;
|
||||
|
||||
if (beheld.Hair != null && beheld.Hair.ItemID > 0)
|
||||
count++;
|
||||
if (beheld.FacialHair != null && beheld.FacialHair.ItemID > 0)
|
||||
count++;
|
||||
if (ns.ContainerGridLines)
|
||||
SendCorpseContentNew(ns, beholder, corpse);
|
||||
else
|
||||
SendCorpseContentOld(ns, beholder, corpse);
|
||||
}
|
||||
|
||||
EnsureCapacity(5 + count * 19);
|
||||
public static void SendCorpseContentOld(NetState ns, Mobile beholder, Corpse corpse)
|
||||
{
|
||||
if (ns == null)
|
||||
return;
|
||||
|
||||
long pos = m_Stream.Position;
|
||||
List<Item> items = corpse.EquipItems;
|
||||
int length = 5 + items.Count * 19;
|
||||
|
||||
int written = 0;
|
||||
if (corpse.Hair?.ItemID > 0)
|
||||
length += 19;
|
||||
if (corpse.FacialHair?.ItemID > 0)
|
||||
length += 19;
|
||||
|
||||
m_Stream.Write((ushort)0);
|
||||
SpanWriter writer = new SpanWriter(stackalloc byte[length]);
|
||||
writer.Write((byte)0x3C); // Packet ID
|
||||
writer.Write((ushort)length); // Dynamic Length
|
||||
writer.Position += 2;
|
||||
|
||||
ushort written = 0;
|
||||
|
||||
for (int i = 0; i < items.Count; ++i)
|
||||
{
|
||||
Item child = items[i];
|
||||
|
||||
if (!child.Deleted && child.Parent == beheld && beholder.CanSee(child))
|
||||
if (!child.Deleted && child.Parent == corpse && beholder.CanSee(child))
|
||||
{
|
||||
m_Stream.Write(child.Serial);
|
||||
m_Stream.Write((ushort)child.ItemID);
|
||||
m_Stream.Write((byte)0); // signed, itemID offset
|
||||
m_Stream.Write((ushort)child.Amount);
|
||||
m_Stream.Write((short)child.X);
|
||||
m_Stream.Write((short)child.Y);
|
||||
m_Stream.Write(beheld.Serial);
|
||||
m_Stream.Write((ushort)child.Hue);
|
||||
writer.Write(child.Serial);
|
||||
writer.Write((ushort)child.ItemID);
|
||||
writer.Position++; // signed, itemID offset
|
||||
writer.Write((ushort)child.Amount);
|
||||
writer.Write((short)child.X);
|
||||
writer.Write((short)child.Y);
|
||||
writer.Write(corpse.Serial);
|
||||
writer.Write((ushort)child.Hue);
|
||||
|
||||
++written;
|
||||
}
|
||||
}
|
||||
|
||||
if (beheld.Hair != null && beheld.Hair.ItemID > 0)
|
||||
if (corpse.Hair?.ItemID > 0)
|
||||
{
|
||||
m_Stream.Write(HairInfo.FakeSerial(beheld.Owner) - 2);
|
||||
m_Stream.Write((ushort)beheld.Hair.ItemID);
|
||||
m_Stream.Write((byte)0); // signed, itemID offset
|
||||
m_Stream.Write((ushort)1);
|
||||
m_Stream.Write((short)0);
|
||||
m_Stream.Write((short)0);
|
||||
m_Stream.Write(beheld.Serial);
|
||||
m_Stream.Write((ushort)beheld.Hair.Hue);
|
||||
writer.Write(HairInfo.FakeSerial(corpse.Owner.Serial) - 2);
|
||||
writer.Write((ushort)corpse.Hair.ItemID);
|
||||
writer.Position++; // signed, itemID offset
|
||||
writer.Write((ushort)1);
|
||||
writer.Position += 4;
|
||||
writer.Write(corpse.Serial);
|
||||
writer.Write((ushort)corpse.Hair.Hue);
|
||||
|
||||
++written;
|
||||
}
|
||||
|
||||
if (beheld.FacialHair != null && beheld.FacialHair.ItemID > 0)
|
||||
if (corpse.FacialHair?.ItemID > 0)
|
||||
{
|
||||
m_Stream.Write(FacialHairInfo.FakeSerial(beheld.Owner) - 2);
|
||||
m_Stream.Write((ushort)beheld.FacialHair.ItemID);
|
||||
m_Stream.Write((byte)0); // signed, itemID offset
|
||||
m_Stream.Write((ushort)1);
|
||||
m_Stream.Write((short)0);
|
||||
m_Stream.Write((short)0);
|
||||
m_Stream.Write(beheld.Serial);
|
||||
m_Stream.Write((ushort)beheld.FacialHair.Hue);
|
||||
writer.Write(FacialHairInfo.FakeSerial(corpse.Owner.Serial) - 2);
|
||||
writer.Write((ushort)corpse.FacialHair.ItemID);
|
||||
writer.Position++; // signed, itemID offset
|
||||
writer.Write((ushort)1);
|
||||
writer.Position += 4;
|
||||
writer.Write(corpse.Serial);
|
||||
writer.Write((ushort)corpse.FacialHair.Hue);
|
||||
|
||||
++written;
|
||||
}
|
||||
|
||||
m_Stream.Seek(pos, SeekOrigin.Begin);
|
||||
m_Stream.Write((ushort)written);
|
||||
writer.Position = 3;
|
||||
writer.Write(written);
|
||||
|
||||
ns.Send(writer.Span);
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class CorpseContent6017 : Packet
|
||||
{
|
||||
public CorpseContent6017(Mobile beholder, Corpse beheld)
|
||||
: base(0x3C)
|
||||
public static void SendCorpseContentNew(NetState ns, Mobile beholder, Corpse corpse)
|
||||
{
|
||||
List<Item> items = beheld.EquipItems;
|
||||
int count = items.Count;
|
||||
if (ns == null)
|
||||
return;
|
||||
|
||||
if (beheld.Hair != null && beheld.Hair.ItemID > 0)
|
||||
count++;
|
||||
if (beheld.FacialHair != null && beheld.FacialHair.ItemID > 0)
|
||||
count++;
|
||||
List<Item> items = corpse.EquipItems;
|
||||
int length = 5 + items.Count * 20;
|
||||
|
||||
EnsureCapacity(5 + count * 20);
|
||||
if (corpse.Hair?.ItemID > 0)
|
||||
length += 20;
|
||||
if (corpse.FacialHair?.ItemID > 0)
|
||||
length += 20;
|
||||
|
||||
long pos = m_Stream.Position;
|
||||
SpanWriter writer = new SpanWriter(stackalloc byte[length]);
|
||||
writer.Write((byte)0x3C); // Packet ID
|
||||
writer.Write((ushort)length); // Dynamic Length
|
||||
writer.Position += 2;
|
||||
|
||||
int written = 0;
|
||||
|
||||
m_Stream.Write((ushort)0);
|
||||
ushort written = 0;
|
||||
|
||||
for (int i = 0; i < items.Count; ++i)
|
||||
{
|
||||
Item child = items[i];
|
||||
|
||||
if (!child.Deleted && child.Parent == beheld && beholder.CanSee(child))
|
||||
if (!child.Deleted && child.Parent == corpse && beholder.CanSee(child))
|
||||
{
|
||||
m_Stream.Write(child.Serial);
|
||||
m_Stream.Write((ushort)child.ItemID);
|
||||
m_Stream.Write((byte)0); // signed, itemID offset
|
||||
m_Stream.Write((ushort)child.Amount);
|
||||
m_Stream.Write((short)child.X);
|
||||
m_Stream.Write((short)child.Y);
|
||||
m_Stream.Write((byte)0); // Grid Location?
|
||||
m_Stream.Write(beheld.Serial);
|
||||
m_Stream.Write((ushort)child.Hue);
|
||||
writer.Write(child.Serial);
|
||||
writer.Write((ushort)child.ItemID);
|
||||
writer.Position++; // signed, itemID offset
|
||||
writer.Write((ushort)child.Amount);
|
||||
writer.Write((short)child.X);
|
||||
writer.Write((short)child.Y);
|
||||
writer.Position++; // grid location
|
||||
writer.Write(corpse.Serial);
|
||||
writer.Write((ushort)child.Hue);
|
||||
|
||||
++written;
|
||||
}
|
||||
}
|
||||
|
||||
if (beheld.Hair != null && beheld.Hair.ItemID > 0)
|
||||
if (corpse.Hair?.ItemID > 0)
|
||||
{
|
||||
m_Stream.Write(HairInfo.FakeSerial(beheld.Owner) - 2);
|
||||
m_Stream.Write((ushort)beheld.Hair.ItemID);
|
||||
m_Stream.Write((byte)0); // signed, itemID offset
|
||||
m_Stream.Write((ushort)1);
|
||||
m_Stream.Write((short)0);
|
||||
m_Stream.Write((short)0);
|
||||
m_Stream.Write((byte)0); // Grid Location?
|
||||
m_Stream.Write(beheld.Serial);
|
||||
m_Stream.Write((ushort)beheld.Hair.Hue);
|
||||
writer.Write(HairInfo.FakeSerial(corpse.Owner.Serial) - 2);
|
||||
writer.Write((ushort)corpse.Hair.ItemID);
|
||||
writer.Position++; // signed, itemID offset
|
||||
writer.Write((ushort)1);
|
||||
writer.Position += 5;
|
||||
writer.Write(corpse.Serial);
|
||||
writer.Write((ushort)corpse.Hair.Hue);
|
||||
|
||||
++written;
|
||||
}
|
||||
|
||||
if (beheld.FacialHair != null && beheld.FacialHair.ItemID > 0)
|
||||
if (corpse.FacialHair?.ItemID > 0)
|
||||
{
|
||||
m_Stream.Write(FacialHairInfo.FakeSerial(beheld.Owner) - 2);
|
||||
m_Stream.Write((ushort)beheld.FacialHair.ItemID);
|
||||
m_Stream.Write((byte)0); // signed, itemID offset
|
||||
m_Stream.Write((ushort)1);
|
||||
m_Stream.Write((short)0);
|
||||
m_Stream.Write((short)0);
|
||||
m_Stream.Write((byte)0); // Grid Location?
|
||||
m_Stream.Write(beheld.Serial);
|
||||
m_Stream.Write((ushort)beheld.FacialHair.Hue);
|
||||
writer.Write(FacialHairInfo.FakeSerial(corpse.Owner.Serial) - 2);
|
||||
writer.Write((ushort)corpse.FacialHair.ItemID);
|
||||
writer.Position++; // signed, itemID offset
|
||||
writer.Write((ushort)1);
|
||||
writer.Position += 5;
|
||||
writer.Write(corpse.Serial);
|
||||
writer.Write((ushort)corpse.FacialHair.Hue);
|
||||
|
||||
++written;
|
||||
}
|
||||
|
||||
m_Stream.Seek(pos, SeekOrigin.Begin);
|
||||
m_Stream.Write((ushort)written);
|
||||
writer.Position = 3;
|
||||
writer.Write(written);
|
||||
|
||||
ns.Send(writer.Span);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue