Server.Items.Spellbook.Deserialize C# (CSharp) Méthode

Deserialize() public méthode

public Deserialize ( Server.GenericReader reader ) : void
reader Server.GenericReader
Résultat void
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            int version = reader.ReadInt();

            switch ( version )
            {
                case 5:
                {
                    m_Quality = (BookQuality) reader.ReadByte();

                    goto case 4;
                }
                case 4:
                {
                    m_EngravedText = reader.ReadString();

                    goto case 3;
                }
                case 3:
                {
                    m_Crafter = reader.ReadMobile();
                    goto case 2;
                }
                case 2:
                {
                    m_Slayer = (SlayerName)reader.ReadInt();
                    m_Slayer2 = (SlayerName)reader.ReadInt();
                    goto case 1;
                }
                case 1:
                {
                    m_AosAttributes = new AosAttributes( this, reader );
                    m_AosSkillBonuses = new AosSkillBonuses( this, reader );

                    goto case 0;
                }
                case 0:
                {
                    m_Content = reader.ReadULong();
                    m_Count = reader.ReadInt();

                    break;
                }
            }

            if ( m_AosAttributes == null )
                m_AosAttributes = new AosAttributes( this );

            if ( m_AosSkillBonuses == null )
                m_AosSkillBonuses = new AosSkillBonuses( this );

            if ( Core.AOS && Parent is Mobile )
                m_AosSkillBonuses.AddTo( (Mobile) Parent );

            int strBonus = m_AosAttributes.BonusStr;
            int dexBonus = m_AosAttributes.BonusDex;
            int intBonus = m_AosAttributes.BonusInt;

            if ( Parent is Mobile && (strBonus != 0 || dexBonus != 0 || intBonus != 0) )
            {
                Mobile m = (Mobile)Parent;

                string modName = Serial.ToString();

                if ( strBonus != 0 )
                    m.AddStatMod( new StatMod( StatType.Str, modName + "Str", strBonus, TimeSpan.Zero ) );

                if ( dexBonus != 0 )
                    m.AddStatMod( new StatMod( StatType.Dex, modName + "Dex", dexBonus, TimeSpan.Zero ) );

                if ( intBonus != 0 )
                    m.AddStatMod( new StatMod( StatType.Int, modName + "Int", intBonus, TimeSpan.Zero ) );
            }

            if ( Parent is Mobile )
                ((Mobile)Parent).CheckStatTimers();
        }