Amount");
AddTextField(width / 2 + 20, y, 50, 20, 0x480, 0xBBC, "SkillReq", c_Sign.SkillReq.ToString());
AddButton(width / 2 - 5, y + 5, 0x2716, "Skill", new GumpCallback(Skill));
AddHtml(0, y += 25, width/2-20, "
Min Total");
AddTextField(width / 2 + 20, y, 60, 20, 0x480, 0xBBC, "MinTotalSkill", c_Sign.MinTotalSkill.ToString());
AddButton(width / 2 - 5, y + 5, 0x2716, "Skill", new GumpCallback(Skill));
AddHtml( 0, y+=25, width/2-20, "
Max Total");
AddTextField(width / 2 + 20, y, 60, 20, 0x480, 0xBBC, "MaxTotalSkill", c_Sign.MaxTotalSkill.ToString());
AddButton(width / 2 - 5, y + 5, 0x2716, "Skill", new GumpCallback(Skill));
string helptext = String.Format( " These settings are all optional. If you want to restrict who can own " +
"this home by their skills, here's the place. You can specify by the skill name and value, or by " +
"player's total skills." );
AddHtml( 10, y+=35, width-20, 90, helptext, false, false );
y += 90;
AddHtml( 30, y+=15, 80, "Previous");
AddButton( 10, y, 0x15E3, 0x15E7, "Previous", new GumpStateCallback( ChangePage ), (int)c_Page-1 );
if ( c_Sign.PriceReady )
{
AddHtml( width-60, y, 60, "Next");
AddButton( width-30, y, 0x15E1, 0x15E5, "Next", new GumpStateCallback( ChangePage ), (int)c_Page+1 );
}
}
private void OtherPage(int width, ref int y)
{
AddHtml(0, y += 10, width, "
Other Options");
AddImage(width / 2 - 100, y + 2, 0x39);
AddImage(width / 2 + 70, y + 2, 0x3B);
AddHtml(0, y += 25, width, "Young");
AddButton(width / 2 - 80, y, c_Sign.YoungOnly ? 0xD3 : 0xD2, "Young Only", new GumpCallback(Young));
AddButton(width / 2 + 60, y, c_Sign.YoungOnly ? 0xD3 : 0xD2, "Young Only", new GumpCallback(Young));
if (!c_Sign.YoungOnly)
{
AddHtml(0, y += 25, width, "Innocents");
AddButton(width / 2 - 80, y, c_Sign.Murderers == Intu.No ? 0xD3 : 0xD2, "No Murderers", new GumpStateCallback(Murderers), Intu.No);
AddButton(width / 2 + 60, y, c_Sign.Murderers == Intu.No ? 0xD3 : 0xD2, "No Murderers", new GumpStateCallback(Murderers), Intu.No);
AddHtml(0, y += 20, width, "Murderers");
AddButton(width / 2 - 80, y, c_Sign.Murderers == Intu.Yes ? 0xD3 : 0xD2, "Yes Murderers", new GumpStateCallback(Murderers), Intu.Yes);
AddButton(width / 2 + 60, y, c_Sign.Murderers == Intu.Yes ? 0xD3 : 0xD2, "Yes Murderers", new GumpStateCallback(Murderers), Intu.Yes);
AddHtml(0, y += 20, width, "All");
AddButton(width / 2 - 80, y, c_Sign.Murderers == Intu.Neither ? 0xD3 : 0xD2, "Neither Murderers", new GumpStateCallback(Murderers), Intu.Neither);
AddButton(width / 2 + 60, y, c_Sign.Murderers == Intu.Neither ? 0xD3 : 0xD2, "Neither Murderers", new GumpStateCallback(Murderers), Intu.Neither);
}
AddHtml(0, y += 25, width, "Relock doors on demolish");
AddButton(width / 2 - 110, y, c_Sign.Relock ? 0xD3 : 0xD2, "Relock", new GumpCallback(Relock));
AddButton(width / 2 + 90, y, c_Sign.Relock ? 0xD3 : 0xD2, "Relock", new GumpCallback(Relock));
string helptext = String.Format(" These options are also optional. With the young setting, you can restrict " +
"who can buy the home to young players only. Similarly, you can specify whether murderers or innocents are " +
" allowed to own the home. You can also specify whether the doors within the " +
"home are locked when the owner demolishes their property.");
AddHtml(10, y += 35, width - 20, 180, helptext, false, false);
y += 180;
AddHtml(30, y += 15, 80, "Previous");
AddButton(10, y, 0x15E3, 0x15E7, "Previous", new GumpStateCallback(ChangePage), (int)c_Page - 1);
AddHtml(width - 60, y, 60, "Next");
AddButton(width - 30, y, 0x15E1, 0x15E5, "Next", new GumpStateCallback(ChangePage), (int)c_Page + 1);
}
private void OtherPage2(int width, ref int y)
{
AddHtml(0, y += 10, width, "Other Options 2");
AddImage(width / 2 - 100, y + 2, 0x39);
AddImage(width / 2 + 70, y + 2, 0x3B);
AddHtml(0, y += 25, width, "Force Public");
AddButton(width / 2 - 110, y, c_Sign.ForcePublic ? 0xD3 : 0xD2, "Public", new GumpCallback(ForcePublic));
AddButton(width / 2 + 90, y, c_Sign.ForcePublic ? 0xD3 : 0xD2, "Public", new GumpCallback(ForcePublic));
AddHtml(0, y += 25, width, "Force Private");
AddButton(width / 2 - 110, y, c_Sign.ForcePrivate ? 0xD3 : 0xD2, "Private", new GumpCallback(ForcePrivate));
AddButton(width / 2 + 90, y, c_Sign.ForcePrivate ? 0xD3 : 0xD2, "Private", new GumpCallback(ForcePrivate));
AddHtml(0, y += 25, width, "No Trading");
AddButton(width / 2 - 110, y, c_Sign.NoTrade ? 0xD3 : 0xD2, "NoTrade", new GumpCallback(NoTrade));
AddButton(width / 2 + 90, y, c_Sign.NoTrade ? 0xD3 : 0xD2, "NoTrade", new GumpCallback(NoTrade));
AddHtml(0, y += 25, width, "No Banning");
AddButton(width / 2 - 110, y, c_Sign.NoBanning ? 0xD3 : 0xD2, "NoBan", new GumpCallback(NoBan));
AddButton(width / 2 + 90, y, c_Sign.NoBanning ? 0xD3 : 0xD2, "NoBan", new GumpCallback(NoBan));
string helptext = String.Format(" Another page of optional options! Sometimes houses have features you don't want players using. " +
"So here you can force homes to be private or public. You can also prevent trading of the home. Lastly, you can remove their ability to ban players.");
AddHtml(10, y += 35, width - 20, 180, helptext, false, false);
y += 180;
AddHtml(30, y += 15, 80, "Previous");
AddButton(10, y, 0x15E3, 0x15E7, "Previous", new GumpStateCallback(ChangePage), (int)c_Page - 1);
}
private bool SkillNameExists(string text)
{
try
{
SkillName index = (SkillName)Enum.Parse( typeof( SkillName ), text, true );
return true;
}
catch
{
Owner.SendMessage( "You provided an invalid skill name." );
return false;
}
}
private void ChangePage( object obj )
{
if ( c_Sign == null )
return;
if ( !(obj is int) )
return;
c_Page = (Page)(int)obj;
c_Sign.ClearPreview();
NewGump();
}
private void Name()
{
c_Sign.Name = GetTextField("Name");
Owner.SendMessage("Name set!");
NewGump();
}
private void Goto()
{
Owner.Location = c_Sign.Location;
Owner.Z += 5;
Owner.Map = c_Sign.Map;
NewGump();
}
private void Quick()
{
c_Quick = !c_Quick;
NewGump();
}
private void BanLocSelect()
{
Owner.SendMessage( "Target the ban location." );
Owner.Target = new InternalTarget( this, c_Sign, TargetType.BanLoc );
}
private void SignLocSelect()
{
Owner.SendMessage( "Target the location for the home sign." );
Owner.Target = new InternalTarget( this, c_Sign, TargetType.SignLoc );
}
private void MinZSelect()
{
Owner.SendMessage( "Target the base floor." );
Owner.Target = new InternalTarget( this, c_Sign, TargetType.MinZ );
}
private void MaxZSelect()
{
Owner.SendMessage( "Target the highest floor." );
Owner.Target = new InternalTarget( this, c_Sign, TargetType.MaxZ );
}
private void Young()
{
c_Sign.YoungOnly = !c_Sign.YoungOnly;
NewGump();
}
private void Murderers( object obj )
{
if ( !(obj is Intu) )
return;
c_Sign.Murderers = (Intu)obj;
NewGump();
}
private void Relock()
{
c_Sign.Relock = !c_Sign.Relock;
NewGump();
}
private void ForcePrivate()
{
c_Sign.ForcePrivate = !c_Sign.ForcePrivate;
NewGump();
}
private void ForcePublic()
{
c_Sign.ForcePublic = !c_Sign.ForcePublic;
NewGump();
}
private void NoTrade()
{
c_Sign.NoTrade = !c_Sign.NoTrade;
NewGump();
}
private void NoBan()
{
c_Sign.NoBanning = !c_Sign.NoBanning;
NewGump();
}
private void KeepItems()
{
c_Sign.KeepItems = !c_Sign.KeepItems;
NewGump();
}
private void LeaveItems()
{
c_Sign.LeaveItems = !c_Sign.LeaveItems;
NewGump();
}
private void ItemsPrice()
{
c_Sign.ItemsPrice = GetTextFieldInt("ItemsPrice");
Owner.SendMessage("Item Price set!");
NewGump();
}
private void RecurRent()
{
c_Sign.RecurRent = !c_Sign.RecurRent;
NewGump();
}
private void RentToOwn()
{
c_Sign.RentToOwn = !c_Sign.RentToOwn;
NewGump();
}
private void Skill()
{
if (GetTextField("Skill") != "" && SkillNameExists(GetTextField("Skill")))
c_Sign.Skill = GetTextField("Skill");
else
c_Sign.Skill = "";
c_Sign.SkillReq = GetTextFieldInt("SkillReq");
c_Sign.MinTotalSkill = GetTextFieldInt("MinTotalSkill");
c_Sign.MaxTotalSkill = GetTextFieldInt("MaxTotalSkill");
Owner.SendMessage("Skill info set!");
NewGump();
}
private void Claim()
{
new TownHouseConfirmGump( Owner, c_Sign );
OnClose();
}
private void SuggestLocSec()
{
int price = c_Sign.CalcVolume()*General.SuggestionFactor;
c_Sign.Secures = price/75;
c_Sign.Locks = c_Sign.Secures/2;
NewGump();
}
private void Secures()
{
c_Sign.Secures = GetTextFieldInt("Secures");
Owner.SendMessage("Secures set!");
NewGump();
}
private void Lockdowns()
{
c_Sign.Locks = GetTextFieldInt("Lockdowns");
Owner.SendMessage("Lockdowns set!");
NewGump();
}
private void SuggestPrice()
{
c_Sign.Price = c_Sign.CalcVolume()*General.SuggestionFactor;
if ( c_Sign.RentByTime == TimeSpan.FromDays( 1 ) )
c_Sign.Price /= 60;
if ( c_Sign.RentByTime == TimeSpan.FromDays( 7 ) )
c_Sign.Price = (int)((double)c_Sign.Price/8.57);
if ( c_Sign.RentByTime == TimeSpan.FromDays( 30 ) )
c_Sign.Price /= 2;
NewGump();
}
private void Price()
{
c_Sign.Price = GetTextFieldInt("Price");
Owner.SendMessage("Price set!");
NewGump();
}
private void Free()
{
c_Sign.Free = !c_Sign.Free;
NewGump();
}
private void AddBlock()
{
if ( c_Sign == null )
return;
Owner.SendMessage( "Target the north western corner." );
Owner.Target = new InternalTarget( this, c_Sign, TargetType.BlockOne );
}
private void ClearAll()
{
if ( c_Sign == null )
return;
c_Sign.Blocks.Clear();
c_Sign.ClearPreview();
c_Sign.UpdateBlocks();
NewGump();
}
private void PriceUp()
{
c_Sign.NextPriceType();
NewGump();
}
private void PriceDown()
{
c_Sign.PrevPriceType();
NewGump();
}
protected override void OnClose()
{
c_Sign.ClearPreview();
}
private class InternalTarget : Target
{
private TownHouseSetupGump c_Gump;
private TownHouseSign c_Sign;
private TargetType c_Type;
private Point3D c_BoundOne;
public InternalTarget( TownHouseSetupGump gump, TownHouseSign sign, TargetType type ) : this( gump, sign, type, Point3D.Zero ){}
public InternalTarget( TownHouseSetupGump gump, TownHouseSign sign, TargetType type, Point3D point ) : base( 20, true, TargetFlags.None )
{
c_Gump = gump;
c_Sign = sign;
c_Type = type;
c_BoundOne = point;
}
protected override void OnTarget( Mobile m, object o )
{
IPoint3D point = (IPoint3D)o;
switch( c_Type )
{
case TargetType.BanLoc:
c_Sign.BanLoc = new Point3D( point.X, point.Y, point.Z );
c_Gump.NewGump();
break;
case TargetType.SignLoc:
c_Sign.SignLoc = new Point3D( point.X, point.Y, point.Z );
c_Sign.MoveToWorld(c_Sign.SignLoc, c_Sign.Map);
c_Sign.Z -= 5;
c_Sign.ShowSignPreview();
c_Gump.NewGump();
break;
case TargetType.MinZ:
c_Sign.MinZ = point.Z;
if ( c_Sign.MaxZ < c_Sign.MinZ+19 )
c_Sign.MaxZ = point.Z+19;
if ( c_Sign.MaxZ == short.MaxValue )
c_Sign.MaxZ = point.Z+19;
c_Gump.NewGump();
break;
case TargetType.MaxZ:
c_Sign.MaxZ = point.Z+19;
if ( c_Sign.MinZ > c_Sign.MaxZ )
c_Sign.MinZ = point.Z;
c_Gump.NewGump();
break;
case TargetType.BlockOne:
m.SendMessage( "Now target the south eastern corner." );
m.Target = new InternalTarget( c_Gump, c_Sign, TargetType.BlockTwo, new Point3D( point.X, point.Y, point.Z ) );
break;
case TargetType.BlockTwo:
c_Sign.Blocks.Add( FixRect( new Rectangle2D( c_BoundOne, new Point3D( point.X+1, point.Y+1, point.Z ) ) ) );
c_Sign.UpdateBlocks();
c_Sign.ShowAreaPreview(m);
c_Gump.NewGump();
break;
}
}
protected override void OnTargetCancel( Mobile m, TargetCancelType cancelType )
{
c_Gump.NewGump();
}
}
}
}