fix: Converts MakersMark gump to static & CraftGumpItem to dynamic (#2095)

This commit is contained in:
Kamron Batman 2025-01-27 11:29:23 -08:00 • committed by GitHub
parent 6d879e1d22
commit b5e3f49d06
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 331 additions and 325 deletions

View file

@ -3,59 +3,58 @@ using Server.Gumps;
using Server.Items;
using Server.Network;
namespace Server.Engines.Craft
namespace Server.Engines.Craft;
public class QueryMakersMarkGump : StaticGump<QueryMakersMarkGump>
{
public class QueryMakersMarkGump : Gump
private readonly CraftItem _craftItem;
private readonly CraftSystem _craftSystem;
private readonly int _quality;
private readonly BaseTool _tool;
private readonly Type _typeRes;
public override bool Singleton => true;
public QueryMakersMarkGump(int quality, CraftItem craftItem, CraftSystem craftSystem, Type typeRes, BaseTool tool)
: base(100, 200)
{
private readonly CraftItem m_CraftItem;
private readonly CraftSystem m_CraftSystem;
private readonly Mobile m_From;
private readonly int m_Quality;
private readonly BaseTool m_Tool;
private readonly Type m_TypeRes;
_quality = quality;
_craftItem = craftItem;
_craftSystem = craftSystem;
_typeRes = typeRes;
_tool = tool;
}
public override bool Singleton => true;
protected override void BuildLayout(ref StaticGumpBuilder builder)
{
builder.AddPage();
public QueryMakersMarkGump(
int quality, Mobile from, CraftItem craftItem, CraftSystem craftSystem, Type typeRes,
BaseTool tool
) : base(100, 200)
builder.AddBackground(0, 0, 220, 170, 5054);
builder.AddBackground(10, 10, 200, 150, 3000);
builder.AddHtmlLocalized(20, 20, 180, 80, 1018317); // Do you wish to place your maker's mark on this item?
builder.AddHtmlLocalized(55, 100, 140, 25, 1011011); // CONTINUE
builder.AddButton(20, 100, 4005, 4007, 1);
builder.AddHtmlLocalized(55, 125, 140, 25, 1011012); // CANCEL
builder.AddButton(20, 125, 4005, 4007, 0);
}
public override void OnResponse(NetState sender, in RelayInfo info)
{
var from = sender.Mobile;
var makersMark = info.ButtonID == 1;
if (makersMark)
{
m_Quality = quality;
m_From = from;
m_CraftItem = craftItem;
m_CraftSystem = craftSystem;
m_TypeRes = typeRes;
m_Tool = tool;
AddPage(0);
AddBackground(0, 0, 220, 170, 5054);
AddBackground(10, 10, 200, 150, 3000);
AddHtmlLocalized(20, 20, 180, 80, 1018317); // Do you wish to place your maker's mark on this item?
AddHtmlLocalized(55, 100, 140, 25, 1011011); // CONTINUE
AddButton(20, 100, 4005, 4007, 1);
AddHtmlLocalized(55, 125, 140, 25, 1011012); // CANCEL
AddButton(20, 125, 4005, 4007, 0);
from.SendLocalizedMessage(501808); // You mark the item.
}
else
{
from.SendLocalizedMessage(501809); // Cancelled mark.
}
public override void OnResponse(NetState sender, in RelayInfo info)
{
var makersMark = info.ButtonID == 1;
if (makersMark)
{
m_From.SendLocalizedMessage(501808); // You mark the item.
}
else
{
m_From.SendLocalizedMessage(501809); // Cancelled mark.
}
m_CraftItem.CompleteCraft(m_Quality, makersMark, m_From, m_CraftSystem, m_TypeRes, m_Tool, null);
}
_craftItem.CompleteCraft(_quality, makersMark, from, _craftSystem, _typeRes, _tool, null);
}
}