chore: Removes dead gump code (#2403)

This commit is contained in:
Kamron Batman 2026-04-08 08:39:23 -06:00 • committed by GitHub
parent 5b6ea0c3b5
commit c0d75562be
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
28 changed files with 460 additions and 724 deletions

View file

@ -6,33 +6,28 @@ namespace Server.Gumps
{
protected Property m_Property;
public PropertyException(Property property, string message)
: base(message) =>
m_Property = property;
public PropertyException(Property property, string message) : base(message) => m_Property = property;
public Property Property => m_Property;
}
public abstract class BindingException : PropertyException
{
public BindingException(Property property, string message)
: base(property, message)
public BindingException(Property property, string message) : base(property, message)
{
}
}
public sealed class NotYetBoundException : BindingException
{
public NotYetBoundException(Property property)
: base(property, "Property has not yet been bound.")
public NotYetBoundException(Property property) : base(property, "Property has not yet been bound.")
{
}
}
public sealed class AlreadyBoundException : BindingException
{
public AlreadyBoundException(Property property)
: base(property, "Property has already been bound.")
public AlreadyBoundException(Property property) : base(property, "Property has already been bound.")
{
}
}
@ -47,32 +42,28 @@ namespace Server.Gumps
public sealed class ReadOnlyException : BindingException
{
public ReadOnlyException(Property property)
: base(property, "Property is read-only.")
public ReadOnlyException(Property property) : base(property, "Property is read-only.")
{
}
}
public sealed class WriteOnlyException : BindingException
{
public WriteOnlyException(Property property)
: base(property, "Property is write-only.")
public WriteOnlyException(Property property) : base(property, "Property is write-only.")
{
}
}
public abstract class AccessException : PropertyException
{
public AccessException(Property property, string message)
: base(property, message)
public AccessException(Property property, string message) : base(property, message)
{
}
}
public sealed class InternalAccessException : AccessException
{
public InternalAccessException(Property property)
: base(property, "Property is internal.")
public InternalAccessException(Property property) : base(property, "Property is internal.")
{
}
}

View file

@ -2,8 +2,6 @@ namespace Server.Gumps;
public static class PropsConfig
{
public const bool OldStyle = false;
public const int GumpOffsetX = 30;
public const int GumpOffsetY = 30;
@ -13,14 +11,15 @@ public static class PropsConfig
public const int OffsetGumpID = 0x0A40; // Pure black
// Light off-white, textured : Dark navy blue, textured
public const int HeaderGumpID = OldStyle ? 0x0BBC : 0x0E14;
public const int HeaderGumpID = 0x0E14;
public const int EntryGumpID = 0x0BBC; // Light offwhite, textured
public const int BackGumpID = 0x13BE; // Gray slate/stoney
public const int SetGumpID = OldStyle ? 0x0000 : 0x0E14; // Empty : Dark navy blue, textured
public const int SetGumpID = 0x0E14; // Empty : Dark navy blue, textured
public const int SetWidth = 20;
public const int SetOffsetX = OldStyle ? 4 : 2, SetOffsetY = 2;
public const int SetOffsetX = 2;
public const int SetOffsetY = 2;
public const int SetButtonID1 = 0x15E1; // Arrow pointing right
public const int SetButtonID2 = 0x15E5; // " pressed
@ -39,7 +38,4 @@ public static class PropsConfig
public const int EntryHeight = 20;
public const int BorderSize = 10;
public const int ApplySize = 30;
public const bool PrevLabel = false;
public const bool NextLabel = false;
}

View file

@ -24,27 +24,16 @@ namespace Server.Gumps
public class PropertiesGump : Gump
{
private static readonly bool PrevLabel = OldStyle;
private static readonly bool NextLabel = OldStyle;
private static readonly bool TypeLabel = !OldStyle;
private const int NameWidth = 107;
private const int ValueWidth = 128;
public static readonly int PrevLabelOffsetX = PrevWidth + 1;
private static readonly int PrevLabelOffsetY = 0;
private const int MaxEntriesPerPage = 15;
private static readonly int NextLabelOffsetX = -29;
private static readonly int NextLabelOffsetY = 0;
private const int TypeWidth = NameWidth + OffsetSize + ValueWidth;
private static readonly int NameWidth = 107;
private static readonly int ValueWidth = 128;
private const int TotalWidth = OffsetSize + NameWidth + OffsetSize + ValueWidth + OffsetSize + SetWidth + OffsetSize;
public static readonly int MaxEntriesPerPage = 15;
private static readonly int TypeWidth = NameWidth + OffsetSize + ValueWidth;
private static readonly int TotalWidth =
OffsetSize + NameWidth + OffsetSize + ValueWidth + OffsetSize + SetWidth + OffsetSize;
protected static readonly int BackWidth = BorderSize + TotalWidth + BorderSize;
protected const int BackWidth = BorderSize + TotalWidth + BorderSize;
protected readonly List<object> m_List;
protected readonly Mobile m_Mobile;
@ -125,7 +114,7 @@ namespace Server.Gumps
AddImageTiled(
BorderSize,
BorderSize,
TotalWidth - (OldStyle ? SetWidth + OffsetSize : 0),
TotalWidth,
OffsetSize + (EntryHeight + OffsetSize) * (m_EntryCount + 1),
OffsetGumpID
);
@ -133,60 +122,30 @@ namespace Server.Gumps
var x = BorderSize + OffsetSize;
var y = BorderSize + OffsetSize;
var emptyWidth = TotalWidth - PrevWidth - NextWidth - OffsetSize * 4 - (OldStyle ? SetWidth + OffsetSize : 0);
if (OldStyle)
{
AddImageTiled(x, y, TotalWidth - OffsetSize * 3 - SetWidth, EntryHeight, HeaderGumpID);
}
else
{
AddImageTiled(x, y, PrevWidth, EntryHeight, HeaderGumpID);
}
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);
if (PrevLabel)
{
AddLabel(x + PrevLabelOffsetX, y + PrevLabelOffsetY, TextHue, "Previous");
}
}
x += PrevWidth + OffsetSize;
if (!OldStyle)
{
AddImageTiled(x, y, emptyWidth, EntryHeight, HeaderGumpID);
}
AddImageTiled(x, y, emptyWidth, EntryHeight, HeaderGumpID);
if (TypeLabel && m_Type != null)
if (m_Type != null)
{
AddHtml(
x,
y,
emptyWidth,
EntryHeight,
m_Type.Name.Center(0xFAFAFA)
);
AddHtml(x, y, emptyWidth, EntryHeight, m_Type.Name.Center(0xFAFAFA));
}
x += emptyWidth + OffsetSize;
if (!OldStyle)
{
AddImageTiled(x, y, NextWidth, EntryHeight, HeaderGumpID);
}
AddImageTiled(x, y, NextWidth, EntryHeight, HeaderGumpID);
if ((page + 1) * MaxEntriesPerPage < m_List.Count)
{
AddButton(x + NextOffsetX, y + NextOffsetY, NextButtonID1, NextButtonID2, 2, GumpButtonType.Reply, 1);
if (NextLabel)
{
AddLabel(x + NextLabelOffsetX, y + NextLabelOffsetY, TextHue, "Next");
}
}
for (int i = 0, index = page * MaxEntriesPerPage; i < m_EntryCount && index < m_List.Count; ++i, ++index)
@ -452,12 +411,12 @@ namespace Server.Gumps
if (attrs.Length == 0)
{
return Array.Empty<string>();
return [];
}
if (attrs[0] is not CustomEnumAttribute ce)
{
return Array.Empty<string>();
return [];
}
return ce.Names;
@ -627,7 +586,7 @@ namespace Server.Gumps
}
else
{
groups[type] = new List<PropertyInfo> { prop };
groups[type] = [prop];
}
}
}

