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
|
|
@ -8,7 +8,7 @@ namespace Server.Factions
|
|||
private Sigil m_Sigil;
|
||||
private Town m_Town;
|
||||
|
||||
public BaseMonolith(Town town, Faction faction) : base(0x1183)
|
||||
public BaseMonolith(Town town = null, Faction faction = null) : base(0x1183)
|
||||
{
|
||||
Movable = false;
|
||||
Town = town;
|
||||
|
|
@ -80,7 +80,7 @@ namespace Server.Factions
|
|||
|
||||
public virtual void UpdateSigil()
|
||||
{
|
||||
if (m_Sigil == null || m_Sigil.Deleted)
|
||||
if (m_Sigil?.Deleted != false)
|
||||
return;
|
||||
|
||||
m_Sigil.MoveToWorld(new Point3D(X, Y, Z + 18), Map);
|
||||
|
|
@ -126,4 +126,4 @@ namespace Server.Factions
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,12 +8,7 @@ namespace Server.Factions
|
|||
private Faction m_Faction;
|
||||
|
||||
[Constructible]
|
||||
public FactionStone() : this(null)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public FactionStone(Faction faction) : base(0xEDC)
|
||||
public FactionStone(Faction faction = null) : base(0xEDC)
|
||||
{
|
||||
Movable = false;
|
||||
Faction = faction;
|
||||
|
|
@ -101,4 +96,4 @@ namespace Server.Factions
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,12 +8,7 @@ namespace Server.Factions
|
|||
private Faction m_Faction;
|
||||
|
||||
[Constructible]
|
||||
public JoinStone() : this(null)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public JoinStone(Faction faction) : base(0xEDC)
|
||||
public JoinStone(Faction faction = null) : base(0xEDC)
|
||||
{
|
||||
Movable = false;
|
||||
Faction = faction;
|
||||
|
|
@ -76,4 +71,4 @@ namespace Server.Factions
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Server.Factions;
|
||||
using Server.Spells;
|
||||
using Server.Targeting;
|
||||
|
|
@ -34,64 +35,61 @@ namespace Server
|
|||
Point3D origin = new Point3D(pt);
|
||||
Map facet = from.Map;
|
||||
|
||||
if (facet != null && facet.CanFit(pt.X, pt.Y, pt.Z, 16, false, false))
|
||||
{
|
||||
Movable = false;
|
||||
if (facet?.CanFit(pt.X, pt.Y, pt.Z, 16, false, false) != true)
|
||||
return;
|
||||
|
||||
Effects.SendMovingEffect(
|
||||
from, new Entity(Serial.Zero, origin, facet),
|
||||
ItemID & 0x3FFF, 7, 0, false, false, Hue - 1
|
||||
Movable = false;
|
||||
|
||||
Effects.SendMovingEffect(
|
||||
from, new Entity(Serial.Zero, origin, facet),
|
||||
ItemID & 0x3FFF, 7, 0, false, false, Hue - 1
|
||||
);
|
||||
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(0.5), delegate
|
||||
{
|
||||
Delete();
|
||||
|
||||
Effects.PlaySound(origin, facet, 530);
|
||||
Effects.PlaySound(origin, facet, 263);
|
||||
|
||||
Effects.SendLocationEffect(
|
||||
origin, facet,
|
||||
14284, 96, 1, 0, 2
|
||||
);
|
||||
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(0.5), delegate
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(1.0), delegate
|
||||
{
|
||||
Delete();
|
||||
List<Mobile> targets = facet.GetMobilesInRange(origin, 12).Where(mob =>
|
||||
from.CanBeHarmful(mob, false) && mob.InLOS(new Point3D(origin, origin.Z + 1)) &&
|
||||
Faction.Find(mob) != null).ToList();
|
||||
|
||||
Effects.PlaySound(origin, facet, 530);
|
||||
Effects.PlaySound(origin, facet, 263);
|
||||
|
||||
Effects.SendLocationEffect(
|
||||
origin, facet,
|
||||
14284, 96, 1, 0, 2
|
||||
);
|
||||
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(1.0), delegate
|
||||
foreach (Mobile mob in targets)
|
||||
{
|
||||
List<Mobile> targets = new List<Mobile>();
|
||||
int damage = mob.Hits * 6 / 10;
|
||||
|
||||
foreach (Mobile mob in facet.GetMobilesInRange(origin, 12))
|
||||
if (from.CanBeHarmful(mob, false) &&
|
||||
mob.InLOS(new Point3D(origin, origin.Z + 1)))
|
||||
if (Faction.Find(mob) != null)
|
||||
targets.Add(mob);
|
||||
if (!mob.Player && damage < 10)
|
||||
damage = 10;
|
||||
else if (damage > 75)
|
||||
damage = 75;
|
||||
|
||||
foreach (Mobile mob in targets)
|
||||
{
|
||||
int damage = mob.Hits * 6 / 10;
|
||||
Effects.SendMovingEffect(
|
||||
new Entity(Serial.Zero, new Point3D(origin, origin.Z + 4), facet), mob,
|
||||
14068, 1, 32, false, false, 1111, 2
|
||||
);
|
||||
|
||||
if (!mob.Player && damage < 10)
|
||||
damage = 10;
|
||||
else if (damage > 75) damage = 75;
|
||||
from.DoHarmful(mob);
|
||||
|
||||
Effects.SendMovingEffect(
|
||||
new Entity(Serial.Zero, new Point3D(origin, origin.Z + 4), facet), mob,
|
||||
14068, 1, 32, false, false, 1111, 2
|
||||
);
|
||||
SpellHelper.Damage(TimeSpan.FromSeconds(0.50), mob, from, damage / 3.0, 0, 0, 0, 0,
|
||||
100);
|
||||
SpellHelper.Damage(TimeSpan.FromSeconds(0.70), mob, from, damage / 3.0, 0, 0, 0, 0,
|
||||
100);
|
||||
SpellHelper.Damage(TimeSpan.FromSeconds(1.00), mob, from, damage / 3.0, 0, 0, 0, 0,
|
||||
100);
|
||||
|
||||
from.DoHarmful(mob);
|
||||
|
||||
SpellHelper.Damage(TimeSpan.FromSeconds(0.50), mob, from, damage / 3.0, 0, 0, 0, 0,
|
||||
100);
|
||||
SpellHelper.Damage(TimeSpan.FromSeconds(0.70), mob, from, damage / 3.0, 0, 0, 0, 0,
|
||||
100);
|
||||
SpellHelper.Damage(TimeSpan.FromSeconds(1.00), mob, from, damage / 3.0, 0, 0, 0, 0,
|
||||
100);
|
||||
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(0.50), delegate { mob.PlaySound(0x1FB); });
|
||||
}
|
||||
});
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(0.50), delegate { mob.PlaySound(0x1FB); });
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -112,4 +110,4 @@ namespace Server
|
|||
int version = reader.ReadEncodedInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ namespace Server
|
|||
{
|
||||
Faction.ClearSkillLoss(mob);
|
||||
|
||||
mob.SendGump(new ResurrectGump(mob, from, ResurrectMessage.Generic));
|
||||
mob.SendGump(new ResurrectGump(mob, from));
|
||||
used = true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -425,10 +425,10 @@ namespace Server.Factions
|
|||
if (monolith == null && m_Town != null)
|
||||
monolith = m_Town.Monolith;
|
||||
|
||||
if (monolith != null && !monolith.Deleted)
|
||||
if (monolith?.Deleted == false)
|
||||
monolith.Sigil = this;
|
||||
|
||||
return monolith != null && !monolith.Deleted;
|
||||
return monolith?.Deleted == false;
|
||||
}
|
||||
|
||||
public override void OnParentDeleted(IEntity parent)
|
||||
|
|
|
|||
|
|
@ -2,12 +2,9 @@ namespace Server.Factions
|
|||
{
|
||||
public class StrongholdMonolith : BaseMonolith
|
||||
{
|
||||
public StrongholdMonolith() : this(null, null)
|
||||
public StrongholdMonolith(Town town = null, Faction faction = null) : base(town, faction)
|
||||
{
|
||||
}
|
||||
|
||||
public StrongholdMonolith(Town town, Faction faction) : base(town, faction)
|
||||
{
|
||||
}
|
||||
|
||||
public StrongholdMonolith(Serial serial) : base(serial)
|
||||
|
|
@ -35,4 +32,4 @@ namespace Server.Factions
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,11 +2,7 @@ namespace Server.Factions
|
|||
{
|
||||
public class TownMonolith : BaseMonolith
|
||||
{
|
||||
public TownMonolith() : this(null)
|
||||
{
|
||||
}
|
||||
|
||||
public TownMonolith(Town town) : base(town, null)
|
||||
public TownMonolith(Town town = null) : base(town)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -35,4 +31,4 @@ namespace Server.Factions
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,12 +7,7 @@ namespace Server.Factions
|
|||
private Town m_Town;
|
||||
|
||||
[Constructible]
|
||||
public TownStone() : this(null)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public TownStone(Town town) : base(0xEDE)
|
||||
public TownStone(Town town = null) : base(0xEDE)
|
||||
{
|
||||
Movable = false;
|
||||
Town = town;
|
||||
|
|
@ -81,4 +76,4 @@ namespace Server.Factions
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ namespace Server.Factions
|
|||
{
|
||||
PlayerState victimState = PlayerState.Find(from);
|
||||
|
||||
if (victimState != null && victimState.CanGiveSilverTo(Placer) && victimState.KillPoints > 0)
|
||||
if (victimState?.CanGiveSilverTo(Placer) == true && victimState.KillPoints > 0)
|
||||
{
|
||||
int silverGiven = Faction.AwardSilver(Placer, silverToAward);
|
||||
|
||||
|
|
@ -236,7 +236,7 @@ namespace Server.Factions
|
|||
|
||||
public override void OnDelete()
|
||||
{
|
||||
if (Faction != null && Faction.Traps.Contains(this))
|
||||
if (Faction?.Traps.Contains(this) == true)
|
||||
Faction.Traps.Remove(this);
|
||||
|
||||
base.OnDelete();
|
||||
|
|
@ -261,4 +261,4 @@ namespace Server.Factions
|
|||
return faction != Faction;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,16 +8,12 @@ namespace Server.Factions
|
|||
{
|
||||
private Faction m_Faction;
|
||||
|
||||
public BaseFactionTrapDeed(int itemID) : base(itemID)
|
||||
public BaseFactionTrapDeed(int itemID= 0x14F0) : base(itemID)
|
||||
{
|
||||
Weight = 1.0;
|
||||
LootType = LootType.Blessed;
|
||||
}
|
||||
|
||||
public BaseFactionTrapDeed(bool createdFromDeed) : this(0x14F0)
|
||||
{
|
||||
}
|
||||
|
||||
public BaseFactionTrapDeed(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
|
@ -120,4 +116,4 @@ namespace Server.Factions
|
|||
m_Faction = Faction.ReadReference(reader);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,16 +4,7 @@ namespace Server.Factions
|
|||
{
|
||||
public class FactionExplosionTrap : BaseFactionTrap
|
||||
{
|
||||
[Constructible]
|
||||
public FactionExplosionTrap() : this(null)
|
||||
{
|
||||
}
|
||||
|
||||
public FactionExplosionTrap(Faction f) : this(f, null)
|
||||
{
|
||||
}
|
||||
|
||||
public FactionExplosionTrap(Faction f, Mobile m) : base(f, m, 0x11C1)
|
||||
public FactionExplosionTrap(Faction f = null, Mobile m = null) : base(f, m, 0x11C1)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -81,4 +72,4 @@ namespace Server.Factions
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,16 +4,7 @@ namespace Server.Factions
|
|||
{
|
||||
public class FactionGasTrap : BaseFactionTrap
|
||||
{
|
||||
[Constructible]
|
||||
public FactionGasTrap() : this(null)
|
||||
{
|
||||
}
|
||||
|
||||
public FactionGasTrap(Faction f) : this(f, null)
|
||||
{
|
||||
}
|
||||
|
||||
public FactionGasTrap(Faction f, Mobile m) : base(f, m, 0x113C)
|
||||
public FactionGasTrap(Faction f = null, Mobile m = null) : base(f, m, 0x113C)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -81,4 +72,4 @@ namespace Server.Factions
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,20 +4,7 @@ namespace Server.Factions
|
|||
{
|
||||
public class FactionSawTrap : BaseFactionTrap
|
||||
{
|
||||
[Constructible]
|
||||
public FactionSawTrap() : this(null)
|
||||
{
|
||||
}
|
||||
|
||||
public FactionSawTrap(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public FactionSawTrap(Faction f) : this(f, null)
|
||||
{
|
||||
}
|
||||
|
||||
public FactionSawTrap(Faction f, Mobile m) : base(f, m, 0x11AC)
|
||||
public FactionSawTrap(Faction f = null, Mobile m = null) : base(f, m, 0x11AC)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -81,4 +68,4 @@ namespace Server.Factions
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,16 +4,7 @@ namespace Server.Factions
|
|||
{
|
||||
public class FactionSpikeTrap : BaseFactionTrap
|
||||
{
|
||||
[Constructible]
|
||||
public FactionSpikeTrap() : this(null)
|
||||
{
|
||||
}
|
||||
|
||||
public FactionSpikeTrap(Faction f) : this(f, null)
|
||||
{
|
||||
}
|
||||
|
||||
public FactionSpikeTrap(Faction f, Mobile m) : base(f, m, 0x11A0)
|
||||
public FactionSpikeTrap(Faction f = null, Mobile m = null) : base(f, m, 0x11A0)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -84,4 +75,4 @@ namespace Server.Factions
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue