コード例 #1
0
        public JournalEngineerContribution(JObject evt) : base(evt, JournalTypeEnum.EngineerContribution)
        {
            Engineer   = evt["Engineer"].Str();
            EngineerID = evt["EngineerID"].LongNull();
            Type       = evt["Type"].Str();

            if (Type.Equals("Commodity") || Type.Equals("Materials") || Type.Equals("Credits") || Type.Equals("Bond") || Type.Equals("Bounty"))
            {
                unknownType = false;
            }
            else
            {
                unknownType = true;
            }

            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();
        }
コード例 #2
0
ファイル: JournalEDD.cs プロジェクト: taemtha/EDDiscovery
        public override void FillInformation(out string info, out string detailed)
        {
            info = "";
            bool comma = false;

            if (Materials != null)
            {
                foreach (MaterialItem m in Materials.Materials)
                {
                    if (comma)
                    {
                        info += ", ";
                    }
                    comma = true;
                    info += BaseUtils.FieldBuilder.Build("Name:".Txb(this), MaterialCommodityData.GetNameByFDName(m.Name), "", m.Count);
                }
            }

            if (Commodities != null)
            {
                foreach (CommodityItem m in Commodities.Commodities)
                {
                    if (comma)
                    {
                        info += ", ";
                    }
                    comma = true;
                    info += BaseUtils.FieldBuilder.Build("Name:".Txb(this), MaterialCommodityData.GetNameByFDName(m.Name), "", m.Count);
                }
            }
            detailed = "";
        }
コード例 #3
0
 public JournalMaterialDiscarded(JObject evt) : base(evt, JournalTypeEnum.MaterialDiscarded)
 {
     Category     = JournalFieldNaming.NormaliseMaterialCategory(evt["Category"].Str());
     Name         = JournalFieldNaming.FDNameTranslation(evt["Name"].Str()); // pre-mangle to latest names, in case we are reading old journal records
     FriendlyName = MaterialCommodityData.GetNameByFDName(Name);
     Count        = evt["Count"].Int();
 }
コード例 #4
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   = MaterialCommodityData.GetNameByFDName(Type);
     Type_Localised = JournalFieldNaming.CheckLocalisationTranslation(evt["Type_Localised"].Str(), FriendlyType);
 }
コード例 #5
0
 public JournalCollectCargo(JObject evt) : base(evt, JournalTypeEnum.CollectCargo)
 {
     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
     Stolen         = evt["Stolen"].Bool();
 }
コード例 #6
0
        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();
            Donation  = evt["Donation"].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"]?.ToObjectProtected <string[]>();

            // 7/3/2018 journal 16 3.02

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

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

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

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

            FactionEffects = evt["FactionEffects"]?.ToObjectProtected <FactionEffectsEntry[]>();      // NEEDS TEST
        }
コード例 #7
0
        }                                                               // never null

        public override void FillInformation(out string info, out string detailed)
        {
            info = BaseUtils.FieldBuilder.Build("Prices on ; items".Tx(typeof(JournalCommodityPricesBase), "PON"), Commodities.Count,
                                                "< at ".Tx(typeof(JournalCommodityPricesBase), "CPBat"), Station,
                                                "< in ".Tx(typeof(JournalCommodityPricesBase), "CPBin"), StarSystem);

            int col    = 0;
            int maxcol = Commodities.Count > 60 ? 2 : 1;

            detailed = "Items to buy:".Tx(typeof(JournalCommodityPricesBase)) + System.Environment.NewLine;
            foreach (CCommodities c in Commodities)
            {
                if (c.buyPrice > 0)
                {
                    string name = MaterialCommodityData.GetNameByFDName(c.fdname);

                    if (c.sellPrice > 0)
                    {
                        detailed += string.Format("{0}: {1} sell {2} Diff {3} {4}%  ".Tx(typeof(JournalCommodityPricesBase), "CPBBuySell"),
                                                  name, c.buyPrice, c.sellPrice, c.buyPrice - c.sellPrice,
                                                  ((double)(c.buyPrice - c.sellPrice) / (double)c.sellPrice * 100.0).ToString("0.#"));
                    }
                    else
                    {
                        detailed += string.Format("{0}: {1}  ".Tx(typeof(JournalCommodityPricesBase), "CPBBuy"), name, c.buyPrice);
                    }

                    if (++col == maxcol)
                    {
                        detailed += System.Environment.NewLine;
                        col       = 0;
                    }
                }
            }

            if (col == maxcol - 1)
            {
                detailed += System.Environment.NewLine;
            }

            col       = 0;
            detailed += "Sell only Items:".Tx(typeof(JournalCommodityPricesBase), "SO") + System.Environment.NewLine;
            foreach (CCommodities c in Commodities)
            {
                if (c.buyPrice <= 0)
                {
                    string name = MaterialCommodityData.GetNameByFDName(c.fdname);

                    detailed += string.Format("{0}: {1}  ".Tx(typeof(JournalCommodityPricesBase), "CPBBuy"), name, c.sellPrice);
                    if (++col == maxcol)
                    {
                        detailed += System.Environment.NewLine;
                        col       = 0;
                    }
                }
            }
        }
