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

@ -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);
}
}
}
}