}                                                                       // SPECIAL USE ONLY - DOES NOT COMPUTE ALL THE OTHER STUFF

        #region Entry processing

        // Called on a New Entry, by EDDiscoveryController:NewEntry, to add an journal entry in.  May return null or empty list, or multiple entries.

        public List <HistoryEntry> AddJournalEntryToHistory(JournalEntry je, Action <string> logerror)
        {
            HistoryEntry he = HistoryEntry.FromJournalEntry(je, hlastprocessed);     // we may check edsm for this entry

            he.UpdateMaterialsCommodities(MaterialCommoditiesMicroResources.Process(je, hlastprocessed?.journalEntry, he.Status.TravelState == HistoryEntryStatus.TravelStateType.SRV));

            // IN THIS order, so suits can be added, then weapons, then loadouts
            he.UpdateSuits(SuitList.Process(je, he.WhereAmI, he.System));
            he.UpdateWeapons(WeaponList.Process(je, he.WhereAmI, he.System));
            he.UpdateLoadouts(SuitLoadoutList.Process(je, WeaponList, he.WhereAmI, he.System));

            // check here to see if we want to remove the entry.. can move this lower later, but at first point where we have the data

            he.UpdateStats(je, statisticsaccumulator, he.StationFaction);
            he.UpdateSystemNote();

            CashLedger.Process(je);
            he.Credits = CashLedger.CashTotal;

            Shipyards.Process(je);
            Outfitting.Process(je);

            Tuple <ShipInformation, ModulesInStore> ret = ShipInformationList.Process(je, he.WhereAmI, he.System);

            he.UpdateShipInformation(ret.Item1);
            he.UpdateShipStoredModules(ret.Item2);

            he.UpdateMissionList(MissionListAccumulator.Process(je, he.System, he.WhereAmI));

            hlastprocessed = he;

            var reorderlist = ReorderRemove(he);

            foreach (var heh in reorderlist.EmptyIfNull())
            {
                heh.Index = historylist.Count; // store its index
                historylist.Add(heh);          // then add to history
                AddToVisitsScan(logerror);     // add to scan database and complain if can't add. Do this after history add, so it has a list.
            }

            return(reorderlist);
        }
Example #2
0
        public List <Outfitting> GetFilteredList(bool nolocrepeats = false, int timeout = 60 * 5)           // latest first..
        {
            Outfitting        last  = null;
            List <Outfitting> yards = new List <Outfitting>();

            foreach (var yard in OutfittingYards.AsEnumerable().Reverse())                      // give it to me in lastest one first..
            {
                if (!nolocrepeats || yards.Find(x => x.Location.Equals(yard.Location)) == null) // allow yard repeats or not in list
                {
                    // if no last or different name or time is older..
                    if (last == null || !yard.Location.Equals(last.Location) || (last.Datetime - yard.Datetime).TotalSeconds >= timeout)
                    {
                        yards.Add(yard);
                        last = yard;
                        //System.Diagnostics.Debug.WriteLine("OF return " + yard.Ident(true) + " " + yard.Datetime.ToString());
                    }
                }
            }

            return(yards);
        }
        // Called on a New Entry, by EDDiscoveryController:NewEntry, to add an journal entry in.  May return null if don't want it in history

        public HistoryEntry AddJournalEntryToHistory(JournalEntry je, Action <string> logerror)
        {
            HistoryEntry hprev = GetLast;

            HistoryEntry he = HistoryEntry.FromJournalEntry(je, hprev);     // we may check edsm for this entry

            he.UpdateMaterialsCommodities(MaterialCommoditiesMicroResources.Process(je));

            if (CheckForRemoval(he, hprev))                                     // check here to see if we want to remove the entry.. can move this lower later, but at first point where we have the data
            {
                return(null);
            }

            he.UpdateStats(je, statisticsaccumulator, he.StationFaction);
            he.UpdateSystemNote();

            CashLedger.Process(je);
            he.Credits = CashLedger.CashTotal;

            Shipyards.Process(je);
            Outfitting.Process(je);

            Tuple <ShipInformation, ModulesInStore> ret = ShipInformationList.Process(je, he.WhereAmI, he.System);

            he.UpdateShipInformation(ret.Item1);
            he.UpdateShipStoredModules(ret.Item2);

            he.UpdateMissionList(MissionListAccumulator.Process(je, he.System, he.WhereAmI));

            he.UpdateWeapons(WeaponList.Process(je, he.WhereAmI, he.System));          // update the entries in suit entry list
            he.UpdateSuits(SuitList.Process(je, he.WhereAmI, he.System));
            he.UpdateLoadouts(SuitLoadoutList.Process(je, WeaponList, he.WhereAmI, he.System));

            historylist.Add(he);                                         // then add to history

            AddToVisitsScan(this, this.historylist.Count - 1, logerror); // add to scan database and complain if can't add. Do this after history add, so it has a list.

            return(he);
        }
Example #4
0
        // Called on a New Entry, by EDDiscoveryController:NewEntry, to add an journal entry in.  May return null if don't want it in history

        public HistoryEntry AddJournalEntryToHistory(JournalEntry je, Action <string> logerror)
        {
            HistoryEntry hprev = GetLast;

            HistoryEntry he = HistoryEntry.FromJournalEntry(je, hprev);     // we may check edsm for this entry

            he.UpdateMaterialsCommodities(je, hprev?.MaterialCommodity);    // let some processes which need the user db to work
            Debug.Assert(he.MaterialCommodity != null);

            if (CheckForRemoval(he, hprev))                                     // check here to see if we want to remove the entry.. can move this lower later, but at first point where we have the data
            {
                return(null);
            }

            he.UpdateStats(je, hprev?.Stats, he.StationFaction);
            he.UpdateSystemNote();

            CashLedger.Process(je);
            he.Credits = CashLedger.CashTotal;

            Shipyards.Process(je);
            Outfitting.Process(je);

            Tuple <ShipInformation, ModulesInStore> ret = ShipInformationList.Process(je, he.WhereAmI, he.System);

            he.UpdateShipInformation(ret.Item1);
            he.UpdateShipStoredModules(ret.Item2);

            he.UpdateMissionList(missionlistaccumulator.Process(je, he.System, he.WhereAmI));

            historylist.Add(he);                 // then add to history

            AddToVisitsScan(this, he, logerror); // add to scan database and complain if can't add. Do this after history add, so it has a list.

            return(he);
        }