Inheritance: BaseAttributes
Example #1
0
        public BaseClothing( int itemID, Layer layer, int hue )
            : base(itemID)
        {
            Layer = layer;
            Hue = hue;
            m_Quality = ClothingQuality.Regular;

            m_AosAttributes = new AosAttributes( this );
            m_AosClothingAttributes = new AosArmorAttributes( this );
            m_AosSkillBonuses = new AosSkillBonuses( this );
            m_AosResistances = new AosElementAttributes( this );
        }
Example #2
0
        public BaseClothing( int itemID, Layer layer, int hue )
            : base(itemID)
        {
            Layer = layer;
            Hue = hue;

            m_Resource = DefaultResource;
            m_Quality = ClothingQuality.Regular;

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

            m_AosAttributes = new AosAttributes( this );
            m_AosClothingAttributes = new AosArmorAttributes( this );
            m_AosSkillBonuses = new AosSkillBonuses( this );
            m_AosResistances = new AosElementAttributes( this );
        }
Example #3
0
        public BaseClothing( int itemID, Layer layer, int hue, ClothEffect effect, int charges )
            : base(itemID)
        {
            Layer = layer;
            Hue = hue;

            m_Resource = DefaultResource;
            m_Quality = ClothingQuality.Regular;
            m_ClothEffect = effect;
            m_Charges = charges;
            m_Identified = false;
            m_IDList = new List<Mobile>();

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

            m_AosAttributes = new AosAttributes( this );
            m_AosClothingAttributes = new AosArmorAttributes( this );
            m_AosSkillBonuses = new AosSkillBonuses( this );
            m_AosResistances = new AosElementAttributes( this );
        }
Example #4
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);
        }
Example #5
0
		public BaseClothing( int itemID, Layer layer, int hue ) : base( itemID )
		{
			Layer = layer;
			Hue = hue;

			m_Resource = DefaultResource;
			m_Quality = ClothingQuality.Regular;

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

			m_AosAttributes = new AosAttributes( this );
			m_AosClothingAttributes = new AosArmorAttributes( this );
			m_AosSkillBonuses = new AosSkillBonuses( this );
			m_AosResistances = new AosElementAttributes( this );
			
			// Genova: suporte ao UO:ML.
			#region Mondain's Legacy
			m_SetAttributes = new AosAttributes( this );
			m_SetClothingAttributes = new AosArmorAttributes( this );
			m_SetSkillBonuses = new AosSkillBonuses( this );
			
			m_LastEquipped = false;
			#endregion
		}
Example #6
0
		public Spellbook( ulong content, int itemID ) : base( itemID )
		{
			m_AosAttributes = new AosAttributes( this );
			m_AosSkillBonuses = new AosSkillBonuses( this );

			Weight = 3.0;
			Layer = Layer.OneHanded;
			LootType = LootType.Blessed;

			Content = content;
		}
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();

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

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

					if ( GetSaveFlag( flags, SaveFlag.SkillBonuses ) )
						m_AosSkillBonuses = new AosSkillBonuses( this, reader );
						
					if ( GetSaveFlag( flags, SaveFlag.Owner ) )
						m_Owner = reader.ReadMobile();
					
					
					m_Protection = new TalismanAttribute();	
						
					if ( GetSaveFlag( flags, SaveFlag.Protection ) )					
						m_Protection.Deserialize( reader );
					else
						m_Protection = null;
						
					m_Killer = new TalismanAttribute();	
						
					if ( GetSaveFlag( flags, SaveFlag.Killer ) )
						m_Killer.Deserialize( reader );
					else
						m_Killer = null;
						
					m_Summoner = new TalismanAttribute();		
						
					if ( GetSaveFlag( flags, SaveFlag.Summoner ) )
						m_Summoner.Deserialize( reader );
					else
						m_Summoner = null;
						
					if ( GetSaveFlag( flags, SaveFlag.Removal ) )
						m_Removal = (TalismanRemoval) reader.ReadEncodedInt();
						
					if ( GetSaveFlag( flags, SaveFlag.KarmaLoss ) )
						m_KarmaLoss = reader.ReadEncodedInt();
						
					if ( GetSaveFlag( flags, SaveFlag.Skill ) )
						m_Skill = (SkillName) reader.ReadEncodedInt();
						
					if ( GetSaveFlag( flags, SaveFlag.SuccessBonus ) )
						m_SuccessBonus = reader.ReadEncodedInt();
						
					if ( GetSaveFlag( flags, SaveFlag.ExceptionalBonus ) )
						m_ExceptionalBonus = reader.ReadEncodedInt();
						
					if ( GetSaveFlag( flags, SaveFlag.MaxCharges ) )
						m_MaxCharges = reader.ReadEncodedInt();
						
					if ( GetSaveFlag( flags, SaveFlag.Charges ) )
						m_Charges = reader.ReadEncodedInt();
						
					if ( GetSaveFlag( flags, SaveFlag.MaxChargeTime ) )
						m_MaxChargeTime = reader.ReadEncodedInt();
						
					if ( GetSaveFlag( flags, SaveFlag.ChargeTime ) )
						m_ChargeTime = reader.ReadEncodedInt();
						
					if ( GetSaveFlag( flags, SaveFlag.Slayer ) )
						m_Slayer = (TalismanSlayerName) reader.ReadEncodedInt();
						
					m_Blessed = GetSaveFlag( flags, SaveFlag.Blessed );
					
					break;
				}
			}
			
			if ( Parent is Mobile && ChargeTime > 0 )
				StartTimer();
				
			if ( m_AosSkillBonuses == null )
				m_AosSkillBonuses = new AosSkillBonuses( this );
				
			if ( Core.AOS && Parent is Mobile )
				m_AosSkillBonuses.AddTo( (Mobile)Parent );
				
			int strBonus = m_AosAttributes.BonusStr;
			int dexBonus = m_AosAttributes.BonusDex;
			int intBonus = m_AosAttributes.BonusInt;

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

				string modName = Serial.ToString();

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

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

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

			if ( Parent is Mobile )
				((Mobile)Parent).CheckStatTimers();
		}
