Ejemplo n.º 1
0
    // Version 7 (pre-codegen)
    private void Deserialize(IGenericReader reader, int version)
    {
        var flags = (OldSaveFlag)reader.ReadEncodedInt();

        Attributes = new AosAttributes(this);

        if (GetSaveFlag(flags, OldSaveFlag.Attributes))
        {
            Attributes.Deserialize(reader);
        }

        ArmorAttributes = new AosArmorAttributes(this);

        if (GetSaveFlag(flags, OldSaveFlag.ArmorAttributes))
        {
            ArmorAttributes.Deserialize(reader);
        }

        if (GetSaveFlag(flags, OldSaveFlag.PhysicalBonus))
        {
            _physicalBonus = reader.ReadEncodedInt();
        }

        if (GetSaveFlag(flags, OldSaveFlag.FireBonus))
        {
            _fireBonus = reader.ReadEncodedInt();
        }

        if (GetSaveFlag(flags, OldSaveFlag.ColdBonus))
        {
            _coldBonus = reader.ReadEncodedInt();
        }

        if (GetSaveFlag(flags, OldSaveFlag.PoisonBonus))
        {
            _poisonBonus = reader.ReadEncodedInt();
        }

        if (GetSaveFlag(flags, OldSaveFlag.EnergyBonus))
        {
            _energyBonus = reader.ReadEncodedInt();
        }

        _identified = GetSaveFlag(flags, OldSaveFlag.Identified);

        if (GetSaveFlag(flags, OldSaveFlag.MaxHitPoints))
        {
            _maxHitPoints = reader.ReadEncodedInt();
        }

        if (GetSaveFlag(flags, OldSaveFlag.HitPoints))
        {
            _hitPoints = reader.ReadEncodedInt();
        }

        if (GetSaveFlag(flags, OldSaveFlag.Crafter))
        {
            var crafter = reader.ReadEntity <Mobile>();
            Timer.StartTimer(() => _crafter = crafter?.RawName);
        }

        if (GetSaveFlag(flags, OldSaveFlag.Quality))
        {
            _quality = (ArmorQuality)reader.ReadEncodedInt();
        }

        if (GetSaveFlag(flags, OldSaveFlag.Durability))
        {
            _durability = (ArmorDurabilityLevel)reader.ReadEncodedInt();
        }

        if (GetSaveFlag(flags, OldSaveFlag.Protection))
        {
            _protection = (ArmorProtectionLevel)reader.ReadEncodedInt();
        }

        if (GetSaveFlag(flags, OldSaveFlag.Resource))
        {
            _rawResource = (CraftResource)reader.ReadEncodedInt();
        }

        if (GetSaveFlag(flags, OldSaveFlag.BaseArmor))
        {
            _armorBase = reader.ReadEncodedInt();
        }

        if (GetSaveFlag(flags, OldSaveFlag.StrBonus))
        {
            _strBonus = reader.ReadEncodedInt();
        }

        if (GetSaveFlag(flags, OldSaveFlag.DexBonus))
        {
            _dexBonus = reader.ReadEncodedInt();
        }

        if (GetSaveFlag(flags, OldSaveFlag.IntBonus))
        {
            _intBonus = reader.ReadEncodedInt();
        }

        if (GetSaveFlag(flags, OldSaveFlag.StrReq))
        {
            _strReq = reader.ReadEncodedInt();
        }

        if (GetSaveFlag(flags, OldSaveFlag.DexReq))
        {
            _dexReq = reader.ReadEncodedInt();
        }

        if (GetSaveFlag(flags, OldSaveFlag.IntReq))
        {
            _intReq = reader.ReadEncodedInt();
        }

        if (GetSaveFlag(flags, OldSaveFlag.MedAllowance))
        {
            _meditate = (AMA)reader.ReadEncodedInt();
        }

        SkillBonuses = new AosSkillBonuses(this);

        if (GetSaveFlag(flags, OldSaveFlag.SkillBonuses))
        {
            SkillBonuses.Deserialize(reader);
        }

        PlayerConstructed = GetSaveFlag(flags, OldSaveFlag.PlayerConstructed);
    }
Ejemplo n.º 2
0
    // Version 5 (pre-codegen)
    private void Deserialize(IGenericReader reader, int version)
    {
        var flags = (OldSaveFlag)reader.ReadEncodedInt();

        if (GetSaveFlag(flags, OldSaveFlag.Resource))
        {
            _rawResource = (CraftResource)reader.ReadEncodedInt();
        }
        else
        {
            _rawResource = DefaultResource;
        }

        Attributes = new AosAttributes(this);

        if (GetSaveFlag(flags, OldSaveFlag.Attributes))
        {
            Attributes.Deserialize(reader);
        }

        ClothingAttributes = new AosArmorAttributes(this);

        if (GetSaveFlag(flags, OldSaveFlag.ClothingAttributes))
        {
            ClothingAttributes.Deserialize(reader);
        }

        SkillBonuses = new AosSkillBonuses(this);

        if (GetSaveFlag(flags, OldSaveFlag.SkillBonuses))
        {
            SkillBonuses.Deserialize(reader);
        }

        Resistances = new AosElementAttributes(this);

        if (GetSaveFlag(flags, OldSaveFlag.Resistances))
        {
            Resistances.Deserialize(reader);
        }

        if (GetSaveFlag(flags, OldSaveFlag.MaxHitPoints))
        {
            _maxHitPoints = reader.ReadEncodedInt();
        }

        if (GetSaveFlag(flags, OldSaveFlag.HitPoints))
        {
            _hitPoints = reader.ReadEncodedInt();
        }

        if (GetSaveFlag(flags, OldSaveFlag.Crafter))
        {
            var crafter = reader.ReadEntity <Mobile>();
            Timer.StartTimer(() => _crafter = crafter?.RawName);
        }

        if (GetSaveFlag(flags, OldSaveFlag.Quality))
        {
            _quality = (ClothingQuality)reader.ReadEncodedInt();
        }

        if (GetSaveFlag(flags, OldSaveFlag.StrReq))
        {
            _strReq = reader.ReadEncodedInt();
        }

        PlayerConstructed = GetSaveFlag(flags, OldSaveFlag.PlayerConstructed);
    }