コード例 #1
0
        public ArmourBackpack()
            : base(0xE75)
        {
            Layer = Layer.Backpack;
            Weight = 3.0;

            m_AosAttributes = new AosAttributes( this );
            m_AosArmorAttributes = new AosArmorAttributes( this );
            m_AosSkillBonuses = new AosSkillBonuses( this );
        }
コード例 #2
0
        public BaseOtherEquipable( int itemID )
            : base(itemID)
        {
            m_Quality = CraftQuality.Regular;
            Resource = DefaultResource;

            m_AosAttributes = new AosAttributes( this );
            m_AosArmorAttributes = new AosArmorAttributes( this );
            m_AosSkillBonuses = new AosSkillBonuses( this );

            m_OriginalWeight = Weight;
        }
コード例 #3
0
ファイル: BaseArmor.cs プロジェクト: FreeReign/Rebirth-Repack
        public BaseArmor( int itemID )
            : base(itemID)
        {
            m_Quality = CraftQuality.Regular;
            m_Durability = DurabilityLevel.Regular;
            m_Crafter = null;

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

            this.Layer = (Layer)ItemData.Quality;

            m_AosAttributes = new AosAttributes( this );
            m_AosArmorAttributes = new AosArmorAttributes( this );
            m_AosSkillBonuses = new AosSkillBonuses( this );
        }
コード例 #4
0
ファイル: BaseClothing.cs プロジェクト: FreeReign/forkuo
        public BaseClothing(int itemID, Layer layer, int hue)
            : base(itemID)
        {
            this.Layer = layer;
            this.Hue = hue;

            this.m_Resource = this.DefaultResource;
            this.m_Quality = ClothingQuality.Regular;

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

            this.m_AosAttributes = new AosAttributes(this);
            this.m_AosClothingAttributes = new AosArmorAttributes(this);
            this.m_AosSkillBonuses = new AosSkillBonuses(this);
            this.m_AosResistances = new AosElementAttributes(this);
        }
コード例 #5
0
ファイル: BaseArmor.cs プロジェクト: FreeReign/forkuo
        public BaseArmor(int itemID)
            : base(itemID)
        {
            this.m_Quality = ArmorQuality.Regular;
            this.m_Durability = ArmorDurabilityLevel.Regular;
            this.m_Crafter = null;

            this.m_Resource = this.DefaultResource;
            this.Hue = CraftResources.GetHue(this.m_Resource);

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

            this.Layer = (Layer)this.ItemData.Quality;

            this.m_AosAttributes = new AosAttributes(this);
            this.m_AosArmorAttributes = new AosArmorAttributes(this);
            this.m_AosSkillBonuses = new AosSkillBonuses(this);
        }
コード例 #6
0
        public BaseArmor( int itemID )
            : base(itemID)
        {
            m_Quality = ArmorQuality.Regular;
            m_Durability = ArmorDurabilityLevel.Regular;
            m_Crafter = null;

            m_Resource = DefaultResource;
            Hue = CraftResources.GetHue( m_Resource );

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

            this.Layer = (Layer)ItemData.Quality;

            m_AosAttributes = new AosAttributes( this );
            m_AosArmorAttributes = new AosArmorAttributes( this );
            m_AosSkillBonuses = new AosSkillBonuses( this );

            m_OriginalWeight = Weight;
        }
コード例 #7
0
        public static void ApplyAttributesTo(BaseHat hat, bool playerMade, int luckChance, int attributeCount, int min, int max)
        {
            if (!playerMade && RandomItemGenerator.Enabled)
            {
                RandomItemGenerator.GenerateRandomItem(hat, luckChance, attributeCount, min, max);
                return;
            }

            m_PlayerMade = playerMade;
            m_LuckChance = luckChance;

            AosAttributes        primary   = hat.Attributes;
            AosArmorAttributes   secondary = hat.ClothingAttributes;
            AosElementAttributes resists   = hat.Resistances;

            m_Props.SetAll(false);

            for (int i = 0; i < attributeCount; ++i)
            {
                int random = GetUniqueRandom(19);

                if (random == -1)
                {
                    break;
                }

                switch (random)
                {
                case 0:
                    ApplyAttribute(primary, min, max, AosAttribute.ReflectPhysical, 1, 15);
                    break;

                case 1:
                    ApplyAttribute(primary, min, max, AosAttribute.RegenHits, 1, 2);
                    break;

                case 2:
                    ApplyAttribute(primary, min, max, AosAttribute.RegenStam, 1, 3);
                    break;

                case 3:
                    ApplyAttribute(primary, min, max, AosAttribute.RegenMana, 1, 2);
                    break;

                case 4:
                    ApplyAttribute(primary, min, max, AosAttribute.NightSight, 1, 1);
                    break;

                case 5:
                    ApplyAttribute(primary, min, max, AosAttribute.BonusHits, 1, 5);
                    break;

                case 6:
                    ApplyAttribute(primary, min, max, AosAttribute.BonusStam, 1, 8);
                    break;

                case 7:
                    ApplyAttribute(primary, min, max, AosAttribute.BonusMana, 1, 8);
                    break;

                case 8:
                    ApplyAttribute(primary, min, max, AosAttribute.LowerManaCost, 1, 8);
                    break;

                case 9:
                    ApplyAttribute(primary, min, max, AosAttribute.LowerRegCost, 1, 20);
                    break;

                case 10:
                    ApplyAttribute(primary, min, max, AosAttribute.Luck, 1, 100);
                    break;

                case 11:
                    ApplyAttribute(secondary, min, max, AosArmorAttribute.LowerStatReq, 10, 100, 10);
                    break;

                case 12:
                    ApplyAttribute(secondary, min, max, AosArmorAttribute.SelfRepair, 1, 5);
                    break;

                case 13:
                    ApplyAttribute(secondary, min, max, AosArmorAttribute.DurabilityBonus, 10, 100, 10);
                    break;

                case 14:
                    ApplyAttribute(resists, min, max, AosElementAttribute.Physical, 1, 15);
                    break;

                case 15:
                    ApplyAttribute(resists, min, max, AosElementAttribute.Fire, 1, 15);
                    break;

                case 16:
                    ApplyAttribute(resists, min, max, AosElementAttribute.Cold, 1, 15);
                    break;

                case 17:
                    ApplyAttribute(resists, min, max, AosElementAttribute.Poison, 1, 15);
                    break;

                case 18:
                    ApplyAttribute(resists, min, max, AosElementAttribute.Energy, 1, 15);
                    break;
                }
            }
        }
コード例 #8
0
        public static void ApplyAttributesTo(BaseArmor armor, bool playerMade, int luckChance, int attributeCount, int min, int max)
        {
            if (!playerMade && RandomItemGenerator.Enabled)
            {
                RandomItemGenerator.GenerateRandomItem(armor, luckChance, attributeCount, min, max);
                return;
            }

            m_PlayerMade = playerMade;
            m_LuckChance = luckChance;

            AosAttributes      primary   = armor.Attributes;
            AosArmorAttributes secondary = armor.ArmorAttributes;

            m_Props.SetAll(false);

            bool isShield   = (armor is BaseShield);
            int  baseCount  = (isShield ? 7 : 20);
            int  baseOffset = (isShield ? 0 : 4);

            if (!isShield && armor.MeditationAllowance == ArmorMeditationAllowance.All)
            {
                m_Props.Set(3, true); // remove mage armor from possible properties
            }
            if (armor.Resource >= CraftResource.RegularLeather && armor.Resource <= CraftResource.BarbedLeather)
            {
                m_Props.Set(0, true); // remove lower requirements from possible properties for leather armor
                m_Props.Set(2, true); // remove durability bonus from possible properties
            }
            if (armor.RequiredRace == Race.Elf)
            {
                m_Props.Set(7, true); // elves inherently have night sight and elf only armor doesn't get night sight as a mod
            }
            for (int i = 0; i < attributeCount; ++i)
            {
                int random = GetUniqueRandom(baseCount);

                if (random == -1)
                {
                    break;
                }

                random += baseOffset;

                switch (random)
                {
                /* Begin Sheilds */
                case 0:
                    ApplyAttribute(primary, min, max, AosAttribute.SpellChanneling, 1, 1);
                    break;

                case 1:
                    ApplyAttribute(primary, min, max, AosAttribute.DefendChance, 1, 15);
                    break;

                case 2:
                    if (Core.ML)
                    {
                        ApplyAttribute(primary, min, max, AosAttribute.ReflectPhysical, 1, 15);
                    }
                    else
                    {
                        ApplyAttribute(primary, min, max, AosAttribute.AttackChance, 1, 15);
                    }
                    break;

                case 3:
                    ApplyAttribute(primary, min, max, AosAttribute.CastSpeed, 1, 1);
                    break;

                /* Begin Armor */
                case 4:
                    ApplyAttribute(secondary, min, max, AosArmorAttribute.LowerStatReq, 10, 100, 10);
                    break;

                case 5:
                    ApplyAttribute(secondary, min, max, AosArmorAttribute.SelfRepair, 1, 5);
                    break;

                case 6:
                    ApplyAttribute(secondary, min, max, AosArmorAttribute.DurabilityBonus, 10, 100, 10);
                    break;

                /* End Shields */
                case 7:
                    ApplyAttribute(secondary, min, max, AosArmorAttribute.MageArmor, 1, 1);
                    break;

                case 8:
                    ApplyAttribute(primary, min, max, AosAttribute.RegenHits, 1, 2);
                    break;

                case 9:
                    ApplyAttribute(primary, min, max, AosAttribute.RegenStam, 1, 3);
                    break;

                case 10:
                    ApplyAttribute(primary, min, max, AosAttribute.RegenMana, 1, 2);
                    break;

                case 11:
                    ApplyAttribute(primary, min, max, AosAttribute.NightSight, 1, 1);
                    break;

                case 12:
                    ApplyAttribute(primary, min, max, AosAttribute.BonusHits, 1, 5);
                    break;

                case 13:
                    ApplyAttribute(primary, min, max, AosAttribute.BonusStam, 1, 8);
                    break;

                case 14:
                    ApplyAttribute(primary, min, max, AosAttribute.BonusMana, 1, 8);
                    break;

                case 15:
                    ApplyAttribute(primary, min, max, AosAttribute.LowerManaCost, 1, 8);
                    break;

                case 16:
                    ApplyAttribute(primary, min, max, AosAttribute.LowerRegCost, 1, 20);
                    break;

                case 17:
                    ApplyAttribute(primary, min, max, AosAttribute.Luck, 1, 100);
                    break;

                case 18:
                    ApplyAttribute(primary, min, max, AosAttribute.ReflectPhysical, 1, 15);
                    break;

                case 19:
                    ApplyResistance(armor, min, max, ResistanceType.Physical, 1, 15);
                    break;

                case 20:
                    ApplyResistance(armor, min, max, ResistanceType.Fire, 1, 15);
                    break;

                case 21:
                    ApplyResistance(armor, min, max, ResistanceType.Cold, 1, 15);
                    break;

                case 22:
                    ApplyResistance(armor, min, max, ResistanceType.Poison, 1, 15);
                    break;

                case 23:
                    ApplyResistance(armor, min, max, ResistanceType.Energy, 1, 15);
                    break;
                    /* End Armor */
                }
            }
        }
