Advertisement
Guest User

GameServerInformations

a guest
Apr 15th, 2019
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.70 KB | None | 0 0
  1. namespace Stump.DofusProtocol.Types
  2. {
  3.     public class GameServerInformations
  4.     {
  5.         public const short Id = 25;
  6.         public virtual short TypeId
  7.         {
  8.             get { return Id; }
  9.         }
  10.  
  11.         public short id;
  12.         public sbyte type;
  13.         public sbyte status;
  14.         public sbyte completion;
  15.         public bool isSelectable;
  16.         public sbyte charactersCount;
  17.         public sbyte charactersSlots;
  18.         public double date;
  19.  
  20.         public GameServerInformations()
  21.         {
  22.         }
  23.  
  24.         public GameServerInformations(short id, sbyte type, sbyte status, sbyte completion, bool isSelectable, sbyte charactersCount, sbyte charactersSlots, double date)
  25.         {
  26.             this.id = id;
  27.             this.type = type;
  28.             this.status = status;
  29.             this.completion = completion;
  30.             this.isSelectable = isSelectable;
  31.             this.charactersCount = charactersCount;
  32.             this.charactersSlots = charactersSlots;
  33.             this.date = date;
  34.         }
  35.  
  36.         public virtual void Serialize(IDataWriter writer)
  37.         {
  38.             writer.WriteVarShort(id);
  39.             writer.WriteSByte(type);
  40.             writer.WriteSByte(status);
  41.             writer.WriteSByte(completion);
  42.             writer.WriteBoolean(isSelectable);
  43.             writer.WriteSByte(charactersCount);
  44.             writer.WriteSByte(charactersSlots);
  45.             writer.WriteDouble(date);
  46.         }
  47.  
  48.         public virtual void Deserialize(IDataReader reader)
  49.         {
  50.             id = reader.ReadVarShort();
  51.             if (id < 0)
  52.                 throw new Exception("Forbidden value on id = " + id + ", it doesn't respect the following condition : id < 0");
  53.             type = reader.ReadSByte();
  54.             status = reader.ReadSByte();
  55.             completion = reader.ReadSByte();
  56.             isSelectable = reader.ReadBoolean();
  57.             charactersCount = reader.ReadSByte();
  58.             if (charactersCount < 0)
  59.                 throw new Exception("Forbidden value on charactersCount = " + charactersCount + ", it doesn't respect the following condition : charactersCount < 0");
  60.             charactersSlots = reader.ReadSByte();
  61.             if (charactersSlots < 0)
  62.                 throw new Exception("Forbidden value on charactersSlots = " + charactersSlots + ", it doesn't respect the following condition : charactersSlots < 0");
  63.             date = reader.ReadDouble();
  64.             if (date < -9007199254740990 || date > 9007199254740990)
  65.                 throw new Exception("Forbidden value on date = " + date + ", it doesn't respect the following condition : date < -9007199254740990 || date > 9007199254740990");
  66.         }
  67.  
  68.  
  69.     }
  70.  
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement