Example #1
0
            private void CheckRibbonForVessel(Ribbon ribbon, VesselState previous, VesselState current, EventReport report, bool hasToBeFirst)
            {
                if (Log.IsLogable(Log.LEVEL.TRACE))
                {
                    Log.Trace("checking ribbon " + ribbon.GetName());
                }
                Achievement achievement = ribbon.GetAchievement();

                if (achievement.HasToBeFirst() == hasToBeFirst)
                {
                    Vessel vessel = current.Origin;
                    // check situation changes
                    if (Log.IsLogable(Log.LEVEL.TRACE))
                    {
                        Log.Trace("checking change in situation");
                    }
                    if (achievement.Check(previous, current))
                    {
                        recorder.Record(ribbon, vessel);
                    }
                    // check events
                    if (Log.IsLogable(Log.LEVEL.TRACE))
                    {
                        Log.Trace("checking report");
                    }
                    if (report != null && achievement.Check(report))
                    {
                        recorder.Record(ribbon, vessel);
                    }
                }
            }
Example #2
0
 private void CheckAchievementsForVessel(VesselState previous, VesselState current, EventReport report,
                                         bool hasToBeFirst)
 {
     if (current != null)
     {
         foreach (Ribbon ribbon in RibbonPool.Instance())
         {
             Achievement achievement = ribbon.GetAchievement();
             if (achievement.HasToBeFirst() == hasToBeFirst)
             {
                 Vessel vessel = current.Origin;
                 // check situationchanges
                 if (achievement.Check(previous, current))
                 {
                     recorder.Record(ribbon, vessel);
                 }
                 // check events
                 if (report != null && achievement.Check(report))
                 {
                     recorder.Record(ribbon, vessel);
                 }
             }
         }
     }
     else
     {
         Log.Warning("no current vessel state; achievemnts not checked");
     }
 }