コード例 #9
0
        public static void ApplyAttributesTo(BaseArmor armor, bool isRunicTool, int luckChance, int attributeCount, int min, int max)
        {
            m_IsRunicTool = isRunicTool;
            m_LuckChance  = luckChance;

            AosAttributes      primary   = armor.Attributes;
            AosArmorAttributes secondary = armor.ArmorAttributes;

            m_Props.SetAll(false);

            bool isShield   = (armor is BaseShield);
            int  baseCount  = (isShield ? 7 : 20);
            int  baseOffset = (isShield ? 0 : 4);

            if (!isShield && armor.MeditationAllowance == ArmorMeditationAllowance.All)
            {
                m_Props.Set(3, true);                   // remove mage armor from possible properties
            }
            for (int i = 0; i < attributeCount; ++i)
            {
                int random = GetUniqueRandom(baseCount);

                if (random == -1)
                {
                    break;
                }

                random += baseOffset;

                switch (random)
                {
                /* Begin Sheilds */
                case  0: ApplyAttribute(primary, min, max, AosAttribute.SpellChanneling, 1, 1); break;

                case  1: ApplyAttribute(primary, min, max, AosAttribute.DefendChance, 1, 15); break;

                case  2: ApplyAttribute(primary, min, max, AosAttribute.AttackChance, 1, 15); break;

                case  3: ApplyAttribute(primary, min, max, AosAttribute.CastSpeed, 1, 1); break;

                /* Begin Armor */
                case  4: ApplyAttribute(secondary, min, max, AosArmorAttribute.LowerStatReq, 10, 100, 10); break;

                case  5: ApplyAttribute(secondary, min, max, AosArmorAttribute.SelfRepair, 1, 5); break;

                case  6: ApplyAttribute(secondary, min, max, AosArmorAttribute.DurabilityBonus, 10, 100, 10); break;

                /* End Shields */
                case  7: ApplyAttribute(secondary, min, max, AosArmorAttribute.MageArmor, 1, 1); break;

                case  8: ApplyAttribute(primary, min, max, AosAttribute.RegenHits, 1, 2); break;

                case  9: ApplyAttribute(primary, min, max, AosAttribute.RegenStam, 1, 3); break;

                case 10: ApplyAttribute(primary, min, max, AosAttribute.RegenMana, 1, 2); break;

                case 11: ApplyAttribute(primary, min, max, AosAttribute.NightSight, 1, 1); break;

                case 12: ApplyAttribute(primary, min, max, AosAttribute.BonusHits, 1, 5); break;

                case 13: ApplyAttribute(primary, min, max, AosAttribute.BonusStam, 1, 8); break;

                case 14: ApplyAttribute(primary, min, max, AosAttribute.BonusMana, 1, 8); break;

                case 15: ApplyAttribute(primary, min, max, AosAttribute.LowerManaCost, 1, 8); break;

                case 16: ApplyAttribute(primary, min, max, AosAttribute.LowerRegCost, 1, 20); break;

                case 17: ApplyAttribute(primary, min, max, AosAttribute.Luck, 1, 100); break;

                case 18: ApplyAttribute(primary, min, max, AosAttribute.ReflectPhysical, 1, 15); break;

                case 19: ApplyResistance(armor, min, max, ResistanceType.Physical, 1, 15); break;

                case 20: ApplyResistance(armor, min, max, ResistanceType.Fire, 1, 15); break;

                case 21: ApplyResistance(armor, min, max, ResistanceType.Cold, 1, 15); break;

                case 22: ApplyResistance(armor, min, max, ResistanceType.Poison, 1, 15); break;

                case 23: ApplyResistance(armor, min, max, ResistanceType.Energy, 1, 15); break;
                    /* End Armor */
                }
            }
        }
コード例 #10
0
		private static void ApplyAttribute( AosArmorAttributes attrs, int min, int max, AosArmorAttribute attr, int low, int high, int scale )
		{
			attrs[attr] = Scale( min, max, low / scale, high / scale ) * scale;
		}
コード例 #11
0
ファイル: BaseClothing.cs プロジェクト: Crome696/ServUO
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch ( version )
            {
                case 8:
                        {
                            this.m_IsImbued = reader.ReadBool();
                            goto case 7;
                        }
                case 7:
                    {
                        m_SAAbsorptionAttributes = new SAAbsorptionAttributes(this, reader);

                        #region Runic Reforging
                        m_ReforgedPrefix = (ReforgedPrefix)reader.ReadInt();
                        m_ReforgedSuffix = (ReforgedSuffix)reader.ReadInt();
                        m_ItemPower = (ItemPower)reader.ReadInt();
                        m_BlockRepair = reader.ReadBool();
                        #endregion

                        #region Stygian Abyss
                        m_GorgonLenseCharges = reader.ReadInt();
                        m_GorgonLenseType = (LenseType)reader.ReadInt();

                        m_PhysImbuing = reader.ReadInt();
                        m_FireImbuing = reader.ReadInt();
                        m_ColdImbuing = reader.ReadInt();
                        m_PoisonImbuing = reader.ReadInt();
                        m_EnergyImbuing = reader.ReadInt();
                        goto case 6;
                    }
                case 6:
                    {
                        if(version == 6)
                            m_SAAbsorptionAttributes = new SAAbsorptionAttributes(this);

                        this.m_TimesImbued = reader.ReadInt();
                       
                        #endregion

                        this.m_BlessedBy = reader.ReadMobile();

                        #region Mondain's Legacy Sets
                        SetFlag sflags = (SetFlag)reader.ReadEncodedInt();

                        if (GetSaveFlag(sflags, SetFlag.Attributes))
                            this.m_SetAttributes = new AosAttributes(this, reader);
                        else
                            this.m_SetAttributes = new AosAttributes(this);

                        if (GetSaveFlag(sflags, SetFlag.ArmorAttributes))
                            this.m_SetSelfRepair = (new AosArmorAttributes(this, reader)).SelfRepair;

                        if (GetSaveFlag(sflags, SetFlag.SkillBonuses))
                            this.m_SetSkillBonuses = new AosSkillBonuses(this, reader);
                        else
                            this.m_SetSkillBonuses = new AosSkillBonuses(this);

                        if (GetSaveFlag(sflags, SetFlag.PhysicalBonus))
                            this.m_SetPhysicalBonus = reader.ReadEncodedInt();

                        if (GetSaveFlag(sflags, SetFlag.FireBonus))
                            this.m_SetFireBonus = reader.ReadEncodedInt();

                        if (GetSaveFlag(sflags, SetFlag.ColdBonus))
                            this.m_SetColdBonus = reader.ReadEncodedInt();

                        if (GetSaveFlag(sflags, SetFlag.PoisonBonus))
                            this.m_SetPoisonBonus = reader.ReadEncodedInt();

                        if (GetSaveFlag(sflags, SetFlag.EnergyBonus))
                            this.m_SetEnergyBonus = reader.ReadEncodedInt();

                        if (GetSaveFlag(sflags, SetFlag.SetHue))
                            this.m_SetHue = reader.ReadEncodedInt();

                        if (GetSaveFlag(sflags, SetFlag.LastEquipped))
                            this.m_LastEquipped = reader.ReadBool();

                        if (GetSaveFlag(sflags, SetFlag.SetEquipped))
                            this.m_SetEquipped = reader.ReadBool();

                        if (GetSaveFlag(sflags, SetFlag.SetSelfRepair))
                            this.m_SetSelfRepair = reader.ReadEncodedInt();
                        #endregion

                        goto case 5;
                    }
                case 5:
                    {
                        SaveFlag flags = (SaveFlag)reader.ReadEncodedInt();

                        if (GetSaveFlag(flags, SaveFlag.NegativeAttributes))
                            m_NegativeAttributes = new NegativeAttributes(this, reader);
                        else
                            m_NegativeAttributes = new NegativeAttributes(this);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            #region Mondain's Legacy Sets
            if (this.m_SetAttributes == null)
                this.m_SetAttributes = new AosAttributes(this);

            if (this.m_SetSkillBonuses == null)
                this.m_SetSkillBonuses = new AosSkillBonuses(this);
            #endregion

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

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

            if (version < 4)
                this.m_Resource = this.DefaultResource;

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

            Mobile parent = this.Parent as Mobile;

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

                this.AddStatBonuses(parent);
                parent.CheckStatTimers();
            }
        }
コード例 #12
0
ファイル: BaseArmor.cs プロジェクト: justdanofficial/khaeros
        public BaseArmor(int itemID)
            : base(itemID)
        {
            m_Quality = ArmorQuality.Regular;
            m_Durability = ArmorDurabilityLevel.Regular;
            m_Crafter = null;

            m_Resource = DefaultResource;
            Hue = CraftResources.GetHue(m_Resource);

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

            this.Layer = (Layer)ItemData.Quality;

            m_AosAttributes = new AosAttributes(this);
            m_AosArmorAttributes = new AosArmorAttributes(this);
            m_AosSkillBonuses = new AosSkillBonuses(this);

            if ((this is WoodenShield || this is LeatherShield || this is BoiledLeatherShield) && this.Resource == CraftResource.Iron)
                this.Resource = CraftResource.Oak;

            else if (this.Resource == CraftResource.Iron)
            {
                this.Resource = CraftResource.Copper;
                this.Hue = 0x96D;
            }

            if (this is IBoneArmour)
            {
                this.Hue = 0;
            }
        }
コード例 #13
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            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);
            }

            Mobile parent = Parent as Mobile;

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

                AddStatBonuses(parent);
                parent.CheckStatTimers();
            }
        }
コード例 #14
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 1:
            {
                SaveFlag flags = (SaveFlag)reader.ReadEncodedInt();

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

                if (GetSaveFlag(flags, SaveFlag.ArmorAttributes))
                {
                    m_AosArmorAttributes = new AosArmorAttributes(this, reader);
                }
                else
                {
                    m_AosArmorAttributes = new AosArmorAttributes(this);
                }

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

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

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

                if (m_Resource == CraftResource.None)
                {
                    m_Resource = DefaultResource;
                }

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

                if (GetSaveFlag(flags, SaveFlag.DexReq))
                {
                    m_DexReq = reader.ReadEncodedInt();
                }
                else
                {
                    m_DexReq = -1;
                }

                if (GetSaveFlag(flags, SaveFlag.IntReq))
                {
                    m_IntReq = reader.ReadEncodedInt();
                }
                else
                {
                    m_IntReq = -1;
                }

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

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

                if (GetSaveFlag(flags, SaveFlag.BonusRandomAttributes))
                {
                    m_BonusRandomAttributes = new BonusAttribute[reader.ReadInt()];

                    for (int i = 0; i < m_BonusRandomAttributes.Length; i++)
                    {
                        m_BonusRandomAttributes[i] = new BonusAttribute(reader);
                    }
                }

                break;
            }

            case 0:
            {
                m_InheritsItem       = true;
                m_OldVersion         = version;
                m_AosAttributes      = new AosAttributes(this);
                m_AosArmorAttributes = new AosArmorAttributes(this);
                m_Quality            = CraftQuality.Regular;
                m_Resource           = DefaultResource;
                m_PlayerConstructed  = true;
                break;
            }
            }

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

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

            if (Parent is Mobile)
            {
                ((Mobile)Parent).CheckStatTimers();
            }
        }
コード例 #15
0
ファイル: BaseArmor.cs プロジェクト: justdanofficial/khaeros
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            //if (version == 11)
            //version = 12;

            switch (version)
            {
                case 12: m_OldArmor = reader.ReadBool(); goto case 11;
                case 11:
                case 10:
                    {
                        m_CraftersOriginalName = reader.ReadString();
                        goto case 9;
                    }
                case 9:
                    {
                        m_Engraved1 = reader.ReadString();
                        m_Engraved2 = reader.ReadString();
                        m_Engraved3 = reader.ReadString();
                        goto case 5;
                    }
                case 8:
                case 7:
                case 6:
                case 5:
                    {
                        SaveFlag flags = (SaveFlag)reader.ReadEncodedInt();

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

                        if (GetSaveFlag(flags, SaveFlag.ArmorAttributes))
                            m_AosArmorAttributes = new AosArmorAttributes(this, reader);
                        else
                            m_AosArmorAttributes = new AosArmorAttributes(this);

                        if (GetSaveFlag(flags, SaveFlag.BluntBonus))
                            m_BluntBonus = reader.ReadEncodedInt();

                        if (GetSaveFlag(flags, SaveFlag.SlashingBonus))
                            m_SlashingBonus = reader.ReadEncodedInt();

                        if (GetSaveFlag(flags, SaveFlag.PiercingBonus))
                            m_PiercingBonus = reader.ReadEncodedInt();

                        if (GetSaveFlag(flags, SaveFlag.PhysicalBonus))
                            m_PhysicalBonus = reader.ReadEncodedInt();

                        if (GetSaveFlag(flags, SaveFlag.FireBonus))
                            m_FireBonus = reader.ReadEncodedInt();

                        if (GetSaveFlag(flags, SaveFlag.ColdBonus))
                            m_ColdBonus = reader.ReadEncodedInt();

                        if (GetSaveFlag(flags, SaveFlag.PoisonBonus))
                            m_PoisonBonus = reader.ReadEncodedInt();

                        if (GetSaveFlag(flags, SaveFlag.EnergyBonus))
                            m_EnergyBonus = reader.ReadEncodedInt();

                        if (GetSaveFlag(flags, SaveFlag.Identified))
                            m_Identified = (version >= 7 || reader.ReadBool());

                        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 = (ArmorQuality)reader.ReadEncodedInt();

                        }
                        else
                            m_Quality = ArmorQuality.Regular;

                        if (version == 5 && m_Quality == ArmorQuality.Low)
                            m_Quality = ArmorQuality.Regular;

                        if (GetSaveFlag(flags, SaveFlag.Durability))
                        {
                            m_Durability = (ArmorDurabilityLevel)reader.ReadEncodedInt();

                            if (m_Durability > ArmorDurabilityLevel.Indestructible)
                                m_Durability = ArmorDurabilityLevel.Durable;
                        }

                        if (GetSaveFlag(flags, SaveFlag.Protection))
                        {
                            m_Protection = (ArmorProtectionLevel)reader.ReadEncodedInt();

                            if (m_Protection > ArmorProtectionLevel.Invulnerability)
                                m_Protection = ArmorProtectionLevel.Defense;
                        }

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

                        if (m_Resource == CraftResource.None)
                            m_Resource = DefaultResource;

                        if (GetSaveFlag(flags, SaveFlag.BaseArmor))
                            m_ArmorBase = reader.ReadEncodedInt();
                        else
                            m_ArmorBase = -1;

                        if (GetSaveFlag(flags, SaveFlag.HitsMaxBonus))
                            m_HitsMaxBonus = reader.ReadEncodedInt();
                        else
                            m_HitsMaxBonus = -1;

                        if (GetSaveFlag(flags, SaveFlag.StamMaxBonus))
                            m_StamMaxBonus = reader.ReadEncodedInt();
                        else
                            m_StamMaxBonus = -1;

                        if (GetSaveFlag(flags, SaveFlag.ManaMaxBonus))
                            m_ManaMaxBonus = reader.ReadEncodedInt();
                        else
                            m_ManaMaxBonus = -1;

                        if (GetSaveFlag(flags, SaveFlag.StrBonus))
                            m_StrBonus = reader.ReadEncodedInt();
                        else
                            m_StrBonus = -1;

                        if (GetSaveFlag(flags, SaveFlag.DexBonus))
                            m_DexBonus = reader.ReadEncodedInt();
                        else
                            m_DexBonus = -1;

                        if (GetSaveFlag(flags, SaveFlag.IntBonus))
                            m_IntBonus = reader.ReadEncodedInt();
                        else
                            m_IntBonus = -1;

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

                        if (GetSaveFlag(flags, SaveFlag.DexReq))
                            m_DexReq = reader.ReadEncodedInt();
                        else
                            m_DexReq = -1;

                        if (GetSaveFlag(flags, SaveFlag.IntReq))
                            m_IntReq = reader.ReadEncodedInt();
                        else
                            m_IntReq = -1;

                        if (GetSaveFlag(flags, SaveFlag.MedAllowance))
                            m_Meditate = (AMA)reader.ReadEncodedInt();
                        else
                            m_Meditate = (AMA)(-1);

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

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

                        break;
                    }
                case 4:
                    {
                        m_AosAttributes = new AosAttributes(this, reader);
                        m_AosArmorAttributes = new AosArmorAttributes(this, reader);
                        goto case 3;
                    }
                case 3:
                    {
                        //m_BluntBonus = reader.ReadInt();
                        // m_SlashingBonus = reader.ReadInt();
                        // m_PiercingBonus = reader.ReadInt();
                        m_PhysicalBonus = reader.ReadInt();
                        m_FireBonus = reader.ReadInt();
                        m_ColdBonus = reader.ReadInt();
                        m_PoisonBonus = reader.ReadInt();
                        m_EnergyBonus = reader.ReadInt();
                        goto case 2;
                    }
                case 2:
                case 1:
                    {
                        m_Identified = reader.ReadBool();
                        goto case 0;
                    }
                case 0:
                    {
                        m_ArmorBase = reader.ReadInt();
                        m_MaxHitPoints = reader.ReadInt();
                        m_HitPoints = reader.ReadInt();
                        m_Crafter = reader.ReadMobile();
                        m_Quality = (ArmorQuality)reader.ReadInt();
                        m_Durability = (ArmorDurabilityLevel)reader.ReadInt();
                        m_Protection = (ArmorProtectionLevel)reader.ReadInt();

                        AMT mat = (AMT)reader.ReadInt();

                        if (m_ArmorBase == RevertArmorBase)
                            m_ArmorBase = -1;

                        /*m_BodyPos = (ArmorBodyType)*/
                        reader.ReadInt();

                        if (version < 4)
                        {
                            m_AosAttributes = new AosAttributes(this);
                            m_AosArmorAttributes = new AosArmorAttributes(this);
                        }

                        if (version < 3 && m_Quality == ArmorQuality.Exceptional)
                            DistributeBonuses(6, 1);

                        if (version >= 2)
                        {
                            m_Resource = (CraftResource)reader.ReadInt();
                        }
                        else
                        {
                            OreInfo info;

                            switch (reader.ReadInt())
                            {
                                default:
                                case 0: info = OreInfo.Iron; break;
                                case 1: info = OreInfo.Copper; break;
                                case 2: info = OreInfo.Bronze; break;
                                case 3: info = OreInfo.Gold; break;
                                case 4: info = OreInfo.Steel; break;
                                case 5: info = OreInfo.Obsidian; break;
                                case 6: info = OreInfo.Tin; break;
                                case 7: info = OreInfo.Starmetal; break;
                            }

                            m_Resource = CraftResources.GetFromOreInfo(info, mat);
                        }

                        m_HitsMaxBonus = reader.ReadInt();
                        m_StamMaxBonus = reader.ReadInt();
                        m_ManaMaxBonus = reader.ReadInt();

                        m_StrBonus = reader.ReadInt();
                        m_DexBonus = reader.ReadInt();
                        m_IntBonus = reader.ReadInt();
                        m_StrReq = reader.ReadInt();
                        m_DexReq = reader.ReadInt();
                        m_IntReq = reader.ReadInt();

                        if (m_HitsMaxBonus == OldHitsMaxBonus)
                            m_HitsMaxBonus = -1;

                        if (m_StamMaxBonus == OldStamMaxBonus)
                            m_StamMaxBonus = -1;

                        if (m_ManaMaxBonus == OldManaMaxBonus)
                            m_ManaMaxBonus = -1;

                        if (m_StrBonus == OldStrBonus)
                            m_StrBonus = -1;

                        if (m_DexBonus == OldDexBonus)
                            m_DexBonus = -1;

                        if (m_IntBonus == OldIntBonus)
                            m_IntBonus = -1;

                        if (m_StrReq == OldStrReq)
                            m_StrReq = -1;

                        if (m_DexReq == OldDexReq)
                            m_DexReq = -1;

                        if (m_IntReq == OldIntReq)
                            m_IntReq = -1;

                        m_Meditate = (AMA)reader.ReadInt();

                        if (m_Meditate == OldMedAllowance)
                            m_Meditate = (AMA)(-1);

                        if (m_Resource == CraftResource.None)
                        {
                            if (mat == ArmorMaterialType.Studded || mat == ArmorMaterialType.Leather)
                                m_Resource = CraftResource.RegularLeather;
                            else if (mat == ArmorMaterialType.Thick)
                                m_Resource = CraftResource.ThickLeather;
                            else if (mat == ArmorMaterialType.Beast)
                                m_Resource = CraftResource.BeastLeather;
                            else if (mat == ArmorMaterialType.Scaled)
                                m_Resource = CraftResource.ScaledLeather;
                            else
                                m_Resource = CraftResource.Iron;
                        }

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

                        break;
                    }
            }

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

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

            int hitsBonus = ComputeStatBonus(StatType.HitsMax);
            int stamBonus = ComputeStatBonus(StatType.StamMax);
            int manaBonus = ComputeStatBonus(StatType.ManaMax);
            int strBonus = ComputeStatBonus(StatType.Str);
            int dexBonus = ComputeStatBonus(StatType.Dex);
            int intBonus = ComputeStatBonus(StatType.Int);

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

                string modName = Serial.ToString();

                if (hitsBonus != 0)
                    m.AddStatMod(new StatMod(StatType.HitsMax, modName + "Hits", hitsBonus, TimeSpan.Zero));

                if (stamBonus != 0)
                    m.AddStatMod(new StatMod(StatType.StamMax, modName + "Stam", stamBonus, TimeSpan.Zero));

                if (manaBonus != 0)
                    m.AddStatMod(new StatMod(StatType.ManaMax, modName + "Mana", manaBonus, TimeSpan.Zero));

                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 (version < 7)
                m_PlayerConstructed = true; // we don't know, so, assume it's crafted

            if (version < 11 && this.RootParentEntity != null && this.RootParentEntity is Mercenary)
            {
                Mercenary merc = this.RootParentEntity as Mercenary;

                if (this.ArmourType == ArmourWeight.Light)
                    merc.RawDex -= 1;

                else if (this.ArmourType == ArmourWeight.Medium)
                    merc.RawDex -= 2;

                else
                    merc.RawDex -= 3;
            }
        }
コード例 #16
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);
    }
コード例 #17
0
        public static void ApplyAttributesTo(BaseHat hat, bool isRunicTool, int luckChance, int attributeCount, int min, int max)
        {
            m_IsRunicTool = isRunicTool;
            m_LuckChance  = luckChance;

            AosAttributes        primary   = hat.Attributes;
            AosArmorAttributes   secondary = hat.ClothingAttributes;
            AosElementAttributes resists   = hat.Resistances;

            m_Props.SetAll(false);
            m_Props.Set(0, true); // no lower stat requirements for hats

            for (int i = 0; i < attributeCount; ++i)
            {
                int random = GetUniqueRandom(18);

                if (random == -1)
                {
                    break;
                }

                switch (random)
                {
                case  0: ApplyAttribute(primary, min, max, AosAttribute.ReflectPhysical, 1, 15); break;

                case  1: ApplyAttribute(primary, min, max, AosAttribute.RegenHits, 1, 2); break;

                case  2: ApplyAttribute(primary, min, max, AosAttribute.RegenStam, 1, 3); break;

                case  3: ApplyAttribute(primary, min, max, AosAttribute.RegenMana, 1, 2); break;

                case  4: ApplyAttribute(primary, min, max, AosAttribute.NightSight, 1, 1); break;

                case  5: ApplyAttribute(primary, min, max, AosAttribute.BonusHits, 1, 5); break;

                case  6: ApplyAttribute(primary, min, max, AosAttribute.BonusStam, 1, 8); break;

                case  7: ApplyAttribute(primary, min, max, AosAttribute.BonusMana, 1, 8); break;

                case  8: ApplyAttribute(primary, min, max, AosAttribute.LowerManaCost, 1, 8); break;

                case  9: ApplyAttribute(primary, min, max, AosAttribute.LowerRegCost, 1, 20); break;

                case 10: ApplyAttribute(primary, min, max, AosAttribute.Luck, 1, 100); break;

                case 11: ApplyAttribute(secondary, min, max, AosArmorAttribute.SelfRepair, 1, 5); break;

                case 12: ApplyAttribute(secondary, min, max, AosArmorAttribute.DurabilityBonus, 10, 100, 10); break;

                case 13: ApplyAttribute(resists, min, max, AosElementAttribute.Physical, 1, 15); break;

                case 14: ApplyAttribute(resists, min, max, AosElementAttribute.Fire, 1, 15); break;

                case 15: ApplyAttribute(resists, min, max, AosElementAttribute.Cold, 1, 15); break;

                case 16: ApplyAttribute(resists, min, max, AosElementAttribute.Poison, 1, 15); break;

                case 17: ApplyAttribute(resists, min, max, AosElementAttribute.Energy, 1, 15); break;
                }
            }
        }
コード例 #18
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 5:
            {
                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.StrReq))
                {
                    m_StrReq = reader.ReadEncodedInt();
                }
                else
                {
                    m_StrReq = -1;
                }

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

                m_IsInvisible = GetSaveFlag(flags, SaveFlag.IPYInvisible);

                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:
            {
                break;
            }

            case 0:
            {
                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;
            }

            Mobile parent = Parent as Mobile;

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

                AddStatBonuses(parent);
                parent.CheckStatTimers();
            }
        }
コード例 #19
0
ファイル: BaseArmor.cs プロジェクト: greeduomacro/vivre-uo
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();

			switch ( version )
			{
                case 8:
				case 7:
				case 6:
				case 5:
				{
					SaveFlag flags = (SaveFlag)reader.ReadEncodedInt();

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

					if ( GetSaveFlag( flags, SaveFlag.ArmorAttributes ) )
						m_AosArmorAttributes = new AosArmorAttributes( this, reader );
					else
						m_AosArmorAttributes = new AosArmorAttributes( this );

					if ( GetSaveFlag( flags, SaveFlag.PhysicalBonus ) )
						m_PhysicalBonus = reader.ReadEncodedInt();

					if ( GetSaveFlag( flags, SaveFlag.FireBonus ) )
						m_FireBonus = reader.ReadEncodedInt();

					if ( GetSaveFlag( flags, SaveFlag.ColdBonus ) )
						m_ColdBonus = reader.ReadEncodedInt();

					if ( GetSaveFlag( flags, SaveFlag.PoisonBonus ) )
						m_PoisonBonus = reader.ReadEncodedInt();

					if ( GetSaveFlag( flags, SaveFlag.EnergyBonus ) )
						m_EnergyBonus = reader.ReadEncodedInt();

					if ( GetSaveFlag( flags, SaveFlag.Identified ) )
						m_Identified = ( version >= 7 || reader.ReadBool() );

					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 = (ArmorQuality)reader.ReadEncodedInt();
					else
						m_Quality = ArmorQuality.Regular;

					if ( version == 5 && m_Quality == ArmorQuality.Low )
						m_Quality = ArmorQuality.Regular;

					if ( GetSaveFlag( flags, SaveFlag.Durability ) )
					{
						m_Durability = (ArmorDurabilityLevel)reader.ReadEncodedInt();

						if ( m_Durability > ArmorDurabilityLevel.Indestructible )
							m_Durability = ArmorDurabilityLevel.Durable;
					}

					if ( GetSaveFlag( flags, SaveFlag.Protection ) )
					{
						m_Protection = (ArmorProtectionLevel)reader.ReadEncodedInt();

						if ( m_Protection > ArmorProtectionLevel.Invulnerability )
							m_Protection = ArmorProtectionLevel.Defense;
					}

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

					if ( m_Resource == CraftResource.None )
						m_Resource = DefaultResource;

					if ( GetSaveFlag( flags, SaveFlag.BaseArmor ) )
						m_ArmorBase = reader.ReadEncodedInt();
					else
						m_ArmorBase = -1;

					if ( GetSaveFlag( flags, SaveFlag.StrBonus ) )
						m_StrBonus = reader.ReadEncodedInt();
					else
						m_StrBonus = -1;

					if ( GetSaveFlag( flags, SaveFlag.DexBonus ) )
						m_DexBonus = reader.ReadEncodedInt();
					else
						m_DexBonus = -1;

					if ( GetSaveFlag( flags, SaveFlag.IntBonus ) )
						m_IntBonus = reader.ReadEncodedInt();
					else
						m_IntBonus = -1;

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

					if ( GetSaveFlag( flags, SaveFlag.DexReq ) )
						m_DexReq = reader.ReadEncodedInt();
					else
						m_DexReq = -1;

					if ( GetSaveFlag( flags, SaveFlag.IntReq ) )
						m_IntReq = reader.ReadEncodedInt();
					else
						m_IntReq = -1;

					if ( GetSaveFlag( flags, SaveFlag.MedAllowance ) )
						m_Meditate = (AMA)reader.ReadEncodedInt();
					else
						m_Meditate = (AMA)(-1);

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

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

					break;
				}
				case 4:
				{
					m_AosAttributes = new AosAttributes( this, reader );
					m_AosArmorAttributes = new AosArmorAttributes( this, reader );
					goto case 3;
				}
				case 3:
				{
					m_PhysicalBonus = reader.ReadInt();
					m_FireBonus = reader.ReadInt();
					m_ColdBonus = reader.ReadInt();
					m_PoisonBonus = reader.ReadInt();
					m_EnergyBonus = reader.ReadInt();
					goto case 2;
				}
				case 2:
				case 1:
				{
					m_Identified = reader.ReadBool();
					goto case 0;
				}
				case 0:
				{
					m_ArmorBase = reader.ReadInt();
					m_MaxHitPoints = reader.ReadInt();
					m_HitPoints = reader.ReadInt();
					m_Crafter = reader.ReadMobile();
					m_Quality = (ArmorQuality)reader.ReadInt();
					m_Durability = (ArmorDurabilityLevel)reader.ReadInt();
					m_Protection = (ArmorProtectionLevel)reader.ReadInt();

					AMT mat = (AMT)reader.ReadInt();

					if ( m_ArmorBase == RevertArmorBase )
						m_ArmorBase = -1;

					/*m_BodyPos = (ArmorBodyType)*/reader.ReadInt();

                  
					if ( version < 4 )
					{
						m_AosAttributes = new AosAttributes( this );
						m_AosArmorAttributes = new AosArmorAttributes( this );
					}

					if ( version < 3 && m_Quality == ArmorQuality.Exceptional )
						DistributeBonuses( 4 );

					if ( version >= 2 )
					{
						m_Resource = (CraftResource)reader.ReadInt();
					}
					else
					{
						OreInfo info;

						switch ( reader.ReadInt() )
						{
							default:
							case 0: info = OreInfo.MIron; break;
							case 1: info = OreInfo.MBronze; break;
							case 2: info = OreInfo.MGold; break;
							case 3: info = OreInfo.MCopper; break;
							case 4: info = OreInfo.MOldcopper; break;
							case 5: info = OreInfo.MDullcopper; break;
							case 6: info = OreInfo.MSilver; break;
							case 7: info = OreInfo.MShadow; break;
							case 8: info = OreInfo.MBloodrock; break;
                            case 9: info = OreInfo.MBlackrock; break;
                            case 10: info = OreInfo.MMytheril; break;
                            case 11: info = OreInfo.MRose; break;
                            case 12: info = OreInfo.MVerite; break;
                            case 13: info = OreInfo.MAgapite; break;
                            case 14: info = OreInfo.MRusty; break;
                            case 15: info = OreInfo.MValorite; break;
                            case 16: info = OreInfo.MDragon; break;
                            case 17: info = OreInfo.MTitan; break;
                            case 18: info = OreInfo.MCrystaline; break;
                            case 19: info = OreInfo.MKrynite; break;
                            case 20: info = OreInfo.MVulcan; break;
                            case 21: info = OreInfo.MBloodcrest; break;
                            case 22: info = OreInfo.MElvin; break;
                            case 23: info = OreInfo.MAcid; break;
                            case 24: info = OreInfo.MAqua; break;
                            case 25: info = OreInfo.MEldar; break;
                            case 26: info = OreInfo.MGlowing; break;
                            case 27: info = OreInfo.MGorgan; break;
                            case 28: info = OreInfo.MSandrock; break;
                            case 29: info = OreInfo.MSteel; break;
						}

						m_Resource = CraftResources.GetFromOreInfo( info, mat );
					}

					m_StrBonus = reader.ReadInt();
					m_DexBonus = reader.ReadInt();
					m_IntBonus = reader.ReadInt();
					m_StrReq = reader.ReadInt();
					m_DexReq = reader.ReadInt();
					m_IntReq = reader.ReadInt();

					if ( m_StrBonus == OldStrBonus )
						m_StrBonus = -1;

					if ( m_DexBonus == OldDexBonus )
						m_DexBonus = -1;

					if ( m_IntBonus == OldIntBonus )
						m_IntBonus = -1;

					if ( m_StrReq == OldStrReq )
						m_StrReq = -1;

					if ( m_DexReq == OldDexReq )
						m_DexReq = -1;

					if ( m_IntReq == OldIntReq )
						m_IntReq = -1;

					m_Meditate = (AMA)reader.ReadInt();

					if ( m_Meditate == OldMedAllowance )
						m_Meditate = (AMA)(-1);

					if ( m_Resource == CraftResource.None )
					{
						if ( mat == ArmorMaterialType.Studded || mat == ArmorMaterialType.Leather )
							m_Resource = CraftResource.RegularLeather;
						else if ( mat == ArmorMaterialType.Spined )
							m_Resource = CraftResource.SpinedLeather;
						else if ( mat == ArmorMaterialType.Horned )
							m_Resource = CraftResource.HornedLeather;
						else if ( mat == ArmorMaterialType.Barbed )
							m_Resource = CraftResource.BarbedLeather;
                        else if (mat == ArmorMaterialType.Daemon)
                            m_Resource = CraftResource.DaemonLeather;
						else
							m_Resource = CraftResource.MIron;
					}

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

					break;
				}
			}

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

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

			int strBonus = ComputeStatBonus( StatType.Str );
			int dexBonus = ComputeStatBonus( StatType.Dex );
			int intBonus = ComputeStatBonus( StatType.Int );

			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 ( version < 7 )
				m_PlayerConstructed = true; // we don't know, so, assume it's crafted
            if (version < 8)
                m_Identified = true; // we don't know, so, assume it's identified
		}
コード例 #20
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);
    }
コード例 #21
0
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();

			switch ( version )
			{
                case 7:
			        DonationClothing = reader.ReadBool();
			        Owner = reader.ReadMobile();
			        goto case 6;
                case 6:
			        m_IsRenamed = reader.ReadBool();
			        goto case 5;
				case 5:
				{
					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();
			}
		}
