chore(core): Cleans up networking leftovers from packet conversions (#387)

- [X] Removes span writing extensions
- [X] Removes span reading extensions
- [X] Cleans up OPL and uses uninitialized arrays

Bumps release version
This commit is contained in:
Kamron Batman 2021-01-05 01:31:52 -08:00 committed by GitHub
parent a278623f38
commit 30ef0761cb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 77 additions and 392 deletions

View file

@ -1,39 +0,0 @@
using System;
using System.Buffers;
using Server.Network;
namespace Server.Tests.Network
{
public static class AttributeNormalizerUtilities
{
public static void WriteAttribute(this Span<byte> data, ref int pos, int cur, int max, bool normalize)
{
if (normalize && AttributeNormalizer.Enabled && max != 0)
{
var maximum = AttributeNormalizer.Maximum;
data.Write(ref pos, (ushort)maximum);
data.Write(ref pos, (ushort)(cur * maximum / max));
return;
}
data.Write(ref pos, (ushort)max);
data.Write(ref pos, (ushort)cur);
}
public static void WriteReverseAttribute(this Span<byte> data, ref int pos, int cur, int max, bool normalize)
{
if (normalize && AttributeNormalizer.Enabled && max != 0)
{
var maximum = AttributeNormalizer.Maximum;
data.Write(ref pos, (ushort)(cur * maximum / max));
data.Write(ref pos, (ushort)maximum);
return;
}
data.Write(ref pos, (ushort)cur);
data.Write(ref pos, (ushort)max);
}
}
}