Esempio n. 1
0
 public override void Deserialize(JHSNetworkReader reader)
 {
     STATUS = reader.ReadByte();
     if (STATUS == SUCCESS)
     {
         REQ    = reader.ReadPackedUInt32();
         player = new DBPlayer
         {
             Base = new DBPlayerBase
             {
                 UserId   = reader.ReadPackedUInt32(),
                 PlayerId = reader.ReadPackedUInt32(),
                 ModelId  = reader.ReadByte()
             },
             Custom = new DBCustomisation
             {
                 PlayerName    = reader.ReadString(),
                 SkinColorId   = reader.ReadByte(),
                 HairColorId   = reader.ReadByte(),
                 EyeColorId    = reader.ReadByte(),
                 ShirtColorId  = reader.ReadByte(),
                 PantsColorId  = reader.ReadByte(),
                 BootsColorId  = reader.ReadByte(),
                 GlovesColorId = reader.ReadByte()
             }
         };
         int lenght = reader.ReadByte();
         player.Actives = new DBPlayerActive[lenght];
         for (int i = 0; i < lenght; i++)
         {
             player.Actives[i] = new DBPlayerActive
             {
                 ActiveId = reader.ReadPackedUInt32(),
                 Value    = reader.ReadPackedUInt32()
             };
         }
     }
 }
Esempio n. 2
0
        public override void Deserialize(JHSNetworkReader reader)
        {
            STATUS = reader.ReadByte();
            if (STATUS == SUCCESS)
            {
                TYPE   = (InfoType)reader.ReadByte();
                player = new DBPlayer
                {
                    Base = new DBPlayerBase
                    {
                        UserId = reader.ReadPackedUInt32()
                    }
                };
                switch (TYPE)
                {
                case InfoType.ACTIVE:
                    int lenght = reader.ReadByte();
                    player.Actives = new DBPlayerActive[lenght];
                    for (int i = 0; i < lenght; i++)
                    {
                        player.Actives[i] = new DBPlayerActive
                        {
                            ActiveId = reader.ReadPackedUInt32(),
                            Value    = reader.ReadPackedUInt32()
                        };
                    }
                    break;

                case InfoType.CUSTOMIZATIONS:
                    player.Custom = new DBCustomisation
                    {
                        PlayerName    = reader.ReadString(),
                        SkinColorId   = reader.ReadByte(),
                        HairColorId   = reader.ReadByte(),
                        EyeColorId    = reader.ReadByte(),
                        ShirtColorId  = reader.ReadByte(),
                        PantsColorId  = reader.ReadByte(),
                        BootsColorId  = reader.ReadByte(),
                        GlovesColorId = reader.ReadByte()
                    };
                    break;

                case InfoType.STATUS:
                    player.Status = new DBStatus
                    {
                        Level  = reader.ReadPackedUInt32(),
                        Exp    = reader.ReadPackedUInt32(),
                        MMR    = reader.ReadPackedUInt32(),
                        Kills  = reader.ReadPackedUInt32(),
                        Deaths = reader.ReadPackedUInt32(),
                        Golden = reader.ReadPackedUInt32(),
                        Silver = reader.ReadPackedUInt32()
                    };
                    break;

                case InfoType.ACTIVE_AND_STATUS:
                    player.Status = new DBStatus
                    {
                        Level  = reader.ReadPackedUInt32(),
                        Exp    = reader.ReadPackedUInt32(),
                        MMR    = reader.ReadPackedUInt32(),
                        Kills  = reader.ReadPackedUInt32(),
                        Deaths = reader.ReadPackedUInt32(),
                        Golden = reader.ReadPackedUInt32(),
                        Silver = reader.ReadPackedUInt32()
                    };
                    int lenghxt = reader.ReadByte();
                    player.Actives = new DBPlayerActive[lenghxt];
                    for (int i = 0; i < lenghxt; i++)
                    {
                        player.Actives[i] = new DBPlayerActive
                        {
                            ActiveId = reader.ReadPackedUInt32(),
                            Value    = reader.ReadPackedUInt32()
                        };
                    }
                    break;

                case InfoType.FULL:
                    player.Base.PlayerId = reader.ReadPackedUInt32();
                    player.Base.ModelId  = reader.ReadByte();
                    player.Custom        = new DBCustomisation
                    {
                        PlayerName    = reader.ReadString(),
                        SkinColorId   = reader.ReadByte(),
                        HairColorId   = reader.ReadByte(),
                        EyeColorId    = reader.ReadByte(),
                        ShirtColorId  = reader.ReadByte(),
                        PantsColorId  = reader.ReadByte(),
                        BootsColorId  = reader.ReadByte(),
                        GlovesColorId = reader.ReadByte()
                    };
                    player.Status = new DBStatus
                    {
                        Level  = reader.ReadPackedUInt32(),
                        Exp    = reader.ReadPackedUInt32(),
                        MMR    = reader.ReadPackedUInt32(),
                        Kills  = reader.ReadPackedUInt32(),
                        Deaths = reader.ReadPackedUInt32(),
                        Golden = reader.ReadPackedUInt32(),
                        Silver = reader.ReadPackedUInt32()
                    };
                    int lenghxty = reader.ReadByte();
                    player.Actives = new DBPlayerActive[lenghxty];
                    for (int i = 0; i < lenghxty; i++)
                    {
                        player.Actives[i] = new DBPlayerActive
                        {
                            ActiveId = reader.ReadPackedUInt32(),
                            Value    = reader.ReadPackedUInt32()
                        };
                    }
                    break;
                }
            }
        }