Exemplo n.º 1
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadInt();

            int index = reader.ReadInt();

            m_BaitType = FishInfo.GetTypeFromIndex(index);

            m_Bobs         = reader.ReadInt();
            m_InUse        = reader.ReadBool();
            m_Owner        = reader.ReadMobile();
            m_BaitUses     = reader.ReadInt();
            m_EnhancedBait = reader.ReadBool();

            if (m_BaitType != null && m_BaitUses <= 0)
            {
                BaitType = null;
            }

            if (m_InUse)
            {
                StartTimer();
            }
        }
Exemplo n.º 2
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 4:
                m_PlayerConstructed = reader.ReadBool();
                m_LowerStatReq      = reader.ReadInt();
                goto case 3;

            case 3:
                m_UsesRemaining     = reader.ReadInt();
                m_ShowUsesRemaining = reader.ReadBool();
                goto case 2;

            case 2:
                m_OriginalHue = reader.ReadInt();
                int idx = reader.ReadInt();
                m_BaitType     = FishInfo.GetTypeFromIndex(idx);
                m_HookType     = (HookType)reader.ReadInt();
                m_HookUses     = reader.ReadInt();
                m_BaitUses     = reader.ReadInt();
                m_EnhancedBait = reader.ReadBool();

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

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

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

            case 1:
                m_AosAttributes   = new AosAttributes(this);
                m_AosSkillBonuses = new AosSkillBonuses(this);
                break;
            }

            if (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();
            }

            if (m_BaitType != null && m_BaitUses <= 0)
            {
                BaitType = null;
            }

            if (m_HookType != HookType.None && m_HookUses <= 0)
            {
                HookType = HookType.None;
            }

            if (version < 3 && m_Crafter != null)
            {
                m_PlayerConstructed = true;

                if (m_Resource == CraftResource.None)
                {
                    Resource = CraftResource.RegularWood;
                }
                else
                {
                    DistributeMaterialBonus();
                }
            }
        }
Exemplo n.º 3
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 2:
                m_OriginalHue = reader.ReadInt();
                int idx = reader.ReadInt();
                m_BaitType     = FishInfo.GetTypeFromIndex(idx);
                m_HookType     = (HookType)reader.ReadInt();
                m_HookUses     = reader.ReadInt();
                m_BaitUses     = reader.ReadInt();
                m_EnhancedBait = reader.ReadBool();

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

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

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

            case 1:
                m_AosAttributes   = new AosAttributes(this);
                m_AosSkillBonuses = new AosSkillBonuses(this);
                break;
            }

            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 (this.Parent is Mobile && (strBonus != 0 || dexBonus != 0 || intBonus != 0))
            {
                Mobile m = (Mobile)this.Parent;

                string modName = this.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();
            }

            if (m_BaitType != null && m_BaitUses <= 0)
            {
                BaitType = null;
            }

            if (m_HookType != HookType.None && m_HookUses <= 0)
            {
                HookType = HookType.None;
            }
        }