public JournalLocation(JObject evt) : base(evt, JournalTypeEnum.Location)      // all have evidence 16/3/2017
        {
            Docked      = evt.Value <bool?>("Docked") ?? false;
            StationName = evt["StationName"].Str();
            StationType = evt["StationType"].Str();
            Body        = evt["Body"].Str();
            BodyType    = evt["BodyType"].Str();
            Faction     = JSONObjectExtensions.GetMultiStringDef(evt, new string[] { "SystemFaction", "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" });

            Latitude  = evt["Latitude"].DoubleNull();
            Longitude = evt["Longitude"].DoubleNull();

            Factions = evt["Factions"]?.ToObject <FactionInfo[]>();

            PowerplayState = evt["PowerplayState"].Str();            // NO evidence
            if (!evt["Powers"].Empty())
            {
                Powers = evt.Value <JArray>("Powers").Values <string>().ToArray();
            }
        }
        public JournalDocked(JObject evt) : base(evt, JournalTypeEnum.Docked)
        {
            StationName   = evt["StationName"].Str();
            StationType   = evt["StationType"].Str().SplitCapsWord();
            StarSystem    = evt["StarSystem"].Str();
            SystemAddress = evt["SystemAddress"].LongNull();
            MarketID      = evt["MarketID"].LongNull();
            CockpitBreach = evt["CockpitBreach"].Bool();

            Faction      = JSONObjectExtensions.GetMultiStringDef(evt, new string[] { "StationFaction", "Faction" });
            FactionState = evt["FactionState"].Str().SplitCapsWord();

            Allegiance           = JSONObjectExtensions.GetMultiStringDef(evt, new string[] { "StationAllegiance", "Allegiance" });
            Economy              = JSONObjectExtensions.GetMultiStringDef(evt, new string[] { "StationEconomy", "Economy" });
            Economy_Localised    = JSONObjectExtensions.GetMultiStringDef(evt, new string[] { "StationEconomy_Localised", "Economy_Localised" });
            Government           = JSONObjectExtensions.GetMultiStringDef(evt, new string[] { "StationGovernment", "Government" });
            Government_Localised = JSONObjectExtensions.GetMultiStringDef(evt, new string[] { "StationGovernment_Localised", "Government_Localised" });

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

            StationServices = evt["StationServices"]?.ToObjectProtected <string[]>();

            // Government = None only happens in Training
            if (Government == "$government_None;")
            {
                IsTrainingEvent = true;
            }
        }
Exemple #3
0
        public JournalDocked(JObject evt) : base(evt, JournalTypeEnum.Docked)
        {
            StationName   = evt["StationName"].Str();
            StationType   = evt["StationType"].Str().SplitCapsWord();
            StarSystem    = evt["StarSystem"].Str();
            CockpitBreach = evt["CockpitBreach"].Bool();

            Faction      = JSONObjectExtensions.GetMultiStringDef(evt, new string[] { "StationFaction", "Faction" });
            FactionState = evt["FactionState"].Str().SplitCapsWord();

            Allegiance           = JSONObjectExtensions.GetMultiStringDef(evt, new string[] { "StationAllegiance", "Allegiance" });
            Economy              = JSONObjectExtensions.GetMultiStringDef(evt, new string[] { "StationEconomy", "Economy" });
            Economy_Localised    = JSONObjectExtensions.GetMultiStringDef(evt, new string[] { "StationEconomy_Localised", "Economy_Localised" });
            Government           = JSONObjectExtensions.GetMultiStringDef(evt, new string[] { "StationGovernment", "Government" });
            Government_Localised = JSONObjectExtensions.GetMultiStringDef(evt, new string[] { "StationGovernment_Localised", "Government_Localised" });

            if (!evt["StationServices"].Empty())
            {
                StationServices = evt.Value <JArray>("StationServices").Values <string>().ToList();
            }

            // Government = None only happens in Training
            if (Government == "$government_None;")
            {
                IsTrainingEvent = true;
            }
        }
        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;
            }
        }
            }                                                           // may be null

            public EngineeringData(JObject evt)
            {
                Engineer              = evt["Engineer"].Str();
                EngineerID            = evt["EngineerID"].Long();
                BlueprintName         = evt["BlueprintName"].Str();
                FriendlyBlueprintName = BlueprintName.SplitCapsWordFull();
                BlueprintID           = evt["BlueprintID"].Long();
                Level   = evt["Level"].Int();
                Quality = evt["Quality"].Double(0);
                // EngineerCraft has it as Apply.. Loadout has just ExperimentalEffect.  Check both
                ExperimentalEffect = JSONObjectExtensions.GetMultiStringDef(evt, new string[] { "ExperimentalEffect", "ApplyExperimentalEffect" });

                Modifiers = evt["Modifiers"]?.ToObject <EngineeringModifiers[]>();
            }