コード例 #8
0
 public JournalSearchAndRescue(JObject evt) : base(evt, JournalTypeEnum.SearchAndRescue)
 {
     Name         = evt["Name"].Str();
     Name         = JournalFieldNaming.FDNameTranslation(Name); // some premangling
     FriendlyName = MaterialCommodityData.GetNameByFDName(Name);
     Count        = evt["Count"].Int();
     Reward       = evt["Reward"].Long();
     MarketID     = evt["MarketID"].LongNull();
 }
コード例 #9
0
 public JournalSearchAndRescue(JObject evt) : base(evt, JournalTypeEnum.SearchAndRescue)
 {
     FDName         = evt["Name"].Str();
     FDName         = JournalFieldNaming.FDNameTranslation(FDName);                                               // some premangling
     FriendlyName   = MaterialCommodityData.GetNameByFDName(FDName);
     Name_Localised = JournalFieldNaming.CheckLocalisationTranslation(evt["Name_Localised"].Str(), FriendlyName); // always ensure we have one
     Count          = evt["Count"].Int();
     Reward         = evt["Reward"].Long();
     MarketID       = evt["MarketID"].LongNull();
 }
コード例 #10
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();
 }
コード例 #11
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();
        }
コード例 #12
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);
                }
            }
コード例 #13
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);
                }
            }
コード例 #14
0
        public override void FillInformation(out string info, out string detailed)
        {
            info = BaseUtils.FieldBuilder.Build("In Slot:".Txb(this), Slot, "", Module, "By:".Txb(this), Engineering.Engineer, "Blueprint:".Txb(this), Engineering.FriendlyBlueprintName, "Level:".Txb(this), Engineering.Level);

            detailed = "";
            if (Ingredients != null)
            {
                foreach (KeyValuePair <string, int> k in Ingredients)        // may be commodities or materials
                {
                    detailed += BaseUtils.FieldBuilder.Build("", MaterialCommodityData.GetNameByFDName(k.Key), "", k.Value) + "; ";
                }
            }
        }
コード例 #15
0
        public override void FillInformation(out string info, out string detailed)
        {
            info = Name;
            if (Materials != null)
            {
                foreach (KeyValuePair <string, int> k in Materials)
                {
                    info += ", " + MaterialCommodityData.GetNameByFDName(k.Key) + ":" + k.Value.ToString();
                }
            }

            detailed = "";
        }
コード例 #16
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();
 }
コード例 #17
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 = JournalFieldNaming.CheckLocalisation(u.Name_Localised ?? "", u.Name);
                }
            }

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

            if (MaterialList != null)
            {
                foreach (Materials m in MaterialList)
                {
                    m.FriendlyName = MaterialCommodityData.GetNameByFDName(m.Name);
                    m.Category     = JournalFieldNaming.NormaliseMaterialCategory(m.Category);
                }
            }

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

            if (ItemsUnlocked == null && oldentry != null)
            {
                ItemsUnlocked = new Unlocked[] { new Unlocked()
                                                 {
                                                     Name = oldentry, Name_Localised = oldentry
                                                 } }
            }
            ;
        }
コード例 #18
0
        public override void FillInformation(out string info, out string detailed)
        {
            info = BaseUtils.FieldBuilder.Build("In Slot:".T(EDTx.JournalEntry_InSlot), Slot, "", Module, "By:".T(EDTx.JournalEntry_By), Engineering.Engineer, "Blueprint:".T(EDTx.JournalEntry_Blueprint), Engineering.FriendlyBlueprintName, "Level:".T(EDTx.JournalEntry_Level), Engineering.Level);

            detailed = "";
            if (Ingredients != null)
            {
                foreach (KeyValuePair <string, int> k in Ingredients)        // may be commodities or materials
                {
                    detailed += BaseUtils.FieldBuilder.Build("", MaterialCommodityData.GetNameByFDName(k.Key), "", k.Value) + "; ";
                }
            }

            if (Engineering != null)
            {
                detailed = detailed.AppendPrePad(Engineering.ToString(), System.Environment.NewLine);
            }
        }
コード例 #19
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
        }
コード例 #20
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();
                }
            }
        }
コード例 #21
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   = MaterialCommodityData.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();
                }
            }
        }
コード例 #22
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   = MaterialCommodityData.GetNameByFDName(CargoType);
            Count               = evt["Count"].Int(0);
            StartMarketID       = evt["StartMarketID"].Long();
            EndMarketID         = evt["EndMarketID"].Long();
            ItemsCollected      = evt["ItemsCollected"].Int();
            ItemsDelivered      = evt["ItemsDelivered"].Int();
            TotalItemsToDeliver = evt["TotalItemsToDeliver"].Int();
            ItemsToGo           = TotalItemsToDeliver - ItemsDelivered;
            ProgressPercent     = evt["Progress"].Double() * 100;
            MarketID            = evt["MarketID"].LongNull();

            if (ProgressPercent < 0.01)
            {
                ProgressPercent = ((double)System.Math.Max(ItemsCollected, ItemsDelivered) / (double)TotalItemsToDeliver) * 100;
            }
        }
コード例 #23
0
            }                                           // 0-100

            public void Normalise()
            {
                Name         = JournalFieldNaming.FDNameTranslation(Name);
                FriendlyName = MaterialCommodityData.GetNameByFDName(Name);
            }