Formatting FIxes (#58)

This commit is contained in:
Kamron Batman 2019-10-04 23:08:13 -07:00 committed by GitHub
parent 57fb9fb525
commit 096d39609e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
1318 changed files with 11633 additions and 22129 deletions

File diff suppressed because it is too large Load diff

View file

@ -70,15 +70,13 @@ namespace Server.Accounting
if (accessLog.Counts >= 3)
try
{
using (StreamWriter op = new StreamWriter("throttle.log", true))
{
op.WriteLine(
"{0}\t{1}\t{2}",
DateTime.UtcNow,
ns,
accessLog.Counts
);
}
using StreamWriter op = new StreamWriter("throttle.log", true);
op.WriteLine(
"{0}\t{1}\t{2}",
DateTime.UtcNow,
ns,
accessLog.Counts
);
}
catch
{

View file

@ -21,10 +21,7 @@ namespace Server.Accounting
EventSink.WorldSave += Save;
}
public static ICollection<IAccount> GetAccounts()
{
return m_Accounts.Values;
}
public static ICollection<IAccount> GetAccounts() => m_Accounts.Values;
public static IAccount GetAccount(string username)
{
@ -75,24 +72,22 @@ namespace Server.Accounting
string filePath = Path.Combine("Saves/Accounts", "accounts.xml");
using (StreamWriter op = new StreamWriter(filePath))
{
XmlTextWriter xml = new XmlTextWriter(op) { Formatting = Formatting.Indented, IndentChar = '\t', Indentation = 1 };
using StreamWriter op = new StreamWriter(filePath);
XmlTextWriter xml = new XmlTextWriter(op) { Formatting = Formatting.Indented, IndentChar = '\t', Indentation = 1 };
xml.WriteStartDocument(true);
xml.WriteStartDocument(true);
xml.WriteStartElement("accounts");
xml.WriteStartElement("accounts");
xml.WriteAttributeString("count", m_Accounts.Count.ToString());
xml.WriteAttributeString("count", m_Accounts.Count.ToString());
foreach (Account a in GetAccounts())
a.Save(xml);
foreach (Account a in GetAccounts())
a.Save(xml);
xml.WriteEndElement();
xml.WriteEndElement();
xml.Close();
}
xml.Close();
}
}
}

View file

@ -13,20 +13,20 @@ namespace Server
string path = "firewall.cfg";
if (File.Exists(path))
using (StreamReader ip = new StreamReader(path))
{
using StreamReader ip = new StreamReader(path);
string line;
while ((line = ip.ReadLine()) != null)
{
string line;
line = line.Trim();
while ((line = ip.ReadLine()) != null)
{
line = line.Trim();
if (line.Length == 0)
continue;
if (line.Length == 0)
continue;
List.Add(ToFirewallEntry(line));
List.Add(ToFirewallEntry(line));
/*
/*
object toAdd;
IPAddress addr;
@ -37,8 +37,8 @@ namespace Server
m_Blocked.Add( toAdd.ToString() );
* */
}
}
}
}
public static List<IFirewallEntry> List{ get; }
@ -130,11 +130,9 @@ namespace Server
{
string path = "firewall.cfg";
using (StreamWriter op = new StreamWriter(path))
{
for (int i = 0; i < List.Count; ++i)
op.WriteLine(List[i]);
}
using StreamWriter op = new StreamWriter(path);
for (int i = 0; i < List.Count; ++i)
op.WriteLine(List[i]);
}
public static bool IsBlocked(IPAddress ip)
@ -177,20 +175,11 @@ namespace Server
{
private IPAddress m_Address;
public IPFirewallEntry(IPAddress address)
{
m_Address = address;
}
public IPFirewallEntry(IPAddress address) => m_Address = address;
public bool IsBlocked(IPAddress address)
{
return m_Address.Equals(address);
}
public bool IsBlocked(IPAddress address) => m_Address.Equals(address);
public override string ToString()
{
return m_Address.ToString();
}
public override string ToString() => m_Address.ToString();
public override bool Equals(object obj)
{
@ -209,10 +198,7 @@ namespace Server
return false;
}
public override int GetHashCode()
{
return m_Address.GetHashCode();
}
public override int GetHashCode() => m_Address.GetHashCode();
}
public class CIDRFirewallEntry : IFirewallEntry
@ -226,15 +212,9 @@ namespace Server
m_CIDRLength = cidrLength;
}
public bool IsBlocked(IPAddress address)
{
return Utility.IPMatchCIDR(m_CIDRPrefix, address, m_CIDRLength);
}
public bool IsBlocked(IPAddress address) => Utility.IPMatchCIDR(m_CIDRPrefix, address, m_CIDRLength);
public override string ToString()
{
return $"{m_CIDRPrefix}/{m_CIDRLength}";
}
public override string ToString() => $"{m_CIDRPrefix}/{m_CIDRLength}";
public override bool Equals(object obj)
{
@ -255,10 +235,7 @@ namespace Server
return false;
}
public override int GetHashCode()
{
return m_CIDRPrefix.GetHashCode() ^ m_CIDRLength.GetHashCode();
}
public override int GetHashCode() => m_CIDRPrefix.GetHashCode() ^ m_CIDRLength.GetHashCode();
}
public class WildcardIPFirewallEntry : IFirewallEntry
@ -267,10 +244,7 @@ namespace Server
private bool m_Valid;
public WildcardIPFirewallEntry(string entry)
{
m_Entry = entry;
}
public WildcardIPFirewallEntry(string entry) => m_Entry = entry;
public bool IsBlocked(IPAddress address)
{
@ -282,10 +256,7 @@ namespace Server
return matched;
}
public override string ToString()
{
return m_Entry;
}
public override string ToString() => m_Entry;
public override bool Equals(object obj)
{
@ -295,10 +266,7 @@ namespace Server
return obj is WildcardIPFirewallEntry entry && m_Entry.Equals(entry.m_Entry);
}
public override int GetHashCode()
{
return m_Entry.GetHashCode();
}
public override int GetHashCode() => m_Entry.GetHashCode();
}
#endregion

View file

@ -616,10 +616,7 @@ namespace Server.Commands
InternalAvg_OnCommand(e, true);
}
public static bool IsEntity(Type t)
{
return m_EntityType.IsAssignableFrom(t);
}
public static bool IsEntity(Type t) => m_EntityType.IsAssignableFrom(t);
public static bool IsConstructible(ConstructorInfo ctor, AccessLevel accessLevel)
{
@ -628,20 +625,11 @@ namespace Server.Commands
return attrs.Length != 0 && accessLevel >= ((ConstructibleAttribute)attrs[0]).AccessLevel;
}
public static bool IsEnum(Type type)
{
return type.IsSubclassOf(m_EnumType);
}
public static bool IsEnum(Type type) => type.IsSubclassOf(m_EnumType);
public static bool IsType(Type type)
{
return type == m_TypeType || type.IsSubclassOf(m_TypeType);
}
public static bool IsType(Type type) => type == m_TypeType || type.IsSubclassOf(m_TypeType);
public static bool IsParsable(Type type)
{
return type.IsDefined(m_ParsableType, false);
}
public static bool IsParsable(Type type) => type.IsDefined(m_ParsableType, false);
public static object ParseParsable(Type type, string value)
{

View file

@ -4,30 +4,21 @@ namespace Server
{
public class UsageAttribute : Attribute
{
public UsageAttribute(string usage)
{
Usage = usage;
}
public UsageAttribute(string usage) => Usage = usage;
public string Usage{ get; }
}
public class DescriptionAttribute : Attribute
{
public DescriptionAttribute(string description)
{
Description = description;
}
public DescriptionAttribute(string description) => Description = description;
public string Description{ get; }
}
public class AliasesAttribute : Attribute
{
public AliasesAttribute(params string[] aliases)
{
Aliases = aliases;
}
public AliasesAttribute(params string[] aliases) => Aliases = aliases;
public string[] Aliases{ get; }
}

View file

@ -985,16 +985,14 @@ namespace Server.Commands
public static List<DecorationList> ReadAll(string path)
{
using (StreamReader ip = new StreamReader(path))
{
List<DecorationList> list = new List<DecorationList>();
DecorationList v;
using StreamReader ip = new StreamReader(path);
List<DecorationList> list = new List<DecorationList>();
DecorationList v;
while ((v = Read(ip)) != null)
list.Add(v);
while ((v = Read(ip)) != null)
list.Add(v);
return list;
}
return list;
}
public static DecorationList Read(StreamReader ip)

View file

@ -983,16 +983,14 @@ namespace Server.Commands
public static List<DecorationListMag> ReadAll(string path)
{
using (StreamReader ip = new StreamReader(path))
{
List<DecorationListMag> list = new List<DecorationListMag>();
using StreamReader ip = new StreamReader(path);
List<DecorationListMag> list = new List<DecorationListMag>();
DecorationListMag v;
while ((v = Read(ip)) != null)
list.Add(v);
DecorationListMag v;
while ((v = Read(ip)) != null)
list.Add(v);
return list;
}
return list;
}
public static DecorationListMag Read(StreamReader ip)

File diff suppressed because it is too large Load diff

View file

@ -388,13 +388,13 @@ namespace Server.Commands
List<CategoryLine> list = new List<CategoryLine>();
if (File.Exists(path))
using (StreamReader ip = new StreamReader(path))
{
string line;
{
using StreamReader ip = new StreamReader(path);
string line;
while ((line = ip.ReadLine()) != null)
list.Add(new CategoryLine(line));
}
while ((line = ip.ReadLine()) != null)
list.Add(new CategoryLine(line));
}
return list.ToArray();
}

View file

@ -54,10 +54,7 @@ namespace Server.Commands.Generic
{
}
public virtual bool ValidateArgs(BaseCommandImplementor impl, CommandEventArgs e)
{
return true;
}
public virtual bool ValidateArgs(BaseCommandImplementor impl, CommandEventArgs e) => true;
public void AddResponse(string message)
{
@ -128,10 +125,7 @@ namespace Server.Commands.Generic
m_Count = 1;
}
public override string ToString()
{
return m_Count > 1 ? $"{m_Message} ({m_Count})" : m_Message;
}
public override string ToString() => m_Count > 1 ? $"{m_Message} ({m_Count})" : m_Message;
}
}
}

View file

@ -121,10 +121,7 @@ namespace Server.Commands.Generic
{
}
public virtual bool IsValid(object obj)
{
return true;
}
public virtual bool IsValid(object obj) => true;
public virtual void Filter(List<object> list)
{

View file

@ -12,10 +12,7 @@ namespace Server.Commands.Generic
private List<Property> m_Properties;
public DistinctExtension()
{
m_Properties = new List<Property>();
}
public DistinctExtension() => m_Properties = new List<Property>();
public override ExtensionInfo Info => ExtInfo;

View file

@ -11,10 +11,7 @@ namespace Server.Commands.Generic
private List<OrderInfo> m_Orders;
public SortExtension()
{
m_Orders = new List<OrderInfo>();
}
public SortExtension() => m_Orders = new List<OrderInfo>();
public override ExtensionInfo Info => ExtInfo;

View file

@ -31,9 +31,6 @@ namespace Server.Commands.Generic
Conditional = ObjectConditional.ParseDirect(from, arguments, offset, size);
}
public override bool IsValid(object obj)
{
return Conditional.CheckCondition(obj);
}
public override bool IsValid(object obj) => Conditional.CheckCondition(obj);
}
}

View file

@ -30,10 +30,7 @@ namespace Server.Commands.Generic
{
private static List<BaseCommandImplementor> m_Implementors;
public BaseCommandImplementor()
{
Commands = new Dictionary<string, BaseCommand>(StringComparer.OrdinalIgnoreCase);
}
public BaseCommandImplementor() => Commands = new Dictionary<string, BaseCommand>(StringComparer.OrdinalIgnoreCase);
public bool SupportsConditionals{ get; set; }

View file

@ -408,10 +408,7 @@ namespace Server.Commands
AutoSave.Save(true);
}
private static bool FixMap(ref Map map, ref Point3D loc, Item item)
{
return 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)
{

View file

@ -388,15 +388,9 @@ namespace Server.Commands
//AddAlphaRegion( 10, height - 30, width - 20, 20 );
}
public string Color(string text, int color)
{
return $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
}
public string Color(string text, int color) => $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
public string Center(string text)
{
return $"<CENTER>{text}</CENTER>";
}
public string Center(string text) => $"<CENTER>{text}</CENTER>";
}
}
}

View file

@ -81,10 +81,8 @@ namespace Server.Commands
AppendPath(ref path, from.AccessLevel.ToString());
path = Path.Combine(path, $"{name}.log");
using (StreamWriter sw = new StreamWriter(path, true))
{
sw.WriteLine("{0}: {1}: {2}", DateTime.UtcNow, from.NetState, text);
}
using StreamWriter sw = new StreamWriter(path, true);
sw.WriteLine("{0}: {1}: {2}", DateTime.UtcNow, @from.NetState, text);
}
catch
{

View file

@ -25,31 +25,29 @@ namespace Server.Commands
{
try
{
using (StreamWriter sw = new StreamWriter("profiles.log", true))
{
sw.WriteLine("# Dump on {0:f}", DateTime.UtcNow);
sw.WriteLine("# Core profiling for " + Core.ProfileTime);
using StreamWriter sw = new StreamWriter("profiles.log", true);
sw.WriteLine("# Dump on {0:f}", DateTime.UtcNow);
sw.WriteLine("# Core profiling for " + Core.ProfileTime);
sw.WriteLine("# Packet send");
BaseProfile.WriteAll(sw, PacketSendProfile.Profiles);
sw.WriteLine();
sw.WriteLine("# Packet send");
BaseProfile.WriteAll(sw, PacketSendProfile.Profiles);
sw.WriteLine();
sw.WriteLine("# Packet receive");
BaseProfile.WriteAll(sw, PacketReceiveProfile.Profiles);
sw.WriteLine();
sw.WriteLine("# Packet receive");
BaseProfile.WriteAll(sw, PacketReceiveProfile.Profiles);
sw.WriteLine();
sw.WriteLine("# Timer");
BaseProfile.WriteAll(sw, TimerProfile.Profiles);
sw.WriteLine();
sw.WriteLine("# Timer");
BaseProfile.WriteAll(sw, TimerProfile.Profiles);
sw.WriteLine();
sw.WriteLine("# Gump response");
BaseProfile.WriteAll(sw, GumpProfile.Profiles);
sw.WriteLine();
sw.WriteLine("# Gump response");
BaseProfile.WriteAll(sw, GumpProfile.Profiles);
sw.WriteLine();
sw.WriteLine("# Target response");
BaseProfile.WriteAll(sw, TargetProfile.Profiles);
sw.WriteLine();
}
sw.WriteLine("# Target response");
BaseProfile.WriteAll(sw, TargetProfile.Profiles);
sw.WriteLine();
}
catch
{
@ -75,10 +73,8 @@ namespace Server.Commands
{
try
{
using (StreamWriter sw = new StreamWriter("timerdump.log", true))
{
Timer.DumpInfo(sw);
}
using StreamWriter sw = new StreamWriter("timerdump.log", true);
Timer.DumpInfo(sw);
}
catch
{
@ -190,37 +186,35 @@ namespace Server.Commands
try
{
using (StreamWriter op = new StreamWriter("expandedItems.log", true))
using StreamWriter op = new StreamWriter("expandedItems.log", true);
string[] names =
{
string[] names =
{
"Name",
"Items",
"Bounce",
"Holder",
"Blessed",
"TempFlag",
"SaveFlag",
"Weight",
"Spawner"
};
"Name",
"Items",
"Bounce",
"Holder",
"Blessed",
"TempFlag",
"SaveFlag",
"Weight",
"Spawner"
};
List<KeyValuePair<Type, int[]>> list = typeTable.ToList();
List<KeyValuePair<Type, int[]>> list = typeTable.ToList();
list.Sort(new CountsSorter());
list.Sort(new CountsSorter());
foreach (KeyValuePair<Type, int[]> kvp in list)
{
int[] countTable = kvp.Value;
foreach (KeyValuePair<Type, int[]> kvp in list)
{
int[] countTable = kvp.Value;
op.WriteLine("# {0}", kvp.Key.FullName);
op.WriteLine("# {0}", kvp.Key.FullName);
for (int i = 0; i < countTable.Length; ++i)
if (countTable[i] > 0)
op.WriteLine("{0}\t{1:N0}", names[i], countTable[i]);
for (int i = 0; i < countTable.Length; ++i)
if (countTable[i] > 0)
op.WriteLine("{0}\t{1:N0}", names[i], countTable[i]);
op.WriteLine();
}
op.WriteLine();
}
}
catch
@ -253,20 +247,18 @@ namespace Server.Commands
table[type] = new[] { 1, item.Amount };
}
using (StreamWriter op = new StreamWriter("internal.log"))
using StreamWriter op = new StreamWriter("internal.log");
op.WriteLine("# {0} items found", totalCount);
op.WriteLine("# {0} different types", table.Count);
op.WriteLine();
op.WriteLine();
op.WriteLine("Type\t\tCount\t\tAmount\t\tAvg. Amount");
foreach (KeyValuePair<Type, int[]> de in table)
{
op.WriteLine("# {0} items found", totalCount);
op.WriteLine("# {0} different types", table.Count);
op.WriteLine();
op.WriteLine();
op.WriteLine("Type\t\tCount\t\tAmount\t\tAvg. Amount");
int[] parms = de.Value;
foreach (KeyValuePair<Type, int[]> de in table)
{
int[] parms = de.Value;
op.WriteLine("{0}\t\t{1}\t\t{2}\t\t{3:F2}", de.Key.Name, parms[0], parms[1], (double)parms[1] / parms[0]);
}
op.WriteLine("{0}\t\t{1}\t\t{2}\t\t{3:F2}", de.Key.Name, parms[0], parms[1], (double)parms[1] / parms[0]);
}
}
@ -323,16 +315,14 @@ namespace Server.Commands
list.Sort(new CountSorter());
using (StreamWriter op = new StreamWriter(opFile))
{
op.WriteLine("# Profile of world {0}", type);
op.WriteLine("# Generated on {0}", DateTime.UtcNow);
op.WriteLine();
op.WriteLine();
using StreamWriter op = new StreamWriter(opFile);
op.WriteLine("# Profile of world {0}", type);
op.WriteLine("# Generated on {0}", DateTime.UtcNow);
op.WriteLine();
op.WriteLine();
list.ForEach(kvp =>
op.WriteLine("{0}\t{1:F2}%\t{2}", kvp.Value, 100.0 * kvp.Value / total, kvp.Key));
}
list.ForEach(kvp =>
op.WriteLine("{0}\t{1:F2}%\t{2}", kvp.Value, 100.0 * kvp.Value / total, kvp.Key));
}
catch
{

View file

@ -70,10 +70,7 @@ namespace Server.Commands
}
}
private static bool CIEqual(string l, string r)
{
return Insensitive.Equals(l, r);
}
private static bool CIEqual(string l, string r) => Insensitive.Equals(l, r);
public static CPA GetCPA(PropertyInfo p)
{
@ -346,40 +343,19 @@ namespace Server.Commands
return p == null ? failReason : InternalSetValue(from, logObject, o, p, name, value, true);
}
private static bool IsSerial(Type t)
{
return t == typeofSerial;
}
private static bool IsSerial(Type t) => t == typeofSerial;
private static bool IsType(Type t)
{
return t == typeofType;
}
private static bool IsType(Type t) => t == typeofType;
private static bool IsChar(Type t)
{
return t == typeofChar;
}
private static bool IsChar(Type t) => t == typeofChar;
private static bool IsString(Type t)
{
return t == typeofString;
}
private static bool IsString(Type t) => t == typeofString;
private static bool IsText(Type t)
{
return t == typeofText;
}
private static bool IsText(Type t) => t == typeofText;
private static bool IsEnum(Type t)
{
return t.IsEnum;
}
private static bool IsEnum(Type t) => t.IsEnum;
private static bool IsParsable(Type t)
{
return t == typeofTimeSpan || t.IsDefined(typeofParsable, false);
}
private static bool IsParsable(Type t) => t == typeofTimeSpan || t.IsDefined(typeofParsable, false);
private static object Parse(object o, Type t, string value)
{
@ -390,10 +366,7 @@ namespace Server.Commands
return method?.Invoke(o, m_ParseParams);
}
private static bool IsNumeric(Type t)
{
return Array.IndexOf(m_NumericTypes, t) >= 0;
}
private static bool IsNumeric(Type t) => Array.IndexOf(m_NumericTypes, t) >= 0;
public static string ConstructFromString(Type type, object obj, string value, ref object constructed)
{
@ -551,10 +524,8 @@ namespace Server
protected Property m_Property;
public PropertyException(Property property, string message)
: base(message)
{
: base(message) =>
m_Property = property;
}
public Property Property => m_Property;
}
@ -655,15 +626,9 @@ namespace Server
{
private PropertyInfo[] m_Chain;
public Property(string binding)
{
Binding = binding;
}
public Property(string binding) => Binding = binding;
public Property(PropertyInfo[] chain)
{
m_Chain = chain;
}
public Property(PropertyInfo[] chain) => m_Chain = chain;
public string Binding{ get; }

View file

@ -60,10 +60,7 @@ namespace Server.Commands
{
private double m_Value;
public AllSkillsTarget(double value) : base(-1, false, TargetFlags.None)
{
m_Value = value;
}
public AllSkillsTarget(double value) : base(-1, false, TargetFlags.None) => m_Value = value;
protected override void OnTarget(Mobile from, object targeted)
{

View file

@ -187,101 +187,97 @@ namespace Server
TileMatrix matrix = map.Tiles;
using (FileStream idxStream = OpenWrite(matrix.IndexStream))
using FileStream idxStream = OpenWrite(matrix.IndexStream);
using FileStream mulStream = OpenWrite(matrix.DataStream);
if (idxStream == null || mulStream == null)
{
using (FileStream mulStream = OpenWrite(matrix.DataStream))
badDataFile = true;
continue;
}
BinaryReader idxReader = new BinaryReader(idxStream);
BinaryWriter idxWriter = new BinaryWriter(idxStream);
BinaryWriter mulWriter = new BinaryWriter(mulStream);
foreach (DeltaState state in table.Values)
{
StaticTile[] oldTiles = ReadStaticBlock(idxReader, mulStream, state.m_X, state.m_Y,
matrix.BlockWidth, matrix.BlockHeight, out int oldTileCount);
if (oldTileCount < 0)
continue;
int newTileCount = 0;
StaticTile[] newTiles = new StaticTile[state.m_List.Count];
for (int i = 0; i < state.m_List.Count; ++i)
{
if (idxStream == null || mulStream == null)
{
badDataFile = true;
Item item = state.m_List[i];
int xOffset = item.X - state.m_X * 8;
int yOffset = item.Y - state.m_Y * 8;
if (xOffset < 0 || xOffset >= 8 || yOffset < 0 || yOffset >= 8)
continue;
}
BinaryReader idxReader = new BinaryReader(idxStream);
StaticTile newTile = new StaticTile((ushort)item.ItemID, (byte)xOffset, (byte)yOffset,
(sbyte)item.Z, (short)item.Hue);
BinaryWriter idxWriter = new BinaryWriter(idxStream);
BinaryWriter mulWriter = new BinaryWriter(mulStream);
newTiles[newTileCount++] = newTile;
foreach (DeltaState state in table.Values)
{
StaticTile[] oldTiles = ReadStaticBlock(idxReader, mulStream, state.m_X, state.m_Y,
matrix.BlockWidth, matrix.BlockHeight, out int oldTileCount);
item.Delete();
if (oldTileCount < 0)
continue;
int newTileCount = 0;
StaticTile[] newTiles = new StaticTile[state.m_List.Count];
for (int i = 0; i < state.m_List.Count; ++i)
{
Item item = state.m_List[i];
int xOffset = item.X - state.m_X * 8;
int yOffset = item.Y - state.m_Y * 8;
if (xOffset < 0 || xOffset >= 8 || yOffset < 0 || yOffset >= 8)
continue;
StaticTile newTile = new StaticTile((ushort)item.ItemID, (byte)xOffset, (byte)yOffset,
(sbyte)item.Z, (short)item.Hue);
newTiles[newTileCount++] = newTile;
item.Delete();
++totalFrozen;
}
int mulPos = -1;
int length = -1;
int extra = 0;
if (oldTileCount + newTileCount > 0)
{
mulWriter.Seek(0, SeekOrigin.End);
mulPos = (int)mulWriter.BaseStream.Position;
length = (oldTileCount + newTileCount) * 7;
extra = 1;
for (int i = 0; i < oldTileCount; ++i)
{
StaticTile toWrite = oldTiles[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);
}
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 = (state.m_X * matrix.BlockHeight + state.m_Y) * 12;
idxWriter.Seek(idxPos, SeekOrigin.Begin);
idxWriter.Write(mulPos);
idxWriter.Write(length);
idxWriter.Write(extra);
idxWriter.Flush();
matrix.SetStaticBlock(state.m_X, state.m_Y, null);
}
++totalFrozen;
}
int mulPos = -1;
int length = -1;
int extra = 0;
if (oldTileCount + newTileCount > 0)
{
mulWriter.Seek(0, SeekOrigin.End);
mulPos = (int)mulWriter.BaseStream.Position;
length = (oldTileCount + newTileCount) * 7;
extra = 1;
for (int i = 0; i < oldTileCount; ++i)
{
StaticTile toWrite = oldTiles[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);
}
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 = (state.m_X * matrix.BlockHeight + state.m_Y) * 12;
idxWriter.Seek(idxPos, SeekOrigin.Begin);
idxWriter.Write(mulPos);
idxWriter.Write(length);
idxWriter.Write(extra);
idxWriter.Flush();
matrix.SetStaticBlock(state.m_X, state.m_Y, null);
}
}
@ -351,96 +347,92 @@ namespace Server
TileMatrix matrix = map.Tiles;
using (FileStream idxStream = OpenWrite(matrix.IndexStream))
using FileStream idxStream = OpenWrite(matrix.IndexStream);
using FileStream mulStream = OpenWrite(matrix.DataStream);
if (idxStream == null || mulStream == null)
{
using (FileStream mulStream = OpenWrite(matrix.DataStream))
badDataFile = true;
return;
}
BinaryReader idxReader = new BinaryReader(idxStream);
BinaryWriter idxWriter = new BinaryWriter(idxStream);
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)
{
if (idxStream == null || mulStream == null)
StaticTile oldTile = oldTiles[i];
int px = baseX + oldTile.X;
int py = baseY + oldTile.Y;
if (px < 0 || px >= xTileWidth || py < 0 || py >= yTileHeight)
{
badDataFile = true;
return;
newTiles[newTileCount++] = oldTile;
}
BinaryReader idxReader = new BinaryReader(idxStream);
BinaryWriter idxWriter = new BinaryWriter(idxStream);
BinaryWriter mulWriter = new BinaryWriter(mulStream);
for (int x = xStartBlock; x <= xEndBlock; ++x)
for (int y = yStartBlock; y <= yEndBlock; ++y)
else
{
StaticTile[] oldTiles = ReadStaticBlock(idxReader, mulStream, x, y, matrix.BlockWidth,
matrix.BlockHeight, out int oldTileCount);
++totalUnfrozen;
if (oldTileCount < 0)
continue;
Item item = new Static(oldTile.ID);
int newTileCount = 0;
StaticTile[] newTiles = new StaticTile[oldTileCount];
item.Hue = oldTile.Hue;
int baseX = (x << 3) - xTileStart, baseY = (y << 3) - yTileStart;
for (int i = 0; i < oldTileCount; ++i)
{
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);
}
}
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);
item.MoveToWorld(new Point3D(px + xTileStart, py + yTileStart, oldTile.Z), map);
}
}
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);
}
}

View file

@ -20,10 +20,7 @@ namespace Server.ContextMenus
{
private SpellScroll m_Scroll;
public InternalTarget(SpellScroll scroll) : base(3, false, TargetFlags.None)
{
m_Scroll = scroll;
}
public InternalTarget(SpellScroll scroll) : base(3, false, TargetFlags.None) => m_Scroll = scroll;
protected override void OnTarget(Mobile from, object targeted)
{

View file

@ -4,10 +4,7 @@ namespace Server.ContextMenus
{
private Mobile m_Banker;
public OpenBankEntry(Mobile from, Mobile banker) : base(6105, 12)
{
m_Banker = banker;
}
public OpenBankEntry(Mobile from, Mobile banker) : base(6105, 12) => m_Banker = banker;
public override void OnClick()
{

View file

@ -6,10 +6,7 @@ namespace Server.Engines.BulkOrders
{
private BaseBOD m_Deed;
public BODTarget(BaseBOD deed) : base(18, false, TargetFlags.None)
{
m_Deed = deed;
}
public BODTarget(BaseBOD deed) : base(18, false, TargetFlags.None) => m_Deed = deed;
protected override void OnTarget(Mobile from, object targeted)
{

View file

@ -8,61 +8,61 @@ using Server.Items;
namespace Server.Engines.BulkOrders
{
public class BulkOrderBook : Item, ISecurable
{
private string m_BookName;
public class BulkOrderBook : Item, ISecurable
{
private string m_BookName;
[CommandProperty( AccessLevel.GameMaster )]
public string BookName
{
get => m_BookName;
set{ m_BookName = value; InvalidateProperties(); }
}
[CommandProperty( AccessLevel.GameMaster )]
public string BookName
{
get => m_BookName;
set{ m_BookName = value; InvalidateProperties(); }
}
[CommandProperty( AccessLevel.GameMaster )]
public SecureLevel Level { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public SecureLevel Level { get; set; }
public List<IBOBEntry> Entries { get; private set; }
public List<IBOBEntry> Entries { get; private set; }
public BOBFilter Filter { get; private set; }
public BOBFilter Filter { get; private set; }
public int ItemCount { get; set; }
public int ItemCount { get; set; }
[Constructible]
public BulkOrderBook() : base( 0x2259 )
{
Weight = 1.0;
LootType = LootType.Blessed;
[Constructible]
public BulkOrderBook() : base( 0x2259 )
{
Weight = 1.0;
LootType = LootType.Blessed;
Entries = new List<IBOBEntry>();
Filter = new BOBFilter();
Entries = new List<IBOBEntry>();
Filter = new BOBFilter();
Level = SecureLevel.CoOwners;
}
Level = SecureLevel.CoOwners;
}
public override void OnDoubleClick( Mobile from )
{
if ( !from.InRange( GetWorldLocation(), 2 ) )
from.LocalOverheadMessage( Network.MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that.
else if ( Entries.Count == 0 )
from.SendLocalizedMessage( 1062381 ); // The book is empty.
else if ( from is PlayerMobile mobile )
mobile.SendGump( new BOBGump( mobile, this ) );
}
public override void OnDoubleClick( Mobile from )
{
if ( !from.InRange( GetWorldLocation(), 2 ) )
from.LocalOverheadMessage( Network.MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that.
else if ( Entries.Count == 0 )
from.SendLocalizedMessage( 1062381 ); // The book is empty.
else if ( from is PlayerMobile mobile )
mobile.SendGump( new BOBGump( mobile, this ) );
}
public override void OnDoubleClickSecureTrade( Mobile from )
{
if ( !from.InRange( GetWorldLocation(), 2 ) )
{
from.SendLocalizedMessage( 500446 ); // That is too far away.
}
else if ( Entries.Count == 0 )
{
from.SendLocalizedMessage( 1062381 ); // The book is empty.
}
else
{
from.SendGump( new BOBGump( (PlayerMobile)from, this ) );
public override void OnDoubleClickSecureTrade( Mobile from )
{
if ( !from.InRange( GetWorldLocation(), 2 ) )
{
from.SendLocalizedMessage( 500446 ); // That is too far away.
}
else if ( Entries.Count == 0 )
{
from.SendLocalizedMessage( 1062381 ); // The book is empty.
}
else
{
from.SendGump( new BOBGump( (PlayerMobile)from, this ) );
SecureTrade trade = GetSecureTradeCont()?.Trade;
@ -70,239 +70,236 @@ namespace Server.Engines.BulkOrders
trade.To.Mobile.SendGump( new BOBGump( (PlayerMobile)trade.To.Mobile, this ) );
else if (trade?.To.Mobile == from )
trade.From.Mobile.SendGump( new BOBGump( (PlayerMobile)trade.From.Mobile, this ) );
}
}
}
}
public override bool OnDragDrop( Mobile from, Item dropped )
{
if ( dropped is BaseBOD )
{
if ( !IsChildOf( from.Backpack ) )
{
from.SendLocalizedMessage( 1062385 ); // You must have the book in your backpack to add deeds to it.
return false;
}
if ( !from.Backpack.CheckHold( from, dropped, true, true ) )
return false;
if ( Entries.Count < 500 )
{
if ( dropped is LargeBOD bod )
Entries.Add( new BOBLargeEntry( bod ) );
else
Entries.Add( new BOBSmallEntry( (SmallBOD)dropped ) );
public override bool OnDragDrop( Mobile from, Item dropped )
{
if ( dropped is BaseBOD )
{
if ( !IsChildOf( from.Backpack ) )
{
from.SendLocalizedMessage( 1062385 ); // You must have the book in your backpack to add deeds to it.
return false;
}
if ( !from.Backpack.CheckHold( from, dropped, true, true ) )
return false;
if ( Entries.Count < 500 )
{
if ( dropped is LargeBOD bod )
Entries.Add( new BOBLargeEntry( bod ) );
else
Entries.Add( new BOBSmallEntry( (SmallBOD)dropped ) );
InvalidateProperties();
InvalidateProperties();
if ( Entries.Count / 5 > ItemCount )
{
ItemCount++;
InvalidateItems();
}
if ( Entries.Count / 5 > ItemCount )
{
ItemCount++;
InvalidateItems();
}
from.SendSound(0x42, GetWorldLocation());
from.SendLocalizedMessage( 1062386 ); // Deed added to book.
from.SendSound(0x42, GetWorldLocation());
from.SendLocalizedMessage( 1062386 ); // Deed added to book.
if ( from is PlayerMobile pm )
pm.SendGump( new BOBGump( pm, this ) );
if ( from is PlayerMobile pm )
pm.SendGump( new BOBGump( pm, this ) );
dropped.Delete();
dropped.Delete();
return true;
}
return true;
}
from.SendLocalizedMessage( 1062387 ); // The book is full of deeds.
return false;
}
from.SendLocalizedMessage( 1062387 ); // The book is full of deeds.
return false;
}
from.SendLocalizedMessage( 1062388 ); // That is not a bulk order deed.
return false;
}
from.SendLocalizedMessage( 1062388 ); // That is not a bulk order deed.
return false;
}
public override int GetTotal( TotalType type )
{
int total = base.GetTotal( type );
public override int GetTotal( TotalType type )
{
int total = base.GetTotal( type );
if ( type == TotalType.Items )
total = ItemCount;
if ( type == TotalType.Items )
total = ItemCount;
return total;
}
return total;
}
public void InvalidateItems()
{
if ( RootParent is Mobile m )
{
m.UpdateTotals();
InvalidateContainers( Parent );
}
}
public void InvalidateItems()
{
if ( RootParent is Mobile m )
{
m.UpdateTotals();
InvalidateContainers( Parent );
}
}
public void InvalidateContainers(IEntity parent)
{
if ( parent is Container c )
{
c.InvalidateProperties();
InvalidateContainers( c.Parent );
}
}
public void InvalidateContainers(IEntity parent)
{
if ( parent is Container c )
{
c.InvalidateProperties();
InvalidateContainers( c.Parent );
}
}
public BulkOrderBook( Serial serial ) : base( serial )
{
}
public BulkOrderBook( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( 2 ); // version
writer.Write( 2 ); // version
writer.Write( ItemCount );
writer.Write( ItemCount );
writer.Write( (int) Level );
writer.Write( (int) Level );
writer.Write( m_BookName );
writer.Write( m_BookName );
Filter.Serialize( writer );
Filter.Serialize( writer );
writer.WriteEncodedInt( Entries.Count );
writer.WriteEncodedInt( Entries.Count );
for ( int i = 0; i < Entries.Count; ++i )
{
object obj = Entries[i];
for ( int i = 0; i < Entries.Count; ++i )
{
object obj = Entries[i];
if ( obj is BOBLargeEntry entry )
{
writer.WriteEncodedInt( 0 );
entry.Serialize( writer );
}
else
{
writer.WriteEncodedInt( 1 );
((BOBSmallEntry)obj).Serialize( writer );
}
}
}
if ( obj is BOBLargeEntry entry )
{
writer.WriteEncodedInt( 0 );
entry.Serialize( writer );
}
else
{
writer.WriteEncodedInt( 1 );
((BOBSmallEntry)obj).Serialize( writer );
}
}
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
int version = reader.ReadInt();
switch ( version )
{
case 2:
{
ItemCount = reader.ReadInt();
goto case 1;
}
case 1:
{
Level = (SecureLevel)reader.ReadInt();
goto case 0;
}
case 0:
{
m_BookName = reader.ReadString();
switch ( version )
{
case 2:
{
ItemCount = reader.ReadInt();
goto case 1;
}
case 1:
{
Level = (SecureLevel)reader.ReadInt();
goto case 0;
}
case 0:
{
m_BookName = reader.ReadString();
Filter = new BOBFilter( reader );
Filter = new BOBFilter( reader );
int count = reader.ReadEncodedInt();
int count = reader.ReadEncodedInt();
Entries = new List<IBOBEntry>( count );
Entries = new List<IBOBEntry>( count );
for ( int i = 0; i < count; ++i )
{
int v = reader.ReadEncodedInt();
for ( int i = 0; i < count; ++i )
{
int v = reader.ReadEncodedInt();
switch ( v )
{
case 0: Entries.Add( new BOBLargeEntry( reader ) ); break;
case 1: Entries.Add( new BOBSmallEntry( reader ) ); break;
}
}
switch ( v )
{
case 0: Entries.Add( new BOBLargeEntry( reader ) ); break;
case 1: Entries.Add( new BOBSmallEntry( reader ) ); break;
}
}
break;
}
}
}
break;
}
}
}
public override void GetProperties( ObjectPropertyList list )
{
base.GetProperties( list );
public override void GetProperties( ObjectPropertyList list )
{
base.GetProperties( list );
list.Add( 1062344, Entries.Count.ToString() ); // Deeds in book: ~1_val~
list.Add( 1062344, Entries.Count.ToString() ); // Deeds in book: ~1_val~
if ( !string.IsNullOrEmpty(m_BookName) )
list.Add( 1062481, m_BookName ); // Book Name: ~1_val~
}
if ( !string.IsNullOrEmpty(m_BookName) )
list.Add( 1062481, m_BookName ); // Book Name: ~1_val~
}
public override void OnSingleClick(Mobile from)
{
base.OnSingleClick(from);
public override void OnSingleClick(Mobile from)
{
base.OnSingleClick(from);
LabelTo(from, 1062344, Entries.Count.ToString()); // Deeds in book: ~1_val~
LabelTo(from, 1062344, Entries.Count.ToString()); // Deeds in book: ~1_val~
if (!string.IsNullOrEmpty(m_BookName))
LabelTo(from, 1062481, m_BookName);
}
if (!string.IsNullOrEmpty(m_BookName))
LabelTo(from, 1062481, m_BookName);
}
public override void GetContextMenuEntries( Mobile from, List<ContextMenuEntry> list )
{
base.GetContextMenuEntries( from, list );
public override void GetContextMenuEntries( Mobile from, List<ContextMenuEntry> list )
{
base.GetContextMenuEntries( from, list );
if ( from.CheckAlive() && IsChildOf( from.Backpack ) )
list.Add( new NameBookEntry( from, this ) );
if ( from.CheckAlive() && IsChildOf( from.Backpack ) )
list.Add( new NameBookEntry( from, this ) );
SetSecureLevelEntry.AddTo( from, this, list );
}
SetSecureLevelEntry.AddTo( from, this, list );
}
private class NameBookEntry : ContextMenuEntry
{
private Mobile m_From;
private BulkOrderBook m_Book;
private class NameBookEntry : ContextMenuEntry
{
private Mobile m_From;
private BulkOrderBook m_Book;
public NameBookEntry( Mobile from, BulkOrderBook book ) : base( 6216 )
{
m_From = from;
m_Book = book;
}
public NameBookEntry( Mobile from, BulkOrderBook book ) : base( 6216 )
{
m_From = from;
m_Book = book;
}
public override void OnClick()
{
if ( m_From.CheckAlive() && m_Book.IsChildOf( m_From.Backpack ) )
{
m_From.Prompt = new NameBookPrompt( m_Book );
m_From.SendLocalizedMessage( 1062479 ); // Type in the new name of the book:
}
}
}
public override void OnClick()
{
if ( m_From.CheckAlive() && m_Book.IsChildOf( m_From.Backpack ) )
{
m_From.Prompt = new NameBookPrompt( m_Book );
m_From.SendLocalizedMessage( 1062479 ); // Type in the new name of the book:
}
}
}
private class NameBookPrompt : Prompt
{
private BulkOrderBook m_Book;
private class NameBookPrompt : Prompt
{
private BulkOrderBook m_Book;
public NameBookPrompt( BulkOrderBook book )
{
m_Book = book;
}
public NameBookPrompt( BulkOrderBook book ) => m_Book = book;
public override void OnResponse( Mobile from, string text )
{
if ( text.Length > 40 )
text = text.Substring( 0, 40 );
public override void OnResponse( Mobile from, string text )
{
if ( text.Length > 40 )
text = text.Substring( 0, 40 );
if ( from.CheckAlive() && m_Book.IsChildOf( from.Backpack ) )
{
m_Book.BookName = Utility.FixHtml( text.Trim() );
if ( from.CheckAlive() && m_Book.IsChildOf( from.Backpack ) )
{
m_Book.BookName = Utility.FixHtml( text.Trim() );
from.SendLocalizedMessage( 1062480 ); // The bulk order book's name has been changed.
}
}
from.SendLocalizedMessage( 1062480 ); // The bulk order book's name has been changed.
}
}
public override void OnCancel( Mobile from )
{
}
}
}
public override void OnCancel( Mobile from )
{
}
}
}
}

View file

@ -28,10 +28,8 @@ namespace Server.Engines.BulkOrders
public override int LabelNumber => 1045151; // a bulk order deed
public LargeBOD(int hue, int amountMax, bool requireExeptional, BulkMaterialType material, LargeBulkEntry[] entries) :
base(hue, amountMax, requireExeptional, material)
{
m_Entries = entries;
}
base(hue, amountMax, requireExeptional, material) =>
m_Entries = entries;
public LargeBOD()
{

View file

@ -3,118 +3,118 @@ using System.Collections.Generic;
namespace Server.Engines.BulkOrders
{
public class LargeBulkEntry
{
private int m_Amount;
public class LargeBulkEntry
{
private int m_Amount;
public LargeBOD Owner { get; set; }
public LargeBOD Owner { get; set; }
public int Amount
public int Amount
{
get => m_Amount;
set{ m_Amount = value; Owner?.InvalidateProperties(); }
set{ m_Amount = value; Owner?.InvalidateProperties(); }
}
public SmallBulkEntry Details { get; }
public SmallBulkEntry Details { get; }
public static SmallBulkEntry[] LargeRing => GetEntries( "Blacksmith", "largering" );
public static SmallBulkEntry[] LargeRing => GetEntries( "Blacksmith", "largering" );
public static SmallBulkEntry[] LargePlate => GetEntries( "Blacksmith", "largeplate" );
public static SmallBulkEntry[] LargePlate => GetEntries( "Blacksmith", "largeplate" );
public static SmallBulkEntry[] LargeChain => GetEntries( "Blacksmith", "largechain" );
public static SmallBulkEntry[] LargeChain => GetEntries( "Blacksmith", "largechain" );
public static SmallBulkEntry[] LargeAxes => GetEntries( "Blacksmith", "largeaxes" );
public static SmallBulkEntry[] LargeAxes => GetEntries( "Blacksmith", "largeaxes" );
public static SmallBulkEntry[] LargeFencing => GetEntries( "Blacksmith", "largefencing" );
public static SmallBulkEntry[] LargeFencing => GetEntries( "Blacksmith", "largefencing" );
public static SmallBulkEntry[] LargeMaces => GetEntries( "Blacksmith", "largemaces" );
public static SmallBulkEntry[] LargeMaces => GetEntries( "Blacksmith", "largemaces" );
public static SmallBulkEntry[] LargePolearms => GetEntries( "Blacksmith", "largepolearms" );
public static SmallBulkEntry[] LargePolearms => GetEntries( "Blacksmith", "largepolearms" );
public static SmallBulkEntry[] LargeSwords => GetEntries( "Blacksmith", "largeswords" );
public static SmallBulkEntry[] LargeSwords => GetEntries( "Blacksmith", "largeswords" );
public static SmallBulkEntry[] BoneSet => GetEntries( "Tailoring", "boneset" );
public static SmallBulkEntry[] BoneSet => GetEntries( "Tailoring", "boneset" );
public static SmallBulkEntry[] Farmer => GetEntries( "Tailoring", "farmer" );
public static SmallBulkEntry[] Farmer => GetEntries( "Tailoring", "farmer" );
public static SmallBulkEntry[] FemaleLeatherSet => GetEntries( "Tailoring", "femaleleatherset" );
public static SmallBulkEntry[] FemaleLeatherSet => GetEntries( "Tailoring", "femaleleatherset" );
public static SmallBulkEntry[] FisherGirl => GetEntries( "Tailoring", "fishergirl" );
public static SmallBulkEntry[] FisherGirl => GetEntries( "Tailoring", "fishergirl" );
public static SmallBulkEntry[] Gypsy => GetEntries( "Tailoring", "gypsy" );
public static SmallBulkEntry[] Gypsy => GetEntries( "Tailoring", "gypsy" );
public static SmallBulkEntry[] HatSet => GetEntries( "Tailoring", "hatset" );
public static SmallBulkEntry[] HatSet => GetEntries( "Tailoring", "hatset" );
public static SmallBulkEntry[] Jester => GetEntries( "Tailoring", "jester" );
public static SmallBulkEntry[] Jester => GetEntries( "Tailoring", "jester" );
public static SmallBulkEntry[] Lady => GetEntries( "Tailoring", "lady" );
public static SmallBulkEntry[] Lady => GetEntries( "Tailoring", "lady" );
public static SmallBulkEntry[] MaleLeatherSet => GetEntries( "Tailoring", "maleleatherset" );
public static SmallBulkEntry[] MaleLeatherSet => GetEntries( "Tailoring", "maleleatherset" );
public static SmallBulkEntry[] Pirate => GetEntries( "Tailoring", "pirate" );
public static SmallBulkEntry[] Pirate => GetEntries( "Tailoring", "pirate" );
public static SmallBulkEntry[] ShoeSet => GetEntries( "Tailoring", "shoeset" );
public static SmallBulkEntry[] ShoeSet => GetEntries( "Tailoring", "shoeset" );
public static SmallBulkEntry[] StuddedSet => GetEntries( "Tailoring", "studdedset" );
public static SmallBulkEntry[] StuddedSet => GetEntries( "Tailoring", "studdedset" );
public static SmallBulkEntry[] TownCrier => GetEntries( "Tailoring", "towncrier" );
public static SmallBulkEntry[] TownCrier => GetEntries( "Tailoring", "towncrier" );
public static SmallBulkEntry[] Wizard => GetEntries( "Tailoring", "wizard" );
public static SmallBulkEntry[] Wizard => GetEntries( "Tailoring", "wizard" );
private static Dictionary<string,Dictionary<string,SmallBulkEntry[]>> m_Cache;
private static Dictionary<string,Dictionary<string,SmallBulkEntry[]>> m_Cache;
public static SmallBulkEntry[] GetEntries( string type, string name )
{
if (m_Cache == null)
m_Cache = new Dictionary<string, Dictionary<string, SmallBulkEntry[]>>();
public static SmallBulkEntry[] GetEntries( string type, string name )
{
if (m_Cache == null)
m_Cache = new Dictionary<string, Dictionary<string, SmallBulkEntry[]>>();
if (!m_Cache.TryGetValue( type, out Dictionary<string, SmallBulkEntry[]> table ))
m_Cache[type] = table = new Dictionary<string, SmallBulkEntry[]>();
if (!m_Cache.TryGetValue( type, out Dictionary<string, SmallBulkEntry[]> table ))
m_Cache[type] = table = new Dictionary<string, SmallBulkEntry[]>();
if (!table.TryGetValue( name, out SmallBulkEntry[] entries ))
table[name] = entries = SmallBulkEntry.LoadEntries(type, name);
if (!table.TryGetValue( name, out SmallBulkEntry[] entries ))
table[name] = entries = SmallBulkEntry.LoadEntries(type, name);
return entries;
}
return entries;
}
public static LargeBulkEntry[] ConvertEntries( LargeBOD owner, SmallBulkEntry[] small )
{
LargeBulkEntry[] large = new LargeBulkEntry[small.Length];
public static LargeBulkEntry[] ConvertEntries( LargeBOD owner, SmallBulkEntry[] small )
{
LargeBulkEntry[] large = new LargeBulkEntry[small.Length];
for ( int i = 0; i < small.Length; ++i )
large[i] = new LargeBulkEntry( owner, small[i] );
for ( int i = 0; i < small.Length; ++i )
large[i] = new LargeBulkEntry( owner, small[i] );
return large;
}
return large;
}
public LargeBulkEntry( LargeBOD owner, SmallBulkEntry details )
{
Owner = owner;
Details = details;
}
public LargeBulkEntry( LargeBOD owner, SmallBulkEntry details )
{
Owner = owner;
Details = details;
}
public LargeBulkEntry( LargeBOD owner, GenericReader reader )
{
Owner = owner;
m_Amount = reader.ReadInt();
public LargeBulkEntry( LargeBOD owner, GenericReader reader )
{
Owner = owner;
m_Amount = reader.ReadInt();
Type realType = null;
Type realType = null;
string type = reader.ReadString();
string type = reader.ReadString();
if ( type != null )
realType = AssemblyHandler.FindTypeByFullName( type );
if ( type != null )
realType = AssemblyHandler.FindTypeByFullName( type );
Details = new SmallBulkEntry( realType, reader.ReadInt(), reader.ReadInt() );
}
Details = new SmallBulkEntry( realType, reader.ReadInt(), reader.ReadInt() );
}
public void Serialize( GenericWriter writer )
{
writer.Write( m_Amount );
writer.Write( Details.Type == null ? null : Details.Type.FullName );
writer.Write( Details.Number );
writer.Write( Details.Graphic );
}
}
public void Serialize( GenericWriter writer )
{
writer.Write( m_Amount );
writer.Write( Details.Type == null ? null : Details.Type.FullName );
writer.Write( Details.Number );
writer.Write( Details.Graphic );
}
}
}

View file

@ -91,15 +91,9 @@ namespace Server.Engines.BulkOrders
{
}
public override int ComputeFame()
{
return TailorRewardCalculator.Instance.ComputeFame(this);
}
public override int ComputeFame() => TailorRewardCalculator.Instance.ComputeFame(this);
public override int ComputeGold()
{
return TailorRewardCalculator.Instance.ComputeGold(this);
}
public override int ComputeGold() => TailorRewardCalculator.Instance.ComputeGold(this);
public override RewardGroup GetRewardGroup() =>
TailorRewardCalculator.Instance.LookupRewards(TailorRewardCalculator.Instance.ComputePoints(this));

View file

@ -116,27 +116,17 @@ namespace Server.Engines.BulkOrders
return points * points;
}
public virtual int ComputePoints(SmallBOD bod)
{
return ComputePoints(bod.AmountMax, bod.RequireExceptional, bod.Material, 1, bod.Type);
}
public virtual int ComputePoints(SmallBOD bod) => ComputePoints(bod.AmountMax, bod.RequireExceptional, bod.Material, 1, bod.Type);
public virtual int ComputePoints(LargeBOD bod)
{
return ComputePoints(bod.AmountMax, bod.RequireExceptional, bod.Material, bod.Entries.Length,
public virtual int ComputePoints(LargeBOD bod) =>
ComputePoints(bod.AmountMax, bod.RequireExceptional, bod.Material, bod.Entries.Length,
bod.Entries[0].Details.Type);
}
public virtual int ComputeGold(SmallBOD bod)
{
return ComputeGold(bod.AmountMax, bod.RequireExceptional, bod.Material, 1, bod.Type);
}
public virtual int ComputeGold(SmallBOD bod) => ComputeGold(bod.AmountMax, bod.RequireExceptional, bod.Material, 1, bod.Type);
public virtual int ComputeGold(LargeBOD bod)
{
return ComputeGold(bod.AmountMax, bod.RequireExceptional, bod.Material, bod.Entries.Length,
public virtual int ComputeGold(LargeBOD bod) =>
ComputeGold(bod.AmountMax, bod.RequireExceptional, bod.Material, bod.Entries.Length,
bod.Entries[0].Details.Type);
}
public virtual RewardGroup LookupRewards(int points)
{
@ -385,15 +375,9 @@ namespace Server.Engines.BulkOrders
#region Constructors
private static Item CreateSturdyShovel(int type)
{
return new SturdyShovel();
}
private static Item CreateSturdyShovel(int type) => new SturdyShovel();
private static Item CreateSturdyPickaxe(int type)
{
return new SturdyPickaxe();
}
private static Item CreateSturdyPickaxe(int type) => new SturdyPickaxe();
private static Item CreateMiningGloves(int type)
{
@ -410,20 +394,11 @@ namespace Server.Engines.BulkOrders
}
}
private static Item CreateGargoylesPickaxe(int type)
{
return new GargoylesPickaxe();
}
private static Item CreateGargoylesPickaxe(int type) => new GargoylesPickaxe();
private static Item CreateProspectorsTool(int type)
{
return new ProspectorsTool();
}
private static Item CreateProspectorsTool(int type) => new ProspectorsTool();
private static Item CreatePowderOfTemperament(int type)
{
return new PowderOfTemperament();
}
private static Item CreatePowderOfTemperament(int type) => new PowderOfTemperament();
private static Item CreateRunicHammer(int type)
{
@ -441,13 +416,7 @@ namespace Server.Engines.BulkOrders
throw new InvalidOperationException();
}
private static Item CreateColoredAnvil(int type)
{
// Generate an anvil deed, not an actual anvil.
//return new ColoredAnvilDeed();
return new ColoredAnvil();
}
private static Item CreateColoredAnvil(int type) => new ColoredAnvil();
private static Item CreateAncientHammer(int type)
{
@ -678,10 +647,7 @@ namespace Server.Engines.BulkOrders
0x484, 0x497
};
private static Item CreateSandals(int type)
{
return new Sandals(m_SandalHues[Utility.Random(m_SandalHues.Length)]);
}
private static Item CreateSandals(int type) => new Sandals(m_SandalHues[Utility.Random(m_SandalHues.Length)]);
private static Item CreateStretchedHide(int type)
{
@ -735,10 +701,7 @@ namespace Server.Engines.BulkOrders
throw new InvalidOperationException();
}
private static Item CreateCBD(int type)
{
return new ClothingBlessDeed();
}
private static Item CreateCBD(int type) => new ClothingBlessDeed();
#endregion
}

View file

@ -4,89 +4,84 @@ using System.IO;
namespace Server.Engines.BulkOrders
{
public class SmallBulkEntry
{
public Type Type { get; }
public class SmallBulkEntry
{
public Type Type { get; }
public int Number { get; }
public int Number { get; }
public int Graphic { get; }
public int Graphic { get; }
public SmallBulkEntry( Type type, int number, int graphic )
{
Type = type;
Number = number;
Graphic = graphic;
}
public SmallBulkEntry( Type type, int number, int graphic )
{
Type = type;
Number = number;
Graphic = graphic;
}
public static SmallBulkEntry[] BlacksmithWeapons => GetEntries( "Blacksmith", "weapons" );
public static SmallBulkEntry[] BlacksmithWeapons => GetEntries( "Blacksmith", "weapons" );
public static SmallBulkEntry[] BlacksmithArmor => GetEntries( "Blacksmith", "armor" );
public static SmallBulkEntry[] BlacksmithArmor => GetEntries( "Blacksmith", "armor" );
public static SmallBulkEntry[] TailorCloth => GetEntries( "Tailoring", "cloth" );
public static SmallBulkEntry[] TailorCloth => GetEntries( "Tailoring", "cloth" );
public static SmallBulkEntry[] TailorLeather => GetEntries( "Tailoring", "leather" );
public static SmallBulkEntry[] TailorLeather => GetEntries( "Tailoring", "leather" );
private static Dictionary<string, Dictionary<string, SmallBulkEntry[]>> m_Cache;
private static Dictionary<string, Dictionary<string, SmallBulkEntry[]>> m_Cache;
public static SmallBulkEntry[] GetEntries( string type, string name )
{
if ( m_Cache == null )
m_Cache = new Dictionary<string, Dictionary<string, SmallBulkEntry[]>>();
public static SmallBulkEntry[] GetEntries( string type, string name )
{
if ( m_Cache == null )
m_Cache = new Dictionary<string, Dictionary<string, SmallBulkEntry[]>>();
if (!m_Cache.TryGetValue( type, out Dictionary<string, SmallBulkEntry[]> table ))
m_Cache[type] = table = new Dictionary<string, SmallBulkEntry[]>();
if (!m_Cache.TryGetValue( type, out Dictionary<string, SmallBulkEntry[]> table ))
m_Cache[type] = table = new Dictionary<string, SmallBulkEntry[]>();
if (!table.TryGetValue( name, out SmallBulkEntry[] entries ))
table[name] = entries = LoadEntries(type, name);
if (!table.TryGetValue( name, out SmallBulkEntry[] entries ))
table[name] = entries = LoadEntries(type, name);
return entries;
}
return entries;
}
public static SmallBulkEntry[] LoadEntries( string type, string name )
{
return LoadEntries($"Data/Bulk Orders/{type}/{name}.cfg");
}
public static SmallBulkEntry[] LoadEntries( string type, string name ) => LoadEntries($"Data/Bulk Orders/{type}/{name}.cfg");
public static SmallBulkEntry[] LoadEntries( string path )
{
path = Path.Combine( Core.BaseDirectory, path );
public static SmallBulkEntry[] LoadEntries( string path )
{
path = Path.Combine( Core.BaseDirectory, path );
List<SmallBulkEntry> list = new List<SmallBulkEntry>();
List<SmallBulkEntry> list = new List<SmallBulkEntry>();
if ( File.Exists( path ) )
{
using ( StreamReader ip = new StreamReader( path ) )
{
string line;
if ( File.Exists( path ) )
{
using StreamReader ip = new StreamReader( path );
string line;
while ( (line = ip.ReadLine()) != null )
{
if ( line.Length == 0 || line.StartsWith( "#" ) )
continue;
while ( (line = ip.ReadLine()) != null )
{
if ( line.Length == 0 || line.StartsWith( "#" ) )
continue;
try
{
string[] split = line.Split( '\t' );
try
{
string[] split = line.Split( '\t' );
if ( split.Length >= 2 )
{
Type type = AssemblyHandler.FindTypeByName( split[0] );
int graphic = Utility.ToInt32( split[split.Length - 1] );
if ( type != null && graphic > 0 )
list.Add( new SmallBulkEntry( type, graphic < 0x4000 ? 1020000 + graphic : 1078872 + graphic, graphic ) );
}
}
catch
if ( split.Length >= 2 )
{
// ignored
Type type = AssemblyHandler.FindTypeByName( split[0] );
int graphic = Utility.ToInt32( split[split.Length - 1] );
if ( type != null && graphic > 0 )
list.Add( new SmallBulkEntry( type, graphic < 0x4000 ? 1020000 + graphic : 1078872 + graphic, graphic ) );
}
}
}
}
catch
{
// ignored
}
}
}
return list.ToArray();
}
}
return list.ToArray();
}
}
}

View file

@ -6,10 +6,7 @@ namespace Server.Engines.CannedEvil
{
private ChampionSpawn m_Spawn;
public ChampionAltar(ChampionSpawn spawn)
{
m_Spawn = spawn;
}
public ChampionAltar(ChampionSpawn spawn) => m_Spawn = spawn;
public ChampionAltar(Serial serial) : base(serial)
{

View file

@ -170,10 +170,7 @@ namespace Server.Engines.CannedEvil
{
private ChampionSkullBrazier m_Brazier;
public SacrificeTarget(ChampionSkullBrazier brazier) : base(12, false, TargetFlags.None)
{
m_Brazier = brazier;
}
public SacrificeTarget(ChampionSkullBrazier brazier) : base(12, false, TargetFlags.None) => m_Brazier = brazier;
protected override void OnTarget(Mobile from, object targeted)
{

View file

@ -84,10 +84,7 @@ namespace Server.Engines.CannedEvil
}
}
public bool Validate(ChampionSkullBrazier brazier)
{
return brazier?.Skull?.Deleted == false;
}
public bool Validate(ChampionSkullBrazier brazier) => brazier?.Skull?.Deleted == false;
public override void Serialize(GenericWriter writer)
{

View file

@ -200,10 +200,7 @@ namespace Server.Engines.CannedEvil
*/
}
public bool IsChampionSpawn(Mobile m)
{
return m_Creatures.Contains(m);
}
public bool IsChampionSpawn(Mobile m) => m_Creatures.Contains(m);
public void SetWhiteSkullCount(int val)
{
@ -1008,11 +1005,9 @@ namespace Server.Engines.CannedEvil
1062317); // For your valor in combating the fallen beast, a special artifact has been bestowed on you.
}
public bool IsEligible(Mobile m, Item Artifact)
{
return m.Player && m.Alive && m.Region != null && m.Region == m_Region &&
m.Backpack?.CheckHold(m, Artifact, false) == true;
}
public bool IsEligible(Mobile m, Item Artifact) =>
m.Player && m.Alive && m.Region != null && m.Region == m_Region &&
m.Backpack?.CheckHold(m, Artifact, false) == true;
public override void Serialize(GenericWriter writer)
{
@ -1167,19 +1162,14 @@ namespace Server.Engines.CannedEvil
public class ChampionSpawnRegion : BaseRegion
{
public ChampionSpawnRegion(ChampionSpawn spawn) : base(null, spawn.Map, Find(spawn.Location, spawn.Map),
spawn.SpawnArea)
{
spawn.SpawnArea) =>
ChampionSpawn = spawn;
}
public override bool YoungProtected => false;
public ChampionSpawn ChampionSpawn{ get; }
public override bool AllowHousing(Mobile from, Point3D p)
{
return false;
}
public override bool AllowHousing(Mobile from, Point3D p) => false;
public override void AlterLightLevel(Mobile m, ref int global, ref int personal)
{

View file

@ -85,10 +85,7 @@ namespace Server.Items
{
private Item m_Item;
public InternalTimer(Item item, DateTime end) : base(end - DateTime.UtcNow)
{
m_Item = item;
}
public InternalTimer(Item item, DateTime end) : base(end - DateTime.UtcNow) => m_Item = item;
protected override void OnTick()
{

View file

@ -19,10 +19,7 @@ namespace Server.Engines.Chat
m_Voices = new List<ChatUser>();
}
public Channel(string name, string password) : this(name)
{
m_Password = password;
}
public Channel(string name, string password) : this(name) => m_Password = password;
public string Name
{
@ -73,35 +70,17 @@ namespace Server.Engines.Chat
public static List<Channel> Channels{ get; } = new List<Channel>();
public bool Contains(ChatUser user)
{
return m_Users.Contains(user);
}
public bool Contains(ChatUser user) => m_Users.Contains(user);
public bool IsBanned(ChatUser user)
{
return m_Banned.Contains(user);
}
public bool IsBanned(ChatUser user) => m_Banned.Contains(user);
public bool CanTalk(ChatUser user)
{
return !m_VoiceRestricted || m_Voices.Contains(user) || m_Moderators.Contains(user);
}
public bool CanTalk(ChatUser user) => !m_VoiceRestricted || m_Voices.Contains(user) || m_Moderators.Contains(user);
public bool IsModerator(ChatUser user)
{
return m_Moderators.Contains(user);
}
public bool IsModerator(ChatUser user) => m_Moderators.Contains(user);
public bool IsVoiced(ChatUser user)
{
return m_Voices.Contains(user);
}
public bool IsVoiced(ChatUser user) => m_Voices.Contains(user);
public bool ValidatePassword(string password)
{
return m_Password == null || Insensitive.Equals(m_Password, password);
}
public bool ValidatePassword(string password) => m_Password == null || Insensitive.Equals(m_Password, password);
public bool ValidateModerator(ChatUser user)
{

View file

@ -51,11 +51,9 @@ namespace Server.Engines.Chat
public bool IsModerator => CurrentChannel?.IsModerator(this) == true;
public char GetColorCharacter()
{
return IsModerator ? ModeratorColorCharacter :
CurrentChannel?.IsVoiced(this) == true ? VoicedColorCharacter : NormalColorCharacter;
}
public char GetColorCharacter() =>
IsModerator ? ModeratorColorCharacter :
CurrentChannel?.IsVoiced(this) == true ? VoicedColorCharacter : NormalColorCharacter;
public bool CheckOnline()
{
@ -78,10 +76,7 @@ namespace Server.Engines.Chat
Mobile.Send(new ChatMessagePacket(from, number, param1, param2));
}
public bool IsIgnored(ChatUser check)
{
return Ignored.Contains(check);
}
public bool IsIgnored(ChatUser check) => Ignored.Contains(check);
public void AddIgnored(ChatUser user)
{

View file

@ -92,15 +92,9 @@ namespace Server.Engines.ConPVP
Timer.DelayCall(TimeSpan.FromSeconds(15.0), AutoReject);
}
public string Center(string text)
{
return $"<CENTER>{text}</CENTER>";
}
public string Center(string text) => $"<CENTER>{text}</CENTER>";
public string Color(string text, int color)
{
return $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
}
public string Color(string text, int color) => $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
public void AutoReject()
{

View file

@ -86,10 +86,7 @@ namespace Server.Engines.ConPVP
[PropertyObject]
public class ArenaStartPoints
{
public ArenaStartPoints(Point3D[] points = null)
{
Points = points ?? new Point3D[8];
}
public ArenaStartPoints(Point3D[] points = null) => Points = points ?? new Point3D[8];
public ArenaStartPoints(GenericReader reader)
{
@ -157,10 +154,7 @@ namespace Server.Engines.ConPVP
set => Points[7] = value;
}
public override string ToString()
{
return "...";
}
public override string ToString() => "...";
public void Serialize(GenericWriter writer)
{
@ -471,10 +465,7 @@ namespace Server.Engines.ConPVP
return a.CompareTo(b);
}
public Ladder AcquireLadder()
{
return Ladder?.Ladder ?? ConPVP.Ladder.Instance;
}
public Ladder AcquireLadder() => Ladder?.Ladder ?? ConPVP.Ladder.Instance;
public void Delete()
{
@ -483,10 +474,7 @@ namespace Server.Engines.ConPVP
m_Region = null;
}
public override string ToString()
{
return "...";
}
public override string ToString() => "...";
public Point3D GetBaseStartPoint(int index)
{
@ -754,10 +742,7 @@ namespace Server.Engines.ConPVP
public int m_VotesAgainst;
public int m_VotesFor;
public ArenaEntry(Arena arena)
{
m_Arena = arena;
}
public ArenaEntry(Arena arena) => m_Arena = arena;
public int Value => m_VotesFor;
}

View file

@ -117,11 +117,7 @@ namespace Server.Engines.ConPVP
Timer.DelayCall(ts, () => DelayBounce_Callback(mob, corpse));
}
public static bool AllowSpecialMove(Mobile from, string name, SpecialMove move)
{
// No DuelContext, or InstaAllowSpecialMove
return (from as PlayerMobile)?.DuelContext?.InstAllowSpecialMove(from, name, move) != false;
}
public static bool AllowSpecialMove(Mobile from, string name, SpecialMove move) => (from as PlayerMobile)?.DuelContext?.InstAllowSpecialMove(from, name, move) != false;
public bool InstAllowSpecialMove(Mobile from, string name, SpecialMove move)
{
@ -958,10 +954,7 @@ namespace Server.Engines.ConPVP
m_SDWarnTimer = null;
}
public static bool CheckSuddenDeath(Mobile mob)
{
return mob is PlayerMobile pm && pm.DuelPlayer?.Eliminated == false && pm.DuelContext?.IsSuddenDeath == true;
}
public static bool CheckSuddenDeath(Mobile mob) => mob is PlayerMobile pm && pm.DuelPlayer?.Eliminated == false && pm.DuelContext?.IsSuddenDeath == true;
public void ActivateSuddenDeath()
{
@ -2204,10 +2197,7 @@ namespace Server.Engines.ConPVP
private class InternalWall : Item
{
public InternalWall() : base(0x80)
{
Movable = false;
}
public InternalWall() : base(0x80) => Movable = false;
public InternalWall(Serial serial) : base(serial)
{

View file

@ -918,10 +918,8 @@ namespace Server.Engines.ConPVP
[Constructible]
public BRBoard()
: base(7774)
{
: base(7774) =>
Movable = false;
}
public BRBoard(Serial serial)
: base(serial)
@ -1088,15 +1086,9 @@ namespace Server.Engines.ConPVP
AddButton(314, height - 42, 247, 248, 1);
}
public string Center(string text)
{
return $"<CENTER>{text}</CENTER>";
}
public string Center(string text) => $"<CENTER>{text}</CENTER>";
public string Color(string text, int color)
{
return $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
}
public string Color(string text, int color) => $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
private void AddBorderedText(int x, int y, int width, int height, string text, int color, int borderColor)
{
@ -1362,15 +1354,9 @@ namespace Server.Engines.ConPVP
public override string Title => "Bombing Run";
public override string DefaultName => "Bombing Run Controller";
public override string GetTeamName(int teamID)
{
return TeamInfo[teamID % TeamInfo.Length].Name;
}
public override string GetTeamName(int teamID) => TeamInfo[teamID % TeamInfo.Length].Name;
public override EventGame Construct(DuelContext context)
{
return new BRGame(this, context);
}
public override EventGame Construct(DuelContext context) => new BRGame(this, context);
public override void Serialize(GenericWriter writer)
{
@ -1421,10 +1407,7 @@ namespace Server.Engines.ConPVP
private TimerCallback m_UnhideCallback;
public BRGame(BRController controller, DuelContext context) : base(context)
{
Controller = controller;
}
public BRGame(BRController controller, DuelContext context) : base(context) => Controller = controller;
public BRController Controller{ get; }
@ -1439,10 +1422,7 @@ namespace Server.Engines.ConPVP
}
}
public override bool CantDoAnything(Mobile mob)
{
return mob.Backpack?.FindItemByType<BRBomb>() != null && GetTeamInfo(mob) != null;
}
public override bool CantDoAnything(Mobile mob) => mob.Backpack?.FindItemByType<BRBomb>() != null && GetTeamInfo(mob) != null;
public void ReturnBomb()
{
@ -1508,10 +1488,7 @@ namespace Server.Engines.ConPVP
return pm.DuelContext.Participants.IndexOf(pm.DuelPlayer.Participant);
}
public int GetColor(Mobile mob)
{
return GetTeamInfo(mob)?.Color ?? -1;
}
public int GetColor(Mobile mob) => GetTeamInfo(mob)?.Color ?? -1;
private void ApplyHues(Participant p, int hueOverride)
{

View file

@ -15,10 +15,8 @@ namespace Server.Engines.ConPVP
[Constructible]
public CTFBoard()
: base(7774)
{
: base(7774) =>
Movable = false;
}
public CTFBoard(Serial serial)
: base(serial)
@ -181,15 +179,9 @@ namespace Server.Engines.ConPVP
AddButton(314, height - 42, 247, 248, 1);
}
public string Center(string text)
{
return $"<CENTER>{text}</CENTER>";
}
public string Center(string text) => $"<CENTER>{text}</CENTER>";
public string Color(string text, int color)
{
return $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
}
public string Color(string text, int color) => $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
private void AddBorderedText(int x, int y, int width, int height, string text, int color, int borderColor)
{
@ -223,10 +215,8 @@ namespace Server.Engines.ConPVP
[Constructible]
public CTFFlag()
: base(5643)
{
: base(5643) =>
Movable = false;
}
public CTFFlag(Serial serial)
: base(serial)
@ -684,10 +674,7 @@ namespace Server.Engines.ConPVP
op.Write(Origin);
}
public override string ToString()
{
return "...";
}
public override string ToString() => "...";
}
public sealed class CTFController : EventController
@ -742,15 +729,9 @@ namespace Server.Engines.ConPVP
public override string Title => "CTF";
public override string GetTeamName(int teamID)
{
return TeamInfo[teamID % TeamInfo.Length].Name;
}
public override string GetTeamName(int teamID) => TeamInfo[teamID % TeamInfo.Length].Name;
public override EventGame Construct(DuelContext context)
{
return new CTFGame(this, context);
}
public override EventGame Construct(DuelContext context) => new CTFGame(this, context);
public override void Serialize(GenericWriter writer)
{
@ -809,10 +790,7 @@ namespace Server.Engines.ConPVP
{
private Timer m_FinishTimer;
public CTFGame(CTFController controller, DuelContext context) : base(context)
{
Controller = controller;
}
public CTFGame(CTFController controller, DuelContext context) : base(context) => Controller = controller;
public CTFController Controller{ get; }

View file

@ -13,10 +13,8 @@ namespace Server.Engines.ConPVP
[Constructible]
public DDBoard()
: base(7774)
{
: base(7774) =>
Movable = false;
}
public DDBoard(Serial serial)
: base(serial)
@ -177,15 +175,9 @@ namespace Server.Engines.ConPVP
AddButton(314, height - 42, 247, 248, 1);
}
public string Center(string text)
{
return $"<CENTER>{text}</CENTER>";
}
public string Center(string text) => $"<CENTER>{text}</CENTER>";
public string Color(string text, int color)
{
return $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
}
public string Color(string text, int color) => $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
private void AddBorderedText(int x, int y, int width, int height, string text, int color, int borderColor)
{
@ -354,10 +346,7 @@ namespace Server.Engines.ConPVP
op.Write(Origin);
}
public override string ToString()
{
return "...";
}
public override string ToString() => "...";
}
public sealed class DDController : EventController
@ -402,15 +391,9 @@ namespace Server.Engines.ConPVP
public override string DefaultName => "DD Controller";
public override string GetTeamName(int teamID)
{
return TeamInfo[teamID % TeamInfo.Length].Name;
}
public override string GetTeamName(int teamID) => TeamInfo[teamID % TeamInfo.Length].Name;
public override EventGame Construct(DuelContext context)
{
return new DDGame(this, context);
}
public override EventGame Construct(DuelContext context) => new DDGame(this, context);
public override void Serialize(GenericWriter writer)
{
@ -464,10 +447,7 @@ namespace Server.Engines.ConPVP
private Timer m_FinishTimer;
private Timer m_UncaptureTimer;
public DDGame(DDController controller, DuelContext context) : base(context)
{
Controller = controller;
}
public DDGame(DDController controller, DuelContext context) : base(context) => Controller = controller;
public DDController Controller{ get; }
@ -525,10 +505,7 @@ namespace Server.Engines.ConPVP
return pm.DuelContext.Participants.IndexOf(pm.DuelPlayer.Participant);
}
public int GetColor(Mobile mob)
{
return GetTeamInfo(mob)?.Color ?? -1;
}
public int GetColor(Mobile mob) => GetTeamInfo(mob)?.Color ?? -1;
private void ApplyHues(Participant p, int hueOverride)
{
@ -1077,10 +1054,7 @@ namespace Server.Engines.ConPVP
public class DDStep : AddonComponent
{
public DDStep(int itemID) : base(itemID)
{
Visible = true;
}
public DDStep(int itemID) : base(itemID) => Visible = true;
public DDStep(Serial serial) : base(serial)
{
@ -1100,10 +1074,7 @@ namespace Server.Engines.ConPVP
writer.Write(0); //version
}
public override bool OnMoveOver(Mobile m)
{
return Addon.OnMoveOver(m);
}
public override bool OnMoveOver(Mobile m) => Addon.OnMoveOver(m);
}
}
}

View file

@ -47,24 +47,15 @@ namespace Server.Engines.ConPVP
{
protected DuelContext m_Context;
public EventGame(DuelContext context)
{
m_Context = context;
}
public EventGame(DuelContext context) => m_Context = context;
public DuelContext Context => m_Context;
public virtual bool FreeConsume => true;
public virtual bool OnDeath(Mobile mob, Container corpse)
{
return true;
}
public virtual bool OnDeath(Mobile mob, Container corpse) => true;
public virtual bool CantDoAnything(Mobile mob)
{
return false;
}
public virtual bool CantDoAnything(Mobile mob) => false;
public virtual void OnStart()
{

View file

@ -463,15 +463,9 @@ namespace Server.Engines.ConPVP
AddButton(314, height - 42, 247, 248, 1);
}
public string Center(string text)
{
return $"<CENTER>{text}</CENTER>";
}
public string Center(string text) => $"<CENTER>{text}</CENTER>";
public string Color(string text, int color)
{
return $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
}
public string Color(string text, int color) => $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
private void AddBorderedText(int x, int y, int width, int height, string text, int color, int borderColor)
{
@ -650,10 +644,7 @@ namespace Server.Engines.ConPVP
op.WriteEncodedInt(Color);
}
public override string ToString()
{
return TeamName != null ? $"({Name}) ..." : "...";
}
public override string ToString() => TeamName != null ? $"({Name}) ..." : "...";
}
public sealed class KHController : EventController
@ -745,15 +736,9 @@ namespace Server.Engines.ConPVP
public override string Title => "King of the Hill";
public override string GetTeamName(int teamID)
{
return TeamInfo[teamID % TeamInfo.Length].Name;
}
public override string GetTeamName(int teamID) => TeamInfo[teamID % TeamInfo.Length].Name;
public override EventGame Construct(DuelContext context)
{
return new KHGame(this, context);
}
public override EventGame Construct(DuelContext context) => new KHGame(this, context);
public void RemoveBoard(KHBoard b)
{
@ -824,10 +809,7 @@ namespace Server.Engines.ConPVP
{
private Timer m_FinishTimer;
public KHGame(KHController controller, DuelContext context) : base(context)
{
Controller = controller;
}
public KHGame(KHController controller, DuelContext context) : base(context) => Controller = controller;
public KHController Controller{ get; }
@ -895,10 +877,7 @@ namespace Server.Engines.ConPVP
return pm.DuelContext.Participants.IndexOf(pm.DuelPlayer.Participant);
}
public int GetColor(Mobile mob)
{
return GetTeamInfo(mob)?.Color ?? -1;
}
public int GetColor(Mobile mob) => GetTeamInfo(mob)?.Color ?? -1;
private void ApplyHues(Participant p, int hueOverride)
{

View file

@ -248,15 +248,9 @@ namespace Server.Engines.ConPVP
Timer.DelayCall(TimeSpan.FromSeconds(15.0), AutoReject);
}
public string Center(string text)
{
return $"<CENTER>{text}</CENTER>";
}
public string Center(string text) => $"<CENTER>{text}</CENTER>";
public string Color(string text, int color)
{
return $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
}
public string Color(string text, int color) => $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
private void AddBorderedText(int x, int y, int width, int height, string text, int color, int borderColor)
{

View file

@ -67,10 +67,7 @@ namespace Server.Engines.ConPVP
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that
}
public override bool OnMoveOver(Mobile m)
{
return !m.Player || UseGate(m);
}
public override bool OnMoveOver(Mobile m) => !m.Player || UseGate(m);
}
public class ArenaGump : Gump
@ -242,15 +239,9 @@ namespace Server.Engines.ConPVP
}
}
public string Center(string text)
{
return $"<CENTER>{text}</CENTER>";
}
public string Center(string text) => $"<CENTER>{text}</CENTER>";
public string Color(string text, int color)
{
return $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
}
public string Color(string text, int color) => $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
private void AddBorderedText(int x, int y, int width, string text, int color, int borderColor)
{

View file

@ -59,14 +59,8 @@ namespace Server.Engines.ConPVP
AddButton(314 - 50, 157 - offset, 247, 248, 1);
}
public string Center(string text)
{
return $"<CENTER>{text}</CENTER>";
}
public string Center(string text) => $"<CENTER>{text}</CENTER>";
public string Color(string text, int color)
{
return $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
}
public string Color(string text, int color) => $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
}
}

View file

@ -281,15 +281,9 @@ public class ConfirmSignupGump : Gump
AddButton(314, y, 247, 248, 1);
}
public string Center(string text)
{
return $"<CENTER>{text}</CENTER>";
}
public string Center(string text) => $"<CENTER>{text}</CENTER>";
public string Color(string text, int color)
{
return $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
}
public string Color(string text, int color) => $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
private void AddBorderedText(int x, int y, int width, int height, string text, int color, int borderColor)
{

View file

@ -56,10 +56,7 @@ namespace Server.Engines.ConPVP
public DuelContext Context{ get; }
public string Center(string text)
{
return $"<CENTER>{text}</CENTER>";
}
public string Center(string text) => $"<CENTER>{text}</CENTER>";
public void AddGoldenButton(int x, int y, int bid)
{

View file

@ -8,10 +8,7 @@ namespace Server.Engines.ConPVP
public class LadderItem : Item
{
[Constructible]
public LadderItem() : base(0x117F)
{
Movable = false;
}
public LadderItem() : base(0x117F) => Movable = false;
public LadderItem(Serial serial) : base(serial)
{
@ -207,15 +204,9 @@ namespace Server.Engines.ConPVP
from.SendGump(new LadderGump(m_Ladder, m_Page + 1));
}
public string Center(string text)
{
return $"<CENTER>{text}</CENTER>";
}
public string Center(string text) => $"<CENTER>{text}</CENTER>";
public string Color(string text, int color)
{
return $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
}
public string Color(string text, int color) => $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
private void AddBorderedText(int x, int y, int width, string text, int color, int borderColor)
{

View file

@ -64,10 +64,7 @@ namespace Server.Engines.ConPVP
public Participant Participant{ get; }
public string Center(string text)
{
return $"<CENTER>{text}</CENTER>";
}
public string Center(string text) => $"<CENTER>{text}</CENTER>";
public void AddGoldenButton(int x, int y, int bid)
{

View file

@ -70,10 +70,7 @@ namespace Server.Engines.ConPVP
}
}
public string Center(string text)
{
return $"<CENTER>{text}</CENTER>";
}
public string Center(string text) => $"<CENTER>{text}</CENTER>";
public override void OnResponse(NetState sender, RelayInfo info)
{

View file

@ -97,10 +97,7 @@ namespace Server.Engines.ConPVP
}
}
public string Center(string text)
{
return $"<CENTER>{text}</CENTER>";
}
public string Center(string text) => $"<CENTER>{text}</CENTER>";
public override void OnResponse(NetState sender, RelayInfo info)
{

View file

@ -189,10 +189,7 @@ namespace Server.Engines.ConPVP
}
}
public string Center(string text)
{
return $"<CENTER>{text}</CENTER>";
}
public string Center(string text) => $"<CENTER>{text}</CENTER>";
public void AddGoldenButton(int x, int y, int bid)
{

View file

@ -73,10 +73,7 @@ namespace Server.Engines.ConPVP
}
}
public string Center(string text)
{
return $"<CENTER>{text}</CENTER>";
}
public string Center(string text) => $"<CENTER>{text}</CENTER>";
public void AddGoldenButton(int x, int y, int bid)
{

View file

@ -614,15 +614,9 @@ namespace Server.Engines.ConPVP
}
}
public string Center(string text)
{
return $"<CENTER>{text}</CENTER>";
}
public string Center(string text) => $"<CENTER>{text}</CENTER>";
public string Color(string text, int color)
{
return $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
}
public string Color(string text, int color) => $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
private void AddBorderedText(int x, int y, int width, int height, string text, int color, int borderColor)
{
@ -667,10 +661,7 @@ namespace Server.Engines.ConPVP
AddLeftArrow(x, y, bid, null);
}
public int ToButtonID(int type, int index)
{
return 1 + index * 7 + type;
}
public int ToButtonID(int type, int index) => 1 + index * 7 + type;
public bool FromButtonID(int bid, out int type, out int index)
{

View file

@ -118,10 +118,7 @@ namespace Server.Engines.ConPVP
private Dictionary<Mobile, LadderEntry> m_Table;
public Ladder()
{
m_Table = new Dictionary<Mobile, LadderEntry>();
}
public Ladder() => m_Table = new Dictionary<Mobile, LadderEntry>();
public Ladder(GenericReader reader)
{
@ -350,10 +347,7 @@ namespace Server.Engines.ConPVP
[CommandProperty(AccessLevel.GameMaster)]
public int Rank => Index;
public int CompareTo(LadderEntry l)
{
return (l?.m_Experience ?? 0) - m_Experience;
}
public int CompareTo(LadderEntry l) => (l?.m_Experience ?? 0) - m_Experience;
public void Serialize(GenericWriter writer)
{

View file

@ -102,10 +102,7 @@ namespace Server.Engines.ConPVP
return null;
}
public bool Contains(Mobile mob)
{
return Find(mob) != null;
}
public bool Contains(Mobile mob) => Find(mob) != null;
public void Broadcast(int hue, string message, string nonLocalOverhead, string localOverhead)
{

View file

@ -240,15 +240,9 @@ namespace Server.Engines.ConPVP
}
}
public string Center(string text)
{
return $"<CENTER>{text}</CENTER>";
}
public string Center(string text) => $"<CENTER>{text}</CENTER>";
public string Color(string text, int color)
{
return $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
}
public string Color(string text, int color) => $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
private void AddBorderedText(int x, int y, int width, string text, int color, int borderColor)
{

View file

@ -736,10 +736,7 @@ namespace Server.Engines.ConPVP
return null;
}
public int GetOptionIndex(string option)
{
return Array.IndexOf(Options, option);
}
public int GetOptionIndex(string option) => Array.IndexOf(Options, option);
public void ComputeOffsets()
{

View file

@ -19,10 +19,7 @@ namespace Server.Engines.ConPVP
Register();
}
public override bool AllowHousing(Mobile from, Point3D p)
{
return from.AccessLevel >= AccessLevel.GameMaster && base.AllowHousing(from, p);
}
public override bool AllowHousing(Mobile from, Point3D p) => from.AccessLevel >= AccessLevel.GameMaster && base.AllowHousing(from, p);
public override bool OnMoveInto(Mobile m, Direction d, Point3D newLocation, Point3D oldLocation)
{
@ -58,9 +55,6 @@ namespace Server.Engines.ConPVP
m.SendMessage("You have left a dueling safezone. Combat is now unrestricted.");
}
public override bool CanUseStuckMenu(Mobile m)
{
return false;
}
public override bool CanUseStuckMenu(Mobile m) => false;
}
}

View file

@ -426,10 +426,7 @@ namespace Server.Engines.ConPVP
Alert(arena, sb.ToString());
}
private int ComputeCashAward()
{
return Participants.Count * m_PlayersPerParticipant * 2500;
}
private int ComputeCashAward() => Participants.Count * m_PlayersPerParticipant * 2500;
private void GiveAwards()
{

View file

@ -5,10 +5,7 @@ namespace Server.Engines.ConPVP
public class TournamentBracketItem : Item
{
[Constructible]
public TournamentBracketItem() : base(3774)
{
Movable = false;
}
public TournamentBracketItem() : base(3774) => Movable = false;
public TournamentBracketItem(Serial serial) : base(serial)
{

View file

@ -106,10 +106,7 @@ namespace Server.Engines.ConPVP
{
private Tournament m_Tournament;
public EditEntry(Tournament tourney) : base(5101)
{
m_Tournament = tourney;
}
public EditEntry(Tournament tourney) : base(5101) => m_Tournament = tourney;
public override void OnClick()
{
@ -121,10 +118,7 @@ namespace Server.Engines.ConPVP
{
private Tournament m_Tournament;
public StartEntry(Tournament tourney) : base(5113)
{
m_Tournament = tourney;
}
public StartEntry(Tournament tourney) : base(5113) => m_Tournament = tourney;
public override void OnClick()
{

View file

@ -6,10 +6,7 @@ namespace Server.Engines.ConPVP
{
public class TourneyPyramid
{
public TourneyPyramid()
{
Levels = new List<PyramidLevel>();
}
public TourneyPyramid() => Levels = new List<PyramidLevel>();
public List<PyramidLevel> Levels{ get; set; }

View file

@ -8,10 +8,7 @@ namespace Server.Engines.ConPVP
public class TournamentSignupItem : Item
{
[Constructible]
public TournamentSignupItem() : base(4029)
{
Movable = false;
}
public TournamentSignupItem() : base(4029) => Movable = false;
public TournamentSignupItem(Serial serial) : base(serial)
{

View file

@ -81,10 +81,7 @@ namespace Server.Engines.ConPVP
}
}
public int CompareTo(TourneyParticipant p)
{
return p.TotalLadderXP - TotalLadderXP;
}
public int CompareTo(TourneyParticipant p) => p.TotalLadderXP - TotalLadderXP;
public void AddLog(string text)
{

View file

@ -4,10 +4,7 @@ namespace Server.Engines.Craft
{
public class CraftGroupCol : CollectionBase
{
public int Add(CraftGroup craftGroup)
{
return List.Add(craftGroup);
}
public int Add(CraftGroup craftGroup) => List.Add(craftGroup);
public void Remove(int index)
{
@ -20,10 +17,7 @@ namespace Server.Engines.Craft
}
}
public CraftGroup GetAt(int index)
{
return (CraftGroup)List[index];
}
public CraftGroup GetAt(int index) => (CraftGroup)List[index];
public int SearchFor(TextDefinition groupName)
{

View file

@ -339,10 +339,7 @@ namespace Server.Engines.Craft
return craftGroupCol.Count;
}
public static int GetButtonID(int type, int index)
{
return 1 + type + index * 7;
}
public static int GetButtonID(int type, int index) => 1 + type + index * 7;
public void CraftItem(CraftItem item)
{

View file

@ -424,10 +424,8 @@ namespace Server.Engines.Craft
}
public bool ConsumeRes(Mobile from, Type typeRes, CraftSystem craftSystem, ref int resHue, ref int maxAmount,
ConsumeType consumeType, ref object message)
{
return ConsumeRes(from, typeRes, craftSystem, ref resHue, ref maxAmount, consumeType, ref message, false);
}
ConsumeType consumeType, ref object message) =>
ConsumeRes(from, typeRes, craftSystem, ref resHue, ref maxAmount, consumeType, ref message, false);
public bool ConsumeRes(Mobile from, Type typeRes, CraftSystem craftSystem, ref int resHue, ref int maxAmount,
ConsumeType consumeType, ref object message, bool isFailure)
@ -639,10 +637,7 @@ namespace Server.Engines.Craft
}
}
private int CheckHueGrouping(Item a, Item b)
{
return b.Hue.CompareTo(a.Hue);
}
private int CheckHueGrouping(Item a, Item b) => b.Hue.CompareTo(a.Hue);
public double GetExceptionalChance(CraftSystem system, double chance, Mobile from)
{
@ -686,10 +681,8 @@ namespace Server.Engines.Craft
}
public bool CheckSkills(Mobile from, Type typeRes, CraftSystem craftSystem, ref int quality,
ref bool allRequiredSkills)
{
return CheckSkills(from, typeRes, craftSystem, ref quality, ref allRequiredSkills, true);
}
ref bool allRequiredSkills) =>
CheckSkills(from, typeRes, craftSystem, ref quality, ref allRequiredSkills, true);
public bool CheckSkills(Mobile from, Type typeRes, CraftSystem craftSystem, ref int quality,
ref bool allRequiredSkills, bool gainSkills)

View file

@ -5,10 +5,7 @@ namespace Server.Engines.Craft
{
public class CraftItemCol : CollectionBase
{
public int Add(CraftItem craftItem)
{
return List.Add(craftItem);
}
public int Add(CraftItem craftItem) => List.Add(craftItem);
public void Remove(int index)
{
@ -21,10 +18,7 @@ namespace Server.Engines.Craft
}
}
public CraftItem GetAt(int index)
{
return (CraftItem)List[index];
}
public CraftItem GetAt(int index) => (CraftItem)List[index];
public CraftItem SearchForSubclass(Type type)
{

View file

@ -5,10 +5,7 @@ namespace Server.Engines.Craft
[AttributeUsage(AttributeTargets.Class)]
public class CraftItemIDAttribute : Attribute
{
public CraftItemIDAttribute(int itemID)
{
ItemID = itemID;
}
public CraftItemIDAttribute(int itemID) => ItemID = itemID;
public int ItemID{ get; }
}

View file

@ -20,9 +20,6 @@ namespace Server.Engines.Craft
}
}
public CraftRes GetAt(int index)
{
return (CraftRes)List[index];
}
public CraftRes GetAt(int index) => (CraftRes)List[index];
}
}

View file

@ -20,9 +20,6 @@ namespace Server.Engines.Craft
}
}
public CraftSkill GetAt(int index)
{
return (CraftSkill)List[index];
}
public CraftSkill GetAt(int index) => (CraftSkill)List[index];
}
}

View file

@ -5,10 +5,7 @@ namespace Server.Engines.Craft
{
public class CraftSubResCol : CollectionBase
{
public CraftSubResCol()
{
Init = false;
}
public CraftSubResCol() => Init = false;
public bool Init{ get; set; }
@ -34,10 +31,7 @@ namespace Server.Engines.Craft
}
}
public CraftSubRes GetAt(int index)
{
return (CraftSubRes)List[index];
}
public CraftSubRes GetAt(int index) => (CraftSubRes)List[index];
public CraftSubRes SearchFor(Type type)
{

View file

@ -65,10 +65,7 @@ namespace Server.Engines.Craft
public abstract double GetChanceAtMin(CraftItem item);
public virtual bool RetainsColorFrom(CraftItem item, Type type)
{
return false;
}
public virtual bool RetainsColorFrom(CraftItem item, Type type) => false;
public CraftContext GetContext(Mobile m)
{
@ -92,10 +89,7 @@ namespace Server.Engines.Craft
GetContext(m)?.OnMade(item);
}
public virtual bool ConsumeOnFailure(Mobile from, Type resourceType, CraftItem craftItem)
{
return true;
}
public virtual bool ConsumeOnFailure(Mobile from, Type resourceType, CraftItem craftItem) => true;
public void CreateItem(Mobile from, Type type, Type typeRes, BaseTool tool, CraftItem realCraftItem)
{
@ -122,22 +116,16 @@ namespace Server.Engines.Craft
public int AddCraft(Type typeItem, TextDefinition group, TextDefinition name, double minSkill, double maxSkill,
Type typeRes, TextDefinition nameRes, int amount)
{
return AddCraft(typeItem, group, name, MainSkill, minSkill, maxSkill, typeRes, nameRes, amount, "");
}
Type typeRes, TextDefinition nameRes, int amount) =>
AddCraft(typeItem, group, name, MainSkill, minSkill, maxSkill, typeRes, nameRes, amount, "");
public int AddCraft(Type typeItem, TextDefinition group, TextDefinition name, double minSkill, double maxSkill,
Type typeRes, TextDefinition nameRes, int amount, TextDefinition message)
{
return AddCraft(typeItem, group, name, MainSkill, minSkill, maxSkill, typeRes, nameRes, amount, message);
}
Type typeRes, TextDefinition nameRes, int amount, TextDefinition message) =>
AddCraft(typeItem, group, name, MainSkill, minSkill, maxSkill, typeRes, nameRes, amount, message);
public int AddCraft(Type typeItem, TextDefinition group, TextDefinition name, SkillName skillToMake, double minSkill,
double maxSkill, Type typeRes, TextDefinition nameRes, int amount)
{
return AddCraft(typeItem, group, name, skillToMake, minSkill, maxSkill, typeRes, nameRes, amount, "");
}
double maxSkill, Type typeRes, TextDefinition nameRes, int amount) =>
AddCraft(typeItem, group, name, skillToMake, minSkill, maxSkill, typeRes, nameRes, amount, "");
public int AddCraft(Type typeItem, TextDefinition group, TextDefinition name, SkillName skillToMake, double minSkill,
double maxSkill, Type typeRes, TextDefinition nameRes, int amount, TextDefinition message)

View file

@ -37,21 +37,11 @@ namespace Server.Engines.Craft
m_Deed = deed;
}
private int GetWeakenChance(Mobile mob, SkillName skill, int curHits, int maxHits)
{
// 40% - (1% per hp lost) - (1% per 10 craft skill)
return 40 + (maxHits - curHits) - (int)((m_Deed?.SkillLevel ?? mob.Skills[skill].Value) / 10);
}
private int GetWeakenChance(Mobile mob, SkillName skill, int curHits, int maxHits) => 40 + (maxHits - curHits) - (int)((m_Deed?.SkillLevel ?? mob.Skills[skill].Value) / 10);
private bool CheckWeaken(Mobile mob, SkillName skill, int curHits, int maxHits)
{
return GetWeakenChance(mob, skill, curHits, maxHits) > Utility.Random(100);
}
private bool CheckWeaken(Mobile mob, SkillName skill, int curHits, int maxHits) => GetWeakenChance(mob, skill, curHits, maxHits) > Utility.Random(100);
private int GetRepairDifficulty(int curHits, int maxHits)
{
return (maxHits - curHits) * 1250 / Math.Max(maxHits, 1) - 250;
}
private int GetRepairDifficulty(int curHits, int maxHits) => (maxHits - curHits) * 1250 / Math.Max(maxHits, 1) - 250;
private bool CheckRepairDifficulty(Mobile mob, SkillName skill, int curHits, int maxHits)
{

View file

@ -19,10 +19,7 @@ namespace Server.Engines.Craft
public static CraftSystem CraftSystem => m_CraftSystem ?? (m_CraftSystem = new DefAlchemy());
public override double GetChanceAtMin(CraftItem item)
{
return 0.0; // 0%
}
public override double GetChanceAtMin(CraftItem item) => 0.0;
public override int CanCraft(Mobile from, BaseTool tool, Type itemType)
{
@ -40,10 +37,7 @@ namespace Server.Engines.Craft
from.PlaySound(0x242);
}
public static bool IsPotion(Type type)
{
return typeofPotion.IsAssignableFrom(type);
}
public static bool IsPotion(Type type) => typeofPotion.IsAssignableFrom(type);
public override int PlayEndingEffect(Mobile from, bool failed, bool lostMaterial, bool toolBroken, int quality,
bool makersMark, CraftItem item)

View file

@ -34,10 +34,7 @@ namespace Server.Engines.Craft
public override CraftECA ECA => CraftECA.ChanceMinusSixtyToFourtyFive;
public override double GetChanceAtMin(CraftItem item)
{
return 0.0; // 0%
}
public override double GetChanceAtMin(CraftItem item) => 0.0;
public static void CheckAnvilAndForge(Mobile from, int range, out bool anvil, out bool forge)
{
@ -773,10 +770,7 @@ namespace Server.Engines.Craft
{
private Mobile m_From;
public InternalTimer(Mobile from) : base(TimeSpan.FromSeconds(0.7))
{
m_From = from;
}
public InternalTimer(Mobile from) : base(TimeSpan.FromSeconds(0.7)) => m_From = from;
protected override void OnTick()
{

View file

@ -19,10 +19,7 @@ namespace Server.Engines.Craft
public override CraftECA ECA => CraftECA.FiftyPercentChanceMinusTenPercent;
public override double GetChanceAtMin(CraftItem item)
{
return 0.5; // 50%
}
public override double GetChanceAtMin(CraftItem item) => 0.5;
public override int CanCraft(Mobile from, BaseTool tool, Type itemType)
{

View file

@ -17,10 +17,7 @@ namespace Server.Engines.Craft
public static CraftSystem CraftSystem => m_CraftSystem ?? (m_CraftSystem = new DefCarpentry());
public override double GetChanceAtMin(CraftItem item)
{
return 0.5; // 50%
}
public override double GetChanceAtMin(CraftItem item) => 0.5;
public override int CanCraft(Mobile from, BaseTool tool, Type itemType)
{

View file

@ -17,10 +17,7 @@ namespace Server.Engines.Craft
public static CraftSystem CraftSystem => m_CraftSystem ?? (m_CraftSystem = new DefCartography());
public override double GetChanceAtMin(CraftItem item)
{
return 0.0; // 0%
}
public override double GetChanceAtMin(CraftItem item) => 0.0;
public override int CanCraft(Mobile from, BaseTool tool, Type itemType)
{

View file

@ -19,10 +19,7 @@ namespace Server.Engines.Craft
public override CraftECA ECA => CraftECA.ChanceMinusSixtyToFourtyFive;
public override double GetChanceAtMin(CraftItem item)
{
return 0.0; // 0%
}
public override double GetChanceAtMin(CraftItem item) => 0.0;
public override int CanCraft(Mobile from, BaseTool tool, Type itemType)
{

View file

@ -18,10 +18,7 @@ namespace Server.Engines.Craft
public static CraftSystem CraftSystem => m_CraftSystem ?? (m_CraftSystem = new DefGlassblowing());
public override double GetChanceAtMin(CraftItem item)
{
return item.ItemType == typeof(HollowPrism) ? 0.5 : 0.0;
}
public override double GetChanceAtMin(CraftItem item) => item.ItemType == typeof(HollowPrism) ? 0.5 : 0.0;
public override int CanCraft(Mobile from, BaseTool tool, Type itemType)
{
@ -102,10 +99,7 @@ namespace Server.Engines.Craft
{
private Mobile m_From;
public InternalTimer(Mobile from) : base(TimeSpan.FromSeconds(0.7))
{
m_From = from;
}
public InternalTimer(Mobile from) : base(TimeSpan.FromSeconds(0.7)) => m_From = from;
protected override void OnTick()
{

View file

@ -38,10 +38,7 @@ namespace Server.Engines.Craft
public static CraftSystem CraftSystem => m_CraftSystem ?? (m_CraftSystem = new DefInscription());
public override double GetChanceAtMin(CraftItem item)
{
return 0.0; // 0%
}
public override double GetChanceAtMin(CraftItem item) => 0.0;
public override int CanCraft(Mobile from, BaseTool tool, Type typeItem)
{

View file

@ -18,15 +18,9 @@ namespace Server.Engines.Craft
public static CraftSystem CraftSystem => m_CraftSystem ?? (m_CraftSystem = new DefMasonry());
public override double GetChanceAtMin(CraftItem item)
{
return 0.0; // 0%
}
public override double GetChanceAtMin(CraftItem item) => 0.0;
public override bool RetainsColorFrom(CraftItem item, Type type)
{
return true;
}
public override bool RetainsColorFrom(CraftItem item, Type type) => true;
public override int CanCraft(Mobile from, BaseTool tool, Type itemType)
{
@ -119,10 +113,7 @@ namespace Server.Engines.Craft
{
private Mobile m_From;
public InternalTimer(Mobile from) : base(TimeSpan.FromSeconds(0.7))
{
m_From = from;
}
public InternalTimer(Mobile from) : base(TimeSpan.FromSeconds(0.7)) => m_From = from;
protected override void OnTick()
{

View file

@ -27,10 +27,7 @@ namespace Server.Engines.Craft
public override CraftECA ECA => CraftECA.ChanceMinusSixtyToFourtyFive;
public override double GetChanceAtMin(CraftItem item)
{
return 0.5; // 50%
}
public override double GetChanceAtMin(CraftItem item) => 0.5;
public override int CanCraft(Mobile from, BaseTool tool, Type itemType)
{

View file

@ -473,10 +473,7 @@ namespace Server.Engines.Craft
{
private TrapCraft m_TrapCraft;
public ContainerTarget(TrapCraft trapCraft) : base(-1, false, TargetFlags.None)
{
m_TrapCraft = trapCraft;
}
public ContainerTarget(TrapCraft trapCraft) : base(-1, false, TargetFlags.None) => m_TrapCraft = trapCraft;
protected override void OnTarget(Mobile from, object targeted)
{

View file

@ -368,12 +368,10 @@ namespace Server.Engines.Doom
}
}
private static bool IsValidDamagable(Mobile m)
{
return m?.Deleted == false &&
(m.Player && m.Alive ||
m is BaseCreature bc && (bc.Controlled || bc.Summoned) && !bc.IsDeadBondedPet);
}
private static bool IsValidDamagable(Mobile m) =>
m?.Deleted == false &&
(m.Player && m.Alive ||
m is BaseCreature bc && (bc.Controlled || bc.Summoned) && !bc.IsDeadBondedPet);
public static void MoveMobileOut(Mobile m)
{
@ -388,15 +386,9 @@ namespace Server.Engines.Doom
}
}
public static bool AniSafe(Mobile m)
{
return m?.BodyMod == 0 && m.Alive && !TransformationSpellHelper.UnderTransformation(m);
}
public static bool AniSafe(Mobile m) => m?.BodyMod == 0 && m.Alive && !TransformationSpellHelper.UnderTransformation(m);
public static IEntity ZAdjustedIEFromMobile(Mobile m, int ZDelta)
{
return new Entity(Serial.Zero, new Point3D(m.X, m.Y, m.Z + ZDelta), m.Map);
}
public static IEntity ZAdjustedIEFromMobile(Mobile m, int ZDelta) => new Entity(Serial.Zero, new Point3D(m.X, m.Y, m.Z + ZDelta), m.Map);
public static void DoDamage(Mobile m, int min, int max, bool poison)
{
@ -407,20 +399,11 @@ namespace Server.Engines.Doom
}
}
public static Point3D RandomPointIn(Point3D point, int range)
{
return RandomPointIn(point.X - range, point.Y - range, range * 2, range * 2, point.Z);
}
public static Point3D RandomPointIn(Point3D point, int range) => RandomPointIn(point.X - range, point.Y - range, range * 2, range * 2, point.Z);
public static Point3D RandomPointIn(Rectangle2D rect, int z)
{
return RandomPointIn(rect.X, rect.Y, rect.Height, rect.Width, z);
}
public static Point3D RandomPointIn(Rectangle2D rect, int z) => RandomPointIn(rect.X, rect.Y, rect.Height, rect.Width, z);
public static Point3D RandomPointIn(int x, int y, int x2, int y2, int z)
{
return new Point3D(Utility.Random(x, x2), Utility.Random(y, y2), z);
}
public static Point3D RandomPointIn(int x, int y, int x2, int y2, int z) => new Point3D(Utility.Random(x, x2), Utility.Random(y, y2), z);
public static void PlaySounds(Point3D location, int[] sounds)
{
@ -503,10 +486,7 @@ namespace Server.Engines.Doom
m_Controller = Controller;
}
private int Rock()
{
return 0x1363 + Utility.Random(0, 11);
}
private int Rock() => 0x1363 + Utility.Random(0, 11);
protected override void OnTick()
{
@ -571,10 +551,8 @@ namespace Server.Engines.Doom
private Mobile m;
public LampRoomKickTimer(Mobile player)
: base(TimeSpan.FromSeconds(.25))
{
: base(TimeSpan.FromSeconds(.25)) =>
m = player;
}
protected override void OnTick()
{

View file

@ -69,10 +69,7 @@ namespace Server.Engines.Doom
kick.Start();
}
public override bool OnSkillUse(Mobile m, int Skill) /* just in case */
{
return m_Controller.Successful != null && (m.AccessLevel != AccessLevel.Player || m == m_Controller.Successful);
}
public override bool OnSkillUse(Mobile m, int Skill) /* just in case */ => m_Controller.Successful != null && (m.AccessLevel != AccessLevel.Player || m == m_Controller.Successful);
}
public class LeverPuzzleRegion : BaseRegion

View file

@ -24,10 +24,7 @@ namespace Server.Ethics
protected PlayerCollection m_Players;
public Ethic()
{
m_Players = new PlayerCollection();
}
public Ethic() => m_Players = new PlayerCollection();
public EthicDefinition Definition => m_Definition;
@ -84,10 +81,7 @@ namespace Server.Ethics
return false;
}
public static bool IsImbued(Item item)
{
return IsImbued(item, false);
}
public static bool IsImbued(Item item) => IsImbued(item, false);
public static bool IsImbued(Item item, bool recurse)
{
@ -166,15 +160,9 @@ namespace Server.Ethics
}
}
public static Ethic Find(Mobile mob)
{
return Find(mob, false, false);
}
public static Ethic Find(Mobile mob) => Find(mob, false, false);
public static Ethic Find(Mobile mob, bool inherit)
{
return Find(mob, inherit, false);
}
public static Ethic Find(Mobile mob, bool inherit) => Find(mob, inherit, false);
public static Ethic Find(Mobile mob, bool inherit, bool allegiance)
{

View file

@ -15,10 +15,8 @@ namespace Server.Ethics
}
public EthicsPersistance(Serial serial)
: base(serial)
{
: base(serial) =>
Instance = this;
}
public static EthicsPersistance Instance{ get; private set; }

View file

@ -79,10 +79,7 @@ namespace Server.Ethics
}
}
public static Player Find(Mobile mob)
{
return Find(mob, false);
}
public static Player Find(Mobile mob) => Find(mob, false);
public static Player Find(Mobile mob, bool inherit)
{

View file

@ -7,15 +7,13 @@ namespace Server.Ethics.Evil
{
public sealed class Blight : Power
{
public Blight()
{
public Blight() =>
m_Definition = new PowerDefinition(
15,
"Blight",
"Velgo Ontawl",
""
);
}
public override void BeginInvoke(Player from)
{

View file

@ -6,15 +6,13 @@ namespace Server.Ethics.Evil
{
public sealed class SummonFamiliar : Power
{
public SummonFamiliar()
{
public SummonFamiliar() =>
m_Definition = new PowerDefinition(
5,
"Summon Familiar",
"Trubechs Vingir",
""
);
}
public override void BeginInvoke(Player from)
{

View file

@ -6,15 +6,13 @@ namespace Server.Ethics.Evil
{
public sealed class UnholyItem : Power
{
public UnholyItem()
{
public UnholyItem() =>
m_Definition = new PowerDefinition(
5,
"Unholy Item",
"Vidda K'balc",
""
);
}
public override void BeginInvoke(Player from)
{

View file

@ -6,15 +6,13 @@ namespace Server.Ethics.Evil
{
public sealed class UnholySense : Power
{
public UnholySense()
{
public UnholySense() =>
m_Definition = new PowerDefinition(
0,
"Unholy Sense",
"Drewrok Velgo",
""
);
}
public override void BeginInvoke(Player from)
{

Some files were not shown because too many files have changed in this diff Show more