protected override void OnTarget(Mobile from, object targeted) { if (!(targeted is PlantPigment) || !((PlantPigment)targeted).IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1046439); // That is not a valid target. from.SendLocalizedMessage(1074794); // Target the material to use: from.Target = new PigmentsTarget(m_CraftSystem, m_TypeRes, m_Tool, m_CraftItem); } else { from.EndAction(typeof(CraftSystem)); PlantPigment pigment = targeted as PlantPigment; if (from.Backpack == null || from.Backpack.GetAmount(typeof(ColorFixative)) < 1) { // You don't have the components needed to make that. from.SendGump(new CraftGump(from, m_CraftSystem, m_Tool, 1044253)); } else { NaturalDye.DoCraft(from, m_CraftSystem, m_TypeRes, m_Tool, m_CraftItem, pigment); } } }
public override void OnAfterDuped(Item newItem) { NaturalDye newDye = newItem as NaturalDye; if (newDye != null) { newDye.PlantHue = PlantHue; } }
public InternalTarget(NaturalDye item) : base(1, false, TargetFlags.None) { this.m_Item = item; }
protected void Target(Mobile from, object targeted) { if (from.Backpack == null) { return; } if (!IsChildOf(from.Backpack)) { // This must be in your backpack to use it. from.SendLocalizedMessage(1080063); } else if (targeted is Item) { Item item = targeted as Item; if (item.Parent is Mobile) { // You cannot scour items that are being worn! from.SendLocalizedMessage(1112350); } else if (!item.IsChildOf(from.Backpack)) { // That must be in your pack for you to use it. from.SendLocalizedMessage(1042001); } else if (!item.Movable) { // You may not scour items which are locked down. from.SendLocalizedMessage(1112351); } else if (item is DryReeds) { if (!(from is PlayerMobile) || !((PlayerMobile)from).BasketWeaving) { // You haven't learned basket weaving. Perhaps studying a book would help! from.SendLocalizedMessage(1112253); } else { PlantHue hue = ((DryReeds)item).PlantHue; if (DryReeds.ConsumeReeds(from.Backpack, hue, 2)) { Consume(); from.AddToBackpack(new SoftenedReeds(hue)); } else { // You don't have enough of this type of dry reeds to make that. from.SendLocalizedMessage(1112250); } } } else if (NaturalDye.IsValidItem(item)) { Consume(); item.Hue = 0; from.PlaySound(0x23E); } else { // You cannot scour that! from.SendLocalizedMessage(1112349); } } else { // You cannot scour that! from.SendLocalizedMessage(1112349); } }