Clean up: Bugs, LINQ, constructors, default values, and null checks (#18)

This commit is contained in:
Kamron Batman 2019-03-11 14:29:59 -07:00 committed by GitHub
parent e748af4430
commit 513e54f70e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
1094 changed files with 15913 additions and 21892 deletions

View file

@ -499,7 +499,7 @@ namespace Server.Items
CraftContext context = craftSystem.GetContext(from);
if (context != null && context.DoNotColor)
if (context?.DoNotColor == true)
Hue = 0;
if (Quality == ArmorQuality.Exceptional)
@ -563,7 +563,7 @@ namespace Server.Items
CraftItem item = system.CraftItems.SearchFor(GetType());
if (item != null && item.Resources.Count == 1 && item.Resources.GetAt(0).Amount >= 2)
if (item?.Resources.Count == 1 && item.Resources.GetAt(0).Amount >= 2)
try
{
Item res = (Item)Activator.CreateInstance(CraftResources.GetInfo(m_Resource).ResourceTypes[0]);
@ -573,6 +573,7 @@ namespace Server.Items
}
catch
{
// ignored
}
from.SendLocalizedMessage(502440); // Scissors can not be used on that to produce anything.
@ -1461,12 +1462,7 @@ namespace Server.Items
private string GetNameString()
{
string name = Name;
if (name == null)
name = $"#{LabelNumber}";
return name;
return Name ?? $"#{LabelNumber}";
}
public override void AddNameProperty(ObjectPropertyList list)
@ -1793,4 +1789,4 @@ namespace Server.Items
#endregion
}
}
}