Example #1
0
        public JournalEjectCargo(JObject evt) : base(evt, JournalTypeEnum.EjectCargo)
        {
            Type           = evt["Type"].Str();                                                                          // fdname
            Type           = JournalFieldNaming.FDNameTranslation(Type);                                                 // pre-mangle to latest names, in case we are reading old journal records
            FriendlyType   = MaterialCommodityData.GetNameByFDName(Type);
            Type_Localised = JournalFieldNaming.CheckLocalisationTranslation(evt["Type_Localised"].Str(), FriendlyType); // always ensure we have one

            Count           = evt["Count"].Int();
            Abandoned       = evt["Abandoned"].Bool();
            PowerplayOrigin = evt["PowerplayOrigin"].Str();
        }
Example #2
0
 public JournalCargo(JObject evt) : base(evt, JournalTypeEnum.Cargo)
 {
     Inventory = evt["Inventory"]?.ToObjectProtected <Cargo[]>().OrderBy(x => x.Name)?.ToArray();
     if (Inventory != null)
     {
         foreach (Cargo c in Inventory)
         {
             c.Name = JournalFieldNaming.FDNameTranslation(c.Name);
         }
     }
 }
Example #3
0
        public JournalMissionCompleted(JObject evt) : base(evt, JournalTypeEnum.MissionCompleted)
        {
            Name    = JournalFieldNaming.GetBetterMissionName(evt["Name"].Str());
            Faction = evt["Faction"].Str();

            Commodity          = JournalFieldNaming.FixCommodityName(evt["Commodity"].Str()); // evidence of $_name problem, fix to fdname
            Commodity          = JournalFieldNaming.FDNameTranslation(Commodity);             // pre-mangle to latest names, in case we are reading old journal records
            CommodityLocalised = evt["Commodity_Localised"].Str();
            FriendlyCommodity  = JournalFieldNaming.RMat(Commodity);

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

            TargetType          = evt["TargetType"].Str();
            TargetTypeFriendly  = JournalFieldNaming.GetBetterTargetTypeName(TargetType); // remove $, underscores etc
            TargetTypeLocalised = evt["TargetTypeLocalised"].Str();                       // may be empty..
            TargetFaction       = evt["TargetFaction"].Str();
            Target          = evt["Target"].Str();
            TargetFriendly  = JournalFieldNaming.GetBetterTargetTypeName(Target); // remove $, underscores etc
            TargetLocalised = evt["Target_Localised"].Str();                      // copied from Accepted.. no evidence

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

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

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

            if (!evt["CommodityReward"].Empty())
            {
                JArray rewards = (JArray)evt["CommodityReward"];        // does not have the $_name problem, straight FDNAME

                if (rewards.Count > 0)
                {
                    System.Tuple <string, int>[] cr = new System.Tuple <string, int> [rewards.Count];
                    int i = 0;
                    foreach (JToken jc in rewards.Children())
                    {
                        if (!jc["Name"].Empty() && !jc["Count"].Empty())        // evidence of empty values
                        {
                            cr[i++] = new System.Tuple <string, int>(JournalFieldNaming.FDNameTranslation(jc["Name"].Value <string>()), jc["Count"].Value <int>());
                        }

                        //System.Diagnostics.Trace.WriteLine(string.Format(" >> Child {0} {1}", jc.Path, jc.Type.ToString()));
                    }
                    CommodityReward = new System.Tuple <string, int> [i];
                    System.Array.Copy(cr, CommodityReward, i);
                }
            }
        }
Example #4
0
 public JournalMarketBuy(JObject evt) : base(evt, JournalTypeEnum.MarketBuy)
 {
     MarketID       = evt["MarketID"].LongNull();
     Type           = evt["Type"].Str();                                                                          // must be FD name
     Type           = JournalFieldNaming.FDNameTranslation(Type);                                                 // pre-mangle to latest names, in case we are reading old journal records
     FriendlyType   = MaterialCommodityData.GetNameByFDName(Type);                                                // our translation..
     Type_Localised = JournalFieldNaming.CheckLocalisationTranslation(evt["Type_Localised"].Str(), FriendlyType); // always ensure we have one
     Count          = evt["Count"].Int();
     BuyPrice       = evt["BuyPrice"].Long();
     TotalCost      = evt["TotalCost"].Long();
 }
Example #5
0
            public void Normalise()
            {
                Name           = JournalFieldNaming.FDNameTranslation(Name);
                FriendlyName   = JournalFieldNaming.RMat(Name);
                Name_Localised = Name_Localised.Alt(FriendlyName);

                if (Category != null)
                {
                    Category           = JournalFieldNaming.NormaliseMaterialCategory(Category);
                    Category_Localised = Category_Localised.Alt(Category);
                }
            }
Example #6
0
            public void Normalise()
            {
                Material           = JournalFieldNaming.FDNameTranslation(Material);
                FriendlyMaterial   = MaterialCommodityData.GetNameByFDName(Material);
                Material_Localised = JournalFieldNaming.CheckLocalisationTranslation(Material_Localised ?? "", FriendlyMaterial); // ensure.

                if (Category != null)                                                                                             // some entries do not have this
                {
                    Category           = JournalFieldNaming.NormaliseMaterialCategory(Category);                                  // fix up any strangeness
                    Category_Localised = JournalFieldNaming.CheckLocalisation(Category_Localised ?? "", Category);
                }
            }
            public void Normalise()
            {
                Material           = JournalFieldNaming.FDNameTranslation(Material);
                FriendlyMaterial   = JournalFieldNaming.RMat(Material);
                Material_Localised = Material_Localised.Alt(FriendlyMaterial);                   // ensure.

                if (Category != null)                                                            // some entries do not have this
                {
                    Category           = JournalFieldNaming.NormaliseMaterialCategory(Category); // fix up any strangeness
                    Category_Localised = Category_Localised.Alt(Category);
                }
            }
Example #8
0
            public void Normalise()
            {
                Name           = JournalFieldNaming.FDNameTranslation(Name);
                FriendlyName   = MaterialCommodityData.GetNameByFDName(Name);
                Name_Localised = JournalFieldNaming.CheckLocalisationTranslation(Name_Localised ?? "", FriendlyName);

                if (Category != null)
                {
                    Category           = JournalFieldNaming.NormaliseMaterialCategory(Category);
                    Category_Localised = JournalFieldNaming.CheckLocalisation(Category_Localised ?? "", Category);
                }
            }
Example #9
0
 public JournalMarketSell(JObject evt) : base(evt, JournalTypeEnum.MarketSell)
 {
     Type         = evt["Type"].Str();                          // FDNAME
     Type         = JournalFieldNaming.FDNameTranslation(Type); // pre-mangle to latest names, in case we are reading old journal records
     FriendlyType = JournalFieldNaming.RMat(Type);
     Count        = evt["Count"].Int();
     SellPrice    = evt["SellPrice"].Long();
     TotalSale    = evt["TotalSale"].Long();
     AvgPricePaid = evt["AvgPricePaid"].Long();
     IllegalGoods = evt["IllegalGoods"].Bool();
     StolenGoods  = evt["StolenGoods"].Bool();
     BlackMarket  = evt["BlackMarket"].Bool();
 }
Example #10
0
        }                                                       // BuyMicroResources, SellMicroResource, TradeMicroResources, TransferMicroResources. These call it type: BackPackChange, UseConsumable, CollectItems, DropItems

        public void Normalise(string cat)
        {
            if (Name.HasChars())
            {
                Name_Localised = JournalFieldNaming.CheckLocalisation(Name_Localised, Name);
                Name           = JournalFieldNaming.FDNameTranslation(Name);               // this lower cases the name
                FriendlyName   = MaterialCommodityMicroResourceType.GetNameByFDName(Name); // normalises to lower case
                if (cat != null)
                {
                    Category = cat;
                }
            }
        }
        public JournalTradeMicroResources(JObject evt) : base(evt, JournalTypeEnum.TradeMicroResources)
        {
            Offered = evt["Offered"]?.ToObjectQ<MicroResource[]>()?.OrderBy(x => x.Name)?.ToArray();
            MicroResource.Normalise(Offered);
            Received = evt["Received"].Str();
            Received_Localised = evt["Received_Localised"].Str();
            Category = evt["Category"].Str();
            Count = evt["Count"].Int();
            MarketID = evt["MarketID"].Long();

            Received_Localised = JournalFieldNaming.CheckLocalisation(Received_Localised, Received);
            Received = JournalFieldNaming.FDNameTranslation(Received);
            Received_FriendlyName = MaterialCommodityMicroResourceType.GetNameByFDName(Received);
        }
Example #12
0
 public JournalMarketSell(JObject evt) : base(evt, JournalTypeEnum.MarketSell)
 {
     MarketID       = evt["MarketID"].LongNull();
     Type           = evt["Type"].Str();                                                                          // FDNAME
     Type           = JournalFieldNaming.FDNameTranslation(Type);                                                 // pre-mangle to latest names, in case we are reading old journal records
     FriendlyType   = MaterialCommodityData.GetNameByFDName(Type);                                                // goes thru the translator..
     Type_Localised = JournalFieldNaming.CheckLocalisationTranslation(evt["Type_Localised"].Str(), FriendlyType); // always ensure we have one
     Count          = evt["Count"].Int();
     SellPrice      = evt["SellPrice"].Long();
     TotalSale      = evt["TotalSale"].Long();
     AvgPricePaid   = evt["AvgPricePaid"].Long();
     IllegalGoods   = evt["IllegalGoods"].Bool();
     StolenGoods    = evt["StolenGoods"].Bool();
     BlackMarket    = evt["BlackMarket"].Bool();
 }
Example #13
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();
                }
            }
        }
        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();
        }
        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);
            }
        }
        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();
                }
            }
        }
        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();
                    }
                }
            }
        }
Example #18
0
 public JournalMiningRefined(JObject evt) : base(evt, JournalTypeEnum.MiningRefined)
 {
     Type         = JournalFieldNaming.FixCommodityName(evt["Type"].Str()); // instances of $.._name, translate to FDNAME
     Type         = JournalFieldNaming.FDNameTranslation(Type);             // pre-mangle to latest names, in case we are reading old journal records
     FriendlyType = JournalFieldNaming.RMat(Type);
 }
Example #19
0
            }                                           // 0-100

            public void Normalise()
            {
                Name         = JournalFieldNaming.FDNameTranslation(Name);
                FriendlyName = MaterialCommodityData.GetNameByFDName(Name);
            }
        public JournalMissionCompleted(JObject evt) : base(evt, JournalTypeEnum.MissionCompleted)
        {
            FDName  = evt["Name"].Str();
            Name    = JournalFieldNaming.GetBetterMissionName(FDName);
            Faction = evt["Faction"].Str();

            Commodity          = JournalFieldNaming.FixCommodityName(evt["Commodity"].Str()); // evidence of $_name problem, fix to fdname
            Commodity          = JournalFieldNaming.FDNameTranslation(Commodity);             // pre-mangle to latest names, in case we are reading old journal records
            FriendlyCommodity  = MaterialCommodityData.GetNameByFDName(Commodity);
            CommodityLocalised = JournalFieldNaming.CheckLocalisationTranslation(evt["Commodity_Localised"].Str(), FriendlyCommodity);

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

            TargetType          = evt["TargetType"].Str();
            TargetTypeFriendly  = JournalFieldNaming.GetBetterTargetTypeName(TargetType);                                     // remove $, underscores etc
            TargetTypeLocalised = JournalFieldNaming.CheckLocalisation(evt["TargetTypeLocalised"].Str(), TargetTypeFriendly); // may be empty..

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

            Target          = evt["Target"].Str();
            TargetFriendly  = JournalFieldNaming.GetBetterTargetTypeName(Target);                                  // remove $, underscores etc
            TargetLocalised = JournalFieldNaming.CheckLocalisation(evt["Target_Localised"].Str(), TargetFriendly); // copied from Accepted.. no evidence

            Reward = evt["Reward"].LongNull();
            JToken dtk = evt["Donation"];

            if (dtk != null)
            {
                if (dtk.IsString)      // some records have donations as strings incorrectly
                {
                    Donation = dtk.Str().InvariantParseLongNull();
                }
                else
                {
                    Donation = dtk.LongNull();
                }
            }

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

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

            PermitsAwarded = evt["PermitsAwarded"]?.ToObjectQ <string[]>();

            // 7/3/2018 journal 16 3.02

            CommodityReward = evt["CommodityReward"]?.ToObjectQ <CommodityRewards[]>();

            if (CommodityReward != null)
            {
                foreach (CommodityRewards c in CommodityReward)
                {
                    c.Normalise();
                }
            }

            MaterialsReward = evt["MaterialsReward"]?.ToObjectQ <MaterialRewards[]>();

            if (MaterialsReward != null)
            {
                foreach (MaterialRewards m in MaterialsReward)
                {
                    m.Normalise();
                }
            }

            FactionEffects = evt["FactionEffects"]?.ToObjectQ <FactionEffectsEntry[]>();      // NEEDS TEST
        }
Example #21
0
 public void Normalise()
 {
     Name           = JournalFieldNaming.FDNameTranslation(Name);
     FriendlyName   = MaterialCommodityMicroResourceType.GetNameByFDName(Name);
     Name_Localised = Name_Localised.Alt(FriendlyName);
 }
Example #22
0
 public void Normalise()
 {
     Name           = JournalFieldNaming.FDNameTranslation(Name);
     FriendlyName   = JournalFieldNaming.RMat(Name);
     Name_Localised = Name_Localised.Alt(FriendlyName);
 }