Example #8
0
		public BaseTalisman( int itemID ) : base( itemID )
		{
			Layer = Layer.Talisman;
			Weight = 1.0;

			m_Protection = new TalismanAttribute();
			m_Killer = new TalismanAttribute();
			m_Summoner = new TalismanAttribute();
			m_AosAttributes = new AosAttributes( this );
			m_AosSkillBonuses = new AosSkillBonuses( this );
		}
Example #9
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch ( version )
            {
			case 7:
				{
				  #region SF Imbuing
                        Physical_Modded = reader.ReadBool();
                        Fire_Modded = reader.ReadBool();
                        Cold_Modded = reader.ReadBool();
                        Poison_Modded = reader.ReadBool();
                        Energy_Modded = reader.ReadBool();
				  #endregion

                        goto case 6;
                    }
                

                case 6:
                    {
                        this.m_TimesImbued = reader.ReadInt();
                        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.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();
            }
        }
Example #10
0
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            int version = reader.ReadInt();

            switch ( version )
            {
                case 12: m_OldCloth = reader.ReadBool(); goto case 11;
                case 11: m_Disease = (Disease)reader.ReadInt(); goto case 10;
                case 10: goto case 9;
                case 9:	goto case 8;
                case 8:	goto case 7;
                case 7:	goto case 6;
                case 6:
                {
                    m_CraftersOriginalName = reader.ReadString();
                    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();
            }

            if( version < 7 && this.Hue == 2992 )
                this.Hue = 2990;

            if( version < 8 && Quality == ClothingQuality.Masterwork )
            {
                this.Resistances.Blunt += 1;
                this.Resistances.Slashing += 1;
                this.Resistances.Piercing += 1;
            }

            if( version < 9 && this.Crafter != null )
            {
                this.CraftersOriginalName = this.Crafter.Name;
            }

            if( version < 10 )
            {
                Resistances.Fire = 0;
                Resistances.Cold = 0;
            }
        }
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            int version = reader.ReadInt();

            int m_PhysicalBonus = 0;
            int m_FireBonus = 0;
            int m_ColdBonus = 0;
            int m_PoisonBonus = 0;
            int m_EnergyBonus = 0;

            switch ( version )
            {
                case 14:
                case 13:
                {
                    m_CustomPropName = reader.ReadString();
                     goto case 12;
                }
                case 12:
                {
                    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;

                    if ( GetSaveFlag( flags, SaveFlag.Identified ) )
                        m_Identified = true;

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

                    goto case 10;
                }
                case 10:
                case 9:
                    m_CustomPropName = reader.ReadString();
                    goto case 8;
                case 8: // Fixed durability
                case 7:
                case 6:
                {
                    int m_ArmorBase = reader.ReadInt();
                    goto case 5;
                }
                case 5:
                {
                    int m_OldMaxHitPoints = reader.ReadInt();
                    int m_OldHitPoints = reader.ReadInt();
                    goto case 4;
                }
                case 4:
                {
                    m_PhysicalBonus = reader.ReadInt();
                    m_FireBonus = reader.ReadInt();
                    m_ColdBonus = reader.ReadInt();
                    m_PoisonBonus = reader.ReadInt();
                    m_EnergyBonus = 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();
            }

            // ***
            if (version < 12)
            {
                 m_AosResistances.Physical = m_PhysicalBonus;
                 m_AosResistances.Fire = m_FireBonus;
                 m_AosResistances.Cold = m_ColdBonus;
                 m_AosResistances.Poison = m_PoisonBonus;
                 m_AosResistances.Energy = m_EnergyBonus;
            }
            // ***

            if ( version < 14 )
                Dyable = true;
        }
Example #12
0
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();

			switch ( version )
			{
				case 9:
				{
					// erl - added to handle packing out of PlayerConstructed property
					goto case 8;
				}
				case 8:
				{
					// removed all AOS attributes
					goto case 7;
				}
				case 7:
				case 6:
				case 5:
				{
					SaveFlag flags = (SaveFlag)reader.ReadEncodedInt();

					if ( GetSaveFlag( flags, SaveFlag.IOBAlignment ) )
						m_IOBAlignment = (IOBAlignment)reader.ReadEncodedInt();


					// obsolete AOS attributes from version 8 on
					if (version < 8)
					{
						AosAttributes dmy_AosAttributes;
						AosArmorAttributes dmy_AosArmorAttributes;

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

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

						// read and throw away
						int foox;
						if ( GetSaveFlag( flags, SaveFlag.PhysicalBonus ) )
							foox = reader.ReadEncodedInt(); // m_PhysicalBonus

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

					// obsolete AOS attributes from version 8 on
					if (version < 8)
					{
						AosSkillBonuses dmy_AosSkillBonuses;
						if ( GetSaveFlag( flags, SaveFlag.SkillBonuses ) )
							dmy_AosSkillBonuses = new AosSkillBonuses( this, reader );
					}

					// obsolete PlayerConstructed property from version 9 on
					if (version < 9)
					{
						if ( GetSaveFlag( flags, SaveFlag.PlayerConstructed ) )
							PlayerCrafted = true;
					}

					break;
				}
				case 4:
				{
					// obsolete
					AosAttributes dmy_AosAttributes;
					AosArmorAttributes dmy_AosArmorAttributes;
					dmy_AosAttributes = new AosAttributes( this, reader );
					dmy_AosArmorAttributes = new AosArmorAttributes( this, reader );
					goto case 3;
				}
				case 3:
				{
					int dummy;
					dummy = reader.ReadInt();
					dummy = reader.ReadInt();
					dummy = reader.ReadInt();
					dummy = reader.ReadInt();
					dummy = reader.ReadInt();
					goto case 2;
				}
				case 2:
				case 1:
				{
					m_Identified = reader.ReadBool();
					goto case 0;
				}
				case 0:
				{
					m_ArmorBase = reader.ReadInt();
					m_MaxHitPoints = reader.ReadInt();
					m_HitPoints = reader.ReadInt();
					m_Crafter = reader.ReadMobile();
					m_Quality = (ArmorQuality)reader.ReadInt();
					m_Durability = (ArmorDurabilityLevel)reader.ReadInt();
					m_Protection = (ArmorProtectionLevel)reader.ReadInt();

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

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

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

					if ( version < 4 )
					{
						// Adam: (Leave for Adam to remove)
						//m_AosAttributes = new AosAttributes( this );
						//m_AosArmorAttributes = new AosArmorAttributes( this );
					}

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

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

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

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

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

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

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

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

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

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

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

					m_Meditate = (AMA)reader.ReadInt();

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

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

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

					break;
				}
			}

			//if ( m_AosSkillBonuses == null )
				//m_AosSkillBonuses = new AosSkillBonuses( this );
/*
			if ( Core.AOS && Parent is Mobile )
				m_AosSkillBonuses.AddTo( (Mobile)Parent );
*/
			if (Parent is Mobile)
			{
				((Mobile)Parent).StatChange += new StatChangeHandler(ApplyStatBonuses);
				ApplyStatBonuses(Parent as Mobile, StatType.All);
			}

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


// erl: PlayerConstructed is now obsolete, replaced with PlayerCrafted at item level
// ..
//			if ( version < 7 )
//				m_PlayerConstructed = true; // we don't know, so, assume it's crafted
// ..

		}
Example #13
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_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;
            }
        }
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();

			switch ( version )
			{
#region ItemID_Mods
							                case 6:
							                {
										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;
                    
                    								if ( GetSaveFlag( flags, SaveFlag.Identified ) ) 
								                        m_Identified = true;
										break;
                							}
								#endregion
				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();
			}
		}
Example #15
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);

            #region Mondain's Legacy Sets
            this.m_SetAttributes = new AosAttributes(this);
            this.m_SetSkillBonuses = new AosSkillBonuses(this);
            #endregion
        }
Example #16
0
File: AOS.cs Project: jaedan/runuo
 public AosSkillBonuses(Item owner, AosSkillBonuses other)
     : base(owner, other)
 {
 }
Example #17
0
		public BaseClothing( int itemID, Layer layer, int hue ) : base( itemID )
		{
			Layer = layer;
			Hue = hue;

			m_Resource = DefaultResource;
			m_Quality = ClothingQuality.Regular;

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

			m_AosAttributes = new AosAttributes( this );
			m_AosClothingAttributes = new AosArmorAttributes( this );
			m_AosSkillBonuses = new AosSkillBonuses( this );
			m_AosResistances = new AosElementAttributes( this );

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

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

			int version = reader.ReadInt();

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

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

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

					if ( GetSaveFlag( flags, SaveFlag.Protection ) )
						m_Protection = new TalismanAttribute( reader );
					else
						m_Protection = new TalismanAttribute();

					if ( GetSaveFlag( flags, SaveFlag.Killer ) )
						m_Killer = new TalismanAttribute( reader );
					else
						m_Killer = new TalismanAttribute();

					if ( GetSaveFlag( flags, SaveFlag.Summoner ) )
						m_Summoner = new TalismanAttribute( reader );
					else
						m_Summoner = new TalismanAttribute();

					if ( GetSaveFlag( flags, SaveFlag.Removal ) )
						m_Removal = (TalismanRemoval) reader.ReadEncodedInt();

					if ( GetSaveFlag( flags, SaveFlag.KarmaLoss ) )
						m_KarmaLoss = reader.ReadEncodedInt();

					if ( GetSaveFlag( flags, SaveFlag.Skill ) )
						m_Skill = (SkillName) reader.ReadEncodedInt();

					if ( GetSaveFlag( flags, SaveFlag.SuccessBonus ) )
						m_SuccessBonus = reader.ReadEncodedInt();

					if ( GetSaveFlag( flags, SaveFlag.ExceptionalBonus ) )
						m_ExceptionalBonus = reader.ReadEncodedInt();

					if ( GetSaveFlag( flags, SaveFlag.MaxCharges ) )
						m_MaxCharges = reader.ReadEncodedInt();

					if ( GetSaveFlag( flags, SaveFlag.Charges ) )
						m_Charges = reader.ReadEncodedInt();

					if ( GetSaveFlag( flags, SaveFlag.MaxChargeTime ) )
						m_MaxChargeTime = reader.ReadEncodedInt();

					if ( GetSaveFlag( flags, SaveFlag.ChargeTime ) )
						m_ChargeTime = reader.ReadEncodedInt();

					if ( GetSaveFlag( flags, SaveFlag.Slayer ) )
						m_Slayer = (TalismanSlayerName) reader.ReadEncodedInt();

					m_Blessed = GetSaveFlag( flags, SaveFlag.Blessed );

					break;
				}
			}

			if ( Parent is Mobile )
			{
				Mobile m = (Mobile) Parent;

				m_AosAttributes.AddStatBonuses( m );
				m_AosSkillBonuses.AddTo( m );

				if ( m_ChargeTime > 0 )
					StartTimer();
			}
		}
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            int version = reader.ReadInt();

            switch ( version )
            {
                case 3:
                {
                    m_AosAttributes = new AosAttributes( this, reader );
                    if (m_AosAttributes.IsEmpty)
                        m_AosAttributes = null;

                    m_AosClothingAttributes = new AosArmorAttributes( this, reader );
                    if (m_AosClothingAttributes.IsEmpty)
                        m_AosClothingAttributes = null;

                    m_AosSkillBonuses = new AosSkillBonuses( this, reader );
                    if (m_AosSkillBonuses.IsEmpty)
                        m_AosSkillBonuses = null;

                    m_AosResistances = new AosElementAttributes( this, reader );
                    if (m_AosResistances.IsEmpty)
                        m_AosResistances = null;

                    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

            Mobile parent = Parent as Mobile;

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

                AddStatBonuses( parent );
                parent.CheckStatTimers();
            }
        }
		public BaseTalisman( int itemID ) : base( itemID )
		{
			Layer = Layer.Talisman;
			Weight = 1;
			
			m_AosAttributes = new AosAttributes( this );
			m_AosSkillBonuses = new AosSkillBonuses( this );
		}
