예제 #1
0
        public BaseJewel( int itemID, Layer layer )
            : base(itemID)
        {
            m_AosAttributes = new AosAttributes( this );
            m_AosResistances = new AosElementAttributes( this );
            m_AosSkillBonuses = new AosSkillBonuses( this );
            m_Resource = CraftResource.Iron;
            m_GemType = GemType.None;

            Layer = layer;
        }
예제 #2
0
        public BaseJewel( int itemID, Layer layer )
            : base(itemID)
        {
            m_AosAttributes = new AosAttributes( this );
            m_AosResistances = new AosElementAttributes( this );
            m_AosSkillBonuses = new AosSkillBonuses( this );
            m_Resource = CraftResource.Iron;
            m_GemType = GemType.None;

            Layer = layer;

            m_HitPoints = m_MaxHitPoints = Utility.RandomMinMax( InitMinHits, InitMaxHits );
        }
예제 #3
0
        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);
        }
예제 #4
0
파일: BaseJewel.cs 프로젝트: Godkong/RunUO
        public BaseJewel(int itemID, Layer layer, JewelEffect effect, int minCharges, int maxCharges)
            : base(itemID)
        {
            m_AosAttributes = new AosAttributes( this );
            m_AosResistances = new AosElementAttributes( this );
            m_AosSkillBonuses = new AosSkillBonuses( this );
            m_Resource = CraftResource.Iron;
            m_GemType = GemType.None;
            m_IDList = new List<Mobile>();

            Layer = layer;
            Weight = 1.0;
            Effect = effect;
            Charges = Utility.RandomMinMax( minCharges, maxCharges );
            m_Identified = false;
        }
예제 #5
0
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            int version = reader.ReadInt();

            switch ( version )
            {
                case 6: m_OldJewel = reader.ReadBool(); goto case 5;
                case 5: m_Seal = reader.ReadString(); goto case 4;
                case 4:
                case 3:
                {
                    m_Crafter = reader.ReadMobile();
                    m_CraftersOriginalName = reader.ReadString();
                    m_Quality = (WeaponQuality)reader.ReadInt();
                    goto case 2;
                }
                case 2:
                {
                    m_Resource = (CraftResource)reader.ReadEncodedInt();
                    m_GemType = (GemType)reader.ReadEncodedInt();

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

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

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

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

                        string modName = Serial.ToString();

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

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

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

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

                    break;
                }
                case 0:
                {
                    m_AosAttributes = new AosAttributes( this );
                    m_AosResistances = new AosElementAttributes( this );
                    m_AosSkillBonuses = new AosSkillBonuses( this );

                    break;
                }
            }

            if ( version < 2 )
            {
                m_Resource = CraftResource.Iron;
                m_GemType = GemType.None;
            }

            if( version < 4 )
                Hue = 0;

            if (!String.IsNullOrEmpty(m_Seal) && !Seals.Contains(m_Seal))
                Seals.Add(m_Seal);
        }
예제 #6
0
		public BaseJewel( int itemID, Layer layer ) : base( itemID )
		{
			m_AosAttributes = new AosAttributes( this );
			m_AosResistances = new AosElementAttributes( this );
			m_AosSkillBonuses = new AosSkillBonuses( this );
			m_Resource = CraftResource.Iron;
			m_GemType = GemType.None;

			Layer = layer;

			#region Mondain's Legacy Sets
			m_SetAttributes = new AosAttributes( this );
			m_SetSkillBonuses = new AosSkillBonuses( this );
			#endregion
		}
예제 #7
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

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

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

            if (GetSaveFlag(flags, SaveFlag.DamageModifier))
            {
                m_DamageModifier = new AosElementAttributes(this, reader);
            }
            else
            {
                m_DamageModifier = new AosElementAttributes(this);
            }

            if (GetSaveFlag(flags, SaveFlag.LowerAmmoCost))
            {
                m_LowerAmmoCost = reader.ReadInt();
            }

            if (GetSaveFlag(flags, SaveFlag.WeightReduction))
            {
                m_WeightReduction = reader.ReadInt();
            }

            if (GetSaveFlag(flags, SaveFlag.DamageIncrease))
            {
                m_DamageIncrease = reader.ReadInt();
            }

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

            if (GetSaveFlag(flags, SaveFlag.Quality))
            {
                m_Quality = (ClothingQuality)reader.ReadInt();
            }

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

            if (GetSaveFlag(flags, SaveFlag.Capacity))
            {
                m_Capacity = reader.ReadInt();
            }

            #region Mondain's Legacy Sets
            if (GetSaveFlag(flags, SaveFlag.SetAttributes))
            {
                m_SetAttributes = new AosAttributes(this, reader);
            }
            else
            {
                m_SetAttributes = new AosAttributes(this);
            }

            if (GetSaveFlag(flags, SaveFlag.SetSkillAttributes))
            {
                m_SetSkillBonuses = new AosSkillBonuses(this, reader);
            }
            else
            {
                m_SetSkillBonuses = new AosSkillBonuses(this);
            }

            if (GetSaveFlag(flags, SaveFlag.SetHue))
            {
                m_SetHue = reader.ReadInt();
            }

            if (GetSaveFlag(flags, SaveFlag.LastEquipped))
            {
                m_LastEquipped = reader.ReadBool();
            }

            if (GetSaveFlag(flags, SaveFlag.SetEquipped))
            {
                m_SetEquipped = reader.ReadBool();
            }
            #endregion

            if (version == 1)
            {
                Layer = Layer.Cloak;
            }
        }
예제 #8
0
		public BaseQuiver( int itemID ) : base( itemID )
		{
			Weight = 2;
			Capacity = 500;
			Layer = Layer.Cloak;
			
			m_Attributes = new AosAttributes( this );
			m_SetAttributes = new AosAttributes( this );
			m_SetSkillBonuses = new AosSkillBonuses( this );
			m_DamageModifier = new AosElementAttributes( this );
		}
예제 #9
0
        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();
            }
        }
예제 #10
0
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();

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

					if ( GetSaveFlag( flags, SaveFlag.DamageLevel ) )
					{
						m_DamageLevel = (WeaponDamageLevel)reader.ReadInt();

						if ( m_DamageLevel > WeaponDamageLevel.Vanq )
							m_DamageLevel = WeaponDamageLevel.Ruin;
					}

					if ( GetSaveFlag( flags, SaveFlag.AccuracyLevel ) )
					{
						m_AccuracyLevel = (WeaponAccuracyLevel)reader.ReadInt();

						if ( m_AccuracyLevel > WeaponAccuracyLevel.Supremely )
							m_AccuracyLevel = WeaponAccuracyLevel.Accurate;
					}

					if ( GetSaveFlag( flags, SaveFlag.DurabilityLevel ) )
					{
						m_DurabilityLevel = (WeaponDurabilityLevel)reader.ReadInt();

						if ( m_DurabilityLevel > WeaponDurabilityLevel.Indestructible )
							m_DurabilityLevel = WeaponDurabilityLevel.Durable;
					}

					if ( GetSaveFlag( flags, SaveFlag.Quality ) )
						m_Quality = (WeaponQuality)reader.ReadInt();
					else
						m_Quality = WeaponQuality.Regular;

					if ( GetSaveFlag( flags, SaveFlag.Hits ) )
						m_Hits = reader.ReadInt();

					if ( GetSaveFlag( flags, SaveFlag.MaxHits ) )
						m_MaxHits = reader.ReadInt();

					if ( GetSaveFlag( flags, SaveFlag.Slayer ) )
						m_Slayer = (SlayerName)reader.ReadInt();

					if ( GetSaveFlag( flags, SaveFlag.Poison ) )
						m_Poison = Poison.Deserialize( reader );

					if ( GetSaveFlag( flags, SaveFlag.PoisonCharges ) )
						m_PoisonCharges = reader.ReadInt();

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

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

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

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

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

					if ( GetSaveFlag( flags, SaveFlag.MinDamage ) )
						m_MinDamage = reader.ReadInt();
					else
						m_MinDamage = -1;

					if ( GetSaveFlag( flags, SaveFlag.MaxDamage ) )
						m_MaxDamage = reader.ReadInt();
					else
						m_MaxDamage = -1;

					if ( GetSaveFlag( flags, SaveFlag.HitSound ) )
						m_HitSound = reader.ReadInt();
					else
						m_HitSound = -1;

					if ( GetSaveFlag( flags, SaveFlag.MissSound ) )
						m_MissSound = reader.ReadInt();
					else
						m_MissSound = -1;

					if ( GetSaveFlag( flags, SaveFlag.Speed ) )
					{
						if ( version < 9 )
							m_Speed = reader.ReadInt();
						else
							m_Speed = reader.ReadFloat();
					}
					else
						m_Speed = -1;

					if ( GetSaveFlag( flags, SaveFlag.MaxRange ) )
						m_MaxRange = reader.ReadInt();
					else
						m_MaxRange = -1;

					if ( GetSaveFlag( flags, SaveFlag.Skill ) )
						m_Skill = (SkillName)reader.ReadInt();
					else
						m_Skill = (SkillName)(-1);

					if ( GetSaveFlag( flags, SaveFlag.Type ) )
						m_Type = (WeaponType)reader.ReadInt();
					else
						m_Type = (WeaponType)(-1);

					if ( GetSaveFlag( flags, SaveFlag.Animation ) )
						m_Animation = (WeaponAnimation)reader.ReadInt();
					else
						m_Animation = (WeaponAnimation)(-1);

					if ( GetSaveFlag( flags, SaveFlag.Resource ) )
						m_Resource = (CraftResource)reader.ReadInt();
					else
						m_Resource = CraftResource.Iron;

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

					if ( GetSaveFlag( flags, SaveFlag.xWeaponAttributes ) )
						m_AosWeaponAttributes = new AosWeaponAttributes( this, reader );
					else
						m_AosWeaponAttributes = new AosWeaponAttributes( this );

					if ( UseSkillMod && m_AccuracyLevel != WeaponAccuracyLevel.Regular && Parent is Mobile )
					{
						m_SkillMod = new DefaultSkillMod( AccuracySkill, true, (int)m_AccuracyLevel * 5 );
						((Mobile)Parent).AddSkillMod( m_SkillMod );
					}

					if ( version < 7 && m_AosWeaponAttributes.MageWeapon != 0 )
						m_AosWeaponAttributes.MageWeapon = 30 - m_AosWeaponAttributes.MageWeapon;

					if ( Core.AOS && m_AosWeaponAttributes.MageWeapon != 0 && m_AosWeaponAttributes.MageWeapon != 30 && Parent is Mobile )
					{
						m_MageMod = new DefaultSkillMod( SkillName.Magery, true, -30 + m_AosWeaponAttributes.MageWeapon );
						((Mobile)Parent).AddSkillMod( m_MageMod );
					}

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

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

					if( GetSaveFlag( flags, SaveFlag.Slayer2 ) )
						m_Slayer2 = (SlayerName)reader.ReadInt();

					if( GetSaveFlag( flags, SaveFlag.ElementalDamages ) )
						m_AosElementDamages = new AosElementAttributes( this, reader );
					else
						m_AosElementDamages = new AosElementAttributes( this );

					if( GetSaveFlag( flags, SaveFlag.EngravedText ) )
						m_EngravedText = reader.ReadString();

					break;
				}
				case 4:
				{
					m_Slayer = (SlayerName)reader.ReadInt();

					goto case 3;
				}
				case 3:
				{
					m_StrReq = reader.ReadInt();
					m_DexReq = reader.ReadInt();
					m_IntReq = reader.ReadInt();

					goto case 2;
				}
				case 2:
				{
					m_Identified = reader.ReadBool();

					goto case 1;
				}
				case 1:
				{
					m_MaxRange = reader.ReadInt();

					goto case 0;
				}
				case 0:
				{
					if ( version == 0 )
						m_MaxRange = 1; // default

					if ( version < 5 )
					{
						m_Resource = CraftResource.Iron;
						m_AosAttributes = new AosAttributes( this );
						m_AosWeaponAttributes = new AosWeaponAttributes( this );
						m_AosElementDamages = new AosElementAttributes( this );
						m_AosSkillBonuses = new AosSkillBonuses( this );
					}

					m_MinDamage = reader.ReadInt();
					m_MaxDamage = reader.ReadInt();

					m_Speed = reader.ReadInt();

					m_HitSound = reader.ReadInt();
					m_MissSound = reader.ReadInt();

					m_Skill = (SkillName)reader.ReadInt();
					m_Type = (WeaponType)reader.ReadInt();
					m_Animation = (WeaponAnimation)reader.ReadInt();
					m_DamageLevel = (WeaponDamageLevel)reader.ReadInt();
					m_AccuracyLevel = (WeaponAccuracyLevel)reader.ReadInt();
					m_DurabilityLevel = (WeaponDurabilityLevel)reader.ReadInt();
					m_Quality = (WeaponQuality)reader.ReadInt();

					m_Crafter = reader.ReadMobile();

					m_Poison = Poison.Deserialize( reader );
					m_PoisonCharges = reader.ReadInt();

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

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

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

					if ( m_MinDamage == OldMinDamage )
						m_MinDamage = -1;

					if ( m_MaxDamage == OldMaxDamage )
						m_MaxDamage = -1;

					if ( m_HitSound == OldHitSound )
						m_HitSound = -1;

					if ( m_MissSound == OldMissSound )
						m_MissSound = -1;

					if ( m_Speed == OldSpeed )
						m_Speed = -1;

					if ( m_MaxRange == OldMaxRange )
						m_MaxRange = -1;

					if ( m_Skill == OldSkill )
						m_Skill = (SkillName)(-1);

					if ( m_Type == OldType )
						m_Type = (WeaponType)(-1);

					if ( m_Animation == OldAnimation )
						m_Animation = (WeaponAnimation)(-1);

					if ( UseSkillMod && m_AccuracyLevel != WeaponAccuracyLevel.Regular && Parent is Mobile )
					{
						m_SkillMod = new DefaultSkillMod( AccuracySkill, true, (int)m_AccuracyLevel * 5);
						((Mobile)Parent).AddSkillMod( m_SkillMod );
					}

					break;
				}
			}

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

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

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

				string modName = this.Serial.ToString();

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

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

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

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

			if ( m_Hits <= 0 && m_MaxHits <= 0 )
			{
				m_Hits = m_MaxHits = Utility.RandomMinMax( InitMinHits, InitMaxHits );
			}

			if ( version < 6 )
				m_PlayerConstructed = true; // we don't know, so, assume it's crafted
		}
예제 #11
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            m_ReplenishesCharges = reader.ReadBool();
            if (m_ReplenishesCharges)
            {
                m_LastReplenished = reader.ReadDateTime();
            }

            m_Crafter = reader.ReadMobile();

            m_Quality = (InstrumentQuality)reader.ReadEncodedInt();
            m_Slayer  = (SlayerName)reader.ReadEncodedInt();
            m_Slayer2 = (SlayerName)reader.ReadEncodedInt();

            UsesRemaining = reader.ReadEncodedInt();

            m_WellSound  = reader.ReadEncodedInt();
            m_BadlySound = reader.ReadEncodedInt();

            m_MaxHitPoints = reader.ReadEncodedInt();
            m_HitPoints    = reader.ReadEncodedInt();

            m_Resource = (CraftResource)reader.ReadEncodedInt();

            m_AosAttributes   = new AosAttributes(this, reader);
            m_AosResistances  = new AosElementAttributes(this, reader);
            m_AosSkillBonuses = new AosSkillBonuses(this, reader);

            CheckReplenishUses();

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

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

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

                string modName = Serial.ToString();

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

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

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

            if (Parent is Mobile)
            {
                ((Mobile)Parent).CheckStatTimers();
            }
        }
예제 #12
0
		public BaseJewel( int itemID, Layer layer ) : base( itemID )
		{
			m_AosAttributes = new AosAttributes( this );
			m_AosResistances = new AosElementAttributes( this );
			m_AosSkillBonuses = new AosSkillBonuses( this );
			m_Resource = CraftResource.Iron;
			m_GemType = GemType.None;

			Layer = layer;

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

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

            #region SA
			m_SAAbsorptionAttributes = new SAAbsorptionAttributes( this );
			#endregion

			ItemValue = GearScore.GetItemValue( this );
        }
예제 #13
0
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();

			switch ( version )
			{
				#region ItemID_Mods
				case (3):
				{
				m_Identified = reader.ReadBool();
				goto case 2;
				}
				#endregion
				case 2:
				{
					m_Resource = (CraftResource)reader.ReadEncodedInt();
					m_GemType = (GemType)reader.ReadEncodedInt();

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

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

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

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

						string modName = Serial.ToString();

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

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

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

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

					break;
				}
				case 0:
				{
					m_AosAttributes = new AosAttributes( this );
					m_AosResistances = new AosElementAttributes( this );
					m_AosSkillBonuses = new AosSkillBonuses( this );

					break;
				}
			}

			if ( version < 2 )
			{
				m_Resource = CraftResource.Iron;
				m_GemType = GemType.None;
			}
		}
예제 #14
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

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

                goto case 2;
            }

            case 2:
            {
                m_Resource  = (CraftResource)reader.ReadEncodedInt();
                m_MLGemType = (MLGemType)reader.ReadEncodedInt();

                goto case 1;
            }

            case 1:
            {
                m_AosAttributes   = new AosAttributes(this, reader);
                m_AosResistances  = new AosElementAttributes(this, reader);
                m_AosSkillBonuses = new AosSkillBonuses(this, reader);

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

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

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

                    string modName = Serial.ToString();

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

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

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

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

                break;
            }

            case 0:
            {
                m_AosAttributes   = new AosAttributes(this);
                m_AosResistances  = new AosElementAttributes(this);
                m_AosSkillBonuses = new AosSkillBonuses(this);

                break;
            }
            }

            if (version < 2)
            {
                m_Resource  = CraftResource.Iron;
                m_MLGemType = MLGemType.None;
            }
        }
예제 #15
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
                case 6:
                    {
                        m_Crafter = reader.ReadMobile();
                        goto case 5;
                    }
                case 5:
                    {
                        m_PlayerConstructed = reader.ReadBool();
                        goto case 4;
                    }
                case 4:
                    {
                        m_Identified = reader.ReadBool();
                        goto case 3;
                    }
                case 3:
                    {
                        m_MaxHitPoints = reader.ReadEncodedInt();
                        m_HitPoints = reader.ReadEncodedInt();
                        goto case 2;
                    }
                case 2:
                    {
                        m_Resource = (CraftResource)reader.ReadEncodedInt();
                        m_GemType = (GemType)reader.ReadEncodedInt();

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

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

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

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

                            string modName = Serial.ToString();

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

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

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

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

                        break;
                    }
                case 0:
                    {
                        m_AosAttributes = new AosAttributes(this);
                        m_AosResistances = new AosElementAttributes(this);
                        m_AosSkillBonuses = new AosSkillBonuses(this);

                        break;
                    }
            }
            if (version < 5)
            {
                m_PlayerConstructed = false; //Assume it wasn't crafted
            }
            if (version < 4)
            {
                m_Identified = true; //Assume it was identified
            }
            if (version < 2)
            {
                m_Resource = CraftResource.MIron;
                m_GemType = GemType.None;
            }
        }
        public static void ApplyAttributesTo(BaseClothing clothing, bool isRunicTool, int luckChance, int attributeCount, int min, int max)
        {
            m_IsRunicTool = isRunicTool;
            m_LuckChance  = luckChance;

            AosAttributes        primary = clothing.Attributes;
            AosSkillBonuses      skills  = clothing.SkillBonuses;
            AosElementAttributes resists = clothing.Resistances;

            m_Props.SetAll(false);

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

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

                switch (random)
                {
                case  0: ApplySkillBonus(skills, min, max, 0, 1, 15); break;

                case  1: ApplySkillBonus(skills, min, max, 1, 1, 15); break;

                case  2: ApplySkillBonus(skills, min, max, 2, 1, 15); break;

                case  3: ApplySkillBonus(skills, min, max, 3, 1, 15); break;

                case  4: ApplySkillBonus(skills, min, max, 4, 1, 15); break;

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

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

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

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

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

                case 10: ApplyAttribute(primary, min, max, AosAttribute.BonusStam, 1, 50); break;

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

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

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

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

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

                case 16: ApplyAttribute(resists, min, max, AosElementAttribute.Physical, 1, 50); break;

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

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

                case 19: ApplyAttribute(resists, min, max, AosElementAttribute.Poison, 1, 50); break;

                case 20: ApplyAttribute(resists, min, max, AosElementAttribute.Energy, 1, 50); break;
                }
            }
        }
예제 #17
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 5:
            {
                #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();
                goto case 4;
            }

            case 4:
            {
                this.m_TimesImbued            = reader.ReadEncodedInt();
                this.m_SAAbsorptionAttributes = new SAAbsorptionAttributes(this, reader);
                #endregion

                this.m_BlessedBy    = reader.ReadMobile();
                this.m_LastEquipped = reader.ReadBool();
                this.m_SetEquipped  = reader.ReadBool();
                this.m_SetHue       = reader.ReadEncodedInt();

                this.m_SetAttributes   = new AosAttributes(this, reader);
                this.m_SetSkillBonuses = new AosSkillBonuses(this, reader);

                this.m_Crafter = reader.ReadMobile();
                this.m_Quality = (ArmorQuality)reader.ReadInt();
                goto case 3;
            }

            case 3:
            {
                this.m_MaxHitPoints = reader.ReadEncodedInt();
                this.m_HitPoints    = reader.ReadEncodedInt();

                goto case 2;
            }

            case 2:
            {
                this.m_Resource = (CraftResource)reader.ReadEncodedInt();
                this.m_GemType  = (GemType)reader.ReadEncodedInt();

                goto case 1;
            }

            case 1:
            {
                this.m_AosAttributes   = new AosAttributes(this, reader);
                this.m_AosResistances  = new AosElementAttributes(this, reader);
                this.m_AosSkillBonuses = new AosSkillBonuses(this, reader);

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

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

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

                    string modName = this.Serial.ToString();

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

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

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

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

                break;
            }

            case 0:
            {
                this.m_AosAttributes   = new AosAttributes(this);
                this.m_AosResistances  = new AosElementAttributes(this);
                this.m_AosSkillBonuses = new AosSkillBonuses(this);

                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_Resource = CraftResource.Iron;
                this.m_GemType  = GemType.None;
            }
        }
예제 #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
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 8:
            {
                m_Exceptional       = reader.ReadBool();
                m_PlayerConstructed = reader.ReadBool();
                m_Crafter           = reader.ReadMobile();

                goto case 7;
            }

            case 7:
            {
                m_AbsorptionAttributes = new AbsorptionAttributes(this, reader);

                m_TimesImbued = reader.ReadEncodedInt();

                m_MaxHitPoints = reader.ReadEncodedInt();
                m_HitPoints    = reader.ReadEncodedInt();

                m_Resource = (CraftResource)reader.ReadEncodedInt();
                m_GemType  = (GemType)reader.ReadEncodedInt();

                m_AosAttributes  = new AosAttributes(this, reader);
                m_AosResistances = new AosElementAttributes(this, reader);
                m_SkillBonuses   = new SkillBonuses(this, reader);

                if (Parent is Mobile)
                {
                    m_SkillBonuses.AddTo((Mobile)Parent);
                }

                break;
            }
            }

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

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

                string modName = Serial.ToString();

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

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

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

            if (Parent is Mobile)
            {
                ((Mobile)Parent).CheckStatTimers();
            }
        }
예제 #20
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 5:
            {
                // erl: New "crafted by" and quality properties

                m_Crafter = reader.ReadMobile();
                m_Quality = (JewelQuality)reader.ReadShort();
                goto case 4;
            }

            case 4:
            {
                // remove AOS crap
                // see case 1 below
                goto case 3;
            }

            case 3:
            {
                m_MagicType    = (JewelMagicEffect)reader.ReadInt();
                m_MagicCharges = reader.ReadInt();
                m_Identified   = reader.ReadBool();

                goto case 2;
            }

            case 2:
            {
                m_Resource = (CraftResource)reader.ReadEncodedInt();
                m_GemType  = (GemType)reader.ReadEncodedInt();

                goto case 1;
            }

            case 1:
            {
                // pack these out of furture versions.
                if (version < 4)
                {
                    AosAttributes        dmy_AosAttributes;
                    AosElementAttributes dmy_AosResistances;
                    AosSkillBonuses      dmy_AosSkillBonuses;
                    dmy_AosAttributes   = new AosAttributes(this, reader);
                    dmy_AosResistances  = new AosElementAttributes(this, reader);
                    dmy_AosSkillBonuses = new AosSkillBonuses(this, reader);

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

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

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

                        string modName = Serial.ToString();

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

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

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

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

                break;
            }

            case 0:
            {
                // pack these out of furture versions.
                if (version < 4)
                {
                    AosAttributes        dmy_AosAttributes;
                    AosElementAttributes dmy_AosResistances;
                    AosSkillBonuses      dmy_AosSkillBonuses;
                    dmy_AosAttributes   = new AosAttributes(this);
                    dmy_AosResistances  = new AosElementAttributes(this);
                    dmy_AosSkillBonuses = new AosSkillBonuses(this);
                }

                break;
            }
            }

            if (version < 2)
            {
                m_Resource = CraftResource.Iron;
                m_GemType  = GemType.None;
            }

            if (version < 5)
            {
                m_Quality = JewelQuality.Regular;
            }
        }
예제 #21
0
		private static void ApplyAttribute( AosElementAttributes attrs, int min, int max, AosElementAttribute attr, int low, int high )
		{
			attrs[attr] = Scale( min, max, low, high );
		}
예제 #22
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);
    }
예제 #23
0
        public BaseJewel(int itemID, Layer layer)
            : base(itemID)
        {
            this.m_AosAttributes = new AosAttributes(this);
            this.m_AosResistances = new AosElementAttributes(this);
            this.m_AosSkillBonuses = new AosSkillBonuses(this);
            this.m_Resource = CraftResource.Iron;
            this.m_GemType = GemType.None;

            this.Layer = layer;

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

            this.m_SetAttributes = new AosAttributes(this);
            this.m_SetSkillBonuses = new AosSkillBonuses(this);
            this.m_SAAbsorptionAttributes = new SAAbsorptionAttributes(this);
            m_NegativeAttributes = new NegativeAttributes(this);
        }
예제 #24
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

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

                goto case 5;
            }

            //personal bless deed
            case 5:
            {
                m_BlessedBy = reader.ReadMobile();
                goto case 4;
            }

                #region Mondain's Legacy Sets
            case 4:
            {
                m_LastEquipped = reader.ReadBool();
                m_SetEquipped  = reader.ReadBool();
                m_SetHue       = reader.ReadEncodedInt();

                m_SetAttributes   = new AosAttributes(this, reader);
                m_SetSkillBonuses = new AosSkillBonuses(this, reader);

                goto case 3;
            }

                #endregion
                #region Mondain's Legacy
            case 3:
            {
                m_Crafter = reader.ReadMobile();
                m_Quality = (ArmorQuality)reader.ReadInt();

                goto case 2;
            }

                #endregion
            case 2:
            {
                m_Resource = (CraftResource)reader.ReadEncodedInt();
                m_GemType  = (GemType)reader.ReadEncodedInt();

                goto case 1;
            }

            case 1:
            {
                m_AosAttributes   = new AosAttributes(this, reader);
                m_AosResistances  = new AosElementAttributes(this, reader);
                m_AosSkillBonuses = new AosSkillBonuses(this, reader);

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

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

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

                    string modName = Serial.ToString();

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

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

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

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

                break;
            }

            case 0:
            {
                m_AosAttributes   = new AosAttributes(this);
                m_AosResistances  = new AosElementAttributes(this);
                m_AosSkillBonuses = new AosSkillBonuses(this);

                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 (version < 2)
            {
                m_Resource = CraftResource.Iron;
                m_GemType  = GemType.None;
            }
        }
