private void MoveToNextAsteroidBelt() { var methodName = "MoveToNextAsteroidBelt"; LogTrace(methodName); _asteroidBelts.ChangeBelts(true, true); if (_movementConfiguration.OnlyUseBeltBookmarks ? _asteroidBelts.AllBookMarkedBeltsEmpty : _asteroidBelts.AllBeltsEmpty) { LogMessage(methodName, LogSeverityTypes.Standard, "Error; all belts are empty."); _rattingState = RattingStates.Error; return; } if (_movementConfiguration.OnlyUseBeltBookmarks) { if (_asteroidBelts.CurrentBookMarkedBelt != null) { _movement.QueueDestination(new Destination( DestinationTypes.BookMark, _asteroidBelts.CurrentBookMarkedBelt.Id) { Distance = 15000 }); } else { _rattingState = RattingStates.Error; } } else { if (_asteroidBelts.CurrentBelt != null) { _movement.QueueDestination(new Destination( DestinationTypes.Entity, _asteroidBelts.CurrentBelt.Id) { Distance = 15000 }); } else { _rattingState = RattingStates.Error; } } }
private void MoveToNextAnomaly() { var methodName = "MoveToNextAnomaly"; LogTrace(methodName); switch (_changeAnomalyState) { case ChangeAnomalyStates.BookmarkSiteForSalvage: BookmarkAnomalyForSalvage(); //Clear the selected anomaly _selectedAnomalyId = null; _changeAnomalyState = ChangeAnomalyStates.SelectAnomaly; goto case ChangeAnomalyStates.SelectAnomaly; case ChangeAnomalyStates.SelectAnomaly: { var selectedAnomaly = SelectAnomaly(); //If none, safe up. if (selectedAnomaly == null) { LogMessage(methodName, LogSeverityTypes.Standard, "Error: Could not find an anomaly matching selected anomalies."); _rattingState = RattingStates.Error; //Reset the ChangeAnomalyState _changeAnomalyState = ChangeAnomalyStates.BookmarkSiteForSalvage; return; } //Claim the anomaly _anomalyClaimTracker.ClaimAnomaly(selectedAnomaly.ID); _selectedAnomalyId = selectedAnomaly.ID; _changeAnomalyState = ChangeAnomalyStates.ValidateAnomaly; break; } case ChangeAnomalyStates.ValidateAnomaly: { if (_selectedAnomalyId == null) { LogMessage(methodName, LogSeverityTypes.Debug, "Error: Cannot validate a non-existent anomaly."); _changeAnomalyState = ChangeAnomalyStates.SelectAnomaly; return; } //make sure there are no new claims on the selected anomaly if (_anomalyClaimTracker.IsAnomalyClaimedByOther(_selectedAnomalyId.Value)) { LogMessage(methodName, LogSeverityTypes.Standard, "Another player has a better claim to anomaly ID {0}. Selecting another anomaly.", _selectedAnomalyId.Value); _selectedAnomalyId = null; _changeAnomalyState = ChangeAnomalyStates.SelectAnomaly; goto case ChangeAnomalyStates.SelectAnomaly; } _changeAnomalyState = ChangeAnomalyStates.MoveToAnomaly; goto case ChangeAnomalyStates.MoveToAnomaly; } case ChangeAnomalyStates.MoveToAnomaly: { var selectedAnomaly = _anomalyProvider.GetAnomalies().FirstOrDefault(a => a.ID == _selectedAnomalyId.Value); if (selectedAnomaly == null) { LogMessage(methodName, LogSeverityTypes.Standard, "Error: No anomaly exists for selected anomaly ID {0}.", _selectedAnomalyId.Value); _changeAnomalyState = ChangeAnomalyStates.SelectAnomaly; _selectedAnomalyId = null; goto case ChangeAnomalyStates.SelectAnomaly; } var destination = new Destination(DestinationTypes.CosmicAnomaly) { SystemAnomalyId = selectedAnomaly.ID, WarpToDistance = 30000 }; LogMessage(methodName, LogSeverityTypes.Standard, "Moving to cosmic anomaly \"{0} - {1}\" ({2}).", selectedAnomaly.Name, selectedAnomaly.DungeonName, selectedAnomaly.ID); _movement.QueueDestination(destination); _changeAnomalyState = ChangeAnomalyStates.BookmarkSiteForSalvage; break; } } }
protected override void SetPulseState() { var methodName = "SetPulseState"; LogTrace(methodName); //If defense has us fleeing we probably shouldn't be doing anything.); if (Core.StealthBot.Defense.IsFleeing) { _rattingState = RattingStates.Defend; return; } //Ok, not fleeign/defending. Check ammo status. /*if (!_ship.IsAmmoAvailable) * { * _rattingState = RattingStates.Rearm; * return; * }*/ //If it's an error state, return. if (_rattingState == RattingStates.Error) { if (HasMaxRuntimeExpired()) { return; } if (_rattingConfiguration.IsAnomalyMode) { var anomalies = GetAvailableAnomalies(); if (anomalies.Any(b => _meCache.ToEntity.DistanceTo(b.X, b.Y, b.Z) >= (int)Ranges.Warp * 2)) { LogMessage(methodName, LogSeverityTypes.Standard, "New anomalies matching those selected were detected."); _rattingState = RattingStates.ChangeBelts; } } return; } //if I'm in station, I should probably focus on getting to a belt. if (_meCache.InStation) { _rattingState = RattingStates.ChangeBelts; } else { //If the NPC check and player check passed, kill shit if (_npcCheck && _pcCheck) { _rattingState = RattingStates.KillRats; } else { if (HasMaxRuntimeExpired()) { _rattingState = RattingStates.Error; } else { //Either no rats or a player here, change belts _rattingState = RattingStates.ChangeBelts; } } } }