Example #21
0
        private static int GetSkillBonuses(AosSkillBonuses bonus, object prop)
        {
            int mod = 0;

            for (int j = 0; j < 5; j++)
            {
                if (bonus.GetBonus(j) > 0)
                {
                    if (!(prop is SkillName) || !IsInSkillGroup((SkillName)prop, j))
                        mod += 1;
                }
            }

            return mod;
        }
Example #22
0
		public AosSkillBonuses( Item owner, AosSkillBonuses other )
			: base( owner, other )
		{
		}
Example #23
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;
			}
		}
Example #24
0
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();

			switch ( version )
			{
				case 5:
				{
					#region Mondain's Legacy
					m_Quality = (BookQuality) reader.ReadByte();		
					#endregion					
					
					goto case 4;
				}
				case 4:
				{
					#region Mondain's Legacy
					m_EngravedText = reader.ReadString();		
					#endregion
					
					goto case 3;
				}
				case 3:
				{
					m_Crafter = reader.ReadMobile();
					goto case 2;
				}
				case 2:
				{
					m_Slayer = (SlayerName)reader.ReadInt();
					m_Slayer2 = (SlayerName)reader.ReadInt();
					goto case 1;
				}
				case 1:
				{
					m_AosAttributes = new AosAttributes( this, reader );
					m_AosSkillBonuses = new AosSkillBonuses( this, reader );

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

					break;
				}
			}

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

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

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

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

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

				string modName = Serial.ToString();

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

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

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

			if ( Parent is Mobile )
				((Mobile)Parent).CheckStatTimers();
		}
Example #25
0
		public static bool SupportsSkillBonus(this Item item, out AosSkillBonuses attrs)
		{
			BaseAttributes a;

			if (SupportsAttributes(item, "SkillBonuses", out a))
			{
				attrs = (AosSkillBonuses)a;
				return true;
			}

			attrs = null;
			return false;
		}
Example #26
0
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();

			switch ( version )
			{
				case 6:
				{
					// Genova: suporte ao UO:ML.
					#region Mondain's Legacy
					SetFlag sflags = (SetFlag) reader.ReadEncodedInt();
					
					if ( GetSaveFlag( sflags, SetFlag.Attributes ) )
						m_SetAttributes = new AosAttributes( this, reader );
					else
						m_SetAttributes = new AosAttributes( this );

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

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

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

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

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

					if ( GetSaveFlag( sflags, SetFlag.EnergyBonus ) )
						m_SetEnergyBonus = reader.ReadEncodedInt();
						
					if ( GetSaveFlag( sflags, SetFlag.SetHue ) )
						m_SetHue = reader.ReadEncodedInt();
						
					if ( GetSaveFlag( sflags, SetFlag.LastEquipped ) )
						m_LastEquipped = reader.ReadBool();
											
					if ( GetSaveFlag( sflags, SetFlag.SetEquipped ) )
						m_SetEquipped = reader.ReadBool();
					#endregion
					
					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;
				}
			}
			
			// Genova: suporte ao UO:ML.
			#region Mondain's Legacy
			if ( m_SetAttributes == null )
				m_SetAttributes = new AosAttributes( this );
	
			if ( m_SetClothingAttributes == null )
				m_SetClothingAttributes = new AosArmorAttributes( this );
				
			if ( m_SetSkillBonuses == null )
				m_SetSkillBonuses = new AosSkillBonuses( this );
			#endregion

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

			//Remove (layered) tags in name
			if ((Layer == Layer.Earrings || Layer == Layer.Neck) && Name != null && ms_RegexLayeredTag.IsMatch(Name))
			{
				Match m = ms_RegexLayeredTag.Match(Name);
				Name = m.Groups["taglessname"].Value.Trim();
			}

//			if ( IsBugged( this ) )
//				World.buggeditems.Add( this );
		}