Ejemplo n.º 1
0
        /// <summary>
        ///   Do a mini-questor here (goto mission, execute mission, goto base)
        /// </summary>
        /// <returns></returns>
        public StorylineState ExecuteMission(Storyline storyline)
        {
            switch (_state)
            {
                case GenericCombatStorylineState.WarpOutStation:
                    DirectBookmark warpOutBookMark = Cache.Instance.BookmarksByLabel(Settings.Instance.UndockBookmarkPrefix ?? "").OrderByDescending(b => b.CreatedOn).FirstOrDefault(b => b.LocationId == Cache.Instance.DirectEve.Session.SolarSystemId);
                    long solarid = Cache.Instance.DirectEve.Session.SolarSystemId ?? -1;

                    if (warpOutBookMark == null)
                    {
                        Logging.Log("GenericCombatStoryline.WarpOut", "No Bookmark", Logging.Orange);
                        _state = GenericCombatStorylineState.GotoMission;
                        break;
                    }

                    if (warpOutBookMark.LocationId == solarid)
                    {
                        if (Traveler.Destination == null)
                        {
                            Logging.Log("GenericCombatStoryline.WarpOut", "Warp at " + warpOutBookMark.Title, Logging.White);
                            Traveler.Destination = new BookmarkDestination(warpOutBookMark);
                            Cache.Instance.DoNotBreakInvul = true;
                        }

                        Traveler.ProcessState();
                        if (_States.CurrentTravelerState == TravelerState.AtDestination)
                        {
                            Logging.Log("GenericCombatStoryline.WarpOut", "Safe!", Logging.White);
                            Cache.Instance.DoNotBreakInvul = false;
                            _state = GenericCombatStorylineState.GotoMission;
                            Traveler.Destination = null;
                            break;
                        }

                        break;
                    }

                    Logging.Log("GenericCombatStoryline.WarpOut", "No Bookmark in System", Logging.White);
                    _state = GenericCombatStorylineState.GotoMission;
                    break;

                case GenericCombatStorylineState.GotoMission:
                    MissionBookmarkDestination missionDestination = Traveler.Destination as MissionBookmarkDestination;
                    //
                    // if we have no destination yet... OR if missionDestination.AgentId != storyline.CurrentStorylineAgentId
                    //
                    //if (missionDestination != null) Logging.Log("GenericCombatStoryline: missionDestination.AgentId [" + missionDestination.AgentId + "] " + "and storyline.CurrentStorylineAgentId [" + storyline.CurrentStorylineAgentId + "]");
                    //if (missionDestination == null) Logging.Log("GenericCombatStoryline: missionDestination.AgentId [ NULL ] " + "and storyline.CurrentStorylineAgentId [" + storyline.CurrentStorylineAgentId + "]");
                    if (missionDestination == null || missionDestination.AgentId != Cache.Instance.CurrentStorylineAgentId) // We assume that this will always work "correctly" (tm)
                    {
                        string nameOfBookmark ="";
                        if (Settings.Instance.EveServerName == "Tranquility") nameOfBookmark = "Encounter";
                        if (Settings.Instance.EveServerName == "Serenity") nameOfBookmark = "遭遇战";
                        if (nameOfBookmark == "") nameOfBookmark = "Encounter";
                        Logging.Log("GenericCombatStoryline", "Setting Destination to 1st bookmark from AgentID: [" + Cache.Instance.CurrentStorylineAgentId + "] with [" + nameOfBookmark + "] in the title", Logging.White);
                        Traveler.Destination = new MissionBookmarkDestination(Cache.Instance.GetMissionBookmark(Cache.Instance.CurrentStorylineAgentId, nameOfBookmark));
                    }

                    if (Cache.Instance.PotentialCombatTargets.Any())
                    {
                        Logging.Log("GenericCombatStoryline", "Priority targets found while traveling, engaging!", Logging.White);
                        Combat.ProcessState();
                    }

                    Traveler.ProcessState();
                    if (_States.CurrentTravelerState == TravelerState.AtDestination)
                    {
                        _state = GenericCombatStorylineState.ExecuteMission;

                        //_States.CurrentCombatState = CombatState.CheckTargets;
                        Traveler.Destination = null;
                    }
                    break;

                case GenericCombatStorylineState.ExecuteMission:
                    Combat.ProcessState();
                    Drones.ProcessState();
                    Salvage.ProcessState();
                    _combatMissionCtrl.ProcessState();

                    // If we are out of ammo, return to base, the mission will fail to complete and the bot will reload the ship
                    // and try the mission again
                    if (_States.CurrentCombatState == CombatState.OutOfAmmo)
                    {
                        // Clear looted containers
                        Cache.Instance.LootedContainers.Clear();

                        Logging.Log("GenericCombatStoryline", "Out of Ammo!", Logging.Orange);
                        return StorylineState.ReturnToAgent;
                    }

                    if (_States.CurrentCombatMissionCtrlState == CombatMissionCtrlState.Done)
                    {
                        // Clear looted containers
                        Cache.Instance.LootedContainers.Clear();
                        return StorylineState.ReturnToAgent;
                    }

                    // If in error state, just go home and stop the bot
                    if (_States.CurrentCombatMissionCtrlState == CombatMissionCtrlState.Error)
                    {
                        // Clear looted containers
                        Cache.Instance.LootedContainers.Clear();

                        Logging.Log("MissionController", "Error", Logging.Red);
                        return StorylineState.ReturnToAgent;
                    }
                    break;
            }

            return StorylineState.ExecuteMission;
        }
Ejemplo n.º 2
0
 /// <summary>
 ///   We have no pre-accept steps
 /// </summary>
 /// <returns></returns>
 public StorylineState PreAcceptMission(Storyline storyline)
 {
     // Not really a step is it? :)
     _state = GenericCombatStorylineState.WarpOutStation;
     return StorylineState.AcceptMission;
 }
Ejemplo n.º 3
0
        /// <summary>
        ///   Do a mini-questor here (goto mission, execute mission, goto base)
        /// </summary>
        /// <returns></returns>
        public StorylineState ExecuteMission(Storyline storyline)
        {
            switch(_state)
            {
                case GenericCombatStorylineState.GotoMission:
                    var missionDestination = _traveler.Destination as MissionBookmarkDestination;
                    if (missionDestination == null || missionDestination.AgentId != storyline.AgentId) // We assume that this will always work "correctly" (tm)
                        _traveler.Destination = new MissionBookmarkDestination(Cache.Instance.GetMissionBookmark(storyline.AgentId, "Encounter"));

                    if (Cache.Instance.PriorityTargets.Any(pt => pt != null && pt.IsValid))
                    {
                        Logging.Log("GenericCombatStoryline: Priority targets found while traveling, engaging!");
                        _combat.ProcessState();
                    }

                    _traveler.ProcessState();
                    if (_traveler.State == TravelerState.AtDestination)
                    {
                        _state = GenericCombatStorylineState.ExecuteMission;
                        _traveler.Destination = null;
                    }
                    break;

                case GenericCombatStorylineState.ExecuteMission:
                    _combat.ProcessState();
                    _drones.ProcessState();
                    _salvage.ProcessState();
                    _missionController.ProcessState();

                    // If we are out of ammo, return to base, the mission will fail to complete and the bot will reload the ship
                    // and try the mission again
                    if (_combat.State == CombatState.OutOfAmmo)
                    {
                        // Clear looted containers
                        Cache.Instance.LootedContainers.Clear();

                        Logging.Log("GenericCombatStoryline: Out of Ammo!");
                        return StorylineState.ReturnToAgent;
                    }

                    if (_missionController.State == MissionControllerState.Done)
                    {
                        // Clear looted containers
                        Cache.Instance.LootedContainers.Clear();
                        return StorylineState.ReturnToAgent;
                    }

                    // If in error state, just go home and stop the bot
                    if (_missionController.State == MissionControllerState.Error)
                    {
                        // Clear looted containers
                        Cache.Instance.LootedContainers.Clear();

                        Logging.Log("MissionController: Error");
                        return StorylineState.ReturnToAgent;
                    }
                    break;
            }

            return StorylineState.ExecuteMission;
        }
Ejemplo n.º 4
0
        /// <summary>
        ///   Do a mini-questor here (goto mission, execute mission, goto base)
        /// </summary>
        /// <returns></returns>
        public StorylineState ExecuteMission(Storyline storyline)
        {
            switch (_state)
            {
            case GenericCombatStorylineState.GotoMission:
                var missionDestination = _traveler.Destination as MissionBookmarkDestination;
                if (missionDestination == null || missionDestination.AgentId != storyline.AgentId)     // We assume that this will always work "correctly" (tm)
                {
                    _traveler.Destination = new MissionBookmarkDestination(Cache.Instance.GetMissionBookmark(storyline.AgentId, "Encounter"));
                }

                if (Cache.Instance.PriorityTargets.Any(pt => pt != null && pt.IsValid))
                {
                    Logging.Log("GenericCombatStoryline: Priority targets found while traveling, engaging!");
                    _combat.ProcessState();
                }

                _traveler.ProcessState();
                if (_traveler.State == TravelerState.AtDestination)
                {
                    _state = GenericCombatStorylineState.ExecuteMission;
                    _traveler.Destination = null;
                }
                break;

            case GenericCombatStorylineState.ExecuteMission:
                _combat.ProcessState();
                _drones.ProcessState();
                _salvage.ProcessState();
                _missionController.ProcessState();

                // If we are out of ammo, return to base, the mission will fail to complete and the bot will reload the ship
                // and try the mission again
                if (_combat.State == CombatState.OutOfAmmo)
                {
                    // Clear looted containers
                    Cache.Instance.LootedContainers.Clear();

                    Logging.Log("GenericCombatStoryline: Out of Ammo!");
                    return(StorylineState.ReturnToAgent);
                }

                if (_missionController.State == MissionControllerState.Done)
                {
                    // Clear looted containers
                    Cache.Instance.LootedContainers.Clear();
                    return(StorylineState.ReturnToAgent);
                }

                // If in error state, just go home and stop the bot
                if (_missionController.State == MissionControllerState.Error)
                {
                    // Clear looted containers
                    Cache.Instance.LootedContainers.Clear();

                    Logging.Log("MissionController: Error");
                    return(StorylineState.ReturnToAgent);
                }
                break;
            }

            return(StorylineState.ExecuteMission);
        }
Ejemplo n.º 5
0
 /// <summary>
 ///   We have no pre-accept steps
 /// </summary>
 /// <returns></returns>
 public StorylineState PreAcceptMission(Storyline storyline)
 {
     // Not really a step is it? :)
     _state = GenericCombatStorylineState.GotoMission;
     return(StorylineState.AcceptMission);
 }
Ejemplo n.º 6
0
        /// <summary>
        ///   Do a mini-questor here (goto mission, execute mission, goto base)
        /// </summary>
        /// <returns></returns>
        public StorylineState ExecuteMission(Storyline storyline)
        {
            switch (_state)
            {
            case GenericCombatStorylineState.WarpOutStation:
                var _bookmark = Cache.Instance.BookmarksByLabel(Settings.Instance.bookmarkWarpOut ?? "").OrderByDescending(b => b.CreatedOn).Where(b => b.LocationId == Cache.Instance.DirectEve.Session.SolarSystemId).FirstOrDefault();
                var _solarid  = Cache.Instance.DirectEve.Session.SolarSystemId ?? -1;

                if (_bookmark == null)
                {
                    Logging.Log("WarpOut: No Bookmark");
                    if (_state == GenericCombatStorylineState.WarpOutStation)
                    {
                        _state = GenericCombatStorylineState.GotoMission;
                    }
                }
                else if (_bookmark.LocationId == _solarid)
                {
                    if (_traveler.Destination == null)
                    {
                        Logging.Log("WarpOut: Warp at " + _bookmark.Title);
                        _traveler.Destination          = new BookmarkDestination(_bookmark);
                        Cache.Instance.DoNotBreakInvul = true;
                    }

                    _traveler.ProcessState();
                    if (_traveler.State == TravelerState.AtDestination)
                    {
                        Logging.Log("WarpOut: Safe!");
                        Cache.Instance.DoNotBreakInvul = false;
                        if (_state == GenericCombatStorylineState.WarpOutStation)
                        {
                            _state = GenericCombatStorylineState.GotoMission;
                        }
                        _traveler.Destination = null;
                    }
                }
                else
                {
                    Logging.Log("WarpOut: No Bookmark in System");
                    if (_state == GenericCombatStorylineState.WarpOutStation)
                    {
                        _state = GenericCombatStorylineState.GotoMission;
                    }
                }
                break;

            case GenericCombatStorylineState.GotoMission:
                var missionDestination = _traveler.Destination as MissionBookmarkDestination;
                if (missionDestination == null || missionDestination.AgentId != storyline.AgentId)     // We assume that this will always work "correctly" (tm)
                {
                    _traveler.Destination = new MissionBookmarkDestination(Cache.Instance.GetMissionBookmark(storyline.AgentId, "Encounter"));
                }

                if (Cache.Instance.PriorityTargets.Any(pt => pt != null && pt.IsValid))
                {
                    Logging.Log("GenericCombatStoryline: Priority targets found while traveling, engaging!");
                    _combat.ProcessState();
                }

                _traveler.ProcessState();
                if (_traveler.State == TravelerState.AtDestination)
                {
                    _state = GenericCombatStorylineState.ExecuteMission;
                    _traveler.Destination = null;
                }
                break;

            case GenericCombatStorylineState.ExecuteMission:
                _combat.ProcessState();
                _drones.ProcessState();
                _salvage.ProcessState();
                _missionController.ProcessState();

                // If we are out of ammo, return to base, the mission will fail to complete and the bot will reload the ship
                // and try the mission again
                if (_combat.State == CombatState.OutOfAmmo)
                {
                    // Clear looted containers
                    Cache.Instance.LootedContainers.Clear();

                    Logging.Log("GenericCombatStoryline: Out of Ammo!");
                    return(StorylineState.ReturnToAgent);
                }

                if (_missionController.State == MissionControllerState.Done)
                {
                    // Clear looted containers
                    Cache.Instance.LootedContainers.Clear();
                    return(StorylineState.ReturnToAgent);
                }

                // If in error state, just go home and stop the bot
                if (_missionController.State == MissionControllerState.Error)
                {
                    // Clear looted containers
                    Cache.Instance.LootedContainers.Clear();

                    Logging.Log("MissionController: Error");
                    return(StorylineState.ReturnToAgent);
                }
                break;
            }

            return(StorylineState.ExecuteMission);
        }
Ejemplo n.º 7
0
        /// <summary>
        ///   Do a mini-questor here (goto mission, execute mission, goto base)
        /// </summary>
        /// <returns></returns>
        public StorylineState ExecuteMission(Storyline storyline)
        {
            switch (_state)
            {
            case GenericCombatStorylineState.WarpOutStation:
                DirectBookmark warpOutBookMark = Cache.Instance.BookmarksByLabel(Settings.Instance.UndockBookmarkPrefix ?? "").OrderByDescending(b => b.CreatedOn).FirstOrDefault(b => b.LocationId == Cache.Instance.DirectEve.Session.SolarSystemId);
                long           solarid         = Cache.Instance.DirectEve.Session.SolarSystemId ?? -1;

                if (warpOutBookMark == null)
                {
                    Logging.Log("GenericCombatStoryline.WarpOut", "No Bookmark", Logging.Orange);
                    _state = GenericCombatStorylineState.GotoMission;
                    break;
                }

                if (warpOutBookMark.LocationId == solarid)
                {
                    if (Traveler.Destination == null)
                    {
                        Logging.Log("GenericCombatStoryline.WarpOut", "Warp at " + warpOutBookMark.Title, Logging.White);
                        Traveler.Destination           = new BookmarkDestination(warpOutBookMark);
                        Cache.Instance.DoNotBreakInvul = true;
                    }

                    Traveler.ProcessState();
                    if (_States.CurrentTravelerState == TravelerState.AtDestination)
                    {
                        Logging.Log("GenericCombatStoryline.WarpOut", "Safe!", Logging.White);
                        Cache.Instance.DoNotBreakInvul = false;
                        _state = GenericCombatStorylineState.GotoMission;
                        Traveler.Destination = null;
                        break;
                    }

                    break;
                }

                Logging.Log("GenericCombatStoryline.WarpOut", "No Bookmark in System", Logging.White);
                _state = GenericCombatStorylineState.GotoMission;
                break;

            case GenericCombatStorylineState.GotoMission:
                MissionBookmarkDestination missionDestination = Traveler.Destination as MissionBookmarkDestination;
                //
                // if we have no destination yet... OR if missionDestination.AgentId != storyline.CurrentStorylineAgentId
                //
                //if (missionDestination != null) Logging.Log("GenericCombatStoryline: missionDestination.AgentId [" + missionDestination.AgentId + "] " + "and storyline.CurrentStorylineAgentId [" + storyline.CurrentStorylineAgentId + "]");
                //if (missionDestination == null) Logging.Log("GenericCombatStoryline: missionDestination.AgentId [ NULL ] " + "and storyline.CurrentStorylineAgentId [" + storyline.CurrentStorylineAgentId + "]");
                if (missionDestination == null || missionDestination.AgentId != Cache.Instance.CurrentStorylineAgentId)     // We assume that this will always work "correctly" (tm)
                {
                    string nameOfBookmark = "";
                    if (Settings.Instance.EveServerName == "Tranquility")
                    {
                        nameOfBookmark = "Encounter";
                    }
                    if (Settings.Instance.EveServerName == "Serenity")
                    {
                        nameOfBookmark = "遭遇战";
                    }
                    if (nameOfBookmark == "")
                    {
                        nameOfBookmark = "Encounter";
                    }
                    Logging.Log("GenericCombatStoryline", "Setting Destination to 1st bookmark from AgentID: [" + Cache.Instance.CurrentStorylineAgentId + "] with [" + nameOfBookmark + "] in the title", Logging.White);
                    Traveler.Destination = new MissionBookmarkDestination(Cache.Instance.GetMissionBookmark(Cache.Instance.CurrentStorylineAgentId, nameOfBookmark));
                }

                if (Cache.Instance.PotentialCombatTargets.Any())
                {
                    Logging.Log("GenericCombatStoryline", "Priority targets found while traveling, engaging!", Logging.White);
                    Combat.ProcessState();
                }

                Traveler.ProcessState();
                if (_States.CurrentTravelerState == TravelerState.AtDestination)
                {
                    _state = GenericCombatStorylineState.ExecuteMission;

                    //_States.CurrentCombatState = CombatState.CheckTargets;
                    Traveler.Destination = null;
                }
                break;

            case GenericCombatStorylineState.ExecuteMission:
                Combat.ProcessState();
                Drones.ProcessState();
                Salvage.ProcessState();
                _combatMissionCtrl.ProcessState();

                // If we are out of ammo, return to base, the mission will fail to complete and the bot will reload the ship
                // and try the mission again
                if (_States.CurrentCombatState == CombatState.OutOfAmmo)
                {
                    // Clear looted containers
                    Cache.Instance.LootedContainers.Clear();

                    Logging.Log("GenericCombatStoryline", "Out of Ammo!", Logging.Orange);
                    return(StorylineState.ReturnToAgent);
                }

                if (_States.CurrentCombatMissionCtrlState == CombatMissionCtrlState.Done)
                {
                    // Clear looted containers
                    Cache.Instance.LootedContainers.Clear();
                    return(StorylineState.ReturnToAgent);
                }

                // If in error state, just go home and stop the bot
                if (_States.CurrentCombatMissionCtrlState == CombatMissionCtrlState.Error)
                {
                    // Clear looted containers
                    Cache.Instance.LootedContainers.Clear();

                    Logging.Log("MissionController", "Error", Logging.Red);
                    return(StorylineState.ReturnToAgent);
                }
                break;
            }

            return(StorylineState.ExecuteMission);
        }