private void InternalCallback(Mobile from, object targeted, object state)
        {
            BasePigmentsOfTokuno pigment = (BasePigmentsOfTokuno)state;

            if (pigment.Deleted || pigment.UsesRemaining <= 0 || !from.InRange(pigment.GetWorldLocation(), 3) || !pigment.IsAccessibleTo(from))
            {
                return;
            }

            Item i = targeted as Item;

            if (i == null)
            {
                from.SendLocalizedMessage(1070931); // You can only dye artifacts and enhanced magic items with this tub.
            }
            else if (!from.InRange(i.GetWorldLocation(), 3) || !IsAccessibleTo(from))
            {
                from.SendLocalizedMessage(502436); // That is not accessible.
            }
            else if (from.Items.Contains(i))
            {
                from.SendLocalizedMessage(1070930); // Can't dye artifacts or enhanced magic items that are being worn.
            }
            else if (i.IsLockedDown)
            {
                from.SendLocalizedMessage(1070932); // You may not dye artifacts and enhanced magic items which are locked down.
            }
            else if (i.QuestItem)
            {
                from.SendLocalizedMessage(1151836); // You may not dye toggled quest items.
            }
            else if (i is MetalPigmentsOfTokuno)
            {
                from.SendLocalizedMessage(1042417); // You cannot dye that.
            }
            else if (i is LesserPigmentsOfTokuno)
            {
                from.SendLocalizedMessage(1042417); // You cannot dye that.
            }
            else if (i is PigmentsOfTokuno)
            {
                from.SendLocalizedMessage(1042417); // You cannot dye that.
            }
            else if (!IsValidItem(i))
            {
                from.SendLocalizedMessage(1070931); // You can only dye artifacts and enhanced magic items with this tub.	//Yes, it says tub on OSI.  Don't ask me why ;p
            }
            else
            {
                //Notes: on OSI there IS no hue check to see if it's already hued.  and no messages on successful hue either
                i.Hue = Hue;

                if (--pigment.UsesRemaining <= 0)
                {
                    pigment.Delete();
                }

                from.PlaySound(0x23E); // As per OSI TC1
            }
        }
Example #2
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                Item item = targeted as Item;

                if (item == null)
                {
                    return;
                }

                if (!item.IsChildOf(from.Backpack))
                {
                    from.SendLocalizedMessage(1062334); // This item must be in your backpack to be used.
                }
                else if (item is MetalPigmentsOfTokuno || item is LesserPigmentsOfTokuno || item is PigmentsOfTokuno || item is CompassionPigment)
                {
                    from.SendLocalizedMessage(1042083); // You cannot dye that.
                }
                else if (item.IsLockedDown)
                {
                    from.SendLocalizedMessage(1070932); // You may not dye artifacts and enhanced magic items which are locked down.
                }
                else if (BasePigmentsOfTokuno.IsValidItem(item))
                {
                    item.Hue = m_Pigment.Hue;

                    m_Pigment.UsesRemaining--;

                    if (m_Pigment.UsesRemaining <= 0)
                    {
                        m_Pigment.Delete();
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1070931); // You can only dye artifacts and enhanced magic items with this tub.
                }
            }
Example #3
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (this.m_Item.Deleted)
                {
                    return;
                }

                Item item = targeted as Item;

                if (null != item)
                {
                    bool valid = (item is IDyable ||
                                  item is BaseBook || item is BaseClothing ||
                                  item is BaseJewel || item is BaseStatuette ||
                                  item is BaseWeapon || item is Runebook ||
                                  item is Spellbook || item.IsArtifact || BasePigmentsOfTokuno.IsValidItem(item));

                    if (!valid && item is BaseArmor)
                    {
                        CraftResourceType restype = CraftResources.GetType(((BaseArmor)item).Resource);
                        if ((CraftResourceType.Leather == restype || CraftResourceType.Metal == restype) &&
                            ArmorMaterialType.Bone != ((BaseArmor)item).MaterialType)
                        {
                            valid = true;
                        }
                    }

                    if (!valid && FurnitureAttribute.Check(item))
                    {
                        if (!from.InRange(this.m_Item.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446); // That is too far away.
                            return;
                        }
                        else
                        {
                            BaseHouse house = BaseHouse.FindHouseAt(item);

                            if (house == null || (!house.IsLockedDown(item) && !house.IsSecure(item)))
                            {
                                from.SendLocalizedMessage(501022); // Furniture must be locked down to paint it.
                                return;
                            }
                            else if (!house.IsCoOwner(from))
                            {
                                from.SendLocalizedMessage(501023); // You must be the owner to use this item.
                                return;
                            }
                            else
                            {
                                valid = true;
                            }
                        }
                    }

                    // need to add any bags, chests, boxes, crates not IDyable but dyable by natural dyes

                    if (valid)
                    {
                        item.Hue = PlantPigmentHueInfo.GetInfo(this.m_Item.PigmentHue).Hue;
                        from.PlaySound(0x23E);

                        if (--this.m_Item.UsesRemaining > 0)
                        {
                            this.m_Item.InvalidateProperties();
                        }
                        else
                        {
                            this.m_Item.Delete();
                        }

                        return;
                    }
                }

                from.SendLocalizedMessage(1042083); // You cannot dye that.
            }