예제 #25
0
		public override void Deserialize(GenericReader reader)
		{
			base.Deserialize(reader);

			int version = reader.ReadInt();

			switch (version)
			{
                case 12:
                    {
                        #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_DImodded = reader.ReadBool();
                        m_SearingWeapon = reader.ReadBool();
                        goto case 11;
                    }
				case 11:
					{
						m_TimesImbued = reader.ReadInt();
                        #endregion

                        goto case 10;
					}
				case 10:
					{
						m_BlessedBy = reader.ReadMobile();
						m_EngravedText = reader.ReadString();
						m_Slayer3 = (TalismanSlayerName)reader.ReadInt();

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

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

						if (GetSaveFlag(flags, SetFlag.WeaponAttributes))
						{
							m_SetSelfRepair = (new AosWeaponAttributes(this, reader)).SelfRepair;
						}

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

						if (GetSaveFlag(flags, SetFlag.Hue))
						{
							m_SetHue = reader.ReadInt();
						}

						if (GetSaveFlag(flags, SetFlag.LastEquipped))
						{
							m_LastEquipped = reader.ReadBool();
						}

						if (GetSaveFlag(flags, SetFlag.SetEquipped))
						{
							m_SetEquipped = reader.ReadBool();
						}

						if (GetSaveFlag(flags, SetFlag.SetSelfRepair))
						{
							m_SetSelfRepair = reader.ReadEncodedInt();
						}

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

						if (GetSaveFlag(flags, SaveFlag.DamageLevel))
						{
							m_DamageLevel = (WeaponDamageLevel)reader.ReadInt();

							if (m_DamageLevel > WeaponDamageLevel.Vanq)
							{
								m_DamageLevel = WeaponDamageLevel.Ruin;
							}
						}

						if (GetSaveFlag(flags, SaveFlag.AccuracyLevel))
						{
							m_AccuracyLevel = (WeaponAccuracyLevel)reader.ReadInt();

							if (m_AccuracyLevel > WeaponAccuracyLevel.Supremely)
							{
								m_AccuracyLevel = WeaponAccuracyLevel.Accurate;
							}
						}

						if (GetSaveFlag(flags, SaveFlag.DurabilityLevel))
						{
							m_DurabilityLevel = (WeaponDurabilityLevel)reader.ReadInt();

							if (m_DurabilityLevel > WeaponDurabilityLevel.Indestructible)
							{
								m_DurabilityLevel = WeaponDurabilityLevel.Durable;
							}
						}

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

						if (GetSaveFlag(flags, SaveFlag.Hits))
						{
							m_Hits = reader.ReadInt();
						}

						if (GetSaveFlag(flags, SaveFlag.MaxHits))
						{
							m_MaxHits = reader.ReadInt();
						}

						if (GetSaveFlag(flags, SaveFlag.Slayer))
						{
							m_Slayer = (SlayerName)reader.ReadInt();
						}

						if (GetSaveFlag(flags, SaveFlag.Poison))
						{
							m_Poison = Poison.Deserialize(reader);
						}

						if (GetSaveFlag(flags, SaveFlag.PoisonCharges))
						{
							m_PoisonCharges = reader.ReadInt();
						}

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

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

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

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

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

						if (GetSaveFlag(flags, SaveFlag.MinDamage))
						{
							m_MinDamage = reader.ReadInt();
						}
						else
						{
							m_MinDamage = -1;
						}

						if (GetSaveFlag(flags, SaveFlag.MaxDamage))
						{
							m_MaxDamage = reader.ReadInt();
						}
						else
						{
							m_MaxDamage = -1;
						}

						if (GetSaveFlag(flags, SaveFlag.HitSound))
						{
							m_HitSound = reader.ReadInt();
						}
						else
						{
							m_HitSound = -1;
						}

						if (GetSaveFlag(flags, SaveFlag.MissSound))
						{
							m_MissSound = reader.ReadInt();
						}
						else
						{
							m_MissSound = -1;
						}

						if (GetSaveFlag(flags, SaveFlag.Speed))
						{
							if (version < 9)
							{
								m_Speed = reader.ReadInt();
							}
							else
							{
								m_Speed = reader.ReadFloat();
							}
						}
						else
						{
							m_Speed = -1;
						}

						if (GetSaveFlag(flags, SaveFlag.MaxRange))
						{
							m_MaxRange = reader.ReadInt();
						}
						else
						{
							m_MaxRange = -1;
						}

						if (GetSaveFlag(flags, SaveFlag.Skill))
						{
							m_Skill = (SkillName)reader.ReadInt();
						}
						else
						{
							m_Skill = (SkillName)(-1);
						}

						if (GetSaveFlag(flags, SaveFlag.Type))
						{
							m_Type = (WeaponType)reader.ReadInt();
						}
						else
						{
							m_Type = (WeaponType)(-1);
						}

						if (GetSaveFlag(flags, SaveFlag.Animation))
						{
							m_Animation = (WeaponAnimation)reader.ReadInt();
						}
						else
						{
							m_Animation = (WeaponAnimation)(-1);
						}

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

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

						if (GetSaveFlag(flags, SaveFlag.xWeaponAttributes))
						{
							m_AosWeaponAttributes = new AosWeaponAttributes(this, reader);
						}
						else
						{
							m_AosWeaponAttributes = new AosWeaponAttributes(this);
						}

						if (UseSkillMod && m_AccuracyLevel != WeaponAccuracyLevel.Regular && Parent is Mobile)
						{
							m_SkillMod = new DefaultSkillMod(AccuracySkill, true, (int)m_AccuracyLevel * 5);
							((Mobile)Parent).AddSkillMod(m_SkillMod);
						}

						if (version < 7 && m_AosWeaponAttributes.MageWeapon != 0)
						{
							m_AosWeaponAttributes.MageWeapon = 30 - m_AosWeaponAttributes.MageWeapon;
						}

						if (Core.AOS && m_AosWeaponAttributes.MageWeapon != 0 && m_AosWeaponAttributes.MageWeapon != 30 &&
							Parent is Mobile)
						{
							m_MageMod = new DefaultSkillMod(SkillName.Magery, true, -30 + m_AosWeaponAttributes.MageWeapon);
							((Mobile)Parent).AddSkillMod(m_MageMod);
						}

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

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

						if (GetSaveFlag(flags, SaveFlag.Slayer2))
						{
							m_Slayer2 = (SlayerName)reader.ReadInt();
						}

						if (GetSaveFlag(flags, SaveFlag.ElementalDamages))
						{
							m_AosElementDamages = new AosElementAttributes(this, reader);
						}
						else
						{
							m_AosElementDamages = new AosElementAttributes(this);
						}

						if (GetSaveFlag(flags, SaveFlag.EngravedText))
						{
							m_EngravedText = reader.ReadString();
						}

						#region Stygian Abyss
						if (version > 9 && GetSaveFlag(flags, SaveFlag.xAbsorptionAttributes))
						{
							m_SAAbsorptionAttributes = new SAAbsorptionAttributes(this, reader);
						}
						else
						{
							m_SAAbsorptionAttributes = new SAAbsorptionAttributes(this);
						}
						#endregion

						break;
					}
				case 4:
					{
						m_Slayer = (SlayerName)reader.ReadInt();

						goto case 3;
					}
				case 3:
					{
						m_StrReq = reader.ReadInt();
						m_DexReq = reader.ReadInt();
						m_IntReq = reader.ReadInt();

						goto case 2;
					}
				case 2:
					{
						m_Identified = reader.ReadBool();

						goto case 1;
					}
				case 1:
					{
						m_MaxRange = reader.ReadInt();

						goto case 0;
					}
				case 0:
					{
						if (version == 0)
						{
							m_MaxRange = 1; // default
						}

						if (version < 5)
						{
							m_Resource = CraftResource.Iron;
							m_AosAttributes = new AosAttributes(this);
							m_AosWeaponAttributes = new AosWeaponAttributes(this);
							m_AosElementDamages = new AosElementAttributes(this);
							m_AosSkillBonuses = new AosSkillBonuses(this);
						}

						m_MinDamage = reader.ReadInt();
						m_MaxDamage = reader.ReadInt();

						m_Speed = reader.ReadInt();

						m_HitSound = reader.ReadInt();
						m_MissSound = reader.ReadInt();

						m_Skill = (SkillName)reader.ReadInt();
						m_Type = (WeaponType)reader.ReadInt();
						m_Animation = (WeaponAnimation)reader.ReadInt();
						m_DamageLevel = (WeaponDamageLevel)reader.ReadInt();
						m_AccuracyLevel = (WeaponAccuracyLevel)reader.ReadInt();
						m_DurabilityLevel = (WeaponDurabilityLevel)reader.ReadInt();
						m_Quality = (WeaponQuality)reader.ReadInt();

						m_Crafter = reader.ReadMobile();

						m_Poison = Poison.Deserialize(reader);
						m_PoisonCharges = reader.ReadInt();

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

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

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

						if (m_MinDamage == OldMinDamage)
						{
							m_MinDamage = -1;
						}

						if (m_MaxDamage == OldMaxDamage)
						{
							m_MaxDamage = -1;
						}

						if (m_HitSound == OldHitSound)
						{
							m_HitSound = -1;
						}

						if (m_MissSound == OldMissSound)
						{
							m_MissSound = -1;
						}

						if (m_Speed == OldSpeed)
						{
							m_Speed = -1;
						}

						if (m_MaxRange == OldMaxRange)
						{
							m_MaxRange = -1;
						}

						if (m_Skill == OldSkill)
						{
							m_Skill = (SkillName)(-1);
						}

						if (m_Type == OldType)
						{
							m_Type = (WeaponType)(-1);
						}

						if (m_Animation == OldAnimation)
						{
							m_Animation = (WeaponAnimation)(-1);
						}

						if (UseSkillMod && m_AccuracyLevel != WeaponAccuracyLevel.Regular && Parent is Mobile)
						{
							m_SkillMod = new DefaultSkillMod(AccuracySkill, true, (int)m_AccuracyLevel * 5);
							((Mobile)Parent).AddSkillMod(m_SkillMod);
						}

						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 (Core.AOS && Parent is Mobile)
			{
				m_AosSkillBonuses.AddTo((Mobile)Parent);
			}

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

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

				string modName = Serial.ToString();

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

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

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

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

			if (m_Hits <= 0 && m_MaxHits <= 0)
			{
				m_Hits = m_MaxHits = Utility.RandomMinMax(InitMinHits, InitMaxHits);
			}

			if (version < 6)
			{
				m_PlayerConstructed = true; // we don't know, so, assume it's crafted
			}
		}
예제 #26
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

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

                goto case 3;
            }

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

                goto case 2;
            }

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

                goto case 1;
            }

            case 1:
            {
                m_AosAttributes  = new AosAttributes(this, reader);
                m_AosResistances = new AosElementAttributes(this, reader);
                m_SkillBonuses   = new SkillBonuses(this, reader);

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

                    m_isequiped = true;
                    InvalidateProperties();

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

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

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

                    string modName = Serial.ToString();

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

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

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

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

                break;
            }

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

                    m_isequiped = true;
                    InvalidateProperties();

                    //------ FIN Charged Time Left ---------
                    m_SkillBonuses.AddTo((Mobile)Parent);
                }
                m_AosAttributes  = new AosAttributes(this);
                m_AosResistances = new AosElementAttributes(this);
                m_SkillBonuses   = new SkillBonuses(this);

                break;
            }
            }

            if (version < 2)
            {
                m_Ownable                = (bool)reader.ReadBool();
                m_Owner                  = (Mobile)reader.ReadMobile();
                m_CraftBonusRegular      = (CraftList)reader.ReadInt();
                m_CraftBonusRegularValue = reader.ReadInt();
                m_CraftBonusExcep        = (CraftList)reader.ReadInt();
                m_CraftBonusExcepValue   = reader.ReadInt();
                m_ProtectionEntry        = (NPC_Name)reader.ReadInt();
                m_ProtectionValue        = reader.ReadInt();
                m_KillersEntry           = (NPC_Name)reader.ReadInt();
                m_KillersValue           = reader.ReadInt();
                m_TalisSlayer            = (TalisSlayerName)reader.ReadInt();
                m_TalismanType           = (TalismanType)reader.ReadInt();
                m_Charges                = reader.ReadInt();
            }
        }
예제 #27
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();
			}
		}
예제 #28
0
        public static void ApplyAttributesTo(BaseHat hat, bool playerMade, int luckChance, int attributeCount, int min, int max)
        {
            int delta;

            if (min > max)
            {
                delta = min;
                min   = max;
                max   = delta;
            }

            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;
                }
            }
        }
예제 #29
0
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();
			
			SaveFlag flags = (SaveFlag) reader.ReadEncodedInt();
			
			if ( GetSaveFlag( flags, SaveFlag.Attributes ) )
				m_Attributes = new AosAttributes( this, reader );
			else
				m_Attributes = new AosAttributes( this );
				
			if ( GetSaveFlag( flags, SaveFlag.DamageModifier ) )
				m_DamageModifier = new AosElementAttributes( this, reader );
			else
				m_DamageModifier = new AosElementAttributes( this );
				
			if ( GetSaveFlag( flags, SaveFlag.LowerAmmoCost ) )
				m_LowerAmmoCost = reader.ReadInt();
				
			if ( GetSaveFlag( flags, SaveFlag.WeightReduction ) )
				m_WeightReduction = reader.ReadInt();
				
			if ( GetSaveFlag( flags, SaveFlag.DamageIncrease ) )
				m_DamageIncrease = reader.ReadInt();
				
			if ( GetSaveFlag( flags, SaveFlag.Crafter ) )
				m_Crafter = reader.ReadMobile();
				
			if ( GetSaveFlag( flags, SaveFlag.Quality ) )
				m_Quality = (ClothingQuality) reader.ReadInt();
				
			if ( GetSaveFlag( flags, SaveFlag.PlayerConstructed ) )
				m_PlayerConstructed = reader.ReadBool();
				
			if ( GetSaveFlag( flags, SaveFlag.Capacity ) )
				m_Capacity = reader.ReadInt();
							
			#region Mondain's Legacy Sets
			if ( GetSaveFlag( flags, SaveFlag.SetAttributes ) )
				m_SetAttributes = new AosAttributes( this, reader );
			else
				m_SetAttributes = new AosAttributes( this );

			if ( GetSaveFlag( flags, SaveFlag.SetSkillAttributes ) )
				m_SetSkillBonuses = new AosSkillBonuses( this, reader );
			else
				m_SetSkillBonuses = new AosSkillBonuses( this );
				
			if ( GetSaveFlag( flags, SaveFlag.SetHue ) )
				m_SetHue = reader.ReadInt();
				
			if ( GetSaveFlag( flags, SaveFlag.LastEquipped ) )
				m_LastEquipped = reader.ReadBool();
									
			if ( GetSaveFlag( flags, SaveFlag.SetEquipped ) )
				m_SetEquipped = reader.ReadBool();
			#endregion
			
			if ( version == 1 )
				Layer = Layer.Cloak;
		}
예제 #30
0
        public BaseWeapon( int itemID )
            : base(itemID)
        {
            Layer = (Layer)ItemData.Quality;

            m_Quality = WeaponQuality.Regular;
            m_StrReq = -1;
            m_DexReq = -1;
            m_IntReq = -1;
            m_MinDamage = -1;
            m_MaxDamage = -1;
            m_HitSound = -1;
            m_MissSound = -1;
            m_Speed = -1;
            m_MaxRange = -1;
            m_Skill = (SkillName)(-1);
            m_Type = (WeaponType)(-1);
            m_Animation = (WeaponAnimation)(-1);

            m_Hits = m_MaxHits = Utility.RandomMinMax( InitMinHits, InitMaxHits );

            m_Components = new List<Item>();

            m_AosAttributes = new AosAttributes( this );
            m_AosWeaponAttributes = new AosWeaponAttributes( this );
            m_AosSkillBonuses = new AosSkillBonuses( this );
            m_AosElementDamages = new AosElementAttributes( this );

            if( this is BaseRanged || this is AzhuranBoomerang ||
                this is DruidStaff || this is ProphetDiviningRod || this is ClericCrook ||
                this is QuarterStaff || this is GnarledStaff || this is SpikedClub || this is Club ||
                this is BlackStaff )
                this.Resource = CraftResource.Oak;

            else
            {
                this.Resource = CraftResource.Copper;
                this.Hue = 2413;
            }

            if( this is IBoneArmour )
                this.Hue = 0;
        }
