Ejemplo n.º 1
0
            public string TransferTimeString;        // computed

            public void Normalise()
            {
                Name               = JournalFieldNaming.GetBetterItemNameEvents(Name);
                Name_Localised     = Name_Localised.Alt(Name);
                TransferTimeSpan   = new System.TimeSpan((int)(TransferTime / 60 / 60), (int)((TransferTime / 60) % 60), (int)(TransferTime % 60));
                TransferTimeString = TransferTimeSpan.ToString();
            }
Ejemplo n.º 2
0
 public JournalAfmuRepairs(JObject evt) : base(evt, JournalTypeEnum.AfmuRepairs)
 {
     Module          = JournalFieldNaming.GetBetterItemNameEvents(evt["Module"].Str());
     ModuleLocalised = evt["Module_Localised"].Str().Alt(Module);
     FullyRepaired   = evt["FullyRepaired"].Bool();
     Health          = evt["Health"].Float() * 100.0F;
 }
Ejemplo n.º 3
0
        public JournalModuleRetrieve(JObject evt) : base(evt, JournalTypeEnum.ModuleRetrieve)
        {
            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();

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

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

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

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

            Hot     = evt["Hot"].BoolNull();
            Level   = evt["Level"].IntNull();
            Quality = evt["Quality"].DoubleNull();

            MarketID = evt["MarketID"].LongNull();
        }
Ejemplo n.º 4
0
        public void Rescan(JObject evt)
        {
            ShipModules = new List <JournalLoadout.ShipModule>();

            JArray jmodules = (JArray)evt["Modules"];

            if (jmodules != null)
            {
                foreach (JObject jo in jmodules)
                {
                    JournalLoadout.ShipModule module = new JournalLoadout.ShipModule(
                        JournalFieldNaming.GetBetterSlotName(jo["Slot"].Str()),
                        JournalFieldNaming.NormaliseFDSlotName(jo["Slot"].Str()),
                        JournalFieldNaming.GetBetterItemNameEvents(jo["Item"].Str()),
                        JournalFieldNaming.NormaliseFDItemName(jo["Item"].Str()),
                        null,                                // unknown
                        jo["Priority"].IntNull(),
                        null,                                //aclip
                        null,                                //ahooper
                        null,                                //health
                        null,                                //value
                        jo["Power"].DoubleNull(),
                        null                                 //engineering
                        );
                    ShipModules.Add(module);
                }

                ShipModules = ShipModules.OrderBy(x => x.Slot).ToList();            // sort for presentation..
            }
        }
Ejemplo n.º 5
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().Alt(BuyItem);
            BuyPrice         = evt["BuyPrice"].Long();

            ShipFD = evt["Ship"].Str();
            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().Alt(SellItem);
            SellPrice         = evt["SellPrice"].LongNull();

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

            MarketID = evt["MarketID"].LongNull();
        }
Ejemplo n.º 6
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().Alt(FromItem);

            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().Alt(ToItem);        // if ToItem is null or not there, this won't be

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

            MarketID = evt["MarketID"].LongNull();
        }
Ejemplo n.º 7
0
        public JournalRepair(JObject evt) : base(evt, JournalTypeEnum.Repair)
        {
            Item          = JournalFieldNaming.GetBetterItemNameEvents(evt["Item"].Str());
            ItemLocalised = evt["Item_Localised"].Str();
            if (ItemLocalised.Length == 0)                          // bug frontier in earlier 2.0 journals, no localised
            {
                ItemLocalised = Item;
            }

            Cost = evt["Cost"].Long();
        }
Ejemplo n.º 8
0
        public JournalModuleSellRemote(JObject evt) : base(evt, JournalTypeEnum.ModuleSellRemote)
        {
            Slot = evt["StorageSlot"].Str();         // this is NOT a ship slot name, just a index

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

            SellPrice = evt["SellPrice"].Long();
            Ship      = JournalFieldNaming.GetBetterShipName(evt["Ship"].Str());
            ShipId    = evt["ShipID"].Int();
            ServerId  = evt["ServerId"].Int();
        }
