using System;
using Server.Gumps;
using Server.Mobiles;
using Server.Network;
namespace Server.Items
{
public class BeardRestylingDeed : Item
{
[Constructable]
public BeardRestylingDeed()
: base(0x14F0)
{
this.Weight = 1.0;
this.LootType = LootType.Blessed;

}
public BeardRestylingDeed(Serial serial)
: base(serial)
{
this.Name = "Beard Restyling Deed";
}
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 (!this.IsChildOf(from.Backpack))
{
from.SendLocalizedMessage(1042001); // That must be in your pack...
}
else if (from.Female)
from.SendMessage( "Only males can use the deed." );
else
{
from.SendGump(new InternalGump(from, this));
}
}
private class InternalGump : Gump
{
private readonly Mobile m_From;
private readonly BeardRestylingDeed m_Deed;
/*
gump data: bgX, bgY, htmlX, htmlY, imgX, imgY, butX, butY
*/
readonly int[][] LayoutArray =
{
new int[] { 0 },
/* padding: its more efficient than code to ++ the index/buttonid */ new int[] { 425, 280, 342, 295, 000, 000, 310, 292 },
new int[] { 235, 060, 150, 075, 168, 020, 118, 073 },
new int[] { 235, 115, 150, 130, 168, 070, 118, 128 },
new int[] { 235, 170, 150, 185, 168, 130, 118, 183 },
new int[] { 235, 225, 150, 240, 168, 185, 118, 238 },
new int[] { 425, 060, 342, 075, 358, 018, 310, 073 },
new int[] { 425, 115, 342, 130, 358, 075, 310, 128 },
new int[] { 425, 170, 342, 185, 358, 125, 310, 183 }
// slot 8, Mustache
};
/*
racial arrays are: cliloc_F, cliloc_M, ItemID_F, ItemID_M, gump_img_F, gump_img_M
*/
readonly int[][] HumanArray =
{
new int[] { 0 },
new int[] { 3000340, 3000340, 0, 0, 0, 0 }, // no beard
new int[] { 3000352, 3000352, 0x203E, 0x203E, 0xC671, 0xC671 }, // Long Beard
new int[] { 3000353, 3000353, 0x203F, 0x203F, 0xC672, 0xC672 }, // Short Beard
new int[] { 3000356, 3000356, 0x204C, 0x204C, 0xC675, 0xC675 }, // Long Full Beard
new int[] { 3000355, 3000355, 0x204B, 0x204B, 0xC676, 0xC676 }, // Short Full Beard
new int[] { 3000351, 3000351, 0x2040, 0x2040, 0xC670, 0xC670 }, // Goatee
new int[] { 3000357, 3000357, 0x204D, 0x204D, 0xC677, 0xC677 }, // vandyke
new int[] { 3000354, 3000354, 0x2041, 0x2041, 0xC678, 0xC678 } // mustache
};
readonly int[][] ElvenArray =
{
new int[] { 0 },
new int[] { 3000340, 3000340, 0, 0, 0, 0 }, // no beard
new int[] { 3000352, 3000352, 0x203E, 0x203E, 0xC671, 0xC671 }, // Long Beard
new int[] { 3000353, 3000353, 0x203F, 0x203F, 0xC672, 0xC672 }, // Short Beard
new int[] { 3000356, 3000356, 0x204C, 0x204C, 0xC675, 0xC675 }, // Long Full Beard
new int[] { 3000355, 3000355, 0x204B, 0x204B, 0xC676, 0xC676 }, // Short Full Beard
new int[] { 3000351, 3000351, 0x2040, 0x2040, 0xC670, 0xC670 }, // Goatee
new int[] { 3000357, 3000357, 0x204D, 0x204D, 0xC677, 0xC677 }, // vandyke
new int[] { 3000354, 3000354, 0x2041, 0x2041, 0xC678, 0xC678 } // mustache
};
public InternalGump(Mobile from, BeardRestylingDeed deed)
: base(50, 50)
{
this.m_From = from;
this.m_Deed = deed;
from.CloseGump(typeof(InternalGump));
this.AddBackground(100, 10, 400, 385, 0xA28);
this.AddHtmlLocalized(100, 25, 400, 35, 1013008, false, false);
this.AddButton(175, 340, 0xFA5, 0xFA7, 0x0, GumpButtonType.Reply, 0); // CANCEL
this.AddHtmlLocalized(210, 342, 90, 35, 1011012, false, false);// <CENTER>HAIRSTYLE SELECTION MENU</center>
int[][] RacialData = (from.Race == Race.Human) ? this.HumanArray : this.ElvenArray;
for (int i = 1; i < RacialData.Length; i++)
{
this.AddHtmlLocalized(this.LayoutArray[2], this.LayoutArray[3], (i == 1) ? 125 : 80, (i == 1) ? 70 : 35, (this.m_From.Female) ? RacialData[0] : RacialData[1], false, false);
if (this.LayoutArray[4] != 0)
{
this.AddBackground(this.LayoutArray[0], this.LayoutArray[1], 50, 50, 0xA3C);
this.AddImage(this.LayoutArray[4], this.LayoutArray[5], (this.m_From.Female) ? RacialData[4] : RacialData[5]);
}
this.AddButton(this.LayoutArray[6], this.LayoutArray[7], 0xFA5, 0xFA7, i, GumpButtonType.Reply, 0);
}
}
public override void OnResponse(NetState sender, RelayInfo info)
{
if (this.m_From == null || !this.m_From.Alive)
return;
if (this.m_Deed.Deleted)
return;
if (info.ButtonID < 1 || info.ButtonID > 10)
return;
int[][] RacialData = (this.m_From.Race == Race.Human) ? this.HumanArray : this.ElvenArray;
if (this.m_From is PlayerMobile)
{
PlayerMobile pm = (PlayerMobile)this.m_From;
pm.SetHairMods(-1, -1); // clear any hairmods (disguise kit, incognito)
this.m_From.HairItemID = (this.m_From.Female) ? RacialData[info.ButtonID][2] : RacialData[info.ButtonID][3];
this.m_Deed.Delete();
}
}
}
}
}

Post automatically merged:

FIGURED IT OUT!!! I will be posting it soon ^w^!!!
Post automatically merged:

Yep, definitely working the way I wanted it to! heck yes!!!!
 
Last edited:
Back