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
|
|
@ -61,7 +61,7 @@ namespace Server.Engines.CannedEvil
|
|||
if (Deleted)
|
||||
return;
|
||||
|
||||
if (m_Skull != null && m_Skull.Deleted)
|
||||
if (m_Skull?.Deleted == true)
|
||||
Skull = null;
|
||||
|
||||
if (from.Map != Map || !from.InRange(GetWorldLocation(), 3))
|
||||
|
|
@ -88,7 +88,7 @@ namespace Server.Engines.CannedEvil
|
|||
if (Deleted)
|
||||
return;
|
||||
|
||||
if (m_Skull != null && m_Skull.Deleted)
|
||||
if (m_Skull?.Deleted == true)
|
||||
Skull = null;
|
||||
|
||||
if (from.Map != Map || !from.InRange(GetWorldLocation(), 3))
|
||||
|
|
@ -181,4 +181,4 @@ namespace Server.Engines.CannedEvil
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ namespace Server.Engines.CannedEvil
|
|||
|
||||
public bool Validate(ChampionSkullBrazier brazier)
|
||||
{
|
||||
return brazier?.Skull != null && !brazier.Skull.Deleted;
|
||||
return brazier?.Skull?.Deleted == false;
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
|
|
@ -125,4 +125,4 @@ namespace Server.Engines.CannedEvil
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -348,7 +348,7 @@ namespace Server.Engines.CannedEvil
|
|||
}
|
||||
else
|
||||
{
|
||||
if (killer.Corpse != null && !killer.Corpse.Deleted)
|
||||
if (killer?.Corpse.Deleted == false)
|
||||
killer.Corpse.DropItem(scroll);
|
||||
else
|
||||
killer.AddToBackpack(scroll);
|
||||
|
|
@ -421,7 +421,8 @@ namespace Server.Engines.CannedEvil
|
|||
{
|
||||
m_Altar.Hue = 0;
|
||||
|
||||
if (!Core.ML || Map == Map.Felucca) new StarRoomGate(true, m_Altar.Location, m_Altar.Map);
|
||||
if (!Core.ML || Map == Map.Felucca)
|
||||
new StarRoomGate(m_Altar.Location, m_Altar.Map, true);
|
||||
}
|
||||
|
||||
Champion = null;
|
||||
|
|
@ -440,7 +441,9 @@ namespace Server.Engines.CannedEvil
|
|||
|
||||
if (m.Deleted)
|
||||
{
|
||||
if (m.Corpse != null && !m.Corpse.Deleted) ((Corpse)m.Corpse).BeginDecay(TimeSpan.FromMinutes(1));
|
||||
if (m.Corpse?.Deleted == false)
|
||||
((Corpse)m.Corpse).BeginDecay(TimeSpan.FromMinutes(1));
|
||||
|
||||
m_Creatures.RemoveAt(i);
|
||||
--i;
|
||||
++m_Kills;
|
||||
|
|
@ -574,6 +577,7 @@ namespace Server.Engines.CannedEvil
|
|||
}
|
||||
catch
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
|
||||
Champion?.MoveToWorld(new Point3D(X, Y, Z - 15), Map);
|
||||
|
|
@ -919,7 +923,7 @@ namespace Server.Engines.CannedEvil
|
|||
m_Creatures.Clear();
|
||||
}
|
||||
|
||||
if (Champion != null && !Champion.Player)
|
||||
if (Champion?.Player == false)
|
||||
Champion.Delete();
|
||||
|
||||
Stop();
|
||||
|
|
@ -950,7 +954,7 @@ namespace Server.Engines.CannedEvil
|
|||
|
||||
public void RegisterDamage(Mobile from, int amount)
|
||||
{
|
||||
if (from == null || !from.Player)
|
||||
if (from?.Player != true)
|
||||
return;
|
||||
|
||||
m_DamageEntries[from] = amount + (m_DamageEntries.TryGetValue(from, out int value) ? value : 0);
|
||||
|
|
@ -997,7 +1001,7 @@ namespace Server.Engines.CannedEvil
|
|||
|
||||
Container pack = to.Backpack;
|
||||
|
||||
if (pack == null || !pack.TryDropItem(to, artifact, false))
|
||||
if (pack?.TryDropItem(to, artifact, false) != true)
|
||||
artifact.Delete();
|
||||
else
|
||||
to.SendLocalizedMessage(
|
||||
|
|
@ -1006,8 +1010,8 @@ namespace Server.Engines.CannedEvil
|
|||
|
||||
public bool IsEligible(Mobile m, Item Artifact)
|
||||
{
|
||||
return m.Player && m.Alive && m.Region != null && m.Region == m_Region && m.Backpack != null &&
|
||||
m.Backpack.CheckHold(m, Artifact, false);
|
||||
return m.Player && m.Alive && m.Region != null && m.Region == m_Region &&
|
||||
m.Backpack?.CheckHold(m, Artifact, false) == true;
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
|
|
|
|||
|
|
@ -9,19 +9,14 @@ namespace Server.Items
|
|||
private Timer m_Timer;
|
||||
|
||||
[Constructible]
|
||||
public StarRoomGate() : this(false)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public StarRoomGate(bool decays, Point3D loc, Map map) : this(decays)
|
||||
public StarRoomGate(Point3D loc, Map map, bool decays) : this(decays)
|
||||
{
|
||||
MoveToWorld(loc, map);
|
||||
Effects.PlaySound(loc, map, 0x20E);
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public StarRoomGate(bool decays) : base(new Point3D(5143, 1774, 0), Map.Felucca)
|
||||
public StarRoomGate(bool decays = false) : base(new Point3D(5143, 1774, 0), Map.Felucca)
|
||||
{
|
||||
Dispellable = false;
|
||||
ItemID = 0x1FD4;
|
||||
|
|
@ -101,4 +96,4 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue