예제 #1
0
 public virtual void Deserialize(IDataReader reader)
 {
     byte flag1 = reader.ReadByte();
     sex = BooleanByteWrapper.GetFlag(flag1, 0);
     isRideable = BooleanByteWrapper.GetFlag(flag1, 1);
     isWild = BooleanByteWrapper.GetFlag(flag1, 2);
     isFecondationReady = BooleanByteWrapper.GetFlag(flag1, 3);
     id = reader.ReadDouble();
     model = reader.ReadInt();
     if (model < 0)
         throw new Exception("Forbidden value on model = " + model + ", it doesn't respect the following condition : model < 0");
     var limit = reader.ReadUShort();
     ancestor = new int[limit];
     for (int i = 0; i < limit; i++)
     {
          ancestor[i] = reader.ReadInt();
     }
     limit = reader.ReadUShort();
     behaviors = new int[limit];
     for (int i = 0; i < limit; i++)
     {
          behaviors[i] = reader.ReadInt();
     }
     name = reader.ReadUTF();
     ownerId = reader.ReadInt();
     if (ownerId < 0)
         throw new Exception("Forbidden value on ownerId = " + ownerId + ", it doesn't respect the following condition : ownerId < 0");
     experience = reader.ReadDouble();
     experienceForLevel = reader.ReadDouble();
     experienceForNextLevel = reader.ReadDouble();
     level = reader.ReadSByte();
     if (level < 0)
         throw new Exception("Forbidden value on level = " + level + ", it doesn't respect the following condition : level < 0");
     maxPods = reader.ReadInt();
     if (maxPods < 0)
         throw new Exception("Forbidden value on maxPods = " + maxPods + ", it doesn't respect the following condition : maxPods < 0");
     stamina = reader.ReadInt();
     if (stamina < 0)
         throw new Exception("Forbidden value on stamina = " + stamina + ", it doesn't respect the following condition : stamina < 0");
     staminaMax = reader.ReadInt();
     if (staminaMax < 0)
         throw new Exception("Forbidden value on staminaMax = " + staminaMax + ", it doesn't respect the following condition : staminaMax < 0");
     maturity = reader.ReadInt();
     if (maturity < 0)
         throw new Exception("Forbidden value on maturity = " + maturity + ", it doesn't respect the following condition : maturity < 0");
     maturityForAdult = reader.ReadInt();
     if (maturityForAdult < 0)
         throw new Exception("Forbidden value on maturityForAdult = " + maturityForAdult + ", it doesn't respect the following condition : maturityForAdult < 0");
     energy = reader.ReadInt();
     if (energy < 0)
         throw new Exception("Forbidden value on energy = " + energy + ", it doesn't respect the following condition : energy < 0");
     energyMax = reader.ReadInt();
     if (energyMax < 0)
         throw new Exception("Forbidden value on energyMax = " + energyMax + ", it doesn't respect the following condition : energyMax < 0");
     serenity = reader.ReadInt();
     aggressivityMax = reader.ReadInt();
     serenityMax = reader.ReadInt();
     if (serenityMax < 0)
         throw new Exception("Forbidden value on serenityMax = " + serenityMax + ", it doesn't respect the following condition : serenityMax < 0");
     love = reader.ReadInt();
     if (love < 0)
         throw new Exception("Forbidden value on love = " + love + ", it doesn't respect the following condition : love < 0");
     loveMax = reader.ReadInt();
     if (loveMax < 0)
         throw new Exception("Forbidden value on loveMax = " + loveMax + ", it doesn't respect the following condition : loveMax < 0");
     fecondationTime = reader.ReadInt();
     boostLimiter = reader.ReadInt();
     if (boostLimiter < 0)
         throw new Exception("Forbidden value on boostLimiter = " + boostLimiter + ", it doesn't respect the following condition : boostLimiter < 0");
     boostMax = reader.ReadDouble();
     reproductionCount = reader.ReadInt();
     reproductionCountMax = reader.ReadInt();
     if (reproductionCountMax < 0)
         throw new Exception("Forbidden value on reproductionCountMax = " + reproductionCountMax + ", it doesn't respect the following condition : reproductionCountMax < 0");
     limit = reader.ReadUShort();
     effectList = new Types.ObjectEffectInteger[limit];
     for (int i = 0; i < limit; i++)
     {
          effectList[i] = new Types.ObjectEffectInteger();
          effectList[i].Deserialize(reader);
     }
 }
