static Packets() { //Authentication Register <AuthenticationPacket>(AuthenticationPacket.Read); Register <AuthenticationReplyPacket>(AuthenticationReplyPacket.Read); Register <LoginSuccessPacket>(LoginSuccessPacket.Read); //Menu Register <OpenCharacterListPacket>(OpenCharacterListPacket.Read); Register <NewCharacterDBPacket>(NewCharacterDBPacket.Read); Register <AddCharacterPacket>(AddCharacterPacket.Read); //Space Register <PositionUpdatePacket>(PositionUpdatePacket.Read); Register <ObjectUpdatePacket>(ObjectUpdatePacket.Read); //Protocol GeneratedProtocol.RegisterPackets(); }
public void ProcessPacket(IPacket packet) { if (ResponseHandler.HandlePacket(packet)) { return; } try { var hsp = GeneratedProtocol.HandleServerPacket(packet, this, this); hsp.Wait(); if (hsp.Result) { return; } } catch (Exception e) { FLLog.Exception("Player", e); throw; } try { switch (packet) { case PositionUpdatePacket p: //TODO: Error handling World?.PositionUpdate(this, p.Position, p.Orientation, p.Speed); break; } } catch (Exception e) { FLLog.Exception("Player", e); throw; } }