예제 #31
0
        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
        }
예제 #32
0
		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.ReadInt();

					if ( GetSaveFlag( flags, SaveFlag.DamageLevel ) )
					{
						m_DamageLevel = (WeaponDamageLevel)reader.ReadInt();

						if ( m_DamageLevel > WeaponDamageLevel.Vanq )
							m_DamageLevel = WeaponDamageLevel.Ruin;
					}

					if ( GetSaveFlag( flags, SaveFlag.AccuracyLevel ) )
					{
						m_AccuracyLevel = (WeaponAccuracyLevel)reader.ReadInt();

						if ( m_AccuracyLevel > WeaponAccuracyLevel.Supremely )
							m_AccuracyLevel = WeaponAccuracyLevel.Accurate;
					}

					if ( GetSaveFlag( flags, SaveFlag.DurabilityLevel ) )
					{
						m_DurabilityLevel = (WeaponDurabilityLevel)reader.ReadInt();

						if ( m_DurabilityLevel > WeaponDurabilityLevel.Indestructible )
							m_DurabilityLevel = WeaponDurabilityLevel.Durable;
					}

					if ( GetSaveFlag( flags, SaveFlag.Quality ) )
						m_Quality = (WeaponQuality)reader.ReadInt();
					else
						m_Quality = WeaponQuality.Regular;

					if ( GetSaveFlag( flags, SaveFlag.Hits ) )
						m_Hits = reader.ReadInt();

					if ( GetSaveFlag( flags, SaveFlag.MaxHits ) )
						m_MaxHits = reader.ReadInt();

					if ( GetSaveFlag( flags, SaveFlag.Slayer ) )
						m_Slayer = (SlayerName)reader.ReadInt();

					if ( GetSaveFlag( flags, SaveFlag.Poison ) )
						m_Poison = Poison.Deserialize( reader );

					if ( GetSaveFlag( flags, SaveFlag.PoisonCharges ) )
						m_PoisonCharges = reader.ReadInt();

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

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

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

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

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

					if ( GetSaveFlag( flags, SaveFlag.MinDamage ) )
						m_MinDamage = reader.ReadInt();
					else
						m_MinDamage = -1;

					if ( GetSaveFlag( flags, SaveFlag.MaxDamage ) )
						m_MaxDamage = reader.ReadInt();
					else
						m_MaxDamage = -1;

					if ( GetSaveFlag( flags, SaveFlag.HitSound ) )
						m_HitSound = reader.ReadInt();
					else
						m_HitSound = -1;

					if ( GetSaveFlag( flags, SaveFlag.MissSound ) )
						m_MissSound = reader.ReadInt();
					else
						m_MissSound = -1;

					if ( GetSaveFlag( flags, SaveFlag.Speed ) )
						m_Speed = reader.ReadInt();
					else
						m_Speed = -1;

					if ( GetSaveFlag( flags, SaveFlag.MaxRange ) )
						m_MaxRange = reader.ReadInt();
					else
						m_MaxRange = -1;

					if ( GetSaveFlag( flags, SaveFlag.Skill ) )
						m_Skill = (SkillName)reader.ReadInt();
					else
						m_Skill = (SkillName)(-1);

					if ( GetSaveFlag( flags, SaveFlag.Type ) )
						m_Type = (WeaponType)reader.ReadInt();
					else
						m_Type = (WeaponType)(-1);

					if ( GetSaveFlag( flags, SaveFlag.Animation ) )
						m_Animation = (WeaponAnimation)reader.ReadInt();
					else
						m_Animation = (WeaponAnimation)(-1);

					if ( GetSaveFlag( flags, SaveFlag.Resource ) )
						m_Resource = (CraftResource)reader.ReadInt();
					else
						m_Resource = CraftResource.Iron;

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

					if ( GetSaveFlag( flags, SaveFlag.xWeaponAttributes ) )
						m_AosWeaponAttributes = new AosWeaponAttributes( this, reader );
					else
						m_AosWeaponAttributes = new AosWeaponAttributes( this );

					if ( UseSkillMod && m_AccuracyLevel != WeaponAccuracyLevel.Regular && Parent is Mobile )
					{
						m_SkillMod = new DefaultSkillMod( AccuracySkill, true, (int)m_AccuracyLevel * 5 );
						((Mobile)Parent).AddSkillMod( m_SkillMod );
					}

					if ( version < 7 && m_AosWeaponAttributes.MageWeapon != 0 )
						m_AosWeaponAttributes.MageWeapon = 30 - m_AosWeaponAttributes.MageWeapon;

					if ( Core.AOS && m_AosWeaponAttributes.MageWeapon != 0 && m_AosWeaponAttributes.MageWeapon != 30 && Parent is Mobile )
					{
						m_MageMod = new DefaultSkillMod( SkillName.Magery, true, -30 + m_AosWeaponAttributes.MageWeapon );
						((Mobile)Parent).AddSkillMod( m_MageMod );
					}

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

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

                    // mod to randomly add sockets and socketability features to weapons. 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);

					if( GetSaveFlag( flags, SaveFlag.Slayer2 ) )
						m_Slayer2 = (SlayerName)reader.ReadInt();

					if( GetSaveFlag( flags, SaveFlag.ElementalDamages ) )
						m_AosElementDamages = new AosElementAttributes( this, reader );
					else
						m_AosElementDamages = new AosElementAttributes( this );

					break;
				}
				case 4:
				{
					m_Slayer = (SlayerName)reader.ReadInt();

					goto case 3;
				}
				case 3:
				{
					m_StrReq = reader.ReadInt();
					m_DexReq = reader.ReadInt();
					m_IntReq = reader.ReadInt();

					goto case 2;
				}
				case 2:
				{
					m_Identified = reader.ReadBool();

					goto case 1;
				}
				case 1:
				{
					m_MaxRange = reader.ReadInt();

					goto case 0;
				}
				case 0:
				{
					if ( version == 0 )
						m_MaxRange = 1; // default

					if ( version < 5 )
					{
						m_Resource = CraftResource.Iron;
						m_AosAttributes = new AosAttributes( this );
						m_AosWeaponAttributes = new AosWeaponAttributes( this );
						m_AosElementDamages = new AosElementAttributes( this );
                        m_AosSkillBonuses = new AosSkillBonuses(this);

                        // mod to randomly add sockets and socketability features to weapons. 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);
					}

					m_MinDamage = reader.ReadInt();
					m_MaxDamage = reader.ReadInt();

					m_Speed = reader.ReadInt();

					m_HitSound = reader.ReadInt();
					m_MissSound = reader.ReadInt();

					m_Skill = (SkillName)reader.ReadInt();
					m_Type = (WeaponType)reader.ReadInt();
					m_Animation = (WeaponAnimation)reader.ReadInt();
					m_DamageLevel = (WeaponDamageLevel)reader.ReadInt();
					m_AccuracyLevel = (WeaponAccuracyLevel)reader.ReadInt();
					m_DurabilityLevel = (WeaponDurabilityLevel)reader.ReadInt();
					m_Quality = (WeaponQuality)reader.ReadInt();

					m_Crafter = reader.ReadMobile();

					m_Poison = Poison.Deserialize( reader );
					m_PoisonCharges = reader.ReadInt();

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

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

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

					if ( m_MinDamage == OldMinDamage )
						m_MinDamage = -1;

					if ( m_MaxDamage == OldMaxDamage )
						m_MaxDamage = -1;

					if ( m_HitSound == OldHitSound )
						m_HitSound = -1;

					if ( m_MissSound == OldMissSound )
						m_MissSound = -1;

					if ( m_Speed == OldSpeed )
						m_Speed = -1;

					if ( m_MaxRange == OldMaxRange )
						m_MaxRange = -1;

					if ( m_Skill == OldSkill )
						m_Skill = (SkillName)(-1);

					if ( m_Type == OldType )
						m_Type = (WeaponType)(-1);

					if ( m_Animation == OldAnimation )
						m_Animation = (WeaponAnimation)(-1);

					if ( UseSkillMod && m_AccuracyLevel != WeaponAccuracyLevel.Regular && Parent is Mobile )
					{
						m_SkillMod = new DefaultSkillMod( AccuracySkill, true, (int)m_AccuracyLevel * 5);
						((Mobile)Parent).AddSkillMod( m_SkillMod );
					}

					break;
				}
			}

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

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

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

				string modName = this.Serial.ToString();

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

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

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

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

			if ( m_Hits <= 0 && m_MaxHits <= 0 )
			{
				m_Hits = m_MaxHits = Utility.RandomMinMax( InitMinHits, InitMaxHits );
			}

			if ( version < 6 )
				m_PlayerConstructed = true; // we don't know, so, assume it's crafted
		}
