feat: Consolidates staff gump layouts (#2404)

## Summary
- Creates `PropsLayoutExtensions.cs` with reusable extension methods for both legacy `Gump` and `DynamicGumpBuilder` that encapsulate the repeating PropsConfig-style layout patterns (frame, header navigation, entry rows)
- Converts all 12 standardized staff gumps to use the new extensions, reducing ~570 lines of duplicated layout code
- Adds Type and Serial display to PropsGump and SkillsGump headers (e.g. `PlayerMobile (0x1)`)

### Extension methods provided
| Method | Pattern |
|--------|---------|
| `AddPropsFrame` | Background + offset region + origin coordinates |
| `AddPropsHeader` | 3-column: [Prev] [Title] [Next] |
| `AddPropsHeaderWithBack` | 4-column: [Back] [Title] [Prev] [Next] |
| `AddPropsEntryButton` | Label + action button |
| `AddPropsEntryNameValue` | Name + Value + action button |
| `AddPropsEntryTextInput` | Text input + action button |
| `AddPropsEntryLabel` | Label only (no button) |
| `AddPropsEntryType` | Full-width type label |
| `AddPropsEntryBlank` | Separator row |

### Gumps converted
PropsGump, GoGump, WhoGump, SkillsGump (frame+header), EditSkillGump, SetGump, SetObjectGump, SetPoint2DGump, SetPoint3DGump, SetTimeSpanGump (frame), SetListOptionGump (frame+header), CategorizedAddGump (frame+header)

## Test plan
- [x] Verify `[props` gump displays correctly with type + serial in header
- [x] Verify `[skills` gump displays correctly with type + serial in header
- [x] Verify `[go` navigation gump works (prev/next/back)
- [x] Verify property editing gumps (Set, SetObject, SetPoint2D, SetPoint3D, SetTimeSpan, SetListOption)
- [x] Verify `[categorizedadd` gump works
- [x] Verify `[who` gump works with pagination
This commit is contained in:
Kamron Batman 2026-04-08 11:42:46 -06:00 • committed by GitHub
parent c0d75562be
commit 8a34903326
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 786 additions and 570 deletions

View file

@ -106,90 +106,45 @@ namespace Server.Gumps
--m_EntryCount;
}
var totalHeight = TotalHeight;
AddPage(0);
AddBackground(0, 0, BackWidth, BorderSize + totalHeight + BorderSize, BackGumpID);
AddImageTiled(
BorderSize,
BorderSize,
TotalWidth,
OffsetSize + (EntryHeight + OffsetSize) * (m_EntryCount + 1),
OffsetGumpID
this.AddPropsFrame(TotalWidth, m_EntryCount + 1, out var x, out var y);
var title = m_Type != null && m_Object is ISerializable serializable
? $"{m_Type.Name} ({serializable.Serial})".Center(0xFAFAFA)
: m_Type?.Name.Center(0xFAFAFA);
this.AddPropsHeader(
TotalWidth, ref x, ref y,
title,
page > 0, 1,
(page + 1) * MaxEntriesPerPage < m_List.Count, 2,
nextType: GumpButtonType.Reply, nextParam: 1
);
var x = BorderSize + OffsetSize;
var y = BorderSize + OffsetSize;
const int emptyWidth = TotalWidth - PrevWidth - NextWidth - OffsetSize * 4;
AddImageTiled(x, y, PrevWidth, EntryHeight, HeaderGumpID);
if (page > 0)
{
AddButton(x + PrevOffsetX, y + PrevOffsetY, PrevButtonID1, PrevButtonID2, 1);
}
x += PrevWidth + OffsetSize;
AddImageTiled(x, y, emptyWidth, EntryHeight, HeaderGumpID);
if (m_Type != null)
{
AddHtml(x, y, emptyWidth, EntryHeight, m_Type.Name.Center(0xFAFAFA));
}
x += emptyWidth + OffsetSize;
AddImageTiled(x, y, NextWidth, EntryHeight, HeaderGumpID);
if ((page + 1) * MaxEntriesPerPage < m_List.Count)
{
AddButton(x + NextOffsetX, y + NextOffsetY, NextButtonID1, NextButtonID2, 2, GumpButtonType.Reply, 1);
}
for (int i = 0, index = page * MaxEntriesPerPage; i < m_EntryCount && index < m_List.Count; ++i, ++index)
{
x = BorderSize + OffsetSize;
y += EntryHeight + OffsetSize;
PropsLayout.NextRow(ref x, ref y);
var o = m_List[index];
if (o == null)
{
AddImageTiled(x - OffsetSize, y, TotalWidth, EntryHeight, BackGumpID + 4);
this.AddPropsEntryBlank(x, y, TotalWidth);
}
else if (o is Type type)
{
AddImageTiled(x, y, TypeWidth, EntryHeight, EntryGumpID);
AddLabelCropped(x + TextOffsetX, y, TypeWidth - TextOffsetX, EntryHeight, TextHue, type.Name);
x += TypeWidth + OffsetSize;
if (SetGumpID != 0)
{
AddImageTiled(x, y, SetWidth, EntryHeight, SetGumpID);
}
this.AddPropsEntryType(ref x, ref y, TypeWidth, type.Name);
}
else if (o is PropertyInfo prop)
{
AddImageTiled(x, y, NameWidth, EntryHeight, EntryGumpID);
AddLabelCropped(x + TextOffsetX, y, NameWidth - TextOffsetX, EntryHeight, TextHue, prop.Name);
x += NameWidth + OffsetSize;
AddImageTiled(x, y, ValueWidth, EntryHeight, EntryGumpID);
AddLabelCropped(x + TextOffsetX, y, ValueWidth - TextOffsetX, EntryHeight, TextHue, ValueToString(prop));
x += ValueWidth + OffsetSize;
if (SetGumpID != 0)
{
AddImageTiled(x, y, SetWidth, EntryHeight, SetGumpID);
}
var cpa = GetCPA(prop);
var canModify = cpa?.ReadOnly == false && m_Mobile.AccessLevel >= cpa.WriteLevel && (prop.CanWrite || cpa.CanModify);
if (cpa?.ReadOnly == false && m_Mobile.AccessLevel >= cpa.WriteLevel && (prop.CanWrite || cpa.CanModify))
{
AddButton(x + SetOffsetX, y + SetOffsetY, SetButtonID1, SetButtonID2, i + 3);
}
this.AddPropsEntryNameValue(
ref x, ref y, NameWidth, ValueWidth,
prop.Name, ValueToString(prop),
canModify, i + 3
);
}
}
}