fix(cleanup): Consolidate the duplicate code in Properties, PropsGump, and PropsConfig (#540)

This commit is contained in:
Kamron Batman 2021-04-14 22:58:56 -07:00 • committed by GitHub
parent 98ce65083a
commit dd2933a9ef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 335 additions and 761 deletions

View file

@ -0,0 +1,109 @@
using System;
namespace Server.Gumps
{
public abstract class PropertyException : Exception
{
protected Property m_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 sealed class NotYetBoundException : BindingException
{
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 sealed class UnknownPropertyException : BindingException
{
public UnknownPropertyException(Property property, string current)
: base(property, $"Property '{current}' not found.")
{
}
}
public sealed class ReadOnlyException : BindingException
{
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 abstract class AccessException : PropertyException
{
public AccessException(Property property, string message)
: base(property, message)
{
}
}
public sealed class InternalAccessException : AccessException
{
public InternalAccessException(Property property)
: base(property, "Property is internal.")
{
}
}
public abstract class ClearanceException : AccessException
{
public ClearanceException(Property property, AccessLevel playerAccess, AccessLevel neededAccess, string accessType)
: base(
property,
$"You must be at least {Mobile.GetAccessLevelName(neededAccess)} to {accessType} this property."
)
{
}
public AccessLevel PlayerAccess { get; set; }
public AccessLevel NeededAccess { get; set; }
}
public sealed class ReadAccessException : ClearanceException
{
public ReadAccessException(Property property, AccessLevel playerAccess, AccessLevel neededAccess)
: base(property, playerAccess, neededAccess, "read")
{
}
}
public sealed class WriteAccessException : ClearanceException
{
public WriteAccessException(Property property, AccessLevel playerAccess, AccessLevel neededAccess)
: base(property, playerAccess, neededAccess, "write")
{
}
}
}

View file

@ -39,5 +39,8 @@ namespace Server.Gumps
public static readonly int EntryHeight = 20;
public static readonly int BorderSize = 10;
public static readonly int ApplySize = 30;
public static readonly bool PrevLabel = false;
public static readonly bool NextLabel = false;
}
}

View file

@ -6,6 +6,10 @@ using Server.Commands.Generic;
using Server.Network;
using CPA = Server.CommandPropertyAttribute;
using static Server.Types;
using static Server.Attributes;
using static Server.Gumps.PropsConfig;
namespace Server.Gumps
{
public class StackEntry
@ -22,40 +26,6 @@ namespace Server.Gumps
public class PropertiesGump : Gump
{
public static readonly bool OldStyle = PropsConfig.OldStyle;
public static readonly int GumpOffsetX = PropsConfig.GumpOffsetX;
public static readonly int GumpOffsetY = PropsConfig.GumpOffsetY;
public static readonly int TextHue = PropsConfig.TextHue;
public static readonly int TextOffsetX = PropsConfig.TextOffsetX;
public static readonly int OffsetGumpID = PropsConfig.OffsetGumpID;
public static readonly int HeaderGumpID = PropsConfig.HeaderGumpID;
public static readonly int EntryGumpID = PropsConfig.EntryGumpID;
public static readonly int BackGumpID = PropsConfig.BackGumpID;
public static readonly int SetGumpID = PropsConfig.SetGumpID;
public static readonly int SetWidth = PropsConfig.SetWidth;
public static readonly int SetOffsetX = PropsConfig.SetOffsetX, SetOffsetY = PropsConfig.SetOffsetY;
public static readonly int SetButtonID1 = PropsConfig.SetButtonID1;
public static readonly int SetButtonID2 = PropsConfig.SetButtonID2;
public static readonly int PrevWidth = PropsConfig.PrevWidth;
public static readonly int PrevOffsetX = PropsConfig.PrevOffsetX, PrevOffsetY = PropsConfig.PrevOffsetY;
public static readonly int PrevButtonID1 = PropsConfig.PrevButtonID1;
public static readonly int PrevButtonID2 = PropsConfig.PrevButtonID2;
public static readonly int NextWidth = PropsConfig.NextWidth;
public static readonly int NextOffsetX = PropsConfig.NextOffsetX, NextOffsetY = PropsConfig.NextOffsetY;
public static readonly int NextButtonID1 = PropsConfig.NextButtonID1;
public static readonly int NextButtonID2 = PropsConfig.NextButtonID2;
public static readonly int OffsetSize = PropsConfig.OffsetSize;
public static readonly int EntryHeight = PropsConfig.EntryHeight;
public static readonly int BorderSize = PropsConfig.BorderSize;
private static readonly bool PrevLabel = OldStyle;
private static readonly bool NextLabel = OldStyle;
private static readonly bool TypeLabel = !OldStyle;
@ -76,56 +46,7 @@ namespace Server.Gumps
private static readonly int TotalWidth =
OffsetSize + NameWidth + OffsetSize + ValueWidth + OffsetSize + SetWidth + OffsetSize;
private static readonly int MaxHeight = OffsetSize + (EntryHeight + OffsetSize) * (MaxEntriesPerPage + 1);
protected static readonly int BackWidth = BorderSize + TotalWidth + BorderSize;
protected static readonly int BackHeight = BorderSize + MaxHeight + BorderSize;
public static readonly string[] BoolNames = { "True", "False" };
public static readonly object[] BoolValues = { true, false };
public static readonly string[] PoisonNames = { "None", "Lesser", "Regular", "Greater", "Deadly", "Lethal" };
public static readonly object[] PoisonValues =
{ null, Poison.Lesser, Poison.Regular, Poison.Greater, Poison.Deadly, Poison.Lethal };
public static readonly Type TypeofMobile = typeof(Mobile);
public static readonly Type TypeofItem = typeof(Item);
public static readonly Type TypeofType = typeof(Type);
public static readonly Type TypeofPoint3D = typeof(Point3D);
public static readonly Type TypeofPoint2D = typeof(Point2D);
public static readonly Type TypeofTimeSpan = typeof(TimeSpan);
public static readonly Type TypeofCustomEnum = typeof(CustomEnumAttribute);
public static readonly Type TypeofEnum = typeof(Enum);
public static readonly Type TypeofBool = typeof(bool);
public static readonly Type TypeofString = typeof(string);
public static readonly Type TypeofText = typeof(TextDefinition);
public static readonly Type TypeofPoison = typeof(Poison);
public static readonly Type TypeofMap = typeof(Map);
public static readonly Type TypeofSkills = typeof(Skills);
public static readonly Type TypeofPropertyObject = typeof(PropertyObjectAttribute);
public static readonly Type TypeofNoSort = typeof(NoSortAttribute);
public static readonly Type[] DecimalTypes =
{
typeof(float),
typeof(double)
};
public static readonly Type[] NumericTypes =
{
typeof(byte),
typeof(short),
typeof(int),
typeof(long),
typeof(sbyte),
typeof(ushort),
typeof(uint),
typeof(ulong)
};
private static readonly Type TypeofCPA = typeof(CPA);
private static readonly Type TypeofObject = typeof(object);
protected readonly List<object> m_List;
protected readonly Mobile m_Mobile;
@ -383,23 +304,23 @@ namespace Server.Gumps
var type = prop.PropertyType;
if (IsType(type, TypeofMobile) || IsType(type, TypeofItem))
if (IsType(type, OfMobile) || IsType(type, OfItem))
{
from.SendGump(new SetObjectGump(prop, from, m_Object, type, this));
}
else if (IsType(type, TypeofType))
else if (IsType(type, OfType))
{
from.Target = new SetObjectTarget(prop, from, m_Object, type, this);
}
else if (IsType(type, TypeofPoint3D))
else if (IsType(type, OfPoint3D))
{
from.SendGump(new SetPoint3DGump(prop, from, m_Object, this));
}
else if (IsType(type, TypeofPoint2D))
else if (IsType(type, OfPoint2D))
{
from.SendGump(new SetPoint2DGump(prop, from, m_Object, this));
}
else if (IsType(type, TypeofTimeSpan))
else if (IsType(type, OfTimeSpan))
{
from.SendGump(new SetTimeSpanGump(prop, from, m_Object, this));
}
@ -415,7 +336,7 @@ namespace Server.Gumps
)
);
}
else if (IsType(type, TypeofEnum))
else if (IsType(type, OfEnum))
{
from.SendGump(
new SetListOptionGump(
@ -428,7 +349,7 @@ namespace Server.Gumps
)
);
}
else if (IsType(type, TypeofBool))
else if (IsType(type, OfBool))
{
from.SendGump(
new SetListOptionGump(
@ -441,13 +362,13 @@ namespace Server.Gumps
)
);
}
else if (IsType(type, TypeofString) || IsType(type, DecimalTypes) ||
else if (IsType(type, OfString) || IsType(type, DecimalTypes) ||
IsType(type, NumericTypes) ||
IsType(type, TypeofText))
IsType(type, OfText))
{
from.SendGump(new SetGump(prop, from, m_Object, this));
}
else if (IsType(type, TypeofPoison))
else if (IsType(type, OfPoison))
{
from.SendGump(
new SetListOptionGump(
@ -460,7 +381,7 @@ namespace Server.Gumps
)
);
}
else if (IsType(type, TypeofMap))
else if (IsType(type, OfMap))
{
from.SendGump(
new SetListOptionGump(
@ -473,12 +394,12 @@ namespace Server.Gumps
)
);
}
else if (IsType(type, TypeofSkills) && m_Object is Mobile mobile)
else if (IsType(type, OfSkills) && m_Object is Mobile mobile)
{
from.SendGump(new PropertiesGump(from, mobile, m_Stack, m_List, m_Page));
from.SendGump(new SkillsGump(from, mobile));
}
else if (HasAttribute(type, TypeofPropertyObject, true))
else if (HasAttribute(type, OfPropertyObject, true))
{
var obj = prop.GetValue(m_Object, null);
@ -512,7 +433,7 @@ namespace Server.Gumps
return list;
}
private static bool IsCustomEnum(Type type) => type.IsDefined(TypeofCustomEnum, false);
private static bool IsCustomEnum(Type type) => type.IsDefined(OfCustomEnum, false);
public void OnValueChanged(object obj, PropertyInfo prop)
{
@ -536,7 +457,7 @@ namespace Server.Gumps
private static string[] GetCustomEnumNames(Type type)
{
var attrs = type.GetCustomAttributes(TypeofCustomEnum, false);
var attrs = type.GetCustomAttributes(OfCustomEnum, false);
if (attrs.Length == 0)
{
@ -551,12 +472,12 @@ namespace Server.Gumps
return ce.Names;
}
public static bool HasAttribute(Type type, Type check, bool inherit) =>
private static bool HasAttribute(Type type, Type check, bool inherit) =>
type.GetCustomAttributes(check, inherit).Length > 0;
public static bool IsType(Type type, Type check) => type == check || type.IsSubclassOf(check);
private static bool IsType(Type type, Type check) => type == check || type.IsSubclassOf(check);
public static bool IsType(Type type, Type[] check)
private static bool IsType(Type type, Type[] check)
{
for (var i = 0; i < check.Length; ++i)
{
@ -569,7 +490,7 @@ namespace Server.Gumps
return false;
}
public string ValueToString(PropertyInfo prop) => ValueToString(m_Object, prop);
private string ValueToString(PropertyInfo prop) => ValueToString(m_Object, prop);
public static string ValueToString(object obj, PropertyInfo prop)
{
@ -583,7 +504,7 @@ namespace Server.Gumps
}
}
public static string ValueToString(object o)
private static string ValueToString(object o)
{
if (o == null)
{
@ -668,7 +589,7 @@ namespace Server.Gumps
{
var kvp = groups[i];
if (!HasAttribute(kvp.Key, TypeofNoSort, false))
if (!HasAttribute(kvp.Key, OfNoSort, false))
{
kvp.Value.Sort(PropertySorter.Instance);
}
@ -694,18 +615,6 @@ namespace Server.Gumps
protected virtual bool ShowAttribute(string name) => true;
public static CPA GetCPA(PropertyInfo prop)
{
var attrs = prop.GetCustomAttributes(TypeofCPA, false);
if (attrs.Length > 0)
{
return attrs[0] as CPA;
}
return null;
}
private List<KeyValuePair<Type, List<PropertyInfo>>> GetGroups(Type objectType, PropertyInfo[] props)
{
var groups = new Dictionary<Type, List<PropertyInfo>>();
@ -726,7 +635,7 @@ namespace Server.Gumps
{
var baseType = type?.BaseType;
if (baseType == TypeofObject || baseType?.GetProperty(prop.Name, prop.PropertyType) == null)
if (baseType == OfObject || baseType?.GetProperty(prop.Name, prop.PropertyType) == null)
{
break;
}
@ -895,7 +804,7 @@ namespace Server.Gumps
int dist;
for (dist = 0; current != null && current != TypeofObject && current != type; ++dist)
for (dist = 0; current != null && current != OfObject && current != type; ++dist)
{
current = current.BaseType;
}

View file

@ -3,44 +3,12 @@ using Server.Commands;
using Server.HuePickers;
using Server.Network;
using static Server.Gumps.PropsConfig;
namespace Server.Gumps
{
public class SetGump : Gump
{
public static readonly bool OldStyle = PropsConfig.OldStyle;
public static readonly int GumpOffsetX = PropsConfig.GumpOffsetX;
public static readonly int GumpOffsetY = PropsConfig.GumpOffsetY;
public static readonly int TextHue = PropsConfig.TextHue;
public static readonly int TextOffsetX = PropsConfig.TextOffsetX;
public static readonly int OffsetGumpID = PropsConfig.OffsetGumpID;
public static readonly int HeaderGumpID = PropsConfig.HeaderGumpID;
public static readonly int EntryGumpID = PropsConfig.EntryGumpID;
public static readonly int BackGumpID = PropsConfig.BackGumpID;
public static readonly int SetGumpID = PropsConfig.SetGumpID;
public static readonly int SetWidth = PropsConfig.SetWidth;
public static readonly int SetOffsetX = PropsConfig.SetOffsetX, SetOffsetY = PropsConfig.SetOffsetY;
public static readonly int SetButtonID1 = PropsConfig.SetButtonID1;
public static readonly int SetButtonID2 = PropsConfig.SetButtonID2;
public static readonly int PrevWidth = PropsConfig.PrevWidth;
public static readonly int PrevOffsetX = PropsConfig.PrevOffsetX, PrevOffsetY = PropsConfig.PrevOffsetY;
public static readonly int PrevButtonID1 = PropsConfig.PrevButtonID1;
public static readonly int PrevButtonID2 = PropsConfig.PrevButtonID2;
public static readonly int NextWidth = PropsConfig.NextWidth;
public static readonly int NextOffsetX = PropsConfig.NextOffsetX, NextOffsetY = PropsConfig.NextOffsetY;
public static readonly int NextButtonID1 = PropsConfig.NextButtonID1;
public static readonly int NextButtonID2 = PropsConfig.NextButtonID2;
public static readonly int OffsetSize = PropsConfig.OffsetSize;
public static readonly int EntryHeight = PropsConfig.EntryHeight;
public static readonly int BorderSize = PropsConfig.BorderSize;
private static readonly int EntryWidth = 212;
private static readonly int TotalWidth = OffsetSize + EntryWidth + OffsetSize + SetWidth + OffsetSize;

View file

@ -2,44 +2,12 @@ using System.Reflection;
using Server.Commands;
using Server.Network;
using static Server.Gumps.PropsConfig;
namespace Server.Gumps
{
public class SetListOptionGump : Gump
{
public static readonly bool OldStyle = PropsConfig.OldStyle;
public static readonly int GumpOffsetX = PropsConfig.GumpOffsetX;
public static readonly int GumpOffsetY = PropsConfig.GumpOffsetY;
public static readonly int TextHue = PropsConfig.TextHue;
public static readonly int TextOffsetX = PropsConfig.TextOffsetX;
public static readonly int OffsetGumpID = PropsConfig.OffsetGumpID;
public static readonly int HeaderGumpID = PropsConfig.HeaderGumpID;
public static readonly int EntryGumpID = PropsConfig.EntryGumpID;
public static readonly int BackGumpID = PropsConfig.BackGumpID;
public static readonly int SetGumpID = PropsConfig.SetGumpID;
public static readonly int SetWidth = PropsConfig.SetWidth;
public static readonly int SetOffsetX = PropsConfig.SetOffsetX, SetOffsetY = PropsConfig.SetOffsetY;
public static readonly int SetButtonID1 = PropsConfig.SetButtonID1;
public static readonly int SetButtonID2 = PropsConfig.SetButtonID2;
public static readonly int PrevWidth = PropsConfig.PrevWidth;
public static readonly int PrevOffsetX = PropsConfig.PrevOffsetX, PrevOffsetY = PropsConfig.PrevOffsetY;
public static readonly int PrevButtonID1 = PropsConfig.PrevButtonID1;
public static readonly int PrevButtonID2 = PropsConfig.PrevButtonID2;
public static readonly int NextWidth = PropsConfig.NextWidth;
public static readonly int NextOffsetX = PropsConfig.NextOffsetX, NextOffsetY = PropsConfig.NextOffsetY;
public static readonly int NextButtonID1 = PropsConfig.NextButtonID1;
public static readonly int NextButtonID2 = PropsConfig.NextButtonID2;
public static readonly int OffsetSize = PropsConfig.OffsetSize;
public static readonly int EntryHeight = PropsConfig.EntryHeight;
public static readonly int BorderSize = PropsConfig.BorderSize;
private static readonly int EntryWidth = 212;
private static readonly int EntryCount = 13;

View file

@ -5,44 +5,12 @@ using Server.Commands.Generic;
using Server.Network;
using Server.Prompts;
using static Server.Gumps.PropsConfig;
namespace Server.Gumps
{
public class SetObjectGump : Gump
{
public static readonly bool OldStyle = PropsConfig.OldStyle;
public static readonly int GumpOffsetX = PropsConfig.GumpOffsetX;
public static readonly int GumpOffsetY = PropsConfig.GumpOffsetY;
public static readonly int TextHue = PropsConfig.TextHue;
public static readonly int TextOffsetX = PropsConfig.TextOffsetX;
public static readonly int OffsetGumpID = PropsConfig.OffsetGumpID;
public static readonly int HeaderGumpID = PropsConfig.HeaderGumpID;
public static readonly int EntryGumpID = PropsConfig.EntryGumpID;
public static readonly int BackGumpID = PropsConfig.BackGumpID;
public static readonly int SetGumpID = PropsConfig.SetGumpID;
public static readonly int SetWidth = PropsConfig.SetWidth;
public static readonly int SetOffsetX = PropsConfig.SetOffsetX, SetOffsetY = PropsConfig.SetOffsetY;
public static readonly int SetButtonID1 = PropsConfig.SetButtonID1;
public static readonly int SetButtonID2 = PropsConfig.SetButtonID2;
public static readonly int PrevWidth = PropsConfig.PrevWidth;
public static readonly int PrevOffsetX = PropsConfig.PrevOffsetX, PrevOffsetY = PropsConfig.PrevOffsetY;
public static readonly int PrevButtonID1 = PropsConfig.PrevButtonID1;
public static readonly int PrevButtonID2 = PropsConfig.PrevButtonID2;
public static readonly int NextWidth = PropsConfig.NextWidth;
public static readonly int NextOffsetX = PropsConfig.NextOffsetX, NextOffsetY = PropsConfig.NextOffsetY;
public static readonly int NextButtonID1 = PropsConfig.NextButtonID1;
public static readonly int NextButtonID2 = PropsConfig.NextButtonID2;
public static readonly int OffsetSize = PropsConfig.OffsetSize;
public static readonly int EntryHeight = PropsConfig.EntryHeight;
public static readonly int BorderSize = PropsConfig.BorderSize;
private static readonly int EntryWidth = 212;
private static readonly int TotalWidth = OffsetSize + EntryWidth + OffsetSize + SetWidth + OffsetSize;

View file

@ -3,44 +3,12 @@ using Server.Commands;
using Server.Network;
using Server.Targeting;
using static Server.Gumps.PropsConfig;
namespace Server.Gumps
{
public class SetPoint2DGump : Gump
{
public static readonly bool OldStyle = PropsConfig.OldStyle;
public static readonly int GumpOffsetX = PropsConfig.GumpOffsetX;
public static readonly int GumpOffsetY = PropsConfig.GumpOffsetY;
public static readonly int TextHue = PropsConfig.TextHue;
public static readonly int TextOffsetX = PropsConfig.TextOffsetX;
public static readonly int OffsetGumpID = PropsConfig.OffsetGumpID;
public static readonly int HeaderGumpID = PropsConfig.HeaderGumpID;
public static readonly int EntryGumpID = PropsConfig.EntryGumpID;
public static readonly int BackGumpID = PropsConfig.BackGumpID;
public static readonly int SetGumpID = PropsConfig.SetGumpID;
public static readonly int SetWidth = PropsConfig.SetWidth;
public static readonly int SetOffsetX = PropsConfig.SetOffsetX, SetOffsetY = PropsConfig.SetOffsetY;
public static readonly int SetButtonID1 = PropsConfig.SetButtonID1;
public static readonly int SetButtonID2 = PropsConfig.SetButtonID2;
public static readonly int PrevWidth = PropsConfig.PrevWidth;
public static readonly int PrevOffsetX = PropsConfig.PrevOffsetX, PrevOffsetY = PropsConfig.PrevOffsetY;
public static readonly int PrevButtonID1 = PropsConfig.PrevButtonID1;
public static readonly int PrevButtonID2 = PropsConfig.PrevButtonID2;
public static readonly int NextWidth = PropsConfig.NextWidth;
public static readonly int NextOffsetX = PropsConfig.NextOffsetX, NextOffsetY = PropsConfig.NextOffsetY;
public static readonly int NextButtonID1 = PropsConfig.NextButtonID1;
public static readonly int NextButtonID2 = PropsConfig.NextButtonID2;
public static readonly int OffsetSize = PropsConfig.OffsetSize;
public static readonly int EntryHeight = PropsConfig.EntryHeight;
public static readonly int BorderSize = PropsConfig.BorderSize;
private static readonly int CoordWidth = 105;
private static readonly int EntryWidth = CoordWidth + OffsetSize + CoordWidth;

View file

@ -3,44 +3,12 @@ using Server.Commands;
using Server.Network;
using Server.Targeting;
using static Server.Gumps.PropsConfig;
namespace Server.Gumps
{
public class SetPoint3DGump : Gump
{
public static readonly bool OldStyle = PropsConfig.OldStyle;
public static readonly int GumpOffsetX = PropsConfig.GumpOffsetX;
public static readonly int GumpOffsetY = PropsConfig.GumpOffsetY;
public static readonly int TextHue = PropsConfig.TextHue;
public static readonly int TextOffsetX = PropsConfig.TextOffsetX;
public static readonly int OffsetGumpID = PropsConfig.OffsetGumpID;
public static readonly int HeaderGumpID = PropsConfig.HeaderGumpID;
public static readonly int EntryGumpID = PropsConfig.EntryGumpID;
public static readonly int BackGumpID = PropsConfig.BackGumpID;
public static readonly int SetGumpID = PropsConfig.SetGumpID;
public static readonly int SetWidth = PropsConfig.SetWidth;
public static readonly int SetOffsetX = PropsConfig.SetOffsetX, SetOffsetY = PropsConfig.SetOffsetY;
public static readonly int SetButtonID1 = PropsConfig.SetButtonID1;
public static readonly int SetButtonID2 = PropsConfig.SetButtonID2;
public static readonly int PrevWidth = PropsConfig.PrevWidth;
public static readonly int PrevOffsetX = PropsConfig.PrevOffsetX, PrevOffsetY = PropsConfig.PrevOffsetY;
public static readonly int PrevButtonID1 = PropsConfig.PrevButtonID1;
public static readonly int PrevButtonID2 = PropsConfig.PrevButtonID2;
public static readonly int NextWidth = PropsConfig.NextWidth;
public static readonly int NextOffsetX = PropsConfig.NextOffsetX, NextOffsetY = PropsConfig.NextOffsetY;
public static readonly int NextButtonID1 = PropsConfig.NextButtonID1;
public static readonly int NextButtonID2 = PropsConfig.NextButtonID2;
public static readonly int OffsetSize = PropsConfig.OffsetSize;
public static readonly int EntryHeight = PropsConfig.EntryHeight;
public static readonly int BorderSize = PropsConfig.BorderSize;
private static readonly int CoordWidth = 70;
private static readonly int EntryWidth = CoordWidth + OffsetSize + CoordWidth + OffsetSize + CoordWidth;
@ -49,6 +17,7 @@ namespace Server.Gumps
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;

View file

@ -3,44 +3,12 @@ using System.Reflection;
using Server.Commands;
using Server.Network;
using static Server.Gumps.PropsConfig;
namespace Server.Gumps
{
public class SetTimeSpanGump : Gump
{
public static readonly bool OldStyle = PropsConfig.OldStyle;
public static readonly int GumpOffsetX = PropsConfig.GumpOffsetX;
public static readonly int GumpOffsetY = PropsConfig.GumpOffsetY;
public static readonly int TextHue = PropsConfig.TextHue;
public static readonly int TextOffsetX = PropsConfig.TextOffsetX;
public static readonly int OffsetGumpID = PropsConfig.OffsetGumpID;
public static readonly int HeaderGumpID = PropsConfig.HeaderGumpID;
public static readonly int EntryGumpID = PropsConfig.EntryGumpID;
public static readonly int BackGumpID = PropsConfig.BackGumpID;
public static readonly int SetGumpID = PropsConfig.SetGumpID;
public static readonly int SetWidth = PropsConfig.SetWidth;
public static readonly int SetOffsetX = PropsConfig.SetOffsetX, SetOffsetY = PropsConfig.SetOffsetY;
public static readonly int SetButtonID1 = PropsConfig.SetButtonID1;
public static readonly int SetButtonID2 = PropsConfig.SetButtonID2;
public static readonly int PrevWidth = PropsConfig.PrevWidth;
public static readonly int PrevOffsetX = PropsConfig.PrevOffsetX, PrevOffsetY = PropsConfig.PrevOffsetY;
public static readonly int PrevButtonID1 = PropsConfig.PrevButtonID1;
public static readonly int PrevButtonID2 = PropsConfig.PrevButtonID2;
public static readonly int NextWidth = PropsConfig.NextWidth;
public static readonly int NextOffsetX = PropsConfig.NextOffsetX, NextOffsetY = PropsConfig.NextOffsetY;
public static readonly int NextButtonID1 = PropsConfig.NextButtonID1;
public static readonly int NextButtonID2 = PropsConfig.NextButtonID2;
public static readonly int OffsetSize = PropsConfig.OffsetSize;
public static readonly int EntryHeight = PropsConfig.EntryHeight;
public static readonly int BorderSize = PropsConfig.BorderSize;
private static readonly int EntryWidth = 212;
private static readonly int TotalWidth = OffsetSize + EntryWidth + OffsetSize + SetWidth + OffsetSize;