-
-
Notifications
You must be signed in to change notification settings - Fork 144
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Converts PageResponse/Prompt gumps (#1838)
- Loading branch information
1 parent
c302ff2
commit 9c0b572
Showing
5 changed files
with
108 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
{ | ||
m_From = from; | ||
m_Type = type; | ||
protected override void BuildLayout(ref StaticGumpBuilder builder) | ||
{ | ||
builder.AddBackground(50, 50, 540, 350, 2600); | ||
|
||
from.CloseGump<PagePromptGump>(); | ||
builder.AddPage(); | ||
|
||
AddBackground(50, 50, 540, 350, 2600); | ||
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); | ||
|
||
AddPage(0); | ||
builder.AddBackground(100, 148, 440, 200, 3500); | ||
builder.AddTextEntry(120, 168, 400, 200, 1153, 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); | ||
builder.AddButton(175, 355, 2074, 2075, 1); // Okay | ||
builder. AddButton(405, 355, 2073, 2072, 0); // Cancel | ||
} | ||
|
||
AddBackground(100, 148, 440, 200, 3500); | ||
AddTextEntry(120, 168, 400, 200, 1153, 0, ""); | ||
public override void SendTo(NetState ns) | ||
{ | ||
_from.CloseGump<PagePromptGump>(); | ||
base.SendTo(ns); | ||
} | ||
|
||
AddButton(175, 355, 2074, 2075, 1); // Okay | ||
AddButton(405, 355, 2073, 2072, 0); // Cancel | ||
public override void OnResponse(NetState sender, in RelayInfo info) | ||
{ | ||
if (info.ButtonID == 0) | ||
{ | ||
_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() ?? ""; | ||
|
||
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)); | ||
} | ||
} | ||
_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); | ||
|
||
PageQueue.Enqueue(new PageEntry(_from, text, _type)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 m_From; | ||
private readonly string m_Name; | ||
private readonly string m_Text; | ||
private readonly Mobile _from; | ||
private readonly string _name; | ||
private readonly string _text; | ||
|
||
public PageResponseGump(Mobile from, string name, string text) : base(0, 0) | ||
{ | ||
m_From = from; | ||
m_Name = name; | ||
m_Text = text; | ||
public PageResponseGump(Mobile from, string name, string text) : base(0, 0) | ||
{ | ||
_from = from; | ||
_name = name; | ||
_text = text; | ||
} | ||
|
||
AddBackground(50, 25, 540, 430, 2600); | ||
protected override void BuildLayout(ref StaticGumpBuilder builder) | ||
{ | ||
builder.AddBackground(50, 25, 540, 430, 2600); | ||
|
||
AddPage(0); | ||
builder.AddPage(); | ||
|
||
// <CENTER><U>Ultima Online Help Response</U></CENTER> | ||
AddHtmlLocalized(150, 40, 360, 40, 1062610); | ||
// <CENTER><U>Ultima Online Help Response</U></CENTER> | ||
builder.AddHtmlLocalized(150, 40, 360, 40, 1062610); | ||
|
||
AddHtml(80, 90, 480, 290, $"{name} tells {from.Name}: {text}", true, true); | ||
builder.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 | ||
// 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 | ||
|
||
AddButton(475, 417, 2073, 2072, 0); // CANCEL | ||
} | ||
builder.AddButton(475, 417, 2073, 2072, 0); // CANCEL | ||
} | ||
|
||
public override void OnResponse(NetState sender, in RelayInfo info) | ||
public override void OnResponse(NetState sender, in RelayInfo info) | ||
{ | ||
if (info.ButtonID != 1) | ||
{ | ||
if (info.ButtonID != 1) | ||
{ | ||
m_From.SendGump(new MessageSentGump(m_From, m_Name, m_Text)); | ||
} | ||
_from.SendGump(new MessageSentGump(_from, _name, _text)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters