fix(core): Fixes map issues at New Haven (#509)
- [X] Fixes map issues at New Haven by turning off static diffs - [X] Some code cleanup and reformatting of tile matrix, tile matrix patch, and tile data - [X] Adds NetState.Flush for generating spawners so it doesn't feel like the server is frozen - [X] Reverts NativeReader changes from a while back. - [X] Adds more string reading for BufferReader. Notes: BufferReader is still `little endian` compared to `SpanReader` which is `big endian` (for packets). To that end, the RunUO deserialization `ReadString()` was made obsolete since it is ambiguous, and contains extra fields other than simply reading a string. Furthermore, we shouldn't be using UTF8 (for now) since it is slow.
This commit is contained in:
parent
d070efeab3
commit
ea5d09a7d7
21 changed files with 724 additions and 482 deletions
|
|
@ -22,28 +22,55 @@ namespace Server.Network
|
|||
{
|
||||
public static void SendMapPatches(this NetState ns)
|
||||
{
|
||||
if (ns == null)
|
||||
if (ns == null || ns.ProtocolChanges >= ProtocolChanges.Version6000)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var writer = new SpanWriter(stackalloc byte[41]);
|
||||
int count;
|
||||
|
||||
if (ns.HasFlag(ClientFlags.TerMur))
|
||||
{
|
||||
count = 6;
|
||||
}
|
||||
else if (ns.HasFlag(ClientFlags.Tokuno))
|
||||
{
|
||||
count = 5;
|
||||
}
|
||||
else if (ns.HasFlag(ClientFlags.Malas))
|
||||
{
|
||||
count = 4;
|
||||
}
|
||||
else if (ns.HasFlag(ClientFlags.Ilshenar))
|
||||
{
|
||||
count = 3;
|
||||
}
|
||||
else if (ns.HasFlag(ClientFlags.Trammel))
|
||||
{
|
||||
count = 2;
|
||||
}
|
||||
else if (ns.HasFlag(ClientFlags.Felucca))
|
||||
{
|
||||
count = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var writer = new SpanWriter(stackalloc byte[9 + count * 8]);
|
||||
writer.Write((byte)0xBF); // Packet ID
|
||||
writer.Write((ushort)41); // Length
|
||||
writer.Write((ushort)0x18); // Subpacket
|
||||
writer.Write(4); // Map count?
|
||||
writer.Write(count);
|
||||
|
||||
writer.Write(Map.Felucca.Tiles.Patch.StaticBlocks);
|
||||
writer.Write(Map.Felucca.Tiles.Patch.LandBlocks);
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
var map = Map.Maps[i];
|
||||
|
||||
writer.Write(Map.Trammel.Tiles.Patch.StaticBlocks);
|
||||
writer.Write(Map.Trammel.Tiles.Patch.LandBlocks);
|
||||
|
||||
writer.Write(Map.Ilshenar.Tiles.Patch.StaticBlocks);
|
||||
writer.Write(Map.Ilshenar.Tiles.Patch.LandBlocks);
|
||||
|
||||
writer.Write(Map.Malas.Tiles.Patch.StaticBlocks);
|
||||
writer.Write(Map.Malas.Tiles.Patch.LandBlocks);
|
||||
writer.Write(map.Tiles.Patch.StaticBlocks);
|
||||
writer.Write(map.Tiles.Patch.LandBlocks);
|
||||
}
|
||||
|
||||
ns.Send(writer.Span);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue