Adds style cop (#109)
This commit is contained in:
parent
3e715bcb60
commit
556a17aba8
1725 changed files with 33831 additions and 38046 deletions
|
|
@ -9,20 +9,20 @@ namespace Server.Commands
|
|||
{
|
||||
public class Add
|
||||
{
|
||||
private static Type m_EntityType = typeof(IEntity);
|
||||
private static readonly Type m_EntityType = typeof(IEntity);
|
||||
|
||||
private static Type m_ConstructibleType = typeof(ConstructibleAttribute);
|
||||
private static readonly Type m_ConstructibleType = typeof(ConstructibleAttribute);
|
||||
|
||||
private static Type m_EnumType = typeof(Enum);
|
||||
private static readonly Type m_EnumType = typeof(Enum);
|
||||
|
||||
private static Type m_TypeType = typeof(Type);
|
||||
private static readonly Type m_TypeType = typeof(Type);
|
||||
|
||||
private static Type m_ParsableType = typeof(ParsableAttribute);
|
||||
private static readonly Type m_ParsableType = typeof(ParsableAttribute);
|
||||
|
||||
private static Type[] m_ParseTypes = { typeof(string) };
|
||||
private static object[] m_ParseArgs = new object[1];
|
||||
private static readonly Type[] m_ParseTypes = { typeof(string) };
|
||||
private static readonly object[] m_ParseArgs = new object[1];
|
||||
|
||||
private static Type[] m_SignedNumerics =
|
||||
private static readonly Type[] m_SignedNumerics =
|
||||
{
|
||||
typeof(long),
|
||||
typeof(int),
|
||||
|
|
@ -30,7 +30,7 @@ namespace Server.Commands
|
|||
typeof(sbyte)
|
||||
};
|
||||
|
||||
private static Type[] m_UnsignedNumerics =
|
||||
private static readonly Type[] m_UnsignedNumerics =
|
||||
{
|
||||
typeof(ulong),
|
||||
typeof(uint),
|
||||
|
|
@ -198,7 +198,6 @@ namespace Server.Commands
|
|||
if (!paramList[j].HasDefaultValue)
|
||||
totalParams += 1;
|
||||
|
||||
|
||||
if (args.Length >= totalParams && args.Length <= paramList.Length)
|
||||
{
|
||||
object[] paramValues = ParseValues(paramList, args);
|
||||
|
|
@ -348,23 +347,23 @@ namespace Server.Commands
|
|||
int z = start.Z;
|
||||
|
||||
for (int x = start.X; x <= end.X; ++x)
|
||||
for (int y = start.Y; y <= end.Y; ++y)
|
||||
{
|
||||
if (outline && x != start.X && x != end.X && y != start.Y && y != end.Y)
|
||||
continue;
|
||||
for (int y = start.Y; y <= end.Y; ++y)
|
||||
{
|
||||
if (outline && x != start.X && x != end.X && y != start.Y && y != end.Y)
|
||||
continue;
|
||||
|
||||
if (mapAvg)
|
||||
z = map.GetAverageZ(x, y);
|
||||
if (mapAvg)
|
||||
z = map.GetAverageZ(x, y);
|
||||
|
||||
IEntity built = Build(from, ctor, values, props, realProps, ref sendError);
|
||||
IEntity built = Build(from, ctor, values, props, realProps, ref sendError);
|
||||
|
||||
sb.AppendFormat("0x{0:X}; ", built.Serial.Value);
|
||||
sb.AppendFormat("0x{0:X}; ", built.Serial.Value);
|
||||
|
||||
if (built is Item item)
|
||||
item.MoveToWorld(new Point3D(x, y, z), map);
|
||||
else if (built is Mobile m)
|
||||
m.MoveToWorld(new Point3D(x, y, z), map);
|
||||
}
|
||||
if (built is Item item)
|
||||
item.MoveToWorld(new Point3D(x, y, z), map);
|
||||
else if (built is Mobile m)
|
||||
m.MoveToWorld(new Point3D(x, y, z), map);
|
||||
}
|
||||
}
|
||||
|
||||
CommandLogging.WriteLine(from, sb.ToString());
|
||||
|
|
@ -433,15 +432,15 @@ namespace Server.Commands
|
|||
switch (ts.m_ZType)
|
||||
{
|
||||
case TileZType.Fixed:
|
||||
{
|
||||
start.Z = end.Z = ts.m_FixedZ;
|
||||
break;
|
||||
}
|
||||
{
|
||||
start.Z = end.Z = ts.m_FixedZ;
|
||||
break;
|
||||
}
|
||||
case TileZType.MapAverage:
|
||||
{
|
||||
mapAvg = true;
|
||||
break;
|
||||
}
|
||||
{
|
||||
mapAvg = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Invoke(from, start, end, ts.m_Args, null, ts.m_Outline, mapAvg);
|
||||
|
|
@ -667,10 +666,10 @@ namespace Server.Commands
|
|||
|
||||
private class TileState
|
||||
{
|
||||
public string[] m_Args;
|
||||
public int m_FixedZ;
|
||||
public bool m_Outline;
|
||||
public TileZType m_ZType;
|
||||
public readonly string[] m_Args;
|
||||
public readonly int m_FixedZ;
|
||||
public readonly bool m_Outline;
|
||||
public readonly TileZType m_ZType;
|
||||
|
||||
public TileState(TileZType zType, int fixedZ, string[] args, bool outline)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -6,20 +6,20 @@ namespace Server
|
|||
{
|
||||
public UsageAttribute(string usage) => Usage = usage;
|
||||
|
||||
public string Usage{ get; }
|
||||
public string Usage { get; }
|
||||
}
|
||||
|
||||
public class DescriptionAttribute : Attribute
|
||||
{
|
||||
public DescriptionAttribute(string description) => Description = description;
|
||||
|
||||
public string Description{ get; }
|
||||
public string Description { get; }
|
||||
}
|
||||
|
||||
public class AliasesAttribute : Attribute
|
||||
{
|
||||
public AliasesAttribute(params string[] aliases) => Aliases = aliases;
|
||||
|
||||
public string[] Aliases{ get; }
|
||||
public string[] Aliases { get; }
|
||||
}
|
||||
}
|
||||
|
|
@ -15,11 +15,11 @@ namespace Server.Commands
|
|||
ListOptimized = true;
|
||||
}
|
||||
|
||||
public BaseCommandImplementor Scope{ get; set; }
|
||||
public BaseCommandImplementor Scope { get; set; }
|
||||
|
||||
public string Condition{ get; set; } = "";
|
||||
public string Condition { get; set; } = "";
|
||||
|
||||
public List<BatchCommand> BatchCommands{ get; } = new List<BatchCommand>();
|
||||
public List<BatchCommand> BatchCommands { get; } = new List<BatchCommand>();
|
||||
|
||||
public override void ExecuteList(CommandEventArgs e, List<object> list)
|
||||
{
|
||||
|
|
@ -180,9 +180,9 @@ namespace Server.Commands
|
|||
Object = obj;
|
||||
}
|
||||
|
||||
public string Command{ get; set; }
|
||||
public string Command { get; set; }
|
||||
|
||||
public string Object{ get; set; }
|
||||
public string Object { get; set; }
|
||||
|
||||
public void GetDetails(out string command, out string argString, out string[] args)
|
||||
{
|
||||
|
|
@ -199,15 +199,15 @@ namespace Server.Commands
|
|||
{
|
||||
argString = "";
|
||||
command = Command.ToLower();
|
||||
args = new string[0];
|
||||
args = Array.Empty<string>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class BatchGump : BaseGridGump
|
||||
{
|
||||
private Batch m_Batch;
|
||||
private Mobile m_From;
|
||||
private readonly Batch m_Batch;
|
||||
private readonly Mobile m_From;
|
||||
|
||||
public BatchGump(Mobile from, Batch batch) : base(30, 30)
|
||||
{
|
||||
|
|
@ -326,28 +326,28 @@ namespace Server.Commands
|
|||
switch (type)
|
||||
{
|
||||
case 0: // main
|
||||
{
|
||||
switch (index)
|
||||
{
|
||||
case 0: // run
|
||||
switch (index)
|
||||
{
|
||||
m_Batch.Run(m_From);
|
||||
break;
|
||||
case 0: // run
|
||||
{
|
||||
m_Batch.Run(m_From);
|
||||
break;
|
||||
}
|
||||
case 1: // set scope
|
||||
{
|
||||
m_From.SendGump(new BatchScopeGump(m_From, m_Batch));
|
||||
return;
|
||||
}
|
||||
case 2: // add command
|
||||
{
|
||||
m_Batch.BatchCommands.Add(new BatchCommand("", ""));
|
||||
break;
|
||||
}
|
||||
}
|
||||
case 1: // set scope
|
||||
{
|
||||
m_From.SendGump(new BatchScopeGump(m_From, m_Batch));
|
||||
return;
|
||||
}
|
||||
case 2: // add command
|
||||
{
|
||||
m_Batch.BatchCommands.Add(new BatchCommand("", ""));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
m_From.SendGump(new BatchGump(m_From, m_Batch));
|
||||
|
|
@ -356,8 +356,8 @@ namespace Server.Commands
|
|||
|
||||
public class BatchScopeGump : BaseGridGump
|
||||
{
|
||||
private Batch m_Batch;
|
||||
private Mobile m_From;
|
||||
private readonly Batch m_Batch;
|
||||
private readonly Mobile m_From;
|
||||
|
||||
public BatchScopeGump(Mobile from, Batch batch) : base(30, 30)
|
||||
{
|
||||
|
|
@ -399,17 +399,17 @@ namespace Server.Commands
|
|||
switch (type)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
if (index < BaseCommandImplementor.Implementors.Count)
|
||||
{
|
||||
BaseCommandImplementor impl = BaseCommandImplementor.Implementors[index];
|
||||
if (index < BaseCommandImplementor.Implementors.Count)
|
||||
{
|
||||
BaseCommandImplementor impl = BaseCommandImplementor.Implementors[index];
|
||||
|
||||
if (m_From.AccessLevel >= impl.AccessLevel)
|
||||
m_Batch.Scope = impl;
|
||||
if (m_From.AccessLevel >= impl.AccessLevel)
|
||||
m_Batch.Scope = impl;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
m_From.SendGump(new BatchGump(m_From, m_Batch));
|
||||
|
|
|
|||
|
|
@ -14,10 +14,10 @@ namespace Server
|
|||
|
||||
private class PickTarget : Target
|
||||
{
|
||||
private BoundingBoxCallback m_Callback;
|
||||
private bool m_First;
|
||||
private Map m_Map;
|
||||
private Point3D m_Store;
|
||||
private readonly BoundingBoxCallback m_Callback;
|
||||
private readonly bool m_First;
|
||||
private readonly Map m_Map;
|
||||
private readonly Point3D m_Store;
|
||||
|
||||
public PickTarget(BoundingBoxCallback callback) : this(Point3D.Zero, true, null, callback)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ namespace Server.Commands
|
|||
}
|
||||
}
|
||||
|
||||
private static PropertyInfo[] _mobProps =
|
||||
private static readonly PropertyInfo[] _mobProps =
|
||||
typeof(Mobile).GetProperties(BindingFlags.Public | BindingFlags.Instance)
|
||||
.Where(prop => prop.CanRead && prop.CanWrite).ToArray();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using Server.Engines.Quests.Haven;
|
||||
using Server.Engines.Quests.Necro;
|
||||
using Server.Items;
|
||||
|
|
@ -12,7 +10,7 @@ using Server.Utilities;
|
|||
|
||||
namespace Server.Commands
|
||||
{
|
||||
public class Decorate
|
||||
public static class Decorate
|
||||
{
|
||||
private static Mobile m_Mobile;
|
||||
private static int m_Count;
|
||||
|
|
@ -60,22 +58,22 @@ namespace Server.Commands
|
|||
|
||||
public class DecorationList
|
||||
{
|
||||
private static Type typeofStatic = typeof(Static);
|
||||
private static Type typeofLocalizedStatic = typeof(LocalizedStatic);
|
||||
private static Type typeofBaseDoor = typeof(BaseDoor);
|
||||
private static Type typeofAnkhWest = typeof(AnkhWest);
|
||||
private static Type typeofAnkhNorth = typeof(AnkhNorth);
|
||||
private static Type typeofBeverage = typeof(BaseBeverage);
|
||||
private static Type typeofLocalizedSign = typeof(LocalizedSign);
|
||||
private static Type typeofMarkContainer = typeof(MarkContainer);
|
||||
private static Type typeofWarningItem = typeof(WarningItem);
|
||||
private static Type typeofHintItem = typeof(HintItem);
|
||||
private static Type typeofCannon = typeof(Cannon);
|
||||
private static Type typeofSerpentPillar = typeof(SerpentPillar);
|
||||
private static readonly Type typeofStatic = typeof(Static);
|
||||
private static readonly Type typeofLocalizedStatic = typeof(LocalizedStatic);
|
||||
private static readonly Type typeofBaseDoor = typeof(BaseDoor);
|
||||
private static readonly Type typeofAnkhWest = typeof(AnkhWest);
|
||||
private static readonly Type typeofAnkhNorth = typeof(AnkhNorth);
|
||||
private static readonly Type typeofBeverage = typeof(BaseBeverage);
|
||||
private static readonly Type typeofLocalizedSign = typeof(LocalizedSign);
|
||||
private static readonly Type typeofMarkContainer = typeof(MarkContainer);
|
||||
private static readonly Type typeofWarningItem = typeof(WarningItem);
|
||||
private static readonly Type typeofHintItem = typeof(HintItem);
|
||||
private static readonly Type typeofCannon = typeof(Cannon);
|
||||
private static readonly Type typeofSerpentPillar = typeof(SerpentPillar);
|
||||
|
||||
private static Queue<Item> m_DeleteQueue = new Queue<Item>();
|
||||
private static readonly Queue<Item> m_DeleteQueue = new Queue<Item>();
|
||||
|
||||
private static string[] m_EmptyParams = new string[0];
|
||||
private static readonly string[] m_EmptyParams = Array.Empty<string>();
|
||||
private List<DecorationEntry> m_Entries;
|
||||
private int m_ItemID;
|
||||
private string[] m_Params;
|
||||
|
|
@ -934,14 +932,13 @@ namespace Server.Commands
|
|||
|
||||
for (int j = 0; j < maps.Length; ++j)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
item ??= Construct();
|
||||
}
|
||||
catch(TypeInitializationException e)
|
||||
catch (TypeInitializationException e)
|
||||
{
|
||||
Console.WriteLine($"{nameof(Generate)}() failed to load type: {e.TypeName}: {e.InnerException.Message}");
|
||||
Console.WriteLine($"{nameof(Generate)}() failed to load type: {e.TypeName}: {e.InnerException?.Message}");
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -1083,11 +1080,11 @@ namespace Server.Commands
|
|||
Extra = line;
|
||||
}
|
||||
|
||||
public Point3D Location{ get; }
|
||||
public Point3D Location { get; }
|
||||
|
||||
public string Extra{ get; }
|
||||
public string Extra { get; }
|
||||
|
||||
public void Pop(out string v, ref string line)
|
||||
public static void Pop(out string v, ref string line)
|
||||
{
|
||||
int space = line.IndexOf(' ');
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@ namespace Server.Commands
|
|||
Generate("Data/Decoration/RuinedMaginciaTram", Map.Trammel);
|
||||
Generate("Data/Decoration/RuinedMaginciaFel", Map.Felucca);
|
||||
|
||||
|
||||
m_Mobile.SendMessage("World generating complete. {0} items were generated.", m_Count);
|
||||
}
|
||||
|
||||
|
|
@ -56,22 +55,22 @@ namespace Server.Commands
|
|||
|
||||
public class DecorationListMag
|
||||
{
|
||||
private static Type typeofStatic = typeof(Static);
|
||||
private static Type typeofLocalizedStatic = typeof(LocalizedStatic);
|
||||
private static Type typeofBaseDoor = typeof(BaseDoor);
|
||||
private static Type typeofAnkhWest = typeof(AnkhWest);
|
||||
private static Type typeofAnkhNorth = typeof(AnkhNorth);
|
||||
private static Type typeofBeverage = typeof(BaseBeverage);
|
||||
private static Type typeofLocalizedSign = typeof(LocalizedSign);
|
||||
private static Type typeofMarkContainer = typeof(MarkContainer);
|
||||
private static Type typeofWarningItem = typeof(WarningItem);
|
||||
private static Type typeofHintItem = typeof(HintItem);
|
||||
private static Type typeofCannon = typeof(Cannon);
|
||||
private static Type typeofSerpentPillar = typeof(SerpentPillar);
|
||||
private static readonly Type typeofStatic = typeof(Static);
|
||||
private static readonly Type typeofLocalizedStatic = typeof(LocalizedStatic);
|
||||
private static readonly Type typeofBaseDoor = typeof(BaseDoor);
|
||||
private static readonly Type typeofAnkhWest = typeof(AnkhWest);
|
||||
private static readonly Type typeofAnkhNorth = typeof(AnkhNorth);
|
||||
private static readonly Type typeofBeverage = typeof(BaseBeverage);
|
||||
private static readonly Type typeofLocalizedSign = typeof(LocalizedSign);
|
||||
private static readonly Type typeofMarkContainer = typeof(MarkContainer);
|
||||
private static readonly Type typeofWarningItem = typeof(WarningItem);
|
||||
private static readonly Type typeofHintItem = typeof(HintItem);
|
||||
private static readonly Type typeofCannon = typeof(Cannon);
|
||||
private static readonly Type typeofSerpentPillar = typeof(SerpentPillar);
|
||||
|
||||
private static Queue m_DeleteQueue = new Queue();
|
||||
private static readonly Queue m_DeleteQueue = new Queue();
|
||||
|
||||
private static string[] m_EmptyParams = new string[0];
|
||||
private static readonly string[] m_EmptyParams = Array.Empty<string>();
|
||||
private List<DecorationEntryMag> m_Entries;
|
||||
private int m_ItemID;
|
||||
private string[] m_Params;
|
||||
|
|
@ -1070,9 +1069,9 @@ namespace Server.Commands
|
|||
Extra = line;
|
||||
}
|
||||
|
||||
public Point3D Location{ get; }
|
||||
public Point3D Location { get; }
|
||||
|
||||
public string Extra{ get; }
|
||||
public string Extra { get; }
|
||||
|
||||
public void Pop(out string v, ref string line)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -243,7 +243,7 @@ namespace Server.Commands
|
|||
|
||||
nameBuilder.Append(sanitizedName);
|
||||
fnamBuilder.Append("T");
|
||||
if (DontLink(typeArguments[i])) //if ( DontLink( typeArguments[i].Name ) )
|
||||
if (DontLink(typeArguments[i]))
|
||||
linkBuilder.Append($"<font color=\"blue\">{aliasedName}</font>");
|
||||
else
|
||||
linkBuilder.Append(
|
||||
|
|
@ -270,7 +270,7 @@ namespace Server.Commands
|
|||
else
|
||||
linkName = link;
|
||||
|
||||
//Console.WriteLine( typeName+":"+fileName+":"+linkName );
|
||||
// Console.WriteLine( typeName+":"+fileName+":"+linkName );
|
||||
}
|
||||
|
||||
public static string SanitizeType(string name)
|
||||
|
|
@ -312,7 +312,7 @@ namespace Server.Commands
|
|||
public static bool DontLink( string name )
|
||||
{
|
||||
foreach( string dontLink in m_DontLink )
|
||||
if ( dontLink == name ) return true;
|
||||
if (dontLink == name ) return true;
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
|
|
@ -416,9 +416,13 @@ namespace Server.Commands
|
|||
private class TypeInfo
|
||||
{
|
||||
public List<TypeInfo> m_Derived, m_Nested;
|
||||
private string m_FileName, m_TypeName, m_LinkName;
|
||||
public Type[] m_Interfaces;
|
||||
public Type m_Type, m_BaseType, m_Declaring;
|
||||
private readonly string m_FileName;
|
||||
private readonly string m_TypeName;
|
||||
private readonly string m_LinkName;
|
||||
public readonly Type[] m_Interfaces;
|
||||
public readonly Type m_Type;
|
||||
public readonly Type m_BaseType;
|
||||
public readonly Type m_Declaring;
|
||||
|
||||
public TypeInfo(Type type)
|
||||
{
|
||||
|
|
@ -437,8 +441,6 @@ namespace Server.Commands
|
|||
public string LinkName(string dirRoot) => m_LinkName.Replace("@directory@", dirRoot);
|
||||
}
|
||||
|
||||
#region FileSystem
|
||||
|
||||
private static readonly char[] ReplaceChars = "<>".ToCharArray();
|
||||
|
||||
public static string GetFileName(string root, string name, string ext)
|
||||
|
|
@ -460,7 +462,7 @@ namespace Server.Commands
|
|||
return file;
|
||||
}
|
||||
|
||||
private static string m_RootDirectory = Path.GetDirectoryName(Environment.GetCommandLineArgs()[0]);
|
||||
private static readonly string m_RootDirectory = Path.GetDirectoryName(Environment.GetCommandLineArgs()[0]);
|
||||
|
||||
private static void EnsureDirectory(string path)
|
||||
{
|
||||
|
|
@ -482,11 +484,7 @@ namespace Server.Commands
|
|||
|
||||
private static StreamWriter GetWriter(string path) => new StreamWriter(Path.Combine(m_RootDirectory, path));
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetPair
|
||||
|
||||
private static string[,] m_Aliases =
|
||||
private static readonly string[,] m_Aliases =
|
||||
{
|
||||
{ "System.Object", "<font color=\"blue\">object</font>" },
|
||||
{ "System.String", "<font color=\"blue\">string</font>" },
|
||||
|
|
@ -506,7 +504,7 @@ namespace Server.Commands
|
|||
{ "System.Void", "<font color=\"blue\">void</font>" }
|
||||
};
|
||||
|
||||
private static int m_AliasLength = m_Aliases.GetLength(0);
|
||||
private static readonly int m_AliasLength = m_Aliases.GetLength(0);
|
||||
|
||||
public static string GetPair(Type varType, string name, bool ignoreRef)
|
||||
{
|
||||
|
|
@ -600,10 +598,6 @@ namespace Server.Commands
|
|||
return string.Concat(prepend, aliased, append, name);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Root documentation
|
||||
|
||||
private static bool Document()
|
||||
{
|
||||
try
|
||||
|
|
@ -634,7 +628,6 @@ namespace Server.Commands
|
|||
|
||||
List<Assembly> assemblies = new List<Assembly> { Core.Assembly };
|
||||
|
||||
|
||||
foreach (Assembly asm in AssemblyHandler.Assemblies)
|
||||
assemblies.Add(asm);
|
||||
|
||||
|
|
@ -713,10 +706,6 @@ namespace Server.Commands
|
|||
html.WriteLine("</html>");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region BODs
|
||||
|
||||
private const int Iron = 0xCCCCDD;
|
||||
private const int DullCopper = 0xAAAAAA;
|
||||
private const int ShadowIron = 0x777799;
|
||||
|
|
@ -763,7 +752,6 @@ namespace Server.Commands
|
|||
html.WriteLine(" <br><br>");
|
||||
html.WriteLine(" <br><br>");
|
||||
|
||||
|
||||
sbod.Type = typeof(PlateArms);
|
||||
|
||||
WriteSmithBODHeader(html, "(Small) Armor: Normal");
|
||||
|
|
@ -923,8 +911,6 @@ namespace Server.Commands
|
|||
}
|
||||
}
|
||||
|
||||
#region Tailor Bods
|
||||
|
||||
private static void WriteTailorLBOD(StreamWriter html, string name, SmallBulkEntry[] entries, bool expandCloth,
|
||||
bool expandPlain)
|
||||
{
|
||||
|
|
@ -1221,20 +1207,20 @@ namespace Server.Commands
|
|||
switch (material)
|
||||
{
|
||||
case BulkMaterialType.None:
|
||||
{
|
||||
if (type.IsSubclassOf(typeof(BaseArmor)) || type.IsSubclassOf(typeof(BaseShoes)))
|
||||
{
|
||||
style = "pl";
|
||||
name = "Plain";
|
||||
}
|
||||
else
|
||||
{
|
||||
style = "cl";
|
||||
name = "Cloth";
|
||||
}
|
||||
if (type.IsSubclassOf(typeof(BaseArmor)) || type.IsSubclassOf(typeof(BaseShoes)))
|
||||
{
|
||||
style = "pl";
|
||||
name = "Plain";
|
||||
}
|
||||
else
|
||||
{
|
||||
style = "cl";
|
||||
name = "Cloth";
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case BulkMaterialType.Spined:
|
||||
style = "sp";
|
||||
name = "Spined";
|
||||
|
|
@ -1281,10 +1267,6 @@ namespace Server.Commands
|
|||
html.WriteLine(" </tr>");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Smith Bods
|
||||
|
||||
private static void WriteSmithLBOD(StreamWriter html, string name, SmallBulkEntry[] entries)
|
||||
{
|
||||
LargeBOD lbod = new LargeSmithBOD();
|
||||
|
|
@ -1564,12 +1546,6 @@ namespace Server.Commands
|
|||
html.WriteLine(" </tr>");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Bodies
|
||||
|
||||
public static List<BodyEntry> LoadBodies()
|
||||
{
|
||||
List<BodyEntry> list = new List<BodyEntry>();
|
||||
|
|
@ -1689,10 +1665,6 @@ namespace Server.Commands
|
|||
html.WriteLine("</html>");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Speech
|
||||
|
||||
private static void DocumentKeywords()
|
||||
{
|
||||
List<Dictionary<int, SpeechEntry>> tables = LoadSpeechFile();
|
||||
|
|
@ -1728,7 +1700,7 @@ namespace Server.Commands
|
|||
|
||||
html.Write(" <tr><td class=\"lentry\">0x{0:X4}</td><td class=\"rentry\">", entry.Index);
|
||||
|
||||
entry.Strings.Sort(); //( new EnglishPrioStringSorter() );
|
||||
entry.Strings.Sort(); // ( new EnglishPrioStringSorter() );
|
||||
|
||||
for (int j = 0; j < entry.Strings.Count; ++j)
|
||||
{
|
||||
|
|
@ -1776,9 +1748,9 @@ namespace Server.Commands
|
|||
Strings = new List<string>();
|
||||
}
|
||||
|
||||
public int Index{ get; }
|
||||
public int Index { get; }
|
||||
|
||||
public List<string> Strings{ get; }
|
||||
public List<string> Strings { get; }
|
||||
}
|
||||
|
||||
private class SpeechEntrySorter : IComparer<SpeechEntry>
|
||||
|
|
@ -1833,10 +1805,6 @@ namespace Server.Commands
|
|||
return tables;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Commands
|
||||
|
||||
public class DocCommandEntry
|
||||
{
|
||||
public DocCommandEntry(AccessLevel accessLevel, string name, string[] aliases, string usage, string description)
|
||||
|
|
@ -1848,15 +1816,15 @@ namespace Server.Commands
|
|||
Description = description;
|
||||
}
|
||||
|
||||
public AccessLevel AccessLevel{ get; }
|
||||
public AccessLevel AccessLevel { get; }
|
||||
|
||||
public string Name{ get; }
|
||||
public string Name { get; }
|
||||
|
||||
public string[] Aliases{ get; }
|
||||
public string[] Aliases { get; }
|
||||
|
||||
public string Usage{ get; }
|
||||
public string Usage { get; }
|
||||
|
||||
public string Description{ get; }
|
||||
public string Description { get; }
|
||||
}
|
||||
|
||||
public class CommandEntrySorter : IComparer<DocCommandEntry>
|
||||
|
|
@ -2112,12 +2080,10 @@ namespace Server.Commands
|
|||
html.WriteLine("</tr>");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructible Objects
|
||||
|
||||
private static Type typeofItem = typeof(Item), typeofMobile = typeof(Mobile), typeofMap = typeof(Map);
|
||||
private static Type typeofCustomEnum = typeof(CustomEnumAttribute);
|
||||
private static readonly Type typeofItem = typeof(Item);
|
||||
private static readonly Type typeofMobile = typeof(Mobile);
|
||||
private static readonly Type typeofMap = typeof(Map);
|
||||
private static readonly Type typeofCustomEnum = typeof(CustomEnumAttribute);
|
||||
|
||||
private static bool IsConstructible(Type t, out bool isItem) => (isItem = typeofItem.IsAssignableFrom(t)) || typeofMobile.IsAssignableFrom(t);
|
||||
|
||||
|
|
@ -2226,13 +2192,9 @@ namespace Server.Commands
|
|||
html.WriteLine("</td></tr>");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Tooltips
|
||||
|
||||
private const string HtmlNewLine = " ";
|
||||
|
||||
private static object[,] m_Tooltips =
|
||||
private static readonly object[,] m_Tooltips =
|
||||
{
|
||||
{ typeof(byte), "Numeric value in the range from 0 to 255, inclusive." },
|
||||
{ typeof(sbyte), "Numeric value in the range from negative 128 to positive 127, inclusive." },
|
||||
|
|
@ -2319,10 +2281,6 @@ namespace Server.Commands
|
|||
return "";
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Const Strings
|
||||
|
||||
private const string RefString = "<font color=\"blue\">ref</font> ";
|
||||
private const string GetString = " <font color=\"blue\">get</font>;";
|
||||
private const string SetString = " <font color=\"blue\">set</font>;";
|
||||
|
|
@ -2334,10 +2292,6 @@ namespace Server.Commands
|
|||
private const string CtorString = "(<font color=\"blue\">ctor</font>) ";
|
||||
private const string StaticString = "(<font color=\"blue\">static</font>) ";
|
||||
|
||||
#endregion
|
||||
|
||||
#region Write[...]
|
||||
|
||||
private static void WriteEnum(TypeInfo info, StreamWriter typeHtml)
|
||||
{
|
||||
Type type = info.m_Type;
|
||||
|
|
@ -2381,7 +2335,7 @@ namespace Server.Commands
|
|||
if (decInfo == null)
|
||||
typeHtml.Write(decType.Name);
|
||||
else
|
||||
//typeHtml.Write( "<a href=\"{0}\">{1}</a>", decInfo.m_FileName, decInfo.m_TypeName );
|
||||
// typeHtml.Write( "<a href=\"{0}\">{1}</a>", decInfo.m_FileName, decInfo.m_TypeName );
|
||||
typeHtml.Write(decInfo.LinkName(null));
|
||||
|
||||
typeHtml.Write(") - ");
|
||||
|
|
@ -2452,7 +2406,7 @@ namespace Server.Commands
|
|||
if (i != 0)
|
||||
typeHtml.Write(", ");
|
||||
|
||||
//typeHtml.Write( "<a href=\"{0}\">{1}</a>", derivedInfo.m_FileName, derivedInfo.m_TypeName );
|
||||
// typeHtml.Write( "<a href=\"{0}\">{1}</a>", derivedInfo.m_FileName, derivedInfo.m_TypeName );
|
||||
typeHtml.Write($"<!-- DBG-3 -->{derivedInfo.LinkName(null)}");
|
||||
}
|
||||
|
||||
|
|
@ -2474,7 +2428,7 @@ namespace Server.Commands
|
|||
if (i != 0)
|
||||
typeHtml.Write(", ");
|
||||
|
||||
//typeHtml.Write( "<a href=\"{0}\">{1}</a>", nestedInfo.m_FileName, nestedInfo.m_TypeName );
|
||||
// typeHtml.Write( "<a href=\"{0}\">{1}</a>", nestedInfo.m_FileName, nestedInfo.m_TypeName );
|
||||
typeHtml.Write($"<!-- DBG-4 -->{nestedInfo.LinkName(null)}");
|
||||
}
|
||||
|
||||
|
|
@ -2600,12 +2554,8 @@ namespace Server.Commands
|
|||
|
||||
html.WriteLine(")<br>");
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
#region BodyEntry & BodyType
|
||||
|
||||
public enum ModelBodyType
|
||||
{
|
||||
Invalid = -1,
|
||||
|
|
@ -2625,11 +2575,11 @@ namespace Server.Commands
|
|||
Name = name;
|
||||
}
|
||||
|
||||
public Body Body{ get; }
|
||||
public Body Body { get; }
|
||||
|
||||
public ModelBodyType BodyType{ get; }
|
||||
public ModelBodyType BodyType { get; }
|
||||
|
||||
public string Name{ get; }
|
||||
public string Name { get; }
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
|
|
@ -2657,6 +2607,4 @@ namespace Server.Commands
|
|||
return a?.Name.CompareTo(b?.Name) ?? 1;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
using System;
|
||||
using System.Reflection;
|
||||
using Server.Items;
|
||||
using Server.Targeting;
|
||||
using Server.Utilities;
|
||||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Server.Commands
|
||||
{
|
||||
|
|
@ -48,14 +48,14 @@ namespace Server.Commands
|
|||
}
|
||||
catch
|
||||
{
|
||||
//Console.WriteLine( "Denied" );
|
||||
// Console.WriteLine( "Denied" );
|
||||
}
|
||||
}
|
||||
|
||||
private class DupeTarget : Target
|
||||
{
|
||||
private int m_Amount;
|
||||
private bool m_InBag;
|
||||
private readonly int m_Amount;
|
||||
private readonly bool m_InBag;
|
||||
|
||||
public DupeTarget(bool inbag, int amount)
|
||||
: base(15, false, TargetFlags.None)
|
||||
|
|
@ -103,7 +103,7 @@ namespace Server.Commands
|
|||
for (int i = 0; i < m_Amount; i++)
|
||||
if (c.Invoke(args) is Item newItem)
|
||||
{
|
||||
CopyProperties(newItem, copy); //copy.Dupe( item, copy.Amount );
|
||||
CopyProperties(newItem, copy); // copy.Dupe( item, copy.Amount );
|
||||
copy.OnAfterDuped(newItem);
|
||||
newItem.Parent = null;
|
||||
|
||||
|
|
|
|||
|
|
@ -76,4 +76,4 @@ WEIGHT 25500
|
|||
OWNER -1
|
||||
SPAWN -1
|
||||
VALUE 1
|
||||
}*/
|
||||
}*/
|
||||
|
|
|
|||
|
|
@ -13,9 +13,9 @@ namespace Server.Commands
|
|||
{
|
||||
private static CategoryEntry m_RootItems, m_RootMobiles;
|
||||
|
||||
private static Type typeofItem = typeof(Item);
|
||||
private static Type typeofMobile = typeof(Mobile);
|
||||
private static Type typeofConstructible = typeof(ConstructibleAttribute);
|
||||
private static readonly Type typeofItem = typeof(Item);
|
||||
private static readonly Type typeofMobile = typeof(Mobile);
|
||||
private static readonly Type typeofConstructible = typeof(ConstructibleAttribute);
|
||||
|
||||
public static CategoryEntry Items
|
||||
{
|
||||
|
|
@ -275,9 +275,9 @@ namespace Server.Commands
|
|||
Object = ActivatorUtil.CreateInstance(type);
|
||||
}
|
||||
|
||||
public Type Type{ get; }
|
||||
public Type Type { get; }
|
||||
|
||||
public object Object{ get; }
|
||||
public object Object { get; }
|
||||
}
|
||||
|
||||
public class CategoryEntry
|
||||
|
|
@ -286,8 +286,8 @@ namespace Server.Commands
|
|||
{
|
||||
Parent = parent;
|
||||
Title = title;
|
||||
SubCategories = subCats ?? new CategoryEntry[0];
|
||||
Matches = new Type[0];
|
||||
SubCategories = subCats ?? Array.Empty<CategoryEntry>();
|
||||
Matches = Array.Empty<Type>();
|
||||
Matched = new List<CategoryTypeEntry>();
|
||||
}
|
||||
|
||||
|
|
@ -342,15 +342,15 @@ namespace Server.Commands
|
|||
Matched = new List<CategoryTypeEntry>();
|
||||
}
|
||||
|
||||
public string Title{ get; }
|
||||
public string Title { get; }
|
||||
|
||||
public Type[] Matches{ get; }
|
||||
public Type[] Matches { get; }
|
||||
|
||||
public CategoryEntry Parent{ get; }
|
||||
public CategoryEntry Parent { get; }
|
||||
|
||||
public CategoryEntry[] SubCategories{ get; }
|
||||
public CategoryEntry[] SubCategories { get; }
|
||||
|
||||
public List<CategoryTypeEntry> Matched{ get; }
|
||||
public List<CategoryTypeEntry> Matched { get; }
|
||||
|
||||
public bool IsMatch(Type type)
|
||||
{
|
||||
|
|
@ -380,9 +380,9 @@ namespace Server.Commands
|
|||
Text = input.Substring(index);
|
||||
}
|
||||
|
||||
public int Indentation{ get; }
|
||||
public int Indentation { get; }
|
||||
|
||||
public string Text{ get; }
|
||||
public string Text { get; }
|
||||
|
||||
public static CategoryLine[] Load(string path)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
using Server.Items;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using Server.Items;
|
||||
using Server.Json;
|
||||
|
||||
namespace Server.Commands
|
||||
|
|
@ -122,7 +122,7 @@ namespace Server.Commands
|
|||
public int Count { get; private set; }
|
||||
public int DelCount { get; private set; }
|
||||
|
||||
private static bool IsWithinZ(int delta) => -12 <= delta && delta <= 12;
|
||||
private static bool IsWithinZ(int delta) => delta >= -12 && delta <= 12;
|
||||
|
||||
public static int DeleteTeleporters(Location location)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -12,22 +12,22 @@ namespace Server.Commands.Generic
|
|||
|
||||
public abstract class BaseCommand
|
||||
{
|
||||
private List<MessageEntry> m_Responses = new List<MessageEntry>();
|
||||
private List<MessageEntry> m_Failures = new List<MessageEntry>();
|
||||
private readonly List<MessageEntry> m_Responses = new List<MessageEntry>();
|
||||
private readonly List<MessageEntry> m_Failures = new List<MessageEntry>();
|
||||
|
||||
public bool ListOptimized{ get; set; }
|
||||
public bool ListOptimized { get; set; }
|
||||
|
||||
public string[] Commands{ get; set; }
|
||||
public string[] Commands { get; set; }
|
||||
|
||||
public string Usage{ get; set; }
|
||||
public string Usage { get; set; }
|
||||
|
||||
public string Description{ get; set; }
|
||||
public string Description { get; set; }
|
||||
|
||||
public AccessLevel AccessLevel{ get; set; }
|
||||
public AccessLevel AccessLevel { get; set; }
|
||||
|
||||
public ObjectTypes ObjectTypes{ get; set; }
|
||||
public ObjectTypes ObjectTypes { get; set; }
|
||||
|
||||
public CommandSupport Supports{ get; set; }
|
||||
public CommandSupport Supports { get; set; }
|
||||
|
||||
public static bool IsAccessible(Mobile from, object obj)
|
||||
{
|
||||
|
|
@ -117,7 +117,7 @@ namespace Server.Commands.Generic
|
|||
private class MessageEntry
|
||||
{
|
||||
public int m_Count;
|
||||
public string m_Message;
|
||||
public readonly string m_Message;
|
||||
|
||||
public MessageEntry(string message)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ namespace Server.Commands.Generic
|
|||
{
|
||||
public class TargetCommands
|
||||
{
|
||||
public static List<BaseCommand> AllCommands{ get; } = new List<BaseCommand>();
|
||||
public static List<BaseCommand> AllCommands { get; } = new List<BaseCommand>();
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
|
|
@ -348,7 +348,7 @@ namespace Server.Commands.Generic
|
|||
|
||||
public class TellCommand : BaseCommand
|
||||
{
|
||||
private bool m_InGump;
|
||||
private readonly bool m_InGump;
|
||||
|
||||
public TellCommand(bool inGump)
|
||||
{
|
||||
|
|
@ -511,7 +511,7 @@ namespace Server.Commands.Generic
|
|||
|
||||
SpellHelper.GetSurfaceTop(ref p);
|
||||
|
||||
//CommandLogging.WriteLine( from, "{0} {1} teleporting to {2}", from.AccessLevel, CommandLogging.Format( from ), new Point3D( p ) );
|
||||
// CommandLogging.WriteLine( from, "{0} {1} teleporting to {2}", from.AccessLevel, CommandLogging.Format( from ), new Point3D( p ) );
|
||||
|
||||
Point3D fromLoc = from.Location;
|
||||
Point3D toLoc = new Point3D(p);
|
||||
|
|
@ -683,8 +683,8 @@ namespace Server.Commands.Generic
|
|||
|
||||
public class AliasedSetCommand : BaseCommand
|
||||
{
|
||||
private string m_Name;
|
||||
private string m_Value;
|
||||
private readonly string m_Name;
|
||||
private readonly string m_Value;
|
||||
|
||||
public AliasedSetCommand(AccessLevel level, string command, string name, string value, ObjectTypes objects)
|
||||
{
|
||||
|
|
@ -830,7 +830,7 @@ namespace Server.Commands.Generic
|
|||
|
||||
public class KillCommand : BaseCommand
|
||||
{
|
||||
private bool m_Value;
|
||||
private readonly bool m_Value;
|
||||
|
||||
public KillCommand(bool value)
|
||||
{
|
||||
|
|
@ -916,7 +916,7 @@ namespace Server.Commands.Generic
|
|||
|
||||
public class HideCommand : BaseCommand
|
||||
{
|
||||
private bool m_Value;
|
||||
private readonly bool m_Value;
|
||||
|
||||
public HideCommand(bool value)
|
||||
{
|
||||
|
|
@ -1011,7 +1011,7 @@ namespace Server.Commands.Generic
|
|||
|
||||
public class KickCommand : BaseCommand
|
||||
{
|
||||
private bool m_Ban;
|
||||
private readonly bool m_Ban;
|
||||
|
||||
public KickCommand(bool ban)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ namespace Server.Commands.Generic
|
|||
{
|
||||
house = null;
|
||||
|
||||
if (item == null || item is BaseMulti || item is HouseSign || staticsOnly && !(item is Static))
|
||||
if (item == null || item is BaseMulti || item is HouseSign || (staticsOnly && !(item is Static)))
|
||||
return DesignInsertResult.InvalidItem;
|
||||
|
||||
house = BaseHouse.FindHouseAt(item) as HouseFoundation;
|
||||
|
|
@ -69,8 +69,6 @@ namespace Server.Commands.Generic
|
|||
return true;
|
||||
}
|
||||
|
||||
#region Single targeting mode
|
||||
|
||||
public override void Execute(CommandEventArgs e, object obj)
|
||||
{
|
||||
Target t = new DesignInsertTarget(new List<HouseFoundation>(), e.Length < 1 || !e.GetBoolean(0));
|
||||
|
|
@ -79,8 +77,8 @@ namespace Server.Commands.Generic
|
|||
|
||||
private class DesignInsertTarget : Target
|
||||
{
|
||||
private List<HouseFoundation> m_Foundations;
|
||||
private bool m_StaticsOnly;
|
||||
private readonly List<HouseFoundation> m_Foundations;
|
||||
private readonly bool m_StaticsOnly;
|
||||
|
||||
public DesignInsertTarget(List<HouseFoundation> foundations, bool staticsOnly)
|
||||
: base(-1, false, TargetFlags.None)
|
||||
|
|
@ -107,39 +105,35 @@ namespace Server.Commands.Generic
|
|||
switch (result)
|
||||
{
|
||||
case DesignInsertResult.Valid:
|
||||
{
|
||||
if (m_Foundations.Count == 0)
|
||||
from.SendMessage(
|
||||
"The item has been inserted into the house design. Press ESC when you are finished.");
|
||||
else
|
||||
from.SendMessage("The item has been inserted into the house design.");
|
||||
{
|
||||
if (m_Foundations.Count == 0)
|
||||
from.SendMessage(
|
||||
"The item has been inserted into the house design. Press ESC when you are finished.");
|
||||
else
|
||||
from.SendMessage("The item has been inserted into the house design.");
|
||||
|
||||
if (!m_Foundations.Contains(house))
|
||||
m_Foundations.Add(house);
|
||||
if (!m_Foundations.Contains(house))
|
||||
m_Foundations.Add(house);
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case DesignInsertResult.InvalidItem:
|
||||
{
|
||||
from.SendMessage("That cannot be inserted. Try again.");
|
||||
break;
|
||||
}
|
||||
{
|
||||
from.SendMessage("That cannot be inserted. Try again.");
|
||||
break;
|
||||
}
|
||||
case DesignInsertResult.NotInHouse:
|
||||
case DesignInsertResult.OutsideHouseBounds:
|
||||
{
|
||||
from.SendMessage("That item is not inside a customizable house. Try again.");
|
||||
break;
|
||||
}
|
||||
{
|
||||
from.SendMessage("That item is not inside a customizable house. Try again.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
from.Target = new DesignInsertTarget(m_Foundations, m_StaticsOnly);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Area targeting mode
|
||||
|
||||
public override void ExecuteList(CommandEventArgs e, List<object> list)
|
||||
{
|
||||
Mobile from = e.Mobile;
|
||||
|
|
@ -165,25 +159,25 @@ namespace Server.Commands.Generic
|
|||
switch (result)
|
||||
{
|
||||
case DesignInsertResult.Valid:
|
||||
{
|
||||
AddResponse("The item has been inserted into the house design.");
|
||||
{
|
||||
AddResponse("The item has been inserted into the house design.");
|
||||
|
||||
if (!foundations.Contains(house))
|
||||
foundations.Add(house);
|
||||
if (!foundations.Contains(house))
|
||||
foundations.Add(house);
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case DesignInsertResult.InvalidItem:
|
||||
{
|
||||
LogFailure("That cannot be inserted.");
|
||||
break;
|
||||
}
|
||||
{
|
||||
LogFailure("That cannot be inserted.");
|
||||
break;
|
||||
}
|
||||
case DesignInsertResult.NotInHouse:
|
||||
case DesignInsertResult.OutsideHouseBounds:
|
||||
{
|
||||
LogFailure("That item is not inside a customizable house.");
|
||||
break;
|
||||
}
|
||||
{
|
||||
LogFailure("That item is not inside a customizable house.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -197,7 +191,5 @@ namespace Server.Commands.Generic
|
|||
|
||||
Flush(from, flushToLog);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
@ -25,7 +25,6 @@ namespace Server.Commands.Generic
|
|||
{
|
||||
List<string> columns = new List<string> { "Object" };
|
||||
|
||||
|
||||
if (e.Length > 0)
|
||||
{
|
||||
int offset = 0;
|
||||
|
|
@ -50,13 +49,13 @@ namespace Server.Commands.Generic
|
|||
{
|
||||
private const int EntriesPerPage = 15;
|
||||
|
||||
private string[] m_Columns;
|
||||
private Mobile m_From;
|
||||
private readonly string[] m_Columns;
|
||||
private readonly Mobile m_From;
|
||||
|
||||
private List<object> m_List;
|
||||
private int m_Page;
|
||||
private readonly List<object> m_List;
|
||||
private readonly int m_Page;
|
||||
|
||||
private object m_Select;
|
||||
private readonly object m_Select;
|
||||
|
||||
public InterfaceGump(Mobile from, string[] columns, List<object> list, int page, object select) : base(30, 30)
|
||||
{
|
||||
|
|
@ -197,57 +196,57 @@ namespace Server.Commands.Generic
|
|||
switch (info.ButtonID)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
if (m_Page > 0)
|
||||
m_From.SendGump(new InterfaceGump(m_From, m_Columns, m_List, m_Page - 1, m_Select));
|
||||
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
if ((m_Page + 1) * EntriesPerPage < m_List.Count)
|
||||
m_From.SendGump(new InterfaceGump(m_From, m_Columns, m_List, m_Page + 1, m_Select));
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
int v = info.ButtonID - 3;
|
||||
|
||||
if (v >= 0 && v < m_List.Count)
|
||||
{
|
||||
object obj = m_List[v];
|
||||
if (m_Page > 0)
|
||||
m_From.SendGump(new InterfaceGump(m_From, m_Columns, m_List, m_Page - 1, m_Select));
|
||||
|
||||
if (!BaseCommand.IsAccessible(m_From, obj))
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
if ((m_Page + 1) * EntriesPerPage < m_List.Count)
|
||||
m_From.SendGump(new InterfaceGump(m_From, m_Columns, m_List, m_Page + 1, m_Select));
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
int v = info.ButtonID - 3;
|
||||
|
||||
if (v >= 0 && v < m_List.Count)
|
||||
{
|
||||
m_From.SendLocalizedMessage(500447); // That is not accessible.
|
||||
m_From.SendGump(new InterfaceGump(m_From, m_Columns, m_List, m_Page, m_Select));
|
||||
break;
|
||||
object obj = m_List[v];
|
||||
|
||||
if (!BaseCommand.IsAccessible(m_From, obj))
|
||||
{
|
||||
m_From.SendLocalizedMessage(500447); // That is not accessible.
|
||||
m_From.SendGump(new InterfaceGump(m_From, m_Columns, m_List, m_Page, m_Select));
|
||||
break;
|
||||
}
|
||||
|
||||
if (obj is Item item && !item.Deleted)
|
||||
m_From.SendGump(new InterfaceItemGump(m_From, m_Columns, m_List, m_Page, item));
|
||||
else if (obj is Mobile mobile && !mobile.Deleted)
|
||||
m_From.SendGump(new InterfaceMobileGump(m_From, m_Columns, m_List, m_Page, mobile));
|
||||
else
|
||||
m_From.SendGump(new InterfaceGump(m_From, m_Columns, m_List, m_Page, m_Select));
|
||||
}
|
||||
|
||||
if (obj is Item item && !item.Deleted)
|
||||
m_From.SendGump(new InterfaceItemGump(m_From, m_Columns, m_List, m_Page, item));
|
||||
else if (obj is Mobile mobile && !mobile.Deleted)
|
||||
m_From.SendGump(new InterfaceMobileGump(m_From, m_Columns, m_List, m_Page, mobile));
|
||||
else
|
||||
m_From.SendGump(new InterfaceGump(m_From, m_Columns, m_List, m_Page, m_Select));
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class InterfaceItemGump : BaseGridGump
|
||||
{
|
||||
private string[] m_Columns;
|
||||
private Mobile m_From;
|
||||
private readonly string[] m_Columns;
|
||||
private readonly Mobile m_From;
|
||||
|
||||
private Item m_Item;
|
||||
private readonly Item m_Item;
|
||||
|
||||
private List<object> m_List;
|
||||
private int m_Page;
|
||||
private readonly List<object> m_List;
|
||||
private readonly int m_Page;
|
||||
|
||||
public InterfaceItemGump(Mobile from, string[] columns, List<object> list, int page, Item item) : base(30, 30)
|
||||
{
|
||||
|
|
@ -318,71 +317,71 @@ namespace Server.Commands.Generic
|
|||
{
|
||||
case 0:
|
||||
case 1:
|
||||
{
|
||||
m_From.SendGump(new InterfaceGump(m_From, m_Columns, m_List, m_Page, m_Item));
|
||||
break;
|
||||
}
|
||||
{
|
||||
m_From.SendGump(new InterfaceGump(m_From, m_Columns, m_List, m_Page, m_Item));
|
||||
break;
|
||||
}
|
||||
case 2: // Properties
|
||||
{
|
||||
m_From.SendGump(new InterfaceItemGump(m_From, m_Columns, m_List, m_Page, m_Item));
|
||||
m_From.SendGump(new PropertiesGump(m_From, m_Item));
|
||||
break;
|
||||
}
|
||||
case 3: // Delete
|
||||
{
|
||||
CommandLogging.WriteLine(m_From, "{0} {1} deleting {2}", m_From.AccessLevel,
|
||||
CommandLogging.Format(m_From), CommandLogging.Format(m_Item));
|
||||
m_Item.Delete();
|
||||
m_From.SendGump(new InterfaceGump(m_From, m_Columns, m_List, m_Page, m_Item));
|
||||
break;
|
||||
}
|
||||
case 4: // Go there
|
||||
{
|
||||
m_From.SendGump(new InterfaceItemGump(m_From, m_Columns, m_List, m_Page, m_Item));
|
||||
InvokeCommand($"Go {m_Item.Serial.Value}");
|
||||
break;
|
||||
}
|
||||
case 5: // Move to target
|
||||
{
|
||||
m_From.SendGump(new InterfaceItemGump(m_From, m_Columns, m_List, m_Page, m_Item));
|
||||
m_From.Target = new MoveTarget(m_Item);
|
||||
break;
|
||||
}
|
||||
case 6: // Bring to pack
|
||||
{
|
||||
Mobile owner = m_Item.RootParent as Mobile;
|
||||
|
||||
if (owner?.Map != null && owner.Map != Map.Internal &&
|
||||
!BaseCommand.IsAccessible(m_From, owner) /* !m_From.CanSee( owner )*/)
|
||||
{
|
||||
m_From.SendMessage("You can not get what you can not see.");
|
||||
}
|
||||
else if (owner != null && (owner.Map == null || owner.Map == Map.Internal) && owner.Hidden &&
|
||||
owner.AccessLevel >= m_From.AccessLevel)
|
||||
{
|
||||
m_From.SendMessage("You can not get what you can not see.");
|
||||
}
|
||||
else
|
||||
{
|
||||
m_From.SendGump(new InterfaceItemGump(m_From, m_Columns, m_List, m_Page, m_Item));
|
||||
m_From.AddToBackpack(m_Item);
|
||||
m_From.SendGump(new PropertiesGump(m_From, m_Item));
|
||||
break;
|
||||
}
|
||||
case 3: // Delete
|
||||
{
|
||||
CommandLogging.WriteLine(m_From, "{0} {1} deleting {2}", m_From.AccessLevel,
|
||||
CommandLogging.Format(m_From), CommandLogging.Format(m_Item));
|
||||
m_Item.Delete();
|
||||
m_From.SendGump(new InterfaceGump(m_From, m_Columns, m_List, m_Page, m_Item));
|
||||
break;
|
||||
}
|
||||
case 4: // Go there
|
||||
{
|
||||
m_From.SendGump(new InterfaceItemGump(m_From, m_Columns, m_List, m_Page, m_Item));
|
||||
InvokeCommand($"Go {m_Item.Serial.Value}");
|
||||
break;
|
||||
}
|
||||
case 5: // Move to target
|
||||
{
|
||||
m_From.SendGump(new InterfaceItemGump(m_From, m_Columns, m_List, m_Page, m_Item));
|
||||
m_From.Target = new MoveTarget(m_Item);
|
||||
break;
|
||||
}
|
||||
case 6: // Bring to pack
|
||||
{
|
||||
Mobile owner = m_Item.RootParent as Mobile;
|
||||
|
||||
break;
|
||||
}
|
||||
if (owner?.Map != null && owner.Map != Map.Internal &&
|
||||
!BaseCommand.IsAccessible(m_From, owner) /* !m_From.CanSee( owner )*/)
|
||||
{
|
||||
m_From.SendMessage("You can not get what you can not see.");
|
||||
}
|
||||
else if (owner != null && (owner.Map == null || owner.Map == Map.Internal) && owner.Hidden &&
|
||||
owner.AccessLevel >= m_From.AccessLevel)
|
||||
{
|
||||
m_From.SendMessage("You can not get what you can not see.");
|
||||
}
|
||||
else
|
||||
{
|
||||
m_From.SendGump(new InterfaceItemGump(m_From, m_Columns, m_List, m_Page, m_Item));
|
||||
m_From.AddToBackpack(m_Item);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class InterfaceMobileGump : BaseGridGump
|
||||
{
|
||||
private string[] m_Columns;
|
||||
private Mobile m_From;
|
||||
private readonly string[] m_Columns;
|
||||
private readonly Mobile m_From;
|
||||
|
||||
private List<object> m_List;
|
||||
private readonly List<object> m_List;
|
||||
|
||||
private Mobile m_Mobile;
|
||||
private int m_Page;
|
||||
private readonly Mobile m_Mobile;
|
||||
private readonly int m_Page;
|
||||
|
||||
public InterfaceMobileGump(Mobile from, string[] columns, List<object> list, int page, Mobile mob)
|
||||
: base(30, 30)
|
||||
|
|
@ -482,86 +481,86 @@ namespace Server.Commands.Generic
|
|||
{
|
||||
case 0:
|
||||
case 1:
|
||||
{
|
||||
m_From.SendGump(new InterfaceGump(m_From, m_Columns, m_List, m_Page, m_Mobile));
|
||||
break;
|
||||
}
|
||||
case 2: // Properties
|
||||
{
|
||||
m_From.SendGump(new InterfaceMobileGump(m_From, m_Columns, m_List, m_Page, m_Mobile));
|
||||
m_From.SendGump(new PropertiesGump(m_From, m_Mobile));
|
||||
break;
|
||||
}
|
||||
case 3: // Delete
|
||||
{
|
||||
if (!m_Mobile.Player)
|
||||
{
|
||||
CommandLogging.WriteLine(m_From, "{0} {1} deleting {2}", m_From.AccessLevel,
|
||||
CommandLogging.Format(m_From), CommandLogging.Format(m_Mobile));
|
||||
m_Mobile.Delete();
|
||||
m_From.SendGump(new InterfaceGump(m_From, m_Columns, m_List, m_Page, m_Mobile));
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case 4: // Go there
|
||||
{
|
||||
m_From.SendGump(new InterfaceMobileGump(m_From, m_Columns, m_List, m_Page, m_Mobile));
|
||||
InvokeCommand($"Go {m_Mobile.Serial.Value}");
|
||||
break;
|
||||
}
|
||||
case 5: // Bring them here
|
||||
{
|
||||
if (m_From.Map == null || m_From.Map == Map.Internal)
|
||||
{
|
||||
m_From.SendMessage("You cannot bring that person here.");
|
||||
}
|
||||
else
|
||||
case 2: // Properties
|
||||
{
|
||||
m_From.SendGump(new InterfaceMobileGump(m_From, m_Columns, m_List, m_Page, m_Mobile));
|
||||
m_Mobile.MoveToWorld(m_From.Location, m_From.Map);
|
||||
m_From.SendGump(new PropertiesGump(m_From, m_Mobile));
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case 6: // Move to target
|
||||
{
|
||||
m_From.SendGump(new InterfaceMobileGump(m_From, m_Columns, m_List, m_Page, m_Mobile));
|
||||
m_From.Target = new MoveTarget(m_Mobile);
|
||||
break;
|
||||
}
|
||||
case 7: // Kill
|
||||
{
|
||||
if (m_From == m_Mobile || m_From.AccessLevel > m_Mobile.AccessLevel)
|
||||
m_Mobile.Kill();
|
||||
|
||||
m_From.SendGump(new InterfaceMobileGump(m_From, m_Columns, m_List, m_Page, m_Mobile));
|
||||
|
||||
break;
|
||||
}
|
||||
case 8: // Res
|
||||
{
|
||||
if (m_From == m_Mobile || m_From.AccessLevel > m_Mobile.AccessLevel)
|
||||
case 3: // Delete
|
||||
{
|
||||
m_Mobile.PlaySound(0x214);
|
||||
m_Mobile.FixedEffect(0x376A, 10, 16);
|
||||
if (!m_Mobile.Player)
|
||||
{
|
||||
CommandLogging.WriteLine(m_From, "{0} {1} deleting {2}", m_From.AccessLevel,
|
||||
CommandLogging.Format(m_From), CommandLogging.Format(m_Mobile));
|
||||
m_Mobile.Delete();
|
||||
m_From.SendGump(new InterfaceGump(m_From, m_Columns, m_List, m_Page, m_Mobile));
|
||||
}
|
||||
|
||||
m_Mobile.Resurrect();
|
||||
break;
|
||||
}
|
||||
case 4: // Go there
|
||||
{
|
||||
m_From.SendGump(new InterfaceMobileGump(m_From, m_Columns, m_List, m_Page, m_Mobile));
|
||||
InvokeCommand($"Go {m_Mobile.Serial.Value}");
|
||||
break;
|
||||
}
|
||||
case 5: // Bring them here
|
||||
{
|
||||
if (m_From.Map == null || m_From.Map == Map.Internal)
|
||||
{
|
||||
m_From.SendMessage("You cannot bring that person here.");
|
||||
}
|
||||
else
|
||||
{
|
||||
m_From.SendGump(new InterfaceMobileGump(m_From, m_Columns, m_List, m_Page, m_Mobile));
|
||||
m_Mobile.MoveToWorld(m_From.Location, m_From.Map);
|
||||
}
|
||||
|
||||
m_From.SendGump(new InterfaceMobileGump(m_From, m_Columns, m_List, m_Page, m_Mobile));
|
||||
break;
|
||||
}
|
||||
case 6: // Move to target
|
||||
{
|
||||
m_From.SendGump(new InterfaceMobileGump(m_From, m_Columns, m_List, m_Page, m_Mobile));
|
||||
m_From.Target = new MoveTarget(m_Mobile);
|
||||
break;
|
||||
}
|
||||
case 7: // Kill
|
||||
{
|
||||
if (m_From == m_Mobile || m_From.AccessLevel > m_Mobile.AccessLevel)
|
||||
m_Mobile.Kill();
|
||||
|
||||
break;
|
||||
}
|
||||
m_From.SendGump(new InterfaceMobileGump(m_From, m_Columns, m_List, m_Page, m_Mobile));
|
||||
|
||||
break;
|
||||
}
|
||||
case 8: // Res
|
||||
{
|
||||
if (m_From == m_Mobile || m_From.AccessLevel > m_Mobile.AccessLevel)
|
||||
{
|
||||
m_Mobile.PlaySound(0x214);
|
||||
m_Mobile.FixedEffect(0x376A, 10, 16);
|
||||
|
||||
m_Mobile.Resurrect();
|
||||
}
|
||||
|
||||
m_From.SendGump(new InterfaceMobileGump(m_From, m_Columns, m_List, m_Page, m_Mobile));
|
||||
|
||||
break;
|
||||
}
|
||||
case 9: // Client
|
||||
{
|
||||
m_From.SendGump(new InterfaceMobileGump(m_From, m_Columns, m_List, m_Page, m_Mobile));
|
||||
{
|
||||
m_From.SendGump(new InterfaceMobileGump(m_From, m_Columns, m_List, m_Page, m_Mobile));
|
||||
|
||||
if (m_Mobile.NetState != null)
|
||||
m_From.SendGump(new ClientGump(m_From, m_Mobile.NetState));
|
||||
if (m_Mobile.NetState != null)
|
||||
m_From.SendGump(new ClientGump(m_From, m_Mobile.NetState));
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,18 +17,18 @@ namespace Server.Commands.Generic
|
|||
Constructor = constructor;
|
||||
}
|
||||
|
||||
public static Dictionary<string, ExtensionInfo> Table{ get; } =
|
||||
public static Dictionary<string, ExtensionInfo> Table { get; } =
|
||||
new Dictionary<string, ExtensionInfo>(StringComparer.InvariantCultureIgnoreCase);
|
||||
|
||||
public int Order{ get; }
|
||||
public int Order { get; }
|
||||
|
||||
public string Name{ get; }
|
||||
public string Name { get; }
|
||||
|
||||
public int Size{ get; }
|
||||
public int Size { get; }
|
||||
|
||||
public bool IsFixedSize => Size >= 0;
|
||||
|
||||
public ExtensionConstructor Constructor{ get; }
|
||||
public ExtensionConstructor Constructor { get; }
|
||||
|
||||
public static void Register(ExtensionInfo ext)
|
||||
{
|
||||
|
|
@ -103,7 +103,7 @@ namespace Server.Commands.Generic
|
|||
|
||||
public abstract class BaseExtension
|
||||
{
|
||||
public abstract ExtensionInfo Info{ get; }
|
||||
public abstract ExtensionInfo Info { get; }
|
||||
|
||||
public string Name => Info.Name;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
using Server.Utilities;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Reflection;
|
||||
using System.Reflection.Emit;
|
||||
using Server.Utilities;
|
||||
|
||||
namespace Server.Commands.Generic
|
||||
{
|
||||
|
|
@ -47,11 +47,11 @@ namespace Server.Commands.Generic
|
|||
Value = value;
|
||||
}
|
||||
|
||||
public Type Type{ get; }
|
||||
public Type Type { get; }
|
||||
|
||||
public object Value{ get; private set; }
|
||||
public object Value { get; private set; }
|
||||
|
||||
public FieldInfo Field{ get; private set; }
|
||||
public FieldInfo Field { get; private set; }
|
||||
|
||||
public bool HasField => Field != null;
|
||||
|
||||
|
|
@ -119,8 +119,7 @@ namespace Server.Commands.Generic
|
|||
BindingFlags.Public | BindingFlags.Static,
|
||||
null,
|
||||
new[] { typeof(string), typeof(NumberStyles) },
|
||||
null
|
||||
);
|
||||
null);
|
||||
|
||||
if (parseNumber != null)
|
||||
{
|
||||
|
|
@ -142,8 +141,7 @@ namespace Server.Commands.Generic
|
|||
BindingFlags.Public | BindingFlags.Static,
|
||||
null,
|
||||
new[] { typeof(string) },
|
||||
null
|
||||
);
|
||||
null);
|
||||
|
||||
parseMethod = parseGeneral;
|
||||
parseArgs = new object[] { toParse };
|
||||
|
|
@ -158,13 +156,11 @@ namespace Server.Commands.Generic
|
|||
Field = typeBuilder.DefineField(
|
||||
fieldName,
|
||||
Type,
|
||||
FieldAttributes.Private | FieldAttributes.InitOnly
|
||||
);
|
||||
FieldAttributes.Private | FieldAttributes.InitOnly);
|
||||
|
||||
// parseMethod.Invoke(null,
|
||||
// parseMethod.Invoke(null,
|
||||
// parseArgs.Length == 2 ? new object[] {toParse, (int) parseArgs[1]} : new object[] {toParse});
|
||||
|
||||
|
||||
il.Emit(OpCodes.Ldarg_0);
|
||||
|
||||
il.Emit(OpCodes.Ldstr, toParse);
|
||||
|
|
@ -179,8 +175,7 @@ namespace Server.Commands.Generic
|
|||
else
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
$"Unable to convert string \"{Value}\" into type '{Type}'."
|
||||
);
|
||||
$"Unable to convert string \"{Value}\" into type '{Type}'.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -215,9 +210,9 @@ namespace Server.Commands.Generic
|
|||
|
||||
public sealed class StringCondition : PropertyCondition
|
||||
{
|
||||
private bool m_IgnoreCase;
|
||||
private StringOperator m_Operator;
|
||||
private PropertyValue m_Value;
|
||||
private readonly bool m_IgnoreCase;
|
||||
private readonly StringOperator m_Operator;
|
||||
private readonly PropertyValue m_Value;
|
||||
|
||||
public StringCondition(Property property, bool not, StringOperator op, object value, bool ignoreCase)
|
||||
: base(property, not)
|
||||
|
|
@ -280,9 +275,7 @@ namespace Server.Commands.Generic
|
|||
typeof(string),
|
||||
typeof(string)
|
||||
},
|
||||
null
|
||||
)
|
||||
);
|
||||
null));
|
||||
|
||||
emitter.Chain(m_Property);
|
||||
m_Value.Load(emitter);
|
||||
|
|
@ -319,9 +312,7 @@ namespace Server.Commands.Generic
|
|||
{
|
||||
typeof(string)
|
||||
},
|
||||
null
|
||||
)
|
||||
);
|
||||
null));
|
||||
|
||||
m_Value.Load(emitter);
|
||||
|
||||
|
|
@ -347,8 +338,8 @@ namespace Server.Commands.Generic
|
|||
|
||||
public sealed class ComparisonCondition : PropertyCondition
|
||||
{
|
||||
private ComparisonOperator m_Operator;
|
||||
private PropertyValue m_Value;
|
||||
private readonly ComparisonOperator m_Operator;
|
||||
private readonly PropertyValue m_Value;
|
||||
|
||||
public ComparisonCondition(Property property, bool not, ComparisonOperator op, object value)
|
||||
: base(property, not)
|
||||
|
|
@ -369,7 +360,7 @@ namespace Server.Commands.Generic
|
|||
bool inverse = false;
|
||||
|
||||
bool couldCompare =
|
||||
emitter.CompareTo(1, delegate { m_Value.Load(emitter); });
|
||||
emitter.CompareTo(1, () => { m_Value.Load(emitter); });
|
||||
|
||||
if (couldCompare)
|
||||
{
|
||||
|
|
@ -449,17 +440,12 @@ namespace Server.Commands.Generic
|
|||
TypeBuilder typeBuilder = assembly.DefineType(
|
||||
$"__conditional{index}",
|
||||
TypeAttributes.Public,
|
||||
typeof(object)
|
||||
);
|
||||
|
||||
#region Constructor
|
||||
|
||||
typeof(object));
|
||||
{
|
||||
ConstructorBuilder ctor = typeBuilder.DefineConstructor(
|
||||
MethodAttributes.Public,
|
||||
CallingConventions.Standard,
|
||||
Type.EmptyTypes
|
||||
);
|
||||
Type.EmptyTypes);
|
||||
|
||||
ILGenerator il = ctor.GetILGenerator();
|
||||
|
||||
|
|
@ -474,16 +460,9 @@ namespace Server.Commands.Generic
|
|||
il.Emit(OpCodes.Ret);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IComparer
|
||||
|
||||
typeBuilder.AddInterfaceImplementation(typeof(IConditional));
|
||||
|
||||
MethodBuilder compareMethod;
|
||||
|
||||
#region Compare
|
||||
|
||||
{
|
||||
MethodEmitter emitter = new MethodEmitter(typeBuilder);
|
||||
|
||||
|
|
@ -531,17 +510,11 @@ namespace Server.Commands.Generic
|
|||
new[]
|
||||
{
|
||||
typeof(object)
|
||||
}
|
||||
)
|
||||
);
|
||||
}));
|
||||
|
||||
compareMethod = emitter.Method;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
Type conditionalType = typeBuilder.CreateType();
|
||||
|
||||
return (IConditional)ActivatorUtil.CreateInstance(conditionalType);
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
using Server.Utilities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.Reflection.Emit;
|
||||
using Server.Utilities;
|
||||
|
||||
namespace Server.Commands.Generic
|
||||
{
|
||||
|
|
@ -13,17 +13,12 @@ namespace Server.Commands.Generic
|
|||
TypeBuilder typeBuilder = assembly.DefineType(
|
||||
"__distinct",
|
||||
TypeAttributes.Public,
|
||||
typeof(object)
|
||||
);
|
||||
|
||||
#region Constructor
|
||||
|
||||
typeof(object));
|
||||
{
|
||||
ConstructorBuilder ctor = typeBuilder.DefineConstructor(
|
||||
MethodAttributes.Public,
|
||||
CallingConventions.Standard,
|
||||
Type.EmptyTypes
|
||||
);
|
||||
Type.EmptyTypes);
|
||||
|
||||
ILGenerator il = ctor.GetILGenerator();
|
||||
|
||||
|
|
@ -36,16 +31,9 @@ namespace Server.Commands.Generic
|
|||
il.Emit(OpCodes.Ret);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IComparer
|
||||
|
||||
typeBuilder.AddInterfaceImplementation(typeof(IComparer<T>));
|
||||
|
||||
MethodBuilder compareMethod;
|
||||
|
||||
#region Compare
|
||||
|
||||
{
|
||||
MethodEmitter emitter = new MethodEmitter(typeBuilder);
|
||||
|
||||
|
|
@ -78,7 +66,7 @@ namespace Server.Commands.Generic
|
|||
if (i > 0)
|
||||
{
|
||||
emitter.LoadLocal(v);
|
||||
emitter.BranchIfTrue(end); // if ( v != 0 ) return v;
|
||||
emitter.BranchIfTrue(end);
|
||||
}
|
||||
|
||||
Property prop = props[i];
|
||||
|
|
@ -87,7 +75,7 @@ namespace Server.Commands.Generic
|
|||
emitter.Chain(prop);
|
||||
|
||||
bool couldCompare =
|
||||
emitter.CompareTo(1, delegate
|
||||
emitter.CompareTo(1, () =>
|
||||
{
|
||||
emitter.LoadLocal(b);
|
||||
emitter.Chain(prop);
|
||||
|
|
@ -112,23 +100,12 @@ namespace Server.Commands.Generic
|
|||
{
|
||||
typeof(T),
|
||||
typeof(T)
|
||||
}
|
||||
) ?? throw new Exception($"No Compare method found for type {typeof(T).FullName}")
|
||||
);
|
||||
}) ?? throw new Exception($"No Compare method found for type {typeof(T).FullName}"));
|
||||
|
||||
compareMethod = emitter.Method;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region IEqualityComparer
|
||||
|
||||
typeBuilder.AddInterfaceImplementation(typeof(IEqualityComparer<T>));
|
||||
|
||||
#region Equals
|
||||
|
||||
{
|
||||
MethodEmitter emitter = new MethodEmitter(typeBuilder);
|
||||
|
||||
|
|
@ -158,15 +135,9 @@ namespace Server.Commands.Generic
|
|||
{
|
||||
typeof(T),
|
||||
typeof(T)
|
||||
}
|
||||
) ?? throw new Exception($"No Equals method found for type {typeof(T).FullName}")
|
||||
);
|
||||
}) ?? throw new Exception($"No Equals method found for type {typeof(T).FullName}"));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetHashCode
|
||||
|
||||
{
|
||||
MethodEmitter emitter = new MethodEmitter(typeBuilder);
|
||||
|
||||
|
|
@ -242,15 +213,9 @@ namespace Server.Commands.Generic
|
|||
new[]
|
||||
{
|
||||
typeof(T)
|
||||
}
|
||||
) ?? throw new Exception($"No GetHashCode method found for type {typeof(T).FullName}")
|
||||
);
|
||||
}) ?? throw new Exception($"No GetHashCode method found for type {typeof(T).FullName}"));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
Type comparerType = typeBuilder.CreateType();
|
||||
|
||||
return (IComparer<T>)ActivatorUtil.CreateInstance(comparerType);
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
using Server.Utilities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.Reflection.Emit;
|
||||
using Server.Utilities;
|
||||
|
||||
namespace Server.Commands.Generic
|
||||
{
|
||||
|
|
@ -17,7 +17,7 @@ namespace Server.Commands.Generic
|
|||
IsAscending = isAscending;
|
||||
}
|
||||
|
||||
public Property Property{ get; set; }
|
||||
public Property Property { get; set; }
|
||||
|
||||
public bool IsAscending
|
||||
{
|
||||
|
|
@ -51,17 +51,12 @@ namespace Server.Commands.Generic
|
|||
TypeBuilder typeBuilder = assembly.DefineType(
|
||||
"__sort",
|
||||
TypeAttributes.Public,
|
||||
typeof(T)
|
||||
);
|
||||
|
||||
#region Constructor
|
||||
|
||||
typeof(T));
|
||||
{
|
||||
ConstructorBuilder ctor = typeBuilder.DefineConstructor(
|
||||
MethodAttributes.Public,
|
||||
CallingConventions.Standard,
|
||||
Type.EmptyTypes
|
||||
);
|
||||
Type.EmptyTypes);
|
||||
|
||||
ILGenerator il = ctor.GetILGenerator();
|
||||
|
||||
|
|
@ -74,13 +69,7 @@ namespace Server.Commands.Generic
|
|||
il.Emit(OpCodes.Ret);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IComparer
|
||||
|
||||
typeBuilder.AddInterfaceImplementation(typeof(IComparer<T>));
|
||||
|
||||
#region Compare
|
||||
{
|
||||
MethodEmitter emitter = new MethodEmitter(typeBuilder);
|
||||
|
||||
|
|
@ -113,7 +102,7 @@ namespace Server.Commands.Generic
|
|||
if (i > 0)
|
||||
{
|
||||
emitter.LoadLocal(v);
|
||||
emitter.BranchIfTrue(end); // if ( v != 0 ) return v;
|
||||
emitter.BranchIfTrue(end);
|
||||
}
|
||||
|
||||
OrderInfo orderInfo = orders[i];
|
||||
|
|
@ -125,7 +114,7 @@ namespace Server.Commands.Generic
|
|||
emitter.Chain(prop);
|
||||
|
||||
bool couldCompare =
|
||||
emitter.CompareTo(sign, delegate
|
||||
emitter.CompareTo(sign, () =>
|
||||
{
|
||||
emitter.LoadLocal(b);
|
||||
emitter.Chain(prop);
|
||||
|
|
@ -150,15 +139,9 @@ namespace Server.Commands.Generic
|
|||
{
|
||||
typeof(T),
|
||||
typeof(T)
|
||||
}
|
||||
) ?? throw new Exception($"No Compare method found for type {typeof(T).FullName}")
|
||||
);
|
||||
}) ?? throw new Exception($"No Compare method found for type {typeof(T).FullName}"));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
Type comparerType = typeBuilder.CreateType();
|
||||
return (IComparer<T>)ActivatorUtil.CreateInstance(comparerType);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ namespace Server.Commands.Generic
|
|||
|
||||
private IComparer<object> m_Comparer;
|
||||
|
||||
private List<Property> m_Properties;
|
||||
private readonly List<Property> m_Properties;
|
||||
|
||||
public DistinctExtension() => m_Properties = new List<Property>();
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ namespace Server.Commands.Generic
|
|||
|
||||
public override ExtensionInfo Info => ExtInfo;
|
||||
|
||||
public int Limit{ get; private set; }
|
||||
public int Limit { get; private set; }
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ namespace Server.Commands.Generic
|
|||
|
||||
private IComparer<object> m_Comparer;
|
||||
|
||||
private List<OrderInfo> m_Orders;
|
||||
private readonly List<OrderInfo> m_Orders;
|
||||
|
||||
public SortExtension() => m_Orders = new List<OrderInfo>();
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ namespace Server.Commands.Generic
|
|||
|
||||
public override ExtensionInfo Info => ExtInfo;
|
||||
|
||||
public ObjectConditional Conditional{ get; private set; }
|
||||
public ObjectConditional Conditional { get; private set; }
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Server.Commands.Generic
|
||||
{
|
||||
|
|
@ -19,7 +18,7 @@ namespace Server.Commands.Generic
|
|||
Instance = this;
|
||||
}
|
||||
|
||||
public static AreaCommandImplementor Instance{ get; private set; }
|
||||
public static AreaCommandImplementor Instance { get; private set; }
|
||||
|
||||
public override void Process(Mobile from, BaseCommand command, string[] args)
|
||||
{
|
||||
|
|
@ -48,7 +47,6 @@ namespace Server.Commands.Generic
|
|||
if ((!mobiles || obj is Mobile) && BaseCommand.IsAccessible(from, obj) && ext.IsValid(obj))
|
||||
objs.Add(obj);
|
||||
|
||||
|
||||
eable.Free();
|
||||
ext.Filter(objs);
|
||||
|
||||
|
|
|
|||
|
|
@ -32,19 +32,19 @@ namespace Server.Commands.Generic
|
|||
|
||||
public BaseCommandImplementor() => Commands = new Dictionary<string, BaseCommand>(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
public bool SupportsConditionals{ get; set; }
|
||||
public bool SupportsConditionals { get; set; }
|
||||
|
||||
public string[] Accessors{ get; set; }
|
||||
public string[] Accessors { get; set; }
|
||||
|
||||
public string Usage{ get; set; }
|
||||
public string Usage { get; set; }
|
||||
|
||||
public string Description{ get; set; }
|
||||
public string Description { get; set; }
|
||||
|
||||
public AccessLevel AccessLevel{ get; set; }
|
||||
public AccessLevel AccessLevel { get; set; }
|
||||
|
||||
public CommandSupport SupportRequirement{ get; set; }
|
||||
public CommandSupport SupportRequirement { get; set; }
|
||||
|
||||
public Dictionary<string, BaseCommand> Commands{ get; }
|
||||
public Dictionary<string, BaseCommand> Commands { get; }
|
||||
|
||||
public static List<BaseCommandImplementor> Implementors
|
||||
{
|
||||
|
|
@ -110,43 +110,43 @@ namespace Server.Commands.Generic
|
|||
{
|
||||
case ObjectTypes.All:
|
||||
case ObjectTypes.Both:
|
||||
{
|
||||
if (condIsItem)
|
||||
items = true;
|
||||
{
|
||||
if (condIsItem)
|
||||
items = true;
|
||||
|
||||
if (condIsMobile)
|
||||
mobiles = true;
|
||||
if (condIsMobile)
|
||||
mobiles = true;
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ObjectTypes.Items:
|
||||
{
|
||||
if (condIsItem)
|
||||
{
|
||||
items = true;
|
||||
}
|
||||
else if (condIsMobile)
|
||||
{
|
||||
from.SendMessage("You may not use a mobile type condition for this command.");
|
||||
return false;
|
||||
}
|
||||
if (condIsItem)
|
||||
{
|
||||
items = true;
|
||||
}
|
||||
else if (condIsMobile)
|
||||
{
|
||||
from.SendMessage("You may not use a mobile type condition for this command.");
|
||||
return false;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ObjectTypes.Mobiles:
|
||||
{
|
||||
if (condIsMobile)
|
||||
{
|
||||
mobiles = true;
|
||||
}
|
||||
else if (condIsItem)
|
||||
{
|
||||
from.SendMessage("You may not use an item type condition for this command.");
|
||||
return false;
|
||||
}
|
||||
if (condIsMobile)
|
||||
{
|
||||
mobiles = true;
|
||||
}
|
||||
else if (condIsItem)
|
||||
{
|
||||
from.SendMessage("You may not use an item type condition for this command.");
|
||||
return false;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
@ -199,8 +199,8 @@ namespace Server.Commands.Generic
|
|||
|
||||
public void RunCommand(Mobile from, object obj, BaseCommand command, string[] args)
|
||||
{
|
||||
// try
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
CommandEventArgs e = new CommandEventArgs(from, command.Commands[0], GenerateArgString(args), args);
|
||||
|
||||
if (!command.ValidateArgs(this, e))
|
||||
|
|
@ -226,17 +226,17 @@ namespace Server.Commands.Generic
|
|||
else if (obj != null)
|
||||
{
|
||||
if (command.ListOptimized)
|
||||
command.ExecuteList(e, new List<object>{ obj });
|
||||
command.ExecuteList(e, new List<object> { obj });
|
||||
else
|
||||
command.Execute(e, obj);
|
||||
}
|
||||
|
||||
command.Flush(from, flushToLog);
|
||||
// }
|
||||
// catch ( Exception ex )
|
||||
// {
|
||||
// from.SendMessage( ex.Message );
|
||||
// }
|
||||
// }
|
||||
// catch ( Exception ex )
|
||||
// {
|
||||
// from.SendMessage( ex.Message );
|
||||
// }
|
||||
}
|
||||
|
||||
public virtual void Process(Mobile from, BaseCommand command, string[] args)
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ namespace Server.Commands.Generic
|
|||
from.SendMessage("That is not a container.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
Extensions ext = Extensions.Parse(from, ref args);
|
||||
|
|
|
|||
|
|
@ -33,35 +33,35 @@ namespace Server.Commands.Generic
|
|||
switch (command.ObjectTypes)
|
||||
{
|
||||
case ObjectTypes.Both:
|
||||
{
|
||||
if (!(targeted is Item || targeted is Mobile))
|
||||
{
|
||||
from.SendMessage("This command does not work on that.");
|
||||
return;
|
||||
}
|
||||
if (!(targeted is Item || targeted is Mobile))
|
||||
{
|
||||
from.SendMessage("This command does not work on that.");
|
||||
return;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ObjectTypes.Items:
|
||||
{
|
||||
if (!(targeted is Item))
|
||||
{
|
||||
from.SendMessage("This command only works on items.");
|
||||
return;
|
||||
}
|
||||
if (!(targeted is Item))
|
||||
{
|
||||
from.SendMessage("This command only works on items.");
|
||||
return;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ObjectTypes.Mobiles:
|
||||
{
|
||||
if (!(targeted is Mobile))
|
||||
{
|
||||
from.SendMessage("This command only works on mobiles.");
|
||||
return;
|
||||
}
|
||||
if (!(targeted is Mobile))
|
||||
{
|
||||
from.SendMessage("This command only works on mobiles.");
|
||||
return;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
RunCommand(from, targeted, command, args);
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ namespace Server.Commands.Generic
|
|||
|
||||
private IConditional[] m_Conditionals;
|
||||
|
||||
private ICondition[][] m_Conditions;
|
||||
private readonly ICondition[][] m_Conditions;
|
||||
|
||||
public ObjectConditional(Type objectType, ICondition[][] conditions)
|
||||
{
|
||||
|
|
@ -20,7 +20,7 @@ namespace Server.Commands.Generic
|
|||
m_Conditions = conditions;
|
||||
}
|
||||
|
||||
public Type Type{ get; }
|
||||
public Type Type { get; }
|
||||
|
||||
public bool IsItem => Type == null || Type == typeofItem || Type.IsSubclassOf(typeofItem);
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ namespace Server.Commands.Generic
|
|||
Instance = this;
|
||||
}
|
||||
|
||||
public static RangeCommandImplementor Instance{ get; private set; }
|
||||
public static RangeCommandImplementor Instance { get; private set; }
|
||||
|
||||
public override void Execute(CommandEventArgs e)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -46,25 +46,25 @@ namespace Server.Commands.Generic
|
|||
switch (command.ObjectTypes)
|
||||
{
|
||||
case ObjectTypes.Items:
|
||||
{
|
||||
if (!(obj is Item))
|
||||
{
|
||||
e.Mobile.SendMessage("This command only works on items.");
|
||||
return;
|
||||
}
|
||||
if (!(obj is Item))
|
||||
{
|
||||
e.Mobile.SendMessage("This command only works on items.");
|
||||
return;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ObjectTypes.Mobiles:
|
||||
{
|
||||
if (!(obj is Mobile))
|
||||
{
|
||||
e.Mobile.SendMessage("This command only works on mobiles.");
|
||||
return;
|
||||
}
|
||||
if (!(obj is Mobile))
|
||||
{
|
||||
e.Mobile.SendMessage("This command only works on mobiles.");
|
||||
return;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
string[] oldArgs = e.Arguments;
|
||||
|
|
|
|||
|
|
@ -52,35 +52,35 @@ namespace Server.Commands.Generic
|
|||
switch (command.ObjectTypes)
|
||||
{
|
||||
case ObjectTypes.Both:
|
||||
{
|
||||
if (!(targeted is Item) && !(targeted is Mobile))
|
||||
{
|
||||
from.SendMessage("This command does not work on that.");
|
||||
return;
|
||||
}
|
||||
if (!(targeted is Item) && !(targeted is Mobile))
|
||||
{
|
||||
from.SendMessage("This command does not work on that.");
|
||||
return;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ObjectTypes.Items:
|
||||
{
|
||||
if (!(targeted is Item))
|
||||
{
|
||||
from.SendMessage("This command only works on items.");
|
||||
return;
|
||||
}
|
||||
if (!(targeted is Item))
|
||||
{
|
||||
from.SendMessage("This command only works on items.");
|
||||
return;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ObjectTypes.Mobiles:
|
||||
{
|
||||
if (!(targeted is Mobile))
|
||||
{
|
||||
from.SendMessage("This command only works on mobiles.");
|
||||
return;
|
||||
}
|
||||
if (!(targeted is Mobile))
|
||||
{
|
||||
from.SendMessage("This command only works on mobiles.");
|
||||
return;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
RunCommand(from, targeted, command, args);
|
||||
|
|
|
|||
|
|
@ -287,7 +287,7 @@ namespace Server.Commands
|
|||
|
||||
foreach (Mobile m in World.Mobiles.Values)
|
||||
if (m is BaseCreature bc)
|
||||
if (bc.Controlled && bc.ControlMaster == master || bc.Summoned && bc.SummonMaster == master)
|
||||
if ((bc.Controlled && bc.ControlMaster == master) || (bc.Summoned && bc.SummonMaster == master))
|
||||
pets.Add(bc);
|
||||
|
||||
if (pets.Count > 0)
|
||||
|
|
@ -408,7 +408,7 @@ namespace Server.Commands
|
|||
AutoSave.Save(true);
|
||||
}
|
||||
|
||||
private static bool FixMap(ref Map map, ref Point3D loc, Item item) => map != null && map != Map.Internal || item.RootParent is Mobile m && FixMap(ref map, ref loc, m);
|
||||
private static bool FixMap(ref Map map, ref Point3D loc, Item item) => (map != null && map != Map.Internal) || (item.RootParent is Mobile m && FixMap(ref map, ref loc, m));
|
||||
|
||||
private static bool FixMap(ref Map map, ref Point3D loc, Mobile m)
|
||||
{
|
||||
|
|
@ -782,7 +782,7 @@ namespace Server.Commands
|
|||
|
||||
private class EquipMenu : ItemListMenu
|
||||
{
|
||||
private Mobile m_Mobile;
|
||||
private readonly Mobile m_Mobile;
|
||||
|
||||
public EquipMenu(Mobile from, Mobile m, ItemListEntry[] entries) : base("Equipment", entries)
|
||||
{
|
||||
|
|
@ -804,8 +804,8 @@ namespace Server.Commands
|
|||
|
||||
private class EquipDetailsMenu : QuestionMenu
|
||||
{
|
||||
private Item m_Item;
|
||||
private Mobile m_Mobile;
|
||||
private readonly Item m_Item;
|
||||
private readonly Mobile m_Mobile;
|
||||
|
||||
public EquipDetailsMenu(Mobile m, Item item) : base($"{item.Layer}: {item.GetType().Name}",
|
||||
new[] { "Move", "Delete", "Props" })
|
||||
|
|
|
|||
|
|
@ -11,9 +11,9 @@ namespace Server.Commands
|
|||
{
|
||||
public class HelpInfo
|
||||
{
|
||||
public static Dictionary<string, CommandInfo> HelpInfos{ get; } = new Dictionary<string, CommandInfo>();
|
||||
public static Dictionary<string, CommandInfo> HelpInfos { get; } = new Dictionary<string, CommandInfo>();
|
||||
|
||||
public static List<CommandInfo> SortedHelpInfo{ get; private set; } = new List<CommandInfo>();
|
||||
public static List<CommandInfo> SortedHelpInfo { get; private set; } = new List<CommandInfo>();
|
||||
|
||||
[CallPriority(100)]
|
||||
public static void Initialize()
|
||||
|
|
@ -106,7 +106,6 @@ namespace Server.Commands
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
for (int i = 0; i < TargetCommands.AllCommands.Count; ++i)
|
||||
{
|
||||
BaseCommand command = TargetCommands.AllCommands[i];
|
||||
|
|
@ -221,9 +220,9 @@ namespace Server.Commands
|
|||
public class CommandListGump : BaseGridGump
|
||||
{
|
||||
private const int EntriesPerPage = 15;
|
||||
private List<CommandInfo> m_List;
|
||||
private readonly List<CommandInfo> m_List;
|
||||
|
||||
private int m_Page;
|
||||
private readonly int m_Page;
|
||||
|
||||
public CommandListGump(int page, Mobile from, List<CommandInfo> list)
|
||||
: base(30, 30)
|
||||
|
|
@ -290,51 +289,50 @@ namespace Server.Commands
|
|||
switch (info.ButtonID)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
m.CloseGump<CommandInfoGump>();
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
if (m_Page > 0)
|
||||
m.SendGump(new CommandListGump(m_Page - 1, m, m_List));
|
||||
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
if ((m_Page + 1) * EntriesPerPage < SortedHelpInfo.Count)
|
||||
m.SendGump(new CommandListGump(m_Page + 1, m, m_List));
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
int v = info.ButtonID - 3;
|
||||
|
||||
if (v >= 0 && v < m_List.Count)
|
||||
{
|
||||
CommandInfo c = m_List[v];
|
||||
|
||||
if (m.AccessLevel >= c.AccessLevel)
|
||||
{
|
||||
m.SendGump(new CommandInfoGump(c));
|
||||
m.SendGump(new CommandListGump(m_Page, m, m_List));
|
||||
}
|
||||
else
|
||||
{
|
||||
m.SendMessage("You no longer have access to that command.");
|
||||
m.SendGump(new CommandListGump(m_Page, m, null));
|
||||
}
|
||||
m.CloseGump<CommandInfoGump>();
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
if (m_Page > 0)
|
||||
m.SendGump(new CommandListGump(m_Page - 1, m, m_List));
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
if ((m_Page + 1) * EntriesPerPage < SortedHelpInfo.Count)
|
||||
m.SendGump(new CommandListGump(m_Page + 1, m, m_List));
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
int v = info.ButtonID - 3;
|
||||
|
||||
if (v >= 0 && v < m_List.Count)
|
||||
{
|
||||
CommandInfo c = m_List[v];
|
||||
|
||||
if (m.AccessLevel >= c.AccessLevel)
|
||||
{
|
||||
m.SendGump(new CommandInfoGump(c));
|
||||
m.SendGump(new CommandListGump(m_Page, m, m_List));
|
||||
}
|
||||
else
|
||||
{
|
||||
m.SendMessage("You no longer have access to that command.");
|
||||
m.SendGump(new CommandListGump(m_Page, m, null));
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class CommandInfoGump : Gump
|
||||
{
|
||||
public CommandInfoGump(CommandInfo info, int width = 320, int height = 200)
|
||||
|
|
@ -344,13 +342,13 @@ namespace Server.Commands
|
|||
|
||||
AddBackground(0, 0, width, height, 5054);
|
||||
|
||||
//AddImageTiled( 10, 10, width - 20, 20, 2624 );
|
||||
//AddAlphaRegion( 10, 10, width - 20, 20 );
|
||||
//AddHtmlLocalized( 10, 10, width - 20, 20, header, headerColor, false, false );
|
||||
// AddImageTiled( 10, 10, width - 20, 20, 2624 );
|
||||
// AddAlphaRegion( 10, 10, width - 20, 20 );
|
||||
// AddHtmlLocalized( 10, 10, width - 20, 20, header, headerColor, false, false );
|
||||
AddHtml(10, 10, width - 20, 20, Color(Center(info.Name), 0xFF0000));
|
||||
|
||||
//AddImageTiled( 10, 40, width - 20, height - 80, 2624 );
|
||||
//AddAlphaRegion( 10, 40, width - 20, height - 80 );
|
||||
// AddImageTiled( 10, 40, width - 20, height - 80, 2624 );
|
||||
// AddAlphaRegion( 10, 40, width - 20, height - 80 );
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
|
|
@ -384,8 +382,8 @@ namespace Server.Commands
|
|||
|
||||
AddHtml(10, 40, width - 20, height - 80, sb.ToString(), false, true);
|
||||
|
||||
//AddImageTiled( 10, height - 30, width - 20, 20, 2624 );
|
||||
//AddAlphaRegion( 10, height - 30, width - 20, 20 );
|
||||
// AddImageTiled( 10, height - 30, width - 20, 20, 2624 );
|
||||
// AddAlphaRegion( 10, height - 30, width - 20, 20 );
|
||||
}
|
||||
|
||||
public string Color(string text, int color) => $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using Server.Commands.Generic;
|
||||
using Server.Items;
|
||||
using Server.Targeting;
|
||||
using System.Globalization;
|
||||
|
||||
namespace Server.Commands
|
||||
{
|
||||
public class LocationCommand : BaseCommand
|
||||
{
|
||||
private static readonly List<int> m_DefaultGraphics = new List<int>{ 0x17AF, 0x17B0, 0x17B1, 0x17B2 };
|
||||
private static readonly List<int> m_DefaultGraphics = new List<int> { 0x17AF, 0x17B0, 0x17B1, 0x17B2 };
|
||||
|
||||
public LocationCommand()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -7,10 +7,10 @@ namespace Server.Commands
|
|||
{
|
||||
public class CommandLogging
|
||||
{
|
||||
private static char[] m_NotSafe = { '\\', '/', ':', '*', '?', '"', '<', '>', '|' };
|
||||
public static bool Enabled{ get; set; } = true;
|
||||
private static readonly char[] m_NotSafe = { '\\', '/', ':', '*', '?', '"', '<', '>', '|' };
|
||||
public static bool Enabled { get; set; } = true;
|
||||
|
||||
public static StreamWriter Output{ get; private set; }
|
||||
public static StreamWriter Output { get; private set; }
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ using Server.Diagnostics;
|
|||
|
||||
namespace Server.Commands
|
||||
{
|
||||
public class Profiling
|
||||
public static class Profiling
|
||||
{
|
||||
public static void Initialize()
|
||||
{
|
||||
|
|
@ -168,10 +168,10 @@ namespace Server.Commands
|
|||
if ((flags & ExpandFlag.Blessed) != 0)
|
||||
++countTable[4];
|
||||
|
||||
/*if ( ( flags & ExpandFlag.TempFlag ) != 0 )
|
||||
/*if (( flags & ExpandFlag.TempFlag ) != 0)
|
||||
++countTable[5];
|
||||
|
||||
if ( ( flags & ExpandFlag.SaveFlag ) != 0 )
|
||||
if (( flags & ExpandFlag.SaveFlag ) != 0)
|
||||
++countTable[6];*/
|
||||
|
||||
if ((flags & ExpandFlag.Weight) != 0)
|
||||
|
|
@ -243,7 +243,8 @@ namespace Server.Commands
|
|||
{
|
||||
parms[0]++;
|
||||
parms[1] += item.Amount;
|
||||
} else
|
||||
}
|
||||
else
|
||||
table[type] = new[] { 1, item.Amount };
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,25 +18,25 @@ namespace Server.Commands
|
|||
|
||||
public static class Properties
|
||||
{
|
||||
private static Type typeofCPA = typeof(CPA);
|
||||
private static readonly Type typeofCPA = typeof(CPA);
|
||||
|
||||
private static Type typeofSerial = typeof(Serial);
|
||||
private static readonly Type typeofSerial = typeof(Serial);
|
||||
|
||||
private static Type typeofType = typeof(Type);
|
||||
private static readonly Type typeofType = typeof(Type);
|
||||
|
||||
private static Type typeofChar = typeof(char);
|
||||
private static readonly Type typeofChar = typeof(char);
|
||||
|
||||
private static Type typeofString = typeof(string);
|
||||
private static readonly Type typeofString = typeof(string);
|
||||
|
||||
private static Type typeofText = typeof(TextDefinition);
|
||||
private static readonly Type typeofText = typeof(TextDefinition);
|
||||
|
||||
private static Type typeofTimeSpan = typeof(TimeSpan);
|
||||
private static Type typeofParsable = typeof(ParsableAttribute);
|
||||
private static readonly Type typeofTimeSpan = typeof(TimeSpan);
|
||||
private static readonly Type typeofParsable = typeof(ParsableAttribute);
|
||||
|
||||
private static Type[] m_ParseTypes = { typeof(string) };
|
||||
private static object[] m_ParseParams = new object[1];
|
||||
private static readonly Type[] m_ParseTypes = { typeof(string) };
|
||||
private static readonly object[] m_ParseParams = new object[1];
|
||||
|
||||
private static Type[] m_NumericTypes =
|
||||
private static readonly Type[] m_NumericTypes =
|
||||
{
|
||||
typeof(byte), typeof(sbyte),
|
||||
typeof(short), typeof(ushort),
|
||||
|
|
@ -602,8 +602,8 @@ namespace Server
|
|||
{
|
||||
}
|
||||
|
||||
public AccessLevel PlayerAccess{ get; set; }
|
||||
public AccessLevel NeededAccess{ get; set; }
|
||||
public AccessLevel PlayerAccess { get; set; }
|
||||
public AccessLevel NeededAccess { get; set; }
|
||||
}
|
||||
|
||||
public sealed class ReadAccessException : ClearanceException
|
||||
|
|
@ -630,11 +630,11 @@ namespace Server
|
|||
|
||||
public Property(PropertyInfo[] chain) => m_Chain = chain;
|
||||
|
||||
public string Binding{ get; }
|
||||
public string Binding { get; }
|
||||
|
||||
public bool IsBound => m_Chain != null;
|
||||
|
||||
public PropertyAccess Access{ get; private set; }
|
||||
public PropertyAccess Access { get; private set; }
|
||||
|
||||
public PropertyInfo[] Chain
|
||||
{
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ namespace Server.Commands
|
|||
{
|
||||
public class SignParser
|
||||
{
|
||||
private static Queue<Item> m_ToDelete = new Queue<Item>();
|
||||
private static readonly Queue<Item> m_ToDelete = new Queue<Item>();
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
|
|
@ -119,10 +119,10 @@ namespace Server.Commands
|
|||
|
||||
private class SignEntry
|
||||
{
|
||||
public int m_ItemID;
|
||||
public Point3D m_Location;
|
||||
public int m_Map;
|
||||
public string m_Text;
|
||||
public readonly int m_ItemID;
|
||||
public readonly Point3D m_Location;
|
||||
public readonly int m_Map;
|
||||
public readonly string m_Text;
|
||||
|
||||
public SignEntry(string text, Point3D pt, int itemID, int mapLoc)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ namespace Server.Commands
|
|||
|
||||
public class AllSkillsTarget : Target
|
||||
{
|
||||
private double m_Value;
|
||||
private readonly double m_Value;
|
||||
|
||||
public AllSkillsTarget(double value) : base(-1, false, TargetFlags.None) => m_Value = value;
|
||||
|
||||
|
|
@ -82,9 +82,9 @@ namespace Server.Commands
|
|||
|
||||
public class SkillTarget : Target
|
||||
{
|
||||
private bool m_Set;
|
||||
private SkillName m_Skill;
|
||||
private double m_Value;
|
||||
private readonly bool m_Set;
|
||||
private readonly SkillName m_Skill;
|
||||
private readonly double m_Value;
|
||||
|
||||
public SkillTarget(SkillName skill, double value) : base(-1, false, TargetFlags.None)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ namespace Server
|
|||
"It is strongly recommended that you make backup of the data files mentioned above. " +
|
||||
"Do you wish to proceed?";
|
||||
|
||||
private static Point3D NullP3D = new Point3D(int.MinValue, int.MinValue, int.MinValue);
|
||||
private static readonly Point3D NullP3D = new Point3D(int.MinValue, int.MinValue, int.MinValue);
|
||||
|
||||
private static byte[] m_Buffer;
|
||||
|
||||
|
|
@ -45,7 +45,7 @@ namespace Server
|
|||
CommandSystem.Register("UnfreezeWorld", AccessLevel.Administrator, UnfreezeWorld_OnCommand);
|
||||
}
|
||||
|
||||
public delegate void FreezeCallback( Mobile from, bool okay, StateInfo si );
|
||||
public delegate void FreezeCallback(Mobile from, bool okay, StateInfo si);
|
||||
|
||||
[Usage("Freeze")]
|
||||
[Description("Makes a targeted area of dynamic items static.")]
|
||||
|
|
@ -361,79 +361,79 @@ namespace Server
|
|||
BinaryWriter mulWriter = new BinaryWriter(mulStream);
|
||||
|
||||
for (int x = xStartBlock; x <= xEndBlock; ++x)
|
||||
for (int y = yStartBlock; y <= yEndBlock; ++y)
|
||||
{
|
||||
StaticTile[] oldTiles = ReadStaticBlock(idxReader, mulStream, x, y, matrix.BlockWidth,
|
||||
matrix.BlockHeight, out int oldTileCount);
|
||||
|
||||
if (oldTileCount < 0)
|
||||
continue;
|
||||
|
||||
int newTileCount = 0;
|
||||
StaticTile[] newTiles = new StaticTile[oldTileCount];
|
||||
|
||||
int baseX = (x << 3) - xTileStart, baseY = (y << 3) - yTileStart;
|
||||
|
||||
for (int i = 0; i < oldTileCount; ++i)
|
||||
for (int y = yStartBlock; y <= yEndBlock; ++y)
|
||||
{
|
||||
StaticTile oldTile = oldTiles[i];
|
||||
StaticTile[] oldTiles = ReadStaticBlock(idxReader, mulStream, x, y, matrix.BlockWidth,
|
||||
matrix.BlockHeight, out int oldTileCount);
|
||||
|
||||
int px = baseX + oldTile.X;
|
||||
int py = baseY + oldTile.Y;
|
||||
if (oldTileCount < 0)
|
||||
continue;
|
||||
|
||||
if (px < 0 || px >= xTileWidth || py < 0 || py >= yTileHeight)
|
||||
int newTileCount = 0;
|
||||
StaticTile[] newTiles = new StaticTile[oldTileCount];
|
||||
|
||||
int baseX = (x << 3) - xTileStart, baseY = (y << 3) - yTileStart;
|
||||
|
||||
for (int i = 0; i < oldTileCount; ++i)
|
||||
{
|
||||
newTiles[newTileCount++] = oldTile;
|
||||
StaticTile oldTile = oldTiles[i];
|
||||
|
||||
int px = baseX + oldTile.X;
|
||||
int py = baseY + oldTile.Y;
|
||||
|
||||
if (px < 0 || px >= xTileWidth || py < 0 || py >= yTileHeight)
|
||||
{
|
||||
newTiles[newTileCount++] = oldTile;
|
||||
}
|
||||
else
|
||||
{
|
||||
++totalUnfrozen;
|
||||
|
||||
Item item = new Static(oldTile.ID);
|
||||
|
||||
item.Hue = oldTile.Hue;
|
||||
|
||||
item.MoveToWorld(new Point3D(px + xTileStart, py + yTileStart, oldTile.Z), map);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
int mulPos = -1;
|
||||
int length = -1;
|
||||
int extra = 0;
|
||||
|
||||
if (newTileCount > 0)
|
||||
{
|
||||
++totalUnfrozen;
|
||||
mulWriter.Seek(0, SeekOrigin.End);
|
||||
|
||||
Item item = new Static(oldTile.ID);
|
||||
mulPos = (int)mulWriter.BaseStream.Position;
|
||||
length = newTileCount * 7;
|
||||
extra = 1;
|
||||
|
||||
item.Hue = oldTile.Hue;
|
||||
for (int i = 0; i < newTileCount; ++i)
|
||||
{
|
||||
StaticTile toWrite = newTiles[i];
|
||||
|
||||
item.MoveToWorld(new Point3D(px + xTileStart, py + yTileStart, oldTile.Z), map);
|
||||
mulWriter.Write((ushort)toWrite.ID);
|
||||
mulWriter.Write((byte)toWrite.X);
|
||||
mulWriter.Write((byte)toWrite.Y);
|
||||
mulWriter.Write((sbyte)toWrite.Z);
|
||||
mulWriter.Write((short)toWrite.Hue);
|
||||
}
|
||||
|
||||
mulWriter.Flush();
|
||||
}
|
||||
|
||||
int idxPos = (x * matrix.BlockHeight + y) * 12;
|
||||
|
||||
idxWriter.Seek(idxPos, SeekOrigin.Begin);
|
||||
idxWriter.Write(mulPos);
|
||||
idxWriter.Write(length);
|
||||
idxWriter.Write(extra);
|
||||
|
||||
idxWriter.Flush();
|
||||
|
||||
matrix.SetStaticBlock(x, y, null);
|
||||
}
|
||||
|
||||
int mulPos = -1;
|
||||
int length = -1;
|
||||
int extra = 0;
|
||||
|
||||
if (newTileCount > 0)
|
||||
{
|
||||
mulWriter.Seek(0, SeekOrigin.End);
|
||||
|
||||
mulPos = (int)mulWriter.BaseStream.Position;
|
||||
length = newTileCount * 7;
|
||||
extra = 1;
|
||||
|
||||
for (int i = 0; i < newTileCount; ++i)
|
||||
{
|
||||
StaticTile toWrite = newTiles[i];
|
||||
|
||||
mulWriter.Write((ushort)toWrite.ID);
|
||||
mulWriter.Write((byte)toWrite.X);
|
||||
mulWriter.Write((byte)toWrite.Y);
|
||||
mulWriter.Write((sbyte)toWrite.Z);
|
||||
mulWriter.Write((short)toWrite.Hue);
|
||||
}
|
||||
|
||||
mulWriter.Flush();
|
||||
}
|
||||
|
||||
int idxPos = (x * matrix.BlockHeight + y) * 12;
|
||||
|
||||
idxWriter.Seek(idxPos, SeekOrigin.Begin);
|
||||
idxWriter.Write(mulPos);
|
||||
idxWriter.Write(length);
|
||||
idxWriter.Write(extra);
|
||||
|
||||
idxWriter.Flush();
|
||||
|
||||
matrix.SetStaticBlock(x, y, null);
|
||||
}
|
||||
}
|
||||
|
||||
public static void DoUnfreeze(Map map, ref bool badDataFile, ref int totalUnfrozen)
|
||||
|
|
@ -551,8 +551,9 @@ namespace Server
|
|||
|
||||
private class DeltaState
|
||||
{
|
||||
public List<Item> m_List;
|
||||
public int m_X, m_Y;
|
||||
public readonly List<Item> m_List;
|
||||
public readonly int m_X;
|
||||
public readonly int m_Y;
|
||||
|
||||
public DeltaState(Point2D p)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -72,9 +72,9 @@ namespace Server.Commands
|
|||
|
||||
IPooledEnumerable<IEntity> eable;
|
||||
|
||||
if (!items && !multis || !mobiles)
|
||||
if ((!items && !multis) || !mobiles)
|
||||
return;
|
||||
|
||||
|
||||
eable = map.GetObjectsInBounds(rect);
|
||||
|
||||
foreach (IEntity obj in eable)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue