Beispiel #1
0
        public override void OnComponentUsed(AddonComponent c, Mobile from)
        {
            if (from.InRange(Location, 2))
            {
                if (m_Charges > 0)
                {
                    from.Target = new InternalTarget(this);
                }
                else
                {
                    if (from.Backpack != null)
                    {
                        PotionKeg keg = from.Backpack.FindItemByType(typeof(PotionKeg)) as PotionKeg;

                        if (Validate(keg) > 0)
                        {
                            from.SendGump(new InternalGump(this, keg));
                        }
                        else
                        {
                            from.SendLocalizedMessage(1076198); // You do not have a full keg of explosion potions needed to recharge the cannon.
                        }
                    }
                }
            }
            else
            {
                from.SendLocalizedMessage(1076766); // That is too far away.
            }
        }
Beispiel #2
0
        public void Fill(Mobile from, PotionKeg keg)
        {
            Charges = Validate(keg);

            if (Charges > 0)
            {
                keg.Delete();
                from.SendLocalizedMessage(1076199); // Your cannon is recharged.
            }
            else
            {
                from.SendLocalizedMessage(1076198); // You do not have a full keg of explosion potions needed to recharge the cannon.
            }
        }
Beispiel #3
0
        public int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CraftItem craftItem, int resHue)
        {
            if (craftSystem is DefAlchemy)
            {
                Container pack = from.Backpack;

                if (pack != null)
                {
                    if ((int)PotionEffect >= (int)PotionEffect.Invisibility)
                    {
                        return(1);
                    }

                    List <PotionKeg> kegs = pack.FindItemsByType <PotionKeg>();

                    for (int i = 0; i < kegs.Count; ++i)
                    {
                        PotionKeg keg = kegs[i];

                        if (keg == null)
                        {
                            continue;
                        }

                        if (keg.Held <= 0 || keg.Held >= 100)
                        {
                            continue;
                        }

                        if (keg.Type != PotionEffect)
                        {
                            continue;
                        }

                        ++keg.Held;

                        Consume();
                        from.AddToBackpack(new Bottle());

                        return(-1); // signal placed in keg
                    }
                }
            }

            return(1);
        }
Beispiel #4
0
        public int Validate(PotionKeg keg)
        {
            if (keg != null && !keg.Deleted && keg.Held == 100)
            {
                if (keg.Type == PotionEffect.ExplosionLesser)
                {
                    return(5);
                }
                else if (keg.Type == PotionEffect.Explosion)
                {
                    return(10);
                }
                else if (keg.Type == PotionEffect.ExplosionGreater)
                {
                    return(15);
                }
            }

            return(0);
        }
Beispiel #5
0
            public InternalGump(CannonAddon cannon, PotionKeg keg) : base(50, 50)
            {
                m_Cannon = cannon;
                m_Keg    = keg;

                Closable   = true;
                Disposable = true;
                Dragable   = true;
                Resizable  = false;

                AddPage(0);

                AddBackground(0, 0, 291, 133, 0x13BE);
                AddImageTiled(5, 5, 280, 100, 0xA40);

                AddHtmlLocalized(9, 9, 272, 100, 1076196, cannon.Validate(keg).ToString(), 0x7FFF, false, false); // You will need a full keg of explosion potions to recharge the cannon.  Your keg will provide ~1_CHARGES~ charges.

                AddButton(5, 107, 0xFB1, 0xFB2, (int)Buttons.Cancel, GumpButtonType.Reply, 0);
                AddHtmlLocalized(40, 109, 100, 20, 1060051, 0x7FFF, false, false); // CANCEL

                AddButton(160, 107, 0xFB7, 0xFB8, (int)Buttons.Recharge, GumpButtonType.Reply, 0);
                AddHtmlLocalized(195, 109, 120, 20, 1076197, 0x7FFF, false, false); // Recharge
            }