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,60 +1,65 @@
using Server.Gumps;
using Server.Network;
namespace Server.Engines.Help
namespace Server.Engines.Help;
public sealed class PagePromptGump : StaticGump<PagePromptGump>
{
public class PagePromptGump : Gump
private readonly Mobile _from;
private readonly PageType _type;
public PagePromptGump(Mobile from, PageType type) : base(0, 0)
{
private readonly Mobile m_From;
private readonly PageType m_Type;
_from = from;
_type = type;
}
public PagePromptGump(Mobile from, PageType type) : base(0, 0)
protected override void BuildLayout(ref StaticGumpBuilder builder)
{
builder.AddBackground(50, 50, 540, 350, 2600);
builder.AddPage();
builder.AddHtmlLocalized(264, 80, 200, 24, 1062524); // Enter Description
// Please enter a brief description (up to 200 characters) of your problem:
builder.AddHtmlLocalized(120, 108, 420, 48, 1062638);
builder.AddBackground(100, 148, 440, 200, 3500);
builder.AddTextEntry(120, 168, 400, 200, 1153, 0, "");
builder.AddButton(175, 355, 2074, 2075, 1); // Okay
builder. AddButton(405, 355, 2073, 2072, 0); // Cancel
}
public override void SendTo(NetState ns)
{
_from.CloseGump<PagePromptGump>();
base.SendTo(ns);
}
public override void OnResponse(NetState sender, in RelayInfo info)
{
if (info.ButtonID == 0)
{
m_From = from;
m_Type = type;
from.CloseGump<PagePromptGump>();
AddBackground(50, 50, 540, 350, 2600);
AddPage(0);
AddHtmlLocalized(264, 80, 200, 24, 1062524); // Enter Description
// Please enter a brief description (up to 200 characters) of your problem:
AddHtmlLocalized(120, 108, 420, 48, 1062638);
AddBackground(100, 148, 440, 200, 3500);
AddTextEntry(120, 168, 400, 200, 1153, 0, "");
AddButton(175, 355, 2074, 2075, 1); // Okay
AddButton(405, 355, 2073, 2072, 0); // Cancel
_from.SendLocalizedMessage(501235, "", 0x35); // Help request aborted.
return;
}
public override void OnResponse(NetState sender, in RelayInfo info)
var text = info.GetTextEntry(0)?.Trim() ?? "";
if (text.Length == 0)
{
if (info.ButtonID == 0)
{
m_From.SendLocalizedMessage(501235, "", 0x35); // Help request aborted.
}
else
{
var text = info.GetTextEntry(0)?.Trim() ?? "";
_from.SendMessage(0x35, "You must enter a description.");
_from.SendGump(new PagePromptGump(_from, _type));
}
else
{
/* The next available Counselor/Game Master will respond as soon as possible.
* Please check your Journal for messages every few minutes.
*/
_from.SendLocalizedMessage(501234, "", 0x35);
if (text.Length == 0)
{
m_From.SendMessage(0x35, "You must enter a description.");
m_From.SendGump(new PagePromptGump(m_From, m_Type));
}
else
{
/* The next available Counselor/Game Master will respond as soon as possible.
* Please check your Journal for messages every few minutes.
*/
m_From.SendLocalizedMessage(501234, "", 0x35);
PageQueue.Enqueue(new PageEntry(m_From, text, m_Type));
}
}
PageQueue.Enqueue(new PageEntry(_from, text, _type));
}
}
}

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

View file

@ -98,22 +98,22 @@ namespace Server.Engines.Help
{
if (pm.Female)
{
from.SendMessage($"You don't have the required access level to view her speech log.");
from.SendMessage("You don't have the required access level to view her speech log.");
}
else
{
from.SendMessage($"You don't have the required access level to view his speech log.");
from.SendMessage("You don't have the required access level to view his speech log.");
}
}
else if (pm.SpeechLog == null)
{
if (pm.Female)
{
from.SendMessage($"She has no speech log.");
from.SendMessage("She has no speech log.");
}
else
{
from.SendMessage($"He has no speech log.");
from.SendMessage("He has no speech log.");
}
}
else

View file

@ -79,12 +79,7 @@ namespace Server.Engines.Help
builder.Append("<br>");
}
builder.AppendFormat(
"<u>{0}</u> (<i>{1}</i>): {2}",
name,
account.FixHtml(),
speech.FixHtml()
);
builder.Append($"<u>{name}</u> (<i>{account.FixHtml()}</i>): {speech.FixHtml()}");
}
sLog = builder.ToString();

View file

@ -22,114 +22,106 @@ namespace Server.Menus.Questions
public class StuckMenu : Gump
{
private static readonly StuckMenuEntry[] m_Entries =
{
[
// Britain
new(
new StuckMenuEntry(
1011028,
new[]
{
[
new Point3D(1522, 1757, 28),
new Point3D(1519, 1619, 10),
new Point3D(1457, 1538, 30),
new Point3D(1607, 1568, 20),
new Point3D(1643, 1680, 18)
}
]
),
// Trinsic
new(
new StuckMenuEntry(
1011029,
new[]
{
[
new Point3D(2005, 2754, 30),
new Point3D(1993, 2827, 0),
new Point3D(2044, 2883, 0),
new Point3D(1876, 2859, 20),
new Point3D(1865, 2687, 0)
}
]
),
// Vesper
new(
new StuckMenuEntry(
1011030,
new[]
{
[
new Point3D(2973, 891, 0),
new Point3D(3003, 776, 0),
new Point3D(2910, 727, 0),
new Point3D(2865, 804, 0),
new Point3D(2832, 927, 0)
}
]
),
// Minoc
new(
new StuckMenuEntry(
1011031,
new[]
{
[
new Point3D(2498, 392, 0),
new Point3D(2433, 541, 0),
new Point3D(2445, 501, 15),
new Point3D(2501, 469, 15),
new Point3D(2444, 420, 15)
}
]
),
// Yew
new(
new StuckMenuEntry(
1011032,
new[]
{
[
new Point3D(490, 1166, 0),
new Point3D(652, 1098, 0),
new Point3D(650, 1013, 0),
new Point3D(536, 979, 0),
new Point3D(464, 970, 0)
}
]
),
// Cove
new(
new StuckMenuEntry(
1011033,
new[]
{
[
new Point3D(2230, 1159, 0),
new Point3D(2218, 1203, 0),
new Point3D(2247, 1194, 0),
new Point3D(2236, 1224, 0),
new Point3D(2273, 1231, 0)
}
]
)
};
];
private static readonly StuckMenuEntry[] m_T2AEntries =
{
[
// Papua
new(
new StuckMenuEntry(
1011057,
new[]
{
[
new Point3D(5720, 3109, -1),
new Point3D(5677, 3176, -3),
new Point3D(5678, 3227, 0),
new Point3D(5769, 3206, -2),
new Point3D(5777, 3270, -1)
}
]
),
// Delucia
new(
new StuckMenuEntry(
1011058,
new[]
{
[
new Point3D(5216, 4033, 37),
new Point3D(5262, 4049, 37),
new Point3D(5284, 4006, 37),
new Point3D(5189, 3971, 39),
new Point3D(5243, 3960, 37)
}
]
)
};
];
private readonly bool m_MarkUse;