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:
parent
65532ea887
commit
bb7bc57e42
19 changed files with 713 additions and 430 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue