Ejemplo n.º 1
0
        public override void OnDoubleClick(Mobile from)
        {
            Container       backpack = from.Backpack;
            DullCopperIngot item1    = (DullCopperIngot)backpack.FindItemByType(typeof(DullCopperIngot));

            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();
                    from.SendLocalizedMessage(1113048); // You've successfully converted the metal.
                    from.AddToBackpack(new GoldIngot(500));
                    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.
            }
        }
Ejemplo n.º 2
0
        public override void OnDoubleClick(Mobile from)
        {
            var backpack = from.Backpack;

            var item1 = (ShadowIronIngot)backpack.FindItemByType(typeof(ShadowIronIngot));

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

                var toConsume = m_Ore1.Amount;

                if ((m_Ore1.Amount > 499) && (m_Ore1.Amount < 501))
                {
                    m_Ore1.Delete();
                    from.SendMessage("You've successfully converted the Metal.");
                    from.AddToBackpack(new AgapiteIngot(500));
                    Delete();
                }
                else if ((m_Ore1.Amount < 500) || (m_Ore1.Amount > 500))
                {
                    from.SendMessage("You can only convert 500 ShadowIron Ingots at a time.");
                }
            }
            else
            {
                from.SendMessage("There isn't ShadowIron Ingots in your Backpack.");
            }
        }
Ejemplo n.º 3
0
        public bool AddResource(Mobile from, BaseIngot reagent, bool passive)
        {
            if (!m_StoredItems.ContainsKey(reagent.GetType()))
            {
                m_StoredItems.Add(reagent.GetType(), new ResourceStub()
                {
                    m_Type = reagent.GetType(), m_Count = 0
                });
            }
            var resource = m_StoredItems[reagent.GetType()];

            if (resource.m_Count >= MAX_STORAGE_AMOUNT)
            {
                if (!passive)
                {
                    from.SendMessage("This book cannot hold more of that ingot.");
                }
                return(false);
            }

            var newTotal = resource.m_Count + reagent.Amount;

            if (newTotal > MAX_STORAGE_AMOUNT)
            {
                //partial deposit
                var excess = newTotal - MAX_STORAGE_AMOUNT;
                var toAdd  = (uint)(reagent.Amount - (newTotal - MAX_STORAGE_AMOUNT));
                if (toAdd > reagent.Amount)
                {
                    return(false);
                }
                m_StoredItems[reagent.GetType()].m_Count += toAdd;
                reagent.Amount -= (int)toAdd;
                if (!passive)
                {
                    from.SendMessage("You were only able to add {0} of the ingots.", toAdd);
                }
                return(false);
            }
            else
            {
                m_StoredItems[reagent.GetType()].m_Count += (uint)reagent.Amount;
                reagent.Delete();
                if (!passive)
                {
                    from.SendMessage("You add all of the ingots into the book.");
                }
                return(true);
            }
            // InvalidateProperties();
        }
Ejemplo n.º 4
0
        public override void OnDoubleClick(Mobile from)
        {
            var backpack = from.Backpack;

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

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

                var 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.");
                    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.");
            }
        }
Ejemplo n.º 5
0
        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.
                    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.
            }
        }
Ejemplo n.º 6
0
        public override bool OnDragDrop(Mobile from, Item item1)
        {
            if (item1 is PotionKeg)
            {
                PotionKeg m_Pot1 = item1 as PotionKeg;

                if (m_Pot1.Type == PotionEffect.RefreshTotal)
                {
                    from.SendMessage("OHHHH YESSS !!!");

                    int toConsume = m_Pot1.Amount;

                    if ((m_Pot1.Amount < 2) && (m_Pot1.Amount > 0))
                    {
                        from.SendMessage("You have converted 1 Keg of Total Refreshment Potion in a Inspected Keg of Total Refreshment");
                        m_Pot1.Delete();
                        from.AddToBackpack(new InspectedKegofTotalRefreshment());

                        return(true);
                    }
                    else
                    {
                        from.SendMessage("You can only convert 1 Keg of Total Refreshment Potion at a time !");
                    }
                }
                else if (m_Pot1.Type == PotionEffect.PoisonGreater)
                {
                    from.SendMessage("OHHHH YESSS !!!");

                    int toConsume = m_Pot1.Amount;

                    if ((m_Pot1.Amount < 2) && (m_Pot1.Amount > 0))
                    {
                        from.SendMessage("You have converted 1 Keg of Greater Poison Potion in a Inspected Keg of Greater Poison");
                        m_Pot1.Delete();
                        from.AddToBackpack(new InspectedKegofGreaterPoison());

                        return(true);
                    }
                    else
                    {
                        from.SendMessage("You can only convert 1 Keg of Greater Poison Potion at a time !");
                    }
                }
            }

            if (item1 is GoldIngot)
            {
                BaseIngot m_Ing1 = item1 as BaseIngot;

                int toConsume = m_Ing1.Amount;

                if ((m_Ing1.Amount > 19) && (m_Ing1.Amount < 21))
                {
                    from.SendMessage("You have converted 20 Gold Ingot in a Pile of Inspected Gold Ingots");
                    m_Ing1.Delete();
                    from.AddToBackpack(new PileofInspectedGoldIngots());

                    return(true);
                }
                else
                {
                    from.SendMessage("You can only convert 20 Gold Ingot at a time !");
                }
            }

            if (item1 is DullCopperIngot)
            {
                BaseIngot m_Ing2 = item1 as BaseIngot;

                int toConsume = m_Ing2.Amount;

                if ((m_Ing2.Amount > 19) && (m_Ing2.Amount < 21))
                {
                    from.SendMessage("You have converted 20 DullCopper Ingot in a Pile of Inspected DullCopper Ingots");
                    m_Ing2.Delete();
                    from.AddToBackpack(new PileofInspectedDullCopperIngots());

                    return(true);
                }
                else
                {
                    from.SendMessage("You can only convert 20 DullCopper Ingot at a time !");
                }
            }

            if (item1 is ShadowIronIngot)
            {
                BaseIngot m_Ing3 = item1 as BaseIngot;

                int toConsume = m_Ing3.Amount;

                if ((m_Ing3.Amount > 19) && (m_Ing3.Amount < 21))
                {
                    from.SendMessage("You have converted 20 ShadowIron Ingot in a Pile of Inspected ShadowIron Ingots");
                    m_Ing3.Delete();
                    from.AddToBackpack(new PileofInspectedShadowIronIngots());

                    return(true);
                }
                else
                {
                    from.SendMessage("You can only convert 20 ShadowIron Ingot at a time !");
                }
            }

            if (item1 is CopperIngot)
            {
                BaseIngot m_Ing4 = item1 as BaseIngot;

                int toConsume = m_Ing4.Amount;

                if ((m_Ing4.Amount > 19) && (m_Ing4.Amount < 21))
                {
                    from.SendMessage("You have converted 20 Copper Ingot in a Pile of Inspected Copper Ingots");
                    m_Ing4.Delete();
                    from.AddToBackpack(new PileofInspectedCopperIngots());

                    return(true);
                }
                else
                {
                    from.SendMessage("You can only convert 20 Copper Ingot at a time !");
                }
            }

            if (item1 is BronzeIngot)
            {
                BaseIngot m_Ing5 = item1 as BaseIngot;

                int toConsume = m_Ing5.Amount;

                if ((m_Ing5.Amount > 19) && (m_Ing5.Amount < 21))
                {
                    from.SendMessage("You have converted 20 Bronze Ingot in a Pile of Inspected Bronze Ingots");
                    m_Ing5.Delete();
                    from.AddToBackpack(new PileofInspectedBronzeIngots());

                    return(true);
                }
                else
                {
                    from.SendMessage("You can only convert 20 Bronze Ingot at a time !");
                }
            }

            if (item1 is AgapiteIngot)
            {
                BaseIngot m_Ing6 = item1 as BaseIngot;

                int toConsume = m_Ing6.Amount;

                if ((m_Ing6.Amount > 19) && (m_Ing6.Amount < 21))
                {
                    from.SendMessage("You have converted 20 Agapite Ingot in a Pile of Inspected Bronze Ingots");
                    m_Ing6.Delete();
                    from.AddToBackpack(new PileofInspectedAgapiteIngots());

                    return(true);
                }
                else
                {
                    from.SendMessage("You can only convert 20 Agapite Ingot at a time !");
                }
            }

            if (item1 is VeriteIngot)
            {
                BaseIngot m_Ing7 = item1 as BaseIngot;

                int toConsume = m_Ing7.Amount;

                if ((m_Ing7.Amount > 19) && (m_Ing7.Amount < 21))
                {
                    from.SendMessage("You have converted 20 Verite Ingot in a Pile of Inspected Verite Ingots");
                    m_Ing7.Delete();
                    from.AddToBackpack(new PileofInspectedVeriteIngots());

                    return(true);
                }
                else
                {
                    from.SendMessage("You can only convert 20 Verite Ingot at a time !");
                }
            }

            if (item1 is ValoriteIngot)
            {
                BaseIngot m_Ing8 = item1 as BaseIngot;

                int toConsume = m_Ing8.Amount;

                if ((m_Ing8.Amount > 19) && (m_Ing8.Amount < 21))
                {
                    from.SendMessage("You have converted 20 Valorite Ingot in a Pile of Inspected Valorite Ingots");
                    m_Ing8.Delete();
                    from.AddToBackpack(new PileofInspectedValoriteIngots());

                    return(true);
                }
                else
                {
                    from.SendMessage("You can only convert 20 Verite Ingot at a time !");
                }
            }

            return(base.OnDragDrop(from, item1));
        }