ModernUO/Projects/Scripts/Engines/BulkOrders/SmallBODGump.cs
2019-08-02 18:16:11 -07:00

82 lines
2.7 KiB
C#

using Server.Gumps;
using Server.Network;
namespace Server.Engines.BulkOrders
{
public class SmallBODGump : Gump
{
private SmallBOD m_Deed;
private Mobile m_From;
public SmallBODGump(Mobile from, SmallBOD deed) : base(25, 25)
{
m_From = from;
m_Deed = deed;
m_From.CloseGump<LargeBODGump>();
m_From.CloseGump<SmallBODGump>();
AddPage(0);
AddBackground(50, 10, 455, 260, 5054);
AddImageTiled(58, 20, 438, 241, 2624);
AddAlphaRegion(58, 20, 438, 241);
AddImage(45, 5, 10460);
AddImage(480, 5, 10460);
AddImage(45, 245, 10460);
AddImage(480, 245, 10460);
AddHtmlLocalized(225, 25, 120, 20, 1045133, 0x7FFF); // A bulk order
AddHtmlLocalized(75, 48, 250, 20, 1045138, 0x7FFF); // Amount to make:
AddLabel(275, 48, 1152, deed.AmountMax.ToString());
AddHtmlLocalized(275, 76, 200, 20, 1045153, 0x7FFF); // Amount finished:
AddHtmlLocalized(75, 72, 120, 20, 1045136, 0x7FFF); // Item requested:
AddItem(410, 72, deed.Graphic);
AddHtmlLocalized(75, 96, 210, 20, deed.Number, 0x7FFF);
AddLabel(275, 96, 0x480, deed.AmountCur.ToString());
if (deed.RequireExceptional || deed.Material != BulkMaterialType.None)
AddHtmlLocalized(75, 120, 200, 20, 1045140, 0x7FFF); // Special requirements to meet:
if (deed.RequireExceptional)
AddHtmlLocalized(75, 144, 300, 20, 1045141, 0x7FFF); // All items must be exceptional.
if (deed.Material != BulkMaterialType.None)
AddHtmlLocalized(75, deed.RequireExceptional ? 168 : 144, 300, 20, GetMaterialNumberFor(deed.Material),
0x7FFF); // All items must be made with x material.
AddButton(125, 192, 4005, 4007, 2);
AddHtmlLocalized(160, 192, 300, 20, 1045154, 0x7FFF); // Combine this deed with the item requested.
AddButton(125, 216, 4005, 4007, 1);
AddHtmlLocalized(160, 216, 120, 20, 1011441, 0x7FFF); // EXIT
}
public override void OnResponse(NetState sender, RelayInfo info)
{
if (m_Deed.Deleted || !m_Deed.IsChildOf(m_From.Backpack))
return;
if (info.ButtonID == 2) // Combine
{
m_From.SendGump(new SmallBODGump(m_From, m_Deed));
m_Deed.BeginCombine(m_From);
}
}
public static int GetMaterialNumberFor(BulkMaterialType material)
{
if (material >= BulkMaterialType.DullCopper && material <= BulkMaterialType.Valorite)
return 1045142 + (material - BulkMaterialType.DullCopper);
if (material >= BulkMaterialType.Spined && material <= BulkMaterialType.Barbed)
return 1049348 + (material - BulkMaterialType.Spined);
return 0;
}
}
}