예제 #33
0
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            int version = reader.ReadInt();

            switch ( version )
            {
                case 27:
                case 26: m_BetaNerf = reader.ReadBool(); goto case 25;
                case 25: m_Components = reader.ReadStrongItemList(); goto case 24;
                case 24: m_NewCrafting = reader.ReadBool(); m_QualityDefense = reader.ReadInt(); goto case 23;
                case 23: m_HasHalo = reader.ReadBool(); goto case 22;
                case 22:
                case 21:
                case 20:
                {
                    m_QualityDamage = reader.ReadInt();
                    m_QualitySpeed = reader.ReadInt();
                    m_QualityAccuracy = reader.ReadInt();
                    goto case 19;
                }
                case 19:
                case 18:
                case 17:
                case 16:
                case 15:
                case 14:
                case 13:
                case 12:
                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.ReadInt();

                    if ( GetSaveFlag( flags, SaveFlag.DamageLevel ) )
                    {
                        m_DamageLevel = (WeaponDamageLevel)reader.ReadInt();

                        if ( m_DamageLevel > WeaponDamageLevel.Vanq )
                            m_DamageLevel = WeaponDamageLevel.Ruin;
                    }

                    if ( GetSaveFlag( flags, SaveFlag.AccuracyLevel ) )
                    {
                        m_AccuracyLevel = (WeaponAccuracyLevel)reader.ReadInt();

                        if ( m_AccuracyLevel > WeaponAccuracyLevel.Supremely )
                            m_AccuracyLevel = WeaponAccuracyLevel.Accurate;
                    }

                    if ( GetSaveFlag( flags, SaveFlag.DurabilityLevel ) )
                    {
                        m_DurabilityLevel = (WeaponDurabilityLevel)reader.ReadInt();

                        if ( m_DurabilityLevel > WeaponDurabilityLevel.Indestructible )
                            m_DurabilityLevel = WeaponDurabilityLevel.Durable;
                    }

                    if ( GetSaveFlag( flags, SaveFlag.Quality ) )
                        m_Quality = (WeaponQuality)reader.ReadInt();
                    else
                        m_Quality = WeaponQuality.Regular;

                    if ( GetSaveFlag( flags, SaveFlag.Hits ) )
                        m_Hits = reader.ReadInt();

                    if ( GetSaveFlag( flags, SaveFlag.MaxHits ) )
                        m_MaxHits = reader.ReadInt();

                    if ( GetSaveFlag( flags, SaveFlag.Slayer ) )
                        m_Slayer = (SlayerName)reader.ReadInt();

                    if ( GetSaveFlag( flags, SaveFlag.Poison ) )
                        m_Poison = Poison.Deserialize( reader );

                    if ( GetSaveFlag( flags, SaveFlag.PoisonCharges ) )
                        m_PoisonCharges = reader.ReadInt();

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

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

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

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

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

                    if ( GetSaveFlag( flags, SaveFlag.MinDamage ) )
                        m_MinDamage = reader.ReadInt();
                    else
                        m_MinDamage = -1;

                    if ( GetSaveFlag( flags, SaveFlag.MaxDamage ) )
                        m_MaxDamage = reader.ReadInt();
                    else
                        m_MaxDamage = -1;

                    if ( GetSaveFlag( flags, SaveFlag.HitSound ) )
                        m_HitSound = reader.ReadInt();
                    else
                        m_HitSound = -1;

                    if ( GetSaveFlag( flags, SaveFlag.MissSound ) )
                        m_MissSound = reader.ReadInt();
                    else
                        m_MissSound = -1;

                    if ( GetSaveFlag( flags, SaveFlag.Speed ) )
                        m_Speed = reader.ReadInt();
                    else
                        m_Speed = -1;

                    if ( GetSaveFlag( flags, SaveFlag.MaxRange ) )
                        m_MaxRange = reader.ReadInt();
                    else
                        m_MaxRange = -1;

                    if ( GetSaveFlag( flags, SaveFlag.Skill ) )
                        m_Skill = (SkillName)reader.ReadInt();
                    else
                        m_Skill = (SkillName)(-1);

                    if ( GetSaveFlag( flags, SaveFlag.Type ) )
                        m_Type = (WeaponType)reader.ReadInt();
                    else
                        m_Type = (WeaponType)(-1);

                    if ( GetSaveFlag( flags, SaveFlag.Animation ) )
                        m_Animation = (WeaponAnimation)reader.ReadInt();
                    else
                        m_Animation = (WeaponAnimation)(-1);

                    if ( GetSaveFlag( flags, SaveFlag.Resource ) )
                        m_Resource = (CraftResource)reader.ReadInt();
                    else
                        m_Resource = CraftResource.Iron;

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

                    if ( GetSaveFlag( flags, SaveFlag.xWeaponAttributes ) )
                        m_AosWeaponAttributes = new AosWeaponAttributes( this, reader );
                    else
                        m_AosWeaponAttributes = new AosWeaponAttributes( this );

                    if ( UseSkillMod && m_AccuracyLevel != WeaponAccuracyLevel.Regular && Parent is Mobile )
                    {
                        m_SkillMod = new DefaultSkillMod( AccuracySkill, true, (int)m_AccuracyLevel * 5 );
                        ((Mobile)Parent).AddSkillMod( m_SkillMod );
                    }

                    if ( version < 7 && m_AosWeaponAttributes.MageWeapon != 0 )
                        m_AosWeaponAttributes.MageWeapon = 30 - m_AosWeaponAttributes.MageWeapon;

                    if ( Core.AOS && m_AosWeaponAttributes.MageWeapon != 0 && m_AosWeaponAttributes.MageWeapon != 30 && Parent is Mobile )
                    {
                        m_MageMod = new DefaultSkillMod( SkillName.Magery, true, -30 + m_AosWeaponAttributes.MageWeapon );
                        ((Mobile)Parent).AddSkillMod( m_MageMod );
                    }

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

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

                    if( GetSaveFlag( flags, SaveFlag.Slayer2 ) )
                        m_Slayer2 = (SlayerName)reader.ReadInt();

                    if( GetSaveFlag( flags, SaveFlag.ElementalDamages ) )
                        m_AosElementDamages = new AosElementAttributes( this, reader );
                    else
                        m_AosElementDamages = new AosElementAttributes( this );

                    break;
                }
                case 4:
                {
                    m_Slayer = (SlayerName)reader.ReadInt();

                    goto case 3;
                }
                case 3:
                {
                    m_StrReq = reader.ReadInt();
                    m_DexReq = reader.ReadInt();
                    m_IntReq = reader.ReadInt();

                    goto case 2;
                }
                case 2:
                {
                    m_Identified = reader.ReadBool();

                    goto case 1;
                }
                case 1:
                {
                    m_MaxRange = reader.ReadInt();

                    goto case 0;
                }
                case 0:
                {
                    if ( version == 0 )
                        m_MaxRange = 1; // default

                    if ( version < 5 )
                    {
                        m_Resource = CraftResource.Iron;
                        m_AosAttributes = new AosAttributes( this );
                        m_AosWeaponAttributes = new AosWeaponAttributes( this );
                        m_AosElementDamages = new AosElementAttributes( this );
                        m_AosSkillBonuses = new AosSkillBonuses( this );
                    }

                    m_MinDamage = reader.ReadInt();
                    m_MaxDamage = reader.ReadInt();

                    m_Speed = reader.ReadInt();

                    m_HitSound = reader.ReadInt();
                    m_MissSound = reader.ReadInt();

                    m_Skill = (SkillName)reader.ReadInt();
                    m_Type = (WeaponType)reader.ReadInt();
                    m_Animation = (WeaponAnimation)reader.ReadInt();
                    m_DamageLevel = (WeaponDamageLevel)reader.ReadInt();
                    m_AccuracyLevel = (WeaponAccuracyLevel)reader.ReadInt();
                    m_DurabilityLevel = (WeaponDurabilityLevel)reader.ReadInt();
                    m_Quality = (WeaponQuality)reader.ReadInt();

                    m_Crafter = reader.ReadMobile();

                    m_Poison = Poison.Deserialize( reader );
                    m_PoisonCharges = reader.ReadInt();

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

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

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

                    if ( m_MinDamage == OldMinDamage )
                        m_MinDamage = -1;

                    if ( m_MaxDamage == OldMaxDamage )
                        m_MaxDamage = -1;

                    if ( m_HitSound == OldHitSound )
                        m_HitSound = -1;

                    if ( m_MissSound == OldMissSound )
                        m_MissSound = -1;

                    if ( m_Speed == OldSpeed )
                        m_Speed = -1;

                    if ( m_MaxRange == OldMaxRange )
                        m_MaxRange = -1;

                    if ( m_Skill == OldSkill )
                        m_Skill = (SkillName)(-1);

                    if ( m_Type == OldType )
                        m_Type = (WeaponType)(-1);

                    if ( m_Animation == OldAnimation )
                        m_Animation = (WeaponAnimation)(-1);

                    if ( UseSkillMod && m_AccuracyLevel != WeaponAccuracyLevel.Regular && Parent is Mobile )
                    {
                        m_SkillMod = new DefaultSkillMod( AccuracySkill, true, (int)m_AccuracyLevel * 5);
                        ((Mobile)Parent).AddSkillMod( m_SkillMod );
                    }

                    break;
                }
            }

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

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

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

                string modName = this.Serial.ToString();

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

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

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

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

            if ( m_Hits <= 0 && m_MaxHits <= 0 )
            {
                m_Hits = m_MaxHits = Utility.RandomMinMax( InitMinHits, InitMaxHits );
            }

            if( version < 15 && this is IBoneArmour )
                this.Attributes.WeaponSpeed -= 4;

            if( version < 16 )
                FixResource();

            if( version < 17 )
            {
                this.m_Speed = -1;
                this.m_MinDamage = -1;
                this.m_MaxDamage = -1;

                if( this.Hue == 2413 )
                    this.Resource = CraftResource.Copper;

                if( this.Hue == 2418 )
                    this.Resource = CraftResource.Bronze;
            }

            if( version < 18 )
                this.DurabilityLevel = WeaponDurabilityLevel.Regular;

            if( version < 19 )
            {
                if( this.HitPoints > 175 )
                    this.HitPoints = 175;

                if( this.MaxHitPoints > 175 )
                    this.MaxHitPoints = 175;
            }

            if( version < 20 )
                FixBonuses();

            if( version < 21 )
            {
                if( this is IBoneArmour )
                    Hue = 0;

                else
                    Hue = CraftResources.GetHue( this.Resource );
            }

            if( version < 22 )
            {
                Speed = -1;
                MinDamage = -1;
                MaxDamage = -1;
            }

            if ( version == 26 )
                BetaNerf = false;
        }
예제 #34
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
                case 1:
                    {
                        m_AosSkillBonuses = new AosSkillBonuses(this, reader);
                        m_Resistances = new AosElementAttributes(this, reader);
                        goto case 0;
                    }
                case 0:
                    {
                        if (version == 0)
                        {
                            m_AosSkillBonuses = new AosSkillBonuses(this);
                            m_Resistances = new AosElementAttributes(this);
                        }

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

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

                        if (GetSaveFlag(flags, SaveFlag.LowerAmmoCost))
                            this.m_LowerAmmoCost = reader.ReadInt();

                        if (GetSaveFlag(flags, SaveFlag.WeightReduction))
                            this.m_WeightReduction = reader.ReadInt();

                        if (GetSaveFlag(flags, SaveFlag.DamageIncrease))
                            this.m_DamageIncrease = reader.ReadInt();

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

                        if (GetSaveFlag(flags, SaveFlag.Quality))
                            this.m_Quality = (ClothingQuality)reader.ReadInt();

                        if (GetSaveFlag(flags, SaveFlag.Capacity))
                            this.m_Capacity = reader.ReadInt();

                        #region Mondain's Legacy Sets
                        if (GetSaveFlag(flags, SaveFlag.SetAttributes))
                            this.m_SetAttributes = new AosAttributes(this, reader);
                        else
                            this.m_SetAttributes = new AosAttributes(this);

                        if (GetSaveFlag(flags, SaveFlag.SetSkillAttributes))
                            this.m_SetSkillBonuses = new AosSkillBonuses(this, reader);
                        else
                            this.m_SetSkillBonuses = new AosSkillBonuses(this);

                        if (GetSaveFlag(flags, SaveFlag.SetHue))
                            this.m_SetHue = reader.ReadInt();

                        if (GetSaveFlag(flags, SaveFlag.LastEquipped))
                            this.m_LastEquipped = reader.ReadBool();

                        if (GetSaveFlag(flags, SaveFlag.SetEquipped))
                            this.m_SetEquipped = reader.ReadBool();
                        #endregion

                        break;
                    }
            }
        }
예제 #35
0
        public BaseWeapon(int itemID)
            : base(itemID)
        {
            Layer = (Layer)ItemData.Quality;

            m_Quality = WeaponQuality.Regular;
            m_StrReq = -1;
            m_DexReq = -1;
            m_IntReq = -1;
            m_MinDamage = -1;
            m_MaxDamage = -1;
            m_HitSound = -1;
            m_MissSound = -1;
            m_Speed = -1;
            m_MaxRange = -1;
            m_Skill = (SkillName)(-1);
            m_Type = (WeaponType)(-1);
            m_Animation = (WeaponAnimation)(-1);

            m_Hits = m_MaxHits = Utility.RandomMinMax(InitMinHits, InitMaxHits);

            m_Resource = CraftResource.Iron;

            m_AosAttributes = new AosAttributes(this);
            m_AosWeaponAttributes = new AosWeaponAttributes(this);
            m_AosSkillBonuses = new AosSkillBonuses(this);
            m_AosElementDamages = new AosElementAttributes(this);
            #region SA
			m_SAAbsorptionAttributes = new SAAbsorptionAttributes( this );
			#endregion

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

		ItemValue = GearScore.GetItemValue( this );
        }
예제 #36
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadInt();

            switch (version)
            {
            case 4:
            {
                _VvVItem   = reader.ReadBool();
                _Owner     = reader.ReadMobile();
                _OwnerName = reader.ReadString();
                goto case 3;
            }

            case 3:
            case 2:
                IsArrowAmmo = reader.ReadBool();
                goto case 1;

            case 1:
            {
                if (version == 1)
                {
                    IsArrowAmmo = (Ammo == null || Ammo is Arrow);
                }
                m_AosSkillBonuses = new AosSkillBonuses(this, reader);
                m_Resistances     = new AosElementAttributes(this, reader);
                goto case 0;
            }

            case 0:
            {
                if (version == 0)
                {
                    m_AosSkillBonuses = new AosSkillBonuses(this);
                    m_Resistances     = new AosElementAttributes(this);
                }

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

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

                if (version < 3 && GetSaveFlag(flags, SaveFlag.LowerAmmoCost))
                {
                    m_Attributes.LowerAmmoCost = reader.ReadInt();
                }

                if (GetSaveFlag(flags, SaveFlag.WeightReduction))
                {
                    m_WeightReduction = reader.ReadInt();
                }

                if (GetSaveFlag(flags, SaveFlag.DamageIncrease))
                {
                    m_DamageIncrease = reader.ReadInt();
                }

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

                if (GetSaveFlag(flags, SaveFlag.Quality))
                {
                    m_Quality = (ItemQuality)reader.ReadInt();
                }

                if (GetSaveFlag(flags, SaveFlag.Capacity))
                {
                    m_Capacity = reader.ReadInt();
                }

                #region Mondain's Legacy Sets
                if (GetSaveFlag(flags, SaveFlag.SetPhysical))
                {
                    m_SetPhysicalBonus = reader.ReadEncodedInt();
                }

                if (GetSaveFlag(flags, SaveFlag.SetFire))
                {
                    m_SetFireBonus = reader.ReadEncodedInt();
                }

                if (GetSaveFlag(flags, SaveFlag.SetCold))
                {
                    m_SetColdBonus = reader.ReadEncodedInt();
                }

                if (GetSaveFlag(flags, SaveFlag.SetPoison))
                {
                    m_SetPoisonBonus = reader.ReadEncodedInt();
                }

                if (GetSaveFlag(flags, SaveFlag.SetEnergy))
                {
                    m_SetEnergyBonus = reader.ReadEncodedInt();
                }

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

                if (GetSaveFlag(flags, SaveFlag.SetSkillAttributes))
                {
                    m_SetSkillBonuses = new AosSkillBonuses(this, reader);
                }
                else
                {
                    m_SetSkillBonuses = new AosSkillBonuses(this);
                }

                if (GetSaveFlag(flags, SaveFlag.SetHue))
                {
                    m_SetHue = reader.ReadInt();
                }

                if (GetSaveFlag(flags, SaveFlag.LastEquipped))
                {
                    m_LastEquipped = reader.ReadBool();
                }

                if (GetSaveFlag(flags, SaveFlag.SetEquipped))
                {
                    m_SetEquipped = reader.ReadBool();
                }

                if (GetSaveFlag(flags, SaveFlag.ElvesOnly))
                {
                    _ElvesOnly = reader.ReadBool();
                }
                #endregion

                break;
            }
            }

            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)
            {
                m_AosSkillBonuses.AddTo((Mobile)Parent);
                ((Mobile)Parent).CheckStatTimers();
            }
        }
예제 #37
0
		public BaseWeapon( int itemID ) : base( itemID )
		{
			Layer = (Layer)ItemData.Quality;

			m_Quality = WeaponQuality.Regular;
			m_StrReq = -1;
			m_DexReq = -1;
			m_IntReq = -1;
			m_MinDamage = -1;
			m_MaxDamage = -1;
			m_HitSound = -1;
			m_MissSound = -1;
			m_Speed = -1;
			m_MaxRange = -1;
			m_Skill = (SkillName)(-1);
			m_Type = (WeaponType)(-1);
			m_Animation = (WeaponAnimation)(-1);

			m_Hits = m_MaxHits = Utility.RandomMinMax( InitMinHits, InitMaxHits );

			m_Resource = CraftResource.Iron;

			m_AosAttributes = new AosAttributes( this );
			m_AosWeaponAttributes = new AosWeaponAttributes( this );
            m_AosSkillBonuses = new AosSkillBonuses(this);

            // mod to randomly add sockets and socketability features to weapons. 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);
			m_AosElementDamages = new AosElementAttributes( this );
		}
예제 #38
0
        public static bool CheckMatch(Item item, int price, SearchCriteria searchCriteria)
        {
            if (item is CommodityDeed && ((CommodityDeed)item).Commodity != null)
            {
                item = ((CommodityDeed)item).Commodity;
            }

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

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

            if (!string.IsNullOrEmpty(searchCriteria.SearchName))
            {
                string name;

                if (item is CommodityDeed && ((CommodityDeed)item).Commodity is ICommodity)
                {
                    ICommodity commodity = (ICommodity)((CommodityDeed)item).Commodity;

                    if (!string.IsNullOrEmpty(commodity.Description.String))
                    {
                        name = commodity.Description.String;
                    }
                    else
                    {
                        name = StringList.GetString(commodity.Description.Number);
                    }
                }
                else
                {
                    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:
                        return(false);

                    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 == "SearingWeapon" && (!(item is BaseWeapon) || !((BaseWeapon)item).SearingWeapon))
                    {
                        return(false);
                    }

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

            return(true);
        }
예제 #39
0
 private static void ApplyAttribute(AosElementAttributes attrs, int min, int max, AosElementAttribute attr, int low, int high)
 {
     attrs[attr] = Scale(min, max, low, high);
 }
예제 #40
0
 private static void ApplyAttribute(AosElementAttributes attrs, int min, int max, AosElementAttribute attr, int low, int high, int scale)
 {
     attrs[attr] = Scale(min, max, low / scale, high / scale) * scale;
 }
예제 #41
0
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();

			switch ( version )
			{
                case 7:
                    {
                        m_SAAbsorptionAttributes = new SAAbsorptionAttributes(this, reader);
                        goto case 6;
                    }
				case 6:
				{
                        if (version == 6)
                            m_SAAbsorptionAttributes = new SAAbsorptionAttributes(this);

					m_MaxHitPoints = reader.ReadEncodedInt();
					m_HitPoints = reader.ReadEncodedInt();

					goto case 5;
				}
				//personal bless deed
				case 5:
				{
					m_BlessedBy = reader.ReadMobile();
					goto case 4;
				}
				#region Mondain's Legacy Sets
				case 4:
				{
					m_LastEquipped = reader.ReadBool();
					m_SetEquipped = reader.ReadBool();
					m_SetHue = reader.ReadEncodedInt();

					m_SetAttributes = new AosAttributes( this, reader );
					m_SetSkillBonuses = new AosSkillBonuses( this, reader );

					goto case 3;
				}
				#endregion
				#region Mondain's Legacy
				case 3:
				{
					m_Crafter = reader.ReadMobile();
					m_Quality = (ArmorQuality) reader.ReadInt();
										
					goto case 2;
				}
				#endregion
				case 2:
				{
					m_Resource = (CraftResource)reader.ReadEncodedInt();
					m_GemType = (GemType)reader.ReadEncodedInt();

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

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

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

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

						string modName = Serial.ToString();

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

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

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

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

					break;
				}
				case 0:
				{
					m_AosAttributes = new AosAttributes( this );
					m_AosResistances = new AosElementAttributes( this );
					m_AosSkillBonuses = new AosSkillBonuses( this );

					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 ( version < 2 )
			{
				m_Resource = CraftResource.Iron;
				m_GemType = GemType.None;
			}
		}
예제 #42
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);

            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;
                }
            }
        }
예제 #43
0
		private static void ApplyAttribute( AosElementAttributes attrs, int min, int max, AosElementAttribute attr, int low, int high, int scale )
		{
			attrs[attr] = Scale( min, max, low / scale, high / scale ) * scale;
		}
예제 #44
0
        public static void ApplyAttributesTo(BaseJewel jewelry, bool isRunicTool, int luckChance, int attributeCount, int min, int max)
        {
            m_IsRunicTool = isRunicTool;
            m_LuckChance  = luckChance;

            AosAttributes        primary = jewelry.Attributes;
            AosElementAttributes resists = jewelry.Resistances;
            AosSkillBonuses      skills  = jewelry.SkillBonuses;

            m_Props.SetAll(false);

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

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

                switch (random)
                {
                case  0: ApplyAttribute(resists, min, max, AosElementAttribute.Physical, 1, 15); break;

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

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

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

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

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

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

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

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

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

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

                case 11: ApplyAttribute(primary, min, max, AosAttribute.EnhancePotions, 5, 25, 5); break;

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

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

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

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

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

                case 17: ApplyAttribute(primary, min, max, AosAttribute.SpellDamage, 1, 12); break;

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

                case 19: ApplySkillBonus(skills, min, max, 0, 1, 15); break;

                case 20: ApplySkillBonus(skills, min, max, 1, 1, 15); break;

                case 21: ApplySkillBonus(skills, min, max, 2, 1, 15); break;

                case 22: ApplySkillBonus(skills, min, max, 3, 1, 15); break;

                case 23: ApplySkillBonus(skills, min, max, 4, 1, 15); break;
                }
            }
        }
예제 #45
0
		public BaseJewel( int itemID, Layer layer ) : base( itemID )
		{
			m_AosAttributes = new AosAttributes( this );
			m_AosResistances = new AosElementAttributes( this );
			m_AosSkillBonuses = new AosSkillBonuses( this );
			m_Resource = CraftResource.Iron;
			m_GemType = GemType.None;

            Layer = layer;
            // mod to randomly add sockets and socketability features to weapons. 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);
		}
