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
|
|
@ -9,12 +9,7 @@ namespace Server.Items
|
|||
{
|
||||
public class HouseTeleporter : Item, ISecurable
|
||||
{
|
||||
[Constructible]
|
||||
public HouseTeleporter(int itemID) : this(itemID, null)
|
||||
{
|
||||
}
|
||||
|
||||
public HouseTeleporter(int itemID, Item target) : base(itemID)
|
||||
public HouseTeleporter(int itemID, Item target = null) : base(itemID)
|
||||
{
|
||||
Movable = false;
|
||||
|
||||
|
|
@ -37,15 +32,13 @@ namespace Server.Items
|
|||
{
|
||||
BaseHouse house = BaseHouse.FindHouseAt(this);
|
||||
|
||||
if (house != null && (house.Public ? house.IsBanned(m) : !house.HasAccess(m)))
|
||||
return false;
|
||||
|
||||
return house != null && house.HasSecureAccess(m, Level);
|
||||
return (house == null || house.Public && !house.IsBanned(m) || house.HasAccess(m)) &&
|
||||
house?.HasSecureAccess(m, Level) == true;
|
||||
}
|
||||
|
||||
public override bool OnMoveOver(Mobile m)
|
||||
{
|
||||
if (Target != null && !Target.Deleted)
|
||||
if (Target?.Deleted == false)
|
||||
{
|
||||
if (CheckAccess(m))
|
||||
{
|
||||
|
|
@ -145,35 +138,35 @@ namespace Server.Items
|
|||
{
|
||||
Item target = m_Teleporter.Target;
|
||||
|
||||
if (target != null && !target.Deleted)
|
||||
{
|
||||
Mobile m = m_Mobile;
|
||||
if (target?.Deleted != false)
|
||||
return;
|
||||
|
||||
if (m.Location == m_Teleporter.Location && m.Map == m_Teleporter.Map)
|
||||
{
|
||||
Point3D p = target.GetWorldTop();
|
||||
Map map = target.Map;
|
||||
Mobile m = m_Mobile;
|
||||
|
||||
BaseCreature.TeleportPets(m, p, map);
|
||||
if (m.Location != m_Teleporter.Location || m.Map != m_Teleporter.Map)
|
||||
return;
|
||||
|
||||
m.MoveToWorld(p, map);
|
||||
Point3D p = target.GetWorldTop();
|
||||
Map map = target.Map;
|
||||
|
||||
if (!m.Hidden || m.AccessLevel == AccessLevel.Player)
|
||||
{
|
||||
Effects.PlaySound(target.Location, target.Map, 0x1FE);
|
||||
BaseCreature.TeleportPets(m, p, map);
|
||||
|
||||
Effects.SendLocationParticles(
|
||||
EffectItem.Create(m_Teleporter.Location, m_Teleporter.Map, EffectItem.DefaultDuration),
|
||||
0x3728, 10, 10, 2023, 0);
|
||||
Effects.SendLocationParticles(
|
||||
EffectItem.Create(target.Location, target.Map, EffectItem.DefaultDuration), 0x3728, 10, 10,
|
||||
5023, 0);
|
||||
m.MoveToWorld(p, map);
|
||||
|
||||
new EffectTimer(target.Location, target.Map, 2023, -1, TimeSpan.FromSeconds(0.4)).Start();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (m.Hidden && m.AccessLevel != AccessLevel.Player)
|
||||
return;
|
||||
|
||||
Effects.PlaySound(target.Location, target.Map, 0x1FE);
|
||||
|
||||
Effects.SendLocationParticles(
|
||||
EffectItem.Create(m_Teleporter.Location, m_Teleporter.Map, EffectItem.DefaultDuration),
|
||||
0x3728, 10, 10, 2023, 0);
|
||||
Effects.SendLocationParticles(
|
||||
EffectItem.Create(target.Location, target.Map, EffectItem.DefaultDuration), 0x3728, 10, 10,
|
||||
5023, 0);
|
||||
|
||||
new EffectTimer(target.Location, target.Map, 2023, -1, TimeSpan.FromSeconds(0.4)).Start();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue