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

            int version = reader.ReadInt();

            switch ( version )
            {
                case 4:
                    {
                        m_MaxHitPoints = reader.ReadEncodedInt();
                        m_HitPoints = reader.ReadEncodedInt();

                        goto case 3;
                    }
                case 3:
                    {
                        m_Slayer = (SlayerName) reader.ReadInt();
                        m_Slayer2 = (SlayerName) reader.ReadInt();

                        goto case 2;
                    }
                case 2:
                    {
                        m_Ownable = (bool) reader.ReadBool();
                        m_Owner = (Mobile) reader.ReadMobile();
                        m_CraftBonusRegular = (CraftList) reader.ReadInt();
                        m_CraftBonusRegularValue = reader.ReadInt();
                        m_CraftBonusExcep = (CraftList) reader.ReadInt();
                        m_CraftBonusExcepValue = reader.ReadInt();
                        m_ProtectionEntry = (NPC_Name) reader.ReadInt();
                        m_ProtectionValue = reader.ReadInt();
                        m_KillersEntry = (NPC_Name) reader.ReadInt();
                        m_KillersValue = reader.ReadInt();
                        m_TalisSlayer = (TalisSlayerName) reader.ReadInt();
                        m_TalismanType = (TalismanType) reader.ReadInt();
                        m_Charges = reader.ReadInt();

                        goto case 1;
                    }
                case 1:
                    {
                        m_MagicalAttributes = new MagicalAttributes( this, reader );
                        m_AosResistances = new ElementAttributes( this, reader );
                        m_SkillBonuses = new SkillBonuses( this, reader );

                        if ( Parent is Mobile )
                        {
                            //-------- Charged Time Left -----------

                            m_isequiped = true;
                            InvalidateProperties();

                            //------ FIN Charged Time Left ---------
                            m_SkillBonuses.AddTo( (Mobile) Parent );
                        }

                        int strBonus = m_MagicalAttributes.BonusStr;
                        int dexBonus = m_MagicalAttributes.BonusDex;
                        int intBonus = m_MagicalAttributes.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();

                        break;
                    }
                case 0:
                    {
                        if ( Parent is Mobile )
                        {
                            //-------- Charged Time Left -----------

                            m_isequiped = true;
                            InvalidateProperties();

                            //------ FIN Charged Time Left ---------
                            m_SkillBonuses.AddTo( (Mobile) Parent );
                        }
                        m_MagicalAttributes = new MagicalAttributes( this );
                        m_AosResistances = new ElementAttributes( this );
                        m_SkillBonuses = new SkillBonuses( this );

                        break;
                    }
            }

            if ( version < 2 )
            {
                m_Ownable = (bool) reader.ReadBool();
                m_Owner = (Mobile) reader.ReadMobile();
                m_CraftBonusRegular = (CraftList) reader.ReadInt();
                m_CraftBonusRegularValue = reader.ReadInt();
                m_CraftBonusExcep = (CraftList) reader.ReadInt();
                m_CraftBonusExcepValue = reader.ReadInt();
                m_ProtectionEntry = (NPC_Name) reader.ReadInt();
                m_ProtectionValue = reader.ReadInt();
                m_KillersEntry = (NPC_Name) reader.ReadInt();
                m_KillersValue = reader.ReadInt();
                m_TalisSlayer = (TalisSlayerName) reader.ReadInt();
                m_TalismanType = (TalismanType) reader.ReadInt();
                m_Charges = reader.ReadInt();
            }
        }
예제 #2
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 4:
            {
                m_MaxHitPoints = reader.ReadEncodedInt();
                m_HitPoints    = reader.ReadEncodedInt();

                goto case 3;
            }

            case 3:
            {
                m_Slayer  = (SlayerName)reader.ReadInt();
                m_Slayer2 = (SlayerName)reader.ReadInt();

                goto case 2;
            }

            case 2:
            {
                m_Ownable                = (bool)reader.ReadBool();
                m_Owner                  = (Mobile)reader.ReadMobile();
                m_CraftBonusRegular      = (CraftList)reader.ReadInt();
                m_CraftBonusRegularValue = reader.ReadInt();
                m_CraftBonusExcep        = (CraftList)reader.ReadInt();
                m_CraftBonusExcepValue   = reader.ReadInt();
                m_ProtectionEntry        = (NPC_Name)reader.ReadInt();
                m_ProtectionValue        = reader.ReadInt();
                m_KillersEntry           = (NPC_Name)reader.ReadInt();
                m_KillersValue           = reader.ReadInt();
                m_TalisSlayer            = (TalisSlayerName)reader.ReadInt();
                m_TalismanType           = (TalismanType)reader.ReadInt();
                m_Charges                = reader.ReadInt();

                goto case 1;
            }

            case 1:
            {
                m_MagicalAttributes = new MagicalAttributes(this, reader);
                m_AosResistances    = new ElementAttributes(this, reader);
                m_SkillBonuses      = new SkillBonuses(this, reader);

                if (Parent is Mobile)
                {
                    //-------- Charged Time Left -----------

                    m_isequiped = true;
                    InvalidateProperties();

                    //------ FIN Charged Time Left ---------
                    m_SkillBonuses.AddTo((Mobile)Parent);
                }

                int strBonus = m_MagicalAttributes.BonusStr;
                int dexBonus = m_MagicalAttributes.BonusDex;
                int intBonus = m_MagicalAttributes.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();
                }

                break;
            }

            case 0:
            {
                if (Parent is Mobile)
                {
                    //-------- Charged Time Left -----------

                    m_isequiped = true;
                    InvalidateProperties();

                    //------ FIN Charged Time Left ---------
                    m_SkillBonuses.AddTo((Mobile)Parent);
                }
                m_MagicalAttributes = new MagicalAttributes(this);
                m_AosResistances    = new ElementAttributes(this);
                m_SkillBonuses      = new SkillBonuses(this);

                break;
            }
            }

            if (version < 2)
            {
                m_Ownable                = (bool)reader.ReadBool();
                m_Owner                  = (Mobile)reader.ReadMobile();
                m_CraftBonusRegular      = (CraftList)reader.ReadInt();
                m_CraftBonusRegularValue = reader.ReadInt();
                m_CraftBonusExcep        = (CraftList)reader.ReadInt();
                m_CraftBonusExcepValue   = reader.ReadInt();
                m_ProtectionEntry        = (NPC_Name)reader.ReadInt();
                m_ProtectionValue        = reader.ReadInt();
                m_KillersEntry           = (NPC_Name)reader.ReadInt();
                m_KillersValue           = reader.ReadInt();
                m_TalisSlayer            = (TalisSlayerName)reader.ReadInt();
                m_TalismanType           = (TalismanType)reader.ReadInt();
                m_Charges                = reader.ReadInt();
            }
        }