fix: Converts PageResponse/Prompt gumps (#1838)

This commit is contained in:
Kamron Batman 2024-06-16 21:16:15 -07:00 • committed by GitHub
parent c302ff23bc
commit 9c0b57213a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 118 additions and 124 deletions

View file

@ -1,42 +1,44 @@
using Server.Gumps;
using Server.Network;
namespace Server.Engines.Help
namespace Server.Engines.Help;
public sealed class PageResponseGump : StaticGump<PageResponseGump>
{
public class PageResponseGump : Gump
private readonly Mobile _from;
private readonly string _name;
private readonly string _text;
public PageResponseGump(Mobile from, string name, string text) : base(0, 0)
{
private readonly Mobile m_From;
private readonly string m_Name;
private readonly string m_Text;
_from = from;
_name = name;
_text = text;
}
public PageResponseGump(Mobile from, string name, string text) : base(0, 0)
protected override void BuildLayout(ref StaticGumpBuilder builder)
{
builder.AddBackground(50, 25, 540, 430, 2600);
builder.AddPage();
// <CENTER><U>Ultima Online Help Response</U></CENTER>
builder.AddHtmlLocalized(150, 40, 360, 40, 1062610);
builder.AddHtml(80, 90, 480, 290, $"{_name} tells {_from.Name}: {_text}", true, true);
// Clicking the OKAY button will remove the response you have received.
builder.AddHtmlLocalized(80, 390, 480, 40, 1062611);
builder.AddButton(400, 417, 2074, 2075, 1); // OKAY
builder.AddButton(475, 417, 2073, 2072, 0); // CANCEL
}
public override void OnResponse(NetState sender, in RelayInfo info)
{
if (info.ButtonID != 1)
{
m_From = from;
m_Name = name;
m_Text = text;
AddBackground(50, 25, 540, 430, 2600);
AddPage(0);
// <CENTER><U>Ultima Online Help Response</U></CENTER>
AddHtmlLocalized(150, 40, 360, 40, 1062610);
AddHtml(80, 90, 480, 290, $"{name} tells {from.Name}: {text}", true, true);
// Clicking the OKAY button will remove the reponse you have received.
AddHtmlLocalized(80, 390, 480, 40, 1062611);
AddButton(400, 417, 2074, 2075, 1); // OKAY
AddButton(475, 417, 2073, 2072, 0); // CANCEL
}
public override void OnResponse(NetState sender, in RelayInfo info)
{
if (info.ButtonID != 1)
{
m_From.SendGump(new MessageSentGump(m_From, m_Name, m_Text));
}
_from.SendGump(new MessageSentGump(_from, _name, _text));
}
}
}