SHARE
TWEET

GameServerInformations.cs

a guest Jun 17th, 2019 88 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using Stump.Core.IO;
  6.  
  7. namespace Stump.DofusProtocol.Types
  8. {
  9.     public class GameServerInformations
  10.     {
  11.         public const short Id = 25;
  12.         public virtual short TypeId
  13.         {
  14.             get { return Id; }
  15.         }
  16.        
  17.         public short id;
  18.         public sbyte type;
  19.         public bool isMonoAccount;
  20.         public sbyte status;
  21.         public sbyte completion;
  22.         public bool isSelectable;
  23.         public sbyte charactersCount;
  24.         public sbyte charactersSlots;
  25.         public double date;
  26.        
  27.         public GameServerInformations()
  28.         {
  29.         }
  30.        
  31.         public GameServerInformations(short id, sbyte type, bool isMonoAccount, sbyte status, sbyte completion, bool isSelectable, sbyte charactersCount, sbyte charactersSlots, double date)
  32.         {
  33.             this.id = id;
  34.             this.type = type;
  35.             this.isMonoAccount = isMonoAccount;
  36.             this.status = status;
  37.             this.completion = completion;
  38.             this.isSelectable = isSelectable;
  39.             this.charactersCount = charactersCount;
  40.             this.charactersSlots = charactersSlots;
  41.             this.date = date;
  42.         }
  43.        
  44.         public virtual void Serialize(IDataWriter writer)
  45.         {
  46.             writer.WriteVarShort(id);
  47.             writer.WriteSByte(type);
  48.             writer.WriteBoolean(isMonoAccount);
  49.             writer.WriteSByte(status);
  50.             writer.WriteSByte(completion);
  51.             writer.WriteBoolean(isSelectable);
  52.             writer.WriteSByte(charactersCount);
  53.             writer.WriteSByte(charactersSlots);
  54.             writer.WriteDouble(date);
  55.         }
  56.        
  57.         public virtual void Deserialize(IDataReader reader)
  58.         {
  59.             id = reader.ReadVarShort();
  60.             if (id < 0)
  61.                 throw new Exception("Forbidden value on id = " + id + ", it doesn't respect the following condition : id < 0");
  62.             type = reader.ReadSByte();
  63.             isMonoAccount = reader.ReadBoolean();
  64.             status = reader.ReadSByte();
  65.             completion = reader.ReadSByte();
  66.             isSelectable = reader.ReadBoolean();
  67.             charactersCount = reader.ReadSByte();
  68.             if (charactersCount < 0)
  69.                 throw new Exception("Forbidden value on charactersCount = " + charactersCount + ", it doesn't respect the following condition : charactersCount < 0");
  70.             charactersSlots = reader.ReadSByte();
  71.             if (charactersSlots < 0)
  72.                 throw new Exception("Forbidden value on charactersSlots = " + charactersSlots + ", it doesn't respect the following condition : charactersSlots < 0");
  73.             date = reader.ReadDouble();
  74.             if (date < -9007199254740990 || date > 9007199254740990)
  75.                 throw new Exception("Forbidden value on date = " + date + ", it doesn't respect the following condition : date < -9007199254740990 || date > 9007199254740990");
  76.         }
  77.        
  78.        
  79.     }
  80.    
  81. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top