Exemple #6
0
        public JournalDocked(JObject evt) : base(evt, JournalTypeEnum.Docked)
        {
            StationName   = evt["StationName"].Str();
            StationType   = evt["StationType"].Str();
            StarSystem    = evt["StarSystem"].Str();
            CockpitBreach = evt["CockpitBreach"].Bool();

            Faction      = JSONObjectExtensions.GetMultiStringDef(evt, new string[] { "StationFaction", "Faction" });
            FactionState = evt["FactionState"].Str().SplitCapsWord();

            Allegiance           = JSONObjectExtensions.GetMultiStringDef(evt, new string[] { "StationAllegiance", "Allegiance" });
            Economy              = JSONObjectExtensions.GetMultiStringDef(evt, new string[] { "StationEconomy", "Economy" });
            Economy_Localised    = JSONObjectExtensions.GetMultiStringDef(evt, new string[] { "StationEconomy_Localised", "Economy_Localised" });
            Government           = JSONObjectExtensions.GetMultiStringDef(evt, new string[] { "StationGovernment", "Government" });
            Government_Localised = JSONObjectExtensions.GetMultiStringDef(evt, new string[] { "StationGovernment_Localised", "Government_Localised" });
        }
Exemple #7
0
        public JournalFSDJump(JObject evt) : base(evt, JournalTypeEnum.FSDJump)
        {
            RealJournalEvent = evt["FuelUsed"].Empty(); // Old pre ED 2.2 messages has no Fuel used fields

            // base class does StarSystem/StarPos

            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" });
            Security             = JSONObjectExtensions.GetMultiStringDef(evt, new string[] { "", "SystemSecurity" });
            Security_Localised   = JSONObjectExtensions.GetMultiStringDef(evt, new string[] { "", "SystemSecurity_Localised" });
            Population           = evt["Population"].LongNull();
            JumpDist             = evt["JumpDist"].Double();
            FuelUsed             = evt["FuelUsed"].Double();
            FuelLevel            = evt["FuelLevel"].Double();
            BoostUsed            = evt["BoostUsed"].Bool();
            BoostValue           = evt["BoostUsed"].Int();

            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

            if (evt["Factions"] != null)
            {
                Factions = evt["Factions"]?.ToObject <FactionInformation[]>().OrderByDescending(x => x.Influence).ToArray();  // POST 2.3
                int i = Array.FindIndex(Factions, x => x.Name == Faction);
                if (i != -1)
                {
                    FactionState = Factions[i].FactionState;        // set to State of controlling faction
                }
            }

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

            JToken jm = evt["EDDMapColor"];

            MapColor = jm.Int(EliteDangerousCore.EliteConfigInstance.InstanceConfig.DefaultMapColour);
            if (jm.Empty())
            {
                evt["EDDMapColor"] = EliteDangerousCore.EliteConfigInstance.InstanceConfig.DefaultMapColour;      // new entries get this default map colour if its not already there
            }
        }
Exemple #8
0
        public JournalDocked(JObject evt) : base(evt, JournalTypeEnum.Docked)
        {
            StationName   = evt["StationName"].Str();
            StationType   = evt["StationType"].Str().SplitCapsWord();
            StarSystem    = evt["StarSystem"].Str();
            SystemAddress = evt["SystemAddress"].LongNull();
            MarketID      = evt["MarketID"].LongNull();
            CockpitBreach = evt["CockpitBreach"].Bool();

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

            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
                Faction      = JSONObjectExtensions.GetMultiStringDef(evt, new string[] { "StationFaction", "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)
            }

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

            Economy           = JSONObjectExtensions.GetMultiStringDef(evt, new string[] { "StationEconomy", "Economy" });
            Economy_Localised = JournalFieldNaming.CheckLocalisation(JSONObjectExtensions.GetMultiStringDef(evt, new string[] { "StationEconomy_Localised", "Economy_Localised" }), Economy);
            EconomyList       = evt["StationEconomies"]?.ToObjectProtected <Economies[]>();

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

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

            StationServices = evt["StationServices"]?.ToObjectProtected <string[]>();

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

            // Government = None only happens in Training
            if (Government == "$government_None;")
            {
                IsTrainingEvent = true;
            }
        }
Exemple #9
0
            }                                                           // may be null

            public EngineeringData(JObject evt)
            {
                Engineer              = evt["Engineer"].Str();
                EngineerID            = evt["EngineerID"].Long();
                BlueprintName         = evt["BlueprintName"].Str();
                FriendlyBlueprintName = BlueprintName.SplitCapsWordFull();
                BlueprintID           = evt["BlueprintID"].Long();
                Level   = evt["Level"].Int();
                Quality = evt["Quality"].Double(0);
                // EngineerCraft has it as Apply.. Loadout has just ExperimentalEffect.  Check both
                ExperimentalEffect           = JSONObjectExtensions.GetMultiStringDef(evt, new string[] { "ExperimentalEffect", "ApplyExperimentalEffect" });
                ExperimentalEffect_Localised = JournalFieldNaming.CheckLocalisation(evt["ExperimentalEffect_Localised"].Str(), ExperimentalEffect);

                Modifiers = evt["Modifiers"]?.ToObjectProtected <EngineeringModifiers[]>();

                if (Modifiers != null)
                {
                    foreach (EngineeringModifiers v in Modifiers)
                    {
                        v.FriendlyLabel = v.Label.SplitCapsWord();
                    }
                }
            }
        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;
            }
        }