protected override void OnTarget(Mobile from, object targeted) { if (targeted is EmptyDungBucket) { EmptyDungBucket bucket = (EmptyDungBucket)targeted; if (bucket.Parent == from.Backpack) { try { object fullbucket = new FullDungBucket(); FullDungBucket full = (FullDungBucket)Activator.CreateInstance(fullbucket.GetType()); full.Hue = dung.Hue; if (from.Backpack != null) { from.AddToBackpack(full); } else { full.DropToWorld(from, new Point3D(from.Location)); } bucket.Delete(); dung.Delete(); shovel.UsesRemaining -= 1; if (shovel.UsesRemaining <= 0) { shovel.Delete(); from.SendMessage("You have worn out your shovel!"); } } catch { from.SendMessage("There was a problem filling your bucket!"); } } else { from.SendMessage("I know it stinks, but you must have the bucket in your pack to fill it."); } } else { from.SendMessage("That is not a dung bucket."); } }
public InternalHayTarget(FullDungBucket dung) : base(3, true, TargetFlags.None) { bucket = dung; }