コード例 #1
0
ファイル: StateGather.cs プロジェクト: semi420/lazybot
 public override void DoWork()
 {
     Logging.Debug("Approaching: " + _node.Location);
     if (_nodeLoc == _node.Location)
     {
         if (_approachTimes > 6)
         {
             Logging.Write("We tried to approach the same node more than 6 times... does not make sense abort");
             FlyingBlackList.Blacklist(_node, 120, true);
             return;
         }
         _approachTimes++;
     }
     else
     {
         _nodeLoc       = _node.Location;
         _approachTimes = 0;
     }
     if (Gather.GatherNode(_node))
     {
         FlyingEngine.UpdateStats(1, 0, 0);
         if (FlyingSettings.WaitForLoot)
         {
             while (ObjectManager.MyPlayer.LootWinOpen && !TimeOut.IsReady)
             {
                 Thread.Sleep(100);
             }
             Latency.Sleep(1300);
         }
         if (ObjectManager.MyPlayer.IsInFlightForm)
         {
             MoveHelper.Jump();
         }
     }
     else
     {
         if (ObjectManager.ShouldDefend && Mount.IsMounted())
         {
             Logging.Write("ShouldDefend while mounted? Odd");
             FlyingBlackList.Blacklist(_node, 120, true);
         }
     }
     if (!ObjectManager.MyPlayer.InVashjir && ObjectManager.MyPlayer.IsSwimming)
     {
         Logging.Write("We got into the water, blacklisting node");
         FlyingBlackList.AddBadNode(_node);
         KeyHelper.SendKey("Space");
         Thread.Sleep(3000);
         KeyHelper.ReleaseKey("Space");
     }
     if (!ObjectManager.ShouldDefend && !ObjectManager.MyPlayer.IsInCombat)
     {
         LootedBlacklist.Looted(_node);
         if (ObjectManager.MyPlayer.InVashjir)
         {
             KeyHelper.SendKey("Space");
             Thread.Sleep(1000);
             KeyHelper.ReleaseKey("Space");
         }
     }
     if (!Mount.IsMounted())
     {
         CombatHandler.RunningAction();
         CombatHandler.Rest();
     }
     Stuck.Reset();
     if (FlyingEngine.CurrentProfile.NaturalRun)
     {
         FlyingEngine.Navigation.UseNearestWaypoint();
     }
     else
     {
         FlyingEngine.Navigation.UseNearestWaypoint(10);
     }
 }