예제 #2
0
        public virtual void Deserialize(IDataReader reader)
        {
            byte flag1 = reader.ReadByte();

            sex                = BooleanByteWrapper.GetFlag(flag1, 0);
            isRideable         = BooleanByteWrapper.GetFlag(flag1, 1);
            isWild             = BooleanByteWrapper.GetFlag(flag1, 2);
            isFecondationReady = BooleanByteWrapper.GetFlag(flag1, 3);
            id    = reader.ReadDouble();
            model = reader.ReadInt();
            if (model < 0)
            {
                throw new Exception("Forbidden value on model = " + model + ", it doesn't respect the following condition : model < 0");
            }
            var limit     = reader.ReadUShort();
            var ancestor_ = new int[limit];

            for (int i = 0; i < limit; i++)
            {
                ancestor_[i] = reader.ReadInt();
            }
            ancestor = ancestor_;
            limit    = reader.ReadUShort();
            var behaviors_ = new int[limit];

            for (int i = 0; i < limit; i++)
            {
                behaviors_[i] = reader.ReadInt();
            }
            behaviors = behaviors_;
            name      = reader.ReadUTF();
            ownerId   = reader.ReadInt();
            if (ownerId < 0)
            {
                throw new Exception("Forbidden value on ownerId = " + ownerId + ", it doesn't respect the following condition : ownerId < 0");
            }
            experience             = reader.ReadDouble();
            experienceForLevel     = reader.ReadDouble();
            experienceForNextLevel = reader.ReadDouble();
            level = reader.ReadSByte();
            if (level < 0)
            {
                throw new Exception("Forbidden value on level = " + level + ", it doesn't respect the following condition : level < 0");
            }
            maxPods = reader.ReadInt();
            if (maxPods < 0)
            {
                throw new Exception("Forbidden value on maxPods = " + maxPods + ", it doesn't respect the following condition : maxPods < 0");
            }
            stamina = reader.ReadInt();
            if (stamina < 0)
            {
                throw new Exception("Forbidden value on stamina = " + stamina + ", it doesn't respect the following condition : stamina < 0");
            }
            staminaMax = reader.ReadInt();
            if (staminaMax < 0)
            {
                throw new Exception("Forbidden value on staminaMax = " + staminaMax + ", it doesn't respect the following condition : staminaMax < 0");
            }
            maturity = reader.ReadInt();
            if (maturity < 0)
            {
                throw new Exception("Forbidden value on maturity = " + maturity + ", it doesn't respect the following condition : maturity < 0");
            }
            maturityForAdult = reader.ReadInt();
            if (maturityForAdult < 0)
            {
                throw new Exception("Forbidden value on maturityForAdult = " + maturityForAdult + ", it doesn't respect the following condition : maturityForAdult < 0");
            }
            energy = reader.ReadInt();
            if (energy < 0)
            {
                throw new Exception("Forbidden value on energy = " + energy + ", it doesn't respect the following condition : energy < 0");
            }
            energyMax = reader.ReadInt();
            if (energyMax < 0)
            {
                throw new Exception("Forbidden value on energyMax = " + energyMax + ", it doesn't respect the following condition : energyMax < 0");
            }
            serenity        = reader.ReadInt();
            aggressivityMax = reader.ReadInt();
            serenityMax     = reader.ReadInt();
            if (serenityMax < 0)
            {
                throw new Exception("Forbidden value on serenityMax = " + serenityMax + ", it doesn't respect the following condition : serenityMax < 0");
            }
            love = reader.ReadInt();
            if (love < 0)
            {
                throw new Exception("Forbidden value on love = " + love + ", it doesn't respect the following condition : love < 0");
            }
            loveMax = reader.ReadInt();
            if (loveMax < 0)
            {
                throw new Exception("Forbidden value on loveMax = " + loveMax + ", it doesn't respect the following condition : loveMax < 0");
            }
            fecondationTime = reader.ReadInt();
            boostLimiter    = reader.ReadInt();
            if (boostLimiter < 0)
            {
                throw new Exception("Forbidden value on boostLimiter = " + boostLimiter + ", it doesn't respect the following condition : boostLimiter < 0");
            }
            boostMax             = reader.ReadDouble();
            reproductionCount    = reader.ReadInt();
            reproductionCountMax = reader.ReadInt();
            if (reproductionCountMax < 0)
            {
                throw new Exception("Forbidden value on reproductionCountMax = " + reproductionCountMax + ", it doesn't respect the following condition : reproductionCountMax < 0");
            }
            limit = reader.ReadUShort();
            var effectList_ = new Types.ObjectEffectInteger[limit];

            for (int i = 0; i < limit; i++)
            {
                effectList_[i] = new Types.ObjectEffectInteger();
                effectList_[i].Deserialize(reader);
            }
            effectList = effectList_;
        }