75 lines
2.1 KiB
C#
75 lines
2.1 KiB
C#
using System;
|
|
using Server;
|
|
using Server.Mobiles;
|
|
|
|
namespace Server.Items
|
|
{
|
|
public class RareHairDye : Item
|
|
{
|
|
private int m_DyeHue;
|
|
|
|
[CommandProperty( AccessLevel.GameMaster )]
|
|
public int DyeHue
|
|
{
|
|
get { return m_DyeHue; }
|
|
set { m_DyeHue = value; InvalidateProperties(); }
|
|
}
|
|
|
|
[Constructable]
|
|
public RareHairDye() : this( Utility.RandomList( 1, 1150, 1154, 1157, 1161, 1166, 1175, 1254 ) )
|
|
{
|
|
}
|
|
|
|
[Constructable]
|
|
public RareHairDye( int hue ) : base( 0xE26 ) // Clear bottle graphic
|
|
{
|
|
Weight = 1.0;
|
|
m_DyeHue = hue;
|
|
Hue = m_DyeHue; // The bottle itself will display the rare color!
|
|
Name = "a vial of rare hair dye";
|
|
}
|
|
|
|
public override void OnDoubleClick( Mobile from )
|
|
{
|
|
if ( !IsChildOf( from.Backpack ) )
|
|
{
|
|
from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
|
|
return;
|
|
}
|
|
|
|
if ( from.HairItemID == 0 && from.FacialHairItemID == 0 )
|
|
{
|
|
from.SendMessage( 33, "You have no hair to dye!" );
|
|
return;
|
|
}
|
|
|
|
if ( from.HairItemID != 0 )
|
|
from.HairHue = m_DyeHue;
|
|
|
|
if ( from.FacialHairItemID != 0 )
|
|
from.FacialHairHue = m_DyeHue;
|
|
|
|
from.PlaySound( 0x246 ); // Magical splash sound
|
|
from.SendMessage( 63, "You wash your hair with the rare dye, permanently changing its color!" );
|
|
this.Delete();
|
|
}
|
|
|
|
public RareHairDye( Serial serial ) : base( serial )
|
|
{
|
|
}
|
|
|
|
public override void Serialize( GenericWriter writer )
|
|
{
|
|
base.Serialize( writer );
|
|
writer.Write( (int) 0 ); // version
|
|
writer.Write( (int) m_DyeHue );
|
|
}
|
|
|
|
public override void Deserialize( GenericReader reader )
|
|
{
|
|
base.Deserialize( reader );
|
|
int version = reader.ReadInt();
|
|
m_DyeHue = reader.ReadInt();
|
|
}
|
|
}
|
|
}
|