cmdrmcdonald / EliteDangerousDataProvider

Apache License 2.0
133 stars 31 forks source link

Rings are not identified as an array object (though they do behave like one). Parameters available inside of the array object are not documented. #232

Open Tkael opened 7 years ago

Tkael commented 7 years ago

I have been unable to get EDDI to report either reserve levels or the composition of planetary rings from EDDI, despite reserve level being described as being supported and despite both items being available from the player journal.

I suspect that the ring composition and reserve level are not being parsed correctly by EDDI, and that this is the relevant code from journalmonitor.cs & ring.cs:

                                data.TryGetValue("Rings", out val);
                                List<object> ringsData = (List<object>)val;
                                List<Ring> rings = new List<Ring>();
                                if (ringsData != null)
                                {
                                    foreach (Dictionary<string, object> ringData in ringsData)
                                    {
                                        ringData.TryGetValue("Name", out val);
                                        string ringName = (string)val;

                                        ringData.TryGetValue("RingClass", out val);
                                        Composition ringComposition = Composition.FromEDName((string)val);

                                        ringData.TryGetValue("MassMT", out val);
                                        decimal ringMass = (decimal)(double)val;

                                        ringData.TryGetValue("InnerRad", out val);
                                        decimal ringInnerRadius = (decimal)(double)val;

                                        ringData.TryGetValue("OuterRad", out val);
                                        decimal ringOuterRadius = (decimal)(double)val;

                                        rings.Add(new Ring(ringName, ringComposition, ringMass, ringInnerRadius, ringOuterRadius));
                                    }
                                }

Is the string declaration incorrect? Why doesn't the formatting for this value match its neighbors?

Tkael commented 7 years ago

For the record, the following test declarations do not currently work in EDDI (in Cottle):


{set reportbody to BodyDetails(state.eddi_context_body_name, state.eddi_context_body_system)}

{if !reportbody:
   {set reportbody to event}
   {set planettype to bodyclass}
}

        BodyComposition {reportbody.rings[0].bodycomposition}
        BodyClass {reportbody.rings[0].bodyclass}
        BodyType {reportbody.rings[0].bodytype}
        Composition {reportbody.rings[0].composition}
        RingComposition {reportbody.rings[0].ringcomposition}
        RingClass {reportbody.rings[0].ringclass}
        RingName {reportbody.rings[0].ringname}
        RingType {reportbody.rings[0].ringtype}
        Type {reportbody.rings[0].type}
        Name {reportbody.rings[0].name}`

        {reportbody.reserves}
        {reportbody.ring.reserves}
Tkael commented 7 years ago

Relevant journal entry:

{ "timestamp":"2017-06-25T09:17:37Z", "event":"Scan", "BodyName":"Col 89 Sector MT-H d10-3 1", "DistanceFromArrivalLS":2266.716309, "TidalLock":false, "TerraformState":"", "PlanetClass":"Sudarsky class III gas giant", "Atmosphere":"", "AtmosphereComposition":[ { "Name":"Hydrogen", "Percent":70.803558 }, { "Name":"Helium", "Percent":29.196449 } ], "Volcanism":"", "MassEM":1610.820068, "Radius":73634976.000000, "SurfaceGravity":118.409935, "SurfaceTemperature":492.808441, "SurfacePressure":0.000000, "Landable":false, "SemiMajorAxis":18112664.000000, "Eccentricity":0.042406, "OrbitalInclination":0.876989, "Periapsis":287.593445, "OrbitalPeriod":9251436.000000, "RotationPeriod":170026.296875, "Rings":[ { "Name":"Col 89 Sector MT-H d10-3 1 A Ring", "RingClass":"eRingClass_Metalic", "MassMT":2.3099e+11, "InnerRad":1.215e+08, "OuterRad":1.5198e+08 }, { "Name":"Col 89 Sector MT-H d10-3 1 B Ring", "RingClass":"eRingClass_Rocky", "MassMT":4.438e+12, "InnerRad":1.5208e+08, "OuterRad":4.1929e+08 } ], "ReserveLevel":"PristineResources" }