Fixes bad expressions, bad bool checks in loops, a few null pointer exceptions, and optimizes constructors.

This commit is contained in:
Kamron Batman 2018-09-15 23:16:45 -07:00
parent 8da55d6043
commit f93c3b992e
62 changed files with 318 additions and 634 deletions

View file

@ -197,27 +197,24 @@ namespace Server.Items
BaseCreature bc =
(BaseCreature)Activator.CreateInstance(Creatures[Utility.Random(Creatures.Length)]);
if (bc != null)
Point3D spawnLoc = GetSpawnPosition();
DoEffect(spawnLoc, map);
Timer.DelayCall(TimeSpan.FromSeconds(1), delegate
{
Point3D spawnLoc = GetSpawnPosition();
bc.Home = Location;
bc.RangeHome = SpawnRange;
bc.FightMode = FightMode.Closest;
bc.MoveToWorld(spawnLoc, map);
DoEffect(spawnLoc, map);
Timer.DelayCall(TimeSpan.FromSeconds(1), delegate
{
bc.Home = Location;
bc.RangeHome = SpawnRange;
bc.FightMode = FightMode.Closest;
bc.ForceReacquire();
});
bc.MoveToWorld(spawnLoc, map);
DoEffect(spawnLoc, map);
bc.ForceReacquire();
});
NextSpawn = DateTime.UtcNow + NextSpawnDelay;
}
NextSpawn = DateTime.UtcNow + NextSpawnDelay;
}
else
{
@ -227,6 +224,7 @@ namespace Server.Items
}
catch
{
// ignored
}
else
from.SendLocalizedMessage(500446); // That is too far away.