Esempio n. 1
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);
 }
Esempio n. 2
0
        public override void Init()
        {
            dataGridView.CheckEDSM = true;
            dataGridView.MakeDoubleBuffered();
            dataGridView.DefaultCellStyle.WrapMode = DataGridViewTriState.True;
            dataGridView.RowTemplate.Height        = 26;
            dataGridView.AutoSizeRowsMode          = DataGridViewAutoSizeRowsMode.DisplayedCells; // NEW! appears to work https://msdn.microsoft.com/en-us/library/74b2wakt(v=vs.110).aspx

            BaseUtils.Translator.Instance.Translate(this, new Control[] { });
            BaseUtils.Translator.Instance.Translate(toolTip, this);

            dataGridView.Init(discoveryform);

            itemlist = MaterialCommodityData.GetAll();
            Array.Sort(itemlist, (left, right) => left.Name.CompareTo(right.Name));

            var list = (from x in itemlist select x.Name + " (" + x.Category + ", " + x.Type + ((x.Rarity) ? ", Rare Commodity".Tx(this):"") + ")");

            comboBoxCustomCM1.Items.AddRange(list);
            comboBoxCustomCM1.SelectedIndex = Math.Min(SQLiteConnectionUser.GetSettingInt(DbCM1, 0), list.Count() - 1);
            comboBoxCustomCM2.Items.Add("----");
            comboBoxCustomCM2.Items.AddRange(list);
            comboBoxCustomCM2.SelectedIndex = Math.Min(SQLiteConnectionUser.GetSettingInt(DbCM2, 0), list.Count() - 1);

            comboBoxCustomCMANDOR.Items.AddRange(new string[] { "AND".Tx(this), "OR".Tx(this) });
            comboBoxCustomCMANDOR.SelectedIndex = SQLiteConnectionUser.GetSettingInt(DbCMANDOR, 0);
        }
Esempio n. 3
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();
        }
        public override void Init()
        {
            dataGridView.CheckEDSM = true;
            dataGridView.MakeDoubleBuffered();
            dataGridView.DefaultCellStyle.WrapMode = DataGridViewTriState.True;
            dataGridView.RowTemplate.Height        = Font.ScalePixels(26);
            dataGridView.AutoSizeRowsMode          = DataGridViewAutoSizeRowsMode.DisplayedCells; // NEW! appears to work https://msdn.microsoft.com/en-us/library/74b2wakt(v=vs.110).aspx

            BaseUtils.Translator.Instance.Translate(this, new Control[] { });
            BaseUtils.Translator.Instance.Translate(toolTip, this);

            dataGridView.Init(discoveryform);

            itemlist = MaterialCommodityData.GetAll();
            Array.Sort(itemlist, (left, right) => left.Name.CompareTo(right.Name));

            var list = (from x in itemlist select x.Name + " (" + x.TranslatedCategory + ", " + x.TranslatedType + (x.Rarity ? ", Rare Commodity".T(EDTx.SearchMaterialsCommodities_RareCommodity):"") + ")");

            comboBoxCustomCM1.Items.AddRange(list);
            comboBoxCustomCM1.SelectedIndex = Math.Min(EliteDangerousCore.DB.UserDatabase.Instance.GetSettingInt(DbCM1, 0), list.Count() - 1);
            comboBoxCustomCM2.Items.Add("----");
            comboBoxCustomCM2.Items.AddRange(list);
            comboBoxCustomCM2.SelectedIndex = Math.Min(EliteDangerousCore.DB.UserDatabase.Instance.GetSettingInt(DbCM2, 0), list.Count() - 1);

            comboBoxCustomCMANDOR.Items.AddRange(new string[] { "AND".T(EDTx.SearchMaterialsCommodities_AND), "OR".T(EDTx.SearchMaterialsCommodities_OR) });
            comboBoxCustomCMANDOR.SelectedIndex = EliteDangerousCore.DB.UserDatabase.Instance.GetSettingInt(DbCMANDOR, 0);

            dataGridView.GotoEntryClicked += (he) => { uctg.GotoPosByJID(he.Journalid); };
        }
Esempio n. 5
0
        // curmats may be null
        Point CreateMaterialNodes(List <ExtPictureBox.ImageElement> pc, JournalScan sn, MaterialCommoditiesList curmats, HistoryList hl, Point matpos, Size matsize)
        {
            Point startpos  = matpos;
            Point maximum   = matpos;
            int   noperline = 0;

            bool noncommon = ShowMaterialsRare;

            string matclicktext = sn.DisplayMaterials(2, curmats, hl.GetLast?.MaterialCommodity);

            foreach (KeyValuePair <string, double> sd in sn.Materials)
            {
                string tooltip = sn.DisplayMaterial(sd.Key, sd.Value, curmats, hl.GetLast?.MaterialCommodity);

                Color  fillc = Color.Yellow;
                string abv   = sd.Key.Substring(0, 1);

                MaterialCommodityData mc = MaterialCommodityData.GetByFDName(sd.Key);

                if (mc != null)
                {
                    abv   = mc.Shortname;
                    fillc = mc.Colour;

                    if (HideFullMaterials)                 // check full
                    {
                        int?limit = mc.MaterialLimit();
                        MaterialCommodities matnow = curmats?.Find(mc);  // allow curmats = null

                        // debug if (matnow != null && mc.shortname == "Fe")  matnow.count = 10000;

                        if (matnow != null && limit != null && matnow.Count >= limit)        // and limit
                        {
                            continue;
                        }
                    }

                    if (noncommon && mc.IsCommonMaterial)
                    {
                        continue;
                    }
                }

                CreateMaterialImage(pc, matpos, matsize, abv, tooltip + "\n\n" + "All " + matclicktext, tooltip, fillc, Color.Black);

                maximum = new Point(Math.Max(maximum.X, matpos.X + matsize.Width), Math.Max(maximum.Y, matpos.Y + matsize.Height));

                if (++noperline == 4)
                {
                    matpos    = new Point(startpos.X, matpos.Y + matsize.Height + materiallinespacerxy);
                    noperline = 0;
                }
                else
                {
                    matpos.X += matsize.Width + materiallinespacerxy;
                }
            }

            return(maximum);
        }
