}                                                                                // entry may be overridden to dynamically change icon event for an event

        #endregion

        #region Constructors

        protected JournalEntry(DateTime utc, JournalTypeEnum jtype, bool edsmsynced)       // manual creation via NEW
        {
            EventTypeID  = jtype;
            EventTimeUTC = utc;
            Synced       = edsmsynced ? (int)SyncFlags.EDSM : 0;
            TLUId        = 0;
        }
Beispiel #2
0
        }                                                                                   // entries may override if required

        #endregion

        #region Creation

        public JournalEntry(DateTime utc, int synced, JournalTypeEnum jtype)        // manual creation via NEW
        {
            EventTypeID  = jtype;
            EventTimeUTC = utc;
            Synced       = synced;
            TLUId        = 0;
        }
        static public JournalEntry CreateJournalEntry(JObject jo)
        {
            string Eventstr = jo["event"].StrNull();

            JournalEntry ret = null;

            if (Eventstr == null)             // Should normaly not happend unless corrupt string.
            {
                ret = new JournalUnknown(jo); // MUST return something
            }
            else
            {
                JournalTypeEnum jte   = JournalTypeEnum.Unknown;
                Type            jtype = Enum.TryParse(Eventstr, out jte) ? TypeOfJournalEntry(jte) : TypeOfJournalEntry(Eventstr);

                if (jtype == null)
                {
                    ret = new JournalUnknown(jo);
                }
                else
                {
                    ret = (JournalEntry)Activator.CreateInstance(jtype, jo);
                }
            }

            return(ret);
        }
Beispiel #4
0
 public JournalEntry(JObject jo, JournalTypeEnum jtype)
 {
     EventTypeID  = jtype;
     EventTypeStr = jtype.ToString();
     EventTimeUTC = DateTime.Parse(jo.Value <string>("timestamp"), CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal | DateTimeStyles.AdjustToUniversal);
     TLUId        = 0;
 }
Beispiel #5
0
        public static List <JournalEntry> GetByEventType(JournalTypeEnum eventtype, int commanderid, DateTime start, DateTime stop)
        {
            Dictionary <long, TravelLogUnit> tlus = TravelLogUnit.GetAll().ToDictionary(t => t.id);

            List <JournalEntry> vsc = new List <JournalEntry>();

            using (SQLiteConnectionUser cn = new SQLiteConnectionUser(utc: true))
            {
                using (DbCommand cmd = cn.CreateCommand("SELECT * FROM JournalEntries WHERE EventTypeID = @eventtype and  CommanderID=@commander and  EventTime >=@start and EventTime<=@Stop ORDER BY EventTime ASC"))
                {
                    cmd.AddParameterWithValue("@eventtype", (int)eventtype);
                    cmd.AddParameterWithValue("@commander", (int)commanderid);
                    cmd.AddParameterWithValue("@start", start);
                    cmd.AddParameterWithValue("@stop", stop);
                    using (DbDataReader reader = cmd.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            JournalEntry je = CreateJournalEntry(reader);
                            je.beta = tlus.ContainsKey(je.TLUId) ? tlus[je.TLUId].Beta : false;
                            vsc.Add(je);
                        }
                    }
                }
            }
            return(vsc);
        }
        protected JournalLocOrJump(JObject evt, JournalTypeEnum jtype) : base(evt, jtype)
        {
            StarSystem        = evt["StarSystem"].Str();
            StarPosFromEDSM   = evt["StarPosFromEDSM"].Bool(false);
            EDSMFirstDiscover = evt["EDD_EDSMFirstDiscover"].Bool(false);

            EMK.LightGeometry.Vector3 pos = new EMK.LightGeometry.Vector3();

            if (!evt["StarPos"].Empty())            // if its an old VS entry, may not have co-ords
            {
                JArray coords = evt["StarPos"] as JArray;
                pos.X = coords[0].Value <float>();
                pos.Y = coords[1].Value <float>();
                pos.Z = coords[2].Value <float>();
            }
            else
            {
                pos.X = pos.Y = pos.Z = float.NaN;
            }

            StarPos = pos;

            SystemAddress = evt["SystemAddress"].LongNull();

            Faction      = JSONObjectExtensions.GetMultiStringDef(evt, new string[] { "SystemFaction", "Faction" });
            FactionState = evt["FactionState"].Str();                                                                          // PRE 2.3 .. not present in newer files, fixed up in next bit of code
            Factions     = evt["Factions"]?.ToObject <FactionInformation[]>()?.OrderByDescending(x => x.Influence)?.ToArray(); // POST 2.3

            if (Factions != null)
            {
                int i = Array.FindIndex(Factions, x => x.Name == Faction);
                if (i != -1)
                {
                    FactionState = Factions[i].FactionState;        // set to State of controlling faction
                }
            }

            Allegiance           = JSONObjectExtensions.GetMultiStringDef(evt, new string[] { "SystemAllegiance", "Allegiance" });
            Economy              = JSONObjectExtensions.GetMultiStringDef(evt, new string[] { "SystemEconomy", "Economy" });
            Economy_Localised    = JSONObjectExtensions.GetMultiStringDef(evt, new string[] { "SystemEconomy_Localised", "Economy_Localised" });
            Government           = JSONObjectExtensions.GetMultiStringDef(evt, new string[] { "SystemGovernment", "Government" });
            Government_Localised = JSONObjectExtensions.GetMultiStringDef(evt, new string[] { "SystemGovernment_Localised", "Government_Localised" });
            Security             = JSONObjectExtensions.GetMultiStringDef(evt, new string[] { "SystemSecurity", "Security" });
            Security_Localised   = JSONObjectExtensions.GetMultiStringDef(evt, new string[] { "SystemSecurity_Localised", "Security_Localised" });

            Wanted = evt["Wanted"].BoolNull();

            PowerplayState = evt["PowerplayState"].Str();            // NO evidence
            if (!evt["Powers"].Empty())
            {
                Powers = evt.Value <JArray>("Powers").Values <string>().ToArray();
            }

            // Allegiance without Faction only occurs in Training
            if (!String.IsNullOrEmpty(Allegiance) && Faction == null)
            {
                IsTrainingEvent = true;
            }
        }
Beispiel #7
0
 public JournalEntry(JournalTypeEnum jtype)
 {
     jEventData   = null;
     EventTypeID  = jtype;
     EventTypeStr = jtype.ToString();
     EventTimeUTC = DateTime.UtcNow;
     TLUId        = 0;
 }
Beispiel #8
0
 public JournalCommodityPricesBase(System.DateTime utc, JournalTypeEnum type, long?marketid, string station, string starsystem, int cmdrid)
     : base(utc, type, false)
 {
     MarketID    = marketid;
     Station     = station;
     StarSystem  = starsystem;
     Commodities = new List <CCommodities>(); // always made..
     SetCommander(cmdrid);
 }
Beispiel #9
0
 static public Type TypeOfJournalEntry(JournalTypeEnum type)
 {
     if (JournalEntryTypes.ContainsKey(type))
     {
         return(JournalEntryTypes[type]);
     }
     else
     {
         return(TypeOfJournalEntry(type.ToString()));
     }
 }
 static public bool IsEDDNMessage(JournalTypeEnum EntryType)
 {
     return(EntryType == JournalTypeEnum.Scan ||
            EntryType == JournalTypeEnum.Docked ||
            EntryType == JournalTypeEnum.FSDJump || EntryType == JournalTypeEnum.CarrierJump || EntryType == JournalTypeEnum.Location ||
            EntryType == JournalTypeEnum.Market ||
            EntryType == JournalTypeEnum.Shipyard ||
            EntryType == JournalTypeEnum.SAASignalsFound ||
            EntryType == JournalTypeEnum.EDDCommodityPrices ||
            EntryType == JournalTypeEnum.Outfitting);
 }
Beispiel #11
0
        public static List <JournalEntry> GetByEventType(JournalTypeEnum eventtype, int commanderid, DateTime startutc, DateTime stoputc)
        {
            Dictionary <long, TravelLogUnit> tlus = TravelLogUnit.GetAll().ToDictionary(t => t.id);
            DbCommand           cmd     = null;
            DbDataReader        reader  = null;
            List <JournalEntry> entries = new List <JournalEntry>();

            try
            {
                cmd    = UserDatabase.Instance.ExecuteWithDatabase(cn => cn.Connection.CreateCommand("SELECT * FROM JournalEntries WHERE EventTypeID = @eventtype and  CommanderID=@commander and  EventTime >=@start and EventTime<=@Stop ORDER BY EventTime ASC"));
                reader = UserDatabase.Instance.ExecuteWithDatabase(cn =>
                {
                    cmd.AddParameterWithValue("@eventtype", (int)eventtype);
                    cmd.AddParameterWithValue("@commander", (int)commanderid);
                    cmd.AddParameterWithValue("@start", startutc);
                    cmd.AddParameterWithValue("@stop", stoputc);
                    return(cmd.ExecuteReader());
                });

                List <JournalEntry> retlist = null;

                do
                {
                    retlist = UserDatabase.Instance.ExecuteWithDatabase(cn =>
                    {
                        List <JournalEntry> vsc = new List <JournalEntry>();

                        while (vsc.Count < 1000 && reader.Read())
                        {
                            JournalEntry je = CreateJournalEntry(reader);
                            je.beta         = tlus.ContainsKey(je.TLUId) ? tlus[je.TLUId].Beta : false;
                            vsc.Add(je);
                        }

                        return(vsc);
                    });

                    entries.AddRange(retlist);
                }while (retlist != null && retlist.Count != 0);

                return(entries);
            }
            finally
            {
                if (reader != null || cmd != null)
                {
                    UserDatabase.Instance.ExecuteWithDatabase(cn =>
                    {
                        reader?.Close();
                        cmd?.Dispose();
                    });
                }
            }
        }
