Full Version : Universal Dye Tub Question
xmlspawner >>Scripting Support >>Universal Dye Tub Question
<< Prev | Next >>
Erica- 04-02-2007
Hi was wondering what i got to edit or add so it will not hue the gold silver or tokens heres the script.

CODE
using System; using Server; using Server.Targeting; using Server.Items; using Server.Factions;
namespace Server.Items
{
public class UnivTubTarget : Target
{
private Item m_Item;
public UnivTubTarget( Item item ) : base( 12, false, TargetFlags.None )
{
m_Item = item;
}
protected override void OnTarget(Mobile from, object targeted)
{
if ( targeted is Item && !(targeted is Gold) && !(targeted is Tokens) && !(targeted is Silver))
{
Item targ = (Item)targeted;
if (!targ.IsChildOf(from.Backpack))
{
from.SendMessage("The item is not in your pack!");
}
else
{
targ.Hue = m_Item.Hue;
from.PlaySound(0x23F);
}
}
else
{
from.SendMessage("You cannot dye that.");
}
}
//}
}
public class UniversalDyeTub : DyeTub
{
public override CustomHuePicker CustomHuePicker{ get{ return CustomHuePicker.UniversalDyeTub; } }
private bool m_Redyable;
[Constructable]
public UniversalDyeTub()
{
Weight = 0.0;
Hue = 0;
Name = "Universal Dye Tub";
m_Redyable = true;
}
public UniversalDyeTub( Serial serial ) : base( serial )
{
}
public override void OnDoubleClick( Mobile from )
{
if ( !IsChildOf (from.Backpack))
{
from.Target = new UnivTubTarget( this );
from.SendMessage( "What do you wish to dye?" );
}
else
{
from.Target = new UnivTubTarget( this );
from.SendMessage( "What do you wish to dye?" );
}
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
}

ArteGordon- 04-02-2007
this line should already prevent gold silver or tokens from being hued.

CODE
if ( targeted is Item && !(targeted is Gold) && !(targeted is Tokens) && !(targeted is Silver))