Example #1
0
 public void Completed(JournalMissionCompleted m)
 {
     if (current.Missions.ContainsKey(MissionList.Key(m))) // make sure not repeating, ignore if so
     {
         current = new MissionList(current);               // shallow copy
         current.Completed(m);
     }
     else
     {
         System.Diagnostics.Debug.WriteLine("Missions: Unknown " + MissionList.Key(m));
     }
 }
Example #2
0
 public void Accepted(JournalMissionAccepted m, ISystem sys, string body)
 {
     if (!current.Missions.ContainsKey(MissionList.Key(m))) // make sure not repeating, ignore if so
     {
         current = new MissionList(current);                // shallow copy
         current.Add(m, sys, body);
     }
     else
     {
         System.Diagnostics.Debug.WriteLine("Missions: Duplicate " + MissionList.Key(m));
     }
 }
Example #3
0
 public void Redirected(JournalMissionRedirected m)
 {
     if (missionlist.Missions.ContainsKey(MissionList.Key(m))) // make sure not repeating, ignore if so
     {
         missionlist = new MissionList(missionlist);           // shallow copy
         missionlist.Redirected(m);
     }
     else
     {
         System.Diagnostics.Debug.WriteLine("Missions: Unknown " + MissionList.Key(m));
     }
 }
 public void Failed(JournalMissionFailed m)
 {
     if (missionlist.Missions.ContainsKey(MissionList.Key(m))) // make sure not repeating, ignore if so
     {
         missionlist = new MissionList(missionlist);           // shallow copy
         missionlist.Failed(m);
         // System.Diagnostics.Debug.WriteLine(m.EventTimeUTC.ToStringZulu() + " Missions Failed " + MissionList.Key(m));
     }
     else
     {
         System.Diagnostics.Debug.WriteLine("Missions: Unknown " + MissionList.Key(m));
     }
 }
 public void Accepted(JournalMissionAccepted m, ISystem sys, string body)
 {
     if (!missionlist.Missions.ContainsKey(MissionList.Key(m))) // make sure not repeating, ignore if so
     {
         missionlist = new MissionList(missionlist);            // shallow copy
         missionlist.Accepted(m, sys, body);
         //  System.Diagnostics.Debug.WriteLine(m.EventTimeUTC.ToStringZulu() + " Missions Accepted " + MissionList.Key(m));
     }
     else
     {
         System.Diagnostics.Debug.WriteLine("Missions: Duplicate " + MissionList.Key(m));
     }
 }
        public void Missions(JournalMissions m)
        {
            List <string>    toresurrect = new List <string>();
            HashSet <string> active      = new HashSet <string>();
            List <string>    failed      = new List <string>();
            List <string>    completed   = new List <string>();
            List <string>    disappeared = new List <string>();

            foreach (var mi in m.ActiveMissions)
            {
                string kn = MissionList.Key(mi.MissionID, mi.Name);
                active.Add(kn);
                //System.Diagnostics.Debug.WriteLine(m.EventTimeUTC.ToStringZulu() + " Mission " + kn + " is active");

                if (missionlist.Missions.ContainsKey(kn))
                {
                    MissionState ms = missionlist.Missions[kn];

                    if (ms.State == MissionState.StateTypes.Died)   // if marked died...
                    {
                        System.Diagnostics.Debug.WriteLine("Missions in active list but marked died" + kn);
                        toresurrect.Add(kn);
                    }
                }
            }

            foreach (var mi in m.FailedMissions)
            {
                string kn = MissionList.Key(mi.MissionID, mi.Name);
                failed.Add(kn);
            }

            foreach (var mi in m.CompletedMissions)
            {
                string kn = MissionList.Key(mi.MissionID, mi.Name);
                completed.Add(kn);
            }

            foreach (var kvp in missionlist.Missions)
            {
                if (!active.Contains(kvp.Key) && !failed.Contains(kvp.Key) && !completed.Contains(kvp.Key) && kvp.Value.State == MissionState.StateTypes.InProgress)
                {
                    System.Diagnostics.Debug.WriteLine(m.EventTimeUTC.ToStringZulu() + " Mission " + kvp.Value.Mission.EventTimeUTC.ToStringZulu() + " " + kvp.Key + " disappeared ****");
                    disappeared.Add(kvp.Key);
                }
            }

            if (toresurrect.Count > 0)                      // if any..
            {
                missionlist = new MissionList(missionlist); // shallow copy
                missionlist.Resurrect(toresurrect);
            }

            if (disappeared.Count > 0)
            {
                missionlist = new MissionList(missionlist);
                missionlist.Disappeared(disappeared, m.EventTimeUTC);
            }

            if (failed.Count > 0)
            {
                missionlist = new MissionList(missionlist);
                missionlist.ChangeStateIfInProgress(failed, MissionState.StateTypes.Failed, m.EventTimeUTC);
            }

            if (completed.Count > 0)
            {
                missionlist = new MissionList(missionlist);
                missionlist.ChangeStateIfInProgress(failed, MissionState.StateTypes.Completed, m.EventTimeUTC);
            }
        }