Beispiel #12
0
 protected JournalEntry(JObject jo, JournalTypeEnum jtype)              // called by journal entries to create themselves
 {
     EventTypeID = jtype;
     if (DateTime.TryParse(jo["timestamp"].Str(), CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal | DateTimeStyles.AdjustToUniversal, out DateTime etime))
     {
         EventTimeUTC = etime;
     }
     else
     {
         EventTimeUTC = DateTime.MinValue;
     }
     TLUId = 0;
 }
        static public bool IsDelayableEDDNMessage(JournalTypeEnum EntryType, DateTime EventTimeUTC)
        {
            DateTime ed22 = new DateTime(2016, 10, 25, 12, 0, 0);

            if ((EntryType == JournalTypeEnum.Scan ||
                 EntryType == JournalTypeEnum.SAASignalsFound) && EventTimeUTC > ed22)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #14
0
        static public bool IsEDDNMessage(JournalTypeEnum EntryType, DateTime EventTimeUTC)
        {
            DateTime ed22 = new DateTime(2016, 10, 25, 12, 0, 0);

            if ((EntryType == JournalTypeEnum.Scan ||
                 EntryType == JournalTypeEnum.Docked ||
                 EntryType == JournalTypeEnum.FSDJump ||
                 EntryType == JournalTypeEnum.Location ||
                 EntryType == JournalTypeEnum.Market ||
                 EntryType == JournalTypeEnum.Shipyard ||
                 EntryType == JournalTypeEnum.Outfitting) && EventTimeUTC > ed22)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #15
0
        int cargoleftdisplay   = 0;                         // used to track what we wrote for cargo

        private void Display(HistoryEntry he)               // at he, see if changed
        {
            if (he != null)
            {
                JournalTypeEnum[] boundevents = new JournalTypeEnum[] { JournalTypeEnum.Docked, JournalTypeEnum.Undocked, JournalTypeEnum.FSDJump, JournalTypeEnum.CarrierJump,
                                                                        JournalTypeEnum.Touchdown, JournalTypeEnum.Liftoff };
                JournalTypeEnum[] miningevents = new JournalTypeEnum[] { JournalTypeEnum.AsteroidCracked, JournalTypeEnum.ProspectedAsteroid, JournalTypeEnum.LaunchDrone,
                                                                         JournalTypeEnum.MiningRefined, JournalTypeEnum.MaterialCollected, JournalTypeEnum.MaterialDiscovered, JournalTypeEnum.MaterialDiscarded };

                var newlist = HistoryList.FilterBetween(discoveryform.history.EntryOrder(), he, x => boundevents.Contains(x.EntryType), y => miningevents.Contains(y.EntryType), out HistoryEntry newhebelow, out HistoryEntry newheabove);

                if (newlist != null)        // only if no history would we get null, unlikely since he has been tested, but still..
                {
                    int limpetsleft = discoveryform.history.MaterialCommoditiesMicroResources.Get(newheabove.MaterialCommodity, "drones")?.Count ?? 0;
                    int cargo       = discoveryform.history.MaterialCommoditiesMicroResources.CargoCount(newheabove.MaterialCommodity);
                    int cargocap    = newheabove.ShipInformation?.CargoCapacity() ?? 0;// so if we don't have a ShipInformation, use 0
                    int cargoleft   = cargocap - cargo;

                    // if no list, or diff no of items (due to new entry) or different start point, we reset and display, else we just quit as current is good
                    if (curlist == null || newlist.Count != curlist.Count || hebelow != newhebelow || limpetsleft != limpetsleftdisplay || cargoleft != cargoleftdisplay)
                    {
                        curlist            = newlist;
                        heabove            = newheabove;
                        hebelow            = newhebelow;
                        limpetsleftdisplay = limpetsleft;
                        cargoleftdisplay   = cargoleft;
                        incurrentplay      = heabove == discoveryform.history.GetLast && !boundevents.Contains(heabove.EntryType);
                        System.Diagnostics.Debug.WriteLine("Redisplay {0} current {1}", heabove.EntryNumber, incurrentplay);
                        Display();
                    }

                    return;
                }
            }

            if (curlist != null)        // moved outside to no data..
            {
                curlist = null;         // fall thru means no data, clear and display
                heabove = hebelow = null;
                Display();
            }
        }
Beispiel #16
0
        public void AddEventCash(long jidn, DateTime t, JournalTypeEnum j, string n, long ca, double ppu = 0)
        {
            long newcashtotal = CashTotal + ca;

            //System.Diagnostics.Debug.WriteLine("{0} {1} {2} {3} = {4}", j.ToString(), n, CashTotal, ca , newcashtotal);
            CashTotal = newcashtotal;

            Transaction tr = new Transaction
            {
                jid           = jidn,
                utctime       = t,
                jtype         = j,
                notes         = n,
                cashadjust    = ca,
                cash          = CashTotal,
                profitperunit = ppu
            };

            transactions.Add(tr);
        }
Beispiel #17
0
        protected JournalLocOrJump(JObject jo, JournalTypeEnum jtype) : base(jo, jtype)
        {
            StarSystem      = JSONHelper.GetStringDef(jo["StarSystem"], "Unknown!");
            StarPosFromEDSM = JSONHelper.GetBool(jo["StarPosFromEDSM"], false);

            Vector3 pos = new Vector3();

            if (!JSONHelper.IsNullOrEmptyT(jo["StarPos"]))            // if its an old VS entry, may not have co-ords
            {
                JArray coords = jo["StarPos"] as JArray;
                pos.X = coords[0].Value <float>();
                pos.Y = coords[1].Value <float>();
                pos.Z = coords[2].Value <float>();
            }
            else
            {
                pos.X = pos.Y = pos.Z = float.NaN;
            }

            StarPos = pos;
        }
Beispiel #18
0
        static public JournalEntry CreateJournalEntry(JObject jo)
        {
            string Eventstr = jo["event"].StrNull();

            if (Eventstr == null)               // Should normaly not happend unless corrupt string.
            {
                return(new JournalUnknown(jo)); // MUST return something
            }
            JournalTypeEnum jte   = JournalTypeEnum.Unknown;
            Type            jtype = Enum.TryParse(Eventstr, out jte) ? TypeOfJournalEntry(jte) : TypeOfJournalEntry(Eventstr);

            if (jtype == null)
            {
                System.Diagnostics.Trace.WriteLine("Unknown event: " + Eventstr);
                return(new JournalUnknown(jo));
            }
            else
            {
                return((JournalEntry)Activator.CreateInstance(jtype, jo));
            }
        }
Beispiel #19
0
        protected JournalLocOrJump(JObject jo, JournalTypeEnum jtype )
            : base(jo, jtype)
        {
            StarSystem = Tools.GetStringDef(jo["StarSystem"],"Unknown!");

            Vector3 pos = new Vector3();

            if (!Tools.IsNullOrEmptyT(jo["StarPos"]))            // if its an old VS entry, may not have co-ords
            {
                JArray coords = jo["StarPos"] as JArray;
                pos.X = coords[0].Value<float>();
                pos.Y = coords[1].Value<float>();
                pos.Z = coords[2].Value<float>();
            }
            else
            {
                pos.X = pos.Y = pos.Z = float.NaN;
            }

            StarPos = pos;
        }
Beispiel #20
0
        protected JournalLocOrJump(JObject jo, JournalTypeEnum jtype) : base(jo, jtype)
        {
            StarSystem        = jo["StarSystem"].Str();
            StarPosFromEDSM   = jo["StarPosFromEDSM"].Bool(false);
            EDSMFirstDiscover = jo["EDD_EDSMFirstDiscover"].Bool(false);

            EMK.LightGeometry.Vector3 pos = new EMK.LightGeometry.Vector3();

            if (!jo["StarPos"].Empty())            // if its an old VS entry, may not have co-ords
            {
                JArray coords = jo["StarPos"] as JArray;
                pos.X = coords[0].Value <float>();
                pos.Y = coords[1].Value <float>();
                pos.Z = coords[2].Value <float>();
            }
            else
            {
                pos.X = pos.Y = pos.Z = float.NaN;
            }

            StarPos = pos;
        }
        public JournalEngineerCraftBase(JObject evt, JournalTypeEnum en) : base(evt, en)
        {
            SlotFD = JournalFieldNaming.NormaliseFDSlotName(evt["Slot"].Str());
            Slot   = JournalFieldNaming.GetBetterSlotName(SlotFD);

            ModuleFD = JournalFieldNaming.NormaliseFDItemName(evt["Module"].Str());
            Module   = JournalFieldNaming.GetBetterItemName(ModuleFD);

            Engineering = new ShipModule.EngineeringData(evt);

            IsPreview = evt["IsPreview"].BoolNull();
            JToken mats = (JToken)evt["Ingredients"];

            if (mats != null)
            {
                Ingredients = new Dictionary <string, int>();

                if (mats.Type == JTokenType.Object)
                {
                    Dictionary <string, int> temp = mats?.ToObjectProtected <Dictionary <string, int> >();

                    if (temp != null)
                    {
                        foreach (string key in temp.Keys)
                        {
                            Ingredients[JournalFieldNaming.FDNameTranslation(key)] = temp[key];
                        }
                    }
                }
                else
                {
                    foreach (JObject jo in (JArray)mats)
                    {
                        Ingredients[JournalFieldNaming.FDNameTranslation((string)jo["Name"])] = jo["Count"].Int();
                    }
                }
            }
        }
Beispiel #22
0
        public static List <JournalEntry> GetByEventType(JournalTypeEnum eventtype, int commanderid, DateTime start, DateTime stop)
        {
            List <JournalEntry> vsc = new List <JournalEntry>();

            using (SQLiteConnectionUser cn = new SQLiteConnectionUser(utc: true))
            {
                using (DbCommand cmd = cn.CreateCommand("SELECT * FROM JournalEntries WHERE EventTypeID = @eventtype and  CommanderID=@commander and  EventTime >=@start and EventTime<=@Stop ORDER BY EventTime ASC"))
                {
                    cmd.AddParameterWithValue("@eventtype", (int)eventtype);
                    cmd.AddParameterWithValue("@commander", (int)commanderid);
                    cmd.AddParameterWithValue("@start", start);
                    cmd.AddParameterWithValue("@stop", stop);
                    using (DbDataReader reader = cmd.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            vsc.Add(JournalEntry.CreateJournalEntry(reader));
                        }
                    }
                }
            }
            return(vsc);
        }
 protected JournalLocOrJump(DateTime utc, ISystem sys, JournalTypeEnum jtype, bool edsmsynced) : base(utc, jtype, edsmsynced)
 {
     StarSystem = sys.Name;
     StarPos    = new EMK.LightGeometry.Vector3((float)sys.X, (float)sys.Y, (float)sys.Z);
     EdsmID     = sys.EDSMID;
 }
Beispiel #24
0
 public JournalCommodityPricesBase(JObject evt, JournalTypeEnum en) : base(evt, en)
 {
 }
Beispiel #25
0
 public JournalSquadronRankBase(JObject evt, JournalTypeEnum e) : base(evt, e)
 {
     OldRank = (SquadronRank)evt["OldRank"].Int();
     NewRank = (SquadronRank)evt["NewRank"].Int();
 }
Beispiel #26
0
 public JournalSquadronBase(JObject evt, JournalTypeEnum e) : base(evt, e)
 {
     Name = evt["SquadronName"].Str();
 }
Beispiel #27
0
 public JournalEntry(JObject jo, JournalTypeEnum jtype)
 {
     jEventData = jo;
     eventType = jtype;
 }
Beispiel #28
0
 static public Tuple <string, string, Image> GetNameImageOfEvent(JournalTypeEnum ev)
 {
     return(new Tuple <string, string, Image>(ev.ToString(), TranslatedEventNames[ev],
                                              JournalTypeIcons.ContainsKey(ev) ? JournalTypeIcons[ev] : JournalTypeIcons[JournalTypeEnum.Unknown]));
 }
Beispiel #29
0
 public JournalMicroResourceState(JObject evt, JournalTypeEnum en) : base(evt, en)
 {
     Rescan(evt);
 }
Beispiel #30
0
 public void AddEventNoCash(long jidn, DateTime t, JournalTypeEnum j, string n)
 {
     AddEventCash(jidn, t, j, n, 0, 0);
 }
Beispiel #31
0
 public void AddEvent(long jidn, DateTime t, JournalTypeEnum j, string n, long?ca, double ppu = 0)
 {
     AddEventCash(jidn, t, j, n, ca.HasValue ? ca.Value : 0, ppu);
 }
        protected JournalLocOrJump(JObject evt, JournalTypeEnum jtype) : base(evt, jtype)
        {
            StarSystem      = evt["StarSystem"].Str();
            StarPosFromEDSM = evt["StarPosFromEDSM"].Bool(false);

            EMK.LightGeometry.Vector3 pos = new EMK.LightGeometry.Vector3();

            if (!evt["StarPos"].Empty())            // if its an old VS entry, may not have co-ords
            {
                JArray coords = evt["StarPos"] as JArray;
                pos.X = coords[0].Float();
                pos.Y = coords[1].Float();
                pos.Z = coords[2].Float();
            }
            else
            {
                pos.X = pos.Y = pos.Z = float.NaN;
            }

            StarPos = pos;

            SystemAddress = evt["SystemAddress"].LongNull();

            JToken jk = (JToken)evt["SystemFaction"];

            if (jk != null && jk.Type == JTokenType.Object)     // new 3.03
            {
                JObject jo = jk as JObject;
                Faction      = jk["Name"].Str();           // system faction pick up
                FactionState = jk["FactionState"].Str();
            }
            else
            {
                // old pre 3.3.3 had this - for system faction
                Faction      = JSONObjectExtensions.GetMultiStringDef(evt, new string[] { "SystemFaction", "Faction" });
                FactionState = evt["FactionState"].Str();           // PRE 2.3 .. not present in newer files, fixed up in next bit of code (but see 3.3.2 as its been incorrectly reintroduced)
            }

            Factions = evt["Factions"]?.ToObjectProtected <FactionInformation[]>()?.OrderByDescending(x => x.Influence)?.ToArray();  // POST 2.3

            if (Factions != null)
            {
                int i = Array.FindIndex(Factions, x => x.Name == Faction);
                if (i != -1)
                {
                    FactionState = Factions[i].FactionState; // set to State of controlling faction
                }
                foreach (var x in Factions)                  // normalise localised
                {
                    x.Happiness_Localised = JournalFieldNaming.CheckLocalisation(x.Happiness_Localised, x.Happiness);
                }
            }

            Allegiance = JSONObjectExtensions.GetMultiStringDef(evt, new string[] { "SystemAllegiance", "Allegiance" });

            Economy           = JSONObjectExtensions.GetMultiStringDef(evt, new string[] { "SystemEconomy", "Economy" });
            Economy_Localised = JournalFieldNaming.CheckLocalisation(JSONObjectExtensions.GetMultiStringDef(evt, new string[] { "SystemEconomy_Localised", "Economy_Localised" }), Economy);

            SecondEconomy           = evt["SystemSecondEconomy"].Str();
            SecondEconomy_Localised = JournalFieldNaming.CheckLocalisation(evt["SystemSecondEconomy_Localised"].Str(), SecondEconomy);

            Government           = JSONObjectExtensions.GetMultiStringDef(evt, new string[] { "SystemGovernment", "Government" });
            Government_Localised = JournalFieldNaming.CheckLocalisation(JSONObjectExtensions.GetMultiStringDef(evt, new string[] { "SystemGovernment_Localised", "Government_Localised" }), Government);

            Security           = JSONObjectExtensions.GetMultiStringDef(evt, new string[] { "SystemSecurity", "Security" });
            Security_Localised = JournalFieldNaming.CheckLocalisation(JSONObjectExtensions.GetMultiStringDef(evt, new string[] { "SystemSecurity_Localised", "Security_Localised" }), Security);

            Wanted = evt["Wanted"].Bool();                 // if absence, your not wanted, by definition of frontier in journal (only present if wanted, see docked)

            PowerplayState  = evt["PowerplayState"].Str(); // NO evidence
            PowerplayPowers = evt["Powers"]?.ToObjectProtected <string[]>();

            Conflicts = evt["Conflicts"]?.ToObjectProtected <ConflictInfo[]>();   // 3.4

            // Allegiance without Faction only occurs in Training
            if (!String.IsNullOrEmpty(Allegiance) && Faction == null && EventTimeUTC <= ED_No_Training_Timestamp && (EventTimeUTC <= ED_No_Faction_Timestamp || EventTypeID != JournalTypeEnum.FSDJump || StarSystem == "Eranin"))
            {
                IsTrainingEvent = true;
            }
        }