Exemplo n.º 1
0
        public JournalLoadGame(JObject evt) : base(evt, JournalTypeEnum.LoadGame)
        {
            LoadGameCommander = evt["Commander"].Str();
            Ship        = JournalFieldNaming.GetBetterShipName(evt["Ship"].Str());
            ShipFD      = JournalFieldNaming.NormaliseFDShipName(evt["Ship"].Str());
            ShipId      = evt["ShipID"].Int();
            StartLanded = evt["StartLanded"].Bool();
            StartDead   = evt["StartDead"].Bool();
            GameMode    = evt["GameMode"].Str();
            Group       = evt["Group"].Str();
            Credits     = evt["Credits"].Long();
            Loan        = evt["Loan"].Long();

            ShipName     = evt["ShipName"].Str();
            ShipIdent    = evt["ShipIdent"].Str();
            FuelLevel    = evt["FuelLevel"].Double();
            FuelCapacity = evt["FuelCapacity"].Double();
        }
Exemplo n.º 2
0
        public void Rescan(JObject evt)
        {
            StationName    = evt["StationName"].Str();
            StarSystem     = evt["StarSystem"].Str();
            MarketID       = evt["MarketID"].LongNull();
            Horizons       = evt["Horizons"].BoolNull();
            AllowCobraMkIV = evt["AllowCobraMkIV"].BoolNull();

            ModuleItems = evt["Items"]?.ToObject <OutfittingModuleItem[]>();

            if (ModuleItems != null)
            {
                foreach (OutfittingModuleItem i in ModuleItems)
                {
                    i.Name = JournalFieldNaming.GetBetterItemNameEvents(i.Name);
                }
            }
        }
Exemplo n.º 3
0
        public JournalStoredModules(JObject evt) : base(evt, JournalTypeEnum.StoredModules)
        {
            StationName = evt["StationName"].Str();
            StarSystem  = evt["StarSystem"].Str();
            MarketID    = evt["MarketID"].LongNull();

            ModuleItems = evt["Items"]?.ToObject <StoredModuleItem[]>();

            if (ModuleItems != null)
            {
                foreach (StoredModuleItem i in ModuleItems)
                {
                    i.Name               = JournalFieldNaming.GetBetterItemNameEvents(i.Name);
                    i.TransferTimeSpan   = new System.TimeSpan((int)(i.TransferTime / 60 / 60), (int)((i.TransferTime / 60) % 60), (int)(i.TransferTime % 60));
                    i.TransferTimeString = i.TransferTimeSpan.ToString();
                }
            }
        }
Exemplo n.º 4
0
 public JournalCargoDepot(JObject evt) : base(evt, JournalTypeEnum.CargoDepot)
 {
     MissionId  = evt["MissionID"].Int();
     UpdateType = evt["UpdateType"].Str();        // must be FD name
     System.Enum.TryParse <UpdateTypeEnum>(UpdateType, out UpdateTypeEnum u);
     UpdateEnum          = u;
     CargoType           = evt["CargoType"].Str(); // item counts
     FriendlyCargoType   = JournalFieldNaming.RMat(CargoType);
     Count               = evt["Count"].Int(0);
     StartMarketID       = evt["StartMarketID"].Long();
     EndMarketID         = evt["EndMarketID"].Long();
     ItemsCollected      = evt["ItemsCollected"].Int();
     ItemsDelivered      = evt["ItemsCollected"].Int();
     TotalItemsToDeliver = evt["TotalItemsToDeliver"].Int();
     ItemsToGo           = TotalItemsToDeliver - ItemsDelivered;
     ProgressPercent     = evt["Progress"].Double() * 100;
     MarketID            = evt["MarketID"].LongNull();
 }
Exemplo n.º 5
0
        public JournalFetchRemoteModule(JObject evt) : base(evt, JournalTypeEnum.FetchRemoteModule)
        {
            StorageSlot = evt["StorageSlot"].Str();          // Slot number, not a slot on our ship

            StoredItemFD        = JournalFieldNaming.NormaliseFDItemName(evt["StoredItem"].Str());
            StoredItem          = JournalFieldNaming.GetBetterItemName(StoredItemFD);
            StoredItemLocalised = JournalFieldNaming.CheckLocalisation(evt["StoredItem_Localised"].Str(), StoredItem);

            TransferCost = evt["TransferCost"].Long();

            ShipFD = JournalFieldNaming.NormaliseFDShipName(evt["Ship"].Str());
            Ship   = JournalFieldNaming.GetBetterShipName(ShipFD);
            ShipId = evt["ShipID"].Int();

            ServerId             = evt["ServerId"].Int();
            nTransferTime        = evt["TransferTime"].IntNull();
            FriendlyTransferTime = nTransferTime.HasValue ? nTransferTime.Value.SecondsToString() : "";
        }
Exemplo n.º 6
0
        public JournalTechnologyBroker(JObject evt) : base(evt, JournalTypeEnum.TechnologyBroker)
        {
            BrokerType = evt["BrokerType"].Str("Unknown");
            MarketID   = evt["MarketID"].LongNull();

            ItemsUnlocked = evt["ItemsUnlocked"]?.ToObjectProtected <Unlocked[]>();      //3.03 entry
            CommodityList = evt["Commodities"]?.ToObjectProtected <Commodities[]>();
            MaterialList  = evt["Materials"]?.ToObjectProtected <Materials[]>();

            if (ItemsUnlocked != null)
            {
                foreach (Unlocked u in ItemsUnlocked)
                {
                    u.Name_Localised = u.Name_Localised.Alt(u.Name);
                }
            }

            if (CommodityList != null)
            {
                foreach (Commodities c in CommodityList)
                {
                    c.FriendlyName = JournalFieldNaming.RMat(c.Name);
                }
            }

            if (MaterialList != null)
            {
                foreach (Materials m in MaterialList)
                {
                    m.FriendlyName = JournalFieldNaming.RMat(m.Name);
                }
            }

            string oldentry = evt["ItemUnlocked"].StrNull();        // 3.02 journal entry

            if (ItemsUnlocked == null && oldentry != null)
            {
                ItemsUnlocked = new Unlocked[] { new Unlocked()
                                                 {
                                                     Name = oldentry, Name_Localised = oldentry
                                                 } }
            }
            ;
        }
Exemplo n.º 7
0
        public JournalMissionAccepted(JObject evt) : base(evt, JournalTypeEnum.MissionAccepted)
        {
            Faction       = evt["Faction"].Str();
            FDName        = evt["Name"].Str();
            Name          = JournalFieldNaming.GetBetterMissionName(FDName);
            LocalisedName = evt["LocalisedName"].Str();

            TargetType          = evt["TargetType"].Str();
            TargetTypeFriendly  = JournalFieldNaming.GetBetterTargetTypeName(TargetType);   // remove $, underscore it
            TargetTypeLocalised = JournalFieldNaming.CheckLocalisation(evt["TargetType_Localised"].Str(), TargetTypeFriendly);

            TargetFaction = evt["TargetFaction"].Str();

            Target          = evt["Target"].Str();
            TargetFriendly  = JournalFieldNaming.GetBetterTargetTypeName(Target);                                  // remove $, underscore it
            TargetLocalised = JournalFieldNaming.CheckLocalisation(evt["Target_localised"].Str(), TargetFriendly); // not all

            KillCount = evt["KillCount"].IntNull();

            DestinationSystem = evt["DestinationSystem"].Str().Replace("$MISSIONUTIL_MULTIPLE_INNER_SEPARATOR;", ",")
                                .Replace("$MISSIONUTIL_MULTIPLE_FINAL_SEPARATOR;", ",");                                     // multi missions get this strange list;
            DestinationStation = evt["DestinationStation"].Str();

            Influence  = evt["Influence"].Str();
            Reputation = evt["Reputation"].Str();

            MissionId = evt["MissionID"].Int();

            Commodity          = JournalFieldNaming.FixCommodityName(evt["Commodity"].Str()); // instances of $_name, fix to fdname
            FriendlyCommodity  = MaterialCommodityData.GetNameByFDName(Commodity);
            CommodityLocalised = JournalFieldNaming.CheckLocalisationTranslation(evt["Commodity_Localised"].Str(), FriendlyCommodity);

            Count  = evt["Count"].IntNull();
            Expiry = evt["Expiry"].DateTimeUTC();

            PassengerCount  = evt["PassengerCount"].IntNull();
            PassengerVIPs   = evt["PassengerVIPs"].BoolNull();
            PassengerWanted = evt["PassengerWanted"].BoolNull();
            PassengerType   = evt["PassengerType"].StrNull();

            Reward = evt["Reward"].IntNull();   // not in DOC V13, but present in latest journal entries

            Wing = evt["Wing"].BoolNull();      // new 3.02
        }
        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.IsObject)       // new 3.03
            {
                Faction      = jk["Name"].Str(); // system faction pick up
                FactionState = jk["FactionState"].Str();
            }
            else
            {
                // old pre 3.3.3 had this
                Faction      = evt.MultiStr(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 = evt.MultiStr(new string[] { "StationAllegiance", "Allegiance" });

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

            Government           = evt.MultiStr(new string[] { "StationGovernment", "Government" });
            Government_Localised = JournalFieldNaming.CheckLocalisation(evt.MultiStr(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;
            }
        }
Exemplo n.º 9
0
        public JournalModuleRetrieve(JObject evt) : base(evt, JournalTypeEnum.ModuleRetrieve)
        {
            Slot   = JournalFieldNaming.GetBetterSlotName(evt["Slot"].Str());
            SlotFD = JournalFieldNaming.NormaliseFDSlotName(evt["Slot"].Str());

            Ship   = JournalFieldNaming.GetBetterShipName(evt["Ship"].Str());
            ShipId = evt["ShipID"].Int();

            RetrievedItem          = JournalFieldNaming.GetBetterItemNameEvents(evt["RetrievedItem"].Str());
            RetrievedItemFD        = JournalFieldNaming.NormaliseFDItemName(evt["RetrievedItem"].Str());
            RetrievedItemLocalised = evt["RetrievedItem_Localised"].Str();
            EngineerModifications  = evt["EngineerModifications"].Str().SplitCapsWordFull();

            SwapOutItem          = JournalFieldNaming.GetBetterItemNameEvents(evt["SwapOutItem"].Str());
            SwapOutItemFD        = JournalFieldNaming.NormaliseFDItemName(evt["SwapOutItem"].Str());
            SwapOutItemLocalised = evt["SwapOutItem_Localised"].Str();

            Cost = evt["Cost"].Long();
        }
Exemplo n.º 10
0
        public JournalMassModuleStore(JObject evt) : base(evt, JournalTypeEnum.MassModuleStore)
        {
            ShipFD      = JournalFieldNaming.NormaliseFDShipName(evt["Ship"].Str());
            Ship        = JournalFieldNaming.GetBetterShipName(ShipFD);
            ShipId      = evt["ShipID"].Int();
            ModuleItems = evt["Items"]?.ToObjectProtected <ModuleItem[]>();
            MarketID    = evt["MarketID"].LongNull();

            if (ModuleItems != null)
            {
                foreach (ModuleItem i in ModuleItems)
                {
                    i.SlotFD = JournalFieldNaming.NormaliseFDSlotName(i.Slot);
                    i.Slot   = JournalFieldNaming.GetBetterSlotName(i.SlotFD);
                    i.NameFD = JournalFieldNaming.NormaliseFDItemName(i.Name);
                    i.Name   = JournalFieldNaming.GetBetterItemName(i.NameFD);
                }
            }
        }
Exemplo n.º 11
0
        public JournalProspectedAsteroid(JObject evt) : base(evt, JournalTypeEnum.ProspectedAsteroid)
        {
            Content           = evt["Content"].Str(); // strange string with $AsteroidMaterialContent_High
            Content_Localised = JournalFieldNaming.CheckLocalisationTranslation(evt["Content_Localised"].Str(), Content);

            MotherlodeMaterial         = JournalFieldNaming.FDNameTranslation(evt["MotherlodeMaterial"].Str());
            FriendlyMotherlodeMaterial = MaterialCommodityData.GetNameByFDName(MotherlodeMaterial);

            Remaining = evt["Remaining"].Double();      // 0-100o
            Materials = evt["Materials"]?.ToObjectProtected <Material[]>().OrderBy(x => x.Name)?.ToArray();

            if (Materials != null)
            {
                foreach (Material m in Materials)
                {
                    m.Normalise();
                }
            }
        }
Exemplo n.º 12
0
        public JournalEngineerContribution(JObject evt) : base(evt, JournalTypeEnum.EngineerContribution)
        {
            Engineer   = evt["Engineer"].Str();
            EngineerID = evt["EngineerID"].LongNull();
            Type       = evt["Type"].Str();

            Commodity           = evt["Commodity"].Str();
            Commodity           = JournalFieldNaming.FDNameTranslation(Commodity); // pre-mangle to latest names, in case we are reading old journal records
            FriendlyCommodity   = MaterialCommodityData.GetNameByFDName(Commodity);
            Commodity_Localised = JournalFieldNaming.CheckLocalisationTranslation(evt["Commodity_Localised"].Str(), FriendlyCommodity);

            Material           = evt["Material"].Str();
            Material           = JournalFieldNaming.FDNameTranslation(Material); // pre-mangle to latest names, in case we are reading old journal records
            FriendlyMaterial   = MaterialCommodityData.GetNameByFDName(Material);
            Material_Localised = JournalFieldNaming.CheckLocalisationTranslation(evt["Material_Localised"].Str(), FriendlyMaterial);

            Quantity      = evt["Quantity"].Int();
            TotalQuantity = evt["TotalQuantity"].Int();
        }
Exemplo n.º 13
0
        public void Rescan(JObject evt)
        {
            StationName    = evt["StationName"].Str();
            StarSystem     = evt["StarSystem"].Str();
            MarketID       = evt["MarketID"].LongNull();
            Horizons       = evt["Horizons"].BoolNull();
            AllowCobraMkIV = evt["AllowCobraMkIV"].BoolNull();

            ShipyardItems = evt["PriceList"]?.ToObjectProtected <ShipyardItem[]>();

            if (ShipyardItems != null)
            {
                foreach (ShipyardItem i in ShipyardItems)
                {
                    i.FDShipType = i.ShipType;
                    i.ShipType   = JournalFieldNaming.GetBetterShipName(i.ShipType);
                }
            }
        }
        public JournalMaterialTrade(JObject evt) : base(evt, JournalTypeEnum.MaterialTrade)
        {
            MarketID   = evt["MarketID"].LongNull();
            TraderType = evt["TraderType"].Str();

            Paid = evt["Paid"]?.ToObjectProtected <Traded>();
            if (Paid != null)
            {
                Paid.Material         = JournalFieldNaming.FDNameTranslation(Paid.Material);
                Paid.FriendlyMaterial = JournalFieldNaming.RMat(Paid.Material);
            }

            Received = evt["Received"]?.ToObjectProtected <Traded>();
            if (Received != null)
            {
                Received.Material         = JournalFieldNaming.FDNameTranslation(Received.Material);
                Received.FriendlyMaterial = JournalFieldNaming.RMat(Received.Material);
            }
        }
Exemplo n.º 15
0
        public JournalCarrierJump(JObject evt) : base(evt, JournalTypeEnum.CarrierJump)
        {
            // base class does StarSystem/StarPos/Faction/Powerplay

            Docked         = evt.Value <bool?>("Docked") ?? false;
            StationName    = evt["StationName"].Str();
            StationType    = evt["StationType"].Str().SplitCapsWord();
            Body           = evt["Body"].Str();
            BodyID         = evt["BodyID"].IntNull();
            BodyType       = JournalFieldNaming.NormaliseBodyType(evt["BodyType"].Str());
            DistFromStarLS = evt["DistFromStarLS"].DoubleNull();

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

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

            // station data only if docked..

            JToken jk = (JToken)evt["StationFaction"];  // 3.3.3 post

            if (jk != null && jk.Type == JTokenType.Object)
            {
                JObject jo = jk as JObject;
                StationFaction      = jk["Name"].Str();           // system faction pick up
                StationFactionState = jk["FactionState"].Str();
            }

            StationGovernment           = evt["StationGovernment"].Str();           // 3.3.2 empty before
            StationGovernment_Localised = evt["StationGovernment_Localised"].Str(); // 3.3.2 empty before
            StationAllegiance           = evt["StationAllegiance"].Str();           // 3.3.2 empty before
                                                                                    // tbd bug in journal over FactionState - its repeated twice..
            StationServices    = evt["StationServices"]?.ToObjectProtected <string[]>();
            StationEconomyList = evt["StationEconomies"]?.ToObjectProtected <JournalDocked.Economies[]>();

            JToken jm = evt["EDDMapColor"];

            MapColor = jm.Int(EDCommander.Current.MapColour);
            if (jm.Empty())
            {
                evt["EDDMapColor"] = EDCommander.Current.MapColour;      // new entries get this default map colour if its not already there
            }
        }
Exemplo n.º 16
0
        public JournalLoadGame(JObject evt) : base(evt, JournalTypeEnum.LoadGame)
        {
            LoadGameCommander = JournalFieldNaming.SubsituteCommanderName(evt["Commander"].Str());

            ShipFD = evt["Ship"].Str();
            if (ShipFD.Length == 0)      // Vega logs show no ship on certain logs.. handle it to prevent warnings.
            {
                ShipFD = "Unknown";
            }

            if (ItemData.IsShip(ShipFD))
            {
                ShipFD = JournalFieldNaming.NormaliseFDShipName(ShipFD);
                Ship   = JournalFieldNaming.GetBetterShipName(ShipFD);
            }
            else
            {
                Ship = ShipFD.SplitCapsWordFull();
            }

            ShipId      = evt["ShipID"].ULong();
            StartLanded = evt["StartLanded"].Bool();
            StartDead   = evt["StartDead"].Bool();
            GameMode    = evt["GameMode"].Str();
            Group       = evt["Group"].Str();
            Credits     = evt["Credits"].Long();
            Loan        = evt["Loan"].Long();

            ShipName     = evt["ShipName"].Str();
            ShipIdent    = evt["ShipIdent"].Str();
            FuelLevel    = evt["FuelLevel"].Double();
            FuelCapacity = evt["FuelCapacity"].Double();

            Horizons = evt["Horizons"].Bool();
            Odyssey  = evt["Odyssey"].Bool();

            Language    = evt["language"].Str();
            GameVersion = evt["gameversion"].Str();
            Build       = evt["build"].Str();

            FID = JournalFieldNaming.SubsituteCommanderFID(evt["FID"].Str());     // 3.3 on
        }
Exemplo n.º 17
0
        public JournalProspectedAsteroid(JObject evt) : base(evt, JournalTypeEnum.ProspectedAsteroid)
        {
            Content           = evt["Content"].Enumeration <AsteroidContent>(AsteroidContent.Low, x => x.Replace("$AsteroidMaterialContent_", "").Replace(";", ""));
            Content_Localised = JournalFieldNaming.CheckLocalisationTranslation(evt["Content_Localised"].Str(), Content.ToString());

            MotherlodeMaterial           = JournalFieldNaming.FDNameTranslation(evt["MotherlodeMaterial"].Str());
            FriendlyMotherlodeMaterial   = MaterialCommodityMicroResourceType.GetNameByFDName(MotherlodeMaterial);
            MotherlodeMaterial_Localised = JournalFieldNaming.CheckLocalisationTranslation(evt["MotherlodeMaterial_Localised"].Str(), FriendlyMotherlodeMaterial);

            Remaining = evt["Remaining"].Double();      // 0-100
            Materials = evt["Materials"]?.ToObjectQ <Material[]>().OrderBy(x => x.Name)?.ToArray();

            if (Materials != null)
            {
                foreach (Material m in Materials)
                {
                    m.Normalise();
                }
            }
        }
Exemplo n.º 18
0
 public JournalCodexEntry(JObject evt) : base(evt, JournalTypeEnum.CodexEntry)
 {
     EntryID               = evt["EntryID"].Long();
     Name                  = evt["Name"].Str();
     Name_Localised        = JournalFieldNaming.CheckLocalisation(evt["Name_Localised"].Str(), Name);
     SubCategory           = evt["SubCategory"].Str();
     SubCategory_Localised = JournalFieldNaming.CheckLocalisation(evt["SubCategory_Localised"].Str(), SubCategory);
     Category              = evt["Category"].Str();
     Category_Localised    = JournalFieldNaming.CheckLocalisation(evt["Category_Localised"].Str(), Category);
     Region                = evt["Region"].Str();
     Region_Localised      = evt["Region_Localised"].Str();
     System                = evt["System"].Str();
     SystemAddress         = evt["SystemAddress"].LongNull();
     IsNewEntry            = evt["IsNewEntry"].BoolNull();
     NewTraitsDiscovered   = evt["NewTraitsDiscovered"].BoolNull();
     if (evt["Traits"] != null)
     {
         Traits = evt["Traits"].ToObjectProtected <string[]>();
     }
 }
        public JournalMissionAccepted(JObject evt) : base(evt, JournalTypeEnum.MissionAccepted)
        {
            Faction = evt["Faction"].Str();
            Name    = JournalFieldNaming.GetBetterMissionName(evt["Name"].Str());

            TargetType          = evt["TargetType"].Str();
            TargetTypeFriendly  = JournalFieldNaming.GetBetterTargetTypeName(TargetType);   // remove $, underscore it
            TargetTypeLocalised = evt["TargetType_Localised"].Str();
            TargetFaction       = evt["TargetFaction"].Str();
            Target          = evt["Target"].Str();
            TargetFriendly  = JournalFieldNaming.GetBetterTargetTypeName(Target);                                       // remove $, underscore it
            TargetLocalised = evt["Target_localised"].Str();                                                            // not all

            DestinationSystem  = evt["DestinationSystem"].Str().Replace("$MISSIONUTIL_MULTIPLE_INNER_SEPARATOR;", ","); // multi missions get this strange list;
            DestinationStation = evt["DestinationStation"].Str();

            Influence  = evt["Influence"].Str();
            Reputation = evt["Reputation"].Str();

            MissionId = evt["MissionID"].Int();

            Commodity          = JournalFieldNaming.FixCommodityName(evt["Commodity"].Str()); // instances of $_name, fix to fdname
            CommodityLocalised = evt["Commodity_Localised"].Str();
            FriendlyCommodity  = JournalFieldNaming.RMat(Commodity);

            Count = evt["Count"].IntNull();

            if (!evt["Expiry"].Empty())
            {
                string s = evt.Value <string>("Expiry");
                //System.Diagnostics.Debug.WriteLine("Time " + s);
                Expiry = DateTime.Parse(s, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal | DateTimeStyles.AdjustToUniversal);
            }

            PassengerCount  = evt["PassengerCount"].IntNull();
            PassengerVIPs   = evt["PassengerVIPs"].BoolNull();
            PassengerWanted = evt["PassengerWanted"].BoolNull();
            PassengerType   = evt["PassengerType"].StrNull();

            Reward = evt["Reward"].IntNull();   // not in DOC V13, but present in latest journal entries
        }
Exemplo n.º 20
0
        public JournalShipyardTransfer(JObject evt) : base(evt, JournalTypeEnum.ShipyardTransfer)
        {
            ShipTypeFD = JournalFieldNaming.NormaliseFDShipName(evt["ShipType"].Str());
            ShipType   = JournalFieldNaming.GetBetterShipName(ShipTypeFD);
            ShipId     = evt["ShipID"].Int();

            FromSystem    = evt["System"].Str();
            Distance      = evt["Distance"].Double();
            TransferPrice = evt["TransferPrice"].Long();

            if (Distance > 100000.0)       // previously, it was in m, now they have changed it to LY per 2.3. So if its large (over 100k ly, impossible) convert
            {
                Distance = Distance / 299792458.0 / 365 / 24 / 60 / 60;
            }

            nTransferTime        = evt["TransferTime"].IntNull();
            FriendlyTransferTime = nTransferTime.HasValue ? nTransferTime.Value.SecondsToString() : "";

            MarketID     = evt["MarketID"].LongNull();
            ShipMarketID = evt["ShipMarketID"].LongNull();
        }
        public JournalBounty(JObject evt) : base(evt, JournalTypeEnum.Bounty)
        {
            TotalReward = evt["TotalReward"].Long();     // others of them..

            VictimFaction          = evt["VictimFaction"].Str();
            VictimFactionLocalised = JournalFieldNaming.CheckLocalisation(evt["VictimFaction_Localised"].Str(), VictimFaction);

            SharedWithOthers = evt["SharedWithOthers"].Bool(false);
            Rewards          = evt["Rewards"]?.ToObjectQ <BountyReward[]>();

            TargetLocalised = Target = evt["Target"].StrNull();       // only set for skimmer target missions

            if (Target != null)
            {
                TargetLocalised = JournalFieldNaming.CheckLocalisation(evt["Target_Localised"].Str(), Target);  // 3.7 added a localised target field, so try it

                var sp = ShipModuleData.Instance.GetShipProperties(Target);
                if (sp != null)
                {
                    TargetLocalised = ((ShipModuleData.ShipInfoString)sp[ShipModuleData.ShipPropID.Name]).Value;
                }
            }


            if (Rewards == null)                    // for skimmers, its Faction/Reward.  Bug in manual reported to FD 23/5/2018
            {
                string faction = evt["Faction"].StrNull();
                long?  reward  = evt["Reward"].IntNull();

                if (faction != null && reward != null)
                {
                    Rewards    = new BountyReward[1];
                    Rewards[0] = new BountyReward()
                    {
                        Faction = faction, Reward = reward.Value
                    };
                    TotalReward = reward.Value;
                }
            }
        }
        public JournalLocation(JObject evt) : base(evt, JournalTypeEnum.Location)      // all have evidence 16/3/2017
        {
            // base class does StarSystem/StarPos/Faction/Powerplay

            Docked         = evt["Docked"].Bool();
            StationName    = evt["StationName"].Str();
            StationType    = evt["StationType"].Str().SplitCapsWord();
            Body           = evt["Body"].Str();
            BodyID         = evt["BodyID"].IntNull();
            BodyType       = JournalFieldNaming.NormaliseBodyType(evt["BodyType"].Str());
            DistFromStarLS = evt["DistFromStarLS"].DoubleNull();

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

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

            // station data only if docked..

            JObject jk = evt["StationFaction"].Object();  // 3.3.3 post

            if (jk != null)
            {
                StationFaction      = jk["Name"].Str();           // system faction pick up
                StationFactionState = jk["FactionState"].Str();
            }

            StationGovernment           = evt["StationGovernment"].Str();           // 3.3.2 empty before
            StationGovernment_Localised = evt["StationGovernment_Localised"].Str(); // 3.3.2 empty before
            StationAllegiance           = evt["StationAllegiance"].Str();           // 3.3.2 empty before
                                                                                    // tbd bug in journal over FactionState - its repeated twice..
            StationServices    = evt["StationServices"]?.ToObjectQ <string[]>();
            StationEconomyList = evt["StationEconomies"]?.ToObjectQ <JournalDocked.Economies[]>();

            Taxi      = evt["Taxi"].BoolNull();
            Multicrew = evt["Multicrew"].BoolNull();
            InSRV     = evt["InSRV"].BoolNull();
            OnFoot    = evt["OnFoot"].BoolNull();
        }
Exemplo n.º 23
0
        public JournalModuleBuy(JObject evt) : base(evt, JournalTypeEnum.ModuleBuy)
        {
            SlotFD = JournalFieldNaming.NormaliseFDSlotName(evt["Slot"].Str());
            Slot   = JournalFieldNaming.GetBetterSlotName(evt["Slot"].Str());

            BuyItem          = JournalFieldNaming.GetBetterItemNameEvents(evt["BuyItem"].Str());
            BuyItemFD        = JournalFieldNaming.NormaliseFDItemName(evt["BuyItem"].Str());
            BuyItemLocalised = evt["BuyItem_Localised"].Str();
            BuyPrice         = evt["BuyPrice"].Long();

            Ship   = JournalFieldNaming.GetBetterShipName(evt["Ship"].Str());
            ShipId = evt["ShipID"].Int();

            SellItem          = JournalFieldNaming.GetBetterItemNameEvents(evt["SellItem"].Str());
            SellItemFD        = JournalFieldNaming.NormaliseFDItemName(evt["SellItem"].Str());
            SellItemLocalised = evt["SellItem_Localised"].Str();
            SellPrice         = evt["SellPrice"].LongNull();

            StoredItem          = JournalFieldNaming.GetBetterItemNameEvents(evt["StoredItem"].Str());
            StoredItemFD        = JournalFieldNaming.NormaliseFDItemName(evt["StoredItem"].Str());
            StoredItemLocalised = evt["StoredItem_Localised"].Str();
        }
Exemplo n.º 24
0
        public JournalFSDJump(JObject evt) : base(evt, JournalTypeEnum.FSDJump)
        {
            // base class does StarSystem/StarPos/Faction/Powerplay

            JumpDist   = evt["JumpDist"].Double();
            FuelUsed   = evt["FuelUsed"].Double();
            FuelLevel  = evt["FuelLevel"].Double();
            BoostUsed  = evt["BoostUsed"].Bool();
            BoostValue = evt["BoostUsed"].Int();
            Body       = evt["Body"].StrNull();
            BodyID     = evt["BodyID"].IntNull();
            BodyType   = JournalFieldNaming.NormaliseBodyType(evt["BodyType"].Str());

            JToken jm = evt["EDDMapColor"];

            MapColor = jm.Int(EDCommander.Current.MapColour);
            if (jm.IsNull())
            {
                evt["EDDMapColor"] = EDCommander.Current.MapColour;      // new entries get this default map colour if its not already there
            }
            EDSMFirstDiscover = evt["EDD_EDSMFirstDiscover"].Bool(false);
        }
Exemplo n.º 25
0
        public string CommoditiesList(bool pretty = true)
        {
            string detailed = "";

            if (CommodityReward != null && CommodityReward.Length > 0)
            {
                if (pretty)
                {
                    detailed += "Rewards:";
                }
                for (int i = 0; i < CommodityReward.Length; i++)
                {
                    detailed += ((i > 0) ? "," : "") + JournalFieldNaming.RMat(CommodityReward[i].Item1) + " " + CommodityReward[i].Item2.ToStringInvariant();
                }

                if (pretty)
                {
                    detailed += System.Environment.NewLine;
                }
            }
            return(detailed);
        }
Exemplo n.º 26
0
        public JournalShipTargeted(JObject evt) : base(evt, JournalTypeEnum.ShipTargeted)
        {
            TargetLocked        = evt["TargetLocked"].Bool();
            Ship                = evt["Ship"].StrNull();
            Ship_Localised      = evt["Ship_Localised"].Str().Alt(Ship);
            ScanStage           = evt["ScanStage"].IntNull();
            PilotName           = evt["PilotName"].StrNull();
            PilotName_Localised = evt["PilotName_Localised"].Str().Alt(PilotName);
            PilotRank           = evt["PilotRank"].StrNull();
            ShieldHealth        = evt["ShieldHealth"].DoubleNull();
            HullHealth          = evt["HullHealth"].DoubleNull();
            Faction             = evt["Faction"].StrNull();
            LegalStatus         = evt["LegalStatus"].StrNull();
            Bounty              = evt["Bounty"].IntNull();
            SubSystem           = evt["PilotRank"].StrNull();
            SubSystemHealth     = evt["SubSystemHealth"].DoubleNull();

            if (Ship != null)
            {
                Ship = JournalFieldNaming.GetBetterShipName(Ship);
            }
        }
Exemplo n.º 27
0
        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();
                    }
                }
            }
        }
Exemplo n.º 28
0
        public JournalModuleSwap(JObject evt) : base(evt, JournalTypeEnum.ModuleSwap)
        {
            FromSlot   = JournalFieldNaming.GetBetterSlotName(evt["FromSlot"].Str());
            FromSlotFD = JournalFieldNaming.NormaliseFDSlotName(evt["FromSlot"].Str());

            ToSlot   = JournalFieldNaming.GetBetterSlotName(evt["ToSlot"].Str());
            ToSlotFD = JournalFieldNaming.NormaliseFDSlotName(evt["ToSlot"].Str());

            FromItem          = JournalFieldNaming.GetBetterItemNameEvents(evt["FromItem"].Str());
            FromItemFD        = JournalFieldNaming.NormaliseFDItemName(evt["FromItem"].Str());
            FromItemLocalised = evt["FromItem_Localised"].Str();

            ToItem   = JournalFieldNaming.GetBetterItemNameEvents(evt["ToItem"].Str());
            ToItemFD = JournalFieldNaming.NormaliseFDItemName(evt["ToItem"].Str());
            if (ToItem.Equals("Null"))      // Frontier bug.. something Null is here.. remove
            {
                ToItem = ToItemFD = "";
            }
            ToItemLocalised = evt["ToItem_Localised"].Str();        // if ToItem is null or not there, this won't be

            Ship   = JournalFieldNaming.GetBetterShipName(evt["Ship"].Str());
            ShipId = evt["ShipID"].Int();
        }
Exemplo n.º 29
0
        public JournalModuleStore(JObject evt) : base(evt, JournalTypeEnum.ModuleStore)
        {
            Slot   = JournalFieldNaming.GetBetterSlotName(evt["Slot"].Str());
            SlotFD = JournalFieldNaming.NormaliseFDSlotName(evt["Slot"].Str());
            ShipFD = evt["Ship"].Str();
            Ship   = JournalFieldNaming.GetBetterShipName(evt["Ship"].Str());
            ShipId = evt["ShipID"].Int();

            StoredItem          = JournalFieldNaming.GetBetterItemNameEvents(evt["StoredItem"].Str());
            StoredItemFD        = JournalFieldNaming.NormaliseFDItemName(evt["StoredItem"].Str());
            StoredItemLocalised = evt["StoredItem_Localised"].Str();

            EngineerModifications = evt["EngineerModifications"].StrNull().SplitCapsWordFull();

            ReplacementItem          = JournalFieldNaming.GetBetterItemNameEvents(evt["ReplacementItem"].Str());
            ReplacementItemFD        = JournalFieldNaming.NormaliseFDItemName(evt["ReplacementItem"].Str());
            ReplacementItemLocalised = evt["ReplacementItem_Localised"].Str();

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

            Hot     = evt["Hot"].BoolNull();
            Level   = evt["Level"].IntNull();
            Quality = evt["Quality"].DoubleNull();
        }
Exemplo n.º 30
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/Faction/Powerplay

            JumpDist   = evt["JumpDist"].Double();
            FuelUsed   = evt["FuelUsed"].Double();
            FuelLevel  = evt["FuelLevel"].Double();
            BoostUsed  = evt["BoostUsed"].Bool();
            BoostValue = evt["BoostUsed"].Int();
            Body       = evt["Body"].StrNull();
            BodyID     = evt["BodyID"].IntNull();
            BodyType   = JournalFieldNaming.NormaliseBodyType(evt["BodyType"].Str());

            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
            }
            EDSMFirstDiscover = evt["EDD_EDSMFirstDiscover"].Bool(false);
        }