internal static bool PlayerToClose(int distance, PGameObject gameObject) { if (!FlyingSettings.AvoidPlayers) { return(false); } if ( ObjectManager.GetPlayers.Where(obj => !obj.Name.Equals(ObjectManager.MyPlayer.Name)) .Any(obj => FindNode.GetLocation(gameObject).GetDistanceTo(obj.Location) < distance)) { Logging.Write("Player to close to node"); FlyingBlackList.Blacklist(gameObject, 300, false); return(true); } return(false); }
public static bool GatherNode(PGameObject harvest) { if (FindNode.IsSchool(harvest)) { return(GatherFishNode(harvest)); } if (ApprochNode(harvest)) { Logging.Write("靠近[矿/草]点"); HitTheNode(harvest); if (!CheckMobs(harvest)) { return(false); } if (FlyingBlackList.IsBlacklisted(harvest)) { ToldAboutNode.TellAbout("is blacklisted", harvest); return(false); } if (MoveHelper.NegativeValue(ObjectManager.MyPlayer.Location.Z - FindNode.GetLocation(harvest).Z) > 1) { Logging.Write("下降中......"); DescentToNode(harvest); } if (FlyingBlackList.IsBlacklisted(harvest)) { ToldAboutNode.TellAbout("is blacklisted", harvest); return(false); } if (FindNode.GetLocation(harvest).DistanceToSelf2D > 5) { ApproachPosFlying.Approach(harvest.Location, 4); } if (FindNode.GetLocation(harvest).DistanceToSelf > 10) { Logging.Write("距离矿/草太远,放弃"); return(false); } if (!DismountAndHarvest(harvest, TimeOut)) { return(false); } return(true); } ToldAboutNode.TellAbout("过不去啊!!!", harvest); return(false); }
internal static void HitTheNode(PGameObject nodeToHarvest) { Face.Reset(); ToLongRun.Reset(); _oldDis = FindNode.GetLocation(nodeToHarvest).DistanceToSelf; while (!ToLongRun.IsReady) { MoveHelper.Forwards(true); _distanceX = Math.Round(Math.Abs(FindNode.GetLocation(nodeToHarvest).Y - ObjectManager.MyPlayer.Location.Y)); _distanceY = Math.Round(Math.Abs(FindNode.GetLocation(nodeToHarvest).X - ObjectManager.MyPlayer.Location.X)); if (_distanceX <= 3 && _distanceY <= 3) { break; } if (Face.IsReady) { FindNode.GetLocation(nodeToHarvest).Face(); Face.Reset(); } Thread.Sleep(2); if (_oldDis < FindNode.GetLocation(nodeToHarvest).DistanceToSelf) { break; } } if (nodeToHarvest.Location.DistanceToSelf2D > 2.9) { if (nodeToHarvest.Location.DistanceToSelf2D > 2) { Thread.Sleep(150); } else if (nodeToHarvest.Location.DistanceToSelf2D > 1) { Thread.Sleep(100); } } MoveHelper.ReleaseKeys(); }