Adds style cop (#109)
This commit is contained in:
parent
3e715bcb60
commit
556a17aba8
1725 changed files with 33831 additions and 38046 deletions
|
|
@ -56,8 +56,9 @@ namespace Server.Gumps
|
|||
public static readonly int EntryHeight = PropsConfig.EntryHeight;
|
||||
public static readonly int BorderSize = PropsConfig.BorderSize;
|
||||
|
||||
private static bool PrevLabel = OldStyle, NextLabel = OldStyle;
|
||||
private static bool TypeLabel = !OldStyle;
|
||||
private static readonly bool PrevLabel = OldStyle;
|
||||
private static readonly bool NextLabel = OldStyle;
|
||||
private static readonly bool TypeLabel = !OldStyle;
|
||||
|
||||
private static readonly int PrevLabelOffsetX = PrevWidth + 1;
|
||||
private static readonly int PrevLabelOffsetY = 0;
|
||||
|
|
@ -88,30 +89,30 @@ namespace Server.Gumps
|
|||
public static object[] m_PoisonValues =
|
||||
{ null, Poison.Lesser, Poison.Regular, Poison.Greater, Poison.Deadly, Poison.Lethal };
|
||||
|
||||
private static Type typeofMobile = typeof(Mobile);
|
||||
private static Type typeofItem = typeof(Item);
|
||||
private static Type typeofType = typeof(Type);
|
||||
private static Type typeofPoint3D = typeof(Point3D);
|
||||
private static Type typeofPoint2D = typeof(Point2D);
|
||||
private static Type typeofTimeSpan = typeof(TimeSpan);
|
||||
private static Type typeofCustomEnum = typeof(CustomEnumAttribute);
|
||||
private static Type typeofEnum = typeof(Enum);
|
||||
private static Type typeofBool = typeof(bool);
|
||||
private static Type typeofString = typeof(string);
|
||||
private static Type typeofText = typeof(TextDefinition);
|
||||
private static Type typeofPoison = typeof(Poison);
|
||||
private static Type typeofMap = typeof(Map);
|
||||
private static Type typeofSkills = typeof(Skills);
|
||||
private static Type typeofPropertyObject = typeof(PropertyObjectAttribute);
|
||||
private static Type typeofNoSort = typeof(NoSortAttribute);
|
||||
private static readonly Type typeofMobile = typeof(Mobile);
|
||||
private static readonly Type typeofItem = typeof(Item);
|
||||
private static readonly Type typeofType = typeof(Type);
|
||||
private static readonly Type typeofPoint3D = typeof(Point3D);
|
||||
private static readonly Type typeofPoint2D = typeof(Point2D);
|
||||
private static readonly Type typeofTimeSpan = typeof(TimeSpan);
|
||||
private static readonly Type typeofCustomEnum = typeof(CustomEnumAttribute);
|
||||
private static readonly Type typeofEnum = typeof(Enum);
|
||||
private static readonly Type typeofBool = typeof(bool);
|
||||
private static readonly Type typeofString = typeof(string);
|
||||
private static readonly Type typeofText = typeof(TextDefinition);
|
||||
private static readonly Type typeofPoison = typeof(Poison);
|
||||
private static readonly Type typeofMap = typeof(Map);
|
||||
private static readonly Type typeofSkills = typeof(Skills);
|
||||
private static readonly Type typeofPropertyObject = typeof(PropertyObjectAttribute);
|
||||
private static readonly Type typeofNoSort = typeof(NoSortAttribute);
|
||||
|
||||
private static Type[] typeofReal =
|
||||
private static readonly Type[] typeofReal =
|
||||
{
|
||||
typeof(float),
|
||||
typeof(double)
|
||||
};
|
||||
|
||||
private static Type[] typeofNumeric =
|
||||
private static readonly Type[] typeofNumeric =
|
||||
{
|
||||
typeof(byte),
|
||||
typeof(short),
|
||||
|
|
@ -123,14 +124,14 @@ namespace Server.Gumps
|
|||
typeof(ulong)
|
||||
};
|
||||
|
||||
private static Type typeofCPA = typeof(CPA);
|
||||
private static Type typeofObject = typeof(object);
|
||||
private List<object> m_List;
|
||||
private Mobile m_Mobile;
|
||||
private object m_Object;
|
||||
private static readonly Type typeofCPA = typeof(CPA);
|
||||
private static readonly Type typeofObject = typeof(object);
|
||||
private readonly List<object> m_List;
|
||||
private readonly Mobile m_Mobile;
|
||||
private readonly object m_Object;
|
||||
private int m_Page;
|
||||
private Stack<StackEntry> m_Stack;
|
||||
private Type m_Type;
|
||||
private readonly Stack<StackEntry> m_Stack;
|
||||
private readonly Type m_Type;
|
||||
|
||||
public PropertiesGump(Mobile mobile, object o) : base(GumpOffsetX, GumpOffsetY)
|
||||
{
|
||||
|
|
@ -292,115 +293,115 @@ namespace Server.Gumps
|
|||
switch (info.ButtonID)
|
||||
{
|
||||
case 0: // Closed
|
||||
{
|
||||
if (m_Stack?.Count > 0)
|
||||
{
|
||||
StackEntry entry = m_Stack.Pop();
|
||||
from.SendGump(new PropertiesGump(from, entry.m_Object, m_Stack, null));
|
||||
}
|
||||
if (m_Stack?.Count > 0)
|
||||
{
|
||||
StackEntry entry = m_Stack.Pop();
|
||||
from.SendGump(new PropertiesGump(from, entry.m_Object, m_Stack, null));
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 1: // Previous
|
||||
{
|
||||
if (m_Page > 0)
|
||||
from.SendGump(new PropertiesGump(from, m_Object, m_Stack, m_List, m_Page - 1));
|
||||
|
||||
break;
|
||||
}
|
||||
case 2: // Next
|
||||
{
|
||||
if ((m_Page + 1) * EntryCount < m_List.Count)
|
||||
from.SendGump(new PropertiesGump(from, m_Object, m_Stack, m_List, m_Page + 1));
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
int index = m_Page * EntryCount + (info.ButtonID - 3);
|
||||
|
||||
if (index >= 0 && index < m_List.Count)
|
||||
{
|
||||
PropertyInfo prop = m_List[index] as PropertyInfo;
|
||||
if (m_Page > 0)
|
||||
from.SendGump(new PropertiesGump(from, m_Object, m_Stack, m_List, m_Page - 1));
|
||||
|
||||
if (prop == null)
|
||||
return;
|
||||
|
||||
CPA attr = GetCPA(prop);
|
||||
|
||||
if (prop.GetType().IsValueType && !prop.CanWrite || attr == null || from.AccessLevel < attr.WriteLevel || attr.ReadOnly)
|
||||
return;
|
||||
|
||||
Type type = prop.PropertyType;
|
||||
|
||||
if (IsType(type, typeofMobile) || IsType(type, typeofItem))
|
||||
{
|
||||
from.SendGump(new SetObjectGump(prop, from, m_Object, m_Stack, type, m_Page, m_List));
|
||||
}
|
||||
else if (IsType(type, typeofType))
|
||||
{
|
||||
from.Target = new SetObjectTarget(prop, from, m_Object, m_Stack, type, m_Page, m_List);
|
||||
}
|
||||
else if (IsType(type, typeofPoint3D))
|
||||
{
|
||||
from.SendGump(new SetPoint3DGump(prop, from, m_Object, m_Stack, m_Page, m_List));
|
||||
}
|
||||
else if (IsType(type, typeofPoint2D))
|
||||
{
|
||||
from.SendGump(new SetPoint2DGump(prop, from, m_Object, m_Stack, m_Page, m_List));
|
||||
}
|
||||
else if (IsType(type, typeofTimeSpan))
|
||||
{
|
||||
from.SendGump(new SetTimeSpanGump(prop, from, m_Object, m_Stack, m_Page, m_List));
|
||||
}
|
||||
else if (IsCustomEnum(type))
|
||||
{
|
||||
from.SendGump(new SetCustomEnumGump(prop, from, m_Object, m_Stack, m_Page, m_List,
|
||||
GetCustomEnumNames(type)));
|
||||
}
|
||||
else if (IsType(type, typeofEnum))
|
||||
{
|
||||
from.SendGump(new SetListOptionGump(prop, from, m_Object, m_Stack, m_Page, m_List,
|
||||
Enum.GetNames(type), GetObjects(Enum.GetValues(type))));
|
||||
}
|
||||
else if (IsType(type, typeofBool))
|
||||
{
|
||||
from.SendGump(new SetListOptionGump(prop, from, m_Object, m_Stack, m_Page, m_List, m_BoolNames,
|
||||
m_BoolValues));
|
||||
}
|
||||
else if (IsType(type, typeofString) || IsType(type, typeofReal) || IsType(type, typeofNumeric) ||
|
||||
IsType(type, typeofText))
|
||||
{
|
||||
from.SendGump(new SetGump(prop, from, m_Object, m_Stack, m_Page, m_List));
|
||||
}
|
||||
else if (IsType(type, typeofPoison))
|
||||
{
|
||||
from.SendGump(new SetListOptionGump(prop, from, m_Object, m_Stack, m_Page, m_List, m_PoisonNames,
|
||||
m_PoisonValues));
|
||||
}
|
||||
else if (IsType(type, typeofMap))
|
||||
{
|
||||
from.SendGump(new SetListOptionGump(prop, from, m_Object, m_Stack, m_Page, m_List,
|
||||
Map.GetMapNames(), Map.GetMapValues().ToArray<object>()));
|
||||
}
|
||||
else if (IsType(type, typeofSkills) && 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))
|
||||
{
|
||||
object obj = prop.GetValue(m_Object, null);
|
||||
|
||||
if (obj != null)
|
||||
from.SendGump(new PropertiesGump(from, obj, m_Stack, new StackEntry(m_Object, prop)));
|
||||
else
|
||||
from.SendGump(new PropertiesGump(from, m_Object, m_Stack, m_List, m_Page));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 2: // Next
|
||||
{
|
||||
if ((m_Page + 1) * EntryCount < m_List.Count)
|
||||
from.SendGump(new PropertiesGump(from, m_Object, m_Stack, m_List, m_Page + 1));
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
int index = m_Page * EntryCount + (info.ButtonID - 3);
|
||||
|
||||
if (index >= 0 && index < m_List.Count)
|
||||
{
|
||||
PropertyInfo prop = m_List[index] as PropertyInfo;
|
||||
|
||||
if (prop == null)
|
||||
return;
|
||||
|
||||
CPA attr = GetCPA(prop);
|
||||
|
||||
if ((prop.GetType().IsValueType && !prop.CanWrite) || attr == null || from.AccessLevel < attr.WriteLevel || attr.ReadOnly)
|
||||
return;
|
||||
|
||||
Type type = prop.PropertyType;
|
||||
|
||||
if (IsType(type, typeofMobile) || IsType(type, typeofItem))
|
||||
{
|
||||
from.SendGump(new SetObjectGump(prop, from, m_Object, m_Stack, type, m_Page, m_List));
|
||||
}
|
||||
else if (IsType(type, typeofType))
|
||||
{
|
||||
from.Target = new SetObjectTarget(prop, from, m_Object, m_Stack, type, m_Page, m_List);
|
||||
}
|
||||
else if (IsType(type, typeofPoint3D))
|
||||
{
|
||||
from.SendGump(new SetPoint3DGump(prop, from, m_Object, m_Stack, m_Page, m_List));
|
||||
}
|
||||
else if (IsType(type, typeofPoint2D))
|
||||
{
|
||||
from.SendGump(new SetPoint2DGump(prop, from, m_Object, m_Stack, m_Page, m_List));
|
||||
}
|
||||
else if (IsType(type, typeofTimeSpan))
|
||||
{
|
||||
from.SendGump(new SetTimeSpanGump(prop, from, m_Object, m_Stack, m_Page, m_List));
|
||||
}
|
||||
else if (IsCustomEnum(type))
|
||||
{
|
||||
from.SendGump(new SetCustomEnumGump(prop, from, m_Object, m_Stack, m_Page, m_List,
|
||||
GetCustomEnumNames(type)));
|
||||
}
|
||||
else if (IsType(type, typeofEnum))
|
||||
{
|
||||
from.SendGump(new SetListOptionGump(prop, from, m_Object, m_Stack, m_Page, m_List,
|
||||
Enum.GetNames(type), GetObjects(Enum.GetValues(type))));
|
||||
}
|
||||
else if (IsType(type, typeofBool))
|
||||
{
|
||||
from.SendGump(new SetListOptionGump(prop, from, m_Object, m_Stack, m_Page, m_List, m_BoolNames,
|
||||
m_BoolValues));
|
||||
}
|
||||
else if (IsType(type, typeofString) || IsType(type, typeofReal) || IsType(type, typeofNumeric) ||
|
||||
IsType(type, typeofText))
|
||||
{
|
||||
from.SendGump(new SetGump(prop, from, m_Object, m_Stack, m_Page, m_List));
|
||||
}
|
||||
else if (IsType(type, typeofPoison))
|
||||
{
|
||||
from.SendGump(new SetListOptionGump(prop, from, m_Object, m_Stack, m_Page, m_List, m_PoisonNames,
|
||||
m_PoisonValues));
|
||||
}
|
||||
else if (IsType(type, typeofMap))
|
||||
{
|
||||
from.SendGump(new SetListOptionGump(prop, from, m_Object, m_Stack, m_Page, m_List,
|
||||
Map.GetMapNames(), Map.GetMapValues().ToArray<object>()));
|
||||
}
|
||||
else if (IsType(type, typeofSkills) && 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))
|
||||
{
|
||||
object obj = prop.GetValue(m_Object, null);
|
||||
|
||||
if (obj != null)
|
||||
from.SendGump(new PropertiesGump(from, obj, m_Stack, new StackEntry(m_Object, prop)));
|
||||
else
|
||||
from.SendGump(new PropertiesGump(from, m_Object, m_Stack, m_List, m_Page));
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -435,10 +436,10 @@ namespace Server.Gumps
|
|||
object[] attrs = type.GetCustomAttributes(typeofCustomEnum, false);
|
||||
|
||||
if (attrs.Length == 0)
|
||||
return new string[0];
|
||||
return Array.Empty<string>();
|
||||
|
||||
if (!(attrs[0] is CustomEnumAttribute ce))
|
||||
return new string[0];
|
||||
return Array.Empty<string>();
|
||||
|
||||
return ce.Names;
|
||||
}
|
||||
|
|
@ -561,7 +562,7 @@ namespace Server.Gumps
|
|||
}
|
||||
|
||||
if (type != null && !groups.ContainsKey(type))
|
||||
groups[type] = new List<PropertyInfo>{ prop };
|
||||
groups[type] = new List<PropertyInfo> { prop };
|
||||
else
|
||||
groups[type].Add(prop);
|
||||
}
|
||||
|
|
@ -650,7 +651,7 @@ namespace Server.Gumps
|
|||
|
||||
private class GroupComparer : IComparer<KeyValuePair<Type, List<PropertyInfo>>>
|
||||
{
|
||||
private Type m_Start;
|
||||
private readonly Type m_Start;
|
||||
|
||||
public GroupComparer(Type start) => m_Start = start;
|
||||
|
||||
|
|
|
|||
|
|
@ -13,15 +13,15 @@ namespace Server.Gumps
|
|||
private const int TextColor32 = 0xFFFFFF;
|
||||
|
||||
private static List<InternalEntry> m_Monster, m_Animal, m_Sea, m_Human;
|
||||
private List<object> m_List;
|
||||
private Mobile m_Mobile;
|
||||
private object m_Object;
|
||||
private List<InternalEntry> m_OurList;
|
||||
private int m_OurPage;
|
||||
private ModelBodyType m_OurType;
|
||||
private int m_Page;
|
||||
private PropertyInfo m_Property;
|
||||
private Stack<StackEntry> m_Stack;
|
||||
private readonly List<object> m_List;
|
||||
private readonly Mobile m_Mobile;
|
||||
private readonly object m_Object;
|
||||
private readonly List<InternalEntry> m_OurList;
|
||||
private readonly int m_OurPage;
|
||||
private readonly ModelBodyType m_OurType;
|
||||
private readonly int m_Page;
|
||||
private readonly PropertyInfo m_Property;
|
||||
private readonly Stack<StackEntry> m_Stack;
|
||||
|
||||
public SetBodyGump(PropertyInfo prop, Mobile mobile, object o, Stack<StackEntry> stack, int page, List<object> list,
|
||||
int ourPage = 0, List<InternalEntry> ourList = null, ModelBodyType ourType = ModelBodyType.Invalid)
|
||||
|
|
@ -236,7 +236,7 @@ namespace Server.Gumps
|
|||
|
||||
public class InternalEntry : IComparable<InternalEntry>
|
||||
{
|
||||
private static string[] m_GroupNames =
|
||||
private static readonly string[] m_GroupNames =
|
||||
{
|
||||
"ogres_", "ettins_", "walking_dead_", "gargoyles_",
|
||||
"orcs_", "flails_", "daemons_", "arachnids_",
|
||||
|
|
@ -273,13 +273,13 @@ namespace Server.Gumps
|
|||
DisplayName = DisplayName.Replace('_', ' ');
|
||||
}
|
||||
|
||||
public int Body{ get; }
|
||||
public int Body { get; }
|
||||
|
||||
public int ItemID{ get; }
|
||||
public int ItemID { get; }
|
||||
|
||||
public string Name{ get; }
|
||||
public string Name { get; }
|
||||
|
||||
public string DisplayName{ get; }
|
||||
public string DisplayName { get; }
|
||||
|
||||
public int CompareTo(InternalEntry comp)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ namespace Server.Gumps
|
|||
{
|
||||
public class SetCustomEnumGump : SetListOptionGump
|
||||
{
|
||||
private string[] m_Names;
|
||||
private readonly string[] m_Names;
|
||||
|
||||
public SetCustomEnumGump(PropertyInfo prop, Mobile mobile, object o, Stack<StackEntry> stack, int propspage,
|
||||
List<object> list, string[] names) : base(prop, mobile, o, stack, propspage, list, names, null) =>
|
||||
|
|
|
|||
|
|
@ -49,12 +49,12 @@ namespace Server.Gumps
|
|||
|
||||
private static readonly int BackWidth = BorderSize + TotalWidth + BorderSize;
|
||||
private static readonly int BackHeight = BorderSize + TotalHeight + BorderSize;
|
||||
private List<object> m_List;
|
||||
private Mobile m_Mobile;
|
||||
private object m_Object;
|
||||
private int m_Page;
|
||||
private PropertyInfo m_Property;
|
||||
private Stack<StackEntry> m_Stack;
|
||||
private readonly List<object> m_List;
|
||||
private readonly Mobile m_Mobile;
|
||||
private readonly object m_Object;
|
||||
private readonly int m_Page;
|
||||
private readonly PropertyInfo m_Property;
|
||||
private readonly Stack<StackEntry> m_Stack;
|
||||
|
||||
public SetGump(PropertyInfo prop, Mobile mobile, object o, Stack<StackEntry> stack, int page, List<object> list) : base(
|
||||
GumpOffsetX, GumpOffsetY)
|
||||
|
|
@ -163,65 +163,65 @@ namespace Server.Gumps
|
|||
switch (info.ButtonID)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
TextRelay text = info.GetTextEntry(0);
|
||||
|
||||
if (text != null)
|
||||
{
|
||||
try
|
||||
TextRelay text = info.GetTextEntry(0);
|
||||
|
||||
if (text != null)
|
||||
{
|
||||
toSet = PropertiesGump.GetObjectFromString(m_Property.PropertyType, text.Text);
|
||||
shouldSet = true;
|
||||
try
|
||||
{
|
||||
toSet = PropertiesGump.GetObjectFromString(m_Property.PropertyType, text.Text);
|
||||
shouldSet = true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
toSet = null;
|
||||
shouldSet = false;
|
||||
m_Mobile.SendMessage("Bad format");
|
||||
}
|
||||
}
|
||||
catch
|
||||
else
|
||||
{
|
||||
toSet = null;
|
||||
shouldSet = false;
|
||||
m_Mobile.SendMessage("Bad format");
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
else
|
||||
case 2: // Null
|
||||
{
|
||||
toSet = null;
|
||||
shouldSet = true;
|
||||
|
||||
break;
|
||||
}
|
||||
case 3: // Hue Picker
|
||||
{
|
||||
toSet = null;
|
||||
shouldSet = false;
|
||||
shouldSend = false;
|
||||
|
||||
m_Mobile.SendHuePicker(new InternalPicker(m_Property, m_Mobile, m_Object, m_Stack, m_Page, m_List));
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case 2: // Null
|
||||
{
|
||||
toSet = null;
|
||||
shouldSet = true;
|
||||
|
||||
break;
|
||||
}
|
||||
case 3: // Hue Picker
|
||||
{
|
||||
toSet = null;
|
||||
shouldSet = false;
|
||||
shouldSend = false;
|
||||
|
||||
m_Mobile.SendHuePicker(new InternalPicker(m_Property, m_Mobile, m_Object, m_Stack, m_Page, m_List));
|
||||
|
||||
break;
|
||||
}
|
||||
case 4: // Body Picker
|
||||
{
|
||||
toSet = null;
|
||||
shouldSet = false;
|
||||
shouldSend = false;
|
||||
{
|
||||
toSet = null;
|
||||
shouldSet = false;
|
||||
shouldSend = false;
|
||||
|
||||
m_Mobile.SendGump(new SetBodyGump(m_Property, m_Mobile, m_Object, m_Stack, m_Page, m_List));
|
||||
m_Mobile.SendGump(new SetBodyGump(m_Property, m_Mobile, m_Object, m_Stack, m_Page, m_List));
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
toSet = null;
|
||||
shouldSet = false;
|
||||
{
|
||||
toSet = null;
|
||||
shouldSet = false;
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (shouldSet)
|
||||
|
|
@ -243,12 +243,12 @@ namespace Server.Gumps
|
|||
|
||||
private class InternalPicker : HuePicker
|
||||
{
|
||||
private List<object> m_List;
|
||||
private Mobile m_Mobile;
|
||||
private object m_Object;
|
||||
private int m_Page;
|
||||
private PropertyInfo m_Property;
|
||||
private Stack<StackEntry> m_Stack;
|
||||
private readonly List<object> m_List;
|
||||
private readonly Mobile m_Mobile;
|
||||
private readonly object m_Object;
|
||||
private readonly int m_Page;
|
||||
private readonly PropertyInfo m_Property;
|
||||
private readonly Stack<StackEntry> m_Stack;
|
||||
|
||||
public InternalPicker(PropertyInfo prop, Mobile mobile, object o, Stack<StackEntry> stack, int page,
|
||||
List<object> list) : base(((IHued)o).HuedItemID)
|
||||
|
|
|
|||
|
|
@ -48,7 +48,8 @@ namespace Server.Gumps
|
|||
|
||||
private static readonly int BackWidth = BorderSize + TotalWidth + BorderSize;
|
||||
|
||||
private static bool PrevLabel = OldStyle, NextLabel = OldStyle;
|
||||
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;
|
||||
|
|
@ -62,7 +63,7 @@ namespace Server.Gumps
|
|||
protected PropertyInfo m_Property;
|
||||
protected Stack<StackEntry> m_Stack;
|
||||
|
||||
private object[] m_Values;
|
||||
private readonly object[] m_Values;
|
||||
|
||||
public SetListOptionGump(PropertyInfo prop, Mobile mobile, object o, Stack<StackEntry> stack, int propspage,
|
||||
List<object> list, string[] names, object[] values) : base(GumpOffsetX, GumpOffsetY)
|
||||
|
|
@ -96,7 +97,6 @@ namespace Server.Gumps
|
|||
AddImageTiled(BorderSize, BorderSize, TotalWidth - (OldStyle ? SetWidth + OffsetSize : 0), totalHeight,
|
||||
OffsetGumpID);
|
||||
|
||||
|
||||
int x = BorderSize + OffsetSize;
|
||||
int y = BorderSize + OffsetSize;
|
||||
|
||||
|
|
@ -134,7 +134,6 @@ namespace Server.Gumps
|
|||
AddLabel(x + NextLabelOffsetX, y + NextLabelOffsetY, TextHue, "Next");
|
||||
}
|
||||
|
||||
|
||||
AddRect(0, prop.Name, 0);
|
||||
|
||||
for (int i = 0; i < count; ++i)
|
||||
|
|
|
|||
|
|
@ -51,13 +51,13 @@ namespace Server.Gumps
|
|||
|
||||
private static readonly int BackWidth = BorderSize + TotalWidth + BorderSize;
|
||||
private static readonly int BackHeight = BorderSize + TotalHeight + BorderSize;
|
||||
private List<object> m_List;
|
||||
private Mobile m_Mobile;
|
||||
private object m_Object;
|
||||
private int m_Page;
|
||||
private PropertyInfo m_Property;
|
||||
private Stack<StackEntry> m_Stack;
|
||||
private Type m_Type;
|
||||
private readonly List<object> m_List;
|
||||
private readonly Mobile m_Mobile;
|
||||
private readonly object m_Object;
|
||||
private readonly int m_Page;
|
||||
private readonly PropertyInfo m_Property;
|
||||
private readonly Stack<StackEntry> m_Stack;
|
||||
private readonly Type m_Type;
|
||||
|
||||
public SetObjectGump(PropertyInfo prop, Mobile mobile, object o, Stack<StackEntry> stack, Type type, int page,
|
||||
List<object> list) : base(GumpOffsetX, GumpOffsetY)
|
||||
|
|
@ -145,53 +145,53 @@ namespace Server.Gumps
|
|||
switch (info.ButtonID)
|
||||
{
|
||||
case 0: // closed
|
||||
{
|
||||
m_Mobile.SendGump(new PropertiesGump(m_Mobile, m_Object, m_Stack, m_List, m_Page));
|
||||
shouldSend = false;
|
||||
break;
|
||||
}
|
||||
{
|
||||
m_Mobile.SendGump(new PropertiesGump(m_Mobile, m_Object, m_Stack, m_List, m_Page));
|
||||
shouldSend = false;
|
||||
break;
|
||||
}
|
||||
case 1: // Change by Target
|
||||
{
|
||||
m_Mobile.Target = new SetObjectTarget(m_Property, m_Mobile, m_Object, m_Stack, m_Type, m_Page, m_List);
|
||||
shouldSend = false;
|
||||
break;
|
||||
}
|
||||
{
|
||||
m_Mobile.Target = new SetObjectTarget(m_Property, m_Mobile, m_Object, m_Stack, m_Type, m_Page, m_List);
|
||||
shouldSend = false;
|
||||
break;
|
||||
}
|
||||
case 2: // Change by Serial
|
||||
{
|
||||
shouldSend = false;
|
||||
{
|
||||
shouldSend = false;
|
||||
|
||||
m_Mobile.SendMessage("Enter the serial you wish to find:");
|
||||
m_Mobile.Prompt = new InternalPrompt(m_Property, m_Mobile, m_Object, m_Stack, m_Type, m_Page, m_List);
|
||||
m_Mobile.SendMessage("Enter the serial you wish to find:");
|
||||
m_Mobile.Prompt = new InternalPrompt(m_Property, m_Mobile, m_Object, m_Stack, m_Type, m_Page, m_List);
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 3: // Nullify
|
||||
{
|
||||
try
|
||||
{
|
||||
CommandLogging.LogChangeProperty(m_Mobile, m_Object, m_Property.Name, "(null)");
|
||||
m_Property.SetValue(m_Object, null, null);
|
||||
PropertiesGump.OnValueChanged(m_Object, m_Property, m_Stack);
|
||||
try
|
||||
{
|
||||
CommandLogging.LogChangeProperty(m_Mobile, m_Object, m_Property.Name, "(null)");
|
||||
m_Property.SetValue(m_Object, null, null);
|
||||
PropertiesGump.OnValueChanged(m_Object, m_Property, m_Stack);
|
||||
}
|
||||
catch
|
||||
{
|
||||
m_Mobile.SendMessage("An exception was caught. The property may not have changed.");
|
||||
}
|
||||
break;
|
||||
}
|
||||
catch
|
||||
{
|
||||
m_Mobile.SendMessage("An exception was caught. The property may not have changed.");
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 4: // View Properties
|
||||
{
|
||||
object obj = m_Property.GetValue(m_Object, null);
|
||||
{
|
||||
object obj = m_Property.GetValue(m_Object, null);
|
||||
|
||||
if (obj == null)
|
||||
m_Mobile.SendMessage("The property is null and so you cannot view its properties.");
|
||||
else if (!BaseCommand.IsAccessible(m_Mobile, obj))
|
||||
m_Mobile.SendMessage("You may not view their properties.");
|
||||
else
|
||||
viewProps = obj;
|
||||
if (obj == null)
|
||||
m_Mobile.SendMessage("The property is null and so you cannot view its properties.");
|
||||
else if (!BaseCommand.IsAccessible(m_Mobile, obj))
|
||||
m_Mobile.SendMessage("You may not view their properties.");
|
||||
else
|
||||
viewProps = obj;
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (shouldSend)
|
||||
|
|
@ -203,13 +203,13 @@ namespace Server.Gumps
|
|||
|
||||
private class InternalPrompt : Prompt
|
||||
{
|
||||
private List<object> m_List;
|
||||
private Mobile m_Mobile;
|
||||
private object m_Object;
|
||||
private int m_Page;
|
||||
private PropertyInfo m_Property;
|
||||
private Stack<StackEntry> m_Stack;
|
||||
private Type m_Type;
|
||||
private readonly List<object> m_List;
|
||||
private readonly Mobile m_Mobile;
|
||||
private readonly object m_Object;
|
||||
private readonly int m_Page;
|
||||
private readonly PropertyInfo m_Property;
|
||||
private readonly Stack<StackEntry> m_Stack;
|
||||
private readonly Type m_Type;
|
||||
|
||||
public InternalPrompt(PropertyInfo prop, Mobile mobile, object o, Stack<StackEntry> stack, Type type, int page,
|
||||
List<object> list)
|
||||
|
|
|
|||
|
|
@ -9,13 +9,13 @@ namespace Server.Gumps
|
|||
{
|
||||
public class SetObjectTarget : Target
|
||||
{
|
||||
private List<object> m_List;
|
||||
private Mobile m_Mobile;
|
||||
private object m_Object;
|
||||
private int m_Page;
|
||||
private PropertyInfo m_Property;
|
||||
private Stack<StackEntry> m_Stack;
|
||||
private Type m_Type;
|
||||
private readonly List<object> m_List;
|
||||
private readonly Mobile m_Mobile;
|
||||
private readonly object m_Object;
|
||||
private readonly int m_Page;
|
||||
private readonly PropertyInfo m_Property;
|
||||
private readonly Stack<StackEntry> m_Stack;
|
||||
private readonly Type m_Type;
|
||||
|
||||
public SetObjectTarget(PropertyInfo prop, Mobile mobile, object o, Stack<StackEntry> stack, Type type, int page,
|
||||
List<object> list) : base(-1, false, TargetFlags.None)
|
||||
|
|
|
|||
|
|
@ -50,12 +50,12 @@ namespace Server.Gumps
|
|||
|
||||
private static readonly int BackWidth = BorderSize + TotalWidth + BorderSize;
|
||||
private static readonly int BackHeight = BorderSize + TotalHeight + BorderSize;
|
||||
private List<object> m_List;
|
||||
private Mobile m_Mobile;
|
||||
private object m_Object;
|
||||
private int m_Page;
|
||||
private PropertyInfo m_Property;
|
||||
private Stack<StackEntry> m_Stack;
|
||||
private readonly List<object> m_List;
|
||||
private readonly Mobile m_Mobile;
|
||||
private readonly object m_Object;
|
||||
private readonly int m_Page;
|
||||
private readonly PropertyInfo m_Property;
|
||||
private readonly Stack<StackEntry> m_Stack;
|
||||
|
||||
public SetPoint2DGump(PropertyInfo prop, Mobile mobile, object o, Stack<StackEntry> stack, int page, List<object> list)
|
||||
: base(GumpOffsetX, GumpOffsetY)
|
||||
|
|
@ -133,42 +133,42 @@ namespace Server.Gumps
|
|||
switch (info.ButtonID)
|
||||
{
|
||||
case 1: // Current location
|
||||
{
|
||||
toSet = new Point2D(m_Mobile.Location);
|
||||
shouldSet = true;
|
||||
shouldSend = true;
|
||||
{
|
||||
toSet = new Point2D(m_Mobile.Location);
|
||||
shouldSet = true;
|
||||
shouldSend = true;
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 2: // Pick location
|
||||
{
|
||||
m_Mobile.Target = new InternalTarget(m_Property, m_Mobile, m_Object, m_Stack, m_Page, m_List);
|
||||
{
|
||||
m_Mobile.Target = new InternalTarget(m_Property, m_Mobile, m_Object, m_Stack, m_Page, m_List);
|
||||
|
||||
toSet = Point2D.Zero;
|
||||
shouldSet = false;
|
||||
shouldSend = false;
|
||||
toSet = Point2D.Zero;
|
||||
shouldSet = false;
|
||||
shouldSend = false;
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 3: // Use values
|
||||
{
|
||||
TextRelay x = info.GetTextEntry(0);
|
||||
TextRelay y = info.GetTextEntry(1);
|
||||
{
|
||||
TextRelay x = info.GetTextEntry(0);
|
||||
TextRelay y = info.GetTextEntry(1);
|
||||
|
||||
toSet = new Point2D(x == null ? 0 : Utility.ToInt32(x.Text), y == null ? 0 : Utility.ToInt32(y.Text));
|
||||
shouldSet = true;
|
||||
shouldSend = true;
|
||||
toSet = new Point2D(x == null ? 0 : Utility.ToInt32(x.Text), y == null ? 0 : Utility.ToInt32(y.Text));
|
||||
shouldSet = true;
|
||||
shouldSend = true;
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
toSet = Point2D.Zero;
|
||||
shouldSet = false;
|
||||
shouldSend = true;
|
||||
{
|
||||
toSet = Point2D.Zero;
|
||||
shouldSet = false;
|
||||
shouldSend = true;
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (shouldSet)
|
||||
|
|
@ -189,12 +189,12 @@ namespace Server.Gumps
|
|||
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private List<object> m_List;
|
||||
private Mobile m_Mobile;
|
||||
private object m_Object;
|
||||
private int m_Page;
|
||||
private PropertyInfo m_Property;
|
||||
private Stack<StackEntry> m_Stack;
|
||||
private readonly List<object> m_List;
|
||||
private readonly Mobile m_Mobile;
|
||||
private readonly object m_Object;
|
||||
private readonly int m_Page;
|
||||
private readonly PropertyInfo m_Property;
|
||||
private readonly Stack<StackEntry> m_Stack;
|
||||
|
||||
public InternalTarget(PropertyInfo prop, Mobile mobile, object o, Stack<StackEntry> stack, int page,
|
||||
List<object> list) : base(-1, true, TargetFlags.None)
|
||||
|
|
|
|||
|
|
@ -50,12 +50,12 @@ namespace Server.Gumps
|
|||
|
||||
private static readonly int BackWidth = BorderSize + TotalWidth + BorderSize;
|
||||
private static readonly int BackHeight = BorderSize + TotalHeight + BorderSize;
|
||||
private List<object> m_List;
|
||||
private Mobile m_Mobile;
|
||||
private object m_Object;
|
||||
private int m_Page;
|
||||
private PropertyInfo m_Property;
|
||||
private Stack<StackEntry> m_Stack;
|
||||
private readonly List<object> m_List;
|
||||
private readonly Mobile m_Mobile;
|
||||
private readonly object m_Object;
|
||||
private readonly int m_Page;
|
||||
private readonly PropertyInfo m_Property;
|
||||
private readonly Stack<StackEntry> m_Stack;
|
||||
|
||||
public SetPoint3DGump(PropertyInfo prop, Mobile mobile, object o, Stack<StackEntry> stack, int page, List<object> list)
|
||||
: base(GumpOffsetX, GumpOffsetY)
|
||||
|
|
@ -138,44 +138,44 @@ namespace Server.Gumps
|
|||
switch (info.ButtonID)
|
||||
{
|
||||
case 1: // Current location
|
||||
{
|
||||
toSet = m_Mobile.Location;
|
||||
shouldSet = true;
|
||||
shouldSend = true;
|
||||
{
|
||||
toSet = m_Mobile.Location;
|
||||
shouldSet = true;
|
||||
shouldSend = true;
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 2: // Pick location
|
||||
{
|
||||
m_Mobile.Target = new InternalTarget(m_Property, m_Mobile, m_Object, m_Stack, m_Page, m_List);
|
||||
{
|
||||
m_Mobile.Target = new InternalTarget(m_Property, m_Mobile, m_Object, m_Stack, m_Page, m_List);
|
||||
|
||||
toSet = Point3D.Zero;
|
||||
shouldSet = false;
|
||||
shouldSend = false;
|
||||
toSet = Point3D.Zero;
|
||||
shouldSet = false;
|
||||
shouldSend = false;
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 3: // Use values
|
||||
{
|
||||
TextRelay x = info.GetTextEntry(0);
|
||||
TextRelay y = info.GetTextEntry(1);
|
||||
TextRelay z = info.GetTextEntry(2);
|
||||
{
|
||||
TextRelay x = info.GetTextEntry(0);
|
||||
TextRelay y = info.GetTextEntry(1);
|
||||
TextRelay z = info.GetTextEntry(2);
|
||||
|
||||
toSet = new Point3D(x == null ? 0 : Utility.ToInt32(x.Text), y == null ? 0 : Utility.ToInt32(y.Text),
|
||||
z == null ? 0 : Utility.ToInt32(z.Text));
|
||||
shouldSet = true;
|
||||
shouldSend = true;
|
||||
toSet = new Point3D(x == null ? 0 : Utility.ToInt32(x.Text), y == null ? 0 : Utility.ToInt32(y.Text),
|
||||
z == null ? 0 : Utility.ToInt32(z.Text));
|
||||
shouldSet = true;
|
||||
shouldSend = true;
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
toSet = Point3D.Zero;
|
||||
shouldSet = false;
|
||||
shouldSend = true;
|
||||
{
|
||||
toSet = Point3D.Zero;
|
||||
shouldSet = false;
|
||||
shouldSend = true;
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (shouldSet)
|
||||
|
|
@ -196,12 +196,12 @@ namespace Server.Gumps
|
|||
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private List<object> m_List;
|
||||
private Mobile m_Mobile;
|
||||
private object m_Object;
|
||||
private int m_Page;
|
||||
private PropertyInfo m_Property;
|
||||
private Stack<StackEntry> m_Stack;
|
||||
private readonly List<object> m_List;
|
||||
private readonly Mobile m_Mobile;
|
||||
private readonly object m_Object;
|
||||
private readonly int m_Page;
|
||||
private readonly PropertyInfo m_Property;
|
||||
private readonly Stack<StackEntry> m_Stack;
|
||||
|
||||
public InternalTarget(PropertyInfo prop, Mobile mobile, object o, Stack<StackEntry> stack, int page,
|
||||
List<object> list) : base(-1, true, TargetFlags.None)
|
||||
|
|
|
|||
|
|
@ -49,12 +49,12 @@ namespace Server.Gumps
|
|||
|
||||
private static readonly int BackWidth = BorderSize + TotalWidth + BorderSize;
|
||||
private static readonly int BackHeight = BorderSize + TotalHeight + BorderSize;
|
||||
private List<object> m_List;
|
||||
private Mobile m_Mobile;
|
||||
private object m_Object;
|
||||
private int m_Page;
|
||||
private PropertyInfo m_Property;
|
||||
private Stack<StackEntry> m_Stack;
|
||||
private readonly List<object> m_List;
|
||||
private readonly Mobile m_Mobile;
|
||||
private readonly object m_Object;
|
||||
private readonly int m_Page;
|
||||
private readonly PropertyInfo m_Property;
|
||||
private readonly Stack<StackEntry> m_Stack;
|
||||
|
||||
public SetTimeSpanGump(PropertyInfo prop, Mobile mobile, object o, Stack<StackEntry> stack, int page, List<object> list)
|
||||
: base(GumpOffsetX, GumpOffsetY)
|
||||
|
|
@ -115,99 +115,99 @@ namespace Server.Gumps
|
|||
switch (info.ButtonID)
|
||||
{
|
||||
case 1: // Zero
|
||||
{
|
||||
toSet = TimeSpan.Zero;
|
||||
shouldSet = true;
|
||||
shouldSend = true;
|
||||
|
||||
break;
|
||||
}
|
||||
case 2: // From H:M:S
|
||||
{
|
||||
bool successfulParse = false;
|
||||
if (h != null && m != null && s != null)
|
||||
successfulParse = TimeSpan.TryParse($"{h.Text}:{m.Text}:{s.Text}", out toSet);
|
||||
else
|
||||
{
|
||||
toSet = TimeSpan.Zero;
|
||||
shouldSet = true;
|
||||
shouldSend = true;
|
||||
|
||||
shouldSet = shouldSend = successfulParse;
|
||||
break;
|
||||
}
|
||||
case 2: // From H:M:S
|
||||
{
|
||||
bool successfulParse = false;
|
||||
if (h != null && m != null && s != null)
|
||||
successfulParse = TimeSpan.TryParse($"{h.Text}:{m.Text}:{s.Text}", out toSet);
|
||||
else
|
||||
toSet = TimeSpan.Zero;
|
||||
|
||||
break;
|
||||
}
|
||||
shouldSet = shouldSend = successfulParse;
|
||||
|
||||
break;
|
||||
}
|
||||
case 3: // From H
|
||||
{
|
||||
if (h != null)
|
||||
try
|
||||
{
|
||||
toSet = TimeSpan.FromHours(Utility.ToDouble(h.Text));
|
||||
shouldSet = true;
|
||||
shouldSend = true;
|
||||
{
|
||||
if (h != null)
|
||||
try
|
||||
{
|
||||
toSet = TimeSpan.FromHours(Utility.ToDouble(h.Text));
|
||||
shouldSet = true;
|
||||
shouldSend = true;
|
||||
|
||||
break;
|
||||
}
|
||||
catch
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
break;
|
||||
}
|
||||
catch
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
|
||||
toSet = TimeSpan.Zero;
|
||||
shouldSet = false;
|
||||
shouldSend = false;
|
||||
toSet = TimeSpan.Zero;
|
||||
shouldSet = false;
|
||||
shouldSend = false;
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 4: // From M
|
||||
{
|
||||
if (m != null)
|
||||
try
|
||||
{
|
||||
toSet = TimeSpan.FromMinutes(Utility.ToDouble(m.Text));
|
||||
shouldSet = true;
|
||||
shouldSend = true;
|
||||
{
|
||||
if (m != null)
|
||||
try
|
||||
{
|
||||
toSet = TimeSpan.FromMinutes(Utility.ToDouble(m.Text));
|
||||
shouldSet = true;
|
||||
shouldSend = true;
|
||||
|
||||
break;
|
||||
}
|
||||
catch
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
break;
|
||||
}
|
||||
catch
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
|
||||
toSet = TimeSpan.Zero;
|
||||
shouldSet = false;
|
||||
shouldSend = false;
|
||||
toSet = TimeSpan.Zero;
|
||||
shouldSet = false;
|
||||
shouldSend = false;
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 5: // From S
|
||||
{
|
||||
if (s != null)
|
||||
try
|
||||
{
|
||||
toSet = TimeSpan.FromSeconds(Utility.ToDouble(s.Text));
|
||||
shouldSet = true;
|
||||
shouldSend = true;
|
||||
{
|
||||
if (s != null)
|
||||
try
|
||||
{
|
||||
toSet = TimeSpan.FromSeconds(Utility.ToDouble(s.Text));
|
||||
shouldSet = true;
|
||||
shouldSend = true;
|
||||
|
||||
break;
|
||||
}
|
||||
catch
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
break;
|
||||
}
|
||||
catch
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
|
||||
toSet = TimeSpan.Zero;
|
||||
shouldSet = false;
|
||||
shouldSend = false;
|
||||
toSet = TimeSpan.Zero;
|
||||
shouldSet = false;
|
||||
shouldSend = false;
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
toSet = TimeSpan.Zero;
|
||||
shouldSet = false;
|
||||
shouldSend = true;
|
||||
{
|
||||
toSet = TimeSpan.Zero;
|
||||
shouldSet = false;
|
||||
shouldSend = true;
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (shouldSet)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue