public static PersistantPlayer DeserializeLengthDelimited(Stream stream) { PersistantPlayer persistantPlayer = Pool.Get <PersistantPlayer>(); PersistantPlayer.DeserializeLengthDelimited(stream, persistantPlayer, false); return(persistantPlayer); }
public static BasePlayer DeserializeLengthDelimited(Stream stream, BasePlayer instance, bool isDelta) { long position = (long)ProtocolParser.ReadUInt32(stream); position += stream.Position; while (stream.Position < position) { int num = stream.ReadByte(); if (num == -1) { throw new EndOfStreamException(); } if (num <= 50) { if (num <= 16) { if (num == 10) { instance.name = ProtocolParser.ReadString(stream); continue; } else if (num == 16) { instance.userid = ProtocolParser.ReadUInt64(stream); continue; } } else if (num == 26) { if (instance.inventory != null) { PlayerInventory.DeserializeLengthDelimited(stream, instance.inventory, isDelta); continue; } else { instance.inventory = PlayerInventory.DeserializeLengthDelimited(stream); continue; } } else if (num != 34) { if (num == 50) { if (instance.modelState != null) { ModelState.DeserializeLengthDelimited(stream, instance.modelState, isDelta); continue; } else { instance.modelState = ModelState.DeserializeLengthDelimited(stream); continue; } } } else if (instance.metabolism != null) { PlayerMetabolism.DeserializeLengthDelimited(stream, instance.metabolism, isDelta); continue; } else { instance.metabolism = PlayerMetabolism.DeserializeLengthDelimited(stream); continue; } } else if (num <= 64) { if (num == 56) { instance.playerFlags = (int)ProtocolParser.ReadUInt64(stream); continue; } else if (num == 64) { instance.heldEntity = ProtocolParser.ReadUInt32(stream); continue; } } else if (num == 77) { instance.health = ProtocolParser.ReadSingle(stream); continue; } else if (num != 82) { if (num == 125) { instance.skinCol = ProtocolParser.ReadSingle(stream); continue; } } else if (instance.persistantData != null) { PersistantPlayer.DeserializeLengthDelimited(stream, instance.persistantData, isDelta); continue; } else { instance.persistantData = PersistantPlayer.DeserializeLengthDelimited(stream); continue; } Key key = ProtocolParser.ReadKey((byte)num, stream); uint field = key.Field; if (field == 0) { throw new ProtocolBufferException("Invalid field id: 0, something went wrong in the stream"); } switch (field) { case 16: { if (key.WireType != Wire.Fixed32) { continue; } instance.skinTex = ProtocolParser.ReadSingle(stream); continue; } case 17: { if (key.WireType != Wire.Fixed32) { continue; } instance.skinMesh = ProtocolParser.ReadSingle(stream); continue; } case 18: case 19: { ProtocolParser.SkipKey(stream, key); continue; } case 20: { if (key.WireType != Wire.LengthDelimited) { continue; } if (instance.currentLife != null) { PlayerLifeStory.DeserializeLengthDelimited(stream, instance.currentLife, isDelta); continue; } else { instance.currentLife = PlayerLifeStory.DeserializeLengthDelimited(stream); continue; } } case 21: { if (key.WireType != Wire.LengthDelimited) { continue; } if (instance.previousLife != null) { PlayerLifeStory.DeserializeLengthDelimited(stream, instance.previousLife, isDelta); continue; } else { instance.previousLife = PlayerLifeStory.DeserializeLengthDelimited(stream); continue; } } case 22: { if (key.WireType != Wire.Varint) { continue; } instance.mounted = ProtocolParser.ReadUInt32(stream); continue; } case 23: { if (key.WireType != Wire.Varint) { continue; } instance.currentTeam = ProtocolParser.ReadUInt64(stream); continue; } default: { goto case 19; } } } if (stream.Position != position) { throw new ProtocolBufferException("Read past max limit"); } return(instance); }