Beispiel #1
0
        /// <summary>
        /// The mission engine sent a progress update to the zone. This function handles it.
        /// </summary>
        /// <param name="missionProgressUpdate"></param>
        /// <returns></returns>
        public void MissionAdvanceGroupOrder(MissionProgressUpdate missionProgressUpdate)
        {
            Logger.DebugInfo("advancing mission target group on zone: " + missionProgressUpdate);

            if (missionProgressUpdate.isFinished)
            {
                _runningMissions.Remove(missionProgressUpdate.missionId);

                var targetsToRemove = GetTargetsByProgressUpdate(missionProgressUpdate);

                foreach (var cachedMissionTarget in targetsToRemove)
                {
                    _cachedMissionTargets.Remove(cachedMissionTarget.Id);
                }
                Logger.DebugInfo("mission got finished and removed! " + missionProgressUpdate);
            }
            else
            {
                Logger.DebugInfo("mission targetorder advancing" + missionProgressUpdate);

                if (_runningMissions.TryGetValue(missionProgressUpdate.missionId, out ZoneMissionInProgress mzp))
                {
                    mzp.SetCurrentTargetOrder(missionProgressUpdate);
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// The mission engine pushes a new mission
        /// </summary>
        /// <param name="missionProgressUpdate"></param>
        /// <returns></returns>
        public void MissionNew(MissionProgressUpdate missionProgressUpdate)
        {
            var missionZoneProgress = ZoneMissionInProgress.CreateFromProgressUpdate(_zone, missionProgressUpdate);

            _runningMissions[missionProgressUpdate.missionId] = missionZoneProgress;

            var targets = missionZoneProgress.LoadZoneTargets(_zone.PresenceManager, _player);

            foreach (var missionTarget in targets)
            {
                _cachedMissionTargets.Add(missionTarget.Id, missionTarget);
            }
        }
Beispiel #3
0
        private IList <IZoneMissionTarget> GetTargetsByProgressUpdate(MissionProgressUpdate missionProgressUpdate)
        {
            var list = new List <IZoneMissionTarget>();

            foreach (var cachedMissionTarget in _cachedMissionTargets.Values)
            {
                if (cachedMissionTarget.MyZoneMissionInProgress.missionId == missionProgressUpdate.missionId)
                {
                    list.Add(cachedMissionTarget);
                }
            }

            return(list);
        }