Example #1
0
        internal static bool GatherFishNode(PGameObject node)
        {
            if (_reLure == null)
            {
                _reLure = new Ticker(600000);
                _reLure.ForceReady();
            }
            FlyingEngine.Navigator.Stop();
            var combat = new StateCombat();
            int nearestIndexInPositionList =
                Location.GetClosestPositionInList(FlyingEngine.CurrentProfile.WaypointsNormal, node.Location);
            Location position = FlyingEngine.CurrentProfile.WaypointsNormal[nearestIndexInPositionList];

            if (!ApproachPosFlying.Approach(position, 5))
            {
                return(false);
            }
            node.Location.Face();
            if (Bobber() != null)
            {
                Logging.Write("Someone is fishing, break");
                return(false);
            }
            if (!CheckMobs(node))
            {
                return(false);
            }
            if (FlyingBlackList.IsBlacklisted(node))
            {
                ToldAboutNode.TellAbout("is blacklisted", node);
                return(false);
            }
            DescentToSchool(node);
            Mount.Dismount();
            var timeout      = new Ticker((FlyingSettings.MaxTimeAtSchool * 60) * 1000);
            var checkIfValid = new Ticker(8000);

            while (node.IsValid)
            {
                while (combat.NeedToRun)
                {
                    combat.DoWork();
                    timeout.Reset();
                }
                if (checkIfValid.IsReady)
                {
                    if (ObjectManager.GetObjects.FirstOrDefault(u => u.BaseAddress == node.BaseAddress) == null)
                    {
                        break;
                    }
                    checkIfValid.Reset();
                }
                if (FlyingSettings.Lure && _reLure.IsReady)
                {
                    KeyHelper.SendKey("Lure");
                    Thread.Sleep(3500);
                    _reLure.Reset();
                }
                if (timeout.IsReady)
                {
                    return(false);
                }
                if (ObjectManager.MyPlayer.IsSwimming)
                {
                    MoveHelper.Jump(1500);
                    Thread.Sleep(1000);
                    KeyHelper.SendKey("Waterwalk");
                    Thread.Sleep(2000);
                    MoveHelper.Jump(1500);
                    Thread.Sleep(1500);
                    if (ObjectManager.MyPlayer.IsSwimming)
                    {
                        return(false);
                    }
                }
                node.Location.Face();
                var timeout3 = new Ticker(4000);
                while (!timeout3.IsReady && (node.Location.DistanceToSelf2D < 14))
                {
                    MoveHelper.Backwards(true);
                    Thread.Sleep(20);
                }
                MoveHelper.ReleaseKeys();
                timeout3.Reset();
                node.Location.Face();
                while (!timeout3.IsReady && (node.Location.DistanceToSelf2D > 16))
                {
                    MoveHelper.Forwards(true);
                    Thread.Sleep(20);
                }
                MoveHelper.ReleaseKeys();
                KeyHelper.SendKey("Fishing");
                Thread.Sleep(1500);
                Fishing.FindBobberAndClick(FlyingSettings.WaitForLoot);
                Thread.Sleep(100);
            }
            return(true);
        }
Example #2
0
 public override void DoWork()
 {
     KeyHelper.SendKey("Fishing");
     Thread.Sleep(1500);
     Fishing.FindBobberAndClick(true);
 }