fix: Moves accounting, entity, 0xBF, and house packets to UOContent project (#1337)

This commit is contained in:
Marcelo Paez Sequeira 2023-02-09 23:42:57 -03:00 committed by GitHub
parent 3cf6db73f0
commit a8d8db8f59
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 24 additions and 22 deletions

View file

@ -48,7 +48,7 @@ public partial class NetState : IComparable<NetState>
private const int MenuCap = 512;
private const int PacketPerSecondThreshold = 3000;
private static GCHandle[] _polledStates = new GCHandle[2048];
private static readonly GCHandle[] _polledStates = new GCHandle[2048];
private static readonly IPollGroup _pollGroup = PollGroup.Create();
private static readonly Queue<NetState> _flushPending = new(2048);
private static readonly Queue<NetState> _flushedPartials = new(256);
@ -67,8 +67,6 @@ public partial class NetState : IComparable<NetState>
private readonly long[] _packetCounts = new long[0x100];
private string _disconnectReason = string.Empty;
internal int _authId;
internal int _seed;
internal ParserState _parserState = ParserState.AwaitingNextPacket;
internal ProtocolState _protocolState = ProtocolState.AwaitingSeed;
internal GCHandle _handle;
@ -166,6 +164,10 @@ public partial class NetState : IComparable<NetState>
}
}
public int AuthId { get; set; }
public int Seed { get; set; }
public DateTime ConnectedOn { get; }
public TimeSpan ConnectedFor => Core.Now - ConnectedOn;
@ -611,15 +613,15 @@ public partial class NetState : IComparable<NetState>
}
else if (length >= 4)
{
int seed = (packetId << 24) | (packetReader.ReadByte() << 16) | (packetReader.ReadByte() << 8) | packetReader.ReadByte();
int newSeed = (packetId << 24) | (packetReader.ReadByte() << 16) | (packetReader.ReadByte() << 8) | packetReader.ReadByte();
if (seed == 0)
if (newSeed == 0)
{
HandleError(0, 0);
return;
}
_seed = seed;
Seed = newSeed;
packetLength = 4;
_parserState = ParserState.AwaitingNextPacket;