// Made by Thistle and Urhell using the logic from the hair restyling deed.
// *praises InsideUO and Cliloc Editor for graphic numbers and messages.*
// Special thanks to joshw and blue77 for helping with the "male usage only" section.
// Don't remove the above lines if you redistribute this or use it.
// I'd have to hunt you down and poke you then. *grin*
using System;
using Server.Mobiles;
using Server.Network;
using Server.Prompts;
using Server.Items;
using Server.Targeting;
using Server.Gumps;
namespace Server.Items
{
public class BeardRestylingDeed : Item
{
[Constructable]
public BeardRestylingDeed() : base( 0x14F0 )
{
Name = "A Beard Restyling Deed";
Weight = 1.0;
LootType = LootType.Blessed;
}
public BeardRestylingDeed( Serial serial ) : base( serial )
{
}
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();
}
public override void OnDoubleClick( Mobile from )
{
if ( !IsChildOf( from.Backpack ) )
from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
if (from.Female)
from.SendMessage( "Only males can use the deed." );
else
from.SendGump( new InternalGump( from, this ) );
}
private class InternalGump : Gump
{
private Mobile m_From;
private BeardRestylingDeed m_Deed;
public InternalGump( Mobile from, BeardRestylingDeed deed ) : base( 50, 50 )
{
m_From = from;
m_Deed = deed;
from.CloseGump( typeof( InternalGump ) );
AddBackground( 100, 10, 400, 385, 0xA28 );
AddHtmlLocalized( 225, 25, 400, 35, 1011056, false, false );
AddButton( 175, 340, 0xFA5, 0xFA7, 0x0, GumpButtonType.Reply, 0 ); // CANCEL
AddHtmlLocalized( 210, 342, 90, 35, 1011012, false, false ); // <CENTER>FACIALHAIR SELECTION MENU</center>
AddBackground( 220, 60, 50, 50, 0xA3C );
AddBackground( 220, 115, 50, 50, 0xA3C );
AddBackground( 220, 170, 50, 50, 0xA3C );
AddBackground( 220, 225, 50, 50, 0xA3C );
AddBackground( 425, 60, 50, 50, 0xA3C );
AddBackground( 425, 115, 50, 50, 0xA3C );
AddBackground( 425, 170, 50, 50, 0xA3C );
AddBackground( 425, 225, 50, 50, 0xA3C );
AddHtmlLocalized( 150, 75, 80, 35, 3000353, false, false ); // short beard
AddHtmlLocalized( 150, 130, 80, 35, 3000355, false, false ); // short full beard
AddHtmlLocalized( 150, 185, 80, 35, 3000351, false, false ); // goatee
AddHtmlLocalized( 150, 240, 80, 35, 3000357, false, false ); // vandyke
AddHtmlLocalized( 355, 75, 80, 35, 3000352, false, false ); // long beard
AddHtmlLocalized( 355, 130, 80, 35, 3000356, false, false ); // long full beard
AddHtmlLocalized( 355, 185, 80, 35, 3000354, false, false ); // mustache
AddHtmlLocalized( 355, 240, 80, 35, 3000340, false, false ); // no beard
AddImage( 153, 20, 0xC672 ); // short beard
AddImage( 153, 65, 0xC6D8 ); // short full beard
AddImage( 153, 120, 0xC670 ); // goatee
AddImage( 153, 185, 0xC6DA ); // vandyke
AddImage( 358, 18, 0xC671 ); // long beard
AddImage( 358, 75, 0xC6D9 ); // long full beard
AddImage( 358, 120, 0xC678 ); // mustache
AddButton( 118, 73, 0xFA5, 0xFA7, 2, GumpButtonType.Reply, 0 );
AddButton( 118, 128, 0xFA5, 0xFA7, 3, GumpButtonType.Reply, 0 );
AddButton( 118, 183, 0xFA5, 0xFA7, 4, GumpButtonType.Reply, 0 );
AddButton( 118, 238, 0xFA5, 0xFA7, 5, GumpButtonType.Reply, 0 );
AddButton( 323, 73, 0xFA5, 0xFA7, 6, GumpButtonType.Reply, 0 );
AddButton( 323, 128, 0xFA5, 0xFA7, 7, GumpButtonType.Reply, 0 );
AddButton( 323, 183, 0xFA5, 0xFA7, 8, GumpButtonType.Reply, 0 );
AddButton( 323, 238, 0xFA5, 0xFA7, 1, GumpButtonType.Reply, 0 );
}
public override void OnResponse( NetState sender, RelayInfo info )
{
if ( m_Deed.Deleted )
return;
Item newBeard = null;
switch ( info.ButtonID )
{
case 0: return;
case 2: newBeard = new ShortBeard(); break;
case 3: newBeard = new MediumShortBeard(); break;
case 4: newBeard = new Goatee(); break;
case 5: newBeard = new Vandyke(); break;
case 6: newBeard = new LongBeard(); break;
case 7: newBeard = new MediumLongBeard(); break;
case 8: newBeard = new Mustache(); break;
}
if ( m_From is PlayerMobile )
{
PlayerMobile pm = (PlayerMobile)m_From;
pm.SetHairMods( -1, -1 ); // clear any hairmods (disguise kit, incognito)
}
Item oldBeard = m_From.FindItemOnLayer( Layer.FacialHair );
if ( oldBeard != null )
oldBeard.Delete();
if ( newBeard != null )
{
if ( oldBeard != null )
newBeard.Hue = oldBeard.Hue;
m_From.AddItem( newBeard );
}
m_Deed.Delete();
}
}
}
}