Clean up: Bugs, LINQ, constructors, default values, and null checks (#18)
This commit is contained in:
parent
e748af4430
commit
513e54f70e
1094 changed files with 15913 additions and 21892 deletions
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue