示例#1
0
        public bool IsConfigMissionAvailable(Mission mission, IStandingHandler standingHandler, bool ignoreTriggerCheck = false)
        {
            //not listable
            if (!mission.listable)
            {
                return(false);
            }

            if (mission.LocationId != _location.id)
            {
                //not at the requested location
                return(false);
            }

            if (!ignoreTriggerCheck)
            {
                //the mission is member of a chain mission
                if (mission.isTriggered)
                {
                    return(false);
                }
            }

            if (mission.MissionLevel > 0)
            {
                if (!mission.MatchStandingToLevel(_character, standingHandler))
                {
                    //standing VS megacorp
                    return(false);
                }
            }

            if (!mission.CheckPeriodicMissions(_periodicMissionTimes))
            {
                //mission was done within the period
                return(false);
            }

            if (!mission.CheckRequiredStandingsToOtherAlliances(_character))
            {
                //standing check failed
                return(false);
            }

            //a finished unique mission can't be listed any more
            if (mission.isUnique)
            {
                if (_finishedMissionIds.Contains(mission.id))
                {
                    return(false);
                }
            }

            //required mission check
            if (mission.RequiredMissions.Any(missionId => !_finishedMissionIds.Contains(missionId)))
            {
                return(false);
            }

            if (IsCollectorAvailable())
            {
                //currently this mission
                if (_collector.IsMissionCurrentlyRunning(mission.id))
                {
                    return(false);
                }

                //if the current mission is not triggered BUT starter of a chain of missions
                if (!mission.isTriggered)
                {
                    //get all members of the chain
                    var storyLineMissionMembers = _missionDataCache.GetCompleteMissionLine(mission.id);

                    //check if any of the chain members are running
                    if (storyLineMissionMembers.Count > 0)
                    {
                        if (_collector.AnyMissionFromTheListRunning(storyLineMissionMembers))
                        {
                            return(false);
                        }
                    }
                }
            }

            if (mission.RequiredExtensions.Any())
            {
                foreach (var requiredExtension in mission.RequiredExtensions)
                {
                    if (!_character.CheckLearnedExtension(requiredExtension))
                    {
                        return(false);
                    }
                }
            }

            if (!CheckTutorialMissions(mission))
            {
                return(false);
            }

            return(true);
        }