Ejemplo n.º 9
0
        public JournalRebootRepair(JObject evt) : base(evt, JournalTypeEnum.RebootRepair)
        {
            Modules = evt["Modules"]?.ToObjectProtected <string[]>();

            if (Modules != null)
            {
                FriendlyModules = new string[Modules.Length];
                for (int i = 0; i < Modules.Length; i++)
                {
                    FriendlyModules[i] = JournalFieldNaming.GetBetterItemNameEvents(Modules[i]);
                }
            }
        }
        public JournalFetchRemoteModule(JObject evt) : base(evt, JournalTypeEnum.FetchRemoteModule)
        {
            StorageSlot = evt["StorageSlot"].Str();          // Slot number, not a slot on our ship

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

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

            Ship     = JournalFieldNaming.GetBetterShipName(evt["Ship"].Str());
            ShipId   = evt["ShipID"].Int();
            ServerId = evt["ServerId"].Int();
        }
Ejemplo n.º 11
0
        public JournalModuleSell(JObject evt) : base(evt, JournalTypeEnum.ModuleSell)
        {
            Slot   = JournalFieldNaming.GetBetterSlotName(evt["Slot"].Str());
            SlotFD = JournalFieldNaming.NormaliseFDSlotName(evt["Slot"].Str());

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

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

            Ship   = JournalFieldNaming.GetBetterShipName(evt["Ship"].Str());
            ShipId = evt["ShipID"].Int();
        }
Ejemplo n.º 12
0
        public JournalMassModuleStore(JObject evt) : base(evt, JournalTypeEnum.MassModuleStore)
        {
            Ship        = JournalFieldNaming.GetBetterShipName(evt["Ship"].Str());
            ShipId      = evt["ShipID"].Int();
            ModuleItems = evt["Items"]?.ToObject <ModuleItem[]>();

            if (ModuleItems != null)
            {
                foreach (ModuleItem i in ModuleItems)
                {
                    i.Slot = JournalFieldNaming.GetBetterSlotName(i.Slot);
                    i.Name = JournalFieldNaming.GetBetterItemNameEvents(i.Name);
                }
            }
        }
 public JournalRebootRepair(JObject evt) : base(evt, JournalTypeEnum.RebootRepair)
 {
     if (!evt["Modules"].Empty())
     {
         Modules = evt.Value <JArray>("Modules").Values <string>().ToArray();
         if (Modules != null)
         {
             FriendlyModules = new string[Modules.Length];
             for (int i = 0; i < Modules.Length; i++)
             {
                 FriendlyModules[i] = JournalFieldNaming.GetBetterItemNameEvents(Modules[i]);
             }
         }
     }
 }
Ejemplo n.º 14
0
        public void Rescan(JObject evt)
        {
            StationName = evt["StationName"].Str();
            StarSystem  = evt["StarSystem"].Str();
            MarketID    = evt["MarketID"].LongNull();

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

            if (ModuleItems != null)
            {
                foreach (OutfittingModuleItem i in ModuleItems)
                {
                    i.Name = JournalFieldNaming.GetBetterItemNameEvents(i.Name);
                }
            }
        }
Ejemplo n.º 15
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);
                }
            }
        }
Ejemplo n.º 16
0
        public JournalLoadout(JObject evt) : base(evt, JournalTypeEnum.Loadout)
        {
            Ship         = JournalFieldNaming.GetBetterShipName(evt["Ship"].Str());
            ShipFD       = JournalFieldNaming.NormaliseFDShipName(evt["Ship"].Str());
            ShipId       = evt["ShipID"].Int();
            ShipName     = evt["ShipName"].Str();
            ShipIdent    = evt["ShipIdent"].Str();
            HullValue    = evt["HullValue"].LongNull();
            ModulesValue = evt["ModulesValue"].LongNull();
            Rebuy        = evt["Rebuy"].LongNull();

            ShipModules = new List <ShipModule>();

            JArray jmodules = (JArray)evt["Modules"];

            if (jmodules != null)       // paranoia
            {
                foreach (JObject jo in jmodules)
                {
                    JournalEngineerCraftBase.EngineeringData engineering = null;

                    JObject jeng = (JObject)jo["Engineering"];
                    if (jeng != null)
                    {
                        engineering = new JournalEngineerCraftBase.EngineeringData(jeng);
                    }

                    ShipModule module = new ShipModule(JournalFieldNaming.GetBetterSlotName(jo["Slot"].Str()),
                                                       JournalFieldNaming.NormaliseFDSlotName(jo["Slot"].Str()),
                                                       JournalFieldNaming.GetBetterItemNameEvents(jo["Item"].Str()),
                                                       JournalFieldNaming.NormaliseFDItemName(jo["Item"].Str()),
                                                       jo["On"].BoolNull(),
                                                       jo["Priority"].IntNull(),
                                                       jo["AmmoInClip"].IntNull(),
                                                       jo["AmmoInHopper"].IntNull(),
                                                       jo["Health"].DoubleNull(),
                                                       jo["Value"].IntNull(),
                                                       null,   //power not received here
                                                       engineering);
                    ShipModules.Add(module);
                }

                ShipModules = ShipModules.OrderBy(x => x.Slot).ToList();            // sort for presentation..
            }
        }
