protected override void OnTarget(Mobile from, object targeted) { // Use the same targetting logic as a regular dye tub, only with uses // decrementation (providing not just a color swatch) if (targeted is ColorSwatch) { ColorSwatch cs = (ColorSwatch)targeted; if (cs.Amount > 1) { cs.Amount--; cs = null; cs = new ColorSwatch(); cs.Stackable = false; from.AddToBackpack(cs); } cs.StoredColorName = m_Tub.StoredColorNamePrefix + "shade of " + m_Tub.StoredColorName; cs.Hue = m_Tub.Hue; } else if (targeted is Item) { Item item = (Item)targeted; if (item is BaseClothing) { if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1)) { from.SendLocalizedMessage(500446); // That is too far away. } else if (!item.IsChildOf(from.Backpack)) { from.SendMessage("The item you are dying must be in your backpack."); } else if (item.Parent is Mobile) { from.SendLocalizedMessage(500861); // Can't Dye clothing that is being worn. } else if (((IDyable)item).Dye(from, m_Tub)) { from.PlaySound(0x23E); if (--m_Tub.m_Uses == 0) { m_Tub.Delete(); from.AddToBackpack(new DyeTub()); } item.Hue = m_Tub.Hue; } } else { from.SendMessage("You can only dye clothing with special dyes. You're trying to dye {0}", targeted); } } }
protected override void OnTarget( Mobile from, object targeted ) { // Use the same targetting logic as a regular dye tub, only with uses // decrementation (providing not just a color swatch) if ( targeted is ColorSwatch ) { ColorSwatch cs = (ColorSwatch) targeted; if( cs.Amount > 1 ) { cs.Amount --; cs = null; cs = new ColorSwatch(); cs.Stackable = false; from.AddToBackpack( cs ); } cs.StoredColorName = m_Tub.StoredColorNamePrefix + "shade of " + m_Tub.StoredColorName; cs.Hue = m_Tub.Hue; } else if ( targeted is Item ) { Item item = (Item)targeted; if ( item is BaseClothing ) { if ( !from.InRange( m_Tub.GetWorldLocation(), 1 ) || !from.InRange( item.GetWorldLocation(), 1 ) ) from.SendLocalizedMessage( 500446 ); // That is too far away. else if( !item.IsChildOf(from.Backpack) ) from.SendMessage("The item you are dying must be in your backpack."); else if( item.Parent is Mobile ) from.SendLocalizedMessage( 500861 ); // Can't Dye clothing that is being worn. else if( ((IDyable)item).Dye( from, m_Tub ) ) { from.PlaySound( 0x23E ); if( --m_Tub.m_Uses == 0 ) { m_Tub.Delete(); from.AddToBackpack( new DyeTub() ); } item.Hue = m_Tub.Hue; } } else { from.SendMessage("You can only dye clothing with special dyes. You're trying to dye {0}", targeted); } } }