Skip to content

Commit

Permalink
Merge branch 'main' into feat-restyle-res-gumps
Browse files Browse the repository at this point in the history
  • Loading branch information
kamronbatman authored Aug 14, 2024
2 parents c9940a9 + b612c44 commit 1cc0c69
Show file tree
Hide file tree
Showing 9 changed files with 175 additions and 172 deletions.
4 changes: 2 additions & 2 deletions Projects/UOContent/Engines/Bulk Orders/LargeBOD.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public override void OnDoubleClick(Mobile from)
{
if (IsChildOf(from.Backpack) || InSecureTrade || RootParent is PlayerVendor)
{
from.SendGump(new LargeBODGump(from, this));
from.SendGump(new LargeBODGump(this));
}
else
{
Expand Down Expand Up @@ -143,7 +143,7 @@ public override void EndCombine(Mobile from, Item item)
small.Delete();

from.SendLocalizedMessage(1045165); // The orders have been combined.
from.SendGump(new LargeBODGump(from, this));
from.SendGump(new LargeBODGump(this));

if (!Complete)
{
Expand Down
82 changes: 41 additions & 41 deletions Projects/UOContent/Engines/Bulk Orders/LargeBODAcceptGump.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,109 +3,109 @@

namespace Server.Engines.BulkOrders
{
public class LargeBODAcceptGump : Gump
public class LargeBODAcceptGump : DynamicGump
{
private readonly LargeBOD m_Deed;
private readonly Mobile m_From;
private readonly LargeBOD _deed;

public override bool Singleton => true;

public LargeBODAcceptGump(Mobile from, LargeBOD deed) : base(50, 50)
{
m_From = from;
m_Deed = deed;
public LargeBODAcceptGump(LargeBOD deed) : base(50, 50) => _deed = deed;

var entries = deed.Entries;
protected override void BuildLayout(ref DynamicGumpBuilder builder)
{
var entries = _deed.Entries;

AddPage(0);
builder.AddPage();

AddBackground(25, 10, 430, 240 + entries.Length * 24, 5054);
builder.AddBackground(25, 10, 430, 240 + entries.Length * 24, 5054);

AddImageTiled(33, 20, 413, 221 + entries.Length * 24, 2624);
AddAlphaRegion(33, 20, 413, 221 + entries.Length * 24);
builder.AddImageTiled(33, 20, 413, 221 + entries.Length * 24, 2624);
builder.AddAlphaRegion(33, 20, 413, 221 + entries.Length * 24);

AddImage(20, 5, 10460);
AddImage(430, 5, 10460);
AddImage(20, 225 + entries.Length * 24, 10460);
AddImage(430, 225 + entries.Length * 24, 10460);
builder.AddImage(20, 5, 10460);
builder.AddImage(430, 5, 10460);
builder.AddImage(20, 225 + entries.Length * 24, 10460);
builder.AddImage(430, 225 + entries.Length * 24, 10460);

AddHtmlLocalized(180, 25, 120, 20, 1045134, 0x7FFF); // A large bulk order
builder.AddHtmlLocalized(180, 25, 120, 20, 1045134, 0x7FFF); // A large bulk order

AddHtmlLocalized(40, 48, 350, 20, 1045135, 0x7FFF); // Ah! Thanks for the goods! Would you help me out?
builder.AddHtmlLocalized(40, 48, 350, 20, 1045135, 0x7FFF); // Ah! Thanks for the goods! Would you help me out?

AddHtmlLocalized(40, 72, 210, 20, 1045138, 0x7FFF); // Amount to make:
AddLabel(250, 72, 1152, deed.AmountMax.ToString());
builder.AddHtmlLocalized(40, 72, 210, 20, 1045138, 0x7FFF); // Amount to make:
builder.AddLabel(250, 72, 1152, _deed.AmountMax.ToString());

AddHtmlLocalized(40, 96, 120, 20, 1045137, 0x7FFF); // Items requested:
builder.AddHtmlLocalized(40, 96, 120, 20, 1045137, 0x7FFF); // Items requested:

var y = 120;

for (var i = 0; i < entries.Length; ++i, y += 24)
{
AddHtmlLocalized(40, y, 210, 20, entries[i].Details.Number, 0x7FFF);
builder.AddHtmlLocalized(40, y, 210, 20, entries[i].Details.Number, 0x7FFF);
}

if (deed.RequireExceptional || deed.Material != BulkMaterialType.None)
if (_deed.RequireExceptional || _deed.Material != BulkMaterialType.None)
{
AddHtmlLocalized(40, y, 210, 20, 1045140, 0x7FFF); // Special requirements to meet:
builder.AddHtmlLocalized(40, y, 210, 20, 1045140, 0x7FFF); // Special requirements to meet:
y += 24;

if (deed.RequireExceptional)
if (_deed.RequireExceptional)
{
AddHtmlLocalized(40, y, 350, 20, 1045141, 0x7FFF); // All items must be exceptional.
builder.AddHtmlLocalized(40, y, 350, 20, 1045141, 0x7FFF); // All items must be exceptional.
y += 24;
}

if (deed.Material != BulkMaterialType.None)
if (_deed.Material != BulkMaterialType.None)
{
AddHtmlLocalized(
builder.AddHtmlLocalized(
40,
y,
350,
20,
GetMaterialNumberFor(deed.Material), // All items must be made with x material.
GetMaterialNumberFor(_deed.Material), // All items must be made with x material.
0x7FFF
);
}
}

// Do you want to accept this order?
AddHtmlLocalized(40, 192 + entries.Length * 24, 350, 20, 1045139, 0x7FFF);
builder.AddHtmlLocalized(40, 192 + entries.Length * 24, 350, 20, 1045139, 0x7FFF);

// Ok
AddButton(100, 216 + entries.Length * 24, 4005, 4007, 1);
AddHtmlLocalized(135, 216 + entries.Length * 24, 120, 20, 1006044, 0x7FFF);
builder.AddButton(100, 216 + entries.Length * 24, 4005, 4007, 1);
builder.AddHtmlLocalized(135, 216 + entries.Length * 24, 120, 20, 1006044, 0x7FFF);

// CANCEL
AddButton(275, 216 + entries.Length * 24, 4005, 4007, 0);
AddHtmlLocalized(310, 216 + entries.Length * 24, 120, 20, 1011012, 0x7FFF);
builder.AddButton(275, 216 + entries.Length * 24, 4005, 4007, 0);
builder.AddHtmlLocalized(310, 216 + entries.Length * 24, 120, 20, 1011012, 0x7FFF);
}

public override void OnResponse(NetState sender, in RelayInfo info)
{
Mobile from = sender.Mobile;

if (info.ButtonID == 1) // Ok
{
if (m_From.PlaceInBackpack(m_Deed))
if (from.PlaceInBackpack(_deed))
{
m_From.SendLocalizedMessage(1045152); // The bulk order deed has been placed in your backpack.
from.SendLocalizedMessage(1045152); // The bulk order deed has been placed in your backpack.
}
else
{
m_From.SendLocalizedMessage(1045150); // There is not enough room in your backpack for the deed.
m_Deed.Delete();
from.SendLocalizedMessage(1045150); // There is not enough room in your backpack for the deed.
_deed.Delete();
}
}
else
{
m_Deed.Delete();
_deed.Delete();
}
}

public override void OnServerClose(NetState owner)
{
if (m_Deed?.Deleted == false)
if (_deed?.Deleted == false)
{
m_Deed.Delete();
_deed.Delete();
}
}

Expand Down
74 changes: 37 additions & 37 deletions Projects/UOContent/Engines/Bulk Orders/LargeBODGump.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,37 @@

namespace Server.Engines.BulkOrders
{
public class LargeBODGump : Gump
public class LargeBODGump : DynamicGump
{
private readonly LargeBOD m_Deed;
private readonly Mobile m_From;
private readonly LargeBOD _deed;

public override bool Singleton => true;

public LargeBODGump(Mobile from, LargeBOD deed) : base(25, 25)
{
m_From = from;
m_Deed = deed;
public LargeBODGump(LargeBOD deed) : base(25, 25) => _deed = deed;

var entries = deed.Entries;
protected override void BuildLayout(ref DynamicGumpBuilder builder)
{
var entries = _deed.Entries;

AddPage(0);
builder.AddPage();

AddBackground(50, 10, 455, 236 + entries.Length * 24, 5054);
builder.AddBackground(50, 10, 455, 236 + entries.Length * 24, 5054);

AddImageTiled(58, 20, 438, 217 + entries.Length * 24, 2624);
AddAlphaRegion(58, 20, 438, 217 + entries.Length * 24);
builder.AddImageTiled(58, 20, 438, 217 + entries.Length * 24, 2624);
builder.AddAlphaRegion(58, 20, 438, 217 + entries.Length * 24);

AddImage(45, 5, 10460);
AddImage(480, 5, 10460);
AddImage(45, 221 + entries.Length * 24, 10460);
AddImage(480, 221 + entries.Length * 24, 10460);
builder.AddImage(45, 5, 10460);
builder.AddImage(480, 5, 10460);
builder.AddImage(45, 221 + entries.Length * 24, 10460);
builder.AddImage(480, 221 + entries.Length * 24, 10460);

AddHtmlLocalized(225, 25, 120, 20, 1045134, 0x7FFF); // A large bulk order
builder.AddHtmlLocalized(225, 25, 120, 20, 1045134, 0x7FFF); // A large bulk order

AddHtmlLocalized(75, 48, 250, 20, 1045138, 0x7FFF); // Amount to make:
AddLabel(275, 48, 1152, deed.AmountMax.ToString());
builder.AddHtmlLocalized(75, 48, 250, 20, 1045138, 0x7FFF); // Amount to make:
builder.AddLabel(275, 48, 1152, _deed.AmountMax.ToString());

AddHtmlLocalized(75, 72, 120, 20, 1045137, 0x7FFF); // Items requested:
AddHtmlLocalized(275, 76, 200, 20, 1045153, 0x7FFF); // Amount finished:
builder.AddHtmlLocalized(75, 72, 120, 20, 1045137, 0x7FFF); // Items requested:
builder.AddHtmlLocalized(275, 76, 200, 20, 1045153, 0x7FFF); // Amount finished:

var y = 96;

Expand All @@ -44,39 +42,39 @@ public LargeBODGump(Mobile from, LargeBOD deed) : base(25, 25)
var entry = entries[i];
var details = entry.Details;

AddHtmlLocalized(75, y, 210, 20, details.Number, 0x7FFF);
AddLabel(275, y, 0x480, entry.Amount.ToString());
builder.AddHtmlLocalized(75, y, 210, 20, details.Number, 0x7FFF);
builder.AddLabel(275, y, 0x480, entry.Amount.ToString());

y += 24;
}

if (deed.RequireExceptional || deed.Material != BulkMaterialType.None)
if (_deed.RequireExceptional || _deed.Material != BulkMaterialType.None)
{
AddHtmlLocalized(75, y, 200, 20, 1045140, 0x7FFF); // Special requirements to meet:
builder.AddHtmlLocalized(75, y, 200, 20, 1045140, 0x7FFF); // Special requirements to meet:
y += 24;
}

if (deed.RequireExceptional)
if (_deed.RequireExceptional)
{
AddHtmlLocalized(75, y, 300, 20, 1045141, 0x7FFF); // All items must be exceptional.
builder.AddHtmlLocalized(75, y, 300, 20, 1045141, 0x7FFF); // All items must be exceptional.
y += 24;
}

if (deed.Material != BulkMaterialType.None)
if (_deed.Material != BulkMaterialType.None)
{
AddHtmlLocalized(
builder.AddHtmlLocalized(
75,
y,
300,
20,
GetMaterialNumberFor(deed.Material), // All items must be made with x material.
GetMaterialNumberFor(_deed.Material), // All items must be made with x material.
0x7FFF
);
}

AddButton(125, 168 + entries.Length * 24, 4005, 4007, 2);
builder.AddButton(125, 168 + entries.Length * 24, 4005, 4007, 2);

AddHtmlLocalized(
builder.AddHtmlLocalized(
160,
168 + entries.Length * 24,
300,
Expand All @@ -85,21 +83,23 @@ public LargeBODGump(Mobile from, LargeBOD deed) : base(25, 25)
0x7FFF
);

AddButton(125, 192 + entries.Length * 24, 4005, 4007, 1);
AddHtmlLocalized(160, 192 + entries.Length * 24, 120, 20, 1011441, 0x7FFF); // EXIT
builder.AddButton(125, 192 + entries.Length * 24, 4005, 4007, 1);
builder.AddHtmlLocalized(160, 192 + entries.Length * 24, 120, 20, 1011441, 0x7FFF); // EXIT
}

public override void OnResponse(NetState sender, in RelayInfo info)
{
if (m_Deed.Deleted || !m_Deed.IsChildOf(m_From.Backpack))
Mobile from = sender.Mobile;

if (_deed.Deleted || !_deed.IsChildOf(from.Backpack))
{
return;
}

if (info.ButtonID == 2) // Combine
{
m_From.SendGump(new LargeBODGump(m_From, m_Deed));
m_Deed.BeginCombine(m_From);
sender.SendGump(new LargeBODGump(_deed));
_deed.BeginCombine(from);
}
}

Expand Down
4 changes: 2 additions & 2 deletions Projects/UOContent/Engines/Bulk Orders/SmallBOD.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public override void OnDoubleClick(Mobile from)
{
if (IsChildOf(from.Backpack) || InSecureTrade || RootParent is PlayerVendor)
{
from.SendGump(new SmallBODGump(from, this));
from.SendGump(new SmallBODGump(this));
}
else
{
Expand Down Expand Up @@ -181,7 +181,7 @@ public override void EndCombine(Mobile from, Item item)
++AmountCur;

from.SendLocalizedMessage(1045170); // The item has been combined with the deed.
from.SendGump(new SmallBODGump(from, this));
from.SendGump(new SmallBODGump(this));

if (m_AmountCur < AmountMax)
{
Expand Down
Loading

0 comments on commit 1cc0c69

Please sign in to comment.