Exemplo n.º 1
0
 public void SetMagic(JewelMagicEffect Effect, int Charges)
 {
     // Only allow Teleport to be set on Rings
     if (Effect == JewelMagicEffect.Teleport)
     {
         if (this is BaseRing)
         {
             m_MagicType    = Effect;
             m_MagicCharges = Charges;
             Identified     = false;
         }
     }
     else
     {
         m_MagicType    = Effect;
         m_MagicCharges = Charges;
         Identified     = false;
     }
 }
Exemplo n.º 2
0
        public override void OnSingleClick(Mobile from)
        {
            // If it's not identified, leave... name is handled in EnchantedScroll

            if (!m_Identified)
            {
                return;
            }

            ArrayList attrs = new ArrayList();

            if (ItemType.IsSubclassOf(typeof(BaseWeapon)))
            {
                // Send damage, durability, accuracy and slayer info

                if (iProps[3] != (int)SlayerName.None)
                {
                    attrs.Add(new EquipInfoAttribute(1017383 + iProps[3]));
                }

                if (iProps[1] != (int)WeaponDurabilityLevel.Regular)
                {
                    attrs.Add(new EquipInfoAttribute(1038000 + iProps[1]));
                }

                if (iProps[0] != (int)WeaponDamageLevel.Regular)
                {
                    attrs.Add(new EquipInfoAttribute(1038015 + iProps[0]));
                }

                if (iProps[2] != (int)WeaponAccuracyLevel.Regular)
                {
                    attrs.Add(new EquipInfoAttribute(1038010 + iProps[2]));
                }
            }
            else if (ItemType.IsSubclassOf(typeof(BaseArmor)))
            {
                // Send protection and durability info

                if (iProps[1] != (int)ArmorDurabilityLevel.Regular)
                {
                    attrs.Add(new EquipInfoAttribute(1038000 + iProps[1]));
                }

                if (iProps[0] > (int)ArmorProtectionLevel.Regular)
                {
                    attrs.Add(new EquipInfoAttribute(1038005 + iProps[0]));
                }
            }
            else if (ItemType.IsSubclassOf(typeof(BaseClothing)))
            {
                // Send charges and charge type info

                MagicEffect MagicType = (MagicEffect)iProps[0];

                switch (MagicType)
                {
                case MagicEffect.MagicReflect:
                    attrs.Add(new EquipInfoAttribute(1044416, iProps[1]));                             // magic reflection
                    break;

                case MagicEffect.Invisibility:
                    attrs.Add(new EquipInfoAttribute(1044424, iProps[1]));                             // invisibility
                    break;

                case MagicEffect.Bless:
                    attrs.Add(new EquipInfoAttribute(1044397, iProps[1]));                             // bless
                    break;

                case MagicEffect.Agility:
                    attrs.Add(new EquipInfoAttribute(1044389, iProps[1]));                             // agility
                    break;

                case MagicEffect.Cunning:
                    attrs.Add(new EquipInfoAttribute(1044390, iProps[1]));                             // cunning
                    break;

                case MagicEffect.Strength:
                    attrs.Add(new EquipInfoAttribute(1044396, iProps[1]));                             // strength
                    break;

                case MagicEffect.NightSight:
                    attrs.Add(new EquipInfoAttribute(1044387, iProps[1]));                             // night sight
                    break;

                case MagicEffect.Curse:
                    attrs.Add(new EquipInfoAttribute(1044407, iProps[1]));                             // curse
                    break;

                case MagicEffect.Clumsy:
                    attrs.Add(new EquipInfoAttribute(1044382, iProps[1]));                             // clumsy
                    break;

                case MagicEffect.Feeblemind:
                    attrs.Add(new EquipInfoAttribute(1044384, iProps[1]));                             // feeblemind
                    break;

                case MagicEffect.Weakness:
                    attrs.Add(new EquipInfoAttribute(1044388, iProps[1]));                             // weaken
                    break;
                }
            }
            else if (ItemType.IsSubclassOf(typeof(BaseJewel)))
            {
                // Send charges and charge type info

                JewelMagicEffect MagicType = (JewelMagicEffect)iProps[0];

                switch (MagicType)
                {
                case JewelMagicEffect.MagicReflect:
                    attrs.Add(new EquipInfoAttribute(1044416, iProps[1]));                             // magic reflection
                    break;

                case JewelMagicEffect.Invisibility:
                    attrs.Add(new EquipInfoAttribute(1044424, iProps[1]));                             // invisibility
                    break;

                case JewelMagicEffect.Bless:
                    attrs.Add(new EquipInfoAttribute(1044397, iProps[1]));                             // bless
                    break;

                case JewelMagicEffect.Teleport:
                    attrs.Add(new EquipInfoAttribute(1044402, iProps[1]));                             // teleport
                    break;

                case JewelMagicEffect.Agility:
                    attrs.Add(new EquipInfoAttribute(1044389, iProps[1]));                             // agility
                    break;

                case JewelMagicEffect.Cunning:
                    attrs.Add(new EquipInfoAttribute(1044390, iProps[1]));                             // cunning
                    break;

                case JewelMagicEffect.Strength:
                    attrs.Add(new EquipInfoAttribute(1044396, iProps[1]));                             // strength
                    break;

                case JewelMagicEffect.NightSight:
                    attrs.Add(new EquipInfoAttribute(1044387, iProps[1]));                             // night sight
                    break;

                case JewelMagicEffect.Curse:
                    attrs.Add(new EquipInfoAttribute(1044407, iProps[1]));                             // curse
                    break;

                case JewelMagicEffect.Clumsy:
                    attrs.Add(new EquipInfoAttribute(1044382, iProps[1]));                             // clumsy
                    break;

                case JewelMagicEffect.Feeblemind:
                    attrs.Add(new EquipInfoAttribute(1044384, iProps[1]));                             // feeblemind
                    break;

                case JewelMagicEffect.Weakness:
                    attrs.Add(new EquipInfoAttribute(1044388, iProps[1]));                             // weaken
                    break;
                }
            }
            else
            {
                return;
            }

            EquipmentInfo eqInfo = new EquipmentInfo(1041000, null, false, (EquipInfoAttribute[])attrs.ToArray(typeof(EquipInfoAttribute)));

            from.Send(new DisplayEquipmentInfo(this, eqInfo));
        }
Exemplo n.º 3
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;
			}
		}
Exemplo n.º 4
0
		public void SetRandomMagicEffect(int MinLevel, int MaxLevel)
		{
			if (MinLevel < 1 || MaxLevel > 3)
				return;

			int NewMagicType;

			if (this is BaseRing)
			{
				NewMagicType = Utility.RandomList((int)JewelMagicEffect.MagicReflect,
					(int)JewelMagicEffect.Invisibility,(int)JewelMagicEffect.Bless,
					(int)JewelMagicEffect.Teleport,(int)JewelMagicEffect.Agility,
					(int)JewelMagicEffect.Cunning,(int)JewelMagicEffect.Strength,
					(int)JewelMagicEffect.NightSight);
			}
			else
			{
				// no teleporting for non-rings
				NewMagicType = Utility.RandomList((int)JewelMagicEffect.MagicReflect,
					(int)JewelMagicEffect.Invisibility, (int)JewelMagicEffect.Bless,
					/*(int)JewelMagicEffect.Teleport,*/ (int)JewelMagicEffect.Agility,
					(int)JewelMagicEffect.Cunning, (int)JewelMagicEffect.Strength,
					(int)JewelMagicEffect.NightSight);
			}

			m_MagicType = (JewelMagicEffect) NewMagicType;

			int NewLevel = Utility.RandomMinMax(MinLevel, MaxLevel);
			switch (NewLevel)
			{
				case 1:
					m_MagicCharges = Utility.Random (1, 5);
					break;
				case 2:
					m_MagicCharges = Utility.Random (4, 11);
					break;
				case 3:
					m_MagicCharges = Utility.Random (9, 20);
					break;
				default:
					// should never happen
					m_MagicCharges = 0;
					break;
			}
			Identified = false;
		}
Exemplo n.º 5
0
		public void SetMagic(JewelMagicEffect Effect, int Charges)
		{
			// Only allow Teleport to be set on Rings
			if (Effect == JewelMagicEffect.Teleport)
			{
				if (this is BaseRing)
				{
					m_MagicType = Effect;
					m_MagicCharges = Charges;
					Identified = false;
				}
			}
			else
			{
				m_MagicType = Effect;
				m_MagicCharges = Charges;
				Identified = false;
			}
		}
Exemplo n.º 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;
			m_MagicType = JewelMagicEffect.None;
			m_MagicCharges = 0;
			m_Identified = true;
			Layer = layer;
			m_InvisTimer = null;
			m_StatEffectTimer = null;
		}
Exemplo n.º 7
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;
            }
        }