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
|
|
@ -22,7 +22,7 @@ namespace Server.Items
|
|||
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
if (m_Timer != null && m_Timer.Running)
|
||||
if (m_Timer?.Running == true)
|
||||
m_Timer.Stop();
|
||||
}
|
||||
|
||||
|
|
@ -30,7 +30,7 @@ namespace Server.Items
|
|||
{
|
||||
if (IsAccessibleTo(from) && !Patched)
|
||||
{
|
||||
if (m_Timer != null && m_Timer.Running)
|
||||
if (m_Timer?.Running == true)
|
||||
m_Timer.Stop();
|
||||
|
||||
if (Starting)
|
||||
|
|
@ -107,4 +107,4 @@ namespace Server.Items
|
|||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ namespace Server.Items
|
|||
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
if (m_Timer != null && m_Timer.Running)
|
||||
if (m_Timer?.Running == true)
|
||||
m_Timer.Stop();
|
||||
}
|
||||
|
||||
|
|
@ -51,7 +51,7 @@ namespace Server.Items
|
|||
|
||||
protected override void OnTick()
|
||||
{
|
||||
if (m_Heart == null || m_Heart.Deleted || m_Heart.Owner == null || !m_Heart.Owner.Alive)
|
||||
if (m_Heart?.Deleted != false || m_Heart.Owner?.Alive != true)
|
||||
{
|
||||
Stop();
|
||||
return;
|
||||
|
|
@ -76,4 +76,4 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -76,11 +76,7 @@ namespace Server.Items
|
|||
|
||||
public class PlagueBeastComponent : PlagueBeastInnard
|
||||
{
|
||||
public PlagueBeastComponent(int itemID, int hue) : this(itemID, hue, false)
|
||||
{
|
||||
}
|
||||
|
||||
public PlagueBeastComponent(int itemID, int hue, bool movable) : base(itemID, hue)
|
||||
public PlagueBeastComponent(int itemID, int hue, bool movable = false) : base(itemID, hue)
|
||||
{
|
||||
Movable = movable;
|
||||
}
|
||||
|
|
@ -99,10 +95,7 @@ namespace Server.Items
|
|||
|
||||
public override bool DropToItem(Mobile from, Item target, Point3D p)
|
||||
{
|
||||
if (target is PlagueBeastBackpack)
|
||||
return base.DropToItem(from, target, p);
|
||||
|
||||
return false;
|
||||
return target is PlagueBeastBackpack && base.DropToItem(from, target, p);
|
||||
}
|
||||
|
||||
public override bool AllowSecureTrade(Mobile from, Mobile to, Mobile newOwner, bool accepted)
|
||||
|
|
@ -122,8 +115,7 @@ namespace Server.Items
|
|||
|
||||
public override bool OnDragDrop(Mobile from, Item dropped)
|
||||
{
|
||||
if (Organ != null && Organ.OnDropped(from, dropped, this))
|
||||
if (dropped is PlagueBeastComponent component)
|
||||
if (Organ?.OnDropped(from, dropped, this) == true && dropped is PlagueBeastComponent component)
|
||||
Organ.Components.Add(component);
|
||||
|
||||
return true;
|
||||
|
|
@ -133,10 +125,9 @@ namespace Server.Items
|
|||
{
|
||||
if (IsAccessibleTo(from))
|
||||
{
|
||||
if (Organ != null && Organ.OnLifted(from, this))
|
||||
if (Organ?.OnLifted(from, this) == true)
|
||||
{
|
||||
from.SendLocalizedMessage(IsGland ? 1071895 : 1071914, null,
|
||||
0x3B2); // * You rip the organ out of the plague beast's flesh *
|
||||
from.SendLocalizedMessage(IsGland ? 1071895 : 1071914, null); // * You rip the organ out of the plague beast's flesh *
|
||||
|
||||
if (Organ.Components.Contains(this))
|
||||
Organ.Components.Remove(this);
|
||||
|
|
@ -169,4 +160,4 @@ namespace Server.Items
|
|||
Organ = reader.ReadItem<PlagueBeastOrgan>();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,17 +8,12 @@ namespace Server.Items
|
|||
{
|
||||
private Timer m_Timer;
|
||||
|
||||
public PlagueBeastOrgan() : this(1, 0)
|
||||
{
|
||||
Visible = false;
|
||||
}
|
||||
|
||||
public PlagueBeastOrgan(int itemID, int hue) : base(itemID, hue)
|
||||
public PlagueBeastOrgan(int itemID = 1, int hue = 0) : base(itemID, hue)
|
||||
{
|
||||
Components = new List<PlagueBeastComponent>();
|
||||
Opened = false;
|
||||
|
||||
Movable = false;
|
||||
Visible = itemID <= 1;
|
||||
|
||||
Timer.DelayCall(TimeSpan.Zero, Initialize);
|
||||
}
|
||||
|
|
@ -70,7 +65,7 @@ namespace Server.Items
|
|||
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
if (m_Timer != null && m_Timer.Running)
|
||||
if (m_Timer?.Running == true)
|
||||
m_Timer.Stop();
|
||||
}
|
||||
|
||||
|
|
@ -116,7 +111,7 @@ namespace Server.Items
|
|||
|
||||
public class PlagueBeastMaidenOrgan : PlagueBeastOrgan
|
||||
{
|
||||
public PlagueBeastMaidenOrgan() : base(0x124D, 0x0)
|
||||
public PlagueBeastMaidenOrgan() : base(0x124D)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -564,4 +559,4 @@ namespace Server.Items
|
|||
m_Brains = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ namespace Server.Items
|
|||
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
if (m_Timer != null && m_Timer.Running)
|
||||
if (m_Timer?.Running == true)
|
||||
m_Timer.Stop();
|
||||
}
|
||||
|
||||
|
|
@ -75,4 +75,4 @@ namespace Server.Items
|
|||
Cut = reader.ReadBool();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue