Exemplo n.º 1
0
        static public void HistoryEventVars(Variables vars, HistoryEntry he, string prefix)
        {
            if (he != null)
            {
                System.Globalization.CultureInfo ct = System.Globalization.CultureInfo.InvariantCulture;

                vars[prefix + "LocalTime"]   = he.EventTimeLocal.ToStringUS();
                vars[prefix + "DockedState"] = he.IsDocked ? "1" : "0";
                vars[prefix + "LandedState"] = he.IsLanded ? "1" : "0";
                vars[prefix + "Hyperspace"]  = he.IsInHyperSpace ? "1" : "0";
                vars[prefix + "WhereAmI"]    = he.WhereAmI;
                vars[prefix + "BodyType"]    = he.BodyType;
                vars[prefix + "ShipType"]    = he.ShipType;
                vars[prefix + "ShipId"]      = he.ShipId.ToString(ct);
                vars[prefix + "IndexOf"]     = he.Indexno.ToString(ct);
                vars[prefix + "JID"]         = he.Journalid.ToString(ct);

                vars[prefix + "Credits"] = he.Credits.ToString(ct);

                vars[prefix + "TravelledDistance"]     = he.TravelledDistance.ToString("0.0");
                vars[prefix + "TravelledSeconds"]      = he.TravelledSeconds.ToString();
                vars[prefix + "IsTravelling"]          = he.isTravelling ? "1" : "0";
                vars[prefix + "TravelledJumps"]        = he.Travelledjumps.ToStringInvariant();
                vars[prefix + "TravelledMissingJumps"] = he.TravelledMissingjump.ToStringInvariant();
                vars[prefix + "MultiPlayer"]           = he.MultiPlayer ? "1" : "0";
                vars[prefix + "ContainsRares"]         = he.ContainsRares() ? "1" : "0";
                vars[prefix + "EventSummary"]          = he.EventSummary;

                vars[prefix + "Note"] = he.snc?.Note ?? "";

                he.journalEntry.FillInformation(out string EventDescription, out string EventDetailedInfo);
                vars[prefix + "EventDescription"]  = EventDescription;
                vars[prefix + "EventDetailedInfo"] = EventDetailedInfo;

                vars.AddPropertiesFieldsOfClass(he.journalEntry, prefix + "Class_", new Type[] { typeof(System.Drawing.Icon), typeof(System.Drawing.Image), typeof(System.Drawing.Bitmap), typeof(Newtonsoft.Json.Linq.JObject) }, 5);      //depth seems good enough

                // being backwards compatible to actions packs BEFORE the V3 change to remove JS vars
                // these were the ones used in the pack..

                vars[prefix + "JS_event"] = he.EntryType.ToString();
                if (he.journalEntry is EliteDangerousCore.JournalEvents.JournalReceiveText)
                {
                    vars[prefix + "JS_Channel"] = (he.journalEntry as EliteDangerousCore.JournalEvents.JournalReceiveText).Channel;
                }
                if (he.journalEntry is EliteDangerousCore.JournalEvents.JournalBuyAmmo)
                {
                    vars[prefix + "JS_Cost"] = (he.journalEntry as EliteDangerousCore.JournalEvents.JournalBuyAmmo).Cost.ToString(System.Globalization.CultureInfo.InvariantCulture);
                }
            }
        }
Exemplo n.º 2
0
        static public void HistoryEventVars(Variables vars, HistoryEntry he, string prefix)
        {
            if (he != null)
            {
                System.Globalization.CultureInfo ct = System.Globalization.CultureInfo.InvariantCulture;

                vars[prefix + "JID"]         = he.Journalid.ToString(ct);
                vars[prefix + "UTCTime"]     = he.EventTimeUTC.ToStringUS();
                vars[prefix + "LocalTime"]   = he.EventTimeUTC.ToLocalTime().ToStringUS();
                vars[prefix + "GameTime"]    = he.EventTimeUTC.AddYears(1286).ToStringUS();
                vars[prefix + "DockedState"] = he.IsDocked.ToStringIntValue();
                vars[prefix + "LandedState"] = he.IsLanded.ToStringIntValue();
                vars[prefix + "Hyperspace"]  = he.IsInHyperSpace.ToStringIntValue();
                vars[prefix + "WhereAmI"]    = he.WhereAmI;
                vars[prefix + "BodyType"]    = he.BodyType;
                vars[prefix + "ShipType"]    = he.ShipType;
                vars[prefix + "ShipTypeFD"]  = he.ShipTypeFD;
                vars[prefix + "ShipId"]      = he.ShipId.ToString(ct);
                vars[prefix + "IndexOf"]     = he.Indexno.ToString(ct);

                vars[prefix + "Credits"] = he.Credits.ToString(ct);

                vars[prefix + "TravelledDistance"]     = he.TravelledDistance.ToStringInvariant("0.0");
                vars[prefix + "TravelledSeconds"]      = he.TravelledSeconds.ToString();
                vars[prefix + "IsTravelling"]          = he.isTravelling.ToStringIntValue();
                vars[prefix + "TravelledJumps"]        = he.Travelledjumps.ToStringInvariant();
                vars[prefix + "TravelledMissingJumps"] = he.TravelledMissingjump.ToStringInvariant();
                vars[prefix + "MultiPlayer"]           = he.MultiPlayer.ToStringIntValue();
                vars[prefix + "ContainsRares"]         = he.ContainsRares().ToStringIntValue();
                vars[prefix + "EventSummary"]          = he.EventSummary;

                vars[prefix + "StartMarker"] = he.StartMarker.ToStringIntValue();
                vars[prefix + "StopMarker"]  = he.StopMarker.ToStringIntValue();
                vars[prefix + "EdsmSync"]    = he.EdsmSync.ToStringIntValue();
                vars[prefix + "EddnSync"]    = he.EDDNSync.ToStringIntValue();
                vars[prefix + "EgoSync"]     = false.ToStringIntValue();    //removed due to no EGO
                vars[prefix + "Beta"]        = he.IsBetaMessage.ToStringIntValue();
                vars[prefix + "GameMode"]    = he.GameMode;
                vars[prefix + "Group"]       = he.Group;
                vars[prefix + "Wanted"]      = he.Wanted.ToStringIntValue();
                vars[prefix + "MarketId"]    = he.MarketID.HasValue ? he.MarketID.ToStringInvariant() : "0";

                vars[prefix + "Note"] = he.snc?.Note ?? "";

                he.journalEntry.FillInformation(out string EventDescription, out string EventDetailedInfo);
                vars[prefix + "EventDescription"]  = EventDescription;
                vars[prefix + "EventDetailedInfo"] = EventDetailedInfo;

                vars.AddPropertiesFieldsOfClass(he.journalEntry, prefix + "Class_", new Type[] { typeof(System.Drawing.Icon), typeof(System.Drawing.Image), typeof(System.Drawing.Bitmap), typeof(BaseUtils.JSON.JObject) }, 5);      //depth seems good enough

                // being backwards compatible to actions packs BEFORE the V3 change to remove JS vars
                // these were the ones used in the pack..

                vars[prefix + "JS_event"] = he.EntryType.ToString();
                if (he.journalEntry is EliteDangerousCore.JournalEvents.JournalReceiveText)
                {
                    vars[prefix + "JS_Channel"] = (he.journalEntry as EliteDangerousCore.JournalEvents.JournalReceiveText).Channel;
                }
                if (he.journalEntry is EliteDangerousCore.JournalEvents.JournalBuyAmmo)
                {
                    vars[prefix + "JS_Cost"] = (he.journalEntry as EliteDangerousCore.JournalEvents.JournalBuyAmmo).Cost.ToString(System.Globalization.CultureInfo.InvariantCulture);
                }
            }
        }