Esempio n. 6
0
        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 = "";
        }
 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();
 }
Esempio n. 8
0
        public string DisplayMaterial(string name, double percent, MaterialCommoditiesList historicmatlist = null, MaterialCommoditiesList currentmatlist = null)
        {
            StringBuilder scanText = new StringBuilder();

            MaterialCommodityData mc = MaterialCommodityData.GetCachedMaterial(name);

            if (mc != null && (historicmatlist != null || currentmatlist != null))
            {
                MaterialCommodities historic = historicmatlist?.Find(mc.name);
                MaterialCommodities current  = ReferenceEquals(historicmatlist, currentmatlist) ? null : currentmatlist?.Find(mc.name);
                int?limit = MaterialCommodityData.MaterialLimit(mc);

                string matinfo = historic?.count.ToString() ?? "0";
                if (limit != null)
                {
                    matinfo += "/" + limit.Value.ToString();
                }

                if (current != null && (historic == null || historic.count != current.count))
                {
                    matinfo += " Cur " + current.count.ToString();
                }

                scanText.AppendFormat("{0} ({1}) {2} {3}% {4}\n", mc.name, mc.shortname, mc.type, percent.ToString("N1"), matinfo);
            }
            else
            {
                scanText.AppendFormat("{0} {1}%\n", System.Threading.Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(name.ToLower()),
                                      percent.ToString("N1"));
            }

            return(scanText.ToNullSafeString());
        }
Esempio n. 9
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();
 }
Esempio n. 10
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
        }
 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();
 }
        }                                                               // 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;
                    }
                }
            }
        }
Esempio n. 13
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();
 }
Esempio n. 14
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();
 }
Esempio n. 15
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();
        }
Esempio n. 16
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);
                }
            }
Esempio n. 17
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);
                }
            }
Esempio n. 18
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) + "; ";
                }
            }
        }
Esempio n. 19
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 = "";
        }
        public override void FillInformation(out string info, out string detailed)
        {
            MaterialCommodityData mcd = MaterialCommodityData.GetByFDName(Type);

            if (mcd != null)
            {
                info = BaseUtils.FieldBuilder.Build("", Type_Localised, "< (", mcd.TranslatedCategory, ";)", mcd.TranslatedType, "Total:".T(EDTx.JournalEntry_Total), Total);
            }
            else
            {
                info = Type_Localised;
            }
            detailed = "";
        }
Esempio n. 21
0
 public bool FromString(string s)                    // serialise from string
 {
     string[] parts = s.Split(',');
     if (parts.Length == 4)
     {
         fromelement = MaterialCommodityData.GetByFDName(parts[0]);
         element     = MaterialCommodityData.GetByFDName(parts[1]);
         return(fromelement != null && element != null && parts[2].InvariantParse(out offer) && parts[3].InvariantParse(out receive));
     }
     else
     {
         return(false);
     }
 }
Esempio n. 22
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();
 }
Esempio n. 23
0
        public override void FillInformation(out string info, out string detailed)
        {
            MaterialCommodityData mcd = MaterialCommodityData.GetByFDName(Name);

            if (mcd != null)
            {
                info = BaseUtils.FieldBuilder.Build("", FriendlyName, "< (", mcd.TranslatedCategory, ";)", mcd.TranslatedType, "; items".T(EDTx.JournalEntry_MatC), Count, "Total: ".T(EDTx.JournalEntry_Total), Total);
            }
            else
            {
                info = BaseUtils.FieldBuilder.Build("", FriendlyName, "< ; items".T(EDTx.JournalEntry_MatC), Count);
            }

            detailed = "";
        }
Esempio n. 24
0
        public override void FillInformation(out string info, out string detailed)
        {
            info = BaseUtils.FieldBuilder.Build("", FriendlyName);
            MaterialCommodityData mcd = MaterialCommodityData.GetByFDName(Name);

            if (mcd != null)
            {
                info += BaseUtils.FieldBuilder.Build(" (", mcd.TranslatedCategory, ";)", mcd.TranslatedType);
            }

            if (DiscoveryNumber > 0)
            {
                info += string.Format(", Discovery {0}".T(EDTx.JournalMaterialDiscovered_DN), DiscoveryNumber);
            }
            detailed = "";
        }
            public int[] content;                  // number in each cat, high/med/low

            public static MaterialsFound Find(string fdname, List <MaterialsFound> list)
            {
                MaterialsFound mat = list.Find(x => x.matnamefd2.Equals(fdname, StringComparison.InvariantCultureIgnoreCase));

                if (mat == null)
                {
                    mat                   = new MaterialsFound();
                    mat.matnamefd2        = fdname;
                    mat.friendlyname      = MaterialCommodityData.GetByFDName(fdname)?.Name ?? fdname;
                    mat.prospectedamounts = new List <double>();
                    mat.content           = new int[3];
                    list.Add(mat);
                }

                return(mat);
            }
        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
                                                 } }
            }
            ;
        }
        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);
            }
        }
Esempio n. 28
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
        }
Esempio n. 29
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 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();
                }
            }
        }