예제 #46
0
파일: BaseJewel.cs 프로젝트: pallop/Servuo
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 12:
            case 11:
            {
                m_SetPhysicalBonus = reader.ReadInt();
                m_SetFireBonus     = reader.ReadInt();
                m_SetColdBonus     = reader.ReadInt();
                m_SetPoisonBonus   = reader.ReadInt();
                m_SetEnergyBonus   = reader.ReadInt();
                goto case 10;
            }

            case 10:
            {
                m_PlayerConstructed = reader.ReadBool();
                goto case 9;
            }

            case 9:
            {
                m_TalismanProtection = new TalismanAttribute(reader);
                goto case 8;
            }

            case 8:
            {
                if (version == 11)
                {
                    reader.ReadBool();
                }
                _Owner     = reader.ReadMobile();
                _OwnerName = reader.ReadString();
                goto case 7;
            }

            case 7:
            {
                m_IsImbued = reader.ReadBool();
                goto case 6;
            }

            case 6:
            {
                m_NegativeAttributes = new NegativeAttributes(this, reader);
                goto case 5;
            }

            case 5:
            {
                #region Runic Reforging
                m_ReforgedPrefix = (ReforgedPrefix)reader.ReadInt();
                m_ReforgedSuffix = (ReforgedSuffix)reader.ReadInt();
                m_ItemPower      = (ItemPower)reader.ReadInt();
                if (version == 11 && reader.ReadBool())
                {
                    m_NegativeAttributes.NoRepair = 1;
                }
                #endregion

                #region Stygian Abyss
                m_GorgonLenseCharges = reader.ReadInt();
                m_GorgonLenseType    = (LenseType)reader.ReadInt();
                goto case 4;
            }

            case 4:
            {
                m_TimesImbued = reader.ReadEncodedInt();

                m_SAAbsorptionAttributes = new SAAbsorptionAttributes(this, reader);
                #endregion

                m_BlessedBy    = reader.ReadMobile();
                m_LastEquipped = reader.ReadBool();
                m_SetEquipped  = reader.ReadBool();
                m_SetHue       = reader.ReadEncodedInt();

                m_SetAttributes   = new AosAttributes(this, reader);
                m_SetSkillBonuses = new AosSkillBonuses(this, reader);

                m_Crafter = reader.ReadMobile();
                m_Quality = (ItemQuality)reader.ReadInt();
                goto case 3;
            }

            case 3:
            {
                m_MaxHitPoints = reader.ReadEncodedInt();
                m_HitPoints    = reader.ReadEncodedInt();

                goto case 2;
            }

            case 2:
            {
                m_Resource = (CraftResource)reader.ReadEncodedInt();
                m_GemType  = (GemType)reader.ReadEncodedInt();

                goto case 1;
            }

            case 1:
            {
                m_AosAttributes   = new AosAttributes(this, reader);
                m_AosResistances  = new AosElementAttributes(this, reader);
                m_AosSkillBonuses = new AosSkillBonuses(this, reader);

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

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

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

                    string modName = Serial.ToString();

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

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

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

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

                break;
            }

            case 0:
            {
                m_AosAttributes   = new AosAttributes(this);
                m_AosResistances  = new AosElementAttributes(this);
                m_AosSkillBonuses = new AosSkillBonuses(this);

                break;
            }
            }

            if (m_NegativeAttributes == null)
            {
                m_NegativeAttributes = new NegativeAttributes(this);
            }

            if (m_TalismanProtection == null)
            {
                m_TalismanProtection = new TalismanAttribute();
            }

            #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 (version < 2)
            {
                m_Resource = CraftResource.Iron;
                m_GemType  = GemType.None;
            }
        }
예제 #47
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
                case 7:
                    {
                        this.m_IsImbued = reader.ReadBool();
                        goto case 6;
                    }
                case 6:
                    {
                        m_NegativeAttributes = new NegativeAttributes(this, reader);
                        goto case 5;
                    }
                case 5:
                    {
                        #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();
                        goto case 4;
                    }
                case 4:
                    {
                        this.m_TimesImbued = reader.ReadEncodedInt();
                       
                        this.m_SAAbsorptionAttributes = new SAAbsorptionAttributes(this, reader);
                        #endregion

                        this.m_BlessedBy = reader.ReadMobile();
                        this.m_LastEquipped = reader.ReadBool();
                        this.m_SetEquipped = reader.ReadBool();
                        this.m_SetHue = reader.ReadEncodedInt();

                        this.m_SetAttributes = new AosAttributes(this, reader);
                        this.m_SetSkillBonuses = new AosSkillBonuses(this, reader);

                        this.m_Crafter = reader.ReadMobile();
                        this.m_Quality = (ArmorQuality)reader.ReadInt();
                        goto case 3;
                    }
                case 3:
                    {
                        this.m_MaxHitPoints = reader.ReadEncodedInt();
                        this.m_HitPoints = reader.ReadEncodedInt();

                        goto case 2;
                    }
                case 2:
                    {
                        this.m_Resource = (CraftResource)reader.ReadEncodedInt();
                        this.m_GemType = (GemType)reader.ReadEncodedInt();

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

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

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

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

                            string modName = this.Serial.ToString();

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

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

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

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

                        break;
                    }
                case 0:
                    {
                        this.m_AosAttributes = new AosAttributes(this);
                        this.m_AosResistances = new AosElementAttributes(this);
                        this.m_AosSkillBonuses = new AosSkillBonuses(this);

                        break;
                    }
            }

            if (m_NegativeAttributes == null)
                m_NegativeAttributes = new NegativeAttributes(this);

            #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_Resource = CraftResource.Iron;
                this.m_GemType = GemType.None;
            }
        }
예제 #48
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.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();
            }
        }
예제 #49
0
		public BaseWeapon( int itemID ) : base( itemID )
		{
			Layer = (Layer)ItemData.Quality;

			m_Quality = WeaponQuality.Regular;
			m_StrReq = -1;
			m_DexReq = -1;
			m_IntReq = -1;
			m_MinDamage = -1;
			m_MaxDamage = -1;
			m_HitSound = -1;
			m_MissSound = -1;
			m_Speed = -1;
			m_MaxRange = -1;
			m_Skill = (SkillName)(-1);
			m_Type = (WeaponType)(-1);
			m_Animation = (WeaponAnimation)(-1);

			m_Hits = m_MaxHits = Utility.RandomMinMax( InitMinHits, InitMaxHits );

			m_Resource = CraftResource.Iron;

			m_AosAttributes = new AosAttributes( this );
			m_AosWeaponAttributes = new AosWeaponAttributes( this );
			m_AosSkillBonuses = new AosSkillBonuses( this );
			m_AosElementDamages = new AosElementAttributes( this );
		}
예제 #50
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 4:
            {
                _VvVItem   = reader.ReadBool();
                _Owner     = reader.ReadMobile();
                _OwnerName = reader.ReadString();
                goto case 3;
            }

            case 3:
            case 2:
                IsArrowAmmo = reader.ReadBool();
                goto case 1;

            case 1:
            {
                if (version == 1)
                {
                    IsArrowAmmo = (Ammo == null || Ammo is Arrow);
                }
                m_AosSkillBonuses = new AosSkillBonuses(this, reader);
                m_Resistances     = new AosElementAttributes(this, reader);
                goto case 0;
            }

            case 0:
            {
                if (version == 0)
                {
                    m_AosSkillBonuses = new AosSkillBonuses(this);
                    m_Resistances     = new AosElementAttributes(this);
                }

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

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

                if (version < 3 && GetSaveFlag(flags, SaveFlag.LowerAmmoCost))
                {
                    m_Attributes.LowerAmmoCost = reader.ReadInt();
                }

                if (GetSaveFlag(flags, SaveFlag.WeightReduction))
                {
                    m_WeightReduction = reader.ReadInt();
                }

                if (GetSaveFlag(flags, SaveFlag.DamageIncrease))
                {
                    m_DamageIncrease = reader.ReadInt();
                }

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

                if (GetSaveFlag(flags, SaveFlag.Quality))
                {
                    m_Quality = (ItemQuality)reader.ReadInt();
                }

                if (GetSaveFlag(flags, SaveFlag.Capacity))
                {
                    m_Capacity = reader.ReadInt();
                }

                #region Mondain's Legacy Sets
                if (GetSaveFlag(flags, SaveFlag.SetPhysical))
                {
                    m_SetPhysicalBonus = reader.ReadEncodedInt();
                }

                if (GetSaveFlag(flags, SaveFlag.SetFire))
                {
                    m_SetFireBonus = reader.ReadEncodedInt();
                }

                if (GetSaveFlag(flags, SaveFlag.SetCold))
                {
                    m_SetColdBonus = reader.ReadEncodedInt();
                }

                if (GetSaveFlag(flags, SaveFlag.SetPoison))
                {
                    m_SetPoisonBonus = reader.ReadEncodedInt();
                }

                if (GetSaveFlag(flags, SaveFlag.SetEnergy))
                {
                    m_SetEnergyBonus = reader.ReadEncodedInt();
                }

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

                if (GetSaveFlag(flags, SaveFlag.SetSkillAttributes))
                {
                    m_SetSkillBonuses = new AosSkillBonuses(this, reader);
                }
                else
                {
                    m_SetSkillBonuses = new AosSkillBonuses(this);
                }

                if (GetSaveFlag(flags, SaveFlag.SetHue))
                {
                    m_SetHue = reader.ReadInt();
                }

                if (GetSaveFlag(flags, SaveFlag.LastEquipped))
                {
                    m_LastEquipped = reader.ReadBool();
                }

                if (GetSaveFlag(flags, SaveFlag.SetEquipped))
                {
                    m_SetEquipped = reader.ReadBool();
                }
                #endregion

                break;
            }
            }
        }
예제 #51
0
		public BaseWeapon(int itemID)
			: base(itemID)
		{
			Layer = (Layer)ItemData.Quality;

			m_Quality = WeaponQuality.Regular;
			m_StrReq = -1;
			m_DexReq = -1;
			m_IntReq = -1;
			m_MinDamage = -1;
			m_MaxDamage = -1;
			m_HitSound = -1;
			m_MissSound = -1;
			m_Speed = -1;
			m_MaxRange = -1;
			m_Skill = (SkillName)(-1);
			m_Type = (WeaponType)(-1);
			m_Animation = (WeaponAnimation)(-1);

			m_Hits = m_MaxHits = Utility.RandomMinMax(InitMinHits, InitMaxHits);

			m_Resource = CraftResource.Iron;

			m_AosAttributes = new AosAttributes(this);
			m_AosWeaponAttributes = new AosWeaponAttributes(this);
			m_AosSkillBonuses = new AosSkillBonuses(this);
			m_AosElementDamages = new AosElementAttributes(this);

			#region Stygian Abyss
			m_SAAbsorptionAttributes = new SAAbsorptionAttributes(this);
			#endregion

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

			m_AosSkillBonuses = new AosSkillBonuses(this);
			// Xml Spawner XmlSockets - SOF
			// 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)
			if(XmlSpawner.SocketsEnabled)
				XmlSockets.ConfigureRandom(this, 2.0, 0.1, 0.5, 3.0, 15.0, 50.0);
		}
예제 #52
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();
            }
        }