Code cleanup (#188)

This commit is contained in:
Kamron Batman 2020-08-01 08:40:06 -07:00 • committed by GitHub
parent df53c16620
commit 010fd9402a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
185 changed files with 1052 additions and 1271 deletions

View file

@ -1126,32 +1126,31 @@ namespace Server.Mobiles
double distance = m_Mobile.GetDistanceToSqrt(target);
if (distance < 1 || distance > 15)
if (!(distance < 1 || distance > 15))
{
if (distance < 1 && target.X == 1076 && target.Y == 450 && m_Mobile is HordeMinionFamiliar)
if (m_Mobile.ControlMaster is PlayerMobile pm)
{
QuestSystem qs = pm.Quest;
if (qs is DarkTidesQuest)
{
QuestObjective obj = qs.FindObjective<FetchAbraxusScrollObjective>();
if (obj?.Completed == false)
{
m_Mobile.AddToBackpack(new ScrollOfAbraxus());
obj.Complete();
}
}
}
m_Mobile.TargetLocation = null;
return false; // At the target or too far away
DoMove(m_Mobile.GetDirectionTo(target));
return true;
}
DoMove(m_Mobile.GetDirectionTo(target));
if (distance < 1 && target.X == 1076 && target.Y == 450 && m_Mobile is HordeMinionFamiliar)
if (m_Mobile.ControlMaster is PlayerMobile pm)
{
QuestSystem qs = pm.Quest;
return true;
if (qs is DarkTidesQuest)
{
QuestObjective obj = qs.FindObjective<FetchAbraxusScrollObjective>();
if (obj?.Completed == false)
{
m_Mobile.AddToBackpack(new ScrollOfAbraxus());
obj.Complete();
}
}
}
m_Mobile.TargetLocation = null;
return false; // At the target or too far away
}
public virtual bool DoOrderFollow()
@ -2099,8 +2098,7 @@ namespace Server.Mobiles
if (!DoMove(dirTo, true) && needCloser)
{
m_Path = new PathFollower(m_Mobile, m);
m_Path.Mover = DoMoveImpl;
m_Path = new PathFollower(m_Mobile, m) {Mover = DoMoveImpl};
if (m_Path.Follow(bRun, 1))
m_Path = null;
@ -2379,17 +2377,11 @@ namespace Server.Mobiles
var spawner = m_Mobile.Spawner;
if (spawner?.ReturnOnDeactivate == true && !m_Mobile.Controlled)
{
if (spawner.HomeLocation == Point3D.Zero)
{
if (!m_Mobile.Region.AcceptsSpawnsFrom(spawner.Region)) Timer.DelayCall(TimeSpan.Zero, ReturnToHome);
}
else if (!m_Mobile.InRange(spawner.HomeLocation, spawner.HomeRange))
{
Timer.DelayCall(TimeSpan.Zero, ReturnToHome);
}
}
if (spawner?.ReturnOnDeactivate == true && !m_Mobile.Controlled && (
spawner.HomeLocation == Point3D.Zero && !m_Mobile.Region.AcceptsSpawnsFrom(spawner.Region) ||
!m_Mobile.InRange(spawner.HomeLocation, spawner.HomeRange)
))
Timer.DelayCall(ReturnToHome);
}
}