예제 #1
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)
                {
                    Item[] kegs = pack.FindItemsByType(typeof(PotionKeg), true);

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

                        if (keg == null)
                        {
                            continue;
                        }

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

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

                        if (this is TeiravonPotion)
                        {
                            TeiravonPotion tp = (TeiravonPotion)this;
                            if (tp.Racial)
                            {
                                continue;
                            }
                        }

                        ++keg.Held;

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

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

            return(1);
        }
예제 #2
0
        public override bool OnDragDrop(Mobile from, Item item)
        {
            if (item is TeiravonPotion)
            {
                TeiravonPotion tp = (TeiravonPotion)item;
                if (tp.Racial)
                {
                    from.SendMessage("Keg storage will ruin that potion!");
                    return(false);
                }
            }

            if (item is BasePotion)
            {
                BasePotion pot = (BasePotion)item;

                if (m_Held == 0)
                {
                    if (GiveBottle(from))
                    {
                        m_Type     = pot.PotionEffect;
                        m_TypeName = pot.Name;

                        Held = 1;

                        from.PlaySound(0x240);

                        from.SendLocalizedMessage(502237);                           // You place the empty bottle in your backpack.

                        item.Delete();
                        return(true);
                    }
                    else
                    {
                        from.SendLocalizedMessage(502238);                           // You don't have room for the empty bottle in your backpack.
                        return(false);
                    }
                }
                else if (pot.PotionEffect != m_Type)
                {
                    from.SendLocalizedMessage(502236);                       // You decide that it would be a bad idea to mix different types of potions.
                    return(false);
                }
                else if (m_Held >= 100)
                {
                    from.SendLocalizedMessage(502233);                       // The keg will not hold any more!
                    return(false);
                }
                else
                {
                    if (GiveBottle(from))
                    {
                        ++Held;
                        item.Delete();

                        from.PlaySound(0x240);

                        from.SendLocalizedMessage(502237);                           // You place the empty bottle in your backpack.

                        item.Delete();
                        return(true);
                    }
                    else
                    {
                        from.SendLocalizedMessage(502238);                           // You don't have room for the empty bottle in your backpack.
                        return(false);
                    }
                }
            }
            else
            {
                from.SendLocalizedMessage(502232);                   // The keg is not designed to hold that type of object.
                return(false);
            }
        }