示例#1
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();

            ShipModules = new List <ShipModule>();

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

            if (jmodules != null)       // paranoia
            {
                foreach (JObject jo in jmodules)
                {
                    ShipModule module = new ShipModule(JournalFieldNaming.GetBetterSlotName(jo["Slot"].Str()),
                                                       JournalFieldNaming.NormaliseFDSlotName(jo["Slot"].Str()),
                                                       JournalFieldNaming.GetBetterItemNameLoadout(jo["Item"].Str()),
                                                       JournalFieldNaming.NormaliseFDItemName(jo["Item"].Str()),
                                                       jo["On"].BoolNull(),
                                                       jo["Priority"].IntNull(),
                                                       jo["AmmoInClip"].IntNull(),
                                                       jo["AmmoInHopper"].IntNull(),
                                                       jo["EngineerBlueprint"].Str().SplitCapsWordFull(),
                                                       jo["EngineerLevel"].IntNull(),
                                                       jo["Health"].DoubleNull(),
                                                       jo["Value"].IntNull());
                    ShipModules.Add(module);
                }

                ShipModules = ShipModules.OrderBy(x => x.Slot).ToList();            // sort for presentation..
            }
        }