Example #1
0
        public void FillWith(Mobile from, IronIngot ironingot)
        {
            int need = RequiredIngots - CurrentIngots;

            int toAdd = Math.Min(need, ironingot.Amount);

            CurrentIngots += toAdd;

            ironingot.Amount -= need;

            if (ironingot.Amount <= 0)
            {
                ironingot.Delete();
            }

            if (CurrentIngots < RequiredIngots || CurrentBoards < RequiredBoards)
            {
                from.SendMessage("You have added {0} ingots to the plan.", toAdd);
            }
            else
            {
                from.SendMessage("The filled plans have been added to your backpack.");
                from.AddToBackpack(FilledPlans);
                Delete();
            }
        }
Example #2
0
        public override void OnDoubleClick(Mobile from)
        {
            if (this.ItemID == 0x3544 || this.ItemID == 0x34BC || this.ItemID == 0x34D8)
            {
                bool anvil, forge;
                Server.Engines.Craft.DefBlacksmithy.CheckAnvilAndForge(from, 2, out anvil, out forge);

                if (!IsChildOf(from.Backpack))
                {
                    from.SendLocalizedMessage(1060640);                       // The item must be in your backpack to use it.
                }
                else if (!forge)
                {
                    from.SendMessage("You need to be near a forge to smelt that.");
                }
                else if (from.Skills[SkillName.Blacksmith].Value >= 50)
                {
                    Item ingot = new IronIngot();
                    ingot.Amount = Utility.RandomMinMax(1, 5);
                    from.AddToBackpack(ingot);
                    from.PlaySound(0x208);
                    from.SendMessage("You smelt this into usable iron ingots.");
                    this.Delete();
                }
                else
                {
                    from.SendMessage("Only an apprentice blacksmith can smelt that.");
                }
            }
        }
        public override void OnDoubleClick(Mobile from)
        {
            Container backpack = from.Backpack;

            IronIngot item1 = (IronIngot)backpack.FindItemByType(typeof(IronIngot));

            if (item1 != null)
            {
                BaseIngot m_Ore1 = item1 as BaseIngot;

                int toConsume = m_Ore1.Amount;

                if ((m_Ore1.Amount > 499) && (m_Ore1.Amount < 501))
                {
                    m_Ore1.Delete();

                    switch (Utility.Random(4))
                    {
                    case 0:
                        from.AddToBackpack(new DullCopperIngot(500));
                        break;

                    case 2:
                        from.AddToBackpack(new ShadowIronIngot(500));
                        break;

                    case 1:
                        from.AddToBackpack(new CopperIngot(500));
                        break;

                    case 3:
                        from.AddToBackpack(new BronzeIngot(500));
                        break;
                    }

                    from.SendMessage("You've successfully converted the Metal.");
                    this.Delete();
                }
                else if ((m_Ore1.Amount < 500) || (m_Ore1.Amount > 500))
                {
                    from.SendMessage("You can only convert 500 Iron Ingots at a time.");
                }
            }
            else
            {
                from.SendMessage("There isn't Iron Ingots in your Backpack.");
            }
        }
Example #4
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Rusted.Deleted)
                {
                    return;
                }

                if (Server.Engines.Craft.DefBlacksmithy.IsForge(targeted))
                {
                    int weight = (int)(m_Rusted.Weight);
                    if (weight < 1)
                    {
                        weight = 1;
                    }
                    double difficulty = 50.0;
                    double minSkill   = difficulty - 25.0;
                    double maxSkill   = difficulty + 25.0;

                    if (difficulty > from.Skills[SkillName.Mining].Value)
                    {
                        from.SendMessage("You have no idea how to smelt this item!");
                        return;
                    }

                    if (from.CheckTargetSkill(SkillName.Mining, targeted, minSkill, maxSkill))
                    {
                        IronIngot ingot = new IronIngot(1);
                        ingot.Amount = weight;
                        from.AddToBackpack(ingot);
                        from.PlaySound(0x208);
                        if (weight == 1)
                        {
                            from.SendMessage("You smelt the rusty metal into a usable iron ingot!");
                        }
                        else
                        {
                            from.SendMessage("You smelt the rusty metal into usable iron ingots!");
                        }
                        m_Rusted.Delete();
                    }
                    else
                    {
                        from.PlaySound(0x208);
                        from.SendMessage("You failed to smelt the rusty metal into anything usable!");
                        m_Rusted.Delete();
                    }
                }
            }
        public override void OnDoubleClick(Mobile from)
        {
            Container backpack = from.Backpack;
            IronIngot item1    = (IronIngot)backpack.FindItemByType(typeof(IronIngot));

            if (item1 != null)
            {
                BaseIngot m_Ore1 = item1 as BaseIngot;

                int toConsume = m_Ore1.Amount;

                if ((m_Ore1.Amount > 499) && (m_Ore1.Amount < 501))
                {
                    m_Ore1.Delete();

                    switch (Utility.Random(4))
                    {
                    case 0:
                        from.AddToBackpack(new DullCopperIngot(500));
                        break;

                    case 2:
                        from.AddToBackpack(new ShadowIronIngot(500));
                        break;

                    case 1:
                        from.AddToBackpack(new CopperIngot(500));
                        break;

                    case 3:
                        from.AddToBackpack(new BronzeIngot(500));
                        break;
                    }

                    from.SendLocalizedMessage(1113048); // You've successfully converted the metal.
                    this.Delete();
                }
                else if ((m_Ore1.Amount < 500) || (m_Ore1.Amount > 500))
                {
                    from.SendLocalizedMessage(1113046); // You can only convert five hundred ingots at a time.
                }
            }
            else
            {
                from.SendLocalizedMessage(1078618); // The item must be in your backpack to be exchanged.
            }
        }
        public void OnChop(Mobile from)
        {
            if (from.InRange(this.GetWorldLocation(), 2))
            {
                Effects.SendLocationEffect(Location, Map, 0x3728, 20, 10);                   //smoke or dust
                Effects.PlaySound(Location, Map, 0x11C);

                switch (Utility.Random(25))
                {
                case 0:
                    Effects.SendLocationEffect(from, from.Map, 0x113A, 20, 10);                               // Poison Player
                    from.PlaySound(0x231);
                    from.ApplyPoison(from, Poison.Lesser);
                    break;

                case 1:
                    Effects.SendLocationEffect(from, from.Map, 0x3709, 30);                             // Burn Player
                    from.PlaySound(0x54);
                    AOS.Damage(from, from, Utility.RandomMinMax(2, 5), 0, 100, 0, 0, 0);
                    break;

                case 2:
                    new BarrelLid().MoveToWorld(Location, Map);
                    new BarrelHoops().MoveToWorld(Location, Map);
                    break;

                case 3:
                    Bandage b = new Bandage(Utility.RandomMinMax(5, 10));
                    b.MoveToWorld(Location, Map);
                    break;

                case 4:
                    new BarrelStaves().MoveToWorld(Location, Map);
                    new BarrelHoops().MoveToWorld(Location, Map);
                    break;

                case 5:
                    Gold g = new Gold(Utility.RandomMinMax(25, 50));
                    g.MoveToWorld(Location, Map);
                    break;

                case 6:
                    new AgilityPotion().MoveToWorld(Location, Map);
                    break;

                case 7:
                    new LesserCurePotion().MoveToWorld(Location, Map);
                    break;

                case 8:
                    new LesserExplosionPotion().MoveToWorld(Location, Map);
                    break;

                case 9:
                    new LesserHealPotion().MoveToWorld(Location, Map);
                    break;

                case 10:
                    new LesserLightningPotion().MoveToWorld(Location, Map);
                    break;

                case 11:
                    new LesserManaPotion().MoveToWorld(Location, Map);
                    break;

                case 12:
                    new MindPotion().MoveToWorld(Location, Map);
                    break;

                case 13:
                    new LesserPoisonPotion().MoveToWorld(Location, Map);
                    break;

                case 14:
                    new LesserShatterPotion().MoveToWorld(Location, Map);
                    break;

                case 15:
                    new StrengthPotion().MoveToWorld(Location, Map);
                    break;

                case 16:
                    new LesserToxicPotion().MoveToWorld(Location, Map);
                    break;

                case 17:
                    Arrow arrow = new Arrow(Utility.RandomMinMax(5, 25));
                    arrow.MoveToWorld(Location, Map);
                    break;

                case 18:
                    Bolt bolt = new Bolt(Utility.RandomMinMax(5, 25));
                    bolt.MoveToWorld(Location, Map);
                    break;

                case 19:
                    IronIngot ii = new IronIngot(Utility.RandomMinMax(5, 25));
                    ii.MoveToWorld(Location, Map);
                    break;

                case 20:
                    Leather leather = new Leather(Utility.RandomMinMax(5, 25));
                    leather.MoveToWorld(Location, Map);
                    break;

                case 21:
                    Log log = new Log(Utility.RandomMinMax(5, 25));
                    log.MoveToWorld(Location, Map);
                    break;

                case 22:
                    BoltOfCloth boc = new BoltOfCloth(Utility.RandomMinMax(1, 25));
                    boc.MoveToWorld(Location, Map);
                    break;

                case 23:
                    SpidersSilk spiderssilk = new SpidersSilk(Utility.RandomMinMax(5, 25));
                    spiderssilk.MoveToWorld(Location, Map);
                    break;

                case 24:
                    SulfurousAsh sulfurousash = new SulfurousAsh(Utility.RandomMinMax(1, 25));
                    sulfurousash.MoveToWorld(Location, Map);
                    break;
                }

                Destroy();
            }
            else
            {
                from.SendLocalizedMessage(500446);                   // That is too far away.
            }
        }
Example #7
0
        public override void OnComponentUsed(AddonComponent c, Mobile from)
        {
            BaseHouse house = BaseHouse.FindHouseAt(this);

            /*
             * Unique problems have unique solutions.  OSI does not have a problem with 1000s of mining carts
             * due to the fact that they have only a miniscule fraction of the number of 10 year vets that a
             * typical RunUO shard will have (RunUO's scaled down account aging system makes this a unique problem),
             * and the "freeness" of free accounts. We also dont have mitigating factors like inactive (unpaid)
             * accounts not gaining veteran time.
             *
             * The lack of high end vets and vet rewards on OSI has made testing the *exact* ranging/stacking
             * behavior of these things all but impossible, so either way its just an estimation.
             *
             * If youd like your shard's carts/stumps to work the way they did before, simply replace the check
             * below with this line of code:
             *
             * if (!from.InRange(GetWorldLocation(), 2)
             *
             * However, I am sure these checks are more accurate to OSI than the former version was.
             *
             */

            if (!from.InRange(GetWorldLocation(), 2) || !from.InLOS(this) || !((from.Z - Z) > -3 && (from.Z - Z) < 3))
            {
                from.LocalOverheadMessage(Network.MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
            }
            else if (house != null && house.HasSecureAccess(from, SecureLevel.Friends))
            {
                switch (m_CartType)
                {
                case MiningCartType.OreSouth:
                case MiningCartType.OreEast:
                    if (m_Ore > 0)
                    {
                        Item ingots = null;

                        switch (Utility.Random(9))
                        {
                        case 0:
                            ingots = new IronIngot();
                            break;

                        case 1:
                            ingots = new DullCopperIngot();
                            break;

                        case 2:
                            ingots = new ShadowIronIngot();
                            break;

                        case 3:
                            ingots = new CopperIngot();
                            break;

                        case 4:
                            ingots = new BronzeIngot();
                            break;

                        case 5:
                            ingots = new GoldIngot();
                            break;

                        case 6:
                            ingots = new AgapiteIngot();
                            break;

                        case 7:
                            ingots = new VeriteIngot();
                            break;

                        case 8:
                            ingots = new ValoriteIngot();
                            break;
                        }

                        int amount = Math.Min(10, m_Ore);
                        ingots.Amount = amount;

                        if (!from.PlaceInBackpack(ingots))
                        {
                            ingots.Delete();
                            from.SendLocalizedMessage(1078837);     // Your backpack is full! Please make room and try again.
                        }
                        else
                        {
                            PublicOverheadMessage(MessageType.Regular, 0, 1094724, amount.ToString());     // Ore: ~1_COUNT~
                            m_Ore -= amount;
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(1094725);     // There are no more resources available at this time.
                    }
                    break;

                case MiningCartType.GemSouth:
                case MiningCartType.GemEast:
                    if (m_Gems > 0)
                    {
                        Item gems = null;

                        switch (Utility.Random(15))
                        {
                        case 0:
                            gems = new Amber();
                            break;

                        case 1:
                            gems = new Amethyst();
                            break;

                        case 2:
                            gems = new Citrine();
                            break;

                        case 3:
                            gems = new Diamond();
                            break;

                        case 4:
                            gems = new Emerald();
                            break;

                        case 5:
                            gems = new Ruby();
                            break;

                        case 6:
                            gems = new Sapphire();
                            break;

                        case 7:
                            gems = new StarSapphire();
                            break;

                        case 8:
                            gems = new Tourmaline();
                            break;

                        // Mondain's Legacy gems
                        case 9:
                            gems = new PerfectEmerald();
                            break;

                        case 10:
                            gems = new DarkSapphire();
                            break;

                        case 11:
                            gems = new Turquoise();
                            break;

                        case 12:
                            gems = new EcruCitrine();
                            break;

                        case 13:
                            gems = new FireRuby();
                            break;

                        case 14:
                            gems = new BlueDiamond();
                            break;
                        }

                        int amount = Math.Min(5, m_Gems);
                        gems.Amount = amount;

                        if (!from.PlaceInBackpack(gems))
                        {
                            gems.Delete();
                            from.SendLocalizedMessage(1078837);     // Your backpack is full! Please make room and try again.
                        }
                        else
                        {
                            PublicOverheadMessage(MessageType.Regular, 0, 1094723, amount.ToString());     // Gems: ~1_COUNT~
                            m_Gems -= amount;
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(1094725);     // There are no more resources available at this time.
                    }
                    break;
                }
            }
            else
            {
                from.SendLocalizedMessage(1061637); // You are not allowed to access
            }
        }
Example #8
0
        public override void OnComponentUsed(AddonComponent c, Mobile from)
        {
            BaseHouse house = BaseHouse.FindHouseAt(this);

            if (house != null && house.HasSecureAccess(from, SecureLevel.Friends))
            {
                switch (m_CartType)
                {
                case MiningCartType.OreSouth:
                case MiningCartType.OreEast:
                    if (m_Ore > 0)
                    {
                        Item ingots = null;

                        switch (Utility.Random(9))
                        {
                        case 0: ingots = new IronIngot(); break;

                        case 1: ingots = new DullCopperIngot(); break;

                        case 2: ingots = new ShadowIronIngot(); break;

                        case 3: ingots = new CopperIngot(); break;

                        case 4: ingots = new BronzeIngot(); break;

                        case 5: ingots = new GoldIngot(); break;

                        case 6: ingots = new AgapiteIngot(); break;

                        case 7: ingots = new VeriteIngot(); break;

                        case 8: ingots = new ValoriteIngot(); break;
                        }

                        int amount = Math.Min(10, m_Ore);
                        ingots.Amount = amount;

                        if (!from.PlaceInBackpack(ingots))
                        {
                            ingots.Delete();
                            from.SendLocalizedMessage(1078837);                                       // Your backpack is full! Please make room and try again.
                        }
                        else
                        {
                            PublicOverheadMessage(MessageType.Regular, 0, 1094724, amount.ToString());                                      // Ore: ~1_COUNT~
                            m_Ore -= amount;
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(1094725);                                   // There are no more resources available at this time.
                    }
                    break;

                case MiningCartType.GemSouth:
                case MiningCartType.GemEast:
                    if (m_Gems > 0)
                    {
                        Item gems = null;

                        switch (Utility.Random(17))
                        {
                        case 0: gems = new Amber(); break;

                        case 1: gems = new Amethyst(); break;

                        case 2: gems = new Citrine(); break;

                        case 3: gems = new Diamond(); break;

                        case 4: gems = new Emerald(); break;

                        case 5: gems = new Ruby(); break;

                        case 6: gems = new Sapphire(); break;

                        case 7: gems = new StarSapphire(); break;

                        case 8: gems = new Tourmaline(); break;

                        // Mondain's Legacy gems
                        case 9: gems = new PerfectEmerald(); break;

                        case 10: gems = new DarkSapphire(); break;

                        case 11: gems = new Turquoise(); break;

                        case 12: gems = new EcruCitrine(); break;

                        case 13: gems = new WhitePearl(); break;

                        case 14: gems = new FireRuby(); break;

                        case 15: gems = new BlueDiamond(); break;

                        case 16: gems = new BrilliantAmber(); break;
                        }

                        int amount = Math.Min(5, m_Gems);
                        gems.Amount = amount;

                        if (!from.PlaceInBackpack(gems))
                        {
                            gems.Delete();
                            from.SendLocalizedMessage(1078837);                                       // Your backpack is full! Please make room and try again.
                        }
                        else
                        {
                            PublicOverheadMessage(MessageType.Regular, 0, 1094723, amount.ToString());                                       // Gems: ~1_COUNT~
                            m_Gems -= amount;
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(1094725);                                   // There are no more resources available at this time.
                    }
                    break;
                }
            }
            else
            {
                from.SendLocalizedMessage(1061637);                   // You are not allowed to access this.
            }
        }
Example #9
0
        public override void OnDoubleClick( Mobile m )
        {
            if ( m_TalismanType == TalismanType.None )
                return;

            if ( this.Parent != m )
            {
                m.SendLocalizedMessage( 502641 ); // You must equip this item to use it.
            }
            else if ( m_ChargeTimeLeft > 0 )
            {
                int tmptime = ( m_ChargeTimeLeft2 - ( DateTime.Now.Second - m_ChargeTimeLeft3.Second ) + 1 );

                if ( tmptime > ( m_ChargeTimeLeft2 + 1 ) )
                    tmptime -= 60;
                if ( tmptime > m_ChargeTimeLeft2 )
                    tmptime = m_ChargeTimeLeft2;

                m.SendLocalizedMessage( 1074882, tmptime.ToString() ); // You must wait ~1_val~ seconds for this to recharge.
            }
            else if ( m_Charges == 0 )
            {
                m.SendLocalizedMessage( 501250 ); // This magic item is out of charges.
            }
            else
            {

                if ( (int) m_TalismanType <= 4 )
                {
                    //Removal
                    m.Target = new InternalTarget( this );
                }
                //Mana Phase
                else if ( m_TalismanType == TalismanType.ManaPhase )
                {
                    ManaPhase.OnUse( m, this );
                }
                else if ( (int) m_TalismanType >= 9 )
                {
                    //Summon creature
                    BaseCreature bc = (BaseCreature) Activator.CreateInstance( SummonEntry.GetNPC( m_TalismanType ) );
                    if ( BaseCreature.Summon( bc, m, m.Location, -1, TimeSpan.FromMinutes( 10.0 ) ) )
                    {
                        bc.FixedParticles( 0x3728, 1, 10, 9910, EffectLayer.Head );
                        bc.PlaySound( bc.GetIdleSound() );
                        m_SummonedCreature = bc;
                        m_Charges--;
                        InvalidateProperties();
                        ChargeTimeLeft = 1800;
                        m_ChargeTimer = new ChargeTimeLeftTimer( this );
                        m_ChargeTimer.Start();
                        m_ChargeTimeLeft3 = DateTime.Now;
                    }
                }
                else if ( m_TalismanType == TalismanType.SummonRandom )
                {
                    //Summon Random
                    TalismanType tmpbc = SummonEntry.GetRandom();
                    BaseCreature bc = (BaseCreature) Activator.CreateInstance( SummonEntry.GetNPC( tmpbc ) );
                    if ( BaseCreature.Summon( bc, m, m.Location, -1, TimeSpan.FromMinutes( 10.0 ) ) )
                    {
                        bc.FixedParticles( 0x3728, 1, 10, 9910, EffectLayer.Head );
                        bc.PlaySound( bc.GetIdleSound() );
                        m_SummonedCreature = bc;
                        m_Charges--;
                        InvalidateProperties();
                        ChargeTimeLeft = 1800;
                        m_ChargeTimer = new ChargeTimeLeftTimer( this );
                        m_ChargeTimer.Start();
                        m_ChargeTimeLeft3 = DateTime.Now;
                    }
                }
                else
                {
                    Item summonitem;
                    int message;

                    // Summon item
                    if ( m_TalismanType == TalismanType.SummonBandage )
                    {
                        summonitem = new Bandage( 10 );
                        summonitem.ItemID = 0x0EE9;
                        summonitem.Hue = 0xA3;
                        message = 1075002; // You have been given some clean bandages.
                    }
                    else if ( m_TalismanType == TalismanType.SummonBoard )
                    {
                        summonitem = new Board( 10 );
                        summonitem.Hue = 0xA3;
                        message = 1075000; // You have been given some wooden boards.
                    }
                    else// if ( m_TalismanType == TalismanType.SummonIngot )
                    {
                        summonitem = new IronIngot( 10 );
                        summonitem.Hue = 0xA3;
                        message = 1075001; // You have been given some ingots.
                    }

                    m.AddToBackpack( summonitem );
                    m.SendLocalizedMessage( message );

                    m_Charges--;
                    InvalidateProperties();
                    ChargeTimeLeft = 60;

                    m_ChargeTimer = new ChargeTimeLeftTimer( this );
                    m_ChargeTimer.Start();
                    m_ChargeTimeLeft3 = DateTime.Now;
                }
            }
        }
Example #10
0
		public override void OnComponentUsed( AddonComponent c, Mobile from )
		{
			BaseHouse house = BaseHouse.FindHouseAt( this );

			/*
			 * Unique problems have unique solutions.  OSI does not have a problem with 1000s of mining carts
			 * due to the fact that they have only a miniscule fraction of the number of 10 year vets that a
			 * typical RunUO shard will have (RunUO's scaled down account aging system makes this a unique problem),
			 * and the "freeness" of free accounts. We also dont have mitigating factors like inactive (unpaid)
			 * accounts not gaining veteran time.
			 *
			 * The lack of high end vets and vet rewards on OSI has made testing the *exact* ranging/stacking
			 * behavior of these things all but impossible, so either way its just an estimation.
			 *
			 * If youd like your shard's carts/stumps to work the way they did before, simply replace the check
			 * below with this line of code:
			 *
			 * if (!from.InRange(GetWorldLocation(), 2)
			 *
			 * However, I am sure these checks are more accurate to OSI than the former version was.
			 *
			 */

			if (!from.InRange(GetWorldLocation(), 2) || !from.InLOS(this) || !((from.Z - Z) > -3 && (from.Z - Z) < 3))
			{
				from.LocalOverheadMessage(Network.MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
			}
			else if ( house != null && house.HasSecureAccess( from, SecureLevel.Friends ) )
			{
				switch ( m_CartType )
				{
					case MiningCartType.OreSouth:
					case MiningCartType.OreEast:
						if ( m_Ore > 0 )
						{
							Item ingots = null;

							switch ( Utility.Random( 9 ) )
							{
								case 0: ingots = new IronIngot(); break;
								case 1: ingots = new DullcopperIngot(); break;
								case 2: ingots = new ShadowIngot(); break;
								case 3: ingots = new CopperIngot(); break;
								case 4: ingots = new BronzeIngot(); break;
								case 5: ingots = new GoldIngot(); break;
								case 6: ingots = new AgapiteIngot(); break;
								case 7: ingots = new VeriteIngot(); break;
								case 8: ingots = new ValoriteIngot(); break;
							}

							int amount = Math.Min( 10, m_Ore );
							ingots.Amount = amount;

							if ( !from.PlaceInBackpack( ingots ) )
							{
								ingots.Delete();
								from.SendLocalizedMessage( 1078837 ); // Your backpack is full! Please make room and try again.
							}
							else
							{
								PublicOverheadMessage(MessageType.Regular, 0, 1094724, amount.ToString() ); // Ore: ~1_COUNT~
								m_Ore -= amount;
							}
						}
						else
							from.SendLocalizedMessage( 1094725 ); // There are no more resources available at this time.

						break;
					case MiningCartType.GemSouth:
					case MiningCartType.GemEast:
						if ( m_Gems > 0 )
						{
							Item gems = null;

							switch ( Utility.Random( 15 ) )
							{
								case 0: gems = new Amber(); break;
								case 1: gems = new Amethyst(); break;
								case 2: gems = new Citrine(); break;
								case 3: gems = new Diamond(); break;
								case 4: gems = new Emerald(); break;
								case 5: gems = new Ruby(); break;
								case 6: gems = new Sapphire(); break;
								case 7: gems = new StarSapphire(); break;
								case 8: gems = new Tourmaline(); break;

								// Mondain's Legacy gems
								case 9: gems = new PerfectEmerald(); break;
								case 10: gems = new DarkSapphire(); break;
								case 11: gems = new Turquoise(); break;
								case 12: gems = new EcruCitrine(); break;
								case 13: gems = new FireRuby(); break;
								case 14: gems = new BlueDiamond(); break;
							}

							int amount = Math.Min( 5, m_Gems );
							gems.Amount = amount;

							if ( !from.PlaceInBackpack( gems ) )
							{
								gems.Delete();
								from.SendLocalizedMessage( 1078837 ); // Your backpack is full! Please make room and try again.
							}
							else
							{
								PublicOverheadMessage( MessageType.Regular, 0, 1094723, amount.ToString() ); // Gems: ~1_COUNT~
								m_Gems -= amount;
							}
						}
						else
							from.SendLocalizedMessage( 1094725 ); // There are no more resources available at this time.

						break;
				}
			}
			else
				from.SendLocalizedMessage( 1061637 ); // You are not allowed to access this.
		}
Example #11
0
        public void DropResource(int x, int y, int z, Map map)
        {
            Item Gold = new Gold(100, 200);
            Gold.MoveToWorld(new Point3D(x + Utility.RandomMinMax(-1, 1), y + Utility.RandomMinMax(-1, 1), z), map);

            Item item;

            switch (m_ResType)
            {
                case ResType.Iron:
                    {
                        item = new IronIngot();
                        item.MoveToWorld(new Point3D(x + Utility.RandomMinMax(-1, 1), y + Utility.RandomMinMax(-1, 1), z), map);
                        item.Amount = 100; break;
                    };
                case ResType.Copper:
                    {
                        item = new CopperIngot();
                        item.MoveToWorld(new Point3D(x + Utility.RandomMinMax(-1, 1), y + Utility.RandomMinMax(-1, 1), z), map);
                        item.Amount = 100; break;
                    };
            }
        }
Example #12
0
        public override void OnDoubleClick(Mobile m)
        {
            if (m_TalismanType == TalismanType.None)
            {
                return;
            }

            if (this.Parent != m)
            {
                m.SendLocalizedMessage(502641);                   // You must equip this item to use it.
            }
            else if (m_ChargeTimeLeft > 0)
            {
                int tmptime = (m_ChargeTimeLeft2 - (DateTime.Now.Second - m_ChargeTimeLeft3.Second) + 1);

                if (tmptime > (m_ChargeTimeLeft2 + 1))
                {
                    tmptime -= 60;
                }
                if (tmptime > m_ChargeTimeLeft2)
                {
                    tmptime = m_ChargeTimeLeft2;
                }

                m.SendLocalizedMessage(1074882, tmptime.ToString());                   // You must wait ~1_val~ seconds for this to recharge.
            }
            else if (m_Charges == 0)
            {
                m.SendLocalizedMessage(501250);                   // This magic item is out of charges.
            }
            else
            {
                if ((int)m_TalismanType <= 4)
                {
                    //Removal
                    m.Target = new InternalTarget(this);
                }
                //Mana Phase
                else if (m_TalismanType == TalismanType.ManaPhase)
                {
                    ManaPhase.OnUse(m, this);
                }
                else if ((int)m_TalismanType >= 9)
                {
                    //Summon creature
                    BaseCreature bc = (BaseCreature)Activator.CreateInstance(SummonEntry.GetNPC(m_TalismanType));
                    if (BaseCreature.Summon(bc, m, m.Location, -1, TimeSpan.FromMinutes(10.0)))
                    {
                        bc.FixedParticles(0x3728, 1, 10, 9910, EffectLayer.Head);
                        bc.PlaySound(bc.GetIdleSound());
                        m_SummonedCreature = bc;
                        m_Charges--;
                        InvalidateProperties();
                        ChargeTimeLeft = 1800;
                        m_ChargeTimer  = new ChargeTimeLeftTimer(this);
                        m_ChargeTimer.Start();
                        m_ChargeTimeLeft3 = DateTime.Now;
                    }
                }
                else if (m_TalismanType == TalismanType.SummonRandom)
                {
                    //Summon Random
                    TalismanType tmpbc = SummonEntry.GetRandom();
                    BaseCreature bc    = (BaseCreature)Activator.CreateInstance(SummonEntry.GetNPC(tmpbc));
                    if (BaseCreature.Summon(bc, m, m.Location, -1, TimeSpan.FromMinutes(10.0)))
                    {
                        bc.FixedParticles(0x3728, 1, 10, 9910, EffectLayer.Head);
                        bc.PlaySound(bc.GetIdleSound());
                        m_SummonedCreature = bc;
                        m_Charges--;
                        InvalidateProperties();
                        ChargeTimeLeft = 1800;
                        m_ChargeTimer  = new ChargeTimeLeftTimer(this);
                        m_ChargeTimer.Start();
                        m_ChargeTimeLeft3 = DateTime.Now;
                    }
                }
                else
                {
                    Item summonitem;
                    int  message;

                    // Summon item
                    if (m_TalismanType == TalismanType.SummonBandage)
                    {
                        summonitem        = new Bandage(10);
                        summonitem.ItemID = 0x0EE9;
                        summonitem.Hue    = 0xA3;
                        message           = 1075002;               // You have been given some clean bandages.
                    }
                    else if (m_TalismanType == TalismanType.SummonBoard)
                    {
                        summonitem     = new Board(10);
                        summonitem.Hue = 0xA3;
                        message        = 1075000; // You have been given some wooden boards.
                    }
                    else                          // if ( m_TalismanType == TalismanType.SummonIngot )
                    {
                        summonitem     = new IronIngot(10);
                        summonitem.Hue = 0xA3;
                        message        = 1075001;                  // You have been given some ingots.
                    }

                    m.AddToBackpack(summonitem);
                    m.SendLocalizedMessage(message);

                    m_Charges--;
                    InvalidateProperties();
                    ChargeTimeLeft = 60;

                    m_ChargeTimer = new ChargeTimeLeftTimer(this);
                    m_ChargeTimer.Start();
                    m_ChargeTimeLeft3 = DateTime.Now;
                }
            }
        }
Example #13
0
        public override void OnDoubleClick(Mobile from)
        {
            bool anvil, forge;

            Server.Engines.Craft.DefBlacksmithy.CheckAnvilAndForge(from, 2, out anvil, out forge);

            if (!IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1060640);                   // The item must be in your backpack to use it.
            }
            else if (!forge)
            {
                from.SendMessage("You need to be near a forge to smelt that.");
            }
            else if (from.Skills[SkillName.Blacksmith].Value >= 50)
            {
                if (this.Name == "dull copper scales")
                {
                    Item ingot = new DullCopperIngot();
                    ingot.Amount = this.Amount;
                    from.AddToBackpack(ingot);
                }
                else if (this.Name == "shadow iron scales")
                {
                    Item ingot = new ShadowIronIngot();
                    ingot.Amount = this.Amount;
                    from.AddToBackpack(ingot);
                }
                else if (this.Name == "copper scales")
                {
                    Item ingot = new CopperIngot();
                    ingot.Amount = this.Amount;
                    from.AddToBackpack(ingot);
                }
                else if (this.Name == "bronze scales")
                {
                    Item ingot = new BronzeIngot();
                    ingot.Amount = this.Amount;
                    from.AddToBackpack(ingot);
                }
                else if (this.Name == "gold scales")
                {
                    Item ingot = new GoldIngot();
                    ingot.Amount = this.Amount;
                    from.AddToBackpack(ingot);
                }
                else if (this.Name == "agapite scales")
                {
                    Item ingot = new AgapiteIngot();
                    ingot.Amount = this.Amount;
                    from.AddToBackpack(ingot);
                }
                else if (this.Name == "verite scales")
                {
                    Item ingot = new VeriteIngot();
                    ingot.Amount = this.Amount;
                    from.AddToBackpack(ingot);
                }
                else if (this.Name == "valorite scales")
                {
                    Item ingot = new ValoriteIngot();
                    ingot.Amount = this.Amount;
                    from.AddToBackpack(ingot);
                }
                else if (this.Name == "caddellite scales")
                {
                    Item ingot = new CaddelliteIngot();
                    ingot.Amount = this.Amount;
                    from.AddToBackpack(ingot);
                }
                else if (this.Name == "onyx scales")
                {
                    Item ingot = new OnyxIngot();
                    ingot.Amount = this.Amount;
                    from.AddToBackpack(ingot);
                }
                else if (this.Name == "quartz scales")
                {
                    Item ingot = new QuartzIngot();
                    ingot.Amount = this.Amount;
                    from.AddToBackpack(ingot);
                }
                else if (this.Name == "ruby scales")
                {
                    Item ingot = new RubyIngot();
                    ingot.Amount = this.Amount;
                    from.AddToBackpack(ingot);
                }
                else if (this.Name == "sapphire scales")
                {
                    Item ingot = new SapphireIngot();
                    ingot.Amount = this.Amount;
                    from.AddToBackpack(ingot);
                }
                else if (this.Name == "spinel scales")
                {
                    Item ingot = new SpinelIngot();
                    ingot.Amount = this.Amount;
                    from.AddToBackpack(ingot);
                }
                else if (this.Name == "topaz scales")
                {
                    Item ingot = new TopazIngot();
                    ingot.Amount = this.Amount;
                    from.AddToBackpack(ingot);
                }
                else if (this.Name == "amethyst scales")
                {
                    Item ingot = new AmethystIngot();
                    ingot.Amount = this.Amount;
                    from.AddToBackpack(ingot);
                }
                else if (this.Name == "emerald scales")
                {
                    Item ingot = new EmeraldIngot();
                    ingot.Amount = this.Amount;
                    from.AddToBackpack(ingot);
                }
                else if (this.Name == "garnet scales")
                {
                    Item ingot = new GarnetIngot();
                    ingot.Amount = this.Amount;
                    from.AddToBackpack(ingot);
                }
                else if (Name == "silver scales")
                {
                    Item ingot = new ShinySilverIngot();
                    ingot.Amount = this.Amount;
                    from.AddToBackpack(ingot);
                }
                else if (Name == "star ruby scales")
                {
                    Item ingot = new StarRubyIngot();
                    ingot.Amount = this.Amount;
                    from.AddToBackpack(ingot);
                }
                else if (Name == "marble scales")
                {
                    Item ingot = new MarbleIngot();
                    ingot.Amount = this.Amount;
                    from.AddToBackpack(ingot);
                }
                else if (Name == "jade scales")
                {
                    Item ingot = new JadeIngot();
                    ingot.Amount = this.Amount;
                    from.AddToBackpack(ingot);
                }
                else if (Name == "ice scales")
                {
                    Item ingot = new IceIngot();
                    ingot.Amount = this.Amount;
                    from.AddToBackpack(ingot);
                }
                else if (Name == "obsidian scales")
                {
                    Item ingot = new ObsidianIngot();
                    ingot.Amount = this.Amount;
                    from.AddToBackpack(ingot);
                }
                else if (Name == "nepturite scales")
                {
                    Item ingot = new NepturiteIngot();
                    ingot.Amount = this.Amount;
                    from.AddToBackpack(ingot);
                }
                else if (Name == "steel scales")
                {
                    Item ingot = new SteelIngot();
                    ingot.Amount = this.Amount;
                    from.AddToBackpack(ingot);
                }
                else if (Name == "brass scales")
                {
                    Item ingot = new BrassIngot();
                    ingot.Amount = this.Amount;
                    from.AddToBackpack(ingot);
                }
                else if (Name == "mithril scales")
                {
                    Item ingot = new MithrilIngot();
                    ingot.Amount = this.Amount;
                    from.AddToBackpack(ingot);
                }
                else if (Name == "xormite scales")
                {
                    Item ingot = new XormiteIngot();
                    ingot.Amount = this.Amount;
                    from.AddToBackpack(ingot);
                }
                else
                {
                    Item ingot = new IronIngot();
                    ingot.Amount = this.Amount;
                    from.AddToBackpack(ingot);
                }

                from.PlaySound(0x208);
                from.SendMessage("You smelt the scales and put the ingots in your backpack.");
                this.Delete();
            }
            else
            {
                from.SendMessage("Only an apprentice blacksmith can smelt that.");
            }
        }
Example #14
0
        public override void OnComponentUsed( AddonComponent c, Mobile from )
        {
            BaseHouse house = BaseHouse.FindHouseAt( this );

            if ( !from.InRange( GetWorldLocation(), 2 ) )
            {
                from.LocalOverheadMessage( Network.MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that.
            }
            else if ( house != null && house.HasSecureAccess( from, SecureLevel.Friends ) )
            {
                switch ( m_CartType )
                {
                    case MiningCartType.OreSouth:
                    case MiningCartType.OreEast:
                        if ( m_Ore > 0 )
                        {
                            Item ingots = null;

                            switch ( Utility.Random( 9 ) )
                            {
                                case 0: ingots = new IronIngot(); break;
                                case 1: ingots = new DullCopperIngot(); break;
                                case 2: ingots = new ShadowIronIngot(); break;
                                case 3: ingots = new CopperIngot(); break;
                                case 4: ingots = new BronzeIngot(); break;
                                case 5: ingots = new GoldIngot(); break;
                                case 6: ingots = new AgapiteIngot(); break;
                                case 7: ingots = new VeriteIngot(); break;
                                case 8: ingots = new ValoriteIngot(); break;
                            }

                            int amount = Math.Min( 10, m_Ore );
                            ingots.Amount = amount;

                            if ( !from.PlaceInBackpack( ingots ) )
                            {
                                ingots.Delete();
                                from.SendLocalizedMessage( 1078837 ); // Your backpack is full! Please make room and try again.
                            }
                            else
                            {
                                PublicOverheadMessage(MessageType.Regular, 0, 1094724, amount.ToString() ); // Ore: ~1_COUNT~
                                m_Ore -= amount;
                            }
                        }
                        else
                            from.SendLocalizedMessage( 1094725 ); // There are no more resources available at this time.

                        break;
                    case MiningCartType.GemSouth:
                    case MiningCartType.GemEast:
                        if ( m_Gems > 0 )
                        {
                            Item gems = null;

                            switch ( Utility.Random( 15 ) )
                            {
                                case 0: gems = new Amber(); break;
                                case 1: gems = new Amethyst(); break;
                                case 2: gems = new Citrine(); break;
                                case 3: gems = new Diamond(); break;
                                case 4: gems = new Emerald(); break;
                                case 5: gems = new Ruby(); break;
                                case 6: gems = new Sapphire(); break;
                                case 7: gems = new StarSapphire(); break;
                                case 8: gems = new Tourmaline(); break;

                                // Mondain's Legacy gems
                                case 9: gems = new PerfectEmerald(); break;
                                case 10: gems = new DarkSapphire(); break;
                                case 11: gems = new Turquoise(); break;
                                case 12: gems = new EcruCitrine(); break;
                                case 13: gems = new FireRuby(); break;
                                case 14: gems = new BlueDiamond(); break;
                            }

                            int amount = Math.Min( 5, m_Gems );
                            gems.Amount = amount;

                            if ( !from.PlaceInBackpack( gems ) )
                            {
                                gems.Delete();
                                from.SendLocalizedMessage( 1078837 ); // Your backpack is full! Please make room and try again.
                            }
                            else
                            {
                                PublicOverheadMessage( MessageType.Regular, 0, 1094723, amount.ToString() ); // Gems: ~1_COUNT~
                                m_Gems -= amount;
                            }
                        }
                        else
                            from.SendLocalizedMessage( 1094725 ); // There are no more resources available at this time.

                        break;
                }
            }
            else
                from.SendLocalizedMessage( 1061637 ); // You are not allowed to access this.
        }
        public void UseRepairMaterials(BaseShip ship, Mobile from, DamageType damageType)
        {
            switch (damageType)
            {
            case DamageType.Hull:
            {
                int boardsUsed          = 0;
                int boardsNeeded        = 0;
                int repairAmount        = ship.MaxHitPoints - ship.HitPoints;
                int maximumRepairAmount = (int)((double)ship.MaxHitPoints * BaseShip.HullRepairPercent);

                if (repairAmount > maximumRepairAmount)
                {
                    repairAmount = maximumRepairAmount;
                }

                boardsNeeded = (int)((double)repairAmount * BaseShip.RepairMaterialFactor);

                if (boardsNeeded < 0)
                {
                    boardsNeeded = 1;
                }

                Item[] playerBoards = from.Backpack.FindItemsByType(typeof(BaseResourceBoard));
                Item[] holdBoards   = ship.Hold.FindItemsByType(typeof(BaseResourceBoard));

                foreach (Item item in playerBoards)
                {
                    if (boardsNeeded <= 0)
                    {
                        return;
                    }

                    BaseResourceBoard board = item as BaseResourceBoard;

                    if (board.Amount > boardsNeeded)
                    {
                        board.Amount -= boardsNeeded;
                        boardsNeeded  = 0;
                    }

                    else
                    {
                        boardsNeeded -= board.Amount;
                        board.Delete();
                    }
                }

                foreach (Item item in holdBoards)
                {
                    if (boardsNeeded <= 0)
                    {
                        return;
                    }

                    BaseResourceBoard board = item as BaseResourceBoard;

                    if (board.Amount > boardsNeeded)
                    {
                        board.Amount -= boardsNeeded;
                        boardsNeeded  = 0;
                    }

                    else
                    {
                        boardsNeeded -= board.Amount;
                        board.Delete();
                    }
                }

                break;
            }

            case DamageType.Sails:
            {
                int clothUsed           = 0;
                int clothNeeded         = 0;
                int repairAmount        = ship.MaxSailPoints - ship.SailPoints;
                int maximumRepairAmount = (int)((double)ship.MaxSailPoints * BaseShip.HullRepairPercent);

                if (repairAmount > maximumRepairAmount)
                {
                    repairAmount = maximumRepairAmount;
                }

                clothNeeded = (int)((double)repairAmount * BaseShip.RepairMaterialFactor);

                if (clothNeeded < 0)
                {
                    clothNeeded = 1;
                }

                Item[] playerCloth = from.Backpack.FindItemsByType(typeof(Cloth));
                Item[] holdCloth   = ship.Hold.FindItemsByType(typeof(Cloth));

                foreach (Item item in playerCloth)
                {
                    if (clothNeeded <= 0)
                    {
                        return;
                    }

                    Cloth cloth = item as Cloth;

                    if (cloth.Amount > clothNeeded)
                    {
                        cloth.Amount -= clothNeeded;
                        clothNeeded   = 0;
                    }

                    else
                    {
                        clothNeeded -= cloth.Amount;
                        cloth.Delete();
                    }
                }

                foreach (Item item in holdCloth)
                {
                    if (clothNeeded <= 0)
                    {
                        return;
                    }

                    Cloth cloth = item as Cloth;

                    if (cloth.Amount > clothNeeded)
                    {
                        cloth.Amount -= clothNeeded;
                        clothNeeded   = 0;
                    }

                    else
                    {
                        clothNeeded -= cloth.Amount;
                        cloth.Delete();
                    }
                }

                break;
            }


            case DamageType.Guns:
            {
                int ironIngotsUsed      = 0;
                int ironIngotsNeeded    = 0;
                int repairAmount        = ship.MaxGunPoints - ship.GunPoints;
                int maximumRepairAmount = (int)((double)ship.MaxGunPoints * BaseShip.HullRepairPercent);

                if (repairAmount > maximumRepairAmount)
                {
                    repairAmount = maximumRepairAmount;
                }

                ironIngotsNeeded = (int)((double)repairAmount * BaseShip.RepairMaterialFactor);

                if (ironIngotsNeeded < 0)
                {
                    ironIngotsNeeded = 1;
                }

                Item[] playerIronIngots = from.Backpack.FindItemsByType(typeof(IronIngot));
                Item[] holdIronIngots   = ship.Hold.FindItemsByType(typeof(IronIngot));

                foreach (Item item in playerIronIngots)
                {
                    if (ironIngotsNeeded <= 0)
                    {
                        return;
                    }

                    IronIngot ironIngot = item as IronIngot;

                    if (ironIngot.Amount > ironIngotsNeeded)
                    {
                        ironIngot.Amount -= ironIngotsNeeded;
                        ironIngotsNeeded  = 0;
                    }

                    else
                    {
                        ironIngotsNeeded -= ironIngot.Amount;
                        ironIngot.Delete();
                    }
                }

                foreach (Item item in holdIronIngots)
                {
                    if (ironIngotsNeeded <= 0)
                    {
                        return;
                    }

                    IronIngot ironIngot = item as IronIngot;

                    if (ironIngot.Amount > ironIngotsNeeded)
                    {
                        ironIngot.Amount -= ironIngotsNeeded;
                        ironIngotsNeeded  = 0;
                    }

                    else
                    {
                        ironIngotsNeeded -= ironIngot.Amount;
                        ironIngot.Delete();
                    }
                }

                break;
            }
            }
        }
        public bool CheckRepairMaterials(BaseShip ship, Mobile from, DamageType damageType)
        {
            if (ship == null)
            {
                return(false);
            }

            if (from == null)
            {
                return(false);
            }

            if (damageType == null)
            {
                return(false);
            }

            switch (damageType)
            {
            case DamageType.Hull:
            {
                int totalBoards  = 0;
                int boardsNeeded = (int)((double)ship.MaxHitPoints * BaseShip.HullRepairPercent * BaseShip.RepairMaterialFactor);

                Item[] playerBoards = from.Backpack.FindItemsByType(typeof(BaseResourceBoard));
                Item[] holdBoards   = ship.Hold.FindItemsByType(typeof(BaseResourceBoard));

                foreach (Item item in playerBoards)
                {
                    BaseResourceBoard board = item as BaseResourceBoard;
                    totalBoards += board.Amount;
                }

                foreach (Item item in holdBoards)
                {
                    BaseResourceBoard board = item as BaseResourceBoard;
                    totalBoards += board.Amount;
                }

                if (totalBoards > boardsNeeded)
                {
                    return(true);
                }

                break;
            }

            case DamageType.Sails:
            {
                int totalCloth  = 0;
                int clothNeeded = (int)((double)ship.MaxHitPoints * BaseShip.SailRepairPercent * BaseShip.RepairMaterialFactor);

                Item[] playerCloth = from.Backpack.FindItemsByType(typeof(Cloth));
                Item[] holdCloth   = ship.Hold.FindItemsByType(typeof(Cloth));

                foreach (Item item in playerCloth)
                {
                    Cloth cloth = item as Cloth;
                    totalCloth += cloth.Amount;
                }

                foreach (Item item in holdCloth)
                {
                    Cloth cloth = item as Cloth;
                    totalCloth += cloth.Amount;
                }

                if (totalCloth > clothNeeded)
                {
                    return(true);
                }

                break;
            }

            case DamageType.Guns:
            {
                int totalIronIngots  = 0;
                int ironIngotsNeeded = (int)((double)ship.MaxHitPoints * BaseShip.GunRepairPercent * BaseShip.RepairMaterialFactor);

                Item[] playerIronIngots = from.Backpack.FindItemsByType(typeof(IronIngot));
                Item[] holdIronIngots   = ship.Hold.FindItemsByType(typeof(IronIngot));

                foreach (Item item in playerIronIngots)
                {
                    IronIngot ironIngot = item as IronIngot;
                    totalIronIngots += ironIngot.Amount;
                }

                foreach (Item item in holdIronIngots)
                {
                    IronIngot ironIngot = item as IronIngot;
                    totalIronIngots += ironIngot.Amount;
                }

                if (totalIronIngots > ironIngotsNeeded)
                {
                    return(true);
                }

                break;
            }
            }

            return(false);
        }