Ejemplo n.º 17
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();
                }
            }
        }
Ejemplo n.º 18
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();
        }
Ejemplo n.º 19
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"]?.ToObjectProtected <OutfittingModuleItem[]>();

            if (ModuleItems != null)
            {
                foreach (OutfittingModuleItem i in ModuleItems)
                {
                    i.FDName = i.Name;
                    i.Name   = JournalFieldNaming.GetBetterItemNameEvents(i.Name);
                }
            }
        }
Ejemplo n.º 20
0
        public JournalEngineerCraftBase(JObject evt, JournalTypeEnum en) : base(evt, en)
        {
            Slot   = JournalFieldNaming.GetBetterSlotName(evt["Slot"].Str());
            SlotFD = JournalFieldNaming.NormaliseFDSlotName(evt["Slot"].Str());

            Module   = JournalFieldNaming.GetBetterItemNameEvents(evt["Module"].Str());
            ModuleFD = JournalFieldNaming.NormaliseFDItemName(evt["Module"].Str());

            Engineering = new 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?.ToObject <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();
                    }
                }
            }
        }
Ejemplo n.º 21
0
 public JournalRepair(JObject evt) : base(evt, JournalTypeEnum.Repair)
 {
     Item          = JournalFieldNaming.GetBetterItemNameEvents(evt["Item"].Str());
     ItemLocalised = evt["Item_Localised"].Str().Alt(Item);
     Cost          = evt["Cost"].Long();
 }
Ejemplo n.º 22
0
        public static void ReadJSON(string file)          //DEBUG ONLY FROM COMMAND LINE
        {
            Stopwatch t = new Stopwatch();

            t.Start();

            System.Diagnostics.Debug.WriteLine("HelloThere123_HowAreYou AndSome1232 and some more".SplitCapsWord());

            string st = "$int_stellarbodydiscoveryscanner_medium_class2";

            for (long i = 0; i < 56000; i++)
            {
                string p = JournalFieldNaming.GetBetterItemNameEvents(st);
            }

            long elapsed = t.ElapsedMilliseconds;

            System.Diagnostics.Debug.WriteLine("Elapsed " + elapsed);


            System.IO.StreamReader filejr = new System.IO.StreamReader(file);
            string line;

            Dictionary <string, string> items = new Dictionary <string, string>();

            while ((line = filejr.ReadLine()) != null)
            {
                if (line.Equals("END"))
                {
                    break;
                }
                //System.Diagnostics.Trace.WriteLine(line);

                if (line.Length > 0)
                {
                    JObject jo = (JObject)JObject.Parse(line);

                    string s = jo["BuyItem"].StrNull();

                    if (s != null)
                    {
                        items[s] = s;
                    }

                    s = jo["SellItem"].StrNull();

                    if (s != null)
                    {
                        items[s] = s;
                    }

                    s = jo["Name"].StrNull();

                    if (s != null)
                    {
                        items[s] = s;
                    }

                    s = jo["FromItem"].StrNull();

                    if (s != null)
                    {
                        items[s] = s;
                    }
                    s = jo["ToItem"].StrNull();

                    if (s != null)
                    {
                        items[s] = s;
                    }
                }
            }

            Dictionary <string, string> cutitems = new Dictionary <string, string>();

            foreach (string i in items.Keys.ToList())
            {
                if (i.Length > 5)
                {
                    string s          = i.Substring(5);
                    int    underscore = s.IndexOf('_');
                    s           = s.Substring(0, underscore);
                    cutitems[s] = s;
                }
            }
            List <string> l = cutitems.Keys.ToList();

            l.Sort();
            foreach (string i in l)
            {
                System.Diagnostics.Debug.WriteLine("            {\"" + i + "\",     \"" + i + "\"},");
            }
        }
Ejemplo n.º 23
0
 public JournalTechnologyBroker(JObject evt) : base(evt, JournalTypeEnum.TechnologyBroker)
 {
     ItemUnlocked    = JournalFieldNaming.GetBetterItemNameEvents(evt["ItemUnlocked"].Str());
     IngredientsList = evt["Ingredients"]?.ToObject <Ingredients[]>();
 }