Skip to content

Commit

Permalink
fix: Fixes craft/help gump not appearing (#1845)
Browse files Browse the repository at this point in the history
  • Loading branch information
kamronbatman authored Jun 23, 2024
1 parent b8ad5c6 commit 3b84c80
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
13 changes: 8 additions & 5 deletions Projects/UOContent/Engines/Craft/Core/CraftGump.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ protected override void BuildLayout(ref DynamicGumpBuilder builder)
{
var context = _craftSystem.GetContext(_from);

_from.CloseGump<CraftGump>();
_from.CloseGump<CraftGumpItem>();

builder.AddPage();

builder.AddBackground(0, 0, 530, 437, 5054);
Expand Down Expand Up @@ -396,7 +393,7 @@ public void CreateItemList(ref DynamicGumpBuilder builder, int selectedGroup)
}
}

public int CreateGroupList(ref DynamicGumpBuilder builder)
public void CreateGroupList(ref DynamicGumpBuilder builder)
{
var craftGroupCol = _craftSystem.CraftGroups;

Expand All @@ -418,8 +415,14 @@ public int CreateGroupList(ref DynamicGumpBuilder builder)
builder.AddLabel(50, 80 + i * 20, LabelHue, craftGroup.NameString);
}
}
}

public override void SendTo(NetState ns)
{
_from.CloseGump<CraftGump>();
_from.CloseGump<CraftGumpItem>();

return craftGroupCol.Count;
base.SendTo(ns);
}

public static int GetButtonID(int type, int index) => 1 + type + index * 7;
Expand Down
15 changes: 8 additions & 7 deletions Projects/UOContent/Engines/Help/HelpGump.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,12 @@ public override void OnResponse(NetState state, int index)

public sealed class HelpGump : DynamicGump
{
private Mobile _from;
private readonly Mobile _from;

public HelpGump(Mobile from) : base(0, 0)
{
_from = from;
}
public HelpGump(Mobile from) : base(0, 0) => _from = from;

protected override void BuildLayout(ref DynamicGumpBuilder builder)
{
_from.CloseGump<HelpGump>();

var isYoung = IsYoung(_from);
var totalHeight = 110 + (isYoung ? 64 : 0) + 4 * 80;

Expand Down Expand Up @@ -211,6 +206,12 @@ protected override void BuildLayout(ref DynamicGumpBuilder builder)
builder.AddHtmlLocalized(180, y + 150, 335, 40, 1001015); // NO - I meant to ask for help with another matter.
}

public override void SendTo(NetState ns)
{
_from.CloseGump<HelpGump>();
base.SendTo(ns);
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static void AddOption(
ref DynamicGumpBuilder builder, int y, int buttonId, int localizedName, GumpButtonType type = GumpButtonType.Reply,
Expand Down

0 comments on commit 3b84c80

Please sign in to comment.