Example #4
0
        public void OnTarget(Mobile from, object targeted)
        {
            if (targeted is Item)
            {
                var item = (Item)targeted;

                if (item.Parent is Mobile)
                {
                    from.SendLocalizedMessage(1112350); // You cannot scour items that are being worn!
                }
                else if (item.IsLockedDown || item.IsSecure)
                {
                    from.SendLocalizedMessage(1112351); // You may not scour items which are locked down.
                }
                else if (item.QuestItem)
                {
                    from.SendLocalizedMessage(1151837); // You may not scour toggled quest items.
                }
                else if (item is DryReeds)
                {
                    if (!(from is PlayerMobile) || !((PlayerMobile)from).BasketWeaving)
                    {
                        from.SendLocalizedMessage(1112253); //You haven't learned basket weaving. Perhaps studying a book would help!
                    }
                    else
                    {
                        DryReeds  reed1 = (DryReeds)targeted;
                        Container cont  = from.Backpack;

                        Server.Engines.Plants.PlantHue hue = reed1.PlantHue;

                        if (!reed1.IsChildOf(from.Backpack))
                        {
                            from.SendLocalizedMessage(1116249); //That must be in your backpack for you to use it.
                        }
                        else if (cont != null)
                        {
                            Item[]      items = cont.FindItemsByType(typeof(DryReeds));
                            List <Item> list  = new List <Item>();
                            int         total = 0;

                            foreach (Item it in items)
                            {
                                if (it is DryReeds)
                                {
                                    DryReeds check = (DryReeds)it;

                                    if (reed1.PlantHue == check.PlantHue)
                                    {
                                        total += it.Amount;
                                        list.Add(it);
                                    }
                                }
                            }

                            int toConsume = 2;

                            if (list.Count > 0 && total > 1)
                            {
                                foreach (Item it in list)
                                {
                                    if (it.Amount >= toConsume)
                                    {
                                        it.Consume(toConsume);
                                        toConsume = 0;
                                    }
                                    else if (it.Amount < toConsume)
                                    {
                                        it.Delete();
                                        toConsume -= it.Amount;
                                    }

                                    if (toConsume <= 0)
                                    {
                                        break;
                                    }
                                }

                                SoftenedReeds sReed = new SoftenedReeds(hue);

                                if (!from.Backpack.TryDropItem(from, sReed, false))
                                {
                                    sReed.MoveToWorld(from.Location, from.Map);
                                }

                                m_UsesRemaining--;

                                if (m_UsesRemaining <= 0)
                                {
                                    Delete();
                                }
                                else
                                {
                                    InvalidateProperties();
                                }

                                from.PlaySound(0x23E);
                            }
                            else
                            {
                                from.SendLocalizedMessage(1112250); //You don't have enough of this type of dry reeds to make that.
                            }
                        }
                    }
                }
                else if (BasePigmentsOfTokuno.IsValidItem(item))
                {
                    from.PlaySound(0x23E);

                    ((Item)targeted).Hue = 0;

                    m_UsesRemaining--;

                    if (m_UsesRemaining <= 0)
                    {
                        Delete();
                    }
                    else
                    {
                        InvalidateProperties();
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1112349); // You cannot scour that!
                }
            }
            else
            {
                from.SendLocalizedMessage(1112349); // You cannot scour that!
            }
        }