View file

@ -31,7 +31,7 @@ namespace Server.Gumps
{
try
{
var info = m_Property.PropertyType.GetMethod("Parse", new[] { typeof(string) });
var info = m_Property.PropertyType.GetMethod("Parse", [typeof(string)]);
string result;
@ -43,7 +43,7 @@ namespace Server.Gumps
m_Object,
m_Property,
m_Property.Name,
info.Invoke(null, new object[] { m_Names[index] }),
info.Invoke(null, [m_Names[index]]),
true
);
}

View file

@ -9,13 +9,14 @@ namespace Server.Gumps
{
public class SetGump : Gump
{
private static readonly int EntryWidth = 212;
private const int EntryWidth = 212;
private static readonly int TotalWidth = OffsetSize + EntryWidth + OffsetSize + SetWidth + OffsetSize;
private static readonly int TotalHeight = OffsetSize + 2 * (EntryHeight + OffsetSize);
private const int TotalWidth = OffsetSize + EntryWidth + OffsetSize + SetWidth + OffsetSize;
private const int TotalHeight = OffsetSize + 2 * (EntryHeight + OffsetSize);
private const int BackWidth = BorderSize + TotalWidth + BorderSize;
private const int BackHeight = BorderSize + TotalHeight + BorderSize;
private static readonly int BackWidth = BorderSize + TotalWidth + BorderSize;
private static readonly int BackHeight = BorderSize + TotalHeight + BorderSize;
private readonly Mobile m_Mobile;
private readonly object m_Object;
private readonly PropertyInfo m_Property;
@ -51,7 +52,7 @@ namespace Server.Gumps
AddImageTiled(
BorderSize,
BorderSize,
TotalWidth - (OldStyle ? SetWidth + OffsetSize : 0),
TotalWidth,
TotalHeight + (canNull ? EntryHeight + OffsetSize : 0) + (canDye ? EntryHeight + OffsetSize : 0),
OffsetGumpID
);
@ -144,7 +145,6 @@ namespace Server.Gumps
}
else
{
toSet = null;
shouldSet = false;
}
@ -202,8 +202,8 @@ namespace Server.Gumps
private readonly PropertyInfo m_Property;
private readonly PropertiesGump m_PropertiesGump;
public InternalPicker(
PropertyInfo prop, Mobile mobile, object o, PropertiesGump propertiesGump) : base(((IHued)o).HuedItemID)
public InternalPicker(PropertyInfo prop, Mobile mobile, object o, PropertiesGump propertiesGump)
: base(((IHued)o).HuedItemID)
{
m_Property = prop;
m_Mobile = mobile;

View file

@ -9,21 +9,12 @@ namespace Server.Gumps
{
public class SetListOptionGump : Gump
{
private static readonly int EntryWidth = 212;
private static readonly int EntryCount = 13;
private const int EntryWidth = 212;
private const int EntryCount = 13;
private static readonly int TotalWidth = OffsetSize + EntryWidth + OffsetSize + SetWidth + OffsetSize;
private const int TotalWidth = OffsetSize + EntryWidth + OffsetSize + SetWidth + OffsetSize;
private static readonly int BackWidth = BorderSize + TotalWidth + BorderSize;
private static readonly bool PrevLabel = OldStyle;
private static readonly bool NextLabel = OldStyle;
private static readonly int PrevLabelOffsetX = PrevWidth + 1;
private static readonly int PrevLabelOffsetY = 0;
private static readonly int NextLabelOffsetX = -29;
private static readonly int NextLabelOffsetY = 0;
private const int BackWidth = BorderSize + TotalWidth + BorderSize;
private readonly object[] m_Values;
protected Mobile m_Mobile;
@ -61,19 +52,12 @@ namespace Server.Gumps
var backHeight = BorderSize + totalHeight + BorderSize;
AddBackground(0, 0, BackWidth, backHeight, BackGumpID);
AddImageTiled(
BorderSize,
BorderSize,
TotalWidth - (OldStyle ? SetWidth + OffsetSize : 0),
totalHeight,
OffsetGumpID
);
AddImageTiled(BorderSize, BorderSize, TotalWidth, totalHeight, OffsetGumpID);
var x = BorderSize + OffsetSize;
var y = BorderSize + OffsetSize;
const int y = BorderSize + OffsetSize;
var emptyWidth = TotalWidth - PrevWidth - NextWidth - OffsetSize * 4 -
(OldStyle ? SetWidth + OffsetSize : 0);
const int emptyWidth = TotalWidth - PrevWidth - NextWidth - OffsetSize * 4;
AddImageTiled(x, y, PrevWidth, EntryHeight, HeaderGumpID);
@ -88,32 +72,15 @@ namespace Server.Gumps
GumpButtonType.Page,
page - 1
);
if (PrevLabel)
{
AddLabel(x + PrevLabelOffsetX, y + PrevLabelOffsetY, TextHue, "Previous");
}
}
x += PrevWidth + OffsetSize;
if (!OldStyle)
{
AddImageTiled(
x - (OldStyle ? OffsetSize : 0),
y,
emptyWidth + (OldStyle ? OffsetSize * 2 : 0),
EntryHeight,
HeaderGumpID
);
}
AddImageTiled(x, y, emptyWidth, EntryHeight, HeaderGumpID);
x += emptyWidth + OffsetSize;
if (!OldStyle)
{
AddImageTiled(x, y, NextWidth, EntryHeight, HeaderGumpID);
}
AddImageTiled(x, y, NextWidth, EntryHeight, HeaderGumpID);
if (page < pages)
{
@ -126,11 +93,6 @@ namespace Server.Gumps
GumpButtonType.Page,
page + 1
);
if (NextLabel)
{
AddLabel(x + NextLabelOffsetX, y + NextLabelOffsetY, TextHue, "Next");
}
}
AddRect(0, prop.Name, 0);

View file

@ -11,13 +11,13 @@ namespace Server.Gumps
{
public class SetObjectGump : Gump
{
private static readonly int EntryWidth = 212;
private const int EntryWidth = 212;
private static readonly int TotalWidth = OffsetSize + EntryWidth + OffsetSize + SetWidth + OffsetSize;
private static readonly int TotalHeight = OffsetSize + 5 * (EntryHeight + OffsetSize);
private const int TotalWidth = OffsetSize + EntryWidth + OffsetSize + SetWidth + OffsetSize;
private const int TotalHeight = OffsetSize + 5 * (EntryHeight + OffsetSize);
private static readonly int BackWidth = BorderSize + TotalWidth + BorderSize;
private static readonly int BackHeight = BorderSize + TotalHeight + BorderSize;
private const int BackWidth = BorderSize + TotalWidth + BorderSize;
private const int BackHeight = BorderSize + TotalHeight + BorderSize;
private readonly Mobile m_Mobile;
private readonly object m_Object;
private readonly PropertyInfo m_Property;
@ -39,13 +39,7 @@ namespace Server.Gumps
AddPage(0);
AddBackground(0, 0, BackWidth, BackHeight, BackGumpID);
AddImageTiled(
BorderSize,
BorderSize,
TotalWidth - (OldStyle ? SetWidth + OffsetSize : 0),
TotalHeight,
OffsetGumpID
);
AddImageTiled(BorderSize, BorderSize, TotalWidth, TotalHeight, OffsetGumpID);
var x = BorderSize + OffsetSize;
var y = BorderSize + OffsetSize;

View file

@ -9,22 +9,20 @@ namespace Server.Gumps
{
public class SetPoint2DGump : Gump
{
private static readonly int CoordWidth = 105;
private static readonly int EntryWidth = CoordWidth + OffsetSize + CoordWidth;
private const int CoordWidth = 105;
private const int EntryWidth = CoordWidth + OffsetSize + CoordWidth;
private static readonly int TotalWidth = OffsetSize + EntryWidth + OffsetSize + SetWidth + OffsetSize;
private static readonly int TotalHeight = OffsetSize + 4 * (EntryHeight + OffsetSize);
private const int TotalWidth = OffsetSize + EntryWidth + OffsetSize + SetWidth + OffsetSize;
private const int TotalHeight = OffsetSize + 4 * (EntryHeight + OffsetSize);
private static readonly int BackWidth = BorderSize + TotalWidth + BorderSize;
private static readonly int BackHeight = BorderSize + TotalHeight + BorderSize;
private const int BackWidth = BorderSize + TotalWidth + BorderSize;
private const int BackHeight = BorderSize + TotalHeight + BorderSize;
private readonly Mobile m_Mobile;
private readonly object m_Object;
private readonly PropertyInfo m_Property;
private readonly PropertiesGump m_PropertiesGump;
public SetPoint2DGump(
PropertyInfo prop, Mobile mobile, object o, PropertiesGump propertiesGump
)
public SetPoint2DGump(PropertyInfo prop, Mobile mobile, object o, PropertiesGump propertiesGump)
: base(GumpOffsetX, GumpOffsetY)
{
m_PropertiesGump = propertiesGump;
@ -37,13 +35,7 @@ namespace Server.Gumps
AddPage(0);
AddBackground(0, 0, BackWidth, BackHeight, BackGumpID);
AddImageTiled(
BorderSize,
BorderSize,
TotalWidth - (OldStyle ? SetWidth + OffsetSize : 0),
TotalHeight,
OffsetGumpID
);
AddImageTiled(BorderSize, BorderSize, TotalWidth, TotalHeight, OffsetGumpID);
var x = BorderSize + OffsetSize;
var y = BorderSize + OffsetSize;
@ -179,9 +171,8 @@ namespace Server.Gumps
private readonly PropertyInfo m_Property;
private readonly PropertiesGump m_PropertiesGump;
public InternalTarget(
PropertyInfo prop, Mobile mobile, object o, PropertiesGump propertiesGump
) : base(-1, true, TargetFlags.None)
public InternalTarget(PropertyInfo prop, Mobile mobile, object o, PropertiesGump propertiesGump)
: base(-1, true, TargetFlags.None)
{
m_Property = prop;
m_Mobile = mobile;

View file

@ -9,23 +9,21 @@ namespace Server.Gumps
{
public class SetPoint3DGump : Gump
{
private static readonly int CoordWidth = 70;
private static readonly int EntryWidth = CoordWidth + OffsetSize + CoordWidth + OffsetSize + CoordWidth;
private const int CoordWidth = 70;
private const int EntryWidth = CoordWidth + OffsetSize + CoordWidth + OffsetSize + CoordWidth;
private static readonly int TotalWidth = OffsetSize + EntryWidth + OffsetSize + SetWidth + OffsetSize;
private static readonly int TotalHeight = OffsetSize + 4 * (EntryHeight + OffsetSize);
private const int TotalWidth = OffsetSize + EntryWidth + OffsetSize + SetWidth + OffsetSize;
private const int TotalHeight = OffsetSize + 4 * (EntryHeight + OffsetSize);
private static readonly int BackWidth = BorderSize + TotalWidth + BorderSize;
private static readonly int BackHeight = BorderSize + TotalHeight + BorderSize;
private const int BackWidth = BorderSize + TotalWidth + BorderSize;
private const int BackHeight = BorderSize + TotalHeight + BorderSize;
private readonly Mobile m_Mobile;
private readonly object m_Object;
private readonly PropertyInfo m_Property;
private readonly PropertiesGump m_PropertiesGump;
public SetPoint3DGump(
PropertyInfo prop, Mobile mobile, object o, PropertiesGump propertiesGump
)
public SetPoint3DGump(PropertyInfo prop, Mobile mobile, object o, PropertiesGump propertiesGump)
: base(GumpOffsetX, GumpOffsetY)
{
m_PropertiesGump = propertiesGump;
@ -38,13 +36,7 @@ namespace Server.Gumps
AddPage(0);
AddBackground(0, 0, BackWidth, BackHeight, BackGumpID);
AddImageTiled(
BorderSize,
BorderSize,
TotalWidth - (OldStyle ? SetWidth + OffsetSize : 0),
TotalHeight,
OffsetGumpID
);
AddImageTiled(BorderSize, BorderSize, TotalWidth, TotalHeight, OffsetGumpID);
var x = BorderSize + OffsetSize;
var y = BorderSize + OffsetSize;
@ -186,9 +178,8 @@ namespace Server.Gumps
private readonly PropertyInfo m_Property;
private readonly PropertiesGump m_PropertiesGump;
public InternalTarget(
PropertyInfo prop, Mobile mobile, object o, PropertiesGump propertiesGump
) : base(-1, true, TargetFlags.None)
public InternalTarget(PropertyInfo prop, Mobile mobile, object o, PropertiesGump propertiesGump)
: base(-1, true, TargetFlags.None)
{
m_PropertiesGump = propertiesGump;
m_Property = prop;

View file

@ -9,13 +9,13 @@ namespace Server.Gumps
{
public class SetTimeSpanGump : Gump
{
private static readonly int EntryWidth = 212;
private const int EntryWidth = 212;
private static readonly int TotalWidth = OffsetSize + EntryWidth + OffsetSize + SetWidth + OffsetSize;
private static readonly int TotalHeight = OffsetSize + 7 * (EntryHeight + OffsetSize);
private const int TotalWidth = OffsetSize + EntryWidth + OffsetSize + SetWidth + OffsetSize;
private const int TotalHeight = OffsetSize + 7 * (EntryHeight + OffsetSize);
private static readonly int BackWidth = BorderSize + TotalWidth + BorderSize;
private static readonly int BackHeight = BorderSize + TotalHeight + BorderSize;
private const int BackWidth = BorderSize + TotalWidth + BorderSize;
private const int BackHeight = BorderSize + TotalHeight + BorderSize;
private readonly Mobile m_Mobile;
private readonly object m_Object;
private readonly PropertyInfo m_Property;
@ -36,13 +36,7 @@ namespace Server.Gumps
AddPage(0);
AddBackground(0, 0, BackWidth, BackHeight, BackGumpID);
AddImageTiled(
BorderSize,
BorderSize,
TotalWidth - (OldStyle ? SetWidth + OffsetSize : 0),
TotalHeight,
OffsetGumpID
);
AddImageTiled(BorderSize, BorderSize, TotalWidth, TotalHeight, OffsetGumpID);
AddRect(0, prop?.Name, 0, -1);
AddRect(1, ts.ToString(), 0, -1);