コード例 #22
0
        public static bool CheckMatch(VendorItem vitem, SearchCriteria searchCriteria)
        {
            if (vitem == null)
            {
                return(false);
            }

            Item item = vitem.Item;

            if (searchCriteria.MinPrice > -1 && vitem.Price < searchCriteria.MinPrice)
            {
                return(false);
            }

            if (searchCriteria.MaxPrice > -1 && vitem.Price > searchCriteria.MaxPrice)
            {
                return(false);
            }

            if (!String.IsNullOrEmpty(searchCriteria.SearchName))
            {
                string name = GetItemName(item);

                if (name == null)
                {
                    return(false); // TODO? REturn null names?
                }

                if (!CheckKeyword(searchCriteria.SearchName, item) && name.ToLower().IndexOf(searchCriteria.SearchName.ToLower()) < 0)
                {
                    return(false);
                }
            }

            if (searchCriteria.SearchType != Layer.Invalid && searchCriteria.SearchType != item.Layer)
            {
                return(false);
            }

            if (searchCriteria.Details.Count == 0)
            {
                return(true);
            }

            foreach (SearchDetail detail in searchCriteria.Details)
            {
                object o     = detail.Attribute;
                int    value = detail.Value;

                if (value == 0)
                {
                    value = 1;
                }

                if (o is AosAttribute)
                {
                    AosAttributes attrs = RunicReforging.GetAosAttributes(item);

                    if (attrs == null || attrs[(AosAttribute)o] < value)
                    {
                        return(false);
                    }
                }
                else if (o is AosWeaponAttribute)
                {
                    AosWeaponAttributes attrs = RunicReforging.GetAosWeaponAttributes(item);

                    if ((AosWeaponAttribute)o == AosWeaponAttribute.MageWeapon)
                    {
                        if (attrs == null || attrs[(AosWeaponAttribute)o] == 0 || attrs[(AosWeaponAttribute)o] > Math.Max(0, 30 - value))
                        {
                            return(false);
                        }
                    }
                    else if (attrs == null || attrs[(AosWeaponAttribute)o] < value)
                    {
                        return(false);
                    }
                }
                else if (o is SAAbsorptionAttribute)
                {
                    SAAbsorptionAttributes attrs = RunicReforging.GetSAAbsorptionAttributes(item);

                    if (attrs == null || attrs[(SAAbsorptionAttribute)o] < value)
                    {
                        return(false);
                    }
                }
                else if (o is AosArmorAttribute)
                {
                    AosArmorAttributes attrs = RunicReforging.GetAosArmorAttributes(item);

                    if (attrs == null || attrs[(AosArmorAttribute)o] < value)
                    {
                        return(false);
                    }
                }
                else if (o is SkillName)
                {
                    if (detail.Category != Category.RequiredSkill)
                    {
                        AosSkillBonuses skillbonuses = RunicReforging.GetAosSkillBonuses(item);

                        if (skillbonuses != null)
                        {
                            bool hasSkill = false;

                            for (int i = 0; i < 5; i++)
                            {
                                SkillName check;
                                double    bonus;

                                if (skillbonuses.GetValues(i, out check, out bonus) && check == (SkillName)o && bonus >= value)
                                {
                                    hasSkill = true;
                                    break;
                                }
                            }

                            if (!hasSkill)
                            {
                                return(false);
                            }
                        }
                        else if (item is SpecialScroll && value >= 105)
                        {
                            if (((SpecialScroll)item).Skill != (SkillName)o || ((SpecialScroll)item).Value < value)
                            {
                                return(false);
                            }
                        }
                        else
                        {
                            return(false);
                        }
                    }
                    else if (!(item is BaseWeapon) || ((BaseWeapon)item).DefSkill != (SkillName)o)
                    {
                        return(false);
                    }
                }
                else if (!CheckSlayer(item, o))
                {
                    return(false);
                }
                else if (o is AosElementAttribute)
                {
                    if (item is BaseWeapon)
                    {
                        BaseWeapon wep = item as BaseWeapon;

                        if (detail.Category == Category.DamageType)
                        {
                            int phys, fire, cold, pois, nrgy, chaos, direct;
                            wep.GetDamageTypes(null, out phys, out fire, out cold, out pois, out nrgy, out chaos, out direct);

                            switch ((AosElementAttribute)o)
                            {
                            case AosElementAttribute.Physical: if (phys < value)
                                {
                                    return(false);
                                }
                                break;

                            case AosElementAttribute.Fire: if (fire < value)
                                {
                                    return(false);
                                }
                                break;

                            case AosElementAttribute.Cold: if (cold < value)
                                {
                                    return(false);
                                }
                                break;

                            case AosElementAttribute.Poison: if (pois < value)
                                {
                                    return(false);
                                }
                                break;

                            case AosElementAttribute.Energy: if (nrgy < value)
                                {
                                    return(false);
                                }
                                break;

                            case AosElementAttribute.Chaos: if (chaos < value)
                                {
                                    return(false);
                                }
                                break;

                            case AosElementAttribute.Direct: if (direct < value)
                                {
                                    return(false);
                                }
                                break;
                            }
                        }
                        else
                        {
                            switch ((AosElementAttribute)o)
                            {
                            case AosElementAttribute.Physical:
                                if (wep.WeaponAttributes.ResistPhysicalBonus < value)
                                {
                                    return(false);
                                }
                                break;

                            case AosElementAttribute.Fire:
                                if (wep.WeaponAttributes.ResistFireBonus < value)
                                {
                                    return(false);
                                }
                                break;

                            case AosElementAttribute.Cold:
                                if (wep.WeaponAttributes.ResistColdBonus < value)
                                {
                                    return(false);
                                }
                                break;

                            case AosElementAttribute.Poison:
                                if (wep.WeaponAttributes.ResistPoisonBonus < value)
                                {
                                    return(false);
                                }
                                break;

                            case AosElementAttribute.Energy:
                                if (wep.WeaponAttributes.ResistEnergyBonus < value)
                                {
                                    return(false);
                                }
                                break;
                            }
                        }
                    }
                    else if (item is BaseArmor && detail.Category == Category.Resists)
                    {
                        BaseArmor armor = item as BaseArmor;

                        switch ((AosElementAttribute)o)
                        {
                        case AosElementAttribute.Physical:
                            if (armor.PhysicalResistance < value)
                            {
                                return(false);
                            }
                            break;

                        case AosElementAttribute.Fire:
                            if (armor.FireResistance < value)
                            {
                                return(false);
                            }
                            break;

                        case AosElementAttribute.Cold:
                            if (armor.ColdResistance < value)
                            {
                                return(false);
                            }
                            break;

                        case AosElementAttribute.Poison:
                            if (armor.PoisonResistance < value)
                            {
                                return(false);
                            }
                            break;

                        case AosElementAttribute.Energy:
                            if (armor.EnergyResistance < value)
                            {
                                return(false);
                            }
                            break;
                        }
                    }
                    else if (detail.Category != Category.DamageType)
                    {
                        AosElementAttributes attrs = RunicReforging.GetElementalAttributes(item);

                        if (attrs == null || attrs[(AosElementAttribute)o] < value)
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        return(false);
                    }
                }
                else if (o is Misc)
                {
                    switch ((Misc)o)
                    {
                    case Misc.ExcludeFel: break;

                    case Misc.GargoyleOnly:
                        if (!IsGargoyle(item))
                        {
                            return(false);
                        }
                        break;

                    case Misc.NotGargoyleOnly:
                        if (IsGargoyle(item))
                        {
                            return(false);
                        }
                        break;

                    case Misc.ElvesOnly:
                        if (!IsElf(item))
                        {
                            return(false);
                        }
                        break;

                    case Misc.NotElvesOnly:
                        if (IsElf(item))
                        {
                            return(false);
                        }
                        break;

                    case Misc.FactionItem:
                        if (!(item is Server.Factions.IFactionItem))
                        {
                            return(false);
                        }
                        break;

                    case Misc.PromotionalToken:
                        if (!(item is PromotionalToken))
                        {
                            return(false);
                        }
                        break;

                    case Misc.Cursed:
                        if (item.LootType != LootType.Cursed)
                        {
                            return(false);
                        }
                        break;

                    case Misc.NotCursed:
                        if (item.LootType == LootType.Cursed)
                        {
                            return(false);
                        }
                        break;

                    case Misc.CannotRepair:
                        if (CheckCanRepair(item))
                        {
                            return(false);
                        }
                        break;

                    case Misc.NotCannotBeRepaired:
                        if (!CheckCanRepair(item))
                        {
                            return(false);
                        }
                        break;

                    case Misc.Brittle:
                        NegativeAttributes neg2 = RunicReforging.GetNegativeAttributes(item);
                        if (neg2 == null || neg2.Brittle == 0)
                        {
                            return(false);
                        }
                        break;

                    case Misc.NotBrittle:
                        NegativeAttributes neg3 = RunicReforging.GetNegativeAttributes(item);
                        if (neg3 != null && neg3.Brittle > 0)
                        {
                            return(false);
                        }
                        break;

                    case Misc.Antique:
                        NegativeAttributes neg4 = RunicReforging.GetNegativeAttributes(item);
                        if (neg4 == null || neg4.Antique == 0)
                        {
                            return(false);
                        }
                        break;

                    case Misc.NotAntique:
                        NegativeAttributes neg5 = RunicReforging.GetNegativeAttributes(item);
                        if (neg5 != null && neg5.Antique > 0)
                        {
                            return(false);
                        }
                        break;
                    }
                }
                else if (o is string)
                {
                    string str = o as string;

                    if (str == "WeaponVelocity" && (!(item is BaseRanged) || ((BaseRanged)item).Velocity < value))
                    {
                        return(false);
                    }

                    /*if (str == "BalancedWeapon" && (!(item is BaseRanged) || !((BaseRanged)item).Balanced))
                     *  return false;*/

                    if (str == "SearingWeapon" && (!(item is BaseWeapon) || !((BaseWeapon)item).SearingWeapon))
                    {
                        return(false);
                    }

                    if (str == "ArtifactRarity" && (!(item is IArtifact) || ((IArtifact)item).ArtifactRarity < value))
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }
コード例 #23
0
ファイル: BaseArmor.cs プロジェクト: FreeReign/Rebirth-Repack
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            int version = reader.ReadInt();

            switch ( version )
            {
                case 8:
                {
                    m_Identified = reader.ReadMobileList();

                    goto case 7;
                }
                case 7:
                case 6:
                case 5:
                {
                    SaveFlag flags = (SaveFlag)reader.ReadEncodedInt();

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

                    if ( GetSaveFlag( flags, SaveFlag.ArmorAttributes ) )
                        m_AosArmorAttributes = new AosArmorAttributes( this, reader );
                    else
                        m_AosArmorAttributes = new AosArmorAttributes( this );

                    if ( GetSaveFlag( flags, SaveFlag.PhysicalBonus ) )
                        m_PhysicalBonus = reader.ReadEncodedInt();

                    if ( GetSaveFlag( flags, SaveFlag.FireBonus ) )
                        m_FireBonus = reader.ReadEncodedInt();

                    if ( GetSaveFlag( flags, SaveFlag.ColdBonus ) )
                        m_ColdBonus = reader.ReadEncodedInt();

                    if ( GetSaveFlag( flags, SaveFlag.PoisonBonus ) )
                        m_PoisonBonus = reader.ReadEncodedInt();

                    if ( GetSaveFlag( flags, SaveFlag.EnergyBonus ) )
                        m_EnergyBonus = reader.ReadEncodedInt();

                    if ( GetSaveFlag( flags, SaveFlag.Identified ) && version < 7 )
                        reader.ReadBool();
                        //m_Identified = ( version >= 7 || reader.ReadBool() );

                    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 = (CraftQuality)reader.ReadEncodedInt();
                    else
                        m_Quality = CraftQuality.Regular;

                    if ( version == 5 && m_Quality == CraftQuality.Low )
                        m_Quality = CraftQuality.Regular;

                    if ( GetSaveFlag( flags, SaveFlag.Durability ) )
                        m_Durability = (DurabilityLevel)reader.ReadEncodedInt();

                    if ( GetSaveFlag( flags, SaveFlag.Protection ) )
                        m_Protection = (ArmorProtectionLevel)reader.ReadEncodedInt();

                    if ( GetSaveFlag( flags, SaveFlag.BaseArmor ) )
                        m_ArmorBase = reader.ReadEncodedInt();
                    else
                        m_ArmorBase = -1;

                    if ( GetSaveFlag( flags, SaveFlag.StrBonus ) )
                        m_StrBonus = reader.ReadEncodedInt();
                    else
                        m_StrBonus = -1;

                    if ( GetSaveFlag( flags, SaveFlag.DexBonus ) )
                        m_DexBonus = reader.ReadEncodedInt();
                    else
                        m_DexBonus = -1;

                    if ( GetSaveFlag( flags, SaveFlag.IntBonus ) )
                        m_IntBonus = reader.ReadEncodedInt();
                    else
                        m_IntBonus = -1;

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

                    if ( GetSaveFlag( flags, SaveFlag.DexReq ) )
                        m_DexReq = reader.ReadEncodedInt();
                    else
                        m_DexReq = -1;

                    if ( GetSaveFlag( flags, SaveFlag.IntReq ) )
                        m_IntReq = reader.ReadEncodedInt();
                    else
                        m_IntReq = -1;

                    if ( GetSaveFlag( flags, SaveFlag.MedAllowance ) )
                        m_Meditate = (AMA)reader.ReadEncodedInt();
                    else
                        m_Meditate = (AMA)(-1);

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

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

                    break;
                }
                case 4:
                {
                    m_AosAttributes = new AosAttributes( this, reader );
                    m_AosArmorAttributes = new AosArmorAttributes( this, reader );
                    goto case 3;
                }
                case 3:
                {
                    m_PhysicalBonus = reader.ReadInt();
                    m_FireBonus = reader.ReadInt();
                    m_ColdBonus = reader.ReadInt();
                    m_PoisonBonus = reader.ReadInt();
                    m_EnergyBonus = reader.ReadInt();
                    goto case 2;
                }
                case 2:
                case 1:
                {
                    /*m_Identified = */reader.ReadBool();
                    goto case 0;
                }
                case 0:
                {
                    m_ArmorBase = reader.ReadInt();
                    m_MaxHitPoints = reader.ReadInt();
                    m_HitPoints = reader.ReadInt();
                    m_Crafter = reader.ReadMobile();
                    m_Quality = (CraftQuality)reader.ReadInt();
                    m_Durability = (DurabilityLevel)reader.ReadInt();
                    m_Protection = (ArmorProtectionLevel)reader.ReadInt();

                    AMT mat = (AMT)reader.ReadInt();

                    if ( m_ArmorBase == RevertArmorBase )
                        m_ArmorBase = -1;

                    /*m_BodyPos = (ArmorBodyType)*/reader.ReadInt();

                    if ( version < 4 )
                    {
                        m_AosAttributes = new AosAttributes( this );
                        m_AosArmorAttributes = new AosArmorAttributes( this );
                    }

                    if ( version < 3 && m_Quality == CraftQuality.Exceptional )
                        DistributeBonuses( 6 );

                    m_StrBonus = reader.ReadInt();
                    m_DexBonus = reader.ReadInt();
                    m_IntBonus = reader.ReadInt();
                    m_StrReq = reader.ReadInt();
                    m_DexReq = reader.ReadInt();
                    m_IntReq = reader.ReadInt();

                    if ( m_StrBonus == OldStrBonus )
                        m_StrBonus = -1;

                    if ( m_DexBonus == OldDexBonus )
                        m_DexBonus = -1;

                    if ( m_IntBonus == OldIntBonus )
                        m_IntBonus = -1;

                    if ( m_StrReq == OldStrReq )
                        m_StrReq = -1;

                    if ( m_DexReq == OldDexReq )
                        m_DexReq = -1;

                    if ( m_IntReq == OldIntReq )
                        m_IntReq = -1;

                    m_Meditate = (AMA)reader.ReadInt();

                    if ( m_Meditate == OldMedAllowance )
                        m_Meditate = (AMA)(-1);

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

                    break;
                }
            }

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

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

            int strBonus = ComputeStatBonus( StatType.Str );
            int dexBonus = ComputeStatBonus( StatType.Dex );
            int intBonus = ComputeStatBonus( StatType.Int );

            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 ( version < 7 )
                m_PlayerConstructed = true; // we don't know, so, assume it's crafted
        }
コード例 #24
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize( reader );

            int version = reader.ReadInt();

            switch( version )
            {
                case 12:
                case 11:
                case 10:
                case 9:
                case 8:
                case 7:
                case 6:
                case 5:
                    {
                        SaveFlag flags = (SaveFlag)reader.ReadEncodedInt();

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

                        if( GetSaveFlag( flags, SaveFlag.ArmorAttributes ) )
                            m_AosArmorAttributes = new AosArmorAttributes( this, reader );
                        else
                            m_AosArmorAttributes = new AosArmorAttributes( this );

                        if( GetSaveFlag( flags, SaveFlag.BluntBonus ) )
                            m_BluntBonus = reader.ReadEncodedInt();

                        if( GetSaveFlag( flags, SaveFlag.SlashingBonus ) )
                            m_SlashingBonus = reader.ReadEncodedInt();

                        if( GetSaveFlag( flags, SaveFlag.PiercingBonus ) )
                            m_PiercingBonus = reader.ReadEncodedInt();

                        if( GetSaveFlag( flags, SaveFlag.PhysicalBonus ) )
                            m_PhysicalBonus = reader.ReadEncodedInt();

                        if( GetSaveFlag( flags, SaveFlag.FireBonus ) )
                            m_FireBonus = reader.ReadEncodedInt();

                        if( GetSaveFlag( flags, SaveFlag.ColdBonus ) )
                            m_ColdBonus = reader.ReadEncodedInt();

                        if( GetSaveFlag( flags, SaveFlag.PoisonBonus ) )
                            m_PoisonBonus = reader.ReadEncodedInt();

                        if( GetSaveFlag( flags, SaveFlag.EnergyBonus ) )
                            m_EnergyBonus = reader.ReadEncodedInt();

                        if( GetSaveFlag( flags, SaveFlag.Identified ) )
                            m_Identified = ( version >= 7 || reader.ReadBool() );

                        if( GetSaveFlag( flags, SaveFlag.Protection ) )
                        {
                            m_Protection = (ArmorProtectionLevel)reader.ReadEncodedInt();

                            if( m_Protection > ArmorProtectionLevel.Invulnerability )
                                m_Protection = ArmorProtectionLevel.Defense;
                        }

                        if( GetSaveFlag( flags, SaveFlag.BaseArmor ) )
                            m_ArmorBase = reader.ReadEncodedInt();
                        else
                            m_ArmorBase = -1;

                        if( GetSaveFlag( flags, SaveFlag.HitsMaxBonus ) )
                            m_HitsMaxBonus = reader.ReadEncodedInt();
                        else
                            m_HitsMaxBonus = -1;

                        if( GetSaveFlag( flags, SaveFlag.StamMaxBonus ) )
                            m_StamMaxBonus = reader.ReadEncodedInt();
                        else
                            m_StamMaxBonus = -1;

                        if( GetSaveFlag( flags, SaveFlag.ManaMaxBonus ) )
                            m_ManaMaxBonus = reader.ReadEncodedInt();
                        else
                            m_ManaMaxBonus = -1;

                        if( GetSaveFlag( flags, SaveFlag.StrBonus ) )
                            m_StrBonus = reader.ReadEncodedInt();
                        else
                            m_StrBonus = -1;

                        if( GetSaveFlag( flags, SaveFlag.DexBonus ) )
                            m_DexBonus = reader.ReadEncodedInt();
                        else
                            m_DexBonus = -1;

                        if( GetSaveFlag( flags, SaveFlag.IntBonus ) )
                            m_IntBonus = reader.ReadEncodedInt();
                        else
                            m_IntBonus = -1;

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

                        if( GetSaveFlag( flags, SaveFlag.DexReq ) )
                            m_DexReq = reader.ReadEncodedInt();
                        else
                            m_DexReq = -1;

                        if( GetSaveFlag( flags, SaveFlag.IntReq ) )
                            m_IntReq = reader.ReadEncodedInt();
                        else
                            m_IntReq = -1;

                        if( GetSaveFlag( flags, SaveFlag.MedAllowance ) )
                            m_Meditate = (AMA)reader.ReadEncodedInt();
                        else
                            m_Meditate = (AMA)( -1 );

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

                        break;
                    }
                case 4:
                    {
                        m_AosAttributes = new AosAttributes( this, reader );
                        m_AosArmorAttributes = new AosArmorAttributes( this, reader );
                        goto case 3;
                    }
                case 3:
                    {
                        m_PhysicalBonus = reader.ReadInt();
                        m_FireBonus = reader.ReadInt();
                        m_ColdBonus = reader.ReadInt();
                        m_PoisonBonus = reader.ReadInt();
                        m_EnergyBonus = reader.ReadInt();
                        goto case 2;
                    }
                case 2:
                case 1:
                    {
                        m_Identified = reader.ReadBool();
                        goto case 0;
                    }
                case 0:
                    {
                        m_ArmorBase = reader.ReadInt();
                        m_Protection = (ArmorProtectionLevel)reader.ReadInt();

                        if( m_ArmorBase == RevertArmorBase )
                            m_ArmorBase = -1;

                        reader.ReadInt();

                        if( version < 4 )
                        {
                            m_AosAttributes = new AosAttributes( this );
                            m_AosArmorAttributes = new AosArmorAttributes( this );
                        }

                        m_HitsMaxBonus = reader.ReadInt();
                        m_StamMaxBonus = reader.ReadInt();
                        m_ManaMaxBonus = reader.ReadInt();

                        m_StrBonus = reader.ReadInt();
                        m_DexBonus = reader.ReadInt();
                        m_IntBonus = reader.ReadInt();
                        m_StrReq = reader.ReadInt();
                        m_DexReq = reader.ReadInt();
                        m_IntReq = reader.ReadInt();

                        if( m_HitsMaxBonus == OldHitsMaxBonus )
                            m_HitsMaxBonus = -1;

                        if( m_StamMaxBonus == OldStamMaxBonus )
                            m_StamMaxBonus = -1;

                        if( m_ManaMaxBonus == OldManaMaxBonus )
                            m_ManaMaxBonus = -1;

                        if( m_StrBonus == OldStrBonus )
                            m_StrBonus = -1;

                        if( m_DexBonus == OldDexBonus )
                            m_DexBonus = -1;

                        if( m_IntBonus == OldIntBonus )
                            m_IntBonus = -1;

                        if( m_StrReq == OldStrReq )
                            m_StrReq = -1;

                        if( m_DexReq == OldDexReq )
                            m_DexReq = -1;

                        if( m_IntReq == OldIntReq )
                            m_IntReq = -1;

                        m_Meditate = (AMA)reader.ReadInt();

                        if( m_Meditate == OldMedAllowance )
                            m_Meditate = (AMA)( -1 );

                        break;
                    }
            }

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

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

            int hitsmaxBonus = ComputeStatBonus( StatType.HitsMax );
            int stammaxBonus = ComputeStatBonus( StatType.StamMax );
            int manamaxBonus = ComputeStatBonus( StatType.ManaMax );

            int strBonus = ComputeStatBonus( StatType.Str );
            int dexBonus = ComputeStatBonus( StatType.Dex );
            int intBonus = ComputeStatBonus( StatType.Int );

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

                string modName = Serial.ToString();

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

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

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

                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( version < 12 )
            {
                if( this.ParentEntity != null && this.ParentEntity is PlayerMobile )
                {
                    PlayerMobile pm = this.ParentEntity as PlayerMobile;
                    Attributes.WeaponSpeed = 0;
                    Attributes.WeaponDamage = 0;
                    Attributes.AttackChance = 0;
                    Attributes.DefendChance = 0;
                }
            }
        }
コード例 #25
0
ファイル: BaseClothing.cs プロジェクト: Crome696/ServUO
        public BaseClothing(int itemID, Layer layer, int hue)
            : base(itemID)
        {
            this.Layer = layer;
            this.Hue = hue;

            this.m_Resource = this.DefaultResource;
            this.m_Quality = ClothingQuality.Regular;

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

            this.m_AosAttributes = new AosAttributes(this);
            this.m_AosClothingAttributes = new AosArmorAttributes(this);
            this.m_AosSkillBonuses = new AosSkillBonuses(this);
            this.m_AosResistances = new AosElementAttributes(this);
            this.m_SAAbsorptionAttributes = new SAAbsorptionAttributes(this);
            m_NegativeAttributes = new NegativeAttributes(this);

            #region Mondain's Legacy Sets
            this.m_SetAttributes = new AosAttributes(this);
            this.m_SetSkillBonuses = new AosSkillBonuses(this);
            #endregion
        }
コード例 #26
0
ファイル: BaseArmor.cs プロジェクト: suiy187/runuocustom
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();

			switch ( version )
            {
                #region Personal Bless Deed
                case 9:
                    {
                        m_BlessedBy = reader.ReadMobile();
                        goto case 8;
                    }
                #endregion
                #region Mondain's Legacy Sets
                case 8:
					SetFlag sflags = (SetFlag) reader.ReadEncodedInt();
					
					if ( GetSaveFlag( sflags, SetFlag.Attributes ) )
						m_SetAttributes = new AosAttributes( this, reader );
					else
						m_SetAttributes = new AosAttributes( this );
					
					if ( GetSaveFlag( sflags, SetFlag.ArmorAttributes ) )
						m_SetSelfRepair = (new AosArmorAttributes( this, reader )).SelfRepair;
						
					if ( GetSaveFlag( sflags, SetFlag.SkillBonuses ) )
						m_SetSkillBonuses = new AosSkillBonuses( this, reader );
					else
						m_SetSkillBonuses =  new AosSkillBonuses( this );

					if ( GetSaveFlag( sflags, SetFlag.PhysicalBonus ) )
						m_SetPhysicalBonus = reader.ReadEncodedInt();

					if ( GetSaveFlag( sflags, SetFlag.FireBonus ) )
						m_SetFireBonus = reader.ReadEncodedInt();

					if ( GetSaveFlag( sflags, SetFlag.ColdBonus ) )
						m_SetColdBonus = reader.ReadEncodedInt();

					if ( GetSaveFlag( sflags, SetFlag.PoisonBonus ) )
						m_SetPoisonBonus = reader.ReadEncodedInt();

					if ( GetSaveFlag( sflags, SetFlag.EnergyBonus ) )
						m_SetEnergyBonus = reader.ReadEncodedInt();
						
					if ( GetSaveFlag( sflags, SetFlag.Hue ) )
						m_SetHue = reader.ReadEncodedInt();
						
					if ( GetSaveFlag( sflags, SetFlag.LastEquipped ) )
						m_LastEquipped = reader.ReadBool();
						
					if ( GetSaveFlag( sflags, SetFlag.SetEquipped ) )
						m_SetEquipped = reader.ReadBool();
						
					if ( GetSaveFlag( sflags, SetFlag.SetSelfRepair ) )
						m_SetSelfRepair = reader.ReadEncodedInt();
					
					goto case 7;
				#endregion
				case 7:
				case 6:
				case 5:
				{
					SaveFlag flags = (SaveFlag)reader.ReadEncodedInt();

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

					if ( GetSaveFlag( flags, SaveFlag.ArmorAttributes ) )
						m_AosArmorAttributes = new AosArmorAttributes( this, reader );
					else
						m_AosArmorAttributes = new AosArmorAttributes( this );

					if ( GetSaveFlag( flags, SaveFlag.PhysicalBonus ) )
						m_PhysicalBonus = reader.ReadEncodedInt();

					if ( GetSaveFlag( flags, SaveFlag.FireBonus ) )
						m_FireBonus = reader.ReadEncodedInt();

					if ( GetSaveFlag( flags, SaveFlag.ColdBonus ) )
						m_ColdBonus = reader.ReadEncodedInt();

					if ( GetSaveFlag( flags, SaveFlag.PoisonBonus ) )
						m_PoisonBonus = reader.ReadEncodedInt();

					if ( GetSaveFlag( flags, SaveFlag.EnergyBonus ) )
						m_EnergyBonus = reader.ReadEncodedInt();

					if ( GetSaveFlag( flags, SaveFlag.Identified ) )
						m_Identified = ( version >= 7 || reader.ReadBool() );

					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 = (ArmorQuality)reader.ReadEncodedInt();
					else
						m_Quality = ArmorQuality.Regular;

					if ( version == 5 && m_Quality == ArmorQuality.Low )
						m_Quality = ArmorQuality.Regular;

					if ( GetSaveFlag( flags, SaveFlag.Durability ) )
					{
						m_Durability = (ArmorDurabilityLevel)reader.ReadEncodedInt();

						if ( m_Durability > ArmorDurabilityLevel.Indestructible )
							m_Durability = ArmorDurabilityLevel.Durable;
					}

					if ( GetSaveFlag( flags, SaveFlag.Protection ) )
					{
						m_Protection = (ArmorProtectionLevel)reader.ReadEncodedInt();

						if ( m_Protection > ArmorProtectionLevel.Invulnerability )
							m_Protection = ArmorProtectionLevel.Defense;
					}

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

					if ( m_Resource == CraftResource.None )
						m_Resource = DefaultResource;

					if ( GetSaveFlag( flags, SaveFlag.BaseArmor ) )
						m_ArmorBase = reader.ReadEncodedInt();
					else
						m_ArmorBase = -1;

					if ( GetSaveFlag( flags, SaveFlag.StrBonus ) )
						m_StrBonus = reader.ReadEncodedInt();
					else
						m_StrBonus = -1;

					if ( GetSaveFlag( flags, SaveFlag.DexBonus ) )
						m_DexBonus = reader.ReadEncodedInt();
					else
						m_DexBonus = -1;

					if ( GetSaveFlag( flags, SaveFlag.IntBonus ) )
						m_IntBonus = reader.ReadEncodedInt();
					else
						m_IntBonus = -1;

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

					if ( GetSaveFlag( flags, SaveFlag.DexReq ) )
						m_DexReq = reader.ReadEncodedInt();
					else
						m_DexReq = -1;

					if ( GetSaveFlag( flags, SaveFlag.IntReq ) )
						m_IntReq = reader.ReadEncodedInt();
					else
						m_IntReq = -1;

					if ( GetSaveFlag( flags, SaveFlag.MedAllowance ) )
						m_Meditate = (AMA)reader.ReadEncodedInt();
					else
						m_Meditate = (AMA)(-1);

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

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

					#region SA
					if ( version > 7 && GetSaveFlag( flags, SaveFlag.xAbsorptionAttributes ) )
							m_SAAbsorptionAttributes = new SAAbsorptionAttributes( this, reader );
						else
							m_SAAbsorptionAttributes = new SAAbsorptionAttributes( this );
					#endregion

					break;
				}
				case 4:
				{
					m_AosAttributes = new AosAttributes( this, reader );
					m_AosArmorAttributes = new AosArmorAttributes( this, reader );
					goto case 3;
				}
				case 3:
				{
					m_PhysicalBonus = reader.ReadInt();
					m_FireBonus = reader.ReadInt();
					m_ColdBonus = reader.ReadInt();
					m_PoisonBonus = reader.ReadInt();
					m_EnergyBonus = reader.ReadInt();
					goto case 2;
				}
				case 2:
				case 1:
				{
					m_Identified = reader.ReadBool();
					goto case 0;
				}
				case 0:
				{
					m_ArmorBase = reader.ReadInt();
					m_MaxHitPoints = reader.ReadInt();
					m_HitPoints = reader.ReadInt();
					m_Crafter = reader.ReadMobile();
					m_Quality = (ArmorQuality)reader.ReadInt();
					m_Durability = (ArmorDurabilityLevel)reader.ReadInt();
					m_Protection = (ArmorProtectionLevel)reader.ReadInt();

					AMT mat = (AMT)reader.ReadInt();

					if ( m_ArmorBase == RevertArmorBase )
						m_ArmorBase = -1;

					/*m_BodyPos = (ArmorBodyType)*/reader.ReadInt();

					if ( version < 4 )
					{
						m_AosAttributes = new AosAttributes( this );
						m_AosArmorAttributes = new AosArmorAttributes( this );
					}

					if ( version < 3 && m_Quality == ArmorQuality.Exceptional )
						DistributeBonuses( 6 );

					if ( version >= 2 )
					{
						m_Resource = (CraftResource)reader.ReadInt();
					}
					else
					{
						OreInfo info;

						switch ( reader.ReadInt() )
						{
							default:
							case 0: info = OreInfo.Iron; break;
							case 1: info = OreInfo.DullCopper; break;
							case 2: info = OreInfo.ShadowIron; break;
							case 3: info = OreInfo.Copper; break;
							case 4: info = OreInfo.Bronze; break;
							case 5: info = OreInfo.Gold; break;
							case 6: info = OreInfo.Agapite; break;
							case 7: info = OreInfo.Verite; break;
							case 8: info = OreInfo.Valorite; break;
						}

						m_Resource = CraftResources.GetFromOreInfo( info, mat );
					}

					m_StrBonus = reader.ReadInt();
					m_DexBonus = reader.ReadInt();
					m_IntBonus = reader.ReadInt();
					m_StrReq = reader.ReadInt();
					m_DexReq = reader.ReadInt();
					m_IntReq = reader.ReadInt();

					if ( m_StrBonus == OldStrBonus )
						m_StrBonus = -1;

					if ( m_DexBonus == OldDexBonus )
						m_DexBonus = -1;

					if ( m_IntBonus == OldIntBonus )
						m_IntBonus = -1;

					if ( m_StrReq == OldStrReq )
						m_StrReq = -1;

					if ( m_DexReq == OldDexReq )
						m_DexReq = -1;

					if ( m_IntReq == OldIntReq )
						m_IntReq = -1;

					m_Meditate = (AMA)reader.ReadInt();

					if ( m_Meditate == OldMedAllowance )
						m_Meditate = (AMA)(-1);

					if ( m_Resource == CraftResource.None )
					{
						if ( mat == ArmorMaterialType.Studded || mat == ArmorMaterialType.Leather )
							m_Resource = CraftResource.RegularLeather;
						else if ( mat == ArmorMaterialType.Spined )
							m_Resource = CraftResource.SpinedLeather;
						else if ( mat == ArmorMaterialType.Horned )
							m_Resource = CraftResource.HornedLeather;
						else if ( mat == ArmorMaterialType.Barbed )
							m_Resource = CraftResource.BarbedLeather;
						else
							m_Resource = CraftResource.Iron;
					}

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

					break;
				}
			}

			#region Mondain's Legacy Sets
			if ( m_SetAttributes == null )
				m_SetAttributes = new AosAttributes( this );
				
			if ( m_SetSkillBonuses == null )
				m_SetSkillBonuses = new AosSkillBonuses( this );
			#endregion
			
			if ( m_AosSkillBonuses == null )
				m_AosSkillBonuses = new AosSkillBonuses( this );

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

			int strBonus = ComputeStatBonus( StatType.Str );
			int dexBonus = ComputeStatBonus( StatType.Dex );
			int intBonus = ComputeStatBonus( StatType.Int );

			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 ( version < 7 )
				m_PlayerConstructed = true; // we don't know, so, assume it's crafted
		}
コード例 #27
0
		private static void ApplyAttribute( AosArmorAttributes attrs, int min, int max, AosArmorAttribute attr, int low, int high )
		{
			attrs[attr] = Scale( min, max, low, high );
		}
コード例 #28
0
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            int version = reader.ReadInt();

            switch ( version )
            {
                case 1:
                {
                    SaveFlag flags = (SaveFlag)reader.ReadEncodedInt();

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

                    if ( GetSaveFlag( flags, SaveFlag.ArmorAttributes ) )
                        m_AosArmorAttributes = new AosArmorAttributes( this, reader );
                    else
                        m_AosArmorAttributes = new AosArmorAttributes( this );

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

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

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

                    if ( m_Resource == CraftResource.None )
                        m_Resource = DefaultResource;

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

                    if ( GetSaveFlag( flags, SaveFlag.DexReq ) )
                        m_DexReq = reader.ReadEncodedInt();
                    else
                        m_DexReq = -1;

                    if ( GetSaveFlag( flags, SaveFlag.IntReq ) )
                        m_IntReq = reader.ReadEncodedInt();
                    else
                        m_IntReq = -1;

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

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

                    if ( GetSaveFlag( flags, SaveFlag.BonusRandomAttributes ) )
                    {
                        m_BonusRandomAttributes = new BonusAttribute[reader.ReadInt()];

                        for( int i = 0; i < m_BonusRandomAttributes.Length; i++ )
                            m_BonusRandomAttributes[i] =  new BonusAttribute( reader );
                    }

                    break;
                }
                case 0:
                {
                    m_InheritsItem = true;
                    m_OldVersion = version;
                    m_AosAttributes = new AosAttributes( this );
                    m_AosArmorAttributes = new AosArmorAttributes( this );
                    m_Quality = CraftQuality.Regular;
                    m_Resource = DefaultResource;
                    m_PlayerConstructed = true;
                    break;
                }
            }

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

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

            if ( Parent is Mobile )
                ((Mobile)Parent).CheckStatTimers();
        }
コード例 #29
0
ファイル: BaseClothing.cs プロジェクト: zerodowned/kaltar
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 5:
            {
                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();
            }
        }
コード例 #30
0
ファイル: BaseArmor.cs プロジェクト: proxeeus/UORebirth
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 8:
            {
                m_Identified = reader.ReadMobileList();

                goto case 7;
            }

            case 7:
            case 6:
            case 5:
            {
                SaveFlag flags = (SaveFlag)reader.ReadEncodedInt();

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

                if (GetSaveFlag(flags, SaveFlag.ArmorAttributes))
                {
                    m_AosArmorAttributes = new AosArmorAttributes(this, reader);
                }
                else
                {
                    m_AosArmorAttributes = new AosArmorAttributes(this);
                }

                if (GetSaveFlag(flags, SaveFlag.PhysicalBonus))
                {
                    m_PhysicalBonus = reader.ReadEncodedInt();
                }

                if (GetSaveFlag(flags, SaveFlag.FireBonus))
                {
                    m_FireBonus = reader.ReadEncodedInt();
                }

                if (GetSaveFlag(flags, SaveFlag.ColdBonus))
                {
                    m_ColdBonus = reader.ReadEncodedInt();
                }

                if (GetSaveFlag(flags, SaveFlag.PoisonBonus))
                {
                    m_PoisonBonus = reader.ReadEncodedInt();
                }

                if (GetSaveFlag(flags, SaveFlag.EnergyBonus))
                {
                    m_EnergyBonus = reader.ReadEncodedInt();
                }

                if (GetSaveFlag(flags, SaveFlag.Identified) && version < 7)
                {
                    reader.ReadBool();
                }
                //m_Identified = ( version >= 7 || reader.ReadBool() );

                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 = (CraftQuality)reader.ReadEncodedInt();
                }
                else
                {
                    m_Quality = CraftQuality.Regular;
                }

                if (version == 5 && m_Quality == CraftQuality.Low)
                {
                    m_Quality = CraftQuality.Regular;
                }

                if (GetSaveFlag(flags, SaveFlag.Durability))
                {
                    m_Durability = (DurabilityLevel)reader.ReadEncodedInt();
                }

                if (GetSaveFlag(flags, SaveFlag.Protection))
                {
                    m_Protection = (ArmorProtectionLevel)reader.ReadEncodedInt();
                }

                if (GetSaveFlag(flags, SaveFlag.BaseArmor))
                {
                    m_ArmorBase = reader.ReadEncodedInt();
                }
                else
                {
                    m_ArmorBase = -1;
                }

                if (GetSaveFlag(flags, SaveFlag.StrBonus))
                {
                    m_StrBonus = reader.ReadEncodedInt();
                }
                else
                {
                    m_StrBonus = -1;
                }

                if (GetSaveFlag(flags, SaveFlag.DexBonus))
                {
                    m_DexBonus = reader.ReadEncodedInt();
                }
                else
                {
                    m_DexBonus = -1;
                }

                if (GetSaveFlag(flags, SaveFlag.IntBonus))
                {
                    m_IntBonus = reader.ReadEncodedInt();
                }
                else
                {
                    m_IntBonus = -1;
                }

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

                if (GetSaveFlag(flags, SaveFlag.DexReq))
                {
                    m_DexReq = reader.ReadEncodedInt();
                }
                else
                {
                    m_DexReq = -1;
                }

                if (GetSaveFlag(flags, SaveFlag.IntReq))
                {
                    m_IntReq = reader.ReadEncodedInt();
                }
                else
                {
                    m_IntReq = -1;
                }

                if (GetSaveFlag(flags, SaveFlag.MedAllowance))
                {
                    m_Meditate = (AMA)reader.ReadEncodedInt();
                }
                else
                {
                    m_Meditate = (AMA)(-1);
                }

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

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

                break;
            }

            case 4:
            {
                m_AosAttributes      = new AosAttributes(this, reader);
                m_AosArmorAttributes = new AosArmorAttributes(this, reader);
                goto case 3;
            }

            case 3:
            {
                m_PhysicalBonus = reader.ReadInt();
                m_FireBonus     = reader.ReadInt();
                m_ColdBonus     = reader.ReadInt();
                m_PoisonBonus   = reader.ReadInt();
                m_EnergyBonus   = reader.ReadInt();
                goto case 2;
            }

            case 2:
            case 1:
            {
                /*m_Identified = */ reader.ReadBool();
                goto case 0;
            }

            case 0:
            {
                m_ArmorBase    = reader.ReadInt();
                m_MaxHitPoints = reader.ReadInt();
                m_HitPoints    = reader.ReadInt();
                m_Crafter      = reader.ReadMobile();
                m_Quality      = (CraftQuality)reader.ReadInt();
                m_Durability   = (DurabilityLevel)reader.ReadInt();
                m_Protection   = (ArmorProtectionLevel)reader.ReadInt();

                AMT mat = (AMT)reader.ReadInt();

                if (m_ArmorBase == RevertArmorBase)
                {
                    m_ArmorBase = -1;
                }

                /*m_BodyPos = (ArmorBodyType)*/ reader.ReadInt();

                if (version < 4)
                {
                    m_AosAttributes      = new AosAttributes(this);
                    m_AosArmorAttributes = new AosArmorAttributes(this);
                }

                if (version < 3 && m_Quality == CraftQuality.Exceptional)
                {
                    DistributeBonuses(6);
                }

                m_StrBonus = reader.ReadInt();
                m_DexBonus = reader.ReadInt();
                m_IntBonus = reader.ReadInt();
                m_StrReq   = reader.ReadInt();
                m_DexReq   = reader.ReadInt();
                m_IntReq   = reader.ReadInt();

                if (m_StrBonus == OldStrBonus)
                {
                    m_StrBonus = -1;
                }

                if (m_DexBonus == OldDexBonus)
                {
                    m_DexBonus = -1;
                }

                if (m_IntBonus == OldIntBonus)
                {
                    m_IntBonus = -1;
                }

                if (m_StrReq == OldStrReq)
                {
                    m_StrReq = -1;
                }

                if (m_DexReq == OldDexReq)
                {
                    m_DexReq = -1;
                }

                if (m_IntReq == OldIntReq)
                {
                    m_IntReq = -1;
                }

                m_Meditate = (AMA)reader.ReadInt();

                if (m_Meditate == OldMedAllowance)
                {
                    m_Meditate = (AMA)(-1);
                }

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

                break;
            }
            }

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

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

            int strBonus = ComputeStatBonus(StatType.Str);
            int dexBonus = ComputeStatBonus(StatType.Dex);
            int intBonus = ComputeStatBonus(StatType.Int);

            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 (version < 7)
            {
                m_PlayerConstructed = true;                 // we don't know, so, assume it's crafted
            }
        }
コード例 #31
0
ファイル: BaseArmor.cs プロジェクト: FeehTuffani/ServUO
        public BaseArmor(int itemID)
            : base(itemID)
        {
            this.m_Quality = ArmorQuality.Regular;
            this.m_Durability = ArmorDurabilityLevel.Regular;
            this.m_Crafter = null;

            this.m_Resource = this.DefaultResource;
            this.Hue = CraftResources.GetHue(this.m_Resource);

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

            this.Layer = (Layer)this.ItemData.Quality;

            this.m_AosAttributes = new AosAttributes(this);
            this.m_AosArmorAttributes = new AosArmorAttributes(this);
            this.m_AosSkillBonuses = new AosSkillBonuses(this);

            this.m_SAAbsorptionAttributes = new SAAbsorptionAttributes(this);

            #region Mondain's Legacy Sets
            this.m_SetAttributes = new AosAttributes(this);
            this.m_SetSkillBonuses = new AosSkillBonuses(this);
            #endregion
            this.m_AosSkillBonuses = new AosSkillBonuses(this);

            // Mod to randomly add sockets and socketability features to armor. These settings will yield
            // 2% drop rate of socketed/socketable items
            // 0.1% chance of 5 sockets
            // 0.5% of 4 sockets
            // 3% chance of 3 sockets
            // 15% chance of 2 sockets
            // 50% chance of 1 socket
            // the remainder will be 0 socket (31.4% in this case)
            // uncomment the next line to prevent artifacts from being socketed
            // if(ArtifactRarity == 0)
            XmlSockets.ConfigureRandom(this, 2.0, 0.1, 0.5, 3.0, 15.0, 50.0);
        }
コード例 #32
0
 private static void ApplyAttribute(AosArmorAttributes attrs, int min, int max, AosArmorAttribute attr, int low, int high)
 {
     attrs[attr] = Scale(min, max, low, high);
 }
コード例 #33
0
ファイル: BaseArmor.cs プロジェクト: suiy187/runuocustom
		public BaseArmor( int itemID ) :  base( itemID )
		{
			m_Quality = ArmorQuality.Regular;
			m_Durability = ArmorDurabilityLevel.Regular;
			m_Crafter = null;

			m_Resource = DefaultResource;
			Hue = CraftResources.GetHue( m_Resource );

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

			this.Layer = (Layer)ItemData.Quality;

			m_AosAttributes = new AosAttributes( this );
			m_AosArmorAttributes = new AosArmorAttributes( this );
			m_AosSkillBonuses = new AosSkillBonuses( this );
			
			m_SAAbsorptionAttributes = new SAAbsorptionAttributes( this );

			#region Mondain's Legacy Sets
			m_SetAttributes = new AosAttributes( this );
			m_SetSkillBonuses = new AosSkillBonuses( this );
			#endregion
		}
コード例 #34
0
 private static void ApplyAttribute(AosArmorAttributes attrs, int min, int max, AosArmorAttribute attr, int low, int high, int scale)
 {
     attrs[attr] = Scale(min, max, low / scale, high / scale) * scale;
 }