예제 #1
0
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            int version = reader.ReadInt();

            switch ( version )
            {
                case 6:
                {
                        m_IDList = reader.ReadStrongMobileList();
                        goto case 5;
                }
                case 5:
                {
                    m_Identified = reader.ReadBool();
                    m_Charges = reader.ReadInt();
                    m_ClothEffect = (ClothEffect)reader.ReadEncodedInt();

                    SaveFlag flags = (SaveFlag)reader.ReadEncodedInt();

                    if ( GetSaveFlag( flags, SaveFlag.Resource ) )
                        m_Resource = (CraftResource)reader.ReadEncodedInt();
                    else
                        m_Resource = DefaultResource;

                    if ( GetSaveFlag( flags, SaveFlag.Attributes ) )
                        m_AosAttributes = new AosAttributes( this, reader );
                    else
                        m_AosAttributes = new AosAttributes( this );

                    if ( GetSaveFlag( flags, SaveFlag.ClothingAttributes ) )
                        m_AosClothingAttributes = new AosArmorAttributes( this, reader );
                    else
                        m_AosClothingAttributes = new AosArmorAttributes( this );

                    if ( GetSaveFlag( flags, SaveFlag.SkillBonuses ) )
                        m_AosSkillBonuses = new AosSkillBonuses( this, reader );
                    else
                        m_AosSkillBonuses = new AosSkillBonuses( this );

                    if ( GetSaveFlag( flags, SaveFlag.Resistances ) )
                        m_AosResistances = new AosElementAttributes( this, reader );
                    else
                        m_AosResistances = new AosElementAttributes( this );

                    if ( GetSaveFlag( flags, SaveFlag.MaxHitPoints ) )
                        m_MaxHitPoints = reader.ReadEncodedInt();

                    if ( GetSaveFlag( flags, SaveFlag.HitPoints ) )
                        m_HitPoints = reader.ReadEncodedInt();

                    if ( GetSaveFlag( flags, SaveFlag.Crafter ) )
                        m_Crafter = reader.ReadMobile();

                    if ( GetSaveFlag( flags, SaveFlag.Quality ) )
                        m_Quality = (ClothingQuality)reader.ReadEncodedInt();
                    else
                        m_Quality = ClothingQuality.Regular;

                    if ( GetSaveFlag( flags, SaveFlag.StrReq ) )
                        m_StrReq = reader.ReadEncodedInt();
                    else
                        m_StrReq = -1;

                    if ( GetSaveFlag( flags, SaveFlag.PlayerConstructed ) )
                        m_PlayerConstructed = true;

                    break;
                }
                case 4:
                {
                    m_Resource = (CraftResource)reader.ReadInt();

                    goto case 3;
                }
                case 3:
                {
                    m_AosAttributes = new AosAttributes( this, reader );
                    m_AosClothingAttributes = new AosArmorAttributes( this, reader );
                    m_AosSkillBonuses = new AosSkillBonuses( this, reader );
                    m_AosResistances = new AosElementAttributes( this, reader );

                    goto case 2;
                }
                case 2:
                {
                    m_PlayerConstructed = reader.ReadBool();
                    goto case 1;
                }
                case 1:
                {
                    m_Crafter = reader.ReadMobile();
                    m_Quality = (ClothingQuality)reader.ReadInt();
                    break;
                }
                case 0:
                {
                    m_Crafter = null;
                    m_Quality = ClothingQuality.Regular;
                    break;
                }
            }

            if ( version < 2 )
                m_PlayerConstructed = true; // we don't know, so, assume it's crafted

            if ( version < 3 )
            {
                m_AosAttributes = new AosAttributes( this );
                m_AosClothingAttributes = new AosArmorAttributes( this );
                m_AosSkillBonuses = new AosSkillBonuses( this );
                m_AosResistances = new AosElementAttributes( this );
            }

            if ( version < 4 )
                m_Resource = DefaultResource;

            if ( m_MaxHitPoints == 0 && m_HitPoints == 0 )
                m_HitPoints = m_MaxHitPoints = Utility.RandomMinMax( InitMinHits, InitMaxHits );

            Mobile parent = Parent as Mobile;

            if ( parent != null )
            {
                if ( Core.AOS )
                    m_AosSkillBonuses.AddTo( parent );

                AddStatBonuses( parent );
                parent.CheckStatTimers();
            }
        }
예제 #2
0
        public BaseClothing( int itemID, Layer layer, int hue, ClothEffect effect, int charges )
            : base(itemID)
        {
            Layer = layer;
            Hue = hue;

            m_Resource = DefaultResource;
            m_Quality = ClothingQuality.Regular;
            m_ClothEffect = effect;
            m_Charges = charges;
            m_Identified = false;
            m_IDList = new List<Mobile>();

            m_HitPoints = m_MaxHitPoints = Utility.RandomMinMax( InitMinHits, InitMaxHits );

            m_AosAttributes = new AosAttributes( this );
            m_AosClothingAttributes = new AosArmorAttributes( this );
            m_AosSkillBonuses = new AosSkillBonuses( this );
            m_AosResistances = new AosElementAttributes( this );
        }