Esempio n. 1
0
 public override Activity GetActivity()
 {
     if (walkTask != null)
     {
         // check result of walking
         if (walkTask.MoveResult != EasyMover.MoveResult.Moving &&
             walkTask.MoveResult != EasyMover.MoveResult.GotThere)
         {
             PPather.WriteLine("Can't reach " + monster.Name + ". blacklist. " + walkTask.MoveResult);
             ppather.Blacklist(monster);
             return(null);
         }
     }
     // check distance
     if (monster.DistanceToSelf < ppather.PullDistance)
     {
         PPather.mover.Stop();
         if (attackTask == null)
         {
             attackTask = new ActivityAttack(this, monster);
         }
         walkTask = null;
         return(attackTask);
     }
     else
     {
         // walk over there
         if (walkTask == null)
         {
             walkTask = new ActivityApproach(this, monster, ppather.PullDistance, UseMount);
         }
         attackTask = null;
         return(walkTask);
     }
 }
Esempio n. 2
0
        public Activity GetWalkToActivity()
        {
            GUnit npc = FindNPC();

            if (npc == null)
            {
                Location l = GetLocationOfNPC();
                if (l == null)
                {
                    return(null);
                }
                if (walkToTask == null || NPC != prevNPC)
                {
                    walkToTask = new ActivityWalkTo(this, l, 2f, UseMount);
                }
                prevNPC = NPC;
                return(walkToTask);
            }
            else
            {
                if (approachTask == null || NPC != prevNPC)
                {
                    approachTask = new ActivityApproach(this, npc, 2f, UseMount);
                }
                prevNPC = NPC;
                return(approachTask);
            }
        }
Esempio n. 3
0
        public override Activity GetActivity()
        {
            if (walkTask != null)
            {
                // check result of walking
                if (walkTask.MoveResult != EasyMover.MoveResult.Moving &&
                    walkTask.MoveResult != EasyMover.MoveResult.GotThere)
                {
                    PPather.WriteLine("Can't reach " + target.Name + ". blacklist. " + walkTask.MoveResult);
                    ppather.Blacklist(target.GUID, 120);
                    return null;
                }
            }

            // check distance
            if (target.DistanceToSelf < Distance)
            {
                PPather.mover.Stop();
                if (waitTask == null)
                    waitTask = new ActivityWait(this, "GroupFollow");
                walkTask = null;
                return waitTask;
            }
            else
            {
                // walk over there
                if (walkTask == null)
                    walkTask = new ActivityApproach(this, target, Distance, UseMount);
                waitTask = null;
                return walkTask;
            }
        }
Esempio n. 4
0
        public override Activity GetActivity()
        {
            // override a true to skin with false if it's in the ignorelist
            bool shouldSkin = (this.ignoreSkin.Contains(monster.Name)) ? false : Skin;

            // check distance
            if (monster.DistanceToSelf < 5.0)
            {
                if (walkTask != null)
                {
                    walkTask.Stop();
                }
                if (lootTask == null)
                {
                    lootTask = new ActivityLoot(this, monster, shouldSkin);
                }
                walkTask = null;
                return(lootTask);
            }
            else
            {
                // walk over there
                if (walkTask == null)
                {
                    walkTask = new ActivityApproach(this, monster, 2f, UseMount);
                }
                lootTask = null;
                return(walkTask);
            }
        }
Esempio n. 5
0
        public override bool ActivityDone(Activity task)
        {
            if (task == attackTask)
            {
                monster    = null;
                attackTask = null;
                walkTask   = null;
            }

            task.Stop();

            return(false);
        }
Esempio n. 6
0
 public override bool WantToDoSomething()
 {
     GUnit prevTarget = target;
     target = FindBestTarget();
     if (target != prevTarget)
     {
         if (prevTarget != null && prevTarget.IsValid && !prevTarget.IsDead)
         {
             PPather.WriteLine("New player to follow. ban old one:  " + prevTarget.Name);
             ppather.Blacklist(prevTarget.GUID, 30); // ban for 30 seconds
         }
         waitTask = null;
         walkTask = null;
     }
     if (target == null)
     {
         waitTask = null;
         walkTask = null;
     }
     return target != null;
 }
Esempio n. 7
0
        public Activity GetWalkToActivity()
        {
            GObject  obj = FindObject();
            Location l   = null;

            if (obj == null || obj.Type == GObjectType.Node)
            {
                if (obj == null)
                {
                    l = GetLocationOfObject();
                }
                else
                {
                    l = new Location(obj.Location);
                }
                if (walkToTask == null || Object != prevObj)
                {
                    walkToTask = new ActivityWalkTo(this, l, InteractDistance, UseMount);
                }
                prevObj = Object;
                return(walkToTask);
            }
            else if (obj.Type == GObjectType.Monster)
            {
                if (approachTask == null || NPC != prevObj)
                {
                    approachTask = new ActivityApproach(this, (GUnit)obj, InteractDistance, UseMount);
                }
                prevObj = NPC;
                return(approachTask);
            }
            else
            {
                return(null);                // /cry
            }
        }