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

@ -151,17 +151,12 @@ namespace Server.Items
public bool HasAccces(Mobile m)
{
if (m.AccessLevel >= AccessLevel.GameMaster)
return true;
BaseHouse house = BaseHouse.FindHouseAt(this);
return house != null && house.HasAccess(m);
return m.AccessLevel >= AccessLevel.GameMaster || BaseHouse.FindHouseAt(this)?.HasAccess(m) == true;
}
public void PlayMusic(Mobile m, MusicName music)
{
if (m_Timer != null && m_Timer.Running)
if (m_Timer?.Running == true)
EndMusic(m);
else
m_ItemID = ItemID;
@ -172,7 +167,7 @@ namespace Server.Items
public void EndMusic(Mobile m)
{
if (m_Timer != null && m_Timer.Running)
if (m_Timer?.Running == true)
m_Timer.Stop();
m.Send(StopMusic.Instance);

View file

@ -109,7 +109,7 @@ namespace Server.Items
protected override void OnTarget(Mobile from, object targeted)
{
if (m_Gear == null || m_Gear.Deleted)
if (m_Gear?.Deleted != false)
return;
if (targeted is DawnsMusicBox box)
@ -135,4 +135,4 @@ namespace Server.Items
}
}
}
}
}

View file

@ -5,13 +5,7 @@ namespace Server.Items
public class EnhancedBandage : Bandage
{
[Constructible]
public EnhancedBandage()
: this(1)
{
}
[Constructible]
public EnhancedBandage(int amount)
public EnhancedBandage(int amount = 1)
: base(amount)
{
Hue = 0x8A5;
@ -61,13 +55,7 @@ namespace Server.Items
private Timer m_Timer;
[Constructible]
public FountainOfLife()
: this(10)
{
}
[Constructible]
public FountainOfLife(int charges)
public FountainOfLife(int charges = 10)
: base(0x2AC0)
{
m_Charges = charges;
@ -222,13 +210,7 @@ namespace Server.Items
private int m_Charges;
[Constructible]
public FountainOfLifeDeed()
: this(10)
{
}
[Constructible]
public FountainOfLifeDeed(int charges)
public FountainOfLifeDeed(int charges = 10)
{
LootType = LootType.Blessed;
m_Charges = charges;
@ -271,4 +253,4 @@ namespace Server.Items
m_Charges = reader.ReadInt();
}
}
}
}