Ejemplo n.º 1
0
        public void ProcessState()
        {
            switch (State)
            {
            case StorylineState.Idle:
                IdleState();
                break;

            case StorylineState.Arm:
                State = _storyline.Arm(this);
                break;

            case StorylineState.GotoAgent:
                GotoAgent(StorylineState.PreAcceptMission);
                break;

            case StorylineState.PreAcceptMission:
                State = _storyline.PreAcceptMission(this);
                break;

            case StorylineState.AcceptMission:
                if (_agentInteraction.State == AgentInteractionState.Idle)
                {
                    Logging.Log("AgentInteraction: Start conversation [Start Mission]");

                    _agentInteraction.State       = AgentInteractionState.StartConversation;
                    _agentInteraction.Purpose     = AgentInteractionPurpose.StartMission;
                    _agentInteraction.AgentId     = AgentId;
                    _agentInteraction.ForceAccept = true;
                }

                _agentInteraction.ProcessState();

                if (Settings.Instance.DebugStates)
                {
                    Logging.Log("AgentInteraction.State = " + _agentInteraction.State);
                }

                if (_agentInteraction.State == AgentInteractionState.Done)
                {
                    _agentInteraction.State = AgentInteractionState.Idle;
                    State = StorylineState.ExecuteMission;
                }
                break;

            case StorylineState.ExecuteMission:
                State = _storyline.ExecuteMission(this);
                break;

            case StorylineState.ReturnToAgent:
                GotoAgent(StorylineState.CompleteMission);
                break;

            case StorylineState.CompleteMission:
                if (_agentInteraction.State == AgentInteractionState.Idle)
                {
                    Logging.Log("AgentInteraction: Start Conversation [Complete Mission]");

                    _agentInteraction.State   = AgentInteractionState.StartConversation;
                    _agentInteraction.Purpose = AgentInteractionPurpose.CompleteMission;
                }

                _agentInteraction.ProcessState();

                if (Settings.Instance.DebugStates)
                {
                    Logging.Log("AgentInteraction.State = " + _agentInteraction.State);
                }

                if (_agentInteraction.State == AgentInteractionState.Done)
                {
                    _agentInteraction.State = AgentInteractionState.Idle;
                    State = StorylineState.BringSpoilsOfWar;
                }
                break;

            case StorylineState.BringSpoilsOfWar:
                BringSpoilsOfWar();
                break;

            case StorylineState.BlacklistAgent:
                _agentBlacklist.Add(AgentId);
                State = StorylineState.Done;
                break;

            case StorylineState.Done:
                break;
            }
        }
Ejemplo n.º 2
0
        public void ProcessState()
        {
            switch (_States.CurrentStorylineState)
            {
            case StorylineState.Idle:
                IdleState();
                break;

            case StorylineState.Arm:

                //Logging.Log("Storyline: Arm");
                _States.CurrentStorylineState = _storyline.Arm(this);
                break;

            case StorylineState.GotoAgent:

                //Logging.Log("Storyline: GotoAgent");
                GotoAgent(StorylineState.PreAcceptMission);
                break;

            case StorylineState.PreAcceptMission:

                //Logging.Log("Storyline: PreAcceptMission-!!");
                _States.CurrentAgentInteractionState = AgentInteractionState.Idle;
                _States.CurrentStorylineState        = _storyline.PreAcceptMission(this);
                break;

            case StorylineState.DeclineMission:
                if (_States.CurrentAgentInteractionState == AgentInteractionState.Idle)
                {
                    Logging.Log("Storyline.AgentInteraction", "Start conversation [Decline Mission]", Logging.Yellow);

                    _States.CurrentAgentInteractionState = AgentInteractionState.StartConversation;
                    AgentInteraction.Purpose             = AgentInteractionPurpose.DeclineMission;
                    AgentInteraction.AgentId             = Cache.Instance.CurrentStorylineAgentId;
                }

                AgentInteraction.ProcessState();

                if (Settings.Instance.DebugStates)
                {
                    Logging.Log("AgentInteraction.State is ", _States.CurrentAgentInteractionState.ToString(), Logging.White);
                }

                if (_States.CurrentAgentInteractionState == AgentInteractionState.Done)
                {
                    _States.CurrentAgentInteractionState = AgentInteractionState.Idle;

                    // If there is no mission anymore then we're done (we declined it)
                }
                break;

            case StorylineState.AcceptMission:

                //Logging.Log("Storyline: AcceptMission!!-");
                if (_States.CurrentAgentInteractionState == AgentInteractionState.Idle)
                {
                    Logging.Log("Storyline.AgentInteraction", "Start conversation [Start Mission]", Logging.Yellow);

                    _States.CurrentAgentInteractionState = AgentInteractionState.StartConversation;
                    AgentInteraction.Purpose             = AgentInteractionPurpose.StartMission;
                    AgentInteraction.AgentId             = Cache.Instance.CurrentStorylineAgentId;
                    AgentInteraction.ForceAccept         = true;
                }

                AgentInteraction.ProcessState();

                if (Settings.Instance.DebugStates)
                {
                    Logging.Log("AgentInteraction.State is ", _States.CurrentAgentInteractionState.ToString(), Logging.White);
                }

                if (_States.CurrentAgentInteractionState == AgentInteractionState.Done)
                {
                    _States.CurrentAgentInteractionState = AgentInteractionState.Idle;

                    // If there is no mission anymore then we're done (we declined it)
                    _States.CurrentStorylineState = StorylineMission == null ? StorylineState.Done : StorylineState.ExecuteMission;
                }
                break;

            case StorylineState.ExecuteMission:
                _States.CurrentStorylineState = _storyline.ExecuteMission(this);
                break;

            case StorylineState.ReturnToAgent:
                GotoAgent(StorylineState.CompleteMission);
                break;

            case StorylineState.CompleteMission:
                if (_States.CurrentAgentInteractionState == AgentInteractionState.Idle)
                {
                    Logging.Log("AgentInteraction", "Start Conversation [Complete Mission]", Logging.Yellow);

                    _States.CurrentAgentInteractionState = AgentInteractionState.StartConversation;
                    AgentInteraction.Purpose             = AgentInteractionPurpose.CompleteMission;
                }

                AgentInteraction.ProcessState();

                if (Settings.Instance.DebugStates)
                {
                    Logging.Log("AgentInteraction.State is", _States.CurrentAgentInteractionState.ToString(), Logging.White);
                }

                if (_States.CurrentAgentInteractionState == AgentInteractionState.Done)
                {
                    _States.CurrentAgentInteractionState = AgentInteractionState.Idle;
                    _States.CurrentStorylineState        = StorylineState.BringSpoilsOfWar;
                }
                break;

            case StorylineState.BringSpoilsOfWar:
                if (!BringSpoilsOfWar())
                {
                    return;
                }
                break;

            case StorylineState.BlacklistAgent:
                Cache.Instance.AgentBlacklist.Add(Cache.Instance.CurrentStorylineAgentId);
                Logging.Log("Storyline", "BlacklistAgent: The agent that provided us with this storyline mission has been added to the session blacklist", Logging.Orange);
                Reset();
                _States.CurrentCombatMissionBehaviorState = CombatMissionsBehaviorState.GotoBase;
                break;

            case StorylineState.Done:
                if (DateTime.UtcNow > _nextStoryLineAttempt)
                {
                    _States.CurrentStorylineState = StorylineState.Idle;
                }
                break;
            }
        }