public override void Deserialize(IDataReader reader) { base.Deserialize(reader); lifePoints = reader.ReadVarInt(); if (lifePoints < 0) { throw new Exception("Forbidden value on lifePoints = " + lifePoints + ", it doesn't respect the following condition : lifePoints < 0"); } maxLifePoints = reader.ReadVarInt(); if (maxLifePoints < 0) { throw new Exception("Forbidden value on maxLifePoints = " + maxLifePoints + ", it doesn't respect the following condition : maxLifePoints < 0"); } prospecting = reader.ReadVarShort(); if (prospecting < 0) { throw new Exception("Forbidden value on prospecting = " + prospecting + ", it doesn't respect the following condition : prospecting < 0"); } regenRate = reader.ReadSByte(); if (regenRate < 0 || regenRate > 255) { throw new Exception("Forbidden value on regenRate = " + regenRate + ", it doesn't respect the following condition : regenRate < 0 || regenRate > 255"); } initiative = reader.ReadVarShort(); if (initiative < 0) { throw new Exception("Forbidden value on initiative = " + initiative + ", it doesn't respect the following condition : initiative < 0"); } alignmentSide = reader.ReadSByte(); worldX = reader.ReadShort(); if (worldX < -255 || worldX > 255) { throw new Exception("Forbidden value on worldX = " + worldX + ", it doesn't respect the following condition : worldX < -255 || worldX > 255"); } worldY = reader.ReadShort(); if (worldY < -255 || worldY > 255) { throw new Exception("Forbidden value on worldY = " + worldY + ", it doesn't respect the following condition : worldY < -255 || worldY > 255"); } mapId = reader.ReadInt(); subAreaId = reader.ReadVarShort(); if (subAreaId < 0) { throw new Exception("Forbidden value on subAreaId = " + subAreaId + ", it doesn't respect the following condition : subAreaId < 0"); } status = Types.ProtocolTypeManager.GetInstance <PlayerStatus>(reader.ReadShort()); status.Deserialize(reader); var limit = reader.ReadShort(); var companions_ = new Types.PartyCompanionMemberInformations[limit]; for (int i = 0; i < limit; i++) { companions_[i] = new Types.PartyCompanionMemberInformations(); companions_[i].Deserialize(reader); } companions = companions_; }
public override void Deserialize(BigEndianReader reader) { base.Deserialize(reader); lifePoints = reader.ReadVarInt(); if (lifePoints < 0) throw new Exception("Forbidden value on lifePoints = " + lifePoints + ", it doesn't respect the following condition : lifePoints < 0"); maxLifePoints = reader.ReadVarInt(); if (maxLifePoints < 0) throw new Exception("Forbidden value on maxLifePoints = " + maxLifePoints + ", it doesn't respect the following condition : maxLifePoints < 0"); prospecting = reader.ReadVarShort(); if (prospecting < 0) throw new Exception("Forbidden value on prospecting = " + prospecting + ", it doesn't respect the following condition : prospecting < 0"); regenRate = reader.ReadByte(); if (regenRate < 0 || regenRate > 255) throw new Exception("Forbidden value on regenRate = " + regenRate + ", it doesn't respect the following condition : regenRate < 0 || regenRate > 255"); initiative = reader.ReadVarShort(); if (initiative < 0) throw new Exception("Forbidden value on initiative = " + initiative + ", it doesn't respect the following condition : initiative < 0"); alignmentSide = reader.ReadSByte(); worldX = reader.ReadShort(); if (worldX < -255 || worldX > 255) throw new Exception("Forbidden value on worldX = " + worldX + ", it doesn't respect the following condition : worldX < -255 || worldX > 255"); worldY = reader.ReadShort(); if (worldY < -255 || worldY > 255) throw new Exception("Forbidden value on worldY = " + worldY + ", it doesn't respect the following condition : worldY < -255 || worldY > 255"); mapId = reader.ReadInt(); subAreaId = reader.ReadVarShort(); if (subAreaId < 0) throw new Exception("Forbidden value on subAreaId = " + subAreaId + ", it doesn't respect the following condition : subAreaId < 0"); status = Types.ProtocolTypeManager.GetInstance<Types.PlayerStatus>(reader.ReadShort()); status.Deserialize(reader); var limit = reader.ReadUShort(); companions = new Types.PartyCompanionMemberInformations[limit]; for (int i = 0; i < limit; i++) { companions[i] = new Types.PartyCompanionMemberInformations(); companions[i].Deserialize(reader); } }