fix: Adds static warning/notice gumps. (#1741)

### Summary
* Adds `StaticNoticeGump<T>` and `StaticWarningGump<T>`
* Converts NoticeGump/WarningGump to use `DynamicGump`
* Changes various uses of notice gump and warning gump to their static counterpart.
This commit is contained in:
Kamron Batman 2024-04-26 17:19:16 -07:00 committed by GitHub
parent 65532ea887
commit bb7bc57e42
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 713 additions and 430 deletions

View file

@ -36,18 +36,7 @@ public static class AssistantHandler
if (AssistantConfiguration.Settings.WarnOnFailure)
{
var warningGump = new WarningGump(
1060635,
30720,
AssistantConfiguration.Settings.WarningMessage,
0xFFC000,
420,
250,
null,
false
);
m.SendGump(warningGump);
m.SendGump(new AssistantFailureWarningGump());
}
if (isPlayer)
@ -154,4 +143,15 @@ public static class AssistantHandler
ns.Send(writer.Span);
}
private class AssistantFailureWarningGump : StaticWarningGump<AssistantFailureWarningGump>
{
private static readonly TextDefinition _warningMessage = AssistantConfiguration.Settings.WarningMessage;
public override int StaticLocalizedContent => _warningMessage?.Number ?? 0;
public override string Content => _warningMessage.String;
public override int Width => 420;
public override int Height => 250;
public override bool CancelButton => false;
}
}

View file

@ -284,13 +284,8 @@ namespace Server.Commands.Generic
}
mob.SendGump(
new WarningGump(
1060637,
30720,
$"A game master is requesting to open your web browser to the following URL:<br>{url}",
0xFFC000,
320,
240,
new OpenBrowserWarningGump(
url,
okay => OpenBrowser_Callback(mob, okay, from, url, echo)
)
);
@ -307,6 +302,16 @@ namespace Server.Commands.Generic
}
}
private class OpenBrowserWarningGump : StaticWarningGump<OpenBrowserWarningGump>
{
public override string Content { get; }
public override int Width => 320;
public override int Height => 240;
public OpenBrowserWarningGump(string url, Action<bool> callback) : base(callback) =>
Content = $"A game master is requesting to open your web browser to the following URL:<br>{url}";
}
public override void Execute(CommandEventArgs e, object obj)
{
Execute(e, obj, true);
@ -912,15 +917,7 @@ namespace Server.Commands.Generic
{
var from = e.Mobile;
from.SendGump(
new WarningGump(
1060637,
30720,
$"You are about to delete {list.Count} objects. This cannot be undone without a full server revert.<br><br>Continue?",
0xFFC000,
420,
280,
okay => OnConfirmCallback(from, okay, e, list)
)
new DeleteObjectsNoticeGump(list.Count, okay => OnConfirmCallback(from, okay, e, list))
);
AddResponse("Awaiting confirmation...");
}
@ -930,6 +927,16 @@ namespace Server.Commands.Generic
}
}
private class DeleteObjectsNoticeGump : StaticWarningGump<DeleteObjectsNoticeGump>
{
public override int Width => 420;
public override int Height => 280;
public override string Content { get; }
public DeleteObjectsNoticeGump(int count, Action<bool> callback) : base(callback) =>
Content = $"You are about to delete {count} objects. This cannot be undone without a full server revert.<br><br>Continue?";
}
public override void Execute(CommandEventArgs e, object obj)
{
if (obj is Item item)

View file

@ -1,3 +1,4 @@
using System;
using System.Collections.Generic;
using Server.Gumps;
using Server.Items;
@ -87,19 +88,24 @@ namespace Server.Commands.Generic
{
var from = e.Mobile;
from.SendGump(
new WarningGump(
1060637,
30720,
$"You are about to insert {list.Count} objects. This cannot be undone without a full server revert.<br><br>Continue?",
0xFFC000,
420,
280,
new InsertObjectsNoticeGump(
list.Count,
okay => OnConfirmCallback(from, okay, list, e.Length < 1 || !e.GetBoolean(0))
)
);
AddResponse("Awaiting confirmation...");
}
private class InsertObjectsNoticeGump : StaticWarningGump<InsertObjectsNoticeGump>
{
public override int Width => 420;
public override int Height => 280;
public override string Content { get; }
public InsertObjectsNoticeGump(int count, Action<bool> callback) : base(callback) =>
Content = $"You are about to insert {count} objects. This cannot be undone without a full server revert.<br><br>Continue?";
}
private void OnConfirmCallback(Mobile from, bool okay, List<object> list, bool staticsOnly)
{
var flushToLog = false;

View file

@ -251,13 +251,8 @@ namespace Server.Commands
);
from.SendGump(
new WarningGump(
1060635,
30720,
$"You are about to delete {list.Count} object{(list.Count == 1 ? "" : "s")} from this facet. Do you really wish to continue?",
0xFFC000,
360,
260,
new DeleteObjectsNoticeGump(
list.Count,
okay => DeleteList_Callback(from, okay, list)
)
);
@ -268,6 +263,17 @@ namespace Server.Commands
}
}
private class DeleteObjectsNoticeGump : StaticWarningGump<DeleteObjectsNoticeGump>
{
public override int Header => 1060635; // <CENTER>WARNING</CENTER>
public override int Width => 360;
public override int Height => 260;
public override string Content { get; }
public DeleteObjectsNoticeGump(int count, Action<bool> callback) : base(callback) =>
Content = $"You are about to delete {count} object{(count == 1 ? "" : "s")} from this facet. Do you really wish to continue?";
}
[Usage("GetFollowers")]
[Description("Teleports all pets of a targeted player to your location.")]
public static void GetFollowers_OnCommand(CommandEventArgs e)

View file

@ -1767,13 +1767,8 @@ namespace Server.Gumps
}
from.SendGump(
new NoticeGump(
1060637,
30720,
new AdminNoticeGump(
$"You have {(ban ? "banned" : "deleted")} the account{(rads.Count == 1 ? "" : "s")}.",
0xFFC000,
420,
280,
() => ResendGump_Callback(from, list, rads, ban ? page : 0)
)
);
@ -1786,13 +1781,8 @@ namespace Server.Gumps
else
{
from.SendGump(
new NoticeGump(
1060637,
30720,
new AdminNoticeGump(
$"You have chosen not to {(ban ? "ban" : "delete")} the account{(rads.Count == 1 ? "" : "s")}.",
0xFFC000,
420,
280,
() => ResendGump_Callback(from, list, rads, page)
)
);
@ -3049,10 +3039,7 @@ namespace Server.Gumps
from.SendGump(
new WarningGump(
1060635,
30720,
sb.ToString(),
0xFFC000,
420,
400,
okay => BanShared_Callback(from, okay, a)
@ -3099,10 +3086,7 @@ namespace Server.Gumps
{
from.SendGump(
new WarningGump(
1060635,
30720,
$"You are about to firewall {a.LoginIPs.Length} address{(a.LoginIPs.Length != 1 ? "s" : "")}. Do you wish to continue?",
0xFFC000,
420,
400,
okay => FirewallShared_Callback(from, okay, a)
@ -3237,10 +3221,7 @@ namespace Server.Gumps
from.SendGump(
new WarningGump(
1060635,
30720,
$"<center>Account of {a.Username}</center><br>You are about to <em><basefont color=red>permanently delete</basefont></em> the account. Likewise, all characters on the account will be deleted, including equipped, inventory, and banked items. Any houses tied to the account will be demolished.<br><br>Do you wish to continue?",
0xFFC000,
420,
280,
okay => AccountDelete_Callback(from, okay, a)
@ -3266,10 +3247,7 @@ namespace Server.Gumps
{
from.SendGump(
new WarningGump(
1060635,
30720,
$"You are about to ban {rads.Count} marked account{(rads.Count == 1 ? "" : "s")}. Be cautioned, the only way to reverse this is by hand--manually unbanning each account.<br><br>Do you wish to continue?",
0xFFC000,
420,
280,
okay => Marked_Callback(from, okay, true, list, rads, m_ListPage)
@ -3279,13 +3257,8 @@ namespace Server.Gumps
else
{
from.SendGump(
new NoticeGump(
1060637,
30720,
new AdminNoticeGump(
"You have not yet marked any accounts. Place a check mark next to the accounts you wish to ban and then try again.",
0xFFC000,
420,
280,
() => ResendGump_Callback(from, list, rads, m_ListPage)
)
);
@ -3306,14 +3279,7 @@ namespace Server.Gumps
{
from.SendGump(
new WarningGump(
1060635,
30720,
string.Format(
"You are about to <em><basefont color=red>permanently delete</basefont></em> {0} marked account{1}. Likewise, all characters on the account{1} will be deleted, including equipped, inventory, and banked items. Any houses tied to the account{1} will be demolished.<br><br>Do you wish to continue?",
rads.Count,
rads.Count == 1 ? "" : "s"
),
0xFFC000,
$"You are about to <em><basefont color=red>permanently delete</basefont></em> {rads.Count} marked account{(rads.Count == 1 ? "" : "s")}. Likewise, all characters on the account{(rads.Count == 1 ? "" : "s")} will be deleted, including equipped, inventory, and banked items. Any houses tied to the account{(rads.Count == 1 ? "" : "s")} will be demolished.<br><br>Do you wish to continue?",
420,
280,
okay => Marked_Callback(from, okay, false, list, rads, m_ListPage)
@ -3323,13 +3289,8 @@ namespace Server.Gumps
else
{
from.SendGump(
new NoticeGump(
1060637,
30720,
new AdminNoticeGump(
"You have not yet marked any accounts. Place a check mark next to the accounts you wish to ban and then try again.",
0xFFC000,
420,
280,
() => ResendGump_Callback(from, list, rads, m_ListPage)
)
);
@ -3554,10 +3515,7 @@ namespace Server.Gumps
{
from.SendGump(
new WarningGump(
1060635,
30720,
$"You are about to clear the address list for account {a} containing {ips.Length} {(ips.Length == 1 ? "entry" : "entries")}. Do you wish to continue?",
0xFFC000,
420,
280,
okay => RemoveLoginIPs_Callback(from, okay, a)
@ -3998,10 +3956,7 @@ namespace Server.Gumps
{
from.SendGump(
new WarningGump(
1060635,
30720,
$"You are about to firewall {m_List[index]}. All connection attempts from a matching IP will be refused. Are you sure?",
0xFFC000,
420,
280,
okay => Firewall_Callback(from, okay, a, m_List[index])
@ -4100,10 +4055,7 @@ namespace Server.Gumps
from.SendGump(
new WarningGump(
1060635,
30720,
$"You are about to remove address {ip} from account {a}. Do you wish to continue?",
0xFFC000,
420,
280,
okay => RemoveLoginIP_Callback(from, okay, a, ip)
@ -4395,5 +4347,15 @@ namespace Server.Gumps
return aLevel < bLevel ? 1 : x.Username.InsensitiveCompare(y.Username);
}
}
private class AdminNoticeGump : StaticNoticeGump<AdminNoticeGump>
{
public override int Width => 420;
public override int Height => 280;
public override string Content { get; }
public AdminNoticeGump(string content, Action callback) : base(callback) => Content = content;
}
}
}

View file

@ -903,7 +903,7 @@ namespace Server.Gumps
* These containers can be used to re-create the vendor in a new location.
* Any barkeepers have been converted into deeds.
*/
from.SendGump(new NoticeGump(1060637, 30720, 1060012, 32512, 420, 280));
from.SendGump(new ReplaceHouseNoticeGump());
return;
}
}
@ -1107,13 +1107,7 @@ namespace Server.Gumps
if (isOwner)
{
from.SendGump(
new WarningGump(
1060635,
30720,
1060736,
32512,
420,
280,
new RemoveAllCoOwnersWarningGump(
okay => ClearCoOwners_Callback(from, okay, m_House)
)
);
@ -1153,13 +1147,7 @@ namespace Server.Gumps
if (isCoOwner)
{
from.SendGump(
new WarningGump(
1060635,
30720,
1018039,
32512,
420,
280,
new RemoveAllFriendsWarningGump(
okay => ClearFriends_Callback(from, okay, m_House)
)
);
@ -1176,15 +1164,7 @@ namespace Server.Gumps
case 9: // Clear Ban List
{
from.SendGump(
new WarningGump(
1060635,
30720,
1060753,
32512,
420,
280,
okay => ClearBans_Callback(from, okay, m_House)
)
new LifeAllBansWarningGump(okay => ClearBans_Callback(from, okay, m_House))
);
break;
@ -1198,15 +1178,7 @@ namespace Server.Gumps
case 11: // Clear Access List
{
from.SendGump(
new WarningGump(
1060635,
30720,
1061842,
32512,
420,
280,
okay => ClearAccess_Callback(from, okay, m_House)
)
new RevokeAccessWarning(okay => ClearAccess_Callback(from, okay, m_House))
);
break;
@ -1217,15 +1189,8 @@ namespace Server.Gumps
{
if (m_House.PlayerVendors.Count > 0)
{
// You have vendors working out of this building. It cannot be declared private until there are no vendors in place.
from.SendGump(
new NoticeGump(
1060637,
30720,
501887,
32512,
320,
180,
new CannotConvertPrivateNoticeGump(
() => PublicPrivateNotice_Callback(from, m_House)
)
);
@ -1234,15 +1199,8 @@ namespace Server.Gumps
if (m_House.VendorRentalContracts.Count > 0)
{
// You cannot currently take this action because you have vendor contracts locked down in your home. You must remove them first.
from.SendGump(
new NoticeGump(
1060637,
30720,
1062351,
32512,
320,
180,
new CannotPerformActionContractsNoticeGump(
() => PublicPrivateNotice_Callback(from, m_House)
)
);
@ -1253,15 +1211,8 @@ namespace Server.Gumps
m_House.ChangeLocks(from);
// This house is now private.
from.SendGump(
new NoticeGump(
1060637,
30720,
501888,
32512,
320,
180,
new HouseConvertedPrivateNoticeGump(
() => PublicPrivateNotice_Callback(from, m_House)
)
);
@ -1294,13 +1245,7 @@ namespace Server.Gumps
if (BaseHouse.NewVendorSystem)
{
from.SendGump(
new NoticeGump(
1060637,
30720,
501886,
32512,
320,
180,
new HouseConvertedPublicNoticeGump(
() => PublicPrivateNotice_Callback(from, m_House)
)
);
@ -1308,13 +1253,7 @@ namespace Server.Gumps
else
{
from.SendGump(
new NoticeGump(
1060637,
30720,
"This house is now public. Friends of the house may now have vendors working out of this building.",
0xF8C000,
320,
180,
new HouseConvertedPublicOldSystemNoticeGump(
() => PublicPrivateNotice_Callback(from, m_House)
)
);
@ -1350,37 +1289,19 @@ namespace Server.Gumps
{
if (m_House.HasRentedVendors)
{
// You cannot perform this action while you still have vendors rented out in this house.
from.SendGump(
new NoticeGump(
1060637,
30720,
1062395,
32512,
320,
180,
new CannotPerformActionVendorsNoticeGump(
() => CustomizeNotice_Callback(from, m_House)
)
);
}
else
else if (m_House.ConvertEntry != null)
{
var e = m_House.ConvertEntry;
if (e != null)
{
from.SendGump(
new WarningGump(
1060635,
30720,
1060013,
32512,
420,
280,
okay => ConvertHouse_Callback(from, okay, m_House)
)
);
}
from.SendGump(
new ConvertToCustomHouseWarningGump(
okay => ConvertHouse_Callback(from, okay, m_House)
)
);
}
}
@ -1393,13 +1314,7 @@ namespace Server.Gumps
if (m_House.HasRentedVendors)
{
from.SendGump(
new NoticeGump(
1060637,
30720,
1062395,
32512,
320,
180,
new CannotPerformActionVendorsNoticeGump(
() => CustomizeNotice_Callback(from, m_House)
)
);
@ -1407,13 +1322,7 @@ namespace Server.Gumps
else if (m_House.HasAddonContainers)
{
from.SendGump(
new NoticeGump(
1060637,
30720,
1074863,
32512,
320,
180,
new CannotCustomizeAddonsNoticeGump(
() => CustomizeNotice_Callback(from, m_House)
)
);
@ -1739,5 +1648,202 @@ namespace Server.Gumps
}
}
}
private class RemoveAllCoOwnersWarningGump : StaticWarningGump<RemoveAllCoOwnersWarningGump>
{
public override int Width => 420;
public override int Height => 280;
// You are about to remove ALL co-owners from your house. Are you certain you wish to clear the co-owner list?
public override int StaticLocalizedContent => 1060736;
public RemoveAllCoOwnersWarningGump(Action<bool> callback) : base(callback)
{
}
}
private class RemoveAllFriendsWarningGump : StaticWarningGump<RemoveAllFriendsWarningGump>
{
public override int Width => 420;
public override int Height => 280;
/*
* If you go ahead with this option, all of the current friendships will be removed from the house,
* and any vendors associated with said friends will be made unwelcome. Are you sure you want to do this?
*/
public override int StaticLocalizedContent => 1018039;
public RemoveAllFriendsWarningGump(Action<bool> callback) : base(callback)
{
}
}
private class LifeAllBansWarningGump : StaticWarningGump<LifeAllBansWarningGump>
{
public override int Width => 420;
public override int Height => 280;
// You are about to lift all bans for this house. Are you sure you wish to do this?
public override int StaticLocalizedContent => 1060753;
public LifeAllBansWarningGump(Action<bool> callback) : base(callback)
{
}
}
private class RevokeAccessWarning : StaticWarningGump<RevokeAccessWarning>
{
public override int Width => 420;
public override int Height => 280;
/*
* This will revoke access from everyone on this list and immediately eject them from the house.
* Those players will no longer be able to enter the house.
* Are you sure you wish to clear the house access list?
*/
public override int StaticLocalizedContent => 1061842;
public RevokeAccessWarning(Action<bool> callback) : base(callback)
{
}
}
private class ConvertToCustomHouseWarningGump : StaticWarningGump<ConvertToCustomHouseWarningGump>
{
public override int Width => 420;
public override int Height => 280;
/*
* You are about to turn your house into a customizable house.
* You will be refunded or charged the value of this house minus the cost of the equivalent customizable dirt lot.
* All of your possessions in the house will be transported to a Moving Crate.
* Deed-based house add-ons will be converted back into deeds.
* Vendors and barkeeps will also be stored in the Moving Crate.
* Your house will be leveled to its foundation, and you will be able to build new walls, windows, doors, and stairs.
* Are you sure you wish to continue?
*/
public override int StaticLocalizedContent => 1060013;
public ConvertToCustomHouseWarningGump(Action<bool> callback) : base(callback)
{
}
}
private class CannotPerformActionVendorsNoticeGump : StaticNoticeGump<CannotPerformActionVendorsNoticeGump>
{
public override int Width => 320;
public override int Height => 180;
// You cannot perform this action while you still have vendors rented out in this house.
public override int StaticLocalizedContent => 1062395;
public CannotPerformActionVendorsNoticeGump(Action callback) : base(callback)
{
}
}
private class CannotPerformActionContractsNoticeGump : StaticNoticeGump<CannotPerformActionContractsNoticeGump>
{
public override int Width => 320;
public override int Height => 180;
/*
* You cannot currently take this action because you have vendor contracts locked down in your home.
* You must remove them first.
*/
public override int StaticLocalizedContent => 1062351;
public CannotPerformActionContractsNoticeGump(Action callback) : base(callback)
{
}
}
private class CannotCustomizeAddonsNoticeGump : StaticNoticeGump<CannotCustomizeAddonsNoticeGump>
{
public override int Width => 320;
public override int Height => 180;
/*
* The house cannot be customized when certain special house add-ons including aquariums, raised garden beds,
* and special temporary add-ons are present in the house.
* Please re-deed the special add-ons before customizing the house.
*/
public override int StaticLocalizedContent => 1074863;
public CannotCustomizeAddonsNoticeGump(Action callback) : base(callback)
{
}
}
private class ReplaceHouseNoticeGump : StaticNoticeGump<ReplaceHouseNoticeGump>
{
public override int Width => 420;
public override int Height => 280;
/*
* You have successfully replaced your original house with a new house.
* The value of the replaced house has been deposited into your bank box.
* All of the items in your original house have been relocated to a Moving Crate in the new house.
* Any deed-based house add-ons have been converted back into deeds.
* Vendors and barkeeps in the house, if any, have been stored in the Moving Crate as well.
* Use the <B>Get Vendor</B> context-sensitive menu option on your character to retrieve them.
* These containers can be used to re-create the vendor in a new location.
* Any barkeepers have been converted into deeds.
*/
public override int StaticLocalizedContent => 1060012;
}
private class HouseConvertedPublicNoticeGump : StaticNoticeGump<HouseConvertedPublicNoticeGump>
{
public override int Width => 320;
public override int Height => 180;
// This house is now public. The owner may now place vendors and vendor rental contracts.
public override int StaticLocalizedContent => 501886;
public HouseConvertedPublicNoticeGump(Action callback) : base(callback)
{
}
}
private class CannotConvertPrivateNoticeGump : StaticNoticeGump<CannotConvertPrivateNoticeGump>
{
public override int Width => 320;
public override int Height => 180;
/*
* You have vendors working out of this building.
* It cannot be declared private until there are no vendors in place.
*/
public override int StaticLocalizedContent => 501887;
public CannotConvertPrivateNoticeGump(Action callback) : base(callback)
{
}
}
private class HouseConvertedPrivateNoticeGump : StaticNoticeGump<HouseConvertedPrivateNoticeGump>
{
public override int Width => 320;
public override int Height => 180;
public override int StaticLocalizedContent => 501888; // This house is now private.
public HouseConvertedPrivateNoticeGump(Action callback) : base(callback)
{
}
}
private class HouseConvertedPublicOldSystemNoticeGump : StaticNoticeGump<HouseConvertedPublicOldSystemNoticeGump>
{
public override int Width => 320;
public override int Height => 180;
public override string Content { get; }
public HouseConvertedPublicOldSystemNoticeGump(Action callback) : base(callback) =>
Content =
"This house is now public. Friends of the house may now have vendors working out of this building.";
}
}
}

View file

@ -1,65 +1,37 @@
using Server.Network;
using System;
namespace Server.Gumps
namespace Server.Gumps;
public class NoticeGump : WarningGump
{
public delegate void NoticeGumpCallback();
public class NoticeGump : Gump
public NoticeGump(
TextDefinition content, int width, int height,
Action callback = null
) : this(
1060637, // <CENTER>NOTICE</CENTER>
0x7800,
content,
0xFFC000,
width,
height,
callback
)
{
private readonly NoticeGumpCallback m_Callback;
}
public NoticeGump(
int header, int headerColor, TextDefinition content, int contentColor, int width, int height,
NoticeGumpCallback callback = null
) : base((640 - width) / 2, (480 - height) / 2)
{
m_Callback = callback;
Closable = false;
AddPage(0);
AddBackground(0, 0, width, height, 5054);
AddImageTiled(10, 10, width - 20, 20, 2624);
AddAlphaRegion(10, 10, width - 20, 20);
AddHtmlLocalized(10, 10, width - 20, 20, header, headerColor);
AddImageTiled(10, 40, width - 20, height - 80, 2624);
AddAlphaRegion(10, 40, width - 20, height - 80);
if (content != null)
{
if (content.Number > 0)
{
AddHtmlLocalized(10, 40, width - 20, height - 80, content.Number, contentColor, false, true);
}
else
{
AddHtml(
10,
40,
width - 20,
height - 80,
$"<BASEFONT COLOR=#{contentColor:X6}>{content.String}</BASEFONT>",
false,
true
);
}
}
AddImageTiled(10, height - 30, width - 20, 20, 2624);
AddAlphaRegion(10, height - 30, width - 20, 20);
AddButton(10, height - 30, 4005, 4007, 1);
AddHtmlLocalized(40, height - 30, 120, 20, 1011036, 32767); // OKAY
}
public override void OnResponse(NetState sender, in RelayInfo info)
{
if (info.ButtonID == 1)
{
m_Callback?.Invoke();
}
}
public NoticeGump(
int header, int headerColor, TextDefinition content, int contentColor, int width, int height,
Action callback = null
) : base(
header,
headerColor,
content,
contentColor,
width,
height,
callback != null ? _ => callback() : null,
false
)
{
}
}

View file

@ -0,0 +1,13 @@
using System;
namespace Server.Gumps;
public abstract class StaticNoticeGump<T> : StaticWarningGump<T> where T : StaticNoticeGump<T>
{
public override int Header => 1060637; // <CENTER>NOTICE</CENTER>
public sealed override bool CancelButton => false;
public StaticNoticeGump(Action callback = null) : base(callback != null ? _ => callback() : null)
{
}
}

View file

@ -0,0 +1,95 @@
using System;
using Server.Network;
namespace Server.Gumps;
public abstract class StaticWarningGump<T> : StaticGump<T> where T : StaticWarningGump<T>
{
public virtual int Header => 1060635; // <CENTER>WARNING</CENTER>
public virtual int HeaderColor => 0x7800;
public virtual int ContentColor => StaticLocalizedContent > 0 ? 0x7F00 : 0xFFC000;
public abstract int Width { get; }
public abstract int Height { get; }
public virtual bool CancelButton => true;
// If this is overridden, then the content will be localized and cached.
public virtual int StaticLocalizedContent => 0;
public virtual string Content => null;
private readonly Action<bool> _callback;
public StaticWarningGump(Action<bool> callback = null) : base(0, 0)
{
_callback = callback;
X = (640 - Width) / 2;
Y = (480 - Height) / 2;
}
protected override void BuildLayout(ref StaticGumpBuilder builder)
{
var width = Width;
var height = Height;
var header = Header;
var headerColor = HeaderColor;
var cancelButton = CancelButton;
builder.SetNoClose();
builder.AddPage();
builder.AddBackground(0, 0, width, height, 5054);
builder.AddImageTiled(10, 10, width - 20, 20, 2624);
builder.AddAlphaRegion(10, 10, width - 20, 20);
builder.AddHtmlLocalized(10, 10, width - 20, 20, header, (short)headerColor);
builder.AddImageTiled(10, 40, width - 20, height - 80, 2624);
builder.AddAlphaRegion(10, 40, width - 20, height - 80);
if (StaticLocalizedContent > 0)
{
builder.AddHtmlLocalized(
10,
40,
width - 20,
height - 80,
StaticLocalizedContent,
(short)ContentColor,
false,
true
);
}
else
{
builder.AddHtmlPlaceholder(
10,
40,
width - 20,
height - 80,
"content",
false,
true
);
}
builder.AddImageTiled(10, height - 30, width - 20, 20, 2624);
builder.AddAlphaRegion(10, height - 30, width - 20, 20);
builder.AddButton(10, height - 30, 4005, 4007, 1);
builder.AddHtmlLocalized(40, height - 30, 170, 20, 1011036, 32767); // OKAY
if (cancelButton)
{
builder.AddButton(10 + (width - 20) / 2, height - 30, 4005, 4007, 0);
builder.AddHtmlLocalized(40 + (width - 20) / 2, height - 30, 170, 20, 1011012, 32767); // CANCEL
}
}
protected sealed override void BuildStrings(ref GumpStringsBuilder builder)
{
builder.SetStringSlot("content", $"<BASEFONT COLOR=#{ContentColor:X6}>{Content}</BASEFONT>");
}
public override void OnResponse(NetState sender, in RelayInfo info) => _callback?.Invoke(info.ButtonID == 1);
}

View file

@ -1,66 +1,97 @@
using System;
using Server.Network;
namespace Server.Gumps
namespace Server.Gumps;
public class WarningGump : DynamicGump
{
public delegate void WarningGumpCallback(bool okay);
private readonly int _header;
private readonly int _headerColor;
private readonly int _contentColor;
private readonly int _width;
private readonly int _height;
private readonly bool _cancelButton;
private readonly TextDefinition _content;
private readonly Action<bool> _callback;
public class WarningGump : Gump
public WarningGump(
TextDefinition content, int width, int height,
Action<bool> callback = null, bool cancelButton = true
) : this(
1060635, // <CENTER>WARNING</CENTER>
0x7800,
content,
0xFFC000,
width,
height,
callback,
cancelButton
)
{
private readonly WarningGumpCallback m_Callback;
}
public WarningGump(
int header, int headerColor, TextDefinition content, int contentColor, int width, int height,
WarningGumpCallback callback = null, bool cancelButton = true
) : base((640 - width) / 2, (480 - height) / 2)
public WarningGump(
int header, int headerColor, TextDefinition content, int contentColor, int width, int height,
Action<bool> callback = null, bool cancelButton = true
) : base((640 - width) / 2, (480 - height) / 2)
{
_header = header;
_headerColor = headerColor;
_content = content;
_contentColor = contentColor;
_width = width;
_height = height;
_cancelButton = cancelButton;
_callback = callback;
}
protected sealed override void BuildLayout(ref DynamicGumpBuilder builder)
{
builder.SetNoClose();
builder.AddPage();
builder.AddBackground(0, 0, _width, _height, 5054);
builder.AddImageTiled(10, 10, _width - 20, 20, 2624);
builder.AddAlphaRegion(10, 10, _width - 20, 20);
builder.AddHtmlLocalized(10, 10, _width - 20, 20, _header, (short)_headerColor);
builder.AddImageTiled(10, 40, _width - 20, _height - 80, 2624);
builder.AddAlphaRegion(10, 40, _width - 20, _height - 80);
if (_content != null)
{
m_Callback = callback;
Closable = false;
AddPage(0);
AddBackground(0, 0, width, height, 5054);
AddImageTiled(10, 10, width - 20, 20, 2624);
AddAlphaRegion(10, 10, width - 20, 20);
AddHtmlLocalized(10, 10, width - 20, 20, header, headerColor);
AddImageTiled(10, 40, width - 20, height - 80, 2624);
AddAlphaRegion(10, 40, width - 20, height - 80);
if (content != null)
if (_content.Number > 0)
{
if (content.Number > 0)
{
AddHtmlLocalized(10, 40, width - 20, height - 80, content.Number, contentColor, false, true);
}
else
{
AddHtml(
10,
40,
width - 20,
height - 80,
$"<BASEFONT COLOR=#{contentColor:X6}>{content.String}</BASEFONT>",
false,
true
);
}
builder.AddHtmlLocalized(10, 40, _width - 20, _height - 80, _content.Number, (short)_contentColor, false, true);
}
AddImageTiled(10, height - 30, width - 20, 20, 2624);
AddAlphaRegion(10, height - 30, width - 20, 20);
AddButton(10, height - 30, 4005, 4007, 1);
AddHtmlLocalized(40, height - 30, 170, 20, 1011036, 32767); // OKAY
if (cancelButton)
else
{
AddButton(10 + (width - 20) / 2, height - 30, 4005, 4007, 0);
AddHtmlLocalized(40 + (width - 20) / 2, height - 30, 170, 20, 1011012, 32767); // CANCEL
builder.AddHtml(
10,
40,
_width - 20,
_height - 80,
$"<BASEFONT COLOR=#{_contentColor:X6}>{_content.String}</BASEFONT>",
false,
true
);
}
}
public override void OnResponse(NetState sender, in RelayInfo info) => m_Callback?.Invoke(info.ButtonID == 1);
builder.AddImageTiled(10, _height - 30, _width - 20, 20, 2624);
builder.AddAlphaRegion(10, _height - 30, _width - 20, 20);
builder.AddButton(10, _height - 30, 4005, 4007, 1);
builder.AddHtmlLocalized(40, _height - 30, 170, 20, 1011036, 0x7FFF); // OKAY
if (_cancelButton)
{
builder.AddButton(10 + (_width - 20) / 2, _height - 30, 4005, 4007, 0);
builder.AddHtmlLocalized(40 + (_width - 20) / 2, _height - 30, 170, 20, 1011012, 32767); // CANCEL
}
}
public override void OnResponse(NetState sender, in RelayInfo info) => _callback?.Invoke(info.ButtonID == 1);
}

View file

@ -63,10 +63,10 @@ public class HouseRaffleManagementGump : Gump
AddHtml(10, 10, 598, 20, Color(Center("Raffle Management"), LabelColor));
AddHtml(45, 35, 100, 20, Color("Location:", LabelColor));
AddHtml(145, 35, 250, 20, Color(_stone.FormatLocation(), LabelColor));
AddHtml(145, 35, 250, 20, Color(HouseRaffleStone.FormatLocation(stone.PlotBounds, stone.GetPlotCenter(), stone.PlotFacet), LabelColor));
AddHtml(45, 55, 100, 20, Color("Ticket Price:", LabelColor));
AddHtml(145, 55, 250, 20, Color(_stone.FormatPrice(), LabelColor));
AddHtml(145, 55, 250, 20, Color(HouseRaffleStone.FormatPrice(stone.TicketPrice), LabelColor));
AddHtml(45, 75, 100, 20, Color("Total Entries:", LabelColor));
AddHtml(145, 75, 250, 20, Color(_stone.Entries.Count.ToString(), LabelColor));

View file

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Net;
using System.Runtime.CompilerServices;
using ModernUO.Serialization;
using Server.Accounting;
using Server.ContextMenus;
@ -234,10 +235,11 @@ public partial class HouseRaffleStone : Item
}
}
public bool ValidLocation() =>
_plotBounds.Start != Point2D.Zero &&
_plotBounds.End != Point2D.Zero &&
_plotFacet != null && _plotFacet != Map.Internal;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool ValidLocation(Rectangle2D bounds, Map map) =>
bounds.Start != Point2D.Zero &&
bounds.End != Point2D.Zero &&
map != null && map != Map.Internal;
private void InvalidateRegion()
{
@ -247,7 +249,7 @@ public partial class HouseRaffleStone : Item
_region = null;
}
if (ValidLocation())
if (ValidLocation(_plotBounds, _plotFacet))
{
_region = new HouseRaffleRegion(this);
_region.Register();
@ -337,25 +339,27 @@ public partial class HouseRaffleStone : Item
return new Point3D(x, y, z);
}
public string FormatLocation() =>
!ValidLocation() ? "no location set" : FormatLocation(GetPlotCenter(), _plotFacet, true);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static string FormatLocation(Rectangle2D bounds, Point3D center, Map map) =>
!ValidLocation(bounds, map) ? "no location set" : FormatLocation(center, map, true);
public string FormatPrice() => _ticketPrice == 0 ? "FREE" : $"{_ticketPrice} gold";
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static string FormatPrice(int price) => price == 0 ? "FREE" : $"{price} gold";
public override void GetProperties(IPropertyList list)
{
base.GetProperties(list);
if (ValidLocation())
if (ValidLocation(_plotBounds, _plotFacet))
{
list.Add(FormatLocation());
list.Add(FormatLocation(_plotBounds, GetPlotCenter(), _plotFacet));
}
switch (_currentState)
{
case HouseRaffleState.Active:
{
list.Add(1060658, $"{"ticket price"}\t{FormatPrice()}"); // ~1_val~: ~2_val~
list.Add(1060658, $"{"ticket price"}\t{FormatPrice(_ticketPrice)}"); // ~1_val~: ~2_val~
list.Add(1060659, $"{"ends"}\t{_started + _duration}"); // ~1_val~: ~2_val~
break;
}
@ -433,13 +437,11 @@ public partial class HouseRaffleStone : Item
else
{
from.SendGump(
new WarningGump(
1150470, // CONFIRM TICKET PURCHASE
0x7F00,
$"You are about to purchase a raffle ticket for the house plot located at {FormatLocation()}. The ticket price is {FormatPrice()}. Tickets are non-refundable and you can only purchase one ticket per account. Do you wish to continue?",
0xFFFFFF,
420,
280,
new ConfirmTicketPurchaseGump(
_plotBounds,
GetPlotCenter(),
_plotFacet,
_ticketPrice,
okay => Purchase_Callback(from, okay)
)
);
@ -471,7 +473,7 @@ public partial class HouseRaffleStone : Item
}
else
{
from.SendMessage(MessageHue, $"You do not have the {FormatPrice()} required to enter the raffle.");
from.SendMessage(MessageHue, $"You do not have the {FormatPrice(_ticketPrice)} required to enter the raffle.");
}
}
else
@ -499,7 +501,7 @@ public partial class HouseRaffleStone : Item
_winner.SendMessage(
MessageHue,
$"Congratulations, {_winner.Name}! You have won the raffle for the plot located at {FormatLocation()}."
$"Congratulations, {_winner.Name}! You have won the raffle for the plot located at {FormatLocation(_plotBounds, GetPlotCenter(), _plotFacet)}."
);
if (_winner.AddToBackpack(Deed))
@ -628,7 +630,7 @@ public partial class HouseRaffleStone : Item
{
public ActivateEntry(Mobile from, HouseRaffleStone stone) : base(from, stone, 5113) // Start
{
if (!stone.ValidLocation())
if (!ValidLocation(stone._plotBounds, stone._plotFacet))
{
Flags |= CMEFlags.Disabled;
}
@ -636,7 +638,7 @@ public partial class HouseRaffleStone : Item
public override void OnClick()
{
if (_stone.Deleted || _from.AccessLevel < AccessLevel.Seer || !_stone.ValidLocation())
if (_stone.Deleted || _from.AccessLevel < AccessLevel.Seer || !ValidLocation(_stone._plotBounds, _stone._plotFacet))
{
return;
}
@ -661,4 +663,21 @@ public partial class HouseRaffleStone : Item
_from.SendGump(new HouseRaffleManagementGump(_stone));
}
}
private class ConfirmTicketPurchaseGump : StaticWarningGump<ConfirmTicketPurchaseGump>
{
public override int Header => 1150470; // CONFIRM TICKET PURCHASE
public override int HeaderColor => 0x7F00;
public override int ContentColor => 0xFFFFFF;
public override int Width => 420;
public override int Height => 280;
public override string Content { get; }
public ConfirmTicketPurchaseGump(Rectangle2D bounds, Point3D center, Map map, int price, Action<bool> callback) : base(callback)
{
Content =
$"You are about to purchase a raffle ticket for the house plot located at {FormatLocation(bounds, center, map)}. The ticket price is {FormatPrice(price)}. Tickets are non-refundable and you can only purchase one ticket per account. Do you wish to continue?";
}
}
}

View file

@ -220,7 +220,7 @@ namespace Server.Misc
}
}
private static void KickMessage(Mobile from, bool okay)
private static void KickMessage(Mobile from)
{
from.SendMessage("You will be reminded of this again.");
@ -238,23 +238,7 @@ namespace Server.Misc
{
if (m.NetState != null)
{
Gump g = new WarningGump(
1060637,
30720,
$"Your client is invalid.<br>This server recommends that your client version is {GetVersionExpression()}.<br> <br>You are currently using version {m.NetState.Version}.",
0xFFC000,
480,
360,
okay => KickMessage(m, okay),
false
)
{
Draggable = false,
Closable = false,
Resizable = false,
};
m.SendGump(g);
m.SendGump(new AnnoyGump(m.NetState.Version, () => KickMessage(m)));
}
}
@ -266,5 +250,25 @@ namespace Server.Misc
LenientKick,
Kick
}
private class AnnoyGump : StaticNoticeGump<AnnoyGump>
{
public override int Width => 480;
public override int Height => 360;
public override string Content { get; }
public AnnoyGump(ClientVersion version, Action callback) : base(callback) =>
Content = $"Your client is invalid.<br>This server recommends that your client version is {GetVersionExpression()}.<br><br>You are currently using version {version}.";
protected override void BuildLayout(ref StaticGumpBuilder builder)
{
builder.SetNoDispose();
builder.SetNoResize();
builder.SetNoMove();
base.BuildLayout(ref builder);
}
}
}
}

View file

@ -121,7 +121,7 @@ public partial class HordeMinionFamiliar : BaseFamiliar
if (Backpack?.Items.Count > 0)
{
from.SendGump(
new WarningGump(1060635, 30720, 1061672, 32512, 420, 280, okay => ConfirmRelease_Callback(from, okay))
new ReleaseFamiliarWarningGump(okay => ConfirmRelease_Callback(from, okay))
);
}
else
@ -185,4 +185,20 @@ public partial class HordeMinionFamiliar : BaseFamiliar
PackAnimal.GetContextMenuEntries(this, from, list);
}
private class ReleaseFamiliarWarningGump : StaticWarningGump<ReleaseFamiliarWarningGump>
{
/*
* If you release your familiar, everything in its backpack will be destroyed!
* Are you sure you want to release your familiar?
*/
public override int StaticLocalizedContent => 1061672;
public override int Width => 420;
public override int Height => 280;
public ReleaseFamiliarWarningGump(Action<bool> callback) : base(callback)
{
}
}
}

View file

@ -1246,7 +1246,7 @@ namespace Server.Mobiles
notice = "The server is currently under lockdown. You have sufficient access level to connect.";
}
from.SendGump(new NoticeGump(1060637, 30720, notice, 0xFFC000, 300, 140));
from.SendGump(new ServerLockdownNoticeGump(notice));
return;
}
@ -1257,6 +1257,15 @@ namespace Server.Mobiles
}
}
private class ServerLockdownNoticeGump : StaticNoticeGump<ServerLockdownNoticeGump>
{
public override int Width => 300;
public override int Height => 140;
public override string Content { get; }
public ServerLockdownNoticeGump(string content) => Content = content;
}
public void ValidateEquipment()
{
if (m_NoDeltaRecursion || Map == null || Map == Map.Internal)

View file

@ -2240,22 +2240,8 @@ namespace Server.Multis
if (HasRentedVendors)
{
/* You are about to be traded a home that has active vendor contracts.
* While there are active vendor contracts in this house, you
* <strong>cannot</strong> demolish <strong>OR</strong> customize the home.
* When you accept this house, you also accept landlordship for every
* contract vendor in the house.
*/
to.SendGump(
new WarningGump(
1060635,
30720,
1062487,
32512,
420,
280,
okay => ConfirmTransfer_Callback(to, okay, from)
)
new TradeHouseWarningGump(okay => ConfirmTransfer_Callback(to, okay, from))
);
}
else
@ -2266,6 +2252,24 @@ namespace Server.Multis
}
}
private class TradeHouseWarningGump : StaticWarningGump<TradeHouseWarningGump>
{
/*
* You are about to be traded a home that has active vendor contracts.
* While there are active vendor contracts in this house, you
* <strong>cannot</strong> demolish <strong>OR</strong> customize the home.
* When you accept this house, you also accept landlordship for every contract vendor in the house.
*/
public override int StaticLocalizedContent => 1062487;
public override int Width => 420;
public override int Height => 280;
public TradeHouseWarningGump(Action<bool> callback) : base(callback)
{
}
}
private void ConfirmTransfer_Callback(Mobile to, bool ok, Mobile from)
{
if (!ok || Deleted || !from.CheckAlive() || !IsOwner(from))

View file

@ -1996,11 +1996,7 @@ namespace Server.Items
if (prevHouse.Deleted)
{
/* Too much time has passed and the test house you created has been deleted.
* Please try again!
*/
from.SendGump(new NoticeGump(1060637, 30720, 1060647, 32512, 320, 180));
from.SendGump(new HousePlacementTimeoutNoticeGump());
return;
}
@ -2040,18 +2036,15 @@ namespace Server.Items
{
if (Banker.Withdraw(from, Cost))
{
from.SendLocalizedMessage(
1060398,
Cost.ToString()
); // ~1_AMOUNT~ gold has been withdrawn from your bank box.
// ~1_AMOUNT~ gold has been withdrawn from your bank box.
from.SendLocalizedMessage(1060398, Cost.ToString());
}
else
{
house.RemoveKeys(from);
house.Delete();
from.SendLocalizedMessage(
1060646
); // You do not have the funds available in your bank box to purchase this house. Try placing a smaller house, or adding gold or checks to your bank box.
// You do not have the funds available in your bank box to purchase this house. Try placing a smaller house, or adding gold or checks to your bank box.
from.SendLocalizedMessage(1060646);
return;
}
}
@ -2081,9 +2074,8 @@ namespace Server.Items
case HousePlacementResult.BadRegionHidden:
case HousePlacementResult.NoSurface:
{
from.SendLocalizedMessage(
1043287
); // The house could not be created here. Either something is blocking the house, or the house would not be on valid terrain.
// The house could not be created here. Either something is blocking the house, or the house would not be on valid terrain.
from.SendLocalizedMessage(1043287);
break;
}
case HousePlacementResult.BadRegion:
@ -2093,16 +2085,14 @@ namespace Server.Items
}
case HousePlacementResult.BadRegionTemp:
{
from.SendLocalizedMessage(
501270
); // Lord British has decreed a 'no build' period, thus you cannot build this house at this time.
// Lord British has decreed a 'no build' period, thus you cannot build this house at this time.
from.SendLocalizedMessage(501270);
break;
}
case HousePlacementResult.BadRegionRaffle:
{
from.SendLocalizedMessage(
1150493
); // You must have a deed for this plot of land in order to build here.
// You must have a deed for this plot of land in order to build here.
from.SendLocalizedMessage(1150493);
break;
}
case HousePlacementResult.InvalidCastleKeep:
@ -2170,28 +2160,8 @@ namespace Server.Items
prev.MoveToWorld(center, from.Map);
/* You are about to place a new house.
* Placing this house will condemn any and all of your other houses that you may have.
* All of your houses on all shards will be affected.
*
* In addition, you will not be able to place another house or have one transferred to you for one (1) real-life week.
*
* Once you accept these terms, these effects cannot be reversed.
* Re-deeding or transferring your new house will not uncondemn your other house(s) nor will the one week timer be removed.
*
* If you are absolutely certain you wish to proceed, click the button next to OKAY below.
* If you do not wish to trade for this house, click CANCEL.
*/
from.SendGump(
new WarningGump(
1060635,
30720,
1049583,
32512,
420,
280,
okay => PlacementWarning_Callback(from, okay, prev)
)
new CondemnWarningGump(okay => PlacementWarning_Callback(from, okay, prev))
);
return true;
@ -2205,9 +2175,8 @@ namespace Server.Items
case HousePlacementResult.BadRegionHidden:
case HousePlacementResult.NoSurface:
{
from.SendLocalizedMessage(
1043287
); // The house could not be created here. Either something is blocking the house, or the house would not be on valid terrain.
// The house could not be created here. Either something is blocking the house, or the house would not be on valid terrain.
from.SendLocalizedMessage(1043287);
break;
}
case HousePlacementResult.BadRegion:
@ -2217,16 +2186,14 @@ namespace Server.Items
}
case HousePlacementResult.BadRegionTemp:
{
from.SendLocalizedMessage(
501270
); // Lord British has decreed a 'no build' period, thus you cannot build this house at this time.
// Lord British has decreed a 'no build' period, thus you cannot build this house at this time.
from.SendLocalizedMessage(501270);
break;
}
case HousePlacementResult.BadRegionRaffle:
{
from.SendLocalizedMessage(
1150493
); // You must have a deed for this plot of land in order to build here.
// You must have a deed for this plot of land in order to build here.
from.SendLocalizedMessage(1150493);
break;
}
case HousePlacementResult.InvalidCastleKeep:
@ -2311,5 +2278,35 @@ namespace Server.Items
}
}
}
private class CondemnWarningGump : StaticWarningGump<CondemnWarningGump>
{
/*
* You are about to place a new house.
* Placing this house will <a href = "?ForceTopic97">condemn</a> any and all of your other houses that you may have.
* All of your houses on <U>all shards</U> will be affected.<BR><BR>In addition, you will not be able to place
* another house or have one transferred to you for one (1) real-life week.<BR><BR>
* Once you accept these terms, these effects cannot be reversed.
* Re-deeding or transferring your new house will <U>not</U> uncondemn your other house(s) nor will the one
* week timer be removed.<BR><BR>If you are absolutely certain you wish to proceed, click the button next to OKAY below.
* If you do not wish to trade for this house, click CANCEL.
*/
public override int StaticLocalizedContent => 1049583;
public override int Width => 420;
public override int Height => 280;
public CondemnWarningGump(Action<bool> callback) : base(callback)
{
}
}
private class HousePlacementTimeoutNoticeGump : StaticWarningGump<HousePlacementTimeoutNoticeGump>
{
// Too much time has passed and the test house you created has been deleted. Please try again!
public override int StaticLocalizedContent => 1060647;
public override int Width => 320;
public override int Height => 180;
}
}
}

View file

@ -168,7 +168,7 @@ namespace Server.Multis
if (canClaim && !BaseHouse.HasAccountHouse(m))
{
m.SendGump(
new WarningGump(501036, 32512, 1049719, 32512, 420, 280, okay => ClaimGump_Callback(m, okay))
new ClaimHouseWarningGump(okay => ClaimGump_Callback(m, okay))
);
}
}
@ -176,6 +176,28 @@ namespace Server.Multis
ShowSign(m);
}
private class ClaimHouseWarningGump : StaticWarningGump<ClaimHouseWarningGump>
{
public override int Header => 501036; // Claim house
public override int HeaderColor => 0x7F00;
/*
* You do not currently own any house on any shard with this account, and this house currently does not have an owner.
* If you wish, you may choose to claim this house and become its rightful owner.
* If you do this, it will become your Primary house and automatically refresh.
* If you claim this house, you will be unable to place another house or have another house transferred to you for the next 7 days.
* Do you wish to claim this house?
*/
public override int StaticLocalizedContent => 1049719;
public override int Width => 420;
public override int Height => 280;
public ClaimHouseWarningGump(Action<bool> callback) : base(callback)
{
}
}
public override void GetContextMenuEntries(Mobile from, List<ContextMenuEntry> list)
{
base.GetContextMenuEntries(from, list);

View file

@ -125,9 +125,9 @@ public class HouseRegion : BaseRegion
}
if (House.InternalizedVendors.Count > 0 && House.IsInside(m) && !House.IsInside(oldLocation, 16) &&
House.IsOwner(m) && m.Alive && !m.HasGump<NoticeGump>())
House.IsOwner(m) && m.Alive && !m.HasGump<RecentlyCustomizedWarningGump>())
{
m.SendGump(new NoticeGump(1060635, 30720, 1061826, 32512, 320, 180));
m.SendGump(new RecentlyCustomizedWarningGump());
}
m_Recursion = false;
@ -193,9 +193,9 @@ public class HouseRegion : BaseRegion
if (House.InternalizedVendors.Count > 0 && House.IsInside(from) && !House.IsInside(oldLocation, 16) &&
House.IsOwner(from) && from.Alive &&
!from.HasGump<NoticeGump>())
!from.HasGump<RecentlyCustomizedWarningGump>())
{
from.SendGump(new NoticeGump(1060635, 30720, 1061826, 32512, 320, 180));
from.SendGump(new RecentlyCustomizedWarningGump());
}
return true;
@ -402,4 +402,18 @@ public class HouseRegion : BaseRegion
return base.OnSingleClick(from, o);
}
// TODO: Should this be a notice gump instead?
private class RecentlyCustomizedWarningGump : StaticWarningGump<RecentlyCustomizedWarningGump>
{
/*
* This house has been customized recently, and vendors that work out of this house have been temporarily relocated.
* You must now put your vendors back to work.
* To do this, walk to a location inside the house where you wish to station your vendor, then activate the context-sensitive menu on your avatar and select "Get Vendor".
*/
public override int StaticLocalizedContent => 1061826;
public override int Width => 320;
public override int Height => 180;
public override bool CancelButton => false;
}
}