AddTo() public method

public AddTo ( Server.Mobile m ) : void
m Server.Mobile
return void
Ejemplo n.º 1
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;
			}
		}
Ejemplo n.º 2
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;
            }
        }