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
|
|
@ -42,7 +42,7 @@ namespace Server.Items
|
|||
{
|
||||
base.OnAfterDelete();
|
||||
|
||||
if (m_Timer != null && m_Timer.Running)
|
||||
if (m_Timer?.Running == true)
|
||||
m_Timer.Stop();
|
||||
}
|
||||
|
||||
|
|
@ -117,7 +117,7 @@ namespace Server.Items
|
|||
|
||||
protected override void OnTick()
|
||||
{
|
||||
if (m_Component != null && !m_Component.Deleted)
|
||||
if (m_Component?.Deleted == false)
|
||||
m_Component.UpdateImage();
|
||||
}
|
||||
}
|
||||
|
|
@ -181,4 +181,4 @@ namespace Server.Items
|
|||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -128,32 +128,29 @@ namespace Server.Items
|
|||
{
|
||||
Stop();
|
||||
}
|
||||
else
|
||||
else if (m_Location != m_Mobile.Location)
|
||||
{
|
||||
if (m_Location != m_Mobile.Location)
|
||||
{
|
||||
int amount = Utility.RandomMinMax(0, 7);
|
||||
int amount = Utility.RandomMinMax(0, 7);
|
||||
|
||||
for (int i = 0; i < amount; i++)
|
||||
for (int i = 0; i < amount; i++)
|
||||
{
|
||||
int x = m_Mobile.X + Utility.RandomMinMax(-1, 1);
|
||||
int y = m_Mobile.Y + Utility.RandomMinMax(-1, 1);
|
||||
int z = m_Mobile.Z;
|
||||
|
||||
if (!m_Mobile.Map.CanFit(x, y, z, 1, false, false))
|
||||
{
|
||||
int x = m_Mobile.X + Utility.RandomMinMax(-1, 1);
|
||||
int y = m_Mobile.Y + Utility.RandomMinMax(-1, 1);
|
||||
int z = m_Mobile.Z;
|
||||
z = m_Mobile.Map.GetAverageZ(x, y);
|
||||
|
||||
if (!m_Mobile.Map.CanFit(x, y, z, 1, false, false))
|
||||
{
|
||||
z = m_Mobile.Map.GetAverageZ(x, y);
|
||||
|
||||
if (!m_Mobile.Map.CanFit(x, y, z, 1, false, false))
|
||||
continue;
|
||||
}
|
||||
|
||||
Blood blood = new Blood(Utility.RandomMinMax(0x122C, 0x122F));
|
||||
blood.MoveToWorld(new Point3D(x, y, z), m_Mobile.Map);
|
||||
continue;
|
||||
}
|
||||
|
||||
m_Location = m_Mobile.Location;
|
||||
Blood blood = new Blood(Utility.RandomMinMax(0x122C, 0x122F));
|
||||
blood.MoveToWorld(new Point3D(x, y, z), m_Mobile.Map);
|
||||
}
|
||||
|
||||
m_Location = m_Mobile.Location;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -189,4 +186,4 @@ namespace Server.Items
|
|||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ namespace Server.Items
|
|||
{
|
||||
base.OnAfterDelete();
|
||||
|
||||
if (m_Timer != null && m_Timer.Running)
|
||||
if (m_Timer?.Running == true)
|
||||
m_Timer.Stop();
|
||||
}
|
||||
|
||||
|
|
@ -118,4 +118,4 @@ namespace Server.Items
|
|||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue