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

@ -37,7 +37,7 @@ namespace Server.Items
{
get
{
if (m_Pet != null && m_Pet.Deleted)
if (m_Pet?.Deleted == true)
{
m_Pet = null;
InternalUpdatePetName();
@ -475,4 +475,4 @@ namespace Server.Items
}
}
}
}
}

View file

@ -49,7 +49,7 @@ namespace Server.Items
{
get
{
if (m_Bound != null && m_Bound.Deleted)
if (m_Bound?.Deleted == true)
m_Bound = null;
return m_Bound;
@ -380,20 +380,18 @@ namespace Server.Items
m_Bracelet.m_Timer = null;
m_From.Frozen = false;
if (m_Bracelet.Deleted || m_From.Deleted)
if (m_Bracelet.Deleted || m_From.Deleted ||
!m_Bracelet.CheckUse(m_From, false) ||
!(m_Bracelet.Bound.RootParent is Mobile boundRoot))
return;
if (m_Bracelet.CheckUse(m_From, false))
if (m_Bracelet.Bound.RootParent is Mobile boundRoot)
{
m_Bracelet.Charges--;
m_Bracelet.Charges--;
BaseCreature.TeleportPets(m_From, boundRoot.Location, boundRoot.Map, true);
BaseCreature.TeleportPets(m_From, boundRoot.Location, boundRoot.Map, true);
m_From.PlaySound(0x1FC);
m_From.MoveToWorld(boundRoot.Location, boundRoot.Map);
m_From.PlaySound(0x1FC);
}
m_From.PlaySound(0x1FC);
m_From.MoveToWorld(boundRoot.Location, boundRoot.Map);
m_From.PlaySound(0x1FC);
}
}
@ -472,4 +470,4 @@ namespace Server.Items
}
}
}
}
}

View file

@ -15,12 +15,7 @@ namespace Server.Items
public class PowderOfTranslocation : Item
{
[Constructible]
public PowderOfTranslocation() : this(1)
{
}
[Constructible]
public PowderOfTranslocation(int amount) : base(0x26B8)
public PowderOfTranslocation(int amount = 1) : base(0x26B8)
{
Stackable = true;
Weight = 0.1;
@ -112,4 +107,4 @@ namespace Server.Items
}
}
}
}
}

View file

@ -3,12 +3,7 @@ namespace Server.Items
public class ZoogiFungus : Item, ICommodity
{
[Constructible]
public ZoogiFungus() : this(1)
{
}
[Constructible]
public ZoogiFungus(int amount) : base(0x26B7)
public ZoogiFungus(int amount = 1) : base(0x26B7)
{
Stackable = true;
Weight = 0.1;
@ -36,4 +31,4 @@ namespace Server.Items
int version = reader.ReadEncodedInt();
}
}
}
}