Beispiel #1
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.
                }
            }
Beispiel #2
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.
            }
Beispiel #3
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!
            }
        }